LibreOffice Module oox (master) 1
shapepropertymap.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_OOX_DRAWINGML_SHAPEPROPERTYMAP_HXX
21#define INCLUDED_OOX_DRAWINGML_SHAPEPROPERTYMAP_HXX
22
23#include <com/sun/star/uno/Any.hxx>
24#include <o3tl/enumarray.hxx>
25#include <oox/dllapi.h>
27#include <rtl/ustring.hxx>
28#include <sal/types.h>
29#include <tools/color.hxx>
30
31namespace oox { class ModelObjectHelper; }
32
33namespace oox::drawingml {
34
44enum class ShapeProperty
45{
50 LineDash,
51 LineCap,
53 LineStart,
56 LineEnd,
71 FillHatch,
79};
80
82
84{
91
93
94 explicit ShapePropertyInfo(const ShapePropertyIds& rnPropertyIds,
95 bool bNamedLineMarker, bool bNamedLineDash,
96 bool bNamedFillGradient, bool bNamedFillBitmap, bool bNamedFillHatch);
97
98 bool has(ShapeProperty ePropId) const
99 {
100 return mrPropertyIds[ePropId] >= 0;
101 }
102 sal_Int32 operator[](ShapeProperty ePropId) const
103 {
104 return mrPropertyIds[ePropId];
105 }
106};
107
109{
110public:
111 explicit ShapePropertyMap(ModelObjectHelper& rModelObjHelper,
112 const ShapePropertyInfo& rShapePropInfo = ShapePropertyInfo::DEFAULT );
113
115 bool supportsProperty( ShapeProperty ePropId ) const;
116
119 bool hasNamedLineMarkerInTable( const OUString& rMarkerName ) const;
120
122 bool setAnyProperty( ShapeProperty ePropId, const css::uno::Any& rValue );
123
125 template<typename Type>
126 bool setProperty(ShapeProperty ePropId, const Type& rValue)
127 {
128 return setAnyProperty(ePropId, css::uno::Any(rValue));
129 }
130 bool setProperty(ShapeProperty ePropId, const ::Color& rValue)
131 {
132 return setAnyProperty(ePropId, css::uno::Any(rValue));
133 }
134
137
138private:
140 bool setLineMarker( sal_Int32 nPropId, const css::uno::Any& rValue );
142 bool setLineDash( sal_Int32 nPropId, const css::uno::Any& rValue );
144 bool setFillGradient( sal_Int32 nPropId, const css::uno::Any& rValue );
146 bool setGradientTrans( sal_Int32 nPropId, const css::uno::Any& rValue );
148 bool setFillBitmap( sal_Int32 nPropId, const css::uno::Any& rValue );
150 bool setFillBitmapName( const css::uno::Any& rValue );
152 bool setFillHatch( sal_Int32 nPropId, const css::uno::Any& rValue );
153
154 // not implemented, to prevent implicit conversion from enum to int
155 css::uno::Any& operator[]( ShapeProperty ePropId ) = delete;
156 const css::uno::Any& operator[]( ShapeProperty ePropId ) const = delete;
157
158private:
161};
162
163
164} // namespace oox::drawingml
165
166#endif
167
168/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Contains tables for named drawing objects for a document model.
A helper that maps property identifiers to property values.
Definition: propertymap.hxx:52
bool setAnyProperty(sal_Int32 nPropId, const css::uno::Any &rValue)
Sets the specified property to the passed value.
bool setProperty(sal_Int32 nPropId, Type &&rValue)
Sets the specified property to the passed value.
Definition: propertymap.hxx:72
bool setProperty(ShapeProperty ePropId, const ::Color &rValue)
bool setProperty(ShapeProperty ePropId, const Type &rValue)
Sets the specified shape property to the passed value.
const css::uno::Any & operator[](ShapeProperty ePropId) const =delete
css::uno::Any & operator[](ShapeProperty ePropId)=delete
#define OOX_DLLPUBLIC
Definition: dllapi.h:28
LineEnd
enum SAL_DLLPUBLIC_RTTI FillStyle
Type
LineEndWidth
ShapeProperty
Enumeration for various properties related to drawing shape formatting.
@ LineStart
Explicit line start marker or name of a line marker stored in a global container.
@ FillBitmap
Explicit fill bitmap or name of a fill bitmap stored in a global container.
@ FillGradient
Explicit fill gradient or name of a fill gradient stored in a global container.
@ FillHatch
Explicit fill hatch or name of a fill hatch stored in a global container.
@ LineDash
Explicit line dash or name of a line dash stored in a global container.
o3tl::enumarray< ShapeProperty, sal_Int32 > ShapePropertyIds
bool mbNamedFillBitmap
True = use named fill gradient instead of explicit fill gradient.
bool has(ShapeProperty ePropId) const
sal_Int32 operator[](ShapeProperty ePropId) const
bool mbNamedFillHatch
True = use named fill bitmap instead of explicit fill bitmap.
const ShapePropertyIds & mrPropertyIds
bool mbNamedLineDash
True = use named line marker instead of explicit line marker.
static ShapePropertyInfo DEFAULT
True = use named fill hatch instead of explicit fill hatch.
bool mbNamedFillGradient
True = use named line dash instead of explicit line dash.
LineStyle