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 <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 2 : 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 2 : 0, 0));
58 : }
59 :
60 2 : MeasureProperties::MeasureProperties(SdrObject& rObj)
61 2 : : TextProperties(rObj)
62 : {
63 2 : }
64 :
65 0 : MeasureProperties::MeasureProperties(const MeasureProperties& rProps, SdrObject& rObj)
66 0 : : TextProperties(rProps, rObj)
67 : {
68 0 : }
69 :
70 4 : MeasureProperties::~MeasureProperties()
71 : {
72 4 : }
73 :
74 0 : BaseProperties& MeasureProperties::Clone(SdrObject& rObj) const
75 : {
76 0 : return *(new MeasureProperties(*this, rObj));
77 : }
78 :
79 8 : void MeasureProperties::ItemSetChanged(const SfxItemSet& rSet)
80 : {
81 8 : SdrMeasureObj& rObj = static_cast<SdrMeasureObj&>(GetSdrObject());
82 :
83 : // call parent
84 8 : TextProperties::ItemSetChanged(rSet);
85 :
86 : // local changes
87 8 : rObj.SetTextDirty();
88 8 : }
89 :
90 2 : void MeasureProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr)
91 : {
92 2 : SdrMeasureObj& rObj = static_cast<SdrMeasureObj&>(GetSdrObject());
93 :
94 : // local changes
95 2 : rObj.SetTextDirty();
96 :
97 : // call parent
98 2 : TextProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
99 2 : }
100 :
101 2 : void MeasureProperties::ForceDefaultAttributes()
102 : {
103 : // call parent
104 2 : TextProperties::ForceDefaultAttributes();
105 :
106 : // force ItemSet
107 2 : 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 2 : mpItemSet->Put(makeSdrMeasureShowUnitItem(true));
113 :
114 2 : basegfx::B2DPolygon aNewPolygon;
115 2 : aNewPolygon.append(basegfx::B2DPoint(100.0, 0.0));
116 2 : aNewPolygon.append(basegfx::B2DPoint(200.0, 400.0));
117 2 : aNewPolygon.append(basegfx::B2DPoint(0.0, 400.0));
118 2 : aNewPolygon.setClosed(true);
119 :
120 2 : mpItemSet->Put(XLineStartItem(OUString(), basegfx::B2DPolyPolygon(aNewPolygon)));
121 2 : mpItemSet->Put(XLineStartWidthItem(200));
122 2 : mpItemSet->Put(XLineEndItem(OUString(), basegfx::B2DPolyPolygon(aNewPolygon)));
123 2 : mpItemSet->Put(XLineEndWidthItem(200));
124 2 : mpItemSet->Put(XLineStyleItem(XLINE_SOLID));
125 2 : }
126 : } // end of namespace properties
127 651 : } // end of namespace sdr
128 :
129 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|