diff options
author | Kurt Zenker <kz@openoffice.org> | 2005-03-01 16:04:43 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2005-03-01 16:04:43 +0000 |
commit | a4af4c9a4365ac2bdbe7d17e17d4515c2dee55b8 (patch) | |
tree | ef2152e8b81011eab5f975d92d6d8ace7f56f160 /writerperfect/source | |
parent | b4702a713b4670e4621702917e1833ca2625f078 (diff) |
INTEGRATION: CWS libwpdupgrade (1.1.2); FILE MERGED
2005/02/02 20:44:42 rene 1.1.2.1: upgrade writerperfect to new libwpd API and implement --with-system-libwpd.
Remove old libwpd/ stuff, tarball will come when the actual release happened :-)
Diffstat (limited to 'writerperfect/source')
-rw-r--r-- | writerperfect/source/filter/FilterInternal.hxx | 3 | ||||
-rw-r--r-- | writerperfect/source/filter/FontStyle.cxx | 8 | ||||
-rw-r--r-- | writerperfect/source/filter/FontStyle.hxx | 15 | ||||
-rw-r--r-- | writerperfect/source/filter/ListStyle.cxx | 103 | ||||
-rw-r--r-- | writerperfect/source/filter/ListStyle.hxx | 36 |
5 files changed, 53 insertions, 112 deletions
diff --git a/writerperfect/source/filter/FilterInternal.hxx b/writerperfect/source/filter/FilterInternal.hxx index 12d4b8641013..dba9e6c43eca 100644 --- a/writerperfect/source/filter/FilterInternal.hxx +++ b/writerperfect/source/filter/FilterInternal.hxx @@ -26,9 +26,10 @@ #define WRITER_DEBUG_MSG(M) #endif +#if 0 #include <rtl/string.hxx> - inline rtl::OString utf8_itoa(int i) { return rtl::OString::valueOf( (sal_Int32) i ); } +#endif diff --git a/writerperfect/source/filter/FontStyle.cxx b/writerperfect/source/filter/FontStyle.cxx index 1aaa56e2bc8a..fffd35bbdd2b 100644 --- a/writerperfect/source/filter/FontStyle.cxx +++ b/writerperfect/source/filter/FontStyle.cxx @@ -25,14 +25,12 @@ * Corel Corporation or Corel Corporation Limited." */ #include "FontStyle.hxx" -#include "FontMap.hxx" #include "WriterProperties.hxx" #include "DocumentElement.hxx" FontStyle::FontStyle(const char *psName, const char *psFontFamily) : Style(psName), msFontFamily(psFontFamily), msFontPitch(IMP_DEFAULT_FONT_PITCH) - { } @@ -40,11 +38,11 @@ FontStyle::~FontStyle() { } -void FontStyle::write(Reference < XDocumentHandler > &xHandler) const +void FontStyle::write(DocumentHandler &xHandler) const { TagOpenElement styleOpen("style:font-decl"); - styleOpen.addAttribute("style:name", mapFont(getName())); - styleOpen.addAttribute("fo:font-family", mapFont(msFontFamily)); + styleOpen.addAttribute("style:name", getName()); + styleOpen.addAttribute("fo:font-family", msFontFamily); styleOpen.addAttribute("style:font-pitch", msFontPitch); styleOpen.write(xHandler); TagCloseElement styleClose("style:font-decl"); diff --git a/writerperfect/source/filter/FontStyle.hxx b/writerperfect/source/filter/FontStyle.hxx index e275aa1ce531..7b8cb62854a9 100644 --- a/writerperfect/source/filter/FontStyle.hxx +++ b/writerperfect/source/filter/FontStyle.hxx @@ -31,23 +31,16 @@ #include "Style.hxx" #include "WriterProperties.hxx" -#ifndef _COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_ -#include <com/sun/star/xml/sax/XDocumentHandler.hpp> -#endif - -using com::sun::star::uno::Reference; -using com::sun::star::xml::sax::XDocumentHandler; - class FontStyle : public Style { public: FontStyle(const char *psName, const char *psFontFamily); ~FontStyle(); - virtual void write(Reference < XDocumentHandler > &xHandler) const; - const UTF8String &getFontFamily() const { return msFontFamily; } + virtual void write(DocumentHandler &xHandler) const; + const WPXString &getFontFamily() const { return msFontFamily; } private: - UTF8String msFontFamily; - UTF8String msFontPitch; + WPXString msFontFamily; + WPXString msFontPitch; }; #endif diff --git a/writerperfect/source/filter/ListStyle.cxx b/writerperfect/source/filter/ListStyle.cxx index 96959bb8126d..ac836605203d 100644 --- a/writerperfect/source/filter/ListStyle.cxx +++ b/writerperfect/source/filter/ListStyle.cxx @@ -28,112 +28,77 @@ #include "ListStyle.hxx" #include "DocumentElement.hxx" -using namespace ::rtl; -using rtl::OUString; - -OrderedListLevelStyle::OrderedListLevelStyle(const WPXNumberingType listType, const UCSString &sTextBeforeNumber, - const UCSString &sTextAfterNumber, const float fSpaceBefore, const int iStartingNumber) : - mlistType(listType), - msTextBeforeNumber(sTextBeforeNumber), - msTextAfterNumber(sTextAfterNumber), - mfSpaceBefore(fSpaceBefore), - miStartingNumber(iStartingNumber) +OrderedListLevelStyle::OrderedListLevelStyle(const WPXPropertyList &xPropList) : + mPropList(xPropList) { } -void OrderedListStyle::updateListLevel(const int iLevel, const WPXNumberingType listType, const UCSString &sTextBeforeNumber, const UCSString &sTextAfterNumber, const int iStartingNumber) +void OrderedListStyle::updateListLevel(const int iLevel, const WPXPropertyList &xPropList) { if (!isListLevelDefined(iLevel)) - setListLevel(iLevel, new OrderedListLevelStyle(listType, sTextBeforeNumber, sTextAfterNumber, iLevel*0.5f, iStartingNumber)); + setListLevel(iLevel, new OrderedListLevelStyle(xPropList)); } -void OrderedListLevelStyle::write(Reference < XDocumentHandler > &xHandler, int iLevel) const +void OrderedListLevelStyle::write(DocumentHandler &xHandler, int iLevel) const { - // then convert from ucs4 to utf8 and write it - //char *sBulletUTF8 = ucs2ArrayToUTF8String(msBullet); - - //if (mfSpaceBefore != 0.0f) - UTF8String sListTypeSymbol("1"); - switch (mlistType) - { - case ARABIC: - sListTypeSymbol.sprintf("1"); - break; - case LOWERCASE: - sListTypeSymbol.sprintf("a"); - break; - case UPPERCASE: - sListTypeSymbol.sprintf("A"); - break; - case LOWERCASE_ROMAN: - sListTypeSymbol.sprintf("i"); - break; - case UPPERCASE_ROMAN: - sListTypeSymbol.sprintf("I"); - break; - } - - UTF8String sTextBeforeNumber(msTextBeforeNumber, true); - UTF8String sTextAfterNumber(msTextAfterNumber, true); - UTF8String sLevel; + WPXString sLevel; sLevel.sprintf("%i", (iLevel+1)); - UTF8String sStartValue; - sStartValue.sprintf("%i", miStartingNumber); TagOpenElement listLevelStyleOpen("text:list-level-style-number"); - listLevelStyleOpen.addAttribute("text:level", sLevel.getUTF8()); + listLevelStyleOpen.addAttribute("text:level", sLevel); listLevelStyleOpen.addAttribute("text:style-name", "Numbering Symbols"); - listLevelStyleOpen.addAttribute("style:num-prefix", sTextBeforeNumber.getUTF8()); - listLevelStyleOpen.addAttribute("style:num-suffix", sTextAfterNumber.getUTF8()); - listLevelStyleOpen.addAttribute("style:num-format", sListTypeSymbol.getUTF8()); - listLevelStyleOpen.addAttribute("text:start-value", sStartValue.getUTF8()); + if (mPropList["style:num-prefix"]) + listLevelStyleOpen.addAttribute("style:num-prefix", mPropList["style:num-prefix"]->getStr()); + if (mPropList["style:num-suffix"]) + listLevelStyleOpen.addAttribute("style:num-suffix", mPropList["style:num-suffix"]->getStr()); + if (mPropList["style:num-format"]) + listLevelStyleOpen.addAttribute("style:num-format", mPropList["style:num-format"]->getStr()); + if (mPropList["text:start-value"]) + listLevelStyleOpen.addAttribute("text:start-value", mPropList["text:start-value"]->getStr()); listLevelStyleOpen.write(xHandler); - UTF8String sSpaceBefore; - sSpaceBefore.sprintf("%fcm", mfSpaceBefore); TagOpenElement stylePropertiesOpen("style:properties"); - stylePropertiesOpen.addAttribute("text:space-before", sSpaceBefore.getUTF8()); + if (mPropList["text:space-before"]) + stylePropertiesOpen.addAttribute("text:space-before", mPropList["text:space-before"]->getStr()); stylePropertiesOpen.addAttribute("text:min-label-width", "0.499cm"); stylePropertiesOpen.write(xHandler); - xHandler->endElement(OUString::createFromAscii("style:properties")); - xHandler->endElement(OUString::createFromAscii("text:list-level-style-number")); + xHandler.endElement("style:properties"); + xHandler.endElement("text:list-level-style-number"); } -UnorderedListLevelStyle::UnorderedListLevelStyle(const UCSString &sBullet, const float fSpaceBefore) - : msBullet(sBullet), - mfSpaceBefore(fSpaceBefore) +UnorderedListLevelStyle::UnorderedListLevelStyle(const WPXPropertyList &xPropList) + : mPropList(xPropList) { } -void UnorderedListStyle::updateListLevel(const int iLevel, const UCSString &sBullet) +void UnorderedListStyle::updateListLevel(const int iLevel, const WPXPropertyList &xPropList) { if (!isListLevelDefined(iLevel)) - setListLevel(iLevel, new UnorderedListLevelStyle(sBullet, iLevel*0.5f)); + setListLevel(iLevel, new UnorderedListLevelStyle(xPropList)); } -void UnorderedListLevelStyle::write(Reference < XDocumentHandler > &xHandler, int iLevel) const +void UnorderedListLevelStyle::write(DocumentHandler &xHandler, int iLevel) const { - UTF8String sBulletUTF8(msBullet, true); - UTF8String sLevel; + WPXString sLevel; sLevel.sprintf("%i", (iLevel+1)); TagOpenElement listLevelStyleOpen("text:list-level-style-bullet"); - listLevelStyleOpen.addAttribute("text:level", sLevel.getUTF8()); + listLevelStyleOpen.addAttribute("text:level", sLevel); listLevelStyleOpen.addAttribute("text:style-name", "Bullet Symbols"); listLevelStyleOpen.addAttribute("style:num-suffice", "."); - listLevelStyleOpen.addAttribute("text:bullet-char", sBulletUTF8.getUTF8()); + if (mPropList["text:bullet-char"]) + listLevelStyleOpen.addAttribute("text:bullet-char", mPropList["text:bullet-char"]->getStr()); listLevelStyleOpen.write(xHandler); - UTF8String sSpaceBefore; - sSpaceBefore.sprintf("%fcm", mfSpaceBefore); TagOpenElement stylePropertiesOpen("style:properties"); - stylePropertiesOpen.addAttribute("text:space-before", sSpaceBefore.getUTF8()); + if (mPropList["text:space-before"]) + listLevelStyleOpen.addAttribute("text:space-before", mPropList["text:space-before"]->getStr()); stylePropertiesOpen.addAttribute("text:min-label-width", "0.499cm"); stylePropertiesOpen.addAttribute("style:font-name", "StarSymbol"); stylePropertiesOpen.write(xHandler); - xHandler->endElement(OUString::createFromAscii("style:properties")); - xHandler->endElement(OUString::createFromAscii("text:list-level-style-bullet")); + xHandler.endElement("style:properties"); + xHandler.endElement("text:list-level-style-bullet"); } ListStyle::ListStyle(const char *psName, const int iListID) : @@ -171,7 +136,7 @@ void ListStyle::setListLevel(int iLevel, ListLevelStyle *iListLevelStyle) mppListLevels[iLevel] = iListLevelStyle; } -void ListStyle::write(Reference < XDocumentHandler > &xHandler) const +void ListStyle::write(DocumentHandler &xHandler) const { TagOpenElement listStyleOpenElement("text:list-style"); listStyleOpenElement.addAttribute("style:name", getName()); @@ -182,5 +147,5 @@ void ListStyle::write(Reference < XDocumentHandler > &xHandler) const mppListLevels[i]->write(xHandler, i); } - xHandler->endElement(OUString::createFromAscii("text:list-style")); + xHandler.endElement("text:list-style"); } diff --git a/writerperfect/source/filter/ListStyle.hxx b/writerperfect/source/filter/ListStyle.hxx index 51017b9e6133..850dcd105c3c 100644 --- a/writerperfect/source/filter/ListStyle.hxx +++ b/writerperfect/source/filter/ListStyle.hxx @@ -33,44 +33,30 @@ #include "Style.hxx" #include "WriterProperties.hxx" -#ifndef _COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_ -#include <com/sun/star/xml/sax/XDocumentHandler.hpp> -#endif - -using com::sun::star::uno::Reference; -using com::sun::star::xml::sax::XDocumentHandler; - class DocumentElement; class ListLevelStyle { public: - virtual void write(Reference < XDocumentHandler > &xHandler, int level) const = 0; + virtual void write(DocumentHandler &xHandler, int iLevel) const = 0; }; class OrderedListLevelStyle : public ListLevelStyle { public: - OrderedListLevelStyle(const WPXNumberingType listType, - const UCSString &sTextBeforeNumber, const UCSString &sTextAfterNumber, - const float fSpaceBefore, const int iStartingNumber); - virtual void write(Reference < XDocumentHandler > &xHandler, int level) const; + OrderedListLevelStyle(const WPXPropertyList &xPropList); + virtual void write(DocumentHandler &xHandler, int iLevel) const; private: - UCSString msTextBeforeNumber; - UCSString msTextAfterNumber; - float mfSpaceBefore; - int miStartingNumber; - WPXNumberingType mlistType; + WPXPropertyList mPropList; }; class UnorderedListLevelStyle : public ListLevelStyle { public: - UnorderedListLevelStyle(const UCSString &sBullet, const float fSpaceBefore); - virtual void write(Reference < XDocumentHandler > &xHandler, int iLevel) const; + UnorderedListLevelStyle(const WPXPropertyList &xPropList); + virtual void write(DocumentHandler &xHandler, int iLevel) const; private: - UCSString msBullet; - float mfSpaceBefore; + WPXPropertyList mPropList; }; class ListStyle : public Style @@ -78,7 +64,7 @@ class ListStyle : public Style public: ListStyle(const char *psName, const int iListID); virtual ~ListStyle(); - virtual void write(Reference < XDocumentHandler > &xHandler) const; + virtual void write(DocumentHandler &xHandler) const; const int getListID() { return miListID; } const bool isListLevelDefined(int iLevel) const; @@ -95,15 +81,13 @@ class OrderedListStyle : public ListStyle { public: OrderedListStyle(const char *psName, const int iListID) : ListStyle(psName, iListID) {} - void updateListLevel(const int iLevel, const WPXNumberingType listType, - const UCSString &sTextBeforeNumber, const UCSString &sTextAfterNumber, - const int iStartingNumber); + void updateListLevel(const int iLevel, const WPXPropertyList &xPropList); }; class UnorderedListStyle : public ListStyle { public: UnorderedListStyle(const char *psName, const int iListID) : ListStyle(psName, iListID) {} - void updateListLevel(const int iLevel, const UCSString &sBullet); + void updateListLevel(const int iLevel, const WPXPropertyList &xPropList); }; #endif |