1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: SlsPageDescriptor.cxx,v $
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"
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
,
54 const sal_Int32 nIndex
,
55 const controller::PageObjectFactory
& rPageObjectFactory
)
59 mpPageObjectFactory(&rPageObjectFactory
),
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
90 Reference
<drawing::XDrawPage
> PageDescriptor::GetXDrawPage (void) const
98 sal_Int32
PageDescriptor::GetPageIndex (void) const
106 view::PageObject
* PageDescriptor::GetPageObject (void)
108 if (mpPageObject
==NULL
&& mpPageObjectFactory
!=NULL
&& mpPage
!= NULL
)
110 mpPageObject
= mpPageObjectFactory
->CreatePageObject(mpPage
, shared_from_this());
119 void PageDescriptor::ReleasePageObject (void)
127 bool PageDescriptor::IsVisible (void) const
135 void PageDescriptor::SetVisible (bool bIsVisible
)
137 mbIsVisible
= bIsVisible
;
143 bool PageDescriptor::Select (void)
157 bool PageDescriptor::Deselect (void)
161 mbIsSelected
= false;
171 bool PageDescriptor::IsSelected (void) const
179 bool PageDescriptor::UpdateSelection (void)
181 if (mpPage
!=NULL
&& (mpPage
->IsSelected()==TRUE
) != mbIsSelected
)
183 mbIsSelected
= ! mbIsSelected
;
193 bool PageDescriptor::IsFocused (void) const
201 void PageDescriptor::SetFocus (void)
209 void PageDescriptor::RemoveFocus (void)
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
293 void PageDescriptor::SetIsCurrentPage (const bool bIsCurrent
)
295 mbIsCurrent
= bIsCurrent
;
300 } } } // end of namespace ::sd::slidesorter::model