From 2ac9cb17de765cdc5c358059c6256a3e168203ac Mon Sep 17 00:00:00 2001 From: Maxim Monastirsky Date: Thu, 23 Aug 2018 02:33:50 +0300 Subject: tdf#119236 Dimension dialog for Writer and Calc Change-Id: Ifbc6c8959afcedac0fd9ec7a3f5e2cca63c11eda Reviewed-on: https://gerrit.libreoffice.org/59484 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky --- sw/source/uibase/shells/drawdlg.cxx | 19 +++++++++++++++++++ sw/source/uibase/shells/drwbassh.cxx | 23 +++++++++++++++++++---- 2 files changed, 38 insertions(+), 4 deletions(-) (limited to 'sw/source/uibase') diff --git a/sw/source/uibase/shells/drawdlg.cxx b/sw/source/uibase/shells/drawdlg.cxx index 0dfaa6a92c43..dc36accdc4b6 100644 --- a/sw/source/uibase/shells/drawdlg.cxx +++ b/sw/source/uibase/shells/drawdlg.cxx @@ -68,6 +68,25 @@ void SwDrawShell::ExecDrawDlg(SfxRequest& rReq) } break; + case SID_MEASURE_DLG: + { + bool bHasMarked = pView->AreObjectsMarked(); + + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + ScopedVclPtr pDlg(pFact->CreateSfxDialog(rReq.GetFrameWindow(), + aNewAttr, pView, RID_SVXPAGE_MEASURE)); + if (pDlg->Execute() == RET_OK) + { + pSh->StartAction(); + if (bHasMarked) + pView->SetAttrToMarked(*pDlg->GetOutputItemSet(), false); + else + pView->SetDefaultAttr(*pDlg->GetOutputItemSet(), false); + pSh->EndAction(); + } + } + break; + case SID_ATTRIBUTES_AREA: { bool bHasMarked = pView->AreObjectsMarked(); diff --git a/sw/source/uibase/shells/drwbassh.cxx b/sw/source/uibase/shells/drwbassh.cxx index b56ae8aec092..10a2320a6f68 100644 --- a/sw/source/uibase/shells/drwbassh.cxx +++ b/sw/source/uibase/shells/drwbassh.cxx @@ -733,22 +733,37 @@ void SwDrawBaseShell::DisableState( SfxItemSet& rSet ) SwWrtShell *pSh = &GetShell(); SdrView* pSdrView = pSh->GetDrawView(); const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList(); + const size_t nMarkCount = rMarkList.GetMarkCount(); + bool bShowArea = true, bShowMeasure = true; - if ( rMarkList.GetMarkCount() == 1 ) + for (size_t i = 0; i < nMarkCount && i < 50; ++i) { - SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); + SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj(); sal_uInt16 nObjType = pObj->GetObjIdentifier(); + if ( nObjType != OBJ_MEASURE ) + bShowMeasure = false; + // If marked object is 2D, disable format area command. if ( nObjType == OBJ_PLIN || nObjType == OBJ_LINE || nObjType == OBJ_PATHLINE || nObjType == OBJ_FREELINE || nObjType == OBJ_EDGE || - nObjType == OBJ_CARC ) - rSet.DisableItem( SID_ATTRIBUTES_AREA ); + nObjType == OBJ_CARC || + bShowMeasure ) + bShowArea = false; + + if (!bShowArea && !bShowMeasure) + break; } + if (!bShowArea) + rSet.DisableItem(SID_ATTRIBUTES_AREA); + + if (!bShowMeasure) + rSet.DisableItem(SID_MEASURE_DLG); + Disable(rSet); } -- cgit