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

Mark Hung marklh9 at gmail.com
Fri Mar 2 11:06:27 UTC 2018


 include/xmloff/xmltoken.hxx                   |    1 +
 include/xmloff/xmltypes.hxx                   |    2 ++
 sw/qa/extras/odfexport/data/ruby-position.odt |binary
 sw/qa/extras/odfexport/odfexport.cxx          |    6 ++++++
 xmloff/source/core/xmltoken.cxx               |    1 +
 xmloff/source/text/txtprhdl.cxx               |   22 ++++++++++++++++++++--
 xmloff/source/text/txtprmap.cxx               |    3 ++-
 xmloff/source/token/tokens.txt                |    1 +
 8 files changed, 33 insertions(+), 3 deletions(-)

New commits:
commit 1e034575584930c5bfb57838383ac2cf151c1b92
Author: Mark Hung <marklh9 at gmail.com>
Date:   Sun Jan 21 21:29:00 2018 +0800

    tdf#35301 xmloff: load / store loext:ruby-position.
    
    Add a new property loext:ruby-position to ODF filter
    for the new attribute value "inter-character".
    
    Change-Id: I193eb93fba0e2e7861b6c8635244cac36eb29a06
    Reviewed-on: https://gerrit.libreoffice.org/48328
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Mark Hung <marklh9 at gmail.com>

diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 242a93f28d48..ddd50ab9e6a0 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -1055,6 +1055,7 @@ namespace xmloff { namespace token {
         XML_INSTITUTION,
         XML_INT,
         XML_INTENSITY,
+        XML_INTER_CHARACTER,
         XML_INTERSECT,
         XML_INTERVAL,
         XML_INTERVAL_MAJOR,
diff --git a/include/xmloff/xmltypes.hxx b/include/xmloff/xmltypes.hxx
index 010dad07fc38..8b7fc23981c7 100644
--- a/include/xmloff/xmltypes.hxx
+++ b/include/xmloff/xmltypes.hxx
@@ -289,6 +289,8 @@
 #define XML_SW_TYPE_BITMAPREPOFFSETX    (XML_TEXT_TYPES_START + 124)
 #define XML_SW_TYPE_BITMAPREPOFFSETY    (XML_TEXT_TYPES_START + 125)
 
+#define XML_TYPE_TEXT_RUBY_IS_ABOVE     (XML_TEXT_TYPES_START + 126)
+
 #endif // INCLUDED_XMLOFF_XMLTYPES_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/odfexport/data/ruby-position.odt b/sw/qa/extras/odfexport/data/ruby-position.odt
new file mode 100644
index 000000000000..7086144bf10f
Binary files /dev/null and b/sw/qa/extras/odfexport/data/ruby-position.odt differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index de1399620fea..b36b8045be7f 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -1918,6 +1918,12 @@ DECLARE_ODFEXPORT_TEST(testReferenceLanguage, "referencelanguage.odt")
     }
 }
 
+DECLARE_ODFEXPORT_TEST(testRubyPosition, "ruby-position.odt")
+{
+    if (xmlDocPtr pXmlDoc = parseExport("content.xml"))
+        assertXPath(pXmlDoc, "//style:style[@style:family='ruby']/style:ruby-properties[@loext:ruby-position='inter-character']", 1);
+}
+
 DECLARE_ODFEXPORT_TEST(testBulletAsImage, "BulletAsImage.odt")
 {
     uno::Reference<text::XTextRange> xPara(getParagraph(1));
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index e4718637eace..e28178afdda5 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -1056,6 +1056,7 @@ namespace xmloff { namespace token {
         TOKEN( "institution",                     XML_INSTITUTION ),
         TOKEN( "int",                             XML_INT ),
         TOKEN( "intensity",                       XML_INTENSITY ),
+        TOKEN( "inter-character",                 XML_INTER_CHARACTER ),
         TOKEN( "intersect",                       XML_INTERSECT ),
         TOKEN( "interval",                        XML_INTERVAL ),
         TOKEN( "interval-major",                  XML_INTERVAL_MAJOR ),
diff --git a/xmloff/source/text/txtprhdl.cxx b/xmloff/source/text/txtprhdl.cxx
index 382c283e1a57..993b100976bd 100644
--- a/xmloff/source/text/txtprhdl.cxx
+++ b/xmloff/source/text/txtprhdl.cxx
@@ -34,6 +34,7 @@
 #include <com/sun/star/text/HoriOrientation.hpp>
 #include <com/sun/star/text/VertOrientation.hpp>
 #include <com/sun/star/text/RubyAdjust.hpp>
+#include <com/sun/star/text/RubyPosition.hpp>
 #include <com/sun/star/text/FontEmphasis.hpp>
 #include <com/sun/star/text/ParagraphVertAlign.hpp>
 #include <sax/tools/converter.hxx>
@@ -198,6 +199,21 @@ static SvXMLEnumMapEntry<RubyAdjust> const pXML_RubyAdjust_Enum[] =
     { XML_TOKEN_INVALID,        RubyAdjust(0) }
 };
 
+static SvXMLEnumMapEntry<sal_Int16> const pXML_RubyPosition_Enum[] =
+{
+    { XML_ABOVE,                RubyPosition::ABOVE},
+    { XML_BELOW,                RubyPosition::BELOW},
+    { XML_INTER_CHARACTER,      RubyPosition::INTER_CHARACTER},
+    { XML_TOKEN_INVALID,        0 }
+};
+
+static SvXMLEnumMapEntry<sal_Int16> const pXML_RubyIsAbove_Enum[] =
+{
+    { XML_ABOVE,                RubyPosition::ABOVE},
+    { XML_BELOW,                RubyPosition::BELOW},
+    { XML_TOKEN_INVALID,        0 }
+};
+
 static SvXMLEnumMapEntry<sal_uInt16> const pXML_FontRelief_Enum[] =
 {
     { XML_NONE,             FontRelief::NONE        },
@@ -1256,8 +1272,10 @@ static const XMLPropertyHandler *GetPropertyHandler
         pHdl = new XMLConstantsPropertyHandler( pXML_ParaVerticalAlign_Enum, XML_TOKEN_INVALID );
         break;
     case XML_TYPE_TEXT_RUBY_POSITION:
-        pHdl = new XMLNamedBoolPropertyHdl( ::xmloff::token::XML_ABOVE,
-                                            ::xmloff::token::XML_BELOW );
+        pHdl = new XMLConstantsPropertyHandler( pXML_RubyPosition_Enum, XML_TOKEN_INVALID );
+        break;
+    case XML_TYPE_TEXT_RUBY_IS_ABOVE:
+        pHdl = new XMLConstantsPropertyHandler( pXML_RubyIsAbove_Enum, XML_TOKEN_INVALID );
         break;
     // OD 2004-05-05 #i28701#
     case XML_TYPE_WRAP_INFLUENCE_ON_POSITION:
diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx
index 1dac3b40ffe1..b6b90c1c538a 100644
--- a/xmloff/source/text/txtprmap.cxx
+++ b/xmloff/source/text/txtprmap.cxx
@@ -964,7 +964,8 @@ XMLPropertyMapEntry const aXMLSectionPropMap[] =
 XMLPropertyMapEntry const aXMLRubyPropMap[] =
 {
     MR_E( "RubyAdjust", STYLE, RUBY_ALIGN, XML_TYPE_TEXT_RUBY_ADJUST, 0 ),
-    MR_E( "RubyIsAbove",    STYLE, RUBY_POSITION, XML_TYPE_TEXT_RUBY_POSITION, 0 ),
+    MR_E( "RubyPosition",    STYLE, RUBY_POSITION, XML_TYPE_TEXT_RUBY_IS_ABOVE, 0 ),
+    MR_E( "RubyPosition",   LO_EXT, RUBY_POSITION, XML_TYPE_TEXT_RUBY_POSITION | MID_FLAG_MERGE_PROPERTY, 0 ),
     M_END()
 };
 
diff --git a/xmloff/source/token/tokens.txt b/xmloff/source/token/tokens.txt
index cc0b35ad084c..d977e96c4016 100644
--- a/xmloff/source/token/tokens.txt
+++ b/xmloff/source/token/tokens.txt
@@ -974,6 +974,7 @@ inside
 institution
 int
 intensity
+inter-character
 intersect
 interval
 interval-major


More information about the Libreoffice-commits mailing list