Updated core
[LibreOffice.git] / sdext / source / presenter / PresenterPaneFactory.hxx
blobec2db5a54357e05a9ad1cea1c84ae16579c1cf2c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef SDEXT_PRESENTER_PANE_FACTORY_HXX
21 #define SDEXT_PRESENTER_PANE_FACTORY_HXX
23 #include <cppuhelper/compbase1.hxx>
24 #include <cppuhelper/basemutex.hxx>
25 #include <com/sun/star/frame/XController.hpp>
26 #include <com/sun/star/lang/XInitialization.hpp>
27 #include <com/sun/star/drawing/XPresenterHelper.hpp>
28 #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
29 #include <com/sun/star/drawing/framework/XPane.hpp>
30 #include <com/sun/star/drawing/framework/XResourceFactory.hpp>
31 #include <com/sun/star/uno/XComponentContext.hpp>
32 #include <rtl/ref.hxx>
33 #include <boost/scoped_ptr.hpp>
34 #include <map>
36 namespace sdext { namespace presenter {
38 class PresenterController;
40 namespace {
41 typedef ::cppu::WeakComponentImplHelper1 <
42 css::drawing::framework::XResourceFactory
43 > PresenterPaneFactoryInterfaceBase;
46 /** The PresenerPaneFactory provides a fixed set of panes.
48 In order to make the presener screen more easily extendable in the
49 future the set of supported panes could be made extendable on demand.
51 class PresenterPaneFactory
52 : public ::cppu::BaseMutex,
53 public PresenterPaneFactoryInterfaceBase
55 public:
56 static const OUString msCurrentSlidePreviewPaneURL;
57 static const OUString msNextSlidePreviewPaneURL;
58 static const OUString msNotesPaneURL;
59 static const OUString msToolBarPaneURL;
60 static const OUString msSlideSorterPaneURL;
61 static const OUString msHelpPaneURL;
62 static const OUString msOverlayPaneURL;
64 /** Create a new instance of this class and register it as resource
65 factory in the drawing framework of the given controller.
66 This registration keeps it alive. When the drawing framework is
67 shut down and releases its reference to the factory then the factory
68 is destroyed.
70 static css::uno::Reference<css::drawing::framework::XResourceFactory> Create (
71 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
72 const css::uno::Reference<css::frame::XController>& rxController,
73 const ::rtl::Reference<PresenterController>& rpPresenterController);
74 virtual ~PresenterPaneFactory (void);
76 static OUString getImplementationName_static (void);
77 static css::uno::Sequence< OUString > getSupportedServiceNames_static (void);
78 static css::uno::Reference<css::uno::XInterface> Create(
79 const css::uno::Reference<css::uno::XComponentContext>& rxContext)
80 SAL_THROW((css::uno::Exception));
82 virtual void SAL_CALL disposing (void)
83 throw (css::uno::RuntimeException);
85 // XResourceFactory
87 virtual css::uno::Reference<css::drawing::framework::XResource>
88 SAL_CALL createResource (
89 const ::com::sun::star::uno::Reference<
90 com::sun::star::drawing::framework::XResourceId>& rxPaneId)
91 throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException);
93 virtual void SAL_CALL
94 releaseResource (
95 const ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResource>&
96 rxPane)
97 throw (::com::sun::star::uno::RuntimeException);
99 private:
100 css::uno::WeakReference<css::uno::XComponentContext> mxComponentContextWeak;
101 css::uno::WeakReference<css::drawing::framework::XConfigurationController>
102 mxConfigurationControllerWeak;
103 ::rtl::Reference<PresenterController> mpPresenterController;
104 typedef ::std::map<OUString, css::uno::Reference<css::drawing::framework::XResource> >
105 ResourceContainer;
106 ::boost::scoped_ptr<ResourceContainer> mpResourceCache;
108 PresenterPaneFactory (
109 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
110 const ::rtl::Reference<PresenterController>& rpPresenterController);
112 void Register (const css::uno::Reference<css::frame::XController>& rxController);
114 css::uno::Reference<css::drawing::framework::XResource> CreatePane (
115 const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId,
116 const OUString& rsTitle);
117 css::uno::Reference<css::drawing::framework::XResource> CreatePane (
118 const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId,
119 const OUString& rsTitle,
120 const css::uno::Reference<css::drawing::framework::XPane>& rxParentPane,
121 const bool bIsSpritePane);
123 void ThrowIfDisposed (void) const throw (::com::sun::star::lang::DisposedException);
128 #endif
130 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */