Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


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: */


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.