summaryrefslogtreecommitdiff
path: root/sd/source/ui/slidesorter/view
diff options
context:
space:
mode:
Diffstat (limited to 'sd/source/ui/slidesorter/view')
-rw-r--r--sd/source/ui/slidesorter/view/SlideSorterView.cxx1135
-rw-r--r--sd/source/ui/slidesorter/view/SlsButtonBar.cxx1558
-rw-r--r--sd/source/ui/slidesorter/view/SlsFontProvider.cxx135
-rw-r--r--sd/source/ui/slidesorter/view/SlsFramePainter.cxx265
-rw-r--r--sd/source/ui/slidesorter/view/SlsFramePainter.hxx121
-rw-r--r--sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx537
-rw-r--r--sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx448
-rw-r--r--sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx565
-rw-r--r--sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx99
-rw-r--r--sd/source/ui/slidesorter/view/SlsLayouter.cxx1555
-rw-r--r--sd/source/ui/slidesorter/view/SlsPageObject.cxx83
-rw-r--r--sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx287
-rw-r--r--sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx584
-rw-r--r--sd/source/ui/slidesorter/view/SlsResource.hxx50
-rw-r--r--sd/source/ui/slidesorter/view/SlsResource.src314
-rw-r--r--sd/source/ui/slidesorter/view/SlsTheme.cxx536
-rw-r--r--sd/source/ui/slidesorter/view/SlsToolTip.cxx230
-rw-r--r--sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx162
-rw-r--r--sd/source/ui/slidesorter/view/SlsViewCacheContext.hxx73
19 files changed, 0 insertions, 8737 deletions
diff --git a/sd/source/ui/slidesorter/view/SlideSorterView.cxx b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
deleted file mode 100644
index ce2b3a641..000000000
--- a/sd/source/ui/slidesorter/view/SlideSorterView.cxx
+++ /dev/null
@@ -1,1135 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "precompiled_sd.hxx"
-
-#include "view/SlideSorterView.hxx"
-
-#include "ViewShellBase.hxx"
-#include "SlideSorter.hxx"
-#include "SlideSorterViewShell.hxx"
-#include "ViewShell.hxx"
-#include "SlsViewCacheContext.hxx"
-#include "SlsLayeredDevice.hxx"
-#include "view/SlsLayouter.hxx"
-#include "view/SlsPageObjectLayouter.hxx"
-#include "view/SlsPageObjectPainter.hxx"
-#include "view/SlsILayerPainter.hxx"
-#include "view/SlsButtonBar.hxx"
-#include "view/SlsToolTip.hxx"
-#include "controller/SlideSorterController.hxx"
-#include "controller/SlsProperties.hxx"
-#include "model/SlideSorterModel.hxx"
-#include "model/SlsPageEnumerationProvider.hxx"
-#include "model/SlsPageDescriptor.hxx"
-#include "cache/SlsPageCache.hxx"
-#include "cache/SlsPageCacheManager.hxx"
-#include "cache/SlsCacheContext.hxx"
-#include "taskpane/SlideSorterCacheDisplay.hxx"
-#include "DrawDocShell.hxx"
-#include "PaneDockingWindow.hxx"
-
-#include "drawdoc.hxx"
-#include "sdpage.hxx"
-#include "Window.hxx"
-#include "sdresid.hxx"
-#include "glob.hrc"
-
-#include <svl/itempool.hxx>
-#include <svx/svdpagv.hxx>
-#include <svx/svdopage.hxx>
-#include <svx/xlndsit.hxx>
-#include <svx/xlnclit.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/scrbar.hxx>
-#include <tools/poly.hxx>
-#include <vcl/lineinfo.hxx>
-#include <algorithm>
-#include <svx/sdrpagewindow.hxx>
-#include <svl/itempool.hxx>
-#include <basegfx/matrix/b2dhommatrix.hxx>
-#include <basegfx/polygon/b2dpolygontools.hxx>
-#include <basegfx/polygon/b2dpolygon.hxx>
-#include <drawinglayer/geometry/viewinformation2d.hxx>
-#include <canvas/elapsedtime.hxx>
-
-//#define DEBUG_TIMING
-#include <svl/itempool.hxx>
-#ifdef DEBUG_TIMING
-#include <vector>
-#endif
-#include <boost/foreach.hpp>
-
-
-using namespace std;
-using namespace ::sd::slidesorter::model;
-using namespace ::drawinglayer::primitive2d;
-
-
-namespace sd { namespace slidesorter { namespace view {
-
-namespace {
- /** Wrapper around the SlideSorterView that supports the IPainter
- interface and that allows the LayeredDevice to hold the
- SlideSorterView (held as scoped_ptr by the SlideSorter) as
- shared_ptr.
- */
- class Painter : public ILayerPainter
- {
- public:
- Painter (SlideSorterView& rView) : mrView(rView) {}
- virtual ~Painter (void) {}
-
- virtual void Paint (OutputDevice& rDevice, const Rectangle& rRepaintArea)
- {
- mrView.Paint(rDevice,rRepaintArea);
- }
-
- virtual void SetLayerInvalidator (const SharedILayerInvalidator&) {}
-
- private:
- SlideSorterView& mrView;
- };
-}
-
-
-
-class BackgroundPainter
- : public ILayerPainter,
- public ::boost::noncopyable
-{
-public:
- BackgroundPainter (const Color aBackgroundColor) : maBackgroundColor(aBackgroundColor) {}
- virtual ~BackgroundPainter (void) {}
-
- virtual void Paint (OutputDevice& rDevice, const Rectangle& rRepaintArea)
- {
- rDevice.SetFillColor(maBackgroundColor);
- rDevice.SetLineColor();
- rDevice.DrawRect(rRepaintArea);
- }
-
- virtual void SetLayerInvalidator (const SharedILayerInvalidator&) {}
-
- void SetColor (const Color aColor) { maBackgroundColor = aColor; }
-
-private:
- Color maBackgroundColor;
-};
-
-
-
-TYPEINIT1(SlideSorterView, ::sd::View);
-
-SlideSorterView::SlideSorterView (SlideSorter& rSlideSorter)
- : ::sd::View (
- rSlideSorter.GetModel().GetDocument(),
- rSlideSorter.GetContentWindow().get(),
- rSlideSorter.GetViewShell()),
- mrSlideSorter(rSlideSorter),
- mrModel(rSlideSorter.GetModel()),
- mbIsDisposed(false),
- mpLayouter (new Layouter(rSlideSorter.GetContentWindow(), rSlideSorter.GetTheme())),
- mbPageObjectVisibilitiesValid (false),
- mpPreviewCache(),
- mpLayeredDevice(new LayeredDevice(rSlideSorter.GetContentWindow())),
- maVisiblePageRange(-1,-1),
- mbModelChangedWhileModifyEnabled(true),
- maPreviewSize(0,0),
- mbPreciousFlagUpdatePending(true),
- meOrientation(Layouter::GRID),
- mpProperties(rSlideSorter.GetProperties()),
- mpPageUnderMouse(),
- mnButtonUnderMouse(-1),
- mpPageObjectPainter(),
- mpSelectionPainter(),
- mpBackgroundPainter(
- new BackgroundPainter(mrSlideSorter.GetTheme()->GetColor(Theme::Color_Background))),
- mpButtonBar(new ButtonBar(mrSlideSorter)),
- mpToolTip(new ToolTip(mrSlideSorter)),
- mbIsRearrangePending(true),
- maVisibilityChangeListeners()
-{
- // Hide the page that contains the page objects.
- SetPageVisible (sal_False);
-
-
- // Register the background painter on level 1 to avoid the creation of a
- // background buffer.
- mpLayeredDevice->RegisterPainter(mpBackgroundPainter, 1);
-
- // Wrap a shared_ptr-held-wrapper around this view and register it as
- // painter at the layered device. There is no explicit destruction: in
- // the SlideSorterView destructor the layered device is destroyed and
- // with it the only reference to the wrapper which therefore is also
- // destroyed.
- SharedILayerPainter pPainter (new Painter(*this));
-
- // The painter is placed on level 1 to avoid buffering. This should be
- // a little faster during animations because the previews are painted
- // directly into the window, not via the buffer.
- mpLayeredDevice->RegisterPainter(pPainter, 1);
-}
-
-
-
-
-SlideSorterView::~SlideSorterView (void)
-{
- if ( ! mbIsDisposed)
- {
- OSL_ASSERT(mbIsDisposed);
- Dispose();
- }
-}
-
-
-
-
-void SlideSorterView::Init (void)
-{
- HandleModelChange();
-}
-
-
-
-
-void SlideSorterView::Dispose (void)
-{
- mpSelectionPainter.reset();
-
- mpLayeredDevice->Dispose();
- mpPreviewCache.reset();
-
- SetPageUnderMouse(SharedPageDescriptor(),false);
-
- // Hide the page to avoid problems in the view when deleting
- // visualized objects
- HideSdrPage();
-
- // Deletion of the objects and the page will be done in SdrModel
- // destructor (as long as objects and pages are added)
-
- OSL_ASSERT(mpLayeredDevice.unique());
- mpLayeredDevice.reset();
-
- mbIsDisposed = true;
-}
-
-
-
-
-sal_Int32 SlideSorterView::GetPageIndexAtPoint (const Point& rWindowPosition) const
-{
- sal_Int32 nIndex (-1);
-
- SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
- if (pWindow)
- {
- nIndex = mpLayouter->GetIndexAtPoint(pWindow->PixelToLogic(rWindowPosition), false, false);
-
- // Clip the page index against the page count.
- if (nIndex >= mrModel.GetPageCount())
- nIndex = -1;
- }
-
- return nIndex;
-}
-
-
-
-
-Layouter& SlideSorterView::GetLayouter (void)
-{
- return *mpLayouter.get();
-}
-
-
-
-
-void SlideSorterView::ModelHasChanged (void)
-{
- // Ignore this call. Rely on hints sent by the model to get informed of
- // model changes.
-}
-
-
-
-
-void SlideSorterView::LocalModelHasChanged(void)
-{
- mbModelChangedWhileModifyEnabled = false;
-
- // First call our base class.
- View::ModelHasChanged ();
-}
-
-
-
-
-void SlideSorterView::PreModelChange (void)
-{
- // Reset the slide under the mouse. It will be re-set in PostModelChange().
- SetPageUnderMouse(SharedPageDescriptor());
-}
-
-
-
-
-void SlideSorterView::PostModelChange (void)
-{
- // In PreModelChange() the page objects have been released. Here we
- // create new ones.
- ::osl::MutexGuard aGuard (mrModel.GetMutex());
-
- model::PageEnumeration aPageEnumeration (
- model::PageEnumerationProvider::CreateAllPagesEnumeration(mrModel));
-
- // The new page objects have to be scaled and positioned.
- RequestRearrange();
- RequestRepaint();
-}
-
-
-
-
-/** At the moment for every model change all page objects are destroyed and
- re-created again. This can be optimized by accepting hints that
- describe the type of change so that existing page objects can be
- reused.
-*/
-void SlideSorterView::HandleModelChange (void)
-{
- PreModelChange ();
- PostModelChange();
-}
-
-
-
-
-void SlideSorterView::HandleDrawModeChange (void)
-{
- // Replace the preview cache with a new and empty one. The
- // PreviewRenderer that is used by the cache is replaced by this as
- // well.
- mpPreviewCache.reset();
- GetPreviewCache()->InvalidateCache(true);
-
- RequestRepaint();
-}
-
-
-
-
-void SlideSorterView::HandleDataChangeEvent (void)
-{
- GetPageObjectPainter()->SetTheme(mrSlideSorter.GetTheme());
-
- // Update the color used by the background painter.
- ::boost::shared_ptr<BackgroundPainter> pPainter (
- ::boost::dynamic_pointer_cast<BackgroundPainter>(mpBackgroundPainter));
- if (pPainter)
- pPainter->SetColor(mrSlideSorter.GetTheme()->GetColor(Theme::Color_Background));
-
- if (mpButtonBar)
- mpButtonBar->HandleDataChangeEvent();
-
- RequestRepaint();
-}
-
-
-
-
-void SlideSorterView::Resize (void)
-{
- UpdateOrientation();
-
- mpLayeredDevice->Resize();
- RequestRearrange();
-}
-
-
-
-
-void SlideSorterView::RequestRearrange (void)
-{
- mbIsRearrangePending = true;
- Rearrange();
-}
-
-
-
-
-void SlideSorterView::Rearrange (void)
-{
- if ( ! mbIsRearrangePending)
- return;
- if (mrModel.GetPageCount() <= 0)
- return;
-
- SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
- if ( ! pWindow)
- return;
- const Size aWindowSize (pWindow->GetSizePixel());
- if (aWindowSize.Width()<=0 || aWindowSize.Height()<=0)
- return;
-
- const bool bRearrangeSuccess (
- mpLayouter->Rearrange (
- meOrientation,
- aWindowSize,
- mrModel.GetPageDescriptor(0)->GetPage()->GetSize(),
- mrModel.GetPageCount()));
- if (bRearrangeSuccess)
- {
- mbIsRearrangePending = false;
- Layout();
- UpdatePageUnderMouse(false);
- // RequestRepaint();
- }
-}
-
-
-
-
-void SlideSorterView::UpdateOrientation (void)
-{
- // The layout of slides depends on whether the slide sorter is
- // displayed in the center or the side pane.
- if (mrSlideSorter.GetViewShell()->IsMainViewShell())
- SetOrientation(Layouter::GRID);
- else
- {
- // Get access to the docking window.
- ::Window* pWindow = mrSlideSorter.GetContentWindow().get();
- PaneDockingWindow* pDockingWindow = NULL;
- while (pWindow!=NULL && pDockingWindow==NULL)
- {
- pDockingWindow = dynamic_cast<PaneDockingWindow*>(pWindow);
- pWindow = pWindow->GetParent();
- }
-
- if (pDockingWindow != NULL)
- {
- const long nScrollBarSize (
- Application::GetSettings().GetStyleSettings().GetScrollBarSize());
- switch (pDockingWindow->GetOrientation())
- {
- case PaneDockingWindow::HorizontalOrientation:
- if (SetOrientation(Layouter::HORIZONTAL))
- {
- const Range aRange (mpLayouter->GetValidVerticalSizeRange());
- pDockingWindow->SetValidSizeRange(Range(
- aRange.Min() + nScrollBarSize,
- aRange.Max() + nScrollBarSize));
- }
- break;
-
- case PaneDockingWindow::VerticalOrientation:
- if (SetOrientation(Layouter::VERTICAL))
- {
- const Range aRange (mpLayouter->GetValidHorizontalSizeRange());
- pDockingWindow->SetValidSizeRange(Range(
- aRange.Min() + nScrollBarSize,
- aRange.Max() + nScrollBarSize));
- }
- break;
-
- case PaneDockingWindow::UnknownOrientation:
- if (SetOrientation(Layouter::GRID))
- {
- const sal_Int32 nAdditionalSize (10);
- pDockingWindow->SetMinOutputSizePixel(Size(
- mpLayouter->GetValidHorizontalSizeRange().Min()
- + nScrollBarSize
- + nAdditionalSize,
- mpLayouter->GetValidVerticalSizeRange().Min()
- + nScrollBarSize
- + nAdditionalSize));
- }
- return;
- }
- }
- else
- {
- // We are not placed in a docking window. One possible reason
- // is that the slide sorter is temporarily into a cache and was
- // reparented to a non-docking window.
- SetOrientation(Layouter::GRID);
- }
- }
-}
-
-
-
-
-void SlideSorterView::Layout ()
-{
- SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
- if (pWindow)
- {
- // Set the model area, i.e. the smallest rectangle that includes all
- // page objects.
- const Rectangle aViewBox (mpLayouter->GetTotalBoundingBox());
- pWindow->SetViewOrigin (aViewBox.TopLeft());
- pWindow->SetViewSize (aViewBox.GetSize());
-
- ::boost::shared_ptr<PageObjectLayouter> pPageObjectLayouter(
- mpLayouter->GetPageObjectLayouter());
- if (pPageObjectLayouter)
- {
- const Size aNewPreviewSize (mpLayouter->GetPageObjectLayouter()->GetSize(
- PageObjectLayouter::Preview,
- PageObjectLayouter::WindowCoordinateSystem));
- if (maPreviewSize != aNewPreviewSize && GetPreviewCache())
- {
- mpPreviewCache->ChangeSize(aNewPreviewSize, true);
- maPreviewSize = aNewPreviewSize;
- }
- }
-
- // Iterate over all page objects and place them relative to the
- // containing page.
- model::PageEnumeration aPageEnumeration (
- model::PageEnumerationProvider::CreateAllPagesEnumeration(mrModel));
- while (aPageEnumeration.HasMoreElements())
- {
- model::SharedPageDescriptor pDescriptor (aPageEnumeration.GetNextElement());
- pDescriptor->SetBoundingBox(mpLayouter->GetPageObjectBox(pDescriptor->GetPageIndex()));
- }
-
- GetPageObjectPainter()->NotifyResize();
- }
-
- InvalidatePageObjectVisibilities ();
-}
-
-
-
-
-void SlideSorterView::InvalidatePageObjectVisibilities (void)
-{
- mbPageObjectVisibilitiesValid = false;
-}
-
-
-
-
-void SlideSorterView::DeterminePageObjectVisibilities (void)
-{
- SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
- if (pWindow)
- {
- // Set this flag to true here so that an invalidate during the
- // visibility calculation can correctly invalidate it again.
- mbPageObjectVisibilitiesValid = true;
-
- Rectangle aViewArea (pWindow->PixelToLogic(Rectangle(Point(0,0),pWindow->GetSizePixel())));
- const Range aRange (mpLayouter->GetRangeOfVisiblePageObjects(aViewArea));
- const Range aUnion(
- ::std::min(maVisiblePageRange.Min(), aRange.Min()),
- ::std::max(maVisiblePageRange.Max(), aRange.Max()));
-
- // For page objects that just dropped off the visible area we
- // decrease the priority of pending requests for preview bitmaps.
- if (maVisiblePageRange != aRange)
- mbPreciousFlagUpdatePending |= true;
-
- model::SharedPageDescriptor pDescriptor;
- for (int nIndex=aUnion.Min(); nIndex<=aUnion.Max(); nIndex++)
- {
- pDescriptor = mrModel.GetPageDescriptor(nIndex);
- if (pDescriptor.get() != NULL)
- SetState(
- pDescriptor,
- PageDescriptor::ST_Visible,
- aRange.IsInside(nIndex));
- }
-
- // Broadcast a change of the set of visible page objects.
- if (maVisiblePageRange != aRange)
- {
- maVisiblePageRange = aRange;
-
- // Tell the listeners that the visibility of some objects has
- // changed.
- ::std::vector<Link>& aChangeListeners (maVisibilityChangeListeners);
- for (::std::vector<Link>::const_iterator
- iLink(aChangeListeners.begin()),
- iEnd(aChangeListeners.end());
- iLink!=iEnd;
- ++iLink)
- {
- iLink->Call(NULL);
- }
- }
-
-
- // Restore the mouse over state.
- UpdatePageUnderMouse(true);
- }
-}
-
-
-
-
-void SlideSorterView::UpdatePreciousFlags (void)
-{
- if (mbPreciousFlagUpdatePending)
- {
- mbPreciousFlagUpdatePending = false;
-
- model::SharedPageDescriptor pDescriptor;
- ::boost::shared_ptr<cache::PageCache> pCache = GetPreviewCache();
- sal_Int32 nPageCount (mrModel.GetPageCount());
-
- for (int nIndex=0; nIndex<=nPageCount; ++nIndex)
- {
- pDescriptor = mrModel.GetPageDescriptor(nIndex);
- if (pDescriptor.get() != NULL)
- {
- pCache->SetPreciousFlag(
- pDescriptor->GetPage(),
- maVisiblePageRange.IsInside(nIndex));
- SSCD_SET_VISIBILITY(mrModel.GetDocument(), nIndex,
- maVisiblePageRange.IsInside(nIndex));
- }
- else
- {
- // At least one cache entry can not be updated. Remember to
- // repeat the whole updating later and leave the loop now.
- mbPreciousFlagUpdatePending = true;
- break;
- }
- }
- }
-}
-
-
-
-
-bool SlideSorterView::SetOrientation (const Layouter::Orientation eOrientation)
-{
- if (meOrientation != eOrientation)
- {
- meOrientation = eOrientation;
- return true;
- }
- else
- return false;
-}
-
-
-
-
-Layouter::Orientation SlideSorterView::GetOrientation (void) const
-{
- return meOrientation;
-}
-
-
-
-
-void SlideSorterView::RequestRepaint (void)
-{
- SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
- if (pWindow)
- {
- mpLayeredDevice->InvalidateAllLayers(
- Rectangle(
- pWindow->PixelToLogic(Point(0,0)),
- pWindow->PixelToLogic(pWindow->GetSizePixel())));
- pWindow->Invalidate();
- }
-}
-
-
-
-
-void SlideSorterView::RequestRepaint (const model::SharedPageDescriptor& rpDescriptor)
-{
- if (rpDescriptor)
- RequestRepaint(rpDescriptor->GetBoundingBox());
-}
-
-
-
-
-void SlideSorterView::RequestRepaint (const Rectangle& rRepaintBox)
-{
- SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
- if (pWindow)
- {
- mpLayeredDevice->InvalidateAllLayers(rRepaintBox);
- pWindow->Invalidate(rRepaintBox);
- }
-}
-
-
-
-void SlideSorterView::RequestRepaint (const Region& rRepaintRegion)
-{
- SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
- if (pWindow)
- {
- mpLayeredDevice->InvalidateAllLayers(rRepaintRegion);
- pWindow->Invalidate(rRepaintRegion);
- }
-}
-
-
-
-
-Rectangle SlideSorterView::GetModelArea (void)
-{
- return mpLayouter->GetTotalBoundingBox();
-}
-
-
-#ifdef DEBUG_TIMING
-static ::canvas::tools::ElapsedTime gaTimer;
-static const size_t gFrameTimeCount (10);
-static size_t gFrameTimeIndex (0);
-static ::std::vector<double> gFrameTimes (gFrameTimeCount, 0);
-static double gFrameTimeSum (0);
-static const Rectangle gFrameTimeBox (10,10,150,20);
-static double gnLastFrameStart = 0;
-#endif
-
-void SlideSorterView::CompleteRedraw (
- OutputDevice* pDevice,
- const Region& rPaintArea,
- sdr::contact::ViewObjectContactRedirector* pRedirector)
-{
- (void)pRedirector;
-#ifdef DEBUG_TIMING
- const double nStartTime (gaTimer.getElapsedTime());
- OSL_TRACE("SlideSorterView::CompleteRedraw start at %f, %s",
- nStartTime,
- mnLockRedrawSmph ? "locked" : "");
-#endif
-
- if (pDevice == NULL || pDevice!=mrSlideSorter.GetContentWindow().get())
- return;
-
- // The parent implementation of CompleteRedraw is called only when
- // painting is locked. We do all the painting ourself. When painting
- // is locked the parent implementation keeps track of the repaint
- // requests and later, when painting is unlocked, calls CompleteRedraw
- // for all missed repaints.
-
- if (mnLockRedrawSmph == 0)
- {
- mrSlideSorter.GetContentWindow()->IncrementLockCount();
- if (mpLayeredDevice->HandleMapModeChange())
- DeterminePageObjectVisibilities();
- mpLayeredDevice->Repaint(rPaintArea);
- mrSlideSorter.GetContentWindow()->DecrementLockCount();
- }
- else
- {
- maRedrawRegion.Union(rPaintArea);
- }
-
-#ifdef DEBUG_TIMING
- const double nEndTime (gaTimer.getElapsedTime());
- OSL_TRACE("SlideSorterView::CompleteRedraw end at %f after %fms", nEndTime, (nEndTime-nStartTime)*1000);
- gFrameTimeSum -= gFrameTimes[gFrameTimeIndex];
- gFrameTimes[gFrameTimeIndex] = nStartTime - gnLastFrameStart;
- gnLastFrameStart = nStartTime;
- gFrameTimeSum += gFrameTimes[gFrameTimeIndex];
- gFrameTimeIndex = (gFrameTimeIndex+1) % gFrameTimeCount;
-
-
- mrSlideSorter.GetContentWindow()->SetFillColor(COL_BLUE);
- mrSlideSorter.GetContentWindow()->DrawRect(gFrameTimeBox);
- mrSlideSorter.GetContentWindow()->SetTextColor(COL_WHITE);
- mrSlideSorter.GetContentWindow()->DrawText(
- gFrameTimeBox,
- ::rtl::OUString::valueOf(1 / (gFrameTimeSum / gFrameTimeCount)),
- TEXT_DRAW_RIGHT | TEXT_DRAW_VCENTER);
- // mrSlideSorter.GetContentWindow()->Invalidate(gFrameTimeBox);
-#endif
-}
-
-
-
-
-void SlideSorterView::Paint (
- OutputDevice& rDevice,
- const Rectangle& rRepaintArea)
-{
- if ( ! mpPageObjectPainter)
- if ( ! GetPageObjectPainter())
- return;
-
- // Update the page visibilities when they have been invalidated.
- if ( ! mbPageObjectVisibilitiesValid)
- DeterminePageObjectVisibilities();
-
- if (mbPreciousFlagUpdatePending)
- UpdatePreciousFlags();
-
- if (mbIsRearrangePending)
- Rearrange();
-
- // Paint all page objects that are fully or partially inside the
- // repaint region.
- const Range aRange (mpLayouter->GetRangeOfVisiblePageObjects(rRepaintArea));
- for (sal_Int32 nIndex=aRange.Min(); nIndex<=aRange.Max(); ++nIndex)
- {
- model::SharedPageDescriptor pDescriptor (mrModel.GetPageDescriptor(nIndex));
- if (!pDescriptor || ! pDescriptor->HasState(PageDescriptor::ST_Visible))
- continue;
-
- mpPageObjectPainter->PaintPageObject(rDevice, pDescriptor);
- }
-}
-
-
-
-
-void SlideSorterView::ConfigurationChanged (
- utl::ConfigurationBroadcaster* pBroadcaster,
- sal_uInt32 nHint)
-{
- // Some changes of the configuration (some of the colors for example)
- // may affect the previews. Throw away the old ones and create new ones.
- cache::PageCacheManager::Instance()->InvalidateAllCaches();
-
- ::sd::View::ConfigurationChanged(pBroadcaster, nHint);
- RequestRepaint();
-
-}
-
-
-
-
-::boost::shared_ptr<cache::PageCache> SlideSorterView::GetPreviewCache (void)
-{
- SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
- if (pWindow && mpPreviewCache.get() == NULL)
- {
- mpPreviewCache.reset(
- new cache::PageCache(
- mpLayouter->GetPageObjectSize(),
- false,
- cache::SharedCacheContext(new ViewCacheContext(mrSlideSorter))));
- }
-
- return mpPreviewCache;
-}
-
-
-
-
-Pair SlideSorterView::GetVisiblePageRange (void)
-{
- if ( ! mbPageObjectVisibilitiesValid)
- DeterminePageObjectVisibilities();
- return maVisiblePageRange;
-}
-
-
-
-
-void SlideSorterView::AddVisibilityChangeListener (const Link& rListener)
-{
- if (::std::find (
- maVisibilityChangeListeners.begin(),
- maVisibilityChangeListeners.end(),
- rListener) == maVisibilityChangeListeners.end())
- {
- maVisibilityChangeListeners.push_back(rListener);
- }
-}
-
-
-
-
-void SlideSorterView::RemoveVisibilityChangeListener(const Link&rListener)
-{
- maVisibilityChangeListeners.erase (
- ::std::find (
- maVisibilityChangeListeners.begin(),
- maVisibilityChangeListeners.end(),
- rListener));
-}
-
-
-
-
-ButtonBar& SlideSorterView::GetButtonBar (void) const
-{
- OSL_ASSERT(mpButtonBar);
- return *mpButtonBar;
-}
-
-
-
-
-ToolTip& SlideSorterView::GetToolTip (void) const
-{
- OSL_ASSERT(mpToolTip);
- return *mpToolTip;
-}
-
-
-
-
-void SlideSorterView::Notify (SfxBroadcaster& rBroadcaster, const SfxHint& rHint)
-{
- ::sd::DrawDocShell* pDocShell = mrModel.GetDocument()->GetDocSh();
- if (pDocShell!=NULL && pDocShell->IsEnableSetModified())
- mbModelChangedWhileModifyEnabled = true;
-
- ::sd::View::Notify(rBroadcaster, rHint);
-}
-
-
-
-
-void SlideSorterView::UpdatePageUnderMouse (bool bAnimate)
-{
- ::boost::shared_ptr<ScrollBar> pVScrollBar (mrSlideSorter.GetVerticalScrollBar());
- ::boost::shared_ptr<ScrollBar> pHScrollBar (mrSlideSorter.GetHorizontalScrollBar());
- if ((pVScrollBar && pVScrollBar->IsVisible() && pVScrollBar->IsTracking())
- || (pHScrollBar && pHScrollBar->IsVisible() && pHScrollBar->IsTracking()))
- {
- // One of the scroll bars is tracking mouse movement. Do not
- // highlight the slide under the mouse in this case.
- SetPageUnderMouse(SharedPageDescriptor(),false);
- return;
- }
-
- SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
- if (pWindow && pWindow->IsVisible() && ! pWindow->IsMouseCaptured())
- {
- const Window::PointerState aPointerState (pWindow->GetPointerState());
- const Rectangle aWindowBox (pWindow->GetPosPixel(), pWindow->GetSizePixel());
- if (aWindowBox.IsInside(aPointerState.maPos))
- {
- UpdatePageUnderMouse (
- aPointerState.maPos,
- (aPointerState.mnState & MOUSE_LEFT)!=0,
- bAnimate);
- return;
- }
- }
-
- SetPageUnderMouse(SharedPageDescriptor(),false);
-}
-
-
-
-
-void SlideSorterView::UpdatePageUnderMouse (
- const Point& rMousePosition,
- const bool bIsMouseButtonDown,
- const bool bAnimate)
-{
- UpdatePageUnderMouse(
- mrSlideSorter.GetController().GetPageAt(rMousePosition),
- rMousePosition,
- bIsMouseButtonDown,
- bAnimate);
-}
-
-
-
-
-void SlideSorterView::UpdatePageUnderMouse (
- const model::SharedPageDescriptor& rpDescriptor,
- const Point& rMousePosition,
- const bool bIsMouseButtonDown,
- const bool bAnimate)
-{
- // Update the page under the mouse.
- SetPageUnderMouse(rpDescriptor, bAnimate);
-
- // Tell the button bar about the new mouse position.
- SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
- const Point aMouseModelPosition (pWindow->PixelToLogic(rMousePosition));
-
- ::boost::shared_ptr<ViewShell> pMainViewShell (mrSlideSorter.GetViewShellBase()->GetMainViewShell());
- if (pMainViewShell
- && pMainViewShell->GetShellType()!=ViewShell::ST_DRAW)
- {
- const bool bIsMouseOverButtonBar (GetButtonBar().IsMouseOverBar());
- GetButtonBar().ProcessMouseMotionEvent(rpDescriptor, aMouseModelPosition, bIsMouseButtonDown);
- // Set the help text of the slide when the mouse was moved from the
- // button bar back over the preview.
- if (rpDescriptor
- && GetButtonBar().IsMouseOverBar() != bIsMouseOverButtonBar
- && bIsMouseOverButtonBar)
- {
- mpToolTip->ShowDefaultHelpText();
- }
- }
-}
-
-
-
-
-void SlideSorterView::SetPageUnderMouse (
- const model::SharedPageDescriptor& rpDescriptor,
- const bool bAnimate)
-{
- if (mpPageUnderMouse != rpDescriptor)
- {
- if (mpPageUnderMouse)
- SetState(mpPageUnderMouse, PageDescriptor::ST_MouseOver, false, bAnimate);
-
- mpPageUnderMouse = rpDescriptor;
-
- if (mpPageUnderMouse)
- SetState(mpPageUnderMouse, PageDescriptor::ST_MouseOver, true, bAnimate);
-
- // Change the quick help text to display the name of the page under
- // the mouse.
- mpToolTip->SetPage(rpDescriptor);
- }
-}
-
-
-
-
-bool SlideSorterView::SetState (
- const model::SharedPageDescriptor& rpDescriptor,
- const PageDescriptor::State eState,
- const bool bStateValue,
- const bool bAnimate)
-{
- model::SharedPageDescriptor pDescriptor (rpDescriptor);
- if ( ! pDescriptor)
- return false;
-
- const bool bModified (pDescriptor->SetState(eState, bStateValue));
- if ( ! bModified)
- return false;
-
- // When the page object is not visible (i.e. not on the screen then
- // nothing has to be painted.
- if (pDescriptor->HasState(PageDescriptor::ST_Visible))
- {
- // For most states a change of that state leads to visible
- // difference and we have to request a repaint.
- if (eState != PageDescriptor::ST_WasSelected)
- RequestRepaint(pDescriptor);
- }
-
- ::boost::shared_ptr<ViewShell> pMainViewShell(mrSlideSorter.GetViewShellBase()->GetMainViewShell());
- if (pMainViewShell
- && pMainViewShell->GetShellType()!=ViewShell::ST_DRAW)
- {
- // Fade in or out the buttons.
- if (eState == PageDescriptor::ST_MouseOver)
- {
- if (bStateValue)
- GetButtonBar().RequestFadeIn(rpDescriptor, bAnimate);
- else
- GetButtonBar().RequestFadeOut(rpDescriptor, bAnimate);
- }
- }
-
- return bModified;
-}
-
-
-
-
-::boost::shared_ptr<PageObjectPainter> SlideSorterView::GetPageObjectPainter (void)
-{
- if ( ! mpPageObjectPainter)
- mpPageObjectPainter.reset(new PageObjectPainter(mrSlideSorter));
- return mpPageObjectPainter;
-}
-
-
-
-
-::boost::shared_ptr<LayeredDevice> SlideSorterView::GetLayeredDevice (void) const
-{
- return mpLayeredDevice;
-}
-
-
-
-
-//===== SlideSorterView::DrawLock =============================================
-
-SlideSorterView::DrawLock::DrawLock (
- view::SlideSorterView& rView,
- const SharedSdWindow& rpWindow)
- : mrView(rView),
- mpWindow(rpWindow)
-{
- if (mrView.mnLockRedrawSmph == 0)
- mrView.maRedrawRegion.SetEmpty();
- ++mrView.mnLockRedrawSmph;
-}
-
-
-
-
-SlideSorterView::DrawLock::DrawLock (SlideSorter& rSlideSorter)
- : mrView(rSlideSorter.GetView()),
- mpWindow(rSlideSorter.GetContentWindow())
-{
- if (mrView.mnLockRedrawSmph == 0)
- mrView.maRedrawRegion.SetEmpty();
- ++mrView.mnLockRedrawSmph;
-}
-
-
-
-
-SlideSorterView::DrawLock::~DrawLock (void)
-{
- OSL_ASSERT(mrView.mnLockRedrawSmph>0);
- --mrView.mnLockRedrawSmph;
- if (mrView.mnLockRedrawSmph == 0)
- if (mpWindow)
- {
- mpWindow->Invalidate(mrView.maRedrawRegion);
- mpWindow->Update();
- }
-}
-
-
-
-
-void SlideSorterView::DrawLock::Dispose (void)
-{
- mpWindow.reset();
-}
-
-
-} } } // end of namespace ::sd::slidesorter::view
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/view/SlsButtonBar.cxx b/sd/source/ui/slidesorter/view/SlsButtonBar.cxx
deleted file mode 100644
index 5c0adf49a..000000000
--- a/sd/source/ui/slidesorter/view/SlsButtonBar.cxx
+++ /dev/null
@@ -1,1558 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "precompiled_sd.hxx"
-
-#include "view/SlsButtonBar.hxx"
-
-#include "SlideSorter.hxx"
-#include "model/SlsPageDescriptor.hxx"
-#include "model/SlideSorterModel.hxx"
-#include "view/SlsTheme.hxx"
-#include "view/SlideSorterView.hxx"
-#include "view/SlsToolTip.hxx"
-#include "controller/SlideSorterController.hxx"
-#include "controller/SlsSlotManager.hxx"
-#include "controller/SlsCurrentSlideManager.hxx"
-#include "controller/SlsPageSelector.hxx"
-#include "controller/SlsAnimator.hxx"
-#include "controller/SlsAnimationFunction.hxx"
-#include "app.hrc"
-#include "drawdoc.hxx"
-#include <svx/svxids.hrc>
-#include <sfx2/dispatch.hxx>
-#include <vcl/bmpacc.hxx>
-#include <vcl/virdev.hxx>
-#include <basegfx/polygon/b2dpolygontools.hxx>
-#include <basegfx/polygon/b2dpolygon.hxx>
-#include <com/sun/star/presentation/XPresentation2.hpp>
-#include <boost/bind.hpp>
-
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::beans::PropertyValue;
-using ::com::sun::star::presentation::XPresentation2;
-
-namespace sd { namespace slidesorter { namespace view {
-
-/** Base class for the painter of the background bar onto which the buttons
- are painted. It also provides some size information.
-*/
-class ButtonBar::BackgroundTheme
-{
-public:
- BackgroundTheme(
- const ::boost::shared_ptr<Theme>& rpTheme,
- const ::std::vector<SharedButton>& rButtons);
- /** Set the preview bounding box, the maximal area in which to display
- buttons. A call to this method triggers a call to Layout().
- */
- void SetPreviewBoundingBox (const Rectangle& rPreviewBoundingBox);
- Button::IconSize GetIconSize (void) const;
-
- virtual BitmapEx CreateBackground (
- const OutputDevice& rTemplateDevice,
- const bool bIsButtonDown) const = 0;
- virtual Point GetBackgroundLocation (void) = 0;
- virtual Rectangle GetButtonArea (void) = 0;
-
-protected:
- ::boost::shared_ptr<Theme> mpTheme;
- Rectangle maPreviewBoundingBox;
- Size maMinimumLargeButtonAreaSize;
- Size maMinimumMediumButtonAreaSize;
- Size maMinimumSmallButtonAreaSize;
- Button::IconSize meIconSize;
-
- virtual void Layout (void) = 0;
-
-private:
- void UpdateMinimumIconSizes(const ::std::vector<SharedButton>& rButtons);
-};
-
-
-namespace {
- /** Rectangular button bar that covers the whole width of the preview.
- */
- class RectangleBackgroundTheme : public ButtonBar::BackgroundTheme
- {
- public:
- RectangleBackgroundTheme(
- const ::boost::shared_ptr<Theme>& rpTheme,
- const ::std::vector<SharedButton>& rButtons);
- virtual BitmapEx CreateBackground (
- const OutputDevice& rTemplateDevice,
- const bool bIsButtonDown) const;
- virtual Point GetBackgroundLocation (void);
- virtual Rectangle GetButtonArea (void);
- protected:
- virtual void Layout (void);
- private:
- sal_Int32 mnBarHeight;
- };
-
- /** Button bar is composed of three images, the left and right end of
- the bar and the center image. Buttons are only placed over the
- center image. The center image is painted as is, it is not scaled.
- */
- class BitmapBackgroundTheme : public ButtonBar::BackgroundTheme
- {
- public:
- BitmapBackgroundTheme(
- const ::boost::shared_ptr<Theme>& rpTheme,
- const ::std::vector<SharedButton>& rButtons);
- virtual BitmapEx CreateBackground (
- const OutputDevice& rTemplateDevice,
- const bool bIsButtonDown) const;
- virtual Point GetBackgroundLocation (void);
- virtual Rectangle GetButtonArea (void);
- protected:
- virtual void Layout (void);
- private:
- Rectangle maButtonArea;
- Point maBackgroundLocation;
- };
-
- /** The source mask is essentially multiplied with the given alpha value.
- The result is writen to the result mask.
- */
- void AdaptTransparency (AlphaMask& rMask, const AlphaMask& rSourceMask, const double nAlpha)
- {
- BitmapWriteAccess* pBitmap = rMask.AcquireWriteAccess();
- const BitmapReadAccess* pSourceBitmap = const_cast<AlphaMask&>(rSourceMask).AcquireReadAccess();
-
- if (pBitmap!=NULL && pSourceBitmap!=NULL)
- {
- const sal_Int32 nWidth (pBitmap->Width());
- const sal_Int32 nHeight (pBitmap->Height());
-
- for (sal_Int32 nY = 0; nY<nHeight; ++nY)
- for (sal_Int32 nX = 0; nX<nWidth; ++nX)
- {
- const sal_uInt8 nValue (255 - pSourceBitmap->GetPixel(nY, nX).GetBlueOrIndex());
- const sal_uInt8 nNewValue (static_cast<sal_uInt8>(nValue * (1-nAlpha)));
- pBitmap->SetPixel(nY, nX, 255-nNewValue);
- }
- }
- }
-
-} // end of anonymous namespace
-
-
-//===== ButtonBar::Lock =======================================================
-
-ButtonBar::Lock::Lock (SlideSorter& rSlideSorter)
- : mrButtonBar(rSlideSorter.GetView().GetButtonBar())
-{
- mrButtonBar.AcquireLock();
-}
-
-
-
-
-ButtonBar::Lock::~Lock (void)
-{
- mrButtonBar.ReleaseLock();
-}
-
-
-
-
-//===== ButtonBar =============================================================
-
-ButtonBar::ButtonBar (SlideSorter& rSlideSorter)
- : mrSlideSorter(rSlideSorter),
- maPageObjectSize(0,0),
- maButtonBoundingBox(),
- maBackgroundLocation(),
- mpDescriptor(),
- mbIsExcluded(false),
- mpButtonUnderMouse(),
- mpDownButton(),
- maRegularButtons(),
- maExcludedButtons(),
- maNormalBackground(),
- maButtonDownBackground(),
- mbIsMouseOverBar(false),
- mpBackgroundTheme(),
- mnLockCount(0)
-{
- HandleDataChangeEvent();
-}
-
-
-
-
-ButtonBar::~ButtonBar (void)
-{
-}
-
-
-
-
-void ButtonBar::ProcessButtonDownEvent (
- const model::SharedPageDescriptor& rpDescriptor,
- const Point aMouseModelLocation)
-{
- SetButtonUnderMouse(GetButtonAt(aMouseModelLocation));
- if (mpButtonUnderMouse)
- mpButtonUnderMouse->SetState(Button::State_Down);
- mpDownButton = mpButtonUnderMouse;
-
- mrSlideSorter.GetView().RequestRepaint(rpDescriptor);
-}
-
-
-
-
-void ButtonBar::ProcessButtonUpEvent (
- const model::SharedPageDescriptor& rpDescriptor,
- const Point aMouseModelLocation)
-{
- SetButtonUnderMouse(GetButtonAt(aMouseModelLocation));
- if (mpButtonUnderMouse)
- {
- mpButtonUnderMouse->SetState(Button::State_Hover);
- if (mpButtonUnderMouse == mpDownButton)
- {
- // This is done only when the buttons are sufficiently visible.
- if (mpDescriptor->GetVisualState().GetButtonAlpha()<0.7)
- {
- mpButtonUnderMouse->ProcessClick(mpDescriptor);
- mbIsExcluded = mpDescriptor->HasState(model::PageDescriptor::ST_Excluded);
- ProcessMouseMotionEvent (rpDescriptor, aMouseModelLocation, false);
- }
- }
- }
- mpDownButton.reset();
- mrSlideSorter.GetView().RequestRepaint(rpDescriptor);
-}
-
-
-
-
-void ButtonBar::ProcessMouseMotionEvent (
- const model::SharedPageDescriptor& rpDescriptor,
- const Point aMouseModelLocation,
- const bool bIsMouseButtonDown)
-{
- model::SharedPageDescriptor pOldDescriptor (mpDescriptor);
- bool bPageHasChanged (false);
- bool bButtonHasChanged (false);
- bool bButtonStateHasChanged (false);
-
- // Update the page object for which to manage the buttons.
- bPageHasChanged = SetPage(rpDescriptor);
- mbIsMouseOverBar = IsMouseOverBar(aMouseModelLocation);
-
- // Update button under mouse.
- if (rpDescriptor)
- {
- bButtonHasChanged = SetButtonUnderMouse(GetButtonAt(aMouseModelLocation));
-
- if (mpButtonUnderMouse)
- {
- // When the mouse button is down, mark the button under the
- // mouse only as pressed when it is the same button the mouse
- // button was pressed over, and where the button release would
- // lead to a click action.
- if (bIsMouseButtonDown)
- {
- if (mpButtonUnderMouse==mpDownButton)
- bButtonStateHasChanged = mpButtonUnderMouse->SetState(Button::State_Down);
- }
- else
- bButtonStateHasChanged = mpButtonUnderMouse->SetState(Button::State_Hover);
- }
- }
-
- // Show a quick help text when the mouse is over a button.
- if (bButtonHasChanged)
- {
- SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
- if (pWindow)
- {
- if (mpButtonUnderMouse)
- mrSlideSorter.GetView().GetToolTip().ShowHelpText(mpButtonUnderMouse->GetHelpText());
- else
- mrSlideSorter.GetView().GetToolTip().ShowDefaultHelpText();
- }
- }
-
- if (bPageHasChanged || bButtonHasChanged || bButtonStateHasChanged)
- {
- if (pOldDescriptor)
- mrSlideSorter.GetView().RequestRepaint(pOldDescriptor);
- if (mpDescriptor && pOldDescriptor!=mpDescriptor)
- mrSlideSorter.GetView().RequestRepaint(mpDescriptor);
- }
-}
-
-
-
-
-void ButtonBar::ResetPage (void)
-{
- SetPage(model::SharedPageDescriptor());
-}
-
-
-
-
-bool ButtonBar::SetPage (const model::SharedPageDescriptor& rpDescriptor)
-{
- if (mpDescriptor != rpDescriptor)
- {
- mpDescriptor = rpDescriptor;
-
- if (mpDescriptor)
- mbIsExcluded = mpDescriptor->HasState(model::PageDescriptor::ST_Excluded);
- else
- mbIsExcluded = false;
- SetButtonUnderMouse();
- mpDownButton.reset();
-
- return true;
- }
- else
- return false;
-}
-
-
-
-
-sal_Int32 ButtonBar::GetButtonCount (const bool bIsExcluded) const
-{
- if (bIsExcluded)
- return maExcludedButtons.size();
- else
- return maRegularButtons.size();
-}
-
-
-
-
-::boost::shared_ptr<Button> ButtonBar::GetButton (
- const bool bIsExcluded,
- const sal_Int32 nIndex) const
-{
- const ::std::vector<boost::shared_ptr<Button> >& rButtons (bIsExcluded
- ? maExcludedButtons
- : maRegularButtons);
-
- if (nIndex<0 || sal_uInt32(nIndex)>=rButtons.size())
- {
- OSL_ASSERT(nIndex<0 || sal_uInt32(nIndex)>=rButtons.size());
- return ::boost::shared_ptr<Button>();
- }
- else
- return rButtons[sal_uInt32(nIndex)];
-}
-
-
-
-
-SharedButton ButtonBar::GetButtonAt (const Point aModelLocation)
-{
- if (IsMouseOverBar(aModelLocation))
- {
- const Point aLocalLocation (aModelLocation - mpDescriptor->GetBoundingBox().TopLeft());
- ::std::vector<SharedButton>& rButtons (
- mbIsExcluded ? maExcludedButtons : maRegularButtons);
- for (sal_uInt32 nIndex=0; nIndex<rButtons.size(); ++nIndex)
- {
- if (rButtons[sal_uInt32(nIndex)]->GetBoundingBox().IsInside(aLocalLocation))
- {
- if (rButtons[sal_uInt32(nIndex)]->IsEnabled())
- return rButtons[sal_uInt32(nIndex)];
- else
- return SharedButton();
- }
- }
- }
-
- return SharedButton();
-}
-
-
-
-
-bool ButtonBar::IsMouseOverBar (void) const
-{
- return mbIsMouseOverBar;
-}
-
-
-
-
-bool ButtonBar::SetButtonUnderMouse (const SharedButton& rButton)
-{
- if (mpButtonUnderMouse != rButton)
- {
- if (mpButtonUnderMouse)
- mpButtonUnderMouse->SetState(Button::State_Normal);
-
- mpButtonUnderMouse = rButton;
-
- return true;
- }
- else
- return false;
-}
-
-
-
-
-void ButtonBar::Paint (
- OutputDevice& rDevice,
- const model::SharedPageDescriptor& rpDescriptor)
-{
- if ( ! rpDescriptor)
- return;
-
- const double nButtonBarAlpha (rpDescriptor->GetVisualState().GetButtonBarAlpha());
- if (nButtonBarAlpha >= 1)
- return;
-
- LayoutButtons(rpDescriptor->GetBoundingBox().GetSize());
-
- const Point aOffset (rpDescriptor->GetBoundingBox().TopLeft());
-
- // Paint the background.
- PaintButtonBackground(rDevice, rpDescriptor, aOffset);
-
- // Paint the buttons.
- const ::std::vector<SharedButton>& rButtons (
- rpDescriptor->HasState(model::PageDescriptor::ST_Excluded)
- ? maExcludedButtons
- : maRegularButtons);
-
-
- const double nButtonAlpha (rpDescriptor->GetVisualState().GetButtonAlpha());
- for (sal_uInt32 nIndex=0; nIndex<rButtons.size(); ++nIndex)
- rButtons[nIndex]->Paint(
- rDevice,
- aOffset,
- nButtonAlpha,
- mrSlideSorter.GetTheme());
-}
-
-
-
-
-bool ButtonBar::IsMouseOverButton (void) const
-{
- return mpButtonUnderMouse;
-}
-
-
-
-
-void ButtonBar::PaintButtonBackground (
- OutputDevice& rDevice,
- const model::SharedPageDescriptor& rpDescriptor,
- const Point aOffset)
-{
- BitmapEx* pBitmap = NULL;
- if (maButtonDownBackground.IsEmpty() || maNormalBackground.IsEmpty())
- {
- if (mpBackgroundTheme)
- {
- maButtonDownBackground = mpBackgroundTheme->CreateBackground(rDevice, true);
- maNormalBackground = mpBackgroundTheme->CreateBackground(rDevice, false);
- }
- }
- if (mpButtonUnderMouse && mpButtonUnderMouse->IsDown())
- pBitmap = &maButtonDownBackground;
- else
- pBitmap = &maNormalBackground;
- if (pBitmap != NULL)
- {
- AlphaMask aMask (pBitmap->GetSizePixel());
- AdaptTransparency(
- aMask,
- pBitmap->GetAlpha(),
- rpDescriptor->GetVisualState().GetButtonBarAlpha());
- rDevice.DrawBitmapEx(maBackgroundLocation+aOffset, BitmapEx(pBitmap->GetBitmap(), aMask));
- }
-}
-
-
-
-
-bool ButtonBar::IsMouseOverBar (const Point aModelLocation) const
-{
- if ( ! mpDescriptor || ! mpDescriptor->GetBoundingBox().IsInside(aModelLocation))
- return false;
-
- if ( ! maButtonBoundingBox.IsInside(aModelLocation - mpDescriptor->GetBoundingBox().TopLeft()))
- return false;
-
- return true;
-}
-
-
-
-
-void ButtonBar::RequestLayout (void)
-{
- maPageObjectSize = Size(0,0);
-}
-
-
-
-
-void ButtonBar::LayoutButtons (const Size aPageObjectSize)
-{
- if (maPageObjectSize != aPageObjectSize)
- {
- maPageObjectSize = aPageObjectSize;
-
- if (mpBackgroundTheme)
- {
- mpBackgroundTheme->SetPreviewBoundingBox(
- mrSlideSorter.GetView().GetLayouter().GetPageObjectLayouter()->GetBoundingBox(
- Point(0,0),
- PageObjectLayouter::Preview,
- PageObjectLayouter::ModelCoordinateSystem));
- LayoutButtons();
- }
-
- // Release the background bitmaps so that on the next paint
- // they are created anew in the right size.
- maNormalBackground.SetEmpty();
- maButtonDownBackground.SetEmpty();
- }
-}
-
-
-
-
-bool ButtonBar::LayoutButtons (void)
-{
- const sal_Int32 nGap (mrSlideSorter.GetTheme()->GetIntegerValue(Theme::Integer_ButtonGap));
- const sal_Int32 nBorder (mrSlideSorter.GetTheme()->GetIntegerValue(Theme::Integer_ButtonBorder));
-
- const Button::IconSize eIconSize (mpBackgroundTheme->GetIconSize());
-
- // Tell buttons which size they are.
- for (sal_uInt32 nIndex=0; nIndex<maExcludedButtons.size(); ++nIndex)
- maExcludedButtons[nIndex]->SetIconSize(eIconSize);
- for (sal_uInt32 nIndex=0; nIndex<maRegularButtons.size(); ++nIndex)
- maRegularButtons[nIndex]->SetIconSize(eIconSize);
-
- // Determine maximal height and total width of the buttons.
- // Start with the buttons used for the excluded state.
- sal_Int32 nMaximumHeight (0);
- sal_Int32 nExcludedTotalWidth ((maExcludedButtons.size()-1) * nGap + 2*nBorder);
- for (sal_uInt32 nIndex=0; nIndex<maExcludedButtons.size(); ++nIndex)
- {
- const Size aSize (maExcludedButtons[nIndex]->GetSize());
- if (aSize.Height() > nMaximumHeight)
- nMaximumHeight = aSize.Height();
- nExcludedTotalWidth += aSize.Width();
- }
-
- // Do the same for the regular buttons.
- sal_Int32 nRegularTotalWidth ((maRegularButtons.size()-1) * nGap + 2*nBorder);
- for (sal_uInt32 nIndex=0; nIndex<maRegularButtons.size(); ++nIndex)
- {
- const Size aSize (maRegularButtons[nIndex]->GetSize());
- if (aSize.Height() > nMaximumHeight)
- nMaximumHeight = aSize.Height();
- nRegularTotalWidth += aSize.Width();
- }
- nMaximumHeight += 2*nBorder;
-
- // Set up the bounding box of the button bar.
- maButtonBoundingBox = mpBackgroundTheme->GetButtonArea();
- maBackgroundLocation = mpBackgroundTheme->GetBackgroundLocation();
- if (mrSlideSorter.GetTheme()->GetIntegerValue(Theme::Integer_ButtonPaintType) == 1)
- {
- // Center the buttons.
- maButtonBoundingBox.Left() += (maButtonBoundingBox.GetWidth() - nRegularTotalWidth)/2;
- maButtonBoundingBox.Right() = maButtonBoundingBox.Left() + nRegularTotalWidth - 1;
- }
-
- // Place the buttons.
- Rectangle aBox (maButtonBoundingBox);
- aBox.Right() -= nBorder;
- for (sal_Int32 nIndex=maRegularButtons.size()-1; nIndex>=0; --nIndex)
- {
- maRegularButtons[nIndex]->Place(aBox);
- aBox.Right() = maRegularButtons[nIndex]->GetBoundingBox().Left() - nGap;
- }
-
- // For slides excluded from the show there is only one icon placed
- // exactly like the second of the regular icons.
- if (maRegularButtons.size()>=2 && maExcludedButtons.size()>=1)
- {
- aBox = maRegularButtons[1]->GetBoundingBox();
- maExcludedButtons[0]->Place(aBox);
- }
-
- // We return true only when there is no inactive button.
- for (sal_uInt32 nIndex=0; nIndex<maExcludedButtons.size(); ++nIndex)
- if ( ! maExcludedButtons[nIndex]->IsActive())
- return false;
- for (sal_uInt32 nIndex=0; nIndex<maRegularButtons.size(); ++nIndex)
- if ( ! maRegularButtons[nIndex]->IsActive())
- return false;
-
- return true;
-}
-
-
-
-
-void ButtonBar::RequestFadeIn (
- const model::SharedPageDescriptor& rpDescriptor,
- const bool bAnimate)
-{
- if ( ! rpDescriptor)
- return;
- if (mnLockCount > 0)
- return;
-
- const double nMinAlpha (0);
- if ( ! bAnimate)
- {
- rpDescriptor->GetVisualState().SetButtonAlpha(nMinAlpha);
- rpDescriptor->GetVisualState().SetButtonBarAlpha(nMinAlpha);
- }
- else
- StartFadeAnimation(rpDescriptor, nMinAlpha, true);
-}
-
-
-
-
-void ButtonBar::RequestFadeOut (
- const model::SharedPageDescriptor& rpDescriptor,
- const bool bAnimate)
-{
- if ( ! rpDescriptor)
- return;
- if (mnLockCount > 0)
- return;
-
- const double nMaxAlpha (1);
- if ( ! bAnimate)
- {
- rpDescriptor->GetVisualState().SetButtonAlpha(nMaxAlpha);
- rpDescriptor->GetVisualState().SetButtonBarAlpha(nMaxAlpha);
- }
- else
- StartFadeAnimation(rpDescriptor, nMaxAlpha, false);
-}
-
-
-
-
-bool ButtonBar::IsVisible (const model::SharedPageDescriptor& rpDescriptor)
-{
- const double nMaxAlpha (1);
- return rpDescriptor && rpDescriptor->GetVisualState().GetButtonBarAlpha() < nMaxAlpha;
-}
-
-
-
-
-void ButtonBar::HandleDataChangeEvent (void)
-{
- maExcludedButtons.clear();
- maExcludedButtons.push_back(::boost::shared_ptr<Button>(new UnhideButton(mrSlideSorter)));
-
- maRegularButtons.clear();
- maRegularButtons.push_back(::boost::shared_ptr<Button>(new StartShowButton(mrSlideSorter)));
- maRegularButtons.push_back(::boost::shared_ptr<Button>(new HideButton(mrSlideSorter)));
- maRegularButtons.push_back(::boost::shared_ptr<Button>(new DuplicateButton(mrSlideSorter)));
-
- mpBackgroundTheme.reset(
- new BitmapBackgroundTheme(
- mrSlideSorter.GetTheme(),
- maRegularButtons));
-
- // Force layout on next Paint().
- maPageObjectSize = Size(0,0);
-}
-
-
-
-
-void ButtonBar::StartFadeAnimation (
- const model::SharedPageDescriptor& rpDescriptor,
- const double nTargetAlpha,
- const bool bFadeIn)
-{
- model::SharedPageDescriptor pDescriptor (rpDescriptor);
-
- const double nCurrentButtonAlpha (pDescriptor->GetVisualState().GetButtonAlpha());
- const double nCurrentButtonBarAlpha (pDescriptor->GetVisualState().GetButtonBarAlpha());
-
- // Stop a running animation.
- const controller::Animator::AnimationId nId (
- pDescriptor->GetVisualState().GetButtonAlphaAnimationId());
- if (nId != controller::Animator::NotAnAnimationId)
- mrSlideSorter.GetController().GetAnimator()->RemoveAnimation(nId);
-
- // Prepare the blending functors that translate [0,1] animation
- // times into alpha values of buttons and button bar.
- const ::boost::function<double(double)> aButtonBlendFunctor (
- ::boost::bind(
- controller::AnimationFunction::Blend,
- nCurrentButtonAlpha,
- nTargetAlpha,
- ::boost::bind(controller::AnimationFunction::Linear, _1)));
- const ::boost::function<double(double)> aButtonBarBlendFunctor (
- ::boost::bind(
- controller::AnimationFunction::Blend,
- nCurrentButtonBarAlpha,
- nTargetAlpha,
- ::boost::bind(controller::AnimationFunction::Linear, _1)));
-
- // Delay the fade in a little bit when the buttons are not visible at
- // all so that we do not leave a trail of half-visible buttons when the
- // mouse is moved across the screen. No delay on fade out or when the
- // buttons are already showing. Fade out is faster than fade in.
- const double nDelay (nCurrentButtonBarAlpha>0 && nCurrentButtonBarAlpha<1
- ? 0
- : (mrSlideSorter.GetTheme()->GetIntegerValue(bFadeIn
- ? Theme::Integer_ButtonFadeInDelay
- : Theme::Integer_ButtonFadeOutDelay)));
- const double nDuration (mrSlideSorter.GetTheme()->GetIntegerValue(bFadeIn
- ? Theme::Integer_ButtonFadeInDuration
- : Theme::Integer_ButtonFadeOutDuration));
- pDescriptor->GetVisualState().SetButtonAlphaAnimationId(
- mrSlideSorter.GetController().GetAnimator()->AddAnimation(
- ::boost::bind(
- controller::AnimationFunction::ApplyButtonAlphaChange,
- pDescriptor,
- ::boost::ref(mrSlideSorter.GetView()),
- ::boost::bind(aButtonBlendFunctor, _1),
- ::boost::bind(aButtonBarBlendFunctor, _1)),
- static_cast<sal_Int32>(nDelay),
- static_cast<sal_Int32>(nDuration),
- ::boost::bind(
- &model::VisualState::SetButtonAlphaAnimationId,
- ::boost::ref(pDescriptor->GetVisualState()),
- controller::Animator::NotAnAnimationId)
- ));
-}
-
-
-
-
-void ButtonBar::AcquireLock (void)
-{
- if (mnLockCount == 0 && mpDescriptor)
- RequestFadeOut(mpDescriptor, true);
-
- ++mnLockCount;
-}
-
-
-
-
-void ButtonBar::ReleaseLock (void)
-{
- --mnLockCount;
-
- if (mnLockCount == 0 && mpDescriptor)
- RequestFadeIn(mpDescriptor, true);
-}
-
-
-
-
-//===== BackgroundTheme =====================================================
-
-ButtonBar::BackgroundTheme::BackgroundTheme (
- const ::boost::shared_ptr<Theme>& rpTheme,
- const ::std::vector<SharedButton>& rButtons)
- : mpTheme(rpTheme)
-{
- UpdateMinimumIconSizes(rButtons);
-}
-
-
-
-
-void ButtonBar::BackgroundTheme::SetPreviewBoundingBox (const Rectangle& rPreviewBoundingBox)
-{
- maPreviewBoundingBox = rPreviewBoundingBox;
- Layout();
-}
-
-
-
-
-void ButtonBar::BackgroundTheme::UpdateMinimumIconSizes (
- const ::std::vector<SharedButton>& rButtons)
-{
- OSL_ASSERT(mpTheme);
-
- sal_Int32 nMaximumHeightLarge (0);
- sal_Int32 nMaximumHeightMedium (0);
- sal_Int32 nMaximumHeightSmall (0);
- const sal_Int32 nGap (mpTheme->GetIntegerValue(Theme::Integer_ButtonGap));
- const sal_Int32 nBorder (mpTheme->GetIntegerValue(Theme::Integer_ButtonBorder));
- sal_Int32 nTotalWidthLarge ((rButtons.size()-1) * nGap + 2*nBorder);
- sal_Int32 nTotalWidthMedium ((rButtons.size()-1) * nGap + 2*nBorder);
- sal_Int32 nTotalWidthSmall ((rButtons.size()-1) * nGap + 2*nBorder);
- for (sal_uInt32 nIndex=0; nIndex<rButtons.size(); ++nIndex)
- {
- // Update large size.
- Size aSize = rButtons[nIndex]->GetSize(Button::IconSize_Large);
- if (aSize.Height() > nMaximumHeightLarge)
- nMaximumHeightLarge = aSize.Height();
- nTotalWidthLarge += aSize.Width();
-
- // Update medium size.
- aSize = rButtons[nIndex]->GetSize(Button::IconSize_Medium);
- if (aSize.Height() > nMaximumHeightMedium)
- nMaximumHeightMedium = aSize.Height();
- nTotalWidthMedium += aSize.Width();
-
- // Update small size.
- aSize = rButtons[nIndex]->GetSize(Button::IconSize_Small);
- if (aSize.Height() > nMaximumHeightSmall)
- nMaximumHeightSmall = aSize.Height();
- nTotalWidthSmall += aSize.Width();
- }
- maMinimumLargeButtonAreaSize = Size(nTotalWidthLarge, nMaximumHeightLarge+2*nBorder);
- maMinimumMediumButtonAreaSize = Size(nTotalWidthMedium, nMaximumHeightMedium+2*nBorder);
- maMinimumSmallButtonAreaSize = Size(nTotalWidthSmall, nMaximumHeightSmall+2*nBorder);
-}
-
-
-
-
-Button::IconSize ButtonBar::BackgroundTheme::GetIconSize (void) const
-{
- return meIconSize;
-}
-
-
-
-
-//===== RectangleBackgroundTheme ============================================
-
-RectangleBackgroundTheme::RectangleBackgroundTheme (
- const ::boost::shared_ptr<Theme>& rpTheme,
- const ::std::vector<SharedButton>& rButtons)
- : BackgroundTheme(rpTheme, rButtons),
- mnBarHeight(0)
-{
-}
-
-
-
-
-BitmapEx RectangleBackgroundTheme::CreateBackground (
- const OutputDevice& rTemplateDevice,
- const bool bIsButtonDown) const
-{
- OSL_ASSERT(mpTheme);
-
- // Setup background color.
- Color aTopFillColor (mpTheme->GetGradientColor(
- Theme::Gradient_ButtonBackground,
- Theme::Fill1));
- Color aTopBorderColor (mpTheme->GetGradientColor(
- Theme::Gradient_ButtonBackground,
- Theme::Border1));
- Color aBottomFillColor (mpTheme->GetGradientColor(
- Theme::Gradient_ButtonBackground,
- Theme::Fill2));
- Color aBottomBorderColor (mpTheme->GetGradientColor(
- Theme::Gradient_ButtonBackground,
- Theme::Border2));
- if (bIsButtonDown)
- {
- aTopFillColor.DecreaseLuminance(50);
- aTopBorderColor.DecreaseLuminance(50);
- aBottomFillColor.DecreaseLuminance(50);
- aBottomBorderColor.DecreaseLuminance(50);
- }
-
- const int nWidth (maPreviewBoundingBox.GetWidth()+2);
- const int nHeight (mnBarHeight);
- const int nCenter (nHeight / 2);
-
- VirtualDevice aDevice (rTemplateDevice, 0, 8);
- aDevice.SetOutputSizePixel(Size(nWidth,nHeight));
-
- // Fill upper and lower half.
- aDevice.SetLineColor();
- aDevice.SetFillColor(aTopFillColor);
- aDevice.DrawRect(Rectangle(0,0,nWidth-1,nCenter));
- aDevice.SetFillColor(aBottomFillColor);
- aDevice.DrawRect(Rectangle(0,nCenter,nWidth-1,nHeight-1));
-
- // Draw border.
- aDevice.SetFillColor();
- aDevice.SetLineColor(aTopBorderColor);
- aDevice.DrawLine(Point(0,nCenter),Point(0,0));
- aDevice.DrawLine(Point(0,0), Point(nWidth-1,0));
- aDevice.DrawLine(Point(nWidth-1,0),Point(nWidth-1,nCenter));
- aDevice.SetLineColor(aBottomBorderColor);
- aDevice.DrawLine(Point(0,nCenter),Point(0,nHeight-1));
- aDevice.DrawLine(Point(0,nHeight-1), Point(nWidth-1,nHeight-1));
- aDevice.DrawLine(Point(nWidth-1,nHeight-1),Point(nWidth-1,nCenter));
-
- return aDevice.GetBitmapEx(Point(0,0), Size(nWidth,nHeight));
-}
-
-
-
-
-Point RectangleBackgroundTheme::GetBackgroundLocation (void)
-{
- return Point(
- maPreviewBoundingBox.Left()-1,
- maPreviewBoundingBox.Bottom() - mnBarHeight + 2);
-}
-
-
-
-
-Rectangle RectangleBackgroundTheme::GetButtonArea (void)
-{
- return Rectangle(
- maPreviewBoundingBox.Left(),
- maPreviewBoundingBox.Bottom() - mnBarHeight + 2,
- maPreviewBoundingBox.Right(),
- maPreviewBoundingBox.Bottom());
-}
-
-
-
-
-void RectangleBackgroundTheme::Layout (void)
-{
- if (maPreviewBoundingBox.GetWidth() < maMinimumLargeButtonAreaSize.Width())
- if (maPreviewBoundingBox.GetWidth() < maMinimumMediumButtonAreaSize.Width())
- {
- meIconSize = Button::IconSize_Small;
- mnBarHeight = maMinimumSmallButtonAreaSize.Height();
- }
- else
- {
- meIconSize = Button::IconSize_Medium;
- mnBarHeight = maMinimumMediumButtonAreaSize.Height();
- }
- else
- {
- meIconSize = Button::IconSize_Large;
- mnBarHeight = maMinimumLargeButtonAreaSize.Height();
- }
-}
-
-
-
-
-//===== BitmapBackgroundTheme =================================================
-
-BitmapBackgroundTheme::BitmapBackgroundTheme (
- const ::boost::shared_ptr<Theme>& rpTheme,
- const ::std::vector<SharedButton>& rButtons)
- : BackgroundTheme(rpTheme, rButtons),
- maButtonArea(),
- maBackgroundLocation()
-{
-}
-
-
-
-
-BitmapEx BitmapBackgroundTheme::CreateBackground (
- const OutputDevice& rTemplateDevice,
- const bool bIsButtonDown) const
-{
- (void)rTemplateDevice;
- (void)bIsButtonDown;
-
- OSL_ASSERT(mpTheme);
-
- // Get images.
- switch (meIconSize)
- {
- case Button::IconSize_Large:
- default:
- return mpTheme->GetIcon(Theme::Icon_ButtonBarLarge);
-
- case Button::IconSize_Medium:
- return mpTheme->GetIcon(Theme::Icon_ButtonBarMedium);
-
- case Button::IconSize_Small:
- return mpTheme->GetIcon(Theme::Icon_ButtonBarSmall);
- }
-}
-
-
-
-
-Point BitmapBackgroundTheme::GetBackgroundLocation (void)
-{
- return maBackgroundLocation;
-}
-
-
-
-
-Rectangle BitmapBackgroundTheme::GetButtonArea (void)
-{
- return maButtonArea;
-}
-
-
-
-
-void BitmapBackgroundTheme::Layout (void)
-{
- Size aImageSize (mpTheme->GetIcon(Theme::Icon_ButtonBarLarge).GetSizePixel());
- if (aImageSize.Width() >= maPreviewBoundingBox.GetWidth())
- {
- aImageSize = mpTheme->GetIcon(Theme::Icon_ButtonBarMedium).GetSizePixel();
- if (aImageSize.Width() >= maPreviewBoundingBox.GetWidth())
- {
- meIconSize = Button::IconSize_Small;
- aImageSize = mpTheme->GetIcon(Theme::Icon_ButtonBarSmall).GetSizePixel();
- }
- else
- meIconSize = Button::IconSize_Medium;
- }
- else
- {
- meIconSize = Button::IconSize_Large;
- }
-
- maBackgroundLocation = Point(
- maPreviewBoundingBox.Left()
- + (maPreviewBoundingBox.GetWidth()-aImageSize.Width())/2,
- maPreviewBoundingBox.Bottom() - aImageSize.Height());
- maButtonArea = Rectangle(maBackgroundLocation, aImageSize);
-}
-
-
-
-
-//===== Button ================================================================
-
-Button::Button (
- SlideSorter& rSlideSorter,
- const ::rtl::OUString& rsHelpText)
- : mrSlideSorter(rSlideSorter),
- meState(State_Normal),
- maBoundingBox(),
- msHelpText(rsHelpText),
- mbIsActive(false),
- meIconSize(IconSize_Large)
-{
-}
-
-
-
-
-Button::~Button (void)
-{
-}
-
-
-
-
-bool Button::SetState (const State eState)
-{
- if (meState != eState)
- {
- meState = eState;
- return true;
- }
- else
- return false;
-}
-
-
-
-
-Button::State Button::GetState (void) const
-{
- return meState;
-}
-
-
-
-
-Rectangle Button::GetBoundingBox (void) const
-{
- if (mbIsActive)
- return maBoundingBox;
- else
- return Rectangle();
-}
-
-
-
-
-::rtl::OUString Button::GetHelpText (void) const
-{
- if (mbIsActive)
- return msHelpText;
- else
- return ::rtl::OUString();
-}
-
-
-
-
-bool Button::IsDown (void) const
-{
- return mbIsActive && meState==State_Down;
-}
-
-
-
-
-void Button::SetActiveState (const bool bIsActive)
-{
- mbIsActive = bIsActive;
-}
-
-
-
-
-bool Button::IsActive (void) const
-{
- return mbIsActive;
-}
-
-
-
-
-void Button::SetIconSize (const IconSize eIconSize)
-{
- meIconSize = eIconSize;
-}
-
-
-
-
-Button::IconSize Button::GetIconSize (void) const
-{
- return meIconSize;
-}
-
-
-
-
-bool Button::IsEnabled (void) const
-{
- return true;
-}
-
-
-
-
-//===== TextButton ============================================================
-
-TextButton::TextButton (
- SlideSorter& rSlideSorter,
- const ::rtl::OUString& rsText,
- const ::rtl::OUString& rsHelpText)
- : Button(rSlideSorter, rsHelpText),
- msText(rsText)
-{
-}
-
-
-
-
-void TextButton::Place (const Rectangle aButtonBarBox)
-{
- maBoundingBox = aButtonBarBox;
- SetActiveState(true);
-}
-
-
-
-
-void TextButton::Paint (
- OutputDevice& rDevice,
- const Point aOffset,
- const double nAlpha,
- const ::boost::shared_ptr<Theme>& rpTheme) const
-{
- (void)nAlpha;
-
- if (mbIsActive)
- {
- // Paint text over the button background.
- if (meState == State_Normal)
- rDevice.SetTextColor(rpTheme->GetColor(Theme::Color_ButtonText));
- else
- rDevice.SetTextColor(rpTheme->GetColor(Theme::Color_ButtonTextHover));
- Rectangle aBox (maBoundingBox);
- aBox += aOffset;
- rDevice.DrawText(aBox, msText, TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER);
- }
-}
-
-
-
-
-Size TextButton::GetSize (void) const
-{
- return Size();
-}
-
-
-
-
-Size TextButton::GetSize (const Button::IconSize) const
-{
- return Size();
-}
-
-
-
-
-//===== ImageButon ============================================================
-
-ImageButton::ImageButton (
- SlideSorter& rSlideSorter,
- const BitmapEx& rLargeIcon,
- const BitmapEx& rLargeHoverIcon,
- const BitmapEx& rMediumIcon,
- const BitmapEx& rMediumHoverIcon,
- const BitmapEx& rSmallIcon,
- const BitmapEx& rSmallHoverIcon,
- const ::rtl::OUString& rsHelpText)
- : Button(rSlideSorter, rsHelpText),
- maLargeIcon(rLargeIcon),
- maLargeHoverIcon(rLargeHoverIcon.IsEmpty() ? rLargeIcon : rLargeHoverIcon),
- maMediumIcon(rMediumIcon),
- maMediumHoverIcon(rMediumHoverIcon.IsEmpty() ? rMediumIcon : rMediumHoverIcon),
- maSmallIcon(rSmallIcon),
- maSmallHoverIcon(rSmallHoverIcon.IsEmpty() ? rSmallIcon : rSmallHoverIcon)
-{
-}
-
-
-
-
-void ImageButton::Place (const Rectangle aButtonBarBox)
-{
- const sal_Int32 nWidth (GetSize().Width());
- maBoundingBox = Rectangle(
- aButtonBarBox.Right() - nWidth,
- aButtonBarBox.Top(),
- aButtonBarBox.Right(),
- aButtonBarBox.Bottom());
- SetActiveState(aButtonBarBox.IsInside(maBoundingBox));
-}
-
-
-
-
-void ImageButton::Paint (
- OutputDevice& rDevice,
- const Point aOffset,
- const double nAlpha,
- const ::boost::shared_ptr<Theme>& rpTheme) const
-{
- (void)rpTheme;
-
- if ( ! mbIsActive)
- return;
-
- const sal_uInt16 nSavedAntialiasingMode (rDevice.GetAntialiasing());
- rDevice.SetAntialiasing(nSavedAntialiasingMode | ANTIALIASING_ENABLE_B2DDRAW);
-
- rDevice.SetLineColor();
-
- // Choose icon.
- BitmapEx aIcon;
- switch (meIconSize)
- {
- case IconSize_Large:
- default:
- if (meState == State_Normal)
- aIcon = maLargeIcon;
- else
- aIcon = maLargeHoverIcon;
- break;
-
- case IconSize_Medium:
- if (meState == State_Normal)
- aIcon = maMediumIcon;
- else
- aIcon = maMediumHoverIcon;
- break;
-
- case IconSize_Small:
- if (meState == State_Normal)
- aIcon = maSmallIcon;
- else
- aIcon = maSmallHoverIcon;
- break;
- }
-
- // Paint icon.
- if ( ! aIcon.IsEmpty())
- {
- AlphaMask aMask (aIcon.GetSizePixel());
- AdaptTransparency(aMask, aIcon.GetAlpha(), nAlpha);
- rDevice.DrawBitmapEx(
- Point(
- maBoundingBox.Left()
- + aOffset.X()
- + (maBoundingBox.GetWidth()-aIcon.GetSizePixel().Width())/2,
- maBoundingBox.Top()
- + aOffset.Y()
- + (maBoundingBox.GetHeight()-aIcon.GetSizePixel().Height())/2),
- BitmapEx(aIcon.GetBitmap(), aMask));
- }
-
- rDevice.SetAntialiasing(nSavedAntialiasingMode);
-}
-
-
-
-
-Size ImageButton::GetSize (void) const
-{
- return GetSize(meIconSize);
-}
-
-
-
-
-Size ImageButton::GetSize (const Button::IconSize eIconSize) const
-{
- switch (eIconSize)
- {
- case IconSize_Large:
- default:
- return maLargeIcon.GetSizePixel();
-
- case IconSize_Medium:
- return maMediumIcon.GetSizePixel();
-
- case IconSize_Small:
- return maSmallIcon.GetSizePixel();
- }
-}
-
-
-
-
-//===== UnhideButton ==========================================================
-
-UnhideButton::UnhideButton (SlideSorter& rSlideSorter)
- : ImageButton(
- rSlideSorter,
- rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2BLarge),
- rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2BLargeHover),
- rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2BMedium),
- rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2BMediumHover),
- rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2BSmall),
- rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2BSmallHover),
- rSlideSorter.GetTheme()->GetString(Theme::String_Command2B))
-{
-}
-
-
-
-
-void UnhideButton::ProcessClick (const model::SharedPageDescriptor& rpDescriptor)
-{
- if ( ! rpDescriptor)
- return;
- mrSlideSorter.GetController().GetSlotManager()->ChangeSlideExclusionState(
- (rpDescriptor->HasState(model::PageDescriptor::ST_Selected)
- ? model::SharedPageDescriptor()
- : rpDescriptor),
- false);
-}
-
-
-
-
-//===== StartSlideShowButton ==================================================
-
-StartShowButton::StartShowButton (SlideSorter& rSlideSorter)
- : ImageButton(
- rSlideSorter,
- rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command1Large),
- rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command1LargeHover),
- rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command1Medium),
- rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command1MediumHover),
- rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command1Small),
- rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command1SmallHover),
- rSlideSorter.GetTheme()->GetString(Theme::String_Command1))
-{
-}
-
-
-
-
-bool StartShowButton::IsEnabled (void) const
-{
- ViewShell* pViewShell = mrSlideSorter.GetViewShell();
- if (pViewShell == NULL)
- return false;
- SfxDispatcher* pDispatcher = pViewShell->GetDispatcher();
- if (pDispatcher == NULL)
- return false;
-
- const SfxPoolItem* pState = NULL;
- const SfxItemState eState (pDispatcher->QueryState(SID_PRESENTATION, pState));
- return (eState & SFX_ITEM_DISABLED) == 0;
-}
-
-
-
-
-void StartShowButton::ProcessClick (const model::SharedPageDescriptor& rpDescriptor)
-{
- // Hide the tool tip early, while the slide show still intializes.
- mrSlideSorter.GetView().GetToolTip().SetPage(model::SharedPageDescriptor());
-
- Reference< XPresentation2 > xPresentation(
- mrSlideSorter.GetModel().GetDocument()->getPresentation());
- if (xPresentation.is())
- {
- Sequence<PropertyValue> aProperties (1);
- aProperties[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FirstPage"));
- const ::rtl::OUString sName (rpDescriptor->GetPage()->GetName());
- aProperties[0].Value = Any(sName);
- xPresentation->startWithArguments(aProperties);
- }
-}
-
-
-
-
-//===== HideButton ============================================================
-
-HideButton::HideButton (SlideSorter& rSlideSorter)
- : ImageButton(
- rSlideSorter,
- rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2Large),
- rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2LargeHover),
- rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2Medium),
- rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2MediumHover),
- rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2Small),
- rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2SmallHover),
- rSlideSorter.GetTheme()->GetString(Theme::String_Command2))
-{
-}
-
-
-
-
-void HideButton::ProcessClick (const model::SharedPageDescriptor& rpDescriptor)
-{
- if ( ! rpDescriptor)
- return;
- mrSlideSorter.GetController().GetSlotManager()->ChangeSlideExclusionState(
- (rpDescriptor->HasState(model::PageDescriptor::ST_Selected)
- ? model::SharedPageDescriptor()
- : rpDescriptor),
- true);
-}
-
-
-
-
-//===== DuplicateButton =======================================================
-
-DuplicateButton::DuplicateButton (SlideSorter& rSlideSorter)
- : ImageButton(
- rSlideSorter,
- rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command3Large),
- rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command3LargeHover),
- rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command3Medium),
- rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command3MediumHover),
- rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command3Small),
- rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command3SmallHover),
- rSlideSorter.GetTheme()->GetString(Theme::String_Command3))
-{
-}
-
-
-
-
-bool DuplicateButton::IsEnabled (void) const
-{
- ViewShell* pViewShell = mrSlideSorter.GetViewShell();
- if (pViewShell == NULL)
- return false;
- SfxDispatcher* pDispatcher = pViewShell->GetDispatcher();
- if (pDispatcher == NULL)
- return false;
-
- const SfxPoolItem* pState = NULL;
- const SfxItemState eState (pDispatcher->QueryState(
- SID_DUPLICATE_PAGE,
- pState));
- return (eState & SFX_ITEM_DISABLED) == 0;
-}
-
-
-
-
-void DuplicateButton::ProcessClick (const model::SharedPageDescriptor& rpDescriptor)
-{
- if ( ! rpDescriptor)
- return;
-
- mrSlideSorter.GetView().SetPageUnderMouse(model::SharedPageDescriptor(),false);
-
- // When the page under the button is not selected then set the
- // selection to just this page.
- if ( ! rpDescriptor->HasState(model::PageDescriptor::ST_Selected))
- {
- mrSlideSorter.GetController().GetPageSelector().DeselectAllPages();
- mrSlideSorter.GetController().GetPageSelector().SelectPage(rpDescriptor);
- }
- // Duplicate the selected pages. Insert the new pages right
- // after the current selection and select them
- if (mrSlideSorter.GetViewShell() != NULL
- && mrSlideSorter.GetViewShell()->GetDispatcher() != NULL)
- {
- mrSlideSorter.GetViewShell()->GetDispatcher()->Execute(
- SID_DUPLICATE_PAGE,
- SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
- }
-}
-
-
-
-} } } // end of namespace ::sd::slidesorter::view
diff --git a/sd/source/ui/slidesorter/view/SlsFontProvider.cxx b/sd/source/ui/slidesorter/view/SlsFontProvider.cxx
deleted file mode 100644
index c7d7d2c34..000000000
--- a/sd/source/ui/slidesorter/view/SlsFontProvider.cxx
+++ /dev/null
@@ -1,135 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sd.hxx"
-
-#include "view/SlsFontProvider.hxx"
-
-#include "controller/SlideSorterController.hxx"
-
-#include <sfx2/app.hxx>
-#include <com/sun/star/uno/RuntimeException.hpp>
-
-
-using namespace ::sd::slidesorter;
-
-namespace sd { namespace slidesorter { namespace view {
-
-FontProvider* FontProvider::mpInstance = NULL;
-
-FontProvider& FontProvider::Instance (void)
-{
- if (mpInstance == NULL)
- {
- ::osl::GetGlobalMutex aMutexFunctor;
- ::osl::MutexGuard aGuard (aMutexFunctor());
- if (mpInstance == NULL)
- {
- // Create an instance of the class and register it at the
- // SdGlobalResourceContainer so that it is eventually released.
- FontProvider* pInstance = new FontProvider();
- SdGlobalResourceContainer::Instance().AddResource (
- ::std::auto_ptr<SdGlobalResource>(pInstance));
- OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
- mpInstance = pInstance;
- }
- }
- else
- {
- OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
- }
-
- // We throw an exception when for some strange reason no instance of
- // this class exists.
- if (mpInstance == NULL)
- throw ::com::sun::star::uno::RuntimeException(::rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.IndexedPropertyValues")),
- NULL);
-
- return *mpInstance;
-}
-
-
-
-
-FontProvider::FontProvider (void)
- : maFont(),
- maMapMode()
-{
-}
-
-
-
-
-FontProvider::~FontProvider (void)
-{
-}
-
-
-
-
-void FontProvider::Invalidate (void)
-{
- maFont.reset();
-}
-
-
-
-
-FontProvider::SharedFontPointer FontProvider::GetFont (const OutputDevice& rDevice)
-{
- // Reset the font when the map mode has changed since its creation.
- if (maMapMode != rDevice.GetMapMode())
- maFont.reset();
-
- if (maFont.get() == NULL)
- {
- // Initialize the font from the application style settings.
- maFont.reset(new Font (Application::GetSettings().GetStyleSettings().GetAppFont()));
- maFont->SetTransparent(sal_True);
- maFont->SetWeight(WEIGHT_NORMAL);
-
- // Transform the point size to pixel size.
- MapMode aFontMapMode (MAP_POINT);
- Size aFontSize (rDevice.LogicToPixel(maFont->GetSize(), aFontMapMode));
-
- // Transform the font size to the logical coordinates of the device.
- maFont->SetSize (rDevice.PixelToLogic(aFontSize));
-
- // Remember the map mode of the given device to detect different
- // devices or modified zoom scales on future calls.
- maMapMode = rDevice.GetMapMode();
- }
-
- return maFont;
-}
-
-} } } // end of namespace ::sd::slidesorter::view
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/view/SlsFramePainter.cxx b/sd/source/ui/slidesorter/view/SlsFramePainter.cxx
deleted file mode 100644
index 3f1e6c3f6..000000000
--- a/sd/source/ui/slidesorter/view/SlsFramePainter.cxx
+++ /dev/null
@@ -1,265 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "precompiled_sd.hxx"
-
-#include "SlsFramePainter.hxx"
-#include <vcl/outdev.hxx>
-#include <vcl/bmpacc.hxx>
-
-
-namespace sd { namespace slidesorter { namespace view {
-
-FramePainter::FramePainter (const BitmapEx& rShadowBitmap)
- : maTopLeft(rShadowBitmap,-1,-1),
- maTop(rShadowBitmap,0,-1),
- maTopRight(rShadowBitmap,+1,-1),
- maLeft(rShadowBitmap,-1,0),
- maRight(rShadowBitmap,+1,0),
- maBottomLeft(rShadowBitmap,-1,+1),
- maBottom(rShadowBitmap,0,+1),
- maBottomRight(rShadowBitmap,+1,+1),
- maCenter(rShadowBitmap,0,0),
- mbIsValid(false)
-{
- if (rShadowBitmap.GetSizePixel().Width() == rShadowBitmap.GetSizePixel().Height()
- && (rShadowBitmap.GetSizePixel().Width()-1)%2 == 0
- && ((rShadowBitmap.GetSizePixel().Width()-1)/2)%2 == 1)
- {
- mbIsValid = true;
- }
- else
- {
- OSL_ASSERT(rShadowBitmap.GetSizePixel().Width() == rShadowBitmap.GetSizePixel().Height());
- OSL_ASSERT((rShadowBitmap.GetSizePixel().Width()-1)%2 == 0);
- OSL_ASSERT(((rShadowBitmap.GetSizePixel().Width()-1)/2)%2 == 1);
- }
-}
-
-
-
-
-FramePainter::~FramePainter (void)
-{
-}
-
-
-
-
-void FramePainter::PaintFrame (
- OutputDevice& rDevice,
- const Rectangle aBox) const
-{
- if ( ! mbIsValid)
- return;
-
- // Paint the shadow.
- maTopLeft.PaintCorner(rDevice, aBox.TopLeft());
- maTopRight.PaintCorner(rDevice, aBox.TopRight());
- maBottomLeft.PaintCorner(rDevice, aBox.BottomLeft());
- maBottomRight.PaintCorner(rDevice, aBox.BottomRight());
- maLeft.PaintSide(rDevice, aBox.TopLeft(), aBox.BottomLeft(), maTopLeft, maBottomLeft);
- maRight.PaintSide(rDevice, aBox.TopRight(), aBox.BottomRight(), maTopRight, maBottomRight);
- maTop.PaintSide(rDevice, aBox.TopLeft(), aBox.TopRight(), maTopLeft, maTopRight);
- maBottom.PaintSide(rDevice, aBox.BottomLeft(), aBox.BottomRight(), maBottomLeft, maBottomRight);
- maCenter.PaintCenter(rDevice,aBox);
-}
-
-
-
-
-void FramePainter::AdaptColor (
- const Color aNewColor,
- const bool bEraseCenter)
-{
- // Get the source color.
- if (maCenter.maBitmap.IsEmpty())
- return;
- BitmapReadAccess* pReadAccess = maCenter.maBitmap.GetBitmap().AcquireReadAccess();
- if (pReadAccess == NULL)
- return;
- const Color aSourceColor = pReadAccess->GetColor(0,0);
- maCenter.maBitmap.GetBitmap().ReleaseAccess(pReadAccess);
-
- // Erase the center bitmap.
- if (bEraseCenter)
- maCenter.maBitmap.SetEmpty();
-
- // Replace the color in all bitmaps.
- maTopLeft.maBitmap.Replace(aSourceColor, aNewColor, 0);
- maTop.maBitmap.Replace(aSourceColor, aNewColor, 0);
- maTopRight.maBitmap.Replace(aSourceColor, aNewColor, 0);
- maLeft.maBitmap.Replace(aSourceColor, aNewColor, 0);
- maCenter.maBitmap.Replace(aSourceColor, aNewColor, 0);
- maRight.maBitmap.Replace(aSourceColor, aNewColor, 0);
- maBottomLeft.maBitmap.Replace(aSourceColor, aNewColor, 0);
- maBottom.maBitmap.Replace(aSourceColor, aNewColor, 0);
- maBottomRight.maBitmap.Replace(aSourceColor, aNewColor, 0);
-}
-
-
-
-
-//===== FramePainter::OffsetBitmap ============================================
-
-FramePainter::OffsetBitmap::OffsetBitmap (
- const BitmapEx& rBitmap,
- const sal_Int32 nHorizontalPosition,
- const sal_Int32 nVerticalPosition)
- : maBitmap(),
- maOffset()
-{
- OSL_ASSERT(nHorizontalPosition>=-1 && nHorizontalPosition<=+1);
- OSL_ASSERT(nVerticalPosition>=-1 && nVerticalPosition<=+1);
-
- const sal_Int32 nS (1);
- const sal_Int32 nC (::std::max<sal_Int32>(0,(rBitmap.GetSizePixel().Width()-nS)/2));
- const sal_Int32 nO (nC/2);
-
- const Point aOrigin(
- nHorizontalPosition<0 ? 0 : (nHorizontalPosition == 0 ? nC : nC+nS),
- nVerticalPosition<0 ? 0 : (nVerticalPosition == 0 ? nC : nC+nS));
- const Size aSize(
- nHorizontalPosition==0 ? nS : nC,
- nVerticalPosition==0 ? nS : nC);
- maBitmap = BitmapEx(rBitmap, aOrigin, aSize);
- if (maBitmap.IsEmpty())
- return;
- maOffset = Point(
- nHorizontalPosition<0 ? -nO : nHorizontalPosition>0 ? -nO : 0,
- nVerticalPosition<0 ? -nO : nVerticalPosition>0 ? -nO : 0);
-
- // Enlarge the side bitmaps so that painting the frame requires less
- // paint calls.
- const sal_Int32 nSideBitmapSize (64);
- if (nHorizontalPosition == 0 && nVerticalPosition == 0)
- {
- maBitmap.Scale(Size(nSideBitmapSize,nSideBitmapSize), BMP_SCALE_FAST);
- }
- else if (nHorizontalPosition == 0)
- {
- maBitmap.Scale(Size(nSideBitmapSize,aSize.Height()), BMP_SCALE_FAST);
- }
- else if (nVerticalPosition == 0)
- {
- maBitmap.Scale(Size(maBitmap.GetSizePixel().Width(), nSideBitmapSize), BMP_SCALE_FAST);
- }
-}
-
-
-
-
-void FramePainter::OffsetBitmap::PaintCorner (
- OutputDevice& rDevice,
- const Point& rAnchor) const
-{
- if ( ! maBitmap.IsEmpty())
- rDevice.DrawBitmapEx(rAnchor+maOffset, maBitmap);
-}
-
-
-
-
-void FramePainter::OffsetBitmap::PaintSide (
- OutputDevice& rDevice,
- const Point& rAnchor1,
- const Point& rAnchor2,
- const OffsetBitmap& rCornerBitmap1,
- const OffsetBitmap& rCornerBitmap2) const
-{
- if (maBitmap.IsEmpty())
- return;
-
- const Size aBitmapSize (maBitmap.GetSizePixel());
- if (rAnchor1.Y() == rAnchor2.Y())
- {
- // Side is horizontal.
- const sal_Int32 nY (rAnchor1.Y() + maOffset.Y());
- const sal_Int32 nLeft (
- rAnchor1.X()
- + rCornerBitmap1.maBitmap.GetSizePixel().Width()
- + rCornerBitmap1.maOffset.X());
- const sal_Int32 nRight (
- rAnchor2.X()
- + rCornerBitmap2.maOffset.X()\
- - 1);
- for (sal_Int32 nX=nLeft; nX<=nRight; nX+=aBitmapSize.Width())
- {
- rDevice.DrawBitmapEx(
- Point(nX,nY),
- Size(std::min(aBitmapSize.Width(),static_cast<long>(nRight-nX+1)),aBitmapSize.Height()),
- maBitmap);
- }
- }
- else if (rAnchor1.X() == rAnchor2.X())
- {
- // Side is vertical.
- const sal_Int32 nX (rAnchor1.X() + maOffset.X());
- const sal_Int32 nTop (
- rAnchor1.Y()
- + rCornerBitmap1.maBitmap.GetSizePixel().Height()
- + rCornerBitmap1.maOffset.Y());
- const sal_Int32 nBottom (
- rAnchor2.Y()
- + rCornerBitmap2.maOffset.Y()
- - 1);
- for (sal_Int32 nY=nTop; nY<=nBottom; nY+=aBitmapSize.Height())
- {
- rDevice.DrawBitmapEx(
- Point(nX,nY),
- Size(aBitmapSize.Width(), std::min(aBitmapSize.Height(), static_cast<long>(nBottom-nY+1))),
- maBitmap);
- }
- }
- else
- {
- // Diagonal sides indicatee an error.
- OSL_ASSERT(false);
- }
-}
-
-
-
-
-void FramePainter::OffsetBitmap::PaintCenter (
- OutputDevice& rDevice,
- const Rectangle& rBox) const
-{
- const Size aBitmapSize (maBitmap.GetSizePixel());
- for (sal_Int32 nY=rBox.Top(); nY<=rBox.Bottom(); nY+=aBitmapSize.Height())
- for (sal_Int32 nX=rBox.Left(); nX<=rBox.Right(); nX+=aBitmapSize.Width())
- rDevice.DrawBitmapEx(
- Point(nX,nY),
- Size(
- ::std::min(aBitmapSize.Width(), rBox.Right()-nX+1),
- std::min(aBitmapSize.Height(), rBox.Bottom()-nY+1)),
- maBitmap);
-}
-
-
-
-} } } // end of namespace sd::slidesorter::view
diff --git a/sd/source/ui/slidesorter/view/SlsFramePainter.hxx b/sd/source/ui/slidesorter/view/SlsFramePainter.hxx
deleted file mode 100644
index c029684aa..000000000
--- a/sd/source/ui/slidesorter/view/SlsFramePainter.hxx
+++ /dev/null
@@ -1,121 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef SD_SLIDESORTER_VIEW_FRAME_PAINTER_HXX
-#define SD_SLIDESORTER_VIEW_FRAME_PAINTER_HXX
-
-#include <vcl/bitmapex.hxx>
-
-
-namespace sd { namespace slidesorter { namespace view {
-
-class FramePainter
-{
-public:
- FramePainter (const BitmapEx& rBitmap);
- ~FramePainter (void);
-
- /** Paint a border around the given box by using a set of bitmaps for
- the corners and sides.
- */
- void PaintFrame (OutputDevice&rDevice, const Rectangle aBox) const;
-
- /** Special functionality that takes the color from the center
- bitmap and replaces that color in all bitmaps by the given new
- color. Alpha values are not modified.
- @param bClearCenterBitmap
- When <TRUE/> then the center bitmap is erased.
- */
- void AdaptColor (const Color aNewColor, const bool bClearCenterBitmap);
-
-private:
- /** Bitmap with offset that is used when the bitmap is painted. The bitmap
- */
- class OffsetBitmap {
- public:
- BitmapEx maBitmap;
- Point maOffset;
-
- /** Create one of the eight shadow bitmaps from one that combines
- them all. This larger bitmap is expected to have dimension NxN
- with N=1+2*M. Of this larger bitmap there are created four
- corner bitmaps of size 2*M x 2*M and four side bitmaps of sizes
- 1xM (top and bottom) and Mx1 (left and right). The corner
- bitmaps have each one quadrant of size MxM that is painted under
- the interior of the frame.
- @param rBitmap
- The larger bitmap of which the eight shadow bitmaps are cut
- out from.
- @param nHorizontalPosition
- Valid values are -1 (left), 0 (center), and +1 (right).
- @param nVerticalPosition
- Valid values are -1 (top), 0 (center), and +1 (bottom).
- */
- OffsetBitmap (
- const BitmapEx& rBitmap,
- const sal_Int32 nHorizontalPosition,
- const sal_Int32 nVerticalPosition);
-
- /** Use the given device to paint the bitmap at the location that is
- the sum of the given anchor and the internal offset.
- */
- void PaintCorner (OutputDevice& rDevice, const Point& rAnchor) const;
-
- /** Use the given device to paint the bitmap stretched between the
- two given locations. Offsets of the adjacent corner bitmaps and
- the offset of the side bitmap are used to determine the area
- that is to be filled with the side bitmap.
- */
- void PaintSide (
- OutputDevice& rDevice,
- const Point& rAnchor1,
- const Point& rAnchor2,
- const OffsetBitmap& rCornerBitmap1,
- const OffsetBitmap& rCornerBitmap2) const;
-
- /** Fill the given rectangle with the bitmap.
- */
- void PaintCenter (
- OutputDevice& rDevice,
- const Rectangle& rBox) const;
- };
- OffsetBitmap maTopLeft;
- OffsetBitmap maTop;
- OffsetBitmap maTopRight;
- OffsetBitmap maLeft;
- OffsetBitmap maRight;
- OffsetBitmap maBottomLeft;
- OffsetBitmap maBottom;
- OffsetBitmap maBottomRight;
- OffsetBitmap maCenter;
- bool mbIsValid;
-};
-
-
-} } } // end of namespace sd::slidesorter::view
-
-#endif
diff --git a/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx b/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx
deleted file mode 100644
index 6cd455730..000000000
--- a/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx
+++ /dev/null
@@ -1,537 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "precompiled_sd.hxx"
-
-#include "view/SlsInsertAnimator.hxx"
-#include "controller/SlideSorterController.hxx"
-#include "controller/SlsAnimationFunction.hxx"
-#include "view/SlideSorterView.hxx"
-#include "view/SlsLayouter.hxx"
-#include "model/SlideSorterModel.hxx"
-#include "model/SlsPageEnumerationProvider.hxx"
-
-#include <set>
-#include <boost/bind.hpp>
-#include <boost/enable_shared_from_this.hpp>
-
-namespace sd { namespace slidesorter { namespace view {
-
-namespace {
-
-class PageObjectRun;
-
-class AnimatorAccess
-{
-public:
- virtual void AddRun (const ::boost::shared_ptr<PageObjectRun> pRun) = 0;
- virtual void RemoveRun (const ::boost::shared_ptr<PageObjectRun> pRun) = 0;
- virtual model::SlideSorterModel& GetModel (void) const = 0;
- virtual view::SlideSorterView& GetView (void) const = 0;
- virtual ::boost::shared_ptr<controller::Animator> GetAnimator (void) = 0;
- virtual SharedSdWindow GetContentWindow (void) = 0;
-};
-
-
-/** Controller of the position offsets of all page objects in one row or one
- column.
-*/
-class PageObjectRun : public ::boost::enable_shared_from_this<PageObjectRun>
-{
-public:
- PageObjectRun (
- AnimatorAccess& rAnimatorAccess,
- const sal_Int32 nRunIndex,
- const sal_Int32 nStartIndex,
- const sal_Int32 nEndIndex);
- ~PageObjectRun (void);
-
- void operator () (const double nTime);
-
- void UpdateOffsets(
- const InsertPosition& rInsertPosition,
- const view::Layouter& GetLayouter);
- void ResetOffsets (const controller::Animator::AnimationMode eMode);
-
- /// Index of the row or column that this run represents.
- sal_Int32 mnRunIndex;
- /// The index at which to make place for the insertion indicator (-1 for
- /// no indicator).
- sal_Int32 mnLocalInsertIndex;
- /// Index of the first page in the run.
- sal_Int32 mnStartIndex;
- /// Index of the last page in the run.
- sal_Int32 mnEndIndex;
- /// Offset of each item in the run at the start of the current animation.
- ::std::vector<Point> maStartOffset;
- /// Target offset of each item in the run at the end of the current animation.
- ::std::vector<Point> maEndOffset;
- /// Time at which the current animation started.
- double mnStartTime;
-
- class Comparator
- {
- public: bool operator() (
- const ::boost::shared_ptr<PageObjectRun>& rpRunA,
- const ::boost::shared_ptr<PageObjectRun>& rpRunB) const
- {
- return rpRunA->mnRunIndex < rpRunB->mnRunIndex;
- }
- };
-private:
- controller::Animator::AnimationId mnAnimationId;
- AnimatorAccess& mrAnimatorAccess;
- ::boost::function<double(double)> maAccelerationFunction;
-
- Rectangle GetInnerBoundingBox (
- const view::Layouter& rLayouter,
- const sal_Int32 nIndex) const;
- void RestartAnimation (void);
-};
-typedef ::boost::shared_ptr<PageObjectRun> SharedPageObjectRun;
-
-
-Point Blend (const Point& rPointA, const Point& rPointB, const double nT)
-{
- return Point(
- sal_Int32(rPointA.X() * (1-nT) + rPointB.X() * nT),
- sal_Int32(rPointA.Y() * (1-nT) + rPointB.Y() * nT));
-}
-
-} // end of anonymous namespace
-
-
-
-class InsertAnimator::Implementation : public AnimatorAccess
-{
-public:
- Implementation (SlideSorter& rSlideSorter);
- virtual ~Implementation (void);
-
- void SetInsertPosition (
- const InsertPosition& rInsertPosition,
- const controller::Animator::AnimationMode eAnimationMode);
-
- virtual void AddRun (const ::boost::shared_ptr<PageObjectRun> pRun);
- virtual void RemoveRun (const ::boost::shared_ptr<PageObjectRun> pRun);
-
- virtual model::SlideSorterModel& GetModel (void) const { return mrModel; }
- virtual view::SlideSorterView& GetView (void) const { return mrView; }
- virtual ::boost::shared_ptr<controller::Animator> GetAnimator (void) { return mpAnimator; }
- virtual SharedSdWindow GetContentWindow (void) { return mrSlideSorter.GetContentWindow(); }
-
-private:
- model::SlideSorterModel& mrModel;
- view::SlideSorterView& mrView;
- SlideSorter& mrSlideSorter;
- ::boost::shared_ptr<controller::Animator> mpAnimator;
- typedef ::std::set<SharedPageObjectRun, PageObjectRun::Comparator> RunContainer;
- RunContainer maRuns;
- InsertPosition maInsertPosition;
-
- void StopAnimation (void);
- SharedPageObjectRun GetRun (
- view::Layouter& rLayouter,
- const InsertPosition& rInsertPosition,
- const bool bCreate = true);
- RunContainer::const_iterator FindRun (const sal_Int32 nRunIndex) const;
-};
-
-
-
-
-
-//===== InsertAnimator ========================================================
-
-InsertAnimator::InsertAnimator (SlideSorter& rSlideSorter)
- : mpImplementation(new Implementation(rSlideSorter))
-{
-}
-
-
-
-
-void InsertAnimator::SetInsertPosition (const InsertPosition& rInsertPosition)
-{
- mpImplementation->SetInsertPosition(rInsertPosition, controller::Animator::AM_Animated);
-}
-
-
-
-
-void InsertAnimator::Reset (const controller::Animator::AnimationMode eMode)
-{
- mpImplementation->SetInsertPosition(InsertPosition(), eMode);
-}
-
-
-
-
-//===== InsertAnimator::Implementation ========================================
-
-InsertAnimator::Implementation::Implementation (SlideSorter& rSlideSorter)
- : mrModel(rSlideSorter.GetModel()),
- mrView(rSlideSorter.GetView()),
- mrSlideSorter(rSlideSorter),
- mpAnimator(rSlideSorter.GetController().GetAnimator()),
- maRuns(),
- maInsertPosition()
-{
-}
-
-
-
-
-InsertAnimator::Implementation::~Implementation (void)
-{
- SetInsertPosition(InsertPosition(), controller::Animator::AM_Immediate);
-}
-
-
-
-
-void InsertAnimator::Implementation::SetInsertPosition (
- const InsertPosition& rInsertPosition,
- const controller::Animator::AnimationMode eMode)
-{
- if (maInsertPosition == rInsertPosition)
- return;
-
- SharedPageObjectRun pOldRun (GetRun(mrView.GetLayouter(), maInsertPosition));
- SharedPageObjectRun pCurrentRun (GetRun(mrView.GetLayouter(), rInsertPosition));
- maInsertPosition = rInsertPosition;
-
- // When the new insert position is in a different run then move the page
- // objects in the old run to their default positions.
- if (pOldRun != pCurrentRun)
- {
- if (pOldRun)
- pOldRun->ResetOffsets(eMode);
- }
-
- if (pCurrentRun)
- {
- pCurrentRun->UpdateOffsets(rInsertPosition, mrView.GetLayouter());
- }
-}
-
-
-
-
-SharedPageObjectRun InsertAnimator::Implementation::GetRun (
- view::Layouter& rLayouter,
- const InsertPosition& rInsertPosition,
- const bool bCreate)
-{
- const sal_Int32 nRow (rInsertPosition.GetRow());
- if (nRow < 0)
- return SharedPageObjectRun();
-
- RunContainer::const_iterator iRun (maRuns.end());
- if (rLayouter.GetColumnCount() == 1)
- {
- // There is only one run that contains all slides.
- if (maRuns.empty() && bCreate)
- maRuns.insert(SharedPageObjectRun(new PageObjectRun(
- *this,
- 0,
- 0,
- mrModel.GetPageCount()-1)));
- iRun = maRuns.begin();
- }
- else
- {
- iRun = FindRun(nRow);
- if (iRun == maRuns.end() && bCreate)
- {
- // Create a new run.
- const sal_Int32 nStartIndex (rLayouter.GetIndex(nRow, 0));
- const sal_Int32 nEndIndex (rLayouter.GetIndex(nRow, rLayouter.GetColumnCount()-1));
- if (nStartIndex <= nEndIndex)
- {
- iRun = maRuns.insert(SharedPageObjectRun(new PageObjectRun(
- *this,
- nRow,
- nStartIndex,
- nEndIndex))).first;
- OSL_ASSERT(iRun != maRuns.end());
- }
- }
- }
-
- if (iRun != maRuns.end())
- return *iRun;
- else
- return SharedPageObjectRun();
-}
-
-
-
-
-InsertAnimator::Implementation::RunContainer::const_iterator
- InsertAnimator::Implementation::FindRun (const sal_Int32 nRunIndex) const
-{
- return std::find_if(
- maRuns.begin(),
- maRuns.end(),
- ::boost::bind(
- ::std::equal_to<sal_Int32>(),
- ::boost::bind(&PageObjectRun::mnRunIndex, _1),
- nRunIndex));
-}
-
-
-
-
-void InsertAnimator::Implementation::AddRun (const ::boost::shared_ptr<PageObjectRun> pRun)
-{
- if (pRun)
- {
- maRuns.insert(pRun);
- }
- else
- {
- OSL_ASSERT(pRun);
- }
-}
-
-
-
-
-
-void InsertAnimator::Implementation::RemoveRun (const ::boost::shared_ptr<PageObjectRun> pRun)
-{
- if (pRun)
- {
- // Do not remove runs that show the space for the insertion indicator.
- if (pRun->mnLocalInsertIndex == -1)
- {
- InsertAnimator::Implementation::RunContainer::const_iterator iRun (FindRun(pRun->mnRunIndex));
- if (iRun != maRuns.end())
- {
- OSL_ASSERT(*iRun == pRun);
- maRuns.erase(iRun);
- }
- }
- }
- else
- {
- OSL_ASSERT(pRun);
- }
-}
-
-
-
-
-
-//===== PageObjectRun =========================================================
-
-PageObjectRun::PageObjectRun (
- AnimatorAccess& rAnimatorAccess,
- const sal_Int32 nRunIndex,
- const sal_Int32 nStartIndex,
- const sal_Int32 nEndIndex)
- : mnRunIndex(nRunIndex),
- mnLocalInsertIndex(-1),
- mnStartIndex(nStartIndex),
- mnEndIndex(nEndIndex),
- maStartOffset(),
- maEndOffset(),
- mnStartTime(-1),
- mnAnimationId(controller::Animator::NotAnAnimationId),
- mrAnimatorAccess(rAnimatorAccess),
- maAccelerationFunction(
- controller::AnimationParametricFunction(
- controller::AnimationBezierFunction (0.1,0.7)))
-{
- maStartOffset.resize(nEndIndex - nStartIndex + 1);
- maEndOffset.resize(nEndIndex - nStartIndex + 1);
-}
-
-
-
-
-PageObjectRun::~PageObjectRun (void)
-{
-}
-
-
-
-
-Rectangle PageObjectRun::GetInnerBoundingBox (
- const view::Layouter& rLayouter,
- const sal_Int32 nIndex) const
-{
- model::SharedPageDescriptor pDescriptor (
- mrAnimatorAccess.GetModel().GetPageDescriptor(nIndex));
- if (pDescriptor)
- if (pDescriptor->HasState(model::PageDescriptor::ST_Selected))
- return rLayouter.GetPageObjectLayouter()->GetBoundingBox(
- pDescriptor,
- PageObjectLayouter::PageObject,
- PageObjectLayouter::ModelCoordinateSystem);
- else
- return rLayouter.GetPageObjectLayouter()->GetBoundingBox(
- pDescriptor,
- PageObjectLayouter::Preview,
- PageObjectLayouter::ModelCoordinateSystem);
- else
- return Rectangle();
-}
-
-
-
-
-void PageObjectRun::UpdateOffsets(
- const InsertPosition& rInsertPosition,
- const view::Layouter& rLayouter)
-{
- const bool bIsVertical (rLayouter.GetColumnCount()==1);
- const sal_Int32 nLocalInsertIndex(bIsVertical
- ? rInsertPosition.GetRow()
- : rInsertPosition.GetColumn());
- if (nLocalInsertIndex != mnLocalInsertIndex)
- {
- mnLocalInsertIndex = nLocalInsertIndex;
-
- model::SlideSorterModel& rModel (mrAnimatorAccess.GetModel());
- const sal_Int32 nRunLength (mnEndIndex - mnStartIndex + 1);
- for (sal_Int32 nIndex=0; nIndex<nRunLength; ++nIndex)
- {
- model::SharedPageDescriptor pDescriptor(rModel.GetPageDescriptor(nIndex+mnStartIndex));
- if (pDescriptor)
- maStartOffset[nIndex] = pDescriptor->GetVisualState().GetLocationOffset();
- maEndOffset[nIndex] = nIndex < mnLocalInsertIndex
- ? rInsertPosition.GetLeadingOffset()
- : rInsertPosition.GetTrailingOffset();
- if (bIsVertical)
- maEndOffset[nIndex].X() = 0;
- else
- maEndOffset[nIndex].Y() = 0;
- }
- RestartAnimation();
- }
-}
-
-
-
-
-void PageObjectRun::ResetOffsets (const controller::Animator::AnimationMode eMode)
-{
- mnLocalInsertIndex = -1;
- const sal_Int32 nRunLength (mnEndIndex - mnStartIndex + 1);
- model::SlideSorterModel& rModel (mrAnimatorAccess.GetModel());
- view::SlideSorterView& rView (mrAnimatorAccess.GetView());
- for (sal_Int32 nIndex=0; nIndex<nRunLength; ++nIndex)
- {
- model::SharedPageDescriptor pDescriptor(rModel.GetPageDescriptor(nIndex+mnStartIndex));
- if (pDescriptor)
- {
- if (eMode == controller::Animator::AM_Animated)
- maStartOffset[nIndex] = pDescriptor->GetVisualState().GetLocationOffset();
- else
- {
- const Rectangle aOldBoundingBox (pDescriptor->GetBoundingBox());
- pDescriptor->GetVisualState().SetLocationOffset(Point(0,0));
- rView.RequestRepaint(aOldBoundingBox);
- rView.RequestRepaint(pDescriptor);
- }
- }
- maEndOffset[nIndex] = Point(0,0);
- }
- if (eMode == controller::Animator::AM_Animated)
- RestartAnimation();
- else
- mrAnimatorAccess.RemoveRun(shared_from_this());
-}
-
-
-
-
-void PageObjectRun::RestartAnimation (void)
-{
- // Stop the current animation.
- if (mnAnimationId != controller::Animator::NotAnAnimationId)
- {
- mrAnimatorAccess.GetAnimator()->RemoveAnimation(mnAnimationId);
- }
-
- // Restart the animation.
- mrAnimatorAccess.AddRun(shared_from_this());
- mnAnimationId = mrAnimatorAccess.GetAnimator()->AddAnimation(
- ::boost::ref(*this),
- 0,
- 300,
- ::boost::bind(
- &AnimatorAccess::RemoveRun,
- ::boost::ref(mrAnimatorAccess),
- shared_from_this()));
-}
-
-
-
-
-void PageObjectRun::operator () (const double nGlobalTime)
-{
- if (mnStartTime < 0)
- mnStartTime = nGlobalTime;
-
- double nLocalTime (nGlobalTime - mnStartTime);
- if (nLocalTime > 1.0)
- nLocalTime = 1.0;
- nLocalTime = maAccelerationFunction(nLocalTime);
-
- model::SlideSorterModel& rModel (mrAnimatorAccess.GetModel());
- view::SlideSorterView& rView (mrAnimatorAccess.GetView());
- for (sal_Int32 nIndex=mnStartIndex; nIndex<=mnEndIndex; ++nIndex)
- {
- model::SharedPageDescriptor pDescriptor (rModel.GetPageDescriptor(nIndex));
- if ( ! pDescriptor)
- continue;
- const Rectangle aOldBoundingBox (pDescriptor->GetBoundingBox());
- pDescriptor->GetVisualState().SetLocationOffset(
- Blend(
- maStartOffset[nIndex-mnStartIndex],
- maEndOffset[nIndex-mnStartIndex],
- nLocalTime));
-
- // Request a repaint of the old and new bounding box (which largely overlap.)
- rView.RequestRepaint(aOldBoundingBox);
- rView.RequestRepaint(pDescriptor);
- }
-
- // Call Flush to make
- // a) animations a bit more smooth and
- // b) on Mac without the Flush a Reset of the page locations is not properly
- // visualized when the mouse leaves the window during drag-and-drop.
- mrAnimatorAccess.GetContentWindow()->Flush();
-}
-
-
-
-
-} } } // end of namespace ::sd::slidesorter::view
diff --git a/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx b/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx
deleted file mode 100644
index a18704233..000000000
--- a/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx
+++ /dev/null
@@ -1,448 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "precompiled_sd.hxx"
-
-#include "view/SlsInsertionIndicatorOverlay.hxx"
-
-#include "SlideSorter.hxx"
-#include "model/SlsPageEnumeration.hxx"
-#include "view/SlideSorterView.hxx"
-#include "view/SlsLayouter.hxx"
-#include "view/SlsPageObjectLayouter.hxx"
-#include "view/SlsTheme.hxx"
-#include "cache/SlsPageCache.hxx"
-#include "SlsFramePainter.hxx"
-#include "SlsLayeredDevice.hxx"
-#include "DrawDocShell.hxx"
-#include "drawdoc.hxx"
-#include "sdpage.hxx"
-#include "sdmod.hxx"
-
-#include <vcl/virdev.hxx>
-#include <basegfx/range/b2drectangle.hxx>
-#include <basegfx/tools/canvastools.hxx>
-#include <basegfx/polygon/b2dpolygon.hxx>
-#include <basegfx/polygon/b2dpolygontools.hxx>
-
-
-namespace {
-
-
-static const double gnPreviewOffsetScale = 1.0 / 8.0;
-
-
-
-Rectangle GrowRectangle (const Rectangle& rBox, const sal_Int32 nOffset)
-{
- return Rectangle (
- rBox.Left() - nOffset,
- rBox.Top() - nOffset,
- rBox.Right() + nOffset,
- rBox.Bottom() + nOffset);
-}
-
-sal_Int32 RoundToInt (const double nValue) { return sal_Int32(::rtl::math::round(nValue)); }
-
-} // end of anonymous namespace
-
-
-namespace sd { namespace slidesorter { namespace view {
-
-
-//===== InsertionIndicatorOverlay ===========================================
-
-const static sal_Int32 gnShadowBorder = 3;
-const static sal_Int32 gnSuperScaleFactor = 1;
-
-InsertionIndicatorOverlay::InsertionIndicatorOverlay (SlideSorter& rSlideSorter)
- : mrSlideSorter(rSlideSorter),
- mbIsVisible(false),
- mnLayerIndex(2),
- mpLayerInvalidator(),
- maLocation(),
- maIcon(),
- maIconOffset(),
- mpShadowPainter(
- new FramePainter(mrSlideSorter.GetTheme()->GetIcon(Theme::Icon_RawInsertShadow)))
-{
-}
-
-
-
-
-InsertionIndicatorOverlay::~InsertionIndicatorOverlay (void)
-{
- Hide();
-}
-
-
-
-
-void InsertionIndicatorOverlay::Create (const controller::Transferable* pTransferable)
-{
- if (pTransferable == NULL)
- return;
-
- sal_Int32 nSelectionCount (0);
- if (pTransferable->HasPageBookmarks())
- nSelectionCount = pTransferable->GetPageBookmarks().Count();
- else
- {
- DrawDocShell* pDataDocShell = dynamic_cast<DrawDocShell*>(&pTransferable->GetDocShell());
- if (pDataDocShell != NULL)
- {
- SdDrawDocument* pDataDocument = pDataDocShell->GetDoc();
- if (pDataDocument != NULL)
- nSelectionCount = pDataDocument->GetSdPageCount(PK_STANDARD);
- }
- }
- Create(pTransferable->GetRepresentatives(), nSelectionCount);
-}
-
-
-
-
-void InsertionIndicatorOverlay::Create (
- const ::std::vector<controller::Transferable::Representative>& rRepresentatives,
- const sal_Int32 nSelectionCount)
-{
- view::Layouter& rLayouter (mrSlideSorter.GetView().GetLayouter());
- ::boost::shared_ptr<view::PageObjectLayouter> pPageObjectLayouter (
- rLayouter.GetPageObjectLayouter());
- ::boost::shared_ptr<view::Theme> pTheme (mrSlideSorter.GetTheme());
- const Size aOriginalPreviewSize (pPageObjectLayouter->GetSize(
- PageObjectLayouter::Preview,
- PageObjectLayouter::WindowCoordinateSystem));
-
- const double nPreviewScale (0.5);
- const Size aPreviewSize (
- RoundToInt(aOriginalPreviewSize.Width()*nPreviewScale),
- RoundToInt(aOriginalPreviewSize.Height()*nPreviewScale));
- const sal_Int32 nOffset (
- RoundToInt(Min(aPreviewSize.Width(),aPreviewSize.Height()) * gnPreviewOffsetScale));
-
- // Determine size and offset depending on the number of previews.
- sal_Int32 nCount (rRepresentatives.size());
- if (nCount > 0)
- --nCount;
- Size aIconSize(
- aPreviewSize.Width() + 2 * gnShadowBorder + nCount*nOffset,
- aPreviewSize.Height() + 2 * gnShadowBorder + nCount*nOffset);
- maIconOffset = Point(gnShadowBorder, gnShadowBorder);
-
- // Create virtual devices for bitmap and mask whose bitmaps later be
- // combined to form the BitmapEx of the icon.
- VirtualDevice aContent (
- *mrSlideSorter.GetContentWindow(),
- 0,
- 0);
- aContent.SetOutputSizePixel(aIconSize);
-
- aContent.SetFillColor();
- aContent.SetLineColor(pTheme->GetColor(Theme::Color_PreviewBorder));
- const Point aOffset = PaintRepresentatives(aContent, aPreviewSize, nOffset, rRepresentatives);
-
- PaintPageCount(aContent, nSelectionCount, aPreviewSize, aOffset);
-
- maIcon = aContent.GetBitmapEx(Point(0,0), aIconSize);
- maIcon.Scale(aIconSize);
-}
-
-
-
-
-void InsertionIndicatorOverlay::SelectRepresentatives (
- model::PageEnumeration& rSelection,
- ::std::vector<model::SharedPageDescriptor>& rDescriptors) const
-{
- sal_Int32 nCount (0);
- while (rSelection.HasMoreElements())
- {
- if (nCount++ >= 3)
- break;
- rDescriptors.push_back(rSelection.GetNextElement());
- }
-}
-
-
-
-
-Point InsertionIndicatorOverlay::PaintRepresentatives (
- OutputDevice& rContent,
- const Size aPreviewSize,
- const sal_Int32 nOffset,
- const ::std::vector<controller::Transferable::Representative>& rRepresentatives) const
-{
- const Point aOffset (0,rRepresentatives.size()==1 ? -nOffset : 0);
-
- // Paint the pages.
- Point aPageOffset (0,0);
- double nTransparency (0);
- const BitmapEx aExclusionOverlay (mrSlideSorter.GetTheme()->GetIcon(Theme::Icon_HideSlideOverlay));
- for (sal_Int32 nIndex=2; nIndex>=0; --nIndex)
- {
- if (rRepresentatives.size() <= sal_uInt32(nIndex))
- continue;
- switch(nIndex)
- {
- case 0 :
- aPageOffset = Point(0, nOffset);
- nTransparency = 0.85;
- break;
- case 1:
- aPageOffset = Point(nOffset, 0);
- nTransparency = 0.75;
- break;
- case 2:
- aPageOffset = Point(2*nOffset, 2*nOffset);
- nTransparency = 0.65;
- break;
- }
- aPageOffset += aOffset;
- aPageOffset.X() += gnShadowBorder;
- aPageOffset.Y() += gnShadowBorder;
-
- // Paint the preview.
- Bitmap aPreview (rRepresentatives[nIndex].maBitmap);
- const Size aSuperSampleSize(
- aPreviewSize.Width()*gnSuperScaleFactor,
- aPreviewSize.Height()*gnSuperScaleFactor);
- aPreview.Scale(aPreviewSize, BMP_SCALE_INTERPOLATE);
- rContent.DrawBitmapEx(aPageOffset, aPreview);
-
- // When the page is marked as excluded from the slide show then
- // paint an overlay that visualizes this.
- if (rRepresentatives[nIndex].mbIsExcluded)
- {
- const Region aSavedClipRegion (rContent.GetClipRegion());
- rContent.IntersectClipRegion(Rectangle(aPageOffset, aPreviewSize));
- // Paint bitmap tiled over the preview to mark it as excluded.
- const sal_Int32 nIconWidth (aExclusionOverlay.GetSizePixel().Width());
- const sal_Int32 nIconHeight (aExclusionOverlay.GetSizePixel().Height());
- if (nIconWidth>0 && nIconHeight>0)
- {
- for (sal_Int32 nX=0; nX<aPreviewSize.Width(); nX+=nIconWidth)
- for (sal_Int32 nY=0; nY<aPreviewSize.Height(); nY+=nIconHeight)
- rContent.DrawBitmapEx(Point(nX,nY)+aPageOffset, aExclusionOverlay);
- }
- rContent.SetClipRegion(aSavedClipRegion);
- }
-
- // Tone down the bitmap. The further back the darker it becomes.
- Rectangle aBox (
- aPageOffset.X(),
- aPageOffset.Y(),
- aPageOffset.X()+aPreviewSize.Width()-1,
- aPageOffset.Y()+aPreviewSize.Height()-1);
- rContent.SetFillColor(COL_BLACK);
- rContent.SetLineColor();
- rContent.DrawTransparent(
- ::basegfx::B2DPolyPolygon(::basegfx::tools::createPolygonFromRect(
- ::basegfx::B2DRectangle(aBox.Left(), aBox.Top(), aBox.Right()+1, aBox.Bottom()+1),
- 0,
- 0)),
- nTransparency);
-
- // Draw border around preview.
- Rectangle aBorderBox (GrowRectangle(aBox, 1));
- rContent.SetLineColor(COL_GRAY);
- rContent.SetFillColor();
- rContent.DrawRect(aBorderBox);
-
- // Draw shadow around preview.
- mpShadowPainter->PaintFrame(rContent, aBorderBox);
- }
-
- return aPageOffset;
-}
-
-
-
-
-void InsertionIndicatorOverlay::PaintPageCount (
- OutputDevice& rDevice,
- const sal_Int32 nSelectionCount,
- const Size aPreviewSize,
- const Point aFirstPageOffset) const
-{
- // Paint the number of slides.
- ::boost::shared_ptr<view::Theme> pTheme (mrSlideSorter.GetTheme());
- ::boost::shared_ptr<Font> pFont(Theme::GetFont(Theme::Font_PageCount, rDevice));
- if (pFont)
- {
- ::rtl::OUString sNumber (::rtl::OUString::valueOf(nSelectionCount));
-
- // Determine the size of the (painted) text and create a bounding
- // box that centers the text on the first preview.
- rDevice.SetFont(*pFont);
- Rectangle aTextBox;
- rDevice.GetTextBoundRect(aTextBox, sNumber);
- Point aTextOffset (aTextBox.TopLeft());
- Size aTextSize (aTextBox.GetSize());
- // Place text inside the first page preview.
- Point aTextLocation(aFirstPageOffset);
- // Center the text.
- aTextLocation += Point(
- (aPreviewSize.Width()-aTextBox.GetWidth())/2,
- (aPreviewSize.Height()-aTextBox.GetHeight())/2);
- aTextBox = Rectangle(aTextLocation, aTextSize);
-
- // Paint background, border and text.
- static const sal_Int32 nBorder = 5;
- rDevice.SetFillColor(pTheme->GetColor(Theme::Color_Selection));
- rDevice.SetLineColor(pTheme->GetColor(Theme::Color_Selection));
- rDevice.DrawRect(GrowRectangle(aTextBox, nBorder));
-
- rDevice.SetFillColor();
- rDevice.SetLineColor(pTheme->GetColor(Theme::Color_PageCountFontColor));
- rDevice.DrawRect(GrowRectangle(aTextBox, nBorder-1));
-
- rDevice.SetTextColor(pTheme->GetColor(Theme::Color_PageCountFontColor));
- rDevice.DrawText(aTextBox.TopLeft()-aTextOffset, sNumber);
- }
-}
-
-
-
-
-void InsertionIndicatorOverlay::SetLocation (const Point& rLocation)
-{
- const Point aTopLeft (
- rLocation - Point(
- maIcon.GetSizePixel().Width()/2,
- maIcon.GetSizePixel().Height()/2));
- if (maLocation != aTopLeft)
- {
- const Rectangle aOldBoundingBox (GetBoundingBox());
-
- maLocation = aTopLeft;
-
- if (mpLayerInvalidator && IsVisible())
- {
- mpLayerInvalidator->Invalidate(aOldBoundingBox);
- mpLayerInvalidator->Invalidate(GetBoundingBox());
- }
- }
-}
-
-
-
-
-void InsertionIndicatorOverlay::Paint (
- OutputDevice& rDevice,
- const Rectangle& rRepaintArea)
-{
- (void)rRepaintArea;
-
- if ( ! IsVisible())
- return;
-
- rDevice.DrawImage(maLocation, maIcon);
-}
-
-
-
-
-void InsertionIndicatorOverlay::SetLayerInvalidator (const SharedILayerInvalidator& rpInvalidator)
-{
- mpLayerInvalidator = rpInvalidator;
-
- if (mbIsVisible && mpLayerInvalidator)
- mpLayerInvalidator->Invalidate(GetBoundingBox());
-}
-
-
-
-
-bool InsertionIndicatorOverlay::IsVisible (void) const
-{
- return mbIsVisible;
-}
-
-
-
-
-void InsertionIndicatorOverlay::Show (void)
-{
- if ( ! mbIsVisible)
- {
- mbIsVisible = true;
-
- ::boost::shared_ptr<LayeredDevice> pLayeredDevice (
- mrSlideSorter.GetView().GetLayeredDevice());
- if (pLayeredDevice)
- {
- pLayeredDevice->RegisterPainter(shared_from_this(), mnLayerIndex);
- if (mpLayerInvalidator)
- mpLayerInvalidator->Invalidate(GetBoundingBox());
- }
- }
-}
-
-
-
-
-void InsertionIndicatorOverlay::Hide (void)
-{
- if (mbIsVisible)
- {
- mbIsVisible = false;
-
- ::boost::shared_ptr<LayeredDevice> pLayeredDevice (
- mrSlideSorter.GetView().GetLayeredDevice());
- if (pLayeredDevice)
- {
- if (mpLayerInvalidator)
- mpLayerInvalidator->Invalidate(GetBoundingBox());
- pLayeredDevice->RemovePainter(shared_from_this(), mnLayerIndex);
- }
- }
-}
-
-
-
-
-Rectangle InsertionIndicatorOverlay::GetBoundingBox (void) const
-{
- return Rectangle(maLocation, maIcon.GetSizePixel());
-}
-
-
-
-
-Size InsertionIndicatorOverlay::GetSize (void) const
-{
- return Size(
- maIcon.GetSizePixel().Width() + 10,
- maIcon.GetSizePixel().Height() + 10);
-}
-
-
-
-} } } // end of namespace ::sd::slidesorter::view
-
diff --git a/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx b/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx
deleted file mode 100644
index 1168e2c64..000000000
--- a/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx
+++ /dev/null
@@ -1,565 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "precompiled_sd.hxx"
-
-#include "SlsLayeredDevice.hxx"
-
-#include <vcl/window.hxx>
-#include <vcl/virdev.hxx>
-
-#include <boost/bind.hpp>
-#include <boost/function.hpp>
-
-
-namespace sd { namespace slidesorter { namespace view {
-
-namespace {
-static const sal_Int32 gnMaximumLayerCount = 8;
-
-class LayerInvalidator : public ILayerInvalidator
-{
-public:
- LayerInvalidator (
- const ::boost::shared_ptr<LayeredDevice>& rpLayeredDevice,
- const SharedSdWindow& rpTargetWindow,
- const int nLayer)
- : mpLayeredDevice(rpLayeredDevice),
- mpTargetWindow(rpTargetWindow),
- mnLayer(nLayer)
- {
- }
-
- virtual void Invalidate (const Rectangle& rInvalidationBox)
- {
- mpLayeredDevice->Invalidate(rInvalidationBox, mnLayer);
- mpTargetWindow->Invalidate(rInvalidationBox);
- }
-
-private:
- const ::boost::shared_ptr<LayeredDevice> mpLayeredDevice;
- SharedSdWindow mpTargetWindow;
- const int mnLayer;
-};
-
-void DeviceCopy (
- OutputDevice& rTargetDevice,
- OutputDevice& rSourceDevice,
- const Rectangle& rBox)
-{
- rTargetDevice.DrawOutDev(
- rBox.TopLeft(),
- rBox.GetSize(),
- rBox.TopLeft(),
- rBox.GetSize(),
- rSourceDevice);
-}
-
-
-void ForAllRectangles (const Region& rRegion, ::boost::function<void(const Rectangle&)> aFunction)
-{
- OSL_ASSERT(aFunction);
-
- if (rRegion.GetRectCount() <= 1)
- {
- aFunction(rRegion.GetBoundRect());
- }
- else
- {
- Region aMutableRegionCopy (rRegion);
- RegionHandle aHandle(aMutableRegionCopy.BeginEnumRects());
- Rectangle aBox;
- while (aMutableRegionCopy.GetNextEnumRect(aHandle, aBox))
- aFunction(aBox);
- aMutableRegionCopy.EndEnumRects(aHandle);
- }
-}
-
-class Layer : private ::boost::noncopyable
-{
-public:
- Layer (void);
- ~Layer (void);
-
- void Initialize (const SharedSdWindow& rpTargetWindow);
- void InvalidateRectangle (const Rectangle& rInvalidationBox);
- void InvalidateRegion (const Region& rInvalidationRegion);
- void Validate (const MapMode& rMapMode);
- void Repaint (
- OutputDevice& rTargetDevice,
- const Rectangle& rRepaintRectangle);
- void Resize (const Size& rSize);
- void AddPainter (const SharedILayerPainter& rpPainter);
- void RemovePainter (const SharedILayerPainter& rpPainter);
- bool HasPainter (void) const;
- void Dispose (void);
-
-private:
- ::boost::shared_ptr<VirtualDevice> mpLayerDevice;
- ::std::vector<SharedILayerPainter> maPainters;
- Region maInvalidationRegion;
-
- void ValidateRectangle (const Rectangle& rBox);
-};
-typedef ::boost::shared_ptr<Layer> SharedLayer;
-
-
-} // end of anonymous namespace
-
-
-class LayeredDevice::LayerContainer : public ::std::vector<SharedLayer>
-{
-public:
- LayerContainer (void) {}
- ~LayerContainer (void) {}
-};
-
-
-
-
-//===== LayeredDevice =========================================================
-
-LayeredDevice::LayeredDevice (const SharedSdWindow& rpTargetWindow)
- : mpTargetWindow(rpTargetWindow),
- mpLayers(new LayerContainer()),
- mpBackBuffer(new VirtualDevice(*mpTargetWindow)),
- maSavedMapMode(rpTargetWindow->GetMapMode())
-{
- mpBackBuffer->SetOutputSizePixel(mpTargetWindow->GetSizePixel());
-}
-
-
-
-
-LayeredDevice::~LayeredDevice (void)
-{
-}
-
-
-
-
-void LayeredDevice::Invalidate (
- const Rectangle& rInvalidationArea,
- const sal_Int32 nLayer)
-{
- if (nLayer<0 || size_t(nLayer)>=mpLayers->size())
- {
- OSL_ASSERT(nLayer>=0 && size_t(nLayer)<mpLayers->size());
- return;
- }
-
- (*mpLayers)[nLayer]->InvalidateRectangle(rInvalidationArea);
-}
-
-
-
-
-void LayeredDevice::InvalidateAllLayers (const Rectangle& rInvalidationArea)
-{
- for (sal_uInt32 nLayer=0; nLayer<mpLayers->size(); ++nLayer)
- (*mpLayers)[nLayer]->InvalidateRectangle(rInvalidationArea);
-}
-
-
-
-
-void LayeredDevice::InvalidateAllLayers (const Region& rInvalidationRegion)
-{
- for (sal_uInt32 nLayer=0; nLayer<mpLayers->size(); ++nLayer)
- (*mpLayers)[nLayer]->InvalidateRegion(rInvalidationRegion);
-}
-
-
-
-
-void LayeredDevice::RegisterPainter (
- const SharedILayerPainter& rpPainter,
- const sal_Int32 nLayer)
-{
- OSL_ASSERT(mpLayers);
- if ( ! rpPainter)
- {
- OSL_ASSERT(rpPainter);
- return;
- }
- if (nLayer<0 || nLayer>=gnMaximumLayerCount)
- {
- OSL_ASSERT(nLayer>=0 && nLayer<gnMaximumLayerCount);
- return;
- }
-
- // Provide the layers.
- if (sal_uInt32(nLayer) >= mpLayers->size())
- {
- const sal_Int32 nOldLayerCount (mpLayers->size());
- mpLayers->resize(nLayer+1);
-
- for (size_t nIndex=nOldLayerCount; nIndex<mpLayers->size(); ++nIndex)
- (*mpLayers)[nIndex].reset(new Layer());
- }
-
- (*mpLayers)[nLayer]->AddPainter(rpPainter);
- if (nLayer == 0)
- (*mpLayers)[nLayer]->Initialize(mpTargetWindow);
-
- rpPainter->SetLayerInvalidator(
- SharedILayerInvalidator(new LayerInvalidator(shared_from_this(),mpTargetWindow,nLayer)));
-}
-
-
-
-
-void LayeredDevice::RemovePainter (
- const SharedILayerPainter& rpPainter,
- const sal_Int32 nLayer)
-{
- if ( ! rpPainter)
- {
- OSL_ASSERT(rpPainter);
- return;
- }
- if (nLayer<0 || size_t(nLayer)>=mpLayers->size())
- {
- OSL_ASSERT(nLayer>=0 && size_t(nLayer)<mpLayers->size());
- return;
- }
-
- rpPainter->SetLayerInvalidator(SharedILayerInvalidator());
-
- (*mpLayers)[nLayer]->RemovePainter(rpPainter);
-
- // Remove top most layers that do not contain any painters.
- while ( ! mpLayers->empty() && ! mpLayers->back()->HasPainter())
- mpLayers->erase(mpLayers->end()-1);
-}
-
-
-
-
-bool LayeredDevice::HasPainter (const sal_Int32 nLayer)
-{
- return nLayer>=0
- && sal_uInt32(nLayer)<mpLayers->size()
- && (*mpLayers)[nLayer]->HasPainter();
-}
-
-
-
-
-void LayeredDevice::Repaint (const Region& rRepaintRegion)
-{
- // Validate the contents of all layers (that have their own devices.)
- ::std::for_each(
- mpLayers->begin(),
- mpLayers->end(),
- ::boost::bind(&Layer::Validate, _1, mpTargetWindow->GetMapMode()));
-
- ForAllRectangles(rRepaintRegion, ::boost::bind(&LayeredDevice::RepaintRectangle, this, _1));
-}
-
-
-
-
-void LayeredDevice::RepaintRectangle (const Rectangle& rRepaintRectangle)
-{
- if (mpLayers->size() == 0)
- return;
- else if (mpLayers->size() == 1)
- {
- // Just copy the main layer into the target device.
- (*mpLayers)[0]->Repaint(*mpTargetWindow, rRepaintRectangle);
- }
- else
- {
- // Paint all layers first into the back buffer (to avoid flickering
- // due to synchronous paints) and then copy that into the target
- // device.
- mpBackBuffer->SetMapMode(mpTargetWindow->GetMapMode());
- ::std::for_each(
- mpLayers->begin(),
- mpLayers->end(),
- ::boost::bind(&Layer::Repaint, _1, ::boost::ref(*mpBackBuffer), rRepaintRectangle));
-
- DeviceCopy(*mpTargetWindow, *mpBackBuffer, rRepaintRectangle);
- }
-}
-
-
-
-
-void LayeredDevice::Resize (void)
-{
- const Size aSize (mpTargetWindow->GetSizePixel());
- mpBackBuffer->SetOutputSizePixel(aSize);
- ::std::for_each(mpLayers->begin(), mpLayers->end(), ::boost::bind(&Layer::Resize, _1, aSize));
-}
-
-
-
-
-void LayeredDevice::Dispose (void)
-{
- ::std::for_each(mpLayers->begin(), mpLayers->end(), ::boost::bind(&Layer::Dispose, _1));
- mpLayers->clear();
-}
-
-
-
-
-bool LayeredDevice::HandleMapModeChange (void)
-{
- const MapMode& rMapMode (mpTargetWindow->GetMapMode());
- if (maSavedMapMode == rMapMode)
- return false;
-
- const Rectangle aLogicWindowBox (
- mpTargetWindow->PixelToLogic(Rectangle(Point(0,0), mpTargetWindow->GetSizePixel())));
- if (maSavedMapMode.GetScaleX() != rMapMode.GetScaleX()
- || maSavedMapMode.GetScaleY() != rMapMode.GetScaleY()
- || maSavedMapMode.GetMapUnit() != rMapMode.GetMapUnit())
- {
- // When the scale has changed then we have to paint everything.
- InvalidateAllLayers(aLogicWindowBox);
- }
- else if (maSavedMapMode.GetOrigin() != rMapMode.GetOrigin())
- {
- // Window has been scrolled. Adapt contents of backbuffers and
- // layer devices.
- const Point aDelta (rMapMode.GetOrigin() - maSavedMapMode.GetOrigin());
- mpBackBuffer->CopyArea(
- aLogicWindowBox.TopLeft(),
- mpTargetWindow->PixelToLogic(Point(0,0), maSavedMapMode),
- aLogicWindowBox.GetSize());
-
- // Invalidate the area(s) that have been exposed.
- const Rectangle aWindowBox (Point(0,0), mpTargetWindow->GetSizePixel());
- if (aDelta.Y() < 0)
- InvalidateAllLayers(mpTargetWindow->PixelToLogic(Rectangle(
- aWindowBox.Left(),
- aWindowBox.Bottom()+aDelta.Y(),
- aWindowBox.Right(),
- aWindowBox.Bottom())));
- else if (aDelta.Y() > 0)
- InvalidateAllLayers(mpTargetWindow->PixelToLogic(Rectangle(
- aWindowBox.Left(),
- aWindowBox.Top(),
- aWindowBox.Right(),
- aWindowBox.Top()+aDelta.Y())));
- if (aDelta.X() < 0)
- InvalidateAllLayers(mpTargetWindow->PixelToLogic(Rectangle(
- aWindowBox.Right()+aDelta.X(),
- aWindowBox.Top(),
- aWindowBox.Right(),
- aWindowBox.Bottom())));
- else if (aDelta.X() > 0)
- InvalidateAllLayers(mpTargetWindow->PixelToLogic(Rectangle(
- aWindowBox.Left(),
- aWindowBox.Top(),
- aWindowBox.Left()+aDelta.X(),
- aWindowBox.Bottom())));
- }
- else
- {
- // Can this happen? Lets trigger a warning when it does.
- OSL_ASSERT(false);
- }
-
- maSavedMapMode = rMapMode;
-
- return true;
-}
-
-
-
-
-//===== Layer =================================================================
-
-Layer::Layer (void)
- : mpLayerDevice(),
- maPainters(),
- maInvalidationRegion()
-{
-}
-
-
-
-
-Layer::~Layer (void)
-{
-}
-
-
-
-
-void Layer::Initialize (const SharedSdWindow& rpTargetWindow)
-{
-#if 0
- (void)rpTargetWindow;
-#else
- if ( ! mpLayerDevice)
- {
- mpLayerDevice.reset(new VirtualDevice(*rpTargetWindow));
- mpLayerDevice->SetOutputSizePixel(rpTargetWindow->GetSizePixel());
- }
-#endif
-}
-
-
-
-
-void Layer::InvalidateRectangle (const Rectangle& rInvalidationBox)
-{
- maInvalidationRegion.Union(rInvalidationBox);
-}
-
-
-
-
-void Layer::InvalidateRegion (const Region& rInvalidationRegion)
-{
- maInvalidationRegion.Union(rInvalidationRegion);
-}
-
-
-
-
-void Layer::Validate (const MapMode& rMapMode)
-{
- if (mpLayerDevice && ! maInvalidationRegion.IsEmpty())
- {
- Region aRegion (maInvalidationRegion);
- maInvalidationRegion.SetEmpty();
-
- mpLayerDevice->SetMapMode(rMapMode);
- ForAllRectangles(
- aRegion,
- ::boost::bind(&Layer::ValidateRectangle, this, _1));
- }
-}
-
-
-
-
-void Layer::ValidateRectangle (const Rectangle& rBox)
-{
- if ( ! mpLayerDevice)
- return;
- const Region aSavedClipRegion (mpLayerDevice->GetClipRegion());
- mpLayerDevice->IntersectClipRegion(rBox);
-
- for (::std::vector<SharedILayerPainter>::const_iterator
- iPainter(maPainters.begin()),
- iEnd(maPainters.end());
- iPainter!=iEnd;
- ++iPainter)
- {
- (*iPainter)->Paint(*mpLayerDevice, rBox);
- }
-
- mpLayerDevice->SetClipRegion(aSavedClipRegion);
-}
-
-
-
-
-void Layer::Repaint (
- OutputDevice& rTargetDevice,
- const Rectangle& rRepaintRectangle)
-{
- if (mpLayerDevice)
- {
- DeviceCopy(rTargetDevice, *mpLayerDevice, rRepaintRectangle);
- }
- else
- {
- ::std::for_each(
- maPainters.begin(),
- maPainters.end(),
- ::boost::bind(&ILayerPainter::Paint,
- _1,
- ::boost::ref(rTargetDevice),
- rRepaintRectangle));
- }
-}
-
-
-
-
-void Layer::Resize (const Size& rSize)
-{
- if (mpLayerDevice)
- {
- mpLayerDevice->SetOutputSizePixel(rSize);
- maInvalidationRegion = Rectangle(Point(0,0), rSize);
- }
-}
-
-
-
-
-void Layer::AddPainter (const SharedILayerPainter& rpPainter)
-{
- OSL_ASSERT(::std::find(maPainters.begin(), maPainters.end(), rpPainter) == maPainters.end());
-
- maPainters.push_back(rpPainter);
-}
-
-
-
-
-void Layer::RemovePainter (const SharedILayerPainter& rpPainter)
-{
- const ::std::vector<SharedILayerPainter>::iterator iPainter (
- ::std::find(maPainters.begin(), maPainters.end(), rpPainter));
- if (iPainter != maPainters.end())
- {
- maPainters.erase(iPainter);
- }
- else
- {
- DBG_ASSERT(false,"LayeredDevice::RemovePainter called for painter that is not registered");
- }
-}
-
-
-
-
-bool Layer::HasPainter (void) const
-{
- return !maPainters.empty();
-}
-
-
-
-
-void Layer::Dispose (void)
-{
- maPainters.clear();
-}
-
-
-} } } // end of namespace ::sd::slidesorter::view
diff --git a/sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx b/sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx
deleted file mode 100644
index 66a405823..000000000
--- a/sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx
+++ /dev/null
@@ -1,99 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef SD_SLIDESORTER_VIEW_LAYERED_DEVICE_HXX
-#define SD_SLIDESORTER_VIEW_LAYERED_DEVICE_HXX
-
-#include "view/SlsILayerPainter.hxx"
-#include "SlideSorter.hxx"
-
-#include <tools/gen.hxx>
-#include <vcl/region.hxx>
-#include <vcl/virdev.hxx>
-
-#include <boost/noncopyable.hpp>
-#include <boost/scoped_ptr.hpp>
-#include <boost/shared_ptr.hpp>
-#include <boost/enable_shared_from_this.hpp>
-#include <vector>
-
-class Window;
-
-namespace sd { namespace slidesorter { namespace view {
-
-/** A simple wrapper around an OutputDevice that provides support for
- independent layers and buffering.
- Each layer may contain any number of painters.
-*/
-class LayeredDevice
- : public ::boost::enable_shared_from_this<LayeredDevice>
-
-{
-public:
- LayeredDevice (const SharedSdWindow& rpTargetWindow);
- ~LayeredDevice (void);
-
- void Invalidate (
- const Rectangle& rInvalidationBox,
- const sal_Int32 nLayer);
- void InvalidateAllLayers (
- const Rectangle& rInvalidationBox);
- void InvalidateAllLayers (
- const Region& rInvalidationRegion);
-
- void RegisterPainter (
- const SharedILayerPainter& rPainter,
- const sal_Int32 nLayer);
-
- void RemovePainter (
- const SharedILayerPainter& rPainter,
- const sal_Int32 nLayer);
-
- bool HasPainter (const sal_Int32 nLayer);
-
- bool HandleMapModeChange (void);
- void Repaint (const Region& rRepaintRegion);
-
- void Resize (void);
-
- void Dispose (void);
-
-private:
- SharedSdWindow mpTargetWindow;
- class LayerContainer;
- ::boost::scoped_ptr<LayerContainer> mpLayers;
- ::boost::scoped_ptr<VirtualDevice> mpBackBuffer;
- MapMode maSavedMapMode;
-
- void RepaintRectangle (const Rectangle& rRepaintRectangle);
-};
-
-
-
-} } } // end of namespace ::sd::slidesorter::view
-
-#endif
diff --git a/sd/source/ui/slidesorter/view/SlsLayouter.cxx b/sd/source/ui/slidesorter/view/SlsLayouter.cxx
deleted file mode 100644
index 19ec3bc64..000000000
--- a/sd/source/ui/slidesorter/view/SlsLayouter.cxx
+++ /dev/null
@@ -1,1555 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "precompiled_sd.hxx"
-
-#include "view/SlsLayouter.hxx"
-#include "model/SlideSorterModel.hxx"
-#include "model/SlsPageDescriptor.hxx"
-#include "Window.hxx"
-#include <rtl/math.hxx>
-#include <basegfx/numeric/ftools.hxx>
-
-namespace {
- sal_Int32 RoundToInt (const double nValue)
- {
- return sal_Int32(::rtl::math::round(nValue));
- }
-}
-
-
-namespace sd { namespace slidesorter { namespace view {
-
-class Layouter::Implementation
-{
-public:
- SharedSdWindow mpWindow;
- sal_Int32 mnRequestedLeftBorder;
- sal_Int32 mnRequestedRightBorder;
- sal_Int32 mnRequestedTopBorder;
- sal_Int32 mnRequestedBottomBorder;
- sal_Int32 mnLeftBorder;
- sal_Int32 mnRightBorder;
- sal_Int32 mnTopBorder;
- sal_Int32 mnBottomBorder;
- sal_Int32 mnVerticalGap;
- sal_Int32 mnHorizontalGap;
- Size maMinimalSize;
- Size maPreferredSize;
- Size maMaximalSize;
- sal_Int32 mnMinimalColumnCount;
- sal_Int32 mnMaximalColumnCount;
- sal_Int32 mnPageCount;
- sal_Int32 mnColumnCount;
- sal_Int32 mnRowCount;
- /// The maximum number of columns. Can only be larger than the current
- /// number of columns when there are not enough pages to fill all
- /// available columns.
- sal_Int32 mnMaxColumnCount;
- /// The maximum number of rows. Can only be larger than the current
- /// number of rows when there are not enough pages to fill all available
- /// rows.
- sal_Int32 mnMaxRowCount;
- Size maPageObjectSize;
- ::boost::shared_ptr<PageObjectLayouter> mpPageObjectLayouter;
- ::boost::shared_ptr<view::Theme> mpTheme;
-
- /** Specify how the gap between two page objects is associated with the
- page objects.
- */
- enum GapMembership {
- GM_NONE, // Gap is not associated with any page object.
- GM_PREVIOUS, // The whole gap is associated with the previous page
- // object (left or above the gap.)
- GM_BOTH, // Half of the gap is associated with previous, half
- // with the next page object.
- GM_NEXT, // The whole gap is associated with the next page
- // object (right or below the gap.)
- GM_PAGE_BORDER
- };
-
- static Implementation* Create (
- const Implementation& rImplementation,
- const Layouter::Orientation eOrientation);
-
- virtual Layouter::Orientation GetOrientation (void) const = 0;
-
- bool Rearrange (
- const Size& rWindowSize,
- const Size& rPreviewModelSize,
- const sal_uInt32 nPageCount);
-
- /** Calculate the row that the point with the given vertical coordinate
- is over. The horizontal component is ignored.
- @param nYPosition
- Vertical position in model coordinates.
- @param bIncludeBordersAndGaps
- When this flag is <TRUE/> then the area of borders and gaps are
- interpreted as belonging to one of the rows.
- @param eGapMembership
- Specifies to what row the gap areas belong. Here GM_NONE
- corresponds to bIncludeBordersAndGaps being <FALSE/>. When
- GM_BOTH is given then the upper half is associated to the row
- above and the lower half to the row below. Values of
- GM_PREVIOUS and GM_NEXT associate the whole gap area with the
- row above or below respectively.
- */
- sal_Int32 GetRowAtPosition (
- sal_Int32 nYPosition,
- bool bIncludeBordersAndGaps,
- GapMembership eGapMembership = GM_NONE) const;
-
- /** Calculate the column that the point with the given horizontal
- coordinate is over. The verical component is ignored.
- @param nXPosition
- Horizontal position in model coordinates.
- @param bIncludeBordersAndGaps
- When this flag is <TRUE/> then the area of borders and gaps are
- interpreted as belonging to one of the columns.
- @param eGapMembership
- Specifies to what column the gap areas belong.
- */
- sal_Int32 GetColumnAtPosition (
- sal_Int32 nXPosition,
- bool bIncludeBordersAndGaps,
- GapMembership eGapMembership = GM_NONE) const;
-
- /** This method is typically called from GetRowAtPosition() and
- GetColumnAtPosition() to handle a position that lies inside the gap
- between two adjacent rows or columns.
- @param nDistanceIntoGap
- Vertical distance from the bottom of the upper row down into the
- gap or or horizontal distance from the right edge right into the
- gap.
- @param eGapMemberhship
- This value decides what areas in the gap belong to which (or no)
- row or column.
- @param nIndex
- The row index of the upper row or the column index of the left
- column.
- @param nGap
- Width or height of the gap in model coordiantes between the
- page borders.
- @return
- Returns either the index of the upper row (as given as nRow), the
- index of the lower row (nRow+1) or -1 to indicate that the
- position belongs to no row.
- */
- sal_Int32 ResolvePositionInGap (
- sal_Int32 nDistanceIntoGap,
- GapMembership eGapMembership,
- sal_Int32 nIndex,
- sal_Int32 nGap) const;
-
- /** Calculate the logical part of the insert position, i.e. the page
- after whicht to insert.
- */
- virtual void CalculateLogicalInsertPosition (
- const Point& rModelPosition,
- InsertPosition& rPosition) const = 0;
-
- /** Calculate the geometrical part of the insert position, i.e. the
- location of where to display the insertion indicator and the
- distances about which the leading and trailing pages have to be
- moved to make room for the indicator.
- */
- void CalculateGeometricPosition (
- InsertPosition& rPosition,
- const Size& rIndicatorSize,
- const bool bIsVertical,
- model::SlideSorterModel& rModel) const;
-
- /** Return the bounding box of the preview or, when selected, of the page
- object. Thus, it returns something like a visual bounding box.
- */
- Rectangle GetInnerBoundingBox (
- model::SlideSorterModel& rModel,
- const sal_Int32 nIndex) const;
-
- Range GetValidHorizontalSizeRange (void) const;
- Range GetValidVerticalSizeRange (void) const;
-
- Range GetRangeOfVisiblePageObjects (const Rectangle& aVisibleArea) const;
- sal_Int32 GetIndex (
- const sal_Int32 nRow,
- const sal_Int32 nColumn,
- const bool bClampToValidRange) const;
-
- Rectangle GetPageObjectBox (
- const sal_Int32 nIndex,
- const bool bIncludeBorderAndGap = false) const;
-
- Rectangle GetPageObjectBox (
- const sal_Int32 nRow,
- const sal_Int32 nColumn) const;
-
- Rectangle AddBorderAndGap (
- const Rectangle& rBoundingBox,
- const sal_Int32 nRow,
- const sal_Int32 nColumn) const;
-
- Rectangle GetTotalBoundingBox (void) const;
-
- virtual ~Implementation (void);
-
-protected:
- Implementation (
- const SharedSdWindow& rpWindow,
- const ::boost::shared_ptr<view::Theme>& rpTheme);
- Implementation (const Implementation& rImplementation);
-
- virtual void CalculateRowAndColumnCount (const Size& rWindowSize) = 0;
- virtual void CalculateMaxRowAndColumnCount (const Size& rWindowSize) = 0;
- virtual Size CalculateTargetSize (
- const Size& rWindowSize,
- const Size& rPreviewModelSize) const = 0;
- Size GetTargetSize (
- const Size& rWindowSize,
- const Size& rPreviewModelSize,
- const bool bCalculateWidth,
- const bool bCalculateHeight) const;
- void CalculateVerticalLogicalInsertPosition (
- const Point& rModelPosition,
- InsertPosition& rPosition) const;
-};
-
-
-/** The vertical layouter has one column and as many rows as there are
- pages.
-*/
-class VerticalImplementation : public Layouter::Implementation
-{
-public:
- VerticalImplementation (
- const SharedSdWindow& rpWindow,
- const ::boost::shared_ptr<view::Theme>& rpTheme);
- VerticalImplementation (const Implementation& rImplementation);
-
- virtual Layouter::Orientation GetOrientation (void) const;
-
- void CalculateLogicalInsertPosition (
- const Point& rModelPosition,
- InsertPosition& rPosition) const;
-
-protected:
- virtual void CalculateRowAndColumnCount (const Size& rWindowSize);
- virtual void CalculateMaxRowAndColumnCount (const Size& rWindowSize);
- virtual Size CalculateTargetSize (
- const Size& rWindowSize,
- const Size& rPreviewModelSize) const;
-};
-
-
-/** The horizontal layouter has one row and as many columns as there are
- pages.
-*/
-class HorizontalImplementation : public Layouter::Implementation
-{
-public:
- HorizontalImplementation (
- const SharedSdWindow& rpWindow,
- const ::boost::shared_ptr<view::Theme>& rpTheme);
- HorizontalImplementation (const Implementation& rImplementation);
-
- virtual Layouter::Orientation GetOrientation (void) const;
-
- void CalculateLogicalInsertPosition (
- const Point& rModelPosition,
- InsertPosition& rPosition) const;
-
-protected:
- virtual void CalculateRowAndColumnCount (const Size& rWindowSize);
- virtual void CalculateMaxRowAndColumnCount (const Size& rWindowSize);
- virtual Size CalculateTargetSize (
- const Size& rWindowSize,
- const Size& rPreviewModelSize) const;
-};
-
-
-/** The number of columns of the grid layouter is defined via a control in
- the slide sorter tool bar. The number of rows is calculated from the
- number of columns and the number of pages.
-*/
-class GridImplementation : public Layouter::Implementation
-{
-public:
- GridImplementation (
- const SharedSdWindow& rpWindow,
- const ::boost::shared_ptr<view::Theme>& rpTheme);
- GridImplementation (const Implementation& rImplementation);
-
- virtual Layouter::Orientation GetOrientation (void) const;
-
- void CalculateLogicalInsertPosition (
- const Point& rModelPosition,
- InsertPosition& rPosition) const;
-
-protected:
- virtual void CalculateRowAndColumnCount (const Size& rWindowSize);
- virtual void CalculateMaxRowAndColumnCount (const Size& rWindowSize);
- virtual Size CalculateTargetSize (
- const Size& rWindowSize,
- const Size& rPreviewModelSize) const;
-};
-
-
-
-
-//===== Layouter ==============================================================
-
-Layouter::Layouter (
- const SharedSdWindow& rpWindow,
- const ::boost::shared_ptr<Theme>& rpTheme)
- : mpImplementation(new GridImplementation(rpWindow, rpTheme)),
- mpWindow(rpWindow)
-{
-}
-
-
-
-
-Layouter::~Layouter (void)
-{
-}
-
-
-
-
-::boost::shared_ptr<PageObjectLayouter> Layouter::GetPageObjectLayouter (void) const
-{
- return mpImplementation->mpPageObjectLayouter;
-}
-
-
-
-
-void Layouter::SetBorders (
- sal_Int32 nLeftBorder,
- sal_Int32 nRightBorder,
- sal_Int32 nTopBorder,
- sal_Int32 nBottomBorder)
-{
- if (nLeftBorder >= 0)
- mpImplementation->mnRequestedLeftBorder = nLeftBorder;
- if (nRightBorder >= 0)
- mpImplementation->mnRequestedRightBorder = nRightBorder;
- if (nTopBorder >= 0)
- mpImplementation->mnRequestedTopBorder = nTopBorder;
- if (nBottomBorder >= 0)
- mpImplementation->mnRequestedBottomBorder = nBottomBorder;
-}
-
-
-
-
-void Layouter::SetColumnCount (
- sal_Int32 nMinimalColumnCount,
- sal_Int32 nMaximalColumnCount)
-{
- if (nMinimalColumnCount <= nMaximalColumnCount)
- {
- mpImplementation->mnMinimalColumnCount = nMinimalColumnCount;
- mpImplementation->mnMaximalColumnCount = nMaximalColumnCount;
- }
-}
-
-
-
-
-bool Layouter::Rearrange (
- const Orientation eOrientation,
- const Size& rWindowSize,
- const Size& rPageSize,
- const sal_uInt32 nPageCount)
-{
- OSL_ASSERT(mpWindow);
-
- if (eOrientation != mpImplementation->GetOrientation())
- mpImplementation.reset(Implementation::Create(*mpImplementation, eOrientation));
-
- return mpImplementation->Rearrange(rWindowSize, rPageSize, nPageCount);
-}
-
-
-
-
-void Layouter::_SetZoom (double nZoomFactor)
-{
- _SetZoom(Fraction(nZoomFactor));
-}
-
-
-
-
-void Layouter::_SetZoom (Fraction nZoomFactor)
-{
- OSL_ASSERT(mpWindow);
-
- MapMode aMapMode (mpWindow->GetMapMode());
- aMapMode.SetScaleX (nZoomFactor);
- aMapMode.SetScaleY (nZoomFactor);
- mpWindow->SetMapMode (aMapMode);
-}
-
-
-
-
-sal_Int32 Layouter::GetColumnCount (void) const
-{
- return mpImplementation->mnColumnCount;
-}
-
-
-
-
-sal_Int32 Layouter::GetRowCount (void) const
-{
- return mpImplementation->mnRowCount;
-}
-
-
-
-
-sal_Int32 Layouter::GetRow (const sal_Int32 nIndex) const
-{
- return nIndex / mpImplementation->mnColumnCount;
-}
-
-
-
-
-sal_Int32 Layouter::GetColumn (const sal_Int32 nIndex) const
-{
- return nIndex % mpImplementation->mnColumnCount;
-}
-
-
-
-
-sal_Int32 Layouter::GetIndex (const sal_Int32 nRow, const sal_Int32 nColumn) const
-{
- return mpImplementation->GetIndex(nRow,nColumn,true);
-}
-
-
-
-
-Size Layouter::GetPageObjectSize (void) const
-{
- return mpImplementation->maPageObjectSize;
-}
-
-
-
-
-Rectangle Layouter::GetPageObjectBox (
- const sal_Int32 nIndex,
- const bool bIncludeBorderAndGap) const
-{
- return mpImplementation->GetPageObjectBox(nIndex, bIncludeBorderAndGap);
-}
-
-
-
-
-Rectangle Layouter::GetTotalBoundingBox (void) const
-{
- return mpImplementation->GetTotalBoundingBox();
-}
-
-
-
-
-InsertPosition Layouter::GetInsertPosition (
- const Point& rModelPosition,
- const Size& rIndicatorSize,
- model::SlideSorterModel& rModel) const
-{
- InsertPosition aPosition;
- mpImplementation->CalculateLogicalInsertPosition(
- rModelPosition,
- aPosition);
- mpImplementation->CalculateGeometricPosition(
- aPosition,
- rIndicatorSize,
- GetColumnCount()==1,
- rModel);
- return aPosition;
-}
-
-
-
-
-Range Layouter::GetValidHorizontalSizeRange (void) const
-{
- return mpImplementation->GetValidHorizontalSizeRange();
-}
-
-
-
-
-Range Layouter::GetValidVerticalSizeRange (void) const
-{
- return mpImplementation->GetValidVerticalSizeRange();
-}
-
-
-
-
-Range Layouter::GetRangeOfVisiblePageObjects (const Rectangle& aVisibleArea) const
-{
- return mpImplementation->GetRangeOfVisiblePageObjects(aVisibleArea);
-}
-
-
-
-
-sal_Int32 Layouter::GetIndexAtPoint (
- const Point& rPosition,
- const bool bIncludePageBorders,
- const bool bClampToValidRange) const
-{
- const sal_Int32 nRow (
- mpImplementation->GetRowAtPosition (
- rPosition.Y(),
- bIncludePageBorders,
- bIncludePageBorders ? Implementation::GM_PAGE_BORDER : Implementation::GM_NONE));
- const sal_Int32 nColumn (
- mpImplementation->GetColumnAtPosition (
- rPosition.X(),
- bIncludePageBorders,
- bIncludePageBorders ? Implementation::GM_PAGE_BORDER : Implementation::GM_NONE));
-
- return mpImplementation->GetIndex(nRow,nColumn,bClampToValidRange);
-}
-
-
-
-
-//===== Layouter::Implementation ==============================================
-
-Layouter::Implementation* Layouter::Implementation::Create (
- const Implementation& rImplementation,
- const Layouter::Orientation eOrientation)
-{
- switch (eOrientation)
- {
- case HORIZONTAL: return new HorizontalImplementation(rImplementation);
- case VERTICAL: return new VerticalImplementation(rImplementation);
- case GRID:
- default: return new GridImplementation(rImplementation);
- }
-}
-
-
-
-
-Layouter::Implementation::Implementation (
- const SharedSdWindow& rpWindow,
- const ::boost::shared_ptr<view::Theme>& rpTheme)
- : mpWindow(rpWindow),
- mnRequestedLeftBorder(5),
- mnRequestedRightBorder(5),
- mnRequestedTopBorder(5),
- mnRequestedBottomBorder(5),
- mnLeftBorder(5),
- mnRightBorder(5),
- mnTopBorder(5),
- mnBottomBorder(5),
- mnVerticalGap (10 - 2*rpTheme->GetIntegerValue(Theme::Integer_FocusIndicatorWidth)),
- mnHorizontalGap(10 - 2*rpTheme->GetIntegerValue(Theme::Integer_FocusIndicatorWidth)),
- maMinimalSize(132,98),
- maPreferredSize(200,150),
- maMaximalSize(300,200),
- mnMinimalColumnCount(1),
- mnMaximalColumnCount(15),
- mnPageCount(0),
- mnColumnCount(1),
- mnRowCount(0),
- mnMaxColumnCount(0),
- mnMaxRowCount(0),
- maPageObjectSize(1,1),
- mpPageObjectLayouter(),
- mpTheme(rpTheme)
-{
-}
-
-
-
-
-Layouter::Implementation::Implementation (const Implementation& rImplementation)
- : mpWindow(rImplementation.mpWindow),
- mnRequestedLeftBorder(rImplementation.mnRequestedLeftBorder),
- mnRequestedRightBorder(rImplementation.mnRequestedRightBorder),
- mnRequestedTopBorder(rImplementation.mnRequestedTopBorder),
- mnRequestedBottomBorder(rImplementation.mnRequestedBottomBorder),
- mnLeftBorder(rImplementation.mnLeftBorder),
- mnRightBorder(rImplementation.mnRightBorder),
- mnTopBorder(rImplementation.mnTopBorder),
- mnBottomBorder(rImplementation.mnBottomBorder),
- mnVerticalGap(rImplementation.mnVerticalGap),
- mnHorizontalGap(rImplementation.mnHorizontalGap),
- maMinimalSize(rImplementation.maMinimalSize),
- maPreferredSize(rImplementation.maPreferredSize),
- maMaximalSize(rImplementation.maMaximalSize),
- mnMinimalColumnCount(rImplementation.mnMinimalColumnCount),
- mnMaximalColumnCount(rImplementation.mnMaximalColumnCount),
- mnPageCount(rImplementation.mnPageCount),
- mnColumnCount(rImplementation.mnColumnCount),
- mnRowCount(rImplementation.mnRowCount),
- mnMaxColumnCount(rImplementation.mnMaxColumnCount),
- mnMaxRowCount(rImplementation.mnMaxRowCount),
- maPageObjectSize(rImplementation.maPageObjectSize),
- mpPageObjectLayouter(),
- mpTheme(rImplementation.mpTheme)
-{
-}
-
-
-
-
-Layouter::Implementation::~Implementation (void)
-{
-}
-
-
-
-
-bool Layouter::Implementation::Rearrange (
- const Size& rWindowSize,
- const Size& rPreviewModelSize,
- const sal_uInt32 nPageCount)
-{
- mnPageCount = nPageCount;
-
- // Return early when the window or the model have not yet been initialized.
- if (rWindowSize.Width()<=0 || rWindowSize.Height()<=0)
- return false;
- if (rPreviewModelSize.Width()<=0 || rPreviewModelSize.Height()<=0)
- return false;
-
- CalculateRowAndColumnCount(rWindowSize);
-
- // Update the border values.
- mnLeftBorder = mnRequestedLeftBorder;
- mnTopBorder = mnRequestedTopBorder;
- mnRightBorder = mnRequestedRightBorder;
- mnBottomBorder = mnRequestedBottomBorder;
- if (mnColumnCount > 1)
- {
- int nMinimumBorderWidth = mnHorizontalGap/2;
- if (mnLeftBorder < nMinimumBorderWidth)
- mnLeftBorder = nMinimumBorderWidth;
- if (mnRightBorder < nMinimumBorderWidth)
- mnRightBorder = nMinimumBorderWidth;
- }
- else
- {
- int nMinimumBorderHeight = mnVerticalGap/2;
- if (mnTopBorder < nMinimumBorderHeight)
- mnTopBorder = nMinimumBorderHeight;
- if (mnBottomBorder < nMinimumBorderHeight)
- mnBottomBorder = nMinimumBorderHeight;
- }
-
- mpPageObjectLayouter.reset(
- new PageObjectLayouter(
- mpTheme,
- CalculateTargetSize(rWindowSize, rPreviewModelSize),
- rPreviewModelSize,
- mpWindow,
- mnPageCount));
- maPageObjectSize = mpPageObjectLayouter->GetSize(
- PageObjectLayouter::FocusIndicator,
- PageObjectLayouter::WindowCoordinateSystem);
-
- CalculateMaxRowAndColumnCount(rWindowSize);
-
- return true;
-}
-
-
-
-
-sal_Int32 Layouter::Implementation::GetRowAtPosition (
- sal_Int32 nYPosition,
- bool bIncludeBordersAndGaps,
- GapMembership eGapMembership) const
-{
- sal_Int32 nRow = -1;
-
- const sal_Int32 nY = nYPosition - mnTopBorder;
- if (nY >= 0)
- {
- // Vertical distance from one row to the next.
- const sal_Int32 nRowOffset (maPageObjectSize.Height() + mnVerticalGap);
-
- // Calculate row consisting of page objects and gap below.
- nRow = nY / nRowOffset;
-
- const sal_Int32 nDistanceIntoGap ((nY - nRow*nRowOffset) - maPageObjectSize.Height());
- // When inside the gap below then nYPosition is not over a page
- // object.
- if (nDistanceIntoGap > 0)
- nRow = ResolvePositionInGap (
- nDistanceIntoGap,
- eGapMembership,
- nRow,
- mnVerticalGap);
- }
- else if (bIncludeBordersAndGaps)
- {
- // We are in the top border area. Set nRow to the first row when
- // the top border shall be considered to belong to the first row.
- nRow = 0;
- }
-
- return nRow;
-}
-
-
-
-
-sal_Int32 Layouter::Implementation::GetColumnAtPosition (
- sal_Int32 nXPosition,
- bool bIncludeBordersAndGaps,
- GapMembership eGapMembership) const
-{
- sal_Int32 nColumn = -1;
-
- sal_Int32 nX = nXPosition - mnLeftBorder;
- if (nX >= 0)
- {
- // Horizontal distance from one column to the next.
- const sal_Int32 nColumnOffset (maPageObjectSize.Width() + mnHorizontalGap);
-
- // Calculate row consisting of page objects and gap below.
- nColumn = nX / nColumnOffset;
- if (nColumn < 0)
- nColumn = 0;
- else if (nColumn >= mnColumnCount)
- nColumn = mnColumnCount-1;
-
- const sal_Int32 nDistanceIntoGap ((nX - nColumn*nColumnOffset) - maPageObjectSize.Width());
- // When inside the gap at the right then nXPosition is not over a
- // page object.
- if (nDistanceIntoGap > 0)
- nColumn = ResolvePositionInGap (
- nDistanceIntoGap,
- eGapMembership,
- nColumn,
- mnHorizontalGap);
- }
- else if (bIncludeBordersAndGaps)
- {
- // We are in the left border area. Set nColumn to the first column
- // when the left border shall be considered to belong to the first
- // column.
- nColumn = 0;
- }
- return nColumn;
-}
-
-
-
-
-sal_Int32 Layouter::Implementation::ResolvePositionInGap (
- sal_Int32 nDistanceIntoGap,
- GapMembership eGapMembership,
- sal_Int32 nIndex,
- sal_Int32 nGap) const
-{
- switch (eGapMembership)
- {
- case GM_NONE:
- // The gap is no man's land.
- nIndex = -1;
- break;
-
- case GM_BOTH:
- {
- // The lower half of the gap belongs to the next row or column.
- sal_Int32 nFirstHalfGapWidth = nGap / 2;
- if (nDistanceIntoGap > nFirstHalfGapWidth)
- nIndex ++;
- break;
- }
-
- case GM_PREVIOUS:
- // Row or column already at correct value.
- break;
-
- case GM_NEXT:
- // The complete gap belongs to the next row or column.
- nIndex ++;
- break;
-
- case GM_PAGE_BORDER:
- if (nDistanceIntoGap > 0)
- {
- if (nDistanceIntoGap > nGap)
- {
- // Inside the border of the next row or column.
- nIndex ++;
- }
- else
- {
- // Inside the gap between the page borders.
- nIndex = -1;
- }
- }
- break;
-
- default:
- nIndex = -1;
- }
-
- return nIndex;
-}
-
-
-
-
-void Layouter::Implementation::CalculateGeometricPosition (
- InsertPosition& rPosition,
- const Size& rIndicatorSize,
- const bool bIsVertical,
- model::SlideSorterModel& rModel) const
-{
- // 1. Determine right/bottom of the leading page and the left/top of the
- // trailing page object and how to distribute the missing space.
- sal_Int32 nLeadingLocation (0);
- sal_Int32 nTrailingLocation (0);
- bool bIsLeadingFixed (false);
- bool bIsTrailingFixed (false);
- sal_Int32 nSecondaryLocation (0);
- const sal_Int32 nIndex (rPosition.GetIndex());
-
- if (rPosition.IsAtRunStart())
- {
- // Place indicator at the top of the column.
- const Rectangle aOuterBox (GetPageObjectBox(nIndex));
- const Rectangle aInnerBox (GetInnerBoundingBox(rModel, nIndex));
- if (bIsVertical)
- {
- nLeadingLocation = aOuterBox.Top();
- nTrailingLocation = aInnerBox.Top();
- nSecondaryLocation = aInnerBox.Center().X();
- }
- else
- {
- nLeadingLocation = aOuterBox.Left();
- nTrailingLocation = aInnerBox.Left();
- nSecondaryLocation = aInnerBox.Center().Y();
- }
- bIsLeadingFixed = true;
- }
- else if (rPosition.IsAtRunEnd())
- {
- // Place indicator at the bottom/right of the column/row.
-
- const Rectangle aOuterBox (GetPageObjectBox(nIndex-1));
- const Rectangle aInnerBox (GetInnerBoundingBox(rModel, nIndex-1));
- if (bIsVertical)
- {
- nLeadingLocation = aInnerBox.Bottom();
- nTrailingLocation = aOuterBox.Bottom();
- nSecondaryLocation = aInnerBox.Center().X();
- }
- else
- {
- nLeadingLocation = aInnerBox.Right();
- nTrailingLocation = aOuterBox.Right();
- nSecondaryLocation = aInnerBox.Center().Y();
- }
- bIsTrailingFixed = true;
- if ( ! rPosition.IsExtraSpaceNeeded())
- bIsLeadingFixed = true;
- }
- else
- {
- // Place indicator between two rows/columns.
- const Rectangle aBox1 (GetInnerBoundingBox(rModel, nIndex-1));
- const Rectangle aBox2 (GetInnerBoundingBox(rModel, nIndex));
- if (bIsVertical)
- {
- nLeadingLocation = aBox1.Bottom();
- nTrailingLocation = aBox2.Top();
- nSecondaryLocation = (aBox1.Center().X() + aBox2.Center().X()) / 2;
- }
- else
- {
- nLeadingLocation = aBox1.Right();
- nTrailingLocation = aBox2.Left();
- nSecondaryLocation = (aBox1.Center().Y() + aBox2.Center().Y()) / 2;
- }
- }
-
- // 2. Calculate the location of the insert indicator and the offsets of
- // leading and trailing pages.
- const sal_Int32 nAvailableSpace (nTrailingLocation - nLeadingLocation);
- const sal_Int32 nRequiredSpace (bIsVertical ? rIndicatorSize.Height():rIndicatorSize.Width());
- const sal_Int32 nMissingSpace (::std::max(sal_Int32(0), nRequiredSpace - nAvailableSpace));
- sal_Int32 nPrimaryLocation (0);
- sal_Int32 nLeadingOffset (0);
- sal_Int32 nTrailingOffset (0);
- if (bIsLeadingFixed)
- {
- nPrimaryLocation = nLeadingLocation + nRequiredSpace/2;
- if ( ! bIsTrailingFixed)
- nTrailingOffset = nMissingSpace;
- }
- else if (bIsTrailingFixed)
- {
- nPrimaryLocation = nTrailingLocation - nRequiredSpace/2;
- nLeadingOffset = -nMissingSpace;
- }
- else
- {
- nPrimaryLocation = (nLeadingLocation + nTrailingLocation) /2;
- nLeadingOffset = -nMissingSpace/2;
- nTrailingOffset = nMissingSpace + nLeadingOffset;
- }
-
- if (bIsVertical)
- {
- rPosition.SetGeometricalPosition(
- Point(nSecondaryLocation, nPrimaryLocation),
- Point(0, nLeadingOffset),
- Point(0, nTrailingOffset));
- }
- else
- {
- rPosition.SetGeometricalPosition(
- Point(nPrimaryLocation, nSecondaryLocation),
- Point(nLeadingOffset, 0),
- Point(nTrailingOffset, 0));
- }
-}
-
-
-
-
-Rectangle Layouter::Implementation::GetInnerBoundingBox (
- model::SlideSorterModel& rModel,
- const sal_Int32 nIndex) const
-{
- model::SharedPageDescriptor pDescriptor (rModel.GetPageDescriptor(nIndex));
- if ( ! pDescriptor)
- return Rectangle();
-
- const Point aLocation (pDescriptor->GetLocation(true));
- if (pDescriptor->HasState(model::PageDescriptor::ST_Selected))
- return mpPageObjectLayouter->GetBoundingBox(
- aLocation,
- PageObjectLayouter::PageObject,
- PageObjectLayouter::ModelCoordinateSystem);
- else
- return mpPageObjectLayouter->GetBoundingBox(
- aLocation,
- PageObjectLayouter::Preview,
- PageObjectLayouter::ModelCoordinateSystem);
-}
-
-
-
-
-Range Layouter::Implementation::GetValidHorizontalSizeRange (void) const
-{
- return Range(
- mnLeftBorder + maMinimalSize.Width() + mnRightBorder,
- mnLeftBorder + maMaximalSize.Width() + mnRightBorder);
-}
-
-
-
-
-Range Layouter::Implementation::GetValidVerticalSizeRange (void) const
-{
- return Range(
- mnTopBorder + maMinimalSize.Height() + mnBottomBorder,
- mnTopBorder + maMaximalSize.Height() + mnBottomBorder);
-}
-
-
-
-
-Range Layouter::Implementation::GetRangeOfVisiblePageObjects (const Rectangle& aVisibleArea) const
-{
- const sal_Int32 nRow0 (GetRowAtPosition(aVisibleArea.Top(), true, GM_NEXT));
- const sal_Int32 nCol0 (GetColumnAtPosition(aVisibleArea.Left(),true, GM_NEXT));
- const sal_Int32 nRow1 (GetRowAtPosition(aVisibleArea.Bottom(), true, GM_PREVIOUS));
- const sal_Int32 nCol1 (GetColumnAtPosition(aVisibleArea.Right(), true, GM_PREVIOUS));
-
- // When start and end lie in different rows then the range may include
- // slides outside (left or right of) the given area.
- return Range(GetIndex(nRow0,nCol0,true), GetIndex(nRow1,nCol1,true));
-}
-
-
-
-
-Size Layouter::Implementation::GetTargetSize (
- const Size& rWindowSize,
- const Size& rPreviewModelSize,
- const bool bCalculateWidth,
- const bool bCalculateHeight) const
-{
- (void)rPreviewModelSize;
-
- if (mnColumnCount<=0 || mnRowCount<=0)
- return maPreferredSize;
- if ( ! (bCalculateWidth || bCalculateHeight))
- {
- OSL_ASSERT(bCalculateWidth || bCalculateHeight);
- return maPreferredSize;
- }
-
- // Calculate the width of each page object.
- Size aTargetSize (0,0);
- if (bCalculateWidth)
- aTargetSize.setWidth(
- (rWindowSize.Width() - mnLeftBorder - mnRightBorder
- - (mnColumnCount-1) * mnHorizontalGap)
- / mnColumnCount);
- else if (bCalculateHeight)
- aTargetSize.setHeight(
- (rWindowSize.Height() - mnTopBorder - mnBottomBorder
- - (mnRowCount-1) * mnVerticalGap)
- / mnRowCount);
-
- if (bCalculateWidth)
- {
- if (aTargetSize.Width() < maMinimalSize.Width())
- aTargetSize.setWidth(maMinimalSize.Width());
- else if (aTargetSize.Width() > maMaximalSize.Width())
- aTargetSize.setWidth(maMaximalSize.Width());
- }
- else if (bCalculateHeight)
- {
- if (aTargetSize.Height() < maMinimalSize.Height())
- aTargetSize.setHeight(maMinimalSize.Height());
- else if (aTargetSize.Height() > maMaximalSize.Height())
- aTargetSize.setHeight(maMaximalSize.Height());
- }
-
- return aTargetSize;
-}
-
-
-
-
-sal_Int32 Layouter::Implementation::GetIndex (
- const sal_Int32 nRow,
- const sal_Int32 nColumn,
- const bool bClampToValidRange) const
-{
- if (nRow >= 0 && nColumn >= 0)
- {
- const sal_Int32 nIndex (nRow * mnColumnCount + nColumn);
- if (nIndex >= mnPageCount)
- if (bClampToValidRange)
- return mnPageCount-1;
- else
- return -1;
- else
- return nIndex;
- }
- else if (bClampToValidRange)
- return 0;
- else
- return -1;
-}
-
-
-
-
-Rectangle Layouter::Implementation::GetPageObjectBox (
- const sal_Int32 nIndex,
- const bool bIncludeBorderAndGap) const
-{
- const sal_Int32 nRow (nIndex / mnColumnCount);
- const sal_Int32 nColumn (nIndex % mnColumnCount);
-
- const Rectangle aBoundingBox (GetPageObjectBox(nRow,nColumn));
- if (bIncludeBorderAndGap)
- return AddBorderAndGap(aBoundingBox, nRow, nColumn);
- else
- return aBoundingBox;
-}
-
-
-
-
-Rectangle Layouter::Implementation::GetPageObjectBox (
- const sal_Int32 nRow,
- const sal_Int32 nColumn) const
-{
- return Rectangle(
- Point (mnLeftBorder
- + nColumn * maPageObjectSize.Width()
- + (nColumn>0 ? nColumn : 0) * mnHorizontalGap,
- mnTopBorder
- + nRow * maPageObjectSize.Height()
- + (nRow>0 ? nRow : 0) * mnVerticalGap),
- maPageObjectSize);
-}
-
-
-
-
-
-Rectangle Layouter::Implementation::AddBorderAndGap (
- const Rectangle& rBoundingBox,
- const sal_Int32 nRow,
- const sal_Int32 nColumn) const
-{
- Rectangle aBoundingBox (rBoundingBox);
-
- if (nColumn == 0)
- aBoundingBox.Left() = 0;
- else
- aBoundingBox.Left() -= mnHorizontalGap/2;
- if (nColumn == mnColumnCount-1)
- aBoundingBox.Right() += mnRightBorder;
- else
- aBoundingBox.Right() += mnHorizontalGap/2;
- if (nRow == 0)
- aBoundingBox.Top() = 0;
- else
- aBoundingBox.Top() -= mnVerticalGap/2;
- if (nRow == mnRowCount-1)
- aBoundingBox.Bottom() += mnBottomBorder;
- else
- aBoundingBox.Bottom() += mnVerticalGap/2;
- return aBoundingBox;
-}
-
-
-
-
-Rectangle Layouter::Implementation::GetTotalBoundingBox (void) const
-{
- sal_Int32 nHorizontalSize = 0;
- sal_Int32 nVerticalSize = 0;
- if (mnColumnCount > 0)
- {
- sal_Int32 nRowCount = (mnPageCount+mnColumnCount-1) / mnColumnCount;
- nHorizontalSize =
- mnLeftBorder
- + mnRightBorder
- + mnColumnCount * maPageObjectSize.Width();
- if (mnColumnCount > 1)
- nHorizontalSize += (mnColumnCount-1) * mnHorizontalGap;
- nVerticalSize =
- mnTopBorder
- + mnBottomBorder
- + nRowCount * maPageObjectSize.Height();
- if (nRowCount > 1)
- nVerticalSize += (nRowCount-1) * mnVerticalGap;
- }
-
- return Rectangle (
- Point(0,0),
- Size (nHorizontalSize, nVerticalSize)
- );
-}
-
-
-
-
-void Layouter::Implementation::CalculateVerticalLogicalInsertPosition (
- const Point& rModelPosition,
- InsertPosition& rPosition) const
-{
- const sal_Int32 nY = rModelPosition.Y() - mnTopBorder + maPageObjectSize.Height()/2;
- const sal_Int32 nRowHeight (maPageObjectSize.Height() + mnVerticalGap);
- const sal_Int32 nRow (::std::min(mnPageCount, nY / nRowHeight));
- rPosition.SetLogicalPosition (
- nRow,
- 0,
- nRow,
- (nRow == 0),
- (nRow == mnRowCount),
- (nRow >= mnMaxRowCount));
-}
-
-
-
-
-//===== HorizontalImplementation ================================================
-
-HorizontalImplementation::HorizontalImplementation (
- const SharedSdWindow& rpWindow,
- const ::boost::shared_ptr<view::Theme>& rpTheme)
- : Implementation(rpWindow, rpTheme)
-{
-}
-
-
-
-
-HorizontalImplementation::HorizontalImplementation (const Implementation& rImplementation)
- : Implementation(rImplementation)
-{
-}
-
-
-
-
-Layouter::Orientation HorizontalImplementation::GetOrientation (void) const
-{
- return Layouter::HORIZONTAL;
-}
-
-
-
-
-void HorizontalImplementation::CalculateRowAndColumnCount (const Size& rWindowSize)
-{
- (void)rWindowSize;
-
- // Row and column count are fixed (for a given page count.)
- mnColumnCount = mnPageCount;
- mnRowCount = 1;
-}
-
-
-
-
-void HorizontalImplementation::CalculateMaxRowAndColumnCount (const Size& rWindowSize)
-{
- mnMaxColumnCount = (rWindowSize.Width() - mnLeftBorder - mnRightBorder)
- / (maPageObjectSize.Width() + mnHorizontalGap);
- mnMaxRowCount = 1;
-}
-
-
-
-
-Size HorizontalImplementation::CalculateTargetSize (
- const Size& rWindowSize,
- const Size& rPreviewModelSize) const
-{
- return Implementation::GetTargetSize(rWindowSize, rPreviewModelSize, false, true);
-}
-
-
-
-
-void HorizontalImplementation::CalculateLogicalInsertPosition (
- const Point& rModelPosition,
- InsertPosition& rPosition) const
-{
- const sal_Int32 nX = rModelPosition.X() - mnLeftBorder + maPageObjectSize.Width()/2;
- const sal_Int32 nColumnWidth (maPageObjectSize.Width() + mnHorizontalGap);
- const sal_Int32 nColumn (::std::min(mnPageCount, nX / nColumnWidth));
- rPosition.SetLogicalPosition (
- 0,
- nColumn,
- nColumn,
- (nColumn == 0),
- (nColumn == mnColumnCount),
- (nColumn >= mnMaxColumnCount));
-}
-
-
-
-
-//===== VerticalImplementation ================================================
-
-VerticalImplementation::VerticalImplementation (
- const SharedSdWindow& rpWindow,
- const ::boost::shared_ptr<view::Theme>& rpTheme)
- : Implementation(rpWindow, rpTheme)
-{
-}
-
-
-
-
-VerticalImplementation::VerticalImplementation (const Implementation& rImplementation)
- : Implementation(rImplementation)
-{
-}
-
-
-
-
-Layouter::Orientation VerticalImplementation::GetOrientation (void) const
-{
- return Layouter::VERTICAL;
-}
-
-
-
-
-void VerticalImplementation::CalculateRowAndColumnCount (const Size& rWindowSize)
-{
- (void)rWindowSize;
-
- // Row and column count are fixed (for a given page count.)
- mnRowCount = mnPageCount;
- mnColumnCount = 1;
-
-}
-
-
-
-
-void VerticalImplementation::CalculateMaxRowAndColumnCount (const Size& rWindowSize)
-{
- mnMaxRowCount = (rWindowSize.Height() - mnTopBorder - mnBottomBorder)
- / (maPageObjectSize.Height() + mnVerticalGap);
- mnMaxColumnCount = 1;
-}
-
-
-
-
-Size VerticalImplementation::CalculateTargetSize (
- const Size& rWindowSize,
- const Size& rPreviewModelSize) const
-{
- return Implementation::GetTargetSize(rWindowSize, rPreviewModelSize, true, false);
-}
-
-
-
-
-void VerticalImplementation::CalculateLogicalInsertPosition (
- const Point& rModelPosition,
- InsertPosition& rPosition) const
-{
- return CalculateVerticalLogicalInsertPosition(rModelPosition, rPosition);
-}
-
-
-
-
-//===== GridImplementation ================================================
-
-GridImplementation::GridImplementation (
- const SharedSdWindow& rpWindow,
- const ::boost::shared_ptr<view::Theme>& rpTheme)
- : Implementation(rpWindow, rpTheme)
-{
-}
-
-
-
-
-GridImplementation::GridImplementation (const Implementation& rImplementation)
- : Implementation(rImplementation)
-{
-}
-
-
-
-
-Layouter::Orientation GridImplementation::GetOrientation (void) const
-{
- return Layouter::GRID;
-}
-
-
-
-
-void GridImplementation::CalculateRowAndColumnCount (const Size& rWindowSize)
-{
- // Calculate the column count.
- mnColumnCount
- = (rWindowSize.Width() - mnRequestedLeftBorder - mnRequestedRightBorder)
- / (maPreferredSize.Width() + mnHorizontalGap);
- if (mnColumnCount < mnMinimalColumnCount)
- mnColumnCount = mnMinimalColumnCount;
- if (mnColumnCount > mnMaximalColumnCount)
- mnColumnCount = mnMaximalColumnCount;
- mnRowCount = (mnPageCount + mnColumnCount-1)/mnColumnCount;
-}
-
-
-
-
-void GridImplementation::CalculateMaxRowAndColumnCount (const Size& rWindowSize)
-{
- mnMaxColumnCount = (rWindowSize.Width() - mnLeftBorder - mnRightBorder)
- / (maPageObjectSize.Width() + mnHorizontalGap);
- mnMaxRowCount = (rWindowSize.Height() - mnTopBorder - mnBottomBorder)
- / (maPageObjectSize.Height() + mnVerticalGap);
-}
-
-
-
-
-
-Size GridImplementation::CalculateTargetSize (
- const Size& rWindowSize,
- const Size& rPreviewModelSize) const
-{
- return Implementation::GetTargetSize(rWindowSize, rPreviewModelSize, true, true);
-}
-
-
-
-
-void GridImplementation::CalculateLogicalInsertPosition (
- const Point& rModelPosition,
- InsertPosition& rPosition) const
-{
- if (mnColumnCount == 1)
- {
- CalculateVerticalLogicalInsertPosition(rModelPosition, rPosition);
- }
- else
- {
- // Handle the general case of more than one column.
- sal_Int32 nRow (::std::min(
- mnRowCount-1,
- GetRowAtPosition (rModelPosition.Y(), true, GM_BOTH)));
- const sal_Int32 nX = rModelPosition.X() - mnLeftBorder + maPageObjectSize.Width()/2;
- const sal_Int32 nColumnWidth (maPageObjectSize.Width() + mnHorizontalGap);
- sal_Int32 nColumn (::std::min(mnColumnCount, nX / nColumnWidth));
- sal_Int32 nIndex (nRow * mnColumnCount + nColumn);
- bool bIsAtRunEnd (nColumn == mnColumnCount);
-
- if (nIndex >= mnPageCount)
- {
- nIndex = mnPageCount;
- nRow = mnRowCount-1;
- nColumn = ::std::min(::std::min(mnPageCount, mnColumnCount), nColumn);
- bIsAtRunEnd = true;
- }
-
- rPosition.SetLogicalPosition (
- nRow,
- nColumn,
- nIndex,
- (nColumn == 0),
- bIsAtRunEnd,
- (nColumn >= mnMaxColumnCount));
- }
-}
-
-
-
-
-//===== InsertPosition ========================================================
-
-InsertPosition::InsertPosition (void)
- : mnRow(-1),
- mnColumn(-1),
- mnIndex(-1),
- mbIsAtRunStart(false),
- mbIsAtRunEnd(false),
- mbIsExtraSpaceNeeded(false),
- maLocation(0,0),
- maLeadingOffset(0,0),
- maTrailingOffset(0,0)
-{
-}
-
-
-
-
-InsertPosition& InsertPosition::operator= (const InsertPosition& rInsertPosition)
-{
- if (this != &rInsertPosition)
- {
- mnRow = rInsertPosition.mnRow;
- mnColumn = rInsertPosition.mnColumn;
- mnIndex = rInsertPosition.mnIndex;
- mbIsAtRunStart = rInsertPosition.mbIsAtRunStart;
- mbIsAtRunEnd = rInsertPosition.mbIsAtRunEnd;
- mbIsExtraSpaceNeeded = rInsertPosition.mbIsExtraSpaceNeeded;
- maLocation = rInsertPosition.maLocation;
- maLeadingOffset = rInsertPosition.maLeadingOffset;
- maTrailingOffset = rInsertPosition.maTrailingOffset;
- }
- return *this;
-}
-
-
-
-
-bool InsertPosition::operator== (const InsertPosition& rInsertPosition) const
-{
- // Do not compare the geometrical information (maLocation).
- return mnRow==rInsertPosition.mnRow
- && mnColumn==rInsertPosition.mnColumn
- && mnIndex==rInsertPosition.mnIndex
- && mbIsAtRunStart==rInsertPosition.mbIsAtRunStart
- && mbIsAtRunEnd==rInsertPosition.mbIsAtRunEnd
- && mbIsExtraSpaceNeeded==rInsertPosition.mbIsExtraSpaceNeeded;
-}
-
-
-
-
-bool InsertPosition::operator!= (const InsertPosition& rInsertPosition) const
-{
- return !operator==(rInsertPosition);
-}
-
-
-
-
-void InsertPosition::SetLogicalPosition (
- const sal_Int32 nRow,
- const sal_Int32 nColumn,
- const sal_Int32 nIndex,
- const bool bIsAtRunStart,
- const bool bIsAtRunEnd,
- const bool bIsExtraSpaceNeeded)
-{
- mnRow = nRow;
- mnColumn = nColumn;
- mnIndex = nIndex;
- mbIsAtRunStart = bIsAtRunStart;
- mbIsAtRunEnd = bIsAtRunEnd;
- mbIsExtraSpaceNeeded = bIsExtraSpaceNeeded;
-}
-
-
-
-
-void InsertPosition::SetGeometricalPosition(
- const Point aLocation,
- const Point aLeadingOffset,
- const Point aTrailingOffset)
-{
- maLocation = aLocation;
- maLeadingOffset = aLeadingOffset;
- maTrailingOffset = aTrailingOffset;
-}
-
-
-
-} } } // end of namespace ::sd::slidesorter::namespace
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/view/SlsPageObject.cxx b/sd/source/ui/slidesorter/view/SlsPageObject.cxx
deleted file mode 100644
index a9508e406..000000000
--- a/sd/source/ui/slidesorter/view/SlsPageObject.cxx
+++ /dev/null
@@ -1,83 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sd.hxx"
-
-#include "view/SlsPageObject.hxx"
-
-#include "model/SlsPageDescriptor.hxx"
-#include "controller/SlsPageObjectFactory.hxx"
-
-using namespace ::sdr::contact;
-using namespace ::sd::slidesorter::model;
-
-
-namespace sd { namespace slidesorter { namespace view {
-
-
-PageObject::PageObject (
- const Rectangle& rRectangle,
- SdrPage* _pPage,
- const SharedPageDescriptor& rpDescriptor)
- : SdrPageObj(rRectangle, _pPage),
- mpDescriptor(rpDescriptor)
-{
-}
-
-
-
-
-PageObject::~PageObject (void)
-{
-}
-
-
-
-
-SharedPageDescriptor PageObject::GetDescriptor (void) const
-{
- return mpDescriptor;
-}
-
-
-
-
-sdr::contact::ViewContact* PageObject::CreateObjectSpecificViewContact()
-{
- if (mpDescriptor.get() != NULL)
- return mpDescriptor->GetPageObjectFactory().CreateViewContact(this, mpDescriptor);
- else
- return NULL;
-}
-
-
-
-} } } // end of namespace ::sd::slidesorter::view
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx b/sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx
deleted file mode 100644
index 17fa4df7c..000000000
--- a/sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx
+++ /dev/null
@@ -1,287 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "precompiled_sd.hxx"
-
-#include "view/SlsPageObjectLayouter.hxx"
-
-#include "model/SlsPageDescriptor.hxx"
-#include "view/SlsFontProvider.hxx"
-#include "view/SlsTheme.hxx"
-#include "tools/IconCache.hxx"
-#include "Window.hxx"
-#include "res_bmp.hrc"
-
-namespace sd { namespace slidesorter { namespace view {
-
-namespace {
-const static sal_Int32 gnLeftPageNumberOffset = 2;
-const static sal_Int32 gnRightPageNumberOffset = 5;
-const static sal_Int32 gnOuterBorderWidth = 5;
-const static sal_Int32 gnInfoAreaMinWidth = 26;
-}
-
-PageObjectLayouter::PageObjectLayouter (
- const ::boost::shared_ptr<Theme>& rpTheme,
- const Size& rPageObjectWindowSize,
- const Size& rPageSize,
- const SharedSdWindow& rpWindow,
- const sal_Int32 nPageCount)
- : mpWindow(rpWindow),
- maPageObjectSize(rPageObjectWindowSize.Width(), rPageObjectWindowSize.Height()),
- mnModelToWindowScale(1),
- maPageObjectBoundingBox(),
- maPageNumberAreaBoundingBox(),
- maPreviewBoundingBox(),
- maTransitionEffectBoundingBox(),
- maTransitionEffectIcon(IconCache::Instance().GetIcon(BMP_FADE_EFFECT_INDICATOR)),
- mpPageNumberFont(Theme::GetFont(Theme::Font_PageNumber, *rpWindow))
-{
- const Size aPageNumberAreaSize (GetPageNumberAreaSize(nPageCount));
-
- const int nMaximumBorderWidth (gnOuterBorderWidth);
- const int nFocusIndicatorWidth (rpTheme->GetIntegerValue(Theme::Integer_FocusIndicatorWidth));
-
- maPreviewBoundingBox = CalculatePreviewBoundingBox(
- maPageObjectSize,
- Size(rPageSize.Width(), rPageSize.Height()),
- aPageNumberAreaSize.Width(),
- nFocusIndicatorWidth);
- maFocusIndicatorBoundingBox = Rectangle(Point(0,0), maPageObjectSize);
- maPageObjectBoundingBox = Rectangle(
- Point(
- nFocusIndicatorWidth,
- nFocusIndicatorWidth),
- Size(
- maPageObjectSize.Width()-2*nFocusIndicatorWidth,
- maPageObjectSize.Height()-2*nFocusIndicatorWidth));
-
- maPageNumberAreaBoundingBox = Rectangle(
- Point(
- std::max(gnLeftPageNumberOffset,
- sal_Int32(maPreviewBoundingBox.Left()
- - gnRightPageNumberOffset
- - aPageNumberAreaSize.Width())),
- nMaximumBorderWidth),
- aPageNumberAreaSize);
-
- const Size aIconSize (maTransitionEffectIcon.GetSizePixel());
- maTransitionEffectBoundingBox = Rectangle(
- Point(
- (maPreviewBoundingBox.Left() - aIconSize.Width()) / 2,
- maPreviewBoundingBox.Bottom() - aIconSize.Height()),
- aIconSize);
-}
-
-
-
-
-PageObjectLayouter::~PageObjectLayouter(void)
-{
-}
-
-
-
-
-Rectangle PageObjectLayouter::CalculatePreviewBoundingBox (
- Size& rPageObjectSize,
- const Size& rPageSize,
- const sal_Int32 nPageNumberAreaWidth,
- const sal_Int32 nFocusIndicatorWidth)
-{
- const sal_Int32 nIconWidth (maTransitionEffectIcon.GetSizePixel().Width());
- const sal_Int32 nLeftAreaWidth (
- ::std::max(
- gnInfoAreaMinWidth,
- gnRightPageNumberOffset
- + ::std::max(
- nPageNumberAreaWidth,
- nIconWidth)));
- sal_Int32 nPreviewWidth;
- sal_Int32 nPreviewHeight;
- const double nPageAspectRatio (double(rPageSize.Width()) / double(rPageSize.Height()));
- if (rPageObjectSize.Height() == 0)
- {
- // Calculate height so that the preview fills the available
- // horizontal space completely while observing the aspect ratio of
- // the preview.
- nPreviewWidth = rPageObjectSize.Width()
- - nLeftAreaWidth - gnOuterBorderWidth - 2*nFocusIndicatorWidth - 1;
- nPreviewHeight = ::basegfx::fround(nPreviewWidth / nPageAspectRatio);
- rPageObjectSize.setHeight(nPreviewHeight + 2*gnOuterBorderWidth + 2*nFocusIndicatorWidth + 1);
- }
- else if (rPageObjectSize.Width() == 0)
- {
- // Calculate the width of the page object so that the preview fills
- // the available vertical space completely while observing the
- // aspect ratio of the preview.
- nPreviewHeight = rPageObjectSize.Height() - 2*gnOuterBorderWidth - 2*nFocusIndicatorWidth - 1;
- nPreviewWidth = ::basegfx::fround(nPreviewHeight * nPageAspectRatio);
- rPageObjectSize.setWidth(nPreviewWidth
- + nLeftAreaWidth + gnOuterBorderWidth + 2*nFocusIndicatorWidth + 1);
-
- }
- else
- {
- // The size of the page object is given. Calculate the size of the
- // preview.
- nPreviewWidth = rPageObjectSize.Width()
- - nLeftAreaWidth - gnOuterBorderWidth - 2*nFocusIndicatorWidth - 1;
- nPreviewHeight = rPageObjectSize.Height()
- - gnOuterBorderWidth - 2*nFocusIndicatorWidth - 1;
- if (double(nPreviewWidth)/double(nPreviewHeight) > nPageAspectRatio)
- nPreviewWidth = ::basegfx::fround(nPreviewHeight * nPageAspectRatio);
- else
- nPreviewHeight = ::basegfx::fround(nPreviewWidth / nPageAspectRatio);
- }
- // When the preview does not fill the available space completely then
- // place it flush right and vertically centered.
- const int nLeft (rPageObjectSize.Width()
- - gnOuterBorderWidth - nPreviewWidth - nFocusIndicatorWidth - 1);
- const int nTop ((rPageObjectSize.Height() - nPreviewHeight)/2);
- return Rectangle(
- nLeft,
- nTop,
- nLeft + nPreviewWidth,
- nTop + nPreviewHeight);
-}
-
-
-
-
-Rectangle PageObjectLayouter::GetBoundingBox (
- const model::SharedPageDescriptor& rpPageDescriptor,
- const Part ePart,
- const CoordinateSystem eCoordinateSystem)
-{
- OSL_ASSERT(rpPageDescriptor);
- Point aLocation (rpPageDescriptor ? rpPageDescriptor->GetLocation() : Point(0,0));
- return GetBoundingBox(aLocation, ePart, eCoordinateSystem);
-}
-
-
-
-
-Rectangle PageObjectLayouter::GetBoundingBox (
- const Point& rPageObjectLocation,
- const Part ePart,
- const CoordinateSystem eCoordinateSystem)
-{
- Rectangle aBoundingBox;
- switch (ePart)
- {
- case FocusIndicator:
- aBoundingBox = maFocusIndicatorBoundingBox;
- break;
-
- case PageObject:
- case MouseOverIndicator:
- aBoundingBox = maPageObjectBoundingBox;
- break;
-
- case Preview:
- aBoundingBox = maPreviewBoundingBox;
- break;
-
- case PageNumber:
- aBoundingBox = maPageNumberAreaBoundingBox;
- break;
-
- case Name:
- aBoundingBox = maPageNumberAreaBoundingBox;
- break;
-
- case TransitionEffectIndicator:
- aBoundingBox = maTransitionEffectBoundingBox;
- break;
- }
-
- // Adapt coordinates to the requested coordinate system.
- Point aLocation (rPageObjectLocation);
- if (eCoordinateSystem == WindowCoordinateSystem)
- aLocation += mpWindow->GetMapMode().GetOrigin();
-
- return Rectangle(
- aBoundingBox.TopLeft() + aLocation,
- aBoundingBox.BottomRight() + aLocation);
-}
-
-
-
-
-Size PageObjectLayouter::GetSize (
- const Part ePart,
- const CoordinateSystem eCoordinateSystem)
-{
- return GetBoundingBox(Point(0,0), ePart, eCoordinateSystem).GetSize();
-}
-
-
-
-
-Size PageObjectLayouter::GetPageNumberAreaSize (const int nPageCount)
-{
- OSL_ASSERT(mpWindow);
-
- // Set the correct font.
- Font aOriginalFont (mpWindow->GetFont());
- if (mpPageNumberFont)
- mpWindow->SetFont(*mpPageNumberFont);
-
- String sPageNumberTemplate;
- if (nPageCount < 10)
- sPageNumberTemplate = String::CreateFromAscii("9");
- else if (nPageCount < 100)
- sPageNumberTemplate = String::CreateFromAscii("99");
- else if (nPageCount < 200)
- // Just for the case that 1 is narrower than 9.
- sPageNumberTemplate = String::CreateFromAscii("199");
- else if (nPageCount < 1000)
- sPageNumberTemplate = String::CreateFromAscii("999");
- else
- sPageNumberTemplate = String::CreateFromAscii("9999");
- // More then 9999 pages are not handled.
-
- const Size aSize (
- mpWindow->GetTextWidth(sPageNumberTemplate),
- mpWindow->GetTextHeight());
-
- mpWindow->SetFont(aOriginalFont);
-
- return aSize;
-}
-
-
-
-
-Image PageObjectLayouter::GetTransitionEffectIcon (void) const
-{
- return maTransitionEffectIcon;
-}
-
-
-} } } // end of namespace ::sd::slidesorter::view
diff --git a/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx b/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx
deleted file mode 100644
index d4fb96697..000000000
--- a/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx
+++ /dev/null
@@ -1,584 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "precompiled_sd.hxx"
-
-#include "view/SlsPageObjectPainter.hxx"
-
-#include "model/SlsPageDescriptor.hxx"
-#include "view/SlideSorterView.hxx"
-#include "view/SlsPageObjectLayouter.hxx"
-#include "view/SlsLayouter.hxx"
-#include "view/SlsTheme.hxx"
-#include "view/SlsButtonBar.hxx"
-#include "SlsFramePainter.hxx"
-#include "cache/SlsPageCache.hxx"
-#include "controller/SlsProperties.hxx"
-#include "Window.hxx"
-#include "sdpage.hxx"
-#include "sdresid.hxx"
-#include <vcl/svapp.hxx>
-#include <vcl/vclenum.hxx>
-#include <vcl/virdev.hxx>
-#include <boost/scoped_ptr.hpp>
-
-using namespace ::drawinglayer::primitive2d;
-
-namespace sd { namespace slidesorter { namespace view {
-
-namespace {
-
-sal_uInt8 Blend (
- const sal_uInt8 nValue1,
- const sal_uInt8 nValue2,
- const double nWeight)
-{
- const double nValue (nValue1*(1-nWeight) + nValue2 * nWeight);
- if (nValue < 0)
- return 0;
- else if (nValue > 255)
- return 255;
- else
- return (sal_uInt8)nValue;
-}
-
-sal_uInt8 ClampColorChannel (const double nValue)
-{
- if (nValue <= 0)
- return 0;
- else if (nValue >= 255)
- return 255;
- else
- return sal_uInt8(nValue);
-}
-
-sal_uInt8 CalculateColorChannel(
- const double nColor1,
- const double nColor2,
- const double nAlpha1,
- const double nAlpha2,
- const double nAlpha0)
-{
- if (nAlpha0 == 0)
- return 0;
-
- const double nColor0 ((nAlpha1*nColor1 + nAlpha1*nAlpha2*nColor1 + nAlpha2*nColor2) / nAlpha0);
- return ClampColorChannel(255 * nColor0);
-}
-
-} // end of anonymous namespace
-
-
-
-
-//===== PageObjectPainter =====================================================
-
-PageObjectPainter::PageObjectPainter (
- const SlideSorter& rSlideSorter)
- : mrLayouter(rSlideSorter.GetView().GetLayouter()),
- mpPageObjectLayouter(),
- mpCache(rSlideSorter.GetView().GetPreviewCache()),
- mpProperties(rSlideSorter.GetProperties()),
- mpTheme(rSlideSorter.GetTheme()),
- mpPageNumberFont(Theme::GetFont(Theme::Font_PageNumber, *rSlideSorter.GetContentWindow())),
- mpShadowPainter(new FramePainter(mpTheme->GetIcon(Theme::Icon_RawShadow))),
- mpFocusBorderPainter(new FramePainter(mpTheme->GetIcon(Theme::Icon_FocusBorder))),
- maNormalBackground(),
- maSelectionBackground(),
- maFocusedSelectionBackground(),
- maMouseOverBackground(),
- maMouseOverFocusedBackground(),
- msUnhideString(mpTheme->GetString(Theme::String_Unhide)),
- mrButtonBar(rSlideSorter.GetView().GetButtonBar())
-{
- // Replace the color (not the alpha values) in the focus border with a
- // color derived from the current selection color.
- Color aColor (mpTheme->GetColor(Theme::Color_Selection));
- sal_uInt16 nHue, nSat, nBri;
- aColor.RGBtoHSB(nHue, nSat, nBri);
- aColor = Color::HSBtoRGB(nHue, 28, 65);
- mpFocusBorderPainter->AdaptColor(aColor, true);
-}
-
-
-
-
-PageObjectPainter::~PageObjectPainter (void)
-{
-}
-
-
-
-
-void PageObjectPainter::PaintPageObject (
- OutputDevice& rDevice,
- const model::SharedPageDescriptor& rpDescriptor)
-{
- // The page object layouter is quite volatile. It may have been replaced
- // since the last call. Update it now.
- mpPageObjectLayouter = mrLayouter.GetPageObjectLayouter();
- if ( ! mpPageObjectLayouter)
- {
- OSL_ASSERT(mpPageObjectLayouter);
- return;
- }
-
- // Turn off antialiasing to avoid the bitmaps from being shifted by
- // fractions of a pixel and thus show blurry edges.
- const sal_uInt16 nSavedAntialiasingMode (rDevice.GetAntialiasing());
- rDevice.SetAntialiasing(nSavedAntialiasingMode & ~ANTIALIASING_ENABLE_B2DDRAW);
-
- PaintBackground(rDevice, rpDescriptor);
- PaintPreview(rDevice, rpDescriptor);
- PaintPageNumber(rDevice, rpDescriptor);
- PaintTransitionEffect(rDevice, rpDescriptor);
- mrButtonBar.Paint(rDevice, rpDescriptor);
-
- rDevice.SetAntialiasing(nSavedAntialiasingMode);
-}
-
-
-
-
-void PageObjectPainter::NotifyResize (const bool bForce)
-{
- (void)bForce;
- maNormalBackground.SetEmpty();
- maSelectionBackground.SetEmpty();
- maFocusedSelectionBackground.SetEmpty();
- maFocusedBackground.SetEmpty();
- maMouseOverBackground.SetEmpty();
- maMouseOverFocusedBackground.SetEmpty();
- maMouseOverSelectedAndFocusedBackground.SetEmpty();
-}
-
-
-
-
-void PageObjectPainter::SetTheme (const ::boost::shared_ptr<view::Theme>& rpTheme)
-{
- mpTheme = rpTheme;
- NotifyResize(true);
-}
-
-
-
-
-void PageObjectPainter::PaintBackground (
- OutputDevice& rDevice,
- const model::SharedPageDescriptor& rpDescriptor)
-{
- const Rectangle aBox (mpPageObjectLayouter->GetBoundingBox(
- rpDescriptor,
- PageObjectLayouter::FocusIndicator,
- PageObjectLayouter::ModelCoordinateSystem));
-
- const Bitmap& rBackground (GetBackgroundForState(rpDescriptor, rDevice));
- rDevice.DrawBitmap(aBox.TopLeft(), rBackground);
-
- // Fill the interior of the preview area with the default background
- // color of the page.
- SdPage* pPage = rpDescriptor->GetPage();
- if (pPage != NULL)
- {
- rDevice.SetFillColor(pPage->GetPageBackgroundColor(NULL));
- rDevice.SetLineColor(pPage->GetPageBackgroundColor(NULL));
- const Rectangle aPreviewBox (mpPageObjectLayouter->GetBoundingBox(
- rpDescriptor,
- PageObjectLayouter::Preview,
- PageObjectLayouter::ModelCoordinateSystem));
- rDevice.DrawRect(aPreviewBox);
- }
-}
-
-
-
-
-void PageObjectPainter::PaintPreview (
- OutputDevice& rDevice,
- const model::SharedPageDescriptor& rpDescriptor) const
-{
- const Rectangle aBox (mpPageObjectLayouter->GetBoundingBox(
- rpDescriptor,
- PageObjectLayouter::Preview,
- PageObjectLayouter::ModelCoordinateSystem));
-
- if (mpCache != NULL)
- {
- const SdrPage* pPage = rpDescriptor->GetPage();
- mpCache->SetPreciousFlag(pPage, true);
-
- const Bitmap aPreview (GetPreviewBitmap(rpDescriptor, &rDevice));
- if ( ! aPreview.IsEmpty())
- {
- if (aPreview.GetSizePixel() != aBox.GetSize())
- rDevice.DrawBitmap(aBox.TopLeft(), aBox.GetSize(), aPreview);
- else
- rDevice.DrawBitmap(aBox.TopLeft(), aPreview);
- }
- }
-}
-
-
-
-
-Bitmap PageObjectPainter::CreateMarkedPreview (
- const Size& rSize,
- const Bitmap& rPreview,
- const BitmapEx& rOverlay,
- const OutputDevice* pReferenceDevice) const
-{
- ::boost::scoped_ptr<VirtualDevice> pDevice;
- if (pReferenceDevice != NULL)
- pDevice.reset(new VirtualDevice(*pReferenceDevice));
- else
- pDevice.reset(new VirtualDevice());
- pDevice->SetOutputSizePixel(rSize);
-
- pDevice->DrawBitmap(Point(0,0), rSize, rPreview);
-
- // Paint bitmap tiled over the preview to mark it as excluded.
- const sal_Int32 nIconWidth (rOverlay.GetSizePixel().Width());
- const sal_Int32 nIconHeight (rOverlay.GetSizePixel().Height());
- if (nIconWidth>0 && nIconHeight>0)
- {
- for (sal_Int32 nX=0; nX<rSize.Width(); nX+=nIconWidth)
- for (sal_Int32 nY=0; nY<rSize.Height(); nY+=nIconHeight)
- pDevice->DrawBitmapEx(Point(nX,nY), rOverlay);
- }
- return pDevice->GetBitmap(Point(0,0), rSize);
-}
-
-
-
-
-Bitmap PageObjectPainter::GetPreviewBitmap (
- const model::SharedPageDescriptor& rpDescriptor,
- const OutputDevice* pReferenceDevice) const
-{
- const SdrPage* pPage = rpDescriptor->GetPage();
- const bool bIsExcluded (rpDescriptor->HasState(model::PageDescriptor::ST_Excluded));
-
- if (bIsExcluded)
- {
- Bitmap aMarkedPreview (mpCache->GetMarkedPreviewBitmap(pPage,false));
- const Rectangle aPreviewBox (mpPageObjectLayouter->GetBoundingBox(
- rpDescriptor,
- PageObjectLayouter::Preview,
- PageObjectLayouter::ModelCoordinateSystem));
- if (aMarkedPreview.IsEmpty() || aMarkedPreview.GetSizePixel()!=aPreviewBox.GetSize())
- {
- aMarkedPreview = CreateMarkedPreview(
- aPreviewBox.GetSize(),
- mpCache->GetPreviewBitmap(pPage,true),
- mpTheme->GetIcon(Theme::Icon_HideSlideOverlay),
- pReferenceDevice);
- mpCache->SetMarkedPreviewBitmap(pPage, aMarkedPreview);
- }
- return aMarkedPreview;
- }
- else
- {
- return mpCache->GetPreviewBitmap(pPage,false);
- }
-}
-
-
-
-
-void PageObjectPainter::PaintPageNumber (
- OutputDevice& rDevice,
- const model::SharedPageDescriptor& rpDescriptor) const
-{
- const Rectangle aBox (mpPageObjectLayouter->GetBoundingBox(
- rpDescriptor,
- PageObjectLayouter::PageNumber,
- PageObjectLayouter::ModelCoordinateSystem));
-
- // Determine the color of the page number.
- Color aPageNumberColor (mpTheme->GetColor(Theme::Color_PageNumberDefault));
- if (rpDescriptor->HasState(model::PageDescriptor::ST_MouseOver) ||
- rpDescriptor->HasState(model::PageDescriptor::ST_Selected))
- {
- // Page number is painted on background for hover or selection or
- // both. Each of these background colors has a predefined luminance
- // which is compatible with the PageNumberHover color.
- aPageNumberColor = Color(mpTheme->GetColor(Theme::Color_PageNumberHover));
- }
- else
- {
- const Color aBackgroundColor (mpTheme->GetColor(Theme::Color_Background));
- const sal_Int32 nBackgroundLuminance (aBackgroundColor.GetLuminance());
- // When the background color is black then this is interpreted as
- // high contrast mode and the font color is set to white.
- if (nBackgroundLuminance == 0)
- aPageNumberColor = Color(mpTheme->GetColor(Theme::Color_PageNumberHighContrast));
- else
- {
- // Compare luminance of default page number color and background
- // color. When the two are similar then use a darker
- // (preferred) or brighter font color.
- const sal_Int32 nFontLuminance (aPageNumberColor.GetLuminance());
- if (abs(nBackgroundLuminance - nFontLuminance) < 60)
- {
- if (nBackgroundLuminance > nFontLuminance-30)
- aPageNumberColor = Color(mpTheme->GetColor(Theme::Color_PageNumberBrightBackground));
- else
- aPageNumberColor = Color(mpTheme->GetColor(Theme::Color_PageNumberDarkBackground));
- }
- }
- }
-
- // Paint the page number.
- OSL_ASSERT(rpDescriptor->GetPage()!=NULL);
- const sal_Int32 nPageNumber ((rpDescriptor->GetPage()->GetPageNum() - 1) / 2 + 1);
- const String sPageNumber (String::CreateFromInt32(nPageNumber));
- rDevice.SetFont(*mpPageNumberFont);
- rDevice.SetTextColor(aPageNumberColor);
- rDevice.DrawText(aBox, sPageNumber, TEXT_DRAW_RIGHT | TEXT_DRAW_VCENTER);
-}
-
-
-
-
-void PageObjectPainter::PaintTransitionEffect (
- OutputDevice& rDevice,
- const model::SharedPageDescriptor& rpDescriptor) const
-{
- const SdPage* pPage = rpDescriptor->GetPage();
- if (pPage!=NULL && pPage->getTransitionType() > 0)
- {
- const Rectangle aBox (mpPageObjectLayouter->GetBoundingBox(
- rpDescriptor,
- PageObjectLayouter::TransitionEffectIndicator,
- PageObjectLayouter::ModelCoordinateSystem));
-
- rDevice.DrawBitmapEx(
- aBox.TopLeft(),
- mpPageObjectLayouter->GetTransitionEffectIcon().GetBitmapEx());
- }
-}
-
-
-
-
-Bitmap& PageObjectPainter::GetBackgroundForState (
- const model::SharedPageDescriptor& rpDescriptor,
- const OutputDevice& rReferenceDevice)
-{
- enum State { None = 0x00, Selected = 0x01, MouseOver = 0x02, Focused = 0x04 };
- const int eState =
- (rpDescriptor->HasState(model::PageDescriptor::ST_Selected) ? Selected : None)
- | (rpDescriptor->HasState(model::PageDescriptor::ST_MouseOver) ? MouseOver : None)
- | (rpDescriptor->HasState(model::PageDescriptor::ST_Focused) ? Focused : None);
-
- switch (eState)
- {
- case MouseOver | Selected | Focused:
- return GetBackground(
- maMouseOverSelectedAndFocusedBackground,
- Theme::Gradient_MouseOverSelectedAndFocusedPage,
- rReferenceDevice,
- true);
-
- case MouseOver | Selected:
- case MouseOver:
- return GetBackground(
- maMouseOverBackground,
- Theme::Gradient_MouseOverPage,
- rReferenceDevice,
- false);
-
- case MouseOver | Focused:
- return GetBackground(
- maMouseOverFocusedBackground,
- Theme::Gradient_MouseOverPage,
- rReferenceDevice,
- true);
-
- case Selected | Focused:
- return GetBackground(
- maFocusedSelectionBackground,
- Theme::Gradient_SelectedAndFocusedPage,
- rReferenceDevice,
- true);
-
- case Selected:
- return GetBackground(
- maSelectionBackground,
- Theme::Gradient_SelectedPage,
- rReferenceDevice,
- false);
-
- case Focused:
- return GetBackground(
- maFocusedBackground,
- Theme::Gradient_FocusedPage,
- rReferenceDevice,
- true);
-
- case None:
- default:
- return GetBackground(
- maNormalBackground,
- Theme::Gradient_NormalPage,
- rReferenceDevice,
- false);
- }
-}
-
-
-
-
-Bitmap& PageObjectPainter::GetBackground(
- Bitmap& rBackground,
- Theme::GradientColorType eType,
- const OutputDevice& rReferenceDevice,
- const bool bHasFocusBorder)
-{
- if (rBackground.IsEmpty())
- rBackground = CreateBackgroundBitmap(rReferenceDevice, eType, bHasFocusBorder);
- return rBackground;
-}
-
-
-
-
-Bitmap PageObjectPainter::CreateBackgroundBitmap(
- const OutputDevice& rReferenceDevice,
- const Theme::GradientColorType eColorType,
- const bool bHasFocusBorder) const
-{
- const Size aSize (mpPageObjectLayouter->GetSize(
- PageObjectLayouter::FocusIndicator,
- PageObjectLayouter::WindowCoordinateSystem));
- const Rectangle aPageObjectBox (mpPageObjectLayouter->GetBoundingBox(
- Point(0,0),
- PageObjectLayouter::PageObject,
- PageObjectLayouter::ModelCoordinateSystem));
- VirtualDevice aBitmapDevice (rReferenceDevice);
- aBitmapDevice.SetOutputSizePixel(aSize);
-
- // Fill the background with the background color of the slide sorter.
- const Color aBackgroundColor (mpTheme->GetColor(Theme::Color_Background));
- OSL_TRACE("filling background of page object bitmap with color %x", aBackgroundColor.GetColor());
- aBitmapDevice.SetFillColor(aBackgroundColor);
- aBitmapDevice.SetLineColor(aBackgroundColor);
- aBitmapDevice.DrawRect(Rectangle(Point(0,0), aSize));
-
- // Paint the slide area with a linear gradient that starts some pixels
- // below the top and ends some pixels above the bottom.
- const Color aTopColor(mpTheme->GetGradientColor(eColorType, Theme::Fill1));
- const Color aBottomColor(mpTheme->GetGradientColor(eColorType, Theme::Fill2));
- if (aTopColor != aBottomColor)
- {
- const sal_Int32 nHeight (aPageObjectBox.GetHeight());
- const sal_Int32 nDefaultConstantSize(nHeight/4);
- const sal_Int32 nMinimalGradientSize(40);
- const sal_Int32 nY1 (
- ::std::max<sal_Int32>(
- 0,
- ::std::min<sal_Int32>(
- nDefaultConstantSize,
- (nHeight - nMinimalGradientSize)/2)));
- const sal_Int32 nY2 (nHeight-nY1);
- const sal_Int32 nTop (aPageObjectBox.Top());
- for (sal_Int32 nY=0; nY<nHeight; ++nY)
- {
- if (nY<=nY1)
- aBitmapDevice.SetLineColor(aTopColor);
- else if (nY>=nY2)
- aBitmapDevice.SetLineColor(aBottomColor);
- else
- {
- Color aColor (aTopColor);
- aColor.Merge(aBottomColor, 255 * (nY2-nY) / (nY2-nY1));
- aBitmapDevice.SetLineColor(aColor);
- }
- aBitmapDevice.DrawLine(
- Point(aPageObjectBox.Left(), nY+nTop),
- Point(aPageObjectBox.Right(), nY+nTop));
- }
- }
- else
- {
- aBitmapDevice.SetFillColor(aTopColor);
- aBitmapDevice.DrawRect(aPageObjectBox);
- }
-
- // Paint the simple border and, for some backgrounds, the focus border.
- if (bHasFocusBorder)
- mpFocusBorderPainter->PaintFrame(aBitmapDevice, aPageObjectBox);
- else
- PaintBorder(aBitmapDevice, eColorType, aPageObjectBox);
-
- // Get bounding box of the preview around which a shadow is painted.
- // Compensate for the border around the preview.
- const Rectangle aBox (mpPageObjectLayouter->GetBoundingBox(
- Point(0,0),
- PageObjectLayouter::Preview,
- PageObjectLayouter::ModelCoordinateSystem));
- Rectangle aFrameBox (aBox.Left()-1,aBox.Top()-1,aBox.Right()+1,aBox.Bottom()+1);
- mpShadowPainter->PaintFrame(aBitmapDevice, aFrameBox);
-
- return aBitmapDevice.GetBitmap (Point(0,0),aSize);
-}
-
-
-
-
-void PageObjectPainter::PaintBorder (
- OutputDevice& rDevice,
- const Theme::GradientColorType eColorType,
- const Rectangle& rBox) const
-{
- rDevice.SetFillColor();
- const sal_Int32 nBorderWidth (1);
- for (int nIndex=0; nIndex<nBorderWidth; ++nIndex)
- {
- const int nDelta (nIndex);
- rDevice.SetLineColor(mpTheme->GetGradientColor(eColorType, Theme::Border2));
- rDevice.DrawLine(
- Point(rBox.Left()-nDelta, rBox.Top()-nDelta),
- Point(rBox.Left()-nDelta, rBox.Bottom()+nDelta));
- rDevice.DrawLine(
- Point(rBox.Left()-nDelta, rBox.Bottom()+nDelta),
- Point(rBox.Right()+nDelta, rBox.Bottom()+nDelta));
- rDevice.DrawLine(
- Point(rBox.Right()+nDelta, rBox.Bottom()+nDelta),
- Point(rBox.Right()+nDelta, rBox.Top()-nDelta));
-
- rDevice.SetLineColor(mpTheme->GetGradientColor(eColorType, Theme::Border1));
- rDevice.DrawLine(
- Point(rBox.Left()-nDelta, rBox.Top()-nDelta),
- Point(rBox.Right()+nDelta, rBox.Top()-nDelta));
- }
-}
-
-
-
-} } } // end of namespace sd::slidesorter::view
diff --git a/sd/source/ui/slidesorter/view/SlsResource.hxx b/sd/source/ui/slidesorter/view/SlsResource.hxx
deleted file mode 100644
index bdbb819ba..000000000
--- a/sd/source/ui/slidesorter/view/SlsResource.hxx
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef SD_SLIDESORTER_RESOURCE_HXX
-#define SD_SLIDESORTER_RESOURCE_HXX
-
-#include "view/SlsResource.hrc"
-#include "sdresid.hxx"
-#include <tools/rc.hxx>
-
-namespace sd { namespace slidesorter { namespace view {
-
-class LocalResource : public Resource
-{
-public:
- LocalResource (const sal_uInt16 nResourceId) : Resource(SdResId(nResourceId)){}
- ~LocalResource (void) { FreeResource(); }
-};
-
-
-} } } // end of namespace ::sd::slidesorter::view
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/view/SlsResource.src b/sd/source/ui/slidesorter/view/SlsResource.src
deleted file mode 100644
index 984cff779..000000000
--- a/sd/source/ui/slidesorter/view/SlsResource.src
+++ /dev/null
@@ -1,314 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "view/SlsResource.hrc"
-
-Resource RID_SLIDESORTER_ICONS
-{
- Image IMAGE_COMMAND1_LARGE
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command1_large.png" ; };
- };
- Image IMAGE_COMMAND1_LARGE_HOVER
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command1_large_hover.png" ; };
- };
- Image IMAGE_COMMAND1_MEDIUM
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command1_medium.png" ; };
- };
- Image IMAGE_COMMAND1_MEDIUM_HOVER
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command1_medium_hover.png" ; };
- };
- Image IMAGE_COMMAND1_SMALL
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command1_small.png" ; };
- };
- Image IMAGE_COMMAND1_SMALL_HOVER
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command1_small_hover.png" ; };
- };
-
- Image IMAGE_COMMAND1_LARGE_HC
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command1_large_hc.png" ; };
- };
- Image IMAGE_COMMAND1_LARGE_HOVER_HC
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command1_large_hover_hc.png" ; };
- };
- Image IMAGE_COMMAND1_MEDIUM_HC
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command1_medium_hc.png" ; };
- };
- Image IMAGE_COMMAND1_MEDIUM_HOVER_HC
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command1_medium_hover_hc.png" ; };
- };
- Image IMAGE_COMMAND1_SMALL_HC
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command1_small_hc.png" ; };
- };
- Image IMAGE_COMMAND1_SMALL_HOVER_HC
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command1_small_hover_hc.png" ; };
- };
-
-
- Image IMAGE_COMMAND2_LARGE
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command2_large.png" ; };
- };
- Image IMAGE_COMMAND2_LARGE_HOVER
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command2_large_hover.png" ; };
- };
- Image IMAGE_COMMAND2_MEDIUM
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command2_medium.png" ; };
- };
- Image IMAGE_COMMAND2_MEDIUM_HOVER
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command2_medium_hover.png" ; };
- };
- Image IMAGE_COMMAND2_SMALL
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command2_small.png" ; };
- };
- Image IMAGE_COMMAND2_SMALL_HOVER
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command2_small_hover.png" ; };
- };
-
- Image IMAGE_COMMAND2_LARGE_HC
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command2_large_hc.png" ; };
- };
- Image IMAGE_COMMAND2_LARGE_HOVER_HC
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command2_large_hover_hc.png" ; };
- };
- Image IMAGE_COMMAND2_MEDIUM_HC
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command2_medium_hc.png" ; };
- };
- Image IMAGE_COMMAND2_MEDIUM_HOVER_HC
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command2_medium_hover_hc.png" ; };
- };
- Image IMAGE_COMMAND2_SMALL_HC
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command2_small_hc.png" ; };
- };
- Image IMAGE_COMMAND2_SMALL_HOVER_HC
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command2_small_hover_hc.png" ; };
- };
-
-
- Image IMAGE_COMMAND2B_LARGE
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command2b_large.png" ; };
- };
- Image IMAGE_COMMAND2B_LARGE_HOVER
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command2b_large_hover.png" ; };
- };
- Image IMAGE_COMMAND2B_MEDIUM
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command2b_medium.png" ; };
- };
- Image IMAGE_COMMAND2B_MEDIUM_HOVER
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command2b_medium_hover.png" ; };
- };
- Image IMAGE_COMMAND2B_SMALL
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command2b_small.png" ; };
- };
- Image IMAGE_COMMAND2B_SMALL_HOVER
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command2b_small_hover.png" ; };
- };
-
- Image IMAGE_COMMAND2B_LARGE_HC
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command2b_large_hc.png" ; };
- };
- Image IMAGE_COMMAND2B_LARGE_HOVER_HC
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command2b_large_hover_hc.png" ; };
- };
- Image IMAGE_COMMAND2B_MEDIUM_HC
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command2b_medium_hc.png" ; };
- };
- Image IMAGE_COMMAND2B_MEDIUM_HOVER_HC
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command2b_medium_hover_hc.png" ; };
- };
- Image IMAGE_COMMAND2B_SMALL_HC
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command2b_small_hc.png" ; };
- };
- Image IMAGE_COMMAND2B_SMALL_HOVER_HC
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command2b_small_hover_hc.png" ; };
- };
-
-
- Image IMAGE_COMMAND3_LARGE
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command3_large.png" ; };
- };
- Image IMAGE_COMMAND3_LARGE_HOVER
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command3_large_hover.png" ; };
- };
- Image IMAGE_COMMAND3_MEDIUM
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command3_medium.png" ; };
- };
- Image IMAGE_COMMAND3_MEDIUM_HOVER
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command3_medium_hover.png" ; };
- };
- Image IMAGE_COMMAND3_SMALL
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command3_small.png" ; };
- };
- Image IMAGE_COMMAND3_SMALL_HOVER
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command3_small_hover.png" ; };
- };
-
- Image IMAGE_COMMAND3_LARGE_HC
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command3_large_hc.png" ; };
- };
- Image IMAGE_COMMAND3_LARGE_HOVER_HC
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command3_large_hover_hc.png" ; };
- };
- Image IMAGE_COMMAND3_MEDIUM_HC
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command3_medium_hc.png" ; };
- };
- Image IMAGE_COMMAND3_MEDIUM_HOVER_HC
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command3_medium_hover_hc.png" ; };
- };
- Image IMAGE_COMMAND3_SMALL_HC
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command3_small_hc.png" ; };
- };
- Image IMAGE_COMMAND3_SMALL_HOVER_HC
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command3_small_hover_hc.png" ; };
- };
-
-
- Image IMAGE_BUTTONBAR_LARGE
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command_background_large.png" ; };
- };
- Image IMAGE_BUTTONBAR_MEDIUM
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command_background_medium.png" ; };
- };
- Image IMAGE_BUTTONBAR_SMALL
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command_background_small.png" ; };
- };
-
- Image IMAGE_BUTTONBAR_LARGE_HC
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command_background_large_hc.png" ; };
- };
- Image IMAGE_BUTTONBAR_MEDIUM_HC
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command_background_medium_hc.png" ; };
- };
- Image IMAGE_BUTTONBAR_SMALL_HC
- {
- ImageBitmap = Bitmap { File = "slide_sorter_command_background_small_hc.png" ; };
- };
-
-
-
- Image IMAGE_SHADOW
- {
- ImageBitmap = Bitmap { File = "slide_sorter_shadow.png" ; };
- };
-
- Image IMAGE_INSERT_SHADOW
- {
- ImageBitmap = Bitmap { File = "slide_sorter_insert_shadow.png" ; };
- };
-
- Image IMAGE_HIDE_SLIDE_OVERLAY
- {
- ImageBitmap = Bitmap { File = "slide_sorter_hide_slide_overlay.png" ; };
- };
-
- Image IMAGE_FOCUS_BORDER
- {
- ImageBitmap = Bitmap { File = "slide_sorter_focus_border.png" ; };
- };
-
-
- String STRING_DRAG_AND_DROP_PAGES
- {
- Text [ en-US ] = "Drag and Drop Pages" ;
- };
-
- String STRING_DRAG_AND_DROP_SLIDES
- {
- Text [ en-US ] = "Drag and Drop Slides" ;
- };
-
- String STRING_COMMAND1
- {
- Text [ en-US ] = "Start Slide Show" ;
- };
-
- String STRING_COMMAND2_A
- {
- Text [ en-US ] = "Hide Slide" ;
- };
-
- String STRING_COMMAND2_B
- {
- Text [ en-US ] = "Show Slide" ;
- };
-
- String STRING_COMMAND3
- {
- Text [ en-US ] = "Duplicate Slide" ;
- };
-};
diff --git a/sd/source/ui/slidesorter/view/SlsTheme.cxx b/sd/source/ui/slidesorter/view/SlsTheme.cxx
deleted file mode 100644
index f68ba3208..000000000
--- a/sd/source/ui/slidesorter/view/SlsTheme.cxx
+++ /dev/null
@@ -1,536 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "precompiled_sd.hxx"
-
-#include "view/SlsTheme.hxx"
-#include "SlsResource.hxx"
-#include "controller/SlsProperties.hxx"
-#include "sdresid.hxx"
-#include <tools/color.hxx>
-#include <vcl/outdev.hxx>
-#include <vcl/image.hxx>
-#include <vcl/svapp.hxx>
-#include <svtools/colorcfg.hxx>
-
-namespace sd { namespace slidesorter { namespace view {
-
-const static ColorData Black = 0x000000;
-const static ColorData White = 0xffffff;
-
-
-
-ColorData ChangeLuminance (const ColorData aColorData, const int nValue)
-{
- Color aColor (aColorData);
- if (nValue > 0)
- aColor.IncreaseLuminance(nValue);
- else
- aColor.DecreaseLuminance(-nValue);
- return aColor.GetColor();
-}
-
-ColorData HGBAdapt (
- const ColorData aColorData,
- const sal_Int32 nNewSaturation,
- const sal_Int32 nNewBrightness)
-{
- sal_uInt16 nHue (0);
- sal_uInt16 nSaturation (0);
- sal_uInt16 nBrightness (0);
- Color(aColorData).RGBtoHSB(nHue, nSaturation, nBrightness);
- return Color::HSBtoRGB(
- nHue,
- nNewSaturation>=0 ? nNewSaturation : nSaturation,
- nNewBrightness>=0 ? nNewBrightness : nBrightness);
-}
-
-
-
-
-Theme::Theme (const ::boost::shared_ptr<controller::Properties>& rpProperties)
- : mbIsHighContrastMode(false),
- maBackgroundColor(rpProperties->GetBackgroundColor().GetColor()),
- maPageBackgroundColor(COL_WHITE),
- maGradients(),
- maIcons(),
- maColor(),
- maIntegerValues()
-{
- {
- LocalResource aResource (RID_SLIDESORTER_ICONS);
-
- maStrings.resize(_StringType_Size_);
- maStrings[String_DragAndDropPages] = String(SdResId(STRING_DRAG_AND_DROP_PAGES));
- maStrings[String_DragAndDropSlides] = String(SdResId(STRING_DRAG_AND_DROP_SLIDES));
- maStrings[String_Command1] = String(SdResId(STRING_COMMAND1));
- maStrings[String_Command2] = String(SdResId(STRING_COMMAND2_A));
- maStrings[String_Command2B] = String(SdResId(STRING_COMMAND2_B));
- maStrings[String_Command3] = String(SdResId(STRING_COMMAND3));
-
- maColor.resize(_ColorType_Size_);
- maColor[Color_Background] = maBackgroundColor;
- maColor[Color_ButtonBackground] = Black;
- maColor[Color_ButtonText] = 0xc0c0c0;
- maColor[Color_ButtonTextHover] = White;
- maColor[Color_PageNumberDefault] = 0x0808080;
- maColor[Color_PageNumberHover] = 0x4c4c4c;
- maColor[Color_PageNumberHighContrast] = White;
- maColor[Color_PageNumberBrightBackground] = 0x333333;
- maColor[Color_PageNumberDarkBackground] = 0xcccccc;
- maColor[Color_PreviewBorder] = 0x949599;
-
- maIntegerValues.resize(_IntegerValueType_Size_);
- maIntegerValues[Integer_ButtonCornerRadius] = 3;
- maIntegerValues[Integer_ButtonMaxAlpha] = 0;
- maIntegerValues[Integer_ButtonBarMaxAlpha] = 0;
- maIntegerValues[Integer_ButtonPaintType] = 1;
- maIntegerValues[Integer_ButtonBorder] = 4;
- maIntegerValues[Integer_ButtonGap] = 0;
- maIntegerValues[Integer_ButtonFadeInDelay] = 800;
- maIntegerValues[Integer_ButtonFadeInDuration] = 100;
- maIntegerValues[Integer_ButtonFadeOutDelay] = 0;
- maIntegerValues[Integer_ButtonFadeOutDuration] = 100;
- maIntegerValues[Integer_ToolTipDelay] = 1000;
- maIntegerValues[Integer_FocusIndicatorWidth] = 3;
- }
-
- Update(rpProperties);
-}
-
-
-
-
-void Theme::Update (const ::boost::shared_ptr<controller::Properties>& rpProperties)
-{
- const bool bSavedHighContrastMode (mbIsHighContrastMode);
- mbIsHighContrastMode = rpProperties->IsHighContrastModeActive();
-
- // Set up colors.
- maBackgroundColor = rpProperties->GetBackgroundColor().GetColor();
- maPageBackgroundColor = svtools::ColorConfig().GetColorValue(svtools::DOCCOLOR).nColor;
-
- maColor[Color_Background] = maBackgroundColor;
-
- maGradients.resize(_GradientColorType_Size_);
-
- maColor[Color_Background] = maBackgroundColor;
- const ColorData aSelectionColor (rpProperties->GetSelectionColor().GetColor());
- maColor[Color_Selection] = aSelectionColor;
- if (Color(aSelectionColor).IsBright())
- maColor[Color_PageCountFontColor] = Black;
- else
- maColor[Color_PageCountFontColor] = White;
-
- // Set up gradients.
- SetGradient(Gradient_SelectedPage, aSelectionColor, 50, 50, +100,+100, +50,+25);
- SetGradient(Gradient_MouseOverPage, aSelectionColor, 75, 75, +100,+100, +50,+25);
- SetGradient(Gradient_SelectedAndFocusedPage, aSelectionColor, 50, 50, +100,+100, -50,-75);
- SetGradient(Gradient_MouseOverSelectedAndFocusedPage, aSelectionColor, 75, 75, +100,+100, -50,-75);
- SetGradient(Gradient_FocusedPage, aSelectionColor, -1,-1, 0,0, -50,-75);
-
- SetGradient(Gradient_ButtonBackground, Black, -1,-1, 0,0, 0,0);
- SetGradient(Gradient_NormalPage, maBackgroundColor, -1,-1, 0,0, 0,0);
-
- // The focused gradient needs special handling because its fill color is
- // like that of the NormalPage gradient.
- GetGradient(Gradient_FocusedPage).maFillColor1 = GetGradient(Gradient_NormalPage).maFillColor1;
- GetGradient(Gradient_FocusedPage).maFillColor2 = GetGradient(Gradient_NormalPage).maFillColor2;
-
- // Set up icons.
- if (bSavedHighContrastMode != mbIsHighContrastMode || maIcons.empty())
- {
- LocalResource aResource (RID_SLIDESORTER_ICONS);
-
- maIcons.resize(_IconType_Size_);
- if (mbIsHighContrastMode)
- {
- InitializeIcon(Icon_RawShadow, IMAGE_SHADOW);
- InitializeIcon(Icon_RawInsertShadow, IMAGE_INSERT_SHADOW);
- InitializeIcon(Icon_HideSlideOverlay, IMAGE_HIDE_SLIDE_OVERLAY);
-
- InitializeIcon(Icon_ButtonBarLarge, IMAGE_BUTTONBAR_LARGE_HC);
- InitializeIcon(Icon_ButtonBarMedium, IMAGE_BUTTONBAR_MEDIUM_HC);
- InitializeIcon(Icon_ButtonBarSmall, IMAGE_BUTTONBAR_SMALL_HC);
-
- InitializeIcon(Icon_Command1Large, IMAGE_COMMAND1_LARGE_HC);
- InitializeIcon(Icon_Command1LargeHover, IMAGE_COMMAND1_LARGE_HOVER_HC);
- InitializeIcon(Icon_Command1Medium, IMAGE_COMMAND1_MEDIUM_HC);
- InitializeIcon(Icon_Command1MediumHover, IMAGE_COMMAND1_MEDIUM_HOVER_HC);
- InitializeIcon(Icon_Command1Small, IMAGE_COMMAND1_SMALL_HC);
- InitializeIcon(Icon_Command1SmallHover, IMAGE_COMMAND1_SMALL_HOVER_HC);
-
- InitializeIcon(Icon_Command2Large, IMAGE_COMMAND2_LARGE_HC);
- InitializeIcon(Icon_Command2LargeHover, IMAGE_COMMAND2_LARGE_HOVER_HC);
- InitializeIcon(Icon_Command2Medium, IMAGE_COMMAND2_MEDIUM_HC);
- InitializeIcon(Icon_Command2MediumHover, IMAGE_COMMAND2_MEDIUM_HOVER_HC);
- InitializeIcon(Icon_Command2Small, IMAGE_COMMAND2_SMALL_HC);
- InitializeIcon(Icon_Command2SmallHover, IMAGE_COMMAND2_SMALL_HOVER_HC);
-
- InitializeIcon(Icon_Command2BLarge, IMAGE_COMMAND2B_LARGE_HC);
- InitializeIcon(Icon_Command2BLargeHover, IMAGE_COMMAND2B_LARGE_HOVER_HC);
- InitializeIcon(Icon_Command2BMedium, IMAGE_COMMAND2B_MEDIUM_HC);
- InitializeIcon(Icon_Command2BMediumHover, IMAGE_COMMAND2B_MEDIUM_HOVER_HC);
- InitializeIcon(Icon_Command2BSmall, IMAGE_COMMAND2B_SMALL_HC);
- InitializeIcon(Icon_Command2BSmallHover, IMAGE_COMMAND2B_SMALL_HOVER_HC);
-
- InitializeIcon(Icon_Command3Large, IMAGE_COMMAND3_LARGE_HC);
- InitializeIcon(Icon_Command3LargeHover, IMAGE_COMMAND3_LARGE_HOVER_HC);
- InitializeIcon(Icon_Command3Medium, IMAGE_COMMAND3_SMALL_HC);
- InitializeIcon(Icon_Command3MediumHover, IMAGE_COMMAND3_SMALL_HOVER_HC);
- InitializeIcon(Icon_Command3Small, IMAGE_COMMAND3_SMALL_HC);
- InitializeIcon(Icon_Command3SmallHover, IMAGE_COMMAND3_SMALL_HOVER_HC);
- }
- else
- {
- InitializeIcon(Icon_RawShadow, IMAGE_SHADOW);
- InitializeIcon(Icon_RawInsertShadow, IMAGE_INSERT_SHADOW);
- InitializeIcon(Icon_HideSlideOverlay, IMAGE_HIDE_SLIDE_OVERLAY);
-
- InitializeIcon(Icon_ButtonBarLarge, IMAGE_BUTTONBAR_LARGE);
- InitializeIcon(Icon_ButtonBarMedium, IMAGE_BUTTONBAR_MEDIUM);
- InitializeIcon(Icon_ButtonBarSmall, IMAGE_BUTTONBAR_SMALL);
-
- InitializeIcon(Icon_Command1Large, IMAGE_COMMAND1_LARGE);
- InitializeIcon(Icon_Command1LargeHover, IMAGE_COMMAND1_LARGE_HOVER);
- InitializeIcon(Icon_Command1Medium, IMAGE_COMMAND1_MEDIUM);
- InitializeIcon(Icon_Command1MediumHover, IMAGE_COMMAND1_MEDIUM_HOVER);
- InitializeIcon(Icon_Command1Small, IMAGE_COMMAND1_SMALL);
- InitializeIcon(Icon_Command1SmallHover, IMAGE_COMMAND1_SMALL_HOVER);
-
- InitializeIcon(Icon_Command2Large, IMAGE_COMMAND2_LARGE);
- InitializeIcon(Icon_Command2LargeHover, IMAGE_COMMAND2_LARGE_HOVER);
- InitializeIcon(Icon_Command2Medium, IMAGE_COMMAND2_MEDIUM);
- InitializeIcon(Icon_Command2MediumHover, IMAGE_COMMAND2_MEDIUM_HOVER);
- InitializeIcon(Icon_Command2Small, IMAGE_COMMAND2_SMALL);
- InitializeIcon(Icon_Command2SmallHover, IMAGE_COMMAND2_SMALL_HOVER);
-
- InitializeIcon(Icon_Command2BLarge, IMAGE_COMMAND2B_LARGE);
- InitializeIcon(Icon_Command2BLargeHover, IMAGE_COMMAND2B_LARGE_HOVER);
- InitializeIcon(Icon_Command2BMedium, IMAGE_COMMAND2B_MEDIUM);
- InitializeIcon(Icon_Command2BMediumHover, IMAGE_COMMAND2B_MEDIUM_HOVER);
- InitializeIcon(Icon_Command2BSmall, IMAGE_COMMAND2B_SMALL);
- InitializeIcon(Icon_Command2BSmallHover, IMAGE_COMMAND2B_SMALL_HOVER);
-
- InitializeIcon(Icon_Command3Large, IMAGE_COMMAND3_LARGE);
- InitializeIcon(Icon_Command3LargeHover, IMAGE_COMMAND3_LARGE_HOVER);
- InitializeIcon(Icon_Command3Medium, IMAGE_COMMAND3_MEDIUM);
- InitializeIcon(Icon_Command3MediumHover, IMAGE_COMMAND3_MEDIUM_HOVER);
- InitializeIcon(Icon_Command3Small, IMAGE_COMMAND3_SMALL);
- InitializeIcon(Icon_Command3SmallHover, IMAGE_COMMAND3_SMALL_HOVER);
- }
- InitializeIcon(Icon_FocusBorder, IMAGE_FOCUS_BORDER);
- }
-}
-
-
-
-
-::boost::shared_ptr<Font> Theme::GetFont (
- const FontType eType,
- const OutputDevice& rDevice)
-{
- ::boost::shared_ptr<Font> pFont;
-
- switch (eType)
- {
- case Font_PageNumber:
- pFont.reset(new Font(Application::GetSettings().GetStyleSettings().GetAppFont()));
- pFont->SetTransparent(sal_True);
- pFont->SetWeight(WEIGHT_BOLD);
- break;
-
- case Font_PageCount:
- pFont.reset(new Font(Application::GetSettings().GetStyleSettings().GetAppFont()));
- pFont->SetTransparent(sal_True);
- pFont->SetWeight(WEIGHT_NORMAL);
- {
- const Size aSize (pFont->GetSize());
- pFont->SetSize(Size(aSize.Width()*5/3, aSize.Height()*5/3));
- }
- break;
-
- case Font_Button:
- pFont.reset(new Font(Application::GetSettings().GetStyleSettings().GetAppFont()));
- pFont->SetTransparent(sal_True);
- pFont->SetWeight(WEIGHT_BOLD);
- {
- const Size aSize (pFont->GetSize());
- pFont->SetSize(Size(aSize.Width()*4/3, aSize.Height()*4/3));
- }
- break;
- }
-
- if (pFont)
- {
- // Transform the point size to pixel size.
- const MapMode aFontMapMode (MAP_POINT);
- const Size aFontSize (rDevice.LogicToPixel(pFont->GetSize(), aFontMapMode));
-
- // Transform the font size to the logical coordinates of the device.
- pFont->SetSize(rDevice.PixelToLogic(aFontSize));
- }
-
- return pFont;
-}
-
-
-
-
-ColorData Theme::GetColor (const ColorType eType)
-{
- if (eType>=0 && sal_uInt32(eType)<maColor.size())
- return maColor[eType];
- else
- return 0;
-}
-
-
-
-
-void Theme::SetColor (
- const ColorType eType,
- const ColorData aData)
-{
- if (eType>=0 && sal_uInt32(eType)<maColor.size())
- maColor[eType] = aData;
-}
-
-
-
-
-ColorData Theme::GetGradientColor (
- const GradientColorType eType,
- const GradientColorClass eClass)
-{
- GradientDescriptor& rDescriptor (GetGradient(eType));
-
- switch (eClass)
- {
- case Border1: return rDescriptor.maBorderColor1;
- case Border2: return rDescriptor.maBorderColor2;
- case Fill1: return rDescriptor.maFillColor1;
- case Fill2: return rDescriptor.maFillColor2;
- default: OSL_ASSERT(false); // fall through
- case Base: return rDescriptor.maBaseColor;
- }
-}
-
-
-
-
-sal_Int32 Theme::GetGradientOffset (
- const GradientColorType eType,
- const GradientColorClass eClass)
-{
- GradientDescriptor& rDescriptor (GetGradient(eType));
-
- switch (eClass)
- {
- case Border1: return rDescriptor.mnBorderOffset1;
- case Border2: return rDescriptor.mnBorderOffset2;
- case Fill1: return rDescriptor.mnFillOffset1;
- case Fill2: return rDescriptor.mnFillOffset2;
- default: OSL_ASSERT(false); // fall through
- case Base: return 0;
- }
-}
-
-
-
-
-void Theme::SetGradient (
- const GradientColorType eType,
- const ColorData aBaseColor,
- const sal_Int32 nSaturationOverride,
- const sal_Int32 nBrightnessOverride,
- const sal_Int32 nFillStartOffset,
- const sal_Int32 nFillEndOffset,
- const sal_Int32 nBorderStartOffset,
- const sal_Int32 nBorderEndOffset)
-{
- GradientDescriptor& rGradient (GetGradient(eType));
-
- rGradient.maBaseColor = aBaseColor;
-
- rGradient.mnSaturationOverride = nSaturationOverride;
- rGradient.mnBrightnessOverride = nBrightnessOverride;
- const ColorData aColor (nSaturationOverride>=0 || nBrightnessOverride>=0
- ? HGBAdapt(aBaseColor, nSaturationOverride, nBrightnessOverride)
- : aBaseColor);
-
- rGradient.maFillColor1 = ChangeLuminance(aColor, nFillStartOffset);
- rGradient.maFillColor2 = ChangeLuminance(aColor, nFillEndOffset);
- rGradient.maBorderColor1 = ChangeLuminance(aColor, nBorderStartOffset);
- rGradient.maBorderColor2 = ChangeLuminance(aColor, nBorderEndOffset);
-
- rGradient.mnFillOffset1 = nFillStartOffset;
- rGradient.mnFillOffset2 = nFillEndOffset;
- rGradient.mnBorderOffset1 = nBorderStartOffset;
- rGradient.mnBorderOffset2 = nBorderEndOffset;
-}
-
-
-
-
-sal_Int32 Theme::GetGradientSaturationOverride (const GradientColorType eType)
-{
- GradientDescriptor& rGradient (GetGradient(eType));
- return rGradient.mnSaturationOverride;
-}
-
-
-
-
-sal_Int32 Theme::GetGradientBrightnessOverride (const GradientColorType eType)
-{
- GradientDescriptor& rGradient (GetGradient(eType));
- return rGradient.mnBrightnessOverride;
-}
-
-
-
-
-void Theme::SetGradientSaturationOverride (const GradientColorType eType, const sal_Int32 nValue)
-{
- GradientDescriptor& rGradient (GetGradient(eType));
- SetGradient(
- eType,
- rGradient.maBaseColor,
- nValue,
- rGradient.mnBrightnessOverride,
- rGradient.mnFillOffset1,
- rGradient.mnFillOffset2,
- rGradient.mnBorderOffset1,
- rGradient.mnBorderOffset2);
-}
-
-
-
-
-void Theme::SetGradientBrightnessOverride (const GradientColorType eType, const sal_Int32 nValue)
-{
- GradientDescriptor& rGradient (GetGradient(eType));
- SetGradient(eType,
- rGradient.maBaseColor,
- rGradient.mnSaturationOverride,
- nValue,
- rGradient.mnFillOffset1,
- rGradient.mnFillOffset2,
- rGradient.mnBorderOffset1,
- rGradient.mnBorderOffset2);
-}
-
-
-
-
-const BitmapEx& Theme::GetIcon (const IconType eType)
-{
- if (eType>=0 && size_t(eType)<maIcons.size())
- return maIcons[eType];
- else
- {
- OSL_ASSERT(eType>=0 && size_t(eType)<maIcons.size());
- return maIcons[0];
- }
-}
-
-
-
-
-sal_Int32 Theme::GetIntegerValue (const IntegerValueType eType) const
-{
- if (eType>=0 && size_t(eType)<maIntegerValues.size())
- return maIntegerValues[eType];
- else
- {
- OSL_ASSERT(eType>=0 && size_t(eType)<maIntegerValues.size());
- return 0;
- }
-}
-
-
-
-
-void Theme::SetIntegerValue (const IntegerValueType eType, const sal_Int32 nValue)
-{
- if (eType>=0 && size_t(eType)<maIntegerValues.size())
- maIntegerValues[eType] = nValue;
- else
- {
- OSL_ASSERT(eType>=0 && size_t(eType)<maIntegerValues.size());
- }
-}
-
-
-
-
-::rtl::OUString Theme::GetString (const StringType eType) const
-{
- if (eType>=0 && size_t(eType)<maStrings.size())
- return maStrings[eType];
- else
- {
- OSL_ASSERT(eType>=0 && size_t(eType)<maStrings.size());
- return ::rtl::OUString();
- }
-}
-
-
-
-
-Theme::GradientDescriptor& Theme::GetGradient (const GradientColorType eType)
-{
- if (eType>=0 && size_t(eType)<maGradients.size())
- return maGradients[eType];
- else
- {
- OSL_ASSERT(eType>=0 && size_t(eType)<maGradients.size());
- return maGradients[0];
- }
-}
-
-
-
-
-void Theme::InitializeIcon (const IconType eType, sal_uInt16 nResourceId)
-{
- if (eType>=0 && size_t(eType)<maIcons.size())
- {
- const BitmapEx aIcon (Image(SdResId(nResourceId)).GetBitmapEx());
- maIcons[eType] = aIcon;
- }
- else
- {
- OSL_ASSERT(eType>=0 && size_t(eType)<maIcons.size());
- }
-}
-
-
-
-
-} } } // end of namespace ::sd::slidesorter::view
diff --git a/sd/source/ui/slidesorter/view/SlsToolTip.cxx b/sd/source/ui/slidesorter/view/SlsToolTip.cxx
deleted file mode 100644
index 65c03a3bb..000000000
--- a/sd/source/ui/slidesorter/view/SlsToolTip.cxx
+++ /dev/null
@@ -1,230 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "precompiled_sd.hxx"
-
-#include "view/SlsToolTip.hxx"
-#include "view/SlideSorterView.hxx"
-#include "view/SlsLayouter.hxx"
-#include "view/SlsTheme.hxx"
-#include "sdpage.hxx"
-#include "sdresid.hxx"
-#include "glob.hrc"
-#include <vcl/help.hxx>
-
-using ::rtl::OUString;
-
-namespace sd { namespace slidesorter { namespace view {
-
-ToolTip::ToolTip (SlideSorter& rSlideSorter)
- : mrSlideSorter(rSlideSorter),
- msDefaultHelpText(),
- msCurrentHelpText(),
- mnHelpWindowHandle(0),
- maTimer()
-{
- maTimer.SetTimeout(rSlideSorter.GetTheme()->GetIntegerValue(Theme::Integer_ToolTipDelay));
- maTimer.SetTimeoutHdl(LINK(this, ToolTip, DelayTrigger));
-}
-
-
-
-
-ToolTip::~ToolTip (void)
-{
- maTimer.Stop();
- Hide();
-}
-
-
-
-
-void ToolTip::SetPage (const model::SharedPageDescriptor& rpDescriptor)
-{
- if (mpDescriptor != rpDescriptor)
- {
- maTimer.Stop();
- Hide();
-
- mpDescriptor = rpDescriptor;
-
- if (mpDescriptor)
- {
- SdPage* pPage = mpDescriptor->GetPage();
- OUString sHelpText;
- if (pPage != NULL)
- sHelpText = pPage->GetName();
- else
- {
- OSL_ASSERT(mpDescriptor->GetPage() != NULL);
- }
- if (sHelpText.getLength() == 0)
- {
- sHelpText = String(SdResId(STR_PAGE));
- sHelpText += String::CreateFromInt32(mpDescriptor->GetPageIndex()+1);
- }
-
- msDefaultHelpText = sHelpText;
- msCurrentHelpText = sHelpText;
- Show(false);
- }
- else
- {
- msDefaultHelpText = OUString();
- msCurrentHelpText = OUString();
- }
- }
-}
-
-
-
-
-void ToolTip::ShowDefaultHelpText (const ::rtl::OUString& rsHelpText)
-{
- if (msDefaultHelpText != rsHelpText)
- {
- const bool bIsVisible (Hide());
-
- msDefaultHelpText = rsHelpText;
- msCurrentHelpText = rsHelpText;
-
- Show(bIsVisible);
- }
-}
-
-
-
-
-void ToolTip::ShowDefaultHelpText (void)
-{
- if (msCurrentHelpText != msDefaultHelpText)
- {
- const bool bIsVisible (Hide());
-
- msCurrentHelpText = msDefaultHelpText;
-
- Show(bIsVisible);
- }
-}
-
-
-
-
-void ToolTip::ShowHelpText (const ::rtl::OUString& rsHelpText)
-{
- if (msCurrentHelpText != rsHelpText)
- {
- const bool bIsVisible (Hide());
-
- msCurrentHelpText = rsHelpText;
-
- Show(bIsVisible);
- }
-}
-
-
-
-
-void ToolTip::Show (const bool bNoDelay)
-{
- if (bNoDelay)
- DoShow();
- else
- maTimer.Start();
-}
-
-
-
-
-void ToolTip::DoShow (void)
-{
- if (maTimer.IsActive())
- {
- // The delay timer is active. Wait for it to trigger the showing of
- // the tool tip.
- return;
- }
-
- SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
- if (msCurrentHelpText.getLength()>0 && pWindow)
- {
- Rectangle aBox (
- mrSlideSorter.GetView().GetLayouter().GetPageObjectLayouter()->GetBoundingBox(
- mpDescriptor,
- PageObjectLayouter::Preview,
- PageObjectLayouter::WindowCoordinateSystem));
-
- // Do not show the help text when the (lower edge of the ) preview
- // is not visible. The tool tip itself may still be outside the
- // window.
- if (aBox.Bottom() >= pWindow->GetSizePixel().Height())
- return;
-
- ::Window* pParent (pWindow.get());
- while (pParent!=NULL && pParent->GetParent()!=NULL)
- pParent = pParent->GetParent();
- const Point aOffset (pWindow->GetWindowExtentsRelative(pParent).TopLeft());
-
- // We do not know how high the tool tip will be but want its top
- // edge not its bottom to be at a specific position (a little below
- // the preview). Therefore we use a little trick and place the tool
- // tip at the top of a rectangle that is placed below the preview.
- aBox.Move(aOffset.X(), aOffset.Y() + aBox.GetHeight() + 3);
- mnHelpWindowHandle = Help::ShowTip(
- pWindow.get(),
- aBox,
- msCurrentHelpText,
- QUICKHELP_CENTER | QUICKHELP_TOP);
- }
-}
-
-
-
-
-bool ToolTip::Hide (void)
-{
- if (mnHelpWindowHandle>0)
- {
- Help::HideTip(mnHelpWindowHandle);
- mnHelpWindowHandle = 0;
- return true;
- }
- else
- return false;
-}
-
-
-
-
-IMPL_LINK(ToolTip, DelayTrigger, void*, EMPTYARG)
-{
- DoShow();
-
- return 0;
-}
-
-} } } // end of namespace ::sd::slidesorter::view
diff --git a/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx b/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx
deleted file mode 100644
index 4f35996fe..000000000
--- a/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx
+++ /dev/null
@@ -1,162 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "precompiled_sd.hxx"
-
-#include "SlsViewCacheContext.hxx"
-
-#include "SlideSorter.hxx"
-#include "model/SlideSorterModel.hxx"
-#include "model/SlsPageDescriptor.hxx"
-#include "model/SlsPageEnumerationProvider.hxx"
-#include "view/SlideSorterView.hxx"
-#include "sdpage.hxx"
-#include "Window.hxx"
-#include "drawdoc.hxx"
-#include "tools/IdleDetection.hxx"
-#include <svx/svdpage.hxx>
-#include <svx/sdr/contact/viewcontact.hxx>
-#include <vcl/window.hxx>
-#include <svx/sdr/contact/objectcontact.hxx>
-
-namespace sd { namespace slidesorter { namespace view {
-
-
-ViewCacheContext::ViewCacheContext (SlideSorter& rSlideSorter)
- : mrModel(rSlideSorter.GetModel()),
- mrSlideSorter(rSlideSorter)
-{
-}
-
-
-
-
-ViewCacheContext::~ViewCacheContext (void)
-{
-}
-
-
-
-
-void ViewCacheContext::NotifyPreviewCreation (
- cache::CacheKey aKey,
- const Bitmap&)
-{
- const model::SharedPageDescriptor pDescriptor (GetDescriptor(aKey));
- if (pDescriptor.get() != NULL)
- {
- // Force a repaint that will trigger their re-creation.
- mrSlideSorter.GetView().RequestRepaint(pDescriptor);
- }
- else
- {
- OSL_ASSERT(pDescriptor);
- }
-}
-
-
-
-
-bool ViewCacheContext::IsIdle (void)
-{
- sal_Int32 nIdleState (tools::IdleDetection::GetIdleState(mrSlideSorter.GetContentWindow().get()));
- if (nIdleState == tools::IdleDetection::IDET_IDLE)
- return true;
- else
- return false;
-}
-
-
-
-
-bool ViewCacheContext::IsVisible (cache::CacheKey aKey)
-{
- const model::SharedPageDescriptor pDescriptor (GetDescriptor(aKey));
- return pDescriptor && pDescriptor->HasState(model::PageDescriptor::ST_Visible);
-}
-
-
-
-
-const SdrPage* ViewCacheContext::GetPage (cache::CacheKey aKey)
-{
- return static_cast<const SdrPage*>(aKey);
-}
-
-
-
-
-::boost::shared_ptr<std::vector<cache::CacheKey> > ViewCacheContext::GetEntryList (bool bVisible)
-{
- ::boost::shared_ptr<std::vector<cache::CacheKey> > pKeys (new std::vector<cache::CacheKey>());
-
- model::PageEnumeration aPageEnumeration (
- bVisible
- ? model::PageEnumerationProvider::CreateVisiblePagesEnumeration(mrModel)
- : model::PageEnumerationProvider::CreateAllPagesEnumeration(mrModel));
-
- while (aPageEnumeration.HasMoreElements())
- {
- model::SharedPageDescriptor pDescriptor (aPageEnumeration.GetNextElement());
- pKeys->push_back(pDescriptor->GetPage());
- }
-
- return pKeys;
-}
-
-
-
-
-sal_Int32 ViewCacheContext::GetPriority (cache::CacheKey aKey)
-{
- return - (static_cast<const SdrPage*>(aKey)->GetPageNum()-1) / 2;
-}
-
-
-
-
-model::SharedPageDescriptor ViewCacheContext::GetDescriptor (cache::CacheKey aKey)
-{
- sal_uInt16 nPageIndex ((static_cast<const SdrPage*>(aKey)->GetPageNum() - 1) / 2);
- return mrModel.GetPageDescriptor(nPageIndex);
-}
-
-
-
-
-::com::sun::star::uno::Reference<com::sun::star::uno::XInterface> ViewCacheContext::GetModel (void)
-{
- if (mrModel.GetDocument() == NULL)
- return NULL;
- else
- return mrModel.GetDocument()->getUnoModel();
-}
-
-} } } // end of namespace ::sd::slidesorter::view
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/view/SlsViewCacheContext.hxx b/sd/source/ui/slidesorter/view/SlsViewCacheContext.hxx
deleted file mode 100644
index 9c714f871..000000000
--- a/sd/source/ui/slidesorter/view/SlsViewCacheContext.hxx
+++ /dev/null
@@ -1,73 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef SD_SLIDESORTER_VIEW_VIEW_CACHE_CONTEXT_HXX
-#define SD_SLIDESORTER_VIEW_VIEW_CACHE_CONTEXT_HXX
-
-#include "cache/SlsCacheContext.hxx"
-#include "model/SlsSharedPageDescriptor.hxx"
-
-namespace sd { namespace slidesorter { namespace model {
-class SlideSorterModel;
-} } }
-
-namespace sd { namespace slidesorter {
-class SlideSorter;
-} }
-
-namespace sd { namespace slidesorter { namespace view {
-
-/** The cache context for the SlideSorter as used by Draw and Impress. See
- the base class for documentation of the individual methods.
-*/
-class ViewCacheContext : public cache::CacheContext
-{
-public:
- ViewCacheContext (SlideSorter& rSlideSorter);
- virtual ~ViewCacheContext (void);
- virtual void NotifyPreviewCreation (cache::CacheKey aKey, const Bitmap& rPreview);
- virtual bool IsIdle (void);
- virtual bool IsVisible (cache::CacheKey aKey);
- virtual const SdrPage* GetPage (cache::CacheKey aKey);
- virtual ::boost::shared_ptr<std::vector<cache::CacheKey> > GetEntryList (bool bVisible);
- virtual sal_Int32 GetPriority (cache::CacheKey aKey);
- virtual ::com::sun::star::uno::Reference<com::sun::star::uno::XInterface> GetModel (void);
-
-private:
- model::SlideSorterModel& mrModel;
- SlideSorter& mrSlideSorter;
-
- model::SharedPageDescriptor GetDescriptor (cache::CacheKey aKey);
-};
-
-
-} } } // end of namespace ::sd::slidesorter::view
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */