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

List:       kde-commits
Subject:    [calligra] /: Calligra filters: refactor chart handling and make it sane
From:       Inge Wallin <inge () lysator ! liu ! se>
Date:       2015-03-02 15:11:47
Message-ID: E1YSS0Y-0007mX-WE () scm ! kde ! org
[Download RAW message or body]

Git commit 2ee3e0f2071e32beddc05117a92dccec1c83abfb by Inge Wallin.
Committed on 02/03/2015 at 14:40.
Pushed by ingwa into branch 'master'.

Calligra filters: refactor chart handling and make it sane
 - Factor out common parts and move them to libodf2/charts
 - Factor out the parts common to MS handling and move them to libmso/
 - Move common parts within the ooxml filters from the xlsx tree to libmsooxml/
 - Move things that only have to do with MS binary parts to libmso/
 - Rename the vaguely named namespace "Charting" to "KoChart"
 - Rename ChartExport to KoOdfChartWriter, which should be clearer
 - Make the filters use and link to the libraries instead of each other

REVIEW: 122045

Squashed commit of the following:

commit 75196b0e668e7671f82cbe7b2402885e6da30c85
Author: Inge Wallin <inge@lysator.liu.se>
Date:   Mon Mar 2 14:43:37 2015 +0100

    Fix issues from the review.

commit 67ee01b08ad65cd085e5edde7a0ef14a9e001339
Merge: 2db1a0b b2ad4ee
Author: Inge Wallin <inge@lysator.liu.se>
Date:   Mon Mar 2 13:13:48 2015 +0100

    Merge branch 'master' into filters-charting-ingwa

commit 2db1a0b6720106adc80ab5e44409e62a6da2b11c
Merge: 1690384 c9e4f87
Author: Inge Wallin <inge@lysator.liu.se>
Date:   Wed Feb 25 21:29:45 2015 +0100

    Merge branch 'master' into filters-charting-ingwa

    Conflicts:
    	filters/sheets/xlsx/ChartExport.cpp
    	filters/sheets/xlsx/ChartExport.h
    	filters/sheets/xlsx/Charting.h

commit 16903846a4f8be6b3806241a5ac12099e8fe23e0
Author: Inge Wallin <inge@lysator.liu.se>
Date:   Sun Jan 18 04:19:37 2015 +0100

    Fix issues pointed out in review.

    Thanks Friedrich!

commit f66f1c017a81b96ccfa3d69dd47506c142a7a99f
Merge: 33f571c 4af3f2f
Author: Inge Wallin <inge@lysator.liu.se>
Date:   Sun Jan 18 03:28:56 2015 +0100

    Merge branch 'master' into filters-charting-ingwa

commit 33f571c1838c014d9e08cd9e92767cf9e8ac0b8f
Merge: 82a9a7d 189c859
Author: Inge Wallin <inge@lysator.liu.se>
Date:   Tue Jan 13 16:01:05 2015 +0100

    Merge branch 'master' into filters-charting-ingwa

commit 82a9a7d2620d34f9c4c5eb255a503fba9b206afd
Merge: 99b2631 c30c93a
Author: Inge Wallin <inge@lysator.liu.se>
Date:   Thu Oct 16 22:33:25 2014 +0200

    Merge branch 'master' into filters-charting-ingwa

commit c30c93a5263e3df9970ad97f3b6d64b11a25d6e2
Author: Inge Wallin <inge@lysator.liu.se>
Date:   Mon Oct 6 20:28:06 2014 +0200

    Fix build

commit 99b26314844a2a440b2c11239d57a1f7d695143c
Merge: 759c7ff c00b38a
Author: Inge Wallin <inge@lysator.liu.se>
Date:   Tue Oct 14 18:30:02 2014 +0200

    Merge branch 'master' into filters-charting-ingwa

commit c00b38a9417c9550df1ac4fef1447864752ee4ec
Author: Inge Wallin <inge@lysator.liu.se>
Date:   Mon Oct 6 20:28:06 2014 +0200

    Fix build

commit 759c7ffdfdc8731883811ff5726f4eecbc0eb0b6
Author: Inge Wallin <inge@lysator.liu.se>
Date:   Mon Oct 13 02:18:55 2014 +0200

    Make the new charting work with the Sheets filters.

    Apparently it wasn't tested before because a missing dependency prevented the
    sheets filters from being built.

commit a838b7140af6b6888ae20043dd847ada1d424a6a
Merge: 3a046ea b7690d9
Author: Inge Wallin <inge@lysator.liu.se>
Date:   Sun Oct 12 23:30:45 2014 +0200

    Merge branch 'master' into filters-charting-ingwa

commit b7690d9068eeaf3aad1d513a8487843da37c15a5
Author: Inge Wallin <inge@lysator.liu.se>
Date:   Mon Oct 6 20:28:06 2014 +0200

    Fix build

commit 3a046ea6742b1725185c8344f03fdfb4faf9c24f
Author: Inge Wallin <inge@lysator.liu.se>
Date:   Sun Oct 12 23:28:03 2014 +0200

    Finally move the chart odf writer to libodf2

commit 01ed233128c822aa1058611ebd0a704eb1c9310b
Author: Inge Wallin <inge@lysator.liu.se>
Date:   Sun Oct 12 21:30:32 2014 +0200

    Some final finetuning.

commit 9144cf2199af8323038a79349569028e59db26d8
Author: Inge Wallin <inge@lysator.liu.se>
Date:   Sun Oct 12 00:01:08 2014 +0200

    Improve the separation of the ChartExport and XlsxChartExport.

     * Remove duplicated code: saveContent() and saveSeries() in XlsxChartExport
     * Remove #if 0'ed code in ChartExport
     * Make *all* functions reimplemented in XlsxChartExport virtual (bugfix)

commit 32d0a108632551b3086ab0c4e4d656fa3fc2db38
Author: Inge Wallin <inge@lysator.liu.se>
Date:   Sat Oct 11 00:36:51 2014 +0200

    ChartExport: Separate out the saving of series.

    Reasons for this are:
     - saveContents() it's a very big function and this is the biggest part of it.
     - This is the part that we want to inherit in the XlsChartExport since this
       is where the handling of palettes is done.

commit 05b16fd1ed82eec7b10f824682a2b0c93ab3cc20
Author: Inge Wallin <inge@lysator.liu.se>
Date:   Fri Oct 10 20:32:38 2014 +0200

    Small formatting improvement and update PLAN

commit dcd3ebeea7635d141c457422445bb6744e35c180
Author: Inge Wallin <inge@lysator.liu.se>
Date:   Thu Oct 9 22:23:28 2014 +0200

    Separate the OOXML specific parts out of ChartExport

    These parts are now contained in the XlsxChartExport class. This should
    probably change name to OoxmlChartExport instead because it turned out that it
    was used from all the ooxml import filters.

commit ba738c2cc4b4423cab0c415937c242db2aeed9ff
Merge: a8a1370 6c941f6
Author: Inge Wallin <inge@lysator.liu.se>
Date:   Wed Oct 8 20:17:42 2014 +0200

    Merge branch 'master' into filters-charting-ingwa

commit 6c941f64d79389c7557e9082f1160fe4624766b0
Author: Inge Wallin <inge@lysator.liu.se>
Date:   Mon Oct 6 20:28:06 2014 +0200

    Fix build

commit a8a137010f091734d6b5e27393cad8585d5bc452
Author: Inge Wallin <inge@lysator.liu.se>
Date:   Wed Oct 8 20:10:59 2014 +0200

    Update PLAN

commit e4aa0b1b38fd89fb0b50cc48069c8ed2ef0f7a56
Author: Inge Wallin <inge@lysator.liu.se>
Date:   Wed Oct 8 19:12:30 2014 +0200

    OOXML: Only use the themes where we don't need the reader

commit 7fa297552bb37e61109ec0cc02116d96c103a772
Author: Inge Wallin <inge@lysator.liu.se>
Date:   Wed Oct 8 17:52:42 2014 +0200

    Split out the OOXML theme data types from the reader.

commit 111b30ee68b909f62781cb5adecf71280eb8aa3d
Author: Inge Wallin <inge@lysator.liu.se>
Date:   Wed Oct 8 08:16:03 2014 +0200

    Finalize the move of some utils from libmsooxml to libmso.

    In practice, this turned out to be just removing old stuff that wasn't used
    anymore.

commit 129e5c3b36ee35b54bc479070a08a0d4ed10eb6c
Author: Inge Wallin <inge@lysator.liu.se>
Date:   Wed Oct 8 06:24:45 2014 +0200

    Move the NumberFormatParser from libmsooxml to libmso

    This was a necessary step before moving the ChartExport to libodf2 since we
    don't want anything outside of the ooxml filters to depend on things inside
    it.

    This change triggered a lot of other small changes too, such as the start of a
    MSO::Utils file.

commit 6a35790ac2be83d80ea52e8654b1b3dabb9d735d
Author: Inge Wallin <inge@lysator.liu.se>
Date:   Wed Oct 8 04:23:13 2014 +0200

    Include the correct file

commit 8d58a48aea5037a1dce083b9bfa2f500ad6566ea
Author: Inge Wallin <inge@lysator.liu.se>
Date:   Wed Oct 8 04:20:37 2014 +0200

    PLAN: Add a plan for this branch

commit 5066798c4c1039567d400893af534f22a82651e6
Author: Inge Wallin <inge@lysator.liu.se>
Date:   Wed Oct 8 02:10:59 2014 +0200

    Clean up the NumberFormatParser

commit 93e8f8cdaf3e80b2b7d49dfeab2fce3bb5fa720a
Author: Inge Wallin <inge@lysator.liu.se>
Date:   Wed Oct 8 02:10:44 2014 +0200

    ChartExport: Do some more fixups

commit ae676e46c174bf0260fd9166d6a0ae452d9029e5
Author: Inge Wallin <inge@lysator.liu.se>
Date:   Wed Oct 8 01:26:25 2014 +0200

    Clean up ChartExport

commit a059ececa84e7dc0fe1c1a4cde4f8cdd1e081bf3
Author: Inge Wallin <inge@lysator.liu.se>
Date:   Tue Oct 7 22:11:38 2014 +0200

    Heavy cleanup of Charting.h

     * Follow the coding standards better
     * Fix many spelling errors

commit 49a7e502e9a6ea9068f54ffae77718168f8e58ca
Author: Inge Wallin <inge@lysator.liu.se>
Date:   Tue Oct 7 06:20:08 2014 +0200

    Use namespace KoChart for everything that has to do with charts.

    NOTE: We are still only using this in the filters.  The chart shape will come
          later.

commit 077952099bc256514ba6b3abf3aa2d70aefafd2c
Author: Inge Wallin <inge@lysator.liu.se>
Date:   Tue Oct 7 05:14:10 2014 +0200

    Move Charting.h to filters/libodf2/chart/

commit edfcd938a6ed4ba90b0d01f0740855fb4a6fbf9a
Author: Inge Wallin <inge@lysator.liu.se>
Date:   Mon Oct 6 20:28:06 2014 +0200

    Fix build

M  +1    -0    CMakeLists.txt
M  +12   -1    filters/libmso/CMakeLists.txt
A  +362  -0    filters/libmso/MsoUtils.cpp     [License: LGPL (v2.1)]
C  +20   -18   filters/libmso/MsoUtils.h [from: \
filters/sheets/xlsx/NumberFormatParser.h - 055% similarity] R  +96   -56   \
filters/libmso/NumberFormatParser.cpp [from: \
filters/sheets/xlsx/NumberFormatParser.cpp - 084% similarity] R  +2    -1    \
filters/libmso/NumberFormatParser.h [from: filters/sheets/xlsx/NumberFormatParser.h - \
093% similarity] R  +2    -2    filters/libmso/XlsUtils.h [from: \
filters/sheets/xlsx/XlsxUtils.h - 098% similarity] M  +7    -5    \
filters/libmsooxml/CMakeLists.txt M  +20   -20   \
filters/libmsooxml/MsooXmlCommonReaderDrawingMLImpl.h M  +2    -1    \
filters/libmsooxml/MsooXmlDrawingTableStyleReader.cpp M  +1    -1    \
filters/libmsooxml/MsooXmlImport.cpp C  +7    -84   filters/libmsooxml/MsooXmlTheme.h \
[from: filters/libmsooxml/MsooXmlThemesReader.h - 067% similarity] M  +1    -0    \
filters/libmsooxml/MsooXmlThemesReader.cpp M  +6    -175  \
filters/libmsooxml/MsooXmlThemesReader.h M  +0    -305  \
filters/libmsooxml/MsooXmlUtils.cpp M  +0    -6    filters/libmsooxml/MsooXmlUtils.h
M  +19   -2    filters/libodf2/CMakeLists.txt
A  +724  -0    filters/libodf2/chart/Charting.h     [License: LGPL (v2.1+)]
A  +1074 -0    filters/libodf2/chart/KoOdfChartWriter.cpp     [License: LGPL (v2.1+)]
A  +110  -0    filters/libodf2/chart/KoOdfChartWriter.h     [License: LGPL (v2.1+)]
A  +59   -0    filters/libodf2/chart/PLAN
M  +6    -3    filters/sheets/excel/export/CMakeLists.txt
M  +7    -4    filters/sheets/excel/import/CMakeLists.txt
M  +4    -4    filters/sheets/excel/import/ExcelImport.cpp
M  +4    -4    filters/sheets/excel/import/excelimporttoods.cc
M  +4    -4    filters/sheets/excel/sidewinder/CMakeLists.txt
M  +114  -114  filters/sheets/excel/sidewinder/chartsubstreamhandler.cpp
M  +7    -7    filters/sheets/excel/sidewinder/chartsubstreamhandler.h
M  +2    -2    filters/sheets/excel/sidewinder/objects.h
M  +9    -3    filters/sheets/xlsx/CMakeLists.txt
D  +0    -1090 filters/sheets/xlsx/ChartExport.cpp
D  +0    -93   filters/sheets/xlsx/ChartExport.h
D  +0    -491  filters/sheets/xlsx/Charting.h
A  +361  -0    filters/sheets/xlsx/XlsxChartOdfWriter.cpp     [License: LGPL (v2+)]
A  +60   -0    filters/sheets/xlsx/XlsxChartOdfWriter.h     [License: LGPL (v2+)]
M  +1    -0    filters/sheets/xlsx/XlsxImport.cpp
M  +99   -91   filters/sheets/xlsx/XlsxXmlChartReader.cpp
M  +7    -7    filters/sheets/xlsx/XlsxXmlChartReader.h
M  +1    -1    filters/sheets/xlsx/XlsxXmlCommentsReader.h
M  +1    -1    filters/sheets/xlsx/XlsxXmlCommonReader.h
M  +4    -0    filters/sheets/xlsx/XlsxXmlDocumentReader.cpp
M  +2    -1    filters/sheets/xlsx/XlsxXmlDocumentReader.h
M  +2    -2    filters/sheets/xlsx/XlsxXmlDrawingReader.cpp
M  +3    -3    filters/sheets/xlsx/XlsxXmlDrawingReader.h
M  +1    -1    filters/sheets/xlsx/XlsxXmlStylesReader.h
M  +3    -1    filters/sheets/xlsx/XlsxXmlWorksheetReader.cpp
M  +4    -1    filters/sheets/xlsx/XlsxXmlWorksheetReader.h
M  +4    -2    filters/stage/pptx/CMakeLists.txt
M  +2    -2    filters/stage/pptx/PptxXmlSlideReader.cpp
M  +5    -3    filters/words/docx/import/CMakeLists.txt
M  +1    -1    filters/words/docx/import/DocxXmlDocumentReader.cpp
M  +0    -1    filters/words/docx/import/DocxXmlDocumentReader.h
M  +0    -1    filters/words/msword-odf/CMakeLists.txt

http://commits.kde.org/calligra/2ee3e0f2071e32beddc05117a92dccec1c83abfb

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8dae485..4860d2a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -809,6 +809,7 @@ set(KDCHART_LIBS calligrakdchart)
 # libodf2
 set(KOODF2_INCLUDES
     ${CMAKE_SOURCE_DIR}/filters/libodf2
+    ${CMAKE_SOURCE_DIR}/filters/libodf2/chart
 )
 
 # libodfreader
diff --git a/filters/libmso/CMakeLists.txt b/filters/libmso/CMakeLists.txt
index 19aced3..c0c6684 100644
--- a/filters/libmso/CMakeLists.txt
+++ b/filters/libmso/CMakeLists.txt
@@ -16,5 +16,16 @@ if(NOT MSVC AND NOT (WIN32 AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL \
"Intel"))  endif("${CMAKE_CXX_COMPILER_ID}" MATCHES "SunPro")
 endif(NOT MSVC AND NOT (WIN32 AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel"))
 
-add_library(mso STATIC generated/simpleParser.cpp drawstyle.cpp writer.cpp \
ODrawToOdf.cpp shapes.cpp shapes2.cpp pictures.cpp pole.cpp) +add_library(mso STATIC
+    generated/simpleParser.cpp
+    drawstyle.cpp
+    writer.cpp
+    ODrawToOdf.cpp
+    shapes.cpp
+    shapes2.cpp
+    pictures.cpp
+    pole.cpp
+    MsoUtils.cpp
+    NumberFormatParser.cpp
+)
 target_link_libraries(mso koodf ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})
diff --git a/filters/libmso/MsoUtils.cpp b/filters/libmso/MsoUtils.cpp
new file mode 100644
index 0000000..52148c7
--- /dev/null
+++ b/filters/libmso/MsoUtils.cpp
@@ -0,0 +1,362 @@
+/*
+ * This file is part of Office 2007 Filters for Calligra
+ * Copyright (C) 2002 Laurent Montel <lmontel@mandrakesoft.com>
+ * Copyright (c) 2003 Lukas Tinkl <lukas@kde.org>
+ * Copyright (C) 2003 David Faure <faure@kde.org>
+ * Copyright (C) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+ * Contact: Suresh Chande suresh.chande@nokia.com
+ * Copyright (C) 2011 Matus Uzak <matus.uzak@ixonos.com>
+ * Copyright 2014 Inge Wallin <inge@lysator.liu.se>
+ *
+ * Utils::columnName() based on Cell::columnName() from calligra/kspread/Utils.cpp:
+ * Copyright 2006-2007 Stefan Nikolaus <stefan.nikolaus@kdemail.net>
+ * Copyright 2004 Tomas Mecir <mecirt@gmail.com>
+ * Copyright 1999-2002,2004 Laurent Montel <montel@kde.org>
+ * Copyright 2002,2004 Ariya Hidayat <ariya@kde.org>
+ * Copyright 2002-2003 Norbert Andres <nandres@web.de>
+ * Copyright 2003 Stefan Hetzl <shetzl@chello.at>
+ * Copyright 2001-2002 Philipp Mueller <philipp.mueller@gmx.de>
+ * Copyright 2002 Harri Porten <porten@kde.org>
+ * Copyright 2002 John Dailey <dailey@vt.edu>
+ * Copyright 1999-2001 David Faure <faure@kde.org>
+ * Copyright 2000-2001 Werner Trobin <trobin@kde.org>
+ * Copyright 2000 Simon Hausmann <hausmann@kde.org
+ * Copyright 1998-1999 Torben Weis <weis@kde.org>
+ * Copyright 1999 Michael Reiher <michael.reiher@gmx.de>
+ * Copyright 1999 Reginald Stadlbauer <reggie@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+// Own
+#include "MsoUtils.h"
+
+// Qt
+#include <QMap>
+#include <QString>
+#include <QPalette>
+
+// KDE
+#include <kglobal.h>  // for K_GLOBAL_STATIC
+
+
+class DefaultIndexedColors : public QList< QColor >
+{
+public:
+    DefaultIndexedColors()
+    {
+        push_back( QColor( 0, 0, 0 ) );
+        push_back( QColor( 255, 255, 255 ) );
+        push_back( QColor( 255, 0, 0 ) );
+        push_back( QColor( 0, 255, 0 ) );
+        push_back( QColor( 0, 0, 255 ) );
+        push_back( QColor( 255, 255, 0 ) );
+        push_back( QColor( 255, 0, 255 ) );
+        push_back( QColor( 0, 255, 255 ) );
+        push_back( QColor( 0, 0, 0 ) );
+        push_back( QColor( 255, 255, 255 ) );
+        push_back( QColor( 255, 0, 0 ) );
+        push_back( QColor( 0, 255, 0 ) );
+        push_back( QColor( 0, 0, 255 ) );
+        push_back( QColor( 255, 255, 0 ) );
+        push_back( QColor( 255, 0, 255 ) );
+        push_back( QColor( 0, 255, 255 ) );
+        push_back( QColor( 128, 0, 0 ) );
+        push_back( QColor( 0, 128, 0 ) );
+        push_back( QColor( 0, 0, 128 ) );
+        push_back( QColor( 128, 128, 0 ) );
+        push_back( QColor( 128, 0, 128 ) );
+        push_back( QColor( 0, 128, 128 ) );
+        push_back( QColor( 192, 192, 192 ) );
+        push_back( QColor( 128, 128, 128 ) );
+        push_back( QColor( 153, 153, 255 ) );
+        push_back( QColor( 153, 51, 102 ) );
+        push_back( QColor( 255, 255, 204 ) );
+        push_back( QColor( 204, 255, 255 ) );
+        push_back( QColor( 102, 0, 102 ) );
+        push_back( QColor( 255, 128, 128 ) );
+        push_back( QColor( 0, 102, 204 ) );
+        push_back( QColor( 204, 204, 255 ) );
+        push_back( QColor( 0, 0, 128 ) );
+        push_back( QColor( 255, 0, 255 ) );
+        push_back( QColor( 255, 255, 0 ) );
+        push_back( QColor( 0, 255, 255 ) );
+        push_back( QColor( 128, 0, 128 ) );
+        push_back( QColor( 128, 0, 0 ) );
+        push_back( QColor( 0, 128, 128 ) );
+        push_back( QColor( 0, 0, 255 ) );
+        push_back( QColor( 0, 204, 255 ) );
+        push_back( QColor( 204, 255, 255 ) );
+        push_back( QColor( 204, 255, 204 ) );
+        push_back( QColor( 255, 255, 153 ) );
+        push_back( QColor( 153, 204, 255 ) );
+        push_back( QColor( 255, 153, 204 ) );
+        push_back( QColor( 204, 153, 255 ) );
+        push_back( QColor( 255, 204, 153 ) );
+        push_back( QColor( 51, 102, 255 ) );
+        push_back( QColor( 51, 204, 204 ) );
+        push_back( QColor( 153, 204, 0 ) );
+        push_back( QColor( 255, 204, 0 ) );
+        push_back( QColor( 255, 153, 0 ) );
+        push_back( QColor( 255, 102, 0 ) );
+        push_back( QColor( 102, 102, 153 ) );
+        push_back( QColor( 150, 150, 150 ) );
+        push_back( QColor( 0, 51, 102 ) );
+        push_back( QColor( 51, 102, 153 ) );
+        push_back( QColor( 0, 51, 0 ) );
+        push_back( QColor( 51, 51, 0 ) );
+        push_back( QColor( 153, 51, 0 ) );
+        push_back( QColor( 153, 51, 102 ) );
+        push_back( QColor( 51, 51, 153 ) );
+        push_back( QColor( 51, 51, 51 ) );
+	// FIXME: The palette colors can apparently change during execution so
+	//        this should be calculated on the fly instead.
+        push_back( QPalette().color( QPalette::Active, QPalette::WindowText ) );
+        push_back( QPalette().color( QPalette::Active, QPalette::Window ) );
+     }
+};
+
+QColor MSO::defaultIndexedColor( int index )
+{
+    K_GLOBAL_STATIC( DefaultIndexedColors, s_defaultIndexedColors )
+    if( index < 0 || s_defaultIndexedColors->count() <= index )
+        return QColor();
+    return s_defaultIndexedColors->at( index );
+}
+
+
+class LangIdToLocaleMapping : public QMap< int, QString >
+{
+public:
+    LangIdToLocaleMapping()
+    {
+#define DEFINELOCALE( ID, CODE ) insert( ID, QLatin1String( CODE ) );
+        DEFINELOCALE( 0x0436, "af-ZA" ) //  Afrikaans   South Africa
+        DEFINELOCALE( 0x041c, "sq-AL" ) //  Albanian    Albania
+        DEFINELOCALE( 0x0484, "gsw-FR" ) //  Alsatian    France
+        DEFINELOCALE( 0x045e, "am-ET" ) //   Amharic     Ethiopia
+        DEFINELOCALE( 0x0401, "ar-SA" ) //   Arabic  Saudi Arabia
+        DEFINELOCALE( 0x0801, "ar-IQ" ) //   Arabic  Iraq
+        DEFINELOCALE( 0x0c01, "ar-EG" ) //   Arabic  Egypt
+        DEFINELOCALE( 0x1001, "ar-LY" ) //   Arabic  Libya
+        DEFINELOCALE( 0x1401, "ar-DZ" ) //   Arabic  Algeria
+        DEFINELOCALE( 0x1801, "ar-MA" ) //   Arabic  Morocco
+        DEFINELOCALE( 0x1c01, "ar-TN" ) //   Arabic  Tunisia
+        DEFINELOCALE( 0x2001, "ar-OM" ) //   Arabic  Oman
+        DEFINELOCALE( 0x2401, "ar-YE" ) //   Arabic  Yemen
+        DEFINELOCALE( 0x2801, "ar-SY" ) //   Arabic  Syria
+        DEFINELOCALE( 0x2c01, "ar-JO" ) //   Arabic  Jordan
+        DEFINELOCALE( 0x3001, "ar-LB" ) //   Arabic  Lebanon
+        DEFINELOCALE( 0x3401, "ar-KW" ) //   Arabic  Kuwait
+        DEFINELOCALE( 0x3801, "ar-AE" ) //   Arabic  U.A.E.
+        DEFINELOCALE( 0x3c01, "ar-BH" ) //   Arabic  Bahrain
+        DEFINELOCALE( 0x4001, "ar-QA" ) //   Arabic  Qatar
+        DEFINELOCALE( 0x042b, "hy-AM" ) //   Armenian    Armenia
+        DEFINELOCALE( 0x044d, "as-IN" ) //   Assamese    India
+        DEFINELOCALE( 0x082c, "az-Cyrl-AZ" ) //  Azeri (Cyrillic)    Azerbaijan
+        DEFINELOCALE( 0x042c, "az-Latn-AZ" ) //  Azeri (Latin)   Azerbaijan
+        DEFINELOCALE( 0x046d, "ba-RU" ) //   Bashkir     Russia
+        DEFINELOCALE( 0x042d, "eu-ES" ) //   Basque  Basque
+        DEFINELOCALE( 0x0423, "be-BY" ) //   Belarusian  Belarus
+        DEFINELOCALE( 0x0445, "bn-IN" ) //   Bengali     India
+        DEFINELOCALE( 0x0845, "bn-BD" ) //   Bengali     Bangladesh
+        DEFINELOCALE( 0x201a, "bs-Cyrl-BA" ) //  Bosnian (Cyrillic)  Bosnia and \
Herzegovina +        DEFINELOCALE( 0x141a, "bs-Latn-BA" ) //  Bosnian (Latin)     \
Bosnia and Herzegovina +        DEFINELOCALE( 0x047e, "br-FR" ) //   Breton  France
+        DEFINELOCALE( 0x0402, "bg-BG" ) //   Bulgarian   Bulgaria
+        DEFINELOCALE( 0x0403, "ca-ES" ) //   Catalan     Catalan
+        DEFINELOCALE( 0x0404, "zh-TW" ) //   Chinese     Taiwan
+        DEFINELOCALE( 0x0804, "zh-CN" ) //   Chinese     PRC
+        DEFINELOCALE( 0x0c04, "zh-HK" ) //   Chinese     Hong Kong SAR
+        DEFINELOCALE( 0x1004, "zh-SG" ) //   Chinese     Singapore
+        DEFINELOCALE( 0x1404, "zh-MO" ) //   Chinese     Macao SAR
+        DEFINELOCALE( 0x0483, "co-FR" ) //   Corsican    France
+        DEFINELOCALE( 0x041a, "hr-HR" ) //   Croatian    Croatia
+        DEFINELOCALE( 0x101a, "hr-BA" ) //   Croatian (Latin)    Bosnia and \
Herzegovina +        DEFINELOCALE( 0x0405, "cs-CZ" ) //   Czech   Czech Republic
+        DEFINELOCALE( 0x0406, "da-DK" ) //   Danish  Denmark
+        DEFINELOCALE( 0x048c, "prs-AF" ) //  Dari    Afghanistan
+        DEFINELOCALE( 0x0465, "dv-MV" ) //   Divehi  Maldives
+        DEFINELOCALE( 0x0813, "nl-BE" ) //   Dutch   Belgium
+        DEFINELOCALE( 0x0413, "nl-NL" ) //   Dutch   Netherlands
+        DEFINELOCALE( 0x1009, "en-CA" ) //   English     Canada
+        DEFINELOCALE( 0x2009, "en-JM" ) //   English     Jamaica
+        DEFINELOCALE( 0x2409, "en-029" ) //  English     Caribbean
+        DEFINELOCALE( 0x2809, "en-BZ" ) //   English     Belize
+        DEFINELOCALE( 0x2c09, "en-TT" ) //   English     Trinidad
+        DEFINELOCALE( 0x0809, "en-GB" ) //   English     United Kingdom
+        DEFINELOCALE( 0x1809, "en-IE" ) //   English     Ireland
+        DEFINELOCALE( 0x4009, "en-IN" ) //   English     India
+        DEFINELOCALE( 0x1c09, "en-ZA" ) //   English     South Africa
+        DEFINELOCALE( 0x3009, "en-ZW" ) //   English     Zimbabwe
+        DEFINELOCALE( 0x0c09, "en-AU" ) //   English     Australia
+        DEFINELOCALE( 0x1409, "en-NZ" ) //   English     New Zealand
+        DEFINELOCALE( 0x3409, "en-PH" ) //   English     Philippines
+        DEFINELOCALE( 0x0409, "en-US" ) //   English     United States
+        DEFINELOCALE( 0x4409, "en-MY" ) //   English     Malaysia
+        DEFINELOCALE( 0x4809, "en-SG" ) //   English     Singapore
+        DEFINELOCALE( 0x0425, "et-EE" ) //   Estonian    Estonia
+        DEFINELOCALE( 0x0438, "fo-FO" ) //   Faroese     Faroe Islands
+        DEFINELOCALE( 0x0464, "fil-PH" ) //  Filipino    Philippines
+        DEFINELOCALE( 0x040b, "fi-FI" ) //   Finnish     Finland
+        DEFINELOCALE( 0x0c0c, "fr-CA" ) //   French  Canada
+        DEFINELOCALE( 0x040c, "fr-FR" ) //   French  France
+        DEFINELOCALE( 0x180c, "fr-MC" ) //   French  Monaco
+        DEFINELOCALE( 0x100c, "fr-CH" ) //   French  Switzerland
+        DEFINELOCALE( 0x080c, "fr-BE" ) //   French  Belgium
+        DEFINELOCALE( 0x140c, "fr-LU" ) //   French  Luxembourg
+        DEFINELOCALE( 0x0462, "fy-NL" ) //   Frisian     Netherlands
+        DEFINELOCALE( 0x0456, "gl-ES" ) //   Galician    Galician
+        DEFINELOCALE( 0x0437, "ka-GE" ) //   Georgian    Georgia
+        DEFINELOCALE( 0x0407, "de-DE" ) //   German  Germany
+        DEFINELOCALE( 0x0807, "de-CH" ) //   German  Switzerland
+        DEFINELOCALE( 0x0c07, "de-AT" ) //   German  Austria
+        DEFINELOCALE( 0x1407, "de-LI" ) //   German  Liechtenstein
+        DEFINELOCALE( 0x1007, "de-LU" ) //   German  Luxembourg
+        DEFINELOCALE( 0x0408, "el-GR" ) //   Greek   Greece
+        DEFINELOCALE( 0x046f, "kl-GL" ) //   Greenlandic     Greenland
+        DEFINELOCALE( 0x0447, "gu-IN" ) //   Gujarati    India
+        DEFINELOCALE( 0x0468, "ha-Latn-NG" ) //  Hausa   Nigeria
+        DEFINELOCALE( 0x040d, "he-IL" ) //   Hebrew  Israel
+        DEFINELOCALE( 0x0439, "hi-IN" ) //   Hindi   India
+        DEFINELOCALE( 0x040e, "hu-HU" ) //   Hungarian   Hungary
+        DEFINELOCALE( 0x040f, "is-IS" ) //   Icelandic   Iceland
+        DEFINELOCALE( 0x0470, "ig-NG" ) //   Igbo    Nigeria
+        DEFINELOCALE( 0x0421, "id-ID" ) //   Indonesian  Indonesia
+        DEFINELOCALE( 0x045d, "iu-Cans-CA" ) //  Inukitut (Syllabics)    Canada
+        DEFINELOCALE( 0x085d, "iu-Latn-CA" ) //  Inuktitut (Latin)   Canada
+        DEFINELOCALE( 0x083c, "ga-IE" ) //   Irish   Ireland
+        DEFINELOCALE( 0x0434, "xh-ZA" ) //   isiXhosa    South Africa
+        DEFINELOCALE( 0x0435, "zu-ZA" ) //   isiZulu     South Africa
+        DEFINELOCALE( 0x0410, "it-IT" ) //   Italian     Italy
+        DEFINELOCALE( 0x0810, "it-CH" ) //   Italian     Switzerland
+        DEFINELOCALE( 0x0411, "ja-JP" ) //   Japanese    Japan
+        DEFINELOCALE( 0x044b, "kn-IN" ) //   Kannada     India
+        DEFINELOCALE( 0x043f, "kk-KZ" ) //   Kazakh  Kazakhstan
+        DEFINELOCALE( 0x0453, "km-KH" ) //   Khmer   Cambodia
+        DEFINELOCALE( 0x0486, "qut-GT" ) //  K'iche  Guatemala
+        DEFINELOCALE( 0x0487, "rw-RW" ) //   Kinyarwanda     Rwanda
+        DEFINELOCALE( 0x0441, "sw-KE" ) //   Kiswahili   Kenya
+        DEFINELOCALE( 0x0457, "kok-IN" ) //  Konkani     India
+        DEFINELOCALE( 0x0412, "ko-KR" ) //   Korean  Korea
+        DEFINELOCALE( 0x0440, "ky-KG" ) //   Kyrgyz  Kyrgyzistan
+        DEFINELOCALE( 0x0454, "lo-LA" ) //   Lao     Lao P.D.R.
+        DEFINELOCALE( 0x0426, "lv-LV" ) //   Latvian     Latvia
+        DEFINELOCALE( 0x0427, "lt-LT" ) //   Lithuanian  Lithuania
+        DEFINELOCALE( 0x082e, "dsb-DE" ) //  Lower Sorbian   Germany
+        DEFINELOCALE( 0x046e, "lb-LU" ) //   Luxembourgish   Luxembourg
+        DEFINELOCALE( 0x042f, "mk-MK" ) //   Macedonian (FYROM)  Macedonia (FYROM)
+        DEFINELOCALE( 0x043e, "ms-MY" ) //   Malay   Malaysia
+        DEFINELOCALE( 0x083e, "ms-BN" ) //   Malay   Brunei Darussalam
+        DEFINELOCALE( 0x044c, "ml-IN" ) //   Malayalam   India
+        DEFINELOCALE( 0x043a, "mt-MT" ) //   Maltese     Malta
+        DEFINELOCALE( 0x0481, "mi-NZ" ) //   Maori   New Zealand
+        DEFINELOCALE( 0x047a, "arn-CL" ) //  Mapudungun  Chile
+        DEFINELOCALE( 0x044e, "mr-IN" ) //   Marathi     India
+        DEFINELOCALE( 0x047c, "moh-CA" ) //  Mohawk  Mohawk
+        DEFINELOCALE( 0x0450, "mn-MN" ) //   Mongolian (Cyrillic)    Mongolia
+        DEFINELOCALE( 0x0850, "mn-Mong-CN" ) //  Mongolian (Mongolian)   PRC
+        DEFINELOCALE( 0x0461, "ne-NP" ) //   Nepali  Nepal
+        DEFINELOCALE( 0x0414, "nb-NO" ) //   Norwegian (Bokmål)  Norway
+        DEFINELOCALE( 0x0814, "nn-NO" ) //   Norwegian (Nynorsk)     Norway
+        DEFINELOCALE( 0x0482, "oc-FR" ) //   Occitan     France
+        DEFINELOCALE( 0x0448, "or-IN" ) //   Oriya   India
+        DEFINELOCALE( 0x0463, "ps-AF" ) //   Pashto  Afghanistan
+        DEFINELOCALE( 0x0429, "fa-IR" ) //   Persian     Iran
+        DEFINELOCALE( 0x0415, "pl-PL" ) //   Polish  Poland
+        DEFINELOCALE( 0x0416, "pt-BR" ) //   Portuguese  Brazil
+        DEFINELOCALE( 0x0816, "pt-PT" ) //   Portuguese  Portugal
+        DEFINELOCALE( 0x0446, "pa-IN" ) //   Punjabi (Gurmukhi)  India
+        DEFINELOCALE( 0x046b, "quz-BO" ) //  Quechua     Bolivia
+        DEFINELOCALE( 0x086b, "quz-EC" ) //  Quechua     Ecuador
+        DEFINELOCALE( 0x0c6b, "quz-PE" ) //  Quechua     Peru
+        DEFINELOCALE( 0x0418, "ro-RO" ) //   Romanian    Romania
+        DEFINELOCALE( 0x0417, "rm-CH" ) //   Romansh     Switzerland
+        DEFINELOCALE( 0x0419, "ru-RU" ) //   Russian     Russia
+        DEFINELOCALE( 0x243b, "smn-FI" ) //  Sami, Inari     Finland
+        DEFINELOCALE( 0x143b, "smj-SE" ) //  Sami, Lule  Sweden
+        DEFINELOCALE( 0x103b, "smj-NO" ) //  Sami, Lule  Norway
+        DEFINELOCALE( 0x043b, "se-NO" ) //   Sami, Northern  Norway
+        DEFINELOCALE( 0x083b, "se-SE" ) //   Sami, Northern  Sweden
+        DEFINELOCALE( 0x0c3b, "se-FI" ) //   Sami, Northern  Finland
+        DEFINELOCALE( 0x203b, "sms-FI" ) //  Sami, Skolt     Finland
+        DEFINELOCALE( 0x183b, "sma-NO" ) //  Sami, Southern  Norway
+        DEFINELOCALE( 0x1c3b, "sma-SE" ) //  Sami, Southern  Sweden
+        DEFINELOCALE( 0x044f, "sa-IN" ) //   Sanskrit    India
+        DEFINELOCALE( 0x0c1a, "sr-Cyrl-CS" ) //  Serbian (Cyrillic)  Serbia
+        DEFINELOCALE( 0x1c1a, "sr-Cyrl-BA" ) //  Serbian (Cyrillic)  Bosnia and \
Herzegovina +        DEFINELOCALE( 0x081a, "sr-Latn-CS" ) //  Serbian (Latin)     \
Serbia +        DEFINELOCALE( 0x181a, "sr-Latn-BA" ) //  Serbian (Latin)     Bosnia \
and Herzegovina +        DEFINELOCALE( 0x046c, "nso-ZA" ) //  Sesotho sa Leboa    \
South Africa +        DEFINELOCALE( 0x0432, "tn-ZA" ) //   Setswana    South Africa
+        DEFINELOCALE( 0x045b, "si-LK" ) //   Sinhala     Sri Lanka
+        DEFINELOCALE( 0x041b, "sk-SK" ) //   Slovak  Slovakia
+        DEFINELOCALE( 0x0424, "sl-SI" ) //   Slovenian   Slovenia
+        DEFINELOCALE( 0x080a, "es-MX" ) //   Spanish     Mexico
+        DEFINELOCALE( 0x100a, "es-GT" ) //   Spanish     Guatemala
+        DEFINELOCALE( 0x140a, "es-CR" ) //   Spanish     Costa Rica
+        DEFINELOCALE( 0x180a, "es-PA" ) //   Spanish     Panama
+        DEFINELOCALE( 0x1c0a, "es-DO" ) //   Spanish     Dominican Republic
+        DEFINELOCALE( 0x200a, "es-VE" ) //   Spanish     Venezuela
+        DEFINELOCALE( 0x240a, "es-CO" ) //   Spanish     Colombia
+        DEFINELOCALE( 0x280a, "es-PE" ) //   Spanish     Peru
+        DEFINELOCALE( 0x2c0a, "es-AR" ) //   Spanish     Argentina
+        DEFINELOCALE( 0x300a, "es-EC" ) //   Spanish     Ecuador
+        DEFINELOCALE( 0x340a, "es-CL" ) //   Spanish     Chile
+        DEFINELOCALE( 0x3c0a, "es-PY" ) //   Spanish     Paraguay
+        DEFINELOCALE( 0x400a, "es-BO" ) //   Spanish     Bolivia
+        DEFINELOCALE( 0x440a, "es-SV" ) //   Spanish     El Salvador
+        DEFINELOCALE( 0x480a, "es-HN" ) //   Spanish     Honduras
+        DEFINELOCALE( 0x4c0a, "es-NI" ) //   Spanish     Nicaragua
+        DEFINELOCALE( 0x500a, "es-PR" ) //   Spanish     Puerto Rico
+        DEFINELOCALE( 0x540a, "es-US" ) //   Spanish     United States
+        DEFINELOCALE( 0x380a, "es-UY" ) //   Spanish     Uruguay
+        DEFINELOCALE( 0x0c0a, "es-ES" ) //   Spanish (International Sort)    Spain
+        DEFINELOCALE( 0x040a, "es-ES_tradnl" ) //    Spanish (Traditional Sort)  \
Spain +        DEFINELOCALE( 0x041d, "sv-SE" ) //   Swedish     Sweden
+        DEFINELOCALE( 0x081d, "sv-FI" ) //   Swedish     Finland
+        DEFINELOCALE( 0x045a, "syr-SY" ) //  Syriac  Syria
+        DEFINELOCALE( 0x0428, "tg-Cyrl-TJ" ) //  Tajik   Tajikistan
+        DEFINELOCALE( 0x085f, "tzm-Latn-DZ" ) //     Tamazight (Latin)   Algeria
+        DEFINELOCALE( 0x0449, "ta-IN" ) //   Tamil   India
+        DEFINELOCALE( 0x0444, "tt-RU" ) //   Tatar   Russia
+        DEFINELOCALE( 0x044a, "te-IN" ) //   Telugu  India
+        DEFINELOCALE( 0x041e, "th-TH" ) //   Thai    Thailand
+        DEFINELOCALE( 0x0451, "bo-CN" ) //   Tibetan     PRC
+        DEFINELOCALE( 0x041f, "tr-TR" ) //   Turkish     Turkey
+        DEFINELOCALE( 0x0442, "tk-TM" ) //   Turkmen     Turkmenistan
+        DEFINELOCALE( 0x0480, "ug-CN" ) //   Uighur  PRC
+        DEFINELOCALE( 0x0422, "uk-UA" ) //   Ukrainian   Ukraine
+        DEFINELOCALE( 0x042e, "wen-DE" ) //  Upper Sorbian   Germany
+        DEFINELOCALE( 0x0420, "ur-PK" ) //   Urdu    Pakistan
+        DEFINELOCALE( 0x0843, "uz-Cyrl-UZ" ) //  Uzbek (Cyrillic)    Uzbekistan
+        DEFINELOCALE( 0x0443, "uz-Latn-UZ" ) //  Uzbek (Latin)   Uzbekistan
+        DEFINELOCALE( 0x042a, "vi-VN" ) //   Vietnamese  Vietnam
+        DEFINELOCALE( 0x0452, "cy-GB" ) //   Welsh   United Kingdom
+        DEFINELOCALE( 0x0488, "wo-SN" ) //   Wolof   Senegal
+        DEFINELOCALE( 0x0485, "sah-RU" ) //  Yakut   Russia
+        DEFINELOCALE( 0x0478, "ii-CN" ) //   Yi  PRC
+        DEFINELOCALE( 0x046a, "yo-NG" ) //   Yoruba  Nigeria
+
+#undef DEFINELOCALE
+    }
+};
+
+QLocale MSO::localeForLangId( int langid )
+{
+    K_GLOBAL_STATIC( LangIdToLocaleMapping, s_LangIdToLocaleMapping )
+    return QLocale( s_LangIdToLocaleMapping->value( langid ) );
+}
diff --git a/filters/sheets/xlsx/NumberFormatParser.h b/filters/libmso/MsoUtils.h
similarity index 55%
copy from filters/sheets/xlsx/NumberFormatParser.h
copy to filters/libmso/MsoUtils.h
index e877d40..f18e64e 100644
--- a/filters/sheets/xlsx/NumberFormatParser.h
+++ b/filters/libmso/MsoUtils.h
@@ -1,9 +1,11 @@
 /*
  * This file is part of Office 2007 Filters for Calligra
+ * Copyright (C) 2002 Laurent Montel <lmontel@mandrakesoft.com>
+ * Copyright (c) 2003 Lukas Tinkl <lukas@kde.org>
+ * Copyright (C) 2003 David Faure <faure@kde.org>
+ * Copyright (C) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
  *
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
- *
- * Contact: Christoph Schleifenbaum christoph@kdab.com
+ * Contact: Suresh Chande suresh.chande@nokia.com
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -20,24 +22,24 @@
  * 02110-1301 USA
  *
  */
-#ifndef NUMBERFORMATPARSER_H
-#define NUMBERFORMATPARSER_H
 
-#include <KoGenStyle.h>
+#ifndef MSOUTILS_H
+#define MSOUTILS_H
 
-class QColor;
-class QLocale;
-class QString;
-class KoGenStyles;
+#include <QColor>
+#include <QLocale>
 
-class NumberFormatParser
+namespace MSO
 {
-public:
-    static QColor color(const QString& name);
-    static QLocale locale(int langid);
 
-    static KoGenStyle parse(const QString& numberFormat, KoGenStyles* styles = 0, \
                KoGenStyle::Type type = KoGenStyle::ParagraphAutoStyle);
-    static bool isDateFormat(const QString& numberFormat);
-};
+//! @return QColor value for DefaultIndexColor
+QColor defaultIndexedColor( int index );
+
+//! @return QLocale for the give language id
+QLocale localeForLangId(int langid);
+
+
+}; // namespace MSO
+
 
-#endif
+#endif /* MSOUTILS_H */
diff --git a/filters/sheets/xlsx/NumberFormatParser.cpp \
b/filters/libmso/NumberFormatParser.cpp similarity index 84%
rename from filters/sheets/xlsx/NumberFormatParser.cpp
rename to filters/libmso/NumberFormatParser.cpp
index 433ffe8..b8d6734 100644
--- a/filters/sheets/xlsx/NumberFormatParser.cpp
+++ b/filters/libmso/NumberFormatParser.cpp
@@ -25,7 +25,7 @@
 #include <KoGenStyles.h>
 #include <KoXmlWriter.h>
 
-#include <MsooXmlUtils.h>
+#include <MsoUtils.h>
 
 #include <QBuffer>
 #include <QLocale>
@@ -40,7 +40,7 @@ QColor NumberFormatParser::color(const QString& name)
     if (name.toUpper().startsWith(QLatin1String("COLOR"))) {
         bool ok = false;
         const int index = name.mid(5).toInt(&ok) + 7;
-        return MSOOXML::Utils::defaultIndexedColor(index);
+        return MSO::defaultIndexedColor(index);
     } else {
         return QColor(name);
     }
@@ -48,54 +48,54 @@ QColor NumberFormatParser::color(const QString& name)
 
 QLocale NumberFormatParser::locale(int langid)
 {
-    return MSOOXML::Utils::localeForLangId(langid);
+    return MSO::localeForLangId(langid);
 }
 
 #define SET_TYPE_OR_RETURN( TYPE ) { \
-if( type == KoGenStyle::NumericDateStyle && TYPE == KoGenStyle::NumericTimeStyle )   \
\ +if (type == KoGenStyle::NumericDateStyle && TYPE == KoGenStyle::NumericTimeStyle)  \
\  {                                                                                  \
\  }                                                                                  \
                \
-else if( type == KoGenStyle::NumericDateStyle && TYPE == \
KoGenStyle::NumericNumberStyle )        \ +else if (type == \
KoGenStyle::NumericDateStyle && TYPE == KoGenStyle::NumericNumberStyle)         \  {  \
\  }                                                                                  \
                \
-else if( type == KoGenStyle::NumericTimeStyle && TYPE == \
KoGenStyle::NumericNumberStyle )        \ +else if (type == \
KoGenStyle::NumericTimeStyle && TYPE == KoGenStyle::NumericNumberStyle)         \  {  \
\  }                                                                                  \
                \
-else if( type == KoGenStyle::NumericTimeStyle && TYPE == \
KoGenStyle::NumericDateStyle )          \ +else if (type == \
KoGenStyle::NumericTimeStyle && TYPE == KoGenStyle::NumericDateStyle)           \  {  \
                \
     type = TYPE;                                                                     \
\  }                                                                                  \
                \
-else if( type == KoGenStyle::NumericPercentageStyle && TYPE == \
KoGenStyle::NumericNumberStyle )  \ +else if (type == \
KoGenStyle::NumericPercentageStyle && TYPE == KoGenStyle::NumericNumberStyle)   \  {  \
\  }                                                                                  \
                \
-else if( type == KoGenStyle::NumericNumberStyle && TYPE == \
KoGenStyle::NumericPercentageStyle )  \ +else if (type == \
KoGenStyle::NumericNumberStyle && TYPE == KoGenStyle::NumericPercentageStyle)   \  {  \
                \
     type = TYPE;                                                                     \
\  }                                                                                  \
                \
-else if( type == KoGenStyle::NumericCurrencyStyle && TYPE == \
KoGenStyle::NumericNumberStyle )    \ +else if (type == \
KoGenStyle::NumericCurrencyStyle && TYPE == KoGenStyle::NumericNumberStyle)     \  {  \
\  }                                                                                  \
                \
-else if( type == KoGenStyle::NumericNumberStyle && TYPE == \
KoGenStyle::NumericCurrencyStyle )    \ +else if (type == \
KoGenStyle::NumericNumberStyle && TYPE == KoGenStyle::NumericCurrencyStyle)     \  {  \
                \
     type = TYPE;                                                                     \
\  }                                                                                  \
                \
-else if( type == KoGenStyle::NumericFractionStyle && TYPE == \
KoGenStyle::NumericNumberStyle )    \ +else if (type == \
KoGenStyle::NumericFractionStyle && TYPE == KoGenStyle::NumericNumberStyle)     \  {  \
\  }                                                                                  \
                \
-else if( type == KoGenStyle::NumericNumberStyle && TYPE == \
KoGenStyle::NumericFractionStyle )    \ +else if (type == \
KoGenStyle::NumericNumberStyle && TYPE == KoGenStyle::NumericFractionStyle)     \  {  \
                \
     type = TYPE;                                                                     \
\  }                                                                                  \
                \
-else if( type == KoGenStyle::NumericScientificStyle && TYPE == \
KoGenStyle::NumericNumberStyle )  \ +else if (type == \
KoGenStyle::NumericScientificStyle && TYPE == KoGenStyle::NumericNumberStyle)   \  {  \
\  }                                                                                  \
                \
-else if( type == KoGenStyle::NumericNumberStyle && TYPE == \
KoGenStyle::NumericScientificStyle )  \ +else if (type == \
KoGenStyle::NumericNumberStyle && TYPE == KoGenStyle::NumericScientificStyle)   \  {  \
                \
     type = TYPE;                                                                     \
\  }                                                                                  \
                \
-else if( type != KoGenStyle::ParagraphAutoStyle && type != TYPE )                    \
\ +else if (type != KoGenStyle::ParagraphAutoStyle && type != TYPE)                   \
\  {                                                                                  \
                \
-    return KoGenStyle( KoGenStyle::ParagraphAutoStyle );                             \
\ +    return KoGenStyle(KoGenStyle::ParagraphAutoStyle);                             \
\  }                                                                                  \
\  else                                                                               \
\  {                                                                                  \
\ @@ -104,11 +104,10 @@ else
 }
 
 #define FINISH_PLAIN_TEXT_PART {             \
-if( !plainText.isEmpty() )                   \
-{                                            \
+if (!plainText.isEmpty()) {		     \
     hadPlainText = true;                     \
-    xmlWriter.startElement( "number:text" ); \
-    xmlWriter.addTextNode( plainText );      \
+    xmlWriter.startElement("number:text");   \
+    xmlWriter.addTextNode(plainText );       \
     xmlWriter.endElement();                  \
     plainText.clear();                       \
 }                                            \
@@ -124,7 +123,8 @@ static KoGenStyle styleFromTypeAndBuffer(KoGenStyle::Type type, \
const QBuffer& b  return result;
 }
 
-KoGenStyle NumberFormatParser::parse(const QString& origNumberFormat, KoGenStyles* \
styles, KoGenStyle::Type type) +KoGenStyle NumberFormatParser::parse(const QString& \
origNumberFormat, KoGenStyles* styles, +				     KoGenStyle::Type type)
 {
     QBuffer buffer;
     buffer.open(QIODevice::WriteOnly);
@@ -134,8 +134,9 @@ KoGenStyle NumberFormatParser::parse(const QString& \
origNumberFormat, KoGenStyle  QMap< QString, QString > conditions;
     QString condition;
 
-    // this is for the month vs. minutes-context
+    // This is for the month vs. minutes-context.
     bool justHadHours = false;
+
     // to skip escaped plain-text
     bool hadPlainText = false;
     QString numberFormat = origNumberFormat;
@@ -144,10 +145,17 @@ KoGenStyle NumberFormatParser::parse(const QString& \
origNumberFormat, KoGenStyle  const char c = numberFormat[ i ].toLatin1();
         bool isSpecial = true;
 
-        const bool isLong = i < numberFormat.length() - 1 && numberFormat[ i + 1 ] \
                == c;
-        const bool isLonger = isLong && i < numberFormat.length() - 2 && \
                numberFormat[ i + 2 ] == c;
-        const bool isLongest = isLonger && i < numberFormat.length() - 3 && \
                numberFormat[ i + 3 ] == c;
-        const bool isWayTooLong = isLongest && i < numberFormat.length() - 4 && \
numberFormat[ i + 4 ] == c; +        const bool isLong       = (i < \
numberFormat.length() - 1 +				   && numberFormat[ i + 1 ] == c);
+        const bool isLonger     = (isLong
+				   && i < numberFormat.length() - 2
+				   && numberFormat[ i + 2 ] == c);
+        const bool isLongest    = (isLonger
+				   && i < numberFormat.length() - 3
+				   && numberFormat[ i + 3 ] == c);
+        const bool isWayTooLong = (isLongest
+				   && i < numberFormat.length() - 4
+				   && numberFormat[ i + 4 ] == c);
 
         switch (c) {
             // condition or color or locale or elapsed format
@@ -171,12 +179,18 @@ KoGenStyle NumberFormatParser::parse(const QString& \
origNumberFormat, KoGenStyle  // was actually time in 'elapsed format'
                     numberFormat.insert(i+1, colorName);
                 }
-            } else if (ch == '$' && i < numberFormat.length() - 2 && numberFormat[ i \
+ 1 ].toLatin1() != '-') { +            } else if (ch == '$'
+		       && i < numberFormat.length() - 2
+		       && numberFormat[ i + 1 ].toLatin1() != '-')
+	    {
                 SET_TYPE_OR_RETURN(KoGenStyle::NumericCurrencyStyle);
                 ++i;
-                // currency code
+
+		// currency code
                 QString currency;
-                while (i < numberFormat.length() && numberFormat[ i ] != \
QLatin1Char(']') && numberFormat[ i ] != QLatin1Char('-')) +                while (i \
< numberFormat.length() +		       && numberFormat[ i ] != QLatin1Char(']')
+		       && numberFormat[ i ] != QLatin1Char('-'))
                     currency += numberFormat[ i++ ];
 
                 QString language;
@@ -244,7 +258,10 @@ KoGenStyle NumberFormatParser::parse(const QString& \
origNumberFormat, KoGenStyle  SET_TYPE_OR_RETURN(KoGenStyle::NumericNumberStyle)
             FINISH_PLAIN_TEXT_PART
             // do following only if we are really a number and not part of another \
                KoGenStyle like a date or time formatting
-            if (type == KoGenStyle::NumericNumberStyle || type == \
KoGenStyle::NumericFractionStyle || type == KoGenStyle::NumericScientificStyle) { +   \
if (type == KoGenStyle::NumericNumberStyle +		|| type == \
KoGenStyle::NumericFractionStyle +		|| type == KoGenStyle::NumericScientificStyle)
+	    {
                 bool grouping = false;
                 bool gotDot = false;
                 bool gotE = false;
@@ -292,14 +309,19 @@ KoGenStyle NumberFormatParser::parse(const QString& \
origNumberFormat, KoGenStyle  ch = numberFormat[ ++i ].toLatin1();
 
                     if (ch == ' ') {
-                        // spaces are not allowed - but there's an exception: if \
this is a fraction. Let's check for '?' or '/' +                        // Spaces are \
not allowed - but there is an exception: +                        // if this is a \
fraction. Let's check for '?' or '/'  const char c = numberFormat[ i + 1 \
].toLatin1();  if (c == '?' || c == '/')
                             ch = numberFormat[ ++i ].toLatin1();
                     }
-                } while (i < numberFormat.length() && (ch == '.' || ch == ',' || ch \
== '#' || ch == '0' || ch == 'E' || ch == 'e' || ch == '?' || ch == '/')); +          \
} while (i < numberFormat.length() +			 && (ch == '.' || ch == ',' || ch == '#' || ch \
== '0' +			     || ch == 'E' || ch == 'e' || ch == '?' || ch == '/'));
 
-                if (!(ch == '.' || ch == ',' || ch == '#' || ch == '0' || ch == 'E' \
|| ch == 'e' || ch == '?' || ch == '/')) { +                if (!(ch == '.' || ch == \
',' || ch == '#' || ch == '0' +		      || ch == 'E' || ch == 'e' || ch == '?' || ch \
== '/')) +		{
                     --i;
                 }
 
@@ -368,21 +390,25 @@ KoGenStyle NumberFormatParser::parse(const QString& \
origNumberFormat, KoGenStyle  SET_TYPE_OR_RETURN(KoGenStyle::NumericDateStyle)
                 FINISH_PLAIN_TEXT_PART;
                 xmlWriter.startElement("number:month");
-                const bool isReallyReallyLong = isWayTooLong && i < \
numberFormat.length() - 4 && numberFormat[ i + 4 ] == c; +                const bool \
isReallyReallyLong = (isWayTooLong +						 && i < numberFormat.length() - 4
+						 && numberFormat[ i + 4 ] == c);
                 if (isLongest && !isReallyReallyLong)
                     xmlWriter.addAttribute("number:style", "long");
-                if (isWayTooLong) {       // the month format is "mmmmm" then it's \
the extra-short format of month +                if (isWayTooLong) {
+		    // If the month format is "mmmmm" then it's the
+		    // extra-short format of month.
                     xmlWriter.addAttribute("calligra:number-length", "extra-short");
                 }
                 xmlWriter.addAttribute("number:textual", "true");
                 xmlWriter.endElement();
                 i += isLongest ? (isWayTooLong ? 4 : 3) : 2;
-                if (isReallyReallyLong ) {
+                if (isReallyReallyLong) {
                     ++i;
                 }
             }
-            // depends on the context. After hours and before seconds, it's minutes
-            // otherwise it's the month
+            // This depends on the context. After hours and before seconds,
+            // it's minutes otherwise it's the month
             else {
                 if (justHadHours) {
                     SET_TYPE_OR_RETURN(KoGenStyle::NumericTimeStyle)
@@ -392,9 +418,12 @@ KoGenStyle NumberFormatParser::parse(const QString& \
origNumberFormat, KoGenStyle  xmlWriter.addAttribute("number:style", "long");
                     xmlWriter.endElement();
                 } else {
-                    // on the next iteration, we might see whether there're seconds \
                or something else
-                    bool minutes = true; // let's just default to minutes, if \
                there's nothing more...
-                    // so let's look ahead:
+                    // On the next iteration, we might see whether there're
+                    // seconds or something else. Let's just default to
+                    // minutes, if there's nothing more.
+                    bool minutes = true;
+
+                    // So, let's look ahead:
                     for (int j = i + 1; j < numberFormat.length(); ++j) {
                         const char ch = numberFormat[ i ].toLatin1();
                         if (ch == 's' || ch == 'S') {   // minutes
@@ -486,7 +515,7 @@ KoGenStyle NumberFormatParser::parse(const QString& \
origNumberFormat, KoGenStyle  xmlWriter.endElement();
             break;
 
-            // now it's getting really scarry: semi-colon:
+            // Now it's getting really scary: semi-colon:
         case ';': {
             FINISH_PLAIN_TEXT_PART;
             buffer.close();
@@ -500,7 +529,7 @@ KoGenStyle NumberFormatParser::parse(const QString& \
origNumberFormat, KoGenStyle  }
             condition.clear();
 
-            // start a new style
+            // Start a new style
             buffer.setData(QByteArray());
             buffer.open(QIODevice::WriteOnly);
             type = KoGenStyle::ParagraphAutoStyle;
@@ -567,7 +596,8 @@ KoGenStyle NumberFormatParser::parse(const QString& \
origNumberFormat, KoGenStyle  buffer.open(QIODevice::WriteOnly);
     }
 
-    // if conditions w/o explicit expressions where added, we create the expressions
+    // If conditions w/o explicit expressions where added, we create the
+    // expressions.
     QStringList autoConditions;
     if (conditions.count(QString()) == 1) {
         autoConditions.push_back(QLatin1String("value()>=0"));
@@ -577,9 +607,12 @@ KoGenStyle NumberFormatParser::parse(const QString& \
origNumberFormat, KoGenStyle  autoConditions.push_back(QLatin1String("value()=0"));
     }
 
-    // add conditional styles:
-    for (QMap< QString, QString >::const_iterator it = conditions.constBegin(); it \
                != conditions.constEnd(); ++it) {
-        // conditional styles are always numbers
+    // Add conditional styles.
+    for (QMap<QString, QString>::const_iterator it = conditions.constBegin();
+	 it != conditions.constEnd();
+	 ++it)
+    {
+        // Conditional styles are always numbers.
         type = KoGenStyle::NumericNumberStyle;
 
         xmlWriter.startElement("style:map");
@@ -647,14 +680,19 @@ bool NumberFormatParser::isDateFormat(const QString& \
numberFormat)  ch = numberFormat[ ++i ].toLatin1();
 
                 if (ch == ' ') {
-                    // spaces are not allowed - but there's an exception: if this is \
a fraction. Let's check for '?' or '/' +                    // spaces are not allowed \
- but there's an exception: if +                    // this is a fraction. Let's \
check for '?' or '/'  const char c = numberFormat[ i + 1 ].toLatin1();
                     if (c == '?' || c == '/')
                         ch = numberFormat[ ++i ].toLatin1();
                 }
-            } while (i < numberFormat.length() && (ch == '.' || ch == ',' || ch == \
'#' || ch == '0' || ch == 'E' || ch == 'e' || ch == '?' || ch == '/')); +            \
} while (i < numberFormat.length() +		     && (ch == '.' || ch == ',' || ch == '#' || \
ch == '0' +			 || ch == 'E' || ch == 'e' || ch == '?' || ch == '/'));
 
-            if (!(ch == '.' || ch == ',' || ch == '#' || ch == '0' || ch == 'E' || \
ch == 'e' || ch == '?' || ch == '/')) { +            if (!(ch == '.' || ch == ',' || \
ch == '#' || ch == '0' +		  || ch == 'E' || ch == 'e' || ch == '?' || ch == '/'))
+	    {
                 --i;
             }
         }
@@ -664,8 +702,9 @@ bool NumberFormatParser::isDateFormat(const QString& \
numberFormat)  // AM/PM
         case 'A':
         case 'a':
-            if (numberFormat.mid(i, 5).toLower() == QLatin1String("am/pm") ||
-                    numberFormat.mid(i, 3).toLower() == QLatin1String("a/p")) {
+            if (numberFormat.mid(i, 5).toLower() == QLatin1String("am/pm")
+		|| numberFormat.mid(i, 3).toLower() == QLatin1String("a/p"))
+	    {
                 // SET_TYPE_OR_RETURN(KoGenStyle::NumericTimeStyle)
                 if (numberFormat.mid(i, 5).toLower() == QLatin1String("am/pm"))
                     i += 2;
@@ -673,7 +712,6 @@ bool NumberFormatParser::isDateFormat(const QString& \
numberFormat)  }
             break;
 
-
             // hours, long or short
         case 'H':
         case 'h':
@@ -697,8 +735,10 @@ bool NumberFormatParser::isDateFormat(const QString& \
numberFormat)  if (justHadHours) {
                     //SET_TYPE_OR_RETURN(KoGenStyle::NumericTimeStyle)
                 } else {
-                    // on the next iteration, we might see whether there're seconds \
                or something else
-                    bool minutes = true; // let's just default to minutes, if \
there's nothing more... +                    // On the next iteration, we might see \
whether there're +                    // seconds or something else. Let's just \
default to +                    // minutes, if there's nothing more.
+                    bool minutes = true;
                     // so let's look ahead:
                     for (int j = i + 1; j < numberFormat.length(); ++j) {
                         const char ch = numberFormat[ i ].toLatin1();
diff --git a/filters/sheets/xlsx/NumberFormatParser.h \
b/filters/libmso/NumberFormatParser.h similarity index 93%
rename from filters/sheets/xlsx/NumberFormatParser.h
rename to filters/libmso/NumberFormatParser.h
index e877d40..5a610cd 100644
--- a/filters/sheets/xlsx/NumberFormatParser.h
+++ b/filters/libmso/NumberFormatParser.h
@@ -36,7 +36,8 @@ public:
     static QColor color(const QString& name);
     static QLocale locale(int langid);
 
-    static KoGenStyle parse(const QString& numberFormat, KoGenStyles* styles = 0, \
KoGenStyle::Type type = KoGenStyle::ParagraphAutoStyle); +    static KoGenStyle \
parse(const QString& numberFormat, KoGenStyles* styles = 0, +			    KoGenStyle::Type \
type = KoGenStyle::ParagraphAutoStyle);  static bool isDateFormat(const QString& \
numberFormat);  };
 
diff --git a/filters/sheets/xlsx/XlsxUtils.h b/filters/libmso/XlsUtils.h
similarity index 98%
rename from filters/sheets/xlsx/XlsxUtils.h
rename to filters/libmso/XlsUtils.h
index a2eae4d..0c343a8 100644
--- a/filters/sheets/xlsx/XlsxUtils.h
+++ b/filters/libmso/XlsUtils.h
@@ -16,8 +16,8 @@
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-#ifndef UTILS_H
-#define UTILS_H
+#ifndef XLSUTILS_H
+#define XLSUTILS_H
 
 #include <QDebug>
 #include <math.h>
diff --git a/filters/libmsooxml/CMakeLists.txt b/filters/libmsooxml/CMakeLists.txt
index 7dc2d7f..7de40e0 100644
--- a/filters/libmsooxml/CMakeLists.txt
+++ b/filters/libmsooxml/CMakeLists.txt
@@ -7,9 +7,10 @@ endif(QCA2_FOUND)
 
 include_directories(
     ${KOMAIN_INCLUDES}
-    ${KOODF2_INCLUDES}
+    ${KOODF2_INCLUDES} # For charts
     ${CMAKE_CURRENT_SOURCE_DIRECTORY}
-    ${CMAKE_SOURCE_DIR}/filters/sheets/xlsx # for Charting
+    ${CMAKE_SOURCE_DIR}/filters/libmso # For NumberFormatParser
+    ${CMAKE_SOURCE_DIR}/filters/sheets/xlsx # For ChartExport  FIXME: Remove when \
moved to libodf2  )
 
 ########### next target ###############
@@ -33,15 +34,15 @@ set(msooxml_LIB_SRCS
     VmlDrawingReader.cpp
     PredefinedShapeHelper.cpp
     ComplexShapeHandler.cpp
-    ${CMAKE_SOURCE_DIR}/filters/sheets/xlsx/ChartExport.cpp
-    ${CMAKE_SOURCE_DIR}/filters/sheets/xlsx/NumberFormatParser.cpp
+    ${CMAKE_SOURCE_DIR}/filters/sheets/xlsx/XlsxChartOdfWriter.cpp
+    ${CMAKE_SOURCE_DIR}/filters/libodf2/chart/KoOdfChartWriter.cpp
     # TODO: move back to kolibs
     KoOdfExporter.cpp
 )
 
 kde4_add_library(komsooxml SHARED ${msooxml_LIB_SRCS})
 
-target_link_libraries(komsooxml koodf2 koodf komain)
+target_link_libraries(komsooxml mso koodf2 koodf komain)
 if(QCA2_FOUND)
    target_link_libraries(komsooxml ${QCA2_LIBRARIES})
 endif(QCA2_FOUND)
@@ -63,6 +64,7 @@ install( FILES
     MsooXmlCommonReaderMethods.h
     MsooXmlSchemas.h
     MsooXmlThemesReader.h
+    MsooXmlTheme.h
     MsooXmlUtils.h
     MsooXmlRelationships.h
     MsooXmlImport.h
diff --git a/filters/libmsooxml/MsooXmlCommonReaderDrawingMLImpl.h \
b/filters/libmsooxml/MsooXmlCommonReaderDrawingMLImpl.h index e8748ef..2cc8e9a 100644
--- a/filters/libmsooxml/MsooXmlCommonReaderDrawingMLImpl.h
+++ b/filters/libmsooxml/MsooXmlCommonReaderDrawingMLImpl.h
@@ -55,7 +55,7 @@
 #include <KoXmlWriter.h>
 #include <MsooXmlUnits.h>
 #include "Charting.h"
-#include "ChartExport.h"
+#include "XlsxChartOdfWriter.h"
 #include "XlsxXmlChartReader.h"
 #include "ComplexShapeHandler.h"
 
@@ -1832,43 +1832,43 @@ KoFilter::ConversionStatus \
MSOOXML_CURRENT_CLASS::read_chart()  if (!r_id.isEmpty() && m_context->relationships) \
                {
         const QString filepath = m_context->relationships->target(m_context->path, \
m_context->file, r_id);  
-        Charting::Chart* chart = new Charting::Chart;
-        ChartExport* chartexport = new ChartExport(chart, m_context->themes);
+        KoChart::Chart* chart = new KoChart::Chart;
+        XlsxChartOdfWriter* chartWriter = new XlsxChartOdfWriter(chart, \
m_context->themes);  bool hasStart = false, hasEnd = false;
 #if defined(XLSXXMLDRAWINGREADER_CPP)
         chart->m_sheetName = m_context->worksheetReaderContext->worksheetName;
-        chartexport->setSheetReplacement(false);
+        chartWriter->setSheetReplacement(false);
         if (m_currentDrawingObject->m_positions.contains(XlsxDrawingObject::FromAnchor)) \
                {
             XlsxDrawingObject::Position f = \
                m_currentDrawingObject->m_positions[XlsxDrawingObject::FromAnchor];
-            //chartexport->m_x = columnWidth(f.m_col-1, 0 /*f.m_colOff*/);
-            //chartexport->m_y = rowHeight(f.m_row-1, 0 /*f.m_rowOff*/);
-            chartexport->m_x = EMU_TO_POINT(f.m_colOff);
-            chartexport->m_y = EMU_TO_POINT(f.m_rowOff);
+            //chartWriter->m_x = columnWidth(f.m_col-1, 0 /*f.m_colOff*/);
+            //chartWriter->m_y = rowHeight(f.m_row-1, 0 /*f.m_rowOff*/);
+            chartWriter->m_x = EMU_TO_POINT(f.m_colOff);
+            chartWriter->m_y = EMU_TO_POINT(f.m_rowOff);
             hasStart = true;
             if (m_currentDrawingObject->m_positions.contains(XlsxDrawingObject::ToAnchor)) \
                {
                 f = \
                m_currentDrawingObject->m_positions[XlsxDrawingObject::ToAnchor];
-                chartexport->m_endCellAddress = \
                m_currentDrawingObject->toCellAddress();
-                //chartexport->m_end_x = f.m_colOff;
-                //chartexport->m_end_y = f.m_rowOff;
-                chartexport->m_end_x = EMU_TO_POINT(f.m_colOff);
-                chartexport->m_end_y = EMU_TO_POINT(f.m_rowOff);
+                chartWriter->m_endCellAddress = \
m_currentDrawingObject->toCellAddress(); +                //chartWriter->m_end_x = \
f.m_colOff; +                //chartWriter->m_end_y = f.m_rowOff;
+                chartWriter->m_end_x = EMU_TO_POINT(f.m_colOff);
+                chartWriter->m_end_y = EMU_TO_POINT(f.m_rowOff);
                 hasEnd = true;
             }
         }
 #else
-        chartexport->m_drawLayer = true;
+        chartWriter->m_drawLayer = true;
 #endif
         if (!hasStart) {
-            chartexport->m_x = EMU_TO_POINT(qMax((qint64)0, m_svgX));
-            chartexport->m_y = EMU_TO_POINT(qMax((qint64)0, m_svgY));
+            chartWriter->m_x = EMU_TO_POINT(qMax((qint64)0, m_svgX));
+            chartWriter->m_y = EMU_TO_POINT(qMax((qint64)0, m_svgY));
         }
         if (!hasEnd) {
-            chartexport->m_width = m_svgWidth > 0 ? EMU_TO_POINT(m_svgWidth) : 100;
-            chartexport->m_height = m_svgHeight > 0 ? EMU_TO_POINT(m_svgHeight) : \
100; +            chartWriter->m_width = m_svgWidth > 0 ? EMU_TO_POINT(m_svgWidth) : \
100; +            chartWriter->m_height = m_svgHeight > 0 ? EMU_TO_POINT(m_svgHeight) \
: 100;  }
 
         KoStore* storeout = m_context->import->outputStore();
-        QScopedPointer<XlsxXmlChartReaderContext> context(new \
XlsxXmlChartReaderContext(storeout, chartexport)); +        \
QScopedPointer<XlsxXmlChartReaderContext> context(new \
XlsxXmlChartReaderContext(storeout, chartWriter));  XlsxXmlChartReader reader(this);
         const KoFilter::ConversionStatus result = \
m_context->import->loadAndParseDocument(&reader, filepath, context.data());  if \
(result != KoFilter::OK) { @@ -1879,7 +1879,7 @@ KoFilter::ConversionStatus \
MSOOXML_CURRENT_CLASS::read_chart()  #if defined(XLSXXMLDRAWINGREADER_CPP)
         m_currentDrawingObject->setChart(context.take());
 #else
-        chartexport->saveIndex(body);
+        chartWriter->saveIndex(body);
 #endif
     }
 
diff --git a/filters/libmsooxml/MsooXmlDrawingTableStyleReader.cpp \
b/filters/libmsooxml/MsooXmlDrawingTableStyleReader.cpp index c7bd7fe..7240aca 100644
--- a/filters/libmsooxml/MsooXmlDrawingTableStyleReader.cpp
+++ b/filters/libmsooxml/MsooXmlDrawingTableStyleReader.cpp
@@ -18,7 +18,8 @@
  */
 
 #include "MsooXmlDrawingTableStyleReader.h"
-#include "MsooXmlThemesReader.h"
+#include "MsooXmlTheme.h"
+
 
 #include <KoGenStyles.h>
 #include <KoGenStyle.h>
diff --git a/filters/libmsooxml/MsooXmlImport.cpp \
b/filters/libmsooxml/MsooXmlImport.cpp index 49ad484..895adf1 100644
--- a/filters/libmsooxml/MsooXmlImport.cpp
+++ b/filters/libmsooxml/MsooXmlImport.cpp
@@ -29,7 +29,7 @@
 #include "MsooXmlSchemas.h"
 #include "MsooXmlContentTypes.h"
 #include "MsooXmlRelationships.h"
-#include "MsooXmlThemesReader.h"
+#include "MsooXmlTheme.h"
 #include "ooxml_pole.h"
 
 #include <QColor>
diff --git a/filters/libmsooxml/MsooXmlThemesReader.h \
b/filters/libmsooxml/MsooXmlTheme.h similarity index 67%
copy from filters/libmsooxml/MsooXmlThemesReader.h
copy to filters/libmsooxml/MsooXmlTheme.h
index 9682c34..4ad9b0e 100644
--- a/filters/libmsooxml/MsooXmlThemesReader.h
+++ b/filters/libmsooxml/MsooXmlTheme.h
@@ -21,17 +21,18 @@
  *
  */
 
-#ifndef MSOOXMLTHEMESREADER_H
-#define MSOOXMLTHEMESREADER_H
+#ifndef MSOOXMLTHEME_H
+#define MSOOXMLTHEME_H
 
 #include <QHash>
+#include <QVector>
 #include <QColor>
 #include <QMap>
 
 #include <KoGenStyles.h>
 
-#include "MsooXmlCommonReader.h"
-#include "MsooXmlImport.h"
+#include "komsooxml_export.h"
+
 
 namespace MSOOXML
 {
@@ -191,7 +192,7 @@ public:
 
     QMap<int, DrawingMLFillBase*> fillStyles;
 
-    // Stores the three line styles for use within a theme.
+    //! Stores the three line styles for use within a theme.
     QList<KoGenStyle> lnStyleLst;
 };
 
@@ -207,85 +208,7 @@ public:
     DrawingMLFormatScheme formatScheme;
 };
 
-//! Context for MsooXmlThemesReader::read()
-class KOMSOOXML_EXPORT MsooXmlThemesReaderContext : public MsooXmlReaderContext
-{
-public:
-    MsooXmlThemesReaderContext(DrawingMLTheme& t, MSOOXML::MsooXmlRelationships* \
                rel, MSOOXML::MsooXmlImport* imp,
-        QString pathName, QString fileName);
-    DrawingMLTheme * const theme;
-    MSOOXML::MsooXmlRelationships* relationships;
-    MSOOXML::MsooXmlImport* import;
-    QString path;
-    QString file;
-};
-
-//! A class reading MSOOXML themes markup - theme/theme1.xml.
-/*! @todo generalize for other MSOOXML subformats.
- */
-class KOMSOOXML_EXPORT MsooXmlThemesReader : public MSOOXML::MsooXmlCommonReader
-{
-public:
-    //! Creates MsooXmlThemesReader object.
-    //! On successful reading, @a theme will be written with theme definition.
-    explicit MsooXmlThemesReader(KoOdfWriters *writers);
-
-    virtual ~MsooXmlThemesReader();
-
-    //! Reads/parses the file. The output goes mainly to KoGenStyles* \
                KoOdfWriters::mainStyles
-    virtual KoFilter::ConversionStatus read(MsooXmlReaderContext* context = 0);
-
-protected:
-    KoFilter::ConversionStatus readInternal();
-    KoFilter::ConversionStatus read_theme();
-    KoFilter::ConversionStatus read_themeElements();
-    //! @todo no CASE
-    KoFilter::ConversionStatus read_objectDefaults();
-    KoFilter::ConversionStatus read_custClrLst();
-    KoFilter::ConversionStatus read_extraClrSchemeLst();
-    KoFilter::ConversionStatus read_extraClrScheme();
-
-    KoFilter::ConversionStatus read_clrScheme();
-    KoFilter::ConversionStatus read_color(); //!< helper
-    DrawingMLColorSchemeItemBase* m_currentColor_local; //!< used by *Clr()
-
-    KoFilter::ConversionStatus read_fmtScheme();
-    KoFilter::ConversionStatus read_fontScheme();
-    KoFilter::ConversionStatus read_clrMap();
-
-    KoFilter::ConversionStatus fillStyleReadHelper(int& index);
-    KoFilter::ConversionStatus read_bgFillStyleLst();
-    KoFilter::ConversionStatus read_fillStyleLst();
-    KoFilter::ConversionStatus read_majorFont();
-    KoFilter::ConversionStatus read_minorFont();
-    KoFilter::ConversionStatus read_lnStyleLst();
-
-    //! Used for skipping a subtree - just reads and shows each element.
-    //! called by BIND_READ_SKIP() macro.
-    KoFilter::ConversionStatus read_SKIP();
-
-#include "MsooXmlDrawingMLShared.h"
-
-    KoFilter::ConversionStatus read_srgbClr_local();
-    KoFilter::ConversionStatus read_sysClr_local();
-
-private:
-    void init();
-
-    MsooXmlThemesReaderContext* m_context;
-
-    typedef KoFilter::ConversionStatus(MsooXmlThemesReader::*ReadMethod)();
-    QHash<QString, ReadMethod> m_readMethods;
-    QHash<QString, QString> m_colorSchemeIndices;
-    bool m_clrScheme_initialized;
-    bool m_color_initialized;
-
-    MSOOXML::MsooXmlRelationships* m_relationships;
-    MSOOXML::MsooXmlImport* m_import;
-    QString m_path;
-    QString m_file;
-};
 
 } // namespace MSOOXML
 
-#endif //MSOOXMLTHEMESREADER_H
+#endif //MSOOXMLTHEME_H
diff --git a/filters/libmsooxml/MsooXmlThemesReader.cpp \
b/filters/libmsooxml/MsooXmlThemesReader.cpp index 5335029..4019a69 100644
--- a/filters/libmsooxml/MsooXmlThemesReader.cpp
+++ b/filters/libmsooxml/MsooXmlThemesReader.cpp
@@ -23,6 +23,7 @@
 
 #include "MsooXmlThemesReader.h"
 #include "MsooXmlSchemas.h"
+#include "MsooXmlTheme.h"
 #include "MsooXmlUtils.h"
 #include "MsooXmlUnits.h"
 
diff --git a/filters/libmsooxml/MsooXmlThemesReader.h \
b/filters/libmsooxml/MsooXmlThemesReader.h index 9682c34..b0fc4ae 100644
--- a/filters/libmsooxml/MsooXmlThemesReader.h
+++ b/filters/libmsooxml/MsooXmlThemesReader.h
@@ -32,190 +32,21 @@
 
 #include "MsooXmlCommonReader.h"
 #include "MsooXmlImport.h"
+#include "MsooXmlTheme.h"
 
 namespace MSOOXML
 {
 
-class DrawingMLColorSchemeItem;
-class DrawingMLColorSchemeSystemItem;
-
-//! @todo add other classes inheriting DrawingMLColorSchemeItemBase
-class KOMSOOXML_EXPORT DrawingMLColorSchemeItemBase
-{
-public:
-    DrawingMLColorSchemeItemBase();
-    virtual ~DrawingMLColorSchemeItemBase();
-    DrawingMLColorSchemeItem* toColorItem();
-    DrawingMLColorSchemeSystemItem* toSystemItem();
-    virtual QColor value() const = 0;
-    virtual DrawingMLColorSchemeItemBase* clone() const = 0;
-};
-
-class KOMSOOXML_EXPORT DrawingMLColorSchemeItem : public \
                DrawingMLColorSchemeItemBase
-{
-public:
-    DrawingMLColorSchemeItem();
-    virtual QColor value() const { return color; }
-    QColor color;
-    DrawingMLColorSchemeItem* clone() const { return new \
                DrawingMLColorSchemeItem(*this); }
-};
-
-class KOMSOOXML_EXPORT DrawingMLColorSchemeSystemItem : public \
                DrawingMLColorSchemeItemBase
-{
-public:
-    DrawingMLColorSchemeSystemItem();
-    virtual QColor value() const;
-
-    QColor lastColor;
-    QString systemColor; //!< ST_SystemColorVal ( §20.1.10.58).;
-    DrawingMLColorSchemeSystemItem* clone() const { return new \
                DrawingMLColorSchemeSystemItem(*this); }
-};
-
-typedef QHash<QString, DrawingMLColorSchemeItemBase*> DrawingMLColorSchemeItemHash;
-
-//! Implements color scheme, based on hash. All items are owned by this object.
-class KOMSOOXML_EXPORT DrawingMLColorScheme : public DrawingMLColorSchemeItemHash
-{
-public:
-    DrawingMLColorScheme();
-    ~DrawingMLColorScheme();
-
-    DrawingMLColorSchemeItemBase* value(const QString& name) const {
-        return DrawingMLColorSchemeItemHash::value(name);
-    }
-
-    /*! @return color value for index. Needed because while PPTX uses lookup by
-        name: value(QString&), XLSX uses lookup by index. When index is
-        invalid, 0 is returned. */
-    DrawingMLColorSchemeItemBase* value(int index) const;
-
-    DrawingMLColorScheme(const DrawingMLColorScheme& scheme);
-    DrawingMLColorScheme& operator=(const DrawingMLColorScheme& scheme);
-    //! Name of the color scheme
-    QString name;
-};
-
-//! Font set for majorFont and minorFont.
-//! @todo add more support for latin, ea and cs: charser, panose, pitchfamily \
                attributes (21.1.2.3.3)
-class KOMSOOXML_EXPORT DrawingMLFontSet
-{
-public:
-    DrawingMLFontSet();
-    //! A (script->typeface) hash with font definitions (20.1.4.1.16.)
-    QHash<QString, QString> typefacesForScripts;
-
-    //! Specifies that a Latin font be used for a specific run of text.
-    QString latinTypeface;
-
-    //! The possible values for this attribute are defined by the ST_TextTypeface \
                simple type
-    //! ( §20.1.10.81).
-    QString eaTypeface;
-    //! The possible values for this attribute are defined by the ST_TextTypeface \
                simple type
-    //! ( §20.1.10.81).
-    QString csTypeface;
-};
-
-//! Defines the font scheme within the theme
-//! The font scheme consists of a pair of major and minor fonts for which to use in \
                a document.s
-class KOMSOOXML_EXPORT DrawingMLFontScheme
-{
-public:
-    DrawingMLFontScheme();
-    DrawingMLFontSet majorFonts;
-    DrawingMLFontSet minorFonts;
-    QString name;
-};
-
-
-class KOMSOOXML_EXPORT DrawingMLFillBase
-{
-public:
-    virtual ~DrawingMLFillBase();
-    // This function will create the fill style and fill the appropriate styles
-    // and filePath if needed.
-    // Number is used to index to correct style, color is the color which should be \
                used when making the styles
-    virtual void writeStyles(KoGenStyles& styles, KoGenStyle *graphicStyle, QColor \
                color) = 0;
-
-    virtual DrawingMLFillBase* clone() const = 0;
-};
-
-class KOMSOOXML_EXPORT DrawingMLSolidFill : public DrawingMLFillBase
-{
-public:
-    void writeStyles(KoGenStyles& styles, KoGenStyle *graphicStyle, QColor color);
-
-    DrawingMLSolidFill* clone() const { return new DrawingMLSolidFill(*this); }
-};
-
-class KOMSOOXML_EXPORT DrawingMLBlipFill : public DrawingMLFillBase
-{
-public:
-    explicit DrawingMLBlipFill(const QString &filePath);
-    void writeStyles(KoGenStyles& styles, KoGenStyle *graphicStyle, QColor color);
-
-    DrawingMLBlipFill* clone() const { return new DrawingMLBlipFill(*this); }
-
-private:
-    QString m_filePath;
-};
-
-class KOMSOOXML_EXPORT DrawingMLGradientFill : public DrawingMLFillBase
-{
-public:
-    // Simplified gradient constructor
-    DrawingMLGradientFill(QVector<qreal> shadeModifier, QVector<qreal> tintModifier, \
                QVector<qreal> satModifier,
-                          QVector<int> alphaModifier, QVector<int> gradPositions, \
                QString gradAngle);
-    void writeStyles(KoGenStyles& styles, KoGenStyle *graphicStyle, QColor color);
-
-    DrawingMLGradientFill* clone() const { return new DrawingMLGradientFill(*this); \
                }
-
-private:
-    QVector<qreal> m_shadeModifier;
-    QVector<qreal> m_tintModifier;
-    QVector<qreal> m_satModifier;
-    QVector<int> m_alphaModifier;
-    QVector<int> m_gradPosition;
-    QString m_gradAngle;
-};
-
-class KOMSOOXML_EXPORT DrawingMLFormatScheme
-{
-public:
-
-    DrawingMLFormatScheme();
-    ~DrawingMLFormatScheme();
-    QString name;
-
-    DrawingMLFormatScheme(const DrawingMLFormatScheme& format);
-    DrawingMLFormatScheme& operator=(const DrawingMLFormatScheme& format);
-
-    QMap<int, DrawingMLFillBase*> fillStyles;
-
-    // Stores the three line styles for use within a theme.
-    QList<KoGenStyle> lnStyleLst;
-};
-
-//! Defines a single DrawingML theme.
-//! @todo support objectDefaults and extraClrSchemeLst
-class KOMSOOXML_EXPORT DrawingMLTheme
-{
-public:
-    DrawingMLTheme();
-    QString name;
-    DrawingMLColorScheme colorScheme;
-    DrawingMLFontScheme fontScheme;
-    DrawingMLFormatScheme formatScheme;
-};
-
 //! Context for MsooXmlThemesReader::read()
 class KOMSOOXML_EXPORT MsooXmlThemesReaderContext : public MsooXmlReaderContext
 {
 public:
-    MsooXmlThemesReaderContext(DrawingMLTheme& t, MSOOXML::MsooXmlRelationships* \
                rel, MSOOXML::MsooXmlImport* imp,
-        QString pathName, QString fileName);
+    MsooXmlThemesReaderContext(DrawingMLTheme& t, MSOOXML::MsooXmlRelationships* \
rel, +			       MSOOXML::MsooXmlImport* imp,
+			       QString pathName, QString fileName);
     DrawingMLTheme * const theme;
-    MSOOXML::MsooXmlRelationships* relationships;
-    MSOOXML::MsooXmlImport* import;
+    MSOOXML::MsooXmlRelationships *relationships;
+    MSOOXML::MsooXmlImport        *import;
     QString path;
     QString file;
 };
diff --git a/filters/libmsooxml/MsooXmlUtils.cpp \
b/filters/libmsooxml/MsooXmlUtils.cpp index 31df41e..25bb0d6 100644
--- a/filters/libmsooxml/MsooXmlUtils.cpp
+++ b/filters/libmsooxml/MsooXmlUtils.cpp
@@ -577,311 +577,6 @@ QBrush Utils::ST_HighlightColor_to_QColor(const QString& \
colorName)  return QBrush(); // for "none" or anything unsupported
 }
 
-class DefaultIndexedColors : public QList< QColor >
-{
-public:
-    DefaultIndexedColors()
-    {
-        push_back( QColor( 0, 0, 0 ) );
-        push_back( QColor( 255, 255, 255 ) );
-        push_back( QColor( 255, 0, 0 ) );
-        push_back( QColor( 0, 255, 0 ) );
-        push_back( QColor( 0, 0, 255 ) );
-        push_back( QColor( 255, 255, 0 ) );
-        push_back( QColor( 255, 0, 255 ) );
-        push_back( QColor( 0, 255, 255 ) );
-        push_back( QColor( 0, 0, 0 ) );
-        push_back( QColor( 255, 255, 255 ) );
-        push_back( QColor( 255, 0, 0 ) );
-        push_back( QColor( 0, 255, 0 ) );
-        push_back( QColor( 0, 0, 255 ) );
-        push_back( QColor( 255, 255, 0 ) );
-        push_back( QColor( 255, 0, 255 ) );
-        push_back( QColor( 0, 255, 255 ) );
-        push_back( QColor( 128, 0, 0 ) );
-        push_back( QColor( 0, 128, 0 ) );
-        push_back( QColor( 0, 0, 128 ) );
-        push_back( QColor( 128, 128, 0 ) );
-        push_back( QColor( 128, 0, 128 ) );
-        push_back( QColor( 0, 128, 128 ) );
-        push_back( QColor( 192, 192, 192 ) );
-        push_back( QColor( 128, 128, 128 ) );
-        push_back( QColor( 153, 153, 255 ) );
-        push_back( QColor( 153, 51, 102 ) );
-        push_back( QColor( 255, 255, 204 ) );
-        push_back( QColor( 204, 255, 255 ) );
-        push_back( QColor( 102, 0, 102 ) );
-        push_back( QColor( 255, 128, 128 ) );
-        push_back( QColor( 0, 102, 204 ) );
-        push_back( QColor( 204, 204, 255 ) );
-        push_back( QColor( 0, 0, 128 ) );
-        push_back( QColor( 255, 0, 255 ) );
-        push_back( QColor( 255, 255, 0 ) );
-        push_back( QColor( 0, 255, 255 ) );
-        push_back( QColor( 128, 0, 128 ) );
-        push_back( QColor( 128, 0, 0 ) );
-        push_back( QColor( 0, 128, 128 ) );
-        push_back( QColor( 0, 0, 255 ) );
-        push_back( QColor( 0, 204, 255 ) );
-        push_back( QColor( 204, 255, 255 ) );
-        push_back( QColor( 204, 255, 204 ) );
-        push_back( QColor( 255, 255, 153 ) );
-        push_back( QColor( 153, 204, 255 ) );
-        push_back( QColor( 255, 153, 204 ) );
-        push_back( QColor( 204, 153, 255 ) );
-        push_back( QColor( 255, 204, 153 ) );
-        push_back( QColor( 51, 102, 255 ) );
-        push_back( QColor( 51, 204, 204 ) );
-        push_back( QColor( 153, 204, 0 ) );
-        push_back( QColor( 255, 204, 0 ) );
-        push_back( QColor( 255, 153, 0 ) );
-        push_back( QColor( 255, 102, 0 ) );
-        push_back( QColor( 102, 102, 153 ) );
-        push_back( QColor( 150, 150, 150 ) );
-        push_back( QColor( 0, 51, 102 ) );
-        push_back( QColor( 51, 102, 153 ) );
-        push_back( QColor( 0, 51, 0 ) );
-        push_back( QColor( 51, 51, 0 ) );
-        push_back( QColor( 153, 51, 0 ) );
-        push_back( QColor( 153, 51, 102 ) );
-        push_back( QColor( 51, 51, 153 ) );
-        push_back( QColor( 51, 51, 51 ) );
-        push_back( QPalette().color( QPalette::Active, QPalette::WindowText ) );
-        push_back( QPalette().color( QPalette::Active, QPalette::Window ) );
-     }
-};
-
-QColor Utils::defaultIndexedColor( int index )
-{
-    K_GLOBAL_STATIC( DefaultIndexedColors, s_defaultIndexedColors )
-    if( index < 0 || s_defaultIndexedColors->count() <= index )
-        return QColor();
-    return s_defaultIndexedColors->at( index );
-}
-
-class LangIdToLocaleMapping : public QMap< int, QString >
-{
-public:
-    LangIdToLocaleMapping()
-    {
-#define DEFINELOCALE( ID, CODE ) insert( ID, QLatin1String( CODE ) );
-        DEFINELOCALE( 0x0436, "af-ZA" ) //  Afrikaans   South Africa
-        DEFINELOCALE( 0x041c, "sq-AL" ) //  Albanian    Albania
-        DEFINELOCALE( 0x0484, "gsw-FR" ) //  Alsatian    France
-        DEFINELOCALE( 0x045e, "am-ET" ) //   Amharic     Ethiopia
-        DEFINELOCALE( 0x0401, "ar-SA" ) //   Arabic  Saudi Arabia
-        DEFINELOCALE( 0x0801, "ar-IQ" ) //   Arabic  Iraq
-        DEFINELOCALE( 0x0c01, "ar-EG" ) //   Arabic  Egypt
-        DEFINELOCALE( 0x1001, "ar-LY" ) //   Arabic  Libya
-        DEFINELOCALE( 0x1401, "ar-DZ" ) //   Arabic  Algeria
-        DEFINELOCALE( 0x1801, "ar-MA" ) //   Arabic  Morocco
-        DEFINELOCALE( 0x1c01, "ar-TN" ) //   Arabic  Tunisia
-        DEFINELOCALE( 0x2001, "ar-OM" ) //   Arabic  Oman
-        DEFINELOCALE( 0x2401, "ar-YE" ) //   Arabic  Yemen
-        DEFINELOCALE( 0x2801, "ar-SY" ) //   Arabic  Syria
-        DEFINELOCALE( 0x2c01, "ar-JO" ) //   Arabic  Jordan
-        DEFINELOCALE( 0x3001, "ar-LB" ) //   Arabic  Lebanon
-        DEFINELOCALE( 0x3401, "ar-KW" ) //   Arabic  Kuwait
-        DEFINELOCALE( 0x3801, "ar-AE" ) //   Arabic  U.A.E.
-        DEFINELOCALE( 0x3c01, "ar-BH" ) //   Arabic  Bahrain
-        DEFINELOCALE( 0x4001, "ar-QA" ) //   Arabic  Qatar
-        DEFINELOCALE( 0x042b, "hy-AM" ) //   Armenian    Armenia
-        DEFINELOCALE( 0x044d, "as-IN" ) //   Assamese    India
-        DEFINELOCALE( 0x082c, "az-Cyrl-AZ" ) //  Azeri (Cyrillic)    Azerbaijan
-        DEFINELOCALE( 0x042c, "az-Latn-AZ" ) //  Azeri (Latin)   Azerbaijan
-        DEFINELOCALE( 0x046d, "ba-RU" ) //   Bashkir     Russia
-        DEFINELOCALE( 0x042d, "eu-ES" ) //   Basque  Basque
-        DEFINELOCALE( 0x0423, "be-BY" ) //   Belarusian  Belarus
-        DEFINELOCALE( 0x0445, "bn-IN" ) //   Bengali     India
-        DEFINELOCALE( 0x0845, "bn-BD" ) //   Bengali     Bangladesh
-        DEFINELOCALE( 0x201a, "bs-Cyrl-BA" ) //  Bosnian (Cyrillic)  Bosnia and \
                Herzegovina
-        DEFINELOCALE( 0x141a, "bs-Latn-BA" ) //  Bosnian (Latin)     Bosnia and \
                Herzegovina
-        DEFINELOCALE( 0x047e, "br-FR" ) //   Breton  France
-        DEFINELOCALE( 0x0402, "bg-BG" ) //   Bulgarian   Bulgaria
-        DEFINELOCALE( 0x0403, "ca-ES" ) //   Catalan     Catalan
-        DEFINELOCALE( 0x0404, "zh-TW" ) //   Chinese     Taiwan
-        DEFINELOCALE( 0x0804, "zh-CN" ) //   Chinese     PRC
-        DEFINELOCALE( 0x0c04, "zh-HK" ) //   Chinese     Hong Kong SAR
-        DEFINELOCALE( 0x1004, "zh-SG" ) //   Chinese     Singapore
-        DEFINELOCALE( 0x1404, "zh-MO" ) //   Chinese     Macao SAR
-        DEFINELOCALE( 0x0483, "co-FR" ) //   Corsican    France
-        DEFINELOCALE( 0x041a, "hr-HR" ) //   Croatian    Croatia
-        DEFINELOCALE( 0x101a, "hr-BA" ) //   Croatian (Latin)    Bosnia and \
                Herzegovina
-        DEFINELOCALE( 0x0405, "cs-CZ" ) //   Czech   Czech Republic
-        DEFINELOCALE( 0x0406, "da-DK" ) //   Danish  Denmark
-        DEFINELOCALE( 0x048c, "prs-AF" ) //  Dari    Afghanistan
-        DEFINELOCALE( 0x0465, "dv-MV" ) //   Divehi  Maldives
-        DEFINELOCALE( 0x0813, "nl-BE" ) //   Dutch   Belgium
-        DEFINELOCALE( 0x0413, "nl-NL" ) //   Dutch   Netherlands
-        DEFINELOCALE( 0x1009, "en-CA" ) //   English     Canada
-        DEFINELOCALE( 0x2009, "en-JM" ) //   English     Jamaica
-        DEFINELOCALE( 0x2409, "en-029" ) //  English     Caribbean
-        DEFINELOCALE( 0x2809, "en-BZ" ) //   English     Belize
-        DEFINELOCALE( 0x2c09, "en-TT" ) //   English     Trinidad
-        DEFINELOCALE( 0x0809, "en-GB" ) //   English     United Kingdom
-        DEFINELOCALE( 0x1809, "en-IE" ) //   English     Ireland
-        DEFINELOCALE( 0x4009, "en-IN" ) //   English     India
-        DEFINELOCALE( 0x1c09, "en-ZA" ) //   English     South Africa
-        DEFINELOCALE( 0x3009, "en-ZW" ) //   English     Zimbabwe
-        DEFINELOCALE( 0x0c09, "en-AU" ) //   English     Australia
-        DEFINELOCALE( 0x1409, "en-NZ" ) //   English     New Zealand
-        DEFINELOCALE( 0x3409, "en-PH" ) //   English     Philippines
-        DEFINELOCALE( 0x0409, "en-US" ) //   English     United States
-        DEFINELOCALE( 0x4409, "en-MY" ) //   English     Malaysia
-        DEFINELOCALE( 0x4809, "en-SG" ) //   English     Singapore
-        DEFINELOCALE( 0x0425, "et-EE" ) //   Estonian    Estonia
-        DEFINELOCALE( 0x0438, "fo-FO" ) //   Faroese     Faroe Islands
-        DEFINELOCALE( 0x0464, "fil-PH" ) //  Filipino    Philippines
-        DEFINELOCALE( 0x040b, "fi-FI" ) //   Finnish     Finland
-        DEFINELOCALE( 0x0c0c, "fr-CA" ) //   French  Canada
-        DEFINELOCALE( 0x040c, "fr-FR" ) //   French  France
-        DEFINELOCALE( 0x180c, "fr-MC" ) //   French  Monaco
-        DEFINELOCALE( 0x100c, "fr-CH" ) //   French  Switzerland
-        DEFINELOCALE( 0x080c, "fr-BE" ) //   French  Belgium
-        DEFINELOCALE( 0x140c, "fr-LU" ) //   French  Luxembourg
-        DEFINELOCALE( 0x0462, "fy-NL" ) //   Frisian     Netherlands
-        DEFINELOCALE( 0x0456, "gl-ES" ) //   Galician    Galician
-        DEFINELOCALE( 0x0437, "ka-GE" ) //   Georgian    Georgia
-        DEFINELOCALE( 0x0407, "de-DE" ) //   German  Germany
-        DEFINELOCALE( 0x0807, "de-CH" ) //   German  Switzerland
-        DEFINELOCALE( 0x0c07, "de-AT" ) //   German  Austria
-        DEFINELOCALE( 0x1407, "de-LI" ) //   German  Liechtenstein
-        DEFINELOCALE( 0x1007, "de-LU" ) //   German  Luxembourg
-        DEFINELOCALE( 0x0408, "el-GR" ) //   Greek   Greece
-        DEFINELOCALE( 0x046f, "kl-GL" ) //   Greenlandic     Greenland
-        DEFINELOCALE( 0x0447, "gu-IN" ) //   Gujarati    India
-        DEFINELOCALE( 0x0468, "ha-Latn-NG" ) //  Hausa   Nigeria
-        DEFINELOCALE( 0x040d, "he-IL" ) //   Hebrew  Israel
-        DEFINELOCALE( 0x0439, "hi-IN" ) //   Hindi   India
-        DEFINELOCALE( 0x040e, "hu-HU" ) //   Hungarian   Hungary
-        DEFINELOCALE( 0x040f, "is-IS" ) //   Icelandic   Iceland
-        DEFINELOCALE( 0x0470, "ig-NG" ) //   Igbo    Nigeria
-        DEFINELOCALE( 0x0421, "id-ID" ) //   Indonesian  Indonesia
-        DEFINELOCALE( 0x045d, "iu-Cans-CA" ) //  Inukitut (Syllabics)    Canada
-        DEFINELOCALE( 0x085d, "iu-Latn-CA" ) //  Inuktitut (Latin)   Canada
-        DEFINELOCALE( 0x083c, "ga-IE" ) //   Irish   Ireland
-        DEFINELOCALE( 0x0434, "xh-ZA" ) //   isiXhosa    South Africa
-        DEFINELOCALE( 0x0435, "zu-ZA" ) //   isiZulu     South Africa
-        DEFINELOCALE( 0x0410, "it-IT" ) //   Italian     Italy
-        DEFINELOCALE( 0x0810, "it-CH" ) //   Italian     Switzerland
-        DEFINELOCALE( 0x0411, "ja-JP" ) //   Japanese    Japan
-        DEFINELOCALE( 0x044b, "kn-IN" ) //   Kannada     India
-        DEFINELOCALE( 0x043f, "kk-KZ" ) //   Kazakh  Kazakhstan
-        DEFINELOCALE( 0x0453, "km-KH" ) //   Khmer   Cambodia
-        DEFINELOCALE( 0x0486, "qut-GT" ) //  K'iche  Guatemala
-        DEFINELOCALE( 0x0487, "rw-RW" ) //   Kinyarwanda     Rwanda
-        DEFINELOCALE( 0x0441, "sw-KE" ) //   Kiswahili   Kenya
-        DEFINELOCALE( 0x0457, "kok-IN" ) //  Konkani     India
-        DEFINELOCALE( 0x0412, "ko-KR" ) //   Korean  Korea
-        DEFINELOCALE( 0x0440, "ky-KG" ) //   Kyrgyz  Kyrgyzistan
-        DEFINELOCALE( 0x0454, "lo-LA" ) //   Lao     Lao P.D.R.
-        DEFINELOCALE( 0x0426, "lv-LV" ) //   Latvian     Latvia
-        DEFINELOCALE( 0x0427, "lt-LT" ) //   Lithuanian  Lithuania
-        DEFINELOCALE( 0x082e, "dsb-DE" ) //  Lower Sorbian   Germany
-        DEFINELOCALE( 0x046e, "lb-LU" ) //   Luxembourgish   Luxembourg
-        DEFINELOCALE( 0x042f, "mk-MK" ) //   Macedonian (FYROM)  Macedonia (FYROM)
-        DEFINELOCALE( 0x043e, "ms-MY" ) //   Malay   Malaysia
-        DEFINELOCALE( 0x083e, "ms-BN" ) //   Malay   Brunei Darussalam
-        DEFINELOCALE( 0x044c, "ml-IN" ) //   Malayalam   India
-        DEFINELOCALE( 0x043a, "mt-MT" ) //   Maltese     Malta
-        DEFINELOCALE( 0x0481, "mi-NZ" ) //   Maori   New Zealand
-        DEFINELOCALE( 0x047a, "arn-CL" ) //  Mapudungun  Chile
-        DEFINELOCALE( 0x044e, "mr-IN" ) //   Marathi     India
-        DEFINELOCALE( 0x047c, "moh-CA" ) //  Mohawk  Mohawk
-        DEFINELOCALE( 0x0450, "mn-MN" ) //   Mongolian (Cyrillic)    Mongolia
-        DEFINELOCALE( 0x0850, "mn-Mong-CN" ) //  Mongolian (Mongolian)   PRC
-        DEFINELOCALE( 0x0461, "ne-NP" ) //   Nepali  Nepal
-        DEFINELOCALE( 0x0414, "nb-NO" ) //   Norwegian (Bokmål)  Norway
-        DEFINELOCALE( 0x0814, "nn-NO" ) //   Norwegian (Nynorsk)     Norway
-        DEFINELOCALE( 0x0482, "oc-FR" ) //   Occitan     France
-        DEFINELOCALE( 0x0448, "or-IN" ) //   Oriya   India
-        DEFINELOCALE( 0x0463, "ps-AF" ) //   Pashto  Afghanistan
-        DEFINELOCALE( 0x0429, "fa-IR" ) //   Persian     Iran
-        DEFINELOCALE( 0x0415, "pl-PL" ) //   Polish  Poland
-        DEFINELOCALE( 0x0416, "pt-BR" ) //   Portuguese  Brazil
-        DEFINELOCALE( 0x0816, "pt-PT" ) //   Portuguese  Portugal
-        DEFINELOCALE( 0x0446, "pa-IN" ) //   Punjabi (Gurmukhi)  India
-        DEFINELOCALE( 0x046b, "quz-BO" ) //  Quechua     Bolivia
-        DEFINELOCALE( 0x086b, "quz-EC" ) //  Quechua     Ecuador
-        DEFINELOCALE( 0x0c6b, "quz-PE" ) //  Quechua     Peru
-        DEFINELOCALE( 0x0418, "ro-RO" ) //   Romanian    Romania
-        DEFINELOCALE( 0x0417, "rm-CH" ) //   Romansh     Switzerland
-        DEFINELOCALE( 0x0419, "ru-RU" ) //   Russian     Russia
-        DEFINELOCALE( 0x243b, "smn-FI" ) //  Sami, Inari     Finland
-        DEFINELOCALE( 0x143b, "smj-SE" ) //  Sami, Lule  Sweden
-        DEFINELOCALE( 0x103b, "smj-NO" ) //  Sami, Lule  Norway
-        DEFINELOCALE( 0x043b, "se-NO" ) //   Sami, Northern  Norway
-        DEFINELOCALE( 0x083b, "se-SE" ) //   Sami, Northern  Sweden
-        DEFINELOCALE( 0x0c3b, "se-FI" ) //   Sami, Northern  Finland
-        DEFINELOCALE( 0x203b, "sms-FI" ) //  Sami, Skolt     Finland
-        DEFINELOCALE( 0x183b, "sma-NO" ) //  Sami, Southern  Norway
-        DEFINELOCALE( 0x1c3b, "sma-SE" ) //  Sami, Southern  Sweden
-        DEFINELOCALE( 0x044f, "sa-IN" ) //   Sanskrit    India
-        DEFINELOCALE( 0x0c1a, "sr-Cyrl-CS" ) //  Serbian (Cyrillic)  Serbia
-        DEFINELOCALE( 0x1c1a, "sr-Cyrl-BA" ) //  Serbian (Cyrillic)  Bosnia and \
                Herzegovina
-        DEFINELOCALE( 0x081a, "sr-Latn-CS" ) //  Serbian (Latin)     Serbia
-        DEFINELOCALE( 0x181a, "sr-Latn-BA" ) //  Serbian (Latin)     Bosnia and \
                Herzegovina
-        DEFINELOCALE( 0x046c, "nso-ZA" ) //  Sesotho sa Leboa    South Africa
-        DEFINELOCALE( 0x0432, "tn-ZA" ) //   Setswana    South Africa
-        DEFINELOCALE( 0x045b, "si-LK" ) //   Sinhala     Sri Lanka
-        DEFINELOCALE( 0x041b, "sk-SK" ) //   Slovak  Slovakia
-        DEFINELOCALE( 0x0424, "sl-SI" ) //   Slovenian   Slovenia
-        DEFINELOCALE( 0x080a, "es-MX" ) //   Spanish     Mexico
-        DEFINELOCALE( 0x100a, "es-GT" ) //   Spanish     Guatemala
-        DEFINELOCALE( 0x140a, "es-CR" ) //   Spanish     Costa Rica
-        DEFINELOCALE( 0x180a, "es-PA" ) //   Spanish     Panama
-        DEFINELOCALE( 0x1c0a, "es-DO" ) //   Spanish     Dominican Republic
-        DEFINELOCALE( 0x200a, "es-VE" ) //   Spanish     Venezuela
-        DEFINELOCALE( 0x240a, "es-CO" ) //   Spanish     Colombia
-        DEFINELOCALE( 0x280a, "es-PE" ) //   Spanish     Peru
-        DEFINELOCALE( 0x2c0a, "es-AR" ) //   Spanish     Argentina
-        DEFINELOCALE( 0x300a, "es-EC" ) //   Spanish     Ecuador
-        DEFINELOCALE( 0x340a, "es-CL" ) //   Spanish     Chile
-        DEFINELOCALE( 0x3c0a, "es-PY" ) //   Spanish     Paraguay
-        DEFINELOCALE( 0x400a, "es-BO" ) //   Spanish     Bolivia
-        DEFINELOCALE( 0x440a, "es-SV" ) //   Spanish     El Salvador
-        DEFINELOCALE( 0x480a, "es-HN" ) //   Spanish     Honduras
-        DEFINELOCALE( 0x4c0a, "es-NI" ) //   Spanish     Nicaragua
-        DEFINELOCALE( 0x500a, "es-PR" ) //   Spanish     Puerto Rico
-        DEFINELOCALE( 0x540a, "es-US" ) //   Spanish     United States
-        DEFINELOCALE( 0x380a, "es-UY" ) //   Spanish     Uruguay
-        DEFINELOCALE( 0x0c0a, "es-ES" ) //   Spanish (International Sort)    Spain
-        DEFINELOCALE( 0x040a, "es-ES_tradnl" ) //    Spanish (Traditional Sort)  \
                Spain
-        DEFINELOCALE( 0x041d, "sv-SE" ) //   Swedish     Sweden
-        DEFINELOCALE( 0x081d, "sv-FI" ) //   Swedish     Finland
-        DEFINELOCALE( 0x045a, "syr-SY" ) //  Syriac  Syria
-        DEFINELOCALE( 0x0428, "tg-Cyrl-TJ" ) //  Tajik   Tajikistan
-        DEFINELOCALE( 0x085f, "tzm-Latn-DZ" ) //     Tamazight (Latin)   Algeria
-        DEFINELOCALE( 0x0449, "ta-IN" ) //   Tamil   India
-        DEFINELOCALE( 0x0444, "tt-RU" ) //   Tatar   Russia
-        DEFINELOCALE( 0x044a, "te-IN" ) //   Telugu  India
-        DEFINELOCALE( 0x041e, "th-TH" ) //   Thai    Thailand
-        DEFINELOCALE( 0x0451, "bo-CN" ) //   Tibetan     PRC
-        DEFINELOCALE( 0x041f, "tr-TR" ) //   Turkish     Turkey
-        DEFINELOCALE( 0x0442, "tk-TM" ) //   Turkmen     Turkmenistan
-        DEFINELOCALE( 0x0480, "ug-CN" ) //   Uighur  PRC
-        DEFINELOCALE( 0x0422, "uk-UA" ) //   Ukrainian   Ukraine
-        DEFINELOCALE( 0x042e, "wen-DE" ) //  Upper Sorbian   Germany
-        DEFINELOCALE( 0x0420, "ur-PK" ) //   Urdu    Pakistan
-        DEFINELOCALE( 0x0843, "uz-Cyrl-UZ" ) //  Uzbek (Cyrillic)    Uzbekistan
-        DEFINELOCALE( 0x0443, "uz-Latn-UZ" ) //  Uzbek (Latin)   Uzbekistan
-        DEFINELOCALE( 0x042a, "vi-VN" ) //   Vietnamese  Vietnam
-        DEFINELOCALE( 0x0452, "cy-GB" ) //   Welsh   United Kingdom
-        DEFINELOCALE( 0x0488, "wo-SN" ) //   Wolof   Senegal
-        DEFINELOCALE( 0x0485, "sah-RU" ) //  Yakut   Russia
-        DEFINELOCALE( 0x0478, "ii-CN" ) //   Yi  PRC
-        DEFINELOCALE( 0x046a, "yo-NG" ) //   Yoruba  Nigeria
-
-#undef DEFINELOCALE
-    }
-};
-
-QLocale Utils::localeForLangId( int langid )
-{
-    K_GLOBAL_STATIC( LangIdToLocaleMapping, s_LangIdToLocaleMapping )
-    return QLocale( s_LangIdToLocaleMapping->value( langid ) );
-}
-
 qreal Utils::ST_Percentage_to_double(const QString& val, bool& ok)
 {
     if (!val.endsWith('%')) {
diff --git a/filters/libmsooxml/MsooXmlUtils.h b/filters/libmsooxml/MsooXmlUtils.h
index 055fa15..c796408 100644
--- a/filters/libmsooxml/MsooXmlUtils.h
+++ b/filters/libmsooxml/MsooXmlUtils.h
@@ -335,12 +335,6 @@ inline QColor ST_HexColorRGB_to_QColor(const QString& color)
 //! @par colorName named text highlight color like "black", "blue" (17.18.40)
 KOMSOOXML_EXPORT QBrush ST_HighlightColor_to_QColor(const QString& colorName);
 
-//! @return QColor value for DefaultIndexColor
-KOMSOOXML_EXPORT QColor defaultIndexedColor( int index );
-
-//! @return QLocale for the give language id
-KOMSOOXML_EXPORT QLocale localeForLangId( int langid );
-
 //! Converts value for 22.9.2.9 ST_Percentage (Percentage Value with Sign) from \
string  //! Sets @arg ok to true on success.
 KOMSOOXML_EXPORT qreal ST_Percentage_to_double(const QString& val, bool& ok);
diff --git a/filters/libodf2/CMakeLists.txt b/filters/libodf2/CMakeLists.txt
index 0006016..0a4ae56 100644
--- a/filters/libodf2/CMakeLists.txt
+++ b/filters/libodf2/CMakeLists.txt
@@ -1,10 +1,19 @@
 #add_subdirectory( tests )
 
-include_directories( ${KOODF_INCLUDES} ${KOODF2_INCLUDES} )
+include_directories(${KOODF_INCLUDES}
+                    ${KOODF2_INCLUDES}
+
+                    # FIXME: This should not be here. Make sure that the chart
+                    #        classes parse the number formats while loading,
+                    #        and not just store the unparsed format strings to
+                    #        be parsed during saving.
+ 		    ${CMAKE_SOURCE_DIR}/filters/libmso  # for NumberFormatParser
+)
 
 ########### libkoodf2 ###############
 
 set(koodf2_LIB_SRCS
+    # Storage objects, using old DOM based loading
     KoXmlStreamReader.cpp
     KoXmlUtils.cpp
 
@@ -17,12 +26,14 @@ set(koodf2_LIB_SRCS
     KoCellChild.cpp
     KoRawCellChild.cpp
 
+    # Style objects, using old DOM based loading
     KoStyle.cpp
     KoTblStyle.cpp
     KoRowStyle.cpp
     KoColumnStyle.cpp
     KoCellStyle.cpp
 
+    # Style objects, using newer stream based loading
     KoOdfStyleBase.cpp
     KoOdfStyleManager.cpp
     KoOdfStyle.cpp
@@ -35,11 +46,13 @@ set(koodf2_LIB_SRCS
     KoOdfGraphicProperties.cpp
     KoOdfPageLayoutProperties.cpp
     KoOdfHeaderFooterProperties.cpp
+
+    chart/KoOdfChartWriter.cpp
 )
 
 kde4_add_library(koodf2 SHARED ${koodf2_LIB_SRCS})
 
-target_link_libraries(koodf2 koodf ${KDE4_KIO_LIBS} ${QT_QTXML_LIBRARY})
+target_link_libraries(koodf2 koodf mso ${KDE4_KIO_LIBS} ${QT_QTXML_LIBRARY})
 target_link_libraries(koodf2 LINK_INTERFACE_LIBRARIES ${KDE4_KIO_LIBS})
 
 set_target_properties(koodf2 PROPERTIES
@@ -71,5 +84,9 @@ install( FILES
     KoOdfGraphicProperties.h
     KoOdfPageLayoutProperties.h
     KoOdfHeaderFooterProperties.h
+
+    chart/Charting.h
+    chart/KoOdfChartWriter.h
+
 DESTINATION ${INCLUDE_INSTALL_DIR}/calligra COMPONENT Devel)
 
diff --git a/filters/libodf2/chart/Charting.h b/filters/libodf2/chart/Charting.h
new file mode 100644
index 0000000..f3b734b
--- /dev/null
+++ b/filters/libodf2/chart/Charting.h
@@ -0,0 +1,724 @@
+/*
+ *  Copyright (c) 2010 Sebastian Sauer <sebsauer@kdab.com>
+ *  Copyright (c) 2010 Carlos Licea <carlos@kdab.com>
+ *  Copyright (c) 2014 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 Lesser General Public License as published
+ *  by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef CHARTING_H
+#define CHARTING_H
+
+#include <QString>
+#include <QRect>
+#include <QMap>
+#include <QColor>
+#include <QDebug>
+
+
+namespace KoChart
+{
+  
+class Value
+{
+ public:
+    enum DataId {
+	SeriesLegendOrTrendlineName = 0x00, ///< Referenced data specifies the series, \
legend entry, or trendline name. Error bars name MUST be empty. +	HorizontalValues = \
0x01, ///< Referenced data specifies the values or horizontal values on bubble and \
scatter chart groups of the series and error bars. +	VerticalValues = 0x02, ///< \
Referenced data specifies the categories or vertical values on bubble and scatter \
chart groups of the series and error bars. +	BubbleSizeValues = 0x03 ///< Referenced \
data specifies the bubble size values of the series. +    };
+    DataId m_dataId;
+
+    enum DataType {
+	AutoGeneratedName = 0x00, ///< The data source is a category (3) name, series name \
or bubble size that was automatically generated. +	TextOrValue = 0x01, ///< The data \
source is the text or value as specified by the formula field. +	CellRange = 0x02 \
///< The data source is the value from a range of cells in a sheet specified by the \
formula field. +    };
+    DataType m_type;
+
+    bool m_isUnlinkedFormat; ///< false=data uses the number formatting of the \
referenced data, true=data uses the custom formatting specified via m_numberFormat. + \
unsigned m_numberFormat; ///< specifies the numnber format to use for the data. +    \
QString m_formula; ///< the optional formula. could be for example \
"[Sheet1.$D$2:$F$2]" +
+    Value(DataId dataId, DataType type,
+	  const QString& formula = QString(),
+	  bool isUnlinkedFormat = false, unsigned numberFormat = 0)
+	: m_dataId(dataId)
+	, m_type(type)
+	, m_isUnlinkedFormat(isUnlinkedFormat)
+	, m_numberFormat(numberFormat)
+	, m_formula(formula)
+    {}
+    virtual ~Value() {}
+};
+
+
+// ----------------------------------------------------------------
+//                             Formats
+
+
+class Format
+{
+ public:
+    Format() {}
+    virtual ~Format() {}
+};
+
+class LineFormat : public Format
+{
+ public:
+    enum Style {
+	Solid = 0x0000,
+	Dash = 0x0001,
+	Dot = 0x0002,
+	DashDot = 0x0003,
+	DashDotDot = 0x0004,
+	None = 0x0005,
+	DarkGrayPattern = 0x0006,
+	MediumGrayPattern = 0x0007,
+	LightGrayPattern = 0x0008
+    };
+
+    enum Thickness {
+	Hairline = 0xFFFF,
+	NarrowSingle = 0x0000,
+	MediumDouble = 0x0001,
+	WideTriple = 0x0002
+    };
+
+    Style     m_style;
+    Thickness m_thickness;
+
+    explicit LineFormat(const Style& style = None, const Thickness& thickness = \
Hairline) +	: Format()
+	, m_style(style)
+	, m_thickness(thickness)
+    {} 
+};
+    
+ class PieFormat : public Format
+ {
+ public:
+    int m_pcExplode; // from PieFormat
+
+    explicit PieFormat(int pcExplode = 0)
+	: Format()
+	, m_pcExplode(pcExplode)
+    {}
+ };
+    
+ class AreaFormat : public Format
+ {
+ public:
+    QColor m_foreground;
+    QColor m_background;
+    bool m_fill;
+ 
+    explicit AreaFormat(const QColor &foreground = QColor(), const QColor \
&background = QColor(), +			bool fill = false)
+	: Format()
+	, m_foreground(foreground)
+	, m_background(background)
+	, m_fill(fill)
+    {}
+ };
+
+class Gradient
+{
+ public:
+    Gradient() { angle =  0.0; }
+
+    class GradientStop
+    {
+    public:
+	void reset()
+	{
+	    position = 1.0;
+	    knownColorValue = QColor();
+	    tintVal = 0;
+	    satVal = 0;
+	    shadeVal = 0;
+	    referenceColor.clear();
+	}
+
+	qreal position;
+	QColor knownColorValue;
+	qreal tintVal;
+	qreal satVal;
+	qreal shadeVal;
+	QString referenceColor;
+    };
+
+    QVector< GradientStop > gradientStops;
+    qreal angle;
+};
+
+class Fill
+{
+ public:        
+    enum FillType {Blip, Gradient, Group, None, Pattern, Solid};
+
+    Fill()
+	: type(None)
+	, valid(false)
+    {}
+
+    void setColor(const QColor& color){ solidColor = color; valid = true; type = \
Solid; } +    void setType(FillType type){ this->type = type; valid = true; }
+
+    QColor solidColor;
+    QString pixmapFile;
+    KoChart::Gradient gradient;
+    FillType type;
+    bool valid;
+};
+    
+class ShapeProperties
+{
+ public:
+    int lineWidth;
+    Fill lineFill;
+    Fill areaFill;
+};
+
+
+// ----------------------------------------------------------------
+//                         Chart types
+
+
+class ChartImpl
+{
+ public:
+    ChartImpl() {}
+    virtual ~ChartImpl() {}
+    virtual QByteArray name() const = 0;
+};
+
+class PieImpl : public ChartImpl
+{
+ public:
+    /// Starting angle of the first data point clockwise from the top of the circle.
+    int m_anStart;
+
+    explicit PieImpl(int anStart = 0)
+	: ChartImpl()
+	, m_anStart(anStart)
+    {}
+
+    virtual QByteArray name() const { return "circle"; }
+};
+
+class RingImpl : public PieImpl
+{
+ public:
+    /// Size of the center hole in a doughnut chart group as a percentage of the \
plot area size. +    int m_pcDonut;
+
+    explicit RingImpl(int anStart = 0, int pcDonut = 0)
+	: PieImpl(anStart)
+	, m_pcDonut(pcDonut)
+    {}
+
+    virtual QByteArray name() const { return "ring"; }
+};
+
+class BarImpl : public ChartImpl
+{
+ public:
+    virtual QByteArray name() const { return "bar"; }
+};
+    
+class LineImpl : public ChartImpl
+{
+ public:
+    virtual QByteArray name() const { return "line"; }
+};
+    
+class RadarImpl : public ChartImpl
+{
+ public:
+    /// If true then the radar-chart is filled (a RadarArea chart), else not.
+    bool m_filled;
+
+    explicit RadarImpl(bool filled = false)
+	: ChartImpl()
+	, m_filled(filled)
+    {}
+
+    virtual QByteArray name() const { return m_filled ? "filled-radar" : "radar"; }
+};
+
+class AreaImpl : public ChartImpl
+{
+ public:
+    AreaImpl() : ChartImpl() {}
+
+    virtual QByteArray name() const { return "area"; }
+};
+
+class StockImpl : public ChartImpl
+{
+ public:
+    StockImpl() : ChartImpl() {}
+
+    virtual QByteArray name() const { return "stock"; }
+};
+
+class ScatterImpl : public ChartImpl
+{
+ public:
+    enum ScatterStyle { None, Line, LineMarker, Marker, Smooth, SmoothMarker };
+    ScatterStyle style;
+
+    ScatterImpl()
+	: ChartImpl()
+	, style(LineMarker)
+    {}
+
+    virtual QByteArray name() const { return "scatter"; }
+};
+
+class BubbleImpl : public ChartImpl
+{
+ public:
+    enum SizeType {
+	Area = 0x0001, ///< The area of the data point represents the value.
+	Width = 0x0002 ///< The width of the data point represents the value.
+    };
+    /// Specifies how the default size of the data points represents the value.
+    SizeType m_sizeType;
+
+    /// The size of the data points as a percentage of their default size. A
+    /// value of 100 shows all the data points in their default size, as
+    /// determined by the application.
+    unsigned int m_sizeRatio;
+
+    /// Specifies whether data points with negative values are shown.
+    bool m_showNegativeBubbles;
+
+    explicit BubbleImpl(SizeType sizeType = Area, unsigned int sizeRatio = 100,
+			bool showNegativeBubbles = true)
+	: ChartImpl()
+	, m_sizeType(sizeType)
+	, m_sizeRatio(sizeRatio)
+	, m_showNegativeBubbles(showNegativeBubbles)
+    {}
+
+    virtual QByteArray name() const { return "bubble"; }
+};
+
+class SurfaceImpl : public ChartImpl
+{
+ public:
+    /// Specifies that the surface is either filled or a wireframe.
+    bool m_fill;
+
+    explicit SurfaceImpl(bool fill = false) : ChartImpl(), m_fill(fill) {}
+
+    virtual QByteArray name() const { return "surface"; }
+};
+
+
+// ----------------------------------------------------------------
+//                 Objects within the chart
+
+
+class Obj
+{
+ public:
+    unsigned int m_mdTopLt;
+    unsigned int m_mdBotRt;
+    unsigned int m_x1;
+    unsigned int m_y1;
+    unsigned int m_x2;
+    unsigned int m_y2;
+    KoChart::AreaFormat *m_areaFormat;
+
+    explicit Obj()
+	: m_mdTopLt(0)
+	, m_mdBotRt(0)
+	, m_x1(0)
+	, m_y1(0)
+	, m_x2(0)
+	, m_y2(0)
+	, m_areaFormat(0)
+    {}
+    virtual ~Obj() { delete m_areaFormat; }
+};
+
+class Text : public Obj
+{
+ public:
+    QString m_text;
+
+    explicit Text(const QString &text = QString())
+	: Obj()
+	, m_text(text)
+    {}
+    virtual ~Text() {}
+};
+    
+class Axis : public Obj
+{
+ public:
+    enum Type {
+	HorizontalValueAxis = 0x0000,
+	VerticalValueAxis = 0x0001,
+	SeriesAxis = 0x0002
+    };
+    Type m_type;
+
+    class Gridline
+    {
+    public:
+	LineFormat m_format;
+	explicit Gridline(const LineFormat &format = LineFormat())
+	    : m_format(format)
+	{}
+    };
+
+    Gridline m_majorGridlines;
+    Gridline m_minorGridlines;
+
+    LineFormat m_format;
+
+    QString m_numberFormat;
+
+    bool m_reversed;
+    bool m_logarithmic;
+
+    bool m_autoMinimum;
+    bool m_autoMaximum;
+    qreal m_minimum;
+    qreal m_maximum;
+
+    explicit Axis(Type type)
+	: Obj()
+	, m_type(type)
+	, m_reversed(false)
+	, m_logarithmic(false)
+	, m_autoMinimum(true)
+	, m_autoMaximum(true)
+	, m_minimum(0)
+	, m_maximum(0)
+    {}
+    virtual ~Axis() {}
+};
+
+class Cell
+{
+ public:
+    int m_column;
+    int m_row;
+    QString m_value;
+    QString m_valueType;
+
+    Cell(int columnIndex, int rowIndex)
+	: m_column(columnIndex)
+	, m_row(rowIndex)
+	, m_valueType("string")
+    {}
+};
+
+
+/// cell data represetation of internal table
+class InternalTable
+{
+ public:
+    InternalTable()
+	: m_maxRow(0)
+	, m_maxColumn(0)
+    {}
+    ~InternalTable()
+    {
+	qDeleteAll(m_cells);
+    }
+
+    Cell* cell(int columnIndex, int rowIndex, bool autoCreate)
+    {
+	const uint maximumSpreadsheetColumns = 0x7FFF; // \
MSOOXML::maximumSpreadsheetColumns() +	const unsigned hashed = (rowIndex + 1) * \
maximumSpreadsheetColumns + columnIndex + 1; +
+	Cell* c = m_cells[hashed];
+	if (!c && autoCreate) {
+	    c = new Cell(columnIndex, rowIndex);
+	    m_cells[hashed] = c;
+
+	    if (rowIndex > m_maxRow)
+		m_maxRow = rowIndex;
+	    if (columnIndex > m_maxColumn)
+		m_maxColumn = columnIndex;
+	    if (!m_maxCellsInRow.contains(rowIndex) || columnIndex > \
m_maxCellsInRow[rowIndex]) +		m_maxCellsInRow[rowIndex] = columnIndex;
+	}
+
+	return c;
+    }
+
+    int maxCellsInRow(int rowIndex) const { return m_maxCellsInRow[rowIndex]; }
+    int maxRow() const { return m_maxRow; }
+    int maxColumn() const { return m_maxColumn; }
+
+ private:
+    int m_maxRow;
+    int m_maxColumn;
+    QHash<unsigned, Cell*> m_cells;
+    QHash<int, int> m_maxCellsInRow;
+};
+
+
+/// Different types of markers.
+enum MarkerType {
+    NoMarker,
+    AutoMarker,
+    SquareMarker,
+    DiamondMarker,
+    StarMarker,
+    DotMarker,
+    DashMarker,
+    PlusMarker,
+    CircleMarker,
+    SymbolXMarker,
+    TriangleMarker
+    // TODO fill the missing marker types in
+};
+
+class DataPoint : public Obj
+{
+ public:
+};
+
+class Series : public Obj
+{
+ public:
+    /// the type of data in categories, or horizontal values on bubble and
+    /// scatter chart groups, in the series. MUST be either 0x0001=numeric or
+    /// 0x0003=text.
+    int m_dataTypeX;
+
+    /// the count of categories (3), or horizontal values on bubble and
+    /// scatter chart groups, in the series.
+    int m_countXValues;
+
+    /// the count of values, or vertical values on bubble and scatter chart
+    /// groups, in the series.
+    int m_countYValues;
+
+    /// the count of bubble size values in the series.
+    int m_countBubbleSizeValues;
+
+    /// determines if the data values are shown in raw values as labels
+    bool m_showDataLabelValues;
+
+    /// determines if the data values are shown in percent as labels or not
+    bool m_showDataLabelPercent;
+
+    /// determines if the category data is shown as labels or not
+    bool m_showDataLabelCategory;
+
+    /// determines if the name of the series is shown as labels
+    bool m_showDataLabelSeries;
+
+    /// range that contains the values that should be visualized by the dataSeries.
+    QString m_valuesCellRangeAddress;
+
+    /// Ranges that contain the values that should be visualized by the dataSeries.
+    QStringList m_domainValuesCellRangeAddress;
+
+    /// The referenced values used in the chart
+    QMap<Value::DataId, Value*> m_datasetValue;
+
+    /// The data-points in the series.
+    QList<DataPoint*> m_dataPoints;
+
+    /// The formatting for the referenced values
+    QList<Format*> m_datasetFormat;
+
+    /// List of text records attached to the series.
+    QList<Text*> m_texts;
+
+    /// range that contains label
+    QString m_labelCell;
+
+    /// marker type
+    MarkerType m_markerType;
+    ShapeProperties* spPr;
+    QString m_numberFormat;
+
+    explicit Series()
+	: Obj()
+	, m_dataTypeX(0)
+	, m_countXValues(0)
+	, m_countYValues(0)
+	, m_countBubbleSizeValues(0)
+	, m_showDataLabelValues(false)
+	, m_showDataLabelPercent(false)
+	, m_showDataLabelCategory(false)
+	, m_showDataLabelSeries(false)
+	, m_markerType(NoMarker)
+	,spPr(0)
+    {}
+    virtual ~Series()
+    {
+	qDeleteAll(m_datasetValue);
+	qDeleteAll(m_dataPoints);
+	qDeleteAll(m_datasetFormat);
+
+	delete spPr;
+    }
+};
+
+class PlotArea : public Obj
+{
+ public:
+    explicit PlotArea()
+	: Obj()
+    {}
+    virtual ~PlotArea() {}
+};
+
+class Legend : public Obj
+{
+ public:
+    explicit Legend() : Obj() {}
+    virtual ~Legend() {}
+};
+
+/// The main charting class that represents a single chart.
+class Chart : public Obj
+{
+ public:
+    QString m_sheetName;
+        
+    /// If true then the chart is a 3d chart else the chart is 2d.
+    bool m_is3d;
+
+    /// Specifies a counter clockwise rotation of a polar coordinate in a
+    /// circle, ring or polar chart.
+    int m_angleOffset;
+
+    //int anRot, anElv, pcDist;
+
+    /// Margins around the chart object
+    int m_leftMargin;
+    int m_topMargin;
+    int m_rightMargin;
+    int m_bottomMargin;
+
+    /// List of series
+    QList<Series*> m_series;
+
+    /// List of text records attached to the chart.
+    QList<Text*> m_texts;
+
+    /// Range of all referenced cells.
+    QRect m_cellRangeAddress;
+
+    /// Range that contains the vertical values (the categories) for the plot-area.
+    QString m_verticalCellRangeAddress;
+
+    // The ChartTitle
+    QString m_title;
+
+    /// The more concrete chart implementation like e.g. a PieImpl for a pie chart.
+    ChartImpl *m_impl;
+
+    /// The plot-area.
+    PlotArea *m_plotArea;
+
+    /// The legend.
+    Legend *m_legend;
+
+    /// List of defined axes.
+    QList<Axis*> m_axes;
+
+    /// Whether the chart is vertical or not.
+    bool m_transpose;
+
+    /// Whether the chart is stacked or not.
+    bool m_stacked;
+
+    /// Whether the chart is percentage or not.
+    bool m_f100;
+
+    /// style for colors fills, line types, etc
+    int m_style;
+
+    Gradient* m_fillGradient;
+    Gradient* m_plotAreaFillGradient;
+    MarkerType m_markerType;
+    bool m_showLines;
+    qreal m_textSize;
+
+    // the chart's internal table
+    InternalTable m_internalTable;
+
+    explicit Chart()
+	: Obj()
+	, m_is3d(false)
+	, m_angleOffset(0)
+	, m_leftMargin(0)
+	, m_topMargin(0)
+	, m_rightMargin(0)
+	, m_bottomMargin(0)
+	, m_impl(0)
+	, m_plotArea(0)
+	, m_legend(0)
+	, m_transpose(false)
+	, m_stacked(false)
+	, m_f100(false)
+	, m_style(2)
+	, m_fillGradient(0)
+	, m_plotAreaFillGradient(0)
+	, m_markerType(NoMarker)
+	, m_showLines(false)
+	, m_textSize(10)
+    {
+	m_x1 = m_y1 = m_x2 = m_y2 = -1; // -1 means autoposition/autosize
+    }
+    virtual ~Chart()
+    {
+	qDeleteAll(m_series);
+	qDeleteAll(m_texts);
+	delete m_impl;
+	delete m_plotArea;
+	delete m_legend;
+	delete m_fillGradient;
+	delete m_plotAreaFillGradient;
+    }
+        
+    void addRange(const QRect& range)
+    {
+	if (range.isValid()) {
+	    if (m_cellRangeAddress.isValid()) {
+		if (range.left() < m_cellRangeAddress.left())
+		    m_cellRangeAddress.setLeft(range.left());
+		if (range.top() < m_cellRangeAddress.top())
+		    m_cellRangeAddress.setTop(range.top());
+		if (range.right() > m_cellRangeAddress.right())
+		    m_cellRangeAddress.setRight(range.right());
+		if (range.bottom() > m_cellRangeAddress.bottom())
+		    m_cellRangeAddress.setBottom(range.bottom());
+	    } else {
+		m_cellRangeAddress = range;
+	    }
+	}
+    }
+};
+
+} // namespace Charting
+
+#endif
diff --git a/filters/libodf2/chart/KoOdfChartWriter.cpp \
b/filters/libodf2/chart/KoOdfChartWriter.cpp new file mode 100644
index 0000000..9495a5f
--- /dev/null
+++ b/filters/libodf2/chart/KoOdfChartWriter.cpp
@@ -0,0 +1,1074 @@
+/*
+ *  Copyright (c) 2010 Sebastian Sauer <sebsauer@kdab.com>
+ *  Copyright (c) 2010 Carlos Licea <carlos@kdab.com>
+ *  Copyright (c) 2014 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 Lesser General Public License as published
+ *  by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+// Own
+#include "KoOdfChartWriter.h"
+
+// libstdc++
+#include <algorithm> // For std:find()
+
+// KDE
+#include <kdebug.h>
+
+// Calligra
+#include <KoStore.h>
+#include <KoXmlWriter.h>
+#include <KoOdfWriteStore.h>
+#include <KoStoreDevice.h>
+#include <KoGenStyles.h>
+#include <KoGenStyle.h>
+
+
+#include <Charting.h>
+#include "NumberFormatParser.h"
+
+
+// Print the content of generated content.xml to the console for debugging purpose
+//#define CONTENTXML_DEBUG
+
+using namespace KoChart;
+
+KoOdfChartWriter::KoOdfChartWriter(KoChart::Chart* chart)
+    : m_x(0)
+    , m_y(0)
+    , m_width(0)
+    , m_height(0)
+    , m_end_x(0)
+    , m_end_y(0)
+    , m_chart(chart)
+    , sheetReplacement(true)
+    , paletteIsSet(false)
+{
+    Q_ASSERT(m_chart);
+    m_drawLayer = false;
+}
+
+KoOdfChartWriter::~KoOdfChartWriter()
+{
+}
+
+
+// Takes a Excel cellrange and translates it into a ODF cellrange
+QString KoOdfChartWriter::normalizeCellRange(QString range)
+{
+    if (range.startsWith('[') && range.endsWith(']')) {
+        range.remove(0, 1).chop(1);
+    }
+    range.remove('$');
+
+    const bool isPoint = !range.contains( ':' );
+    QRegExp regEx(isPoint ? "(|.*\\.|.*\\!)([A-Z0-9]+)"
+		          : "(|.*\\.|.*\\!)([A-Z]+[0-9]+)\\:(|.*\\.|.*\\!)([A-Z0-9]+)");
+    if (regEx.indexIn(range) >= 0) {
+        range.clear();
+        QString sheetName = regEx.cap(1);
+        if (sheetName.endsWith(QLatin1Char('.')) || \
sheetName.endsWith(QLatin1Char('!'))) +            sheetName.chop(1);
+        if (!sheetName.isEmpty())
+            range = sheetName + '.';
+        range += regEx.cap(2);
+        if (!isPoint)
+            range += ':' + regEx.cap(4);
+    }
+
+    return range;
+}
+
+QColor KoOdfChartWriter::tintColor(const QColor & color, qreal tintfactor)
+{
+    QColor retColor;
+    const qreal  nonTindedPart = 1.0 - tintfactor;
+    qreal luminance = 0.0;
+    qreal sat = 0.0;
+    qreal hue = 0.0;
+    color.getHslF(&hue, &sat, &luminance);
+    luminance = luminance * tintfactor + nonTindedPart;
+    retColor.setHslF(hue, sat, luminance);
+//     const int tintedColor = 255 * nonTindedPart;
+//     retColor.setRed(tintedColor + tintfactor * color.red());
+//     retColor.setGreen(tintedColor + tintfactor * color.green());
+//     retColor.setBlue(tintedColor + tintfactor * color.blue());
+
+    return retColor;
+}
+
+QColor KoOdfChartWriter::calculateColorFromGradientStop(const \
KoChart::Gradient::GradientStop& grad) +{
+    QColor color = grad.knownColorValue;
+
+    const int tintedColor = 255 * grad.tintVal / 100.0;
+    const qreal  nonTindedPart = 1.0 - grad.tintVal / 100.0;
+    color.setRed(tintedColor + nonTindedPart * color.red());
+    color.setGreen(tintedColor + nonTindedPart * color.green());
+    color.setBlue(tintedColor + nonTindedPart * color.blue());
+
+    return color;
+}
+
+QString KoOdfChartWriter::generateGradientStyle(KoGenStyles& mainStyles,
+						const KoChart::Gradient* grad)
+{
+    KoGenStyle gradStyle(KoGenStyle::GradientStyle);
+    gradStyle.addAttribute("draw:style", "linear");
+
+    QColor startColor = calculateColorFromGradientStop(grad->gradientStops.first());
+    QColor endColor = calculateColorFromGradientStop(grad->gradientStops.last());
+    
+    gradStyle.addAttribute("draw:start-color", startColor.name());
+    gradStyle.addAttribute("draw:end-color", endColor.name());
+    gradStyle.addAttribute("draw:angle", QString::number(grad->angle));
+
+    return mainStyles.insert(gradStyle, "ms_chart_gradient");
+}
+
+QColor KoOdfChartWriter::labelFontColor() const
+{
+    return QColor();
+}
+
+QString KoOdfChartWriter::genChartAreaStyle(KoGenStyle& style, KoGenStyles& styles,
+					    KoGenStyles& mainStyles)
+{
+    if (chart()->m_fillGradient) {
+        style.addProperty("draw:fill", "gradient", KoGenStyle::GraphicType);
+        style.addProperty("draw:fill-gradient-name",
+			  generateGradientStyle(mainStyles, chart()->m_fillGradient),
+			  KoGenStyle::GraphicType);
+    } else {
+	style.addProperty("draw:fill", "solid", KoGenStyle::GraphicType);
+
+	QColor color;
+	if (chart()->m_areaFormat
+	    && chart()->m_areaFormat->m_fill
+	    && chart()->m_areaFormat->m_foreground.isValid())
+	{
+	    color = chart()->m_areaFormat->m_foreground;
+	}
+	else
+	    color = QColor("#FFFFFF");
+	style.addProperty("draw:fill-color", color.name(), KoGenStyle::GraphicType);
+
+	if (color.alpha() < 255)
+	    style.addProperty("draw:opacity",
+			      QString("%1%").arg(chart()->m_areaFormat->m_foreground.alphaF()
+						 * 100.0),
+			      KoGenStyle::GraphicType);
+    }
+
+    return styles.insert(style, "ch");
+}
+
+
+QString KoOdfChartWriter::genChartAreaStyle(KoGenStyles& styles, KoGenStyles& \
mainStyles) +{
+    KoGenStyle style(KoGenStyle::GraphicAutoStyle, "chart");
+
+    return genChartAreaStyle(style, styles, mainStyles);
+}
+
+
+QString KoOdfChartWriter::genPlotAreaStyle(KoGenStyle& style, KoGenStyles& styles,
+					   KoGenStyles& mainStyles)
+{
+    KoChart::AreaFormat *areaFormat = ((chart()->m_plotArea
+					&& chart()->m_plotArea->m_areaFormat
+					&& chart()->m_plotArea->m_areaFormat->m_fill)
+				       ? chart()->m_plotArea->m_areaFormat
+				       : chart()->m_areaFormat);
+    if (chart()->m_plotAreaFillGradient) {
+        style.addProperty("draw:fill", "gradient", KoGenStyle::GraphicType);
+        style.addProperty("draw:fill-gradient-name",
+			  generateGradientStyle(mainStyles, chart()->m_plotAreaFillGradient),
+			  KoGenStyle::GraphicType);
+    } else {
+        style.addProperty("draw:fill", "solid", KoGenStyle::GraphicType);
+
+	QColor color;
+	if (areaFormat && areaFormat->m_foreground.isValid())
+	    color = areaFormat->m_foreground;
+	else
+	    color = QColor(paletteIsSet ? "#C0C0C0" : "#FFFFFF");
+	style.addProperty("draw:fill-color", color.name(), KoGenStyle::GraphicType);
+
+	if (color.alpha() < 255)
+	    style.addProperty("draw:opacity",
+			      QString("%1%").arg(areaFormat->m_foreground.alphaF() * 100.0),
+			      KoGenStyle::GraphicType);
+    }
+
+    return styles.insert(style, "ch");
+}
+
+
+void KoOdfChartWriter::addShapePropertyStyle(/*const*/ KoChart::Series* series, \
KoGenStyle& style, +					     KoGenStyles& /*mainStyles*/)
+{
+    Q_ASSERT(series);
+    bool marker = false;
+    KoChart::ScatterImpl* impl = dynamic_cast< KoChart::ScatterImpl* \
>(m_chart->m_impl); +
+    if (impl)
+        marker = (impl->style == KoChart::ScatterImpl::Marker 
+		  || impl->style == KoChart::ScatterImpl::LineMarker);
+
+    if (series->spPr->lineFill.valid) {
+        if (series->spPr->lineFill.type == KoChart::Fill::Solid) {
+            style.addProperty("draw:stroke", "solid", KoGenStyle::GraphicType);
+            style.addProperty("svg:stroke-color", \
series->spPr->lineFill.solidColor.name(), +			      KoGenStyle::GraphicType);
+        }
+        else if (series->spPr->lineFill.type == KoChart::Fill::None) {
+            style.addProperty("draw:stroke", "none", KoGenStyle::GraphicType);
+	}
+    }
+    else if (  (paletteIsSet && m_chart->m_impl->name() != "scatter")
+             || m_chart->m_showLines)
+    {
+        const int curSerNum = m_chart->m_series.indexOf(series);
+        style.addProperty("draw:stroke", "solid", KoGenStyle::GraphicType);
+        style.addProperty("svg:stroke-color", m_palette.at(24 + curSerNum).name(),
+			  KoGenStyle::GraphicType);
+    }
+    else if (paletteIsSet && m_chart->m_impl->name() == "scatter")
+        style.addProperty("draw:stroke", "none", KoGenStyle::GraphicType);
+    if (series->spPr->areaFill.valid) {
+        if (series->spPr->areaFill.type == KoChart::Fill::Solid) {
+            style.addProperty("draw:fill", "solid", KoGenStyle::GraphicType);
+            style.addProperty("draw:fill-color", \
series->spPr->areaFill.solidColor.name(), +			      KoGenStyle::GraphicType);
+        }
+        else if (series->spPr->areaFill.type == KoChart::Fill::None)
+            style.addProperty("draw:fill", "none", KoGenStyle::GraphicType);
+    }
+    else if (paletteIsSet
+	     && !(m_chart->m_markerType != KoChart::NoMarker || marker)
+	     && series->m_markerType == KoChart::NoMarker)
+    {
+        const int curSerNum = m_chart->m_series.indexOf(series) % 8;
+        style.addProperty("draw:fill", "solid", KoGenStyle::GraphicType);
+        style.addProperty("draw:fill-color", m_palette.at(16 + curSerNum).name(),
+			  KoGenStyle::GraphicType);
+    }
+}
+
+QString KoOdfChartWriter::genPlotAreaStyle(KoGenStyles& styles, KoGenStyles& \
mainStyles) +{
+    KoGenStyle style(KoGenStyle::ChartAutoStyle/*, "chart"*/);
+    return genPlotAreaStyle(style, styles, mainStyles);
+}
+
+QString KoOdfChartWriter::replaceSheet(const QString &originalString,
+				       const QString &replacementSheet)
+{
+    QStringList split = originalString.split(QLatin1Char('!'));
+    split[0] = replacementSheet;
+    return split.join(QString::fromLatin1("!"));
+}
+
+void KoOdfChartWriter::set2003ColorPalette(QList < QColor > palette)
+{
+    m_palette = palette;
+    paletteIsSet = true;
+}
+
+QString KoOdfChartWriter::markerType(KoChart::MarkerType type, int \
currentSeriesNumber) +{
+    QString markerName;
+    switch(type) {
+        case NoMarker:
+            break;
+        case AutoMarker: { // auto marker type
+            const int resNum = currentSeriesNumber % 3;
+            if (resNum == 0)
+                markerName = "square";
+            else if (resNum == 1)
+                markerName = "diamond";
+            else if (resNum == 2)
+                markerName = "circle";
+        } break;
+        case SquareMarker:
+            markerName = "square";
+            break;
+        case DiamondMarker:
+            markerName = "diamond";
+            break;
+        case StarMarker:
+            markerName = "star";
+            break;
+        case TriangleMarker:
+            markerName = "arrow-up";
+            break;
+        case DotMarker:
+            markerName = "dot";
+            break;
+        case PlusMarker:
+            markerName = "plus";
+            break;
+        case SymbolXMarker:
+            markerName = "x";
+            break;
+        case CircleMarker:
+            markerName = "circle";
+            break;
+        case DashMarker:
+            markerName = "horizontal-bar";
+            break;
+    }
+
+    return markerName;
+}
+
+
+// ----------------------------------------------------------------
+//                 The actual saving code
+
+
+bool KoOdfChartWriter::saveIndex(KoXmlWriter* xmlWriter)
+{
+    if (!chart() || m_href.isEmpty())
+        return false;
+
+    // This because for presesentations the frame is done in read_graphicFrame
+    if (!m_drawLayer) {
+        xmlWriter->startElement("draw:frame");
+        // used in opendocumentpresentation for layers
+        //if (m_drawLayer)
+        //    xmlWriter->addAttribute("draw:layer", "layout");
+
+        // used in opendocumentspreadsheet to reference cells
+        if (!m_endCellAddress.isEmpty()) {
+            xmlWriter->addAttribute("table:end-cell-address", m_endCellAddress);
+            xmlWriter->addAttributePt("table:end-x", m_end_x);
+            xmlWriter->addAttributePt("table:end-y", m_end_y);
+        }
+
+        xmlWriter->addAttributePt("svg:x", m_x);
+        xmlWriter->addAttributePt("svg:y", m_y);
+        if (m_width > 0)
+            xmlWriter->addAttributePt("svg:width", m_width);
+        if (m_height > 0)
+            xmlWriter->addAttributePt("svg:height", m_height);
+    }
+    //xmlWriter->addAttribute("draw:z-index", "0");
+    xmlWriter->startElement("draw:object");
+    //TODO don't show on e.g. presenter
+    if (!m_notifyOnUpdateOfRanges.isEmpty())
+        xmlWriter->addAttribute("draw:notify-on-update-of-ranges", \
m_notifyOnUpdateOfRanges); +
+    xmlWriter->addAttribute("xlink:href", "./" + m_href);
+    xmlWriter->addAttribute("xlink:type", "simple");
+    xmlWriter->addAttribute("xlink:show", "embed");
+    xmlWriter->addAttribute("xlink:actuate", "onLoad");
+
+    xmlWriter->endElement(); // draw:object
+    if (!m_drawLayer) {
+        xmlWriter->endElement(); // draw:frame
+    }
+    return true;
+}
+
+bool KoOdfChartWriter::saveContent(KoStore* store, KoXmlWriter* manifestWriter)
+{
+    if (!chart() || !chart()->m_impl || m_href.isEmpty())
+        return false;
+    
+    KoGenStyles styles;
+    KoGenStyles mainStyles;
+
+    store->pushDirectory();
+    store->enterDirectory(m_href);
+
+    KoOdfWriteStore s(store);
+    KoXmlWriter* bodyWriter = s.bodyWriter();
+    KoXmlWriter* contentWriter = s.contentWriter();
+    Q_ASSERT(bodyWriter && contentWriter);
+
+    bodyWriter->startElement("office:body");
+    bodyWriter->startElement("office:chart");
+
+    //<chart:chart chart:class="chart:circle"
+    //             svg:width="8cm" svg:height="7cm"
+    //             chart:style-name="ch1">
+    bodyWriter->startElement("chart:chart");
+
+    if (!chart()->m_impl->name().isEmpty()) {
+        bodyWriter->addAttribute("chart:class", "chart:" + chart()->m_impl->name());
+    }
+
+    if (m_width > 0) {
+        bodyWriter->addAttributePt("svg:width", m_width);
+    }
+    if (m_height > 0) {
+        bodyWriter->addAttributePt("svg:height", m_height);
+    }
+    
+    bodyWriter->addAttribute("chart:style-name", genChartAreaStyle(styles, \
mainStyles)); +
+    // <chart:title svg:x="5.618cm" svg:y="0.14cm" chart:style-name="ch2">
+    //     <text:p>PIE CHART</text:p>
+    // </chart:title>
+    if (!chart()->m_title.isEmpty()) {
+        bodyWriter->startElement("chart:title");
+
+        /* TODO we can't determine this because by default we need to center the \
title, +        in order to center it we need to know the textbox size, and to do \
that we need +        the used font metrics.
+
+        Also, for now, the default implementation of KChart centers
+        the title, so we get close to the expected behavior. We ignore any offset \
though. +
+        Nonetheless, the formula should be something like this:
+        const int widht = m_width/2 - textWidth/2 + sprcToPt(t->m_x1, vertical);
+        const int height = m_height/2 - textHeight/2 + sprcToPt(t->m_y1, \
horizontal); +        bodyWriter->addAttributePt("svg:x", width);
+        bodyWriter->addAttributePt("svg:y", height);
+        */
+
+        // NOTE: Don't load width or height, the record MUST be ignored and
+        //       determined by the application
+        // see [MS-XLS] p. 362
+
+        bodyWriter->startElement("text:p");
+        bodyWriter->addTextNode(chart()->m_title);
+        bodyWriter->endElement(); // text:p
+        bodyWriter->endElement(); // chart:title
+    }
+
+    // Legend
+    if (chart()->m_legend) {
+        bodyWriter->startElement("chart:legend");
+        bodyWriter->addAttribute("chart:legend-position", "end");
+
+        KoGenStyle legendstyle(KoGenStyle::ChartAutoStyle, "chart");
+
+        QColor labelColor = labelFontColor();
+        if (labelColor.isValid())
+            legendstyle.addProperty("fo:font-color", labelColor.name(), \
KoGenStyle::TextType); +
+        bodyWriter->addAttribute("chart:style-name", styles.insert(legendstyle, \
"lg")); +
+        bodyWriter->endElement(); // chart:legend
+    }
+
+    // <chart:plot-area chart:style-name="ch3"
+    //                  table:cell-range-address="Sheet1.C2:Sheet1.E2"
+    //                  svg:x="0.16cm" svg:y="0.14cm">
+    bodyWriter->startElement("chart:plot-area");
+
+    if (chart()->m_is3d) {
+        //bodyWriter->addAttribute("dr3d:transform", "matrix (0.893670830886674 \
0.102940425033731 -0.436755898547686 -0.437131441492021 0.419523087196176 \
-0.795560483036015 0.101333848646097 0.901888933407692 0.419914042293545 0cm 0cm \
0cm)"); +        //bodyWriter->addAttribute("dr3d:vrp", "(12684.722548717 \
7388.35827488833 17691.2795565958)"); +        //bodyWriter->addAttribute("dr3d:vpn", \
"(0.416199821709347 0.173649045905254 0.892537795986984)"); +        \
//bodyWriter->addAttribute("dr3d:vup", "(-0.0733876362771618 0.984807599917971 \
-0.157379306090273)"); +        //bodyWriter->addAttribute("dr3d:projection", \
"parallel"); +        //bodyWriter->addAttribute("dr3d:distance", "4.2cm");
+        //bodyWriter->addAttribute("dr3d:focal-length", "8cm");
+        //bodyWriter->addAttribute("dr3d:shadow-slant", "0");
+        //bodyWriter->addAttribute("dr3d:shade-mode", "flat");
+        //bodyWriter->addAttribute("dr3d:ambient-color", "#b3b3b3");
+        //bodyWriter->addAttribute("dr3d:lighting-mode", "true");
+    }
+
+    KoGenStyle chartstyle(KoGenStyle::ChartAutoStyle, "chart");
+    //chartstyle.addProperty("chart:connect-bars", "false");
+    //chartstyle.addProperty("chart:include-hidden-cells", "false");
+    chartstyle.addProperty("chart:auto-position", "true");
+    chartstyle.addProperty("chart:auto-size", "true");
+    chartstyle.addProperty("chart:angle-offset", chart()->m_angleOffset);
+
+    //chartstyle.addProperty("chart:series-source", "rows");
+    //chartstyle.addProperty("chart:sort-by-x-values", "false");
+    //chartstyle.addProperty("chart:right-angled-axes", "true");
+    if (chart()->m_is3d) {
+        chartstyle.addProperty("chart:three-dimensional", "true");
+    }
+    //chartstyle.addProperty("chart:angle-offset", "90");
+    //chartstyle.addProperty("chart:series-source", "rows");
+    //chartstyle.addProperty("chart:right-angled-axes", "false");
+    if (chart()->m_transpose) {
+        chartstyle.addProperty("chart:vertical", "true");
+    }
+    if (chart()->m_stacked) {
+        chartstyle.addProperty("chart:stacked", "true");
+    }
+    if (chart()->m_f100) {
+        chartstyle.addProperty("chart:percentage", "true");
+    }
+    bodyWriter->addAttribute("chart:style-name", genPlotAreaStyle(chartstyle, \
styles, mainStyles)); +
+    QString verticalCellRangeAddress = chart()->m_verticalCellRangeAddress;
+// FIXME microsoft treats the regions from this area in a different order, so don't \
use it or x and y values will be switched +//     if \
(!chart()->m_cellRangeAddress.isEmpty()) { +//         if (sheetReplacement)
+//             bodyWriter->addAttribute("table:cell-range-address", \
replaceSheet(normalizeCellRange(m_cellRangeAddress), QString::fromLatin1("local"))); \
//"Sheet1.C2:Sheet1.E5"); +//         else
+//             bodyWriter->addAttribute("table:cell-range-address", \
normalizeCellRange(m_cellRangeAddress)); //"Sheet1.C2:Sheet1.E5"); +//     }
+
+    /*FIXME
+    if (verticalCellRangeAddress.isEmpty()) {
+        // only add the chart:data-source-has-labels if no chart:categories with a \
table:cell-range-address was defined within an axis. +        \
bodyWriter->addAttribute("chart:data-source-has-labels", "both"); +    }
+    */
+
+    //bodyWriter->addAttribute("svg:x", "0.16cm"); //FIXME
+    //bodyWriter->addAttribute("svg:y", "0.14cm"); //FIXME
+    //bodyWriter->addAttribute("svg:width", "6.712cm"); //FIXME
+    //bodyWriter->addAttribute("svg:height", "6.58cm"); //FIXME
+
+    const bool definesCategories = chart()->m_impl->name() != "scatter"; // scatter \
charts are using domains +    int countXAxis = 0;
+    int countYAxis = 0;
+    foreach (KoChart::Axis* axis, chart()->m_axes) {
+        //TODO handle series-axis
+        if (axis->m_type == KoChart::Axis::SeriesAxis) continue;
+
+        bodyWriter->startElement("chart:axis");
+
+        KoGenStyle axisstyle(KoGenStyle::ChartAutoStyle, "chart");
+
+        if (axis->m_reversed)
+            axisstyle.addProperty("chart:reverse-direction", "true", \
KoGenStyle::ChartType); +
+        //FIXME this hits an infinite-looping bug in kdchart it seems... maybe fixed \
with a newer version +//         if (axis->m_logarithmic)
+//             axisstyle.addProperty("chart:logarithmic", "true", \
KoGenStyle::ChartType); +
+        if (!axis->m_autoMinimum)
+            axisstyle.addProperty("chart:minimum", QString::number(axis->m_minimum, \
'f'), +				  KoGenStyle::ChartType);
+        if (!axis->m_autoMaximum)
+            axisstyle.addProperty("chart:maximum", QString::number(axis->m_maximum, \
'f'), +				  KoGenStyle::ChartType);
+
+        axisstyle.addProperty("fo:font-size", \
QString("%0pt").arg(chart()->m_textSize), +			      KoGenStyle::TextType);
+
+        QColor labelColor = labelFontColor();
+        if (labelColor.isValid())
+            axisstyle.addProperty("fo:font-color", labelColor.name(), \
KoGenStyle::TextType); +
+        if (!axis->m_numberFormat.isEmpty()) {
+            const KoGenStyle style = NumberFormatParser::parse(axis->m_numberFormat, \
&styles); +            axisstyle.addAttribute("style:data-style-name", \
styles.insert(style, "ds")); +        }
+
+        bodyWriter->addAttribute("chart:style-name", styles.insert(axisstyle, \
"ch")); +
+        switch(axis->m_type) {
+            case KoChart::Axis::VerticalValueAxis:
+                bodyWriter->addAttribute("chart:dimension", "y");
+                bodyWriter->addAttribute("chart:name", \
QString("y%1").arg(++countYAxis)); +                break;
+            case KoChart::Axis::HorizontalValueAxis:
+                bodyWriter->addAttribute("chart:dimension", "x");
+                bodyWriter->addAttribute("chart:name", \
QString("x%1").arg(++countXAxis)); +                if (countXAxis == 1 && \
definesCategories && !verticalCellRangeAddress.isEmpty()) { +                    \
bodyWriter->startElement("chart:categories"); +                    if \
(sheetReplacement) +                        verticalCellRangeAddress
+			    = normalizeCellRange(replaceSheet(verticalCellRangeAddress,
+							      QString::fromLatin1("local")));
+                    else
+                        verticalCellRangeAddress = \
normalizeCellRange(verticalCellRangeAddress); +                    \
bodyWriter->addAttribute("table:cell-range-address", verticalCellRangeAddress); \
//"Sheet1.C2:Sheet1.E2"); +                    bodyWriter->endElement();
+                }
+                break;
+            default: break;
+        }
+
+        if (axis->m_majorGridlines.m_format.m_style != KoChart::LineFormat::None) {
+            bodyWriter->startElement("chart:grid");
+            bodyWriter->addAttribute("chart:class", "major");
+            bodyWriter->endElement(); // chart:grid
+        }
+
+        if (axis->m_minorGridlines.m_format.m_style != KoChart::LineFormat::None) {
+            bodyWriter->startElement("chart:grid");
+            bodyWriter->addAttribute("chart:class", "minor");
+            bodyWriter->endElement(); // chart:grid
+        }
+        bodyWriter->endElement(); // chart:axis
+    }
+
+    // Add at least one x-axis.
+    if (countXAxis == 0) {
+        bodyWriter->startElement("chart:axis");
+        bodyWriter->addAttribute("chart:dimension", "x");
+        bodyWriter->addAttribute("chart:name", "primary-x");
+
+        if (definesCategories && !verticalCellRangeAddress.isEmpty()) {
+            bodyWriter->startElement("chart:categories");
+            if (sheetReplacement)
+                verticalCellRangeAddress
+		    = normalizeCellRange(replaceSheet(verticalCellRangeAddress,
+						      QString::fromLatin1("local")));
+            else
+                verticalCellRangeAddress = \
normalizeCellRange(verticalCellRangeAddress); +
+            bodyWriter->addAttribute("table:cell-range-address", \
verticalCellRangeAddress); +            bodyWriter->endElement();
+        }
+
+        bodyWriter->endElement(); // chart:axis
+    }
+
+    // Add at least one y-axis.
+    if (countYAxis == 0) {
+        bodyWriter->startElement("chart:axis");
+        bodyWriter->addAttribute("chart:dimension", "y");
+        bodyWriter->addAttribute("chart:name", "primary-y");
+        bodyWriter->endElement(); // chart:axis
+    }
+
+    //<chart:axis chart:dimension="x" chart:name="primary-x" \
chart:style-name="ch4"/> +    //<chart:axis chart:dimension="y" \
chart:name="primary-y" chart:style-name="ch5"><chart:grid chart:style-name="ch6" \
chart:class="major"/></chart:axis> +
+    // NOTE: The XLS format specifies that if an explodeFactor that is > 100
+    //       is found, we should find the biggest and make it 100, then scale
+    //       all the other factors accordingly.
+    // see 2.4.195 PieFormat
+    int maxExplode = 100;
+    foreach (KoChart::Series* series, chart()->m_series) {
+        foreach (KoChart::Format* f, series->m_datasetFormat) {
+            if (KoChart::PieFormat* pieformat = \
dynamic_cast<KoChart::PieFormat*>(f)) { +                if (pieformat->m_pcExplode > \
0) { +                    maxExplode = qMax(maxExplode, pieformat->m_pcExplode);
+                }
+            }
+        }
+    }
+
+    // Area diagrams are special in that Excel displays the areas in another
+    // order than OpenOffice.org and KSpread. To make sure the same areas are
+    // visible we do the same as OpenOffice.org does and reverse the order.
+    if (chart()->m_impl->name() == "area") {
+        for (int i = chart()->m_series.count() - 1; i >= 0; --i) {
+            chart()->m_series.append(chart()->m_series.takeAt(i));
+        }
+    }
+
+    // Save the series.
+    if (!saveSeries(styles, mainStyles, bodyWriter, maxExplode))
+	return false;
+
+    bodyWriter->startElement("chart:wall");
+    bodyWriter->endElement(); // chart:wall
+
+    bodyWriter->startElement("chart:floor");
+    bodyWriter->endElement(); // chart:floor
+
+    bodyWriter->endElement(); // chart:plot-area
+
+    writeInternalTable(bodyWriter);
+
+    bodyWriter->endElement(); // chart:chart
+    bodyWriter->endElement(); // office:chart
+    bodyWriter->endElement(); // office:body
+
+#ifdef CONTENTXML_DEBUG
+    qDebug() << bodyWriter->toString();
+#endif
+
+    styles.saveOdfStyles(KoGenStyles::DocumentAutomaticStyles, contentWriter);
+    s.closeContentWriter();
+
+    if (store->open("styles.xml")) {
+        KoStoreDevice dev(store);
+        KoXmlWriter* stylesWriter = new KoXmlWriter(&dev);
+
+        stylesWriter->startDocument("office:document-styles");
+        stylesWriter->startElement("office:document-styles");
+        stylesWriter->addAttribute("xmlns:office", \
"urn:oasis:names:tc:opendocument:xmlns:office:1.0"); +        \
stylesWriter->addAttribute("xmlns:style", \
"urn:oasis:names:tc:opendocument:xmlns:style:1.0"); +        \
stylesWriter->addAttribute("xmlns:text", \
"urn:oasis:names:tc:opendocument:xmlns:text:1.0"); +        \
stylesWriter->addAttribute("xmlns:table", \
"urn:oasis:names:tc:opendocument:xmlns:table:1.0"); +        \
stylesWriter->addAttribute("xmlns:draw", \
"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"); +        \
stylesWriter->addAttribute("xmlns:fo", \
"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"); +        \
stylesWriter->addAttribute("xmlns:svg", \
"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"); +        \
stylesWriter->addAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink"); +        \
stylesWriter->addAttribute("xmlns:chart", \
"urn:oasis:names:tc:opendocument:xmlns:chart:1.0"); +        \
stylesWriter->addAttribute("xmlns:dc", "http://purl.org/dc/elements/1.1/"); +        \
stylesWriter->addAttribute("xmlns:meta", \
"urn:oasis:names:tc:opendocument:xmlns:meta:1.0"); +        \
stylesWriter->addAttribute("xmlns:number", \
"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"); +        \
stylesWriter->addAttribute("xmlns:dr3d", \
"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"); +        \
stylesWriter->addAttribute("xmlns:math", "http://www.w3.org/1998/Math/MathML"); +     \
stylesWriter->addAttribute("xmlns:of", \
"urn:oasis:names:tc:opendocument:xmlns:of:1.2"); +        \
stylesWriter->addAttribute("office:version", "1.2"); +        \
mainStyles.saveOdfStyles(KoGenStyles::MasterStyles, stylesWriter); +        \
mainStyles.saveOdfStyles(KoGenStyles::DocumentStyles, stylesWriter); // office:style \
+        mainStyles.saveOdfStyles(KoGenStyles::DocumentAutomaticStyles, \
stylesWriter); // office:automatic-styles +        stylesWriter->endElement();  // \
office:document-styles +        stylesWriter->endDocument();
+
+        delete stylesWriter;
+        store->close();
+    }
+
+    manifestWriter->addManifestEntry(m_href + "/", \
"application/vnd.oasis.opendocument.chart"); +    \
manifestWriter->addManifestEntry(QString("%1/styles.xml").arg(m_href), "text/xml"); + \
manifestWriter->addManifestEntry(QString("%1/content.xml").arg(m_href), "text/xml"); \
+ +    store->popDirectory();
+    return true;
+}
+
+// FIXME: We should probably create a KoOdfChartWriterContext out of these
+//        parameters when we add more similar saving functions later.
+bool KoOdfChartWriter::saveSeries(KoGenStyles &styles, KoGenStyles &mainStyles,
+				  KoXmlWriter* bodyWriter, int maxExplode)
+{
+    int curSerNum = 0;
+    bool lines = true;
+    bool marker = false;
+    Q_FOREACH (KoChart::Series* series, chart()->m_series) {
+        lines = true;
+        if (chart()->m_impl->name() == "scatter" && !paletteIsSet) {
+            KoChart::ScatterImpl* impl = static_cast< KoChart::ScatterImpl* \
>(chart()->m_impl); +            lines = (impl->style == KoChart::ScatterImpl::Line
+		     || impl->style == KoChart::ScatterImpl::LineMarker);
+            marker = (impl->style == KoChart::ScatterImpl::Marker
+		      || impl->style == KoChart::ScatterImpl::LineMarker);
+        }
+        const bool noLineFill = ((series->spPr != 0)
+				 && series->spPr->lineFill.type == KoChart::Fill::None);
+        lines = lines && !noLineFill;
+        lines = lines || m_chart->m_showLines;
+        
+	// <chart:series chart:style-name="ch7"
+	//               chart:values-cell-range-address="Sheet1.C2:Sheet1.E2"
+	//               chart:class="chart:circle">
+        bodyWriter->startElement("chart:series");
+        KoGenStyle seriesstyle(KoGenStyle::GraphicAutoStyle, "chart");
+        if (series->spPr)
+            addShapePropertyStyle(series, seriesstyle, mainStyles);
+        else if (lines && paletteIsSet) {
+            lines = false;
+            seriesstyle.addProperty("draw:stroke", "solid", \
KoGenStyle::GraphicType);       +            \
seriesstyle.addProperty("svg:stroke-color", m_palette.at(24 + curSerNum).name(), \
+				    KoGenStyle::GraphicType); +        }
+
+        if (paletteIsSet
+	    && m_chart->m_impl->name() != "ring"
+	    && m_chart->m_impl->name() != "circle")
+	{
+            if (series->m_markerType == KoChart::NoMarker
+		&& m_chart->m_markerType == KoChart::NoMarker
+		&& !marker)
+            {
+		seriesstyle.addProperty("draw:fill", "solid", KoGenStyle::GraphicType);
+		seriesstyle.addProperty("draw:fill-color", m_palette.at(16 + curSerNum).name(),
+					KoGenStyle::GraphicType);
+            }
+        }
+
+        if (series->m_markerType != KoChart::NoMarker) {
+            QString markerName = markerType(series->m_markerType, curSerNum);
+            if (!markerName.isEmpty()) {
+                seriesstyle.addProperty("chart:symbol-type", "named-symbol", \
KoGenStyle::ChartType); +                seriesstyle.addProperty("chart:symbol-name", \
markerName, KoGenStyle::ChartType); +            }
+        }
+        else if (m_chart->m_markerType != KoChart::NoMarker || marker) {
+            QString markerName = markerType(m_chart->m_markerType == \
KoChart::NoMarker +					    ? KoChart::AutoMarker
+					    : m_chart->m_markerType, curSerNum);
+            if (!markerName.isEmpty()) {
+                seriesstyle.addProperty("chart:symbol-type", "named-symbol", \
KoGenStyle::ChartType); +                seriesstyle.addProperty("chart:symbol-name", \
markerName, KoGenStyle::ChartType); +            }
+        }
+
+        if (chart()->m_impl->name() != "circle" && chart()->m_impl->name() != \
"ring") +            addDataThemeToStyle(seriesstyle, curSerNum, \
chart()->m_series.count(), lines); +        //seriesstyle.addProperty("draw:stroke", \
"solid"); +        //seriesstyle.addProperty("draw:fill-color", "#ff0000");
+
+        foreach (KoChart::Format* f, series->m_datasetFormat) {
+            if (KoChart::PieFormat* pieformat = \
dynamic_cast<KoChart::PieFormat*>(f)) { +                if (pieformat->m_pcExplode > \
0) { +                    // Note that 100.0/maxExplode will yield 1.0 most of the
+                    // time, that's why do that division first
+                    const int pcExplode = (int)((float)pieformat->m_pcExplode * \
(100.0 / (float)maxExplode)); +                    \
seriesstyle.addProperty("chart:pie-offset", pcExplode, KoGenStyle::ChartType); +      \
} +            }
+        }
+
+        if (series->m_showDataLabelValues && series->m_showDataLabelPercent) {
+            seriesstyle.addProperty("chart:data-label-number", \
"value-and-percentage", +				    KoGenStyle::ChartType);
+        } else if (series->m_showDataLabelValues) {
+            seriesstyle.addProperty("chart:data-label-number", "value", \
KoGenStyle::ChartType); +        } else if (series->m_showDataLabelPercent) {
+            seriesstyle.addProperty("chart:data-label-number", "percentage", \
KoGenStyle::ChartType); +        }
+
+        if (series->m_showDataLabelCategory) {
+            seriesstyle.addProperty("chart:data-label-text", "true", \
KoGenStyle::ChartType); +        }
+        //seriesstyle.addProperty("chart:data-label-symbol", "true", \
KoGenStyle::ChartType); +
+        if (!series->m_numberFormat.isEmpty()) {
+            const KoGenStyle style = \
NumberFormatParser::parse(series->m_numberFormat, &styles); +            \
seriesstyle.addAttribute("style:data-style-name", styles.insert(style, "ds")); +      \
} +
+        bodyWriter->addAttribute("chart:style-name", styles.insert(seriesstyle, \
"ch")); +
+        // ODF does not support custom labels so we depend on the
+        // SeriesLegendOrTrendlineName being defined and to point to a valid
+        // cell to be able to display custom labels.
+        if (series->m_datasetValue.contains(KoChart::Value::SeriesLegendOrTrendlineName)) \
{ +            KoChart::Value* v = \
series->m_datasetValue[KoChart::Value::SeriesLegendOrTrendlineName]; +            if \
(!v->m_formula.isEmpty()) { +                \
bodyWriter->addAttribute("chart:label-cell-address", +					 (v->m_type == \
KoChart::Value::CellRange +					  ? normalizeCellRange(v->m_formula)
+					  : v->m_formula));
+            }
+        }
+
+        if (!series->m_labelCell.isEmpty()) {
+            QString labelAddress = series->m_labelCell;
+            if (sheetReplacement)
+                labelAddress = normalizeCellRange(replaceSheet(labelAddress,
+							       QString::fromLatin1("local")));
+            else
+                labelAddress = normalizeCellRange(labelAddress);
+            bodyWriter->addAttribute("chart:label-cell-address", labelAddress);
+        }
+
+        QString valuesCellRangeAddress;
+        if (sheetReplacement)
+            valuesCellRangeAddress
+		= normalizeCellRange(replaceSheet(series->m_valuesCellRangeAddress,
+						  QString::fromLatin1("local")));
+        else
+            valuesCellRangeAddress = \
normalizeCellRange(series->m_valuesCellRangeAddress); +        
+        if (!valuesCellRangeAddress.isEmpty()) {
+	    // "Sheet1.C2:Sheet1.E2";
+            bodyWriter->addAttribute("chart:values-cell-range-address", \
valuesCellRangeAddress); +        }
+        else if (!series->m_domainValuesCellRangeAddress.isEmpty()) {
+	    // "Sheet1.C2:Sheet1.E2";
+            bodyWriter->addAttribute("chart:values-cell-range-address",
+				     series->m_domainValuesCellRangeAddress.last());
+        }
+
+        bodyWriter->addAttribute("chart:class", "chart:" + chart()->m_impl->name());
+
+//         if (chart()->m_impl->name() == "scatter") {
+//             bodyWriter->startElement("chart:domain");
+//             bodyWriter->addAttribute("table:cell-range-address", \
verticalCellRangeAddress); //"Sheet1.C2:Sheet1.E5"); +//             \
bodyWriter->endElement(); +//         } else if (chart()->m_impl->name() == "bubble") \
{ +
+            QString domainRange;
+            Q_FOREACH (const QString& curRange, \
series->m_domainValuesCellRangeAddress) { +                \
bodyWriter->startElement("chart:domain"); +                if (sheetReplacement)
+                    domainRange = normalizeCellRange(replaceSheet(curRange, \
QString::fromLatin1("local"))); +                else
+                    domainRange = normalizeCellRange(curRange);
+                if (!domainRange.isEmpty())
+                    bodyWriter->addAttribute("table:cell-range-address", \
domainRange); +                bodyWriter->endElement();
+            }
+//             if (series->m_domainValuesCellRangeAddress.count() == 1){
+//                 bodyWriter->startElement("chart:domain");
+//                 bodyWriter->addAttribute("table:cell-range-address", \
series->m_domainValuesCellRangeAddress.last()); //"Sheet1.C2:Sheet1.E5"); +//         \
bodyWriter->endElement(); +//             }
+//             if (series->m_domainValuesCellRangeAddress.isEmpty()){
+//                 bodyWriter->startElement("chart:domain");
+//                 bodyWriter->addAttribute("table:cell-range-address", \
series->m_valuesCellRangeAddress); //"Sheet1.C2:Sheet1.E5"); +//                 \
bodyWriter->endElement(); +//                 \
bodyWriter->startElement("chart:domain"); +//                 \
bodyWriter->addAttribute("table:cell-range-address", \
series->m_valuesCellRangeAddress); //"Sheet1.C2:Sheet1.E5"); +//                 \
bodyWriter->endElement(); +//             }
+//         }
+
+        for (int j = 0; j < series->m_countYValues; ++j) {
+            bodyWriter->startElement("chart:data-point");
+            KoGenStyle gs(KoGenStyle::GraphicAutoStyle, "chart");
+
+            if (chart()->m_impl->name() == "circle" || chart()->m_impl->name() == \
"ring") { +                QColor fillColor;
+                if (j < series->m_dataPoints.count()) {
+                    KoChart::DataPoint *dataPoint = series->m_dataPoints[j];
+                    if (dataPoint->m_areaFormat) {
+                        fillColor = dataPoint->m_areaFormat->m_foreground;
+                    }
+                }
+
+                if (fillColor.isValid()) {
+                    gs.addProperty("draw:fill", "solid", KoGenStyle::GraphicType);
+                    gs.addProperty("draw:fill-color", fillColor.name(), \
KoGenStyle::GraphicType); +                }
+                else if (series->m_markerType == KoChart::NoMarker
+			 && m_chart->m_markerType == KoChart::NoMarker
+			 && !marker)
+		{
+                    if (paletteIsSet) {
+                        gs.addProperty("draw:fill", "solid", \
KoGenStyle::GraphicType); +                        gs.addProperty("draw:fill-color", \
m_palette.at(16 + j).name(), +				       KoGenStyle::GraphicType);
+                    }
+                    else {
+                        addDataThemeToStyle(gs, j, series->m_countYValues, lines);
+                    }
+                }
+            }/*
+            else
+            {
+                addSeriesThemeToStyle(gs, curSerNum, chart()->m_series.count());
+            }*/
+
+            //gs.addProperty("chart:solid-type", "cuboid", KoGenStyle::ChartType);
+            //gs.addProperty("draw:fill-color",j==0?"#004586":j==1?"#ff420e":"#ffd320",
 +	    //               KoGenStyle::GraphicType);
+            bodyWriter->addAttribute("chart:style-name", styles.insert(gs, "ch"));
+
+            Q_FOREACH (KoChart::Text* t, series->m_texts) {
+                bodyWriter->startElement("chart:data-label");
+                bodyWriter->startElement("text:p");
+                bodyWriter->addTextNode(t->m_text);
+                bodyWriter->endElement();
+                bodyWriter->endElement();
+            }
+
+            bodyWriter->endElement();
+        }
+        
+        ++curSerNum;
+        bodyWriter->endElement(); // chart:series
+    }
+
+    return true;
+}
+
+
+// ----------------------------------------------------------------
+//                   Some helper functions
+
+
+// Calculate fade factor as suggested in msoo xml reference page 4161
+qreal KoOdfChartWriter::calculateFade(int index, int maxIndex)
+{
+    return -70.0 + 140.0 * ((double) index / ((double) maxIndex + 1.0));
+}
+
+QColor KoOdfChartWriter::shadeColor(const QColor& col, qreal factor)
+{
+    QColor result = col;
+    qreal luminance = 0.0;
+    qreal hue = 0.0;
+    qreal sat = 0.0;
+    result.getHslF(&hue, &sat, &luminance);
+    luminance *= factor;
+    result.setHslF(hue, sat, luminance);
+    return result;
+}
+
+void KoOdfChartWriter::addDataThemeToStyle(KoGenStyle& style, int dataNumber, int \
maxNumData, +					   bool strokes)
+{
+    // FIXME: This is only relevant to themes, so remove this function after
+    //        we are done with saveContent().
+    Q_UNUSED(style);
+    Q_UNUSED(dataNumber);
+    Q_UNUSED(maxNumData);
+    Q_UNUSED(strokes);
+}
+
+
+float KoOdfChartWriter::sprcToPt(int sprc, Orientation orientation )
+{
+    if (orientation & vertical)
+        return (float)sprc * ( (float)m_width / 4000.0);
+
+    return (float)sprc * ( (float)m_height / 4000.0);
+}
+
+void KoOdfChartWriter::writeInternalTable(KoXmlWriter* bodyWriter)
+{
+    Q_ASSERT( bodyWriter );
+    bodyWriter->startElement("table:table");
+        bodyWriter->addAttribute( "table:name", "local" );
+
+        bodyWriter->startElement( "table:table-header-columns" );
+            bodyWriter->startElement( "table:table-column" );
+            bodyWriter->endElement();
+        bodyWriter->endElement();
+
+        bodyWriter->startElement( "table:table-columns" );
+            bodyWriter->startElement( "table:table-column" );
+            bodyWriter->endElement();
+        bodyWriter->endElement();
+
+        bodyWriter->startElement( "table:table-rows" );
+
+        const int rowCount = chart()->m_internalTable.maxRow();
+        for (int r = 1; r <= rowCount; ++r) {
+            bodyWriter->startElement("table:table-row");
+            const int columnCount = chart()->m_internalTable.maxCellsInRow(r);
+            for (int c = 1; c <= columnCount; ++c) {
+                bodyWriter->startElement("table:table-cell");
+                if (Cell* cell = chart()->m_internalTable.cell(c, r, false)) {
+                    //kDebug() << "cell->m_value " << cell->m_value;
+                    if (!cell->m_value.isEmpty()) {
+                        if (!cell->m_valueType.isEmpty()) {
+                            bodyWriter->addAttribute("office:value-type", \
cell->m_valueType); +                            if (cell->m_valueType == "string") {
+                                bodyWriter->addAttribute("office:string-value", \
cell->m_value); +                            } else if (cell->m_valueType == \
"boolean") { +                                \
bodyWriter->addAttribute("office:boolean-value", cell->m_value); +                    \
} else if (cell->m_valueType == "date") { +                                \
bodyWriter->addAttribute("office:date-value", cell->m_value); +                       \
} else if (cell->m_valueType == "time") { +                                \
bodyWriter->addAttribute("office:time-value", cell->m_value); +                       \
} else { // float, percentage and currency including fraction and scientific +        \
bodyWriter->addAttribute("office:value", cell->m_value); +                            \
} +                        }
+
+                        bodyWriter->startElement("text:p");
+                        bodyWriter->addTextNode( cell->m_value );
+                        bodyWriter->endElement(); // text:p
+                    }
+                }
+                bodyWriter->endElement(); // table:table-cell
+            }
+            bodyWriter->endElement(); // table:table-row
+        }
+        bodyWriter->endElement(); // table:table-rows
+    bodyWriter->endElement(); // table:table
+}
+
+void KoOdfChartWriter::setSheetReplacement( bool val )
+{
+    sheetReplacement = val;
+}
diff --git a/filters/libodf2/chart/KoOdfChartWriter.h \
b/filters/libodf2/chart/KoOdfChartWriter.h new file mode 100644
index 0000000..2f09ba62
--- /dev/null
+++ b/filters/libodf2/chart/KoOdfChartWriter.h
@@ -0,0 +1,110 @@
+/*
+ *  Copyright (c) 2010 Sebastian Sauer <sebsauer@kdab.com>
+ *  Copyright (c) 2010 Carlos Licea <carlos@kdab.com>
+ *  Copyright (c) 2014-2015 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 Lesser General Public License as published
+ *  by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KOODFCHARTWRITER_H
+#define KOODFCHARTWRITER_H
+
+#include <Charting.h>
+
+#include "koodf2_export.h"
+
+class KoStore;
+class KoXmlWriter;
+class KoGenStyles;
+class KoGenStyle;
+
+
+class KOODF2_EXPORT KoOdfChartWriter
+{
+public:
+    explicit KoOdfChartWriter(KoChart::Chart* chart);
+    virtual ~KoOdfChartWriter();
+
+    KoChart::Chart* chart() const { return m_chart; }
+
+    void setSheetReplacement(bool val);
+
+    void set2003ColorPalette(QList< QColor > palette);
+    QString markerType(KoChart::MarkerType type, int currentSeriesNumber);
+
+    bool m_drawLayer;
+    QString m_href;
+    QString m_cellRangeAddress;
+    QString m_endCellAddress;
+    QString m_notifyOnUpdateOfRanges;
+#if 0
+    /// anchored to sheet
+    QString m_sheetName;
+    /// anchored to cell
+    //unsigned long m_colL, m_rwT;
+#endif
+    qreal m_x, m_y, m_width, m_height; //in pt
+    qreal m_end_x, m_end_y; //in pt
+
+    // Saving of content
+            bool saveIndex(KoXmlWriter* xmlWriter);
+    virtual bool saveContent(KoStore* store, KoXmlWriter* manifestWriter);
+    virtual bool saveSeries(KoGenStyles &styles, KoGenStyles &mainStyles, \
KoXmlWriter* bodyWriter, +			    int maxExplode);
+
+    // helper functions
+    qreal calculateFade(int index, int maxIndex);
+    QColor shadeColor(const QColor& col, qreal factor);
+
+protected:
+    KoChart::Chart* m_chart;
+
+    QString normalizeCellRange(QString range);
+    QString toPtString(int number);
+    enum Orientation {
+        vertical,
+        horizontal
+    };
+    float sprcToPt(int sprc, Orientation orientation);
+    QColor tintColor(const QColor & color, qreal tintfactor);
+    QString replaceSheet(const QString &originalString, const QString \
&replacementSheet); +    bool sheetReplacement;
+
+    // Style generation
+            QString genChartAreaStyle(KoGenStyles& styles, KoGenStyles& mainStyles);
+    virtual QString genChartAreaStyle(KoGenStyle& style, KoGenStyles& styles,
+				      KoGenStyles& mainStyles);
+            QString genPlotAreaStyle(KoGenStyles& styles, KoGenStyles& mainStyles);
+    virtual QString genPlotAreaStyle(KoGenStyle& style, KoGenStyles& styles,
+				     KoGenStyles& mainStyles);
+            void addShapePropertyStyle(/*const*/ KoChart::Series* series,
+				       KoGenStyle& style, KoGenStyles& mainStyles);
+    virtual void addDataThemeToStyle(KoGenStyle& style,
+				     int dataNumber, int maxNumData = 1, bool strokes = true);
+
+    QString generateGradientStyle(KoGenStyles& mainStyles, const KoChart::Gradient* \
grad); +
+    // Color functions
+    virtual QColor calculateColorFromGradientStop(const \
KoChart::Gradient::GradientStop& grad); +    virtual QColor labelFontColor() const;
+    void writeInternalTable(KoXmlWriter* bodyWriter);
+
+    // MS Office related stuff
+    QList<QColor> m_palette;
+    // tells if a 2003 color palette has been set
+    bool paletteIsSet;
+};
+
+#endif  // KOODFCHARTWRITER_H
diff --git a/filters/libodf2/chart/PLAN b/filters/libodf2/chart/PLAN
new file mode 100644
index 0000000..601630d
--- /dev/null
+++ b/filters/libodf2/chart/PLAN
@@ -0,0 +1,59 @@
+Primary goal: Unify handling of charts in Calligra: filters and shape
+Later goal:   Simplify the move to the new KdCharts and perhaps other backends
+
+
+Part I: Move the charts to libodf2
+
+Preparations
+ * Move to better places and do some cleanups				Done
+    + NumberFormatParser --> libmso					done
+    + Charting -> KoChart,  --> libodf2					done
+ * Change the namespace to KoChart					Done
+
+Refactoring
+ * Separate the definition of DrawingMLTheme from the ThemesReader.	Done
+    + Move the data definitions into its own .h file. 			done
+    + Only include the Theme definitions where the reader is not needed done
+ * Make ChartExport into a base class and make inherited classes in:	Done
+    + Move baseclass to libodf2    	       		 	 	done
+    + subclass in sheets/xlsx	   	  - using the DrawingMLTheme	done
+    + subclass in sheets/excel/sidewinder - using the 2003palette	LATER(*)
+
+Test
+ * Convert all the test documents and check that the output is the same ----
+   as before.
+    + Download the test documents (checkout the repo)			....
+    + Create a script that does the conversion				....
+    + Create a script that does the comparison				....
+
+
+(*) The palette is far too deeply ingrained in all of the chart writer to be
+    easily separated.  And perhaps this is something we could use in the chart
+    shape itself? We have wanted to provide support for chart themes for some
+    time now.
+
+
+Milestone 1: separating useful parts into a library
+----------------------------------------------------------------
+
+Part II: Enhance the chart storage and use it in the chart shape
+
+Enhancements of KoChart::Chart and the subclasses
+ * Separate into separate files						----
+ * Also read ODF (get from the ChartShape)				----
+ * ...
+
+Start using KoChart in ChartShape
+ * Create a backend API and move KDChart into a backend subdirectory	----
+ * Use the storage classes  	 	      				----
+
+
+Milestone 2: Share common definitions and some data classes between all usages
+	     of charts.
+----------------------------------------------------------------
+
+
+Other stuff to do, but not part of this plan:
+
+ * Move XlsxChartReader to libmsooxml. (it's used in docx and pptx)
+ * Move XlsxChartExport to libmsooxml. (it's used in docx and pptx)
diff --git a/filters/sheets/excel/export/CMakeLists.txt \
b/filters/sheets/excel/export/CMakeLists.txt index acc5a73..ef42686 100644
--- a/filters/sheets/excel/export/CMakeLists.txt
+++ b/filters/sheets/excel/export/CMakeLists.txt
@@ -4,6 +4,7 @@ include_directories(
     ${CMAKE_BINARY_DIR}/filters/
     ${KOMAIN_INCLUDES}
     ${CMAKE_SOURCE_DIR}/filters/sheets/xlsx
+    ${KOODF2_INCLUDES}
     ${CMAKE_SOURCE_DIR}/filters/libmso
     ${CMAKE_SOURCE_DIR}/filters/libmsooxml
     ${CMAKE_SOURCE_DIR}/sheets # for PointStorage
@@ -35,8 +36,6 @@ set(sidewinder_SRCS
   ${CMAKE_CURRENT_SOURCE_DIR}/../sidewinder/worksheetsubstreamhandler.cpp
   ${CMAKE_CURRENT_SOURCE_DIR}/../sidewinder/chartsubstreamhandler.cpp
   ${CMAKE_CURRENT_SOURCE_DIR}/../sidewinder/XlsRecordOutputStream.cpp
-  ${CMAKE_CURRENT_SOURCE_DIR}/../../xlsx/NumberFormatParser.cpp
-  ${CMAKE_CURRENT_SOURCE_DIR}/../../xlsx/ChartExport.cpp
   ${CMAKE_CURRENT_BINARY_DIR}/records.cpp
 )
 
@@ -47,7 +46,11 @@ set(sheets2xls_SRCS ExcelExport.cpp CFBWriter.cpp \
${sidewinder_SRCS})  kde4_add_plugin(calligra_filter_sheets2xls ${sheets2xls_SRCS})
 
 
-target_link_libraries(calligra_filter_sheets2xls komsooxml komain mso koodf \
${ZLIB_LIBRARIES} calligrasheetscommon) \
+target_link_libraries(calligra_filter_sheets2xls +                      \
calligrasheetscommon +                      komsooxml mso
+                      komain koodf
+                      ${ZLIB_LIBRARIES})
 
 set(INSTALL_XLS_EXPORT_FILTER OFF CACHE BOOL "Install the very experimental xls \
export filter, which might eat your data and provides no guarentees")  
diff --git a/filters/sheets/excel/import/CMakeLists.txt \
b/filters/sheets/excel/import/CMakeLists.txt index de653ee..d10b149 100644
--- a/filters/sheets/excel/import/CMakeLists.txt
+++ b/filters/sheets/excel/import/CMakeLists.txt
@@ -3,7 +3,7 @@ include_directories(
     ${CMAKE_CURRENT_SOURCE_DIR}/../sidewinder
     ${CMAKE_BINARY_DIR}/filters/
     ${KOMAIN_INCLUDES}
-    ${KOODF_INCLUDES}
+    ${KOODF2_INCLUDES}
     ${CMAKE_SOURCE_DIR}/filters/sheets/xlsx
     ${CMAKE_SOURCE_DIR}/filters/libmso
     ${CMAKE_SOURCE_DIR}/filters/libmsooxml
@@ -36,8 +36,7 @@ set(sidewinder_SRCS
   ${CMAKE_CURRENT_SOURCE_DIR}/../sidewinder/worksheetsubstreamhandler.cpp
   ${CMAKE_CURRENT_SOURCE_DIR}/../sidewinder/chartsubstreamhandler.cpp
   ${CMAKE_CURRENT_SOURCE_DIR}/../sidewinder/XlsRecordOutputStream.cpp
-  ${CMAKE_CURRENT_SOURCE_DIR}/../../xlsx/NumberFormatParser.cpp
-  ${CMAKE_CURRENT_SOURCE_DIR}/../../xlsx/ChartExport.cpp
+  ${CMAKE_SOURCE_DIR}/filters/libodf2/chart/KoOdfChartWriter.cpp
   ${CMAKE_CURRENT_BINARY_DIR}/records.cpp
 )
 
@@ -54,7 +53,11 @@ target_link_libraries(excelimport calligrasheetsodf komsooxml \
komain mso koodf $  
 set(xls2ods_SRCS ExcelImport.cpp ImportUtils.cpp ODrawClient.cpp ${sidewinder_SRCS})
 kde4_add_plugin(calligra_filter_xls2ods ${xls2ods_SRCS})
-target_link_libraries(calligra_filter_xls2ods calligrasheetsodf komsooxml komain mso \
koodf ${ZLIB_LIBRARIES}) +target_link_libraries(calligra_filter_xls2ods
+                      calligrasheetsodf
+                      komsooxml mso
+                      komain koodf
+                      ${ZLIB_LIBRARIES})
 
 install(TARGETS calligra_filter_xls2ods DESTINATION ${PLUGIN_INSTALL_DIR})
 
diff --git a/filters/sheets/excel/import/ExcelImport.cpp \
b/filters/sheets/excel/import/ExcelImport.cpp index abf4c52..ba54f56 100644
--- a/filters/sheets/excel/import/ExcelImport.cpp
+++ b/filters/sheets/excel/import/ExcelImport.cpp
@@ -69,7 +69,7 @@
 #include <Util.h>
 
 #include <Charting.h>
-#include <ChartExport.h>
+#include <KoOdfChartWriter.h>
 #include <NumberFormatParser.h>
 
 #include <iostream>
@@ -163,7 +163,7 @@ public:
     QHash<int, QRegion> columnStyles;
     QList<QPair<QRegion, Calligra::Sheets::Conditions> > cellConditions;
 
-    QList<ChartExport*> charts;
+    QList<KoOdfChartWriter*> charts;
     void processCharts(KoXmlWriter* manifestWriter);
 
     void addManifestEntries(KoXmlWriter* ManifestWriter);
@@ -1011,7 +1011,7 @@ void ExcelImport::Private::processCellObjects(Cell* ic, \
Calligra::Sheets::Cell o  hasObjects = true;
         }
 
-        ChartExport *c = new ChartExport(chart->m_chart);
+        KoOdfChartWriter *c = new KoOdfChartWriter(chart->m_chart);
         c->setSheetReplacement( false );
         c->m_href = QString("Chart%1").arg(this->charts.count()+1);
         c->m_endCellAddress = Swinder::encodeAddress(sheet->name(), chart->m_colR, \
chart->m_rwB); @@ -1067,7 +1067,7 @@ void \
ExcelImport::Private::processCellObjects(Cell* ic, Calligra::Sheets::Cell o  
 void ExcelImport::Private::processCharts(KoXmlWriter* manifestWriter)
 {
-    foreach(ChartExport *c, this->charts) {
+    foreach(KoOdfChartWriter *c, this->charts) {
         c->set2003ColorPalette( workbook->colorTable() );
         c->saveContent(this->storeout, manifestWriter);
     }
diff --git a/filters/sheets/excel/import/excelimporttoods.cc \
b/filters/sheets/excel/import/excelimporttoods.cc index 5d6887b..1639a57 100644
--- a/filters/sheets/excel/import/excelimporttoods.cc
+++ b/filters/sheets/excel/import/excelimporttoods.cc
@@ -41,7 +41,7 @@
 #include <KoOdfNumberStyles.h>
 
 #include <Charting.h>
-#include <ChartExport.h>
+#include <KoOdfChartWriter.h>
 #include <NumberFormatParser.h>
 
 #include "swinder.h"
@@ -118,7 +118,7 @@ public:
     QString subScriptStyle, superScriptStyle;
     QHash<QString, KoGenStyle> valueFormatCache;
     QHash<CellFormatKey, QString> cellFormatCache;
-    QList<ChartExport*> charts;
+    QList<KoOdfChartWriter*> charts;
     QHash<Cell*, QByteArray> cellShapes;
     QHash<Sheet*, QByteArray> sheetShapes;
 
@@ -1325,7 +1325,7 @@ void ExcelImport::Private::processCellContentForBody(Cell* \
cell,  continue;
         }
 
-        ChartExport *c = new ChartExport(chart->m_chart);
+        KoOdfChartWriter *c = new KoOdfChartWriter(chart->m_chart);
         c->m_href = QString("Chart%1").arg(this->charts.count()+1);
         c->m_endCellAddress = encodeAddress(sheet->name(), chart->m_colR, \
chart->m_rwB);  c->m_notifyOnUpdateOfRanges = "Sheet1.D2:Sheet1.F2";
@@ -1359,7 +1359,7 @@ void ExcelImport::Private::processCellContentForBody(Cell* \
cell,  
 void ExcelImport::Private::processCharts(KoXmlWriter* manifestWriter)
 {
-    foreach(ChartExport *c, this->charts) {
+    foreach(KoOdfChartWriter *c, this->charts) {
         c->saveContent(this->storeout, manifestWriter);
     }
 }
diff --git a/filters/sheets/excel/sidewinder/CMakeLists.txt \
b/filters/sheets/excel/sidewinder/CMakeLists.txt index 097e2a8..20dec14 100644
--- a/filters/sheets/excel/sidewinder/CMakeLists.txt
+++ b/filters/sheets/excel/sidewinder/CMakeLists.txt
@@ -1,10 +1,10 @@
 include_directories(
     ${CMAKE_BINARY_DIR}/filters/
-    ${CMAKE_SOURCE_DIR}/filters/libmso
-    ${CMAKE_SOURCE_DIR}/filters/sheets/xlsx # for Charting.h
     ${CMAKE_SOURCE_DIR}/filters/libmsooxml  # for MsooXmlGlobal.h
-    ${CMAKE_SOURCE_DIR}/sheets # for PointStorage.h
-    ${KOTEXT_INCLUDES} # for KoTextRangeManager.h, IMHO could be removed again
+    ${CMAKE_SOURCE_DIR}/filters/libmso
+    ${KOODF2_INCLUDES}                      # For the chart stuff
+    ${CMAKE_SOURCE_DIR}/sheets              # for PointStorage.h
+    ${KOTEXT_INCLUDES}                      # for KoTextRangeManager.h, IMHO could \
be removed again  ${KOODF_INCLUDES}
 )
 
diff --git a/filters/sheets/excel/sidewinder/chartsubstreamhandler.cpp \
b/filters/sheets/excel/sidewinder/chartsubstreamhandler.cpp index ecd9071..a7a1fbb \
                100644
--- a/filters/sheets/excel/sidewinder/chartsubstreamhandler.cpp
+++ b/filters/sheets/excel/sidewinder/chartsubstreamhandler.cpp
@@ -27,7 +27,7 @@
 #include <QRegExp>
 #include <QDebug>
 
-#include <XlsxUtils.h>
+#include <XlsUtils.h>  // splitCellRange() et al.
 
 #include <sstream>
 
@@ -36,7 +36,7 @@ namespace Swinder {
 class BRAIRecord : public Record
 {
 public:
-    Charting::Value* m_value;
+    KoChart::Value* m_value;
 
     static const unsigned int id;
     unsigned int rtti() const { return this->id; }
@@ -59,8 +59,8 @@ public:
             return;
         }
 
-        Charting::Value::DataId dataId = (Charting::Value::DataId) readU8(data);
-        Charting::Value::DataType type = (Charting::Value::DataType) readU8(data + \
1); +        KoChart::Value::DataId dataId = (KoChart::Value::DataId) readU8(data);
+        KoChart::Value::DataType type = (KoChart::Value::DataType) readU8(data + 1);
         bool isUnlinkedFormat = readU16(data + 2) & 0x01;
         unsigned numberFormat = readU16(data + 4);
 
@@ -74,7 +74,7 @@ public:
         }
 
         delete m_value;
-        m_value = new Charting::Value(dataId, type, formula, isUnlinkedFormat, \
numberFormat); +        m_value = new KoChart::Value(dataId, type, formula, \
isUnlinkedFormat, numberFormat);  }
 
 private:
@@ -139,13 +139,13 @@ public:
     InternalDataCache(ChartSubStreamHandler *chartSubStreamHandler, unsigned index) \
: m_chartSubStreamHandler(chartSubStreamHandler), m_siIndex(index) {}  \
                ~InternalDataCache() {
         QString cellRegion = m_cellRegion.isNull() ? QString() : \
                Swinder::encodeAddress("local", m_cellRegion);
-        bool isBubble = \
                dynamic_cast<Charting::BubbleImpl*>(m_chartSubStreamHandler->m_chart->m_impl);
                
-        bool isScatter = \
                dynamic_cast<Charting::ScatterImpl*>(m_chartSubStreamHandler->m_chart->m_impl);
                
-        foreach(Charting::Series *series, \
m_chartSubStreamHandler->m_chart->m_series) { +        bool isBubble = \
dynamic_cast<KoChart::BubbleImpl*>(m_chartSubStreamHandler->m_chart->m_impl); +       \
bool isScatter = dynamic_cast<KoChart::ScatterImpl*>(m_chartSubStreamHandler->m_chart->m_impl);
 +        foreach(KoChart::Series *series, \
m_chartSubStreamHandler->m_chart->m_series) {  switch (m_siIndex) {
                 case 0x0001: { // Series values or vertical values (for scatter or \
bubble chart groups)  if (isBubble || isScatter) {
-                        bool change = \
!series->m_datasetValue.contains(Charting::Value::VerticalValues) || \
(series->m_datasetValue[Charting::Value::VerticalValues]->m_type == \
Charting::Value::TextOrValue && \
series->m_datasetValue[Charting::Value::VerticalValues]->m_formula.isEmpty()); +      \
bool change = !series->m_datasetValue.contains(KoChart::Value::VerticalValues) || \
(series->m_datasetValue[KoChart::Value::VerticalValues]->m_type == \
KoChart::Value::TextOrValue && \
series->m_datasetValue[KoChart::Value::VerticalValues]->m_formula.isEmpty());  if \
(change) {  if (isBubble) {
                                 QString y = \
series->m_domainValuesCellRangeAddress.isEmpty() ? QString() : \
series->m_domainValuesCellRangeAddress[0]; @@ -162,7 +162,7 @@ public:
                 } break;
                 case 0x0002: { // Category labels or horizontal values (for scatter \
or bubble chart groups)  if (isBubble || isScatter) {
-                        bool change = \
!series->m_datasetValue.contains(Charting::Value::HorizontalValues) || \
(series->m_datasetValue[Charting::Value::HorizontalValues]->m_type == \
Charting::Value::TextOrValue && \
series->m_datasetValue[Charting::Value::HorizontalValues]->m_formula.isEmpty()); +    \
bool change = !series->m_datasetValue.contains(KoChart::Value::HorizontalValues) || \
(series->m_datasetValue[KoChart::Value::HorizontalValues]->m_type == \
KoChart::Value::TextOrValue && \
series->m_datasetValue[KoChart::Value::HorizontalValues]->m_formula.isEmpty());  if \
(change) {  if (isBubble) {
                                 QString x = \
series->m_domainValuesCellRangeAddress.count() < 2 ? QString() : \
series->m_domainValuesCellRangeAddress[1]; @@ -286,7 +286,7 @@ \
                ChartSubStreamHandler::~ChartSubStreamHandler()
         if (m_chart->m_title.isEmpty() && m_chart->m_series.count() == 1) {
             // Else we are using the same logic that is used in the 2007 filter and \
fetch the title  // from the series collection of TextRecord's.
-            Charting::Series* series = m_chart->m_series.first();
+            KoChart::Series* series = m_chart->m_series.first();
             if (!series->m_texts.isEmpty() )
                 m_chart->m_title = series->m_texts.first()->m_text;
         }
@@ -555,7 +555,7 @@ void ChartSubStreamHandler::handleEnd(EndRecord *)
     m_currentObj = m_stack.pop();
     if (!m_seriesStack.isEmpty())
         m_currentSeries = m_seriesStack.pop();
-    else if (Charting::Series* series = \
dynamic_cast<Charting::Series*>(m_currentObj)) +    else if (KoChart::Series* series \
= dynamic_cast<KoChart::Series*>(m_currentObj))  m_currentSeries = series;
 }
 
@@ -563,7 +563,7 @@ void ChartSubStreamHandler::handleFrame(FrameRecord *record)
 {
     if (!record) return;
     DEBUG << "autoPosition=" << record->isAutoPosition() << " autoSize=" << \
                record->isAutoSize() << std::endl;
-    if ( dynamic_cast< Charting::Chart* > ( m_currentObj ) ) {
+    if ( dynamic_cast< KoChart::Chart* > ( m_currentObj ) ) {
         if (record->isAutoPosition()) {
             m_chart->m_x1 = -1;
             m_chart->m_y1 = -1;
@@ -573,7 +573,7 @@ void ChartSubStreamHandler::handleFrame(FrameRecord *record)
             m_chart->m_y2 = -1;
         }
     }
-    else if ( dynamic_cast< Charting::PlotArea* > ( m_currentObj ) ) {
+    else if ( dynamic_cast< KoChart::PlotArea* > ( m_currentObj ) ) {
     }
 }
 
@@ -583,7 +583,7 @@ void ChartSubStreamHandler::handleSeries(SeriesRecord *record)
     if (!record) return;
     DEBUG << "dataTypeX=" << record->dataTypeX() << " dataTypeY=" << \
record->dataTypeY() << " countXValues=" << record->countXValues() << " countYValues=" \
<< record->countYValues() << " bubbleSizeDataType=" << record->bubbleSizeDataType() \
<< " countBubbleSizeValues=" << record->countBubbleSizeValues() << std::endl;  
-    m_currentSeries = new Charting::Series;
+    m_currentSeries = new KoChart::Series;
     m_currentSeries->m_dataTypeX = record->dataTypeX();
     m_currentSeries->m_countXValues = record->countXValues();
     m_currentSeries->m_countYValues = record->countYValues();
@@ -608,7 +608,7 @@ void ChartSubStreamHandler::handleNumber(NumberRecord *record)
     // The formatting of the value doesn't really matter or does it? Well, maybe for \
data-value-label's that should be displayed as formatted?  \
//m_xfTable[record->xfIndex()]  
-    Charting::Cell *cell = m_chart->m_internalTable.cell(record->column() + 1, \
record->row() + 1, true); +    KoChart::Cell *cell = \
m_chart->m_internalTable.cell(record->column() + 1, record->row() + 1, true);  \
cell->m_value = QString::number(record->number(), 'f');  cell->m_valueType = "float";
 
@@ -629,12 +629,12 @@ void ChartSubStreamHandler::handleBRAI(BRAIRecord *record)
         //
         // FIXME: Handle VerticalValues and BubbleSizeValues
         if (!record->m_value->m_formula.isEmpty()) {
-            if (record->m_value->m_type == Charting::Value::TextOrValue
-                || record->m_value->m_type == Charting::Value::CellRange)
+            if (record->m_value->m_type == KoChart::Value::TextOrValue
+                || record->m_value->m_type == KoChart::Value::CellRange)
             {
-                if (record->m_value->m_dataId == Charting::Value::HorizontalValues) \
{ +                if (record->m_value->m_dataId == KoChart::Value::HorizontalValues) \
                {
                     m_currentSeries->m_valuesCellRangeAddress = \
                record->m_value->m_formula;
-                } else if (record->m_value->m_dataId == \
Charting::Value::VerticalValues) { +                } else if \
                (record->m_value->m_dataId == KoChart::Value::VerticalValues) {
                     m_chart->m_verticalCellRangeAddress = \
record->m_value->m_formula;  }
                 
@@ -669,11 +669,11 @@ void ChartSubStreamHandler::handleDataFormat(DataFormatRecord \
*record)  if ( record->xi() == 0xFFFF ) { // applies to series
         m_currentObj = m_currentSeries;
     } else { // applies to data-point
-        Charting::DataPoint *dataPoint = 0;
+        KoChart::DataPoint *dataPoint = 0;
         if (record->xi() > uint(m_currentSeries->m_dataPoints.count())) {
             DEBUG << "Invalid data-point index=" << record->yi() << std::endl;
         } else if (record->xi() == uint(m_currentSeries->m_dataPoints.count())) {
-            dataPoint = new Charting::DataPoint();
+            dataPoint = new KoChart::DataPoint();
             m_currentSeries->m_dataPoints << dataPoint;
         } else {
             dataPoint = m_currentSeries->m_dataPoints[record->xi()];
@@ -702,34 +702,34 @@ void ChartSubStreamHandler::handleLineFormat(LineFormatRecord \
*record)  {    
     if (!record) return;
     DEBUG << "lns=" << record->lns() << " we=" << record->we() << " fAxisOn=" << \
                record->isFAxisOn() << std::endl;
-    if (Charting::Axis* axis = dynamic_cast<Charting::Axis*>(m_currentObj)) {
-        Charting::LineFormat format(Charting::LineFormat::Style(record->lns()), \
Charting::LineFormat::Tickness(record->we())); +    if (KoChart::Axis* axis = \
dynamic_cast<KoChart::Axis*>(m_currentObj)) { +        KoChart::LineFormat \
format(KoChart::LineFormat::Style(record->lns()), \
KoChart::LineFormat::Thickness(record->we()));  switch(m_axisId) {
             case 0x0000: // The axis line itself
                 axis->m_format = format;
                 break;
             case 0x0001: // The major gridlines along the axis
-                axis->m_majorGridlines = Charting::Axis::Gridline(format);
+                axis->m_majorGridlines = KoChart::Axis::Gridline(format);
                 break;
             case 0x0002: // The minor gridlines along the axis
-                axis->m_minorGridlines = Charting::Axis::Gridline(format);
+                axis->m_minorGridlines = KoChart::Axis::Gridline(format);
                 break;
             case 0x0003: // The walls or floor of a 3-D chart
                 //TODO
                 break;
         }
         m_axisId = -1;
-    } else if ( dynamic_cast< Charting::Legend* > ( m_currentObj ) ) {
+    } else if ( dynamic_cast< KoChart::Legend* > ( m_currentObj ) ) {
         if ( record->lns() == 0x0005 )
             m_chart->m_showLines = false;
         else if ( record->lns() == 0x0000 )
             m_chart->m_showLines = true;
-//     } else if ( dynamic_cast< Charting::Text* > ( m_currentObj ) ) {
+//     } else if ( dynamic_cast< KoChart::Text* > ( m_currentObj ) ) {
 //         return;
-    } else if ( Charting::Series* series = dynamic_cast< Charting::Series* > ( \
m_currentObj/*m_currentSeries*/ ) ) { +    } else if ( KoChart::Series* series = \
dynamic_cast< KoChart::Series* > ( m_currentObj/*m_currentSeries*/ ) ) {  //Q_ASSERT( \
false );  if ( !series->spPr )
-            series->spPr = new Charting::ShapeProperties;
+            series->spPr = new KoChart::ShapeProperties;
         m_chart->m_showLines = false;
         const int index = m_chart->m_series.indexOf( series );
         const QColor color = record->isFAuto() ? \
globals()->workbook()->colorTable().at( 24 + index ) : QColor( record->red(), \
record->green(), record->blue() ); @@ -737,35 +737,35 @@ void \
ChartSubStreamHandler::handleLineFormat(LineFormatRecord *record)  switch ( \
record->lns() )  {
             case( 0x0000 ):
-                series->spPr->lineFill.setType( Charting::Fill::Solid );
+                series->spPr->lineFill.setType( KoChart::Fill::Solid );
                 break;
             case( 0x0005 ):
             {
-                series->spPr->lineFill.setType( Charting::Fill::None );
-//                 Charting::ScatterImpl* impl = dynamic_cast< \
Charting::ScatterImpl* >( m_chart->m_impl ); +                \
series->spPr->lineFill.setType( KoChart::Fill::None ); +//                 \
KoChart::ScatterImpl* impl = dynamic_cast< KoChart::ScatterImpl* >( m_chart->m_impl \
);  //                 if ( impl )
 //                 {
-//                     if ( impl->style == Charting::ScatterImpl::Marker || \
                impl->style == Charting::ScatterImpl::LineMarker )
-//                         impl->style = Charting::ScatterImpl::Marker;
+//                     if ( impl->style == KoChart::ScatterImpl::Marker || \
impl->style == KoChart::ScatterImpl::LineMarker ) +//                         \
impl->style = KoChart::ScatterImpl::Marker;  //                     else
-//                         impl->style = Charting::ScatterImpl::None;
+//                         impl->style = KoChart::ScatterImpl::None;
 //                 }
             }
                 break;
             default:
-                series->spPr->lineFill.setType( Charting::Fill::None );
+                series->spPr->lineFill.setType( KoChart::Fill::None );
         }
-        //series->spPr->lineFill.type = Charting::Fill::Solid;
+        //series->spPr->lineFill.type = KoChart::Fill::Solid;
     }
-    else if ( dynamic_cast< Charting::ChartImpl* > ( m_currentObj ) ) {
+    else if ( dynamic_cast< KoChart::ChartImpl* > ( m_currentObj ) ) {
         Q_ASSERT( false );
     }
-    else if ( dynamic_cast< Charting::Chart* > ( m_currentObj ) ) {
+    else if ( dynamic_cast< KoChart::Chart* > ( m_currentObj ) ) {
         DEBUG << "color=" << QColor( record->red(), record->green(), record->blue() \
).name() << "automatic=" << record->isFAuto() << std::endl;  //m_chart->m_showLines = \
                record->isFAuto();
-        Q_ASSERT( !dynamic_cast< Charting::Series* > ( m_currentSeries ) );
+        Q_ASSERT( !dynamic_cast< KoChart::Series* > ( m_currentSeries ) );
     }
-    else if ( Charting::DataPoint *dataPoint = dynamic_cast< Charting::DataPoint* > \
( m_currentObj ) ) { +    else if ( KoChart::DataPoint *dataPoint = dynamic_cast< \
KoChart::DataPoint* > ( m_currentObj ) ) {  Q_UNUSED( dataPoint );
     }
 }
@@ -781,11 +781,11 @@ void ChartSubStreamHandler::handleAreaFormat(AreaFormatRecord \
*record)  QColor foreground, background;
     if ( record->isFAuto() ) {
         int index = 0;
-        if ( Charting::Series* series = dynamic_cast< Charting::Series* > ( \
m_currentObj ) ) { +        if ( KoChart::Series* series = dynamic_cast< \
KoChart::Series* > ( m_currentObj ) ) {  index = m_chart->m_series.indexOf( series ) \
% 8;  Q_ASSERT(index >= 0);
             foreground = globals()->workbook()->colorTable().at( 16 + index );
-        } else if ( Charting::DataPoint *dataPoint = dynamic_cast< \
Charting::DataPoint* > ( m_currentObj ) ) { +        } else if ( KoChart::DataPoint \
                *dataPoint = dynamic_cast< KoChart::DataPoint* > ( m_currentObj ) ) {
             index = m_currentSeries->m_dataPoints.indexOf( dataPoint ) % 8;
             Q_ASSERT(index >= 0);
             foreground = globals()->workbook()->colorTable().at( 16 + index );
@@ -807,16 +807,16 @@ void ChartSubStreamHandler::handleAreaFormat(AreaFormatRecord \
*record)  
     DEBUG << "foreground=" << foreground.name() << " background=" << \
background.name() << " fillStyle=" << record->fls() << " fAuto=" << record->isFAuto() \
<< std::endl;  
-    m_currentObj->m_areaFormat = new Charting::AreaFormat(foreground, background, \
fill); +    m_currentObj->m_areaFormat = new KoChart::AreaFormat(foreground, \
background, fill);  
-    if ( Charting::Series* series = dynamic_cast< Charting::Series* > ( m_currentObj \
) ) { +    if ( KoChart::Series* series = dynamic_cast< KoChart::Series* > ( \
m_currentObj ) ) {  if ( !series->spPr )
-            series->spPr = new Charting::ShapeProperties;
+            series->spPr = new KoChart::ShapeProperties;
         series->spPr->areaFill.setColor( foreground );
     }
-    //else if ( Charting::PlotArea* plotArea = dynamic_cast< Charting::PlotArea* > ( \
m_currentObj ) ) { +    //else if ( KoChart::PlotArea* plotArea = dynamic_cast< \
KoChart::PlotArea* > ( m_currentObj ) ) {  //}
-    //else if ( Charting::DataPoint *dataPoint = dynamic_cast< Charting::DataPoint* \
> ( m_currentObj ) ) { +    //else if ( KoChart::DataPoint *dataPoint = dynamic_cast< \
> KoChart::DataPoint* > ( m_currentObj ) ) {
     //}
 }
 
@@ -825,92 +825,92 @@ void ChartSubStreamHandler::handlePieFormat(PieFormatRecord \
*record)  if (!record) return;
     if (!m_currentSeries) return;
     DEBUG << "pcExplode=" << record->pcExplode() << std::endl;
-    m_currentSeries->m_datasetFormat << new \
Charting::PieFormat(record->pcExplode()); +    m_currentSeries->m_datasetFormat << \
new KoChart::PieFormat(record->pcExplode());  }
 
 void ChartSubStreamHandler::handleMarkerFormat(MarkerFormatRecord *record)
 {
     if (!record) return;
     DEBUG << "fAuto=" << record->fAuto() << " imk=" << record->imk() << std::endl;
-    const bool legend = dynamic_cast< Charting::Legend* >( m_currentObj );
+    const bool legend = dynamic_cast< KoChart::Legend* >( m_currentObj );
     if ( m_disableAutoMarker && legend )
         return;
-    m_chart->m_markerType = Charting::NoMarker;
+    m_chart->m_markerType = KoChart::NoMarker;
 
-    if ( Charting::DataPoint *dataPoint = \
dynamic_cast<Charting::DataPoint*>(m_currentObj) ) { +    if ( KoChart::DataPoint \
*dataPoint = dynamic_cast<KoChart::DataPoint*>(m_currentObj) ) {  \
Q_UNUSED(dataPoint);  }
-    else if ( Charting::Series *series = \
dynamic_cast<Charting::Series*>(m_currentObj) ) { +    else if ( KoChart::Series \
*series = dynamic_cast<KoChart::Series*>(m_currentObj) ) {  if ( !series->spPr )
-            series->spPr = new Charting::ShapeProperties;
+            series->spPr = new KoChart::ShapeProperties;
         const int index = m_chart->m_series.indexOf( series ) % 8;
         if ( record->fAuto() ) {
             if ( !m_disableAutoMarker )
-                m_chart->m_markerType = Charting::AutoMarker;
+                m_chart->m_markerType = KoChart::AutoMarker;
             if ( !series->spPr->areaFill.valid )
                 series->spPr->areaFill.setColor( \
globals()->workbook()->colorTable().at( 24 + index ) );  switch ( index ) {
                 case( 0x0000 ):
-                    series->m_markerType = Charting::SquareMarker;
+                    series->m_markerType = KoChart::SquareMarker;
                     break;
                 case( 0x0001 ):
-                    series->m_markerType = Charting::DiamondMarker;
+                    series->m_markerType = KoChart::DiamondMarker;
                     break;
                 case( 0x0002 ):
-                    series->m_markerType = Charting::SymbolXMarker;
+                    series->m_markerType = KoChart::SymbolXMarker;
                     break;
                 case( 0x0003 ):
-                    series->m_markerType = Charting::SquareMarker;
+                    series->m_markerType = KoChart::SquareMarker;
                     break;
                 case( 0x0004 ):
-                    series->m_markerType = Charting::DashMarker;
+                    series->m_markerType = KoChart::DashMarker;
                     break;
                 case( 0x0005 ):
-                    series->m_markerType = Charting::DashMarker;
+                    series->m_markerType = KoChart::DashMarker;
                     break;
                 case( 0x0006 ):
-                    series->m_markerType = Charting::CircleMarker;
+                    series->m_markerType = KoChart::CircleMarker;
                     break;
                 case( 0x0007 ):
-                    series->m_markerType = Charting::PlusMarker;
+                    series->m_markerType = KoChart::PlusMarker;
                     break;
                 default:
-                    series->m_markerType = Charting::SquareMarker;
+                    series->m_markerType = KoChart::SquareMarker;
                     break;
             }
         } else {
             if ( series ) {
                 switch ( record->imk() ) {
                     case( 0x0000 ):
-                        series->m_markerType = Charting::NoMarker;
+                        series->m_markerType = KoChart::NoMarker;
                         m_disableAutoMarker = true;
                         break;
                     case( 0x0001 ):
-                        series->m_markerType = Charting::SquareMarker;
+                        series->m_markerType = KoChart::SquareMarker;
                         break;
                     case( 0x0002 ):
-                        series->m_markerType = Charting::DiamondMarker;
+                        series->m_markerType = KoChart::DiamondMarker;
                         break;
                     case( 0x0003 ):
-                        series->m_markerType = Charting::SymbolXMarker;
+                        series->m_markerType = KoChart::SymbolXMarker;
                         break;
                     case( 0x0004 ):
-                        series->m_markerType = Charting::SquareMarker;
+                        series->m_markerType = KoChart::SquareMarker;
                         break;
                     case( 0x0005 ):
-                        series->m_markerType = Charting::DashMarker;
+                        series->m_markerType = KoChart::DashMarker;
                         break;
                     case( 0x0006 ):
-                        series->m_markerType = Charting::DashMarker;
+                        series->m_markerType = KoChart::DashMarker;
                         break;
                     case( 0x0007 ):
-                        series->m_markerType = Charting::CircleMarker;
+                        series->m_markerType = KoChart::CircleMarker;
                         break;
                     case( 0x0008 ):
-                        series->m_markerType = Charting::PlusMarker;
+                        series->m_markerType = KoChart::PlusMarker;
                         break;
                     default:
-                        series->m_markerType = Charting::SquareMarker;
+                        series->m_markerType = KoChart::SquareMarker;
                         break;
                 }
                 if ( !series->spPr->areaFill.valid )
@@ -979,7 +979,7 @@ void ChartSubStreamHandler::handleText(TextRecord *record)
           << " fShowKey=" << record->isFShowKey()
           << " fShowValue=" << record->isFShowValue() << std::endl;
 
-    m_currentObj = new Charting::Text;
+    m_currentObj = new KoChart::Text;
     if (m_defaultTextId >= 0) {  
         //m_defaultObjects[m_currentObj] = m_defaultTextId;
         m_defaultTextId = -1;
@@ -990,15 +990,15 @@ void ChartSubStreamHandler::handleSeriesText(SeriesTextRecord* \
record)  {
     if (!record || !m_currentSeries) return;
     DEBUG << "text=" << record->text() << std::endl;
-    if (Charting::Text *t = dynamic_cast<Charting::Text*>(m_currentObj)) {
+    if (KoChart::Text *t = dynamic_cast<KoChart::Text*>(m_currentObj)) {
         t->m_text = record->text();
-    } else if (Charting::Legend *l = dynamic_cast<Charting::Legend*>(m_currentObj)) \
{ +    } else if (KoChart::Legend *l = dynamic_cast<KoChart::Legend*>(m_currentObj)) \
{  //TODO
         Q_UNUSED(l);
-    } else if (Charting::Series* series = \
                dynamic_cast<Charting::Series*>(m_currentObj)) {
-        series->m_texts << new Charting::Text(record->text());
+    } else if (KoChart::Series* series = \
dynamic_cast<KoChart::Series*>(m_currentObj)) { +        series->m_texts << new \
KoChart::Text(record->text());  } else {
-        //m_currentSeries->m_texts << new Charting::Text(string(record->text()));
+        //m_currentSeries->m_texts << new KoChart::Text(string(record->text()));
     }
 }
 
@@ -1035,7 +1035,7 @@ void ChartSubStreamHandler::handleLegend(LegendRecord *record)
 {
     if (!record) return;
     DEBUG << "fAutoPosition=" << record->isFAutoPosition() << " fAutoPosX=" << \
record->isFAutoPosX() << " fAutoPosY=" << record->isFAutoPosY() << " fVert=" << \
                record->isFVert() << " fWasDataTable=" << record->isFWasDataTable() \
                << std::endl;
-    m_currentObj = m_chart->m_legend = new Charting::Legend();
+    m_currentObj = m_chart->m_legend = new KoChart::Legend();
 }
 
 // specifies the number of axis groups on the chart.
@@ -1066,9 +1066,9 @@ void ChartSubStreamHandler::handlePie(PieRecord *record)
     if (!record || m_chart->m_impl) return;
     DEBUG << "anStart=" << record->anStart() << " pcDonut=" << record->pcDonut() << \
std::endl;  if (record->pcDonut() > 0)
-        m_chart->m_impl = new Charting::RingImpl(record->anStart(), \
record->pcDonut()); +        m_chart->m_impl = new \
KoChart::RingImpl(record->anStart(), record->pcDonut());  else
-        m_chart->m_impl = new Charting::PieImpl(record->anStart());
+        m_chart->m_impl = new KoChart::PieImpl(record->anStart());
 }
 
 // specifies that the chartgroup is a bar chart
@@ -1076,7 +1076,7 @@ void ChartSubStreamHandler::handleBar(BarRecord *record)
 {
     if (!record || m_chart->m_impl) return;
     DEBUG << "pcOverlap=" << record->pcOverlap() << " pcGap=" << record->pcGap() << \
" fTranspose=" << record->isFTranspose() << " fStacked=" << record->isFStacked() << " \
                f100=" << record->isF100() << std::endl;
-    m_chart->m_impl = new Charting::BarImpl();
+    m_chart->m_impl = new KoChart::BarImpl();
     m_chart->m_transpose = record->isFTranspose();
     m_chart->m_stacked = record->isFStacked();
     m_chart->m_f100 = record->isF100();
@@ -1087,7 +1087,7 @@ void ChartSubStreamHandler::handleArea(AreaRecord* record)
 {
     if (!record || m_chart->m_impl) return;
     DEBUG << std::endl;
-    m_chart->m_impl = new Charting::AreaImpl();
+    m_chart->m_impl = new KoChart::AreaImpl();
     m_chart->m_stacked = record->isFStacked();
     m_chart->m_f100 = record->isF100();
 }
@@ -1097,15 +1097,15 @@ void ChartSubStreamHandler::handleLine(LineRecord* record)
 {
     if (!record || m_chart->m_impl) return;
     DEBUG << std::endl;
-    m_chart->m_impl = new Charting::LineImpl();
+    m_chart->m_impl = new KoChart::LineImpl();
     m_chart->m_stacked = record->isFStacked();
     m_chart->m_f100 = record->isF100();
     if ( !m_disableAutoMarker )
-        m_chart->m_markerType = Charting::AutoMarker;
-//     Q_FOREACH( const Charting::Series* const series, m_chart->m_series )
+        m_chart->m_markerType = KoChart::AutoMarker;
+//     Q_FOREACH( const KoChart::Series* const series, m_chart->m_series )
 //     {
-//         if ( series->m_markerType == Charting::Series::None )
-//             m_chart->m_markerType = Charting::NoMarker;
+//         if ( series->m_markerType == KoChart::Series::None )
+//             m_chart->m_markerType = KoChart::NoMarker;
 //     }
 }
 
@@ -1115,9 +1115,9 @@ void ChartSubStreamHandler::handleScatter(ScatterRecord* \
record)  if (!record || m_chart->m_impl) return;
     DEBUG << std::endl;
     if (record->isFBubbles())
-        m_chart->m_impl = new \
Charting::BubbleImpl(Charting::BubbleImpl::SizeType(record->wBubbleSize()), \
record->pcBubbleSizeRatio(), record->isFShowNegBubbles()); +        m_chart->m_impl = \
new KoChart::BubbleImpl(KoChart::BubbleImpl::SizeType(record->wBubbleSize()), \
record->pcBubbleSizeRatio(), record->isFShowNegBubbles());  else
-        m_chart->m_impl = new Charting::ScatterImpl();
+        m_chart->m_impl = new KoChart::ScatterImpl();
 
     // For scatter charts, one <chart:domain> element shall exist. Its \
                table:cell-range-address
     // attribute references the x coordinate values for the scatter chart.
@@ -1125,18 +1125,18 @@ void ChartSubStreamHandler::handleScatter(ScatterRecord* \
                record)
     // given by the first <chart:domain> element. The values for the x-coordinates \
are given by the  // second <chart:domain> element.
     QString x, y;
-    if (m_currentSeries->m_datasetValue.contains(Charting::Value::VerticalValues))
-        x = m_currentSeries->m_datasetValue[Charting::Value::VerticalValues]->m_formula;
                
-    if (m_currentSeries->m_datasetValue.contains(Charting::Value::HorizontalValues))
-        y = m_currentSeries->m_datasetValue[Charting::Value::HorizontalValues]->m_formula;
                
-    foreach(Charting::Series *series, m_chart->m_series) {
+    if (m_currentSeries->m_datasetValue.contains(KoChart::Value::VerticalValues))
+        x = m_currentSeries->m_datasetValue[KoChart::Value::VerticalValues]->m_formula;
 +    if (m_currentSeries->m_datasetValue.contains(KoChart::Value::HorizontalValues))
+        y = m_currentSeries->m_datasetValue[KoChart::Value::HorizontalValues]->m_formula;
 +    foreach(KoChart::Series *series, m_chart->m_series) {
         Q_ASSERT(series->m_domainValuesCellRangeAddress.isEmpty()); // what should \
we do if that happens?  if (!series->m_domainValuesCellRangeAddress.isEmpty())
             continue;
         if (record->isFBubbles()) {
             series->m_domainValuesCellRangeAddress << y << x;
-            if (series->m_datasetValue.contains(Charting::Value::BubbleSizeValues))
-                series->m_valuesCellRangeAddress = \
series->m_datasetValue[Charting::Value::BubbleSizeValues]->m_formula; +            if \
(series->m_datasetValue.contains(KoChart::Value::BubbleSizeValues)) +                \
series->m_valuesCellRangeAddress = \
                series->m_datasetValue[KoChart::Value::BubbleSizeValues]->m_formula;
             //m_chart->m_verticalCellRangeAddress = \
series->m_valuesCellRangeAddress;  } else {
             series->m_domainValuesCellRangeAddress << x;
@@ -1144,11 +1144,11 @@ void ChartSubStreamHandler::handleScatter(ScatterRecord* \
record)  }
 
     if ( !m_disableAutoMarker ) {
-        m_chart->m_markerType = Charting::AutoMarker;
+        m_chart->m_markerType = KoChart::AutoMarker;
     }
-    // Charting::ScatterImpl* impl = dynamic_cast< Charting::ScatterImpl* >( \
m_chart->m_impl ); +    // KoChart::ScatterImpl* impl = dynamic_cast< \
KoChart::ScatterImpl* >( m_chart->m_impl );  // if ( impl )
-    //     impl->style = Charting::ScatterImpl::Marker;
+    //     impl->style = KoChart::ScatterImpl::Marker;
 }
 
 // specifies that the chartgroup is a radar chart
@@ -1156,8 +1156,8 @@ void ChartSubStreamHandler::handleRadar(RadarRecord *record)
 {
     if (!record || m_chart->m_impl) return;
     DEBUG << std::endl;
-    m_chart->m_impl = new Charting::RadarImpl(false);
-    m_chart->m_markerType = Charting::AutoMarker;
+    m_chart->m_impl = new KoChart::RadarImpl(false);
+    m_chart->m_markerType = KoChart::AutoMarker;
 }
 
 // specifies that the chartgroup is a filled radar chart
@@ -1165,7 +1165,7 @@ void ChartSubStreamHandler::handleRadarArea(RadarAreaRecord \
*record)  {
     if (!record || m_chart->m_impl) return;
     DEBUG << std::endl;
-    m_chart->m_impl = new Charting::RadarImpl(true);
+    m_chart->m_impl = new KoChart::RadarImpl(true);
 }
 
 // specifies that the chartgroup is a surface chart
@@ -1173,14 +1173,14 @@ void ChartSubStreamHandler::handleSurf(SurfRecord *record)
 {
     if (!record || m_chart->m_impl) return;
     DEBUG << std::endl;
-    m_chart->m_impl = new Charting::SurfaceImpl(record->isFFillSurface());
+    m_chart->m_impl = new KoChart::SurfaceImpl(record->isFFillSurface());
 }
 
 void ChartSubStreamHandler::handleAxis(AxisRecord* record)
 {
     if (!record) return;
     DEBUG << "wType=" << record->wType() << std::endl;
-    Charting::Axis* axis = new \
Charting::Axis(Charting::Axis::Type(record->wType())); +    KoChart::Axis* axis = new \
KoChart::Axis(KoChart::Axis::Type(record->wType()));  m_chart->m_axes << axis;
     m_currentObj = axis;
 }
@@ -1255,7 +1255,7 @@ void ChartSubStreamHandler::handleObjectLink(ObjectLinkRecord \
*record)  if (!record) return;
     DEBUG << "wLinkObj=" << record->wLinkObj() << " wLinkVar1=" << \
record->wLinkVar1() << " wLinkVar2=" << record->wLinkVar2() << std::endl;  
-    Charting::Text *t = dynamic_cast<Charting::Text*>(m_currentObj);
+    KoChart::Text *t = dynamic_cast<KoChart::Text*>(m_currentObj);
     if (!t) return;         // if the current object is not text, just do nothing
 //    Q_ASSERT(t);          // if the current object is not text, terminate
 
@@ -1271,7 +1271,7 @@ void ChartSubStreamHandler::handleObjectLink(ObjectLinkRecord \
*record)  break;
         case ObjectLinkRecord::SeriesOrDatapoints: {
             if ((int)record->wLinkVar1() >= m_chart->m_series.count()) return;
-            //Charting::Series* series = m_chart->m_series[ record->wLinkVar1() ];
+            //KoChart::Series* series = m_chart->m_series[ record->wLinkVar1() ];
             if (record->wLinkVar2() == 0xFFFF) {
                 //TODO series->texts << t;
             } else {
@@ -1289,14 +1289,14 @@ void ChartSubStreamHandler::handlePlotArea(PlotAreaRecord \
*record)  {
     if (!record) return;
     DEBUG << std::endl;
-    m_currentObj = m_chart->m_plotArea = new Charting::PlotArea();
+    m_currentObj = m_chart->m_plotArea = new KoChart::PlotArea();
 }
 
 void ChartSubStreamHandler::handleValueRange(ValueRangeRecord *record)
 {
     if (!record) return;
     DEBUG << "fAutoMin=" << record->isFAutoMin() << " fAutoMax=" << \
record->isFAutoMax() << " fAutoMajor=" << record->isFAutoMajor() << " fAutoMinor=" << \
record->isFAutoMinor() << " fAutoCross=" << record->isFAutoCross() << " fLog=" << \
record->isFLog() << " fReversed=" << record->isFReversed() << " fMaxCross=" << \
                record->isFMaxCross() << std::endl;
-    if ( Charting::Axis *axis = dynamic_cast< Charting::Axis* > ( m_currentObj ) ) {
+    if ( KoChart::Axis *axis = dynamic_cast< KoChart::Axis* > ( m_currentObj ) ) {
         axis->m_reversed = record->isFReversed();
         axis->m_logarithmic = record->isFLog();
         axis->m_autoMinimum = record->isFAutoMin();
@@ -1339,10 +1339,10 @@ void ChartSubStreamHandler::handleCrtLine(CrtLineRecord \
*record)  //TODO
             break;
         case 0x0001: // High-Low lines around the data points of line and stock \
                chart groups.
-            if (Charting::LineImpl* line = \
dynamic_cast<Charting::LineImpl*>(m_chart->m_impl)) { +            if \
                (KoChart::LineImpl* line = \
                dynamic_cast<KoChart::LineImpl*>(m_chart->m_impl)) {
                 // It seems that a stockchart is always a linechart with a CrtLine \
record that defines High-Low lines.  delete line;
-                m_chart->m_impl = new Charting::StockImpl();
+                m_chart->m_impl = new KoChart::StockImpl();
             }
             break;
         case 0x0002: // Series lines connecting data points of stacked column and \
bar chart groups, and the primary pie to the secondary bar/pie of bar of pie and pie \
                of pie chart groups.
diff --git a/filters/sheets/excel/sidewinder/chartsubstreamhandler.h \
b/filters/sheets/excel/sidewinder/chartsubstreamhandler.h index d22c02b..06f12fb \
                100644
--- a/filters/sheets/excel/sidewinder/chartsubstreamhandler.h
+++ b/filters/sheets/excel/sidewinder/chartsubstreamhandler.h
@@ -31,7 +31,7 @@
 
 #include <QStack>
 
-namespace Charting
+namespace KoChart
 {
     class Chart;
     class Series;
@@ -63,19 +63,19 @@ private:
     SubStreamHandler* m_parentHandler;
     Sheet* m_sheet;
     ChartObject* m_chartObject;
-    Charting::Chart* m_chart;
+    KoChart::Chart* m_chart;
 
-    Charting::Series* m_currentSeries;
-    Charting::Obj* m_currentObj;
-    QStack<Charting::Obj*> m_stack;
-    QStack<Charting::Series*> m_seriesStack;
+    KoChart::Series* m_currentSeries;
+    KoChart::Obj* m_currentObj;
+    QStack<KoChart::Obj*> m_stack;
+    QStack<KoChart::Series*> m_seriesStack;
     std::vector<XFRecord> m_xfTable;
 
     class InternalDataCache;
     friend class InternalDataCache;
     InternalDataCache *m_internalDataCache;
 
-    //QMap<Charting::Obj*, int> m_defaultObjects;
+    //QMap<KoChart::Obj*, int> m_defaultObjects;
     int m_defaultTextId;
     int m_axisId;
     
diff --git a/filters/sheets/excel/sidewinder/objects.h \
b/filters/sheets/excel/sidewinder/objects.h index 5162cee..a72b2a1 100644
--- a/filters/sheets/excel/sidewinder/objects.h
+++ b/filters/sheets/excel/sidewinder/objects.h
@@ -130,9 +130,9 @@ private:
 class ChartObject : public Object
 {
 public:
-    Charting::Chart* m_chart;
+    KoChart::Chart* m_chart;
 
-    explicit ChartObject(unsigned long id) : Object(Chart, id), m_chart(new \
Charting::Chart) {} +    explicit ChartObject(unsigned long id) : Object(Chart, id), \
m_chart(new KoChart::Chart) {}  virtual ~ChartObject() { delete m_chart; }
     bool operator==(const ChartObject &other) const { return this == &other; }
     bool operator!=(const ChartObject &other) const { return ! (*this == other); }
diff --git a/filters/sheets/xlsx/CMakeLists.txt b/filters/sheets/xlsx/CMakeLists.txt
index 294f048..493fd00 100644
--- a/filters/sheets/xlsx/CMakeLists.txt
+++ b/filters/sheets/xlsx/CMakeLists.txt
@@ -1,6 +1,10 @@
 add_definitions(-DKDE_DEFAULT_DEBUG_AREA=30527)
 
-include_directories( ${KOMAIN_INCLUDES} ${CMAKE_SOURCE_DIR}/filters/libmsooxml )
+include_directories(${KOMAIN_INCLUDES}
+                    ${KOODF2_INCLUDES}           # For KoOdfChartWriter
+                    ${CMAKE_SOURCE_DIR}/filters/libmso
+                    ${CMAKE_SOURCE_DIR}/filters/libmsooxml
+)
 
 ########### next target ###############
 
@@ -15,8 +19,8 @@ set(xlsx2ods_PART_SRCS
     XlsxXmlChartReader.cpp
     XlsxXmlCommentsReader.cpp
     XlsxXmlTableReader.cpp
-    NumberFormatParser.cpp
-    ChartExport.cpp
+
+    XlsxChartOdfWriter.cpp
     FormulaParser.cpp
 )
 
@@ -24,7 +28,9 @@ kde4_add_plugin(calligra_filter_xlsx2ods ${xlsx2ods_PART_SRCS})
 
 target_link_libraries(
     calligra_filter_xlsx2ods
+    koodf2
     komsooxml
+    mso
     koodf
     komain
     calligrasheetscommon
diff --git a/filters/sheets/xlsx/ChartExport.cpp \
b/filters/sheets/xlsx/ChartExport.cpp deleted file mode 100644
index 0bafa8d..0000000
--- a/filters/sheets/xlsx/ChartExport.cpp
+++ /dev/null
@@ -1,1090 +0,0 @@
-/*
- *  Copyright (c) 2010 Sebastian Sauer <sebsauer@kdab.com>
- *  Copyright (c) 2010 Carlos Licea <carlos@kdab.com>
- *
- *  This library is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Lesser General Public License as published
- *  by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
- *
- *  You should have received a copy of the GNU Lesser General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "ChartExport.h"
-#include "NumberFormatParser.h"
-
-#include <KoStore.h>
-#include <KoXmlWriter.h>
-#include <KoOdfWriteStore.h>
-#include <KoStoreDevice.h>
-#include <KoGenStyles.h>
-#include <KoGenStyle.h>
-//#include <KoOdfNumberStyles.h>
-#include <kdebug.h>
-#include "XlsxXmlDrawingReader.h"
-#include "Charting.h"
-
-#include <algorithm>
-
-// Print the content of generated content.xml to the console for debugging purpose
-//#define CONTENTXML_DEBUG
-
-using namespace Charting;
-
-ChartExport::ChartExport(Charting::Chart* chart, const MSOOXML::DrawingMLTheme* \
                const theme)
-    : m_x(0), m_y(0), m_width(0), m_height(0), m_end_x(0), m_end_y(0), \
                m_chart(chart), m_theme(theme), sheetReplacement(true), paletteSet( \
                false )
-{
-    Q_ASSERT(m_chart);
-    m_drawLayer = false;
-}
-
-ChartExport::~ChartExport()
-{
-}
-
-// Takes a Excel cellrange and translates it into a ODF cellrange
-QString normalizeCellRange(QString range)
-{
-    if(range.startsWith('[') && range.endsWith(']')) {
-        range.remove(0, 1).chop(1);
-    }
-    range.remove('$');
-
-    const bool isPoint = !range.contains( ':' );
-    QRegExp regEx(isPoint ? "(|.*\\.|.*\\!)([A-Z0-9]+)" : \
                "(|.*\\.|.*\\!)([A-Z]+[0-9]+)\\:(|.*\\.|.*\\!)([A-Z0-9]+)");
-    if(regEx.indexIn(range) >= 0) {
-        range.clear();
-        QString sheetName = regEx.cap(1);
-        if(sheetName.endsWith(QLatin1Char('.')) || \
                sheetName.endsWith(QLatin1Char('!')))
-            sheetName.chop(1);
-        if(!sheetName.isEmpty())
-            range = sheetName + '.';
-        range += regEx.cap(2);
-        if(!isPoint)
-            range += ':' + regEx.cap(4);
-    }
-
-    return range;
-}
-
-bool ChartExport::saveIndex(KoXmlWriter* xmlWriter)
-{
-    if(!chart() || m_href.isEmpty())
-        return false;
-
-    // This because for presesentations the frame is done in read_graphicFrame
-    if (!m_drawLayer) {
-        xmlWriter->startElement("draw:frame");
-        // used in opendocumentpresentation for layers
-        //if(m_drawLayer)
-        //    xmlWriter->addAttribute("draw:layer", "layout");
-
-        // used in opendocumentspreadsheet to reference cells
-        if(!m_endCellAddress.isEmpty()) {
-            xmlWriter->addAttribute("table:end-cell-address", m_endCellAddress);
-            xmlWriter->addAttributePt("table:end-x", m_end_x);
-            xmlWriter->addAttributePt("table:end-y", m_end_y);
-        }
-
-        xmlWriter->addAttributePt("svg:x", m_x);
-        xmlWriter->addAttributePt("svg:y", m_y);
-        if(m_width > 0)
-            xmlWriter->addAttributePt("svg:width", m_width);
-        if(m_height > 0)
-            xmlWriter->addAttributePt("svg:height", m_height);
-    }
-    //xmlWriter->addAttribute("draw:z-index", "0");
-    xmlWriter->startElement("draw:object");
-    //TODO don't show on e.g. presenter
-    if(!m_notifyOnUpdateOfRanges.isEmpty())
-        xmlWriter->addAttribute("draw:notify-on-update-of-ranges", \
                m_notifyOnUpdateOfRanges);
-    xmlWriter->addAttribute("xlink:href", "./" + m_href);
-    xmlWriter->addAttribute("xlink:type", "simple");
-    xmlWriter->addAttribute("xlink:show", "embed");
-    xmlWriter->addAttribute("xlink:actuate", "onLoad");
-    xmlWriter->endElement(); // draw:object
-    if (!m_drawLayer) {
-        xmlWriter->endElement(); // draw:frame
-    }
-    return true;
-}
-
-QColor tintColor( const QColor & color, qreal tintfactor )
-{
-    QColor retColor;
-    const qreal  nonTindedPart = 1.0 - tintfactor;
-    qreal luminance = 0.0;
-    qreal sat = 0.0;
-    qreal hue = 0.0;
-    color.getHslF( &hue, &sat, &luminance );
-    luminance = luminance * tintfactor + nonTindedPart;
-    retColor.setHslF( hue, sat, luminance );
-//     const int tintedColor = 255 * nonTindedPart;
-//     retColor.setRed( tintedColor + tintfactor * color.red() );
-//     retColor.setGreen( tintedColor + tintfactor * color.green() );
-//     retColor.setBlue( tintedColor + tintfactor * color.blue() );
-    return retColor;
-}
-
-QColor ChartExport::calculateColorFromGradientStop ( const \
                Charting::Gradient::GradientStop& grad )
-{
-    QColor color = grad.knownColorValue;
-    if ( !grad.referenceColor.isEmpty() )
-        color = m_theme->colorScheme.value( grad.referenceColor )->value();
-    const int tintedColor = 255 * grad.tintVal / 100.0;
-    const qreal  nonTindedPart = 1.0 - grad.tintVal / 100.0;
-    color.setRed( tintedColor + nonTindedPart * color.red() );
-    color.setGreen( tintedColor + nonTindedPart * color.green() );
-    color.setBlue( tintedColor + nonTindedPart * color.blue() );
-    return color;
-}
-
-QString ChartExport::generateGradientStyle ( KoGenStyles& mainStyles, const \
                Charting::Gradient* grad )
-{
-    KoGenStyle gradStyle( KoGenStyle::GradientStyle );
-    gradStyle.addAttribute( "draw:style", "linear" );
-    QColor startColor = calculateColorFromGradientStop( grad->gradientStops.first() \
                );
-    QColor endColor = calculateColorFromGradientStop( grad->gradientStops.last() );
-    
-    gradStyle.addAttribute( "draw:start-color", startColor.name() );
-    gradStyle.addAttribute( "draw:end-color", endColor.name() );
-    gradStyle.addAttribute( "draw:angle", QString::number( grad->angle ) );
-    return mainStyles.insert( gradStyle, "ms_chart_gradient" );
-}
-
-QColor ChartExport::labelFontColor() const
-{
-    bool useTheme = !chart()->m_areaFormat && m_theme;
-    if ( useTheme ) {
-        // Following assumes that we just need to invert the in genChartAreaStyle \
                used font-color for the axis. It's
-        // not clear yet (means any documentation in the specs is missing) if that \
                is really correct thing to do.
-        const MSOOXML::DrawingMLColorScheme& colorScheme = m_theme->colorScheme;
-        switch( chart()->m_style ) {
-            case( 33 ):
-            case( 34 ):
-            case( 35 ):
-            case( 36 ):
-            case( 37 ):
-            case( 38 ):
-            case( 39 ):
-            case( 40 ): {
-                return colorScheme.value( "dk1" )->value();
-            } break;
-            case( 41 ):
-            case( 42 ):
-            case( 43 ):
-            case( 44 ):
-            case( 45 ):
-            case( 46 ):
-            case( 47 ):
-            case( 48 ): {
-                return colorScheme.value( "lt1" )->value();
-            } break;
-            default:
-                break;
-        }
-    }
-    return QColor();
-}
-
-QString ChartExport::genChartAreaStyle(KoGenStyle& style, KoGenStyles& styles, \
                KoGenStyles& mainStyles )
-{
-    if ( chart()->m_fillGradient ) {
-        style.addProperty( "draw:fill", "gradient", KoGenStyle::GraphicType );
-        style.addProperty( "draw:fill-gradient-name", generateGradientStyle( \
                mainStyles, chart()->m_fillGradient ), KoGenStyle::GraphicType );
-    } else {
-        style.addProperty( "draw:fill", "solid", KoGenStyle::GraphicType );
-        bool useTheme = !chart()->m_areaFormat && m_theme;
-        if ( useTheme ) {
-            const MSOOXML::DrawingMLColorScheme& colorScheme = m_theme->colorScheme;
-            switch( chart()->m_style ) {
-                case( 33 ):
-                case( 34 ):
-                case( 35 ):
-                case( 36 ):
-                case( 37 ):
-                case( 38 ):
-                case( 39 ):
-                case( 40 ): {
-                    style.addProperty( "draw:fill-color", colorScheme.value( "lt1" \
                )->value().name(), KoGenStyle::GraphicType );
-                } break;
-                case( 41 ):
-                case( 42 ):
-                case( 43 ):
-                case( 44 ):
-                case( 45 ):
-                case( 46 ):
-                case( 47 ):
-                case( 48 ): {
-                    style.addProperty( "draw:fill-color", colorScheme.value( "dk1" \
                )->value().name(), KoGenStyle::GraphicType );
-                } break;
-                default: {
-                    useTheme = false;
-                } break;
-            }
-        }
-        if ( !useTheme ) {
-            QColor color;
-            if ( chart()->m_areaFormat && chart()->m_areaFormat->m_fill && \
                chart()->m_areaFormat->m_foreground.isValid() )
-                color = chart()->m_areaFormat->m_foreground;
-            else
-                color = QColor("#FFFFFF");
-            style.addProperty( "draw:fill-color", color.name(), \
                KoGenStyle::GraphicType );
-            if ( color.alpha() < 255 )
-                style.addProperty( "draw:opacity", QString( "%1%" ).arg( \
                chart()->m_areaFormat->m_foreground.alphaF() * 100.0 ), \
                KoGenStyle::GraphicType );
-        }
-    }
-    return styles.insert( style, "ch" );
-}
-
-
-QString ChartExport::genChartAreaStyle( KoGenStyles& styles, KoGenStyles& mainStyles \
                )
-{
-    KoGenStyle style(KoGenStyle::GraphicAutoStyle, "chart");
-    return genChartAreaStyle( style, styles, mainStyles );
-}
-
-
-QString ChartExport::genPlotAreaStyle( KoGenStyle& style, KoGenStyles& styles, \
                KoGenStyles& mainStyles )
-{
-    Charting::AreaFormat *areaFormat = ( chart()->m_plotArea && \
chart()->m_plotArea->m_areaFormat && chart()->m_plotArea->m_areaFormat->m_fill ) ? \
                chart()->m_plotArea->m_areaFormat : chart()->m_areaFormat;
-    if ( chart()->m_plotAreaFillGradient ) {
-        style.addProperty( "draw:fill", "gradient", KoGenStyle::GraphicType );
-        style.addProperty( "draw:fill-gradient-name", generateGradientStyle( \
                mainStyles, chart()->m_plotAreaFillGradient ), \
                KoGenStyle::GraphicType );
-    } else {
-        style.addProperty( "draw:fill", "solid", KoGenStyle::GraphicType );
-        bool useTheme = !areaFormat && m_theme;
-        if ( useTheme ) {
-            const MSOOXML::DrawingMLColorScheme& colorScheme = m_theme->colorScheme;
-            switch( chart()->m_style ) {
-                case( 33 ):
-                case( 34 ): {
-                    style.addProperty( "draw:fill-color", tintColor( \
                colorScheme.value( "dk1" )->value(), 0.2 ).name(), \
                KoGenStyle::GraphicType );
-                } break;
-                case( 35 ):
-                case( 36 ):
-                case( 37 ):
-                case( 38 ):
-                case( 39 ):
-                case( 40 ): {
-                    QString prop = QString::fromLatin1( "accent%1" ).arg( \
                chart()->m_style - 34 );
-                    style.addProperty( "draw:fill-color", colorScheme.value( "dk1" \
                )->value().name(), KoGenStyle::GraphicType );
-                } break;
-                case( 41 ):
-                case( 42 ):
-                case( 43 ):
-                case( 44 ):
-                case( 45 ):
-                case( 46 ):
-                case( 47 ):
-                case( 48 ): {
-                    style.addProperty( "draw:fill-color", tintColor( \
                colorScheme.value( "dk1" )->value(), 0.95 ).name(), \
                KoGenStyle::GraphicType );
-                } break;
-                default: {
-                    useTheme = false;
-                } break;
-            }
-        }
-        if ( !useTheme ) {
-            QColor color;
-            if ( areaFormat && areaFormat->m_foreground.isValid() )
-                color = areaFormat->m_foreground;
-            else
-                color = QColor(paletteSet ? "#C0C0C0" : "#FFFFFF");
-            style.addProperty( "draw:fill-color", color.name(), \
                KoGenStyle::GraphicType );
-            if ( color.alpha() < 255 )
-                style.addProperty( "draw:opacity", QString( "%1%" ).arg( \
                areaFormat->m_foreground.alphaF() * 100.0 ), KoGenStyle::GraphicType \
                );
-        }
-    }
-    return styles.insert( style, "ch" );
-}
-
-
-void ChartExport::addShapePropertyStyle( /*const*/ Charting::Series* series, \
                KoGenStyle& style, KoGenStyles& /*mainStyles*/ )
-{
-    Q_ASSERT( series );
-    bool marker = false;
-    Charting::ScatterImpl* impl = dynamic_cast< Charting::ScatterImpl* >( \
                m_chart->m_impl );
-    if ( impl )
-        marker = impl->style == Charting::ScatterImpl::Marker || impl->style == \
                Charting::ScatterImpl::LineMarker;
-    if ( series->spPr->lineFill.valid )
-    {
-        if ( series->spPr->lineFill.type == Charting::Fill::Solid )
-        {
-            style.addProperty( "draw:stroke", "solid", KoGenStyle::GraphicType );
-            style.addProperty( "svg:stroke-color", \
                series->spPr->lineFill.solidColor.name(), KoGenStyle::GraphicType );
-        }
-        else if ( series->spPr->lineFill.type == Charting::Fill::None )
-            style.addProperty( "draw:stroke", "none", KoGenStyle::GraphicType );
-    }
-    else if (   (paletteSet && m_chart->m_impl->name() != "scatter")
-             || m_chart->m_showLines )
-    {
-        const int curSerNum = m_chart->m_series.indexOf( series );
-        style.addProperty( "draw:stroke", "solid", KoGenStyle::GraphicType );
-        style.addProperty( "svg:stroke-color", m_palette.at( 24 + curSerNum \
                ).name(), KoGenStyle::GraphicType );
-    }
-    else if ( paletteSet && m_chart->m_impl->name() == "scatter" )
-        style.addProperty( "draw:stroke", "none", KoGenStyle::GraphicType );
-    if ( series->spPr->areaFill.valid )
-    {
-        if ( series->spPr->areaFill.type == Charting::Fill::Solid )
-        {
-            style.addProperty( "draw:fill", "solid", KoGenStyle::GraphicType );
-            style.addProperty( "draw:fill-color", \
                series->spPr->areaFill.solidColor.name(), KoGenStyle::GraphicType );
-        }
-        else if ( series->spPr->areaFill.type == Charting::Fill::None )
-            style.addProperty( "draw:fill", "none", KoGenStyle::GraphicType );
-    }
-    else if ( paletteSet && !( m_chart->m_markerType != Charting::NoMarker || marker \
                ) && series->m_markerType == Charting::NoMarker )
-    {
-        const int curSerNum = m_chart->m_series.indexOf( series ) % 8;
-        style.addProperty( "draw:fill", "solid", KoGenStyle::GraphicType );
-        style.addProperty( "draw:fill-color", m_palette.at( 16 + curSerNum ).name(), \
                KoGenStyle::GraphicType );
-    }
-}
-
-QString ChartExport::genPlotAreaStyle( KoGenStyles& styles, KoGenStyles& mainStyles \
                )
-{
-    KoGenStyle style(KoGenStyle::ChartAutoStyle/*, "chart"*/);
-    return genPlotAreaStyle( style, styles, mainStyles );
-}
-
-QString replaceSheet( const QString &originalString, const QString &replacementSheet \
                )
-{
-    QStringList split = originalString.split( QLatin1Char('!') );
-    split[0] = replacementSheet;
-    return split.join( QString::fromLatin1( "!" ) );
-}
-
-void ChartExport::set2003ColorPalette( QList < QColor > palette )
-{
-    m_palette = palette;
-    paletteSet = true;
-}
-
-QString markerType(Charting::MarkerType type, int currentSeriesNumber)
-{
-    QString markerName;
-    switch(type) {
-        case NoMarker:
-            break;
-        case AutoMarker: { // auto marker type
-            const int resNum = currentSeriesNumber % 3;
-            if ( resNum == 0 )
-                markerName = "square";
-            else if ( resNum == 1 )
-                markerName = "diamond";
-            else if ( resNum == 2 )
-                markerName = "circle";
-        } break;
-        case SquareMarker:
-            markerName = "square";
-            break;
-        case DiamondMarker:
-            markerName = "diamond";
-            break;
-        case StarMarker:
-            markerName = "star";
-            break;
-        case TriangleMarker:
-            markerName = "arrow-up";
-            break;
-        case DotMarker:
-            markerName = "dot";
-            break;
-        case PlusMarker:
-            markerName = "plus";
-            break;
-        case SymbolXMarker:
-            markerName = "x";
-            break;
-        case CircleMarker:
-            markerName = "circle";
-            break;
-        case DashMarker:
-            markerName = "horizontal-bar";
-            break;
-    }
-    return markerName;
-}
-
-bool ChartExport::saveContent(KoStore* store, KoXmlWriter* manifestWriter)
-{
-    if(!chart() || !chart()->m_impl || m_href.isEmpty())
-        return false;
-    
-    KoGenStyles styles;
-    KoGenStyles mainStyles;
-
-    store->pushDirectory();
-    store->enterDirectory(m_href);
-
-    KoOdfWriteStore s(store);
-    KoXmlWriter* bodyWriter = s.bodyWriter();
-    KoXmlWriter* contentWriter = s.contentWriter();
-    Q_ASSERT(bodyWriter && contentWriter);
-    bodyWriter->startElement("office:body");
-    bodyWriter->startElement("office:chart");
-    bodyWriter->startElement("chart:chart"); //<chart:chart svg:width="8cm" \
                svg:height="7cm" chart:class="chart:circle" chart:style-name="ch1">
-
-    if (!chart()->m_impl->name().isEmpty()) {
-        bodyWriter->addAttribute("chart:class", "chart:" + chart()->m_impl->name());
-    }
-
-    if(m_width > 0) {
-        bodyWriter->addAttributePt("svg:width", m_width);
-    }
-    if(m_height > 0) {
-        bodyWriter->addAttributePt("svg:height", m_height);
-    }
-    
-    bodyWriter->addAttribute("chart:style-name", genChartAreaStyle( styles, \
                mainStyles ) );
-
-    //<chart:title svg:x="5.618cm" svg:y="0.14cm" chart:style-name="ch2"><text:p>PIE \
                CHART</text:p></chart:title>
-    if ( !chart()->m_title.isEmpty() ) {
-        bodyWriter->startElement( "chart:title" );
-        /* TODO we can't determine this because by default we need to center the \
                title,
-        in order to center it we need to know the textbox size, and to do that we \
                need
-        the used font metrics.
-
-        Also, for now, the default implementation of KChart centers
-        the title, so we get close to the expected behavior. We ignore any offset \
                though.
-
-        Nonetheless, the formula should be something like this:
-        const int widht = m_width/2 - textWidth/2 + sprcToPt(t->m_x1, vertical);
-        const int height = m_height/2 - textHeight/2 + sprcToPt(t->m_y1, \
                horizontal);
-        bodyWriter->addAttributePt("svg:x", width );
-        bodyWriter->addAttributePt("svg:y", height);
-        */
-
-        //NOTE don't load width or height, the record MUST be ignored and determined \
                by the application
-        //see [MS-XLS] p. 362
-
-        bodyWriter->startElement( "text:p" );
-        bodyWriter->addTextNode( chart()->m_title );
-        bodyWriter->endElement(); // text:p
-        bodyWriter->endElement(); // chart:title
-    }
-
-    if (chart()->m_legend) {
-        bodyWriter->startElement("chart:legend");
-        bodyWriter->addAttribute("chart:legend-position", "end");
-
-        KoGenStyle legendstyle(KoGenStyle::ChartAutoStyle, "chart");
-
-        QColor labelColor = labelFontColor();
-        if (labelColor.isValid())
-            legendstyle.addProperty( "fo:font-color", labelColor.name(), \
                KoGenStyle::TextType );
-
-        bodyWriter->addAttribute( "chart:style-name", styles.insert( legendstyle, \
                "lg" ) );
-
-        bodyWriter->endElement(); // chart:legend
-    }
-
-    bodyWriter->startElement("chart:plot-area"); //<chart:plot-area \
chart:style-name="ch3" table:cell-range-address="Sheet1.C2:Sheet1.E2" svg:x="0.16cm" \
                svg:y="0.14cm"
-
-    if( chart()->m_is3d) {
-        //bodyWriter->addAttribute("dr3d:transform", "matrix (0.893670830886674 \
0.102940425033731 -0.436755898547686 -0.437131441492021 0.419523087196176 \
-0.795560483036015 0.101333848646097 0.901888933407692 0.419914042293545 0cm 0cm \
                0cm)");
-        //bodyWriter->addAttribute("dr3d:vrp", "(12684.722548717 7388.35827488833 \
                17691.2795565958)");
-        //bodyWriter->addAttribute("dr3d:vpn", "(0.416199821709347 0.173649045905254 \
                0.892537795986984)");
-        //bodyWriter->addAttribute("dr3d:vup", "(-0.0733876362771618 \
                0.984807599917971 -0.157379306090273)");
-        //bodyWriter->addAttribute("dr3d:projection", "parallel");
-        //bodyWriter->addAttribute("dr3d:distance", "4.2cm");
-        //bodyWriter->addAttribute("dr3d:focal-length", "8cm");
-        //bodyWriter->addAttribute("dr3d:shadow-slant", "0");
-        //bodyWriter->addAttribute("dr3d:shade-mode", "flat");
-        //bodyWriter->addAttribute("dr3d:ambient-color", "#b3b3b3");
-        //bodyWriter->addAttribute("dr3d:lighting-mode", "true");
-    }
-
-    KoGenStyle chartstyle(KoGenStyle::ChartAutoStyle, "chart");
-    //chartstyle.addProperty("chart:connect-bars", "false");
-    //chartstyle.addProperty("chart:include-hidden-cells", "false");
-    chartstyle.addProperty("chart:auto-position", "true");
-    chartstyle.addProperty("chart:auto-size", "true");
-    chartstyle.addProperty("chart:angle-offset", chart()->m_angleOffset);
-
-    //chartstyle.addProperty("chart:series-source", "rows");
-    //chartstyle.addProperty("chart:sort-by-x-values", "false");
-    //chartstyle.addProperty("chart:right-angled-axes", "true");
-    if( chart()->m_is3d) {
-        chartstyle.addProperty("chart:three-dimensional", "true");
-    }
-    //chartstyle.addProperty("chart:angle-offset", "90");
-    //chartstyle.addProperty("chart:series-source", "rows");
-    //chartstyle.addProperty("chart:right-angled-axes", "false");
-    if( chart()->m_transpose ) {
-        chartstyle.addProperty("chart:vertical", "true");
-    }
-    if( chart()->m_stacked ) {
-        chartstyle.addProperty("chart:stacked", "true");
-    }
-    if( chart()->m_f100 ) {
-        chartstyle.addProperty("chart:percentage", "true");
-    }
-    bodyWriter->addAttribute("chart:style-name", genPlotAreaStyle( chartstyle, \
                styles, mainStyles ) );
-
-    QString verticalCellRangeAddress = chart()->m_verticalCellRangeAddress;
-// FIXME microsoft treats the regions from this area in a different order, so don't \
                use it or x and y values will be switched
-//     if( !chart()->m_cellRangeAddress.isEmpty() ) {
-//         if ( sheetReplacement )
-//             bodyWriter->addAttribute( "table:cell-range-address", replaceSheet( \
normalizeCellRange( m_cellRangeAddress ), QString::fromLatin1( "local" ) ) ); \
                //"Sheet1.C2:Sheet1.E5");
-//         else
-//             bodyWriter->addAttribute( "table:cell-range-address", \
                normalizeCellRange( m_cellRangeAddress ) ); //"Sheet1.C2:Sheet1.E5");
-//     }
-
-    /*FIXME
-    if(verticalCellRangeAddress.isEmpty()) {
-        // only add the chart:data-source-has-labels if no chart:categories with a \
                table:cell-range-address was defined within an axis.
-        bodyWriter->addAttribute("chart:data-source-has-labels", "both");
-    }
-    */
-
-    //bodyWriter->addAttribute("svg:x", "0.16cm"); //FIXME
-    //bodyWriter->addAttribute("svg:y", "0.14cm"); //FIXME
-    //bodyWriter->addAttribute("svg:width", "6.712cm"); //FIXME
-    //bodyWriter->addAttribute("svg:height", "6.58cm"); //FIXME
-
-    const bool definesCategories = chart()->m_impl->name() != "scatter"; // scatter \
                charts are using domains
-    int countXAxis = 0;
-    int countYAxis = 0;
-    foreach(Charting::Axis* axis, chart()->m_axes) {
-        //TODO handle series-axis
-        if(axis->m_type == Charting::Axis::SeriesAxis) continue;
-
-        bodyWriter->startElement("chart:axis");
-
-        KoGenStyle axisstyle(KoGenStyle::ChartAutoStyle, "chart");
-
-        if (axis->m_reversed)
-            axisstyle.addProperty( "chart:reverse-direction", "true", \
                KoGenStyle::ChartType );
-
-        //FIXME this hits an infinite-looping bug in kdchart it seems... maybe fixed \
                with a newer version
-//         if (axis->m_logarithmic)
-//             axisstyle.addProperty( "chart:logarithmic", "true", \
                KoGenStyle::ChartType );
-
-        if (!axis->m_autoMinimum)
-            axisstyle.addProperty( "chart:minimum", QString::number(axis->m_minimum, \
                'f'), KoGenStyle::ChartType );
-        if (!axis->m_autoMaximum)
-            axisstyle.addProperty( "chart:maximum", QString::number(axis->m_maximum, \
                'f'), KoGenStyle::ChartType );
-
-        axisstyle.addProperty( "fo:font-size", QString( "%0pt" ).arg( \
                chart()->m_textSize ), KoGenStyle::TextType );
-
-        QColor labelColor = labelFontColor();
-        if (labelColor.isValid())
-            axisstyle.addProperty( "fo:font-color", labelColor.name(), \
                KoGenStyle::TextType );
-
-        if (!axis->m_numberFormat.isEmpty()) {
-            const KoGenStyle style = NumberFormatParser::parse( \
                axis->m_numberFormat, &styles );
-            axisstyle.addAttribute( "style:data-style-name", styles.insert( style, \
                "ds" ) );
-        }
-
-        bodyWriter->addAttribute( "chart:style-name", styles.insert( axisstyle, "ch" \
                ) );
-
-        switch(axis->m_type) {
-            case Charting::Axis::VerticalValueAxis:
-                bodyWriter->addAttribute("chart:dimension", "y");
-                bodyWriter->addAttribute("chart:name", \
                QString("y%1").arg(++countYAxis));
-                break;
-            case Charting::Axis::HorizontalValueAxis:
-                bodyWriter->addAttribute("chart:dimension", "x");
-                bodyWriter->addAttribute("chart:name", \
                QString("x%1").arg(++countXAxis));
-                if(countXAxis == 1 && definesCategories && \
                !verticalCellRangeAddress.isEmpty()) {
-                    bodyWriter->startElement("chart:categories");
-                    if ( sheetReplacement )
-                        verticalCellRangeAddress = normalizeCellRange( replaceSheet( \
                verticalCellRangeAddress, QString::fromLatin1( "local" ) ) );
-                    else
-                        verticalCellRangeAddress = normalizeCellRange( \
                verticalCellRangeAddress );
-                    bodyWriter->addAttribute("table:cell-range-address", \
                verticalCellRangeAddress); //"Sheet1.C2:Sheet1.E2");
-                    bodyWriter->endElement();
-                }
-                break;
-            default: break;
-        }
-        if(axis->m_majorGridlines.m_format.m_style != Charting::LineFormat::None) {
-            bodyWriter->startElement("chart:grid");
-            bodyWriter->addAttribute("chart:class", "major");
-            bodyWriter->endElement(); // chart:grid
-        }
-        if(axis->m_minorGridlines.m_format.m_style != Charting::LineFormat::None) {
-            bodyWriter->startElement("chart:grid");
-            bodyWriter->addAttribute("chart:class", "minor");
-            bodyWriter->endElement(); // chart:grid
-        }
-        bodyWriter->endElement(); // chart:axis
-    }
-    if(countXAxis == 0) { // add at least one x-axis
-        bodyWriter->startElement("chart:axis");
-        bodyWriter->addAttribute("chart:dimension", "x");
-        bodyWriter->addAttribute("chart:name", "primary-x");
-        if(definesCategories && !verticalCellRangeAddress.isEmpty()) {
-            bodyWriter->startElement("chart:categories");
-            if ( sheetReplacement )
-                verticalCellRangeAddress = normalizeCellRange( replaceSheet( \
                verticalCellRangeAddress, QString::fromLatin1( "local" ) ) );
-            else
-                verticalCellRangeAddress = normalizeCellRange( \
                verticalCellRangeAddress );
-            bodyWriter->addAttribute("table:cell-range-address", \
                verticalCellRangeAddress);
-            bodyWriter->endElement();
-        }
-        bodyWriter->endElement(); // chart:axis
-    }
-    if(countYAxis == 0) { // add at least one y-axis
-        bodyWriter->startElement("chart:axis");
-        bodyWriter->addAttribute("chart:dimension", "y");
-        bodyWriter->addAttribute("chart:name", "primary-y");
-        bodyWriter->endElement(); // chart:axis
-    }
-
-    //<chart:axis chart:dimension="x" chart:name="primary-x" \
                chart:style-name="ch4"/>
-    //<chart:axis chart:dimension="y" chart:name="primary-y" \
chart:style-name="ch5"><chart:grid chart:style-name="ch6" \
                chart:class="major"/></chart:axis>
-
-    //NOTE the XLS format specifies that if an explodeFactor that is > 100 is found,
-    //we should find the biggest and make it 100, then scale all the other factors \
                accordingly
-    //see 2.4.195 PieFormat
-    int maxExplode = 100;
-    foreach(Charting::Series* series, chart()->m_series) {
-        foreach(Charting::Format* f, series->m_datasetFormat) {
-            if(Charting::PieFormat* pieformat = \
                dynamic_cast<Charting::PieFormat*>(f)) {
-                if(pieformat->m_pcExplode > 0) {
-                    maxExplode = qMax(maxExplode, pieformat->m_pcExplode);
-                }
-            }
-        }
-    }
-
-    // area diagrams are special in that Excel does display the areas in another \
                order then OpenOffice.org and
-    // KSpread. To be sure the same areas are visible we do the same OpenOffice.org \
                does and reverse the order.
-    if(chart()->m_impl->name() == "area") {
-        for(int i = chart()->m_series.count() - 1; i >= 0; --i) {
-            chart()->m_series.append( chart()->m_series.takeAt(i) );
-        }
-    }
-
-    int curSerNum = 0;
-    bool lines = true;
-    bool marker = false;
-    
-    Q_FOREACH(Charting::Series* series, chart()->m_series) {
-        lines = true;
-        if ( chart()->m_impl->name() == "scatter" && !paletteSet )
-        {            
-            Charting::ScatterImpl* impl = static_cast< Charting::ScatterImpl* >( \
                chart()->m_impl );
-            lines = impl->style == Charting::ScatterImpl::Line || impl->style == \
                Charting::ScatterImpl::LineMarker;
-            marker = impl->style == Charting::ScatterImpl::Marker || impl->style == \
                Charting::ScatterImpl::LineMarker;
-        }
-        const bool noLineFill = ( series->spPr != 0 ) && series->spPr->lineFill.type \
                == Charting::Fill::None;
-        lines = lines && !noLineFill;
-        lines = lines || m_chart->m_showLines;
-        
-        bodyWriter->startElement("chart:series"); //<chart:series \
chart:style-name="ch7" chart:values-cell-range-address="Sheet1.C2:Sheet1.E2" \
                chart:class="chart:circle">
-        KoGenStyle seriesstyle(KoGenStyle::GraphicAutoStyle, "chart");
-        if ( series->spPr )
-            addShapePropertyStyle( series, seriesstyle, mainStyles );
-        else if ( lines && paletteSet )
-        {
-            lines = false;
-            seriesstyle.addProperty( "draw:stroke", "solid", KoGenStyle::GraphicType \
                );      
-            seriesstyle.addProperty( "svg:stroke-color", m_palette.at( 24 + \
                curSerNum ).name(), KoGenStyle::GraphicType );
-        }
-        if ( paletteSet && m_chart->m_impl->name() != "ring" && \
                m_chart->m_impl->name() != "circle" )
-        {
-            if ( series->m_markerType == Charting::NoMarker && m_chart->m_markerType \
                == Charting::NoMarker && !marker )
-            {
-              seriesstyle.addProperty( "draw:fill", "solid", KoGenStyle::GraphicType \
                );
-              seriesstyle.addProperty( "draw:fill-color", m_palette.at( 16 + \
                curSerNum ).name(), KoGenStyle::GraphicType );
-            }
-        }
-        if ( series->m_markerType != Charting::NoMarker )
-        {
-            QString markerName = markerType(series->m_markerType, curSerNum);
-            if (!markerName.isEmpty()) {
-                seriesstyle.addProperty( "chart:symbol-type", "named-symbol", \
                KoGenStyle::ChartType );
-                seriesstyle.addProperty( "chart:symbol-name", markerName, \
                KoGenStyle::ChartType );
-            }
-        }
-        else if ( m_chart->m_markerType != Charting::NoMarker || marker )
-        {
-            QString markerName = markerType(m_chart->m_markerType == \
                Charting::NoMarker ? Charting::AutoMarker : m_chart->m_markerType, \
                curSerNum);
-            if (!markerName.isEmpty()) {
-                seriesstyle.addProperty( "chart:symbol-type", "named-symbol", \
                KoGenStyle::ChartType );
-                seriesstyle.addProperty( "chart:symbol-name", markerName, \
                KoGenStyle::ChartType );
-            }
-        }
-
-        if ( chart()->m_impl->name() != "circle" && chart()->m_impl->name() != \
                "ring" )
-            addDataThemeToStyle( seriesstyle, curSerNum, chart()->m_series.count(), \
                lines );
-        //seriesstyle.addProperty("draw:stroke", "solid");
-        //seriesstyle.addProperty("draw:fill-color", "#ff0000");
-
-        foreach(Charting::Format* f, series->m_datasetFormat) {
-            if(Charting::PieFormat* pieformat = \
                dynamic_cast<Charting::PieFormat*>(f)) {
-                if(pieformat->m_pcExplode > 0) {
-                    //Note that 100.0/maxExplode will yield 1.0 most of the time, \
                that's why do that division first
-                    const int pcExplode = (int)((float)pieformat->m_pcExplode * \
                (100.0 / (float)maxExplode));
-                    seriesstyle.addProperty("chart:pie-offset", pcExplode, \
                KoGenStyle::ChartType);
-                }
-            }
-        }
-
-        if ( series->m_showDataLabelValues && series->m_showDataLabelPercent ) {
-            seriesstyle.addProperty( "chart:data-label-number", \
                "value-and-percentage", KoGenStyle::ChartType );
-        } else if ( series->m_showDataLabelValues ) {
-            seriesstyle.addProperty( "chart:data-label-number", "value", \
                KoGenStyle::ChartType );
-        } else if ( series->m_showDataLabelPercent ) {
-            seriesstyle.addProperty( "chart:data-label-number", "percentage", \
                KoGenStyle::ChartType );
-        }
-        if ( series->m_showDataLabelCategory ) {
-            seriesstyle.addProperty( "chart:data-label-text", "true", \
                KoGenStyle::ChartType );
-        }
-        //seriesstyle.addProperty( "chart:data-label-symbol", "true", \
                KoGenStyle::ChartType );
-
-        if (!series->m_numberFormat.isEmpty()) {
-            const KoGenStyle style = NumberFormatParser::parse( \
                series->m_numberFormat, &styles );
-            seriesstyle.addAttribute( "style:data-style-name", styles.insert( style, \
                "ds" ) );
-        }
-
-        bodyWriter->addAttribute("chart:style-name", styles.insert(seriesstyle, \
                "ch"));
-
-        // ODF does not support custom labels so we depend on the \
                SeriesLegendOrTrendlineName being defined
-        // and to point to a valid cell to be able to display custom labels.
-        if(series->m_datasetValue.contains(Charting::Value::SeriesLegendOrTrendlineName)) \
                {
-            Charting::Value* v = \
                series->m_datasetValue[Charting::Value::SeriesLegendOrTrendlineName];
-            if(!v->m_formula.isEmpty()) {
-                bodyWriter->addAttribute("chart:label-cell-address", v->m_type == \
                Charting::Value::CellRange ? normalizeCellRange(v->m_formula) : \
                v->m_formula);
-            }
-        }
-        if (!series->m_labelCell.isEmpty()) {
-            QString labelAddress = series->m_labelCell;
-            if ( sheetReplacement )
-                labelAddress = normalizeCellRange( replaceSheet( labelAddress, \
                QString::fromLatin1( "local" ) ) );
-            else
-                labelAddress = normalizeCellRange( labelAddress );
-            bodyWriter->addAttribute("chart:label-cell-address", labelAddress );
-        }
-
-        QString valuesCellRangeAddress;
-        if ( sheetReplacement )
-            valuesCellRangeAddress = normalizeCellRange( replaceSheet( \
                series->m_valuesCellRangeAddress, QString::fromLatin1( "local" ) ) );
-        else
-            valuesCellRangeAddress = normalizeCellRange( \
                series->m_valuesCellRangeAddress );
-        
-        if(!valuesCellRangeAddress.isEmpty()) {
-            bodyWriter->addAttribute("chart:values-cell-range-address", \
                valuesCellRangeAddress); //"Sheet1.C2:Sheet1.E2");
-        }
-        else if (!series->m_domainValuesCellRangeAddress.isEmpty()) {
-            bodyWriter->addAttribute("chart:values-cell-range-address", \
                series->m_domainValuesCellRangeAddress.last()); \
                //"Sheet1.C2:Sheet1.E2");
-        }
-        bodyWriter->addAttribute("chart:class", "chart:" + chart()->m_impl->name());
-
-//         if(chart()->m_impl->name() == "scatter") {
-//             bodyWriter->startElement("chart:domain");
-//             bodyWriter->addAttribute("table:cell-range-address", \
                verticalCellRangeAddress); //"Sheet1.C2:Sheet1.E5");
-//             bodyWriter->endElement();
-//         } else if (chart()->m_impl->name() == "bubble" ){
-            QString domainRange;
-            Q_FOREACH( const QString& curRange, \
                series->m_domainValuesCellRangeAddress ){
-                bodyWriter->startElement("chart:domain");
-                if ( sheetReplacement )
-                    domainRange = normalizeCellRange( replaceSheet( curRange, \
                QString::fromLatin1( "local" ) ) );
-                else
-                    domainRange = normalizeCellRange( curRange );
-                if ( !domainRange.isEmpty() )
-                    bodyWriter->addAttribute( "table:cell-range-address", \
                domainRange );
-                bodyWriter->endElement();
-            }
-//             if ( series->m_domainValuesCellRangeAddress.count() == 1 ){
-//                 bodyWriter->startElement("chart:domain");
-//                 bodyWriter->addAttribute("table:cell-range-address", \
                series->m_domainValuesCellRangeAddress.last()); \
                //"Sheet1.C2:Sheet1.E5");
-//                 bodyWriter->endElement();
-//             }
-//             if ( series->m_domainValuesCellRangeAddress.isEmpty() ){
-//                 bodyWriter->startElement("chart:domain");
-//                 bodyWriter->addAttribute("table:cell-range-address", \
                series->m_valuesCellRangeAddress); //"Sheet1.C2:Sheet1.E5");
-//                 bodyWriter->endElement();
-//                 bodyWriter->startElement("chart:domain");
-//                 bodyWriter->addAttribute("table:cell-range-address", \
                series->m_valuesCellRangeAddress); //"Sheet1.C2:Sheet1.E5");
-//                 bodyWriter->endElement();
-//             }
-//         }
-
-        for(int j = 0; j < series->m_countYValues; ++j) {
-            bodyWriter->startElement("chart:data-point");
-            KoGenStyle gs(KoGenStyle::GraphicAutoStyle, "chart");
-
-            if ( chart()->m_impl->name() == "circle" || chart()->m_impl->name() == \
                "ring" ) {
-                QColor fillColor;
-                if ( j < series->m_dataPoints.count() ) {
-                    Charting::DataPoint *dataPoint = series->m_dataPoints[j];
-                    if ( dataPoint->m_areaFormat ) {
-                        fillColor = dataPoint->m_areaFormat->m_foreground;
-                    }
-                }
-                if ( fillColor.isValid() ) {
-                    gs.addProperty( "draw:fill", "solid", KoGenStyle::GraphicType );
-                    gs.addProperty( "draw:fill-color", fillColor.name(), \
                KoGenStyle::GraphicType );
-                }
-                else if ( series->m_markerType == Charting::NoMarker && \
                m_chart->m_markerType == Charting::NoMarker && !marker ) {
-                    if ( paletteSet ) {
-                        gs.addProperty( "draw:fill", "solid", \
                KoGenStyle::GraphicType );
-                        gs.addProperty( "draw:fill-color", m_palette.at( 16 + j \
                ).name(), KoGenStyle::GraphicType );
-                    }
-                    else {
-                        addDataThemeToStyle( gs, j, series->m_countYValues, lines );
-                    }
-                }
-            }/*
-            else
-            {
-                addSeriesThemeToStyle( gs, curSerNum, chart()->m_series.count() );
-            }*/
-
-            //gs.addProperty("chart:solid-type", "cuboid", KoGenStyle::ChartType);
-            //gs.addProperty("draw:fill-color",j==0?"#004586":j==1?"#ff420e":"#ffd320", \
                KoGenStyle::GraphicType);
-            bodyWriter->addAttribute("chart:style-name", styles.insert(gs, "ch"));
-
-            Q_FOREACH(Charting::Text* t, series->m_texts) {
-                bodyWriter->startElement("chart:data-label");
-                bodyWriter->startElement("text:p");
-                bodyWriter->addTextNode(t->m_text);
-                bodyWriter->endElement();
-                bodyWriter->endElement();
-            }
-
-            bodyWriter->endElement();
-        }
-        
-        ++curSerNum;
-        bodyWriter->endElement(); // chart:series
-    }
-
-    bodyWriter->startElement("chart:wall");
-    bodyWriter->endElement(); // chart:wall
-
-    bodyWriter->startElement("chart:floor");
-    bodyWriter->endElement(); // chart:floor
-
-    bodyWriter->endElement(); // chart:plot-area
-
-    writeInternalTable( bodyWriter );
-
-    bodyWriter->endElement(); // chart:chart
-    bodyWriter->endElement(); // office:chart
-    bodyWriter->endElement(); // office:body
-
-#ifdef CONTENTXML_DEBUG
-    qDebug() << bodyWriter->toString();
-#endif
-
-    styles.saveOdfStyles(KoGenStyles::DocumentAutomaticStyles, contentWriter);
-    s.closeContentWriter();
-
-    if (store->open("styles.xml")) {
-        KoStoreDevice dev(store);
-        KoXmlWriter* stylesWriter = new KoXmlWriter(&dev);
-        stylesWriter->startDocument("office:document-styles");
-        stylesWriter->startElement("office:document-styles");
-        stylesWriter->addAttribute("xmlns:office", \
                "urn:oasis:names:tc:opendocument:xmlns:office:1.0");
-        stylesWriter->addAttribute("xmlns:style", \
                "urn:oasis:names:tc:opendocument:xmlns:style:1.0");
-        stylesWriter->addAttribute("xmlns:text", \
                "urn:oasis:names:tc:opendocument:xmlns:text:1.0");
-        stylesWriter->addAttribute("xmlns:table", \
                "urn:oasis:names:tc:opendocument:xmlns:table:1.0");
-        stylesWriter->addAttribute("xmlns:draw", \
                "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0");
-        stylesWriter->addAttribute("xmlns:fo", \
                "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0");
-        stylesWriter->addAttribute("xmlns:svg", \
                "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0");
-        stylesWriter->addAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink");
-        stylesWriter->addAttribute("xmlns:chart", \
                "urn:oasis:names:tc:opendocument:xmlns:chart:1.0");
-        stylesWriter->addAttribute("xmlns:dc", "http://purl.org/dc/elements/1.1/");
-        stylesWriter->addAttribute("xmlns:meta", \
                "urn:oasis:names:tc:opendocument:xmlns:meta:1.0");
-        stylesWriter->addAttribute("xmlns:number", \
                "urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0");
-        stylesWriter->addAttribute("xmlns:dr3d", \
                "urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0");
-        stylesWriter->addAttribute("xmlns:math", \
                "http://www.w3.org/1998/Math/MathML");
-        stylesWriter->addAttribute("xmlns:of", \
                "urn:oasis:names:tc:opendocument:xmlns:of:1.2");
-        stylesWriter->addAttribute("office:version", "1.2");
-        mainStyles.saveOdfStyles(KoGenStyles::MasterStyles, stylesWriter);
-        mainStyles.saveOdfStyles(KoGenStyles::DocumentStyles, stylesWriter); // \
                office:style
-        mainStyles.saveOdfStyles(KoGenStyles::DocumentAutomaticStyles, \
                stylesWriter); // office:automatic-styles
-        stylesWriter->endElement();  // office:document-styles
-        stylesWriter->endDocument();
-        delete stylesWriter;
-        store->close();
-    }
-
-    manifestWriter->addManifestEntry(m_href+"/", \
                "application/vnd.oasis.opendocument.chart");
-    manifestWriter->addManifestEntry(QString("%1/styles.xml").arg(m_href), \
                "text/xml");
-    manifestWriter->addManifestEntry(QString("%1/content.xml").arg(m_href), \
                "text/xml");
-
-    store->popDirectory();
-    return true;
-}
-
-// calculating fade factor as suggested in msoo xml reference page 4161
-inline qreal calculateFade( int index, int maxIndex )
-{
-    return -70.0 + 140.0 * ( ( double ) index / ( ( double ) maxIndex + 1.0 ) );
-}
-
-inline QColor shadeColor( const QColor& col, qreal factor )
-{
-    QColor result = col;
-    qreal luminance = 0.0;
-    qreal hue = 0.0;
-    qreal sat = 0.0;
-    result.getHslF( &hue, &sat, &luminance );
-    luminance *= factor;
-    result.setHslF( hue, sat, luminance );
-    return result;
-}
-
-void ChartExport::addDataThemeToStyle( KoGenStyle& style, int dataNumber, int \
                maxNumData, bool strokes )
-{
-    if (!m_theme) return;
-
-    const int patternOneIndexes[] = { 1, 9, 17, 25, 33 };
-    const int patternTwoIndexes[] = { 42, 34, 26, 18, 10, 2 };
-    const int patternFourIndexes[] = { 41 };
-    
-    const int fadepatternOne[] = { 3, 11, 19, 27, 35, 43 };
-    const int fadepatternTwo[] = { 4, 12, 20, 28, 36, 44 };
-    const int fadepatternThree[] = { 5, 13, 21, 29, 37, 45 };
-    const int fadepatternFour[] = { 6, 14, 22, 30, 38, 46 };
-    const int fadepatternFive[] = { 7, 15, 23, 31, 39, 47 };
-    const int fadepatternSix[] = { 8, 16, 24, 32, 40, 48 };
-    QVector< const int* > fadePatterns; fadePatterns << fadepatternOne << \
fadepatternTwo << fadepatternThree << fadepatternFour << fadepatternFive << \
                fadepatternSix;
-
-    const MSOOXML::DrawingMLColorScheme& colorScheme = m_theme->colorScheme;
-    const int rounds = dataNumber / 6;
-    const int maxRounds = maxNumData / 6 + 1;
-    QColor seriesColor;
-    if ( std::find( patternTwoIndexes, patternTwoIndexes + 6, chart()->m_style ) != \
                patternTwoIndexes + 6 ) {
-        const QString themeColorString = QString::fromLatin1( "accent%1" ).arg( ( \
                dataNumber % 6 ) + 1 );
-        const qreal tintFactor = 1.0 - ( rounds / maxRounds * 2 );
-        MSOOXML::DrawingMLColorSchemeItemBase *colorSchemeItem = colorScheme.value( \
                themeColorString );
-        if ( colorSchemeItem ) {
-            seriesColor = colorSchemeItem->value();
-            if ( rounds > 1 )
-                seriesColor = tintColor( seriesColor, tintFactor );
-        }
-    } else if ( std::find( patternOneIndexes, patternOneIndexes + 5, \
                chart()->m_style ) != patternOneIndexes + 5 ) {
-        const QString themeColorString = QString::fromLatin1( "dk1" );
-        MSOOXML::DrawingMLColorSchemeItemBase *colorSchemeItem = colorScheme.value( \
                themeColorString );
-        if ( colorSchemeItem ) {
-            seriesColor = colorSchemeItem->value();
-            const qreal tintVals[] = { 0.885, 0.55, 0.78, 0.925, 0.7, 0.3 };
-            seriesColor = tintColor( seriesColor, tintVals[ dataNumber % 6 ]);
-            const qreal tintFactor = 1.0 - ( rounds / maxRounds * 2 );
-            if ( rounds > 1 )
-                seriesColor = tintColor( seriesColor, tintFactor );
-        }
-    } else if ( std::find( patternFourIndexes, patternFourIndexes + 1, \
                chart()->m_style ) != patternFourIndexes + 1 ) {
-        const QString themeColorString = QString::fromLatin1( "dk1" );
-        MSOOXML::DrawingMLColorSchemeItemBase *colorSchemeItem = colorScheme.value( \
                themeColorString );
-        if ( colorSchemeItem ) {
-            seriesColor = colorSchemeItem->value();
-            const qreal tintVals[] = { 0.885, 0.55, 0.78, 0.925, 0.7, 0.3 };
-            seriesColor = tintColor( seriesColor, tintVals[ dataNumber % 6 ]);
-            const qreal tintFactor = 1.0 - ( rounds / maxRounds * 2 );
-            if ( rounds > 1 )
-                seriesColor = tintColor( seriesColor, tintFactor );
-        }
-    } else {
-        for ( int i = 0; i < fadePatterns.count(); ++i ) {
-            if ( std::find( fadePatterns[ i ], fadePatterns[ i ] + 6, \
                chart()->m_style ) != fadePatterns[ i ] + 6 ) {
-                const QString themeColorString = QString::fromLatin1( "accent%1" \
                ).arg( i + 1 );
-                MSOOXML::DrawingMLColorSchemeItemBase *colorSchemeItem = \
                colorScheme.value( themeColorString );
-                if ( colorSchemeItem ) {
-                    seriesColor = colorSchemeItem->value();
-                    qreal fadeValue = calculateFade( dataNumber, maxNumData ) / \
                100.0;
-                    if ( fadeValue > 0.0 )
-                        seriesColor = tintColor( seriesColor, 1 - fadeValue );
-                    else
-                        seriesColor = shadeColor( seriesColor, 1 + fadeValue );
-                }
-            }
-        }
-    }
-    if ( seriesColor.isValid() ) {
-        style.addProperty( "draw:fill", "solid", KoGenStyle::GraphicType );
-        style.addProperty( "draw:fill-color", seriesColor.name(), \
                KoGenStyle::GraphicType );
-        if ( strokes ) {
-            style.addProperty( "draw:stroke", "solid", KoGenStyle::GraphicType );
-            style.addProperty( "svg:stroke-color", seriesColor.name(), \
                KoGenStyle::GraphicType );
-        } else {
-            style.addProperty( "draw:stroke", "none", KoGenStyle::GraphicType );
-        }
-    }
-}
-
-
-float ChartExport::sprcToPt( int sprc, Orientation orientation )
-{
-    if( orientation & vertical )
-        return (float)sprc * ( (float)m_width / 4000.0);
-
-    return (float)sprc * ( (float)m_height / 4000.0);
-}
-
-void ChartExport::writeInternalTable ( KoXmlWriter* bodyWriter )
-{
-    Q_ASSERT( bodyWriter );
-    bodyWriter->startElement("table:table");
-        bodyWriter->addAttribute( "table:name", "local" );
-
-        bodyWriter->startElement( "table:table-header-columns" );
-            bodyWriter->startElement( "table:table-column" );
-            bodyWriter->endElement();
-        bodyWriter->endElement();
-
-        bodyWriter->startElement( "table:table-columns" );
-            bodyWriter->startElement( "table:table-column" );
-            bodyWriter->endElement();
-        bodyWriter->endElement();
-
-        bodyWriter->startElement( "table:table-rows" );
-
-        const int rowCount = chart()->m_internalTable.maxRow();
-        for(int r = 1; r <= rowCount; ++r) {
-            bodyWriter->startElement("table:table-row");
-            const int columnCount = chart()->m_internalTable.maxCellsInRow(r);
-            for(int c = 1; c <= columnCount; ++c) {
-                bodyWriter->startElement("table:table-cell");
-                if (Cell* cell = chart()->m_internalTable.cell(c, r, false)) {
-                    //kDebug() << "cell->m_value " << cell->m_value;
-                    if (!cell->m_value.isEmpty()) {
-                        if (!cell->m_valueType.isEmpty()) {
-                            bodyWriter->addAttribute("office:value-type", \
                cell->m_valueType);
-                            if (cell->m_valueType == "string") {
-                                bodyWriter->addAttribute("office:string-value", \
                cell->m_value);
-                            } else if (cell->m_valueType == "boolean") {
-                                bodyWriter->addAttribute("office:boolean-value", \
                cell->m_value);
-                            } else if (cell->m_valueType == "date") {
-                                bodyWriter->addAttribute("office:date-value", \
                cell->m_value);
-                            } else if (cell->m_valueType == "time") {
-                                bodyWriter->addAttribute("office:time-value", \
                cell->m_value);
-                            } else { // float, percentage and currency including \
                fraction and scientific
-                                bodyWriter->addAttribute("office:value", \
                cell->m_value);
-                            }
-                        }
-                        bodyWriter->startElement("text:p");
-                        bodyWriter->addTextNode( cell->m_value );
-                        bodyWriter->endElement(); // text:p
-                    }
-                }
-                bodyWriter->endElement(); // table:table-cell
-            }
-            bodyWriter->endElement(); // table:table-row
-        }
-        bodyWriter->endElement();
-    bodyWriter->endElement();
-}
-
-void ChartExport::setSheetReplacement( bool val )
-{
-    sheetReplacement = val;
-}
diff --git a/filters/sheets/xlsx/ChartExport.h b/filters/sheets/xlsx/ChartExport.h
deleted file mode 100644
index c38d5fb..0000000
--- a/filters/sheets/xlsx/ChartExport.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- *  Copyright (c) 2010 Sebastian Sauer <sebsauer@kdab.com>
- *  Copyright (c) 2010 Carlos Licea <carlos@kdab.com>
- *
- *  This library is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Lesser General Public License as published
- *  by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
- *
- *  You should have received a copy of the GNU Lesser General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef CHARTEXPORT_H
-#define CHARTEXPORT_H
-
-#include <Charting.h>
-
-//#include <QString>
-//#include <QStringList>
-//#include <QRect>
-//#include <QMap>
-//#include <QColor>
-
-class KoStore;
-class KoXmlWriter;
-class KoGenStyles;
-class KoGenStyle;
-
-namespace MSOOXML
-{
-    class DrawingMLTheme;
-}
-
-
-class ChartExport
-{
-public:
-    explicit ChartExport(Charting::Chart* chart, const MSOOXML::DrawingMLTheme* \
                const contextWithThemeInformation = NULL);
-    ~ChartExport();
-    Charting::Chart* chart() const { return m_chart; }
-    void setSheetReplacement( bool val );
-    void set2003ColorPalette( QList< QColor > palette );
-
-    bool m_drawLayer;
-    QString m_href;
-    QString m_cellRangeAddress;
-    QString m_endCellAddress;
-    QString m_notifyOnUpdateOfRanges;
-#if 0
-    /// anchored to sheet
-    QString m_sheetName;
-    /// anchored to cell
-    //unsigned long m_colL, m_rwT;
-#endif
-    qreal m_x, m_y, m_width, m_height; //in pt
-    qreal m_end_x, m_end_y; //in pt
-
-    bool saveIndex(KoXmlWriter* xmlWriter);
-    bool saveContent(KoStore* store, KoXmlWriter* manifestWriter);
-
-private:
-    QString toPtString( int number );
-    enum Orientation {
-        vertical,
-        horizontal
-    };
-    float sprcToPt( int sprc, Orientation orientation );
-    Charting::Chart* m_chart;
-    const MSOOXML::DrawingMLTheme* m_theme;
-    bool sheetReplacement;
-    QString genChartAreaStyle( KoGenStyles& styles, KoGenStyles& mainStyles );
-    QString genChartAreaStyle( KoGenStyle& style, KoGenStyles& styles, KoGenStyles& \
                mainStyles );
-    QString genPlotAreaStyle( KoGenStyles& styles, KoGenStyles& mainStyles );
-    QString genPlotAreaStyle( KoGenStyle& style, KoGenStyles& styles, KoGenStyles& \
                mainStyles );
-    void addShapePropertyStyle( /*const*/ Charting::Series* series, KoGenStyle& \
                style, KoGenStyles& mainStyles );
-    void addDataThemeToStyle( KoGenStyle& style, int dataNumber, int maxNumData = 1, \
                bool strokes = true );
-    QString generateGradientStyle( KoGenStyles& mainStyles, const \
                Charting::Gradient* grad );
-    QColor calculateColorFromGradientStop( const Charting::Gradient::GradientStop& \
                grad );
-    QColor labelFontColor() const;
-    void writeInternalTable ( KoXmlWriter* bodyWriter );
-    QList< QColor > m_palette;
-    // tells if a 2003 color palette has been set
-    bool paletteSet;
-};
-
-#endif
diff --git a/filters/sheets/xlsx/Charting.h b/filters/sheets/xlsx/Charting.h
deleted file mode 100644
index 3a8a1f8..0000000
--- a/filters/sheets/xlsx/Charting.h
+++ /dev/null
@@ -1,491 +0,0 @@
-/*
- *  Copyright (c) 2010 Sebastian Sauer <sebsauer@kdab.com>
- *  Copyright (c) 2010 Carlos Licea <carlos@kdab.com>
- *
- *  This library is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Lesser General Public License as published
- *  by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
- *
- *  You should have received a copy of the GNU Lesser General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef CHARTING_H
-#define CHARTING_H
-
-#include <QString>
-//#include <QStringList>
-#include <QRect>
-#include <QMap>
-#include <QColor>
-#include <QDebug>
-#include <MsooXmlGlobal.h>
-
-namespace Charting
-{
-  
-    class Value
-    {
-    public:
-        enum DataId {
-            SeriesLegendOrTrendlineName = 0x00, ///< Referenced data specifies the \
                series, legend entry, or trendline name. Error bars name MUST be \
                empty.
-            HorizontalValues = 0x01, ///< Referenced data specifies the values or \
                horizontal values on bubble and scatter chart groups of the series \
                and error bars.
-            VerticalValues = 0x02, ///< Referenced data specifies the categories or \
                vertical values on bubble and scatter chart groups of the series and \
                error bars.
-            BubbleSizeValues = 0x03 ///< Referenced data specifies the bubble size \
                values of the series.
-        };
-        DataId m_dataId;
-
-        enum DataType {
-            AutoGeneratedName = 0x00, ///< The data source is a category (3) name, \
                series name or bubble size that was automatically generated.
-            TextOrValue = 0x01, ///< The data source is the text or value as \
                specified by the formula field.
-            CellRange = 0x02 ///< The data source is the value from a range of cells \
                in a sheet specified by the formula field.
-        };
-        DataType m_type;
-
-        bool m_isUnlinkedFormat; ///< false=data uses the number formatting of the \
                referenced data, true=data uses the custom formatting specified via \
                m_numberFormat.
-        unsigned m_numberFormat; ///< specifies the numnber format to use for the \
                data.
-        QString m_formula; ///< the optional formula. could be for example \
                "[Sheet1.$D$2:$F$2]"
-
-        Value(DataId dataId, DataType type, const QString& formula = QString(), bool \
isUnlinkedFormat = false, unsigned numberFormat = 0) : m_dataId(dataId), \
m_type(type), m_isUnlinkedFormat(isUnlinkedFormat), m_numberFormat(numberFormat), \
                m_formula(formula) {}
-        virtual ~Value() {}
-    };
-
-    class Format
-    {
-    public:
-        Format() {}
-        virtual ~Format() {}
-    };
-
-    class LineFormat : public Format
-    {
-    public:
-        enum Style {
-            Solid = 0x0000,
-            Dash = 0x0001,
-            Dot = 0x0002,
-            DashDot = 0x0003,
-            DashDotDot = 0x0004,
-            None = 0x0005,
-            DarkGrayPattern = 0x0006,
-            MediumGrayPattern = 0x0007,
-            LightGrayPattern = 0x0008
-        };
-        enum Tickness {
-            Hairline = 0xFFFF,
-            NarrowSingle = 0x0000,
-            MediumDouble = 0x0001,
-            WideTriple = 0x0002
-        };
-        Style m_style;
-        Tickness m_tickness;
-        explicit LineFormat(const Style& style = None, const Tickness& tickness = \
                Hairline) : Format(), m_style(style), m_tickness(tickness) {} 
-    };
-    
-    class PieFormat : public Format
-    {
-    public:
-        int m_pcExplode; // from PieFormat
-        explicit PieFormat(int pcExplode = 0) : Format(), m_pcExplode(pcExplode) {}
-    };
-    
-    class AreaFormat : public Format
-    {
-    public:
-        QColor m_foreground;
-        QColor m_background;
-        bool m_fill;
-        explicit AreaFormat(const QColor &foreground = QColor(), const QColor \
&background = QColor(), bool fill = false) : Format(), m_foreground(foreground), \
                m_background(background), m_fill(fill) {}
-    };
-
-    class Gradient
-    {
-    public:
-        Gradient(){ angle =  0.0; }
-        class GradientStop
-        {
-        public:
-            void reset(){ position = 1.0; knownColorValue = QColor(); tintVal = 0; \
                satVal = 0; shadeVal = 0; referenceColor.clear(); }
-            qreal position;
-            QColor knownColorValue;
-            qreal tintVal;
-            qreal satVal;
-            qreal shadeVal;
-            QString referenceColor;
-        };
-        QVector< GradientStop > gradientStops;
-        qreal angle;
-    };
-
-    class Fill
-    {
-    public:        
-        enum FillType{ Blip, Gradient, Group, None, Pattern, Solid };
-        Fill():type( None ), valid( false ){};
-        void setColor( const QColor& color ){ solidColor = color; valid = true; type \
                = Solid; }
-        void setType( FillType type ){ this->type = type; valid = true; }
-        QColor solidColor;
-        QString pixmapFile;
-        Charting::Gradient gradient;
-        FillType type;
-        bool valid;
-    };
-    
-    class ShapeProperties
-    {
-    public:
-        int lineWidth;
-        Fill lineFill;
-        Fill areaFill;
-    };
-
-    class ChartImpl
-    {
-    public:
-        ChartImpl() {}
-        virtual ~ChartImpl() {}
-        virtual QByteArray name() const = 0;
-    };
-
-    class PieImpl : public ChartImpl
-    {
-    public:
-        /// Starting angle of the first data point clockwise from the top of the \
                circle.
-        int m_anStart;
-        explicit PieImpl(int anStart = 0) : ChartImpl(), m_anStart(anStart) {}
-        virtual QByteArray name() const { return "circle"; }
-    };
-
-    class RingImpl : public PieImpl
-    {
-    public:
-        /// Size of the center hole in a doughnut chart group as a percentage of the \
                plot area size.
-        int m_pcDonut;
-       explicit  RingImpl(int anStart = 0, int pcDonut = 0) : PieImpl(anStart), \
                m_pcDonut(pcDonut) {}
-        virtual QByteArray name() const { return "ring"; }
-    };
-
-    class BarImpl : public ChartImpl
-    {
-    public:
-        virtual QByteArray name() const { return "bar"; }
-    };
-    
-    class LineImpl : public ChartImpl
-    {
-    public:
-        virtual QByteArray name() const { return "line"; }
-    };
-    
-    class RadarImpl : public ChartImpl
-    {
-    public:
-        /// If true then the radar-chart is filled (an RadarArea chart) else not.
-        bool m_filled;
-        explicit RadarImpl(bool filled = false) : ChartImpl(), m_filled(filled) {}
-        virtual QByteArray name() const { return m_filled ? "filled-radar" : \
                "radar"; }
-    };
-
-    class AreaImpl : public ChartImpl
-    {
-    public:
-        AreaImpl() : ChartImpl() {}
-        virtual QByteArray name() const { return "area"; }
-    };
-
-    class StockImpl : public ChartImpl
-    {
-    public:
-        StockImpl() : ChartImpl() {}
-        virtual QByteArray name() const { return "stock"; }
-    };
-
-    class ScatterImpl : public ChartImpl
-    {
-    public:
-        enum ScatterStyle { None, Line, LineMarker, Marker, Smooth, SmoothMarker };
-        ScatterStyle style;
-        ScatterImpl() : ChartImpl(), style( LineMarker ) {}
-        virtual QByteArray name() const { return "scatter"; }
-    };
-
-    class BubbleImpl : public ChartImpl
-    {
-    public:
-        enum SizeType {
-            Area = 0x0001, ///< The area of the data point represents the value.
-            Width = 0x0002 ///< The width of the data point represents the value.
-        };
-        /// Specifies how the default size of the data points represents the value.
-        SizeType m_sizeType;
-        /// The size of the data points as a percentage of their default size. A \
value of 100 shows all the data points in their default size, as determined by the \
                application.
-        unsigned int m_sizeRatio;
-        /// Specifies whether data points with negative values are shown.
-        bool m_showNegativeBubbles;
-        explicit BubbleImpl(SizeType sizeType = Area, unsigned int sizeRatio = 100, \
bool showNegativeBubbles = true) : ChartImpl(), m_sizeType(sizeType), \
                m_sizeRatio(sizeRatio), m_showNegativeBubbles(showNegativeBubbles) {}
-        virtual QByteArray name() const { return "bubble"; }
-    };
-
-    class SurfaceImpl : public ChartImpl
-    {
-    public:
-        /// Specifies that the surface is either filled or a wireframe.
-        bool m_fill;
-        explicit SurfaceImpl(bool fill = false) : ChartImpl(), m_fill(fill) {}
-        virtual QByteArray name() const { return "surface"; }
-    };
-
-    class Obj
-    {
-    public:
-        unsigned int m_mdTopLt, m_mdBotRt, m_x1, m_y1, m_x2, m_y2;
-        Charting::AreaFormat *m_areaFormat;
-        explicit Obj() : m_mdTopLt(0), m_mdBotRt(0), m_x1(0), m_y1(0), m_x2(0), \
                m_y2(0), m_areaFormat(0) {}
-        virtual ~Obj() { delete m_areaFormat; }
-    };
-
-    class Text : public Obj
-    {
-    public:
-        QString m_text;
-        explicit Text(const QString &text = QString()) : Obj(), m_text(text) {}
-        virtual ~Text() {}
-    };
-    
-    class Axis : public Obj
-    {
-    public:
-        enum Type {
-            HorizontalValueAxis = 0x0000,
-            VerticalValueAxis = 0x0001,
-            SeriesAxis = 0x0002
-        };
-        Type m_type;
-
-        class Gridline
-        {
-        public:
-            LineFormat m_format;
-            explicit Gridline(const LineFormat &format = LineFormat()) : \
                m_format(format) {}
-        };
-        Gridline m_majorGridlines;
-        Gridline m_minorGridlines;
-
-        LineFormat m_format;
-
-        QString m_numberFormat;
-
-        bool m_reversed;
-        bool m_logarithmic;
-
-        bool m_autoMinimum;
-        bool m_autoMaximum;
-        qreal m_minimum;
-        qreal m_maximum;
-
-        explicit Axis(Type type) : Obj(), m_type(type), m_reversed(false), \
m_logarithmic(false), m_autoMinimum(true), m_autoMaximum(true), m_minimum(0), \
                m_maximum(0) {}
-        virtual ~Axis() {}
-    };
-
-    class Cell
-    {
-    public:
-        int m_column;
-        int m_row;
-        QString m_value;
-        QString m_valueType;
-        Cell(int columnIndex, int rowIndex) : m_column(columnIndex), \
                m_row(rowIndex), m_valueType("string"){};
-    };
-
-    /// cell data represetation of internal table
-    class InternalTable
-    {
-    public:
-        InternalTable():m_maxRow(0),m_maxColumn(0) {  }
-        ~InternalTable() { qDeleteAll(m_cells); }
-
-        Cell* cell(int columnIndex, int rowIndex, bool autoCreate)
-        {
-            const uint maximumSpreadsheetColumns = 0x7FFF; // \
                MSOOXML::maximumSpreadsheetColumns()
-            const unsigned hashed = (rowIndex + 1) * maximumSpreadsheetColumns + \
                columnIndex + 1;
-            Cell* c = m_cells[ hashed ];
-            if (!c && autoCreate) {
-                c = new Cell(columnIndex, rowIndex);
-                m_cells[ hashed ] = c;
-                if (rowIndex > m_maxRow) m_maxRow = rowIndex;
-                if (columnIndex > m_maxColumn) m_maxColumn = columnIndex;
-                if (!m_maxCellsInRow.contains(rowIndex) || columnIndex > \
                m_maxCellsInRow[rowIndex])
-                    m_maxCellsInRow[rowIndex] = columnIndex;
-            }
-            return c;
-        }
-
-        int maxCellsInRow(int rowIndex) const { return m_maxCellsInRow[rowIndex]; }
-        int maxRow() const { return m_maxRow; }
-        int maxColumn() const { return m_maxColumn; }
-
-    private:
-        int m_maxRow;
-        int m_maxColumn;
-        QHash<unsigned, Cell*> m_cells;
-        QHash<int, int> m_maxCellsInRow;
-    };
-
-    /// Different types of markers.
-    enum MarkerType {
-        NoMarker,
-        AutoMarker,
-        SquareMarker,
-        DiamondMarker,
-        StarMarker,
-        DotMarker,
-        DashMarker,
-        PlusMarker,
-        CircleMarker,
-        SymbolXMarker,
-        TriangleMarker
-        // TODO fill the missing marker types in
-    };
-
-    class DataPoint : public Obj
-    {
-    public:
-    };
-
-    class Series : public Obj
-    {
-    public:
-        /// the type of data in categories, or horizontal values on bubble and \
                scatter chart groups, in the series. MUST be either 0x0001=numeric or \
                0x0003=text.
-        int m_dataTypeX;
-        /// the count of categories (3), or horizontal values on bubble and scatter \
                chart groups, in the series.
-        int m_countXValues;
-        /// the count of values, or vertical values on bubble and scatter chart \
                groups, in the series.
-        int m_countYValues;
-        /// the count of bubble size values in the series.
-        int m_countBubbleSizeValues;
-        /// termines if the data values are shown in raw values as labels
-        bool m_showDataLabelValues;
-        /// termines if the data values are shown in percent as labels
-        bool m_showDataLabelPercent;
-        /// termines if the category data is shown as labels
-        bool m_showDataLabelCategory;
-        /// termines if the name of the series is shown as labels
-        bool m_showDataLabelSeries;
-        /// Range that contains the values that should be visualized by the \
                dataSeries.
-        QString m_valuesCellRangeAddress;
-        /// Ranges that contains the values that should be visualized by the \
                dataSeries.
-        QStringList m_domainValuesCellRangeAddress;
-        /// The referenced values used in the chart
-        QMap<Value::DataId, Value*> m_datasetValue;
-        /// The data-points in the series.
-        QList<DataPoint*> m_dataPoints;
-        /// The formatting for the referenced values
-        QList<Format*> m_datasetFormat;
-        /// List of text records attached to the series.
-        QList<Text*> m_texts;
-        /// range that contains label
-        QString m_labelCell;
-        /// marker type
-        MarkerType m_markerType;
-        ShapeProperties* spPr;
-        QString m_numberFormat;
-        explicit Series() : Obj(), m_dataTypeX(0), m_countXValues(0), \
m_countYValues(0), m_countBubbleSizeValues(0), m_showDataLabelValues(false), \
m_showDataLabelPercent(false), m_showDataLabelCategory(false), \
                m_showDataLabelSeries(false), m_markerType(NoMarker),spPr(0) {}
-        virtual ~Series() { qDeleteAll(m_datasetValue); qDeleteAll(m_dataPoints); \
                qDeleteAll(m_datasetFormat); delete spPr; }
-    };
-
-    class PlotArea : public Obj
-    {
-    public:
-        explicit PlotArea() : Obj() {}
-        virtual ~PlotArea() {}
-    };
-
-    class Legend : public Obj
-    {
-    public:
-        explicit Legend() : Obj() {}
-        virtual ~Legend() {}
-    };
-
-    /// The main charting class that represents a single chart.
-    class Chart : public Obj
-    {
-    public:
-        QString m_sheetName;
-        
-        /// If true then the chart is a 3d chart else the chart is 2d.
-        bool m_is3d;
-        /// Specifies a counter clockwise rotation of a polar coordinate in a \
                circle, ring or polar chart.
-        int m_angleOffset;
-        //int anRot, anElv, pcDist;
-        /// Margins around the chart object
-        int m_leftMargin, m_topMargin, m_rightMargin, m_bottomMargin;
-        /// List of series
-        QList<Series*> m_series;
-        /// List of text records attached to the chart.
-        QList<Text*> m_texts;
-        /// Range of all referenced cells.
-        QRect m_cellRangeAddress;
-        /// Range that contains the vertical values (the categories) for the \
                plot-area.
-        QString m_verticalCellRangeAddress;
-        // The ChartTitle
-        QString m_title;
-        /// The more concrete chart implementation like e.g. a PieImpl for a pie \
                chart.
-        ChartImpl *m_impl;
-        /// The plot-area.
-        PlotArea *m_plotArea;
-        /// The legend.
-        Legend *m_legend;
-        /// List of defined axes.
-        QList<Axis*> m_axes;
-        /// Whether the chart is vertical or not.
-        bool m_transpose;
-        /// Whether the chart is stacked or not.
-        bool m_stacked;
-        /// Whether the chart is percentage or not.
-        bool m_f100;
-        /// style for colors fills line types, etc
-        int m_style;
-        Gradient* m_fillGradient;
-        Gradient* m_plotAreaFillGradient;
-        MarkerType m_markerType;
-        bool m_showLines;
-        qreal m_textSize;
-
-        // charts internal table
-        InternalTable m_internalTable;
-
-        explicit Chart() : Obj(), m_is3d(false), m_angleOffset(0), m_leftMargin(0), \
m_topMargin(0), m_rightMargin(0), m_bottomMargin(0), m_impl(0), m_plotArea(0), \
m_legend(0), m_transpose(false), m_stacked(false), m_f100(false), m_style(2), \
m_fillGradient(0), m_plotAreaFillGradient(0), m_markerType(NoMarker), m_showLines( \
                false ), m_textSize( 10 ) {
-            m_x1 = m_y1 = m_x2 = m_y2 = -1; // -1 means autoposition/autosize
-        }
-        virtual ~Chart() { qDeleteAll(m_series); qDeleteAll(m_texts); delete m_impl; \
delete m_plotArea; delete m_legend; delete m_fillGradient; delete \
                m_plotAreaFillGradient; }
-        
-        void addRange(const QRect& range)
-        {
-            if (range.isValid()) {
-                if (m_cellRangeAddress.isValid()) {
-                    if (range.left() < m_cellRangeAddress.left())
-                        m_cellRangeAddress.setLeft(range.left());
-                    if (range.top() < m_cellRangeAddress.top())
-                        m_cellRangeAddress.setTop(range.top());
-                    if (range.right() > m_cellRangeAddress.right())
-                        m_cellRangeAddress.setRight(range.right());
-                    if (range.bottom() > m_cellRangeAddress.bottom())
-                        m_cellRangeAddress.setBottom(range.bottom());
-                } else {
-                    m_cellRangeAddress = range;
-                }
-            }
-        }
-    };
-
-} // namespace Charting
-
-#endif
diff --git a/filters/sheets/xlsx/XlsxChartOdfWriter.cpp \
b/filters/sheets/xlsx/XlsxChartOdfWriter.cpp new file mode 100644
index 0000000..6b739ac
--- /dev/null
+++ b/filters/sheets/xlsx/XlsxChartOdfWriter.cpp
@@ -0,0 +1,361 @@
+/*
+ *  Copyright (c) 2010 Sebastian Sauer <sebsauer@kdab.com>
+ *  Copyright (c) 2010 Carlos Licea <carlos@kdab.com>
+ *  Copyright (c) 2014 Inge Wallin <inge@lysator.liu.se>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Lesser General Public License as published
+ *  by the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+// Own
+#include "XlsxChartOdfWriter.h"
+
+// KDE
+#include <kdebug.h>
+
+// Calligra
+#include <KoStore.h>
+#include <KoXmlWriter.h>
+#include <KoOdfWriteStore.h>
+#include <KoStoreDevice.h>
+#include <KoGenStyles.h>
+#include <KoGenStyle.h>
+
+
+#include <Charting.h>
+#include "NumberFormatParser.h"
+#include <MsooXmlTheme.h>
+
+#include <algorithm> // For std:find()
+
+// Print the content of generated content.xml to the console for debugging purpose
+//#define CONTENTXML_DEBUG
+
+using namespace KoChart;
+
+XlsxChartOdfWriter::XlsxChartOdfWriter(KoChart::Chart* chart, const \
MSOOXML::DrawingMLTheme* const theme) +    : KoOdfChartWriter(chart)
+    , m_theme(theme)
+{
+    Q_ASSERT(m_chart);
+    m_drawLayer = false;
+}
+
+XlsxChartOdfWriter::~XlsxChartOdfWriter()
+{
+}
+
+
+QColor XlsxChartOdfWriter::calculateColorFromGradientStop(const \
KoChart::Gradient::GradientStop& grad) +{
+    QColor color = grad.knownColorValue;
+
+    if (!grad.referenceColor.isEmpty())
+        color = m_theme->colorScheme.value(grad.referenceColor)->value();
+
+    const int tintedColor = 255 * grad.tintVal / 100.0;
+    const qreal  nonTindedPart = 1.0 - grad.tintVal / 100.0;
+    color.setRed(tintedColor + nonTindedPart * color.red());
+    color.setGreen(tintedColor + nonTindedPart * color.green());
+    color.setBlue(tintedColor + nonTindedPart * color.blue());
+
+    return color;
+}
+
+QColor XlsxChartOdfWriter::labelFontColor() const
+{
+    bool useTheme = !chart()->m_areaFormat && m_theme;
+    if (useTheme) {
+        // The following assumes that we just need to invert the in
+        // genChartAreaStyle used font-color for the axis. It's not clear yet
+        // (means any documentation in the specs is missing) if that is really
+        // the correct thing to do.
+        const MSOOXML::DrawingMLColorScheme& colorScheme = m_theme->colorScheme;
+        switch(chart()->m_style) {
+            case(33):
+            case(34):
+            case(35):
+            case(36):
+            case(37):
+            case(38):
+            case(39):
+            case(40): {
+                return colorScheme.value("dk1")->value();
+            } break;
+
+            case(41):
+            case(42):
+            case(43):
+            case(44):
+            case(45):
+            case(46):
+            case(47):
+            case(48): {
+                return colorScheme.value("lt1")->value();
+            } break;
+
+            default:
+                break;
+        }
+    }
+
+    return QColor();
+}
+
+QString XlsxChartOdfWriter::genChartAreaStyle(KoGenStyle& style, KoGenStyles& \
styles, +					      KoGenStyles& mainStyles)
+{
+    if (chart()->m_fillGradient) {
+        style.addProperty("draw:fill", "gradient", KoGenStyle::GraphicType);
+        style.addProperty("draw:fill-gradient-name",
+			  generateGradientStyle(mainStyles, chart()->m_fillGradient),
+			  KoGenStyle::GraphicType);
+    } else {
+        style.addProperty("draw:fill", "solid", KoGenStyle::GraphicType);
+        bool useTheme = !chart()->m_areaFormat && m_theme;
+        if (useTheme) {
+            const MSOOXML::DrawingMLColorScheme& colorScheme = m_theme->colorScheme;
+            switch(chart()->m_style) {
+                case(33):
+                case(34):
+                case(35):
+                case(36):
+                case(37):
+                case(38):
+                case(39):
+                case(40): {
+                    style.addProperty("draw:fill-color", \
colorScheme.value("lt1")->value().name(), +				      KoGenStyle::GraphicType);
+                } break;
+                case(41):
+                case(42):
+                case(43):
+                case(44):
+                case(45):
+                case(46):
+                case(47):
+                case(48): {
+                    style.addProperty("draw:fill-color", \
colorScheme.value("dk1")->value().name(), +				      KoGenStyle::GraphicType);
+                } break;
+
+                default: {
+                    useTheme = false;
+                } break;
+            }
+        }
+
+        if (!useTheme) {
+            QColor color;
+            if (chart()->m_areaFormat
+		&& chart()->m_areaFormat->m_fill
+		&& chart()->m_areaFormat->m_foreground.isValid())
+	    {
+                color = chart()->m_areaFormat->m_foreground;
+	    }
+            else
+                color = QColor("#FFFFFF");
+            style.addProperty("draw:fill-color", color.name(), \
KoGenStyle::GraphicType); +
+            if (color.alpha() < 255)
+                style.addProperty("draw:opacity",
+				  QString("%1%").arg(chart()->m_areaFormat->m_foreground.alphaF()
+						     * 100.0),
+				  KoGenStyle::GraphicType);
+        }
+    }
+
+    return styles.insert(style, "ch");
+}
+
+
+QString XlsxChartOdfWriter::genPlotAreaStyle(KoGenStyle& style, KoGenStyles& styles,
+					     KoGenStyles& mainStyles)
+{
+    KoChart::AreaFormat *areaFormat = ((chart()->m_plotArea
+					&& chart()->m_plotArea->m_areaFormat
+					&& chart()->m_plotArea->m_areaFormat->m_fill)
+				       ? chart()->m_plotArea->m_areaFormat
+				       : chart()->m_areaFormat);
+    if (chart()->m_plotAreaFillGradient) {
+        style.addProperty("draw:fill", "gradient", KoGenStyle::GraphicType);
+        style.addProperty("draw:fill-gradient-name",
+			  generateGradientStyle(mainStyles, chart()->m_plotAreaFillGradient),
+			  KoGenStyle::GraphicType);
+    } else {
+        style.addProperty("draw:fill", "solid", KoGenStyle::GraphicType);
+        bool useTheme = !areaFormat && m_theme;
+        if (useTheme) {
+            const MSOOXML::DrawingMLColorScheme& colorScheme = m_theme->colorScheme;
+            switch(chart()->m_style) {
+                case(33):
+                case(34): {
+                    style.addProperty("draw:fill-color",
+				      tintColor(colorScheme.value("dk1")->value(), 0.2).name(),
+				      KoGenStyle::GraphicType);
+                } break;
+                case(35):
+                case(36):
+                case(37):
+                case(38):
+                case(39):
+                case(40): {
+                    QString prop = \
QString::fromLatin1("accent%1").arg(chart()->m_style - 34); +                    \
style.addProperty("draw:fill-color", +				      \
colorScheme.value("dk1")->value().name(), +				      KoGenStyle::GraphicType);
+                } break;
+                case(41):
+                case(42):
+                case(43):
+                case(44):
+                case(45):
+                case(46):
+                case(47):
+                case(48): {
+                    style.addProperty("draw:fill-color",
+				      tintColor(colorScheme.value("dk1")->value(), 0.95).name(),
+				      KoGenStyle::GraphicType);
+                } break;
+
+                default: {
+                    useTheme = false;
+                } break;
+            }
+        }
+
+        if (!useTheme) {
+            QColor color;
+            if (areaFormat && areaFormat->m_foreground.isValid())
+                color = areaFormat->m_foreground;
+            else
+                color = QColor(paletteIsSet ? "#C0C0C0" : "#FFFFFF");
+            style.addProperty("draw:fill-color", color.name(), \
KoGenStyle::GraphicType); +
+            if (color.alpha() < 255)
+                style.addProperty("draw:opacity",
+				  QString("%1%").arg(areaFormat->m_foreground.alphaF() * 100.0),
+				  KoGenStyle::GraphicType);
+        }
+    }
+
+    return styles.insert(style, "ch");
+}
+
+
+// ----------------------------------------------------------------
+//                 The actual saving code
+
+
+// We don't have to do anything special here in the case of Xlsx.
+
+
+// ----------------------------------------------------------------
+//                   Some helper functions
+
+
+void XlsxChartOdfWriter::addDataThemeToStyle(KoGenStyle& style, int dataNumber, int \
maxNumData, +					     bool strokes)
+{
+    if (!m_theme) return;
+
+    const int patternOneIndexes[] = { 1, 9, 17, 25, 33 };
+    const int patternTwoIndexes[] = { 42, 34, 26, 18, 10, 2 };
+    const int patternFourIndexes[] = { 41 };
+    
+    const int fadepatternOne[] = { 3, 11, 19, 27, 35, 43 };
+    const int fadepatternTwo[] = { 4, 12, 20, 28, 36, 44 };
+    const int fadepatternThree[] = { 5, 13, 21, 29, 37, 45 };
+    const int fadepatternFour[] = { 6, 14, 22, 30, 38, 46 };
+    const int fadepatternFive[] = { 7, 15, 23, 31, 39, 47 };
+    const int fadepatternSix[] = { 8, 16, 24, 32, 40, 48 };
+    QVector< const int* > fadePatterns; fadePatterns << fadepatternOne << \
fadepatternTwo +						     << fadepatternThree << fadepatternFour
+						     << fadepatternFive << fadepatternSix;
+
+    const MSOOXML::DrawingMLColorScheme& colorScheme = m_theme->colorScheme;
+    const int rounds = dataNumber / 6;
+    const int maxRounds = maxNumData / 6 + 1;
+    QColor seriesColor;
+    if (std::find(patternTwoIndexes, patternTwoIndexes + 6, chart()->m_style)
+	!= patternTwoIndexes + 6)
+    {
+        const QString themeColorString = \
QString::fromLatin1("accent%1").arg((dataNumber % 6) + 1); +        const qreal \
tintFactor = 1.0 - (rounds / maxRounds * 2); +        \
MSOOXML::DrawingMLColorSchemeItemBase *colorSchemeItem = \
colorScheme.value(themeColorString); +        if (colorSchemeItem) {
+            seriesColor = colorSchemeItem->value();
+            if (rounds > 1)
+                seriesColor = tintColor(seriesColor, tintFactor);
+        }
+    }
+    else if (std::find(patternOneIndexes, patternOneIndexes + 5, chart()->m_style)
+	     != patternOneIndexes + 5)
+    {
+        const QString themeColorString = QString::fromLatin1("dk1");
+        MSOOXML::DrawingMLColorSchemeItemBase *colorSchemeItem = \
colorScheme.value(themeColorString); +        if (colorSchemeItem) {
+            seriesColor = colorSchemeItem->value();
+            const qreal tintVals[] = { 0.885, 0.55, 0.78, 0.925, 0.7, 0.3 };
+            seriesColor = tintColor(seriesColor, tintVals[ dataNumber % 6 ]);
+            const qreal tintFactor = 1.0 - (rounds / maxRounds * 2);
+            if (rounds > 1)
+                seriesColor = tintColor(seriesColor, tintFactor);
+        }
+    }
+    else if (std::find(patternFourIndexes, patternFourIndexes + 1, chart()->m_style)
+	     != patternFourIndexes + 1)
+    {
+        const QString themeColorString = QString::fromLatin1("dk1");
+        MSOOXML::DrawingMLColorSchemeItemBase *colorSchemeItem = \
colorScheme.value(themeColorString); +        if (colorSchemeItem) {
+            seriesColor = colorSchemeItem->value();
+            const qreal tintVals[] = { 0.885, 0.55, 0.78, 0.925, 0.7, 0.3 };
+            seriesColor = tintColor(seriesColor, tintVals[ dataNumber % 6 ]);
+            const qreal tintFactor = 1.0 - (rounds / maxRounds * 2);
+            if (rounds > 1)
+                seriesColor = tintColor(seriesColor, tintFactor);
+        }
+    }
+    else {
+        for (int i = 0; i < fadePatterns.count(); ++i) {
+            if (std::find(fadePatterns[ i ], fadePatterns[ i ] + 6, \
chart()->m_style) +		!= fadePatterns[ i ] + 6)
+	    {
+                const QString themeColorString = \
QString::fromLatin1("accent%1").arg(i + 1); +                \
MSOOXML::DrawingMLColorSchemeItemBase *colorSchemeItem = \
colorScheme.value(themeColorString); +                if (colorSchemeItem) {
+                    seriesColor = colorSchemeItem->value();
+                    qreal fadeValue = calculateFade(dataNumber, maxNumData) / 100.0;
+                    if (fadeValue > 0.0)
+                        seriesColor = tintColor(seriesColor, 1 - fadeValue);
+                    else
+                        seriesColor = shadeColor(seriesColor, 1 + fadeValue);
+                }
+            }
+        }
+    }
+
+    if (seriesColor.isValid()) {
+        style.addProperty("draw:fill", "solid", KoGenStyle::GraphicType);
+        style.addProperty("draw:fill-color", seriesColor.name(), \
KoGenStyle::GraphicType); +
+        if (strokes) {
+            style.addProperty("draw:stroke", "solid", KoGenStyle::GraphicType);
+            style.addProperty("svg:stroke-color", seriesColor.name(), \
KoGenStyle::GraphicType); +        } else {
+            style.addProperty("draw:stroke", "none", KoGenStyle::GraphicType);
+        }
+    }
+}
diff --git a/filters/sheets/xlsx/XlsxChartOdfWriter.h \
b/filters/sheets/xlsx/XlsxChartOdfWriter.h new file mode 100644
index 0000000..db4da9f
--- /dev/null
+++ b/filters/sheets/xlsx/XlsxChartOdfWriter.h
@@ -0,0 +1,60 @@
+/*
+ *  Copyright (c) 2010 Sebastian Sauer <sebsauer@kdab.com>
+ *  Copyright (c) 2010 Carlos Licea <carlos@kdab.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Lesser General Public License as published
+ *  by the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef XLSXCHARTODFWRITER_H
+#define XLSXCHARTODFWRITER_H
+
+#include <KoOdfChartWriter.h>
+
+
+class KoGenStyles;
+class KoGenStyle;
+
+namespace MSOOXML
+{
+    class DrawingMLTheme;
+}
+
+
+class XlsxChartOdfWriter : public KoOdfChartWriter
+{
+public:
+    explicit XlsxChartOdfWriter(KoChart::Chart* chart,
+				const MSOOXML::DrawingMLTheme* const contextWithThemeInfo = NULL);
+    ~XlsxChartOdfWriter();
+
+
+private:
+
+    // All of these are virtual functions called from other functions (mainly
+    // saveContent()) in the parent class.
+
+    QString genChartAreaStyle(KoGenStyle& style, KoGenStyles& styles, KoGenStyles& \
mainStyles); +    QString genPlotAreaStyle(KoGenStyle& style, KoGenStyles& styles, \
KoGenStyles& mainStyles); +    void addDataThemeToStyle(KoGenStyle& style,
+			     int dataNumber, int maxNumData = 1, bool strokes = true);
+
+    QColor calculateColorFromGradientStop(const KoChart::Gradient::GradientStop& \
grad); +    QColor labelFontColor() const;
+
+private:
+    const MSOOXML::DrawingMLTheme* m_theme;
+};
+
+#endif  // XLSXCHARTODFWRITER_H
diff --git a/filters/sheets/xlsx/XlsxImport.cpp b/filters/sheets/xlsx/XlsxImport.cpp
index b0091ca..539d059 100644
--- a/filters/sheets/xlsx/XlsxImport.cpp
+++ b/filters/sheets/xlsx/XlsxImport.cpp
@@ -33,6 +33,7 @@
 #include <MsooXmlSchemas.h>
 #include <MsooXmlContentTypes.h>
 #include <MsooXmlRelationships.h>
+#include "MsooXmlThemesReader.h"
 
 #include <memory>
 
diff --git a/filters/sheets/xlsx/XlsxXmlChartReader.cpp \
b/filters/sheets/xlsx/XlsxXmlChartReader.cpp index 0290bf0..61172f1 100644
--- a/filters/sheets/xlsx/XlsxXmlChartReader.cpp
+++ b/filters/sheets/xlsx/XlsxXmlChartReader.cpp
@@ -23,13 +23,20 @@
  *
  */
 
+// Own
 #include "XlsxXmlChartReader.h"
 
+// libodf2
 #include "Charting.h"
-#include "ChartExport.h"
-#include "XlsxUtils.h"
+
+// libmso
+#include "XlsUtils.h"
 #include "NumberFormatParser.h"
 
+// The Xlsx import filter
+#include "XlsxChartOdfWriter.h"
+
+
 #define MSOOXML_CURRENT_NS "c"
 #define MSOOXML_CURRENT_CLASS XlsxXmlChartReader
 #define BIND_READ_CLASS MSOOXML_CURRENT_CLASS
@@ -369,18 +376,19 @@ QString columnName(uint column)
 
 
 
-XlsxXmlChartReaderContext::XlsxXmlChartReaderContext(KoStore* _storeout, \
ChartExport* _chartExport) \
+XlsxXmlChartReaderContext::XlsxXmlChartReaderContext(KoStore* _storeout, +						     \
XlsxChartOdfWriter* _chartWriter)  : MSOOXML::MsooXmlReaderContext()
     , m_storeout(_storeout)
-    , m_chart(_chartExport->chart())
-    , m_chartExport(_chartExport)
+    , m_chart(_chartWriter->chart())
+    , m_chartWriter(_chartWriter)
 {
 }
 
 XlsxXmlChartReaderContext::~XlsxXmlChartReaderContext()
 {
     delete m_chart;
-    delete m_chartExport;
+    delete m_chartWriter;
 }
 
 XlsxXmlChartReader::XlsxXmlChartReader(KoOdfWriters *writers)
@@ -466,26 +474,26 @@ KoFilter::ConversionStatus \
                XlsxXmlChartReader::read(MSOOXML::MsooXmlReaderContex
     // static is fine here cause we only need to take care that that number is \
                unique in the
     // exported ODS file and do not take if the number is continuous or whatever.
     static int chartNumber = 0;
-    m_context->m_chartExport->m_href = QString("Chart%1").arg(++chartNumber);
+    m_context->m_chartWriter->m_href = QString("Chart%1").arg(++chartNumber);
 
-    Charting::Chart* c = m_context->m_chart;
+    KoChart::Chart* c = m_context->m_chart;
     if (!c->m_cellRangeAddress.isNull() ) {
-        m_context->m_chartExport->m_cellRangeAddress.clear();
+        m_context->m_chartWriter->m_cellRangeAddress.clear();
         if (!c->m_sheetName.isEmpty())
-            m_context->m_chartExport->m_cellRangeAddress += c->m_sheetName + '.';
-        m_context->m_chartExport->m_cellRangeAddress += \
columnName(c->m_cellRangeAddress.left()) + \
QString::number(c->m_cellRangeAddress.top()) + ":" + +            \
m_context->m_chartWriter->m_cellRangeAddress += c->m_sheetName + '.'; +        \
m_context->m_chartWriter->m_cellRangeAddress += \
columnName(c->m_cellRangeAddress.left()) + \
                QString::number(c->m_cellRangeAddress.top()) + ":" +
                                                         \
columnName(c->m_cellRangeAddress.right()) + \
QString::number(c->m_cellRangeAddress.bottom());  }
 
     if (m_currentSeries) {
-        m_context->m_chartExport->m_notifyOnUpdateOfRanges = \
m_currentSeries->m_valuesCellRangeAddress; //m_cellRangeAddress +        \
m_context->m_chartWriter->m_notifyOnUpdateOfRanges = \
m_currentSeries->m_valuesCellRangeAddress; //m_cellRangeAddress  }
 
     // the index will by written by the XlsxXmlWorksheetReader
-    //m_context->m_chartExport->saveIndex(body);
+    //m_context->m_chartWriter->saveIndex(body);
 
     // write the embedded object file
-    m_context->m_chartExport->saveContent(m_context->m_storeout, manifest);
+    m_context->m_chartWriter->saveContent(m_context->m_storeout, manifest);
 
     m_context = 0;
     return KoFilter::OK;
@@ -584,14 +592,14 @@ KoFilter::ConversionStatus XlsxXmlChartReader::read_valAx()
     // This sounds hacky (and it certainly is) but that's how OO.org does it too.
     bool xAxisAlreadyDefined = \
!m_context->m_chart->m_verticalCellRangeAddress.isEmpty();  if (!xAxisAlreadyDefined) \
                {
-        foreach(Charting::Axis* axis, m_context->m_chart->m_axes) {
-            if (axis->m_type == Charting::Axis::HorizontalValueAxis) {
+        foreach(KoChart::Axis* axis, m_context->m_chart->m_axes) {
+            if (axis->m_type == KoChart::Axis::HorizontalValueAxis) {
                 xAxisAlreadyDefined = true;
                 break;
             }
         }
     }
-    Charting::Axis* axis = new Charting::Axis( xAxisAlreadyDefined ? \
Charting::Axis::VerticalValueAxis : Charting::Axis::HorizontalValueAxis ); +    \
KoChart::Axis* axis = new KoChart::Axis( xAxisAlreadyDefined ? \
KoChart::Axis::VerticalValueAxis : KoChart::Axis::HorizontalValueAxis );  
     m_context->m_chart->m_axes.push_back( axis );
     while (!atEnd()) {
@@ -602,14 +610,14 @@ KoFilter::ConversionStatus XlsxXmlChartReader::read_valAx()
 //                   const QXmlStreamAttributes attrs(attributes());
 //                   TRY_READ_ATTR_WITHOUT_NS(val)
 //                   if ( val == QLatin1String( "b" ) ){
-//                       axis->m_type = Charting::Axis::HorizontalValueAxis;
+//                       axis->m_type = KoChart::Axis::HorizontalValueAxis;
 //                   }
 //                   else if ( val == QLatin1String( "l" ) ){
 //                   }
 //             }
             }
             else if ( qualifiedName() == QLatin1String( \
                QUALIFIED_NAME(majorGridlines) ) ) {
-                axis->m_majorGridlines = Charting::Axis::Gridline( \
Charting::LineFormat( Charting::LineFormat::Solid ) ); +                \
axis->m_majorGridlines = KoChart::Axis::Gridline( KoChart::LineFormat( \
KoChart::LineFormat::Solid ) );  }
             else if ( qualifiedName() == QLatin1String( QUALIFIED_NAME(numFmt) ) ) {
                 const QXmlStreamAttributes attrs(attributes());
@@ -628,7 +636,7 @@ KoFilter::ConversionStatus XlsxXmlChartReader::read_catAx()
     READ_PROLOGUE
     // category-axis or date-axis are always x-axis. They are only defined for the \
                case the
     // x-axis itself defines a category. If not then the x-axis will be defined via \
                read_valAx.
-    Charting::Axis* axis = new Charting::Axis( Charting::Axis::HorizontalValueAxis \
); +    KoChart::Axis* axis = new KoChart::Axis( KoChart::Axis::HorizontalValueAxis \
);  m_context->m_chart->m_axes.push_back( axis );
     while (!atEnd()) {
         readNext();
@@ -643,7 +651,7 @@ KoFilter::ConversionStatus XlsxXmlChartReader::read_catAx()
 //                   }
             }
             else if ( qualifiedName() == QLatin1String( \
                QUALIFIED_NAME(majorGridlines) ) ) {
-                  axis->m_majorGridlines = Charting::Axis::Gridline( \
Charting::LineFormat( Charting::LineFormat::Solid ) ); +                  \
axis->m_majorGridlines = KoChart::Axis::Gridline( KoChart::LineFormat( \
KoChart::LineFormat::Solid ) );  }
             ELSE_TRY_READ_IF(scaling)
         }
@@ -657,7 +665,7 @@ KoFilter::ConversionStatus XlsxXmlChartReader::read_scaling()
 {
     READ_PROLOGUE
     Q_ASSERT(!m_context->m_chart->m_axes.isEmpty());
-    Charting::Axis* axis = m_context->m_chart->m_axes.last();
+    KoChart::Axis* axis = m_context->m_chart->m_axes.last();
     while (!atEnd()) {
         readNext();
         BREAK_IF_END_OF(CURRENT_EL)
@@ -724,7 +732,7 @@ KoFilter::ConversionStatus XlsxXmlChartReader::read_plotArea()
 {
     m_areaContext = PlotArea;
     if (!m_context->m_chart->m_plotArea) {
-        m_context->m_chart->m_plotArea = new Charting::PlotArea();
+        m_context->m_chart->m_plotArea = new KoChart::PlotArea();
     }
     READ_PROLOGUE
     while (!atEnd()) {
@@ -942,12 +950,12 @@ KoFilter::ConversionStatus \
XlsxXmlChartReader::read_chartText_Tx()  state = isStartElement() ? InRichText : \
Start;  break;
             case InStrRef: // plaintext within a series
-//                if (isStartElement() && \
!m_currentSeriesData->m_datasetValue.contains(Charting::Value::SeriesLegendOrTrendlineName)) \
{ +//                if (isStartElement() && \
!m_currentSeriesData->m_datasetValue.contains(KoChart::Value::SeriesLegendOrTrendlineName)) \
{  //                    if (qualifiedName() == QLatin1String(QUALIFIED_NAME(f))) {
-//                        Charting::Value* v = new \
Charting::Value(Charting::Value::SeriesLegendOrTrendlineName, \
Charting::Value::CellRange, readElementText()); +//                        \
KoChart::Value* v = new KoChart::Value(KoChart::Value::SeriesLegendOrTrendlineName, \
KoChart::Value::CellRange, readElementText());  //                        \
m_currentSeriesData->m_datasetValue[v->m_dataId] = v;  //                    } else \
                if (qualifiedName() == QLatin1String(QUALIFIED_NAME(v))) {
-//                        Charting::Value* v = new \
Charting::Value(Charting::Value::SeriesLegendOrTrendlineName, \
Charting::Value::TextOrValue, readElementText()); +//                        \
KoChart::Value* v = new KoChart::Value(KoChart::Value::SeriesLegendOrTrendlineName, \
KoChart::Value::TextOrValue, readElementText());  //                        \
m_currentSeriesData->m_datasetValue[v->m_dataId] = v;  //                    }
 //                }
@@ -982,7 +990,7 @@ KoFilter::ConversionStatus \
XlsxXmlChartReader::read_chartText_Tx()  BREAK_IF_END_OF(rich)
                 }
                 if(!result.isEmpty())
-                    m_context->m_chart->m_texts << new Charting::Text(result);
+                    m_context->m_chart->m_texts << new KoChart::Text(result);
                 state = Start;
                 break;
         }
@@ -1089,7 +1097,7 @@ KoFilter::ConversionStatus XlsxXmlChartReader::read_legend()
 {
     READ_PROLOGUE
     if (!m_context->m_chart->m_legend) {
-        m_context->m_chart->m_legend = new Charting::Legend();
+        m_context->m_chart->m_legend = new KoChart::Legend();
     }
     while (!atEnd()) {
         readNext();
@@ -1267,8 +1275,8 @@ KoFilter::ConversionStatus XlsxXmlChartReader::read_spPr()
     int level = 0;
     bool readingGradient = false;
     bool readingGradientStop = false;
-    Charting::Gradient* gradient = NULL;
-    Charting::Gradient::GradientStop currentStop;
+    KoChart::Gradient* gradient = NULL;
+    KoChart::Gradient::GradientStop currentStop;
     while (!atEnd()) {
         readNext();
         BREAK_IF_END_OF(CURRENT_EL)
@@ -1281,7 +1289,7 @@ KoFilter::ConversionStatus XlsxXmlChartReader::read_spPr()
             if (level == 1)
                 state = isStartElement() ? InFill : Start;
         } else if (qualifiedName() == "a:noFill") {
-            m_currentShapeProperties->lineFill.setType( Charting::Fill::None );
+            m_currentShapeProperties->lineFill.setType( KoChart::Fill::None );
             if (level == 1)
                 state = isStartElement() ? NoFill : Start;
         } else if ((state == NoFill || state == InFill) && qualifiedName() == \
"a:srgbClr") { @@ -1292,7 +1300,7 @@ KoFilter::ConversionStatus \
XlsxXmlChartReader::read_spPr()  if ( readingGradientStop ) {
                         currentStop.knownColorValue = QColor( val );
                     } else {
-                        Charting::AreaFormat *areaFormat = new \
Charting::AreaFormat(QColor(val), QColor(), state == InFill); +                       \
KoChart::AreaFormat *areaFormat = new KoChart::AreaFormat(QColor(val), QColor(), \
state == InFill);  if ( m_areaContext == ChartArea )
                             m_context->m_chart->m_areaFormat = areaFormat;
                         else
@@ -1309,7 +1317,7 @@ KoFilter::ConversionStatus XlsxXmlChartReader::read_spPr()
                     if ( readingGradientStop ) {
                         currentStop.knownColorValue = QColor( val );
                     } else {
-                        Charting::AreaFormat *areaFormat = new \
Charting::AreaFormat(QColor(val), QColor(), state == InFill); +                       \
KoChart::AreaFormat *areaFormat = new KoChart::AreaFormat(QColor(val), QColor(), \
state == InFill);  if ( m_areaContext == ChartArea ) {
                             m_context->m_chart->m_areaFormat = areaFormat;
                         } else {
@@ -1337,7 +1345,7 @@ KoFilter::ConversionStatus XlsxXmlChartReader::read_spPr()
         } else if ( qualifiedName() == "a:gsLst" ) {
             if ( isStartElement() ) {
                 readingGradient = true;
-                gradient =  new Charting::Gradient;
+                gradient =  new KoChart::Gradient;
             } else if ( isEndElement() ) {
                 readingGradient = false;
                 switch ( m_areaContext ) {
@@ -1388,7 +1396,7 @@ KoFilter::ConversionStatus XlsxXmlChartReader::read_spPr()
             if ( !ang.isEmpty() )
                 gradient->angle = ang.toDouble() / 60000.0;
         } else if ( qualifiedName() == "a:noFill" ) {
-            m_currentShapeProperties->lineFill.setType( Charting::Fill::None );
+            m_currentShapeProperties->lineFill.setType( KoChart::Fill::None );
         }
     }
     READ_EPILOGUE
@@ -1412,7 +1420,7 @@ KoFilter::ConversionStatus XlsxXmlChartReader::read_spPr()
 KoFilter::ConversionStatus XlsxXmlChartReader::read_pieChart()
 {
     if(!m_context->m_chart->m_impl) {
-        m_context->m_chart->m_impl = new Charting::PieImpl();
+        m_context->m_chart->m_impl = new KoChart::PieImpl();
     }
 
     while (!atEnd()) {
@@ -1449,7 +1457,7 @@ KoFilter::ConversionStatus XlsxXmlChartReader::read_pieChart()
 KoFilter::ConversionStatus XlsxXmlChartReader::read_pie3DChart()
 {
     if(!m_context->m_chart->m_impl) {
-        m_context->m_chart->m_impl = new Charting::PieImpl();
+        m_context->m_chart->m_impl = new KoChart::PieImpl();
         m_context->m_chart->m_is3d = true;
     }
 
@@ -1504,7 +1512,7 @@ KoFilter::ConversionStatus \
                XlsxXmlChartReader::read_ofPieChart()
     // charts nor does ODF. So, we do the same OO.org is doing and just translate
     // it to pie-chart what is better then nothing.
     if(!m_context->m_chart->m_impl) {
-        m_context->m_chart->m_impl = new Charting::PieImpl();
+        m_context->m_chart->m_impl = new KoChart::PieImpl();
     }
     while (!atEnd()) {
         readNext();
@@ -1539,7 +1547,7 @@ KoFilter::ConversionStatus \
XlsxXmlChartReader::read_ofPieChart()  KoFilter::ConversionStatus \
XlsxXmlChartReader::read_doughnutChart()  {
     if(!m_context->m_chart->m_impl) {
-        m_context->m_chart->m_impl = new Charting::RingImpl();
+        m_context->m_chart->m_impl = new KoChart::RingImpl();
     }
 
     while (!atEnd()) {
@@ -1579,7 +1587,7 @@ KoFilter::ConversionStatus \
XlsxXmlChartReader::read_doughnutChart()  KoFilter::ConversionStatus \
XlsxXmlChartReader::read_areaChart()  {
     if(!m_context->m_chart->m_impl) {
-        m_context->m_chart->m_impl = new Charting::AreaImpl();
+        m_context->m_chart->m_impl = new KoChart::AreaImpl();
     }
 
     while (!atEnd()) {
@@ -1620,7 +1628,7 @@ KoFilter::ConversionStatus XlsxXmlChartReader::read_areaChart()
 KoFilter::ConversionStatus XlsxXmlChartReader::read_area3DChart()
 {
     if(!m_context->m_chart->m_impl) {
-        m_context->m_chart->m_impl = new Charting::AreaImpl();
+        m_context->m_chart->m_impl = new KoChart::AreaImpl();
         m_context->m_chart->m_is3d = true;
     }
 
@@ -1664,7 +1672,7 @@ KoFilter::ConversionStatus \
XlsxXmlChartReader::read_area3DChart()  KoFilter::ConversionStatus \
XlsxXmlChartReader::read_barChart()  {
     if(!m_context->m_chart->m_impl) {
-        m_context->m_chart->m_impl = new Charting::BarImpl();
+        m_context->m_chart->m_impl = new KoChart::BarImpl();
     }
 
     while (!atEnd()) {
@@ -1708,7 +1716,7 @@ KoFilter::ConversionStatus XlsxXmlChartReader::read_barChart()
 KoFilter::ConversionStatus XlsxXmlChartReader::read_bar3DChart()
 {
     if(!m_context->m_chart->m_impl) {
-        m_context->m_chart->m_impl = new Charting::BarImpl();
+        m_context->m_chart->m_impl = new KoChart::BarImpl();
         m_context->m_chart->m_is3d = true;
     }
 
@@ -1754,7 +1762,7 @@ KoFilter::ConversionStatus \
XlsxXmlChartReader::read_bar3DChart()  KoFilter::ConversionStatus \
XlsxXmlChartReader::read_lineChart()  {
     if(!m_context->m_chart->m_impl) {
-        m_context->m_chart->m_impl = new Charting::LineImpl();
+        m_context->m_chart->m_impl = new KoChart::LineImpl();
     }
 
     while (!atEnd()) {
@@ -1796,7 +1804,7 @@ KoFilter::ConversionStatus XlsxXmlChartReader::read_lineChart()
 KoFilter::ConversionStatus XlsxXmlChartReader::read_line3DChart()
 {
     if(!m_context->m_chart->m_impl) {
-        m_context->m_chart->m_impl = new Charting::LineImpl();
+        m_context->m_chart->m_impl = new KoChart::LineImpl();
         m_context->m_chart->m_is3d = true;
     }
 
@@ -1835,9 +1843,9 @@ KoFilter::ConversionStatus \
                XlsxXmlChartReader::read_line3DChart()
 */
 KoFilter::ConversionStatus XlsxXmlChartReader::read_scatterChart()
 {
-    Charting::ScatterImpl* impl = \
dynamic_cast<Charting::ScatterImpl*>(m_context->m_chart->m_impl); +    \
KoChart::ScatterImpl* impl = \
dynamic_cast<KoChart::ScatterImpl*>(m_context->m_chart->m_impl);  if (!impl) {
-        m_context->m_chart->m_impl = impl = new Charting::ScatterImpl();
+        m_context->m_chart->m_impl = impl = new KoChart::ScatterImpl();
     }
 
     while (!atEnd()) {
@@ -1852,17 +1860,17 @@ KoFilter::ConversionStatus \
XlsxXmlChartReader::read_scatterChart()  const QXmlStreamAttributes \
attrs(attributes());  TRY_READ_ATTR_WITHOUT_NS(val);
                 if ( val == "none" )
-                    impl->style = Charting::ScatterImpl::None;
+                    impl->style = KoChart::ScatterImpl::None;
                 else if ( val == "line" )
-                    impl->style = Charting::ScatterImpl::Line;
+                    impl->style = KoChart::ScatterImpl::Line;
                 else if ( val == "lineMarker" )
-                    impl->style = Charting::ScatterImpl::LineMarker;
+                    impl->style = KoChart::ScatterImpl::LineMarker;
                 else if ( val == "marker" )
-                    impl->style = Charting::ScatterImpl::Marker;
+                    impl->style = KoChart::ScatterImpl::Marker;
                 else if ( val == "smooth" )
-                    impl->style = Charting::ScatterImpl::Smooth;
+                    impl->style = KoChart::ScatterImpl::Smooth;
                 else if ( val == "smoothMarker" )
-                    impl->style = Charting::ScatterImpl::SmoothMarker;
+                    impl->style = KoChart::ScatterImpl::SmoothMarker;
             }
         }
     }
@@ -1891,9 +1899,9 @@ KoFilter::ConversionStatus \
                XlsxXmlChartReader::read_scatterChart()
 */
 KoFilter::ConversionStatus XlsxXmlChartReader::read_radarChart()
 {
-    Charting::RadarImpl* impl = \
dynamic_cast<Charting::RadarImpl*>(m_context->m_chart->m_impl); +    \
KoChart::RadarImpl* impl = \
dynamic_cast<KoChart::RadarImpl*>(m_context->m_chart->m_impl);  if (!impl) {
-        m_context->m_chart->m_impl = impl = new Charting::RadarImpl(false);
+        m_context->m_chart->m_impl = impl = new KoChart::RadarImpl(false);
     }
 
     while (!atEnd()) {
@@ -1936,7 +1944,7 @@ KoFilter::ConversionStatus \
XlsxXmlChartReader::read_radarChart()  KoFilter::ConversionStatus \
XlsxXmlChartReader::read_surfaceChart()  {
     if(!m_context->m_chart->m_impl) {
-        m_context->m_chart->m_impl = new Charting::SurfaceImpl();
+        m_context->m_chart->m_impl = new KoChart::SurfaceImpl();
     }
 
     while (!atEnd()) {
@@ -1973,7 +1981,7 @@ KoFilter::ConversionStatus \
XlsxXmlChartReader::read_surfaceChart()  KoFilter::ConversionStatus \
XlsxXmlChartReader::read_surface3DChart()  {
     if(!m_context->m_chart->m_impl) {
-        m_context->m_chart->m_impl = new Charting::SurfaceImpl();
+        m_context->m_chart->m_impl = new KoChart::SurfaceImpl();
         m_context->m_chart->m_is3d = true;
     }
 
@@ -2015,7 +2023,7 @@ KoFilter::ConversionStatus \
XlsxXmlChartReader::read_surface3DChart()  KoFilter::ConversionStatus \
XlsxXmlChartReader::read_bubbleChart()  {
     if(!m_context->m_chart->m_impl) {
-        m_context->m_chart->m_impl = new Charting::BubbleImpl();
+        m_context->m_chart->m_impl = new KoChart::BubbleImpl();
         m_context->m_chart->m_is3d = true;
     }
 
@@ -2065,7 +2073,7 @@ KoFilter::ConversionStatus \
XlsxXmlChartReader::read_bubbleChart()  KoFilter::ConversionStatus \
XlsxXmlChartReader::read_stockChart()  {
     if(!m_context->m_chart->m_impl) {
-        m_context->m_chart->m_impl = new Charting::StockImpl();
+        m_context->m_chart->m_impl = new KoChart::StockImpl();
     }
 
     while (!atEnd()) {
@@ -2113,7 +2121,7 @@ KoFilter::ConversionStatus \
XlsxXmlChartReader::read_pieChart_Ser()  {
     READ_PROLOGUE2(pieChart_Ser)
 
-    m_currentSeries  = new Charting::Series();
+    m_currentSeries  = new KoChart::Series();
     m_context->m_chart->m_series << m_currentSeries;
 
     PieSeries * tempPieSeriesData = new PieSeries();
@@ -2156,9 +2164,9 @@ KoFilter::ConversionStatus \
XlsxXmlChartReader::read_pieChart_Ser()  
     // set explosion
     if (tempPieSeriesData->m_explosion != 0) {
-        if(Charting::PieImpl* pie = \
dynamic_cast<Charting::PieImpl*>(m_context->m_chart->m_impl)) { +        \
if(KoChart::PieImpl* pie = \
dynamic_cast<KoChart::PieImpl*>(m_context->m_chart->m_impl)) {  Q_UNUSED(pie);
-            m_currentSeries->m_datasetFormat << new \
Charting::PieFormat(tempPieSeriesData->m_explosion); +            \
m_currentSeries->m_datasetFormat << new \
KoChart::PieFormat(tempPieSeriesData->m_explosion);  }
     }
 
@@ -2195,7 +2203,7 @@ KoFilter::ConversionStatus \
XlsxXmlChartReader::read_bubbleChart_Ser()  {
     READ_PROLOGUE2(bubbleChart_Ser)
 
-    m_currentSeries  = new Charting::Series();
+    m_currentSeries  = new KoChart::Series();
     m_context->m_chart->m_series << m_currentSeries;
 
     BubbleSeries * tempBubbleSeriesData = new BubbleSeries();
@@ -2279,7 +2287,7 @@ KoFilter::ConversionStatus \
XlsxXmlChartReader::read_scatterChart_Ser()  {
     READ_PROLOGUE2(scatterChart_Ser)
 
-    m_currentSeries  = new Charting::Series();
+    m_currentSeries  = new KoChart::Series();
     m_context->m_chart->m_series << m_currentSeries;
 
     ScatterSeries * tempScatterSeriesData = new ScatterSeries();
@@ -2297,7 +2305,7 @@ KoFilter::ConversionStatus \
XlsxXmlChartReader::read_scatterChart_Ser()  if (isStartElement()) {
             if (QUALIFIED_NAME_IS(spPr) )
             {
-                m_currentSeries->spPr = new Charting::ShapeProperties;
+                m_currentSeries->spPr = new KoChart::ShapeProperties;
                 m_currentShapeProperties  = m_currentSeries->spPr;
             }
             ELSE_TRY_READ_IF(order)
@@ -2365,7 +2373,7 @@ KoFilter::ConversionStatus \
XlsxXmlChartReader::read_barChart_Ser()  {
     READ_PROLOGUE2(barChart_Ser)
 
-    m_currentSeries  = new Charting::Series();
+    m_currentSeries  = new KoChart::Series();
     m_context->m_chart->m_series << m_currentSeries;
 
     BarSeries * tempBarSeriesData = new BarSeries();
@@ -2434,7 +2442,7 @@ KoFilter::ConversionStatus \
XlsxXmlChartReader::read_areaChart_Ser()  {
     READ_PROLOGUE2(areaChart_Ser)
 
-    m_currentSeries  = new Charting::Series();
+    m_currentSeries  = new KoChart::Series();
     m_context->m_chart->m_series << m_currentSeries;
 
     AreaSeries * tempAreaSeriesData = new AreaSeries();
@@ -2500,7 +2508,7 @@ KoFilter::ConversionStatus \
XlsxXmlChartReader::read_radarChart_Ser()  {
     READ_PROLOGUE2(radarChart_Ser)
 
-    m_currentSeries  = new Charting::Series();
+    m_currentSeries  = new KoChart::Series();
     m_context->m_chart->m_series << m_currentSeries;
 
     RadarSeries * tempRadarSeriesData = new RadarSeries();
@@ -2571,7 +2579,7 @@ KoFilter::ConversionStatus \
XlsxXmlChartReader::read_lineChart_Ser()  {
     READ_PROLOGUE2(lineChart_Ser)
 
-    m_currentSeries  = new Charting::Series();
+    m_currentSeries  = new KoChart::Series();
     m_context->m_chart->m_series << m_currentSeries;
 
     LineSeries * tempLineSeriesData = new LineSeries();
@@ -2615,28 +2623,28 @@ KoFilter::ConversionStatus \
XlsxXmlChartReader::read_lineChart_Ser()  READ_EPILOGUE
 }
 
-Charting::MarkerType markerType(const QString &_val)
+KoChart::MarkerType markerType(const QString &_val)
 {
     const QString val = _val.toLower();
     if ( val == "star" )
-        return Charting::StarMarker;
+        return KoChart::StarMarker;
     if ( val == "dash" )
-        return Charting::DashMarker;
+        return KoChart::DashMarker;
     if ( val == "dot" )
-        return Charting::DotMarker;
+        return KoChart::DotMarker;
     if ( val == "plus" )
-        return Charting::PlusMarker;
+        return KoChart::PlusMarker;
     if ( val == "circle" )
-        return Charting::CircleMarker;
+        return KoChart::CircleMarker;
     if ( val == "x" )
-        return Charting::SymbolXMarker;
+        return KoChart::SymbolXMarker;
     if ( val == "triangle" )
-        return Charting::TriangleMarker;
+        return KoChart::TriangleMarker;
     if ( val == "squre" )
-        return Charting::SquareMarker;
+        return KoChart::SquareMarker;
     if ( val == "diamond" )
-        return Charting::DiamondMarker;
-    return Charting::NoMarker;
+        return KoChart::DiamondMarker;
+    return KoChart::NoMarker;
 }
 
 #undef CURRENT_EL
@@ -2664,7 +2672,7 @@ KoFilter::ConversionStatus XlsxXmlChartReader::read_marker()
 
     if (!gotSymbol)
         if (MSOOXML::Utils::convertBooleanAttr(val, true))
-            m_context->m_chart->m_markerType = Charting::AutoMarker;
+            m_context->m_chart->m_markerType = KoChart::AutoMarker;
 
     READ_EPILOGUE
     return KoFilter::OK;
@@ -2696,7 +2704,7 @@ KoFilter::ConversionStatus XlsxXmlChartReader::read_serMarker()
 
     if (!gotSymbol)
         if (MSOOXML::Utils::convertBooleanAttr(val, true))
-            m_currentSeries->m_markerType = Charting::AutoMarker;
+            m_currentSeries->m_markerType = KoChart::AutoMarker;
 
     READ_EPILOGUE
 }
@@ -2725,7 +2733,7 @@ KoFilter::ConversionStatus \
XlsxXmlChartReader::read_surfaceChart_Ser()  {
     READ_PROLOGUE2(surfaceChart_Ser)
 
-    m_currentSeries  = new Charting::Series();
+    m_currentSeries  = new KoChart::Series();
     m_context->m_chart->m_series << m_currentSeries;
 
     SurfaceSeries * tempSurfaceSeriesData = new SurfaceSeries();
@@ -2832,7 +2840,7 @@ KoFilter::ConversionStatus XlsxXmlChartReader::read_grouping()
 */
 KoFilter::ConversionStatus XlsxXmlChartReader::read_firstSliceAng()
 {
-    if(Charting::PieImpl* pie = \
dynamic_cast<Charting::PieImpl*>(m_context->m_chart->m_impl)) { +    \
if(KoChart::PieImpl* pie = \
dynamic_cast<KoChart::PieImpl*>(m_context->m_chart->m_impl)) {  const \
QXmlStreamAttributes attrs(attributes());  QString \
val(attrs.value("val").toString());  pie->m_anStart = val.toInt(); // default value \
is zero @@ -2857,7 +2865,7 @@ KoFilter::ConversionStatus \
                XlsxXmlChartReader::read_firstSliceAng()
 */
 KoFilter::ConversionStatus XlsxXmlChartReader::read_holeSize()
 {
-    if(Charting::RingImpl* ring = \
dynamic_cast<Charting::RingImpl*>(m_context->m_chart->m_impl)) { +    \
if(KoChart::RingImpl* ring = \
dynamic_cast<KoChart::RingImpl*>(m_context->m_chart->m_impl)) {  const \
QXmlStreamAttributes attrs(attributes());  QString \
val(attrs.value("val").toString());  ring->m_pcDonut = val.toInt(); // default value \
is zero @@ -2916,7 +2924,7 @@ KoFilter::ConversionStatus \
XlsxXmlChartReader::read_bubbleScale()  const QXmlStreamAttributes \
attrs(attributes());  QString val(attrs.value("val").toString());
 
-    if(Charting::BubbleImpl* bubble = \
dynamic_cast<Charting::BubbleImpl*>(m_context->m_chart->m_impl)) { +    \
if(KoChart::BubbleImpl* bubble = \
dynamic_cast<KoChart::BubbleImpl*>(m_context->m_chart->m_impl)) {  bool ok;
         const int i = val.toInt(&ok);
         if(ok)
@@ -3359,7 +3367,7 @@ QString \
XlsxXmlChartReader::AlocateAndWriteIntoInternalTable(QVector< QString >  
     //create range where to place the data
     QString range("local");
-    Charting::InternalTable *internalTable = &m_context->m_chart->m_internalTable;
+    KoChart::InternalTable *internalTable = &m_context->m_chart->m_internalTable;
 
     range += "!$" + columnName(internalTable->maxColumn()+1) +"$" + "1" + ":$" + \
columnName(internalTable->maxColumn()+1) +  "$" + QString::number(buffer.size());
@@ -3462,13 +3470,13 @@ void XlsxXmlChartReader::WriteIntoInternalTable(QString \
&range, QVector< QString  //
 //    kDebug()<<"buffer.size() " << buffer.size();
 
-    Charting::InternalTable *internalTable = &m_context->m_chart->m_internalTable;
+    KoChart::InternalTable *internalTable = &m_context->m_chart->m_internalTable;
     if (startColumn < endColumn) {
         if ((endColumn - startColumn +1) == buffer.size()) {
 
             int bufferIndex = 0;
             for(int i = startColumn; i <=endColumn; i++,bufferIndex++) {
-                Charting::Cell *cell = internalTable->cell(i,startRow,true);
+                KoChart::Cell *cell = internalTable->cell(i,startRow,true);
                 cell->m_valueType = convertToFormat( formatType );
                 cell->m_value = convertToFormat( formatType, formatString, \
buffer[bufferIndex] );  //                kDebug()<<"m_value " << format;
@@ -3482,7 +3490,7 @@ void XlsxXmlChartReader::WriteIntoInternalTable(QString &range, \
QVector< QString  
             int bufferIndex = 0;
             for(int i = startRow; i <=endRow; i++,bufferIndex++) {
-                Charting::Cell *cell = internalTable->cell(startColumn,i,true);
+                KoChart::Cell *cell = internalTable->cell(startColumn,i,true);
                 cell->m_valueType = convertToFormat( formatType );
                 cell->m_value = convertToFormat( formatType, formatString, \
buffer[bufferIndex] );  //                kDebug()<<"m_value " << format;
@@ -3493,7 +3501,7 @@ void XlsxXmlChartReader::WriteIntoInternalTable(QString &range, \
QVector< QString  }
     } else {
         if (buffer.size() != 0) {
-            Charting::Cell *cell = internalTable->cell(startColumn,startRow,true);
+            KoChart::Cell *cell = internalTable->cell(startColumn,startRow,true);
             cell->m_valueType = convertToFormat( formatType );
             cell->m_value = convertToFormat( formatType, formatString, buffer[ 0 ] \
);  //            kDebug()<<"m_value " << format;
diff --git a/filters/sheets/xlsx/XlsxXmlChartReader.h \
b/filters/sheets/xlsx/XlsxXmlChartReader.h index a2b07e8..5329062 100644
--- a/filters/sheets/xlsx/XlsxXmlChartReader.h
+++ b/filters/sheets/xlsx/XlsxXmlChartReader.h
@@ -27,21 +27,21 @@
 
 #include <MsooXmlCommonReader.h>
 
-namespace Charting {
+namespace KoChart {
     class Series;
     class Chart;
     class ShapeProperties;
 }
 
-class ChartExport;
+class XlsxChartOdfWriter;
 
 class XlsxXmlChartReaderContext : public MSOOXML::MsooXmlReaderContext
 {
 public:
     KoStore* m_storeout;
-    Charting::Chart* m_chart;
-    ChartExport* m_chartExport;
-    explicit XlsxXmlChartReaderContext(KoStore* _storeout, ChartExport* \
_chartExport); +    KoChart::Chart* m_chart;
+    XlsxChartOdfWriter* m_chartWriter;
+    explicit XlsxXmlChartReaderContext(KoStore* _storeout, XlsxChartOdfWriter* \
_chartWriter);  virtual ~XlsxXmlChartReaderContext();
 };
 
@@ -133,8 +133,8 @@ private:
     enum ReadTxContext{ Title, None };
     enum ReadAreaContext{ PlotArea, ChartArea };
     XlsxXmlChartReaderContext *m_context;
-    Charting::Series *m_currentSeries;
-    Charting::ShapeProperties* m_currentShapeProperties;
+    KoChart::Series *m_currentSeries;
+    KoChart::ShapeProperties* m_currentShapeProperties;
     QString m_cellRangeAddress;
     ReadTxContext m_readTxContext;
     ReadAreaContext m_areaContext;
diff --git a/filters/sheets/xlsx/XlsxXmlCommentsReader.h \
b/filters/sheets/xlsx/XlsxXmlCommentsReader.h index e025a06..6846b7a 100644
--- a/filters/sheets/xlsx/XlsxXmlCommentsReader.h
+++ b/filters/sheets/xlsx/XlsxXmlCommentsReader.h
@@ -25,7 +25,7 @@
 #define XLSXXMLCOMMENTSREADER_H
 
 #include "XlsxXmlCommonReader.h"
-#include <MsooXmlThemesReader.h>
+#include <MsooXmlTheme.h>
 
 class XlsxXmlWorksheetReaderContext;
 class XlsxComments;
diff --git a/filters/sheets/xlsx/XlsxXmlCommonReader.h \
b/filters/sheets/xlsx/XlsxXmlCommonReader.h index e406b0a..0cd58df 100644
--- a/filters/sheets/xlsx/XlsxXmlCommonReader.h
+++ b/filters/sheets/xlsx/XlsxXmlCommonReader.h
@@ -24,7 +24,7 @@
 #ifndef XLSXXMLCOMMONREADER_H
 #define XLSXXMLCOMMONREADER_H
 
-#include <MsooXmlThemesReader.h>
+#include <MsooXmlTheme.h>
 #include <MsooXmlReader.h>
 #include <KoGenStyle.h>
 
diff --git a/filters/sheets/xlsx/XlsxXmlDocumentReader.cpp \
b/filters/sheets/xlsx/XlsxXmlDocumentReader.cpp index a4961ee..9b7728d 100644
--- a/filters/sheets/xlsx/XlsxXmlDocumentReader.cpp
+++ b/filters/sheets/xlsx/XlsxXmlDocumentReader.cpp
@@ -21,7 +21,11 @@
  *
  */
 
+// Own
 #include "XlsxXmlDocumentReader.h"
+
+#include <KoBorder.h>  // needed by DrawingMLMethodso
+
 #include "XlsxXmlWorksheetReader.h"
 #include "XlsxXmlCommentsReader.h"
 #include "XlsxImport.h"
diff --git a/filters/sheets/xlsx/XlsxXmlDocumentReader.h \
b/filters/sheets/xlsx/XlsxXmlDocumentReader.h index 6395799..90f0fe5 100644
--- a/filters/sheets/xlsx/XlsxXmlDocumentReader.h
+++ b/filters/sheets/xlsx/XlsxXmlDocumentReader.h
@@ -24,7 +24,8 @@
 #ifndef XLSXXMLDOCUMENTREADER_H
 #define XLSXXMLDOCUMENTREADER_H
 
-#include <MsooXmlThemesReader.h>
+#include <MsooXmlTheme.h>
+#include <MsooXmlReader.h>
 
 #include <QMap>
 
diff --git a/filters/sheets/xlsx/XlsxXmlDrawingReader.cpp \
b/filters/sheets/xlsx/XlsxXmlDrawingReader.cpp index def1ff6..e53b73b 100644
--- a/filters/sheets/xlsx/XlsxXmlDrawingReader.cpp
+++ b/filters/sheets/xlsx/XlsxXmlDrawingReader.cpp
@@ -28,7 +28,7 @@
 #include "XlsxXmlChartReader.h"
 #include "XlsxImport.h"
 #include "Charting.h"
-#include "ChartExport.h"
+#include "XlsxChartOdfWriter.h"
 
 #include <MsooXmlSchemas.h>
 #include <MsooXmlUtils.h>
@@ -96,7 +96,7 @@ void XlsxDrawingObject::save(KoXmlWriter* xmlWriter)
             // nothing to do for us
         } break;
         case Chart: {
-            m_chart->m_chartExport->saveIndex(xmlWriter);
+            m_chart->m_chartWriter->saveIndex(xmlWriter);
         } break;
         case Diagram: {
             xmlWriter->startElement("draw:g");
diff --git a/filters/sheets/xlsx/XlsxXmlDrawingReader.h \
b/filters/sheets/xlsx/XlsxXmlDrawingReader.h index 69c75ac..0ffe071 100644
--- a/filters/sheets/xlsx/XlsxXmlDrawingReader.h
+++ b/filters/sheets/xlsx/XlsxXmlDrawingReader.h
@@ -25,10 +25,12 @@
 #ifndef XLSXXMLDRAWINGREADER_H
 #define XLSXXMLDRAWINGREADER_H
 
-#include <MsooXmlThemesReader.h>
+#include <MsooXmlTheme.h>
 #include <MsooXmlCommonReader.h>
 
 #include <KoXmlWriter.h>
+#include <KoBorder.h>     // Needed in DrawingMLMethods.h
+
 
 class XlsxImport;
 class XlsxXmlWorksheetReaderContext;
@@ -41,8 +43,6 @@ namespace MSOOXML
     class MsooXmlDiagramReaderContext;
 }
 
-//#include <KoGenStyle.h>
-//#include <styles/KoCharacterStyle.h>
 
 class XlsxShape {
 };
diff --git a/filters/sheets/xlsx/XlsxXmlStylesReader.h \
b/filters/sheets/xlsx/XlsxXmlStylesReader.h index 4793ae3..3e73138 100644
--- a/filters/sheets/xlsx/XlsxXmlStylesReader.h
+++ b/filters/sheets/xlsx/XlsxXmlStylesReader.h
@@ -24,7 +24,7 @@
 #ifndef XLSXXMLSTYLESREADER_H
 #define XLSXXMLSTYLESREADER_H
 
-#include <MsooXmlThemesReader.h>
+#include <MsooXmlTheme.h>
 #include <QFlags>
 #include <QColor>
 
diff --git a/filters/sheets/xlsx/XlsxXmlWorksheetReader.cpp \
b/filters/sheets/xlsx/XlsxXmlWorksheetReader.cpp index 74e1302..c0e8c6b 100644
--- a/filters/sheets/xlsx/XlsxXmlWorksheetReader.cpp
+++ b/filters/sheets/xlsx/XlsxXmlWorksheetReader.cpp
@@ -22,7 +22,9 @@
  *
  */
 
+// Own
 #include "XlsxXmlWorksheetReader.h"
+
 #include "XlsxXmlCommentsReader.h"
 #include "XlsxXmlStylesReader.h"
 #include "XlsxXmlDocumentReader.h"
@@ -31,7 +33,7 @@
 #include "XlsxXmlTableReader.h"
 #include "XlsxImport.h"
 #include "Charting.h"
-#include "ChartExport.h"
+#include "XlsxChartOdfWriter.h"
 #include "FormulaParser.h"
 
 #include <MsooXmlRelationships.h>
diff --git a/filters/sheets/xlsx/XlsxXmlWorksheetReader.h \
b/filters/sheets/xlsx/XlsxXmlWorksheetReader.h index 559a029..82ba7a0 100644
--- a/filters/sheets/xlsx/XlsxXmlWorksheetReader.h
+++ b/filters/sheets/xlsx/XlsxXmlWorksheetReader.h
@@ -25,7 +25,10 @@
 #ifndef XLSXXMLWORKSHEETREADER_H
 #define XLSXXMLWORKSHEETREADER_H
 
-#include <MsooXmlThemesReader.h>
+#include <KoBorder.h>   // needed by DrawingMLMethods
+
+//#include <MsooXmlThemesReader.h>
+#include <MsooXmlTheme.h>
 #include <MsooXmlCommonReader.h>
 
 #include <KoGenStyle.h>
diff --git a/filters/stage/pptx/CMakeLists.txt b/filters/stage/pptx/CMakeLists.txt
index b48615c..d3e659b 100644
--- a/filters/stage/pptx/CMakeLists.txt
+++ b/filters/stage/pptx/CMakeLists.txt
@@ -3,6 +3,7 @@ add_definitions(-DKDE_DEFAULT_DEBUG_AREA=30528)
 include_directories(
     ${KOODF2_INCLUDES}
     ${CMAKE_SOURCE_DIR}/filters/libmsooxml
+    ${CMAKE_SOURCE_DIR}/filters/libmso
     ${CMAKE_SOURCE_DIR}/filters/sheets/xlsx
     ${KOMAIN_INCLUDES}
 )
@@ -15,9 +16,9 @@ set(pptx2odp_PART_SRCS
     PptxXmlSlideReader.cpp
     PptxXmlCommentsReader.cpp
     PptxXmlCommentAuthorsReader.cpp
-    ${CMAKE_SOURCE_DIR}/filters/sheets/xlsx/ChartExport.cpp
+    ${CMAKE_SOURCE_DIR}/filters/sheets/xlsx/XlsxChartOdfWriter.cpp
+    ${CMAKE_SOURCE_DIR}/filters/libodf2/chart/KoOdfChartWriter.cpp
     ${CMAKE_SOURCE_DIR}/filters/sheets/xlsx/XlsxXmlChartReader.cpp
-    ${CMAKE_SOURCE_DIR}/filters/sheets/xlsx/NumberFormatParser.cpp
 )
 
 kde4_add_plugin(calligra_filter_pptx2odp ${pptx2odp_PART_SRCS})
@@ -25,6 +26,7 @@ kde4_add_plugin(calligra_filter_pptx2odp ${pptx2odp_PART_SRCS})
 target_link_libraries(
     calligra_filter_pptx2odp
     komsooxml
+    mso
     koodf2
     koodf
     komain
diff --git a/filters/stage/pptx/PptxXmlSlideReader.cpp \
b/filters/stage/pptx/PptxXmlSlideReader.cpp index 702a381..2346272 100644
--- a/filters/stage/pptx/PptxXmlSlideReader.cpp
+++ b/filters/stage/pptx/PptxXmlSlideReader.cpp
@@ -25,7 +25,7 @@
 #include "PptxImport.h"
 
 #include "Charting.h"
-#include "ChartExport.h"
+#include "KoOdfChartWriter.h"
 #include "XlsxXmlChartReader.h"
 #include "PptxXmlCommentsReader.h"
 
@@ -35,7 +35,7 @@
 #include <MsooXmlUnits.h>
 #include <MsooXmlDrawingTableStyle.h>
 #include <MsooXmlDrawingTableStyleReader.h>
-#include <MsooXmlThemesReader.h>
+#include <MsooXmlTheme.h>
 
 #include <KoXmlWriter.h>
 #include <KoGenStyles.h>
diff --git a/filters/words/docx/import/CMakeLists.txt \
b/filters/words/docx/import/CMakeLists.txt index 70edffb..d698151 100644
--- a/filters/words/docx/import/CMakeLists.txt
+++ b/filters/words/docx/import/CMakeLists.txt
@@ -3,7 +3,8 @@ add_definitions(-DKDE_DEFAULT_DEBUG_AREA=30526)
 include_directories(
     ${KOODF2_INCLUDES}
     ${CMAKE_SOURCE_DIR}/filters/libmsooxml
-    ${CMAKE_SOURCE_DIR}/filters/sheets/xlsx # for Charting
+    ${CMAKE_SOURCE_DIR}/filters/libmso # For NumberFormatParser
+    ${CMAKE_SOURCE_DIR}/filters/sheets/xlsx # for the XlsxChartReader
     ${KOMAIN_INCLUDES}
 )
 
@@ -21,9 +22,9 @@ set(docx2odt_PART_SRCS
     DocxXmlEndnoteReader.cpp
     DocxXmlSettingsReader.cpp
     DocxImport.cpp
-    ${CMAKE_SOURCE_DIR}/filters/sheets/xlsx/ChartExport.cpp
+    ${CMAKE_SOURCE_DIR}/filters/sheets/xlsx/XlsxChartOdfWriter.cpp
+    ${CMAKE_SOURCE_DIR}/filters/libodf2/chart/KoOdfChartWriter.cpp
     ${CMAKE_SOURCE_DIR}/filters/sheets/xlsx/XlsxXmlChartReader.cpp
-    ${CMAKE_SOURCE_DIR}/filters/sheets/xlsx/NumberFormatParser.cpp
 )
 
 kde4_add_plugin(calligra_filter_docx2odt ${docx2odt_PART_SRCS})
@@ -31,6 +32,7 @@ kde4_add_plugin(calligra_filter_docx2odt ${docx2odt_PART_SRCS})
 target_link_libraries(
     calligra_filter_docx2odt
     komsooxml
+    mso
     koodf2
     koodf
     komain
diff --git a/filters/words/docx/import/DocxXmlDocumentReader.cpp \
b/filters/words/docx/import/DocxXmlDocumentReader.cpp index ae7cb0e..cd4010d 100644
--- a/filters/words/docx/import/DocxXmlDocumentReader.cpp
+++ b/filters/words/docx/import/DocxXmlDocumentReader.cpp
@@ -35,7 +35,7 @@
 #include <KoGenStyles.h>
 #include <KoOdfGraphicStyles.h>
 #include <Charting.h>
-#include <ChartExport.h>
+#include <KoOdfChartWriter.h>
 #include <XlsxXmlChartReader.h>
 
 #include <MsooXmlTableStyle.h>
diff --git a/filters/words/docx/import/DocxXmlDocumentReader.h \
b/filters/words/docx/import/DocxXmlDocumentReader.h index bfb9171..38fa71f 100644
--- a/filters/words/docx/import/DocxXmlDocumentReader.h
+++ b/filters/words/docx/import/DocxXmlDocumentReader.h
@@ -29,7 +29,6 @@
 
 #include <MsooXmlCommonReader.h>
 #include <MsooXmlThemesReader.h>
-
 #include <MsooXmlDrawingTableStyle.h>
 
 #include <KoXmlWriter.h>
diff --git a/filters/words/msword-odf/CMakeLists.txt \
b/filters/words/msword-odf/CMakeLists.txt index 36a35f4..177801f 100644
--- a/filters/words/msword-odf/CMakeLists.txt
+++ b/filters/words/msword-odf/CMakeLists.txt
@@ -16,7 +16,6 @@ set(doc2odt_PART_SRCS
    tablehandler.cpp
    graphicshandler.cpp
    drawclient.cpp
-   ../../sheets/xlsx/NumberFormatParser.cpp
 )
 
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}")


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

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