merge the formfield patch from ooo-build
[ooovba.git] / sd / source / ui / slidesorter / view / SlideSorterView.cxx
blobf067e879d3b0b112086fa9a3bef38e23ee5da794
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: SlideSorterView.cxx,v $
10 * $Revision: 1.29 $
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 #include "precompiled_sd.hxx"
33 #include "view/SlideSorterView.hxx"
35 #include "ViewShellBase.hxx"
36 #include "SlideSorter.hxx"
37 #include "SlideSorterViewShell.hxx"
38 #include "ViewShell.hxx"
39 #include "SlsViewCacheContext.hxx"
40 #include "view/SlsLayouter.hxx"
41 #include "view/SlsViewOverlay.hxx"
42 #include "view/SlsPageObjectViewObjectContact.hxx"
43 #include "controller/SlideSorterController.hxx"
44 #include "controller/SlsPageObjectFactory.hxx"
45 #include "controller/SlsProperties.hxx"
46 #include "model/SlideSorterModel.hxx"
47 #include "model/SlsPageEnumerationProvider.hxx"
48 #include "model/SlsPageDescriptor.hxx"
49 #include "cache/SlsPageCache.hxx"
50 #include "cache/SlsPageCacheManager.hxx"
51 #include "cache/SlsCacheContext.hxx"
52 #include "view/SlsPageObject.hxx"
53 #include "view/SlsPageObjectViewObjectContact.hxx"
54 #include "taskpane/SlideSorterCacheDisplay.hxx"
55 #include "DrawDocShell.hxx"
57 #include "drawdoc.hxx"
58 #include "sdpage.hxx"
59 #include "Window.hxx"
60 #include "sdresid.hxx"
61 #include "glob.hrc"
63 #include <svtools/itempool.hxx>
64 #include <svx/svdpagv.hxx>
65 #include <svx/svdopage.hxx>
66 #include <svx/xlndsit.hxx>
67 #include <svx/xlnclit.hxx>
68 #include <com/sun/star/presentation/FadeEffect.hpp>
69 #include <vcl/svapp.hxx>
70 #include <tools/poly.hxx>
71 #include <vcl/lineinfo.hxx>
72 #include <algorithm>
73 #include <svx/sdr/contact/objectcontact.hxx>
74 #include <svx/sdrpagewindow.hxx>
75 #include <svtools/itempool.hxx>
77 #ifndef _SFXITEMPOOL_HXX
78 #include <svtools/itempool.hxx>
79 #endif
81 using namespace std;
82 using namespace ::sd::slidesorter::model;
84 namespace sd { namespace slidesorter { namespace view {
86 TYPEINIT1(SlideSorterView, ::sd::View);
89 SlideSorterView::SlideSorterView (SlideSorter& rSlideSorter)
90 : ::sd::View (
91 rSlideSorter.GetModel().GetDocument(),
92 NULL,
93 rSlideSorter.GetViewShell()),
94 mrSlideSorter(rSlideSorter),
95 mrModel(rSlideSorter.GetModel()),
96 maPageModel(),
97 mpPage(new SdrPage(maPageModel)),
98 mpLayouter (new Layouter ()),
99 mbPageObjectVisibilitiesValid (false),
100 mpPreviewCache(),
101 mpViewOverlay (new ViewOverlay(rSlideSorter)),
102 mnFirstVisiblePageIndex(0),
103 mnLastVisiblePageIndex(-1),
104 mbModelChangedWhileModifyEnabled(true),
105 maPreviewSize(0,0),
106 mbPreciousFlagUpdatePending(true),
107 maPageNumberAreaModelSize(0,0),
108 maModelBorder(),
109 meOrientation(VERTICAL)
111 // Hide the page that contains the page objects.
112 SetPageVisible (FALSE);
114 // call FreezeIdRanges() at the pool from the newly constructed SdrModel,
115 // else creating SfxItemSets on it will complain
116 maPageModel.GetItemPool().FreezeIdRanges();
118 // add the page to the model (no, this is NOT done by the constructor :-( )
119 maPageModel.InsertPage(mpPage);
121 // show page
122 LocalModelHasChanged();
128 SlideSorterView::~SlideSorterView (void)
130 // Inform the contact objects to disconnect from the preview cache.
131 // Otherwise each dying contact object invalidates its preview. When
132 // the previews are kept for a later re-use than this invalidation is
133 // not wanted.
134 ::boost::shared_ptr<cache::PageCache> pEmptyCache;
135 model::PageEnumeration aPageEnumeration (
136 model::PageEnumerationProvider::CreateAllPagesEnumeration(mrModel));
137 while (aPageEnumeration.HasMoreElements())
139 view::PageObjectViewObjectContact* pContact
140 = aPageEnumeration.GetNextElement()->GetViewObjectContact();
141 if (pContact != NULL)
142 pContact->SetCache(pEmptyCache);
144 mpPreviewCache.reset();
146 // hide the page to avoid problems in the view when deleting
147 // visualized objects
148 HideSdrPage();
150 // Deletion of the objects and the page will be done in SdrModel
151 // destructor (as long as objects and pages are added)
157 sal_Int32 SlideSorterView::GetPageIndexAtPoint (const Point& rPosition) const
159 sal_Int32 nIndex (-1);
161 ::sd::Window* pWindow = GetWindow();
162 if (pWindow != NULL)
164 nIndex = mpLayouter->GetIndexAtPoint (pWindow->PixelToLogic (rPosition));
166 // Clip the page index against the page count.
167 if (nIndex >= mrModel.GetPageCount())
168 nIndex = -1;
171 return nIndex;
177 sal_Int32 SlideSorterView::GetFadePageIndexAtPoint (
178 const Point& rPosition) const
180 sal_Int32 nIndex (-1);
182 ::sd::Window* pWindow = GetWindow();
183 if (pWindow != NULL)
185 Point aModelPosition (pWindow->PixelToLogic (rPosition));
186 nIndex = mpLayouter->GetIndexAtPoint(
187 aModelPosition,
188 true // Include page borders into hit test
191 // Clip the page index against the page count.
192 if (nIndex >= mrModel.GetPageCount())
193 nIndex = -1;
195 if (nIndex >= 0)
197 // Now test whether the given position is inside the area of the
198 // fade effect indicator.
199 view::PageObjectViewObjectContact* pContact
200 = mrModel.GetPageDescriptor(nIndex)->GetViewObjectContact();
201 if (pContact != NULL)
203 if ( ! pContact->GetBoundingBox(
204 *pWindow,
205 PageObjectViewObjectContact::FadeEffectIndicatorBoundingBox,
206 PageObjectViewObjectContact::ModelCoordinateSystem).IsInside (
207 aModelPosition))
209 nIndex = -1;
212 else
213 nIndex = -1;
217 return nIndex;
223 Layouter& SlideSorterView::GetLayouter (void)
225 return *mpLayouter.get();
231 void SlideSorterView::ModelHasChanged (void)
233 if (mbModelChangedWhileModifyEnabled)
235 controller::SlideSorterController::ModelChangeLock alock( mrSlideSorter.GetController() );
236 mrSlideSorter.GetController().HandleModelChange();
237 LocalModelHasChanged();
244 void SlideSorterView::LocalModelHasChanged(void)
246 mbModelChangedWhileModifyEnabled = false;
248 // First call our base class.
249 View::ModelHasChanged ();
251 // Then re-set the page as current page that contains the page objects.
252 ShowSdrPage(mpPage);
254 // Initialize everything that depends on a page view, now that we have
255 // one.
256 // SetApplicationDocumentColor(
257 // Application::GetSettings().GetStyleSettings().GetWindowColor());
259 UpdatePageBorders();
265 void SlideSorterView::PreModelChange (void)
267 // Reset the slide under the mouse. It will be set to the correct slide
268 // on the next mouse motion.
269 GetOverlay().GetMouseOverIndicatorOverlay().SetSlideUnderMouse(SharedPageDescriptor());
271 // Tell the page descriptors of the model that the page objects do not
272 // exist anymore.
273 model::PageEnumeration aPageEnumeration (
274 model::PageEnumerationProvider::CreateAllPagesEnumeration(mrModel));
275 while (aPageEnumeration.HasMoreElements())
276 aPageEnumeration.GetNextElement()->ReleasePageObject();
278 // Remove all page objects from the page.
279 mpPage->Clear();
285 void SlideSorterView::PostModelChange (void)
287 // In PreModelChange() the page objects have been released. Here we
288 // create new ones.
289 ::osl::MutexGuard aGuard (mrModel.GetMutex());
291 model::PageEnumeration aPageEnumeration (
292 model::PageEnumerationProvider::CreateAllPagesEnumeration(mrModel));
293 UpdatePageBorders();
294 while (aPageEnumeration.HasMoreElements())
296 SdrPageObj* pPageObject = aPageEnumeration.GetNextElement()->GetPageObject();
297 if (pPageObject != NULL)
298 AddSdrObject(*pPageObject);
301 // The new page objects have to be scaled and positioned.
302 Layout ();
308 /** At the moment for every model change all page objects are destroyed and
309 re-created again. This can be optimized by accepting hints that
310 describe the type of change so that existing page objects can be
311 reused.
313 void SlideSorterView::HandleModelChange (void)
315 PreModelChange ();
316 PostModelChange();
322 void SlideSorterView::HandleDrawModeChange (void)
324 UpdatePageBorders();
326 // Replace the preview cache with a new and empty one. The
327 // PreviewRenderer that is used by the cache is replaced by this as
328 // well.
329 mpPreviewCache.reset();
330 GetPreviewCache()->InvalidateCache(true);
331 mrModel.SetPageObjectFactory(
332 ::std::auto_ptr<controller::PageObjectFactory>(
333 new controller::PageObjectFactory(
334 GetPreviewCache(),
335 mrSlideSorter.GetController().GetProperties())));
337 RequestRepaint();
343 void SlideSorterView::Resize (void)
345 ::sd::Window* pWindow = GetWindow();
346 if (mrModel.GetPageCount()>0 && pWindow != NULL)
348 UpdatePageBorders();
349 bool bRearrangeSuccess (false);
350 if (meOrientation == HORIZONTAL)
352 bRearrangeSuccess = mpLayouter->RearrangeHorizontal (
353 pWindow->GetSizePixel(),
354 mrModel.GetPageDescriptor(0)->GetPage()->GetSize(),
355 pWindow,
356 mrModel.GetPageCount());
358 else
360 bRearrangeSuccess = mpLayouter->RearrangeVertical (
361 pWindow->GetSizePixel(),
362 mrModel.GetPageDescriptor(0)->GetPage()->GetSize(),
363 pWindow);
366 if (bRearrangeSuccess)
368 Layout();
369 pWindow->Invalidate();
377 void SlideSorterView::Layout ()
379 ::sd::Window* pWindow = GetWindow();
380 if (pWindow != NULL)
382 // Set the model area, i.e. the smallest rectangle that includes all
383 // page objects.
384 Rectangle aViewBox (mpLayouter->GetPageBox(mrModel.GetPageCount()));
385 pWindow->SetViewOrigin (aViewBox.TopLeft());
386 pWindow->SetViewSize (aViewBox.GetSize());
388 Size aPageObjectPixelSize (pWindow->LogicToPixel(mpLayouter->GetPageObjectSize()));
389 if (maPreviewSize != aPageObjectPixelSize && mpPreviewCache.get()!=NULL)
391 mpPreviewCache->ChangeSize(aPageObjectPixelSize);
392 maPreviewSize = aPageObjectPixelSize;
395 // Iterate over all page objects and place them relative to the
396 // containing page.
397 model::PageEnumeration aPageEnumeration (
398 model::PageEnumerationProvider::CreateAllPagesEnumeration(mrModel));
399 int nIndex = 0;
400 while (aPageEnumeration.HasMoreElements())
402 model::SharedPageDescriptor pDescriptor (aPageEnumeration.GetNextElement());
403 SdrPageObj* pPageObject = pDescriptor->GetPageObject();
404 Rectangle aPageObjectBox (mpLayouter->GetPageObjectBox (nIndex));
405 pPageObject->SetSnapRect(aPageObjectBox);
407 nIndex += 1;
409 // Set the page so that it encloses all page objects.
410 mpPage->SetSize (aViewBox.GetSize());
413 InvalidatePageObjectVisibilities ();
419 void SlideSorterView::InvalidatePageObjectVisibilities (void)
421 mbPageObjectVisibilitiesValid = false;
427 void SlideSorterView::DeterminePageObjectVisibilities (void)
429 ::sd::Window* pWindow = GetWindow();
430 if (pWindow != NULL)
432 // Set this flag to true here so that an invalidate during the
433 // visibility calculation can correctly invalidate it again.
434 mbPageObjectVisibilitiesValid = true;
436 Rectangle aViewArea (
437 Point(0,0),
438 pWindow->GetSizePixel());
439 aViewArea = pWindow->PixelToLogic (aViewArea);
440 int nFirstIndex =
441 mpLayouter->GetIndexOfFirstVisiblePageObject (aViewArea);
442 int nLastIndex =
443 mpLayouter->GetIndexOfLastVisiblePageObject (aViewArea);
445 // For page objects that just dropped off the visible area we
446 // decrease the priority of pending requests for preview bitmaps.
448 int nMinIndex = ::std::min (mnFirstVisiblePageIndex, nFirstIndex);
449 int nMaxIndex = ::std::max (mnLastVisiblePageIndex, nLastIndex);
450 if (mnFirstVisiblePageIndex!=nFirstIndex || mnLastVisiblePageIndex!=nLastIndex)
451 mbPreciousFlagUpdatePending |= true;
452 model::SharedPageDescriptor pDescriptor;
453 view::PageObjectViewObjectContact* pContact;
454 for (int nIndex=nMinIndex; nIndex<=nMaxIndex; nIndex++)
456 // Determine the visibility before and after the change so that
457 // we can handle the page objects for which the visibility has
458 // changed.
459 bool bWasVisible = nIndex>=mnFirstVisiblePageIndex
460 && nIndex<=mnLastVisiblePageIndex;
461 bool bIsVisible = nIndex>=nFirstIndex && nIndex<=nLastIndex;
463 // Get the view-object-contact.
464 if (bWasVisible != bIsVisible)
466 pContact = NULL;
467 pDescriptor = mrModel.GetPageDescriptor(nIndex);
468 if (pDescriptor.get() != NULL)
469 pContact = pDescriptor->GetViewObjectContact();
471 if (pDescriptor.get() != NULL)
472 pDescriptor->SetVisible (bIsVisible);
476 mnFirstVisiblePageIndex = nFirstIndex;
477 mnLastVisiblePageIndex = nLastIndex;
484 void SlideSorterView::UpdatePreciousFlags (void)
486 if (mbPreciousFlagUpdatePending)
488 mbPreciousFlagUpdatePending = false;
490 model::SharedPageDescriptor pDescriptor;
491 ::boost::shared_ptr<cache::PageCache> pCache = GetPreviewCache();
492 sal_Int32 nPageCount (mrModel.GetPageCount());
494 for (int nIndex=0; nIndex<=nPageCount; ++nIndex)
496 pDescriptor = mrModel.GetPageDescriptor(nIndex);
497 if (pDescriptor.get() != NULL)
499 pCache->SetPreciousFlag(
500 pDescriptor->GetPage(),
501 (nIndex>=mnFirstVisiblePageIndex && nIndex<=mnLastVisiblePageIndex));
502 SSCD_SET_VISIBILITY(mrModel.GetDocument(), nIndex,
503 (nIndex>=mnFirstVisiblePageIndex && nIndex<=mnLastVisiblePageIndex));
505 else
507 // At least one cache entry can not be updated. Remember to
508 // repeat the whole updating later and leave the loop now.
509 mbPreciousFlagUpdatePending = true;
510 break;
519 void SlideSorterView::SetOrientation (const Orientation eOrientation)
521 meOrientation = eOrientation;
522 RequestRepaint();
528 SlideSorterView::Orientation SlideSorterView::GetOrientation (void) const
530 return meOrientation;
536 void SlideSorterView::RequestRepaint (void)
538 ::sd::Window* pWindow = GetWindow();
539 if (pWindow != NULL)
540 pWindow->Invalidate();
546 void SlideSorterView::RequestRepaint (const model::SharedPageDescriptor& rpDescriptor)
548 ::sd::Window* pWindow = GetWindow();
549 if (pWindow != NULL)
550 pWindow->Invalidate(
551 GetPageBoundingBox (
552 rpDescriptor,
553 CS_MODEL,
554 BBT_INFO));
560 Rectangle SlideSorterView::GetModelArea (void)
562 return Rectangle (
563 Point (0,0),
564 Size (mpPage->GetSize().Width(),mpPage->GetSize().Height()));
570 Rectangle SlideSorterView::GetPageBoundingBox (
571 const model::SharedPageDescriptor& rpDescriptor,
572 CoordinateSystem eCoordinateSystem,
573 BoundingBoxType eBoundingBoxType) const
575 Rectangle aBBox;
576 SdrObject* pPageObject = rpDescriptor->GetPageObject();
577 if (pPageObject != NULL)
579 aBBox = pPageObject->GetCurrentBoundRect();
580 AdaptBoundingBox (aBBox, eCoordinateSystem, eBoundingBoxType);
583 return aBBox;
589 Rectangle SlideSorterView::GetPageBoundingBox (
590 sal_Int32 nIndex,
591 CoordinateSystem eCoordinateSystem,
592 BoundingBoxType eBoundingBoxType) const
594 Rectangle aBBox;
595 if (nIndex >= 0 && nIndex<mrModel.GetPageCount())
597 aBBox = mpLayouter->GetPageObjectBox(nIndex);
598 AdaptBoundingBox (aBBox, eCoordinateSystem, eBoundingBoxType);
601 return aBBox;
607 void SlideSorterView::CompleteRedraw(OutputDevice* pDevice, const Region& rPaintArea, sdr::contact::ViewObjectContactRedirector* pRedirector)
609 if (mnLockRedrawSmph == 0)
611 // Update the page visibilities when they have been invalidated.
612 if ( ! mbPageObjectVisibilitiesValid)
613 DeterminePageObjectVisibilities();
615 if (mbPreciousFlagUpdatePending)
616 UpdatePreciousFlags();
618 // Call the base class InitRedraw even when re-drawing is locked to
619 // let it remember the request for a redraw.
620 View::CompleteRedraw (pDevice, rPaintArea, pRedirector);
622 else
624 // In sd::View::CompleteRedraw() this call is recorded and given
625 // region is painted when the view is unlocked.
626 View::CompleteRedraw (pDevice, rPaintArea, pRedirector);
633 void SlideSorterView::InvalidateOneWin (::Window& rWindow)
635 // if ( IsInvalidateAllowed() )
636 View::InvalidateOneWin (rWindow);
642 void SlideSorterView::InvalidateOneWin (
643 ::Window& rWindow,
644 const Rectangle& rPaintArea)
646 // if( IsInvalidateAllowed() )
647 View::InvalidateOneWin (rWindow, rPaintArea);
653 ::sd::Window* SlideSorterView::GetWindow (void) const
655 return static_cast< ::sd::Window*>(GetFirstOutputDevice());
661 void SlideSorterView::AdaptBoundingBox (
662 Rectangle& rModelPageObjectBoundingBox,
663 CoordinateSystem eCoordinateSystem,
664 BoundingBoxType eBoundingBoxType) const
666 CoordinateSystem aCurrentCoordinateSystem = CS_MODEL;
667 ::sd::Window* pWindow = GetWindow();
668 if (pWindow != NULL)
670 if (eBoundingBoxType == BBT_INFO)
672 // Make the box larger so that it encloses all relevant
673 // displayed information.
674 if (aCurrentCoordinateSystem == CS_MODEL)
676 // The relevant offsets are given in pixel values. Therefore
677 // transform the box first into screen coordinates.
678 rModelPageObjectBoundingBox
679 = pWindow->LogicToPixel (rModelPageObjectBoundingBox);
680 aCurrentCoordinateSystem = CS_SCREEN;
682 rModelPageObjectBoundingBox.Left() -= maPagePixelBorder.Left();
683 rModelPageObjectBoundingBox.Right() += maPagePixelBorder.Right();
684 rModelPageObjectBoundingBox.Top() -= maPagePixelBorder.Top();
685 rModelPageObjectBoundingBox.Bottom() += maPagePixelBorder.Bottom();
688 // Make sure that the bounding box is given in the correct coordinate
689 // system.
690 if (eCoordinateSystem != aCurrentCoordinateSystem)
692 if (eCoordinateSystem == CS_MODEL)
693 rModelPageObjectBoundingBox
694 = pWindow->PixelToLogic (rModelPageObjectBoundingBox);
695 else
696 rModelPageObjectBoundingBox
697 = pWindow->LogicToPixel (rModelPageObjectBoundingBox);
705 ::boost::shared_ptr<cache::PageCache> SlideSorterView::GetPreviewCache (void)
707 ::sd::Window* pWindow = GetWindow();
708 if (pWindow != NULL && mpPreviewCache.get() == NULL)
710 maPreviewSize = pWindow->LogicToPixel(mpLayouter->GetPageObjectSize());
711 mpPreviewCache.reset(
712 new cache::PageCache(
713 maPreviewSize,
714 cache::SharedCacheContext(new ViewCacheContext(mrSlideSorter.GetModel(), *this))));
717 return mpPreviewCache;
723 ViewOverlay& SlideSorterView::GetOverlay (void)
725 return *mpViewOverlay.get();
731 ::sdr::contact::ObjectContact& SlideSorterView::GetObjectContact (void) const
733 return GetSdrPageView()->GetPageWindow(0)->GetObjectContact();
739 SlideSorterView::PageRange SlideSorterView::GetVisiblePageRange (void)
741 const int nMaxPageIndex (mrModel.GetPageCount() - 1);
742 if ( ! mbPageObjectVisibilitiesValid)
743 DeterminePageObjectVisibilities();
744 return PageRange(
745 ::std::min(mnFirstVisiblePageIndex,nMaxPageIndex),
746 ::std::min(mnLastVisiblePageIndex, nMaxPageIndex));
752 void SlideSorterView::Notify (SfxBroadcaster& rBroadcaster, const SfxHint& rHint)
754 ::sd::DrawDocShell* pDocShell = mrModel.GetDocument()->GetDocSh();
755 if (pDocShell!=NULL && pDocShell->IsEnableSetModified())
756 mbModelChangedWhileModifyEnabled = true;
758 ::sd::View::Notify(rBroadcaster, rHint);
764 void SlideSorterView::UpdatePageBorders (void)
766 maPagePixelBorder = SvBorder();
767 ::sd::Window* pWindow = GetWindow();
768 if (mrModel.GetPageCount()>0 && pWindow!=NULL)
770 // Calculate the border in model coordinates.
771 maPageNumberAreaModelSize = PageObjectViewObjectContact::CalculatePageNumberAreaModelSize (
772 pWindow,
773 mrModel.GetPageCount());
774 maModelBorder = PageObjectViewObjectContact::CalculatePageModelBorder (
775 pWindow,
776 mrModel.GetPageCount());
778 // Depending on values in the global properties the border has to be
779 // extended a little bit.
780 ::boost::shared_ptr<controller::Properties> pProperties(
781 mrSlideSorter.GetController().GetProperties());
782 if (pProperties.get()!=NULL && pProperties->IsHighlightCurrentSlide())
784 Size aBorderSize (pWindow->PixelToLogic (Size(3,3)));
785 maModelBorder.Left() += aBorderSize.Width();
786 maModelBorder.Right() += aBorderSize.Width();
787 maModelBorder.Top() += aBorderSize.Height();
788 maModelBorder.Bottom() += aBorderSize.Height();
791 // Set the border at all page descriptors so that the contact
792 // objects have access to them.
793 model::PageEnumeration aPageEnumeration (
794 model::PageEnumerationProvider::CreateAllPagesEnumeration(mrModel));
795 while (aPageEnumeration.HasMoreElements())
797 model::SharedPageDescriptor pDescriptor (aPageEnumeration.GetNextElement());
798 pDescriptor->SetModelBorder(maModelBorder);
799 pDescriptor->SetPageNumberAreaModelSize(maPageNumberAreaModelSize);
802 // Convert the borders to pixel coordinates and store them for later
803 // use.
804 Size aTopLeftBorders(pWindow->LogicToPixel(
805 Size (maModelBorder.Left(), maModelBorder.Top())));
806 Size aBottomRightBorders(pWindow->LogicToPixel(
807 Size (maModelBorder.Right(), maModelBorder.Bottom())));
808 maPagePixelBorder = SvBorder (
809 aTopLeftBorders.Width(),
810 aTopLeftBorders.Height(),
811 aBottomRightBorders.Width(),
812 aBottomRightBorders.Height());
815 // Finally tell the layouter about the borders.
816 mpLayouter->SetBorders (2,5,4,5);
817 mpLayouter->SetPageBorders (
818 maPagePixelBorder.Left(),
819 maPagePixelBorder.Right(),
820 maPagePixelBorder.Top(),
821 maPagePixelBorder.Bottom());
827 Size SlideSorterView::GetPageNumberAreaModelSize (void) const
829 return maPageNumberAreaModelSize;
835 SvBorder SlideSorterView::GetModelBorder (void) const
837 return maModelBorder;
843 void SlideSorterView::AddSdrObject (SdrObject& rObject)
845 mpPage->InsertObject(&rObject);
846 rObject.SetModel(&maPageModel);
849 } } } // end of namespace ::sd::slidesorter::view