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