LibreOffice Module sd (master) 1
PresenterViewFactory.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#ifndef INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERVIEWFACTORY_HXX
21#define INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERVIEWFACTORY_HXX
22
26#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
27#include <com/sun/star/drawing/framework/XResourceFactory.hpp>
28#include <com/sun/star/drawing/framework/XView.hpp>
29#include <com/sun/star/uno/XComponentContext.hpp>
30#include <unotools/weakref.hxx>
31#include <rtl/ref.hxx>
32#include <memory>
33
34namespace sd { class DrawController; }
35
36namespace sdext::presenter {
37
38typedef ::cppu::WeakComponentImplHelper <
39 css::drawing::framework::XResourceFactory
41
45class SAL_LOPLUGIN_ANNOTATE("crosscast") CachablePresenterView
46{
47public:
48 virtual void ActivatePresenterView();
49
53 virtual void DeactivatePresenterView();
54
59 virtual void ReleaseView();
60
61protected:
62 bool mbIsPresenterViewActive;
63
64 CachablePresenterView();
65
66 ~CachablePresenterView() {}
67};
68
77 : public ::cppu::BaseMutex,
79{
80public:
81 static constexpr OUStringLiteral msCurrentSlidePreviewViewURL
82 = u"private:resource/view/Presenter/CurrentSlidePreview";
83 static constexpr OUStringLiteral msNextSlidePreviewViewURL
84 = u"private:resource/view/Presenter/NextSlidePreview";
85 static constexpr OUStringLiteral msNotesViewURL = u"private:resource/view/Presenter/Notes";
86 static constexpr OUStringLiteral msToolBarViewURL = u"private:resource/view/Presenter/ToolBar";
87 static constexpr OUStringLiteral msSlideSorterURL
88 = u"private:resource/view/Presenter/SlideSorter";
89 static constexpr OUStringLiteral msHelpViewURL = u"private:resource/view/Presenter/Help";
90
97 static css::uno::Reference<css::drawing::framework::XResourceFactory> Create (
98 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
99 const ::rtl::Reference<::sd::DrawController>& rxController,
100 const ::rtl::Reference<PresenterController>& rpPresenterController);
101 virtual ~PresenterViewFactory() override;
102
103 virtual void SAL_CALL disposing() override;
104
105 // XResourceFactory
106
107 virtual css::uno::Reference<css::drawing::framework::XResource>
108 SAL_CALL createResource (
109 const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId) override;
110
111 virtual void SAL_CALL
113 const css::uno::Reference<css::drawing::framework::XResource>& rxPane) override;
114
115private:
116 css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
117 css::uno::Reference<css::drawing::framework::XConfigurationController>
121 typedef ::std::pair<css::uno::Reference<css::drawing::framework::XView>,
122 css::uno::Reference<css::drawing::framework::XPane> > ViewResourceDescriptor;
123 typedef ::std::map<OUString, ViewResourceDescriptor> ResourceContainer;
124 std::unique_ptr<ResourceContainer> mpResourceCache;
125
127 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
128 const rtl::Reference<::sd::DrawController>& rxController,
129 ::rtl::Reference<PresenterController> pPresenterController);
130
131 void Register (const ::rtl::Reference<::sd::DrawController>& rxController);
132
133 css::uno::Reference<css::drawing::framework::XView> CreateSlideShowView(
134 const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId) const;
135
136 css::uno::Reference<css::drawing::framework::XView> CreateSlidePreviewView(
137 const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
138 const css::uno::Reference<css::drawing::framework::XPane>& rxPane) const;
139
140 css::uno::Reference<css::drawing::framework::XView> CreateToolBarView(
141 const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId) const;
142
143 css::uno::Reference<css::drawing::framework::XView> CreateNotesView(
144 const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId) const;
145
146 css::uno::Reference<css::drawing::framework::XView> CreateSlideSorterView(
147 const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId) const;
148
149 css::uno::Reference<css::drawing::framework::XView> CreateHelpView(
150 const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId) const;
151
152 css::uno::Reference<css::drawing::framework::XResource> GetViewFromCache (
153 const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
154 const css::uno::Reference<css::drawing::framework::XPane>& rxAnchorPane) const;
155 css::uno::Reference<css::drawing::framework::XResource> CreateView(
156 const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
157 const css::uno::Reference<css::drawing::framework::XPane>& rxAnchorPane);
158
160 void ThrowIfDisposed() const;
161};
162
163}
164
165#endif
166
167/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Factory of the presenter screen specific views.
css::uno::Reference< css::drawing::framework::XResource > CreateView(const css::uno::Reference< css::drawing::framework::XResourceId > &rxViewId, const css::uno::Reference< css::drawing::framework::XPane > &rxAnchorPane)
std::unique_ptr< ResourceContainer > mpResourceCache
static constexpr OUStringLiteral msCurrentSlidePreviewViewURL
css::uno::Reference< css::drawing::framework::XConfigurationController > mxConfigurationController
PresenterViewFactory(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const rtl::Reference<::sd::DrawController > &rxController, ::rtl::Reference< PresenterController > pPresenterController)
void Register(const ::rtl::Reference<::sd::DrawController > &rxController)
static constexpr OUStringLiteral msToolBarViewURL
css::uno::Reference< css::drawing::framework::XView > CreateSlideSorterView(const css::uno::Reference< css::drawing::framework::XResourceId > &rxViewId) const
css::uno::Reference< css::drawing::framework::XView > CreateToolBarView(const css::uno::Reference< css::drawing::framework::XResourceId > &rxViewId) const
virtual css::uno::Reference< css::drawing::framework::XResource > SAL_CALL createResource(const css::uno::Reference< css::drawing::framework::XResourceId > &rxViewId) override
css::uno::Reference< css::drawing::framework::XView > CreateNotesView(const css::uno::Reference< css::drawing::framework::XResourceId > &rxViewId) const
unotools::WeakReference<::sd::DrawController > mxControllerWeak
static constexpr OUStringLiteral msNotesViewURL
static constexpr OUStringLiteral msSlideSorterURL
css::uno::Reference< css::drawing::framework::XResource > GetViewFromCache(const css::uno::Reference< css::drawing::framework::XResourceId > &rxViewId, const css::uno::Reference< css::drawing::framework::XPane > &rxAnchorPane) const
::rtl::Reference< PresenterController > mpPresenterController
static constexpr OUStringLiteral msNextSlidePreviewViewURL
static constexpr OUStringLiteral msHelpViewURL
static css::uno::Reference< css::drawing::framework::XResourceFactory > Create(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const ::rtl::Reference<::sd::DrawController > &rxController, const ::rtl::Reference< PresenterController > &rpPresenterController)
Create a new instance of this class and register it as resource factory in the drawing framework of t...
css::uno::Reference< css::drawing::framework::XView > CreateHelpView(const css::uno::Reference< css::drawing::framework::XResourceId > &rxViewId) const
css::uno::Reference< css::uno::XComponentContext > mxComponentContext
css::uno::Reference< css::drawing::framework::XView > CreateSlidePreviewView(const css::uno::Reference< css::drawing::framework::XResourceId > &rxViewId, const css::uno::Reference< css::drawing::framework::XPane > &rxPane) const
virtual void SAL_CALL releaseResource(const css::uno::Reference< css::drawing::framework::XResource > &rxPane) override
::std::pair< css::uno::Reference< css::drawing::framework::XView >, css::uno::Reference< css::drawing::framework::XPane > > ViewResourceDescriptor
css::uno::Reference< css::drawing::framework::XView > CreateSlideShowView(const css::uno::Reference< css::drawing::framework::XResourceId > &rxViewId) const
virtual void SAL_CALL disposing() override
::std::map< OUString, ViewResourceDescriptor > ResourceContainer
float u
::cppu::WeakComponentImplHelper< css::drawing::framework::XResourceFactory > PresenterViewFactoryInterfaceBase
class SAL_LOPLUGIN_ANNOTATE("crosscast") CachablePresenterView
Base class for presenter views that allows the view factory to store them in a cache and reuse deacti...