[Libreoffice-commits] core.git: sd/source

Noel (via logerrit) logerrit at kemper.freedesktop.org
Wed Sep 30 13:26:18 UTC 2020


 sd/source/core/stlpool.cxx                                    |    3 -
 sd/source/filter/eppt/epptso.cxx                              |    2 -
 sd/source/filter/eppt/pptx-animations.cxx                     |    2 -
 sd/source/filter/html/htmlex.cxx                              |    6 +--
 sd/source/filter/ppt/pptin.cxx                                |    3 +
 sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx     |    2 -
 sd/source/ui/annotations/annotationmanager.cxx                |    5 +-
 sd/source/ui/dlg/tpaction.cxx                                 |    4 --
 sd/source/ui/func/fupoor.cxx                                  |    2 -
 sd/source/ui/func/fusldlg.cxx                                 |    3 -
 sd/source/ui/func/futempl.cxx                                 |    2 -
 sd/source/ui/sidebar/MasterPageContainerProviders.cxx         |    3 -
 sd/source/ui/slidesorter/controller/SlideSorterController.cxx |    3 -
 sd/source/ui/slidesorter/controller/SlsSlotManager.cxx        |   17 +++-------
 sd/source/ui/unoidl/unomodel.cxx                              |    3 -
 sd/source/ui/unoidl/unosrch.cxx                               |    4 --
 sd/source/ui/view/drtxtob.cxx                                 |    2 -
 sd/source/ui/view/drviews2.cxx                                |    3 -
 sd/source/ui/view/drviewse.cxx                                |    2 -
 sd/source/ui/view/outlnvsh.cxx                                |    7 +---
 sd/source/ui/view/sdview.cxx                                  |    4 +-
 sd/source/ui/view/sdview2.cxx                                 |    2 -
 sd/source/ui/view/viewshe2.cxx                                |    3 -
 23 files changed, 34 insertions(+), 53 deletions(-)

New commits:
commit e4c8e666541a058dc9ca3c17029eb629bd7cf100
Author:     Noel <noelgrandin at gmail.com>
AuthorDate: Wed Sep 30 12:08:56 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Sep 30 15:22:38 2020 +0200

    loplugin:reducevarscope in sd
    
    Change-Id: Ia4a62900536ea49583cc00853ff937fae35c2d7a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103679
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx
index 2419eaa354f9..a31e28461f3c 100644
--- a/sd/source/core/stlpool.cxx
+++ b/sd/source/core/stlpool.cxx
@@ -927,7 +927,6 @@ void SdStyleSheetPool::UpdateStdNames()
             SfxStyleFamily eFam = pStyle->GetFamily();
 
             bool bHelpKnown = true;
-            OUString aNewName;
             const char* pNameId = nullptr;
             switch( nHelpId )
             {
@@ -985,9 +984,9 @@ void SdStyleSheetPool::UpdateStdNames()
             }
             if( bHelpKnown )
             {
+                OUString aNewName;
                 if (pNameId)
                 {
-                    aNewName = SdResId(pNameId);
                     if (strcmp(pNameId, STR_PSEUDOSHEET_OUTLINE) == 0)
                     {
                         aNewName += " " + OUString::number( sal_Int32( nHelpId - HID_PSEUDOSHEET_OUTLINE ) );
diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx
index 84a5178503fb..8f767df2e581 100644
--- a/sd/source/filter/eppt/epptso.cxx
+++ b/sd/source/filter/eppt/epptso.cxx
@@ -1693,11 +1693,11 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
                 bool bIsFontwork = false;
                 bool bIsHatching = false;
                 css::uno::Any aAny;
-                css::drawing::FillStyle eFS;
                 if ( GetPropertyValue( aAny, mXPropSet, "IsFontwork", true ) )
                     aAny >>= bIsFontwork;
                 if ( GetPropertyValue( aAny, mXPropSet, "FillStyle", true ) )
                 {
+                    css::drawing::FillStyle eFS;
                     aAny >>= eFS;
                     bIsHatching = eFS == css::drawing::FillStyle_HATCH;
                 }
diff --git a/sd/source/filter/eppt/pptx-animations.cxx b/sd/source/filter/eppt/pptx-animations.cxx
index 53d2ce888686..bc36afb1283a 100644
--- a/sd/source/filter/eppt/pptx-animations.cxx
+++ b/sd/source/filter/eppt/pptx-animations.cxx
@@ -761,9 +761,9 @@ void PPTXAnimationExport::WriteAnimationCondList(const Any& rAny, sal_Int32 nTok
 
 void PPTXAnimationExport::WriteAnimationCond(const Cond& rCond)
 {
-    sal_Int32 nId = -1;
     if (rCond.mpEvent)
     {
+        sal_Int32 nId = -1;
         if (rCond.mxShape.is())
         {
             mpFS->startElementNS(XML_p, XML_cond, XML_delay, rCond.getDelay(), XML_evt,
diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx
index 406fbf2eb1d1..83618fe199d3 100644
--- a/sd/source/filter/html/htmlex.cxx
+++ b/sd/source/filter/html/htmlex.cxx
@@ -1706,12 +1706,11 @@ bool HtmlExport::CreateHtmlForPresPages()
                         // corresponding names of the html file
                         bool        bIsMasterPage;
                         sal_uInt16  nPgNum = mpDoc->GetPageByName( aURL, bIsMasterPage );
-                        SdrObject*  pObj = nullptr;
 
                         if (nPgNum == SDRPAGE_NOTFOUND)
                         {
                             // is the bookmark an object?
-                            pObj = mpDoc->GetObj( aURL );
+                            SdrObject* pObj = mpDoc->GetObj( aURL );
                             if (pObj)
                                 nPgNum = pObj->getSdrPageFromSdrObject()->GetPageNum();
                         }
@@ -1792,12 +1791,11 @@ bool HtmlExport::CreateHtmlForPresPages()
                         {
                             bool        bIsMasterPage;
                             sal_uInt16  nPgNum = mpDoc->GetPageByName( pInfo->GetBookmark(), bIsMasterPage );
-                            SdrObject*  pObj = nullptr;
 
                             if( nPgNum == SDRPAGE_NOTFOUND )
                             {
                                 // is the bookmark an object?
-                                pObj = mpDoc->GetObj(pInfo->GetBookmark());
+                                SdrObject* pObj = mpDoc->GetObj(pInfo->GetBookmark());
                                 if (pObj)
                                     nPgNum = pObj->getSdrPageFromSdrObject()->GetPageNum();
                             }
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index eaf8fa476d41..d648cb4aa1ac 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -250,7 +250,7 @@ bool ImplSdPPTImport::Import()
     {
         PropItem aPropItem;
 
-        sal_uInt32 nType, nPropSize, nPropCount;
+        sal_uInt32 nType, nPropCount;
 
         pDInfoSec2->Read();
 
@@ -373,6 +373,7 @@ bool ImplSdPPTImport::Import()
                             aPropItem.ReadUInt32( nType );
                             if ( nType == VT_BLOB )
                             {
+                                sal_uInt32 nPropSize;
                                 aPropItem.ReadUInt32( nPropSize )
                                          .ReadUInt32( nPropCount );
 
diff --git a/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx b/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx
index 859641ddb328..92ac8bdf1c0c 100644
--- a/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx
+++ b/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx
@@ -741,11 +741,11 @@ uno::Any SAL_CALL AccessibleDocumentViewBase::getExtendedAttributes()
     }
     if (dynamic_cast<const ::sd::OutlineViewShell* >(mpViewShell ) !=  nullptr )
     {
-        OUString sDisplay;
         SdPage* pCurrPge = mpViewShell->GetActualPage();
         SdDrawDocument* pDoc = mpViewShell->GetDoc();
         if(pCurrPge && pDoc)
         {
+            OUString sDisplay;
             sDisplay = pCurrPge->GetName();
             sDisplay = sDisplay.replaceFirst( "=", "\\=" );
             sDisplay = sDisplay.replaceFirst( ";", "\\;" );
diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx
index 80f6fba904c4..b1c21ec8eef9 100644
--- a/sd/source/ui/annotations/annotationmanager.cxx
+++ b/sd/source/ui/annotations/annotationmanager.cxx
@@ -389,7 +389,6 @@ void AnnotationManagerImpl::ExecuteEditAnnotation(SfxRequest const & rReq)
 {
     const SfxItemSet* pArgs = rReq.GetArgs();
     Reference< XAnnotation > xAnnotation;
-    sal_uInt32 nId = 0;
     OUString sText;
     sal_Int32 nPositionX = -1;
     sal_Int32 nPositionY = -1;
@@ -403,7 +402,7 @@ void AnnotationManagerImpl::ExecuteEditAnnotation(SfxRequest const & rReq)
     const SfxPoolItem* pPoolItem = nullptr;
     if (SfxItemState::SET == pArgs->GetItemState(SID_ATTR_POSTIT_ID, true, &pPoolItem))
     {
-        nId = static_cast<const SvxPostItIdItem*>(pPoolItem)->GetValue().toUInt32();
+        sal_uInt32 nId = static_cast<const SvxPostItIdItem*>(pPoolItem)->GetValue().toUInt32();
         xAnnotation = GetAnnotationById(nId);
     }
     if (SfxItemState::SET == pArgs->GetItemState(SID_ATTR_POSTIT_TEXT, true, &pPoolItem))
@@ -540,13 +539,13 @@ void AnnotationManagerImpl::ExecuteReplyToAnnotation( SfxRequest const & rReq )
 {
     Reference< XAnnotation > xAnnotation;
     const SfxItemSet* pArgs = rReq.GetArgs();
-    sal_uInt32 nReplyId = 0; // Id of the comment to reply to
     OUString sReplyText;
     if( pArgs )
     {
         const SfxPoolItem*  pPoolItem = nullptr;
         if( SfxItemState::SET == pArgs->GetItemState( SID_ATTR_POSTIT_ID, true, &pPoolItem ) )
         {
+            sal_uInt32 nReplyId = 0; // Id of the comment to reply to
             nReplyId = static_cast<const SvxPostItIdItem*>(pPoolItem)->GetValue().toUInt32();
             xAnnotation = GetAnnotationById(nReplyId);
         }
diff --git a/sd/source/ui/dlg/tpaction.cxx b/sd/source/ui/dlg/tpaction.cxx
index f4f2430e6cfc..335930cb3ff2 100644
--- a/sd/source/ui/dlg/tpaction.cxx
+++ b/sd/source/ui/dlg/tpaction.cxx
@@ -161,12 +161,10 @@ void SdTPAction::Construct()
     if ( mpView->AreObjectsMarked() )
     {
         const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
-        SdrObject* pObj;
-
         if (rMarkList.GetMarkCount() == 1)
         {
             SdrMark* pMark = rMarkList.GetMark(0);
-            pObj = pMark->GetMarkedSdrObj();
+            SdrObject* pObj = pMark->GetMarkedSdrObj();
 
             SdrInventor nInv        = pObj->GetObjInventor();
             sal_uInt16  nSdrObjKind = pObj->GetObjIdentifier();
diff --git a/sd/source/ui/func/fupoor.cxx b/sd/source/ui/func/fupoor.cxx
index aa76f72ff3e7..d3ceffea98e7 100644
--- a/sd/source/ui/func/fupoor.cxx
+++ b/sd/source/ui/func/fupoor.cxx
@@ -913,10 +913,10 @@ void FuPoor::DoPasteUnformatted()
 {
     if (mpView)
     {
-        sal_Int8 nAction = DND_ACTION_COPY;
         TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( mpViewShell->GetActiveWindow() ) );
         if (aDataHelper.GetTransferable().is())
         {
+            sal_Int8 nAction = DND_ACTION_COPY;
             mpView->InsertData( aDataHelper,
                                 mpWindow->PixelToLogic( ::tools::Rectangle( Point(), mpWindow->GetOutputSizePixel() ).Center() ),
                                 nAction, false, SotClipboardFormatId::STRING);
diff --git a/sd/source/ui/func/fusldlg.cxx b/sd/source/ui/func/fusldlg.cxx
index 8f522d8cdcb6..5722eb3798d9 100644
--- a/sd/source/ui/func/fusldlg.cxx
+++ b/sd/source/ui/func/fusldlg.cxx
@@ -111,7 +111,6 @@ void FuSlideShowDlg::DoExecute( SfxRequest& )
     if( pDlg->Execute() != RET_OK )
         return;
 
-    OUString aPage;
     long    nValue32;
     bool    bValue;
     bool    bValuesChanged = false;
@@ -129,7 +128,7 @@ void FuSlideShowDlg::DoExecute( SfxRequest& )
 
     if (!rPresentationSettings.mbAll)
     {
-        aPage = ITEMVALUE( aDlgSet, ATTR_PRESENT_DIANAME, SfxStringItem );
+        OUString aPage = ITEMVALUE( aDlgSet, ATTR_PRESENT_DIANAME, SfxStringItem );
         if( aPage != rPresentationSettings.maPresPage )
         {
             bValuesChanged = true;
diff --git a/sd/source/ui/func/futempl.cxx b/sd/source/ui/func/futempl.cxx
index 14f9e3c32955..aeb9251e3002 100644
--- a/sd/source/ui/func/futempl.cxx
+++ b/sd/source/ui/func/futempl.cxx
@@ -295,7 +295,6 @@ void FuTemplate::DoExecute( SfxRequest& rReq )
                 ScopedVclPtr<SfxAbstractTabDialog> pStdDlg;
                 ScopedVclPtr<SfxAbstractTabDialog> pPresDlg;
                 SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
-                bool bOldDocInOtherLanguage = false;
 
                 SfxStyleFamily eFamily = pStyleSheet->GetFamily();
 
@@ -307,6 +306,7 @@ void FuTemplate::DoExecute( SfxRequest& rReq )
                 {
                     OUString aName(pStyleSheet->GetName());
                     bool bBackground = false;
+                    bool bOldDocInOtherLanguage = false;
 
                     if (aName == SdResId(STR_PSEUDOSHEET_TITLE))
                     {
diff --git a/sd/source/ui/sidebar/MasterPageContainerProviders.cxx b/sd/source/ui/sidebar/MasterPageContainerProviders.cxx
index 9bfbdcd0a470..b935673695c0 100644
--- a/sd/source/ui/sidebar/MasterPageContainerProviders.cxx
+++ b/sd/source/ui/sidebar/MasterPageContainerProviders.cxx
@@ -109,11 +109,10 @@ SdPage* TemplatePageObjectProvider::operator() (SdDrawDocument*)
     SdPage* pPage = nullptr;
 
     mxDocumentShell = nullptr;
-    ::sd::DrawDocShell* pDocumentShell = nullptr;
     try
     {
         // Load the template document and return its first page.
-        pDocumentShell = LoadDocument (msURL);
+        ::sd::DrawDocShell* pDocumentShell = LoadDocument (msURL);
         if (pDocumentShell != nullptr)
         {
             SdDrawDocument* pDocument = pDocumentShell->GetDoc();
diff --git a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
index 2588124b867c..47e033bf80a2 100644
--- a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
+++ b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
@@ -749,13 +749,12 @@ void SlideSorterController::PrepareEditModeChange()
 
 void SlideSorterController::ChangeEditMode (EditMode eEditMode)
 {
-    bool bResult (false);
     if (mrModel.GetEditMode() != eEditMode)
     {
         ModelChangeLock aLock (*this);
         PreModelChange();
         // Do the actual edit mode switching.
-        bResult = mrModel.SetEditMode(eEditMode);
+        bool bResult = mrModel.SetEditMode(eEditMode);
         if (bResult)
             HandleModelChange();
     }
diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
index bb8814fb6fa7..91deb290441f 100644
--- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
@@ -826,13 +826,7 @@ void SlotManager::GetStatusBarState (SfxItemSet& rSet)
 {
     // page view and layout
     SdPage* pPage      = nullptr;
-    SdPage* pFirstPage = nullptr;
-    sal_uInt16 nFirstPage;
-    sal_Int32 nPageCount;
-    sal_Int32 nActivePageCount;
     sal_uInt16 nSelectedPages = mrSlideSorter.GetController().GetPageSelector().GetSelectedPageCount();
-    OUString aPageStr;
-    OUString aLayoutStr;
 
     //Set number of slides
     if (nSelectedPages > 0)
@@ -841,12 +835,13 @@ void SlotManager::GetStatusBarState (SfxItemSet& rSet)
             model::PageEnumerationProvider::CreateSelectedPagesEnumeration(
                 mrSlideSorter.GetModel()));
         model::SharedPageDescriptor pDescriptor (aSelectedPages.GetNextElement());
+        OUString aPageStr;
         if (pDescriptor)
         {
             pPage = pDescriptor->GetPage();
-            nFirstPage = (pPage->GetPageNum()/2) + 1;
-            nPageCount = mrSlideSorter.GetModel().GetPageCount();
-            nActivePageCount = static_cast<sal_Int32>(mrSlideSorter.GetModel().GetDocument()->GetActiveSdPageCount());
+            sal_uInt16 nFirstPage = (pPage->GetPageNum()/2) + 1;
+            sal_Int32 nPageCount = mrSlideSorter.GetModel().GetPageCount();
+            sal_Int32 nActivePageCount = static_cast<sal_Int32>(mrSlideSorter.GetModel().GetDocument()->GetActiveSdPageCount());
 
             aPageStr = (nPageCount == nActivePageCount) ? SdResId(STR_SD_PAGE_COUNT) : SdResId(STR_SD_PAGE_COUNT_CUSTOM);
 
@@ -860,8 +855,8 @@ void SlotManager::GetStatusBarState (SfxItemSet& rSet)
     //Set layout
     if (nSelectedPages == 1 && pPage != nullptr)
     {
-        pFirstPage = pPage;
-        aLayoutStr = pFirstPage->GetLayoutName();
+        SdPage* pFirstPage = pPage;
+        OUString aLayoutStr = pFirstPage->GetLayoutName();
         sal_Int32 nIndex = aLayoutStr.indexOf( SD_LT_SEPARATOR );
         if( nIndex != -1 )
             aLayoutStr = aLayoutStr.copy(0, nIndex);
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 88c134e9be5d..67871eaefdfd 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -1537,12 +1537,11 @@ static sal_Int32 ImplPDFGetBookmarkPage( const OUString& rBookmark, SdDrawDocume
     // is the bookmark a page ?
     bool        bIsMasterPage;
     sal_uInt16  nPgNum = rDoc.GetPageByName( aBookmark, bIsMasterPage );
-    SdrObject*  pObj = nullptr;
 
     if ( nPgNum == SDRPAGE_NOTFOUND )
     {
         // is the bookmark an object ?
-        pObj = rDoc.GetObj( aBookmark );
+        SdrObject* pObj = rDoc.GetObj( aBookmark );
         if (pObj)
             nPgNum = pObj->getSdrPageFromSdrObject()->GetPageNum();
     }
diff --git a/sd/source/ui/unoidl/unosrch.cxx b/sd/source/ui/unoidl/unosrch.cxx
index d4d7f1c67228..e23d2c26b5df 100644
--- a/sd/source/ui/unoidl/unosrch.cxx
+++ b/sd/source/ui/unoidl/unosrch.cxx
@@ -545,16 +545,14 @@ uno::Reference< text::XTextRange >  SdUnoSearchReplaceShape::Search( const uno::
         {
             ESelection aSelection( pConvertPara[nStartPos], pConvertPos[nStartPos],
                              pConvertPara[nEndPos], pConvertPos[nEndPos] );
-            SvxUnoTextRange *pRange;
 
             SvxUnoTextBase* pParent = comphelper::getUnoTunnelImplementation<SvxUnoTextBase>( xParent );
 
             if(pParent)
             {
-                pRange = new SvxUnoTextRange( *pParent );
+                SvxUnoTextRange *pRange = new SvxUnoTextRange( *pParent );
                 xFound = pRange;
                 pRange->SetSelection(aSelection);
-
             }
         }
         else
diff --git a/sd/source/ui/view/drtxtob.cxx b/sd/source/ui/view/drtxtob.cxx
index d010706ab7da..38caef16ae22 100644
--- a/sd/source/ui/view/drtxtob.cxx
+++ b/sd/source/ui/view/drtxtob.cxx
@@ -166,7 +166,6 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet )
             case SID_ATTR_CHAR_CASEMAP:
             {
                 sal_uInt16 stretchX = 100;
-                sal_uInt16 stretchY = 100;
                 SvxScriptSetItem aSetItem( nSlotId, GetPool() );
                 aSetItem.GetItemSet().Put( aAttrSet, false );
 
@@ -187,6 +186,7 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet )
                             mpViewShell->GetActiveWindow());
                     }
 
+                    sal_uInt16 stretchY = 100;
                     if( pOutliner )
                         pOutliner->GetGlobalCharStretching( stretchX, stretchY );
 
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 9c35ca4077f7..dd9eb1f75b19 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -549,7 +549,6 @@ public:
     void lcl_convertStringArguments(sal_uInt16 nSlot, std::unique_ptr<SfxItemSet>& pArgs)
     {
         Color aColor;
-        OUString sColor;
         const SfxPoolItem* pItem = nullptr;
 
         if (SfxItemState::SET == pArgs->GetItemState(SID_ATTR_LINE_WIDTH_ARG, false, &pItem))
@@ -564,7 +563,7 @@ public:
         }
         if (SfxItemState::SET == pArgs->GetItemState(SID_ATTR_COLOR_STR, false, &pItem))
         {
-            sColor = static_cast<const SfxStringItem*>(pItem)->GetValue();
+            OUString sColor = static_cast<const SfxStringItem*>(pItem)->GetValue();
 
             if (sColor == "transparent")
                 aColor = COL_TRANSPARENT;
diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx
index ad18b8b5ffea..efed98db327d 100644
--- a/sd/source/ui/view/drviewse.cxx
+++ b/sd/source/ui/view/drviewse.cxx
@@ -924,10 +924,10 @@ void DrawViewShell::FuSupport(SfxRequest& rReq)
             }
             else if(mpDrawView)
             {
-                sal_Int8 nAction = DND_ACTION_COPY;
                 TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( GetActiveWindow() ) );
                 if (aDataHelper.GetTransferable().is())
                 {
+                    sal_Int8 nAction = DND_ACTION_COPY;
                     mpDrawView->InsertData( aDataHelper,
                                             GetActiveWindow()->PixelToLogic( ::tools::Rectangle( Point(), GetActiveWindow()->GetOutputSizePixel() ).Center() ),
                                             nAction, false, SotClipboardFormatId::STRING);
diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx
index 2c7dcdfdba83..c62380fde3de 100644
--- a/sd/source/ui/view/outlnvsh.cxx
+++ b/sd/source/ui/view/outlnvsh.cxx
@@ -489,10 +489,10 @@ void OutlineViewShell::FuSupport(SfxRequest &rReq)
             }
             else if(pOlView)
             {
-                sal_Int8 nAction = DND_ACTION_COPY;
                 TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( GetActiveWindow() ) );
                 if (aDataHelper.GetTransferable().is())
                 {
+                    sal_Int8 nAction = DND_ACTION_COPY;
                     pOlView->InsertData( aDataHelper,
                                          GetActiveWindow()->PixelToLogic( ::tools::Rectangle( Point(), GetActiveWindow()->GetOutputSizePixel() ).Center() ),
                                          nAction, false, SotClipboardFormatId::STRING);
@@ -1568,10 +1568,10 @@ void OutlineViewShell::UpdateTitleObject( SdPage* pPage, Paragraph const * pPara
 
     OUString aTest = rOutliner.GetText(pPara);
     bool    bText = !aTest.isEmpty();
-    bool    bNewObject = false;
 
     if( bText )
     {
+        bool    bNewObject = false;
         // create a title object if we don't have one but have text
         if( !pTO )
         {
@@ -1647,8 +1647,6 @@ void OutlineViewShell::UpdateOutlineObject( SdPage* pPage, Paragraph* pPara )
     std::unique_ptr<OutlinerParaObject> pOPO;
     SdrTextObj*         pTO  = nullptr;
 
-    bool bNewObject = false;
-
     OutlinerMode eOutlinerMode = OutlinerMode::TitleObject;
     pTO = static_cast<SdrTextObj*>(pPage->GetPresObj( PresObjKind::Text ));
     if( !pTO )
@@ -1676,6 +1674,7 @@ void OutlineViewShell::UpdateOutlineObject( SdPage* pPage, Paragraph* pPara )
     if( pOPO )
     {
         DBG_ASSERT( pOlView->isRecordingUndo(), "sd::OutlineViewShell::UpdateOutlineObject(), no undo for model change!?" );
+        bool bNewObject = false;
 
         // do we need an outline text object?
         if( !pTO )
diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx
index 28e163e5bebc..5a2a0be72ce7 100644
--- a/sd/source/ui/view/sdview.cxx
+++ b/sd/source/ui/view/sdview.cxx
@@ -1008,12 +1008,12 @@ void View::onAccessibilityOptionsChanged()
 
     const StyleSettings& rStyleSettings = pWindow->GetSettings().GetStyleSettings();
 
-    sal_uInt16 nOutputSlot, nPreviewSlot;
-
     SvtAccessibilityOptions& aAccOptions = getAccessibilityOptions();
 
     if( mpViewSh->GetViewFrame() && mpViewSh->GetViewFrame()->GetDispatcher() )
     {
+        sal_uInt16 nOutputSlot, nPreviewSlot;
+
         if( rStyleSettings.GetHighContrastMode() )
         {
             nOutputSlot = SID_OUTPUT_QUALITY_CONTRAST;
diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx
index 62704f1b8fdc..cbe8281af0eb 100644
--- a/sd/source/ui/view/sdview2.cxx
+++ b/sd/source/ui/view/sdview2.cxx
@@ -307,12 +307,12 @@ void View::DoPaste (::sd::Window* pWindow)
     }
     else
     {
-        sal_Int8    nDnDAction = DND_ACTION_COPY;
         Point aPos = pWindow->GetVisibleCenter();
         DrawViewShell* pDrViewSh = static_cast<DrawViewShell*>( mpDocSh->GetViewShell() );
 
         if (pDrViewSh != nullptr)
         {
+            sal_Int8    nDnDAction = DND_ACTION_COPY;
             if( !InsertData( aDataHelper, aPos, nDnDAction, false ) )
             {
                 INetBookmark    aINetBookmark( "", "" );
diff --git a/sd/source/ui/view/viewshe2.cxx b/sd/source/ui/view/viewshe2.cxx
index 47ac53f680c0..4e1ebe7321ad 100644
--- a/sd/source/ui/view/viewshe2.cxx
+++ b/sd/source/ui/view/viewshe2.cxx
@@ -637,13 +637,12 @@ bool ViewShell::ActivateObject(SdrOle2Obj* pObj, long nVerb)
     SfxViewShell* pViewShell = GetViewShell();
     OSL_ASSERT (pViewShell!=nullptr);
     bool bChangeDefaultsForChart = false;
-    OUString aName;
 
     uno::Reference < embed::XEmbeddedObject > xObj = pObj->GetObjRef();
     if ( !xObj.is() )
     {
         // provide OLE object to empty OLE object
-        aName = pObj->GetProgName();
+        OUString aName = pObj->GetProgName();
         OUString aObjName;
         SvGlobalName aClass;
 


More information about the Libreoffice-commits mailing list