|
|
|
@ -55,7 +55,7 @@ _WriterDocumentState::_WriterDocumentState() :
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WordPerfectCollector::WordPerfectCollector(WPXInputStream *pInput, DocumentHandler *pHandler) :
|
|
|
|
|
WordPerfectCollector::WordPerfectCollector(_SH_InputStream *pInput, DocumentHandler *pHandler) :
|
|
|
|
|
mpInput(pInput),
|
|
|
|
|
mpHandler(pHandler),
|
|
|
|
|
mbUsed(false),
|
|
|
|
@ -69,8 +69,8 @@ WordPerfectCollector::WordPerfectCollector(WPXInputStream *pInput, DocumentHandl
|
|
|
|
|
miLastListLevel(0),
|
|
|
|
|
miLastListNumber(0),
|
|
|
|
|
mbListContinueNumbering(false),
|
|
|
|
|
mbListElementParagraphOpened(false),
|
|
|
|
|
mbListElementOpened(false)
|
|
|
|
|
mbListElementOpened(false),
|
|
|
|
|
mbListElementParagraphOpened(false)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -111,10 +111,10 @@ bool WordPerfectCollector::filter()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WRITER_DEBUG_MSG(("Destroying the rest of the styles elements\n"));
|
|
|
|
|
for (std::map<WPXString, ParagraphStyle *, ltstr>::iterator iterTextStyle = mTextStyleHash.begin(); iterTextStyle != mTextStyleHash.end(); iterTextStyle++) {
|
|
|
|
|
for (std::map<_SH_String, ParagraphStyle *, ltstr>::iterator iterTextStyle = mTextStyleHash.begin(); iterTextStyle != mTextStyleHash.end(); iterTextStyle++) {
|
|
|
|
|
delete(iterTextStyle->second);
|
|
|
|
|
}
|
|
|
|
|
for (std::map<WPXString, FontStyle *, ltstr>::iterator iterFont = mFontHash.begin(); iterFont != mFontHash.end(); iterFont++) {
|
|
|
|
|
for (std::map<_SH_String, FontStyle *, ltstr>::iterator iterFont = mFontHash.begin(); iterFont != mFontHash.end(); iterFont++) {
|
|
|
|
|
delete(iterFont->second);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -135,15 +135,21 @@ bool WordPerfectCollector::filter()
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool WordPerfectCollector::_parseSourceDocument(WPXInputStream &input)
|
|
|
|
|
bool WordPerfectCollector::_parseSourceDocument(_SH_InputStream &input)
|
|
|
|
|
{
|
|
|
|
|
#ifdef HAVE_LIBWPD_090
|
|
|
|
|
WPDResult result = WPDocument::parse(&input, static_cast<WPXHLListenerImpl *>(this), NULL);
|
|
|
|
|
#if defined(HAVE_LIBWPD_0100)
|
|
|
|
|
libwpd::WPDResult result = libwpd::WPDocument::parse(&input, static_cast<_SH_DocumentInterface*>(this), NULL);
|
|
|
|
|
#elif defined(HAVE_LIBWPD_090)
|
|
|
|
|
WPDResult result = WPDocument::parse(&input, static_cast<_SH_DocumentInterface*>(this), NULL);
|
|
|
|
|
#else
|
|
|
|
|
WPDResult result = WPDocument::parse(&input, static_cast<_SH_DocumentInterface*>(this));
|
|
|
|
|
#endif
|
|
|
|
|
#if defined(HAVE_LIBWPD_0100)
|
|
|
|
|
if (result != libwpd::WPD_OK)
|
|
|
|
|
#else
|
|
|
|
|
WPDResult result = WPDocument::parse(&input, static_cast<WPXHLListenerImpl *>(this));
|
|
|
|
|
if (result != WPD_OK)
|
|
|
|
|
#endif
|
|
|
|
|
if (result != WPD_OK)
|
|
|
|
|
return false;
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
@ -214,7 +220,7 @@ void WordPerfectCollector::_writeBegin()
|
|
|
|
|
|
|
|
|
|
void WordPerfectCollector::_writeMasterPages(DocumentHandler &xHandler)
|
|
|
|
|
{
|
|
|
|
|
WPXPropertyList xBlankAttrList;
|
|
|
|
|
_SH_PropertyList xBlankAttrList;
|
|
|
|
|
|
|
|
|
|
xHandler.startElement("office:master-styles", xBlankAttrList);
|
|
|
|
|
int pageNumber = 1;
|
|
|
|
@ -240,13 +246,13 @@ void WordPerfectCollector::_writePageMasters(DocumentHandler &xHandler)
|
|
|
|
|
bool WordPerfectCollector::_writeTargetDocument(DocumentHandler &xHandler)
|
|
|
|
|
{
|
|
|
|
|
WRITER_DEBUG_MSG(("WriterWordPerfect: Document Body: Printing out the header stuff..\n"));
|
|
|
|
|
WPXPropertyList xBlankAttrList;
|
|
|
|
|
_SH_PropertyList xBlankAttrList;
|
|
|
|
|
|
|
|
|
|
WRITER_DEBUG_MSG(("WriterWordPerfect: Document Body: Start Document\n"));
|
|
|
|
|
mpHandler->startDocument();
|
|
|
|
|
|
|
|
|
|
WRITER_DEBUG_MSG(("WriterWordPerfect: Document Body: preamble\n"));
|
|
|
|
|
WPXPropertyList docContentPropList;
|
|
|
|
|
_SH_PropertyList docContentPropList;
|
|
|
|
|
docContentPropList.insert("xmlns:office", "http://openoffice.org/2000/office");
|
|
|
|
|
docContentPropList.insert("xmlns:style", "http://openoffice.org/2000/style");
|
|
|
|
|
docContentPropList.insert("xmlns:text", "http://openoffice.org/2000/text");
|
|
|
|
@ -267,7 +273,7 @@ bool WordPerfectCollector::_writeTargetDocument(DocumentHandler &xHandler)
|
|
|
|
|
|
|
|
|
|
// write out the font styles
|
|
|
|
|
mpHandler->startElement("office:font-decls", xBlankAttrList);
|
|
|
|
|
for (std::map<WPXString, FontStyle *, ltstr>::iterator iterFont = mFontHash.begin(); iterFont != mFontHash.end(); iterFont++) {
|
|
|
|
|
for (std::map<_SH_String, FontStyle *, ltstr>::iterator iterFont = mFontHash.begin(); iterFont != mFontHash.end(); iterFont++) {
|
|
|
|
|
iterFont->second->write(*mpHandler);
|
|
|
|
|
}
|
|
|
|
|
TagOpenElement symbolFontOpen("style:font-decl");
|
|
|
|
@ -287,7 +293,7 @@ bool WordPerfectCollector::_writeTargetDocument(DocumentHandler &xHandler)
|
|
|
|
|
|
|
|
|
|
mpHandler->startElement("office:automatic-styles", xBlankAttrList);
|
|
|
|
|
|
|
|
|
|
for (std::map<WPXString, ParagraphStyle *, ltstr>::iterator iterTextStyle = mTextStyleHash.begin();
|
|
|
|
|
for (std::map<_SH_String, ParagraphStyle *, ltstr>::iterator iterTextStyle = mTextStyleHash.begin();
|
|
|
|
|
iterTextStyle != mTextStyleHash.end(); iterTextStyle++)
|
|
|
|
|
{
|
|
|
|
|
// writing out the paragraph styles
|
|
|
|
@ -299,7 +305,7 @@ bool WordPerfectCollector::_writeTargetDocument(DocumentHandler &xHandler)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// span styles..
|
|
|
|
|
for (std::map<WPXString, SpanStyle *, ltstr>::iterator iterSpanStyle = mSpanStyleHash.begin();
|
|
|
|
|
for (std::map<_SH_String, SpanStyle *, ltstr>::iterator iterSpanStyle = mSpanStyleHash.begin();
|
|
|
|
|
iterSpanStyle != mSpanStyleHash.end(); iterSpanStyle++)
|
|
|
|
|
{
|
|
|
|
|
(iterSpanStyle->second)->write(xHandler);
|
|
|
|
@ -346,13 +352,13 @@ bool WordPerfectCollector::_writeTargetDocument(DocumentHandler &xHandler)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WPXString propListToStyleKey(const WPXPropertyList & xPropList)
|
|
|
|
|
_SH_String propListToStyleKey(const _SH_PropertyList & xPropList)
|
|
|
|
|
{
|
|
|
|
|
WPXString sKey;
|
|
|
|
|
WPXPropertyList::Iter i(xPropList);
|
|
|
|
|
_SH_String sKey;
|
|
|
|
|
_SH_PropertyList::Iter i(xPropList);
|
|
|
|
|
for (i.rewind(); i.next(); )
|
|
|
|
|
{
|
|
|
|
|
WPXString sProp;
|
|
|
|
|
_SH_String sProp;
|
|
|
|
|
sProp.sprintf("[%s:%s]", i.key(), i()->getStr().cstr());
|
|
|
|
|
sKey.append(sProp);
|
|
|
|
|
}
|
|
|
|
@ -360,13 +366,13 @@ WPXString propListToStyleKey(const WPXPropertyList & xPropList)
|
|
|
|
|
return sKey;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WPXString getParagraphStyleKey(const WPXPropertyList & xPropList, const WPXPropertyListVector & xTabStops)
|
|
|
|
|
_SH_String getParagraphStyleKey(const _SH_PropertyList & xPropList, const _SH_PropertyListVector & xTabStops)
|
|
|
|
|
{
|
|
|
|
|
WPXString sKey = propListToStyleKey(xPropList);
|
|
|
|
|
_SH_String sKey = propListToStyleKey(xPropList);
|
|
|
|
|
|
|
|
|
|
WPXString sTabStops;
|
|
|
|
|
_SH_String sTabStops;
|
|
|
|
|
sTabStops.sprintf("[num-tab-stops:%i]", xTabStops.count());
|
|
|
|
|
WPXPropertyListVector::Iter i(xTabStops);
|
|
|
|
|
_SH_PropertyListVector::Iter i(xTabStops);
|
|
|
|
|
for (i.rewind(); i.next();)
|
|
|
|
|
{
|
|
|
|
|
sTabStops.append(propListToStyleKey(i()));
|
|
|
|
@ -377,7 +383,7 @@ WPXString getParagraphStyleKey(const WPXPropertyList & xPropList, const WPXPrope
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// _allocateFontName: add a (potentially mapped) font style to the hash if it's not already there, do nothing otherwise
|
|
|
|
|
void WordPerfectCollector::_allocateFontName(const WPXString & sFontName)
|
|
|
|
|
void WordPerfectCollector::_allocateFontName(const _SH_String & sFontName)
|
|
|
|
|
{
|
|
|
|
|
if (mFontHash.find(sFontName) == mFontHash.end())
|
|
|
|
|
{
|
|
|
|
@ -386,14 +392,14 @@ void WordPerfectCollector::_allocateFontName(const WPXString & sFontName)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WordPerfectCollector::openPageSpan(const WPXPropertyList &propList)
|
|
|
|
|
void WordPerfectCollector::openPageSpan(const _SH_PropertyList &propList)
|
|
|
|
|
{
|
|
|
|
|
PageSpan *pPageSpan = new PageSpan(propList);
|
|
|
|
|
mPageSpans.push_back(pPageSpan);
|
|
|
|
|
mpCurrentPageSpan = pPageSpan;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WordPerfectCollector::openHeader(const WPXPropertyList &propList)
|
|
|
|
|
void WordPerfectCollector::openHeader(const _SH_PropertyList &propList)
|
|
|
|
|
{
|
|
|
|
|
std::vector<DocumentElement *> * pHeaderFooterContentElements = new std::vector<DocumentElement *>;
|
|
|
|
|
|
|
|
|
@ -410,7 +416,7 @@ void WordPerfectCollector::closeHeader()
|
|
|
|
|
mpCurrentContentElements = &mBodyElements;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WordPerfectCollector::openFooter(const WPXPropertyList &propList)
|
|
|
|
|
void WordPerfectCollector::openFooter(const _SH_PropertyList &propList)
|
|
|
|
|
{
|
|
|
|
|
std::vector<DocumentElement *> * pHeaderFooterContentElements = new std::vector<DocumentElement *>;
|
|
|
|
|
|
|
|
|
@ -427,18 +433,18 @@ void WordPerfectCollector::closeFooter()
|
|
|
|
|
mpCurrentContentElements = &mBodyElements;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WordPerfectCollector::openSection(const WPXPropertyList &propList, const WPXPropertyListVector &columns)
|
|
|
|
|
void WordPerfectCollector::openSection(const _SH_PropertyList &propList, const _SH_PropertyListVector &columns)
|
|
|
|
|
{
|
|
|
|
|
int iNumColumns = columns.count();
|
|
|
|
|
|
|
|
|
|
if (iNumColumns > 1)
|
|
|
|
|
{
|
|
|
|
|
#ifdef HAVE_LIBWPD_090
|
|
|
|
|
#if defined(HAVE_LIBWPD_090) || defined(HAVE_LIBWPD_0100)
|
|
|
|
|
mfSectionSpaceAfter = propList["fo:margin-bottom"]->getDouble();
|
|
|
|
|
#else
|
|
|
|
|
mfSectionSpaceAfter = propList["fo:margin-bottom"]->getFloat();
|
|
|
|
|
#endif
|
|
|
|
|
WPXString sSectionName;
|
|
|
|
|
_SH_String sSectionName;
|
|
|
|
|
sSectionName.sprintf("Section%i", mSectionStyles.size());
|
|
|
|
|
|
|
|
|
|
SectionStyle *pSectionStyle = new SectionStyle(propList, columns, sSectionName.cstr());
|
|
|
|
@ -472,12 +478,12 @@ void WordPerfectCollector::closeSection()
|
|
|
|
|
mfSectionSpaceAfter = 0.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WordPerfectCollector::openParagraph(const WPXPropertyList &propList, const WPXPropertyListVector &tabStops)
|
|
|
|
|
void WordPerfectCollector::openParagraph(const _SH_PropertyList &propList, const _SH_PropertyListVector &tabStops)
|
|
|
|
|
{
|
|
|
|
|
// FIXMENOW: What happens if we open a footnote inside a table? do we then inherit the footnote's style
|
|
|
|
|
// from "Table Contents"
|
|
|
|
|
|
|
|
|
|
WPXPropertyList *pPersistPropList = new WPXPropertyList(propList);
|
|
|
|
|
_SH_PropertyList *pPersistPropList = new _SH_PropertyList(propList);
|
|
|
|
|
ParagraphStyle *pStyle = NULL;
|
|
|
|
|
|
|
|
|
|
if (mWriterDocumentState.mbFirstElement && mpCurrentContentElements == &mBodyElements)
|
|
|
|
@ -488,10 +494,10 @@ void WordPerfectCollector::openParagraph(const WPXPropertyList &propList, const
|
|
|
|
|
// be inside a table in this case (the table would be the first document element
|
|
|
|
|
//in that case)
|
|
|
|
|
pPersistPropList->insert("style:parent-style-name", "Standard");
|
|
|
|
|
WPXString sName;
|
|
|
|
|
_SH_String sName;
|
|
|
|
|
sName.sprintf("FS");
|
|
|
|
|
|
|
|
|
|
WPXString sParagraphHashKey("P|FS");
|
|
|
|
|
_SH_String sParagraphHashKey("P|FS");
|
|
|
|
|
pPersistPropList->insert("style:master-page-name", "Page Style 1");
|
|
|
|
|
pStyle = new ParagraphStyle(pPersistPropList, tabStops, sName);
|
|
|
|
|
mTextStyleHash[sParagraphHashKey] = pStyle;
|
|
|
|
@ -509,10 +515,10 @@ void WordPerfectCollector::openParagraph(const WPXPropertyList &propList, const
|
|
|
|
|
else
|
|
|
|
|
pPersistPropList->insert("style:parent-style-name", "Standard");
|
|
|
|
|
|
|
|
|
|
WPXString sKey = getParagraphStyleKey(*pPersistPropList, tabStops);
|
|
|
|
|
_SH_String sKey = getParagraphStyleKey(*pPersistPropList, tabStops);
|
|
|
|
|
|
|
|
|
|
if (mTextStyleHash.find(sKey) == mTextStyleHash.end()) {
|
|
|
|
|
WPXString sName;
|
|
|
|
|
_SH_String sName;
|
|
|
|
|
sName.sprintf("S%i", mTextStyleHash.size());
|
|
|
|
|
|
|
|
|
|
pStyle = new ParagraphStyle(pPersistPropList, tabStops, sName);
|
|
|
|
@ -536,15 +542,15 @@ void WordPerfectCollector::closeParagraph()
|
|
|
|
|
mpCurrentContentElements->push_back(static_cast<DocumentElement *>(new TagCloseElement("text:p")));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WordPerfectCollector::openSpan(const WPXPropertyList &propList)
|
|
|
|
|
void WordPerfectCollector::openSpan(const _SH_PropertyList &propList)
|
|
|
|
|
{
|
|
|
|
|
if (propList["style:font-name"])
|
|
|
|
|
_allocateFontName(propList["style:font-name"]->getStr());
|
|
|
|
|
WPXString sSpanHashKey = propListToStyleKey(propList);
|
|
|
|
|
_SH_String sSpanHashKey = propListToStyleKey(propList);
|
|
|
|
|
WRITER_DEBUG_MSG(("WriterWordPerfect: Span Hash Key: %s\n", sSpanHashKey.cstr()));
|
|
|
|
|
|
|
|
|
|
// Get the style
|
|
|
|
|
WPXString sName;
|
|
|
|
|
_SH_String sName;
|
|
|
|
|
if (mSpanStyleHash.find(sSpanHashKey) == mSpanStyleHash.end())
|
|
|
|
|
{
|
|
|
|
|
// allocate a new paragraph style
|
|
|
|
@ -569,7 +575,7 @@ void WordPerfectCollector::closeSpan()
|
|
|
|
|
mpCurrentContentElements->push_back(static_cast<DocumentElement *>(new TagCloseElement("text:span")));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WordPerfectCollector::defineOrderedListLevel(const WPXPropertyList &propList)
|
|
|
|
|
void WordPerfectCollector::defineOrderedListLevel(const _SH_PropertyList &propList)
|
|
|
|
|
{
|
|
|
|
|
int id = 0;
|
|
|
|
|
if (propList["libwpd:id"])
|
|
|
|
@ -588,7 +594,7 @@ void WordPerfectCollector::defineOrderedListLevel(const WPXPropertyList &propLis
|
|
|
|
|
(propList["text:start-value"] && propList["text:start-value"]->getInt() != (miLastListNumber+1))))
|
|
|
|
|
{
|
|
|
|
|
WRITER_DEBUG_MSG(("Attempting to create a new ordered list style (listid: %i)\n", id));
|
|
|
|
|
WPXString sName;
|
|
|
|
|
_SH_String sName;
|
|
|
|
|
sName.sprintf("OL%i", miNumListStyles);
|
|
|
|
|
miNumListStyles++;
|
|
|
|
|
pOrderedListStyle = new OrderedListStyle(sName.cstr(), propList["libwpd:id"]->getInt());
|
|
|
|
@ -610,7 +616,7 @@ void WordPerfectCollector::defineOrderedListLevel(const WPXPropertyList &propLis
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WordPerfectCollector::defineUnorderedListLevel(const WPXPropertyList &propList)
|
|
|
|
|
void WordPerfectCollector::defineUnorderedListLevel(const _SH_PropertyList &propList)
|
|
|
|
|
{
|
|
|
|
|
int id = 0;
|
|
|
|
|
if (propList["libwpd:id"])
|
|
|
|
@ -622,7 +628,7 @@ void WordPerfectCollector::defineUnorderedListLevel(const WPXPropertyList &propL
|
|
|
|
|
|
|
|
|
|
if (pUnorderedListStyle == NULL) {
|
|
|
|
|
WRITER_DEBUG_MSG(("Attempting to create a new unordered list style (listid: %i)\n", id));
|
|
|
|
|
WPXString sName;
|
|
|
|
|
_SH_String sName;
|
|
|
|
|
sName.sprintf("UL%i", miNumListStyles);
|
|
|
|
|
pUnorderedListStyle = new UnorderedListStyle(sName.cstr(), id);
|
|
|
|
|
mListStyles.push_back(static_cast<ListStyle *>(pUnorderedListStyle));
|
|
|
|
@ -637,7 +643,7 @@ void WordPerfectCollector::defineUnorderedListLevel(const WPXPropertyList &propL
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WordPerfectCollector::openOrderedListLevel(const WPXPropertyList &propList)
|
|
|
|
|
void WordPerfectCollector::openOrderedListLevel(const _SH_PropertyList &propList)
|
|
|
|
|
{
|
|
|
|
|
miCurrentListLevel++;
|
|
|
|
|
TagOpenElement *pListLevelOpenElement = new TagOpenElement("text:ordered-list");
|
|
|
|
@ -650,7 +656,7 @@ void WordPerfectCollector::openOrderedListLevel(const WPXPropertyList &propList)
|
|
|
|
|
mpCurrentContentElements->push_back(static_cast<DocumentElement *>(pListLevelOpenElement));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WordPerfectCollector::openUnorderedListLevel(const WPXPropertyList &propList)
|
|
|
|
|
void WordPerfectCollector::openUnorderedListLevel(const _SH_PropertyList &propList)
|
|
|
|
|
{
|
|
|
|
|
miCurrentListLevel++;
|
|
|
|
|
TagOpenElement *pListLevelOpenElement = new TagOpenElement("text:unordered-list");
|
|
|
|
@ -695,7 +701,7 @@ void WordPerfectCollector::_closeListLevel(const char *szListType)
|
|
|
|
|
|
|
|
|
|
miCurrentListLevel--;
|
|
|
|
|
|
|
|
|
|
WPXString sCloseElement;
|
|
|
|
|
_SH_String sCloseElement;
|
|
|
|
|
sCloseElement.sprintf("text:%s", szListType);
|
|
|
|
|
mpCurrentContentElements->push_back(static_cast<DocumentElement *>(new TagCloseElement(sCloseElement.cstr())));
|
|
|
|
|
|
|
|
|
@ -704,7 +710,7 @@ void WordPerfectCollector::_closeListLevel(const char *szListType)
|
|
|
|
|
mbListElementOpened = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WordPerfectCollector::openListElement(const WPXPropertyList &propList, const WPXPropertyListVector &tabStops)
|
|
|
|
|
void WordPerfectCollector::openListElement(const _SH_PropertyList &propList, const _SH_PropertyListVector &tabStops)
|
|
|
|
|
{
|
|
|
|
|
miLastListLevel = miCurrentListLevel;
|
|
|
|
|
if (miCurrentListLevel == 1)
|
|
|
|
@ -715,15 +721,15 @@ void WordPerfectCollector::openListElement(const WPXPropertyList &propList, cons
|
|
|
|
|
|
|
|
|
|
ParagraphStyle *pStyle = NULL;
|
|
|
|
|
|
|
|
|
|
WPXPropertyList *pPersistPropList = new WPXPropertyList(propList);
|
|
|
|
|
_SH_PropertyList *pPersistPropList = new _SH_PropertyList(propList);
|
|
|
|
|
pPersistPropList->insert("style:list-style-name", mpCurrentListStyle->getName());
|
|
|
|
|
pPersistPropList->insert("style:parent-style-name", "Standard");
|
|
|
|
|
|
|
|
|
|
WPXString sKey = getParagraphStyleKey(*pPersistPropList, tabStops);
|
|
|
|
|
_SH_String sKey = getParagraphStyleKey(*pPersistPropList, tabStops);
|
|
|
|
|
|
|
|
|
|
if (mTextStyleHash.find(sKey) == mTextStyleHash.end())
|
|
|
|
|
{
|
|
|
|
|
WPXString sName;
|
|
|
|
|
_SH_String sName;
|
|
|
|
|
sName.sprintf("S%i", mTextStyleHash.size());
|
|
|
|
|
|
|
|
|
|
pStyle = new ParagraphStyle(pPersistPropList, tabStops, sName);
|
|
|
|
@ -762,12 +768,12 @@ void WordPerfectCollector::closeListElement()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WordPerfectCollector::openFootnote(const WPXPropertyList &propList)
|
|
|
|
|
void WordPerfectCollector::openFootnote(const _SH_PropertyList &propList)
|
|
|
|
|
{
|
|
|
|
|
TagOpenElement *pOpenFootNote = new TagOpenElement("text:footnote");
|
|
|
|
|
if (propList["libwpd:number"])
|
|
|
|
|
{
|
|
|
|
|
WPXString tmpString("ftn");
|
|
|
|
|
_SH_String tmpString("ftn");
|
|
|
|
|
tmpString.append(propList["libwpd:number"]->getStr());
|
|
|
|
|
pOpenFootNote->addAttribute("text:id", tmpString);
|
|
|
|
|
}
|
|
|
|
@ -791,12 +797,12 @@ void WordPerfectCollector::closeFootnote()
|
|
|
|
|
mpCurrentContentElements->push_back(static_cast<DocumentElement *>(new TagCloseElement("text:footnote")));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WordPerfectCollector::openEndnote(const WPXPropertyList &propList)
|
|
|
|
|
void WordPerfectCollector::openEndnote(const _SH_PropertyList &propList)
|
|
|
|
|
{
|
|
|
|
|
TagOpenElement *pOpenEndNote = new TagOpenElement("text:endnote");
|
|
|
|
|
if (propList["libwpd:number"])
|
|
|
|
|
{
|
|
|
|
|
WPXString tmpString("edn");
|
|
|
|
|
_SH_String tmpString("edn");
|
|
|
|
|
tmpString.append(propList["libwpd:number"]->getStr());
|
|
|
|
|
pOpenEndNote->addAttribute("text:id", tmpString);
|
|
|
|
|
}
|
|
|
|
@ -820,11 +826,11 @@ void WordPerfectCollector::closeEndnote()
|
|
|
|
|
mpCurrentContentElements->push_back(static_cast<DocumentElement *>(new TagCloseElement("text:endnote")));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WordPerfectCollector::openTable(const WPXPropertyList &propList, const WPXPropertyListVector &columns)
|
|
|
|
|
void WordPerfectCollector::openTable(const _SH_PropertyList &propList, const _SH_PropertyListVector &columns)
|
|
|
|
|
{
|
|
|
|
|
if (!mWriterDocumentState.mbInNote)
|
|
|
|
|
{
|
|
|
|
|
WPXString sTableName;
|
|
|
|
|
_SH_String sTableName;
|
|
|
|
|
sTableName.sprintf("Table%i", mTableStyles.size());
|
|
|
|
|
|
|
|
|
|
// FIXME: we base the table style off of the page's margin left, ignoring (potential) wordperfect margin
|
|
|
|
@ -834,7 +840,7 @@ void WordPerfectCollector::openTable(const WPXPropertyList &propList, const WPXP
|
|
|
|
|
|
|
|
|
|
if (mWriterDocumentState.mbFirstElement && mpCurrentContentElements == &mBodyElements)
|
|
|
|
|
{
|
|
|
|
|
WPXString sMasterPageName("Page Style 1");
|
|
|
|
|
_SH_String sMasterPageName("Page Style 1");
|
|
|
|
|
pTableStyle->setMasterPageName(sMasterPageName);
|
|
|
|
|
mWriterDocumentState.mbFirstElement = false;
|
|
|
|
|
}
|
|
|
|
@ -852,7 +858,7 @@ void WordPerfectCollector::openTable(const WPXPropertyList &propList, const WPXP
|
|
|
|
|
for (int i=0; i<pTableStyle->getNumColumns(); i++)
|
|
|
|
|
{
|
|
|
|
|
TagOpenElement *pTableColumnOpenElement = new TagOpenElement("table:table-column");
|
|
|
|
|
WPXString sColumnStyleName;
|
|
|
|
|
_SH_String sColumnStyleName;
|
|
|
|
|
sColumnStyleName.sprintf("%s.Column%i", sTableName.cstr(), (i+1));
|
|
|
|
|
pTableColumnOpenElement->addAttribute("table:style-name", sColumnStyleName.cstr());
|
|
|
|
|
mpCurrentContentElements->push_back(pTableColumnOpenElement);
|
|
|
|
@ -863,7 +869,7 @@ void WordPerfectCollector::openTable(const WPXPropertyList &propList, const WPXP
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WordPerfectCollector::openTableRow(const WPXPropertyList &propList)
|
|
|
|
|
void WordPerfectCollector::openTableRow(const _SH_PropertyList &propList)
|
|
|
|
|
{
|
|
|
|
|
if (!mWriterDocumentState.mbInNote)
|
|
|
|
|
{
|
|
|
|
@ -873,7 +879,7 @@ void WordPerfectCollector::openTableRow(const WPXPropertyList &propList)
|
|
|
|
|
mWriterDocumentState.mbHeaderRow = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WPXString sTableRowStyleName;
|
|
|
|
|
_SH_String sTableRowStyleName;
|
|
|
|
|
sTableRowStyleName.sprintf("%s.Row%i", mpCurrentTableStyle->getName().cstr(), mpCurrentTableStyle->getNumTableRowStyles());
|
|
|
|
|
TableRowStyle *pTableRowStyle = new TableRowStyle(propList, sTableRowStyleName.cstr());
|
|
|
|
|
mpCurrentTableStyle->addTableRowStyle(pTableRowStyle);
|
|
|
|
@ -897,11 +903,11 @@ void WordPerfectCollector::closeTableRow()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WordPerfectCollector::openTableCell(const WPXPropertyList &propList)
|
|
|
|
|
void WordPerfectCollector::openTableCell(const _SH_PropertyList &propList)
|
|
|
|
|
{
|
|
|
|
|
if (!mWriterDocumentState.mbInNote)
|
|
|
|
|
{
|
|
|
|
|
WPXString sTableCellStyleName;
|
|
|
|
|
_SH_String sTableCellStyleName;
|
|
|
|
|
sTableCellStyleName.sprintf( "%s.Cell%i", mpCurrentTableStyle->getName().cstr(), mpCurrentTableStyle->getNumTableCellStyles());
|
|
|
|
|
TableCellStyle *pTableCellStyle = new TableCellStyle(propList, sTableCellStyleName.cstr());
|
|
|
|
|
mpCurrentTableStyle->addTableCellStyle(pTableCellStyle);
|
|
|
|
@ -930,7 +936,7 @@ void WordPerfectCollector::closeTableCell()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WordPerfectCollector::insertCoveredTableCell(const WPXPropertyList &propList)
|
|
|
|
|
void WordPerfectCollector::insertCoveredTableCell(const _SH_PropertyList &propList)
|
|
|
|
|
{
|
|
|
|
|
if (!mWriterDocumentState.mbInNote)
|
|
|
|
|
{
|
|
|
|
@ -960,7 +966,7 @@ void WordPerfectCollector::insertLineBreak()
|
|
|
|
|
mpCurrentContentElements->push_back(static_cast<DocumentElement *>(new TagCloseElement("text:line-break")));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WordPerfectCollector::insertText(const WPXString &text)
|
|
|
|
|
void WordPerfectCollector::insertText(const _SH_String &text)
|
|
|
|
|
{
|
|
|
|
|
DocumentElement *pText = new TextElement(text);
|
|
|
|
|
mpCurrentContentElements->push_back(pText);
|
|
|
|
|