fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sdext / source / presenter / PresenterPaneContainer.hxx
blobd12913c042c9954bc1abd85bca917cd18f10be6e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERPANECONTAINER_HXX
21 #define INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERPANECONTAINER_HXX
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>
41 namespace sdext { namespace presenter {
43 class PresenterPaneBase;
44 class PresenterSprite;
46 namespace {
47 typedef ::cppu::WeakComponentImplHelper1 <
48 css::lang::XEventListener
49 > PresenterPaneContainerInterfaceBase;
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.
56 class PresenterPaneContainer
57 : private ::boost::noncopyable,
58 private ::cppu::BaseMutex,
59 public PresenterPaneContainerInterfaceBase
61 public:
62 PresenterPaneContainer (
63 const css::uno::Reference<css::uno::XComponentContext>& rxContext);
64 virtual ~PresenterPaneContainer();
66 virtual void SAL_CALL disposing() SAL_OVERRIDE;
68 typedef ::boost::function1<void, const css::uno::Reference<css::drawing::framework::XView>&>
69 ViewInitializationFunction;
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.
76 A initialization function for the view is stored as well. This
77 function is executed as soon as a view is created.
79 class PaneDescriptor
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;
108 void SetActivationState (const bool bIsActive);
110 typedef ::boost::shared_ptr<PaneDescriptor> SharedPaneDescriptor;
111 typedef ::std::vector<SharedPaneDescriptor> PaneList;
112 PaneList maPanes;
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);
126 SharedPaneDescriptor StorePane (
127 const rtl::Reference<PresenterPaneBase>& rxPane);
129 SharedPaneDescriptor StoreBorderWindow(
130 const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId,
131 const css::uno::Reference<css::awt::XWindow>& rxBorderWindow);
133 SharedPaneDescriptor StoreView (
134 const css::uno::Reference<css::drawing::framework::XView>& rxView,
135 const SharedBitmapDescriptor& rpViewBackground);
137 SharedPaneDescriptor RemovePane (
138 const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId);
140 SharedPaneDescriptor RemoveView (
141 const css::uno::Reference<css::drawing::framework::XView>& rxView);
143 void CreateBorderWindow (PaneDescriptor& rDescriptor);
145 /** Find the pane whose border window is identical to the given border
146 window.
148 SharedPaneDescriptor FindBorderWindow (
149 const css::uno::Reference<css::awt::XWindow>& rxBorderWindow);
151 /** Find the pane whose border window is identical to the given content
152 window.
154 SharedPaneDescriptor FindContentWindow (
155 const css::uno::Reference<css::awt::XWindow>& rxBorderWindow);
157 /** Find the pane whose pane URL is identical to the given URL string.
159 SharedPaneDescriptor FindPaneURL (const OUString& rsPaneURL);
161 /** Find the pane whose resource id is identical to the given one.
163 SharedPaneDescriptor FindPaneId (const css::uno::Reference<
164 css::drawing::framework::XResourceId>& rxPaneId);
166 SharedPaneDescriptor FindViewURL (const OUString& rsViewURL);
168 OUString GetPaneURLForViewURL (const OUString& rsViewURL);
170 void ToTop (const SharedPaneDescriptor& rpDescriptor);
172 // XEventListener
174 virtual void SAL_CALL disposing (
175 const css::lang::EventObject& rEvent)
176 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
178 private:
179 css::uno::Reference<css::drawing::XPresenterHelper> mxPresenterHelper;
181 PaneList::const_iterator FindIteratorForPaneURL (const OUString& rsPaneURL);
184 } } // end of namespace ::sdext::presenter
186 #endif
188 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */