update dev300-m58
[ooovba.git] / sdext / source / presenter / PresenterTheme.hxx
blob42df6a75c39d8e905169d1370872440765113e1a
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: PresenterTheme.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_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
60 property.
62 Example: you want to access the top left bitmap of a pane border
63 (simplified code):
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.
73 class PresenterTheme
75 public:
76 PresenterTheme (
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;
92 class FontDescriptor;
93 class Theme;
95 class FontDescriptor
97 public:
98 explicit FontDescriptor (void);
99 explicit FontDescriptor (const ::boost::shared_ptr<FontDescriptor>& rpDescriptor);
101 ::rtl::OUString msFamilyName;
102 ::rtl::OUString msStyleName;
103 sal_Int32 mnSize;
104 sal_uInt32 mnColor;
105 ::rtl::OUString msAnchor;
106 sal_Int32 mnXOffset;
107 sal_Int32 mnYOffset;
108 css::uno::Reference<css::rendering::XCanvasFont> mxFont;
110 bool PrepareFont (const css::uno::Reference<css::rendering::XCanvas>& rxCanvas);
112 typedef ::boost::shared_ptr<FontDescriptor> SharedFontDescriptor;
114 ::rtl::OUString GetThemeName (void) const;
116 SharedBitmapDescriptor GetBitmap (
117 const ::rtl::OUString& rsStyleName,
118 const ::rtl::OUString& rsBitmapName) const;
120 SharedBitmapDescriptor GetBitmap (
121 const ::rtl::OUString& rsBitmapName) const;
123 ::boost::shared_ptr<PresenterBitmapContainer> GetBitmapContainer (void) const;
125 SharedFontDescriptor GetFont (
126 const ::rtl::OUString& rsStyleName) const;
128 static SharedFontDescriptor ReadFont (
129 const css::uno::Reference<css::container::XHierarchicalNameAccess>& rxNode,
130 const ::rtl::OUString& rsFontPath,
131 const SharedFontDescriptor& rDefaultFount);
133 static bool ConvertToColor (
134 const css::uno::Any& rColorSequence,
135 sal_uInt32& rColor);
137 ::boost::shared_ptr<PresenterConfigurationAccess> GetNodeForViewStyle (
138 const ::rtl::OUString& rsStyleName,
139 const PresenterConfigurationAccess::WriteMode) const;
141 private:
142 css::uno::Reference<css::uno::XComponentContext> mxContext;
143 const ::rtl::OUString msThemeName;
144 ::boost::shared_ptr<Theme> mpTheme;
145 ::boost::shared_ptr<PresenterBitmapContainer> mpBitmapContainer;
146 css::uno::Reference<css::rendering::XCanvas> mxCanvas;
148 ::boost::shared_ptr<Theme> ReadTheme (void);
151 } } // end of namespace ::sd::presenter
153 #endif