[Libreoffice-commits] .: 2 commits - xmloff/inc xmloff/source

Michael Stahl mst at kemper.freedesktop.org
Thu Dec 22 15:01:40 PST 2011


 xmloff/inc/xmloff/PageMasterStyleMap.hxx           |    1 +
 xmloff/source/style/PageMasterExportPropMapper.cxx |    7 +++++++
 xmloff/source/style/PageMasterStyleMap.cxx         |   21 ++++++++++++++-------
 xmloff/source/text/txtprmap.cxx                    |    4 ++--
 4 files changed, 24 insertions(+), 9 deletions(-)

New commits:
commit 59a5c37d0df9b5612552c4b749191385ca0adc80
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Dec 22 23:51:33 2011 +0100

    fdo#44082: fix hyphenation attributes:
    
    These have type positiveInteger, so don't write 0 values:
    
    20.191 fo:hyphenation-push-char-count
    20.192 fo:hyphenation-remain-char-count

diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx
index 29559a6..ba5c899 100644
--- a/xmloff/source/text/txtprmap.cxx
+++ b/xmloff/source/text/txtprmap.cxx
@@ -264,8 +264,8 @@ XMLPropertyMapEntry aXMLParaPropMap[] =
     MP_ED( "ParaTabStops",      STYLE,  TAB_STOPS,          MID_FLAG_ELEMENT_ITEM|XML_TYPE_TEXT_TABSTOP, CTF_TABSTOP ), // this is not realy a string!
     // RES_PARATR_HYPHENZONE
     MT_E( "ParaIsHyphenation",  FO,     HYPHENATE,          XML_TYPE_BOOL, 0 ),
-    MT_E( "ParaHyphenationMaxLeadingChars", FO, HYPHENATION_REMAIN_CHAR_COUNT, XML_TYPE_NUMBER16, 0 ),
-    MT_E( "ParaHyphenationMaxTrailingChars",FO, HYPHENATION_PUSH_CHAR_COUNT, XML_TYPE_NUMBER16, 0 ),
+    MT_E( "ParaHyphenationMaxLeadingChars", FO, HYPHENATION_REMAIN_CHAR_COUNT, XML_TYPE_NUMBER16_NO_ZERO, 0 ),
+    MT_E( "ParaHyphenationMaxTrailingChars",FO, HYPHENATION_PUSH_CHAR_COUNT, XML_TYPE_NUMBER16_NO_ZERO, 0 ),
     MP_E( "ParaHyphenationMaxHyphens",  FO, HYPHENATION_LADDER_COUNT, XML_TYPE_NUMBER16_NONE, 0 ),
     // RES_PARATR_DROP
     MP_E( "DropCapWholeWord",   STYLE,  LENGTH,     MID_FLAG_SPECIAL_ITEM|XML_TYPE_BOOL, CTF_DROPCAPWHOLEWORD ),
commit c1e1ef80e8428514499b061e00801a6a6298d0b0
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Dec 22 23:10:14 2011 +0100

    fdo#44073: ODF export: fix layout grid invalid ODF
    
    The following 3 attributes have been added in ODF 1.2, so don't write
    them into ODF 1.1 files:
    
    style:layout-grid-base-width 20.297
    style:layout-grid-snap-to 20.305
    style:layout-grid-standard-mode 20.306
    
    Additionally, style:layout-grid-snap-to was written wrongly as
    style:layout-grid-snap-to-characters, which does not exist in any ODF
    spec.
    For backward compatibility with previous OOo/LO versions, write the
    wrong attribute in addition to the correct one in ODF extended mode,
    even though validators complain about it (consider removing that
    some years from now).

diff --git a/xmloff/inc/xmloff/PageMasterStyleMap.hxx b/xmloff/inc/xmloff/PageMasterStyleMap.hxx
index 573d883..1c90b32 100644
--- a/xmloff/inc/xmloff/PageMasterStyleMap.hxx
+++ b/xmloff/inc/xmloff/PageMasterStyleMap.hxx
@@ -102,6 +102,7 @@
 #define CTF_PM_STANDARD_MODE            (XML_PM_CTF_START + 0x0055)
 #define CTP_PM_GRID_BASE_WIDTH          (XML_PM_CTF_START + 0x0056)
 #define CTP_PM_GRID_SNAP_TO_CHARS       (XML_PM_CTF_START + 0x0057)
+#define CTP_PM_GRID_SNAP_TO             (XML_PM_CTF_START + 0x0058)
 // header
 #define CTF_PM_HEADERBORDERALL          (CTF_PM_HEADERFLAG|CTF_PM_BORDERALL)
 #define CTF_PM_HEADERBORDERTOP          (CTF_PM_HEADERFLAG|CTF_PM_BORDERTOP)
diff --git a/xmloff/source/style/PageMasterExportPropMapper.cxx b/xmloff/source/style/PageMasterExportPropMapper.cxx
index 3a1c0a0..ba0f45b 100644
--- a/xmloff/source/style/PageMasterExportPropMapper.cxx
+++ b/xmloff/source/style/PageMasterExportPropMapper.cxx
@@ -360,7 +360,9 @@ void XMLPageMasterExportPropMapper::ContextFilter(
     XMLPropertyState*       pPMScaleToY         = NULL;
     XMLPropertyState*       pPMStandardMode     = NULL;
     XMLPropertyState*       pPMGridBaseWidth    = NULL;
+    // same as pPMGridSnapTo but for backward compatibility only
     XMLPropertyState*       pPMGridSnapToChars  = NULL;
+    XMLPropertyState*       pPMGridSnapTo       = NULL;
 
     XMLPropertyState*       pPrint              = NULL;
 
@@ -421,6 +423,7 @@ void XMLPageMasterExportPropMapper::ContextFilter(
             case CTF_PM_STANDARD_MODE:      pPMStandardMode     = pProp;    break;
             case CTP_PM_GRID_BASE_WIDTH:        pPMGridBaseWidth    = pProp;    break;
             case CTP_PM_GRID_SNAP_TO_CHARS:     pPMGridSnapToChars  = pProp;    break;
+            case CTP_PM_GRID_SNAP_TO:       pPMGridSnapTo = pProp;    break;
         }
         if (nPrintId == CTF_PM_PRINTMASK)
         {
@@ -436,6 +439,10 @@ void XMLPageMasterExportPropMapper::ContextFilter(
             lcl_RemoveState(pPMGridBaseWidth);
         if( pPMGridSnapToChars )
             lcl_RemoveState(pPMGridSnapToChars);
+        if (pPMGridSnapTo)
+        {
+            lcl_RemoveState(pPMGridSnapTo);
+        }
     }
 
     if( pPMGridBaseWidth && pPMStandardMode )
diff --git a/xmloff/source/style/PageMasterStyleMap.cxx b/xmloff/source/style/PageMasterStyleMap.cxx
index c4c5916..231ec37 100644
--- a/xmloff/source/style/PageMasterStyleMap.cxx
+++ b/xmloff/source/style/PageMasterStyleMap.cxx
@@ -33,11 +33,15 @@
 
 using namespace ::xmloff::token;
 
-#define _MAP(name,prefix,token,type,context)  { name, sizeof(name)-1, prefix, token, type, context, SvtSaveOptions::ODFVER_010 }
+#define MAP(name,prefix,token,type,context,version)  { name, sizeof(name)-1, prefix, token, type, context, version }
 #define PLMAP(name,prefix,token,type,context) \
-        _MAP(name,prefix,token,type|XML_TYPE_PROP_PAGE_LAYOUT,context)
+        MAP(name,prefix,token,type|XML_TYPE_PROP_PAGE_LAYOUT,context, SvtSaveOptions::ODFVER_010)
+#define PLMAP_12(name,prefix,token,type,context) \
+        MAP(name,prefix,token,type|XML_TYPE_PROP_PAGE_LAYOUT,context, SvtSaveOptions::ODFVER_012)
+#define PLMAP_EX(name,prefix,token,type,context) \
+        MAP(name,prefix,token,type|XML_TYPE_PROP_PAGE_LAYOUT,context, SvtSaveOptions::ODFVER_LATEST)
 #define HFMAP(name,prefix,token,type,context) \
-        _MAP(name,prefix,token,type|XML_TYPE_PROP_HEADER_FOOTER,context)
+        MAP(name,prefix,token,type|XML_TYPE_PROP_HEADER_FOOTER,context, SvtSaveOptions::ODFVER_010)
 
 //______________________________________________________________________________
 
@@ -108,11 +112,14 @@ const XMLPropertyMapEntry aXMLPageMasterStyleMap[] =
     PLMAP( "GridDisplay", XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_DISPLAY, XML_TYPE_BOOL, 0 ),
 
     //text grid enhancement for better CJK support
-    PLMAP( "GridBaseWidth", XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_BASE_WIDTH, XML_TYPE_MEASURE, CTP_PM_GRID_BASE_WIDTH ),
-    PLMAP( "GridSnapToChars", XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_SNAP_TO, XML_TYPE_BOOL, CTP_PM_GRID_SNAP_TO_CHARS ),
-    PLMAP( "GridSnapToChars", XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_SNAP_TO_CHARS, XML_TYPE_BOOL, CTP_PM_GRID_SNAP_TO_CHARS ),
+    PLMAP_12( "GridBaseWidth", XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_BASE_WIDTH, XML_TYPE_MEASURE, CTP_PM_GRID_BASE_WIDTH ),
+    PLMAP_12( "GridSnapToChars", XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_SNAP_TO, XML_TYPE_BOOL, CTP_PM_GRID_SNAP_TO ),
+    // fdo#44073: layout-grid-snap-to-characters does not exist in ODF:
+    // write this in extended mode purely for backward compatibility so old
+    // OOo/LO versions that don't understand layout-grid-snap-to read it
+    PLMAP_EX( "GridSnapToChars", XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_SNAP_TO_CHARS, XML_TYPE_BOOL, CTP_PM_GRID_SNAP_TO_CHARS ),
       //export as a default attribute
-    PLMAP( "StandardPageMode", XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_STANDARD_MODE, XML_TYPE_BOOL|MID_FLAG_DEFAULT_ITEM_EXPORT, CTF_PM_STANDARD_MODE ),
+    PLMAP_12( "StandardPageMode", XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_STANDARD_MODE, XML_TYPE_BOOL|MID_FLAG_DEFAULT_ITEM_EXPORT, CTF_PM_STANDARD_MODE ),
 
     PLMAP( "UserDefinedAttributes", XML_NAMESPACE_TEXT,     XML_XMLNS,                      XML_TYPE_ATTRIBUTE_CONTAINER | MID_FLAG_SPECIAL_ITEM, 0 ),
 


More information about the Libreoffice-commits mailing list