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     There are two left panes because this is (seems to be) the only way to
71     show different titles for the left pane in Draw and Impress.
72 */
73 class BasicPaneFactory
74     : private ::cppu::BaseMutex,
75       public BasicPaneFactoryInterfaceBase
76 {
77 public:
78     BasicPaneFactory (
79         const css::uno::Reference<css::uno::XComponentContext>& rxContext);
80     virtual ~BasicPaneFactory (void);
81 
82     virtual void SAL_CALL disposing (void);
83 
84 
85     // XInitialization
86 
87     virtual void SAL_CALL initialize(
88         const css::uno::Sequence<css::uno::Any>& aArguments)
89         throw (css::uno::Exception, css::uno::RuntimeException);
90 
91 
92     // XResourceFactory
93 
94     virtual css::uno::Reference<css::drawing::framework::XResource>
95         SAL_CALL createResource (
96             const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId)
97         throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException);
98 
99     virtual void SAL_CALL
100         releaseResource (
101             const css::uno::Reference<css::drawing::framework::XResource>& rxPane)
102         throw (css::uno::RuntimeException);
103 
104 
105     // XConfigurationChangeListener
106 
107     virtual void SAL_CALL notifyConfigurationChange (
108         const css::drawing::framework::ConfigurationChangeEvent& rEvent)
109         throw (css::uno::RuntimeException);
110 
111 
112     // lang::XEventListener
113 
114     virtual void SAL_CALL disposing (
115         const css::lang::EventObject& rEventObject)
116         throw (css::uno::RuntimeException);
117 
118 private:
119     css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
120     css::uno::WeakReference<css::drawing::framework::XConfigurationController>
121         mxConfigurationControllerWeak;
122     css::uno::WeakReference<css::frame::XController> mxControllerWeak;
123     ViewShellBase* mpViewShellBase;
124     class PaneDescriptor;
125     class PaneContainer;
126     ::boost::scoped_ptr<PaneContainer> mpPaneContainer;
127     bool mbFirstUpdateSeen;
128     ::boost::shared_ptr<UpdateLockManager> mpUpdateLockManager;
129 
130     /** Create a new instance of FrameWindowPane.
131         @param rPaneId
132             There is only one frame window so this id is just checked to
133             have the correct value.
134     */
135     css::uno::Reference<css::drawing::framework::XResource>
136         CreateFrameWindowPane (
137             const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId);
138 
139     /** Create a new pane that represents the center pane in full screen
140         mode.
141     */
142     css::uno::Reference<css::drawing::framework::XResource>
143         CreateFullScreenPane (
144             const css::uno::Reference<css::uno::XComponentContext>& rxComponentContext,
145             const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId);
146 
147     /** Create a new instance of ChildWindowPane.
148         @param rPaneId
149             The ResourceURL member defines which side pane to create.
150     */
151     css::uno::Reference<css::drawing::framework::XResource>
152         CreateChildWindowPane (
153             const css::uno::Reference<
154                 css::drawing::framework::XResourceId>& rxPaneId,
155             const PaneDescriptor& rDescriptor);
156 
157     void ThrowIfDisposed (void) const
158         throw (css::lang::DisposedException);
159 };
160 
161 } } // end of namespace sd::framework
162 
163 #endif
164