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