summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
Diffstat (limited to 'sd')
-rw-r--r--sd/sdi/_drvwsh.sdi4
-rw-r--r--sd/sdi/sdraw.sdi23
-rw-r--r--sd/source/ui/view/drviewse.cxx42
3 files changed, 69 insertions, 0 deletions
diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi
index 2a721d8a7038..2f7769be816b 100644
--- a/sd/sdi/_drvwsh.sdi
+++ b/sd/sdi/_drvwsh.sdi
@@ -96,6 +96,10 @@ interface DrawView
ExecMethod = FuSupport ;
StateMethod = GetMenuState ;
]
+ SID_UNICODE_NOTATION_TOGGLE
+ [
+ ExecMethod = FuSupport;
+ ]
SID_PASTE_UNFORMATTED
[
ExecMethod = FuSupport ;
diff --git a/sd/sdi/sdraw.sdi b/sd/sdi/sdraw.sdi
index d91e21bec36f..5fd19ad8bde8 100644
--- a/sd/sdi/sdraw.sdi
+++ b/sd/sdi/sdraw.sdi
@@ -7208,4 +7208,27 @@ SfxVoidItem MovePageLast SID_MOVE_PAGE_LAST
ToolBoxConfig = TRUE,
GroupId = GID_MODIFY;
]
+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;
+]
diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx
index 0eb9f29177c4..093b46d31665 100644
--- a/sd/source/ui/view/drviewse.cxx
+++ b/sd/source/ui/view/drviewse.cxx
@@ -22,6 +22,7 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/i18n/TransliterationModules.hpp>
#include <com/sun/star/i18n/TransliterationModulesExtra.hpp>
+#include <i18nutil/unicode.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/uno/Any.hxx>
@@ -837,6 +838,47 @@ void DrawViewShell::FuSupport(SfxRequest& rReq)
}
break;
+ case SID_UNICODE_NOTATION_TOGGLE:
+ {
+ if ( mpDrawView->IsTextEdit() )
+ {
+ OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView();
+ if (pOLV)
+ {
+ OUString sInput = pOLV->GetSurroundingText();
+ ESelection aSel( pOLV->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);
+ //The mouse can set the cursor in the middle of a multi-unit character,
+ // so reset to the proper end of the logical characters
+ 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() )
+ {
+ OUString sStringToReplace = aToggle.StringToReplace();
+ mpDrawView->BegUndo(sStringToReplace +"->"+ sReplacement);
+ aSel.nStartPos = aSel.nEndPos - sStringToReplace.getLength();
+ pOLV->SetSelection( aSel );
+ pOLV->InsertText(sReplacement, true);
+ mpDrawView->EndUndo();
+ }
+ }
+ }
+ }
+ break;
+
case SID_PASTE_UNFORMATTED:
{
WaitObject aWait( GetActiveWindow() );