renaissance1: #i107215# Added detection for assignment of master pages.

This commit is contained in:
Andre Fischer
2010-02-17 18:06:39 +01:00
parent 70ebb85a47
commit e1f5c8ef3c
6 changed files with 75 additions and 3 deletions

View File

@@ -77,7 +77,7 @@ BitmapFactory::~BitmapFactory (void)
const bool bDoSuperSampling) const bool bDoSuperSampling)
{ {
Size aSize (rPixelSize); Size aSize (rPixelSize);
bool bDo (bDoSuperSampling); bool bDo (false);//bDoSuperSampling);
if (bDo) if (bDo)
{ {
aSize.Width() *= gnSuperSampleFactor; aSize.Width() *= gnSuperSampleFactor;

View File

@@ -1039,6 +1039,24 @@ void SlideSorterController::SetDocumentSlides (const Reference<container::XIndex
void SlideSorterController::CheckForMasterPageAssignment (void)
{
PageEnumeration aAllPages (PageEnumerationProvider::CreateAllPagesEnumeration(mrModel));
while (aAllPages.HasMoreElements())
{
SharedPageDescriptor pDescriptor (aAllPages.GetNextElement());
if (pDescriptor->UpdateMasterPage())
{
mrView.GetPreviewCache()->InvalidatePreviewBitmap (
pDescriptor->GetPage(),
true);
}
}
}
//===== SlideSorterController::ModelChangeLock ================================ //===== SlideSorterController::ModelChangeLock ================================
SlideSorterController::ModelChangeLock::ModelChangeLock ( SlideSorterController::ModelChangeLock::ModelChangeLock (

View File

@@ -42,6 +42,7 @@
#include "view/SlideSorterView.hxx" #include "view/SlideSorterView.hxx"
#include "cache/SlsPageCache.hxx" #include "cache/SlsPageCache.hxx"
#include "drawdoc.hxx" #include "drawdoc.hxx"
#include "DrawDocShell.hxx"
#include "glob.hrc" #include "glob.hrc"
#include "ViewShellBase.hxx" #include "ViewShellBase.hxx"
@@ -79,6 +80,7 @@ Listener::Listener (
mpModelChangeLock() mpModelChangeLock()
{ {
StartListening(*mrSlideSorter.GetModel().GetDocument()); StartListening(*mrSlideSorter.GetModel().GetDocument());
StartListening(*mrSlideSorter.GetModel().GetDocument()->GetDocSh());
mbListeningToDocument = true; mbListeningToDocument = true;
// Connect to the UNO document. // Connect to the UNO document.
@@ -160,6 +162,7 @@ void Listener::ReleaseListeners (void)
{ {
if (mbListeningToDocument) if (mbListeningToDocument)
{ {
EndListening(*mrSlideSorter.GetModel().GetDocument()->GetDocSh());
EndListening(*mrSlideSorter.GetModel().GetDocument()); EndListening(*mrSlideSorter.GetModel().GetDocument());
mbListeningToDocument = false; mbListeningToDocument = false;
} }
@@ -370,6 +373,16 @@ void Listener::Notify (
break; break;
} }
} }
else if (rHint.ISA(SfxSimpleHint))
{
SfxSimpleHint& rSfxSimpleHint (*PTR_CAST(SfxSimpleHint,&rHint));
switch (rSfxSimpleHint.GetId())
{
case SFX_HINT_DOCCHANGED:
mrController.CheckForMasterPageAssignment();
break;
}
}
} }
@@ -421,6 +434,20 @@ IMPL_LINK(Listener, EventMultiplexerCallback, ::sd::tools::EventMultiplexerEvent
DisconnectFromController(); DisconnectFromController();
break; break;
case tools::EventMultiplexerEvent::EID_SHAPE_CHANGED:
case tools::EventMultiplexerEvent::EID_SHAPE_INSERTED:
case tools::EventMultiplexerEvent::EID_SHAPE_REMOVED:
{
const SdrPage* pPage = static_cast<const SdrPage*>(pEvent->mpUserData);
if (pPage != NULL)
{
mrSlideSorter.GetView().GetPreviewCache()->InvalidatePreviewBitmap(
pPage,
true);
}
}
break;
default: default:
break; break;
} }

View File

@@ -252,6 +252,8 @@ public:
*/ */
::boost::shared_ptr<Animator> GetAnimator (void) const; ::boost::shared_ptr<Animator> GetAnimator (void) const;
void CheckForMasterPageAssignment (void);
private: private:
SlideSorter& mrSlideSorter; SlideSorter& mrSlideSorter;
model::SlideSorterModel& mrModel; model::SlideSorterModel& mrModel;

View File

@@ -42,6 +42,7 @@
#include <boost/enable_shared_from_this.hpp> #include <boost/enable_shared_from_this.hpp>
class SdPage; class SdPage;
class SdrPage;
namespace sdr { namespace contact { namespace sdr { namespace contact {
class ObjectContact; class ObjectContact;
@@ -110,6 +111,8 @@ public:
*/ */
sal_Int32 GetPageIndex (void) const; sal_Int32 GetPageIndex (void) const;
bool UpdateMasterPage (void);
enum State { ST_Visible, ST_Selected, ST_WasSelected, enum State { ST_Visible, ST_Selected, ST_WasSelected,
ST_Focused, ST_MouseOver, ST_Current, ST_Excluded }; ST_Focused, ST_MouseOver, ST_Current, ST_Excluded };
@@ -137,6 +140,7 @@ public:
private: private:
SdPage* mpPage; SdPage* mpPage;
css::uno::Reference<css::drawing::XDrawPage> mxPage; css::uno::Reference<css::drawing::XDrawPage> mxPage;
SdrPage const* mpMasterPage;
/** This index is displayed as page number in the view. It may or may /** This index is displayed as page number in the view. It may or may
not be the actual page index. not be the actual page index.
*/ */

View File

@@ -51,6 +51,7 @@ PageDescriptor::PageDescriptor (
const sal_Int32 nIndex) const sal_Int32 nIndex)
: mpPage(pPage), : mpPage(pPage),
mxPage(rxPage), mxPage(rxPage),
mpMasterPage(NULL),
mnIndex(nIndex), mnIndex(nIndex),
mbIsSelected(false), mbIsSelected(false),
mbWasSelected(false), mbWasSelected(false),
@@ -61,7 +62,10 @@ PageDescriptor::PageDescriptor (
maBoundingBox(), maBoundingBox(),
maVisualState(nIndex) maVisualState(nIndex)
{ {
OSL_ASSERT(mpPage);
OSL_ASSERT(mpPage == SdPage::getImplementation(rxPage)); OSL_ASSERT(mpPage == SdPage::getImplementation(rxPage));
if (mpPage != NULL)
mpMasterPage = &mpPage->TRG_GetMasterPage();
} }
@@ -98,6 +102,23 @@ sal_Int32 PageDescriptor::GetPageIndex (void) const
bool PageDescriptor::UpdateMasterPage (void)
{
const SdrPage* pMaster = NULL;
if (mpPage != NULL)
pMaster = &mpPage->TRG_GetMasterPage();
if (mpMasterPage != pMaster)
{
mpMasterPage = pMaster;
return true;
}
else
return false;
}
bool PageDescriptor::HasState (const State eState) const bool PageDescriptor::HasState (const State eState) const
{ {
switch (eState) switch (eState)