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