31#include <bitmaps.hlst>
56 :m_aRegistrationItems(
std::move( _aMasterSet ))
77 short result = SfxSingleTabDialogController::run();
90 :
SfxTabPage(pPage, pController,
"cui/ui/dbregisterpage.ui",
"DbRegisterPage", &
rSet)
93 , m_xNew(m_xBuilder->weld_button(
"new"))
94 , m_xEdit(m_xBuilder->weld_button(
"edit"))
95 , m_xDelete(m_xBuilder->weld_button(
"delete"))
96 , m_xPathBox(m_xBuilder->weld_tree_view(
"pathctrl"))
97 , m_xIter(m_xPathBox->make_iterator())
103 std::vector<int> aWidths
105 o3tl::narrowing<int>(
m_xPathBox->get_approximate_digit_width() * 20)
125 delete weld::fromId<DatabaseRegistration*>(
m_xPathBox->get_id(
i));
131 return std::make_unique<DbRegistrationOptionsPage>(pPage, pController, *rAttrSet);
137 bool bModified =
false;
143 if ( pRegistration && !pRegistration->
sLocation.isEmpty() )
146 OFileNotation aTransformer( pRegistration->
sLocation );
163 if ( !pRegistrations )
170 for (
auto const& elem : rRegistrations)
172 OFileNotation aTransformer( elem.second.sLocation );
173 insertNewEntry( elem.first, aTransformer.get( OFileNotation::N_SYSTEM ), elem.second.bReadOnly );
177 if ( aUserData.isEmpty() )
182 std::vector<int> aWidths
195 OUString aUserData = OUString::number(
m_xPathBox->get_column_width(
COL_TYPE) ) +
";";
197 aUserData += (bUp ? std::u16string_view(
u"1") : std::u16string_view(
u"0"));
203 int nEntry = m_xPathBox->get_selected_index();
207 VclMessageType::Question, VclButtonsType::YesNo,
CuiResId(RID_CUISTR_QUERY_DELETE_CONFIRM)));
209 m_xPathBox->remove(nEntry);
215 openLinkDialog(OUString(),OUString());
226 int nEntry = m_xPathBox->get_selected_index();
230 DatabaseRegistration* pOldRegistration = weld::fromId<DatabaseRegistration*>(m_xPathBox->get_id(nEntry));
231 if (!pOldRegistration || pOldRegistration->
bReadOnly)
234 OUString sOldName = m_xPathBox->get_text(nEntry, 0);
235 openLinkDialog(sOldName, pOldRegistration->
sLocation, nEntry);
243 bool bSortMode = m_xPathBox->get_sort_order();
246 bSortMode = !bSortMode;
247 m_xPathBox->set_sort_order(bSortMode);
255 DatabaseRegistration* pRegistration = weld::fromId<DatabaseRegistration*>(m_xPathBox->get_selected_id());
282 aDlg.
setLink(sOldName, sOldLocation);
288 OUString sNewName,sNewLocation;
289 aDlg.
getLink(sNewName,sNewLocation);
290 if ( nEntry == -1 || sNewName != sOldName || sNewLocation != sOldLocation )
294 delete weld::fromId<DatabaseRegistration*>(
m_xPathBox->get_id(nEntry));
304 int nCount = m_xPathBox->n_children();
307 if (m_xPathBox->get_text(
i, 0) == _rName)
Reference< XExecutableDialog > m_xDialog
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxItemSet * GetOutputItemSet() const
void SetTabPage(std::unique_ptr< SfxTabPage > xTabPage)
weld::Container * get_content_area()
void SetUserData(const OUString &rString)
const OUString & GetUserData() const
weld::Window * GetFrameWeld() const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
const DatabaseRegistrations & getRegistrations() const
virtual short run() override
DatabaseRegistrationDialog(weld::Window *pParent, const SfxItemSet &rAttr)
static void SetOptions(const SfxItemSet &_rSourceItems)
static void GetOptions(SfxItemSet &_rFillItems)
virtual void Reset(const SfxItemSet *rSet) override
virtual ~DbRegistrationOptionsPage() override
std::unique_ptr< weld::Button > m_xDelete
std::unique_ptr< weld::Button > m_xEdit
std::unique_ptr< weld::Button > m_xNew
std::unique_ptr< weld::TreeView > m_xPathBox
DbRegistrationOptionsPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
void insertNewEntry(const OUString &_sName, const OUString &_sLocation, const bool bReadOnly)
inserts a new entry in the tablistbox
void openLinkDialog(const OUString &sOldName, const OUString &sOldLocation, int nEntry=-1)
opens the LinkDialog to create a register pair
std::unique_ptr< weld::TreeIter > m_xIter
virtual void FillUserData() override
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
virtual bool FillItemSet(SfxItemSet *rSet) override
dialog for editing document links associated with data sources
void setNameValidator(const Link< const OUString &, bool > &_rValidator)
void setLink(const OUString &_rName, const OUString &_rURL)
void getLink(OUString &_rName, OUString &_rURL) const
helper for DatabaseRegistrationDialog
RegistrationItemSetHolder(SfxItemSet _aMasterSet)
SfxItemSet m_aRegistrationItems
const SfxItemSet & getRegistrationItems() const
~RegistrationItemSetHolder()
OUString CuiResId(TranslateId aKey)
#define SID_SB_DB_REGISTER
#define DBG_ASSERT(sCon, aError)
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
constexpr OUStringLiteral HID_DBPATH_CTL_PATH
#define LINK(Instance, Class, Member)
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
IMPL_LINK(ClassificationDialog, SelectClassificationHdl, weld::ComboBox &, rBox, void)
IMPL_LINK_NOARG(ClassificationDialog, OnAsyncExpandHdl, void *, void)
std::map< OUString, DatabaseRegistration > DatabaseRegistrations
OUString toId(const void *pValue)