File: gnumericimport.h

package info (click to toggle)
calligra 1%3A25.04.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 309,164 kB
  • sloc: cpp: 667,890; xml: 126,105; perl: 2,724; python: 2,497; yacc: 1,817; ansic: 1,326; sh: 1,223; lex: 1,107; javascript: 495; makefile: 24
file content (67 lines) | stat: -rw-r--r-- 1,907 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* This file is part of the KDE project
   SPDX-FileCopyrightText: 1999 David Faure <faure@kde.org>

   SPDX-License-Identifier: LGPL-2.0-or-later
*/

#ifndef GNUMERICIMPORT_H
#define GNUMERICIMPORT_H

#include <KoFilter.h>

#include <QDate>
#include <QVariantList>

class QDomElement;
class QDomNode;

namespace Calligra
{
namespace Sheets
{
class Cell;
class Sheet;
}
}

class GNUMERICFilter : public KoFilter
{
    Q_OBJECT
public:
    GNUMERICFilter(QObject *parent, const QVariantList &);
    ~GNUMERICFilter() override = default;

    KoFilter::ConversionStatus convert(const QByteArray &from, const QByteArray &to) override;

    enum borderStyle {
        Left,
        Right,
        Top,
        Bottom,
        Diagonal,
        Revdiagonal
    };

private:
    class GnumericDate : public QDate
    {
    public:
        static uint greg2jul(int y, int m, int d);
        static void jul2greg(double num, int &y, int &m, int &d);
        static QTime getTime(double num);
    };

    void dateInit();
    QString convertVars(QString const &str, Calligra::Sheets::Sheet *table) const;
    void ParsePrintInfo(QDomNode const &printInfo, Calligra::Sheets::Sheet *table);
    void ParseFormat(QString const &formatString, const Calligra::Sheets::Cell &kspread_cell);
    void setStyleInfo(QDomNode *sheet, Calligra::Sheets::Sheet *table);
    bool setType(const Calligra::Sheets::Cell &kspread_cell, QString const &formatString, QString &cell_content);
    void convertFormula(QString &formula) const;
    void importBorder(QDomElement border, borderStyle _style, const Calligra::Sheets::Cell &cell);
    void ParseBorder(QDomElement &gmr_styleborder, const Calligra::Sheets::Cell &kspread_cell);
    double parseAttribute(const QDomElement &_element);

    void setText(Calligra::Sheets::Sheet *sheet, int row, int column, const QString &text, bool asString = false);
};
#endif // GNUMERICIMPORT_H