[Libreoffice-commits] core.git: compilerplugins/clang editeng/source sc/source sd/source sfx2/source svx/source sw/source

Noel Grandin noel.grandin at collabora.co.uk
Tue Jan 24 11:20:15 UTC 2017


 compilerplugins/clang/unusedvariablecheck.cxx       |   14 +++++++++-----
 editeng/source/editeng/eehtml.cxx                   |    4 ++--
 sc/source/ui/miscdlgs/autofmt.cxx                   |    1 -
 sc/source/ui/vba/vbaapplication.cxx                 |    1 -
 sd/source/ui/dlg/tpoption.cxx                       |    3 ---
 sfx2/source/dialog/mgetempl.cxx                     |    1 -
 svx/source/sidebar/possize/PosSizePropertyPanel.cxx |    8 --------
 sw/source/core/doc/docfly.cxx                       |    2 --
 sw/source/core/undo/SwUndoPageDesc.cxx              |    6 ++++++
 sw/source/filter/html/svxcss1.cxx                   |    1 -
 sw/source/ui/chrdlg/numpara.cxx                     |    1 -
 sw/source/ui/dbui/mmresultdialogs.cxx               |    2 --
 sw/source/uibase/shells/tabsh.cxx                   |    1 -
 sw/source/uibase/shells/textsh1.cxx                 |    3 ---
 14 files changed, 17 insertions(+), 31 deletions(-)

New commits:
commit fe2164949b38a7f73883dbdcb3271b94e5c81744
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Tue Jan 24 13:19:04 2017 +0200

    teach unusedvariablecheck plugin about SfxPoolItem subclasses
    
    which can all be treated as SAL_WARN_UNUSED
    
    The eehtml.cxx change probably fixes some CJK/CTL bug somewhere
    
    Change-Id: I6852129540f316075aee907971ac19418d71dd9a

diff --git a/compilerplugins/clang/unusedvariablecheck.cxx b/compilerplugins/clang/unusedvariablecheck.cxx
index 8642032..db6a45e 100644
--- a/compilerplugins/clang/unusedvariablecheck.cxx
+++ b/compilerplugins/clang/unusedvariablecheck.cxx
@@ -49,7 +49,7 @@ void UnusedVariableCheck::run()
     TraverseDecl( compiler.getASTContext().getTranslationUnitDecl());
     }
 
-bool BaseCheckNotDialogSubclass(
+bool BaseCheckNotSomethingInterestingSubclass(
     const CXXRecordDecl *BaseDefinition
 #if CLANG_VERSION < 30800
     , void *
@@ -59,21 +59,26 @@ bool BaseCheckNotDialogSubclass(
     if (BaseDefinition && BaseDefinition->getQualifiedNameAsString().compare("Dialog") == 0) {
         return false;
     }
+    if (BaseDefinition && BaseDefinition->getQualifiedNameAsString().compare("SfxPoolItem") == 0) {
+        return false;
+    }
     return true;
 }
 
-bool isDerivedFromDialog(const CXXRecordDecl *decl) {
+bool isDerivedFromSomethingInteresting(const CXXRecordDecl *decl) {
     if (!decl)
         return false;
     if (decl->getQualifiedNameAsString() == "Dialog")
         return true;
+    if (decl->getQualifiedNameAsString() == "SfxPoolItem")
+        return true;
     if (!decl->hasDefinition()) {
         return false;
     }
     if (// not sure what hasAnyDependentBases() does,
         // but it avoids classes we don't want, e.g. WeakAggComponentImplHelper1
         !decl->hasAnyDependentBases() &&
-        !compat::forallBases(*decl, BaseCheckNotDialogSubclass, nullptr, true)) {
+        !compat::forallBases(*decl, BaseCheckNotSomethingInterestingSubclass, nullptr, true)) {
         return true;
     }
     return false;
@@ -114,8 +119,7 @@ bool UnusedVariableCheck::VisitVarDecl( const VarDecl* var )
                 || n == "std::list" || n == "std::__debug::list"
                 || n == "std::vector" || n == "std::__debug::vector" )
                 warn_unused = true;
-            // check if this field is derived from Dialog
-            if (!warn_unused && isDerivedFromDialog(type))
+            if (!warn_unused && isDerivedFromSomethingInteresting(type))
                   warn_unused = true;
             }
         if( warn_unused )
diff --git a/editeng/source/editeng/eehtml.cxx b/editeng/source/editeng/eehtml.cxx
index be16f03..f0f6cd3 100644
--- a/editeng/source/editeng/eehtml.cxx
+++ b/editeng/source/editeng/eehtml.cxx
@@ -598,10 +598,10 @@ void EditHTMLParser::ImpSetStyleSheet( sal_uInt16 nHLevel )
         aItems.Put( aWeightItem );
 
         SvxWeightItem aWeightItemCJK( WEIGHT_BOLD, EE_CHAR_WEIGHT_CJK );
-        aItems.Put( aWeightItem );
+        aItems.Put( aWeightItemCJK );
 
         SvxWeightItem aWeightItemCTL( WEIGHT_BOLD, EE_CHAR_WEIGHT_CTL );
-        aItems.Put( aWeightItem );
+        aItems.Put( aWeightItemCTL );
     }
 
     // Font hight and margins, when LogicToLogic is possible:
diff --git a/sc/source/ui/miscdlgs/autofmt.cxx b/sc/source/ui/miscdlgs/autofmt.cxx
index 4e7b9e4..d9f7219 100644
--- a/sc/source/ui/miscdlgs/autofmt.cxx
+++ b/sc/source/ui/miscdlgs/autofmt.cxx
@@ -254,7 +254,6 @@ void ScAutoFmtPreview::DrawString(vcl::RenderContext& rRenderContext, size_t nCo
         Point aPos = cellRect.TopLeft();
         sal_uInt16 nRightX = 0;
         bool bJustify = pCurData->GetIncludeJustify();
-        SvxHorJustifyItem aHorJustifyItem( SVX_HOR_JUSTIFY_STANDARD, ATTR_HOR_JUSTIFY );
         SvxCellHorJustify eJustification;
 
         SvtScriptedTextHelper aScriptedText(rRenderContext);
diff --git a/sc/source/ui/vba/vbaapplication.cxx b/sc/source/ui/vba/vbaapplication.cxx
index 4992084..a55a99c 100644
--- a/sc/source/ui/vba/vbaapplication.cxx
+++ b/sc/source/ui/vba/vbaapplication.cxx
@@ -1260,7 +1260,6 @@ ScVbaApplication::setDisplayFormulaBar( sal_Bool _displayformulabar )
     ScTabViewShell* pViewShell = excel::getCurrentBestViewShell( mxContext );
     if ( pViewShell && ( _displayformulabar !=  getDisplayFormulaBar() ) )
     {
-        SfxBoolItem sfxFormBar( FID_TOGGLEINPUTLINE, _displayformulabar);
         SfxAllItemSet reqList(  SfxGetpApp()->GetPool() );
         SfxRequest aReq( FID_TOGGLEINPUTLINE, SfxCallMode::SLOT, reqList );
         pViewShell->Execute( aReq );
diff --git a/sd/source/ui/dlg/tpoption.cxx b/sd/source/ui/dlg/tpoption.cxx
index 8ba8d68..a2cff38 100644
--- a/sd/source/ui/dlg/tpoption.cxx
+++ b/sd/source/ui/dlg/tpoption.cxx
@@ -158,9 +158,6 @@ bool SdTpOptionsContents::FillItemSet( SfxItemSet* rAttrs )
 
 void SdTpOptionsContents::Reset( const SfxItemSet* rAttrs )
 {
-    SdOptionsContentsItem aOptsItem( static_cast<const SdOptionsContentsItem&>( rAttrs->
-                        Get( ATTR_OPTIONS_CONTENTS ) ) );
-
     SdOptionsLayoutItem aLayoutItem( static_cast<const SdOptionsLayoutItem&>( rAttrs->
                         Get( ATTR_OPTIONS_LAYOUT ) ) );
 
diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx
index 523a476..0989f25 100644
--- a/sfx2/source/dialog/mgetempl.cxx
+++ b/sfx2/source/dialog/mgetempl.cxx
@@ -381,7 +381,6 @@ bool SfxManageStyleSheetPage::Execute_Impl(
     SfxStringItem aItem(nId, rStr);
     SfxUInt16Item aFamily(SID_STYLE_FAMILY, nFamily);
     SfxUInt16Item aMask( SID_STYLE_MASK, nMask );
-    SfxStringItem aUpdName(SID_STYLE_UPD_BY_EX_NAME, rStr);
     SfxStringItem aRefName( SID_STYLE_REFERENCE, rRefStr );
     const SfxPoolItem* pItems[ 6 ];
     sal_uInt16 nCount = 0;
diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
index 5861e13..a9346e8 100644
--- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
+++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
@@ -369,16 +369,12 @@ IMPL_LINK_NOARG( PosSizePropertyPanel, ChangePosXHdl, Edit&, void )
     if ( mpMtrPosX->IsValueModified())
     {
         long lX = GetCoreValue( *mpMtrPosX, mePoolUnit );
-        long lY = GetCoreValue( *mpMtrPosY, mePoolUnit );
 
         Fraction aUIScale = mpView->GetModel()->GetUIScale();
         lX += maAnchorPos.X();
         lX = Fraction( lX ) * aUIScale;
-        lY += maAnchorPos.Y();
-        lY = Fraction( lY ) * aUIScale;
 
         SfxInt32Item aPosXItem( SID_ATTR_TRANSFORM_POS_X,(sal_uInt32) lX);
-        SfxInt32Item aPosYItem( SID_ATTR_TRANSFORM_POS_Y,(sal_uInt32) lY);
 
         GetBindings()->GetDispatcher()->ExecuteList(
             SID_ATTR_TRANSFORM, SfxCallMode::RECORD, { &aPosXItem });
@@ -390,16 +386,12 @@ IMPL_LINK_NOARG( PosSizePropertyPanel, ChangePosYHdl, Edit&, void )
 {
     if ( mpMtrPosY->IsValueModified() )
     {
-        long lX = GetCoreValue( *mpMtrPosX, mePoolUnit );
         long lY = GetCoreValue( *mpMtrPosY, mePoolUnit );
 
         Fraction aUIScale = mpView->GetModel()->GetUIScale();
-        lX += maAnchorPos.X();
-        lX = Fraction( lX ) * aUIScale;
         lY += maAnchorPos.Y();
         lY = Fraction( lY ) * aUIScale;
 
-        SfxInt32Item aPosXItem( SID_ATTR_TRANSFORM_POS_X,(sal_uInt32) lX);
         SfxInt32Item aPosYItem( SID_ATTR_TRANSFORM_POS_Y,(sal_uInt32) lY);
 
         GetBindings()->GetDispatcher()->ExecuteList(
diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx
index 98ffdae..c89c636 100644
--- a/sw/source/core/doc/docfly.cxx
+++ b/sw/source/core/doc/docfly.cxx
@@ -629,8 +629,6 @@ bool SwDoc::SetFrameFormatToFly( SwFrameFormat& rFormat, SwFrameFormat& rNewForm
     bool bChgAnchor = false, bFrameSz = false;
 
     const SwFormatFrameSize aFrameSz( rFormat.GetFrameSize() );
-    const SwFormatVertOrient aVert( rFormat.GetVertOrient() );
-    const SwFormatHoriOrient aHori( rFormat.GetHoriOrient() );
 
     SwUndoSetFlyFormat* pUndo = nullptr;
     bool const bUndo = GetIDocumentUndoRedo().DoesUndo();
diff --git a/sw/source/core/undo/SwUndoPageDesc.cxx b/sw/source/core/undo/SwUndoPageDesc.cxx
index e8bdf8b..d1bb5bb 100644
--- a/sw/source/core/undo/SwUndoPageDesc.cxx
+++ b/sw/source/core/undo/SwUndoPageDesc.cxx
@@ -148,17 +148,20 @@ SwUndoPageDesc::SwUndoPageDesc(const SwPageDesc & _aOld,
             SwFrameFormat* pFormat = new SwFrameFormat( *rNewHead.GetHeaderFormat() );
             // The Ctor of this object will remove the duplicate!
             SwFormatHeader aFormatHeader(pFormat);
+            (void)aFormatHeader;
             if (!rNewDesc.IsHeaderShared())
             {
                 pFormat = new SwFrameFormat( *rNewDesc.GetLeft().GetHeader().GetHeaderFormat() );
                 // The Ctor of this object will remove the duplicate!
                 SwFormatHeader aLeftHeader(pFormat);
+                (void)aLeftHeader;
             }
             if (!rNewDesc.IsFirstShared())
             {
                 pFormat = new SwFrameFormat( *rNewDesc.GetFirstMaster().GetHeader().GetHeaderFormat() );
                 // The Ctor of this object will remove the duplicate!
                 SwFormatHeader aFirstHeader(pFormat);
+                (void)aFirstHeader;
             }
         }
         // Same procedure for footers...
@@ -167,17 +170,20 @@ SwUndoPageDesc::SwUndoPageDesc(const SwPageDesc & _aOld,
             SwFrameFormat* pFormat = new SwFrameFormat( *rNewFoot.GetFooterFormat() );
             // The Ctor of this object will remove the duplicate!
             SwFormatFooter aFormatFooter(pFormat);
+            (void)aFormatFooter;
             if (!rNewDesc.IsFooterShared())
             {
                 pFormat = new SwFrameFormat( *rNewDesc.GetLeft().GetFooter().GetFooterFormat() );
                 // The Ctor of this object will remove the duplicate!
                 SwFormatFooter aLeftFooter(pFormat);
+                (void)aLeftFooter;
             }
             if (!rNewDesc.IsFirstShared())
             {
                 pFormat = new SwFrameFormat( *rNewDesc.GetFirstMaster().GetFooter().GetFooterFormat() );
                 // The Ctor of this object will remove the duplicate!
                 SwFormatFooter aFirstFooter(pFormat);
+                (void)aFirstFooter;
             }
         }
 
diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx
index f94dabf..5373a5f 100644
--- a/sw/source/filter/html/svxcss1.cxx
+++ b/sw/source/filter/html/svxcss1.cxx
@@ -937,7 +937,6 @@ void SvxCSS1Parser::MergeStyles( const SfxItemSet& rSrcSet,
     {
         SvxLRSpaceItem aLRSpace( static_cast<const SvxLRSpaceItem&>(rTargetSet.Get(aItemIds.nLRSpace)) );
         SvxULSpaceItem aULSpace( static_cast<const SvxULSpaceItem&>(rTargetSet.Get(aItemIds.nULSpace)) );
-        SvxBoxItem aBox( static_cast<const SvxBoxItem&>(rTargetSet.Get(aItemIds.nBox)) );
 
         rTargetSet.Put( rSrcSet );
 
diff --git a/sw/source/ui/chrdlg/numpara.cxx b/sw/source/ui/chrdlg/numpara.cxx
index 487441c..8ccffeb 100644
--- a/sw/source/ui/chrdlg/numpara.cxx
+++ b/sw/source/ui/chrdlg/numpara.cxx
@@ -352,7 +352,6 @@ bool SwParagraphNumTabPage::ExecuteEditNumStyle_Impl(
     SfxStringItem aItem(nId, rStr);
     SfxUInt16Item aFamily(SID_STYLE_FAMILY, (sal_uInt16)nFamily);
     SfxUInt16Item aMask( SID_STYLE_MASK, nMask );
-    SfxStringItem aUpdName(SID_STYLE_UPD_BY_EX_NAME, rStr);
     SfxStringItem aRefName( SID_STYLE_REFERENCE, rRefStr );
     const SfxPoolItem* pItems[ 6 ];
     sal_uInt16 nCount = 0;
diff --git a/sw/source/ui/dbui/mmresultdialogs.cxx b/sw/source/ui/dbui/mmresultdialogs.cxx
index 2fa7ba3..53fb96f 100644
--- a/sw/source/ui/dbui/mmresultdialogs.cxx
+++ b/sw/source/ui/dbui/mmresultdialogs.cxx
@@ -841,7 +841,6 @@ IMPL_LINK(SwMMResultPrintDialog, PrintHdl_Impl, Button*, pButton, void)
 
     SfxObjectShell* pObjSh = pTargetView->GetViewFrame()->GetObjectShell();
     SfxGetpApp()->NotifyEvent(SfxEventHint(SfxEventHintId::SwMailMerge, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE), pObjSh));
-    SfxBoolItem aMergeSilent(SID_SILENT, false);
 
     uno::Sequence < beans::PropertyValue > aProps( 2 );
     aProps[0]. Name = "MonitorVisible";
@@ -1045,7 +1044,6 @@ IMPL_LINK(SwMMResultEmailDialog, SendDocumentsHdl_Impl, Button*, pButton, void)
         else
             return; // back to the dialog
     }
-    SfxStringItem aFilterName( SID_FILTER_NAME, pSfxFlt->GetFilterName() );
     OUString sEMailColumn = m_pMailToLB->GetSelectEntry();
     OSL_ENSURE( !sEMailColumn.isEmpty(), "No email column selected");
     Reference< sdbcx::XColumnsSupplier > xColsSupp( xConfigItem->GetResultSet(), UNO_QUERY);
diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx
index 8c63736..ce4ae64 100644
--- a/sw/source/uibase/shells/tabsh.cxx
+++ b/sw/source/uibase/shells/tabsh.cxx
@@ -224,7 +224,6 @@ static SwTableRep*  lcl_TableParamToItemSet( SfxItemSet& rSet, SwWrtShell &rSh )
 
     SwTabCols aTabCols;
     rSh.GetTabCols( aTabCols );
-    SvxColumnItem aColItem;
 
     // Pointer will be deleted after the dialogue execution.
     SwTableRep* pRep = new SwTableRep( aTabCols );
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index 350a7f1..43383e1 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -466,9 +466,6 @@ void SwTextShell::Execute(SfxRequest &rReq)
                 rWrtSh.Left( CRSR_SKIP_CHARS, true, 1, false );
                 SfxItemSet aSet( rWrtSh.GetAttrPool(), RES_CHRATR_FONT, RES_CHRATR_FONT );
                 rWrtSh.GetCurAttr( aSet );
-                const SvxFontItem &rFont = static_cast<const SvxFontItem &>( aSet.Get( RES_CHRATR_FONT ));
-                SvxFontItem aFont( rFont.GetFamily(), pFont->GetValue(),
-                                    rFont.GetStyleName(), rFont.GetPitch(), RTL_TEXTENCODING_DONTKNOW, RES_CHRATR_FONT );
                 rWrtSh.SetAttrSet( aSet, SetAttrMode::DONTEXPAND );
                 rWrtSh.ResetSelect(nullptr, false);
                 rWrtSh.EndSelect();


More information about the Libreoffice-commits mailing list