From 5f4a3e7bd77c3294ef85eebec17ed2d624dc3a2d Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Tue, 7 Nov 2017 09:02:11 +0100 Subject: tdf#113550 RTF import: fix incorrect text indent Left indent was set to non-zero in the style, but direct formatting set it back to zero. Teach deduplication to remove the NS_ooxml::LN_CT_PPrBase_ind SPRM itself in case the last attribute was removed. Change-Id: I01b202f0241b02816b2b392326737b1150caffc2 Reviewed-on: https://gerrit.libreoffice.org/44385 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- sw/qa/extras/rtfexport/data/tdf113550.rtf | 17 +++++++++++++++++ sw/qa/extras/rtfexport/rtfexport.cxx | 10 ++++++++++ sw/source/filter/ww8/docxsdrexport.cxx | 8 ++++---- sw/source/filter/ww8/docxsdrexport.hxx | 8 ++++---- 4 files changed, 35 insertions(+), 8 deletions(-) create mode 100644 sw/qa/extras/rtfexport/data/tdf113550.rtf (limited to 'sw') diff --git a/sw/qa/extras/rtfexport/data/tdf113550.rtf b/sw/qa/extras/rtfexport/data/tdf113550.rtf new file mode 100644 index 000000000000..ef89c9af5df6 --- /dev/null +++ b/sw/qa/extras/rtfexport/data/tdf113550.rtf @@ -0,0 +1,17 @@ +{\rtf1\adeflang1037\ansi\ansicpg1252\uc1\adeff1\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi0\deflang1033\deflangfe1033\themelang1033\themelangfe0\themelangcs0 +{\fonttbl +{\f0\fbidi \froman\fcharset238\fprq2 Times New Roman;} +} +{\stylesheet +{\ql \li0\ri0 Normal;} +{\s22\ql \li0\ri0 S22;} +{\s442\ql \li1418\ri0 \sbasedon22 S442;} +} +\paperw12240\paperh15840\margl1134\margr1134\margt1134\margb1410 +\trowd \cellx10008 +\pard\plain \ltrpar\s442\ql \li0\ri0\intbl +hello\par +\pard\cell\row +} +\pard\plain\par +} diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index 1d75996fcdda..ff6d400a41d6 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -1204,6 +1204,16 @@ DECLARE_RTFEXPORT_TEST(testTdf104085, "tdf104085.rtf") CPPUNIT_FAIL("no BulletChar property"); } +DECLARE_RTFEXPORT_TEST(testTdf113550, "tdf113550.rtf") +{ + uno::Reference xTable(getParagraphOrTable(1), uno::UNO_QUERY); + uno::Reference xCell(xTable->getCellByName("A1"), uno::UNO_QUERY); + uno::Reference xParagraph = getParagraphOfText(1, xCell->getText()); + // This was 2501, 0 as direct formatting was ignored on the paragraph (and + // the style had this larger value). + CPPUNIT_ASSERT_EQUAL(static_cast(0), getProperty(xParagraph, "ParaLeftMargin")); +} + DECLARE_RTFEXPORT_TEST(testLeveljcCenter, "leveljc-center.rtf") { // Tests that \leveljc1 is mapped to Adjust=Center for a numbering rule. diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx index aeb544a679b5..46671e083558 100644 --- a/sw/source/filter/ww8/docxsdrexport.cxx +++ b/sw/source/filter/ww8/docxsdrexport.cxx @@ -112,7 +112,7 @@ void lclMovePositionWithRotation(awt::Point& aPos, const Size& rSize, sal_Int64 } -ExportDataSaveRestore::ExportDataSaveRestore(DocxExport& rExport, sal_uLong nStt, sal_uLong nEnd, ww8::Frame const * pParentFrame) +ExportDataSaveRestore::ExportDataSaveRestore(DocxExport& rExport, sal_uLong nStt, sal_uLong nEnd, ww8::Frame const* pParentFrame) : m_rExport(rExport) { m_rExport.SaveData(nStt, nEnd); @@ -1291,7 +1291,7 @@ void DocxSdrExport::writeDiagram(const SdrObject* sdrObject, const SwFrameFormat } } -void DocxSdrExport::writeOnlyTextOfFrame(ww8::Frame const * pParentFrame) +void DocxSdrExport::writeOnlyTextOfFrame(ww8::Frame const* pParentFrame) { const SwFrameFormat& rFrameFormat = pParentFrame->GetFrameFormat(); const SwNodeIndex* pNodeIndex = rFrameFormat.GetContent().GetContentIdx(); @@ -1357,7 +1357,7 @@ void DocxSdrExport::writeBoxItemLine(const SvxBoxItem& rBox) pFS->endElementNS(XML_a, XML_ln); } -void DocxSdrExport::writeDMLTextFrame(ww8::Frame const * pParentFrame, int nAnchorId, bool bTextBoxOnly) +void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAnchorId, bool bTextBoxOnly) { bool bDMLAndVMLDrawingOpen = m_pImpl->m_bDMLAndVMLDrawingOpen; m_pImpl->m_bDMLAndVMLDrawingOpen = true; @@ -1634,7 +1634,7 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const * pParentFrame, int nAnch m_pImpl->m_bDMLAndVMLDrawingOpen = bDMLAndVMLDrawingOpen; } -void DocxSdrExport::writeVMLTextFrame(ww8::Frame const * pParentFrame, bool bTextBoxOnly) +void DocxSdrExport::writeVMLTextFrame(ww8::Frame const* pParentFrame, bool bTextBoxOnly) { bool bDMLAndVMLDrawingOpen = m_pImpl->m_bDMLAndVMLDrawingOpen; m_pImpl->m_bDMLAndVMLDrawingOpen = true; diff --git a/sw/source/filter/ww8/docxsdrexport.hxx b/sw/source/filter/ww8/docxsdrexport.hxx index 86bf9bca80ad..85bc1239069f 100644 --- a/sw/source/filter/ww8/docxsdrexport.hxx +++ b/sw/source/filter/ww8/docxsdrexport.hxx @@ -46,7 +46,7 @@ class ExportDataSaveRestore private: DocxExport& m_rExport; public: - ExportDataSaveRestore(DocxExport& rExport, sal_uLong nStt, sal_uLong nEnd, ww8::Frame const * pParentFrame); + ExportDataSaveRestore(DocxExport& rExport, sal_uLong nStt, sal_uLong nEnd, ww8::Frame const* pParentFrame); ~ExportDataSaveRestore(); }; @@ -101,13 +101,13 @@ public: const css::uno::Reference& xOutStream, const OUString& sGrabBagProperyName, int nAnchorId); /// Writes text frame in DML format. - void writeDMLTextFrame(ww8::Frame const * pParentFrame, int nAnchorId, bool bTextBoxOnly = false); + void writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAnchorId, bool bTextBoxOnly = false); /// Writes text frame in VML format. - void writeVMLTextFrame(ww8::Frame const * pParentFrame, bool bTextBoxOnly = false); + void writeVMLTextFrame(ww8::Frame const* pParentFrame, bool bTextBoxOnly = false); /// Is this a standalone TextFrame, or used as a TextBox of a shape? static bool isTextBox(const SwFrameFormat& rFrameFormat); /// Writes text from Textbox for - void writeOnlyTextOfFrame(ww8::Frame const * pParentFrame); + void writeOnlyTextOfFrame(ww8::Frame const* pParentFrame); /// Writes the drawingML markup of a box item. void writeBoxItemLine(const SvxBoxItem& rBox); }; -- cgit