diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2018-08-23 02:33:50 +0300 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2018-08-24 01:49:15 +0200 |
commit | 2ac9cb17de765cdc5c358059c6256a3e168203ac (patch) | |
tree | 5711a3d14095e15c9fc51c49e04019276b8897fd /sw/source/uibase | |
parent | b576d593cd702560f84ac28d8a17905e5e7b8353 (diff) |
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 <momonasmon@gmail.com>
Diffstat (limited to 'sw/source/uibase')
-rw-r--r-- | sw/source/uibase/shells/drawdlg.cxx | 19 | ||||
-rw-r--r-- | sw/source/uibase/shells/drwbassh.cxx | 23 |
2 files changed, 38 insertions, 4 deletions
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<SfxAbstractDialog> 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); } |