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 <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 "swuilabimp.hxx"
31 #include "labfmt.hxx"
32 #include "labprt.hxx"
33 #include <unotools.hxx>
34 #include <dbmgr.hxx>
35 #include <uitool.hxx>
36 #include <cmdid.h>
37 #include <helpids.h>
38 #include <globals.hrc>
39 #include <strings.hrc>
40 #include <envimg.hxx>
41 
42 void SwLabRec::SetFromItem( const SwLabItem& rItem )
43 {
44  m_nHDist = rItem.m_lHDist;
45  m_nVDist = rItem.m_lVDist;
46  m_nWidth = rItem.m_lWidth;
47  m_nHeight = rItem.m_lHeight;
48  m_nLeft = rItem.m_lLeft;
49  m_nUpper = rItem.m_lUpper;
50  m_nCols = rItem.m_nCols;
51  m_nRows = rItem.m_nRows;
52  m_nPWidth = rItem.m_lPWidth;
53  m_nPHeight = rItem.m_lPHeight;
54  m_bCont = rItem.m_bCont;
55 }
56 
57 void SwLabRec::FillItem( SwLabItem& rItem ) const
58 {
59  rItem.m_lHDist = m_nHDist;
60  rItem.m_lVDist = m_nVDist;
61  rItem.m_lWidth = m_nWidth;
62  rItem.m_lHeight = m_nHeight;
63  rItem.m_lLeft = m_nLeft;
64  rItem.m_lUpper = m_nUpper;
65  rItem.m_nCols = m_nCols;
66  rItem.m_lPWidth = m_nPWidth;
67  rItem.m_lPHeight = m_nPHeight;
68  rItem.m_nRows = m_nRows;
69 }
70 
71 void SwLabDlg::ReplaceGroup_( const OUString &rMake )
72 {
73  // Remove old entries
74  m_pRecs->erase(m_pRecs->begin() + 1, m_pRecs->end());
75  aLabelsCfg.FillLabels(rMake, *m_pRecs);
76  aLstGroup = rMake;
77 }
78 
79 void SwLabDlg::PageCreated(const OString &rId, SfxTabPage &rPage)
80 {
81  if (rId == "labels")
82  {
83  if (m_bLabel)
84  {
85  static_cast<SwLabPage*>(&rPage)->SetDBManager(pDBManager);
86  static_cast<SwLabPage*>(&rPage)->InitDatabaseBox();
87  }
88  else
89  static_cast<SwLabPage*>(&rPage)->SetToBusinessCard();
90  }
91  else if (rId == "options")
92  m_pPrtPage = static_cast<SwLabPrtPage*>(&rPage);
93 }
94 
96  SwDBManager* pDBManager_, bool bLabel)
97  : SfxTabDialogController(pParent, "modules/swriter/ui/labeldialog.ui", "LabelDialog", &rSet)
98  , pDBManager(pDBManager_)
99  , m_pPrtPage(nullptr)
100  , aTypeIds(50, 10)
101  , m_pRecs(new SwLabRecs)
102  , m_bLabel(bLabel)
103 {
104  weld::WaitObject aWait(pParent);
105 
106  // Read user label from writer.cfg
107  SwLabItem aItem(static_cast<const SwLabItem&>(rSet.Get( FN_LABEL )));
108  std::unique_ptr<SwLabRec> pRec(new SwLabRec);
109  pRec->m_aMake = pRec->m_aType = SwResId(STR_CUSTOM_LABEL);
110  pRec->SetFromItem( aItem );
111 
112  bool bDouble = false;
113 
114  for (const std::unique_ptr<SwLabRec> & i : *m_pRecs)
115  {
116  if (pRec->m_aMake == i->m_aMake &&
117  pRec->m_aType == i->m_aType)
118  {
119  bDouble = true;
120  break;
121  }
122  }
123 
124  if (!bDouble)
125  m_pRecs->insert( m_pRecs->begin(), std::move(pRec));
126 
127  size_t nLstGroup = 0;
128  const std::vector<OUString>& rMan = aLabelsCfg.GetManufacturers();
129  for(size_t nMan = 0; nMan < rMan.size(); ++nMan)
130  {
131  aMakes.push_back(rMan[nMan]);
132  if ( rMan[nMan] == aItem.m_aLstMake )
133  nLstGroup = nMan;
134  }
135 
136  if ( !aMakes.empty() )
137  ReplaceGroup_( aMakes[nLstGroup] );
138 
139  if (m_xExampleSet)
140  m_xExampleSet->Put(aItem);
141 
142  AddTabPage("format", SwLabFormatPage::Create, nullptr);
143  AddTabPage("options", SwLabPrtPage::Create, nullptr);
144  m_sBusinessCardDlg = SwResId(STR_BUSINESS_CARDS);
145 
146  if (m_bLabel)
147  {
148  RemoveTabPage("business");
149  RemoveTabPage("private");
150  RemoveTabPage("medium");
151  AddTabPage("labels", SwLabPage::Create, nullptr);
152  }
153  else
154  {
155  RemoveTabPage("labels");
156  AddTabPage("medium", SwLabPage::Create, nullptr);
157  AddTabPage("business", SwBusinessDataPage::Create, nullptr );
158  AddTabPage("private", SwPrivateDataPage::Create, nullptr);
159  m_xDialog->set_title(m_sBusinessCardDlg);
160  }
161 
162  pParent->set_busy_cursor(false);
163 }
164 
166 {
167  m_pRecs.reset();
168 }
169 
171 {
172  const SwLabItem& rActItem = static_cast<const SwLabItem&>(GetExampleSet()->Get(FN_LABEL));
173  const SwLabItem& rOldItem = static_cast<const SwLabItem&>(GetInputSetImpl()->Get(FN_LABEL));
174 
175  if (rActItem != rOldItem)
176  {
177  // Was already "put" with (hopefully) correct content
178  rItem = rActItem;
179  }
180  else
181  {
182  rItem = rOldItem;
183 
184  // In rItem there are only settings defined by users.
185  // Therefore get the real settings directly from Record
186  SwLabRec* pRec = GetRecord(rItem.m_aType, rItem.m_bCont);
187  pRec->FillItem( rItem );
188  }
189 }
190 
191 SwLabRec* SwLabDlg::GetRecord(const OUString &rRecName, bool bCont)
192 {
193  SwLabRec* pRec = nullptr;
194  bool bFound = false;
195  const OUString sCustom(SwResId(STR_CUSTOM_LABEL));
196 
197  const size_t nCount = Recs().size();
198  for (size_t i = 0; i < nCount; ++i)
199  {
200  pRec = Recs()[i].get();
201  if (pRec->m_aType != sCustom &&
202  rRecName == pRec->m_aType && bCont == pRec->m_bCont)
203  {
204  bFound = true;
205  break;
206  }
207  }
208  if (!bFound) // User defined
209  pRec = Recs()[0].get();
210 
211  return pRec;
212 }
213 
215 {
216  if (m_pPrtPage)
217  return m_pPrtPage->GetPrt();
218  else
219  return nullptr;
220 }
221 
223  : SfxTabPage(pPage, pController, "modules/swriter/ui/cardmediumpage.ui", "CardMediumPage", &rSet)
224  , pDBManager(nullptr)
225  , aItem(static_cast<const SwLabItem&>(rSet.Get(FN_LABEL)))
226  , m_xAddressFrame(m_xBuilder->weld_widget("addressframe"))
227  , m_xAddrBox(m_xBuilder->weld_check_button("address"))
228  , m_xWritingEdit(m_xBuilder->weld_text_view("textview"))
229  , m_xDatabaseLB(m_xBuilder->weld_combo_box("database"))
230  , m_xTableLB(m_xBuilder->weld_combo_box("table"))
231  , m_xInsertBT(m_xBuilder->weld_button("insert"))
232  , m_xDBFieldLB(m_xBuilder->weld_combo_box("field"))
233  , m_xContButton(m_xBuilder->weld_radio_button("continuous"))
234  , m_xSheetButton(m_xBuilder->weld_radio_button("sheet"))
235  , m_xMakeBox(m_xBuilder->weld_combo_box("brand"))
236  , m_xTypeBox(m_xBuilder->weld_combo_box("type"))
237  , m_xHiddenSortTypeBox(m_xBuilder->weld_combo_box("hiddentype"))
238  , m_xFormatInfo(m_xBuilder->weld_label("formatinfo"))
239 {
241 
242  m_xWritingEdit->set_size_request(m_xWritingEdit->get_approximate_digit_width() * 30,
243  m_xWritingEdit->get_height_rows(10));
244  m_xHiddenSortTypeBox->make_sorted();
245 
246  long nListBoxWidth = m_xWritingEdit->get_approximate_digit_width() * 25;
247  m_xTableLB->set_size_request(nListBoxWidth, -1);
248  m_xDatabaseLB->set_size_request(nListBoxWidth, -1);
249  m_xDBFieldLB->set_size_request(nListBoxWidth, -1);
250 
252 
253  // Install handlers
254  m_xAddrBox->connect_toggled(LINK(this, SwLabPage, AddrHdl));
255  m_xDatabaseLB->connect_changed(LINK(this, SwLabPage, DatabaseHdl));
256  m_xTableLB->connect_changed(LINK(this, SwLabPage, DatabaseHdl));
257  m_xDBFieldLB->connect_changed(LINK(this, SwLabPage, DatabaseHdl));
258  m_xInsertBT->connect_clicked(LINK(this, SwLabPage, FieldHdl));
259  // Disable insert button first,
260  // it'll be enabled if m_xDatabaseLB, m_pTableLB and m_pInsertBT are filled
261  m_xInsertBT->set_sensitive(false);
262  m_xContButton->connect_toggled(LINK(this, SwLabPage, PageHdl));
263  m_xSheetButton->connect_toggled(LINK(this, SwLabPage, PageHdl));
264  auto nMaxWidth = m_xMakeBox->get_approximate_digit_width() * 32;
265  m_xMakeBox->set_size_request(nMaxWidth, -1);
266  m_xTypeBox->set_size_request(nMaxWidth, -1);
267  m_xMakeBox->connect_changed(LINK(this, SwLabPage, MakeHdl));
268  m_xTypeBox->connect_changed(LINK(this, SwLabPage, TypeHdl));
269 
270  InitDatabaseBox();
271 }
272 
274 {
275 }
276 
278 {
279  m_xContainer->set_help_id(HID_BUSINESS_FMT_PAGE);
284  m_xAddressFrame->hide();
285 };
286 
288 {
289  OUString aWriting;
290 
291  if (m_xAddrBox->get_active())
292  aWriting = convertLineEnd(MakeSender(), GetSystemLineEnd());
293 
294  m_xWritingEdit->set_text(aWriting);
295  m_xWritingEdit->grab_focus();
296 }
297 
298 IMPL_LINK( SwLabPage, DatabaseHdl, weld::ComboBox&, rListBox, void )
299 {
300  sActDBName = m_xDatabaseLB->get_active_text();
301 
302  weld::WaitObject aObj(GetParentSwLabDlg()->getDialog());
303 
304  if (&rListBox == m_xDatabaseLB.get())
305  GetDBManager()->GetTableNames(*m_xTableLB, sActDBName);
306 
307  if (&rListBox == m_xDatabaseLB.get() || &rListBox == m_xTableLB.get())
308  GetDBManager()->GetColumnNames(*m_xDBFieldLB, sActDBName, m_xTableLB->get_active_text());
309 
310  if (!m_xDatabaseLB->get_active_text().isEmpty() && !m_xTableLB->get_active_text().isEmpty()
311  && !m_xDBFieldLB->get_active_text().isEmpty())
312  m_xInsertBT->set_sensitive(true);
313  else
314  m_xInsertBT->set_sensitive(false);
315 }
316 
318 {
319  OUString aStr("<" + m_xDatabaseLB->get_active_text() + "." +
320  m_xTableLB->get_active_text() + "." +
321  m_xTableLB->get_active_id() + "." +
322  m_xDBFieldLB->get_active_text() + ">");
323  m_xWritingEdit->replace_selection(aStr);
324  int nStartPos, nEndPos;
325  m_xWritingEdit->get_selection_bounds(nStartPos, nEndPos);
326  m_xWritingEdit->grab_focus();
327  m_xWritingEdit->select_region(nStartPos, nEndPos);
328 }
329 
331 {
332  MakeHdl(*m_xMakeBox);
333 }
334 
336 {
337  weld::WaitObject aWait(GetParentSwLabDlg()->getDialog());
338 
339  m_xTypeBox->clear();
340  m_xHiddenSortTypeBox->clear();
341  GetParentSwLabDlg()->TypeIds().clear();
342 
343  const OUString aMake = m_xMakeBox->get_active_text();
344  GetParentSwLabDlg()->ReplaceGroup( aMake );
345  aItem.m_aLstMake = aMake;
346 
347  const bool bCont = m_xContButton->get_active();
348  const size_t nCount = GetParentSwLabDlg()->Recs().size();
349  size_t nLstType = 0;
350 
351  const OUString sCustom(SwResId(STR_CUSTOM_LABEL));
352  //insert the entries into the sorted list box
353  for ( size_t i = 0; i < nCount; ++i )
354  {
355  const OUString aType(GetParentSwLabDlg()->Recs()[i]->m_aType);
356  bool bInsert = false;
357  if (GetParentSwLabDlg()->Recs()[i]->m_aType == sCustom)
358  {
359  bInsert = true;
360  m_xTypeBox->append_text(aType );
361  }
362  else if (GetParentSwLabDlg()->Recs()[i]->m_bCont == bCont)
363  {
364  if (m_xHiddenSortTypeBox->find_text(aType) == -1)
365  {
366  bInsert = true;
367  m_xHiddenSortTypeBox->append_text( aType );
368  }
369  }
370  if(bInsert)
371  {
372  GetParentSwLabDlg()->TypeIds().push_back(i);
373  if ( !nLstType && aType == aItem.m_aLstType )
374  nLstType = GetParentSwLabDlg()->TypeIds().size();
375  }
376  }
377  for (int nEntry = 0; nEntry < m_xHiddenSortTypeBox->get_count(); ++nEntry)
378  {
379  m_xTypeBox->append_text(m_xHiddenSortTypeBox->get_text(nEntry));
380  }
381  if (nLstType)
382  m_xTypeBox->set_active_text(aItem.m_aLstType);
383  else
384  m_xTypeBox->set_active(0);
385  TypeHdl(*m_xTypeBox);
386 }
387 
389 {
390  DisplayFormat();
391  aItem.m_aType = m_xTypeBox->get_active_text();
392 }
393 
395 {
397  FieldUnit aMetric = ::GetDfltMetric(false);
398  SetMetric(*aField, aMetric);
399  aField->SetDecimalDigits(2);
400  aField->SetMin (0);
401  aField->SetMax (LONG_MAX);
402 
403  SwLabRec* pRec = GetSelectedEntryPos();
404  aItem.m_aLstType = pRec->m_aType;
405  SETFLDVAL(*aField, pRec->m_nWidth);
406  aField->Reformat();
407  const OUString aWString = aField->GetText();
408 
409  SETFLDVAL(*aField, pRec->m_nHeight);
410  aField->Reformat();
411 
412  OUString aText = pRec->m_aType + ": " + aWString +
413  " x " + aField->GetText() +
414  " (" + OUString::number( pRec->m_nCols ) +
415  " x " + OUString::number( pRec->m_nRows ) + ")";
416  m_xFormatInfo->set_label(aText);
417 }
418 
420 {
421  OUString sSelEntry(m_xTypeBox->get_active_text());
422 
423  return GetParentSwLabDlg()->GetRecord(sSelEntry, m_xContButton->get_active());
424 }
425 
427 {
428  if( GetDBManager() )
429  {
430  m_xDatabaseLB->clear();
431  const css::uno::Sequence<OUString> aDataNames = SwDBManager::GetExistingDatabaseNames();
432  for (const OUString& rDataName : aDataNames)
433  m_xDatabaseLB->append_text(rDataName);
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 
448 std::unique_ptr<SfxTabPage> SwLabPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet)
449 {
450  return std::make_unique<SwLabPage>(pPage, pController, *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(pPage, pController, "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 
576 std::unique_ptr<SfxTabPage> SwPrivateDataPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet)
577 {
578  return std::make_unique<SwPrivateDataPage>(pPage, pController, *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(pPage, pController, "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 
669 std::unique_ptr<SfxTabPage> SwBusinessDataPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet)
670 {
671  return std::make_unique<SwBusinessDataPage>(pPage, pController, *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: */
OUString m_aMake
Definition: labimg.hxx:48
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: labprt.cxx:89
long m_nHDist
Definition: labrec.hxx:40
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:114
sal_Int32 m_lHeight
Definition: labimg.hxx:53
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: label1.cxx:458
long m_nHeight
Definition: labrec.hxx:43
TOOLS_DLLPUBLIC OString convertLineEnd(const OString &rIn, LineEnd eLineEnd)
sal_Int32 m_nRows
Definition: labrec.hxx:49
OUString m_aCompSlogan
Definition: labimg.hxx:88
#define HID_BUSINESS_FMT_PAGE_SHEET
Definition: helpids.h:103
#define SETFLDVAL(rField, lValue)
Definition: labimp.hxx:25
sal_Int32 m_lVDist
Definition: labimg.hxx:51
Printer * GetPrt()
Definition: label1.cxx:214
SwLabRec * GetSelectedEntryPos()
Definition: label1.cxx:419
bool m_bAddr
Definition: labimg.hxx:62
virtual void Reformat() override
std::unique_ptr< weld::Widget > m_xAddressFrame
Definition: swuilabimp.hxx:33
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: label1.cxx:576
bool GetTableNames(weld::ComboBox &rBox, const OUString &rDBName)
Fill listbox with all table names of a database.
Definition: dbmgr.cxx:720
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: label1.cxx:669
std::unique_ptr< weld::Entry > m_xStreetED
Definition: swuilabimp.hxx:87
OUString m_aPrivTitle
Definition: labimg.hxx:79
std::unique_ptr< weld::Entry > m_xZipED
Definition: swuilabimp.hxx:118
void FillItem(SwLabItem &rItem)
Definition: label1.cxx:466
sal_Int32 m_lLeft
Definition: labimg.hxx:54
static vcl::Window * GetDefDialogParent()
void SetMin(sal_Int64 nNewMin, FieldUnit eInUnit)
std::unique_ptr< weld::ComboBox > m_xDBFieldLB
Definition: swuilabimp.hxx:39
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: label1.cxx:674
long m_nWidth
Definition: labrec.hxx:42
std::unique_ptr< weld::Entry > m_xCompanyExtED
Definition: swuilabimp.hxx:115
std::unique_ptr< weld::TextView > m_xWritingEdit
Definition: swuilabimp.hxx:35
std::unique_ptr< weld::ComboBox > m_xHiddenSortTypeBox
Definition: swuilabimp.hxx:44
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:42
void DisplayFormat()
Definition: label1.cxx:394
std::unique_ptr< weld::CheckButton > m_xAddrBox
Definition: swuilabimp.hxx:34
OUString sActDBName
Definition: swuilabimp.hxx:30
void SetMax(sal_Int64 nNewMax, FieldUnit eInUnit)
SwLabItem aItem
Definition: swuilabimp.hxx:31
SfxItemSet * GetInputSetImpl()
std::unique_ptr< weld::ComboBox > m_xTypeBox
Definition: swuilabimp.hxx:43
OUString m_aCompCity
Definition: labimg.hxx:91
virtual ~SwLabPage() override
Definition: label1.cxx:273
OUString m_aPrivPhone
Definition: labimg.hxx:81
std::unique_ptr< weld::Entry > m_xPositionED
Definition: swuilabimp.hxx:122
OUString m_aCompMobile
Definition: labimg.hxx:96
OUString m_aPrivMobile
Definition: labimg.hxx:82
OUString m_aLstType
Definition: labimg.hxx:44
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:2571
sal_Int32 m_lPWidth
Definition: labimg.hxx:61
long m_nLeft
Definition: labrec.hxx:44
sal_Int64 WinBits
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: label1.cxx:453
OUString m_aPrivShortCut2
Definition: labimg.hxx:73
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: label1.cxx:448
bool m_bCont
Definition: labrec.hxx:50
std::unique_ptr< weld::Entry > m_xShortCutED
Definition: swuilabimp.hxx:83
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:124
std::unique_ptr< weld::Entry > m_xName2ED
Definition: swuilabimp.hxx:85
OUString m_aPrivProfession
Definition: labimg.hxx:80
long m_nVDist
Definition: labrec.hxx:41
bool m_bCont
Definition: labimg.hxx:63
SwLabPrtPage * m_pPrtPage
Definition: label.hxx:36
IMPL_LINK_NOARG(SwLabPage, AddrHdl, weld::ToggleButton &, void)
Definition: label1.cxx:287
void InitDatabaseBox()
Definition: label1.cxx:426
void SetFromItem(const SwLabItem &rItem)
Definition: label1.cxx:42
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:76
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:86
void ReplaceGroup_(const OUString &rMake)
Definition: label1.cxx:71
std::unique_ptr< weld::Button > m_xInsertBT
Definition: swuilabimp.hxx:38
std::unique_ptr< weld::Entry > m_xCityED
Definition: swuilabimp.hxx:89
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: label1.cxx:686
std::unique_ptr< weld::Entry > m_xStreetED
Definition: swuilabimp.hxx:117
std::unique_ptr< weld::Entry > m_xZipED
Definition: swuilabimp.hxx:88
std::vector< OUString > & Makes()
Definition: label.hxx:63
virtual void Reset(const SfxItemSet *rSet) override
Definition: label1.cxx:490
std::unique_ptr< weld::Entry > m_xNameED
Definition: swuilabimp.hxx:82
SW_DLLPUBLIC FieldUnit GetDfltMetric(bool bWeb)
Definition: uitool.cxx:709
OUString m_aPrivFirstName2
Definition: labimg.hxx:71
long m_nPWidth
Definition: labrec.hxx:46
SwDBManager *const pDBManager
Definition: label.hxx:35
sal_Int32 m_lHDist
Definition: labimg.hxx:50
void SetToBusinessCard()
Definition: label1.cxx:277
int i
Printer * GetPrt()
Definition: labprt.hxx:58
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:93
virtual OUString GetText() const override
std::unique_ptr< weld::Entry > m_xPhoneED
Definition: swuilabimp.hxx:94
std::unique_ptr< weld::Entry > m_xCountryED
Definition: swuilabimp.hxx:120
OUString m_aType
Definition: labimg.hxx:49
OUString m_aCompFax
Definition: labimg.hxx:97
std::unique_ptr< weld::Entry > m_xFirstNameED
Definition: swuilabimp.hxx:81
sal_Int32 m_nCols
Definition: labimg.hxx:56
#define HID_BUSINESS_FMT_PAGE_TYPE
Definition: helpids.h:105
SwPrivateDataPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: label1.cxx:548
OUString m_aCompWWW
Definition: labimg.hxx:98
OUString m_aCompPhone
Definition: labimg.hxx:95
OUString SwResId(const char *pId)
Definition: swmodule.cxx:190
std::unique_ptr< weld::Entry > m_xCityED
Definition: swuilabimp.hxx:119
OUString m_sBusinessCardDlg
Definition: label.hxx:43
OUString MakeSender()
Definition: envimg.cxx:49
SW_DLLPUBLIC void SetMetric(MetricFormatter &rCtrl, FieldUnit eUnit)
Definition: uitool.cxx:89
void FillLabels(const OUString &rManufacturer, SwLabRecs &rLabArr)
Definition: labelcfg.cxx:250
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:40
#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:48
SwLabDlg * GetParentSwLabDlg()
Definition: swuilabimp.hxx:70
std::unique_ptr< weld::Entry > m_xMobilePhoneED
Definition: swuilabimp.hxx:95
OUString m_aType
Definition: labrec.hxx:39
const std::vector< OUString > & GetManufacturers() const
Definition: labelcfg.hxx:50
std::unique_ptr< weld::Entry > m_xFaxED
Definition: swuilabimp.hxx:125
std::unique_ptr< weld::Entry > m_xMailED
Definition: swuilabimp.hxx:98
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: labfmt.cxx:406
std::unique_ptr< weld::Label > m_xFormatInfo
Definition: swuilabimp.hxx:45
SwLabRec * GetRecord(const OUString &rRecName, bool bCont)
Definition: label1.cxx:191
OUString m_aCompState
Definition: labimg.hxx:93
std::unique_ptr< weld::Entry > m_xTitleED
Definition: swuilabimp.hxx:92
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
std::unique_ptr< weld::Entry > m_xStateED
Definition: swuilabimp.hxx:121
OUString aLstGroup
Definition: label.hxx:42
weld::Window * GetFrameWeld() const
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:79
void AddTabPage(const OString &rName, CreateTabPage pCreateFunc, GetTabPageRanges pRangesFunc)
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: label1.cxx:679
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:298
virtual ~SwLabDlg() override
Definition: label1.cxx:165
std::unique_ptr< weld::Entry > m_xHomePageED
Definition: swuilabimp.hxx:97
OUString m_aLstMake
Definition: labimg.hxx:43
SwBusinessDataPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: label1.cxx:645
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: label1.cxx:482
DeactivateRC
std::vector< std::unique_ptr< SwLabRec > > SwLabRecs
Definition: labrec.hxx:53
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:90
long m_nPHeight
Definition: labrec.hxx:47
std::unique_ptr< weld::Entry > m_xHomePageED
Definition: swuilabimp.hxx:126
OUString m_aCompCompany
Definition: labimg.hxx:86
SVX_DLLPUBLIC MSO_SPT Get(const OUString &)
void FillItem(SwLabItem &rItem) const
Definition: label1.cxx:57
void GetColumnNames(weld::ComboBox &rBox, const OUString &rDBName, const OUString &rTableName)
Fill listbox with all column names of a database table.
Definition: dbmgr.cxx:760
std::unique_ptr< weld::Entry > m_xFaxED
Definition: swuilabimp.hxx:96
SwLabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: label1.cxx:222
std::unique_ptr< weld::Entry > m_xSloganED
Definition: swuilabimp.hxx:116
std::unique_ptr< weld::Entry > m_xPhoneED
Definition: swuilabimp.hxx:123
std::unique_ptr< weld::Entry > m_xFirstName2ED
Definition: swuilabimp.hxx:84
std::unique_ptr< weld::Entry > m_xStateED
Definition: swuilabimp.hxx:91
sal_Int32 m_lWidth
Definition: labimg.hxx:52
SwLabDlg(weld::Window *pParent, const SfxItemSet &rSet, SwDBManager *pDBManager, bool bLabel)
Definition: label1.cxx:95
std::unique_ptr< weld::Entry > m_xMailED
Definition: swuilabimp.hxx:127
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:170
long m_nUpper
Definition: labrec.hxx:45
std::unique_ptr< weld::ComboBox > m_xDatabaseLB
Definition: swuilabimp.hxx:36
std::unique_ptr< weld::ComboBox > m_xTableLB
Definition: swuilabimp.hxx:37
std::unique_ptr< weld::RadioButton > m_xSheetButton
Definition: swuilabimp.hxx:41