update dev300-m58
[ooovba.git] / sdext / source / presenter / PresenterPaneFactory.hxx
blob16d6ff7dad16de4ea313cf3fc529f92411eb244d
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: PresenterPaneFactory.hxx,v $
11 * $Revision: 1.4 $
13 * This file is part of OpenOffice.org.
15 * OpenOffice.org is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 3
17 * only, as published by the Free Software Foundation.
19 * OpenOffice.org is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License version 3 for more details
23 * (a copy is included in the LICENSE file that accompanied this code).
25 * You should have received a copy of the GNU Lesser General Public License
26 * version 3 along with OpenOffice.org. If not, see
27 * <http://www.openoffice.org/license.html>
28 * for a copy of the LGPLv3 License.
30 ************************************************************************/
32 #ifndef SDEXT_PRESENTER_PANE_FACTORY_HXX
33 #define SDEXT_PRESENTER_PANE_FACTORY_HXX
35 #include <cppuhelper/compbase1.hxx>
36 #include <cppuhelper/basemutex.hxx>
37 #include <com/sun/star/frame/XController.hpp>
38 #include <com/sun/star/lang/XInitialization.hpp>
39 #include <com/sun/star/drawing/XPresenterHelper.hpp>
40 #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
41 #include <com/sun/star/drawing/framework/XPane.hpp>
42 #include <com/sun/star/drawing/framework/XResourceFactory.hpp>
43 #include <com/sun/star/uno/XComponentContext.hpp>
44 #include <rtl/ref.hxx>
45 #include <boost/scoped_ptr.hpp>
46 #include <map>
48 namespace css = ::com::sun::star;
50 namespace sdext { namespace presenter {
52 class PresenterController;
54 namespace {
55 typedef ::cppu::WeakComponentImplHelper1 <
56 css::drawing::framework::XResourceFactory
57 > PresenterPaneFactoryInterfaceBase;
61 /** The PresenerPaneFactory provides a fixed set of panes.
63 In order to make the presener screen more easily extendable in the
64 future the set of supported panes could be made extendable on demand.
66 class PresenterPaneFactory
67 : public ::cppu::BaseMutex,
68 public PresenterPaneFactoryInterfaceBase
70 public:
71 static const ::rtl::OUString msCurrentSlidePreviewPaneURL;
72 static const ::rtl::OUString msNextSlidePreviewPaneURL;
73 static const ::rtl::OUString msNotesPaneURL;
74 static const ::rtl::OUString msToolBarPaneURL;
75 static const ::rtl::OUString msSlideSorterPaneURL;
76 static const ::rtl::OUString msHelpPaneURL;
77 static const ::rtl::OUString msOverlayPaneURL;
79 /** Create a new instance of this class and register it as resource
80 factory in the drawing framework of the given controller.
81 This registration keeps it alive. When the drawing framework is
82 shut down and releases its reference to the factory then the factory
83 is destroyed.
85 static css::uno::Reference<css::drawing::framework::XResourceFactory> Create (
86 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
87 const css::uno::Reference<css::frame::XController>& rxController,
88 const ::rtl::Reference<PresenterController>& rpPresenterController);
89 virtual ~PresenterPaneFactory (void);
91 static ::rtl::OUString getImplementationName_static (void);
92 static css::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static (void);
93 static css::uno::Reference<css::uno::XInterface> Create(
94 const css::uno::Reference<css::uno::XComponentContext>& rxContext)
95 SAL_THROW((css::uno::Exception));
97 virtual void SAL_CALL disposing (void)
98 throw (css::uno::RuntimeException);
100 // XResourceFactory
102 virtual css::uno::Reference<css::drawing::framework::XResource>
103 SAL_CALL createResource (
104 const ::com::sun::star::uno::Reference<
105 com::sun::star::drawing::framework::XResourceId>& rxPaneId)
106 throw (::com::sun::star::uno::RuntimeException);
108 virtual void SAL_CALL
109 releaseResource (
110 const ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResource>&
111 rxPane)
112 throw (::com::sun::star::uno::RuntimeException);
114 private:
115 css::uno::WeakReference<css::uno::XComponentContext> mxComponentContextWeak;
116 css::uno::WeakReference<css::drawing::framework::XConfigurationController>
117 mxConfigurationControllerWeak;
118 ::rtl::Reference<PresenterController> mpPresenterController;
119 typedef ::std::map<rtl::OUString, css::uno::Reference<css::drawing::framework::XResource> >
120 ResourceContainer;
121 ::boost::scoped_ptr<ResourceContainer> mpResourceCache;
123 PresenterPaneFactory (
124 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
125 const ::rtl::Reference<PresenterController>& rpPresenterController);
127 void Register (const css::uno::Reference<css::frame::XController>& rxController);
129 css::uno::Reference<css::drawing::framework::XResource> CreatePane (
130 const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId,
131 const ::rtl::OUString& rsTitle);
132 css::uno::Reference<css::drawing::framework::XResource> CreatePane (
133 const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId,
134 const ::rtl::OUString& rsTitle,
135 const css::uno::Reference<css::drawing::framework::XPane>& rxParentPane,
136 const bool bIsSpritePane);
138 void ThrowIfDisposed (void) const throw (::com::sun::star::lang::DisposedException);
143 #endif