2004-07-13 13:10:46 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2005-09-09 05:10:44 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2004-07-13 13:10:46 +00:00
|
|
|
*
|
2005-09-09 05:10:44 +00:00
|
|
|
* $RCSfile: SlsPageCache.cxx,v $
|
2004-07-13 13:10:46 +00:00
|
|
|
*
|
2006-09-16 18:04:20 +00:00
|
|
|
* $Revision: 1.7 $
|
2004-07-13 13:10:46 +00:00
|
|
|
*
|
2006-09-16 18:04:20 +00:00
|
|
|
* last change: $Author: obo $ $Date: 2006-09-16 19:04:20 $
|
2004-07-13 13:10:46 +00:00
|
|
|
*
|
2005-09-09 05:10:44 +00:00
|
|
|
* The Contents of this file are made available subject to
|
|
|
|
* the terms of GNU Lesser General Public License Version 2.1.
|
2004-07-13 13:10:46 +00:00
|
|
|
*
|
|
|
|
*
|
2005-09-09 05:10:44 +00:00
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2005 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
2004-07-13 13:10:46 +00:00
|
|
|
*
|
2005-09-09 05:10:44 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
2004-07-13 13:10:46 +00:00
|
|
|
*
|
2005-09-09 05:10:44 +00:00
|
|
|
* This library 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 for more details.
|
2004-07-13 13:10:46 +00:00
|
|
|
*
|
2005-09-09 05:10:44 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
2004-07-13 13:10:46 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-16 18:04:20 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_sd.hxx"
|
|
|
|
|
2004-09-20 12:32:45 +00:00
|
|
|
#include "cache/SlsPageCache.hxx"
|
2005-10-24 06:41:10 +00:00
|
|
|
#include "cache/SlsPageCacheManager.hxx"
|
2004-07-13 13:10:46 +00:00
|
|
|
#include "SlsBitmapCache.hxx"
|
|
|
|
#include "SlsGenericPageCache.hxx"
|
|
|
|
#include "SlsGenericRequestQueue.hxx"
|
|
|
|
#include "SlsRequestFactory.hxx"
|
|
|
|
#include "SlsQueueProcessor.hxx"
|
2006-07-13 09:29:14 +00:00
|
|
|
#include "SlsPreviewBitmapFactory.hxx"
|
2004-09-20 12:32:45 +00:00
|
|
|
|
2004-07-13 13:10:46 +00:00
|
|
|
|
|
|
|
using namespace ::sd::slidesorter::model;
|
|
|
|
using namespace ::sd::slidesorter::view;
|
2005-10-24 06:41:10 +00:00
|
|
|
using namespace ::com::sun::star;
|
2004-07-13 13:10:46 +00:00
|
|
|
|
2004-09-20 12:32:45 +00:00
|
|
|
|
2004-07-13 13:10:46 +00:00
|
|
|
namespace sd { namespace slidesorter { namespace cache {
|
|
|
|
|
2004-09-20 12:32:45 +00:00
|
|
|
|
2005-10-24 06:41:10 +00:00
|
|
|
typedef GenericRequestQueue<PageCache::RequestData> Queue;
|
2006-07-13 09:29:14 +00:00
|
|
|
typedef QueueProcessor<Queue, PageCache::RequestData, PreviewBitmapFactory> Processor;
|
2005-10-24 06:41:10 +00:00
|
|
|
typedef GenericPageCache< PageCache::RequestData, RequestFactory<Queue,false>, Queue, Processor
|
2004-07-13 13:10:46 +00:00
|
|
|
> BaseClass;
|
|
|
|
|
|
|
|
|
2005-10-24 06:41:10 +00:00
|
|
|
/** The implementation class simply hides the actual GenericPageCache base
|
|
|
|
class.
|
|
|
|
*/
|
2004-07-13 13:10:46 +00:00
|
|
|
class PageCache::PageCacheImplementation
|
|
|
|
: public BaseClass
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PageCacheImplementation (
|
|
|
|
view::SlideSorterView& rView,
|
|
|
|
model::SlideSorterModel& rModel,
|
2005-10-24 06:41:10 +00:00
|
|
|
const Size& rPreviewSize)
|
|
|
|
: BaseClass (rView,rModel, rPreviewSize)
|
2004-07-13 13:10:46 +00:00
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2005-10-24 06:41:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
//===== PageCache =============================================================
|
|
|
|
|
2004-07-13 13:10:46 +00:00
|
|
|
PageCache::PageCache (
|
|
|
|
view::SlideSorterView& rView,
|
|
|
|
model::SlideSorterModel& rModel,
|
2005-10-24 06:41:10 +00:00
|
|
|
const Size& rPreviewSize)
|
|
|
|
: mpImplementation(NULL)
|
2004-07-13 13:10:46 +00:00
|
|
|
{
|
2005-10-24 06:41:10 +00:00
|
|
|
mpImplementation.reset(new PageCacheImplementation(rView,rModel,rPreviewSize));
|
2004-07-13 13:10:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PageCache::~PageCache (void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-10-24 06:41:10 +00:00
|
|
|
void PageCache::ChangeSize(const Size& rPreviewSize)
|
|
|
|
{
|
|
|
|
mpImplementation->ChangePreviewSize(rPreviewSize);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2004-07-13 13:10:46 +00:00
|
|
|
BitmapEx PageCache::GetPreviewBitmap (
|
|
|
|
RequestData& rRequestData,
|
|
|
|
const Size& rSize)
|
|
|
|
{
|
|
|
|
return mpImplementation->GetPreviewBitmap (rRequestData, rSize);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void PageCache::RequestPreviewBitmap (
|
|
|
|
RequestData& rRequestData,
|
|
|
|
const Size& rSize)
|
|
|
|
{
|
|
|
|
return mpImplementation->RequestPreviewBitmap (rRequestData, rSize);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void PageCache::InvalidatePreviewBitmap (const RequestData& rRequestData)
|
|
|
|
{
|
|
|
|
mpImplementation->InvalidatePreviewBitmap (rRequestData);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void PageCache::ReleasePreviewBitmap (RequestData& rRequestData)
|
|
|
|
{
|
|
|
|
mpImplementation->ReleasePreviewBitmap(rRequestData);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-10-24 06:41:10 +00:00
|
|
|
void PageCache::InvalidateCache (bool bUpdateCache)
|
2004-07-13 13:10:46 +00:00
|
|
|
{
|
2005-10-24 06:41:10 +00:00
|
|
|
mpImplementation->InvalidateCache(bUpdateCache);
|
2004-07-13 13:10:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void PageCache::SetPreciousFlag (RequestData& rRequestData, bool bIsPrecious)
|
|
|
|
{
|
|
|
|
mpImplementation->SetPreciousFlag (rRequestData, bIsPrecious);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-10-24 06:41:10 +00:00
|
|
|
|
|
|
|
|
2004-07-13 13:10:46 +00:00
|
|
|
} } } // end of namespace ::sd::slidesorter::cache
|