convert editeng spell menu to .ui format

Change-Id: Iaae8e6d6ee3c9cafad343fefb4f357b080df3a08
This commit is contained in:
Caolán McNamara 2017-02-17 13:39:24 +00:00
parent b64bdb8d75
commit 5d6a605a69
9 changed files with 115 additions and 75 deletions

View file

@ -1105,6 +1105,7 @@ $(eval $(call gb_Helper_register_uiconfigs,\
cui \
$(call gb_Helper_optional,DBCONNECTIVITY,dbaccess) \
desktop \
editeng \
filter \
formula \
fps \

View file

@ -26,6 +26,7 @@ $(eval $(call gb_Module_add_targets,editeng,\
$(eval $(call gb_Module_add_l10n_targets,editeng,\
AllLangResTarget_editeng \
UIConfig_editeng \
))
$(eval $(call gb_Module_add_check_targets,editeng,\

View file

@ -0,0 +1,16 @@
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# 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/.
#
$(eval $(call gb_UIConfig_UIConfig,editeng))
$(eval $(call gb_UIConfig_add_uifiles,editeng,\
editeng/uiconfig/ui/spellmenu \
))
# vim: set noet sw=4 ts=4:

View file

@ -21,15 +21,8 @@
#include <editeng/editrids.hrc>
#define MN_SPELLING 1
#define MN_INSERT 2
#define MN_IGNORE 3
#define MN_AUTOCORR 4
#define MN_WORDLANGUAGE 5
#define MN_PARALANGUAGE 6
#define MN_INSERT_SINGLE 7
#define MN_AUTO_CORRECT_DLG 8
#define MN_WORDLANGUAGE 998
#define MN_PARALANGUAGE 999
#define MN_ALTSTART 1000
#define MN_AUTOSTART 2000
#define MN_DICTSTART 3000

View file

@ -21,10 +21,6 @@
#define HID_EDITENG_SPELLER_WORDLANGUAGE "EDITENG_HID_EDITENG_SPELLER_WORDLANGUAGE"
#define HID_EDITENG_SPELLER_PARALANGUAGE "EDITENG_HID_EDITENG_SPELLER_PARALANGUAGE"
#define HID_EDITENG_SPELLER_ADDWORD "EDITENG_HID_EDITENG_SPELLER_ADDWORD"
#define HID_EDITENG_SPELLER_AUTOCORRECT "EDITENG_HID_EDITENG_SPELLER_AUTOCORRECT"
#define HID_EDITENG_SPELLER_IGNORE "EDITENG_HID_EDITENG_SPELLER_IGNORE"
#define HID_EDITENG_SPELLER_START "EDITENG_HID_EDITENG_SPELLER_START"
#endif

View file

@ -65,55 +65,6 @@ String RID_EDITUNDO_TRANSLITERATE
Text [ en-US ] = "Change Case";
};
Menu RID_MENU_SPELL
{
ItemList =
{
MenuItem
{
Identifier = MN_IGNORE ;
HelpId = HID_EDITENG_SPELLER_IGNORE;
Text [ en-US ] = "I~gnore All" ;
};
MenuItem
{
Identifier = MN_INSERT ;
HelpId = HID_EDITENG_SPELLER_ADDWORD;
SubMenu = Menu
{
};
Text [ en-US ] = "~Add to Dictionary" ;
};
MenuItem
{
Identifier = MN_INSERT_SINGLE ;
HelpId = HID_EDITENG_SPELLER_ADDWORD;
Text [ en-US ] = "~Add to Dictionary" ;
};
MenuItem
{
Identifier = MN_SPELLING ;
HelpId = HID_EDITENG_SPELLER_START;
Text [ en-US ] = "~Spellcheck..." ;
};
MenuItem { Separator = TRUE ; };
MenuItem
{
Identifier = MN_AUTOCORR ;
HelpId = HID_EDITENG_SPELLER_AUTOCORRECT;
SubMenu = Menu
{
};
Text [ en-US ] = "AutoCorrect ~To" ;
};
MenuItem
{
Identifier = MN_AUTO_CORRECT_DLG ;
Text [ en-US ] = "Auto~Correct Options..." ;
};
};
};
String RID_STR_WORD
{
Text [ en-US ] = "Word is %x";

View file

@ -817,10 +817,17 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link<SpellCallbackInfo
ESelection aOldSel = GetSelection();
if ( xSpeller.is() && pImpEditView->IsWrongSpelledWord( aPaM, true ) )
{
ScopedVclPtrInstance<PopupMenu> aPopupMenu( EditResId( RID_MENU_SPELL ) );
PopupMenu *pAutoMenu = aPopupMenu->GetPopupMenu( MN_AUTOCORR );
PopupMenu *pInsertMenu = aPopupMenu->GetPopupMenu( MN_INSERT ); // add word to user-dictionaries
VclBuilder aBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "editeng/ui/spellmenu.ui", "");
VclPtr<PopupMenu> aPopupMenu(aBuilder.get_menu("menu"));
const sal_uInt16 nAutoCorrId = aPopupMenu->GetItemId("autocorrect");
PopupMenu *pAutoMenu = aPopupMenu->GetPopupMenu(nAutoCorrId);
const sal_uInt16 nInsertId = aPopupMenu->GetItemId("insert");
PopupMenu *pInsertMenu = aPopupMenu->GetPopupMenu(nInsertId); // add word to user-dictionaries
pInsertMenu->SetMenuFlags( MenuFlags::NoAutoMnemonics ); //! necessary to retrieve the correct dictionary names later
const sal_uInt16 nAddId = aPopupMenu->GetItemId("add");
const sal_uInt16 nIgnoreId = aPopupMenu->GetItemId("ignore");
const sal_uInt16 nCheckId = aPopupMenu->GetItemId("check");
const sal_uInt16 nAutoCorrectDlgId = aPopupMenu->GetItemId("autocorrectdlg");
EditPaM aPaM2( aPaM );
aPaM2.SetIndex( aPaM2.GetIndex()+1 );
@ -910,7 +917,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link<SpellCallbackInfo
aPopupMenu->InsertSeparator(OString(), nWords);
}
else
aPopupMenu->RemoveItem( MN_AUTOCORR ); // delete?
aPopupMenu->RemoveItem(nAutoCorrId); // delete?
SvtLinguConfig aCfg;
@ -963,10 +970,11 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link<SpellCallbackInfo
}
}
}
if ( pInsertMenu->GetItemCount() != 1)
aPopupMenu->EnableItem( MN_INSERT_SINGLE, false );
if ( pInsertMenu->GetItemCount() < 2 )
aPopupMenu->EnableItem( MN_INSERT, false );
if (pInsertMenu->GetItemCount() != 1)
aPopupMenu->EnableItem(nAddId, false);
if (pInsertMenu->GetItemCount() < 2)
aPopupMenu->EnableItem(nInsertId, false);
aPopupMenu->RemoveDisabledEntries( true, true );
@ -976,7 +984,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link<SpellCallbackInfo
aTempRect = pImpEditView->GetWindow()->LogicToPixel( Rectangle(aScreenPos, aTempRect.GetSize() ));
sal_uInt16 nId = aPopupMenu->Execute( pImpEditView->GetWindow(), aTempRect, PopupMenuFlags::NoMouseUpClose );
if ( nId == MN_IGNORE )
if (nId == nIgnoreId)
{
OUString aWord = pImpEditView->SpellIgnoreWord();
if ( pCallBack )
@ -1015,7 +1023,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link<SpellCallbackInfo
}
SetSelection( aOldSel );
}
else if ( nId == MN_SPELLING )
else if (nId == nCheckId)
{
if ( !pCallBack )
{
@ -1033,12 +1041,12 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link<SpellCallbackInfo
pCallBack->Call( aInf );
}
}
else if ( nId == MN_AUTO_CORRECT_DLG && pCallBack)
else if (nId == nAutoCorrectDlgId && pCallBack)
{
SpellCallbackInfo aInf( SpellCallbackCommand::AUTOCORRECT_OPTIONS, OUString() );
pCallBack->Call( aInf );
}
else if ( nId >= MN_DICTSTART || nId == MN_INSERT_SINGLE )
else if ( nId >= MN_DICTSTART || nId == nAddId)
{
OUString aDicName;
if (nId >= MN_DICTSTART)

View file

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<interface>
<requires lib="gtk+" version="3.10"/>
<object class="GtkMenu" id="menu">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkMenuItem" id="ignore">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">I_gnore All</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="insert">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">_Add to Dictionary</property>
<property name="use_underline">True</property>
<child type="submenu">
<object class="GtkMenu">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkMenuItem" id="add">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">_Add to Dictionary</property>
<property name="use_underline">True</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="check">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">_Spellcheck...</property>
<property name="use_underline">True</property>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="menuitem1">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="autocorrect">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">AutoCorrect _To</property>
<property name="use_underline">True</property>
<child type="submenu">
<object class="GtkMenu">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkMenuItem" id="autocorrectdlg">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Auto_Correct Options...</property>
<property name="use_underline">True</property>
</object>
</child>
</object>
</interface>

View file

@ -358,7 +358,7 @@
#define RID_EDITUNDO_RESETATTRIBS (RID_EDIT_START + 308)
#define RID_EDITUNDO_INDENT (RID_EDIT_START + 309)
#define RID_EDITUNDO_TRANSLITERATE (RID_EDIT_START + 310)
#define RID_MENU_SPELL (RID_EDIT_START + 311)
//free
#define RID_STR_PARAGRAPH (RID_EDIT_START + 312)
#define RID_STR_WORD (RID_EDIT_START + 313)
#define RID_SVXSTR_A11Y_IMAGEBULLET_DESCRIPTION (RID_EDIT_START + 314)