[Libreoffice-commits] core.git: include/xmloff schema/libreoffice sw/qa xmloff/source

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Wed May 6 16:40:35 UTC 2020


 include/xmloff/xmltoken.hxx                                 |    2 +
 schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng |   11 ++++++++++
 sw/qa/extras/odfexport/data/page-content-bottom.odt         |binary
 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(-)

New commits:
commit 65b7873aab5deec7157328047e869a6385e0a74a
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Wed Apr 29 12:31:25 2020 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed May 6 18:39:59 2020 +0200

    sw from-bottom relative orientation: add ODF filter
    
    Map between RelOrientation::PAGE_PRINT_AREA_BOTTOM and
    loext:vertical-rel="page-content-bottom".
    
    Change-Id: I1d614bf7c82a76285f4268b8008e08c25ef9b7f0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93120
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index d84f17d03ce6..0f646baa40ca 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -3357,6 +3357,8 @@ namespace xmloff::token {
 
         XML_RESOLVED,
 
+        XML_PAGE_CONTENT_BOTTOM,
+
         XML_TOKEN_END
     };
 
diff --git a/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng b/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng
index 7491e0ec1c8d..a61f6da11f71 100644
--- a/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng
+++ b/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng
@@ -2391,6 +2391,17 @@ xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.
     </rng:optional>
   </rng:define>
 
+  <!-- TODO no proposal -->
+  <rng:define name="common-vertical-rel-attlist" combine="interleave">
+    <rng:optional>
+      <rng:attribute name="loext:vertical-rel">
+        <rng:choice>
+          <rng:value>page-content-bottom</rng:value>
+        </rng:choice>
+      </rng:attribute>
+    </rng:optional>
+  </rng:define>
+
   <!-- just a test-case for user-defined attributes, move along, nothing to see here... -->
   <rng:define name="style-table-cell-properties-attlist" combine="interleave">
     <rng:optional>
diff --git a/sw/qa/extras/odfexport/data/page-content-bottom.odt b/sw/qa/extras/odfexport/data/page-content-bottom.odt
new file mode 100644
index 000000000000..263ca7df40a1
Binary files /dev/null and b/sw/qa/extras/odfexport/data/page-content-bottom.odt differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index 89cf753241d9..1b8bc8a57728 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -2418,5 +2418,12 @@ DECLARE_ODFEXPORT_TEST(testArabicZero5Numbering, "arabic-zero5-numbering.odt")
                          aMap["NumberingType"].get<sal_uInt16>());
 }
 
+DECLARE_ODFEXPORT_TEST(testPageContentBottom, "page-content-bottom.odt")
+{
+    uno::Reference<beans::XPropertySet> xShape(getShape(1), uno::UNO_QUERY);
+    sal_Int16 nExpected = text::RelOrientation::PAGE_PRINT_AREA_BOTTOM;
+    CPPUNIT_ASSERT_EQUAL(nExpected, getProperty<sal_Int16>(xShape, "VertOrientRelation"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 624c7684330c..9fab6ca983ef 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -3353,6 +3353,8 @@ namespace xmloff::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, std::nullopt,               XML_TOKEN_END }
 #else
diff --git a/xmloff/source/style/xmlexppr.cxx b/xmloff/source/style/xmlexppr.cxx
index 188f510c0fe8..cec29f36374c 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 1e7547d1c8b8..a14f5dffbb9f 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 94835323a693..4a28c3e6be23 100644
--- a/xmloff/source/text/txtprmap.cxx
+++ b/xmloff/source/text/txtprmap.cxx
@@ -740,6 +740,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 ),
@@ -905,6 +908,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 4f8e756d3b57..5737c639b50a 100644
--- a/xmloff/source/token/tokens.txt
+++ b/xmloff/source/token/tokens.txt
@@ -3115,4 +3115,5 @@ newline
 creator-initials
 transliteration-spellout
 resolved
+page-content-bottom
 TOKEN_END_DUMMY


More information about the Libreoffice-commits mailing list