diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.com> | 2014-04-29 12:22:38 +0200 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.com> | 2014-04-29 23:57:33 +0200 |
commit | de9ebbaddcb9633380e6614d7e70c1007d3be1c1 (patch) | |
tree | f11828ed6cac415b90e18808560a86a6a4cd2b77 /sd | |
parent | 304c7f7d3cbfb0a696de1fbaa169df109f55395e (diff) |
sd html: support export of tables for Draw documents
Change-Id: I32fe35c90c08d7c87b27ad4a5c10f91c6284c4a3
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/filter/html/htmlex.cxx | 61 | ||||
-rw-r--r-- | sd/source/filter/html/htmlex.hxx | 8 |
2 files changed, 41 insertions, 28 deletions
diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx index e6f163d63141..cdb18b26ed2e 100644 --- a/sd/source/filter/html/htmlex.cxx +++ b/sd/source/filter/html/htmlex.cxx @@ -63,6 +63,7 @@ #include <editeng/frmdiritem.hxx> #include <svx/svdoutl.hxx> #include <svx/svdogrp.hxx> +#include <svx/svdotable.hxx> #include <tools/urlobj.hxx> #include <vcl/bmpacc.hxx> #include <svtools/sfxecode.hxx> @@ -71,7 +72,6 @@ #include <comphelper/anytostring.hxx> #include <cppuhelper/exc_hlp.hxx> #include <basegfx/polygon/b2dpolygon.hxx> -#include <svx/svdotable.hxx> #include "drawdoc.hxx" #include "htmlpublishmode.hxx" @@ -1225,6 +1225,11 @@ OUString HtmlExport::CreateTextForPage(SdrOutliner* pOutliner, SdPage* pPage, SdrObjGroup* pObjectGroup = (SdrObjGroup*) pObject; WriteObjectGroup(aStr, pObjectGroup, pOutliner, rBackgroundColor, false); } + else if (pObject->GetObjIdentifier() == OBJ_TABLE) + { + SdrTableObj* pTableObject = (SdrTableObj*) pObject; + WriteTable(aStr, pTableObject, pOutliner, rBackgroundColor); + } else { if (pObject->GetOutlinerParaObject()) @@ -1238,31 +1243,7 @@ OUString HtmlExport::CreateTextForPage(SdrOutliner* pOutliner, SdPage* pPage, case PRESOBJ_TABLE: { SdrTableObj* pTableObject = (SdrTableObj*) pObject; - - CellPos aStart, aEnd; - - aStart = pTableObject->getFirstCell(); - aEnd = pTableObject->getLastCell(); - - sal_Int32 nColCount = pTableObject->getColumnCount(); - aStr.append("<table>\r\n"); - for (sal_Int32 nRow = aStart.mnRow; nRow <= aEnd.mnRow; nRow++) - { - aStr.append(" <tr>\r\n"); - for (sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++) - { - aStr.append(" <td>\r\n"); - sal_Int32 nCellIndex = nRow * nColCount + nCol; - SdrText* pText = pTableObject->getText(nCellIndex); - - if (pText == NULL) - continue; - WriteOutlinerParagraph(aStr, pOutliner, pText->GetOutlinerParaObject(), rBackgroundColor, false); - aStr.append(" </td>\r\n"); - } - aStr.append(" </tr>\r\n"); - } - aStr.append("</table>\r\n"); + WriteTable(aStr, pTableObject, pOutliner, rBackgroundColor); } break; @@ -1283,6 +1264,34 @@ OUString HtmlExport::CreateTextForPage(SdrOutliner* pOutliner, SdPage* pPage, return aStr.makeStringAndClear(); } +void HtmlExport::WriteTable(OUStringBuffer& aStr, SdrTableObj* pTableObject, SdrOutliner* pOutliner, const Color& rBackgroundColor) +{ + CellPos aStart, aEnd; + + aStart = pTableObject->getFirstCell(); + aEnd = pTableObject->getLastCell(); + + sal_Int32 nColCount = pTableObject->getColumnCount(); + aStr.append("<table>\r\n"); + for (sal_Int32 nRow = aStart.mnRow; nRow <= aEnd.mnRow; nRow++) + { + aStr.append(" <tr>\r\n"); + for (sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++) + { + aStr.append(" <td>\r\n"); + sal_Int32 nCellIndex = nRow * nColCount + nCol; + SdrText* pText = pTableObject->getText(nCellIndex); + + if (pText == NULL) + continue; + WriteOutlinerParagraph(aStr, pOutliner, pText->GetOutlinerParaObject(), rBackgroundColor, false); + aStr.append(" </td>\r\n"); + } + aStr.append(" </tr>\r\n"); + } + aStr.append("</table>\r\n"); +} + void HtmlExport::WriteObjectGroup(OUStringBuffer& aStr, SdrObjGroup* pObjectGroup, SdrOutliner* pOutliner, const Color& rBackgroundColor, bool bHeadLine) { diff --git a/sd/source/filter/html/htmlex.hxx b/sd/source/filter/html/htmlex.hxx index 51d3359fec52..cdf84ccc32bb 100644 --- a/sd/source/filter/html/htmlex.hxx +++ b/sd/source/filter/html/htmlex.hxx @@ -56,6 +56,7 @@ class SdPage; class HtmlState; class SdrTextObj; class SdrObjGroup; +namespace sdr { namespace table { class SdrTableObj; } } class SdrPage; class SdDrawDocument; class ButtonSet; @@ -216,8 +217,11 @@ class HtmlExport OutlinerParaObject* pOutlinerParagraphObject, const Color& rBackgroundColor, bool bHeadLine); - void WriteObjectGroup(OUStringBuffer& aStr, SdrObjGroup* pObjectGroup, SdrOutliner* pOutliner, - const Color& rBackgroundColor, bool bHeadLine); + void WriteObjectGroup(OUStringBuffer& aStr, SdrObjGroup* pObjectGroup, + SdrOutliner* pOutliner, const Color& rBackgroundColor, bool bHeadLine); + + void WriteTable(OUStringBuffer& aStr, sdr::table::SdrTableObj* pTableObject, + SdrOutliner* pOutliner, const Color& rBackgroundColor); public: HtmlExport(const OUString& aPath, |