[Libreoffice-commits] core.git: 2 commits - qadevOOo/runner starmath/sdi starmath/source
Justin Luth
justin_luth at sil.org
Thu Oct 15 06:36:47 PDT 2015
qadevOOo/runner/util/ValueChanger.java | 12 +++++---
starmath/sdi/smath.sdi | 25 +++++++++++++++++
starmath/sdi/smslots.sdi | 4 ++
starmath/source/view.cxx | 47 +++++++++++++++++++++++++++++++++
4 files changed, 84 insertions(+), 4 deletions(-)
New commits:
commit 6212c467156e2bd4580a9f8145124223d3135ea4
Author: Justin Luth <justin_luth at sil.org>
Date: Tue Oct 13 16:42:16 2015 +0300
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/19323
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
diff --git a/starmath/sdi/smath.sdi b/starmath/sdi/smath.sdi
index bbf5a6b..29d4c60 100644
--- a/starmath/sdi/smath.sdi
+++ b/starmath/sdi/smath.sdi
@@ -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
()
[
diff --git a/starmath/sdi/smslots.sdi b/starmath/sdi/smslots.sdi
index a43eb7c..d00382d 100644
--- a/starmath/sdi/smslots.sdi
+++ b/starmath/sdi/smslots.sdi
@@ -291,6 +291,10 @@ interface FormulaView
ExecMethod = Execute ;
StateMethod = GetState ;
]
+ SID_UNICODE_NOTATION_TOGGLE
+ [
+ ExecMethod = Execute;
+ ]
//idlpp kein Menueeintrag , also keine Texte
SID_TOOLBOXWINDOW //idlpp ole : no , status : no
[
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index ad512b1..07cfe8c 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -29,6 +29,7 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/storagehelper.hxx>
#include <comphelper/string.hxx>
+#include <i18nutil/unicode.hxx>
#include <sfx2/app.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/docfile.hxx>
@@ -52,6 +53,7 @@
#include <svx/dialogs.hrc>
#include <svx/zoomslideritem.hxx>
#include <editeng/editeng.hxx>
+#include <editeng/editview.hxx>
#include <svx/svxdlg.hxx>
#include <sfx2/zoomitem.hxx>
#include <vcl/decoview.hxx>
@@ -1844,6 +1846,51 @@ void SmViewShell::Execute(SfxRequest& rReq)
}
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:
{
commit d3465703c9d6f7a6277398337a5e9df3a8df0d19
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Oct 15 15:35:56 2015 +0200
com.sun.star.lang.Locale does not override Object.equals
Change-Id: I4a443ce900252b171bd028e945971818fb2cc7ef
diff --git a/qadevOOo/runner/util/ValueChanger.java b/qadevOOo/runner/util/ValueChanger.java
index df54d5b..4afac0a 100644
--- a/qadevOOo/runner/util/ValueChanger.java
+++ b/qadevOOo/runner/util/ValueChanger.java
@@ -107,10 +107,14 @@ public class ValueChanger {
else
newValue = OR1;
} else if (oldValue instanceof com.sun.star.lang.Locale) {
- Object Loc1 = new com.sun.star.lang.Locale("en", "US", "");
- Object Loc2 = new com.sun.star.lang.Locale("de", "DE", "");
-
- if (oldValue.equals(Loc1))
+ com.sun.star.lang.Locale Loc1 = new com.sun.star.lang.Locale(
+ "en", "US", "");
+ com.sun.star.lang.Locale Loc2 = new com.sun.star.lang.Locale(
+ "de", "DE", "");
+ com.sun.star.lang.Locale old = (com.sun.star.lang.Locale) oldValue;
+ if (old.Language.equals(Loc1.Language)
+ && old.Country.equals(Loc1.Country)
+ && old.Variant.equals(Loc1.Variant))
newValue = Loc2;
else
newValue = Loc1;
More information about the Libreoffice-commits
mailing list