26 "CustomizeAddrListDialog")
28 , m_xFieldsLB(m_xBuilder->weld_tree_view(
"treeview"))
29 , m_xAddPB(m_xBuilder->weld_button(
"add"))
30 , m_xDeletePB(m_xBuilder->weld_button(
"delete"))
31 , m_xRenamePB(m_xBuilder->weld_button(
"rename"))
32 , m_xUpPB(m_xBuilder->weld_button(
"up"))
33 , m_xDownPB(m_xBuilder->weld_button(
"down"))
39 m_xAddPB->connect_clicked(aAddRenameLk);
43 m_xUpPB->connect_clicked(aUpDownLk);
46 for (
const auto& rHeader :
m_xNewData->aDBColumnHeaders)
64 bool bRename = &rButton == m_xRenamePB.get();
65 auto nPos = m_xFieldsLB->get_selected_index();
69 std::unique_ptr<SwAddRenameEntryDialog> xDlg;
76 OUString aTemp = m_xFieldsLB->get_text(
nPos);
77 xDlg->SetFieldName(aTemp);
81 OUString sNew = xDlg->GetFieldName();
84 m_xNewData->aDBColumnHeaders[
nPos] = sNew;
85 m_xFieldsLB->remove(
nPos);
89 if (m_xFieldsLB->get_selected_index() != -1)
92 m_xNewData->aDBColumnHeaders.insert(m_xNewData->aDBColumnHeaders.begin() +
nPos, sNew);
94 for (
auto& rData : m_xNewData->aDBData)
95 rData.insert(rData.begin() +
nPos, OUString());
99 m_xFieldsLB->insert_text(
nPos, sNew);
100 m_xFieldsLB->select(
nPos);
107 auto nPos = m_xFieldsLB->get_selected_index();
108 m_xFieldsLB->remove(
nPos);
109 m_xFieldsLB->select(
nPos > m_xFieldsLB->n_children() - 1 ?
nPos - 1 :
nPos);
112 m_xNewData->aDBColumnHeaders.erase(m_xNewData->aDBColumnHeaders.begin() +
nPos);
114 for (
auto& rData : m_xNewData->aDBData)
115 rData.erase(rData.begin() +
nPos);
122 auto nPos = m_xFieldsLB->get_selected_index();
124 OUString aTemp = m_xFieldsLB->get_text(
nPos);
125 m_xFieldsLB->remove(
nPos);
126 if (&rButton == m_xUpPB.get())
130 m_xFieldsLB->insert_text(
nPos, aTemp);
131 m_xFieldsLB->select(
nPos);
133 OUString sHeader = m_xNewData->aDBColumnHeaders[nOldPos];
134 m_xNewData->aDBColumnHeaders.erase(m_xNewData->aDBColumnHeaders.begin() + nOldPos);
135 m_xNewData->aDBColumnHeaders.insert(m_xNewData->aDBColumnHeaders.begin() +
nPos, sHeader);
136 for (
auto& rData : m_xNewData->aDBData)
138 OUString sData = rData[nOldPos];
139 rData.erase(rData.begin() + nOldPos);
140 rData.insert(rData.begin() +
nPos, sData);
157 weld::Window* pParent,
const OUString& rUIXMLDescription,
const OUString& rID,
158 const std::vector< OUString >& rCSVHeader)
160 , m_rCSVHeader(rCSVHeader)
161 , m_xFieldNameED(m_xBuilder->weld_entry(
"entry"))
162 , m_xOK(m_xBuilder->weld_button(
"ok"))
170 OUString sEntry = rEdit.get_text();
171 bool bFound = sEntry.isEmpty();
175 bFound = std::any_of(m_rCSVHeader.begin(), m_rCSVHeader.end(),
176 [&sEntry](
const OUString& rHeader) { return rHeader == sEntry; });
178 m_xOK->set_sensitive(!bFound);
Reference< XExecutableDialog > m_xDialog
SwAddRenameEntryDialog(weld::Window *pParent, const OUString &rUIXMLDescription, const OUString &rID, const std::vector< OUString > &rCSVHeader)
std::unique_ptr< weld::Entry > m_xFieldNameED
std::unique_ptr< weld::Button > m_xDeletePB
std::unique_ptr< weld::Button > m_xUpPB
std::unique_ptr< SwCSVData > m_xNewData
std::unique_ptr< weld::Button > m_xRenamePB
std::unique_ptr< weld::TreeView > m_xFieldsLB
std::unique_ptr< weld::Button > m_xAddPB
SwCustomizeAddressListDialog(weld::Window *pParent, const SwCSVData &rOldData)
virtual ~SwCustomizeAddressListDialog() override
std::unique_ptr< weld::Button > m_xDownPB
IMPL_LINK_NOARG(SwCustomizeAddressListDialog, ListBoxSelectHdl_Impl, weld::TreeView &, void)
IMPL_LINK(SwCustomizeAddressListDialog, AddRenameHdl_Impl, weld::Button &, rButton, void)
#define LINK(Instance, Class, Member)