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


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2452

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/52/2452/1

Remove dead voice command code

I don't see voice input commands being generated anywhere. Nobody seems to
know what this code has been used for.

Change-Id: I4e4221dd4dff76086d0268be286c3605e669bae7
---
M editeng/source/editeng/impedit2.cxx
M sc/source/ui/app/inputwin.cxx
M sc/source/ui/view/gridwin.cxx
M sw/inc/pch/precompiled_sw.hxx
M sw/source/ui/docvw/edtwin.cxx
M vcl/Package_inc.mk
D vcl/inc/vcl/cmdevt.h
M vcl/inc/vcl/cmdevt.hxx
M vcl/source/control/edit.cxx
9 files changed, 2 insertions(+), 366 deletions(-)



diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 8129570..d34a387 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -49,7 +49,6 @@
 #include <editeng/frmdiritem.hxx>
 #include <editeng/fontitem.hxx>
 #include <editeng/justifyitem.hxx>
-#include <vcl/cmdevt.h>
 
 #include <com/sun/star/i18n/CharacterIteratorMode.hpp>
 #include <com/sun/star/i18n/WordType.hpp>
@@ -348,110 +347,7 @@
 {
     GetSelEngine().SetCurView( pView );
     SetActiveView( pView );
-    if ( rCEvt.GetCommand() == COMMAND_VOICE )
-    {
-        const CommandVoiceData* pData = rCEvt.GetVoiceData();
-        if ( pData->GetType() == VOICECOMMANDTYPE_DICTATION )
-        {
-            // Turn functions into KeyEvent if no corresponding method to
-            // EditView/EditEngine so that Undo remains consistent.
-            SfxPoolItem* pNewAttr = NULL;
-
-            switch ( pData->GetCommand() )
-            {
-                case DICTATIONCOMMAND_UNKNOWN:
-                {
-                    pView->InsertText( pData->GetText() );
-                }
-                break;
-                case DICTATIONCOMMAND_NEWPARAGRAPH:
-                {
-                    pView->PostKeyEvent( KeyEvent( 0, KeyCode( KEY_RETURN, 0 ) ) );
-                }
-                break;
-                case DICTATIONCOMMAND_NEWLINE:
-                {
-                    pView->PostKeyEvent( KeyEvent( 0, KeyCode( KEY_RETURN, KEY_SHIFT ) ) );
-                }
-                break;
-                case DICTATIONCOMMAND_TAB:
-                {
-                    pView->PostKeyEvent( KeyEvent( 0, KeyCode( KEY_TAB, 0 ) ) );
-                }
-                break;
-                case DICTATIONCOMMAND_LEFT:
-                {
-                    pView->PostKeyEvent( KeyEvent( 0, KeyCode( KEY_LEFT, KEY_MOD1  ) ) );
-                }
-                break;
-                case DICTATIONCOMMAND_RIGHT:
-                {
-                    pView->PostKeyEvent( KeyEvent( 0, KeyCode( KEY_RIGHT, KEY_MOD1  ) ) );
-                }
-                break;
-                case DICTATIONCOMMAND_UP:
-                {
-                    pView->PostKeyEvent( KeyEvent( 0, KeyCode( KEY_UP, 0 ) ) );
-                }
-                break;
-                case DICTATIONCOMMAND_DOWN:
-                {
-                    pView->PostKeyEvent( KeyEvent( 0, KeyCode( KEY_UP, 0 ) ) );
-                }
-                break;
-                case DICTATIONCOMMAND_UNDO:
-                {
-                    pView->Undo();
-                }
-                break;
-                case DICTATIONCOMMAND_DEL:
-                {
-                    pView->PostKeyEvent( KeyEvent( 0, KeyCode( KEY_LEFT, KEY_MOD1|KEY_SHIFT  ) ) );
-                    pView->DeleteSelected();
-                }
-                break;
-                case DICTATIONCOMMAND_BOLD_ON:
-                {
-                    pNewAttr = new SvxWeightItem( WEIGHT_BOLD, EE_CHAR_WEIGHT );
-                }
-                break;
-                case DICTATIONCOMMAND_BOLD_OFF:
-                {
-                    pNewAttr = new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT );
-                }
-                break;
-                case DICTATIONCOMMAND_ITALIC_ON:
-                {
-                    pNewAttr = new SvxPostureItem( ITALIC_NORMAL, EE_CHAR_ITALIC );
-                }
-                break;
-                case DICTATIONCOMMAND_ITALIC_OFF:
-                {
-                    pNewAttr = new SvxPostureItem( ITALIC_NORMAL, EE_CHAR_ITALIC );
-                }
-                break;
-                case DICTATIONCOMMAND_UNDERLINE_ON:
-                {
-                    pNewAttr = new SvxUnderlineItem( UNDERLINE_SINGLE, EE_CHAR_UNDERLINE );
-                }
-                break;
-                case DICTATIONCOMMAND_UNDERLINE_OFF:
-                {
-                    pNewAttr = new SvxUnderlineItem( UNDERLINE_NONE, EE_CHAR_UNDERLINE );
-                }
-                break;
-            }
-
-            if ( pNewAttr )
-            {
-                SfxItemSet aSet( GetEmptyItemSet() );
-                aSet.Put( *pNewAttr );
-                pView->SetAttribs( aSet );
-                delete pNewAttr;
-            }
-        }
-    }
-    else if ( rCEvt.GetCommand() == COMMAND_STARTEXTTEXTINPUT )
+    if ( rCEvt.GetCommand() == COMMAND_STARTEXTTEXTINPUT )
     {
         pView->DeleteSelected();
         delete mpIMEInfos;
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index bd2cc81..fb85f3d 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -1565,7 +1565,7 @@
 {
     bInputMode = sal_True;
     sal_uInt16 nCommand = rCEvt.GetCommand();
-    if ( pEditView /* && ( nCommand == COMMAND_STARTDRAG || nCommand == COMMAND_VOICE ) */ )
+    if ( pEditView /* && nCommand == COMMAND_STARTDRAG */ )
     {
         ScModule* pScMod = SC_MOD();
         ScTabViewShell* pStartViewSh = ScTabViewShell::GetActiveViewShell();
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 9aebe4b..4663fa4 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -2840,34 +2840,6 @@
         return;
     }
 
-    if ( nCmd == COMMAND_VOICE )
-    {
-        //  Der Handler wird nur gerufen, wenn ein Text-Cursor aktiv ist,
-        //  also muss es eine EditView oder ein editiertes Zeichenobjekt geben
-
-        ScInputHandler* pHdl = pScMod->GetInputHdl( pViewData->GetViewShell() );
-        if ( pHdl && pViewData->HasEditView( eWhich ) )
-        {
-            EditView* pEditView = pViewData->GetEditView( eWhich ); // ist dann nicht 0
-            pHdl->DataChanging();
-            pEditView->Command( rCEvt );
-            pHdl->DataChanged();
-            return;                                     // erledigt
-        }
-        SdrView* pSdrView = pViewData->GetView()->GetSdrView();
-        if ( pSdrView )
-        {
-            OutlinerView* pOlView = pSdrView->GetTextEditOutlinerView();
-            if ( pOlView && pOlView->GetWindow() == this )
-            {
-                pOlView->Command( rCEvt );
-                return;                                 // erledigt
-            }
-        }
-        Window::Command(rCEvt);     //  sonst soll sich die Basisklasse drum kuemmern...
-        return;
-    }
-
     if ( nCmd == COMMAND_PASTESELECTION )
     {
         if ( bEEMouse )
diff --git a/sw/inc/pch/precompiled_sw.hxx b/sw/inc/pch/precompiled_sw.hxx
index 024fdb7..22930ff 100644
--- a/sw/inc/pch/precompiled_sw.hxx
+++ b/sw/inc/pch/precompiled_sw.hxx
@@ -1004,7 +1004,6 @@
 #include <vcl/bitmap.hxx>
 #include <vcl/builder.hxx>
 #include <vcl/button.hxx>
-#include <vcl/cmdevt.h>
 #include <vcl/cmdevt.hxx>
 #include <vcl/decoview.hxx>
 #include <vcl/dialog.hxx>
diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
index f9475d3..cd5c25d 100644
--- a/sw/source/ui/docvw/edtwin.cxx
+++ b/sw/source/ui/docvw/edtwin.cxx
@@ -32,7 +32,6 @@
 #include <vcl/help.hxx>
 #include <vcl/graph.hxx>
 #include <vcl/msgbox.hxx>
-#include <vcl/cmdevt.h>
 #include <sot/storage.hxx>
 #include <svl/macitem.hxx>
 #include <unotools/securityoptions.hxx>
@@ -5051,95 +5050,6 @@
             if( pShadCrsr )
                 delete pShadCrsr, pShadCrsr = 0;
             bCallBase = !rView.HandleWheelCommands( rCEvt );
-            break;
-
-        case COMMAND_VOICE:
-            {
-                // forward to Outliner if applicable
-                if ( rSh.HasDrawView() && rSh.GetDrawView()->IsTextEdit() )
-                {
-                    bCallBase = false;
-                    rSh.GetDrawView()->GetTextEditOutlinerView()->Command( rCEvt );
-                    break;
-                }
-
-                const CommandVoiceData *pCData = rCEvt.GetVoiceData();
-                if ( VOICECOMMANDTYPE_CONTROL == pCData->GetType() )
-                    break;
-
-                sal_uInt16 nSlotId = 0;
-                SfxPoolItem *pItem = 0;
-
-                switch ( pCData->GetCommand() )
-                {
-                    case DICTATIONCOMMAND_NEWPARAGRAPH: nSlotId = FN_INSERT_BREAK; break;
-                    case DICTATIONCOMMAND_NEWLINE:      nSlotId = FN_INSERT_LINEBREAK; break;
-                    case DICTATIONCOMMAND_LEFT:         nSlotId = FN_PREV_WORD; break;
-                    case DICTATIONCOMMAND_RIGHT:        nSlotId = FN_NEXT_WORD; break;
-                    case DICTATIONCOMMAND_UP:           nSlotId = FN_LINE_UP; break;
-                    case DICTATIONCOMMAND_DOWN:         nSlotId = FN_LINE_DOWN; break;
-                    case DICTATIONCOMMAND_UNDO:         nSlotId = SID_UNDO; break;
-                    case DICTATIONCOMMAND_REPEAT:       nSlotId = SID_REPEAT; break;
-                    case DICTATIONCOMMAND_DEL:          nSlotId = FN_DELETE_BACK_WORD; break;
-
-                    case DICTATIONCOMMAND_BOLD_ON:      nSlotId = SID_ATTR_CHAR_WEIGHT;
-                                                        pItem = new SvxWeightItem( WEIGHT_BOLD, 
RES_CHRATR_WEIGHT );
-                                                        break;
-                    case DICTATIONCOMMAND_BOLD_OFF:     nSlotId = SID_ATTR_CHAR_WEIGHT;
-                                                        pItem = new SvxWeightItem( WEIGHT_NORMAL, 
RES_CHRATR_WEIGHT );
-                                                        break;
-                    case DICTATIONCOMMAND_UNDERLINE_ON: nSlotId = SID_ATTR_CHAR_UNDERLINE;
-                                                        pItem = new SvxUnderlineItem( 
UNDERLINE_SINGLE, RES_CHRATR_WEIGHT );
-                                                        break;
-                    case DICTATIONCOMMAND_UNDERLINE_OFF:nSlotId = SID_ATTR_CHAR_UNDERLINE;
-                                                        pItem = new SvxUnderlineItem( 
UNDERLINE_NONE, RES_CHRATR_UNDERLINE );
-                                                        break;
-                    case DICTATIONCOMMAND_ITALIC_ON:    nSlotId = SID_ATTR_CHAR_POSTURE;
-                                                        pItem = new SvxPostureItem( ITALIC_NORMAL, 
RES_CHRATR_POSTURE );
-                                                        break;
-                    case DICTATIONCOMMAND_ITALIC_OFF:   nSlotId = SID_ATTR_CHAR_POSTURE;
-                                                        pItem = new SvxPostureItem( ITALIC_NONE, 
RES_CHRATR_POSTURE );
-                                                        break;
-                    case DICTATIONCOMMAND_NUMBERING_ON:
-                                    if ( !rSh.GetCurNumRule() )
-                                        nSlotId = FN_NUM_NUMBERING_ON;
-                                    break;
-                    case DICTATIONCOMMAND_NUMBERING_OFF:
-                                    if ( rSh.GetCurNumRule() )
-                                       nSlotId = FN_NUM_NUMBERING_ON;
-                                    break;
-                    case DICTATIONCOMMAND_TAB:
-                                    {
-                                       rSh.Insert( '\t' );
-                                    }
-                                    break;
-                    case DICTATIONCOMMAND_UNKNOWN:
-                                    {
-                                        rView.GetWrtShell().Insert( pCData->GetText() );
-                                    }
-                                    break;
-
-#if OSL_DEBUG_LEVEL > 0
-                    default:
-                        OSL_ENSURE( !this, "unknown speech command." );
-#endif
-                }
-                if ( nSlotId )
-                {
-                    bCallBase = false;
-                    if ( pItem )
-                    {
-                        const SfxPoolItem* aArgs[2];
-                        aArgs[0] = pItem;
-                        aArgs[1] = 0;
-                        GetView().GetViewFrame()->GetBindings().Execute(
-                                    nSlotId, aArgs, 0, SFX_CALLMODE_STANDARD );
-                        delete pItem;
-                    }
-                    else
-                        GetView().GetViewFrame()->GetBindings().Execute( nSlotId );
-                }
-            }
             break;
 
     case COMMAND_STARTEXTTEXTINPUT:
diff --git a/vcl/Package_inc.mk b/vcl/Package_inc.mk
index 6088b66..6310fed 100644
--- a/vcl/Package_inc.mk
+++ b/vcl/Package_inc.mk
@@ -31,7 +31,6 @@
 $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/builder.hxx,vcl/builder.hxx))
 $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/button.hxx,vcl/button.hxx))
 $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/canvastools.hxx,vcl/canvastools.hxx))
-$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/cmdevt.h,vcl/cmdevt.h))
 $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/cmdevt.hxx,vcl/cmdevt.hxx))
 $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/combobox.h,vcl/combobox.h))
 $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/combobox.hxx,vcl/combobox.hxx))
diff --git a/vcl/inc/vcl/cmdevt.h b/vcl/inc/vcl/cmdevt.h
deleted file mode 100644
index a829869..0000000
--- a/vcl/inc/vcl/cmdevt.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef _VCL_CMDEVT_H
-#define _VCL_CMDEVT_H
-
-// --------------------
-// - CommandVoiceData -
-// --------------------
-
-#define DICTATIONCOMMAND_UNKNOWN        0x0001
-#define DICTATIONCOMMAND_NEWPARAGRAPH   0x0002
-#define DICTATIONCOMMAND_NEWLINE        0x0003
-#define DICTATIONCOMMAND_BOLD_ON        0x0004
-#define DICTATIONCOMMAND_BOLD_OFF       0x0005
-#define DICTATIONCOMMAND_ITALIC_ON      0x0006
-#define DICTATIONCOMMAND_ITALIC_OFF     0x0007
-#define DICTATIONCOMMAND_UNDERLINE_ON   0x0008
-#define DICTATIONCOMMAND_UNDERLINE_OFF  0x0009
-#define DICTATIONCOMMAND_NUMBERING_ON   0x0010
-#define DICTATIONCOMMAND_NUMBERING_OFF  0x0011
-#define DICTATIONCOMMAND_TAB            0x0012
-#define DICTATIONCOMMAND_LEFT           0x0013
-#define DICTATIONCOMMAND_RIGHT          0x0014
-#define DICTATIONCOMMAND_UP             0x0015
-#define DICTATIONCOMMAND_DOWN           0x0016
-#define DICTATIONCOMMAND_UNDO           0x0017
-#define DICTATIONCOMMAND_REPEAT         0x0018
-#define DICTATIONCOMMAND_DEL            0x0019
-
-#endif // _VCL_CMDEVT_H
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/vcl/cmdevt.hxx b/vcl/inc/vcl/cmdevt.hxx
index bf4e810..a437a5b 100644
--- a/vcl/inc/vcl/cmdevt.hxx
+++ b/vcl/inc/vcl/cmdevt.hxx
@@ -213,49 +213,6 @@
     mnDeltaY    = nDeltaY;
 }
 
-// --------------------
-// - CommandVoiceData -
-// --------------------
-
-enum DictationCommandType
-{
-    VOICECOMMANDTYPE_DICTATION,
-    VOICECOMMANDTYPE_CONTROL
-};
-
-class VCL_DLLPUBLIC CommandVoiceData
-{
-private:
-    XubString               maText;
-    sal_uInt16                  mnCommand;
-    DictationCommandType    meType;
-
-public:
-                            CommandVoiceData();
-                            CommandVoiceData( const XubString& rStr,
-                                              DictationCommandType eType,
-                                              sal_uInt16 nCommand );
-
-    const XubString&        GetText() const { return maText; }
-    sal_uInt16                  GetCommand() const { return mnCommand; }
-    DictationCommandType    GetType() const { return meType; }
-};
-
-inline CommandVoiceData::CommandVoiceData()
-{
-    meType = VOICECOMMANDTYPE_DICTATION;
-    mnCommand = 0;
-}
-
-inline CommandVoiceData::CommandVoiceData( const XubString& rStr,
-                                           DictationCommandType eType,
-                                           sal_uInt16 nCommand ) :
-    maText( rStr ),
-    mnCommand( nCommand ),
-    meType( eType )
-{
-}
-
 // ---------------------
 // - CommandModKeyData -
 // ---------------------
@@ -380,7 +337,6 @@
 #define COMMAND_WHEEL                   ((sal_uInt16)3)
 #define COMMAND_STARTAUTOSCROLL         ((sal_uInt16)4)
 #define COMMAND_AUTOSCROLL              ((sal_uInt16)5)
-#define COMMAND_VOICE                   ((sal_uInt16)6)
 #define COMMAND_STARTEXTTEXTINPUT       ((sal_uInt16)7)
 #define COMMAND_EXTTEXTINPUT            ((sal_uInt16)8)
 #define COMMAND_ENDEXTTEXTINPUT         ((sal_uInt16)9)
@@ -417,7 +373,6 @@
     const CommandInputContextData*      GetInputContextChangeData() const;
     const CommandWheelData*             GetWheelData() const;
     const CommandScrollData*            GetAutoScrollData() const;
-    const CommandVoiceData*             GetVoiceData() const;
     const CommandModKeyData*            GetModKeyData() const;
     const CommandDialogData*            GetDialogData() const;
     sal_Int16                           GetMediaCommand() const;
@@ -468,14 +423,6 @@
 {
     if ( mnCommand == COMMAND_AUTOSCROLL )
         return (const CommandScrollData*)mpData;
-    else
-        return NULL;
-}
-
-inline const CommandVoiceData* CommandEvent::GetVoiceData() const
-{
-    if ( mnCommand == COMMAND_VOICE )
-        return (const CommandVoiceData*)mpData;
     else
         return NULL;
 }
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 590f1a2..8f19c3c 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -24,7 +24,6 @@
 #include <vcl/cursor.hxx>
 #include <vcl/virdev.hxx>
 #include <vcl/menu.hxx>
-#include <vcl/cmdevt.h>
 #include <vcl/edit.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/msgbox.hxx>
@@ -2234,42 +2233,6 @@
                 break;
         }
         mbActivePopup = sal_False;
-    }
-    else if ( rCEvt.GetCommand() == COMMAND_VOICE )
-    {
-        const CommandVoiceData* pData = rCEvt.GetVoiceData();
-        if ( pData->GetType() == VOICECOMMANDTYPE_DICTATION )
-        {
-            switch ( pData->GetCommand() )
-            {
-                case DICTATIONCOMMAND_UNKNOWN:
-                {
-                    ReplaceSelected( pData->GetText() );
-                }
-                break;
-                case DICTATIONCOMMAND_LEFT:
-                {
-                    ImplHandleKeyEvent( KeyEvent( 0, KeyCode( KEY_LEFT, KEY_MOD1  ) ) );
-                }
-                break;
-                case DICTATIONCOMMAND_RIGHT:
-                {
-                    ImplHandleKeyEvent( KeyEvent( 0, KeyCode( KEY_RIGHT, KEY_MOD1  ) ) );
-                }
-                break;
-                case DICTATIONCOMMAND_UNDO:
-                {
-                    Undo();
-                }
-                break;
-                case DICTATIONCOMMAND_DEL:
-                {
-                    ImplHandleKeyEvent( KeyEvent( 0, KeyCode( KEY_LEFT, KEY_MOD1|KEY_SHIFT  ) ) );
-                    DeleteSelected();
-                }
-                break;
-            }
-        }
     }
     else if ( rCEvt.GetCommand() == COMMAND_STARTEXTTEXTINPUT )
     {

-- 
To view, visit https://gerrit.libreoffice.org/2452
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4e4221dd4dff76086d0268be286c3605e669bae7
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Tor Lillqvist <tml@iki.fi>


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.