[Libreoffice-commits] .: 2 commits - offapi/com reportdesign/inc reportdesign/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Nov 29 12:44:59 PST 2012


 offapi/com/sun/star/inspection/XPropertyHandler.idl   |    4 +++-
 offapi/com/sun/star/report/XReportComponent.idl       |   10 ++++++++--
 reportdesign/inc/ReportHelperDefines.hxx              |    4 ++--
 reportdesign/source/core/api/FixedLine.cxx            |    8 ++++++--
 reportdesign/source/core/inc/ReportHelperImpl.hxx     |    4 ++--
 reportdesign/source/ui/inc/GeometryHandler.hxx        |    2 +-
 reportdesign/source/ui/inspection/GeometryHandler.cxx |    2 +-
 7 files changed, 23 insertions(+), 11 deletions(-)

New commits:
commit 1fefd633220e5d9a7b1d511e3ebac7c008d97a97
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Thu Nov 29 15:53:28 2012 +0100

    fdo#57611 don't crash when setting too small size
    
    setHeight/Width needs to be authorized to throw com::sun::star::beans::PropertyVetoException, which is already handled adequately
    
    Change-Id: I077fbf7e3b871a59446fb3e23cc9fa1e2e9272a2

diff --git a/offapi/com/sun/star/inspection/XPropertyHandler.idl b/offapi/com/sun/star/inspection/XPropertyHandler.idl
index 0c24dbe..40f7210 100644
--- a/offapi/com/sun/star/inspection/XPropertyHandler.idl
+++ b/offapi/com/sun/star/inspection/XPropertyHandler.idl
@@ -25,6 +25,7 @@
 #include <com/sun/star/inspection/LineDescriptor.idl>
 #include <com/sun/star/lang/NullPointerException.idl>
 #include <com/sun/star/beans/UnknownPropertyException.idl>
+#include <com/sun/star/beans/PropertyVetoException.idl>
 #include <com/sun/star/lang/XComponent.idl>
 #include <com/sun/star/inspection/InteractiveSelectionResult.idl>
 
@@ -86,7 +87,8 @@ interface XPropertyHandler
     */
     void
         setPropertyValue( [in] string PropertyName, [in] any Value )
-        raises (::com::sun::star::beans::UnknownPropertyException);
+        raises (::com::sun::star::beans::UnknownPropertyException,
+                ::com::sun::star::beans::PropertyVetoException);
 
     /** returns the state of a property
 
diff --git a/offapi/com/sun/star/report/XReportComponent.idl b/offapi/com/sun/star/report/XReportComponent.idl
index f6e9d8c..148b75f 100644
--- a/offapi/com/sun/star/report/XReportComponent.idl
+++ b/offapi/com/sun/star/report/XReportComponent.idl
@@ -64,7 +64,10 @@ interface XReportComponent
 
     /** specifies the height of the control.
      */
-    [attribute,bound] long Height;
+    [attribute,bound] long Height
+    {
+        set raises ( com::sun::star::beans::PropertyVetoException );
+    };
 
     /** specifies the horizontal position of the control.
      */
@@ -76,7 +79,10 @@ interface XReportComponent
 
     /** specifies the width of the control.
      */
-    [attribute,bound] long Width;
+    [attribute,bound] long Width
+    {
+        set raises ( com::sun::star::beans::PropertyVetoException );
+    };
 
     /** specifies the border style of the control.
 
diff --git a/reportdesign/inc/ReportHelperDefines.hxx b/reportdesign/inc/ReportHelperDefines.hxx
index d0467cb..a54dea3 100644
--- a/reportdesign/inc/ReportHelperDefines.hxx
+++ b/reportdesign/inc/ReportHelperDefines.hxx
@@ -38,13 +38,13 @@
     virtual ::rtl::OUString SAL_CALL getName() throw (::com::sun::star::uno::RuntimeException); \
     virtual void SAL_CALL setName(const ::rtl::OUString & the_value) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::PropertyVetoException); \
     virtual ::sal_Int32 SAL_CALL getHeight() throw (::com::sun::star::uno::RuntimeException); \
-    virtual void SAL_CALL setHeight(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException); \
+    virtual void SAL_CALL setHeight(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::PropertyVetoException); \
     virtual ::sal_Int32 SAL_CALL getPositionX() throw (::com::sun::star::uno::RuntimeException); \
     virtual void SAL_CALL setPositionX(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException); \
     virtual ::sal_Int32 SAL_CALL getPositionY() throw (::com::sun::star::uno::RuntimeException); \
     virtual void SAL_CALL setPositionY(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException); \
     virtual ::sal_Int32 SAL_CALL getWidth() throw (::com::sun::star::uno::RuntimeException); \
-    virtual void SAL_CALL setWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException); \
+    virtual void SAL_CALL setWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::PropertyVetoException); \
     virtual ::sal_Int16 SAL_CALL getControlBorder() throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException); \
     virtual void SAL_CALL setControlBorder(::sal_Int16 the_value) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::beans::UnknownPropertyException); \
     virtual ::sal_Int32 SAL_CALL getControlBorderColor() throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException); \
diff --git a/reportdesign/source/core/inc/ReportHelperImpl.hxx b/reportdesign/source/core/inc/ReportHelperImpl.hxx
index 1b3bc04..1734998 100644
--- a/reportdesign/source/core/inc/ReportHelperImpl.hxx
+++ b/reportdesign/source/core/inc/ReportHelperImpl.hxx
@@ -33,7 +33,7 @@ void SAL_CALL clazz::setName( const ::rtl::OUString& _name ) throw (uno::Runtime
 { \
     return getSize().Height; \
 } \
-void SAL_CALL clazz::setHeight( ::sal_Int32 _height ) throw (uno::RuntimeException) \
+void SAL_CALL clazz::setHeight( ::sal_Int32 _height ) throw (uno::RuntimeException,beans::PropertyVetoException) \
 { \
     awt::Size aSize = getSize(); \
     aSize.Height = _height; \
@@ -63,7 +63,7 @@ void SAL_CALL clazz::setPositionY( ::sal_Int32 _positiony ) throw (uno::RuntimeE
 { \
     return getSize().Width; \
 } \
-void SAL_CALL clazz::setWidth( ::sal_Int32 _width ) throw (uno::RuntimeException) \
+void SAL_CALL clazz::setWidth( ::sal_Int32 _width ) throw (uno::RuntimeException,beans::PropertyVetoException) \
 { \
     awt::Size aSize = getSize(); \
     aSize.Width = _width; \
diff --git a/reportdesign/source/ui/inc/GeometryHandler.hxx b/reportdesign/source/ui/inc/GeometryHandler.hxx
index 08b71ef..e639500 100644
--- a/reportdesign/source/ui/inc/GeometryHandler.hxx
+++ b/reportdesign/source/ui/inc/GeometryHandler.hxx
@@ -258,7 +258,7 @@ namespace rptui
         // ::com::sun::star::inspection::XPropertyHandler:
         virtual void SAL_CALL inspect(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & Component) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::NullPointerException);
         virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(const ::rtl::OUString & PropertyName) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException);
-        virtual void SAL_CALL setPropertyValue(const ::rtl::OUString & PropertyName, const ::com::sun::star::uno::Any & Value) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException);
+        virtual void SAL_CALL setPropertyValue(const ::rtl::OUString & PropertyName, const ::com::sun::star::uno::Any & Value) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException);
         virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState(const ::rtl::OUString & PropertyName) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException);
         virtual ::com::sun::star::inspection::LineDescriptor SAL_CALL describePropertyLine(const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& ControlFactory ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException);
         virtual ::com::sun::star::uno::Any SAL_CALL convertToPropertyValue(const ::rtl::OUString & PropertyName, const ::com::sun::star::uno::Any & ControlValue) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException);
diff --git a/reportdesign/source/ui/inspection/GeometryHandler.cxx b/reportdesign/source/ui/inspection/GeometryHandler.cxx
index d7ea714..cfb5cba 100644
--- a/reportdesign/source/ui/inspection/GeometryHandler.cxx
+++ b/reportdesign/source/ui/inspection/GeometryHandler.cxx
@@ -469,7 +469,7 @@ uno::Any SAL_CALL GeometryHandler::getPropertyValue(const ::rtl::OUString & Prop
     return aPropertyValue;
 }
 
-void SAL_CALL GeometryHandler::setPropertyValue(const ::rtl::OUString & PropertyName, const uno::Any & Value) throw (uno::RuntimeException, beans::UnknownPropertyException)
+void SAL_CALL GeometryHandler::setPropertyValue(const ::rtl::OUString & PropertyName, const uno::Any & Value) throw (uno::RuntimeException, beans::UnknownPropertyException, beans::PropertyVetoException)
 {
     ::osl::ResettableMutexGuard aGuard( m_aMutex );
     uno::Any aNewValue = Value;
commit efd2438e824edd616075e62e948d4ed771f1251f
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Thu Nov 29 15:55:45 2012 +0100

    Enhance error message for too small FixedLine size
    
    Change-Id: Icc9ac2789637db3d30ad452998cf0d857c9f5bea

diff --git a/reportdesign/source/core/api/FixedLine.cxx b/reportdesign/source/core/api/FixedLine.cxx
index b2c3dbe..79e836d 100644
--- a/reportdesign/source/core/api/FixedLine.cxx
+++ b/reportdesign/source/core/api/FixedLine.cxx
@@ -514,8 +514,12 @@ awt::Size SAL_CALL OFixedLine::getSize(  ) throw (uno::RuntimeException)
 // -----------------------------------------------------------------------------
 void SAL_CALL OFixedLine::setSize( const awt::Size& aSize ) throw (beans::PropertyVetoException, uno::RuntimeException)
 {
-    if ( (aSize.Width < MIN_WIDTH && m_nOrientation == 1) || (aSize.Height < MIN_HEIGHT && m_nOrientation == 0) )
-        throw beans::PropertyVetoException();
+    const char hundredthmmC[] = "0\xe2\x80\x89\xC2\xB5""m"; // in UTF-8: 0, thin space, µ (micro), m (meter)
+    const rtl::OUString hundredthmm(hundredthmmC, sizeof(hundredthmmC)-1, RTL_TEXTENCODING_UTF8);
+    if ( aSize.Width < MIN_WIDTH && m_nOrientation == 1 )
+        throw beans::PropertyVetoException("Too small width for FixedLine; minimum is "  + rtl::OUString::valueOf(MIN_WIDTH)  + hundredthmm, *this);
+    else if ( aSize.Height < MIN_HEIGHT && m_nOrientation == 0 )
+        throw beans::PropertyVetoException("Too small height for FixedLine; minimum is " + rtl::OUString::valueOf(MIN_HEIGHT) + hundredthmm, *this);
     OShapeHelper::setSize(aSize,this);
 }
 // -----------------------------------------------------------------------------


More information about the Libreoffice-commits mailing list