[Libreoffice-commits] core.git: 8 commits - configure.ac icon-themes/galaxy icon-themes/hicontrast icon-themes/human include/sfx2 include/vcl sd/source sfx2/source sw/source vcl/source

Jan Holesovsky kendy at collabora.com
Mon Feb 3 10:09:56 PST 2014


 configure.ac                           |   13 --
 dev/null                               |binary
 include/sfx2/objsh.hxx                 |    2 
 include/vcl/gdimtf.hxx                 |    3 
 sd/source/ui/unoidl/unopage.cxx        |    3 
 sfx2/source/control/recentdocsview.cxx |    5 -
 sfx2/source/doc/doc.hrc                |    1 
 sfx2/source/doc/docinf.cxx             |    4 
 sfx2/source/doc/graphhelp.cxx          |  153 ---------------------------------
 sfx2/source/doc/graphhelp.hxx          |   11 --
 sfx2/source/doc/graphhelp.src          |    5 -
 sfx2/source/doc/objstor.cxx            |   21 ----
 sw/source/ui/inc/wrtsh.hxx             |    4 
 vcl/source/gdi/gdimtf.cxx              |   70 ++-------------
 14 files changed, 32 insertions(+), 263 deletions(-)

New commits:
commit 6472e791484e492cb2adfa898c43fbdeee7475ca
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Mon Feb 3 18:56:56 2014 +0100

    fdo#72338: startcenter: Show busy mouse pointer when starting apps.
    
    Change-Id: I8f254419ea7bb4e3e9835bd9fab8229ed89cd0e9

diff --git a/sfx2/source/control/recentdocsview.cxx b/sfx2/source/control/recentdocsview.cxx
index 98e07d7..5f225bc 100644
--- a/sfx2/source/control/recentdocsview.cxx
+++ b/sfx2/source/control/recentdocsview.cxx
@@ -220,6 +220,9 @@ void RecentDocsView::OnItemDblClicked(ThumbnailViewItem *pItem)
 
 void RecentDocsView::OpenItem( const ThumbnailViewItem *pItem )
 {
+    // show busy mouse pointer
+    SetPointer(Pointer(POINTER_WAIT));
+
     const RecentDocsViewItem* pRecentItem = dynamic_cast<const RecentDocsViewItem*>(pItem);
 
     Reference< XDispatch >            xDispatch;
commit 6141a2fda4e47582382d766c4077b1fd725e664a
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Mon Feb 3 18:49:15 2014 +0100

    startcenter: Don't cut off the thumbnails.
    
    Change-Id: Ie5ad5f5be48aa873df94a31e980aaabc4ac24868

diff --git a/sfx2/source/control/recentdocsview.cxx b/sfx2/source/control/recentdocsview.cxx
index 9ed9a96..98e07d7 100644
--- a/sfx2/source/control/recentdocsview.cxx
+++ b/sfx2/source/control/recentdocsview.cxx
@@ -190,7 +190,7 @@ void RecentDocsView::loadRecentDocs()
     }
     else
     {
-        set_width_request(mnItemMaxSize);
+        set_width_request(mnTextHeight + mnItemMaxSize + 2*mnItemPadding);
     }
 }
 
commit ea6c029dfcf7733bb1ce07bc04d9f221f34758db
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Mon Feb 3 18:05:26 2014 +0100

    startcenter: Kill the old branding images.
    
    Change-Id: Idab983ac085efa755025fdef1caa2c0073dd1ba0

diff --git a/configure.ac b/configure.ac
index aa6bac5..2c8a33a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1912,11 +1912,8 @@ AC_ARG_WITH(branding,
     AS_HELP_STRING([--with-branding],
         [Use given path to retrieve branding images set.])
     [
-                          Search for intro.png about.svg flat_logo.svg
-                          backing_left.png backing_right.png
-                          backing_rtl_left.png backing_rtl_right.png
-                          backing_space.png. If any is missing, default
-                          ones will be used instead.
+                          Search for intro.png about.svg and flat_logo.svg.
+                          If any is missing, default ones will be used instead.
 
                           Search also progress.conf for progress
                           settings on intro screen :
@@ -12304,11 +12301,7 @@ dnl branding
 dnl ===================================================================
 AC_MSG_CHECKING([for alternative branding images directory])
 # initialize mapped arrays
-BRAND_INTRO_IMAGES="flat_logo.svg intro.png"
-brand_files="$BRAND_INTRO_IMAGES about.svg \
-    backing_left.png backing_right.png \
-    backing_rtl_left.png backing_rtl_right.png \
-    backing_space.png"
+BRAND_INTRO_IMAGES="flat_logo.svg intro.png about.svg"
 
 if test -z "$with_branding" -o "$with_branding" = "no"; then
     AC_MSG_RESULT([none])
diff --git a/icon-themes/galaxy/brand/shell/backing_left.png b/icon-themes/galaxy/brand/shell/backing_left.png
deleted file mode 100644
index 689f52e..0000000
Binary files a/icon-themes/galaxy/brand/shell/backing_left.png and /dev/null differ
diff --git a/icon-themes/galaxy/brand/shell/backing_right.png b/icon-themes/galaxy/brand/shell/backing_right.png
deleted file mode 100644
index 900501a..0000000
Binary files a/icon-themes/galaxy/brand/shell/backing_right.png and /dev/null differ
diff --git a/icon-themes/galaxy/brand/shell/backing_rtl_left.png b/icon-themes/galaxy/brand/shell/backing_rtl_left.png
deleted file mode 100644
index 689f52e..0000000
Binary files a/icon-themes/galaxy/brand/shell/backing_rtl_left.png and /dev/null differ
diff --git a/icon-themes/galaxy/brand/shell/backing_rtl_right.png b/icon-themes/galaxy/brand/shell/backing_rtl_right.png
deleted file mode 100644
index 900501a..0000000
Binary files a/icon-themes/galaxy/brand/shell/backing_rtl_right.png and /dev/null differ
diff --git a/icon-themes/galaxy/brand/shell/backing_space.png b/icon-themes/galaxy/brand/shell/backing_space.png
deleted file mode 100644
index ae4b309..0000000
Binary files a/icon-themes/galaxy/brand/shell/backing_space.png and /dev/null differ
diff --git a/icon-themes/hicontrast/brand/shell/backing_left.png b/icon-themes/hicontrast/brand/shell/backing_left.png
deleted file mode 100644
index eb6f045..0000000
Binary files a/icon-themes/hicontrast/brand/shell/backing_left.png and /dev/null differ
diff --git a/icon-themes/hicontrast/brand/shell/backing_right.png b/icon-themes/hicontrast/brand/shell/backing_right.png
deleted file mode 100644
index 4b59798..0000000
Binary files a/icon-themes/hicontrast/brand/shell/backing_right.png and /dev/null differ
diff --git a/icon-themes/hicontrast/brand/shell/backing_rtl_left.png b/icon-themes/hicontrast/brand/shell/backing_rtl_left.png
deleted file mode 100644
index eb6f045..0000000
Binary files a/icon-themes/hicontrast/brand/shell/backing_rtl_left.png and /dev/null differ
diff --git a/icon-themes/hicontrast/brand/shell/backing_rtl_right.png b/icon-themes/hicontrast/brand/shell/backing_rtl_right.png
deleted file mode 100644
index 4b59798..0000000
Binary files a/icon-themes/hicontrast/brand/shell/backing_rtl_right.png and /dev/null differ
diff --git a/icon-themes/hicontrast/brand/shell/backing_space.png b/icon-themes/hicontrast/brand/shell/backing_space.png
deleted file mode 100644
index 9b1b268..0000000
Binary files a/icon-themes/hicontrast/brand/shell/backing_space.png and /dev/null differ
diff --git a/icon-themes/human/framework/res/backing_right.png b/icon-themes/human/framework/res/backing_right.png
deleted file mode 100644
index 00a0b1c..0000000
Binary files a/icon-themes/human/framework/res/backing_right.png and /dev/null differ
diff --git a/icon-themes/human/framework/res/backing_rtl_left.png b/icon-themes/human/framework/res/backing_rtl_left.png
deleted file mode 100644
index 70354d5..0000000
Binary files a/icon-themes/human/framework/res/backing_rtl_left.png and /dev/null differ
diff --git a/icon-themes/human/framework/res/backing_space.png b/icon-themes/human/framework/res/backing_space.png
deleted file mode 100644
index 9f0a49f..0000000
Binary files a/icon-themes/human/framework/res/backing_space.png and /dev/null differ
commit 4ce1300fbacbae59f706c1c363a1857aa3e7158c
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Mon Feb 3 17:16:48 2014 +0100

    thumbnails: Nobody uses the overlay functionality now, kill it.
    
    Change-Id: I74c463b67dd950a3e4de838ed0dc55ec366ab8a7

diff --git a/include/vcl/gdimtf.hxx b/include/vcl/gdimtf.hxx
index d7de82f..a922709 100644
--- a/include/vcl/gdimtf.hxx
+++ b/include/vcl/gdimtf.hxx
@@ -213,8 +213,8 @@ public:
     friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, GDIMetaFile& rGDIMetaFile );
     friend VCL_DLLPUBLIC SvStream& WriteGDIMetaFile( SvStream& rOStm, const GDIMetaFile& rGDIMetaFile );
 
-    /// Creates an antialiased thumbnail, with maximum height or width of nMaximumExtent.
-    sal_Bool        CreateThumbnail( BitmapEx& rBmpEx, sal_uInt32 nMaximumSize = 256, const BitmapEx* pOverlay = NULL, const Rectangle* pOverlayRect = NULL ) const;
+    /// Creates an antialiased thumbnail, with maximum width or height of nMaximumExtent.
+    sal_Bool        CreateThumbnail(BitmapEx& rBmpEx, sal_uInt32 nMaximumSize = 256) const;
 
     void            UseCanvas( sal_Bool _bUseCanvas );
     sal_Bool        GetUseCanvas() const { return bUseCanvas; }
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index 9609d48..cdef014 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -2869,8 +2869,7 @@ SvStream& GDIMetaFile::Write( SvStream& rOStm )
     return rOStm;
 }
 
-sal_Bool GDIMetaFile::CreateThumbnail(BitmapEx& rBmpEx, sal_uInt32 nMaximumExtent,
-        const BitmapEx* pOverlay, const Rectangle* pOverlayRect) const
+sal_Bool GDIMetaFile::CreateThumbnail(BitmapEx& rBmpEx, sal_uInt32 nMaximumExtent) const
 {
     // initialization seems to be complicated but is used to avoid rounding errors
     VirtualDevice   aVDev;
@@ -2909,45 +2908,19 @@ sal_Bool GDIMetaFile::CreateThumbnail(BitmapEx& rBmpEx, sal_uInt32 nMaximumExten
         aDrawSize.Height() = FRound( ( static_cast< double >( aDrawSize.Height() ) * aSizePix.Height() ) / aOldSizePix.Height() );
     }
 
-    Size        aFullSize;
-    Point       aBackPosPix;
-    Rectangle   aOverlayRect;
-
-    // calculate additional positions and sizes if an overlay image is used
-    if (pOverlay)
-    {
-        aFullSize = Size( nMaximumExtent, nMaximumExtent );
-        aOverlayRect = Rectangle( aNullPt, aFullSize  );
-
-        aOverlayRect.Intersection( pOverlayRect ? *pOverlayRect : Rectangle( aNullPt, pOverlay->GetSizePixel() ) );
-
-        if ( !aOverlayRect.IsEmpty() )
-            aBackPosPix = Point( ( nMaximumExtent - aSizePix.Width() ) >> 1, ( nMaximumExtent - aSizePix.Height() ) >> 1 );
-        else
-            pOverlay = NULL;
-    }
-    else
-    {
-        aFullSize = aSizePix;
-        pOverlay = NULL;
-    }
-
     // draw image(s) into VDev and get resulting image
     // do it 4x larger to be able to scale it down & get beautiful antialias
-    Size aAntialiasSize(aFullSize.Width() * 4, aFullSize.Height() * 4);
+    Size aAntialiasSize(aSizePix.Width() * 4, aSizePix.Height() * 4);
     if (aVDev.SetOutputSizePixel(aAntialiasSize))
     {
         // antialias: provide 4x larger size, and then scale down the result
         Size aAntialias(aDrawSize.Width() * 4, aDrawSize.Height() * 4);
 
         // draw metafile into VDev
+        Point aBackPosPix;
         const_cast<GDIMetaFile *>(this)->WindStart();
         const_cast<GDIMetaFile *>(this)->Play(&aVDev, aBackPosPix, aAntialias);
 
-        // draw overlay if necessary
-        if ( pOverlay )
-            aVDev.DrawBitmapEx( aOverlayRect.TopLeft(), aOverlayRect.GetSize(), *pOverlay );
-
         // get paint bitmap
         Bitmap aBmp( aVDev.GetBitmap( aNullPt, aVDev.GetOutputSizePixel() ) );
 
commit cd5bc4974d173cc38a95254302d165afc4faf159
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Mon Feb 3 16:26:28 2014 +0100

    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

diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx
index 8cf31db..937e561 100644
--- a/include/sfx2/objsh.hxx
+++ b/include/sfx2/objsh.hxx
@@ -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 );
 
diff --git a/sfx2/source/doc/doc.hrc b/sfx2/source/doc/doc.hrc
index bcdbb71..99506ec 100644
--- a/sfx2/source/doc/doc.hrc
+++ b/sfx2/source/doc/doc.hrc
@@ -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)
diff --git a/sfx2/source/doc/graphhelp.cxx b/sfx2/source/doc/graphhelp.cxx
index 515384e..12482c2 100644
--- a/sfx2/source/doc/graphhelp.cxx
+++ b/sfx2/source/doc/graphhelp.cxx
@@ -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 )
 {
diff --git a/sfx2/source/doc/graphhelp.hxx b/sfx2/source/doc/graphhelp.hxx
index 7f41f71..8acec37 100644
--- a/sfx2/source/doc/graphhelp.hxx
+++ b/sfx2/source/doc/graphhelp.hxx
@@ -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,
diff --git a/sfx2/source/doc/graphhelp.src b/sfx2/source/doc/graphhelp.src
index 177c045..db2357f 100644
--- a/sfx2/source/doc/graphhelp.src
+++ b/sfx2/source/doc/graphhelp.src
@@ -19,11 +19,6 @@
 
 #include "doc.hrc"
 
-Bitmap BMP_SIGNATURE
-{
-    File = "signet.png";
-};
-
 Bitmap BMP_128X128_CALC_DOC
 {
     File = "128x128_calc_doc-p.png";
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 4a9a2bc..32bf234 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -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);
                 }
             }
         }
commit 1e8c4b769774226ae16dbb308e89e9a5fd0adde1
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Mon Feb 3 15:59:05 2014 +0100

    thumbnails: Provide the size as a default parameter.
    
    And increase it consistently to 256 pixels.
    
    Change-Id: I123e11d597269d7e43298504f1dbd0098c9b0149

diff --git a/include/vcl/gdimtf.hxx b/include/vcl/gdimtf.hxx
index d14d6a2..d7de82f 100644
--- a/include/vcl/gdimtf.hxx
+++ b/include/vcl/gdimtf.hxx
@@ -213,7 +213,8 @@ public:
     friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, GDIMetaFile& rGDIMetaFile );
     friend VCL_DLLPUBLIC SvStream& WriteGDIMetaFile( SvStream& rOStm, const GDIMetaFile& rGDIMetaFile );
 
-    sal_Bool        CreateThumbnail( sal_uInt32 nMaximumExtent, BitmapEx& rBmpEx, const BitmapEx* pOverlay = NULL, const Rectangle* pOverlayRect = NULL ) const;
+    /// Creates an antialiased thumbnail, with maximum height or width of nMaximumExtent.
+    sal_Bool        CreateThumbnail( BitmapEx& rBmpEx, sal_uInt32 nMaximumSize = 256, const BitmapEx* pOverlay = NULL, const Rectangle* pOverlayRect = NULL ) const;
 
     void            UseCanvas( sal_Bool _bUseCanvas );
     sal_Bool        GetUseCanvas() const { return bUseCanvas; }
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index 21fd8b5..1aaa1c1 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -1111,8 +1111,7 @@ Any SAL_CALL SdGenericDrawPage::getPropertyValue( const OUString& PropertyName )
                     ::boost::shared_ptr<GDIMetaFile> pMetaFile =
                         pDocShell->GetPreviewMetaFile();
                     BitmapEx aBitmap;
-                    if ( pMetaFile && pMetaFile->CreateThumbnail( 160, /* magic value taken from GraphicHelper::getThumbnailFormatFromGDI_Impl() */
-                                                                  aBitmap ) )
+                    if (pMetaFile && pMetaFile->CreateThumbnail(aBitmap))
                     {
                         SvMemoryStream aMemStream;
                         WriteDIB(aBitmap.GetBitmap(), aMemStream, false, false);
diff --git a/sfx2/source/doc/docinf.cxx b/sfx2/source/doc/docinf.cxx
index a5f967f..f3c56bd 100644
--- a/sfx2/source/doc/docinf.cxx
+++ b/sfx2/source/doc/docinf.cxx
@@ -306,8 +306,8 @@ uno::Sequence<sal_uInt8> SFX2_DLLPUBLIC convertMetaFile(GDIMetaFile* i_pThumb)
     if (i_pThumb) {
         BitmapEx aBitmap;
         SvMemoryStream aStream;
-// magic value 160 taken from GraphicHelper::getThumbnailFormatFromGDI_Impl()
-        if( i_pThumb->CreateThumbnail( 160, aBitmap ) ) {
+        if (i_pThumb->CreateThumbnail(aBitmap))
+        {
             WriteDIB(aBitmap.GetBitmap(), aStream, false, false);
             aStream.Seek(STREAM_SEEK_TO_END);
             uno::Sequence<sal_uInt8> aSeq(aStream.Tell());
diff --git a/sfx2/source/doc/graphhelp.cxx b/sfx2/source/doc/graphhelp.cxx
index 7cd16ee..515384e 100644
--- a/sfx2/source/doc/graphhelp.cxx
+++ b/sfx2/source/doc/graphhelp.cxx
@@ -283,7 +283,7 @@ sal_Bool GraphicHelper::getThumbnailFormatFromGDI_Impl( GDIMetaFile* pMetaFile,
         if ( bSigned )
             pSignatureBitmap = new BitmapEx( SfxResId( BMP_SIGNATURE ) );
 
-        bResult = pMetaFile->CreateThumbnail(THUMBNAIL_RESOLUTION, aResultBitmap, pSignatureBitmap);
+        bResult = pMetaFile->CreateThumbnail(aResultBitmap, THUMBNAIL_RESOLUTION, pSignatureBitmap);
 
         if ( bResult )
             bResult = ( !aResultBitmap.IsEmpty()
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index d5bff9d..9609d48 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -2869,10 +2869,8 @@ SvStream& GDIMetaFile::Write( SvStream& rOStm )
     return rOStm;
 }
 
-sal_Bool GDIMetaFile::CreateThumbnail( sal_uInt32 nMaximumExtent,
-                                    BitmapEx& rBmpEx,
-                                    const BitmapEx* pOverlay,
-                                    const Rectangle* pOverlayRect ) const
+sal_Bool GDIMetaFile::CreateThumbnail(BitmapEx& rBmpEx, sal_uInt32 nMaximumExtent,
+        const BitmapEx* pOverlay, const Rectangle* pOverlayRect) const
 {
     // initialization seems to be complicated but is used to avoid rounding errors
     VirtualDevice   aVDev;
commit 05857ac3232ee88dc9a2bde4c135f07dd25b4c91
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Mon Feb 3 13:04:06 2014 +0100

    thumbnails: Consolidate code.
    
    There were 2 copies of the thumbnailing code; consolidate that to one copy
    directly in VCL.
    
    This kills the attempts to do alpha channel that used to be in the VCL copy of
    the code - it was producing wrong results, the bitmaps ended up empty.
    
    Change-Id: I415c410c287a95e75293bdcba5d71083d1d01dc1

diff --git a/sfx2/source/doc/graphhelp.cxx b/sfx2/source/doc/graphhelp.cxx
index c74042d..7cd16ee 100644
--- a/sfx2/source/doc/graphhelp.cxx
+++ b/sfx2/source/doc/graphhelp.cxx
@@ -264,108 +264,6 @@ sal_Bool GraphicHelper::mergeBitmaps_Impl( const BitmapEx& rBmpEx, const BitmapE
     return !rReturn.IsEmpty();
 }
 
-
-//---------------------------------------------------------------
-// static
-sal_Bool GraphicHelper::createThumb_Impl( const GDIMetaFile& rMtf,
-                       sal_uInt32 nMaximumExtent,
-                       BitmapEx& rBmpEx,
-                       const BitmapEx* pOverlay,
-                       const Rectangle* pOverlayRect )
-{
-    // the implementation is provided by KA
-
-    // initialization seems to be complicated but is used to avoid rounding errors
-    VirtualDevice   aVDev;
-    const Point     aNullPt;
-    const Point     aTLPix( aVDev.LogicToPixel( aNullPt, rMtf.GetPrefMapMode() ) );
-    const Point     aBRPix( aVDev.LogicToPixel( Point( rMtf.GetPrefSize().Width() - 1, rMtf.GetPrefSize().Height() - 1 ), rMtf.GetPrefMapMode() ) );
-    Size            aDrawSize( aVDev.LogicToPixel( rMtf.GetPrefSize(), rMtf.GetPrefMapMode() ) );
-    Size            aSizePix( labs( aBRPix.X() - aTLPix.X() ) + 1, labs( aBRPix.Y() - aTLPix.Y() ) + 1 );
-
-    if ( !rBmpEx.IsEmpty() )
-        rBmpEx.SetEmpty();
-
-    // determine size that has the same aspect ratio as image size and
-    // fits into the rectangle determined by nMaximumExtent
-    if ( aSizePix.Width() && aSizePix.Height() &&
-            ( sal::static_int_cast<sal_uInt32>(aSizePix.Width()) > nMaximumExtent ||
-              sal::static_int_cast<sal_uInt32>(aSizePix.Height()) > nMaximumExtent ) )
-    {
-        const Size  aOldSizePix( aSizePix );
-        double      fWH = static_cast< double >( aSizePix.Width() ) / aSizePix.Height();
-
-        if ( fWH <= 1.0 )
-        {
-            aSizePix.Width() = FRound( nMaximumExtent * fWH );
-            aSizePix.Height() = nMaximumExtent;
-        }
-        else
-        {
-            aSizePix.Width() = nMaximumExtent;
-            aSizePix.Height() = FRound(  nMaximumExtent / fWH );
-        }
-
-        aDrawSize.Width() = FRound( ( static_cast< double >( aDrawSize.Width() ) * aSizePix.Width() ) / aOldSizePix.Width() );
-        aDrawSize.Height() = FRound( ( static_cast< double >( aDrawSize.Height() ) * aSizePix.Height() ) / aOldSizePix.Height() );
-    }
-
-    Size        aFullSize;
-    Point       aBackPosPix;
-    Rectangle   aOverlayRect;
-
-    // calculate additional positions and sizes if an overlay image is used
-    if (  pOverlay )
-    {
-        aFullSize = Size( nMaximumExtent, nMaximumExtent );
-        aOverlayRect = Rectangle( aNullPt, aFullSize  );
-
-        aOverlayRect.Intersection( pOverlayRect ? *pOverlayRect : Rectangle( aNullPt, pOverlay->GetSizePixel() ) );
-
-        if ( !aOverlayRect.IsEmpty() )
-            aBackPosPix = Point( ( nMaximumExtent - aSizePix.Width() ) >> 1, ( nMaximumExtent - aSizePix.Height() ) >> 1 );
-        else
-            pOverlay = NULL;
-    }
-    else
-    {
-        aFullSize = aSizePix;
-        pOverlay = NULL;
-    }
-
-    // draw image(s) into VDev and get resulting image
-    // do it 4x larger to be able to scale it down & get beautiful antialias
-    Size aAntialiasSize(aFullSize.Width() * 4, aFullSize.Height() * 4);
-    if (aVDev.SetOutputSizePixel(aAntialiasSize))
-    {
-        // antialias: provide 4x larger size, and then scale down the result
-        Size aAntialias(aDrawSize.Width() * 4, aDrawSize.Height() * 4);
-
-        // draw metafile into VDev
-        const_cast< GDIMetaFile& >( rMtf ).WindStart();
-        const_cast< GDIMetaFile& >( rMtf ).Play( &aVDev, aBackPosPix, aAntialias );
-
-        // draw overlay if necessary
-        if ( pOverlay )
-            aVDev.DrawBitmapEx( aOverlayRect.TopLeft(), aOverlayRect.GetSize(), *pOverlay );
-
-        // get paint bitmap
-        Bitmap aBmp( aVDev.GetBitmap( aNullPt, aVDev.GetOutputSizePixel() ) );
-
-        // assure that we have a true color image
-        if ( aBmp.GetBitCount() != 24 )
-            aBmp.Convert( BMP_CONVERSION_24BIT );
-
-        // downsize, to get the antialiased picture
-        aBmp.Scale(aDrawSize, BMP_SCALE_BESTQUALITY);
-
-        rBmpEx = BitmapEx( aBmp );
-    }
-
-    return !rBmpEx.IsEmpty();
-}
-
-//---------------------------------------------------------------
 // static
 sal_Bool GraphicHelper::getThumbnailFormatFromGDI_Impl( GDIMetaFile* pMetaFile,
                                                         sal_Bool bSigned,
@@ -385,10 +283,8 @@ sal_Bool GraphicHelper::getThumbnailFormatFromGDI_Impl( GDIMetaFile* pMetaFile,
         if ( bSigned )
             pSignatureBitmap = new BitmapEx( SfxResId( BMP_SIGNATURE ) );
 
-        bResult = createThumb_Impl( *pMetaFile,
-                                       THUMBNAIL_RESOLUTION,
-                                       aResultBitmap,
-                                    pSignatureBitmap );
+        bResult = pMetaFile->CreateThumbnail(THUMBNAIL_RESOLUTION, aResultBitmap, pSignatureBitmap);
+
         if ( bResult )
             bResult = ( !aResultBitmap.IsEmpty()
                         && GraphicConverter::Export( *pStream, aResultBitmap, CVT_PNG ) == 0
diff --git a/sfx2/source/doc/graphhelp.hxx b/sfx2/source/doc/graphhelp.hxx
index 4fd2996..7f41f71 100644
--- a/sfx2/source/doc/graphhelp.hxx
+++ b/sfx2/source/doc/graphhelp.hxx
@@ -34,12 +34,6 @@ class GraphicHelper
     static sal_Bool mergeBitmaps_Impl( const BitmapEx& rBmpEx, const BitmapEx& rOverlay,
                    const Rectangle& rOverlayRect, BitmapEx& rReturn );
 
-    static sal_Bool createThumb_Impl( const GDIMetaFile& rMtf,
-                       sal_uInt32 nMaximumExtent,
-                       BitmapEx& rBmpEx,
-                       const BitmapEx* pOverlay = NULL,
-                       const Rectangle* pOverlayRect = NULL );
-
 public:
 
     static SvMemoryStream* getFormatStrFromGDI_Impl( const GDIMetaFile* pGDIMeta, sal_uInt32 nFormat );
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index 23566cf..d5bff9d 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -2915,8 +2915,8 @@ sal_Bool GDIMetaFile::CreateThumbnail( sal_uInt32 nMaximumExtent,
     Point       aBackPosPix;
     Rectangle   aOverlayRect;
 
-    // calculate addigtional positions and sizes if an overlay image is used
-    if (  pOverlay )
+    // calculate additional positions and sizes if an overlay image is used
+    if (pOverlay)
     {
         aFullSize = Size( nMaximumExtent, nMaximumExtent );
         aOverlayRect = Rectangle( aNullPt, aFullSize  );
@@ -2935,11 +2935,16 @@ sal_Bool GDIMetaFile::CreateThumbnail( sal_uInt32 nMaximumExtent,
     }
 
     // draw image(s) into VDev and get resulting image
-    if ( aVDev.SetOutputSizePixel( aFullSize ) )
+    // do it 4x larger to be able to scale it down & get beautiful antialias
+    Size aAntialiasSize(aFullSize.Width() * 4, aFullSize.Height() * 4);
+    if (aVDev.SetOutputSizePixel(aAntialiasSize))
     {
+        // antialias: provide 4x larger size, and then scale down the result
+        Size aAntialias(aDrawSize.Width() * 4, aDrawSize.Height() * 4);
+
         // draw metafile into VDev
         const_cast<GDIMetaFile *>(this)->WindStart();
-        const_cast<GDIMetaFile *>(this)->Play( &aVDev, aBackPosPix, aDrawSize );
+        const_cast<GDIMetaFile *>(this)->Play(&aVDev, aBackPosPix, aAntialias);
 
         // draw overlay if necessary
         if ( pOverlay )
@@ -2952,32 +2957,10 @@ sal_Bool GDIMetaFile::CreateThumbnail( sal_uInt32 nMaximumExtent,
         if ( aBmp.GetBitCount() != 24 )
             aBmp.Convert( BMP_CONVERSION_24BIT );
 
-        // create resulting mask bitmap with metafile output set to black
-        GDIMetaFile aMonchromeMtf( GetMonochromeMtf( COL_BLACK ) );
-        aVDev.DrawWallpaper( Rectangle( aNullPt, aSizePix ), Wallpaper( Color( COL_WHITE ) ) );
-        aMonchromeMtf.WindStart();
-        aMonchromeMtf.Play( &aVDev, aBackPosPix, aDrawSize );
-
-        // watch for overlay mask
-        if ( pOverlay  )
-        {
-            Bitmap aOverlayMergeBmp( aVDev.GetBitmap( aOverlayRect.TopLeft(), aOverlayRect.GetSize() ) );
-
-            // create ANDed resulting mask at overlay area
-            if ( pOverlay->IsTransparent() )
-                aVDev.DrawBitmap( aOverlayRect.TopLeft(), aOverlayRect.GetSize(), pOverlay->GetMask() );
-            else
-            {
-                aVDev.SetLineColor( COL_BLACK );
-                aVDev.SetFillColor( COL_BLACK );
-                aVDev.DrawRect( aOverlayRect);
-            }
-
-            aOverlayMergeBmp.CombineSimple( aVDev.GetBitmap( aOverlayRect.TopLeft(), aOverlayRect.GetSize() ), BMP_COMBINE_AND );
-            aVDev.DrawBitmap( aOverlayRect.TopLeft(), aOverlayRect.GetSize(), aOverlayMergeBmp );
-        }
+        // downsize, to get the antialiased picture
+        aBmp.Scale(aDrawSize, BMP_SCALE_BESTQUALITY);
 
-        rBmpEx = BitmapEx( aBmp, aVDev.GetBitmap( aNullPt, aVDev.GetOutputSizePixel() ) );
+        rBmpEx = BitmapEx(aBmp);
     }
 
     return !rBmpEx.IsEmpty();
commit 86652eb4f74279a360f5fac160b4b4a66c9bc600
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Mon Feb 3 11:27:30 2014 +0100

    Document a bit.
    
    Change-Id: Ic62acc3eeb4e3526cc6b7366f51f5f3bf69528c1

diff --git a/sw/source/ui/inc/wrtsh.hxx b/sw/source/ui/inc/wrtsh.hxx
index 2b1c922..8ec265c 100644
--- a/sw/source/ui/inc/wrtsh.hxx
+++ b/sw/source/ui/inc/wrtsh.hxx
@@ -73,7 +73,11 @@ namespace nsSelectionType
     const SelectionType SEL_POSTIT          = 0x020000; //annotation
 }
 
+/** Used by the UI to modify the document model.
 
+Eg. the Insert() method will take the current cursor position, insert the
+string, and take care of undo etc.
+*/
 class SW_DLLPUBLIC SwWrtShell: public SwFEShell
 {
 private:


More information about the Libreoffice-commits mailing list