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 "svdglob.hxx"
23 : #include "svx/svdstr.hrc"
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 <sdr/properties/pageproperties.hxx>
33 : #include <svx/sdr/contact/viewcontactofpageobj.hxx>
34 :
35 :
36 : // BaseProperties section
37 :
38 42 : sdr::properties::BaseProperties* SdrPageObj::CreateObjectSpecificProperties()
39 : {
40 42 : return new sdr::properties::PageProperties(*this);
41 : }
42 :
43 :
44 : // DrawContact section
45 :
46 2340 : sdr::contact::ViewContact* SdrPageObj::CreateObjectSpecificViewContact()
47 : {
48 2340 : 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 2 : void SdrPageObj::PageInDestruction(const SdrPage& rPage)
56 : {
57 2 : 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 2 : mpShownPage = 0L;
64 : }
65 2 : }
66 :
67 :
68 :
69 42296 : TYPEINIT1(SdrPageObj,SdrObject);
70 :
71 2300 : SdrPageObj::SdrPageObj(SdrPage* pNewPage)
72 2300 : : mpShownPage(pNewPage)
73 : {
74 2300 : if(mpShownPage)
75 : {
76 788 : mpShownPage->AddPageUser(*this);
77 : }
78 2300 : }
79 :
80 40 : SdrPageObj::SdrPageObj(const Rectangle& rRect, SdrPage* pNewPage)
81 40 : : mpShownPage(pNewPage)
82 : {
83 40 : if(mpShownPage)
84 : {
85 40 : mpShownPage->AddPageUser(*this);
86 : }
87 :
88 40 : aOutRect = rRect;
89 40 : }
90 :
91 7020 : SdrPageObj::~SdrPageObj()
92 : {
93 2340 : if(mpShownPage)
94 : {
95 828 : mpShownPage->RemovePageUser(*this);
96 : }
97 4680 : }
98 :
99 :
100 1870 : void SdrPageObj::SetReferencedPage(SdrPage* pNewPage)
101 : {
102 1870 : if(mpShownPage != pNewPage)
103 : {
104 274 : if(mpShownPage)
105 : {
106 272 : mpShownPage->RemovePageUser(*this);
107 : }
108 :
109 274 : mpShownPage = pNewPage;
110 :
111 274 : if(mpShownPage)
112 : {
113 274 : mpShownPage->AddPageUser(*this);
114 : }
115 :
116 274 : SetChanged();
117 274 : BroadcastObjectChange();
118 : }
119 1870 : }
120 :
121 : // #i96598#
122 0 : void SdrPageObj::SetBoundRectDirty()
123 : {
124 : // avoid resetting aOutRect which in case of this object is model data,
125 : // not re-creatable view data
126 0 : }
127 :
128 8808 : sal_uInt16 SdrPageObj::GetObjIdentifier() const
129 : {
130 8808 : return sal_uInt16(OBJ_PAGE);
131 : }
132 :
133 0 : void SdrPageObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
134 : {
135 0 : rInfo.bRotateFreeAllowed=false;
136 0 : rInfo.bRotate90Allowed =false;
137 0 : rInfo.bMirrorFreeAllowed=false;
138 0 : rInfo.bMirror45Allowed =false;
139 0 : rInfo.bMirror90Allowed =false;
140 0 : rInfo.bTransparenceAllowed = false;
141 0 : rInfo.bGradientAllowed = false;
142 0 : rInfo.bShearAllowed =false;
143 0 : rInfo.bEdgeRadiusAllowed=false;
144 0 : rInfo.bNoOrthoDesired =false;
145 0 : rInfo.bCanConvToPath =false;
146 0 : rInfo.bCanConvToPoly =false;
147 0 : rInfo.bCanConvToPathLineToArea=false;
148 0 : rInfo.bCanConvToPolyLineToArea=false;
149 0 : }
150 :
151 0 : SdrPageObj* SdrPageObj::Clone() const
152 : {
153 0 : return CloneHelper< SdrPageObj >();
154 : }
155 :
156 0 : SdrPageObj& SdrPageObj::operator=(const SdrPageObj& rObj)
157 : {
158 0 : if( this == &rObj )
159 0 : return *this;
160 0 : SdrObject::operator=(rObj);
161 0 : SetReferencedPage( rObj.GetReferencedPage());
162 0 : return *this;
163 : }
164 :
165 76 : OUString SdrPageObj::TakeObjNameSingul() const
166 : {
167 76 : OUStringBuffer sName(ImpGetResStr(STR_ObjNameSingulPAGE));
168 :
169 152 : OUString aName(GetName());
170 76 : if (!aName.isEmpty())
171 : {
172 0 : sName.append(' ');
173 0 : sName.append('\'');
174 0 : sName.append(aName);
175 0 : sName.append('\'');
176 : }
177 :
178 152 : return sName.makeStringAndClear();
179 : }
180 :
181 0 : OUString SdrPageObj::TakeObjNamePlural() const
182 : {
183 0 : return ImpGetResStr(STR_ObjNamePluralPAGE);
184 651 : }
185 :
186 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|