[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - sw/source
Muhammet Kara (via logerrit)
logerrit at kemper.freedesktop.org
Sat Jun 29 14:16:31 UTC 2019
sw/source/uibase/shells/drwbassh.cxx | 178 ++++++++++++++++++-----------------
1 file changed, 94 insertions(+), 84 deletions(-)
New commits:
commit 1ec2cf271b98191d6c6e390357f81ad13cca1473
Author: Muhammet Kara <muhammet.kara at collabora.com>
AuthorDate: Thu Jun 27 01:38:45 2019 +0300
Commit: Muhammet Kara <muhammet.kara at collabora.com>
CommitDate: Sat Jun 29 16:15:48 2019 +0200
lokdialog: Convert the Format -> Position and Size... to async exec for sw
Change-Id: Ie3383ebe7a712d711e28c626be9e0aaeed5379bb
Reviewed-on: https://gerrit.libreoffice.org/74882
Reviewed-by: Muhammet Kara <muhammet.kara at collabora.com>
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 b6a9ca545efe..27beef12535c 100644
--- a/sw/source/uibase/shells/drwbassh.cxx
+++ b/sw/source/uibase/shells/drwbassh.cxx
@@ -175,7 +175,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:
@@ -193,16 +193,16 @@ void SwDrawBaseShell::Execute(SfxRequest const &rReq)
{
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
VclPtr<AbstractSvxCaptionDialog> pCaptionDlg =
- pFact->CreateCaptionDialog( GetView().GetWindow(), pSdrView, nAllowedAnchors );
- pDlg.disposeAndReset(pCaptionDlg);
+ pFact->CreateCaptionDialog( &GetView().GetFrame()->GetWindow(), pSdrView, nAllowedAnchors );
+ pDlg.reset(pCaptionDlg);
pCaptionDlg->SetValidateFramePosLink( LINK(this, SwDrawBaseShell, ValidatePosition) );
}
else
{
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
VclPtr<AbstractSvxTransformTabDialog> pTransform =
- pFact->CreateSvxTransformTabDialog( GetView().GetWindow(), nullptr, pSdrView, nAllowedAnchors );
- pDlg.disposeAndReset(pTransform);
+ pFact->CreateSvxTransformTabDialog( &GetView().GetFrame()->GetWindow(), nullptr, pSdrView, nAllowedAnchors );
+ pDlg.reset(pTransform);
pTransform->SetValidateFramePosLink( LINK(this, SwDrawBaseShell, ValidatePosition) );
}
SfxItemSet aNewAttr(pSdrView->GetGeoAttrFromMarked());
@@ -242,99 +242,109 @@ 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 aVOrient(static_cast<const SwFormatVertOrient&>(pFrameFormat->GetFormatAttr(RES_VERT_ORIENT)));
+ SwFormatHoriOrient aHOrient(static_cast<const SwFormatHoriOrient&>(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((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((RndStdIds)static_cast<const SfxInt16Item*>(pAnchorItem)->GetValue());
- aFrameAttrSet.Put( aAnchor );
+ if(!bSingleSelection)
+ pSh->ChgAnchor((RndStdIds)static_cast<const SfxInt16Item*>(pAnchorItem)
+ ->GetValue(), false, bPosCorr );
+ else
+ {
+ SwFormatAnchor aAnchor(pFrameFormat->GetAnchor());
+ aAnchor.SetType((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)
+ 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* 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)
+ 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);
- 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();
+ });
}
}
else
More information about the Libreoffice-commits
mailing list