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/waitobj.hxx>
22 #include <rtl/ustring.hxx>
23 #include <sfx2/sfxsids.hrc>
24 #include <tools/lineend.hxx>
25 #include <com/sun/star/uno/Sequence.h>
26 #include <swtypes.hxx>
27 #include <wrtsh.hxx>
28 #include <initui.hxx>
29 #include <labimp.hxx>
30 #include "labfmt.hxx"
31 #include "labprt.hxx"
32 #include <unotools.hxx>
33 #include <dbmgr.hxx>
34 #include <uitool.hxx>
35 #include <cmdid.h>
36 #include <helpids.h>
37 #include <globals.hrc>
38 #include <strings.hrc>
39 #include <envimg.hxx>
40 
41 void SwLabRec::SetFromItem( const SwLabItem& rItem )
42 {
43  m_nHDist = rItem.m_lHDist;
44  m_nVDist = rItem.m_lVDist;
45  m_nWidth = rItem.m_lWidth;
46  m_nHeight = rItem.m_lHeight;
47  m_nLeft = rItem.m_lLeft;
48  m_nUpper = rItem.m_lUpper;
49  m_nCols = rItem.m_nCols;
50  m_nRows = rItem.m_nRows;
51  m_nPWidth = rItem.m_lPWidth;
52  m_nPHeight = rItem.m_lPHeight;
53  m_bCont = rItem.m_bCont;
54 }
55 
56 void SwLabRec::FillItem( SwLabItem& rItem ) const
57 {
58  rItem.m_lHDist = m_nHDist;
59  rItem.m_lVDist = m_nVDist;
60  rItem.m_lWidth = m_nWidth;
61  rItem.m_lHeight = m_nHeight;
62  rItem.m_lLeft = m_nLeft;
63  rItem.m_lUpper = m_nUpper;
64  rItem.m_nCols = m_nCols;
65  rItem.m_lPWidth = m_nPWidth;
66  rItem.m_lPHeight = m_nPHeight;
67  rItem.m_nRows = m_nRows;
68 }
69 
70 void SwLabDlg::ReplaceGroup_( const OUString &rMake )
71 {
72  // Remove old entries
73  m_pRecs->erase(m_pRecs->begin() + 1, m_pRecs->end());
74  aLabelsCfg.FillLabels(rMake, *m_pRecs);
75  aLstGroup = rMake;
76 }
77 
78 void SwLabDlg::PageCreated(const OString &rId, SfxTabPage &rPage)
79 {
80  if (rId == "labels")
81  {
82  if (m_bLabel)
83  {
84  static_cast<SwLabPage*>(&rPage)->SetDBManager(pDBManager);
85  static_cast<SwLabPage*>(&rPage)->InitDatabaseBox();
86  }
87  else
88  static_cast<SwLabPage*>(&rPage)->SetToBusinessCard();
89  }
90  else if (rId == "options")
91  pPrtPage = static_cast<SwLabPrtPage*>(&rPage);
92 }
93 
95  SwDBManager* pDBManager_, bool bLabel)
96  : SfxTabDialogController(pParent, "modules/swriter/ui/labeldialog.ui", "LabelDialog", &rSet)
97  , pDBManager(pDBManager_)
98  , pPrtPage(nullptr)
99  , aTypeIds(50, 10)
100  , m_pRecs(new SwLabRecs)
101  , m_bLabel(bLabel)
102 {
103  weld::WaitObject aWait(pParent);
104 
105  // Read user label from writer.cfg
106  SwLabItem aItem(static_cast<const SwLabItem&>(rSet.Get( FN_LABEL )));
107  std::unique_ptr<SwLabRec> pRec(new SwLabRec);
108  pRec->m_aMake = pRec->m_aType = SwResId(STR_CUSTOM_LABEL);
109  pRec->SetFromItem( aItem );
110 
111  bool bDouble = false;
112 
113  for (std::unique_ptr<SwLabRec> & i : *m_pRecs)
114  {
115  if (pRec->m_aMake == i->m_aMake &&
116  pRec->m_aType == i->m_aType)
117  {
118  bDouble = true;
119  break;
120  }
121  }
122 
123  if (!bDouble)
124  m_pRecs->insert( m_pRecs->begin(), std::move(pRec));
125 
126  size_t nLstGroup = 0;
127  const std::vector<OUString>& rMan = aLabelsCfg.GetManufacturers();
128  for(size_t nMan = 0; nMan < rMan.size(); ++nMan)
129  {
130  aMakes.push_back(rMan[nMan]);
131  if ( rMan[nMan] == aItem.m_aLstMake )
132  nLstGroup = nMan;
133  }
134 
135  if ( !aMakes.empty() )
136  ReplaceGroup_( aMakes[nLstGroup] );
137 
138  if (m_xExampleSet)
139  m_xExampleSet->Put(aItem);
140 
141  AddTabPage("format", SwLabFormatPage::Create, nullptr);
142  AddTabPage("options", SwLabPrtPage::Create, nullptr);
143  m_sBusinessCardDlg = SwResId(STR_BUSINESS_CARDS);
144 
145  if (m_bLabel)
146  {
147  RemoveTabPage("business");
148  RemoveTabPage("private");
149  RemoveTabPage("medium");
150  AddTabPage("labels", SwLabPage::Create, nullptr);
151  }
152  else
153  {
154  RemoveTabPage("labels");
155  AddTabPage("medium", SwLabPage::Create, nullptr);
156  AddTabPage("business", SwBusinessDataPage::Create, nullptr );
157  AddTabPage("private", SwPrivateDataPage::Create, nullptr);
158  m_xDialog->set_title(m_sBusinessCardDlg);
159  }
160 
161  pParent->set_busy_cursor(false);
162 }
163 
165 {
166  m_pRecs.reset();
167 }
168 
170 {
171  const SwLabItem& rActItem = static_cast<const SwLabItem&>(GetExampleSet()->Get(FN_LABEL));
172  const SwLabItem& rOldItem = static_cast<const SwLabItem&>(GetInputSetImpl()->Get(FN_LABEL));
173 
174  if (rActItem != rOldItem)
175  {
176  // Was already "put" with (hopefully) correct content
177  rItem = rActItem;
178  }
179  else
180  {
181  rItem = rOldItem;
182 
183  // In rItem there are only settings defined by users.
184  // Therefore get the real settings directly from Record
185  SwLabRec* pRec = GetRecord(rItem.m_aType, rItem.m_bCont);
186  pRec->FillItem( rItem );
187  }
188 }
189 
190 SwLabRec* SwLabDlg::GetRecord(const OUString &rRecName, bool bCont)
191 {
192  SwLabRec* pRec = nullptr;
193  bool bFound = false;
194  const OUString sCustom(SwResId(STR_CUSTOM_LABEL));
195 
196  const size_t nCount = Recs().size();
197  for (size_t i = 0; i < nCount; ++i)
198  {
199  pRec = Recs()[i].get();
200  if (pRec->m_aType != sCustom &&
201  rRecName == pRec->m_aType && bCont == pRec->m_bCont)
202  {
203  bFound = true;
204  break;
205  }
206  }
207  if (!bFound) // User defined
208  pRec = Recs()[0].get();
209 
210  return pRec;
211 }
212 
214 {
215  if (pPrtPage)
216  return pPrtPage->GetPrt();
217  else
218  return nullptr;
219 }
220 
222  : SfxTabPage(pParent, "modules/swriter/ui/cardmediumpage.ui", "CardMediumPage", &rSet)
223  , pDBManager(nullptr)
224  , aItem(static_cast<const SwLabItem&>(rSet.Get(FN_LABEL)))
225  , m_xAddressFrame(m_xBuilder->weld_widget("addressframe"))
226  , m_xAddrBox(m_xBuilder->weld_check_button("address"))
227  , m_xWritingEdit(m_xBuilder->weld_text_view("textview"))
228  , m_xDatabaseLB(m_xBuilder->weld_combo_box("database"))
229  , m_xTableLB(m_xBuilder->weld_combo_box("table"))
230  , m_xInsertBT(m_xBuilder->weld_button("insert"))
231  , m_xDBFieldLB(m_xBuilder->weld_combo_box("field"))
232  , m_xContButton(m_xBuilder->weld_radio_button("continuous"))
233  , m_xSheetButton(m_xBuilder->weld_radio_button("sheet"))
234  , m_xMakeBox(m_xBuilder->weld_combo_box("brand"))
235  , m_xTypeBox(m_xBuilder->weld_combo_box("type"))
236  , m_xHiddenSortTypeBox(m_xBuilder->weld_combo_box("hiddentype"))
237  , m_xFormatInfo(m_xBuilder->weld_label("formatinfo"))
238 {
239  WaitObject aWait(pParent.pParent);
240 
241  m_xWritingEdit->set_size_request(m_xWritingEdit->get_approximate_digit_width() * 30,
242  m_xWritingEdit->get_height_rows(10));
243  m_xHiddenSortTypeBox->make_sorted();
244 
245  long nListBoxWidth = m_xWritingEdit->get_approximate_digit_width() * 25;
246  m_xTableLB->set_size_request(nListBoxWidth, -1);
247  m_xDatabaseLB->set_size_request(nListBoxWidth, -1);
248  m_xDBFieldLB->set_size_request(nListBoxWidth, -1);
249 
251 
252  // Install handlers
253  m_xAddrBox->connect_toggled(LINK(this, SwLabPage, AddrHdl));
254  m_xDatabaseLB->connect_changed(LINK(this, SwLabPage, DatabaseHdl));
255  m_xTableLB->connect_changed(LINK(this, SwLabPage, DatabaseHdl));
256  m_xDBFieldLB->connect_changed(LINK(this, SwLabPage, DatabaseHdl));
257  m_xInsertBT->connect_clicked(LINK(this, SwLabPage, FieldHdl));
258  // Disable insert button first,
259  // it'll be enabled if m_xDatabaseLB, m_pTableLB and m_pInsertBT are filled
260  m_xInsertBT->set_sensitive(false);
261  m_xContButton->connect_toggled(LINK(this, SwLabPage, PageHdl));
262  m_xSheetButton->connect_toggled(LINK(this, SwLabPage, PageHdl));
263  auto nMaxWidth = m_xMakeBox->get_approximate_digit_width() * 32;
264  m_xMakeBox->set_size_request(nMaxWidth, -1);
265  m_xTypeBox->set_size_request(nMaxWidth, -1);
266  m_xMakeBox->connect_changed(LINK(this, SwLabPage, MakeHdl));
267  m_xTypeBox->connect_changed(LINK(this, SwLabPage, TypeHdl));
268 
269  InitDatabaseBox();
270 }
271 
273 {
274 }
275 
277 {
278  m_xContainer->set_help_id(HID_BUSINESS_FMT_PAGE);
283  m_xAddressFrame->hide();
284 };
285 
287 {
288  OUString aWriting;
289 
290  if (m_xAddrBox->get_active())
291  aWriting = convertLineEnd(MakeSender(), GetSystemLineEnd());
292 
293  m_xWritingEdit->set_text(aWriting);
294  m_xWritingEdit->grab_focus();
295 }
296 
297 IMPL_LINK( SwLabPage, DatabaseHdl, weld::ComboBox&, rListBox, void )
298 {
299  sActDBName = m_xDatabaseLB->get_active_text();
300 
301  weld::WaitObject aObj(GetParentSwLabDlg()->getDialog());
302 
303  if (&rListBox == m_xDatabaseLB.get())
304  GetDBManager()->GetTableNames(*m_xTableLB, sActDBName);
305 
306  if (&rListBox == m_xDatabaseLB.get() || &rListBox == m_xTableLB.get())
307  GetDBManager()->GetColumnNames(*m_xDBFieldLB, sActDBName, m_xTableLB->get_active_text());
308 
309  if (!m_xDatabaseLB->get_active_text().isEmpty() && !m_xTableLB->get_active_text().isEmpty()
310  && !m_xDBFieldLB->get_active_text().isEmpty())
311  m_xInsertBT->set_sensitive(true);
312  else
313  m_xInsertBT->set_sensitive(false);
314 }
315 
317 {
318  OUString aStr("<" + m_xDatabaseLB->get_active_text() + "." +
319  m_xTableLB->get_active_text() + "." +
320  m_xTableLB->get_active_id() + "." +
321  m_xDBFieldLB->get_active_text() + ">");
322  m_xWritingEdit->replace_selection(aStr);
323  int nStartPos, nEndPos;
324  m_xWritingEdit->get_selection_bounds(nStartPos, nEndPos);
325  m_xWritingEdit->grab_focus();
326  m_xWritingEdit->select_region(nStartPos, nEndPos);
327 }
328 
330 {
331  MakeHdl(*m_xMakeBox);
332 }
333 
335 {
336  weld::WaitObject aWait(GetParentSwLabDlg()->getDialog());
337 
338  m_xTypeBox->clear();
339  m_xHiddenSortTypeBox->clear();
340  GetParentSwLabDlg()->TypeIds().clear();
341 
342  const OUString aMake = m_xMakeBox->get_active_text();
343  GetParentSwLabDlg()->ReplaceGroup( aMake );
344  aItem.m_aLstMake = aMake;
345 
346  const bool bCont = m_xContButton->get_active();
347  const size_t nCount = GetParentSwLabDlg()->Recs().size();
348  size_t nLstType = 0;
349 
350  const OUString sCustom(SwResId(STR_CUSTOM_LABEL));
351  //insert the entries into the sorted list box
352  for ( size_t i = 0; i < nCount; ++i )
353  {
354  const OUString aType(GetParentSwLabDlg()->Recs()[i]->m_aType);
355  bool bInsert = false;
356  if (GetParentSwLabDlg()->Recs()[i]->m_aType == sCustom)
357  {
358  bInsert = true;
359  m_xTypeBox->append_text(aType );
360  }
361  else if (GetParentSwLabDlg()->Recs()[i]->m_bCont == bCont)
362  {
363  if (m_xHiddenSortTypeBox->find_text(aType) == -1)
364  {
365  bInsert = true;
366  m_xHiddenSortTypeBox->append_text( aType );
367  }
368  }
369  if(bInsert)
370  {
371  GetParentSwLabDlg()->TypeIds().push_back(i);
372  if ( !nLstType && aType == aItem.m_aLstType )
373  nLstType = GetParentSwLabDlg()->TypeIds().size();
374  }
375  }
376  for (int nEntry = 0; nEntry < m_xHiddenSortTypeBox->get_count(); ++nEntry)
377  {
378  m_xTypeBox->append_text(m_xHiddenSortTypeBox->get_text(nEntry));
379  }
380  if (nLstType)
381  m_xTypeBox->set_active_text(aItem.m_aLstType);
382  else
383  m_xTypeBox->set_active(0);
384  TypeHdl(*m_xTypeBox);
385 }
386 
388 {
389  DisplayFormat();
390  aItem.m_aType = m_xTypeBox->get_active_text();
391 }
392 
394 {
396  FieldUnit aMetric = ::GetDfltMetric(false);
397  SetMetric(*aField, aMetric);
398  aField->SetDecimalDigits(2);
399  aField->SetMin (0);
400  aField->SetMax (LONG_MAX);
401 
402  SwLabRec* pRec = GetSelectedEntryPos();
403  aItem.m_aLstType = pRec->m_aType;
404  SETFLDVAL(*aField, pRec->m_nWidth);
405  aField->Reformat();
406  const OUString aWString = aField->GetText();
407 
408  SETFLDVAL(*aField, pRec->m_nHeight);
409  aField->Reformat();
410 
411  OUString aText = pRec->m_aType + ": " + aWString +
412  " x " + aField->GetText() +
413  " (" + OUString::number( pRec->m_nCols ) +
414  " x " + OUString::number( pRec->m_nRows ) + ")";
415  m_xFormatInfo->set_label(aText);
416 }
417 
419 {
420  OUString sSelEntry(m_xTypeBox->get_active_text());
421 
422  return GetParentSwLabDlg()->GetRecord(sSelEntry, m_xContButton->get_active());
423 }
424 
426 {
427  if( GetDBManager() )
428  {
429  m_xDatabaseLB->clear();
430  css::uno::Sequence<OUString> aDataNames = SwDBManager::GetExistingDatabaseNames();
431  const OUString* pDataNames = aDataNames.getConstArray();
432  for (long i = 0; i < aDataNames.getLength(); i++)
433  m_xDatabaseLB->append_text(pDataNames[i]);
434  sal_Int32 nIdx{ 0 };
435  OUString sDBName = sActDBName.getToken( 0, DB_DELIM, nIdx );
436  OUString sTableName = sActDBName.getToken( 0, DB_DELIM, nIdx );
437  m_xDatabaseLB->set_active_text(sDBName);
438  if( !sDBName.isEmpty() && GetDBManager()->GetTableNames(*m_xTableLB, sDBName))
439  {
440  m_xTableLB->set_active_text(sTableName);
442  }
443  else
444  m_xDBFieldLB->clear();
445  }
446 }
447 
449 {
450  return VclPtr<SwLabPage>::Create(pParent, *rSet);
451 }
452 
454 {
455  Reset( &rSet );
456 }
457 
459 {
460  if (_pSet)
461  FillItemSet(_pSet);
462 
463  return DeactivateRC::LeavePage;
464 }
465 
467 {
468  rItem.m_bAddr = m_xAddrBox->get_active();
469  rItem.m_aWriting = m_xWritingEdit->get_text();
470  rItem.m_bCont = m_xContButton->get_active();
471  rItem.m_aMake = m_xMakeBox->get_active_text();
472  rItem.m_aType = m_xTypeBox->get_active_text();
473  rItem.m_sDBName = sActDBName;
474 
475  SwLabRec* pRec = GetSelectedEntryPos();
476  pRec->FillItem( rItem );
477 
478  rItem.m_aLstMake = m_xMakeBox->get_active_text();
479  rItem.m_aLstType = m_xTypeBox->get_active_text();
480 }
481 
483 {
484  FillItem( aItem );
485  rSet->Put( aItem );
486 
487  return true;
488 }
489 
490 void SwLabPage::Reset(const SfxItemSet* rSet)
491 {
492  m_xMakeBox->clear();
493 
494  size_t nLstGroup = 0;
495 
496  const size_t nCount = GetParentSwLabDlg()->Makes().size();
497  for(size_t i = 0; i < nCount; ++i)
498  {
499  OUString& rStr = GetParentSwLabDlg()->Makes()[i];
500  m_xMakeBox->append_text(rStr);
501 
502  if ( rStr == aItem.m_aLstMake)
503  nLstGroup = i;
504  }
505 
506  m_xMakeBox->set_active( nLstGroup );
507  MakeHdl(*m_xMakeBox);
508 
509  aItem = static_cast<const SwLabItem&>( rSet->Get(FN_LABEL));
510  OUString sDBName = aItem.m_sDBName;
511 
512  OUString aWriting(convertLineEnd(aItem.m_aWriting, GetSystemLineEnd()));
513 
514  m_xAddrBox->set_active( aItem.m_bAddr );
515  m_xWritingEdit->set_text( aWriting );
516 
517  for(const auto& rMake : GetParentSwLabDlg()->Makes())
518  {
519  if (m_xMakeBox->find_text(rMake) == -1)
520  m_xMakeBox->append_text(rMake);
521  }
522 
523  m_xMakeBox->set_active_text(aItem.m_aMake);
524  //save the current type
525  OUString sType(aItem.m_aType);
526  MakeHdl(*m_xMakeBox);
527  aItem.m_aType = sType;
528  //#102806# a newly added make may not be in the type ListBox already
529  if (m_xTypeBox->find_text(aItem.m_aType) == -1 && !aItem.m_aMake.isEmpty())
531  if (m_xTypeBox->find_text(aItem.m_aType) != -1)
532  {
533  m_xTypeBox->set_active_text(aItem.m_aType);
534  TypeHdl(*m_xTypeBox);
535  }
536  if (m_xDatabaseLB->find_text(sDBName) != -1)
537  {
538  m_xDatabaseLB->set_active_text(sDBName);
539  DatabaseHdl(*m_xDatabaseLB);
540  }
541 
542  if (aItem.m_bCont)
543  m_xContButton->set_active(true);
544  else
545  m_xSheetButton->set_active(true);
546 }
547 
549  : SfxTabPage(pParent, "modules/swriter/ui/privateuserpage.ui", "PrivateUserPage", &rSet)
550  , m_xFirstNameED(m_xBuilder->weld_entry("firstname"))
551  , m_xNameED(m_xBuilder->weld_entry("lastname"))
552  , m_xShortCutED(m_xBuilder->weld_entry("shortname"))
553  , m_xFirstName2ED(m_xBuilder->weld_entry("firstname2"))
554  , m_xName2ED(m_xBuilder->weld_entry("lastname2"))
555  , m_xShortCut2ED(m_xBuilder->weld_entry("shortname2"))
556  , m_xStreetED(m_xBuilder->weld_entry("street"))
557  , m_xZipED(m_xBuilder->weld_entry("izip"))
558  , m_xCityED(m_xBuilder->weld_entry("icity"))
559  , m_xCountryED(m_xBuilder->weld_entry("country"))
560  , m_xStateED(m_xBuilder->weld_entry("state"))
561  , m_xTitleED(m_xBuilder->weld_entry("title"))
562  , m_xProfessionED(m_xBuilder->weld_entry("job"))
563  , m_xPhoneED(m_xBuilder->weld_entry("phone"))
564  , m_xMobilePhoneED(m_xBuilder->weld_entry("mobile"))
565  , m_xFaxED(m_xBuilder->weld_entry("fax"))
566  , m_xHomePageED(m_xBuilder->weld_entry("url"))
567  , m_xMailED(m_xBuilder->weld_entry("email"))
568 {
570 }
571 
573 {
574 }
575 
577 {
578  return VclPtr<SwPrivateDataPage>::Create(pParent, *rSet);
579 }
580 
582 {
583  Reset(&rSet);
584 }
585 
587 {
588  if (_pSet)
589  FillItemSet(_pSet);
590  return DeactivateRC::LeavePage;
591 }
592 
594 {
595  const SfxItemSet* pExampleSet = GetDialogExampleSet();
596  assert(pExampleSet);
597  SwLabItem aItem = static_cast<const SwLabItem&>(pExampleSet->Get(FN_LABEL));
598 
599  aItem.m_aPrivFirstName = m_xFirstNameED->get_text();
600  aItem.m_aPrivName = m_xNameED->get_text();
601  aItem.m_aPrivShortCut = m_xShortCutED->get_text();
602  aItem.m_aPrivFirstName2 = m_xFirstName2ED->get_text();
603  aItem.m_aPrivName2 = m_xName2ED->get_text();
604  aItem.m_aPrivShortCut2 = m_xShortCut2ED->get_text();
605  aItem.m_aPrivStreet = m_xStreetED->get_text();
606  aItem.m_aPrivZip = m_xZipED->get_text();
607  aItem.m_aPrivCity = m_xCityED->get_text();
608  aItem.m_aPrivCountry = m_xCountryED->get_text();
609  aItem.m_aPrivState = m_xStateED->get_text();
610  aItem.m_aPrivTitle = m_xTitleED->get_text();
611  aItem.m_aPrivProfession= m_xProfessionED->get_text();
612  aItem.m_aPrivPhone = m_xPhoneED->get_text();
613  aItem.m_aPrivMobile = m_xMobilePhoneED->get_text();
614  aItem.m_aPrivFax = m_xFaxED->get_text();
615  aItem.m_aPrivWWW = m_xHomePageED->get_text();
616  aItem.m_aPrivMail = m_xMailED->get_text();
617 
618  rSet->Put(aItem);
619  return true;
620 }
621 
623 {
624  const SwLabItem& aItem = static_cast<const SwLabItem&>( rSet->Get(FN_LABEL) );
625  m_xFirstNameED->set_text(aItem.m_aPrivFirstName);
626  m_xNameED->set_text(aItem.m_aPrivName);
627  m_xShortCutED->set_text(aItem.m_aPrivShortCut);
628  m_xFirstName2ED->set_text(aItem.m_aPrivFirstName2);
629  m_xName2ED->set_text(aItem.m_aPrivName2);
630  m_xShortCut2ED->set_text(aItem.m_aPrivShortCut2);
631  m_xStreetED->set_text(aItem.m_aPrivStreet);
632  m_xZipED->set_text(aItem.m_aPrivZip);
633  m_xCityED->set_text(aItem.m_aPrivCity);
634  m_xCountryED->set_text(aItem.m_aPrivCountry);
635  m_xStateED->set_text(aItem.m_aPrivState);
636  m_xTitleED->set_text(aItem.m_aPrivTitle);
637  m_xProfessionED->set_text(aItem.m_aPrivProfession);
638  m_xPhoneED->set_text(aItem.m_aPrivPhone);
639  m_xMobilePhoneED->set_text(aItem.m_aPrivMobile);
640  m_xFaxED->set_text(aItem.m_aPrivFax);
641  m_xHomePageED->set_text(aItem.m_aPrivWWW);
642  m_xMailED->set_text(aItem.m_aPrivMail);
643 }
644 
646  : SfxTabPage(pParent, "modules/swriter/ui/businessdatapage.ui", "BusinessDataPage", &rSet)
647  , m_xCompanyED(m_xBuilder->weld_entry("company"))
648  , m_xCompanyExtED(m_xBuilder->weld_entry("company2"))
649  , m_xSloganED(m_xBuilder->weld_entry("slogan"))
650  , m_xStreetED(m_xBuilder->weld_entry("street"))
651  , m_xZipED(m_xBuilder->weld_entry("izip"))
652  , m_xCityED(m_xBuilder->weld_entry("icity"))
653  , m_xCountryED(m_xBuilder->weld_entry("country"))
654  , m_xStateED(m_xBuilder->weld_entry("state"))
655  , m_xPositionED(m_xBuilder->weld_entry("position"))
656  , m_xPhoneED(m_xBuilder->weld_entry("phone"))
657  , m_xMobilePhoneED(m_xBuilder->weld_entry("mobile"))
658  , m_xFaxED(m_xBuilder->weld_entry("fax"))
659  , m_xHomePageED(m_xBuilder->weld_entry("url"))
660  , m_xMailED(m_xBuilder->weld_entry("email"))
661 {
663 }
664 
666 {
667 }
668 
670 {
671  return VclPtr<SwBusinessDataPage>::Create(pParent, *rSet);
672 }
673 
675 {
676  Reset(&rSet);
677 }
678 
680 {
681  if (_pSet)
682  FillItemSet(_pSet);
683  return DeactivateRC::LeavePage;
684 }
685 
687 {
688  const SfxItemSet* pExampleSet = GetDialogExampleSet();
689  assert(pExampleSet);
690  SwLabItem aItem = static_cast<const SwLabItem&>(pExampleSet->Get(FN_LABEL));
691 
692  aItem.m_aCompCompany = m_xCompanyED->get_text();
693  aItem.m_aCompCompanyExt= m_xCompanyExtED->get_text();
694  aItem.m_aCompSlogan = m_xSloganED->get_text();
695  aItem.m_aCompStreet = m_xStreetED->get_text();
696  aItem.m_aCompZip = m_xZipED->get_text();
697  aItem.m_aCompCity = m_xCityED->get_text();
698  aItem.m_aCompCountry = m_xCountryED->get_text();
699  aItem.m_aCompState = m_xStateED->get_text();
700  aItem.m_aCompPosition = m_xPositionED->get_text();
701  aItem.m_aCompPhone = m_xPhoneED->get_text();
702  aItem.m_aCompMobile = m_xMobilePhoneED->get_text();
703  aItem.m_aCompFax = m_xFaxED->get_text();
704  aItem.m_aCompWWW = m_xHomePageED->get_text();
705  aItem.m_aCompMail = m_xMailED->get_text();
706 
707  rSet->Put(aItem);
708  return true;
709 }
710 
712 {
713  const SwLabItem& aItem = static_cast<const SwLabItem&>( rSet->Get(FN_LABEL) );
714  m_xCompanyED->set_text(aItem.m_aCompCompany);
715  m_xCompanyExtED->set_text(aItem.m_aCompCompanyExt);
716  m_xSloganED->set_text(aItem.m_aCompSlogan);
717  m_xStreetED->set_text(aItem.m_aCompStreet);
718  m_xZipED->set_text(aItem.m_aCompZip);
719  m_xCityED->set_text(aItem.m_aCompCity);
720  m_xCountryED->set_text(aItem.m_aCompCountry);
721  m_xStateED->set_text(aItem.m_aCompState);
722  m_xPositionED->set_text(aItem.m_aCompPosition);
723  m_xPhoneED->set_text(aItem.m_aCompPhone);
724  m_xMobilePhoneED->set_text(aItem.m_aCompMobile);
725  m_xFaxED->set_text(aItem.m_aCompFax);
726  m_xHomePageED->set_text(aItem.m_aCompWWW);
727  m_xMailED->set_text(aItem.m_aCompMail);
728 }
729 
730 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void GetColumnNames(ListBox *pListBox, const OUString &rDBName, const OUString &rTableName)
Fill listbox with all column names of a database table.
Definition: dbmgr.cxx:754
OUString m_aMake
Definition: labimg.hxx:48
long m_nHDist
Definition: labrec.hxx:38
OUString m_aCompStreet
Definition: labimg.hxx:89
FieldUnit
OUString m_aPrivCity
Definition: labimg.hxx:76
std::unique_ptr< weld::Entry > m_xCompanyED
Definition: swuilabimp.hxx:119
sal_Int32 m_lHeight
Definition: labimg.hxx:53
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: label1.cxx:458
long m_nHeight
Definition: labrec.hxx:41
TOOLS_DLLPUBLIC OString convertLineEnd(const OString &rIn, LineEnd eLineEnd)
sal_Int32 m_nRows
Definition: labrec.hxx:47
OUString m_aCompSlogan
Definition: labimg.hxx:88
#define HID_BUSINESS_FMT_PAGE_SHEET
Definition: helpids.h:103
#define SETFLDVAL(rField, lValue)
Definition: labimp.hxx:27
SwBusinessDataPage(TabPageParent pParent, const SfxItemSet &rSet)
Definition: label1.cxx:645
sal_Int32 m_lVDist
Definition: labimg.hxx:51
Printer * GetPrt()
Definition: label1.cxx:213
SwLabRec * GetSelectedEntryPos()
Definition: label1.cxx:418
bool m_bAddr
Definition: labimg.hxx:62
virtual void Reformat() override
std::unique_ptr< weld::Widget > m_xAddressFrame
Definition: swuilabimp.hxx:32
bool GetTableNames(weld::ComboBox &rBox, const OUString &rDBName)
Fill listbox with all table names of a database.
Definition: dbmgr.cxx:712
std::unique_ptr< weld::Entry > m_xStreetED
Definition: swuilabimp.hxx:89
OUString m_aPrivTitle
Definition: labimg.hxx:79
std::unique_ptr< weld::Entry > m_xZipED
Definition: swuilabimp.hxx:123
void FillItem(SwLabItem &rItem)
Definition: label1.cxx:466
sal_Int32 m_lLeft
Definition: labimg.hxx:54
void SetMin(sal_Int64 nNewMin, FieldUnit eInUnit)
std::unique_ptr< weld::ComboBox > m_xDBFieldLB
Definition: swuilabimp.hxx:38
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: label1.cxx:674
long m_nWidth
Definition: labrec.hxx:40
std::unique_ptr< weld::Entry > m_xCompanyExtED
Definition: swuilabimp.hxx:120
std::unique_ptr< weld::TextView > m_xWritingEdit
Definition: swuilabimp.hxx:34
std::unique_ptr< weld::ComboBox > m_xHiddenSortTypeBox
Definition: swuilabimp.hxx:43
std::unique_ptr< SfxItemSet > m_xExampleSet
void RemoveTabPage(const OString &rName)
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: label1.cxx:586
std::unique_ptr< weld::ComboBox > m_xMakeBox
Definition: swuilabimp.hxx:41
void DisplayFormat()
Definition: label1.cxx:393
std::unique_ptr< weld::CheckButton > m_xAddrBox
Definition: swuilabimp.hxx:33
OUString sActDBName
Definition: swuilabimp.hxx:29
void SetMax(sal_Int64 nNewMax, FieldUnit eInUnit)
SwLabItem aItem
Definition: swuilabimp.hxx:30
SfxItemSet * GetInputSetImpl()
std::unique_ptr< weld::ComboBox > m_xTypeBox
Definition: swuilabimp.hxx:42
OUString m_aCompCity
Definition: labimg.hxx:91
virtual ~SwLabPage() override
Definition: label1.cxx:272
OUString m_aPrivPhone
Definition: labimg.hxx:81
std::unique_ptr< weld::Entry > m_xPositionED
Definition: swuilabimp.hxx:127
OUString m_aCompMobile
Definition: labimg.hxx:96
OUString m_aPrivMobile
Definition: labimg.hxx:82
OUString m_aLstType
Definition: labimg.hxx:44
static VclPtr< SfxTabPage > Create(TabPageParent pParent, const SfxItemSet *rSet)
Definition: labprt.cxx:95
sal_Int32 m_lUpper
Definition: labimg.hxx:55
OUString m_aPrivMail
Definition: labimg.hxx:85
bool const m_bLabel
Definition: label.hxx:44
OUString m_aCompCompanyExt
Definition: labimg.hxx:87
OUString m_aPrivWWW
Definition: labimg.hxx:84
virtual void Reset(const SfxItemSet *rSet) override
Definition: label1.cxx:622
static css::uno::Sequence< OUString > GetExistingDatabaseNames()
Definition: dbmgr.cxx:2614
sal_Int32 m_lPWidth
Definition: labimg.hxx:61
long m_nLeft
Definition: labrec.hxx:42
sal_Int64 WinBits
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: label1.cxx:453
OUString m_aPrivShortCut2
Definition: labimg.hxx:73
static VclPtr< SfxTabPage > Create(TabPageParent pParent, const SfxItemSet *rSet)
Definition: label1.cxx:669
static VclPtr< SfxTabPage > Create(TabPageParent pParent, const SfxItemSet *rSet)
Definition: label1.cxx:448
bool m_bCont
Definition: labrec.hxx:48
std::unique_ptr< weld::Entry > m_xShortCutED
Definition: swuilabimp.hxx:85
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: label1.cxx:581
void SetExchangeSupport()
OUString m_aPrivStreet
Definition: labimg.hxx:74
LineEnd GetSystemLineEnd()
std::unique_ptr< weld::Entry > m_xMobilePhoneED
Definition: swuilabimp.hxx:129
std::unique_ptr< weld::Entry > m_xName2ED
Definition: swuilabimp.hxx:87
OUString m_aPrivProfession
Definition: labimg.hxx:80
long m_nVDist
Definition: labrec.hxx:39
bool m_bCont
Definition: labimg.hxx:63
VclPtr< SwLabPrtPage > pPrtPage
Definition: label.hxx:36
IMPL_LINK_NOARG(SwLabPage, AddrHdl, weld::ToggleButton &, void)
Definition: label1.cxx:286
void InitDatabaseBox()
Definition: label1.cxx:425
void SetFromItem(const SwLabItem &rItem)
Definition: label1.cxx:41
OUString m_aCompZip
Definition: labimg.hxx:90
OUString m_aPrivState
Definition: labimg.hxx:78
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: label1.cxx:593
OUString m_aPrivFax
Definition: labimg.hxx:83
virtual ~SwBusinessDataPage() override
Definition: label1.cxx:665
SwDBManager * GetDBManager() const
Definition: swuilabimp.hxx:78
OUString m_aPrivCountry
Definition: labimg.hxx:77
#define HID_BUSINESS_FMT_PAGE_BRAND
Definition: helpids.h:104
OUString m_aPrivZip
Definition: labimg.hxx:75
std::unique_ptr< weld::Entry > m_xShortCut2ED
Definition: swuilabimp.hxx:88
void ReplaceGroup_(const OUString &rMake)
Definition: label1.cxx:70
std::unique_ptr< weld::Button > m_xInsertBT
Definition: swuilabimp.hxx:37
std::unique_ptr< weld::Entry > m_xCityED
Definition: swuilabimp.hxx:91
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: label1.cxx:686
std::unique_ptr< weld::Entry > m_xStreetED
Definition: swuilabimp.hxx:122
std::unique_ptr< weld::Entry > m_xZipED
Definition: swuilabimp.hxx:90
std::vector< OUString > & Makes()
Definition: label.hxx:63
virtual void Reset(const SfxItemSet *rSet) override
Definition: label1.cxx:490
VclPtr< vcl::Window > pParent
std::unique_ptr< weld::Entry > m_xNameED
Definition: swuilabimp.hxx:84
SW_DLLPUBLIC FieldUnit GetDfltMetric(bool bWeb)
Definition: uitool.cxx:691
OUString m_aPrivFirstName2
Definition: labimg.hxx:71
static VclPtr< SfxTabPage > Create(TabPageParent pParent, const SfxItemSet *rSet)
Definition: labfmt.cxx:405
long m_nPWidth
Definition: labrec.hxx:44
SwDBManager *const pDBManager
Definition: label.hxx:35
sal_Int32 m_lHDist
Definition: labimg.hxx:50
void SetToBusinessCard()
Definition: label1.cxx:276
int i
Printer * GetPrt()
Definition: labprt.hxx:60
virtual ~SwPrivateDataPage() override
Definition: label1.cxx:572
sal_Int32 m_nRows
Definition: labimg.hxx:57
std::unique_ptr< weld::Entry > m_xProfessionED
Definition: swuilabimp.hxx:95
virtual OUString GetText() const override
std::unique_ptr< weld::Entry > m_xPhoneED
Definition: swuilabimp.hxx:96
std::unique_ptr< weld::Entry > m_xCountryED
Definition: swuilabimp.hxx:125
OUString m_aType
Definition: labimg.hxx:49
OUString m_aCompFax
Definition: labimg.hxx:97
std::unique_ptr< weld::Entry > m_xFirstNameED
Definition: swuilabimp.hxx:83
sal_Int32 m_nCols
Definition: labimg.hxx:56
#define HID_BUSINESS_FMT_PAGE_TYPE
Definition: helpids.h:105
OUString m_aCompWWW
Definition: labimg.hxx:98
OUString m_aCompPhone
Definition: labimg.hxx:95
OUString SwResId(const char *pId)
Definition: swmodule.cxx:191
std::unique_ptr< weld::Entry > m_xCityED
Definition: swuilabimp.hxx:124
OUString m_sBusinessCardDlg
Definition: label.hxx:43
OUString MakeSender()
Definition: envimg.cxx:49
SW_DLLPUBLIC void SetMetric(MetricFormatter &rCtrl, FieldUnit eUnit)
Definition: uitool.cxx:90
void FillLabels(const OUString &rManufacturer, SwLabRecs &rLabArr)
Definition: labelcfg.cxx:254
OUString m_aPrivShortCut
Definition: labimg.hxx:70
OUString m_aCompMail
Definition: labimg.hxx:99
virtual void Reset(const SfxItemSet *rSet) override
Definition: label1.cxx:711
#define DB_DELIM
Definition: swtypes.hxx:141
const SfxItemSet * GetDialogExampleSet() const
#define HID_BUSINESS_FMT_PAGE
Definition: helpids.h:101
sal_Int32 m_lPHeight
Definition: labimg.hxx:60
const long LONG_MAX
std::unique_ptr< weld::RadioButton > m_xContButton
Definition: swuilabimp.hxx:39
#define HID_BUSINESS_FMT_PAGE_CONT
Definition: helpids.h:102
std::unique_ptr< SwLabRecs > m_pRecs
Definition: label.hxx:41
sal_Int32 m_nCols
Definition: labrec.hxx:46
SwLabDlg * GetParentSwLabDlg()
Definition: swuilabimp.hxx:72
std::unique_ptr< weld::Entry > m_xMobilePhoneED
Definition: swuilabimp.hxx:97
OUString m_aType
Definition: labrec.hxx:37
const std::vector< OUString > & GetManufacturers() const
Definition: labelcfg.hxx:50
std::unique_ptr< weld::Entry > m_xFaxED
Definition: swuilabimp.hxx:130
std::unique_ptr< weld::Entry > m_xMailED
Definition: swuilabimp.hxx:100
std::unique_ptr< weld::Label > m_xFormatInfo
Definition: swuilabimp.hxx:44
SwPrivateDataPage(TabPageParent pParent, const SfxItemSet &rSet)
Definition: label1.cxx:548
SwLabRec * GetRecord(const OUString &rRecName, bool bCont)
Definition: label1.cxx:190
OUString m_aCompState
Definition: labimg.hxx:93
std::unique_ptr< weld::Entry > m_xTitleED
Definition: swuilabimp.hxx:94
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
std::unique_ptr< weld::Entry > m_xStateED
Definition: swuilabimp.hxx:126
OUString aLstGroup
Definition: label.hxx:42
SwLabelConfig aLabelsCfg
Definition: label.hxx:34
virtual void set_busy_cursor(bool bBusy)=0
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
OUString m_aPrivName2
Definition: labimg.hxx:72
virtual void PageCreated(const OString &rId, SfxTabPage &rPage) override
Definition: label1.cxx:78
static VclPtr< reference_type > Create(Arg &&...arg)
void AddTabPage(const OString &rName, CreateTabPage pCreateFunc, GetTabPageRanges pRangesFunc)
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: label1.cxx:679
SwLabPage(TabPageParent pParent, const SfxItemSet &rSet)
Definition: label1.cxx:221
virtual const SfxItemSet * GetExampleSet() const override
OUString m_aCompPosition
Definition: labimg.hxx:94
void SetDecimalDigits(sal_uInt16 nDigits)
void UpdateGroup(const OUString &rMake)
Definition: label.hxx:73
IMPL_LINK(SwLabPage, DatabaseHdl, weld::ComboBox &, rListBox, void)
Definition: label1.cxx:297
virtual ~SwLabDlg() override
Definition: label1.cxx:164
std::unique_ptr< weld::Entry > m_xHomePageED
Definition: swuilabimp.hxx:99
OUString m_aLstMake
Definition: labimg.hxx:43
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: label1.cxx:482
DeactivateRC
std::vector< std::unique_ptr< SwLabRec > > SwLabRecs
Definition: labrec.hxx:51
OUString m_sDBName
Definition: labimg.hxx:45
std::vector< OUString > aMakes
Definition: label.hxx:39
std::unique_ptr< weld::Entry > m_xCountryED
Definition: swuilabimp.hxx:92
long m_nPHeight
Definition: labrec.hxx:45
std::unique_ptr< weld::Entry > m_xHomePageED
Definition: swuilabimp.hxx:131
OUString m_aCompCompany
Definition: labimg.hxx:86
SVX_DLLPUBLIC MSO_SPT Get(const OUString &)
void FillItem(SwLabItem &rItem) const
Definition: label1.cxx:56
std::unique_ptr< weld::Entry > m_xFaxED
Definition: swuilabimp.hxx:98
std::unique_ptr< weld::Entry > m_xSloganED
Definition: swuilabimp.hxx:121
std::unique_ptr< weld::Entry > m_xPhoneED
Definition: swuilabimp.hxx:128
std::unique_ptr< weld::Entry > m_xFirstName2ED
Definition: swuilabimp.hxx:86
std::unique_ptr< weld::Entry > m_xStateED
Definition: swuilabimp.hxx:93
sal_Int32 m_lWidth
Definition: labimg.hxx:52
SwLabDlg(weld::Window *pParent, const SfxItemSet &rSet, SwDBManager *pDBManager, bool bLabel)
Definition: label1.cxx:94
std::unique_ptr< weld::Entry > m_xMailED
Definition: swuilabimp.hxx:132
static VclPtr< SfxTabPage > Create(TabPageParent pParent, const SfxItemSet *rSet)
Definition: label1.cxx:576
OUString m_aPrivName
Definition: labimg.hxx:69
aStr
OUString m_aWriting
Definition: labimg.hxx:47
SwLabRecs & Recs()
Definition: label.hxx:57
OUString m_aCompCountry
Definition: labimg.hxx:92
OUString m_aPrivFirstName
Definition: labimg.hxx:68
void GetLabItem(SwLabItem &rItem)
Definition: label1.cxx:169
long m_nUpper
Definition: labrec.hxx:43
std::unique_ptr< weld::ComboBox > m_xDatabaseLB
Definition: swuilabimp.hxx:35
std::unique_ptr< weld::ComboBox > m_xTableLB
Definition: swuilabimp.hxx:36
std::unique_ptr< weld::Container > m_xContainer
std::unique_ptr< weld::RadioButton > m_xSheetButton
Definition: swuilabimp.hxx:40