diff options
-rw-r--r-- | cui/source/inc/autocdlg.hxx | 72 | ||||
-rw-r--r-- | cui/source/tabpages/autocdlg.cxx | 271 | ||||
-rw-r--r-- | cui/uiconfig/ui/acorexceptpage.ui | 76 | ||||
-rw-r--r-- | extras/source/glade/libreoffice-catalog.xml.in | 3 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests6/autocorrectOptions.py | 12 | ||||
-rw-r--r-- | sd/qa/uitest/impress_tests/autocorrectOptions.py | 12 | ||||
-rwxr-xr-x | solenv/bin/native-code.py | 1 | ||||
-rw-r--r-- | solenv/sanitizers/ui/cui.suppr | 2 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests5/autocorrectOptions.py | 12 |
9 files changed, 215 insertions, 246 deletions
diff --git a/cui/source/inc/autocdlg.hxx b/cui/source/inc/autocdlg.hxx index bc8739ac2fa0..b396ad89e762 100644 --- a/cui/source/inc/autocdlg.hxx +++ b/cui/source/inc/autocdlg.hxx @@ -178,42 +178,8 @@ public: virtual void ActivatePage( const SfxItemSet& ) override; }; -// class AutoCorrEdit ---------------------------------------------------- - -class AutoCorrEdit : public Edit -{ - Link<AutoCorrEdit&,bool> aActionLink; - VclPtr<SvTabListBox> m_xReplaceTLB; - sal_Int32 m_nCol; - bool bSpaces; - - void dispose() override; - -public: - AutoCorrEdit(vcl::Window* pParent) - : Edit(pParent) - , m_nCol(0) - , bSpaces(false) - { - } - - virtual ~AutoCorrEdit() override; - - void SetActionHdl( const Link<AutoCorrEdit&,bool>& rLink ) - { aActionLink = rLink;} - - void ConnectColumn(const VclPtr<SvTabListBox>& rTable, sal_Int32 nCol); - - void SetSpaces(bool bSet) - {bSpaces = bSet;} - - virtual void KeyInput( const KeyEvent& rKEvent ) override; - virtual void Resize() override; -}; - // class OfaAutocorrReplacePage ------------------------------------------ - struct DoubleString { OUString sShort; @@ -308,34 +274,34 @@ class OfaAutocorrExceptPage : public SfxTabPage using TabPage::DeactivatePage; private: - VclPtr<AutoCorrEdit> m_pAbbrevED; - VclPtr<ListBox> m_pAbbrevLB; - VclPtr<PushButton> m_pNewAbbrevPB; - VclPtr<PushButton> m_pDelAbbrevPB; - VclPtr<CheckBox> m_pAutoAbbrevCB; - - VclPtr<AutoCorrEdit> m_pDoubleCapsED; - VclPtr<ListBox> m_pDoubleCapsLB; - VclPtr<PushButton> m_pNewDoublePB; - VclPtr<PushButton> m_pDelDoublePB; - VclPtr<CheckBox> m_pAutoCapsCB; - StringsTable aStringsTable; std::unique_ptr<CollatorWrapper> pCompareClass; LanguageType eLang; - DECL_LINK(NewDelButtonHdl, Button*, void); - DECL_LINK(NewDelActionHdl, AutoCorrEdit&, bool); - DECL_LINK(SelectHdl, ListBox&, void); - DECL_LINK(ModifyHdl, Edit&, void); - void NewDelHdl(void const *); + std::unique_ptr<weld::Entry> m_xAbbrevED; + std::unique_ptr<weld::TreeView> m_xAbbrevLB; + std::unique_ptr<weld::Button> m_xNewAbbrevPB; + std::unique_ptr<weld::Button> m_xDelAbbrevPB; + std::unique_ptr<weld::CheckButton> m_xAutoAbbrevCB; + + std::unique_ptr<weld::Entry> m_xDoubleCapsED; + std::unique_ptr<weld::TreeView> m_xDoubleCapsLB; + std::unique_ptr<weld::Button> m_xNewDoublePB; + std::unique_ptr<weld::Button> m_xDelDoublePB; + std::unique_ptr<weld::CheckButton> m_xAutoCapsCB; + + DECL_LINK(NewDelButtonHdl, weld::Button&, void); + DECL_LINK(NewDelActionHdl, weld::Entry&, bool); + DECL_LINK(SelectHdl, weld::TreeView&, void); + DECL_LINK(ModifyHdl, weld::Entry&, void); + void NewDelHdl(const weld::Widget*); /// Box filled with new language void RefillReplaceBoxes(bool bFromReset, LanguageType eOldLanguage, LanguageType eNewLanguage); public: - OfaAutocorrExceptPage( vcl::Window* pParent, const SfxItemSet& rSet ); - virtual ~OfaAutocorrExceptPage() override; + OfaAutocorrExceptPage(TabPageParent pParent, const SfxItemSet& rSet); + virtual ~OfaAutocorrExceptPage() override; virtual void dispose() override; static VclPtr<SfxTabPage> Create( TabPageParent pParent, diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx index 704f7d821a3d..59aa8353b10d 100644 --- a/cui/source/tabpages/autocdlg.cxx +++ b/cui/source/tabpages/autocdlg.cxx @@ -154,22 +154,21 @@ void OfaAutoCorrDlg::EnableLanguage(bool bEnable) m_pLanguageBox->Enable(bEnable); } -static bool lcl_FindEntry( ListBox& rLB, const OUString& rEntry, - CollatorWrapper const & rCmpClass ) +static bool lcl_FindEntry(weld::TreeView& rLB, const OUString& rEntry, + CollatorWrapper const & rCmpClass) { - sal_Int32 nCount = rLB.GetEntryCount(); - sal_Int32 nSelPos = rLB.GetSelectedEntryPos(); - sal_Int32 i; - for(i = 0; i < nCount; i++) + int nCount = rLB.n_children(); + int nSelPos = rLB.get_selected_index(); + for (int i = 0; i < nCount; i++) { - if( 0 == rCmpClass.compareString(rEntry, rLB.GetEntry(i) )) + if (0 == rCmpClass.compareString(rEntry, rLB.get_text(i))) { - rLB.SelectEntryPos(i); + rLB.select(i); return true; } } - if(LISTBOX_ENTRY_NOTFOUND != nSelPos) - rLB.SelectEntryPos(nSelPos, false); + if (nSelPos != -1) + rLB.unselect(nSelPos); return false; } @@ -1387,42 +1386,42 @@ static bool lcl_FindInArray(std::vector<OUString>& rStrings, const OUString& rSt return false; } -OfaAutocorrExceptPage::OfaAutocorrExceptPage(vcl::Window* pParent, const SfxItemSet& rSet) - : SfxTabPage(pParent, "AcorExceptPage", "cui/ui/acorexceptpage.ui", &rSet) +OfaAutocorrExceptPage::OfaAutocorrExceptPage(TabPageParent pParent, const SfxItemSet& rSet) + : SfxTabPage(pParent, "cui/ui/acorexceptpage.ui", "AcorExceptPage", &rSet) , eLang(eLastDialogLanguage) -{ - get(m_pAbbrevED, "abbrev"); - get(m_pAbbrevLB, "abbrevlist"); - m_pAbbrevLB->SetStyle(m_pAbbrevLB->GetStyle() | WB_SORT); - m_pAbbrevLB->SetDropDownLineCount(7); - get(m_pNewAbbrevPB, "newabbrev"); - get(m_pDelAbbrevPB, "delabbrev"); - get(m_pAutoAbbrevCB, "autoabbrev"); - - get(m_pDoubleCapsED, "double"); - get(m_pDoubleCapsLB, "doublelist"); - m_pDoubleCapsLB->SetStyle(m_pDoubleCapsLB->GetStyle() | WB_SORT); - m_pDoubleCapsLB->SetDropDownLineCount(7); - get(m_pNewDoublePB, "newdouble"); - get(m_pDelDoublePB, "deldouble"); - get(m_pAutoCapsCB, "autodouble"); + , m_xAbbrevED(m_xBuilder->weld_entry("abbrev")) + , m_xAbbrevLB(m_xBuilder->weld_tree_view("abbrevlist")) + , m_xNewAbbrevPB(m_xBuilder->weld_button("newabbrev")) + , m_xDelAbbrevPB(m_xBuilder->weld_button("delabbrev")) + , m_xAutoAbbrevCB(m_xBuilder->weld_check_button("autoabbrev")) + , m_xDoubleCapsED(m_xBuilder->weld_entry("double")) + , m_xDoubleCapsLB(m_xBuilder->weld_tree_view("doublelist")) + , m_xNewDoublePB(m_xBuilder->weld_button("newdouble")) + , m_xDelDoublePB(m_xBuilder->weld_button("deldouble")) + , m_xAutoCapsCB(m_xBuilder->weld_check_button("autodouble")) +{ + m_xAbbrevLB->make_sorted(); + m_xAbbrevLB->set_size_request(-1, m_xAbbrevLB->get_height_rows(7)); + + m_xDoubleCapsLB->make_sorted(); + m_xDoubleCapsLB->set_size_request(-1, m_xDoubleCapsLB->get_height_rows(7)); css::lang::Locale aLcl( LanguageTag::convertToLocale(eLastDialogLanguage )); pCompareClass.reset( new CollatorWrapper( comphelper::getProcessComponentContext() ) ); pCompareClass->loadDefaultCollator( aLcl, 0 ); - m_pNewAbbrevPB->SetClickHdl(LINK(this, OfaAutocorrExceptPage, NewDelButtonHdl)); - m_pDelAbbrevPB->SetClickHdl(LINK(this, OfaAutocorrExceptPage, NewDelButtonHdl)); - m_pNewDoublePB->SetClickHdl(LINK(this, OfaAutocorrExceptPage, NewDelButtonHdl)); - m_pDelDoublePB->SetClickHdl(LINK(this, OfaAutocorrExceptPage, NewDelButtonHdl)); + m_xNewAbbrevPB->connect_clicked(LINK(this, OfaAutocorrExceptPage, NewDelButtonHdl)); + m_xDelAbbrevPB->connect_clicked(LINK(this, OfaAutocorrExceptPage, NewDelButtonHdl)); + m_xNewDoublePB->connect_clicked(LINK(this, OfaAutocorrExceptPage, NewDelButtonHdl)); + m_xDelDoublePB->connect_clicked(LINK(this, OfaAutocorrExceptPage, NewDelButtonHdl)); - m_pAbbrevLB->SetSelectHdl(LINK(this, OfaAutocorrExceptPage, SelectHdl)); - m_pDoubleCapsLB->SetSelectHdl(LINK(this, OfaAutocorrExceptPage, SelectHdl)); - m_pAbbrevED->SetModifyHdl(LINK(this, OfaAutocorrExceptPage, ModifyHdl)); - m_pDoubleCapsED->SetModifyHdl(LINK(this, OfaAutocorrExceptPage, ModifyHdl)); + m_xAbbrevLB->connect_changed(LINK(this, OfaAutocorrExceptPage, SelectHdl)); + m_xDoubleCapsLB->connect_changed(LINK(this, OfaAutocorrExceptPage, SelectHdl)); + m_xAbbrevED->connect_changed(LINK(this, OfaAutocorrExceptPage, ModifyHdl)); + m_xDoubleCapsED->connect_changed(LINK(this, OfaAutocorrExceptPage, ModifyHdl)); - m_pAbbrevED->SetActionHdl(LINK(this, OfaAutocorrExceptPage, NewDelActionHdl)); - m_pDoubleCapsED->SetActionHdl(LINK(this, OfaAutocorrExceptPage, NewDelActionHdl)); + m_xAbbrevED->connect_activate(LINK(this, OfaAutocorrExceptPage, NewDelActionHdl)); + m_xDoubleCapsED->connect_activate(LINK(this, OfaAutocorrExceptPage, NewDelActionHdl)); } OfaAutocorrExceptPage::~OfaAutocorrExceptPage() @@ -1434,23 +1433,13 @@ void OfaAutocorrExceptPage::dispose() { aStringsTable.clear(); pCompareClass.reset(); - m_pAbbrevED.clear(); - m_pAbbrevLB.clear(); - m_pNewAbbrevPB.clear(); - m_pDelAbbrevPB.clear(); - m_pAutoAbbrevCB.clear(); - m_pDoubleCapsED.clear(); - m_pDoubleCapsLB.clear(); - m_pNewDoublePB.clear(); - m_pDelDoublePB.clear(); - m_pAutoCapsCB.clear(); SfxTabPage::dispose(); } -VclPtr<SfxTabPage> OfaAutocorrExceptPage::Create( TabPageParent pParent, - const SfxItemSet* rSet) +VclPtr<SfxTabPage> OfaAutocorrExceptPage::Create(TabPageParent pParent, + const SfxItemSet* rSet) { - return VclPtr<OfaAutocorrExceptPage>::Create(pParent.pParent, *rSet); + return VclPtr<OfaAutocorrExceptPage>::Create(pParent, *rSet); } void OfaAutocorrExceptPage::ActivatePage( const SfxItemSet& ) @@ -1532,15 +1521,15 @@ bool OfaAutocorrExceptPage::FillItemSet( SfxItemSet* ) for( i = nCount; i; ) { OUString aString = (*pWrdList)[ --i ]; - if( LISTBOX_ENTRY_NOTFOUND == m_pDoubleCapsLB->GetEntryPos(aString) ) + if (m_xDoubleCapsLB->find_text(aString) == -1) { pWrdList->erase(i); } } - nCount = m_pDoubleCapsLB->GetEntryCount(); + nCount = m_xDoubleCapsLB->n_children(); for( i = 0; i < nCount; ++i ) { - pWrdList->insert( m_pDoubleCapsLB->GetEntry( i ) ); + pWrdList->insert(m_xDoubleCapsLB->get_text(i)); } pAutoCorrect->SaveWrdSttExceptList(eLang); } @@ -1553,22 +1542,22 @@ bool OfaAutocorrExceptPage::FillItemSet( SfxItemSet* ) for( size_t i = nCount; i; ) { OUString aString = (*pCplList)[ --i ]; - if( LISTBOX_ENTRY_NOTFOUND == m_pAbbrevLB->GetEntryPos(aString) ) + if (m_xAbbrevLB->find_text(aString) == -1) { pCplList->erase(i); } } - sal_Int32 nAbbrevCount = m_pAbbrevLB->GetEntryCount(); + sal_Int32 nAbbrevCount = m_xAbbrevLB->n_children(); for( sal_Int32 ia = 0; ia < nAbbrevCount; ++ia ) { - pCplList->insert( m_pAbbrevLB->GetEntry( ia ) ); + pCplList->insert(m_xAbbrevLB->get_text(ia)); } pAutoCorrect->SaveCplSttExceptList(eLang); } - if(m_pAutoAbbrevCB->IsValueChangedFromSaved()) - pAutoCorrect->SetAutoCorrFlag( ACFlags::SaveWordCplSttLst, m_pAutoAbbrevCB->IsChecked()); - if(m_pAutoCapsCB->IsValueChangedFromSaved()) - pAutoCorrect->SetAutoCorrFlag( ACFlags::SaveWordWrdSttLst, m_pAutoCapsCB->IsChecked()); + if (m_xAutoAbbrevCB->get_state_changed_from_saved()) + pAutoCorrect->SetAutoCorrFlag( ACFlags::SaveWordCplSttLst, m_xAutoAbbrevCB->get_active()); + if (m_xAutoCapsCB->get_state_changed_from_saved()) + pAutoCorrect->SetAutoCorrFlag( ACFlags::SaveWordWrdSttLst, m_xAutoCapsCB->get_active()); return false; } @@ -1581,8 +1570,8 @@ void OfaAutocorrExceptPage::SetLanguage(LanguageType eSet) eLastDialogLanguage = eSet; pCompareClass.reset( new CollatorWrapper( comphelper::getProcessComponentContext() ) ); pCompareClass->loadDefaultCollator( LanguageTag::convertToLocale( eLastDialogLanguage ), 0 ); - ModifyHdl(*m_pAbbrevED); - ModifyHdl(*m_pDoubleCapsED); + ModifyHdl(*m_xAbbrevED); + ModifyHdl(*m_xDoubleCapsED); } } @@ -1609,27 +1598,29 @@ void OfaAutocorrExceptPage::RefillReplaceBoxes(bool bFromReset, pArrays = &aStringsTable[eOldLanguage]; // create new array } - sal_Int32 i; - for(i = 0; i < m_pAbbrevLB->GetEntryCount(); i++) - pArrays->aAbbrevStrings.push_back(m_pAbbrevLB->GetEntry(i)); + sal_Int32 i, nCount; + nCount = m_xAbbrevLB->n_children(); + for(i = 0; i < nCount; i++) + pArrays->aAbbrevStrings.push_back(m_xAbbrevLB->get_text(i)); - for(i = 0; i < m_pDoubleCapsLB->GetEntryCount(); i++) - pArrays->aDoubleCapsStrings.push_back(m_pDoubleCapsLB->GetEntry(i)); + nCount = m_xDoubleCapsLB->n_children(); + for(i = 0; i < nCount; i++) + pArrays->aDoubleCapsStrings.push_back(m_xDoubleCapsLB->get_text(i)); } - m_pDoubleCapsLB->Clear(); - m_pAbbrevLB->Clear(); + m_xDoubleCapsLB->clear(); + m_xAbbrevLB->clear(); OUString sTemp; - m_pAbbrevED->SetText(sTemp); - m_pDoubleCapsED->SetText(sTemp); + m_xAbbrevED->set_text(sTemp); + m_xDoubleCapsED->set_text(sTemp); if(aStringsTable.find(eLang) != aStringsTable.end()) { StringsArrays& rArrays = aStringsTable[eLang]; for (auto const& elem : rArrays.aAbbrevStrings) - m_pAbbrevLB->InsertEntry(elem); + m_xAbbrevLB->append_text(elem); for (auto const& elem : rArrays.aDoubleCapsStrings) - m_pDoubleCapsLB->InsertEntry(elem); + m_xDoubleCapsLB->append_text(elem); } else { @@ -1639,11 +1630,11 @@ void OfaAutocorrExceptPage::RefillReplaceBoxes(bool bFromReset, size_t i; for( i = 0; i < pCplList->size(); i++ ) { - m_pAbbrevLB->InsertEntry((*pCplList)[i]); + m_xAbbrevLB->append_text((*pCplList)[i]); } for( i = 0; i < pWrdList->size(); i++ ) { - m_pDoubleCapsLB->InsertEntry((*pWrdList)[i]); + m_xDoubleCapsLB->append_text((*pWrdList)[i]); } } } @@ -1652,129 +1643,87 @@ void OfaAutocorrExceptPage::Reset( const SfxItemSet* ) { SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect(); RefillReplaceBoxes(true, eLang, eLang); - m_pAutoAbbrevCB-> Check( pAutoCorrect->IsAutoCorrFlag( ACFlags::SaveWordCplSttLst )); - m_pAutoCapsCB-> Check( pAutoCorrect->IsAutoCorrFlag( ACFlags::SaveWordWrdSttLst )); - m_pAutoAbbrevCB->SaveValue(); - m_pAutoCapsCB->SaveValue(); + m_xAutoAbbrevCB->set_active(pAutoCorrect->IsAutoCorrFlag( ACFlags::SaveWordCplSttLst)); + m_xAutoCapsCB->set_active(pAutoCorrect->IsAutoCorrFlag( ACFlags::SaveWordWrdSttLst)); + m_xAutoAbbrevCB->save_state(); + m_xAutoCapsCB->save_state(); } -IMPL_LINK(OfaAutocorrExceptPage, NewDelButtonHdl, Button*, pBtn, void) +IMPL_LINK(OfaAutocorrExceptPage, NewDelButtonHdl, weld::Button&, rBtn, void) { - NewDelHdl(pBtn); + NewDelHdl(&rBtn); } -IMPL_LINK(OfaAutocorrExceptPage, NewDelActionHdl, AutoCorrEdit&, rEdit, bool) +IMPL_LINK(OfaAutocorrExceptPage, NewDelActionHdl, weld::Entry&, rEdit, bool) { NewDelHdl(&rEdit); return false; } -void OfaAutocorrExceptPage::NewDelHdl(void const * pBtn) +void OfaAutocorrExceptPage::NewDelHdl(const weld::Widget* pBtn) { - if((pBtn == m_pNewAbbrevPB || pBtn == m_pAbbrevED.get() ) - && !m_pAbbrevED->GetText().isEmpty()) + if ((pBtn == m_xNewAbbrevPB.get() || pBtn == m_xAbbrevED.get()) + && !m_xAbbrevED->get_text().isEmpty()) { - m_pAbbrevLB->InsertEntry(m_pAbbrevED->GetText()); - ModifyHdl(*m_pAbbrevED); + m_xAbbrevLB->append_text(m_xAbbrevED->get_text()); + ModifyHdl(*m_xAbbrevED); } - else if(pBtn == m_pDelAbbrevPB) + else if(pBtn == m_xDelAbbrevPB.get()) { - m_pAbbrevLB->RemoveEntry(m_pAbbrevED->GetText()); - ModifyHdl(*m_pAbbrevED); + m_xAbbrevLB->remove_text(m_xAbbrevED->get_text()); + ModifyHdl(*m_xAbbrevED); } - else if((pBtn == m_pNewDoublePB || pBtn == m_pDoubleCapsED.get() ) - && !m_pDoubleCapsED->GetText().isEmpty()) + else if((pBtn == m_xNewDoublePB.get() || pBtn == m_xDoubleCapsED.get() ) + && !m_xDoubleCapsED->get_text().isEmpty()) { - m_pDoubleCapsLB->InsertEntry(m_pDoubleCapsED->GetText()); - ModifyHdl(*m_pDoubleCapsED); + m_xDoubleCapsLB->append_text(m_xDoubleCapsED->get_text()); + ModifyHdl(*m_xDoubleCapsED); } - else if(pBtn == m_pDelDoublePB) + else if (pBtn == m_xDelDoublePB.get()) { - m_pDoubleCapsLB->RemoveEntry(m_pDoubleCapsED->GetText()); - ModifyHdl(*m_pDoubleCapsED); + m_xDoubleCapsLB->remove_text(m_xDoubleCapsED->get_text()); + ModifyHdl(*m_xDoubleCapsED); } } -IMPL_LINK(OfaAutocorrExceptPage, SelectHdl, ListBox&, rBox, void) +IMPL_LINK(OfaAutocorrExceptPage, SelectHdl, weld::TreeView&, rBox, void) { - if (&rBox == m_pAbbrevLB) + if (&rBox == m_xAbbrevLB.get()) { - m_pAbbrevED->SetText(rBox.GetSelectedEntry()); - m_pNewAbbrevPB->Enable(false); - m_pDelAbbrevPB->Enable(); + m_xAbbrevED->set_text(rBox.get_selected_text()); + m_xNewAbbrevPB->set_sensitive(false); + m_xDelAbbrevPB->set_sensitive(true); } else { - m_pDoubleCapsED->SetText(rBox.GetSelectedEntry()); - m_pNewDoublePB->Enable(false); - m_pDelDoublePB->Enable(); + m_xDoubleCapsED->set_text(rBox.get_selected_text()); + m_xNewDoublePB->set_sensitive(false); + m_xDelDoublePB->set_sensitive(true); } } -IMPL_LINK(OfaAutocorrExceptPage, ModifyHdl, Edit&, rEdt, void) +IMPL_LINK(OfaAutocorrExceptPage, ModifyHdl, weld::Entry&, rEdt, void) { -// sal_Bool bSame = pEdt->GetText() == ->GetSelectedEntry(); - const OUString& sEntry = rEdt.GetText(); + const OUString& sEntry = rEdt.get_text(); bool bEntryLen = !sEntry.isEmpty(); - if(&rEdt == m_pAbbrevED) + if (&rEdt == m_xAbbrevED.get()) { - bool bSame = lcl_FindEntry(*m_pAbbrevLB, sEntry, *pCompareClass); - if(bSame && sEntry != m_pAbbrevLB->GetSelectedEntry()) - rEdt.SetText(m_pAbbrevLB->GetSelectedEntry()); - m_pNewAbbrevPB->Enable(!bSame && bEntryLen); - m_pDelAbbrevPB->Enable(bSame && bEntryLen); + bool bSame = lcl_FindEntry(*m_xAbbrevLB, sEntry, *pCompareClass); + if(bSame && sEntry != m_xAbbrevLB->get_selected_text()) + rEdt.set_text(m_xAbbrevLB->get_selected_text()); + m_xNewAbbrevPB->set_sensitive(!bSame && bEntryLen); + m_xDelAbbrevPB->set_sensitive(bSame && bEntryLen); } else { - bool bSame = lcl_FindEntry(*m_pDoubleCapsLB, sEntry, *pCompareClass); - if(bSame && sEntry != m_pDoubleCapsLB->GetSelectedEntry()) - rEdt.SetText(m_pDoubleCapsLB->GetSelectedEntry()); - m_pNewDoublePB->Enable(!bSame && bEntryLen); - m_pDelDoublePB->Enable(bSame && bEntryLen); + bool bSame = lcl_FindEntry(*m_xDoubleCapsLB, sEntry, *pCompareClass); + if(bSame && sEntry != m_xDoubleCapsLB->get_selected_text()) + rEdt.set_text(m_xDoubleCapsLB->get_selected_text()); + m_xNewDoublePB->set_sensitive(!bSame && bEntryLen); + m_xDelDoublePB->set_sensitive(bSame && bEntryLen); } } -VCL_BUILDER_FACTORY(AutoCorrEdit) - -void AutoCorrEdit::dispose() -{ - m_xReplaceTLB.disposeAndClear(); - Edit::dispose(); -} - -AutoCorrEdit::~AutoCorrEdit() { - disposeOnce(); -} - -void AutoCorrEdit::ConnectColumn(const VclPtr<SvTabListBox>& rTable, sal_Int32 nCol) -{ - m_xReplaceTLB = rTable; - m_nCol = nCol; -} - -void AutoCorrEdit::KeyInput( const KeyEvent& rKEvt ) -{ - 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); -} - -void AutoCorrEdit::Resize() -{ - Edit::Resize(); - if (!m_xReplaceTLB) - return; - m_xReplaceTLB->SetTab(m_nCol, GetPosPixel().X(), MapUnit::MapPixel); -} - enum OfaQuoteOptions { ADD_NONBRK_SPACE, diff --git a/cui/uiconfig/ui/acorexceptpage.ui b/cui/uiconfig/ui/acorexceptpage.ui index 9fa20b556f6f..bbe486163167 100644 --- a/cui/uiconfig/ui/acorexceptpage.ui +++ b/cui/uiconfig/ui/acorexceptpage.ui @@ -2,6 +2,22 @@ <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 id --> + <column type="gchararray"/> + </columns> + </object> <object class="GtkBox" id="AcorExceptPage"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -33,7 +49,7 @@ <property name="row_spacing">6</property> <property name="column_spacing">12</property> <child> - <object class="cuilo-AutoCorrEdit" id="abbrev"> + <object class="GtkEntry" id="abbrev"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> @@ -135,18 +151,38 @@ </packing> </child> <child> - <object class="GtkScrolledWindow" id="scrolledwindow1"> - <property name="width_request">1</property> + <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="abbrevlist:border"> - <property name="show_expanders">False</property> + <object class="GtkTreeView" id="abbrevlist"> <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="headers_visible">False</property> + <property name="model">liststore2</property> + <property name="search_column">0</property> + <property name="show_expanders">False</property> + <child internal-child="selection"> + <object class="GtkTreeSelection" id="Macro Library List-selection2"/> + </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">0</attribute> + </attributes> + </child> + </object> + </child> </object> </child> </object> @@ -203,7 +239,7 @@ <property name="row_spacing">6</property> <property name="column_spacing">12</property> <child> - <object class="cuilo-AutoCorrEdit" id="double"> + <object class="GtkEntry" id="double"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="valign">start</property> @@ -306,18 +342,38 @@ </packing> </child> <child> - <object class="GtkScrolledWindow" id="scrolledwindow2"> - <property name="width_request">1</property> + <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="doublelist:border"> - <property name="show_expanders">False</property> + <object class="GtkTreeView" id="doublelist"> <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="headers_visible">False</property> + <property name="model">liststore1</property> + <property name="search_column">0</property> + <property name="show_expanders">False</property> + <child internal-child="selection"> + <object class="GtkTreeSelection" id="Macro Library List-selection1"/> + </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> </object> </child> </object> diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in index 3777421a0cc8..dd27e99e302f 100644 --- a/extras/source/glade/libreoffice-catalog.xml.in +++ b/extras/source/glade/libreoffice-catalog.xml.in @@ -268,9 +268,6 @@ <glade-widget-class title="Dictionary Edit" name="cuilo-SvxDictEdit" generic-name="SvxDictEdit" parent="GtkEntry" icon-name="widget-gtk-textentry"/> - <glade-widget-class title="AutoCorrect Edit" name="cuilo-AutoCorrEdit" - generic-name="AutoCorrEdit" parent="GtkEntry" - icon-name="widget-gtk-textentry"/> <glade-widget-class title="Glossary List" name="swuilo-SwGlossaryGroupTLB" generic-name="Glossary List" parent="GtkTreeView" icon-name="widget-gtk-treeview"/> diff --git a/sc/qa/uitest/calc_tests6/autocorrectOptions.py b/sc/qa/uitest/calc_tests6/autocorrectOptions.py index ecd9082b6263..146e3300f64a 100644 --- a/sc/qa/uitest/calc_tests6/autocorrectOptions.py +++ b/sc/qa/uitest/calc_tests6/autocorrectOptions.py @@ -59,16 +59,16 @@ class autocorrectOptions(UITestCase): delabbrev = xDialog.getChild("delabbrev") abbrevlist = xDialog.getChild("abbrevlist") - nrRowsAbb = get_state_as_dict(abbrevlist)["EntryCount"] + nrRowsAbb = get_state_as_dict(abbrevlist)["Children"] abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) abbrev.executeAction("TYPE", mkPropertyValues({"TEXT":"qqqqq"})) newabbrev.executeAction("CLICK", tuple()) - nrRowsAbbNew = get_state_as_dict(abbrevlist)["EntryCount"] + nrRowsAbbNew = get_state_as_dict(abbrevlist)["Children"] nrRowsAbbDiff = int(nrRowsAbbNew) - int(nrRowsAbb) self.assertEqual(nrRowsAbbDiff, 1) #we have +1 rule delabbrev.executeAction("CLICK", tuple()) - self.assertEqual(get_state_as_dict(abbrevlist)["EntryCount"], nrRowsAbb) #we have default nr of rules + self.assertEqual(get_state_as_dict(abbrevlist)["Children"], nrRowsAbb) #we have default nr of rules #words with two initial capitals double = xDialog.getChild("double") @@ -76,16 +76,16 @@ class autocorrectOptions(UITestCase): deldouble = xDialog.getChild("deldouble") doublelist = xDialog.getChild("doublelist") - nrRowsDouble = get_state_as_dict(doublelist)["EntryCount"] + nrRowsDouble = get_state_as_dict(doublelist)["Children"] double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) double.executeAction("TYPE", mkPropertyValues({"TEXT":"QQqqq"})) newdouble.executeAction("CLICK", tuple()) - nrRowsDoubleNew = get_state_as_dict(doublelist)["EntryCount"] + nrRowsDoubleNew = get_state_as_dict(doublelist)["Children"] nrRowsDoubleDiff = int(nrRowsDoubleNew) - int(nrRowsDouble) #convert string and self.assertEqual(nrRowsDoubleDiff, 1) #we have +1 rule deldouble.executeAction("CLICK", tuple()) - self.assertEqual(get_state_as_dict(doublelist)["EntryCount"], nrRowsDouble) #we have default nr of rules + self.assertEqual(get_state_as_dict(doublelist)["Children"], nrRowsDouble) #we have default nr of rules xCancelButton = xDialog.getChild("cancel") xCancelButton.executeAction("CLICK", tuple()) diff --git a/sd/qa/uitest/impress_tests/autocorrectOptions.py b/sd/qa/uitest/impress_tests/autocorrectOptions.py index c4140bab4059..759304e01071 100644 --- a/sd/qa/uitest/impress_tests/autocorrectOptions.py +++ b/sd/qa/uitest/impress_tests/autocorrectOptions.py @@ -60,16 +60,16 @@ class autocorrectOptions(UITestCase): delabbrev = xDialog.getChild("delabbrev") abbrevlist = xDialog.getChild("abbrevlist") - nrRowsAbb = get_state_as_dict(abbrevlist)["EntryCount"] + nrRowsAbb = get_state_as_dict(abbrevlist)["Children"] abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) abbrev.executeAction("TYPE", mkPropertyValues({"TEXT":"qqqqq"})) newabbrev.executeAction("CLICK", tuple()) - nrRowsAbbNew = get_state_as_dict(abbrevlist)["EntryCount"] + nrRowsAbbNew = get_state_as_dict(abbrevlist)["Children"] nrRowsAbbDiff = int(nrRowsAbbNew) - int(nrRowsAbb) self.assertEqual(nrRowsAbbDiff, 1) #we have +1 rule delabbrev.executeAction("CLICK", tuple()) - self.assertEqual(get_state_as_dict(abbrevlist)["EntryCount"], nrRowsAbb) #we have default nr of rules + self.assertEqual(get_state_as_dict(abbrevlist)["Children"], nrRowsAbb) #we have default nr of rules #words with two initial capitals double = xDialog.getChild("double") @@ -77,16 +77,16 @@ class autocorrectOptions(UITestCase): deldouble = xDialog.getChild("deldouble") doublelist = xDialog.getChild("doublelist") - nrRowsDouble = get_state_as_dict(doublelist)["EntryCount"] + nrRowsDouble = get_state_as_dict(doublelist)["Children"] double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) double.executeAction("TYPE", mkPropertyValues({"TEXT":"QQqqq"})) newdouble.executeAction("CLICK", tuple()) - nrRowsDoubleNew = get_state_as_dict(doublelist)["EntryCount"] + nrRowsDoubleNew = get_state_as_dict(doublelist)["Children"] nrRowsDoubleDiff = int(nrRowsDoubleNew) - int(nrRowsDouble) #convert string and self.assertEqual(nrRowsDoubleDiff, 1) #we have +1 rule deldouble.executeAction("CLICK", tuple()) - self.assertEqual(get_state_as_dict(doublelist)["EntryCount"], nrRowsDouble) #we have default nr of rules + self.assertEqual(get_state_as_dict(doublelist)["Children"], nrRowsDouble) #we have default nr of rules xCancelButton = xDialog.getChild("cancel") xCancelButton.executeAction("CLICK", tuple()) diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py index c3cc2b1f0edb..7aa3ad5bfa58 100755 --- a/solenv/bin/native-code.py +++ b/solenv/bin/native-code.py @@ -403,7 +403,6 @@ constructor_map = { custom_widgets = [ 'ArgEdit', 'AutoCompleteMultiListBox', - 'AutoCorrEdit', 'BookmarksBox', 'CaptionComboBox', 'CategoryListBox', diff --git a/solenv/sanitizers/ui/cui.suppr b/solenv/sanitizers/ui/cui.suppr index a78c3a762914..5b0429602d10 100644 --- a/solenv/sanitizers/ui/cui.suppr +++ b/solenv/sanitizers/ui/cui.suppr @@ -18,6 +18,8 @@ cui/uiconfig/ui/aboutconfigdialog.ui://GtkLabel[@id='value'] orphan-label cui/uiconfig/ui/aboutconfigdialog.ui://svtlo-SvSimpleTableContainer[@id='preferences'] no-labelled-by cui/uiconfig/ui/aboutconfigvaluedialog.ui://GtkLabel[@id='label1'] orphan-label cui/uiconfig/ui/aboutconfigvaluedialog.ui://cuilo-CuiCustomMultilineEdit[@id='valuebox'] no-labelled-by +cui/uiconfig/ui/acorexceptpage.ui://GtkEntry[@id='abbrev'] no-labelled-by +cui/uiconfig/ui/acorexceptpage.ui://GtkEntry[@id='double'] no-labelled-by cui/uiconfig/ui/applyautofmtpage.ui://GtkLabel[@id='label1'] orphan-label cui/uiconfig/ui/applyautofmtpage.ui://GtkLabel[@id='label2'] orphan-label cui/uiconfig/ui/applyautofmtpage.ui://GtkLabel[@id='m'] orphan-label diff --git a/sw/qa/uitest/writer_tests5/autocorrectOptions.py b/sw/qa/uitest/writer_tests5/autocorrectOptions.py index 648dd218e506..925cbb59b293 100644 --- a/sw/qa/uitest/writer_tests5/autocorrectOptions.py +++ b/sw/qa/uitest/writer_tests5/autocorrectOptions.py @@ -59,16 +59,16 @@ class autocorrectOptions(UITestCase): delabbrev = xDialog.getChild("delabbrev") abbrevlist = xDialog.getChild("abbrevlist") - nrRowsAbb = get_state_as_dict(abbrevlist)["EntryCount"] + nrRowsAbb = get_state_as_dict(abbrevlist)["Children"] abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) abbrev.executeAction("TYPE", mkPropertyValues({"TEXT":"qqqqq"})) newabbrev.executeAction("CLICK", tuple()) - nrRowsAbbNew = get_state_as_dict(abbrevlist)["EntryCount"] + nrRowsAbbNew = get_state_as_dict(abbrevlist)["Children"] nrRowsAbbDiff = int(nrRowsAbbNew) - int(nrRowsAbb) self.assertEqual(nrRowsAbbDiff, 1) #we have +1 rule delabbrev.executeAction("CLICK", tuple()) - self.assertEqual(get_state_as_dict(abbrevlist)["EntryCount"], nrRowsAbb) #we have default nr of rules + self.assertEqual(get_state_as_dict(abbrevlist)["Children"], nrRowsAbb) #we have default nr of rules #words with two initial capitals double = xDialog.getChild("double") @@ -76,16 +76,16 @@ class autocorrectOptions(UITestCase): deldouble = xDialog.getChild("deldouble") doublelist = xDialog.getChild("doublelist") - nrRowsDouble = get_state_as_dict(doublelist)["EntryCount"] + nrRowsDouble = get_state_as_dict(doublelist)["Children"] double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) double.executeAction("TYPE", mkPropertyValues({"TEXT":"QQqqq"})) newdouble.executeAction("CLICK", tuple()) - nrRowsDoubleNew = get_state_as_dict(doublelist)["EntryCount"] + nrRowsDoubleNew = get_state_as_dict(doublelist)["Children"] nrRowsDoubleDiff = int(nrRowsDoubleNew) - int(nrRowsDouble) #convert string and self.assertEqual(nrRowsDoubleDiff, 1) #we have +1 rule deldouble.executeAction("CLICK", tuple()) - self.assertEqual(get_state_as_dict(doublelist)["EntryCount"], nrRowsDouble) #we have default nr of rules + self.assertEqual(get_state_as_dict(doublelist)["Children"], nrRowsDouble) #we have default nr of rules xCancelButton = xDialog.getChild("cancel") xCancelButton.executeAction("CLICK", tuple()) |