From 430303aeee790cb8951dd007e7dffb55fa7f0f53 Mon Sep 17 00:00:00 2001 From: Maxim Monastirsky Date: Sun, 20 Dec 2015 21:08:42 +0200 Subject: tdf#93837 Convert sheet row/col header context menus to xml This commit shows some weakness of the current approach with PopupLabel, as in many cases it's exactly the same as Label. Have some ideas on how to improve that, but will look at it after converting the remaining menus (at least in sfx2 based modules), so I could have a broader look at what we have. Change-Id: I78dfdb4a6f2ea3faf84f3a521067c6c15df96852 --- .../data/org/openoffice/Office/UI/CalcCommands.xcu | 30 ++++ .../org/openoffice/Office/UI/CalcWindowState.xcu | 10 ++ sc/AllLangResTarget_sc.mk | 1 - sc/UIConfig_scalc.mk | 2 + sc/inc/sccommands.h | 20 --- sc/source/ui/src/hdrcont.src | 195 --------------------- sc/source/ui/view/hdrcont.cxx | 3 +- sc/uiconfig/scalc/popupmenu/colheader.xml | 27 +++ sc/uiconfig/scalc/popupmenu/rowheader.xml | 27 +++ 9 files changed, 97 insertions(+), 218 deletions(-) delete mode 100644 sc/source/ui/src/hdrcont.src create mode 100644 sc/uiconfig/scalc/popupmenu/colheader.xml create mode 100644 sc/uiconfig/scalc/popupmenu/rowheader.xml diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu index ff1091f85c0d..9fa2e8336b04 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu @@ -1130,6 +1130,9 @@ Rows ~Above + + Insert Rows ~Above + 1 @@ -1153,6 +1156,9 @@ Columns ~Left + + Insert Columns ~Left + 1 @@ -1164,6 +1170,9 @@ Rows ~Below + + Insert Rows ~Below + 1 @@ -1175,6 +1184,9 @@ Columns ~Right + + Insert Columns ~Right + 1 @@ -1266,6 +1278,9 @@ ~Height... + + Row ~Height... + @@ -1285,6 +1300,9 @@ H~ide + + H~ide Rows + @@ -1293,6 +1311,9 @@ ~Show + + Sho~w Rows + @@ -1301,6 +1322,9 @@ ~Width... + + Column ~Width... + @@ -1320,6 +1344,9 @@ ~Hide + + H~ide Columns + @@ -1328,6 +1355,9 @@ ~Show + + S~how Columns + diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcWindowState.xcu b/officecfg/registry/data/org/openoffice/Office/UI/CalcWindowState.xcu index 9adc27edb95b..2ec5c220341c 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/CalcWindowState.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcWindowState.xcu @@ -40,6 +40,11 @@ Chart + + + Column Header + + Shape @@ -85,6 +90,11 @@ Print Preview + + + Row Header + + Sheet Tabs Bar diff --git a/sc/AllLangResTarget_sc.mk b/sc/AllLangResTarget_sc.mk index 57035f01c56a..9063108315db 100644 --- a/sc/AllLangResTarget_sc.mk +++ b/sc/AllLangResTarget_sc.mk @@ -37,7 +37,6 @@ $(eval $(call gb_SrsTarget_add_files,sc/res,\ sc/source/ui/src/toolbox.src \ sc/source/ui/src/scfuncs.src \ sc/source/ui/src/sc.src \ - sc/source/ui/src/hdrcont.src \ sc/source/ui/src/scerrors.src \ sc/source/ui/src/scstring.src \ sc/source/ui/src/filter.src \ diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk index f5ec631e1264..760cc5ba133d 100644 --- a/sc/UIConfig_scalc.mk +++ b/sc/UIConfig_scalc.mk @@ -24,6 +24,7 @@ $(eval $(call gb_UIConfig_add_popupmenufiles,modules/scalc,\ sc/uiconfig/scalc/popupmenu/cell \ sc/uiconfig/scalc/popupmenu/celledit \ sc/uiconfig/scalc/popupmenu/chart \ + sc/uiconfig/scalc/popupmenu/colheader \ sc/uiconfig/scalc/popupmenu/draw \ sc/uiconfig/scalc/popupmenu/drawtext \ sc/uiconfig/scalc/popupmenu/form \ @@ -33,6 +34,7 @@ $(eval $(call gb_UIConfig_add_popupmenufiles,modules/scalc,\ sc/uiconfig/scalc/popupmenu/pagebreak \ sc/uiconfig/scalc/popupmenu/pivot \ sc/uiconfig/scalc/popupmenu/preview \ + sc/uiconfig/scalc/popupmenu/rowheader \ sc/uiconfig/scalc/popupmenu/sheettab \ )) diff --git a/sc/inc/sccommands.h b/sc/inc/sccommands.h index 706555d44511..ad95740103de 100644 --- a/sc/inc/sccommands.h +++ b/sc/inc/sccommands.h @@ -19,26 +19,6 @@ #ifndef INCLUDED_SC_INC_SCCOMMANDS_H #define INCLUDED_SC_INC_SCCOMMANDS_H -#define CMD_FID_COL_WIDTH ".uno:ColumnWidth" -#define CMD_SID_CREATE_SW_DRAWVIEW ".uno:CreateSWDrawView" -#define CMD_SID_DEL_COLS ".uno:DeleteColumns" -#define CMD_SID_DEL_ROWS ".uno:DeleteRows" -#define CMD_FID_CELL_FORMAT ".uno:FormatCellDialog" -#define CMD_FID_COL_HIDE ".uno:HideColumn" -#define CMD_FID_ROW_HIDE ".uno:HideRow" -#define CMD_FID_INS_COLUMNS_AFTER ".uno:InsertColumnsAfter" -#define CMD_FID_INS_COLUMN ".uno:InsertColumns" -#define CMD_FID_INS_COLUMNS_BEFORE ".uno:InsertColumnsBefore" -#define CMD_FID_INS_ROWS_AFTER ".uno:InsertRowsAfter" -#define CMD_FID_INS_ROW ".uno:InsertRows" -#define CMD_FID_INS_ROWS_BEFORE ".uno:InsertRowsBefore" -#define CMD_SID_OBJECT_MIRROR ".uno:Mirror" -#define CMD_FID_ROW_HEIGHT ".uno:RowHeight" -#define CMD_FID_COL_OPT_WIDTH ".uno:SetOptimalColumnWidth" -#define CMD_FID_ROW_OPT_HEIGHT ".uno:SetOptimalRowHeight" -#define CMD_FID_COL_SHOW ".uno:ShowColumn" -#define CMD_FID_ROW_SHOW ".uno:ShowRow" -#define CMD_SID_ULINE_VAL_DOUBLE ".uno:UnderlineDouble" #define CMD_FID_TAB_SET_TAB_BG_COLOR ".uno:TabBgColor" #endif diff --git a/sc/source/ui/src/hdrcont.src b/sc/source/ui/src/hdrcont.src deleted file mode 100644 index 33209bae658e..000000000000 --- a/sc/source/ui/src/hdrcont.src +++ /dev/null @@ -1,195 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#include "sc.hrc" - -#define PART1 \ - MenuItem\ - {\ - Identifier = FID_CELL_FORMAT ; \ - HelpId = CMD_FID_CELL_FORMAT ; \ - Text [ en-US ] = "~Format Cells..." ; \ - }; - -#define PART2 \ - MenuItem\ - {\ - Identifier = SID_CUT ; \ - HelpId = CMD_SID_CUT ; \ - Text [ en-US ] = "Cu~t" ; \ - };\ - MenuItem\ - {\ - Identifier = SID_COPY ; \ - HelpId = CMD_SID_COPY ; \ - Text [ en-US ] = "~Copy" ; \ - };\ - MenuItem\ - {\ - Identifier = SID_PASTE ; \ - HelpId = CMD_SID_PASTE ; \ - Text [ en-US ] = "~Paste" ; \ - }; - -Menu RID_POPUP_ROWHEADER -{ - ItemList = - { - PART2 - MenuItem - { - Identifier = SID_PASTE_SPECIAL ; - HelpId = CMD_SID_PASTE_SPECIAL ; - Text [ en-US ] = "P~aste Special..." ; - }; - - MenuItem { Separator = TRUE ; }; - - MenuItem - { - Identifier = FID_INS_ROWS_BEFORE ; - HelpId = CMD_FID_INS_ROWS_BEFORE ; - Text [ en-US ] = "~Insert Rows Above" ; - }; - MenuItem - { - Identifier = FID_INS_ROWS_AFTER ; - HelpId = CMD_FID_INS_ROWS_AFTER ; - Text [ en-US ] = "Insert Rows ~Below" ; - }; - MenuItem - { - Identifier = SID_DEL_ROWS ; - HelpId = CMD_SID_DEL_ROWS ; - Text [ en-US ] = "~Delete Rows" ; - }; - MenuItem - { - Identifier = SID_DELETE ; - HelpId = CMD_SID_DELETE ; - Text [ en-US ] = "Cl~ear Contents..." ; - }; - - MenuItem { Separator = TRUE ; }; - - PART1 - - MenuItem - { - Identifier = FID_ROW_HEIGHT ; - HelpId = CMD_FID_ROW_HEIGHT ; - Text [ en-US ] = "Row Hei~ght..." ; - }; - MenuItem - { - Identifier = FID_ROW_OPT_HEIGHT ; - HelpId = CMD_FID_ROW_OPT_HEIGHT ; - Text [ en-US ] = "~Optimal Row Height..." ; - }; - - MenuItem { Separator = TRUE ; }; - - MenuItem - { - Identifier = FID_ROW_HIDE ; - HelpId = CMD_FID_ROW_HIDE ; - Text [ en-US ] = "~Hide Rows" ; - }; - MenuItem - { - Identifier = FID_ROW_SHOW ; - HelpId = CMD_FID_ROW_SHOW ; - Text [ en-US ] = "~Show Rows" ; - }; - }; -}; - -Menu RID_POPUP_COLHEADER -{ - ItemList = - { - PART2 - MenuItem - { - Identifier = SID_PASTE_SPECIAL ; - HelpId = CMD_SID_PASTE_SPECIAL ; - Text [ en-US ] = "P~aste Special..." ; - }; - - MenuItem { Separator = TRUE ; }; - - MenuItem - { - Identifier = FID_INS_COLUMNS_BEFORE ; - HelpId = CMD_FID_INS_COLUMNS_BEFORE ; - Text [ en-US ] = "Insert Columns ~Left" ; - }; - MenuItem - { - Identifier = FID_INS_COLUMNS_AFTER ; - HelpId = CMD_FID_INS_COLUMNS_AFTER ; - Text [ en-US ] = "Insert Columns ~Right" ; - }; - MenuItem - { - Identifier = SID_DEL_COLS ; - HelpId = CMD_SID_DEL_COLS ; - Text [ en-US ] = "~Delete Columns" ; - }; - MenuItem - { - Identifier = SID_DELETE ; - HelpId = CMD_SID_DELETE ; - Text [ en-US ] = "Cl~ear Contents..." ; - }; - - MenuItem { Separator = TRUE ; }; - - PART1 - - MenuItem - { - Identifier = FID_COL_WIDTH ; - HelpId = CMD_FID_COL_WIDTH ; - Text [ en-US ] = "Column ~Width..." ; - }; - MenuItem - { - Identifier = FID_COL_OPT_WIDTH ; - HelpId = CMD_FID_COL_OPT_WIDTH ; - Text [ en-US ] = "~Optimal Column Width..." ; - }; - - MenuItem { Separator = TRUE ; }; - - MenuItem - { - Identifier = FID_COL_HIDE ; - HelpId = CMD_FID_COL_HIDE ; - Text [ en-US ] = "~Hide Columns" ; - }; - MenuItem - { - Identifier = FID_COL_SHOW ; - HelpId = CMD_FID_COL_SHOW ; - Text [ en-US ] = "~Show Columns" ; - }; - }; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/view/hdrcont.cxx b/sc/source/ui/view/hdrcont.cxx index 2218484616c2..34b7c1ff3f9d 100644 --- a/sc/source/ui/view/hdrcont.cxx +++ b/sc/source/ui/view/hdrcont.cxx @@ -902,8 +902,7 @@ void ScHeaderControl::Command( const CommandEvent& rCEvt ) pViewSh->MarkRange( aNewRange ); } - ScResId aResId( bVertical ? RID_POPUP_ROWHEADER : RID_POPUP_COLHEADER ); - pViewSh->GetDispatcher()->ExecutePopup( aResId ); + pViewSh->GetDispatcher()->ExecutePopup( bVertical ? OUString( "rowheader" ) : OUString( "colheader" ) ); } } else if ( nCmd == CommandEventId::StartDrag ) diff --git a/sc/uiconfig/scalc/popupmenu/colheader.xml b/sc/uiconfig/scalc/popupmenu/colheader.xml new file mode 100644 index 000000000000..32650ff8b2fa --- /dev/null +++ b/sc/uiconfig/scalc/popupmenu/colheader.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/sc/uiconfig/scalc/popupmenu/rowheader.xml b/sc/uiconfig/scalc/popupmenu/rowheader.xml new file mode 100644 index 000000000000..3027b3003721 --- /dev/null +++ b/sc/uiconfig/scalc/popupmenu/rowheader.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3