File indexing completed on 2024-05-12 16:35:25
0001 /* This file is part of the KDE project 0002 Copyright (C) 2012-2013 Jigar Raisinghani <jigarraisinghani@gmail.com> 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 "pivotsubtotals.h" 0022 #include "ui_pivotsubtotals.h" 0023 0024 #include "Sheet.h" 0025 #include "ui/Selection.h" 0026 0027 using namespace Calligra::Sheets; 0028 0029 class PivotSubTotals::Private{ 0030 public: 0031 Selection *selection; 0032 Ui::PivotSubTotals mainWidget; 0033 }; 0034 0035 0036 PivotSubTotals::PivotSubTotals(QWidget* parent,Selection* selection): 0037 KoDialog(parent), 0038 d(new Private) 0039 { 0040 0041 QWidget* widget = new QWidget(this); 0042 d->mainWidget.setupUi(widget); 0043 setMainWidget(widget); 0044 d->selection=selection; 0045 d->mainWidget.None->setChecked(true); 0046 d->mainWidget.SortBy->setChecked(true); 0047 selectLabels(); 0048 0049 } 0050 public: 0051 explicit PivotOptions(QWidget* parent, Selection* selection); 0052 ~PivotOptions(); 0053 QString returnFunction(); 0054 public Q_SLOTS: 0055 void on_Ok_clicked(); 0056 private: 0057 0058 // void selectBase(); 0059 class Private; 0060 Private *const d; 0061 0062 void PivotFilters::selectLabels() 0063 { 0064 Sheet *const sheet = d->selection->lastSheet(); 0065 const QRect range = d->selection->lastRange(); 0066 0067 int r = range.right(); 0068 int row = range.top(); 0069 0070 Cell cell; 0071 0072 QString text; 0073 0074 int index = 0; 0075 for (int i = range.left(); i <= r; ++i) { 0076 cell = Cell(sheet, i, row); 0077 text = cell.displayText(); 0078 0079 if(text.length() >0) 0080 { 0081 d->mainWidget.LabelSelect->addItem(text); 0082 } 0083 } 0084 } 0085 0086 PivotSubTotals::~PivotSubTotals() 0087 { 0088 delete d; 0089 }