1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #undef SC_DLLIMPLEMENTATION
24 #include <viewopti.hxx>
25 #include <scresid.hxx>
29 #include <appoptio.hxx>
31 #include <svl/eitem.hxx>
32 #include <svx/colorbox.hxx>
33 #include <svtools/unitconv.hxx>
35 ScTpContentOptions::ScTpContentOptions(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rArgSet
)
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"))
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
) );
67 Link
<weld::ToggleButton
&, void> aCBHdl(LINK( this, ScTpContentOptions
, CBHdl
) );
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
);
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
);
84 m_xColorLB
->SetSlotId(SID_ATTR_CHAR_COLOR
);
85 m_xColorLB
->SetAutoDisplayColor(SC_STD_GRIDCOLOR
);
88 ScTpContentOptions::~ScTpContentOptions()
93 std::unique_ptr
<SfxTabPage
> ScTpContentOptions::Create( weld::Container
* pPage
, weld::DialogController
* pController
,
94 const SfxItemSet
* rCoreSet
)
96 return std::make_unique
<ScTpContentOptions
>(pPage
, pController
, *rCoreSet
);
99 bool ScTpContentOptions::FillItemSet( SfxItemSet
* rCoreSet
)
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())
122 NamedColor aNamedColor
= m_xColorLB
->GetSelectedEntry();
123 if (aNamedColor
.first
== COL_AUTO
)
125 aNamedColor
.first
= SC_STD_GRIDCOLOR
;
126 aNamedColor
.second
.clear();
128 m_xLocalOptions
->SetGridColor(aNamedColor
.first
, aNamedColor
.second
);
129 rCoreSet
->Put(ScTpViewItem(*m_xLocalOptions
));
132 if(m_xRangeFindCB
->get_state_changed_from_saved())
134 rCoreSet
->Put(SfxBoolItem(SID_SC_INPUT_RANGEFINDER
, m_xRangeFindCB
->get_active()));
137 if(m_xSyncZoomCB
->get_state_changed_from_saved())
139 rCoreSet
->Put(SfxBoolItem(SID_SC_OPT_SYNCZOOM
, m_xSyncZoomCB
->get_active()));
146 void ScTpContentOptions::Reset( const SfxItemSet
* rCoreSet
)
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() ) );
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
));
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
)) );
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
) );
174 m_xBreakCB
->set_active( m_xLocalOptions
->GetOption(VOPT_PAGEBREAKS
) );
175 m_xGuideLineCB
->set_active( m_xLocalOptions
->GetOption(VOPT_HELPLINES
) );
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());
182 m_xRangeFindCB
->save_state();
183 m_xSyncZoomCB
->save_state();
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();
206 void ScTpContentOptions::ActivatePage( const SfxItemSet
& rSet
)
208 const SfxPoolItem
* pItem
;
209 if(SfxItemState::SET
== rSet
.GetItemState(SID_SCVIEWOPTIONS
, false , &pItem
))
210 *m_xLocalOptions
= static_cast<const ScTpViewItem
*>(pItem
)->GetViewOptions();
213 DeactivateRC
ScTpContentOptions::DeactivatePage( SfxItemSet
* pSetP
)
217 return DeactivateRC::LeavePage
;
220 IMPL_LINK( ScTpContentOptions
, SelLbObjHdl
, weld::ComboBox
&, rLb
, void )
222 const sal_Int32 nSelPos
= rLb
.get_active();
223 ScVObjMode eMode
= ScVObjMode(nSelPos
);
224 ScVObjType eType
= VOBJ_TYPE_OLE
;
226 if ( &rLb
== m_xDiagramLB
.get() )
227 eType
= VOBJ_TYPE_CHART
;
228 else if ( &rLb
== m_xDrawLB
.get() )
229 eType
= VOBJ_TYPE_DRAW
;
231 m_xLocalOptions
->SetObjMode( eType
, eMode
);
234 IMPL_LINK( ScTpContentOptions
, CBHdl
, weld::ToggleButton
&, rBtn
, void )
236 ScViewOption eOption
= VOPT_FORMULAS
;
237 bool bChecked
= rBtn
.get_active();
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
;
254 m_xLocalOptions
->SetOption( eOption
, bChecked
);
257 void ScTpContentOptions::InitGridOpt()
259 bool bGrid
= m_xLocalOptions
->GetOption( VOPT_GRID
);
260 bool bGridOnTop
= m_xLocalOptions
->GetOption( VOPT_GRID_ONTOP
);
261 sal_Int32 nSelPos
= 0;
263 if ( bGrid
|| bGridOnTop
)
265 m_xColorFT
->set_sensitive(true);
266 m_xColorLB
->set_sensitive(true);
274 m_xColorFT
->set_sensitive(false);
275 m_xColorLB
->set_sensitive(false);
279 m_xGridLB
->set_active (nSelPos
);
281 // select grid color entry
283 Color aCol
= m_xLocalOptions
->GetGridColor( &aName
);
285 if (aName
.trim().isEmpty() && aCol
== SC_STD_GRIDCOLOR
)
288 m_xColorLB
->SelectEntry(std::make_pair(aCol
, aName
));
291 IMPL_LINK( ScTpContentOptions
, GridHdl
, weld::ComboBox
&, rLb
, void )
293 sal_Int32 nSelPos
= rLb
.get_active();
294 bool bGrid
= ( nSelPos
<= 1 );
295 bool bGridOnTop
= ( nSelPos
== 1 );
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
);
303 ScTpLayoutOptions::ScTpLayoutOptions(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rArgSet
)
304 : SfxTabPage(pPage
, pController
, "modules/scalc/ui/scgeneralpage.ui", "ScGeneralPage", &rArgSet
)
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"))
323 SetExchangeSupport();
325 m_xUnitLB
->connect_changed( LINK( this, ScTpLayoutOptions
, MetricHdl
) );
326 m_xAlignCB
->connect_toggled(LINK(this, ScTpLayoutOptions
, AlignHdl
));
328 for (size_t i
= 0; i
< SAL_N_ELEMENTS(SCSTR_UNIT
); ++i
)
330 OUString sMetric
= ScResId(SCSTR_UNIT
[i
].first
);
331 FieldUnit eFUnit
= SCSTR_UNIT
[i
].second
;
337 case FieldUnit::POINT
:
338 case FieldUnit::PICA
:
339 case FieldUnit::INCH
:
341 // only use these metrics
342 m_xUnitLB
->append(OUString::number(static_cast<sal_uInt32
>(eFUnit
)), sMetric
);
347 // added to avoid warnings
353 ScTpLayoutOptions::~ScTpLayoutOptions()
357 std::unique_ptr
<SfxTabPage
> ScTpLayoutOptions::Create( weld::Container
* pPage
, weld::DialogController
* pController
,
358 const SfxItemSet
* rCoreSet
)
360 auto xNew
= std::make_unique
<ScTpLayoutOptions
>(pPage
, pController
, *rCoreSet
);
362 ScDocShell
* pDocSh
= dynamic_cast< ScDocShell
*>( SfxObjectShell::Current() );
364 xNew
->pDoc
= &pDocSh
->GetDocument();
368 bool ScTpLayoutOptions::FillItemSet( SfxItemSet
* rCoreSet
)
371 if (m_xUnitLB
->get_value_changed_from_saved())
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
) );
379 if (m_xTabMF
->get_value_changed_from_saved())
381 rCoreSet
->Put(SfxUInt16Item(SID_ATTR_DEFTABSTOP
,
382 sal::static_int_cast
<sal_uInt16
>( m_xTabMF
->denormalize(m_xTabMF
->get_value(FieldUnit::TWIP
)) )));
386 ScLkUpdMode nSet
=LM_ALWAYS
;
388 if (m_xRequestRB
->get_active())
392 else if (m_xNeverRB
->get_active())
397 if (m_xRequestRB
->get_state_changed_from_saved() ||
398 m_xNeverRB
->get_state_changed_from_saved() )
401 pDoc
->SetLinkMode(nSet
);
402 ScAppOptions aAppOptions
=SC_MOD()->GetAppOptions();
403 aAppOptions
.SetLinkMode(nSet
);
404 SC_MOD()->SetAppOptions(aAppOptions
);
407 if (m_xAlignCB
->get_state_changed_from_saved())
409 rCoreSet
->Put(SfxBoolItem(SID_SC_INPUT_SELECTION
, m_xAlignCB
->get_active()));
413 if (m_xAlignLB
->get_value_changed_from_saved())
415 rCoreSet
->Put(SfxUInt16Item(SID_SC_INPUT_SELECTIONPOS
, m_xAlignLB
->get_active()));
419 if (m_xEditModeCB
->get_state_changed_from_saved())
421 rCoreSet
->Put(SfxBoolItem(SID_SC_INPUT_EDITMODE
, m_xEditModeCB
->get_active()));
425 if (m_xFormatCB
->get_state_changed_from_saved())
427 rCoreSet
->Put(SfxBoolItem(SID_SC_INPUT_FMT_EXPAND
, m_xFormatCB
->get_active()));
431 if (m_xExpRefCB
->get_state_changed_from_saved())
433 rCoreSet
->Put(SfxBoolItem(SID_SC_INPUT_REF_EXPAND
, m_xExpRefCB
->get_active()));
437 if (m_xSortRefUpdateCB
->get_state_changed_from_saved())
439 rCoreSet
->Put(SfxBoolItem(SID_SC_OPT_SORT_REF_UPDATE
, m_xSortRefUpdateCB
->get_active()));
443 if (m_xMarkHdrCB
->get_state_changed_from_saved())
445 rCoreSet
->Put(SfxBoolItem(SID_SC_INPUT_MARK_HEADER
, m_xMarkHdrCB
->get_active()));
449 if (m_xTextFmtCB
->get_state_changed_from_saved())
451 rCoreSet
->Put(SfxBoolItem(SID_SC_INPUT_TEXTWYSIWYG
, m_xTextFmtCB
->get_active()));
455 if (m_xReplWarnCB
->get_state_changed_from_saved())
457 rCoreSet
->Put( SfxBoolItem( SID_SC_INPUT_REPLCELLSWARN
, m_xReplWarnCB
->get_active() ) );
461 if (m_xLegacyCellSelectionCB
->get_state_changed_from_saved())
463 rCoreSet
->Put( SfxBoolItem( SID_SC_INPUT_LEGACY_CELL_SELECTION
, m_xLegacyCellSelectionCB
->get_active() ) );
467 if (m_xEnterPasteModeCB
->get_state_changed_from_saved())
469 rCoreSet
->Put( SfxBoolItem( SID_SC_INPUT_ENTER_PASTE_MODE
, m_xEnterPasteModeCB
->get_active() ) );
476 void ScTpLayoutOptions::Reset( const SfxItemSet
* rCoreSet
)
478 m_xUnitLB
->set_active(-1);
479 if ( rCoreSet
->GetItemState( SID_ATTR_METRIC
) >= SfxItemState::DEFAULT
)
481 const SfxUInt16Item
& rItem
= rCoreSet
->Get( SID_ATTR_METRIC
);
482 FieldUnit eFieldUnit
= static_cast<FieldUnit
>(rItem
.GetValue());
484 for (sal_Int32 i
= 0, nEntryCount
= m_xUnitLB
->get_count(); i
< nEntryCount
; ++i
)
486 if (m_xUnitLB
->get_id(i
).toUInt32() == static_cast<sal_uInt32
>(eFieldUnit
))
488 m_xUnitLB
->set_active(i
);
492 ::SetFieldUnit(*m_xTabMF
, eFieldUnit
);
494 m_xUnitLB
->save_value();
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();
501 m_xUnitLB
->save_value();
502 m_xTabMF
->save_value();
504 ScLkUpdMode nSet
=LM_UNKNOWN
;
508 nSet
=pDoc
->GetLinkMode();
513 ScAppOptions aAppOptions
=SC_MOD()->GetAppOptions();
514 nSet
=aAppOptions
.GetLinkMode();
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;
524 // added to avoid warnings
527 if(SfxItemState::SET
== rCoreSet
->GetItemState(SID_SC_INPUT_SELECTION
, false, &pItem
))
528 m_xAlignCB
->set_active(static_cast<const SfxBoolItem
*>(pItem
)->GetValue());
530 if(SfxItemState::SET
== rCoreSet
->GetItemState(SID_SC_INPUT_SELECTIONPOS
, false, &pItem
))
531 m_xAlignLB
->set_active(static_cast<const SfxUInt16Item
*>(pItem
)->GetValue());
533 if(SfxItemState::SET
== rCoreSet
->GetItemState(SID_SC_INPUT_EDITMODE
, false, &pItem
))
534 m_xEditModeCB
->set_active(static_cast<const SfxBoolItem
*>(pItem
)->GetValue());
536 if(SfxItemState::SET
== rCoreSet
->GetItemState(SID_SC_INPUT_FMT_EXPAND
, false, &pItem
))
537 m_xFormatCB
->set_active(static_cast<const SfxBoolItem
*>(pItem
)->GetValue());
539 if(SfxItemState::SET
== rCoreSet
->GetItemState(SID_SC_INPUT_REF_EXPAND
, false, &pItem
))
540 m_xExpRefCB
->set_active(static_cast<const SfxBoolItem
*>(pItem
)->GetValue());
542 if (rCoreSet
->HasItem(SID_SC_OPT_SORT_REF_UPDATE
, &pItem
))
543 m_xSortRefUpdateCB
->set_active(static_cast<const SfxBoolItem
*>(pItem
)->GetValue());
545 if(SfxItemState::SET
== rCoreSet
->GetItemState(SID_SC_INPUT_MARK_HEADER
, false, &pItem
))
546 m_xMarkHdrCB
->set_active(static_cast<const SfxBoolItem
*>(pItem
)->GetValue());
548 if(SfxItemState::SET
== rCoreSet
->GetItemState(SID_SC_INPUT_TEXTWYSIWYG
, false, &pItem
))
549 m_xTextFmtCB
->set_active(static_cast<const SfxBoolItem
*>(pItem
)->GetValue());
551 if( SfxItemState::SET
== rCoreSet
->GetItemState( SID_SC_INPUT_REPLCELLSWARN
, false, &pItem
) )
552 m_xReplWarnCB
->set_active( static_cast<const SfxBoolItem
*>(pItem
)->GetValue() );
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() );
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() );
560 m_xAlignCB
->save_state();
561 m_xAlignLB
->save_value();
562 m_xEditModeCB
->save_state();
563 m_xFormatCB
->save_state();
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();
571 m_xLegacyCellSelectionCB
->save_state();
572 m_xEnterPasteModeCB
->save_state();
574 AlignHdl(*m_xAlignCB
);
576 m_xAlwaysRB
->save_state();
577 m_xNeverRB
->save_state();
578 m_xRequestRB
->save_state();
581 void ScTpLayoutOptions::ActivatePage( const SfxItemSet
& /* rCoreSet */ )
585 DeactivateRC
ScTpLayoutOptions::DeactivatePage( SfxItemSet
* pSetP
)
589 return DeactivateRC::LeavePage
;
592 IMPL_LINK_NOARG(ScTpLayoutOptions
, MetricHdl
, weld::ComboBox
&, void)
594 const sal_Int32 nMPos
= m_xUnitLB
->get_active();
597 FieldUnit eFieldUnit
= static_cast<FieldUnit
>(m_xUnitLB
->get_id(nMPos
).toUInt32());
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
);
605 IMPL_LINK(ScTpLayoutOptions
, AlignHdl
, weld::ToggleButton
&, rBox
, void)
607 m_xAlignLB
->set_sensitive(rBox
.get_active());
610 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */