sw/qa/extras/rtfimport/data/fdo52052.rtf         |    2 +-
 writerfilter/source/rtftok/rtfdispatchsymbol.cxx |    2 +-
 writerfilter/source/rtftok/rtfdocumentimpl.cxx   |    6 ++----
 writerfilter/source/rtftok/rtfdocumentimpl.hxx   |    5 ++---
 4 files changed, 6 insertions(+), 9 deletions(-)

New commits:
commit 7abb319821e641599f92e5f4ad2d7c0e377851fa
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Mon Dec 18 12:29:25 2023 -0500
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Dec 19 16:54:28 2023 +0100

    tdf#158586 RTF writerfilter: substitute hasProperties for inFrame
    
    A proper inFrame() would be identical to hasProperties,
    so just substitute the existing, complete function for inFrame.
    
    This is based on a code read, not a problem document,
    but finding a document that depended on inFrame
    returning true made it trivial to modify it to fail.
    
    Somewhat surprisingly, it made it all the way through
    the rtfexports without failing.
    
    make CppunitTest_sw_rtfimport CPPUNIT_TEST_NAME=testFdo52052
    
    Change-Id: I96f00c9b542dabd3709a896d778569b7681c8f19
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160928
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <jl...@mail.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160984

diff --git a/sw/qa/extras/rtfimport/data/fdo52052.rtf 
b/sw/qa/extras/rtfimport/data/fdo52052.rtf
index e58a64bd43f6..8ae92383c443 100644
--- a/sw/qa/extras/rtfimport/data/fdo52052.rtf
+++ b/sw/qa/extras/rtfimport/data/fdo52052.rtf
@@ -13,7 +13,7 @@
 {\pard \pvpg\phpg\posx2007\posy597\absw12870\absh-900\fi0 \ltrpar\qc first
 \par }
 \page\sect 
-{\pard \pvpg\phpg\posx13152\posy612\absw2984\absh-210\fi0 
\ltrpar\qr\tx360\tx720\tx1080\tx1440\tx1800\tx2160\tx2520\tx2880
+{\pard \pvpg\phpg \posxc\posyc \fi0 
\ltrpar\qr\tx360\tx720\tx1080\tx1440\tx1800\tx2160\tx2520\tx2880
 {\ltrch\f0 \b\i0\ul0\strike0\fs15 \cf1 second}
 \par }
 \page\sect 
diff --git a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx 
b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx
index 61499aac04b5..aa1360f6dc55 100644
--- a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx
@@ -124,7 +124,7 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword 
nKeyword)
             }
             // but don't emit properties yet, since they may change till the 
first text token arrives
             m_bNeedPap = true;
-            if (!m_aStates.top().getFrame().inFrame())
+            if (!m_aStates.top().getFrame().hasProperties())
                 m_bNeedPar = false;
             m_bNeedFinalPar = false;
         }
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index dc4bca02d73b..1d0c2d7dde4c 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1337,8 +1337,6 @@ RTFError RTFDocumentImpl::resolveChars(char ch)
     return RTFError::OK;
 }
 
-bool RTFFrame::inFrame() const { return m_nW > 0 || m_nH > 0 || m_nX > 0 || 
m_nY > 0; }
-
 void RTFDocumentImpl::singleChar(sal_uInt8 nValue, bool bRunProps)
 {
     sal_uInt8 sValue[] = { nValue };
@@ -2952,7 +2950,7 @@ RTFError RTFDocumentImpl::beforePopState(RTFParserState& 
rState)
         case Destination::SHAPE:
             m_bNeedFinalPar = true;
             m_bNeedCr = m_bNeedCrOrig;
-            if (rState.getFrame().inFrame())
+            if (rState.getFrame().hasProperties())
             {
                 // parBreak() modifies m_aStates.top() so we can't apply 
resetFrame() directly on aState
                 resetFrame();
@@ -3615,7 +3613,7 @@ RTFError RTFDocumentImpl::popState()
 
     checkUnicode(/*bUnicode =*/true, /*bHex =*/true);
     RTFParserState aState(m_aStates.top());
-    m_bWasInFrame = aState.getFrame().inFrame();
+    m_bWasInFrame = aState.getFrame().hasProperties();
 
     // dmapper expects some content in header/footer, so if there would be 
nothing, add an empty paragraph.
     if (m_pTokenizer->getGroup() == 1 && m_bFirstRun)
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 091739888089..eb50e3c7e088 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -384,9 +384,8 @@ public:
     RTFSprms getSprms();
     /// Store a property
     void setSprm(Id nId, Id nValue);
-    bool hasProperties() const;
     /// If we got tokens indicating we're in a frame.
-    bool inFrame() const;
+    bool hasProperties() const;
 };
 
 /// State of the parser, which gets saved / restored when changing groups.
@@ -967,7 +966,7 @@ private:
     RTFKeyword m_nResetBreakOnSectBreak;
     /// If a section break is needed before the end of the doc (false right 
after a section break).
     bool m_bNeedSect;
-    /// If aFrame.inFrame() was true in the previous state.
+    /// If aFrame.hasProperties() was true in the previous state.
     bool m_bWasInFrame;
     /// A picture was seen in the current paragraph.
     bool m_bHadPicture;

Reply via email to