~ubuntu-branches/ubuntu/breezy/koffice/breezy

« back to all changes in this revision

Viewing changes to filters/kword/ascii/asciiimport.h

  • Committer: Bazaar Package Importer
  • Author(s): Ben Burton
  • Date: 2004-05-09 11:33:00 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040509113300-vfrdadqsvjfuhn3b
Tags: 1:1.3.1-1
* New upstream bugfix release.
* Built against newer imagemagick (closes: #246623).
* Made koffice-libs/kformula recommend/depend on latex-xft-fonts, which
  provides mathematical fonts that the formula editor can use.  Also
  patched the kformula part to make these fonts the default.
* Changed kword menu hint from "WordProcessors" to "Word processors"
  (closes: #246209).
* Spellchecker configuration is now fixed (closes: #221256, #227568).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* This file is part of the KDE project
2
2
   Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>
3
3
   Copyright (C) 2000 Michael Johnson <mikej@xnet.com>
 
4
   Copyright (C) 2001, 2002 Nicolas GOUTTE <goutte@kde.org>
4
5
 
5
6
   This library is free software; you can redistribute it and/or
6
7
   modify it under the terms of the GNU Library General Public
20
21
 
21
22
#ifndef ASCIIIMPORT_H
22
23
#define ASCIIIMPORT_H
 
24
 
 
25
#include <koFilter.h>
 
26
 
 
27
class QString;
 
28
class QTextStream;
 
29
class QDomDocument;
 
30
class QDomElement;
 
31
 
23
32
#define MAXLINES  1000
24
33
#define MAXCOLUMNS 15
25
34
 
26
 
#include <qstring.h>
27
 
#include <qfile.h>
28
 
#include <qobject.h>
29
 
 
30
 
#include <koFilter.h>
31
 
#include <koStore.h>
32
 
 
33
 
 
34
 
 
35
35
 const double ptsperline = 15.0;
36
36
 const double ptsperchar = 6.0;
37
37
 const int spacespertab = 6;
38
38
 const double leftmargin = 56.0;
39
39
 
40
 
 const int shortline = 40;  // max length of a "short" line
 
40
 const uint shortline = 40;  // max length of a "short" line
41
41
 
42
42
 struct Tabs
43
43
    {
55
55
    double right;
56
56
    };
57
57
 
58
 
 
59
 
 
60
 
 
61
 
 template <class M>
62
 
 M max(M x, M y)
63
 
   {
64
 
   return (x > y) ? x : y;
65
 
   }
66
 
 
67
 
 
68
 
 
69
58
class ASCIIImport : public KoFilter {
70
59
 
71
60
    Q_OBJECT
72
61
 
73
62
public:
74
 
    ASCIIImport(KoFilter *parent, const char *name);
 
63
    ASCIIImport(KoFilter *parent, const char *name, const QStringList &);
75
64
    ASCIIImport();
76
65
    virtual ~ASCIIImport() {}
77
 
    /** filtering :) */
78
 
    virtual bool filter(const QString &fileIn, const QString &fileOut,
79
 
                        const QString &from, const QString &to,
80
 
                        const QString &config=QString::null);
81
 
 
82
 
    void WriteOutParagraph( QString name, QString type, QString text,
83
 
       int firstindent, int secondindent, QString &str);
84
 
 
85
 
    void WriteOutIndents( int firstindent, int secondindent, QString &str);
86
 
 
87
 
    int Indent( QString line);
88
 
 
89
 
    void EscapeXMLSymbols( QString &text );
90
 
 
 
66
 
 
67
    virtual KoFilter::ConversionStatus convert( const QCString& from, const QCString& to );
 
68
private: // not yet changed
 
69
#if 0
91
70
    void WriteOutTableCell( int table_no, int row, int col, Position *pos,
92
71
                          QString &str);
93
72
 
94
73
    bool Table( QString *Line, int *linecount, int no_lines,
95
74
            int table_no, QString &tbl, QString &str );
96
75
 
97
 
    int MultSpaces(QString text, int index);
98
76
 
99
77
 
100
78
    bool ListItem( QString *Line, int no_lines,
101
79
             QString &str );
102
 
 
 
80
#endif
103
81
    bool IsListItem( QString FirstLine, QChar mark );
104
82
 
105
 
    bool IsWhiteSpace(QChar c);
106
 
 
 
83
private:
 
84
    void prepareDocument(QDomDocument& mainDocument, QDomElement& mainFramesetElement);
 
85
    void processParagraph(QDomDocument& mainDocument,
 
86
        QDomElement& mainFramesetElement, const QStringList& paragraph);
 
87
    void writeOutParagraph(QDomDocument& mainDocument,
 
88
        QDomElement& mainFramesetElement,  const QString& name,
 
89
        const QString& text, const int firstindent, const int secondindent);
 
90
    int Indent(const QString& line) const;
 
91
    int MultSpaces(const QString& text, const int index) const;
 
92
    bool IsWhiteSpace(const QChar& c) const;
 
93
    QString readLine(QTextStream& textstream, bool& lastCharWasCr);
 
94
private: // converting functions
 
95
    void oldWayConvert(QTextStream& stream, QDomDocument& mainDocument,
 
96
        QDomElement& mainFramesetElement);
 
97
    void asIsConvert(QTextStream& stream, QDomDocument& mainDocument,
 
98
        QDomElement& mainFramesetElement);
 
99
    void sentenceConvert(QTextStream& stream, QDomDocument& mainDocument,
 
100
        QDomElement& mainFramesetElement);
107
101
};
108
102
#endif // ASCIIIMPORT_H