renaissance1: #i107215# Increased minimal slide width. Replaced some icons. Insert indicator shows exclusion indicator.

This commit is contained in:
Andre Fischer
2010-05-26 13:35:57 +02:00
parent ee97c30d51
commit 6cd3d5260d
10 changed files with 157 additions and 51 deletions

View File

@@ -409,7 +409,7 @@ void Clipboard::CreateSlideTransferable (
// previews are included into the transferable so that an insertion // previews are included into the transferable so that an insertion
// indicator can be rendered. // indicator can be rendered.
aSelectedPages.Rewind(); aSelectedPages.Rewind();
::std::vector<Bitmap> aRepresentatives; ::std::vector<Transferable::Representative> aRepresentatives;
aRepresentatives.reserve(3); aRepresentatives.reserve(3);
::boost::shared_ptr<cache::PageCache> pPreviewCache ( ::boost::shared_ptr<cache::PageCache> pPreviewCache (
mrSlideSorter.GetView().GetPreviewCache()); mrSlideSorter.GetView().GetPreviewCache());
@@ -419,7 +419,9 @@ void Clipboard::CreateSlideTransferable (
if ( ! pDescriptor || pDescriptor->GetPage()==NULL) if ( ! pDescriptor || pDescriptor->GetPage()==NULL)
continue; continue;
Bitmap aPreview (pPreviewCache->GetPreviewBitmap(pDescriptor->GetPage(), false)); 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) if (aRepresentatives.size() >= 3)
break; break;
} }

View File

@@ -40,7 +40,7 @@ Transferable::Transferable (
::sd::View* pWorkView, ::sd::View* pWorkView,
BOOL bInitOnGetData, BOOL bInitOnGetData,
SlideSorterViewShell* pViewShell, SlideSorterViewShell* pViewShell,
const ::std::vector<Bitmap>& rRepresentatives) const ::std::vector<Representative>& rRepresentatives)
: SdTransferable (pSrcDoc, pWorkView, bInitOnGetData), : SdTransferable (pSrcDoc, pWorkView, bInitOnGetData),
mpViewShell(pViewShell), mpViewShell(pViewShell),
maRepresentatives(rRepresentatives) maRepresentatives(rRepresentatives)
@@ -92,7 +92,7 @@ void Transferable::Notify (SfxBroadcaster& rBroadcaster, const SfxHint& rHint)
const ::std::vector<Bitmap>& Transferable::GetRepresentatives (void) const const ::std::vector<Transferable::Representative>& Transferable::GetRepresentatives (void) const
{ {
return maRepresentatives; return maRepresentatives;
} }

View File

@@ -45,22 +45,34 @@ class Transferable
: public SdTransferable : public SdTransferable
{ {
public: 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 ( Transferable (
SdDrawDocument* pSrcDoc, SdDrawDocument* pSrcDoc,
::sd::View* pWorkView, ::sd::View* pWorkView,
BOOL bInitOnGetData, BOOL bInitOnGetData,
SlideSorterViewShell* pViewShell, SlideSorterViewShell* pViewShell,
const ::std::vector<Bitmap>& rRepresentatives); const ::std::vector<Representative>& rRepresentatives);
virtual ~Transferable (void); virtual ~Transferable (void);
virtual void DragFinished (sal_Int8 nDropAction); virtual void DragFinished (sal_Int8 nDropAction);
const ::std::vector<Bitmap>& GetRepresentatives (void) const; const ::std::vector<Representative>& GetRepresentatives (void) const;
private: private:
SlideSorterViewShell* mpViewShell; SlideSorterViewShell* mpViewShell;
const ::std::vector<Bitmap> maRepresentatives; const ::std::vector<Representative> maRepresentatives;
virtual void Notify (SfxBroadcaster& rBroadcaster, const SfxHint& rHint); virtual void Notify (SfxBroadcaster& rBroadcaster, const SfxHint& rHint);
}; };

View File

@@ -188,6 +188,9 @@ private:
const model::SharedPageDescriptor& rpDescriptor, const model::SharedPageDescriptor& rpDescriptor,
const double nTargetAlpha, const double nTargetAlpha,
const bool bFadeIn); const bool bFadeIn);
void AcquireLock (void);
void ReleaseLock (void);
}; };

View File

@@ -30,6 +30,7 @@
#include "model/SlsSharedPageDescriptor.hxx" #include "model/SlsSharedPageDescriptor.hxx"
#include "view/SlsILayerPainter.hxx" #include "view/SlsILayerPainter.hxx"
#include "controller/SlsTransferable.hxx"
#include <tools/gen.hxx> #include <tools/gen.hxx>
#include <vcl/bitmapex.hxx> #include <vcl/bitmapex.hxx>
@@ -109,7 +110,7 @@ private:
OutputDevice& rContent, OutputDevice& rContent,
const Size aPreviewSize, const Size aPreviewSize,
const sal_Int32 nOffset, const sal_Int32 nOffset,
const ::std::vector<Bitmap>& rPages) const; const ::std::vector<controller::Transferable::Representative>& rPages) const;
void PaintPageCount ( void PaintPageCount (
OutputDevice& rDevice, OutputDevice& rDevice,
const sal_Int32 nSelectionCount, const sal_Int32 nSelectionCount,
@@ -119,7 +120,7 @@ private:
scaled down previews of some of the selected pages. scaled down previews of some of the selected pages.
*/ */
void Create ( void Create (
const ::std::vector<Bitmap>& rPages, const ::std::vector<controller::Transferable::Representative>& rPages,
const sal_Int32 nSelectionCount); const sal_Int32 nSelectionCount);
}; };

View File

@@ -72,6 +72,21 @@ public:
*/ */
void SetTheme (const ::boost::shared_ptr<view::Theme>& rpTheme); void SetTheme (const ::boost::shared_ptr<view::Theme>& 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 <NULL/> 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: private:
const Layouter& mrLayouter; const Layouter& mrLayouter;
::boost::shared_ptr<PageObjectLayouter> mpPageObjectLayouter; ::boost::shared_ptr<PageObjectLayouter> mpPageObjectLayouter;
@@ -119,7 +134,7 @@ private:
const Size& rSize, const Size& rSize,
const Bitmap& rPreview, const Bitmap& rPreview,
const BitmapEx& rOverlay, const BitmapEx& rOverlay,
const OutputDevice& TemplateDevice) const; const OutputDevice* pReferenceDevice) const;
}; };
} } } // end of namespace sd::slidesorter::view } } } // end of namespace sd::slidesorter::view

View File

@@ -159,7 +159,7 @@ namespace {
ButtonBar::Lock::Lock (SlideSorter& rSlideSorter) ButtonBar::Lock::Lock (SlideSorter& rSlideSorter)
: mrButtonBar(rSlideSorter.GetView().GetButtonBar()) : mrButtonBar(rSlideSorter.GetView().GetButtonBar())
{ {
++mrButtonBar.mnLockCount; mrButtonBar.AcquireLock();
} }
@@ -167,7 +167,7 @@ ButtonBar::Lock::Lock (SlideSorter& rSlideSorter)
ButtonBar::Lock::~Lock (void) 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 ===================================================== //===== BackgroundTheme =====================================================
ButtonBar::BackgroundTheme::BackgroundTheme ( ButtonBar::BackgroundTheme::BackgroundTheme (

View File

@@ -36,7 +36,6 @@
#include "view/SlsPageObjectLayouter.hxx" #include "view/SlsPageObjectLayouter.hxx"
#include "view/SlsTheme.hxx" #include "view/SlsTheme.hxx"
#include "cache/SlsPageCache.hxx" #include "cache/SlsPageCache.hxx"
#include "controller/SlsTransferable.hxx"
#include "SlsFramePainter.hxx" #include "SlsFramePainter.hxx"
#include "SlsLayeredDevice.hxx" #include "SlsLayeredDevice.hxx"
#include "DrawDocShell.hxx" #include "DrawDocShell.hxx"
@@ -129,7 +128,7 @@ void InsertionIndicatorOverlay::Create (const controller::Transferable* pTransfe
void InsertionIndicatorOverlay::Create ( void InsertionIndicatorOverlay::Create (
const ::std::vector<Bitmap>& rRepresentatives, const ::std::vector<controller::Transferable::Representative>& rRepresentatives,
const sal_Int32 nSelectionCount) const sal_Int32 nSelectionCount)
{ {
view::Layouter& rLayouter (mrSlideSorter.GetView().GetLayouter()); view::Layouter& rLayouter (mrSlideSorter.GetView().GetLayouter());
@@ -195,13 +194,14 @@ Point InsertionIndicatorOverlay::PaintRepresentatives (
OutputDevice& rContent, OutputDevice& rContent,
const Size aPreviewSize, const Size aPreviewSize,
const sal_Int32 nOffset, const sal_Int32 nOffset,
const ::std::vector<Bitmap>& rRepresentatives) const const ::std::vector<controller::Transferable::Representative>& rRepresentatives) const
{ {
const Point aOffset (0,rRepresentatives.size()==1 ? -nOffset : 0); const Point aOffset (0,rRepresentatives.size()==1 ? -nOffset : 0);
// Paint the pages. // Paint the pages.
Point aPageOffset (0,0); Point aPageOffset (0,0);
double nTransparency (0); double nTransparency (0);
const BitmapEx aExclusionOverlay (mrSlideSorter.GetTheme()->GetIcon(Theme::Icon_HideSlideOverlay));
for (sal_Int32 nIndex=2; nIndex>=0; --nIndex) for (sal_Int32 nIndex=2; nIndex>=0; --nIndex)
{ {
if (rRepresentatives.size() <= sal_uInt32(nIndex)) if (rRepresentatives.size() <= sal_uInt32(nIndex))
@@ -225,15 +225,32 @@ Point InsertionIndicatorOverlay::PaintRepresentatives (
aPageOffset.X() += gnShadowBorder; aPageOffset.X() += gnShadowBorder;
aPageOffset.Y() += gnShadowBorder; aPageOffset.Y() += gnShadowBorder;
::boost::shared_ptr<cache::PageCache> pPreviewCache ( // Paint the preview.
mrSlideSorter.GetView().GetPreviewCache()); Bitmap aPreview (rRepresentatives[nIndex].maBitmap);
Bitmap aPreview (rRepresentatives[nIndex]);
const Size aSuperSampleSize( const Size aSuperSampleSize(
aPreviewSize.Width()*gnSuperScaleFactor, aPreviewSize.Width()*gnSuperScaleFactor,
aPreviewSize.Height()*gnSuperScaleFactor); aPreviewSize.Height()*gnSuperScaleFactor);
aPreview.Scale(aPreviewSize, BMP_SCALE_INTERPOLATE); aPreview.Scale(aPreviewSize, BMP_SCALE_INTERPOLATE);
rContent.DrawBitmapEx(aPageOffset, aPreview); 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. // Tone down the bitmap. The further back the darker it becomes.
Rectangle aBox ( Rectangle aBox (
aPageOffset.X(), aPageOffset.X(),

View File

@@ -591,7 +591,7 @@ Layouter::Implementation::Implementation (const SharedSdWindow& rpWindow)
mnBottomBorder(5), mnBottomBorder(5),
mnVerticalGap (10), mnVerticalGap (10),
mnHorizontalGap(10), mnHorizontalGap(10),
maMinimalSize(100,75), maMinimalSize(120,90),
maPreferredSize(200,150), maPreferredSize(200,150),
maMaximalSize(300,200), maMaximalSize(300,200),
mnMinimalColumnCount(1), mnMinimalColumnCount(1),

View File

@@ -52,6 +52,7 @@
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
#include <vcl/vclenum.hxx> #include <vcl/vclenum.hxx>
#include <vcl/virdev.hxx> #include <vcl/virdev.hxx>
#include <boost/scoped_ptr.hpp>
using namespace ::drawinglayer::primitive2d; using namespace ::drawinglayer::primitive2d;
@@ -199,6 +200,20 @@ void PageObjectPainter::PaintBackground (
const Bitmap& rBackground (GetBackgroundForState(rpDescriptor, rDevice)); const Bitmap& rBackground (GetBackgroundForState(rpDescriptor, rDevice));
rDevice.DrawBitmap(aBox.TopLeft(), rBackground); 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::Preview,
PageObjectLayouter::ModelCoordinateSystem)); PageObjectLayouter::ModelCoordinateSystem));
const bool bIsExcluded (rpDescriptor->GetVisualState().GetCurrentVisualState()
== model::VisualState::VS_Excluded);
if (mpCache != NULL) if (mpCache != NULL)
{ {
const SdrPage* pPage = rpDescriptor->GetPage(); const SdrPage* pPage = rpDescriptor->GetPage();
mpCache->SetPreciousFlag(pPage, true); mpCache->SetPreciousFlag(pPage, true);
if (bIsExcluded) const Bitmap aPreview (GetPreviewBitmap(rpDescriptor, &rDevice));
{ if ( ! aPreview.IsEmpty())
Bitmap aMarkedPreview (mpCache->GetMarkedPreviewBitmap(pPage,false)); if (aPreview.GetSizePixel() != aBox.GetSize())
if (aMarkedPreview.IsEmpty() || aMarkedPreview.GetSizePixel()!=aBox.GetSize()) rDevice.DrawBitmap(aBox.TopLeft(), aBox.GetSize(), aPreview);
{ else
aMarkedPreview = CreateMarkedPreview( rDevice.DrawBitmap(aBox.TopLeft(), aPreview);
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);
}
} }
} }
@@ -254,12 +249,16 @@ Bitmap PageObjectPainter::CreateMarkedPreview (
const Size& rSize, const Size& rSize,
const Bitmap& rPreview, const Bitmap& rPreview,
const BitmapEx& rOverlay, const BitmapEx& rOverlay,
const OutputDevice& rReferenceDevice) const const OutputDevice* pReferenceDevice) const
{ {
VirtualDevice aDevice (rReferenceDevice); ::boost::scoped_ptr<VirtualDevice> pDevice;
aDevice.SetOutputSizePixel(rSize); 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. // Paint bitmap tiled over the preview to mark it as excluded.
const sal_Int32 nIconWidth (rOverlay.GetSizePixel().Width()); const sal_Int32 nIconWidth (rOverlay.GetSizePixel().Width());
@@ -268,9 +267,44 @@ Bitmap PageObjectPainter::CreateMarkedPreview (
{ {
for (sal_Int32 nX=0; nX<rSize.Width(); nX+=nIconWidth) for (sal_Int32 nX=0; nX<rSize.Width(); nX+=nIconWidth)
for (sal_Int32 nY=0; nY<rSize.Height(); nY+=nIconHeight) for (sal_Int32 nY=0; nY<rSize.Height(); nY+=nIconHeight)
aDevice.DrawBitmapEx(Point(nX,nY), rOverlay); 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->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);
} }