diff options
author | Noel <noel.grandin@collabora.co.uk> | 2021-03-26 13:35:54 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-03-26 18:02:19 +0100 |
commit | b624b13b3d5a8e573c7de8158cadc66b1982d157 (patch) | |
tree | 56948e6a5e8d7f5a7cbde6328a27f13ecd8a72bc /sw | |
parent | 8136620ff432bf17815bef1f88c7531edb839d23 (diff) |
loplugin:flatten
Change-Id: Ib7a895fba66f8dc9b6501e61631c02694053b7fc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113157
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/access/AccessibilityCheck.cxx | 29 | ||||
-rw-r--r-- | sw/source/core/doc/textboxhelper.cxx | 22 | ||||
-rw-r--r-- | sw/source/core/docnode/ndsect.cxx | 26 | ||||
-rw-r--r-- | sw/source/core/edit/ednumber.cxx | 28 | ||||
-rw-r--r-- | sw/source/core/layout/fly.cxx | 26 | ||||
-rw-r--r-- | sw/source/core/layout/objectformattertxtfrm.cxx | 22 | ||||
-rw-r--r-- | sw/source/core/layout/pagechg.cxx | 26 | ||||
-rw-r--r-- | sw/source/core/layout/sectfrm.cxx | 26 | ||||
-rw-r--r-- | sw/source/core/layout/tabfrm.cxx | 26 | ||||
-rw-r--r-- | sw/source/core/layout/wsfrm.cxx | 26 | ||||
-rw-r--r-- | sw/source/core/text/porrst.cxx | 50 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 22 | ||||
-rw-r--r-- | sw/source/ui/dbui/dbtablepreviewdialog.cxx | 24 | ||||
-rw-r--r-- | sw/source/ui/table/instable.cxx | 26 | ||||
-rw-r--r-- | sw/source/uibase/app/appopt.cxx | 32 | ||||
-rw-r--r-- | sw/source/uibase/docvw/SidebarTxtControl.cxx | 28 | ||||
-rw-r--r-- | sw/source/uibase/ribbar/workctrl.cxx | 28 | ||||
-rw-r--r-- | sw/source/uibase/utlui/content.cxx | 106 |
18 files changed, 286 insertions, 287 deletions
diff --git a/sw/source/core/access/AccessibilityCheck.cxx b/sw/source/core/access/AccessibilityCheck.cxx index 82589ef9f715..071b2baf06c1 100644 --- a/sw/source/core/access/AccessibilityCheck.cxx +++ b/sw/source/core/access/AccessibilityCheck.cxx @@ -744,24 +744,23 @@ public: // If outline level stands for heading level... const int currentLevel = pTextNode->GetAttrOutlineLevel(); - if (currentLevel) + if (!currentLevel) + return; + + // ... and if is bigger than previous by more than 1, warn. + if (currentLevel - m_prevLevel > 1) { - // ... and if is bigger than previous by more than 1, warn. - if (currentLevel - m_prevLevel > 1) - { - // Preparing and posting a warning. - OUString resultString = SwResId(STR_HEADING_ORDER); - resultString - = resultString.replaceAll("%LEVEL_CURRENT%", OUString::number(currentLevel)); - resultString - = resultString.replaceAll("%LEVEL_PREV%", OUString::number(m_prevLevel)); - - lclAddIssue(m_rIssueCollection, resultString); - } + // Preparing and posting a warning. + OUString resultString = SwResId(STR_HEADING_ORDER); + resultString + = resultString.replaceAll("%LEVEL_CURRENT%", OUString::number(currentLevel)); + resultString = resultString.replaceAll("%LEVEL_PREV%", OUString::number(m_prevLevel)); - // Updating previous level. - m_prevLevel = currentLevel; + lclAddIssue(m_rIssueCollection, resultString); } + + // Updating previous level. + m_prevLevel = currentLevel; } private: diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx index abe8f38d2124..9bcd522e4277 100644 --- a/sw/source/core/doc/textboxhelper.cxx +++ b/sw/source/core/doc/textboxhelper.cxx @@ -168,21 +168,21 @@ void SwTextBoxHelper::create(SwFrameFormat* pShape, bool bCopyText) // TODO: Text dialog attr setting to frame // Check if the shape had text before and move it to the new textframe - if (bCopyText && !sCopyableText.isEmpty()) + if (!bCopyText || sCopyableText.isEmpty()) + return; + + auto pSdrShape = pShape->FindRealSdrObject(); + if (pSdrShape) { - auto pSdrShape = pShape->FindRealSdrObject(); - if (pSdrShape) - { - auto pSourceText = dynamic_cast<SdrTextObj*>(pSdrShape); - uno::Reference<text::XTextRange> xDestText(xRealTextFrame, uno::UNO_QUERY); + auto pSourceText = dynamic_cast<SdrTextObj*>(pSdrShape); + uno::Reference<text::XTextRange> xDestText(xRealTextFrame, uno::UNO_QUERY); - xDestText->setString(sCopyableText); + xDestText->setString(sCopyableText); - if (pSourceText) - pSourceText->SetText(OUString()); + if (pSourceText) + pSourceText->SetText(OUString()); - pShape->GetDoc()->getIDocumentState().SetModified(); - } + pShape->GetDoc()->getIDocumentState().SetModified(); } } diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx index b13c8fe662ce..26647f2355cf 100644 --- a/sw/source/core/docnode/ndsect.cxx +++ b/sw/source/core/docnode/ndsect.cxx @@ -1197,22 +1197,22 @@ void SwSectionNode::DelFrames(SwRootFrame const*const /*FIXME TODO*/, bool const // If the Area is within a Fly or TableBox, we can only hide it if // there is more Content which has Frames. // Or else the Fly/TableBox Frame does not have a Lower! - if (!bForce) + if (bForce) + return; + + SwNodeIndex aIdx( *this ); + if( !SwNodes::GoPrevSection( &aIdx, true, false ) || + !CheckNodesRange( *this, aIdx, true ) || + // #i21457# + !lcl_IsInSameTableBox( rNds, *this, true )) { - SwNodeIndex aIdx( *this ); - if( !SwNodes::GoPrevSection( &aIdx, true, false ) || - !CheckNodesRange( *this, aIdx, true ) || + aIdx = *EndOfSectionNode(); + if( !rNds.GoNextSection( &aIdx, true, false ) || + !CheckNodesRange( *EndOfSectionNode(), aIdx, true ) || // #i21457# - !lcl_IsInSameTableBox( rNds, *this, true )) + !lcl_IsInSameTableBox( rNds, *EndOfSectionNode(), false )) { - aIdx = *EndOfSectionNode(); - if( !rNds.GoNextSection( &aIdx, true, false ) || - !CheckNodesRange( *EndOfSectionNode(), aIdx, true ) || - // #i21457# - !lcl_IsInSameTableBox( rNds, *EndOfSectionNode(), false )) - { - m_pSection->m_Data.SetHiddenFlag(false); - } + m_pSection->m_Data.SetHiddenFlag(false); } } } diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx index 7d152920af9a..38582a4143e3 100644 --- a/sw/source/core/edit/ednumber.cxx +++ b/sw/source/core/edit/ednumber.cxx @@ -405,23 +405,23 @@ public: MakeAllOutlineContentTemporarilyVisibile(SwWrtShell* pShell) : pWrtShell(pShell) { - if (pWrtShell && pWrtShell->GetViewOptions() && pWrtShell->GetViewOptions()->IsShowOutlineContentVisibilityButton()) + if (!(pWrtShell && pWrtShell->GetViewOptions() && pWrtShell->GetViewOptions()->IsShowOutlineContentVisibilityButton())) + return; + + // make all outlines content visible and store outline nodes having + // content visible attribute value false + SwOutlineNodes rOutlineNds = pWrtShell->GetNodes().GetOutLineNds(); + for (SwOutlineNodes::size_type nPos = 0; nPos < rOutlineNds.size(); ++nPos) { - // make all outlines content visible and store outline nodes having - // content visible attribute value false - SwOutlineNodes rOutlineNds = pWrtShell->GetNodes().GetOutLineNds(); - for (SwOutlineNodes::size_type nPos = 0; nPos < rOutlineNds.size(); ++nPos) + SwNode* pNd = rOutlineNds[nPos]; + if (pNd->IsTextNode()) // should always be true { - SwNode* pNd = rOutlineNds[nPos]; - if (pNd->IsTextNode()) // should always be true + bool bOutlineContentVisibleAttr = true; + pNd->GetTextNode()->GetAttrOutlineContentVisible(bOutlineContentVisibleAttr); + if (!bOutlineContentVisibleAttr) { - bool bOutlineContentVisibleAttr = true; - pNd->GetTextNode()->GetAttrOutlineContentVisible(bOutlineContentVisibleAttr); - if (!bOutlineContentVisibleAttr) - { - aOutlineNdsArray.push_back(pNd); - pWrtShell->ToggleOutlineContentVisibility(nPos); - } + aOutlineNdsArray.push_back(pNd); + pWrtShell->ToggleOutlineContentVisibility(nPos); } } } diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index ceb9a65a38a9..6dcf1b756ed4 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -1048,20 +1048,20 @@ void SwFlyFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pNew, default: bClear = false; } - if ( bClear ) + if ( !bClear ) + return; + + if ( pOldSet || pNewSet ) { - if ( pOldSet || pNewSet ) - { - if ( pOldSet ) - pOldSet->ClearItem( nWhich ); - if ( pNewSet ) - pNewSet->ClearItem( nWhich ); - } - else - { - SwModify aMod; - SwLayoutFrame::SwClientNotify(aMod, sw::LegacyModifyHint(pOld, pNew)); - } + if ( pOldSet ) + pOldSet->ClearItem( nWhich ); + if ( pNewSet ) + pNewSet->ClearItem( nWhich ); + } + else + { + SwModify aMod; + SwLayoutFrame::SwClientNotify(aMod, sw::LegacyModifyHint(pOld, pNew)); } } diff --git a/sw/source/core/layout/objectformattertxtfrm.cxx b/sw/source/core/layout/objectformattertxtfrm.cxx index 1ea4a63fb56c..1036ea3f05c3 100644 --- a/sw/source/core/layout/objectformattertxtfrm.cxx +++ b/sw/source/core/layout/objectformattertxtfrm.cxx @@ -639,20 +639,20 @@ static void CleanupEmptyFootnoteFrame(SwFrame* pLowerFrame) // but now we have to clean up empty footnote frames to prevent crashes. // Note: check it at this level, not lower: both container and footnote // can be deleted at the same time! - if (pLowerFrame->IsFootnoteContFrame()) + if (!pLowerFrame->IsFootnoteContFrame()) + return; + + for (SwFrame * pFootnote = pLowerFrame->GetLower(); pFootnote; ) { - for (SwFrame * pFootnote = pLowerFrame->GetLower(); pFootnote; ) + assert(pFootnote->IsFootnoteFrame()); + SwFrame *const pNextNote = pFootnote->GetNext(); + if (!pFootnote->IsDeleteForbidden() && !pFootnote->GetLower() && !pFootnote->IsColLocked() && + !static_cast<SwFootnoteFrame*>(pFootnote)->IsBackMoveLocked()) { - assert(pFootnote->IsFootnoteFrame()); - SwFrame *const pNextNote = pFootnote->GetNext(); - if (!pFootnote->IsDeleteForbidden() && !pFootnote->GetLower() && !pFootnote->IsColLocked() && - !static_cast<SwFootnoteFrame*>(pFootnote)->IsBackMoveLocked()) - { - pFootnote->Cut(); - SwFrame::DestroyFrame(pFootnote); - } - pFootnote = pNextNote; + pFootnote->Cut(); + SwFrame::DestroyFrame(pFootnote); } + pFootnote = pNextNote; } } diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index 1bc8d05a8167..76ffb60c89a2 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -698,20 +698,20 @@ void SwPageFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pNew, default: bClear = false; } - if ( bClear ) + if ( !bClear ) + return; + + if ( pOldSet || pNewSet ) { - if ( pOldSet || pNewSet ) - { - if ( pOldSet ) - pOldSet->ClearItem( nWhich ); - if ( pNewSet ) - pNewSet->ClearItem( nWhich ); - } - else - { - SwModify aMod; - SwLayoutFrame::SwClientNotify(aMod, sw::LegacyModifyHint(pOld, pNew)); - } + if ( pOldSet ) + pOldSet->ClearItem( nWhich ); + if ( pNewSet ) + pNewSet->ClearItem( nWhich ); + } + else + { + SwModify aMod; + SwLayoutFrame::SwClientNotify(aMod, sw::LegacyModifyHint(pOld, pNew)); } } diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx index 0de0d2a5f296..7f738bbc3d5e 100644 --- a/sw/source/core/layout/sectfrm.cxx +++ b/sw/source/core/layout/sectfrm.cxx @@ -2715,20 +2715,20 @@ void SwSectionFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pN default: bClear = false; } - if ( bClear ) + if ( !bClear ) + return; + + if ( pOldSet || pNewSet ) { - if ( pOldSet || pNewSet ) - { - if ( pOldSet ) - pOldSet->ClearItem( nWhich ); - if ( pNewSet ) - pNewSet->ClearItem( nWhich ); - } - else - { - SwModify aMod; - SwLayoutFrame::SwClientNotify(aMod, sw::LegacyModifyHint(pOld, pNew)); - } + if ( pOldSet ) + pOldSet->ClearItem( nWhich ); + if ( pNewSet ) + pNewSet->ClearItem( nWhich ); + } + else + { + SwModify aMod; + SwLayoutFrame::SwClientNotify(aMod, sw::LegacyModifyHint(pOld, pNew)); } } diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index bbfaf327c96c..af675d8bd8b8 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -3403,20 +3403,20 @@ void SwTabFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pNew, default: bClear = false; } - if ( bClear ) + if ( !bClear ) + return; + + if ( pOldSet || pNewSet ) { - if ( pOldSet || pNewSet ) - { - if ( pOldSet ) - pOldSet->ClearItem( nWhich ); - if ( pNewSet ) - pNewSet->ClearItem( nWhich ); - } - else - { - SwModify aMod; - SwLayoutFrame::SwClientNotify(aMod, sw::LegacyModifyHint(pOld, pNew)); - } + if ( pOldSet ) + pOldSet->ClearItem( nWhich ); + if ( pNewSet ) + pNewSet->ClearItem( nWhich ); + } + else + { + SwModify aMod; + SwLayoutFrame::SwClientNotify(aMod, sw::LegacyModifyHint(pOld, pNew)); } } diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index 10434529b67e..fccf94925187 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -2538,20 +2538,20 @@ void SwContentFrame::UpdateAttr_( const SfxPoolItem* pOld, const SfxPoolItem* pN default: bClear = false; } - if ( bClear ) + if ( !bClear ) + return; + + if ( pOldSet || pNewSet ) { - if ( pOldSet || pNewSet ) - { - if ( pOldSet ) - pOldSet->ClearItem( nWhich ); - if ( pNewSet ) - pNewSet->ClearItem( nWhich ); - } - else - { - SwModify aMod; - SwFrame::SwClientNotify(aMod, sw::LegacyModifyHint(pOld, pNew)); - } + if ( pOldSet ) + pOldSet->ClearItem( nWhich ); + if ( pNewSet ) + pNewSet->ClearItem( nWhich ); + } + else + { + SwModify aMod; + SwFrame::SwClientNotify(aMod, sw::LegacyModifyHint(pOld, pNew)); } } diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx index 7097bcd90f9d..6f578e0744cd 100644 --- a/sw/source/core/text/porrst.cxx +++ b/sw/source/core/text/porrst.cxx @@ -114,39 +114,39 @@ SwLinePortion *SwBreakPortion::Compress() void SwBreakPortion::Paint( const SwTextPaintInfo &rInf ) const { - if( rInf.OnWin() && rInf.GetOpt().IsLineBreak() ) - { - rInf.DrawLineBreak( *this ); + if( !(rInf.OnWin() && rInf.GetOpt().IsLineBreak()) ) + return; - // paint redlining - if (m_eRedline != RedlineType::None) + rInf.DrawLineBreak( *this ); + + // paint redlining + if (m_eRedline != RedlineType::None) + { + sal_Int16 nNoBreakWidth = rInf.GetTextSize(S_NOBREAK_FOR_REDLINE).Width(); + if ( nNoBreakWidth > 0 ) { - sal_Int16 nNoBreakWidth = rInf.GetTextSize(S_NOBREAK_FOR_REDLINE).Width(); - if ( nNoBreakWidth > 0 ) - { - // approximate portion size with multiple no-break spaces - // and draw these spaces (at least a single one) by DrawText - // painting the requested redline underline/strikeout - sal_Int16 nSpaces = (LINE_BREAK_WIDTH + nNoBreakWidth/2) / nNoBreakWidth; - OUStringBuffer aBuf(S_NOBREAK_FOR_REDLINE); - for (sal_Int16 i = 1; i < nSpaces; ++i) - aBuf.append(S_NOBREAK_FOR_REDLINE); + // approximate portion size with multiple no-break spaces + // and draw these spaces (at least a single one) by DrawText + // painting the requested redline underline/strikeout + sal_Int16 nSpaces = (LINE_BREAK_WIDTH + nNoBreakWidth/2) / nNoBreakWidth; + OUStringBuffer aBuf(S_NOBREAK_FOR_REDLINE); + for (sal_Int16 i = 1; i < nSpaces; ++i) + aBuf.append(S_NOBREAK_FOR_REDLINE); - const SwFont* pOldFnt = rInf.GetFont(); + const SwFont* pOldFnt = rInf.GetFont(); - SwFont aFont(*pOldFnt); + SwFont aFont(*pOldFnt); - if (m_eRedline == RedlineType::Delete) - aFont.SetUnderline( LINESTYLE_NONE ); - else - aFont.SetStrikeout( STRIKEOUT_NONE ); + if (m_eRedline == RedlineType::Delete) + aFont.SetUnderline( LINESTYLE_NONE ); + else + aFont.SetStrikeout( STRIKEOUT_NONE ); - const_cast<SwTextPaintInfo&>(rInf).SetFont(&aFont); + const_cast<SwTextPaintInfo&>(rInf).SetFont(&aFont); - rInf.DrawText(aBuf.makeStringAndClear(), *this); + rInf.DrawText(aBuf.makeStringAndClear(), *this); - const_cast<SwTextPaintInfo&>(rInf).SetFont(const_cast<SwFont*>(pOldFnt)); - } + const_cast<SwTextPaintInfo&>(rInf).SetFont(const_cast<SwFont*>(pOldFnt)); } } } diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 46d19f82cec0..4b9c72829c3b 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -7543,18 +7543,18 @@ void DocxAttributeOutput::CharEscapement( const SvxEscapementItem& rEscapement ) if ( !sIss.isEmpty() ) m_pSerializer->singleElementNS(XML_w, XML_vertAlign, FSNS(XML_w, XML_val), sIss); - if (sIss.isEmpty() || sIss.match("baseline")) - { - const SvxFontHeightItem& rItem = m_rExport.GetItem(RES_CHRATR_FONTSIZE); - float fHeight = rItem.GetHeight(); - OString sPos = OString::number( round(( fHeight * nEsc ) / 1000) ); - m_pSerializer->singleElementNS(XML_w, XML_position, FSNS(XML_w, XML_val), sPos); + if (!(sIss.isEmpty() || sIss.match("baseline"))) + return; - if( ( 100 != nProp || sIss.match( "baseline" ) ) && !m_rExport.m_bFontSizeWritten ) - { - OString sSize = OString::number( round(( fHeight * nProp ) / 1000) ); - m_pSerializer->singleElementNS(XML_w, XML_sz, FSNS(XML_w, XML_val), sSize); - } + const SvxFontHeightItem& rItem = m_rExport.GetItem(RES_CHRATR_FONTSIZE); + float fHeight = rItem.GetHeight(); + OString sPos = OString::number( round(( fHeight * nEsc ) / 1000) ); + m_pSerializer->singleElementNS(XML_w, XML_position, FSNS(XML_w, XML_val), sPos); + + if( ( 100 != nProp || sIss.match( "baseline" ) ) && !m_rExport.m_bFontSizeWritten ) + { + OString sSize = OString::number( round(( fHeight * nProp ) / 1000) ); + m_pSerializer->singleElementNS(XML_w, XML_sz, FSNS(XML_w, XML_val), sSize); } } diff --git a/sw/source/ui/dbui/dbtablepreviewdialog.cxx b/sw/source/ui/dbui/dbtablepreviewdialog.cxx index d716aefbb689..6a2f0e916a25 100644 --- a/sw/source/ui/dbui/dbtablepreviewdialog.cxx +++ b/sw/source/ui/dbui/dbtablepreviewdialog.cxx @@ -88,19 +88,19 @@ SwDBTablePreviewDialog::SwDBTablePreviewDialog(weld::Window* pParent, uno::Seque { xFrame.clear(); } - if (xFrame.is()) - { - m_xFrameListener.set(new DBTablePreviewFrame(xFrame)); - xFrame->addEventListener(m_xFrameListener); + if (!xFrame.is()) + return; - util::URL aURL; - aURL.Complete = ".component:DB/DataSourceBrowser"; - uno::Reference<frame::XDispatch> xD = xFrame->queryDispatch(aURL, "", 0x0C); - if (xD.is()) - { - xD->dispatch(aURL, rValues); - m_xBeamerWIN->show(); - } + m_xFrameListener.set(new DBTablePreviewFrame(xFrame)); + xFrame->addEventListener(m_xFrameListener); + + util::URL aURL; + aURL.Complete = ".component:DB/DataSourceBrowser"; + uno::Reference<frame::XDispatch> xD = xFrame->queryDispatch(aURL, "", 0x0C); + if (xD.is()) + { + xD->dispatch(aURL, rValues); + m_xBeamerWIN->show(); } } diff --git a/sw/source/ui/table/instable.cxx b/sw/source/ui/table/instable.cxx index b700b85d53fc..6ba513c4f2fb 100644 --- a/sw/source/ui/table/instable.cxx +++ b/sw/source/ui/table/instable.cxx @@ -259,22 +259,22 @@ IMPL_LINK( SwInsTableDlg, ModifyRowCol, weld::Entry&, rEdit, void ) { m_xWarning->set_visible(false); } - if (&rEdit != m_xColSpinButton.get()) - { - if(!nRow) - nRow = 1; + if (&rEdit == m_xColSpinButton.get()) + return; - // adjust depending NF for repeated rows - sal_Int64 nMax = ( nRow == 1 )? 1 : nRow - 1 ; - sal_Int64 nActVal = m_xRepeatHeaderNF->get_value(); + if(!nRow) + nRow = 1; - m_xRepeatHeaderNF->set_max( nMax ); + // adjust depending NF for repeated rows + sal_Int64 nMax = ( nRow == 1 )? 1 : nRow - 1 ; + sal_Int64 nActVal = m_xRepeatHeaderNF->get_value(); - if( nActVal > nMax ) - m_xRepeatHeaderNF->set_value( nMax ); - else if( nActVal < nEnteredValRepeatHeaderNF ) - m_xRepeatHeaderNF->set_value(std::min(nEnteredValRepeatHeaderNF, nMax)); - } + m_xRepeatHeaderNF->set_max( nMax ); + + if( nActVal > nMax ) + m_xRepeatHeaderNF->set_value( nMax ); + else if( nActVal < nEnteredValRepeatHeaderNF ) + m_xRepeatHeaderNF->set_value(std::min(nEnteredValRepeatHeaderNF, nMax)); } IMPL_LINK_NOARG(SwInsTableDlg, CheckBoxHdl, weld::ToggleButton&, void) diff --git a/sw/source/uibase/app/appopt.cxx b/sw/source/uibase/app/appopt.cxx index 1ab2a7823092..9862da388021 100644 --- a/sw/source/uibase/app/appopt.cxx +++ b/sw/source/uibase/app/appopt.cxx @@ -426,23 +426,23 @@ void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) ApplyUsrPref( aViewOpt, pAppView, bTextDialog? SvViewOpt::DestText : SvViewOpt::DestWeb); // must be done after ApplyUsrPref - if (SfxItemState::SET == rSet.GetItemState(FN_PARAM_ELEM, false)) + if (SfxItemState::SET != rSet.GetItemState(FN_PARAM_ELEM, false)) + return; + + if (!GetActiveWrtShell()->GetViewOptions()->IsShowOutlineContentVisibilityButton()) { - if (!GetActiveWrtShell()->GetViewOptions()->IsShowOutlineContentVisibilityButton()) - { - // outline mode is no longer active - // set outline content visible attribute to false for nodes in the array - for (SwNode* pNd : aFoldedOutlineNdsArray) - pNd->GetTextNode()->SetAttrOutlineContentVisible(false); - } - else if (bShow) - { - // outline mode remained active - // sub level treatment might have changed - // ToggleOutlineContentVisibility only knows sub level treatment after ApplyUserPref - for (SwNode* pNd : aFoldedOutlineNdsArray) - GetActiveWrtShell()->ToggleOutlineContentVisibility(pNd, true); - } + // outline mode is no longer active + // set outline content visible attribute to false for nodes in the array + for (SwNode* pNd : aFoldedOutlineNdsArray) + pNd->GetTextNode()->SetAttrOutlineContentVisible(false); + } + else if (bShow) + { + // outline mode remained active + // sub level treatment might have changed + // ToggleOutlineContentVisibility only knows sub level treatment after ApplyUserPref + for (SwNode* pNd : aFoldedOutlineNdsArray) + GetActiveWrtShell()->ToggleOutlineContentVisibility(pNd, true); } } diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx index 3c5de1f2b8ee..2f0fe44a21e9 100644 --- a/sw/source/uibase/docvw/SidebarTxtControl.cxx +++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx @@ -206,25 +206,25 @@ void SidebarTextControl::DrawForPage(OutputDevice* pDev, const Point& rPt) pOutlinerView->GetOutliner()->Draw(pDev, tools::Rectangle(rPt, aSize)); } - if ( mrSidebarWin.GetLayoutStatus()==SwPostItHelper::DELETED ) - { - pDev->Push(PushFlags::LINECOLOR); + if ( mrSidebarWin.GetLayoutStatus()!=SwPostItHelper::DELETED ) + return; - pDev->SetLineColor(mrSidebarWin.GetChangeColor()); - Point aBottomRight(rPt); - aBottomRight.Move(aSize); - pDev->DrawLine(rPt, aBottomRight); + pDev->Push(PushFlags::LINECOLOR); - Point aTopRight(rPt); - aTopRight.Move(Size(aSize.Width(), 0)); + pDev->SetLineColor(mrSidebarWin.GetChangeColor()); + Point aBottomRight(rPt); + aBottomRight.Move(aSize); + pDev->DrawLine(rPt, aBottomRight); - Point aBottomLeft(rPt); - aBottomLeft.Move(Size(0, aSize.Height())); + Point aTopRight(rPt); + aTopRight.Move(Size(aSize.Width(), 0)); - pDev->DrawLine(aTopRight, aBottomLeft); + Point aBottomLeft(rPt); + aBottomLeft.Move(Size(0, aSize.Height())); - pDev->Pop(); - } + pDev->DrawLine(aTopRight, aBottomLeft); + + pDev->Pop(); } void SidebarTextControl::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) diff --git a/sw/source/uibase/ribbar/workctrl.cxx b/sw/source/uibase/ribbar/workctrl.cxx index 5fd2438c63a0..6a88d7c1a072 100644 --- a/sw/source/uibase/ribbar/workctrl.cxx +++ b/sw/source/uibase/ribbar/workctrl.cxx @@ -850,22 +850,22 @@ void SAL_CALL NavElementToolBoxControl::statusChanged( const frame::FeatureState return; SolarMutexGuard aSolarMutexGuard; - if ( rEvent.FeatureURL.Path == "NavElement" ) + if ( rEvent.FeatureURL.Path != "NavElement" ) + return; + + if ( rEvent.IsEnabled ) { - if ( rEvent.IsEnabled ) - { - m_pBox->set_sensitive(true); - m_pBox->UpdateBox(); - } - else - m_pBox->set_sensitive(true); + m_pBox->set_sensitive(true); + m_pBox->UpdateBox(); + } + else + m_pBox->set_sensitive(true); - SwView* pView = GetActiveView(); - if (pView && pView->GetViewFrame()) - { - pView->GetViewFrame()->GetBindings().Invalidate(FN_SCROLL_NEXT); - pView->GetViewFrame()->GetBindings().Invalidate(FN_SCROLL_PREV); - } + SwView* pView = GetActiveView(); + if (pView && pView->GetViewFrame()) + { + pView->GetViewFrame()->GetBindings().Invalidate(FN_SCROLL_NEXT); + pView->GetViewFrame()->GetBindings().Invalidate(FN_SCROLL_PREV); } } diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index fe9da9cfc0e1..265f2b28dc90 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -3165,34 +3165,34 @@ void SwContentTree::HideTree() static void lcl_SelectByContentTypeAndName(SwContentTree* pThis, weld::TreeView& rContentTree, std::u16string_view rContentTypeName, std::u16string_view rName) { - if (!rName.empty()) + if (rName.empty()) + return; + + // find content type entry + std::unique_ptr<weld::TreeIter> xIter(rContentTree.make_iterator()); + bool bFoundEntry = rContentTree.get_iter_first(*xIter); + while (bFoundEntry && rContentTypeName != rContentTree.get_text(*xIter)) + bFoundEntry = rContentTree.iter_next_sibling(*xIter); + // find content type content entry and select it + if (bFoundEntry) { - // find content type entry - std::unique_ptr<weld::TreeIter> xIter(rContentTree.make_iterator()); - bool bFoundEntry = rContentTree.get_iter_first(*xIter); - while (bFoundEntry && rContentTypeName != rContentTree.get_text(*xIter)) - bFoundEntry = rContentTree.iter_next_sibling(*xIter); - // find content type content entry and select it - if (bFoundEntry) + rContentTree.expand_row(*xIter); // assure content type entry is expanded + while (rContentTree.iter_next(*xIter) && lcl_IsContent(*xIter, rContentTree)) { - rContentTree.expand_row(*xIter); // assure content type entry is expanded - while (rContentTree.iter_next(*xIter) && lcl_IsContent(*xIter, rContentTree)) + if (rName == rContentTree.get_text(*xIter)) { - if (rName == rContentTree.get_text(*xIter)) + // get first selected for comparison + std::unique_ptr<weld::TreeIter> xFirstSelected(rContentTree.make_iterator()); + if (!rContentTree.get_selected(xFirstSelected.get())) + xFirstSelected.reset(); + if (rContentTree.count_selected_rows() != 1 || + rContentTree.iter_compare(*xIter, *xFirstSelected) != 0) { - // get first selected for comparison - std::unique_ptr<weld::TreeIter> xFirstSelected(rContentTree.make_iterator()); - if (!rContentTree.get_selected(xFirstSelected.get())) - xFirstSelected.reset(); - if (rContentTree.count_selected_rows() != 1 || - rContentTree.iter_compare(*xIter, *xFirstSelected) != 0) - { - // unselect all entries and make passed entry visible and selected - rContentTree.set_cursor(*xIter); - pThis->Select(); - } - break; + // unselect all entries and make passed entry visible and selected + rContentTree.set_cursor(*xIter); + pThis->Select(); } + break; } } } @@ -3405,41 +3405,41 @@ void SwContentTree::SelectOutlinesWithSelection() } } while (pCursor && pCursor != pFirstCursor); - if (!aOutlinePositions.empty()) - { - // remove duplicates before selecting - aOutlinePositions.erase(std::unique(aOutlinePositions.begin(), aOutlinePositions.end()), - aOutlinePositions.end()); + if (aOutlinePositions.empty()) + return; - m_xTreeView->unselect_all(); + // remove duplicates before selecting + aOutlinePositions.erase(std::unique(aOutlinePositions.begin(), aOutlinePositions.end()), + aOutlinePositions.end()); - for (auto nOutlinePosition : aOutlinePositions) - { - m_xTreeView->all_foreach([this, nOutlinePosition](const weld::TreeIter& rEntry){ - if (lcl_IsContent(rEntry, *m_xTreeView) && - reinterpret_cast<SwContent*>( - m_xTreeView->get_id(rEntry).toInt64())->GetParent()->GetType() == - ContentTypeId::OUTLINE) + m_xTreeView->unselect_all(); + + for (auto nOutlinePosition : aOutlinePositions) + { + m_xTreeView->all_foreach([this, nOutlinePosition](const weld::TreeIter& rEntry){ + if (lcl_IsContent(rEntry, *m_xTreeView) && + reinterpret_cast<SwContent*>( + m_xTreeView->get_id(rEntry).toInt64())->GetParent()->GetType() == + ContentTypeId::OUTLINE) + { + if (reinterpret_cast<SwOutlineContent*>( + m_xTreeView->get_id(rEntry).toInt64())->GetOutlinePos() == + nOutlinePosition) { - if (reinterpret_cast<SwOutlineContent*>( - m_xTreeView->get_id(rEntry).toInt64())->GetOutlinePos() == - nOutlinePosition) - { - std::unique_ptr<weld::TreeIter> xParent = - m_xTreeView->make_iterator(&rEntry); - if (m_xTreeView->iter_parent(*xParent) && - !m_xTreeView->get_row_expanded(*xParent)) - m_xTreeView->expand_row(*xParent); - m_xTreeView->select(rEntry); - return true; - } + std::unique_ptr<weld::TreeIter> xParent = + m_xTreeView->make_iterator(&rEntry); + if (m_xTreeView->iter_parent(*xParent) && + !m_xTreeView->get_row_expanded(*xParent)) + m_xTreeView->expand_row(*xParent); + m_xTreeView->select(rEntry); + return true; } - return false; - }); - } - - Select(); + } + return false; + }); } + + Select(); } void SwContentTree::MoveOutline(SwOutlineNodes::size_type nTargetPos) |