Kaydet (Commit) cd5bc497 authored tarafından Jan Holesovsky's avatar Jan Holesovsky

thumbnails: bSigned is always false, nobody uses the signed sign, kill it.

Not killing the icon itself, still seems to be used by on Windows in the shell
code.

Change-Id: I21c3b1ae6dfc65b6852659d6157b02324a485774
üst 1e8c4b76
......@@ -427,13 +427,11 @@ public:
sal_Bool GenerateAndStoreThumbnail(
sal_Bool bEncrypted,
sal_Bool bSigned,
sal_Bool bIsTemplate,
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStor );
sal_Bool WriteThumbnail(
sal_Bool bEncrypted,
sal_Bool bSigned,
sal_Bool bIsTemplate,
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xStream );
......
......@@ -135,7 +135,6 @@
#define STR_LABEL_FILEFORMAT (RID_SFX_DOC_START+96)
// some icons are commented out since they are removed
#define BMP_SIGNATURE (RID_SFX_DOC_START+97)
#define BMP_128X128_CALC_DOC (RID_SFX_DOC_START+99)
#define BMP_128X128_DRAW_DOC (RID_SFX_DOC_START+102)
#define BMP_128X128_IMPRESS_DOC (RID_SFX_DOC_START+104)
......
......@@ -65,10 +65,6 @@
using namespace ::com::sun::star;
#define THUMBNAIL_RESOLUTION 256
//---------------------------------------------------------------
// static
SvMemoryStream* GraphicHelper::getFormatStrFromGDI_Impl( const GDIMetaFile* pGDIMeta, sal_uInt32 nFormat )
{
SvMemoryStream* pResult = NULL;
......@@ -266,7 +262,6 @@ sal_Bool GraphicHelper::mergeBitmaps_Impl( const BitmapEx& rBmpEx, const BitmapE
// static
sal_Bool GraphicHelper::getThumbnailFormatFromGDI_Impl( GDIMetaFile* pMetaFile,
sal_Bool bSigned,
const uno::Reference< io::XStream >& xStream )
{
sal_Bool bResult = sal_False;
......@@ -278,54 +273,13 @@ sal_Bool GraphicHelper::getThumbnailFormatFromGDI_Impl( GDIMetaFile* pMetaFile,
if ( pMetaFile && pStream && !pStream->GetError() )
{
BitmapEx aResultBitmap;
BitmapEx* pSignatureBitmap = NULL;
if ( bSigned )
pSignatureBitmap = new BitmapEx( SfxResId( BMP_SIGNATURE ) );
bResult = pMetaFile->CreateThumbnail(aResultBitmap, THUMBNAIL_RESOLUTION, pSignatureBitmap);
if ( bResult )
bResult = ( !aResultBitmap.IsEmpty()
&& GraphicConverter::Export( *pStream, aResultBitmap, CVT_PNG ) == 0
&& ( pStream->Flush(), !pStream->GetError() ) );
if ( pSignatureBitmap )
delete pSignatureBitmap;
delete pStream;
}
return bResult;
}
//---------------------------------------------------------------
// static
sal_Bool GraphicHelper::getSignedThumbnailFormatFromBitmap_Impl( const BitmapEx& aBitmap,
const uno::Reference< io::XStream >& xStream )
{
sal_Bool bResult = sal_False;
SvStream* pStream = NULL;
if ( xStream.is() )
pStream = ::utl::UcbStreamHelper::CreateStream( xStream );
if ( pStream && !pStream->GetError() )
{
BitmapEx aResultBitmap;
BitmapEx aSignatureBitmap( SfxResId( BMP_SIGNATURE ) );
bResult = mergeBitmaps_Impl( aBitmap,
aSignatureBitmap,
Rectangle( Point(), aBitmap.GetSizePixel() ),
aResultBitmap );
bResult = pMetaFile->CreateThumbnail(aResultBitmap);
if ( bResult )
{
bResult = ( !aResultBitmap.IsEmpty()
&& GraphicConverter::Export( *pStream, aResultBitmap, CVT_PNG ) == 0
&& ( pStream->Flush(), !pStream->GetError() ) );
}
delete pStream;
}
......@@ -333,7 +287,6 @@ sal_Bool GraphicHelper::getSignedThumbnailFormatFromBitmap_Impl( const BitmapEx&
return bResult;
}
//---------------------------------------------------------------
// static
sal_Bool GraphicHelper::getThumbnailReplacement_Impl( sal_Int32 nResID, const uno::Reference< io::XStream >& xStream )
{
......
......@@ -46,11 +46,6 @@ public:
static sal_Bool getThumbnailFormatFromGDI_Impl(
GDIMetaFile* pMetaFile,
sal_Bool bSigned,
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xStream );
static sal_Bool getSignedThumbnailFormatFromBitmap_Impl(
const BitmapEx& aBitmap,
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xStream );
static sal_uInt16 getThumbnailReplacementIDByFactoryName_Impl( const OUString& aFactoryShortName,
......
......@@ -19,11 +19,6 @@
#include "doc.hrc"
Bitmap BMP_SIGNATURE
{
File = "signet.png";
};
Bitmap BMP_128X128_CALC_DOC
{
File = "128x128_calc_doc-p.png";
......
......@@ -1457,7 +1457,6 @@ sal_Bool SfxObjectShell::SaveTo_Impl
// the thumbnail is not stored in case of encrypted document
AddLog( OUString( OSL_LOG_PREFIX "Thumbnail creation." ) );
if ( !GenerateAndStoreThumbnail( bPasswdProvided,
sal_False,
pFilter->IsOwnTemplateFormat(),
xMedStorage ) )
{
......@@ -3525,7 +3524,6 @@ sal_Bool SfxObjectShell::CopyStoragesOfUnknownMediaType( const uno::Reference< e
}
sal_Bool SfxObjectShell::GenerateAndStoreThumbnail( sal_Bool bEncrypted,
sal_Bool bSigned,
sal_Bool bIsTemplate,
const uno::Reference< embed::XStorage >& xStor )
{
......@@ -3545,7 +3543,7 @@ sal_Bool SfxObjectShell::GenerateAndStoreThumbnail( sal_Bool bEncrypted,
OUString("thumbnail.png"),
embed::ElementModes::READWRITE );
if ( xStream.is() && WriteThumbnail( bEncrypted, bSigned, bIsTemplate, xStream ) )
if (xStream.is() && WriteThumbnail(bEncrypted, bIsTemplate, xStream))
{
uno::Reference< embed::XTransactedObject > xTransact( xThumbnailStor, uno::UNO_QUERY_THROW );
xTransact->commit();
......@@ -3563,7 +3561,6 @@ sal_Bool SfxObjectShell::GenerateAndStoreThumbnail( sal_Bool bEncrypted,
}
sal_Bool SfxObjectShell::WriteThumbnail( sal_Bool bEncrypted,
sal_Bool bSigned,
sal_Bool bIsTemplate,
const uno::Reference< io::XStream >& xStream )
{
......@@ -3585,19 +3582,7 @@ sal_Bool SfxObjectShell::WriteThumbnail( sal_Bool bEncrypted,
OUString::createFromAscii( GetFactory().GetShortName() ),
bIsTemplate );
if ( nResID )
{
if ( !bSigned )
{
bResult = GraphicHelper::getThumbnailReplacement_Impl( nResID, xStream );
}
else
{
// retrieve the bitmap and write a signature bitmap over it
SfxResId aResId( nResID );
BitmapEx aThumbBitmap( aResId );
bResult = GraphicHelper::getSignedThumbnailFormatFromBitmap_Impl( aThumbBitmap, xStream );
}
}
bResult = GraphicHelper::getThumbnailReplacement_Impl(nResID, xStream);
}
else
{
......@@ -3606,7 +3591,7 @@ sal_Bool SfxObjectShell::WriteThumbnail( sal_Bool bEncrypted,
if ( pMetaFile )
{
bResult = GraphicHelper::getThumbnailFormatFromGDI_Impl(
pMetaFile.get(), bSigned, xStream );
pMetaFile.get(), xStream);
}
}
}
......
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