File indexing completed on 2024-05-19 16:08:01

0001 /* This file is part of the KDE project
0002    Copyright 2005-2006 Stefan Nikolaus <stefan.nikolaus@kdemail.net>
0003 
0004    This library is free software; you can redistribute it and/or
0005    modify it under the terms of the GNU Library General Public
0006    License as published by the Free Software Foundation; either
0007    version 2 of the License, or (at your option) any later version.
0008 
0009    This library is distributed in the hope that it will be useful,
0010    but WITHOUT ANY WARRANTY; without even the implied warranty of
0011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012    Library General Public License for more details.
0013 
0014    You should have received a copy of the GNU Library General Public License
0015    along with this library; see the file COPYING.LIB.  If not, write to
0016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017    Boston, MA 02110-1301, USA.
0018 */
0019 
0020 // Local
0021 #include "IndentationCommand.h"
0022 
0023 #include <KLocalizedString>
0024 
0025 #include "ApplicationSettings.h"
0026 #include "Cell.h"
0027 #include "CellStorage.h"
0028 #include "Map.h"
0029 #include "Sheet.h"
0030 #include "Style.h"
0031 
0032 using namespace Calligra::Sheets;
0033 
0034 IndentationCommand::IndentationCommand()
0035         : AbstractRegionCommand()
0036 {
0037     setText(kundo2_i18n("Increase Indentation"));
0038 }
0039 
0040 bool IndentationCommand::mainProcessing()
0041 {
0042     Style style;
0043     if (!m_reverse) {
0044         // increase the indentation
0045         style.setIndentation(m_sheet->map()->settings()->indentValue());
0046     } else { // m_reverse
0047         // decrease the indentation
0048         style.setIndentation(-m_sheet->map()->settings()->indentValue());
0049     }
0050     m_sheet->cellStorage()->setStyle(*this, style);
0051     return true;
0052 }
0053 
0054 bool IndentationCommand::postProcessing()
0055 {
0056     return true;
0057 }
0058 
0059 void IndentationCommand::setReverse(bool reverse)
0060 {
0061     AbstractRegionCommand::setReverse(reverse);
0062     if (!m_reverse)
0063         setText(kundo2_i18n("Increase Indentation"));
0064     else
0065         setText(kundo2_i18n("Decrease Indentation"));
0066 }