renaissance1: #1107215# Previews are updated on model changes (to reflect changes of page numbers etc). Fixed insert position at end of document.
This commit is contained in:
@@ -385,6 +385,32 @@ bool PageCacheManager::InvalidatePreviewBitmap (
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void PageCacheManager::InvalidateAllPreviewBitmaps (DocumentKey pDocument)
|
||||||
|
{
|
||||||
|
if (pDocument == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Iterate over all caches that are currently in use and invalidate the
|
||||||
|
// previews in those that belong to the document.
|
||||||
|
PageCacheContainer::iterator iCache;
|
||||||
|
for (iCache=mpPageCaches->begin(); iCache!=mpPageCaches->end(); ++iCache)
|
||||||
|
if (iCache->first.mpDocument == pDocument)
|
||||||
|
iCache->second->InvalidateCache();
|
||||||
|
|
||||||
|
// Invalidate the previews in the recently used caches belonging to the
|
||||||
|
// given document.
|
||||||
|
RecentlyUsedPageCaches::iterator iQueue (mpRecentlyUsedPageCaches->find(pDocument));
|
||||||
|
if (iQueue != mpRecentlyUsedPageCaches->end())
|
||||||
|
{
|
||||||
|
RecentlyUsedQueue::const_iterator iCache2;
|
||||||
|
for (iCache2=iQueue->second.begin(); iCache2!=iQueue->second.end(); ++iCache2)
|
||||||
|
iCache2->mpCache->InvalidateCache();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void PageCacheManager::InvalidateAllCaches (void)
|
void PageCacheManager::InvalidateAllCaches (void)
|
||||||
{
|
{
|
||||||
// Iterate over all caches that are currently in use and invalidate
|
// Iterate over all caches that are currently in use and invalidate
|
||||||
|
@@ -318,42 +318,7 @@ void Listener::Notify (
|
|||||||
{
|
{
|
||||||
case HINT_PAGEORDERCHG:
|
case HINT_PAGEORDERCHG:
|
||||||
if (&rBroadcaster == mrSlideSorter.GetModel().GetDocument())
|
if (&rBroadcaster == mrSlideSorter.GetModel().GetDocument())
|
||||||
{
|
HandleModelChange(rSdrHint.GetPage());
|
||||||
// Notify model and selection observer about the page.
|
|
||||||
// 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))
|
|
||||||
{
|
|
||||||
SdDrawDocument& rDocument (static_cast<SdDrawDocument&>(rBroadcaster));
|
|
||||||
if (rDocument.GetMasterSdPageCount(PK_STANDARD)
|
|
||||||
== rDocument.GetMasterSdPageCount(PK_NOTES))
|
|
||||||
{
|
|
||||||
mrController.HandleModelChange();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HINT_OBJINSERTED:
|
|
||||||
case HINT_OBJREMOVED:
|
|
||||||
case HINT_OBJCHG:
|
|
||||||
HandleShapeModification(rSdrHint.GetPage());
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -641,6 +606,40 @@ void Listener::UpdateEditMode (void)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void Listener::HandleModelChange (const SdrPage* pPage)
|
||||||
|
{
|
||||||
|
// Notify model and selection observer about the page. The return value
|
||||||
|
// of the model call acts as filter as to which events to pass to the
|
||||||
|
// selection observer.
|
||||||
|
if (mrSlideSorter.GetModel().NotifyPageEvent(pPage))
|
||||||
|
{
|
||||||
|
// 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.
|
||||||
|
if (pPage!=NULL && ! pPage->IsInserted())
|
||||||
|
cache::PageCacheManager::Instance()->ReleasePreviewBitmap(pPage);
|
||||||
|
|
||||||
|
mrController.GetSelectionManager()->GetSelectionObserver()->NotifyPageEvent(pPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tell the controller about the model change only when the document is
|
||||||
|
// in a sane state, not just in the middle of a larger change.
|
||||||
|
SdDrawDocument* pDocument (mrSlideSorter.GetModel().GetDocument());
|
||||||
|
if (pDocument != NULL
|
||||||
|
&& pDocument->GetMasterSdPageCount(PK_STANDARD) == pDocument->GetMasterSdPageCount(PK_NOTES))
|
||||||
|
{
|
||||||
|
// A model change can make updates of some text fields necessary
|
||||||
|
// (like page numbers and page count.) Invalidate all previews in
|
||||||
|
// the cache to cope with this. Doing this on demand would be a
|
||||||
|
// nice optimization.
|
||||||
|
cache::PageCacheManager::Instance()->InvalidateAllPreviewBitmaps(pDocument->getUnoModel());
|
||||||
|
|
||||||
|
mrController.HandleModelChange();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Listener::HandleShapeModification (const SdrPage* pPage)
|
void Listener::HandleShapeModification (const SdrPage* pPage)
|
||||||
{
|
{
|
||||||
|
@@ -169,6 +169,11 @@ private:
|
|||||||
*/
|
*/
|
||||||
void UpdateEditMode (void);
|
void UpdateEditMode (void);
|
||||||
|
|
||||||
|
/** Handle a change in the order of slides or when the set of slides has
|
||||||
|
changed, i.e. a slide has been created.
|
||||||
|
*/
|
||||||
|
void HandleModelChange (const SdrPage* pPage);
|
||||||
|
|
||||||
/** Handle a modification to a shape on the given page. When this is a
|
/** Handle a modification to a shape on the given page. When this is a
|
||||||
regular page then update its preview. When it is a master page then
|
regular page then update its preview. When it is a master page then
|
||||||
additionally update the previews of all pages linked to it.
|
additionally update the previews of all pages linked to it.
|
||||||
|
@@ -107,6 +107,12 @@ public:
|
|||||||
DocumentKey pDocument,
|
DocumentKey pDocument,
|
||||||
const SdrPage* pPage);
|
const SdrPage* pPage);
|
||||||
|
|
||||||
|
/** Invalidate the preview bitmaps for all slides that belong to the
|
||||||
|
specified document. This is necessary after model changes that
|
||||||
|
affect e.g. page number fiels.
|
||||||
|
*/
|
||||||
|
void InvalidateAllPreviewBitmaps (DocumentKey pDocument);
|
||||||
|
|
||||||
/** Invalidate all the caches that are currently in use and destroy
|
/** Invalidate all the caches that are currently in use and destroy
|
||||||
those that are not. This is used for example when the high contrast
|
those that are not. This is used for example when the high contrast
|
||||||
mode is turned on or off.
|
mode is turned on or off.
|
||||||
|
@@ -1407,7 +1407,7 @@ bool StartShowButton::IsEnabled (void) const
|
|||||||
return false;
|
return false;
|
||||||
SfxDispatcher* pDispatcher = pViewShell->GetDispatcher();
|
SfxDispatcher* pDispatcher = pViewShell->GetDispatcher();
|
||||||
if (pDispatcher == NULL)
|
if (pDispatcher == NULL)
|
||||||
return NULL;
|
return false;
|
||||||
|
|
||||||
const SfxPoolItem* pState = NULL;
|
const SfxPoolItem* pState = NULL;
|
||||||
const SfxItemState eState (pDispatcher->QueryState(SID_PRESENTATION, pState));
|
const SfxItemState eState (pDispatcher->QueryState(SID_PRESENTATION, pState));
|
||||||
@@ -1416,13 +1416,9 @@ bool StartShowButton::IsEnabled (void) const
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void StartShowButton::ProcessClick (const model::SharedPageDescriptor& rpDescriptor)
|
void StartShowButton::ProcessClick (const model::SharedPageDescriptor& rpDescriptor)
|
||||||
{
|
{
|
||||||
// mrSlideSorter.GetController().GetCurrentSlideManager()->SwitchCurrentSlide(
|
|
||||||
// rpDescriptor);
|
|
||||||
if (mrSlideSorter.GetViewShell() != NULL
|
|
||||||
&& mrSlideSorter.GetViewShell()->GetDispatcher() != NULL)
|
|
||||||
{
|
|
||||||
// Hide the tool tip early, while the slide show still intializes.
|
// Hide the tool tip early, while the slide show still intializes.
|
||||||
mrSlideSorter.GetView().GetToolTip().SetPage(model::SharedPageDescriptor());
|
mrSlideSorter.GetView().GetToolTip().SetPage(model::SharedPageDescriptor());
|
||||||
|
|
||||||
@@ -1436,14 +1432,6 @@ void StartShowButton::ProcessClick (const model::SharedPageDescriptor& rpDescrip
|
|||||||
aProperties[0].Value = Any(sName);
|
aProperties[0].Value = Any(sName);
|
||||||
xPresentation->startWithArguments(aProperties);
|
xPresentation->startWithArguments(aProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
// Request the start of the slide show.
|
|
||||||
mrSlideSorter.GetViewShell()->GetDispatcher()->Execute(
|
|
||||||
SID_PRESENTATION,
|
|
||||||
SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1501,8 +1489,15 @@ DuplicateButton::DuplicateButton (SlideSorter& rSlideSorter)
|
|||||||
|
|
||||||
bool DuplicateButton::IsEnabled (void) const
|
bool DuplicateButton::IsEnabled (void) const
|
||||||
{
|
{
|
||||||
|
ViewShell* pViewShell = mrSlideSorter.GetViewShell();
|
||||||
|
if (pViewShell == NULL)
|
||||||
|
return false;
|
||||||
|
SfxDispatcher* pDispatcher = pViewShell->GetDispatcher();
|
||||||
|
if (pDispatcher == NULL)
|
||||||
|
return false;
|
||||||
|
|
||||||
const SfxPoolItem* pState = NULL;
|
const SfxPoolItem* pState = NULL;
|
||||||
const SfxItemState eState (mrSlideSorter.GetViewShell()->GetDispatcher()->QueryState(
|
const SfxItemState eState (pDispatcher->QueryState(
|
||||||
SID_DUPLICATE_PAGE,
|
SID_DUPLICATE_PAGE,
|
||||||
pState));
|
pState));
|
||||||
return (eState & SFX_ITEM_DISABLED) == 0;
|
return (eState & SFX_ITEM_DISABLED) == 0;
|
||||||
@@ -1527,10 +1522,13 @@ void DuplicateButton::ProcessClick (const model::SharedPageDescriptor& rpDescrip
|
|||||||
}
|
}
|
||||||
// Duplicate the selected pages. Insert the new pages right
|
// Duplicate the selected pages. Insert the new pages right
|
||||||
// after the current selection and select them
|
// after the current selection and select them
|
||||||
if (mrSlideSorter.GetViewShell() != NULL)
|
if (mrSlideSorter.GetViewShell() != NULL
|
||||||
|
&& mrSlideSorter.GetViewShell()->GetDispatcher() != NULL)
|
||||||
|
{
|
||||||
mrSlideSorter.GetViewShell()->GetDispatcher()->Execute(
|
mrSlideSorter.GetViewShell()->GetDispatcher()->Execute(
|
||||||
SID_DUPLICATE_PAGE,
|
SID_DUPLICATE_PAGE,
|
||||||
SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
|
SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1466,7 +1466,7 @@ void GridImplementation::CalculateLogicalInsertPosition (
|
|||||||
{
|
{
|
||||||
nIndex = mnPageCount;
|
nIndex = mnPageCount;
|
||||||
nRow = mnRowCount-1;
|
nRow = mnRowCount-1;
|
||||||
nColumn = mnPageCount%mnColumnCount;
|
nColumn = ::std::min(::std::min(mnPageCount, mnColumnCount), nColumn);
|
||||||
bIsAtRunEnd = true;
|
bIsAtRunEnd = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user