diff options
39 files changed, 325 insertions, 147 deletions
diff --git a/sw/inc/modcfg.hxx b/sw/inc/modcfg.hxx index bf5148bee215..dd9c9ed40e15 100644 --- a/sw/inc/modcfg.hxx +++ b/sw/inc/modcfg.hxx @@ -278,26 +278,30 @@ public: bool IsInsTableFormatNum(bool bHTML) const { return bHTML ? m_aWebTableConfig.bInsTableFormatNum : m_aTableConfig.bInsTableFormatNum; } void SetInsTableFormatNum( bool bHTML, bool b ) - { bHTML ? (m_aWebTableConfig.bInsTableFormatNum = b) : (m_aTableConfig.bInsTableFormatNum = b); - bHTML ? m_aWebTableConfig.SetModified() : m_aTableConfig.SetModified();} + { auto & config = bHTML ? m_aWebTableConfig : m_aTableConfig; + config.bInsTableFormatNum = b; + config.SetModified();} bool IsInsTableChangeNumFormat(bool bHTML) const { return bHTML ? m_aWebTableConfig.bInsTableChangeNumFormat : m_aTableConfig.bInsTableChangeNumFormat; } void SetInsTableChangeNumFormat( bool bHTML, bool b ) - { bHTML ? (m_aWebTableConfig.bInsTableChangeNumFormat = b) : (m_aTableConfig.bInsTableChangeNumFormat = b); - bHTML ? m_aWebTableConfig.SetModified() : m_aTableConfig.SetModified();} + { auto & config = bHTML ? m_aWebTableConfig : m_aTableConfig; + config.bInsTableChangeNumFormat = b; + config.SetModified();} bool IsInsTableAlignNum(bool bHTML) const { return bHTML ? m_aWebTableConfig.bInsTableAlignNum : m_aTableConfig.bInsTableAlignNum; } void SetInsTableAlignNum( bool bHTML, bool b ) - { bHTML ? (m_aWebTableConfig.bInsTableAlignNum = b) : (m_aTableConfig.bInsTableAlignNum = b); - bHTML ? m_aWebTableConfig.SetModified() : m_aTableConfig.SetModified();} + { auto & config = bHTML ? m_aWebTableConfig : m_aTableConfig; + config.bInsTableAlignNum = b; + config.SetModified();} const SwInsertTableOptions& GetInsTableFlags(bool bHTML) const { return bHTML ? m_aWebInsertConfig.m_aInsTableOpts : m_aInsertConfig.m_aInsTableOpts;} void SetInsTableFlags( bool bHTML, const SwInsertTableOptions& rOpts ) { - bHTML ? (m_aWebInsertConfig.m_aInsTableOpts = rOpts) : (m_aInsertConfig.m_aInsTableOpts = rOpts); - bHTML ? m_aWebInsertConfig.SetModified() : m_aInsertConfig.SetModified();} + auto & config = bHTML ? m_aWebInsertConfig : m_aInsertConfig; + config.m_aInsTableOpts = rOpts; + config.SetModified();} const InsCaptionOpt* GetCapOption(bool bHTML, const SwCapObjType eType, const SvGlobalName *pOleId); bool SetCapOption(bool bHTML, const InsCaptionOpt* pOpt); diff --git a/sw/inc/viewopt.hxx b/sw/inc/viewopt.hxx index 4c1e8de5df7b..2f9332789451 100644 --- a/sw/inc/viewopt.hxx +++ b/sw/inc/viewopt.hxx @@ -213,51 +213,51 @@ public: bool IsTab(bool bHard = false) const { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::Tab) && ((m_nCoreOptions & ViewOptFlags1::ViewMetachars)||bHard); } - void SetTab( bool b ) { - b ? (m_nCoreOptions |= ViewOptFlags1::Tab ) : ( m_nCoreOptions &= ~ViewOptFlags1::Tab); } + void SetTab( bool b ) + { SetCoreOption(b, ViewOptFlags1::Tab); } bool IsBlank(bool bHard = false) const { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::Blank) && ((m_nCoreOptions & ViewOptFlags1::ViewMetachars)||bHard); } void SetBlank( bool b ) - { b ? (m_nCoreOptions |= ViewOptFlags1::Blank ) : ( m_nCoreOptions &= ~ViewOptFlags1::Blank); } + { SetCoreOption(b, ViewOptFlags1::Blank); } bool IsHardBlank() const { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::HardBlank); } void SetHardBlank( bool b ) - { b ? (m_nCoreOptions |= ViewOptFlags1::HardBlank ) : ( m_nCoreOptions &= ~ViewOptFlags1::HardBlank); } + { SetCoreOption(b, ViewOptFlags1::HardBlank); } bool IsParagraph(bool bHard = false) const { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::Paragraph) && ((m_nCoreOptions & ViewOptFlags1::ViewMetachars)||bHard); } void SetParagraph( bool b ) - { b ? (m_nCoreOptions |= ViewOptFlags1::Paragraph ) : ( m_nCoreOptions &= ~ViewOptFlags1::Paragraph); } + { SetCoreOption(b, ViewOptFlags1::Paragraph); } bool IsLineBreak(bool bHard = false) const { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::Linebreak) && ((m_nCoreOptions & ViewOptFlags1::ViewMetachars)||bHard); } void SetLineBreak( bool b ) - { b ? (m_nCoreOptions |= ViewOptFlags1::Linebreak ) : ( m_nCoreOptions &= ~ViewOptFlags1::Linebreak); } + { SetCoreOption(b, ViewOptFlags1::Linebreak); } void SetPageBreak( bool b ) - { b ? (m_nCoreOptions |= ViewOptFlags1::Pagebreak ) : ( m_nCoreOptions &= ~ViewOptFlags1::Pagebreak); } + { SetCoreOption(b, ViewOptFlags1::Pagebreak); } void SetColumnBreak( bool b) - { b ? (m_nCoreOptions |= ViewOptFlags1::Columnbreak ) : ( m_nCoreOptions &= ~ViewOptFlags1::Columnbreak); } + { SetCoreOption(b, ViewOptFlags1::Columnbreak); } bool IsSoftHyph() const { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::SoftHyph); } void SetSoftHyph( bool b ) - { b ? (m_nCoreOptions |= ViewOptFlags1::SoftHyph ) : ( m_nCoreOptions &= ~ViewOptFlags1::SoftHyph); } + { SetCoreOption(b, ViewOptFlags1::SoftHyph); } bool IsFieldName() const { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::FieldName); } void SetFieldName( bool b ) - { b ? (m_nCoreOptions |= ViewOptFlags1::FieldName ) : ( m_nCoreOptions &= ~ViewOptFlags1::FieldName); } + { SetCoreOption(b, ViewOptFlags1::FieldName); } bool IsPostIts() const { return bool(m_nCoreOptions & ViewOptFlags1::Postits); } void SetPostIts( bool b ) - { b ? (m_nCoreOptions |= ViewOptFlags1::Postits ) : ( m_nCoreOptions &= ~ViewOptFlags1::Postits); } + { SetCoreOption(b, ViewOptFlags1::Postits); } static void PaintPostIts( OutputDevice *pOut, const SwRect &rRect, bool bIsScript ); static sal_uInt16 GetPostItsWidth( const OutputDevice *pOut ); @@ -266,55 +266,55 @@ public: bool IsShowInlineTooltips() const { return bool(m_nCoreOptions & ViewOptFlags1::ShowInlineTooltips); } void SetShowInlineTooltips( bool b ) - { b ? (m_nCoreOptions |= ViewOptFlags1::ShowInlineTooltips ) : ( m_nCoreOptions &= ~ViewOptFlags1::ShowInlineTooltips); } + { SetCoreOption(b, ViewOptFlags1::ShowInlineTooltips); } //show/hide interactive header/footer on top/bottom of pages bool IsUseHeaderFooterMenu() const { return bool(m_nCoreOptions & ViewOptFlags1::UseHeaderFooterMenu ); } void SetUseHeaderFooterMenu( bool b ) - { b ? (m_nCoreOptions |= ViewOptFlags1::UseHeaderFooterMenu ) : ( m_nCoreOptions &= ~ViewOptFlags1::UseHeaderFooterMenu); } + { SetCoreOption(b, ViewOptFlags1::UseHeaderFooterMenu); } bool IsShowHiddenChar(bool bHard = false) const { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::CharHidden) && ((m_nCoreOptions & ViewOptFlags1::ViewMetachars)||bHard); } void SetShowHiddenChar( bool b ) - { b ? (m_nCoreOptions |= ViewOptFlags1::CharHidden ) : ( m_nCoreOptions &= ~ViewOptFlags1::CharHidden); } + { SetCoreOption(b, ViewOptFlags1::CharHidden); } bool IsShowHiddenField() const { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::FieldHidden); } void SetShowHiddenField( bool b ) - { b ? (m_nCoreOptions |= ViewOptFlags1::FieldHidden ) : ( m_nCoreOptions &= ~ViewOptFlags1::FieldHidden); } + { SetCoreOption(b, ViewOptFlags1::FieldHidden); } bool IsGraphic() const { return bool(m_nCoreOptions & ViewOptFlags1::Graphic); } void SetGraphic( bool b ) - { b ? (m_nCoreOptions |= ViewOptFlags1::Graphic ) : ( m_nCoreOptions &= ~ViewOptFlags1::Graphic); } + { SetCoreOption(b, ViewOptFlags1::Graphic); } bool IsPageBack() const { return bool(m_nCoreOptions & ViewOptFlags1::Pageback); } void SetPageBack( bool b ) - { b ? (m_nCoreOptions |= ViewOptFlags1::Pageback) : ( m_nCoreOptions &= ~ViewOptFlags1::Pageback); } + { SetCoreOption(b, ViewOptFlags1::Pageback); } bool IsTable() const { return bool(m_nCoreOptions & ViewOptFlags1::Table); } void SetTable( bool b ) - { b ? (m_nCoreOptions |= ViewOptFlags1::Table ) : ( m_nCoreOptions &= ~ViewOptFlags1::Table); } + { SetCoreOption(b, ViewOptFlags1::Table); } bool IsDraw() const { return bool(m_nCoreOptions & ViewOptFlags1::Draw); } void SetDraw( bool b ) - { b ? (m_nCoreOptions |= ViewOptFlags1::Draw ) : ( m_nCoreOptions &= ~ViewOptFlags1::Draw); } + { SetCoreOption(b, ViewOptFlags1::Draw); } bool IsControl() const { return bool(m_nCoreOptions & ViewOptFlags1::Control); } void SetControl( bool b ) - { b ? (m_nCoreOptions |= ViewOptFlags1::Control ) : ( m_nCoreOptions &= ~ViewOptFlags1::Control); } + { SetCoreOption(b, ViewOptFlags1::Control); } bool IsSnap() const { return bool(m_nCoreOptions & ViewOptFlags1::Snap); } void SetSnap( bool b ) - { b ? (m_nCoreOptions |= ViewOptFlags1::Snap ) : ( m_nCoreOptions &= ~ViewOptFlags1::Snap); } + { SetCoreOption(b, ViewOptFlags1::Snap); } void SetSnapSize( Size const &rSz ){ m_aSnapSize = rSz; } const Size &GetSnapSize() const { return m_aSnapSize; } @@ -322,7 +322,7 @@ public: bool IsGridVisible() const { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::GridVisible); } void SetGridVisible( bool b ) - { b ? (m_nCoreOptions |= ViewOptFlags1::GridVisible ) : ( m_nCoreOptions &= ~ViewOptFlags1::GridVisible); } + { SetCoreOption(b, ViewOptFlags1::GridVisible); } bool IsOnlineSpell() const { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::OnlineSpell); } @@ -331,42 +331,42 @@ public: bool IsViewMetaChars() const { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::ViewMetachars); } void SetViewMetaChars( bool b) - { b ? (m_nCoreOptions |= ViewOptFlags1::ViewMetachars ) : ( m_nCoreOptions &= ~ViewOptFlags1::ViewMetachars); } + { SetCoreOption(b, ViewOptFlags1::ViewMetachars); } bool IsSynchronize() const { return bool(m_nCoreOptions & ViewOptFlags1::Synchronize); } void SetSynchronize( bool b ) - { b ? (m_nCoreOptions |= ViewOptFlags1::Synchronize ) : ( m_nCoreOptions &= ~ViewOptFlags1::Synchronize); } + { SetCoreOption(b, ViewOptFlags1::Synchronize); } bool IsCrossHair() const { return bool(m_nCoreOptions & ViewOptFlags1::Crosshair); } void SetCrossHair( bool b ) - { b ? (m_nCoreOptions |= ViewOptFlags1::Crosshair ) : ( m_nCoreOptions &= ~ViewOptFlags1::Crosshair); } + { SetCoreOption(b, ViewOptFlags1::Crosshair); } // Options from nCore2Options bool IsBlackFont() const {return bool(m_nCore2Options & ViewOptCoreFlags2::BlackFont); } void SetBlackFont(bool b) - { b ? (m_nCore2Options |= ViewOptCoreFlags2::BlackFont) : (m_nCore2Options &= ~ViewOptCoreFlags2::BlackFont);} + { SetCore2Option(b, ViewOptCoreFlags2::BlackFont); } bool IsShowHiddenPara() const {return bool(m_nCore2Options & ViewOptCoreFlags2::HiddenPara); } void SetShowHiddenPara(bool b) - { b ? (m_nCore2Options |= ViewOptCoreFlags2::HiddenPara) : (m_nCore2Options &= ~ViewOptCoreFlags2::HiddenPara);} + { SetCore2Option(b, ViewOptCoreFlags2::HiddenPara); } bool IsSmoothScroll() const {return bool(m_nCore2Options & ViewOptCoreFlags2::SmoothScroll); } void SetSmoothScroll(bool b) - { b ? (m_nCore2Options |= ViewOptCoreFlags2::SmoothScroll) : (m_nCore2Options &= ~ViewOptCoreFlags2::SmoothScroll);} + { SetCore2Option(b, ViewOptCoreFlags2::SmoothScroll); } bool IsCursorInProtectedArea() const {return bool(m_nCore2Options & ViewOptCoreFlags2::CursorInProt); } void SetCursorInProtectedArea(bool b) - { b ? (m_nCore2Options |= ViewOptCoreFlags2::CursorInProt) : (m_nCore2Options &= ~ViewOptCoreFlags2::CursorInProt);} + { SetCore2Option(b, ViewOptCoreFlags2::CursorInProt); } static bool IsIgnoreProtectedArea(); @@ -374,13 +374,28 @@ public: {return bool(m_nCore2Options & ViewOptCoreFlags2::PdfExport); } void SetPDFExport(bool b) - { b ? (m_nCore2Options |= ViewOptCoreFlags2::PdfExport) : (m_nCore2Options &= ~ViewOptCoreFlags2::PdfExport);} + { SetCore2Option(b, ViewOptCoreFlags2::PdfExport); } bool IsPrinting() const {return bool(m_nCore2Options & ViewOptCoreFlags2::Printing); } void SetPrinting(bool b) - { b ? (m_nCore2Options |= ViewOptCoreFlags2::Printing) : (m_nCore2Options &= ~ViewOptCoreFlags2::Printing);} + { SetCore2Option(b, ViewOptCoreFlags2::Printing); } + + void SetCore2Option(bool b, ViewOptCoreFlags2 f) + { + if (b) + m_nCore2Options |= f; + else + m_nCore2Options &= ~f; + } + void SetCoreOption(bool b, ViewOptFlags1 f) + { + if (b) + m_nCoreOptions |= f; + else + m_nCoreOptions &= ~f; + } short GetDivisionX() const { return m_nDivisionX; } void SetDivisionX( short n ){ m_nDivisionX = n; } @@ -489,19 +504,26 @@ public: sal_uInt8 GetTableDest() const { return m_nTableDestination; } void SetViewVScrollBar(bool b) - { b ? (m_nUIOptions |= ViewOptFlags2::VScrollbar ) : ( m_nUIOptions &= ~ViewOptFlags2::VScrollbar); } + { SetUIOption(b, ViewOptFlags2::VScrollbar); } void SetViewHScrollBar(bool b) - { b ? (m_nUIOptions |= ViewOptFlags2::HScrollbar ) : ( m_nUIOptions &= ~ViewOptFlags2::HScrollbar); } + { SetUIOption(b, ViewOptFlags2::HScrollbar); } void SetKeepRatio (bool b) - { b ? (m_nUIOptions |= ViewOptFlags2::KeepAspectRatio ) : ( m_nUIOptions &= ~ViewOptFlags2::KeepAspectRatio); } + { SetUIOption(b, ViewOptFlags2::KeepAspectRatio); } void SetGrfKeepZoom (bool b) - { b ? (m_nUIOptions |= ViewOptFlags2::GrfKeepZoom ) : ( m_nUIOptions &= ~ViewOptFlags2::GrfKeepZoom); } + { SetUIOption(b, ViewOptFlags2::GrfKeepZoom); } void SetShowContentTips( bool b) - { b ? (m_nUIOptions |= ViewOptFlags2::ContentTips) : (m_nUIOptions &= ~ViewOptFlags2::ContentTips); } + { SetUIOption(b, ViewOptFlags2::ContentTips); } void SetPrtFormat( bool b) - { b ? (m_nUIOptions |= ViewOptFlags2::PrintFormat) : (m_nUIOptions &= ~ViewOptFlags2::PrintFormat); } + { SetUIOption(b, ViewOptFlags2::PrintFormat); } void SetShowScrollBarTips( bool b) - { b ? (m_nUIOptions |= ViewOptFlags2::ScrollbarTips) : (m_nUIOptions &= ~ViewOptFlags2::ScrollbarTips); } + { SetUIOption(b, ViewOptFlags2::ScrollbarTips); } + void SetUIOption( bool b, ViewOptFlags2 f) + { + if (b) + m_nUIOptions |= f; + else + m_nUIOptions &= ~f; + } void SetZoomType (SvxZoomType eZoom_){ m_eZoom = eZoom_; } void SetTableDest( sal_uInt8 nNew ) { m_nTableDestination = nNew; } @@ -521,7 +543,7 @@ public: #endif } void SetViewAnyRuler(bool bSet) - { bSet ? (m_nUIOptions |= ViewOptFlags2::AnyRuler) : (m_nUIOptions &= ~ViewOptFlags2::AnyRuler);} + { SetUIOption(bSet, ViewOptFlags2::AnyRuler);} bool IsViewHRuler(bool bDirect = false) const { @@ -535,7 +557,7 @@ public: #endif } void SetViewHRuler (bool b) - { b ? (m_nUIOptions |= ViewOptFlags2::HRuler ) : ( m_nUIOptions &= ~ViewOptFlags2::HRuler);} + { SetUIOption(b, ViewOptFlags2::HRuler ); } bool IsViewVRuler(bool bDirect = false) const { @@ -549,19 +571,19 @@ public: #endif } void SetViewVRuler (bool b) - { b ? (m_nUIOptions |= ViewOptFlags2::VRuler ) : ( m_nUIOptions &= ~ViewOptFlags2::VRuler);} + { SetUIOption(b, ViewOptFlags2::VRuler); } // ShadowCursor, switch on/off, get/set color/mode. bool IsShadowCursor() const { return bool(m_nUIOptions & ViewOptFlags2::ShadowCursor); } void SetShadowCursor(bool b) - { b ? (m_nUIOptions |= ViewOptFlags2::ShadowCursor ) : ( m_nUIOptions &= ~ViewOptFlags2::ShadowCursor); } + { SetUIOption(b, ViewOptFlags2::ShadowCursor); } //move vertical ruler to the right bool IsVRulerRight() const { return bool(m_nUIOptions & ViewOptFlags2::VRulerRight); } void SetVRulerRight(bool b) - { b ? (m_nUIOptions |= ViewOptFlags2::VRulerRight ) : ( m_nUIOptions &= ~ViewOptFlags2::VRulerRight); } + { SetUIOption(b, ViewOptFlags2::VRulerRight); } bool IsStarOneSetting() const {return m_bStarOneSetting; } void SetStarOneSetting(bool bSet) {m_bStarOneSetting = bSet; } diff --git a/sw/source/core/bastyp/bparr.cxx b/sw/source/core/bastyp/bparr.cxx index da67b8b1a617..f466f204a643 100644 --- a/sw/source/core/bastyp/bparr.cxx +++ b/sw/source/core/bastyp/bparr.cxx @@ -207,7 +207,8 @@ void BigPtrArray::Insert( BigPtrEntry* pElem, sal_uLong pos ) if( !m_nSize ) { // special case: insert first element - p = InsBlock( cur = 0 ); + cur = 0; + p = InsBlock( cur ); } else if( pos == m_nSize ) { @@ -238,7 +239,10 @@ void BigPtrArray::Insert( BigPtrEntry* pElem, sal_uLong pos ) auto pFrom = q->mvData.begin() + nCount; auto pTo = pFrom + 1; while( nCount-- ) - ++( *--pTo = *--pFrom )->m_nOffset; + { + *--pTo = *--pFrom; + ++((*pTo)->m_nOffset); + } } q->nStart--; q->nEnd--; @@ -281,7 +285,10 @@ void BigPtrArray::Insert( BigPtrEntry* pElem, sal_uLong pos ) auto pFrom = p->mvData.begin() + p->nElem; auto pTo = pFrom + 1; while( nCount-- ) - ++( *--pTo = *--pFrom )->m_nOffset; + { + *--pTo = *--pFrom; + ++( *pTo )->m_nOffset; + } } // insert element and update indices pElem->m_nOffset = sal_uInt16(pos); diff --git a/sw/source/core/bastyp/breakit.cxx b/sw/source/core/bastyp/breakit.cxx index 9fb1f98348fc..3427c483a04b 100644 --- a/sw/source/core/bastyp/breakit.cxx +++ b/sw/source/core/bastyp/breakit.cxx @@ -137,7 +137,8 @@ SvtScriptType SwBreakIt::GetAllScriptsOfText( const OUString& rText ) const for( sal_Int32 n = 0, nEnd = rText.getLength(); n < nEnd; n = m_xBreak->endOfScript(rText, n, nScript) ) { - switch( nScript = m_xBreak->getScriptType(rText, n) ) + nScript = m_xBreak->getScriptType(rText, n); + switch( nScript ) { case i18n::ScriptType::LATIN: nRet |= SvtScriptType::LATIN; break; case i18n::ScriptType::ASIAN: nRet |= SvtScriptType::ASIAN; break; diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx index b61be8fe83aa..4d80b9a2302e 100644 --- a/sw/source/core/bastyp/calc.cxx +++ b/sw/source/core/bastyp/calc.cxx @@ -655,7 +655,8 @@ SwCalcOper SwCalc::GetToken() CalcOp* pFnd = ::FindOperator( sLowerCaseName ); if( pFnd ) { - switch( ( m_eCurrOper = pFnd->eOp ) ) + m_eCurrOper = pFnd->eOp; + switch( m_eCurrOper ) { case CALC_SUM: case CALC_MEAN: diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index 657c7b1fb795..780d11595ef8 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -753,7 +753,10 @@ CharClass& GetAppCharClass() void SwCalendarWrapper::LoadDefaultCalendar( LanguageType eLang ) { if( eLang != nLang ) - loadDefaultCalendar( LanguageTag::convertToLocale( nLang = eLang )); + { + nLang = eLang; + loadDefaultCalendar( LanguageTag::convertToLocale( nLang )); + } } LanguageType GetAppLanguage() diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx b/sw/source/core/doc/DocumentFieldsManager.cxx index ae1d7fcab7f5..15b89a5bdc71 100644 --- a/sw/source/core/doc/DocumentFieldsManager.cxx +++ b/sw/source/core/doc/DocumentFieldsManager.cxx @@ -952,7 +952,9 @@ void DocumentFieldsManager::UpdateExpFieldsImpl( const SwFieldType* pFieldType; // process separately: for( auto n = mpFieldTypes->size(); n; ) - switch( ( pFieldType = (*mpFieldTypes)[ --n ] )->Which() ) + { + pFieldType = (*mpFieldTypes)[ --n ]; + switch( pFieldType->Which() ) { case SwFieldIds::User: { @@ -972,6 +974,7 @@ void DocumentFieldsManager::UpdateExpFieldsImpl( break; default: break; } + } } // The array is filled with all fields; start calculation. @@ -1057,7 +1060,8 @@ void DocumentFieldsManager::UpdateExpFieldsImpl( SwFormatField* pFormatField = const_cast<SwFormatField*>(&pTextField->GetFormatField()); const SwField* pField = pFormatField->GetField(); - switch( nWhich = pField->GetTyp()->Which() ) + nWhich = pField->GetTyp()->Which(); + switch( nWhich ) { case SwFieldIds::HiddenText: { diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx index a5b60561abdf..036e33e43853 100644 --- a/sw/source/core/doc/DocumentRedlineManager.cxx +++ b/sw/source/core/doc/DocumentRedlineManager.cxx @@ -2342,7 +2342,10 @@ bool DocumentRedlineManager::AcceptRedline( SwRedlineTable::size_type nPos, bool if( SwRedlineTable::npos != nFndPos || ( 0 != ( --nLoopCnt ) && SwRedlineTable::npos != ( nFndPos = mpRedlineTable->FindPrevSeqNo( nSeqNo, nPos ))) ) - pTmp = (*mpRedlineTable)[ nPos = nFndPos ]; + { + nPos = nFndPos; + pTmp = (*mpRedlineTable)[ nPos ]; + } else nLoopCnt = 0; } @@ -2481,7 +2484,10 @@ bool DocumentRedlineManager::RejectRedline( SwRedlineTable::size_type nPos, bool if( SwRedlineTable::npos != nFndPos || ( 0 != ( --nLoopCnt ) && SwRedlineTable::npos != ( nFndPos = mpRedlineTable->FindPrevSeqNo( nSeqNo, nPos ))) ) - pTmp = (*mpRedlineTable)[ nPos = nFndPos ]; + { + nPos = nFndPos; + pTmp = (*mpRedlineTable)[ nPos ]; + } else nLoopCnt = 0; } diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx b/sw/source/core/doc/DocumentStylePoolManager.cxx index e0b44789c499..09d457056a05 100644 --- a/sw/source/core/doc/DocumentStylePoolManager.cxx +++ b/sw/source/core/doc/DocumentStylePoolManager.cxx @@ -1967,12 +1967,14 @@ SwNumRule* DocumentStylePoolManager::GetNumRuleFromPool( sal_uInt16 nId ) { if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) { - aFormat.SetAbsLSpace( nSpace = nSpace + pArr[ n ] ); + nSpace += pArr[ n ]; + aFormat.SetAbsLSpace( nSpace ); aFormat.SetFirstLineOffset( - pArr[ n ] ); } else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT ) { - aFormat.SetListtabPos( nSpace = nSpace + pArr[ n ] ); + nSpace += pArr[ n ]; + aFormat.SetListtabPos( nSpace ); aFormat.SetIndentAt( nSpace ); aFormat.SetFirstLineIndent( - pArr[ n ] ); } diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx index fead8dd1ec45..7d6e880c605a 100644 --- a/sw/source/core/doc/doccomp.cxx +++ b/sw/source/core/doc/doccomp.cxx @@ -858,8 +858,14 @@ sal_uLong Compare::CompareSequence::CheckDiag( sal_uLong nStt1, sal_uLong nEnd1, long d; /* Active diagonal. */ /* Extend the top-down search by an edit step in each diagonal. */ - fmin > dmin ? pFDiag[--fmin - 1] = -1 : ++fmin; - fmax < dmax ? pFDiag[++fmax + 1] = -1 : --fmax; + if (fmin > dmin) + pFDiag[--fmin - 1] = -1; + else + ++fmin; + if (fmax < dmax) + pFDiag[++fmax + 1] = -1; + else + --fmax; for (d = fmax; d >= fmin; d -= 2) { long x, y, tlo = pFDiag[d - 1], thi = pFDiag[d + 1]; @@ -884,8 +890,14 @@ sal_uLong Compare::CompareSequence::CheckDiag( sal_uLong nStt1, sal_uLong nEnd1, } /* Similar extend the bottom-up search. */ - bmin > dmin ? pBDiag[--bmin - 1] = INT_MAX : ++bmin; - bmax < dmax ? pBDiag[++bmax + 1] = INT_MAX : --bmax; + if (bmin > dmin) + pBDiag[--bmin - 1] = INT_MAX; + else + ++bmin; + if (bmax < dmax) + pBDiag[++bmax + 1] = INT_MAX; + else + --bmax; for (d = bmax; d >= bmin; d -= 2) { long x, y, tlo = pBDiag[d - 1], thi = pBDiag[d + 1]; @@ -1013,7 +1025,7 @@ sal_uLong SwCompareLine::GetHashValue() const { OUString sStr( GetText() ); for( sal_Int32 n = 0; n < sStr.getLength(); ++n ) - ( nRet <<= 1 ) += sStr[ n ]; + nRet = (nRet << 1) + sStr[ n ]; } break; @@ -1233,7 +1245,7 @@ sal_uLong SwCompareLine::GetTextNodeHashValue( const SwTextNode& rNd, sal_uLong { OUString sStr( rNd.GetExpandText(nullptr) ); for( sal_Int32 n = 0; n < sStr.getLength(); ++n ) - ( nVal <<= 1 ) += sStr[ n ]; + nVal = (nVal << 1 ) + sStr[ n ]; return nVal; } diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index ccebf3bfac0b..9f16c4131334 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -1722,7 +1722,10 @@ SwTableNumFormatMerge::SwTableNumFormatMerge( const SwDoc& rSrc, SwDoc& rDest ) // a different Doc -> Number formatter needs to be merged SvNumberFormatter* pN; if( &rSrc != &rDest && nullptr != ( pN = const_cast<SwDoc&>(rSrc).GetNumberFormatter( false ) )) - ( pNFormat = rDest.GetNumberFormatter())->MergeFormatter( *pN ); + { + pNFormat = rDest.GetNumberFormatter(); + pNFormat->MergeFormatter( *pN ); + } if( &rSrc != &rDest ) static_cast<SwGetRefFieldType*>(rSrc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::GetRef ))-> diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index e26e02b53848..a323b595f0fc 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -1671,7 +1671,8 @@ void SwRangeRedline::MoveFromSection(size_t nMyPos) if( m_bDelLastPara ) { ++GetPoint()->nNode; - GetPoint()->nContent.Assign( pCNd = GetContentNode(), 0 ); + pCNd = GetContentNode(); + GetPoint()->nContent.Assign( pCNd, 0 ); m_bDelLastPara = false; } else if( pColl ) diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx index fc9d328335f8..582cb226dc55 100644 --- a/sw/source/core/docnode/ndtbl1.cxx +++ b/sw/source/core/docnode/ndtbl1.cxx @@ -716,7 +716,10 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ) if ( bLeftValid ) { aBox.SetLine( bRightOver ? pLeft : nullptr, SvxBoxItemLine::RIGHT ); - bVertValid ? nType |= 0x0020 : nType |= 0x0010; + if (bVertValid) + nType |= 0x0020; + else + nType |= 0x0010; } if ( bLeftOver ) { diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx index 83e43c6d0d2a..57f44eb15483 100644 --- a/sw/source/core/docnode/nodes.cxx +++ b/sw/source/core/docnode/nodes.cxx @@ -452,7 +452,9 @@ bool SwNodes::MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, // continue until everything has been moved while( aRg.aStart < aRg.aEnd ) - switch( (pCurrentNode = &aRg.aEnd.GetNode())->GetNodeType() ) + { + pCurrentNode = &aRg.aEnd.GetNode(); + switch( pCurrentNode->GetNodeType() ) { case SwNodeType::End: { @@ -841,6 +843,7 @@ bool SwNodes::MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, OSL_FAIL( "Unknown node type" ); break; } + } if( nInsPos ) // copy remaining rest { diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx index 37865d7c9a98..0b435c3a5f02 100644 --- a/sw/source/core/edit/autofmt.cxx +++ b/sw/source/core/edit/autofmt.cxx @@ -821,7 +821,7 @@ sal_uInt16 SwAutoFormat::GetDigitLevel( const SwTextNode& rNd, sal_Int32& rPos, c += SVX_NUM_ROMAN_LOWER; } - ( eScan &= ~(UPPER_ALPHA|LOWER_ALPHA)) |= eTmpScan; + eScan = (eScan & ~(UPPER_ALPHA|LOWER_ALPHA)) | eTmpScan; if( pNumTypes ) (*pNumTypes) = pNumTypes->replaceAt( pNumTypes->getLength() - 1, 1, OUString(c) ); } @@ -1877,7 +1877,9 @@ void SwAutoFormat::AutoCorrect( sal_Int32 nPos ) if (nPos && IsSpace((*pText)[nPos-1])) nLastBlank = nPos; for (nSttPos = nPos; !bBreak && nPos < pText->getLength(); ++nPos) - switch (cChar = (*pText)[nPos]) + { + cChar = (*pText)[nPos]; + switch (cChar) { case '\"': case '\'': @@ -1991,6 +1993,7 @@ void SwAutoFormat::AutoCorrect( sal_Int32 nPos ) } break; } + } if( nPos == nSttPos ) { @@ -2122,9 +2125,12 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFormatFlags const & m_nEndNdIdx = m_aEndNdIdx.GetIndex(); if( !m_aFlags.bAFormatByInput ) + { + m_nEndNdIdx = m_aEndNdIdx.GetIndex(); ::StartProgress( STR_STATSTR_AUTOFORMAT, m_aNdIdx.GetIndex(), - m_nEndNdIdx = m_aEndNdIdx.GetIndex(), + m_nEndNdIdx, m_pDoc->GetDocShell() ); + } RedlineFlags eRedlMode = m_pDoc->getIDocumentRedlineAccess().GetRedlineFlags(), eOldMode = eRedlMode; if( m_aFlags.bWithRedlining ) diff --git a/sw/source/core/fields/cellfml.cxx b/sw/source/core/fields/cellfml.cxx index d99d39c81dc9..e5971f552bfb 100644 --- a/sw/source/core/fields/cellfml.cxx +++ b/sw/source/core/fields/cellfml.cxx @@ -930,7 +930,8 @@ void SwTableFormula::GetBoxes( const SwTableBox& rSttBox, const SwLayoutFrame *pStt, *pEnd; const SwFrame* pFrame = lcl_GetBoxFrame( rSttBox ); pStt = pFrame ? pFrame->GetUpper() : nullptr; - pEnd = ( nullptr != (pFrame = lcl_GetBoxFrame( rEndBox ))) ? pFrame->GetUpper() : nullptr; + pFrame = lcl_GetBoxFrame( rEndBox ); + pEnd = pFrame ? pFrame->GetUpper() : nullptr; if( !pStt || !pEnd ) return ; // no valid selection diff --git a/sw/source/core/fields/dbfld.cxx b/sw/source/core/fields/dbfld.cxx index f85e61eafd5d..6518f9f7b5b5 100644 --- a/sw/source/core/fields/dbfld.cxx +++ b/sw/source/core/fields/dbfld.cxx @@ -329,8 +329,11 @@ void SwDBField::Evaluate() SvNumberFormatter* pDocFormatter = GetDoc()->GetNumberFormatter(); pMgr->GetMergeColumnCnt(aColNm, GetLanguage(), aContent, &nValue); if( !( nSubType & nsSwExtendedSubType::SUB_OWN_FMT ) ) - SetFormat( nFormat = pMgr->GetColumnFormat( aTmpData.sDataSource, aTmpData.sCommand, - aColNm, pDocFormatter, GetLanguage() )); + { + nFormat = pMgr->GetColumnFormat( aTmpData.sDataSource, aTmpData.sCommand, + aColNm, pDocFormatter, GetLanguage() ); + SetFormat( nFormat ); + } sal_Int32 nColumnType = nValue == DBL_MAX ? 0 diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index 859c5d4ddc02..e2044622aa1d 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -2285,10 +2285,13 @@ void SwRefPageGetFieldType::UpdateField( SwTextField const * pTextField, const SwContentFrame *const pRefFrame = pRefTextField->GetTextNode().getLayoutFrame( pLayout, nullptr, &tmp); const SwPageFrame* pPgFrame = nullptr; - const short nDiff = ( pFrame && pRefFrame ) - ? (pPgFrame = pFrame->FindPageFrame())->GetPhyPageNum() - - pRefFrame->FindPageFrame()->GetPhyPageNum() + 1 - : 1; + short nDiff = 1; + if ( pFrame && pRefFrame ) + { + pPgFrame = pFrame->FindPageFrame(); + nDiff = pPgFrame->GetPhyPageNum() - + pRefFrame->FindPageFrame()->GetPhyPageNum() + 1; + } SvxNumType nTmpFormat = SVX_NUM_PAGEDESC == static_cast<SvxNumType>(pGetField->GetFormat()) ? ( !pPgFrame diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index abecc671a750..9eb869de51ec 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -1532,9 +1532,12 @@ bool SwFEShell::Paste(const Graphic &rGrf, const OUString& rURL) SdrObject* pObj = nullptr; SdrView *pView = Imp()->GetDrawView(); - bool bRet = 1 == pView->GetMarkedObjectList().GetMarkCount() && - (pObj = pView->GetMarkedObjectList().GetMark( 0 )->GetMarkedSdrObj())->IsClosedObj() && - dynamic_cast<const SdrOle2Obj*>( pObj) == nullptr; + bool bRet = 1 == pView->GetMarkedObjectList().GetMarkCount(); + if (bRet) + { + pObj = pView->GetMarkedObjectList().GetMark( 0 )->GetMarkedSdrObj(); + bRet = pObj->IsClosedObj() && dynamic_cast<const SdrOle2Obj*>( pObj) == nullptr; + } if( bRet && pObj ) { diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index 8a1c36b28f48..d94ee5c8e6ad 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -193,7 +193,8 @@ static bool lcl_FindAnchorPos( } } - aNewAnch.SetType( nNew = RndStdIds::FLY_AT_PAGE ); + nNew = RndStdIds::FLY_AT_PAGE; + aNewAnch.SetType( nNew ); SAL_FALLTHROUGH; case RndStdIds::FLY_AT_PAGE: @@ -1526,8 +1527,8 @@ const SwFrameFormat* SwFEShell::IsURLGrfAtPos( const Point& rPt, OUString* pURL, // without MapMode-Offset, without Offset, o ... !!!!! aPt = GetOut()->LogicToPixel( aPt, MapMode( MapUnit::MapTwip ) ); - ((( *pURL += "?" ) += OUString::number( aPt.getX() )) - += "," ) += OUString::number(aPt.getY() ); + *pURL = *pURL + "?" + OUString::number( aPt.getX() ) + + "," + OUString::number(aPt.getY() ); } } pRet = pFly->GetFormat(); @@ -1719,7 +1720,10 @@ ObjCntType SwFEShell::GetObjCntType( const Point &rPt, SdrObject *&rpObj ) const SdrObject* pObj = pDView->PickObj(rPt, pDView->getHitTolLog(), pPView, SdrSearchOptions::PICKMARKABLE); if (pObj) - eType = GetObjCntType( *(rpObj = pObj) ); + { + rpObj = pObj; + eType = GetObjCntType( *rpObj ); + } pDView->SetHitTolerancePixel( nOld ); } diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx index 90d5fedfac70..a38f9f989529 100644 --- a/sw/source/core/layout/findfrm.cxx +++ b/sw/source/core/layout/findfrm.cxx @@ -313,18 +313,25 @@ const SwLayoutFrame *SwFrame::ImplGetNextLayoutLeaf( bool bFwd ) const bool bGoingFwdOrBwd = false; - bool bGoingDown = ( !bGoingUp && ( nullptr != (p = lcl_GetLower( pFrame, bFwd ) ) ) ); + bool bGoingDown = !bGoingUp; + if (bGoingDown) + { + p = lcl_GetLower( pFrame, bFwd ); + bGoingDown = nullptr != p; + } if ( !bGoingDown ) { // I cannot go down, because either I'm currently going up or // because the is no lower. // I'll try to go forward: - bGoingFwdOrBwd = (nullptr != (p = lcl_FindLayoutFrame( pFrame, bFwd ) ) ); + p = lcl_FindLayoutFrame( pFrame, bFwd ); + bGoingFwdOrBwd = nullptr != p; if ( !bGoingFwdOrBwd ) { // I cannot go forward, because there is no next frame. // I'll try to go up: - bGoingUp = (nullptr != (p = pFrame->GetUpper() ) ); + p = pFrame->GetUpper(); + bGoingUp = nullptr != p; if ( !bGoingUp ) { // I cannot go up, because there is no upper frame. @@ -366,13 +373,20 @@ const SwContentFrame* SwContentFrame::ImplGetNextContentFrame( bool bFwd ) const const SwFrame *p = nullptr; bool bGoingFwdOrBwd = false; - bool bGoingDown = ( !bGoingUp && ( nullptr != ( p = lcl_GetLower( pFrame, true ) ) ) ); + bool bGoingDown = !bGoingUp; + if (bGoingDown) + { + p = lcl_GetLower( pFrame, true ) ; + bGoingDown = nullptr != p; + } if ( !bGoingDown ) { - bGoingFwdOrBwd = ( nullptr != ( p = lcl_FindLayoutFrame( pFrame, bFwd ) ) ); + p = lcl_FindLayoutFrame( pFrame, bFwd ); + bGoingFwdOrBwd = nullptr != p; if ( !bGoingFwdOrBwd ) { - bGoingUp = ( nullptr != ( p = pFrame->GetUpper() ) ); + p = pFrame->GetUpper(); + bGoingUp = nullptr != p; if ( !bGoingUp ) { return nullptr; @@ -713,14 +727,20 @@ static SwFrame* lcl_NextFrame( SwFrame* pFrame ) SwFrame *p = nullptr; bool bGoingFwd = false; - bool bGoingDown = (!bGoingUp && ( nullptr != (p = pFrame->IsLayoutFrame() ? static_cast<SwLayoutFrame*>(pFrame)->Lower() : nullptr))); - + bool bGoingDown = !bGoingUp && pFrame->IsLayoutFrame(); + if (bGoingDown) + { + p = static_cast<SwLayoutFrame*>(pFrame)->Lower(); + bGoingDown = nullptr != p; + } if( !bGoingDown ) { - bGoingFwd = (nullptr != (p = ( pFrame->IsFlyFrame() ? static_cast<SwFlyFrame*>(pFrame)->GetNextLink() : pFrame->GetNext()))); + p = pFrame->IsFlyFrame() ? static_cast<SwFlyFrame*>(pFrame)->GetNextLink() : pFrame->GetNext(); + bGoingFwd = nullptr != p; if ( !bGoingFwd ) { - bGoingUp = (nullptr != (p = pFrame->GetUpper())); + p = pFrame->GetUpper(); + bGoingUp = nullptr != p; if ( !bGoingUp ) { return nullptr; diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index b7abc1e3453b..de8d04311d64 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -5168,7 +5168,8 @@ void SwFootnoteContFrame::PaintLine( const SwRect& rRect, SwRectFnSet aRectFnSet(this); SwTwips nPrtWidth = aRectFnSet.GetWidth(getFramePrintArea()); Fraction aFract( nPrtWidth, 1 ); - const SwTwips nWidth = static_cast<long>(aFract *= rInf.GetWidth()); + aFract *= rInf.GetWidth(); + const SwTwips nWidth = static_cast<long>(aFract); SwTwips nX = aRectFnSet.GetPrtLeft(*this); switch ( rInf.GetAdj() ) diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx index 500eaa6b15d1..093d84d04f4e 100644 --- a/sw/source/core/layout/sectfrm.cxx +++ b/sw/source/core/layout/sectfrm.cxx @@ -591,15 +591,22 @@ static SwContentFrame* lcl_GetNextContentFrame( const SwLayoutFrame* pLay, bool const SwFrame *p = nullptr; bool bGoingFwdOrBwd = false; - bool bGoingDown = !bGoingUp && ( nullptr != ( p = pFrame->IsLayoutFrame() ? static_cast<const SwLayoutFrame*>(pFrame)->Lower() : nullptr ) ); + bool bGoingDown = !bGoingUp && pFrame->IsLayoutFrame(); + if (bGoingDown) + { + p = static_cast<const SwLayoutFrame*>(pFrame)->Lower(); + bGoingDown = nullptr != p; + } if ( !bGoingDown ) { - bGoingFwdOrBwd = ( nullptr != ( p = pFrame->IsFlyFrame() ? - ( bFwd ? static_cast<const SwFlyFrame*>(pFrame)->GetNextLink() : static_cast<const SwFlyFrame*>(pFrame)->GetPrevLink() ) : - ( bFwd ? pFrame->GetNext() :pFrame->GetPrev() ) ) ); + p = pFrame->IsFlyFrame() ? + ( bFwd ? static_cast<const SwFlyFrame*>(pFrame)->GetNextLink() : static_cast<const SwFlyFrame*>(pFrame)->GetPrevLink() ) : + ( bFwd ? pFrame->GetNext() :pFrame->GetPrev() ); + bGoingFwdOrBwd = nullptr != p; if ( !bGoingFwdOrBwd ) { - bGoingUp = (nullptr != (p = pFrame->GetUpper() ) ); + p = pFrame->GetUpper(); + bGoingUp = nullptr != p; if ( !bGoingUp ) return nullptr; } diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx index 4054520e1f0f..93f53065a7ca 100644 --- a/sw/source/core/table/swtable.cxx +++ b/sw/source/core/table/swtable.cxx @@ -1834,13 +1834,15 @@ OUString SwTableBox::GetName() const const SwTableLines* pLines = pLine->GetUpper() ? &pLine->GetUpper()->GetTabLines() : &rTable.GetTabLines(); - sTmp = OUString::number( nPos = pLines->GetPos( pLine ) + 1 ); + nPos = pLines->GetPos( pLine ) + 1; + sTmp = OUString::number( nPos ); if( !sNm.isEmpty() ) sNm = sTmp + "." + sNm; else sNm = sTmp; - sTmp = OUString::number(( nPos = pBox->GetUpper()->GetBoxPos( pBox )) + 1 ); + nPos = pBox->GetUpper()->GetBoxPos( pBox ); + sTmp = OUString::number(nPos + 1); if( nullptr != ( pBox = pLine->GetUpper()) ) sNm = sTmp + "." + sNm; else diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx index 1712aa8475b7..157a338bda34 100644 --- a/sw/source/core/text/frmform.cxx +++ b/sw/source/core/text/frmform.cxx @@ -1445,8 +1445,8 @@ void SwTextFrame::Format_( SwTextFormatter &rLine, SwTextFormatInfo &rInf, bool bWatchMidHyph = false; const SwAttrSet& rAttrSet = GetTextNodeForParaProps()->GetSwAttrSet(); - bool bMaxHyph = ( 0 != - ( rInf.MaxHyph() = rAttrSet.GetHyphenZone().GetMaxHyphens() ) ); + rInf.MaxHyph() = rAttrSet.GetHyphenZone().GetMaxHyphens(); + bool bMaxHyph = 0 != rInf.MaxHyph(); if ( bMaxHyph ) rLine.InitCntHyph(); diff --git a/sw/source/core/undo/undobj1.cxx b/sw/source/core/undo/undobj1.cxx index 27063a251aab..763b2ed5b221 100644 --- a/sw/source/core/undo/undobj1.cxx +++ b/sw/source/core/undo/undobj1.cxx @@ -636,7 +636,8 @@ void SwUndoSetFlyFormat::PutAttr( sal_uInt16 nWhich, const SfxPoolItem* pItem ) bAnchorChgd = true; const SwFormatAnchor* pAnchor = static_cast<const SwFormatAnchor*>(pItem); - switch( nOldAnchorTyp = pAnchor->GetAnchorId() ) + nOldAnchorTyp = pAnchor->GetAnchorId(); + switch( nOldAnchorTyp ) { case RndStdIds::FLY_AS_CHAR: case RndStdIds::FLY_AT_CHAR: @@ -652,7 +653,8 @@ void SwUndoSetFlyFormat::PutAttr( sal_uInt16 nWhich, const SfxPoolItem* pItem ) } pAnchor = &pFrameFormat->GetAnchor(); - switch( nNewAnchorTyp = pAnchor->GetAnchorId() ) + nNewAnchorTyp = pAnchor->GetAnchorId(); + switch( nNewAnchorTyp ) { case RndStdIds::FLY_AS_CHAR: case RndStdIds::FLY_AT_CHAR: diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index 1f8613046c36..da9601045cca 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -1165,11 +1165,15 @@ SwXTextCursor::gotoRange( // now there are four SwPositions, // two of them are going to be used, but which ones? - *rOwnCursor.GetPoint() = (aOwnRight > rParamRight) - ? aOwnRight : *rOwnCursor.GetPoint() = rParamRight; + if (aOwnRight > rParamRight) + *rOwnCursor.GetPoint() = aOwnRight; + else + *rOwnCursor.GetPoint() = rParamRight; rOwnCursor.SetMark(); - *rOwnCursor.GetMark() = (aOwnLeft < rParamLeft) - ? aOwnLeft : *rOwnCursor.GetMark() = rParamLeft; + if (aOwnLeft < rParamLeft) + *rOwnCursor.GetMark() = aOwnLeft; + else + *rOwnCursor.GetMark() = rParamLeft; } else { diff --git a/sw/source/filter/basflt/fltini.cxx b/sw/source/filter/basflt/fltini.cxx index da64fa262012..ac001af12e29 100644 --- a/sw/source/filter/basflt/fltini.cxx +++ b/sw/source/filter/basflt/fltini.cxx @@ -118,9 +118,12 @@ namespace sw { Filters::Filters() { - SetFltPtr( READER_WRITER_BAS, (ReadAscii = new AsciiReader) ); - SetFltPtr( READER_WRITER_HTML, (ReadHTML = new HTMLReader) ); - SetFltPtr( READER_WRITER_XML, (ReadXML = new XMLReader) ); + ReadAscii = new AsciiReader; + ReadHTML = new HTMLReader; + ReadXML = new XMLReader; + SetFltPtr( READER_WRITER_BAS, ReadAscii ); + SetFltPtr( READER_WRITER_HTML, ReadHTML ); + SetFltPtr( READER_WRITER_XML, ReadXML ); SetFltPtr( READER_WRITER_TEXT_DLG, ReadAscii ); SetFltPtr( READER_WRITER_TEXT, ReadAscii ); } diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 6e4f3b9993a6..ce6a79f8e0dd 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -2081,17 +2081,17 @@ void SwHTMLParser::NextToken( HtmlTokenId nToken ) if( bInsertUnknown ) { - OUString aComment("HTML: <"); + OUStringBuffer aComment("HTML: <"); if( (nToken >= HtmlTokenId::ONOFF_START) && isOffToken(nToken) ) - aComment += "/"; - aComment += sSaveToken; + aComment.append("/"); + aComment.append(sSaveToken); if( !aToken.isEmpty() ) { UnescapeToken(); - (aComment += " ") += aToken; + aComment.append(" ").append(aToken); } - aComment += ">"; - InsertComment( aComment ); + aComment.append(">"); + InsertComment( aComment.makeStringAndClear() ); } // if there are temporary paragraph attributes and the diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx index c8ef6be2e265..89a80960da6f 100644 --- a/sw/source/filter/ww8/rtfexport.cxx +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -1153,11 +1153,20 @@ void RtfExport::InsColorLine(const SvxBoxItem& rBox) const editeng::SvxBorderLine* pLine = nullptr; if (rBox.GetTop()) - InsColor((pLine = rBox.GetTop())->GetColor()); + { + pLine = rBox.GetTop(); + InsColor(pLine->GetColor()); + } if (rBox.GetBottom() && pLine != rBox.GetBottom()) - InsColor((pLine = rBox.GetBottom())->GetColor()); + { + pLine = rBox.GetBottom(); + InsColor(pLine->GetColor()); + } if (rBox.GetLeft() && pLine != rBox.GetLeft()) - InsColor((pLine = rBox.GetLeft())->GetColor()); + { + pLine = rBox.GetLeft(); + InsColor(pLine->GetColor()); + } if (rBox.GetRight() && pLine != rBox.GetRight()) InsColor(rBox.GetRight()->GetColor()); } diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index e674c23e6041..fa0aa300710c 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -179,8 +179,8 @@ sal_uInt16 MSWordStyles::GetSlot( const SwFormat* pFormat ) const sal_uInt16 MSWordStyles::BuildGetSlot( const SwFormat& rFormat ) { - sal_uInt16 nRet; - switch ( nRet = rFormat.GetPoolFormatId() ) + sal_uInt16 nRet = rFormat.GetPoolFormatId(); + switch ( nRet ) { case RES_POOLCOLL_STANDARD: nRet = 0; diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index 49c506b3d5d6..c77292333300 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -1047,7 +1047,8 @@ void SwWW8ImplReader::MakeTagString( OUString& rStr, const OUString& rOrg ) nI < rStr.getLength() && rStr.getLength() < (MAX_FIELDLEN - 4); ++nI ) { bool bSetAsHex = false; - switch( cChar = rStr[ nI ] ) + cChar = rStr[ nI ]; + switch( cChar ) { case 132: // Exchange typographical quotation marks for normal ones case 148: @@ -1467,7 +1468,7 @@ eF_ResT SwWW8ImplReader::Read_F_Seq( WW8FieldDesc*, OUString& rStr ) aField.SetSubType(aField.GetSubType() | nsSwExtendedSubType::SUB_INVISIBLE); if (!sStart.isEmpty()) - aField.SetFormula( ( aSequenceName += "=" ) += sStart ); + aField.SetFormula( aSequenceName + "=" + sStart ); else if (!bCountOn) aField.SetFormula(aSequenceName); @@ -3513,7 +3514,7 @@ eF_ResT SwWW8ImplReader::Read_F_Hyperlink( WW8FieldDesc* /*pF*/, OUString& rStr OSL_ENSURE(!sURL.isEmpty() || !sMark.isEmpty(), "WW8: Empty URL"); if( !sMark.isEmpty() ) - ( sURL += "#" ) += sMark; + sURL = sURL + "#" + sMark; SwFormatINetFormat aURL(sURL, sTarget); // If on loading TOC field, change the default style into the "index link" diff --git a/sw/source/ui/dbui/mmdocselectpage.cxx b/sw/source/ui/dbui/mmdocselectpage.cxx index af68496086d0..cf3fc454829b 100644 --- a/sw/source/ui/dbui/mmdocselectpage.cxx +++ b/sw/source/ui/dbui/mmdocselectpage.cxx @@ -167,10 +167,26 @@ bool SwMailMergeDocSelectPage::commitPage( ::svt::WizardTypes::CommitPageReason { OUString sReloadDocument; bReturn = m_xCurrentDocRB->get_active() || - m_xNewDocRB->get_active() || - (!(sReloadDocument = m_sLoadFileName).isEmpty() && m_xLoadDocRB->get_active() )|| - (!(sReloadDocument = m_sLoadTemplateName).isEmpty() && m_xLoadTemplateRB->get_active())|| - (m_xRecentDocRB->get_active() && !(sReloadDocument = m_xRecentDocLB->get_active_text()).isEmpty()); + m_xNewDocRB->get_active(); + if (!bReturn) + { + sReloadDocument = m_sLoadFileName; + bReturn = !sReloadDocument.isEmpty() && m_xLoadDocRB->get_active(); + } + if (!bReturn) + { + sReloadDocument = m_sLoadTemplateName; + bReturn = !sReloadDocument.isEmpty() && m_xLoadTemplateRB->get_active(); + } + if (!bReturn) + { + bReturn = m_xRecentDocRB->get_active(); + if (bReturn) + { + sReloadDocument = m_xRecentDocLB->get_active_text(); + bReturn = !sReloadDocument.isEmpty(); + } + } if( _eReason == ::svt::WizardTypes::eValidate ) m_pWizard->SetDocumentLoad(!m_xCurrentDocRB->get_active()); diff --git a/sw/source/ui/misc/srtdlg.cxx b/sw/source/ui/misc/srtdlg.cxx index f9736984fb5f..1f0f66fadb3c 100644 --- a/sw/source/ui/misc/srtdlg.cxx +++ b/sw/source/ui/misc/srtdlg.cxx @@ -408,7 +408,10 @@ void SwSortDlg::LanguageHdl(weld::ComboBox const* pLBox) for( sal_Int32 nCnt = 0; nCnt <= nEnd; ++nCnt ) { if( nCnt < nEnd ) - sUINm = m_xColRes->GetTranslation( sAlg = aSeq[ nCnt ] ); + { + sAlg = aSeq[ nCnt ]; + sUINm = m_xColRes->GetTranslation( sAlg ); + } else sUINm = sAlg = aNumericText; diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index 45c287eab510..68fe77ff8a9f 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -637,10 +637,14 @@ void SwDocShell::Execute(SfxRequest& rReq) if( !aFileName.isEmpty() ) { SwgReaderOption aOpt; - aOpt.SetTextFormats( bText = bool(nFlags & SfxTemplateFlags::LOAD_TEXT_STYLES )); - aOpt.SetFrameFormats( bFrame = bool(nFlags & SfxTemplateFlags::LOAD_FRAME_STYLES)); - aOpt.SetPageDescs( bPage = bool(nFlags & SfxTemplateFlags::LOAD_PAGE_STYLES )); - aOpt.SetNumRules( bNum = bool(nFlags & SfxTemplateFlags::LOAD_NUM_STYLES )); + bText = bool(nFlags & SfxTemplateFlags::LOAD_TEXT_STYLES ); + aOpt.SetTextFormats(bText); + bFrame = bool(nFlags & SfxTemplateFlags::LOAD_FRAME_STYLES); + aOpt.SetFrameFormats(bFrame); + bPage = bool(nFlags & SfxTemplateFlags::LOAD_PAGE_STYLES ); + aOpt.SetPageDescs(bPage); + bNum = bool(nFlags & SfxTemplateFlags::LOAD_NUM_STYLES ); + aOpt.SetNumRules(bNum); //different meaning between SFX_MERGE_STYLES and aOpt.SetMerge! bMerge = bool(nFlags & SfxTemplateFlags::MERGE_STYLES); aOpt.SetMerge( !bMerge ); diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx index 7bd4c97ac1cf..9a094d2068ed 100644 --- a/sw/source/uibase/app/docstyle.cxx +++ b/sw/source/uibase/app/docstyle.cxx @@ -2923,8 +2923,10 @@ SfxStyleSheetBase* SwStyleSheetIterator::First() while( *pPoolIds ) { if( !bIsSearchUsed || rDoc.getIDocumentStylePoolAccess().IsPoolTextCollUsed( *pPoolIds ) ) - aLst.Append( cPARA, - s = SwStyleNameMapper::GetUIName( *pPoolIds, s )); + { + s = SwStyleNameMapper::GetUIName( *pPoolIds, s ); + aLst.Append( cPARA, s); + } ++pPoolIds; } } diff --git a/sw/source/uibase/config/viewopt.cxx b/sw/source/uibase/config/viewopt.cxx index 9db2f39a0134..970816c3e3ce 100644 --- a/sw/source/uibase/config/viewopt.cxx +++ b/sw/source/uibase/config/viewopt.cxx @@ -326,7 +326,10 @@ bool SwViewOption::IsAutoCompleteWords() void SwViewOption::SetOnlineSpell(bool b) { - b ? (m_nCoreOptions |= ViewOptFlags1::OnlineSpell ) : ( m_nCoreOptions &= ~ViewOptFlags1::OnlineSpell); + if (b) + m_nCoreOptions |= ViewOptFlags1::OnlineSpell; + else + m_nCoreOptions &= ~ViewOptFlags1::OnlineSpell; } AuthorCharAttr::AuthorCharAttr() : diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 4d03ac063bf4..33497fafbef4 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -1278,7 +1278,15 @@ bool SwTransferable::PasteData( TransferableDataHelper& rData, SwTransferable *pTrans=nullptr, *pTunneledTrans=GetSwTransferable( rData ); // check for private drop - bool bPrivateDrop(pPt && (bPasteSelection ? nullptr != (pTrans = pMod->m_pXSelection) : nullptr != (pTrans = pMod->m_pDragDrop))); + bool bPrivateDrop(pPt); + if (bPrivateDrop) + { + if (bPasteSelection) + pTrans = pMod->m_pXSelection; + else + pTrans = pMod->m_pDragDrop; + bPrivateDrop = nullptr != pTrans; + } bool bNeedToSelectBeforePaste(false); if(bPrivateDrop && DND_ACTION_LINK == nDropAction) diff --git a/sw/source/uibase/wrtsh/move.cxx b/sw/source/uibase/wrtsh/move.cxx index d28554afd64e..d9cf0a00b73f 100644 --- a/sw/source/uibase/wrtsh/move.cxx +++ b/sw/source/uibase/wrtsh/move.cxx @@ -46,7 +46,8 @@ public: ShellMoveCursor( SwWrtShell* pWrtSh, bool bSel ) { bAct = !pWrtSh->ActionPend() && (pWrtSh->GetFrameType(nullptr,false) & FrameTypeFlags::FLY_ANY); - ( pSh = pWrtSh )->MoveCursor( bSel ); + pSh = pWrtSh; + pSh->MoveCursor( bSel ); pWrtSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_HYPERLINK_GETLINK); } ~ShellMoveCursor() COVERITY_NOEXCEPT_FALSE |