Commit c3d306fb authored by Thorsten Zachmann's avatar Thorsten Zachmann

o rename KoOasisStyles to KoOdfStylesReader

  I hope I did not break anything. If I have done however please send me
  a mail.

svn path=/trunk/koffice/; revision=741247
parent 2e901ae5
......@@ -48,7 +48,7 @@
<UML:DataType stereotype="15470" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="22026" isRoot="false" isAbstract="false" name="KisUndoAdapter&amp;" elementReference="22003" />
<UML:DataType stereotype="15470" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="22052" isRoot="false" isAbstract="false" name="KoStore*" elementReference="22051" />
<UML:DataType stereotype="15470" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="22058" isRoot="false" isAbstract="false" name="const QDomDocument&amp;" elementReference="22057" />
<UML:DataType stereotype="15470" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="22061" isRoot="false" isAbstract="false" name="KoOasisStyles&amp;" elementReference="22060" />
<UML:DataType stereotype="15470" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="22061" isRoot="false" isAbstract="false" name="KoOdfStylesReader&amp;" elementReference="22060" />
<UML:DataType stereotype="15470" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="22068" isRoot="false" isAbstract="false" name="KoXmlWriter*" elementReference="22067" />
<UML:DataType stereotype="15470" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="22074" isRoot="false" isAbstract="false" name="QIODevice*" elementReference="22073" />
<UML:DataType stereotype="15470" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="22083" isRoot="false" isAbstract="false" name="const QPoint&amp;" elementReference="22082" />
......@@ -1134,7 +1134,7 @@ due to an undo or redo action." isSpecification="false" isLeaf="false" visibilit
<UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="22036" isRoot="false" isAbstract="false" name="KoDocument" />
<UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="22051" isRoot="false" isAbstract="false" name="KoStore" />
<UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="22057" isRoot="false" isAbstract="false" name="QDomDocument" />
<UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="22060" isRoot="false" isAbstract="false" name="KoOasisStyles" />
<UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="22060" isRoot="false" isAbstract="false" name="KoOdfStylesReader" />
<UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="22067" isRoot="false" isAbstract="false" name="KoXmlWriter" />
<UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="22073" isRoot="false" isAbstract="false" name="QIODevice" />
<UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="22078" isRoot="false" isAbstract="false" name="QByteArray" />
......
......@@ -1295,7 +1295,7 @@ pixels in the brush." visibility="public" xmi.id="705" type="virtual KisAlphaMas
</UML:Operation>
<UML:Operation visibility="public" xmi.id="998" type="virtual bool" name="loadOasis" >
<UML:Parameter visibility="private" xmi.id="999" value="" type="const QDomDocument &amp;" />
<UML:Parameter visibility="private" xmi.id="1000" value="" type="KoOasisStyles &amp;" />
<UML:Parameter visibility="private" xmi.id="1000" value="" type="KoOdfStylesReader &amp;" />
</UML:Operation>
<UML:Operation visibility="public" xmi.id="1001" type="virtual bool" name="loadXML" >
<UML:Parameter visibility="private" xmi.id="1002" value="" type="QIODevice *" />
......@@ -43,7 +43,7 @@
#include <KoXmlNS.h>
#include <KoGenStyle.h>
#include <KoUnit.h>
#include <KoOasisStyles.h>
#include <KoOdfStylesReader.h>
#include <KoOdfGraphicStyles.h>
#include <KoOasisLoadingContext.h>
......@@ -727,9 +727,9 @@ QBrush KoShape::loadOdfFill( const KoXmlElement & element, KoShapeLoadingContext
KoStyleStack &styleStack = context.koLoadingContext().styleStack();
QString fill = getStyleProperty( "fill", element, context );
if ( fill == "solid" || fill == "hatch" )
return KoOdfGraphicStyles::loadOasisFillStyle( styleStack, fill, context.koLoadingContext().oasisStyles() );
return KoOdfGraphicStyles::loadOasisFillStyle( styleStack, fill, context.koLoadingContext().stylesReader() );
else if( fill == "gradient" )
return KoOdfGraphicStyles::loadOasisGradientStyle( styleStack, context.koLoadingContext().oasisStyles(), size() );
return KoOdfGraphicStyles::loadOasisGradientStyle( styleStack, context.koLoadingContext().stylesReader(), size() );
else if( fill == "bitmap" )
return KoOdfGraphicStyles::loadOasisPatternStyle( styleStack, context.koLoadingContext(), size() );
......@@ -742,7 +742,7 @@ KoShapeBorderModel * KoShape::loadOdfStroke( const KoXmlElement & element, KoSha
QString stroke = getStyleProperty( "stroke", element, context );
if( stroke == "solid" || stroke == "dash" )
{
QPen pen = KoOdfGraphicStyles::loadOasisStrokeStyle( styleStack, stroke, context.koLoadingContext().oasisStyles() );
QPen pen = KoOdfGraphicStyles::loadOasisStrokeStyle( styleStack, stroke, context.koLoadingContext().stylesReader() );
KoLineBorder * border = new KoLineBorder();
border->setLineWidth( pen.widthF() );
......
......@@ -20,7 +20,7 @@
#include <qtest_kde.h>
#include <KoOasisLoadingContext.h>
#include <KoOasisStyles.h>
#include <KoOdfStylesReader.h>
#include <KoShapeLoadingContext.h>
#include <KoPathShapeFactory.h>
#include <KoShape.h>
......@@ -114,8 +114,8 @@ void TestKoShapeFactory::testOdfElement()
// XXX: When loading is implemented, these no doubt have to be
// sensibly filled.
KoOasisStyles styles;
KoOasisLoadingContext oasisContext(0, styles, 0);
KoOdfStylesReader stylesReader;
KoOasisLoadingContext oasisContext(0, stylesReader, 0);
KoShapeLoadingContext shapeContext( oasisContext );
QVERIFY( shape->loadOdf( pathElement, shapeContext ) );
......
......@@ -27,7 +27,7 @@
#include <QtXml>
#include <KoOasisLoadingContext.h>
#include <KoOasisStyles.h>
#include <KoOdfStylesReader.h>
#include "KoShapeRegistry.h"
#include "KoShape.h"
......@@ -77,8 +77,8 @@ void TestKoShapeRegistry::testCreateShapes()
// XXX: When loading is implemented, these no doubt have to be
// sensibly filled.
KoOasisStyles styles;
KoOasisLoadingContext oasisContext(0, styles, 0);
KoOdfStylesReader stylesReader;
KoOasisLoadingContext oasisContext(0, stylesReader, 0);
KoShapeLoadingContext shapeContext( oasisContext );
KoShape * shape = registry->createShapeFromOdf(bodyElement, shapeContext);
......@@ -124,8 +124,8 @@ void TestKoShapeRegistry::testCreateFramedShapes()
// XXX: When loading is implemented, these no doubt have to be
// sensibly filled.
KoOasisStyles styles;
KoOasisLoadingContext oasisContext(0, styles, 0);
KoOdfStylesReader stylesReader;
KoOasisLoadingContext oasisContext(0, stylesReader, 0);
KoShapeLoadingContext shapeContext( oasisContext );
KoShape * shape = registry->createShapeFromOdf(bodyElement, shapeContext);
......
......@@ -24,7 +24,7 @@
#include <KoStoreDevice.h>
#include <KoXmlWriter.h>
#include <KoXmlReader.h>
#include <KoOasisStyles.h>
#include <KoOdfStylesReader.h>
#include <KoOdfReadStore.h>
#include <KoOdfWriteStore.h>
#include <KoOasisLoadingContext.h>
......
......@@ -23,7 +23,7 @@
#include <KoGenStyle.h>
#include <KoXmlWriter.h>
#include <KoXmlNS.h>
#include <KoOasisStyles.h>
#include <KoOdfStylesReader.h>
#include <KoOasisLoadingContext.h>
#include "KoPASavingContext.h"
......@@ -79,7 +79,7 @@ void KoPAMasterPage::loadOdfPageTag( const KoXmlElement &element, KoPALoadingCon
setName( element.attributeNS( KoXmlNS::style, "name" ) );
}
QString pageLayoutName = element.attributeNS( KoXmlNS::style, "page-layout-name" );
const KoOasisStyles& styles = loadingContext.koLoadingContext().oasisStyles();
const KoOdfStylesReader& styles = loadingContext.koLoadingContext().stylesReader();
const KoXmlElement* masterPageStyle = styles.findStyle( pageLayoutName );
KoPageLayout pageLayout = KoPageLayout::standardLayout();
......
......@@ -32,7 +32,7 @@
#include <KoShapeRegistry.h>
#include <KoGenStyle.h>
#include <KoGenStyles.h>
#include <KoOasisStyles.h>
#include <KoOdfStylesReader.h>
#include <KoOdfGraphicStyles.h>
#include <KoXmlWriter.h>
#include <KoViewConverter.h>
......@@ -115,7 +115,7 @@ bool KoPAPageBase::loadOdf( const KoXmlElement &element, KoShapeLoadingContext &
// load layers and shapes
// This needs some work as this is only for layers which are the same for all pages
KoXmlElement layerElement;
forEachElement( layerElement, loadingContext.koLoadingContext().oasisStyles().layerSet() )
forEachElement( layerElement, loadingContext.koLoadingContext().stylesReader().layerSet() )
{
KoShapeLayer * layer = new KoShapeLayer();
if ( layer->loadOdf( layerElement, loadingContext ) ) {
......
......@@ -24,7 +24,7 @@
#include <KoOdfReadStore.h>
#include <KoXmlWriter.h>
#include <KoOasisLoadingContext.h>
#include <KoOasisStyles.h>
#include <KoOdfStylesReader.h>
#include "KoPALoadingContext.h"
#include "KoPADocument.h"
#include "KoPAMasterPage.h"
......
......@@ -174,7 +174,7 @@ bool KoTextShapeData::loadOdf(const KoXmlElement & element, KoShapeLoadingContex
owner = true;
loader = new KoTextLoader(new KoStyleManager);
loader->styleManager()->setParent(loader);
loaderContext = new KoTextLoadingContext(loader, oasisContext.koDocument(), oasisContext.oasisStyles(), oasisContext.store());
loaderContext = new KoTextLoadingContext(loader, oasisContext.koDocument(), oasisContext.stylesReader(), oasisContext.store());
}
QTextCursor cursor( document() );
......
......@@ -28,7 +28,7 @@
//#include "frames/KWTextFrame.h"
// koffice
#include <KoOasisStyles.h>
#include <KoOdfStylesReader.h>
#include <KoOasisSettings.h>
#include <KoXmlNS.h>
#include <KoDom.h>
......
......@@ -28,7 +28,7 @@
//#include "frames/KWTextFrame.h"
// koffice
#include <KoOasisStyles.h>
#include <KoOdfStylesReader.h>
#include <KoOasisSettings.h>
#include <KoXmlNS.h>
#include <KoDom.h>
......@@ -151,7 +151,7 @@ void KoTextLoader::loadStyles(KoTextLoadingContext& context, QList<KoXmlElement*
{
#if 0 //1.6:
QStringList followingStyles;
QList<KoXmlElement*> userStyles = context.oasisStyles().customStyles( "paragraph" ).values();
QList<KoXmlElement*> userStyles = context.stylesReader().customStyles( "paragraph" ).values();
bool defaultStyleDeleted = false;
int stylesLoaded = 0;
const unsigned int nStyles = userStyles.count();
......@@ -241,8 +241,8 @@ void KoTextLoader::loadAllStyles(KoTextLoadingContext& context)
// User styles are named and appear in the gui while automatic styles are just a way to
// save formatting changes done by the user. There is no real tech diff between them
// except how we present them to the user.
loadStyles(context, context.oasisStyles().autoStyles("paragraph").values());
loadStyles(context, context.oasisStyles().customStyles("paragraph").values());
loadStyles(context, context.stylesReader().autoStyles("paragraph").values());
loadStyles(context, context.stylesReader().customStyles("paragraph").values());
// we always need the default style
if( ! d->paragraphStyle("Standard") ) {
......@@ -252,7 +252,7 @@ void KoTextLoader::loadAllStyles(KoTextLoadingContext& context)
}
// handle the list styles
QHash<QString, KoXmlElement*> listStyles = context.oasisStyles().listStyles();
QHash<QString, KoXmlElement*> listStyles = context.stylesReader().listStyles();
for(QHash<QString, KoXmlElement*>::Iterator it = listStyles.begin(); it != listStyles.end(); ++it) {
#ifdef KOOPENDOCUMENTLOADER_DEBUG
kDebug(32500)<<"listStyle="<<it.key();
......@@ -264,7 +264,7 @@ void KoTextLoader::loadAllStyles(KoTextLoadingContext& context)
}
// outline-styles used e.g. for headers
KoXmlElement outlineStyle = KoDom::namedItemNS( context.oasisStyles().officeStyle(), KoXmlNS::text, "outline-style" );
KoXmlElement outlineStyle = KoDom::namedItemNS( context.stylesReader().officeStyle(), KoXmlNS::text, "outline-style" );
KoXmlElement tag;
forEachElement(tag, outlineStyle) {
#ifdef KOOPENDOCUMENTLOADER_DEBUG
......@@ -433,7 +433,7 @@ void KoTextLoader::loadParagraph(KoTextLoadingContext& context, const KoXmlEleme
kDebug(32500)<<"styleName="<<styleName<<" userStyleName="<<userStyleName<<" userStyle="<<(userStyle?"YES":"NULL");
#endif
if ( !styleName.isEmpty() ) {
const KoXmlElement* paragraphStyle = context.oasisStyles().findStyle( styleName, "paragraph" );
const KoXmlElement* paragraphStyle = context.stylesReader().findStyle( styleName, "paragraph" );
QString masterPageName = paragraphStyle ? paragraphStyle->attributeNS( KoXmlNS::style, "master-page-name", QString() ) : QString();
if ( masterPageName.isEmpty() )
masterPageName = "Standard";
......@@ -486,7 +486,7 @@ void KoTextLoader::loadParagraph(KoTextLoadingContext& context, const KoXmlEleme
QTextCharFormat cf = cursor.charFormat(); // store the current cursor char format
context.styleStack().setTypeProperties( "paragraph" );
const QString textStyleName = parent.attributeNS( KoXmlNS::text, "style-name", QString() );
const KoXmlElement* textStyleElem = textStyleName.isEmpty() ? 0 : context.oasisStyles().findStyle( textStyleName, "paragraph" );
const KoXmlElement* textStyleElem = textStyleName.isEmpty() ? 0 : context.stylesReader().findStyle( textStyleName, "paragraph" );
KoCharacterStyle *charstyle = 0;
if( textStyleElem ) {
context.addStyles( textStyleElem, "paragraph" );
......@@ -559,7 +559,7 @@ void KoTextLoader::loadHeading(KoTextLoadingContext& context, const KoXmlElement
/*
//1.6: KoOasisContext::pushOutlineListLevelStyle
//KoXmlElement outlineStyle = KoDom::namedItemNS( oasisStyles().officeStyle(), KoXmlNS::text, "outline-style" );
//KoXmlElement outlineStyle = KoDom::namedItemNS( stylesReader().officeStyle(), KoXmlNS::text, "outline-style" );
KoListStyle* listStyle = 0;
if( level > 0 ) {
listStyle = new KoListStyle();
......@@ -571,7 +571,7 @@ void KoTextLoader::loadHeading(KoTextLoadingContext& context, const KoXmlElement
//1.6: KWTextParag::loadOasis
QString styleName = parent.attributeNS( KoXmlNS::text, "style-name", QString() );
if ( !styleName.isEmpty() ) {
const KoXmlElement* paragraphStyle = context.oasisStyles().findStyle( styleName, "paragraph" );
const KoXmlElement* paragraphStyle = context.stylesReader().findStyle( styleName, "paragraph" );
//QString masterPageName = paragraphStyle ? paragraphStyle->attributeNS( KoXmlNS::style, "master-page-name", QString() ) : QString();
//if ( masterPageName.isEmpty() ) masterPageName = "Standard"; // Seems to be a builtin name for the default layout...
//#ifdef KOOPENDOCUMENTLOADER_DEBUG
......@@ -866,7 +866,7 @@ void KoTextLoader::loadSpan(KoTextLoadingContext& context, const KoXmlElement& p
context.styleStack().setTypeProperties( "text" );
const QString textStyleName = ts.attributeNS( KoXmlNS::text, "style-name", QString() );
const KoXmlElement* textStyleElem = textStyleName.isEmpty() ? 0 : context.oasisStyles().findStyle( textStyleName, "text" );
const KoXmlElement* textStyleElem = textStyleName.isEmpty() ? 0 : context.stylesReader().findStyle( textStyleName, "text" );
KoCharacterStyle *charstyle = 0;
if( textStyleElem ) {
#ifdef KOOPENDOCUMENTLOADER_DEBUG
......@@ -947,8 +947,8 @@ void KoTextLoader::loadSpan(KoTextLoadingContext& context, const KoXmlElement& p
QString dataStyle = ts.attributeNS(KoXmlNS::style, "data-style-name");
QString dateFormat = "";
if (!dataStyle.isEmpty()) {
if (context.oasisStyles().dataFormats().contains(dataStyle)) {
KoOdfNumberStyles::NumericStyleFormat dataFormat = context.oasisStyles().dataFormats().value(dataStyle);
if (context.stylesReader().dataFormats().contains(dataStyle)) {
KoOdfNumberStyles::NumericStyleFormat dataFormat = context.stylesReader().dataFormats().value(dataStyle);
dateFormat = dataFormat.prefix + dataFormat.formatStr + dataFormat.suffix;
}
}
......
......@@ -33,8 +33,8 @@ class KoTextLoadingContext::Private
int currentListLevel;
};
KoTextLoadingContext::KoTextLoadingContext( KoTextLoader* loader, KoDocument* doc, KoOasisStyles& styles, KoStore* store )
: KoOasisLoadingContext( doc, styles, store ), d(new Private())
KoTextLoadingContext::KoTextLoadingContext( KoTextLoader* loader, KoDocument* doc, KoOdfStylesReader& stylesReader, KoStore* store )
: KoOasisLoadingContext( doc, stylesReader, store ), d(new Private())
{
d->loader = loader;
d->currentListLevel = 1; // default list level is always 1
......@@ -84,7 +84,7 @@ static KoXmlElement findListLevelStyle( const KoXmlElement& fullListStyle, int l
bool KoOasisContext::pushListLevelStyle( const QString& listStyleName, int level )
{
KoXmlElement* fullListStyle = oasisStyles().listStyles()[listStyleName];
KoXmlElement* fullListStyle = stylesReader().listStyles()[listStyleName];
if ( !fullListStyle ) {
kWarning(32500) << "List style " << listStyleName << " not found!";
return false;
......@@ -95,7 +95,7 @@ bool KoOasisContext::pushListLevelStyle( const QString& listStyleName, int level
bool KoOasisContext::pushOutlineListLevelStyle( int level )
{
KoXmlElement outlineStyle = KoDom::namedItemNS( oasisStyles().officeStyle(), KoXmlNS::text, "outline-style" );
KoXmlElement outlineStyle = KoDom::namedItemNS( stylesReader().officeStyle(), KoXmlNS::text, "outline-style" );
return pushListLevelStyle( "<outline-style>", outlineStyle, level );
}
......
......@@ -47,7 +47,7 @@ public:
* \param styles The styles used for loading.
* \param store The storage backend we are reading from.
*/
KoTextLoadingContext( KoTextLoader* loader, KoDocument* doc, KoOasisStyles& styles, KoStore* store );
KoTextLoadingContext( KoTextLoader* loader, KoDocument* doc, KoOdfStylesReader& stylesReader, KoStore* store );
/**
* Destructor.
......
......@@ -25,7 +25,7 @@
#include <QTextCursor>
#include <KoStyleStack.h>
#include <KoOasisStyles.h>
#include <KoOdfStylesReader.h>
#include <KoXmlNS.h>
#include <KoXmlReader.h>
#include <KoUnit.h>
......@@ -504,8 +504,8 @@ void KoCharacterStyle::loadOasis(KoTextLoadingContext& context) {
fontName = styleStack.property( KoXmlNS::style, "font-family" );
if ( styleStack.hasProperty( KoXmlNS::style, "font-name" ) ) {
// This font name is a reference to a font face declaration.
KoOasisStyles &styles = context.oasisStyles();
const KoXmlElement *fontFace = styles.findStyle(styleStack.property( KoXmlNS::style, "font-name" ));
KoOdfStylesReader &stylesReader = context.stylesReader();
const KoXmlElement *fontFace = stylesReader.findStyle(styleStack.property( KoXmlNS::style, "font-name" ));
if (fontFace != 0)
fontName = fontFace->attributeNS(KoXmlNS::svg, "font-family", "");
}
......
......@@ -23,7 +23,7 @@
#include "opendocument/KoTextLoadingContext.h"
#include <KoStyleStack.h>
#include <KoOasisStyles.h>
#include <KoOdfStylesReader.h>
#include <KoXmlNS.h>
#include <kdebug.h>
#include <QTextCursor>
......
......@@ -30,7 +30,7 @@
#include "KoMainWindow.h"
#include "KoFilterManager.h"
#include "KoDocumentInfo.h"
#include "KoOasisStyles.h"
#include "KoOdfStylesReader.h"
#include "KoOdfReadStore.h"
#include "KoOdfWriteStore.h"
#include "KoXmlNS.h"
......
......@@ -47,7 +47,6 @@ class KoChild;
class KoDocumentChild;
class KoView;
class KoDocumentInfo;
class KoOasisStyles;
class KoOpenPane;
......
......@@ -36,7 +36,7 @@
#include <KoXmlWriter.h>
#include "KoOasisLoadingContext.h"
#include "KoOasisStyles.h"
#include "KoOdfStylesReader.h"
#include "KoPictureShared.h"
void KoOdfGraphicStyles::saveOasisFillStyle( KoGenStyle &styleFill, KoGenStyles& mainStyles, const QBrush & brush )
......@@ -192,11 +192,11 @@ QString KoOdfGraphicStyles::saveOasisGradientStyle( KoGenStyles &mainStyles, con
return mainStyles.lookup( gradientStyle, "gradient" );
}
QBrush KoOdfGraphicStyles::loadOasisGradientStyle( const KoStyleStack &styleStack, const KoOasisStyles & oasisStyles, const QSizeF &size )
QBrush KoOdfGraphicStyles::loadOasisGradientStyle( const KoStyleStack &styleStack, const KoOdfStylesReader & stylesReader, const QSizeF &size )
{
QString styleName = styleStack.property( KoXmlNS::draw, "fill-gradient-name" );
KoXmlElement* e = oasisStyles.drawStyles()[styleName];
KoXmlElement* e = stylesReader.drawStyles()[styleName];
if( ! e )
return QBrush();
......@@ -324,7 +324,7 @@ QBrush KoOdfGraphicStyles::loadOasisPatternStyle( const KoStyleStack &styleStack
{
QString styleName = styleStack.property( KoXmlNS::draw, "fill-image-name" );
KoXmlElement* e = context.oasisStyles().drawStyles()[styleName];
KoXmlElement* e = context.stylesReader().drawStyles()[styleName];
if( ! e )
return QBrush();
......@@ -434,7 +434,7 @@ QBrush KoOdfGraphicStyles::loadOasisPatternStyle( const KoStyleStack &styleStack
return resultBrush;
}
QBrush KoOdfGraphicStyles::loadOasisFillStyle( const KoStyleStack &styleStack, const QString & fill, const KoOasisStyles & oasisStyles )
QBrush KoOdfGraphicStyles::loadOasisFillStyle( const KoStyleStack &styleStack, const QString & fill, const KoOdfStylesReader & stylesReader )
{
QBrush tmpBrush;
if ( fill == "solid" )
......@@ -501,7 +501,7 @@ QBrush KoOdfGraphicStyles::loadOasisFillStyle( const KoStyleStack &styleStack, c
//type not defined by default
//try to use style.
KoXmlElement* draw = oasisStyles.drawStyles()[style];
KoXmlElement* draw = stylesReader.drawStyles()[style];
if ( draw)
{
kDebug(30003)<<"We have a style";
......@@ -588,7 +588,7 @@ QBrush KoOdfGraphicStyles::loadOasisFillStyle( const KoStyleStack &styleStack, c
return tmpBrush;
}
QPen KoOdfGraphicStyles::loadOasisStrokeStyle( const KoStyleStack &styleStack, const QString & stroke, const KoOasisStyles & oasisStyles )
QPen KoOdfGraphicStyles::loadOasisStrokeStyle( const KoStyleStack &styleStack, const QString & stroke, const KoOdfStylesReader & stylesReader )
{
QPen tmpPen;
......@@ -620,7 +620,7 @@ QPen KoOdfGraphicStyles::loadOasisStrokeStyle( const KoStyleStack &styleStack, c
{
QString dashStyleName = styleStack.property( KoXmlNS::draw, "stroke-dash" );
KoXmlElement * dashElement = oasisStyles.drawStyles()[ dashStyleName ];
KoXmlElement * dashElement = stylesReader.drawStyles()[ dashStyleName ];
if( dashElement )
{
QVector<qreal> dashes;
......
......@@ -34,7 +34,7 @@ class KoGenStyle;
class KoGenStyles;
class KoStyleStack;
class KoOasisStyles;
class KoOdfStylesReader;
class KoOasisLoadingContext;
class KOMAIN_EXPORT KoOdfGraphicStyles
......@@ -47,15 +47,15 @@ public:
/// Saves gradient style of brush into mainStyles and returns the styles name
static QString saveOasisGradientStyle( KoGenStyles &mainStyles, const QBrush &brush );
/// Loads gradient style from style stack and oasisStyles adapted to the given size and returns a brush
static QBrush loadOasisGradientStyle( const KoStyleStack &styleStack, const KoOasisStyles & oasisStyles, const QSizeF &size );
/// Loads gradient style from style stack and stylesReader adapted to the given size and returns a brush
static QBrush loadOasisGradientStyle( const KoStyleStack &styleStack, const KoOdfStylesReader & stylesReader, const QSizeF &size );
/// Loads pattern style from style stack and oasisstyle adapted to the given size
static QBrush loadOasisPatternStyle( const KoStyleStack &styleStack, KoOasisLoadingContext & context, const QSizeF &size );
static QBrush loadOasisFillStyle( const KoStyleStack &styleStack, const QString & fill, const KoOasisStyles & oasisStyles );
static QBrush loadOasisFillStyle( const KoStyleStack &styleStack, const QString & fill, const KoOdfStylesReader & stylesReader );
static QPen loadOasisStrokeStyle( const KoStyleStack &styleStack, const QString & stroke, const KoOasisStyles & oasisStyles );
static QPen loadOasisStrokeStyle( const KoStyleStack &styleStack, const QString & stroke, const KoOdfStylesReader & stylesReader );
/// Helper function to parse a transformation attribute
static QMatrix loadTransformation( const QString &transformation );
......
......@@ -17,7 +17,7 @@ set(koodf_LIB_SRCS
KoGenStyles.cpp
KoOasisLoadingContext.cpp
KoOasisSettings.cpp
KoOasisStyles.cpp
KoOdfStylesReader.cpp
KoOdfNumberStyles.cpp
KoOdfPaste.cpp
KoOdfReadStore.cpp
......@@ -42,8 +42,8 @@ install( FILES
KoGenStyles.h
KoOasisLoadingContext.h
KoOasisSettings.h
KoOasisStyles.cpp
KoOasisStyles.h
KoOdfStylesReader.cpp
KoOdfStylesReader.h
KoOdfNumberStyles.h
KoOdfPaste.h
KoOdfReadStore.h
......
......@@ -18,7 +18,7 @@
#include "KoOasisLoadingContext.h"
#include <KoOdfReadStore.h>
#include <KoOasisStyles.h>
#include <KoOdfStylesReader.h>
#include <KoStore.h>
#include <KoXmlNS.h>
#include <kdebug.h>
......@@ -29,8 +29,8 @@ class KoOasisLoadingContext::Private
};
KoOasisLoadingContext::KoOasisLoadingContext( KoDocument* doc,
KoOasisStyles& styles, KoStore* store )
: m_doc( doc ), m_store( store ), m_styles( styles ),
KoOdfStylesReader& stylesReader, KoStore* store )
: m_doc( doc ), m_store( store ), m_stylesReader( stylesReader ),
m_metaXmlParsed( false ), m_useStylesAutoStyles( false ), d( 0 )
{
// Ideally this should be done by KoDocument and passed as argument here...
......@@ -54,13 +54,13 @@ void KoOasisLoadingContext::fillStyleStack( const KoXmlElement& object, const ch
bool isStyleAutoStyle = false;
if ( m_useStylesAutoStyles ) {
// When loading something from styles.xml, look into the styles.xml auto styles first
style = m_styles.findStyleAutoStyle( styleName, family );
style = m_stylesReader.findStyleAutoStyle( styleName, family );
// and fallback to looking at styles(), which includes the user styles from styles.xml
if ( style )
isStyleAutoStyle = true;
}
if ( !style )
style = m_styles.findStyle( styleName, family );
style = m_stylesReader.findStyle( styleName, family );
if ( style )
addStyles( style, family, isStyleAutoStyle );
else
......@@ -78,18 +78,18 @@ void KoOasisLoadingContext::addStyles( const KoXmlElement* style, const char* fa
const KoXmlElement* parentStyle = 0;
if ( usingStylesAutoStyles ) {
// When loading something from styles.xml, look into the styles.xml auto styles first
parentStyle = m_styles.findStyleAutoStyle( parentStyleName, family );
parentStyle = m_stylesReader.findStyleAutoStyle( parentStyleName, family );
// and fallback to looking at styles(), which includes the user styles from styles.xml
}
if ( !parentStyle )
parentStyle = m_styles.findStyle( parentStyleName, family );
parentStyle = m_stylesReader.findStyle( parentStyleName, family );
if ( parentStyle )
addStyles( parentStyle, family, usingStylesAutoStyles );
else
kWarning(32500) << "Parent style not found: " << parentStyleName;
}
else if ( family ) {
const KoXmlElement* def = m_styles.defaultStyle( family );
const KoXmlElement* def = m_stylesReader.defaultStyle( family );
if ( def ) { // on top of all, the default style for this family
//kDebug(32500) <<"pushing default style" << style->attributeNS( KoXmlNS::style,"name", QString() );
m_styleStack.push( *def );
......
......@@ -20,7 +20,7 @@
#define KOOASISLOADINGCONTEXT_H
class KoDocument;
class KoOasisStyles;
class KoOdfStylesReader;
class KoStore;
#include <QMap>
......@@ -38,22 +38,22 @@ class KOODF_EXPORT KoOasisLoadingContext
{
public:
/**
* Stores reference to the KoOasisStyles and stored passed by
* KoDocument. Make sure that the KoOasisStyles instance outlives
* Stores reference to the KoOdfStylesReader and stored passed by
* KoDocument. Make sure that the KoOdfStylesReader instance outlives
* this KoOasisLoadingContext instance. (This is the case during
* loading, when using the KoOasisStyles given by KoDocument)
* loading, when using the KoOdfStylesReader given by KoDocument)
*
* @param doc the KoDocument being loaded
* @param styles reference to the KoOasisStyles parsed by KoDocument
* @param styles reference to the KoOdfStylesReader parsed by KoDocument
* @param store pointer to store, if available, for e.g. loading images.
*/
KoOasisLoadingContext( KoDocument* doc, KoOasisStyles& styles, KoStore* store );
KoOasisLoadingContext( KoDocument* doc, KoOdfStylesReader& stylesReader, KoStore* store );
virtual ~KoOasisLoadingContext();
KoDocument* koDocument() { return m_doc; }
KoStore* store() { return m_store; }
KoOasisStyles& oasisStyles() { return m_styles; }
KoOdfStylesReader& stylesReader() { return m_stylesReader; }
KoStyleStack& styleStack() { return m_styleStack; }
const KoXmlDocument& manifestDocument() const { return m_manifestDoc; }
......@@ -102,7 +102,7 @@ private:
private:
KoDocument* m_doc;
KoStore* m_store;
KoOasisStyles& m_styles;
KoOdfStylesReader& m_stylesReader;
KoStyleStack m_styleStack;
mutable QString m_generator;
......
......@@ -25,7 +25,7 @@
#include <KoStore.h>
#include <KoXmlReader.h>
#include "KoOasisStyles.h"
#include "KoOdfStylesReader.h"
#include "KoXmlNS.h"
struct KoOdfReadStore::Private
......@@ -35,7 +35,7 @@ struct KoOdfReadStore::Private
{}
KoStore * store;
KoOasisStyles styles;
KoOdfStylesReader stylesReader;
// it is needed to keep the stylesDoc around so that you can access the styles
KoXmlDocument stylesDoc;
KoXmlDocument contentDoc;
......@@ -72,9 +72,9 @@ KoStore * KoOdfReadStore::store() const
return d->store;
}
KoOasisStyles & KoOdfReadStore::styles()
KoOdfStylesReader & KoOdfReadStore::styles()
{
return d->styles;
return d->stylesReader;
}
const KoXmlDocument & KoOdfReadStore::contentDoc() const
......@@ -95,9 +95,9 @@ bool KoOdfReadStore::loadAndParse( QString & errorMessage )
loadAndParse( "styles.xml", d->stylesDoc, errorMessage );
// Load styles from style.xml
d->styles.createStyleMap( d->stylesDoc, true );
d->stylesReader.createStyleMap( d->stylesDoc, true );
// Also load styles from content.xml
d->styles.createStyleMap( d->contentDoc, false );
d->stylesReader.createStyleMap( d->contentDoc, false );
// TODO post 1.4, pass manifestDoc to the apps so that they don't have to do it themselves
// (when calling KoDocumentChild::loadOasisDocument)
......
......@@ -23,7 +23,7 @@ class QString;
class QIODevice;
class QXmlSimpleReader;
class KoStore;
class KoOasisStyles;
class KoOdfStylesReader;
class KoXmlDocument;
/**
......@@ -60,7 +60,7 @@ public:
*
* @return styles
*/
KoOasisStyles & styles();
KoOdfStylesReader & styles();
/**
* Get the content document
......
......@@ -17,7 +17,7 @@
* Boston, MA 02110-1301, USA.
*/
#include "KoOasisStyles.h"
#include "KoOdfStylesReader.h"
#include "KoDom.h"
#include "KoGenStyles.h"
......@@ -31,7 +31,7 @@
#include <KoXmlReader.h>
class KoOasisStyles::Private
class KoOdfStylesReader::Private
{
public:
QHash<QString /*family*/, QHash<QString /*name*/, KoXmlElement*> > customStyles;
......@@ -52,12 +52,12 @@ public:
DataFormatsMap dataFormats;
};
KoOasisStyles::KoOasisStyles()
KoOdfStylesReader::KoOdfStylesReader()
: d( new Private )
{
}
KoOasisStyles::~KoOasisStyles()
KoOdfStylesReader::~KoOdfStylesReader()
{
foreach ( const QString& family, d->customStyles.keys() )
qDeleteAll( d->customStyles[family] );
......@@ -73,7 +73,7 @@ KoOasisStyles::~KoOasisStyles()
delete d;
}
void KoOasisStyles::createStyleMap( const KoXmlDocument& doc, bool stylesDotXml )
void KoOdfStylesReader::createStyleMap( const KoXmlDocument& doc, bool stylesDotXml )
{
const KoXmlElement docElement = doc.documentElement();
// We used to have the office:version check here, but better let the apps do that
......@@ -127,26 +127,26 @@ void KoOasisStyles::createStyleMap( const KoXmlDocument& doc, bool stylesDotXml
//kDebug(30003) <<"Styles read in.";
}
QHash<QString, KoXmlElement*> KoOasisStyles::customStyles(const QString& family) const
QHash<QString, KoXmlElement*> KoOdfStylesReader::customStyles(const QString& family) const
{
if ( family.isNull() )
return QHash<QString, KoXmlElement*>();
return d->customStyles.value( family );
}
QHash<QString, KoXmlElement*> KoOasisStyles::autoStyles(const QString& family, bool stylesDotXml ) const
QHash<QString, KoXmlElement*> KoOdfStylesReader::autoStyles(const QString& family, bool stylesDotXml ) const
{
if ( family.isNull() )
return QHash<QString, KoXmlElement*>();
return stylesDotXml ? d->stylesAutoStyles.value( family ) : d->contentAutoStyles.value( family );
}
const KoOasisStyles::DataFormatsMap& KoOasisStyles::dataFormats() const
const KoOdfStylesReader::DataFormatsMap& KoOdfStylesReader::dataFormats() const
{
return d->dataFormats;
}