Update ooo320-m1
[ooovba.git] / svx / source / sdr / properties / measureproperties.cxx
blob7bd657ddc598ae57732856070917ab35311f3c6c
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: measureproperties.cxx,v $
10 * $Revision: 1.9 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
33 #include <svx/sdr/properties/measureproperties.hxx>
34 #include <svtools/itemset.hxx>
35 #include <svtools/style.hxx>
36 #include <svx/svddef.hxx>
37 #include <svx/eeitem.hxx>
38 #include <svx/svdomeas.hxx>
39 #include <svx/sxmsuitm.hxx>
40 #include <svx/xlnstit.hxx>
41 #include <svx/xlnstwit.hxx>
42 #include <svx/xlnedit.hxx>
43 #include <svx/xlnedwit.hxx>
44 #include <basegfx/point/b2dpoint.hxx>
45 #include <basegfx/polygon/b2dpolygon.hxx>
47 //////////////////////////////////////////////////////////////////////////////
49 namespace sdr
51 namespace properties
53 // create a new itemset
54 SfxItemSet& MeasureProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
56 return *(new SfxItemSet(rPool,
58 // range from SdrAttrObj
59 SDRATTR_START, SDRATTR_SHADOW_LAST,
60 SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
61 SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
63 // range from SdrMeasureObj
64 SDRATTR_MEASURE_FIRST, SDRATTR_MEASURE_LAST,
66 // range from SdrTextObj
67 EE_ITEMS_START, EE_ITEMS_END,
69 // end
70 0, 0));
73 MeasureProperties::MeasureProperties(SdrObject& rObj)
74 : TextProperties(rObj)
78 MeasureProperties::MeasureProperties(const MeasureProperties& rProps, SdrObject& rObj)
79 : TextProperties(rProps, rObj)
83 MeasureProperties::~MeasureProperties()
87 BaseProperties& MeasureProperties::Clone(SdrObject& rObj) const
89 return *(new MeasureProperties(*this, rObj));
92 void MeasureProperties::ItemSetChanged(const SfxItemSet& rSet)
94 SdrMeasureObj& rObj = (SdrMeasureObj&)GetSdrObject();
96 // call parent
97 TextProperties::ItemSetChanged(rSet);
99 // local changes
100 rObj.SetTextDirty();
103 void MeasureProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
105 SdrMeasureObj& rObj = (SdrMeasureObj&)GetSdrObject();
107 // local changes
108 rObj.SetTextDirty();
110 // call parent
111 TextProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
114 void MeasureProperties::ForceDefaultAttributes()
116 // call parent
117 TextProperties::ForceDefaultAttributes();
119 // force ItemSet
120 GetObjectItemSet();
122 //#71958# by default, the show units Bool-Item is set as hard
123 // attribute to TRUE to aviod confusion when copying SdrMeasureObj's
124 // from one application to another
125 mpItemSet->Put(SdrMeasureShowUnitItem(TRUE));
127 basegfx::B2DPolygon aNewPolygon;
128 aNewPolygon.append(basegfx::B2DPoint(100.0, 0.0));
129 aNewPolygon.append(basegfx::B2DPoint(200.0, 400.0));
130 aNewPolygon.append(basegfx::B2DPoint(0.0, 400.0));
131 aNewPolygon.setClosed(true);
133 mpItemSet->Put(XLineStartItem(String(), basegfx::B2DPolyPolygon(aNewPolygon)));
134 mpItemSet->Put(XLineStartWidthItem(200));
135 mpItemSet->Put(XLineEndItem(String(), basegfx::B2DPolyPolygon(aNewPolygon)));
136 mpItemSet->Put(XLineEndWidthItem(200));
137 mpItemSet->Put(XLineStyleItem(XLINE_SOLID));
139 } // end of namespace properties
140 } // end of namespace sdr
142 //////////////////////////////////////////////////////////////////////////////
144 // eof