sw/qa/core/text/text.cxx | 4 + sw/qa/extras/ooxmlexport/ooxmlexport10.cxx | 2 sw/qa/extras/ooxmlexport/ooxmlexport12.cxx | 3 - sw/qa/extras/ooxmlexport/ooxmlexport13.cxx | 2 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 6 +- sw/qa/extras/ooxmlexport/ooxmlexport17.cxx | 4 - sw/qa/extras/ooxmlexport/ooxmlexport8.cxx | 4 - sw/qa/extras/ooxmlimport/ooxmlimport2.cxx | 2 sw/qa/extras/rtfimport/rtfimport.cxx | 4 + sw/qa/extras/uiwriter/uiwriter.cxx | 2 sw/qa/extras/uiwriter/uiwriter4.cxx | 45 +++++++++++---- sw/qa/extras/uiwriter/uiwriter7.cxx | 7 +- sw/qa/extras/uiwriter/uiwriter8.cxx | 2 sw/qa/extras/ww8import/ww8import.cxx | 2 sw/source/core/access/accportions.cxx | 5 - sw/source/core/access/accportions.hxx | 4 - sw/source/core/inc/SwPortionHandler.hxx | 7 -- sw/source/core/text/porfld.cxx | 2 sw/source/core/text/portxt.cxx | 2 sw/source/core/text/txttab.cxx | 2 sw/source/core/text/xmldump.cxx | 85 ----------------------------- 21 files changed, 66 insertions(+), 130 deletions(-)
New commits: commit 59e25927f4babdc142cdcbd81b5ceb7afe798d02 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Tue Nov 22 20:01:35 2022 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Wed Nov 23 08:12:29 2022 +0100 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 <vmik...@collabora.com> diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx index 9125cf256a4b..8616f7d331e9 100644 --- a/sw/qa/core/text/text.cxx +++ b/sw/qa/core/text/text.cxx @@ -141,7 +141,9 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTabOverMarginSection) createSwDoc("tabovermargin-section.fodt"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); sal_Int32 nWidth - = getXPath(pXmlDoc, "//Text[@nType='PortionType::TabRight']", "nWidth").toInt32(); + = getXPath(pXmlDoc, "//SwParaPortion/SwLineLayout/child::*[@type='PortionType::TabRight']", + "width") + .toInt32(); // Without the accompanying fix in place, this test would have failed with: // - Expected less than: 5000 // - Actual : 9372 diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx index cd7968b428e4..c6c9a3cb4c8b 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx @@ -1049,7 +1049,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf95377, "tdf95377.docx") assertXPath(pXmlDoc, "//body/txt[1]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::Number']", "expand", "a."); assertXPath(pXmlDoc, "//body/txt[2]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::Number']", "expand", "b."); assertXPath(pXmlDoc, "//body/txt[3]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::Number']", "expand", "c."); - assertXPath(pXmlDoc, "/root/page/body/txt[4]/Special", 0); //last paragraph style disables numbering + assertXPath(pXmlDoc, "/root/page/body/txt[4]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::Number']", 0); //last paragraph style disables numbering } DECLARE_OOXMLEXPORT_TEST(testTdf95376, "tdf95376.docx") diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx index 09e916005468..eaddd1d6f48c 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx @@ -687,7 +687,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf112202, "090716_Studentische_Arbeit_VWS.docx") // page 3 header: 1 table, 1 paragraph, no text assertXPath(pXmlDoc, "/root/page[3]/header/txt", 1); assertXPath(pXmlDoc, "/root/page[3]/header/tab", 1); - assertXPath(pXmlDoc, "/root/page[3]/header/tab/row/cell/txt/Text", 0); + assertXPath(pXmlDoc, + "/root/page[3]/header/tab/row/cell/txt/SwParaPortion/SwLineLayout/child::*", 0); assertXPath(pXmlDoc, "/root/page[3]/header//anchored", 0); // tdf#149313: ensure 3rd page does not have extra empty paragraph at top assertXPathContent(pXmlDoc, "/root/page[3]/body//txt", "AUFGABENSTELLUNG"); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx index 71998af86753..c97fc13e2bd3 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -437,7 +437,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf123636_newlinePageBreak4, "tdf123636_newlinePage CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Pages", 2, getPages() ); xmlDocUniquePtr pDump = parseLayoutDump(); - assertXPath(pDump, "/root/page[2]/body/txt[1]/Text", 0); + assertXPath(pDump, "/root/page[2]/body/txt[1]/SwParaPortion", 0); } DECLARE_OOXMLEXPORT_TEST(testTdf118947_tableStyle, "tdf118947_tableStyle.docx") diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index b68c077af668..19cf5dee5e3f 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -280,7 +280,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf129888dml, "tdf129888dml.docx") CPPUNIT_TEST_FIXTURE(Test, testTdf130120) { loadAndSave("tdf130120.docx"); - //Text for exporting the allowincell attribute: + // Text for exporting the allowincell attribute: xmlDocUniquePtr p_XmlDoc = parseExport("word/document.xml"); assertXPath(p_XmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc/w:p/w:r/mc:AlternateContent/" "mc:Choice/w:drawing/wp:anchor", "layoutInCell", "0"); @@ -551,7 +551,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf78352, "tdf78352.docx") CPPUNIT_ASSERT_EQUAL(1, getPages()); // Ensure that width of first tab is close to zero (previous value was ~1000 twips) - int nWidth = parseDump("/root/page/body/txt[1]/Text[@nType='PortionType::TabLeft']", "nWidth").toInt32(); + int nWidth = parseDump("/root/page/body/txt[1]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::TabLeft']", "width").toInt32(); CPPUNIT_ASSERT_LESS(150, nWidth); } @@ -731,7 +731,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf83309, "tdf83309.docx") // First paragraph does not have tab before // (same applies to all paragraphs in doc, but lets assume they are // behave same way) - OUString sNodeType = parseDump("/root/page[1]/body/txt[1]/Text[1]", "nType"); + OUString sNodeType = parseDump("(/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/child::*)[1]", "type"); CPPUNIT_ASSERT_EQUAL(OUString("PortionType::Text"), sNodeType); // tdf148380: creation-date field in header.xml was unsupported on export diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx index 05682a4d48d4..e294a51feabb 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx @@ -1055,9 +1055,9 @@ DECLARE_OOXMLEXPORT_TEST(testTdf148360, "tdf148360.docx") const auto& pLayout = parseLayoutDump(); // Ensure first element is a tab - assertXPath(pLayout, "/root/page[1]/body/txt[1]/Text[1]", "nType", "PortionType::TabLeft"); + assertXPath(pLayout, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/child::*[1]", "type", "PortionType::TabLeft"); // and only then goes content - assertXPath(pLayout, "/root/page[1]/body/txt[1]/Text[2]", "nType", "PortionType::Text"); + assertXPath(pLayout, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/child::*[2]", "type", "PortionType::Text"); } DECLARE_OOXMLEXPORT_TEST(testTdf135923, "tdf135923-min.docx") diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx index 5ee39c6b5e13..4378f3b1a0c7 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx @@ -712,8 +712,8 @@ DECLARE_OOXMLEXPORT_TEST(testN793262, "n793262.docx") DECLARE_OOXMLEXPORT_TEST(testN793998, "n793998.docx") { - sal_Int32 nTextPortion = parseDump("/root/page/body/txt/Text[1]", "nWidth").toInt32(); // Width of the first (text) portion - sal_Int32 nTabPortion = parseDump("/root/page/body/txt/Text[2]", "nWidth").toInt32(); // Width of the second (tab) portion + sal_Int32 nTextPortion = parseDump("/root/page/body/txt/SwParaPortion/SwLineLayout/child::*[1]", "width").toInt32(); // Width of the first (text) portion + sal_Int32 nTabPortion = parseDump("/root/page/body/txt/SwParaPortion/SwLineLayout/child::*[2]", "width").toInt32(); // Width of the second (tab) portion sal_Int32 nParagraph = parseDump("/root/page/body/txt/infos/bounds", "width").toInt32(); // Width of the paragraph sal_Int32 const nRightMargin = 3000; // The problem was that the tab portion didn't ignore the right margin, so text + tab width wasn't larger than body (paragraph - right margin) width. diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx index dd36e5e02059..1c79dbecf75f 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx @@ -407,7 +407,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf120548) // Without the accompanying fix in place, this test would have failed with 'Expected: 00ff0000; // Actual: ffffffff', i.e. the numbering portion was black, not red. CPPUNIT_ASSERT_EQUAL(OUString("00ff0000"), - parseDump("//Special[@nType='PortionType::Number']/SwFont", "color")); + parseDump("//SwFieldPortion[@type='PortionType::Number']", "font-color")); } CPPUNIT_TEST_FIXTURE(Test, test120551) diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index c018f9a581a9..e7392d333068 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -393,7 +393,9 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf112211_2) createSwDoc("tdf112211-2.rtf"); // Spacing between the bullet and the actual text was too large. // This is now around 269, large old value was 629. - int nWidth = parseDump("/root/page/body/txt[2]/Text[@nType='PortionType::TabLeft']", "nWidth") + int nWidth = parseDump("/root/page/body/txt[2]/SwParaPortion/SwLineLayout/" + "child::*[@type='PortionType::TabLeft']", + "width") .toInt32(); CPPUNIT_ASSERT_LESS(300, nWidth); } diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index fc3daa6bd7ea..4d930f7bca21 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -1528,7 +1528,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf90003) CPPUNIT_ASSERT(pXmlDoc); // This was 1: an unexpected fly portion was created, resulting in too // large x position for the empty paragraph marker. - assertXPath(pXmlDoc, "//Special[@nType='PortionType::Fly']", 0); + assertXPath(pXmlDoc, "//SwFixPortion[@type='PortionType::Fly']", 0); } CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf51741) diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx b/sw/qa/extras/uiwriter/uiwriter4.cxx index 0463360d3a14..77b42667ee87 100644 --- a/sw/qa/extras/uiwriter/uiwriter4.cxx +++ b/sw/qa/extras/uiwriter/uiwriter4.cxx @@ -1873,11 +1873,17 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf107362) createSwDoc("tdf107362.odt"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); sal_Int32 nHeight - = getXPath(pXmlDoc, "(//Text[@nType='PortionType::Text'])[1]", "nHeight").toInt32(); + = getXPath(pXmlDoc, "(//SwParaPortion/SwLineLayout/child::*[@type='PortionType::Text'])[1]", + "height") + .toInt32(); sal_Int32 nWidth1 - = getXPath(pXmlDoc, "(//Text[@nType='PortionType::Text'])[1]", "nWidth").toInt32(); + = getXPath(pXmlDoc, "(//SwParaPortion/SwLineLayout/child::*[@type='PortionType::Text'])[1]", + "width") + .toInt32(); sal_Int32 nWidth2 - = getXPath(pXmlDoc, "(//Text[@nType='PortionType::Text'])[2]", "nWidth").toInt32(); + = getXPath(pXmlDoc, "(//SwParaPortion/SwLineLayout/child::*[@type='PortionType::Text'])[2]", + "width") + .toInt32(); sal_Int32 nLineWidth = getXPath(pXmlDoc, "//SwParaPortion/SwLineLayout", "width").toInt32(); sal_Int32 nKernWidth = nLineWidth - nWidth1 - nWidth2; // Test only if fonts are available @@ -1989,7 +1995,10 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf106736) createSwDoc("tdf106736-grid.odt"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); sal_Int32 nWidth - = getXPath(pXmlDoc, "(//Text[@nType='PortionType::TabLeft'])[1]", "nWidth").toInt32(); + = getXPath(pXmlDoc, + "(//SwParaPortion/SwLineLayout/child::*[@type='PortionType::TabLeft'])[1]", + "width") + .toInt32(); // In tdf106736, width of tab overflow so that it got // width value around 9200, expected value is around 103 CPPUNIT_ASSERT_MESSAGE("Left Tab width is ~103", nWidth < 150); @@ -2005,10 +2014,18 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testMsWordCompTrailingBlanks) calcLayout(); // Check that trailing spaces spans have no width if option is enabled - CPPUNIT_ASSERT_EQUAL(OUString(), parseDump("/root/page/body/txt[2]/Text[4]", "nWidth")); - CPPUNIT_ASSERT_EQUAL(OUString(), parseDump("/root/page/body/txt[2]/Text[5]", "nWidth")); - CPPUNIT_ASSERT_EQUAL(OUString(), parseDump("/root/page/body/txt[3]/Text[4]", "nWidth")); - CPPUNIT_ASSERT_EQUAL(OUString(), parseDump("/root/page/body/txt[3]/Text[5]", "nWidth")); + CPPUNIT_ASSERT_EQUAL( + OUString("0"), + parseDump("/root/page/body/txt[2]/SwParaPortion/SwLineLayout/child::*[4]", "width")); + CPPUNIT_ASSERT_EQUAL( + OUString("0"), + parseDump("/root/page/body/txt[2]/SwParaPortion/SwLineLayout/child::*[5]", "width")); + CPPUNIT_ASSERT_EQUAL( + OUString("0"), + parseDump("/root/page/body/txt[3]/SwParaPortion/SwLineLayout/child::*[4]", "width")); + CPPUNIT_ASSERT_EQUAL( + OUString("0"), + parseDump("/root/page/body/txt[3]/SwParaPortion/SwLineLayout/child::*[5]", "width")); // The option is false in settings.xml createSwDoc("MsWordCompTrailingBlanksFalse.odt"); @@ -2017,10 +2034,14 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testMsWordCompTrailingBlanks) DocumentSettingId::MS_WORD_COMP_TRAILING_BLANKS)); calcLayout(); // Check that trailing spaces spans have width if option is disabled - CPPUNIT_ASSERT(!parseDump("/root/page/body/txt[2]/Text[4]", "nWidth").isEmpty()); - CPPUNIT_ASSERT(!parseDump("/root/page/body/txt[2]/Text[5]", "nWidth").isEmpty()); - CPPUNIT_ASSERT(!parseDump("/root/page/body/txt[3]/Text[4]", "nWidth").isEmpty()); - CPPUNIT_ASSERT(!parseDump("/root/page/body/txt[3]/Text[5]", "nWidth").isEmpty()); + CPPUNIT_ASSERT( + parseDump("/root/page/body/txt[2]/SwParaPortion/SwLineLayout/child::*[4]", "width") != "0"); + CPPUNIT_ASSERT( + parseDump("/root/page/body/txt[2]/SwParaPortion/SwLineLayout/child::*[5]", "width") != "0"); + CPPUNIT_ASSERT( + parseDump("/root/page/body/txt[3]/SwParaPortion/SwLineLayout/child::*[4]", "width") != "0"); + CPPUNIT_ASSERT( + parseDump("/root/page/body/txt[3]/SwParaPortion/SwLineLayout/child::*[5]", "width") != "0"); // MsWordCompTrailingBlanks option should be false by default in new documents createSwDoc(); diff --git a/sw/qa/extras/uiwriter/uiwriter7.cxx b/sw/qa/extras/uiwriter/uiwriter7.cxx index e7c6f3f494bb..8c14e7184f44 100644 --- a/sw/qa/extras/uiwriter/uiwriter7.cxx +++ b/sw/qa/extras/uiwriter/uiwriter7.cxx @@ -2541,14 +2541,13 @@ public: void clear() { mPortionItems.clear(); } - virtual void Text(TextFrameIndex nLength, PortionType nType, sal_Int32 /*nHeight*/, - sal_Int32 /*nWidth*/) override + virtual void Text(TextFrameIndex nLength, PortionType nType) override { mPortionItems.emplace_back("text", sal_Int32(nLength), nType); } - virtual void Special(TextFrameIndex nLength, const OUString& /*rText*/, PortionType nType, - const SwFont* /*pFont*/) override + virtual void Special(TextFrameIndex nLength, const OUString& /*rText*/, + PortionType nType) override { mPortionItems.emplace_back("special", sal_Int32(nLength), nType); } diff --git a/sw/qa/extras/uiwriter/uiwriter8.cxx b/sw/qa/extras/uiwriter/uiwriter8.cxx index e6b5d0dad60c..e61c7ab42547 100644 --- a/sw/qa/extras/uiwriter/uiwriter8.cxx +++ b/sw/qa/extras/uiwriter/uiwriter8.cxx @@ -393,7 +393,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf141391) pXmlDoc = parseLayoutDump(); // 2 rows again, no copied text content assertXPath(pXmlDoc, "/root/page[1]/body/tab/row", 2); - assertXPath(pXmlDoc, "/root/page[1]/body/tab/row[2]/cell[1]/Text", 0); + assertXPath(pXmlDoc, "/root/page[1]/body/tab/row[2]/cell[1]/SwParaPortion", 0); // insert the 2-row table into the second paragraph of cell "A2" as a nested table // For this it's enough to positionate the text cursor not in the first paragraph diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx index 772df7a55a18..f5f679da1f04 100644 --- a/sw/qa/extras/ww8import/ww8import.cxx +++ b/sw/qa/extras/ww8import/ww8import.cxx @@ -143,7 +143,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf106799) OString cellXPath("/root/page/body/tab/row/cell/tab/row[" + OString::number(nRow+1) + "]/cell[" + OString::number(nCell+1) + "]/"); CPPUNIT_ASSERT_EQUAL_MESSAGE(cellXPath.getStr(), nCellWidths[nRow][nCell], parseDump(cellXPath + "infos/bounds", "width").toInt32()); if (nCellTxtLns[nRow][nCell] != 0) - CPPUNIT_ASSERT_EQUAL_MESSAGE(cellXPath.getStr(), nCellTxtLns[nRow][nCell], parseDump(cellXPath + "txt/Text", "nLength").toInt32()); + CPPUNIT_ASSERT_EQUAL_MESSAGE(cellXPath.getStr(), nCellTxtLns[nRow][nCell], parseDump(cellXPath + "txt/SwParaPortion/SwLineLayout", "length").toInt32()); } } 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"));