summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--extras/source/glade/libreoffice-catalog.xml.in6
-rwxr-xr-xsolenv/bin/native-code.py2
-rw-r--r--sw/source/ui/misc/glosbib.cxx301
-rw-r--r--sw/source/ui/misc/glossary.cxx6
-rw-r--r--sw/source/uibase/inc/glosbib.hxx79
-rw-r--r--sw/uiconfig/swriter/ui/editcategories.ui124
-rw-r--r--vcl/source/app/salvtables.cxx7
7 files changed, 266 insertions, 259 deletions
diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in
index 89c1348c2c1a..47505da352aa 100644
--- a/extras/source/glade/libreoffice-catalog.xml.in
+++ b/extras/source/glade/libreoffice-catalog.xml.in
@@ -256,18 +256,12 @@
<glade-widget-class title="Chart Light Button" name="chartcontrollerlo-LightButton"
generic-name="ChartLightButton" parent="GtkButton"
icon-name="widget-gtk-button"/>
- <glade-widget-class title="Category Edit" name="swuilo-FEdit"
- generic-name="CategoryEdit" parent="GtkEntry"
- icon-name="widget-gtk-textentry"/>
<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="Glossary List" name="swuilo-SwGlossaryGroupTLB"
- generic-name="Glossary List" parent="GtkTreeView"
- icon-name="widget-gtk-treeview"/>
<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/solenv/bin/native-code.py b/solenv/bin/native-code.py
index e21d19270afc..f35d4e89aab4 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -422,7 +422,6 @@ custom_widgets = [
'EmojiView',
'ExtBoxWithBtns',
'ExtensionBox',
- 'FEdit',
'FontNameBox',
'FontSizeBox',
'FontStyleBox',
@@ -513,7 +512,6 @@ custom_widgets = [
'SwCaptionPreview',
'SwFieldRefTreeListBox',
'SwGlTreeListBox',
- 'SwGlossaryGroupTLB',
'SwIdxTreeListBox',
'SwMarkPreview',
'SwNavHelpToolBox',
diff --git a/sw/source/ui/misc/glosbib.cxx b/sw/source/ui/misc/glosbib.cxx
index 3e8d9a3f7bde..82febac648ed 100644
--- a/sw/source/ui/misc/glosbib.cxx
+++ b/sw/source/ui/misc/glosbib.cxx
@@ -44,53 +44,55 @@
#define RENAME_TOKEN_DELIM u'\x0001'
-SwGlossaryGroupDlg::SwGlossaryGroupDlg(vcl::Window * pParent,
+SwGlossaryGroupDlg::SwGlossaryGroupDlg(weld::Window * pParent,
std::vector<OUString> const& rPathArr, SwGlossaryHdl *pHdl)
- : SvxStandardDialog(pParent, "EditCategoriesDialog",
- "modules/swriter/ui/editcategories.ui")
+ : SfxDialogController(pParent, "modules/swriter/ui/editcategories.ui",
+ "EditCategoriesDialog")
+ , m_pParent(pParent)
, pGlosHdl(pHdl)
+ , m_xNameED(m_xBuilder->weld_entry("name"))
+ , m_xPathLB(m_xBuilder->weld_combo_box("pathlb"))
+ , m_xGroupTLB(m_xBuilder->weld_tree_view("group"))
+ , m_xNewPB(m_xBuilder->weld_button("new"))
+ , m_xDelPB(m_xBuilder->weld_button("delete"))
+ , m_xRenamePB(m_xBuilder->weld_button("rename"))
{
- get(m_pPathLB, "pathlb");
- get(m_pNewPB, "new");
- get(m_pDelPB, "delete");
- get(m_pRenamePB, "rename");
- get(m_pNameED, "name");
- get(m_pGroupTLB, "group");
-
- const int nAppFontUnits = 130;
- long nWidth = LogicToPixel(Size(nAppFontUnits, 0), MapMode(MapUnit::MapAppFont)).Width();
- m_pPathLB->set_width_request(nWidth);
+ int nWidth = m_xGroupTLB->get_approximate_digit_width() * 34;
+ m_xPathLB->set_size_request(nWidth, -1);
//just has to be something small, real size will be available space
- m_pGroupTLB->set_width_request(nWidth);
- m_pGroupTLB->set_height_request(GetTextHeight() * 10);
+ m_xGroupTLB->set_size_request(nWidth, m_xGroupTLB->get_height_rows(10));
- long nTabs[] = { 0, nAppFontUnits };
+ std::vector<int> aWidths;
+ aWidths.push_back(nWidth);
+ m_xGroupTLB->set_column_fixed_widths(aWidths);
+ m_xGroupTLB->connect_changed(LINK(this, SwGlossaryGroupDlg, SelectHdl));
- m_pGroupTLB->SetTabs( SAL_N_ELEMENTS(nTabs), nTabs );
- m_pGroupTLB->SetSelectHdl(LINK(this, SwGlossaryGroupDlg, SelectHdl));
- m_pGroupTLB->GetModel()->SetSortMode(SortAscending);
- m_pNewPB->SetClickHdl(LINK(this, SwGlossaryGroupDlg, NewHdl));
- m_pDelPB->SetClickHdl(LINK(this, SwGlossaryGroupDlg, DeleteHdl));
- m_pNameED->SetModifyHdl(LINK(this, SwGlossaryGroupDlg, ModifyHdl));
- m_pPathLB->SetSelectHdl(LINK(this, SwGlossaryGroupDlg, ModifyListBoxHdl));
- m_pRenamePB->SetClickHdl(LINK(this, SwGlossaryGroupDlg, RenameHdl));
+ m_xNewPB->connect_clicked(LINK(this, SwGlossaryGroupDlg, NewHdl));
+ m_xDelPB->connect_clicked(LINK(this, SwGlossaryGroupDlg, DeleteHdl));
+ m_xNameED->connect_changed(LINK(this, SwGlossaryGroupDlg, ModifyHdl));
+ m_xNameED->connect_insert_text(LINK(this, SwGlossaryGroupDlg, EditInsertTextHdl));
+ m_xPathLB->connect_changed(LINK(this, SwGlossaryGroupDlg, ModifyListBoxHdl));
+ m_xRenamePB->connect_clicked(LINK(this, SwGlossaryGroupDlg, RenameHdl));
+
+ m_xNameED->connect_size_allocate(LINK(this, SwGlossaryGroupDlg, EntrySizeAllocHdl));
+ m_xPathLB->connect_size_allocate(LINK(this, SwGlossaryGroupDlg, EntrySizeAllocHdl));
for (size_t i = 0; i < rPathArr.size(); ++i)
{
INetURLObject aTempURL(rPathArr[i]);
const OUString sPath = aTempURL.GetMainURL(INetURLObject::DecodeMechanism::WithCharset );
- m_pPathLB->InsertEntry(sPath);
- sal_uLong nCaseReadonly = 0;
+ sal_uInt32 nCaseReadonly = 0;
utl::TempFile aTempFile(&sPath);
aTempFile.EnableKillingFile();
if(!aTempFile.IsValid())
nCaseReadonly |= PATH_READONLY;
else if( SWUnoHelper::UCB_IsCaseSensitiveFileName( aTempFile.GetURL()))
nCaseReadonly |= PATH_CASE_SENSITIVE;
- m_pPathLB->SetEntryData(i, reinterpret_cast<void*>(nCaseReadonly));
+ OUString sId(OUString::number(nCaseReadonly));
+ m_xPathLB->append(sId, sPath);
}
- m_pPathLB->SelectEntryPos(0);
- m_pPathLB->Enable();
+ m_xPathLB->set_active(0);
+ m_xPathLB->set_sensitive(true);
const size_t nCount = pHdl->GetGroupCnt();
/* tdf#111870 "My AutoText" comes from mytexts.bau but should be translated
@@ -108,34 +110,38 @@ SwGlossaryGroupDlg::SwGlossaryGroupDlg(vcl::Window * pParent,
pData->sGroupTitle = SwResId(STR_MY_AUTOTEXT);
else
pData->sGroupTitle = sTitle;
- pData->sPath = m_pPathLB->GetEntry(sGroup.getToken(1, GLOS_DELIM).toInt32());
- SvTreeListEntry* pEntry = m_pGroupTLB->InsertEntry(pData->sGroupTitle + "\t" + pData->sPath);
- pEntry->SetUserData(pData);
+ pData->sPath = m_xPathLB->get_text(sGroup.getToken(1, GLOS_DELIM).toInt32());
+ OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pData)));
+ m_xGroupTLB->append(sId, pData->sGroupTitle);
+ int nEntry = m_xGroupTLB->find_id(sId);
+ m_xGroupTLB->set_text(nEntry, pData->sPath, 1);
}
- m_pGroupTLB->GetModel()->Resort();
+ m_xGroupTLB->make_sorted();
}
SwGlossaryGroupDlg::~SwGlossaryGroupDlg()
{
- disposeOnce();
+ int nCount = m_xGroupTLB->n_children();
+ for (int i = 0; i < nCount; ++i)
+ {
+ GlosBibUserData* pUserData = reinterpret_cast<GlosBibUserData*>(m_xGroupTLB->get_id(i).toInt64());
+ delete pUserData;
+ }
}
-void SwGlossaryGroupDlg::dispose()
+short SwGlossaryGroupDlg::run()
{
- m_pNameED.clear();
- m_pPathLB.clear();
- m_pGroupTLB.clear();
- m_pNewPB.clear();
- m_pDelPB.clear();
- m_pRenamePB.clear();
- SvxStandardDialog::dispose();
+ short nRet = SfxDialogController::run();
+ if (nRet == RET_OK)
+ Apply();
+ return nRet;
}
void SwGlossaryGroupDlg::Apply()
{
- if(m_pNewPB->IsEnabled())
- NewHdl(m_pNewPB);
+ if (m_xNewPB->get_sensitive())
+ NewHdl(*m_xNewPB);
OUString aActGroup = SwGlossaryDlg::GetCurrGroup();
@@ -145,10 +151,9 @@ void SwGlossaryGroupDlg::Apply()
if( sDelGroup == aActGroup )
{
//when the current group is deleted, the current group has to be relocated
- if(m_pGroupTLB->GetEntryCount())
+ if (m_xGroupTLB->n_children())
{
- SvTreeListEntry* pFirst = m_pGroupTLB->First();
- GlosBibUserData* pUserData = static_cast<GlosBibUserData*>(pFirst->GetUserData());
+ GlosBibUserData* pUserData = reinterpret_cast<GlosBibUserData*>(m_xGroupTLB->get_id(0).toInt64());
pGlosHdl->SetCurGroup(pUserData->sGroupName);
}
}
@@ -157,8 +162,7 @@ void SwGlossaryGroupDlg::Apply()
+ sTitle
+ SwResId(STR_QUERY_DELETE_GROUP2));
- vcl::Window* pWin = GetParent();
- std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
+ std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(m_pParent,
VclMessageType::Question, VclButtonsType::YesNo, sMsg));
xQueryBox->set_default_response(RET_NO);
if (RET_YES == xQueryBox->run())
@@ -189,57 +193,72 @@ void SwGlossaryGroupDlg::Apply()
}
}
-IMPL_LINK_NOARG( SwGlossaryGroupDlg, SelectHdl, SvTreeListBox*, void )
+IMPL_LINK_NOARG( SwGlossaryGroupDlg, SelectHdl, weld::TreeView&, void )
{
- m_pNewPB->Enable(false);
- SvTreeListEntry* pFirstEntry = m_pGroupTLB->FirstSelected();
- if(pFirstEntry)
+ m_xNewPB->set_sensitive(false);
+ int nFirstEntry = m_xGroupTLB->get_selected_index();
+ if (nFirstEntry != -1)
{
- GlosBibUserData* pUserData = static_cast<GlosBibUserData*>(pFirstEntry->GetUserData());
+ GlosBibUserData* pUserData = reinterpret_cast<GlosBibUserData*>(m_xGroupTLB->get_id(nFirstEntry).toInt64());
OUString sEntry(pUserData->sGroupName);
- OUString sName(m_pNameED->GetText());
+ OUString sName(m_xNameED->get_text());
bool bExists = false;
- sal_uLong nPos = m_pGroupTLB->GetEntryPos(sName, 0);
- if( 0xffffffff > nPos)
+ int nPos = m_xGroupTLB->find_text(sName);
+ if (nPos != -1)
{
- SvTreeListEntry* pEntry = m_pGroupTLB->GetEntry(nPos);
- GlosBibUserData* pFoundData = static_cast<GlosBibUserData*>(pEntry->GetUserData());
+ GlosBibUserData* pFoundData = reinterpret_cast<GlosBibUserData*>(m_xGroupTLB->get_id(nPos).toInt64());
+ fprintf(stderr, "comparing %s and %s\n",
+ OUStringToOString(pFoundData->sGroupName, RTL_TEXTENCODING_UTF8).getStr(),
+ OUStringToOString(sEntry, RTL_TEXTENCODING_UTF8).getStr());
bExists = pFoundData->sGroupName == sEntry;
}
- m_pRenamePB->Enable(!bExists && !sName.isEmpty());
- m_pDelPB->Enable(IsDeleteAllowed(sEntry));
+ m_xRenamePB->set_sensitive(!bExists && !sName.isEmpty());
+ fprintf(stderr, "one rename %d\n", !bExists && !sName.isEmpty());
+ m_xDelPB->set_sensitive(IsDeleteAllowed(sEntry));
}
}
-IMPL_LINK_NOARG(SwGlossaryGroupDlg, NewHdl, Button*, void)
+IMPL_LINK_NOARG(SwGlossaryGroupDlg, NewHdl, weld::Button&, void)
{
- OUString sGroup = m_pNameED->GetText()
+ OUString sGroup = m_xNameED->get_text()
+ OUStringLiteral1(GLOS_DELIM)
- + OUString::number(m_pPathLB->GetSelectedEntryPos());
+ + OUString::number(m_xPathLB->get_active());
OSL_ENSURE(!pGlosHdl->FindGroupName(sGroup), "group already available!");
m_InsertedArr.push_back(sGroup);
- const OUString sTemp(m_pNameED->GetText() + "\t" + m_pPathLB->GetSelectedEntry());
- SvTreeListEntry* pEntry = m_pGroupTLB->InsertEntry(sTemp);
GlosBibUserData* pData = new GlosBibUserData;
- pData->sPath = m_pPathLB->GetSelectedEntry();
+ pData->sPath = m_xPathLB->get_active_text();
pData->sGroupName = sGroup;
- pData->sGroupTitle = m_pNameED->GetText();
- pEntry->SetUserData(pData);
- m_pGroupTLB->Select(pEntry);
- m_pGroupTLB->MakeVisible(pEntry);
- m_pGroupTLB->GetModel()->Resort();
+ pData->sGroupTitle = m_xNameED->get_text();
+ OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pData)));
+ m_xGroupTLB->append(sId, m_xNameED->get_text());
+ int nEntry = m_xGroupTLB->find_id(sId);
+ m_xGroupTLB->set_text(nEntry, pData->sPath, 1);
+ m_xGroupTLB->select(nEntry);
+ SelectHdl(*m_xGroupTLB);
+ m_xGroupTLB->scroll_to_row(nEntry);
}
-IMPL_LINK( SwGlossaryGroupDlg, DeleteHdl, Button*, pButton, void )
+IMPL_LINK_NOARG(SwGlossaryGroupDlg, EntrySizeAllocHdl, const Size&, void)
{
- SvTreeListEntry* pEntry = m_pGroupTLB->FirstSelected();
- if(!pEntry)
+ std::vector<int> aWidths;
+ int x, y, width, height;
+ if (m_xPathLB->get_extents_relative_to(*m_xGroupTLB, x, y, width, height))
{
- pButton->Enable(false);
+ aWidths.push_back(x);
+ m_xGroupTLB->set_column_fixed_widths(aWidths);
+ }
+}
+
+IMPL_LINK( SwGlossaryGroupDlg, DeleteHdl, weld::Button&, rButton, void )
+{
+ int nEntry = m_xGroupTLB->get_selected_index();
+ if (nEntry == -1)
+ {
+ rButton.set_sensitive(false);
return;
}
- GlosBibUserData* pUserData = static_cast<GlosBibUserData*>(pEntry->GetUserData());
+ GlosBibUserData* pUserData = reinterpret_cast<GlosBibUserData*>(m_xGroupTLB->get_id(nEntry).toInt64());
OUString const sEntry(pUserData->sGroupName);
// if the name to be deleted is among the new ones - get rid of it
bool bDelete = true;
@@ -265,23 +284,24 @@ IMPL_LINK( SwGlossaryGroupDlg, DeleteHdl, Button*, pButton, void )
m_RemovedArr.emplace_back(pUserData->sGroupName + "\t" + pUserData->sGroupTitle);
}
delete pUserData;
- m_pGroupTLB->GetModel()->Remove(pEntry);
- if(!m_pGroupTLB->First())
- pButton->Enable(false);
+ m_xGroupTLB->remove(nEntry);
+ if (!m_xGroupTLB->n_children())
+ rButton.set_sensitive(false);
//the content must be deleted - otherwise the new handler would be called in Apply()
- m_pNameED->SetText(aEmptyOUStr);
+ m_xNameED->set_text(aEmptyOUStr);
+ ModifyHdl(*m_xNameED);
}
-IMPL_LINK_NOARG(SwGlossaryGroupDlg, RenameHdl, Button*, void)
+IMPL_LINK_NOARG(SwGlossaryGroupDlg, RenameHdl, weld::Button&, void)
{
- SvTreeListEntry* pEntry = m_pGroupTLB->FirstSelected();
- GlosBibUserData* pUserData = static_cast<GlosBibUserData*>(pEntry->GetUserData());
+ int nEntry = m_xGroupTLB->get_selected_index();
+ GlosBibUserData* pUserData = reinterpret_cast<GlosBibUserData*>(m_xGroupTLB->get_id(nEntry).toInt64());
OUString sEntry(pUserData->sGroupName);
- const OUString sNewTitle(m_pNameED->GetText());
+ const OUString sNewTitle(m_xNameED->get_text());
OUString sNewName = sNewTitle
+ OUStringLiteral1(GLOS_DELIM)
- + OUString::number(m_pPathLB->GetSelectedEntryPos());
+ + OUString::number(m_xPathLB->get_active());
OSL_ENSURE(!pGlosHdl->FindGroupName(sNewName), "group already available!");
// if the name to be renamed is among the new ones - replace
@@ -299,47 +319,49 @@ IMPL_LINK_NOARG(SwGlossaryGroupDlg, RenameHdl, Button*, void)
+ OUStringLiteral1(RENAME_TOKEN_DELIM) + sNewTitle;
m_RenamedArr.push_back(sEntry);
}
- delete static_cast<GlosBibUserData*>(pEntry->GetUserData());
- m_pGroupTLB->GetModel()->Remove(pEntry);
- pEntry = m_pGroupTLB->InsertEntry(m_pNameED->GetText() + "\t"
- + m_pPathLB->GetSelectedEntry());
+ delete pUserData;
+ m_xGroupTLB->remove(nEntry);
+
GlosBibUserData* pData = new GlosBibUserData;
- pData->sPath = m_pPathLB->GetSelectedEntry();
+ pData->sPath = m_xPathLB->get_active_text();
pData->sGroupName = sNewName;
pData->sGroupTitle = sNewTitle;
- pEntry->SetUserData(pData);
- m_pGroupTLB->Select(pEntry);
- m_pGroupTLB->MakeVisible(pEntry);
- m_pGroupTLB->GetModel()->Resort();
+
+ OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pData)));
+ m_xGroupTLB->append(sId, m_xNameED->get_text());
+ nEntry = m_xGroupTLB->find_id(sId);
+ m_xGroupTLB->set_text(nEntry, m_xPathLB->get_active_text(), 1);
+ m_xGroupTLB->select(nEntry);
+ SelectHdl(*m_xGroupTLB);
+ m_xGroupTLB->scroll_to_row(nEntry);
}
-IMPL_LINK_NOARG(SwGlossaryGroupDlg, ModifyListBoxHdl, ListBox&, void)
+IMPL_LINK_NOARG(SwGlossaryGroupDlg, ModifyListBoxHdl, weld::ComboBox&, void)
{
- ModifyHdl(*m_pNameED);
+ ModifyHdl(*m_xNameED);
}
-IMPL_LINK_NOARG(SwGlossaryGroupDlg, ModifyHdl, Edit&, void)
+
+IMPL_LINK_NOARG(SwGlossaryGroupDlg, ModifyHdl, weld::Entry&, void)
{
- OUString sEntry(m_pNameED->GetText());
+ OUString sEntry(m_xNameED->get_text());
bool bEnableNew = true;
bool bEnableDel = false;
- sal_uLong nCaseReadonly =
- reinterpret_cast<sal_uLong>(m_pPathLB->GetSelectedEntryData());
+ sal_uInt32 nCaseReadonly = m_xPathLB->get_active_id().toUInt32();
bool bDirReadonly = 0 != (nCaseReadonly&PATH_READONLY);
- if(sEntry.isEmpty() || bDirReadonly)
+ if (sEntry.isEmpty() || bDirReadonly)
bEnableNew = false;
else if(!sEntry.isEmpty())
{
- sal_uLong nPos = m_pGroupTLB->GetEntryPos(sEntry, 0);
+ int nPos = m_xGroupTLB->find_text(sEntry);
//if it's not case sensitive you have to search for yourself
- if( 0xffffffff == nPos)
+ if (nPos == -1)
{
const ::utl::TransliterationWrapper& rSCmp = GetAppCmpStrIgnore();
- for(sal_uLong i = 0; i < m_pGroupTLB->GetEntryCount(); i++)
+ for (int i = 0, nEntryCount = m_xGroupTLB->n_children(); i < nEntryCount; ++i)
{
- OUString sTemp = m_pGroupTLB->GetEntryText( i, 0 );
- nCaseReadonly = reinterpret_cast<sal_uLong>(m_pPathLB->GetEntryData(
- m_pPathLB->GetEntryPos(m_pGroupTLB->GetEntryText(i,1))));
+ OUString sTemp = m_xGroupTLB->get_text(i, 0);
+ nCaseReadonly = m_xPathLB->get_id(m_xPathLB->find_text(m_xGroupTLB->get_text(i,1))).toUInt32();
bool bCase = 0 != (nCaseReadonly & PATH_CASE_SENSITIVE);
if( !bCase && rSCmp.isEqual( sTemp, sEntry ))
@@ -349,23 +371,25 @@ IMPL_LINK_NOARG(SwGlossaryGroupDlg, ModifyHdl, Edit&, void)
}
}
}
- if( 0xffffffff > nPos)
+ if (nPos != -1)
{
bEnableNew = false;
- m_pGroupTLB->Select(m_pGroupTLB->GetEntry( nPos ));
- m_pGroupTLB->MakeVisible(m_pGroupTLB->GetEntry( nPos ));
+ m_xGroupTLB->select(nPos);
+ m_xGroupTLB->scroll_to_row(nPos);
+ SelectHdl(*m_xGroupTLB);
}
}
- SvTreeListEntry* pEntry = m_pGroupTLB->FirstSelected();
- if(pEntry)
+ int nEntry = m_xGroupTLB->get_selected_index();
+ if (nEntry != -1)
{
- GlosBibUserData* pUserData = static_cast<GlosBibUserData*>(pEntry->GetUserData());
+ GlosBibUserData* pUserData = reinterpret_cast<GlosBibUserData*>(m_xGroupTLB->get_id(nEntry).toInt64());
bEnableDel = IsDeleteAllowed(pUserData->sGroupName);
}
- m_pDelPB->Enable(bEnableDel);
- m_pNewPB->Enable(bEnableNew);
- m_pRenamePB->Enable(bEnableNew && pEntry);
+ m_xDelPB->set_sensitive(bEnableDel);
+ m_xNewPB->set_sensitive(bEnableNew);
+ m_xRenamePB->set_sensitive(bEnableNew && nEntry != -1);
+ fprintf(stderr, "two rename %d\n", bEnableNew && nEntry != -1);
}
bool SwGlossaryGroupDlg::IsDeleteAllowed(const OUString &rGroup)
@@ -383,47 +407,10 @@ bool SwGlossaryGroupDlg::IsDeleteAllowed(const OUString &rGroup)
return bDel;
}
-void FEdit::KeyInput( const KeyEvent& rKEvent )
-{
- vcl::KeyCode aCode = rKEvent.GetKeyCode();
- if( KEYGROUP_CURSOR == aCode.GetGroup() ||
- ( KEYGROUP_MISC == aCode.GetGroup() &&
- KEY_DELETE >= aCode.GetCode() ) ||
- SVT_SEARCHPATH_DELIMITER != rKEvent.GetCharCode() )
- Edit::KeyInput( rKEvent );
-}
-
-VCL_BUILDER_FACTORY(FEdit)
-
-void SwGlossaryGroupTLB::RequestHelp( const HelpEvent& rHEvt )
+IMPL_STATIC_LINK(SwGlossaryGroupDlg, EditInsertTextHdl, OUString&, rText, bool)
{
- Point aPos( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ));
- SvTreeListEntry* pEntry = GetEntry( aPos );
- if(pEntry)
- {
- SvLBoxTab* pTab;
- SvLBoxItem* pItem = GetItem( pEntry, aPos.X(), &pTab );
- if(pItem)
- {
- aPos = GetEntryPosition( pEntry );
- Size aSize(pItem->GetSize( this, pEntry ));
- aPos.setX( GetTabPos( pEntry, pTab ) );
-
- if((aPos.X() + aSize.Width()) > GetSizePixel().Width())
- aSize.setWidth( GetSizePixel().Width() - aPos.X() );
- aPos = OutputToScreenPixel(aPos);
- tools::Rectangle aItemRect( aPos, aSize );
- GlosBibUserData* pData = static_cast<GlosBibUserData*>(pEntry->GetUserData());
- const OUString sMsg = pData->sPath + "/"
- + pData->sGroupName.getToken(0, GLOS_DELIM)
- + SwGlossaries::GetExtension();
-
- Help::ShowQuickHelp( this, aItemRect, sMsg,
- QuickHelpFlags::Left|QuickHelpFlags::VCenter );
- }
- }
+ rText = rText.replaceAll(OUStringLiteral1(SVT_SEARCHPATH_DELIMITER), "");
+ return true;
}
-VCL_BUILDER_FACTORY(SwGlossaryGroupTLB)
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx
index 3e5467407377..32cb5103562a 100644
--- a/sw/source/ui/misc/glossary.cxx
+++ b/sw/source/ui/misc/glossary.cxx
@@ -632,12 +632,12 @@ IMPL_LINK_NOARG(SwGlossaryDlg, BibHdl, Button*, void)
if(bIsWritable)
{
- ScopedVclPtrInstance< SwGlossaryGroupDlg > pDlg( this, pGloss->GetPathArray(), pGlossaryHdl );
- if ( RET_OK == pDlg->Execute() )
+ SwGlossaryGroupDlg aDlg(GetFrameWeld(), pGloss->GetPathArray(), pGlossaryHdl);
+ if (aDlg.run() == RET_OK)
{
Init();
//if new groups were created - select one of them
- const OUString sNewGroup = pDlg->GetCreatedGroupName();
+ const OUString sNewGroup = aDlg.GetCreatedGroupName();
SvTreeListEntry* pEntry = m_pCategoryBox->First();
while (!sNewGroup.isEmpty() && pEntry)
{
diff --git a/sw/source/uibase/inc/glosbib.hxx b/sw/source/uibase/inc/glosbib.hxx
index 12b9ca217148..b5ba48a97711 100644
--- a/sw/source/uibase/inc/glosbib.hxx
+++ b/sw/source/uibase/inc/glosbib.hxx
@@ -20,31 +20,14 @@
#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_GLOSBIB_HXX
#define INCLUDED_SW_SOURCE_UIBASE_INC_GLOSBIB_HXX
-#include <vcl/edit.hxx>
-#include <svx/stddlg.hxx>
-
-#include <vcl/lstbox.hxx>
-#include <vcl/svtabbx.hxx>
-
-#include <vcl/button.hxx>
-#include <vcl/fixed.hxx>
+#include <sfx2/basedlgs.hxx>
#include <rtl/ustring.hxx>
+#include <vcl/weld.hxx>
#include <vector>
class SwGlossaryHdl;
-class FEdit : public Edit
-{
-public:
- FEdit(vcl::Window* pParent)
- : Edit(pParent, WB_LEFT|WB_VCENTER|WB_BORDER|WB_3DLOOK)
- {
- }
-
- virtual void KeyInput( const KeyEvent& rKEvent ) override;
-};
-
struct GlosBibUserData
{
OUString sPath;
@@ -52,51 +35,43 @@ struct GlosBibUserData
OUString sGroupTitle;
};
-class SwGlossaryGroupTLB : public SvTabListBox
-{
-public:
- SwGlossaryGroupTLB(vcl::Window* pParent)
- : SvTabListBox(pParent, WB_BORDER|WB_HSCROLL|WB_CLIPCHILDREN|WB_SORT)
- {
- }
-
- virtual void RequestHelp( const HelpEvent& rHEvt ) override;
-};
-
-class SwGlossaryGroupDlg final : public SvxStandardDialog
+class SwGlossaryGroupDlg final : public SfxDialogController
{
- VclPtr<FEdit> m_pNameED;
- VclPtr<ListBox> m_pPathLB;
- VclPtr<SwGlossaryGroupTLB> m_pGroupTLB;
-
- VclPtr<PushButton> m_pNewPB;
- VclPtr<PushButton> m_pDelPB;
- VclPtr<PushButton> m_pRenamePB;
-
std::vector<OUString> m_RemovedArr;
std::vector<OUString> m_InsertedArr;
std::vector<OUString> m_RenamedArr;
- SwGlossaryHdl *pGlosHdl;
+ weld::Window* m_pParent;
+ SwGlossaryHdl* pGlosHdl;
OUString sCreatedGroup;
- bool IsDeleteAllowed(const OUString &rGroup);
+ std::unique_ptr<weld::Entry> m_xNameED;
+ std::unique_ptr<weld::ComboBox> m_xPathLB;
+ std::unique_ptr<weld::TreeView> m_xGroupTLB;
+
+ std::unique_ptr<weld::Button> m_xNewPB;
+ std::unique_ptr<weld::Button> m_xDelPB;
+ std::unique_ptr<weld::Button> m_xRenamePB;
+
+ bool IsDeleteAllowed(const OUString &rGroup);
- virtual void Apply() override;
- DECL_LINK( SelectHdl, SvTreeListBox*, void );
- DECL_LINK( NewHdl, Button *, void );
- DECL_LINK( DeleteHdl, Button*, void );
- DECL_LINK( ModifyHdl, Edit&, void );
- DECL_LINK( ModifyListBoxHdl, ListBox&, void );
- DECL_LINK( RenameHdl, Button *, void );
+ void Apply();
+ DECL_LINK(SelectHdl, weld::TreeView&, void);
+ DECL_LINK(NewHdl, weld::Button&, void);
+ DECL_LINK(DeleteHdl, weld::Button&, void);
+ DECL_LINK(ModifyHdl, weld::Entry&, void);
+ DECL_LINK(ModifyListBoxHdl, weld::ComboBox&, void);
+ DECL_LINK(RenameHdl, weld::Button&, void);
+ DECL_STATIC_LINK(SwGlossaryGroupDlg, EditInsertTextHdl, OUString&, bool);
+ DECL_LINK(EntrySizeAllocHdl, const Size&, void);
public:
- SwGlossaryGroupDlg(vcl::Window * pParent,
- std::vector<OUString> const& rPathArr,
- SwGlossaryHdl *pGlosHdl);
+ SwGlossaryGroupDlg(weld::Window* pParent,
+ std::vector<OUString> const& rPathArr,
+ SwGlossaryHdl *pGlosHdl);
+ virtual short run() override;
virtual ~SwGlossaryGroupDlg() override;
- virtual void dispose() override;
const OUString& GetCreatedGroupName() const {return sCreatedGroup;}
};
diff --git a/sw/uiconfig/swriter/ui/editcategories.ui b/sw/uiconfig/swriter/ui/editcategories.ui
index 2bcfad0846b3..74dbdffbe07e 100644
--- a/sw/uiconfig/swriter/ui/editcategories.ui
+++ b/sw/uiconfig/swriter/ui/editcategories.ui
@@ -1,12 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.0 -->
+<!-- Generated with glade 3.22.1 -->
<interface domain="sw">
<requires lib="gtk+" version="3.18"/>
+ <object class="GtkTreeStore" id="liststore1">
+ <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="EditCategoriesDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="editcategories|EditCategoriesDialog">Edit Categories</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>
@@ -17,12 +33,11 @@
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
- <object class="GtkButton" id="ok">
- <property name="label">gtk-ok</property>
+ <object class="GtkButton" id="new">
+ <property name="label">gtk-new</property>
<property name="visible">True</property>
+ <property name="sensitive">False</property>
<property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="has_default">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
@@ -33,9 +48,10 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="cancel">
- <property name="label">gtk-cancel</property>
+ <object class="GtkButton" id="delete">
+ <property name="label">gtk-delete</property>
<property name="visible">True</property>
+ <property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
@@ -47,12 +63,13 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="help">
- <property name="label">gtk-help</property>
+ <object class="GtkButton" id="rename">
+ <property name="label" translatable="yes" context="editcategories|rename">_Rename</property>
<property name="visible">True</property>
+ <property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="use_stock">True</property>
+ <property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -61,10 +78,12 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="new">
- <property name="label">gtk-new</property>
+ <object class="GtkButton" id="ok">
+ <property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
@@ -75,8 +94,8 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="delete">
- <property name="label">gtk-delete</property>
+ <object class="GtkButton" id="cancel">
+ <property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@@ -89,17 +108,18 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="rename">
- <property name="label" translatable="yes" context="editcategories|rename">_Rename</property>
+ <object class="GtkButton" id="help">
+ <property name="label">gtk-help</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">5</property>
+ <property name="secondary">True</property>
</packing>
</child>
</object>
@@ -123,31 +143,69 @@
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="editcategories|label3">Selection list</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">group</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">2</property>
- <property name="height">1</property>
</packing>
</child>
<child>
- <object class="swuilo-SwGlossaryGroupTLB" id="group">
+ <object class="GtkScrolledWindow">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
- <property name="label" translatable="yes" context="editcategories|group">label</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="group">
+ <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="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>
+ <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">3</property>
<property name="width">2</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -159,44 +217,38 @@
<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="label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="editcategories|label2">Path</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">pathlb</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>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="editcategories|label1">Category</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">name</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="swuilo-FEdit" id="name">
+ <object class="GtkEntry" id="name">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="max_length">256</property>
@@ -204,8 +256,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>
@@ -218,12 +268,12 @@
</object>
</child>
<action-widgets>
+ <action-widget response="101">new</action-widget>
+ <action-widget response="102">delete</action-widget>
+ <action-widget response="103">rename</action-widget>
<action-widget response="-5">ok</action-widget>
<action-widget response="-6">cancel</action-widget>
<action-widget response="-11">help</action-widget>
- <action-widget response="0">new</action-widget>
- <action-widget response="0">delete</action-widget>
- <action-widget response="0">rename</action-widget>
</action-widgets>
</object>
</interface>
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index d9cdc5e0a63f..e61980febe35 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -1862,6 +1862,8 @@ public:
for (size_t i = 0; i < rWidths.size(); ++i)
pHeaderBar->SetItemSize(pHeaderBar->GetItemId(i), rWidths[i]);
}
+ // call Resize to recalculate based on the new tabs
+ m_xTreeView->Resize();
}
virtual OUString get_column_title(int nColumn) const override
@@ -1933,7 +1935,7 @@ public:
{
for (SvTreeListEntry* pEntry = m_xTreeView->First(); pEntry; pEntry = m_xTreeView->Next(pEntry))
{
- if (m_xTreeView->GetEntryText(pEntry) == rText)
+ if (SvTabListBox::GetEntryText(pEntry, 0) == rText)
return m_xTreeView->GetAbsPos(pEntry);
}
return -1;
@@ -2245,7 +2247,7 @@ public:
virtual OUString get_text(const weld::TreeIter& rIter) const override
{
const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
- return m_xTreeView->GetEntryText(rVclIter.iter);
+ return SvTabListBox::GetEntryText(rVclIter.iter, 0);
}
virtual OUString get_id(const weld::TreeIter& rIter) const override
@@ -2283,6 +2285,7 @@ public:
virtual void make_sorted() override
{
m_xTreeView->SetStyle(m_xTreeView->GetStyle() | WB_SORT);
+ m_xTreeView->GetModel()->Resort();
}
SvTabListBox& getTreeView()