Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Hi,

Here is a modification. (Shift+F3 is not hardcoded)

Balint

2011. március 16. 17:56 Bálint Dózsa írta, <dozsabalint@gmail.com>:

Thanks for helping.
I'm working on it

Balint

2011. március 15. 17:43 Caolán McNamara írta, <caolanm@redhat.com>:

On Wed, 2011-03-09 at 15:50 +0100, Bálint Dózsa wrote:
Hi,

Here is the correction patch

This looks reasonable so far, though it might be better to avoid
hardcoding a "case KEY_F3 | KEY_SHIFT" to run this stuff, and instead
move it around a bit to make it configurable, (though that seems like a
good default)

Doing it the configurable way is a bit[1] involved, but here's the rough
guide

search for something similar, e.g. SID_TRANSLITERATE_TOGGLE_CASE

starting at
http://opengrok.libreoffice.org/xref/libs-core/svx/inc/svx/svxids.hrc
add a new one, e.g. SID_TRANSLITERATE_ROTATE_CASE

In svx/sdi/svx.sdi copy and paste the
SfxVoidItem ChangeCaseToToggleCase SID_TRANSLITERATE_TOGGLE_CASE entry
to e.g.
SfxVoidItem ChangeCaseRotateCase SID_TRANSLITERATE_ROTATE_CASE

Where SID_TRANSLITERATE_TOGGLE_CASE appears in the other .sdi files (use
opengrok to find them, e.g. sw/sdi/_textsh.sdi) add an entry for
SID_TRANSLITERATE_ROTATE_CASE by copying and pasting the
SID_TRANSLITERATE_ROTATE_CASE one except change the impl name e.g.
ExecTransliteration -> ExecRotateTransliteration

For writer you can then implement ExecRotateTransliteration like you've
already done to call TransliterateText with a nMode which advances from
the previous one on each attempt.

In officecfg/registry grep for ChangeCaseToToggleCase and some cut and
paste to give yourself a ChangeCaseRotateCase entry in there

To set an accelerator key combo for it then see
officecfg/registry/data/org/openoffice/Office/Accelerators.xcu
Doing is this involved way allows the feature to appear in
tools->customize->keyboard etc.

C.

[1] understatement of the year



From db58c931a99edbf2e027bc52688af02c0eaaa92e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?D=C3=B3zsa=20B=C3=A1lint?= <dozsa@linux-dugf.site>
Date: Wed, 16 Mar 2011 21:28:44 +0100
Subject: [PATCH] FIX BUG 32559

---
 .../data/org/openoffice/Office/Accelerators.xcu    |   30 ++++++++++++++++++++
 .../org/openoffice/Office/UI/GenericCommands.xcu   |    5 +++
 svx/inc/svx/svxids.hrc                             |    3 +-
 svx/sdi/svx.sdi                                    |   25 ++++++++++++++++
 4 files changed, 62 insertions(+), 1 deletions(-)

diff --git a/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu 
b/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu
index 04141b3..de1380a 100755
--- a/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu
@@ -1556,6 +1556,11 @@
       <value xml:lang="en-US">.uno:EditGlossary</value>
      </prop>
     </node>
+    <node oor:name="F3_SHIFT" oor:op="replace">
+     <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO 
TRANSLATE</value>
+      <value xml:lang="en-US">.uno:ChangeCaseRotateCase</value>
+     </prop>
+    </node>
     <node oor:name="F4_SHIFT" oor:op="replace">
      <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO 
TRANSLATE</value>
       <value xml:lang="en-US">.uno:JumpToNextFrame</value>
@@ -2597,6 +2602,11 @@
       <value xml:lang="en-US">.uno:EditGlossary</value>
      </prop>
     </node>
+    <node oor:name="F3_SHIFT" oor:op="replace">
+     <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO 
TRANSLATE</value>
+      <value xml:lang="en-US">.uno:ChangeCaseRotateCase</value>
+     </prop>
+    </node>
     <node oor:name="F4_SHIFT" oor:op="replace">
      <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO 
TRANSLATE</value>
       <value xml:lang="en-US">.uno:JumpToNextFrame</value>
@@ -3222,6 +3232,11 @@
       <value xml:lang="en-US">.uno:EditGlossary</value>
      </prop>
     </node>
+    <node oor:name="F3_SHIFT" oor:op="replace">
+     <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO 
TRANSLATE</value>
+      <value xml:lang="en-US">.uno:ChangeCaseRotateCase</value>
+     </prop>
+    </node>
     <node oor:name="F4_SHIFT" oor:op="replace">
      <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO 
TRANSLATE</value>
       <value xml:lang="en-US">.uno:JumpToNextFrame</value>
@@ -3847,6 +3862,11 @@
       <value xml:lang="en-US">.uno:EditGlossary</value>
      </prop>
     </node>
+    <node oor:name="F3_SHIFT" oor:op="replace">
+     <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO 
TRANSLATE</value>
+      <value xml:lang="en-US">.uno:ChangeCaseRotateCase</value>
+     </prop>
+    </node>
     <node oor:name="F4_SHIFT" oor:op="replace">
      <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO 
TRANSLATE</value>
       <value xml:lang="en-US">.uno:JumpToNextFrame</value>
@@ -4457,6 +4477,11 @@
       <value xml:lang="en-US">.uno:EditGlossary</value>
      </prop>
     </node>
+    <node oor:name="F3_SHIFT" oor:op="replace">
+     <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO 
TRANSLATE</value>
+      <value xml:lang="en-US">.uno:ChangeCaseRotateCase</value>
+     </prop>
+    </node>
     <node oor:name="F4_SHIFT" oor:op="replace">
      <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO 
TRANSLATE</value>
       <value xml:lang="en-US">.uno:JumpToNextFrame</value>
@@ -5072,6 +5097,11 @@
       <value xml:lang="en-US">.uno:EditGlossary</value>
      </prop>
     </node>
+    <node oor:name="F3_SHIFT" oor:op="replace">
+     <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO 
TRANSLATE</value>
+      <value xml:lang="en-US">.uno:ChangeCaseRotateCase</value>
+     </prop>
+    </node>
     <node oor:name="F4_SHIFT" oor:op="replace">
      <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO 
TRANSLATE</value>
       <value xml:lang="en-US">.uno:JumpToNextFrame</value>
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu 
b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
index ea2485e..c2ec267 100755
--- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
@@ -2160,6 +2160,11 @@
                     <value xml:lang="en-US">~tOGGLE cASE</value>
                 </prop>
             </node>
+            <node oor:name=".uno:ChangeCaseRotateCase" oor:op="replace">
+                <prop oor:name="Label" oor:type="xs:string">
+                    <value xml:lang="en-US">Rotate case (Title Case, UPPERCASE, lowercase)</value>
+                </prop>
+            </node>
             <node oor:name=".uno:ChangeCaseToHalfWidth" oor:op="replace">
                 <prop oor:name="Label" oor:type="xs:string">
                     <value xml:lang="en-US">H~alf-width</value>
diff --git a/svx/inc/svx/svxids.hrc b/svx/inc/svx/svxids.hrc
index 01323c3..9bf3cb6 100755
--- a/svx/inc/svx/svxids.hrc
+++ b/svx/inc/svx/svxids.hrc
@@ -1260,9 +1260,10 @@
 #define SID_TRANSLITERATE_SENTENCE_CASE                 (SID_SVX_START+1102)
 #define SID_TRANSLITERATE_TITLE_CASE                    (SID_SVX_START+1103)
 #define SID_TRANSLITERATE_TOGGLE_CASE                   (SID_SVX_START+1104)
+#define SID_TRANSLITERATE_ROTATE_CASE                   (SID_SVX_START+1105)
 
 // IMPORTANT NOTE: adjust SID_SVX_FIRSTFREE, when adding new slot id
-#define SID_SVX_FIRSTFREE                                                              
(SID_TRANSLITERATE_TOGGLE_CASE + 1)
+#define SID_SVX_FIRSTFREE                                                              
(SID_TRANSLITERATE_ROTATE_CASE + 1)
 
 // --------------------------------------------------------------------------
 // Overflow check for slot IDs
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
index c5069ad..fee8433 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -1530,6 +1530,31 @@ SfxVoidItem ChangeCaseToToggleCase SID_TRANSLITERATE_TOGGLE_CASE
 ]
 
 //--------------------------------------------------------------------------
+SfxVoidItem ChangeCaseRotateCase SID_TRANSLITERATE_ROTATE_CASE
+()
+[
+    /* flags: */
+    AutoUpdate = TRUE,
+    Cachable = Cachable,
+    FastCall = TRUE,
+    HasCoreId = FALSE,
+    HasDialog = FALSE,
+    ReadOnlyDoc = FALSE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+    Asynchron;
+
+    /* config: */
+    AccelConfig = TRUE,
+    MenuConfig = TRUE,
+    StatusBarConfig = FALSE,
+    ToolBoxConfig = TRUE,
+    GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
 SfxVoidItem ChangeCaseToLower SID_TRANSLITERATE_LOWER
 ()
 [
-- 
1.7.3.4

From 2ea56e72835e8d5513436ac703a298fc715289ca Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?D=C3=B3zsa=20B=C3=A1lint?= <dozsa@linux-dugf.site>
Date: Wed, 16 Mar 2011 21:31:14 +0100
Subject: [PATCH] FIX BUG 32559

---
 sw/sdi/_textsh.sdi             |    6 ++++++
 sw/source/ui/inc/textsh.hxx    |    2 ++
 sw/source/ui/shells/textsh.cxx |   30 +++++++++++++++++++++++++++++-
 3 files changed, 37 insertions(+), 1 deletions(-)

diff --git a/sw/sdi/_textsh.sdi b/sw/sdi/_textsh.sdi
index a895cc5..e1898e1 100644
--- a/sw/sdi/_textsh.sdi
+++ b/sw/sdi/_textsh.sdi
@@ -1503,6 +1503,12 @@ interface BaseText
         StateMethod = NoState ;
         DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
     ]
+    SID_TRANSLITERATE_ROTATE_CASE
+    [
+        ExecMethod = ExecRotateTransliteration;
+        StateMethod = NoState ;
+        DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+    ]
     SID_TRANSLITERATE_UPPER
     [
         ExecMethod = ExecTransliteration;
diff --git a/sw/source/ui/inc/textsh.hxx b/sw/source/ui/inc/textsh.hxx
index a8215b6..3dc6069 100644
--- a/sw/source/ui/inc/textsh.hxx
+++ b/sw/source/ui/inc/textsh.hxx
@@ -43,6 +43,7 @@ class SwTextShell: public SwBaseShell
     void InsertHyperlink(const SvxHyperlinkItem& rHlnkItem);
     bool InsertMediaDlg( SfxRequest& );
     void ChangeHeaderOrFooter(const String& rStyleName, BOOL bHeader, BOOL bOn, BOOL bShowWarning);
+    sal_uInt32  nF3ShiftCounter;
 
 public:
     SFX_DECL_INTERFACE(SW_TEXTSHELL)
@@ -77,6 +78,7 @@ public:
     void       ExecAttr(SfxRequest &);
     void       ExecDB(SfxRequest &);
     void       ExecTransliteration(SfxRequest &);
+    void       ExecRotateTransliteration(SfxRequest &);
 
     void       GetAttrState(SfxItemSet &);
 
diff --git a/sw/source/ui/shells/textsh.cxx b/sw/source/ui/shells/textsh.cxx
index d768df8..00bbfe8 100644
--- a/sw/source/ui/shells/textsh.cxx
+++ b/sw/source/ui/shells/textsh.cxx
@@ -1038,8 +1038,36 @@ void SwTextShell::ExecTransliteration( SfxRequest & rReq )
     }
 }
 
+void SwTextShell::ExecRotateTransliteration( SfxRequest & rReq )
+{
+    using namespace ::com::sun::star::i18n;
+    {
+        sal_uInt32 nMode = 0;
+
+        if( rReq.GetSlot() == SID_TRANSLITERATE_ROTATE_CASE ) {
+            switch ( nF3ShiftCounter ) {
+                case 0:
+                    nMode = TransliterationModulesExtra::TITLE_CASE;
+                    break;
+                case 1:
+                    nMode = TransliterationModules_LOWERCASE_UPPERCASE;
+                    break;
+                case 2:
+                    nMode = TransliterationModules_UPPERCASE_LOWERCASE;
+                    nF3ShiftCounter = -1;
+                    break;
+            }
+
+            if ( nMode )
+                GetShell().TransliterateText( nMode );
+
+            nF3ShiftCounter++;
+        }
+    }
+}
+
 SwTextShell::SwTextShell(SwView &_rView) :
-    SwBaseShell(_rView), pPostItFldMgr( 0 )
+    SwBaseShell(_rView), pPostItFldMgr( 0 ), nF3ShiftCounter(0)
 {
     SetName(String::CreateFromAscii("Text"));
     SetHelpId(SW_TEXTSHELL);
-- 
1.7.3.4


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.