This is an automated email from the ASF dual-hosted git repository.

jimjag pushed a commit to branch odf-devel
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit e3dbd52ed7b262ab1c4b873b1c303ac60358186c
Author: Jim Jagielski <[email protected]>
AuthorDate: Wed Oct 28 11:05:20 2026 -0400

    xmloff: valid font weights, underline styles and page scaling in ODF 1.2 
strict mode
---
 main/xmloff/source/style/PageMasterExportPropMapper.cxx | 16 ++++++++++++++--
 main/xmloff/source/style/undlihdl.cxx                   |  4 ++++
 main/xmloff/source/style/weighhdl.cxx                   | 13 +++++++++++++
 3 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/main/xmloff/source/style/PageMasterExportPropMapper.cxx 
b/main/xmloff/source/style/PageMasterExportPropMapper.cxx
index dadb5195f3..f94ab2a33e 100644
--- a/main/xmloff/source/style/PageMasterExportPropMapper.cxx
+++ b/main/xmloff/source/style/PageMasterExportPropMapper.cxx
@@ -590,10 +590,22 @@ void XMLPageMasterExportPropMapper::ContextFilter(
                lcl_RemoveStateIfZero16( pPMScaleTo );
        if( pPMScaleToPages )
                lcl_RemoveStateIfZero16( pPMScaleToPages );
+       // style:scale-to-X and -Y are not in ODF 1.2
+       const sal_Bool bStrict = SvtSaveOptions().GetODFDefaultVersion() == 
SvtSaveOptions::ODFVER_012;
        if( pPMScaleToX )
-               lcl_RemoveStateIfZero16( pPMScaleToX );
+       {
+               if( bStrict )
+                       lcl_RemoveState( pPMScaleToX );
+               else
+                       lcl_RemoveStateIfZero16( pPMScaleToX );
+       }
        if( pPMScaleToY )
-               lcl_RemoveStateIfZero16( pPMScaleToY );
+       {
+               if( bStrict )
+                       lcl_RemoveState( pPMScaleToY );
+               else
+                       lcl_RemoveStateIfZero16( pPMScaleToY );
+       }
 
     if (pPrint)
     {
diff --git a/main/xmloff/source/style/undlihdl.cxx 
b/main/xmloff/source/style/undlihdl.cxx
index cfed64cfb2..07755f99e7 100644
--- a/main/xmloff/source/style/undlihdl.cxx
+++ b/main/xmloff/source/style/undlihdl.cxx
@@ -27,6 +27,7 @@
 #include <xmloff/xmltoken.hxx>
 #include <xmloff/xmluconv.hxx>
 #include <rtl/ustrbuf.hxx>
+#include <unotools/saveopt.hxx>
 
 
 #include <com/sun/star/uno/Any.hxx>
@@ -274,6 +275,9 @@ sal_Bool XMLUnderlineStylePropHdl::exportXML( OUString& 
rStrExpValue, const uno:
 
        if( rValue >>= nValue )
        {
+               // small-wave is not a lineStyle in ODF 1.2
+               if( FontUnderline::SMALLWAVE == nValue && 
SvtSaveOptions().GetODFDefaultVersion() == SvtSaveOptions::ODFVER_012 )
+                       nValue = FontUnderline::WAVE;
         bRet = SvXMLUnitConverter::convertEnum(
             aOut, (sal_uInt16)nValue, pXML_UnderlineStyle_Enum );
                if( bRet )
diff --git a/main/xmloff/source/style/weighhdl.cxx 
b/main/xmloff/source/style/weighhdl.cxx
index f66b91901e..1b50a5a65d 100644
--- a/main/xmloff/source/style/weighhdl.cxx
+++ b/main/xmloff/source/style/weighhdl.cxx
@@ -33,6 +33,7 @@
 #include <limits.h>
 #endif
 #include <rtl/ustrbuf.hxx>
+#include <unotools/saveopt.hxx>
 #include <rtl/ustring.hxx>
 
 #include <com/sun/star/uno/Any.hxx>
@@ -154,6 +155,18 @@ sal_Bool XMLFontWeightPropHdl::exportXML( OUString& 
rStrExpValue, const Any& rVa
                        }
                }
 
+               // strict ODF 1.2 allows normal, bold and the hundreds only; 
rounding down keeps light and semilight apart
+               if( SvtSaveOptions().GetODFDefaultVersion() == 
SvtSaveOptions::ODFVER_012 )
+               {
+                       switch( nWeight )
+                       {
+                               case 0:         return sal_False;
+                               case 150:       nWeight = 100; break;
+                               case 250:       nWeight = 200; break;
+                               case 350:       nWeight = 300; break;
+                       }
+               }
+
                OUStringBuffer aOut;
 
                if( 400 == nWeight )

Reply via email to