summaryrefslogtreecommitdiff
path: root/writerfilter/source/rtftok/rtfdocumentimpl.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-08-02 20:08:17 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-08-02 22:44:54 +0200
commite2644b014005e1c79b0a7eaf1c3c4002464a1cf0 (patch)
tree52c24bcb37f2ebd73ad70efc2f45f0bdd5ed6875 /writerfilter/source/rtftok/rtfdocumentimpl.cxx
parentf0da01e59ffe1f7f1b5446f111994be6cf6f7d4a (diff)
loplugin:flatten in writerfilter
Change-Id: Ifaa63738c4e38dddd385821f568911927d834f1e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99966 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'writerfilter/source/rtftok/rtfdocumentimpl.cxx')
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx100
1 files changed, 50 insertions, 50 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 9fcbcf2a2f09..1f4ebda582d7 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -381,25 +381,25 @@ void RTFDocumentImpl::outputSettingsTable()
void RTFDocumentImpl::checkFirstRun()
{
- if (m_bFirstRun)
- {
- outputSettingsTable();
- // start initial paragraph
- m_bFirstRun = false;
- assert(!m_bNeedSect || m_bFirstRunException);
- setNeedSect(true); // first call that succeeds
+ if (!m_bFirstRun)
+ return;
- // set the requested default font, if there are none
- RTFValue::Pointer_t pFont
- = getNestedAttribute(m_aDefaultState.getCharacterSprms(),
- NS_ooxml::LN_EG_RPrBase_rFonts, NS_ooxml::LN_CT_Fonts_ascii);
- RTFValue::Pointer_t pCurrentFont
- = getNestedAttribute(m_aStates.top().getCharacterSprms(),
- NS_ooxml::LN_EG_RPrBase_rFonts, NS_ooxml::LN_CT_Fonts_ascii);
- if (pFont && !pCurrentFont)
- putNestedAttribute(m_aStates.top().getCharacterSprms(), NS_ooxml::LN_EG_RPrBase_rFonts,
- NS_ooxml::LN_CT_Fonts_ascii, pFont);
- }
+ outputSettingsTable();
+ // start initial paragraph
+ m_bFirstRun = false;
+ assert(!m_bNeedSect || m_bFirstRunException);
+ setNeedSect(true); // first call that succeeds
+
+ // set the requested default font, if there are none
+ RTFValue::Pointer_t pFont
+ = getNestedAttribute(m_aDefaultState.getCharacterSprms(), NS_ooxml::LN_EG_RPrBase_rFonts,
+ NS_ooxml::LN_CT_Fonts_ascii);
+ RTFValue::Pointer_t pCurrentFont
+ = getNestedAttribute(m_aStates.top().getCharacterSprms(), NS_ooxml::LN_EG_RPrBase_rFonts,
+ NS_ooxml::LN_CT_Fonts_ascii);
+ if (pFont && !pCurrentFont)
+ putNestedAttribute(m_aStates.top().getCharacterSprms(), NS_ooxml::LN_EG_RPrBase_rFonts,
+ NS_ooxml::LN_CT_Fonts_ascii, pFont);
}
void RTFDocumentImpl::setNeedPar(bool bNeedPar) { m_bNeedPar = bNeedPar; }
@@ -540,46 +540,46 @@ RTFDocumentImpl::getProperties(const RTFSprms& rAttributes, RTFSprms const& rSpr
void RTFDocumentImpl::checkNeedPap()
{
- if (m_bNeedPap)
- {
- m_bNeedPap = false; // reset early, so we can avoid recursion when calling ourselves
+ if (!m_bNeedPap)
+ return;
- if (m_aStates.empty())
- return;
+ m_bNeedPap = false; // reset early, so we can avoid recursion when calling ourselves
- if (!m_aStates.top().getCurrentBuffer())
- {
- writerfilter::Reference<Properties>::Pointer_t const pParagraphProperties(getProperties(
- m_aStates.top().getParagraphAttributes(), m_aStates.top().getParagraphSprms(),
- NS_ooxml::LN_Value_ST_StyleType_paragraph));
+ if (m_aStates.empty())
+ return;
- // Writer will ignore a page break before a text frame, so guard it with empty paragraphs
- bool hasBreakBeforeFrame = m_aStates.top().getFrame().hasProperties()
- && m_aStates.top().getParagraphSprms().find(
- NS_ooxml::LN_CT_PPrBase_pageBreakBefore);
- if (hasBreakBeforeFrame)
- {
- dispatchSymbol(RTF_PAR);
- m_bNeedPap = false;
- }
- Mapper().props(pParagraphProperties);
- if (hasBreakBeforeFrame)
- dispatchSymbol(RTF_PAR);
+ if (!m_aStates.top().getCurrentBuffer())
+ {
+ writerfilter::Reference<Properties>::Pointer_t const pParagraphProperties(getProperties(
+ m_aStates.top().getParagraphAttributes(), m_aStates.top().getParagraphSprms(),
+ NS_ooxml::LN_Value_ST_StyleType_paragraph));
- if (m_aStates.top().getFrame().hasProperties())
- {
- writerfilter::Reference<Properties>::Pointer_t const pFrameProperties(
- new RTFReferenceProperties(RTFSprms(), m_aStates.top().getFrame().getSprms()));
- Mapper().props(pFrameProperties);
- }
+ // Writer will ignore a page break before a text frame, so guard it with empty paragraphs
+ bool hasBreakBeforeFrame
+ = m_aStates.top().getFrame().hasProperties()
+ && m_aStates.top().getParagraphSprms().find(NS_ooxml::LN_CT_PPrBase_pageBreakBefore);
+ if (hasBreakBeforeFrame)
+ {
+ dispatchSymbol(RTF_PAR);
+ m_bNeedPap = false;
}
- else
+ Mapper().props(pParagraphProperties);
+ if (hasBreakBeforeFrame)
+ dispatchSymbol(RTF_PAR);
+
+ if (m_aStates.top().getFrame().hasProperties())
{
- auto pValue = new RTFValue(m_aStates.top().getParagraphAttributes(),
- m_aStates.top().getParagraphSprms());
- bufferProperties(*m_aStates.top().getCurrentBuffer(), pValue, nullptr);
+ writerfilter::Reference<Properties>::Pointer_t const pFrameProperties(
+ new RTFReferenceProperties(RTFSprms(), m_aStates.top().getFrame().getSprms()));
+ Mapper().props(pFrameProperties);
}
}
+ else
+ {
+ auto pValue = new RTFValue(m_aStates.top().getParagraphAttributes(),
+ m_aStates.top().getParagraphSprms());
+ bufferProperties(*m_aStates.top().getCurrentBuffer(), pValue, nullptr);
+ }
}
void RTFDocumentImpl::runProps()