Kaydet (Commit) ffc2e5be authored tarafından Rodolfo Ribeiro Gomes's avatar Rodolfo Ribeiro Gomes Kaydeden (comit) Luboš Luňák

Clean zoom redundances in Math and fix fdo#55929

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/4076Reviewed-by: 's avatarLuboš Luňák <l.lunak@suse.cz>
Tested-by: 's avatarLuboš Luňák <l.lunak@suse.cz>
üst 615b3c84
......@@ -1773,7 +1773,7 @@
</node>
<node oor:name=".uno:ZoomOptimal" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Optimal</value>
<value xml:lang="en-US">Optimal view</value>
</prop>
<prop oor:name="Properties" oor:type="xs:int">
<value>1</value>
......
......@@ -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
[
......
......@@ -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;
}
......
......@@ -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 */
......
......@@ -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);
......
......@@ -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
()
......
......@@ -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 ;
......
......@@ -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" ;
};
......
......@@ -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;
......
......@@ -20,10 +20,10 @@
<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
<toolbar:toolbaritem xlink:href=".uno:ZoomIn" toolbar:text=""/>
<toolbar:toolbaritem xlink:href=".uno:ZoomOut" toolbar:text=""/>
<toolbar:toolbaritem xlink:href=".uno:View100" toolbar:text=""/>
<toolbar:toolbaritem xlink:href=".uno:Adjust" toolbar:text=""/>
<toolbar:toolbaritem xlink:href=".uno:Zoom100Percent" toolbar:text=""/>
<toolbar:toolbaritem xlink:href=".uno:ZoomOptimal" toolbar:text=""/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:Draw" toolbar:text=""/>
<toolbar:toolbaritem xlink:href=".uno:FormelCursor" toolbar:text=""/>
<toolbar:toolbaritem xlink:href=".uno:SymbolCatalogue" toolbar:text=""/>
</toolbar:toolbar>
\ No newline at end of file
</toolbar:toolbar>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment