Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include <svx/svdopage.hxx>
31 : : #include "svx/svdglob.hxx" // Stringcache
32 : : #include "svx/svdstr.hrc" // the object's name
33 : : #include <svx/svdtrans.hxx>
34 : : #include <svx/svdetc.hxx>
35 : : #include <svx/svdmodel.hxx>
36 : : #include <svx/svdpage.hxx>
37 : : #include <svx/svdpagv.hxx>
38 : : #include <svx/svdoutl.hxx>
39 : : #include <svtools/colorcfg.hxx>
40 : : #include <svl/itemset.hxx>
41 : : #include <svx/sdr/properties/pageproperties.hxx>
42 : : #include <svx/sdr/contact/viewcontactofpageobj.hxx>
43 : :
44 : : ////////////////////////////////////////////////////////////////////////////////////////////////////
45 : : // BaseProperties section
46 : :
47 : 87 : sdr::properties::BaseProperties* SdrPageObj::CreateObjectSpecificProperties()
48 : : {
49 [ + - ]: 87 : return new sdr::properties::PageProperties(*this);
50 : : }
51 : :
52 : : //////////////////////////////////////////////////////////////////////////////
53 : : // DrawContact section
54 : :
55 : 604 : sdr::contact::ViewContact* SdrPageObj::CreateObjectSpecificViewContact()
56 : : {
57 [ + - ]: 604 : return new sdr::contact::ViewContactOfPageObj(*this);
58 : : }
59 : :
60 : : ////////////////////////////////////////////////////////////////////////////////////////////////////
61 : : // this method is called form the destructor of the referenced page.
62 : : // do all necessary action to forget the page. It is not necessary to call
63 : : // RemovePageUser(), that is done form the destructor.
64 : 0 : void SdrPageObj::PageInDestruction(const SdrPage& rPage)
65 : : {
66 [ # # ][ # # ]: 0 : if(mpShownPage && mpShownPage == &rPage)
67 : : {
68 : : // #i58769# Do not call ActionChanged() here, because that would
69 : : // lead to the construction of a view contact object for a page that
70 : : // is being destroyed.
71 : :
72 : 0 : mpShownPage = 0L;
73 : : }
74 : 0 : }
75 : :
76 : : ////////////////////////////////////////////////////////////////////////////////////////////////////
77 : :
78 [ + + ][ - + ]: 10251 : TYPEINIT1(SdrPageObj,SdrObject);
79 : :
80 : 601 : SdrPageObj::SdrPageObj(SdrPage* pNewPage)
81 : 601 : : mpShownPage(pNewPage)
82 : : {
83 [ + + ]: 601 : if(mpShownPage)
84 : : {
85 [ + - ]: 217 : mpShownPage->AddPageUser(*this);
86 : : }
87 : 601 : }
88 : :
89 : 3 : SdrPageObj::SdrPageObj(const Rectangle& rRect, SdrPage* pNewPage)
90 : 3 : : mpShownPage(pNewPage)
91 : : {
92 [ + - ]: 3 : if(mpShownPage)
93 : : {
94 [ + - ]: 3 : mpShownPage->AddPageUser(*this);
95 : : }
96 : :
97 : 3 : aOutRect = rRect;
98 : 3 : }
99 : :
100 : 541 : SdrPageObj::~SdrPageObj()
101 : : {
102 [ + + ]: 541 : if(mpShownPage)
103 : : {
104 [ + - ]: 217 : mpShownPage->RemovePageUser(*this);
105 : : }
106 [ - + ]: 1082 : }
107 : :
108 : 28 : SdrPage* SdrPageObj::GetReferencedPage() const
109 : : {
110 : 28 : return mpShownPage;
111 : : }
112 : :
113 : 437 : void SdrPageObj::SetReferencedPage(SdrPage* pNewPage)
114 : : {
115 [ + + ]: 437 : if(mpShownPage != pNewPage)
116 : : {
117 [ + - ]: 5 : if(mpShownPage)
118 : : {
119 : 5 : mpShownPage->RemovePageUser(*this);
120 : : }
121 : :
122 : 5 : mpShownPage = pNewPage;
123 : :
124 [ + - ]: 5 : if(mpShownPage)
125 : : {
126 : 5 : mpShownPage->AddPageUser(*this);
127 : : }
128 : :
129 : 5 : SetChanged();
130 : 5 : BroadcastObjectChange();
131 : : }
132 : 437 : }
133 : :
134 : : // #i96598#
135 : 0 : void SdrPageObj::SetBoundRectDirty()
136 : : {
137 : : // avoid resetting aOutRect which in case of this object is model data,
138 : : // not re-creatable view data
139 : 0 : }
140 : :
141 : 3984 : sal_uInt16 SdrPageObj::GetObjIdentifier() const
142 : : {
143 : 3984 : return sal_uInt16(OBJ_PAGE);
144 : : }
145 : :
146 : 0 : void SdrPageObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
147 : : {
148 : 0 : rInfo.bRotateFreeAllowed=sal_False;
149 : 0 : rInfo.bRotate90Allowed =sal_False;
150 : 0 : rInfo.bMirrorFreeAllowed=sal_False;
151 : 0 : rInfo.bMirror45Allowed =sal_False;
152 : 0 : rInfo.bMirror90Allowed =sal_False;
153 : 0 : rInfo.bTransparenceAllowed = sal_False;
154 : 0 : rInfo.bGradientAllowed = sal_False;
155 : 0 : rInfo.bShearAllowed =sal_False;
156 : 0 : rInfo.bEdgeRadiusAllowed=sal_False;
157 : 0 : rInfo.bNoOrthoDesired =sal_False;
158 : 0 : rInfo.bCanConvToPath =sal_False;
159 : 0 : rInfo.bCanConvToPoly =sal_False;
160 : 0 : rInfo.bCanConvToPathLineToArea=sal_False;
161 : 0 : rInfo.bCanConvToPolyLineToArea=sal_False;
162 : 0 : }
163 : :
164 : 0 : SdrPageObj* SdrPageObj::Clone() const
165 : : {
166 : 0 : return CloneHelper< SdrPageObj >();
167 : : }
168 : :
169 : 0 : SdrPageObj& SdrPageObj::operator=(const SdrPageObj& rObj)
170 : : {
171 [ # # ]: 0 : if( this == &rObj )
172 : 0 : return *this;
173 : 0 : SdrObject::operator=(rObj);
174 : 0 : SetReferencedPage( rObj.GetReferencedPage());
175 : 0 : return *this;
176 : : }
177 : :
178 : 6 : void SdrPageObj::TakeObjNameSingul(XubString& rName) const
179 : : {
180 [ + - ][ + - ]: 6 : rName=ImpGetResStr(STR_ObjNameSingulPAGE);
[ + - ]
181 : :
182 [ + - ][ + - ]: 6 : String aName( GetName() );
183 [ - + ]: 6 : if(aName.Len())
184 : : {
185 [ # # ]: 0 : rName += sal_Unicode(' ');
186 [ # # ]: 0 : rName += sal_Unicode('\'');
187 [ # # ]: 0 : rName += aName;
188 [ # # ]: 0 : rName += sal_Unicode('\'');
189 [ + - ]: 6 : }
190 : 6 : }
191 : :
192 : 0 : void SdrPageObj::TakeObjNamePlural(XubString& rName) const
193 : : {
194 [ # # ]: 0 : rName=ImpGetResStr(STR_ObjNamePluralPAGE);
195 : 0 : }
196 : :
197 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|