merge the formfield patch from ooo-build
[ooovba.git] / sdext / source / presenter / PresenterPaneBorderPainter.hxx
blobc26bc3be6642ccf799048a4b3f5c6db0920617ef
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: PresenterPaneBorderPainter.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_PRESENTER_PANE_BORDER_PAINTER_HXX
33 #define SDEXT_PRESENTER_PRESENTER_PANE_BORDER_PAINTER_HXX
35 #include <com/sun/star/uno/XComponentContext.hpp>
36 #include <com/sun/star/awt/Rectangle.hpp>
37 #include <com/sun/star/drawing/framework/XPaneBorderPainter.hpp>
38 #include <com/sun/star/graphic/XGraphicProvider.hpp>
39 #include <com/sun/star/rendering/XCanvas.hpp>
40 #include <com/sun/star/util/XMacroExpander.hpp>
41 #include <com/sun/star/awt/XGraphics.hpp>
42 #include <cppuhelper/basemutex.hxx>
43 #include <cppuhelper/compbase1.hxx>
44 #include <boost/noncopyable.hpp>
45 #include <boost/scoped_ptr.hpp>
46 #include <boost/shared_ptr.hpp>
48 namespace css = ::com::sun::star;
50 namespace sdext { namespace tools {
51 class ConfigurationAccess;
52 } }
54 namespace sdext { namespace presenter {
56 class PresenterPane;
57 class PresenterTheme;
59 namespace {
60 typedef ::cppu::WeakComponentImplHelper1<
61 css::drawing::framework::XPaneBorderPainter
62 > PresenterPaneBorderPainterInterfaceBase;
65 /** This class is responsible for painting window borders of PresenterPane
66 objects.
68 class PresenterPaneBorderPainter
69 : private ::boost::noncopyable,
70 protected ::cppu::BaseMutex,
71 public PresenterPaneBorderPainterInterfaceBase
73 public:
74 PresenterPaneBorderPainter (
75 const css::uno::Reference<css::uno::XComponentContext>& rxContext);
76 virtual ~PresenterPaneBorderPainter (void);
78 /** Transform the bounding box of the window content to the outer
79 bounding box of the border that is painted around it.
80 @param rsPaneURL
81 Specifies the pane style that is used to determine the border sizes.
82 @param rInnerBox
83 The rectangle of the inner window content.
85 css::awt::Rectangle AddBorder (
86 const ::rtl::OUString& rsPaneURL,
87 const css::awt::Rectangle& rInnerBox,
88 const css::drawing::framework::BorderType eBorderType) const;
90 /** Transorm the outer bounding box of a window to the bounding box of
91 the inner content area.
92 @param rsPaneURL
93 Specifies the pane style that is used to determine the border sizes.
94 @param rOuterBox
95 The bounding box of the rectangle around the window.
96 @param bIsTitleVisible
97 This flag controls whether the upper part of the frame is
98 supposed to contain the window title.
100 css::awt::Rectangle RemoveBorder (
101 const ::rtl::OUString& rsPaneURL,
102 const css::awt::Rectangle& rOuterBox,
103 const css::drawing::framework::BorderType eBorderType) const;
105 bool HasTheme (void) const;
107 void SetTheme (const ::boost::shared_ptr<PresenterTheme>& rpTheme);
109 class Renderer;
111 // XPaneBorderPainter
113 virtual css::awt::Rectangle SAL_CALL addBorder (
114 const rtl::OUString& rsPaneBorderStyleName,
115 const css::awt::Rectangle& rRectangle,
116 css::drawing::framework::BorderType eBorderType)
117 throw(css::uno::RuntimeException);
119 virtual css::awt::Rectangle SAL_CALL removeBorder (
120 const rtl::OUString& rsPaneBorderStyleName,
121 const css::awt::Rectangle& rRectangle,
122 css::drawing::framework::BorderType eBorderType)
123 throw(css::uno::RuntimeException);
125 virtual void SAL_CALL paintBorder (
126 const rtl::OUString& rsPaneBorderStyleName,
127 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
128 const css::awt::Rectangle& rOuterBorderRectangle,
129 const css::awt::Rectangle& rRepaintArea,
130 const rtl::OUString& rsTitle)
131 throw(css::uno::RuntimeException);
133 virtual void SAL_CALL paintBorderWithCallout (
134 const rtl::OUString& rsPaneBorderStyleName,
135 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
136 const css::awt::Rectangle& rOuterBorderRectangle,
137 const css::awt::Rectangle& rRepaintArea,
138 const rtl::OUString& rsTitle,
139 const css::awt::Point& rCalloutAnchor)
140 throw(css::uno::RuntimeException);
142 virtual css::awt::Point SAL_CALL getCalloutOffset (
143 const rtl::OUString& rsPaneBorderStyleName)
144 throw(css::uno::RuntimeException);
146 private:
147 css::uno::Reference<css::uno::XComponentContext> mxContext;
148 ::boost::shared_ptr<PresenterTheme> mpTheme;
149 ::boost::scoped_ptr<Renderer> mpRenderer;
151 /** When the theme for the border has not yet been loaded then try again
152 when this method is called.
153 @return
154 Returns <TRUE/> only one time when the theme is loaded and/or the
155 renderer is initialized.
157 bool ProvideTheme (
158 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas);
159 bool ProvideTheme (void);
161 void ThrowIfDisposed (void) const
162 throw (::com::sun::star::lang::DisposedException);
165 } } // end of namespace ::sd::presenter
167 #endif