Kaydet (Commit) 7c9a4842 authored tarafından Justin Luth's avatar Justin Luth Kaydeden (comit) Samuel Mehrbrodt

tdf#73691 - add alt-x support to calc

Alt-X (Unicode notation toggling) was added to Writer
and Draw/Impress in earlier.  This adds it to Calc as well.

Change-Id: Ieb5188b9ff35cb35941c36d22292069723df80b6
Reviewed-on: https://gerrit.libreoffice.org/18558Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Tested-by: 's avatarSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
üst e9e5fee7
......@@ -43,6 +43,8 @@ interface TableText
SID_REDO [ ExecMethod = ExecuteUndo; StateMethod = GetUndoState; Export = FALSE; ]
SID_REPEAT [ ExecMethod = ExecuteUndo; StateMethod = GetUndoState; Export = FALSE; ]
SID_UNICODE_NOTATION_TOGGLE [ ExecMethod = Execute; Export = FALSE; ]
// ---- Attribute:
SID_ATTR_CHAR_FONT [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ]
SID_ATTR_CHAR_FONTHEIGHT [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ]
......
......@@ -8903,6 +8903,30 @@ SfxVoidItem ConvertFormulaToValue SID_CONVERT_FORMULA_TO_VALUE
GroupId = GID_OPTIONS;
]
SfxVoidItem UnicodeNotationToggle SID_UNICODE_NOTATION_TOGGLE
()
[
/* flags: */
AutoUpdate = FALSE,
Cachable = Cachable,
FastCall = FALSE,
HasCoreId = FALSE,
HasDialog = FALSE,
ReadOnlyDoc = FALSE,
Toggle = FALSE,
Container = FALSE,
RecordAbsolute = FALSE,
RecordPerSet;
Synchron;
/* config: */
AccelConfig = TRUE,
MenuConfig = FALSE,
StatusBarConfig = FALSE,
ToolBoxConfig = FALSE,
GroupId = GID_OPTIONS;
]
SfxVoidItem ShowDetail SID_OUTLINE_SHOW
()
[
......
......@@ -21,6 +21,7 @@
#include <comphelper/string.hxx>
#include "scitems.hxx"
#include <editeng/eeitem.hxx>
#include <i18nutil/unicode.hxx>
#include <svx/clipfmtitem.hxx>
#include <svx/svxdlg.hxx>
......@@ -331,6 +332,46 @@ void ScEditShell::Execute( SfxRequest& rReq )
bSetModified = false;
}
return;
case SID_UNICODE_NOTATION_TOGGLE:
{
EditView* pActiveView = pHdl ? pHdl->GetActiveView() : pEditView;
if( pActiveView )
{
OUString sInput = pEngine->GetText();
ESelection aSel( pActiveView->GetSelection() );
if( aSel.HasRange() )
sInput = pActiveView->GetSelected();
if( aSel.nStartPos > aSel.nEndPos )
aSel.nEndPos = aSel.nStartPos;
//calculate a valid end-position by reading logical characters
sal_Int32 nUtf16Pos=0;
while( (nUtf16Pos < sInput.getLength()) && (nUtf16Pos < aSel.nEndPos) )
{
sInput.iterateCodePoints(&nUtf16Pos);
if( nUtf16Pos > aSel.nEndPos )
aSel.nEndPos = nUtf16Pos;
}
ToggleUnicodeCodepoint aToggle = ToggleUnicodeCodepoint();
while( nUtf16Pos && aToggle.AllowMoreInput( sInput[nUtf16Pos-1]) )
--nUtf16Pos;
OUString sReplacement = aToggle.ReplacementString();
if( !sReplacement.isEmpty() )
{
aSel.nStartPos = aSel.nEndPos - aToggle.StringToReplace().getLength();
pTableView->SetSelection( aSel );
pTableView->InsertText(sReplacement, true);
if( pTopView )
{
pTopView->SetSelection( aSel );
pTopView->InsertText(sReplacement, true);
}
}
}
}
break;
case SID_CHARMAP:
{
......
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