Commit b0833aa4 authored by Thorsten Zachmann's avatar Thorsten Zachmann

o more loading/saving of graphics styles from KoOasisStyles to KoOdfGraphicStyles

svn path=/trunk/koffice/; revision=737925
parent c6968967
......@@ -44,6 +44,7 @@
#include <KoGenStyle.h>
#include <KoUnit.h>
#include <KoOasisStyles.h>
#include <KoOdfGraphicStyles.h>
#include <KoOasisLoadingContext.h>
#include <QPainter>
......@@ -729,11 +730,11 @@ QBrush KoShape::loadOdfFill( const KoXmlElement & element, KoShapeLoadingContext
KoStyleStack &styleStack = context.koLoadingContext().styleStack();
QString fill = getStyleProperty( "fill", element, context );
if ( fill == "solid" || fill == "hatch" )
return KoOasisStyles::loadOasisFillStyle( styleStack, fill, context.koLoadingContext().oasisStyles() );
return KoOdfGraphicStyles::loadOasisFillStyle( styleStack, fill, context.koLoadingContext().oasisStyles() );
else if( fill == "gradient" )
return KoOasisStyles::loadOasisGradientStyle( styleStack, context.koLoadingContext().oasisStyles(), size() );
return KoOdfGraphicStyles::loadOasisGradientStyle( styleStack, context.koLoadingContext().oasisStyles(), size() );
else if( fill == "bitmap" )
return KoOasisStyles::loadOasisPatternStyle( styleStack, context.koLoadingContext(), size() );
return KoOdfGraphicStyles::loadOasisPatternStyle( styleStack, context.koLoadingContext(), size() );
return QBrush();
}
......@@ -744,7 +745,7 @@ KoShapeBorderModel * KoShape::loadOdfStroke( const KoXmlElement & element, KoSha
QString stroke = getStyleProperty( "stroke", element, context );
if( stroke == "solid" || stroke == "dash" )
{
QPen pen = KoOasisStyles::loadOasisStrokeStyle( styleStack, stroke, context.koLoadingContext().oasisStyles() );
QPen pen = KoOdfGraphicStyles::loadOasisStrokeStyle( styleStack, stroke, context.koLoadingContext().oasisStyles() );
KoLineBorder * border = new KoLineBorder();
border->setLineWidth( pen.widthF() );
......
......@@ -25,7 +25,7 @@
#include <KoXmlWriter.h>
#include <KoGenStyle.h>
#include <KoGenStyles.h>
#include <KoOasisStyles.h>
#include <KoOdfGraphicStyles.h>
KoShapeStyleWriter::KoShapeStyleWriter( KoShapeSavingContext &context )
: m_context( context )
......@@ -46,7 +46,7 @@ QString KoShapeStyleWriter::addFillStyle( KoGenStyle &style, const QBrush &fill
style.addProperty( "draw:fill-image-name", savePatternStyle( style, fill ) );
break;
default:
KoOasisStyles::saveOasisFillStyle( style, m_context.mainStyles(), fill );
KoOdfGraphicStyles::saveOasisFillStyle( style, m_context.mainStyles(), fill );
break;
}
......
......@@ -33,6 +33,7 @@
#include <KoGenStyle.h>
#include <KoGenStyles.h>
#include <KoOasisStyles.h>
#include <KoOdfGraphicStyles.h>
#include <KoXmlWriter.h>
#include <KoViewConverter.h>
......@@ -102,7 +103,7 @@ void KoPAPageBase::saveOdfPageStyleData( KoGenStyle &style, KoPASavingContext &p
{
//TODO
QBrush background( Qt::white );
KoOasisStyles::saveOasisFillStyle( style, paContext.mainStyles(), background );
KoOdfGraphicStyles::saveOasisFillStyle( style, paContext.mainStyles(), background );
}
bool KoPAPageBase::loadOdf( const KoXmlElement &element, KoShapeLoadingContext & loadingContext )
......
......@@ -43,6 +43,7 @@ set(komain_LIB_SRCS
KoChild.cpp
kofficeversion.cc
KoOasisStyles.cpp
KoOdfGraphicStyles.cpp
KoOasisSettings.cpp
KoPageFormat.cpp
KoPageLayout.cpp
......@@ -138,6 +139,7 @@ install( FILES
KoPictureCollection.h
kofficeversion.h
KoOasisStyles.h
KoOdfGraphicStyles.h
KoOasisSettings.h
KoPageFormat.h
KoPageLayout.h
......
This diff is collapsed.
......@@ -150,21 +150,6 @@ public:
static QString saveOasisTextStyle( KoGenStyles &mainStyles, const QString & _format,
const QString &_prefix = QString() , const QString &_suffix= QString() );
static void saveOasisFillStyle( KoGenStyle &styleFill, KoGenStyles& mainStyles, const QBrush & brush );
static QString saveOasisHatchStyle( KoGenStyles& mainStyles, const QBrush &brush );
/// 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 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 QPen loadOasisStrokeStyle( const KoStyleStack &styleStack, const QString & stroke, const KoOasisStyles & oasisStyles );
/// Helper function to parse a transformation attribute
static QMatrix loadTransformation( const QString &transformation );
/// Helper function to create a transformation attribute
......
This diff is collapsed.
/* This file is part of the KDE project
Copyright (C) 2004-2006 David Faure <faure@kde.org>
Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
Copyright (C) 2007 Thorsten Zachmann <zachmann@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOODFGRAPHICSTYLES_H
#define KOODFGRAPHICSTYLES_H
#include <komain_export.h>
class QBrush;
class QPen;
class QString;
class QSizeF;
class KoGenStyle;
class KoGenStyles;
class KoStyleStack;
class KoOasisStyles;
class KoOasisLoadingContext;
class KOMAIN_EXPORT KoOdfGraphicStyles
{
public:
static void saveOasisFillStyle( KoGenStyle &styleFill, KoGenStyles& mainStyles, const QBrush & brush );
static QString saveOasisHatchStyle( KoGenStyles& mainStyles, const QBrush &brush );
/// 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 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 QPen loadOasisStrokeStyle( const KoStyleStack &styleStack, const QString & stroke, const KoOasisStyles & oasisStyles );
};
#endif /* KOODFGRAPHICSTYLES_H */
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