summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2018-08-15 18:32:17 +0200
committerTomaž Vajngerl <quikee@gmail.com>2018-08-15 20:59:40 +0200
commit757b2438b172b3ef4560e533b3ce2a10f699f2bd (patch)
tree294289e32bd860a7abcabda8250876745fe33763
parent43b7aa5133ce3bfb44c5203aea37fa4474bc3a61 (diff)
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 <quikee@gmail.com>
-rw-r--r--xmloff/source/draw/sdxmlexp.cxx20
1 files changed, 14 insertions, 6 deletions
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
}
}