diff options
author | Noel Grandin <noel@peralex.com> | 2016-06-25 23:03:53 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-06-27 05:22:07 +0000 |
commit | 1bf97d99e7529f1a69688522ac271636059a3391 (patch) | |
tree | 67629ba3d6d0c9fbe9916e7245461c3c2d7c79b2 | |
parent | b1225d201f8c23c75e31e09a0f5e9ff838866776 (diff) |
loplugin:singlevalfields in sw(part1)
Change-Id: I0c6f545a8818da1f226c3958580abeeff0dc87b7
Reviewed-on: https://gerrit.libreoffice.org/26664
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r-- | sw/source/ui/config/optpage.cxx | 8 | ||||
-rw-r--r-- | sw/source/ui/frmdlg/frmpage.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/cctrl/swlbox.cxx | 19 | ||||
-rw-r--r-- | sw/source/uibase/docvw/AnchorOverlayObject.cxx | 45 | ||||
-rw-r--r-- | sw/source/uibase/docvw/srcedtw.cxx | 3 | ||||
-rw-r--r-- | sw/source/uibase/inc/bmpwin.hxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/inc/content.hxx | 3 | ||||
-rw-r--r-- | sw/source/uibase/inc/optpage.hxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/inc/redlndlg.hxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/inc/srcedtw.hxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/inc/swlbox.hxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/inc/tablemgr.hxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/inc/unomod.hxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/misc/redlndlg.cxx | 8 | ||||
-rw-r--r-- | sw/source/uibase/table/tablemgr.cxx | 8 | ||||
-rw-r--r-- | sw/source/uibase/uno/unomod.cxx | 16 | ||||
-rw-r--r-- | sw/source/uibase/utlui/content.cxx | 24 |
17 files changed, 23 insertions, 123 deletions
diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx index 84c3cf26df57..2369aa04b729 100644 --- a/sw/source/ui/config/optpage.cxx +++ b/sw/source/ui/config/optpage.cxx @@ -549,7 +549,6 @@ SwStdFontTabPage::SwStdFontTabPage( vcl::Window* pParent, m_bSetLabelDefault(true), m_bIdxDefault(false), m_bSetIdxDefault(true), - m_bDeletePrinter(false), m_bListHeightDefault (false), m_bSetListHeightDefault (false), @@ -611,8 +610,6 @@ SwStdFontTabPage::~SwStdFontTabPage() void SwStdFontTabPage::dispose() { delete m_pFontList; - if (m_bDeletePrinter) - m_pPrt.disposeAndClear(); m_pLabelFT.clear(); m_pStandardBox.clear(); m_pStandardHeightLB.clear(); @@ -802,11 +799,6 @@ void SwStdFontTabPage::Reset( const SfxItemSet* rSet) const SfxPoolItem* pItem; - if (m_bDeletePrinter) - { - m_pPrt.disposeAndClear(); - } - if(SfxItemState::SET == rSet->GetItemState(FN_PARAM_PRINTER, false, &pItem)) { m_pPrt = static_cast<SfxPrinter*>(static_cast<const SwPtrItem*>(pItem)->GetValue()); diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx index df4760deb996..7f90f17dec1a 100644 --- a/sw/source/ui/frmdlg/frmpage.cxx +++ b/sw/source/ui/frmdlg/frmpage.cxx @@ -2627,7 +2627,6 @@ BmpWindow::BmpWindow(vcl::Window* pPar, WinBits nStyle) , bHorz(false) , bVert(false) , bGraphic(false) - , bLeftAlign(false) { } @@ -2675,8 +2674,7 @@ void BmpWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle&) else aPntSz.Width() = aPntSz.Height() * nRelGrf /100; - if (!bLeftAlign) - aPntPos.X() += nWidth - aPntSz.Width() ; + aPntPos.X() += nWidth - aPntSz.Width() ; } // #i119307# clear window background, the graphic might have transparency diff --git a/sw/source/uibase/cctrl/swlbox.cxx b/sw/source/uibase/cctrl/swlbox.cxx index 9b4290234fbd..9ee1e32f8aad 100644 --- a/sw/source/uibase/cctrl/swlbox.cxx +++ b/sw/source/uibase/cctrl/swlbox.cxx @@ -23,19 +23,16 @@ #include <swlbox.hxx> // Description: ListboxElement -SwBoxEntry::SwBoxEntry() : - bNew(false) +SwBoxEntry::SwBoxEntry() { } SwBoxEntry::SwBoxEntry(const OUString& aNam) : - bNew(false), aName(aNam) { } SwBoxEntry::SwBoxEntry(const SwBoxEntry& rOld) : - bNew(rOld.bNew), aName(rOld.aName) { } @@ -78,20 +75,12 @@ void SwComboBox::RemoveEntryAt(sal_Int32 const nPos) return; // Remove old element - SwBoxEntry const& rEntry = m_EntryList[nPos]; ComboBox::RemoveEntryAt(nPos); // Don't add new entries to the list - if (rEntry.bNew) - { - m_EntryList.erase(m_EntryList.begin() + nPos); - } - else - { - // add to DelEntryLst - m_DelEntryList.push_back(m_EntryList[nPos]); - m_EntryList.erase(m_EntryList.begin() + nPos); - } + // add to DelEntryLst + m_DelEntryList.push_back(m_EntryList[nPos]); + m_EntryList.erase(m_EntryList.begin() + nPos); } const SwBoxEntry& SwComboBox::GetSwEntry(sal_Int32 const nPos) const diff --git a/sw/source/uibase/docvw/AnchorOverlayObject.cxx b/sw/source/uibase/docvw/AnchorOverlayObject.cxx index 4f8d0e147788..850228e6cf3b 100644 --- a/sw/source/uibase/docvw/AnchorOverlayObject.cxx +++ b/sw/source/uibase/docvw/AnchorOverlayObject.cxx @@ -48,7 +48,6 @@ private: double mfDiscreteLineWidth; // bitfield - bool mbShadow : 1; bool mbLineSolid : 1; protected: @@ -70,7 +69,6 @@ public: maAnchorState(aAnchorState), maColor(rColor), mfDiscreteLineWidth(fDiscreteLineWidth), - mbShadow(false), mbLineSolid(bLineSolid) {} @@ -81,7 +79,6 @@ public: AnchorState getAnchorState() const { return maAnchorState; } const basegfx::BColor& getColor() const { return maColor; } double getDiscreteLineWidth() const { return mfDiscreteLineWidth; } - bool getShadow() const { return mbShadow; } bool getLineSolid() const { return mbLineSolid; } virtual bool operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const override; @@ -148,47 +145,6 @@ drawinglayer::primitive2d::Primitive2DContainer AnchorPrimitive::create2DDecompo } } - if(!aRetval.empty() && getShadow()) - { - // shadow is only for triangle and line start, and in upper left - // and lower right direction, in different colors - const double fColorChange(20.0 / 255.0); - const basegfx::B3DTuple aColorChange(fColorChange, fColorChange, fColorChange); - basegfx::BColor aLighterColor(getColor() + aColorChange); - basegfx::BColor aDarkerColor(getColor() - aColorChange); - - aLighterColor.clamp(); - aDarkerColor.clamp(); - - // create shadow sequence - drawinglayer::primitive2d::Primitive2DContainer aShadows(2); - basegfx::B2DHomMatrix aTransform; - - aTransform.set(0, 2, -getDiscreteUnit()); - aTransform.set(1, 2, -getDiscreteUnit()); - - aShadows[0] = drawinglayer::primitive2d::Primitive2DReference( - new drawinglayer::primitive2d::ShadowPrimitive2D( - aTransform, - aLighterColor, - aRetval)); - - aTransform.set(0, 2, getDiscreteUnit()); - aTransform.set(1, 2, getDiscreteUnit()); - - aShadows[1] = drawinglayer::primitive2d::Primitive2DReference( - new drawinglayer::primitive2d::ShadowPrimitive2D( - aTransform, - aDarkerColor, - aRetval)); - - // add shadow before geometry to make it be proccessed first - const drawinglayer::primitive2d::Primitive2DContainer aTemporary(aRetval); - - aRetval = aShadows; - aRetval.append(aTemporary); - } - if ( AS_ALL == maAnchorState || AS_END == maAnchorState ) { @@ -217,7 +173,6 @@ bool AnchorPrimitive::operator==( const drawinglayer::primitive2d::BasePrimitive && getAnchorState() == rCompare.getAnchorState() && getColor() == rCompare.getColor() && getDiscreteLineWidth() == rCompare.getDiscreteLineWidth() - && getShadow() == rCompare.getShadow() && getLineSolid() == rCompare.getLineSolid()); } diff --git a/sw/source/uibase/docvw/srcedtw.cxx b/sw/source/uibase/docvw/srcedtw.cxx index 4bce8bc7ec66..54f03f9ce3c7 100644 --- a/sw/source/uibase/docvw/srcedtw.cxx +++ b/sw/source/uibase/docvw/srcedtw.cxx @@ -249,7 +249,6 @@ SwSrcEditWindow::SwSrcEditWindow( vcl::Window* pParent, SwSrcView* pParentView ) nCurTextWidth(0), nStartLine(USHRT_MAX), eSourceEncoding(osl_getThreadTextEncoding()), - bDoSyntaxHighlight(true), bHighlighting(false), aSyntaxIdle("sw uibase SwSrcEditWindow Syntax") { @@ -674,7 +673,7 @@ void SwSrcEditWindow::DoSyntaxHighlight( sal_uInt16 nPara ) void SwSrcEditWindow::DoDelayedSyntaxHighlight( sal_uInt16 nPara ) { - if ( !bHighlighting && bDoSyntaxHighlight ) + if ( !bHighlighting ) { aSyntaxLineTable.insert( nPara ); aSyntaxIdle.Start(); diff --git a/sw/source/uibase/inc/bmpwin.hxx b/sw/source/uibase/inc/bmpwin.hxx index 442147a745e0..6ea8d06cb1b8 100644 --- a/sw/source/uibase/inc/bmpwin.hxx +++ b/sw/source/uibase/inc/bmpwin.hxx @@ -34,7 +34,6 @@ private: bool bHorz : 1; bool bVert : 1; bool bGraphic : 1; - bool bLeftAlign : 1; virtual void Paint(vcl::RenderContext& /*rRenderContext*/, const Rectangle& rRect) override; diff --git a/sw/source/uibase/inc/content.hxx b/sw/source/uibase/inc/content.hxx index 27cd9bc747f3..feafa87f7b1e 100644 --- a/sw/source/uibase/inc/content.hxx +++ b/sw/source/uibase/inc/content.hxx @@ -91,7 +91,6 @@ class SwPostItContent : public SwContent { const SwFormatField* pField; SwRangeRedline* pRedline; - bool mbPostIt; public: SwPostItContent( const SwContentType* pCnt, const OUString& rName, @@ -100,13 +99,11 @@ public: : SwContent(pCnt, rName, nYPos) , pField(pFormatField) , pRedline(nullptr) - , mbPostIt(true) {} const SwFormatField* GetPostIt() const { return pField; } SwRangeRedline* GetRedline() { return pRedline; } virtual bool IsProtect() const override; - bool IsPostIt() const {return mbPostIt; } }; class SwGraphicContent : public SwContent diff --git a/sw/source/uibase/inc/optpage.hxx b/sw/source/uibase/inc/optpage.hxx index 03d65cdfff5d..51d1f46db633 100644 --- a/sw/source/uibase/inc/optpage.hxx +++ b/sw/source/uibase/inc/optpage.hxx @@ -158,7 +158,6 @@ class SwStdFontTabPage : public SfxTabPage bool m_bSetLabelDefault :1; bool m_bIdxDefault :1; bool m_bSetIdxDefault :1; - bool m_bDeletePrinter :1; bool m_bListHeightDefault :1; bool m_bSetListHeightDefault :1; diff --git a/sw/source/uibase/inc/redlndlg.hxx b/sw/source/uibase/inc/redlndlg.hxx index c661ae22ff1b..f97ba04643ad 100644 --- a/sw/source/uibase/inc/redlndlg.hxx +++ b/sw/source/uibase/inc/redlndlg.hxx @@ -81,7 +81,6 @@ class SW_DLLPUBLIC SwRedlineAcceptDlg Link<SvTreeListBox*,void> m_aOldSelectHdl; Link<SvTreeListBox*,void> m_aOldDeselectHdl; bool m_bOnlyFormatedRedlines; - bool m_bHasReadonlySel; bool m_bRedlnAutoFormat; // prevent update dialog data during longer operations (cf #102657#) diff --git a/sw/source/uibase/inc/srcedtw.hxx b/sw/source/uibase/inc/srcedtw.hxx index d7b57db57cf1..5810865787b0 100644 --- a/sw/source/uibase/inc/srcedtw.hxx +++ b/sw/source/uibase/inc/srcedtw.hxx @@ -82,7 +82,6 @@ private: sal_uInt16 nStartLine; rtl_TextEncoding eSourceEncoding; bool bReadonly; - bool bDoSyntaxHighlight; bool bHighlighting; Idle aSyntaxIdle; diff --git a/sw/source/uibase/inc/swlbox.hxx b/sw/source/uibase/inc/swlbox.hxx index 1d2d34aff2af..94997a3f7487 100644 --- a/sw/source/uibase/inc/swlbox.hxx +++ b/sw/source/uibase/inc/swlbox.hxx @@ -34,7 +34,6 @@ class SW_DLLPUBLIC SwBoxEntry { friend class SwComboBox; - bool bNew : 1; OUString aName; public: diff --git a/sw/source/uibase/inc/tablemgr.hxx b/sw/source/uibase/inc/tablemgr.hxx index 7c92756a9fa7..ce7632dbf4ce 100644 --- a/sw/source/uibase/inc/tablemgr.hxx +++ b/sw/source/uibase/inc/tablemgr.hxx @@ -43,7 +43,6 @@ class SW_DLLPUBLIC SwTableFUNC { SwFrameFormat *pFormat; SwWrtShell *pSh; - bool bCopy; SwTabCols aCols; private: diff --git a/sw/source/uibase/inc/unomod.hxx b/sw/source/uibase/inc/unomod.hxx index e41af1200b7a..352ed23b165a 100644 --- a/sw/source/uibase/inc/unomod.hxx +++ b/sw/source/uibase/inc/unomod.hxx @@ -133,7 +133,7 @@ protected: SwView* pView; SwViewOption* mpViewOption; const SwViewOption* mpConstViewOption; - bool bObjectValid:1, bWeb:1, mbApplyZoom; + bool bObjectValid:1, mbApplyZoom; FieldUnit eHRulerUnit; bool mbApplyHRulerMetric; diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx index eca8ac5fe9ee..670e3b31de8f 100644 --- a/sw/source/uibase/misc/redlndlg.cxx +++ b/sw/source/uibase/misc/redlndlg.cxx @@ -159,7 +159,6 @@ SwRedlineAcceptDlg::SwRedlineAcceptDlg(vcl::Window *pParent, VclBuilderContainer m_sFormatCollSet (SW_RES(STR_REDLINE_FMTCOLLSET)), m_sAutoFormat (SW_RES(STR_REDLINE_AUTOFMT)), m_bOnlyFormatedRedlines( false ), - m_bHasReadonlySel ( false ), m_bRedlnAutoFormat (bAutoFormat), m_bInhibitActivate( false ), m_aInserted (SW_RES(IMG_REDLINE_INSERTED)), @@ -273,7 +272,6 @@ void SwRedlineAcceptDlg::InitAuthors() sal_uInt16 nCount = pSh->GetRedlineCount(); m_bOnlyFormatedRedlines = true; - m_bHasReadonlySel = false; bool bIsNotFormated = false; sal_uInt16 i; @@ -322,8 +320,8 @@ void SwRedlineAcceptDlg::InitAuthors() m_pTPView->EnableAccept( bEnable && bSel ); m_pTPView->EnableReject( bEnable && bIsNotFormated && bSel ); - m_pTPView->EnableAcceptAll( bEnable && !m_bHasReadonlySel ); - m_pTPView->EnableRejectAll( bEnable && !m_bHasReadonlySel && + m_pTPView->EnableAcceptAll( bEnable ); + m_pTPView->EnableRejectAll( bEnable && !m_bOnlyFormatedRedlines ); } @@ -1008,7 +1006,7 @@ IMPL_LINK_NOARG_TYPED(SwRedlineAcceptDlg, GotoHdl, Timer *, void) bool bEnable = !pSh->getIDocumentRedlineAccess().GetRedlinePassword().getLength(); m_pTPView->EnableAccept( bEnable && bSel /*&& !bReadonlySel*/ ); m_pTPView->EnableReject( bEnable && bSel && bIsNotFormated /*&& !bReadonlySel*/ ); - m_pTPView->EnableRejectAll( bEnable && !m_bOnlyFormatedRedlines && !m_bHasReadonlySel ); + m_pTPView->EnableRejectAll( bEnable && !m_bOnlyFormatedRedlines ); } IMPL_LINK_NOARG_TYPED(SwRedlineAcceptDlg, CommandHdl, SvSimpleTable*, void) diff --git a/sw/source/uibase/table/tablemgr.cxx b/sw/source/uibase/table/tablemgr.cxx index a82738dce1db..e9fb41e674d5 100644 --- a/sw/source/uibase/table/tablemgr.cxx +++ b/sw/source/uibase/table/tablemgr.cxx @@ -168,18 +168,12 @@ void SwTableFUNC::InitTabCols() SwTableFUNC::SwTableFUNC(SwWrtShell *pShell) : pFormat(pShell->GetTableFormat()), - pSh(pShell), - bCopy(false) + pSh(pShell) { - // if applicable copy the format for edit - if( pFormat && bCopy ) - pFormat = new SwFrameFormat( *pFormat ); } SwTableFUNC::~SwTableFUNC() { - if(bCopy) - delete pFormat; } void SwTableFUNC::UpdateChart() diff --git a/sw/source/uibase/uno/unomod.cxx b/sw/source/uibase/uno/unomod.cxx index c6486853568b..0248099f1ab9 100644 --- a/sw/source/uibase/uno/unomod.cxx +++ b/sw/source/uibase/uno/unomod.cxx @@ -541,7 +541,6 @@ SwXViewSettings::SwXViewSettings(SwView* pVw) , mpViewOption(nullptr) , mpConstViewOption(nullptr) , bObjectValid(true) - , bWeb(false) , mbApplyZoom(false) , eHRulerUnit(FUNIT_CM) , mbApplyHRulerMetric(false) @@ -573,7 +572,7 @@ void SwXViewSettings::_preSetValues () pVOpt = pView->GetWrtShell().GetViewOptions(); } else - pVOpt = SW_MOD()->GetViewOption(bWeb); + pVOpt = SW_MOD()->GetViewOption(false); mpViewOption = new SwViewOption (*pVOpt); mbApplyZoom = false; @@ -804,14 +803,13 @@ void SwXViewSettings::_postSetValues() else { if(mbApplyHRulerMetric) - SW_MOD()->ApplyRulerMetric( (FieldUnit)eHRulerUnit, true, bWeb ); + SW_MOD()->ApplyRulerMetric( (FieldUnit)eHRulerUnit, true, false ); if(mbApplyVRulerMetric) - SW_MOD()->ApplyRulerMetric( (FieldUnit)eVRulerUnit, false, bWeb ); + SW_MOD()->ApplyRulerMetric( (FieldUnit)eVRulerUnit, false, false ); } SW_MOD()->ApplyUsrPref( *mpViewOption, pView, pView ? SvViewOpt::DestViewOnly - : bWeb ? SvViewOpt::DestWeb - : SvViewOpt::DestText ); + : SvViewOpt::DestText ); delete mpViewOption; mpViewOption = nullptr; @@ -829,7 +827,7 @@ void SwXViewSettings::_preGetValues () mpConstViewOption = pView->GetWrtShell().GetViewOptions(); } else - mpConstViewOption = SW_MOD()->GetViewOption(bWeb); + mpConstViewOption = SW_MOD()->GetViewOption(false); } void SwXViewSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, uno::Any & rValue ) @@ -948,7 +946,7 @@ void SwXViewSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, u } else { - const SwMasterUsrPref* pUsrPref = SW_MOD()->GetUsrPref( bWeb ); + const SwMasterUsrPref* pUsrPref = SW_MOD()->GetUsrPref( false ); rValue <<= (sal_Int32)pUsrPref->GetHScrollMetric(); } bBool = false; @@ -964,7 +962,7 @@ void SwXViewSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, u } else { - const SwMasterUsrPref* pUsrPref = SW_MOD()->GetUsrPref( bWeb ); + const SwMasterUsrPref* pUsrPref = SW_MOD()->GetUsrPref( false ); rValue <<= (sal_Int32)pUsrPref->GetVScrollMetric(); } bBool = false; diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index fa3c723f198b..abe568f5ce76 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -197,10 +197,7 @@ bool SwContent::IsProtect() const bool SwPostItContent::IsProtect() const { - if (mbPostIt) - return pField->IsProtect(); - else - return false; + return pField->IsProtect(); } bool SwURLFieldContent::IsProtect() const @@ -3159,18 +3156,12 @@ void SwContentTree::EditEntry(SvTreeListEntry* pEntry, EditEntryMode nMode) m_pActiveShell->GetView().GetPostItMgr()->AssureStdModeAtShell(); if(nMode == EditEntryMode::DELETE) { - if (static_cast<SwPostItContent*>(pCnt)->IsPostIt()) - { - m_pActiveShell->GetView().GetPostItMgr()->SetActiveSidebarWin(nullptr); - m_pActiveShell->DelRight(); - } + m_pActiveShell->GetView().GetPostItMgr()->SetActiveSidebarWin(nullptr); + m_pActiveShell->DelRight(); } else { - if (static_cast<SwPostItContent*>(pCnt)->IsPostIt()) - nSlot = FN_POSTIT; - else - nSlot = FN_REDLINE_COMMENT; + nSlot = FN_POSTIT; } break; case ContentTypeId::INDEX: @@ -3314,12 +3305,7 @@ void SwContentTree::GotoContent(SwContent* pCnt) break; case ContentTypeId::POSTIT: m_pActiveShell->GetView().GetPostItMgr()->AssureStdModeAtShell(); - if (static_cast<SwPostItContent*>(pCnt)->IsPostIt()) - m_pActiveShell->GotoFormatField(*static_cast<SwPostItContent*>(pCnt)->GetPostIt()); - else - m_pActiveShell->GetView().GetDocShell()->GetWrtShell()->GotoRedline( - m_pActiveShell->GetView().GetDocShell()->GetWrtShell()->FindRedlineOfData(static_cast<SwPostItContent*>(pCnt)->GetRedline()->GetRedlineData())); - + m_pActiveShell->GotoFormatField(*static_cast<SwPostItContent*>(pCnt)->GetPostIt()); break; case ContentTypeId::DRAWOBJECT: { |