From ffc2e5be1f712b09710e2096ad2f7eb81b80118d Mon Sep 17 00:00:00 2001 From: Rodolfo Ribeiro Gomes Date: Tue, 28 May 2013 11:22:05 -0300 Subject: Clean zoom redundances in Math and fix fdo#55929 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Zoom can be handled by sfx2 in many ways: - 50%, 75%, 100%, 150%, 200% - Optimal view (fit in window) - Entire page - Page width The math module was doing the first two by itself. Remove it. Strange enough, state methods for zoom interface definitions on sfx2's appslots.sdi were needed. I thought 'Container' property in sfx.sdi should do the job. It seems to do nothing, though. (The zoom should be disabled only if the object is an OLE/Container). The Help-Ids from pop-up menu in Math/Formula were kept, because they doesn't exist in sfx2. Change-Id: Ie1ae413780551b34aa36b338f9a9df79a198319c Reviewed-on: https://gerrit.libreoffice.org/4076 Reviewed-by: Luboš Luňák Tested-by: Luboš Luňák --- .../org/openoffice/Office/UI/GenericCommands.xcu | 2 +- sfx2/sdi/appslots.sdi | 8 ++ sfx2/source/appl/appserv.cxx | 16 +++ starmath/inc/starmath.hrc | 5 - starmath/qa/cppunit/test_starmath.cxx | 9 +- starmath/sdi/smath.sdi | 124 --------------------- starmath/sdi/smslots.sdi | 26 ----- starmath/source/smres.src | 8 +- starmath/source/view.cxx | 21 +--- starmath/uiconfig/smath/toolbar/toolbar.xml | 6 +- 10 files changed, 35 insertions(+), 190 deletions(-) diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu index 46ed65a1d57d..bbed900702ed 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu @@ -1773,7 +1773,7 @@ - Optimal + Optimal view 1 diff --git a/sfx2/sdi/appslots.sdi b/sfx2/sdi/appslots.sdi index aa1da36faebf..320a75e121d2 100644 --- a/sfx2/sdi/appslots.sdi +++ b/sfx2/sdi/appslots.sdi @@ -182,34 +182,42 @@ interface Application SID_ZOOM_ENTIRE_PAGE [ ExecMethod = MiscExec_Impl ; + StateMethod = MiscState_Impl ; ] SID_ZOOM_OPTIMAL [ ExecMethod = MiscExec_Impl ; + StateMethod = MiscState_Impl ; ] SID_ZOOM_PAGE_WIDTH [ ExecMethod = MiscExec_Impl ; + StateMethod = MiscState_Impl ; ] SID_ZOOM_50_PERCENT [ ExecMethod = MiscExec_Impl ; + StateMethod = MiscState_Impl ; ] SID_ZOOM_75_PERCENT [ ExecMethod = MiscExec_Impl ; + StateMethod = MiscState_Impl ; ] SID_ZOOM_100_PERCENT [ ExecMethod = MiscExec_Impl ; + StateMethod = MiscState_Impl ; ] SID_ZOOM_150_PERCENT [ ExecMethod = MiscExec_Impl ; + StateMethod = MiscState_Impl ; ] SID_ZOOM_200_PERCENT [ ExecMethod = MiscExec_Impl ; + StateMethod = MiscState_Impl ; ] SID_HELP_TUTORIALS [ diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 80a380ff0552..825125d0d48f 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -827,6 +827,22 @@ void SfxApplication::MiscState_Impl(SfxItemSet &rSet) } break; + case SID_ZOOM_50_PERCENT: + case SID_ZOOM_75_PERCENT: + case SID_ZOOM_100_PERCENT: + case SID_ZOOM_150_PERCENT: + case SID_ZOOM_200_PERCENT: + case SID_ZOOM_OPTIMAL: + case SID_ZOOM_ENTIRE_PAGE: + case SID_ZOOM_PAGE_WIDTH: + { + const SfxPoolItem *pItem; + SfxItemState aState = SfxViewFrame::Current()->GetDispatcher()->QueryState(SID_ATTR_ZOOM, pItem); + if ( aState == SFX_ITEM_DISABLED ) + rSet.DisableItem( nWhich ); + } + break; + default: break; } diff --git a/starmath/inc/starmath.hrc b/starmath/inc/starmath.hrc index f233fa4b1b53..3b2e9023e5f8 100644 --- a/starmath/inc/starmath.hrc +++ b/starmath/inc/starmath.hrc @@ -31,13 +31,9 @@ #define SID_PREVMARK (SID_SMA_START + 4) #define SID_SYMBOLS_CATALOGUE (SID_SMA_START + 5) #define SID_PREFERENCES (SID_SMA_START + 6) -#define SID_VIEW050 (SID_SMA_START + 7) -#define SID_VIEW100 (SID_SMA_START + 8) -#define SID_VIEW200 (SID_SMA_START + 9) #define SID_ZOOMIN (SID_SMA_START + 10) #define SID_ZOOMOUT (SID_SMA_START + 11) #define SID_DRAW (SID_SMA_START + 12) -#define SID_ADJUST (SID_SMA_START + 13) #define SID_TOOLBOX (SID_SMA_START + 14) #define SID_FORMULACURSOR (SID_SMA_START + 15) #define SID_FONT (SID_SMA_START + 50) @@ -51,7 +47,6 @@ #define SID_IMPORT_FORMULA (SID_SMA_START + 58) #define SID_TEXT (SID_SMA_START + 100) #define SID_GAPHIC_SM (SID_SMA_START + 101) -#define SID_FITINWINDOW (SID_SMA_START + 103) /** Command for inserting a symbol specified by a string (Inserts an SmSpecialNode) */ #define SID_INSERTSYMBOL (SID_SMA_START + 104) /** Command for inserting a math construction specified in commands.src */ diff --git a/starmath/qa/cppunit/test_starmath.cxx b/starmath/qa/cppunit/test_starmath.cxx index e9377106e35a..566861828f6b 100644 --- a/starmath/qa/cppunit/test_starmath.cxx +++ b/starmath/qa/cppunit/test_starmath.cxx @@ -254,7 +254,7 @@ void Test::viewZoom() sal_uInt16 nOptimalZoom=0; { - SfxRequest aZoom(SID_FITINWINDOW, SFX_CALLMODE_SYNCHRON, m_pViewShell->GetPool()); + SfxRequest aZoom(SID_ZOOM_OPTIMAL, SFX_CALLMODE_SYNCHRON, m_pViewShell->GetPool()); m_pViewShell->Execute(aZoom); nOptimalZoom = rGraphicWindow.GetZoom(); CPPUNIT_ASSERT_MESSAGE("Should be about 800%", nOptimalZoom > nOrigZoom); @@ -333,13 +333,6 @@ void Test::viewZoom() CPPUNIT_ASSERT_MESSAGE("Should be Clipped to 800%", nFinalZoom == 800); } - { - SfxRequest aZoom(SID_ADJUST, SFX_CALLMODE_SYNCHRON, m_pViewShell->GetPool()); - m_pViewShell->Execute(aZoom); - nFinalZoom = rGraphicWindow.GetZoom(); - CPPUNIT_ASSERT_MESSAGE("Should be the same as optimal", nOptimalZoom == nFinalZoom); - } - } CPPUNIT_TEST_SUITE_REGISTRATION(Test); diff --git a/starmath/sdi/smath.sdi b/starmath/sdi/smath.sdi index 6df2a617d227..84a934b6d4e1 100644 --- a/starmath/sdi/smath.sdi +++ b/starmath/sdi/smath.sdi @@ -15,31 +15,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -SfxVoidItem Adjust SID_ADJUST -() -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - /* config: */ - AccelConfig = TRUE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_VIEW; -] -//-------------------------------------------------------------------------- SfxVoidItem ChangeAlignment SID_ALIGN () [ @@ -291,31 +267,6 @@ SfxVoidItem Draw SID_DRAW GroupId = GID_VIEW; ] -//-------------------------------------------------------------------------- -SfxVoidItem FitInWindow SID_FITINWINDOW -() -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - /* config: */ - AccelConfig = TRUE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_VIEW; -] - //-------------------------------------------------------------------------- SfxBoolItem FormelCursor SID_FORMULACURSOR () @@ -877,81 +828,6 @@ SfxBoolItem ToolBox SID_TOOLBOX GroupId = GID_VIEW; ] -//-------------------------------------------------------------------------- -SfxVoidItem View100 SID_VIEW100 -() -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - /* config: */ - AccelConfig = TRUE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_VIEW; -] - -//-------------------------------------------------------------------------- -SfxVoidItem View200 SID_VIEW200 -() -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - /* config: */ - AccelConfig = TRUE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_VIEW; -] - -//-------------------------------------------------------------------------- -SfxVoidItem View50 SID_VIEW050 -() -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - /* config: */ - AccelConfig = TRUE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_VIEW; -] - //-------------------------------------------------------------------------- SfxVoidItem ZoomIn SID_ZOOMIN () diff --git a/starmath/sdi/smslots.sdi b/starmath/sdi/smslots.sdi index 5db0d631a25b..9857d3902bb6 100644 --- a/starmath/sdi/smslots.sdi +++ b/starmath/sdi/smslots.sdi @@ -176,21 +176,6 @@ interface FormulaView ExecMethod = Execute ; StateMethod = GetState ; ] - SID_VIEW050 //idlpp ole : no , status : no - [ - ExecMethod = Execute ; - StateMethod = GetState ; - ] - SID_VIEW100 //idlpp ole : no , status : no - [ - ExecMethod = Execute ; - StateMethod = GetState ; - ] - SID_VIEW200 //idlpp ole : no , status : no - [ - ExecMethod = Execute ; - StateMethod = GetState ; - ] SID_ZOOMIN //idlpp ole : no , status : no [ ExecMethod = Execute ; @@ -202,17 +187,6 @@ interface FormulaView StateMethod = GetState ; ] SID_DRAW //idlpp ole : no , status : no - [ - ExecMethod = Execute ; - StateMethod = GetState ; - ] - SID_ADJUST //idlpp ole : no , status : no - [ - ExecMethod = Execute ; - StateMethod = GetState ; - ] - //idlpp kein Menueeintrag , also keine Texte - SID_FITINWINDOW //idlpp ole : no , status : no [ ExecMethod = Execute ; StateMethod = GetState ; diff --git a/starmath/source/smres.src b/starmath/source/smres.src index f5c36b4cd36c..147291d93c24 100644 --- a/starmath/source/smres.src +++ b/starmath/source/smres.src @@ -831,19 +831,19 @@ Menu RID_VIEWMENU { MenuItem { - Identifier = SID_VIEW050 ; + Identifier = SID_ZOOM_50_PERCENT; HelpId = CMD_SID_VIEW050 ; Text [ en-US ] = "~View 50%" ; }; MenuItem { - Identifier = SID_VIEW100 ; + Identifier = SID_ZOOM_100_PERCENT ; HelpId = CMD_SID_VIEW100 ; Text [ en-US ] = "View ~100%" ; }; MenuItem { - Identifier = SID_VIEW200 ; + Identifier = SID_ZOOM_200_PERCENT ; HelpId = CMD_SID_VIEW200 ; Text [ en-US ] = "View ~200%" ; }; @@ -861,7 +861,7 @@ Menu RID_VIEWMENU }; MenuItem { - Identifier = SID_ADJUST ; + Identifier = SID_ZOOM_OPTIMAL ; HelpId = CMD_SID_ADJUST ; Text [ en-US ] = "~Display All" ; }; diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 997908d786da..42325559e34f 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -1573,23 +1573,10 @@ void SmViewShell::Execute(SfxRequest& rReq) } break; - case SID_ADJUST: - case SID_FITINWINDOW: + case SID_ZOOM_OPTIMAL: aGraphic.ZoomToFitInWindow(); break; - case SID_VIEW050: - aGraphic.SetZoom(50); - break; - - case SID_VIEW100: - aGraphic.SetZoom(100); - break; - - case SID_VIEW200: - aGraphic.SetZoom(200); - break; - case SID_ZOOMIN: aGraphic.SetZoom(aGraphic.GetZoom() + 25); break; @@ -1942,13 +1929,9 @@ void SmViewShell::GetState(SfxItemSet &rSet) case SID_ATTR_ZOOM: rSet.Put(SvxZoomItem( SVX_ZOOM_PERCENT, aGraphic.GetZoom())); /* no break here */ - case SID_VIEW050: - case SID_VIEW100: - case SID_VIEW200: - case SID_ADJUST: case SID_ZOOMIN: case SID_ZOOMOUT: - case SID_FITINWINDOW: + case SID_ZOOM_OPTIMAL: if ( GetViewFrame()->GetFrame().IsInPlace() ) rSet.DisableItem( nWh ); break; diff --git a/starmath/uiconfig/smath/toolbar/toolbar.xml b/starmath/uiconfig/smath/toolbar/toolbar.xml index 7ac3103fdda6..ae74d5e4812c 100644 --- a/starmath/uiconfig/smath/toolbar/toolbar.xml +++ b/starmath/uiconfig/smath/toolbar/toolbar.xml @@ -20,10 +20,10 @@ - - + + - \ No newline at end of file + -- cgit v1.2.3