[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/kchart/shape
From: Johannes Simon <johannes.simon () gmail ! com>
Date: 2008-07-31 21:29:34
Message-ID: 1217539774.333396.13057.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 840331 by jsimon:
Use proper arguments for loadOdf() and use KoStyleStack to load styles + cleanup
M +15 -40 Legend.cpp
M +0 -1 Legend.h
--- trunk/koffice/kchart/shape/Legend.cpp #840330:840331
@@ -321,11 +321,11 @@
d->pixmapRepaintRequested = true;
}
-void Legend::setSize( const QSizeF &size )
+void Legend::setSize( const QSizeF &newSize )
{
- d->kdLegend->resize( size.toSize() );
- d->kdLegend->resizeLayout( size.toSize() );
- KoShape::setSize( size );
+ d->kdLegend->resize( newSize.toSize() );
+ d->kdLegend->resizeLayout( newSize.toSize() );
+ KoShape::setSize( newSize );
}
@@ -398,12 +398,11 @@
// Only reimplemneted because pure virtual in KoShape, but not needed
bool Legend::loadOdf( const KoXmlElement &legendElement, KoShapeLoadingContext \
&context ) {
+ KoStyleStack &styleStack = context.odfLoadingContext().styleStack();
+ styleStack.save();
+
loadOdfAttributes( legendElement, context, OdfAllAttributes );
- return loadOdf( legendElement, context.odfLoadingContext().stylesReader() );
-}
-
-bool Legend::loadOdf( const KoXmlElement &legendElement, const KoOdfStylesReader \
&stylesReader )
-{
+
// TODO: Read optional attributes
// 1. Legend expansion
// 2. Advanced legend styling
@@ -471,37 +470,13 @@
}
if ( legendElement.hasAttributeNS( KoXmlNS::chart, "style-name" ) ) {
- QString styleName = legendElement.attributeNS( KoXmlNS::chart, \
"style-name", QString() );
- const KoXmlElement *styleElement = stylesReader.findStyle( styleName, \
"chart" );
- if ( styleElement ) {
- KoXmlElement graphicsPropertiesElement = styleElement->namedItemNS( \
KoXmlNS::style, "graphic-properties" ).toElement();
- if ( !graphicsPropertiesElement.isNull() ) {
- if ( graphicsPropertiesElement.hasAttributeNS( KoXmlNS::draw, \
"stroke" ) ) {
- // TODO (Johannes): set stroke type of legend border
- QString stroke = graphicsPropertiesElement.attributeNS( \
KoXmlNS::draw, "stroke", QString() );
- QString strokeColor = graphicsPropertiesElement.attributeNS( \
KoXmlNS::draw, "stroke-color", QString() );
- // use overloaded QColor constructor to convert QString (in \
form of "#rrggbb") to QColor
- setFrameColor( strokeColor );
- }
- if ( graphicsPropertiesElement.hasAttributeNS( KoXmlNS::draw, \
"fill" ) ) {
- QString fill = graphicsPropertiesElement.attributeNS( \
KoXmlNS::draw, "fill", QString() );
- if ( fill == "solid" ) {
- QString fillColor = \
graphicsPropertiesElement.attributeNS( KoXmlNS::draw, "fill-color", \
QString() );
- // use overloaded QColor constructor to convert QString \
(in form of "#rrggbb") to QColor
- setBackgroundColor( fillColor );
- }
- }
- }
-
- KoXmlElement textPropertiesElement = styleElement->namedItemNS( \
KoXmlNS::style, "text-properties" ).toElement();
- if ( !textPropertiesElement.isNull() )
- {
- if ( textPropertiesElement.hasAttributeNS( KoXmlNS::fo, \
"font-size" ) )
- {
- const qreal fontSize = KoUnit::parseValue( \
textPropertiesElement.attributeNS( KoXmlNS::fo, "font-size" ) );
- setFontSize( fontSize );
- }
- }
+ context.odfLoadingContext().fillStyleStack( legendElement, \
KoXmlNS::chart, "style-name", "chart" ); +
+ styleStack.setTypeProperties( "text" );
+
+ if ( styleStack.hasProperty( KoXmlNS::fo, "font-size" ) )
+ {
+ setFontSize( KoUnit::parseValue( styleStack.property( KoXmlNS::fo, \
"font-size" ) ) ); }
}
}
--- trunk/koffice/kchart/shape/Legend.h #840330:840331
@@ -68,7 +68,6 @@
void paintPixmap( QPainter &painter, const KoViewConverter &converter );
bool loadOdf( const KoXmlElement &legendElement, KoShapeLoadingContext &context \
);
- bool loadOdf( const KoXmlElement &legendElement, const KoOdfStylesReader \
&stylesReader );
void saveOdf( KoXmlWriter &bodyWriter, KoGenStyles &mainStyles ) const;
void saveOdf( KoShapeSavingContext &context ) const;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic