[Libreoffice-commits] core.git: 2 commits - comphelper/inc comphelper/source sd/source xmloff/source

Michael Stahl mstahl at redhat.com
Fri Mar 22 07:27:23 PDT 2013


 comphelper/inc/comphelper/propertysethelper.hxx  |   10 ++++-----
 comphelper/source/property/propertysethelper.cxx |   11 +++++++---
 sd/source/ui/unoidl/UnoDocumentSettings.cxx      |   25 +++++++++++++++++------
 xmloff/source/draw/sdxmlexp.cxx                  |   15 ++++++++++---
 4 files changed, 43 insertions(+), 18 deletions(-)

New commits:
commit 3605407693c83e5e5e0af6f7ec4a3863bc7178b0
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Mar 22 14:24:13 2013 +0100

    sd::DocumentSettings: throwing UnknownPropertyException ...
    
    ... for properties that are in the PropertySetInfo just because there's
    no document or shell is just plain wrong.
    
    Change-Id: I84f4f930f492753b20ba04ec4d41c905d674b9ba

diff --git a/comphelper/inc/comphelper/propertysethelper.hxx b/comphelper/inc/comphelper/propertysethelper.hxx
index 6aa647f..c9f1b4d 100644
--- a/comphelper/inc/comphelper/propertysethelper.hxx
+++ b/comphelper/inc/comphelper/propertysethelper.hxx
@@ -46,12 +46,12 @@ private:
     PropertySetHelperImpl* mp;
 
 protected:
-    virtual void _setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const ::com::sun::star::uno::Any* pValues ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) = 0;
-    virtual void _getPropertyValues( const comphelper::PropertyMapEntry** ppEntries, ::com::sun::star::uno::Any* pValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException ) = 0;
+    virtual void _setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const ::com::sun::star::uno::Any* pValues ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException ) = 0;
+    virtual void _getPropertyValues( const comphelper::PropertyMapEntry** ppEntries, ::com::sun::star::uno::Any* pValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException ) = 0;
 
-    virtual void _getPropertyStates( const comphelper::PropertyMapEntry** ppEntries, ::com::sun::star::beans::PropertyState* pStates ) throw(::com::sun::star::beans::UnknownPropertyException );
-    virtual void _setPropertyToDefault( const comphelper::PropertyMapEntry* pEntry )  throw(::com::sun::star::beans::UnknownPropertyException );
-    virtual ::com::sun::star::uno::Any _getPropertyDefault( const comphelper::PropertyMapEntry* pEntry ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException );
+    virtual void _getPropertyStates( const comphelper::PropertyMapEntry** ppEntries, ::com::sun::star::beans::PropertyState* pStates ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException );
+    virtual void _setPropertyToDefault( const comphelper::PropertyMapEntry* pEntry )  throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException );
+    virtual ::com::sun::star::uno::Any _getPropertyDefault( const comphelper::PropertyMapEntry* pEntry ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
 
 public:
     PropertySetHelper( comphelper::PropertySetInfo* pInfo ) throw();
diff --git a/comphelper/source/property/propertysethelper.cxx b/comphelper/source/property/propertysethelper.cxx
index 979f1c9..27b4c0e 100644
--- a/comphelper/source/property/propertysethelper.cxx
+++ b/comphelper/source/property/propertysethelper.cxx
@@ -282,17 +282,22 @@ Any SAL_CALL PropertySetHelper::getPropertyDefault( const ::rtl::OUString& aProp
     return _getPropertyDefault( pEntry );
 }
 
-void PropertySetHelper::_getPropertyStates( const comphelper::PropertyMapEntry**, PropertyState* ) throw(UnknownPropertyException )
+void PropertySetHelper::_getPropertyStates(
+        const comphelper::PropertyMapEntry**, PropertyState*)
+throw (UnknownPropertyException, RuntimeException)
 {
     OSL_FAIL( "you have to implement this yourself!");
 }
 
-void PropertySetHelper::_setPropertyToDefault( const comphelper::PropertyMapEntry* )  throw(UnknownPropertyException )
+void
+PropertySetHelper::_setPropertyToDefault(const comphelper::PropertyMapEntry*)
+throw (UnknownPropertyException, RuntimeException)
 {
     OSL_FAIL( "you have to implement this yourself!");
 }
 
-Any PropertySetHelper::_getPropertyDefault( const comphelper::PropertyMapEntry* ) throw(UnknownPropertyException, WrappedTargetException )
+Any PropertySetHelper::_getPropertyDefault(const comphelper::PropertyMapEntry*)
+throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
 {
     OSL_FAIL( "you have to implement this yourself!");
 
diff --git a/sd/source/ui/unoidl/UnoDocumentSettings.cxx b/sd/source/ui/unoidl/UnoDocumentSettings.cxx
index e9d6f65..2711af2 100644
--- a/sd/source/ui/unoidl/UnoDocumentSettings.cxx
+++ b/sd/source/ui/unoidl/UnoDocumentSettings.cxx
@@ -111,8 +111,8 @@ namespace sd
                                        const uno::Sequence<beans::PropertyValue>& aConfigProps );
 
     protected:
-        virtual void _setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const ::com::sun::star::uno::Any* pValues ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
-        virtual void _getPropertyValues( const comphelper::PropertyMapEntry** ppEntries, ::com::sun::star::uno::Any* pValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException );
+        virtual void _setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const ::com::sun::star::uno::Any* pValues ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, RuntimeException );
+        virtual void _getPropertyValues( const comphelper::PropertyMapEntry** ppEntries, ::com::sun::star::uno::Any* pValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, RuntimeException );
 
     private:
         bool LoadList( XPropertyListType t, const rtl::OUString &rPath,
@@ -388,14 +388,21 @@ uno::Sequence<beans::PropertyValue>
     return aRet;
 }
 
-void DocumentSettings::_setPropertyValues( const PropertyMapEntry** ppEntries, const Any* pValues ) throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException )
+void
+DocumentSettings::_setPropertyValues(const PropertyMapEntry** ppEntries,
+        const Any* pValues)
+throw (UnknownPropertyException, PropertyVetoException,
+    IllegalArgumentException, WrappedTargetException, RuntimeException)
 {
     ::SolarMutexGuard aGuard;
 
     SdDrawDocument* pDoc = mpModel->GetDoc();
     ::sd::DrawDocShell* pDocSh = mpModel->GetDocShell();
     if( NULL == pDoc || NULL == pDocSh )
-        throw UnknownPropertyException();
+    {
+        throw RuntimeException("Document or Shell missing",
+                static_cast<OWeakObject *>(this));
+    }
 
     sal_Bool bValue = sal_False;
     bool bOk, bChanged = false, bOptionsChanged = false;
@@ -949,14 +956,20 @@ void DocumentSettings::ExtractURL( XPropertyListType t, Any* pValue )
     *pValue <<= aPath;
 }
 
-void DocumentSettings::_getPropertyValues( const PropertyMapEntry** ppEntries, Any* pValue ) throw(UnknownPropertyException, WrappedTargetException )
+void
+DocumentSettings::_getPropertyValues(
+        const PropertyMapEntry** ppEntries, Any* pValue)
+throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
 {
     ::SolarMutexGuard aGuard;
 
     SdDrawDocument* pDoc = mpModel->GetDoc();
     ::sd::DrawDocShell* pDocSh = mpModel->GetDocShell();
     if( NULL == pDoc || NULL == pDocSh )
-        throw UnknownPropertyException();
+    {
+        throw RuntimeException("Document or Shell missing",
+                static_cast<OWeakObject *>(this));
+    }
 
     SdOptionsPrintItem aOptionsPrintItem( ATTR_OPTIONS_PRINT );
 
commit cc85e44cfa7ce7ae49944535418c5735c560f0ad
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Mar 22 14:23:43 2013 +0100

    SdXMLExport::CreateFontAutoStylePool: "EmbedFonts": ignore exceptions
    
    (regression from f0cd6fe9075cd0aa00162474784ad804a07ed138)
    
    Change-Id: Ia86c0d168e9dd24555e7431666c0d783daef3b6a

diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx
index e2337d5..78563fb 100644
--- a/xmloff/source/draw/sdxmlexp.cxx
+++ b/xmloff/source/draw/sdxmlexp.cxx
@@ -2912,15 +2912,22 @@ OUString SAL_CALL SdXMLExport::getImplementationName() throw( uno::RuntimeExcept
 XMLFontAutoStylePool* SdXMLExport::CreateFontAutoStylePool()
 {
     bool bEmbedFonts = false;
-    if( getExportFlags() & EXPORT_CONTENT ) {
+    if (getExportFlags() & EXPORT_CONTENT)
+    {
         Reference< lang::XMultiServiceFactory > xFac( GetModel(), UNO_QUERY );
         if( xFac.is() )
+        {
+            Reference<beans::XPropertySet> const xProps( xFac->createInstance(
+                         "com.sun.star.document.Settings"), UNO_QUERY );
+            if (xProps.is())
             {
-                Reference< beans::XPropertySet > xProps( xFac->createInstance( OUString( "com.sun.star.document.Settings" ) ), UNO_QUERY );
-                if( xProps.is() )
+                try // clipboard document doesn't have shell so throws here
+                {
                     xProps->getPropertyValue("EmbedFonts") >>= bEmbedFonts;
-
+                }
+                catch (uno::Exception const&) { }
             }
+        }
     }
 
     XMLFontAutoStylePool *pPool = new XMLFontAutoStylePool( *this, bEmbedFonts );


More information about the Libreoffice-commits mailing list