summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2023-12-01 14:30:45 -0500
committerMiklos Vajna <vmiklos@collabora.com>2023-12-05 08:49:33 +0100
commitb63a12d481cd26f960f97f74e5a4d764966db338 (patch)
tree97a9141d207e7da5749bdda36f002844c27b7693
parentcaecfff1adbe9715260ef9e2009333e523d61123 (diff)
tdf#148540 Revert "tdf#109790 RTF import: keep remembering...
... paragraph style between \cell and \row" This reverts 5.4.1 commit aaa6a5202a447fb4e86d5f016d8e79fbc34a3ed7, and rtfexport7's tdf109790.rtf unit test still passes. I also did a visual test, which looks good. After \cell, we normally get more \cells, so an impending \row is completely unexpected most of the time. I'm not really sure why that patch was ever thought to be good. The problem was that \pard was not removing the paragraph style that was assigned to an earlier column. The end result seemed innocent (no bad formatting noticed), but that is probably based on other work done in the meantime which allows the unit test to still pass even after all of "its code" has been reverted. [If this causes a regression, perhaps m_pLastCharacterContext could be of value?] Change-Id: Ide9b65f5e5fa39c21bac6d8ed354bb88e0bbefe5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160233 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com>
-rw-r--r--sw/qa/extras/rtfexport/rtfexport6.cxx2
-rw-r--r--writerfilter/source/rtftok/rtfdispatchflag.cxx9
-rw-r--r--writerfilter/source/rtftok/rtfdispatchsymbol.cxx4
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx1
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.hxx3
5 files changed, 3 insertions, 16 deletions
diff --git a/sw/qa/extras/rtfexport/rtfexport6.cxx b/sw/qa/extras/rtfexport/rtfexport6.cxx
index f4ff562c37e8..e65e57fd3192 100644
--- a/sw/qa/extras/rtfexport/rtfexport6.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport6.cxx
@@ -172,6 +172,8 @@ DECLARE_RTFEXPORT_TEST(testTdf108505_fieldCharFormat, "tdf108505_fieldCharFormat
CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, getProperty<float>(xRun, "CharWeight"));
CPPUNIT_ASSERT_EQUAL(awt::FontSlant_NONE, getProperty<awt::FontSlant>(xRun, "CharPosture"));
CPPUNIT_ASSERT_EQUAL(COL_LIGHTGREEN, getProperty<Color>(xRun, "CharColor"));
+
+ CPPUNIT_ASSERT_EQUAL(OUString("Standard"), getProperty<OUString>(xPara, "ParaStyleName"));
}
DECLARE_RTFEXPORT_TEST(testTdf108505_fieldCharFormat2, "tdf108505_fieldCharFormat2.rtf")
diff --git a/writerfilter/source/rtftok/rtfdispatchflag.cxx b/writerfilter/source/rtftok/rtfdispatchflag.cxx
index 23d8f5d1f59f..72c777aab1fb 100644
--- a/writerfilter/source/rtftok/rtfdispatchflag.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchflag.cxx
@@ -579,8 +579,6 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
dispatchSymbol(RTFKeyword::PAR);
// \pard is allowed between \cell and \row, but in that case it should not reset the fact that we're inside a table.
// It should not reset the paragraph style, either, so remember the old paragraph style.
- RTFValue::Pointer_t pOldStyle
- = m_aStates.top().getParagraphSprms().find(NS_ooxml::LN_CT_PPrBase_pStyle);
m_aStates.top().getParagraphSprms() = m_aDefaultState.getParagraphSprms();
m_aStates.top().getParagraphAttributes() = m_aDefaultState.getParagraphAttributes();
@@ -593,19 +591,14 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
{
// We are still in a table.
m_aStates.top().getParagraphSprms().set(NS_ooxml::LN_inTbl, new RTFValue(1));
- if (m_bAfterCellBeforeRow && pOldStyle)
- // And we still have the same paragraph style.
- m_aStates.top().getParagraphSprms().set(NS_ooxml::LN_CT_PPrBase_pStyle,
- pOldStyle);
// Ideally getDefaultSPRM() would take care of this, but it would not when we're buffering.
m_aStates.top().getParagraphSprms().set(NS_ooxml::LN_CT_PPrBase_tabs,
new RTFValue());
}
resetFrame();
- // Reset currently selected paragraph style as well, unless we are in the special "after \cell, before \row" state.
+ // Reset currently selected paragraph style as well.
// By default the style with index 0 is applied.
- if (!m_bAfterCellBeforeRow)
{
OUString const aName = getStyleName(0);
// But only in case it's not a character style.
diff --git a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx
index d5b196790a50..61499aac04b5 100644
--- a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx
@@ -180,9 +180,6 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
case RTFKeyword::CELL:
case RTFKeyword::NESTCELL:
{
- if (nKeyword == RTFKeyword::CELL)
- m_bAfterCellBeforeRow = true;
-
checkFirstRun();
if (m_bNeedPap)
{
@@ -236,7 +233,6 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
break;
case RTFKeyword::ROW:
{
- m_bAfterCellBeforeRow = false;
if (m_aStates.top().getTableRowWidthAfter() > 0)
{
// Add fake cellx / cell, RTF equivalent of
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 76ab50135427..79b12dc0c7dd 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -330,7 +330,6 @@ RTFDocumentImpl::RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& x
, m_hasFHeader(false)
, m_hasRFooter(false)
, m_hasFFooter(false)
- , m_bAfterCellBeforeRow(false)
{
OSL_ASSERT(xInputStream.is());
m_pInStream = utl::UcbStreamHelper::CreateStream(xInputStream, true);
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 47fedc431bfb..091739888089 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -988,9 +988,6 @@ private:
bool m_hasFHeader;
bool m_hasRFooter;
bool m_hasFFooter;
-
- /// Are we after a \cell, but before a \row?
- bool m_bAfterCellBeforeRow;
};
} // namespace writerfilter::rtftok