1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERPANEFACTORY_HXX
21 #define INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERPANEFACTORY_HXX
23 #include <cppuhelper/compbase.hxx>
24 #include <cppuhelper/basemutex.hxx>
25 #include <com/sun/star/frame/XController.hpp>
26 #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
27 #include <com/sun/star/drawing/framework/XPane.hpp>
28 #include <com/sun/star/drawing/framework/XResourceFactory.hpp>
29 #include <com/sun/star/uno/XComponentContext.hpp>
30 #include <rtl/ref.hxx>
31 #include <unotools/weakref.hxx>
35 namespace sd
{ class DrawController
; }
36 namespace sd::framework
{ class ConfigurationController
; }
38 namespace sdext::presenter
{
40 class PresenterController
;
42 typedef ::cppu::WeakComponentImplHelper
<
43 css::drawing::framework::XResourceFactory
44 > PresenterPaneFactoryInterfaceBase
;
46 /** The PresenterPaneFactory provides a fixed set of panes.
48 In order to make the presenter 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
56 static constexpr OUString msCurrentSlidePreviewPaneURL
57 = u
"private:resource/pane/Presenter/Pane1"_ustr
;
58 static constexpr OUString msNextSlidePreviewPaneURL
59 = u
"private:resource/pane/Presenter/Pane2"_ustr
;
60 static constexpr OUString msNotesPaneURL
= u
"private:resource/pane/Presenter/Pane3"_ustr
;
61 static constexpr OUString msToolBarPaneURL
= u
"private:resource/pane/Presenter/Pane4"_ustr
;
62 static constexpr OUString msSlideSorterPaneURL
63 = u
"private:resource/pane/Presenter/Pane5"_ustr
;
65 /** Create a new instance of this class and register it as resource
66 factory in the drawing framework of the given controller.
67 This registration keeps it alive. When the drawing framework is
68 shut down and releases its reference to the factory then the factory
71 static css::uno::Reference
<css::drawing::framework::XResourceFactory
> Create (
72 const css::uno::Reference
<css::uno::XComponentContext
>& rxContext
,
73 const rtl::Reference
<::sd::DrawController
>& rxController
,
74 const ::rtl::Reference
<PresenterController
>& rpPresenterController
);
75 virtual ~PresenterPaneFactory() override
;
77 virtual void SAL_CALL
disposing() override
;
81 virtual css::uno::Reference
<css::drawing::framework::XResource
>
82 SAL_CALL
createResource (
83 const css::uno::Reference
<
84 css::drawing::framework::XResourceId
>& rxPaneId
) override
;
88 const css::uno::Reference
<css::drawing::framework::XResource
>&
92 css::uno::WeakReference
<css::uno::XComponentContext
> mxComponentContextWeak
;
93 unotools::WeakReference
<sd::framework::ConfigurationController
>
94 mxConfigurationControllerWeak
;
95 ::rtl::Reference
<PresenterController
> mpPresenterController
;
96 typedef ::std::map
<OUString
, css::uno::Reference
<css::drawing::framework::XResource
> >
98 std::unique_ptr
<ResourceContainer
> mpResourceCache
;
100 PresenterPaneFactory (
101 const css::uno::Reference
<css::uno::XComponentContext
>& rxContext
,
102 ::rtl::Reference
<PresenterController
> xPresenterController
);
104 void Register (const rtl::Reference
<::sd::DrawController
>& rxController
);
106 css::uno::Reference
<css::drawing::framework::XResource
> CreatePane (
107 const css::uno::Reference
<css::drawing::framework::XResourceId
>& rxPaneId
);
108 css::uno::Reference
<css::drawing::framework::XResource
> CreatePane (
109 const css::uno::Reference
<css::drawing::framework::XResourceId
>& rxPaneId
,
110 const css::uno::Reference
<css::drawing::framework::XPane
>& rxParentPane
,
111 const bool bIsSpritePane
);
113 /// @throws css::lang::DisposedException
114 void ThrowIfDisposed() const;
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */