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

« back to all changes in this revision

Viewing changes to filters/kword/html/export/htmlexport.cc

  • 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
// $Header: /home/kde/koffice/filters/kword/html/export/htmlexport.cc,v 1.17 2003/08/16 12:22:48 mueller Exp $
 
2
 
 
3
/*
 
4
   This file is part of the KDE project
 
5
   Copyright (C) 2001, 2002 Nicolas GOUTTE <goutte@kde.org>
 
6
 
 
7
   This library is free software; you can redistribute it and/or
 
8
   modify it under the terms of the GNU Library General Public
 
9
   License as published by the Free Software Foundation; either
 
10
   version 2 of the License, or (at your option) any later version.
 
11
 
 
12
   This library is distributed in the hope that it will be useful,
 
13
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
15
   Library General Public License for more details.
 
16
 
 
17
   You should have received a copy of the GNU Library General Public License
 
18
   along with this library; see the file COPYING.LIB.  If not, write to
 
19
   the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
20
   Boston, MA 02111-1307, USA.
 
21
*/
 
22
 
 
23
/*
 
24
   This file is based on the old file:
 
25
    /home/kde/koffice/filters/kword/ascii/asciiexport.cc
 
26
 
 
27
   The old file was copyrighted by
 
28
    Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>
 
29
    Copyright (c) 2000 ID-PRO Deutschland GmbH. All rights reserved.
 
30
                       Contact: Wolf-Michael Bolle <Bolle@ID-PRO.de>
 
31
 
 
32
   The old file was licensed under the terms of the GNU Library General Public
 
33
   License version 2.
 
34
*/
 
35
 
 
36
#include <kdebug.h>
 
37
#include <kgenericfactory.h>
 
38
#include <koFilterChain.h>
 
39
 
 
40
#include <KWEFBaseWorker.h>
 
41
#include <KWEFKWordLeader.h>
 
42
 
 
43
#include "ExportDialog.h"
 
44
#include "ExportFilter.h"
 
45
#include "ExportCss.h"
 
46
#include "ExportBasic.h"
 
47
#include "ExportDocStruct.h"
 
48
 
 
49
#include <htmlexport.h>
 
50
#include <htmlexport.moc>
 
51
 
 
52
typedef KGenericFactory<HTMLExport, KoFilter> HTMLExportFactory;
 
53
K_EXPORT_COMPONENT_FACTORY( libhtmlexport, HTMLExportFactory( "kwordhtmlexportfilter" ) )
 
54
 
 
55
//
 
56
// HTMLExport
 
57
//
 
58
 
 
59
HTMLExport::HTMLExport(KoFilter *, const char *, const QStringList &) :
 
60
                     KoFilter() {
 
61
}
 
62
 
 
63
KoFilter::ConversionStatus HTMLExport::convert( const QCString& from, const QCString& to )
 
64
{
 
65
    if ((from != "application/x-kword") || (to != "text/html"))
 
66
    {
 
67
        return KoFilter::NotImplemented;
 
68
    }
 
69
 
 
70
    HtmlExportDialog dialog;
 
71
 
 
72
    if (!dialog.exec())
 
73
    {
 
74
        kdDebug(30503) << "Dialog was aborted! Aborting filter!" << endl;
 
75
        return KoFilter::UserCancelled;
 
76
    }
 
77
 
 
78
    HtmlWorker* worker;
 
79
 
 
80
    const HtmlExportDialog::Mode mode = dialog.getMode();
 
81
    switch (mode)
 
82
    {
 
83
    case HtmlExportDialog::Light:
 
84
      worker=new HtmlDocStructWorker();
 
85
      break;
 
86
    case HtmlExportDialog::Basic:
 
87
      worker=new HtmlBasicWorker();
 
88
      break;
 
89
    default: // CSS
 
90
      worker=new HtmlCssWorker();
 
91
    }
 
92
 
 
93
    worker->setXML(dialog.isXHtml());
 
94
    worker->setCodec(dialog.getCodec());
 
95
 
 
96
    KWEFKWordLeader* leader=new KWEFKWordLeader(worker);
 
97
 
 
98
    if (!leader)
 
99
    {
 
100
        kdError(30503) << "Cannot create Worker! Aborting!" << endl;
 
101
        delete worker;
 
102
        return KoFilter::StupidError;
 
103
    }
 
104
    KoFilter::ConversionStatus result=leader->convert(m_chain,from,to);
 
105
 
 
106
    delete leader;
 
107
    delete worker;
 
108
 
 
109
    return result;
 
110
}