summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Hung <marklh9@gmail.com>2018-03-09 22:41:34 +0800
committerMark Hung <marklh9@gmail.com>2018-03-25 06:55:27 +0200
commit1401f5fbc8427178371b2d6add11510e06e6414f (patch)
tree97eeccb1a597f406bfbc38e1a4c8770f8bc1b7d1
parent1fbe46cf08f525e78016feef83f4c38b79b337ba (diff)
xmloff: export ruby-position in a more compatible way.
Export both style:ruby-position and loext:ruby-position. The later one only allows "above" and "below", obeying ODF standard while the former one allows "inter-character", which is added lately. Also use ODFVER_012_EXT_COMPAT so that loext:ruby-position isn't exported only in extended mode. Change-Id: I7b9208f289f8253a835b2f7751549206361274e0 Reviewed-on: https://gerrit.libreoffice.org/51007 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mark Hung <marklh9@gmail.com>
-rw-r--r--sw/qa/extras/odfexport/odfexport.cxx3
-rw-r--r--xmloff/source/text/txtprhdl.cxx9
-rw-r--r--xmloff/source/text/txtprmap.cxx6
3 files changed, 8 insertions, 10 deletions
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index 9d1c60811f78..7566ec25ad6e 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -1921,7 +1921,10 @@ 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);
+ assertXPath(pXmlDoc, "//style:style[@style:family='ruby']/style:ruby-properties[@style:ruby-position='below']", 1);
+ }
}
DECLARE_ODFEXPORT_TEST(testBulletAsImage, "BulletAsImage.odt")
diff --git a/xmloff/source/text/txtprhdl.cxx b/xmloff/source/text/txtprhdl.cxx
index 482dd4f02aee..4ca595d30691 100644
--- a/xmloff/source/text/txtprhdl.cxx
+++ b/xmloff/source/text/txtprhdl.cxx
@@ -209,13 +209,6 @@ static SvXMLEnumMapEntry<sal_Int16> const pXML_RubyPosition_Enum[] =
{ 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 },
@@ -1309,7 +1302,7 @@ static const XMLPropertyHandler *GetPropertyHandler
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 );
+ pHdl = new XMLNamedBoolPropertyHdl(::xmloff::token::XML_ABOVE, ::xmloff::token::XML_BELOW);
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 ae484f236f5b..99693da63e21 100644
--- a/xmloff/source/text/txtprmap.cxx
+++ b/xmloff/source/text/txtprmap.cxx
@@ -65,6 +65,8 @@ using namespace ::xmloff::token;
// ruby properties
#define MR_E( a, p, l, t, c ) \
M_E_( a, p, l, (t|XML_TYPE_PROP_RUBY), c )
+#define MR_EV( a, p, l, t, c, v ) \
+ M_EV_( a, p, l, (t|XML_TYPE_PROP_RUBY), c, v )
// cell properties
#define MC_E( a, p, l, t, c ) \
@@ -964,8 +966,8 @@ XMLPropertyMapEntry const aXMLSectionPropMap[] =
XMLPropertyMapEntry const aXMLRubyPropMap[] =
{
MR_E( "RubyAdjust", STYLE, RUBY_ALIGN, XML_TYPE_TEXT_RUBY_ADJUST, 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 ),
+ MR_E( "RubyIsAbove", STYLE, RUBY_POSITION, XML_TYPE_TEXT_RUBY_IS_ABOVE, 0 ),
+ MR_EV( "RubyPosition", LO_EXT, RUBY_POSITION, XML_TYPE_TEXT_RUBY_POSITION, 0, SvtSaveOptions::ODFVER_012_EXT_COMPAT),
M_END()
};