22 #include <rtl/ustring.hxx>
25 #include <com/sun/star/uno/Sequence.h>
35 #include <strings.hrc>
82 static_cast<SwLabPage*
>(&rPage)->InitDatabaseBox();
85 static_cast<SwLabPage*
>(&rPage)->SetToBusinessCard();
87 else if (rId ==
"options")
94 , pDBManager(pDBManager_)
103 SwLabItem aItem(static_cast<const SwLabItem&>(rSet.
Get( FN_LABEL )));
104 std::unique_ptr<SwLabRec> pRec(
new SwLabRec);
105 pRec->m_aMake = pRec->m_aType =
SwResId(STR_CUSTOM_LABEL);
106 pRec->SetFromItem( aItem );
108 bool bDouble =
false;
110 for (
const std::unique_ptr<SwLabRec> &
i : *
m_pRecs)
112 if (pRec->m_aMake ==
i->m_aMake &&
113 pRec->m_aType ==
i->m_aType)
121 m_pRecs->insert( m_pRecs->begin(), std::move(pRec));
123 size_t nLstGroup = 0;
125 for(
size_t nMan = 0; nMan < rMan.size(); ++nMan)
127 aMakes.push_back(rMan[nMan]);
171 if (rActItem != rOldItem)
191 const OUString sCustom(
SwResId(STR_CUSTOM_LABEL));
194 for (
size_t i = 0;
i < nCount; ++
i)
196 pRec =
Recs()[
i].get();
197 if (pRec->
m_aType != sCustom &&
205 pRec =
Recs()[0].get();
219 :
SfxTabPage(pPage, pController,
"modules/swriter/ui/cardmediumpage.ui",
"CardMediumPage", &rSet)
220 , pDBManager(nullptr)
221 , aItem(static_cast<const
SwLabItem&>(rSet.
Get(FN_LABEL)))
222 , m_xAddressFrame(m_xBuilder->weld_widget(
"addressframe"))
223 , m_xAddrBox(m_xBuilder->weld_check_button(
"address"))
224 , m_xWritingEdit(m_xBuilder->weld_text_view(
"textview"))
225 , m_xDatabaseLB(m_xBuilder->weld_combo_box(
"database"))
226 , m_xTableLB(m_xBuilder->weld_combo_box(
"table"))
227 , m_xInsertBT(m_xBuilder->weld_button(
"insert"))
228 , m_xDBFieldLB(m_xBuilder->weld_combo_box(
"field"))
229 , m_xContButton(m_xBuilder->weld_radio_button(
"continuous"))
230 , m_xSheetButton(m_xBuilder->weld_radio_button(
"sheet"))
231 , m_xMakeBox(m_xBuilder->weld_combo_box(
"brand"))
232 , m_xTypeBox(m_xBuilder->weld_combo_box(
"type"))
233 , m_xHiddenSortTypeBox(m_xBuilder->weld_combo_box(
"hiddentype"))
234 , m_xFormatInfo(m_xBuilder->weld_label(
"formatinfo"))
243 m_xTableLB->set_size_request(nListBoxWidth, -1);
260 auto nMaxWidth =
m_xMakeBox->get_approximate_digit_width() * 32;
287 if (m_xAddrBox->get_active())
290 m_xWritingEdit->set_text(aWriting);
291 m_xWritingEdit->grab_focus();
296 sActDBName = m_xDatabaseLB->get_active_text();
300 if (&rListBox == m_xDatabaseLB.get())
301 GetDBManager()->GetTableNames(*m_xTableLB, sActDBName);
303 if (&rListBox == m_xDatabaseLB.get() || &rListBox == m_xTableLB.get())
304 GetDBManager()->GetColumnNames(*m_xDBFieldLB, sActDBName, m_xTableLB->get_active_text());
306 if (!m_xDatabaseLB->get_active_text().isEmpty() && !m_xTableLB->get_active_text().isEmpty()
307 && !m_xDBFieldLB->get_active_text().isEmpty())
308 m_xInsertBT->set_sensitive(
true);
310 m_xInsertBT->set_sensitive(
false);
315 OUString
aStr(
"<" + m_xDatabaseLB->get_active_text() +
"." +
316 m_xTableLB->get_active_text() +
"." +
317 m_xTableLB->get_active_id() +
"." +
318 m_xDBFieldLB->get_active_text() +
">");
319 m_xWritingEdit->replace_selection(
aStr);
320 int nStartPos, nEndPos;
321 m_xWritingEdit->get_selection_bounds(nStartPos, nEndPos);
322 m_xWritingEdit->grab_focus();
323 m_xWritingEdit->select_region(nStartPos, nEndPos);
328 MakeHdl(*m_xMakeBox);
336 m_xHiddenSortTypeBox->clear();
337 GetParentSwLabDlg()->TypeIds().clear();
339 const OUString aMake = m_xMakeBox->get_active_text();
340 GetParentSwLabDlg()->ReplaceGroup( aMake );
341 aItem.m_aLstMake = aMake;
343 const bool bCont = m_xContButton->get_active();
344 const size_t nCount = GetParentSwLabDlg()->Recs().size();
347 const OUString sCustom(
SwResId(STR_CUSTOM_LABEL));
349 for (
size_t i = 0;
i < nCount; ++
i )
351 const OUString aType(GetParentSwLabDlg()->Recs()[
i]->
m_aType);
352 bool bInsert =
false;
353 if (GetParentSwLabDlg()->Recs()[
i]->
m_aType == sCustom)
356 m_xTypeBox->append_text(aType );
358 else if (GetParentSwLabDlg()->Recs()[
i]->m_bCont == bCont)
360 if (m_xHiddenSortTypeBox->find_text(aType) == -1)
363 m_xHiddenSortTypeBox->append_text( aType );
368 GetParentSwLabDlg()->TypeIds().push_back(
i);
369 if ( !nLstType && aType == aItem.m_aLstType )
370 nLstType = GetParentSwLabDlg()->TypeIds().size();
373 for (
int nEntry = 0; nEntry < m_xHiddenSortTypeBox->get_count(); ++nEntry)
375 m_xTypeBox->append_text(m_xHiddenSortTypeBox->get_text(nEntry));
378 m_xTypeBox->set_active_text(aItem.m_aLstType);
380 m_xTypeBox->set_active(0);
381 TypeHdl(*m_xTypeBox);
387 aItem.m_aType = m_xTypeBox->get_active_text();
393 std::unique_ptr<weld::MetricSpinButton> xField(xBuilder->weld_metric_spin_button(
"spin", FieldUnit::CM));
395 xField->set_digits(2);
396 xField->set_range(0, INT_MAX - 1, FieldUnit::NONE);
402 const OUString aWString = xField->get_text();
407 OUString aText = pRec->
m_aType +
": " + aWString +
408 " x " + xField->get_text() +
409 " (" + OUString::number( pRec->
m_nCols ) +
410 " x " + OUString::number( pRec->
m_nRows ) +
")";
416 OUString sSelEntry(
m_xTypeBox->get_active_text());
428 for (
const OUString& rDataName : aDataNames)
445 return std::make_unique<SwLabPage>(pPage, pController, *rSet);
458 return DeactivateRC::LeavePage;
489 size_t nLstGroup = 0;
492 for(
size_t i = 0;
i < nCount; ++
i)
544 :
SfxTabPage(pPage, pController,
"modules/swriter/ui/privateuserpage.ui",
"PrivateUserPage", &rSet)
545 , m_xFirstNameED(m_xBuilder->weld_entry(
"firstname"))
546 , m_xNameED(m_xBuilder->weld_entry(
"lastname"))
547 , m_xShortCutED(m_xBuilder->weld_entry(
"shortname"))
548 , m_xFirstName2ED(m_xBuilder->weld_entry(
"firstname2"))
549 , m_xName2ED(m_xBuilder->weld_entry(
"lastname2"))
550 , m_xShortCut2ED(m_xBuilder->weld_entry(
"shortname2"))
551 , m_xStreetED(m_xBuilder->weld_entry(
"street"))
552 , m_xZipED(m_xBuilder->weld_entry(
"izip"))
553 , m_xCityED(m_xBuilder->weld_entry(
"icity"))
554 , m_xCountryED(m_xBuilder->weld_entry(
"country"))
555 , m_xStateED(m_xBuilder->weld_entry(
"state"))
556 , m_xTitleED(m_xBuilder->weld_entry(
"title"))
557 , m_xProfessionED(m_xBuilder->weld_entry(
"job"))
558 , m_xPhoneED(m_xBuilder->weld_entry(
"phone"))
559 , m_xMobilePhoneED(m_xBuilder->weld_entry(
"mobile"))
560 , m_xFaxED(m_xBuilder->weld_entry(
"fax"))
561 , m_xHomePageED(m_xBuilder->weld_entry(
"url"))
562 , m_xMailED(m_xBuilder->weld_entry(
"email"))
573 return std::make_unique<SwPrivateDataPage>(pPage, pController, *rSet);
585 return DeactivateRC::LeavePage;
641 :
SfxTabPage(pPage, pController,
"modules/swriter/ui/businessdatapage.ui",
"BusinessDataPage", &rSet)
642 , m_xCompanyED(m_xBuilder->weld_entry(
"company"))
643 , m_xCompanyExtED(m_xBuilder->weld_entry(
"company2"))
644 , m_xSloganED(m_xBuilder->weld_entry(
"slogan"))
645 , m_xStreetED(m_xBuilder->weld_entry(
"street"))
646 , m_xZipED(m_xBuilder->weld_entry(
"izip"))
647 , m_xCityED(m_xBuilder->weld_entry(
"icity"))
648 , m_xCountryED(m_xBuilder->weld_entry(
"country"))
649 , m_xStateED(m_xBuilder->weld_entry(
"state"))
650 , m_xPositionED(m_xBuilder->weld_entry(
"position"))
651 , m_xPhoneED(m_xBuilder->weld_entry(
"phone"))
652 , m_xMobilePhoneED(m_xBuilder->weld_entry(
"mobile"))
653 , m_xFaxED(m_xBuilder->weld_entry(
"fax"))
654 , m_xHomePageED(m_xBuilder->weld_entry(
"url"))
655 , m_xMailED(m_xBuilder->weld_entry(
"email"))
666 return std::make_unique<SwBusinessDataPage>(pPage, pController, *rSet);
678 return DeactivateRC::LeavePage;
#define LINK(Instance, Class, Member)
void SetFieldUnit(weld::MetricSpinButton &rField, FieldUnit eUnit, bool bAll)
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
std::unique_ptr< weld::Entry > m_xCompanyED
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
TOOLS_DLLPUBLIC OString convertLineEnd(const OString &rIn, LineEnd eLineEnd)
#define HID_BUSINESS_FMT_PAGE_SHEET
SwLabRec * GetSelectedEntryPos()
std::unique_ptr< weld::Widget > m_xAddressFrame
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
bool GetTableNames(weld::ComboBox &rBox, const OUString &rDBName)
Fill listbox with all table names of a database.
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
std::unique_ptr< weld::Entry > m_xStreetED
std::unique_ptr< weld::Entry > m_xZipED
void FillItem(SwLabItem &rItem)
std::unique_ptr< weld::ComboBox > m_xDBFieldLB
virtual void ActivatePage(const SfxItemSet &rSet) override
std::unique_ptr< weld::Entry > m_xCompanyExtED
std::unique_ptr< weld::TextView > m_xWritingEdit
std::unique_ptr< weld::ComboBox > m_xHiddenSortTypeBox
std::unique_ptr< SfxItemSet > m_xExampleSet
void RemoveTabPage(const OString &rName)
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
std::unique_ptr< weld::ComboBox > m_xMakeBox
static weld::Builder * CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false)
std::unique_ptr< weld::CheckButton > m_xAddrBox
void setfldval(weld::MetricSpinButton &rField, int lValue)
SfxItemSet * GetInputSetImpl()
std::unique_ptr< weld::ComboBox > m_xTypeBox
virtual ~SwLabPage() override
std::unique_ptr< weld::Entry > m_xPositionED
OUString m_aCompCompanyExt
virtual void Reset(const SfxItemSet *rSet) override
static css::uno::Sequence< OUString > GetExistingDatabaseNames()
Reference< XNameAccess > m_xContainer
virtual void ActivatePage(const SfxItemSet &rSet) override
OUString m_aPrivShortCut2
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
std::unique_ptr< weld::Entry > m_xShortCutED
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
virtual void ActivatePage(const SfxItemSet &rSet) override
void SetExchangeSupport()
LineEnd GetSystemLineEnd()
std::unique_ptr< weld::Entry > m_xMobilePhoneED
std::unique_ptr< weld::Entry > m_xName2ED
OUString m_aPrivProfession
SwLabPrtPage * m_pPrtPage
IMPL_LINK_NOARG(SwLabPage, AddrHdl, weld::ToggleButton &, void)
void SetFromItem(const SwLabItem &rItem)
virtual bool FillItemSet(SfxItemSet *rSet) override
virtual ~SwBusinessDataPage() override
SwDBManager * GetDBManager() const
#define HID_BUSINESS_FMT_PAGE_BRAND
std::unique_ptr< weld::Entry > m_xShortCut2ED
void ReplaceGroup_(const OUString &rMake)
std::unique_ptr< weld::Button > m_xInsertBT
std::unique_ptr< weld::Entry > m_xCityED
virtual bool FillItemSet(SfxItemSet *rSet) override
std::unique_ptr< weld::Entry > m_xStreetED
std::unique_ptr< weld::Entry > m_xZipED
std::vector< OUString > & Makes()
virtual void Reset(const SfxItemSet *rSet) override
std::unique_ptr< weld::Entry > m_xNameED
OUString m_aPrivFirstName2
virtual ~SwPrivateDataPage() override
std::unique_ptr< weld::Entry > m_xProfessionED
std::unique_ptr< weld::Entry > m_xPhoneED
std::unique_ptr< weld::Entry > m_xCountryED
SwLabRec * GetRecord(std::u16string_view rRecName, bool bCont)
std::unique_ptr< weld::Entry > m_xFirstNameED
#define HID_BUSINESS_FMT_PAGE_TYPE
SwPrivateDataPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
OUString SwResId(const char *pId)
std::unique_ptr< weld::Entry > m_xCityED
OUString m_sBusinessCardDlg
void FillLabels(const OUString &rManufacturer, SwLabRecs &rLabArr)
virtual void Reset(const SfxItemSet *rSet) override
const SfxItemSet * GetDialogExampleSet() const
#define HID_BUSINESS_FMT_PAGE
std::unique_ptr< weld::RadioButton > m_xContButton
#define HID_BUSINESS_FMT_PAGE_CONT
std::unique_ptr< SwLabRecs > m_pRecs
SwLabDlg * GetParentSwLabDlg()
std::unique_ptr< weld::Entry > m_xMobilePhoneED
const std::vector< OUString > & GetManufacturers() const
std::unique_ptr< weld::Entry > m_xFaxED
std::unique_ptr< weld::Entry > m_xMailED
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
std::unique_ptr< weld::Label > m_xFormatInfo
std::unique_ptr< weld::Entry > m_xTitleED
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
std::unique_ptr< weld::Entry > m_xStateED
weld::Window * GetFrameWeld() const
virtual void set_busy_cursor(bool bBusy)=0
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
virtual void PageCreated(const OString &rId, SfxTabPage &rPage) override
void AddTabPage(const OString &rName, CreateTabPage pCreateFunc, GetTabPageRanges pRangesFunc)
Reference< XExecutableDialog > m_xDialog
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
virtual const SfxItemSet * GetExampleSet() const override
void UpdateGroup(const OUString &rMake)
IMPL_LINK(SwLabPage, DatabaseHdl, weld::ComboBox &, rListBox, void)
virtual ~SwLabDlg() override
std::unique_ptr< weld::Entry > m_xHomePageED
SwBusinessDataPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
virtual bool FillItemSet(SfxItemSet *rSet) override
std::vector< std::unique_ptr< SwLabRec > > SwLabRecs
std::vector< OUString > aMakes
std::unique_ptr< weld::Entry > m_xCountryED
std::unique_ptr< weld::Entry > m_xHomePageED
SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString &)
void FillItem(SwLabItem &rItem) const
void GetColumnNames(weld::ComboBox &rBox, const OUString &rDBName, const OUString &rTableName)
Fill listbox with all column names of a database table.
std::unique_ptr< weld::Entry > m_xFaxED
SwLabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
std::unique_ptr< weld::Entry > m_xSloganED
std::unique_ptr< weld::Entry > m_xPhoneED
std::unique_ptr< weld::Entry > m_xFirstName2ED
std::unique_ptr< weld::Entry > m_xStateED
SwLabDlg(weld::Window *pParent, const SfxItemSet &rSet, SwDBManager *pDBManager, bool bLabel)
std::unique_ptr< weld::Entry > m_xMailED
OUString m_aPrivFirstName
void GetLabItem(SwLabItem &rItem)
std::unique_ptr< weld::ComboBox > m_xDatabaseLB
std::unique_ptr< weld::ComboBox > m_xTableLB
std::unique_ptr< weld::RadioButton > m_xSheetButton