diff options
author | Alberto Villa <avilla@FreeBSD.org> | 2012-05-31 00:09:24 +0000 |
---|---|---|
committer | Alberto Villa <avilla@FreeBSD.org> | 2012-05-31 00:09:24 +0000 |
commit | 7b4e1ec4a5950c12e703456521df41ff4b698fd2 (patch) | |
tree | 23df0789e394e66dc29f4a94ba2d01086142182d /editors/calligra/files | |
parent | - Force commit to document repocopy from KOffice 2 to Calligra. (diff) |
The KDE/FreeBSD team is pleased to announce Calligra Suite 2.4.2, KDE
graphic art and office suite.
Information on this release can be found here:
http://www.calligra.org/news/calligra-2-4-2-released
Information on Calligra Project can be found in its first ever release
announcement:
http://www.calligra.org/news/calligra-2-4-released
Consequently, KOffice 2 has been removed from the ports collection.
As usual, we would like to thank all testers and contributors.
Notes
Notes:
svn path=/head/; revision=297847
Diffstat (limited to 'editors/calligra/files')
6 files changed, 339 insertions, 1402 deletions
diff --git a/editors/calligra/files/patch-cmake__modules__FindWPD.cmake b/editors/calligra/files/patch-cmake__modules__FindWPD.cmake index c3b84828ea03..118a5baaea3b 100644 --- a/editors/calligra/files/patch-cmake__modules__FindWPD.cmake +++ b/editors/calligra/files/patch-cmake__modules__FindWPD.cmake @@ -1,7 +1,7 @@ ---- ./cmake/modules/FindWPD.cmake.orig 2011-03-25 01:34:51.930775929 +0100 -+++ ./cmake/modules/FindWPD.cmake 2011-03-25 01:37:46.910772674 +0100 -@@ -19,13 +19,11 @@ - else (WPD_INCLUDE_DIR AND WPD_LIBRARIES) +--- ./cmake/modules/FindWPD.cmake.orig 2011-10-16 07:29:58.807077221 -0700 ++++ ./cmake/modules/FindWPD.cmake 2011-10-16 07:30:23.717073061 -0700 +@@ -19,17 +19,13 @@ + #else (WPD_INCLUDE_DIR AND WPD_LIBRARIES) if(NOT WIN32) INCLUDE(FindPkgConfig) - pkg_check_modules(WPD libwpd-0.8) @@ -9,9 +9,12 @@ endif(NOT WIN32) FIND_PATH(WPD_INCLUDE_DIR libwpd/libwpd.h - ${WPD_INCLUDE_DIR} -- /usr/include/libwpd-0.8 -- /usr/include/libwpd-0.9 -+ PATH_SUFFIXES libwpd-0.9 + PATHS + ${WPD_INCLUDE_DIR} +- /usr/include/libwpd-0.8 +- /usr/include/libwpd-0.9 + PATH_SUFFIXES +- libwpd-0.8 + libwpd-0.9 ) diff --git a/editors/calligra/files/patch-cmake__modules__FindWPG.cmake b/editors/calligra/files/patch-cmake__modules__FindWPG.cmake index 307c72f717b9..f6cfac8058f3 100644 --- a/editors/calligra/files/patch-cmake__modules__FindWPG.cmake +++ b/editors/calligra/files/patch-cmake__modules__FindWPG.cmake @@ -1,24 +1,32 @@ ---- ./cmake/modules/FindWPG.cmake.orig 2011-03-25 01:38:36.660731693 +0100 -+++ ./cmake/modules/FindWPG.cmake 2011-03-25 01:40:49.690727037 +0100 -@@ -18,11 +18,10 @@ +--- ./cmake/modules/FindWPG.cmake.orig 2011-10-16 07:30:32.257075896 -0700 ++++ ./cmake/modules/FindWPG.cmake 2011-10-16 07:32:34.927100360 -0700 +@@ -18,7 +18,6 @@ IF (NOT WIN32) INCLUDE(FindPkgConfig) - pkg_check_modules(LIBWPG libwpg-0.1) pkg_check_modules(LIBWPG libwpg-0.2) - ENDIF (NOT WIN32) + IF(LIBWPG_FOUND) + SET(LIBWPG_LIBRARY ${LIBWPG_LIBRARIES}) +@@ -32,12 +31,8 @@ -- FIND_LIBRARY(LIBWPG_STREAM_LIBRARIES NAMES libwpg-stream-0.1 wpg-stream-0.1 libwpd-stream-0.9 wpd-stream-0.9 -+ FIND_LIBRARY(LIBWPG_STREAM_LIBRARIES NAMES libwpd-stream-0.9 wpd-stream-0.9 - PATHS - ${LIBWPG_LIBRARIES} - ) -@@ -30,7 +29,7 @@ + FIND_LIBRARY(LIBWPG_STREAM_LIBRARY + NAMES +- libwpg-stream-0.1 +- wpg-stream-0.1 + libwpd-stream-0.9 + wpd-stream-0.9 +- libwpd-stream +- wpd-stream + PATHS + ${LIBWPG_LIBRARIES} + ) +@@ -45,7 +40,7 @@ FIND_PATH(LIBWPG_INCLUDE_DIR libwpg/libwpg.h - PATHS - ${LIBWPG_INCLUDE_DIRS} -- PATH_SUFFIXES libwpg -+ PATH_SUFFIXES libwpg-0.2 - ) + PATHS + ${LIBWPG_INCLUDE_DIRS} +- PATH_SUFFIXES libwpg-0.1 libwpg-0.2 libwpg ++ PATH_SUFFIXES libwpg-0.2 + ) - IF (LIBWPG_INCLUDE_DIR AND LIBWPG_LIBRARIES) + SET(LIBWPG_LIBRARIES ${LIBWPG_LIBRARY} ${LIBWPG_STREAM_LIBRARY}) diff --git a/editors/calligra/files/patch-filters-kword-CMakeLists.txt b/editors/calligra/files/patch-filters-kword-CMakeLists.txt deleted file mode 100644 index 5e139efd9f19..000000000000 --- a/editors/calligra/files/patch-filters-kword-CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ ---- filters/kword/CMakeLists.txt -+++ filters/kword/CMakeLists.txt -@@ -42,7 +42,12 @@ IF( HAVE_SYS_ICONV_H ) - SET( ICONV_COMPILE_DEFINITIONS ${ICONV_COMPILE_DEFINITIONS} "-DHAVE_SYS_ICONV_H" ) - ENDIF( HAVE_SYS_ICONV_H ) - --TRY_RUN( MODERN_ICONV_RUN MODERN_ICONV_COMPILE ${CMAKE_CURRENT_BINARY_DIR}/CMakeTmp ${CMAKE_SOURCE_DIR}/cmake/TestModernIconv.c COMPILE_DEFINITIONS ${ICONV_COMPILE_DEFINITIONS} ) -+TRY_RUN( MODERN_ICONV_RUN MODERN_ICONV_COMPILE -+ ${CMAKE_CURRENT_BINARY_DIR}/CMakeTmp -+ ${CMAKE_SOURCE_DIR}/cmake/TestModernIconv.c -+ CMAKE_FLAGS "-DLINK_LIBRARIES:STRING=${ICONV_LIBRARIES}" -+ "-DINCLUDE_DIRECTORIES:STRING=${ICONV_INCLUDE_DIR}" -+ COMPILE_DEFINITIONS ${ICONV_COMPILE_DEFINITIONS} ) - - IF( MODERN_ICONV_RUN GREATER 0 OR NOT MODERN_ICONV_COMPILE ) - MESSAGE( STATUS "wv2 depends on a modern iconv installation, supporting UNICODELITTLE and" ) diff --git a/editors/calligra/files/patch-git_c804712 b/editors/calligra/files/patch-git_c804712 new file mode 100644 index 000000000000..459ee8fdf18b --- /dev/null +++ b/editors/calligra/files/patch-git_c804712 @@ -0,0 +1,304 @@ +commit c804712c97b24a3774a53a3825f50762089f1f49 +Author: Boudewijn Rempt <boud@valdyas.org> +Date: Fri Apr 20 16:35:40 2012 +0200 + + Make calligra compile with clang + + Clang has some additional restriction. + + if (foo = bar) becomes if ((foo = bar)), while (foo=bar) while ((foo=bar)) + and if ((baz==boz)) if (bas==boz) and so on. + + patch by Matthew Rezny + + CCMAIL: mrezny@hexaneinc.com + CCMAIL: calligra-devel@kde.org + CCMAIL: kimageshop@kde.org + +diff --git a/filters/libmsooxml/MsooXmlUtils.cpp b/filters/libmsooxml/MsooXmlUtils.cpp +index 3975c88..657ce05 100644 +--- filters/libmsooxml/MsooXmlUtils.cpp ++++ filters/libmsooxml/MsooXmlUtils.cpp +@@ -1944,7 +1944,7 @@ QString Utils::ParagraphBulletProperties::convertToListProperties(KoGenStyles& m + } + //MSPowerPoint: A label does NOT inherit Underline from text-properties + //of the 1st text chunk. A bullet does NOT inherit {Italics, Bold}. +- if ((currentFilter == Utils::PptxFilter)) { ++ if (currentFilter == Utils::PptxFilter) { + if (m_type != ParagraphBulletProperties::NumberType) { + out.addAttribute("fo:font-style", "normal"); + out.addAttribute("fo:font-weight", "normal"); +diff --git a/filters/sheets/opencalc/opencalcexport.cc b/filters/sheets/opencalc/opencalcexport.cc +index 7f34f5b..383d328 100644 +--- filters/sheets/opencalc/opencalcexport.cc ++++ filters/sheets/opencalc/opencalcexport.cc +@@ -449,12 +449,11 @@ bool OpenCalcExport::exportBody(QDomDocument & doc, QDomElement & content, const + QString name(sheet->sheetName()); + + int n = name.indexOf(' '); +- if (n != -1) { ++ if (n > -1) { + kDebug(30518) << "Sheet name converting:" << name; +- name[n] == '_'; ++ name.replace(' ','_'); + kDebug(30518) << "Sheet name converted:" << name; + } +- name = name.replace(' ', "_"); + + QRect _printRange = sheet->printSettings()->printRegion().lastRange(); + if (_printRange != (QRect(QPoint(1, 1), QPoint(KS_colMax, KS_rowMax)))) { +diff --git a/filters/words/libexport/ProcessDocument.cc b/filters/words/libexport/ProcessDocument.cc +index 30a4465..0dad6a7 100644 +--- filters/words/libexport/ProcessDocument.cc ++++ filters/words/libexport/ProcessDocument.cc +@@ -515,7 +515,7 @@ static void SubProcessFormatTwoTag(QDomNode myNode, + ValueListFormatData *formatDataList, int formatPos, int formatLen, + KWEFWordsLeader *leader) + { +- if ((formatPos == -1)) { ++ if (formatPos == -1) { + // We have no position defined + kWarning(30508) << "Missing text image position!"; + return; +@@ -551,7 +551,7 @@ static void SubProcessFormatThreeTag(QDomNode myNode, + ValueListFormatData *formatDataList, int formatPos, int /*formatLen*/, + KWEFWordsLeader *leader) + { +- if ((formatPos == -1)) { // formatLen is never there but is 1. ++ if (formatPos == -1) { // formatLen is never there but is 1. + // We have no position and no length defined + kWarning(30508) << "Missing variable formatting!"; + return; +diff --git a/filters/words/msword-odf/wv2/src/bookmark.cpp b/filters/words/msword-odf/wv2/src/bookmark.cpp +index 63e8e6a..cf40c67 100644 +--- filters/words/msword-odf/wv2/src/bookmark.cpp ++++ filters/words/msword-odf/wv2/src/bookmark.cpp +@@ -363,7 +363,7 @@ bool Bookmarks::valid(U16 &num, const U32 ccpText) + //check bookmark names + for (uint i = 0; i < m_name.size(); i++) { + if ( (m_name[i] == UString::null) ) { +- m_name[i] == UString().from(i + 1); ++ m_name[i] = UString().from(i + 1); + } + } + if (m_name.size() < m_start->count()) { +diff --git a/filters/words/rtf/import/rtf-qt/src/UserPropsDestination.cpp b/filters/words/rtf/import/rtf-qt/src/UserPropsDestination.cpp +index 4e6d185..6b9b76e 100644 +--- filters/words/rtf/import/rtf-qt/src/UserPropsDestination.cpp ++++ filters/words/rtf/import/rtf-qt/src/UserPropsDestination.cpp +@@ -38,13 +38,13 @@ namespace RtfReader + if ( value == 30 ) { + m_propertyType = QVariant::String; + } else if ( value == 3 ) { +- m_propertyType == QVariant::Int; ++ m_propertyType = QVariant::Int; + } else if ( value == 5 ) { +- m_propertyType == QVariant::Double; ++ m_propertyType = QVariant::Double; + } else if ( value == 64 ) { +- m_propertyType == QVariant::Date; ++ m_propertyType = QVariant::Date; + } else if ( value == 11 ) { +- m_propertyType == QVariant::Bool; ++ m_propertyType = QVariant::Bool; + } else { + qDebug() << "unhandled value type in UserPropsDestination:" << value; + } +diff --git a/karbon/plugins/tools/filterEffectTool/FilterEffectResource.cpp b/karbon/plugins/tools/filterEffectTool/FilterEffectResource.cpp +index 2b0c959..a31afb1 100644 +--- karbon/plugins/tools/filterEffectTool/FilterEffectResource.cpp ++++ karbon/plugins/tools/filterEffectTool/FilterEffectResource.cpp +@@ -119,10 +119,10 @@ KoFilterEffectStack * FilterEffectResource::toFilterStack() const + + // only allow obect bounding box units + if (e.hasAttribute("filterUnits") && e.attribute("filterUnits") != "objectBoundingBox") +- return false; ++ return 0; + + if (e.attribute("primitiveUnits") != "objectBoundingBox") +- return false; ++ return 0; + + // parse filter region rectangle + QRectF filterRegion; +diff --git a/kexi/kexidb/connection.cpp b/kexi/kexidb/connection.cpp +index d6ccd9c..1eac0b9 100644 +--- kexi/kexidb/connection.cpp ++++ kexi/kexidb/connection.cpp +@@ -3015,7 +3015,7 @@ KexiDB::QuerySchema* Connection::setupQuerySchema(const RecordData &data) + bool ok = true; + const int objID = data[0].toInt(&ok); + if (!ok) +- return false; ++ return 0; + QString sqlText; + if (!loadDataBlock(objID, sqlText, "sql")) { + setError(ERR_OBJECT_NOT_FOUND, +diff --git a/kexi/kexidb/drivers/sqlite/sqlitevacuum.cpp b/kexi/kexidb/drivers/sqlite/sqlitevacuum.cpp +index 5dc1f1d..5c20482 100644 +--- kexi/kexidb/drivers/sqlite/sqlitevacuum.cpp ++++ kexi/kexidb/drivers/sqlite/sqlitevacuum.cpp +@@ -194,7 +194,7 @@ void SQLiteVacuum::sqliteProcessFinished(int exitCode, QProcess::ExitStatus exit + + if (0 != KDE::rename(m_tmpFilePath, m_filePath)) { + kWarning() << "Rename" << m_tmpFilePath << "to" << m_filePath << "failed."; +- m_result == false; ++ m_result = false; + } + + if (m_result == true) { +diff --git a/kexi/kexidb/parser/parser_p.cpp b/kexi/kexidb/parser/parser_p.cpp +index b1e8efe..6d69429 100644 +--- kexi/kexidb/parser/parser_p.cpp ++++ kexi/kexidb/parser/parser_p.cpp +@@ -564,7 +564,7 @@ QuerySchema* buildSelectQuery( + if (!options->whereExpr->validate(parseInfo)) { + setError(parseInfo.errMsg, parseInfo.errDescr); + CLEANUP; +- return false; ++ return 0; + } + querySchema->setWhereExpression(options->whereExpr); + } +diff --git a/kexi/kexiutils/utils.h b/kexi/kexiutils/utils.h +index 4629d66..5d06a2d 100644 +--- kexi/kexiutils/utils.h ++++ kexi/kexiutils/utils.h +@@ -538,7 +538,7 @@ public: + return QHash<Key, T>::insertMulti(key.toLower(), value); + } + const Key key(const T& value, const Key& defaultKey) const { +- return QHash<Key, T>::key(value, key.toLower()); ++ return QHash<Key, T>::key(value, defaultKey.toLower()); + } + int remove(const Key& key) { + return QHash<Key, T>::remove(key.toLower()); +diff --git a/kexi/main/KexiMainWindow.cpp b/kexi/main/KexiMainWindow.cpp +index 33f81f5..3bef113 100644 +--- kexi/main/KexiMainWindow.cpp ++++ kexi/main/KexiMainWindow.cpp +@@ -3434,7 +3434,7 @@ KexiMainWindow::openObjectFromNavigator(KexiPart::Item* item, Kexi::ViewMode vie + return 0; + } + if (!d->prj || !item) +- return false; ++ return 0; + #ifndef KEXI_NO_PENDING_DIALOGS + Private::PendingJobType pendingType; + KexiWindow *window = d->openedWindowFor(item, pendingType); +diff --git a/kexi/migration/mdb/src/mdbtools/libmdb/write.c b/kexi/migration/mdb/src/mdbtools/libmdb/write.c +index 8506b71..b1fbb46 100644 +--- kexi/migration/mdb/src/mdbtools/libmdb/write.c ++++ kexi/migration/mdb/src/mdbtools/libmdb/write.c +@@ -170,7 +170,7 @@ mdb_crack_row(MdbTableDef *table, int row_start, int row_end, MdbField *fields) + } + + bitmask_sz = (row_cols + 7) / 8; +- nullmask = (char*)pg_buf + row_end - bitmask_sz + 1; ++ nullmask = (unsigned char*)pg_buf + row_end - bitmask_sz + 1; + + /* read table of variable column locations */ + row_var_cols = IS_JET4(mdb) ? +diff --git a/krita/image/tiles3/kis_tiled_data_manager.cc b/krita/image/tiles3/kis_tiled_data_manager.cc +index dacef5e..cac55d7 100644 +--- krita/image/tiles3/kis_tiled_data_manager.cc ++++ krita/image/tiles3/kis_tiled_data_manager.cc +@@ -138,7 +138,7 @@ bool KisTiledDataManager::write(KoStore *store) + KisAbstractTileCompressorSP compressor = + KisTileCompressorFactory::create(CURRENT_VERSION); + +- while (tile = iter.tile()) { ++ while ((tile = iter.tile())) { + compressor->writeTile(tile, store); + ++iter; + } +@@ -287,7 +287,7 @@ void KisTiledDataManager::purge(const QRect& area) + KisTileHashTableIterator iter(m_hashTable); + KisTileSP tile; + +- while (tile = iter.tile()) { ++ while ((tile = iter.tile())) { + if (tile->extent().intersects(area)) { + tile->lockForRead(); + if(memcmp(defaultData, tile->data(), tileDataSize) == 0) { +diff --git a/krita/plugins/formats/psd/psd_colormode_block.cpp b/krita/plugins/formats/psd/psd_colormode_block.cpp +index 3466725..ccd6099 100644 +--- krita/plugins/formats/psd/psd_colormode_block.cpp ++++ krita/plugins/formats/psd/psd_colormode_block.cpp +@@ -89,7 +89,7 @@ bool PSDColorModeBlock::valid() + return false; + } + if (colormode == DuoTone && blocksize == 0) { +- error == QString("DuoTone mode, but data block is empty"); ++ error = QString("DuoTone mode, but data block is empty"); + return false; + } + if ((quint32)data.size() != blocksize) { +diff --git a/krita/plugins/tools/tool_perspectivegrid/kis_tool_perspectivegrid.cc b/krita/plugins/tools/tool_perspectivegrid/kis_tool_perspectivegrid.cc +index ba1e1de..c4ae45e 100644 +--- krita/plugins/tools/tool_perspectivegrid/kis_tool_perspectivegrid.cc ++++ krita/plugins/tools/tool_perspectivegrid/kis_tool_perspectivegrid.cc +@@ -138,7 +138,7 @@ void KisToolPerspectiveGrid::mousePressEvent(KoPointerEvent *event) + KisSubPerspectiveGrid* grid = *it; + QPointF gridCenter = grid->center(); + dbgKrita << "click at " << event->point << " top left at " << *grid->topLeft(); +- if (m_selectedNode1 = nodeNearPoint(grid, mousep)) { ++ if (m_selectedNode1 == nodeNearPoint(grid, mousep)) { + m_internalMode = MODE_DRAGING_NODE; + break; + } else if (mouseNear(mousep, ((pixelToView(*grid->topLeft()) + pixelToView(*grid->bottomLeft()))*0.5))) { +@@ -233,7 +233,7 @@ void KisToolPerspectiveGrid::mouseMoveEvent(KoPointerEvent *event) + KisPerspectiveGrid* pGrid = m_canvas->view()->resourceProvider()->currentImage()->perspectiveGrid(); + for (QList<KisSubPerspectiveGrid*>::const_iterator it = pGrid->begin(); it != pGrid->end(); ++it) { + KisSubPerspectiveGrid* grid = *it; +- if (m_higlightedNode = nodeNearPoint(grid, mousep)) { ++ if ((m_higlightedNode = nodeNearPoint(grid, mousep))) { + if (m_higlightedNode == m_selectedNode1 || m_higlightedNode == m_selectedNode2) { + m_higlightedNode = 0; + } else { +diff --git a/libs/kotext/styles/KoTableStyle.cpp b/libs/kotext/styles/KoTableStyle.cpp +index a9ebe62..21bf9af 100644 +--- libs/kotext/styles/KoTableStyle.cpp ++++ libs/kotext/styles/KoTableStyle.cpp +@@ -633,13 +633,13 @@ void KoTableStyle::saveOdf(KoGenStyle &style) + style.addProperty("fo:background-color", backBrush.color().name(), KoGenStyle::TableType); + else + style.addProperty("fo:background-color", "transparent", KoGenStyle::TableType); +- } else if ((key == QTextFormat::FrameLeftMargin)) { ++ } else if (key == QTextFormat::FrameLeftMargin) { + style.addPropertyLength("fo:margin-left", propertyLength(QTextFormat::FrameLeftMargin), KoGenStyle::TableType); +- } else if ((key == QTextFormat::FrameRightMargin)) { ++ } else if (key == QTextFormat::FrameRightMargin) { + style.addPropertyLength("fo:margin-right", propertyLength(QTextFormat::FrameRightMargin), KoGenStyle::TableType); +- } else if ((key == QTextFormat::FrameTopMargin)) { ++ } else if (key == QTextFormat::FrameTopMargin) { + style.addPropertyLength("fo:margin-top", propertyLength(QTextFormat::FrameTopMargin), KoGenStyle::TableType); +- } else if ((key == QTextFormat::FrameBottomMargin)) { ++ } else if (key == QTextFormat::FrameBottomMargin) { + style.addPropertyLength("fo:margin-bottom", propertyLength(QTextFormat::FrameBottomMargin), KoGenStyle::TableType); + } else if (key == KoTableStyle::CollapsingBorders) { + if (collapsingBorderModel()) +diff --git a/libs/odf/KoElementReference.cpp b/libs/odf/KoElementReference.cpp +index 8747574..b51f97f 100644 +--- libs/odf/KoElementReference.cpp ++++ libs/odf/KoElementReference.cpp +@@ -110,5 +110,5 @@ KoElementReference KoElementReference::loadOdf(const KoXmlElement &element) + + void KoElementReference::invalidate() + { +- d->xmlid == QString::null; ++ d->xmlid = QString::null; + } +diff --git a/words/part/KWDocument.cpp b/words/part/KWDocument.cpp +index 30ac20a..65d027c 100644 +--- words/part/KWDocument.cpp ++++ words/part/KWDocument.cpp +@@ -24,7 +24,7 @@ + */ + + #include "KWDocument.h" +-#include "KWFactory.h"< ++#include "KWFactory.h" + #include "KWView.h" + #include "KWCanvas.h" + #include "KWCanvasItem.h" diff --git a/editors/calligra/files/patch-krita_plugins_formats_CMakeLists.txt b/editors/calligra/files/patch-krita_plugins_formats_CMakeLists.txt deleted file mode 100644 index 277c45975334..000000000000 --- a/editors/calligra/files/patch-krita_plugins_formats_CMakeLists.txt +++ /dev/null @@ -1,28 +0,0 @@ ---- krita/plugins/formats/CMakeLists.txt.orig 2010-11-30 04:06:29.223954558 +0100 -+++ krita/plugins/formats/CMakeLists.txt 2010-11-30 04:14:21.883911180 +0100 -@@ -15,15 +15,22 @@ - macro_optional_find_package(Poppler) - macro_log_feature( POPPLER_FOUND "poppler-qt4" "The Poppler Qt4 interface library" "http://poppler.freedesktop.org" FALSE "" "Required by the Krita PDF filter") - --macro_optional_find_package(Kdcraw) --macro_log_feature( KDCRAW_FOUND "kdcraw" "The KDCraw library" "http://www.digikam.org/" FALSE "" "Required by the Krita RAW filter") -- - macro_optional_find_package(OpenJPEG) - macro_log_feature(OPENJPEG_FOUND "openjpeg" "Free library for JPEG 2000 image compression" "http://www.openjpeg.org" FALSE "" "Required by the Krita JPEG 2000 filter") - - macro_optional_find_package(GIF2) - macro_log_feature(GIF_FOUND "libungif/giflib" "Free library for reading and writing GIF images" "http://directory.fsf.org/project/libungif/" FALSE "" "Required by the Krita GIF filter") - -+# Check for Kdcraw -+PKG_CHECK_MODULES(LIBKDCRAW libkdcraw-kde4>=0.4.0) -+FIND_PATH(KDCRAW_INCLUDE_DIR NAMES libkdcraw/version.h -+ PATHS ${LIBKDCRAW_INCLUDE_DIRS} ${KDE4_INCLUDE_DIR} NO_DEFAULT_PATH) -+FIND_LIBRARY(KDCRAW_LIBRARY NAMES kdcraw -+ PATHS ${LIBKDCRAW_LIBRARY_DIRS} ${KDE4_LIB_DIR} NO_DEFAULT_PATH) -+INCLUDE(FindPackageHandleStandardArgs) -+FIND_PACKAGE_HANDLE_STANDARD_ARGS(KDCRAW DEFAULT_MSG KDCRAW_LIBRARY KDCRAW_INCLUDE_DIR) -+macro_log_feature( KDCRAW_FOUND "kdcraw" "The KDCraw library" "http://www.digikam.org/" FALSE "" "Required by the Krita RAW filter") -+ - include_directories(${KRITA_INCLUDES}) - - if(KDCRAW_FOUND) diff --git a/editors/calligra/files/patch-libwpg02-libwpd09 b/editors/calligra/files/patch-libwpg02-libwpd09 deleted file mode 100644 index ee14437564d5..000000000000 --- a/editors/calligra/files/patch-libwpg02-libwpd09 +++ /dev/null @@ -1,1334 +0,0 @@ -diff -Nur ./filters/karbon/wpg/import/CMakeLists.txt ./filters/karbon/wpg/import/CMakeLists.txt ---- ./filters/karbon/wpg/import/CMakeLists.txt 2011-01-15 21:05:35.000000000 +0100 -+++ ./filters/karbon/wpg/import/CMakeLists.txt 2011-01-18 07:40:25.000000000 +0100 -@@ -1,16 +1,11 @@ - -- - include_directories(${CMAKE_BINARY_DIR}/filters/ ${WPD_INCLUDE_DIR} ${LIBWPG_INCLUDE_DIR}/) - --set(wpgimport_PART_SRCS --WPGImport.cpp --OdgExporter.cxx --FileOutputHandler.cxx --GraphicsElement.cxx) -+set(wpgimport_PART_SRCS WPGImport.cpp) - - kde4_add_plugin(wpgimport ${wpgimport_PART_SRCS}) - --target_link_libraries(wpgimport komain ${LIBWPG_LIBRARIES} ${LIBWPG_STREAM_LIBRARIES}) -+target_link_libraries(wpgimport komain ${LIBWPG_LIBRARIES} ${LIBWPG_STREAM_LIBRARIES} ${WPD_LIBRARIES}) - - install(TARGETS wpgimport DESTINATION ${PLUGIN_INSTALL_DIR}) - install(FILES karbon_wpg_import.desktop DESTINATION ${SERVICES_INSTALL_DIR}) -diff -Nur ./filters/karbon/wpg/import/FileOutputHandler.cxx ./filters/karbon/wpg/import/FileOutputHandler.cxx ---- ./filters/karbon/wpg/import/FileOutputHandler.cxx 2011-01-15 21:05:35.000000000 +0100 -+++ ./filters/karbon/wpg/import/FileOutputHandler.cxx 1970-01-01 01:00:00.000000000 +0100 -@@ -1,95 +0,0 @@ --/* libwpg -- * Copyright (C) 2006 Fridrich Strba (fridrich.strba@bluewin.ch) -- * -- * This library is free software; you can redistribute it and/or -- * modify it under the terms of the GNU Library General Public -- * License as published by the Free Software Foundation; either -- * version 2 of the License, or (at your option) any later version. -- * -- * This library is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- * Library General Public License for more details. -- * -- * You should have received a copy of the GNU Library General Public -- * License along with this library; if not, write to the -- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -- * Boston, MA 02111-1301 USA -- * -- * For further information visit http://libwpg.sourceforge.net -- */ -- --/* "This product is not manufactured, approved, or supported by -- * Corel Corporation or Corel Corporation Limited." -- */ -- --#include "FileOutputHandler.hxx" -- --FileOutputHandler::FileOutputHandler(std::ostringstream &contentStream) : -- mbIsTagOpened(false), -- mContentStream(contentStream) --{ --} -- --void FileOutputHandler::startDocument() --{ --} -- --void FileOutputHandler::startElement(const char *psName, const std::vector<std::pair<std::string, std::string> > &xPropList) --{ -- if (mbIsTagOpened) -- { -- mContentStream << ">"; -- mbIsTagOpened = false; -- } -- mContentStream << "<" << psName; -- -- for (std::vector<std::pair<std::string, std::string> >::const_iterator i = xPropList.begin(); i != xPropList.end(); i++) -- { -- mContentStream << " " << (*i).first.c_str() << "=\"" << (*i).second.c_str() << "\""; -- } -- mbIsTagOpened = true; -- msOpenedTagName = psName; --} -- --void FileOutputHandler::endElement(const char *psName) --{ -- if (mbIsTagOpened) -- { -- if( msOpenedTagName == psName ) -- { -- mContentStream << "/>"; -- mbIsTagOpened = false; -- } -- else // should not happen, but handle it -- { -- mContentStream << ">"; -- mContentStream << "</" << psName << ">"; -- mbIsTagOpened = false; -- } -- } -- else -- { -- mContentStream << "</" << psName << ">"; -- mbIsTagOpened = false; -- } --} -- --void FileOutputHandler::characters(const std::string &sCharacters) --{ -- if (mbIsTagOpened) -- { -- mContentStream << ">"; -- mbIsTagOpened = false; -- } -- mContentStream << sCharacters.c_str(); --} -- --void FileOutputHandler::endDocument() --{ -- if (mbIsTagOpened) -- { -- mContentStream << ">"; -- mbIsTagOpened = false; -- } --} -diff -Nur ./filters/karbon/wpg/import/FileOutputHandler.hxx ./filters/karbon/wpg/import/FileOutputHandler.hxx ---- ./filters/karbon/wpg/import/FileOutputHandler.hxx 2011-01-15 21:05:35.000000000 +0100 -+++ ./filters/karbon/wpg/import/FileOutputHandler.hxx 1970-01-01 01:00:00.000000000 +0100 -@@ -1,49 +0,0 @@ --/* libwpg -- * Copyright (C) 2006 Fridrich Strba (fridrich.strba@bluewin.ch) -- * -- * This library is free software; you can redistribute it and/or -- * modify it under the terms of the GNU Library General Public -- * License as published by the Free Software Foundation; either -- * version 2 of the License, or (at your option) any later version. -- * -- * This library is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- * Library General Public License for more details. -- * -- * You should have received a copy of the GNU Library General Public -- * License along with this library; if not, write to the -- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -- * Boston, MA 02111-1301 USA -- * -- * For further information visit http://libwpg.sourceforge.net -- */ -- --/* "This product is not manufactured, approved, or supported by -- * Corel Corporation or Corel Corporation Limited." -- */ -- --#ifndef FILEOUTPUTHANDLER_H --#define FILEOUTPUTHANDLER_H -- --#include <iostream> --#include <sstream> --#include <string> --#include "GraphicsHandler.hxx" -- --class FileOutputHandler : public GraphicsHandler --{ -- public: -- explicit FileOutputHandler(std::ostringstream &contentStream); -- virtual void startDocument(); -- virtual void endDocument(); -- virtual void startElement(const char *psName, const std::vector<std::pair<std::string, std::string> > &xPropList); -- virtual void endElement(const char *psName); -- virtual void characters(const std::string &sCharacters); -- -- private: -- bool mbIsTagOpened; -- std::string msOpenedTagName; -- std::ostringstream &mContentStream; --}; --#endif -diff -Nur ./filters/karbon/wpg/import/GraphicsElement.cxx ./filters/karbon/wpg/import/GraphicsElement.cxx ---- ./filters/karbon/wpg/import/GraphicsElement.cxx 2011-01-15 21:05:35.000000000 +0100 -+++ ./filters/karbon/wpg/import/GraphicsElement.cxx 1970-01-01 01:00:00.000000000 +0100 -@@ -1,66 +0,0 @@ --/* GraphicsElement: The items we are collecting to be put into the Writer -- * document: paragraph and spans of text, as well as section breaks. -- * -- * Copyright (C) 2002-2003 William Lachance (william.lachance@sympatico.ca) -- * -- * 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 -- * Library General Public License for more details. -- * -- * You should have received a copy of the GNU Library General Public -- * License along with this library; if not, write to the -- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -- * Boston, MA 02111-1301 USA -- * -- * For further information visit http://libwpg.sourceforge.net -- * -- */ -- --/* "This product is not manufactured, approved, or supported by -- * Corel Corporation or Corel Corporation Limited." -- */ -- --#include "GraphicsElement.hxx" --#include "GraphicsHandler.hxx" --#include <string.h> -- --#define ASCII_SPACE 0x0020 -- --void TagGraphicsElement::print() const --{ --} -- --void OpenTagGraphicsElement::write(GraphicsHandler *pHandler) const --{ -- pHandler->startElement(getTagName().c_str(), maAttrList); --} -- --void OpenTagGraphicsElement::print() const --{ -- TagGraphicsElement::print(); --} -- --void OpenTagGraphicsElement::addAttribute(const std::string &szAttributeName, const std::string &sAttributeValue) --{ -- std::pair<std::string, std::string> tmpAttribute; -- tmpAttribute.first = szAttributeName; -- tmpAttribute.second = sAttributeValue; -- maAttrList.push_back(tmpAttribute); --} -- --void CloseTagGraphicsElement::write(GraphicsHandler *pHandler) const --{ -- -- pHandler->endElement(getTagName().c_str()); --} -- --void CharDataGraphicsElement::write(GraphicsHandler *pHandler) const --{ -- pHandler->characters(msData); --} -diff -Nur ./filters/karbon/wpg/import/GraphicsElement.hxx ./filters/karbon/wpg/import/GraphicsElement.hxx ---- ./filters/karbon/wpg/import/GraphicsElement.hxx 2011-01-15 21:05:35.000000000 +0100 -+++ ./filters/karbon/wpg/import/GraphicsElement.hxx 1970-01-01 01:00:00.000000000 +0100 -@@ -1,84 +0,0 @@ --/* GraphicsElement: The items we are collecting to be put into the Writer -- * document: paragraph and spans of text, as well as section breaks. -- * -- * Copyright (C) 2002-2003 William Lachance (william.lachance@sympatico.ca) -- * -- * 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 -- * Library General Public License for more details. -- * -- * You should have received a copy of the GNU Library General Public -- * License along with this library; if not, write to the -- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -- * Boston, MA 02111-1301 USA -- * -- * For further information visit http://libwpd.sourceforge.net -- * -- */ -- --/* "This product is not manufactured, approved, or supported by -- * Corel Corporation or Corel Corporation Limited." -- */ -- --#ifndef _GRAPHICSELEMENT_H --#define _GRAPHICSELEMENT_H --#include <string> --#include <map> --#include <vector> -- --#include "GraphicsHandler.hxx" -- --class GraphicsElement --{ --public: -- virtual ~GraphicsElement() {} -- virtual void write(GraphicsHandler *pHandler) const = 0; -- virtual void print() const {} --}; -- --class TagGraphicsElement : public GraphicsElement --{ --public: -- explicit TagGraphicsElement(const char *szTagName) : msTagName(szTagName) {} -- const std::string &getTagName() const { return msTagName; } -- virtual void print() const; --private: -- const std::string msTagName; --}; -- --class OpenTagGraphicsElement : public TagGraphicsElement --{ --public: -- explicit OpenTagGraphicsElement(const char *szTagName) : TagGraphicsElement(szTagName) {} -- ~OpenTagGraphicsElement() {} -- void addAttribute(const std::string &szAttributeName, const std::string &sAttributeValue); -- virtual void write(GraphicsHandler *pHandler) const; -- virtual void print () const; --private: -- std::vector<std::pair<std::string, std::string> > maAttrList; --}; -- --class CloseTagGraphicsElement : public TagGraphicsElement --{ --public: -- explicit CloseTagGraphicsElement(const char *szTagName) : TagGraphicsElement(szTagName) {} -- virtual void write(GraphicsHandler *pHandler) const; --}; -- --class CharDataGraphicsElement : public GraphicsElement --{ --public: -- CharDataGraphicsElement(const char *sData) : GraphicsElement(), msData(sData) {} -- virtual void write(GraphicsHandler *pHandler) const; --private: -- std::string msData; --}; -- -- --#endif -diff -Nur ./filters/karbon/wpg/import/GraphicsHandler.hxx ./filters/karbon/wpg/import/GraphicsHandler.hxx ---- ./filters/karbon/wpg/import/GraphicsHandler.hxx 2011-01-15 21:05:35.000000000 +0100 -+++ ./filters/karbon/wpg/import/GraphicsHandler.hxx 1970-01-01 01:00:00.000000000 +0100 -@@ -1,43 +0,0 @@ --/* -- * Copyright (C) 2004 William Lachance (wlach@interlog.com) -- * Copyright (C) 2004 Net Integration Technologies (http://www.net-itech.com) -- * -- * This program is free software; you can redistribute it and/or -- * modify it under the terms of the GNU 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 General Public License for more details. -- * -- * You should have received a copy of the GNU Library General Public -- * License along with this library; if not, write to the -- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -- * Boston, MA 02111-1301 USA -- * -- * Contributor(s): Martin Gallwey (gallwey@sun.com) -- * -- */ -- --/* "This product is not manufactured, approved, or supported by -- * Corel Corporation or Corel Corporation Limited." -- */ --#ifndef _GRAPHICSHANDLER_H --#define _GRAPHICSHANDLER_H --#include <string> --#include <map> --#include <vector> -- --class GraphicsHandler --{ --public: -- virtual ~GraphicsHandler() {} -- virtual void startDocument() = 0; -- virtual void endDocument() = 0; -- virtual void startElement(const char *psName, const std::vector< std::pair <std::string, std::string> > &xPropList) = 0; -- virtual void endElement(const char *psName) = 0; -- virtual void characters(const std::string &sCharacters) = 0; --}; --#endif -diff -Nur ./filters/karbon/wpg/import/karbon_wpg_import.desktop ./filters/karbon/wpg/import/karbon_wpg_import.desktop ---- ./filters/karbon/wpg/import/karbon_wpg_import.desktop 2011-01-15 21:05:35.000000000 +0100 -+++ ./filters/karbon/wpg/import/karbon_wpg_import.desktop 2011-01-18 07:41:33.000000000 +0100 -@@ -42,7 +42,7 @@ - Name[x-test]=xxKarbon WPG Import Filterxx - Name[zh_CN]=Karbon WPG 导入过滤器 - Name[zh_TW]=Karbon WPG 匯入過濾程式 --X-KDE-Export=application/vnd.oasis.opendocument.graphics -+X-KDE-Export=image/svg+xml - X-KDE-Import=application/x-wpg - X-KDE-Weight=1 - X-KDE-Library=wpgimport -diff -Nur ./filters/karbon/wpg/import/OdgExporter.cxx ./filters/karbon/wpg/import/OdgExporter.cxx ---- ./filters/karbon/wpg/import/OdgExporter.cxx 2011-01-15 21:05:35.000000000 +0100 -+++ ./filters/karbon/wpg/import/OdgExporter.cxx 1970-01-01 01:00:00.000000000 +0100 -@@ -1,662 +0,0 @@ --/* libwpg -- * Copyright (C) 2006 Ariya Hidayat (ariya@kde.org) -- * Copyright (C) 2006 Fridrich Strba (fridrich.strba@bluewin.ch) -- * -- * This library is free software; you can redistribute it and/or -- * modify it under the terms of the GNU Library General Public -- * License as published by the Free Software Foundation; either -- * version 2 of the License, or (at your option) any later version. -- * -- * This library is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- * Library General Public License for more details. -- * -- * You should have received a copy of the GNU Library General Public -- * License along with this library; if not, write to the -- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -- * Boston, MA 02111-1301 USA -- * -- * For further information visit http://libwpg.sourceforge.net -- */ -- --/* "This product is not manufactured, approved, or supported by -- * Corel Corporation or Corel Corporation Limited." -- */ -- --#include "OdgExporter.hxx" --#include "GraphicsElement.hxx" --#include "GraphicsHandler.hxx" --#include <locale.h> -- --static std::string doubleToString(const double value) --{ -- std::ostringstream tempStream; -- tempStream << value; -- std::string decimalPoint(localeconv()->decimal_point); -- if ((decimalPoint.size() == 0) || (decimalPoint == ".")) -- return tempStream.str(); -- std::string stringValue(tempStream.str()); -- if (!stringValue.empty()) -- { -- std::string::size_type pos; -- while ((pos = stringValue.find(decimalPoint)) != std::string::npos) -- stringValue.replace(pos,decimalPoint.size(),"."); -- } -- return stringValue; --} -- -- --OdgExporter::OdgExporter(GraphicsHandler *pHandler, const bool isFlatXML): -- mpHandler(pHandler), -- m_fillRule(AlternatingFill), -- m_gradientIndex(1), -- m_dashIndex(1), -- m_styleIndex(1), -- m_width(0.0f), -- m_height(0.0f), -- m_isFlatXML(isFlatXML) --{ --} -- --OdgExporter::~OdgExporter() --{ -- for (std::vector <GraphicsElement *>::iterator iterStroke = mStrokeDashElements.begin(); -- iterStroke != mStrokeDashElements.end(); iterStroke++) -- delete (*iterStroke); -- -- for (std::vector <GraphicsElement *>::iterator iterGradient = mGradientElements.begin(); -- iterGradient != mGradientElements.end(); iterGradient++) -- delete (*iterGradient); -- -- for (std::vector <GraphicsElement *>::iterator iterAutomaticStyles = mAutomaticStylesElements.begin(); -- iterAutomaticStyles != mAutomaticStylesElements.end(); iterAutomaticStyles++) -- delete (*iterAutomaticStyles); -- -- for (std::vector<GraphicsElement *>::iterator bodyIter = mBodyElements.begin(); -- bodyIter != mBodyElements.end(); bodyIter++) -- delete (*bodyIter); --} -- --void OdgExporter::startGraphics(double width, double height) --{ -- m_gradientIndex = 1; -- m_dashIndex = 1; -- m_styleIndex = 1; -- m_width = width; -- m_height = height; -- -- -- mpHandler->startDocument(); -- OpenTagGraphicsElement tmpOfficeDocumentContent("office:document"); -- tmpOfficeDocumentContent.addAttribute("xmlns:office", "urn:oasis:names:tc:opendocument:xmlns:office:1.0"); -- tmpOfficeDocumentContent.addAttribute("xmlns:style", "urn:oasis:names:tc:opendocument:xmlns:style:1.0"); -- tmpOfficeDocumentContent.addAttribute("xmlns:text", "urn:oasis:names:tc:opendocument:xmlns:text:1.0"); -- tmpOfficeDocumentContent.addAttribute("xmlns:draw", "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"); -- tmpOfficeDocumentContent.addAttribute("xmlns:dc", "http://purl.org/dc/elements/1.1/"); -- tmpOfficeDocumentContent.addAttribute("xmlns:svg", "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"); -- tmpOfficeDocumentContent.addAttribute("xmlns:fo", "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"); -- tmpOfficeDocumentContent.addAttribute("xmlns:config", "urn:oasis:names:tc:opendocument:xmlns:config:1.0"); -- tmpOfficeDocumentContent.addAttribute("xmlns:ooo", "http://openoffice.org/2004/office"); -- tmpOfficeDocumentContent.addAttribute("office:version", "1.0"); -- if (m_isFlatXML) -- tmpOfficeDocumentContent.addAttribute("office:mimetype", "application/x-vnd.oasis.openoffice.drawing"); -- tmpOfficeDocumentContent.write(mpHandler); -- -- OpenTagGraphicsElement("office:settings").write(mpHandler); -- -- OpenTagGraphicsElement configItemSetOpenElement("config:config-item-set"); -- configItemSetOpenElement.addAttribute("config:name", "ooo:view-settings"); -- configItemSetOpenElement.write(mpHandler); -- -- OpenTagGraphicsElement configItemOpenElement1("config:config-item"); -- configItemOpenElement1.addAttribute("config:name", "VisibleAreaTop"); -- configItemOpenElement1.addAttribute("config:type", "int"); -- configItemOpenElement1.write(mpHandler); -- mpHandler->characters("0"); -- mpHandler->endElement("config:config-item"); -- -- OpenTagGraphicsElement configItemOpenElement2("config:config-item"); -- configItemOpenElement2.addAttribute("config:name", "VisibleAreaLeft"); -- configItemOpenElement2.addAttribute("config:type", "int"); -- configItemOpenElement2.write(mpHandler); -- mpHandler->characters("0"); -- mpHandler->endElement("config:config-item"); -- -- OpenTagGraphicsElement configItemOpenElement3("config:config-item"); -- configItemOpenElement3.addAttribute("config:name", "VisibleAreaWidth"); -- configItemOpenElement3.addAttribute("config:type", "int"); -- configItemOpenElement3.write(mpHandler); -- m_value.str(""); -- m_value << (unsigned)(2540 * width); -- mpHandler->characters(m_value.str()); -- mpHandler->endElement("config:config-item"); -- -- OpenTagGraphicsElement configItemOpenElement4("config:config-item"); -- configItemOpenElement4.addAttribute("config:name", "VisibleAreaHeight"); -- configItemOpenElement4.addAttribute("config:type", "int"); -- configItemOpenElement4.write(mpHandler); -- m_value.str(""); -- m_value << (unsigned)(2540 * height); -- mpHandler->characters(m_value.str()); -- mpHandler->endElement("config:config-item"); -- -- mpHandler->endElement("config:config-item-set"); -- -- mpHandler->endElement("office:settings"); -- --} -- --void OdgExporter::endGraphics() --{ -- OpenTagGraphicsElement("office:styles").write(mpHandler); -- -- for (std::vector <GraphicsElement *>::const_iterator iterStroke = mStrokeDashElements.begin(); -- iterStroke != mStrokeDashElements.end(); iterStroke++) -- (*iterStroke)->write(mpHandler); -- -- for (std::vector <GraphicsElement *>::const_iterator iterGradient = mGradientElements.begin(); -- iterGradient != mGradientElements.end(); iterGradient++) -- (*iterGradient)->write(mpHandler); -- -- mpHandler->endElement("office:styles"); -- -- OpenTagGraphicsElement("office:automatic-styles").write(mpHandler); -- -- for (std::vector <GraphicsElement *>::const_iterator iterAutomaticStyles = mAutomaticStylesElements.begin(); -- iterAutomaticStyles != mAutomaticStylesElements.end(); iterAutomaticStyles++) -- (*iterAutomaticStyles)->write(mpHandler); -- -- OpenTagGraphicsElement tmpStylePageLayoutOpenElement("style:page-layout"); -- tmpStylePageLayoutOpenElement.addAttribute("style:name", "PM0"); -- tmpStylePageLayoutOpenElement.write(mpHandler); -- -- OpenTagGraphicsElement tmpStylePageLayoutPropertiesOpenElement("style:page-layout-properties"); -- tmpStylePageLayoutPropertiesOpenElement.addAttribute("fo:margin-top", "0in"); -- tmpStylePageLayoutPropertiesOpenElement.addAttribute("fo:margin-bottom", "0in"); -- tmpStylePageLayoutPropertiesOpenElement.addAttribute("fo:margin-left", "0in"); -- tmpStylePageLayoutPropertiesOpenElement.addAttribute("fo:margin-right", "0in"); -- m_value.str(""); -- m_value << doubleToString(m_width) << "in"; -- tmpStylePageLayoutPropertiesOpenElement.addAttribute("fo:page-width", m_value.str()); -- m_value.str(""); -- m_value << doubleToString(m_height) << "in"; -- tmpStylePageLayoutPropertiesOpenElement.addAttribute("fo:page-height", m_value.str()); -- m_value.str(""); -- tmpStylePageLayoutPropertiesOpenElement.addAttribute("style:print-orientation", "portrait"); -- tmpStylePageLayoutPropertiesOpenElement.write(mpHandler); -- -- mpHandler->endElement("style:page-layout-properties"); -- -- mpHandler->endElement("style:page-layout"); -- -- OpenTagGraphicsElement tmpStyleStyleOpenElement("style:style"); -- tmpStyleStyleOpenElement.addAttribute("style:name", "dp1"); -- tmpStyleStyleOpenElement.addAttribute("style:family", "drawing-page"); -- tmpStyleStyleOpenElement.write(mpHandler); -- -- OpenTagGraphicsElement tmpStyleDrawingPagePropertiesOpenElement("style:drawing-page-properties"); -- // tmpStyleDrawingPagePropertiesOpenElement.addAttribute("draw:background-size", "border"); -- tmpStyleDrawingPagePropertiesOpenElement.addAttribute("draw:fill", "none"); -- tmpStyleDrawingPagePropertiesOpenElement.write(mpHandler); -- -- mpHandler->endElement("style:drawing-page-properties"); -- -- mpHandler->endElement("style:style"); -- -- mpHandler->endElement("office:automatic-styles"); -- -- OpenTagGraphicsElement("office:master-styles").write(mpHandler); -- -- OpenTagGraphicsElement tmpStyleMasterPageOpenElement("style:master-page"); -- tmpStyleMasterPageOpenElement.addAttribute("style:name", "Default"); -- tmpStyleMasterPageOpenElement.addAttribute("style:page-layout-name", "PM0"); -- tmpStyleMasterPageOpenElement.addAttribute("draw:style-name", "dp1"); -- tmpStyleMasterPageOpenElement.write(mpHandler); -- -- mpHandler->endElement("style:master-page"); -- -- mpHandler->endElement("office:master-styles"); -- -- OpenTagGraphicsElement("office:body").write(mpHandler); -- -- OpenTagGraphicsElement("office:drawing").write(mpHandler); -- -- OpenTagGraphicsElement tmpDrawPageOpenElement("draw:page"); -- tmpDrawPageOpenElement.addAttribute("draw:name", "page1"); -- tmpDrawPageOpenElement.addAttribute("draw:style-name", "dp1"); -- tmpDrawPageOpenElement.addAttribute("draw:master-page-name", "Default"); -- tmpDrawPageOpenElement.write(mpHandler); -- -- for (std::vector<GraphicsElement *>::const_iterator bodyIter = mBodyElements.begin(); -- bodyIter != mBodyElements.end(); bodyIter++) -- { -- (*bodyIter)->write(mpHandler); -- } -- -- mpHandler->endElement("draw:page"); -- mpHandler->endElement("office:drawing"); -- mpHandler->endElement("office:body"); -- mpHandler->endElement("office:document"); -- -- mpHandler->endDocument(); --} -- --void OdgExporter::setPen(const libwpg::WPGPen& pen) --{ -- m_pen = pen; --} -- --void OdgExporter::setBrush(const libwpg::WPGBrush& brush) --{ -- m_brush = brush; --} -- --void OdgExporter::setFillRule(FillRule rule) --{ -- m_fillRule = rule; --} -- --void OdgExporter::startLayer(unsigned int) --{ --} -- --void OdgExporter::endLayer(unsigned int) --{ --} -- --void OdgExporter::drawRectangle(const libwpg::WPGRect& rect, double rx, double ) --{ -- writeStyle(); -- OpenTagGraphicsElement *pDrawRectElement = new OpenTagGraphicsElement("draw:rect"); -- m_value.str(""); -- m_value << "gr" << m_styleIndex-1; -- pDrawRectElement->addAttribute("draw:style-name", m_value.str()); -- m_value.str(""); -- m_value << doubleToString(rect.x1) << "in"; -- pDrawRectElement->addAttribute("svg:x", m_value.str()); -- m_value.str(""); -- m_value << doubleToString(rect.y1) << "in"; -- pDrawRectElement->addAttribute("svg:y", m_value.str()); -- m_value.str(""); -- m_value << doubleToString(rect.x2-rect.x1) << "in"; -- pDrawRectElement->addAttribute("svg:width", m_value.str()); -- m_value.str(""); -- m_value << doubleToString(rect.y2-rect.y1) << "in"; -- pDrawRectElement->addAttribute("svg:height", m_value.str()); -- m_value.str(""); -- m_value << doubleToString(rx) << "in"; -- // FIXME: what to do when rx != ry ? -- pDrawRectElement->addAttribute("draw:corner-radius", m_value.str()); -- m_value.str(""); -- mBodyElements.push_back(static_cast<GraphicsElement *>(pDrawRectElement)); -- mBodyElements.push_back(static_cast<GraphicsElement *>(new CloseTagGraphicsElement("draw:rect"))); --} -- --void OdgExporter::drawEllipse(const libwpg::WPGPoint& center, double rx, double ry) --{ -- writeStyle(); -- OpenTagGraphicsElement *pDrawEllipseElement = new OpenTagGraphicsElement("draw:ellipse"); -- m_value.str(""); -- m_value << "gr" << m_styleIndex-1; -- pDrawEllipseElement->addAttribute("draw:style-name", m_value.str()); -- m_value.str(""); -- m_value << doubleToString(center.x - rx) << "in"; -- pDrawEllipseElement->addAttribute("svg:x", m_value.str()); -- m_value.str(""); -- m_value << doubleToString(center.y - ry) << "in"; -- pDrawEllipseElement->addAttribute("svg:y", m_value.str()); -- m_value.str(""); -- m_value << doubleToString(2 * rx) << "in"; -- pDrawEllipseElement->addAttribute("svg:width", m_value.str()); -- m_value.str(""); -- m_value << doubleToString(2 * ry) << "in"; -- pDrawEllipseElement->addAttribute("svg:height", m_value.str()); -- m_value.str(""); -- mBodyElements.push_back(static_cast<GraphicsElement *>(pDrawEllipseElement)); -- mBodyElements.push_back(static_cast<GraphicsElement *>(new CloseTagGraphicsElement("draw:ellipse"))); --} -- --void OdgExporter::drawPolygon(const libwpg::WPGPointArray& vertices) --{ -- if(vertices.count() < 2) -- return; -- -- if(vertices.count() == 2) -- { -- const libwpg::WPGPoint& p1 = vertices[0]; -- const libwpg::WPGPoint& p2 = vertices[1]; -- -- writeStyle(); -- OpenTagGraphicsElement *pDrawLineElement = new OpenTagGraphicsElement("draw:line"); -- m_value.str(""); -- m_value << "gr" << m_styleIndex-1; -- pDrawLineElement->addAttribute("draw:style-name", m_value.str()); -- m_value.str(""); -- pDrawLineElement->addAttribute("draw:text-style-name", "P1"); -- pDrawLineElement->addAttribute("draw:layer", "layout"); -- m_value << doubleToString(p1.x) << "in"; -- pDrawLineElement->addAttribute("svg:x1", m_value.str()); -- m_value.str(""); -- m_value << doubleToString(p1.y) << "in"; -- pDrawLineElement->addAttribute("svg:y1", m_value.str()); -- m_value.str(""); -- m_value << doubleToString(p2.x) << "in"; -- pDrawLineElement->addAttribute("svg:x2", m_value.str()); -- m_value.str(""); -- m_value << doubleToString(p2.y) << "in"; -- pDrawLineElement->addAttribute("svg:y2", m_value.str()); -- m_value.str(""); -- mBodyElements.push_back(static_cast<GraphicsElement *>(pDrawLineElement)); -- mBodyElements.push_back(static_cast<GraphicsElement *>(new CloseTagGraphicsElement("draw:line"))); -- } -- else -- { -- // draw as path -- libwpg::WPGPath path; -- path.moveTo(vertices[0]); -- for(unsigned long ii = 1; ii < vertices.count(); ii++) -- path.lineTo(vertices[ii]); -- path.closed = true; -- drawPath(path); -- } --} -- --void OdgExporter::drawPath(const libwpg::WPGPath& path) --{ -- if(path.count() == 0) -- return; -- -- // try to find the bounding box -- // this is simple convex hull technique, the bounding box might not be -- // accurate but that should be enough for this purpose -- libwpg::WPGPoint p = path.element(0).point; -- libwpg::WPGPoint q = path.element(0).point; -- for(unsigned k = 0; k < path.count(); k++) -- { -- libwpg::WPGPathElement element = path.element(k); -- p.x = (p.x > element.point.x) ? element.point.x : p.x; -- p.y = (p.y > element.point.y) ? element.point.y : p.y; -- q.x = (q.x < element.point.x) ? element.point.x : q.x; -- q.y = (q.y < element.point.y) ? element.point.y : q.y; -- if(element.type == libwpg::WPGPathElement::CurveToElement) -- { -- p.x = (p.x > element.extra1.x) ? element.extra1.x : p.x; -- p.y = (p.y > element.extra1.y) ? element.extra1.y : p.y; -- q.x = (q.x < element.extra1.x) ? element.extra1.x : q.x; -- q.y = (q.y < element.extra1.y) ? element.extra1.y : q.y; -- p.x = (p.x > element.extra2.x) ? element.extra2.x : p.x; -- p.y = (p.y > element.extra2.y) ? element.extra2.y : p.y; -- q.x = (q.x < element.extra2.x) ? element.extra2.x : q.x; -- q.y = (q.y < element.extra2.y) ? element.extra2.y : q.y; -- } -- } -- double vw = q.x - p.x; -- double vh = q.y - p.y; -- -- writeStyle(); -- -- OpenTagGraphicsElement *pDrawPathElement = new OpenTagGraphicsElement("draw:path"); -- m_value.str(""); -- m_value << "gr" << m_styleIndex-1; -- pDrawPathElement->addAttribute("draw:style-name", m_value.str()); -- m_value.str(""); -- pDrawPathElement->addAttribute("draw:text-style-name", "P1"); -- pDrawPathElement->addAttribute("draw:layer", "layout"); -- m_value << doubleToString(p.x) << "in"; -- pDrawPathElement->addAttribute("svg:x", m_value.str()); -- m_value.str(""); -- m_value << doubleToString(p.y) << "in"; -- pDrawPathElement->addAttribute("svg:y", m_value.str()); -- m_value.str(""); -- m_value << doubleToString(vw) << "in"; -- pDrawPathElement->addAttribute("svg:width", m_value.str()); -- m_value.str(""); -- m_value << doubleToString(vh) << "in"; -- pDrawPathElement->addAttribute("svg:height", m_value.str()); -- m_value.str(""); -- m_value << "0 0 " << (int)(vw*2540) << " " << (int)(vh*2540); -- pDrawPathElement->addAttribute("svg:viewBox", m_value.str()); -- m_value.str(""); -- -- for(unsigned i = 0; i < path.count(); i++) -- { -- libwpg::WPGPathElement element = path.element(i); -- libwpg::WPGPoint point = element.point; -- switch(element.type) -- { -- // 2540 is 2.54*1000, 2.54 in = 1 in -- case libwpg::WPGPathElement::MoveToElement: -- m_value << "M" << (int)((point.x-p.x)*2540) << " "; -- m_value << (int)((point.y-p.y)*2540); -- break; -- -- case libwpg::WPGPathElement::LineToElement: -- m_value << "L" << (int)((point.x-p.x)*2540) << " "; -- m_value << (int)((point.y-p.y)*2540); -- break; -- -- case libwpg::WPGPathElement::CurveToElement: -- m_value << "C" << (int)((element.extra1.x-p.x)*2540) << " "; -- m_value << (int)((element.extra1.y-p.y)*2540) << " "; -- m_value << (int)((element.extra2.x-p.x)*2540) << " "; -- m_value << (int)((element.extra2.y-p.y)*2540) << " "; -- m_value << (int)((point.x-p.x)*2540) << " "; -- m_value << (int)((point.y-p.y)*2540); -- break; -- -- default: -- break; -- } -- } -- if(path.closed) -- m_value << " Z"; -- pDrawPathElement->addAttribute("svg:d", m_value.str()); -- m_value.str(""); -- mBodyElements.push_back(static_cast<GraphicsElement *>(pDrawPathElement)); -- mBodyElements.push_back(static_cast<GraphicsElement *>(new CloseTagGraphicsElement("draw:path"))); --} -- -- --void OdgExporter::drawBitmap(const libwpg::WPGBitmap& bitmap) --{ -- OpenTagGraphicsElement *pDrawFrameElement = new OpenTagGraphicsElement("draw:frame"); -- m_value.str(""); -- m_value << doubleToString(bitmap.rect.x1) << "in"; -- pDrawFrameElement->addAttribute("svg:x", m_value.str()); -- m_value.str(""); -- m_value << doubleToString(bitmap.rect.y1) << "in"; -- pDrawFrameElement->addAttribute("svg:y", m_value.str()); -- m_value.str(""); -- m_value << doubleToString(bitmap.rect.height()) << "in"; -- pDrawFrameElement->addAttribute("svg:height", m_value.str()); -- m_value.str(""); -- m_value << doubleToString(bitmap.rect.width()) << "in"; -- pDrawFrameElement->addAttribute("svg:width", m_value.str()); -- mBodyElements.push_back(static_cast<GraphicsElement *>(pDrawFrameElement)); -- -- mBodyElements.push_back(static_cast<GraphicsElement *>(new OpenTagGraphicsElement("draw:image"))); -- -- mBodyElements.push_back(static_cast<GraphicsElement *>(new OpenTagGraphicsElement("office:binary-data"))); -- -- libwpg::WPGString base64Binary; -- bitmap.generateBase64DIB(base64Binary); -- mBodyElements.push_back(static_cast<GraphicsElement *>(new CharDataGraphicsElement(base64Binary.cstr()))); -- -- mBodyElements.push_back(static_cast<GraphicsElement *>(new CloseTagGraphicsElement("office:binary-data"))); -- -- mBodyElements.push_back(static_cast<GraphicsElement *>(new CloseTagGraphicsElement("draw:image"))); -- -- mBodyElements.push_back(static_cast<GraphicsElement *>(new CloseTagGraphicsElement("draw:frame"))); --} -- --void OdgExporter::drawImageObject(const libwpg::WPGBinaryData& binaryData) --{ -- if (binaryData.mimeType.length() <= 0) -- return; -- OpenTagGraphicsElement *pDrawFrameElement = new OpenTagGraphicsElement("draw:frame"); -- m_value.str(""); -- m_value << doubleToString(binaryData.rect.x1) << "in"; -- pDrawFrameElement->addAttribute("svg:x", m_value.str()); -- m_value.str(""); -- m_value << doubleToString(binaryData.rect.y1) << "in"; -- pDrawFrameElement->addAttribute("svg:y", m_value.str()); -- m_value.str(""); -- m_value << doubleToString(binaryData.rect.height()) << "in"; -- pDrawFrameElement->addAttribute("svg:height", m_value.str()); -- m_value.str(""); -- m_value << doubleToString(binaryData.rect.width()) << "in"; -- pDrawFrameElement->addAttribute("svg:width", m_value.str()); -- mBodyElements.push_back(static_cast<GraphicsElement *>(pDrawFrameElement)); -- -- mBodyElements.push_back(static_cast<GraphicsElement *>(new OpenTagGraphicsElement("draw:image"))); -- -- mBodyElements.push_back(static_cast<GraphicsElement *>(new OpenTagGraphicsElement("office:binary-data"))); -- -- libwpg::WPGString base64Binary = binaryData.getBase64Data(); -- mBodyElements.push_back(static_cast<GraphicsElement *>(new CharDataGraphicsElement(base64Binary.cstr()))); -- -- mBodyElements.push_back(static_cast<GraphicsElement *>(new CloseTagGraphicsElement("office:binary-data"))); -- -- mBodyElements.push_back(static_cast<GraphicsElement *>(new CloseTagGraphicsElement("draw:image"))); -- -- mBodyElements.push_back(static_cast<GraphicsElement *>(new CloseTagGraphicsElement("draw:frame"))); --} -- -- --static std::string colorToHex(const libwpg::WPGColor& color) --{ -- char hexdigits[] = "0123456789abcdef"; -- char buffer[] = "123456"; -- buffer[0] = hexdigits[(color.red >> 4) & 15]; -- buffer[1] = hexdigits[color.red & 15]; -- buffer[2] = hexdigits[(color.green >> 4) & 15]; -- buffer[3] = hexdigits[color.green & 15]; -- buffer[4] = hexdigits[(color.blue >> 4) & 15]; -- buffer[5] = hexdigits[color.blue & 15]; -- return std::string(buffer); --} -- --void OdgExporter::writeStyle() --{ -- m_value.str(""); -- m_name.str(""); -- -- if(!m_pen.solid && (m_pen.dashArray.count() >=2 ) ) -- { -- // ODG only supports dashes with the same length of spaces inbetween -- // here we take the first space and assume everything else the same -- // note that dash length is written in percentage -- double distance = m_pen.dashArray.at(1); -- OpenTagGraphicsElement *tmpDrawStrokeDashElement = new OpenTagGraphicsElement("draw:stroke-dash"); -- tmpDrawStrokeDashElement->addAttribute("draw:style", "rect"); -- m_value << "Dash_" << m_dashIndex++; -- tmpDrawStrokeDashElement->addAttribute("draw:name", m_value.str()); -- m_value.str(""); -- m_value << doubleToString(distance*100) << "%"; -- tmpDrawStrokeDashElement->addAttribute("draw:distance", m_value.str()); -- m_value.str(""); -- for(unsigned i = 0; i < m_pen.dashArray.count()/2; i++) -- { -- m_name << "draw:dots" << i+1; -- tmpDrawStrokeDashElement->addAttribute(m_name.str(), "1"); -- m_name.str(""); -- m_name << "draw:dots" << i+1 << "-length"; -- m_value << doubleToString(100*m_pen.dashArray.at(i*2)) << "%"; -- tmpDrawStrokeDashElement->addAttribute(m_name.str(), m_value.str()); -- m_name.str(""); -- m_value.str(""); -- } -- mStrokeDashElements.push_back(static_cast<GraphicsElement *>(tmpDrawStrokeDashElement)); -- mStrokeDashElements.push_back(static_cast<GraphicsElement *>(new CloseTagGraphicsElement("draw:stroke-dash"))); -- } -- -- if(m_brush.style == libwpg::WPGBrush::Gradient) -- { -- OpenTagGraphicsElement *tmpDrawGradientElement = new OpenTagGraphicsElement("draw:gradient"); -- tmpDrawGradientElement->addAttribute("draw:style", "linear"); -- m_value << "Gradient_" << m_gradientIndex++; -- tmpDrawGradientElement->addAttribute("draw:name", m_value.str()); -- m_value.str(""); -- -- // ODG angle unit is 0.1 degree -- double angle = -m_brush.gradient.angle(); -- while(angle < 0) -- angle += 360; -- while(angle > 360) -- angle -= 360; -- -- m_value << (unsigned)(angle*10); -- tmpDrawGradientElement->addAttribute("draw:angle", m_value.str()); -- m_value.str(""); -- -- libwpg::WPGColor startColor = m_brush.gradient.stopColor(0); -- libwpg::WPGColor stopColor = m_brush.gradient.stopColor(1); -- m_value << "#" << colorToHex(startColor); -- tmpDrawGradientElement->addAttribute("draw:start-color", m_value.str()); -- m_value.str(""); -- m_value << "#" << colorToHex(stopColor); -- tmpDrawGradientElement->addAttribute("draw:end-color", m_value.str()); -- m_value.str(""); -- tmpDrawGradientElement->addAttribute("draw:start-intensity", "100%"); -- tmpDrawGradientElement->addAttribute("draw:end-intensity", "100%"); -- tmpDrawGradientElement->addAttribute("draw:border", "0%"); -- mGradientElements.push_back(static_cast<GraphicsElement *>(tmpDrawGradientElement)); -- mGradientElements.push_back(static_cast<GraphicsElement *>(new CloseTagGraphicsElement("draw:gradient"))); -- } -- -- OpenTagGraphicsElement *tmpStyleStyleElement = new OpenTagGraphicsElement("style:style"); -- m_value << "gr" << m_styleIndex; -- tmpStyleStyleElement->addAttribute("style:name", m_value.str()); -- m_value.str(""); -- tmpStyleStyleElement->addAttribute("style:family", "graphic"); -- tmpStyleStyleElement->addAttribute("style:parent-style-name", "standard"); -- mAutomaticStylesElements.push_back(static_cast<GraphicsElement *>(tmpStyleStyleElement)); -- -- OpenTagGraphicsElement *tmpStyleGraphicPropertiesElement = new OpenTagGraphicsElement("style:graphic-properties"); -- -- if(m_pen.width > 0.0) -- { -- m_value << doubleToString(m_pen.width) << "in"; -- tmpStyleGraphicPropertiesElement->addAttribute("svg:stroke-width", m_value.str()); -- m_value.str(""); -- m_value << "#" << colorToHex(m_pen.foreColor); -- tmpStyleGraphicPropertiesElement->addAttribute("svg:stroke-color", m_value.str()); -- m_value.str(""); -- -- if(!m_pen.solid) -- { -- tmpStyleGraphicPropertiesElement->addAttribute("draw:stroke", "dash"); -- m_value << "Dash_" << m_dashIndex-1; -- tmpStyleGraphicPropertiesElement->addAttribute("draw:stroke-dash", m_value.str()); -- m_value.str(""); -- } -- } -- else -- tmpStyleGraphicPropertiesElement->addAttribute("draw:stroke", "none"); -- -- if(m_brush.style == libwpg::WPGBrush::NoBrush) -- tmpStyleGraphicPropertiesElement->addAttribute("draw:fill", "none"); -- -- if(m_brush.style == libwpg::WPGBrush::Solid) -- { -- tmpStyleGraphicPropertiesElement->addAttribute("draw:fill", "solid"); -- m_value << "#" << colorToHex(m_brush.foreColor); -- tmpStyleGraphicPropertiesElement->addAttribute("draw:fill-color", m_value.str()); -- m_value.str(""); -- } -- -- if(m_brush.style == libwpg::WPGBrush::Gradient) -- { -- tmpStyleGraphicPropertiesElement->addAttribute("draw:fill", "gradient"); -- m_value << "Gradient_" << m_gradientIndex-1; -- tmpStyleGraphicPropertiesElement->addAttribute("draw:fill-gradient-name", m_value.str()); -- m_value.str(""); -- } -- -- mAutomaticStylesElements.push_back(static_cast<GraphicsElement *>(tmpStyleGraphicPropertiesElement)); -- mAutomaticStylesElements.push_back(static_cast<GraphicsElement *>(new CloseTagGraphicsElement("style:graphic-properties"))); -- -- mAutomaticStylesElements.push_back(static_cast<GraphicsElement *>(new CloseTagGraphicsElement("style:style"))); -- m_styleIndex++; --} -diff -Nur ./filters/karbon/wpg/import/OdgExporter.hxx ./filters/karbon/wpg/import/OdgExporter.hxx ---- ./filters/karbon/wpg/import/OdgExporter.hxx 2011-01-15 21:05:35.000000000 +0100 -+++ ./filters/karbon/wpg/import/OdgExporter.hxx 1970-01-01 01:00:00.000000000 +0100 -@@ -1,116 +0,0 @@ --/* libwpg -- * Copyright (C) 2006 Ariya Hidayat (ariya@kde.org) -- * -- * This library is free software; you can redistribute it and/or -- * modify it under the terms of the GNU Library General Public -- * License as published by the Free Software Foundation; either -- * version 2 of the License, or (at your option) any later version. -- * -- * This library is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- * Library General Public License for more details. -- * -- * You should have received a copy of the GNU Library General Public -- * License along with this library; if not, write to the -- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -- * Boston, MA 02111-1301 USA -- * -- * For further information visit http://libwpg.sourceforge.net -- */ -- --/* "This product is not manufactured, approved, or supported by -- * Corel Corporation or Corel Corporation Limited." -- */ -- --#ifndef __ODGEXPORTER_H__ --#define __ODGEXPORTER_H__ -- --#include <iostream> --#include <sstream> --#include <string> -- --#include <libwpg/libwpg.h> --#include "GraphicsElement.hxx" -- --class OdgExporter : public libwpg::WPGPaintInterface { --public: -- explicit OdgExporter(GraphicsHandler *pHandler, -- const bool isFlatXML = false); -- ~OdgExporter(); -- --#if LIBWPG_VERSION_MINOR<2 -- void startGraphics(double imageWidth, double imageHeight); -- void endGraphics(); -- void startLayer(unsigned int id); -- void endLayer(unsigned int id); -- -- void setPen(const libwpg::WPGPen& pen); -- void setBrush(const libwpg::WPGBrush& brush); -- void setFillRule(FillRule rule); -- -- void drawRectangle(const libwpg::WPGRect& rect, double rx, double ry); -- void drawEllipse(const libwpg::WPGPoint& center, double rx, double ry); -- void drawPolygon(const libwpg::WPGPointArray& vertices); -- void drawPath(const libwpg::WPGPath& path); -- void drawBitmap(const libwpg::WPGBitmap& bitmap); -- void drawImageObject(const libwpg::WPGBinaryData& binaryData); -- --private: -- std::vector <GraphicsElement *> mBodyElements; -- std::vector <GraphicsElement *> mAutomaticStylesElements; -- std::vector <GraphicsElement *> mStrokeDashElements; -- std::vector <GraphicsElement *> mGradientElements; -- GraphicsHandler *mpHandler; -- -- libwpg::WPGPen m_pen; -- libwpg::WPGBrush m_brush; -- FillRule m_fillRule; -- int m_gradientIndex; -- int m_dashIndex; -- int m_styleIndex; -- void writeStyle(); -- std::ostringstream m_value, m_name; -- double m_width, m_height; -- const bool m_isFlatXML; --#else -- virtual void startGraphics(const ::WPXPropertyList &propList); -- virtual void endGraphics(); -- virtual void setStyle(const ::WPXPropertyList &propList, const ::WPXPropertyListVector &gradient); -- virtual void startLayer(const ::WPXPropertyList &propList); -- virtual void endLayer(); -- virtual void drawRectangle(const ::WPXPropertyList& propList); -- virtual void drawEllipse(const ::WPXPropertyList& propList); -- virtual void drawPolygon(const ::WPXPropertyListVector &vertices); -- virtual void drawPath(const ::WPXPropertyListVector &path); -- virtual void drawGraphicObject(const ::WPXPropertyList &propList, const ::WPXBinaryData &binaryData); -- virtual void startEmbeddedGraphics(const ::WPXPropertyList &propList); -- virtual void endEmbeddedGraphics(); -- virtual void drawPolyline(const ::WPXPropertyListVector &vertices); -- virtual void startTextObject(const ::WPXPropertyList &propList, const ::WPXPropertyListVector &path); -- virtual void endTextObject(); -- virtual void startTextLine(const ::WPXPropertyList &propList); -- virtual void endTextLine(); -- virtual void startTextSpan(const ::WPXPropertyList &propList); -- virtual void endTextSpan(); -- virtual void insertText(const ::WPXString &str); -- -- --private: -- std::vector <GraphicsElement *> mBodyElements; -- std::vector <GraphicsElement *> mAutomaticStylesElements; -- std::vector <GraphicsElement *> mStrokeDashElements; -- std::vector <GraphicsElement *> mGradientElements; -- GraphicsHandler *mpHandler; -- -- int m_gradientIndex; -- int m_dashIndex; -- int m_styleIndex; -- void writeStyle(); -- std::ostringstream m_value, m_name; -- double m_width, m_height; -- const bool m_isFlatXML; --#endif --}; -- --#endif // __ODGEXPORTER_H__ -diff -Nur ./filters/karbon/wpg/import/WPGImport.cpp ./filters/karbon/wpg/import/WPGImport.cpp ---- ./filters/karbon/wpg/import/WPGImport.cpp 2011-01-15 21:05:35.000000000 +0100 -+++ ./filters/karbon/wpg/import/WPGImport.cpp 2011-01-02 17:46:15.000000000 +0100 -@@ -20,28 +20,26 @@ - #include <WPGImport.h> - #include <WPGImport.moc> - --#include <QBuffer> --#include <QByteArray> --#include <QString> -- --#include <kdebug.h> - #include <KoFilterChain.h> - #include <KoGlobal.h> - #include <KoUnit.h> -+#include <KoXmlWriter.h> -+ - #include <kpluginfactory.h> -+#include <KDebug> - --#include <KoXmlWriter.h> -+ -+#include <QtCore/QString> -+#include <QtCore/QFile> - - #include <libwpg/libwpg.h> - #if LIBWPG_VERSION_MINOR<2 - #include <libwpg/WPGStreamImplementation.h> - #else - #include <libwpd-stream/libwpd-stream.h> -+#include <libwpd/libwpd.h> - #endif - --#include "FileOutputHandler.hxx" --#include "OdgExporter.hxx" -- - #include <iostream> - - K_PLUGIN_FACTORY(WPGImportFactory, registerPlugin<WPGImport>();) -@@ -56,35 +54,13 @@ - { - } - --static QByteArray createManifest() --{ -- KoXmlWriter* manifestWriter; -- QByteArray manifestData; -- QBuffer manifestBuffer(&manifestData); -- -- manifestBuffer.open(QIODevice::WriteOnly); -- manifestWriter = new KoXmlWriter(&manifestBuffer); -- -- manifestWriter->startDocument("manifest:manifest"); -- manifestWriter->startElement("manifest:manifest"); -- manifestWriter->addAttribute("xmlns:manifest", "urn:oasis:names:tc:openoffice:xmlns:manifest:1.0"); -- manifestWriter->addManifestEntry("/", "application/vnd.oasis.opendocument.graphics"); -- //manifestWriter->addManifestEntry( "styles.xml", "text/xml" ); -- manifestWriter->addManifestEntry("content.xml", "text/xml"); -- manifestWriter->endElement(); -- manifestWriter->endDocument(); -- delete manifestWriter; -- -- return manifestData; --} -- - - KoFilter::ConversionStatus WPGImport::convert(const QByteArray& from, const QByteArray& to) - { - if (from != "application/x-wpg") - return KoFilter::NotImplemented; - -- if (to != "application/vnd.oasis.opendocument.graphics") -+ if (to != "image/svg+xml") - return KoFilter::NotImplemented; - - #if LIBWPG_VERSION_MINOR<2 -@@ -96,6 +72,7 @@ - input = olestream; - } - } -+ libwpg::WPGString output; - #else - WPXInputStream* input = new WPXFileStream(m_chain->inputFile().toLocal8Bit()); - if (input->isOLEStream()) { -@@ -105,59 +82,31 @@ - input = olestream; - } - } -+ ::WPXString output; - #endif - - if (!libwpg::WPGraphics::isSupported(input)) { -- std::cerr << "ERROR: Unsupported file format (unsupported version) or file is encrypted!" << std::endl; -+ kWarning() << "ERROR: Unsupported file format (unsupported version) or file is encrypted!"; - delete input; - return KoFilter::NotImplemented; - } - -- // do the conversion -- std::ostringstream tmpStringStream; -- FileOutputHandler tmpHandler(tmpStringStream); -- OdgExporter exporter(&tmpHandler); -- libwpg::WPGraphics::parse(input, &exporter); -- delete input; -- -- -- // create output store -- KoStore* storeout; -- storeout = KoStore::createStore(m_chain->outputFile(), KoStore::Write, -- "application/vnd.oasis.opendocument.graphics", KoStore::Zip); -- -- if (!storeout) { -- kWarning() << "Couldn't open the requested file."; -- return KoFilter::FileNotFound; -- } -- --#if 0 -- if (!storeout->open("styles.xml")) { -- kWarning() << "Couldn't open the file 'styles.xml'."; -- return KoFilter::CreationError; -+ if (!libwpg::WPGraphics::generateSVG(input, output)) { -+ kWarning() << "ERROR: SVG Generation failed!"; -+ delete input; -+ return KoFilter::ParsingError; - } -- //storeout->write( createStyles() ); -- storeout->close(); --#endif - -- if (!storeout->open("content.xml")) { -- kWarning() << "Couldn't open the file 'content.xml'."; -- return KoFilter::CreationError; -- } -- storeout->write(tmpStringStream.str().c_str()); -- storeout->close(); -+ delete input; - -- // store document manifest -- storeout->enterDirectory("META-INF"); -- if (!storeout->open("manifest.xml")) { -- kWarning() << "Couldn't open the file 'META-INF/manifest.xml'."; -- return KoFilter::CreationError; -+ QFile outputFile(m_chain->outputFile()); -+ if(!outputFile.open(QIODevice::WriteOnly | QIODevice::Text)) { -+ kWarning() << "ERROR: Could not open output file" << m_chain->outputFile(); -+ return KoFilter::InternalError; - } -- storeout->write(createManifest()); -- storeout->close(); - -- // we are done! -- delete storeout; -+ outputFile.write(output.cstr()); -+ outputFile.close(); - - return KoFilter::OK; - } |