xmloff/source/draw/sdxmlexp.cxx |   20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

New commits:
commit 757b2438b172b3ef4560e533b3ce2a10f699f2bd
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Wed Aug 15 18:32:17 2018 +0200
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Wed Aug 15 20:59:40 2018 +0200

    tdf#118883 reinstate the try block to not throw on copy/paste
    
    Seems the defnesive approach wasn't enough to ward against the
    exception being thrown when creating a clipboard document when
    copy/pasting between documents.
    
    Change-Id: Iedcfbc6fe054b46fc26005b1ea0dbadbd21a08cb
    Reviewed-on: https://gerrit.libreoffice.org/59121
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx
index 29ce8b730135..d9eab3c6e21b 100644
--- a/xmloff/source/draw/sdxmlexp.cxx
+++ b/xmloff/source/draw/sdxmlexp.cxx
@@ -2716,13 +2716,17 @@ XMLFontAutoStylePool* 
SdXMLExport::CreateFontAutoStylePool()
 
     if (getExportFlags() & SvXMLExportFlags::CONTENT)
     {
-        Reference< lang::XMultiServiceFactory > xFac( GetModel(), UNO_QUERY );
-        if( xFac.is() )
+        try
         {
-            Reference<beans::XPropertySet> const 
xProps(xFac->createInstance("com.sun.star.document.Settings"), UNO_QUERY);
-            Reference<beans::XPropertySetInfo> const 
xInfo(xProps->getPropertySetInfo(), uno::UNO_QUERY);
-
-            if (xProps.is() && xInfo.is())
+            Reference<lang::XMultiServiceFactory> xFactory(GetModel(), 
UNO_QUERY);
+            Reference<beans::XPropertySet> xProps;
+            Reference<beans::XPropertySetInfo> xInfo;
+
+            if (xFactory.is())
+                
xProps.set(xFactory->createInstance("com.sun.star.document.Settings"), 
UNO_QUERY);
+            if (xProps.is())
+                xInfo.set(xProps->getPropertySetInfo(), uno::UNO_QUERY);
+            if (xInfo.is() && xProps.is())
             {
                 if (xInfo->hasPropertyByName("EmbedFonts"))
                     xProps->getPropertyValue("EmbedFonts") >>= bEmbedFonts;
@@ -2735,6 +2739,10 @@ XMLFontAutoStylePool* 
SdXMLExport::CreateFontAutoStylePool()
                 if (xInfo->hasPropertyByName("EmbedComplexScriptFonts"))
                     xProps->getPropertyValue("EmbedComplexScriptFonts") >>= 
bEmbedComplexScript;
             }
+        } catch(...)
+        {
+            // clipboard document doesn't have shell so throws from 
getPropertyValue
+            // gallery elements may not support com.sun.star.document.Settings 
so throws from createInstance
         }
     }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to