Warning, file /rolisteam/rolisteam/src/libraries/rwidgets/editors/noteeditor/format_OO_oasis_/OOFormat.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 #ifndef OOFORMAT_H
0002 #define OOFORMAT_H
0003 #include "FoColorName.h"
0004 #include "rwidgets_global.h"
0005 #include <QApplication>
0006 #include <QColor>
0007 #include <QCryptographicHash>
0008 #include <QDebug>
0009 #include <QDomDocument>
0010 #include <QTextDocument>
0011 #include <QTextTableFormat>
0012 #include <QtCore>
0013 
0014 static const int InterSpace= 15; /* distance from page 1 to 2 */
0015 static const int SliderTopHeight= 28;
0016 static const int SliderLeftHeight= 28;
0017 static const int MaximumPages= 99;
0018 static const int BorderShadow= 5;
0019 
0020 static const int PageSizeID= 824;
0021 static const int PageMarginID= 825;
0022 static const int LayerCss2ID= 826; /* layer css on documents propritety as QString */
0023 static const int CellBorderStyleID= 827;
0024 
0025 static const qreal DEBUgletterspacing= 99.9;
0026 static const int DEBUgdefaultFontPointSize= 10;
0027 
0028 static const int CellDomelementID= 2308;
0029 
0030 #define _LINK_COLOR_ QColor("#dc0000")
0031 
0032 #define _NOTLINKGREB_ QString("http://qmake.net/")
0033 
0034 /*  created */
0035 /*
0036 static QString bulletChar(const QTextBlock &block)
0037 {
0038     Q_ASSERT(block.textList());
0039     QTextListFormat::Style style = block.textList()->format().style();
0040     if (style == QTextListFormat::ListDecimal)
0041         return QString::number(block.textList()->itemNumber(block));
0042     if (style == QTextListFormat::ListLowerAlpha)
0043         return QChar('a' + block.textList()->itemNumber(block));
0044     if (style == QTextListFormat::ListUpperAlpha)
0045         return QChar('A' + block.textList()->itemNumber(block));
0046 
0047     return bulletChar(style);
0048 }
0049 */
0050 
0051 QString ootrimmed(QString txt, const QString txttransform= QString("none"));
0052 QTextCharFormat PreFormatChar(QTextCharFormat format= QTextCharFormat());
0053 QTextBlockFormat DefaultMargin(QTextBlockFormat rootformats= QTextBlockFormat());
0054 QTextCharFormat DefaultCharFormats(bool qtwritteln= false, QTextCharFormat format= QTextCharFormat());
0055 QByteArray CatDomElement(const QDomElement e);
0056 #ifdef _OOREADRELEASE_
0057 QString cssGroup(const QDomElement e);
0058 #endif
0059 QTextFrameFormat DefaultFrameFormat();
0060 
0061 class RWIDGET_EXPORT ReadWriteBuf
0062 {
0063 public:
0064     ReadWriteBuf(const QString xml= QString()) : d(new QBuffer())
0065     {
0066         d->open(QIODevice::ReadWrite);
0067         start();
0068         if(xml.size() > 0)
0069             write(xml);
0070     }
0071     bool clear()
0072     {
0073         d->write(QByteArray());
0074         start();
0075         return d->bytesAvailable() == 0 ? true : false;
0076     }
0077     qint64 write(const QString dat)
0078     {
0079         QByteArray chunk;
0080         chunk.append(dat.toUtf8());
0081         d->write(chunk);
0082         start();
0083         return d->bytesAvailable();
0084     }
0085     qint64 write(const QByteArray dat)
0086     {
0087         d->write(dat);
0088         start();
0089         return d->bytesAvailable();
0090     }
0091     void start() { d->seek(0); }
0092     bool LoadFile(const QString file)
0093     {
0094         if(clear())
0095         {
0096             QFile f(file);
0097             if(f.exists())
0098             {
0099                 if(f.open(QFile::ReadOnly))
0100                 {
0101                     d->write(f.readAll());
0102                     f.close();
0103                     start();
0104                     return true;
0105                 }
0106             }
0107         }
0108         return false;
0109     }
0110     bool PutOnFile(const QString file)
0111     {
0112         QFile f(file);
0113         start();
0114         if(f.open(QFile::WriteOnly))
0115         {
0116             auto bi= f.write(d->readAll());
0117             f.close();
0118             start();
0119             return bi > 0 ? true : false;
0120         }
0121         return false;
0122     }
0123     bool isValid() { return doc.setContent(stream(), false, 0, 0, 0); }
0124     QDomDocument Dom() { return doc; }
0125 
0126     QIODevice* device() { return d; }
0127     QByteArray stream() { return d->data(); }
0128     QString toString() { return QString(d->data()); }
0129     QDomDocument doc;
0130     QBuffer* d;
0131 };
0132 
0133 class RWIDGET_EXPORT OOFormat : public QObject
0134 {
0135     Q_OBJECT
0136     //
0137 public:
0138     OOFormat(QObject* parent= nullptr);
0139     QString hashGenerator(const QString name) const;
0140     QTextDocument* Qdoc;
0141     FopColor* FoCol;
0142 };
0143 
0144 //
0145 #endif // OOFORMAT_H