Commit c5a72684 authored by Jan Hambrecht's avatar Jan Hambrecht

KoShapeStyleWriter is not used anywhere anymore, so i removed it.


svn path=/trunk/koffice/; revision=824041
parent bc91c050
......@@ -57,7 +57,6 @@ set(flake_SRCS
KoColorBackground.cpp
KoGradientBackground.cpp
KoPatternBackground.cpp
KoShapeStyleWriter.cpp
KoShapeConfigWidgetBase.cpp
KoDrag.cpp
KoDragOdfSaveHelper.cpp
......
......@@ -40,7 +40,6 @@
#include "KoViewConverter.h"
#include "KoLineBorder.h"
#include "ShapeDeleter_p.h"
#include "KoShapeStyleWriter.h"
#include "KoShapeShadow.h"
#include "KoEventAction.h"
#include "KoEventActionRegistry.h"
......
/* This file is part of the KDE project
Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
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.
*/
#include "KoShapeStyleWriter.h"
#include "KoShapeSavingContext.h"
#include "KoShape.h"
#include "KoShapeBorderModel.h"
#include <KoXmlWriter.h>
#include <KoGenStyle.h>
#include <KoGenStyles.h>
#include <KoOdfGraphicStyles.h>
KoShapeStyleWriter::KoShapeStyleWriter( KoShapeSavingContext &context )
: m_context( context )
{
}
QString KoShapeStyleWriter::addFillStyle( KoGenStyle &style, const QBrush &fill )
{
saveFillStyle( style, fill );
if ( m_context.isSet( KoShapeSavingContext::AutoStyleInStyleXml ) ) {
style.setAutoStyleInStylesDotXml( true );
}
return m_context.mainStyles().lookup( style, m_context.isSet( KoShapeSavingContext::PresentationShape ) ? "pr" : "gr" );
}
void KoShapeStyleWriter::saveFillStyle( KoGenStyle &style, const QBrush &fill )
{
switch ( fill.style() )
{
case Qt::NoBrush:
style.addProperty( "draw:fill","none" );
break;
// the pattern style needs special handling regarding the saving of
// the pattern texture, os we handle that here
case Qt::TexturePattern:
style.addProperty( "draw:fill","bitmap" );
style.addProperty( "draw:fill-image-name", savePatternStyle( style, fill ) );
break;
default:
KoOdfGraphicStyles::saveOasisFillStyle( style, m_context.mainStyles(), fill );
break;
}
}
QString KoShapeStyleWriter::savePatternStyle( KoGenStyle &style, const QBrush &brush )
{
QPixmap texture = brush.texture();
QMatrix matrix = brush.matrix();
QSize size = texture.size();
style.addProperty( "style:repeat", "repeat" );
style.addProperty( "draw:fill-image-ref-point-x", QString("%1%").arg( matrix.dx()/size.width() * 100.0 ) );
style.addProperty( "draw:fill-image-ref-point-y", QString("%1%").arg( matrix.dy()/size.height() * 100.0 ) );
//style.addAttribute( "draw:fill-image-height", texture.height() );
//style.addAttribute( "draw:fill-image-width", texture.width() );
KoGenStyle patternStyle( KoGenStyle::StyleFillImage /*no family name*/ );
patternStyle.addAttribute( "xlink:show", "embed" );
patternStyle.addAttribute( "xlink:actuate", "onLoad" );
patternStyle.addAttribute( "xlink:type", "simple" );
patternStyle.addAttribute( "xlink:href", m_context.addImageForSaving( texture ) );
return m_context.mainStyles().lookup( patternStyle, "picture" );
}
/* This file is part of the KDE project
Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
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 KOSHAPESTYLEWRITER_H
#define KOSHAPESTYLEWRITER_H
#include "flake_export.h"
#include <QtCore/QString>
class KoShapeSavingContext;
class KoGenStyle;
class KoXmlWriter;
class QBrush;
/// A helper class for writing the shape styles to ODF.
class FLAKE_EXPORT KoShapeStyleWriter
{
public:
/// Creates a new shape style writer working on the given saving context
KoShapeStyleWriter( KoShapeSavingContext &context );
/**
* Writes the style of the brush using the internal saving context
* @param style the style to write to
* @param fill the fill style to save
* @return the name of the saved style
*/
QString addFillStyle( KoGenStyle &style, const QBrush &fill );
/**
* Add the fill style to the current style
*
* This is nearly the same as addFillStyle but it does not add the generated style
* to the styles collection
*
* @param style the style to write to
* @param fill the fill style to save
*/
void saveFillStyle( KoGenStyle &style, const QBrush &fill );
private:
/// Saves pattern style
QString savePatternStyle( KoGenStyle &style, const QBrush &brush );
KoShapeSavingContext & m_context; ///< the shape saving context the styles are added to
};
#endif // KOSHAPESTYLEWRITER_H
......@@ -34,7 +34,6 @@
#include <KoTextSharedLoadingData.h>
#include <KoTextDocumentLayout.h>
#include <KoInlineTextObjectManager.h>
#include <KoShapeStyleWriter.h>
#include <KoStyleManager.h>
#include <KoPathShape.h>
#include <KoLineBorder.h>
......
......@@ -35,7 +35,6 @@
#include <KoGenStyles.h>
#include <KoOdfStylesReader.h>
#include <KoOdfGraphicStyles.h>
#include <KoShapeStyleWriter.h>
#include <KoXmlWriter.h>
#include <KoViewConverter.h>
#include <KoShapeBackground.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