summaryrefslogtreecommitdiff
path: root/writerperfect
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-10-24 14:51:29 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-10-24 14:51:59 +0100
commitf8c2d298be72440da658b580630d1f4452a807a4 (patch)
treeda8322d12b4711777597ed0cc83a91eea820f741 /writerperfect
parent09179e24c4e4eec135012a3cce5e1cffc42fae60 (diff)
fix warning and indent and use boost::noncopyable
Diffstat (limited to 'writerperfect')
-rw-r--r--writerperfect/source/filter/DocumentElement.hxx2
-rw-r--r--writerperfect/source/filter/FontStyle.cxx3
-rw-r--r--writerperfect/source/filter/OdgGenerator.cxx57
-rw-r--r--writerperfect/source/filter/OdtGenerator.cxx21
-rw-r--r--writerperfect/source/filter/Style.hxx21
-rw-r--r--writerperfect/source/filter/TextRunStyle.hxx4
6 files changed, 52 insertions, 56 deletions
diff --git a/writerperfect/source/filter/DocumentElement.hxx b/writerperfect/source/filter/DocumentElement.hxx
index f56cfb25772a..4032a399b52c 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 a3f0ef7e8fd7..8b24e1836e2c 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 79653fa98c3a..2de6f4ab7faf 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 04e035195cc6..aba82d819fa2 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 83fb2b510d9d..ab38d6db48f2 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 5bd1381ac375..a460c858d054 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;
};