1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef SDEXT_PRESENTER_PRESENTER_PANE_BORDER_PAINTER_HXX 29 #define SDEXT_PRESENTER_PRESENTER_PANE_BORDER_PAINTER_HXX 30 31 #include <com/sun/star/uno/XComponentContext.hpp> 32 #include <com/sun/star/awt/Rectangle.hpp> 33 #include <com/sun/star/drawing/framework/XPaneBorderPainter.hpp> 34 #include <com/sun/star/graphic/XGraphicProvider.hpp> 35 #include <com/sun/star/rendering/XCanvas.hpp> 36 #include <com/sun/star/util/XMacroExpander.hpp> 37 #include <com/sun/star/awt/XGraphics.hpp> 38 #include <cppuhelper/basemutex.hxx> 39 #include <cppuhelper/compbase1.hxx> 40 #include <boost/noncopyable.hpp> 41 #include <boost/scoped_ptr.hpp> 42 #include <boost/shared_ptr.hpp> 43 44 namespace css = ::com::sun::star; 45 46 namespace sdext { namespace tools { 47 class ConfigurationAccess; 48 } } 49 50 namespace sdext { namespace presenter { 51 52 class PresenterPane; 53 class PresenterTheme; 54 55 namespace { 56 typedef ::cppu::WeakComponentImplHelper1< 57 css::drawing::framework::XPaneBorderPainter 58 > PresenterPaneBorderPainterInterfaceBase; 59 } 60 61 /** This class is responsible for painting window borders of PresenterPane 62 objects. 63 */ 64 class PresenterPaneBorderPainter 65 : private ::boost::noncopyable, 66 protected ::cppu::BaseMutex, 67 public PresenterPaneBorderPainterInterfaceBase 68 { 69 public: 70 PresenterPaneBorderPainter ( 71 const css::uno::Reference<css::uno::XComponentContext>& rxContext); 72 virtual ~PresenterPaneBorderPainter (void); 73 74 /** Transform the bounding box of the window content to the outer 75 bounding box of the border that is painted around it. 76 @param rsPaneURL 77 Specifies the pane style that is used to determine the border sizes. 78 @param rInnerBox 79 The rectangle of the inner window content. 80 */ 81 css::awt::Rectangle AddBorder ( 82 const ::rtl::OUString& rsPaneURL, 83 const css::awt::Rectangle& rInnerBox, 84 const css::drawing::framework::BorderType eBorderType) const; 85 86 /** Transorm the outer bounding box of a window to the bounding box of 87 the inner content area. 88 @param rsPaneURL 89 Specifies the pane style that is used to determine the border sizes. 90 @param rOuterBox 91 The bounding box of the rectangle around the window. 92 @param bIsTitleVisible 93 This flag controls whether the upper part of the frame is 94 supposed to contain the window title. 95 */ 96 css::awt::Rectangle RemoveBorder ( 97 const ::rtl::OUString& rsPaneURL, 98 const css::awt::Rectangle& rOuterBox, 99 const css::drawing::framework::BorderType eBorderType) const; 100 101 bool HasTheme (void) const; 102 103 void SetTheme (const ::boost::shared_ptr<PresenterTheme>& rpTheme); 104 105 class Renderer; 106 107 // XPaneBorderPainter 108 109 virtual css::awt::Rectangle SAL_CALL addBorder ( 110 const rtl::OUString& rsPaneBorderStyleName, 111 const css::awt::Rectangle& rRectangle, 112 css::drawing::framework::BorderType eBorderType) 113 throw(css::uno::RuntimeException); 114 115 virtual css::awt::Rectangle SAL_CALL removeBorder ( 116 const rtl::OUString& rsPaneBorderStyleName, 117 const css::awt::Rectangle& rRectangle, 118 css::drawing::framework::BorderType eBorderType) 119 throw(css::uno::RuntimeException); 120 121 virtual void SAL_CALL paintBorder ( 122 const rtl::OUString& rsPaneBorderStyleName, 123 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas, 124 const css::awt::Rectangle& rOuterBorderRectangle, 125 const css::awt::Rectangle& rRepaintArea, 126 const rtl::OUString& rsTitle) 127 throw(css::uno::RuntimeException); 128 129 virtual void SAL_CALL paintBorderWithCallout ( 130 const rtl::OUString& rsPaneBorderStyleName, 131 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas, 132 const css::awt::Rectangle& rOuterBorderRectangle, 133 const css::awt::Rectangle& rRepaintArea, 134 const rtl::OUString& rsTitle, 135 const css::awt::Point& rCalloutAnchor) 136 throw(css::uno::RuntimeException); 137 138 virtual css::awt::Point SAL_CALL getCalloutOffset ( 139 const rtl::OUString& rsPaneBorderStyleName) 140 throw(css::uno::RuntimeException); 141 142 private: 143 css::uno::Reference<css::uno::XComponentContext> mxContext; 144 ::boost::shared_ptr<PresenterTheme> mpTheme; 145 ::boost::scoped_ptr<Renderer> mpRenderer; 146 147 /** When the theme for the border has not yet been loaded then try again 148 when this method is called. 149 @return 150 Returns <TRUE/> only one time when the theme is loaded and/or the 151 renderer is initialized. 152 */ 153 bool ProvideTheme ( 154 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas); 155 bool ProvideTheme (void); 156 157 void ThrowIfDisposed (void) const 158 throw (::com::sun::star::lang::DisposedException); 159 }; 160 161 } } // end of namespace ::sd::presenter 162 163 #endif 164