Line data Source code
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_PRESENTERPANECONTAINER_HXX
21 : #define INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERPANECONTAINER_HXX
22 :
23 : #include "PresenterTheme.hxx"
24 : #include <com/sun/star/awt/Point.hpp>
25 : #include <com/sun/star/awt/Rectangle.hpp>
26 : #include <com/sun/star/awt/XWindow.hpp>
27 : #include <com/sun/star/drawing/XPresenterHelper.hpp>
28 : #include <com/sun/star/drawing/framework/XResourceId.hpp>
29 : #include <com/sun/star/drawing/framework/XPane.hpp>
30 : #include <com/sun/star/drawing/framework/XView.hpp>
31 : #include <com/sun/star/uno/XComponentContext.hpp>
32 : #include <com/sun/star/util/Color.hpp>
33 : #include <cppuhelper/basemutex.hxx>
34 : #include <cppuhelper/compbase1.hxx>
35 : #include <rtl/ref.hxx>
36 : #include <vector>
37 : #include <boost/function.hpp>
38 : #include <boost/noncopyable.hpp>
39 : #include <boost/shared_ptr.hpp>
40 :
41 : namespace sdext { namespace presenter {
42 :
43 : class PresenterPaneBase;
44 : class PresenterSprite;
45 :
46 : namespace {
47 : typedef ::cppu::WeakComponentImplHelper1 <
48 : css::lang::XEventListener
49 : > PresenterPaneContainerInterfaceBase;
50 : }
51 :
52 : /** This class could also be called PresenterPaneAndViewContainer because it
53 : stores not only references to all panes that belong to the presenter
54 : screen but stores the views displayed in these panes as well.
55 : */
56 : class PresenterPaneContainer
57 : : private ::boost::noncopyable,
58 : private ::cppu::BaseMutex,
59 : public PresenterPaneContainerInterfaceBase
60 : {
61 : public:
62 : PresenterPaneContainer (
63 : const css::uno::Reference<css::uno::XComponentContext>& rxContext);
64 : virtual ~PresenterPaneContainer (void);
65 :
66 : virtual void SAL_CALL disposing (void) SAL_OVERRIDE;
67 :
68 : typedef ::boost::function1<void, const css::uno::Reference<css::drawing::framework::XView>&>
69 : ViewInitializationFunction;
70 :
71 : /** Each pane descriptor holds references to one pane and the view
72 : displayed in this pane as well as the other information that is used
73 : to manage the pane window like an XWindow reference, the title, and
74 : the coordinates.
75 :
76 : A initialization function for the view is stored as well. This
77 : function is executed as soon as a view is created.
78 : */
79 0 : class PaneDescriptor
80 : {
81 : public:
82 : typedef ::boost::function<void(bool)> Activator;
83 : typedef ::boost::function<boost::shared_ptr<PresenterSprite>()> SpriteProvider;
84 : css::uno::Reference<css::drawing::framework::XResourceId> mxPaneId;
85 : OUString msViewURL;
86 : ::rtl::Reference<PresenterPaneBase> mxPane;
87 : css::uno::Reference<css::drawing::framework::XView> mxView;
88 : css::uno::Reference<css::awt::XWindow> mxContentWindow;
89 : css::uno::Reference<css::awt::XWindow> mxBorderWindow;
90 : OUString msTitleTemplate;
91 : OUString msAccessibleTitleTemplate;
92 : OUString msTitle;
93 : ViewInitializationFunction maViewInitialization;
94 : double mnLeft;
95 : double mnTop;
96 : double mnRight;
97 : double mnBottom;
98 : SharedBitmapDescriptor mpViewBackground;
99 : bool mbIsActive;
100 : bool mbNeedsClipping;
101 : bool mbIsOpaque;
102 : SpriteProvider maSpriteProvider;
103 : bool mbIsSprite;
104 : Activator maActivator;
105 : css::awt::Point maCalloutAnchorLocation;
106 : bool mbHasCalloutAnchor;
107 :
108 : void SetActivationState (const bool bIsActive);
109 : };
110 : typedef ::boost::shared_ptr<PaneDescriptor> SharedPaneDescriptor;
111 : typedef ::std::vector<SharedPaneDescriptor> PaneList;
112 : PaneList maPanes;
113 :
114 : void PreparePane (
115 : const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId,
116 : const OUString& rsViewURL,
117 : const OUString& rsTitle,
118 : const OUString& rsAccessibleTitle,
119 : const bool bIsOpaque,
120 : const ViewInitializationFunction& rViewIntialization,
121 : const double nLeft,
122 : const double nTop,
123 : const double nRight,
124 : const double nBottom);
125 :
126 : SharedPaneDescriptor StorePane (
127 : const rtl::Reference<PresenterPaneBase>& rxPane);
128 :
129 : SharedPaneDescriptor StoreBorderWindow(
130 : const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId,
131 : const css::uno::Reference<css::awt::XWindow>& rxBorderWindow);
132 :
133 : SharedPaneDescriptor StoreView (
134 : const css::uno::Reference<css::drawing::framework::XView>& rxView,
135 : const SharedBitmapDescriptor& rpViewBackground);
136 :
137 : SharedPaneDescriptor RemovePane (
138 : const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId);
139 :
140 : SharedPaneDescriptor RemoveView (
141 : const css::uno::Reference<css::drawing::framework::XView>& rxView);
142 :
143 : void CreateBorderWindow (PaneDescriptor& rDescriptor);
144 :
145 : /** Find the pane whose border window is identical to the given border
146 : window.
147 : */
148 : SharedPaneDescriptor FindBorderWindow (
149 : const css::uno::Reference<css::awt::XWindow>& rxBorderWindow);
150 :
151 : /** Find the pane whose border window is identical to the given content
152 : window.
153 : */
154 : SharedPaneDescriptor FindContentWindow (
155 : const css::uno::Reference<css::awt::XWindow>& rxBorderWindow);
156 :
157 : /** Find the pane whose pane URL is identical to the given URL string.
158 : */
159 : SharedPaneDescriptor FindPaneURL (const OUString& rsPaneURL);
160 :
161 : /** Find the pane whose resource id is identical to the given one.
162 : */
163 : SharedPaneDescriptor FindPaneId (const css::uno::Reference<
164 : css::drawing::framework::XResourceId>& rxPaneId);
165 :
166 : SharedPaneDescriptor FindViewURL (const OUString& rsViewURL);
167 :
168 : OUString GetPaneURLForViewURL (const OUString& rsViewURL);
169 :
170 : void ToTop (const SharedPaneDescriptor& rpDescriptor);
171 :
172 : // XEventListener
173 :
174 : virtual void SAL_CALL disposing (
175 : const css::lang::EventObject& rEvent)
176 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
177 :
178 : private:
179 : css::uno::Reference<css::drawing::XPresenterHelper> mxPresenterHelper;
180 :
181 : PaneList::const_iterator FindIteratorForPaneURL (const OUString& rsPaneURL);
182 : };
183 :
184 : } } // end of namespace ::sdext::presenter
185 :
186 : #endif
187 :
188 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|