xref: /AOO41X/main/svx/source/sdr/properties/measureproperties.cxx (revision f6e50924346d0b8c0b07c91832a97665dd718b0c)
1*f6e50924SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*f6e50924SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*f6e50924SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*f6e50924SAndrew Rist  * distributed with this work for additional information
6*f6e50924SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*f6e50924SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*f6e50924SAndrew Rist  * "License"); you may not use this file except in compliance
9*f6e50924SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*f6e50924SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*f6e50924SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*f6e50924SAndrew Rist  * software distributed under the License is distributed on an
15*f6e50924SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*f6e50924SAndrew Rist  * KIND, either express or implied.  See the License for the
17*f6e50924SAndrew Rist  * specific language governing permissions and limitations
18*f6e50924SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*f6e50924SAndrew Rist  *************************************************************/
21*f6e50924SAndrew Rist 
22*f6e50924SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svx.hxx"
26cdf0e10cSrcweir #include <svx/sdr/properties/measureproperties.hxx>
27cdf0e10cSrcweir #include <svl/itemset.hxx>
28cdf0e10cSrcweir #include <svl/style.hxx>
29cdf0e10cSrcweir #include <svx/svddef.hxx>
30cdf0e10cSrcweir #include <editeng/eeitem.hxx>
31cdf0e10cSrcweir #include <svx/svdomeas.hxx>
32cdf0e10cSrcweir #include <svx/sxmsuitm.hxx>
33cdf0e10cSrcweir #include <svx/xlnstit.hxx>
34cdf0e10cSrcweir #include <svx/xlnstwit.hxx>
35cdf0e10cSrcweir #include <svx/xlnedit.hxx>
36cdf0e10cSrcweir #include <svx/xlnedwit.hxx>
37cdf0e10cSrcweir #include <basegfx/point/b2dpoint.hxx>
38cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygon.hxx>
39cdf0e10cSrcweir 
40cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
41cdf0e10cSrcweir 
42cdf0e10cSrcweir namespace sdr
43cdf0e10cSrcweir {
44cdf0e10cSrcweir 	namespace properties
45cdf0e10cSrcweir 	{
46cdf0e10cSrcweir 		// create a new itemset
CreateObjectSpecificItemSet(SfxItemPool & rPool)47cdf0e10cSrcweir 		SfxItemSet& MeasureProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
48cdf0e10cSrcweir 		{
49cdf0e10cSrcweir 			return *(new SfxItemSet(rPool,
50cdf0e10cSrcweir 
51cdf0e10cSrcweir 				// range from SdrAttrObj
52cdf0e10cSrcweir 				SDRATTR_START, SDRATTR_SHADOW_LAST,
53cdf0e10cSrcweir 				SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
54cdf0e10cSrcweir 				SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
55cdf0e10cSrcweir 
56cdf0e10cSrcweir 				// range from SdrMeasureObj
57cdf0e10cSrcweir 				SDRATTR_MEASURE_FIRST, SDRATTR_MEASURE_LAST,
58cdf0e10cSrcweir 
59cdf0e10cSrcweir 				// range from SdrTextObj
60cdf0e10cSrcweir 				EE_ITEMS_START, EE_ITEMS_END,
61cdf0e10cSrcweir 
62cdf0e10cSrcweir 				// end
63cdf0e10cSrcweir 				0, 0));
64cdf0e10cSrcweir 		}
65cdf0e10cSrcweir 
MeasureProperties(SdrObject & rObj)66cdf0e10cSrcweir 		MeasureProperties::MeasureProperties(SdrObject& rObj)
67cdf0e10cSrcweir 		:	TextProperties(rObj)
68cdf0e10cSrcweir 		{
69cdf0e10cSrcweir 		}
70cdf0e10cSrcweir 
MeasureProperties(const MeasureProperties & rProps,SdrObject & rObj)71cdf0e10cSrcweir 		MeasureProperties::MeasureProperties(const MeasureProperties& rProps, SdrObject& rObj)
72cdf0e10cSrcweir 		:	TextProperties(rProps, rObj)
73cdf0e10cSrcweir 		{
74cdf0e10cSrcweir 		}
75cdf0e10cSrcweir 
~MeasureProperties()76cdf0e10cSrcweir 		MeasureProperties::~MeasureProperties()
77cdf0e10cSrcweir 		{
78cdf0e10cSrcweir 		}
79cdf0e10cSrcweir 
Clone(SdrObject & rObj) const80cdf0e10cSrcweir 		BaseProperties& MeasureProperties::Clone(SdrObject& rObj) const
81cdf0e10cSrcweir 		{
82cdf0e10cSrcweir 			return *(new MeasureProperties(*this, rObj));
83cdf0e10cSrcweir 		}
84cdf0e10cSrcweir 
ItemSetChanged(const SfxItemSet & rSet)85cdf0e10cSrcweir 		void MeasureProperties::ItemSetChanged(const SfxItemSet& rSet)
86cdf0e10cSrcweir 		{
87cdf0e10cSrcweir 			SdrMeasureObj& rObj = (SdrMeasureObj&)GetSdrObject();
88cdf0e10cSrcweir 
89cdf0e10cSrcweir 			// call parent
90cdf0e10cSrcweir 			TextProperties::ItemSetChanged(rSet);
91cdf0e10cSrcweir 
92cdf0e10cSrcweir 			// local changes
93cdf0e10cSrcweir 			rObj.SetTextDirty();
94cdf0e10cSrcweir 		}
95cdf0e10cSrcweir 
SetStyleSheet(SfxStyleSheet * pNewStyleSheet,sal_Bool bDontRemoveHardAttr)96cdf0e10cSrcweir 		void MeasureProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
97cdf0e10cSrcweir 		{
98cdf0e10cSrcweir 			SdrMeasureObj& rObj = (SdrMeasureObj&)GetSdrObject();
99cdf0e10cSrcweir 
100cdf0e10cSrcweir 			// local changes
101cdf0e10cSrcweir 			rObj.SetTextDirty();
102cdf0e10cSrcweir 
103cdf0e10cSrcweir 			// call parent
104cdf0e10cSrcweir 			TextProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
105cdf0e10cSrcweir 		}
106cdf0e10cSrcweir 
ForceDefaultAttributes()107cdf0e10cSrcweir 		void MeasureProperties::ForceDefaultAttributes()
108cdf0e10cSrcweir 		{
109cdf0e10cSrcweir 			// call parent
110cdf0e10cSrcweir 			TextProperties::ForceDefaultAttributes();
111cdf0e10cSrcweir 
112cdf0e10cSrcweir 			// force ItemSet
113cdf0e10cSrcweir 			GetObjectItemSet();
114cdf0e10cSrcweir 
115cdf0e10cSrcweir 			//#71958# by default, the show units Bool-Item is set as hard
116cdf0e10cSrcweir 			// attribute to sal_True to aviod confusion when copying SdrMeasureObj's
117cdf0e10cSrcweir 			// from one application to another
118cdf0e10cSrcweir 			mpItemSet->Put(SdrMeasureShowUnitItem(sal_True));
119cdf0e10cSrcweir 
120cdf0e10cSrcweir 			basegfx::B2DPolygon aNewPolygon;
121cdf0e10cSrcweir 			aNewPolygon.append(basegfx::B2DPoint(100.0, 0.0));
122cdf0e10cSrcweir 			aNewPolygon.append(basegfx::B2DPoint(200.0, 400.0));
123cdf0e10cSrcweir 			aNewPolygon.append(basegfx::B2DPoint(0.0, 400.0));
124cdf0e10cSrcweir 			aNewPolygon.setClosed(true);
125cdf0e10cSrcweir 
126cdf0e10cSrcweir 			mpItemSet->Put(XLineStartItem(String(), basegfx::B2DPolyPolygon(aNewPolygon)));
127cdf0e10cSrcweir 			mpItemSet->Put(XLineStartWidthItem(200));
128cdf0e10cSrcweir 			mpItemSet->Put(XLineEndItem(String(), basegfx::B2DPolyPolygon(aNewPolygon)));
129cdf0e10cSrcweir 			mpItemSet->Put(XLineEndWidthItem(200));
130cdf0e10cSrcweir 			mpItemSet->Put(XLineStyleItem(XLINE_SOLID));
131cdf0e10cSrcweir 		}
132cdf0e10cSrcweir 	} // end of namespace properties
133cdf0e10cSrcweir } // end of namespace sdr
134cdf0e10cSrcweir 
135cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
136cdf0e10cSrcweir 
137cdf0e10cSrcweir // eof
138