1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include <vcl/svapp.hxx>
22 #include <rtl/ustring.hxx>
23 #include <tools/lineend.hxx>
24 #include <svtools/unitconv.hxx>
25 #include <com/sun/star/uno/Sequence.h>
26 #include <swtypes.hxx>
28 #include "swuilabimp.hxx"
35 #include <strings.hrc>
38 void SwLabRec::SetFromItem( const SwLabItem
& rItem
)
40 m_nHDist
= rItem
.m_lHDist
;
41 m_nVDist
= rItem
.m_lVDist
;
42 m_nWidth
= rItem
.m_lWidth
;
43 m_nHeight
= rItem
.m_lHeight
;
44 m_nLeft
= rItem
.m_lLeft
;
45 m_nUpper
= rItem
.m_lUpper
;
46 m_nCols
= rItem
.m_nCols
;
47 m_nRows
= rItem
.m_nRows
;
48 m_nPWidth
= rItem
.m_lPWidth
;
49 m_nPHeight
= rItem
.m_lPHeight
;
50 m_bCont
= rItem
.m_bCont
;
53 void SwLabRec::FillItem( SwLabItem
& rItem
) const
55 rItem
.m_lHDist
= m_nHDist
;
56 rItem
.m_lVDist
= m_nVDist
;
57 rItem
.m_lWidth
= m_nWidth
;
58 rItem
.m_lHeight
= m_nHeight
;
59 rItem
.m_lLeft
= m_nLeft
;
60 rItem
.m_lUpper
= m_nUpper
;
61 rItem
.m_nCols
= m_nCols
;
62 rItem
.m_lPWidth
= m_nPWidth
;
63 rItem
.m_lPHeight
= m_nPHeight
;
64 rItem
.m_nRows
= m_nRows
;
67 void SwLabDlg::ReplaceGroup_( const OUString
&rMake
)
70 m_pRecs
->erase(m_pRecs
->begin() + 1, m_pRecs
->end());
71 m_aLabelsCfg
.FillLabels(rMake
, *m_pRecs
);
75 void SwLabDlg::PageCreated(const OUString
&rId
, SfxTabPage
&rPage
)
79 static_cast<SwLabPage
*>(&rPage
)->SetDBManager(m_pDBManager
);
80 static_cast<SwLabPage
*>(&rPage
)->InitDatabaseBox();
82 static_cast<SwLabPage
*>(&rPage
)->SetToBusinessCard();
84 else if (rId
== "options")
85 m_pPrtPage
= static_cast<SwLabPrtPage
*>(&rPage
);
88 SwLabDlg::SwLabDlg(weld::Window
* pParent
, const SfxItemSet
& rSet
,
89 SwDBManager
* pDBManager_
, bool bLabel
)
90 : SfxTabDialogController(pParent
, "modules/swriter/ui/labeldialog.ui", "LabelDialog", &rSet
)
91 , m_pDBManager(pDBManager_
)
94 , m_pRecs(new SwLabRecs
)
97 weld::WaitObject
aWait(pParent
);
99 // Read user label from writer.cfg
100 SwLabItem
aItem(static_cast<const SwLabItem
&>(rSet
.Get( FN_LABEL
)));
101 std::unique_ptr
<SwLabRec
> pRec(new SwLabRec
);
102 pRec
->m_aMake
= pRec
->m_aType
= SwResId(STR_CUSTOM_LABEL
);
103 pRec
->SetFromItem( aItem
);
105 bool bDouble
= false;
107 for (const std::unique_ptr
<SwLabRec
> & i
: *m_pRecs
)
109 if (pRec
->m_aMake
== i
->m_aMake
&&
110 pRec
->m_aType
== i
->m_aType
)
118 m_pRecs
->insert( m_pRecs
->begin(), std::move(pRec
));
120 size_t nLstGroup
= 0;
121 const std::vector
<OUString
>& rMan
= m_aLabelsCfg
.GetManufacturers();
122 for(size_t nMan
= 0; nMan
< rMan
.size(); ++nMan
)
124 m_aMakes
.push_back(rMan
[nMan
]);
125 if ( rMan
[nMan
] == aItem
.m_aLstMake
)
129 if ( !m_aMakes
.empty() )
130 ReplaceGroup_( m_aMakes
[nLstGroup
] );
133 m_xExampleSet
->Put(aItem
);
135 AddTabPage("format", SwLabFormatPage::Create
, nullptr);
136 AddTabPage("options", SwLabPrtPage::Create
, nullptr);
137 AddTabPage("labels", SwLabPage::Create
, nullptr);
138 m_sBusinessCardDlg
= SwResId(STR_BUSINESS_CARDS
);
142 RemoveTabPage("business");
143 RemoveTabPage("private");
147 AddTabPage("business", SwBusinessDataPage::Create
, nullptr );
148 AddTabPage("private", SwPrivateDataPage::Create
, nullptr);
149 m_xDialog
->set_title(m_sBusinessCardDlg
);
153 SwLabDlg::~SwLabDlg()
158 void SwLabDlg::GetLabItem(SwLabItem
&rItem
)
160 const SwLabItem
& rActItem
= static_cast<const SwLabItem
&>(GetExampleSet()->Get(FN_LABEL
));
161 const SwLabItem
& rOldItem
= static_cast<const SwLabItem
&>(GetInputSetImpl()->Get(FN_LABEL
));
163 if (rActItem
!= rOldItem
)
165 // Was already "put" with (hopefully) correct content
172 // In rItem there are only settings defined by users.
173 // Therefore get the real settings directly from Record
174 SwLabRec
* pRec
= GetRecord(rItem
.m_aType
, rItem
.m_bCont
);
175 pRec
->FillItem( rItem
);
179 SwLabRec
* SwLabDlg::GetRecord(std::u16string_view rRecName
, bool bCont
)
181 SwLabRec
* pRec
= nullptr;
183 const OUString
sCustom(SwResId(STR_CUSTOM_LABEL
));
185 const size_t nCount
= Recs().size();
186 for (size_t i
= 0; i
< nCount
; ++i
)
188 pRec
= Recs()[i
].get();
189 if (pRec
->m_aType
!= sCustom
&&
190 rRecName
== pRec
->m_aType
&& bCont
== pRec
->m_bCont
)
196 if (!bFound
) // User defined
197 pRec
= Recs()[0].get();
202 Printer
*SwLabDlg::GetPrt()
205 return m_pPrtPage
->GetPrt();
210 SwLabPage::SwLabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
)
211 : SfxTabPage(pPage
, pController
, "modules/swriter/ui/cardmediumpage.ui", "CardMediumPage", &rSet
)
212 , m_pDBManager(nullptr)
213 , m_aItem(static_cast<const SwLabItem
&>(rSet
.Get(FN_LABEL
)))
214 , m_xAddressFrame(m_xBuilder
->weld_widget("addressframe"))
215 , m_xAddrBox(m_xBuilder
->weld_check_button("address"))
216 , m_xWritingEdit(m_xBuilder
->weld_text_view("textview"))
217 , m_xDatabaseLB(m_xBuilder
->weld_combo_box("database"))
218 , m_xTableLB(m_xBuilder
->weld_combo_box("table"))
219 , m_xInsertBT(m_xBuilder
->weld_button("insert"))
220 , m_xDBFieldLB(m_xBuilder
->weld_combo_box("field"))
221 , m_xContButton(m_xBuilder
->weld_radio_button("continuous"))
222 , m_xSheetButton(m_xBuilder
->weld_radio_button("sheet"))
223 , m_xMakeBox(m_xBuilder
->weld_combo_box("brand"))
224 , m_xTypeBox(m_xBuilder
->weld_combo_box("type"))
225 , m_xHiddenSortTypeBox(m_xBuilder
->weld_combo_box("hiddentype"))
226 , m_xFormatInfo(m_xBuilder
->weld_label("formatinfo"))
228 weld::WaitObject
aWait(GetFrameWeld());
230 m_xWritingEdit
->set_size_request(m_xWritingEdit
->get_approximate_digit_width() * 30,
231 m_xWritingEdit
->get_height_rows(10));
232 m_xHiddenSortTypeBox
->make_sorted();
234 tools::Long nListBoxWidth
= m_xWritingEdit
->get_approximate_digit_width() * 25;
235 m_xTableLB
->set_size_request(nListBoxWidth
, -1);
236 m_xDatabaseLB
->set_size_request(nListBoxWidth
, -1);
237 m_xDBFieldLB
->set_size_request(nListBoxWidth
, -1);
239 SetExchangeSupport();
242 m_xAddrBox
->connect_toggled(LINK(this, SwLabPage
, AddrHdl
));
243 m_xDatabaseLB
->connect_changed(LINK(this, SwLabPage
, DatabaseHdl
));
244 m_xTableLB
->connect_changed(LINK(this, SwLabPage
, DatabaseHdl
));
245 m_xDBFieldLB
->connect_changed(LINK(this, SwLabPage
, DatabaseHdl
));
246 m_xInsertBT
->connect_clicked(LINK(this, SwLabPage
, FieldHdl
));
247 // Disable insert button first,
248 // it'll be enabled if m_xDatabaseLB, m_pTableLB and m_pInsertBT are filled
249 m_xInsertBT
->set_sensitive(false);
250 m_xContButton
->connect_toggled(LINK(this, SwLabPage
, PageHdl
));
251 m_xSheetButton
->connect_toggled(LINK(this, SwLabPage
, PageHdl
));
252 auto nMaxWidth
= m_xMakeBox
->get_approximate_digit_width() * 32;
253 m_xMakeBox
->set_size_request(nMaxWidth
, -1);
254 m_xTypeBox
->set_size_request(nMaxWidth
, -1);
255 m_xMakeBox
->connect_changed(LINK(this, SwLabPage
, MakeHdl
));
256 m_xTypeBox
->connect_changed(LINK(this, SwLabPage
, TypeHdl
));
261 SwLabPage::~SwLabPage()
265 void SwLabPage::SetToBusinessCard()
267 m_xContainer
->set_help_id(HID_BUSINESS_FMT_PAGE
);
268 m_xContButton
->set_help_id(HID_BUSINESS_FMT_PAGE_CONT
);
269 m_xSheetButton
->set_help_id(HID_BUSINESS_FMT_PAGE_SHEET
);
270 m_xMakeBox
->set_help_id(HID_BUSINESS_FMT_PAGE_BRAND
);
271 m_xTypeBox
->set_help_id(HID_BUSINESS_FMT_PAGE_TYPE
);
274 IMPL_LINK_NOARG(SwLabPage
, AddrHdl
, weld::Toggleable
&, void)
278 if (m_xAddrBox
->get_active())
279 aWriting
= convertLineEnd(MakeSender(), GetSystemLineEnd());
281 m_xWritingEdit
->set_text(aWriting
);
282 m_xWritingEdit
->grab_focus();
285 IMPL_LINK( SwLabPage
, DatabaseHdl
, weld::ComboBox
&, rListBox
, void )
287 m_sActDBName
= m_xDatabaseLB
->get_active_text();
289 weld::WaitObject
aObj(GetParentSwLabDlg()->getDialog());
291 if (&rListBox
== m_xDatabaseLB
.get())
292 GetDBManager()->GetTableNames(*m_xTableLB
, m_sActDBName
);
294 if (&rListBox
== m_xDatabaseLB
.get() || &rListBox
== m_xTableLB
.get())
295 GetDBManager()->GetColumnNames(*m_xDBFieldLB
, m_sActDBName
, m_xTableLB
->get_active_text());
297 if (!m_xDatabaseLB
->get_active_text().isEmpty() && !m_xTableLB
->get_active_text().isEmpty()
298 && !m_xDBFieldLB
->get_active_text().isEmpty())
299 m_xInsertBT
->set_sensitive(true);
301 m_xInsertBT
->set_sensitive(false);
304 IMPL_LINK_NOARG(SwLabPage
, FieldHdl
, weld::Button
&, void)
306 OUString
aStr("<" + m_xDatabaseLB
->get_active_text() + "." +
307 m_xTableLB
->get_active_text() + "." +
308 m_xTableLB
->get_active_id() + "." +
309 m_xDBFieldLB
->get_active_text() + ">");
310 m_xWritingEdit
->replace_selection(aStr
);
311 int nStartPos
, nEndPos
;
312 m_xWritingEdit
->get_selection_bounds(nStartPos
, nEndPos
);
313 m_xWritingEdit
->grab_focus();
314 m_xWritingEdit
->select_region(nStartPos
, nEndPos
);
317 IMPL_LINK_NOARG(SwLabPage
, PageHdl
, weld::Toggleable
&, void)
319 MakeHdl(*m_xMakeBox
);
322 IMPL_LINK_NOARG(SwLabPage
, MakeHdl
, weld::ComboBox
&, void)
324 weld::WaitObject
aWait(GetParentSwLabDlg()->getDialog());
327 m_xHiddenSortTypeBox
->clear();
328 GetParentSwLabDlg()->TypeIds().clear();
330 const OUString aMake
= m_xMakeBox
->get_active_text();
331 GetParentSwLabDlg()->ReplaceGroup( aMake
);
332 m_aItem
.m_aLstMake
= aMake
;
334 const bool bCont
= m_xContButton
->get_active();
335 const size_t nCount
= GetParentSwLabDlg()->Recs().size();
338 const OUString
sCustom(SwResId(STR_CUSTOM_LABEL
));
339 //insert the entries into the sorted list box
340 for ( size_t i
= 0; i
< nCount
; ++i
)
342 const OUString
aType(GetParentSwLabDlg()->Recs()[i
]->m_aType
);
343 bool bInsert
= false;
344 if (GetParentSwLabDlg()->Recs()[i
]->m_aType
== sCustom
)
347 m_xTypeBox
->append_text(aType
);
349 else if (GetParentSwLabDlg()->Recs()[i
]->m_bCont
== bCont
)
351 if (m_xHiddenSortTypeBox
->find_text(aType
) == -1)
354 m_xHiddenSortTypeBox
->append_text( aType
);
359 GetParentSwLabDlg()->TypeIds().push_back(i
);
360 if ( !nLstType
&& aType
== m_aItem
.m_aLstType
)
361 nLstType
= GetParentSwLabDlg()->TypeIds().size();
364 for (int nEntry
= 0; nEntry
< m_xHiddenSortTypeBox
->get_count(); ++nEntry
)
366 m_xTypeBox
->append_text(m_xHiddenSortTypeBox
->get_text(nEntry
));
369 m_xTypeBox
->set_active_text(m_aItem
.m_aLstType
);
371 m_xTypeBox
->set_active(0);
372 TypeHdl(*m_xTypeBox
);
375 IMPL_LINK_NOARG(SwLabPage
, TypeHdl
, weld::ComboBox
&, void)
378 m_aItem
.m_aType
= m_xTypeBox
->get_active_text();
381 void SwLabPage::DisplayFormat()
383 std::unique_ptr
<weld::Builder
> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/spinbox.ui"));
384 std::unique_ptr
<weld::Dialog
> xTopLevel(xBuilder
->weld_dialog("SpinDialog"));
385 std::unique_ptr
<weld::MetricSpinButton
> xField(xBuilder
->weld_metric_spin_button("spin", FieldUnit::CM
));
386 SetFieldUnit(*xField
, ::GetDfltMetric(false));
387 xField
->set_digits(2);
388 xField
->set_range(0, INT_MAX
- 1, FieldUnit::NONE
);
390 SwLabRec
* pRec
= GetSelectedEntryPos();
391 m_aItem
.m_aLstType
= pRec
->m_aType
;
392 setfldval(*xField
, pRec
->m_nWidth
);
394 const OUString aWString
= xField
->get_text();
396 setfldval(*xField
, pRec
->m_nHeight
);
399 OUString aText
= pRec
->m_aType
+ ": " + aWString
+
400 " x " + xField
->get_text() +
401 " (" + OUString::number( pRec
->m_nCols
) +
402 " x " + OUString::number( pRec
->m_nRows
) + ")";
403 m_xFormatInfo
->set_label(aText
);
406 SwLabRec
* SwLabPage::GetSelectedEntryPos()
408 OUString
sSelEntry(m_xTypeBox
->get_active_text());
410 return GetParentSwLabDlg()->GetRecord(sSelEntry
, m_xContButton
->get_active());
413 void SwLabPage::InitDatabaseBox()
415 if( !GetDBManager() )
418 m_xDatabaseLB
->clear();
419 const css::uno::Sequence
<OUString
> aDataNames
= SwDBManager::GetExistingDatabaseNames();
420 for (const OUString
& rDataName
: aDataNames
)
421 m_xDatabaseLB
->append_text(rDataName
);
423 OUString sDBName
= m_sActDBName
.getToken( 0, DB_DELIM
, nIdx
);
424 OUString sTableName
= m_sActDBName
.getToken( 0, DB_DELIM
, nIdx
);
425 m_xDatabaseLB
->set_active_text(sDBName
);
426 if( !sDBName
.isEmpty() && GetDBManager()->GetTableNames(*m_xTableLB
, sDBName
))
428 m_xTableLB
->set_active_text(sTableName
);
429 GetDBManager()->GetColumnNames(*m_xDBFieldLB
, m_sActDBName
, sTableName
);
432 m_xDBFieldLB
->clear();
435 std::unique_ptr
<SfxTabPage
> SwLabPage::Create(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* rSet
)
437 return std::make_unique
<SwLabPage
>(pPage
, pController
, *rSet
);
440 void SwLabPage::ActivatePage(const SfxItemSet
& rSet
)
445 DeactivateRC
SwLabPage::DeactivatePage(SfxItemSet
* _pSet
)
450 return DeactivateRC::LeavePage
;
453 void SwLabPage::FillItem(SwLabItem
& rItem
)
455 rItem
.m_bAddr
= m_xAddrBox
->get_active();
456 rItem
.m_aWriting
= m_xWritingEdit
->get_text();
457 rItem
.m_bCont
= m_xContButton
->get_active();
458 rItem
.m_aMake
= m_xMakeBox
->get_active_text();
459 rItem
.m_aType
= m_xTypeBox
->get_active_text();
460 rItem
.m_sDBName
= m_sActDBName
;
462 SwLabRec
* pRec
= GetSelectedEntryPos();
463 pRec
->FillItem( rItem
);
465 rItem
.m_aLstMake
= m_xMakeBox
->get_active_text();
466 rItem
.m_aLstType
= m_xTypeBox
->get_active_text();
469 bool SwLabPage::FillItemSet(SfxItemSet
* rSet
)
472 rSet
->Put( m_aItem
);
477 void SwLabPage::Reset(const SfxItemSet
* rSet
)
481 size_t nLstGroup
= 0;
483 const size_t nCount
= GetParentSwLabDlg()->Makes().size();
484 for(size_t i
= 0; i
< nCount
; ++i
)
486 OUString
& rStr
= GetParentSwLabDlg()->Makes()[i
];
487 m_xMakeBox
->append_text(rStr
);
489 if ( rStr
== m_aItem
.m_aLstMake
)
493 m_xMakeBox
->set_active( nLstGroup
);
494 MakeHdl(*m_xMakeBox
);
496 m_aItem
= static_cast<const SwLabItem
&>( rSet
->Get(FN_LABEL
));
497 OUString sDBName
= m_aItem
.m_sDBName
;
499 OUString
aWriting(convertLineEnd(m_aItem
.m_aWriting
, GetSystemLineEnd()));
501 m_xAddrBox
->set_active( m_aItem
.m_bAddr
);
502 m_xWritingEdit
->set_text( aWriting
);
504 for(const auto& rMake
: GetParentSwLabDlg()->Makes())
506 if (m_xMakeBox
->find_text(rMake
) == -1)
507 m_xMakeBox
->append_text(rMake
);
510 m_xMakeBox
->set_active_text(m_aItem
.m_aMake
);
511 //save the current type
512 OUString
sType(m_aItem
.m_aType
);
513 MakeHdl(*m_xMakeBox
);
514 m_aItem
.m_aType
= sType
;
515 //#102806# a newly added make may not be in the type ListBox already
516 if (m_xTypeBox
->find_text(m_aItem
.m_aType
) == -1 && !m_aItem
.m_aMake
.isEmpty())
517 GetParentSwLabDlg()->UpdateGroup( m_aItem
.m_aMake
);
518 if (m_xTypeBox
->find_text(m_aItem
.m_aType
) != -1)
520 m_xTypeBox
->set_active_text(m_aItem
.m_aType
);
521 TypeHdl(*m_xTypeBox
);
523 if (m_xDatabaseLB
->find_text(sDBName
) != -1)
525 m_xDatabaseLB
->set_active_text(sDBName
);
526 DatabaseHdl(*m_xDatabaseLB
);
530 m_xContButton
->set_active(true);
532 m_xSheetButton
->set_active(true);
535 SwPrivateDataPage::SwPrivateDataPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
)
536 : SfxTabPage(pPage
, pController
, "modules/swriter/ui/privateuserpage.ui", "PrivateUserPage", &rSet
)
537 , m_xFirstNameED(m_xBuilder
->weld_entry("firstname"))
538 , m_xNameED(m_xBuilder
->weld_entry("lastname"))
539 , m_xShortCutED(m_xBuilder
->weld_entry("shortname"))
540 , m_xFirstName2ED(m_xBuilder
->weld_entry("firstname2"))
541 , m_xName2ED(m_xBuilder
->weld_entry("lastname2"))
542 , m_xShortCut2ED(m_xBuilder
->weld_entry("shortname2"))
543 , m_xStreetED(m_xBuilder
->weld_entry("street"))
544 , m_xZipED(m_xBuilder
->weld_entry("izip"))
545 , m_xCityED(m_xBuilder
->weld_entry("icity"))
546 , m_xCountryED(m_xBuilder
->weld_entry("country"))
547 , m_xStateED(m_xBuilder
->weld_entry("state"))
548 , m_xTitleED(m_xBuilder
->weld_entry("title"))
549 , m_xProfessionED(m_xBuilder
->weld_entry("job"))
550 , m_xPhoneED(m_xBuilder
->weld_entry("phone"))
551 , m_xMobilePhoneED(m_xBuilder
->weld_entry("mobile"))
552 , m_xFaxED(m_xBuilder
->weld_entry("fax"))
553 , m_xHomePageED(m_xBuilder
->weld_entry("url"))
554 , m_xMailED(m_xBuilder
->weld_entry("email"))
556 SetExchangeSupport();
559 SwPrivateDataPage::~SwPrivateDataPage()
563 std::unique_ptr
<SfxTabPage
> SwPrivateDataPage::Create(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* rSet
)
565 return std::make_unique
<SwPrivateDataPage
>(pPage
, pController
, *rSet
);
568 void SwPrivateDataPage::ActivatePage(const SfxItemSet
& rSet
)
573 DeactivateRC
SwPrivateDataPage::DeactivatePage(SfxItemSet
* _pSet
)
577 return DeactivateRC::LeavePage
;
580 bool SwPrivateDataPage::FillItemSet(SfxItemSet
* rSet
)
582 const SfxItemSet
* pExampleSet
= GetDialogExampleSet();
584 SwLabItem aItem
= static_cast<const SwLabItem
&>(pExampleSet
->Get(FN_LABEL
));
586 aItem
.m_aPrivFirstName
= m_xFirstNameED
->get_text();
587 aItem
.m_aPrivName
= m_xNameED
->get_text();
588 aItem
.m_aPrivShortCut
= m_xShortCutED
->get_text();
589 aItem
.m_aPrivFirstName2
= m_xFirstName2ED
->get_text();
590 aItem
.m_aPrivName2
= m_xName2ED
->get_text();
591 aItem
.m_aPrivShortCut2
= m_xShortCut2ED
->get_text();
592 aItem
.m_aPrivStreet
= m_xStreetED
->get_text();
593 aItem
.m_aPrivZip
= m_xZipED
->get_text();
594 aItem
.m_aPrivCity
= m_xCityED
->get_text();
595 aItem
.m_aPrivCountry
= m_xCountryED
->get_text();
596 aItem
.m_aPrivState
= m_xStateED
->get_text();
597 aItem
.m_aPrivTitle
= m_xTitleED
->get_text();
598 aItem
.m_aPrivProfession
= m_xProfessionED
->get_text();
599 aItem
.m_aPrivPhone
= m_xPhoneED
->get_text();
600 aItem
.m_aPrivMobile
= m_xMobilePhoneED
->get_text();
601 aItem
.m_aPrivFax
= m_xFaxED
->get_text();
602 aItem
.m_aPrivWWW
= m_xHomePageED
->get_text();
603 aItem
.m_aPrivMail
= m_xMailED
->get_text();
609 void SwPrivateDataPage::Reset(const SfxItemSet
* rSet
)
611 const SwLabItem
& aItem
= static_cast<const SwLabItem
&>( rSet
->Get(FN_LABEL
) );
612 m_xFirstNameED
->set_text(aItem
.m_aPrivFirstName
);
613 m_xNameED
->set_text(aItem
.m_aPrivName
);
614 m_xShortCutED
->set_text(aItem
.m_aPrivShortCut
);
615 m_xFirstName2ED
->set_text(aItem
.m_aPrivFirstName2
);
616 m_xName2ED
->set_text(aItem
.m_aPrivName2
);
617 m_xShortCut2ED
->set_text(aItem
.m_aPrivShortCut2
);
618 m_xStreetED
->set_text(aItem
.m_aPrivStreet
);
619 m_xZipED
->set_text(aItem
.m_aPrivZip
);
620 m_xCityED
->set_text(aItem
.m_aPrivCity
);
621 m_xCountryED
->set_text(aItem
.m_aPrivCountry
);
622 m_xStateED
->set_text(aItem
.m_aPrivState
);
623 m_xTitleED
->set_text(aItem
.m_aPrivTitle
);
624 m_xProfessionED
->set_text(aItem
.m_aPrivProfession
);
625 m_xPhoneED
->set_text(aItem
.m_aPrivPhone
);
626 m_xMobilePhoneED
->set_text(aItem
.m_aPrivMobile
);
627 m_xFaxED
->set_text(aItem
.m_aPrivFax
);
628 m_xHomePageED
->set_text(aItem
.m_aPrivWWW
);
629 m_xMailED
->set_text(aItem
.m_aPrivMail
);
632 SwBusinessDataPage::SwBusinessDataPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
)
633 : SfxTabPage(pPage
, pController
, "modules/swriter/ui/businessdatapage.ui", "BusinessDataPage", &rSet
)
634 , m_xCompanyED(m_xBuilder
->weld_entry("company"))
635 , m_xCompanyExtED(m_xBuilder
->weld_entry("company2"))
636 , m_xSloganED(m_xBuilder
->weld_entry("slogan"))
637 , m_xStreetED(m_xBuilder
->weld_entry("street"))
638 , m_xZipED(m_xBuilder
->weld_entry("izip"))
639 , m_xCityED(m_xBuilder
->weld_entry("icity"))
640 , m_xCountryED(m_xBuilder
->weld_entry("country"))
641 , m_xStateED(m_xBuilder
->weld_entry("state"))
642 , m_xPositionED(m_xBuilder
->weld_entry("position"))
643 , m_xPhoneED(m_xBuilder
->weld_entry("phone"))
644 , m_xMobilePhoneED(m_xBuilder
->weld_entry("mobile"))
645 , m_xFaxED(m_xBuilder
->weld_entry("fax"))
646 , m_xHomePageED(m_xBuilder
->weld_entry("url"))
647 , m_xMailED(m_xBuilder
->weld_entry("email"))
649 SetExchangeSupport();
652 SwBusinessDataPage::~SwBusinessDataPage()
656 std::unique_ptr
<SfxTabPage
> SwBusinessDataPage::Create(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* rSet
)
658 return std::make_unique
<SwBusinessDataPage
>(pPage
, pController
, *rSet
);
661 void SwBusinessDataPage::ActivatePage(const SfxItemSet
& rSet
)
666 DeactivateRC
SwBusinessDataPage::DeactivatePage(SfxItemSet
* _pSet
)
670 return DeactivateRC::LeavePage
;
673 bool SwBusinessDataPage::FillItemSet(SfxItemSet
* rSet
)
675 const SfxItemSet
* pExampleSet
= GetDialogExampleSet();
677 SwLabItem aItem
= static_cast<const SwLabItem
&>(pExampleSet
->Get(FN_LABEL
));
679 aItem
.m_aCompCompany
= m_xCompanyED
->get_text();
680 aItem
.m_aCompCompanyExt
= m_xCompanyExtED
->get_text();
681 aItem
.m_aCompSlogan
= m_xSloganED
->get_text();
682 aItem
.m_aCompStreet
= m_xStreetED
->get_text();
683 aItem
.m_aCompZip
= m_xZipED
->get_text();
684 aItem
.m_aCompCity
= m_xCityED
->get_text();
685 aItem
.m_aCompCountry
= m_xCountryED
->get_text();
686 aItem
.m_aCompState
= m_xStateED
->get_text();
687 aItem
.m_aCompPosition
= m_xPositionED
->get_text();
688 aItem
.m_aCompPhone
= m_xPhoneED
->get_text();
689 aItem
.m_aCompMobile
= m_xMobilePhoneED
->get_text();
690 aItem
.m_aCompFax
= m_xFaxED
->get_text();
691 aItem
.m_aCompWWW
= m_xHomePageED
->get_text();
692 aItem
.m_aCompMail
= m_xMailED
->get_text();
698 void SwBusinessDataPage::Reset(const SfxItemSet
* rSet
)
700 const SwLabItem
& aItem
= static_cast<const SwLabItem
&>( rSet
->Get(FN_LABEL
) );
701 m_xCompanyED
->set_text(aItem
.m_aCompCompany
);
702 m_xCompanyExtED
->set_text(aItem
.m_aCompCompanyExt
);
703 m_xSloganED
->set_text(aItem
.m_aCompSlogan
);
704 m_xStreetED
->set_text(aItem
.m_aCompStreet
);
705 m_xZipED
->set_text(aItem
.m_aCompZip
);
706 m_xCityED
->set_text(aItem
.m_aCompCity
);
707 m_xCountryED
->set_text(aItem
.m_aCompCountry
);
708 m_xStateED
->set_text(aItem
.m_aCompState
);
709 m_xPositionED
->set_text(aItem
.m_aCompPosition
);
710 m_xPhoneED
->set_text(aItem
.m_aCompPhone
);
711 m_xMobilePhoneED
->set_text(aItem
.m_aCompMobile
);
712 m_xFaxED
->set_text(aItem
.m_aCompFax
);
713 m_xHomePageED
->set_text(aItem
.m_aCompWWW
);
714 m_xMailED
->set_text(aItem
.m_aCompMail
);
717 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */