writerperfect/source/filter/DocumentElement.hxx | 2 writerperfect/source/filter/FontStyle.cxx | 3 - writerperfect/source/filter/OdgGenerator.cxx | 57 ++++++++++++------------ writerperfect/source/filter/OdtGenerator.cxx | 21 ++++---- writerperfect/source/filter/Style.hxx | 21 ++------ writerperfect/source/filter/TextRunStyle.hxx | 4 - 6 files changed, 52 insertions(+), 56 deletions(-)
New commits: commit f9832c3edb8c69eb9791e55ebfdce8c21f460291 Author: Caolán McNamara <caol...@redhat.com> Date: Mon Oct 24 14:51:29 2011 +0100 fix warning and indent and use boost::noncopyable diff --git a/writerperfect/source/filter/DocumentElement.hxx b/writerperfect/source/filter/DocumentElement.hxx index f56cfb2..4032a39 100644 --- a/writerperfect/source/filter/DocumentElement.hxx +++ b/writerperfect/source/filter/DocumentElement.hxx @@ -57,7 +57,7 @@ private: class TagOpenElement : public TagElement { public: - TagOpenElement(const WPXString &szTagName) : TagElement(szTagName), maAttrList() {} + TagOpenElement(const WPXString &szTagName) : TagElement(szTagName), maAttrList() {} virtual ~TagOpenElement() {} void addAttribute(const WPXString &szAttributeName, const WPXString &sAttributeValue); virtual void write(OdfDocumentHandler *pHandler) const; diff --git a/writerperfect/source/filter/FontStyle.cxx b/writerperfect/source/filter/FontStyle.cxx index a3f0ef7..8b24e18 100644 --- a/writerperfect/source/filter/FontStyle.cxx +++ b/writerperfect/source/filter/FontStyle.cxx @@ -54,7 +54,8 @@ void FontStyle::write(OdfDocumentHandler *pHandler) const void FontStyleManager::clean() { for (std::map<WPXString, FontStyle *, ltstr>::iterator iter = mHash.begin(); - iter != mHash.end(); iter++) { + iter != mHash.end(); iter++) + { delete(iter->second); } mHash.clear(); diff --git a/writerperfect/source/filter/OdgGenerator.cxx b/writerperfect/source/filter/OdgGenerator.cxx index 79653fa..2de6f4a 100644 --- a/writerperfect/source/filter/OdgGenerator.cxx +++ b/writerperfect/source/filter/OdgGenerator.cxx @@ -255,14 +255,14 @@ public: std::vector<DocumentElement *> mPageAutomaticStyles; std::vector<DocumentElement *> mPageMasterStyles; - // paragraph styles - ParagraphStyleManager mParagraphManager; + // paragraph styles + ParagraphStyleManager mParagraphManager; - // span styles - SpanStyleManager mSpanManager; + // span styles + SpanStyleManager mSpanManager; // font styles - FontStyleManager mFontManager; + FontStyleManager mFontManager; OdfDocumentHandler *mpHandler; @@ -283,17 +283,18 @@ public: }; OdgGeneratorPrivate::OdgGeneratorPrivate(OdfDocumentHandler *pHandler, const OdfStreamType streamType): - mBodyElements(), - mGraphicsStrokeDashStyles(), - mGraphicsGradientStyles(), - mGraphicsAutomaticStyles(), - mPageAutomaticStyles(), - mPageMasterStyles(), - mParagraphManager(), - mSpanManager(), - mFontManager(), + mBodyElements(), + mGraphicsStrokeDashStyles(), + mGraphicsGradientStyles(), + mGraphicsAutomaticStyles(), + mPageAutomaticStyles(), + mPageMasterStyles(), + mParagraphManager(), + mSpanManager(), + mFontManager(), mpHandler(pHandler), - mxStyle(), mxGradient(), + mxStyle(), + mxGradient(), miGradientIndex(1), miDashIndex(1), miGraphicsStyleIndex(1), @@ -1335,15 +1336,15 @@ void OdgGenerator::endTextObject() void OdgGenerator::startTextLine(WPXPropertyList const &propList) { - WPXPropertyList finalPropList(propList); - finalPropList.insert("style:parent-style-name", "Standard"); - WPXString paragName = mpImpl->mParagraphManager.findOrAdd(finalPropList, WPXPropertyListVector()); + WPXPropertyList finalPropList(propList); + finalPropList.insert("style:parent-style-name", "Standard"); + WPXString paragName = mpImpl->mParagraphManager.findOrAdd(finalPropList, WPXPropertyListVector()); - // create a document element corresponding to the paragraph, and append it to our list of document elements - TagOpenElement *pParagraphOpenElement = new TagOpenElement("text:p"); - pParagraphOpenElement->addAttribute("text:style-name", paragName); - mpImpl->mBodyElements.push_back(pParagraphOpenElement); + // create a document element corresponding to the paragraph, and append it to our list of document elements + TagOpenElement *pParagraphOpenElement = new TagOpenElement("text:p"); + pParagraphOpenElement->addAttribute("text:style-name", paragName); + mpImpl->mBodyElements.push_back(pParagraphOpenElement); } void OdgGenerator::endTextLine() @@ -1354,18 +1355,18 @@ void OdgGenerator::endTextLine() void OdgGenerator::startTextSpan(WPXPropertyList const&propList) { if (propList["style:font-name"]) - mpImpl->mFontManager.findOrAdd(propList["style:font-name"]->getStr().cstr()); + mpImpl->mFontManager.findOrAdd(propList["style:font-name"]->getStr().cstr()); - WPXString sName = mpImpl->mSpanManager.findOrAdd(propList); + WPXString sName = mpImpl->mSpanManager.findOrAdd(propList); - TagOpenElement *pSpanOpenElement = new TagOpenElement("text:span"); - pSpanOpenElement->addAttribute("text:style-name", sName.cstr()); - mpImpl->mBodyElements.push_back(pSpanOpenElement); + TagOpenElement *pSpanOpenElement = new TagOpenElement("text:span"); + pSpanOpenElement->addAttribute("text:style-name", sName.cstr()); + mpImpl->mBodyElements.push_back(pSpanOpenElement); } void OdgGenerator::endTextSpan() { - mpImpl->mBodyElements.push_back(new TagCloseElement("text:span")); + mpImpl->mBodyElements.push_back(new TagCloseElement("text:span")); } void OdgGenerator::insertText(WPXString const &text) diff --git a/writerperfect/source/filter/OdtGenerator.cxx b/writerperfect/source/filter/OdtGenerator.cxx index 04e0351..aba82d8 100644 --- a/writerperfect/source/filter/OdtGenerator.cxx +++ b/writerperfect/source/filter/OdtGenerator.cxx @@ -84,7 +84,7 @@ enum WriterListType { unordered, ordered }; _WriterDocumentState::_WriterDocumentState() : mbFirstElement(true), - mbFirstParagraphInPageSpan(true), + mbFirstParagraphInPageSpan(true), mbInFakeSection(false), mbListElementOpenedAtCurrentLevel(false), mbTableCellOpened(false), @@ -342,7 +342,9 @@ void OdtGeneratorPrivate::_writeDefaultStyles(OdfDocumentHandler *pHandler) for (std::vector<DocumentElement *>::const_iterator iter = mFrameStyles.begin(); iter != mFrameStyles.end(); ++iter) + { (*iter)->write(pHandler); + } pHandler->endElement("office:styles"); } @@ -483,19 +485,18 @@ bool OdtGeneratorPrivate::_writeTargetDocument(OdfDocumentHandler *pHandler) void OdtGenerator::setDocumentMetaData(const WPXPropertyList &propList) { - WPXPropertyList::Iter i(propList); - for (i.rewind(); i.next(); ) - { - // filter out libwpd elements - if (strncmp(i.key(), "libwpd", 6) != 0 && strncmp(i.key(), "dcterms", 7) != 0) + WPXPropertyList::Iter i(propList); + for (i.rewind(); i.next(); ) + { + // filter out libwpd elements + if (strncmp(i.key(), "libwpd", 6) != 0 && strncmp(i.key(), "dcterms", 7) != 0) { mpImpl->mMetaData.push_back(new TagOpenElement(i.key())); WPXString sStringValue(i()->getStr(), true); mpImpl->mMetaData.push_back(new CharDataElement(sStringValue.cstr())); mpImpl->mMetaData.push_back(new TagCloseElement(i.key())); } - } - + } } void OdtGenerator::openPageSpan(const WPXPropertyList &propList) @@ -618,7 +619,7 @@ void OdtGenerator::closeParagraph() void OdtGenerator::openSpan(const WPXPropertyList &propList) { if (propList["style:font-name"]) - mpImpl->mFontManager.findOrAdd(propList["style:font-name"]->getStr().cstr()); + mpImpl->mFontManager.findOrAdd(propList["style:font-name"]->getStr().cstr()); // Get the style WPXString sName = mpImpl->mSpanManager.findOrAdd(propList); @@ -650,7 +651,7 @@ void OdtGenerator::defineOrderedListLevel(const WPXPropertyList &propList) // is starting a new list at level 1 (and only level 1) if (pOrderedListStyle == NULL || pOrderedListStyle->getListID() != id || (propList["libwpd:level"] && propList["libwpd:level"]->getInt()==1 && - (propList["text:start-value"] && static_cast<unsigned>(propList["text:start-value"]->getInt()) != int(mpImpl->mWriterListStates.top().miLastListNumber+1)))) + (propList["text:start-value"] && static_cast<unsigned>(propList["text:start-value"]->getInt()) != mpImpl->mWriterListStates.top().miLastListNumber+1))) { WRITER_DEBUG_MSG(("Attempting to create a new ordered list style (listid: %i)\n", id)); WPXString sName; diff --git a/writerperfect/source/filter/Style.hxx b/writerperfect/source/filter/Style.hxx index 83fb2b5..ab38d6d 100644 --- a/writerperfect/source/filter/Style.hxx +++ b/writerperfect/source/filter/Style.hxx @@ -32,18 +32,16 @@ #include <libwpd/libwpd.h> #include "libwriterperfect_filter.hxx" #include "DocumentElement.hxx" +#include <boost/noncopyable.hpp> -class TopLevelElementStyle +class TopLevelElementStyle : private boost::noncopyable { public: TopLevelElementStyle() : mpsMasterPageName(NULL) { } virtual ~TopLevelElementStyle() { if (mpsMasterPageName) delete mpsMasterPageName; } void setMasterPageName(WPXString &sMasterPageName) { mpsMasterPageName = new WPXString(sMasterPageName); } const WPXString * getMasterPageName() const { return mpsMasterPageName; } - private: - TopLevelElementStyle(TopLevelElementStyle const &orig) : mpsMasterPageName(0) { *this = orig; } - TopLevelElementStyle &operator=(TopLevelElementStyle const &) { mpsMasterPageName=0L; return *this; } WPXString *mpsMasterPageName; }; @@ -60,19 +58,14 @@ private: WPXString msName; }; -class StyleManager +class StyleManager : private boost::noncopyable { public: - StyleManager() {} - virtual ~StyleManager() {} - - virtual void clean() {}; - virtual void write(OdfDocumentHandler *) const = 0; + StyleManager() {} + virtual ~StyleManager() {} -private: - // forbide copy constructor/operator - StyleManager(StyleManager const &orig); - StyleManager &operator=(StyleManager const &); + virtual void clean() {}; + virtual void write(OdfDocumentHandler *) const = 0; }; #endif diff --git a/writerperfect/source/filter/TextRunStyle.hxx b/writerperfect/source/filter/TextRunStyle.hxx index 5bd1381..a460c85 100644 --- a/writerperfect/source/filter/TextRunStyle.hxx +++ b/writerperfect/source/filter/TextRunStyle.hxx @@ -44,12 +44,12 @@ class OdfDocumentHandler; class ParagraphStyle { public: - ParagraphStyle(WPXPropertyList const &propList, const WPXPropertyListVector &tabStops, const WPXString &sName); + ParagraphStyle(WPXPropertyList const &propList, const WPXPropertyListVector &tabStops, const WPXString &sName); virtual ~ParagraphStyle(); virtual void write(OdfDocumentHandler *pHandler) const; WPXString getName() const { return msName; } private: - WPXPropertyList mpPropList; + WPXPropertyList mpPropList; WPXPropertyListVector mxTabStops; WPXString msName; };
_______________________________________________ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits