[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - 2 commits - sc/source sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Jan 18 14:10:27 UTC 2019


 sc/source/ui/docshell/docsh4.cxx     |   68 ++++++++++++++++++-----------------
 sw/source/uibase/dialog/regionsw.cxx |   22 +++--------
 sw/source/uibase/dochdl/swdtflvr.cxx |   13 +++---
 sw/source/uibase/inc/wrtsh.hxx       |    4 +-
 4 files changed, 49 insertions(+), 58 deletions(-)

New commits:
commit 1e532297119af77cb54b5967eec3625954126e50
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Jan 10 12:27:22 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Jan 18 15:10:15 2019 +0100

    make format->page dialog async
    
    Change-Id: Ie2c63e2bac176002bc6616578aef2d4c763245c7
    Reviewed-on: https://gerrit.libreoffice.org/66113
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Reviewed-by: Mert Tümer <mert.tumer at collabora.com>
    Tested-by: Mert Tümer <mert.tumer at collabora.com>

diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 839cf0257617..c157374b21d8 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -1655,47 +1655,49 @@ void ScDocShell::ExecutePageStyle( const SfxViewShell& rCaller,
                         ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
                         OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
 
-                        ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateScStyleDlg( GetActiveDialogParent(), *pStyleSheet, RID_SCDLG_STYLES_PAGE, RID_SCDLG_STYLES_PAGE ));
-                        OSL_ENSURE(pDlg, "Dialog create fail!");
-
-                        if ( pDlg->Execute() == RET_OK )
-                        {
-                            const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
-
-                            WaitObject aWait( GetActiveDialogParent() );
+                        VclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateScStyleDlg( GetActiveDialogParent(), *pStyleSheet, RID_SCDLG_STYLES_PAGE, RID_SCDLG_STYLES_PAGE ));
 
-                            OUString aNewName = pStyleSheet->GetName();
-                            if ( aNewName != aOldName &&
-                                m_aDocument.RenamePageStyleInUse( aOldName, aNewName ) )
+                        std::shared_ptr<SfxRequest> pRequest(new SfxRequest(rReq));
+                        rReq.Ignore(); // the 'old' request is not relevant any more
+                        pDlg->StartExecuteAsync([this, pDlg, pRequest, pStyleSheet, aOldData, aOldName, &rStyleSet, nCurTab, &rCaller, bUndo](sal_Int32 nResult){
+                            if ( nResult == RET_OK )
                             {
-                                SfxBindings* pBindings = GetViewBindings();
-                                if (pBindings)
+                                const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
+                                WaitObject aWait( GetActiveDialogParent() );
+
+                                OUString aNewName = pStyleSheet->GetName();
+                                if ( aNewName != aOldName &&
+                                    m_aDocument.RenamePageStyleInUse( aOldName, aNewName ) )
                                 {
-                                    pBindings->Invalidate( SID_STATUS_PAGESTYLE );
-                                    pBindings->Invalidate( FID_RESET_PRINTZOOM );
+                                    SfxBindings* pBindings = GetViewBindings();
+                                    if (pBindings)
+                                    {
+                                        pBindings->Invalidate( SID_STATUS_PAGESTYLE );
+                                        pBindings->Invalidate( FID_RESET_PRINTZOOM );
+                                    }
                                 }
-                            }
 
-                            if ( pOutSet )
-                                m_aDocument.ModifyStyleSheet( *pStyleSheet, *pOutSet );
+                                if ( pOutSet )
+                                    m_aDocument.ModifyStyleSheet( *pStyleSheet, *pOutSet );
 
-                            // memorizing for GetState():
-                            GetPageOnFromPageStyleSet( &rStyleSet, nCurTab, m_bHeaderOn, m_bFooterOn );
-                            rCaller.GetViewFrame()->GetBindings().Invalidate( SID_HFEDIT );
+                                // memorizing for GetState():
+                                GetPageOnFromPageStyleSet( &rStyleSet, nCurTab, m_bHeaderOn, m_bFooterOn );
+                                rCaller.GetViewFrame()->GetBindings().Invalidate( SID_HFEDIT );
 
-                            ScStyleSaveData aNewData;
-                            aNewData.InitFromStyle( pStyleSheet );
-                            if (bUndo)
-                            {
-                                GetUndoManager()->AddUndoAction(
-                                        new ScUndoModifyStyle( this, SfxStyleFamily::Page,
-                                                    aOldData, aNewData ) );
-                            }
+                                ScStyleSaveData aNewData;
+                                aNewData.InitFromStyle( pStyleSheet );
+                                if (bUndo)
+                                {
+                                    GetUndoManager()->AddUndoAction(
+                                            new ScUndoModifyStyle( this, SfxStyleFamily::Page,
+                                                        aOldData, aNewData ) );
+                                }
 
-                            PageStyleModified( aNewName, false );
-                            rReq.Done();
-                        }
-                        pDlg.disposeAndClear();
+                                PageStyleModified( aNewName, false );
+                                pRequest->Done();
+                                pDlg->disposeOnce();
+                            }
+                        });
                     }
                 }
             }
commit 8597df19549773174b9d8c1ad92d6ba915199f5b
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Jan 10 10:25:55 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Jan 18 15:10:02 2019 +0100

    make insert-section dialog async
    
    Reviewed-on: https://gerrit.libreoffice.org/66065
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    (cherry picked from commit 09f9b5f6ba9e4590227b12eb8232a56d003086ea)
    
    Change-Id: Ia48f4103b8f346a93ebe1f2c5078f21a90884e3f
    Reviewed-on: https://gerrit.libreoffice.org/66148
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Reviewed-by: Mert Tümer <mert.tumer at collabora.com>
    Tested-by: Mert Tümer <mert.tumer at collabora.com>

diff --git a/sw/source/uibase/dialog/regionsw.cxx b/sw/source/uibase/dialog/regionsw.cxx
index 4d4185104699..84b418f2235f 100644
--- a/sw/source/uibase/dialog/regionsw.cxx
+++ b/sw/source/uibase/dialog/regionsw.cxx
@@ -81,11 +81,9 @@ void SwBaseShell::InsertRegionDialog(SfxRequest& rReq)
         // height=width for more consistent preview (analog to edit region)
         aSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(nWidth, nWidth)));
         SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
-        OSL_ENSURE(pFact, "Dialog creation failed!");
-        ScopedVclPtr<AbstractInsertSectionTabDialog> aTabDlg(pFact->CreateInsertSectionTabDialog(
+        VclPtr<AbstractInsertSectionTabDialog> aTabDlg(pFact->CreateInsertSectionTabDialog(
             &GetView().GetViewFrame()->GetWindow(), aSet , rSh));
-        OSL_ENSURE(aTabDlg, "Dialog creation failed!");
-        aTabDlg->Execute();
+        aTabDlg->StartExecuteAsync(nullptr);
         rReq.Ignore();
     }
     else
@@ -173,13 +171,8 @@ void SwBaseShell::InsertRegionDialog(SfxRequest& rReq)
     }
 }
 
-IMPL_LINK( SwWrtShell, InsertRegionDialog, void*, p, void )
+void SwWrtShell::StartInsertRegionDialog(SwSectionData& rSectionData)
 {
-    SwSectionData* pSect = static_cast<SwSectionData*>(p);
-    std::unique_ptr<SwSectionData> xSectionData(pSect);
-    if (!xSectionData.get())
-        return;
-
     SfxItemSet aSet(
         GetView().GetPool(),
         svl::Items<
@@ -194,13 +187,10 @@ IMPL_LINK( SwWrtShell, InsertRegionDialog, void*, p, void )
     // height=width for more consistent preview (analog to edit region)
     aSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(nWidth, nWidth)));
     SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
-    OSL_ENSURE(pFact, "Dialog creation failed!");
-    ScopedVclPtr<AbstractInsertSectionTabDialog> aTabDlg(pFact->CreateInsertSectionTabDialog(
+    VclPtr<AbstractInsertSectionTabDialog> aTabDlg(pFact->CreateInsertSectionTabDialog(
         &GetView().GetViewFrame()->GetWindow(),aSet , *this));
-    OSL_ENSURE(aTabDlg, "Dialog creation failed!");
-    aTabDlg->SetSectionData(*xSectionData);
-    aTabDlg->Execute();
-
+    aTabDlg->SetSectionData(rSectionData);
+    aTabDlg->StartExecuteAsync(nullptr);
 }
 
 void SwBaseShell::EditRegionDialog(SfxRequest const & rReq)
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index a89182f0f8ee..4deb00ac74ae 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -2604,17 +2604,16 @@ bool SwTransferable::PasteFileName( TransferableDataHelper& rData,
                         ? nullptr : SwIoSystem::GetFileFilter(sFileURL);
                 if( pFlt && dynamic_cast< const SwWebDocShell *>( rSh.GetView().GetDocShell() ) == nullptr )
                 {
-                // and then pull up the insert-region-dialog by PostUser event
-                    SwSectionData * pSect = new SwSectionData(
+                    // and then pull up the insert-region-dialog
+                    SwSectionData aSect(
                                     FILE_LINK_SECTION,
                                     rSh.GetDoc()->GetUniqueSectionName() );
-                    pSect->SetLinkFileName( sFileURL );
-                    pSect->SetProtectFlag( true );
+                    aSect.SetLinkFileName( sFileURL );
+                    aSect.SetProtectFlag( true );
 
-                    Application::PostUserEvent( LINK( &rSh, SwWrtShell,
-                                                      InsertRegionDialog ), pSect );
+                    rSh.StartInsertRegionDialog( aSect ); // starts dialog asynchronously
                     bRet = true;
-                    }
+                }
                 else if( SwPasteSdr::SetAttr == nAction ||
                         ( bIsURLFile && SwPasteSdr::Insert == nAction ))
                 {
diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx
index 9f592df77473..936b910d0de6 100644
--- a/sw/source/uibase/inc/wrtsh.hxx
+++ b/sw/source/uibase/inc/wrtsh.hxx
@@ -444,8 +444,8 @@ typedef bool (SwWrtShell:: *FNSimpleMove)();
     void AutoUpdateFrame(SwFrameFormat* pFormat, const SfxItemSet& rStyleSet);
     void AutoUpdatePara(SwTextFormatColl* pColl, const SfxItemSet& rStyleSet, SwPaM* pPaM = nullptr );
 
-    // link for inserting ranges via Drag&Drop/Clipboard
-    DECL_LINK( InsertRegionDialog, void*, void );
+    // starts dialog for inserting ranges via Drag&Drop/Clipboard
+    void StartInsertRegionDialog(SwSectionData&);
 
     // ctor, the first one is a kind of a controlled copy ctor for more views of a document
     SwWrtShell( SwWrtShell&, vcl::Window *pWin, SwView &rShell);


More information about the Libreoffice-commits mailing list