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_TOOL_BAR_FACTORY_HXX
25 #define SD_FRAMEWORK_BASIC_TOOL_BAR_FACTORY_HXX
26 
27 #include "MutexOwner.hxx"
28 
29 #include <com/sun/star/lang/XInitialization.hpp>
30 #include <com/sun/star/uno/XComponentContext.hpp>
31 #include <com/sun/star/drawing/framework/XResourceFactory.hpp>
32 #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
33 #include <com/sun/star/drawing/framework/XResourceId.hpp>
34 #include <com/sun/star/frame/XController.hpp>
35 #include <osl/mutex.hxx>
36 #include <cppuhelper/compbase3.hxx>
37 #include <cppuhelper/basemutex.hxx>
38 
39 
40 namespace css = ::com::sun::star;
41 
42 namespace {
43 
44 typedef ::cppu::WeakComponentImplHelper3 <
45     css::drawing::framework::XResourceFactory,
46     css::lang::XInitialization,
47     css::lang::XEventListener
48     > BasicToolBarFactoryInterfaceBase;
49 
50 } // end of anonymous namespace.
51 
52 namespace sd {
53 class ViewShellBase;
54 }
55 
56 namespace sd { namespace framework {
57 
58 /** This factory provides some of the frequently used tool bars:
59         private:resource/toolbar/ViewTabBar
60 */
61 class BasicToolBarFactory
62     : protected ::cppu::BaseMutex,
63       public BasicToolBarFactoryInterfaceBase
64 {
65 public:
66     BasicToolBarFactory (
67         const css::uno::Reference<com::sun::star::uno::XComponentContext>& rxContext);
68     virtual ~BasicToolBarFactory (void);
69 
70     virtual void SAL_CALL disposing (void);
71 
72 
73     // ToolBarFactory
74 
75     virtual css::uno::Reference<com::sun::star::drawing::framework::XResource> SAL_CALL
76         createResource (
77             const css::uno::Reference<
78                 css::drawing::framework::XResourceId>& rxToolBarId)
79         throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException);
80 
81     virtual void SAL_CALL
82         releaseResource (
83             const css::uno::Reference<com::sun::star::drawing::framework::XResource>&
84                 rxToolBar)
85         throw (css::uno::RuntimeException);
86 
87 
88     // XInitialization
89 
90     virtual void SAL_CALL initialize(
91         const css::uno::Sequence<com::sun::star::uno::Any>& aArguments)
92         throw (css::uno::Exception, css::uno::RuntimeException);
93 
94 
95     // lang::XEventListener
96 
97     virtual void SAL_CALL disposing (
98         const css::lang::EventObject& rEventObject)
99         throw (css::uno::RuntimeException);
100 
101 private:
102     css::uno::Reference<css::drawing::framework::XConfigurationController> mxConfigurationController;
103     css::uno::Reference<css::frame::XController> mxController;
104     ViewShellBase* mpViewShellBase;
105 
106     void Shutdown (void);
107 
108     void ThrowIfDisposed (void) const
109         throw (css::lang::DisposedException);
110 };
111 
112 } } // end of namespace sd::framework
113 
114 #endif
115