[Libreoffice-commits] core.git: sw/source writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Tue Dec 20 09:43:20 UTC 2016


 sw/source/filter/ww8/rtfexportfilter.cxx              |    2 +-
 sw/source/filter/ww8/rtfsdrexport.cxx                 |    4 ++--
 writerfilter/source/dmapper/SmartTagHandler.cxx       |    2 +-
 writerfilter/source/dmapper/TablePositionHandler.cxx  |    2 --
 writerfilter/source/filter/WriterFilterDetection.cxx  |    4 +---
 writerfilter/source/rtftok/rtfdispatchdestination.cxx |    3 +--
 writerfilter/source/rtftok/rtfdispatchflag.cxx        |    6 +++---
 writerfilter/source/rtftok/rtfdispatchsymbol.cxx      |   10 +++++-----
 8 files changed, 14 insertions(+), 19 deletions(-)

New commits:
commit 51b6a7c87ba27e181fb3634e96296b7307a8281f
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Dec 20 09:09:53 2016 +0100

    writerfilter: various small cleanups
    
    Change-Id: I258a03909e2a166b8f1c077cf758974a06ad3403
    Reviewed-on: https://gerrit.libreoffice.org/32215
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/sw/source/filter/ww8/rtfexportfilter.cxx b/sw/source/filter/ww8/rtfexportfilter.cxx
index 8170723..f09a8c5 100644
--- a/sw/source/filter/ww8/rtfexportfilter.cxx
+++ b/sw/source/filter/ww8/rtfexportfilter.cxx
@@ -47,7 +47,7 @@ sal_Bool RtfExportFilter::filter(const uno::Sequence< beans::PropertyValue >& aD
 
     // get SwDoc*
     uno::Reference< uno::XInterface > xIfc(m_xSrcDoc, uno::UNO_QUERY);
-    SwXTextDocument* pTextDoc = dynamic_cast< SwXTextDocument* >(xIfc.get());
+    auto pTextDoc = dynamic_cast<SwXTextDocument*>(xIfc.get());
     if (!pTextDoc)
     {
         return false;
diff --git a/sw/source/filter/ww8/rtfsdrexport.cxx b/sw/source/filter/ww8/rtfsdrexport.cxx
index 848457b..838591a 100644
--- a/sw/source/filter/ww8/rtfsdrexport.cxx
+++ b/sw/source/filter/ww8/rtfsdrexport.cxx
@@ -471,7 +471,7 @@ void RtfSdrExport::impl_writeGraphic()
     (void)GraphicConverter::Export(aStream, aGraphic, ConvertDataFormat::PNG);
     aStream.Seek(STREAM_SEEK_TO_END);
     sal_uInt32 nSize = aStream.Tell();
-    const sal_uInt8* pGraphicAry = static_cast<sal_uInt8 const*>(aStream.GetData());
+    auto pGraphicAry = static_cast<sal_uInt8 const*>(aStream.GetData());
 
     Size aMapped(aGraphic.GetPrefSize());
 
@@ -531,7 +531,7 @@ sal_Int32 RtfSdrExport::StartShape()
         }
     }
 
-    const SdrTextObj* pTextObj = dynamic_cast<const SdrTextObj*>(m_pSdrObject);
+    auto pTextObj = dynamic_cast<const SdrTextObj*>(m_pSdrObject);
     if (pTextObj)
     {
         const OutlinerParaObject* pParaObj = nullptr;
diff --git a/writerfilter/source/dmapper/SmartTagHandler.cxx b/writerfilter/source/dmapper/SmartTagHandler.cxx
index d4bff8c..4b1b308 100644
--- a/writerfilter/source/dmapper/SmartTagHandler.cxx
+++ b/writerfilter/source/dmapper/SmartTagHandler.cxx
@@ -68,7 +68,7 @@ void SmartTagHandler::lcl_sprm(Sprm& rSprm)
     case NS_ooxml::LN_CT_SmartTagPr_attr:
     {
         writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
-        if (pProperties.get())
+        if (pProperties)
             pProperties->resolve(*this);
         break;
     }
diff --git a/writerfilter/source/dmapper/TablePositionHandler.cxx b/writerfilter/source/dmapper/TablePositionHandler.cxx
index 4182c4f..4536ac6 100644
--- a/writerfilter/source/dmapper/TablePositionHandler.cxx
+++ b/writerfilter/source/dmapper/TablePositionHandler.cxx
@@ -24,9 +24,7 @@ using namespace ::com::sun::star;
 TablePositionHandler::TablePositionHandler() :
     LoggedProperties("TablePositionHandler"),
     m_aVertAnchor("margin"),
-    m_aYSpec(),
     m_aHorzAnchor("text"),
-    m_aXSpec(),
     m_nY(0),
     m_nX(0),
     m_nLeftFromText(0),
diff --git a/writerfilter/source/filter/WriterFilterDetection.cxx b/writerfilter/source/filter/WriterFilterDetection.cxx
index f72323b..dccd823 100644
--- a/writerfilter/source/filter/WriterFilterDetection.cxx
+++ b/writerfilter/source/filter/WriterFilterDetection.cxx
@@ -47,9 +47,7 @@ public:
 
 uno::Sequence<OUString> SAL_CALL WriterFilterDetection_getSupportedServiceNames() throw (uno::RuntimeException);
 
-WriterFilterDetection::WriterFilterDetection()
-{
-}
+WriterFilterDetection::WriterFilterDetection() = default;
 
 OUString WriterFilterDetection::detect(uno::Sequence<beans::PropertyValue>& rDescriptor) throw (uno::RuntimeException, std::exception)
 {
diff --git a/writerfilter/source/rtftok/rtfdispatchdestination.cxx b/writerfilter/source/rtftok/rtfdispatchdestination.cxx
index 75d7019..0c44e25 100644
--- a/writerfilter/source/rtftok/rtfdispatchdestination.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchdestination.cxx
@@ -332,9 +332,8 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
         case RTF_DPTXBXTEXT:
         {
             bool bPictureFrame = false;
-            for (std::size_t i = 0; i < m_aStates.top().aShape.aProperties.size(); ++i)
+            for (auto& rProperty : m_aStates.top().aShape.aProperties)
             {
-                std::pair<OUString, OUString>& rProperty = m_aStates.top().aShape.aProperties[i];
                 if (rProperty.first == "shapeType" && rProperty.second == OUString::number(ESCHER_ShpInst_PictureFrame))
                 {
                     bPictureFrame = true;
diff --git a/writerfilter/source/rtftok/rtfdispatchflag.cxx b/writerfilter/source/rtftok/rtfdispatchflag.cxx
index b99876e..aa3c41c 100644
--- a/writerfilter/source/rtftok/rtfdispatchflag.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchflag.cxx
@@ -889,10 +889,10 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
         {
             m_aStates.top().aDrawingObject.xShape.set(getModelFactory()->createInstance("com.sun.star.text.TextFrame"), uno::UNO_QUERY);
             std::vector<beans::PropertyValue> aDefaults = RTFSdrImport::getTextFrameDefaults(false);
-            for (std::size_t i = 0; i < aDefaults.size(); ++i)
+            for (const auto& rDefault : aDefaults)
             {
-                if (!findPropertyName(m_aStates.top().aDrawingObject.aPendingProperties, aDefaults[i].Name))
-                    m_aStates.top().aDrawingObject.aPendingProperties.push_back(aDefaults[i]);
+                if (!findPropertyName(m_aStates.top().aDrawingObject.aPendingProperties, rDefault.Name))
+                    m_aStates.top().aDrawingObject.aPendingProperties.push_back(rDefault);
             }
             checkFirstRun();
             Mapper().startShape(m_aStates.top().aDrawingObject.xShape);
diff --git a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx
index 6905f1c..c85f957 100644
--- a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx
@@ -178,13 +178,13 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
         {
             // There were no runs in the cell, so we need to send paragraph and character properties here.
             auto pPValue = std::make_shared<RTFValue>(m_aStates.top().aParagraphAttributes, m_aStates.top().aParagraphSprms);
-            m_aTableBufferStack.back().push_back(Buf_t(BUFFER_PROPS, pPValue, nullptr));
+            m_aTableBufferStack.back().emplace_back(Buf_t(BUFFER_PROPS, pPValue, nullptr));
             auto pCValue = std::make_shared<RTFValue>(m_aStates.top().aCharacterAttributes, m_aStates.top().aCharacterSprms);
-            m_aTableBufferStack.back().push_back(Buf_t(BUFFER_PROPS, pCValue, nullptr));
+            m_aTableBufferStack.back().emplace_back(Buf_t(BUFFER_PROPS, pCValue, nullptr));
         }
 
         RTFValue::Pointer_t pValue;
-        m_aTableBufferStack.back().push_back(Buf_t(BUFFER_CELLEND, pValue, nullptr));
+        m_aTableBufferStack.back().emplace_back(Buf_t(BUFFER_CELLEND, pValue, nullptr));
         m_bNeedPap = true;
     }
     break;
@@ -218,7 +218,7 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
             }
         }
         m_aTableBufferStack.pop_back();
-        m_aTableBufferStack.back().push_back(
+        m_aTableBufferStack.back().emplace_back(
             Buf_t(BUFFER_NESTROW, RTFValue::Pointer_t(), pBuffer));
 
         m_aNestedTableCellsSprms.clear();
@@ -322,7 +322,7 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
     {
         bool bColumns = false; // If we have multiple columns
         RTFValue::Pointer_t pCols = m_aStates.top().aSectionSprms.find(NS_ooxml::LN_EG_SectPrContents_cols);
-        if (pCols.get())
+        if (pCols)
         {
             RTFValue::Pointer_t pNum = pCols->getAttributes().find(NS_ooxml::LN_CT_Columns_num);
             if (pNum.get() && pNum->getInt() > 1)


More information about the Libreoffice-commits mailing list