LibreOffice Module svx (master) 1
measureproperties.cxx
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#include <sal/config.h>
21
23#include <svl/itemset.hxx>
24#include <svl/style.hxx>
25#include <svx/svddef.hxx>
26#include <editeng/eeitem.hxx>
27#include <svx/svdomeas.hxx>
28#include <svx/xlineit0.hxx>
29#include <svx/xlnstit.hxx>
30#include <svx/xlnstwit.hxx>
31#include <svx/xlnedit.hxx>
32#include <svx/xlnedwit.hxx>
33#include <svx/sdynitm.hxx>
36
37
38namespace sdr::properties
39{
40 // create a new itemset
42 {
43 return SfxItemSet(
44 rPool,
46 // Ranges from SdrAttrObj, SdrMeasureObj:
52 // Range from SdrTextObj:
54 }
55
57 : TextProperties(rObj)
58 {
59 }
60
62 : TextProperties(rProps, rObj)
63 {
64 }
65
67 {
68 }
69
70 std::unique_ptr<BaseProperties> MeasureProperties::Clone(SdrObject& rObj) const
71 {
72 return std::unique_ptr<BaseProperties>(new MeasureProperties(*this, rObj));
73 }
74
76 {
77 SdrMeasureObj& rObj = static_cast<SdrMeasureObj&>(GetSdrObject());
78
79 // call parent
80 TextProperties::ItemSetChanged(aChangedItems, nDeletedWhich);
81
82 // local changes
83 rObj.SetTextDirty();
84 }
85
86 void MeasureProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr,
87 bool bBroadcast)
88 {
89 // call parent (always first thing to do, may create the SfxItemSet)
90 TextProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr, bBroadcast);
91
92 // local changes
93 // get access to dimension line object
94 SdrMeasureObj& rObj = static_cast<SdrMeasureObj&>(GetSdrObject());
95
96 // mark dimension line text as changed (dirty) in the dimension line object
97 rObj.SetTextDirty();
98
99 // tdf#98525 ask the dimension line object to redraw the changed text
100 rObj.UndirtyText();
101 }
102
104 {
105 // call parent
107
108 // force ItemSet
110
111 //#71958# by default, the show units Bool-Item is set as hard
112 // attribute to sal_True to avoid confusion when copying SdrMeasureObj's
113 // from one application to another
115
116 basegfx::B2DPolygon aNewPolygon;
117 aNewPolygon.append(basegfx::B2DPoint(100.0, 0.0));
118 aNewPolygon.append(basegfx::B2DPoint(200.0, 400.0));
119 aNewPolygon.append(basegfx::B2DPoint(0.0, 400.0));
120 aNewPolygon.setClosed(true);
121
122 mxItemSet->Put(XLineStartItem(OUString(), basegfx::B2DPolyPolygon(aNewPolygon)));
124 mxItemSet->Put(XLineEndItem(OUString(), basegfx::B2DPolyPolygon(aNewPolygon)));
125 mxItemSet->Put(XLineEndWidthItem(200));
126 mxItemSet->Put(XLineStyleItem(css::drawing::LineStyle_SOLID));
127 }
128} // end of namespace
129
130/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void UndirtyText() const
Definition: svdomeas.cxx:576
void SetTextDirty()
Definition: svdomeas.hxx:64
Abstract DrawObject.
Definition: svdobj.hxx:261
void append(const basegfx::B2DPoint &rPoint, sal_uInt32 nCount)
void setClosed(bool bNew)
virtual const SfxItemSet & GetObjectItemSet() const override
const SdrObject & GetSdrObject() const
Definition: properties.cxx:43
std::optional< SfxItemSet > mxItemSet
virtual void ForceDefaultAttributes() override
virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool &rPool) override
virtual void ItemSetChanged(o3tl::span< const SfxPoolItem *const > aChangedItems, sal_uInt16 nDeletedWhich) override
virtual void SetStyleSheet(SfxStyleSheet *pNewStyleSheet, bool bDontRemoveHardAttr, bool bBroadcast) override
virtual std::unique_ptr< BaseProperties > Clone(SdrObject &rObj) const override
virtual void SetStyleSheet(SfxStyleSheet *pNewStyleSheet, bool bDontRemoveHardAttr, bool bBroadcast) override
virtual void ForceDefaultAttributes() override
virtual void ItemSetChanged(o3tl::span< const SfxPoolItem *const > aChangedItems, sal_uInt16 nDeletedWhich) override
constexpr sal_uInt16 EE_ITEMS_END(EE_FEATURE_END)
constexpr sal_uInt16 EE_ITEMS_START(OWN_ATTR_VALUE_END+1)
static constexpr auto Items
constexpr sal_uInt16 SDRATTR_START(XATTR_START)
constexpr sal_uInt16 SDRATTR_TEXTCOLUMNS_FIRST(SDRATTR_SOFTEDGE_LAST+1)
constexpr sal_uInt16 SDRATTR_MEASURE_LAST(SDRATTR_MEASUREDECIMALPLACES)
constexpr sal_uInt16 SDRATTR_MEASURE_FIRST(SDRATTR_EDGE_LAST+1)
constexpr sal_uInt16 SDRATTR_MISC_FIRST(SDRATTR_CAPTION_LAST+1)
constexpr TypedWhichId< SdrYesNoItem > SDRATTR_MEASURESHOWUNIT(SDRATTR_MEASURE_FIRST+14)
constexpr sal_uInt16 SDRATTR_SHADOW_LAST(SDRATTR_SHADOWBLUR)
constexpr sal_uInt16 SDRATTR_MISC_LAST(SDRATTR_TEXT_CHAINNEXTNAME)
constexpr sal_uInt16 SDRATTR_TEXTCOLUMNS_LAST(SDRATTR_TEXTCOLUMNS_SPACING)
constexpr TypedWhichId< SvxWritingModeItem > SDRATTR_TEXTDIRECTION(SDRATTR_NOTPERSIST_FIRST+34)