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 
21 #pragma once
22 
23 #include <com/sun/star/uno/Reference.hxx>
24 #include <rtl/ustrbuf.hxx>
25 
26 namespace com::sun::star::beans { class XPropertySet; }
27 namespace com::sun::star::drawing { class XShape; }
28 
29 
30 namespace accessibility {
31 
40 {
41 public:
42  enum class PropertyType {
43  Color,
44  Integer
45  };
46 
54  DescriptionGenerator (const css::uno::Reference<
55  css::drawing::XShape>& xShape);
56 
58 
65  void Initialize (const OUString& sPrefix);
66 
74  void Initialize(const char* pResourceId);
75 
81  OUString operator() (void);
82 
96  void AddProperty (const OUString& sPropertyName,
97  PropertyType aType);
98 
104  void AppendString (const OUString& sString);
105 
106 private:
108  css::uno::Reference< css::drawing::XShape> mxShape;
109 
111  css::uno::Reference< css::beans::XPropertySet> mxSet;
112 
114  OUStringBuffer msDescription;
115 
120 
123  void AddColor (const OUString& sPropertyName);
124 
127  void AddInteger (const OUString& sPropertyName);
128 };
129 
130 
131 } // end of namespace accessibility
132 
133 
134 /* 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:31
void Initialize(const OUString &sPrefix)
Initialize the description with the given prefix followed by the shape style in parentheses and a col...
bool mbIsFirstProperty
This flag is used to determine whether to insert a separator e.g.
css::uno::Reference< css::drawing::XShape > mxShape
Reference to the shape from which the properties are extracted.
This class creates description strings for shapes.
DescriptionGenerator(const css::uno::Reference< css::drawing::XShape > &xShape)
Creates a new description generator with an empty description string.
void AppendString(const OUString &sString)
Append the given string as is to the current description.
void AddProperty(const OUString &sPropertyName, PropertyType aType)
Add the given property name and its associated value to the description string.
PropertyType