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 { namespace 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 const OUString msCurrentSlidePreviewViewURL;
79  static const OUString msNextSlidePreviewViewURL;
80  static const OUString msNotesViewURL;
81  static const OUString msToolBarViewURL;
82  static const OUString msSlideSorterURL;
83  static const OUString msHelpViewURL;
84 
91  static css::uno::Reference<css::drawing::framework::XResourceFactory> Create (
92  const css::uno::Reference<css::uno::XComponentContext>& rxContext,
93  const css::uno::Reference<css::frame::XController>& rxController,
94  const ::rtl::Reference<PresenterController>& rpPresenterController);
95  virtual ~PresenterViewFactory() override;
96 
97  virtual void SAL_CALL disposing() override;
98 
99  // XResourceFactory
100 
101  virtual css::uno::Reference<css::drawing::framework::XResource>
102  SAL_CALL createResource (
103  const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId) override;
104 
105  virtual void SAL_CALL
107  const css::uno::Reference<css::drawing::framework::XResource>& rxPane) override;
108 
109 private:
110  css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
111  css::uno::Reference<css::drawing::framework::XConfigurationController>
113  css::uno::WeakReference<css::frame::XController> mxControllerWeak;
115  typedef ::std::pair<css::uno::Reference<css::drawing::framework::XView>,
116  css::uno::Reference<css::drawing::framework::XPane> > ViewResourceDescriptor;
117  typedef ::std::map<OUString, ViewResourceDescriptor> ResourceContainer;
118  std::unique_ptr<ResourceContainer> mpResourceCache;
119 
121  const css::uno::Reference<css::uno::XComponentContext>& rxContext,
122  const css::uno::Reference<css::frame::XController>& rxController,
123  const ::rtl::Reference<PresenterController>& rpPresenterController);
124 
125  void Register (const css::uno::Reference<css::frame::XController>& rxController);
126 
127  css::uno::Reference<css::drawing::framework::XView> CreateSlideShowView(
128  const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId) const;
129 
130  css::uno::Reference<css::drawing::framework::XView> CreateSlidePreviewView(
131  const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
132  const css::uno::Reference<css::drawing::framework::XPane>& rxPane) const;
133 
134  css::uno::Reference<css::drawing::framework::XView> CreateToolBarView(
135  const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId) const;
136 
137  css::uno::Reference<css::drawing::framework::XView> CreateNotesView(
138  const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId) const;
139 
140  css::uno::Reference<css::drawing::framework::XView> CreateSlideSorterView(
141  const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId) const;
142 
143  css::uno::Reference<css::drawing::framework::XView> CreateHelpView(
144  const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId) const;
145 
146  css::uno::Reference<css::drawing::framework::XResource> GetViewFromCache (
147  const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
148  const css::uno::Reference<css::drawing::framework::XPane>& rxAnchorPane) const;
149  css::uno::Reference<css::drawing::framework::XResource> CreateView(
150  const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
151  const css::uno::Reference<css::drawing::framework::XPane>& rxAnchorPane);
152 
154  void ThrowIfDisposed() const;
155 };
156 
157 } }
158 
159 #endif
160 
161 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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
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
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
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
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.
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