[Libreoffice-commits] core.git: 2 commits - cui/source framework/source include/vcl offapi/com officecfg/registry sc/inc sc/sdi sc/source vcl/unx vcl/win
Kohei Yoshida
kohei.yoshida at collabora.com
Fri May 2 12:43:28 PDT 2014
cui/source/customize/acccfg.cxx | 5 +
framework/source/accelerators/keymapping.cxx | 1
include/vcl/keycodes.hxx | 1
offapi/com/sun/star/awt/Key.idl | 3
officecfg/registry/data/org/openoffice/Office/Accelerators.xcu | 6 +
officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu | 8 ++
sc/inc/sc.hrc | 1
sc/inc/scmod.hxx | 2
sc/sdi/cellsh.sdi | 1
sc/sdi/scalc.sdi | 25 ++++++
sc/source/ui/app/inputhdl.cxx | 8 +-
sc/source/ui/app/scmod.cxx | 4 -
sc/source/ui/inc/cellsh.hxx | 2
sc/source/ui/inc/inputhdl.hxx | 2
sc/source/ui/view/cellsh.cxx | 4 -
sc/source/ui/view/cellsh1.cxx | 37 ++++++++++
vcl/unx/generic/app/saldisp.cxx | 8 +-
vcl/unx/gtk/window/gtksalframe.cxx | 1
vcl/unx/gtk/window/gtksalmenu.cxx | 1
vcl/win/source/app/salinst.cxx | 1
vcl/win/source/window/salframe.cxx | 3
21 files changed, 117 insertions(+), 7 deletions(-)
New commits:
commit 56cce6fd8151a916e1be540ac18724b46d1b15fc
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Fri May 2 15:30:20 2014 -0400
Implement "fill single edit" mode and map it to Ctrl-' by default.
Excel does this apparently, and lots of people want it.
Change-Id: Ia741ebb84526197d28caa323d36709e38b8f1323
diff --git a/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu b/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu
index 624bcdf..ef0ec1b 100644
--- a/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu
@@ -967,6 +967,12 @@
<value xml:lang="en-US">.uno:ToggleFormula</value>
</prop>
</node>
+ <node oor:name="QUOTERIGHT_MOD1" oor:op="replace">
+ <prop oor:name="Command">
+ <value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value>
+ <value xml:lang="en-US">.uno:FillSingleEdit</value>
+ </prop>
+ </node>
<node oor:name="Y_SHIFT_MOD1" oor:op="replace">
<prop oor:name="Command">
<value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value>
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
index 18dc5d3..1bfa929 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
@@ -632,6 +632,14 @@
<value xml:lang="en-US">~Left</value>
</prop>
</node>
+ <node oor:name=".uno:FillSingleEdit" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">Fill Single ~Edit</value>
+ </prop>
+ <prop oor:name="ContextLabel" oor:type="xs:string">
+ <value xml:lang="en-US">Single ~Edit</value>
+ </prop>
+ </node>
<node oor:name=".uno:FillTable" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Fill ~Sheets...</value>
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index 757931f..43bda66 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -286,6 +286,7 @@
#define FID_FILL_TO_LEFT (EDIT_MENU_START + 7)
#define FID_FILL_TAB (EDIT_MENU_START + 8)
#define FID_FILL_SERIES (EDIT_MENU_START + 9)
+#define FID_FILL_SINGLE_EDIT (EDIT_MENU_START + 10)
#define SID_SC_EDIT_OBJECT (EDIT_MENU_START + 14)
#define SID_HFEDIT (EDIT_MENU_START + 15)
diff --git a/sc/inc/scmod.hxx b/sc/inc/scmod.hxx
index de9d9c2..cafefdf 100644
--- a/sc/inc/scmod.hxx
+++ b/sc/inc/scmod.hxx
@@ -205,7 +205,7 @@ SC_DLLPUBLIC void SetAppOptions ( const ScAppOptions& rO
// InputHandler:
bool IsEditMode(); // not for SC_INPUT_TYPE
bool IsInputMode(); // also for SC_INPUT_TYPE
- void SetInputMode( ScInputMode eMode );
+ void SetInputMode( ScInputMode eMode, const OUString* pInitText = NULL );
bool InputKeyEvent( const KeyEvent& rKEvt, bool bStartEdit = false );
SC_DLLPUBLIC void InputEnterHandler( sal_uInt8 nBlockMode = 0 );
void InputCancelHandler();
diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi
index b77b4f8..62ce485 100644
--- a/sc/sdi/cellsh.sdi
+++ b/sc/sdi/cellsh.sdi
@@ -150,6 +150,7 @@ interface CellSelection
FID_FILL_TAB [ ExecMethod = ExecuteEdit; StateMethod = GetState; ]
FID_FILL_SERIES [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ]
FID_FILL_AUTO [ ExecMethod = ExecuteEdit; StateMethod = GetState; ]
+ FID_FILL_SINGLE_EDIT [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ]
SID_RANDOM_NUMBER_GENERATOR_DIALOG [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ]
SID_SAMPLING_DIALOG [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ]
SID_DESCRIPTIVE_STATISTICS_DIALOG [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ]
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index d260cda..fe3d780 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -2414,6 +2414,31 @@ SfxVoidItem FillLeft FID_FILL_TO_LEFT
]
+SfxVoidItem FillSingleEdit FID_FILL_SINGLE_EDIT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+
SfxVoidItem FillModeEnd SID_FILL_NONE
()
[
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 78481fa..f1a3da8 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -2381,7 +2381,7 @@ void ScInputHandler::InvalidateAttribs()
// --------------- public Methoden --------------------------------------------
-void ScInputHandler::SetMode( ScInputMode eNewMode )
+void ScInputHandler::SetMode( ScInputMode eNewMode, const OUString* pInitText )
{
if ( eMode == eNewMode )
return;
@@ -2419,6 +2419,12 @@ void ScInputHandler::SetMode( ScInputMode eNewMode )
}
}
+ if (pInitText)
+ {
+ pEngine->SetText(*pInitText);
+ bModified = true;
+ }
+
sal_Int32 nPara = pEngine->GetParagraphCount()-1;
sal_Int32 nLen = pEngine->GetText(nPara).getLength();
sal_uInt16 nCount = pEngine->GetViewCount();
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index ec2ce29..586686d 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -1427,11 +1427,11 @@ void ScModule::ViewShellChanged()
pShell->UpdateInputHandler();
}
-void ScModule::SetInputMode( ScInputMode eMode )
+void ScModule::SetInputMode( ScInputMode eMode, const OUString* pInitText )
{
ScInputHandler* pHdl = GetInputHdl();
if (pHdl)
- pHdl->SetMode( eMode );
+ pHdl->SetMode(eMode, pInitText);
}
bool ScModule::IsEditMode()
diff --git a/sc/source/ui/inc/cellsh.hxx b/sc/source/ui/inc/cellsh.hxx
index fa83707..2318cf8 100644
--- a/sc/source/ui/inc/cellsh.hxx
+++ b/sc/source/ui/inc/cellsh.hxx
@@ -61,6 +61,8 @@ private:
void ExecuteXMLSourceDialog();
void ExecuteSubtotals(SfxRequest& rReq);
+ void ExecuteFillSingleEdit();
+
DECL_LINK( ClipboardChanged, TransferableDataHelper* );
DECL_LINK( DialogClosed, void* );
diff --git a/sc/source/ui/inc/inputhdl.hxx b/sc/source/ui/inc/inputhdl.hxx
index 231e9ad..9373138 100644
--- a/sc/source/ui/inc/inputhdl.hxx
+++ b/sc/source/ui/inc/inputhdl.hxx
@@ -164,7 +164,7 @@ public:
ScInputHandler();
virtual ~ScInputHandler();
- void SetMode( ScInputMode eNewMode );
+ void SetMode( ScInputMode eNewMode, const OUString* pInitText = NULL );
bool IsInputMode() const { return (eMode != SC_INPUT_NONE); }
bool IsEditMode() const { return (eMode != SC_INPUT_NONE &&
eMode != SC_INPUT_TYPE); }
diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx
index 498d173..2a5aa5b 100644
--- a/sc/source/ui/view/cellsh.cxx
+++ b/sc/source/ui/view/cellsh.cxx
@@ -199,7 +199,9 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet )
nCol2, nRow1, nCol2, nRow2, rMark ); // last column
}
break;
-
+ case FID_FILL_SINGLE_EDIT:
+ bDisable = false;
+ break;
case SID_CUT: // cut
case FID_INS_CELL: // insert cells, just simple selection
bDisable = (!bSimpleArea);
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 858d1ab..e53be77 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -79,6 +79,10 @@
#include "scui_def.hxx"
#include <svx/dialogs.hrc>
#include "scabstdlg.hxx"
+#include <tokenstringcontext.hxx>
+#include <cellvalue.hxx>
+#include <tokenarray.hxx>
+#include <formulacell.hxx>
#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
@@ -901,6 +905,9 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
}
}
break;
+ case FID_FILL_SINGLE_EDIT:
+ ExecuteFillSingleEdit();
+ break;
case SID_RANDOM_NUMBER_GENERATOR_DIALOG:
{
sal_uInt16 nId = ScRandomNumberGeneratorDialogWrapper::GetChildWindowId();
@@ -2771,6 +2778,36 @@ void ScCellShell::ExecuteSubtotals(SfxRequest& rReq)
delete pDlg;
}
+void ScCellShell::ExecuteFillSingleEdit()
+{
+ ScAddress aCurPos = GetViewData()->GetCurPos();
+
+ OUString aInit;
+
+ if (aCurPos.Row() > 0)
+ {
+ // Get the initial text value from the above cell.
+
+ ScDocument* pDoc = GetViewData()->GetDocument();
+ ScRefCellValue aCell;
+ ScAddress aPrevPos = aCurPos;
+ aPrevPos.IncRow(-1);
+ aCell.assign(*pDoc, aPrevPos);
+
+ if (aCell.meType == CELLTYPE_FORMULA)
+ {
+ aInit = "=";
+ const ScTokenArray* pCode = aCell.mpFormula->GetCode();
+ sc::TokenStringContext aCxt(pDoc, pDoc->GetGrammar());
+ aInit += pCode->CreateString(aCxt, aCurPos);
+ }
+ else
+ aInit = aCell.getString(pDoc);
+ }
+
+ SC_MOD()->SetInputMode(SC_INPUT_TABLE, &aInit);
+}
+
IMPL_LINK_NOARG(ScCellShell, DialogClosed)
{
OSL_ENSURE( pImpl->m_pLinkedDlg, "ScCellShell::DialogClosed(): invalid request" );
commit dd9c9a69da7b22c4166391df082ac23878312a01
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Fri May 2 12:29:15 2014 -0400
Add the "quoteright" key to the list of available keyboard shortcuts.
Change-Id: I24800c28b1513b883c42d9ce1c787eaf07815b92
diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx
index 40ad739..ea56730 100644
--- a/cui/source/customize/acccfg.cxx
+++ b/cui/source/customize/acccfg.cxx
@@ -203,6 +203,7 @@ static const sal_uInt16 KEYCODE_ARRAY[] =
KEY_Y | KEY_MOD1 ,
KEY_Z | KEY_MOD1 ,
KEY_SEMICOLON | KEY_MOD1 ,
+ KEY_QUOTERIGHT | KEY_MOD1 ,
KEY_BRACKETLEFT | KEY_MOD1 ,
KEY_BRACKETRIGHT | KEY_MOD1,
KEY_POINT | KEY_MOD1 ,
@@ -280,6 +281,7 @@ static const sal_uInt16 KEYCODE_ARRAY[] =
KEY_Y | KEY_SHIFT | KEY_MOD1,
KEY_Z | KEY_SHIFT | KEY_MOD1,
KEY_SEMICOLON | KEY_SHIFT | KEY_MOD1 ,
+ KEY_QUOTERIGHT | KEY_SHIFT | KEY_MOD1 ,
KEY_BRACKETLEFT | KEY_SHIFT | KEY_MOD1 ,
KEY_BRACKETRIGHT | KEY_SHIFT | KEY_MOD1,
KEY_POINT | KEY_SHIFT | KEY_MOD1,
@@ -352,6 +354,7 @@ static const sal_uInt16 KEYCODE_ARRAY[] =
KEY_Y | KEY_MOD2 ,
KEY_Z | KEY_MOD2 ,
KEY_SEMICOLON | KEY_MOD2 ,
+ KEY_QUOTERIGHT | KEY_MOD2 ,
KEY_BRACKETLEFT | KEY_MOD2 ,
KEY_BRACKETRIGHT | KEY_MOD2,
KEY_POINT | KEY_MOD2 ,
@@ -424,6 +427,7 @@ static const sal_uInt16 KEYCODE_ARRAY[] =
KEY_Y | KEY_SHIFT | KEY_MOD2,
KEY_Z | KEY_SHIFT | KEY_MOD2,
KEY_SEMICOLON | KEY_SHIFT | KEY_MOD2 ,
+ KEY_QUOTERIGHT | KEY_SHIFT | KEY_MOD2 ,
KEY_BRACKETLEFT | KEY_SHIFT | KEY_MOD2 ,
KEY_BRACKETRIGHT | KEY_SHIFT | KEY_MOD2,
KEY_POINT | KEY_SHIFT | KEY_MOD2,
@@ -564,6 +568,7 @@ static const sal_uInt16 KEYCODE_ARRAY[] =
KEY_Y | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_Z | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_SEMICOLON | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
+ KEY_QUOTERIGHT | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_BRACKETLEFT | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_BRACKETRIGHT | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_POINT | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
diff --git a/framework/source/accelerators/keymapping.cxx b/framework/source/accelerators/keymapping.cxx
index c13007b..c07231b 100644
--- a/framework/source/accelerators/keymapping.cxx
+++ b/framework/source/accelerators/keymapping.cxx
@@ -135,6 +135,7 @@ KeyMapping::KeyIdentifierInfo KeyMapping::KeyIdentifierMap[] =
{css::awt::Key::BRACKETLEFT , "KEY_BRACKETLEFT" },
{css::awt::Key::BRACKETRIGHT , "KEY_BRACKETRIGHT" },
{css::awt::Key::SEMICOLON , "KEY_SEMICOLON" },
+ {css::awt::Key::QUOTERIGHT , "KEY_QUOTERIGHT" },
{0 , "" } // mark the end of this array!
};
diff --git a/include/vcl/keycodes.hxx b/include/vcl/keycodes.hxx
index 9644561..271ff61 100644
--- a/include/vcl/keycodes.hxx
+++ b/include/vcl/keycodes.hxx
@@ -145,6 +145,7 @@
#define KEY_BRACKETLEFT ((sal_uInt16)::com::sun::star::awt::Key::BRACKETLEFT)
#define KEY_BRACKETRIGHT ((sal_uInt16)::com::sun::star::awt::Key::BRACKETRIGHT)
#define KEY_SEMICOLON ((sal_uInt16)::com::sun::star::awt::Key::SEMICOLON)
+#define KEY_QUOTERIGHT ((sal_uInt16)::com::sun::star::awt::Key::QUOTERIGHT)
#define KEY_CAPSLOCK ((sal_uInt16)::com::sun::star::awt::Key::CAPSLOCK)
#define KEY_NUMLOCK ((sal_uInt16)::com::sun::star::awt::Key::NUMLOCK)
diff --git a/offapi/com/sun/star/awt/Key.idl b/offapi/com/sun/star/awt/Key.idl
index 21636bb..5c84843 100644
--- a/offapi/com/sun/star/awt/Key.idl
+++ b/offapi/com/sun/star/awt/Key.idl
@@ -362,6 +362,9 @@ published constants Key
const short SEMICOLON = 1317;
+ const short QUOTERIGHT = 1318;
+
+
const short DELETE_TO_END_OF_PARAGRAPH = 1539;
diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx
index d7231e0..a5cef39 100644
--- a/vcl/unx/generic/app/saldisp.cxx
+++ b/vcl/unx/generic/app/saldisp.cxx
@@ -919,7 +919,9 @@ OUString SalDisplay::GetKeyName( sal_uInt16 nKeyCode ) const
case KEY_SEMICOLON:
aCustomKeyName = ";";
break;
-
+ case KEY_QUOTERIGHT:
+ aCustomKeyName = "'";
+ break;
default:
nKeySym = 0;
break;
@@ -1262,6 +1264,10 @@ sal_uInt16 SalDisplay::GetKeyCode( KeySym keysym, char*pcPrintable ) const
nKey = KEY_SEMICOLON;
*pcPrintable = ';';
break;
+ case XK_quoteright:
+ nKey = KEY_QUOTERIGHT;
+ *pcPrintable = '\'';
+ break;
// - - - - - - - - - - - - - Apollo - - - - - - - - - - - - - 0x1000
case 0x1000FF02: // apXK_Copy
nKey = KEY_COPY;
diff --git a/vcl/unx/gtk/window/gtksalframe.cxx b/vcl/unx/gtk/window/gtksalframe.cxx
index a8207be..b5967e0 100644
--- a/vcl/unx/gtk/window/gtksalframe.cxx
+++ b/vcl/unx/gtk/window/gtksalframe.cxx
@@ -255,6 +255,7 @@ static sal_uInt16 GetKeyCode( guint keyval )
case GDK_bracketleft: nCode = KEY_BRACKETLEFT; break;
case GDK_bracketright: nCode = KEY_BRACKETRIGHT; break;
case GDK_semicolon: nCode = KEY_SEMICOLON; break;
+ case GDK_quoteright: nCode = KEY_QUOTERIGHT; break;
// some special cases, also see saldisp.cxx
// - - - - - - - - - - - - - Apollo - - - - - - - - - - - - - 0x1000
case 0x1000FF02: // apXK_Copy
diff --git a/vcl/unx/gtk/window/gtksalmenu.cxx b/vcl/unx/gtk/window/gtksalmenu.cxx
index 203b9b4..6143e6c 100644
--- a/vcl/unx/gtk/window/gtksalmenu.cxx
+++ b/vcl/unx/gtk/window/gtksalmenu.cxx
@@ -139,6 +139,7 @@ static void KeyCodeToGdkKey ( const KeyCode& rKeyCode, guint* pGdkKeyCode, GdkMo
case KEY_BRACKETLEFT: nKeyCode = GDK_bracketleft; break;
case KEY_BRACKETRIGHT: nKeyCode = GDK_bracketright; break;
case KEY_SEMICOLON: nKeyCode = GDK_semicolon; break;
+ case KEY_QUOTERIGHT: nKeyCode = GDK_quoteright; break;
// Special cases
case KEY_COPY: nKeyCode = GDK_Copy; break;
diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx
index 88a76c3..d01806b 100644
--- a/vcl/win/source/app/salinst.cxx
+++ b/vcl/win/source/app/salinst.cxx
@@ -332,6 +332,7 @@ void SalData::initKeyCodeMap()
initKey( '[', KEY_BRACKETLEFT );
initKey( ']', KEY_BRACKETRIGHT );
initKey( ';', KEY_SEMICOLON );
+ initKey( '\'', KEY_QUOTERIGHT );
}
// SalData
diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx
index 90b36e0..2f00cfb 100644
--- a/vcl/win/source/window/salframe.cxx
+++ b/vcl/win/source/window/salframe.cxx
@@ -2550,6 +2550,9 @@ OUString WinSalFrame::GetKeyName( sal_uInt16 nKeyCode )
case KEY_SEMICOLON:
cSVCode = ';';
break;
+ case KEY_QUOTERIGHT:
+ cSVCode = '\'';
+ break;
case KEY_BRACKETLEFT:
cSVCode = '[';
break;
More information about the Libreoffice-commits
mailing list