1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: PresenterTheme.hxx,v $
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_THEME_HXX
33 #define SDEXT_PRESENTER_PRESENTER_THEME_HXX
35 #include "PresenterBitmapContainer.hxx"
36 #include "PresenterConfigurationAccess.hxx"
37 #include "PresenterTheme.hxx"
38 #include <com/sun/star/uno/XComponentContext.hpp>
39 #include <com/sun/star/rendering/XCanvas.hpp>
40 #include <com/sun/star/rendering/XCanvasFont.hpp>
41 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
42 #include <com/sun/star/util/Color.hpp>
43 #include <boost/shared_ptr.hpp>
45 namespace css
= ::com::sun::star
;
47 namespace sdext
{ namespace presenter
{
49 /** A theme is a set of properties describing fonts, colors, and bitmaps to be used to draw
50 background, pane borders, and view content.
52 At the moment the properties can be accessed via the getPropertyValue() method.
54 For a resource URL of a pane or a view you get the name of the
55 associated PaneStyle or ViewStyle.
57 For the name of pane or view style suffixed with and underscore and the
58 name of configuration property, and maybe additionally suffixed by
59 another underscore and sub property name you get the associated
62 Example: you want to access the top left bitmap of a pane border
65 String sStyleName = getPropertyValue("private:resource/pane/Presenter/Pane1");
66 XBitmap xBitmap = getPropertyValue(sStyleName + "_TopLeftBitmap");
68 For the offset of the bitmap you can call
69 Point aOffset = getPropertyValue(sStyleName + "_TopLeftOffset");
71 This is work in progress.
77 const css::uno::Reference
<css::uno::XComponentContext
>& rxContext
,
78 const rtl::OUString
& rsThemeName
,
79 const css::uno::Reference
<css::rendering::XCanvas
>& rxCanvas
);
80 ~PresenterTheme (void);
82 void SAL_CALL
disposing (void);
84 bool HasCanvas (void) const;
85 void ProvideCanvas (const css::uno::Reference
<css::rendering::XCanvas
>& rxCanvas
);
87 ::rtl::OUString
GetStyleName (const ::rtl::OUString
& rsResourceURL
) const;
88 ::std::vector
<sal_Int32
> GetBorderSize (
89 const ::rtl::OUString
& rsStyleName
,
90 const bool bOuter
) const;
98 explicit FontDescriptor (void);
99 explicit FontDescriptor (const ::boost::shared_ptr
<FontDescriptor
>& rpDescriptor
);
101 ::rtl::OUString msFamilyName
;
102 ::rtl::OUString msStyleName
;
105 ::rtl::OUString msAnchor
;
108 css::uno::Reference
<css::rendering::XCanvasFont
> mxFont
;
110 bool PrepareFont (const css::uno::Reference
<css::rendering::XCanvas
>& rxCanvas
);
113 css::uno::Reference
<css::rendering::XCanvasFont
> CreateFont (
114 const css::uno::Reference
<css::rendering::XCanvas
>& rxCanvas
,
115 const double nCellSize
) const;
116 double GetCellSizeForDesignSize (
117 const css::uno::Reference
<css::rendering::XCanvas
>& rxCanvas
,
118 const double nDesignSize
) const;
120 typedef ::boost::shared_ptr
<FontDescriptor
> SharedFontDescriptor
;
122 ::rtl::OUString
GetThemeName (void) const;
124 SharedBitmapDescriptor
GetBitmap (
125 const ::rtl::OUString
& rsStyleName
,
126 const ::rtl::OUString
& rsBitmapName
) const;
128 SharedBitmapDescriptor
GetBitmap (
129 const ::rtl::OUString
& rsBitmapName
) const;
131 ::boost::shared_ptr
<PresenterBitmapContainer
> GetBitmapContainer (void) const;
133 SharedFontDescriptor
GetFont (
134 const ::rtl::OUString
& rsStyleName
) const;
136 static SharedFontDescriptor
ReadFont (
137 const css::uno::Reference
<css::container::XHierarchicalNameAccess
>& rxNode
,
138 const ::rtl::OUString
& rsFontPath
,
139 const SharedFontDescriptor
& rDefaultFount
);
141 static bool ConvertToColor (
142 const css::uno::Any
& rColorSequence
,
145 ::boost::shared_ptr
<PresenterConfigurationAccess
> GetNodeForViewStyle (
146 const ::rtl::OUString
& rsStyleName
,
147 const PresenterConfigurationAccess::WriteMode
) const;
150 css::uno::Reference
<css::uno::XComponentContext
> mxContext
;
151 const ::rtl::OUString msThemeName
;
152 ::boost::shared_ptr
<Theme
> mpTheme
;
153 ::boost::shared_ptr
<PresenterBitmapContainer
> mpBitmapContainer
;
154 css::uno::Reference
<css::rendering::XCanvas
> mxCanvas
;
156 ::boost::shared_ptr
<Theme
> ReadTheme (void);
159 } } // end of namespace ::sd::presenter