[Libreoffice-commits] core.git: 3 commits - embeddedobj/source include/svtools sc/source svtools/source sw/source vcl/README

Jan Holesovsky kendy at collabora.com
Tue Mar 4 14:05:41 PST 2014


 embeddedobj/source/msole/olepersist.cxx |   11 +++++------
 include/svtools/transfer.hxx            |   10 +++++++++-
 sc/source/ui/view/viewfun5.cxx          |    7 ++++++-
 svtools/source/misc/transfer.cxx        |    6 ++++--
 sw/source/ui/dochdl/swdtflvr.cxx        |    7 ++++++-
 vcl/README                              |   11 +++++++++++
 6 files changed, 41 insertions(+), 11 deletions(-)

New commits:
commit a94e973bf5b5d0755a53881867961691633a4cbd
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Tue Mar 4 22:49:08 2014 +0100

    OLE: Turn an OSL_ENSURE() into a real condition.
    
    This is part of some STAMPIT workaround; no idea what it is, but for sure it
    causes problems with PowerPoint OLE in Writer - so let's avoid updating if it
    is not "STAMPIT".
    
    Change-Id: I266b419ba3461c547f7ee8e447ef64a47a8511e8

diff --git a/embeddedobj/source/msole/olepersist.cxx b/embeddedobj/source/msole/olepersist.cxx
index 915a89a..264b920 100644
--- a/embeddedobj/source/msole/olepersist.cxx
+++ b/embeddedobj/source/msole/olepersist.cxx
@@ -888,13 +888,12 @@ void OleEmbeddedObject::OnViewChanged_Impl()
     // - if the verb execution is in progress and the view is changed the object will be stored
     // after the execution, so there is no need to send the notification.
     // - the STAMPIT object can never be active.
-    if ( m_aVerbExecutionController.CanDoNotification()
-      && m_pOleComponent && m_nUpdateMode == embed::EmbedUpdateModes::ALWAYS_UPDATE )
+    if (m_aVerbExecutionController.CanDoNotification() &&
+            m_pOleComponent && m_nUpdateMode == embed::EmbedUpdateModes::ALWAYS_UPDATE &&
+            (MimeConfigurationHelper::ClassIDsEqual(m_aClassID, MimeConfigurationHelper::GetSequenceClassID(0x852ee1c9, 0x9058, 0x44ba, 0x8c, 0x6c, 0x0c, 0x5f, 0xc6, 0x6b, 0xdb, 0x8d)) ||
+             MimeConfigurationHelper::ClassIDsEqual(m_aClassID, MimeConfigurationHelper::GetSequenceClassID(0xcf1b4491, 0xbea3, 0x4c9f, 0xa7, 0x0f, 0x22, 0x1b, 0x1e, 0xca, 0xef, 0x3e)))
+       )
     {
-        OSL_ENSURE( MimeConfigurationHelper::ClassIDsEqual( m_aClassID, MimeConfigurationHelper::GetSequenceClassID( 0x852ee1c9, 0x9058, 0x44ba, 0x8c,0x6c,0x0c,0x5f,0xc6,0x6b,0xdb,0x8d ) )
-                    || MimeConfigurationHelper::ClassIDsEqual( m_aClassID, MimeConfigurationHelper::GetSequenceClassID( 0xcf1b4491, 0xbea3, 0x4c9f, 0xa7,0x0f,0x22,0x1b,0x1e,0xca,0xef,0x3e ) ),
-                    "Expected to be triggered for STAMPIT only! Please contact developers!\n" );
-
         // The view is changed while the object is in running state, save the new object
         m_xCachedVisualRepresentation = uno::Reference< io::XStream >();
         SaveObject_Impl();
commit a6560b114af3c9a37a664d82b1ed36761e5d23ac
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Tue Mar 4 22:41:18 2014 +0100

    EMF+: Add info about logging.
    
    Change-Id: I72f2c7436df4f1189673d7ccce0d4ac47d338a31

diff --git a/vcl/README b/vcl/README
index c1fc0bf..76ee2bb 100644
--- a/vcl/README
+++ b/vcl/README
@@ -141,3 +141,14 @@ rendering:
 
 another interesting part is actual rendering into canvas bitmap and
 using that bitmap later in code using vcl API.
+
+EMF+ implementation has some extensive logging, best if you do a dbgutil
+build, and then
+
+export SAL_LOG=+INFO.cppcanvas.emf+INFO.vcl.emf
+
+before running LibreOffice; it will give you lots of useful hints.
+
+You can also fallback to EMF (from EMF+) rendering via
+
+export EMF_PLUS_DISABLE=1
commit be4f7ea3f6c8bddba3ca1ae3d9d9e67449bbc3cb
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Tue Mar 4 20:41:02 2014 +0100

    OLE preview: Limit the GDI metafile size to 100000 actions.
    
    Excel can copy huge metafiles to the clipboard, with over 3 million of
    actions, which are 1) unusable, and 2) crash LibreOffice because of their
    size.
    
    So let's just limit the size of metafiles to be under 100000 actions,
    otherwise use the 'OLE' bitmap.
    
    Change-Id: I6a50471e6fe6ab9417592c011bf78cad6247236b

diff --git a/include/svtools/transfer.hxx b/include/svtools/transfer.hxx
index 8980e88..969312b 100644
--- a/include/svtools/transfer.hxx
+++ b/include/svtools/transfer.hxx
@@ -321,7 +321,15 @@ public:
     sal_Bool                    GetBitmapEx( SotFormatStringId nFormat, BitmapEx& rBmp );
     sal_Bool                    GetBitmapEx( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, BitmapEx& rBmp );
 
-    sal_Bool                    GetGDIMetaFile( SotFormatStringId nFormat, GDIMetaFile& rMtf );
+    /** Return as GDI metafile.
+
+        @param nMaxAction Allows you to limit the amount of actions; defaults to 0 which means no limit.
+
+        Whet you eg. Ctrl+a in Excel, you can get the entire sheet as
+        metafile, with over 3 million (!) actions; which is just too large for
+        any reasonable handling - and you need to set a limit.
+    */
+    sal_Bool                    GetGDIMetaFile( SotFormatStringId nFormat, GDIMetaFile& rMtf, size_t nMaxActions = 0 );
     sal_Bool                    GetGDIMetaFile( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, GDIMetaFile& rMtf );
 
     sal_Bool                    GetGraphic( SotFormatStringId nFormat, Graphic& rGraphic );
diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx
index 3a44579..c4107ff 100644
--- a/sc/source/ui/view/viewfun5.cxx
+++ b/sc/source/ui/view/viewfun5.cxx
@@ -181,8 +181,13 @@ bool ScViewFunc::PasteDataFormat( sal_uLong nFormatId,
                     Graphic aGraphic;
                     sal_uLong nGrFormat = 0;
 
-                    if (aDataHelper.GetGraphic( FORMAT_GDIMETAFILE, aGraphic ) )
+                    // limit the size of the preview metafile to 100000 actions
+                    GDIMetaFile aMetafile;
+                    if (aDataHelper.GetGDIMetaFile(FORMAT_GDIMETAFILE, aMetafile, 100000))
+                    {
                         nGrFormat = SOT_FORMAT_GDIMETAFILE;
+                        aGraphic = aMetafile;
+                    }
 
                     // insert replacement image ( if there is one ) into the object helper
                     if ( nGrFormat )
diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx
index a7b6354..def8b3d 100644
--- a/svtools/source/misc/transfer.cxx
+++ b/svtools/source/misc/transfer.cxx
@@ -1777,10 +1777,12 @@ sal_Bool TransferableDataHelper::GetBitmapEx( const DataFlavor& rFlavor, BitmapE
 
 
 
-sal_Bool TransferableDataHelper::GetGDIMetaFile( SotFormatStringId nFormat, GDIMetaFile& rMtf )
+sal_Bool TransferableDataHelper::GetGDIMetaFile(SotFormatStringId nFormat, GDIMetaFile& rMtf, size_t nMaxActions)
 {
     DataFlavor aFlavor;
-    return( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) && GetGDIMetaFile( aFlavor, rMtf ) );
+    return SotExchange::GetFormatDataFlavor(nFormat, aFlavor) &&
+        GetGDIMetaFile(aFlavor, rMtf) &&
+        (nMaxActions == 0 || rMtf.GetActionSize() < nMaxActions);
 }
 
 
diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx
index 085115c..9d4acca 100644
--- a/sw/source/ui/dochdl/swdtflvr.cxx
+++ b/sw/source/ui/dochdl/swdtflvr.cxx
@@ -1816,8 +1816,13 @@ bool SwTransferable::_PasteOLE( TransferableDataHelper& rData, SwWrtShell& rSh,
             Graphic aGraphic;
             sal_uLong nGrFormat = 0;
 
-            if( rData.GetGraphic( FORMAT_GDIMETAFILE, aGraphic ) )
+            // limit the size of the preview metafile to 100000 actions
+            GDIMetaFile aMetafile;
+            if (rData.GetGDIMetaFile(FORMAT_GDIMETAFILE, aMetafile, 100000))
+            {
                 nGrFormat = SOT_FORMAT_GDIMETAFILE;
+                aGraphic = aMetafile;
+            }
 
             // insert replacement image ( if there is one ) into the object helper
             if ( nGrFormat )


More information about the Libreoffice-commits mailing list