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

Muhammet Kara (via logerrit) logerrit at kemper.freedesktop.org
Sat Jun 29 12:03:15 UTC 2019


 sw/source/uibase/shells/drwbassh.cxx |  176 ++++++++++++++++++-----------------
 1 file changed, 94 insertions(+), 82 deletions(-)

New commits:
commit 80413cdc7bb0e5350d6b67d2334efa0faa67a7c3
Author:     Muhammet Kara <muhammet.kara at collabora.com>
AuthorDate: Fri Jun 28 22:44:10 2019 +0300
Commit:     Muhammet Kara <muhammet.kara at collabora.com>
CommitDate: Sat Jun 29 14:02:32 2019 +0200

    lokdialog: Convert the Format -> Position and Size... to async exec for sw
    
    Change-Id: Ie3383ebe7a712d711e28c626be9e0aaeed5379bb
    Reviewed-on: https://gerrit.libreoffice.org/74860
    Tested-by: Jenkins
    Reviewed-by: Muhammet Kara <muhammet.kara at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/74872
    Tested-by: Muhammet Kara <muhammet.kara at collabora.com>

diff --git a/sw/source/uibase/shells/drwbassh.cxx b/sw/source/uibase/shells/drwbassh.cxx
index 91c9bcf9090a..831c7f4c2a3e 100644
--- a/sw/source/uibase/shells/drwbassh.cxx
+++ b/sw/source/uibase/shells/drwbassh.cxx
@@ -170,7 +170,7 @@ void SwDrawBaseShell::Execute(SfxRequest const &rReq)
                     if( rMarkList.GetMark(0) != nullptr )
                     {
                         SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
-                        ScopedVclPtr<SfxAbstractTabDialog> pDlg;
+                        VclPtr<SfxAbstractTabDialog> pDlg;
                         bool bCaption = false;
 
                         // Allowed anchorages:
@@ -189,7 +189,7 @@ void SwDrawBaseShell::Execute(SfxRequest const &rReq)
                             SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
                             VclPtr<AbstractSvxCaptionDialog> pCaptionDlg =
                                     pFact->CreateCaptionDialog( rReq.GetFrameWeld(), pSdrView, nAllowedAnchors );
-                            pDlg.disposeAndReset(pCaptionDlg);
+                            pDlg.reset(pCaptionDlg);
                             pCaptionDlg->SetValidateFramePosLink( LINK(this, SwDrawBaseShell, ValidatePosition) );
                         }
                         else
@@ -197,7 +197,7 @@ void SwDrawBaseShell::Execute(SfxRequest const &rReq)
                             SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
                             VclPtr<AbstractSvxTransformTabDialog> pTransform =
                                         pFact->CreateSvxTransformTabDialog(rReq.GetFrameWeld(), nullptr, pSdrView, nAllowedAnchors);
-                            pDlg.disposeAndReset(pTransform);
+                            pDlg.reset(pTransform);
                             pTransform->SetValidateFramePosLink( LINK(this, SwDrawBaseShell, ValidatePosition) );
                         }
                         SfxItemSet aNewAttr(pSdrView->GetGeoAttrFromMarked());
@@ -237,99 +237,111 @@ void SwDrawBaseShell::Execute(SfxRequest const &rReq)
 
                         pDlg->SetInputSet( &aSet );
 
-                        if (pDlg->Execute() == RET_OK)
-                        {
-                            const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
-                            pSh->StartAllAction();
+                        pDlg->StartExecuteAsync([=](sal_Int32 nResult){
+                            if (nResult == RET_OK)
+                            {
+                                SwFormatVertOrient aVOrientFinal(pFrameFormat->GetFormatAttr(RES_VERT_ORIENT));
+                                SwFormatHoriOrient aHOrientFinal(pFrameFormat->GetFormatAttr(RES_HORI_ORIENT));
 
-                            // #i30451#
-                            pSh->StartUndo(SwUndoId::INSFMTATTR);
+                                const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
+                                pSh->StartAllAction();
 
-                            pSdrView->SetGeoAttrToMarked(*pOutSet);
+                                // #i30451#
+                                pSh->StartUndo(SwUndoId::INSFMTATTR);
 
-                            if (bCaption)
-                                pSdrView->SetAttributes(*pOutSet);
+                                pSdrView->SetGeoAttrToMarked(*pOutSet);
 
-                            bool bPosCorr =
-                                SfxItemState::SET != pOutSet->GetItemState(
-                                    SID_ATTR_TRANSFORM_POS_X, false ) &&
-                                SfxItemState::SET != pOutSet->GetItemState(
-                                    SID_ATTR_TRANSFORM_POS_Y, false );
+                                if (bCaption)
+                                    pSdrView->SetAttributes(*pOutSet);
 
-                            SfxItemSet aFrameAttrSet(GetPool(), svl::Items<RES_FRMATR_BEGIN, RES_FRMATR_END - 1>{});
+                                bool bPosCorr =
+                                    SfxItemState::SET != pOutSet->GetItemState(
+                                        SID_ATTR_TRANSFORM_POS_X, false ) &&
+                                    SfxItemState::SET != pOutSet->GetItemState(
+                                        SID_ATTR_TRANSFORM_POS_Y, false );
 
-                            bool bSingleSelection = rMarkList.GetMarkCount() == 1;
+                                SfxItemSet aFrameAttrSet(GetPool(), svl::Items<RES_FRMATR_BEGIN, RES_FRMATR_END - 1>{});
 
-                            const SfxPoolItem* pAnchorItem;
-                            if(SfxItemState::SET == pOutSet->GetItemState(
-                                SID_ATTR_TRANSFORM_ANCHOR, false, &pAnchorItem))
-                            {
-                                if(!bSingleSelection)
-                                    pSh->ChgAnchor(static_cast<RndStdIds>(static_cast<const SfxInt16Item*>(pAnchorItem)
-                                            ->GetValue()), false, bPosCorr );
-                                else
+                                bool bSingleSelection = rMarkList.GetMarkCount() == 1;
+
+                                const SfxPoolItem* pAnchorItem;
+                                if(SfxItemState::SET == pOutSet->GetItemState(
+                                    SID_ATTR_TRANSFORM_ANCHOR, false, &pAnchorItem))
                                 {
-                                    SwFormatAnchor aAnchor(pFrameFormat->GetAnchor());
-                                    aAnchor.SetType(static_cast<RndStdIds>(static_cast<const SfxInt16Item*>(pAnchorItem)->GetValue()));
-                                    aFrameAttrSet.Put( aAnchor );
+                                    if(!bSingleSelection)
+                                        pSh->ChgAnchor(static_cast<RndStdIds>(static_cast<const SfxInt16Item*>(pAnchorItem)
+                                                ->GetValue()), false, bPosCorr );
+                                    else
+                                    {
+                                        SwFormatAnchor aAnchor(pFrameFormat->GetAnchor());
+                                        aAnchor.SetType(static_cast<RndStdIds>(static_cast<const SfxInt16Item*>(pAnchorItem)->GetValue()));
+                                        aFrameAttrSet.Put( aAnchor );
+                                    }
+                                }
+                                const SfxPoolItem* pHoriOrient = nullptr;
+                                const SfxPoolItem* pHoriRelation = nullptr;
+                                const SfxPoolItem* pHoriPosition = nullptr;
+                                const SfxPoolItem* pHoriMirror = nullptr;
+                                pOutSet->GetItemState(SID_ATTR_TRANSFORM_HORI_ORIENT, false, &pHoriOrient);
+                                pOutSet->GetItemState(SID_ATTR_TRANSFORM_HORI_RELATION, false, &pHoriRelation);
+                                pOutSet->GetItemState(SID_ATTR_TRANSFORM_HORI_POSITION, false, &pHoriPosition);
+                                pOutSet->GetItemState(SID_ATTR_TRANSFORM_HORI_MIRROR, false, &pHoriMirror);
+                                if(pHoriOrient || pHoriRelation || pHoriPosition || pHoriMirror)
+                                {
+                                    if(pHoriOrient)
+                                        aHOrientFinal.SetHoriOrient(
+                                              static_cast<const SfxInt16Item*>(pHoriOrient)->GetValue());
+                                    if(pHoriRelation)
+                                        aHOrientFinal.SetRelationOrient(
+                                                  static_cast<const SfxInt16Item*>(pHoriRelation)->GetValue());
+                                    if(pHoriPosition)
+                                        aHOrientFinal.SetPos( static_cast<const SfxInt32Item*>(pHoriPosition)->GetValue());
+                                    if(pHoriMirror)
+                                        aHOrientFinal.SetPosToggle( static_cast<const SfxBoolItem*>(pHoriMirror)->GetValue());
+                                    aFrameAttrSet.Put(aHOrientFinal);
                                 }
-                            }
-                            const SfxPoolItem* pHoriOrient = nullptr;
-                            const SfxPoolItem* pHoriRelation = nullptr;
-                            const SfxPoolItem* pHoriPosition = nullptr;
-                            const SfxPoolItem* pHoriMirror = nullptr;
-                            pOutSet->GetItemState(SID_ATTR_TRANSFORM_HORI_ORIENT, false, &pHoriOrient);
-                            pOutSet->GetItemState(SID_ATTR_TRANSFORM_HORI_RELATION, false, &pHoriRelation);
-                            pOutSet->GetItemState(SID_ATTR_TRANSFORM_HORI_POSITION, false, &pHoriPosition);
-                            pOutSet->GetItemState(SID_ATTR_TRANSFORM_HORI_MIRROR, false, &pHoriMirror);
-                            if(pHoriOrient || pHoriRelation || pHoriPosition || pHoriMirror)
-                            {
-                                if(pHoriOrient)
-                                    aHOrient.SetHoriOrient(
-                                          static_cast<const SfxInt16Item*>(pHoriOrient)->GetValue());
-                                if(pHoriRelation)
-                                    aHOrient.SetRelationOrient(
-                                              static_cast<const SfxInt16Item*>(pHoriRelation)->GetValue());
-                                if(pHoriPosition)
-                                    aHOrient.SetPos( static_cast<const SfxInt32Item*>(pHoriPosition)->GetValue());
-                                if(pHoriMirror)
-                                    aHOrient.SetPosToggle( static_cast<const SfxBoolItem*>(pHoriMirror)->GetValue());
-                                aFrameAttrSet.Put(aHOrient);
-                            }
 
-                            const SfxPoolItem* pVertOrient = nullptr;
-                            const SfxPoolItem* pVertRelation = nullptr;
-                            const SfxPoolItem* pVertPosition = nullptr;
-                            pOutSet->GetItemState(SID_ATTR_TRANSFORM_VERT_ORIENT, false, &pVertOrient);
-                            pOutSet->GetItemState(SID_ATTR_TRANSFORM_VERT_RELATION, false, &pVertRelation);
-                            pOutSet->GetItemState(SID_ATTR_TRANSFORM_VERT_POSITION, false, &pVertPosition);
-                            if(pVertOrient || pVertRelation || pVertPosition )
-                            {
-                                if(pVertOrient)
-                                    aVOrient.SetVertOrient(
-                                        static_cast<const SfxInt16Item*>(pVertOrient)->GetValue());
-                                if(pVertRelation)
-                                    aVOrient.SetRelationOrient(
-                                        static_cast<const SfxInt16Item*>(pVertRelation)->GetValue());
-                                if(pVertPosition)
-                                    aVOrient.SetPos( static_cast<const SfxInt32Item*>(pVertPosition)->GetValue());
-                                aFrameAttrSet.Put( aVOrient );
-                            }
-                            const SfxPoolItem* pFollowItem = nullptr;
-                            pOutSet->GetItemState(RES_FOLLOW_TEXT_FLOW, false, &pFollowItem);
-                            if(pFollowItem)
-                                aFrameAttrSet.Put(*pFollowItem);
+                                const SfxPoolItem* pVertOrient = nullptr;
+                                const SfxPoolItem* pVertRelation = nullptr;
+                                const SfxPoolItem* pVertPosition = nullptr;
+                                pOutSet->GetItemState(SID_ATTR_TRANSFORM_VERT_ORIENT, false, &pVertOrient);
+                                pOutSet->GetItemState(SID_ATTR_TRANSFORM_VERT_RELATION, false, &pVertRelation);
+                                pOutSet->GetItemState(SID_ATTR_TRANSFORM_VERT_POSITION, false, &pVertPosition);
+                                if(pVertOrient || pVertRelation || pVertPosition )
+                                {
+                                    if(pVertOrient)
+                                        aVOrientFinal.SetVertOrient(
+                                            static_cast<const SfxInt16Item*>(pVertOrient)->GetValue());
+                                    if(pVertRelation)
+                                        aVOrientFinal.SetRelationOrient(
+                                            static_cast<const SfxInt16Item*>(pVertRelation)->GetValue());
+                                    if(pVertPosition)
+                                        aVOrientFinal.SetPos( static_cast<const SfxInt32Item*>(pVertPosition)->GetValue());
+                                    aFrameAttrSet.Put( aVOrientFinal );
+                                }
+                                const SfxPoolItem* pFollowItem = nullptr;
+                                pOutSet->GetItemState(RES_FOLLOW_TEXT_FLOW, false, &pFollowItem);
+                                if(pFollowItem)
+                                    aFrameAttrSet.Put(*pFollowItem);
 
-                            if(aFrameAttrSet.Count())
-                                pSh->SetDrawingAttr(aFrameAttrSet);
+                                if(aFrameAttrSet.Count())
+                                    pSh->SetDrawingAttr(aFrameAttrSet);
 
-                            rBind.InvalidateAll(false);
+                                GetView().GetViewFrame()->GetBindings().InvalidateAll(false);
 
-                            // #i30451#
-                            pSh->EndUndo( SwUndoId::INSFMTATTR );
+                                // #i30451#
+                                pSh->EndUndo( SwUndoId::INSFMTATTR );
 
-                            pSh->EndAllAction();
-                        }
+                                pSh->EndAllAction();
+                            }
+
+                            if (pSdrView->GetModel()->IsChanged())
+                                pSh->SetModified();
+                            else if (bChanged)
+                                pSdrView->GetModel()->SetChanged();
+
+                            pDlg->disposeOnce();
+                        });
                     }
                 }
                 else


More information about the Libreoffice-commits mailing list