[prev in list] [next in list] [prev in thread] [next in thread]
List: koffice-devel
Subject: evaluating formulas inside kword
From: Ulrich Kuettler <ulrich.kuettler () mailbox ! tu-dresden ! de>
Date: 2003-03-12 21:03:22
[Download RAW message or body]
Hi:
now I went a little further and implemented evaluating formulas inside kword.
As a very first approximation of a useful application only. Just to see if it
works!
If you want to have a look you'll need the current cvs versions of koffice and
octave, the kengineer sources from
http://rcswww.urz.tu-dresden.de/~uk327083/kengineer.tar.bz2 and the attached
patch. The patch is very brutal and of course preliminary. (It's the really
ugly part.) It simply loads the new mathformula library and substitutes
kformula's Document with the derived MathDocument. Formulas created by a
MathDocument behave just as ordinary formulas but can be evaluated. This way
no other part of kword has to know about the evaluation support. At least not
at the moment.
The idea is that one might have a special kind of kword document. These
special documents require the mathformula library to be created or loaded and
support evaluation. The difference between ordinary formulas and the living
ones should be as small as possible to hide the different behavior behind a
common interface.
Now my question is if those special kinds of documents are acceptable and if
kengineer could be part of koffice. I'd also like to know how to call the
library if you want kengineer be part of koffice. Among other things. There's
nothing that cannot be talked about.
If you don't like the idea it's still okay. I just need to know.
Greetings,
Uli
["kwdoc.patch" (text/x-diff)]
Index: kwdoc.cc
===================================================================
RCS file: /home/kde/koffice/kword/kwdoc.cc,v
retrieving revision 1.599
diff -u -3 -p -r1.599 kwdoc.cc
--- kwdoc.cc 10 Mar 2003 08:42:12 -0000 1.599
+++ kwdoc.cc 12 Mar 2003 20:07:20 -0000
@@ -24,6 +24,7 @@
#include <kapplication.h> // for KDE_VERSION
#include <kdebug.h>
#include <kdebugclasses.h>
+#include <klibloader.h>
#include <klocale.h>
#include <kstandarddirs.h>
#include <kmessagebox.h>
@@ -3915,9 +3916,22 @@ void KWDocument::invalidate(const KWFram
KFormula::Document* KWDocument::getFormulaDocument()
{
if (!m_formulaDocument) {
- /// ##### kapp->config()? Shouldn't that be instance()->config() instead?
- // Otherwise it depends on which app is embedding us (David).
- m_formulaDocument = new KFormula::Document( kapp->config(), \
actionCollection(), m_commandHistory ); + KLibFactory* factory = \
KLibLoader::self()->factory( "libmathformula" ); + if ( factory != 0 ) {
+ m_formulaDocument =
+ static_cast<KFormula::Document*>( factory->create( this,
+ \
"formula_document", + \
"MathDocument" ) ); + m_formulaDocument->setConfig( instance()->config() \
); + m_formulaDocument->setCommandStack( m_commandHistory );
+ m_formulaDocument->createActions( actionCollection() );
+ }
+ else {
+ m_formulaDocument =
+ new KFormula::Document( instance()->config(),
+ actionCollection(),
+ m_commandHistory );
+ }
m_formulaDocument->setZoomAndResolution( m_zoom,
qRound(INCH_TO_POINT( m_resolutionX \
)), // re-calculate dpiX and dpiY
qRound(INCH_TO_POINT( m_resolutionY \
)) );
_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic