1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: PresenterPaneContainer.hxx,v $
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>
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
;
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
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
90 A initialization function for the view is stored as well. This
91 function is executed as soon as a view is created.
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 msAccessibleTitleTemplate
;
106 ::rtl::OUString msTitle
;
107 ViewInitializationFunction maViewInitialization
;
112 SharedBitmapDescriptor mpViewBackground
;
114 bool mbNeedsClipping
;
116 SpriteProvider maSpriteProvider
;
118 Activator maActivator
;
119 css::awt::Point maCalloutAnchorLocation
;
120 bool mbHasCalloutAnchor
;
122 void SetActivationState (const bool bIsActive
);
124 typedef ::boost::shared_ptr
<PaneDescriptor
> SharedPaneDescriptor
;
125 typedef ::std::vector
<SharedPaneDescriptor
> PaneList
;
129 const css::uno::Reference
<css::drawing::framework::XResourceId
>& rxPaneId
,
130 const ::rtl::OUString
& rsViewURL
,
131 const ::rtl::OUString
& rsTitle
,
132 const ::rtl::OUString
& rsAccessibleTitle
,
133 const bool bIsOpaque
,
134 const ViewInitializationFunction
& rViewIntialization
,
138 const double nBottom
);
140 SharedPaneDescriptor
StorePane (
141 const rtl::Reference
<PresenterPaneBase
>& rxPane
);
143 SharedPaneDescriptor
StoreBorderWindow(
144 const css::uno::Reference
<css::drawing::framework::XResourceId
>& rxPaneId
,
145 const css::uno::Reference
<css::awt::XWindow
>& rxBorderWindow
);
147 SharedPaneDescriptor
StoreView (
148 const css::uno::Reference
<css::drawing::framework::XView
>& rxView
,
149 const SharedBitmapDescriptor
& rpViewBackground
);
151 SharedPaneDescriptor
RemovePane (
152 const css::uno::Reference
<css::drawing::framework::XResourceId
>& rxPaneId
);
154 SharedPaneDescriptor
RemoveView (
155 const css::uno::Reference
<css::drawing::framework::XView
>& rxView
);
157 void CreateBorderWindow (PaneDescriptor
& rDescriptor
);
159 /** Find the pane whose border window is identical to the given border
162 SharedPaneDescriptor
FindBorderWindow (
163 const css::uno::Reference
<css::awt::XWindow
>& rxBorderWindow
);
165 /** Find the pane whose border window is identical to the given content
168 SharedPaneDescriptor
FindContentWindow (
169 const css::uno::Reference
<css::awt::XWindow
>& rxBorderWindow
);
171 /** Find the pane whose pane URL is identical to the given URL string.
173 SharedPaneDescriptor
FindPaneURL (const ::rtl::OUString
& rsPaneURL
);
175 /** Find the pane whose resource id is identical to the given one.
177 SharedPaneDescriptor
FindPaneId (const css::uno::Reference
<
178 css::drawing::framework::XResourceId
>& rxPaneId
);
180 SharedPaneDescriptor
FindViewURL (const ::rtl::OUString
& rsViewURL
);
182 ::rtl::OUString
GetPaneURLForViewURL (const ::rtl::OUString
& rsViewURL
);
184 void ToTop (const SharedPaneDescriptor
& rpDescriptor
);
189 virtual void SAL_CALL
disposing (
190 const com::sun::star::lang::EventObject
& rEvent
)
191 throw (com::sun::star::uno::RuntimeException
);
194 css::uno::Reference
<css::drawing::XPresenterHelper
> mxPresenterHelper
;
196 PaneList::const_iterator
FindIteratorForPaneURL (const ::rtl::OUString
& rsPaneURL
);
199 } } // end of namespace ::sdext::presenter