LibreOffice Module sdext (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 
23 #include "PresenterController.hxx"
24 #include <cppuhelper/compbase.hxx>
25 #include <cppuhelper/basemutex.hxx>
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 <rtl/ref.hxx>
31 #include <memory>
32 
33 namespace sdext::presenter {
34 
35 typedef ::cppu::WeakComponentImplHelper <
36  css::drawing::framework::XResourceFactory
38 
43 {
44 public:
45  virtual void ActivatePresenterView();
46 
50  virtual void DeactivatePresenterView();
51 
56  virtual void ReleaseView();
57 
58 protected:
60 
62 
64 };
65 
74  : public ::cppu::BaseMutex,
76 {
77 public:
78  static constexpr OUStringLiteral msCurrentSlidePreviewViewURL
79  = u"private:resource/view/Presenter/CurrentSlidePreview";
80  static constexpr OUStringLiteral msNextSlidePreviewViewURL
81  = u"private:resource/view/Presenter/NextSlidePreview";
82  static constexpr OUStringLiteral msNotesViewURL = u"private:resource/view/Presenter/Notes";
83  static constexpr OUStringLiteral msToolBarViewURL = u"private:resource/view/Presenter/ToolBar";
84  static constexpr OUStringLiteral msSlideSorterURL
85  = u"private:resource/view/Presenter/SlideSorter";
86  static constexpr OUStringLiteral msHelpViewURL = u"private:resource/view/Presenter/Help";
87 
94  static css::uno::Reference<css::drawing::framework::XResourceFactory> Create (
95  const css::uno::Reference<css::uno::XComponentContext>& rxContext,
96  const css::uno::Reference<css::frame::XController>& rxController,
97  const ::rtl::Reference<PresenterController>& rpPresenterController);
98  virtual ~PresenterViewFactory() override;
99 
100  virtual void SAL_CALL disposing() override;
101 
102  // XResourceFactory
103 
104  virtual css::uno::Reference<css::drawing::framework::XResource>
105  SAL_CALL createResource (
106  const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId) override;
107 
108  virtual void SAL_CALL
110  const css::uno::Reference<css::drawing::framework::XResource>& rxPane) override;
111 
112 private:
113  css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
114  css::uno::Reference<css::drawing::framework::XConfigurationController>
116  css::uno::WeakReference<css::frame::XController> mxControllerWeak;
118  typedef ::std::pair<css::uno::Reference<css::drawing::framework::XView>,
119  css::uno::Reference<css::drawing::framework::XPane> > ViewResourceDescriptor;
120  typedef ::std::map<OUString, ViewResourceDescriptor> ResourceContainer;
121  std::unique_ptr<ResourceContainer> mpResourceCache;
122 
124  const css::uno::Reference<css::uno::XComponentContext>& rxContext,
125  const css::uno::Reference<css::frame::XController>& rxController,
126  const ::rtl::Reference<PresenterController>& rpPresenterController);
127 
128  void Register (const css::uno::Reference<css::frame::XController>& rxController);
129 
130  css::uno::Reference<css::drawing::framework::XView> CreateSlideShowView(
131  const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId) const;
132 
133  css::uno::Reference<css::drawing::framework::XView> CreateSlidePreviewView(
134  const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
135  const css::uno::Reference<css::drawing::framework::XPane>& rxPane) const;
136 
137  css::uno::Reference<css::drawing::framework::XView> CreateToolBarView(
138  const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId) const;
139 
140  css::uno::Reference<css::drawing::framework::XView> CreateNotesView(
141  const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId) const;
142 
143  css::uno::Reference<css::drawing::framework::XView> CreateSlideSorterView(
144  const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId) const;
145 
146  css::uno::Reference<css::drawing::framework::XView> CreateHelpView(
147  const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId) const;
148 
149  css::uno::Reference<css::drawing::framework::XResource> GetViewFromCache (
150  const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
151  const css::uno::Reference<css::drawing::framework::XPane>& rxAnchorPane) const;
152  css::uno::Reference<css::drawing::framework::XResource> CreateView(
153  const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
154  const css::uno::Reference<css::drawing::framework::XPane>& rxAnchorPane);
155 
157  void ThrowIfDisposed() const;
158 };
159 
160 }
161 
162 #endif
163 
164 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static constexpr OUStringLiteral msCurrentSlidePreviewViewURL
css::uno::Reference< css::drawing::framework::XConfigurationController > mxConfigurationController
::std::pair< css::uno::Reference< css::drawing::framework::XView >, css::uno::Reference< css::drawing::framework::XPane > > ViewResourceDescriptor
virtual css::uno::Reference< css::drawing::framework::XResource > SAL_CALL createResource(const css::uno::Reference< css::drawing::framework::XResourceId > &rxViewId) override
static constexpr OUStringLiteral msNotesViewURL
css::uno::Reference< css::drawing::framework::XView > CreateToolBarView(const css::uno::Reference< css::drawing::framework::XResourceId > &rxViewId) const
css::uno::Reference< css::drawing::framework::XView > CreateNotesView(const css::uno::Reference< css::drawing::framework::XResourceId > &rxViewId) const
::std::map< OUString, ViewResourceDescriptor > ResourceContainer
css::uno::WeakReference< css::frame::XController > mxControllerWeak
static constexpr OUStringLiteral msNextSlidePreviewViewURL
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)
::cppu::WeakComponentImplHelper< css::drawing::framework::XResourceFactory > PresenterViewFactoryInterfaceBase
virtual void SAL_CALL disposing() override
static constexpr OUStringLiteral msToolBarViewURL
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
Factory of the presenter screen specific views.
void Register(const css::uno::Reference< css::frame::XController > &rxController)
css::uno::Reference< css::drawing::framework::XView > CreateHelpView(const css::uno::Reference< css::drawing::framework::XResourceId > &rxViewId) const
std::unique_ptr< ResourceContainer > mpResourceCache
float u
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
static css::uno::Reference< css::drawing::framework::XResourceFactory > Create(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const css::uno::Reference< css::frame::XController > &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...
::rtl::Reference< PresenterController > mpPresenterController
css::uno::Reference< css::uno::XComponentContext > mxComponentContext
PresenterViewFactory(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const css::uno::Reference< css::frame::XController > &rxController, const ::rtl::Reference< PresenterController > &rpPresenterController)
virtual void SAL_CALL releaseResource(const css::uno::Reference< css::drawing::framework::XResource > &rxPane) override
virtual void ReleaseView()
Called before the view is disposed.
static constexpr OUStringLiteral msHelpViewURL
static constexpr OUStringLiteral msSlideSorterURL
css::uno::Reference< css::drawing::framework::XView > CreateSlideShowView(const css::uno::Reference< css::drawing::framework::XResourceId > &rxViewId) const
Base class for presenter views that allows the view factory to store them in a cache and reuse deacti...
virtual void DeactivatePresenterView()
Called when the view is put into a cache.
css::uno::Reference< css::drawing::framework::XView > CreateSlideSorterView(const css::uno::Reference< css::drawing::framework::XResourceId > &rxViewId) const