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 56 : sdr::properties::BaseProperties* SdrPageObj::CreateObjectSpecificProperties()
39 : {
40 56 : return new sdr::properties::PageProperties(*this);
41 : }
42 :
43 :
44 : // DrawContact section
45 :
46 2186 : sdr::contact::ViewContact* SdrPageObj::CreateObjectSpecificViewContact()
47 : {
48 2186 : 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 1 : void SdrPageObj::PageInDestruction(const SdrPage& rPage)
56 : {
57 1 : 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 1 : mpShownPage = 0L;
64 : }
65 1 : }
66 :
67 :
68 :
69 39512 : TYPEINIT1(SdrPageObj,SdrObject);
70 :
71 2161 : SdrPageObj::SdrPageObj(SdrPage* pNewPage)
72 2161 : : mpShownPage(pNewPage)
73 : {
74 2161 : if(mpShownPage)
75 : {
76 715 : mpShownPage->AddPageUser(*this);
77 : }
78 2161 : }
79 :
80 25 : SdrPageObj::SdrPageObj(const Rectangle& rRect, SdrPage* pNewPage)
81 25 : : mpShownPage(pNewPage)
82 : {
83 25 : if(mpShownPage)
84 : {
85 25 : mpShownPage->AddPageUser(*this);
86 : }
87 :
88 25 : aOutRect = rRect;
89 25 : }
90 :
91 6450 : SdrPageObj::~SdrPageObj()
92 : {
93 2150 : if(mpShownPage)
94 : {
95 734 : mpShownPage->RemovePageUser(*this);
96 : }
97 4300 : }
98 :
99 :
100 1869 : void SdrPageObj::SetReferencedPage(SdrPage* pNewPage)
101 : {
102 1869 : if(mpShownPage != pNewPage)
103 : {
104 329 : if(mpShownPage)
105 : {
106 328 : mpShownPage->RemovePageUser(*this);
107 : }
108 :
109 329 : mpShownPage = pNewPage;
110 :
111 329 : if(mpShownPage)
112 : {
113 329 : mpShownPage->AddPageUser(*this);
114 : }
115 :
116 329 : SetChanged();
117 329 : BroadcastObjectChange();
118 : }
119 1869 : }
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 6978 : sal_uInt16 SdrPageObj::GetObjIdentifier() const
129 : {
130 6978 : 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 50 : OUString SdrPageObj::TakeObjNameSingul() const
166 : {
167 50 : OUStringBuffer sName(ImpGetResStr(STR_ObjNameSingulPAGE));
168 :
169 100 : OUString aName(GetName());
170 50 : if (!aName.isEmpty())
171 : {
172 0 : sName.append(' ');
173 0 : sName.append('\'');
174 0 : sName.append(aName);
175 0 : sName.append('\'');
176 : }
177 :
178 100 : return sName.makeStringAndClear();
179 : }
180 :
181 0 : OUString SdrPageObj::TakeObjNamePlural() const
182 : {
183 0 : return ImpGetResStr(STR_ObjNamePluralPAGE);
184 435 : }
185 :
186 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|