diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2024-01-31 14:47:22 +0100 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2024-02-01 09:34:10 +0100 |
commit | 4913812baeabd44b46302e54b73a227e760c688a (patch) | |
tree | 0b81ec9618e8280d9fbd9f45c6c3f7e752a4152c | |
parent | 8869994d5e62c422465f52b25dc3792be9add92d (diff) |
writerfilter: move m_bParaHadField to SubstreamContext
Change-Id: Ie15e35d304a423bfa3d7b7ead71015d5ec1228d4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162839
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 20 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.hxx | 7 |
2 files changed, 11 insertions, 16 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 03886000935d..8f56f102e65f 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -401,8 +401,6 @@ DomainMapper_Impl::DomainMapper_Impl( m_bIgnoreNextTab(false), m_bIsSplitPara(false), m_bIsActualParagraphFramed( false ), - m_bParaHadField(false), - m_bSaveParaHadField(false), m_bParaAutoBefore(false), m_bFirstParagraphInCell(true), m_bSaveFirstParagraphInCell(false), @@ -2614,7 +2612,8 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con else { uno::Reference<text::XTextCursor> xCursor; - if (m_bParaHadField && !m_bIsInComments && !m_xTOCMarkerCursor.is()) + if (m_StreamStateStack.top().bParaHadField + && !m_bIsInComments && !m_xTOCMarkerCursor.is()) { // Workaround to make sure char props of the field are not lost. // Not relevant for editeng-based comments. @@ -3017,7 +3016,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con } SetIsOutsideAParagraph(true); - m_bParaHadField = false; + m_StreamStateStack.top().bParaHadField = false; // don't overwrite m_bFirstParagraphInCell in table separator nodes // and in text boxes anchored to the first paragraph of table cells @@ -3789,7 +3788,6 @@ bool isContentEmpty(uno::Reference<text::XText> const& xText, uno::Reference<tex void DomainMapper_Impl::PushPageHeaderFooter(PagePartType ePagePartType, PageType eType) { - m_bSaveParaHadField = m_bParaHadField; m_StreamStateStack.emplace(); bool bHeader = ePagePartType == PagePartType::Header; @@ -3954,8 +3952,6 @@ void DomainMapper_Impl::PopPageHeaderFooter(PagePartType ePagePartType, PageType assert(!m_StreamStateStack.empty()); m_StreamStateStack.pop(); - - m_bParaHadField = m_bSaveParaHadField; } void DomainMapper_Impl::PushFootOrEndnote( bool bIsFootnote ) @@ -5932,7 +5928,7 @@ uno::Reference<beans::XPropertySet> DomainMapper_Impl::FindOrCreateFieldMaster(c void DomainMapper_Impl::PushFieldContext() { - m_bParaHadField = true; + m_StreamStateStack.top().bParaHadField = true; if(m_bDiscardHeaderFooter) return; #ifdef DBG_UTIL @@ -7045,7 +7041,7 @@ void DomainMapper_Impl::handleToc m_bStartTOC = true; pContext->SetTOC(xTOC); - m_bParaHadField = false; + m_StreamStateStack.top().bParaHadField = false; if (!xTOC) return; @@ -7278,7 +7274,7 @@ void DomainMapper_Impl::handleBibliography xTOC->setPropertyValue(getPropertyName( PROP_TITLE ), uno::Any(OUString())); pContext->SetTOC( xTOC ); - m_bParaHadField = false; + m_StreamStateStack.top().bParaHadField = false; uno::Reference< text::XTextContent > xToInsert( xTOC, uno::UNO_QUERY ); appendTextContent(xToInsert, uno::Sequence< beans::PropertyValue >() ); @@ -7321,7 +7317,7 @@ void DomainMapper_Impl::handleIndex } } pContext->SetTOC( xTOC ); - m_bParaHadField = false; + m_StreamStateStack.top().bParaHadField = false; uno::Reference< text::XTextContent > xToInsert( xTOC, uno::UNO_QUERY ); appendTextContent(xToInsert, uno::Sequence< beans::PropertyValue >() ); @@ -8339,7 +8335,7 @@ void DomainMapper_Impl::CloseFieldCommand() } } else - m_bParaHadField = false; + m_StreamStateStack.top().bParaHadField = false; } } catch( const uno::Exception& ) diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx index 4f6bca22aa19..518f490cf12c 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx @@ -187,6 +187,8 @@ struct SubstreamContext bool bIsColumnBreakDeferred = false; bool bIsPageBreakDeferred = false; sal_Int32 nLineBreaksDeferred = 0; + /// Current paragraph had at least one field in it. + bool bParaHadField = false; }; /// Information about a paragraph to be finished after a field end. @@ -767,7 +769,7 @@ public: const std::stack<BookmarkInsertPosition>& GetSdtStarts() const; bool GetParaChanged() const { return m_bParaChanged;} - bool GetParaHadField() const { return m_bParaHadField; } + bool GetParaHadField() const { return m_StreamStateStack.top().bParaHadField; } bool GetRemoveThisPara() const { return m_bRemoveThisParagraph; } void deferBreak( BreakType deferredBreakType ); @@ -1227,9 +1229,6 @@ private: // Start a new index section; if needed, finish current paragraph css::uno::Reference<css::beans::XPropertySet> StartIndexSectionChecked(const OUString& sServiceName); std::vector<css::uno::Reference< css::drawing::XShape > > m_vTextFramesForChaining ; - /// Current paragraph had at least one field in it. - bool m_bParaHadField; - bool m_bSaveParaHadField; css::uno::Reference<css::beans::XPropertySet> m_xPreviousParagraph; /// Current paragraph has automatic before spacing. bool m_bParaAutoBefore; |