xref: /AOO41X/main/sd/source/ui/framework/factories/BasicPaneFactory.hxx (revision b5da552ccefc4034e06a43bfae43fb8a8b64a7ad)
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 SD_FRAMEWORK_BASIC_PANE_FACTORY_HXX
25 #define SD_FRAMEWORK_BASIC_PANE_FACTORY_HXX
26 
27 #include "MutexOwner.hxx"
28 
29 #include <com/sun/star/drawing/framework/XResourceFactory.hpp>
30 #include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp>
31 #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
32 #include <com/sun/star/frame/XController.hpp>
33 #include <com/sun/star/lang/XInitialization.hpp>
34 #include <com/sun/star/uno/XComponentContext.hpp>
35 #include <osl/mutex.hxx>
36 #include <cppuhelper/basemutex.hxx>
37 #include <cppuhelper/compbase3.hxx>
38 #include "UpdateLockManager.hxx"
39 
40 
41 #include <boost/scoped_ptr.hpp>
42 #include <boost/shared_ptr.hpp>
43 
44 namespace css = ::com::sun::star;
45 
46 
47 namespace {
48 
49 typedef ::cppu::WeakComponentImplHelper3 <
50     css::lang::XInitialization,
51     css::drawing::framework::XResourceFactory,
52     css::drawing::framework::XConfigurationChangeListener
53     > BasicPaneFactoryInterfaceBase;
54 
55 } // end of anonymous namespace.
56 
57 
58 namespace sd {
59 
60 class ViewShellBase;
61 }
62 
63 namespace sd { namespace framework {
64 
65 /** This factory provides the frequently used standard panes
66         private:resource/pane/CenterPane
67         private:resource/pane/FullScreenPane
68         private:resource/pane/LeftImpressPane
69         private:resource/pane/LeftDrawPane
70         private:resource/pane/RightPane
71     There are two left panes because this is (seems to be) the only way to
72     show different titles for the left pane in Draw and Impress.
73 */
74 class BasicPaneFactory
75     : private ::cppu::BaseMutex,
76       public BasicPaneFactoryInterfaceBase
77 {
78 public:
79     BasicPaneFactory (
80         const css::uno::Reference<css::uno::XComponentContext>& rxContext);
81     virtual ~BasicPaneFactory (void);
82 
83     virtual void SAL_CALL disposing (void);
84 
85 
86     // XInitialization
87 
88     virtual void SAL_CALL initialize(
89         const css::uno::Sequence<css::uno::Any>& aArguments)
90         throw (css::uno::Exception, css::uno::RuntimeException);
91 
92 
93     // XResourceFactory
94 
95     virtual css::uno::Reference<css::drawing::framework::XResource>
96         SAL_CALL createResource (
97             const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId)
98         throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException);
99 
100     virtual void SAL_CALL
101         releaseResource (
102             const css::uno::Reference<css::drawing::framework::XResource>& rxPane)
103         throw (css::uno::RuntimeException);
104 
105 
106     // XConfigurationChangeListener
107 
108     virtual void SAL_CALL notifyConfigurationChange (
109         const css::drawing::framework::ConfigurationChangeEvent& rEvent)
110         throw (css::uno::RuntimeException);
111 
112 
113     // lang::XEventListener
114 
115     virtual void SAL_CALL disposing (
116         const css::lang::EventObject& rEventObject)
117         throw (css::uno::RuntimeException);
118 
119 private:
120     css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
121     css::uno::WeakReference<css::drawing::framework::XConfigurationController>
122         mxConfigurationControllerWeak;
123     css::uno::WeakReference<css::frame::XController> mxControllerWeak;
124     ViewShellBase* mpViewShellBase;
125     class PaneDescriptor;
126     class PaneContainer;
127     ::boost::scoped_ptr<PaneContainer> mpPaneContainer;
128     bool mbFirstUpdateSeen;
129     ::boost::shared_ptr<UpdateLockManager> mpUpdateLockManager;
130 
131     /** Create a new instance of FrameWindowPane.
132         @param rPaneId
133             There is only one frame window so this id is just checked to
134             have the correct value.
135     */
136     css::uno::Reference<css::drawing::framework::XResource>
137         CreateFrameWindowPane (
138             const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId);
139 
140     /** Create a new pane that represents the center pane in full screen
141         mode.
142     */
143     css::uno::Reference<css::drawing::framework::XResource>
144         CreateFullScreenPane (
145             const css::uno::Reference<css::uno::XComponentContext>& rxComponentContext,
146             const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId);
147 
148     /** Create a new instance of ChildWindowPane.
149         @param rPaneId
150             The ResourceURL member defines which side pane to create.
151     */
152     css::uno::Reference<css::drawing::framework::XResource>
153         CreateChildWindowPane (
154             const css::uno::Reference<
155                 css::drawing::framework::XResourceId>& rxPaneId,
156             const PaneDescriptor& rDescriptor);
157 
158     void ThrowIfDisposed (void) const
159         throw (css::lang::DisposedException);
160 };
161 
162 } } // end of namespace sd::framework
163 
164 #endif
165