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