kspread

Util.h

Go to the documentation of this file.
00001 /* This file is part of the KDE project
00002    Copyright 2006,2007 Stefan Nikolaus <stefan.nikolaus@kdemail.net>
00003    Copyright 1998,1999 Torben Weis <weis@kde.org>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018    Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef KSPREAD_UTIL
00022 #define KSPREAD_UTIL
00023 
00024 #include <QString>
00025 #include <QRect>
00026 
00027 #include "kspread_export.h"
00028 #include <KoXmlReader.h>
00029 
00030 #include "Global.h"
00031 #include "Value.h"
00032 
00033 class QFont;
00034 class QPen;
00035 class QDomElement;
00036 class QDomDocument;
00037 
00038 class KLocale;
00039 
00040 bool util_isPointValid(const QPoint& point);
00041 bool util_isRectValid(const QRect& rect);
00042 
00043 namespace KSpread
00044 {
00045 class Cell;
00046 class Map;
00047 class Sheet;
00048 
00049 namespace Util {
00056 KSPREAD_EXPORT int decodeColumnLabelText(const QString &labelText);
00057 
00062 KSPREAD_EXPORT QString encodeColumnLabelText(int column);
00063 
00064 //Return true when it's a reference to cell from sheet.
00065 KSPREAD_EXPORT bool localReferenceAnchor(const QString &_ref);
00066 
00067 // TODO Stefan: used nowhere
00068 int         penCompare(QPen const & pen1, QPen const & pen2);
00069 }
00070 
00076 namespace NativeFormat {
00080 QDomElement createElement(const QString & tagName, const QFont & font, QDomDocument & doc);
00081 
00085 QDomElement createElement(const QString & tagname, const QPen & pen, QDomDocument & doc);
00086 
00090 QFont       toFont(KoXmlElement & element);
00091 
00095 QPen        toPen(KoXmlElement & element);
00096 }
00097 
00103 namespace Odf {
00109 QString encodePen(const QPen& pen);
00110 
00116 QPen decodePen(const QString &str);
00117 
00125 // TODO check visibility
00126 KSPREAD_EXPORT QString decodeFormula(const QString& expr, const KLocale* locale = 0, QString namespacePrefix = QString());
00127 
00135 KSPREAD_EXPORT QString encodeFormula(const QString& expr, const KLocale* locale = 0);
00136 
00140 KSPREAD_EXPORT QString convertRefToRange(const QString & sheet, const QRect & rect);
00141 
00145 KSPREAD_EXPORT QString convertRefToBase(const QString & sheet, const QRect & rect);
00146 
00150 KSPREAD_EXPORT QString convertRangeToRef(const QString & sheetName, const QRect & _area);
00151 }
00152 
00153 } // namespace KSpread
00154 
00155 #endif // KSPREAD_UTIL