Kaydet (Commit) 6e793fdb authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

sd html: Support export of any text objects (draw) and groups

Change-Id: Ied2de0a076db722df8366e866ae66846f3fb2854
üst 306b29a6
...@@ -62,13 +62,16 @@ ...@@ -62,13 +62,16 @@
#include <svl/style.hxx> #include <svl/style.hxx>
#include <editeng/frmdiritem.hxx> #include <editeng/frmdiritem.hxx>
#include <svx/svdoutl.hxx> #include <svx/svdoutl.hxx>
#include <svx/svdogrp.hxx>
#include <tools/urlobj.hxx> #include <tools/urlobj.hxx>
#include <vcl/bmpacc.hxx> #include <vcl/bmpacc.hxx>
#include <svtools/sfxecode.hxx> #include <svtools/sfxecode.hxx>
#include <com/sun/star/beans/PropertyState.hpp> #include <com/sun/star/beans/PropertyState.hpp>
#include <tools/resmgr.hxx> #include <tools/resmgr.hxx>
#include "comphelper/anytostring.hxx" #include <comphelper/anytostring.hxx>
#include "cppuhelper/exc_hlp.hxx" #include <cppuhelper/exc_hlp.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
#include <svx/svdotable.hxx>
#include "drawdoc.hxx" #include "drawdoc.hxx"
#include "htmlpublishmode.hxx" #include "htmlpublishmode.hxx"
...@@ -80,9 +83,6 @@ ...@@ -80,9 +83,6 @@
#include "imapinfo.hxx" #include "imapinfo.hxx"
#include "sdresid.hxx" #include "sdresid.hxx"
#include "buttonset.hxx" #include "buttonset.hxx"
#include <basegfx/polygon/b2dpolygon.hxx>
#include <svx/svdotable.hxx>
using namespace ::com::sun::star; using namespace ::com::sun::star;
using namespace ::com::sun::star::uno; using namespace ::com::sun::star::uno;
...@@ -1218,6 +1218,23 @@ OUString HtmlExport::CreateTextForPage(SdrOutliner* pOutliner, SdPage* pPage, ...@@ -1218,6 +1218,23 @@ OUString HtmlExport::CreateTextForPage(SdrOutliner* pOutliner, SdPage* pPage,
switch (eKind) switch (eKind)
{ {
case PRESOBJ_NONE:
{
if (pObject->GetObjIdentifier() == OBJ_GRUP)
{
SdrObjGroup* pObjectGroup = (SdrObjGroup*) pObject;
WriteObjectGroup(aStr, pObjectGroup, pOutliner, rBackgroundColor, false);
}
else
{
if (pObject->GetOutlinerParaObject())
{
WriteOutlinerParagraph(aStr, pOutliner, pObject->GetOutlinerParaObject(), rBackgroundColor, false);
}
}
}
break;
case PRESOBJ_TABLE: case PRESOBJ_TABLE:
{ {
SdrTableObj* pTableObject = (SdrTableObj*) pObject; SdrTableObj* pTableObject = (SdrTableObj*) pObject;
...@@ -1248,6 +1265,7 @@ OUString HtmlExport::CreateTextForPage(SdrOutliner* pOutliner, SdPage* pPage, ...@@ -1248,6 +1265,7 @@ OUString HtmlExport::CreateTextForPage(SdrOutliner* pOutliner, SdPage* pPage,
aStr.append("</table>\r\n"); aStr.append("</table>\r\n");
} }
break; break;
case PRESOBJ_TEXT: case PRESOBJ_TEXT:
case PRESOBJ_OUTLINE: case PRESOBJ_OUTLINE:
{ {
...@@ -1257,6 +1275,7 @@ OUString HtmlExport::CreateTextForPage(SdrOutliner* pOutliner, SdPage* pPage, ...@@ -1257,6 +1275,7 @@ OUString HtmlExport::CreateTextForPage(SdrOutliner* pOutliner, SdPage* pPage,
WriteOutlinerParagraph(aStr, pOutliner, pTextObject->GetOutlinerParaObject(), rBackgroundColor, bHeadLine); WriteOutlinerParagraph(aStr, pOutliner, pTextObject->GetOutlinerParaObject(), rBackgroundColor, bHeadLine);
} }
break; break;
default: default:
break; break;
} }
...@@ -1264,6 +1283,29 @@ OUString HtmlExport::CreateTextForPage(SdrOutliner* pOutliner, SdPage* pPage, ...@@ -1264,6 +1283,29 @@ OUString HtmlExport::CreateTextForPage(SdrOutliner* pOutliner, SdPage* pPage,
return aStr.makeStringAndClear(); return aStr.makeStringAndClear();
} }
void HtmlExport::WriteObjectGroup(OUStringBuffer& aStr, SdrObjGroup* pObjectGroup, SdrOutliner* pOutliner,
const Color& rBackgroundColor, bool bHeadLine)
{
SdrObjListIter aGroupIterator(*pObjectGroup->GetSubList(), IM_DEEPNOGROUPS);
while (aGroupIterator.IsMore())
{
SdrObject* pCurrentObject = aGroupIterator.Next();
if (pCurrentObject->GetObjIdentifier() == OBJ_GRUP)
{
SdrObjGroup* pCurrentGroupObject = (SdrObjGroup*) pCurrentObject;
WriteObjectGroup(aStr, pCurrentGroupObject, pOutliner, rBackgroundColor, bHeadLine);
}
else
{
OutlinerParaObject* pOutlinerParagraphObject = pCurrentObject->GetOutlinerParaObject();
if (pOutlinerParagraphObject != NULL)
{
WriteOutlinerParagraph(aStr, pOutliner, pOutlinerParagraphObject, rBackgroundColor, bHeadLine);
}
}
}
}
void HtmlExport::WriteOutlinerParagraph(OUStringBuffer& aStr, SdrOutliner* pOutliner, void HtmlExport::WriteOutlinerParagraph(OUStringBuffer& aStr, SdrOutliner* pOutliner,
OutlinerParaObject* pOutlinerParagraphObject, OutlinerParaObject* pOutlinerParagraphObject,
const Color& rBackgroundColor, bool bHeadLine) const Color& rBackgroundColor, bool bHeadLine)
......
...@@ -55,6 +55,7 @@ class SdrOutliner; ...@@ -55,6 +55,7 @@ class SdrOutliner;
class SdPage; class SdPage;
class HtmlState; class HtmlState;
class SdrTextObj; class SdrTextObj;
class SdrObjGroup;
class SdrPage; class SdrPage;
class SdDrawDocument; class SdDrawDocument;
class ButtonSet; class ButtonSet;
...@@ -215,6 +216,9 @@ class HtmlExport ...@@ -215,6 +216,9 @@ class HtmlExport
OutlinerParaObject* pOutlinerParagraphObject, OutlinerParaObject* pOutlinerParagraphObject,
const Color& rBackgroundColor, bool bHeadLine); const Color& rBackgroundColor, bool bHeadLine);
void WriteObjectGroup(OUStringBuffer& aStr, SdrObjGroup* pObjectGroup, SdrOutliner* pOutliner,
const Color& rBackgroundColor, bool bHeadLine);
public: public:
HtmlExport(const OUString& aPath, HtmlExport(const OUString& aPath,
const css::uno::Sequence<css::beans::PropertyValue>& rParams, const css::uno::Sequence<css::beans::PropertyValue>& rParams,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment