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

tdf#73691 - add alt-x support to math

At the request of bug tdf#94957, adding unicode conversion
shortcut (alt+x) to Math also.

Change-Id: I5b4d17543a819f035ade0d9a516eeef8542a286e
Reviewed-on: https://gerrit.libreoffice.org/19323Reviewed-by: 's avatarSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Tested-by: 's avatarSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
üst d3465703
...@@ -800,6 +800,31 @@ SfxStringItem TextStatus SID_TEXTSTATUS ...@@ -800,6 +800,31 @@ SfxStringItem TextStatus SID_TEXTSTATUS
] ]
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 ToolBoxWindow SID_TOOLBOXWINDOW SfxVoidItem ToolBoxWindow SID_TOOLBOXWINDOW
() ()
[ [
......
...@@ -291,6 +291,10 @@ interface FormulaView ...@@ -291,6 +291,10 @@ interface FormulaView
ExecMethod = Execute ; ExecMethod = Execute ;
StateMethod = GetState ; StateMethod = GetState ;
] ]
SID_UNICODE_NOTATION_TOGGLE
[
ExecMethod = Execute;
]
//idlpp kein Menueeintrag , also keine Texte //idlpp kein Menueeintrag , also keine Texte
SID_TOOLBOXWINDOW //idlpp ole : no , status : no SID_TOOLBOXWINDOW //idlpp ole : no , status : no
[ [
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <comphelper/storagehelper.hxx> #include <comphelper/storagehelper.hxx>
#include <comphelper/string.hxx> #include <comphelper/string.hxx>
#include <i18nutil/unicode.hxx>
#include <sfx2/app.hxx> #include <sfx2/app.hxx>
#include <sfx2/dispatch.hxx> #include <sfx2/dispatch.hxx>
#include <sfx2/docfile.hxx> #include <sfx2/docfile.hxx>
...@@ -52,6 +53,7 @@ ...@@ -52,6 +53,7 @@
#include <svx/dialogs.hrc> #include <svx/dialogs.hrc>
#include <svx/zoomslideritem.hxx> #include <svx/zoomslideritem.hxx>
#include <editeng/editeng.hxx> #include <editeng/editeng.hxx>
#include <editeng/editview.hxx>
#include <svx/svxdlg.hxx> #include <svx/svxdlg.hxx>
#include <sfx2/zoomitem.hxx> #include <sfx2/zoomitem.hxx>
#include <vcl/decoview.hxx> #include <vcl/decoview.hxx>
...@@ -1844,6 +1846,51 @@ void SmViewShell::Execute(SfxRequest& rReq) ...@@ -1844,6 +1846,51 @@ void SmViewShell::Execute(SfxRequest& rReq)
} }
break; break;
case SID_UNICODE_NOTATION_TOGGLE:
{
EditEngine* pEditEngine = 0;
if( pWin )
pEditEngine = pWin->GetEditEngine();
EditView* pEditView = 0;
if( pEditEngine )
pEditView = pEditEngine->GetView();
if( pEditView )
{
const OUString sInput = pEditView->GetSurroundingText();
ESelection aSel( pWin->GetSelection() );
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;
while( nUtf16Pos && aToggle.AllowMoreInput( sInput[nUtf16Pos-1]) )
--nUtf16Pos;
const OUString sReplacement = aToggle.ReplacementString();
if( !sReplacement.isEmpty() )
{
pEditView->SetSelection( aSel );
pEditEngine->UndoActionStart(EDITUNDO_REPLACEALL);
aSel.nStartPos = aSel.nEndPos - aToggle.StringToReplace().getLength();
pWin->SetSelection( aSel );
pEditView->InsertText( sReplacement, true );
pEditEngine->UndoActionEnd(EDITUNDO_REPLACEALL);
pWin->Flush();
}
}
}
break;
case SID_SYMBOLS_CATALOGUE: case SID_SYMBOLS_CATALOGUE:
{ {
......
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