Branch data Line data Source code
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 <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>
33 : :
34 : : //////////////////////////////////////////////////////////////////////////////
35 : :
36 : : namespace sdr
37 : : {
38 : : namespace properties
39 : : {
40 : : // create a new itemset
41 : 0 : SfxItemSet& MeasureProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
42 : : {
43 : : return *(new SfxItemSet(rPool,
44 : :
45 : : // range from SdrAttrObj
46 : : SDRATTR_START, SDRATTR_SHADOW_LAST,
47 : : SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
48 : : SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
49 : :
50 : : // range from SdrMeasureObj
51 : : SDRATTR_MEASURE_FIRST, SDRATTR_MEASURE_LAST,
52 : :
53 : : // range from SdrTextObj
54 : : EE_ITEMS_START, EE_ITEMS_END,
55 : :
56 : : // end
57 [ # # ]: 0 : 0, 0));
58 : : }
59 : :
60 : 0 : MeasureProperties::MeasureProperties(SdrObject& rObj)
61 : 0 : : TextProperties(rObj)
62 : : {
63 : 0 : }
64 : :
65 : 0 : MeasureProperties::MeasureProperties(const MeasureProperties& rProps, SdrObject& rObj)
66 : 0 : : TextProperties(rProps, rObj)
67 : : {
68 : 0 : }
69 : :
70 : 0 : MeasureProperties::~MeasureProperties()
71 : : {
72 [ # # ]: 0 : }
73 : :
74 : 0 : BaseProperties& MeasureProperties::Clone(SdrObject& rObj) const
75 : : {
76 [ # # ]: 0 : return *(new MeasureProperties(*this, rObj));
77 : : }
78 : :
79 : 0 : void MeasureProperties::ItemSetChanged(const SfxItemSet& rSet)
80 : : {
81 : 0 : SdrMeasureObj& rObj = (SdrMeasureObj&)GetSdrObject();
82 : :
83 : : // call parent
84 : 0 : TextProperties::ItemSetChanged(rSet);
85 : :
86 : : // local changes
87 : 0 : rObj.SetTextDirty();
88 : 0 : }
89 : :
90 : 0 : void MeasureProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
91 : : {
92 : 0 : SdrMeasureObj& rObj = (SdrMeasureObj&)GetSdrObject();
93 : :
94 : : // local changes
95 : 0 : rObj.SetTextDirty();
96 : :
97 : : // call parent
98 : 0 : TextProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
99 : 0 : }
100 : :
101 : 0 : void MeasureProperties::ForceDefaultAttributes()
102 : : {
103 : : // call parent
104 [ # # ]: 0 : TextProperties::ForceDefaultAttributes();
105 : :
106 : : // force ItemSet
107 [ # # ]: 0 : GetObjectItemSet();
108 : :
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 [ # # ][ # # ]: 0 : mpItemSet->Put(SdrMeasureShowUnitItem(sal_True));
[ # # ]
113 : :
114 [ # # ]: 0 : basegfx::B2DPolygon aNewPolygon;
115 [ # # ]: 0 : aNewPolygon.append(basegfx::B2DPoint(100.0, 0.0));
116 [ # # ]: 0 : aNewPolygon.append(basegfx::B2DPoint(200.0, 400.0));
117 [ # # ]: 0 : aNewPolygon.append(basegfx::B2DPoint(0.0, 400.0));
118 [ # # ]: 0 : aNewPolygon.setClosed(true);
119 : :
120 [ # # ][ # # ]: 0 : mpItemSet->Put(XLineStartItem(String(), basegfx::B2DPolyPolygon(aNewPolygon)));
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
121 [ # # ][ # # ]: 0 : mpItemSet->Put(XLineStartWidthItem(200));
[ # # ]
122 [ # # ][ # # ]: 0 : mpItemSet->Put(XLineEndItem(String(), basegfx::B2DPolyPolygon(aNewPolygon)));
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
123 [ # # ][ # # ]: 0 : mpItemSet->Put(XLineEndWidthItem(200));
[ # # ]
124 [ # # ][ # # ]: 0 : mpItemSet->Put(XLineStyleItem(XLINE_SOLID));
[ # # ][ # # ]
125 : 0 : }
126 : : } // end of namespace properties
127 : : } // end of namespace sdr
128 : :
129 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|