From 6cd3d5260d9e33c20b32664eb1ffb46ca6010e00 Mon Sep 17 00:00:00 2001 From: Andre Fischer Date: Wed, 26 May 2010 13:35:57 +0200 Subject: [PATCH] renaissance1: #i107215# Increased minimal slide width. Replaced some icons. Insert indicator shows exclusion indicator. --- .../slidesorter/controller/SlsClipboard.cxx | 6 +- .../controller/SlsTransferable.cxx | 4 +- .../inc/controller/SlsTransferable.hxx | 18 +++- .../ui/slidesorter/inc/view/SlsButtonBar.hxx | 3 + .../inc/view/SlsInsertionIndicatorOverlay.hxx | 5 +- .../inc/view/SlsPageObjectPainter.hxx | 17 +++- .../ui/slidesorter/view/SlsButtonBar.cxx | 26 ++++- .../view/SlsInsertionIndicatorOverlay.cxx | 29 ++++-- sd/source/ui/slidesorter/view/SlsLayouter.cxx | 2 +- .../slidesorter/view/SlsPageObjectPainter.cxx | 98 +++++++++++++------ 10 files changed, 157 insertions(+), 51 deletions(-) diff --git a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx index 22c39344fced..67a68c17e5b2 100644 --- a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx +++ b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx @@ -409,7 +409,7 @@ void Clipboard::CreateSlideTransferable ( // previews are included into the transferable so that an insertion // indicator can be rendered. aSelectedPages.Rewind(); - ::std::vector aRepresentatives; + ::std::vector aRepresentatives; aRepresentatives.reserve(3); ::boost::shared_ptr pPreviewCache ( mrSlideSorter.GetView().GetPreviewCache()); @@ -419,7 +419,9 @@ void Clipboard::CreateSlideTransferable ( if ( ! pDescriptor || pDescriptor->GetPage()==NULL) continue; Bitmap aPreview (pPreviewCache->GetPreviewBitmap(pDescriptor->GetPage(), false)); - aRepresentatives.push_back(aPreview); + aRepresentatives.push_back(Transferable::Representative( + aPreview, + pDescriptor->HasState(model::PageDescriptor::ST_Excluded))); if (aRepresentatives.size() >= 3) break; } diff --git a/sd/source/ui/slidesorter/controller/SlsTransferable.cxx b/sd/source/ui/slidesorter/controller/SlsTransferable.cxx index 6b25fbd1117f..efda2eb1e4eb 100644 --- a/sd/source/ui/slidesorter/controller/SlsTransferable.cxx +++ b/sd/source/ui/slidesorter/controller/SlsTransferable.cxx @@ -40,7 +40,7 @@ Transferable::Transferable ( ::sd::View* pWorkView, BOOL bInitOnGetData, SlideSorterViewShell* pViewShell, - const ::std::vector& rRepresentatives) + const ::std::vector& rRepresentatives) : SdTransferable (pSrcDoc, pWorkView, bInitOnGetData), mpViewShell(pViewShell), maRepresentatives(rRepresentatives) @@ -92,7 +92,7 @@ void Transferable::Notify (SfxBroadcaster& rBroadcaster, const SfxHint& rHint) -const ::std::vector& Transferable::GetRepresentatives (void) const +const ::std::vector& Transferable::GetRepresentatives (void) const { return maRepresentatives; } diff --git a/sd/source/ui/slidesorter/inc/controller/SlsTransferable.hxx b/sd/source/ui/slidesorter/inc/controller/SlsTransferable.hxx index 2519b2473851..c47411580085 100644 --- a/sd/source/ui/slidesorter/inc/controller/SlsTransferable.hxx +++ b/sd/source/ui/slidesorter/inc/controller/SlsTransferable.hxx @@ -45,22 +45,34 @@ class Transferable : public SdTransferable { public: + class Representative + { + public: + Representative (const Bitmap& rBitmap, const bool bIsExcluded) + : maBitmap(rBitmap), mbIsExcluded(bIsExcluded) {} + Representative (const Representative& rOther) + : maBitmap(rOther.maBitmap), mbIsExcluded(rOther.mbIsExcluded) {} + const Bitmap maBitmap; + const bool mbIsExcluded; + }; + + Transferable ( SdDrawDocument* pSrcDoc, ::sd::View* pWorkView, BOOL bInitOnGetData, SlideSorterViewShell* pViewShell, - const ::std::vector& rRepresentatives); + const ::std::vector& rRepresentatives); virtual ~Transferable (void); virtual void DragFinished (sal_Int8 nDropAction); - const ::std::vector& GetRepresentatives (void) const; + const ::std::vector& GetRepresentatives (void) const; private: SlideSorterViewShell* mpViewShell; - const ::std::vector maRepresentatives; + const ::std::vector maRepresentatives; virtual void Notify (SfxBroadcaster& rBroadcaster, const SfxHint& rHint); }; diff --git a/sd/source/ui/slidesorter/inc/view/SlsButtonBar.hxx b/sd/source/ui/slidesorter/inc/view/SlsButtonBar.hxx index 1c99db4aa3f0..d9d8b2dac112 100644 --- a/sd/source/ui/slidesorter/inc/view/SlsButtonBar.hxx +++ b/sd/source/ui/slidesorter/inc/view/SlsButtonBar.hxx @@ -188,6 +188,9 @@ private: const model::SharedPageDescriptor& rpDescriptor, const double nTargetAlpha, const bool bFadeIn); + + void AcquireLock (void); + void ReleaseLock (void); }; diff --git a/sd/source/ui/slidesorter/inc/view/SlsInsertionIndicatorOverlay.hxx b/sd/source/ui/slidesorter/inc/view/SlsInsertionIndicatorOverlay.hxx index 5cecc802ac57..a9a640d978cf 100644 --- a/sd/source/ui/slidesorter/inc/view/SlsInsertionIndicatorOverlay.hxx +++ b/sd/source/ui/slidesorter/inc/view/SlsInsertionIndicatorOverlay.hxx @@ -30,6 +30,7 @@ #include "model/SlsSharedPageDescriptor.hxx" #include "view/SlsILayerPainter.hxx" +#include "controller/SlsTransferable.hxx" #include #include @@ -109,7 +110,7 @@ private: OutputDevice& rContent, const Size aPreviewSize, const sal_Int32 nOffset, - const ::std::vector& rPages) const; + const ::std::vector& rPages) const; void PaintPageCount ( OutputDevice& rDevice, const sal_Int32 nSelectionCount, @@ -119,7 +120,7 @@ private: scaled down previews of some of the selected pages. */ void Create ( - const ::std::vector& rPages, + const ::std::vector& rPages, const sal_Int32 nSelectionCount); }; diff --git a/sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx b/sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx index 5a5aba931fe4..4b56c37e3139 100644 --- a/sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx +++ b/sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx @@ -72,6 +72,21 @@ public: */ void SetTheme (const ::boost::shared_ptr& rpTheme); + /** Return a preview bitmap for the given page descriptor. When the + page is excluded from the show then the preview is marked + accordingly. + @rpDescriptor + Defines the page for which to return the preview. + @pReferenceDevice + When not then this reference device is used to created a + compatible bitmap. + @return + The returned bitmap may have a different size then the preview area. + */ + Bitmap GetPreviewBitmap ( + const model::SharedPageDescriptor& rpDescriptor, + const OutputDevice* pReferenceDevice) const; + private: const Layouter& mrLayouter; ::boost::shared_ptr mpPageObjectLayouter; @@ -119,7 +134,7 @@ private: const Size& rSize, const Bitmap& rPreview, const BitmapEx& rOverlay, - const OutputDevice& TemplateDevice) const; + const OutputDevice* pReferenceDevice) const; }; } } } // end of namespace sd::slidesorter::view diff --git a/sd/source/ui/slidesorter/view/SlsButtonBar.cxx b/sd/source/ui/slidesorter/view/SlsButtonBar.cxx index 7c12846a5758..534900bf2440 100644 --- a/sd/source/ui/slidesorter/view/SlsButtonBar.cxx +++ b/sd/source/ui/slidesorter/view/SlsButtonBar.cxx @@ -159,7 +159,7 @@ namespace { ButtonBar::Lock::Lock (SlideSorter& rSlideSorter) : mrButtonBar(rSlideSorter.GetView().GetButtonBar()) { - ++mrButtonBar.mnLockCount; + mrButtonBar.AcquireLock(); } @@ -167,7 +167,7 @@ ButtonBar::Lock::Lock (SlideSorter& rSlideSorter) ButtonBar::Lock::~Lock (void) { - --mrButtonBar.mnLockCount; + mrButtonBar.ReleaseLock(); } @@ -730,6 +730,28 @@ void ButtonBar::StartFadeAnimation ( +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 ( diff --git a/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx b/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx index 3dfde5b0d83b..2c48d34c04e9 100644 --- a/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx +++ b/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx @@ -36,7 +36,6 @@ #include "view/SlsPageObjectLayouter.hxx" #include "view/SlsTheme.hxx" #include "cache/SlsPageCache.hxx" -#include "controller/SlsTransferable.hxx" #include "SlsFramePainter.hxx" #include "SlsLayeredDevice.hxx" #include "DrawDocShell.hxx" @@ -129,7 +128,7 @@ void InsertionIndicatorOverlay::Create (const controller::Transferable* pTransfe void InsertionIndicatorOverlay::Create ( - const ::std::vector& rRepresentatives, + const ::std::vector& rRepresentatives, const sal_Int32 nSelectionCount) { view::Layouter& rLayouter (mrSlideSorter.GetView().GetLayouter()); @@ -195,13 +194,14 @@ Point InsertionIndicatorOverlay::PaintRepresentatives ( OutputDevice& rContent, const Size aPreviewSize, const sal_Int32 nOffset, - const ::std::vector& rRepresentatives) const + const ::std::vector& 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)) @@ -225,15 +225,32 @@ Point InsertionIndicatorOverlay::PaintRepresentatives ( aPageOffset.X() += gnShadowBorder; aPageOffset.Y() += gnShadowBorder; - ::boost::shared_ptr pPreviewCache ( - mrSlideSorter.GetView().GetPreviewCache()); - Bitmap aPreview (rRepresentatives[nIndex]); + // 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 #include #include +#include using namespace ::drawinglayer::primitive2d; @@ -199,6 +200,20 @@ void PageObjectPainter::PaintBackground ( 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); + } } @@ -213,37 +228,17 @@ void PageObjectPainter::PaintPreview ( PageObjectLayouter::Preview, PageObjectLayouter::ModelCoordinateSystem)); - const bool bIsExcluded (rpDescriptor->GetVisualState().GetCurrentVisualState() - == model::VisualState::VS_Excluded); - if (mpCache != NULL) { const SdrPage* pPage = rpDescriptor->GetPage(); mpCache->SetPreciousFlag(pPage, true); - if (bIsExcluded) - { - Bitmap aMarkedPreview (mpCache->GetMarkedPreviewBitmap(pPage,false)); - if (aMarkedPreview.IsEmpty() || aMarkedPreview.GetSizePixel()!=aBox.GetSize()) - { - aMarkedPreview = CreateMarkedPreview( - aBox.GetSize(), - mpCache->GetPreviewBitmap(pPage,true), - mpTheme->GetIcon(Theme::Icon_HideSlideOverlay), - rDevice); - mpCache->SetMarkedPreviewBitmap(pPage, aMarkedPreview); - } - rDevice.DrawBitmap(aBox.TopLeft(), aMarkedPreview); - } - else - { - const Bitmap aPreview (mpCache->GetPreviewBitmap(pPage,false)); - if ( ! aPreview.IsEmpty()) - if (aPreview.GetSizePixel() != aBox.GetSize()) - rDevice.DrawBitmap(aBox.TopLeft(), aBox.GetSize(), aPreview); - else - rDevice.DrawBitmap(aBox.TopLeft(), aPreview); - } + 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); } } @@ -254,12 +249,16 @@ Bitmap PageObjectPainter::CreateMarkedPreview ( const Size& rSize, const Bitmap& rPreview, const BitmapEx& rOverlay, - const OutputDevice& rReferenceDevice) const + const OutputDevice* pReferenceDevice) const { - VirtualDevice aDevice (rReferenceDevice); - aDevice.SetOutputSizePixel(rSize); + ::boost::scoped_ptr pDevice; + if (pReferenceDevice != NULL) + pDevice.reset(new VirtualDevice(*pReferenceDevice)); + else + pDevice.reset(new VirtualDevice()); + pDevice->SetOutputSizePixel(rSize); - aDevice.DrawBitmap(Point(0,0), rSize, rPreview); + 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()); @@ -268,9 +267,44 @@ Bitmap PageObjectPainter::CreateMarkedPreview ( { for (sal_Int32 nX=0; nXDrawBitmapEx(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->GetVisualState().GetCurrentVisualState() + == model::VisualState::VS_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); } - return aDevice.GetBitmap(Point(0,0), rSize); }