[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/lib/kofficecore
From: David Faure <faure () kde ! org>
Date: 2004-02-02 14:35:19
Message-ID: 20040202143519.548E99961 () office ! kde ! org
[Download RAW message or body]
CVS commit by faure:
Provide user-styles in a QValueVector
M +12 -3 koOasisStyles.cc 1.3
M +12 -0 koOasisStyles.h 1.2
--- koffice/lib/kofficecore/koOasisStyles.cc #1.2:1.3
@@ -1,4 +1,5 @@
#include "koOasisStyles.h"
#include <kdebug.h>
+#include <qdom.h>
KoOasisStyles::KoOasisStyles()
@@ -54,8 +55,16 @@ void KoOasisStyles::createStyleMap( cons
//kdDebug(30003) << "Starting reading in office:styles" << endl;
- QDomNode fixedStyles = docElement.namedItem( "office:styles" );
+ QDomElement userStyles = docElement.namedItem( "office:styles" ).toElement();
- if ( !fixedStyles.isNull() )
- insertStyles( fixedStyles.toElement() );
+ if ( !userStyles.isNull() ) {
+ // Collect user styles
+ QDomNodeList children = userStyles.elementsByTagName( "style:style" );
+ Q_ASSERT( m_userStyles.empty() );
+ m_userStyles.resize( children.length() );
+ for ( unsigned int i = 0 ; i < children.length(); ++i )
+ m_userStyles[i] = children.item( i ).toElement();
+
+ insertStyles( userStyles );
+ }
//kdDebug(30003) << "Styles read in." << endl;
--- koffice/lib/kofficecore/koOasisStyles.h #1.1:1.2
@@ -4,4 +4,5 @@
#include <qdom.h>
#include <qdict.h>
+#include <qvaluevector.h>
/**
@@ -17,7 +18,17 @@ public:
void createStyleMap( const QDomDocument& doc );
+ /// Contains *all* styles, hashed by name
const QDict<QDomElement>& styles() const { return m_styles; }
+
+ /// Contains the sub-set of "user styles", i.e. those from office:styles
+ const QValueVector<QDomElement> &userStyles() const { return m_userStyles; }
+
+ /// @return the default style
const QDomElement& defaultStyle() const { return m_defaultStyle; }
+
+ /// @return all list styles ("text:list-style" elements), hashed by name
const QDict<QDomElement>& listStyles() const { return m_listStyles; }
+
+ /// @return master pages ("style:master-page" elements), hashed by name
const QDict<QDomElement>& masterPages() const { return m_masterPages; }
@@ -31,4 +42,5 @@ private:
QDict<QDomElement> m_styles;
+ QValueVector<QDomElement> m_userStyles;
QDomElement m_defaultStyle;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic