summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2023-12-14 20:16:04 +0100
committerMiklos Vajna <vmiklos@collabora.com>2023-12-15 08:24:12 +0100
commit437062f29360146995ae37ccde79f449d09102c8 (patch)
treedd6ed762237489506d17e09a4d2c2170e947439e
parent50d55703bd55ff807cce286f112875f322cfa098 (diff)
sw doc model xml dump: add initial ruby support
Fixes this warning when some text portion has ruby on it: warn:sw.core:19310:19310:sw/source/core/txtnode/txatbase.cxx:180: Unhandled TXTATR Change-Id: If741f7201c56f7f19ae51108312f2813e92f45d4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160787 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r--sw/inc/fmtruby.hxx1
-rw-r--r--sw/source/core/txtnode/fmtatr2.cxx13
-rw-r--r--sw/source/core/txtnode/txatbase.cxx5
3 files changed, 18 insertions, 1 deletions
diff --git a/sw/inc/fmtruby.hxx b/sw/inc/fmtruby.hxx
index e0e756b1db7a..6741102ed489 100644
--- a/sw/inc/fmtruby.hxx
+++ b/sw/inc/fmtruby.hxx
@@ -74,6 +74,7 @@ public:
css::text::RubyAdjust GetAdjustment() const { return m_eAdjustment; }
void SetAdjustment( css::text::RubyAdjust nNew ) { m_eAdjustment = nNew; }
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
};
#endif
diff --git a/sw/source/core/txtnode/fmtatr2.cxx b/sw/source/core/txtnode/fmtatr2.cxx
index 3e888b660f6a..d9fe78377de3 100644
--- a/sw/source/core/txtnode/fmtatr2.cxx
+++ b/sw/source/core/txtnode/fmtatr2.cxx
@@ -426,6 +426,19 @@ SwFormatRuby::~SwFormatRuby()
{
}
+void SwFormatRuby::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+ (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwFormatRuby"));
+ (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
+ (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("m_pTextAttr"), "%p", m_pTextAttr);
+ (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("ruby-text"),
+ BAD_CAST(m_sRubyText.toUtf8().getStr()));
+ SfxPoolItem::dumpAsXml(pWriter);
+
+
+ (void)xmlTextWriterEndElement(pWriter);
+}
+
SwFormatRuby& SwFormatRuby::operator=( const SwFormatRuby& rAttr )
{
// SwFormatRuby is not shareable, so ptr compare is OK
diff --git a/sw/source/core/txtnode/txatbase.cxx b/sw/source/core/txtnode/txatbase.cxx
index 1d57f0e0dda5..8e48806901a2 100644
--- a/sw/source/core/txtnode/txatbase.cxx
+++ b/sw/source/core/txtnode/txatbase.cxx
@@ -176,8 +176,11 @@ void SwTextAttr::dumpAsXml(xmlTextWriterPtr pWriter) const
case RES_TXTATR_INETFMT:
GetINetFormat().dumpAsXml(pWriter);
break;
+ case RES_TXTATR_CJK_RUBY:
+ GetRuby().dumpAsXml(pWriter);
+ break;
default:
- SAL_WARN("sw.core", "Unhandled TXTATR");
+ SAL_WARN("sw.core", "Unhandled TXTATR: " << Which());
break;
}