diff options
-rw-r--r-- | cui/source/factory/dlgfact.cxx | 6 | ||||
-rw-r--r-- | cui/source/factory/dlgfact.hxx | 2 | ||||
-rw-r--r-- | cui/source/inc/optdict.hxx | 76 | ||||
-rw-r--r-- | cui/source/options/optdict.cxx | 468 | ||||
-rw-r--r-- | cui/source/options/optlingu.cxx | 2 | ||||
-rw-r--r-- | cui/uiconfig/ui/editdictionarydialog.ui | 147 | ||||
-rw-r--r-- | extras/source/glade/libreoffice-catalog.xml.in | 3 | ||||
-rw-r--r-- | include/svx/svxdlg.hxx | 3 | ||||
-rwxr-xr-x | solenv/bin/native-code.py | 1 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 21 |
10 files changed, 385 insertions, 344 deletions
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index b47589591b18..56694622b723 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -1210,11 +1210,9 @@ VclPtr<AbstractSvxNewDictionaryDialog> AbstractDialogFactory_Impl::CreateSvxNewD return VclPtr<AbstractSvxNewDictionaryDialog_Impl>::Create(std::make_unique<SvxNewDictionaryDialog>(pParent)); } -VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateSvxEditDictionaryDialog( vcl::Window* pParent, - const OUString& rName ) +VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateSvxEditDictionaryDialog(weld::Window* pParent, const OUString& rName) { - VclPtrInstance<SvxEditDictionaryDialog> pDlg( pParent, rName ); - return VclPtr<CuiVclAbstractDialog_Impl>::Create( pDlg ); + return VclPtr<CuiAbstractController_Impl>::Create(std::make_unique<SvxEditDictionaryDialog>(pParent, rName)); } VclPtr<AbstractSvxNameDialog> AbstractDialogFactory_Impl::CreateSvxNameDialog(weld::Window* pParent, diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index c183d30cdaa0..d2312b21b6b6 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -773,7 +773,7 @@ public: TransliterationFlags nInitialFlags) override; virtual VclPtr<AbstractFmInputRecordNoDialog> CreateFmInputRecordNoDialog(weld::Window* pParent) override; virtual VclPtr<AbstractSvxNewDictionaryDialog> CreateSvxNewDictionaryDialog(weld::Window* pParent) override; - virtual VclPtr<VclAbstractDialog> CreateSvxEditDictionaryDialog(vcl::Window* pParent, const OUString& rName) override; + virtual VclPtr<VclAbstractDialog> CreateSvxEditDictionaryDialog(weld::Window* pParent, const OUString& rName) override; virtual VclPtr<AbstractSvxNameDialog> CreateSvxNameDialog(weld::Window* pParent, const OUString& rName, const OUString& rDesc) override; // #i68101# diff --git a/cui/source/inc/optdict.hxx b/cui/source/inc/optdict.hxx index 81c529b98bdf..5c0b694b1e75 100644 --- a/cui/source/inc/optdict.hxx +++ b/cui/source/inc/optdict.hxx @@ -64,43 +64,11 @@ public: const css::uno::Reference<css::linguistic2::XDictionary>& GetNewDictionary() { return m_xNewDic; } }; -// class SvxDictEdit ---------------------------------------------------- - -class SvxDictEdit : public Edit -{ - Link<SvxDictEdit&,bool> aActionLink; - bool bSpaces; - - public: - SvxDictEdit(vcl::Window* pParent, WinBits aWB) : - Edit(pParent, aWB), bSpaces(false){} - - void SetActionHdl( const Link<SvxDictEdit&,bool>& rLink ) - { aActionLink = rLink;} - - void SetSpaces(bool bSet) - {bSpaces = bSet;} - - virtual void KeyInput( const KeyEvent& rKEvent ) override; -}; - // class SvxEditDictionaryDialog ----------------------------------------- -class SvxEditDictionaryDialog : public ModalDialog +class SvxEditDictionaryDialog : public weld::GenericDialogController { private: - - VclPtr<ListBox> pAllDictsLB; - VclPtr<FixedText> pLangFT; - VclPtr<SvxLanguageBox> pLangLB; - - VclPtr<SvxDictEdit> pWordED; - VclPtr<FixedText> pReplaceFT; - VclPtr<SvxDictEdit> pReplaceED; - VclPtr<SvTabListBox> pWordsLB; - VclPtr<PushButton> pNewReplacePB; - VclPtr<PushButton> pDeletePB; - OUString sModify; OUString sNew; OUString sReplaceFT_Text; @@ -109,19 +77,31 @@ private: css::uno::Reference< css::linguistic2::XDictionary > > aDics; //! snapshot copy to work on - long nWidth; bool bFirstSelect; bool bDoNothing; - bool bDicIsReadonly; - - DECL_LINK(SelectBookHdl_Impl, ListBox&, void); - DECL_LINK(SelectLangHdl_Impl, ListBox&, void); - DECL_LINK(SelectHdl, SvTreeListBox*, void); - DECL_LINK(NewDelButtonHdl, Button*, void); - DECL_LINK(NewDelActionHdl, SvxDictEdit&, bool); - DECL_LINK(ModifyHdl, Edit&, void); - bool NewDelHdl(void const *); - + bool bDicIsReadonly; + + weld::TreeView* m_pWordsLB; + std::unique_ptr<weld::ComboBox> m_xAllDictsLB; + std::unique_ptr<weld::Label> m_xLangFT; + std::unique_ptr<LanguageBox> m_xLangLB; + std::unique_ptr<weld::Entry> m_xWordED; + std::unique_ptr<weld::Label> m_xReplaceFT; + std::unique_ptr<weld::Entry> m_xReplaceED; + std::unique_ptr<weld::TreeView> m_xSingleColumnLB; + std::unique_ptr<weld::TreeView> m_xDoubleColumnLB; + std::unique_ptr<weld::Button> m_xNewReplacePB; + std::unique_ptr<weld::Button> m_xDeletePB; + + DECL_LINK(SelectBookHdl_Impl, weld::ComboBox&, void); + DECL_LINK(SelectLangHdl_Impl, weld::ComboBox&, void); + DECL_LINK(SelectHdl, weld::TreeView&, void); + DECL_LINK(NewDelButtonHdl, weld::Button&, void); + DECL_LINK(NewDelActionHdl, weld::Entry&, bool); + DECL_LINK(ModifyHdl, weld::Entry&, void); + DECL_LINK(EntrySizeAllocHdl, const Size&, void); + DECL_STATIC_LINK(SvxEditDictionaryDialog, InsertTextHdl, OUString&, bool); + bool NewDelHdl(const weld::Widget*); void ShowWords_Impl( sal_uInt16 nId ); void SetLanguage_Impl( LanguageType nLanguage ); @@ -129,14 +109,12 @@ private: void SetDicReadonly_Impl( css::uno::Reference< css::linguistic2::XDictionary > const &xDic ); - void RemoveDictEntry(SvTreeListEntry* pEntry); - sal_uLong GetLBInsertPos(const OUString &rDicWord); + void RemoveDictEntry(int nEntry); + int GetLBInsertPos(const OUString &rDicWord); public: - SvxEditDictionaryDialog( vcl::Window* pParent, - const OUString& rName ); + SvxEditDictionaryDialog(weld::Window* pParent, const OUString& rName); virtual ~SvxEditDictionaryDialog() override; - virtual void dispose() override; }; #endif diff --git a/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx index 4849b287922f..b5fe420a4f03 100644 --- a/cui/source/options/optdict.cxx +++ b/cui/source/options/optdict.cxx @@ -43,10 +43,6 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::linguistic2; using namespace linguistic; -// static ---------------------------------------------------------------- - -static const long nStaticTabs[] = { 10, 71 }; - // static function ------------------------------------------------------- static OUString getNormDicEntry_Impl(const OUString &rText) @@ -186,60 +182,62 @@ IMPL_LINK_NOARG(SvxNewDictionaryDialog, ModifyHdl_Impl, weld::Entry&, void) // class SvxEditDictionaryDialog ------------------------------------------- -VCL_BUILDER_FACTORY_ARGS(SvxDictEdit, WB_LEFT|WB_VCENTER|WB_BORDER|WB_3DLOOK) - -SvxEditDictionaryDialog::SvxEditDictionaryDialog( - vcl::Window* pParent, - const OUString& rName ) : - - ModalDialog( pParent, "EditDictionaryDialog" ,"cui/ui/editdictionarydialog.ui" ), - - sModify (CuiResId(STR_MODIFY)), - bFirstSelect (true), - bDoNothing (false), - bDicIsReadonly (false) - +SvxEditDictionaryDialog::SvxEditDictionaryDialog(weld::Window* pParent, const OUString& rName) + : GenericDialogController(pParent, "cui/ui/editdictionarydialog.ui", "EditDictionaryDialog") + , sModify(CuiResId(STR_MODIFY)) + , bFirstSelect(false) + , bDoNothing(false) + , bDicIsReadonly(false) + , m_xAllDictsLB(m_xBuilder->weld_combo_box("book")) + , m_xLangFT(m_xBuilder->weld_label("lang_label")) + , m_xLangLB(new LanguageBox(m_xBuilder->weld_combo_box("lang"))) + , m_xWordED(m_xBuilder->weld_entry("word")) + , m_xReplaceFT(m_xBuilder->weld_label("replace_label")) + , m_xReplaceED(m_xBuilder->weld_entry("replace")) + , m_xSingleColumnLB(m_xBuilder->weld_tree_view("words")) + , m_xDoubleColumnLB(m_xBuilder->weld_tree_view("replaces")) + , m_xNewReplacePB(m_xBuilder->weld_button("newreplace")) + , m_xDeletePB(m_xBuilder->weld_button("delete")) { - get(pAllDictsLB,"book"); - get(pLangFT,"lang_label"); - get(pLangLB,"lang"); - - get(pWordED,"word"); - get(pReplaceFT,"replace_label"); - sReplaceFT_Text = pReplaceFT->GetText(); - get(pReplaceED,"replace"); - get(pWordsLB,"words"); - pWordsLB->set_height_request(pWordsLB->GetTextHeight() * 8); - get(pNewReplacePB,"newreplace"); - get(pDeletePB,"delete"); - - sNew=pNewReplacePB->GetText(); + sReplaceFT_Text = m_xReplaceFT->get_label(); + m_xSingleColumnLB->set_size_request(-1, m_xSingleColumnLB->get_height_rows(8)); + m_xDoubleColumnLB->set_size_request(-1, m_xDoubleColumnLB->get_height_rows(8)); + m_pWordsLB = m_xDoubleColumnLB.get(); + m_xSingleColumnLB->hide(); + + //set to max of both sizes to avoid resizes + sNew = m_xNewReplacePB->get_label(); + auto nNewWidth = m_xNewReplacePB->get_preferred_size().Width(); + m_xNewReplacePB->set_label(sModify); + auto nReplaceWidth = m_xNewReplacePB->get_preferred_size().Width(); + m_xNewReplacePB->set_label(sNew); + m_xNewReplacePB->set_size_request(std::max(nNewWidth, nReplaceWidth), -1); + if (LinguMgr::GetDictionaryList().is()) aDics = LinguMgr::GetDictionaryList()->getDictionaries(); - pWordsLB->SetSelectHdl(LINK(this, SvxEditDictionaryDialog, SelectHdl)); - pWordsLB->SetTabs(SAL_N_ELEMENTS(nStaticTabs), nStaticTabs); + m_xSingleColumnLB->connect_changed(LINK(this, SvxEditDictionaryDialog, SelectHdl)); + m_xDoubleColumnLB->connect_changed(LINK(this, SvxEditDictionaryDialog, SelectHdl)); - //! we use an algorithm of our own to insert elements sorted - pWordsLB->SetStyle(pWordsLB->GetStyle()|/*WB_SORT|*/WB_HSCROLL|WB_CLIPCHILDREN); + std::vector<int> aWidths; + aWidths.push_back(m_xDoubleColumnLB->get_approximate_digit_width() * 22); + m_xDoubleColumnLB->set_column_fixed_widths(aWidths); - - nWidth=pWordED->GetSizePixel().Width(); // install handler - pNewReplacePB->SetClickHdl( + m_xNewReplacePB->connect_clicked( LINK( this, SvxEditDictionaryDialog, NewDelButtonHdl)); - pDeletePB->SetClickHdl( + m_xDeletePB->connect_clicked( LINK( this, SvxEditDictionaryDialog, NewDelButtonHdl)); - pLangLB->SetSelectHdl( + m_xLangLB->connect_changed( LINK( this, SvxEditDictionaryDialog, SelectLangHdl_Impl ) ); - pAllDictsLB->SetSelectHdl( + m_xAllDictsLB->connect_changed( LINK( this, SvxEditDictionaryDialog, SelectBookHdl_Impl ) ); - pWordED->SetModifyHdl(LINK(this, SvxEditDictionaryDialog, ModifyHdl)); - pReplaceED->SetModifyHdl(LINK(this, SvxEditDictionaryDialog, ModifyHdl)); - pWordED->SetActionHdl(LINK(this, SvxEditDictionaryDialog, NewDelActionHdl)); - pReplaceED->SetActionHdl(LINK(this, SvxEditDictionaryDialog, NewDelActionHdl)); + m_xWordED->connect_changed(LINK(this, SvxEditDictionaryDialog, ModifyHdl)); + m_xReplaceED->connect_changed(LINK(this, SvxEditDictionaryDialog, ModifyHdl)); + m_xWordED->connect_activate(LINK(this, SvxEditDictionaryDialog, NewDelActionHdl)); + m_xReplaceED->connect_activate(LINK(this, SvxEditDictionaryDialog, NewDelActionHdl)); // fill listbox with all available WB's const Reference< XDictionary > *pDic = aDics.getConstArray(); @@ -255,30 +253,31 @@ SvxEditDictionaryDialog::SvxEditDictionaryDialog( OUString aDicName( xDic->getName() ); const OUString aTxt( ::GetDicInfoStr( aDicName, LanguageTag( xDic->getLocale() ).getLanguageType(), bNegative ) ); - pAllDictsLB->InsertEntry( aTxt ); + m_xAllDictsLB->append_text(aTxt); if (rName == aDicName) aLookUpEntry = aTxt; } } - pLangLB->SetLanguageList( SvxLanguageListFlags::ALL, true, true ); + m_xLangLB->SetLanguageList( SvxLanguageListFlags::ALL, true, true ); - pReplaceED->SetSpaces(true); - pWordED->SetSpaces(true); + Link<OUString&,bool> aLink = LINK(this, SvxEditDictionaryDialog, InsertTextHdl); + m_xReplaceED->connect_insert_text(aLink); + m_xWordED->connect_insert_text(aLink); if ( nCount > 0 ) { - pAllDictsLB->SelectEntry( aLookUpEntry ); - sal_Int32 nPos = pAllDictsLB->GetSelectedEntryPos(); + m_xAllDictsLB->set_active_text(aLookUpEntry); + int nPos = m_xAllDictsLB->get_active(); - if ( nPos == LISTBOX_ENTRY_NOTFOUND ) + if (nPos == -1) { nPos = 0; - pAllDictsLB->SelectEntryPos( nPos ); + m_xAllDictsLB->set_active(nPos); } Reference< XDictionary > xDic; - if (nPos != LISTBOX_ENTRY_NOTFOUND) + if (nPos != -1) xDic.set( aDics.getConstArray()[ nPos ], UNO_QUERY ); if (xDic.is()) SetLanguage_Impl( LanguageTag( xDic->getLocale() ).getLanguageType() ); @@ -286,40 +285,37 @@ SvxEditDictionaryDialog::SvxEditDictionaryDialog( // check if dictionary is read-only SetDicReadonly_Impl(xDic); bool bEnable = !IsDicReadonly_Impl(); - pNewReplacePB->Enable( false ); - pDeletePB->Enable( false ); - pLangFT->Enable( bEnable ); - pLangLB->Enable( bEnable ); + m_xNewReplacePB->set_sensitive( false ); + m_xDeletePB->set_sensitive( false ); + m_xLangFT->set_sensitive( bEnable ); + m_xLangLB->set_sensitive( bEnable ); ShowWords_Impl( nPos ); - } else { - pNewReplacePB->Disable(); - pDeletePB->Disable(); + m_xNewReplacePB->set_sensitive(false); + m_xDeletePB->set_sensitive(false); } + + m_xWordED->connect_size_allocate(LINK(this, SvxEditDictionaryDialog, EntrySizeAllocHdl)); + m_xReplaceED->connect_size_allocate(LINK(this, SvxEditDictionaryDialog, EntrySizeAllocHdl)); } -SvxEditDictionaryDialog::~SvxEditDictionaryDialog() +IMPL_LINK_NOARG(SvxEditDictionaryDialog, EntrySizeAllocHdl, const Size&, void) { - disposeOnce(); + std::vector<int> aWidths; + int x, y, width, height; + if (m_xReplaceED->get_extents_relative_to(*m_pWordsLB, x, y, width, height)) + { + aWidths.push_back(x); + m_xDoubleColumnLB->set_column_fixed_widths(aWidths); + } } -void SvxEditDictionaryDialog::dispose() +SvxEditDictionaryDialog::~SvxEditDictionaryDialog() { - pAllDictsLB.clear(); - pLangFT.clear(); - pLangLB.clear(); - pWordED.clear(); - pReplaceFT.clear(); - pReplaceED.clear(); - pWordsLB.clear(); - pNewReplacePB.clear(); - pDeletePB.clear(); - ModalDialog::dispose(); } - void SvxEditDictionaryDialog::SetDicReadonly_Impl( Reference< XDictionary > const &xDic ) { @@ -337,61 +333,53 @@ void SvxEditDictionaryDialog::SetDicReadonly_Impl( } } - -void SvxEditDictionaryDialog::SetLanguage_Impl( LanguageType nLanguage ) +void SvxEditDictionaryDialog::SetLanguage_Impl(LanguageType nLanguage) { // select language - pLangLB->SelectLanguage( nLanguage ); + m_xLangLB->set_active_id(nLanguage); } -sal_uLong SvxEditDictionaryDialog::GetLBInsertPos(const OUString &rDicWord) +int SvxEditDictionaryDialog::GetLBInsertPos(const OUString &rDicWord) { - sal_uLong nPos = TREELIST_ENTRY_NOTFOUND; - IntlWrapper aIntlWrapper(SvtSysLocale().GetUILanguageTag()); const CollatorWrapper* pCollator = aIntlWrapper.getCollator(); - sal_uLong j; - for( j = 0; j < pWordsLB->GetEntryCount(); j++ ) + int j; + int nCount = m_pWordsLB->n_children(); + for (j = 0; j < nCount; ++j) { - SvTreeListEntry* pEntry = pWordsLB->GetEntry(j); - DBG_ASSERT( pEntry, "NULL pointer"); OUString aNormEntry( getNormDicEntry_Impl( rDicWord ) ); sal_Int32 nCmpRes = pCollator-> - compareString( aNormEntry, getNormDicEntry_Impl( SvTabListBox::GetEntryText(pEntry, 0) ) ); + compareString( aNormEntry, getNormDicEntry_Impl( m_pWordsLB->get_text(j, 0) ) ); if (nCmpRes < 0) break; } - if (j < pWordsLB->GetEntryCount()) // entry found? - nPos = j; - return nPos; + return j; } -void SvxEditDictionaryDialog::RemoveDictEntry(SvTreeListEntry* pEntry) +void SvxEditDictionaryDialog::RemoveDictEntry(int nEntry) { - sal_Int32 nLBPos = pAllDictsLB->GetSelectedEntryPos(); - - if ( pEntry != nullptr && nLBPos != LISTBOX_ENTRY_NOTFOUND ) + int nLBPos = m_xAllDictsLB->get_active(); + if (nEntry != -1 && nLBPos != -1) { - OUString sTmpShort(SvTabListBox::GetEntryText(pEntry, 0)); + OUString sTmpShort(m_pWordsLB->get_text(nEntry, 0)); - Reference< XDictionary > xDic = aDics.getConstArray()[ nLBPos ]; - if (xDic->remove( sTmpShort )) // sal_True on success + Reference<XDictionary> xDic = aDics.getConstArray()[nLBPos]; + if (xDic->remove(sTmpShort)) // sal_True on success { - pWordsLB->GetModel()->Remove(pEntry); + m_pWordsLB->remove(nEntry); + SelectHdl(*m_pWordsLB); } } } - -IMPL_LINK_NOARG(SvxEditDictionaryDialog, SelectBookHdl_Impl, ListBox&, void) +IMPL_LINK_NOARG(SvxEditDictionaryDialog, SelectBookHdl_Impl, weld::ComboBox&, void) { - sal_Int32 nPos = pAllDictsLB->GetSelectedEntryPos(); - - if ( nPos != LISTBOX_ENTRY_NOTFOUND ) + int nPos = m_xAllDictsLB->get_active(); + if (nPos != -1) { - pNewReplacePB->Enable( false ); - pDeletePB->Enable( false ); + m_xNewReplacePB->set_sensitive( false ); + m_xDeletePB->set_sensitive( false ); // display dictionary ShowWords_Impl( nPos ); // enable or disable new and delete button according to file attributes @@ -401,26 +389,25 @@ IMPL_LINK_NOARG(SvxEditDictionaryDialog, SelectBookHdl_Impl, ListBox&, void) SetDicReadonly_Impl(xDic); bool bEnable = !IsDicReadonly_Impl(); - pLangFT->Enable( bEnable ); - pLangLB->Enable( bEnable ); + m_xLangFT->set_sensitive( bEnable ); + m_xLangLB->set_sensitive( bEnable ); } } - -IMPL_LINK_NOARG(SvxEditDictionaryDialog, SelectLangHdl_Impl, ListBox&, void) +IMPL_LINK_NOARG(SvxEditDictionaryDialog, SelectLangHdl_Impl, weld::ComboBox&, void) { - sal_Int32 nDicPos = pAllDictsLB->GetSelectedEntryPos(); - LanguageType nLang = pLangLB->GetSelectedLanguage(); + int nDicPos = m_xAllDictsLB->get_active(); + LanguageType nLang = m_xLangLB->get_active_id(); Reference< XDictionary > xDic( aDics.getConstArray()[ nDicPos ], UNO_QUERY ); LanguageType nOldLang = LanguageTag( xDic->getLocale() ).getLanguageType(); if ( nLang != nOldLang ) { - std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_xDialog.get(), VclMessageType::Question, VclButtonsType::YesNo, CuiResId(RID_SVXSTR_CONFIRM_SET_LANGUAGE))); OUString sTxt(xBox->get_primary_text()); - sTxt = sTxt.replaceFirst( "%1", pAllDictsLB->GetSelectedEntry() ); + sTxt = sTxt.replaceFirst("%1", m_xAllDictsLB->get_active_text()); xBox->set_primary_text(sTxt); if (xBox->run() == RET_YES) @@ -432,24 +419,23 @@ IMPL_LINK_NOARG(SvxEditDictionaryDialog, SelectLangHdl_Impl, ListBox&, void) ::GetDicInfoStr( xDic->getName(), LanguageTag( xDic->getLocale() ).getLanguageType(), bNegativ ) ); - pAllDictsLB->RemoveEntry( nDicPos ); - pAllDictsLB->InsertEntry( sName, nDicPos ); - pAllDictsLB->SelectEntryPos( nDicPos ); + m_xAllDictsLB->remove(nDicPos); + m_xAllDictsLB->insert_text(nDicPos, sName); + m_xAllDictsLB->set_active(nDicPos); } else SetLanguage_Impl( nOldLang ); } } - void SvxEditDictionaryDialog::ShowWords_Impl( sal_uInt16 nId ) { Reference< XDictionary > xDic = aDics.getConstArray()[ nId ]; - EnterWait(); + weld::WaitObject aWait(m_xDialog.get()); - pWordED->SetText(OUString()); - pReplaceED->SetText(OUString()); + m_xWordED->set_text(OUString()); + m_xReplaceED->set_text(OUString()); bool bIsNegative = xDic->getDictionaryType() != DictionaryType_POSITIVE; bool bLangNone = LanguageTag( @@ -461,44 +447,37 @@ void SvxEditDictionaryDialog::ShowWords_Impl( sal_uInt16 nId ) // the Hunspell based affixation/compounding of the new dictionary word) if (bIsNegative) { - pReplaceFT->SetText(sReplaceFT_Text); + m_xReplaceFT->set_label(sReplaceFT_Text); } else if (!bLangNone) { - pReplaceFT->SetText(CuiResId(RID_SVXSTR_OPT_GRAMMAR_BY)); + m_xReplaceFT->set_label(CuiResId(RID_SVXSTR_OPT_GRAMMAR_BY)); } - sal_uInt16 nTabsCount; if(bIsNegative || !bLangNone) { - nTabsCount=2; - // make controls for replacement text active - if(!pReplaceFT->IsVisible()) + if (!m_xReplaceFT->get_visible()) { - Size aSize=pWordED->GetSizePixel(); - aSize.setWidth(nWidth ); - pWordED->SetSizePixel(aSize); - pReplaceFT->Show(); - pReplaceED->Show(); + m_xReplaceFT->show(); + m_xReplaceED->show(); + m_xSingleColumnLB->hide(); + m_xDoubleColumnLB->show(); + m_pWordsLB = m_xDoubleColumnLB.get(); } } else { - nTabsCount=1; - // deactivate controls for replacement text - if(pReplaceFT->IsVisible()) + if (m_xReplaceFT->get_visible()) { - Size aSize=pWordED->GetSizePixel(); - aSize.setWidth(pWordsLB->GetSizePixel().Width() ); - pWordED->SetSizePixel(aSize); - pReplaceFT->Hide(); - pReplaceED->Hide(); + m_xReplaceFT->hide(); + m_xReplaceED->hide(); + m_xDoubleColumnLB->hide(); + m_xSingleColumnLB->show(); + m_pWordsLB = m_xSingleColumnLB.get(); } - } - pWordsLB->SetTabs(nTabsCount, nStaticTabs); - pWordsLB->Clear(); + m_pWordsLB->clear(); Sequence< Reference< XDictionaryEntry > > aEntries( xDic->getEntries() ); const Reference< XDictionaryEntry > *pEntry = aEntries.getConstArray(); @@ -525,82 +504,90 @@ void SvxEditDictionaryDialog::ShowWords_Impl( sal_uInt16 nId ) return nCmpRes < 0; }); - pWordsLB->SetUpdateMode(false); // speed up insert + m_pWordsLB->freeze(); // speed up insert + int nRow = 0; for (OUString const & rStr : aSortedDicEntries) { - pWordsLB->InsertEntry(rStr, nullptr, false, TREELIST_APPEND); + m_pWordsLB->append_text(rStr.getToken(0, '\t')); + if (m_pWordsLB == m_xDoubleColumnLB.get()) + { + OUString sReplace = rStr.getToken(1, '\t'); + m_pWordsLB->set_text(nRow, sReplace, 1); + ++nRow; + } } - pWordsLB->SetUpdateMode(true); + m_pWordsLB->thaw(); - if (pWordsLB->GetEntryCount()) + if (m_pWordsLB->n_children()) { - pWordED->SetText( pWordsLB->GetEntryText(sal_uLong(0), 0) ); - pReplaceED->SetText( pWordsLB->GetEntryText(sal_uLong(0), 1) ); + m_pWordsLB->select(0); + m_pWordsLB->set_cursor(0); + SelectHdl(*m_pWordsLB); } - - LeaveWait(); } - -IMPL_LINK(SvxEditDictionaryDialog, SelectHdl, SvTreeListBox*, pBox, void) +IMPL_LINK(SvxEditDictionaryDialog, SelectHdl, weld::TreeView&, rBox, void) { - if(!bDoNothing) + if (bDoNothing) + return; + + int nEntry = rBox.get_selected_index(); + + if(!bFirstSelect) { - if(!bFirstSelect) + if (nEntry != -1) { - SvTreeListEntry* pEntry = pBox->FirstSelected(); - OUString sTmpShort(SvTabListBox::GetEntryText(pEntry, 0)); + OUString sTmpShort(rBox.get_text(nEntry, 0)); // without this the cursor is always at the beginning of a word, if the text // is set over the ModifyHdl, although you're editing there at the moment - if(pWordED->GetText() != sTmpShort) - pWordED->SetText(sTmpShort); - pReplaceED->SetText(SvTabListBox::GetEntryText(pEntry, 1)); + if (m_xWordED->get_text() != sTmpShort) + m_xWordED->set_text(sTmpShort); + if (&rBox == m_xDoubleColumnLB.get()) + m_xReplaceED->set_text(rBox.get_text(nEntry, 1)); } - else - bFirstSelect = false; - - // entries in the list box should exactly correspond to those from the - // dictionary. Thus: - pNewReplacePB->Enable(false); - pDeletePB->Enable( !IsDicReadonly_Impl() ); } -}; + else + bFirstSelect = false; + // entries in the list box should exactly correspond to those from the + // dictionary. Thus: + m_xNewReplacePB->set_sensitive(false); + m_xDeletePB->set_sensitive(nEntry != -1 && !IsDicReadonly_Impl()); +} -IMPL_LINK(SvxEditDictionaryDialog, NewDelButtonHdl, Button*, pBtn, void) +IMPL_LINK(SvxEditDictionaryDialog, NewDelButtonHdl, weld::Button&, rBtn, void) { - NewDelHdl(static_cast<PushButton*>(pBtn)); + NewDelHdl(&rBtn); } -IMPL_LINK(SvxEditDictionaryDialog, NewDelActionHdl, SvxDictEdit&, rDictEdit, bool) +IMPL_LINK(SvxEditDictionaryDialog, NewDelActionHdl, weld::Entry&, rDictEdit, bool) { return NewDelHdl(&rDictEdit); } -bool SvxEditDictionaryDialog::NewDelHdl(void const * pBtn) -{ - SvTreeListEntry* pEntry = pWordsLB->FirstSelected(); - if(pBtn == pDeletePB) +bool SvxEditDictionaryDialog::NewDelHdl(const weld::Widget* pBtn) +{ + if (pBtn == m_xDeletePB.get()) { - DBG_ASSERT(pEntry, "no entry selected"); OUString aStr; - pWordED->SetText(aStr); - pReplaceED->SetText(aStr); - pDeletePB->Disable(); + m_xWordED->set_text(aStr); + m_xReplaceED->set_text(aStr); + m_xDeletePB->set_sensitive(false); - RemoveDictEntry(pEntry); // remove entry from dic and list-box + int nEntry = m_pWordsLB->get_selected_index(); + RemoveDictEntry(nEntry); // remove entry from dic and list-box } - if(pBtn == pNewReplacePB || pNewReplacePB->IsEnabled()) + if (pBtn == m_xNewReplacePB.get() || m_xNewReplacePB->get_sensitive()) { - SvTreeListEntry* _pEntry = pWordsLB->FirstSelected(); - OUString aNewWord(pWordED->GetText()); + int nEntry = m_pWordsLB->get_selected_index(); + OUString aNewWord(m_xWordED->get_text()); OUString sEntry(aNewWord); - OUString aReplaceStr(pReplaceED->GetText()); + OUString aReplaceStr(m_xReplaceED->get_text()); DictionaryError nAddRes = DictionaryError::UNKNOWN; - sal_Int32 nPos = pAllDictsLB->GetSelectedEntryPos(); - if ( nPos != LISTBOX_ENTRY_NOTFOUND && !aNewWord.isEmpty()) + int nPos = m_xAllDictsLB->get_active(); + if (nPos != -1 && !aNewWord.isEmpty()) { DBG_ASSERT(nPos < aDics.getLength(), "invalid dictionary index"); Reference< XDictionary > xDic( aDics.getConstArray()[ nPos ], UNO_QUERY ); @@ -614,8 +601,8 @@ bool SvxEditDictionaryDialog::NewDelHdl(void const * pBtn) if(!aReplaceStr.isEmpty()) aRplcText = aReplaceStr; - if (_pEntry) // entry selected in pWordsLB ie action = modify entry - xDic->remove( SvTabListBox::GetEntryText( _pEntry, 0 ) ); + if (nEntry != -1) // entry selected in m_pWordsLB ie action = modify entry + xDic->remove(m_pWordsLB->get_text(nEntry, 0)); // if remove has failed the following add should fail too // and thus a warning message should be triggered... @@ -625,39 +612,33 @@ bool SvxEditDictionaryDialog::NewDelHdl(void const * pBtn) } } if (DictionaryError::NONE != nAddRes) - SvxDicError(GetFrameWeld(), nAddRes); + SvxDicError(m_xDialog.get(), nAddRes); - if(DictionaryError::NONE == nAddRes && !sEntry.isEmpty()) + if (DictionaryError::NONE == nAddRes && !sEntry.isEmpty()) { // insert new entry in list-box etc... + m_pWordsLB->freeze(); - pWordsLB->SetUpdateMode(false); - sal_uLong _nPos = TREELIST_ENTRY_NOTFOUND; - - if(!aReplaceStr.isEmpty()) + if (nEntry != -1) // entry selected in m_pWordsLB ie action = modify entry { - sEntry += "\t" + aReplaceStr; - } - - SvTreeListEntry* pNewEntry = nullptr; - if(_pEntry) // entry selected in pWordsLB ie action = modify entry - { - pWordsLB->SetEntryText( sEntry, _pEntry ); - pNewEntry = _pEntry; + m_pWordsLB->set_text(nEntry, sEntry); + if (!aReplaceStr.isEmpty()) + m_pWordsLB->set_text(nEntry, aReplaceStr, 1); } else { - _nPos = GetLBInsertPos( aNewWord ); - SvTreeListEntry* pInsEntry = pWordsLB->InsertEntry(sEntry, nullptr, false, - _nPos == TREELIST_ENTRY_NOTFOUND ? TREELIST_APPEND : _nPos); - pNewEntry = pInsEntry; + nEntry = GetLBInsertPos(aNewWord); + m_pWordsLB->insert_text(nEntry, sEntry); + if(!aReplaceStr.isEmpty()) + m_pWordsLB->set_text(nEntry, aReplaceStr, 1); } - pWordsLB->MakeVisible( pNewEntry ); - pWordsLB->SetUpdateMode(true); + m_pWordsLB->thaw(); + m_pWordsLB->scroll_to_row(nEntry); + // if the request came from the ReplaceEdit, give focus to the ShortEdit - if(pReplaceED->HasFocus()) - pWordED->GrabFocus(); + if (m_xReplaceED->has_focus()) + m_xWordED->grab_focus(); } } else @@ -666,23 +647,22 @@ bool SvxEditDictionaryDialog::NewDelHdl(void const * pBtn) // which means EndDialog() - has to be evaluated in KeyInput return false; } - ModifyHdl(*pWordED); + ModifyHdl(*m_xWordED); return true; } - -IMPL_LINK(SvxEditDictionaryDialog, ModifyHdl, Edit&, rEdt, void) +IMPL_LINK(SvxEditDictionaryDialog, ModifyHdl, weld::Entry&, rEdt, void) { - OUString rEntry = rEdt.GetText(); + OUString rEntry = rEdt.get_text(); sal_Int32 nWordLen = rEntry.getLength(); - const OUString& rRepString = pReplaceED->GetText(); + const OUString& rRepString = m_xReplaceED->get_text(); bool bEnableNewReplace = false; bool bEnableDelete = false; OUString aNewReplaceText = sNew; - if(&rEdt == pWordED) + if (&rEdt == m_xWordED.get()) { if(nWordLen>0) { @@ -690,19 +670,18 @@ IMPL_LINK(SvxEditDictionaryDialog, ModifyHdl, Edit&, rEdt, void) bool bTmpSelEntry=false; CDE_RESULT eCmpRes = CDE_DIFFERENT; - for(sal_uLong i = 0; i < pWordsLB->GetEntryCount(); i++) + for (int i = 0, nCount = m_pWordsLB->n_children(); i < nCount; ++i) { - SvTreeListEntry* pEntry = pWordsLB->GetEntry( i ); - OUString aTestStr( SvTabListBox::GetEntryText(pEntry, 0) ); + OUString aTestStr(m_pWordsLB->get_text(i, 0)); eCmpRes = cmpDicEntry_Impl( rEntry, aTestStr ); if(CDE_DIFFERENT != eCmpRes) { if(!rRepString.isEmpty()) bFirstSelect = true; bDoNothing=true; - pWordsLB->SetCurEntry(pEntry); + m_pWordsLB->set_cursor(i); bDoNothing=false; - pReplaceED->SetText(SvTabListBox::GetEntryText(pEntry, 1)); + m_xReplaceED->set_text(m_pWordsLB->get_text(i, 1)); if (CDE_SIMILAR == eCmpRes) { @@ -717,7 +696,7 @@ IMPL_LINK(SvxEditDictionaryDialog, ModifyHdl, Edit&, rEdt, void) && !bTmpSelEntry) { bDoNothing=true; - pWordsLB->MakeVisible(pEntry); + m_pWordsLB->scroll_to_row(i); bDoNothing=false; bTmpSelEntry=true; @@ -728,63 +707,48 @@ IMPL_LINK(SvxEditDictionaryDialog, ModifyHdl, Edit&, rEdt, void) if(!bFound) { - pWordsLB->SelectAll(false); - + m_pWordsLB->unselect_all(); aNewReplaceText = sNew; bEnableNewReplace = true; } bEnableDelete = CDE_DIFFERENT != eCmpRes; } - else if(pWordsLB->GetEntryCount()>0) + else if (m_pWordsLB->n_children() > 0) { - SvTreeListEntry* pEntry = pWordsLB->GetEntry( 0 ); bDoNothing=true; - pWordsLB->MakeVisible(pEntry); + m_pWordsLB->scroll_to_row(0); bDoNothing=false; } } - else if(&rEdt == pReplaceED) + else if(&rEdt == m_xReplaceED.get()) { OUString aReplaceText; OUString aWordText; - SvTreeListEntry* pFirstSel = pWordsLB->FirstSelected(); - if (pFirstSel) // a pWordsLB entry is selected + int nFirstSel = m_pWordsLB->get_selected_index(); + if (nFirstSel != -1) // a m_pWordsLB entry is selected { - aWordText = SvTabListBox::GetEntryText( pFirstSel, 0 ); - aReplaceText = SvTabListBox::GetEntryText( pFirstSel, 1 ); + aWordText = m_pWordsLB->get_text(nFirstSel, 0); + aReplaceText = m_pWordsLB->get_text(nFirstSel, 1); aNewReplaceText = sModify; bEnableDelete = true; } bool bIsChange = - CDE_EQUAL != cmpDicEntry_Impl(pWordED->GetText(), aWordText) - || CDE_EQUAL != cmpDicEntry_Impl(pReplaceED->GetText(), aReplaceText); - if (!pWordED->GetText().isEmpty() && bIsChange) + CDE_EQUAL != cmpDicEntry_Impl(m_xWordED->get_text(), aWordText) + || CDE_EQUAL != cmpDicEntry_Impl(m_xReplaceED->get_text(), aReplaceText); + if (!m_xWordED->get_text().isEmpty() && bIsChange) bEnableNewReplace = true; } - pNewReplacePB->SetText( aNewReplaceText ); - pNewReplacePB->Enable( bEnableNewReplace && !IsDicReadonly_Impl() ); - pDeletePB->Enable( bEnableDelete && !IsDicReadonly_Impl() ); + m_xNewReplacePB->set_label(aNewReplaceText); + m_xNewReplacePB->set_sensitive(bEnableNewReplace && !IsDicReadonly_Impl()); + m_xDeletePB->set_sensitive(bEnableDelete && !IsDicReadonly_Impl()); } - -//SvxDictEdit - -void SvxDictEdit::KeyInput( const KeyEvent& rKEvt ) +IMPL_STATIC_LINK(SvxEditDictionaryDialog, InsertTextHdl, OUString&, rText, bool) { - const vcl::KeyCode aKeyCode = rKEvt.GetKeyCode(); - const sal_uInt16 nModifier = aKeyCode.GetModifier(); - if( aKeyCode.GetCode() == KEY_RETURN ) - { - // if there's nothing done on enter, call the - // base class after all to close the dialog - if(!nModifier && !aActionLink.Call(*this)) - Edit::KeyInput(rKEvt); - } - else if(bSpaces || aKeyCode.GetCode() != KEY_SPACE) - Edit::KeyInput(rKEvt); + rText = rText.replaceAll(" ", ""); + return true; } - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx index d9002fddbc46..0cdce26495df 100644 --- a/cui/source/options/optlingu.cxx +++ b/cui/source/options/optlingu.cxx @@ -1518,7 +1518,7 @@ IMPL_LINK( SvxLinguTabPage, ClickHdl_Impl, Button *, pBtn, void ) if (xDic.is()) { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<VclAbstractDialog> aDlg(pFact->CreateSvxEditDictionaryDialog( this, xDic->getName() )); + ScopedVclPtr<VclAbstractDialog> aDlg(pFact->CreateSvxEditDictionaryDialog(GetFrameWeld(), xDic->getName())); aDlg->Execute(); } } diff --git a/cui/uiconfig/ui/editdictionarydialog.ui b/cui/uiconfig/ui/editdictionarydialog.ui index e95e7b0bd0f0..d77c96fb80bb 100644 --- a/cui/uiconfig/ui/editdictionarydialog.ui +++ b/cui/uiconfig/ui/editdictionarydialog.ui @@ -1,12 +1,36 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.22.1 --> <interface domain="cui"> <requires lib="gtk+" version="3.18"/> - <requires lib="LibreOffice" version="1.0"/> + <object class="GtkTreeStore" id="liststore1"> + <columns> + <!-- column-name text --> + <column type="gchararray"/> + <!-- column-name id --> + <column type="gchararray"/> + </columns> + </object> + <object class="GtkTreeStore" id="liststore2"> + <columns> + <!-- column-name text --> + <column type="gchararray"/> + <!-- column-name text2 --> + <column type="gchararray"/> + <!-- column-name id --> + <column type="gchararray"/> + </columns> + </object> <object class="GtkDialog" id="EditDictionaryDialog"> <property name="can_focus">False</property> <property name="border_width">6</property> <property name="title" translatable="yes" context="editdictionarydialog|EditDictionaryDialog">Edit Custom Dictionary</property> + <property name="modal">True</property> + <property name="default_width">0</property> + <property name="default_height">0</property> <property name="type_hint">dialog</property> + <child> + <placeholder/> + </child> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> <property name="can_focus">False</property> @@ -64,43 +88,37 @@ <property name="row_spacing">6</property> <property name="column_spacing">12</property> <child> - <object class="GtkComboBox" id="book"> + <object class="GtkComboBoxText" id="book"> <property name="visible">True</property> <property name="can_focus">False</property> </object> <packing> <property name="left_attach">1</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> - <object class="svxcorelo-SvxLanguageBox" id="lang"> + <object class="GtkComboBoxText" id="lang"> <property name="visible">True</property> <property name="can_focus">False</property> </object> <packing> <property name="left_attach">1</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> <object class="GtkLabel" id="book_label"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="editdictionarydialog|book_label">_Book:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">book</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -114,8 +132,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> @@ -147,7 +163,7 @@ <property name="row_spacing">6</property> <property name="column_spacing">12</property> <child> - <object class="cuilo-SvxDictEdit" id="replace"> + <object class="GtkEntry" id="replace"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> @@ -155,12 +171,10 @@ <packing> <property name="left_attach">1</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> - <object class="cuilo-SvxDictEdit" id="word"> + <object class="GtkEntry" id="word"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> @@ -168,65 +182,136 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> <object class="GtkLabel" id="word_label"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="editdictionarydialog|word_label">_Word</property> <property name="use_underline">True</property> <property name="mnemonic_widget">word</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> <object class="GtkLabel" id="replace_label"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="editdictionarydialog|replace_label">_Replace By</property> <property name="use_underline">True</property> <property name="mnemonic_widget">replace</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">1</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> - <object class="vcllo-SvTabListBox" id="words:border"> + <object class="GtkScrolledWindow"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> - <child internal-child="selection"> - <object class="GtkTreeSelection" id="Tab List-selection1"/> + <property name="shadow_type">in</property> + <child> + <object class="GtkTreeView" id="replaces"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="model">liststore2</property> + <property name="headers_visible">False</property> + <property name="rules_hint">True</property> + <property name="search_column">0</property> + <property name="show_expanders">False</property> + <child internal-child="selection"> + <object class="GtkTreeSelection" id="versions-selection2"/> + </child> + <child> + <object class="GtkTreeViewColumn" id="treeviewcolumn1"> + <property name="resizable">True</property> + <property name="spacing">6</property> + <child> + <object class="GtkCellRendererText" id="cellrenderer1"/> + <attributes> + <attribute name="text">0</attribute> + </attributes> + </child> + </object> + </child> + <child> + <object class="GtkTreeViewColumn" id="treeviewcolumn2"> + <property name="resizable">True</property> + <property name="spacing">6</property> + <child> + <object class="GtkCellRendererText" id="cellrenderer2"/> + <attributes> + <attribute name="text">1</attribute> + </attributes> + </child> + </object> + </child> + </object> </child> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkScrolledWindow"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="shadow_type">in</property> + <child> + <object class="GtkTreeView" id="words"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="model">liststore1</property> + <property name="headers_visible">False</property> + <property name="rules_hint">True</property> + <property name="search_column">0</property> + <property name="show_expanders">False</property> + <child internal-child="selection"> + <object class="GtkTreeSelection"/> + </child> + <child> + <object class="GtkTreeViewColumn" id="treeviewcolumn3"> + <property name="resizable">True</property> + <property name="spacing">6</property> + <child> + <object class="GtkCellRendererText" id="cellrenderer3"/> + <attributes> + <attribute name="text">0</attribute> + </attributes> + </child> + </object> + </child> + </object> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">2</property> </packing> </child> </object> diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in index 4ffd69daf757..eebb7938cbc2 100644 --- a/extras/source/glade/libreoffice-catalog.xml.in +++ b/extras/source/glade/libreoffice-catalog.xml.in @@ -253,9 +253,6 @@ <glade-widget-class title="Ruby Edit" name="svxlo-RubyEdit" generic-name="RubyEdit" parent="GtkEntry" icon-name="widget-gtk-textentry"/> - <glade-widget-class title="Dictionary Edit" name="cuilo-SvxDictEdit" - generic-name="SvxDictEdit" parent="GtkEntry" - icon-name="widget-gtk-textentry"/> <glade-widget-class title="Extended Macro Library" name="basctllo-ExtTreeListBox" generic-name="Extended Macro Library List" parent="GtkTreeView" icon-name="widget-gtk-treeview"/> diff --git a/include/svx/svxdlg.hxx b/include/svx/svxdlg.hxx index 283d3570f602..57d1dc2d93d3 100644 --- a/include/svx/svxdlg.hxx +++ b/include/svx/svxdlg.hxx @@ -383,8 +383,7 @@ public: TransliterationFlags nInitialFlags) = 0; virtual VclPtr<AbstractFmInputRecordNoDialog> CreateFmInputRecordNoDialog(weld::Window* pParent) = 0; virtual VclPtr<AbstractSvxNewDictionaryDialog> CreateSvxNewDictionaryDialog(weld::Window* pParent) = 0; - virtual VclPtr<VclAbstractDialog> CreateSvxEditDictionaryDialog( vcl::Window* pParent, - const OUString& rName) = 0; + virtual VclPtr<VclAbstractDialog> CreateSvxEditDictionaryDialog(weld::Window* pParent, const OUString& rName) = 0; virtual VclPtr<AbstractSvxNameDialog> CreateSvxNameDialog(weld::Window* pParent, const OUString& rName, const OUString& rDesc ) = 0; diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py index ad9924686565..0c26a25b3530 100755 --- a/solenv/bin/native-code.py +++ b/solenv/bin/native-code.py @@ -514,7 +514,6 @@ custom_widgets = [ 'SvxCheckListBox', 'SvxColorListBox', 'SvxColorValueSet', - 'SvxDictEdit', 'SvxFillAttrBox', 'SvxFillTypeBox', 'SvxFontPrevWindow', diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 48387790daf6..76132642c21a 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -4535,6 +4535,7 @@ private: gulong m_nInsertTextSignalId; gulong m_nCursorPosSignalId; gulong m_nSelectionPosSignalId; + gulong m_nActivateSignalId; static void signalChanged(GtkEntry*, gpointer widget) { @@ -4573,6 +4574,22 @@ private: pThis->signal_cursor_position(); } + static void signalActivate(GtkEntry*, gpointer widget) + { + GtkInstanceEntry* pThis = static_cast<GtkInstanceEntry*>(widget); + pThis->signal_activate(); + } + + void signal_activate() + { + if (m_aActivateHdl.IsSet()) + { + SolarMutexGuard aGuard; + if (m_aActivateHdl.Call(*this)) + g_signal_stop_emission_by_name(m_pEntry, "activate"); + } + } + public: GtkInstanceEntry(GtkEntry* pEntry, bool bTakeOwnership) : GtkInstanceWidget(GTK_WIDGET(pEntry), bTakeOwnership) @@ -4581,6 +4598,7 @@ public: , m_nInsertTextSignalId(g_signal_connect(pEntry, "insert-text", G_CALLBACK(signalInsertText), this)) , m_nCursorPosSignalId(g_signal_connect(pEntry, "notify::cursor-position", G_CALLBACK(signalCursorPosition), this)) , m_nSelectionPosSignalId(g_signal_connect(pEntry, "notify::selection-bound", G_CALLBACK(signalCursorPosition), this)) + , m_nActivateSignalId(g_signal_connect(pEntry, "activate", G_CALLBACK(signalActivate), this)) { } @@ -4662,6 +4680,7 @@ public: virtual void disable_notify_events() override { + g_signal_handler_block(m_pEntry, m_nActivateSignalId); g_signal_handler_block(m_pEntry, m_nSelectionPosSignalId); g_signal_handler_block(m_pEntry, m_nCursorPosSignalId); g_signal_handler_block(m_pEntry, m_nInsertTextSignalId); @@ -4676,6 +4695,7 @@ public: g_signal_handler_unblock(m_pEntry, m_nInsertTextSignalId); g_signal_handler_unblock(m_pEntry, m_nCursorPosSignalId); g_signal_handler_unblock(m_pEntry, m_nSelectionPosSignalId); + g_signal_handler_unblock(m_pEntry, m_nActivateSignalId); } virtual vcl::Font get_font() override @@ -4767,6 +4787,7 @@ public: virtual ~GtkInstanceEntry() override { + g_signal_handler_disconnect(m_pEntry, m_nActivateSignalId); g_signal_handler_disconnect(m_pEntry, m_nSelectionPosSignalId); g_signal_handler_disconnect(m_pEntry, m_nCursorPosSignalId); g_signal_handler_disconnect(m_pEntry, m_nInsertTextSignalId); |