LibreOffice Module sdext (master)  1
PresenterBitmapContainer.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_PRESENTERBITMAPCONTAINER_HXX
21 #define INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERBITMAPCONTAINER_HXX
22 
23 #include <com/sun/star/beans/XPropertySet.hpp>
24 #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
25 #include <com/sun/star/container/XNameAccess.hpp>
26 #include <com/sun/star/drawing/XPresenterHelper.hpp>
27 #include <com/sun/star/rendering/XBitmap.hpp>
28 #include <com/sun/star/rendering/XCanvas.hpp>
29 #include <com/sun/star/uno/XComponentContext.hpp>
30 #include <com/sun/star/util/Color.hpp>
31 #include <map>
32 #include <memory>
33 
34 namespace sdext::presenter {
35 
42 {
43 public:
48  {
49  public:
51  explicit BitmapDescriptor (const std::shared_ptr<BitmapDescriptor>& rpDefault);
52 
54  const css::uno::Reference<css::rendering::XBitmap>& GetNormalBitmap() const;
55  css::uno::Reference<css::rendering::XBitmap> const & GetBitmap(const Mode eMode) const;
56  void SetBitmap (
57  const Mode eMode,
58  const css::uno::Reference<css::rendering::XBitmap>& rxBitmap);
59 
60  sal_Int32 mnWidth;
61  sal_Int32 mnHeight;
62  sal_Int32 mnXOffset;
63  sal_Int32 mnYOffset;
64  sal_Int32 mnXHotSpot;
65  sal_Int32 mnYHotSpot;
66  css::util::Color maReplacementColor;
70 
71  private:
72  css::uno::Reference<css::rendering::XBitmap> mxNormalBitmap;
73  css::uno::Reference<css::rendering::XBitmap> mxMouseOverBitmap;
74  css::uno::Reference<css::rendering::XBitmap> mxButtonDownBitmap;
75  css::uno::Reference<css::rendering::XBitmap> mxDisabledBitmap;
76  css::uno::Reference<css::rendering::XBitmap> mxMaskBitmap;
77  };
78 
89  const OUString& rsConfigurationBase,
90  const std::shared_ptr<PresenterBitmapContainer>& rpParentContainer,
91  const css::uno::Reference<css::uno::XComponentContext>& rxComponentContext,
92  const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
93  const css::uno::Reference<css::drawing::XPresenterHelper>& rxPresenterHelper = nullptr);
95  const css::uno::Reference<css::container::XNameAccess>& rsRootNode,
96  const std::shared_ptr<PresenterBitmapContainer>& rpParentContainer,
97  const css::uno::Reference<css::uno::XComponentContext>& rxComponentContext,
98  const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
99  const css::uno::Reference<css::drawing::XPresenterHelper>& rxPresenterHelper = nullptr);
103 
104  void Initialize (
105  const css::uno::Reference<css::uno::XComponentContext>& rxComponentContext);
106 
109  std::shared_ptr<BitmapDescriptor> GetBitmap (const OUString& rsName) const;
110 
111  static std::shared_ptr<BitmapDescriptor> LoadBitmap (
112  const css::uno::Reference<css::container::XHierarchicalNameAccess>& rxNode,
113  const OUString& rsPathToBitmapNode,
114  const css::uno::Reference<css::drawing::XPresenterHelper>& rxPresenterHelper,
115  const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
116  const std::shared_ptr<BitmapDescriptor>& rpDefaultBitmap);
117 
118 private:
119  std::shared_ptr<PresenterBitmapContainer> mpParentContainer;
120  typedef ::std::map<OUString, std::shared_ptr<BitmapDescriptor> > BitmapContainer;
121  BitmapContainer maIconContainer;
122  css::uno::Reference<css::rendering::XCanvas> mxCanvas;
123  css::uno::Reference<css::drawing::XPresenterHelper> mxPresenterHelper;
124 
125  void LoadBitmaps (
126  const css::uno::Reference<css::container::XNameAccess>& rsRootNode);
127  void ProcessBitmap (
128  const OUString& rsKey,
129  const css::uno::Reference<css::beans::XPropertySet>& rProperties);
130  static std::shared_ptr<BitmapDescriptor> LoadBitmap (
131  const css::uno::Reference<css::beans::XPropertySet>& rxProperties,
132  const css::uno::Reference<css::drawing::XPresenterHelper>& rxPresenterHelper,
133  const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
134  const std::shared_ptr<PresenterBitmapContainer::BitmapDescriptor>& rpDefault);
136  StringToTexturingMode (const OUString& rsTexturingMode);
137 };
138 
140 typedef std::shared_ptr<PresenterBitmapContainer::BitmapDescriptor> SharedBitmapDescriptor;
141 
142 } // end of namespace ::sdext::presenter
143 
144 #endif
145 
146 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
There is one bitmap for the normal state, one for a mouse over effect and one to show that a button h...
void SetBitmap(const Mode eMode, const css::uno::Reference< css::rendering::XBitmap > &rxBitmap)
css::uno::Reference< css::rendering::XBitmap > mxNormalBitmap
void ProcessBitmap(const OUString &rsKey, const css::uno::Reference< css::beans::XPropertySet > &rProperties)
PresenterBitmapContainer::BitmapDescriptor PresenterBitmapDescriptor
Mode
std::shared_ptr< PresenterBitmapContainer::BitmapDescriptor > SharedBitmapDescriptor
PresenterBitmapContainer & operator=(const PresenterBitmapContainer &)=delete
css::uno::Reference< css::rendering::XBitmap > mxButtonDownBitmap
css::uno::Reference< css::rendering::XBitmap > mxMaskBitmap
void Initialize(const css::uno::Reference< css::uno::XComponentContext > &rxComponentContext)
css::uno::Reference< css::rendering::XCanvas > mxCanvas
css::uno::Reference< css::rendering::XBitmap > mxMouseOverBitmap
std::shared_ptr< BitmapDescriptor > GetBitmap(const OUString &rsName) const
Return the bitmap set that is associated with the given name.
css::uno::Reference< css::rendering::XBitmap > const & GetBitmap(const Mode eMode) const
::std::map< OUString, std::shared_ptr< BitmapDescriptor > > BitmapContainer
css::uno::Reference< css::drawing::XPresenterHelper > mxPresenterHelper
static std::shared_ptr< BitmapDescriptor > LoadBitmap(const css::uno::Reference< css::container::XHierarchicalNameAccess > &rxNode, const OUString &rsPathToBitmapNode, const css::uno::Reference< css::drawing::XPresenterHelper > &rxPresenterHelper, const css::uno::Reference< css::rendering::XCanvas > &rxCanvas, const std::shared_ptr< BitmapDescriptor > &rpDefaultBitmap)
PresenterBitmapContainer(const OUString &rsConfigurationBase, const std::shared_ptr< PresenterBitmapContainer > &rpParentContainer, const css::uno::Reference< css::uno::XComponentContext > &rxComponentContext, const css::uno::Reference< css::rendering::XCanvas > &rxCanvas, const css::uno::Reference< css::drawing::XPresenterHelper > &rxPresenterHelper=nullptr)
Create a new bitmap container from a section of the configuration.
css::uno::Reference< css::rendering::XBitmap > mxDisabledBitmap
const css::uno::Reference< css::rendering::XBitmap > & GetNormalBitmap() const
std::shared_ptr< PresenterBitmapContainer > mpParentContainer
void LoadBitmaps(const css::uno::Reference< css::container::XNameAccess > &rsRootNode)
Manage a set of bitmap groups as they are used for buttons: three bitmaps, one for the normal state...
static BitmapDescriptor::TexturingMode StringToTexturingMode(const OUString &rsTexturingMode)