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