merge the formfield patch from ooo-build
[ooovba.git] / sd / source / ui / slidesorter / model / SlsPageDescriptor.cxx
blob5a96304c19bbc3b634042bece6c3e6f2258970d2
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: SlsPageDescriptor.cxx,v $
10 * $Revision: 1.8 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sd.hxx"
34 #include "model/SlsPageDescriptor.hxx"
35 #include "view/SlsPageObject.hxx"
36 #include "view/SlsPageObjectViewObjectContact.hxx"
37 #include "controller/SlsPageObjectFactory.hxx"
39 #include "sdpage.hxx"
40 #include "drawdoc.hxx"
42 #include <svx/svdopage.hxx>
43 #include <svx/svdpagv.hxx>
44 #include <svx/sdr/contact/viewcontact.hxx>
46 using namespace ::com::sun::star::uno;
47 using namespace ::com::sun::star;
49 namespace sd { namespace slidesorter { namespace model {
51 PageDescriptor::PageDescriptor (
52 const Reference<drawing::XDrawPage>& rxPage,
53 SdPage* pPage,
54 const sal_Int32 nIndex,
55 const controller::PageObjectFactory& rPageObjectFactory)
56 : mpPage(pPage),
57 mxPage(rxPage),
58 mnIndex(nIndex),
59 mpPageObjectFactory(&rPageObjectFactory),
60 mpPageObject(NULL),
61 mbIsSelected(false),
62 mbIsVisible(false),
63 mbIsFocused(false),
64 mbIsCurrent(false),
65 mpViewObjectContact(NULL),
66 maModelBorder(0,0,0,0),
67 maPageNumberAreaModelSize(0,0)
69 OSL_ASSERT(mpPage == SdPage::getImplementation(rxPage));
75 PageDescriptor::~PageDescriptor (void)
82 SdPage* PageDescriptor::GetPage (void) const
84 return mpPage;
90 Reference<drawing::XDrawPage> PageDescriptor::GetXDrawPage (void) const
92 return mxPage;
98 sal_Int32 PageDescriptor::GetPageIndex (void) const
100 return mnIndex;
106 view::PageObject* PageDescriptor::GetPageObject (void)
108 if (mpPageObject==NULL && mpPageObjectFactory!=NULL && mpPage != NULL)
110 mpPageObject = mpPageObjectFactory->CreatePageObject(mpPage, shared_from_this());
113 return mpPageObject;
119 void PageDescriptor::ReleasePageObject (void)
121 mpPageObject = NULL;
127 bool PageDescriptor::IsVisible (void) const
129 return mbIsVisible;
135 void PageDescriptor::SetVisible (bool bIsVisible)
137 mbIsVisible = bIsVisible;
143 bool PageDescriptor::Select (void)
145 if ( ! IsSelected())
147 mbIsSelected = true;
148 return true;
150 else
151 return false;
157 bool PageDescriptor::Deselect (void)
159 if (IsSelected())
161 mbIsSelected = false;
162 return true;
164 else
165 return false;
171 bool PageDescriptor::IsSelected (void) const
173 return mbIsSelected;
179 bool PageDescriptor::UpdateSelection (void)
181 if (mpPage!=NULL && (mpPage->IsSelected()==TRUE) != mbIsSelected)
183 mbIsSelected = ! mbIsSelected;
184 return true;
186 else
187 return false;
193 bool PageDescriptor::IsFocused (void) const
195 return mbIsFocused;
201 void PageDescriptor::SetFocus (void)
203 mbIsFocused = true;
209 void PageDescriptor::RemoveFocus (void)
211 mbIsFocused = false;
217 view::PageObjectViewObjectContact*
218 PageDescriptor::GetViewObjectContact (void) const
220 return mpViewObjectContact;
226 void PageDescriptor::SetViewObjectContact (
227 view::PageObjectViewObjectContact* pViewObjectContact)
229 mpViewObjectContact = pViewObjectContact;
235 const controller::PageObjectFactory&
236 PageDescriptor::GetPageObjectFactory (void) const
238 return *mpPageObjectFactory;
244 void PageDescriptor::SetPageObjectFactory (
245 const controller::PageObjectFactory& rFactory)
247 mpPageObjectFactory = &rFactory;
253 void PageDescriptor::SetModelBorder (const SvBorder& rBorder)
255 maModelBorder = rBorder;
261 SvBorder PageDescriptor::GetModelBorder (void) const
263 return maModelBorder;
269 void PageDescriptor::SetPageNumberAreaModelSize (const Size& rSize)
271 maPageNumberAreaModelSize = rSize;
277 Size PageDescriptor::GetPageNumberAreaModelSize (void) const
279 return maPageNumberAreaModelSize;
285 bool PageDescriptor::IsCurrentPage (void) const
287 return mbIsCurrent;
293 void PageDescriptor::SetIsCurrentPage (const bool bIsCurrent)
295 mbIsCurrent = bIsCurrent;
300 } } } // end of namespace ::sd::slidesorter::model