1 /* This file is part of the KDE project
2 Copyright 2005-2006 Stefan Nikolaus <stefan.nikolaus@kdemail.net>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18 */
19
20 // Local
21 #include "IndentationCommand.h"
22
23 #include <KLocalizedString>
24
25 #include "ApplicationSettings.h"
26 #include "Cell.h"
27 #include "CellStorage.h"
28 #include "Map.h"
29 #include "Sheet.h"
30 #include "Style.h"
31
32 using namespace Calligra::Sheets;
33
IndentationCommand()34 IndentationCommand::IndentationCommand()
35 : AbstractRegionCommand()
36 {
37 setText(kundo2_i18n("Increase Indentation"));
38 }
39
mainProcessing()40 bool IndentationCommand::mainProcessing()
41 {
42 Style style;
43 if (!m_reverse) {
44 // increase the indentation
45 style.setIndentation(m_sheet->map()->settings()->indentValue());
46 } else { // m_reverse
47 // decrease the indentation
48 style.setIndentation(-m_sheet->map()->settings()->indentValue());
49 }
50 m_sheet->cellStorage()->setStyle(*this, style);
51 return true;
52 }
53
postProcessing()54 bool IndentationCommand::postProcessing()
55 {
56 return true;
57 }
58
setReverse(bool reverse)59 void IndentationCommand::setReverse(bool reverse)
60 {
61 AbstractRegionCommand::setReverse(reverse);
62 if (!m_reverse)
63 setText(kundo2_i18n("Increase Indentation"));
64 else
65 setText(kundo2_i18n("Decrease Indentation"));
66 }
67