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

List:       kde-commits
Subject:    koffice/kchart
From:       Boudewijn Rempt <boud () valdyas ! org>
Date:       2009-06-16 20:50:49
Message-ID: 1245185449.549530.8583.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 982826 by rempt:

Make kchart compile and link

 M  +2 -2      CMakeLists.txt  
 M  +3 -4      shape/CMakeLists.txt  
 M  +64 -64    shape/ChartShape.cpp  
 M  +1 -2      tests/CMakeLists.txt  


--- trunk/koffice/kchart/CMakeLists.txt #982825:982826
@@ -9,13 +9,14 @@
 add_subdirectory( tests )
 
 include_directories(
+    ${KOMAIN_INCLUDES}
 	${CMAKE_CURRENT_SOURCE_DIR}/kdchart/include
 	${CMAKE_CURRENT_SOURCE_DIR}/kdchart/src
 	${CMAKE_CURRENT_SOURCE_DIR}/kdchart/examples/tools
 	${CMAKE_CURRENT_SOURCE_DIR}/dialogs
 	${CMAKE_CURRENT_SOURCE_DIR}/shape
 	${CMAKE_SOURCE_DIR}/interfaces 
-	${KOGUIUTILS_INCLUDES} )
+	 )
 
 
 ###########  target kchartcommon  ###############
@@ -41,7 +42,6 @@
 
 target_link_libraries(kchartcommon
 	kochart
-	koguiutils
 	kdchart
 	chartshapelib
     komain
--- trunk/koffice/kchart/shape/CMakeLists.txt #982825:982826
@@ -2,8 +2,8 @@
                      ${CMAKE_SOURCE_DIR}/kchart/kdchart/include
                      ${CMAKE_SOURCE_DIR}/interfaces
                      ${CMAKE_SOURCE_DIR}/kchart/shape/dialogs
-                     ${KOGUIUTILS_INCLUDES}
-                     ${KOTEXT_INCLUDES} )
+                     ${KOMAIN_INCLUDES}
+)
 
 ########### Flake Plugin library ###############
 
@@ -48,8 +48,6 @@
     chartshapelib
     kdchart
     flake
-    kotext
-    kostore
     komain
     ${KDE4_KDEUI_LIBS}
     ${KDE4_KPARTS_LIBS}
@@ -67,6 +65,7 @@
     kdchart
     flake
     kostore
+    komain
     ${KDE4_KDECORE_LIBS}
     ${KDE4_KDEUI_LIBS}
     ${QT_QTCORE_LIBRARY}
--- trunk/koffice/kchart/shape/ChartShape.cpp #982825:982826
@@ -52,7 +52,7 @@
 #include <KoToolRegistry.h>
 #include <KoTextShapeData.h>
 #include <KoOdfReadStore.h>
-#include <KoQueryTrader.h>
+#include <KoDocumentEntry.h>
 #include <KoOdfStylesReader.h>
 #include <KoCanvasBase.h>
 #include <KoShapeManager.h>
@@ -161,7 +161,7 @@
     Footer
 };
 
-QString saveOdfFont( KoGenStyles& mainStyles, 
+QString saveOdfFont( KoGenStyles& mainStyles,
                                  const QFont& font,
                                  const QColor& color )
 {
@@ -178,22 +178,22 @@
 }
 
 bool loadOdfLabel( KoShape *label, KoXmlElement &labelElement, KoShapeLoadingContext \
                &context )
-{   
+{
     TextLabelData *labelData = qobject_cast<TextLabelData*>( label->userData() );
     if ( !labelData )
         return false;
-    
+
     label->loadOdf( labelElement, context );
-    
+
     // TODO: Read optional attributes
     // 1. Table range
     KoXmlElement  pElement = KoXml::namedItemNS( labelElement,
                                             KoXmlNS::text, "p" );
-    
+
     labelData->document()->setPlainText( pElement.text() );
-    
+
     label->setVisible( true );
-    
+
     return true;
 }
 
@@ -205,7 +205,7 @@
     TextLabelData *labelData = qobject_cast<TextLabelData*>( label->userData() );
     if ( !labelData )
         return;
-    
+
     if ( odfLabelType == Footer )
         bodyWriter.startElement( "chart:footer" );
     else if ( odfLabelType == SubTitle )
@@ -252,9 +252,9 @@
 public:
     Private( ChartShape *shape );
     ~Private();
-    
+
     void showLabel( KoShape *label );
-    
+
     // The components of a chart
     KoShape   *title;
     KoShape   *subTitle;
@@ -263,13 +263,13 @@
     PlotArea  *plotArea;
     Surface   *wall;
     Surface   *floor;
-    
+
     // Data
     QAbstractItemModel  *internalModel; // The actual data
     ProxyModel          *model;		// What's presented to KDChart
-    
+
     ChartDocument *document;
-    
+
     ChartShape *shape;		// The chart that owns this ChartShape::Private
 };
 
@@ -297,7 +297,7 @@
 }
 
 
-// 
+//
 // Show a label, which means either the Title, Subtitle or Footer.
 //
 // If there is too little room, then make space by shrinking the Plotarea.
@@ -306,7 +306,7 @@
 void ChartShape::Private::showLabel( KoShape *label )
 {
     Q_ASSERT( label );
-    
+
     const QSizeF  plotAreaSize = plotArea->size();
     if ( label->position().y() + label->size().height() / 2.0
          < shape->size().height() / 2.0 )
@@ -316,7 +316,7 @@
 
         if ( spaceToExpand > 0.0 ) {
             plotArea->setSize( QSizeF( plotAreaSize.width(),
-                                       plotAreaSize.height() - spaceToExpand ) ); 
+                                       plotAreaSize.height() - spaceToExpand ) );
             plotArea->setPosition( QPointF( plotArea->position().x(),
                                             plotArea->position().y() + spaceToExpand \
) );  }
@@ -344,7 +344,7 @@
 				       plotAreaSize.height() - spaceToExpand ) );
         }
     }
-    
+
     label->setVisible( true );
 }
 
@@ -372,16 +372,16 @@
     d->plotArea->init();
     d->plotArea->setZIndex( 0 );
     setClipping( d->plotArea, true );
-    
-    
+
+
     // Create the legend.
     d->legend->setVisible( true );
     d->legend->setZIndex( 1 );
     setClipping( d->legend, true );
-    
+
     d->plotArea->setChartType( BarChartType );
     d->plotArea->setChartSubType( NormalChartSubtype );
-    
+
     // Create the Title, which is a standard TextShape.
     // We use a empty dataCenterMap here for the creation and then in
     // init() we init the shapes with the correct data.
@@ -397,7 +397,7 @@
         TextLabelData *dataDummy = new TextLabelData;
         d->title->setUserData( dataDummy );
     }
-    
+
     // Add the title to the shape
     addChild( d->title );
     QFont font = titleData()->document()->defaultFont();
@@ -425,7 +425,7 @@
     subTitleData()->document()->setDefaultFont( font );
     subTitleData()->document()->setHtml( "<div align=\"center\">" + i18n( "Subtitle" \
                ) + "</div>" );
     d->subTitle->setSize( QSizeF( CM_TO_POINT( 5 ), CM_TO_POINT( 0.6 ) ) );
-    d->subTitle->setPosition( QPointF( size().width() / 2.0 - \
d->title->size().width() / 2.0,  +    d->subTitle->setPosition( QPointF( \
size().width() / 2.0 - d->title->size().width() / 2.0,  d->title->size().height() ) \
);  d->subTitle->setVisible( false );
     d->subTitle->setZIndex( 3 );
@@ -454,15 +454,15 @@
     // Create the Floor and Wall.
     d->floor = new Surface( d->plotArea );
     d->wall = new Surface( d->plotArea );
-    
+
     KoColorBackground *background = new KoColorBackground( Qt::white );
     setBackground( background );
-    
+
     KoLineBorder *border = new KoLineBorder( 0, Qt::black );
     setBorder( border );
-    
+
     KoShape::setSize( QSizeF( CM_TO_POINT( 8 ), CM_TO_POINT( 5 ) ) );
-    
+
     requestRepaint();
 }
 
@@ -497,8 +497,8 @@
     TextLabelData *data = qobject_cast<TextLabelData*>( d->title->userData() );
     return data;
 }
-    
 
+
 KoShape *ChartShape::subTitle() const
 {
     return d->subTitle;
@@ -569,7 +569,7 @@
         d->internalModel = model;
     else
         d->internalModel = 0;
-    
+
     requestRepaint();
 }
 
@@ -582,7 +582,7 @@
         delete d->internalModel;
         d->internalModel = 0;
     }
-    
+
     requestRepaint();
 }
 
@@ -649,14 +649,14 @@
 void ChartShape::setSize( const QSizeF &newSize )
 {
     Q_ASSERT( d->plotArea );
-    
+
     // Usually, this is done by signals from the QWidget that we resize.
     // But since a KoShape is not a QWidget, we need to do this manually.
     //d->plotArea->kdChart()->resize( newSize.toSize() );
-    
+
     const double factorX = newSize.width() / size().width();
     const double factorY = newSize.height() / size().height();
-    
+
     foreach( Axis *axis, d->plotArea->axes() ) {
         KoShape *title = axis->title();
         switch( axis->position() ) {
@@ -674,7 +674,7 @@
             break;
         }
     }
-    
+
     switch ( d->legend->legendPosition() ) {
     case TopLegendPosition:
         d->legend->setAbsolutePosition( scalePointCenterTop( \
d->legend->absolutePosition(), factorX, factorY, d->legend->boundingRect().size() ) \
); @@ -692,18 +692,18 @@
     d->title->setAbsolutePosition( scalePointCenterTop( \
                d->title->absolutePosition(), factorX, factorY, \
                d->title->boundingRect().size() ) );
     d->subTitle->setAbsolutePosition( scalePointCenterTop( \
d->subTitle->absolutePosition(), factorX, factorY, d->subTitle->boundingRect().size() \
                ) );
     d->footer->setAbsolutePosition( scalePointCenterBottom( \
d->footer->absolutePosition(), factorX, factorY, d->footer->boundingRect().size() ) \
                );
-    
-    
+
+
     const QSizeF plotAreaSize = d->plotArea->size();
     d->plotArea->setSize( QSizeF( plotAreaSize.width() + newSize.width() - \
                size().width(), plotAreaSize.height() + newSize.height() - \
                size().height() ) );
-    
+
     KoShape::setSize( newSize );
 }
 
 void ChartShape::updateChildrenPositions()
 {
     Q_ASSERT( d->plotArea );
-    
+
     foreach( Axis *axis, d->plotArea->axes() ) {
         KoShape  *title = axis->title();
         QPointF   titlePosition;
@@ -711,7 +711,7 @@
         // FIXME: titlePosition is uniitialized here!
         title->setPosition( titlePosition );
     }
-    
+
     const double legendXOffset = 10.0;
     d->legend->setPosition( QPointF( size().width() + legendXOffset,
                                      size().height() / 2.0 - \
d->legend->size().height() / 2.0 ) ); @@ -738,14 +738,14 @@
 void ChartShape::setFirstRowIsLabel( bool isLabel )
 {
     d->model->setFirstRowIsLabel( isLabel );
-    
+
     requestRepaint();
 }
 
 void ChartShape::setFirstColumnIsLabel( bool isLabel )
 {
     d->model->setFirstColumnIsLabel( isLabel );
-    
+
     requestRepaint();
 }
 
@@ -778,7 +778,7 @@
     // Paint the background
     if ( background() ) {
         applyConversion( painter, converter );
-    
+
         // Calculate the clipping rect
         QRectF paintRect = QRectF( QPointF( 0, 0 ), size() );
         //clipRect.intersect( paintRect );
@@ -800,10 +800,10 @@
 
     if ( border() )
         return;
-    
+
     QRectF border = QRectF( QPointF( -1.5, -1.5 ),
                             converter.documentToView( size() ) + QSizeF( 1.5, 1.5 ) \
                );
-    
+
     painter.setPen( QPen( Qt::lightGray, 0 ) );
     painter.drawRect( border );
 }
@@ -814,7 +814,7 @@
         kError() << "Object element has no valid xlink:href attribute";
         return false;
     }
-    
+
     QString url = objectElement.attributeNS( KoXmlNS::xlink, "href" );
 
     // It can happen that the url is empty e.g. when it is a
@@ -841,7 +841,7 @@
     }
     if ( !path.endsWith( '/' ) )
         path += '/';
-    
+
     const QString mimeType = KoOdfReadStore::mimeForPath( manifestDocument, path );
     //kDebug(35001) << "path for manifest file=" << path << "mimeType=" << mimeType;
     if ( mimeType.isEmpty() ) {
@@ -945,7 +945,7 @@
 {
     if ( element.tagName() == "object" )
         return loadEmbeddedDocument( context.odfLoadingContext().store(), element, \
                context.odfLoadingContext().manifestDocument() );
-    
+
     qWarning() << "Unknown frame element <" << element.tagName() << ">";
     return false;
 }
@@ -960,7 +960,7 @@
         context.odfLoadingContext().fillStyleStack( chartElement, KoXmlNS::chart, \
"style-name", "chart" );  styleStack.setTypeProperties( "graphic" );
     }
-    loadOdfAttributes( chartElement, context, 
+    loadOdfAttributes( chartElement, context,
                        OdfAdditionalAttributes | OdfMandatories | \
OdfCommonChildElements );  
     // Check if we're loading an embedded document
@@ -983,7 +983,7 @@
 
             d->plotArea->setChartType( (ChartType)type );
             knownType = true;
-            break;  
+            break;
         }
     }
 
@@ -996,7 +996,7 @@
     }
 
     // 2. Load the title.
-    KoXmlElement titleElem = KoXml::namedItemNS( chartElement, 
+    KoXmlElement titleElem = KoXml::namedItemNS( chartElement,
                                                  KoXmlNS::chart, "title" );
     if ( !titleElem.isNull() ) {
         if ( !loadOdfLabel( d->title, titleElem, context) )
@@ -1004,7 +1004,7 @@
     }
 
     // 3. Load the subtitle.
-    KoXmlElement subTitleElem = KoXml::namedItemNS( chartElement, 
+    KoXmlElement subTitleElem = KoXml::namedItemNS( chartElement,
                                                     KoXmlNS::chart, "subtitle" );
     if ( !subTitleElem.isNull() ) {
         if ( !loadOdfLabel( d->subTitle, subTitleElem, context) )
@@ -1012,7 +1012,7 @@
     }
 
     // 4. Load the footer.
-    KoXmlElement footerElem = KoXml::namedItemNS( chartElement, 
+    KoXmlElement footerElem = KoXml::namedItemNS( chartElement,
                                                   KoXmlNS::chart, "footer" );
     if ( !footerElem.isNull() ) {
         if ( !loadOdfLabel( d->footer, footerElem, context ) )
@@ -1043,7 +1043,7 @@
         if ( !d->plotArea->loadOdf( plotareaElem, context ) )
             return false;
     }
-    
+
     requestRepaint();
 
     styleStack.restore();
@@ -1056,21 +1056,21 @@
     // There is no table element to load
     if ( tableElement.isNull() || !tableElement.isElement() )
         return true;
-    
+
     TableModel *model = new TableModel;
     model->loadOdf( tableElement, context );
-    
+
     setModel( model, true );
-    
+
     return true;
 }
 
 void ChartShape::saveOdf( KoShapeSavingContext & context ) const
 {
     Q_ASSERT( d->plotArea );
-    
+
     KoXmlWriter&  bodyWriter = context.xmlWriter();
-    
+
     // Check if we're saving to a chart document. If not, embed a
     // chart document.  ChartShape::saveOdf() will then be called
     // again later, when the current document saves the embedded
@@ -1087,11 +1087,11 @@
         return;
     }
     KoGenStyles&  mainStyles( context.mainStyles() );
-    
+
     bodyWriter.startElement( "chart:chart" );
-    
+
     saveOdfAttributes( context, OdfAllAttributes ^ OdfMandatories );
-    
+
     KoGenStyle style;
     style = KoGenStyle( KoGenStyle::StyleGraphicAuto, "chart" );
     bodyWriter.addAttribute( "chart:style-name", saveStyle( style, context ) );
@@ -1116,14 +1116,14 @@
 
     // 7. Save the data
     saveOdfData( bodyWriter, mainStyles );
-    
+
     bodyWriter.endElement(); // chart:chart
 }
 
 void ChartShape::saveOdfData( KoXmlWriter &bodyWriter, KoGenStyles &mainStyles ) \
const  {
     Q_UNUSED( mainStyles );
-    
+
     if ( !d->internalModel )
         return;
 
--- trunk/koffice/kchart/tests/CMakeLists.txt #982825:982826
@@ -5,8 +5,7 @@
                      ${CMAKE_SOURCE_DIR}/kchart/kdchart/include
                      ${CMAKE_SOURCE_DIR}/interfaces
                      ${CMAKE_SOURCE_DIR}/kchart/shape/dialogs
-                     ${KOGUIUTILS_INCLUDES}
-                     ${KOTEXT_INCLUDES} )
+                     ${KOMAIN_INCLUDES} )
 
 ########### next target ###############
 set( TestProxyModel_test_SRCS TestProxyModel.cpp )


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

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