summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sd/source/ui/presenter/PresenterPreviewCache.cxx6
-rw-r--r--sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx135
-rw-r--r--sd/source/ui/slidesorter/cache/SlsBitmapCache.hxx32
-rw-r--r--sd/source/ui/slidesorter/cache/SlsBitmapCompressor.cxx83
-rw-r--r--sd/source/ui/slidesorter/cache/SlsBitmapCompressor.hxx27
-rw-r--r--sd/source/ui/slidesorter/cache/SlsBitmapFactory.cxx48
-rw-r--r--sd/source/ui/slidesorter/cache/SlsBitmapFactory.hxx4
-rw-r--r--sd/source/ui/slidesorter/cache/SlsGenericPageCache.cxx70
-rw-r--r--sd/source/ui/slidesorter/cache/SlsGenericPageCache.hxx15
-rw-r--r--sd/source/ui/slidesorter/cache/SlsPageCache.cxx25
-rw-r--r--sd/source/ui/slidesorter/cache/SlsPageCacheManager.cxx10
-rw-r--r--sd/source/ui/slidesorter/cache/SlsQueueProcessor.cxx9
-rw-r--r--sd/source/ui/slidesorter/controller/SlideSorterController.cxx16
-rw-r--r--sd/source/ui/slidesorter/controller/SlsClipboard.cxx82
-rw-r--r--sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx5
-rw-r--r--sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx14
-rw-r--r--sd/source/ui/slidesorter/controller/SlsDragAndDropContext.hxx2
-rw-r--r--sd/source/ui/slidesorter/controller/SlsFocusManager.cxx14
-rw-r--r--sd/source/ui/slidesorter/controller/SlsInsertionIndicatorHandler.cxx30
-rw-r--r--sd/source/ui/slidesorter/controller/SlsListener.cxx12
-rw-r--r--sd/source/ui/slidesorter/controller/SlsPageSelector.cxx28
-rw-r--r--sd/source/ui/slidesorter/controller/SlsProperties.cxx16
-rw-r--r--sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx2
-rw-r--r--sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx1578
-rw-r--r--sd/source/ui/slidesorter/controller/SlsSelectionObserver.cxx36
-rw-r--r--sd/source/ui/slidesorter/controller/SlsSlotManager.cxx67
-rw-r--r--sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx43
-rw-r--r--sd/source/ui/slidesorter/inc/cache/SlsCacheContext.hxx4
-rw-r--r--sd/source/ui/slidesorter/inc/cache/SlsPageCache.hxx13
-rw-r--r--sd/source/ui/slidesorter/inc/cache/SlsPageCacheManager.hxx5
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx1
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsClipboard.hxx6
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsFocusManager.hxx12
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsInsertionIndicatorHandler.hxx8
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsPageSelector.hxx3
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsProperties.hxx3
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsSelectionFunction.hxx86
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsSelectionManager.hxx25
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsSelectionObserver.hxx7
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsVisibleAreaManager.hxx17
-rw-r--r--sd/source/ui/slidesorter/inc/model/SlsVisualState.hxx8
-rw-r--r--sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx16
-rw-r--r--sd/source/ui/slidesorter/inc/view/SlsButtonBar.hxx322
-rw-r--r--sd/source/ui/slidesorter/inc/view/SlsLayouter.hxx8
-rw-r--r--sd/source/ui/slidesorter/inc/view/SlsPageObjectLayouter.hxx28
-rw-r--r--sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx43
-rw-r--r--sd/source/ui/slidesorter/inc/view/SlsResource.hrc51
-rw-r--r--sd/source/ui/slidesorter/inc/view/SlsTheme.hxx82
-rw-r--r--sd/source/ui/slidesorter/model/SlideSorterModel.cxx7
-rw-r--r--sd/source/ui/slidesorter/model/SlsVisualState.cxx20
-rw-r--r--sd/source/ui/slidesorter/shell/SlsDebugDialog.cxx221
-rw-r--r--sd/source/ui/slidesorter/view/SlideSorterView.cxx184
-rw-r--r--sd/source/ui/slidesorter/view/SlsButtonBar.cxx960
-rw-r--r--sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx55
-rw-r--r--sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx6
-rw-r--r--sd/source/ui/slidesorter/view/SlsLayouter.cxx29
-rw-r--r--sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx64
-rw-r--r--sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx462
-rw-r--r--sd/source/ui/slidesorter/view/SlsResource.src131
-rw-r--r--sd/source/ui/slidesorter/view/SlsTheme.cxx290
-rw-r--r--sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx3
-rw-r--r--sd/source/ui/slidesorter/view/SlsViewCacheContext.hxx3
-rw-r--r--sd/source/ui/slidesorter/view/makefile.mk1
63 files changed, 3784 insertions, 1809 deletions
diff --git a/sd/source/ui/presenter/PresenterPreviewCache.cxx b/sd/source/ui/presenter/PresenterPreviewCache.cxx
index 59af1fc34c7d..f0d0002c04d0 100644
--- a/sd/source/ui/presenter/PresenterPreviewCache.cxx
+++ b/sd/source/ui/presenter/PresenterPreviewCache.cxx
@@ -64,7 +64,7 @@ public:
// CacheContext
virtual void NotifyPreviewCreation (
- CacheKey aKey, const ::boost::shared_ptr<BitmapEx>& rPreview);
+ CacheKey aKey, const PreviewType& rPreview);
virtual bool IsIdle (void);
virtual bool IsVisible (CacheKey aKey);
virtual const SdrPage* GetPage (CacheKey aKey);
@@ -209,7 +209,7 @@ Reference<rendering::XBitmap> SAL_CALL PresenterPreviewCache::getSlidePreview (
if (pPage == NULL)
throw RuntimeException();
- const BitmapEx aPreview (mpCache->GetPreviewBitmap(pPage,true));
+ const BitmapEx aPreview (mpCache->GetPreviewBitmap(pPage,true).GetBitmap());
if (aPreview.IsEmpty())
return NULL;
else
@@ -368,7 +368,7 @@ void PresenterPreviewCache::PresenterCacheContext::RemovePreviewCreationNotifyLi
void PresenterPreviewCache::PresenterCacheContext::NotifyPreviewCreation (
CacheKey aKey,
- const ::boost::shared_ptr<BitmapEx>& rPreview)
+ const PreviewType& rPreview)
{
(void)rPreview;
diff --git a/sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx b/sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx
index 47818b73d193..315496355658 100644
--- a/sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx
+++ b/sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx
@@ -33,7 +33,6 @@
#include "SlsBitmapCompressor.hxx"
#include "SlsCacheConfiguration.hxx"
-#include "taskpane/SlideSorterCacheDisplay.hxx"
#include "sdpage.hxx"
#include "drawdoc.hxx"
@@ -55,8 +54,7 @@ namespace sd { namespace slidesorter { namespace cache {
class BitmapCache::CacheEntry
{
public:
- CacheEntry(const ::boost::shared_ptr<BitmapEx>& rpBitmap,
- sal_Int32 nLastAccessTime, bool bIsPrecious);
+ CacheEntry(const PreviewType& rBitmap, sal_Int32 nLastAccessTime, bool bIsPrecious);
CacheEntry(sal_Int32 nLastAccessTime, bool bIsPrecious);
~CacheEntry (void) {};
inline void Recycle (const CacheEntry& rEntry);
@@ -68,18 +66,26 @@ public:
void SetUpToDate (bool bIsUpToDate) { mbIsUpToDate = bIsUpToDate; }
sal_Int32 GetAccessTime (void) const { return mnLastAccessTime; }
void SetAccessTime (sal_Int32 nAccessTime) { mnLastAccessTime = nAccessTime; }
- ::boost::shared_ptr<BitmapEx> GetPreview (void) const { return mpPreview; }
- inline void SetPreview (const ::boost::shared_ptr<BitmapEx>& rpPreview);
+
+ PreviewType GetPreview (void) const { return maPreview; }
+ inline void SetPreview (const PreviewType& rPreview);
bool HasPreview (void) const;
+
+ PreviewType GetMarkedPreview (void) const { return maMarkedPreview; }
+ inline void SetMarkedPreview (const PreviewType& rMarkePreview);
+ bool HasMarkedPreview (void) const;
+
bool HasReplacement (void) const { return (mpReplacement.get() != NULL); }
inline bool HasLosslessReplacement (void) const;
- void Clear (void) { mpPreview.reset(); mpReplacement.reset(); mpCompressor.reset(); }
+ void Clear (void) { maPreview.GetBitmap().SetEmpty(); maMarkedPreview.GetBitmap().SetEmpty();
+ mpReplacement.reset(); mpCompressor.reset(); }
void Invalidate (void) { mpReplacement.reset(); mpCompressor.reset(); mbIsUpToDate = false; }
bool IsPrecious (void) const { return mbIsPrecious; }
void SetPrecious (bool bIsPrecious) { mbIsPrecious = bIsPrecious; }
private:
- ::boost::shared_ptr<BitmapEx> mpPreview;
+ PreviewType maPreview;
+ PreviewType maMarkedPreview;
::boost::shared_ptr<BitmapReplacement> mpReplacement;
::boost::shared_ptr<BitmapCompressor> mpCompressor;
Size maBitmapSize;
@@ -229,7 +235,7 @@ bool BitmapCache::BitmapIsUpToDate (const CacheKey& rKey)
-::boost::shared_ptr<BitmapEx> BitmapCache::GetBitmap (const CacheKey& rKey)
+PreviewType BitmapCache::GetBitmap (const CacheKey& rKey)
{
::osl::MutexGuard aGuard (maMutex);
@@ -238,10 +244,9 @@ bool BitmapCache::BitmapIsUpToDate (const CacheKey& rKey)
{
// Create an empty bitmap for the given key that acts as placeholder
// until we are given the real one. Mark it as not being up to date.
- SetBitmap (rKey, ::boost::shared_ptr<BitmapEx>(new BitmapEx()), false);
+ SetBitmap(rKey, PreviewType(), false);
iEntry = mpBitmapContainer->find(rKey);
iEntry->second.SetUpToDate(false);
- SSCD_SET_UPTODATE(iEntry->first,false);
}
else
{
@@ -261,6 +266,23 @@ bool BitmapCache::BitmapIsUpToDate (const CacheKey& rKey)
+PreviewType BitmapCache::GetMarkedBitmap (const CacheKey& rKey)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ CacheBitmapContainer::iterator iEntry (mpBitmapContainer->find(rKey));
+ if (iEntry != mpBitmapContainer->end())
+ {
+ iEntry->second.SetAccessTime(mnCurrentAccessTime++);
+ return iEntry->second.GetMarkedPreview();
+ }
+ else
+ return PreviewType();
+}
+
+
+
+
void BitmapCache::ReleaseBitmap (const CacheKey& rKey)
{
::osl::MutexGuard aGuard (maMutex);
@@ -276,7 +298,7 @@ void BitmapCache::ReleaseBitmap (const CacheKey& rKey)
-void BitmapCache::InvalidateBitmap (const CacheKey& rKey)
+bool BitmapCache::InvalidateBitmap (const CacheKey& rKey)
{
::osl::MutexGuard aGuard (maMutex);
@@ -284,7 +306,6 @@ void BitmapCache::InvalidateBitmap (const CacheKey& rKey)
if (iEntry != mpBitmapContainer->end())
{
iEntry->second.SetUpToDate(false);
- SSCD_SET_UPTODATE(iEntry->first,false);
// When there is a preview then we release the replacement. The
// preview itself is kept until a new one is created.
@@ -292,10 +313,12 @@ void BitmapCache::InvalidateBitmap (const CacheKey& rKey)
{
UpdateCacheSize(iEntry->second, REMOVE);
iEntry->second.Invalidate();
- SSCD_SET_UPTODATE(iEntry->first,false);
UpdateCacheSize(iEntry->second, ADD);
}
+ return true;
}
+ else
+ return false;
}
@@ -309,7 +332,6 @@ void BitmapCache::InvalidateCache (void)
for (iEntry=mpBitmapContainer->begin(); iEntry!=mpBitmapContainer->end(); ++iEntry)
{
iEntry->second.Invalidate();
- SSCD_SET_UPTODATE(iEntry->first,false);
}
ReCalculateTotalCacheSize();
}
@@ -319,7 +341,7 @@ void BitmapCache::InvalidateCache (void)
void BitmapCache::SetBitmap (
const CacheKey& rKey,
- const ::boost::shared_ptr<BitmapEx>& rpPreview,
+ const PreviewType& rPreview,
bool bIsPrecious)
{
::osl::MutexGuard aGuard (maMutex);
@@ -328,16 +350,15 @@ void BitmapCache::SetBitmap (
if (iEntry != mpBitmapContainer->end())
{
UpdateCacheSize(iEntry->second, REMOVE);
- iEntry->second.SetPreview(rpPreview);
+ iEntry->second.SetPreview(rPreview);
iEntry->second.SetUpToDate(true);
- SSCD_SET_UPTODATE(iEntry->first,true);
iEntry->second.SetAccessTime(mnCurrentAccessTime++);
}
else
{
iEntry = mpBitmapContainer->insert(CacheBitmapContainer::value_type (
rKey,
- CacheEntry (rpPreview, mnCurrentAccessTime++, bIsPrecious))
+ CacheEntry(rPreview, mnCurrentAccessTime++, bIsPrecious))
).first;
}
@@ -348,6 +369,25 @@ void BitmapCache::SetBitmap (
+void BitmapCache::SetMarkedBitmap (
+ const CacheKey& rKey,
+ const PreviewType& rPreview)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ CacheBitmapContainer::iterator iEntry (mpBitmapContainer->find(rKey));
+ if (iEntry != mpBitmapContainer->end())
+ {
+ UpdateCacheSize(iEntry->second, REMOVE);
+ iEntry->second.SetMarkedPreview(rPreview);
+ iEntry->second.SetAccessTime(mnCurrentAccessTime++);
+ UpdateCacheSize(iEntry->second, ADD);
+ }
+}
+
+
+
+
bool BitmapCache::IsPrecious (const CacheKey& rKey)
{
::osl::MutexGuard aGuard (maMutex);
@@ -380,9 +420,7 @@ void BitmapCache::SetPrecious (const CacheKey& rKey, bool bIsPrecious)
{
iEntry = mpBitmapContainer->insert(CacheBitmapContainer::value_type (
rKey,
- CacheEntry (
- ::boost::shared_ptr<BitmapEx>(),
- mnCurrentAccessTime++, bIsPrecious))
+ CacheEntry(PreviewType(), mnCurrentAccessTime++, bIsPrecious))
).first;
UpdateCacheSize(iEntry->second, ADD);
}
@@ -540,7 +578,8 @@ void BitmapCache::UpdateCacheSize (const CacheEntry& rEntry, CacheOperation eOpe
BitmapCache::CacheEntry::CacheEntry(
sal_Int32 nLastAccessTime,
bool bIsPrecious)
- : mpPreview(),
+ : maPreview(),
+ maMarkedPreview(),
mbIsUpToDate(true),
mnLastAccessTime(nLastAccessTime),
mbIsPrecious(bIsPrecious)
@@ -551,10 +590,11 @@ BitmapCache::CacheEntry::CacheEntry(
BitmapCache::CacheEntry::CacheEntry(
- const ::boost::shared_ptr<BitmapEx>& rpPreview,
+ const PreviewType& rPreview,
sal_Int32 nLastAccessTime,
bool bIsPrecious)
- : mpPreview(rpPreview),
+ : maPreview(rPreview),
+ maMarkedPreview(),
mbIsUpToDate(true),
mnLastAccessTime(nLastAccessTime),
mbIsPrecious(bIsPrecious)
@@ -569,7 +609,8 @@ inline void BitmapCache::CacheEntry::Recycle (const CacheEntry& rEntry)
if ((rEntry.HasPreview() || rEntry.HasLosslessReplacement())
&& ! (HasPreview() || HasLosslessReplacement()))
{
- mpPreview = rEntry.mpPreview;
+ maPreview = rEntry.maPreview;
+ maMarkedPreview = rEntry.maMarkedPreview;
mpReplacement = rEntry.mpReplacement;
mpCompressor = rEntry.mpCompressor;
mnLastAccessTime = rEntry.mnLastAccessTime;
@@ -583,8 +624,8 @@ inline void BitmapCache::CacheEntry::Recycle (const CacheEntry& rEntry)
inline sal_Int32 BitmapCache::CacheEntry::GetMemorySize (void) const
{
sal_Int32 nSize (0);
- if (mpPreview.get() != NULL)
- nSize += mpPreview->GetSizeBytes();
+ nSize += maPreview.GetBitmap().GetSizeBytes();
+ nSize += maMarkedPreview.GetBitmap().GetSizeBytes();
if (mpReplacement.get() != NULL)
nSize += mpReplacement->GetMemorySize();
return nSize;
@@ -595,14 +636,14 @@ inline sal_Int32 BitmapCache::CacheEntry::GetMemorySize (void) const
void BitmapCache::CacheEntry::Compress (const ::boost::shared_ptr<BitmapCompressor>& rpCompressor)
{
- if (mpPreview.get() != NULL)
+ if ( ! maPreview.IsEmpty())
{
if (mpReplacement.get() == NULL)
{
- mpReplacement = rpCompressor->Compress(mpPreview);
+ mpReplacement = rpCompressor->Compress(maPreview);
#ifdef VERBOSE
- sal_uInt32 nOldSize (mpPreview->GetSizeBytes());
+ sal_uInt32 nOldSize (maPreview.GetSizeBytes());
sal_uInt32 nNewSize (mpReplacement.get()!=NULL ? mpReplacement->GetMemorySize() : 0);
if (nOldSize == 0)
nOldSize = 1;
@@ -617,7 +658,8 @@ void BitmapCache::CacheEntry::Compress (const ::boost::shared_ptr<BitmapCompress
mpCompressor = rpCompressor;
}
- mpPreview.reset();
+ maPreview.GetBitmap().SetEmpty();
+ maMarkedPreview.GetBitmap().SetEmpty();
}
}
@@ -626,9 +668,10 @@ void BitmapCache::CacheEntry::Compress (const ::boost::shared_ptr<BitmapCompress
inline void BitmapCache::CacheEntry::Decompress (void)
{
- if (mpReplacement.get()!=NULL && mpCompressor.get()!=NULL && mpPreview.get()==NULL)
+ if (mpReplacement.get()!=NULL && mpCompressor.get()!=NULL && maPreview.IsEmpty())
{
- mpPreview = mpCompressor->Decompress(*mpReplacement);
+ maPreview = mpCompressor->Decompress(*mpReplacement);
+ maMarkedPreview.GetBitmap().SetEmpty();
if ( ! mpCompressor->IsLossless())
mbIsUpToDate = false;
}
@@ -636,9 +679,10 @@ inline void BitmapCache::CacheEntry::Decompress (void)
-inline void BitmapCache::CacheEntry::SetPreview (const ::boost::shared_ptr<BitmapEx>& rpPreview)
+inline void BitmapCache::CacheEntry::SetPreview (const PreviewType& rPreview)
{
- mpPreview = rpPreview;
+ maPreview = rPreview;
+ maMarkedPreview.GetBitmap().SetEmpty();
mpReplacement.reset();
mpCompressor.reset();
}
@@ -648,10 +692,23 @@ inline void BitmapCache::CacheEntry::SetPreview (const ::boost::shared_ptr<Bitma
bool BitmapCache::CacheEntry::HasPreview (void) const
{
- if (mpPreview.get() != NULL)
- return mpPreview->GetSizePixel().Width()>0 && mpPreview->GetSizePixel().Height()>0;
- else
- return false;
+ return ! maPreview.IsEmpty();
+}
+
+
+
+
+inline void BitmapCache::CacheEntry::SetMarkedPreview (const PreviewType& rMarkedPreview)
+{
+ maMarkedPreview = rMarkedPreview;
+}
+
+
+
+
+bool BitmapCache::CacheEntry::HasMarkedPreview (void) const
+{
+ return ! maMarkedPreview.IsEmpty();
}
diff --git a/sd/source/ui/slidesorter/cache/SlsBitmapCache.hxx b/sd/source/ui/slidesorter/cache/SlsBitmapCache.hxx
index 2c8fbc24b626..d35db6b542da 100644
--- a/sd/source/ui/slidesorter/cache/SlsBitmapCache.hxx
+++ b/sd/source/ui/slidesorter/cache/SlsBitmapCache.hxx
@@ -30,10 +30,11 @@
class SdrPage;
+#include "cache/SlsPreviewType.hxx"
#include <vcl/bitmapex.hxx>
#include <osl/mutex.hxx>
-#include <memory>
#include <boost/shared_ptr.hpp>
+#include <boost/scoped_ptr.hpp>
#include <hash_map>
namespace sd { namespace slidesorter { namespace cache {
@@ -48,6 +49,10 @@ class BitmapCompressor;
compaction algorithms to determine which previews may be compressed or
even discarded and which have to remain in their original form. The
precious flag is usually set for the visible previews.
+
+ Additionally to the actual preview there is an optional marked preview.
+ This is used for slides excluded from the slide show which have a preview
+ that shows a mark (some sort of bitmap overlay) to that effect.
*/
class BitmapCache
{
@@ -106,16 +111,25 @@ public:
/** Return the preview bitmap for the given contact object.
*/
- ::boost::shared_ptr<BitmapEx> GetBitmap (const CacheKey& rKey);
+ PreviewType GetBitmap (const CacheKey& rKey);
+
+ /** Return the marked preview bitmap for the given contact object.
+ */
+ PreviewType GetMarkedBitmap (const CacheKey& rKey);
/** Release the reference to the preview bitmap that is associated with
the given key.
*/
void ReleaseBitmap (const CacheKey& rKey);
- /** Mark the specified preview bitmap as not being up-to-date anymore.
+ /** Mark the specified preview bitmap as not being up-to-date
+ anymore.
+ @return
+ When the key references a page in the cache then
+ return <TRUE/>. When the key is not known then <FALSE/>
+ is returned.
*/
- void InvalidateBitmap (const CacheKey& rKey);
+ bool InvalidateBitmap (const CacheKey& rKey);
/** Mark all preview bitmaps as not being up-to-date anymore.
*/
@@ -125,9 +139,15 @@ public:
*/
void SetBitmap (
const CacheKey& rKey,
- const ::boost::shared_ptr<BitmapEx>& rpPreview,
+ const PreviewType& rPreview,
bool bIsPrecious);
+ /** Add or replace a marked bitmap for the given key.
+ */
+ void SetMarkedBitmap (
+ const CacheKey& rKey,
+ const PreviewType& rPreview);
+
/** Return whether the specified preview bitmap has been marked as
precious.
*/
@@ -175,7 +195,7 @@ public:
private:
mutable ::osl::Mutex maMutex;
- ::std::auto_ptr<CacheBitmapContainer> mpBitmapContainer;
+ ::boost::scoped_ptr<CacheBitmapContainer> mpBitmapContainer;
/** Total size of bytes that are occupied by bitmaps in the cache for
whom the slides are currently not inside the visible area.
diff --git a/sd/source/ui/slidesorter/cache/SlsBitmapCompressor.cxx b/sd/source/ui/slidesorter/cache/SlsBitmapCompressor.cxx
index 86fc72885414..7a9b5d80882a 100644
--- a/sd/source/ui/slidesorter/cache/SlsBitmapCompressor.cxx
+++ b/sd/source/ui/slidesorter/cache/SlsBitmapCompressor.cxx
@@ -47,37 +47,24 @@ class NoBitmapCompression::DummyReplacement
: public BitmapReplacement
{
public:
- ::boost::shared_ptr<BitmapEx> mpPreview;
+ PreviewType maPreview;
Size maOriginalSize;
- DummyReplacement (const ::boost::shared_ptr<BitmapEx>& rpPreview) : mpPreview(rpPreview)
- {
- }
-
- virtual ~DummyReplacement();
-
- virtual sal_Int32 GetMemorySize (void) const;
+ DummyReplacement (const PreviewType& rPreview) : maPreview(rPreview) { }
+ virtual ~DummyReplacement(void) {}
+ virtual sal_Int32 GetMemorySize (void) const { return maPreview.GetBitmap().GetSizeBytes(); }
};
-NoBitmapCompression::DummyReplacement::~DummyReplacement()
-{
-}
-sal_Int32 NoBitmapCompression::DummyReplacement::GetMemorySize (void) const
-{
- return mpPreview->GetSizeBytes();
-}
-::boost::shared_ptr<BitmapReplacement> NoBitmapCompression::Compress (
- const ::boost::shared_ptr<BitmapEx>& rpBitmap) const
+::boost::shared_ptr<BitmapReplacement> NoBitmapCompression::Compress (const PreviewType& rBitmap) const
{
- return ::boost::shared_ptr<BitmapReplacement>(new DummyReplacement(rpBitmap));
+ return ::boost::shared_ptr<BitmapReplacement>(new DummyReplacement(rBitmap));
}
-::boost::shared_ptr<BitmapEx> NoBitmapCompression::Decompress (
- const BitmapReplacement& rBitmapData) const
+PreviewType NoBitmapCompression::Decompress (const BitmapReplacement& rBitmapData) const
{
- return dynamic_cast<const DummyReplacement&>(rBitmapData).mpPreview;
+ return dynamic_cast<const DummyReplacement&>(rBitmapData).maPreview;
}
@@ -93,8 +80,7 @@ bool NoBitmapCompression::IsLossless (void) const
//===== CompressionByDeletion =================================================
-::boost::shared_ptr<BitmapReplacement> CompressionByDeletion::Compress (
- const ::boost::shared_ptr<BitmapEx>& ) const
+::boost::shared_ptr<BitmapReplacement> CompressionByDeletion::Compress (const PreviewType& ) const
{
return ::boost::shared_ptr<BitmapReplacement>();
}
@@ -102,12 +88,11 @@ bool NoBitmapCompression::IsLossless (void) const
-::boost::shared_ptr<BitmapEx> CompressionByDeletion::Decompress (
- const BitmapReplacement& ) const
+PreviewType CompressionByDeletion::Decompress (const BitmapReplacement& ) const
{
// Return a NULL pointer. This will eventually lead to a request for
// the creation of a new one.
- return ::boost::shared_ptr<BitmapEx>();
+ return PreviewType();
}
@@ -128,11 +113,10 @@ bool CompressionByDeletion::IsLossless (void) const
class ResolutionReduction::ResolutionReducedReplacement : public BitmapReplacement
{
public:
- ::boost::shared_ptr<BitmapEx> mpPreview;
+ PreviewType maPreview;
Size maOriginalSize;
virtual ~ResolutionReducedReplacement();
-
virtual sal_Int32 GetMemorySize (void) const;
};
@@ -142,23 +126,20 @@ ResolutionReduction::ResolutionReducedReplacement::~ResolutionReducedReplacement
sal_Int32 ResolutionReduction::ResolutionReducedReplacement::GetMemorySize (void) const
{
- if (mpPreview.get() != NULL)
- return mpPreview->GetSizeBytes();
- else
- return 0;
+ return maPreview.GetBitmap().GetSizeBytes();
}
::boost::shared_ptr<BitmapReplacement> ResolutionReduction::Compress (
- const ::boost::shared_ptr<BitmapEx>& rpBitmap) const
+ const PreviewType& rBitmap) const
{
ResolutionReducedReplacement* pResult = new ResolutionReducedReplacement();
- pResult->mpPreview.reset(new BitmapEx(*rpBitmap));
- Size aSize (rpBitmap->GetSizePixel());
+ pResult->maPreview = rBitmap;
+ Size aSize (rBitmap.GetBitmap().GetSizePixel());
pResult->maOriginalSize = aSize;
if (aSize.Width()>0 && aSize.Width()<mnWidth)
{
int nHeight = aSize.Height() * mnWidth / aSize.Width() ;
- pResult->mpPreview->Scale(Size(mnWidth,nHeight));
+ pResult->maPreview.GetBitmap().Scale(Size(mnWidth,nHeight));
}
return ::boost::shared_ptr<BitmapReplacement>(pResult);
@@ -167,22 +148,21 @@ sal_Int32 ResolutionReduction::ResolutionReducedReplacement::GetMemorySize (void
-::boost::shared_ptr<BitmapEx> ResolutionReduction::Decompress (
- const BitmapReplacement& rBitmapData) const
+PreviewType ResolutionReduction::Decompress (const BitmapReplacement& rBitmapData) const
{
- ::boost::shared_ptr<BitmapEx> pResult;
+ PreviewType aResult;
const ResolutionReducedReplacement* pData (
dynamic_cast<const ResolutionReducedReplacement*>(&rBitmapData));
- if (pData->mpPreview.get() != NULL)
+ if ( ! pData->maPreview.GetBitmap().IsEmpty())
{
- pResult.reset(new BitmapEx(*pData->mpPreview));
+ aResult = pData->maPreview;
if (pData->maOriginalSize.Width() > mnWidth)
- pResult->Scale(pData->maOriginalSize);
+ aResult.GetBitmap().Scale(pData->maOriginalSize);
}
- return pResult;
+ return aResult;
}
@@ -223,15 +203,14 @@ public:
-::boost::shared_ptr<BitmapReplacement> PngCompression::Compress (
- const ::boost::shared_ptr<BitmapEx>& rpBitmap) const
+::boost::shared_ptr<BitmapReplacement> PngCompression::Compress (const PreviewType& rBitmap) const
{
- ::vcl::PNGWriter aWriter (*rpBitmap);
+ ::vcl::PNGWriter aWriter (rBitmap.GetBitmap());
SvMemoryStream aStream (32768, 32768);
aWriter.Write(aStream);
PngReplacement* pResult = new PngReplacement();
- pResult->maImageSize = rpBitmap->GetSizePixel();
+ pResult->maImageSize = rBitmap.GetBitmap().GetSizePixel();
pResult->mnDataSize = aStream.Tell();
pResult->mpData = new char[pResult->mnDataSize];
memcpy(pResult->mpData, aStream.GetData(), pResult->mnDataSize);
@@ -242,21 +221,19 @@ public:
-::boost::shared_ptr<BitmapEx> PngCompression::Decompress (
+PreviewType PngCompression::Decompress (
const BitmapReplacement& rBitmapData) const
{
- BitmapEx* pResult = NULL;
+ PreviewType aResult;
const PngReplacement* pData (dynamic_cast<const PngReplacement*>(&rBitmapData));
if (pData != NULL)
{
SvMemoryStream aStream (pData->mpData, pData->mnDataSize, STREAM_READ);
::vcl::PNGReader aReader (aStream);
- pResult = new BitmapEx(aReader.Read());
+ aResult = PreviewType::Create(aReader.Read().GetBitmap());
}
-// sal_Int32 nRatio ((100L * (ULONG)pResult->GetSizeBytes()) / (ULONG)pData->mnDataSize);
-
- return ::boost::shared_ptr<BitmapEx>(pResult);
+ return aResult;
}
diff --git a/sd/source/ui/slidesorter/cache/SlsBitmapCompressor.hxx b/sd/source/ui/slidesorter/cache/SlsBitmapCompressor.hxx
index cd564ddddcfd..94af70dce2b2 100644
--- a/sd/source/ui/slidesorter/cache/SlsBitmapCompressor.hxx
+++ b/sd/source/ui/slidesorter/cache/SlsBitmapCompressor.hxx
@@ -28,11 +28,11 @@
#ifndef SD_SLIDESORTER_BITMAP_COMPRESSOR_HXX
#define SD_SLIDESORTER_BITMAP_COMPRESSOR_HXX
+#include "cache/SlsPreviewType.hxx"
#include <sal/types.h>
#include <tools/gen.hxx>
#include <boost/shared_ptr.hpp>
-class BitmapEx;
namespace sd { namespace slidesorter { namespace cache {
@@ -48,8 +48,7 @@ public:
/** Compress the given bitmap into a replacement format that is specific
to the compressor class.
*/
- virtual ::boost::shared_ptr<BitmapReplacement> Compress (
- const ::boost::shared_ptr<BitmapEx>& rpBitmap) const = 0;
+ virtual ::boost::shared_ptr<BitmapReplacement> Compress (const PreviewType& rBitmap) const = 0;
/** Decompress the given replacement data into a preview bitmap.
Depending on the compression technique the returned bitmap may
@@ -58,7 +57,7 @@ public:
task of the caller to create a new preview bitmap if the returned
one is not as desired.
*/
- virtual ::boost::shared_ptr<BitmapEx> Decompress (const BitmapReplacement& rBitmapData)const=0;
+ virtual PreviewType Decompress (const BitmapReplacement& rBitmapData)const=0;
/** Return whether the compression and decompression is lossless. This
value is used by the caller of Decompress() to decide whether to use
@@ -91,9 +90,8 @@ class NoBitmapCompression
{
class DummyReplacement;
public:
- virtual ::boost::shared_ptr<BitmapReplacement> Compress (
- const ::boost::shared_ptr<BitmapEx>& rpBitmap) const;
- virtual ::boost::shared_ptr<BitmapEx> Decompress (const BitmapReplacement& rBitmapData) const;
+ virtual ::boost::shared_ptr<BitmapReplacement> Compress (const PreviewType& rpBitmap) const;
+ virtual PreviewType Decompress (const BitmapReplacement& rBitmapData) const;
virtual bool IsLossless (void) const;
};
@@ -109,9 +107,8 @@ class CompressionByDeletion
: public BitmapCompressor
{
public:
- virtual ::boost::shared_ptr<BitmapReplacement> Compress (
- const ::boost::shared_ptr<BitmapEx>& rpBitmap) const;
- virtual ::boost::shared_ptr<BitmapEx> Decompress (const BitmapReplacement& rBitmapData) const;
+ virtual ::boost::shared_ptr<BitmapReplacement> Compress (const PreviewType& rBitmap) const;
+ virtual PreviewType Decompress (const BitmapReplacement& rBitmapData) const;
virtual bool IsLossless (void) const;
};
@@ -129,11 +126,10 @@ class ResolutionReduction
class ResolutionReducedReplacement;
static const sal_Int32 mnWidth = 100;
public:
- virtual ::boost::shared_ptr<BitmapReplacement> Compress (
- const ::boost::shared_ptr<BitmapEx>& rpBitmap) const;
+ virtual ::boost::shared_ptr<BitmapReplacement> Compress (const PreviewType& rpBitmap) const;
/** Scale the replacement bitmap up to the original size.
*/
- virtual ::boost::shared_ptr<BitmapEx> Decompress (const BitmapReplacement& rBitmapData) const;
+ virtual PreviewType Decompress (const BitmapReplacement& rBitmapData) const;
virtual bool IsLossless (void) const;
};
@@ -148,9 +144,8 @@ class PngCompression
{
class PngReplacement;
public:
- virtual ::boost::shared_ptr<BitmapReplacement> Compress (
- const ::boost::shared_ptr<BitmapEx>& rpBitmap) const;
- virtual ::boost::shared_ptr<BitmapEx> Decompress (const BitmapReplacement& rBitmapData) const;
+ virtual ::boost::shared_ptr<BitmapReplacement> Compress (const PreviewType& rBitmap) const;
+ virtual PreviewType Decompress (const BitmapReplacement& rBitmapData) const;
virtual bool IsLossless (void) const;
};
diff --git a/sd/source/ui/slidesorter/cache/SlsBitmapFactory.cxx b/sd/source/ui/slidesorter/cache/SlsBitmapFactory.cxx
index c403dfb407da..d7ffe735d204 100644
--- a/sd/source/ui/slidesorter/cache/SlsBitmapFactory.cxx
+++ b/sd/source/ui/slidesorter/cache/SlsBitmapFactory.cxx
@@ -43,6 +43,8 @@
#include <vcl/pngwrite.hxx>
const static sal_Int32 gnSuperSampleFactor (2);
+const static bool gbAllowSuperSampling (false);
+
namespace sd { namespace slidesorter { namespace view {
class SlideSorterView;
@@ -66,59 +68,25 @@ BitmapFactory::~BitmapFactory (void)
-::boost::shared_ptr<BitmapEx> BitmapFactory::CreateBitmap (
+PreviewType BitmapFactory::CreateBitmap (
const SdPage& rPage,
const Size& rPixelSize,
const bool bDoSuperSampling)
{
- (void)bDoSuperSampling;
Size aSize (rPixelSize);
- bool bDo (false);//bDoSuperSampling);
- if (bDo)
+ if (bDoSuperSampling && gbAllowSuperSampling)
{
aSize.Width() *= gnSuperSampleFactor;
aSize.Height() *= gnSuperSampleFactor;
}
- const Image aPreview (maRenderer.RenderPage (&rPage, aSize, String()));
-
- ::boost::shared_ptr<BitmapEx> pPreview (new BitmapEx(aPreview.GetBitmapEx()));
- if (bDo)
+ Bitmap aPreview (maRenderer.RenderPage (&rPage, aSize, String()).GetBitmapEx().GetBitmap());
+ if (bDoSuperSampling && gbAllowSuperSampling)
{
-#if 1
- const sal_Int32 nSuperSampleCount (gnSuperSampleFactor * gnSuperSampleFactor);
- BitmapReadAccess* pRA = pPreview->GetBitmap().AcquireReadAccess();
- Bitmap aBitmap (rPixelSize, pPreview->GetBitCount());
- BitmapWriteAccess* pWA = aBitmap.AcquireWriteAccess();
- const sal_Int32 nWidth (pRA->Width());
- const sal_Int32 nHeight (pRA->Height());
- for (sal_Int32 nY=0; nY<nHeight; nY+=gnSuperSampleFactor)
- for (sal_Int32 nX=0; nX<nWidth; nX+=gnSuperSampleFactor)
- {
- sal_Int32 nRed (0);
- sal_Int32 nGreen (0);
- sal_Int32 nBlue (0);
- for (sal_Int32 nV=0; nV<gnSuperSampleFactor; ++nV)
- for (sal_Int32 nU=0; nU<gnSuperSampleFactor; ++nU)
- {
- const BitmapColor aColor (pRA->GetColor(nY+nV, nX+nU));
- nRed += aColor.GetRed();
- nGreen += aColor.GetGreen();
- nBlue += aColor.GetBlue();
- }
- pWA->SetPixel(nY/gnSuperSampleFactor, nX/gnSuperSampleFactor,
- BitmapColor(
- nRed/nSuperSampleCount,
- nGreen/nSuperSampleCount,
- nBlue/nSuperSampleCount));
- }
- pPreview.reset(new BitmapEx(aBitmap));
-#else
- pPreview->Scale(rPixelSize, BMP_SCALE_INTERPOLATE);
-#endif
+ aPreview.Scale(rPixelSize, BMP_SCALE_INTERPOLATE);
}
- return pPreview;
+ return PreviewType::Create(aPreview);
}
diff --git a/sd/source/ui/slidesorter/cache/SlsBitmapFactory.hxx b/sd/source/ui/slidesorter/cache/SlsBitmapFactory.hxx
index 74ed687a312d..3a24cf51f0ae 100644
--- a/sd/source/ui/slidesorter/cache/SlsBitmapFactory.hxx
+++ b/sd/source/ui/slidesorter/cache/SlsBitmapFactory.hxx
@@ -29,9 +29,9 @@
#define SD_SLIDESORTER_PREVIEW_BITMAP_FACTORY_HXX
#include "PreviewRenderer.hxx"
+#include "cache/SlsPreviewType.hxx"
#include <boost/shared_ptr.hpp>
-class BitmapEx;
class SdPage;
class Size;
@@ -50,7 +50,7 @@ public:
BitmapFactory (void);
~BitmapFactory (void);
- ::boost::shared_ptr<BitmapEx> CreateBitmap (
+ PreviewType CreateBitmap (
const SdPage& rPage,
const Size& rPixelSize,
const bool bDoSuperSampling);
diff --git a/sd/source/ui/slidesorter/cache/SlsGenericPageCache.cxx b/sd/source/ui/slidesorter/cache/SlsGenericPageCache.cxx
index c2c3985a414a..01e15b5dd8b1 100644
--- a/sd/source/ui/slidesorter/cache/SlsGenericPageCache.cxx
+++ b/sd/source/ui/slidesorter/cache/SlsGenericPageCache.cxx
@@ -131,32 +131,32 @@ void GenericPageCache::ChangePreviewSize (
-BitmapEx GenericPageCache::GetPreviewBitmap (
+PreviewType GenericPageCache::GetPreviewBitmap (
const CacheKey aKey,
const bool bResize)
{
OSL_ASSERT(aKey != NULL);
- BitmapEx aPreview;
+ PreviewType aPreview;
bool bMayBeUpToDate = true;
ProvideCacheAndProcessor();
const SdrPage* pPage = mpCacheContext->GetPage(aKey);
if (mpBitmapCache->HasBitmap(pPage))
{
- ::boost::shared_ptr<BitmapEx> pPreview(mpBitmapCache->GetBitmap(pPage));
- OSL_ASSERT(pPreview.get() != NULL);
- aPreview = *pPreview;
- const Size aBitmapSize (aPreview.GetSizePixel());
- if (bResize && aBitmapSize != maPreviewSize)
+ aPreview = mpBitmapCache->GetBitmap(pPage);
+ const Size aBitmapSize (aPreview.GetBitmap().GetSizePixel());
+ if (aBitmapSize != maPreviewSize)
{
// Scale the bitmap to the desired size when that is possible,
// i.e. the bitmap is not empty.
- if (aBitmapSize.Width()>0 && aBitmapSize.Height()>0)
+ if (bResize && aBitmapSize.Width()>0 && aBitmapSize.Height()>0)
{
- aPreview.Scale(maPreviewSize, BMP_SCALE_FAST);
+ aPreview.GetBitmap().Scale(maPreviewSize, BMP_SCALE_FAST);
}
+ bMayBeUpToDate = false;
}
- bMayBeUpToDate = true;
+ else
+ bMayBeUpToDate = true;
}
else
bMayBeUpToDate = false;
@@ -172,6 +172,46 @@ BitmapEx GenericPageCache::GetPreviewBitmap (
+PreviewType GenericPageCache::GetMarkedPreviewBitmap (
+ const CacheKey aKey,
+ const bool bResize)
+{
+ OSL_ASSERT(aKey != NULL);
+
+ ProvideCacheAndProcessor();
+ const SdrPage* pPage = mpCacheContext->GetPage(aKey);
+ PreviewType aMarkedPreview (mpBitmapCache->GetMarkedBitmap(pPage));
+ const Size aBitmapSize (aMarkedPreview.GetBitmap().GetSizePixel());
+ if (bResize && aBitmapSize != maPreviewSize)
+ {
+ // Scale the bitmap to the desired size when that is possible,
+ // i.e. the bitmap is not empty.
+ if (aBitmapSize.Width()>0 && aBitmapSize.Height()>0)
+ {
+ aMarkedPreview.GetBitmap().Scale(maPreviewSize, BMP_SCALE_FAST);
+ }
+ }
+
+ return aMarkedPreview;
+}
+
+
+
+
+void GenericPageCache::SetMarkedPreviewBitmap (
+ const CacheKey aKey,
+ const PreviewType& rMarkedBitmap)
+{
+ OSL_ASSERT(aKey != NULL);
+
+ ProvideCacheAndProcessor();
+ const SdrPage* pPage = mpCacheContext->GetPage(aKey);
+ mpBitmapCache->SetMarkedBitmap(pPage, rMarkedBitmap);
+}
+
+
+
+
void GenericPageCache::RequestPreviewBitmap (
const CacheKey aKey,
const bool bMayBeUpToDate)
@@ -188,8 +228,8 @@ void GenericPageCache::RequestPreviewBitmap (
bIsUpToDate = mpBitmapCache->BitmapIsUpToDate (pPage);
if (bIsUpToDate)
{
- ::boost::shared_ptr<BitmapEx> pPreview (mpBitmapCache->GetBitmap(pPage));
- if (pPreview.get()==NULL || pPreview->GetSizePixel()!=maPreviewSize)
+ const PreviewType aPreview (mpBitmapCache->GetBitmap(pPage));
+ if (aPreview.IsEmpty() || aPreview.GetBitmap().GetSizePixel()!=maPreviewSize)
bIsUpToDate = false;
}
@@ -212,10 +252,12 @@ void GenericPageCache::RequestPreviewBitmap (
-void GenericPageCache::InvalidatePreviewBitmap (const CacheKey aKey)
+bool GenericPageCache::InvalidatePreviewBitmap (const CacheKey aKey)
{
if (mpBitmapCache.get() != NULL)
- mpBitmapCache->InvalidateBitmap(mpCacheContext->GetPage(aKey));
+ return mpBitmapCache->InvalidateBitmap(mpCacheContext->GetPage(aKey));
+ else
+ return false;
}
diff --git a/sd/source/ui/slidesorter/cache/SlsGenericPageCache.hxx b/sd/source/ui/slidesorter/cache/SlsGenericPageCache.hxx
index 1d1ee0f1f06e..540bf6d227af 100644
--- a/sd/source/ui/slidesorter/cache/SlsGenericPageCache.hxx
+++ b/sd/source/ui/slidesorter/cache/SlsGenericPageCache.hxx
@@ -30,8 +30,7 @@
#include "SlideSorter.hxx"
#include "SlsRequestQueue.hxx"
-#include "SlsQueueProcessor.hxx"
-#include <boost/function.hpp>
+#include "cache/SlsPreviewType.hxx"
#include <boost/scoped_ptr.hpp>
namespace sd { namespace slidesorter { namespace cache {
@@ -87,9 +86,15 @@ public:
Returns a bitmap that is either empty, contains a scaled (up or
down) version or is the requested bitmap.
*/
- BitmapEx GetPreviewBitmap (
+ PreviewType GetPreviewBitmap (
const CacheKey aKey,
const bool bResize);
+ PreviewType GetMarkedPreviewBitmap (
+ const CacheKey aKey,
+ const bool bResize);
+ void SetMarkedPreviewBitmap (
+ const CacheKey aKey,
+ const PreviewType& rMarkedBitmap);
/** When the requested preview bitmap does not yet exist or is not
up-to-date then the rendering of one is scheduled. Otherwise this
@@ -110,8 +115,10 @@ public:
/** Tell the cache to replace the bitmap associated with the given
request data with a new one that reflects recent changes in the
content of the page object.
+ @return
+ When the key is kown then return <TRUE/>.
*/
- void InvalidatePreviewBitmap (const CacheKey aKey);
+ bool InvalidatePreviewBitmap (const CacheKey aKey);
/** Call this method when a view-object-contact object is being deleted
and does not need (a) its current bitmap in the cache and (b) a
diff --git a/sd/source/ui/slidesorter/cache/SlsPageCache.cxx b/sd/source/ui/slidesorter/cache/SlsPageCache.cxx
index 4ca6464df98a..d59ad2c32259 100644
--- a/sd/source/ui/slidesorter/cache/SlsPageCache.cxx
+++ b/sd/source/ui/slidesorter/cache/SlsPageCache.cxx
@@ -75,7 +75,7 @@ void PageCache::ChangeSize (
-BitmapEx PageCache::GetPreviewBitmap (
+PreviewType PageCache::GetPreviewBitmap (
const CacheKey aKey,
const bool bResize)
{
@@ -85,6 +85,26 @@ BitmapEx PageCache::GetPreviewBitmap (
+PreviewType PageCache::GetMarkedPreviewBitmap (
+ const CacheKey aKey,
+ const bool bResize)
+{
+ return mpImplementation->GetMarkedPreviewBitmap(aKey, bResize);
+}
+
+
+
+
+void PageCache::SetMarkedPreviewBitmap (
+ const CacheKey aKey,
+ const PreviewType& rMarkedBitmap)
+{
+ mpImplementation->SetMarkedPreviewBitmap(aKey, rMarkedBitmap);
+}
+
+
+
+
void PageCache::RequestPreviewBitmap (const CacheKey aKey)
{
return mpImplementation->RequestPreviewBitmap(aKey);
@@ -97,8 +117,7 @@ void PageCache::InvalidatePreviewBitmap (
const CacheKey aKey,
const bool bRequestPreview)
{
- mpImplementation->InvalidatePreviewBitmap(aKey);
- if (bRequestPreview)
+ if (mpImplementation->InvalidatePreviewBitmap(aKey) && bRequestPreview)
RequestPreviewBitmap(aKey);
}
diff --git a/sd/source/ui/slidesorter/cache/SlsPageCacheManager.cxx b/sd/source/ui/slidesorter/cache/SlsPageCacheManager.cxx
index 01d7d45a32b0..820288de331d 100644
--- a/sd/source/ui/slidesorter/cache/SlsPageCacheManager.cxx
+++ b/sd/source/ui/slidesorter/cache/SlsPageCacheManager.cxx
@@ -397,6 +397,16 @@ void PageCacheManager::InvalidateAllCaches (void)
+void PageCacheManager::ReleasePreviewBitmap (const SdrPage* pPage)
+{
+ PageCacheContainer::iterator iCache;
+ for (iCache=mpPageCaches->begin(); iCache!=mpPageCaches->end(); ++iCache)
+ iCache->second->ReleaseBitmap(pPage);
+}
+
+
+
+
::boost::shared_ptr<PageCacheManager::Cache> PageCacheManager::GetRecentlyUsedCache (
DocumentKey pDocument,
const Size& rPreviewSize)
diff --git a/sd/source/ui/slidesorter/cache/SlsQueueProcessor.cxx b/sd/source/ui/slidesorter/cache/SlsQueueProcessor.cxx
index 4ee928edbfcd..e4598927d75c 100644
--- a/sd/source/ui/slidesorter/cache/SlsQueueProcessor.cxx
+++ b/sd/source/ui/slidesorter/cache/SlsQueueProcessor.cxx
@@ -213,15 +213,12 @@ void QueueProcessor::ProcessOneRequest (
const SdPage* pSdPage = dynamic_cast<const SdPage*>(mpCacheContext->GetPage(aKey));
if (pSdPage != NULL)
{
- const ::boost::shared_ptr<BitmapEx> pPreview (
+ const PreviewType aPreview (
maBitmapFactory.CreateBitmap(*pSdPage, maPreviewSize, mbDoSuperSampling));
- mpCache->SetBitmap (
- pSdPage,
- pPreview,
- ePriorityClass!=NOT_VISIBLE);
+ mpCache->SetBitmap (pSdPage, aPreview, ePriorityClass!=NOT_VISIBLE);
// Initiate a repaint of the new preview.
- mpCacheContext->NotifyPreviewCreation(aKey, pPreview);
+ mpCacheContext->NotifyPreviewCreation(aKey, aPreview);
}
}
}
diff --git a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
index 6eae261ec1d2..0f758012c6ac 100644
--- a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
+++ b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
@@ -96,7 +96,6 @@
#include <com/sun/star/drawing/XDrawPages.hpp>
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
-
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::sd::slidesorter::model;
@@ -123,6 +122,7 @@ SlideSorterController::SlideSorterController (SlideSorter& rSlideSorter)
mpVisibleAreaManager(new VisibleAreaManager(rSlideSorter)),
mpListener(),
mnModelChangeLockCount(0),
+ mbIsForcedRearrangePending(false),
mbPreModelChangeDone(false),
mbPostModelChangePending(false),
maSelectionBeforeSwitch(),
@@ -528,7 +528,9 @@ void SlideSorterController::UnlockModelChange (void)
{
mnModelChangeLockCount -= 1;
if (mnModelChangeLockCount==0 && mbPostModelChangePending)
+ {
PostModelChange();
+ }
}
@@ -574,7 +576,7 @@ void SlideSorterController::PostModelChange (void)
// The visibility of the scroll bars may have to be changed. Then
// the size of the view has to change, too. Let Rearrange() handle
// that.
- Rearrange();
+ Rearrange(mbIsForcedRearrangePending);
}
if (mrSlideSorter.GetViewShell() != NULL)
@@ -790,6 +792,14 @@ Rectangle SlideSorterController::Rearrange (bool bForce)
if (aNewContentArea.IsEmpty())
return aNewContentArea;
+ if (mnModelChangeLockCount>0)
+ {
+ mbIsForcedRearrangePending |= bForce;
+ return aNewContentArea;
+ }
+ else
+ mbIsForcedRearrangePending = false;
+
SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
if (pWindow)
{
@@ -822,7 +832,7 @@ Rectangle SlideSorterController::Rearrange (bool bForce)
GetScrollBarManager().UpdateScrollBars(false, !bForce);
// Keep the current slide in the visible area.
- GetVisibleAreaManager().RequestVisible(GetCurrentSlideManager()->GetCurrentSlide());
+ GetVisibleAreaManager().RequestCurrentSlideVisible();
}
return aNewContentArea;
diff --git a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx
index 32a0a6dafbb6..6131c8629204 100644
--- a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx
@@ -418,8 +418,8 @@ void Clipboard::CreateSlideTransferable (
model::SharedPageDescriptor pDescriptor (aSelectedPages.GetNextElement());
if ( ! pDescriptor || pDescriptor->GetPage()==NULL)
continue;
- Bitmap aPreview (pPreviewCache->GetPreviewBitmap(pDescriptor->GetPage(), false)
- .GetBitmap());
+ Bitmap aPreview (
+ pPreviewCache->GetPreviewBitmap(pDescriptor->GetPage(), false).GetBitmap());
aRepresentatives.push_back(aPreview);
if (aRepresentatives.size() >= 3)
break;
@@ -429,11 +429,6 @@ void Clipboard::CreateSlideTransferable (
{
mrSlideSorter.GetView().BrkAction();
SdDrawDocument* pDocument = mrSlideSorter.GetModel().GetDocument();
- ::boost::shared_ptr<DragAndDropContext> pDragAndDropContext;
- ::rtl::Reference<SelectionFunction> pSelectionFunction (
- mrSlideSorter.GetController().GetCurrentSelectionFunction());
- if (pSelectionFunction.is())
- pDragAndDropContext = pSelectionFunction->GetDragAndDropContext();
SdTransferable* pTransferable = new Transferable (
pDocument,
NULL,
@@ -538,10 +533,7 @@ void Clipboard::DragFinished (sal_Int8 nDropAction)
mrController.GetSelectionManager()->DeleteSelectedPages ();
}
mpUndoContext.reset();
- mrSlideSorter.GetController().GetSelectionManager()->GetSelectionObserver()->EndObservation();
-
- // if (nDropAction != DND_ACTION_NONE)
- // SelectPages();
+ mpSelectionObserverContext.reset();
}
@@ -570,7 +562,7 @@ sal_Int8 Clipboard::AcceptDrop (
USHORT nPage,
USHORT nLayer)
{
- sal_Int8 nResult = DND_ACTION_NONE;
+ sal_Int8 nAction (DND_ACTION_NONE);
const Clipboard::DropType eDropType (IsDropAccepted());
@@ -579,7 +571,7 @@ sal_Int8 Clipboard::AcceptDrop (
case DT_PAGE:
{
// Accept a drop.
- nResult = rEvent.mnAction;
+ nAction = rEvent.mnAction;
// Use the copy action when the drop action is the default, i.e. not
// explicitly set to move or link, and when the source and
@@ -592,7 +584,11 @@ sal_Int8 Clipboard::AcceptDrop (
&& (mrSlideSorter.GetModel().GetDocument()->GetDocSh()
!= pDragTransferable->GetPageDocShell()))
{
- nResult = DND_ACTION_COPY;
+ nAction = DND_ACTION_COPY;
+ }
+ else if (mrController.GetInsertionIndicatorHandler()->IsInsertionTrivial(nAction))
+ {
+ nAction = DND_ACTION_NONE;
}
// Show the insertion marker and the substitution for a drop.
@@ -600,7 +596,7 @@ sal_Int8 Clipboard::AcceptDrop (
SelectionFunction* pSelectionFunction = dynamic_cast<SelectionFunction*>(
mrSlideSorter.GetViewShell()->GetCurrentFunction().get());
if (pSelectionFunction != NULL)
- pSelectionFunction->MouseDragged(rEvent, nResult);
+ pSelectionFunction->MouseDragged(rEvent, nAction);
// Scroll the window when the mouse reaches the window border.
// mrController.GetScrollBarManager().AutoScroll (rEvent.maPosPixel);
@@ -608,7 +604,7 @@ sal_Int8 Clipboard::AcceptDrop (
break;
case DT_SHAPE:
- nResult = ExecuteOrAcceptShapeDrop(
+ nAction = ExecuteOrAcceptShapeDrop(
DC_ACCEPT,
rEvent.maPosPixel,
&rEvent,
@@ -617,11 +613,13 @@ sal_Int8 Clipboard::AcceptDrop (
nPage,
nLayer);
break;
+
default:
+ nAction = DND_ACTION_NONE;
break;
}
- return nResult;
+ return nAction;
}
@@ -644,25 +642,30 @@ sal_Int8 Clipboard::ExecuteDrop (
const SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag;
const Point aEventModelPosition (
pTargetWindow->PixelToLogic (rEvent.maPosPixel));
- long int nXOffset = labs (pDragTransferable->GetStartPos().X()
- - aEventModelPosition.X());
- long int nYOffset = labs (pDragTransferable->GetStartPos().Y()
- - aEventModelPosition.Y());
- const bool bContinue =
+ const sal_Int32 nXOffset (labs (pDragTransferable->GetStartPos().X()
+ - aEventModelPosition.X()));
+ const sal_Int32 nYOffset (labs (pDragTransferable->GetStartPos().Y()
+ - aEventModelPosition.Y()));
+ bool bContinue =
( pDragTransferable->GetView() != &mrSlideSorter.GetView() )
|| ( nXOffset >= 2 && nYOffset >= 2 );
+ ::boost::shared_ptr<InsertionIndicatorHandler> pInsertionIndicatorHandler(
+ mrController.GetInsertionIndicatorHandler());
// Get insertion position and then turn off the insertion indicator.
- mrController.GetInsertionIndicatorHandler()->UpdatePosition(
- aEventModelPosition,
- rEvent.mnAction);
+ pInsertionIndicatorHandler->UpdatePosition(aEventModelPosition, rEvent.mnAction);
USHORT nIndex = DetermineInsertPosition(*pDragTransferable);
+ // Do not process the insertion when it is trivial,
+ // i.e. would insert pages at their original place.
+ if (pInsertionIndicatorHandler->IsInsertionTrivial(rEvent.mnAction))
+ bContinue = false;
+
// Tell the insertion indicator handler to hide before the model
// is modified. Doing it later may result in page objects whose
// animation state is not properly reset because they are then
// in another run then before the model change.
- mrController.GetInsertionIndicatorHandler()->End(Animator::AM_Immediate);
+ pInsertionIndicatorHandler->End(Animator::AM_Immediate);
if (bContinue)
{
@@ -673,18 +676,15 @@ sal_Int8 Clipboard::ExecuteDrop (
mrSlideSorter.GetModel().GetDocument(),
mrSlideSorter.GetViewShell()->GetViewShellBase().GetMainViewShell(),
mrSlideSorter.GetTheme()));
- mrSlideSorter.GetController().GetSelectionManager()
- ->GetSelectionObserver()->StartObservation();
+ mpSelectionObserverContext.reset(new SelectionObserver::Context(mrSlideSorter));
HandlePageDrop(*pDragTransferable);
nResult = rEvent.mnAction;
- // When moving or copying inside one view then leave the
- // undo context active a little longer until
- // NotifyDragFinished is called and possibly some slides are
- // deleted. Otherwise all actions in the target view are
- // complete and
- // ( pDragTransferable->GetView() != &mrSlideSorter.GetView() )
+ // We leave the undo context alive for when moving or
+ // copying inside one view then the actions in
+ // NotifyDragFinished should be covered as well as
+ // well as the ones above.
}
// Notify the receiving selection function that drag-and-drop is
@@ -716,6 +716,18 @@ sal_Int8 Clipboard::ExecuteDrop (
+void Clipboard::Abort (void)
+{
+ if (mpSelectionObserverContext)
+ {
+ mpSelectionObserverContext->Abort();
+ mpSelectionObserverContext.reset();
+ }
+}
+
+
+
+
USHORT Clipboard::DetermineInsertPosition (const SdTransferable& )
{
USHORT nInsertPosition = SDRPAGE_NOTFOUND;
@@ -723,7 +735,7 @@ USHORT Clipboard::DetermineInsertPosition (const SdTransferable& )
// Tell the model to move the dragged pages behind the one with the
// index nInsertionIndex which first has to be transformed into an index
// understandable by the document.
- sal_Int32 nInsertionIndex (
+ const sal_Int32 nInsertionIndex (
mrController.GetInsertionIndicatorHandler()->GetInsertionPageIndex());
// Convert to insertion index to that of an SdModel.
diff --git a/sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx b/sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx
index 56beb4a90623..5a7ead7d2391 100644
--- a/sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx
@@ -92,8 +92,11 @@ void CurrentSlideManager::NotifyCurrentSlideChange (const sal_Int32 nSlideIndex)
// Update the selection.
mrSlideSorter.GetController().GetPageSelector().DeselectAllPages();
- if (mpCurrentSlide.get() != NULL)
+ if (mpCurrentSlide)
+ {
mrSlideSorter.GetController().GetPageSelector().SelectPage(mpCurrentSlide);
+ mrSlideSorter.GetController().GetFocusManager().SetFocusedPage(mpCurrentSlide);
+ }
}
}
diff --git a/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx b/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx
index 97d2a5e08881..9b3b52486f96 100644
--- a/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx
@@ -169,20 +169,6 @@ void DragAndDropContext::UpdatePosition (
-void DragAndDropContext::Show (void)
-{
-}
-
-
-
-
-void DragAndDropContext::Hide (void)
-{
-}
-
-
-
-
void DragAndDropContext::SetTargetSlideSorter (
SlideSorter* pSlideSorter,
const Point aMousePosition,
diff --git a/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.hxx b/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.hxx
index 3f0a4e3547d7..ead764ec84be 100644
--- a/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.hxx
+++ b/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.hxx
@@ -71,8 +71,6 @@ public:
const InsertionIndicatorHandler::Mode eMode,
const bool bAllowAutoScroll = true);
- void Show (void);
- void Hide (void);
void SetTargetSlideSorter (
SlideSorter* pSlideSorter = NULL,
const Point aMousePosition = Point(0,0),
diff --git a/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx b/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx
index 8f3d5d05008a..8d84a57e5691 100644
--- a/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx
@@ -229,7 +229,7 @@ sal_Int32 FocusManager::GetFocusedPageIndex (void) const
-
+/*
void FocusManager::FocusPage (sal_Int32 nPageIndex)
{
if (nPageIndex != mnPageIndex)
@@ -242,7 +242,7 @@ void FocusManager::FocusPage (sal_Int32 nPageIndex)
if (HasFocus() && !IsFocusShowing())
ShowFocus();
}
-
+*/
@@ -267,6 +267,14 @@ void FocusManager::SetFocusedPage (sal_Int32 nPageIndex)
+void FocusManager::SetFocusedPageToCurrentPage (void)
+{
+ SetFocusedPage(mrSlideSorter.GetController().GetCurrentSlideManager()->GetCurrentSlide());
+}
+
+
+
+
bool FocusManager::IsFocusShowing (void) const
{
return HasFocus() && mbPageIsFocused;
@@ -298,7 +306,7 @@ void FocusManager::ShowFocusIndicator (
{
// Scroll the focused page object into the visible area and repaint
// it, so that the focus indicator becomes visible.
- mrSlideSorter.GetController().GetVisibleAreaManager().RequestVisible(rpDescriptor);
+ mrSlideSorter.GetController().GetVisibleAreaManager().RequestVisible(rpDescriptor,true);
}
mrSlideSorter.GetView().RequestRepaint(rpDescriptor);
diff --git a/sd/source/ui/slidesorter/controller/SlsInsertionIndicatorHandler.cxx b/sd/source/ui/slidesorter/controller/SlsInsertionIndicatorHandler.cxx
index d7e3f52a9b18..a0b70aa1ed23 100644
--- a/sd/source/ui/slidesorter/controller/SlsInsertionIndicatorHandler.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsInsertionIndicatorHandler.cxx
@@ -149,6 +149,10 @@ void InsertionIndicatorHandler::UpdatePosition (
const Point& rMouseModelPosition,
const Mode eMode)
{
+ OSL_TRACE("InsertionIndicatorHandler::UpdatePosition %d,%d, %d",
+ rMouseModelPosition.X(),
+ rMouseModelPosition.Y(),
+ eMode);
if ( ! mbIsActive)
return;
@@ -201,6 +205,19 @@ void InsertionIndicatorHandler::SetPosition (
maIconSize,
mrSlideSorter.GetModel()));
+ static sal_Int32 TargetIndex (1);
+ if (aInsertPosition.GetIndex() == TargetIndex)
+ {
+ const view::InsertPosition aPosition (rLayouter.GetInsertPosition(
+ rPoint,
+ maIconSize,
+ mrSlideSorter.GetModel()));
+ const view::InsertPosition aPosition2 (rLayouter.GetInsertPosition(
+ rPoint,
+ maIconSize,
+ mrSlideSorter.GetModel()));
+ }
+
if (maInsertPosition != aInsertPosition
|| meMode != eMode
// || ! mpInsertionIndicatorOverlay->IsVisible()
@@ -209,9 +226,10 @@ void InsertionIndicatorHandler::SetPosition (
maInsertPosition = aInsertPosition;
meMode = eMode;
mbIsInsertionTrivial = IsInsertionTrivial(maInsertPosition.GetIndex(), eMode);
-
if (maInsertPosition.GetIndex()>=0 && ! mbIsInsertionTrivial)
{
+ OSL_TRACE("A insertion at %d is %strivial",
+ maInsertPosition.GetIndex(), mbIsInsertionTrivial?"":"not ");
mpInsertionIndicatorOverlay->SetLocation(maInsertPosition.GetLocation());
GetInsertAnimator()->SetInsertPosition(maInsertPosition);
@@ -219,6 +237,8 @@ void InsertionIndicatorHandler::SetPosition (
}
else
{
+ OSL_TRACE("B insertion at %d is %strivial",
+ maInsertPosition.GetIndex(), mbIsInsertionTrivial?"":"not ");
GetInsertAnimator()->Reset(Animator::AM_Animated);
mpInsertionIndicatorOverlay->Hide();
}
@@ -289,6 +309,14 @@ bool InsertionIndicatorHandler::IsInsertionTrivial (
+bool InsertionIndicatorHandler::IsInsertionTrivial (const sal_Int8 nDndAction)
+{
+ return IsInsertionTrivial(GetInsertionPageIndex(), GetModeFromDndAction(nDndAction));
+}
+
+
+
+
//===== InsertionIndicatorHandler::ForceShowContext ===========================
InsertionIndicatorHandler::ForceShowContext::ForceShowContext (
diff --git a/sd/source/ui/slidesorter/controller/SlsListener.cxx b/sd/source/ui/slidesorter/controller/SlsListener.cxx
index 93bdb9aa43ce..f4f73fd2b7cb 100644
--- a/sd/source/ui/slidesorter/controller/SlsListener.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsListener.cxx
@@ -323,8 +323,20 @@ void Listener::Notify (
// The return value of the model call acts as filter as
// to which events to pass to the selection observer.
if (mrSlideSorter.GetModel().NotifyPageEvent(rSdrHint.GetPage()))
+ {
+ // The page of the hint belongs (or belonged)
+ // to the model.
+
+ // Tell the cache manager that the preview
+ // bitmaps for a deleted page can be removed
+ // from all caches.
+ const SdrPage* pPage = rSdrHint.GetPage();
+ if (pPage!=NULL && ! pPage->IsInserted())
+ cache::PageCacheManager::Instance()->ReleasePreviewBitmap(pPage);
+
mrController.GetSelectionManager()
->GetSelectionObserver()->NotifyPageEvent(rSdrHint.GetPage());
+ }
if (rBroadcaster.ISA(SdDrawDocument))
{
diff --git a/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx b/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx
index ec76256b5e97..d7a11cf89f7f 100644
--- a/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx
@@ -202,7 +202,7 @@ void PageSelector::SelectPage (const SharedPageDescriptor& rpDescriptor)
{
mnSelectedPageCount ++;
if ( ! mbIsMakeVisibleDisabled)
- mrSlideSorter.GetController().GetVisibleAreaManager().RequestVisible(rpDescriptor);
+ mrSlideSorter.GetController().GetVisibleAreaManager().RequestVisible(rpDescriptor,true);
mrSlideSorter.GetView().RequestRepaint(rpDescriptor);
mpMostRecentlySelectedPage = rpDescriptor;
@@ -412,18 +412,18 @@ void PageSelector::UpdateCurrentPage (const bool bUpdateOnlyWhenPending)
//===== PageSelector::UpdateLock ==============================================
PageSelector::UpdateLock::UpdateLock (SlideSorter& rSlideSorter)
- : mrSelector(rSlideSorter.GetController().GetPageSelector())
+ : mpSelector(&rSlideSorter.GetController().GetPageSelector())
{
- ++mrSelector.mnUpdateLockCount;
+ ++mpSelector->mnUpdateLockCount;
}
PageSelector::UpdateLock::UpdateLock (PageSelector& rSelector)
- : mrSelector(rSelector)
+ : mpSelector(&rSelector)
{
- ++mrSelector.mnUpdateLockCount;
+ ++mpSelector->mnUpdateLockCount;
}
@@ -431,10 +431,20 @@ PageSelector::UpdateLock::UpdateLock (PageSelector& rSelector)
PageSelector::UpdateLock::~UpdateLock (void)
{
- --mrSelector.mnUpdateLockCount;
- OSL_ASSERT(mrSelector.mnUpdateLockCount >= 0);
- if (mrSelector.mnUpdateLockCount == 0)
- mrSelector.UpdateCurrentPage(true);
+ Release();
+}
+
+void PageSelector::UpdateLock::Release (void)
+{
+ if (mpSelector != NULL)
+ {
+ --mpSelector->mnUpdateLockCount;
+ OSL_ASSERT(mpSelector->mnUpdateLockCount >= 0);
+ if (mpSelector->mnUpdateLockCount == 0)
+ mpSelector->UpdateCurrentPage(true);
+
+ mpSelector = NULL;
+ }
}
diff --git a/sd/source/ui/slidesorter/controller/SlsProperties.cxx b/sd/source/ui/slidesorter/controller/SlsProperties.cxx
index d983e2ba679f..532047cfaefe 100644
--- a/sd/source/ui/slidesorter/controller/SlsProperties.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsProperties.cxx
@@ -37,14 +37,16 @@ Properties::Properties (void)
mbIsShowSelection(true),
mbIsShowFocus(true),
mbIsCenterSelection(false),
- mbIsSmoothSelectionScrolling(true),//false),
+ mbIsSmoothSelectionScrolling(true),
mbIsSuspendPreviewUpdatesDuringFullScreenPresentation(true),
maBackgroundColor(Application::GetSettings().GetStyleSettings().GetWindowColor()),
maTextColor(Application::GetSettings().GetStyleSettings().GetActiveTextColor()),
maSelectionColor(Application::GetSettings().GetStyleSettings().GetHighlightColor()),
maHighlightColor(Application::GetSettings().GetStyleSettings().GetMenuHighlightColor()),
mbIsUIReadOnly(false),
- mbIsOnlyPreviewTriggersMouseOver(true)
+ mbIsOnlyPreviewTriggersMouseOver(true),
+ mbIsHighContrastModeActive(
+ Application::GetSettings().GetStyleSettings().GetHighContrastMode())
{
}
@@ -64,6 +66,8 @@ void Properties::HandleDataChangeEvent (void)
maTextColor = Application::GetSettings().GetStyleSettings().GetActiveTextColor();
maSelectionColor = Application::GetSettings().GetStyleSettings().GetHighlightColor();
maHighlightColor = Application::GetSettings().GetStyleSettings().GetMenuHighlightColor();
+ mbIsHighContrastModeActive
+ = Application::GetSettings().GetStyleSettings().GetHighContrastMode();
}
@@ -258,4 +262,12 @@ void Properties::SetOnlyPreviewTriggersMouseOver (const bool bFlag)
}
+
+
+bool Properties::IsHighContrastModeActive (void) const
+{
+ return mbIsHighContrastModeActive;
+}
+
+
} } } // end of namespace ::sd::slidesorter::controller
diff --git a/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx b/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx
index f6dd4d93862f..3ae1b85c214d 100644
--- a/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx
@@ -31,6 +31,7 @@
#include "SlideSorter.hxx"
#include "controller/SlideSorterController.hxx"
+#include "controller/SlsVisibleAreaManager.hxx"
#include "model/SlideSorterModel.hxx"
#include "model/SlsPageDescriptor.hxx"
#include "view/SlideSorterView.hxx"
@@ -324,6 +325,7 @@ IMPL_LINK(ScrollBarManager, VerticalScrollBarHandler, ScrollBar*, pScrollBar)
/ double(pScrollBar->GetRange().Len());
mrSlideSorter.GetView().InvalidatePageObjectVisibilities();
mrSlideSorter.GetContentWindow()->SetVisibleXY (-1, nRelativePosition);
+ mrSlideSorter.GetController().GetVisibleAreaManager().DeactivateCurrentSlideTracking();
}
return TRUE;
}
diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx
index 416f06a82616..e527d5914871 100644
--- a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx
@@ -50,6 +50,7 @@
#include "view/SlideSorterView.hxx"
#include "view/SlsLayouter.hxx"
#include "view/SlsPageObjectLayouter.hxx"
+#include "view/SlsButton.hxx"
#include "framework/FrameworkHelper.hxx"
#include "showview.hxx"
#include "ViewShellBase.hxx"
@@ -72,6 +73,7 @@
#include <vcl/msgbox.hxx>
#include <svx/svxids.hrc>
#include <boost/bind.hpp>
+#include <boost/optional.hpp>
namespace {
static const sal_uInt32 SINGLE_CLICK (0x00000001);
@@ -88,11 +90,10 @@ static const sal_uInt32 MOUSE_DRAG (0x00000800);
static const sal_uInt32 OVER_SELECTED_PAGE (0x00010000);
static const sal_uInt32 OVER_UNSELECTED_PAGE (0x00020000);
static const sal_uInt32 OVER_FADE_INDICATOR (0x00040000);
-static const sal_uInt32 OVER_BUTTON (0x00080000);
-static const sal_uInt32 SHIFT_MODIFIER (0x00100000);
-static const sal_uInt32 CONTROL_MODIFIER (0x00200000);
-static const sal_uInt32 DRAG_ACTIVE (0x01000000);
-static const sal_uInt32 MULTI_SELECTOR (0x02000000);
+static const sal_uInt32 OVER_BUTTON_AREA (0x00080000);
+static const sal_uInt32 OVER_BUTTON (0x00100000);
+static const sal_uInt32 SHIFT_MODIFIER (0x00200000);
+static const sal_uInt32 CONTROL_MODIFIER (0x00400000);
static const sal_uInt32 KEY_EVENT (0x10000000);
@@ -102,40 +103,177 @@ static const sal_uInt32 NOT_OVER_PAGE (0x00000000);
// Masks
static const sal_uInt32 MODIFIER_MASK (SHIFT_MODIFIER | CONTROL_MODIFIER);
+static const sal_uInt32 BUTTON_MASK (LEFT_BUTTON | RIGHT_BUTTON | MIDDLE_BUTTON);
} // end of anonymous namespace
-#define ONLY_PREVIEW_TRIGGERS_MOUSE_OVER
+
+
+// Define some macros to make the following switch statement more readable.
+#define ANY_MODIFIER(code) \
+ code|NO_MODIFIER: \
+ case code|SHIFT_MODIFIER: \
+ case code|CONTROL_MODIFIER
namespace sd { namespace slidesorter { namespace controller {
+//===== SelectionFunction::EventDescriptor ====================================
-class SelectionFunction::MouseMultiSelector
+class SelectionFunction::EventDescriptor
{
public:
- /** Start a rectangle selection at the given position.
+ Point maMousePosition;
+ Point maMouseModelPosition;
+ model::SharedPageDescriptor mpHitDescriptor;
+ SdrPage* mpHitPage;
+ sal_uInt32 mnEventCode;
+ bool mbIsOverButton;
+ InsertionIndicatorHandler::Mode meDragMode;
+ bool mbMakeSelectionVisible;
+ bool mbIsLeaving;
+
+ EventDescriptor (
+ sal_uInt32 nEventType,
+ const MouseEvent& rEvent,
+ SlideSorter& rSlideSorter);
+ EventDescriptor (
+ sal_uInt32 nEventType,
+ const AcceptDropEvent& rEvent,
+ const sal_Int8 nDragAction,
+ SlideSorter& rSlideSorter);
+ EventDescriptor (
+ const KeyEvent& rEvent,
+ SlideSorter& rSlideSorter);
+
+ void SetDragMode (const InsertionIndicatorHandler::Mode eMode);
+
+private:
+ /** Compute a numerical code that describes a mouse event and that can
+ be used for fast look up of the appropriate reaction.
+ */
+ sal_uInt32 EncodeMouseEvent (const MouseEvent& rEvent) const;
+
+ /** Compute a numerical code that describes a key event and that can
+ be used for fast look up of the appropriate reaction.
*/
- MouseMultiSelector (
+ sal_uInt32 EncodeKeyEvent (const KeyEvent& rEvent) const;
+
+ /** Compute a numerical code that describes the current state like
+ whether the selection rectangle is visible or whether the page under
+ the mouse or the one that has the focus is selected.
+ */
+ sal_uInt32 EncodeState (void) const;
+};
+
+
+
+
+//===== SelectionFunction::ModeHandler ========================================
+
+class SelectionFunction::ModeHandler
+{
+public:
+ ModeHandler (
SlideSorter& rSlideSorter,
- const Point& rMouseModelPosition);
- virtual ~MouseMultiSelector (void);
+ SelectionFunction& rSelectionFunction,
+ const bool bIsMouseOverIndicatorAllowed);
+ virtual ~ModeHandler (void);
- void RestoreInitialSelection (void);
+ virtual Mode GetMode (void) const = 0;
+ virtual void Abort (void) = 0;
+ void ProcessEvent (EventDescriptor& rDescriptor);
- /** Update the rectangle selection so that the given position becomes
- the new second point of the selection rectangle.
+ /** Set the selection to exactly the specified page and also set it as
+ the current page.
*/
- void UpdatePosition (
+ void SetCurrentPage (const model::SharedPageDescriptor& rpDescriptor);
+
+ /// Deselect all pages.
+ void DeselectAllPages (void);
+ void SelectOnePage (const model::SharedPageDescriptor& rpDescriptor);
+
+ /** When the view on which this selection function is working is the
+ main view then the view is switched to the regular editing view.
+ */
+ void SwitchView (const model::SharedPageDescriptor& rpDescriptor);
+
+ void StartDrag (
const Point& rMousePosition,
- const bool bAllowAutoScroll = true);
+ const InsertionIndicatorHandler::Mode eMode);
+
+ bool IsMouseOverIndicatorAllowed (void) const;
+
+protected:
+ SlideSorter& mrSlideSorter;
+ SelectionFunction& mrSelectionFunction;
+
+ virtual bool ProcessButtonDownEvent (EventDescriptor& rDescriptor);
+ virtual bool ProcessButtonUpEvent (EventDescriptor& rDescriptor);
+ virtual bool ProcessMotionEvent (EventDescriptor& rDescriptor);
+ virtual bool ProcessDragEvent (EventDescriptor& rDescriptor);
+ virtual bool HandleUnprocessedEvent (EventDescriptor& rDescriptor);
+
+ void ReprocessEvent (EventDescriptor& rDescriptor);
+
+private:
+ const bool mbIsMouseOverIndicatorAllowed;
+};
+
+
+class NormalModeHandler : public SelectionFunction::ModeHandler
+{
+public:
+ NormalModeHandler (
+ SlideSorter& rSlideSorter,
+ SelectionFunction& rSelectionFunction);
+ virtual ~NormalModeHandler (void);
+
+ virtual SelectionFunction::Mode GetMode (void) const;
+ virtual void Abort (void);
+
+protected:
+ virtual bool ProcessButtonDownEvent (SelectionFunction::EventDescriptor& rDescriptor);
+ virtual bool ProcessButtonUpEvent (SelectionFunction::EventDescriptor& rDescriptor);
+ virtual bool ProcessMotionEvent (SelectionFunction::EventDescriptor& rDescriptor);
+ virtual bool ProcessDragEvent (SelectionFunction::EventDescriptor& rDescriptor);
+
+private:
+ Point maButtonDownLocation;
+
+ /** Select all pages between and including the selection anchor and the
+ specified page.
+ */
+ void RangeSelect (const model::SharedPageDescriptor& rpDescriptor);
+};
+
+
+class MultiSelectionModeHandler : public SelectionFunction::ModeHandler
+{
+public:
+ /** Start a rectangle selection at the given position.
+ */
+ MultiSelectionModeHandler (
+ SlideSorter& rSlideSorter,
+ SelectionFunction& rSelectionFunction,
+ const Point& rMouseModelPosition,
+ const sal_uInt32 nEventCode);
+ virtual ~MultiSelectionModeHandler (void);
+
+ virtual SelectionFunction::Mode GetMode (void) const;
+ virtual void Abort (void);
+
enum SelectionMode { SM_Normal, SM_Add, SM_Toggle };
void SetSelectionMode (const SelectionMode eSelectionMode);
void SetSelectionModeFromModifier (const sal_uInt32 nEventCode);
+protected:
+ virtual bool ProcessButtonUpEvent (SelectionFunction::EventDescriptor& rDescriptor);
+ virtual bool ProcessMotionEvent (SelectionFunction::EventDescriptor& rDescriptor);
+ virtual bool HandleUnprocessedEvent (SelectionFunction::EventDescriptor& rDescriptor);
+
private:
- SlideSorter& mrSlideSorter;
SelectionMode meSelectionMode;
Point maSecondCorner;
Pointer maSavedPointer;
@@ -145,39 +283,64 @@ private:
virtual void UpdateModelPosition (const Point& rMouseModelPosition);
virtual void UpdateSelection (void);
+ /** Update the rectangle selection so that the given position becomes
+ the new second point of the selection rectangle.
+ */
+ void UpdatePosition (
+ const Point& rMousePosition,
+ const bool bAllowAutoScroll);
+
void UpdateSelectionState (
const model::SharedPageDescriptor& rpDescriptor,
const bool bIsInSelection) const;
};
+class DragAndDropModeHandler : public SelectionFunction::ModeHandler
+{
+public:
+ DragAndDropModeHandler (
+ SlideSorter& rSlideSorter,
+ SelectionFunction& rSelectionFunction,
+ const Point& rMousePosition,
+ ::Window* pWindow);
+ virtual ~DragAndDropModeHandler (void);
+ virtual SelectionFunction::Mode GetMode (void) const;
+ virtual void Abort (void);
-class SelectionFunction::EventDescriptor
+protected:
+ virtual bool ProcessButtonUpEvent (SelectionFunction::EventDescriptor& rDescriptor);
+ virtual bool ProcessDragEvent (SelectionFunction::EventDescriptor& rDescriptor);
+
+private:
+ ::boost::scoped_ptr<DragAndDropContext> mpDragAndDropContext;
+};
+
+
+class ButtonModeHandler : public SelectionFunction::ModeHandler
{
public:
- Point maMousePosition;
- Point maMouseModelPosition;
- model::SharedPageDescriptor mpHitDescriptor;
- SdrPage* mpHitPage;
- sal_uInt32 mnEventCode;
- sal_Int32 mnButtonIndex;
- InsertionIndicatorHandler::Mode meDragMode;
- bool mbMakeSelectionVisible;
+ ButtonModeHandler (
+ SlideSorter& rSlideSorter,
+ SelectionFunction& rSelectionFunction);
+ virtual ~ButtonModeHandler (void);
+ virtual void Abort (void);
- EventDescriptor (
- sal_uInt32 nEventType,
- const Point& rMousePosition,
- SlideSorter& rSlideSorter);
- EventDescriptor (
- const KeyEvent& rEvent,
- SlideSorter& rSlideSorter);
- EventDescriptor (const EventDescriptor& rDescriptor);
+ virtual SelectionFunction::Mode GetMode (void) const;
+ virtual void ProcessEvent (SelectionFunction::EventDescriptor& rDescriptor);
- void SetDragMode (const InsertionIndicatorHandler::Mode eMode);
+protected:
+ virtual bool ProcessButtonDownEvent (SelectionFunction::EventDescriptor& rDescriptor);
+ virtual bool ProcessButtonUpEvent (SelectionFunction::EventDescriptor& rDescriptor);
+ virtual bool ProcessMotionEvent (SelectionFunction::EventDescriptor& rDescriptor);
};
+
+
+//===== SelectionFunction =====================================================
+
TYPEINIT1(SelectionFunction, FuPoor);
@@ -195,12 +358,8 @@ SelectionFunction::SelectionFunction (
mbDragSelection(false),
maInsertionMarkerBox(),
mbProcessingMouseButtonDown(false),
- mpDragAndDropContext(),
- mpMouseMultiSelector(),
- mnButtonDownPageIndex(-1),
- mnButtonDownButtonIndex(-1),
- mbIsDeselectionPending(false),
- mnShiftKeySelectionAnchor(-1)
+ mnShiftKeySelectionAnchor(-1),
+ mpModeHandler(new NormalModeHandler(rSlideSorter, *this))
{
}
@@ -209,6 +368,7 @@ SelectionFunction::SelectionFunction (
SelectionFunction::~SelectionFunction (void)
{
+ mpModeHandler.reset();
}
@@ -244,33 +404,7 @@ BOOL SelectionFunction::MouseButtonDown (const MouseEvent& rEvent)
BOOL SelectionFunction::MouseMove (const MouseEvent& rEvent)
{
- Point aMousePosition (rEvent.GetPosPixel());
-
- mrSlideSorter.GetView().UpdatePageUnderMouse(
- aMousePosition,
- (rEvent.GetButtons() & MOUSE_LEFT)!=0,
- true);
-
- // Detect the mouse leaving the window. When not button is pressed then
- // we can call IsLeaveWindow at the event. Otherwise we have to make an
- // explicit test.
- if (rEvent.IsLeaveWindow()
- || ! Rectangle(Point(0,0),mpWindow->GetOutputSizePixel()).IsInside(aMousePosition))
- {
- StopDragAndDrop();
- mrSlideSorter.GetView().SetPageUnderMouse(model::SharedPageDescriptor());
- }
- else
- {
- // Call ProcessMouseEvent() only when one of the buttons is
- // pressed. This prevents calling the method on every motion.
- if (rEvent.GetButtons() != 0
- && mbProcessingMouseButtonDown)
- {
- ProcessMouseEvent(MOUSE_MOTION, rEvent);
- }
- }
-
+ ProcessMouseEvent(MOUSE_MOTION, rEvent);
return TRUE;
}
@@ -284,7 +418,7 @@ BOOL SelectionFunction::MouseButtonUp (const MouseEvent& rEvent)
ProcessMouseEvent(BUTTON_UP, rEvent);
mbProcessingMouseButtonDown = false;
- mpWindow->ReleaseMouse();
+// mpWindow->ReleaseMouse();
return TRUE;
}
@@ -292,63 +426,9 @@ BOOL SelectionFunction::MouseButtonUp (const MouseEvent& rEvent)
-void SelectionFunction::MouseDragged (
- const AcceptDropEvent& rEvent,
- const sal_Int8 nDragAction)
-{
- const InsertionIndicatorHandler::Mode eMode (
- InsertionIndicatorHandler::GetModeFromDndAction(nDragAction));//rEvent.mnAction));
- if (rEvent.mbLeaving)
- {
- StopDragAndDrop();
- }
- else if ( ! mpDragAndDropContext)
- {
- // Connect the substitution handler to this selection function.
- mpDragAndDropContext.reset(new DragAndDropContext(mrSlideSorter));
- const SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag;
- mrController.GetInsertionIndicatorHandler()->Start(
- pDragTransferable != NULL
- && pDragTransferable->GetView()==&mrSlideSorter.GetView());
- mpDragAndDropContext->UpdatePosition(rEvent.maPosPixel, eMode);
- UpdateMouseOverIndicationPermission();
- }
-
- // 1. Compute some frequently used values relating to the event.
- ::std::auto_ptr<EventDescriptor> pEventDescriptor (
- new EventDescriptor(MOUSE_DRAG, rEvent.maPosPixel, mrSlideSorter));
-
- // 2. Detect whether we are dragging pages or dragging a selection rectangle.
- if (mpDragAndDropContext)
- pEventDescriptor->mnEventCode |= DRAG_ACTIVE;
- if (mpMouseMultiSelector)
- pEventDescriptor->mnEventCode |= MULTI_SELECTOR;
-
- // 3. Set the drag mode.
- pEventDescriptor->SetDragMode(eMode);
-
- // 4. Process the event.
- if ( ! ProcessEvent(*pEventDescriptor))
- {
- OSL_TRACE ("can not handle event code %x", pEventDescriptor->mnEventCode);
- }
- PostProcessEvent(*pEventDescriptor);
-}
-
-
-
-
void SelectionFunction::NotifyDragFinished (void)
{
- StopDragAndDrop();
-}
-
-
-
-
-::boost::shared_ptr<DragAndDropContext> SelectionFunction::GetDragAndDropContext (void) const
-{
- return mpDragAndDropContext;
+ SwitchToNormalMode();
}
@@ -370,8 +450,8 @@ BOOL SelectionFunction::KeyInput (const KeyEvent& rEvent)
model::SharedPageDescriptor pDescriptor (rFocusManager.GetFocusedPageDescriptor());
if (pDescriptor.get() != NULL)
{
- SetCurrentPage(pDescriptor);
- SwitchView(pDescriptor);
+ mpModeHandler->SetCurrentPage(pDescriptor);
+ mpModeHandler->SwitchView(pDescriptor);
}
bResult = TRUE;
}
@@ -388,13 +468,8 @@ BOOL SelectionFunction::KeyInput (const KeyEvent& rEvent)
case KEY_ESCAPE:
// When there is an active multiselection or drag-and-drop
// operation then stop that.
- StopDragAndDrop();
- if (mpMouseMultiSelector)
- {
- mrSlideSorter.GetView().RequestRepaint(
- mrSlideSorter.GetModel().RestoreSelection());
- StopMouseMultiSelection();
- }
+ mpModeHandler->Abort();
+ SwitchToNormalMode();
bResult = TRUE;
break;
@@ -478,8 +553,7 @@ BOOL SelectionFunction::KeyInput (const KeyEvent& rEvent)
case KEY_F10:
if (rCode.IsShift())
{
- DeselectAllPages();
- mrController.GetPageSelector().SelectPage(
+ mpModeHandler->SelectOnePage(
mrSlideSorter.GetController().GetFocusManager().GetFocusedPageDescriptor());
}
break;
@@ -557,8 +631,7 @@ void SelectionFunction::MoveFocus (
else
{
// Without shift just select the focused page.
- rSelector.DeselectAllPages();
- mrController.GetPageSelector().SelectPage(pFocusedDescriptor);
+ mpModeHandler->SelectOnePage(pFocusedDescriptor);
}
}
@@ -624,179 +697,301 @@ void SelectionFunction::DoPaste (void)
-void SelectionFunction::StartDrag (
- const Point& rMousePosition,
- const InsertionIndicatorHandler::Mode eMode)
+bool SelectionFunction::cancel (void)
{
- // Do not start a drag-and-drop operation when one is already active.
- // (when dragging pages from one document into another, pressing a
- // modifier key can trigger a MouseMotion event in the originating
- // window (focus still in there). Together with the mouse button pressed
- // (drag-and-drop is active) this triggers the start of drag-and-drop.)
- if (SD_MOD()->pTransferDrag != NULL)
- return;
+ mrController.GetFocusManager().ToggleFocus();
+ return true;
+}
- if ( ! mrSlideSorter.GetProperties()->IsUIReadOnly())
- {
- if (mrSlideSorter.GetViewShell() != NULL)
- {
- SlideSorterViewShell* pSlideSorterViewShell
- = dynamic_cast<SlideSorterViewShell*>(mrSlideSorter.GetViewShell());
- pSlideSorterViewShell->StartDrag (rMousePosition, mpWindow);
- }
- if ( ! mpDragAndDropContext)
- {
- mpDragAndDropContext.reset(new DragAndDropContext(mrSlideSorter));
- mrController.GetInsertionIndicatorHandler()->Start(true);
- UpdateMouseOverIndicationPermission();
- }
- mpDragAndDropContext->UpdatePosition(rMousePosition, eMode);
- mpWindow->ReleaseMouse();
+
+
+void SelectionFunction::GotoNextPage (int nOffset)
+{
+ model::SharedPageDescriptor pDescriptor
+ = mrController.GetCurrentSlideManager()->GetCurrentSlide();
+ if (pDescriptor.get() != NULL)
+ {
+ SdPage* pPage = pDescriptor->GetPage();
+ OSL_ASSERT(pPage!=NULL);
+ sal_Int32 nIndex = (pPage->GetPageNum()-1) / 2;
+ GotoPage(nIndex + nOffset);
}
+ mnShiftKeySelectionAnchor = -1;
}
-bool SelectionFunction::cancel (void)
+void SelectionFunction::GotoPage (int nIndex)
{
- mrController.GetFocusManager().ToggleFocus();
- return true;
+ USHORT nPageCount = (USHORT)mrSlideSorter.GetModel().GetPageCount();
+
+ if (nIndex >= nPageCount)
+ nIndex = nPageCount - 1;
+ if (nIndex < 0)
+ nIndex = 0;
+
+ mrController.GetFocusManager().SetFocusedPage(nIndex);
+ model::SharedPageDescriptor pNextPageDescriptor (
+ mrSlideSorter.GetModel().GetPageDescriptor (nIndex));
+ if (pNextPageDescriptor.get() != NULL)
+ mpModeHandler->SetCurrentPage(pNextPageDescriptor);
+ else
+ {
+ OSL_ASSERT(pNextPageDescriptor.get() != NULL);
+ }
+ mnShiftKeySelectionAnchor = -1;
}
-void SelectionFunction::UpdateMouseOverIndicationPermission (void)
+void SelectionFunction::ProcessMouseEvent (sal_uInt32 nEventType, const MouseEvent& rEvent)
{
+ // #95491# remember button state for creation of own MouseEvents
+ SetMouseButtonCode (rEvent.GetButtons());
+
+ EventDescriptor aEventDescriptor (nEventType, rEvent, mrSlideSorter);
+ ProcessEvent(aEventDescriptor);
+}
+
+
+
- // In some modes (dragging, moving) the mouse over indicator is only
- // annoying. Turn it off in these cases.
- mrSlideSorter.GetView().SetIsMouseOverIndicationAllowed(
- ! mpDragAndDropContext
- && ! mpMouseMultiSelector);
+void SelectionFunction::MouseDragged (
+ const AcceptDropEvent& rEvent,
+ const sal_Int8 nDragAction)
+{
+ EventDescriptor aEventDescriptor (MOUSE_DRAG, rEvent, nDragAction, mrSlideSorter);
+ ProcessEvent(aEventDescriptor);
}
-void SelectionFunction::DeselectAllPages (void)
+
+void SelectionFunction::ProcessKeyEvent (const KeyEvent& rEvent)
{
- mbIsDeselectionPending = false;
- mrController.GetPageSelector().DeselectAllPages();
- mnShiftKeySelectionAnchor = -1;
+ EventDescriptor aEventDescriptor (rEvent, mrSlideSorter);
+ ProcessEvent(aEventDescriptor);
}
-void SelectionFunction::RangeSelect (const model::SharedPageDescriptor& rpDescriptor)
+void SelectionFunction::ProcessEvent (EventDescriptor& rDescriptor)
{
- PageSelector::UpdateLock aLock (mrSlideSorter);
- PageSelector& rSelector (mrController.GetPageSelector());
+ PageSelector::BroadcastLock aBroadcastLock (mrSlideSorter);
+ PageSelector::UpdateLock aUpdateLock (mrSlideSorter);
- model::SharedPageDescriptor pAnchor (rSelector.GetSelectionAnchor());
- DeselectAllPages();
+ // The call to ProcessEvent may switch to another mode handler.
+ // To avoid the destruction of the called handler before the call
+ // completes we aquire a temporary reference here.
+ ::boost::shared_ptr<ModeHandler> pModeHandler (mpModeHandler);
+ pModeHandler->ProcessEvent(rDescriptor);
- if (pAnchor.get() != NULL)
+ if (rDescriptor.mnEventCode & BUTTON_UP)
{
- // Select all pages between the anchor and the given one, including
- // the two.
- USHORT nAnchorIndex ((pAnchor->GetPage()->GetPageNum()-1) / 2);
- USHORT nOtherIndex ((rpDescriptor->GetPage()->GetPageNum()-1) / 2);
+// mpWindow->ReleaseMouse();
- // Iterate over all pages in the range. Start with the anchor
- // page. This way the PageSelector will recognize it again as
- // anchor (the first selected page after a DeselectAllPages()
- // becomes the anchor.)
- USHORT nStep = (nAnchorIndex < nOtherIndex) ? +1 : -1;
- USHORT nIndex = nAnchorIndex;
- while (true)
- {
- rSelector.SelectPage(nIndex);
- if (nIndex == nOtherIndex)
- break;
- nIndex = nIndex + nStep;
- }
+ // Hide insertion indicator.
+ if ( ! mrController.IsContextMenuOpen())
+ mrController.GetInsertionIndicatorHandler()->End(Animator::AM_Animated);
}
}
-void SelectionFunction::GotoNextPage (int nOffset)
+bool Match (
+ const sal_uInt32 nEventCode,
+ const sal_uInt32 nPositivePattern)
{
- model::SharedPageDescriptor pDescriptor
- = mrController.GetCurrentSlideManager()->GetCurrentSlide();
- if (pDescriptor.get() != NULL)
+ return (nEventCode & nPositivePattern)==nPositivePattern;
+}
+
+
+
+
+void SelectionFunction::SwitchToNormalMode (void)
+{
+ if (mpModeHandler->GetMode() != NormalMode)
+ SwitchMode(::boost::shared_ptr<ModeHandler>(
+ new NormalModeHandler(mrSlideSorter, *this)));
+}
+
+
+
+
+void SelectionFunction::SwitchToDragAndDropMode (const Point aMousePosition)
+{
+ if (mpModeHandler->GetMode() != DragAndDropMode)
{
- SdPage* pPage = pDescriptor->GetPage();
- OSL_ASSERT(pPage!=NULL);
- sal_Int32 nIndex = (pPage->GetPageNum()-1) / 2;
- GotoPage(nIndex + nOffset);
+ SwitchMode(::boost::shared_ptr<ModeHandler>(
+ new DragAndDropModeHandler(mrSlideSorter, *this, aMousePosition, mpWindow)));
}
- mnShiftKeySelectionAnchor = -1;
}
-void SelectionFunction::GotoPage (int nIndex)
+void SelectionFunction::SwitchToMultiSelectionMode (
+ const Point aMousePosition,
+ const sal_uInt32 nEventCode)
{
- USHORT nPageCount = (USHORT)mrSlideSorter.GetModel().GetPageCount();
+ if (mpModeHandler->GetMode() != MultiSelectionMode)
+ SwitchMode(::boost::shared_ptr<ModeHandler>(
+ new MultiSelectionModeHandler(mrSlideSorter, *this, aMousePosition, nEventCode)));
+}
- if (nIndex >= nPageCount)
- nIndex = nPageCount - 1;
- if (nIndex < 0)
- nIndex = 0;
- mrController.GetFocusManager().SetFocusedPage(nIndex);
- model::SharedPageDescriptor pNextPageDescriptor (
- mrSlideSorter.GetModel().GetPageDescriptor (nIndex));
- if (pNextPageDescriptor.get() != NULL)
- SetCurrentPage(pNextPageDescriptor);
- else
+
+
+void SelectionFunction::SwitchToButtonMode (void)
+{
+ if (mpModeHandler->GetMode() != ButtonMode)
+ SwitchMode(::boost::shared_ptr<ModeHandler>(
+ new ButtonModeHandler(mrSlideSorter, *this)));
+}
+
+
+
+
+void SelectionFunction::SwitchMode (const ::boost::shared_ptr<ModeHandler>& rpHandler)
+{
+ // Not all modes allow mouse over indicator.
+ if (mpModeHandler->IsMouseOverIndicatorAllowed() != rpHandler->IsMouseOverIndicatorAllowed())
{
- OSL_ASSERT(pNextPageDescriptor.get() != NULL);
+ if ( ! rpHandler->IsMouseOverIndicatorAllowed())
+ {
+ mrSlideSorter.GetView().SetPageUnderMouse(model::SharedPageDescriptor());
+ mrSlideSorter.GetView().GetButtonBar().ResetPage();
+ }
+ else
+ mrSlideSorter.GetView().UpdatePageUnderMouse(false);
}
+
+ mpModeHandler = rpHandler;
+}
+
+
+
+
+void SelectionFunction::ResetShiftKeySelectionAnchor (void)
+{
mnShiftKeySelectionAnchor = -1;
}
-void SelectionFunction::ProcessMouseEvent (sal_uInt32 nEventType, const MouseEvent& rEvent)
+//===== EventDescriptor =======================================================
+
+SelectionFunction::EventDescriptor::EventDescriptor (
+ const sal_uInt32 nEventType,
+ const MouseEvent& rEvent,
+ SlideSorter& rSlideSorter)
+ : maMousePosition(rEvent.GetPosPixel()),
+ maMouseModelPosition(),
+ mpHitDescriptor(),
+ mpHitPage(),
+ mnEventCode(nEventType),
+ mbIsOverButton(rSlideSorter.GetView().GetButtonBar().IsMouseOverButton()),
+ meDragMode(InsertionIndicatorHandler::MoveMode),
+ mbMakeSelectionVisible(true),
+ mbIsLeaving(false)
{
- // #95491# remember button state for creation of own MouseEvents
- SetMouseButtonCode (rEvent.GetButtons());
+ maMouseModelPosition = rSlideSorter.GetContentWindow()->PixelToLogic(maMousePosition);
+ mpHitDescriptor = rSlideSorter.GetController().GetPageAt(maMousePosition);
+ if (mpHitDescriptor)
+ {
+ mpHitPage = mpHitDescriptor->GetPage();
+ }
+
+ mnEventCode |= EncodeMouseEvent(rEvent);
+ mnEventCode |= EncodeState();
+
+ mbIsLeaving = rEvent.IsLeaveWindow()
+ || ! Rectangle(Point(0,0),
+ rSlideSorter.GetContentWindow()->GetOutputSizePixel()).IsInside(maMousePosition);
+}
+
- // 1. Compute some frequently used values relating to the event.
- ::std::auto_ptr<EventDescriptor> pEventDescriptor (
- new EventDescriptor(nEventType, rEvent.GetPosPixel(), mrSlideSorter));
- // 2. Compute a numerical code that describes the event and that is used
- // for fast look-up of the associated reaction.
- pEventDescriptor->mnEventCode
- = EncodeMouseEvent(*pEventDescriptor, rEvent) | EncodeState(*pEventDescriptor);
- // 3. Process the event.
- if ( ! ProcessEvent(*pEventDescriptor))
+SelectionFunction::EventDescriptor::EventDescriptor (
+ const sal_uInt32 nEventType,
+ const AcceptDropEvent& rEvent,
+ const sal_Int8 nDragAction,
+ SlideSorter& rSlideSorter)
+ : maMousePosition(rEvent.maPosPixel),
+ maMouseModelPosition(),
+ mpHitDescriptor(),
+ mpHitPage(),
+ mnEventCode(nEventType),
+ mbIsOverButton(rSlideSorter.GetView().GetButtonBar().IsMouseOverButton()),
+ meDragMode(InsertionIndicatorHandler::GetModeFromDndAction(nDragAction)),
+ mbMakeSelectionVisible(true),
+ mbIsLeaving(false)
+{
+ maMouseModelPosition = rSlideSorter.GetContentWindow()->PixelToLogic(maMousePosition);
+ mpHitDescriptor = rSlideSorter.GetController().GetPageAt(maMousePosition);
+ if (mpHitDescriptor)
{
- OSL_TRACE ("can not handle event code %x", pEventDescriptor->mnEventCode);
+ mpHitPage = mpHitDescriptor->GetPage();
}
- PostProcessEvent(*pEventDescriptor);
+
+ mnEventCode |= EncodeState();
+
+ mbIsLeaving = rEvent.mbLeaving
+ || ! Rectangle(Point(0,0),
+ rSlideSorter.GetContentWindow()->GetOutputSizePixel()).IsInside(maMousePosition);
+}
+
+
+
+
+SelectionFunction::EventDescriptor::EventDescriptor (
+ const KeyEvent& rEvent,
+ SlideSorter& rSlideSorter)
+ : maMousePosition(),
+ maMouseModelPosition(),
+ mpHitDescriptor(),
+ mpHitPage(),
+ mnEventCode(KEY_EVENT),
+ mbIsOverButton(rSlideSorter.GetView().GetButtonBar().IsMouseOverButton()),
+ meDragMode(InsertionIndicatorHandler::MoveMode),
+ mbMakeSelectionVisible(true),
+ mbIsLeaving(false)
+{
+ model::SharedPageDescriptor pHitDescriptor (
+ rSlideSorter.GetController().GetFocusManager().GetFocusedPageDescriptor());
+ if (pHitDescriptor.get() != NULL)
+ {
+ mpHitPage = pHitDescriptor->GetPage();
+ mpHitDescriptor = pHitDescriptor;
+ }
+
+ mnEventCode |= EncodeKeyEvent(rEvent) | EncodeState();
+}
+
+
+
+
+void SelectionFunction::EventDescriptor::SetDragMode (const InsertionIndicatorHandler::Mode eMode)
+{
+ meDragMode = eMode;
}
-sal_uInt32 SelectionFunction::EncodeMouseEvent (
- const EventDescriptor& rDescriptor,
+sal_uInt32 SelectionFunction::EventDescriptor::EncodeMouseEvent (
const MouseEvent& rEvent) const
{
// Initialize with the type of mouse event.
- sal_uInt32 nEventCode (rDescriptor.mnEventCode & (BUTTON_DOWN | BUTTON_UP | MOUSE_MOTION));
+ sal_uInt32 nEventCode (mnEventCode & (BUTTON_DOWN | BUTTON_UP | MOUSE_MOTION));
// Detect the affected button.
switch (rEvent.GetButtons())
@@ -821,7 +1016,7 @@ sal_uInt32 SelectionFunction::EncodeMouseEvent (
// Detect whether the mouse is over one of the active elements inside a
// page object.
- if (rDescriptor.mnButtonIndex >= 0)
+ if (mbIsOverButton)
nEventCode |= OVER_BUTTON;
return nEventCode;
@@ -829,17 +1024,11 @@ sal_uInt32 SelectionFunction::EncodeMouseEvent (
-sal_uInt32 SelectionFunction::EncodeKeyEvent (
- const EventDescriptor& rDescriptor,
- const KeyEvent& rEvent) const
-{
- (void)rDescriptor;
-
- // Initialize as key event.
- sal_uInt32 nEventCode (KEY_EVENT);
- // Add the actual key code in the lower 16 bit.
- nEventCode |= rEvent.GetKeyCode().GetCode();
+sal_uInt32 SelectionFunction::EventDescriptor::EncodeKeyEvent (const KeyEvent& rEvent) const
+{
+ // The key code in the lower 16 bit.
+ sal_uInt32 nEventCode (rEvent.GetKeyCode().GetCode());
// Detect pressed modifier keys.
if (rEvent.GetKeyCode().IsShift())
@@ -853,177 +1042,274 @@ sal_uInt32 SelectionFunction::EncodeKeyEvent (
-sal_uInt32 SelectionFunction::EncodeState (
- const EventDescriptor& rDescriptor) const
+sal_uInt32 SelectionFunction::EventDescriptor::EncodeState (void) const
{
sal_uInt32 nEventCode (0);
// Detect whether the event has happened over a page object.
- if (rDescriptor.mpHitPage != NULL && rDescriptor.mpHitDescriptor)
+ if (mpHitPage!=NULL && mpHitDescriptor)
{
- if (rDescriptor.mpHitDescriptor->HasState(model::PageDescriptor::ST_Selected))
+ if (mpHitDescriptor->HasState(model::PageDescriptor::ST_Selected))
nEventCode |= OVER_SELECTED_PAGE;
else
nEventCode |= OVER_UNSELECTED_PAGE;
// Detect whether the mouse is over one of the active elements
// inside a page object.
- if (rDescriptor.mnButtonIndex >= 0)
+ if (mbIsOverButton)
nEventCode |= OVER_BUTTON;
}
- // Detect whether we are dragging pages or dragging a selection rectangle.
- if (mpDragAndDropContext)
- nEventCode |= DRAG_ACTIVE;
- if (mpMouseMultiSelector)
- nEventCode |= MULTI_SELECTOR;
-
return nEventCode;
}
-void SelectionFunction::ProcessKeyEvent (const KeyEvent& rEvent)
-{
- // 1. Compute some frequently used values relating to the event.
- ::std::auto_ptr<EventDescriptor> pEventDescriptor (
- new EventDescriptor(rEvent, mrSlideSorter));
-
- // 2. Encode the event.
- pEventDescriptor->mnEventCode
- = EncodeKeyEvent(*pEventDescriptor, rEvent) | EncodeState(*pEventDescriptor);
+//===== SelectionFunction::ModeHandler ========================================
- // 3. Process the event.
- if ( ! ProcessEvent(*pEventDescriptor))
- OSL_TRACE ("can not handle event code %x", pEventDescriptor->mnEventCode);
- PostProcessEvent(*pEventDescriptor);
+SelectionFunction::ModeHandler::ModeHandler (
+ SlideSorter& rSlideSorter,
+ SelectionFunction& rSelectionFunction,
+ const bool bIsMouseOverIndicatorAllowed)
+ : mrSlideSorter(rSlideSorter),
+ mrSelectionFunction(rSelectionFunction),
+ mbIsMouseOverIndicatorAllowed(bIsMouseOverIndicatorAllowed)
+{
}
-bool Match (
- const sal_uInt32 nEventCode,
- const sal_uInt32 nPositivePattern)
+SelectionFunction::ModeHandler::~ModeHandler (void)
{
- return (nEventCode & nPositivePattern)==nPositivePattern;
}
-bool SelectionFunction::ProcessEvent (EventDescriptor& rDescriptor)
+void SelectionFunction::ModeHandler::ReprocessEvent (EventDescriptor& rDescriptor)
{
- // Define some macros to make the following switch statement more readable.
-#define ANY_MODIFIER(code) \
- code|NO_MODIFIER: \
- case code|SHIFT_MODIFIER: \
- case code|CONTROL_MODIFIER
+ mrSelectionFunction.ProcessEvent(rDescriptor);
+}
- bool bResult (true);
- PageSelector::BroadcastLock aBroadcastLock (mrSlideSorter);
- PageSelector::UpdateLock aUpdateLock (mrSlideSorter);
- // With the event code determine the type of operation with which to
- // react to the event.
- switch (rDescriptor.mnEventCode & (DRAG_ACTIVE | MULTI_SELECTOR))
+void SelectionFunction::ModeHandler::ProcessEvent (
+ SelectionFunction::EventDescriptor& rDescriptor)
+{
+ bool bIsProcessed (false);
+ switch (rDescriptor.mnEventCode & (BUTTON_DOWN | BUTTON_UP | MOUSE_MOTION | MOUSE_DRAG))
{
- case DRAG_ACTIVE:
- ProcessEventWhileDragActive(rDescriptor);
+ case BUTTON_DOWN:
+ bIsProcessed = ProcessButtonDownEvent(rDescriptor);
break;
- case MULTI_SELECTOR:
- ProcessEventWhileMultiSelectorActive(rDescriptor);
+ case BUTTON_UP:
+ bIsProcessed = ProcessButtonUpEvent(rDescriptor);
+ mrSelectionFunction.SwitchToNormalMode();
break;
- default:
- OSL_ASSERT(!mpMouseMultiSelector);
- OSL_ASSERT(!mpDragAndDropContext);
- switch (rDescriptor.mnEventCode & (BUTTON_DOWN | BUTTON_UP | MOUSE_MOTION))
- {
- case BUTTON_DOWN:
- ProcessButtonDownEvent(rDescriptor);
- break;
-
- case BUTTON_UP:
- ProcessButtonUpEvent(rDescriptor);
- break;
+ case MOUSE_MOTION:
+ bIsProcessed = ProcessMotionEvent(rDescriptor);
+ break;
- case MOUSE_MOTION:
- ProcessMouseMotionEvent(rDescriptor);
- break;
- }
+ case MOUSE_DRAG:
+ bIsProcessed = ProcessDragEvent(rDescriptor);
+ break;
}
- return bResult;
+ if ( ! bIsProcessed)
+ HandleUnprocessedEvent(rDescriptor);
}
-void SelectionFunction::ProcessEventWhileDragActive (EventDescriptor& rDescriptor)
+bool SelectionFunction::ModeHandler::ProcessButtonDownEvent (EventDescriptor&)
{
- OSL_ASSERT(mpDragAndDropContext);
- // The substitution is visible. Handle events accordingly.
- if (Match(rDescriptor.mnEventCode, MOUSE_MOTION | LEFT_BUTTON | SINGLE_CLICK))
- {
- // mpDragAndDropContext->UpdatePosition(
- // rDescriptor.maMousePosition,
- // rDescriptor.meDragMode);
- }
- else if (Match(rDescriptor.mnEventCode, MOUSE_DRAG))
- {
- mpDragAndDropContext->UpdatePosition(
+ return false;
+}
+
+
+
+
+bool SelectionFunction::ModeHandler::ProcessButtonUpEvent (EventDescriptor&)
+{
+ return false;
+}
+
+
+
+
+bool SelectionFunction::ModeHandler::ProcessMotionEvent (EventDescriptor& rDescriptor)
+{
+ if (mbIsMouseOverIndicatorAllowed)
+ mrSlideSorter.GetView().UpdatePageUnderMouse(
rDescriptor.maMousePosition,
- rDescriptor.meDragMode);
- }
- else if (Match(rDescriptor.mnEventCode, BUTTON_UP | LEFT_BUTTON))
+ (rDescriptor.mnEventCode & LEFT_BUTTON) != 0,
+ true);
+
+ // Detect the mouse leaving the window. When not button is pressed then
+ // we can call IsLeaveWindow at the event. Otherwise we have to make an
+ // explicit test.
+ if (rDescriptor.mbIsLeaving)
{
- // The following Process() call may lead to the desctruction
- // of rDescriptor.mpHitDescriptor so release our reference to it.
- rDescriptor.mpHitDescriptor.reset();
- StopDragAndDrop();
+ mrSelectionFunction.SwitchToNormalMode();
+ mrSlideSorter.GetView().SetPageUnderMouse(model::SharedPageDescriptor());
+
+ return true;
}
+ else
+ return false;
}
-void SelectionFunction::ProcessEventWhileMultiSelectorActive (EventDescriptor& rDescriptor)
+bool SelectionFunction::ModeHandler::ProcessDragEvent (EventDescriptor&)
{
- OSL_ASSERT(mpMouseMultiSelector);
- // The selection rectangle is visible. Handle events accordingly.
- if (Match(rDescriptor.mnEventCode, MOUSE_MOTION | LEFT_BUTTON | SINGLE_CLICK))
+ return false;
+}
+
+
+
+
+bool SelectionFunction::ModeHandler::HandleUnprocessedEvent (EventDescriptor&)
+{
+ return false;
+}
+
+
+
+
+void SelectionFunction::ModeHandler::SetCurrentPage (
+ const model::SharedPageDescriptor& rpDescriptor)
+{
+ SelectOnePage(rpDescriptor);
+
+ mrSlideSorter.GetController().GetCurrentSlideManager()->SwitchCurrentSlide(rpDescriptor);
+}
+
+
+
+
+void SelectionFunction::ModeHandler::DeselectAllPages (void)
+{
+ mrSlideSorter.GetController().GetPageSelector().DeselectAllPages();
+ mrSelectionFunction.ResetShiftKeySelectionAnchor();
+}
+
+
+
+
+void SelectionFunction::ModeHandler::SelectOnePage (
+ const model::SharedPageDescriptor& rpDescriptor)
+{
+ DeselectAllPages();
+ mrSlideSorter.GetController().GetPageSelector().SelectPage(rpDescriptor);
+}
+
+
+
+
+void SelectionFunction::ModeHandler::SwitchView (const model::SharedPageDescriptor& rpDescriptor)
+{
+ // Switch to the draw view. This is done only when the current
+ // view is the main view.
+ ViewShell* pViewShell = mrSlideSorter.GetViewShell();
+ if (pViewShell!=NULL && pViewShell->IsMainViewShell())
{
- if (mpMouseMultiSelector)
+ if (rpDescriptor.get()!=NULL && rpDescriptor->GetPage()!=NULL)
{
- mpMouseMultiSelector->SetSelectionModeFromModifier(rDescriptor.mnEventCode);
- mpMouseMultiSelector->UpdatePosition(rDescriptor.maMousePosition);
+ mrSlideSorter.GetModel().GetDocument()->SetSelected(rpDescriptor->GetPage(), TRUE);
+ pViewShell->GetFrameView()->SetSelectedPage(
+ (rpDescriptor->GetPage()->GetPageNum()-1)/2);
}
- rDescriptor.mbMakeSelectionVisible = false;
- }
- else if (Match(rDescriptor.mnEventCode, BUTTON_UP | LEFT_BUTTON | SINGLE_CLICK))
- {
- StopMouseMultiSelection();
+ if (mrSlideSorter.GetViewShellBase() != NULL)
+ framework::FrameworkHelper::Instance(*mrSlideSorter.GetViewShellBase())->RequestView(
+ framework::FrameworkHelper::msImpressViewURL,
+ framework::FrameworkHelper::msCenterPaneURL);
}
- // Anything else stops the rectangle selection and the event is
- // processed again.
- else
+}
+
+
+
+
+void SelectionFunction::ModeHandler::StartDrag (
+ const Point& rMousePosition,
+ const InsertionIndicatorHandler::Mode eMode)
+{
+ // Do not start a drag-and-drop operation when one is already active.
+ // (when dragging pages from one document into another, pressing a
+ // modifier key can trigger a MouseMotion event in the originating
+ // window (focus still in there). Together with the mouse button pressed
+ // (drag-and-drop is active) this triggers the start of drag-and-drop.)
+ if (SD_MOD()->pTransferDrag != NULL)
+ return;
+
+ if ( ! mrSlideSorter.GetProperties()->IsUIReadOnly())
{
- StopMouseMultiSelection();
- rDescriptor.mnEventCode &= ~MULTI_SELECTOR;
- ProcessEvent(rDescriptor);
+ mrSelectionFunction.SwitchToDragAndDropMode(rMousePosition);
}
}
-void SelectionFunction::ProcessButtonDownEvent (EventDescriptor& rDescriptor)
+bool SelectionFunction::ModeHandler::IsMouseOverIndicatorAllowed (void) const
{
+ return mbIsMouseOverIndicatorAllowed;
+}
+
+
+
+
+//===== NormalModeHandler =====================================================
+
+NormalModeHandler::NormalModeHandler (
+ SlideSorter& rSlideSorter,
+ SelectionFunction& rSelectionFunction)
+ : ModeHandler(rSlideSorter, rSelectionFunction, true)
+{
+}
+
+
+
+
+NormalModeHandler::~NormalModeHandler (void)
+{
+}
+
+
+
+
+SelectionFunction::Mode NormalModeHandler::GetMode (void) const
+{
+ return SelectionFunction::NormalMode;
+}
+
+
+
+
+void NormalModeHandler::Abort (void)
+{
+}
+
+
+
+
+bool NormalModeHandler::ProcessButtonDownEvent (
+ SelectionFunction::EventDescriptor& rDescriptor)
+{
+ // Remember the location where the left button is pressed. With
+ // that we can filter away motion events that are caused by key
+ // presses. We also can tune the minimal motion distance that
+ // triggers a drag-and-drop operation.
+ if ((rDescriptor.mnEventCode & BUTTON_DOWN) != 0)
+ maButtonDownLocation = rDescriptor.maMousePosition;
+
switch (rDescriptor.mnEventCode)
{
case BUTTON_DOWN | LEFT_BUTTON | SINGLE_CLICK | OVER_UNSELECTED_PAGE:
@@ -1049,16 +1335,11 @@ void SelectionFunction::ProcessButtonDownEvent (EventDescriptor& rDescriptor)
case BUTTON_DOWN | LEFT_BUTTON | SINGLE_CLICK | OVER_UNSELECTED_PAGE | OVER_BUTTON:
case BUTTON_DOWN | LEFT_BUTTON | SINGLE_CLICK | OVER_SELECTED_PAGE | OVER_BUTTON:
- // Remember page and button index. When mouse button is
- // released over same page and button then invoke action of that
- // button.
- mnButtonDownButtonIndex = rDescriptor.mnButtonIndex;
- OSL_ASSERT(rDescriptor.mpHitDescriptor);
- mnButtonDownPageIndex = rDescriptor.mpHitDescriptor->GetPageIndex();
- rDescriptor.mpHitDescriptor->GetVisualState().SetActiveButtonState(
- mnButtonDownButtonIndex,
- model::VisualState::BS_Pressed);
- mrSlideSorter.GetView().RequestRepaint(rDescriptor.mpHitDescriptor);
+ if (mrSlideSorter.GetView().GetButtonBar().IsMouseOverButton())
+ {
+ mrSelectionFunction.SwitchToButtonMode();
+ ReprocessEvent(rDescriptor);
+ }
break;
// Right button for context menu.
@@ -1068,7 +1349,6 @@ void SelectionFunction::ProcessButtonDownEvent (EventDescriptor& rDescriptor)
// page under the mouse is not selected. In this case the
// selection is set to this single page. Otherwise the
// selection is not modified.
- DeselectAllPages();
SetCurrentPage(rDescriptor.mpHitDescriptor);
rDescriptor.mbMakeSelectionVisible = false;
break;
@@ -1086,14 +1366,20 @@ void SelectionFunction::ProcessButtonDownEvent (EventDescriptor& rDescriptor)
mrSlideSorter.GetModel().SaveCurrentSelection();
DeselectAllPages();
break;
+
+ default:
+ return false;
}
+ return true;
}
-void SelectionFunction::ProcessButtonUpEvent (const EventDescriptor& rDescriptor)
+bool NormalModeHandler::ProcessButtonUpEvent (
+ SelectionFunction::EventDescriptor& rDescriptor)
{
+ bool bIsProcessed (true);
switch (rDescriptor.mnEventCode)
{
case BUTTON_UP | LEFT_BUTTON | SINGLE_CLICK | OVER_SELECTED_PAGE:
@@ -1102,42 +1388,39 @@ void SelectionFunction::ProcessButtonUpEvent (const EventDescriptor& rDescriptor
// Multi selection with the control modifier.
case BUTTON_UP | LEFT_BUTTON | SINGLE_CLICK | OVER_SELECTED_PAGE | CONTROL_MODIFIER:
- mrController.GetPageSelector().DeselectPage(rDescriptor.mpHitDescriptor);
+ mrSlideSorter.GetController().GetPageSelector().DeselectPage(
+ rDescriptor.mpHitDescriptor);
break;
case BUTTON_UP | LEFT_BUTTON | SINGLE_CLICK | OVER_UNSELECTED_PAGE | CONTROL_MODIFIER:
- mrController.GetPageSelector().SelectPage(rDescriptor.mpHitDescriptor);
- // fallthrough
- case BUTTON_UP | LEFT_BUTTON | SINGLE_CLICK | OVER_UNSELECTED_PAGE | OVER_BUTTON:
- case BUTTON_UP | LEFT_BUTTON | SINGLE_CLICK | OVER_SELECTED_PAGE | OVER_BUTTON:
- if (mnButtonDownButtonIndex == rDescriptor.mnButtonIndex
- && mnButtonDownPageIndex == rDescriptor.mpHitDescriptor->GetPageIndex()
- && rDescriptor.mpHitDescriptor->GetVisualState().GetButtonAlpha()<0.7)
- {
- ProcessButtonClick(rDescriptor.mpHitDescriptor, mnButtonDownButtonIndex);
- }
- // Update state of button under mouse (typically from pressed to
- // mouse over). Note that the button under the mouse can change
- // when the exclusions state changes (three buttons vs. wide button.)
- mrSlideSorter.GetView().SetButtonUnderMouse(
- mrSlideSorter.GetView().GetLayouter().GetPageObjectLayouter()->GetButtonIndexAt(
- rDescriptor.mpHitDescriptor,
- rDescriptor.maMouseModelPosition),
- true);
+ mrSlideSorter.GetController().GetPageSelector().SelectPage(
+ rDescriptor.mpHitDescriptor);
+ mrSlideSorter.GetView().UpdatePageUnderMouse(
+ rDescriptor.mpHitDescriptor,
+ rDescriptor.maMousePosition,
+ false);
break;
-
case BUTTON_UP | LEFT_BUTTON | SINGLE_CLICK | NOT_OVER_PAGE:
- if (mbIsDeselectionPending)
- DeselectAllPages();
+ break;
+
+ default:
+ bIsProcessed = false;
break;
}
+ mrSelectionFunction.SwitchToNormalMode();
+ return bIsProcessed;
}
-void SelectionFunction::ProcessMouseMotionEvent (const EventDescriptor& rDescriptor)
+bool NormalModeHandler::ProcessMotionEvent (
+ SelectionFunction::EventDescriptor& rDescriptor)
{
+ if (ModeHandler::ProcessMotionEvent(rDescriptor))
+ return true;
+
+ bool bIsProcessed (true);
switch (rDescriptor.mnEventCode)
{
case ANY_MODIFIER(MOUSE_MOTION | LEFT_BUTTON | SINGLE_CLICK | OVER_UNSELECTED_PAGE):
@@ -1146,284 +1429,176 @@ void SelectionFunction::ProcessMouseMotionEvent (const EventDescriptor& rDescrip
// A mouse motion without visible substitution starts that.
case ANY_MODIFIER(MOUSE_MOTION | LEFT_BUTTON | SINGLE_CLICK | OVER_SELECTED_PAGE):
- StartDrag(
- rDescriptor.maMousePosition,
- (rDescriptor.mnEventCode & CONTROL_MODIFIER) != 0
- ? InsertionIndicatorHandler::CopyMode
- : InsertionIndicatorHandler::MoveMode);
- break;
+ {
+ const sal_Int32 nDistance (
+ ::std::max (
+ abs(maButtonDownLocation.X() - rDescriptor.maMousePosition.X()),
+ abs(maButtonDownLocation.Y() - rDescriptor.maMousePosition.Y())));
+ if (nDistance > 3)
+ StartDrag(
+ rDescriptor.maMousePosition,
+ (rDescriptor.mnEventCode & CONTROL_MODIFIER) != 0
+ ? InsertionIndicatorHandler::CopyMode
+ : InsertionIndicatorHandler::MoveMode);
+ }
+ break;
// A mouse motion not over a page starts a rectangle selection.
case ANY_MODIFIER(MOUSE_MOTION | LEFT_BUTTON | SINGLE_CLICK | NOT_OVER_PAGE):
- OSL_ASSERT(!mpMouseMultiSelector);
- mpMouseMultiSelector.reset(
- new MouseMultiSelector(mrSlideSorter, rDescriptor.maMouseModelPosition));
- mpMouseMultiSelector->SetSelectionModeFromModifier(rDescriptor.mnEventCode);
- UpdateMouseOverIndicationPermission();
+ mrSelectionFunction.SwitchToMultiSelectionMode(
+ rDescriptor.maMouseModelPosition,
+ rDescriptor.mnEventCode);
break;
- }
-}
-
-
-
-void SelectionFunction::PostProcessEvent (const EventDescriptor& rDescriptor)
-{
- if (rDescriptor.mnEventCode & BUTTON_UP)
- {
- mpWindow->ReleaseMouse();
-
- // Now turn them off.
- if ( ! mrController.IsContextMenuOpen())
- mrController.GetInsertionIndicatorHandler()->End(Animator::AM_Animated);
-
- mnButtonDownPageIndex = -1;
- mnButtonDownButtonIndex = -1;
+ default:
+ bIsProcessed = false;
+ break;
}
+ return bIsProcessed;
}
-void SelectionFunction::SetCurrentPage (const model::SharedPageDescriptor& rpDescriptor)
-{
- PageSelector& rSelector (mrController.GetPageSelector());
- rSelector.DeselectAllPages ();
- rSelector.SelectPage(rpDescriptor);
-
- mrController.GetCurrentSlideManager()->SwitchCurrentSlide(rpDescriptor);
- mrController.GetFocusManager().SetFocusedPage(rpDescriptor);
-
- mnShiftKeySelectionAnchor = -1;
-}
-
-
-
-
-void SelectionFunction::SwitchView (const model::SharedPageDescriptor& rpDescriptor)
+bool NormalModeHandler::ProcessDragEvent (SelectionFunction::EventDescriptor& rDescriptor)
{
- // Switch to the draw view. This is done only when the current
- // view is the main view.
- ViewShell* pViewShell = mrSlideSorter.GetViewShell();
- if (pViewShell!=NULL && pViewShell->IsMainViewShell())
- {
- if (rpDescriptor.get()!=NULL && rpDescriptor->GetPage()!=NULL)
- {
- mrSlideSorter.GetModel().GetDocument()->SetSelected(rpDescriptor->GetPage(), TRUE);
- mpViewShell->GetFrameView()->SetSelectedPage(
- (rpDescriptor->GetPage()->GetPageNum()-1)/2);
- }
- if (mrSlideSorter.GetViewShellBase() != NULL)
- framework::FrameworkHelper::Instance(*mrSlideSorter.GetViewShellBase())->RequestView(
- framework::FrameworkHelper::msImpressViewURL,
- framework::FrameworkHelper::msCenterPaneURL);
- }
+ mrSelectionFunction.SwitchToDragAndDropMode(rDescriptor.maMousePosition);
+ ReprocessEvent(rDescriptor);
+ return true;
}
-void SelectionFunction::ProcessButtonClick (
- const model::SharedPageDescriptor& rpDescriptor,
- const sal_Int32 nButtonIndex)
+void NormalModeHandler::RangeSelect (const model::SharedPageDescriptor& rpDescriptor)
{
- OSL_ASSERT(rpDescriptor);
-
PageSelector::UpdateLock aLock (mrSlideSorter);
PageSelector& rSelector (mrSlideSorter.GetController().GetPageSelector());
- switch (nButtonIndex)
- {
- case 2:
- // Start slide show at current slide.
- mrSlideSorter.GetController().GetCurrentSlideManager()->SwitchCurrentSlide(
- rpDescriptor);
- if (mrSlideSorter.GetViewShell() != NULL)
- mrSlideSorter.GetViewShell()->GetDispatcher()->Execute(
- SID_PRESENTATION,
- SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
- break;
-
- case 1:
- if ( ! rpDescriptor)
- return;
- // Toggle exclusion state.
- mrSlideSorter.GetController().GetSlotManager()->ChangeSlideExclusionState(
- (rpDescriptor->HasState(model::PageDescriptor::ST_Selected)
- ? model::SharedPageDescriptor()
- : rpDescriptor),
- ! rpDescriptor->HasState(model::PageDescriptor::ST_Excluded));
- break;
-
- case 0:
- if ( ! rpDescriptor)
- return;
- // When the page under the button is not selected then set the
- // selection to just this page.
- if ( ! rpDescriptor->HasState(model::PageDescriptor::ST_Selected))
- {
- rSelector.DeselectAllPages();
- rSelector.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()->Execute(
- SID_DUPLICATE_PAGE,
- SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
- break;
- }
-}
-
-
+ model::SharedPageDescriptor pAnchor (rSelector.GetSelectionAnchor());
+ DeselectAllPages();
-void SelectionFunction::StopDragAndDrop (void)
-{
- if (mpDragAndDropContext)
+ if (pAnchor.get() != NULL)
{
- // Disconnect the substitution handler from this selection function.
- mpDragAndDropContext->Hide();
- mpDragAndDropContext->SetTargetSlideSorter();
- mpDragAndDropContext.reset();
- UpdateMouseOverIndicationPermission();
+ // Select all pages between the anchor and the given one, including
+ // the two.
+ USHORT nAnchorIndex ((pAnchor->GetPage()->GetPageNum()-1) / 2);
+ USHORT nOtherIndex ((rpDescriptor->GetPage()->GetPageNum()-1) / 2);
+
+ // Iterate over all pages in the range. Start with the anchor
+ // page. This way the PageSelector will recognize it again as
+ // anchor (the first selected page after a DeselectAllPages()
+ // becomes the anchor.)
+ USHORT nStep = (nAnchorIndex < nOtherIndex) ? +1 : -1;
+ USHORT nIndex = nAnchorIndex;
+ while (true)
+ {
+ rSelector.SelectPage(nIndex);
+ if (nIndex == nOtherIndex)
+ break;
+ nIndex = nIndex + nStep;
+ }
}
- mrController.GetInsertionIndicatorHandler()->End(Animator::AM_Animated);
}
-void SelectionFunction::StopMouseMultiSelection (void)
+//===== MultiSelectionModeHandler =============================================
+
+MultiSelectionModeHandler::MultiSelectionModeHandler (
+ SlideSorter& rSlideSorter,
+ SelectionFunction& rSelectionFunction,
+ const Point& rMouseModelPosition,
+ const sal_uInt32 nEventCode)
+ : ModeHandler(rSlideSorter, rSelectionFunction, false),
+ meSelectionMode(SM_Normal),
+ maSecondCorner(rMouseModelPosition),
+ maSavedPointer(mrSlideSorter.GetContentWindow()->GetPointer()),
+ mnAnchorIndex(-1),
+ mnSecondIndex(-1)
{
- if (mpMouseMultiSelector)
- {
- mpMouseMultiSelector.reset();
- UpdateMouseOverIndicationPermission();
- }
+ const Pointer aSelectionPointer (POINTER_TEXT);
+ mrSlideSorter.GetContentWindow()->SetPointer(aSelectionPointer);
+ SetSelectionModeFromModifier(nEventCode);
}
-//===== EventDescriptor =======================================================
-SelectionFunction::EventDescriptor::EventDescriptor (
- sal_uInt32 nEventType,
- const Point& rMousePosition,
- SlideSorter& rSlideSorter)
- : maMousePosition(rMousePosition),
- maMouseModelPosition(),
- mpHitDescriptor(),
- mpHitPage(),
- mnEventCode(nEventType),
- mnButtonIndex(-1)
+MultiSelectionModeHandler::~MultiSelectionModeHandler (void)
{
- maMouseModelPosition = rSlideSorter.GetContentWindow()->PixelToLogic(maMousePosition);
- mpHitDescriptor = rSlideSorter.GetController().GetPageAt(maMousePosition);
- if (mpHitDescriptor)
- {
- mpHitPage = mpHitDescriptor->GetPage();
-
- if (mpHitDescriptor->HasState(model::PageDescriptor::ST_Excluded))
- {
- if (rSlideSorter.GetView().GetLayouter().GetPageObjectLayouter()->GetBoundingBox(
- mpHitDescriptor,
- view::PageObjectLayouter::WideButton,
- view::PageObjectLayouter::ModelCoordinateSystem).IsInside(maMouseModelPosition))
- {
- mnButtonIndex = view::PageObjectLayouter::ShowHideButtonIndex;
- }
- }
- else
- {
- mnButtonIndex
- = rSlideSorter.GetView().GetLayouter().GetPageObjectLayouter()->GetButtonIndexAt(
- mpHitDescriptor,
- maMouseModelPosition);
- }
- }
+ mrSlideSorter.GetContentWindow()->SetPointer(maSavedPointer);
}
-
-SelectionFunction::EventDescriptor::EventDescriptor (
- const KeyEvent&,
- SlideSorter& rSlideSorter)
- : maMousePosition(),
- maMouseModelPosition(),
- mpHitDescriptor(),
- mpHitPage(),
- mnEventCode(0),
- mnButtonIndex(-1),
- meDragMode(InsertionIndicatorHandler::MoveMode),
- mbMakeSelectionVisible(true)
+SelectionFunction::Mode MultiSelectionModeHandler::GetMode (void) const
{
- model::SharedPageDescriptor pHitDescriptor (
- rSlideSorter.GetController().GetFocusManager().GetFocusedPageDescriptor());
- if (pHitDescriptor.get() != NULL)
- {
- mpHitPage = pHitDescriptor->GetPage();
- mpHitDescriptor = pHitDescriptor;
- }
+ return SelectionFunction::MultiSelectionMode;
}
-
-SelectionFunction::EventDescriptor::EventDescriptor (const EventDescriptor& rDescriptor)
- : maMousePosition(rDescriptor.maMousePosition),
- maMouseModelPosition(rDescriptor.maMouseModelPosition),
- mpHitDescriptor(rDescriptor.mpHitDescriptor),
- mpHitPage(rDescriptor.mpHitPage),
- mnEventCode(rDescriptor.mnEventCode),
- mnButtonIndex(rDescriptor.mnButtonIndex),
- meDragMode(InsertionIndicatorHandler::MoveMode),
- mbMakeSelectionVisible(true)
+void MultiSelectionModeHandler::Abort (void)
{
+ mrSlideSorter.GetView().RequestRepaint(mrSlideSorter.GetModel().RestoreSelection());
}
-void SelectionFunction::EventDescriptor::SetDragMode (const InsertionIndicatorHandler::Mode eMode)
+bool MultiSelectionModeHandler::ProcessButtonUpEvent (
+ SelectionFunction::EventDescriptor& rDescriptor)
{
- meDragMode = eMode;
+ if (Match(rDescriptor.mnEventCode, BUTTON_UP | LEFT_BUTTON | SINGLE_CLICK))
+ {
+ mrSelectionFunction.SwitchToNormalMode();
+ return true;
+ }
+ else
+ return false;
}
-//===== SelectionFunction::MouseMultiSelector ======================================
-
-SelectionFunction::MouseMultiSelector::MouseMultiSelector (
- SlideSorter& rSlideSorter,
- const Point& rMouseModelPosition)
- : mrSlideSorter(rSlideSorter),
- meSelectionMode(SM_Normal),
- maSecondCorner(rMouseModelPosition),
- maSavedPointer(mrSlideSorter.GetContentWindow()->GetPointer()),
- mnAnchorIndex(-1),
- mnSecondIndex(-1)
+bool MultiSelectionModeHandler::ProcessMotionEvent (
+ SelectionFunction::EventDescriptor& rDescriptor)
{
- const Pointer aSelectionPointer (POINTER_TEXT);
- mrSlideSorter.GetContentWindow()->SetPointer(aSelectionPointer);
+ // The selection rectangle is visible. Handle events accordingly.
+ if (Match(rDescriptor.mnEventCode, MOUSE_MOTION | LEFT_BUTTON | SINGLE_CLICK))
+ {
+ SetSelectionModeFromModifier(rDescriptor.mnEventCode);
+ UpdatePosition(rDescriptor.maMousePosition, true);
+ rDescriptor.mbMakeSelectionVisible = false;
+ return true;
+ }
+ else
+ return false;
}
-
-SelectionFunction::MouseMultiSelector::~MouseMultiSelector (void)
+bool MultiSelectionModeHandler::HandleUnprocessedEvent (
+ SelectionFunction::EventDescriptor& rDescriptor)
{
- mrSlideSorter.GetContentWindow()->SetPointer(maSavedPointer);
+ if ( ! ModeHandler::HandleUnprocessedEvent(rDescriptor))
+ {
+ // If the event has not been processed then stop multi selection.
+ mrSelectionFunction.SwitchToNormalMode();
+ ReprocessEvent(rDescriptor);
+ }
+ return true;
}
-void SelectionFunction::MouseMultiSelector::UpdatePosition (
+void MultiSelectionModeHandler::UpdatePosition (
const Point& rMousePosition,
const bool bAllowAutoScroll)
{
@@ -1436,7 +1611,7 @@ void SelectionFunction::MouseMultiSelector::UpdatePosition (
if ( ! (bAllowAutoScroll && mrSlideSorter.GetController().GetScrollBarManager().AutoScroll(
rMousePosition,
::boost::bind(
- &SelectionFunction::MouseMultiSelector::UpdatePosition,
+ &MultiSelectionModeHandler::UpdatePosition,
this,
rMousePosition,
false))))
@@ -1448,7 +1623,7 @@ void SelectionFunction::MouseMultiSelector::UpdatePosition (
-void SelectionFunction::MouseMultiSelector::SetSelectionModeFromModifier (
+void MultiSelectionModeHandler::SetSelectionModeFromModifier (
const sal_uInt32 nEventCode)
{
switch (nEventCode & MODIFIER_MASK)
@@ -1470,7 +1645,7 @@ void SelectionFunction::MouseMultiSelector::SetSelectionModeFromModifier (
-void SelectionFunction::MouseMultiSelector::SetSelectionMode (const SelectionMode eSelectionMode)
+void MultiSelectionModeHandler::SetSelectionMode (const SelectionMode eSelectionMode)
{
if (meSelectionMode != eSelectionMode)
{
@@ -1482,7 +1657,7 @@ void SelectionFunction::MouseMultiSelector::SetSelectionMode (const SelectionMod
-void SelectionFunction::MouseMultiSelector::UpdateSelectionState (
+void MultiSelectionModeHandler::UpdateSelectionState (
const model::SharedPageDescriptor& rpDescriptor,
const bool bIsInSelection) const
{
@@ -1520,7 +1695,7 @@ void SelectionFunction::MouseMultiSelector::UpdateSelectionState (
-void SelectionFunction::MouseMultiSelector::UpdateModelPosition (const Point& rMouseModelPosition)
+void MultiSelectionModeHandler::UpdateModelPosition (const Point& rMouseModelPosition)
{
maSecondCorner = rMouseModelPosition;
UpdateSelection();
@@ -1529,7 +1704,7 @@ void SelectionFunction::MouseMultiSelector::UpdateModelPosition (const Point& rM
-void SelectionFunction::MouseMultiSelector::UpdateSelection (void)
+void MultiSelectionModeHandler::UpdateSelection (void)
{
view::SlideSorterView::DrawLock aLock (mrSlideSorter);
@@ -1539,6 +1714,7 @@ void SelectionFunction::MouseMultiSelector::UpdateSelection (void)
const sal_Int32 nIndexUnderMouse (
mrSlideSorter.GetView().GetLayouter().GetIndexAtPoint (
maSecondCorner,
+ false,
false));
if (nIndexUnderMouse>=0 && nIndexUnderMouse<nPageCount)
{
@@ -1560,5 +1736,215 @@ void SelectionFunction::MouseMultiSelector::UpdateSelection (void)
+//===== DragAndDropModeHandler ================================================
+
+DragAndDropModeHandler::DragAndDropModeHandler (
+ SlideSorter& rSlideSorter,
+ SelectionFunction& rSelectionFunction,
+ const Point& rMousePosition,
+ ::Window* pWindow)
+ : ModeHandler(rSlideSorter, rSelectionFunction, false)
+{
+ SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag;
+ if (pDragTransferable==NULL && mrSlideSorter.GetViewShell() != NULL)
+ {
+ SlideSorterViewShell* pSlideSorterViewShell
+ = dynamic_cast<SlideSorterViewShell*>(mrSlideSorter.GetViewShell());
+ if (pSlideSorterViewShell != NULL)
+ pSlideSorterViewShell->StartDrag(rMousePosition, pWindow);
+ pDragTransferable = SD_MOD()->pTransferDrag;
+ }
+
+ mrSlideSorter.GetController().GetInsertionIndicatorHandler()->Start(true);
+ mpDragAndDropContext.reset(new DragAndDropContext(mrSlideSorter));
+ mrSlideSorter.GetController().GetInsertionIndicatorHandler()->Start(
+ pDragTransferable != NULL
+ && pDragTransferable->GetView()==&mrSlideSorter.GetView());
+}
+
+
+
+
+DragAndDropModeHandler::~DragAndDropModeHandler (void)
+{
+ if (mpDragAndDropContext)
+ {
+ // Disconnect the substitution handler from this selection function.
+ mpDragAndDropContext->SetTargetSlideSorter();
+ mpDragAndDropContext.reset();
+ }
+ mrSlideSorter.GetController().GetInsertionIndicatorHandler()->End(Animator::AM_Animated);
+}
+
+
+
+
+SelectionFunction::Mode DragAndDropModeHandler::GetMode (void) const
+{
+ return SelectionFunction::DragAndDropMode;
+}
+
+
+
+
+void DragAndDropModeHandler::Abort (void)
+{
+ mrSlideSorter.GetController().GetClipboard().Abort();
+ if (mpDragAndDropContext)
+ mpDragAndDropContext->Dispose();
+ // mrSlideSorter.GetView().RequestRepaint(mrSlideSorter.GetModel().RestoreSelection());
+}
+
+
+
+
+bool DragAndDropModeHandler::ProcessButtonUpEvent (
+ SelectionFunction::EventDescriptor& rDescriptor)
+{
+ if (Match(rDescriptor.mnEventCode, BUTTON_UP | LEFT_BUTTON))
+ {
+ // The following Process() call may lead to the desctruction
+ // of rDescriptor.mpHitDescriptor so release our reference to it.
+ rDescriptor.mpHitDescriptor.reset();
+ mrSelectionFunction.SwitchToNormalMode();
+ return true;
+ }
+ else
+ return false;
+}
+
+
+
+
+bool DragAndDropModeHandler::ProcessDragEvent (SelectionFunction::EventDescriptor& rDescriptor)
+{
+ OSL_ASSERT(mpDragAndDropContext);
+
+ if (rDescriptor.mbIsLeaving)
+ {
+ mrSelectionFunction.SwitchToNormalMode();
+ }
+ else if (mpDragAndDropContext)
+ {
+ mpDragAndDropContext->UpdatePosition(
+ rDescriptor.maMousePosition,
+ rDescriptor.meDragMode);
+ }
+
+ return true;
+}
+
+
+
+
+//===== ButtonModeHandler =====================================================
+
+ButtonModeHandler::ButtonModeHandler (
+ SlideSorter& rSlideSorter,
+ SelectionFunction& rSelectionFunction)
+ : ModeHandler(rSlideSorter, rSelectionFunction, true)
+{
+}
+
+
+
+
+ButtonModeHandler::~ButtonModeHandler (void)
+{
+}
+
+
+
+
+SelectionFunction::Mode ButtonModeHandler::GetMode (void) const
+{
+ return SelectionFunction::ButtonMode;
+}
+
+
+
+
+void ButtonModeHandler::Abort (void)
+{
+}
+
+
+
+
+void ButtonModeHandler::ProcessEvent (SelectionFunction::EventDescriptor& rDescriptor)
+{
+}
+
+
+
+
+bool ButtonModeHandler::ProcessButtonDownEvent (SelectionFunction::EventDescriptor& rDescriptor)
+{
+ switch (rDescriptor.mnEventCode)
+ {
+ case BUTTON_DOWN | LEFT_BUTTON | SINGLE_CLICK | OVER_UNSELECTED_PAGE | OVER_BUTTON:
+ case BUTTON_DOWN | LEFT_BUTTON | SINGLE_CLICK | OVER_SELECTED_PAGE | OVER_BUTTON:
+ // Remember page and button index. When mouse button is
+ // released over same page and button then invoke action of that
+ // button.
+ mrSlideSorter.GetView().GetButtonBar().ProcessButtonDownEvent(
+ rDescriptor.mpHitDescriptor,
+ rDescriptor.maMouseModelPosition);
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+
+
+
+bool ButtonModeHandler::ProcessButtonUpEvent (SelectionFunction::EventDescriptor& rDescriptor)
+{
+ switch (rDescriptor.mnEventCode & BUTTON_MASK)
+ {
+ case LEFT_BUTTON:
+ mrSlideSorter.GetView().GetButtonBar().ProcessButtonUpEvent(
+ rDescriptor.mpHitDescriptor,
+ rDescriptor.maMouseModelPosition);
+ mrSelectionFunction.SwitchToNormalMode();
+ return true;
+ break;
+ }
+
+ return false;
+}
+
+
+
+
+bool ButtonModeHandler::ProcessMotionEvent (SelectionFunction::EventDescriptor& rDescriptor)
+{
+ switch (rDescriptor.mnEventCode & (MOUSE_MOTION | BUTTON_MASK))
+ {
+ case MOUSE_MOTION | LEFT_BUTTON:
+ mrSlideSorter.GetView().GetButtonBar().ProcessMouseMotionEvent(
+ rDescriptor.mpHitDescriptor,
+ rDescriptor.maMouseModelPosition,
+ true);
+ return true;
+ break;
+
+ case MOUSE_MOTION:
+ mrSlideSorter.GetView().GetButtonBar().ProcessMouseMotionEvent(
+ rDescriptor.mpHitDescriptor,
+ rDescriptor.maMouseModelPosition,
+ false);
+ return true;
+ break;
+ }
+
+ return false;
+}
+
+
+
+
} } } // end of namespace ::sd::slidesorter::controller
diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionObserver.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionObserver.cxx
index 91edc092016f..660990d4c4b6 100644
--- a/sd/source/ui/slidesorter/controller/SlsSelectionObserver.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSelectionObserver.cxx
@@ -32,6 +32,7 @@
#include "controller/SlsSelectionManager.hxx"
#include "controller/SlsSelectionObserver.hxx"
#include "controller/SlsPageSelector.hxx"
+#include "controller/SlsFocusManager.hxx"
#include "model/SlideSorterModel.hxx"
#include "model/SlsPageDescriptor.hxx"
#include <svx/svdmodel.hxx>
@@ -60,6 +61,18 @@ SelectionObserver::Context::~Context(void)
+void SelectionObserver::Context::Abort(void)
+{
+ if (mpSelectionObserver)
+ {
+ mpSelectionObserver->AbortObservation();
+ mpSelectionObserver.reset();
+ }
+}
+
+
+
+
//===== SelectionObserver =====================================================
SelectionObserver::SelectionObserver (SlideSorter& rSlideSorter)
@@ -116,6 +129,17 @@ void SelectionObserver::StartObservation (void)
+void SelectionObserver::AbortObservation (void)
+{
+ OSL_ASSERT(mbIsOvservationActive);
+ mbIsOvservationActive = false;
+ maInsertedPages.clear();
+ maDeletedPages.clear();
+}
+
+
+
+
void SelectionObserver::EndObservation (void)
{
OSL_ASSERT(mbIsOvservationActive);
@@ -123,6 +147,7 @@ void SelectionObserver::EndObservation (void)
model::SlideSorterModel& rModel (mrSlideSorter.GetModel());
PageSelector& rSelector (mrSlideSorter.GetController().GetPageSelector());
+ PageSelector::UpdateLock aUpdateLock (mrSlideSorter);
rSelector.DeselectAllPages();
if ( ! maInsertedPages.empty())
{
@@ -134,17 +159,14 @@ void SelectionObserver::EndObservation (void)
++iPage)
{
rSelector.SelectPage(*iPage);
- /*
- const sal_Int32 nIndex (rModel.GetIndex (*iPage));
- model::SharedPageDescriptor pDescriptor (rModel.GetPageDescriptor(nIndex));
- if (pDescriptor)
- pDescriptor->SetState(model::PageDescriptor::ST_Selected,
- true);
- */
}
maInsertedPages.clear();
}
maDeletedPages.clear();
+
+ aUpdateLock.Release();
+ mrSlideSorter.GetController().GetFocusManager().SetFocusedPageToCurrentPage();
+
}
diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
index 1a2410f1eb64..d6d8c71d9193 100644
--- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
@@ -168,15 +168,16 @@ void SlotManager::FuTemporary (SfxRequest& rRequest)
if (pPagesPerRow != NULL)
{
sal_Int32 nColumnCount = pPagesPerRow->GetValue();
- // Force the given number of columns by setting the
- // minimal and maximal number of columns to the same
- // value.
+ // Force the given number of columns by setting
+ // the minimal and maximal number of columns to
+ // the same value.
mrSlideSorter.GetView().GetLayouter().SetColumnCount (
nColumnCount, nColumnCount);
// Force a repaint and re-layout.
pShell->ArrangeGUIElements ();
// Rearrange the UI-elements controlled by the
- // controller and force a rearrangement of the view.
+ // controller and force a rearrangement of the
+ // view.
mrSlideSorter.GetController().Rearrange(true);
}
}
@@ -190,11 +191,11 @@ void SlotManager::FuTemporary (SfxRequest& rRequest)
case SID_SLIDE_TRANSITIONS_PANEL:
{
- // Make the slide transition panel visible (expand it) in the
- // tool pane.
+ // Make the slide transition panel visible (expand it)
+ // in the tool pane.
if (mrSlideSorter.GetViewShellBase() != NULL)
- framework::FrameworkHelper::Instance(*mrSlideSorter.GetViewShellBase())
- ->RequestTaskPanel(sd::framework::FrameworkHelper::msSlideTransitionTaskPanelURL);
+ framework::FrameworkHelper::Instance(*mrSlideSorter.GetViewShellBase())
+ ->RequestTaskPanel(sd::framework::FrameworkHelper::msSlideTransitionTaskPanelURL);
rRequest.Ignore ();
break;
}
@@ -215,7 +216,7 @@ void SlotManager::FuTemporary (SfxRequest& rRequest)
&mrSlideSorter.GetView(),
pDocument,
rRequest);
- break;
+ break;
case SID_EXPAND_PAGE:
FuExpandPage::Create (
@@ -249,14 +250,14 @@ void SlotManager::FuTemporary (SfxRequest& rRequest)
case SID_DELETE_PAGE:
case SID_DELETE_MASTER_PAGE:
case SID_DELETE: // we need SID_CUT to handle the delete key
- // (DEL -> accelerator -> SID_CUT).
- if (mrSlideSorter.GetModel().GetPageCount() > 1)
- {
- mrSlideSorter.GetController().GetSelectionManager()->DeleteSelectedPages();
- }
+ // (DEL -> accelerator -> SID_CUT).
+ if (mrSlideSorter.GetModel().GetPageCount() > 1)
+ {
+ mrSlideSorter.GetController().GetSelectionManager()->DeleteSelectedPages();
+ }
- rRequest.Done();
- break;
+ rRequest.Done();
+ break;
case SID_RENAMEPAGE:
case SID_RENAME_MASTER_PAGE:
@@ -400,6 +401,9 @@ void SlotManager::FuSupport (SfxRequest& rRequest)
= dynamic_cast<SlideSorterViewShell*>(mrSlideSorter.GetViewShell());
if (pViewShell != NULL)
{
+ view::SlideSorterView::DrawLock aDrawLock (mrSlideSorter);
+ SlideSorterController::ModelChangeLock aModelLock (mrSlideSorter.GetController());
+ PageSelector::UpdateLock aUpdateLock (mrSlideSorter);
SelectionObserver::Context aContext (mrSlideSorter);
pViewShell->ImpSidUndo (FALSE, rRequest);
}
@@ -412,6 +416,9 @@ void SlotManager::FuSupport (SfxRequest& rRequest)
= dynamic_cast<SlideSorterViewShell*>(mrSlideSorter.GetViewShell());
if (pViewShell != NULL)
{
+ view::SlideSorterView::DrawLock aDrawLock (mrSlideSorter);
+ SlideSorterController::ModelChangeLock aModelLock (mrSlideSorter.GetController());
+ PageSelector::UpdateLock aUpdateLock (mrSlideSorter);
SelectionObserver::Context aContext (mrSlideSorter);
pViewShell->ImpSidRedo (FALSE, rRequest);
}
@@ -870,18 +877,22 @@ void SlotManager::GetStatusBarState (SfxItemSet& rSet)
model::PageEnumeration aSelectedPages (
model::PageEnumerationProvider::CreateSelectedPagesEnumeration(
mrSlideSorter.GetModel()));
- pPage = aSelectedPages.GetNextElement()->GetPage();
- nFirstPage = pPage->GetPageNum()/2;
- pFirstPage = pPage;
-
- aPageStr += sal_Unicode(' ');
- aPageStr += String::CreateFromInt32( nFirstPage + 1 );
- aPageStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " / " ));
- aPageStr += String::CreateFromInt32(
- mrSlideSorter.GetModel().GetPageCount());
-
- aLayoutStr = pFirstPage->GetLayoutName();
- aLayoutStr.Erase( aLayoutStr.SearchAscii( SD_LT_SEPARATOR ) );
+ model::SharedPageDescriptor pDescriptor (aSelectedPages.GetNextElement());
+ if (pDescriptor)
+ {
+ pPage = pDescriptor->GetPage();
+ nFirstPage = pPage->GetPageNum()/2;
+ pFirstPage = pPage;
+
+ aPageStr += sal_Unicode(' ');
+ aPageStr += String::CreateFromInt32( nFirstPage + 1 );
+ aPageStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " / " ));
+ aPageStr += String::CreateFromInt32(
+ mrSlideSorter.GetModel().GetPageCount());
+
+ aLayoutStr = pFirstPage->GetLayoutName();
+ aLayoutStr.Erase( aLayoutStr.SearchAscii( SD_LT_SEPARATOR ) );
+ }
}
rSet.Put( SfxStringItem( SID_STATUS_PAGE, aPageStr ) );
diff --git a/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx b/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx
index c683c5e0a2c4..f9c4c1ad4f0a 100644
--- a/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx
@@ -32,6 +32,7 @@
#include "controller/SlsProperties.hxx"
#include "controller/SlsAnimationFunction.hxx"
#include "controller/SlsScrollBarManager.hxx"
+#include "controller/SlsCurrentSlideManager.hxx"
namespace sd { namespace slidesorter { namespace controller {
@@ -61,7 +62,8 @@ VisibleAreaManager::VisibleAreaManager (SlideSorter& rSlideSorter)
maVisibleRequests(),
mnScrollAnimationId(Animator::NotAnAnimationId),
maRequestedVisibleTopLeft(),
- meRequestedAnimationMode(Animator::AM_Immediate)
+ meRequestedAnimationMode(Animator::AM_Immediate),
+ mbIsCurrentSlideTrackingActive(true)
{
}
@@ -75,25 +77,56 @@ VisibleAreaManager::~VisibleAreaManager (void)
+void VisibleAreaManager::ActivateCurrentSlideTracking (void)
+{
+ mbIsCurrentSlideTrackingActive = true;
+}
+
+
+
+
+void VisibleAreaManager::DeactivateCurrentSlideTracking (void)
+{
+ mbIsCurrentSlideTrackingActive = false;
+}
+
+
+
+
void VisibleAreaManager::RequestVisible (
const model::SharedPageDescriptor& rpDescriptor,
- const Animator::AnimationMode eRequestedAnimationMode)
+ const bool bForce)
{
if (rpDescriptor)
{
+ const sal_Int32 nIndex (rpDescriptor->GetPageIndex());
+ if (nIndex > 20)
+ {
+ OSL_TRACE("%d", nIndex);
+ }
maVisibleRequests.push_back(
mrSlideSorter.GetView().GetLayouter().GetPageObjectBox(
rpDescriptor->GetPageIndex(),
true));
- if (eRequestedAnimationMode == Animator::AM_Animated)
- meRequestedAnimationMode = Animator::AM_Animated;
- MakeVisible();
+ if (bForce && ! mbIsCurrentSlideTrackingActive)
+ ActivateCurrentSlideTracking();
+ MakeVisible();
}
}
+void VisibleAreaManager::RequestCurrentSlideVisible (void)
+{
+ if (mbIsCurrentSlideTrackingActive)
+ RequestVisible(
+ mrSlideSorter.GetController().GetCurrentSlideManager()->GetCurrentSlide());
+}
+
+
+
+
void VisibleAreaManager::MakeVisible (void)
{
if (maVisibleRequests.empty())
diff --git a/sd/source/ui/slidesorter/inc/cache/SlsCacheContext.hxx b/sd/source/ui/slidesorter/inc/cache/SlsCacheContext.hxx
index c828e95d1d02..c7f88b87a62a 100644
--- a/sd/source/ui/slidesorter/inc/cache/SlsCacheContext.hxx
+++ b/sd/source/ui/slidesorter/inc/cache/SlsCacheContext.hxx
@@ -33,12 +33,12 @@
#include <boost/shared_ptr.hpp>
#include <vector>
-class BitmapEx;
class SdrPage;
namespace sd { namespace slidesorter { namespace cache {
typedef const SdrPage* CacheKey;
+class PreviewType;
/** This interface allows the individualisation of different instances of
the PreviewCache.
@@ -55,7 +55,7 @@ public:
*/
virtual void NotifyPreviewCreation (
CacheKey aKey,
- const ::boost::shared_ptr<BitmapEx>& rPreview) = 0;
+ const PreviewType& rPreview) = 0;
/** Called to determine whether the system is idle and a preview can be
created without annoying the user.
diff --git a/sd/source/ui/slidesorter/inc/cache/SlsPageCache.hxx b/sd/source/ui/slidesorter/inc/cache/SlsPageCache.hxx
index 82bdd8566b0d..42ede1483c7c 100644
--- a/sd/source/ui/slidesorter/inc/cache/SlsPageCache.hxx
+++ b/sd/source/ui/slidesorter/inc/cache/SlsPageCache.hxx
@@ -29,11 +29,9 @@
#define SD_SLIDESORTER_PAGE_CACHE_HXX
#include "cache/SlsCacheContext.hxx"
+#include "cache/SlsPreviewType.hxx"
#include <sal/types.h>
-#include <vcl/bitmapex.hxx>
-#include <boost/function.hpp>
#include <boost/scoped_ptr.hpp>
-#include <boost/shared_ptr.hpp>
namespace sd { namespace slidesorter { namespace view {
class PageObjectViewObjectContact;
@@ -123,10 +121,17 @@ public:
Returns a bitmap that is either empty, contains a scaled (up or
down) version or is the requested bitmap.
*/
- BitmapEx GetPreviewBitmap (
+ PreviewType GetPreviewBitmap (
const CacheKey aKey,
const bool bResize);
+ PreviewType GetMarkedPreviewBitmap (
+ const CacheKey aKey,
+ const bool bResize);
+ void SetMarkedPreviewBitmap (
+ const CacheKey aKey,
+ const PreviewType& rBitmap);
+
/** When the requested preview bitmap does not yet exist or is not
up-to-date then the rendering of one is scheduled. Otherwise this
method does nothing.
diff --git a/sd/source/ui/slidesorter/inc/cache/SlsPageCacheManager.hxx b/sd/source/ui/slidesorter/inc/cache/SlsPageCacheManager.hxx
index 50202a7eed3d..8e1d827a286f 100644
--- a/sd/source/ui/slidesorter/inc/cache/SlsPageCacheManager.hxx
+++ b/sd/source/ui/slidesorter/inc/cache/SlsPageCacheManager.hxx
@@ -113,6 +113,11 @@ public:
*/
void InvalidateAllCaches (void);
+ /** Call this method when a page has been deleted and its preview
+ is not needed anymore.
+ */
+ void ReleasePreviewBitmap (const SdrPage* pPage);
+
private:
/** Singleton instance of the cache manager. Note that this is a weak
pointer. The (implementation class of) ViewShellBase holds a
diff --git a/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx b/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx
index b72120e9fcb9..04f19d0f7ed0 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx
@@ -275,6 +275,7 @@ private:
::rtl::Reference<controller::Listener> mpListener;
int mnModelChangeLockCount;
+ bool mbIsForcedRearrangePending;
bool mbPreModelChangeDone;
bool mbPostModelChangePending;
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsClipboard.hxx b/sd/source/ui/slidesorter/inc/controller/SlsClipboard.hxx
index 536684be5dc3..9a3f8f7fdff5 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlsClipboard.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlsClipboard.hxx
@@ -29,7 +29,7 @@
#define SD_SLIDESORTER_CLIPBOARD
#include "ViewClipboard.hxx"
-
+#include "controller/SlsSelectionObserver.hxx"
#include <sal/types.h>
#include <tools/solar.h>
#include <svx/svdpage.hxx>
@@ -97,6 +97,8 @@ public:
USHORT nPage = SDRPAGE_NOTFOUND,
USHORT nLayer = SDRPAGE_NOTFOUND);
+ void Abort (void);
+
protected:
virtual USHORT DetermineInsertPosition (
const SdTransferable& rTransferable);
@@ -134,6 +136,8 @@ private:
class UndoContext;
::boost::scoped_ptr<UndoContext> mpUndoContext;
+ ::boost::scoped_ptr<SelectionObserver::Context> mpSelectionObserverContext;
+
void CreateSlideTransferable (
::Window* pWindow,
bool bDrag);
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsFocusManager.hxx b/sd/source/ui/slidesorter/inc/controller/SlsFocusManager.hxx
index 2612f7939610..1d5aaee7a130 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlsFocusManager.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlsFocusManager.hxx
@@ -120,16 +120,6 @@ public:
*/
sal_Int32 GetFocusedPageIndex (void) const;
- /** DEPRECATED. (Use equivalent SetFocusedPage(sal_Int32) instead.
-
- Set the focus to the page with the given index. This does not make
- the focus visible.
- @param nPageIndex
- Index of a page as it is accepted by the slide sorter model.
- The index is not checked for validity.
- */
- void FocusPage (sal_Int32 nPageIndex);
-
/** Set the focused page to the one described by the given page
descriptor. The visibility of the focus indicator is not modified.
@param rDescriptor
@@ -145,6 +135,8 @@ public:
*/
void SetFocusedPage (sal_Int32 nPageIndex);
+ void SetFocusedPageToCurrentPage (void);
+
/** Return <TRUE/> when the focus inidcator is currently shown. A
prerequisite is that the window managed by this focus manager has
the input focus as indicated by a <TRUE/> return value of
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsInsertionIndicatorHandler.hxx b/sd/source/ui/slidesorter/inc/controller/SlsInsertionIndicatorHandler.hxx
index 3945225baf8b..fa721058cccd 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlsInsertionIndicatorHandler.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlsInsertionIndicatorHandler.hxx
@@ -60,7 +60,7 @@ public:
~InsertionIndicatorHandler (void);
enum Mode { CopyMode, MoveMode, UnknownMode };
- static Mode GetModeFromDndAction (const sal_Int8 nMode);
+ static Mode GetModeFromDndAction (const sal_Int8 nDndAction);
/** Activate the insertion marker at the given coordinates.
*/
@@ -102,7 +102,6 @@ public:
*/
sal_Int32 GetInsertionPageIndex (void) const;
-
/** Determine whether moving the current selection to the current
position of the insertion marker would alter the document. This
would be the case when the selection is not consecutive or would be
@@ -111,6 +110,11 @@ public:
bool IsInsertionTrivial (
const sal_Int32 nInsertionIndex,
const Mode eMode) const;
+ /** This method is like the other variant. It operates implicitly
+ on the current insertion index as would be returned by
+ GetInsertionPageIndex().
+ */
+ bool IsInsertionTrivial (const sal_Int8 nDndAction);
private:
SlideSorter& mrSlideSorter;
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsPageSelector.hxx b/sd/source/ui/slidesorter/inc/controller/SlsPageSelector.hxx
index c2d221c62bd5..bc39a5108cf2 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlsPageSelector.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlsPageSelector.hxx
@@ -162,8 +162,9 @@ public:
UpdateLock (SlideSorter& rSlideSorter);
UpdateLock (PageSelector& rPageSelector);
~UpdateLock (void);
+ void Release (void);
private:
- PageSelector& mrSelector;
+ PageSelector* mpSelector;
};
class BroadcastLock
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsProperties.hxx b/sd/source/ui/slidesorter/inc/controller/SlsProperties.hxx
index e72f47644a76..06d239c81da3 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlsProperties.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlsProperties.hxx
@@ -120,6 +120,8 @@ public:
bool IsOnlyPreviewTriggersMouseOver (void) const;
void SetOnlyPreviewTriggersMouseOver (const bool bFlag);
+ bool IsHighContrastModeActive (void) const;
+
private:
bool mbIsHighlightCurrentSlide;
bool mbIsShowSelection;
@@ -133,6 +135,7 @@ private:
Color maHighlightColor;
bool mbIsUIReadOnly;
bool mbIsOnlyPreviewTriggersMouseOver;
+ bool mbIsHighContrastModeActive;
};
} } } // end of namespace ::sd::slidesorter::controller
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsSelectionFunction.hxx b/sd/source/ui/slidesorter/inc/controller/SlsSelectionFunction.hxx
index 9dfdf57bacd6..358d58b6d761 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlsSelectionFunction.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlsSelectionFunction.hxx
@@ -104,7 +104,22 @@ public:
*/
void UpdateMouseOverIndicationPermission (void);
- ::boost::shared_ptr<DragAndDropContext> GetDragAndDropContext (void) const;
+ class EventDescriptor;
+ class ModeHandler;
+ friend class ModeHandler;
+ enum Mode
+ {
+ NormalMode,
+ MultiSelectionMode,
+ DragAndDropMode,
+ ButtonMode
+ };
+ void SwitchToNormalMode (void);
+ void SwitchToDragAndDropMode(const Point aMousePosition);
+ void SwitchToMultiSelectionMode (const Point aMousePosition, const sal_uInt32 nEventCode);
+ void SwitchToButtonMode (void);
+
+ void ResetShiftKeySelectionAnchor (void);
protected:
SlideSorter& mrSlideSorter;
@@ -117,7 +132,6 @@ protected:
virtual ~SelectionFunction();
private:
- class EventDescriptor;
/// The rectangle of the mouse drag selection.
Rectangle maDragSelectionRectangle;
@@ -134,16 +148,6 @@ private:
*/
bool mbProcessingMouseButtonDown;
- ::boost::shared_ptr<DragAndDropContext> mpDragAndDropContext;
-
- class MouseMultiSelector;
- ::boost::scoped_ptr<MouseMultiSelector> mpMouseMultiSelector;
-
- /** Remember where the left mouse button was pressed.
- */
- sal_Int32 mnButtonDownPageIndex;
- sal_Int32 mnButtonDownButtonIndex;
-
bool mbIsDeselectionPending;
/** Remember the slide where the shift key was pressed and started a
@@ -151,19 +155,10 @@ private:
*/
sal_Int32 mnShiftKeySelectionAnchor;
- void StartDrag (
- const Point& rMousePosition,
- const InsertionIndicatorHandler::Mode eMode);
-
- /** Set the selection to exactly the specified page and also set it as
- the current page.
+ /** The selection function can be in one of several mutually
+ exclusive modes.
*/
- void SetCurrentPage (const model::SharedPageDescriptor& rpDescriptor);
-
- /** When the view on which this selection function is working is the
- main view then the view is switched to the regular editing view.
- */
- void SwitchView (const model::SharedPageDescriptor& rpDescriptor);
+ ::boost::shared_ptr<ModeHandler> mpModeHandler;
/** Make the slide nOffset slides away of the current one the new
current slide. When the new index is outside the range of valid
@@ -187,45 +182,7 @@ private:
// What follows are a couple of helper methods that are used by
// ProcessMouseEvent().
- /// Deselect all pages.
- void DeselectAllPages (void);
-
- /** Select all pages between and including the selection anchor and the
- specified page.
- */
- void RangeSelect (const model::SharedPageDescriptor& rpDescriptor);
-
- /** Compute a numerical code that describes a mouse event and that can
- be used for fast look up of the appropriate reaction.
- */
- sal_uInt32 EncodeMouseEvent (
- const EventDescriptor& rDescriptor,
- const MouseEvent& rEvent) const;
-
- /** Compute a numerical code that describes a key event and that can
- be used for fast look up of the appropriate reaction.
- */
- sal_uInt32 EncodeKeyEvent (
- const EventDescriptor& rDescriptor,
- const KeyEvent& rEvent) const;
-
- /** Compute a numerical code that describes the current state like
- whether the selection rectangle is visible or whether the page under
- the mouse or the one that has the focus is selected.
- */
- sal_uInt32 EncodeState (const EventDescriptor& rDescriptor) const;
-
- bool ProcessEvent (EventDescriptor& rEvent);
- void PostProcessEvent (const EventDescriptor& rEvent);
- void ProcessEventWhileDragActive (EventDescriptor& rDescriptor);
- void ProcessEventWhileMultiSelectorActive (EventDescriptor& rDescriptor);
- void ProcessButtonDownEvent (EventDescriptor& rDescriptor);
- void ProcessButtonUpEvent (const EventDescriptor& rDescriptor);
- void ProcessMouseMotionEvent (const EventDescriptor& rDescriptor);
-
- void ProcessButtonClick (
- const model::SharedPageDescriptor& rpDescriptor,
- const sal_Int32 nButtonIndex);
+ void ProcessEvent (EventDescriptor& rEvent);
void MoveFocus (
const FocusManager::FocusMoveDirection eDirection,
@@ -233,7 +190,8 @@ private:
const bool bIsControlDown);
void StopDragAndDrop (void);
- void StopMouseMultiSelection (void);
+
+ void SwitchMode (const ::boost::shared_ptr<ModeHandler>& rpHandler);
};
} } } // end of namespace ::sd::slidesorter::controller
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsSelectionManager.hxx b/sd/source/ui/slidesorter/inc/controller/SlsSelectionManager.hxx
index 74f5b4dece95..a9617a88c2e6 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlsSelectionManager.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlsSelectionManager.hxx
@@ -160,31 +160,6 @@ private:
A list of master pages. Supplying normal pages is an error.
*/
void DeleteSelectedMasterPages (const ::std::vector<SdPage*>& rSelectedMasterPages);
-
- /** Return <TRUE/> when the given rectangle, that typically is the
- bounding box of all currently selected slides, does not fit entirely
- into the visible area of the slide sorter view.
- */
- // bool DoesSelectionExceedVisibleArea (const Rectangle& rSelectionBox) const;
-
- /** When not all currently selected slides fit into the visible area of
- the slide sorter view, and thus DoesSelectionExceedVisibleArea()
- would return <TRUE/>, then it is the task of this method to
- determine which part of the selection to move into the visible area.
- @param rpFirst
- The first selected slide. Must not be an empty pointer.
- @param rpLast
- The last selected slide. Must not be an empty pointer.
- @param eSelectionHint
- This hint tells the method on which slide to concentrate,
- i.e. which slide has to be inside the returned visible area.
- @return
- Returns the new visible area.
- */
- // Rectangle ResolveLargeSelection (
- // const model::SharedPageDescriptor& rpFirst,
- // const model::SharedPageDescriptor& rpLast,
- // const SelectionHint eSelectionHint);
};
} } } // end of namespace ::sd::slidesorter::controller
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsSelectionObserver.hxx b/sd/source/ui/slidesorter/inc/controller/SlsSelectionObserver.hxx
index 7718b9b7af01..0fb45b403af1 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlsSelectionObserver.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlsSelectionObserver.hxx
@@ -30,6 +30,7 @@
#include <tools/gen.hxx>
#include <vector>
+#include <boost/shared_ptr.hpp>
namespace sd { namespace slidesorter {
class SlideSorter;
@@ -40,6 +41,10 @@ class SdrPage;
namespace sd { namespace slidesorter { namespace controller {
+/** Observe insertions and deletions of pages between calls to
+ StartObservation() and EndObservation(). When the later is called
+ the selection is set to just the newly inserted pages.
+*/
class SelectionObserver
{
public:
@@ -48,6 +53,7 @@ public:
void NotifyPageEvent (const SdrPage* pPage);
void StartObservation (void);
+ void AbortObservation (void);
void EndObservation (void);
/** Use this little class instead of calling StartObservation and
@@ -60,6 +66,7 @@ public:
public:
Context (SlideSorter& rSlideSorter);
~Context(void);
+ void Abort (void);
private:
::boost::shared_ptr<SelectionObserver> mpSelectionObserver;
};
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsVisibleAreaManager.hxx b/sd/source/ui/slidesorter/inc/controller/SlsVisibleAreaManager.hxx
index 7edf45b22b16..33fda41975cf 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlsVisibleAreaManager.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlsVisibleAreaManager.hxx
@@ -45,14 +45,21 @@ public:
VisibleAreaManager (SlideSorter& rSlideSorter);
~VisibleAreaManager (void);
+ void ActivateCurrentSlideTracking (void);
+ void DeactivateCurrentSlideTracking (void);
+
+ /** Request the current slide to be moved into the visible area.
+ This request is only obeyed when the current slide tracking is
+ active.
+ @see ActivateCurrentSlideTracking() and DeactivateCurrentSlideTracking()
+ */
+ void RequestCurrentSlideVisible (void);
+
/** Request to make the specified page object visible.
- @param eRequestedAnimationMode
- This flag specifies wether to smoothly scroll the page object into
- view (AM_Animated) or do this in one step (AM_Immediate).
*/
void RequestVisible (
const model::SharedPageDescriptor& rpDescriptor,
- const Animator::AnimationMode eRequestedAnimationMode = Animator::AM_Immediate);
+ const bool bForce = false);
private:
SlideSorter& mrSlideSorter;
@@ -68,8 +75,8 @@ private:
*/
Animator::AnimationId mnScrollAnimationId;
Point maRequestedVisibleTopLeft;
-
Animator::AnimationMode meRequestedAnimationMode;
+ bool mbIsCurrentSlideTrackingActive;
void MakeVisible (void);
::boost::optional<Point> GetRequestedTopLeft (void) const;
diff --git a/sd/source/ui/slidesorter/inc/model/SlsVisualState.hxx b/sd/source/ui/slidesorter/inc/model/SlsVisualState.hxx
index 2a09fc047b80..3830dfbca206 100644
--- a/sd/source/ui/slidesorter/inc/model/SlsVisualState.hxx
+++ b/sd/source/ui/slidesorter/inc/model/SlsVisualState.hxx
@@ -79,11 +79,6 @@ public:
sal_Int32 GetButtonAlphaAnimationId (void) const;
void SetButtonAlphaAnimationId (const sal_Int32 nAnimationId);
- enum ButtonState { BS_Normal, BS_MouseOver, BS_Pressed };
-
- void SetActiveButtonState (const sal_Int32 nIndex, const ButtonState eState);
- ButtonState GetButtonState (const sal_Int32 nIndex);
-
sal_Int32 mnPageId; // For debugging
private:
@@ -99,9 +94,6 @@ private:
double mnButtonAlpha;
sal_Int32 mnButtonAlphaAnimationId;
-
- sal_Int32 mnActiveButtonIndex;
- ButtonState meActiveButtonState;
};
} } } // end of namespace ::sd::slidesorter::model
diff --git a/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx b/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx
index 2b068642930a..4afc5a74ccf0 100644
--- a/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx
+++ b/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx
@@ -63,6 +63,7 @@ class SlideSorterModel;
namespace sd { namespace slidesorter { namespace view {
+class ButtonBar;
class LayeredDevice;
class Layouter;
class PageObjectPainter;
@@ -198,18 +199,19 @@ public:
/** The page under the mouse is not highlighted in some contexts. Call
this method on context changes.
*/
- void SetIsMouseOverIndicationAllowed (const bool bIsAllowed);
void UpdatePageUnderMouse (bool bAnimate);
void UpdatePageUnderMouse (
const Point& rMousePosition,
const bool bIsMouseButtonDown,
const bool bAnimate = true);
+ void UpdatePageUnderMouse (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const Point& rMousePosition,
+ const bool bIsMouseButtonDown,
+ const bool bAnimate = true);
void SetPageUnderMouse (
const model::SharedPageDescriptor& rpDescriptor,
const bool bAnimate = true);
- void SetButtonUnderMouse (
- const sal_Int32 nButtonIndex,
- const bool bForce = false);
bool SetState (
const model::SharedPageDescriptor& rpDescriptor,
@@ -237,6 +239,8 @@ public:
SharedSdWindow mpWindow;
};
+ ButtonBar& GetButtonBar (void) const;
+
protected:
virtual void Notify (SfxBroadcaster& rBroadcaster, const SfxHint& rHint);
@@ -255,18 +259,20 @@ private:
Layouter::Orientation meOrientation;
::boost::shared_ptr<controller::Properties> mpProperties;
model::SharedPageDescriptor mpPageUnderMouse;
- bool mbIsMouseOverIndicationAllowed;
+ ::rtl::OUString msHelpText;
sal_Int32 mnButtonUnderMouse;
::boost::shared_ptr<PageObjectPainter> mpPageObjectPainter;
::boost::shared_ptr<SelectionPainter> mpSelectionPainter;
Region maRedrawRegion;
SharedILayerPainter mpBackgroundPainter;
+ ::boost::scoped_ptr<ButtonBar> mpButtonBar;
/** Determine the visibility of all page objects.
*/
void DeterminePageObjectVisibilities (void);
void UpdatePreciousFlags (void);
+ void Rearrange (void);
};
diff --git a/sd/source/ui/slidesorter/inc/view/SlsButtonBar.hxx b/sd/source/ui/slidesorter/inc/view/SlsButtonBar.hxx
new file mode 100644
index 000000000000..61b81614b2ae
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/view/SlsButtonBar.hxx
@@ -0,0 +1,322 @@
+/*************************************************************************
+ *
+ * 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_BUTTON_BAR_HXX
+#define SD_SLIDESORTER_VIEW_BUTTON_BAR_HXX
+
+#include "model/SlsSharedPageDescriptor.hxx"
+#include <tools/gen.hxx>
+#include <rtl/ustring.hxx>
+#include <vcl/bitmapex.hxx>
+
+
+namespace sd { namespace slidesorter {
+class SlideSorter;
+} }
+
+
+namespace sd { namespace slidesorter { namespace view {
+
+class Theme;
+
+class Button;
+typedef ::boost::shared_ptr<Button> SharedButton;
+
+/** This is a container of buttons and a coordinating controller.
+ The last means that it receives mouse events and forwards them to
+ the right button.
+*/
+class ButtonBar
+{
+public:
+ ButtonBar (SlideSorter& rSlideSorter);
+
+ /** In order to place and size the buttons the ButtonBar has to
+ know how large the page objects are.
+ */
+ void SetPageObjectSize (const Size aPageObjectSize);
+
+ void ProcessButtonDownEvent (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const Point aMouseModelLocation);
+ void ProcessButtonUpEvent (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const Point aMouseModelLocation);
+ void ProcessMouseMotionEvent (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const Point aMouseModelLocation,
+ const bool bIsMouseButtonDown);
+
+ /** Set the page object for which to control the buttons. The set
+ of displayed buttons depends on whether this page is excluded
+ from the slide show or not.
+ @param rsPageHelpText
+ When the mouse is moved over a button then a help text for
+ that button is displayed. When it is moved off the button
+ area then the given page help text is displayed instead.
+ */
+ /*
+ void SetPage (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const Point aMouseModelLocation,
+ const bool bIsMouseButtonDown,
+ const ::rtl::OUString& rsPageHelpText);
+ */
+ void ResetPage (void);
+
+ /** Return the number of buttons that are to be displayed in page
+ objects which the mouse hovers over.
+ @param bIsExcluded
+ When this flag is <TRUE/> then return the number of
+ buttons that is to be displayed for pages that are
+ excluded from the slide show.
+ */
+ sal_Int32 GetButtonCount (const bool bIsExcluded) const;
+
+ /** Return the specified button.
+ @param nIndex
+ Valid values lie in the range [0,GetButtonCount()).
+ @param bIsExcluded
+ When this flag is <TRUE/> then return a button that is to
+ be displayed for pages that are excluded from the slide
+ show.
+ @return
+ Returns an empty pointer when the given index is not valid.
+ */
+ ::boost::shared_ptr<Button> GetButton (
+ const bool bIsExcluded,
+ const sal_Int32 nIndex) const;
+
+ bool IsMouseOverBar (void) const;
+
+ /** Paint the specified page object. When this is not the same as the
+ one under the mouse (mpDescriptor) then the buttons are all
+ painted in their normal state.
+ */
+ void Paint (
+ OutputDevice& rDevice,
+ const model::SharedPageDescriptor& rpPageDescriptor);
+
+ bool IsMouseOverButton (void) const;
+
+ void RequestLayout (void);
+
+ /** Return the help text for the button under the mouse.
+ @return
+ When the mouse is not over a button then an empty string
+ is returned.
+ */
+ ::rtl::OUString GetButtonHelpText (void) const;
+
+private:
+ SlideSorter& mrSlideSorter;
+ Size maPageObjectSize;
+ Rectangle maBoundingBox;
+ model::SharedPageDescriptor mpDescriptor;
+ bool mbIsExcluded;
+ boost::shared_ptr<Button> mpButtonUnderMouse;
+ // The button on which the mouse button was pressed.
+ boost::shared_ptr<Button> mpDownButton;
+ ::std::vector<SharedButton> maRegularButtons;
+ ::std::vector<SharedButton> maExcludedButtons;
+ Bitmap maNormalBackground;
+ Bitmap maButtonDownBackground;
+ bool mbIsMouseOverBar;
+
+ /** In contrast to the other SetPage variant, this method only
+ sets mpDescriptor. If the given descriptor differs from
+ mpDescriptor then the buttons are placed anew.
+ @return
+ The returned flag indicates wether the mpDescriptor member
+ is set to a new value.
+ */
+ bool SetPage (const model::SharedPageDescriptor& rpDescriptor);
+ SharedButton GetButtonAt (const Point aModelLocation);
+ bool SetButtonUnderMouse (const SharedButton& rButton = SharedButton());
+ void PaintButtonBackground (
+ OutputDevice& rDevice,
+ const Point aOffset);
+ void LayoutButtons (const Size aPageModelSize);
+ bool LayoutButtons (
+ const Size aPageObjectSize,
+ const bool bIsSmall);
+ Bitmap CreateBackground (
+ const OutputDevice& rTemplateDevice,
+ const Size aSize,
+ const bool bIsButtonDown) const;
+ bool IsMouseOverBar (const Point aModelLocation) const;
+};
+
+
+
+
+class Button
+{
+public:
+ Button (
+ SlideSorter& rSlideSorter,
+ const ::rtl::OUString& rsHelpText);
+ virtual ~Button (void);
+
+ enum State { ST_Normal, ST_Hover, ST_Down };
+ /** Set a new state.
+ @return
+ When the new state is different from the old state
+ then <TRUE/> is returned.
+ */
+ bool SetState (const State eState);
+ State GetState (void) const;
+
+ virtual void Place (const Rectangle aButtonBarBox, const sal_Int32 nIndex) = 0;
+ virtual void Paint (
+ OutputDevice& rDevice,
+ const Point aOffset,
+ const double nAlpha,
+ const ::boost::shared_ptr<Theme>& rpTheme) const = 0;
+ virtual void ProcessClick (const model::SharedPageDescriptor& rpDescriptor) = 0;
+
+ /** Return the bounding box of the layouted button.
+ */
+ Rectangle GetBoundingBox (void) const;
+ /** Return the minimum size required to completely paint the
+ button.
+ */
+ virtual Size GetSize (void) const = 0;
+ ::rtl::OUString GetHelpText (void) const;
+ bool IsDown (void) const;
+ void SetActiveState (const bool bIsActive);
+ bool IsActive (void) const;
+ void SetIsSmall (const bool bIsSmall);
+
+protected:
+ SlideSorter& mrSlideSorter;
+ State meState;
+ Rectangle maBoundingBox;
+ const ::rtl::OUString msHelpText;
+ // Buttons that lie (partly) outside the button bar are deactivated.
+ bool mbIsActive;
+ bool mbIsSmall;
+};
+
+
+
+class TextButton : public Button
+{
+public:
+ TextButton (
+ SlideSorter& rSlideSorter,
+ const ::rtl::OUString& rsText,
+ const ::rtl::OUString& rsHelpText);
+
+ virtual void Place (const Rectangle aButtonBarBox, const sal_Int32 nIndex);
+ virtual void Paint (
+ OutputDevice& rDevice,
+ const Point aOffset,
+ const double nAlpha,
+ const ::boost::shared_ptr<Theme>& rpTheme) const;
+ virtual Size GetSize (void) const;
+
+private:
+ const ::rtl::OUString msText;
+};
+
+
+
+class ImageButton : public Button
+{
+public:
+ ImageButton (
+ SlideSorter& rSlideSorter,
+ const BitmapEx& rRegularIcon,
+ const BitmapEx& rHoverIcon,
+ const BitmapEx& rDownIcon,
+ const BitmapEx& rSmallRegularIcon,
+ const BitmapEx& rSmallHoverIcon,
+ const BitmapEx& rSmallDownIcon,
+ const ::rtl::OUString& rsHelpText);
+
+ virtual void Place (const Rectangle aButtonBarBox, const sal_Int32 nIndex);
+ virtual void Paint (
+ OutputDevice& rDevice,
+ const Point aOffset,
+ const double nAlpha,
+ const ::boost::shared_ptr<Theme>& rpTheme) const;
+ virtual Size GetSize (void) const;
+
+private:
+ const BitmapEx maNormalIcon;
+ const BitmapEx maHoverIcon;
+ const BitmapEx maDownIcon;
+ const BitmapEx maSmallIcon;
+ const BitmapEx maSmallHoverIcon;
+ const BitmapEx maSmallDownIcon;
+};
+
+
+class UnhideButton : public TextButton
+{
+public:
+ UnhideButton (SlideSorter& rSlideSorter);
+
+protected:
+ virtual void ProcessClick (const model::SharedPageDescriptor& rpDescriptor);
+};
+
+
+class StartShowButton : public ImageButton
+{
+public:
+ StartShowButton (SlideSorter& rSlideSorter);
+
+protected:
+ virtual void ProcessClick (const model::SharedPageDescriptor& rpDescriptor);
+};
+
+
+class HideButton : public ImageButton
+{
+public:
+ HideButton (SlideSorter& rSlideSorter);
+
+protected:
+ virtual void ProcessClick (const model::SharedPageDescriptor& rpDescriptor);
+};
+
+
+class DuplicateButton : public ImageButton
+{
+public:
+ DuplicateButton (SlideSorter& rSlideSorter);
+
+protected:
+ virtual void ProcessClick (const model::SharedPageDescriptor& rpDescriptor);
+};
+
+
+} } } // end of namespace ::sd::slidesorter::view
+
+#endif
diff --git a/sd/source/ui/slidesorter/inc/view/SlsLayouter.hxx b/sd/source/ui/slidesorter/inc/view/SlsLayouter.hxx
index 913bf6c0330c..557e12a24571 100644
--- a/sd/source/ui/slidesorter/inc/view/SlsLayouter.hxx
+++ b/sd/source/ui/slidesorter/inc/view/SlsLayouter.hxx
@@ -206,13 +206,19 @@ public:
the actual page area the index of that page is returned;
otherwise -1 would be returned to indicate that no page object
has been hit.
+ @param bClampToValidRange
+ When <TRUE/> then values outside the valid range [0,mnPageCount)
+ are mapped to 0 (when smaller than 0) or mnPageCount-1 when
+ equal to or larger than mnPageCount.
+ When <FALSE/> then -1 is returned for values outside the valid range.
@return
The returned index may be larger than the number of existing
page objects.
*/
sal_Int32 GetIndexAtPoint (
const Point& rModelPosition,
- const bool bIncludePageBorders = false) const;
+ const bool bIncludePageBorders = false,
+ const bool bClampToValidRange = true) const;
/** Return an object that describes the logical and visual properties of
where to do an insert operation when the user would release the the
diff --git a/sd/source/ui/slidesorter/inc/view/SlsPageObjectLayouter.hxx b/sd/source/ui/slidesorter/inc/view/SlsPageObjectLayouter.hxx
index 09243029e2a4..f6da848050c7 100644
--- a/sd/source/ui/slidesorter/inc/view/SlsPageObjectLayouter.hxx
+++ b/sd/source/ui/slidesorter/inc/view/SlsPageObjectLayouter.hxx
@@ -79,11 +79,7 @@ public:
Name,
// Indicator whether or not there is a slide transition associated
// with this slide.
- TransitionEffectIndicator,
- // Wide button placed without border at the bottom of the preview.
- WideButton,
- // Individual button. Specify nIndex when calling GetBoundingBox().
- Button
+ TransitionEffectIndicator
};
/** Two coordinate systems are supported. They differ only in
translation not in scale. Both relate to pixel values in the window.
@@ -96,14 +92,6 @@ public:
ModelCoordinateSystem
};
- enum ButtonIndex {
- MinButtonIndex = 0,
- StartShowButtonIndex = MinButtonIndex,
- ShowHideButtonIndex = 1,
- DuplicateButtonIndex = 2,
- MaxButtonIndex = DuplicateButtonIndex
- };
-
/** Return the bounding box of the page object or one of its graphical
parts.
@param rWindow
@@ -119,20 +107,15 @@ public:
@param eCoodinateSystem
The bounding box can be returned in model and in pixel
(window) coordinates.
- @param nIndex
- Used only for some parts (Button) to distinguish between
- different parts of the same type.
*/
Rectangle GetBoundingBox (
const model::SharedPageDescriptor& rpPageDescriptor,
const Part ePart,
- const CoordinateSystem eCoordinateSystem,
- const sal_Int32 nIndex = 0);
+ const CoordinateSystem eCoordinateSystem);
Rectangle GetBoundingBox (
const Point& rPageObjectLocation,
const Part ePart,
- const CoordinateSystem eCoordinateSystem,
- const sal_Int32 nIndex = 0);
+ const CoordinateSystem eCoordinateSystem);
/** Return the size in pixel of the whole page object.
*/
@@ -146,10 +129,6 @@ public:
// void Update (void);
- sal_Int32 GetButtonIndexAt (
- const model::SharedPageDescriptor& rpPageDescriptor,
- const Point& rWindowLocation);
-
private:
SharedSdWindow mpWindow;
Size maPageObjectSize;
@@ -159,7 +138,6 @@ private:
Rectangle maPageNumberFrameBoundingBox;
Rectangle maPreviewBoundingBox;
Rectangle maTransitionEffectBoundingBox;
- Rectangle maWideButtonBoundingBox;
const Image maTransitionEffectIcon;
const ::boost::shared_ptr<Font> mpPageNumberFont;
diff --git a/sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx b/sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx
index 2fa10d39f318..6086e64e3f14 100644
--- a/sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx
+++ b/sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx
@@ -42,10 +42,14 @@
#include "view/SlsTheme.hxx"
#include <boost/scoped_ptr.hpp>
-namespace sd { namespace slidesorter { namespace cache { class PageCache; } } }
+namespace sd { namespace slidesorter { namespace cache {
+class PageCache;
+class PreviewType;
+} } }
namespace sd { namespace slidesorter { namespace view {
+class ButtonBar;
class Layouter;
class PageObjectLayouter;
class FramePainter;
@@ -76,19 +80,19 @@ private:
::boost::shared_ptr<controller::Properties> mpProperties;
::boost::shared_ptr<view::Theme> mpTheme;
::boost::shared_ptr<Font> mpPageNumberFont;
- BitmapEx maStartPresentationIcon;
- BitmapEx maShowSlideIcon;
- BitmapEx maNewSlideIcon;
::boost::scoped_ptr<FramePainter> mpShadowPainter;
Bitmap maNormalBackground;
Bitmap maSelectionBackground;
Bitmap maFocusedSelectionBackground;
+ Bitmap maFocusedBackground;
Bitmap maMouseOverBackground;
+ Bitmap maMouseOverSelectedAndFocusedBackground;
::rtl::OUString msUnhideString;
+ ButtonBar& mrButtonBar;
void PaintBackground (
OutputDevice& rDevice,
- const model::SharedPageDescriptor& rpDescriptor) const;
+ const model::SharedPageDescriptor& rpDescriptor);
void PaintPreview (
OutputDevice& rDevice,
const model::SharedPageDescriptor& rpDescriptor) const;
@@ -98,30 +102,25 @@ private:
void PaintTransitionEffect (
OutputDevice& rDevice,
const model::SharedPageDescriptor& rpDescriptor) const;
- void PaintButtons (
- OutputDevice& rDevice,
- const model::SharedPageDescriptor& rpDescriptor) const;
- void PaintButtonsType0 (
- OutputDevice& rDevice,
- const model::SharedPageDescriptor& rpDescriptor) const;
- void PaintButtonsType1 (
- OutputDevice& rDevice,
- const model::SharedPageDescriptor& rpDescriptor) const;
- void PaintWideButton (
- OutputDevice& rDevice,
- const model::SharedPageDescriptor& rpDescriptor) const;
- Rectangle PaintWideButtonBackground (
- OutputDevice& rDevice,
- const model::SharedPageDescriptor& rpDescriptor,
- const model::VisualState::ButtonState eState) const;
- void PrepareBackgrounds (OutputDevice& rDevice);
void PaintBorder (
OutputDevice& rDevice,
const Theme::GradientColorType eColorType,
const Rectangle& rBox) const;
+ Bitmap& GetBackgroundForState (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const OutputDevice& rTemplateDevice);
+ Bitmap& GetBackground(
+ Bitmap& rBackground,
+ Theme::GradientColorType eType,
+ const OutputDevice& rTemplateDevice);
Bitmap CreateBackgroundBitmap(
const OutputDevice& rReferenceDevice,
const Theme::GradientColorType eType) const;
+ Bitmap CreateMarkedPreview(
+ const Size& rSize,
+ const cache::PreviewType& rPreview,
+ const BitmapEx& rOverlay,
+ const OutputDevice& TemplateDevice) const;
};
} } } // end of namespace sd::slidesorter::view
diff --git a/sd/source/ui/slidesorter/inc/view/SlsResource.hrc b/sd/source/ui/slidesorter/inc/view/SlsResource.hrc
index e23c4e8a9a36..3cecd5ad78cb 100644
--- a/sd/source/ui/slidesorter/inc/view/SlsResource.hrc
+++ b/sd/source/ui/slidesorter/inc/view/SlsResource.hrc
@@ -33,18 +33,49 @@
#include "glob.hrc"
-#define IMG_ICONS RID_SLIDESORTER_ICONS
+#define IMAGE_COMMAND1_REGULAR 1
+#define IMAGE_COMMAND1_HOVER 2
+#define IMAGE_COMMAND1_SMALL 3
+#define IMAGE_COMMAND1_SMALL_HOVER 4
-#define IMAGE_PRESENTATION 1
-#define IMAGE_SHOW_SLIDE 2
-#define IMAGE_NEW_SLIDE 3
+#define IMAGE_COMMAND1_REGULAR_HC 5
+#define IMAGE_COMMAND1_HOVER_HC 6
+#define IMAGE_COMMAND1_SMALL_HC 7
+#define IMAGE_COMMAND1_SMALL_HOVER_HC 8
-#define IMAGE_SHADOW 10
-#define IMAGE_INSERT_SHADOW 11
-#define IMAGE_HIDE_SLIDE_OVERLAY 12
-#define STRING_UNHIDE 13
-#define STRING_DRAG_AND_DROP_PAGES 14
-#define STRING_DRAG_AND_DROP_SLIDES 15
+#define IMAGE_COMMAND2_REGULAR 10
+#define IMAGE_COMMAND2_HOVER 11
+#define IMAGE_COMMAND2_SMALL 12
+#define IMAGE_COMMAND2_SMALL_HOVER 13
+
+#define IMAGE_COMMAND2_REGULAR_HC 14
+#define IMAGE_COMMAND2_HOVER_HC 15
+#define IMAGE_COMMAND2_SMALL_HC 16
+#define IMAGE_COMMAND2_SMALL_HOVER_HC 17
+
+
+#define IMAGE_COMMAND3_REGULAR 20
+#define IMAGE_COMMAND3_HOVER 21
+#define IMAGE_COMMAND3_SMALL 22
+#define IMAGE_COMMAND3_SMALL_HOVER 23
+
+#define IMAGE_COMMAND3_REGULAR_HC 24
+#define IMAGE_COMMAND3_HOVER_HC 25
+#define IMAGE_COMMAND3_SMALL_HC 26
+#define IMAGE_COMMAND3_SMALL_HOVER_HC 27
+
+
+#define IMAGE_SHADOW 30
+#define IMAGE_INSERT_SHADOW 31
+#define IMAGE_HIDE_SLIDE_OVERLAY 32
+
+#define STRING_UNHIDE 33
+#define STRING_DRAG_AND_DROP_PAGES 34
+#define STRING_DRAG_AND_DROP_SLIDES 35
+
+#define STRING_COMMAND1 36
+#define STRING_COMMAND2 37
+#define STRING_COMMAND3 38
#endif
diff --git a/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx b/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx
index eefeda7c14d4..11db2fe9f891 100644
--- a/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx
+++ b/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx
@@ -61,9 +61,10 @@ public:
/** Call this method to update some colors as response to a change of
a system color change.
*/
- void Update (const ::boost::shared_ptr<controller::Properties>& rpProperties);
+ void Update (
+ const ::boost::shared_ptr<controller::Properties>& rpProperties);
- BitmapEx GetInsertIndicatorIcon (void) const;
+ // BitmapEx GetInsertIndicatorIcon (void) const;
enum FontType {
PageNumberFont,
@@ -83,16 +84,21 @@ public:
PageNumberBorder,
PageNumberColor,
Selection,
- PreviewBorder
+ PreviewBorder,
+ _ColorType_Size_
};
ColorData GetColor (const ColorType eType);
void SetColor (const ColorType eType, const ColorData aColorData);
enum GradientColorType {
- NormalPage,
- SelectedPage,
- SelectedAndFocusedPage,
- MouseOverPage
+ Gradient_NormalPage,
+ Gradient_SelectedPage,
+ Gradient_SelectedAndFocusedPage,
+ Gradient_MouseOverPage,
+ Gradient_MouseOverSelectedAndFocusedPage,
+ Gradient_FocusedPage,
+ Gradient_ButtonBackground,
+ _GradientColorType_Size_
};
enum GradientColorClass {
Border1,
@@ -110,27 +116,45 @@ public:
void 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);
+ sal_Int32 GetGradientSaturationOverride (const GradientColorType eType);
+ sal_Int32 GetGradientBrightnessOverride (const GradientColorType eType);
+ void SetGradientSaturationOverride (const GradientColorType eType, const sal_Int32 nValue);
+ void SetGradientBrightnessOverride (const GradientColorType eType, const sal_Int32 nValue);
enum IconType
{
Icon_RawShadow,
Icon_RawInsertShadow,
Icon_HideSlideOverlay,
- Icon_StartPresentation,
- Icon_ShowSlide,
- Icon_DuplicateSlide
+ Icon_Command1Regular,
+ Icon_Command1Hover,
+ Icon_Command1Small,
+ Icon_Command1SmallHover,
+ Icon_Command2Regular,
+ Icon_Command2Hover,
+ Icon_Command2Small,
+ Icon_Command2SmallHover,
+ Icon_Command3Regular,
+ Icon_Command3Hover,
+ Icon_Command3Small,
+ Icon_Command3SmallHover,
+ _IconType_Size_
};
BitmapEx GetIcon (const IconType eType);
enum IntegerValueType
{
- ButtonCornerRadius,
- ButtonMaxAlpha,
- ButtonPaintType
+ Integer_ButtonCornerRadius,
+ Integer_ButtonMaxAlpha,
+ Integer_ButtonPaintType,
+ Integer_ButtonBorder,
+ Integer_ButtonGap
};
sal_Int32 GetIntegerValue (const IntegerValueType eType) const;
void SetIntegerValue (const IntegerValueType eType, const sal_Int32 nValue);
@@ -139,16 +163,24 @@ public:
{
String_Unhide,
String_DragAndDropPages,
- String_DragAndDropSlides
+ String_DragAndDropSlides,
+ String_Command1,
+ String_Command2,
+ String_Command3,
+ _StringType_Size_
};
::rtl::OUString GetString (const StringType eType) const;
private:
+ bool mbIsHighContrastMode;
class GradientDescriptor
{
public:
ColorData maBaseColor;
+ sal_Int32 mnSaturationOverride;
+ sal_Int32 mnBrightnessOverride;
+
ColorData maFillColor1;
ColorData maFillColor2;
ColorData maBorderColor1;
@@ -161,25 +193,21 @@ private:
};
ColorData maBackgroundColor;
ColorData maPageBackgroundColor;
- GradientDescriptor maNormalGradient;
- GradientDescriptor maSelectedGradient;
- GradientDescriptor maSelectedAndFocusedGradient;
- GradientDescriptor maMouseOverGradient;
- BitmapEx maRawShadow;
- BitmapEx maRawInsertShadow;
- BitmapEx maHideSlideOverlay;
- BitmapEx maStartPresentationIcon;
- BitmapEx maShowSlideIcon;
- BitmapEx maDuplicateSlideIcon;
+ ::std::vector<GradientDescriptor> maGradients;
+ ::std::vector<BitmapEx> maIcons;
::std::vector<ColorData> maColor;
sal_Int32 mnButtonCornerRadius;
sal_Int32 mnButtonMaxAlpha;
sal_Int32 mnButtonPaintType;
- ::rtl::OUString msUnhide;
- ::rtl::OUString msDragAndDropPages;
- ::rtl::OUString msDragAndDropSlides;
+ sal_Int32 mnButtonBorder;
+ sal_Int32 mnButtonGap;
+ ::std::vector<rtl::OUString> maStrings;
GradientDescriptor& GetGradient (const GradientColorType eType);
+ /** Guarded initialization of the specified icon in the maIcons
+ container. Call only while a LocalResource object is active.
+ */
+ void InitializeIcon (const IconType eType, USHORT nResourceId);
};
diff --git a/sd/source/ui/slidesorter/model/SlideSorterModel.cxx b/sd/source/ui/slidesorter/model/SlideSorterModel.cxx
index 61befe64f80d..714ea953a31f 100644
--- a/sd/source/ui/slidesorter/model/SlideSorterModel.cxx
+++ b/sd/source/ui/slidesorter/model/SlideSorterModel.cxx
@@ -87,13 +87,6 @@ namespace {
OSL_ASSERT(nIndex == pDescriptor->GetVisualState().mnPageId);
return false;
}
- /*
- if (nIndex != FromCoreIndex(pDescriptor->GetPage()->GetPageNum()))
- {
- OSL_ASSERT(nIndex != FromCoreIndex(pDescriptor->GetPage()->GetPageNum()));
- return false;
- }
- */
}
return true;
diff --git a/sd/source/ui/slidesorter/model/SlsVisualState.cxx b/sd/source/ui/slidesorter/model/SlsVisualState.cxx
index c900403eed84..5bde446ddcc8 100644
--- a/sd/source/ui/slidesorter/model/SlsVisualState.cxx
+++ b/sd/source/ui/slidesorter/model/SlsVisualState.cxx
@@ -217,24 +217,4 @@ void VisualState::SetButtonAlphaAnimationId (const sal_Int32 nAnimationId)
}
-
-
-void VisualState::SetActiveButtonState (const sal_Int32 nIndex, const ButtonState eState)
-{
- mnActiveButtonIndex = nIndex;
- meActiveButtonState = eState;
-}
-
-
-
-
-VisualState::ButtonState VisualState::GetButtonState (const sal_Int32 nIndex)
-{
- if (nIndex == mnActiveButtonIndex)
- return meActiveButtonState;
- else
- return BS_Normal;
-}
-
-
} } } // end of namespace ::sd::slidesorter::model
diff --git a/sd/source/ui/slidesorter/shell/SlsDebugDialog.cxx b/sd/source/ui/slidesorter/shell/SlsDebugDialog.cxx
index fa57962659e4..693d61046d22 100644
--- a/sd/source/ui/slidesorter/shell/SlsDebugDialog.cxx
+++ b/sd/source/ui/slidesorter/shell/SlsDebugDialog.cxx
@@ -33,6 +33,7 @@
#include "view/SlideSorterView.hxx"
#include "view/SlsTheme.hxx"
#include "view/SlsPageObjectPainter.hxx"
+#include "view/SlsButtonBar.hxx"
#include <vcl/window.hxx>
#include <vcl/wrkwin.hxx>
@@ -52,6 +53,7 @@ class DebugControl
public:
DebugControl (void) {};
virtual ~DebugControl (void) {}
+ virtual sal_Int32 GetHeight (void) = 0;
};
//===== TextButton ============================================================
@@ -82,6 +84,11 @@ public:
maAction(this);
}
+ virtual sal_Int32 GetHeight (void)
+ {
+ return GetSizePixel().Height();
+ }
+
private:
Action maAction;
};
@@ -127,15 +134,15 @@ public:
mpTitle->SetPosSizePixel(nLeft, nTop, nWidth,20);
mpTitle->Show();
- mpRedSlider->SetPosSizePixel(nLeft, nTop+30, nWidth, 10);
+ mpRedSlider->SetPosSizePixel(nLeft, nTop+25, nWidth, 10);
mpRedSlider->SetRange(Range(0,255));
mpRedSlider->Show();
- mpGreenSlider->SetPosSizePixel(nLeft, nTop+40, nWidth, 10);
+ mpGreenSlider->SetPosSizePixel(nLeft, nTop+35, nWidth, 10);
mpGreenSlider->SetRange(Range(0,255));
mpGreenSlider->Show();
- mpBlueSlider->SetPosSizePixel(nLeft, nTop+50, nWidth, 10);
+ mpBlueSlider->SetPosSizePixel(nLeft, nTop+45, nWidth, 10);
mpBlueSlider->SetRange(Range(0,255));
mpBlueSlider->Show();
@@ -146,10 +153,10 @@ public:
mpBlueSlider->SetSlideHdl(LINK(this, ColorControl, UpdateColor));
mpTextValue->SetText(::rtl::OUString::createFromAscii("x000000"));
- mpTextValue->SetPosSizePixel(nLeft, nTop+70, 150, 20);
+ mpTextValue->SetPosSizePixel(nLeft, nTop+60, 150, 20);
mpTextValue->Show();
- mpColorValue->SetPosSizePixel(nLeft + 150, nTop+70, nWidth - 160, 20);
+ mpColorValue->SetPosSizePixel(nLeft + 150, nTop+60, nWidth - 160, 20);
mpColorValue->SetBackground(Wallpaper(Color(aStartColor)));
mpColorValue->Show();
@@ -186,6 +193,11 @@ public:
mpBlueSlider->GetThumbPos()).GetColor();
}
+ virtual sal_Int32 GetHeight (void)
+ {
+ return mpContainer->GetSizePixel().Height();
+ }
+
DECL_LINK(UpdateColor, void*);
private:
@@ -210,9 +222,14 @@ private:
mpColorValue->SetBackground(Wallpaper(aColor));
mpColorValue->Invalidate();
- const int nMaxLength(10);
+ const int nMaxLength(30);
char aBuffer[nMaxLength];
- snprintf(aBuffer, nMaxLength, "x%02x%02x%02x", nRed,nGreen,nBlue);
+ USHORT nHue (0);
+ USHORT nSaturation (0);
+ USHORT nBrightness (0);
+ aColor.RGBtoHSB(nHue, nSaturation, nBrightness);
+ snprintf(aBuffer, nMaxLength, "r%02Xg%02Xb%02X h%ds%d%b%d",
+ nRed,nGreen,nBlue, nHue,nSaturation,nBrightness);
mpTextValue->SetText(::rtl::OUString::createFromAscii(aBuffer));
return aColor;
@@ -245,6 +262,7 @@ public:
GradientControl (
::Window* pParent,
+ const char* pTitle,
const Theme::GradientColorType eType,
const Rectangle& rBoundingBox,
SlideSorter& rSlideSorter)
@@ -252,12 +270,17 @@ public:
mrSlideSorter(rSlideSorter),
meType(eType),
mpContainer(new ::Window(pParent, WB_BORDER)),
- mpColorControl(new ColorControl(mpContainer, "Base Color",
+ mpColorControl(new ColorControl(mpContainer, pTitle,
Rectangle(0,0, rBoundingBox.GetWidth()-4, 90),
::boost::bind(&Theme::GetGradientColor, mpTheme,
::boost::bind(&GradientControl::GetType, this), Theme::Base),
::boost::bind(&GradientControl::SetBaseColor, this, _1),
::boost::bind(&GradientControl::Update, this, (void*)0))),
+ mpSaturationSlider(new Slider(mpContainer)),
+ mpSaturationText(new FixedText(mpContainer)),
+ mpBrightnessSlider(new Slider(mpContainer)),
+ mpBrightnessText(new FixedText(mpContainer)),
+ mpHGBColor(new ::Window(mpContainer)),
mpFillOffset1Slider(new Slider(mpContainer)),
mpFillOffset1Text(new FixedText(mpContainer)),
mpFillOffset1Color(new ::Window(mpContainer)),
@@ -277,14 +300,33 @@ public:
mpContainer->SetPosSizePixel(rBoundingBox.TopLeft(), rBoundingBox.GetSize());
mpContainer->Show();
+ mpSaturationSlider->SetPosSizePixel(10,100,nWidth/2,15);
+ mpSaturationSlider->SetRange(Range(0,+100));
+ mpSaturationSlider->SetThumbPos(mpTheme->GetGradientSaturationOverride(eType));
+ mpSaturationSlider->SetSlideHdl(LINK(this, GradientControl, SaturationSliderUpdate));
+ mpSaturationSlider->Show();
+ mpSaturationText->SetPosSizePixel(nWidth/2+15,100,nWidth/2,15);
+ mpSaturationText->Show();
+
+ mpBrightnessSlider->SetPosSizePixel(10,115,nWidth/2,15);
+ mpBrightnessSlider->SetRange(Range(0,+100));
+ mpBrightnessSlider->SetThumbPos(mpTheme->GetGradientBrightnessOverride(eType));
+ mpBrightnessSlider->SetSlideHdl(LINK(this, GradientControl, BrightnessSliderUpdate));
+ mpBrightnessSlider->Show();
+ mpBrightnessText->SetPosSizePixel(nWidth/2+15,115,nWidth/2,15);
+ mpBrightnessText->Show();
+
+ mpHGBColor->SetPosSizePixel(nWidth*3/4, 105, nWidth/4,20);
+ mpHGBColor->Show();
+
Initialize(mpFillOffset1Slider, mpFillOffset1Text, mpFillOffset1Color,
- mpTheme->GetGradientOffset(eType, Theme::Fill1), 100, nWidth);
+ mpTheme->GetGradientOffset(eType, Theme::Fill1), 130, nWidth);
Initialize(mpFillOffset2Slider, mpFillOffset2Text, mpFillOffset2Color,
- mpTheme->GetGradientOffset(eType, Theme::Fill2), 120, nWidth);
+ mpTheme->GetGradientOffset(eType, Theme::Fill2), 150, nWidth);
Initialize(mpBorderOffset1Slider, mpBorderOffset1Text, mpBorderOffset1Color,
- mpTheme->GetGradientOffset(eType, Theme::Border1), 140, nWidth);
+ mpTheme->GetGradientOffset(eType, Theme::Border1), 170, nWidth);
Initialize(mpBorderOffset2Slider, mpBorderOffset2Text, mpBorderOffset2Color,
- mpTheme->GetGradientOffset(eType, Theme::Border2), 160, nWidth);
+ mpTheme->GetGradientOffset(eType, Theme::Border2), 190, nWidth);
Update(0);
}
@@ -305,6 +347,12 @@ public:
delete mpBorderOffset2Text;
delete mpBorderOffset2Color;
+ delete mpSaturationSlider;
+ delete mpSaturationText;
+ delete mpBrightnessSlider;
+ delete mpBrightnessText;
+ delete mpHGBColor;
+
delete mpContainer;
}
@@ -322,7 +370,7 @@ public:
pSlider->SetThumbPos(nOffset);
pSlider->SetSlideHdl(LINK(this, GradientControl, Update));
- pText->SetPosSizePixel(nWidth/2+10, nY, nWidth/2-60, 15);
+ pText->SetPosSizePixel(nWidth/2+15, nY, nWidth/2-60, 15);
pText->Show();
pWindow->SetPosSizePixel(nWidth-40, nY, 40, 15);
@@ -355,12 +403,22 @@ public:
UpdateDisplay();
}
+ virtual sal_Int32 GetHeight (void)
+ {
+ return mpContainer->GetSizePixel().Height();
+ }
+
private:
::boost::shared_ptr<view::Theme> mpTheme;
SlideSorter& mrSlideSorter;
Theme::GradientColorType meType;
::Window* mpContainer;
ColorControl* mpColorControl;
+ Slider* mpSaturationSlider;
+ FixedText* mpSaturationText;
+ Slider* mpBrightnessSlider;
+ FixedText* mpBrightnessText;
+ ::Window* mpHGBColor;
Slider* mpFillOffset1Slider;
FixedText* mpFillOffset1Text;
::Window* mpFillOffset1Color;
@@ -379,6 +437,8 @@ private:
sal_Int32 mnBorderOffset2;
DECL_LINK(Update, void*);
+ DECL_LINK(SaturationSliderUpdate, void*);
+ DECL_LINK(BrightnessSliderUpdate, void*);
void UpdateDisplay (void)
{
@@ -387,11 +447,28 @@ private:
const sal_Int32 nBorderOffset1 (mpBorderOffset1Slider->GetThumbPos());
const sal_Int32 nBorderOffset2 (mpBorderOffset2Slider->GetThumbPos());
- mpFillOffset1Text->SetText(::rtl::OUString::valueOf(nFillOffset1));
+ mpSaturationText->SetText(
+ ::rtl::OUString::createFromAscii("S=")
+ +::rtl::OUString::valueOf(mpSaturationSlider->GetThumbPos()));
+ mpBrightnessText->SetText(::rtl::OUString::valueOf(mpBrightnessSlider->GetThumbPos()));
+
+ mpFillOffset1Text->SetText(
+ ::rtl::OUString::createFromAscii("B=")
+ +::rtl::OUString::valueOf(nFillOffset1));
mpFillOffset1Color->SetBackground(Wallpaper(
mpTheme->GetGradientColor(meType, Theme::Fill1)));
mpFillOffset1Color->Invalidate();
+ Color aColor (mpTheme->GetGradientColor(meType, Theme::Base));
+ USHORT nHue (0);
+ USHORT nSaturation (0);
+ USHORT nBrightness (0);
+ aColor.RGBtoHSB(nHue,nSaturation,nBrightness);
+ nSaturation = mpTheme->GetGradientSaturationOverride(meType);
+ nBrightness = mpTheme->GetGradientBrightnessOverride(meType);
+ mpHGBColor->SetBackground(Wallpaper(Color(Color::HSBtoRGB(nHue,nSaturation,nBrightness))));
+ mpHGBColor->Invalidate();
+
mpFillOffset2Text->SetText(::rtl::OUString::valueOf(nFillOffset2));
mpFillOffset2Color->SetBackground(Wallpaper(
mpTheme->GetGradientColor(meType, Theme::Fill2)));
@@ -415,15 +492,36 @@ private:
IMPL_LINK(GradientControl, Update, void*, EMPTYARG)
{
- UpdateDisplay();
-
-
mpTheme->SetGradient(meType,
mpColorControl->GetColor(),
+ mpSaturationSlider->GetThumbPos(),
+ mpBrightnessSlider->GetThumbPos(),
mpFillOffset1Slider->GetThumbPos(),
mpFillOffset2Slider->GetThumbPos(),
mpBorderOffset1Slider->GetThumbPos(),
mpBorderOffset2Slider->GetThumbPos());
+ UpdateDisplay();
+
+ return 0;
+}
+
+
+
+IMPL_LINK(GradientControl, SaturationSliderUpdate, void*, EMPTYARG)
+{
+ mpTheme->SetGradientSaturationOverride(meType, mpSaturationSlider->GetThumbPos());
+ UpdateDisplay();
+
+ return 0;
+}
+
+
+
+
+IMPL_LINK(GradientControl, BrightnessSliderUpdate, void*, EMPTYARG)
+{
+ mpTheme->SetGradientBrightnessOverride(meType, mpBrightnessSlider->GetThumbPos());
+ UpdateDisplay();
return 0;
}
@@ -467,14 +565,14 @@ public:
mpTitle->SetPosSizePixel(nLeft, nTop, nWidth,20);
mpTitle->Show();
- mpSlider->SetPosSizePixel(nLeft, nTop+30, nWidth, 10);
+ mpSlider->SetPosSizePixel(nLeft, nTop+25, nWidth, 10);
mpSlider->SetRange(aRange);
mpSlider->SetSlideHdl(LINK(this, SliderControl, UpdateValue));
mpSlider->SetThumbPos(nStartValue);
mpSlider->Show();
mpTextValue->SetText(::rtl::OUString::valueOf(nStartValue));
- mpTextValue->SetPosSizePixel(nLeft, nTop+50, 150, 20);
+ mpTextValue->SetPosSizePixel(nLeft, nTop+40, 150, 20);
mpTextValue->Show();
UpdateValue(0);
@@ -488,6 +586,11 @@ public:
delete mpContainer;
}
+ virtual sal_Int32 GetHeight (void)
+ {
+ return mpContainer->GetSizePixel().Height();
+ }
+
private:
ValueGetter maGetter;
ValueSetter maSetter;
@@ -577,6 +680,11 @@ public:
delete mpContainer;
}
+ virtual sal_Int32 GetHeight (void)
+ {
+ return mpContainer->GetSizePixel().Height();
+ }
+
private:
::std::map<USHORT, int> maValues;
ValueGetter maGetter;
@@ -648,6 +756,11 @@ public:
delete mpContainer;
}
+ virtual sal_Int32 GetHeight (void)
+ {
+ return mpContainer->GetSizePixel().Height();
+ }
+
private:
ValueGetter maGetter;
ValueSetter maSetter;
@@ -697,37 +810,55 @@ SlideSorterDebugDialog::SlideSorterDebugDialog (SlideSorter& rSlideSorter)
{
::boost::shared_ptr<view::Theme> pTheme(rSlideSorter.GetTheme());
- mpTopLevelWindow->SetSizePixel(Size(300,510));
+ const sal_Int32 nGap (10);
+ sal_Int32 nY (nGap);
- maControls.push_back(new TextButton(
+ maControls.push_back(new SliderControl(
mpTopLevelWindow,
- "Close",
- Rectangle(195,480,100,25),
- ::boost::bind(&WorkWindow::Close, mpTopLevelWindow)));
+ "Button Border",
+ Rectangle(10,nY,290,nY+60),
+ Range(0,64),
+ ::boost::bind(&view::Theme::GetIntegerValue, pTheme, view::Theme::Integer_ButtonBorder),
+ ::boost::bind(&view::Theme::SetIntegerValue, pTheme, view::Theme::Integer_ButtonBorder, _1),
+ ::boost::bind(&view::ButtonBar::RequestLayout,
+ ::boost::ref(rSlideSorter.GetView().GetButtonBar()))));
+ nY += maControls.back()->GetHeight() + nGap;
- maControls.push_back(new ColorControl(
+ maControls.push_back(new SliderControl(
mpTopLevelWindow,
- "Unhide Button Background",
- Rectangle(10,10,290,110),
- ::boost::bind(&view::Theme::GetColor, pTheme, view::Theme::ButtonBackground),
- ::boost::bind(&view::Theme::SetColor, pTheme, view::Theme::ButtonBackground, _1),
- ::boost::bind(&view::SlideSorterView::RequestRepaint,
- ::boost::ref(rSlideSorter.GetView()))));
+ "Button Gap",
+ Rectangle(10,nY,290,nY+60),
+ Range(0,64),
+ ::boost::bind(&view::Theme::GetIntegerValue, pTheme, view::Theme::Integer_ButtonGap),
+ ::boost::bind(&view::Theme::SetIntegerValue, pTheme, view::Theme::Integer_ButtonGap, _1),
+ ::boost::bind(&view::ButtonBar::RequestLayout,
+ ::boost::ref(rSlideSorter.GetView().GetButtonBar()))));
+ nY += maControls.back()->GetHeight() + nGap;
+
+ maControls.push_back(new GradientControl(
+ mpTopLevelWindow,
+ "Button Background",
+ Theme::Gradient_ButtonBackground,
+ Rectangle(10,nY,285,nY+220),
+ rSlideSorter));
+ nY += maControls.back()->GetHeight() + nGap;
maControls.push_back(new SliderControl(
mpTopLevelWindow,
"Max Button Alpha",
- Rectangle(10,120,290,200),
+ Rectangle(10,nY,290,nY+60),
Range(0,255),
- ::boost::bind(&view::Theme::GetIntegerValue, pTheme, view::Theme::ButtonMaxAlpha),
- ::boost::bind(&view::Theme::SetIntegerValue, pTheme, view::Theme::ButtonMaxAlpha, _1),
+ ::boost::bind(&view::Theme::GetIntegerValue, pTheme, view::Theme::Integer_ButtonMaxAlpha),
+ ::boost::bind(&view::Theme::SetIntegerValue, pTheme, view::Theme::Integer_ButtonMaxAlpha, _1),
::boost::bind(&view::SlideSorterView::RequestRepaint,
::boost::ref(rSlideSorter.GetView()))));
+ nY += maControls.back()->GetHeight() + nGap;
GradientControl* pControl = new GradientControl(
mpTopLevelWindow,
- Theme::SelectedPage,
- Rectangle(10,210,285,450),
+ "Base Color",
+ Theme::Gradient_SelectedPage,
+ Rectangle(10,210,285,500),
rSlideSorter);
const char* aValues[] = {
"Normal",
@@ -737,23 +868,33 @@ SlideSorterDebugDialog::SlideSorterDebugDialog (SlideSorter& rSlideSorter)
};
maControls.push_back(new ChoiceControl(
mpTopLevelWindow,
- Rectangle(10,210,290,470),
+ Rectangle(10,nY,290,nY+240),
aValues,
4,
pControl,
::boost::bind(&GradientControl::GetType, pControl),
::boost::bind(&GradientControl::SetType, pControl, _1)));
+ nY += maControls.back()->GetHeight() + nGap;
maControls.push_back(new BoolControl(
mpTopLevelWindow,
"Alternative Button Paint Style",
- Rectangle(10,480,290,500),
+ Rectangle(10,nY,290,nY+20),
1,0,
- ::boost::bind(&view::Theme::GetIntegerValue, pTheme, view::Theme::ButtonPaintType),
- ::boost::bind(&view::Theme::SetIntegerValue, pTheme, view::Theme::ButtonPaintType, _1),
+ ::boost::bind(&view::Theme::GetIntegerValue, pTheme, view::Theme::Integer_ButtonPaintType),
+ ::boost::bind(&view::Theme::SetIntegerValue, pTheme, view::Theme::Integer_ButtonPaintType, _1),
::boost::bind(&view::SlideSorterView::RequestRepaint,
::boost::ref(rSlideSorter.GetView()))));
+ nY += maControls.back()->GetHeight() + nGap;
+
+ maControls.push_back(new TextButton(
+ mpTopLevelWindow,
+ "Close",
+ Rectangle(195,nY,100,nY+25),
+ ::boost::bind(&WorkWindow::Close, mpTopLevelWindow)));
+ nY += maControls.back()->GetHeight() + nGap;
+ mpTopLevelWindow->SetSizePixel(Size(300,nY));
mpTopLevelWindow->Show(true);
}
diff --git a/sd/source/ui/slidesorter/view/SlideSorterView.cxx b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
index e69090f611b9..2b79e4bd650b 100644
--- a/sd/source/ui/slidesorter/view/SlideSorterView.cxx
+++ b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
@@ -39,6 +39,7 @@
#include "view/SlsPageObjectLayouter.hxx"
#include "view/SlsPageObjectPainter.hxx"
#include "view/SlsILayerPainter.hxx"
+#include "view/SlsButton.hxx"
#include "controller/SlideSorterController.hxx"
#include "controller/SlsProperties.hxx"
#include "controller/SlsAnimator.hxx"
@@ -150,26 +151,27 @@ SlideSorterView::SlideSorterView (SlideSorter& rSlideSorter)
rSlideSorter.GetModel().GetDocument(),
rSlideSorter.GetContentWindow().get(),
rSlideSorter.GetViewShell()),
- mrSlideSorter(rSlideSorter),
- mrModel(rSlideSorter.GetModel()),
- mbIsDisposed(false),
- mpLayouter (new Layouter(rSlideSorter.GetContentWindow())),
- 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(),
- mbIsMouseOverIndicationAllowed(true),
- mnButtonUnderMouse(-1),
- mpPageObjectPainter(),
- mpSelectionPainter(),
- mpBackgroundPainter(
- new BackgroundPainter(mrSlideSorter.GetTheme()->GetColor(Theme::Background)))
+ mrSlideSorter(rSlideSorter),
+ mrModel(rSlideSorter.GetModel()),
+ mbIsDisposed(false),
+ mpLayouter (new Layouter(rSlideSorter.GetContentWindow())),
+ 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(),
+ msHelpText(),
+ mnButtonUnderMouse(-1),
+ mpPageObjectPainter(),
+ mpSelectionPainter(),
+ mpBackgroundPainter(
+ new BackgroundPainter(mrSlideSorter.GetTheme()->GetColor(Theme::Background))),
+ mpButtonBar(new ButtonBar(mrSlideSorter))
{
// Hide the page that contains the page objects.
SetPageVisible (FALSE);
@@ -245,7 +247,7 @@ sal_Int32 SlideSorterView::GetPageIndexAtPoint (const Point& rWindowPosition) co
SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
if (pWindow)
{
- nIndex = mpLayouter->GetIndexAtPoint(pWindow->PixelToLogic(rWindowPosition));
+ nIndex = mpLayouter->GetIndexAtPoint(pWindow->PixelToLogic(rWindowPosition), false, false);
// Clip the page index against the page count.
if (nIndex >= mrModel.GetPageCount())
@@ -305,7 +307,7 @@ void SlideSorterView::PostModelChange (void)
model::PageEnumerationProvider::CreateAllPagesEnumeration(mrModel));
// The new page objects have to be scaled and positioned.
- Layout();
+ Rearrange();
RequestRepaint();
}
@@ -361,6 +363,14 @@ void SlideSorterView::Resize (void)
UpdateOrientation();
mpLayeredDevice->Resize();
+ Rearrange();
+}
+
+
+
+
+void SlideSorterView::Rearrange (void)
+{
SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
if (mrModel.GetPageCount()>0 && pWindow)
{
@@ -373,6 +383,7 @@ void SlideSorterView::Resize (void)
if (bRearrangeSuccess)
{
+ GetButtonBar().SetPageObjectSize(mpLayouter->GetPageObjectSize());
Layout();
UpdatePageUnderMouse(false);
RequestRepaint();
@@ -479,20 +490,12 @@ void SlideSorterView::Layout ()
// Iterate over all page objects and place them relative to the
// containing page.
- sal_Int32 nIndex (0);
model::PageEnumeration aPageEnumeration (
model::PageEnumerationProvider::CreateAllPagesEnumeration(mrModel));
while (aPageEnumeration.HasMoreElements())
{
model::SharedPageDescriptor pDescriptor (aPageEnumeration.GetNextElement());
pDescriptor->SetBoundingBox(mpLayouter->GetPageObjectBox(pDescriptor->GetPageIndex()));
- OSL_TRACE("%d %d(%d) : %d %d %d %d",
- pDescriptor->GetPageIndex(), pDescriptor->GetVisualState().mnPageId, nIndex,
- pDescriptor->GetBoundingBox().Left(),
- pDescriptor->GetBoundingBox().Top(),
- pDescriptor->GetBoundingBox().GetWidth(),
- pDescriptor->GetBoundingBox().GetHeight());
- ++nIndex;
}
GetPageObjectPainter()->NotifyResize();
@@ -545,7 +548,7 @@ void SlideSorterView::DeterminePageObjectVisibilities (void)
maVisiblePageRange = aRange;
// Restore the mouse over state.
- UpdatePageUnderMouse(false);
+ UpdatePageUnderMouse(true);
}
}
@@ -808,25 +811,22 @@ Pair SlideSorterView::GetVisiblePageRange (void)
-void SlideSorterView::Notify (SfxBroadcaster& rBroadcaster, const SfxHint& rHint)
+ButtonBar& SlideSorterView::GetButtonBar (void) const
{
- ::sd::DrawDocShell* pDocShell = mrModel.GetDocument()->GetDocSh();
- if (pDocShell!=NULL && pDocShell->IsEnableSetModified())
- mbModelChangedWhileModifyEnabled = true;
-
- ::sd::View::Notify(rBroadcaster, rHint);
+ OSL_ASSERT(mpButtonBar);
+ return *mpButtonBar;
}
-void SlideSorterView::SetIsMouseOverIndicationAllowed (const bool bIsAllowed)
+void SlideSorterView::Notify (SfxBroadcaster& rBroadcaster, const SfxHint& rHint)
{
- mbIsMouseOverIndicationAllowed = bIsAllowed;
- if ( ! mbIsMouseOverIndicationAllowed)
- SetPageUnderMouse(model::SharedPageDescriptor());
- else
- UpdatePageUnderMouse(false);
+ ::sd::DrawDocShell* pDocShell = mrModel.GetDocument()->GetDocSh();
+ if (pDocShell!=NULL && pDocShell->IsEnableSetModified())
+ mbModelChangedWhileModifyEnabled = true;
+
+ ::sd::View::Notify(rBroadcaster, rHint);
}
@@ -857,34 +857,38 @@ void SlideSorterView::UpdatePageUnderMouse (
const bool bIsMouseButtonDown,
const bool bAnimate)
{
- if ( ! mbIsMouseOverIndicationAllowed)
- {
- SetPageUnderMouse(model::SharedPageDescriptor());
- }
- else
- {
- // Determine page under mouse and show the mouse over effect.
- model::SharedPageDescriptor pHitDescriptor (
- mrSlideSorter.GetController().GetPageAt(rMousePosition));
- SetPageUnderMouse(pHitDescriptor, bAnimate);
+ UpdatePageUnderMouse(
+ mrSlideSorter.GetController().GetPageAt(rMousePosition),
+ rMousePosition,
+ bIsMouseButtonDown,
+ bAnimate);
+}
- // Handle the mouse being over any buttons.
- if (pHitDescriptor)
- {
- SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
- const Point aMouseModelPosition (pWindow->PixelToLogic(rMousePosition));
- const sal_Int32 nButtonIndex (
- GetLayouter().GetPageObjectLayouter()->GetButtonIndexAt (
- pHitDescriptor,
- aMouseModelPosition));
- SetButtonUnderMouse(nButtonIndex);
- if (bIsMouseButtonDown)
- {
- pHitDescriptor->GetVisualState().SetActiveButtonState(
- nButtonIndex,
- model::VisualState::BS_Pressed);
- }
- }
+
+
+
+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));
+
+ 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)
+ {
+ pWindow->SetQuickHelpText(msHelpText);
}
}
@@ -898,15 +902,9 @@ void SlideSorterView::SetPageUnderMouse (
if (mpPageUnderMouse != rpDescriptor)
{
if (mpPageUnderMouse)
- {
- mpPageUnderMouse->GetVisualState().SetActiveButtonState(
- -1,
- model::VisualState::BS_Normal);
SetState(mpPageUnderMouse, PageDescriptor::ST_MouseOver, false, bAnimate);
- }
mpPageUnderMouse = rpDescriptor;
- SetButtonUnderMouse(-1);
if (mpPageUnderMouse)
SetState(mpPageUnderMouse, PageDescriptor::ST_MouseOver, true, bAnimate);
@@ -916,43 +914,23 @@ void SlideSorterView::SetPageUnderMouse (
SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
if (pWindow)
{
- ::rtl::OUString sText;
+ msHelpText = ::rtl::OUString();
if (mpPageUnderMouse)
{
SdPage* pPage = mpPageUnderMouse->GetPage();
if (pPage != NULL)
- sText = pPage->GetName();
+ msHelpText = pPage->GetName();
else
{
OSL_ASSERT(mpPageUnderMouse->GetPage() != NULL);
}
- if (sText.getLength() == 0)
+ if (msHelpText.getLength() == 0)
{
- sText = String(SdResId(STR_PAGE));
- sText += String::CreateFromInt32(mpPageUnderMouse->GetPageIndex()+1);
+ msHelpText = String(SdResId(STR_PAGE));
+ msHelpText += String::CreateFromInt32(mpPageUnderMouse->GetPageIndex()+1);
}
}
- pWindow->SetQuickHelpText(sText);
- }
- }
-}
-
-
-
-
-void SlideSorterView::SetButtonUnderMouse (
- const sal_Int32 nButtonIndex,
- const bool bForce)
-{
- if (mnButtonUnderMouse != nButtonIndex || bForce)
- {
- if (mpPageUnderMouse)
- {
- mnButtonUnderMouse = nButtonIndex;
- mpPageUnderMouse->GetVisualState().SetActiveButtonState(
- mnButtonUnderMouse,
- model::VisualState::BS_MouseOver);
- RequestRepaint(mpPageUnderMouse);
+ pWindow->SetQuickHelpText(msHelpText);
}
}
}
@@ -988,7 +966,7 @@ bool SlideSorterView::SetState (
if (eState == PageDescriptor::ST_MouseOver)
{
const double nMinAlpha (
- mrSlideSorter.GetTheme()->GetIntegerValue(Theme::ButtonMaxAlpha)/255.0);
+ mrSlideSorter.GetTheme()->GetIntegerValue(Theme::Integer_ButtonMaxAlpha)/255.0);
const static double nMaxAlpha (1.0);
const double nEndAlpha (bStateValue ? nMinAlpha : nMaxAlpha);
if (bAnimate)
diff --git a/sd/source/ui/slidesorter/view/SlsButtonBar.cxx b/sd/source/ui/slidesorter/view/SlsButtonBar.cxx
new file mode 100644
index 000000000000..9342b2d2ca65
--- /dev/null
+++ b/sd/source/ui/slidesorter/view/SlsButtonBar.cxx
@@ -0,0 +1,960 @@
+/*************************************************************************
+ *
+ * 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 "view/SlsTheme.hxx"
+#include "view/SlideSorterView.hxx"
+#include "controller/SlideSorterController.hxx"
+#include "controller/SlsSlotManager.hxx"
+#include "controller/SlsCurrentSlideManager.hxx"
+#include "controller/SlsPageSelector.hxx"
+#include "app.hrc"
+#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>
+
+namespace sd { namespace slidesorter { namespace view {
+
+namespace {
+ void AdaptTransparency (AlphaMask& rMask, const double nAlpha)
+ {
+ BitmapWriteAccess* pBitmap = rMask.AcquireWriteAccess();
+
+ if (pBitmap != NULL)
+ {
+ const sal_Int32 nWidth (pBitmap->Width());
+ const sal_Int32 nHeight (pBitmap->Height());
+
+ const BitmapColor aWhite (255,255,255);
+ for (sal_Int32 nY = 0; nY<nHeight; ++nY)
+ for (sal_Int32 nX = 0; nX<nWidth; ++nX)
+ {
+ const BYTE nValue (255 - pBitmap->GetPixel(nY, nX).GetBlueOrIndex());
+ const BYTE nNewValue (nValue * (1-nAlpha));
+ pBitmap->SetPixel(nY, nX, 255-nNewValue);
+ }
+ }
+ }
+}
+
+
+
+
+//===== ButtonBar =============================================================
+
+ButtonBar::ButtonBar (SlideSorter& rSlideSorter)
+ : mrSlideSorter(rSlideSorter),
+ maPageObjectSize(0,0),
+ maBoundingBox(),
+ mpDescriptor(),
+ mbIsExcluded(false),
+ mpButtonUnderMouse(),
+ mpDownButton(),
+ maRegularButtons(),
+ maExcludedButtons(),
+ maNormalBackground(),
+ maButtonDownBackground(),
+ mbIsMouseOverBar(false)
+{
+ maExcludedButtons.push_back(::boost::shared_ptr<Button>(new UnhideButton(mrSlideSorter)));
+
+ 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)));
+}
+
+
+
+
+void ButtonBar::SetPageObjectSize (const Size aPageObjectSize)
+{
+}
+
+
+
+
+void ButtonBar::ProcessButtonDownEvent (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const Point aMouseModelLocation)
+{
+ SetButtonUnderMouse(GetButtonAt(aMouseModelLocation));
+ if (mpButtonUnderMouse)
+ mpButtonUnderMouse->SetState(Button::ST_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::ST_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));
+
+ // Update the button state.
+ 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::ST_Down);
+ }
+ else
+ bButtonStateHasChanged = mpButtonUnderMouse->SetState(Button::ST_Hover);
+ }
+ }
+
+ // Show a quick help text when the mouse is over a button.
+ if (bButtonHasChanged)
+ {
+ SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ if (pWindow)
+ if (mpButtonUnderMouse)
+ pWindow->SetQuickHelpText(mpButtonUnderMouse->GetHelpText());
+ else
+ pWindow->SetQuickHelpText(::rtl::OUString());
+ }
+
+ 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);
+
+ LayoutButtons(rpDescriptor->GetBoundingBox().GetSize());
+ }
+ 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 || nIndex>=rButtons.size())
+ {
+ OSL_ASSERT(nIndex<0 || nIndex>=rButtons.size());
+ return ::boost::shared_ptr<Button>();
+ }
+ else
+ return rButtons[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_Int32 nIndex=0; nIndex<rButtons.size(); ++nIndex)
+ if (rButtons[nIndex]->GetBoundingBox().IsInside(aLocalLocation))
+ return rButtons[nIndex];
+ }
+
+ return SharedButton();
+}
+
+
+
+
+bool ButtonBar::IsMouseOverBar (void) const
+{
+ return mbIsMouseOverBar;
+}
+
+
+
+
+bool ButtonBar::SetButtonUnderMouse (const SharedButton& rButton)
+{
+ if (mpButtonUnderMouse != rButton)
+ {
+ if (mpButtonUnderMouse)
+ mpButtonUnderMouse->SetState(Button::ST_Normal);
+
+ mpButtonUnderMouse = rButton;
+
+ return true;
+ }
+ else
+ return false;
+}
+
+
+
+
+void ButtonBar::Paint (
+ OutputDevice& rDevice,
+ const model::SharedPageDescriptor& rpDescriptor)
+{
+ if ( ! mpDescriptor || mpDescriptor!=rpDescriptor)
+ return;
+
+ const double nAlpha (mpDescriptor->GetVisualState().GetButtonAlpha());
+ if (nAlpha >= 1)
+ return;
+
+ const Point aOffset (rpDescriptor->GetBoundingBox().TopLeft());
+
+ // Paint the background.
+ PaintButtonBackground(rDevice, aOffset);
+
+ // Paint the buttons.
+ const ::std::vector<SharedButton>& rButtons (
+ rpDescriptor->HasState(model::PageDescriptor::ST_Excluded)
+ ? maExcludedButtons
+ : maRegularButtons);
+ for (sal_Int32 nIndex=0; nIndex<rButtons.size(); ++nIndex)
+ rButtons[nIndex]->Paint(
+ rDevice,
+ aOffset,
+ nAlpha,
+ mrSlideSorter.GetTheme());
+}
+
+
+
+
+bool ButtonBar::IsMouseOverButton (void) const
+{
+ return mpButtonUnderMouse;
+}
+
+
+
+
+void ButtonBar::PaintButtonBackground (
+ OutputDevice& rDevice,
+ const Point aOffset)
+{
+ Bitmap* pBitmap = NULL;
+ if (mpButtonUnderMouse && mpButtonUnderMouse->IsDown())
+ {
+ if (maButtonDownBackground.IsEmpty())
+ maButtonDownBackground = CreateBackground(rDevice, maBoundingBox.GetSize(), true);
+ pBitmap = &maButtonDownBackground;
+ }
+ else
+ {
+ if (maNormalBackground.IsEmpty())
+ maNormalBackground = CreateBackground(rDevice, maBoundingBox.GetSize(), false);
+ pBitmap = &maNormalBackground;
+ }
+
+ if (pBitmap != NULL)
+ {
+ BYTE aTransparency (mpDescriptor->GetVisualState().GetButtonAlpha()*255);
+ AlphaMask aMask (pBitmap->GetSizePixel(), &aTransparency);
+ rDevice.DrawBitmapEx(maBoundingBox.TopLeft()+aOffset, BitmapEx(*pBitmap, aMask));
+ }
+ else
+ {
+ OSL_TRACE("not painting background");
+ }
+}
+
+
+
+
+Bitmap ButtonBar::CreateBackground (
+ const OutputDevice& rTemplateDevice,
+ const Size aSize,
+ const bool bIsButtonDown) const
+{
+ VirtualDevice aDevice (rTemplateDevice);
+ aDevice.SetOutputSizePixel(aSize);
+
+ // Setup background color.
+ Color aTopFillColor (mrSlideSorter.GetTheme()->GetGradientColor(
+ Theme::Gradient_ButtonBackground,
+ Theme::Fill1));
+ Color aTopBorderColor (mrSlideSorter.GetTheme()->GetGradientColor(
+ Theme::Gradient_ButtonBackground,
+ Theme::Border1));
+ Color aBottomFillColor (mrSlideSorter.GetTheme()->GetGradientColor(
+ Theme::Gradient_ButtonBackground,
+ Theme::Fill2));
+ Color aBottomBorderColor (mrSlideSorter.GetTheme()->GetGradientColor(
+ Theme::Gradient_ButtonBackground,
+ Theme::Border2));
+ if (bIsButtonDown)
+ {
+ aTopFillColor.DecreaseLuminance(50);
+ aTopBorderColor.DecreaseLuminance(50);
+ aBottomFillColor.DecreaseLuminance(50);
+ aBottomBorderColor.DecreaseLuminance(50);
+ }
+
+ const int nCenter (aSize.Height() / 2);
+
+ // Fill upper and lower half.
+ aDevice.SetLineColor();
+ aDevice.SetFillColor(aTopFillColor);
+ aDevice.DrawRect(Rectangle(0,0,aSize.Width()-1,nCenter));
+ aDevice.SetFillColor(aBottomFillColor);
+ aDevice.DrawRect(Rectangle(0,nCenter,aSize.Width()-1,aSize.Height()-1));
+
+ // Draw border.
+ aDevice.SetFillColor();
+ aDevice.SetLineColor(aTopBorderColor);
+ aDevice.DrawLine(Point(0,nCenter),Point(0,0));
+ aDevice.DrawLine(Point(0,0), Point(aSize.Width()-1,0));
+ aDevice.DrawLine(Point(aSize.Width()-1,0),Point(aSize.Width()-1,nCenter));
+ aDevice.SetLineColor(aBottomBorderColor);
+ aDevice.DrawLine(Point(0,nCenter),Point(0,aSize.Height()-1));
+ aDevice.DrawLine(Point(0,aSize.Height()-1), Point(aSize.Width()-1,aSize.Height()-1));
+ aDevice.DrawLine(Point(aSize.Width()-1,aSize.Height()-1),Point(aSize.Width()-1,nCenter));
+
+ return aDevice.GetBitmap(Point(0,0), aSize);
+}
+
+
+
+
+bool ButtonBar::IsMouseOverBar (const Point aModelLocation) const
+{
+ if ( ! mpDescriptor || ! mpDescriptor->GetBoundingBox().IsInside(aModelLocation))
+ return false;
+
+ return maBoundingBox.IsInside(aModelLocation - mpDescriptor->GetBoundingBox().TopLeft());
+}
+
+
+
+
+void ButtonBar::RequestLayout (void)
+{
+ maPageObjectSize = Size(0,0);
+}
+
+
+
+
+void ButtonBar::LayoutButtons (const Size aPageObjectSize)
+{
+ if (maPageObjectSize != aPageObjectSize)
+ {
+ maPageObjectSize = aPageObjectSize;
+
+ if ( ! LayoutButtons(aPageObjectSize, false))
+ LayoutButtons(aPageObjectSize, true);
+
+ // 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 (
+ const Size aPageObjectSize,
+ const bool bIsSmall)
+{
+ // Tell buttons which size they are.
+ for (sal_Int32 nIndex=0; nIndex<maExcludedButtons.size(); ++nIndex)
+ maExcludedButtons[nIndex]->SetIsSmall(bIsSmall);
+ for (sal_Int32 nIndex=0; nIndex<maRegularButtons.size(); ++nIndex)
+ maRegularButtons[nIndex]->SetIsSmall(bIsSmall);
+
+ // Determine maximal height of the buttons.
+ // Start with the buttons used for the excluded state.
+ sal_Int32 nMaximumHeight (0);
+ for (sal_Int32 nIndex=0; nIndex<maExcludedButtons.size(); ++nIndex)
+ {
+ const Size aSize (maExcludedButtons[nIndex]->GetSize());
+ if (aSize.Height() > nMaximumHeight)
+ nMaximumHeight = aSize.Height();
+ }
+
+ // Do the same for the regular buttons.
+ for (sal_Int32 nIndex=0; nIndex<maRegularButtons.size(); ++nIndex)
+ {
+ const Size aSize (maRegularButtons[nIndex]->GetSize());
+ if (aSize.Height() > nMaximumHeight)
+ nMaximumHeight = aSize.Height();
+ }
+ nMaximumHeight += 2*mrSlideSorter.GetTheme()->GetIntegerValue(Theme::Integer_ButtonBorder);
+
+ // Set up the bounding box of the button bar.
+ maBoundingBox
+ = mrSlideSorter.GetView().GetLayouter().GetPageObjectLayouter()->GetBoundingBox(
+ Point(0,0),
+ PageObjectLayouter::Preview,
+ PageObjectLayouter::ModelCoordinateSystem);
+
+ maBoundingBox.Top() = maBoundingBox.Bottom()- nMaximumHeight;
+ maBoundingBox.Left() -= 1;
+ maBoundingBox.Right() += 1;
+ maBoundingBox.Bottom() += 1;
+
+ // Place the buttons.
+ Rectangle aBox (maBoundingBox);
+ const sal_Int32 nGap (mrSlideSorter.GetTheme()->GetIntegerValue(Theme::Integer_ButtonGap));
+ if (maExcludedButtons.size() > 1)
+ aBox.Right() -= mrSlideSorter.GetTheme()->GetIntegerValue(Theme::Integer_ButtonBorder);
+ for (sal_Int32 nIndex=maExcludedButtons.size()-1; nIndex>=0; --nIndex)
+ {
+ maExcludedButtons[nIndex]->Place(aBox, maExcludedButtons.size()-1-nIndex);
+ aBox.Right() = maExcludedButtons[nIndex]->GetBoundingBox().Left() - nGap;
+ }
+ aBox = maBoundingBox;
+ aBox.Right() -= mrSlideSorter.GetTheme()->GetIntegerValue(Theme::Integer_ButtonBorder);
+ for (sal_Int32 nIndex=maRegularButtons.size()-1; nIndex>=0; --nIndex)
+ {
+ maRegularButtons[nIndex]->Place(aBox, maRegularButtons.size()-1-nIndex);
+ aBox.Right() = maRegularButtons[nIndex]->GetBoundingBox().Left() - nGap;
+ }
+
+ // We return true only when there is no inactive button.
+ for (sal_Int32 nIndex=0; nIndex<maExcludedButtons.size(); ++nIndex)
+ if ( ! maExcludedButtons[nIndex]->IsActive())
+ return false;
+ for (sal_Int32 nIndex=0; nIndex<maRegularButtons.size(); ++nIndex)
+ if ( ! maRegularButtons[nIndex]->IsActive())
+ return false;
+ return true;
+}
+
+
+
+
+//===== Button ================================================================
+
+Button::Button (
+ SlideSorter& rSlideSorter,
+ const ::rtl::OUString& rsHelpText)
+ : mrSlideSorter(rSlideSorter),
+ meState(ST_Normal),
+ maBoundingBox(),
+ msHelpText(rsHelpText),
+ mbIsActive(false),
+ mbIsSmall(false)
+{
+}
+
+
+
+
+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==ST_Down;
+}
+
+
+
+
+void Button::SetActiveState (const bool bIsActive)
+{
+ mbIsActive = bIsActive;
+}
+
+
+
+
+bool Button::IsActive (void) const
+{
+ return mbIsActive;
+}
+
+
+
+
+void Button::SetIsSmall (const bool bIsSmall)
+{
+ mbIsSmall = bIsSmall;
+}
+
+
+
+
+//===== TextButton ============================================================
+
+TextButton::TextButton (
+ SlideSorter& rSlideSorter,
+ const ::rtl::OUString& rsText,
+ const ::rtl::OUString& rsHelpText)
+ : Button(rSlideSorter, rsHelpText),
+ msText(rsText)
+{
+}
+
+
+
+
+void TextButton::Place (const Rectangle aButtonBarBox, const sal_Int32 nIndex)
+{
+ (void)nIndex;
+ maBoundingBox = aButtonBarBox;
+ SetActiveState(true);
+}
+
+
+
+
+void TextButton::Paint (
+ OutputDevice& rDevice,
+ const Point aOffset,
+ const double nAlpha,
+ const ::boost::shared_ptr<Theme>& rpTheme) const
+{
+ if (mbIsActive)
+ {
+ // Paint text over the button background.
+ rDevice.SetTextColor(rpTheme->GetColor(Theme::ButtonText));
+ Rectangle aBox (maBoundingBox);
+ aBox += aOffset;
+ rDevice.DrawText(aBox, msText, TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER);
+ }
+}
+
+
+
+
+Size TextButton::GetSize (void) const
+{
+ return Size();
+}
+
+
+
+
+//===== ImageButon ============================================================
+
+ImageButton::ImageButton (
+ SlideSorter& rSlideSorter,
+ const BitmapEx& rRegularIcon,
+ const BitmapEx& rHoverIcon,
+ const BitmapEx& rPressedIcon,
+ const BitmapEx& rSmallIcon,
+ const BitmapEx& rSmallHoverIcon,
+ const BitmapEx& rSmallPressedIcon,
+ const ::rtl::OUString& rsHelpText)
+ : Button(rSlideSorter, rsHelpText),
+ maNormalIcon(rRegularIcon),
+ maHoverIcon(rHoverIcon.IsEmpty() ? rRegularIcon : rHoverIcon),
+ maDownIcon(rPressedIcon.IsEmpty() ? rHoverIcon : rPressedIcon),
+ maSmallIcon(rSmallIcon),
+ maSmallHoverIcon(rSmallHoverIcon.IsEmpty() ? rSmallIcon : rSmallHoverIcon),
+ maSmallDownIcon(rSmallPressedIcon.IsEmpty() ? rSmallHoverIcon : rSmallPressedIcon)
+{
+}
+
+
+
+
+void ImageButton::Place (
+ const Rectangle aButtonBarBox,
+ const sal_Int32 nIndex)
+{
+ const sal_Int32 nWidth (mbIsSmall
+ ? maSmallIcon.GetSizePixel().Width()
+ : maNormalIcon.GetSizePixel().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 USHORT nSavedAntialiasingMode (rDevice.GetAntialiasing());
+ rDevice.SetAntialiasing(nSavedAntialiasingMode | ANTIALIASING_ENABLE_B2DDRAW);
+
+ rDevice.SetLineColor();
+
+ // Choose icon.
+ BitmapEx aIcon;
+ switch (meState)
+ {
+ case ST_Normal:
+ if (mbIsSmall)
+ aIcon = maSmallIcon;
+ else
+ aIcon = maNormalIcon;
+ break;
+
+ case ST_Hover:
+ if (mbIsSmall)
+ aIcon = maSmallHoverIcon;
+ else
+ aIcon = maHoverIcon;
+ break;
+
+ case ST_Down:
+ if (mbIsSmall)
+ aIcon = maSmallDownIcon;
+ else
+ aIcon = maDownIcon;
+ break;
+ }
+
+ // Paint icon.
+ if ( ! aIcon.IsEmpty())
+ {
+ AlphaMask aMask (aIcon.GetMask());
+ AdaptTransparency(aMask, 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
+{
+ if (mbIsSmall)
+ return maSmallIcon.GetSizePixel();
+ else
+ return maNormalIcon.GetSizePixel();
+}
+
+
+
+
+//===== UnhideButton ==========================================================
+
+UnhideButton::UnhideButton (SlideSorter& rSlideSorter)
+ : TextButton(
+ rSlideSorter,
+ rSlideSorter.GetTheme()->GetString(Theme::String_Unhide),
+ rSlideSorter.GetTheme()->GetString(Theme::String_Command2))
+{
+}
+
+
+
+
+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_Command1Regular),
+ rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command1Hover),
+ BitmapEx(),
+ rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command1Small),
+ rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command1SmallHover),
+ BitmapEx(),
+ rSlideSorter.GetTheme()->GetString(Theme::String_Command1))
+{
+}
+
+
+
+
+void StartShowButton::ProcessClick (const model::SharedPageDescriptor& rpDescriptor)
+{
+ mrSlideSorter.GetController().GetCurrentSlideManager()->SwitchCurrentSlide(
+ rpDescriptor);
+ if (mrSlideSorter.GetViewShell() != NULL
+ && mrSlideSorter.GetViewShell()->GetDispatcher() != NULL)
+ {
+ mrSlideSorter.GetViewShell()->GetDispatcher()->Execute(
+ SID_PRESENTATION,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+ }
+}
+
+
+
+
+//===== HideButton ============================================================
+
+HideButton::HideButton (SlideSorter& rSlideSorter)
+ : ImageButton(
+ rSlideSorter,
+ rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2Regular),
+ rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2Hover),
+ BitmapEx(),
+ rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2Small),
+ rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command2SmallHover),
+ BitmapEx(),
+ 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_Command3Regular),
+ rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command3Hover),
+ BitmapEx(),
+ rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command3Small),
+ rSlideSorter.GetTheme()->GetIcon(Theme::Icon_Command3Small),
+ BitmapEx(),
+ rSlideSorter.GetTheme()->GetString(Theme::String_Command3))
+{
+}
+
+
+
+
+void DuplicateButton::ProcessClick (const model::SharedPageDescriptor& rpDescriptor)
+{
+ if ( ! rpDescriptor)
+ return;
+
+ // 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()->Execute(
+ SID_DUPLICATE_PAGE,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+}
+
+
+
+
+
+} } } // end of namespace ::sd::slidesorter::view
diff --git a/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx b/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx
index aaa8cf5d6d18..27c2c3c72721 100644
--- a/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx
+++ b/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx
@@ -41,7 +41,7 @@
#include <set>
#include <boost/bind.hpp>
-
+#include <boost/enable_shared_from_this.hpp>
namespace sd { namespace slidesorter { namespace view {
@@ -52,7 +52,8 @@ class PageObjectRun;
class AnimatorAccess
{
public:
- virtual void RemoveRun (PageObjectRun* pRun) = 0;
+ 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;
@@ -62,7 +63,7 @@ public:
/** Controller of the position offsets of all page objects in one row or one
column.
*/
-class PageObjectRun
+class PageObjectRun : public ::boost::enable_shared_from_this<PageObjectRun>
{
public:
PageObjectRun (
@@ -138,7 +139,8 @@ public:
const InsertPosition& rInsertPosition,
const controller::Animator::AnimationMode eAnimationMode);
- virtual void RemoveRun (PageObjectRun* pRun);
+ 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; }
@@ -228,16 +230,12 @@ void InsertAnimator::Implementation::SetInsertPosition (
if (pOldRun != pCurrentRun)
{
if (pOldRun)
- {
pOldRun->ResetOffsets(eMode);
- maRuns.insert(pOldRun);
- }
}
if (pCurrentRun)
{
pCurrentRun->UpdateOffsets(rInsertPosition, mrView.GetLayouter());
- maRuns.insert(pCurrentRun);
}
}
@@ -309,17 +307,40 @@ InsertAnimator::Implementation::RunContainer::iterator
-void InsertAnimator::Implementation::RemoveRun (PageObjectRun* pRun)
+void InsertAnimator::Implementation::AddRun (const ::boost::shared_ptr<PageObjectRun> pRun)
{
- if (pRun != NULL)
+ 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)
- maRuns.erase(FindRun(pRun->mnRunIndex));
+ {
+ InsertAnimator::Implementation::RunContainer::iterator iRun (FindRun(pRun->mnRunIndex));
+ if (iRun != maRuns.end())
+ {
+ OSL_ASSERT(*iRun == pRun);
+ maRuns.erase(iRun);
+ }
+ }
}
else
{
- OSL_ASSERT(pRun!=NULL);
+ OSL_ASSERT(pRun);
}
}
@@ -436,6 +457,8 @@ void PageObjectRun::ResetOffsets (const controller::Animator::AnimationMode eMod
}
if (eMode == controller::Animator::AM_Animated)
RestartAnimation();
+ else
+ mrAnimatorAccess.RemoveRun(shared_from_this());
}
@@ -450,11 +473,15 @@ void PageObjectRun::RestartAnimation (void)
}
// Restart the animation.
+ mrAnimatorAccess.AddRun(shared_from_this());
mnAnimationId = mrAnimatorAccess.GetAnimator()->AddAnimation(
::boost::ref(*this),
0,
300,
- ::boost::bind(&AnimatorAccess::RemoveRun, ::boost::ref(mrAnimatorAccess), this));
+ ::boost::bind(
+ &AnimatorAccess::RemoveRun,
+ ::boost::ref(mrAnimatorAccess),
+ shared_from_this()));
}
@@ -475,6 +502,8 @@ void PageObjectRun::operator () (const double nGlobalTime)
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(
diff --git a/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx b/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx
index f368dff59555..ad1282624572 100644
--- a/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx
+++ b/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx
@@ -204,7 +204,8 @@ void LayeredDevice::RegisterPainter (
const SharedILayerPainter& rpPainter,
const sal_Int32 nLayer)
{
- OSL_TRACE("layered device registering painter at %x", this);
+ OSL_TRACE("layered device at %x registering painter %x at layer %d",
+ this, rpPainter.get(), nLayer);
OSL_ASSERT(mpLayers);
if ( ! rpPainter)
{
@@ -242,6 +243,8 @@ void LayeredDevice::RemovePainter (
const SharedILayerPainter& rpPainter,
const sal_Int32 nLayer)
{
+ OSL_TRACE("layered device at %x removing painter %x from layer %d",
+ this, rpPainter.get(), nLayer);
if ( ! rpPainter)
{
OSL_ASSERT(rpPainter);
@@ -359,7 +362,6 @@ bool LayeredDevice::HandleMapModeChange (void)
aLogicWindowBox.TopLeft(),
mpTargetWindow->PixelToLogic(Point(0,0), maSavedMapMode),
aLogicWindowBox.GetSize());
- OSL_TRACE("scrolling %d %d", aDelta.X(), aDelta.Y());
// Invalidate the area(s) that have been exposed.
const Rectangle aWindowBox (Point(0,0), mpTargetWindow->GetSizePixel());
diff --git a/sd/source/ui/slidesorter/view/SlsLayouter.cxx b/sd/source/ui/slidesorter/view/SlsLayouter.cxx
index ea660062ae5c..dac2b20647c8 100644
--- a/sd/source/ui/slidesorter/view/SlsLayouter.cxx
+++ b/sd/source/ui/slidesorter/view/SlsLayouter.cxx
@@ -194,7 +194,10 @@ public:
Range GetValidVerticalSizeRange (void) const;
Range GetRangeOfVisiblePageObjects (const Rectangle& aVisibleArea) const;
- sal_Int32 GetIndex (const sal_Int32 nRow, const sal_Int32 nColumn) const;
+ sal_Int32 GetIndex (
+ const sal_Int32 nRow,
+ const sal_Int32 nColumn,
+ const bool bClampToValidRange) const;
Rectangle GetPageObjectBox (
const sal_Int32 nIndex,
@@ -452,7 +455,7 @@ sal_Int32 Layouter::GetColumn (const sal_Int32 nIndex) const
sal_Int32 Layouter::GetIndex (const sal_Int32 nRow, const sal_Int32 nColumn) const
{
- return mpImplementation->GetIndex(nRow,nColumn);
+ return mpImplementation->GetIndex(nRow,nColumn,true);
}
@@ -538,7 +541,8 @@ Range Layouter::GetRangeOfVisiblePageObjects (const Rectangle& aVisibleArea) con
sal_Int32 Layouter::GetIndexAtPoint (
const Point& rPosition,
- const bool bIncludePageBorders) const
+ const bool bIncludePageBorders,
+ const bool bClampToValidRange) const
{
const sal_Int32 nRow (
mpImplementation->GetRowAtPosition (
@@ -551,7 +555,7 @@ sal_Int32 Layouter::GetIndexAtPoint (
bIncludePageBorders,
bIncludePageBorders ? Implementation::GM_PAGE_BORDER : Implementation::GM_NONE));
- return mpImplementation->GetIndex(nRow,nColumn);
+ return mpImplementation->GetIndex(nRow,nColumn,bClampToValidRange);
}
@@ -1004,7 +1008,7 @@ Range Layouter::Implementation::GetRangeOfVisiblePageObjects (const Rectangle& a
// 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), GetIndex(nRow1,nCol1));
+ return Range(GetIndex(nRow0,nCol0,true), GetIndex(nRow1,nCol1,true));
}
@@ -1060,13 +1064,24 @@ Size Layouter::Implementation::GetTargetSize (
-sal_Int32 Layouter::Implementation::GetIndex (const sal_Int32 nRow, const sal_Int32 nColumn) const
+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);
- return ::std::min(nIndex, mnPageCount-1);
+ if (nIndex >= mnPageCount)
+ if (bClampToValidRange)
+ return mnPageCount-1;
+ else
+ return -1;
+ else
+ return nIndex;
}
+ else if (bClampToValidRange)
+ return 0;
else
return -1;
}
diff --git a/sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx b/sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx
index faab407da0de..2b2ed8daa24a 100644
--- a/sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx
+++ b/sd/source/ui/slidesorter/view/SlsPageObjectLayouter.cxx
@@ -64,7 +64,6 @@ PageObjectLayouter::PageObjectLayouter (
maPageNumberAreaBoundingBox(),
maPreviewBoundingBox(),
maTransitionEffectBoundingBox(),
- maWideButtonBoundingBox(),
maTransitionEffectIcon(IconCache::Instance().GetIcon(BMP_FADE_EFFECT_INDICATOR)),
mpPageNumberFont(Theme::GetFont(Theme::PageNumberFont, *rpWindow))
{
@@ -99,15 +98,6 @@ PageObjectLayouter::PageObjectLayouter (
(maPreviewBoundingBox.Left() - aIconSize.Width()) / 2,
maPreviewBoundingBox.Bottom() - aIconSize.Height()),
aIconSize);
-
- // The wide "unhide" button is placed at the lower edge of the preview.
- // Add 1 pixel at the sides to compensate for the missing border around
- // the button.
- maWideButtonBoundingBox = Rectangle(
- maPreviewBoundingBox.Left() - 1,
- maPreviewBoundingBox.Bottom() - gaButtonSize.Height() - 1,
- maPreviewBoundingBox.Right() + 1,
- maPreviewBoundingBox.Bottom() + 1);
}
@@ -183,12 +173,11 @@ Rectangle PageObjectLayouter::CalculatePreviewBoundingBox (
Rectangle PageObjectLayouter::GetBoundingBox (
const model::SharedPageDescriptor& rpPageDescriptor,
const Part ePart,
- const CoordinateSystem eCoordinateSystem,
- const sal_Int32 nIndex)
+ const CoordinateSystem eCoordinateSystem)
{
OSL_ASSERT(rpPageDescriptor);
Point aLocation (rpPageDescriptor ? rpPageDescriptor->GetLocation() : Point(0,0));
- return GetBoundingBox(aLocation, ePart, eCoordinateSystem, nIndex);
+ return GetBoundingBox(aLocation, ePart, eCoordinateSystem);
}
@@ -197,8 +186,7 @@ Rectangle PageObjectLayouter::GetBoundingBox (
Rectangle PageObjectLayouter::GetBoundingBox (
const Point& rPageObjectLocation,
const Part ePart,
- const CoordinateSystem eCoordinateSystem,
- const sal_Int32 nIndex)
+ const CoordinateSystem eCoordinateSystem)
{
Rectangle aBoundingBox;
switch (ePart)
@@ -227,19 +215,6 @@ Rectangle PageObjectLayouter::GetBoundingBox (
case TransitionEffectIndicator:
aBoundingBox = maTransitionEffectBoundingBox;
break;
-
- case WideButton:
- aBoundingBox = maWideButtonBoundingBox;
- break;
-
- case Button:
- aBoundingBox = Rectangle(
- maPreviewBoundingBox.BottomRight()
- - Point(
- (nIndex+1)*gaButtonSize.Width() + nIndex*gnButtonGap,
- gaButtonSize.Height()),
- gaButtonSize);
- break;
}
// Adapt coordinates to the requested coordinate system.
@@ -312,37 +287,4 @@ Image PageObjectLayouter::GetTransitionEffectIcon (void) const
}
-
-
-sal_Int32 PageObjectLayouter::GetButtonIndexAt (
- const model::SharedPageDescriptor& rpPageDescriptor,
- const Point& rWindowLocation)
-{
- if ( ! GetBoundingBox(rpPageDescriptor, Preview, ModelCoordinateSystem)
- .IsInside(rWindowLocation))
- {
- return -1;
- }
- if (rpPageDescriptor->HasState(model::PageDescriptor::ST_Excluded))
- {
- if (GetBoundingBox(rpPageDescriptor, WideButton, ModelCoordinateSystem)
- .IsInside(rWindowLocation))
- {
- return ShowHideButtonIndex;
- }
- }
- else
- {
- for (sal_Int32 nIndex=0; nIndex<3; ++nIndex)
- {
- if (GetBoundingBox(rpPageDescriptor, Button, ModelCoordinateSystem, nIndex)
- .IsInside(rWindowLocation))
- {
- return nIndex;
- }
- }
- }
- return -1;
-}
-
} } } // end of namespace ::sd::slidesorter::view
diff --git a/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx b/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx
index b0c1bfc5828b..dfad7d3861d4 100644
--- a/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx
+++ b/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx
@@ -42,21 +42,18 @@
#include "view/SlsPageObjectLayouter.hxx"
#include "view/SlsLayouter.hxx"
#include "view/SlsTheme.hxx"
+#include "view/SlsButton.hxx"
#include "SlsFramePainter.hxx"
#include "cache/SlsPageCache.hxx"
#include "controller/SlsProperties.hxx"
#include "Window.hxx"
#include "sdpage.hxx"
#include "sdresid.hxx"
-#include <basegfx/polygon/b2dpolygontools.hxx>
-#include <basegfx/polygon/b2dpolygon.hxx>
#include <vcl/svapp.hxx>
#include <vcl/vclenum.hxx>
-#include <vcl/bmpacc.hxx>
#include <vcl/virdev.hxx>
using namespace ::drawinglayer::primitive2d;
-using namespace ::basegfx;
namespace sd { namespace slidesorter { namespace view {
@@ -103,29 +100,6 @@ sal_uInt8 CalculateColorChannel(
-void AdaptTransparency (AlphaMask& rMask, const double nAlpha)
-{
- BitmapWriteAccess* pBitmap = rMask.AcquireWriteAccess();
-
- if (pBitmap != NULL)
- {
- const sal_Int32 nWidth (pBitmap->Width());
- const sal_Int32 nHeight (pBitmap->Height());
-
- const BitmapColor aWhite (255,255,255);
- for (sal_Int32 nY = 0; nY<nHeight; ++nY)
- for (sal_Int32 nX = 0; nX<nWidth; ++nX)
- {
- const BYTE nValue (255 - pBitmap->GetPixel(nY, nX).GetBlueOrIndex());
- const BYTE nNewValue (nValue * (1-nAlpha));
- pBitmap->SetPixel(
- nY,
- nX,
- 255-nNewValue);
- }
- }
-}
-
} // end of anonymous namespace
@@ -141,15 +115,13 @@ PageObjectPainter::PageObjectPainter (
mpProperties(rSlideSorter.GetProperties()),
mpTheme(rSlideSorter.GetTheme()),
mpPageNumberFont(Theme::GetFont(Theme::PageNumberFont, *rSlideSorter.GetContentWindow())),
- maStartPresentationIcon(mpTheme->GetIcon(Theme::Icon_StartPresentation)),
- maShowSlideIcon(mpTheme->GetIcon(Theme::Icon_ShowSlide)),
- maNewSlideIcon(mpTheme->GetIcon(Theme::Icon_DuplicateSlide)),
mpShadowPainter(new FramePainter(mpTheme->GetIcon(Theme::Icon_RawShadow))),
maNormalBackground(),
maSelectionBackground(),
maFocusedSelectionBackground(),
maMouseOverBackground(),
- msUnhideString(mpTheme->GetString(Theme::String_Unhide))
+ msUnhideString(mpTheme->GetString(Theme::String_Unhide)),
+ mrButtonBar(rSlideSorter.GetView().GetButtonBar())
{
}
@@ -176,8 +148,6 @@ void PageObjectPainter::PaintPageObject (
return;
}
- PrepareBackgrounds(rDevice);
-
// Turn off antialiasing to avoid the bitmaps from being shifted by
// fractions of a pixel and thus show blurry edges.
const USHORT nSavedAntialiasingMode (rDevice.GetAntialiasing());
@@ -187,7 +157,7 @@ void PageObjectPainter::PaintPageObject (
PaintPreview(rDevice, rpDescriptor);
PaintPageNumber(rDevice, rpDescriptor);
PaintTransitionEffect(rDevice, rpDescriptor);
- PaintButtons(rDevice, rpDescriptor);
+ mrButtonBar.Paint(rDevice, rpDescriptor);
rDevice.SetAntialiasing(nSavedAntialiasingMode);
}
@@ -197,15 +167,13 @@ void PageObjectPainter::PaintPageObject (
void PageObjectPainter::NotifyResize (const bool bForce)
{
- if ( ! mpPageObjectLayouter
- || bForce
- || mpPageObjectLayouter->GetPageObjectSize() != maNewSlideIcon.GetSizePixel())
- {
- maNormalBackground.SetEmpty();
- maSelectionBackground.SetEmpty();
- maFocusedSelectionBackground.SetEmpty();
- maMouseOverBackground.SetEmpty();
- }
+ (void)bForce;
+ maNormalBackground.SetEmpty();
+ maSelectionBackground.SetEmpty();
+ maFocusedSelectionBackground.SetEmpty();
+ maFocusedBackground.SetEmpty();
+ maMouseOverBackground.SetEmpty();
+ maMouseOverSelectedAndFocusedBackground.SetEmpty();
}
@@ -222,38 +190,15 @@ void PageObjectPainter::SetTheme (const ::boost::shared_ptr<view::Theme>& rpThem
void PageObjectPainter::PaintBackground (
OutputDevice& rDevice,
- const model::SharedPageDescriptor& rpDescriptor) const
+ const model::SharedPageDescriptor& rpDescriptor)
{
const Rectangle aBox (mpPageObjectLayouter->GetBoundingBox(
rpDescriptor,
PageObjectLayouter::PageObject,
PageObjectLayouter::ModelCoordinateSystem));
- if (rpDescriptor->HasState(model::PageDescriptor::ST_MouseOver))
- {
- rDevice.DrawBitmap(
- aBox.TopLeft(),
- maMouseOverBackground);
- }
- else if (rpDescriptor->HasState(model::PageDescriptor::ST_Selected))
- {
- if (rpDescriptor->HasState(model::PageDescriptor::ST_Focused))
- rDevice.DrawBitmap(
- aBox.TopLeft(),
- maFocusedSelectionBackground);
- else
- rDevice.DrawBitmap(
- aBox.TopLeft(),
- maSelectionBackground);
- }
- else
- {
- rDevice.DrawBitmap(
- aBox.TopLeft(),
- maNormalBackground);
- if (rpDescriptor->HasState(model::PageDescriptor::ST_Focused))
- PaintBorder(rDevice, Theme::SelectedPage, aBox);
- }
+ const Bitmap& rBackground (GetBackgroundForState(rpDescriptor, rDevice));
+ rDevice.DrawBitmap(aBox.TopLeft(), rBackground);
}
@@ -268,40 +213,65 @@ void PageObjectPainter::PaintPreview (
PageObjectLayouter::Preview,
PageObjectLayouter::ModelCoordinateSystem));
+ const bool bIsExcluded (rpDescriptor->GetVisualState().GetCurrentVisualState()
+ == model::VisualState::VS_Excluded);
+ bool bIsOverlayPaintRequested (bIsExcluded);
+
if (mpCache != NULL)
{
const SdrPage* pPage = rpDescriptor->GetPage();
mpCache->SetPreciousFlag(pPage, true);
- const Bitmap aBitmap (mpCache->GetPreviewBitmap(pPage,false).GetBitmap());
- if (aBitmap.GetSizePixel() != aBox.GetSize())
+ if (bIsExcluded)
{
- rDevice.DrawBitmap(aBox.TopLeft(), aBox.GetSize(), aBitmap);
+ Bitmap aMarkedPreview (mpCache->GetMarkedPreviewBitmap(pPage,false).GetBitmap());
+ if (aMarkedPreview.IsEmpty() || aMarkedPreview.GetSizePixel()!=aBox.GetSize())
+ {
+ aMarkedPreview = CreateMarkedPreview(
+ aBox.GetSize(),
+ mpCache->GetPreviewBitmap(pPage,true),
+ mpTheme->GetIcon(Theme::Icon_HideSlideOverlay),
+ rDevice);
+ mpCache->SetMarkedPreviewBitmap(pPage, cache::PreviewType::Create(aMarkedPreview));
+ }
+ rDevice.DrawBitmap(aBox.TopLeft(), aMarkedPreview);
}
else
{
- rDevice.DrawBitmap(aBox.TopLeft(), aBitmap);
+ const Bitmap aPreview (mpCache->GetPreviewBitmap(pPage,false).GetBitmap());
+ if ( ! aPreview.IsEmpty())
+ if (aPreview.GetSizePixel() != aBox.GetSize())
+ rDevice.DrawBitmap(aBox.TopLeft(), aBox.GetSize(), aPreview);
+ else
+ rDevice.DrawBitmap(aBox.TopLeft(), aPreview);
}
}
+}
- if (rpDescriptor->GetVisualState().GetCurrentVisualState()
- == model::VisualState::VS_Excluded)
- {
- const BitmapEx aOverlay (mpTheme->GetIcon(Theme::Icon_HideSlideOverlay));
- const sal_Int32 nIconWidth (aOverlay.GetSizePixel().Width());
- const sal_Int32 nIconHeight (aOverlay.GetSizePixel().Height());
- if (nIconWidth>0 && nIconHeight>0)
- {
- const Region aSavedClip (rDevice.GetClipRegion());
- rDevice.IntersectClipRegion(aBox);
- for (sal_Int32 nX=aBox.Left(); nX<aBox.Right(); nX+=nIconWidth)
- for (sal_Int32 nY=aBox.Top(); nY<aBox.Bottom(); nY+=nIconHeight)
- rDevice.DrawBitmapEx(Point(nX,nY), aOverlay);
- rDevice.SetClipRegion(aSavedClip);
- }
+
+Bitmap PageObjectPainter::CreateMarkedPreview (
+ const Size& rSize,
+ const cache::PreviewType& rPreview,
+ const BitmapEx& rOverlay,
+ const OutputDevice& rReferenceDevice) const
+{
+ VirtualDevice aDevice (rReferenceDevice);
+ aDevice.SetOutputSizePixel(rSize);
+
+ aDevice.DrawBitmap(Point(0,0), rSize, rPreview.GetBitmap());
+
+ // 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)
+ aDevice.DrawBitmapEx(Point(nX,nY), rOverlay);
}
+ return aDevice.GetBitmap(Point(0,0), rSize);
}
@@ -323,23 +293,6 @@ void PageObjectPainter::PaintPageNumber (
rDevice.SetFont(*mpPageNumberFont);
rDevice.SetTextColor(Color(mpTheme->GetColor(Theme::PageNumberColor)));
rDevice.DrawText(aBox, sPageNumber, TEXT_DRAW_RIGHT | TEXT_DRAW_VCENTER);
-
-#if 0
- if (rpDescriptor->GetVisualState().GetCurrentVisualState()
- == model::VisualState::VS_Excluded)
- {
- // Paint border around the number.
- const Rectangle aFrameBox (mpPageObjectLayouter->GetBoundingBox(
- rpDescriptor,
- PageObjectLayouter::PageNumberFrame,
- PageObjectLayouter::ModelCoordinateSystem));
- rDevice.SetLineColor(Color(mpTheme->GetColor(Theme::PageNumberBorder)));
- rDevice.SetFillColor();
- rDevice.DrawRect(aFrameBox);
-
- rDevice.DrawLine(aFrameBox.TopLeft(), aBox.BottomRight());
- }
-#endif
}
@@ -366,272 +319,63 @@ void PageObjectPainter::PaintTransitionEffect (
-void PageObjectPainter::PaintButtons (
- OutputDevice& rDevice,
- const model::SharedPageDescriptor& rpDescriptor) const
-{
- if (rpDescriptor->HasState(model::PageDescriptor::ST_Excluded))
- PaintWideButton(rDevice, rpDescriptor);
- else
- if (mpTheme->GetIntegerValue(Theme::ButtonPaintType) == 0)
- PaintButtonsType0(rDevice, rpDescriptor);
- else
- PaintButtonsType1(rDevice, rpDescriptor);
-}
-
-
-
-
-void PageObjectPainter::PaintButtonsType0 (
- OutputDevice& rDevice,
- const model::SharedPageDescriptor& rpDescriptor) const
-{
- if (rpDescriptor->GetVisualState().GetButtonAlpha() >= 1)
- return;
-
- const USHORT nSavedAntialiasingMode (rDevice.GetAntialiasing());
- rDevice.SetAntialiasing(nSavedAntialiasingMode | ANTIALIASING_ENABLE_B2DDRAW);
-
- rDevice.SetLineColor();
-
- const double nCornerRadius(mpTheme->GetIntegerValue(Theme::ButtonCornerRadius));
- for (int nButtonIndex=0; nButtonIndex<3; ++nButtonIndex)
- {
- Color aButtonFillColor (mpTheme->GetColor(Theme::ButtonBackground));
- const Rectangle aBox (
- mpPageObjectLayouter->GetBoundingBox(
- rpDescriptor,
- PageObjectLayouter::Button,
- PageObjectLayouter::ModelCoordinateSystem,
- nButtonIndex));
-
- switch (rpDescriptor->GetVisualState().GetButtonState(nButtonIndex))
- {
- case model::VisualState::BS_Normal:
- break;
-
- case model::VisualState::BS_MouseOver:
- aButtonFillColor.IncreaseLuminance(50);
- break;
-
- case model::VisualState::BS_Pressed:
- aButtonFillColor.DecreaseLuminance(50);
- break;
- }
- rDevice.SetFillColor(aButtonFillColor);
- rDevice.DrawTransparent(
- ::basegfx::B2DPolyPolygon(
- ::basegfx::tools::createPolygonFromRect(
- ::basegfx::B2DRectangle(aBox.Left(), aBox.Top(), aBox.Right(), aBox.Bottom()),
- nCornerRadius/aBox.GetWidth(),
- nCornerRadius/aBox.GetHeight())),
- rpDescriptor->GetVisualState().GetButtonAlpha());
-
- // Choose icon.
- const BitmapEx* pImage = NULL;
- switch (nButtonIndex)
- {
- case 0:
- pImage = &maNewSlideIcon;
- break;
- case 1:
- pImage = &maShowSlideIcon;
- break;
- case 2:
- pImage = &maStartPresentationIcon;
- break;
- }
- // Paint icon over the button background.
- if (pImage != NULL)
- {
- AlphaMask aMask (pImage->GetMask());
- AdaptTransparency(
- aMask,
- rpDescriptor->GetVisualState().GetButtonAlpha());
- rDevice.DrawImage(
- Point(
- aBox.Left()+(aBox.GetWidth()-pImage->GetSizePixel().Width())/2,
- aBox.Top()+(aBox.GetHeight()-pImage->GetSizePixel().Height())/2),
- BitmapEx(pImage->GetBitmap(), aMask));
- }
- }
-
- rDevice.SetAntialiasing(nSavedAntialiasingMode);
-}
-
-
-
-
-void PageObjectPainter::PaintButtonsType1 (
- OutputDevice& rDevice,
- const model::SharedPageDescriptor& rpDescriptor) const
-{
- if (rpDescriptor->GetVisualState().GetButtonAlpha() >= 1)
- return;
-
- const USHORT nSavedAntialiasingMode (rDevice.GetAntialiasing());
- rDevice.SetAntialiasing(nSavedAntialiasingMode | ANTIALIASING_ENABLE_B2DDRAW);
-
- rDevice.SetLineColor();
-
- // Determine state for the background.
- model::VisualState::ButtonState eState (model::VisualState::BS_Normal);
- for (int nButtonIndex=0; nButtonIndex<3; ++nButtonIndex)
- {
- const model::VisualState::ButtonState eButtonState (
- rpDescriptor->GetVisualState().GetButtonState(nButtonIndex));
- if (eButtonState != model::VisualState::BS_Normal)
- {
- eState = eButtonState;
- break;
- }
- }
-
- // Paint the button background with the state of the button under the mouse.
- PaintWideButtonBackground(rDevice, rpDescriptor, eState);
-
- // Paint the icons.
- for (int nButtonIndex=0; nButtonIndex<3; ++nButtonIndex)
- {
- const Rectangle aBox (
- mpPageObjectLayouter->GetBoundingBox(
- rpDescriptor,
- PageObjectLayouter::Button,
- PageObjectLayouter::ModelCoordinateSystem,
- nButtonIndex));
-
- // Choose icon.
- const BitmapEx* pImage = NULL;
- switch (nButtonIndex)
- {
- case 0:
- pImage = &maNewSlideIcon;
- break;
- case 1:
- pImage = &maShowSlideIcon;
- break;
- case 2:
- pImage = &maStartPresentationIcon;
- break;
- }
-
- // Adjust luminosity of icon to indicate its state.
- Bitmap aIcon (pImage->GetBitmap());
- switch (rpDescriptor->GetVisualState().GetButtonState(nButtonIndex))
- {
- case model::VisualState::BS_Normal:
- break;
-
- case model::VisualState::BS_MouseOver:
- aIcon.Adjust(+30);
- break;
-
- case model::VisualState::BS_Pressed:
- aIcon.Adjust(-30);
- break;
- }
-
- // Paint icon over the button background.
- if (pImage != NULL)
- {
- AlphaMask aMask (pImage->GetMask());
- AdaptTransparency(
- aMask,
- rpDescriptor->GetVisualState().GetButtonAlpha());
- rDevice.DrawImage(
- Point(
- aBox.Left()+(aBox.GetWidth()-pImage->GetSizePixel().Width())/2,
- aBox.Top()+(aBox.GetHeight()-pImage->GetSizePixel().Height())/2),
- BitmapEx(aIcon, aMask));
- }
- }
-
- rDevice.SetAntialiasing(nSavedAntialiasingMode);
-}
-
-
-
-
-Rectangle PageObjectPainter::PaintWideButtonBackground (
- OutputDevice& rDevice,
+Bitmap& PageObjectPainter::GetBackgroundForState (
const model::SharedPageDescriptor& rpDescriptor,
- const model::VisualState::ButtonState eState) const
+ const OutputDevice& rReferenceDevice)
{
- const Rectangle aBox (
- mpPageObjectLayouter->GetBoundingBox(
- rpDescriptor,
- PageObjectLayouter::WideButton,
- PageObjectLayouter::ModelCoordinateSystem));
- if (rpDescriptor->GetVisualState().GetButtonAlpha() < 1)
- {
- const USHORT nSavedAntialiasingMode (rDevice.GetAntialiasing());
- rDevice.SetAntialiasing(nSavedAntialiasingMode | ANTIALIASING_ENABLE_B2DDRAW);
+ const bool bIsSelected (rpDescriptor->HasState(model::PageDescriptor::ST_Selected));
+ const bool bIsMouseOver (rpDescriptor->HasState(model::PageDescriptor::ST_MouseOver));
+ const bool bIsFocused (rpDescriptor->HasState(model::PageDescriptor::ST_Focused));
- // Determine background color.
- Color aButtonFillColor (mpTheme->GetColor(Theme::ButtonBackground));
- switch (eState)
- {
- case model::VisualState::BS_Normal:
- break;
-
- case model::VisualState::BS_MouseOver:
- aButtonFillColor.IncreaseLuminance(50);
- break;
-
- case model::VisualState::BS_Pressed:
- aButtonFillColor.DecreaseLuminance(50);
- break;
- }
- rDevice.SetFillColor(aButtonFillColor);
- rDevice.SetLineColor();
-
- const double nCornerRadius(mpTheme->GetIntegerValue(Theme::ButtonCornerRadius));
- rDevice.DrawTransparent(
- ::basegfx::B2DPolyPolygon(
- ::basegfx::tools::createPolygonFromRect(
- ::basegfx::B2DRectangle(aBox.Left(), aBox.Top(), aBox.Right(), aBox.Bottom()),
- nCornerRadius/aBox.GetWidth(),
- nCornerRadius/aBox.GetHeight())),
- rpDescriptor->GetVisualState().GetButtonAlpha());
-
- rDevice.SetAntialiasing(nSavedAntialiasingMode);
+ if (bIsMouseOver)
+ {
+ if (bIsSelected && bIsFocused)
+ return GetBackground(
+ maMouseOverSelectedAndFocusedBackground,
+ Theme::Gradient_MouseOverSelectedAndFocusedPage,
+ rReferenceDevice);
+ else
+ return GetBackground(
+ maMouseOverBackground,
+ Theme::Gradient_MouseOverPage,
+ rReferenceDevice);
}
- return aBox;
-}
-
-
-
-
-void PageObjectPainter::PaintWideButton (
- OutputDevice& rDevice,
- const model::SharedPageDescriptor& rpDescriptor) const
-{
- const Rectangle aButtonBox (PaintWideButtonBackground(
- rDevice,
- rpDescriptor,
- rpDescriptor->GetVisualState().GetButtonState(PageObjectLayouter::ShowHideButtonIndex)));
-
- // Paint text over the button background.
- if (rpDescriptor->GetVisualState().GetButtonAlpha() < 1)
+ else if (bIsSelected)
{
- rDevice.SetTextColor(mpTheme->GetColor(Theme::ButtonText));
- rDevice.DrawText(aButtonBox, msUnhideString, TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER);
+ if (bIsFocused)
+ return GetBackground(
+ maFocusedSelectionBackground,
+ Theme::Gradient_SelectedAndFocusedPage,
+ rReferenceDevice);
+ else
+ return GetBackground(
+ maSelectionBackground,
+ Theme::Gradient_SelectedPage,
+ rReferenceDevice);
}
+ else if (bIsFocused)
+ return GetBackground(
+ maFocusedBackground,
+ Theme::Gradient_FocusedPage,
+ rReferenceDevice);
+ else
+ return GetBackground(
+ maNormalBackground,
+ Theme::Gradient_NormalPage,
+ rReferenceDevice);
}
-void PageObjectPainter::PrepareBackgrounds (OutputDevice& rDevice)
+Bitmap& PageObjectPainter::GetBackground(
+ Bitmap& rBackground,
+ Theme::GradientColorType eType,
+ const OutputDevice& rReferenceDevice)
{
- if (maNormalBackground.IsEmpty())
- {
- maNormalBackground = CreateBackgroundBitmap(rDevice, Theme::NormalPage);
- maSelectionBackground = CreateBackgroundBitmap(rDevice, Theme::SelectedPage);
- maFocusedSelectionBackground = CreateBackgroundBitmap(
- rDevice, Theme::SelectedAndFocusedPage);
- maMouseOverBackground = CreateBackgroundBitmap(rDevice, Theme::MouseOverPage);
- }
+ if (rBackground.IsEmpty())
+ rBackground = CreateBackgroundBitmap(rReferenceDevice, eType);
+ return rBackground;
}
diff --git a/sd/source/ui/slidesorter/view/SlsResource.src b/sd/source/ui/slidesorter/view/SlsResource.src
index 87e6c02356f2..c996d657c59a 100644
--- a/sd/source/ui/slidesorter/view/SlsResource.src
+++ b/sd/source/ui/slidesorter/view/SlsResource.src
@@ -30,23 +30,131 @@
#include "view/SlsResource.hrc"
-Resource IMG_ICONS
+Resource RID_SLIDESORTER_ICONS
{
- Image IMAGE_PRESENTATION
+ Image IMAGE_COMMAND1_REGULAR
{
ImageBitmap = Bitmap { File = "slide_sorter_command1.png" ; };
};
- Image IMAGE_SHOW_SLIDE
+ Image IMAGE_COMMAND1_HOVER
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command1_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_REGULAR_HC
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command1_hc.png" ; };
+ };
+
+ Image IMAGE_COMMAND1_HOVER_HC
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command1_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_REGULAR
{
ImageBitmap = Bitmap { File = "slide_sorter_command2.png" ; };
};
- Image IMAGE_NEW_SLIDE
+ Image IMAGE_COMMAND2_HOVER
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command2_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_REGULAR_HC
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command2_hc.png" ; };
+ };
+
+ Image IMAGE_COMMAND2_HOVER_HC
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command2_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_COMMAND3_REGULAR
{
ImageBitmap = Bitmap { File = "slide_sorter_command3.png" ; };
};
+ Image IMAGE_COMMAND3_HOVER
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command3_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_REGULAR_HC
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command3_hc.png" ; };
+ };
+
+ Image IMAGE_COMMAND3_HOVER_HC
+ {
+ ImageBitmap = Bitmap { File = "slide_sorter_command3_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_SHADOW
{
ImageBitmap = Bitmap { File = "slide_sorter_shadow.png" ; };
@@ -76,4 +184,19 @@ Resource IMG_ICONS
{
Text [ en-US ] = "Drag and Drop Slides" ;
};
+
+ String STRING_COMMAND1
+ {
+ Text [ en-US ] = "Start Slide Show" ;
+ };
+
+ String STRING_COMMAND2
+ {
+ Text [ en-US ] = "Show/Hide 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
index 3ffc1bba7230..e5d54e400cd0 100644
--- a/sd/source/ui/slidesorter/view/SlsTheme.cxx
+++ b/sd/source/ui/slidesorter/view/SlsTheme.cxx
@@ -43,6 +43,9 @@
namespace sd { namespace slidesorter { namespace view {
+// Grays
+#define Black 0x000000
+
// Reds
#define Amber 0xff7e00
@@ -80,53 +83,59 @@ ColorData ChangeLuminance (const ColorData aColorData, const int nValue)
return aColor.GetColor();
}
+ColorData HGBAdapt (
+ const ColorData aColorData,
+ const sal_Int32 nNewSaturation,
+ const sal_Int32 nNewBrightness)
+{
+ USHORT nHue (0);
+ USHORT nSaturation (0);
+ USHORT 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)
: maBackgroundColor(rpProperties->GetBackgroundColor().GetColor()),
maPageBackgroundColor(COL_WHITE),
- maNormalGradient(),
- maSelectedGradient(),
- maSelectedAndFocusedGradient(),
- maMouseOverGradient(),
- maRawShadow(),
- maRawInsertShadow(),
- maHideSlideOverlay(),
- maStartPresentationIcon(),
- maShowSlideIcon(),
- maDuplicateSlideIcon(),
- maColor(PreviewBorder+1),
+ maGradients(),
+ maIcons(),
+ maColor(),
mnButtonCornerRadius(3),
mnButtonMaxAlpha(255 * 20/100),
- mnButtonPaintType(0),
- msUnhide(),
- msDragAndDropPages(),
- msDragAndDropSlides()
+ mnButtonPaintType(1),
+ mnButtonBorder(4),
+ mnButtonGap(8)
{
- LocalResource aResource (IMG_ICONS);
-
- maRawShadow = Image(SdResId(IMAGE_SHADOW)).GetBitmapEx();
- maRawInsertShadow = Image(SdResId(IMAGE_INSERT_SHADOW)).GetBitmapEx();
- maHideSlideOverlay = Image(SdResId(IMAGE_HIDE_SLIDE_OVERLAY)).GetBitmapEx();
- maStartPresentationIcon = Image(SdResId(IMAGE_PRESENTATION)).GetBitmapEx();
- maShowSlideIcon = Image(SdResId(IMAGE_SHOW_SLIDE)).GetBitmapEx();
- maDuplicateSlideIcon = Image(SdResId(IMAGE_NEW_SLIDE)).GetBitmapEx();
- msUnhide = String(SdResId(STRING_UNHIDE));
- msDragAndDropPages = String(SdResId(STRING_DRAG_AND_DROP_PAGES));
- msDragAndDropSlides = String(SdResId(STRING_DRAG_AND_DROP_SLIDES));
-
- maColor.resize(PreviewBorder+1);
- maColor[Background] = maBackgroundColor;
- maColor[PageBackground] = AirForceBlue;
- maColor[ButtonBackground] = AirForceBlue;
- maColor[ButtonText] = AntiqueWhite;
- maColor[MouseOverColor] = gnMouseOverColor;
- maColor[PageNumberBorder] = Azure;
- maColor[PageNumberColor] = 0x0848a8f;
- maColor[Selection] = StellaBlue;
- maColor[PreviewBorder] = 0x949599;
+ {
+ LocalResource aResource (RID_SLIDESORTER_ICONS);
+
+ maStrings.resize(_StringType_Size_);
+ maStrings[String_Unhide] = String(SdResId(STRING_UNHIDE));
+ 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));
+ maStrings[String_Command3] = String(SdResId(STRING_COMMAND3));
+
+ maColor.resize(_ColorType_Size_);
+ maColor[Background] = maBackgroundColor;
+ maColor[PageBackground] = AirForceBlue;
+ maColor[ButtonBackground] = Black;
+ maColor[ButtonText] = AntiqueWhite;
+ maColor[MouseOverColor] = gnMouseOverColor;
+ maColor[PageNumberBorder] = Azure;
+ maColor[PageNumberColor] = 0x0848a8f;
+ maColor[Selection] = StellaBlue;
+ maColor[PreviewBorder] = 0x949599;
+ }
Update(rpProperties);
}
@@ -141,12 +150,16 @@ void Theme::Update (const ::boost::shared_ptr<controller::Properties>& rpPropert
maColor[Background] = maBackgroundColor;
+ maGradients.resize(_GradientColorType_Size_);
+
#ifdef USE_SYSTEM_SELECTION_COLOR
const ColorData aSelectionColor (rpProperties->GetSelectionColor().GetColor());
- SetGradient(SelectedPage, aSelectionColor, +50,-10, -10,-30);
- SetGradient(SelectedAndFocusedPage, aSelectionColor, +30,-30, -30,-50);
- SetGradient(MouseOverPage, aSelectionColor, +90,+30, +10,+30);
+ 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,0, -50,-75);
+ SetGradient(Gradient_MouseOverSelectedAndFocusedPage, aSelectionColor, 75, 75, +100,0, -50,-75);
+ SetGradient(Gradient_FocusedPage, aSelectionColor, -1,-1, 0,0, -50,-75);
#else
@@ -166,7 +179,64 @@ void Theme::Update (const ::boost::shared_ptr<controller::Properties>& rpPropert
maMouseOverGradient.maBorderColor2 = 0x0e85cd;
#endif
- SetGradient(NormalPage, maBackgroundColor, 0,0, 0,0);
+ SetGradient(Gradient_ButtonBackground, 0x000000, -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;
+
+ const bool bSavedHighContrastMode (mbIsHighContrastMode);
+ mbIsHighContrastMode = rpProperties->IsHighContrastModeActive();
+ if (bSavedHighContrastMode != mbIsHighContrastMode)
+ {
+ 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_Command1Regular, IMAGE_COMMAND1_REGULAR_HC);
+ InitializeIcon(Icon_Command1Hover, IMAGE_COMMAND1_HOVER_HC);
+ InitializeIcon(Icon_Command1Small, IMAGE_COMMAND1_SMALL_HC);
+ InitializeIcon(Icon_Command1SmallHover, IMAGE_COMMAND1_SMALL_HOVER_HC);
+
+ InitializeIcon(Icon_Command2Regular, IMAGE_COMMAND2_REGULAR_HC);
+ InitializeIcon(Icon_Command2Hover, IMAGE_COMMAND2_HOVER_HC);
+ InitializeIcon(Icon_Command2Small, IMAGE_COMMAND2_SMALL_HC);
+ InitializeIcon(Icon_Command2SmallHover, IMAGE_COMMAND2_SMALL_HOVER_HC);
+
+ InitializeIcon(Icon_Command3Regular, IMAGE_COMMAND3_REGULAR_HC);
+ InitializeIcon(Icon_Command3Hover, IMAGE_COMMAND3_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_Command1Regular, IMAGE_COMMAND1_REGULAR);
+ InitializeIcon(Icon_Command1Hover, IMAGE_COMMAND1_HOVER);
+ InitializeIcon(Icon_Command1Small, IMAGE_COMMAND1_SMALL);
+ InitializeIcon(Icon_Command1SmallHover, IMAGE_COMMAND1_SMALL_HOVER);
+
+ InitializeIcon(Icon_Command2Regular, IMAGE_COMMAND2_REGULAR);
+ InitializeIcon(Icon_Command2Hover, IMAGE_COMMAND2_HOVER);
+ InitializeIcon(Icon_Command2Small, IMAGE_COMMAND2_SMALL);
+ InitializeIcon(Icon_Command2SmallHover, IMAGE_COMMAND2_SMALL_HOVER);
+
+ InitializeIcon(Icon_Command3Regular, IMAGE_COMMAND3_REGULAR);
+ InitializeIcon(Icon_Command3Hover, IMAGE_COMMAND3_HOVER);
+ InitializeIcon(Icon_Command3Small, IMAGE_COMMAND3_SMALL);
+ InitializeIcon(Icon_Command3SmallHover, IMAGE_COMMAND3_SMALL_HOVER);
+ }
+ }
}
@@ -288,6 +358,8 @@ sal_Int32 Theme::GetGradientOffset (
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,
@@ -297,10 +369,14 @@ void Theme::SetGradient (
rGradient.maBaseColor = aBaseColor;
- rGradient.maFillColor1 = ChangeLuminance(aBaseColor, nFillStartOffset);
- rGradient.maFillColor2 = ChangeLuminance(aBaseColor, nFillEndOffset);
- rGradient.maBorderColor1 = ChangeLuminance(aBaseColor, nBorderStartOffset);
- rGradient.maBorderColor2 = ChangeLuminance(aBaseColor, nBorderEndOffset);
+ rGradient.mnSaturationOverride = nSaturationOverride;
+ rGradient.mnBrightnessOverride = nBrightnessOverride;
+ const ColorData aColor (HGBAdapt(aBaseColor, nSaturationOverride, nBrightnessOverride));
+
+ 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;
@@ -309,32 +385,59 @@ void Theme::SetGradient (
}
+sal_Int32 Theme::GetGradientSaturationOverride (const GradientColorType eType)
+{
+ GradientDescriptor& rGradient (GetGradient(eType));
+ return rGradient.mnSaturationOverride;
+}
-BitmapEx Theme::GetIcon (const IconType eType)
+sal_Int32 Theme::GetGradientBrightnessOverride (const GradientColorType eType)
{
- switch (eType)
- {
- case Icon_RawShadow:
- return maRawShadow;
+ 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);
+}
- case Icon_RawInsertShadow:
- return maRawInsertShadow;
- case Icon_HideSlideOverlay:
- return maHideSlideOverlay;
+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);
+}
- case Icon_StartPresentation:
- return maStartPresentationIcon;
- case Icon_ShowSlide:
- return maShowSlideIcon;
- case Icon_DuplicateSlide:
- return maDuplicateSlideIcon;
- default:
- return BitmapEx();
+BitmapEx Theme::GetIcon (const IconType eType)
+{
+ if (eType>=0 && eType<maIcons.size())
+ return maIcons[eType];
+ else
+ {
+ OSL_ASSERT(eType>=0 && eType<maIcons.size());
+ return BitmapEx();
}
}
@@ -345,15 +448,21 @@ sal_Int32 Theme::GetIntegerValue (const IntegerValueType eType) const
{
switch (eType)
{
- case ButtonCornerRadius:
+ case Integer_ButtonCornerRadius:
return mnButtonCornerRadius;
- case ButtonMaxAlpha:
+ case Integer_ButtonMaxAlpha:
return mnButtonMaxAlpha;
- case ButtonPaintType:
+ case Integer_ButtonPaintType:
return mnButtonPaintType;
+ case Integer_ButtonBorder:
+ return mnButtonBorder;
+
+ case Integer_ButtonGap:
+ return mnButtonGap;
+
default:
return 0;
}
@@ -366,18 +475,26 @@ void Theme::SetIntegerValue (const IntegerValueType eType, const sal_Int32 nValu
{
switch (eType)
{
- case ButtonCornerRadius:
+ case Integer_ButtonCornerRadius:
mnButtonCornerRadius = nValue;
break;
- case ButtonMaxAlpha:
+ case Integer_ButtonMaxAlpha:
mnButtonMaxAlpha = nValue;
break;
- case ButtonPaintType:
+ case Integer_ButtonPaintType:
mnButtonPaintType = nValue;
break;
+ case Integer_ButtonBorder:
+ mnButtonBorder = nValue;
+ break;
+
+ case Integer_ButtonGap:
+ mnButtonGap = nValue;
+ break;
+
default:
break;
}
@@ -388,12 +505,12 @@ void Theme::SetIntegerValue (const IntegerValueType eType, const sal_Int32 nValu
::rtl::OUString Theme::GetString (const StringType eType) const
{
- switch (eType)
+ if (eType>=0 && eType<maStrings.size())
+ return maStrings[eType];
+ else
{
- case String_Unhide: return msUnhide;
- case String_DragAndDropPages: return msDragAndDropPages;
- case String_DragAndDropSlides: return msDragAndDropSlides;
- default: return ::rtl::OUString();
+ OSL_ASSERT(eType>=0 && eType<maStrings.size());
+ return ::rtl::OUString();
}
}
@@ -402,26 +519,29 @@ void Theme::SetIntegerValue (const IntegerValueType eType, const sal_Int32 nValu
Theme::GradientDescriptor& Theme::GetGradient (const GradientColorType eType)
{
- switch(eType)
+ if (eType>=0 && eType<maGradients.size())
+ return maGradients[eType];
+ else
{
- default:
- OSL_ASSERT(false);
- // fall through
+ OSL_ASSERT(eType>=0 && eType<maGradients.size());
+ return maGradients[0];
+ }
+}
- case NormalPage:
- return maNormalGradient;
- case SelectedPage:
- return maSelectedGradient;
- case SelectedAndFocusedPage:
- return maSelectedAndFocusedGradient;
- case MouseOverPage:
- return maMouseOverGradient;
+void Theme::InitializeIcon (const IconType eType, USHORT nResourceId)
+{
+ if (eType>=0 && eType<maIcons.size())
+ maIcons[eType] = Image(SdResId(nResourceId)).GetBitmapEx();
+ else
+ {
+ OSL_ASSERT(eType>=0 && eType<maIcons.size());
}
}
+
} } } // end of namespace ::sd::slidesorter::view
diff --git a/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx b/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx
index 13f7a772c1e0..f1d00c11225f 100644
--- a/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx
+++ b/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx
@@ -64,9 +64,8 @@ ViewCacheContext::~ViewCacheContext (void)
void ViewCacheContext::NotifyPreviewCreation (
cache::CacheKey aKey,
- const ::boost::shared_ptr<BitmapEx>& rPreview)
+ const cache::PreviewType&)
{
- (void)rPreview;
const model::SharedPageDescriptor pDescriptor (GetDescriptor(aKey));
if (pDescriptor.get() != NULL)
{
diff --git a/sd/source/ui/slidesorter/view/SlsViewCacheContext.hxx b/sd/source/ui/slidesorter/view/SlsViewCacheContext.hxx
index 7001192f8d5c..40c5076dcf8a 100644
--- a/sd/source/ui/slidesorter/view/SlsViewCacheContext.hxx
+++ b/sd/source/ui/slidesorter/view/SlsViewCacheContext.hxx
@@ -41,7 +41,6 @@ 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.
*/
@@ -50,7 +49,7 @@ class ViewCacheContext : public cache::CacheContext
public:
ViewCacheContext (SlideSorter& rSlideSorter);
virtual ~ViewCacheContext (void);
- virtual void NotifyPreviewCreation (cache::CacheKey aKey, const ::boost::shared_ptr<BitmapEx>& rPreview);
+ virtual void NotifyPreviewCreation (cache::CacheKey aKey, const cache::PreviewType& rPreview);
virtual bool IsIdle (void);
virtual bool IsVisible (cache::CacheKey aKey);
virtual const SdrPage* GetPage (cache::CacheKey aKey);
diff --git a/sd/source/ui/slidesorter/view/makefile.mk b/sd/source/ui/slidesorter/view/makefile.mk
index cd63b6738801..9a946670309b 100644
--- a/sd/source/ui/slidesorter/view/makefile.mk
+++ b/sd/source/ui/slidesorter/view/makefile.mk
@@ -50,6 +50,7 @@ SRC1FILES = \
SLOFILES = \
$(SLO)$/SlideSorterView.obj \
+ $(SLO)$/SlsButtonBar.obj \
$(SLO)$/SlsFontProvider.obj \
$(SLO)$/SlsFramePainter.obj \
$(SLO)$/SlsInsertAnimator.obj \