1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 <svx/sdr/properties/measureproperties.hxx>
21 #include <svl/itemset.hxx>
22 #include <svl/style.hxx>
23 #include <svx/svddef.hxx>
24 #include <editeng/eeitem.hxx>
25 #include <svx/svdomeas.hxx>
26 #include <svx/sxmsuitm.hxx>
27 #include <svx/xlnstit.hxx>
28 #include <svx/xlnstwit.hxx>
29 #include <svx/xlnedit.hxx>
30 #include <svx/xlnedwit.hxx>
31 #include <basegfx/point/b2dpoint.hxx>
32 #include <basegfx/polygon/b2dpolygon.hxx>
34 //////////////////////////////////////////////////////////////////////////////
40 // create a new itemset
41 SfxItemSet
& MeasureProperties::CreateObjectSpecificItemSet(SfxItemPool
& rPool
)
43 return *(new SfxItemSet(rPool
,
45 // range from SdrAttrObj
46 SDRATTR_START
, SDRATTR_SHADOW_LAST
,
47 SDRATTR_MISC_FIRST
, SDRATTR_MISC_LAST
,
48 SDRATTR_TEXTDIRECTION
, SDRATTR_TEXTDIRECTION
,
50 // range from SdrMeasureObj
51 SDRATTR_MEASURE_FIRST
, SDRATTR_MEASURE_LAST
,
53 // range from SdrTextObj
54 EE_ITEMS_START
, EE_ITEMS_END
,
60 MeasureProperties::MeasureProperties(SdrObject
& rObj
)
61 : TextProperties(rObj
)
65 MeasureProperties::MeasureProperties(const MeasureProperties
& rProps
, SdrObject
& rObj
)
66 : TextProperties(rProps
, rObj
)
70 MeasureProperties::~MeasureProperties()
74 BaseProperties
& MeasureProperties::Clone(SdrObject
& rObj
) const
76 return *(new MeasureProperties(*this, rObj
));
79 void MeasureProperties::ItemSetChanged(const SfxItemSet
& rSet
)
81 SdrMeasureObj
& rObj
= (SdrMeasureObj
&)GetSdrObject();
84 TextProperties::ItemSetChanged(rSet
);
90 void MeasureProperties::SetStyleSheet(SfxStyleSheet
* pNewStyleSheet
, sal_Bool bDontRemoveHardAttr
)
92 SdrMeasureObj
& rObj
= (SdrMeasureObj
&)GetSdrObject();
98 TextProperties::SetStyleSheet(pNewStyleSheet
, bDontRemoveHardAttr
);
101 void MeasureProperties::ForceDefaultAttributes()
104 TextProperties::ForceDefaultAttributes();
109 //#71958# by default, the show units Bool-Item is set as hard
110 // attribute to sal_True to aviod confusion when copying SdrMeasureObj's
111 // from one application to another
112 mpItemSet
->Put(SdrMeasureShowUnitItem(sal_True
));
114 basegfx::B2DPolygon aNewPolygon
;
115 aNewPolygon
.append(basegfx::B2DPoint(100.0, 0.0));
116 aNewPolygon
.append(basegfx::B2DPoint(200.0, 400.0));
117 aNewPolygon
.append(basegfx::B2DPoint(0.0, 400.0));
118 aNewPolygon
.setClosed(true);
120 mpItemSet
->Put(XLineStartItem(String(), basegfx::B2DPolyPolygon(aNewPolygon
)));
121 mpItemSet
->Put(XLineStartWidthItem(200));
122 mpItemSet
->Put(XLineEndItem(String(), basegfx::B2DPolyPolygon(aNewPolygon
)));
123 mpItemSet
->Put(XLineEndWidthItem(200));
124 mpItemSet
->Put(XLineStyleItem(XLINE_SOLID
));
126 } // end of namespace properties
127 } // end of namespace sdr
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */