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 :
21 : #include <svx/svdopage.hxx>
22 : #include "svx/svdglob.hxx" // Stringcache
23 : #include "svx/svdstr.hrc" // the object's name
24 : #include <svx/svdtrans.hxx>
25 : #include <svx/svdetc.hxx>
26 : #include <svx/svdmodel.hxx>
27 : #include <svx/svdpage.hxx>
28 : #include <svx/svdpagv.hxx>
29 : #include <svx/svdoutl.hxx>
30 : #include <svtools/colorcfg.hxx>
31 : #include <svl/itemset.hxx>
32 : #include <svx/sdr/properties/pageproperties.hxx>
33 : #include <svx/sdr/contact/viewcontactofpageobj.hxx>
34 :
35 : ////////////////////////////////////////////////////////////////////////////////////////////////////
36 : // BaseProperties section
37 :
38 15 : sdr::properties::BaseProperties* SdrPageObj::CreateObjectSpecificProperties()
39 : {
40 15 : return new sdr::properties::PageProperties(*this);
41 : }
42 :
43 : //////////////////////////////////////////////////////////////////////////////
44 : // DrawContact section
45 :
46 130 : sdr::contact::ViewContact* SdrPageObj::CreateObjectSpecificViewContact()
47 : {
48 130 : return new sdr::contact::ViewContactOfPageObj(*this);
49 : }
50 :
51 : ////////////////////////////////////////////////////////////////////////////////////////////////////
52 : // this method is called form the destructor of the referenced page.
53 : // do all necessary action to forget the page. It is not necessary to call
54 : // RemovePageUser(), that is done form the destructor.
55 0 : void SdrPageObj::PageInDestruction(const SdrPage& rPage)
56 : {
57 0 : if(mpShownPage && mpShownPage == &rPage)
58 : {
59 : // #i58769# Do not call ActionChanged() here, because that would
60 : // lead to the construction of a view contact object for a page that
61 : // is being destroyed.
62 :
63 0 : mpShownPage = 0L;
64 : }
65 0 : }
66 :
67 : ////////////////////////////////////////////////////////////////////////////////////////////////////
68 :
69 3297 : TYPEINIT1(SdrPageObj,SdrObject);
70 :
71 112 : SdrPageObj::SdrPageObj(SdrPage* pNewPage)
72 112 : : mpShownPage(pNewPage)
73 : {
74 112 : if(mpShownPage)
75 : {
76 34 : mpShownPage->AddPageUser(*this);
77 : }
78 112 : }
79 :
80 18 : SdrPageObj::SdrPageObj(const Rectangle& rRect, SdrPage* pNewPage)
81 18 : : mpShownPage(pNewPage)
82 : {
83 18 : if(mpShownPage)
84 : {
85 18 : mpShownPage->AddPageUser(*this);
86 : }
87 :
88 18 : aOutRect = rRect;
89 18 : }
90 :
91 330 : SdrPageObj::~SdrPageObj()
92 : {
93 110 : if(mpShownPage)
94 : {
95 50 : mpShownPage->RemovePageUser(*this);
96 : }
97 220 : }
98 :
99 0 : SdrPage* SdrPageObj::GetReferencedPage() const
100 : {
101 0 : return mpShownPage;
102 : }
103 :
104 98 : void SdrPageObj::SetReferencedPage(SdrPage* pNewPage)
105 : {
106 98 : if(mpShownPage != pNewPage)
107 : {
108 12 : if(mpShownPage)
109 : {
110 12 : mpShownPage->RemovePageUser(*this);
111 : }
112 :
113 12 : mpShownPage = pNewPage;
114 :
115 12 : if(mpShownPage)
116 : {
117 12 : mpShownPage->AddPageUser(*this);
118 : }
119 :
120 12 : SetChanged();
121 12 : BroadcastObjectChange();
122 : }
123 98 : }
124 :
125 : // #i96598#
126 0 : void SdrPageObj::SetBoundRectDirty()
127 : {
128 : // avoid resetting aOutRect which in case of this object is model data,
129 : // not re-creatable view data
130 0 : }
131 :
132 155 : sal_uInt16 SdrPageObj::GetObjIdentifier() const
133 : {
134 155 : return sal_uInt16(OBJ_PAGE);
135 : }
136 :
137 0 : void SdrPageObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
138 : {
139 0 : rInfo.bRotateFreeAllowed=sal_False;
140 0 : rInfo.bRotate90Allowed =sal_False;
141 0 : rInfo.bMirrorFreeAllowed=sal_False;
142 0 : rInfo.bMirror45Allowed =sal_False;
143 0 : rInfo.bMirror90Allowed =sal_False;
144 0 : rInfo.bTransparenceAllowed = sal_False;
145 0 : rInfo.bGradientAllowed = sal_False;
146 0 : rInfo.bShearAllowed =sal_False;
147 0 : rInfo.bEdgeRadiusAllowed=sal_False;
148 0 : rInfo.bNoOrthoDesired =sal_False;
149 0 : rInfo.bCanConvToPath =sal_False;
150 0 : rInfo.bCanConvToPoly =sal_False;
151 0 : rInfo.bCanConvToPathLineToArea=sal_False;
152 0 : rInfo.bCanConvToPolyLineToArea=sal_False;
153 0 : }
154 :
155 0 : SdrPageObj* SdrPageObj::Clone() const
156 : {
157 0 : return CloneHelper< SdrPageObj >();
158 : }
159 :
160 0 : SdrPageObj& SdrPageObj::operator=(const SdrPageObj& rObj)
161 : {
162 0 : if( this == &rObj )
163 0 : return *this;
164 0 : SdrObject::operator=(rObj);
165 0 : SetReferencedPage( rObj.GetReferencedPage());
166 0 : return *this;
167 : }
168 :
169 2 : void SdrPageObj::TakeObjNameSingul(XubString& rName) const
170 : {
171 2 : rName=ImpGetResStr(STR_ObjNameSingulPAGE);
172 :
173 2 : String aName( GetName() );
174 2 : if(aName.Len())
175 : {
176 0 : rName += sal_Unicode(' ');
177 0 : rName += sal_Unicode('\'');
178 0 : rName += aName;
179 0 : rName += sal_Unicode('\'');
180 2 : }
181 2 : }
182 :
183 0 : void SdrPageObj::TakeObjNamePlural(XubString& rName) const
184 : {
185 0 : rName=ImpGetResStr(STR_ObjNamePluralPAGE);
186 0 : }
187 :
188 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|