update dev300-m58
[ooovba.git] / sdext / source / presenter / PresenterPaneContainer.hxx
blob0097c9dc064245175dc78804c80b0c30f90217d0
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: PresenterPaneContainer.hxx,v $
11 * $Revision: 1.4 $
13 * This file is part of OpenOffice.org.
15 * OpenOffice.org is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 3
17 * only, as published by the Free Software Foundation.
19 * OpenOffice.org is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License version 3 for more details
23 * (a copy is included in the LICENSE file that accompanied this code).
25 * You should have received a copy of the GNU Lesser General Public License
26 * version 3 along with OpenOffice.org. If not, see
27 * <http://www.openoffice.org/license.html>
28 * for a copy of the LGPLv3 License.
30 ************************************************************************/
32 #ifndef SDEXT_PRESENTER_PANE_CONTAINER_HXX
33 #define SDEXT_PRESENTER_PANE_CONTAINER_HXX
35 #include "PresenterTheme.hxx"
36 #include <com/sun/star/awt/Point.hpp>
37 #include <com/sun/star/awt/Rectangle.hpp>
38 #include <com/sun/star/awt/XWindow.hpp>
39 #include <com/sun/star/drawing/XPresenterHelper.hpp>
40 #include <com/sun/star/drawing/framework/XResourceId.hpp>
41 #include <com/sun/star/drawing/framework/XPane.hpp>
42 #include <com/sun/star/drawing/framework/XView.hpp>
43 #include <com/sun/star/uno/XComponentContext.hpp>
44 #include <com/sun/star/util/Color.hpp>
45 #include <cppuhelper/basemutex.hxx>
46 #include <cppuhelper/compbase1.hxx>
47 #include <rtl/ref.hxx>
48 #include <vector>
49 #include <boost/function.hpp>
50 #include <boost/noncopyable.hpp>
51 #include <boost/shared_ptr.hpp>
53 namespace css = ::com::sun::star;
55 namespace sdext { namespace presenter {
57 class PresenterPaneBase;
58 class PresenterSprite;
60 namespace {
61 typedef ::cppu::WeakComponentImplHelper1 <
62 css::lang::XEventListener
63 > PresenterPaneContainerInterfaceBase;
66 /** This class could also be called PresenterPaneAndViewContainer because it
67 stores not only references to all panes that belong to the presenter
68 screen but stores the views displayed in these panes as well.
70 class PresenterPaneContainer
71 : private ::boost::noncopyable,
72 private ::cppu::BaseMutex,
73 public PresenterPaneContainerInterfaceBase
75 public:
76 PresenterPaneContainer (
77 const css::uno::Reference<css::uno::XComponentContext>& rxContext);
78 virtual ~PresenterPaneContainer (void);
80 virtual void SAL_CALL disposing (void);
82 typedef ::boost::function1<void, const css::uno::Reference<css::drawing::framework::XView>&>
83 ViewInitializationFunction;
85 /** Each pane descriptor holds references to one pane and the view
86 displayed in this pane as well as the other information that is used
87 to manage the pane window like an XWindow reference, the title, and
88 the coordinates.
90 A initialization function for the view is stored as well. This
91 function is executed as soon as a view is created.
93 class PaneDescriptor
95 public:
96 typedef ::boost::function<void(bool)> Activator;
97 typedef ::boost::function<boost::shared_ptr<PresenterSprite>()> SpriteProvider;
98 css::uno::Reference<css::drawing::framework::XResourceId> mxPaneId;
99 ::rtl::OUString msViewURL;
100 ::rtl::Reference<PresenterPaneBase> mxPane;
101 css::uno::Reference<css::drawing::framework::XView> mxView;
102 css::uno::Reference<css::awt::XWindow> mxContentWindow;
103 css::uno::Reference<css::awt::XWindow> mxBorderWindow;
104 ::rtl::OUString msTitleTemplate;
105 ::rtl::OUString msTitle;
106 ViewInitializationFunction maViewInitialization;
107 double mnLeft;
108 double mnTop;
109 double mnRight;
110 double mnBottom;
111 SharedBitmapDescriptor mpViewBackground;
112 bool mbIsActive;
113 bool mbNeedsClipping;
114 bool mbIsOpaque;
115 SpriteProvider maSpriteProvider;
116 bool mbIsSprite;
117 Activator maActivator;
118 css::awt::Point maCalloutAnchorLocation;
119 bool mbHasCalloutAnchor;
121 void SetActivationState (const bool bIsActive);
123 typedef ::boost::shared_ptr<PaneDescriptor> SharedPaneDescriptor;
124 typedef ::std::vector<SharedPaneDescriptor> PaneList;
125 PaneList maPanes;
127 void PreparePane (
128 const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId,
129 const ::rtl::OUString& rsViewURL,
130 const ::rtl::OUString& rsTitle,
131 const bool bIsOpaque,
132 const ViewInitializationFunction& rViewIntialization,
133 const double nLeft,
134 const double nTop,
135 const double nRight,
136 const double nBottom);
138 SharedPaneDescriptor StorePane (
139 const rtl::Reference<PresenterPaneBase>& rxPane);
141 SharedPaneDescriptor StoreBorderWindow(
142 const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId,
143 const css::uno::Reference<css::awt::XWindow>& rxBorderWindow);
145 SharedPaneDescriptor StoreView (
146 const css::uno::Reference<css::drawing::framework::XView>& rxView,
147 const SharedBitmapDescriptor& rpViewBackground);
149 SharedPaneDescriptor RemovePane (
150 const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId);
152 SharedPaneDescriptor RemoveView (
153 const css::uno::Reference<css::drawing::framework::XView>& rxView);
155 void CreateBorderWindow (PaneDescriptor& rDescriptor);
157 /** Find the pane whose border window is identical to the given border
158 window.
160 SharedPaneDescriptor FindBorderWindow (
161 const css::uno::Reference<css::awt::XWindow>& rxBorderWindow);
163 /** Find the pane whose border window is identical to the given content
164 window.
166 SharedPaneDescriptor FindContentWindow (
167 const css::uno::Reference<css::awt::XWindow>& rxBorderWindow);
169 /** Find the pane whose pane URL is identical to the given URL string.
171 SharedPaneDescriptor FindPaneURL (const ::rtl::OUString& rsPaneURL);
173 /** Find the pane whose resource id is identical to the given one.
175 SharedPaneDescriptor FindPaneId (const css::uno::Reference<
176 css::drawing::framework::XResourceId>& rxPaneId);
178 SharedPaneDescriptor FindViewURL (const ::rtl::OUString& rsViewURL);
180 ::rtl::OUString GetPaneURLForViewURL (const ::rtl::OUString& rsViewURL);
182 void ToTop (const SharedPaneDescriptor& rpDescriptor);
185 // XEventListener
187 virtual void SAL_CALL disposing (
188 const com::sun::star::lang::EventObject& rEvent)
189 throw (com::sun::star::uno::RuntimeException);
191 private:
192 css::uno::Reference<css::drawing::XPresenterHelper> mxPresenterHelper;
194 PaneList::const_iterator FindIteratorForPaneURL (const ::rtl::OUString& rsPaneURL);
197 } } // end of namespace ::sdext::presenter
199 #endif