• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

cantor/src/lib

  • sources
  • kde-4.14
  • kdeedu
  • cantor
  • src
  • lib
epsresult.cpp
Go to the documentation of this file.
1 /*
2  This program is free software; you can redistribute it and/or
3  modify it under the terms of the GNU General Public License
4  as published by the Free Software Foundation; either version 2
5  of the License, or (at your option) any later version.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  GNU General Public License for more details.
11 
12  You should have received a copy of the GNU General Public License
13  along with this program; if not, write to the Free Software
14  Foundation, Inc., 51 Franklin Street, Fifth Floor,
15  Boston, MA 02110-1301, USA.
16 
17  ---
18  Copyright (C) 2009 Alexander Rieder <alexanderrieder@gmail.com>
19  */
20 
21 #include "epsresult.h"
22 using namespace Cantor;
23 
24 #include <config-cantorlib.h>
25 
26 #include <kdebug.h>
27 #include <kzip.h>
28 #include <kio/job.h>
29 
30 class Cantor::EpsResultPrivate{
31  public:
32  KUrl url;
33 };
34 
35 
36 EpsResult::EpsResult(const KUrl& url) : d(new EpsResultPrivate)
37 {
38  d->url=url;
39 #ifndef WITH_EPS
40  kError()<<"Creating an EpsResult in an environment compiled without EPS support!";
41 #endif
42 }
43 
44 EpsResult::~EpsResult()
45 {
46  delete d;
47 }
48 
49 QString EpsResult::toHtml()
50 {
51  return QString("<img src=\"%1\" />").arg(d->url.url());
52 }
53 
54 QString EpsResult::toLatex()
55 {
56  return QString(" \\begin{center} \n \\includegraphics[width=12cm]{%1}\n \\end{center}").arg(d->url.fileName());
57 }
58 
59 QVariant EpsResult::data()
60 {
61  return QVariant(d->url);
62 }
63 
64 KUrl EpsResult::url()
65 {
66  return d->url;
67 }
68 
69 int EpsResult::type()
70 {
71  return EpsResult::Type;
72 }
73 
74 QString EpsResult::mimeType()
75 {
76  return "image/x-eps";
77 }
78 
79 QDomElement EpsResult::toXml(QDomDocument& doc)
80 {
81  kDebug()<<"saving imageresult "<<toHtml();
82  QDomElement e=doc.createElement("Result");
83  e.setAttribute("type", "image");
84  e.setAttribute("filename", d->url.fileName());
85  kDebug()<<"done";
86 
87  return e;
88 }
89 
90 void EpsResult::saveAdditionalData(KZip* archive)
91 {
92  archive->addLocalFile(d->url.toLocalFile(), d->url.fileName());
93 }
94 
95 void EpsResult::save(const QString& filename)
96 {
97  //just copy over the eps file..
98  KIO::file_copy(d->url, KUrl(filename), -1, KIO::HideProgressInfo);
99 }
Cantor::EpsResult::url
KUrl url()
returns an url, data for this result resides at
Definition: epsresult.cpp:64
Cantor::EpsResult::saveAdditionalData
void saveAdditionalData(KZip *archive)
saves all the data, that can't be saved in xml in an extra file in the archive.
Definition: epsresult.cpp:90
Cantor::EpsResult::mimeType
QString mimeType()
returns the mimetype, this result is
Definition: epsresult.cpp:74
Cantor::EpsResult::~EpsResult
~EpsResult()
Definition: epsresult.cpp:44
Cantor::EpsResult::toXml
QDomElement toXml(QDomDocument &doc)
returns a DomElement, containing the information of the result
Definition: epsresult.cpp:79
Cantor::EpsResult::toLatex
QString toLatex()
returns latex code, that represents this result e.g.
Definition: epsresult.cpp:54
Cantor::EpsResult::save
void save(const QString &filename)
saves this to a file
Definition: epsresult.cpp:95
QDomElement::setAttribute
void setAttribute(const QString &name, const QString &value)
Cantor::EpsResult::toHtml
QString toHtml()
returns html code, that represents this result, e.g.
Definition: epsresult.cpp:49
Cantor::EpsResult::data
QVariant data()
returns data associated with this result (text/images/etc)
Definition: epsresult.cpp:59
QString
QDomDocument
epsresult.h
Cantor::EpsResult::Type
Definition: epsresult.h:35
Cantor::EpsResult::type
int type()
returns an unique number, representing the type of this result.
Definition: epsresult.cpp:69
QDomDocument::createElement
QDomElement createElement(const QString &tagName)
QDomElement
QString::arg
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
Cantor::EpsResult::EpsResult
EpsResult(const KUrl &url)
Definition: epsresult.cpp:36
QVariant
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:16:33 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

cantor/src/lib

Skip menu "cantor/src/lib"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal