renaissance1: #i107215# Fixed updates of slide previews.
This commit is contained in:
parent
4da1188ef4
commit
e969181750
@ -252,7 +252,14 @@ void GenericPageCache::RequestPreviewBitmap (
|
||||
|
||||
bool GenericPageCache::InvalidatePreviewBitmap (const CacheKey aKey)
|
||||
{
|
||||
if (mpBitmapCache.get() != NULL)
|
||||
// Invalidate the page in all caches that reference it, not just this one.
|
||||
::boost::shared_ptr<cache::PageCacheManager> pCacheManager (
|
||||
cache::PageCacheManager::Instance());
|
||||
if (pCacheManager)
|
||||
return pCacheManager->InvalidatePreviewBitmap(
|
||||
mpCacheContext->GetModel(),
|
||||
aKey);
|
||||
else if (mpBitmapCache.get() != NULL)
|
||||
return mpBitmapCache->InvalidateBitmap(mpCacheContext->GetPage(aKey));
|
||||
else
|
||||
return false;
|
||||
|
@ -353,10 +353,12 @@ void PageCacheManager::ReleaseCache (const ::boost::shared_ptr<Cache>& rpCache)
|
||||
|
||||
|
||||
|
||||
void PageCacheManager::InvalidatePreviewBitmap (
|
||||
bool PageCacheManager::InvalidatePreviewBitmap (
|
||||
DocumentKey pDocument,
|
||||
const SdrPage* pKey)
|
||||
{
|
||||
bool bHasChanged (false);
|
||||
|
||||
if (pDocument!=NULL)
|
||||
{
|
||||
// Iterate over all caches that are currently in use and invalidate
|
||||
@ -364,7 +366,7 @@ void PageCacheManager::InvalidatePreviewBitmap (
|
||||
PageCacheContainer::iterator iCache;
|
||||
for (iCache=mpPageCaches->begin(); iCache!=mpPageCaches->end(); ++iCache)
|
||||
if (iCache->first.mpDocument == pDocument)
|
||||
iCache->second->InvalidateBitmap(pKey);
|
||||
bHasChanged |= iCache->second->InvalidateBitmap(pKey);
|
||||
|
||||
// Invalidate the previews in the recently used caches belonging to
|
||||
// the given document.
|
||||
@ -373,9 +375,11 @@ void PageCacheManager::InvalidatePreviewBitmap (
|
||||
{
|
||||
RecentlyUsedQueue::const_iterator iCache2;
|
||||
for (iCache2=iQueue->second.begin(); iCache2!=iQueue->second.end(); ++iCache2)
|
||||
iCache2->mpCache->InvalidateBitmap(pKey);
|
||||
bHasChanged |= iCache2->mpCache->InvalidateBitmap(pKey);
|
||||
}
|
||||
}
|
||||
|
||||
return bHasChanged;
|
||||
}
|
||||
|
||||
|
||||
|
@ -353,9 +353,7 @@ void Listener::Notify (
|
||||
case HINT_OBJINSERTED:
|
||||
case HINT_OBJREMOVED:
|
||||
case HINT_OBJCHG:
|
||||
mrSlideSorter.GetView().GetPreviewCache()->InvalidatePreviewBitmap(
|
||||
rSdrHint.GetPage(),
|
||||
true);
|
||||
HandleShapeModification(rSdrHint.GetPage());
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -644,44 +642,85 @@ void Listener::UpdateEditMode (void)
|
||||
|
||||
|
||||
|
||||
void Listener::HandleObjectModification (void)
|
||||
{
|
||||
::boost::shared_ptr<cache::PageCacheManager> pInstance (
|
||||
cache::PageCacheManager::Instance());
|
||||
if ( ! pInstance)
|
||||
break;
|
||||
SdDrawDocument* pDocument = mrSlideSorter.GetModel().GetDocument();
|
||||
if (pDocument == NULL)
|
||||
{
|
||||
OSL_ASSERT(pDocument!=NULL);
|
||||
break;
|
||||
}
|
||||
pInstance->InvalidatePreviewBitmap(pDocument->getUnoModel(), rSdrHint.GetPage());
|
||||
mrSlideSorter.GetView().GetPreviewCache()->RequestPreviewBitmap(rSdrHint.GetPage());
|
||||
|
||||
// When the modified page is a master page then we have to
|
||||
// invalidate all pages that depend on it.
|
||||
if (rSdrHint.GetPage()->IsMasterPage())
|
||||
{
|
||||
for (USHORT nIndex=0,nCount=pDocument->GetSdPageCount(PK_STANDARD);
|
||||
nIndex<nCount;
|
||||
++nIndex)
|
||||
{
|
||||
const SdPage* pPage = pDocument->GetSdPage(nIndex, PK_STANDARD);
|
||||
if (pPage!=NULL && pPage->TRG_HasMasterPage())
|
||||
{
|
||||
if (&pPage->TRG_GetMasterPage() == rSdrHint.GetPage())
|
||||
pInstance->InvalidatePreviewBitmap(pDocument->getUnoModel(), pPage);
|
||||
}
|
||||
else
|
||||
{
|
||||
OSL_ASSERT(pPage!=NULL && pPage->TRG_HasMasterPage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Listener::HandleShapeModification (const SdrPage* pPage)
|
||||
{
|
||||
if (pPage == NULL)
|
||||
return;
|
||||
|
||||
// Invalidate the preview of the page (in all slide sorters that display
|
||||
// it.)
|
||||
::boost::shared_ptr<cache::PageCacheManager> pCacheManager (cache::PageCacheManager::Instance());
|
||||
if ( ! pCacheManager)
|
||||
break;
|
||||
SdDrawDocument* pDocument = mrSlideSorter.GetModel().GetDocument();
|
||||
if (pDocument == NULL)
|
||||
{
|
||||
OSL_ASSERT(pDocument!=NULL);
|
||||
break;
|
||||
}
|
||||
pCacheManager->InvalidatePreviewBitmap(pDocument->getUnoModel(), rSdrHint.GetPage());
|
||||
mrSlideSorter.GetView().GetPreviewCache()->RequestPreviewBitmap(rSdrHint.GetPage());
|
||||
|
||||
// When the page is a master page then invalidate the previews of all
|
||||
// pages that are linked to this master page.
|
||||
if (pPage->IsMasterPage())
|
||||
{
|
||||
// Invalidate the bitmaps of all pages that are linked to
|
||||
// this master page.
|
||||
model::PageEnumeration aAllPages (
|
||||
model::PageEnumerationProvider::CreateAllPagesEnumeration(
|
||||
mrSlideSorter.GetModel()));
|
||||
::boost::shared_ptr<cache::PageCacheManager> pCacheManager (
|
||||
cache::PageCacheManager::Instance());
|
||||
if (pCacheManager)
|
||||
for (USHORT nIndex=0,nCount=pDocument->GetSdPageCount(PK_STANDARD);
|
||||
nIndex<nCount;
|
||||
++nIndex)
|
||||
{
|
||||
while (aAllPages.HasMoreElements())
|
||||
const SdPage* pPage = pDocument->GetSdPage(nIndex, PK_STANDARD);
|
||||
if (pPage!=NULL && pPage->TRG_HasMasterPage())
|
||||
{
|
||||
model::SharedPageDescriptor pDescriptor (aAllPages.GetNextElement());
|
||||
SdrPage* pCandidate = pDescriptor->GetPage();
|
||||
if (pCandidate!=NULL
|
||||
&& pCandidate->TRG_HasMasterPage()
|
||||
&& &pCandidate->TRG_GetMasterPage() == pPage)
|
||||
{
|
||||
pCacheManager->InvalidatePreviewBitmap(
|
||||
mrSlideSorter.GetModel().GetDocument()->getUnoModel(),
|
||||
pCandidate);
|
||||
}
|
||||
mrSlideSorter.GetView().GetPreviewCache()->RequestPreviewBitmap(pCandidate);
|
||||
if (&pPage->TRG_GetMasterPage() == rSdrHint.GetPage())
|
||||
pCacheManager->InvalidatePreviewBitmap(pDocument->getUnoModel(), pPage);
|
||||
}
|
||||
else
|
||||
{
|
||||
OSL_ASSERT(pPage!=NULL && pPage->TRG_HasMasterPage());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mrSlideSorter.GetView().GetPreviewCache()->InvalidatePreviewBitmap(
|
||||
pPage,
|
||||
true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -31,9 +31,7 @@
|
||||
#include "MutexOwner.hxx"
|
||||
#include "controller/SlideSorterController.hxx"
|
||||
#include <com/sun/star/document/XEventListener.hpp>
|
||||
#ifndef _COM_SUN_STAR_DOCUMENT_XPROPERTYCHANGELISTENER_HPP_
|
||||
#include <com/sun/star/beans/XPropertyChangeListener.hpp>
|
||||
#endif
|
||||
#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
|
||||
#include <com/sun/star/lang/DisposedException.hpp>
|
||||
#include <com/sun/star/beans/XPropertySet.hpp>
|
||||
@ -171,9 +169,9 @@ private:
|
||||
*/
|
||||
void UpdateEditMode (void);
|
||||
|
||||
/** 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 update the previews of all pages linked to it.
|
||||
/** 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
|
||||
additionally update the previews of all pages linked to it.
|
||||
*/
|
||||
void HandleShapeModification (const SdrPage* pPage);
|
||||
|
||||
|
@ -141,7 +141,8 @@ public:
|
||||
void RequestPreviewBitmap (const CacheKey aKey);
|
||||
|
||||
/** Tell the cache that the bitmap associated with the given request
|
||||
data is not up-to-date anymore.
|
||||
data is not up-to-date anymore. This will invalidate all previews
|
||||
in other caches that represent the same page as well.
|
||||
@param bRequestPreview
|
||||
When <TRUE/> then a new preview is requested and will lead
|
||||
eventually to a repaint of the associated page object.
|
||||
|
@ -103,7 +103,7 @@ public:
|
||||
marked as out-of-date and will be re-created when they are requested
|
||||
the next time.
|
||||
*/
|
||||
void InvalidatePreviewBitmap (
|
||||
bool InvalidatePreviewBitmap (
|
||||
DocumentKey pDocument,
|
||||
const SdrPage* pPage);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user