summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <quikee@gmail.com>2013-07-04 20:16:26 +0200
committerTomaž Vajngerl <quikee@gmail.com>2013-07-04 20:21:47 +0200
commitb5d481e2b96e2124021e6f80d2543a5904dad026 (patch)
treea9802aaf66891244dd786c2257a4629b1ec3a656
parentd1472c78b6a166e54eb0c87ce3671d4d9bddd747 (diff)
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
-rw-r--r--chart2/source/controller/dialogs/Strings.src6
-rw-r--r--chart2/source/controller/main/ChartController.cxx4
-rw-r--r--chart2/source/controller/main/ChartController.hxx1
-rw-r--r--chart2/source/controller/main/ChartController_Tools.cxx55
-rw-r--r--chart2/source/controller/main/ControllerCommandDispatch.cxx2
-rw-r--r--chart2/source/inc/Strings.hrc2
-rw-r--r--chart2/uiconfig/toolbar/toolbar.xml3
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/ChartCommands.xcu4
8 files changed, 67 insertions, 10 deletions
diff --git a/chart2/source/controller/dialogs/Strings.src b/chart2/source/controller/dialogs/Strings.src
index f971eae43eed..1aae59a04ebe 100644
--- a/chart2/source/controller/dialogs/Strings.src
+++ b/chart2/source/controller/dialogs/Strings.src
@@ -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
{
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index 8e84ce5ae8f2..e10133ca676e 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -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" )
diff --git a/chart2/source/controller/main/ChartController.hxx b/chart2/source/controller/main/ChartController.hxx
index c3e98b01cab5..442fa8e7dda0 100644
--- a/chart2/source/controller/main/ChartController.hxx
+++ b/chart2/source/controller/main/ChartController.hxx
@@ -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 );
diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx
index 6244943b1263..1d8591d1f1c1 100644
--- a/chart2/source/controller/main/ChartController_Tools.cxx
+++ b/chart2/source/controller/main/ChartController_Tools.cxx
@@ -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() );
diff --git a/chart2/source/controller/main/ControllerCommandDispatch.cxx b/chart2/source/controller/main/ControllerCommandDispatch.cxx
index abb74fc634af..10227164a800 100644
--- a/chart2/source/controller/main/ControllerCommandDispatch.cxx
+++ b/chart2/source/controller/main/ControllerCommandDispatch.cxx
@@ -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 );
diff --git a/chart2/source/inc/Strings.hrc b/chart2/source/inc/Strings.hrc
index 8ce4c2968f2e..eb696a5ac795 100644
--- a/chart2/source/inc/Strings.hrc
+++ b/chart2/source/inc/Strings.hrc
@@ -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)
diff --git a/chart2/uiconfig/toolbar/toolbar.xml b/chart2/uiconfig/toolbar/toolbar.xml
index c1348506ff2b..862f5cf7c201 100644
--- a/chart2/uiconfig/toolbar/toolbar.xml
+++ b/chart2/uiconfig/toolbar/toolbar.xml
@@ -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>
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/ChartCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/ChartCommands.xcu
index 9e21e57cac47..48b6b6553a70 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/ChartCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/ChartCommands.xcu
@@ -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>