[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - 6 commits - include/sfx2 sd/sdi sd/source sfx2/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Dec 6 08:52:04 UTC 2018


 include/sfx2/viewsh.hxx                                                     |    3 
 sd/sdi/sdraw.sdi                                                            |    2 
 sd/source/ui/animations/CustomAnimationDialog.cxx                           |   26 +--
 sd/source/ui/animations/CustomAnimationDialog.hxx                           |    6 
 sd/source/ui/animations/CustomAnimationPane.cxx                             |   12 -
 sd/source/ui/animations/CustomAnimationPane.hxx                             |    2 
 sd/source/ui/framework/configuration/Configuration.cxx                      |   17 --
 sd/source/ui/framework/configuration/ConfigurationControllerBroadcaster.cxx |   11 -
 sd/source/ui/framework/tools/FrameworkHelper.cxx                            |   17 --
 sd/source/ui/func/fupage.cxx                                                |   68 +++++++---
 sd/source/ui/inc/framework/FrameworkHelper.hxx                              |    6 
 sd/source/ui/inc/fupage.hxx                                                 |    2 
 sd/source/ui/sidebar/MasterPageDescriptor.cxx                               |    1 
 sd/source/ui/sidebar/SlideBackground.cxx                                    |   10 +
 sd/source/ui/slidesorter/controller/SlsClipboard.cxx                        |   10 -
 sfx2/source/view/viewsh.cxx                                                 |    2 
 16 files changed, 109 insertions(+), 86 deletions(-)

New commits:
commit d581c7723550187f5185ccd22b8c42d34cab64b4
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Wed Sep 12 20:03:11 2018 -0400
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Thu Dec 6 09:08:16 2018 +0100

    sd: support inserting background image from file via .uno:SelectBackground
    
    The UNO command always prompted the user via file open dialog.
    This change allows for passing the filename as an argument
    to allow for inserting slide background programatically.
    
    Also, hide the Insert Image button in the sidebar
    since we can't use that (just yet), because
    it invokes .uno:SelectBackground directly. We would
    need to send LOOL a notification to invoke this on
    its own end to first prompt the user for a file.
    
    Change-Id: I20c0e33d66f8bcd72a6388e39c4ac92e64978f45
    (cherry picked from commit 2118143bdd246921439ba9e835207585203dd45f)

diff --git a/sd/sdi/sdraw.sdi b/sd/sdi/sdraw.sdi
index 5009acb6cf0c..f5d86d97aaa3 100644
--- a/sd/sdi/sdraw.sdi
+++ b/sd/sdi/sdraw.sdi
@@ -4024,7 +4024,7 @@ SfxVoidItem CloseMasterView SID_CLOSE_MASTER_VIEW()
 ]
 
 SfxVoidItem SelectBackground SID_SELECT_BACKGROUND
-()
+(SfxStringItem FileName SID_SELECT_BACKGROUND,SfxStringItem FilterName FN_PARAM_FILTER,SfxBoolItem AsLink FN_PARAM_1,SfxStringItem Style FN_PARAM_2)
 [
     AutoUpdate = FALSE,
     FastCall = FALSE,
diff --git a/sd/source/ui/func/fupage.cxx b/sd/source/ui/func/fupage.cxx
index 8f05c7b90727..155d8a3e5d86 100644
--- a/sd/source/ui/func/fupage.cxx
+++ b/sd/source/ui/func/fupage.cxx
@@ -125,7 +125,7 @@ rtl::Reference<FuPoor> FuPage::Create( ViewShell* pViewSh, ::sd::Window* pWin, :
     return xFunc;
 }
 
-void FuPage::DoExecute( SfxRequest& )
+void FuPage::DoExecute(SfxRequest& rReq)
 {
     mpDrawViewShell = dynamic_cast<DrawViewShell*>(mpViewShell);
     DBG_ASSERT( mpDrawViewShell, "sd::FuPage::FuPage(), called without a current DrawViewShell!" );
@@ -141,11 +141,12 @@ void FuPage::DoExecute( SfxRequest& )
 
     if( mpPage )
     {
-        // if there are no arguments given, open the dialog
-        if( !mpArgs )
+        // If there are no arguments given, open the dialog, or if we have SelectBackground params, process first.
+        const SfxPoolItem* pItem;
+        if (!mpArgs || mpArgs->GetItemState(SID_SELECT_BACKGROUND, true, &pItem) == SfxItemState::SET)
         {
             mpView->SdrEndTextEdit();
-            mpArgs = ExecuteDialog(mpWindow);
+            mpArgs = ExecuteDialog(mpWindow, rReq);
         }
 
         // if we now have arguments, apply them to current page
@@ -203,7 +204,7 @@ void MergePageBackgroundFilling(SdPage *pPage, SdStyleSheet *pStyleSheet, bool b
     }
 }
 
-const SfxItemSet* FuPage::ExecuteDialog( vcl::Window* pParent )
+const SfxItemSet* FuPage::ExecuteDialog(vcl::Window* pParent, SfxRequest& rReq)
 {
     if (!mpDrawViewShell)
         return nullptr;
@@ -302,27 +303,56 @@ const SfxItemSet* FuPage::ExecuteDialog( vcl::Window* pParent )
     }
     else if (nId == SID_SELECT_BACKGROUND)
     {
-        SvxOpenGraphicDialog aDlg(SdResId(STR_SET_BACKGROUND_PICTURE), pParent);
+        OUString aFileName;
+        OUString aFilterName;
+        Graphic aGraphic;
+        ErrCode nError = ERRCODE_GRFILTER_OPENERROR;
+        bool bAsLink = false;
 
-        if( aDlg.Execute() == ERRCODE_NONE )
+        const SfxItemSet* pArgs = rReq.GetArgs();
+        const SfxPoolItem* pItem;
+
+        if (pArgs && pArgs->GetItemState(SID_SELECT_BACKGROUND, true, &pItem) == SfxItemState::SET)
         {
-            Graphic     aGraphic;
-            ErrCode nError = aDlg.GetGraphic(aGraphic);
-            if( nError == ERRCODE_NONE )
-            {
-                pTempSet.reset( new SfxItemSet( mpDoc->GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{}) );
+            aFileName = static_cast<const SfxStringItem*>(pItem)->GetValue();
 
-                pTempSet->Put( XFillStyleItem( drawing::FillStyle_BITMAP ) );
+            if (pArgs->GetItemState(FN_PARAM_FILTER, true, &pItem) == SfxItemState::SET)
+                aFilterName = static_cast<const SfxStringItem*>(pItem)->GetValue();
 
-                // MigrateItemSet makes sure the XFillBitmapItem will have a unique name
-                SfxItemSet aMigrateSet( mpDoc->GetPool(), svl::Items<XATTR_FILLBITMAP, XATTR_FILLBITMAP>{} );
-                aMigrateSet.Put(XFillBitmapItem("background", aGraphic));
-                SdrModel::MigrateItemSet( &aMigrateSet, pTempSet.get(), mpDoc );
+            if (pArgs->GetItemState(FN_PARAM_1, true, &pItem) == SfxItemState::SET)
+                bAsLink = static_cast<const SfxBoolItem*>(pItem)->GetValue();
 
-                pTempSet->Put( XFillBmpStretchItem( true ));
-                pTempSet->Put( XFillBmpTileItem( false ));
+            nError = GraphicFilter::LoadGraphic(aFileName, aFilterName, aGraphic,
+                                                &GraphicFilter::GetGraphicFilter());
+        }
+        else
+        {
+            SvxOpenGraphicDialog aDlg(SdResId(STR_SET_BACKGROUND_PICTURE), pParent);
+
+            nError = aDlg.Execute();
+            if (nError != ERRCODE_NONE)
+            {
+                nError = aDlg.GetGraphic(aGraphic);
+                bAsLink = aDlg.IsAsLink();
+                aFileName = aDlg.GetPath();
+                aFilterName = aDlg.GetDetectedFilter();
             }
         }
+
+        if (nError == ERRCODE_NONE)
+        {
+            pTempSet.reset( new SfxItemSet( mpDoc->GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{}) );
+
+            pTempSet->Put( XFillStyleItem( drawing::FillStyle_BITMAP ) );
+
+            // MigrateItemSet makes sure the XFillBitmapItem will have a unique name
+            SfxItemSet aMigrateSet( mpDoc->GetPool(), svl::Items<XATTR_FILLBITMAP, XATTR_FILLBITMAP>{} );
+            aMigrateSet.Put(XFillBitmapItem("background", aGraphic));
+            SdrModel::MigrateItemSet( &aMigrateSet, pTempSet.get(), mpDoc );
+
+            pTempSet->Put( XFillBmpStretchItem( true ));
+            pTempSet->Put( XFillBmpTileItem( false ));
+        }
     }
 
     else
diff --git a/sd/source/ui/inc/fupage.hxx b/sd/source/ui/inc/fupage.hxx
index 03721ea41e2e..3a6526b7314a 100644
--- a/sd/source/ui/inc/fupage.hxx
+++ b/sd/source/ui/inc/fupage.hxx
@@ -41,7 +41,7 @@ class FuPage
     virtual void Activate() override;
     virtual void Deactivate() override;
 
-    const SfxItemSet* ExecuteDialog( vcl::Window* pParent );
+    const SfxItemSet* ExecuteDialog(vcl::Window* pParent, SfxRequest& rReq);
 
 protected:
     virtual ~FuPage() override;
diff --git a/sd/source/ui/sidebar/MasterPageDescriptor.cxx b/sd/source/ui/sidebar/MasterPageDescriptor.cxx
index 26e44eff0f7e..e84d0d2b58c9 100644
--- a/sd/source/ui/sidebar/MasterPageDescriptor.cxx
+++ b/sd/source/ui/sidebar/MasterPageDescriptor.cxx
@@ -229,6 +229,7 @@ bool MasterPageDescriptor::UpdatePreview (
         {
             pPage = mpMasterPage;
         }
+        //TODO: Notify LOOL of preview updates.
         maLargePreview = (*mpPreviewProvider)(
             rLargeSize.Width(),
             pPage,
diff --git a/sd/source/ui/sidebar/SlideBackground.cxx b/sd/source/ui/sidebar/SlideBackground.cxx
index c4f271487762..ead02f86eb4e 100644
--- a/sd/source/ui/sidebar/SlideBackground.cxx
+++ b/sd/source/ui/sidebar/SlideBackground.cxx
@@ -69,6 +69,7 @@
 #include <editeng/ulspitem.hxx>
 #include <editeng/lrspitem.hxx>
 #include <svl/itemset.hxx>
+#include <comphelper/lok.hxx>
 
 using namespace ::com::sun::star;
 
@@ -292,6 +293,15 @@ void SlideBackground::HandleContextChange(
             mpBackgroundLabel->Show();
             mpInsertImage->Hide();
         }
+
+        // The Insert Image button in the sidebar issues .uno:SelectBackground,
+        // which when invoked without arguments will open the file-open-dialog
+        // to prompt the user to select a file. This is useless in LOOL.
+        // Hide for now so the user will only be able to use the menu to insert
+        // background image, which prompts the user for file selection in the browser.
+        if (comphelper::LibreOfficeKit::isActive())
+            mpInsertImage->Hide();
+
         // Need to do a relayouting, otherwise the panel size is not updated after show / hide controls
         sfx2::sidebar::Panel* pPanel = dynamic_cast<sfx2::sidebar::Panel*>(GetParent());
         if(pPanel)
diff --git a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx
index b65926d52844..4e5ec9a259c6 100644
--- a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx
@@ -608,13 +608,9 @@ IMPL_LINK(Clipboard, ProcessDragFinished, void*, pUserData, void)
         // Remove the pages that have been moved to another place (possibly
         // in the same document.)
         rSelector.DeselectAllPages();
-        PageList::iterator aDraggedPage;
-        for (aDraggedPage=maPagesToRemove.begin();
-             aDraggedPage!=maPagesToRemove.end();
-             ++aDraggedPage)
-        {
-            rSelector.SelectPage(*aDraggedPage);
-        }
+        for (const auto& aDraggedPage : maPagesToRemove)
+            rSelector.SelectPage(aDraggedPage);
+
         mrController.GetSelectionManager()->DeleteSelectedPages();
     }
     mxUndoContext.reset();
commit bfacba6b23ab90fde3303409976809c0e1624a65
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Fri Sep 14 11:53:39 2018 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Thu Dec 6 09:08:00 2018 +0100

    Join the thread only if launch succeeded.
    
    Change-Id: Idee779cea587e11f6d0f7902182c9394e73d46eb
    Reviewed-on: https://gerrit.libreoffice.org/60488
    Tested-by: Jenkins
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/60544
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>
    (cherry picked from commit 5f3a3de26fca5e3e37e4a08940fa4bf9da5e5ecc)
    (cherry picked from commit c595e7c60b7040510a9541e8fb8535db60a356d3)

diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx
index 9d4a4fe29d86..9959489eed3f 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -825,7 +825,6 @@ void FastSaxParserImpl::parseStream(const InputSource& maStructSource)
     {
         rtl::Reference<ParserThread> xParser;
         xParser = new ParserThread(this);
-        aEnsureFree.setThread(xParser);
         xParser->launch();
         aEnsureFree.setThread(xParser);
         bool done = false;
commit c9cc62fc9cf6b017454589f673ef5e69ebe24b91
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Tue Sep 11 22:28:08 2018 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Thu Dec 6 09:07:48 2018 +0100

    Ensure fastparser thread is joined in case of exceptions.
    
    Change-Id: Ie0fb21776514a9a67e9fdff2ae856392cd711adb
    Reviewed-on: https://gerrit.libreoffice.org/60542
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>
    (cherry picked from commit d06a8ce1434c1dcb45770e08395443771f57f1e9)
    (cherry picked from commit 8325f20088c812fedbb94d8fd421c652f6d73db9)

diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx
index 9959489eed3f..9d4a4fe29d86 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -825,6 +825,7 @@ void FastSaxParserImpl::parseStream(const InputSource& maStructSource)
     {
         rtl::Reference<ParserThread> xParser;
         xParser = new ParserThread(this);
+        aEnsureFree.setThread(xParser);
         xParser->launch();
         aEnsureFree.setThread(xParser);
         bool done = false;
commit 79e2ed05012d5b40c0c6203889e43b9c034060ec
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Jun 21 15:34:16 2018 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Thu Dec 6 09:07:06 2018 +0100

    loplugin:useuniqueptr in CustomAnimationDialog
    
    Reviewed-on: https://gerrit.libreoffice.org/56328
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    (cherry picked from commit e5dfdbcc2084bfdb213afbe03d00136e93d5c4d2)
    
    Change-Id: Ic2e93c1493159c9602bd68b409052117766dcc02
    (cherry picked from commit 130b9aa636200db1d349c1376f8166657f680c7c)

diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx b/sd/source/ui/animations/CustomAnimationDialog.cxx
index 28f96d559121..71f5abb15b0a 100644
--- a/sd/source/ui/animations/CustomAnimationDialog.cxx
+++ b/sd/source/ui/animations/CustomAnimationDialog.cxx
@@ -2169,9 +2169,9 @@ CustomAnimationDialog::CustomAnimationDialog(vcl::Window* pParent, STLPropertySe
     sal_uInt16 nTimingId = mpTabControl->GetPageId("timing");
     sal_uInt16 nTextAnimId = mpTabControl->GetPageId("textanim");
 
-    mpEffectTabPage = VclPtr<CustomAnimationEffectTabPage>::Create( mpTabControl, mpSet );
+    mpEffectTabPage = VclPtr<CustomAnimationEffectTabPage>::Create( mpTabControl, mpSet.get() );
     mpTabControl->SetTabPage( nEffectId, mpEffectTabPage );
-    mpDurationTabPage = VclPtr<CustomAnimationDurationTabPage>::Create( mpTabControl, mpSet );
+    mpDurationTabPage = VclPtr<CustomAnimationDurationTabPage>::Create( mpTabControl, mpSet.get() );
     mpTabControl->SetTabPage( nTimingId, mpDurationTabPage );
 
     bool bHasText = false;
@@ -2180,7 +2180,7 @@ CustomAnimationDialog::CustomAnimationDialog(vcl::Window* pParent, STLPropertySe
 
     if( bHasText )
     {
-        mpTextAnimTabPage = VclPtr<CustomAnimationTextAnimTabPage>::Create( mpTabControl, mpSet );
+        mpTextAnimTabPage = VclPtr<CustomAnimationTextAnimTabPage>::Create( mpTabControl, mpSet.get() );
         mpTabControl->SetTabPage( nTextAnimId, mpTextAnimTabPage );
     }
     else
@@ -2204,8 +2204,8 @@ void CustomAnimationDialog::dispose()
     mpDurationTabPage.disposeAndClear();
     mpTextAnimTabPage.disposeAndClear();
 
-    delete mpSet;
-    delete mpResultSet;
+    mpSet.reset();
+    mpResultSet.reset();
 
     mpTabControl.clear();
     TabDialog::dispose();
@@ -2213,24 +2213,22 @@ void CustomAnimationDialog::dispose()
 
 STLPropertySet* CustomAnimationDialog::getResultSet()
 {
-    delete mpResultSet;
-
     mpResultSet = createDefaultSet();
 
-    mpEffectTabPage->update( mpResultSet );
-    mpDurationTabPage->update( mpResultSet );
+    mpEffectTabPage->update( mpResultSet.get() );
+    mpDurationTabPage->update( mpResultSet.get() );
     if( mpTextAnimTabPage )
-        mpTextAnimTabPage->update( mpResultSet );
+        mpTextAnimTabPage->update( mpResultSet.get() );
 
-    return mpResultSet;
+    return mpResultSet.get();
 }
 
-STLPropertySet* CustomAnimationDialog::createDefaultSet()
+std::unique_ptr<STLPropertySet> CustomAnimationDialog::createDefaultSet()
 {
     Any aEmpty;
 
-    STLPropertySet* pSet = new STLPropertySet();
-    pSet->setPropertyDefaultValue( nHandleMaxParaDepth, makeAny( (sal_Int32)-1 ) );
+    std::unique_ptr<STLPropertySet> pSet(new STLPropertySet());
+    pSet->setPropertyDefaultValue( nHandleMaxParaDepth, makeAny( sal_Int32(-1) ) );
 
     pSet->setPropertyDefaultValue( nHandleHasAfterEffect, makeAny( false ) );
     pSet->setPropertyDefaultValue( nHandleAfterEffectOnNextEffect, makeAny( false ) );
diff --git a/sd/source/ui/animations/CustomAnimationDialog.hxx b/sd/source/ui/animations/CustomAnimationDialog.hxx
index 4d0c685dabb1..50977844a77a 100644
--- a/sd/source/ui/animations/CustomAnimationDialog.hxx
+++ b/sd/source/ui/animations/CustomAnimationDialog.hxx
@@ -148,11 +148,11 @@ public:
 
     STLPropertySet* getResultSet();
 
-    static STLPropertySet* createDefaultSet();
+    static std::unique_ptr<STLPropertySet> createDefaultSet();
 
 private:
-    STLPropertySet* mpSet;
-    STLPropertySet* mpResultSet;
+    std::unique_ptr<STLPropertySet> mpSet;
+    std::unique_ptr<STLPropertySet> mpResultSet;
 
     VclPtr<TabControl> mpTabControl;
 
diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx
index c00aedf6c607..b999ec95e893 100644
--- a/sd/source/ui/animations/CustomAnimationPane.cxx
+++ b/sd/source/ui/animations/CustomAnimationPane.cxx
@@ -919,7 +919,7 @@ void CustomAnimationPane::UpdateLook()
     }
 }
 
-void addValue( STLPropertySet* pSet, sal_Int32 nHandle, const Any& rValue )
+void addValue( std::unique_ptr<STLPropertySet>& pSet, sal_Int32 nHandle, const Any& rValue )
 {
     switch( pSet->getPropertyState( nHandle ) )
     {
@@ -1124,9 +1124,9 @@ static bool hasVisibleShape( const Reference< XShape >& xShape )
     return true;
 }
 
-STLPropertySet* CustomAnimationPane::createSelectionSet()
+std::unique_ptr<STLPropertySet> CustomAnimationPane::createSelectionSet()
 {
-    STLPropertySet* pSet = CustomAnimationDialog::createDefaultSet();
+    std::unique_ptr<STLPropertySet> pSet = CustomAnimationDialog::createDefaultSet();
 
     pSet->setPropertyValue( nHandleCurrentPage, makeAny( mxCurrentPage ) );
 
@@ -1649,13 +1649,13 @@ void CustomAnimationPane::changeSelection( STLPropertySet const * pResultSet, ST
 
 void CustomAnimationPane::showOptions(const OString& sPage)
 {
-    STLPropertySet* pSet = createSelectionSet();
+    std::unique_ptr<STLPropertySet> pSet = createSelectionSet();
 
-    VclPtrInstance< CustomAnimationDialog > pDlg(this, pSet, sPage);
+    VclPtrInstance< CustomAnimationDialog > pDlg(this, pSet.get(), sPage);
     if( pDlg->Execute() )
     {
         addUndo();
-        changeSelection( pDlg->getResultSet(), pSet );
+        changeSelection( pDlg->getResultSet(), pSet.get() );
         updateControls();
     }
 }
diff --git a/sd/source/ui/animations/CustomAnimationPane.hxx b/sd/source/ui/animations/CustomAnimationPane.hxx
index 086b717dbc84..f1aff2e25cdc 100644
--- a/sd/source/ui/animations/CustomAnimationPane.hxx
+++ b/sd/source/ui/animations/CustomAnimationPane.hxx
@@ -109,7 +109,7 @@ private:
     void moveSelection( bool bUp );
     void onPreview( bool bForcePreview );
 
-    STLPropertySet* createSelectionSet();
+    std::unique_ptr<STLPropertySet> createSelectionSet();
     void changeSelection( STLPropertySet const * pResultSet, STLPropertySet const * pOldSet );
 
     static css::uno::Any getProperty1Value( sal_Int32 nType, const CustomAnimationEffectPtr& pEffect );
commit 808359e4def4f9dd1318c7d0330a14eacda7d02c
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Thu Sep 13 22:12:00 2018 -0400
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Thu Dec 6 09:06:44 2018 +0100

    sd: modernize some loops
    
    Change-Id: Ic86960ce2f690bebc51c9120053bdd50232f0358
    (cherry picked from commit beb738eb8688ddaf133a0832328073e3e2b78757)

diff --git a/sd/source/ui/framework/configuration/Configuration.cxx b/sd/source/ui/framework/configuration/Configuration.cxx
index cf08236f80b3..a1f08e7816ab 100644
--- a/sd/source/ui/framework/configuration/Configuration.cxx
+++ b/sd/source/ui/framework/configuration/Configuration.cxx
@@ -129,16 +129,13 @@ Sequence<Reference<XResourceId> > SAL_CALL Configuration::getResources (
     ::osl::MutexGuard aGuard (maMutex);
     ThrowIfDisposed();
 
-    bool bFilterResources (!rsResourceURLPrefix.isEmpty());
+    const bool bFilterResources (!rsResourceURLPrefix.isEmpty());
 
     // Collect the matching resources in a vector.
     ::std::vector<Reference<XResourceId> > aResources;
-    ResourceContainer::const_iterator iResource;
-    for (iResource=mpResourceContainer->begin();
-         iResource!=mpResourceContainer->end();
-         ++iResource)
+    for (const auto& resource : *mpResourceContainer)
     {
-        if ( ! (*iResource)->isBoundTo(rxAnchorId,eMode))
+        if (!resource->isBoundTo(rxAnchorId, eMode))
             continue;
 
         if (bFilterResources)
@@ -147,19 +144,17 @@ Sequence<Reference<XResourceId> > SAL_CALL Configuration::getResources (
 
             // Make sure that the resource is bound directly to the anchor.
             if (eMode != AnchorBindingMode_DIRECT
-                && ! (*iResource)->isBoundTo(rxAnchorId, AnchorBindingMode_DIRECT))
+                && !resource->isBoundTo(rxAnchorId, AnchorBindingMode_DIRECT))
             {
                 continue;
             }
 
             // Make sure that the resource URL matches the given prefix.
-            if ( ! (*iResource)->getResourceURL().match(rsResourceURLPrefix))
-            {
+            if (!resource->getResourceURL().match(rsResourceURLPrefix))
                 continue;
-            }
         }
 
-        aResources.push_back(*iResource);
+        aResources.emplace_back(resource);
     }
 
     return comphelper::containerToSequence(aResources);
diff --git a/sd/source/ui/framework/configuration/ConfigurationControllerBroadcaster.cxx b/sd/source/ui/framework/configuration/ConfigurationControllerBroadcaster.cxx
index ae6aa3a466bc..4c6731c5e882 100644
--- a/sd/source/ui/framework/configuration/ConfigurationControllerBroadcaster.cxx
+++ b/sd/source/ui/framework/configuration/ConfigurationControllerBroadcaster.cxx
@@ -84,20 +84,19 @@ void ConfigurationControllerBroadcaster::NotifyListeners (
     // for every listener.
     ConfigurationChangeEvent aEvent (rEvent);
 
-    ListenerList::const_iterator iListener;
-    for (iListener=rList.begin(); iListener!=rList.end(); ++iListener)
+    for (const ListenerDescriptor& listener : rList)
     {
         try
         {
-            aEvent.UserData = iListener->maUserData;
-            iListener->mxListener->notifyConfigurationChange(aEvent);
+            aEvent.UserData = listener.maUserData;
+            listener.mxListener->notifyConfigurationChange(aEvent);
         }
         catch (const lang::DisposedException& rException)
         {
             // When the exception comes from the listener itself then
             // unregister it.
-            if (rException.Context == iListener->mxListener)
-                RemoveListener(iListener->mxListener);
+            if (rException.Context == listener.mxListener)
+                RemoveListener(listener.mxListener);
         }
         catch (const RuntimeException&)
         {
diff --git a/sd/source/ui/framework/tools/FrameworkHelper.cxx b/sd/source/ui/framework/tools/FrameworkHelper.cxx
index c9ab07963cca..a625c148aed2 100644
--- a/sd/source/ui/framework/tools/FrameworkHelper.cxx
+++ b/sd/source/ui/framework/tools/FrameworkHelper.cxx
@@ -320,7 +320,6 @@ FrameworkHelper::InstanceMap FrameworkHelper::maInstanceMap;
 
 ::std::shared_ptr<FrameworkHelper> FrameworkHelper::Instance (ViewShellBase& rBase)
 {
-
     ::std::shared_ptr<FrameworkHelper> pHelper;
 
     InstanceMap::const_iterator iHelper (maInstanceMap.find(&rBase));
@@ -756,12 +755,8 @@ OUString FrameworkHelper::ResourceIdToString (const Reference<XResourceId>& rxRe
         sString += rxResourceId->getResourceURL();
         if (rxResourceId->hasAnchor())
         {
-            Sequence<OUString> aAnchorURLs (rxResourceId->getAnchorURLs());
-            for (sal_Int32 nIndex=0; nIndex < aAnchorURLs.getLength(); ++nIndex)
-            {
-                sString += " | ";
-                sString += aAnchorURLs[nIndex];
-            }
+            for (const OUString& s : rxResourceId->getAnchorURLs())
+                sString += " | " + s;
         }
     }
     return sString;
commit e1143d75eea07bdcd1e13d99a6015c1fc32bfb60
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Aug 4 23:38:44 2018 -0400
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Thu Dec 6 09:06:16 2018 +0100

    ViewShellBase const correctness
    
    Change-Id: I00bffe23f2f850f5e0cbf63a60aa1600f848edac
    (cherry picked from commit 4e6e33870a60a796c17c1e2d67ac6482b853ad28)

diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index e7a0f6d7fec1..09b185c1b5f3 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -280,8 +280,7 @@ public:
     void                        SetNewWindowAllowed( bool bSet )    { bNoNewWindow = !bSet; }
 
     void                        SetController( SfxBaseController* pController );
-    css::uno::Reference< css::frame::XController >
-                                GetController();
+    css::uno::Reference<css::frame::XController> GetController() const;
 
     bool                        TryContextMenuInterception( Menu& rIn, const OUString& rMenuIdentifier, VclPtr<Menu>& rpOut, css::ui::ContextMenuExecuteEvent aEvent );
     bool                        TryContextMenuInterception( Menu& rMenu, const OUString& rMenuIdentifier, css::ui::ContextMenuExecuteEvent aEvent );
diff --git a/sd/source/ui/framework/tools/FrameworkHelper.cxx b/sd/source/ui/framework/tools/FrameworkHelper.cxx
index 7c905edd4550..c9ab07963cca 100644
--- a/sd/source/ui/framework/tools/FrameworkHelper.cxx
+++ b/sd/source/ui/framework/tools/FrameworkHelper.cxx
@@ -88,7 +88,7 @@ public:
             callback is destroyed.
     */
     CallbackCaller (
-        ::sd::ViewShellBase& rBase,
+        const ::sd::ViewShellBase& rBase,
         const OUString& rsEventType,
         const ::sd::framework::FrameworkHelper::ConfigurationChangeEventFilter& rFilter,
         const ::sd::framework::FrameworkHelper::Callback& rCallback);
@@ -347,7 +347,7 @@ FrameworkHelper::InstanceMap FrameworkHelper::maInstanceMap;
     return pHelper;
 }
 
-void FrameworkHelper::DisposeInstance (ViewShellBase& rBase)
+void FrameworkHelper::DisposeInstance (const ViewShellBase& rBase)
 {
     InstanceMap::iterator iHelper (maInstanceMap.find(&rBase));
     if (iHelper != maInstanceMap.end())
@@ -356,7 +356,7 @@ void FrameworkHelper::DisposeInstance (ViewShellBase& rBase)
     }
 }
 
-void FrameworkHelper::ReleaseInstance (ViewShellBase& rBase)
+void FrameworkHelper::ReleaseInstance (const ViewShellBase& rBase)
 {
     InstanceMap::iterator iHelper (maInstanceMap.find(&rBase));
     if (iHelper != maInstanceMap.end())
@@ -834,7 +834,7 @@ namespace {
 //===== CallbackCaller ========================================================
 
 CallbackCaller::CallbackCaller (
-    ::sd::ViewShellBase& rBase,
+    const ::sd::ViewShellBase& rBase,
     const OUString& rsEventType,
     const ::sd::framework::FrameworkHelper::ConfigurationChangeEventFilter& rFilter,
     const ::sd::framework::FrameworkHelper::Callback& rCallback)
diff --git a/sd/source/ui/inc/framework/FrameworkHelper.hxx b/sd/source/ui/inc/framework/FrameworkHelper.hxx
index d56514065f96..e3597302bc8f 100644
--- a/sd/source/ui/inc/framework/FrameworkHelper.hxx
+++ b/sd/source/ui/inc/framework/FrameworkHelper.hxx
@@ -114,14 +114,14 @@ public:
         Do not call this method.  It is an internally used method that can
         not be made private.
     */
-    static void DisposeInstance (ViewShellBase& rBase);
+    static void DisposeInstance (const ViewShellBase& rBase);
 
     /** Destroy the FrameworkHelper object for the given ViewShellBase.
 
         Do not call this method.  It is an internally used method that can
         not be made private.
     */
-    static void ReleaseInstance (ViewShellBase& rBase);
+    static void ReleaseInstance (const ViewShellBase& rBase);
 
     /** Return an identifier for the given view URL.  This identifier can be
         used in a switch statement.  See GetViewURL() for a mapping in the
@@ -299,7 +299,7 @@ public:
 
 private:
     typedef ::std::map<
-        ViewShellBase*,
+        const ViewShellBase*,
         ::std::shared_ptr<FrameworkHelper> > InstanceMap;
     /** The instance map holds (at least) one FrameworkHelper instance for
         every ViewShellBase object.
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index c9b91d8ca9e0..c5cd05f5e3cd 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -1766,7 +1766,7 @@ void SfxViewShell::SetController( SfxBaseController* pController )
     pImpl->xClipboardListener = new SfxClipboardChangeListener( this, GetClipboardNotifier() );
 }
 
-Reference < XController > SfxViewShell::GetController()
+Reference < XController > SfxViewShell::GetController() const
 {
     return pImpl->m_pController.get();
 }


More information about the Libreoffice-commits mailing list