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