[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/kchart/shape
From:       Inge Wallin <inge () lysator ! liu ! se>
Date:       2010-06-07 13:59:55
Message-ID: 20100607135955.DDA33AC8CF () svn ! kde ! org
[Download RAW message or body]

SVN commit 1135523 by ingwa:

Fix a couple of FIXME's and warnings
 * Remove all traces of KDChart from the ChartShapeFactory
 * Simplify a private API in ChartShape
 * Fix some warnings


 M  +3 -1      ChartConfigWidget.cpp  
 M  +6 -5      ChartShape.cpp  
 M  +1 -0      ChartShape.h  
 M  +1 -6      ChartShapeFactory.cpp  
 M  +0 -1      KDChartModel.cpp  
 M  +6 -0      Legend.cpp  
 M  +2 -0      Legend.h  
 M  +4 -1      PlotArea.cpp  


--- trunk/koffice/kchart/shape/ChartConfigWidget.cpp #1135522:1135523
@@ -77,7 +77,6 @@
     ChartShape            *shape;
 
     // Basic properties of the chart.
-    // FIXME: why are they needed here?
     ChartType              type;
     ChartSubtype           subtype;
     bool                   threeDMode;
@@ -179,8 +178,11 @@
     lastFixedPosition       = KDChart::Position::East;
     selectedDataSet = 0;
     shape = 0;
+
     type = KChart::LastChartType;
     subtype = KChart::NoChartSubtype;
+    threeDMode = false;
+
     isExternalDataSource = false;
     cellRegionStringValidator = 0;
 
--- trunk/koffice/kchart/shape/ChartShape.cpp #1135522:1135523
@@ -244,7 +244,7 @@
     Private( ChartShape *shape );
     ~Private();
 
-    bool loadOdfLabel( KoShape *label, KoXmlElement &labelElement, \
KoShapeLoadingContext &context ); +    bool loadOdfLabel( KoShape *label, \
KoXmlElement &labelElement );  void showLabel( KoShape *label, bool doShow );
 
     // The components of a chart
@@ -290,7 +290,7 @@
 {
 }
 
-bool ChartShape::Private::loadOdfLabel( KoShape *label, KoXmlElement &labelElement, \
KoShapeLoadingContext &context ) +bool ChartShape::Private::loadOdfLabel( KoShape \
*label, KoXmlElement &labelElement )  {
     TextLabelData *labelData = qobject_cast<TextLabelData*>( label->userData() );
     if ( !labelData )
@@ -1015,7 +1015,7 @@
     KoXmlElement titleElem = KoXml::namedItemNS( chartElement,
                                                  KoXmlNS::chart, "title" );
     if ( !titleElem.isNull() ) {
-        if ( !d->loadOdfLabel( d->title, titleElem, context) )
+        if ( !d->loadOdfLabel( d->title, titleElem ) )
             return false;
         d->showLabel(d->title, true);
     }
@@ -1024,7 +1024,7 @@
     KoXmlElement subTitleElem = KoXml::namedItemNS( chartElement,
                                                     KoXmlNS::chart, "subtitle" );
     if ( !subTitleElem.isNull() ) {
-        if ( !d->loadOdfLabel( d->subTitle, subTitleElem, context) )
+        if ( !d->loadOdfLabel( d->subTitle, subTitleElem ) )
             return false;
         d->showLabel(d->subTitle, true);
     }
@@ -1033,7 +1033,7 @@
     KoXmlElement footerElem = KoXml::namedItemNS( chartElement,
                                                   KoXmlNS::chart, "footer" );
     if ( !footerElem.isNull() ) {
-        if ( !d->loadOdfLabel( d->footer, footerElem, context ) )
+        if ( !d->loadOdfLabel( d->footer, footerElem ) )
             return false;
         d->showLabel(d->footer, true);
     }
@@ -1182,6 +1182,7 @@
     bodyWriter.endElement(); // table:table-row
     bodyWriter.endElement(); // table:table-header-rows
 
+    // Here start the actual data rows.
     bodyWriter.startElement( "table:table-rows" );
     //QStringList::const_iterator rowLabelIt = m_rowLabels.begin();
     for ( int row = 0; row < rows ; ++row ) {
--- trunk/koffice/kchart/shape/ChartShape.h #1135522:1135523
@@ -56,6 +56,7 @@
 class KoGenStyles;
 class KoOdfStylesReader;
 
+// FIXME: Remove all mentions of KDChart from the public API.
 namespace KDChart {
     class Chart;
     class Legend;
--- trunk/koffice/kchart/shape/ChartShapeFactory.cpp #1135522:1135523
@@ -34,9 +34,6 @@
 #include <KoToolRegistry.h>
 #include <KoShapeRegistry.h>
 
-// KDChart
-#include <KDChartLegend>
-
 // Chart shape
 #include "ChartToolFactory.h"
 #include "ChartConfigWidget.h"
@@ -131,9 +128,7 @@
     QPointF  plotAreaPos( 0.0, 0.0 );
     QSizeF   plotAreaSize( shapeSize );
     Legend *legend = shape->legend();
-    // FIXME: Remove *all* references to KDChart from this class!
-    legend->kdLegend()->forceRebuild();
-    legend->update();
+    legend->rebuild();          // Implies update()
 
     QPointF  legendPos( 0.0, 0.0 );
     QSizeF   legendSize = legend->size();
--- trunk/koffice/kchart/shape/KDChartModel.cpp #1135522:1135523
@@ -365,7 +365,6 @@
 
     if ( orientation != d->dataDirection ) {
         int dataSetNumber = section / d->dataDimensions;
-
         if ( d->dataSets.count() <= dataSetNumber ) {
             qWarning() << "KDChartModel::headerData(): trying to get more datasets \
than we have.";  return QVariant();
--- trunk/koffice/kchart/shape/Legend.cpp #1135522:1135523
@@ -593,6 +593,12 @@
     return d->kdLegend;
 }
 
+void Legend::rebuild()
+{
+    d->kdLegend->forceRebuild();
+    update();
+}
+
 void Legend::update() const
 {
     d->pixmapRepaintRequested = true;
--- trunk/koffice/kchart/shape/Legend.h #1135522:1135523
@@ -1,6 +1,7 @@
 /* This file is part of the KDE project
 
    Copyright 2007-2008 Johannes Simon <johannes.simon@gmail.com>
+   Copyright 2010      Inge Wallin <inge@lysator.liu.se>
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
@@ -78,6 +79,7 @@
 
     KDChart::Legend *kdLegend() const;
 
+    void rebuild();
     using KoShape::update;
     void update() const;
 
--- trunk/koffice/kchart/shape/PlotArea.cpp #1135522:1135523
@@ -113,7 +113,7 @@
     ThreeDScene  *threeDScene;
     
     // ----------------------------------------------------------------
-    // Data specific to each types
+    // Data specific to each chart type
 
     // table:cell-range-address, ODF v1.2, $18.595
     CellRegion cellRangeAddress;
@@ -502,6 +502,9 @@
         case BubbleChartType:
             dimensions = 3;
             break;
+    case LastChartType:
+    default:
+        dimensions = 1;         // Shouldn't happen
     }
 
     d->shape->proxyModel()->setDataDimensions( dimensions );


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic