[Libreoffice-commits] .: Branch 'libreoffice-3-4' - 2 commits - xmloff/inc xmloff/source

Petr Mladek pmladek at kemper.freedesktop.org
Fri Dec 23 03:23:11 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 09b32d79015b9e4fd933492b495b99ab1cda051d
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
    
    Signed-off-by: Cedric Bosdonnat <cbosdonnat at suse.com>
    Signed-off-by: Petr Mladek <pmladek at suse.cz>

diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx
index 8cf954a..df7a9f4 100644
--- a/xmloff/source/text/txtprmap.cxx
+++ b/xmloff/source/text/txtprmap.cxx
@@ -256,8 +256,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 005f59ac32ce48397fa7df3b4f6586467c7f9bda
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).
    
    Signed-off-by: Cedric Bosdonnat <cbosdonnat at suse.com>
    Signed-off-by: Petr Mladek <pmladek at suse.cz>

diff --git a/xmloff/inc/xmloff/PageMasterStyleMap.hxx b/xmloff/inc/xmloff/PageMasterStyleMap.hxx
index d81bd80..91c59e9 100644
--- a/xmloff/inc/xmloff/PageMasterStyleMap.hxx
+++ b/xmloff/inc/xmloff/PageMasterStyleMap.hxx
@@ -97,6 +97,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 c59d61c..9289712 100644
--- a/xmloff/source/style/PageMasterExportPropMapper.cxx
+++ b/xmloff/source/style/PageMasterExportPropMapper.cxx
@@ -325,7 +325,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;
 
@@ -381,6 +383,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)
         {
@@ -396,6 +399,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 7dafe3a..31df9c8 100644
--- a/xmloff/source/style/PageMasterStyleMap.cxx
+++ b/xmloff/source/style/PageMasterStyleMap.cxx
@@ -35,11 +35,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)
         
 //______________________________________________________________________________
 
@@ -109,11 +113,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