Kaydet (Commit) 5c346ec8 authored tarafından Armin Le Grand's avatar Armin Le Grand Kaydeden (comit) Caolán McNamara

Resolves: #i122231# Buffered content for gallery themes

better graphical preparation (currently BMP_SCALE_BESTQUALITY, but can
be changed in a single place now if wanted)

(cherry picked from commit d32f1d35)

Conflicts:
	svx/inc/svx/galtheme.hxx
	svx/source/gallery2/galctrl.cxx
	svx/source/gallery2/galtheme.cxx

Change-Id: I80879ca472c784f764126676046c1388e1167652
üst 0b9bf62d
...@@ -45,7 +45,13 @@ struct GalleryObject ...@@ -45,7 +45,13 @@ struct GalleryObject
INetURLObject aURL; INetURLObject aURL;
sal_uInt32 nOffset; sal_uInt32 nOffset;
SgaObjKind eObjKind; SgaObjKind eObjKind;
sal_Bool bDummy; bool mbDelete;
//UI visualization buffering
BitmapEx maPreviewBitmapEx;
Size maPreparedSize;
String maTitle;
String maPath;
}; };
typedef ::std::vector< GalleryObject* > GalleryObjectList; typedef ::std::vector< GalleryObject* > GalleryObjectList;
...@@ -219,6 +225,10 @@ public: ...@@ -219,6 +225,10 @@ public:
SvStream& WriteData( SvStream& rOut ) const; SvStream& WriteData( SvStream& rOut ) const;
SvStream& ReadData( SvStream& rIn ); SvStream& ReadData( SvStream& rIn );
static SVX_DLLPUBLIC void InsertAllThemes( ListBox& rListBox ); static SVX_DLLPUBLIC void InsertAllThemes( ListBox& rListBox );
// for buffering PreviewBitmaps and strings for object and path
void GetPreviewBitmapExAndStrings(sal_uIntPtr nPos, BitmapEx& rBitmapEx, Size& rSize, String& rTitle, String& rPath) const;
void SetPreviewBitmapExAndStrings(sal_uIntPtr nPos, const BitmapEx& rBitmapEx, const Size& rSize, const String& rTitle, const String& rPath);
}; };
SvStream& operator<<( SvStream& rOut, const GalleryTheme& rTheme ); SvStream& operator<<( SvStream& rOut, const GalleryTheme& rTheme );
......
...@@ -71,7 +71,6 @@ protected: ...@@ -71,7 +71,6 @@ protected:
sal_Bool CreateThumb( const Graphic& rGraphic ); sal_Bool CreateThumb( const Graphic& rGraphic );
public: public:
SgaObject(); SgaObject();
virtual ~SgaObject() {}; virtual ~SgaObject() {};
...@@ -89,6 +88,8 @@ public: ...@@ -89,6 +88,8 @@ public:
friend SvStream& operator<<( SvStream& rOut, const SgaObject& rObj ); friend SvStream& operator<<( SvStream& rOut, const SgaObject& rObj );
friend SvStream& operator>>( SvStream& rIn, SgaObject& rObj ); friend SvStream& operator>>( SvStream& rIn, SgaObject& rObj );
BitmapEx createPreviewBitmapEx(const Size& rSizePixel) const;
}; };
class SgaObjectSound : public SgaObject class SgaObjectSound : public SgaObject
......
...@@ -324,83 +324,159 @@ void GalleryIconView::UserDraw( const UserDrawEvent& rUDEvt ) ...@@ -324,83 +324,159 @@ void GalleryIconView::UserDraw( const UserDrawEvent& rUDEvt )
const sal_uInt16 nId = rUDEvt.GetItemId(); const sal_uInt16 nId = rUDEvt.GetItemId();
if( nId && mpTheme ) if( nId && mpTheme )
{
SgaObject* pObj = mpTheme->AcquireObject( nId - 1 );
if( pObj )
{ {
const Rectangle& rRect = rUDEvt.GetRect(); const Rectangle& rRect = rUDEvt.GetRect();
OutputDevice* pDev = rUDEvt.GetDevice(); const Size aSize(rRect.GetWidth(), rRect.GetHeight());
Graphic aGraphic;
bool bTransparent(false);
if( pObj->IsThumbBitmap() )
{
BitmapEx aBitmapEx; BitmapEx aBitmapEx;
Size aPreparedSize;
String aItemTextTitle;
String aItemTextPath;
if( pObj->GetObjKind() == SGA_OBJ_SOUND ) mpTheme->GetPreviewBitmapExAndStrings(nId - 1, aBitmapEx, aPreparedSize, aItemTextTitle, aItemTextPath);
{
Bitmap aTemp = pObj->GetThumbBmp().GetBitmap();
aTemp.Replace( COL_LIGHTMAGENTA, COL_WHITE ); bool bNeedToCreate(aBitmapEx.IsEmpty());
aBitmapEx = BitmapEx(aTemp);
}
else
{
aBitmapEx = pObj->GetThumbBmp();
bTransparent = aBitmapEx.IsTransparent();
}
if( ( pDev->GetBitCount() <= 8 ) && ( aBitmapEx.GetBitCount() >= 8 ) ) if(!bNeedToCreate && !aItemTextTitle.Len())
{ {
aBitmapEx.Dither( BMP_DITHER_FLOYD ); bNeedToCreate = true;
} }
aGraphic = aBitmapEx; if(!bNeedToCreate && aPreparedSize != aSize)
}
else
{ {
aGraphic = pObj->GetThumbMtf(); bNeedToCreate = true;
bTransparent = true;
} }
Size aSize( aGraphic.GetSizePixel( pDev ) ); if(bNeedToCreate)
if ( aSize.Width() && aSize.Height() )
{
if( ( aSize.Width() > rRect.GetWidth() ) || ( aSize.Height() > rRect.GetHeight() ) )
{ {
const double fBmpWH = (double) aSize.Width() / aSize.Height(); SgaObject* pObj = mpTheme->AcquireObject(nId - 1);
const double fThmpWH = (double) rRect.GetWidth() / rRect.GetHeight();
// Bitmap an Thumbgroesse anpassen if(pObj)
if ( fBmpWH < fThmpWH )
{
aSize.Width() = (long) ( rRect.GetHeight() * fBmpWH );
aSize.Height()= rRect.GetHeight();
}
else
{ {
aSize.Width() = rRect.GetWidth(); aBitmapEx = pObj->createPreviewBitmapEx(aSize);
aSize.Height()= (long) ( rRect.GetWidth() / fBmpWH ); aItemTextTitle = GalleryBrowser2::GetItemText(*mpTheme, *pObj, GALLERY_ITEM_TITLE);
mpTheme->SetPreviewBitmapExAndStrings(nId - 1, aBitmapEx, aSize, aItemTextTitle, aItemTextPath);
mpTheme->ReleaseObject(pObj);
} }
} }
const Point aPos( ( ( rRect.GetWidth() - aSize.Width() ) >> 1 ) + rRect.Left(), if(!aBitmapEx.IsEmpty())
( ( rRect.GetHeight() - aSize.Height() ) >> 1 ) + rRect.Top() ); {
const Size aBitmapExSizePixel(aBitmapEx.GetSizePixel());
const Point aPos(
((aSize.Width() - aBitmapExSizePixel.Width()) >> 1) + rRect.Left(),
((aSize.Height() - aBitmapExSizePixel.Height()) >> 1) + rRect.Top());
OutputDevice* pDev = rUDEvt.GetDevice();
if(bTransparent) if(aBitmapEx.IsTransparent())
{ {
// draw checkered background for full rectangle. // draw checkered background for full rectangle.
drawTransparenceBackground(*pDev, rRect.TopLeft(), rRect.GetSize()); drawTransparenceBackground(*pDev, rRect.TopLeft(), rRect.GetSize());
} }
aGraphic.Draw( pDev, aPos, aSize ); pDev->DrawBitmapEx(aPos, aBitmapEx);
} }
SetItemText( nId, GalleryBrowser2::GetItemText( *mpTheme, *pObj, GALLERY_ITEM_TITLE) ); SetItemText(nId, aItemTextTitle);
mpTheme->ReleaseObject( pObj );
} //SgaObject* pObj = mpTheme->AcquireObject( nId - 1 );
//
//if( pObj )
//{
// const Rectangle& rRect = rUDEvt.GetRect();
// const Size aSize(rRect.GetWidth(), rRect.GetHeight());
// const BitmapEx aBitmapEx(pObj->createPreviewBitmapEx(aSize));
// const Size aBitmapExSizePixel(aBitmapEx.GetSizePixel());
//
// if(!aBitmapEx.IsEmpty())
// {
// const Point aPos(
// ((aSize.Width() - aBitmapExSizePixel.Width()) >> 1) + rRect.Left(),
// ((aSize.Height() - aBitmapExSizePixel.Height()) >> 1) + rRect.Top());
// OutputDevice* pDev = rUDEvt.GetDevice();
//
// if(aBitmapEx.IsTransparent())
// {
// // draw checkered background
// drawTransparenceBackground(*pDev, aPos, aBitmapExSizePixel);
// }
//
// pDev->DrawBitmapEx(aPos, aBitmapEx);
// }
//
// //const Rectangle& rRect = rUDEvt.GetRect();
// //OutputDevice* pDev = rUDEvt.GetDevice();
// //Graphic aGraphic;
// //bool bTransparent(false);
// //
// //if( pObj->IsThumbBitmap() )
// //{
// // BitmapEx aBitmapEx;
// //
// // if( pObj->GetObjKind() == SGA_OBJ_SOUND )
// // {
// // Bitmap aTemp = pObj->GetThumbBmp().GetBitmap();
// //
// // aTemp.Replace( COL_LIGHTMAGENTA, COL_WHITE );
// // aBitmapEx = BitmapEx(aTemp);
// // }
// // else
// // {
// // aBitmapEx = pObj->GetThumbBmp();
// // bTransparent = aBitmapEx.IsTransparent();
// // }
// //
// // if( ( pDev->GetBitCount() <= 8 ) && ( aBitmapEx.GetBitCount() >= 8 ) )
// // {
// // aBitmapEx.Dither( BMP_DITHER_FLOYD );
// // }
// //
// // aGraphic = aBitmapEx;
// //}
// //else
// //{
// // aGraphic = pObj->GetThumbMtf();
// // bTransparent = true;
// //}
// //
// //Size aSize( aGraphic.GetSizePixel( pDev ) );
// //
// //if ( aSize.Width() && aSize.Height() )
// //{
// // if( ( aSize.Width() > rRect.GetWidth() ) || ( aSize.Height() > rRect.GetHeight() ) )
// // {
// // Point aNewPos;
// // const double fBmpWH = (double) aSize.Width() / aSize.Height();
// // const double fThmpWH = (double) rRect.GetWidth() / rRect.GetHeight();
// //
// // // Bitmap an Thumbgroesse anpassen
// // if ( fBmpWH < fThmpWH )
// // {
// // aSize.Width() = (long) ( rRect.GetHeight() * fBmpWH );
// // aSize.Height()= rRect.GetHeight();
// // }
// // else
// // {
// // aSize.Width() = rRect.GetWidth();
// // aSize.Height()= (long) ( rRect.GetWidth() / fBmpWH );
// // }
// // }
// //
// // const Point aPos( ( ( rRect.GetWidth() - aSize.Width() ) >> 1 ) + rRect.Left(),
// // ( ( rRect.GetHeight() - aSize.Height() ) >> 1 ) + rRect.Top() );
// //
// // if(bTransparent)
// // {
// // // draw checkered background
// // drawTransparenceBackground(*pDev, aPos, aSize);
// // }
// //
// // aGraphic.Draw( pDev, aPos, aSize );
// //}
//
// SetItemText( nId, GalleryBrowser2::GetItemText( *mpTheme, *pObj, GALLERY_ITEM_TITLE) );
// mpTheme->ReleaseObject( pObj );
//}
} }
} }
...@@ -550,79 +626,171 @@ void GalleryListView::PaintField( OutputDevice& rDev, const Rectangle& rRect, sa ...@@ -550,79 +626,171 @@ void GalleryListView::PaintField( OutputDevice& rDev, const Rectangle& rRect, sa
if( mpTheme && ( mnCurRow < mpTheme->GetObjectCount() ) ) if( mpTheme && ( mnCurRow < mpTheme->GetObjectCount() ) )
{ {
SgaObject* pObj = mpTheme->AcquireObject( mnCurRow ); const Size aSize(rRect.GetHeight(), rRect.GetHeight());
BitmapEx aBitmapEx;
Size aPreparedSize;
String aItemTextTitle;
String aItemTextPath;
if( pObj ) mpTheme->GetPreviewBitmapExAndStrings(mnCurRow, aBitmapEx, aPreparedSize, aItemTextTitle, aItemTextPath);
{
const long nTextPosY = rRect.Top() + ( ( rRect.GetHeight() - rDev.GetTextHeight() ) >> 1 );
if( GALLERY_BRWBOX_TITLE == nColumnId ) bool bNeedToCreate(aBitmapEx.IsEmpty());
{
Rectangle aOutputRect( rRect.TopLeft(), Size( rRect.GetHeight(), rRect.GetHeight() ) );
GraphicObject aGrfObj;
bool bTransparent(false);
if( pObj->GetObjKind() == SGA_OBJ_SOUND ) if(!bNeedToCreate && GALLERY_BRWBOX_TITLE == nColumnId && !aItemTextTitle.Len())
{ {
aGrfObj = Graphic( BitmapEx( GAL_RES( RID_SVXBMP_GALLERY_MEDIA ) ) ); bNeedToCreate = true;
} }
else if( pObj->IsThumbBitmap() )
{
const BitmapEx aBitmapEx(pObj->GetThumbBmp());
bTransparent = aBitmapEx.IsTransparent(); if(!bNeedToCreate && GALLERY_BRWBOX_PATH == nColumnId && !aItemTextPath.Len())
aGrfObj = Graphic(aBitmapEx);
}
else
{ {
aGrfObj = Graphic( pObj->GetThumbMtf() ); bNeedToCreate = true;
bTransparent = true;
} }
Size aSize( rDev.LogicToPixel( aGrfObj.GetPrefSize(), aGrfObj.GetPrefMapMode() ) ); if(!bNeedToCreate && aPreparedSize != aSize)
if( aSize.Width() && aSize.Height() )
{
if( ( aSize.Width() > aOutputRect.GetWidth() ) || ( aSize.Height() > aOutputRect.GetHeight() ) )
{ {
const double fBmpWH = (double) aSize.Width() / aSize.Height(); bNeedToCreate = true;
const double fThmpWH = (double) aOutputRect.GetWidth() / aOutputRect.GetHeight(); }
// Bitmap an Thumbgroesse anpassen if(bNeedToCreate)
if ( fBmpWH < fThmpWH )
{ {
aSize.Width() = (long) ( aOutputRect.GetHeight() * fBmpWH ); SgaObject* pObj = mpTheme->AcquireObject(mnCurRow);
aSize.Height()= aOutputRect.GetHeight();
} if(pObj)
else
{ {
aSize.Width() = aOutputRect.GetWidth(); aBitmapEx = pObj->createPreviewBitmapEx(aSize);
aSize.Height()= (long) ( aOutputRect.GetWidth() / fBmpWH ); aItemTextTitle = GalleryBrowser2::GetItemText(*mpTheme, *pObj, GALLERY_ITEM_TITLE);
aItemTextPath = GalleryBrowser2::GetItemText(*mpTheme, *pObj, GALLERY_ITEM_PATH);
mpTheme->SetPreviewBitmapExAndStrings(mnCurRow, aBitmapEx, aSize, aItemTextTitle, aItemTextPath);
mpTheme->ReleaseObject(pObj);
} }
} }
aSize.Width() = std::max( aSize.Width(), 4L ); const long nTextPosY(rRect.Top() + ((rRect.GetHeight() - rDev.GetTextHeight()) >> 1));
aSize.Height() = std::max( aSize.Height(), 4L );
const Point aPos( ( ( aOutputRect.GetWidth() - aSize.Width() ) >> 1 ) + aOutputRect.Left(), if(GALLERY_BRWBOX_TITLE == nColumnId)
( ( aOutputRect.GetHeight() - aSize.Height() ) >> 1 ) + aOutputRect.Top() ); {
if(!aBitmapEx.IsEmpty())
{
const Size aBitmapExSizePixel(aBitmapEx.GetSizePixel());
const Point aPos(
((aSize.Width() - aBitmapExSizePixel.Width()) >> 1) + rRect.Left(),
((aSize.Height() - aBitmapExSizePixel.Height()) >> 1) + rRect.Top());
if(bTransparent) if(aBitmapEx.IsTransparent())
{ {
// draw checkered background // draw checkered background
drawTransparenceBackground(rDev, aPos, aSize); drawTransparenceBackground(rDev, aPos, aBitmapExSizePixel);
} }
aGrfObj.Draw( &rDev, aPos, aSize ); rDev.DrawBitmapEx(aPos, aBitmapEx);
} }
rDev.DrawText( Point( aOutputRect.Right() + 6, nTextPosY ), GalleryBrowser2::GetItemText( *mpTheme, *pObj, GALLERY_ITEM_TITLE ) ); rDev.DrawText(Point(rRect.Left() + rRect.GetHeight() + 6, nTextPosY), aItemTextTitle);
} }
else if( GALLERY_BRWBOX_PATH == nColumnId ) else if(GALLERY_BRWBOX_PATH == nColumnId)
rDev.DrawText( Point( rRect.Left(), nTextPosY ), GalleryBrowser2::GetItemText( *mpTheme, *pObj, GALLERY_ITEM_PATH ) ); {
rDev.DrawText(Point(rRect.Left(), nTextPosY), aItemTextPath);
mpTheme->ReleaseObject( pObj ); }
}
//SgaObject* pObj = mpTheme->AcquireObject( mnCurRow );
//
//if( pObj )
//{
// const long nTextPosY = rRect.Top() + ( ( rRect.GetHeight() - rDev.GetTextHeight() ) >> 1 );
//
// if( GALLERY_BRWBOX_TITLE == nColumnId )
// {
// const Size aSize(rRect.GetHeight(), rRect.GetHeight());
// const BitmapEx aBitmapEx(pObj->createPreviewBitmapEx(aSize));
// const Size aBitmapExSizePixel(aBitmapEx.GetSizePixel());
//
// if(!aBitmapEx.IsEmpty())
// {
// const Point aPos(
// ((aSize.Width() - aBitmapExSizePixel.Width()) >> 1) + rRect.Left(),
// ((aSize.Height() - aBitmapExSizePixel.Height()) >> 1) + rRect.Top());
//
// if(aBitmapEx.IsTransparent())
// {
// // draw checkered background
// drawTransparenceBackground(rDev, aPos, aBitmapExSizePixel);
// }
//
// rDev.DrawBitmapEx(aPos, aBitmapEx);
// }
//
//
// //Rectangle aOutputRect( rRect.TopLeft(), Size( rRect.GetHeight(), rRect.GetHeight() ) );
// //GraphicObject aGrfObj;
// //bool bTransparent(false);
// //
// //if( pObj->GetObjKind() == SGA_OBJ_SOUND )
// //{
// // aGrfObj = Graphic( BitmapEx( GAL_RESID( RID_SVXBMP_GALLERY_MEDIA ) ) );
// //}
// //else if( pObj->IsThumbBitmap() )
// //{
// // const BitmapEx aBitmapEx(pObj->GetThumbBmp());
// //
// // bTransparent = aBitmapEx.IsTransparent();
// // aGrfObj = Graphic(aBitmapEx);
// //}
// //else
// //{
// // aGrfObj = Graphic( pObj->GetThumbMtf() );
// // bTransparent = true;
// //}
// //
// //Size aSize( rDev.LogicToPixel( aGrfObj.GetPrefSize(), aGrfObj.GetPrefMapMode() ) );
// //
// //if( aSize.Width() && aSize.Height() )
// //{
// // if( ( aSize.Width() > aOutputRect.GetWidth() ) || ( aSize.Height() > aOutputRect.GetHeight() ) )
// // {
// // Point aNewPos;
// // const double fBmpWH = (double) aSize.Width() / aSize.Height();
// // const double fThmpWH = (double) aOutputRect.GetWidth() / aOutputRect.GetHeight();
// //
// // // Bitmap an Thumbgroesse anpassen
// // if ( fBmpWH < fThmpWH )
// // {
// // aSize.Width() = (long) ( aOutputRect.GetHeight() * fBmpWH );
// // aSize.Height()= aOutputRect.GetHeight();
// // }
// // else
// // {
// // aSize.Width() = aOutputRect.GetWidth();
// // aSize.Height()= (long) ( aOutputRect.GetWidth() / fBmpWH );
// // }
// // }
// //
// // aSize.Width() = Max( aSize.Width(), 4L );
// // aSize.Height() = Max( aSize.Height(), 4L );
// //
// // const Point aPos( ( ( aOutputRect.GetWidth() - aSize.Width() ) >> 1 ) + aOutputRect.Left(),
// // ( ( aOutputRect.GetHeight() - aSize.Height() ) >> 1 ) + aOutputRect.Top() );
// //
// // if(bTransparent)
// // {
// // // draw checkered background
// // drawTransparenceBackground(rDev, aPos, aSize);
// // }
// //
// // aGrfObj.Draw( &rDev, aPos, aSize );
// //}
//
// // aOutputRect.Right() is here rRect.Left() + rRect.GetHeight()
// rDev.DrawText( Point( rRect.Left() + rRect.GetHeight() + 6, nTextPosY ), GalleryBrowser2::GetItemText( *mpTheme, *pObj, GALLERY_ITEM_TITLE ) );
// }
// else if( GALLERY_BRWBOX_PATH == nColumnId )
// {
// rDev.DrawText( Point( rRect.Left(), nTextPosY ), GalleryBrowser2::GetItemText( *mpTheme, *pObj, GALLERY_ITEM_PATH ) );
// }
//
// mpTheme->ReleaseObject( pObj );
//}
} }
rDev.Pop(); rDev.Pop();
......
...@@ -45,12 +45,54 @@ using namespace ::com::sun::star; ...@@ -45,12 +45,54 @@ using namespace ::com::sun::star;
// - SgaObject - // - SgaObject -
// ------------- // -------------
SgaObject::SgaObject() : SgaObject::SgaObject()
bIsValid ( sal_False ), : bIsValid ( sal_False ),
bIsThumbBmp ( sal_True ) bIsThumbBmp ( sal_True )
{ {
} }
BitmapEx SgaObject::createPreviewBitmapEx(const Size& rSizePixel) const
{
BitmapEx aRetval;
if(rSizePixel.Width() && rSizePixel.Height())
{
if(SGA_OBJ_SOUND == GetObjKind())
{
aRetval = GAL_RES(RID_SVXBMP_GALLERY_MEDIA);
}
else if(IsThumbBitmap())
{
aRetval = GetThumbBmp();
}
else
{
const Graphic aGraphic(GetThumbMtf());
aRetval = aGraphic.GetBitmapEx();
}
if(!aRetval.IsEmpty())
{
const Size aCurrentSizePixel(aRetval.GetSizePixel());
const double fScaleX((double)rSizePixel.Width() / (double)aCurrentSizePixel.Width());
const double fScaleY((double)rSizePixel.Height() / (double)aCurrentSizePixel.Height());
const double fScale(std::min(fScaleX, fScaleY));
// only scale when need to decrease, no need to make bigger as original. Also
// prevent scaling close to 1.0 which is not needed for pixel graphics
if(fScale < 1.0 && fabs(1.0 - fScale) > 0.005)
{
static sal_uInt32 nScaleFlag = BMP_SCALE_BESTQUALITY;
aRetval.Scale(fScale, fScale, nScaleFlag);
}
}
}
return aRetval;
}
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
sal_Bool SgaObject::CreateThumb( const Graphic& rGraphic ) sal_Bool SgaObject::CreateThumb( const Graphic& rGraphic )
......
...@@ -444,6 +444,44 @@ SgaObject* GalleryTheme::AcquireObject( size_t nPos ) ...@@ -444,6 +444,44 @@ SgaObject* GalleryTheme::AcquireObject( size_t nPos )
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
void GalleryTheme::GetPreviewBitmapExAndStrings(sal_uIntPtr nPos, BitmapEx& rBitmapEx, Size& rSize, String& rTitle, String& rPath) const
{
const GalleryObject* pGalleryObject = nPos < aObjectList.size() ? aObjectList[ nPos ] : NULL;
if(pGalleryObject)
{
rBitmapEx = pGalleryObject->maPreviewBitmapEx;
rSize = pGalleryObject->maPreparedSize;
rTitle = pGalleryObject->maTitle;
rPath = pGalleryObject->maPath;
}
else
{
OSL_ENSURE(false, "OOps, no GalleryObject at this index (!)");
}
}
// ------------------------------------------------------------------------
void GalleryTheme::SetPreviewBitmapExAndStrings(sal_uIntPtr nPos, const BitmapEx& rBitmapEx, const Size& rSize, const String& rTitle, const String& rPath)
{
GalleryObject* pGalleryObject = nPos < aObjectList.size() ? aObjectList[ nPos ] : NULL;
if(pGalleryObject)
{
pGalleryObject->maPreviewBitmapEx = rBitmapEx;
pGalleryObject->maPreparedSize = rSize;
pGalleryObject->maTitle = rTitle;
pGalleryObject->maPath = rPath;
}
else
{
OSL_ENSURE(false, "OOps, no GalleryObject at this index (!)");
}
}
// ------------------------------------------------------------------------
void GalleryTheme::ReleaseObject( SgaObject* pObject ) void GalleryTheme::ReleaseObject( SgaObject* pObject )
{ {
delete pObject; delete pObject;
...@@ -526,7 +564,7 @@ void GalleryTheme::Actualize( const Link& rActualizeLink, GalleryProgress* pProg ...@@ -526,7 +564,7 @@ void GalleryTheme::Actualize( const Link& rActualizeLink, GalleryProgress* pProg
// LoeschFlag zuruecksetzen // LoeschFlag zuruecksetzen
for (size_t i = 0; i < nCount; i++) for (size_t i = 0; i < nCount; i++)
aObjectList[ i ]->bDummy = sal_False; aObjectList[ i ]->mbDelete = false;
for(size_t i = 0; ( i < nCount ) && !bAbortActualize; i++) for(size_t i = 0; ( i < nCount ) && !bAbortActualize; i++)
{ {
...@@ -549,7 +587,7 @@ void GalleryTheme::Actualize( const Link& rActualizeLink, GalleryProgress* pProg ...@@ -549,7 +587,7 @@ void GalleryTheme::Actualize( const Link& rActualizeLink, GalleryProgress* pProg
{ {
SgaObjectSound aObjSound( aURL ); SgaObjectSound aObjSound( aURL );
if( !InsertObject( aObjSound ) ) if( !InsertObject( aObjSound ) )
pEntry->bDummy = sal_True; pEntry->mbDelete = true;
} }
else else
{ {
...@@ -567,12 +605,12 @@ void GalleryTheme::Actualize( const Link& rActualizeLink, GalleryProgress* pProg ...@@ -567,12 +605,12 @@ void GalleryTheme::Actualize( const Link& rActualizeLink, GalleryProgress* pProg
pNewObj = (SgaObject*) new SgaObjectBmp( aGraphic, aURL, aFormat ); pNewObj = (SgaObject*) new SgaObjectBmp( aGraphic, aURL, aFormat );
if( !InsertObject( *pNewObj ) ) if( !InsertObject( *pNewObj ) )
pEntry->bDummy = sal_True; pEntry->mbDelete = true;
delete pNewObj; delete pNewObj;
} }
else else
pEntry->bDummy = sal_True; // Loesch-Flag setzen pEntry->mbDelete = true; // Loesch-Flag setzen
} }
} }
else else
...@@ -589,7 +627,7 @@ void GalleryTheme::Actualize( const Link& rActualizeLink, GalleryProgress* pProg ...@@ -589,7 +627,7 @@ void GalleryTheme::Actualize( const Link& rActualizeLink, GalleryProgress* pProg
SgaObjectSvDraw aNewObj( *pIStm, pEntry->aURL ); SgaObjectSvDraw aNewObj( *pIStm, pEntry->aURL );
if( !InsertObject( aNewObj ) ) if( !InsertObject( aNewObj ) )
pEntry->bDummy = sal_True; pEntry->mbDelete = true;
pIStm->SetBufferSize( 0L ); pIStm->SetBufferSize( 0L );
} }
...@@ -601,7 +639,7 @@ void GalleryTheme::Actualize( const Link& rActualizeLink, GalleryProgress* pProg ...@@ -601,7 +639,7 @@ void GalleryTheme::Actualize( const Link& rActualizeLink, GalleryProgress* pProg
for ( size_t i = 0; i < aObjectList.size(); ) for ( size_t i = 0; i < aObjectList.size(); )
{ {
pEntry = aObjectList[ i ]; pEntry = aObjectList[ i ];
if( pEntry->bDummy ) if( pEntry->mbDelete )
{ {
Broadcast( GalleryHint( GALLERY_HINT_CLOSE_OBJECT, GetName(), reinterpret_cast< sal_uIntPtr >( pEntry ) ) ); Broadcast( GalleryHint( GALLERY_HINT_CLOSE_OBJECT, GetName(), reinterpret_cast< sal_uIntPtr >( pEntry ) ) );
Broadcast( GalleryHint( GALLERY_HINT_OBJECT_REMOVED, GetName(), reinterpret_cast< sal_uLong >( pEntry ) ) ); Broadcast( GalleryHint( GALLERY_HINT_OBJECT_REMOVED, GetName(), reinterpret_cast< sal_uLong >( pEntry ) ) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment