LibreOffice Module sc (master)  1
tpview.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 #undef SC_DLLIMPLEMENTATION
21 
22 #include <tpview.hxx>
23 #include <global.hxx>
24 #include <viewopti.hxx>
25 #include <scresid.hxx>
26 #include <docsh.hxx>
27 #include <sc.hrc>
28 #include <units.hrc>
29 #include <appoptio.hxx>
30 #include <scmod.hxx>
31 #include <svl/eitem.hxx>
32 #include <svx/colorbox.hxx>
33 #include <svtools/unitconv.hxx>
34 
36  : SfxTabPage(pPage, pController, "modules/scalc/ui/tpviewpage.ui", "TpViewPage", &rArgSet)
37  , m_xGridLB(m_xBuilder->weld_combo_box("grid"))
38  , m_xColorFT(m_xBuilder->weld_label("color_label"))
39  , m_xColorLB(new ColorListBox(m_xBuilder->weld_menu_button("color"), pController->getDialog()))
40  , m_xBreakCB(m_xBuilder->weld_check_button("break"))
41  , m_xGuideLineCB(m_xBuilder->weld_check_button("guideline"))
42  , m_xFormulaCB(m_xBuilder->weld_check_button("formula"))
43  , m_xNilCB(m_xBuilder->weld_check_button("nil"))
44  , m_xAnnotCB(m_xBuilder->weld_check_button("annot"))
45  , m_xValueCB(m_xBuilder->weld_check_button("value"))
46  , m_xAnchorCB(m_xBuilder->weld_check_button("anchor"))
47  , m_xClipMarkCB(m_xBuilder->weld_check_button("clipmark"))
48  , m_xRangeFindCB(m_xBuilder->weld_check_button("rangefind"))
49  , m_xObjGrfLB(m_xBuilder->weld_combo_box("objgrf"))
50  , m_xDiagramLB(m_xBuilder->weld_combo_box("diagram"))
51  , m_xDrawLB(m_xBuilder->weld_combo_box("draw"))
52  , m_xSyncZoomCB(m_xBuilder->weld_check_button("synczoom"))
53  , m_xRowColHeaderCB(m_xBuilder->weld_check_button("rowcolheader"))
54  , m_xHScrollCB(m_xBuilder->weld_check_button("hscroll"))
55  , m_xVScrollCB(m_xBuilder->weld_check_button("vscroll"))
56  , m_xTblRegCB(m_xBuilder->weld_check_button("tblreg"))
57  , m_xOutlineCB(m_xBuilder->weld_check_button("outline"))
58  , m_xSummaryCB(m_xBuilder->weld_check_button("cbSummary"))
59 {
61  Link<weld::ComboBox&,void> aSelObjHdl(LINK( this, ScTpContentOptions, SelLbObjHdl ) );
62  m_xObjGrfLB->connect_changed(aSelObjHdl);
63  m_xDiagramLB->connect_changed(aSelObjHdl);
64  m_xDrawLB->connect_changed(aSelObjHdl);
65  m_xGridLB->connect_changed( LINK( this, ScTpContentOptions, GridHdl ) );
66 
68  m_xFormulaCB->connect_toggled(aCBHdl);
69  m_xNilCB->connect_toggled(aCBHdl);
70  m_xAnnotCB->connect_toggled(aCBHdl);
71  m_xValueCB->connect_toggled(aCBHdl);
72  m_xAnchorCB->connect_toggled(aCBHdl);
73  m_xClipMarkCB->connect_toggled(aCBHdl);
74 
75  m_xVScrollCB->connect_toggled(aCBHdl);
76  m_xHScrollCB->connect_toggled(aCBHdl);
77  m_xTblRegCB->connect_toggled(aCBHdl);
78  m_xOutlineCB->connect_toggled(aCBHdl);
79  m_xBreakCB->connect_toggled(aCBHdl);
80  m_xGuideLineCB->connect_toggled(aCBHdl);
81  m_xRowColHeaderCB->connect_toggled(aCBHdl);
82  m_xSummaryCB->connect_toggled(aCBHdl);
83 
84  m_xColorLB->SetSlotId(SID_ATTR_CHAR_COLOR);
85  m_xColorLB->SetAutoDisplayColor(SC_STD_GRIDCOLOR);
86 }
87 
89 {
90  m_xColorLB.reset();
91 }
92 
93 std::unique_ptr<SfxTabPage> ScTpContentOptions::Create( weld::Container* pPage, weld::DialogController* pController,
94  const SfxItemSet* rCoreSet )
95 {
96  return std::make_unique<ScTpContentOptions>(pPage, pController, *rCoreSet);
97 }
98 
100 {
101  bool bRet = false;
102  if( m_xFormulaCB->get_state_changed_from_saved() ||
103  m_xNilCB->get_state_changed_from_saved() ||
104  m_xAnnotCB->get_state_changed_from_saved() ||
105  m_xValueCB->get_state_changed_from_saved() ||
106  m_xAnchorCB->get_state_changed_from_saved() ||
107  m_xClipMarkCB->get_state_changed_from_saved() ||
108  m_xObjGrfLB->get_value_changed_from_saved() ||
109  m_xDiagramLB->get_value_changed_from_saved() ||
110  m_xDrawLB->get_value_changed_from_saved() ||
111  m_xGridLB->get_value_changed_from_saved() ||
112  m_xRowColHeaderCB->get_state_changed_from_saved() ||
113  m_xHScrollCB->get_state_changed_from_saved() ||
114  m_xVScrollCB->get_state_changed_from_saved() ||
115  m_xTblRegCB->get_state_changed_from_saved() ||
116  m_xOutlineCB->get_state_changed_from_saved() ||
117  m_xColorLB->IsValueChangedFromSaved() ||
118  m_xBreakCB->get_state_changed_from_saved() ||
119  m_xSummaryCB->get_state_changed_from_saved() ||
120  m_xGuideLineCB->get_state_changed_from_saved())
121  {
122  NamedColor aNamedColor = m_xColorLB->GetSelectedEntry();
123  if (aNamedColor.first == COL_AUTO)
124  {
125  aNamedColor.first = SC_STD_GRIDCOLOR;
126  aNamedColor.second.clear();
127  }
128  m_xLocalOptions->SetGridColor(aNamedColor.first, aNamedColor.second);
129  rCoreSet->Put(ScTpViewItem(*m_xLocalOptions));
130  bRet = true;
131  }
132  if(m_xRangeFindCB->get_state_changed_from_saved())
133  {
134  rCoreSet->Put(SfxBoolItem(SID_SC_INPUT_RANGEFINDER, m_xRangeFindCB->get_active()));
135  bRet = true;
136  }
137  if(m_xSyncZoomCB->get_state_changed_from_saved())
138  {
139  rCoreSet->Put(SfxBoolItem(SID_SC_OPT_SYNCZOOM, m_xSyncZoomCB->get_active()));
140  bRet = true;
141  }
142 
143  return bRet;
144 }
145 
146 void ScTpContentOptions::Reset( const SfxItemSet* rCoreSet )
147 {
148  const SfxPoolItem* pItem;
149  if(SfxItemState::SET == rCoreSet->GetItemState(SID_SCVIEWOPTIONS, false , &pItem))
150  m_xLocalOptions.reset( new ScViewOptions(
151  static_cast<const ScTpViewItem*>(pItem)->GetViewOptions() ) );
152  else
153  m_xLocalOptions.reset( new ScViewOptions );
154  m_xFormulaCB ->set_active(m_xLocalOptions->GetOption(VOPT_FORMULAS));
155  m_xNilCB ->set_active(m_xLocalOptions->GetOption(VOPT_NULLVALS));
156  m_xAnnotCB ->set_active(m_xLocalOptions->GetOption(VOPT_NOTES));
157  m_xValueCB ->set_active(m_xLocalOptions->GetOption(VOPT_SYNTAX));
158  m_xAnchorCB ->set_active(m_xLocalOptions->GetOption(VOPT_ANCHOR));
159  m_xClipMarkCB->set_active(m_xLocalOptions->GetOption(VOPT_CLIPMARKS));
160 
161  m_xObjGrfLB ->set_active( static_cast<sal_uInt16>(m_xLocalOptions->GetObjMode(VOBJ_TYPE_OLE)) );
162  m_xDiagramLB ->set_active( static_cast<sal_uInt16>(m_xLocalOptions->GetObjMode(VOBJ_TYPE_CHART)) );
163  m_xDrawLB ->set_active( static_cast<sal_uInt16>(m_xLocalOptions->GetObjMode(VOBJ_TYPE_DRAW)) );
164 
165  m_xRowColHeaderCB->set_active( m_xLocalOptions->GetOption(VOPT_HEADER) );
166  m_xHScrollCB->set_active( m_xLocalOptions->GetOption(VOPT_HSCROLL) );
167  m_xVScrollCB->set_active( m_xLocalOptions->GetOption(VOPT_VSCROLL) );
168  m_xTblRegCB ->set_active( m_xLocalOptions->GetOption(VOPT_TABCONTROLS) );
169  m_xOutlineCB->set_active( m_xLocalOptions->GetOption(VOPT_OUTLINER) );
170  m_xSummaryCB->set_active( m_xLocalOptions->GetOption(VOPT_SUMMARY) );
171 
172  InitGridOpt();
173 
174  m_xBreakCB->set_active( m_xLocalOptions->GetOption(VOPT_PAGEBREAKS) );
175  m_xGuideLineCB->set_active( m_xLocalOptions->GetOption(VOPT_HELPLINES) );
176 
177  if(SfxItemState::SET == rCoreSet->GetItemState(SID_SC_INPUT_RANGEFINDER, false, &pItem))
178  m_xRangeFindCB->set_active(static_cast<const SfxBoolItem*>(pItem)->GetValue());
179  if(SfxItemState::SET == rCoreSet->GetItemState(SID_SC_OPT_SYNCZOOM, false, &pItem))
180  m_xSyncZoomCB->set_active(static_cast<const SfxBoolItem*>(pItem)->GetValue());
181 
182  m_xRangeFindCB->save_state();
183  m_xSyncZoomCB->save_state();
184 
185  m_xFormulaCB->save_state();
186  m_xNilCB->save_state();
187  m_xAnnotCB->save_state();
188  m_xValueCB->save_state();
189  m_xAnchorCB->save_state();
190  m_xClipMarkCB->save_state();
191  m_xObjGrfLB->save_value();
192  m_xDiagramLB->save_value();
193  m_xDrawLB->save_value();
194  m_xRowColHeaderCB->save_state();
195  m_xHScrollCB->save_state();
196  m_xVScrollCB->save_state();
197  m_xTblRegCB->save_state();
198  m_xOutlineCB->save_state();
199  m_xGridLB->save_value();
200  m_xColorLB->SaveValue();
201  m_xBreakCB->save_state();
202  m_xGuideLineCB->save_state();
203  m_xSummaryCB->save_state();
204 }
205 
207 {
208  const SfxPoolItem* pItem;
209  if(SfxItemState::SET == rSet.GetItemState(SID_SCVIEWOPTIONS, false , &pItem))
210  *m_xLocalOptions = static_cast<const ScTpViewItem*>(pItem)->GetViewOptions();
211 }
212 
214 {
215  if(pSetP)
216  FillItemSet(pSetP);
217  return DeactivateRC::LeavePage;
218 }
219 
220 IMPL_LINK( ScTpContentOptions, SelLbObjHdl, weld::ComboBox&, rLb, void )
221 {
222  const sal_Int32 nSelPos = rLb.get_active();
223  ScVObjMode eMode = ScVObjMode(nSelPos);
225 
226  if ( &rLb == m_xDiagramLB.get() )
227  eType = VOBJ_TYPE_CHART;
228  else if ( &rLb == m_xDrawLB.get() )
229  eType = VOBJ_TYPE_DRAW;
230 
231  m_xLocalOptions->SetObjMode( eType, eMode );
232 }
233 
235 {
236  ScViewOption eOption = VOPT_FORMULAS;
237  bool bChecked = rBtn.get_active();
238 
239  if (m_xFormulaCB.get() == &rBtn ) eOption = VOPT_FORMULAS;
240  else if ( m_xNilCB.get() == &rBtn ) eOption = VOPT_NULLVALS;
241  else if ( m_xAnnotCB.get() == &rBtn ) eOption = VOPT_NOTES;
242  else if ( m_xValueCB.get() == &rBtn ) eOption = VOPT_SYNTAX;
243  else if ( m_xAnchorCB.get() == &rBtn ) eOption = VOPT_ANCHOR;
244  else if ( m_xClipMarkCB.get() == &rBtn ) eOption = VOPT_CLIPMARKS;
245  else if ( m_xVScrollCB.get() == &rBtn ) eOption = VOPT_VSCROLL;
246  else if ( m_xHScrollCB.get() == &rBtn ) eOption = VOPT_HSCROLL;
247  else if ( m_xTblRegCB.get() == &rBtn ) eOption = VOPT_TABCONTROLS;
248  else if ( m_xOutlineCB.get() == &rBtn ) eOption = VOPT_OUTLINER;
249  else if ( m_xBreakCB.get() == &rBtn ) eOption = VOPT_PAGEBREAKS;
250  else if ( m_xGuideLineCB.get() == &rBtn ) eOption = VOPT_HELPLINES;
251  else if ( m_xRowColHeaderCB.get() == &rBtn ) eOption = VOPT_HEADER;
252  else if ( m_xSummaryCB.get() == &rBtn ) eOption = VOPT_SUMMARY;
253 
254  m_xLocalOptions->SetOption( eOption, bChecked );
255 }
256 
258 {
259  bool bGrid = m_xLocalOptions->GetOption( VOPT_GRID );
260  bool bGridOnTop = m_xLocalOptions->GetOption( VOPT_GRID_ONTOP );
261  sal_Int32 nSelPos = 0;
262 
263  if ( bGrid || bGridOnTop )
264  {
265  m_xColorFT->set_sensitive(true);
266  m_xColorLB->set_sensitive(true);
267  if ( !bGridOnTop )
268  nSelPos = 0;
269  else
270  nSelPos = 1;
271  }
272  else
273  {
274  m_xColorFT->set_sensitive(false);
275  m_xColorLB->set_sensitive(false);
276  nSelPos = 2;
277  }
278 
279  m_xGridLB->set_active (nSelPos);
280 
281  // select grid color entry
282  OUString aName;
283  Color aCol = m_xLocalOptions->GetGridColor( &aName );
284 
285  if (aName.trim().isEmpty() && aCol == SC_STD_GRIDCOLOR)
286  aCol = COL_AUTO;
287 
288  m_xColorLB->SelectEntry(std::make_pair(aCol, aName));
289 }
290 
292 {
293  sal_Int32 nSelPos = rLb.get_active();
294  bool bGrid = ( nSelPos <= 1 );
295  bool bGridOnTop = ( nSelPos == 1 );
296 
297  m_xColorFT->set_sensitive(bGrid);
298  m_xColorLB->set_sensitive(bGrid);
299  m_xLocalOptions->SetOption( VOPT_GRID, bGrid );
300  m_xLocalOptions->SetOption( VOPT_GRID_ONTOP, bGridOnTop );
301 }
302 
304  : SfxTabPage(pPage, pController, "modules/scalc/ui/scgeneralpage.ui", "ScGeneralPage", &rArgSet)
305  , pDoc(nullptr)
306  , m_xUnitLB(m_xBuilder->weld_combo_box("unitlb"))
307  , m_xTabMF(m_xBuilder->weld_metric_spin_button("tabmf", FieldUnit::CM))
308  , m_xAlwaysRB(m_xBuilder->weld_radio_button("alwaysrb"))
309  , m_xRequestRB(m_xBuilder->weld_radio_button("requestrb"))
310  , m_xNeverRB(m_xBuilder->weld_radio_button("neverrb"))
311  , m_xAlignCB(m_xBuilder->weld_check_button("aligncb"))
312  , m_xAlignLB(m_xBuilder->weld_combo_box("alignlb"))
313  , m_xEditModeCB(m_xBuilder->weld_check_button("editmodecb"))
314  , m_xFormatCB(m_xBuilder->weld_check_button("formatcb"))
315  , m_xExpRefCB(m_xBuilder->weld_check_button("exprefcb"))
316  , m_xSortRefUpdateCB(m_xBuilder->weld_check_button("sortrefupdatecb"))
317  , m_xMarkHdrCB(m_xBuilder->weld_check_button("markhdrcb"))
318  , m_xTextFmtCB(m_xBuilder->weld_check_button("textfmtcb"))
319  , m_xReplWarnCB(m_xBuilder->weld_check_button("replwarncb"))
320  , m_xLegacyCellSelectionCB(m_xBuilder->weld_check_button("legacy_cell_selection_cb"))
321  , m_xEnterPasteModeCB(m_xBuilder->weld_check_button("enter_paste_mode_cb"))
322 {
324 
325  m_xUnitLB->connect_changed( LINK( this, ScTpLayoutOptions, MetricHdl ) );
326  m_xAlignCB->connect_toggled(LINK(this, ScTpLayoutOptions, AlignHdl));
327 
328  for (size_t i = 0; i < SAL_N_ELEMENTS(SCSTR_UNIT); ++i)
329  {
330  OUString sMetric = ScResId(SCSTR_UNIT[i].first);
331  FieldUnit eFUnit = SCSTR_UNIT[i].second;
332 
333  switch ( eFUnit )
334  {
335  case FieldUnit::MM:
336  case FieldUnit::CM:
337  case FieldUnit::POINT:
338  case FieldUnit::PICA:
339  case FieldUnit::INCH:
340  {
341  // only use these metrics
342  m_xUnitLB->append(OUString::number(static_cast<sal_uInt32>(eFUnit)), sMetric);
343  }
344  break;
345  default:
346  {
347  // added to avoid warnings
348  }
349  }
350  }
351 }
352 
354 {
355 }
356 
357 std::unique_ptr<SfxTabPage> ScTpLayoutOptions::Create( weld::Container* pPage, weld::DialogController* pController,
358  const SfxItemSet* rCoreSet )
359 {
360  auto xNew = std::make_unique<ScTpLayoutOptions>(pPage, pController, *rCoreSet);
361 
362  ScDocShell* pDocSh = dynamic_cast< ScDocShell *>( SfxObjectShell::Current() );
363  if (pDocSh!=nullptr)
364  xNew->pDoc = &pDocSh->GetDocument();
365  return xNew;
366 }
367 
369 {
370  bool bRet = true;
371  if (m_xUnitLB->get_value_changed_from_saved())
372  {
373  const sal_Int32 nMPos = m_xUnitLB->get_active();
374  sal_uInt16 nFieldUnit = m_xUnitLB->get_id(nMPos).toUInt32();
375  rCoreSet->Put( SfxUInt16Item( SID_ATTR_METRIC, nFieldUnit ) );
376  bRet = true;
377  }
378 
379  if (m_xTabMF->get_value_changed_from_saved())
380  {
381  rCoreSet->Put(SfxUInt16Item(SID_ATTR_DEFTABSTOP,
382  sal::static_int_cast<sal_uInt16>( m_xTabMF->denormalize(m_xTabMF->get_value(FieldUnit::TWIP)) )));
383  bRet = true;
384  }
385 
386  ScLkUpdMode nSet=LM_ALWAYS;
387 
388  if (m_xRequestRB->get_active())
389  {
390  nSet=LM_ON_DEMAND;
391  }
392  else if (m_xNeverRB->get_active())
393  {
394  nSet=LM_NEVER;
395  }
396 
397  if (m_xRequestRB->get_state_changed_from_saved() ||
398  m_xNeverRB->get_state_changed_from_saved() )
399  {
400  if(pDoc)
401  pDoc->SetLinkMode(nSet);
402  ScAppOptions aAppOptions=SC_MOD()->GetAppOptions();
403  aAppOptions.SetLinkMode(nSet );
404  SC_MOD()->SetAppOptions(aAppOptions);
405  bRet = true;
406  }
407  if (m_xAlignCB->get_state_changed_from_saved())
408  {
409  rCoreSet->Put(SfxBoolItem(SID_SC_INPUT_SELECTION, m_xAlignCB->get_active()));
410  bRet = true;
411  }
412 
413  if (m_xAlignLB->get_value_changed_from_saved())
414  {
415  rCoreSet->Put(SfxUInt16Item(SID_SC_INPUT_SELECTIONPOS, m_xAlignLB->get_active()));
416  bRet = true;
417  }
418 
419  if (m_xEditModeCB->get_state_changed_from_saved())
420  {
421  rCoreSet->Put(SfxBoolItem(SID_SC_INPUT_EDITMODE, m_xEditModeCB->get_active()));
422  bRet = true;
423  }
424 
425  if (m_xFormatCB->get_state_changed_from_saved())
426  {
427  rCoreSet->Put(SfxBoolItem(SID_SC_INPUT_FMT_EXPAND, m_xFormatCB->get_active()));
428  bRet = true;
429  }
430 
431  if (m_xExpRefCB->get_state_changed_from_saved())
432  {
433  rCoreSet->Put(SfxBoolItem(SID_SC_INPUT_REF_EXPAND, m_xExpRefCB->get_active()));
434  bRet = true;
435  }
436 
437  if (m_xSortRefUpdateCB->get_state_changed_from_saved())
438  {
439  rCoreSet->Put(SfxBoolItem(SID_SC_OPT_SORT_REF_UPDATE, m_xSortRefUpdateCB->get_active()));
440  bRet = true;
441  }
442 
443  if (m_xMarkHdrCB->get_state_changed_from_saved())
444  {
445  rCoreSet->Put(SfxBoolItem(SID_SC_INPUT_MARK_HEADER, m_xMarkHdrCB->get_active()));
446  bRet = true;
447  }
448 
449  if (m_xTextFmtCB->get_state_changed_from_saved())
450  {
451  rCoreSet->Put(SfxBoolItem(SID_SC_INPUT_TEXTWYSIWYG, m_xTextFmtCB->get_active()));
452  bRet = true;
453  }
454 
455  if (m_xReplWarnCB->get_state_changed_from_saved())
456  {
457  rCoreSet->Put( SfxBoolItem( SID_SC_INPUT_REPLCELLSWARN, m_xReplWarnCB->get_active() ) );
458  bRet = true;
459  }
460 
461  if (m_xLegacyCellSelectionCB->get_state_changed_from_saved())
462  {
463  rCoreSet->Put( SfxBoolItem( SID_SC_INPUT_LEGACY_CELL_SELECTION, m_xLegacyCellSelectionCB->get_active() ) );
464  bRet = true;
465  }
466 
467  if (m_xEnterPasteModeCB->get_state_changed_from_saved())
468  {
469  rCoreSet->Put( SfxBoolItem( SID_SC_INPUT_ENTER_PASTE_MODE, m_xEnterPasteModeCB->get_active() ) );
470  bRet = true;
471  }
472 
473  return bRet;
474 }
475 
476 void ScTpLayoutOptions::Reset( const SfxItemSet* rCoreSet )
477 {
478  m_xUnitLB->set_active(-1);
479  if ( rCoreSet->GetItemState( SID_ATTR_METRIC ) >= SfxItemState::DEFAULT )
480  {
481  const SfxUInt16Item& rItem = rCoreSet->Get( SID_ATTR_METRIC );
482  FieldUnit eFieldUnit = static_cast<FieldUnit>(rItem.GetValue());
483 
484  for (sal_Int32 i = 0, nEntryCount = m_xUnitLB->get_count(); i < nEntryCount; ++i)
485  {
486  if (m_xUnitLB->get_id(i).toUInt32() == static_cast<sal_uInt32>(eFieldUnit))
487  {
488  m_xUnitLB->set_active(i);
489  break;
490  }
491  }
492  ::SetFieldUnit(*m_xTabMF, eFieldUnit);
493  }
494  m_xUnitLB->save_value();
495 
496  const SfxPoolItem* pItem;
497  if(SfxItemState::SET == rCoreSet->GetItemState(SID_ATTR_DEFTABSTOP, false, &pItem))
498  m_xTabMF->set_value(m_xTabMF->normalize(static_cast<const SfxUInt16Item*>(pItem)->GetValue()), FieldUnit::TWIP);
499  m_xTabMF->save_value();
500 
501  m_xUnitLB->save_value();
502  m_xTabMF->save_value();
503 
504  ScLkUpdMode nSet=LM_UNKNOWN;
505 
506  if(pDoc!=nullptr)
507  {
508  nSet=pDoc->GetLinkMode();
509  }
510 
511  if(nSet==LM_UNKNOWN)
512  {
513  ScAppOptions aAppOptions=SC_MOD()->GetAppOptions();
514  nSet=aAppOptions.GetLinkMode();
515  }
516 
517  switch(nSet)
518  {
519  case LM_ALWAYS: m_xAlwaysRB->set_active(true); break;
520  case LM_NEVER: m_xNeverRB->set_active(true); break;
521  case LM_ON_DEMAND: m_xRequestRB->set_active(true); break;
522  default:
523  {
524  // added to avoid warnings
525  }
526  }
527  if(SfxItemState::SET == rCoreSet->GetItemState(SID_SC_INPUT_SELECTION, false, &pItem))
528  m_xAlignCB->set_active(static_cast<const SfxBoolItem*>(pItem)->GetValue());
529 
530  if(SfxItemState::SET == rCoreSet->GetItemState(SID_SC_INPUT_SELECTIONPOS, false, &pItem))
531  m_xAlignLB->set_active(static_cast<const SfxUInt16Item*>(pItem)->GetValue());
532 
533  if(SfxItemState::SET == rCoreSet->GetItemState(SID_SC_INPUT_EDITMODE, false, &pItem))
534  m_xEditModeCB->set_active(static_cast<const SfxBoolItem*>(pItem)->GetValue());
535 
536  if(SfxItemState::SET == rCoreSet->GetItemState(SID_SC_INPUT_FMT_EXPAND, false, &pItem))
537  m_xFormatCB->set_active(static_cast<const SfxBoolItem*>(pItem)->GetValue());
538 
539  if(SfxItemState::SET == rCoreSet->GetItemState(SID_SC_INPUT_REF_EXPAND, false, &pItem))
540  m_xExpRefCB->set_active(static_cast<const SfxBoolItem*>(pItem)->GetValue());
541 
542  if (rCoreSet->HasItem(SID_SC_OPT_SORT_REF_UPDATE, &pItem))
543  m_xSortRefUpdateCB->set_active(static_cast<const SfxBoolItem*>(pItem)->GetValue());
544 
545  if(SfxItemState::SET == rCoreSet->GetItemState(SID_SC_INPUT_MARK_HEADER, false, &pItem))
546  m_xMarkHdrCB->set_active(static_cast<const SfxBoolItem*>(pItem)->GetValue());
547 
548  if(SfxItemState::SET == rCoreSet->GetItemState(SID_SC_INPUT_TEXTWYSIWYG, false, &pItem))
549  m_xTextFmtCB->set_active(static_cast<const SfxBoolItem*>(pItem)->GetValue());
550 
551  if( SfxItemState::SET == rCoreSet->GetItemState( SID_SC_INPUT_REPLCELLSWARN, false, &pItem ) )
552  m_xReplWarnCB->set_active( static_cast<const SfxBoolItem*>(pItem)->GetValue() );
553 
554  if( SfxItemState::SET == rCoreSet->GetItemState( SID_SC_INPUT_LEGACY_CELL_SELECTION, false, &pItem ) )
555  m_xLegacyCellSelectionCB->set_active( static_cast<const SfxBoolItem*>(pItem)->GetValue() );
556 
557  if( SfxItemState::SET == rCoreSet->GetItemState( SID_SC_INPUT_ENTER_PASTE_MODE, false, &pItem ) )
558  m_xEnterPasteModeCB->set_active( static_cast<const SfxBoolItem*>(pItem)->GetValue() );
559 
560  m_xAlignCB->save_state();
561  m_xAlignLB->save_value();
562  m_xEditModeCB->save_state();
563  m_xFormatCB->save_state();
564 
565  m_xExpRefCB->save_state();
566  m_xSortRefUpdateCB->save_state();
567  m_xMarkHdrCB->save_state();
568  m_xTextFmtCB->save_state();
569  m_xReplWarnCB->save_state();
570 
571  m_xLegacyCellSelectionCB->save_state();
572  m_xEnterPasteModeCB->save_state();
573 
574  AlignHdl(*m_xAlignCB);
575 
576  m_xAlwaysRB->save_state();
577  m_xNeverRB->save_state();
578  m_xRequestRB->save_state();
579 }
580 
581 void ScTpLayoutOptions::ActivatePage( const SfxItemSet& /* rCoreSet */ )
582 {
583 }
584 
586 {
587  if(pSetP)
588  FillItemSet(pSetP);
589  return DeactivateRC::LeavePage;
590 }
591 
593 {
594  const sal_Int32 nMPos = m_xUnitLB->get_active();
595  if (nMPos != -1)
596  {
597  FieldUnit eFieldUnit = static_cast<FieldUnit>(m_xUnitLB->get_id(nMPos).toUInt32());
598  sal_Int64 nVal =
599  m_xTabMF->denormalize( m_xTabMF->get_value( FieldUnit::TWIP ) );
600  ::SetFieldUnit( *m_xTabMF, eFieldUnit );
601  m_xTabMF->set_value( m_xTabMF->normalize( nVal ), FieldUnit::TWIP );
602  }
603 }
604 
606 {
607  m_xAlignLB->set_sensitive(rBox.get_active());
608 }
609 
610 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< weld::ComboBox > m_xObjGrfLB
Definition: tpview.hxx:46
std::unique_ptr< weld::CheckButton > m_xOutlineCB
Definition: tpview.hxx:56
std::pair< Color, OUString > NamedColor
virtual void ActivatePage(const SfxItemSet &) override
Definition: tpview.cxx:206
FieldUnit
SC_DLLPUBLIC ScLinkMode GetLinkMode(SCTAB nTab) const
Definition: documen3.cxx:498
virtual void ActivatePage(const SfxItemSet &) override
Definition: tpview.cxx:581
ScViewOption
Definition: viewopti.hxx:31
void InitGridOpt()
Definition: tpview.cxx:257
ScLkUpdMode GetLinkMode() const
Definition: appoptio.hxx:68
virtual bool FillItemSet(SfxItemSet *rCoreSet) override
Definition: tpview.cxx:99
virtual void Reset(const SfxItemSet *rCoreSet) override
Definition: tpview.cxx:146
std::unique_ptr< weld::CheckButton > m_xRowColHeaderCB
Definition: tpview.hxx:52
std::unique_ptr< weld::CheckButton > m_xSyncZoomCB
Definition: tpview.hxx:50
sal_uInt16 GetValue() const
std::unique_ptr< weld::CheckButton > m_xTextFmtCB
Definition: tpview.hxx:94
static SfxObjectShell * Current()
virtual ~ScTpLayoutOptions() override
Definition: tpview.cxx:353
std::unique_ptr< weld::CheckButton > m_xRangeFindCB
Definition: tpview.hxx:44
std::unique_ptr< weld::CheckButton > m_xExpRefCB
Definition: tpview.hxx:91
virtual ~ScTpContentOptions() override
Definition: tpview.cxx:88
std::unique_ptr< weld::RadioButton > m_xRequestRB
Definition: tpview.hxx:84
std::unique_ptr< weld::CheckButton > m_xGuideLineCB
Definition: tpview.hxx:36
std::unique_ptr< weld::CheckButton > m_xMarkHdrCB
Definition: tpview.hxx:93
std::unique_ptr< weld::CheckButton > m_xHScrollCB
Definition: tpview.hxx:53
std::unique_ptr< weld::CheckButton > m_xValueCB
Definition: tpview.hxx:41
virtual bool FillItemSet(SfxItemSet *rCoreSet) override
Definition: tpview.cxx:368
std::unique_ptr< weld::CheckButton > m_xLegacyCellSelectionCB
Definition: tpview.hxx:96
constexpr::Color COL_AUTO(0xFF, 0xFF, 0xFF, 0xFF)
std::unique_ptr< weld::ComboBox > m_xUnitLB
Definition: tpview.hxx:80
std::unique_ptr< weld::CheckButton > m_xClipMarkCB
Definition: tpview.hxx:43
std::unique_ptr< weld::ComboBox > m_xGridLB
Definition: tpview.hxx:32
std::unique_ptr< weld::CheckButton > m_xEditModeCB
Definition: tpview.hxx:89
std::unique_ptr< weld::CheckButton > m_xNilCB
Definition: tpview.hxx:39
void SetExchangeSupport()
std::unique_ptr< weld::CheckButton > m_xTblRegCB
Definition: tpview.hxx:55
ScLkUpdMode
Definition: global.hxx:420
std::unique_ptr< weld::CheckButton > m_xAnchorCB
Definition: tpview.hxx:42
Mode eMode
IMPL_LINK(ScTpContentOptions, SelLbObjHdl, weld::ComboBox &, rLb, void)
Definition: tpview.cxx:220
virtual void Reset(const SfxItemSet *rCoreSet) override
Definition: tpview.cxx:476
#define SC_STD_GRIDCOLOR
Definition: viewopti.hxx:61
std::unique_ptr< ScViewOptions > m_xLocalOptions
Definition: tpview.hxx:30
#define SAL_N_ELEMENTS(arr)
std::unique_ptr< weld::ComboBox > m_xDiagramLB
Definition: tpview.hxx:47
DocumentType eType
ScVObjType
Definition: viewopti.hxx:51
ScTpLayoutOptions(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rArgSet)
Definition: tpview.cxx:303
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
int i
std::unique_ptr< weld::CheckButton > m_xSummaryCB
Definition: tpview.hxx:57
std::unique_ptr< ColorListBox > m_xColorLB
Definition: tpview.hxx:34
std::unique_ptr< weld::CheckButton > m_xEnterPasteModeCB
Definition: tpview.hxx:97
#define SC_MOD()
Definition: scmod.hxx:250
std::unique_ptr< weld::CheckButton > m_xReplWarnCB
Definition: tpview.hxx:95
std::unique_ptr< weld::CheckButton > m_xAnnotCB
Definition: tpview.hxx:40
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rCoreSet)
Definition: tpview.cxx:357
std::unique_ptr< weld::CheckButton > m_xSortRefUpdateCB
Definition: tpview.hxx:92
OUString ScResId(const char *pId)
Definition: scdll.cxx:89
std::unique_ptr< weld::MetricSpinButton > m_xTabMF
Definition: tpview.hxx:81
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: tpview.cxx:585
std::unique_ptr< weld::CheckButton > m_xVScrollCB
Definition: tpview.hxx:54
std::unique_ptr< weld::CheckButton > m_xFormatCB
Definition: tpview.hxx:90
std::unique_ptr< weld::CheckButton > m_xAlignCB
Definition: tpview.hxx:87
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: tpview.cxx:213
IMPL_LINK_NOARG(ScTpLayoutOptions, MetricHdl, weld::ComboBox &, void)
Definition: tpview.cxx:592
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
OUString aName
bool HasItem(sal_uInt16 nWhich, const SfxPoolItem **ppItem=nullptr) const
std::unique_ptr< weld::CheckButton > m_xFormulaCB
Definition: tpview.hxx:38
const ScDocument & GetDocument() const
Definition: docsh.hxx:217
DeactivateRC
void SetLinkMode(ScLkUpdMode nSet)
Definition: document.hxx:2168
ScVObjMode
Definition: global.hxx:378
std::unique_ptr< weld::ComboBox > m_xDrawLB
Definition: tpview.hxx:48
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rCoreSet)
Definition: tpview.cxx:93
constexpr OUStringLiteral first
std::unique_ptr< weld::RadioButton > m_xAlwaysRB
Definition: tpview.hxx:83
ScDocument * pDoc
Definition: tpview.hxx:78
void SetLinkMode(ScLkUpdMode nSet)
Definition: appoptio.hxx:69
std::unique_ptr< weld::CheckButton > m_xBreakCB
Definition: tpview.hxx:35
std::unique_ptr< weld::RadioButton > m_xNeverRB
Definition: tpview.hxx:85
std::unique_ptr< weld::Label > m_xColorFT
Definition: tpview.hxx:33
std::unique_ptr< weld::ComboBox > m_xAlignLB
Definition: tpview.hxx:88
ScTpContentOptions(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rArgSet)
Definition: tpview.cxx:35