Kaydet (Commit) b5d481e2 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

fdo#66422 Vertical grid toolbar button - choice major/minor/off

Added toolbar button for vertical grid. Icon was already prepared.
Changed the button behavior for vertical and horizontal grid button
from just on -> off to cycle through major -> major&minor -> off.

Change-Id: I147fc97ab43db31f08a2e98f7b68422fb168f042
üst d1472c78
......@@ -465,7 +465,11 @@ String STR_ACTION_TOGGLE_LEGEND
};
String STR_ACTION_TOGGLE_GRID_HORZ
{
Text [ en-US ] = "Horizontal grid on/off" ;
Text [ en-US ] = "Horizontal grid major/major&minor/off" ;
};
String STR_ACTION_TOGGLE_GRID_VERTICAL
{
Text [ en-US ] = "Vertical grid major/major&minor/off" ;
};
String STR_ACTION_SCALE_TEXT
{
......
......@@ -1214,6 +1214,8 @@ void SAL_CALL ChartController::dispatch(
this->executeDispatch_ToggleLegend();
else if( aCommand == "ToggleGridHorizontal" )
this->executeDispatch_ToggleGridHorizontal();
else if( aCommand == "ToggleGridVertical" )
this->executeDispatch_ToggleGridVertical();
else if( aCommand == "ScaleText" )
this->executeDispatch_ScaleText();
else if( aCommand == "StatusBarVisible" )
......@@ -1546,7 +1548,7 @@ void ChartController::impl_initializeAccessible( const uno::Reference< lang::XIn
( "InsertAxis" ) ( "DeleteAxis" ) ( "InsertAxisTitle" )
// toolbar commands
( "ToggleGridHorizontal" )( "ToggleLegend" ) ( "ScaleText" )
( "ToggleGridHorizontal" ) ( "ToggleGridVertical" ) ( "ToggleLegend" ) ( "ScaleText" )
( "NewArrangement" ) ( "Update" )
( "DefaultColors" ) ( "BarWidth" ) ( "NumberOfLines" )
( "ArrangeRow" )
......
......@@ -667,6 +667,7 @@ private:
bool executeDispatch_Delete();
void executeDispatch_ToggleLegend();
void executeDispatch_ToggleGridHorizontal();
void executeDispatch_ToggleGridVertical();
void impl_ShapeControllerDispatch( const ::com::sun::star::util::URL& rURL,
const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs );
......
......@@ -887,17 +887,64 @@ void ChartController::executeDispatch_ToggleGridHorizontal()
sal_Int32 nCooSysIndex = 0;
bool bIsMainGrid = true;
bool bHasMainYGrid = AxisHelper::isGridShown( nDimensionIndex, nCooSysIndex, bIsMainGrid, xDiagram );
bool bHasMajorYGrid = AxisHelper::isGridShown( nDimensionIndex, nCooSysIndex, true, xDiagram );
bool bHasMinorYGrid = AxisHelper::isGridShown( nDimensionIndex, nCooSysIndex, false, xDiagram );
if( bHasMainYGrid )
AxisHelper::hideGrid( nDimensionIndex, nCooSysIndex, bIsMainGrid, xDiagram );
if( bHasMajorYGrid )
{
if ( bHasMinorYGrid )
{
AxisHelper::hideGrid( nDimensionIndex, nCooSysIndex, true, xDiagram );
AxisHelper::hideGrid( nDimensionIndex, nCooSysIndex, false, xDiagram );
}
else
{
AxisHelper::showGrid( nDimensionIndex, nCooSysIndex, false, xDiagram, m_xCC );
}
}
else
{
AxisHelper::showGrid( nDimensionIndex, nCooSysIndex, true, xDiagram, m_xCC );
}
aUndoGuard.commit();
}
}
void ChartController::executeDispatch_ToggleGridVertical()
{
Reference< frame::XModel > xModel( getModel() );
UndoGuard aUndoGuard = UndoGuard(
String( SchResId( STR_ACTION_TOGGLE_GRID_VERTICAL )), m_xUndoManager );
Reference< chart2::XDiagram > xDiagram( ChartModelHelper::findDiagram( getModel() ));
if( xDiagram.is())
{
sal_Int32 nDimensionIndex = 0;
sal_Int32 nCooSysIndex = 0;
bool bHasMajorXGrid = AxisHelper::isGridShown( nDimensionIndex, nCooSysIndex, true, xDiagram );
bool bHasMinorXGrid = AxisHelper::isGridShown( nDimensionIndex, nCooSysIndex, false, xDiagram );
if( bHasMajorXGrid )
{
if (bHasMinorXGrid)
{
AxisHelper::hideGrid( nDimensionIndex, nCooSysIndex, true, xDiagram );
AxisHelper::hideGrid( nDimensionIndex, nCooSysIndex, false, xDiagram );
}
else
{
AxisHelper::showGrid( nDimensionIndex, nCooSysIndex, false, xDiagram, m_xCC );
}
}
else
AxisHelper::showGrid( nDimensionIndex, nCooSysIndex, bIsMainGrid, xDiagram, m_xCC );
{
AxisHelper::showGrid( nDimensionIndex, nCooSysIndex, true, xDiagram, m_xCC );
}
aUndoGuard.commit();
}
}
void ChartController::impl_ShapeControllerDispatch( const util::URL& rURL, const Sequence< beans::PropertyValue >& rArgs )
{
Reference< frame::XDispatch > xDispatch( m_aDispatchContainer.getShapeController() );
......
......@@ -561,6 +561,8 @@ void ControllerCommandDispatch::updateCommandAvailability()
// toolbar commands
m_aCommandAvailability[ ".uno:ToggleGridHorizontal" ] = bIsWritable;
m_aCommandArguments[ ".uno:ToggleGridHorizontal" ] = uno::makeAny( m_apModelState->bHasMainYGrid );
m_aCommandAvailability[ ".uno:ToggleGridVertical" ] = bIsWritable;
m_aCommandArguments[ ".uno:ToggleGridVertical" ] = uno::makeAny( m_apModelState->bHasMainXGrid );
m_aCommandAvailability[ ".uno:ToggleLegend" ] = bIsWritable;
m_aCommandArguments[ ".uno:ToggleLegend" ] = uno::makeAny( m_apModelState->bHasLegend );
......
......@@ -23,7 +23,6 @@
#include <svl/solar.hrc>
//next free is 297
//single free: 139
//-----------------------------------------------------------------------------
//chart types
......@@ -256,6 +255,7 @@
#define STR_ACTION_EDIT_3D_VIEW (RID_APP_START + 80)
#define STR_ACTION_TOGGLE_LEGEND (RID_APP_START + 83)
#define STR_ACTION_TOGGLE_GRID_HORZ (RID_APP_START + 86)
#define STR_ACTION_TOGGLE_GRID_VERTICAL (RID_APP_START + 139)
#define STR_ACTION_SCALE_TEXT (RID_APP_START + 93)
#define STR_ACTION_REARRANGE_CHART (RID_APP_START + 94)
#define STR_ACTION_EDIT_TEXT (RID_APP_START + 95)
......
......@@ -25,8 +25,9 @@
<toolbar:toolbaritem xlink:href=".uno:DiagramData" toolbar:text=""/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:ToggleGridHorizontal" toolbar:text=""/>
<toolbar:toolbaritem xlink:href=".uno:ToggleGridVertical" toolbar:text=""/>
<toolbar:toolbaritem xlink:href=".uno:ToggleLegend" toolbar:text=""/>
<toolbar:toolbaritem xlink:href=".uno:ScaleText" toolbar:text=""/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:NewArrangement" toolbar:text=""/>
</toolbar:toolbar>
\ No newline at end of file
</toolbar:toolbar>
......@@ -493,7 +493,7 @@
</node>
<node oor:name=".uno:ToggleGridHorizontal" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Horizontal Grid On/Off</value>
<value xml:lang="en-US">Horizontal Grid Major/Major&amp;Minor/Off</value>
</prop>
<prop oor:name="Properties" oor:type="xs:int">
<value>1</value>
......@@ -547,7 +547,7 @@
</node>
<node oor:name=".uno:ToggleGridVertical" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Vertical Grid On/Off</value>
<value xml:lang="en-US">Vertical Grid Major/Major&amp;Minor/Off</value>
</prop>
<prop oor:name="Properties" oor:type="xs:int">
<value>1</value>
......
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