LibreOffice Module sc (master) 1
opredlin.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 <svx/colorbox.hxx>
23
24#include <appoptio.hxx>
25#include <scmod.hxx>
26#include <docsh.hxx>
27#include <svx/svxids.hrc>
28
29#include <opredlin.hxx>
30
32 : SfxTabPage(pPage, pController, "modules/scalc/ui/optchangespage.ui", "OptChangesPage", &rSet)
33 , m_xContentColorLB(new ColorListBox(m_xBuilder->weld_menu_button("changes"),
34 [this]{ return GetDialogController()->getDialog(); }))
35 , m_xRemoveColorLB(new ColorListBox(m_xBuilder->weld_menu_button("deletions"),
36 [this]{ return GetDialogController()->getDialog(); }))
37 , m_xInsertColorLB(new ColorListBox(m_xBuilder->weld_menu_button("entries"),
38 [this]{ return GetDialogController()->getDialog(); }))
39 , m_xMoveColorLB(new ColorListBox(m_xBuilder->weld_menu_button("insertions"),
40 [this]{ return GetDialogController()->getDialog(); }))
41{
42 m_xContentColorLB->SetSlotId(SID_AUTHOR_COLOR);
43 m_xRemoveColorLB->SetSlotId(SID_AUTHOR_COLOR);
44 m_xInsertColorLB->SetSlotId(SID_AUTHOR_COLOR);
45 m_xMoveColorLB->SetSlotId(SID_AUTHOR_COLOR);
46}
47
49{
50 m_xContentColorLB.reset();
51 m_xRemoveColorLB.reset();
52 m_xInsertColorLB.reset();
53 m_xMoveColorLB.reset();
54}
55
56std::unique_ptr<SfxTabPage> ScRedlineOptionsTabPage::Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet )
57{
58 return std::make_unique<ScRedlineOptionsTabPage>( pPage, pController, *rSet );
59}
60
62{
63 ScAppOptions aAppOptions=SC_MOD()->GetAppOptions();
64
65 Color nNew = m_xContentColorLB->GetSelectEntryColor();
66 aAppOptions.SetTrackContentColor(nNew);
67
68 nNew = m_xMoveColorLB->GetSelectEntryColor();
69 aAppOptions.SetTrackMoveColor(nNew);
70
71 nNew = m_xInsertColorLB->GetSelectEntryColor();
72 aAppOptions.SetTrackInsertColor(nNew);
73
74 nNew = m_xRemoveColorLB->GetSelectEntryColor();
75 aAppOptions.SetTrackDeleteColor(nNew);
76
77 SC_MOD()->SetAppOptions(aAppOptions);
78
79 // repaint (if everything would be done by Items (how it should be),
80 // this wouldn't be necessary)
81 ScDocShell* pDocSh = dynamic_cast<ScDocShell*>( SfxObjectShell::Current() );
82 if (pDocSh)
83 pDocSh->PostPaintGridAll();
84
85 return false;
86}
87
89{
90 ScAppOptions aAppOptions=SC_MOD()->GetAppOptions();
91
92 Color nColor = aAppOptions.GetTrackContentColor();
93 m_xContentColorLB->SelectEntry(nColor);
94
95 nColor = aAppOptions.GetTrackMoveColor();
96 m_xMoveColorLB->SelectEntry(nColor);
97
98 nColor = aAppOptions.GetTrackInsertColor();
99 m_xInsertColorLB->SelectEntry(nColor);
100
101 nColor = aAppOptions.GetTrackDeleteColor();
102 m_xRemoveColorLB->SelectEntry(nColor);
103}
104
105/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Color GetTrackMoveColor() const
Definition: appoptio.hxx:65
Color GetTrackInsertColor() const
Definition: appoptio.hxx:61
void SetTrackInsertColor(Color nNew)
Definition: appoptio.hxx:60
void SetTrackMoveColor(Color nNew)
Definition: appoptio.hxx:64
Color GetTrackContentColor() const
Definition: appoptio.hxx:59
void SetTrackDeleteColor(Color nNew)
Definition: appoptio.hxx:62
void SetTrackContentColor(Color nNew)
Definition: appoptio.hxx:58
Color GetTrackDeleteColor() const
Definition: appoptio.hxx:63
void PostPaintGridAll()
Definition: docsh3.cxx:183
virtual ~ScRedlineOptionsTabPage() override
Definition: opredlin.cxx:48
std::unique_ptr< ColorListBox > m_xContentColorLB
Definition: opredlin.hxx:27
std::unique_ptr< ColorListBox > m_xMoveColorLB
Definition: opredlin.hxx:30
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
Definition: opredlin.cxx:56
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: opredlin.cxx:61
virtual void Reset(const SfxItemSet *rSet) override
Definition: opredlin.cxx:88
ScRedlineOptionsTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: opredlin.cxx:31
std::unique_ptr< ColorListBox > m_xInsertColorLB
Definition: opredlin.hxx:29
std::unique_ptr< ColorListBox > m_xRemoveColorLB
Definition: opredlin.hxx:28
static SAL_WARN_UNUSED_RESULT SfxObjectShell * Current()
SfxOkDialogController * GetDialogController() const
#define SC_MOD()
Definition: scmod.hxx:247
static SfxItemSet & rSet