LibreOffice Module sdext (master)  1
PresenterTheme.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #ifndef INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERTHEME_HXX
21 #define INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERTHEME_HXX
22 
25 #include <com/sun/star/uno/XComponentContext.hpp>
26 #include <com/sun/star/rendering/XCanvas.hpp>
27 #include <com/sun/star/rendering/XCanvasFont.hpp>
28 #include <memory>
29 
30 namespace sdext { namespace presenter {
31 
57 {
58 public:
60  const css::uno::Reference<css::uno::XComponentContext>& rxContext,
61  const css::uno::Reference<css::rendering::XCanvas>& rxCanvas);
63 
64  bool HasCanvas() const;
65  void ProvideCanvas (const css::uno::Reference<css::rendering::XCanvas>& rxCanvas);
66 
67  OUString GetStyleName (const OUString& rsResourceURL) const;
68  ::std::vector<sal_Int32> GetBorderSize (
69  const OUString& rsStyleName,
70  const bool bOuter) const;
71 
72  class Theme;
74  {
75  public:
76  explicit FontDescriptor (const std::shared_ptr<FontDescriptor>& rpDescriptor);
77 
78  OUString msFamilyName;
79  OUString msStyleName;
80  sal_Int32 mnSize;
81  sal_uInt32 mnColor;
82  OUString msAnchor;
83  sal_Int32 mnXOffset;
84  sal_Int32 mnYOffset;
85  css::uno::Reference<css::rendering::XCanvasFont> mxFont;
86 
87  bool PrepareFont (const css::uno::Reference<css::rendering::XCanvas>& rxCanvas);
88 
89  private:
90  css::uno::Reference<css::rendering::XCanvasFont> CreateFont (
91  const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
92  const double nCellSize) const;
94  const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
95  const double nDesignSize) const;
96  };
97  typedef std::shared_ptr<FontDescriptor> SharedFontDescriptor;
98 
100  const OUString& rsStyleName,
101  const OUString& rsBitmapName) const;
102 
104  const OUString& rsBitmapName) const;
105 
106  std::shared_ptr<PresenterBitmapContainer> GetBitmapContainer() const;
107 
108  SharedFontDescriptor GetFont (
109  const OUString& rsStyleName) const;
110 
111  static SharedFontDescriptor ReadFont (
112  const css::uno::Reference<css::container::XHierarchicalNameAccess>& rxNode,
113  const SharedFontDescriptor& rDefaultFount);
114 
115  static bool ConvertToColor (
116  const css::uno::Any& rColorSequence,
117  sal_uInt32& rColor);
118 
119  std::shared_ptr<PresenterConfigurationAccess> GetNodeForViewStyle (
120  const OUString& rsStyleName) const;
121 
122 private:
123  css::uno::Reference<css::uno::XComponentContext> mxContext;
124  std::shared_ptr<Theme> mpTheme;
125  css::uno::Reference<css::rendering::XCanvas> mxCanvas;
126 
127  std::shared_ptr<Theme> ReadTheme();
128 };
129 
130 } } // end of namespace ::sd::presenter
131 
132 #endif
133 
134 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
::std::vector< sal_Int32 > GetBorderSize(const OUString &rsStyleName, const bool bOuter) const
std::shared_ptr< FontDescriptor > SharedFontDescriptor
PresenterTheme(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const css::uno::Reference< css::rendering::XCanvas > &rxCanvas)
FontDescriptor(const std::shared_ptr< FontDescriptor > &rpDescriptor)
std::shared_ptr< PresenterConfigurationAccess > GetNodeForViewStyle(const OUString &rsStyleName) const
std::shared_ptr< Theme > mpTheme
bool PrepareFont(const css::uno::Reference< css::rendering::XCanvas > &rxCanvas)
std::shared_ptr< PresenterBitmapContainer::BitmapDescriptor > SharedBitmapDescriptor
SharedBitmapDescriptor GetBitmap(const OUString &rsStyleName, const OUString &rsBitmapName) const
A theme is a set of properties describing fonts, colors, and bitmaps to be used to draw background...
double GetCellSizeForDesignSize(const css::uno::Reference< css::rendering::XCanvas > &rxCanvas, const double nDesignSize) const
static bool ConvertToColor(const css::uno::Any &rColorSequence, sal_uInt32 &rColor)
static SharedFontDescriptor ReadFont(const css::uno::Reference< css::container::XHierarchicalNameAccess > &rxNode, const SharedFontDescriptor &rDefaultFount)
css::uno::Reference< css::rendering::XCanvasFont > CreateFont(const css::uno::Reference< css::rendering::XCanvas > &rxCanvas, const double nCellSize) const
css::uno::Reference< css::rendering::XCanvas > mxCanvas
std::shared_ptr< Theme > ReadTheme()
void ProvideCanvas(const css::uno::Reference< css::rendering::XCanvas > &rxCanvas)
SharedFontDescriptor GetFont(const OUString &rsStyleName) const
OUString GetStyleName(const OUString &rsResourceURL) const
css::uno::Reference< css::rendering::XCanvasFont > mxFont
css::uno::Reference< css::uno::XComponentContext > mxContext
std::shared_ptr< PresenterBitmapContainer > GetBitmapContainer() const