1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef __FRAMEWORK_UICONFIGURATION_WINDOWSTATECONFIGURATION_HXX_
29 #define __FRAMEWORK_UICONFIGURATION_WINDOWSTATECONFIGURATION_HXX_
30 
31 /** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble
32                with solaris headers ...
33 */
34 #include <vector>
35 #include <list>
36 #include <hash_map>
37 
38 //_________________________________________________________________________________________________________________
39 //	my own includes
40 //_________________________________________________________________________________________________________________
41 #include <threadhelp/threadhelpbase.hxx>
42 #include <macros/generic.hxx>
43 #include <macros/xinterface.hxx>
44 #include <macros/xtypeprovider.hxx>
45 #include <macros/xserviceinfo.hxx>
46 #include <stdtypes.h>
47 
48 //_________________________________________________________________________________________________________________
49 //	interface includes
50 //_________________________________________________________________________________________________________________
51 #include <com/sun/star/lang/XServiceInfo.hpp>
52 #include <com/sun/star/lang/XTypeProvider.hpp>
53 #include <com/sun/star/container/XNameAccess.hpp>
54 #include <com/sun/star/frame/XModuleManager.hpp>
55 
56 //_________________________________________________________________________________________________________________
57 //	other includes
58 //_________________________________________________________________________________________________________________
59 #include <cppuhelper/implbase2.hxx>
60 #include <rtl/ustring.hxx>
61 
62 namespace framework
63 {
64 
65 #define WINDOWSTATE_PROPERTY_LOCKED         "Locked"
66 #define WINDOWSTATE_PROPERTY_DOCKED         "Docked"
67 #define WINDOWSTATE_PROPERTY_VISIBLE        "Visible"
68 #define WINDOWSTATE_PROPERTY_DOCKINGAREA    "DockingArea"
69 #define WINDOWSTATE_PROPERTY_DOCKPOS        "DockPos"
70 #define WINDOWSTATE_PROPERTY_DOCKSIZE       "DockSize"
71 #define WINDOWSTATE_PROPERTY_POS            "Pos"
72 #define WINDOWSTATE_PROPERTY_SIZE           "Size"
73 #define WINDOWSTATE_PROPERTY_UINAME         "UIName"
74 #define WINDOWSTATE_PROPERTY_INTERNALSTATE  "InternalState"
75 #define WINDOWSTATE_PROPERTY_STYLE          "Style"
76 #define WINDOWSTATE_PROPERTY_CONTEXT        "ContextSensitive"
77 #define WINDOWSTATE_PROPERTY_HIDEFROMENU    "HideFromToolbarMenu"
78 #define WINDOWSTATE_PROPERTY_NOCLOSE        "NoClose"
79 #define WINDOWSTATE_PROPERTY_SOFTCLOSE      "SoftClose"
80 #define WINDOWSTATE_PROPERTY_CONTEXTACTIVE  "ContextActive"
81 
82 class ConfigurationAccess_Windows;
83 class WindowStateConfiguration :  private ThreadHelpBase						,	// Struct for right initalization of mutex member! Must be first of baseclasses.
84 							      public ::cppu::WeakImplHelper2< ::com::sun::star::container::XNameAccess, css::lang::XServiceInfo>
85 {
86 	public:
87 		WindowStateConfiguration( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
88 		virtual ~WindowStateConfiguration();
89 
90         //  XInterface, XTypeProvider, XServiceInfo
91         FWK_DECLARE_XINTERFACE
92         FWK_DECLARE_XTYPEPROVIDER
93         DECLARE_XSERVICEINFO
94 
95         // XNameAccess
96         virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
97             throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
98 
99         virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames()
100             throw (::com::sun::star::uno::RuntimeException);
101 
102         virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
103             throw (::com::sun::star::uno::RuntimeException);
104 
105         // XElementAccess
106         virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
107             throw (::com::sun::star::uno::RuntimeException);
108         virtual sal_Bool SAL_CALL hasElements()
109             throw (::com::sun::star::uno::RuntimeException);
110 
111         typedef ::std::hash_map< ::rtl::OUString,
112                                  ::rtl::OUString,
113                                  OUStringHashCode,
114                                  ::std::equal_to< ::rtl::OUString > > ModuleToWindowStateFileMap;
115 
116         typedef ::std::hash_map< ::rtl::OUString,
117                                  ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >,
118                                  OUStringHashCode,
119 								 ::std::equal_to< ::rtl::OUString > > ModuleToWindowStateConfigHashMap;
120 
121     private:
122         sal_Bool                                                                            m_bConfigRead;
123         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >    m_xServiceManager;
124         ModuleToWindowStateFileMap                                                          m_aModuleToFileHashMap;
125         ModuleToWindowStateConfigHashMap                                                    m_aModuleToWindowStateHashMap;
126         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleManager;
127 };
128 
129 } // namespace framework
130 
131 #endif // __FRAMEWORK_UIELEMENT_WINDOWSTATECONFIGURATION_HXX_
132