tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / svx / source / sdr / properties / measureproperties.cxx
blobc0dcfb5dae9025b241a6a28919e727bf20a004b0
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <sal/config.h>
22 #include <sdr/properties/measureproperties.hxx>
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>
34 #include <basegfx/point/b2dpoint.hxx>
35 #include <basegfx/polygon/b2dpolygon.hxx>
38 namespace sdr::properties
40 // create a new itemset
41 SfxItemSet MeasureProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
43 return SfxItemSet(
44 rPool,
45 svl::Items<
46 // Ranges from SdrAttrObj, SdrMeasureObj:
47 SDRATTR_START, SDRATTR_SHADOW_LAST,
48 SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
49 SDRATTR_MEASURE_FIRST, SDRATTR_MEASURE_LAST,
50 SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
51 SDRATTR_TEXTCOLUMNS_FIRST, SDRATTR_TEXTCOLUMNS_LAST,
52 // Range from SdrTextObj:
53 EE_ITEMS_START, EE_ITEMS_END>);
56 MeasureProperties::MeasureProperties(SdrObject& rObj)
57 : TextProperties(rObj)
61 MeasureProperties::MeasureProperties(const MeasureProperties& rProps, SdrObject& rObj)
62 : TextProperties(rProps, rObj)
66 MeasureProperties::~MeasureProperties()
70 std::unique_ptr<BaseProperties> MeasureProperties::Clone(SdrObject& rObj) const
72 return std::unique_ptr<BaseProperties>(new MeasureProperties(*this, rObj));
75 void MeasureProperties::ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich, bool bAdjustTextFrameWidthAndHeight)
77 SdrMeasureObj& rObj = static_cast<SdrMeasureObj&>(GetSdrObject());
79 // call parent
80 TextProperties::ItemSetChanged(aChangedItems, nDeletedWhich, bAdjustTextFrameWidthAndHeight);
82 // local changes
83 rObj.SetTextDirty();
86 void MeasureProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr,
87 bool bBroadcast, bool bAdjustTextFrameWidthAndHeight)
89 // call parent (always first thing to do, may create the SfxItemSet)
90 TextProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr, bBroadcast, bAdjustTextFrameWidthAndHeight);
92 // local changes
93 // get access to dimension line object
94 SdrMeasureObj& rObj = static_cast<SdrMeasureObj&>(GetSdrObject());
96 // mark dimension line text as changed (dirty) in the dimension line object
97 rObj.SetTextDirty();
99 // tdf#98525 ask the dimension line object to redraw the changed text
100 rObj.UndirtyText();
103 void MeasureProperties::ForceDefaultAttributes()
105 // call parent
106 TextProperties::ForceDefaultAttributes();
108 //#71958# by default, the show units Bool-Item is set as hard
109 // attribute to sal_True to avoid confusion when copying SdrMeasureObj's
110 // from one application to another
111 moItemSet->Put(SdrYesNoItem(SDRATTR_MEASURESHOWUNIT, true));
113 basegfx::B2DPolygon aNewPolygon;
114 aNewPolygon.append(basegfx::B2DPoint(100.0, 0.0));
115 aNewPolygon.append(basegfx::B2DPoint(200.0, 400.0));
116 aNewPolygon.append(basegfx::B2DPoint(0.0, 400.0));
117 aNewPolygon.setClosed(true);
119 moItemSet->Put(XLineStartItem(OUString(), basegfx::B2DPolyPolygon(aNewPolygon)));
120 moItemSet->Put(XLineStartWidthItem(200));
121 moItemSet->Put(XLineEndItem(OUString(), basegfx::B2DPolyPolygon(aNewPolygon)));
122 moItemSet->Put(XLineEndWidthItem(200));
123 moItemSet->Put(XLineStyleItem(css::drawing::LineStyle_SOLID));
125 } // end of namespace
127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */