1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef __FRAMEWORK_UICONFIGURATION_WINDOWSTATECONFIGURATION_HXX_
25 #define __FRAMEWORK_UICONFIGURATION_WINDOWSTATECONFIGURATION_HXX_
26 
27 /** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble
28                with solaris headers ...
29 */
30 #include <vector>
31 #include <list>
32 #include <hash_map>
33 
34 //_________________________________________________________________________________________________________________
35 //	my own includes
36 //_________________________________________________________________________________________________________________
37 #include <threadhelp/threadhelpbase.hxx>
38 #include <macros/generic.hxx>
39 #include <macros/xinterface.hxx>
40 #include <macros/xtypeprovider.hxx>
41 #include <macros/xserviceinfo.hxx>
42 #include <stdtypes.h>
43 
44 //_________________________________________________________________________________________________________________
45 //	interface includes
46 //_________________________________________________________________________________________________________________
47 #include <com/sun/star/lang/XServiceInfo.hpp>
48 #include <com/sun/star/lang/XTypeProvider.hpp>
49 #include <com/sun/star/container/XNameAccess.hpp>
50 #include <com/sun/star/frame/XModuleManager.hpp>
51 
52 //_________________________________________________________________________________________________________________
53 //	other includes
54 //_________________________________________________________________________________________________________________
55 #include <cppuhelper/implbase2.hxx>
56 #include <rtl/ustring.hxx>
57 
58 namespace framework
59 {
60 
61 #define WINDOWSTATE_PROPERTY_LOCKED         "Locked"
62 #define WINDOWSTATE_PROPERTY_DOCKED         "Docked"
63 #define WINDOWSTATE_PROPERTY_VISIBLE        "Visible"
64 #define WINDOWSTATE_PROPERTY_DOCKINGAREA    "DockingArea"
65 #define WINDOWSTATE_PROPERTY_DOCKPOS        "DockPos"
66 #define WINDOWSTATE_PROPERTY_DOCKSIZE       "DockSize"
67 #define WINDOWSTATE_PROPERTY_POS            "Pos"
68 #define WINDOWSTATE_PROPERTY_SIZE           "Size"
69 #define WINDOWSTATE_PROPERTY_UINAME         "UIName"
70 #define WINDOWSTATE_PROPERTY_INTERNALSTATE  "InternalState"
71 #define WINDOWSTATE_PROPERTY_STYLE          "Style"
72 #define WINDOWSTATE_PROPERTY_CONTEXT        "ContextSensitive"
73 #define WINDOWSTATE_PROPERTY_HIDEFROMENU    "HideFromToolbarMenu"
74 #define WINDOWSTATE_PROPERTY_NOCLOSE        "NoClose"
75 #define WINDOWSTATE_PROPERTY_SOFTCLOSE      "SoftClose"
76 #define WINDOWSTATE_PROPERTY_CONTEXTACTIVE  "ContextActive"
77 
78 class ConfigurationAccess_Windows;
79 class WindowStateConfiguration :  private ThreadHelpBase						,	// Struct for right initalization of mutex member! Must be first of baseclasses.
80 							      public ::cppu::WeakImplHelper2< ::com::sun::star::container::XNameAccess, css::lang::XServiceInfo>
81 {
82 	public:
83 		WindowStateConfiguration( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
84 		virtual ~WindowStateConfiguration();
85 
86         //  XInterface, XTypeProvider, XServiceInfo
87         FWK_DECLARE_XINTERFACE
88         FWK_DECLARE_XTYPEPROVIDER
89         DECLARE_XSERVICEINFO
90 
91         // XNameAccess
92         virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
93             throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
94 
95         virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames()
96             throw (::com::sun::star::uno::RuntimeException);
97 
98         virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
99             throw (::com::sun::star::uno::RuntimeException);
100 
101         // XElementAccess
102         virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
103             throw (::com::sun::star::uno::RuntimeException);
104         virtual sal_Bool SAL_CALL hasElements()
105             throw (::com::sun::star::uno::RuntimeException);
106 
107         typedef ::std::hash_map< ::rtl::OUString,
108                                  ::rtl::OUString,
109                                  rtl::OUStringHash,
110                                  ::std::equal_to< ::rtl::OUString > > ModuleToWindowStateFileMap;
111 
112         typedef ::std::hash_map< ::rtl::OUString,
113                                  ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >,
114                                  rtl::OUStringHash,
115 								 ::std::equal_to< ::rtl::OUString > > ModuleToWindowStateConfigHashMap;
116 
117     private:
118         sal_Bool                                                                            m_bConfigRead;
119         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >    m_xServiceManager;
120         ModuleToWindowStateFileMap                                                          m_aModuleToFileHashMap;
121         ModuleToWindowStateConfigHashMap                                                    m_aModuleToWindowStateHashMap;
122         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleManager;
123 };
124 
125 } // namespace framework
126 
127 #endif // __FRAMEWORK_UIELEMENT_WINDOWSTATECONFIGURATION_HXX_
128