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