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