filters

filterbase.cpp
1/* This file is part of the KDE project
2 Copyright (C) 1999 Werner Trobin <trobin@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18*/
19
20#include <filterbase.h>
21
22FilterBase::FilterBase() : TQObject() {
23 m_success=true;
24 m_ready=false;
25}
26
27FilterBase::FilterBase(TQStringList &oleStreams) : TQObject() {
28 FilterBase();
29 m_oleStreams = oleStreams;
30}
31
32bool FilterBase::filter() {
33 TQString newstr;
34
35 // Page sizes, margins etc. all in points.
36
37 const unsigned height = 841; // Height.
38 const unsigned width = 595; // Width.
39 const unsigned hMargin = 28; // Horizontal margin.
40 const unsigned vMargin = 42; // Vertical margin.
41
42 newstr = TQString("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE DOC >\n"
43 "<DOC author=\"Reginald Stadlbauer and Torben Weis\" email=\"reggie@kde.org and weis@kde.org\" editor=\"KWord\" mime=\"application/x-kword\">\n"
44 " <PAPER format=\"1\" ptWidth=\"595\" ptHeight=\"841\" mmWidth =\"210\" mmHeight=\"297\" inchWidth =\"8.26772\" inchHeight=\"11.6929\" orientation=\"0\" columns=\"1\" ptColumnspc=\"2\" mmColumnspc=\"1\" inchColumnspc=\"0.0393701\" hType=\"0\" fType=\"0\" ptHeadBody=\"9\" ptFootBody=\"9\" mmHeadBody=\"3.5\" mmFootBody=\"3.5\" inchHeadBody=\"0.137795\" inchFootBody=\"0.137795\">\n"
45 " <PAPERBORDERS mmLeft=\"10\" mmTop=\"15\" mmRight=\"10\" mmBottom=\"15\" ptLeft=\"");
46 newstr.append(TQString::number(hMargin));
47 newstr.append("\" ptTop=\"");
48 newstr.append(TQString::number(vMargin));
49 newstr.append("\" ptRight=\"");
50 newstr.append(TQString::number(hMargin));
51 newstr.append("\" ptBottom=\"");
52 newstr.append(TQString::number(vMargin));
53 newstr.append("\" inchLeft=\"0.393701\" inchTop=\"0.590551\" inchRight=\"0.393701\" inchBottom=\"0.590551\"/>\n"
54 " </PAPER>\n"
55 " <ATTRIBUTES processing=\"0\" standardpage=\"1\" hasHeader=\"0\" hasFooter=\"0\" unit=\"mm\"/>\n"
56 " <FOOTNOTEMGR>\n"
57 " <START value=\"1\"/>\n"
58 " <FORMAT superscript=\"1\" type=\"1\"/>\n"
59 " <FIRSTPARAG ref=\"(null)\"/>\n"
60 " </FOOTNOTEMGR>\n"
61 " <FRAMESETS>\n");
62 newstr.append(
63 " <FRAMESET frameType=\"1\" frameInfo=\"0\" removeable=\"0\" visible=\"1\">\n"
64 " <FRAME left=\"");
65 newstr.append(TQString::number(hMargin));
66 newstr.append("\" top=\"");
67 newstr.append(TQString::number(vMargin));
68 newstr.append("\" right=\"");
69 newstr.append(TQString::number(width - hMargin));
70 newstr.append("\" bottom=\"");
71 newstr.append(TQString::number(height - vMargin));
72 newstr.append("\" runaround=\"1\" runaGapPT=\"2\" runaGapMM=\"1\" runaGapINCH=\"0.0393701\" lWidth=\"1\" lRed=\"255\" lGreen=\"255\" lBlue=\"255\" lStyle=\"0\" rWidth=\"1\" rRed=\"255\" rGreen=\"255\" rBlue=\"255\" rStyle=\"0\" tWidth=\"1\" tRed=\"255\" tGreen=\"255\" tBlue=\"255\" tStyle=\"0\" bWidth=\"1\" bRed=\"255\" bGreen=\"255\" bBlue=\"255\" bStyle=\"0\" bkRed=\"255\" bkGreen=\"255\" bkBlue=\"255\" bleftpt=\"0\" bleftmm=\"0\" bleftinch=\"0\" brightpt=\"0\" brightmm=\"0\" brightinch=\"0\" btoppt=\"0\" btopmm=\"0\" btopinch=\"0\" bbottompt=\"0\" bbottommm=\"0\" bbottominch=\"0");
73 newstr.append("\" autoCreateNewFrame=\"1\" newFrameBehaviour=\"0\"/>\n"
74 " <PARAGRAPH>\n"
75 " <TEXT>");
76 newstr.append("Cannot import OLE streams of type: ");
77 newstr.append(m_oleStreams.join(","));
78 newstr.append("</TEXT>\n"
79 " </PARAGRAPH>\n"
80 " </FRAMESET>\n");
81 newstr.append(
82 " </FRAMESETS>\n"
83 "</DOC>\n");
84 m_part=TQDomDocument("doc");
85 m_part.setContent(newstr);
86 m_success=true;
87 m_ready=true;
88 return m_success;
89}
90
91#include <filterbase.moc>