[Libreoffice-commits] core.git: include/svx officecfg/registry sc/sdi sc/source sd/inc sd/sdi svx/sdi sw/sdi sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Aug 23 23:49:44 UTC 2018


 include/svx/svxids.hrc                                                   |    3 
 officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu |    8 --
 officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu     |    8 ++
 sc/sdi/drawsh.sdi                                                        |    1 
 sc/source/ui/drawfunc/drawsh.cxx                                         |   31 ++++++++++
 sc/source/ui/drawfunc/drawsh2.cxx                                        |   23 ++++++-
 sc/source/ui/inc/drawsh.hxx                                              |    1 
 sd/inc/app.hrc                                                           |    1 
 sd/sdi/sdraw.sdi                                                         |   17 -----
 svx/sdi/svx.sdi                                                          |   17 +++++
 sw/sdi/drawsh.sdi                                                        |    6 +
 sw/source/uibase/shells/drawdlg.cxx                                      |   19 ++++++
 sw/source/uibase/shells/drwbassh.cxx                                     |   23 ++++++-
 13 files changed, 123 insertions(+), 35 deletions(-)

New commits:
commit 2ac9cb17de765cdc5c358059c6256a3e168203ac
Author:     Maxim Monastirsky <momonasmon at gmail.com>
AuthorDate: Thu Aug 23 02:33:50 2018 +0300
Commit:     Maxim Monastirsky <momonasmon at gmail.com>
CommitDate: Fri Aug 24 01:49:15 2018 +0200

    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 at gmail.com>

diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc
index 6c5ae5c13117..5e8cd7817534 100644
--- a/include/svx/svxids.hrc
+++ b/include/svx/svxids.hrc
@@ -967,10 +967,11 @@ class SfxStringItem;
 #define SID_INSERT_SIGNATURELINE                        ( SID_SVX_START + 1173 )
 #define SID_EDIT_SIGNATURELINE                          ( SID_SVX_START + 1174 )
 #define SID_SIGN_SIGNATURELINE                          ( SID_SVX_START + 1175 )
+#define SID_MEASURE_DLG                                 ( SID_SVX_START + 1176 )
 
 
 // IMPORTANT NOTE: adjust SID_SVX_FIRSTFREE, when adding new slot id
-#define SID_SVX_FIRSTFREE                               ( SID_SIGN_SIGNATURELINE + 1 )
+#define SID_SVX_FIRSTFREE                               ( SID_MEASURE_DLG + 1 )
 
 // Overflow check for slot IDs
 #if SID_SVX_FIRSTFREE > SID_SVX_END
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
index 47da715d6507..f050287ba3f5 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
@@ -355,14 +355,6 @@
           <value>1</value>
         </prop>
       </node>
-      <node oor:name=".uno:MeasureAttributes" oor:op="replace">
-        <prop oor:name="Label" oor:type="xs:string">
-          <value xml:lang="en-US">Dimen~sions...</value>
-        </prop>
-        <prop oor:name="Properties" oor:type="xs:int">
-          <value>1</value>
-        </prop>
-      </node>
       <node oor:name=".uno:GridFront" oor:op="replace">
         <prop oor:name="Label" oor:type="xs:string">
           <value xml:lang="en-US">Grid to ~Front</value>
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
index d6957a4c29d4..67c85f9814c3 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
@@ -2629,6 +2629,14 @@
           <value>1</value>
         </prop>
       </node>
+      <node oor:name=".uno:MeasureAttributes" oor:op="replace">
+        <prop oor:name="Label" oor:type="xs:string">
+          <value xml:lang="en-US">Dimen~sions...</value>
+        </prop>
+        <prop oor:name="Properties" oor:type="xs:int">
+          <value>1</value>
+        </prop>
+      </node>
       <node oor:name=".uno:LanguageStatus" oor:op="replace">
         <prop oor:name="Label" oor:type="xs:string">
           <value xml:lang="en-US">Language Status</value>
diff --git a/sc/sdi/drawsh.sdi b/sc/sdi/drawsh.sdi
index 23e76a146e67..2cd59627b427 100644
--- a/sc/sdi/drawsh.sdi
+++ b/sc/sdi/drawsh.sdi
@@ -100,6 +100,7 @@ interface TableDraw
     SID_ATTR_LINE_CAP [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ]
     SID_ATTRIBUTES_AREA     [ ExecMethod = ExecDrawAttr; StateMethod = GetAttrFuncState; Export = FALSE; ]
     SID_ATTRIBUTES_LINE     [ ExecMethod = ExecDrawAttr; StateMethod = GetAttrFuncState; Export = FALSE; ]
+    SID_MEASURE_DLG         [ ExecMethod = ExecDrawAttr; StateMethod = GetAttrFuncState; Export = FALSE; ]
     SID_ATTR_TRANSFORM      [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawFuncState; Export = FALSE; ]
 
     // For the sidebar
diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx
index 22cf65513595..5a301f2efe7c 100644
--- a/sc/source/ui/drawfunc/drawsh.cxx
+++ b/sc/source/ui/drawfunc/drawsh.cxx
@@ -208,6 +208,10 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq )
             ExecuteAreaDlg( rReq );
             break;
 
+        case SID_MEASURE_DLG:
+            ExecuteMeasureDlg( rReq );
+            break;
+
         case SID_DRAWTEXT_ATTR_DLG:
             ExecuteTextAttrDlg( rReq );
             break;
@@ -454,6 +458,33 @@ void ScDrawShell::ExecuteTextAttrDlg( SfxRequest& rReq )
     }
 }
 
+void ScDrawShell::ExecuteMeasureDlg( SfxRequest& rReq )
+{
+    ScDrawView* pView       = pViewData->GetScDrawView();
+    bool        bHasMarked  = pView->AreObjectsMarked();
+    SfxItemSet  aNewAttr    ( pView->GetDefaultAttr() );
+
+    if( bHasMarked )
+        pView->MergeAttrFromMarked( aNewAttr, false );
+
+    SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+    vcl::Window* pWin = pViewData->GetDialogParent();
+    ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateSfxDialog(pWin, aNewAttr, pView, RID_SVXPAGE_MEASURE));
+
+    sal_uInt16 nResult = pDlg->Execute();
+
+    if ( RET_OK == nResult )
+    {
+        if ( bHasMarked )
+            pView->SetAttrToMarked( *pDlg->GetOutputItemSet(), false );
+        else
+            pView->SetDefaultAttr( *pDlg->GetOutputItemSet(), false );
+
+        pView->InvalidateAttribs();
+        rReq.Done();
+    }
+}
+
 void ScDrawShell::SetHlinkForObject( SdrObject* pObj, const OUString& rHlnk )
 {
     if ( pObj )
diff --git a/sc/source/ui/drawfunc/drawsh2.cxx b/sc/source/ui/drawfunc/drawsh2.cxx
index 4b2880676407..08cda1bac046 100644
--- a/sc/source/ui/drawfunc/drawsh2.cxx
+++ b/sc/source/ui/drawfunc/drawsh2.cxx
@@ -367,22 +367,37 @@ void ScDrawShell::GetAttrFuncState(SfxItemSet &rSet)
     ScDrawView* pDrView = pViewData->GetScDrawView();
     SfxItemSet aViewSet = pDrView->GetAttrFromMarked(false);
     const SdrMarkList& rMarkList = pDrView->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 );
+
     if ( aViewSet.GetItemState( XATTR_LINESTYLE ) == SfxItemState::DEFAULT )
     {
         rSet.DisableItem( SID_ATTRIBUTES_LINE );
diff --git a/sc/source/ui/inc/drawsh.hxx b/sc/source/ui/inc/drawsh.hxx
index 433c01798640..a5d515bceb62 100644
--- a/sc/source/ui/inc/drawsh.hxx
+++ b/sc/source/ui/inc/drawsh.hxx
@@ -82,6 +82,7 @@ public:
     void    ExecuteLineDlg( SfxRequest& rReq );
     void    ExecuteAreaDlg( SfxRequest& rReq );
     void    ExecuteTextAttrDlg( SfxRequest& rReq );
+    void    ExecuteMeasureDlg( SfxRequest& rReq );
 
     ScDrawView* GetDrawView();
 
diff --git a/sd/inc/app.hrc b/sd/inc/app.hrc
index eb5940c042db..40b36b26f41c 100644
--- a/sd/inc/app.hrc
+++ b/sd/inc/app.hrc
@@ -336,7 +336,6 @@
 #define SID_GLUE_ESCDIR_BOTTOM              (SID_SD_START+317)
 #define SID_DRAWTBX_INSERT                  (SID_SD_START+318)
 #define SID_POLYGON_MORPHING                (SID_SD_START+319)
-#define SID_MEASURE_DLG                     (SID_SD_START+320)
     // FREE
 // In svxids.hrc: SID_GRID_VISIBLE              (SID_SD_START+322)
 // In svxids.hrc: ID_VAL_USEFIRSTROWSTYLE       (SID_SD_START+323)
diff --git a/sd/sdi/sdraw.sdi b/sd/sdi/sdraw.sdi
index 5009acb6cf0c..98d36b3985e2 100644
--- a/sd/sdi/sdraw.sdi
+++ b/sd/sdi/sdraw.sdi
@@ -2435,23 +2435,6 @@ SfxBoolItem MasterPage SID_MASTERPAGE
     GroupId = SfxGroupId::View;
 ]
 
-SfxVoidItem MeasureAttributes SID_MEASURE_DLG
-()
-[
-    AutoUpdate = FALSE,
-    FastCall = FALSE,
-    ReadOnlyDoc = FALSE,
-    Toggle = FALSE,
-    Container = FALSE,
-    RecordAbsolute = FALSE,
-    RecordPerSet;
-
-    AccelConfig = TRUE,
-    MenuConfig = TRUE,
-    ToolBoxConfig = TRUE,
-    GroupId = SfxGroupId::Format;
-]
-
 SfxVoidItem MirrorHorz SID_HORIZONTAL
 ()
 [
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
index d9be1425c8f4..bf1387a1d5a2 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -8539,6 +8539,23 @@ SfxVoidItem TransformDialog SID_ATTR_TRANSFORM
     GroupId = SfxGroupId::Format;
 ]
 
+SfxVoidItem MeasureAttributes SID_MEASURE_DLG
+()
+[
+    AutoUpdate = FALSE,
+    FastCall = FALSE,
+    ReadOnlyDoc = FALSE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+
+    AccelConfig = TRUE,
+    MenuConfig = TRUE,
+    ToolBoxConfig = TRUE,
+    GroupId = SfxGroupId::Format;
+]
+
 
 SfxVoidItem TwainSelect SID_TWAIN_SELECT
 ()
diff --git a/sw/sdi/drawsh.sdi b/sw/sdi/drawsh.sdi
index 974ae8f9c391..0b30d6fba4ce 100644
--- a/sw/sdi/drawsh.sdi
+++ b/sw/sdi/drawsh.sdi
@@ -196,6 +196,12 @@ interface TextDraw : TextDrawBase
         StateMethod = DisableState ;
     ]
 
+    SID_MEASURE_DLG
+    [
+        ExecMethod = ExecDrawDlg ;
+        StateMethod = DisableState ;
+    ]
+
     FN_DRAWTEXT_ATTR_DLG
     [
         ExecMethod = ExecDrawDlg ;
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);
 
 }


More information about the Libreoffice-commits mailing list