Version 3.6.0.2, tag libreoffice-3.6.0.2
[LibreOffice.git] / svx / source / svdraw / svdopage.cxx
blob2c9e34e172568701640631d7f5e719a46fdd55b2
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
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.
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).
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.
27 ************************************************************************/
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>
44 ////////////////////////////////////////////////////////////////////////////////////////////////////
45 // BaseProperties section
47 sdr::properties::BaseProperties* SdrPageObj::CreateObjectSpecificProperties()
49 return new sdr::properties::PageProperties(*this);
52 //////////////////////////////////////////////////////////////////////////////
53 // DrawContact section
55 sdr::contact::ViewContact* SdrPageObj::CreateObjectSpecificViewContact()
57 return new sdr::contact::ViewContactOfPageObj(*this);
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 void SdrPageObj::PageInDestruction(const SdrPage& rPage)
66 if(mpShownPage && mpShownPage == &rPage)
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.
72 mpShownPage = 0L;
76 ////////////////////////////////////////////////////////////////////////////////////////////////////
78 TYPEINIT1(SdrPageObj,SdrObject);
80 SdrPageObj::SdrPageObj(SdrPage* pNewPage)
81 : mpShownPage(pNewPage)
83 if(mpShownPage)
85 mpShownPage->AddPageUser(*this);
89 SdrPageObj::SdrPageObj(const Rectangle& rRect, SdrPage* pNewPage)
90 : mpShownPage(pNewPage)
92 if(mpShownPage)
94 mpShownPage->AddPageUser(*this);
97 aOutRect = rRect;
100 SdrPageObj::~SdrPageObj()
102 if(mpShownPage)
104 mpShownPage->RemovePageUser(*this);
108 SdrPage* SdrPageObj::GetReferencedPage() const
110 return mpShownPage;
113 void SdrPageObj::SetReferencedPage(SdrPage* pNewPage)
115 if(mpShownPage != pNewPage)
117 if(mpShownPage)
119 mpShownPage->RemovePageUser(*this);
122 mpShownPage = pNewPage;
124 if(mpShownPage)
126 mpShownPage->AddPageUser(*this);
129 SetChanged();
130 BroadcastObjectChange();
134 // #i96598#
135 void SdrPageObj::SetBoundRectDirty()
137 // avoid resetting aOutRect which in case of this object is model data,
138 // not re-creatable view data
141 sal_uInt16 SdrPageObj::GetObjIdentifier() const
143 return sal_uInt16(OBJ_PAGE);
146 void SdrPageObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
148 rInfo.bRotateFreeAllowed=sal_False;
149 rInfo.bRotate90Allowed =sal_False;
150 rInfo.bMirrorFreeAllowed=sal_False;
151 rInfo.bMirror45Allowed =sal_False;
152 rInfo.bMirror90Allowed =sal_False;
153 rInfo.bTransparenceAllowed = sal_False;
154 rInfo.bGradientAllowed = sal_False;
155 rInfo.bShearAllowed =sal_False;
156 rInfo.bEdgeRadiusAllowed=sal_False;
157 rInfo.bNoOrthoDesired =sal_False;
158 rInfo.bCanConvToPath =sal_False;
159 rInfo.bCanConvToPoly =sal_False;
160 rInfo.bCanConvToPathLineToArea=sal_False;
161 rInfo.bCanConvToPolyLineToArea=sal_False;
164 SdrPageObj* SdrPageObj::Clone() const
166 return CloneHelper< SdrPageObj >();
169 SdrPageObj& SdrPageObj::operator=(const SdrPageObj& rObj)
171 if( this == &rObj )
172 return *this;
173 SdrObject::operator=(rObj);
174 SetReferencedPage( rObj.GetReferencedPage());
175 return *this;
178 void SdrPageObj::TakeObjNameSingul(XubString& rName) const
180 rName=ImpGetResStr(STR_ObjNameSingulPAGE);
182 String aName( GetName() );
183 if(aName.Len())
185 rName += sal_Unicode(' ');
186 rName += sal_Unicode('\'');
187 rName += aName;
188 rName += sal_Unicode('\'');
192 void SdrPageObj::TakeObjNamePlural(XubString& rName) const
194 rName=ImpGetResStr(STR_ObjNamePluralPAGE);
197 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */