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