File indexing completed on 2024-05-12 16:35:36
0001 /* This file is part of the KDE project 0002 0003 Copyright (C) 2006 Fredrik Edemar <f_edemar@linux.se> 0004 Copyright 2002-2003 Joseph Wenninger <jowenn@kde.org> 0005 Copyright 2002 John Dailey <dailey@vt.edu> 0006 Copyright 2001-2002 Laurent Montel <montel@kde.org> 0007 Copyright 2000 Simon Hausmann <hausmann@kde.org> 0008 Copyright 1999 Torben Weis <weis@kde.org> 0009 0010 This library is free software; you can redistribute it and/or 0011 modify it under the terms of the GNU Library General Public 0012 License as published by the Free Software Foundation; either 0013 version 2 of the License, or (at your option) any later version. 0014 0015 This library is distributed in the hope that it will be useful, 0016 but WITHOUT ANY WARRANTY; without even the implied warranty of 0017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0018 Library General Public License for more details. 0019 0020 You should have received a copy of the GNU Library General Public License 0021 along with this library; see the file COPYING.LIB. If not, write to 0022 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0023 Boston, MA 02110-1301, USA. 0024 */ 0025 0026 #ifndef CALLIGRA_SHEETS_VIEW_ADAPTOR 0027 #define CALLIGRA_SHEETS_VIEW_ADAPTOR 0028 0029 #ifndef QT_NO_DBUS 0030 #include <QColor> 0031 #include <QRect> 0032 #include <QString> 0033 #include <QDBusAbstractAdaptor> 0034 #include "sheets_common_export.h" 0035 0036 namespace Calligra 0037 { 0038 namespace Sheets 0039 { 0040 class View; 0041 class CellProxy; 0042 0043 /** 0044 * The ViewAdaptor class provides access to a view on a Calligra Sheets document. 0045 */ 0046 class CALLIGRA_SHEETS_COMMON_EXPORT ViewAdaptor : public QDBusAbstractAdaptor 0047 { 0048 Q_OBJECT 0049 Q_CLASSINFO("D-Bus Interface", "org.kde.calligra.spreadsheet.view") 0050 public: 0051 explicit ViewAdaptor(View*); 0052 ~ViewAdaptor() override; 0053 0054 public Q_SLOTS: // METHODS 0055 0056 /** Return the name of the document the view looks on. */ 0057 virtual QString doc() const; 0058 /** Return the name of the map for the document. An map offers 0059 additional functionality to deal with the content of a document. */ 0060 virtual QString map() const; 0061 /** Return the name of the active sheet. */ 0062 virtual QString sheet() const; 0063 0064 virtual void changeNbOfRecentFiles(int _nb); 0065 0066 /** Hide the view. */ 0067 virtual void hide(); 0068 /** Show the view. */ 0069 virtual void show(); 0070 0071 /** Set the range of cells that should be selected. */ 0072 virtual void setSelection(const QRect& selection); 0073 /** Return the range of cells that is selected. */ 0074 virtual QRect selection(); 0075 0076 #if 0 // -> cell tool 0077 /** Display the find dialog to find something in the document. */ 0078 virtual void find(); 0079 /** Display the replace dialog to replace something in the document. */ 0080 virtual void replace(); 0081 /** Display the Conditional dialog that allows to set cell style based 0082 on certain conditions. */ 0083 virtual void conditional(); 0084 /** Display the Validity dialog that enables to set tests to confirm cell 0085 data is valid. */ 0086 virtual void validity(); 0087 /** Display the "Series" dialog that allows to insert series into cells. */ 0088 virtual void insertSeries(); 0089 /** Display the "Hyperlink" dialog that provides functionality to insert 0090 hyperlinks like URLs or E-Mails into a cell. */ 0091 virtual void insertHyperlink(); 0092 /** Display the "Go to..." dialog that enables to go to a defined cell. */ 0093 virtual void gotoCell(); 0094 /** Display the "Change Angle" dialog to offer to change the angle of a cell. */ 0095 virtual void changeAngle(); 0096 #endif 0097 virtual void preference(); 0098 /** Select the next sheet as active sheet. */ 0099 virtual void nextSheet(); 0100 /** Select the previous sheet as active sheet. */ 0101 virtual void previousSheet(); 0102 /** Select the sheet with name \p sheetName as active sheet. */ 0103 virtual bool showSheet(const QString& sheetName); 0104 #if 0 // -> cell tool 0105 /** Display the dialog to create a custom lists for sorting or autofill. */ 0106 virtual void sortList(); 0107 /** Set a name for a region of the spreadsheet. */ 0108 virtual void setAreaName(); 0109 /** Show the dialog that allows to edit or select named areas. */ 0110 virtual void showAreaName(); 0111 /** Merge the selected region. */ 0112 virtual void mergeCell(); 0113 /** Unmerge the selected region. */ 0114 virtual void dissociateCell(); 0115 /** Display the "Consolidate..." dialog. */ 0116 virtual void consolidate(); 0117 0118 /** Delete a column from the sheet. */ 0119 virtual void deleteColumn(); 0120 /** Insert a new column into the sheet. */ 0121 virtual void insertColumn(); 0122 /** Delete a row from the sheet. */ 0123 virtual void deleteRow(); 0124 /** Insert a new row into the sheet. */ 0125 virtual void insertRow(); 0126 /** Hide a row in the sheet. */ 0127 virtual void hideRow(); 0128 /** Show a row in the sheet. */ 0129 virtual void showRow(); 0130 /** Hide a column in the sheet. */ 0131 virtual void hideColumn(); 0132 /** Show a column in the sheet. */ 0133 virtual void showColumn(); 0134 /** Convert all letters to upper case. */ 0135 virtual void upper(); 0136 /** Convert all letters to lower case. */ 0137 virtual void lower(); 0138 0139 /** Equalize Column. */ 0140 virtual void equalizeColumn(); 0141 /** Equalize Row. */ 0142 virtual void equalizeRow(); 0143 0144 /** Remove the contents of the current cell. */ 0145 virtual void clearTextSelection(); 0146 /** Remove comment from the selected cells. */ 0147 virtual void clearCommentSelection(); 0148 /** Remove the validity tests on this cell. */ 0149 virtual void clearValiditySelection(); 0150 /** Remove the conditional cell styles. */ 0151 virtual void clearConditionalSelection(); 0152 /** Displays the "Goal seek" dialog. */ 0153 virtual void goalSeek(); 0154 /** Calls the Insert/Database dialog. */ 0155 virtual void insertFromDatabase(); 0156 /** Calls the Insert/Textfile dialog. */ 0157 virtual void insertFromTextfile(); 0158 /** Calls the Insert/Clipboard dialog. */ 0159 virtual void insertFromClipboard(); 0160 /** Display the "Text to Columns..." dialog. */ 0161 virtual void textToColumns(); 0162 #endif 0163 /** Copy the content of the range of cells that is selected. */ 0164 virtual void copyAsText(); 0165 0166 #if 0 // -> cell tool 0167 /** Set the cell formatting to look like your local currency. */ 0168 virtual void setSelectionMoneyFormat(bool b); 0169 /** Set the cell formatting to look like a percentage. */ 0170 virtual void setSelectionPercent(bool b); 0171 /** Make the cell text wrap onto multiple lines. */ 0172 virtual void setSelectionMultiRow(bool enable); 0173 /** Set the font size of the selected cells to the defined size. */ 0174 virtual void setSelectionSize(int size); 0175 /** Convert all letters to upper case. */ 0176 virtual void setSelectionUpper(); 0177 /** Convert all letters to lower case. */ 0178 virtual void setSelectionLower(); 0179 /** Convert First Letter to Upper Case. */ 0180 virtual void setSelectionFirstLetterUpper(); 0181 /** Print cell contents vertically. */ 0182 virtual void setSelectionVerticalText(bool enable); 0183 #endif 0184 /** Set the comment of all selected cells to the defined comment string. */ 0185 virtual void setSelectionComment(const QString& comment); 0186 #if 0 // -> cell tool 0187 /** Set the angle of all selected cells to the defined angle value. */ 0188 virtual void setSelectionAngle(int value); 0189 #endif 0190 /** Set the text color of all selected cells to the defined color value. */ 0191 virtual void setSelectionTextColor(const QColor& txtColor); 0192 /** Set the background color of all selected cells to the defined color value. */ 0193 virtual void setSelectionBgColor(const QColor& bgColor); 0194 /** Set the border color of all selected cells to the defined color value. */ 0195 virtual void setSelectionBorderColor(const QColor& bdColor); 0196 0197 #if 0 // -> cell tool 0198 /** Delete content of the range of cells that is selected. */ 0199 virtual void deleteSelection(); 0200 /** Copy the content of the range of cells that is selected. */ 0201 virtual void copySelection(); 0202 /** Cut the content of the range of cells that is selected. */ 0203 virtual void cutSelection(); 0204 #endif 0205 0206 /** Set the color of the left border. */ 0207 virtual void setLeftBorderColor(const QColor& color); 0208 /** Set the color of the top border. */ 0209 virtual void setTopBorderColor(const QColor& color); 0210 /** Set the color of the right border. */ 0211 virtual void setRightBorderColor(const QColor& color); 0212 /** Set the color of the bottom border. */ 0213 virtual void setBottomBorderColor(const QColor& color); 0214 /** Set the color of the all borders. */ 0215 virtual void setAllBorderColor(const QColor& color); 0216 /** Set the color of the outline border. */ 0217 virtual void setOutlineBorderColor(const QColor& color); 0218 #if 0 // -> cell tool 0219 /** Remove border. */ 0220 virtual void removeBorder(); 0221 0222 /** Increase the indention. */ 0223 virtual void increaseIndent(); 0224 /** Decrease the indention. */ 0225 virtual void decreaseIndent(); 0226 /** Increase the precision. */ 0227 virtual void increasePrecision(); 0228 /** Decrease the precision. */ 0229 virtual void decreasePrecision(); 0230 0231 /** Display the "Subtotals..." dialog. */ 0232 void subtotals(); 0233 /** Sort a group of cells in ascending (first to last) order. */ 0234 void sortInc(); 0235 /** Sort a group of cells in decreasing (last to first) order. */ 0236 void sortDec(); 0237 /** Display the "Layout..." dialog. */ 0238 void layoutDlg(); 0239 /** Increase the size of the font. */ 0240 void increaseFontSize(); 0241 /** Decrease the size of the font. */ 0242 void decreaseFontSize(); 0243 #endif 0244 0245 Q_SIGNALS: 0246 0247 /** This signal got emitted if this view got activated or deactivated. */ 0248 void activated(bool active); 0249 0250 /** This signal got emitted if this view got selected or unselected. */ 0251 void selected(bool select); 0252 0253 /** This signal got emitted if the selection changed. */ 0254 void selectionChanged(); 0255 0256 private: 0257 View* m_view; 0258 CellProxy* m_proxy; 0259 }; 0260 0261 } // namespace Sheets 0262 } // namespace Calligra 0263 #endif // QT_NO_DBUS 0264 0265 #endif // CALLIGRA_SHEETS_VIEW_ADAPTOR