filters

filterbase.cc

00001 /* This file is part of the KDE project
00002    Copyright (C) 1999 Werner Trobin <trobin@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00017    Boston, MA 02111-1307, USA.
00018 */
00019 
00020 #include <filterbase.h>
00021 
00022 FilterBase::FilterBase() : QObject() {
00023     m_success=true;
00024     m_ready=false;
00025 }
00026 
00027 FilterBase::FilterBase(QStringList &oleStreams) : QObject() {
00028     FilterBase();
00029     m_oleStreams = oleStreams;
00030 }
00031 
00032 bool FilterBase::filter() {
00033     QString newstr;
00034 
00035     // Page sizes, margins etc. all in points.
00036 
00037     const unsigned height = 841; // Height.
00038     const unsigned width = 595;  // Width.
00039     const unsigned hMargin = 28; // Horizontal margin.
00040     const unsigned vMargin = 42; // Vertical margin.
00041 
00042     newstr = QString("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE DOC >\n"
00043         "<DOC author=\"Reginald Stadlbauer and Torben Weis\" email=\"reggie@kde.org and weis@kde.org\" editor=\"KWord\" mime=\"application/x-kword\">\n"
00044         " <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"
00045         "  <PAPERBORDERS mmLeft=\"10\" mmTop=\"15\" mmRight=\"10\" mmBottom=\"15\" ptLeft=\"");
00046     newstr.append(QString::number(hMargin));
00047     newstr.append("\" ptTop=\"");
00048     newstr.append(QString::number(vMargin));
00049     newstr.append("\" ptRight=\"");
00050     newstr.append(QString::number(hMargin));
00051     newstr.append("\" ptBottom=\"");
00052     newstr.append(QString::number(vMargin));
00053     newstr.append("\" inchLeft=\"0.393701\" inchTop=\"0.590551\" inchRight=\"0.393701\" inchBottom=\"0.590551\"/>\n"
00054         " </PAPER>\n"
00055         " <ATTRIBUTES processing=\"0\" standardpage=\"1\" hasHeader=\"0\" hasFooter=\"0\" unit=\"mm\"/>\n"
00056         " <FOOTNOTEMGR>\n"
00057         "  <START value=\"1\"/>\n"
00058         "  <FORMAT superscript=\"1\" type=\"1\"/>\n"
00059         "  <FIRSTPARAG ref=\"(null)\"/>\n"
00060         " </FOOTNOTEMGR>\n"
00061         " <FRAMESETS>\n");
00062     newstr.append(
00063         "  <FRAMESET frameType=\"1\" frameInfo=\"0\" removeable=\"0\" visible=\"1\">\n"
00064         "   <FRAME left=\"");
00065     newstr.append(QString::number(hMargin));
00066     newstr.append("\" top=\"");
00067     newstr.append(QString::number(vMargin));
00068     newstr.append("\" right=\"");
00069     newstr.append(QString::number(width - hMargin));
00070     newstr.append("\" bottom=\"");
00071     newstr.append(QString::number(height - vMargin));
00072     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");
00073     newstr.append("\" autoCreateNewFrame=\"1\" newFrameBehaviour=\"0\"/>\n"
00074         "   <PARAGRAPH>\n"
00075         "    <TEXT>");
00076     newstr.append("Cannot import OLE streams of type: ");
00077     newstr.append(m_oleStreams.join(","));
00078     newstr.append("</TEXT>\n"
00079         "   </PARAGRAPH>\n"
00080         "  </FRAMESET>\n");
00081     newstr.append(
00082         " </FRAMESETS>\n"
00083         "</DOC>\n");
00084     m_part=QDomDocument("doc");
00085     m_part.setContent(newstr);
00086     m_success=true;
00087     m_ready=true;
00088     return m_success;
00089 }
00090 
00091 #include <filterbase.moc>
KDE Home | KDE Accessibility Home | Description of Access Keys