25 #include <strings.hrc>
26 #include <bitmaps.hlst>
31 #include <dialmgr.hxx>
44 using namespace ::
svt;
49 :m_aRegistrationItems( _rMasterSet )
70 short result = SfxSingleTabDialogController::run();
83 :
SfxTabPage(pPage, pController,
"cui/ui/dbregisterpage.ui",
"DbRegisterPage", &rSet)
86 , m_xNew(m_xBuilder->weld_button(
"new"))
87 , m_xEdit(m_xBuilder->weld_button(
"edit"))
88 , m_xDelete(m_xBuilder->weld_button(
"delete"))
89 , m_xPathBox(m_xBuilder->weld_tree_view(
"pathctrl"))
90 , m_xIter(m_xPathBox->make_iterator())
94 m_xPathBox->set_size_request(aControlSize.Width(), aControlSize.Height());
96 std::vector<int> aWidths;
97 aWidths.push_back(
m_xPathBox->get_approximate_digit_width() * 20);
116 delete reinterpret_cast<DatabaseRegistration*>(
m_xPathBox->get_id(
i).toInt64());
122 return std::make_unique<DbRegistrationOptionsPage>(pPage, pController, *rAttrSet);
128 bool bModified =
false;
131 for (
int i = 0;
i < nCount; ++
i)
134 if ( pRegistration && !pRegistration->
sLocation.isEmpty() )
137 OFileNotation aTransformer( pRegistration->
sLocation );
154 if ( !pRegistrations )
161 for (
auto const& elem : rRegistrations)
163 OFileNotation aTransformer( elem.second.sLocation );
164 insertNewEntry( elem.first, aTransformer.get( OFileNotation::N_SYSTEM ), elem.second.bReadOnly );
168 if ( !aUserData.isEmpty() )
172 std::vector<int> aWidths;
173 aWidths.push_back(aUserData.getToken(0,
';', nIdx).toInt32());
176 bool bUp = aUserData.getToken(0,
';', nIdx).toInt32() != 0;
184 OUString aUserData = OUString::number(
m_xPathBox->get_column_width(
COL_TYPE) ) +
";";
186 aUserData += (bUp ? OUStringLiteral(
u"1") : OUStringLiteral(
u"0"));
192 int nEntry = m_xPathBox->get_selected_index();
196 VclMessageType::Question, VclButtonsType::YesNo,
CuiResId(RID_SVXSTR_QUERY_DELETE_CONFIRM)));
198 m_xPathBox->remove(nEntry);
204 openLinkDialog(OUString(),OUString());
215 int nEntry = m_xPathBox->get_selected_index();
220 if (!pOldRegistration || pOldRegistration->
bReadOnly)
223 OUString sOldName = m_xPathBox->get_text(nEntry, 0);
224 openLinkDialog(sOldName, pOldRegistration->
sLocation, nEntry);
232 bool bSortMode = m_xPathBox->get_sort_order();
235 bSortMode = !bSortMode;
236 m_xPathBox->set_sort_order(bSortMode);
252 m_xEdit->set_sensitive( !bReadOnly );
253 m_xDelete->set_sensitive( !bReadOnly );
259 m_xPathBox->insert(
nullptr, -1, &_sName, &sId,
nullptr,
nullptr,
false,
m_xIter.get());
271 aDlg.
setLink(sOldName, sOldLocation);
277 OUString sNewName,sNewLocation;
278 aDlg.
getLink(sNewName,sNewLocation);
279 if ( nEntry == -1 || sNewName != sOldName || sNewLocation != sOldLocation )
293 int nCount = m_xPathBox->n_children();
294 for (
int i = 0;
i < nCount; ++
i)
296 if (m_xPathBox->get_text(
i, 0) == _rName)
#define LINK(Instance, Class, Member)
virtual short run() override
SfxItemSet m_aRegistrationItems
void SetUserData(const OUString &rString)
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
void openLinkDialog(const OUString &sOldName, const OUString &sOldLocation, int nEntry=-1)
opens the LinkDialog to create a register pair
std::map< OUString, DatabaseRegistration > DatabaseRegistrations
std::unique_ptr< weld::Button > m_xNew
weld::Container * get_content_area()
std::unique_ptr< weld::TreeView > m_xPathBox
const SfxItemSet * GetOutputItemSet() const
~RegistrationItemSetHolder()
virtual ~DbRegistrationOptionsPage() override
void insertNewEntry(const OUString &_sName, const OUString &_sLocation, const bool bReadOnly)
inserts a new entry in the tablistbox
const OUString & GetUserData() const
virtual bool FillItemSet(SfxItemSet *rSet) override
static void GetOptions(SfxItemSet &_rFillItems)
helper for DatabaseRegistrationDialog
void setLink(const OUString &_rName, const OUString &_rURL)
#define DBG_ASSERT(sCon, aError)
RegistrationItemSetHolder(const SfxItemSet &_rMasterSet)
void setNameValidator(const Link< const OUString &, bool > &_rValidator)
IMPL_LINK(ClassificationDialog, SelectClassificationHdl, weld::ComboBox &, rBox, void)
void SetTabPage(std::unique_ptr< SfxTabPage > xTabPage)
std::unique_ptr< weld::Button > m_xDelete
static void SetOptions(const SfxItemSet &_rSourceItems)
OUString CuiResId(const char *pKey)
#define SID_SB_DB_REGISTER
#define HID_DBPATH_CTL_PATH
std::unique_ptr< weld::Button > m_xEdit
const DatabaseRegistrations & getRegistrations() const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
DatabaseRegistrationDialog(weld::Window *pParent, const SfxItemSet &rAttr)
std::unique_ptr< weld::TreeIter > m_xIter
weld::Window * GetFrameWeld() const
virtual void Reset(const SfxItemSet *rSet) override
DbRegistrationOptionsPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Reference< XExecutableDialog > m_xDialog
IMPL_LINK_NOARG(AccessibilityCheckEntry, GotoButtonClicked, weld::Button &, void)
dialog for editing document links associated with data sources
void getLink(OUString &_rName, OUString &_rURL) const
virtual void FillUserData() override
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const SfxItemSet & getRegistrationItems() const
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, bool bMobile=false)