Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 316c8b25 authored by Boudewijn Rempt's avatar Boudewijn Rempt

CCMAIL: koffice-devel@kde.org

Make it once again possible to compile KOffice with KOXML_USE_QDOM defined; this is not
defined by default because it breaks kpresenter, kchart and kplato and it is slower, but
it should be definable so we can check for errors in our dom implementation. (And I'm 
sure there is one, since if I define KOXML_USE_QDOM, krita loads its documents with Qt45
again, which is broken if it's undefined, but I can now start to debug the problem again).

Note well: KoXmlNode has never been meant as a class you can extend with convenience methods.
It's API should be completely identical with the correspoding Qt class! Convenience methods
should be defined outside this class!

Also note: I have marked all places where applications use the aforementioned convenience methods
with XXX!!!


svn path=/trunk/koffice/; revision=924631
parent 4d36225c
......@@ -21,10 +21,9 @@
#define KOEVENTACTION_H
#include "flake_export.h"
#include "KoXmlReaderForward.h"
class KoShapeLoadingContext;
class KoShapeSavingContext;
class KoXmlElement;
class KoTool;
/**
......
......@@ -23,10 +23,9 @@
#include <QList>
#include "flake_export.h"
#include "KoXmlReaderForward.h"
class KoEventAction;
class KoEventActionFactory;
class KoXmlElement;
class KoShapeLoadingContext;
class FLAKE_EXPORT KoEventActionRegistry
......
......@@ -22,7 +22,7 @@
#include "flake_export.h"
class KoXmlElement;
#include "KoXmlReaderForward.h"
class KoShapeLoadingContext;
/**
......
......@@ -612,9 +612,9 @@ void KoToolManager::selectionChanged(QList<KoShape*> shapes)
// there needs to be at least one shape for a tool without an activationShapeId
// to work
// if not change the current tool to the default tool
if (!(d->canvasData->activationShapeId.isNull() && shapes.size() > 0)
&& d->canvasData->activationShapeId != "flake/always"
&& d->canvasData->activationShapeId != "flake/edit"
if (!(d->canvasData->activationShapeId.isNull() && shapes.size() > 0)
&& d->canvasData->activationShapeId != "flake/always"
&& d->canvasData->activationShapeId != "flake/edit"
&& ! types.contains(d->canvasData->activationShapeId)) {
switchTool(KoInteractionTool_ID, false);
}
......@@ -624,11 +624,19 @@ void KoToolManager::selectionChanged(QList<KoShape*> shapes)
void KoToolManager::currentLayerChanged(const KoShapeLayer* layer)
{
kDebug( 30006 ) << "layer changed to " << layer;
emit currentLayerChanged(d->canvasData->canvas, layer);
bool enabled = layer == 0 || (layer->isEditable() && layer->isVisible());
kDebug(30006 ) << "and the layer is " << ( enabled ? "true" : "false" );
KoToolProxy *proxy = d->proxies.value(d->canvasData->canvas->canvas());
if (proxy)
kDebug( 30006 ) << " and the proxy is " << proxy;
if (proxy) {
kDebug( 30006 ) << " set " << d->canvasData->activeTool << ( enabled ? "enabled" : "disabled" );
proxy->setActiveTool(enabled ? d->canvasData->activeTool : 0);
}
}
KoCanvasController *KoToolManager::activeCanvasController() const
......
......@@ -18,7 +18,7 @@
*/
#include "KoToolBoxFactory.h"
#include "klocale.h"
#include <KoToolManager.h>
#include "KoToolBox_p.h"
......@@ -29,10 +29,15 @@ public:
};
KoToolBoxFactory::KoToolBoxFactory(KoCanvasController *canvas, const QString& appName)
KoToolBoxFactory::KoToolBoxFactory(KoCanvasController *canvas, const QString& title)
: d( new Private())
{
d->appName = appName;
if (title.isEmpty()) {
d->appName = i18n("Tools");
}
else {
d->appName = title;
}
d->canvas = canvas;
}
......
......@@ -74,7 +74,10 @@ QString KoScriptingOdfReader::name() const { return d->currentElement.tagName();
QString KoScriptingOdfReader::namespaceURI() const { return d->currentElement.namespaceURI(); }
int KoScriptingOdfReader::level() const { return d->level; }
#ifndef KOXML_USE_QDOM
QStringList KoScriptingOdfReader::attributeNames() { return d->currentElement.attributeNames(); }
#endif
QString KoScriptingOdfReader::attribute(const QString& name, const QString& defaultValue) const { return d->currentElement.attribute(name, defaultValue); }
QString KoScriptingOdfReader::attributeNS(const QString& namespaceURI, const QString& localName, const QString& defaultValue) const { return d->currentElement.attributeNS(namespaceURI, localName, defaultValue); }
bool KoScriptingOdfReader::hasAttribute(const QString& name) const { return d->currentElement.hasAttribute(name); }
......@@ -85,7 +88,11 @@ bool KoScriptingOdfReader::isElement() const { return d->currentElement.isElemen
QString KoScriptingOdfReader::text() const { return d->currentElement.text(); }
bool KoScriptingOdfReader::hasChildren() const {
#ifdef KOXML_USE_QDOM
const int count = d->currentElement.childNodes().count();
#else
const int count = d->currentElement.childNodesCount();
#endif
if( count < 1 )
return false;
if( count == 1 && d->currentElement.firstChild().isText() )
......@@ -136,7 +143,9 @@ void dumpElem(KoXmlElement elem, int level=0) {
QString prefix="";
for(int i = 0; i < level; ++i) prefix+=" ";
qDebug()<<QString("%1 %2").arg(prefix).arg(elem.tagName());
#ifndef KOXML_USE_QDOM
foreach(const QString &s,elem.attributeNames()) qDebug()<<QString("%1 %2 = %3").arg(prefix).arg(s).arg(elem.attribute(s));
#endif
level++;
KoXmlElement e;
forEachElement(e, elem) dumpElem(e,level);
......
......@@ -119,12 +119,13 @@ class KoScriptingOdfReader : public QObject
* root-element have a level of 1, there children of 2, etc.
*/
int level() const;
#ifndef KOXML_USE_QDOM
/**
* Return a list of attribute-names the element has. This could be
* for example "text:style-name".
*/
QStringList attributeNames();
#endif
/**
* Return the value of the attribute with the name \p name .
......
......@@ -22,7 +22,7 @@
#include "KoInlineObject.h"
#include "kotext_export.h"
class KoXmlElement;
#include "KoXmlReaderForward.h"
class KoShapeLoadingContext;
/**
......
......@@ -27,7 +27,7 @@
#include <KoInsets.h>
class QTextDocument;
class KoXmlElement;
#include "KoXmlReaderForward.h"
class KoXmlWriter;
class KoShapeLoadingContext;
class KoShapeSavingContext;
......
......@@ -30,7 +30,7 @@
class QTextInlineObject;
class QTextDocument;
class KoXmlElement;
#include "KoXmlReaderForward.h"
class KoShape;
class KoShapeLoadingContext;
class KoProperties;
......
......@@ -27,7 +27,7 @@
#include <QObject>
#include <QList>
class KoXmlElement;
#include "KoXmlReaderForward.h"
class KoShapeLoadingContext;
class KoVariable;
class KoCanvasBase;
......
......@@ -28,7 +28,7 @@
#include "kotext_export.h"
class KoXmlElement;
#include "KoXmlReaderForward.h"
class KoShapeLoadingContext;
class QTextCursor;
......
......@@ -36,7 +36,7 @@ class QTextBlock;
class KoStyleStack;
class KoGenStyle;
class KoGenStyles;
class KoXmlElement;
#include "KoXmlReaderForward.h"
class KoOdfLoadingContext;
/**
......
......@@ -23,11 +23,10 @@
#include "komain_export.h"
#include <QtGui/QColor>
#include "KoXmlReaderForward.h"
class QPainter;
class QRectF;
class KoViewConverter;
class KoXmlDocument;
class KoXmlWriter;
/**
......
......@@ -24,12 +24,11 @@
#include "komain_export.h"
#include <QtCore/QList>
#include <QtCore/Qt>
#include "KoXmlReaderForward.h"
class QPainter;
class KoViewConverter;
class QRectF;
class QColor;
class KoXmlDocument;
class KoXmlWriter;
class KOMAIN_EXPORT KoGuidesData
......
......@@ -23,10 +23,10 @@
#include <KoOdf.h>
#include "koodf_export.h"
#include "KoXmlReaderForward.h"
class QString;
class QMimeData;
class KoXmlElement;
class KoOdfReadStore;
class KOODF_EXPORT KoOdfPaste
......
......@@ -19,12 +19,13 @@
#ifndef KOODFREADSTORE_H
#define KOODFREADSTORE_H
#include "KoXmlReaderForward.h"
class QString;
class QIODevice;
class QXmlSimpleReader;
class KoStore;
class KoOdfStylesReader;
class KoXmlDocument;
/**
* Helper class around KoStore for reading out ODF files.
......
......@@ -70,14 +70,13 @@ struct KoColorSpaceRegistry::Private {
};
KoColorSpaceRegistry *KoColorSpaceRegistry::Private::singleton = 0;
// deleting the registry still gives errors
//static K3StaticDeleter<KoColorSpaceRegistry> staticDeleter;
static K3StaticDeleter<KoColorSpaceRegistry> staticDeleter;
KoColorSpaceRegistry* KoColorSpaceRegistry::instance()
{
if(KoColorSpaceRegistry::Private::singleton == 0)
if (KoColorSpaceRegistry::Private::singleton == 0)
{
//staticDeleter.setObject(KoColorSpaceRegistry::Private::singleton, new KoColorSpaceRegistry());
staticDeleter.setObject(KoColorSpaceRegistry::Private::singleton, new KoColorSpaceRegistry());
KoColorSpaceRegistry::Private::singleton = new KoColorSpaceRegistry();
KoColorSpaceRegistry::Private::singleton->init();
}
......@@ -378,7 +377,7 @@ const KoColorSpace * KoColorSpaceRegistry::colorSpace(const QString &csID, const
{
cs = colorSpace( csID, profile->name());
}
if( not d->profileMap.contains( profile->name() ) )
{
addProfile( profile );
......
......@@ -46,7 +46,7 @@ class QString;
class QXmlReader;
class QXmlInputSource;
class KoXmlElement;
#include "KoXmlReaderForward.h"
class KoXmlText;
class KoXmlCDATASection;
class KoXmlDocumentType;
......@@ -64,6 +64,8 @@ class KoXmlNodeData;
* KoXmlNode implements an explicit sharing, a node shares its data with
* other copies (if exist).
*
* XXX: DO NOT ADD CONVENIENCE API HERE BECAUSE THIS CLASS MUST REMAIN COMPATIBLE WITH QDOMNODE!
*
* @author Ariya Hidayat <ariya@kde.org>
*/
class KOSTORE_EXPORT KoXmlNode
......@@ -115,7 +117,7 @@ public:
KoXmlNode nextSibling() const;
KoXmlNode previousSibling() const;
// equivalen to node.childNodes().count() if node is a QDomNode instance
// equivalent to node.childNodes().count() if node is a QDomNode instance
int childNodesCount() const;
// workaround to get and iterate over all attributes
......
......@@ -22,7 +22,7 @@
#define KOXMLREADERFORWARD_H
// use standard QDom, useful to test KoXml classes against Qt's QDom
// #define KOXML_USE_QDOM
//#define KOXML_USE_QDOM
#ifdef KOXML_USE_QDOM
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment