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