1*06bcd5d2SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*06bcd5d2SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*06bcd5d2SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*06bcd5d2SAndrew Rist * distributed with this work for additional information 6*06bcd5d2SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*06bcd5d2SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*06bcd5d2SAndrew Rist * "License"); you may not use this file except in compliance 9*06bcd5d2SAndrew Rist * with the License. You may obtain a copy of the License at 10*06bcd5d2SAndrew Rist * 11*06bcd5d2SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*06bcd5d2SAndrew Rist * 13*06bcd5d2SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*06bcd5d2SAndrew Rist * software distributed under the License is distributed on an 15*06bcd5d2SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*06bcd5d2SAndrew Rist * KIND, either express or implied. See the License for the 17*06bcd5d2SAndrew Rist * specific language governing permissions and limitations 18*06bcd5d2SAndrew Rist * under the License. 19*06bcd5d2SAndrew Rist * 20*06bcd5d2SAndrew Rist *************************************************************/ 21*06bcd5d2SAndrew Rist 22*06bcd5d2SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef SDEXT_PRESENTER_PRESENTER_PANE_BORDER_PAINTER_HXX 25cdf0e10cSrcweir #define SDEXT_PRESENTER_PRESENTER_PANE_BORDER_PAINTER_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp> 28cdf0e10cSrcweir #include <com/sun/star/awt/Rectangle.hpp> 29cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XPaneBorderPainter.hpp> 30cdf0e10cSrcweir #include <com/sun/star/graphic/XGraphicProvider.hpp> 31cdf0e10cSrcweir #include <com/sun/star/rendering/XCanvas.hpp> 32cdf0e10cSrcweir #include <com/sun/star/util/XMacroExpander.hpp> 33cdf0e10cSrcweir #include <com/sun/star/awt/XGraphics.hpp> 34cdf0e10cSrcweir #include <cppuhelper/basemutex.hxx> 35cdf0e10cSrcweir #include <cppuhelper/compbase1.hxx> 36cdf0e10cSrcweir #include <boost/noncopyable.hpp> 37cdf0e10cSrcweir #include <boost/scoped_ptr.hpp> 38cdf0e10cSrcweir #include <boost/shared_ptr.hpp> 39cdf0e10cSrcweir 40cdf0e10cSrcweir namespace css = ::com::sun::star; 41cdf0e10cSrcweir 42cdf0e10cSrcweir namespace sdext { namespace tools { 43cdf0e10cSrcweir class ConfigurationAccess; 44cdf0e10cSrcweir } } 45cdf0e10cSrcweir 46cdf0e10cSrcweir namespace sdext { namespace presenter { 47cdf0e10cSrcweir 48cdf0e10cSrcweir class PresenterPane; 49cdf0e10cSrcweir class PresenterTheme; 50cdf0e10cSrcweir 51cdf0e10cSrcweir namespace { 52cdf0e10cSrcweir typedef ::cppu::WeakComponentImplHelper1< 53cdf0e10cSrcweir css::drawing::framework::XPaneBorderPainter 54cdf0e10cSrcweir > PresenterPaneBorderPainterInterfaceBase; 55cdf0e10cSrcweir } 56cdf0e10cSrcweir 57cdf0e10cSrcweir /** This class is responsible for painting window borders of PresenterPane 58cdf0e10cSrcweir objects. 59cdf0e10cSrcweir */ 60cdf0e10cSrcweir class PresenterPaneBorderPainter 61cdf0e10cSrcweir : private ::boost::noncopyable, 62cdf0e10cSrcweir protected ::cppu::BaseMutex, 63cdf0e10cSrcweir public PresenterPaneBorderPainterInterfaceBase 64cdf0e10cSrcweir { 65cdf0e10cSrcweir public: 66cdf0e10cSrcweir PresenterPaneBorderPainter ( 67cdf0e10cSrcweir const css::uno::Reference<css::uno::XComponentContext>& rxContext); 68cdf0e10cSrcweir virtual ~PresenterPaneBorderPainter (void); 69cdf0e10cSrcweir 70cdf0e10cSrcweir /** Transform the bounding box of the window content to the outer 71cdf0e10cSrcweir bounding box of the border that is painted around it. 72cdf0e10cSrcweir @param rsPaneURL 73cdf0e10cSrcweir Specifies the pane style that is used to determine the border sizes. 74cdf0e10cSrcweir @param rInnerBox 75cdf0e10cSrcweir The rectangle of the inner window content. 76cdf0e10cSrcweir */ 77cdf0e10cSrcweir css::awt::Rectangle AddBorder ( 78cdf0e10cSrcweir const ::rtl::OUString& rsPaneURL, 79cdf0e10cSrcweir const css::awt::Rectangle& rInnerBox, 80cdf0e10cSrcweir const css::drawing::framework::BorderType eBorderType) const; 81cdf0e10cSrcweir 82cdf0e10cSrcweir /** Transorm the outer bounding box of a window to the bounding box of 83cdf0e10cSrcweir the inner content area. 84cdf0e10cSrcweir @param rsPaneURL 85cdf0e10cSrcweir Specifies the pane style that is used to determine the border sizes. 86cdf0e10cSrcweir @param rOuterBox 87cdf0e10cSrcweir The bounding box of the rectangle around the window. 88cdf0e10cSrcweir @param bIsTitleVisible 89cdf0e10cSrcweir This flag controls whether the upper part of the frame is 90cdf0e10cSrcweir supposed to contain the window title. 91cdf0e10cSrcweir */ 92cdf0e10cSrcweir css::awt::Rectangle RemoveBorder ( 93cdf0e10cSrcweir const ::rtl::OUString& rsPaneURL, 94cdf0e10cSrcweir const css::awt::Rectangle& rOuterBox, 95cdf0e10cSrcweir const css::drawing::framework::BorderType eBorderType) const; 96cdf0e10cSrcweir 97cdf0e10cSrcweir bool HasTheme (void) const; 98cdf0e10cSrcweir 99cdf0e10cSrcweir void SetTheme (const ::boost::shared_ptr<PresenterTheme>& rpTheme); 100cdf0e10cSrcweir 101cdf0e10cSrcweir class Renderer; 102cdf0e10cSrcweir 103cdf0e10cSrcweir // XPaneBorderPainter 104cdf0e10cSrcweir 105cdf0e10cSrcweir virtual css::awt::Rectangle SAL_CALL addBorder ( 106cdf0e10cSrcweir const rtl::OUString& rsPaneBorderStyleName, 107cdf0e10cSrcweir const css::awt::Rectangle& rRectangle, 108cdf0e10cSrcweir css::drawing::framework::BorderType eBorderType) 109cdf0e10cSrcweir throw(css::uno::RuntimeException); 110cdf0e10cSrcweir 111cdf0e10cSrcweir virtual css::awt::Rectangle SAL_CALL removeBorder ( 112cdf0e10cSrcweir const rtl::OUString& rsPaneBorderStyleName, 113cdf0e10cSrcweir const css::awt::Rectangle& rRectangle, 114cdf0e10cSrcweir css::drawing::framework::BorderType eBorderType) 115cdf0e10cSrcweir throw(css::uno::RuntimeException); 116cdf0e10cSrcweir 117cdf0e10cSrcweir virtual void SAL_CALL paintBorder ( 118cdf0e10cSrcweir const rtl::OUString& rsPaneBorderStyleName, 119cdf0e10cSrcweir const css::uno::Reference<css::rendering::XCanvas>& rxCanvas, 120cdf0e10cSrcweir const css::awt::Rectangle& rOuterBorderRectangle, 121cdf0e10cSrcweir const css::awt::Rectangle& rRepaintArea, 122cdf0e10cSrcweir const rtl::OUString& rsTitle) 123cdf0e10cSrcweir throw(css::uno::RuntimeException); 124cdf0e10cSrcweir 125cdf0e10cSrcweir virtual void SAL_CALL paintBorderWithCallout ( 126cdf0e10cSrcweir const rtl::OUString& rsPaneBorderStyleName, 127cdf0e10cSrcweir const css::uno::Reference<css::rendering::XCanvas>& rxCanvas, 128cdf0e10cSrcweir const css::awt::Rectangle& rOuterBorderRectangle, 129cdf0e10cSrcweir const css::awt::Rectangle& rRepaintArea, 130cdf0e10cSrcweir const rtl::OUString& rsTitle, 131cdf0e10cSrcweir const css::awt::Point& rCalloutAnchor) 132cdf0e10cSrcweir throw(css::uno::RuntimeException); 133cdf0e10cSrcweir 134cdf0e10cSrcweir virtual css::awt::Point SAL_CALL getCalloutOffset ( 135cdf0e10cSrcweir const rtl::OUString& rsPaneBorderStyleName) 136cdf0e10cSrcweir throw(css::uno::RuntimeException); 137cdf0e10cSrcweir 138cdf0e10cSrcweir private: 139cdf0e10cSrcweir css::uno::Reference<css::uno::XComponentContext> mxContext; 140cdf0e10cSrcweir ::boost::shared_ptr<PresenterTheme> mpTheme; 141cdf0e10cSrcweir ::boost::scoped_ptr<Renderer> mpRenderer; 142cdf0e10cSrcweir 143cdf0e10cSrcweir /** When the theme for the border has not yet been loaded then try again 144cdf0e10cSrcweir when this method is called. 145cdf0e10cSrcweir @return 146cdf0e10cSrcweir Returns <TRUE/> only one time when the theme is loaded and/or the 147cdf0e10cSrcweir renderer is initialized. 148cdf0e10cSrcweir */ 149cdf0e10cSrcweir bool ProvideTheme ( 150cdf0e10cSrcweir const css::uno::Reference<css::rendering::XCanvas>& rxCanvas); 151cdf0e10cSrcweir bool ProvideTheme (void); 152cdf0e10cSrcweir 153cdf0e10cSrcweir void ThrowIfDisposed (void) const 154cdf0e10cSrcweir throw (::com::sun::star::lang::DisposedException); 155cdf0e10cSrcweir }; 156cdf0e10cSrcweir 157cdf0e10cSrcweir } } // end of namespace ::sd::presenter 158cdf0e10cSrcweir 159cdf0e10cSrcweir #endif 160