LibreOffice Module sw (master) 1
label1.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include <memory>
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>
27#include <labimp.hxx>
28#include "swuilabimp.hxx"
29#include "labfmt.hxx"
30#include "labprt.hxx"
31#include <dbmgr.hxx>
32#include <uitool.hxx>
33#include <cmdid.h>
34#include <helpids.h>
35#include <strings.hrc>
36#include <envimg.hxx>
37
38void SwLabRec::SetFromItem( const SwLabItem& rItem )
39{
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;
51}
52
53void SwLabRec::FillItem( SwLabItem& rItem ) const
54{
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;
65}
66
67void SwLabDlg::ReplaceGroup_( const OUString &rMake )
68{
69 // Remove old entries
70 m_pRecs->erase(m_pRecs->begin() + 1, m_pRecs->end());
72 m_aLstGroup = rMake;
73}
74
75void SwLabDlg::PageCreated(const OString &rId, SfxTabPage &rPage)
76{
77 if (rId == "labels")
78 {
79 static_cast<SwLabPage*>(&rPage)->SetDBManager(m_pDBManager);
80 static_cast<SwLabPage*>(&rPage)->InitDatabaseBox();
81 if (!m_bLabel)
82 static_cast<SwLabPage*>(&rPage)->SetToBusinessCard();
83 }
84 else if (rId == "options")
85 m_pPrtPage = static_cast<SwLabPrtPage*>(&rPage);
86}
87
89 SwDBManager* pDBManager_, bool bLabel)
90 : SfxTabDialogController(pParent, "modules/swriter/ui/labeldialog.ui", "LabelDialog", &rSet)
91 , m_pDBManager(pDBManager_)
92 , m_pPrtPage(nullptr)
93 , m_aTypeIds(50, 10)
94 , m_pRecs(new SwLabRecs)
95 , m_bLabel(bLabel)
96{
97 weld::WaitObject aWait(pParent);
98
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 );
104
105 bool bDouble = false;
106
107 for (const std::unique_ptr<SwLabRec> & i : *m_pRecs)
108 {
109 if (pRec->m_aMake == i->m_aMake &&
110 pRec->m_aType == i->m_aType)
111 {
112 bDouble = true;
113 break;
114 }
115 }
116
117 if (!bDouble)
118 m_pRecs->insert( m_pRecs->begin(), std::move(pRec));
119
120 size_t nLstGroup = 0;
121 const std::vector<OUString>& rMan = m_aLabelsCfg.GetManufacturers();
122 for(size_t nMan = 0; nMan < rMan.size(); ++nMan)
123 {
124 m_aMakes.push_back(rMan[nMan]);
125 if ( rMan[nMan] == aItem.m_aLstMake )
126 nLstGroup = nMan;
127 }
128
129 if ( !m_aMakes.empty() )
130 ReplaceGroup_( m_aMakes[nLstGroup] );
131
132 if (m_xExampleSet)
133 m_xExampleSet->Put(aItem);
134
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);
139
140 if (m_bLabel)
141 {
142 RemoveTabPage("business");
143 RemoveTabPage("private");
144 }
145 else
146 {
147 AddTabPage("business", SwBusinessDataPage::Create, nullptr );
148 AddTabPage("private", SwPrivateDataPage::Create, nullptr);
149 m_xDialog->set_title(m_sBusinessCardDlg);
150 }
151}
152
154{
155 m_pRecs.reset();
156}
157
159{
160 const SwLabItem& rActItem = static_cast<const SwLabItem&>(GetExampleSet()->Get(FN_LABEL));
161 const SwLabItem& rOldItem = static_cast<const SwLabItem&>(GetInputSetImpl()->Get(FN_LABEL));
162
163 if (rActItem != rOldItem)
164 {
165 // Was already "put" with (hopefully) correct content
166 rItem = rActItem;
167 }
168 else
169 {
170 rItem = rOldItem;
171
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 );
176 }
177}
178
179SwLabRec* SwLabDlg::GetRecord(std::u16string_view rRecName, bool bCont)
180{
181 SwLabRec* pRec = nullptr;
182 bool bFound = false;
183 const OUString sCustom(SwResId(STR_CUSTOM_LABEL));
184
185 const size_t nCount = Recs().size();
186 for (size_t i = 0; i < nCount; ++i)
187 {
188 pRec = Recs()[i].get();
189 if (pRec->m_aType != sCustom &&
190 rRecName == pRec->m_aType && bCont == pRec->m_bCont)
191 {
192 bFound = true;
193 break;
194 }
195 }
196 if (!bFound) // User defined
197 pRec = Recs()[0].get();
198
199 return pRec;
200}
201
203{
204 if (m_pPrtPage)
205 return m_pPrtPage->GetPrt();
206 else
207 return nullptr;
208}
209
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"))
227{
229
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();
233
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);
238
240
241 // Install handlers
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));
257
259}
260
262{
263}
264
266{
272};
273
275{
276 OUString aWriting;
277
278 if (m_xAddrBox->get_active())
280
281 m_xWritingEdit->set_text(aWriting);
282 m_xWritingEdit->grab_focus();
283}
284
285IMPL_LINK( SwLabPage, DatabaseHdl, weld::ComboBox&, rListBox, void )
286{
287 m_sActDBName = m_xDatabaseLB->get_active_text();
288
289 weld::WaitObject aObj(GetParentSwLabDlg()->getDialog());
290
291 if (&rListBox == m_xDatabaseLB.get())
292 GetDBManager()->GetTableNames(*m_xTableLB, m_sActDBName);
293
294 if (&rListBox == m_xDatabaseLB.get() || &rListBox == m_xTableLB.get())
295 GetDBManager()->GetColumnNames(*m_xDBFieldLB, m_sActDBName, m_xTableLB->get_active_text());
296
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);
300 else
301 m_xInsertBT->set_sensitive(false);
302}
303
305{
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);
315}
316
318{
319 MakeHdl(*m_xMakeBox);
320}
321
323{
324 weld::WaitObject aWait(GetParentSwLabDlg()->getDialog());
325
326 m_xTypeBox->clear();
327 m_xHiddenSortTypeBox->clear();
328 GetParentSwLabDlg()->TypeIds().clear();
329
330 const OUString aMake = m_xMakeBox->get_active_text();
331 GetParentSwLabDlg()->ReplaceGroup( aMake );
332 m_aItem.m_aLstMake = aMake;
333
334 const bool bCont = m_xContButton->get_active();
335 const size_t nCount = GetParentSwLabDlg()->Recs().size();
336 size_t nLstType = 0;
337
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 )
341 {
342 const OUString aType(GetParentSwLabDlg()->Recs()[i]->m_aType);
343 bool bInsert = false;
344 if (GetParentSwLabDlg()->Recs()[i]->m_aType == sCustom)
345 {
346 bInsert = true;
347 m_xTypeBox->append_text(aType );
348 }
349 else if (GetParentSwLabDlg()->Recs()[i]->m_bCont == bCont)
350 {
351 if (m_xHiddenSortTypeBox->find_text(aType) == -1)
352 {
353 bInsert = true;
354 m_xHiddenSortTypeBox->append_text( aType );
355 }
356 }
357 if(bInsert)
358 {
359 GetParentSwLabDlg()->TypeIds().push_back(i);
360 if ( !nLstType && aType == m_aItem.m_aLstType )
361 nLstType = GetParentSwLabDlg()->TypeIds().size();
362 }
363 }
364 for (int nEntry = 0; nEntry < m_xHiddenSortTypeBox->get_count(); ++nEntry)
365 {
366 m_xTypeBox->append_text(m_xHiddenSortTypeBox->get_text(nEntry));
367 }
368 if (nLstType)
369 m_xTypeBox->set_active_text(m_aItem.m_aLstType);
370 else
371 m_xTypeBox->set_active(0);
372 TypeHdl(*m_xTypeBox);
373}
374
376{
377 DisplayFormat();
378 m_aItem.m_aType = m_xTypeBox->get_active_text();
379}
380
382{
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);
389
391 m_aItem.m_aLstType = pRec->m_aType;
392 setfldval(*xField, pRec->m_nWidth);
393 xField->reformat();
394 const OUString aWString = xField->get_text();
395
396 setfldval(*xField, pRec->m_nHeight);
397 xField->reformat();
398
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);
404}
405
407{
408 OUString sSelEntry(m_xTypeBox->get_active_text());
409
410 return GetParentSwLabDlg()->GetRecord(sSelEntry, m_xContButton->get_active());
411}
412
414{
415 if( !GetDBManager() )
416 return;
417
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);
422 sal_Int32 nIdx{ 0 };
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))
427 {
428 m_xTableLB->set_active_text(sTableName);
430 }
431 else
432 m_xDBFieldLB->clear();
433}
434
435std::unique_ptr<SfxTabPage> SwLabPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet)
436{
437 return std::make_unique<SwLabPage>(pPage, pController, *rSet);
438}
439
441{
442 Reset( &rSet );
443}
444
446{
447 if (_pSet)
448 FillItemSet(_pSet);
449
450 return DeactivateRC::LeavePage;
451}
452
454{
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;
461
463 pRec->FillItem( rItem );
464
465 rItem.m_aLstMake = m_xMakeBox->get_active_text();
466 rItem.m_aLstType = m_xTypeBox->get_active_text();
467}
468
470{
471 FillItem( m_aItem );
472 rSet->Put( m_aItem );
473
474 return true;
475}
476
478{
479 m_xMakeBox->clear();
480
481 size_t nLstGroup = 0;
482
483 const size_t nCount = GetParentSwLabDlg()->Makes().size();
484 for(size_t i = 0; i < nCount; ++i)
485 {
486 OUString& rStr = GetParentSwLabDlg()->Makes()[i];
487 m_xMakeBox->append_text(rStr);
488
489 if ( rStr == m_aItem.m_aLstMake)
490 nLstGroup = i;
491 }
492
493 m_xMakeBox->set_active( nLstGroup );
494 MakeHdl(*m_xMakeBox);
495
496 m_aItem = static_cast<const SwLabItem&>( rSet->Get(FN_LABEL));
497 OUString sDBName = m_aItem.m_sDBName;
498
499 OUString aWriting(convertLineEnd(m_aItem.m_aWriting, GetSystemLineEnd()));
500
501 m_xAddrBox->set_active( m_aItem.m_bAddr );
502 m_xWritingEdit->set_text( aWriting );
503
504 for(const auto& rMake : GetParentSwLabDlg()->Makes())
505 {
506 if (m_xMakeBox->find_text(rMake) == -1)
507 m_xMakeBox->append_text(rMake);
508 }
509
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);
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())
518 if (m_xTypeBox->find_text(m_aItem.m_aType) != -1)
519 {
520 m_xTypeBox->set_active_text(m_aItem.m_aType);
521 TypeHdl(*m_xTypeBox);
522 }
523 if (m_xDatabaseLB->find_text(sDBName) != -1)
524 {
525 m_xDatabaseLB->set_active_text(sDBName);
526 DatabaseHdl(*m_xDatabaseLB);
527 }
528
529 if (m_aItem.m_bCont)
530 m_xContButton->set_active(true);
531 else
532 m_xSheetButton->set_active(true);
533}
534
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"))
555{
557}
558
560{
561}
562
563std::unique_ptr<SfxTabPage> SwPrivateDataPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet)
564{
565 return std::make_unique<SwPrivateDataPage>(pPage, pController, *rSet);
566}
567
569{
570 Reset(&rSet);
571}
572
574{
575 if (_pSet)
576 FillItemSet(_pSet);
577 return DeactivateRC::LeavePage;
578}
579
581{
582 const SfxItemSet* pExampleSet = GetDialogExampleSet();
583 assert(pExampleSet);
584 SwLabItem aItem = static_cast<const SwLabItem&>(pExampleSet->Get(FN_LABEL));
585
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();
604
605 rSet->Put(aItem);
606 return true;
607}
608
610{
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);
630}
631
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"))
648{
650}
651
653{
654}
655
656std::unique_ptr<SfxTabPage> SwBusinessDataPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet)
657{
658 return std::make_unique<SwBusinessDataPage>(pPage, pController, *rSet);
659}
660
662{
663 Reset(&rSet);
664}
665
667{
668 if (_pSet)
669 FillItemSet(_pSet);
670 return DeactivateRC::LeavePage;
671}
672
674{
675 const SfxItemSet* pExampleSet = GetDialogExampleSet();
676 assert(pExampleSet);
677 SwLabItem aItem = static_cast<const SwLabItem&>(pExampleSet->Get(FN_LABEL));
678
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();
693
694 rSet->Put(aItem);
695 return true;
696}
697
699{
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);
715}
716
717/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OptionalString sType
uno::Type m_aType
Reference< XExecutableDialog > m_xDialog
static std::unique_ptr< weld::Builder > CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false, sal_uInt64 nLOKWindowId=0)
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
void AddTabPage(const OString &rName, CreateTabPage pCreateFunc, GetTabPageRanges pRangesFunc)
virtual const SfxItemSet * GetExampleSet() const override
std::unique_ptr< SfxItemSet > m_xExampleSet
void RemoveTabPage(const OString &rName)
SfxItemSet * GetInputSetImpl()
void SetExchangeSupport()
const SfxItemSet * GetDialogExampleSet() const
weld::Window * GetFrameWeld() const
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: label1.cxx:673
std::unique_ptr< weld::Entry > m_xStateED
Definition: swuilabimp.hxx:124
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: label1.cxx:661
std::unique_ptr< weld::Entry > m_xFaxED
Definition: swuilabimp.hxx:128
std::unique_ptr< weld::Entry > m_xCountryED
Definition: swuilabimp.hxx:123
SwBusinessDataPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: label1.cxx:632
std::unique_ptr< weld::Entry > m_xMailED
Definition: swuilabimp.hxx:130
std::unique_ptr< weld::Entry > m_xPositionED
Definition: swuilabimp.hxx:125
std::unique_ptr< weld::Entry > m_xCompanyExtED
Definition: swuilabimp.hxx:118
std::unique_ptr< weld::Entry > m_xCityED
Definition: swuilabimp.hxx:122
std::unique_ptr< weld::Entry > m_xZipED
Definition: swuilabimp.hxx:121
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: label1.cxx:666
virtual ~SwBusinessDataPage() override
Definition: label1.cxx:652
std::unique_ptr< weld::Entry > m_xPhoneED
Definition: swuilabimp.hxx:126
std::unique_ptr< weld::Entry > m_xSloganED
Definition: swuilabimp.hxx:119
std::unique_ptr< weld::Entry > m_xMobilePhoneED
Definition: swuilabimp.hxx:127
std::unique_ptr< weld::Entry > m_xHomePageED
Definition: swuilabimp.hxx:129
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: label1.cxx:656
std::unique_ptr< weld::Entry > m_xStreetED
Definition: swuilabimp.hxx:120
std::unique_ptr< weld::Entry > m_xCompanyED
Definition: swuilabimp.hxx:117
virtual void Reset(const SfxItemSet *rSet) override
Definition: label1.cxx:698
static css::uno::Sequence< OUString > GetExistingDatabaseNames()
Definition: dbmgr.cxx:2522
void GetColumnNames(weld::ComboBox &rBox, const OUString &rDBName, const OUString &rTableName)
Fill listbox with all column names of a database table.
Definition: dbmgr.cxx:674
std::vector< OUString > m_aMakes
Definition: label.hxx:39
SwLabRec * GetRecord(std::u16string_view rRecName, bool bCont)
Definition: label1.cxx:179
virtual ~SwLabDlg() override
Definition: label1.cxx:153
OUString m_sBusinessCardDlg
Definition: label.hxx:43
SwLabDlg(weld::Window *pParent, const SfxItemSet &rSet, SwDBManager *pDBManager, bool bLabel)
Definition: label1.cxx:88
bool m_bLabel
Definition: label.hxx:44
SwLabelConfig m_aLabelsCfg
Definition: label.hxx:34
Printer * GetPrt()
Definition: label1.cxx:202
SwLabPrtPage * m_pPrtPage
Definition: label.hxx:36
void ReplaceGroup_(const OUString &rMake)
Definition: label1.cxx:67
void UpdateGroup(const OUString &rMake)
Definition: label.hxx:73
void GetLabItem(SwLabItem &rItem)
Definition: label1.cxx:158
SwLabRecs & Recs()
Definition: label.hxx:57
std::unique_ptr< SwLabRecs > m_pRecs
Definition: label.hxx:41
virtual void PageCreated(const OString &rId, SfxTabPage &rPage) override
Definition: label1.cxx:75
SwDBManager * m_pDBManager
Definition: label.hxx:35
OUString m_aLstGroup
Definition: label.hxx:42
std::vector< OUString > & Makes()
Definition: label.hxx:63
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: labfmt.cxx:405
OUString m_aPrivName2
Definition: labimg.hxx:72
OUString m_aCompZip
Definition: labimg.hxx:90
OUString m_aCompMobile
Definition: labimg.hxx:96
bool m_bCont
Definition: labimg.hxx:63
sal_Int32 m_nRows
Definition: labimg.hxx:57
OUString m_aLstType
Definition: labimg.hxx:44
OUString m_aCompPosition
Definition: labimg.hxx:94
OUString m_aCompCompanyExt
Definition: labimg.hxx:87
OUString m_aLstMake
Definition: labimg.hxx:43
OUString m_aPrivWWW
Definition: labimg.hxx:84
OUString m_aPrivShortCut
Definition: labimg.hxx:70
OUString m_sDBName
Definition: labimg.hxx:45
OUString m_aPrivStreet
Definition: labimg.hxx:74
sal_Int32 m_lPWidth
Definition: labimg.hxx:61
OUString m_aCompStreet
Definition: labimg.hxx:89
sal_Int32 m_lUpper
Definition: labimg.hxx:55
OUString m_aPrivFax
Definition: labimg.hxx:83
OUString m_aPrivFirstName2
Definition: labimg.hxx:71
sal_Int32 m_lPHeight
Definition: labimg.hxx:60
bool m_bAddr
Definition: labimg.hxx:62
OUString m_aPrivShortCut2
Definition: labimg.hxx:73
OUString m_aWriting
Definition: labimg.hxx:47
OUString m_aPrivMail
Definition: labimg.hxx:85
OUString m_aPrivCity
Definition: labimg.hxx:76
OUString m_aPrivCountry
Definition: labimg.hxx:77
OUString m_aPrivProfession
Definition: labimg.hxx:80
OUString m_aPrivMobile
Definition: labimg.hxx:82
OUString m_aCompPhone
Definition: labimg.hxx:95
OUString m_aCompCountry
Definition: labimg.hxx:92
sal_Int32 m_lWidth
Definition: labimg.hxx:52
OUString m_aCompMail
Definition: labimg.hxx:99
sal_Int32 m_lVDist
Definition: labimg.hxx:51
sal_Int32 m_nCols
Definition: labimg.hxx:56
sal_Int32 m_lLeft
Definition: labimg.hxx:54
OUString m_aPrivFirstName
Definition: labimg.hxx:68
OUString m_aCompCity
Definition: labimg.hxx:91
OUString m_aMake
Definition: labimg.hxx:48
OUString m_aPrivState
Definition: labimg.hxx:78
OUString m_aCompCompany
Definition: labimg.hxx:86
sal_Int32 m_lHeight
Definition: labimg.hxx:53
OUString m_aCompFax
Definition: labimg.hxx:97
OUString m_aPrivTitle
Definition: labimg.hxx:79
OUString m_aPrivPhone
Definition: labimg.hxx:81
OUString m_aCompSlogan
Definition: labimg.hxx:88
OUString m_aPrivName
Definition: labimg.hxx:69
OUString m_aCompWWW
Definition: labimg.hxx:98
OUString m_aPrivZip
Definition: labimg.hxx:75
sal_Int32 m_lHDist
Definition: labimg.hxx:50
OUString m_aCompState
Definition: labimg.hxx:93
OUString m_aType
Definition: labimg.hxx:49
std::unique_ptr< weld::ComboBox > m_xTypeBox
Definition: swuilabimp.hxx:43
std::unique_ptr< weld::ComboBox > m_xHiddenSortTypeBox
Definition: swuilabimp.hxx:44
SwLabDlg * GetParentSwLabDlg()
Definition: swuilabimp.hxx:71
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: label1.cxx:469
SwLabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: label1.cxx:210
SwLabItem m_aItem
Definition: swuilabimp.hxx:31
std::unique_ptr< weld::RadioButton > m_xContButton
Definition: swuilabimp.hxx:40
std::unique_ptr< weld::ComboBox > m_xMakeBox
Definition: swuilabimp.hxx:42
std::unique_ptr< weld::Label > m_xFormatInfo
Definition: swuilabimp.hxx:45
SwLabRec * GetSelectedEntryPos()
Definition: label1.cxx:406
void InitDatabaseBox()
Definition: label1.cxx:413
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: label1.cxx:435
std::unique_ptr< weld::RadioButton > m_xSheetButton
Definition: swuilabimp.hxx:41
std::unique_ptr< weld::TextView > m_xWritingEdit
Definition: swuilabimp.hxx:35
std::unique_ptr< weld::ComboBox > m_xTableLB
Definition: swuilabimp.hxx:37
virtual ~SwLabPage() override
Definition: label1.cxx:261
OUString m_sActDBName
Definition: swuilabimp.hxx:30
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: label1.cxx:445
void DisplayFormat()
Definition: label1.cxx:381
SwDBManager * GetDBManager() const
Definition: swuilabimp.hxx:77
std::unique_ptr< weld::CheckButton > m_xAddrBox
Definition: swuilabimp.hxx:34
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: label1.cxx:440
std::unique_ptr< weld::ComboBox > m_xDatabaseLB
Definition: swuilabimp.hxx:36
void FillItem(SwLabItem &rItem)
Definition: label1.cxx:453
virtual void Reset(const SfxItemSet *rSet) override
Definition: label1.cxx:477
std::unique_ptr< weld::ComboBox > m_xDBFieldLB
Definition: swuilabimp.hxx:39
void SetToBusinessCard()
Definition: label1.cxx:265
std::unique_ptr< weld::Button > m_xInsertBT
Definition: swuilabimp.hxx:38
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: labprt.cxx:86
Printer * GetPrt()
Definition: labprt.hxx:61
tools::Long m_nUpper
Definition: labrec.hxx:46
void SetFromItem(const SwLabItem &rItem)
Definition: label1.cxx:38
tools::Long m_nPHeight
Definition: labrec.hxx:48
OUString m_aType
Definition: labrec.hxx:40
bool m_bCont
Definition: labrec.hxx:51
tools::Long m_nLeft
Definition: labrec.hxx:45
tools::Long m_nVDist
Definition: labrec.hxx:42
tools::Long m_nWidth
Definition: labrec.hxx:43
sal_Int32 m_nCols
Definition: labrec.hxx:49
tools::Long m_nPWidth
Definition: labrec.hxx:47
sal_Int32 m_nRows
Definition: labrec.hxx:50
tools::Long m_nHeight
Definition: labrec.hxx:44
tools::Long m_nHDist
Definition: labrec.hxx:41
void FillItem(SwLabItem &rItem) const
Definition: label1.cxx:53
const std::vector< OUString > & GetManufacturers() const
Definition: labelcfg.hxx:50
void FillLabels(const OUString &rManufacturer, SwLabRecs &rLabArr)
Definition: labelcfg.cxx:244
std::unique_ptr< weld::Entry > m_xStreetED
Definition: swuilabimp.hxx:88
std::unique_ptr< weld::Entry > m_xMailED
Definition: swuilabimp.hxx:99
std::unique_ptr< weld::Entry > m_xMobilePhoneED
Definition: swuilabimp.hxx:96
virtual void Reset(const SfxItemSet *rSet) override
Definition: label1.cxx:609
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: label1.cxx:568
std::unique_ptr< weld::Entry > m_xZipED
Definition: swuilabimp.hxx:89
SwPrivateDataPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: label1.cxx:535
std::unique_ptr< weld::Entry > m_xCityED
Definition: swuilabimp.hxx:90
std::unique_ptr< weld::Entry > m_xNameED
Definition: swuilabimp.hxx:83
std::unique_ptr< weld::Entry > m_xPhoneED
Definition: swuilabimp.hxx:95
std::unique_ptr< weld::Entry > m_xShortCutED
Definition: swuilabimp.hxx:84
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: label1.cxx:580
std::unique_ptr< weld::Entry > m_xStateED
Definition: swuilabimp.hxx:92
std::unique_ptr< weld::Entry > m_xProfessionED
Definition: swuilabimp.hxx:94
std::unique_ptr< weld::Entry > m_xHomePageED
Definition: swuilabimp.hxx:98
std::unique_ptr< weld::Entry > m_xFirstNameED
Definition: swuilabimp.hxx:82
std::unique_ptr< weld::Entry > m_xName2ED
Definition: swuilabimp.hxx:86
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: label1.cxx:573
std::unique_ptr< weld::Entry > m_xFirstName2ED
Definition: swuilabimp.hxx:85
virtual ~SwPrivateDataPage() override
Definition: label1.cxx:559
std::unique_ptr< weld::Entry > m_xShortCut2ED
Definition: swuilabimp.hxx:87
std::unique_ptr< weld::Entry > m_xFaxED
Definition: swuilabimp.hxx:97
std::unique_ptr< weld::Entry > m_xTitleED
Definition: swuilabimp.hxx:93
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: label1.cxx:563
std::unique_ptr< weld::Entry > m_xCountryED
Definition: swuilabimp.hxx:91
int nCount
OUString MakeSender()
Definition: envimg.cxx:49
constexpr OStringLiteral HID_BUSINESS_FMT_PAGE_SHEET
Definition: helpids.h:82
constexpr OStringLiteral HID_BUSINESS_FMT_PAGE_TYPE
Definition: helpids.h:84
constexpr OStringLiteral HID_BUSINESS_FMT_PAGE_CONT
Definition: helpids.h:81
constexpr OStringLiteral HID_BUSINESS_FMT_PAGE_BRAND
Definition: helpids.h:83
constexpr OStringLiteral HID_BUSINESS_FMT_PAGE
Definition: helpids.h:80
IMPL_LINK_NOARG(SwLabPage, AddrHdl, weld::Toggleable &, void)
Definition: label1.cxx:274
IMPL_LINK(SwLabPage, DatabaseHdl, weld::ComboBox &, rListBox, void)
Definition: label1.cxx:285
void setfldval(weld::MetricSpinButton &rField, int lValue)
Definition: labimp.hxx:29
std::vector< std::unique_ptr< SwLabRec > > SwLabRecs
Definition: labrec.hxx:54
LineEnd GetSystemLineEnd()
TOOLS_DLLPUBLIC OString convertLineEnd(const OString &rIn, LineEnd eLineEnd)
aStr
SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString &)
int i
long Long
Reference< XNameAccess > m_xContainer
static SfxItemSet & rSet
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:164
#define DB_DELIM
Definition: swtypes.hxx:130
DeactivateRC
SW_DLLPUBLIC FieldUnit GetDfltMetric(bool bWeb)
Definition: uitool.cxx:755
SVT_DLLPUBLIC void SetFieldUnit(weld::MetricSpinButton &rCtrl, FieldUnit eUnit, bool bAll=false)