LibreOffice Module sd (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
34namespace sdext::presenter {
35
42{
43public:
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 std::shared_ptr<PresenterBitmapContainer> xParentContainer,
91 const css::uno::Reference<css::uno::XComponentContext>& rxComponentContext,
92 css::uno::Reference<css::rendering::XCanvas> xCanvas,
93 css::uno::Reference<css::drawing::XPresenterHelper> xPresenterHelper = nullptr);
95 const css::uno::Reference<css::container::XNameAccess>& rsRootNode,
96 std::shared_ptr<PresenterBitmapContainer> xParentContainer,
97 const css::uno::Reference<css::uno::XComponentContext>& rxComponentContext,
98 css::uno::Reference<css::rendering::XCanvas> xCanvas,
99 css::uno::Reference<css::drawing::XPresenterHelper> xPresenterHelper = 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
118private:
119 std::shared_ptr<PresenterBitmapContainer> mpParentContainer;
120 typedef ::std::map<OUString, std::shared_ptr<BitmapDescriptor> > BitmapContainer;
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 (std::u16string_view rsTexturingMode);
137};
138
140typedef 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...
const css::uno::Reference< css::rendering::XBitmap > & GetNormalBitmap() const
css::uno::Reference< css::rendering::XBitmap > mxDisabledBitmap
void SetBitmap(const Mode eMode, const css::uno::Reference< css::rendering::XBitmap > &rxBitmap)
css::uno::Reference< css::rendering::XBitmap > mxMouseOverBitmap
css::uno::Reference< css::rendering::XBitmap > const & GetBitmap(const Mode eMode) const
BitmapDescriptor(const std::shared_ptr< BitmapDescriptor > &rpDefault)
css::uno::Reference< css::rendering::XBitmap > mxNormalBitmap
css::uno::Reference< css::rendering::XBitmap > mxButtonDownBitmap
css::uno::Reference< css::rendering::XBitmap > mxMaskBitmap
Manage a set of bitmap groups as they are used for buttons: three bitmaps, one for the normal state,...
void LoadBitmaps(const css::uno::Reference< css::container::XNameAccess > &rsRootNode)
PresenterBitmapContainer & operator=(const PresenterBitmapContainer &)=delete
PresenterBitmapContainer(const PresenterBitmapContainer &)=delete
::std::map< OUString, std::shared_ptr< BitmapDescriptor > > BitmapContainer
std::shared_ptr< PresenterBitmapContainer > mpParentContainer
static std::shared_ptr< BitmapDescriptor > LoadBitmap(const css::uno::Reference< css::beans::XPropertySet > &rxProperties, const css::uno::Reference< css::drawing::XPresenterHelper > &rxPresenterHelper, const css::uno::Reference< css::rendering::XCanvas > &rxCanvas, const std::shared_ptr< PresenterBitmapContainer::BitmapDescriptor > &rpDefault)
void Initialize(const css::uno::Reference< css::uno::XComponentContext > &rxComponentContext)
PresenterBitmapContainer(const OUString &rsConfigurationBase, std::shared_ptr< PresenterBitmapContainer > xParentContainer, const css::uno::Reference< css::uno::XComponentContext > &rxComponentContext, css::uno::Reference< css::rendering::XCanvas > xCanvas, css::uno::Reference< css::drawing::XPresenterHelper > xPresenterHelper=nullptr)
Create a new bitmap container from a section of the configuration.
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)
static BitmapDescriptor::TexturingMode StringToTexturingMode(std::u16string_view rsTexturingMode)
std::shared_ptr< BitmapDescriptor > GetBitmap(const OUString &rsName) const
Return the bitmap set that is associated with the given name.
css::uno::Reference< css::drawing::XPresenterHelper > mxPresenterHelper
void ProcessBitmap(const OUString &rsKey, const css::uno::Reference< css::beans::XPropertySet > &rProperties)
css::uno::Reference< css::rendering::XCanvas > mxCanvas
PresenterBitmapContainer::BitmapDescriptor PresenterBitmapDescriptor
std::shared_ptr< PresenterBitmapContainer::BitmapDescriptor > SharedBitmapDescriptor
Mode