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
Reviewed-on: https://gerrit.libreoffice.org/2452
Reviewed-by: Niko Rönkkö <ronkko@iki.fi>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Tor Lillqvist
2013-02-28 14:42:37 +00:00
committed by Caolán McNamara
parent 4626cda96a
commit 04df3cb2b9
9 changed files with 2 additions and 366 deletions
+1 -105
View File
@@ -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 @@ void ImpEditEngine::Command( const CommandEvent& rCEvt, EditView* pView )
{
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;
+1 -1
View File
@@ -1565,7 +1565,7 @@ void ScTextWnd::Command( const CommandEvent& rCEvt )
{
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();
-28
View File
@@ -2840,34 +2840,6 @@ void ScGridWindow::Command( const CommandEvent& rCEvt )
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 )
-1
View File
@@ -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>
-90
View File
@@ -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>
@@ -5053,95 +5052,6 @@ void SwEditWin::Command( const CommandEvent& rCEvt )
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:
{
bool bIsDocReadOnly = rView.GetDocShell()->IsReadOnly() &&
-1
View File
@@ -31,7 +31,6 @@ $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/btndlg.hxx,vcl/btndlg.hxx))
$(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))
-50
View File
@@ -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: */
-53
View File
@@ -213,49 +213,6 @@ inline CommandScrollData::CommandScrollData( long nDeltaX, long nDeltaY )
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 @@ inline CommandSelectionChangeData::CommandSelectionChangeData( sal_uLong nStart,
#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 @@ public:
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;
@@ -472,14 +427,6 @@ inline const CommandScrollData* CommandEvent::GetAutoScrollData() const
return NULL;
}
inline const CommandVoiceData* CommandEvent::GetVoiceData() const
{
if ( mnCommand == COMMAND_VOICE )
return (const CommandVoiceData*)mpData;
else
return NULL;
}
inline const CommandModKeyData* CommandEvent::GetModKeyData() const
{
if( mnCommand == COMMAND_MODKEYCHANGE )
-37
View File
@@ -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>
@@ -2235,42 +2234,6 @@ void Edit::Command( const CommandEvent& rCEvt )
}
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 )
{
DeleteSelected();