LibreOffice Module svx (master)  1
DescriptionGenerator.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 #pragma once
21 
22 #include <sal/config.h>
23 
24 #include <string_view>
25 
26 #include <com/sun/star/uno/Reference.hxx>
27 #include <rtl/ustrbuf.hxx>
28 #include <unotools/resmgr.hxx>
29 
30 namespace com::sun::star::beans
31 {
32 class XPropertySet;
33 }
35 {
36 class XShape;
37 }
38 
39 namespace accessibility
40 {
49 {
50 public:
51  enum class PropertyType
52  {
53  Color,
54  Integer
55  };
56 
64  DescriptionGenerator(const css::uno::Reference<css::drawing::XShape>& xShape);
65 
67 
74  void Initialize(std::u16string_view sPrefix);
75 
83  void Initialize(TranslateId pResourceId);
84 
90  OUString operator()(void);
91 
105  void AddProperty(const OUString& sPropertyName, PropertyType aType);
106 
112  void AppendString(std::u16string_view sString);
113 
114 private:
116  css::uno::Reference<css::drawing::XShape> mxShape;
117 
119  css::uno::Reference<css::beans::XPropertySet> mxSet;
120 
122  OUStringBuffer msDescription;
123 
128 
131  void AddColor(const OUString& sPropertyName);
132 
135  void AddInteger(const OUString& sPropertyName);
136 };
137 
138 } // end of namespace accessibility
139 
140 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void AddInteger(const OUString &sPropertyName)
Add a property value formatted as integer to the description string.
OUStringBuffer msDescription
The description string that is build.
void AddColor(const OUString &sPropertyName)
Add a property value formatted as color to the description string.
OUString sPrefix
css::uno::Reference< css::beans::XPropertySet > mxSet
Reference to the shape's property set.
OUString operator()(void)
Returns the description string and then resets it.
class SAL_NO_VTABLE XPropertySet
Definition: xmlexchg.hxx:28
bool mbIsFirstProperty
This flag is used to determine whether to insert a separator e.g.
This class creates description strings for shapes.
css::uno::Reference< css::drawing::XShape > mxShape
Reference to the shape from which the properties are extracted.
void AppendString(std::u16string_view sString)
Append the given string as is to the current description.
DescriptionGenerator(const css::uno::Reference< css::drawing::XShape > &xShape)
Creates a new description generator with an empty description string.
void Initialize(std::u16string_view sPrefix)
Initialize the description with the given prefix followed by the shape style in parentheses and a col...
void AddProperty(const OUString &sPropertyName, PropertyType aType)
Add the given property name and its associated value to the description string.
PropertyType