summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-09-07 09:09:47 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-09-07 10:07:43 +0200
commit105b9ce13cbf19e898b5971279b5fe53410ddb71 (patch)
treea8bc5821dacadd957271e15a554b62af520ec8ed /writerfilter
parent9f28a9e6593fcb9031cd1f80b073c62e624eddd8 (diff)
writerfilter: size() > 0 -> !empty() and other small cleanups
Change-Id: I808a3ed8180b6f2164f14d736e2c8dc4bb8948bc Reviewed-on: https://gerrit.libreoffice.org/42037 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/SdtHelper.hxx2
-rw-r--r--writerfilter/source/dmapper/TableManager.cxx10
-rw-r--r--writerfilter/source/filter/RtfFilter.cxx2
-rw-r--r--writerfilter/source/filter/WriterFilter.cxx4
-rw-r--r--writerfilter/source/rtftok/rtfdispatchdestination.cxx2
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx55
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.hxx20
-rw-r--r--writerfilter/source/rtftok/rtfsdrimport.cxx6
-rw-r--r--writerfilter/source/rtftok/rtfsdrimport.hxx2
-rw-r--r--writerfilter/source/rtftok/rtfsprm.cxx16
-rw-r--r--writerfilter/source/rtftok/rtftokenizer.cxx2
-rw-r--r--writerfilter/source/rtftok/rtfvalue.cxx12
12 files changed, 64 insertions, 69 deletions
diff --git a/writerfilter/source/dmapper/SdtHelper.hxx b/writerfilter/source/dmapper/SdtHelper.hxx
index 3f3574af7adf..595071377cf0 100644
--- a/writerfilter/source/dmapper/SdtHelper.hxx
+++ b/writerfilter/source/dmapper/SdtHelper.hxx
@@ -67,7 +67,7 @@ class SdtHelper final
bool m_bOutsideAParagraph;
/// Create and append the drawing::XControlShape, containing the various models.
- void createControlShape(css::awt::Size aSize, css::uno::Reference<css::awt::XControlModel> const&, const css::uno::Sequence<css::beans::PropertyValue>& rGrabBag);
+ void createControlShape(css::awt::Size aSize, css::uno::Reference<css::awt::XControlModel> const& xControlModel, const css::uno::Sequence<css::beans::PropertyValue>& rGrabBag);
public:
explicit SdtHelper(DomainMapper_Impl& rDM_Impl);
~SdtHelper();
diff --git a/writerfilter/source/dmapper/TableManager.cxx b/writerfilter/source/dmapper/TableManager.cxx
index 697d109136d0..87ca79b5e118 100644
--- a/writerfilter/source/dmapper/TableManager.cxx
+++ b/writerfilter/source/dmapper/TableManager.cxx
@@ -39,7 +39,7 @@ void TableManager::openCell(const css::uno::Reference<css::text::XTextRange>& rH
TagLogger::getInstance().endElement();
#endif
- if (mTableDataStack.size() > 0)
+ if (!mTableDataStack.empty())
{
TableData::Pointer_t pTableData = mTableDataStack.top();
@@ -197,7 +197,7 @@ void TableManager::closeCell(const css::uno::Reference<css::text::XTextRange>& r
TagLogger::getInstance().endElement();
#endif
- if (mTableDataStack.size() > 0)
+ if (!mTableDataStack.empty())
{
TableData::Pointer_t pTableData = mTableDataStack.top();
@@ -214,7 +214,7 @@ void TableManager::ensureOpenCell(const TablePropertyMapPtr& pProps)
TagLogger::getInstance().startElement("tablemanager.ensureOpenCell");
#endif
- if (mTableDataStack.size() > 0)
+ if (!mTableDataStack.empty())
{
TableData::Pointer_t pTableData = mTableDataStack.top();
@@ -345,7 +345,7 @@ void TableManager::endLevel()
#ifdef DEBUG_WRITERFILTER
TableData::Pointer_t pTableData;
- if (mTableDataStack.size() > 0)
+ if (!mTableDataStack.empty())
pTableData = mTableDataStack.top();
TagLogger::getInstance().startElement("tablemanager.endLevel");
@@ -363,7 +363,7 @@ void TableManager::startLevel()
#ifdef DEBUG_WRITERFILTER
TableData::Pointer_t pTableData;
- if (mTableDataStack.size() > 0)
+ if (!mTableDataStack.empty())
pTableData = mTableDataStack.top();
TagLogger::getInstance().startElement("tablemanager.startLevel");
diff --git a/writerfilter/source/filter/RtfFilter.cxx b/writerfilter/source/filter/RtfFilter.cxx
index d985942b863f..6487b015c6bf 100644
--- a/writerfilter/source/filter/RtfFilter.cxx
+++ b/writerfilter/source/filter/RtfFilter.cxx
@@ -204,7 +204,7 @@ uno::Sequence<OUString> RtfFilter::getSupportedServiceNames()
return aRet;
}
-extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* SAL_CALL com_sun_star_comp_Writer_RtfFilter_get_implementation(uno::XComponentContext* pComponent, uno::Sequence<uno::Any> const&)
+extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* SAL_CALL com_sun_star_comp_Writer_RtfFilter_get_implementation(uno::XComponentContext* pComponent, uno::Sequence<uno::Any> const& /*rSequence*/)
{
return cppu::acquire(new RtfFilter(pComponent));
}
diff --git a/writerfilter/source/filter/WriterFilter.cxx b/writerfilter/source/filter/WriterFilter.cxx
index eafbb21d0bd5..36527b7a5223 100644
--- a/writerfilter/source/filter/WriterFilter.cxx
+++ b/writerfilter/source/filter/WriterFilter.cxx
@@ -149,7 +149,7 @@ sal_Bool WriterFilter::filter(const uno::Sequence< beans::PropertyValue >& rDesc
xExprtr->setSourceDocument(m_xSrcDoc);
return xFltr->filter(rDescriptor);
}
- else if (m_xDstDoc.is())
+ if (m_xDstDoc.is())
{
utl::MediaDescriptor aMediaDesc(rDescriptor);
bool bRepairStorage = aMediaDesc.getUnpackedValueOrDefault("RepairPackage", false);
@@ -368,7 +368,7 @@ void WriterFilter::putPropertiesToDocumentGrabBag(const comphelper::SequenceAsHa
}
}
-extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* SAL_CALL com_sun_star_comp_Writer_WriterFilter_get_implementation(uno::XComponentContext* component, uno::Sequence<uno::Any> const&)
+extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* SAL_CALL com_sun_star_comp_Writer_WriterFilter_get_implementation(uno::XComponentContext* component, uno::Sequence<uno::Any> const& /*rSequence*/)
{
return cppu::acquire(new WriterFilter(component));
}
diff --git a/writerfilter/source/rtftok/rtfdispatchdestination.cxx b/writerfilter/source/rtftok/rtfdispatchdestination.cxx
index 4799a3be8978..16abeed361ef 100644
--- a/writerfilter/source/rtftok/rtfdispatchdestination.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchdestination.cxx
@@ -292,7 +292,7 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
m_aStates.top().pCurrentBuffer = nullptr;
bool bCustomMark = false;
OUString aCustomMark;
- while (m_aSuperBuffer.size())
+ while (!m_aSuperBuffer.empty())
{
Buf_t aTuple = m_aSuperBuffer.front();
m_aSuperBuffer.pop_front();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index bdcb128d6128..f9afa8acfe44 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -137,13 +137,11 @@ bool eraseNestedAttribute(RTFSprms& rSprms, Id nParent, Id nId)
RTFSprms& getLastAttributes(RTFSprms& rSprms, Id nId)
{
RTFValue::Pointer_t p = rSprms.find(nId);
- if (p.get() && p->getSprms().size())
+ if (p.get() && !p->getSprms().empty())
return p->getSprms().back().second->getAttributes();
- else
- {
- SAL_WARN("writerfilter.rtf", "trying to set property when no type is defined");
- return rSprms;
- }
+
+ SAL_WARN("writerfilter.rtf", "trying to set property when no type is defined");
+ return rSprms;
}
void putBorderProperty(RTFStack& aStates, Id nId, const RTFValue::Pointer_t& pValue)
@@ -650,8 +648,8 @@ sal_uInt32 RTFDocumentImpl::getColorTable(sal_uInt32 nIndex)
return m_aColorTable[nIndex];
return 0;
}
- else
- return m_pSuperstream->getColorTable(nIndex);
+
+ return m_pSuperstream->getColorTable(nIndex);
}
rtl_TextEncoding RTFDocumentImpl::getEncoding(int nFontIndex)
@@ -662,31 +660,30 @@ rtl_TextEncoding RTFDocumentImpl::getEncoding(int nFontIndex)
if (it != m_aFontEncodings.end())
// We have a font encoding associated to this font.
return it->second;
- else if (m_aDefaultState.nCurrentEncoding != rtl_getTextEncodingFromWindowsCharset(0))
+ if (m_aDefaultState.nCurrentEncoding != rtl_getTextEncodingFromWindowsCharset(0))
// We have a default encoding.
return m_aDefaultState.nCurrentEncoding;
- else
- // Guess based on locale.
- return msfilter::util::getBestTextEncodingFromLocale(Application::GetSettings().GetLanguageTag().getLocale());
+ // Guess based on locale.
+ return msfilter::util::getBestTextEncodingFromLocale(Application::GetSettings().GetLanguageTag().getLocale());
}
- else
- return m_pSuperstream->getEncoding(nFontIndex);
+
+ return m_pSuperstream->getEncoding(nFontIndex);
}
OUString RTFDocumentImpl::getFontName(int nIndex)
{
if (!m_pSuperstream)
return m_aFontNames[nIndex];
- else
- return m_pSuperstream->getFontName(nIndex);
+
+ return m_pSuperstream->getFontName(nIndex);
}
int RTFDocumentImpl::getFontIndex(int nIndex)
{
if (!m_pSuperstream)
return std::find(m_aFontIndexes.begin(), m_aFontIndexes.end(), nIndex) - m_aFontIndexes.begin();
- else
- return m_pSuperstream->getFontIndex(nIndex);
+
+ return m_pSuperstream->getFontIndex(nIndex);
}
OUString RTFDocumentImpl::getStyleName(int nIndex)
@@ -698,8 +695,8 @@ OUString RTFDocumentImpl::getStyleName(int nIndex)
aRet = m_aStyleNames[nIndex];
return aRet;
}
- else
- return m_pSuperstream->getStyleName(nIndex);
+
+ return m_pSuperstream->getStyleName(nIndex);
}
Id RTFDocumentImpl::getStyleType(int nIndex)
@@ -711,16 +708,16 @@ Id RTFDocumentImpl::getStyleType(int nIndex)
nRet = m_aStyleTypes[nIndex];
return nRet;
}
- else
- return m_pSuperstream->getStyleType(nIndex);
+
+ return m_pSuperstream->getStyleType(nIndex);
}
RTFParserState& RTFDocumentImpl::getDefaultState()
{
if (!m_pSuperstream)
return m_aDefaultState;
- else
- return m_pSuperstream->getDefaultState();
+
+ return m_pSuperstream->getDefaultState();
}
oox::GraphicHelper& RTFDocumentImpl::getGraphicHelper()
@@ -1011,7 +1008,7 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS
}
auto pAnchorWrapValue = std::make_shared<RTFValue>(aAnchorWrapAttributes);
aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_extent, pExtentValue);
- if (aAnchorWrapAttributes.size() && nWrap == -1)
+ if (!aAnchorWrapAttributes.empty() && nWrap == -1)
aAnchorSprms.set(NS_ooxml::LN_EG_WrapType_wrapSquare, pAnchorWrapValue);
// See OOXMLFastContextHandler::positionOffset(), we can't just put offset values in an RTFValue.
@@ -1495,14 +1492,14 @@ void RTFDocumentImpl::replayRowBuffer(
SAL_WARN_IF(BUFFER_CELLEND == std::get<0>(i),
"writerfilter.rtf", "dropping table cell!");
}
- assert(0 == rCellsSrpms.size());
- assert(0 == rCellsAttributes.size());
+ assert(rCellsSrpms.empty());
+ assert(rCellsAttributes.empty());
}
void RTFDocumentImpl::replayBuffer(RTFBuffer_t& rBuffer,
RTFSprms* const pSprms, RTFSprms const* const pAttributes)
{
- while (rBuffer.size())
+ while (!rBuffer.empty())
{
Buf_t aTuple(rBuffer.front());
rBuffer.pop_front();
@@ -2090,7 +2087,7 @@ RTFError RTFDocumentImpl::popState()
aState.aShape.aProperties.emplace_back(m_aStates.top().pDestinationText->makeStringAndClear(), OUString());
break;
case Destination::SHAPEPROPERTYVALUE:
- if (aState.aShape.aProperties.size())
+ if (!aState.aShape.aProperties.empty())
{
aState.aShape.aProperties.back().second = m_aStates.top().pDestinationText->makeStringAndClear();
if (m_aStates.top().bHadShapeText)
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index bd9658310e24..c2834268499e 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -481,22 +481,22 @@ private:
void sectBreak(bool bFinal = false);
void prepareProperties(
RTFParserState& rState,
- writerfilter::Reference<Properties>::Pointer_t&,
- writerfilter::Reference<Properties>::Pointer_t&,
- writerfilter::Reference<Properties>::Pointer_t&,
- int const nCells, int const nCurrentCellX);
+ writerfilter::Reference<Properties>::Pointer_t& o_rpParagraphProperties,
+ writerfilter::Reference<Properties>::Pointer_t& o_rpFrameProperties,
+ writerfilter::Reference<Properties>::Pointer_t& o_rpTableRowProperties,
+ int nCells, int nCurrentCellX);
/// Send the passed properties to dmapper.
void sendProperties(
- writerfilter::Reference<Properties>::Pointer_t const&,
- writerfilter::Reference<Properties>::Pointer_t const&,
- writerfilter::Reference<Properties>::Pointer_t const&);
+ writerfilter::Reference<Properties>::Pointer_t const& pParagraphProperties,
+ writerfilter::Reference<Properties>::Pointer_t const& pFrameProperties,
+ writerfilter::Reference<Properties>::Pointer_t const& pTableRowProperties);
void replayRowBuffer(RTFBuffer_t& rBuffer,
::std::deque<RTFSprms>& rCellsSrpms,
::std::deque<RTFSprms>& rCellsAttributes,
- int const nCells);
+ int nCells);
void replayBuffer(RTFBuffer_t& rBuffer,
- RTFSprms* const pSprms,
- RTFSprms const* const pAttributes);
+ RTFSprms* pSprms,
+ RTFSprms const* pAttributes);
/// If we have some unicode or hex characters to send.
void checkUnicode(bool bUnicode, bool bHex);
/// If we need a final section break at the end of the document.
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index ea9a800e35c0..d6e9ecdb5559 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -69,7 +69,7 @@ RTFSdrImport::~RTFSdrImport()
{
if (!m_aGraphicZOrderHelpers.empty())
m_aGraphicZOrderHelpers.pop();
- if (m_aParents.size())
+ if (!m_aParents.empty())
m_aParents.pop();
}
@@ -384,7 +384,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
{
continue; // ignore: already handled by initShape
}
- else if (rProperty.first == "wzName")
+ if (rProperty.first == "wzName")
{
if (m_bTextFrame)
{
@@ -838,7 +838,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
xPropertySet->setPropertyValue("TextWritingMode", uno::makeAny(eWritingMode));
}
- if (m_aParents.size() && m_aParents.top().is() && !m_bTextFrame)
+ if (!m_aParents.empty() && m_aParents.top().is() && !m_bTextFrame)
m_aParents.top()->add(xShape);
if (bPib)
diff --git a/writerfilter/source/rtftok/rtfsdrimport.hxx b/writerfilter/source/rtftok/rtfsdrimport.hxx
index a60ec73ce559..c854a961993d 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.hxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.hxx
@@ -62,7 +62,7 @@ private:
int initShape(css::uno::Reference<css::drawing::XShape>& o_xShape,
css::uno::Reference<css::beans::XPropertySet>& o_xPropSet,
bool& o_rIsCustomShape,
- RTFShape const& rShape, bool bClose, ShapeOrPict const shapeOrPict);
+ RTFShape const& rShape, bool bClose, ShapeOrPict shapeOrPict);
RTFDocumentImpl& m_rImport;
std::stack< css::uno::Reference<css::drawing::XShapes> > m_aParents;
diff --git a/writerfilter/source/rtftok/rtfsprm.cxx b/writerfilter/source/rtftok/rtfsprm.cxx
index bbf2eceef417..34293344240b 100644
--- a/writerfilter/source/rtftok/rtfsprm.cxx
+++ b/writerfilter/source/rtftok/rtfsprm.cxx
@@ -79,8 +79,8 @@ RTFValue::Pointer_t RTFSprms::find(Id nKeyword, bool bFirst, bool bForWrite)
{
if (bFirst)
return rSprm.second;
- else
- pValue = rSprm.second;
+
+ pValue = rSprm.second;
}
return pValue;
}
@@ -99,11 +99,9 @@ void RTFSprms::set(Id nKeyword, RTFValue::Pointer_t pValue, RTFOverwrite eOverwr
rSprm.second = pValue;
return;
}
- else
- {
- bFound = true;
- break;
- }
+
+ bFound = true;
+ break;
}
}
if (eOverwrite == RTFOverwrite::NO_APPEND || !bFound)
@@ -300,8 +298,8 @@ void RTFSprms::clear()
{
if (m_pSprms->m_nRefCount == 1)
return m_pSprms->clear();
- else
- m_pSprms.reset(new RTFSprmsImpl);
+
+ m_pSprms.reset(new RTFSprmsImpl);
}
} // namespace rtftok
diff --git a/writerfilter/source/rtftok/rtftokenizer.cxx b/writerfilter/source/rtftok/rtftokenizer.cxx
index 1b36289e4af0..3bd21353ef46 100644
--- a/writerfilter/source/rtftok/rtftokenizer.cxx
+++ b/writerfilter/source/rtftok/rtftokenizer.cxx
@@ -160,7 +160,7 @@ RTFError RTFTokenizer::resolveParse()
if (m_nGroup < 0)
return RTFError::GROUP_UNDER;
- else if (m_nGroup > 0)
+ if (m_nGroup > 0)
return RTFError::GROUP_OVER;
return RTFError::OK;
}
diff --git a/writerfilter/source/rtftok/rtfvalue.cxx b/writerfilter/source/rtftok/rtfvalue.cxx
index c8855f633e7e..555c51d30a16 100644
--- a/writerfilter/source/rtftok/rtfvalue.cxx
+++ b/writerfilter/source/rtftok/rtfvalue.cxx
@@ -136,8 +136,8 @@ OUString RTFValue::getString() const
{
if (!m_sValue.isEmpty() || m_bForceString)
return m_sValue;
- else
- return OUString::number(m_nValue);
+
+ return OUString::number(m_nValue);
}
void RTFValue::setString(const OUString& sValue)
@@ -186,8 +186,8 @@ std::string RTFValue::toString() const
{
if (!m_sValue.isEmpty() || m_bForceString)
return OUStringToOString(m_sValue, RTL_TEXTENCODING_UTF8).getStr();
- else
- return OString::number(m_nValue).getStr();
+
+ return OString::number(m_nValue).getStr();
}
#endif
@@ -209,11 +209,11 @@ bool RTFValue::equals(RTFValue& rOther)
return false;
if (m_pAttributes->size() != rOther.m_pAttributes->size())
return false;
- else if (!m_pAttributes->equals(rOther))
+ if (!m_pAttributes->equals(rOther))
return false;
if (m_pSprms->size() != rOther.m_pSprms->size())
return false;
- else if (!m_pSprms->equals(rOther))
+ if (!m_pSprms->equals(rOther))
return false;
return true;
}