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)
{
Size aSize (rPixelSize);
bool bDo (bDoSuperSampling);
bool bDo (false);//bDoSuperSampling);
if (bDo)
{
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::ModelChangeLock (

View File

@@ -42,6 +42,7 @@
#include "view/SlideSorterView.hxx"
#include "cache/SlsPageCache.hxx"
#include "drawdoc.hxx"
#include "DrawDocShell.hxx"
#include "glob.hrc"
#include "ViewShellBase.hxx"
@@ -78,7 +79,8 @@ Listener::Listener (
mxFrameWeak(),
mpModelChangeLock()
{
StartListening (*mrSlideSorter.GetModel().GetDocument());
StartListening(*mrSlideSorter.GetModel().GetDocument());
StartListening(*mrSlideSorter.GetModel().GetDocument()->GetDocSh());
mbListeningToDocument = true;
// Connect to the UNO document.
@@ -160,7 +162,8 @@ void Listener::ReleaseListeners (void)
{
if (mbListeningToDocument)
{
EndListening (*mrSlideSorter.GetModel().GetDocument());
EndListening(*mrSlideSorter.GetModel().GetDocument()->GetDocSh());
EndListening(*mrSlideSorter.GetModel().GetDocument());
mbListeningToDocument = false;
}
@@ -370,6 +373,16 @@ void Listener::Notify (
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();
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:
break;
}

View File

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

View File

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

View File

@@ -51,6 +51,7 @@ PageDescriptor::PageDescriptor (
const sal_Int32 nIndex)
: mpPage(pPage),
mxPage(rxPage),
mpMasterPage(NULL),
mnIndex(nIndex),
mbIsSelected(false),
mbWasSelected(false),
@@ -61,7 +62,10 @@ PageDescriptor::PageDescriptor (
maBoundingBox(),
maVisualState(nIndex)
{
OSL_ASSERT(mpPage);
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
{
switch (eState)