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