diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2022-11-22 20:01:35 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2022-11-23 08:12:29 +0100 |
commit | 59e25927f4babdc142cdcbd81b5ceb7afe798d02 (patch) | |
tree | 5666a4ab462f9c0577566a033eb97a359703b644 /sw/source/core | |
parent | 1435c5b12646269e2b5b58ec7d51626dce6505db (diff) |
CppunitTest_sw_uiwriter: use more SwParaPortion::dumpAsXml()
Which means XmlPortionDumper can be finally removed.
See commit feeed3e762cf077fbd9cf48f82e949365108ccc1
(CppunitTest_sw_layoutwriter: avoid some a11y-based layout testing,
2022-04-07) for motivation.
Change-Id: I50e6c49a50c5ccbec9e426ad796d85865dcc93e8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143128
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/source/core')
-rw-r--r-- | sw/source/core/access/accportions.cxx | 5 | ||||
-rw-r--r-- | sw/source/core/access/accportions.hxx | 4 | ||||
-rw-r--r-- | sw/source/core/inc/SwPortionHandler.hxx | 7 | ||||
-rw-r--r-- | sw/source/core/text/porfld.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/text/portxt.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/text/txttab.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/text/xmldump.cxx | 85 |
7 files changed, 9 insertions, 98 deletions
diff --git a/sw/source/core/access/accportions.cxx b/sw/source/core/access/accportions.cxx index 6117d7931f80..6cc693c98ac5 100644 --- a/sw/source/core/access/accportions.cxx +++ b/sw/source/core/access/accportions.cxx @@ -84,7 +84,7 @@ SwAccessiblePortionData::~SwAccessiblePortionData() } void SwAccessiblePortionData::Text(TextFrameIndex const nLength, - PortionType nType, sal_Int32 /*nHeight*/, sal_Int32 /*nWidth*/) + PortionType nType) { OSL_ENSURE((m_nViewPosition + nLength) <= TextFrameIndex(m_pTextFrame->GetText().getLength()), "portion exceeds model string!" ); @@ -109,8 +109,7 @@ void SwAccessiblePortionData::Text(TextFrameIndex const nLength, } void SwAccessiblePortionData::Special( - TextFrameIndex const nLength, const OUString& rText, PortionType nType, - const SwFont* /*pFont*/) + TextFrameIndex const nLength, const OUString& rText, PortionType nType) { OSL_ENSURE(m_nViewPosition >= TextFrameIndex(0), "illegal position"); OSL_ENSURE((m_nViewPosition + nLength) <= TextFrameIndex(m_pTextFrame->GetText().getLength()), diff --git a/sw/source/core/access/accportions.hxx b/sw/source/core/access/accportions.hxx index 81eab54144dc..01725c0007de 100644 --- a/sw/source/core/access/accportions.hxx +++ b/sw/source/core/access/accportions.hxx @@ -91,8 +91,8 @@ public: virtual ~SwAccessiblePortionData() override; // SwPortionHandler methods - virtual void Text(TextFrameIndex nLength, PortionType nType, sal_Int32 nHeight = 0, sal_Int32 nWidth = 0) override; - virtual void Special(TextFrameIndex nLength, const OUString& rText, PortionType nType, const SwFont* pFont = nullptr) override; + virtual void Text(TextFrameIndex nLength, PortionType nType) override; + virtual void Special(TextFrameIndex nLength, const OUString& rText, PortionType nType) override; virtual void LineBreak() override; virtual void Skip(TextFrameIndex nLength) override; virtual void Finish() override; diff --git a/sw/source/core/inc/SwPortionHandler.hxx b/sw/source/core/inc/SwPortionHandler.hxx index 5cffce8411ae..29625efbca84 100644 --- a/sw/source/core/inc/SwPortionHandler.hxx +++ b/sw/source/core/inc/SwPortionHandler.hxx @@ -56,9 +56,7 @@ public: */ virtual void Text( TextFrameIndex nLength, ///< length of this portion in the view string - PortionType nType, /// type of this portion - sal_Int32 nHeight = 0, /// height of this portion - sal_Int32 nWidth = 0 /// width of this portion + PortionType nType /// type of this portion ) = 0; /** special portion. This method is called for every non-text @@ -69,8 +67,7 @@ public: virtual void Special( TextFrameIndex nLength, ///< length of this portion in the view string const OUString& rText, /// text which is painted on-screen - PortionType nType, /// type of this portion - const SwFont* pFont = nullptr /// font of this portion + PortionType nType /// type of this portion ) = 0; /** line break. This method is called whenever a line break in the diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx index 01a42cfc4e82..146d0b9f76df 100644 --- a/sw/source/core/text/porfld.cxx +++ b/sw/source/core/text/porfld.cxx @@ -464,7 +464,7 @@ bool SwFieldPortion::GetExpText( const SwTextSizeInfo &rInf, OUString &rText ) c void SwFieldPortion::HandlePortion( SwPortionHandler& rPH ) const { - rPH.Special( GetLen(), m_aExpand, GetWhichPor(), m_pFont.get() ); + rPH.Special( GetLen(), m_aExpand, GetWhichPor() ); } void SwFieldPortion::dumpAsXml(xmlTextWriterPtr pWriter, const OUString& rText, diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx index 77aa7676e1f3..89df5fc6665c 100644 --- a/sw/source/core/text/portxt.cxx +++ b/sw/source/core/text/portxt.cxx @@ -673,7 +673,7 @@ tools::Long SwTextPortion::CalcSpacing( tools::Long nSpaceAdd, const SwTextSizeI void SwTextPortion::HandlePortion( SwPortionHandler& rPH ) const { - rPH.Text( GetLen(), GetWhichPor(), Height(), Width() ); + rPH.Text( GetLen(), GetWhichPor() ); } SwTextInputFieldPortion::SwTextInputFieldPortion() diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx index 58555334770b..389e4efb2e46 100644 --- a/sw/source/core/text/txttab.cxx +++ b/sw/source/core/text/txttab.cxx @@ -655,7 +655,7 @@ void SwAutoTabDecimalPortion::Paint( const SwTextPaintInfo & ) const void SwTabPortion::HandlePortion( SwPortionHandler& rPH ) const { - rPH.Text( GetLen(), GetWhichPor(), Height(), Width() ); + rPH.Text( GetLen(), GetWhichPor() ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx index f729c021f75d..1a419a495bf8 100644 --- a/sw/source/core/text/xmldump.cxx +++ b/sw/source/core/text/xmldump.cxx @@ -157,89 +157,6 @@ const char* sw::PortionTypeToString(PortionType nType) } namespace { - -class XmlPortionDumper:public SwPortionHandler -{ - private: - xmlTextWriterPtr m_Writer; - - public: - explicit XmlPortionDumper(xmlTextWriterPtr some_writer) - : m_Writer(some_writer) - {} - - /** - @param nLength - length of this portion in the model string - @param rText - text which is painted on-screen - */ - virtual void Text( TextFrameIndex nLength, - PortionType nType, - sal_Int32 nHeight, - sal_Int32 nWidth) override - { - (void)xmlTextWriterStartElement(m_Writer, BAD_CAST("Text")); - (void)xmlTextWriterWriteFormatAttribute(m_Writer, BAD_CAST("nLength"), "%i", - static_cast<int>(static_cast<sal_Int32>(nLength))); - (void)xmlTextWriterWriteFormatAttribute(m_Writer, BAD_CAST("nType"), "%s", - sw::PortionTypeToString(nType)); - if (nHeight > 0) - (void)xmlTextWriterWriteFormatAttribute(m_Writer, BAD_CAST("nHeight"), "%i", - static_cast<int>(nHeight)); - if (nWidth > 0) - (void)xmlTextWriterWriteFormatAttribute(m_Writer, BAD_CAST("nWidth"), "%i", - static_cast<int>(nWidth)); - (void)xmlTextWriterEndElement(m_Writer); - } - - /** - @param nLength - length of this portion in the model string - @param rText - text which is painted on-screen - @param nType - type of this portion - */ - virtual void Special( TextFrameIndex /*nLength*/, - const OUString & /*rText*/, - PortionType nType, - const SwFont* pFont ) override - { - (void)xmlTextWriterStartElement(m_Writer, BAD_CAST("Special")); - (void)xmlTextWriterWriteFormatAttribute(m_Writer, BAD_CAST("nType"), "%s", - sw::PortionTypeToString(nType)); - - if (pFont) - pFont->dumpAsXml(m_Writer); - - (void)xmlTextWriterEndElement(m_Writer); - } - - virtual void LineBreak() override - { - (void)xmlTextWriterStartElement(m_Writer, BAD_CAST("LineBreak")); - (void)xmlTextWriterEndElement(m_Writer); - } - - /** - * @param nLength - * number of 'model string' characters to be skipped - */ - virtual void Skip( TextFrameIndex /*nLength*/ ) override - { - (void)xmlTextWriterStartElement(m_Writer, BAD_CAST("Skip")); - (void)xmlTextWriterEndElement(m_Writer); - } - - virtual void Finish( ) override - { - (void)xmlTextWriterStartElement(m_Writer, BAD_CAST("Finish")); - (void)xmlTextWriterEndElement(m_Writer); - } - -}; - xmlTextWriterPtr lcl_createDefaultWriter() { xmlTextWriterPtr writer = xmlNewTextWriterFilename( "layout.xml", 0 ); @@ -440,8 +357,6 @@ void SwFrame::dumpAsXml( xmlTextWriterPtr writer ) const RTL_TEXTENCODING_UTF8 ); (void)xmlTextWriterWriteString( writer, reinterpret_cast<const xmlChar *>(aText8.getStr( )) ); - XmlPortionDumper pdumper( writer ); - pTextFrame->VisitPortions( pdumper ); if (const SwParaPortion* pPara = pTextFrame->GetPara()) { (void)xmlTextWriterStartElement(writer, BAD_CAST("SwParaPortion")); |