File bsc1160687-5.diff of Package libreoffice.15776

From 49f0501f8ba4acd36067a84590469944e9d3234c Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos@collabora.com>
Date: Wed, 29 Apr 2020 12:31:25 +0200
Subject: [PATCH] sw from-bottom relative orientation: add ODF filter

Map between RelOrientation::PAGE_PRINT_AREA_BOTTOM and
loext:vertical-rel="page-content-bottom".

Conflicts:
	sw/qa/extras/odfexport/odfexport.cxx

Change-Id: I1d614bf7c82a76285f4268b8008e08c25ef9b7f0
---
 include/xmloff/xmltoken.hxx                      |   2 ++
 .../OpenDocument-schema-v1.3+libreoffice.rng     |  11 +++++++++++
 .../odfexport/data/page-content-bottom.odt       | Bin 0 -> 8502 bytes
 sw/qa/extras/odfexport/odfexport.cxx             |   7 +++++++
 xmloff/source/core/xmltoken.cxx                  |   2 ++
 xmloff/source/style/xmlexppr.cxx                 |  13 +++++++++++--
 xmloff/source/text/txtprhdl.cxx                  |   2 ++
 xmloff/source/text/txtprmap.cxx                  |   6 ++++++
 xmloff/source/token/tokens.txt                   |   1 +
 9 files changed, 42 insertions(+), 2 deletions(-)
 create mode 100644 sw/qa/extras/odfexport/data/page-content-bottom.odt

diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 1175958548ff..dfc9ad5ced3d 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -3367,6 +3367,8 @@ namespace xmloff { namespace token {

         XML_RESOLVED,

+        XML_PAGE_CONTENT_BOTTOM,
+
         XML_TOKEN_END
     };

diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index e0f6e4d7a216..b37e90f0b568 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -3360,6 +3360,8 @@ namespace xmloff { namespace token {
         // For recording whether comments/annotations are resolved
         TOKEN( "resolved",                        XML_RESOLVED ),

+        TOKEN( "page-content-bottom",             XML_PAGE_CONTENT_BOTTOM ),
+
 #if OSL_DEBUG_LEVEL > 0
         { 0, nullptr, nullptr,                       XML_TOKEN_END }
 #else
diff --git a/xmloff/source/style/xmlexppr.cxx b/xmloff/source/style/xmlexppr.cxx
index 76fd72c71deb..cd94fccae8dd 100644
--- a/xmloff/source/style/xmlexppr.cxx
+++ b/xmloff/source/style/xmlexppr.cxx
@@ -1030,10 +1030,10 @@ void SvXMLExportPropertyMapper::_exportXML(
             if( bRemove )
                 rAttrList.RemoveAttribute( sName );

+            // We don't seem to have a generic mechanism to write an attribute in the extension
+            // namespace in case of certain attribute values only, so do this manually.
             if (IsXMLToken(mpImpl->mxPropMapper->GetEntryXMLName(rProperty.mnIndex), XML_WRITING_MODE))
             {
-                // We don't seem to have a generic mechanism to write an attribute in the extension
-                // namespace in case of certain attribute values only, so do this manually.
                 if (IsXMLToken(aValue, XML_BT_LR))
                 {
                     sName = rNamespaceMap.GetQNameByKey(
@@ -1041,6 +1041,15 @@ void SvXMLExportPropertyMapper::_exportXML(
                             mpImpl->mxPropMapper->GetEntryXMLName(rProperty.mnIndex));
                 }
             }
+            else if (IsXMLToken(mpImpl->mxPropMapper->GetEntryXMLName(rProperty.mnIndex), XML_VERTICAL_REL))
+            {
+                if (IsXMLToken(aValue, XML_PAGE_CONTENT_BOTTOM))
+                {
+                    sName = rNamespaceMap.GetQNameByKey(
+                            XML_NAMESPACE_LO_EXT,
+                            mpImpl->mxPropMapper->GetEntryXMLName(rProperty.mnIndex));
+                }
+            }

             rAttrList.AddAttribute( sName, aValue );
         }
diff --git a/xmloff/source/text/txtprhdl.cxx b/xmloff/source/text/txtprhdl.cxx
index 32644e5f7f1c..13770a7de558 100644
--- a/xmloff/source/text/txtprhdl.cxx
+++ b/xmloff/source/text/txtprhdl.cxx
@@ -153,6 +153,7 @@ static SvXMLEnumMapEntry<sal_uInt16> const pXML_VertRel_Enum[] =
     // DVO, OD 17.09.2003 #i18732# - allow vertical alignment at page
     { XML_PAGE,                 RelOrientation::PAGE_FRAME  },
     { XML_PAGE_CONTENT,         RelOrientation::PAGE_PRINT_AREA },
+    { XML_PAGE_CONTENT_BOTTOM,  RelOrientation::PAGE_PRINT_AREA_BOTTOM },
     { XML_FRAME,                RelOrientation::FRAME   },      // import only
     { XML_FRAME_CONTENT,        RelOrientation::PRINT_AREA  },  // import only
     // OD 13.11.2003 #i22341# - new vertical alignment at top of line
@@ -166,6 +167,7 @@ static SvXMLEnumMapEntry<sal_uInt16> const pXML_VertRelPage_Enum[] =
     { XML_PAGE_CONTENT, RelOrientation::PRINT_AREA  },
     { XML_PAGE,         RelOrientation::PAGE_FRAME  },
     { XML_PAGE_CONTENT, RelOrientation::PAGE_PRINT_AREA },
+    { XML_PAGE_CONTENT_BOTTOM, RelOrientation::PAGE_PRINT_AREA_BOTTOM },
     { XML_TOKEN_INVALID, 0 }
 };

diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx
index ebd91ebc3062..e3597b7c6f50 100644
--- a/xmloff/source/text/txtprmap.cxx
+++ b/xmloff/source/text/txtprmap.cxx
@@ -736,6 +736,9 @@ XMLPropertyMapEntry const aXMLFramePropMap[] =
     MG_ED( "VertOrientRelation",        STYLE,  VERTICAL_REL,         XML_TYPE_TEXT_VERTICAL_REL, CTF_VERTICALREL ),
     MG_ED( "VertOrientRelation",        STYLE,  VERTICAL_REL,         XML_TYPE_TEXT_VERTICAL_REL_PAGE|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_VERTICALREL_PAGE ),
     MG_ED( "VertOrientRelation",        STYLE,  VERTICAL_REL,         XML_TYPE_TEXT_VERTICAL_REL_FRAME|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_VERTICALREL_FRAME ),
+    MAP_EXT_I( "VertOrientRelation",    XML_NAMESPACE_LO_EXT, XML_VERTICAL_REL, XML_TYPE_TEXT_VERTICAL_REL|XML_TYPE_PROP_GRAPHIC|MID_FLAG_DEFAULT_ITEM_EXPORT, CTF_VERTICALREL ),
+    MAP_EXT_I( "VertOrientRelation",    XML_NAMESPACE_LO_EXT, XML_VERTICAL_REL, XML_TYPE_TEXT_VERTICAL_REL_PAGE|MID_FLAG_SPECIAL_ITEM_IMPORT|XML_TYPE_PROP_GRAPHIC|MID_FLAG_DEFAULT_ITEM_EXPORT, CTF_VERTICALREL_PAGE ),
+    MAP_EXT_I( "VertOrientRelation",    XML_NAMESPACE_LO_EXT, XML_VERTICAL_REL, XML_TYPE_TEXT_VERTICAL_REL_FRAME|MID_FLAG_SPECIAL_ITEM_IMPORT|XML_TYPE_PROP_GRAPHIC|MID_FLAG_DEFAULT_ITEM_EXPORT, CTF_VERTICALREL_FRAME ),
     // RES_HORI_ORIENT
     MG_ED( "HoriOrient",                STYLE,  HORIZONTAL_POS,       XML_TYPE_TEXT_HORIZONTAL_POS|MID_FLAG_MULTI_PROPERTY, CTF_HORIZONTALPOS ),
     MG_ED( "PageToggle",        STYLE,  HORIZONTAL_POS,       XML_TYPE_TEXT_HORIZONTAL_MIRROR, CTF_HORIZONTALMIRROR ),
@@ -901,6 +904,9 @@ XMLPropertyMapEntry const aXMLShapePropMap[] =
     MG_E( "VertOrientRelation", STYLE,  VERTICAL_REL,   XML_TYPE_TEXT_VERTICAL_REL, CTF_SHAPE_VERTICALREL ),
     MG_E( "VertOrientRelation", STYLE,  VERTICAL_REL,   XML_TYPE_TEXT_VERTICAL_REL_PAGE|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_SHAPE_VERTICALREL_PAGE ),
     MG_E( "VertOrientRelation", STYLE,  VERTICAL_REL,   XML_TYPE_TEXT_VERTICAL_REL_FRAME|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_SHAPE_VERTICALREL_FRAME ),
+    MAP_EXT_I( "VertOrientRelation",    XML_NAMESPACE_LO_EXT, XML_VERTICAL_REL, XML_TYPE_TEXT_VERTICAL_REL|XML_TYPE_PROP_GRAPHIC, CTF_VERTICALREL ),
+    MAP_EXT_I( "VertOrientRelation",    XML_NAMESPACE_LO_EXT, XML_VERTICAL_REL, XML_TYPE_TEXT_VERTICAL_REL_PAGE|MID_FLAG_SPECIAL_ITEM_IMPORT|XML_TYPE_PROP_GRAPHIC, CTF_VERTICALREL_PAGE ),
+    MAP_EXT_I( "VertOrientRelation",    XML_NAMESPACE_LO_EXT, XML_VERTICAL_REL, XML_TYPE_TEXT_VERTICAL_REL_FRAME|MID_FLAG_SPECIAL_ITEM_IMPORT|XML_TYPE_PROP_GRAPHIC, CTF_VERTICALREL_FRAME ),
     // RES_HORI_ORIENT
     MG_E( "HoriOrient",         STYLE,  HORIZONTAL_POS, XML_TYPE_TEXT_HORIZONTAL_POS|MID_FLAG_MULTI_PROPERTY, CTF_SHAPE_HORIZONTALPOS ),
     MG_E( "PageToggle",         STYLE,  HORIZONTAL_POS, XML_TYPE_TEXT_HORIZONTAL_MIRROR, CTF_SHAPE_HORIZONTALMIRROR ),
diff --git a/xmloff/source/token/tokens.txt b/xmloff/source/token/tokens.txt
index 921ff2b63b5a..ef2aaca8ea77 100644
--- a/xmloff/source/token/tokens.txt
+++ b/xmloff/source/token/tokens.txt
@@ -3127,4 +3127,5 @@ newline
 creator-initials
 transliteration-spellout
 resolved
+page-content-bottom
 TOKEN_END_DUMMY
--
2.26.1
openSUSE Build Service is sponsored by