Hi all,

Some broken documents seem to contain negative values for margins, which messes the output. One of the sample documents is available as attachment in n757419.
I have attached a patch for review with this mail.

I didn't want to touch editeng for fixing this better (e.g. in
SvxLRSpaceItem::PutValue), assuming that probably writer (or some other
module) might actually need a negative value for the para margins (?)
Please let me know if my assumption is wrong. Or if there is a better way to fix this...

Thank you so much!
Muthu Subramanian

diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index 9db3fa3..0cf88f1 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -4300,11 +4300,18 @@ uno::Any SvxItemPropertySet_getPropertyValue( const SvxItemPropertySet& rPropSet
 
 void SvxItemPropertySet_setPropertyValue( const SvxItemPropertySet& rPropSet, const SfxItemPropertySimpleEntry* pMap, const uno::Any& rVal, SfxItemSet& rSet )
 {
+    uno::Any aVal(rVal);
     if(!pMap || !pMap->nWID)
         return;
 
     bool bDontConvertNegativeValues = ( pMap->nWID == XATTR_FILLBMP_SIZEX || pMap->nWID == XATTR_FILLBMP_SIZEY );
-    rPropSet.setPropertyValue( pMap, rVal, rSet, bDontConvertNegativeValues );
+    if( pMap->nWID == EE_PARA_LRSPACE ) // Don't import negative values
+    {
+        sal_Int32 nVal;
+        if( (aVal >>= nVal) && nVal < 0 )
+            aVal <<= ( sal_Int32 ) 0;
+    }
+    rPropSet.setPropertyValue( pMap, aVal, rSet, bDontConvertNegativeValues );
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to