[Libreoffice-commits] core.git: desktop/source sfx2/source starmath/source svl/source sw/source

Miklos Vajna vmiklos at collabora.co.uk
Wed Nov 30 10:44:15 UTC 2016


 desktop/source/lib/lokclipboard.cxx           |    2 +-
 sfx2/source/view/classificationcontroller.cxx |    2 +-
 starmath/source/rtfexport.cxx                 |    8 ++++----
 starmath/source/unofilter.cxx                 |    4 ++--
 starmath/source/wordexportbase.cxx            |    2 +-
 svl/source/items/grabbagitem.cxx              |    2 +-
 sw/source/core/doc/rdfhelper.cxx              |    2 +-
 sw/source/core/doc/textboxhelper.cxx          |   12 ++++++------
 sw/source/filter/ww8/docxsdrexport.cxx        |    4 ++--
 9 files changed, 19 insertions(+), 19 deletions(-)

New commits:
commit b18b1e80e9f3359fdfc06dc36dd4f0c15e9344af
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Nov 30 09:08:43 2016 +0100

    sw: use auto when initializing with a cast to avoid duplicating the type name
    
    Change-Id: Ide7bd0f1f444824b78aa53cfe1db0129cbca1a5d
    Reviewed-on: https://gerrit.libreoffice.org/31397
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/desktop/source/lib/lokclipboard.cxx b/desktop/source/lib/lokclipboard.cxx
index fa74fa0..deab34f 100644
--- a/desktop/source/lib/lokclipboard.cxx
+++ b/desktop/source/lib/lokclipboard.cxx
@@ -42,7 +42,7 @@ throw(datatransfer::UnsupportedFlavorException, io::IOException, uno::RuntimeExc
     uno::Any aRet;
     if (rFlavor.DataType == cppu::UnoType<OUString>::get())
     {
-        sal_Char* pText = reinterpret_cast<sal_Char*>(m_aSequence.getArray());
+        auto pText = reinterpret_cast<sal_Char*>(m_aSequence.getArray());
         aRet <<= OUString(pText, m_aSequence.getLength(), RTL_TEXTENCODING_UTF8);
     }
     else
diff --git a/sfx2/source/view/classificationcontroller.cxx b/sfx2/source/view/classificationcontroller.cxx
index 1b069cc..fd19278 100644
--- a/sfx2/source/view/classificationcontroller.cxx
+++ b/sfx2/source/view/classificationcontroller.cxx
@@ -154,7 +154,7 @@ void ClassificationCategoriesController::dispose() throw (uno::RuntimeException,
 uno::Reference<awt::XWindow> ClassificationCategoriesController::createItemWindow(const uno::Reference<awt::XWindow>& rParent) throw (uno::RuntimeException, std::exception)
 {
     VclPtr<vcl::Window> pParent = VCLUnoHelper::GetWindow(rParent);
-    ToolBox* pToolbar = dynamic_cast<ToolBox*>(pParent.get());
+    auto pToolbar = dynamic_cast<ToolBox*>(pParent.get());
     if (pToolbar)
     {
         m_pClassification = VclPtr<ClassificationControl>::Create(pToolbar);
diff --git a/starmath/source/rtfexport.cxx b/starmath/source/rtfexport.cxx
index b0e947d..9acd9d4 100644
--- a/starmath/source/rtfexport.cxx
+++ b/starmath/source/rtfexport.cxx
@@ -54,7 +54,7 @@ void SmRtfExport::HandleText(const SmNode* pNode, int /*nLevel*/)
     if (pNode->GetToken().eType == TTEXT)  // literal text
         m_pBuffer->append(LO_STRING_SVTOOLS_RTF_MNOR " ");
 
-    const SmTextNode* pTemp = static_cast<const SmTextNode*>(pNode);
+    auto pTemp = static_cast<const SmTextNode*>(pNode);
     SAL_INFO("starmath.rtf", "Text: " << pTemp->GetText());
     for (sal_Int32 i = 0; i < pTemp->GetText().getLength(); i++)
     {
@@ -180,7 +180,7 @@ namespace
 OString mathSymbolToString(const SmNode* node, rtl_TextEncoding nEncoding)
 {
     assert(node->GetType() == NMATH || node->GetType() == NMATHIDENT);
-    const SmTextNode* txtnode = static_cast<const SmTextNode*>(node);
+    auto txtnode = static_cast<const SmTextNode*>(node);
     if (txtnode->GetText().isEmpty())
         return OString();
     assert(txtnode->GetText().getLength() == 1);
@@ -405,7 +405,7 @@ void SmRtfExport::HandleBrace(const SmBraceNode* pNode, int nLevel)
     std::vector< const SmNode* > subnodes;
     if (pNode->Body()->GetType() == NBRACEBODY)
     {
-        const SmBracebodyNode* body = static_cast<const SmBracebodyNode*>(pNode->Body());
+        auto body = static_cast<const SmBracebodyNode*>(pNode->Body());
         bool separatorWritten = false; // assume all separators are the same
         for (int i = 0; i < body->GetNumSubNodes(); ++i)
         {
@@ -413,7 +413,7 @@ void SmRtfExport::HandleBrace(const SmBraceNode* pNode, int nLevel)
             if (subnode->GetType() == NMATH || subnode->GetType() == NMATHIDENT)
             {
                 // do not write, but write what separator it is
-                const SmMathSymbolNode* math = static_cast<const SmMathSymbolNode*>(subnode);
+                auto math = static_cast<const SmMathSymbolNode*>(subnode);
                 if (!separatorWritten)
                 {
                     m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_MSEPCHR " ");
diff --git a/starmath/source/unofilter.cxx b/starmath/source/unofilter.cxx
index 95fc3e8..d24d0b2 100644
--- a/starmath/source/unofilter.cxx
+++ b/starmath/source/unofilter.cxx
@@ -67,9 +67,9 @@ sal_Bool MathTypeFilter::filter(const uno::Sequence<beans::PropertyValue>& rDesc
                 // Is this a MathType Storage?
                 if (aStorage->IsStream("Equation Native"))
                 {
-                    if (SmModel* pModel = dynamic_cast<SmModel*>(m_xDstDoc.get()))
+                    if (auto pModel = dynamic_cast<SmModel*>(m_xDstDoc.get()))
                     {
-                        SmDocShell* pDocShell = static_cast<SmDocShell*>(pModel->GetObjectShell());
+                        auto pDocShell = static_cast<SmDocShell*>(pModel->GetObjectShell());
                         OUString aText = pDocShell->GetText();
                         MathType aEquation(aText);
                         bSuccess = aEquation.Parse(aStorage.get());
diff --git a/starmath/source/wordexportbase.cxx b/starmath/source/wordexportbase.cxx
index 61c1d97..a5136a7 100644
--- a/starmath/source/wordexportbase.cxx
+++ b/starmath/source/wordexportbase.cxx
@@ -51,7 +51,7 @@ void SmWordExportBase::HandleNode(const SmNode* pNode, int nLevel)
         break;
     case NSPECIAL:
     {
-        const SmTextNode* pText= static_cast< const SmTextNode* >(pNode);
+        auto pText= static_cast<const SmTextNode*>(pNode);
         //if the token str and the result text are the same then this
         //is to be seen as text, else assume it's a mathchar
         if (pText->GetText() == pText->GetToken().aText)
diff --git a/svl/source/items/grabbagitem.cxx b/svl/source/items/grabbagitem.cxx
index 082c422..6d69fcd 100644
--- a/svl/source/items/grabbagitem.cxx
+++ b/svl/source/items/grabbagitem.cxx
@@ -28,7 +28,7 @@ SfxGrabBagItem::~SfxGrabBagItem() = default;
 
 bool SfxGrabBagItem::operator==(const SfxPoolItem& rItem) const
 {
-    const SfxGrabBagItem* pItem = static_cast<const SfxGrabBagItem*>(&rItem);
+    auto pItem = static_cast<const SfxGrabBagItem*>(&rItem);
 
     return m_aMap == pItem->m_aMap;
 }
diff --git a/sw/source/core/doc/rdfhelper.cxx b/sw/source/core/doc/rdfhelper.cxx
index 7f93813..a139dfc 100644
--- a/sw/source/core/doc/rdfhelper.cxx
+++ b/sw/source/core/doc/rdfhelper.cxx
@@ -28,7 +28,7 @@ std::map<OUString, OUString> SwRDFHelper::getTextNodeStatements(const OUString&
     std::map<OUString, OUString> aRet;
 
     // We only read the node, but CreateXParagraph() needs a non-cost one.
-    SwTextNode& rTextNode = const_cast<SwTextNode&>(rNode);
+    auto& rTextNode = const_cast<SwTextNode&>(rNode);
 
     uno::Reference<uno::XComponentContext> xComponentContext(comphelper::getProcessComponentContext());
     uno::Reference<rdf::XURI> xType = rdf::URI::create(xComponentContext, rType);
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index bfa3d3a..3bf4a6a 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -59,7 +59,7 @@ void SwTextBoxHelper::create(SwFrameFormat* pShape)
 
         // Link FLY and DRAW formats, so it becomes a text box (needed for syncProperty calls).
         uno::Reference<text::XTextFrame> xRealTextFrame(xTextFrame, uno::UNO_QUERY);
-        SwXTextFrame* pTextFrame = dynamic_cast<SwXTextFrame*>(xRealTextFrame.get());
+        auto pTextFrame = dynamic_cast<SwXTextFrame*>(xRealTextFrame.get());
         assert(nullptr != pTextFrame);
         SwFrameFormat* pFormat = pTextFrame->GetFrameFormat();
 
@@ -151,7 +151,7 @@ bool SwTextBoxHelper::isTextBox(const SwFrameFormat* pShape, sal_uInt16 nType)
 
 bool SwTextBoxHelper::isTextBox(const SdrObject* pObject)
 {
-    const SwVirtFlyDrawObj* pVirtFlyDrawObj = dynamic_cast<const SwVirtFlyDrawObj*>(pObject);
+    auto pVirtFlyDrawObj = dynamic_cast<const SwVirtFlyDrawObj*>(pObject);
     if (!pVirtFlyDrawObj)
         return false;
     return isTextBox(pVirtFlyDrawObj->GetFormat(), RES_FLYFRMFMT);
@@ -241,7 +241,7 @@ SwFrameFormat* SwTextBoxHelper::getOtherTextBoxFormat(const SwFrameFormat* pForm
 
 SwFrameFormat* SwTextBoxHelper::getOtherTextBoxFormat(uno::Reference<drawing::XShape> const& xShape)
 {
-    SwXShape* pShape = dynamic_cast<SwXShape*>(xShape.get());
+    auto pShape = dynamic_cast<SwXShape*>(xShape.get());
     if (!pShape)
         return nullptr;
 
@@ -286,7 +286,7 @@ Rectangle SwTextBoxHelper::getTextRectangle(SwFrameFormat* pShape, bool bAbsolut
 {
     Rectangle aRet;
     aRet.SetEmpty();
-    SdrObjCustomShape* pCustomShape = dynamic_cast<SdrObjCustomShape*>(pShape->FindRealSdrObject());
+    auto pCustomShape = dynamic_cast<SdrObjCustomShape*>(pShape->FindRealSdrObject());
     if (pCustomShape)
     {
         // Need to temporarily release the lock acquired in
@@ -608,7 +608,7 @@ void SwTextBoxHelper::syncFlyFrameAttr(SwFrameFormat& rShape, SfxItemSet& rSet)
             {
             case RES_VERT_ORIENT:
             {
-                const SwFormatVertOrient& rOrient = static_cast<const SwFormatVertOrient&>(*aIter.GetCurItem());
+                auto& rOrient = static_cast<const SwFormatVertOrient&>(*aIter.GetCurItem());
                 SwFormatVertOrient aOrient(rOrient);
 
                 Rectangle aRect = getTextRectangle(&rShape, /*bAbsolute=*/false);
@@ -628,7 +628,7 @@ void SwTextBoxHelper::syncFlyFrameAttr(SwFrameFormat& rShape, SfxItemSet& rSet)
             break;
             case RES_HORI_ORIENT:
             {
-                const SwFormatHoriOrient& rOrient = static_cast<const SwFormatHoriOrient&>(*aIter.GetCurItem());
+                auto& rOrient = static_cast<const SwFormatHoriOrient&>(*aIter.GetCurItem());
                 SwFormatHoriOrient aOrient(rOrient);
 
                 Rectangle aRect = getTextRectangle(&rShape, /*bAbsolute=*/false);
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index 5af66a1..b407082 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -950,7 +950,7 @@ void DocxSdrExport::writeDMLAndVMLDrawing(const SdrObject* sdrObj, const SwFrame
     {
         m_pImpl->m_pSerializer->startElementNS(XML_mc, XML_AlternateContent, FSEND);
 
-        const SdrObjGroup* pObjGroup = dynamic_cast<const SdrObjGroup*>(sdrObj);
+        auto pObjGroup = dynamic_cast<const SdrObjGroup*>(sdrObj);
         m_pImpl->m_pSerializer->startElementNS(XML_mc, XML_Choice,
                                                XML_Requires, (pObjGroup ? "wpg" : "wps"),
                                                FSEND);
@@ -1769,7 +1769,7 @@ bool DocxSdrExport::Impl::checkFrameBtlr(SwNode* pStartNode, bool bDML)
 
     if (bItemSet)
     {
-        const SvxCharRotateItem& rCharRotate = static_cast<const SvxCharRotateItem&>(*pItem);
+        auto& rCharRotate = static_cast<const SvxCharRotateItem&>(*pItem);
         if (rCharRotate.GetValue() == 900)
         {
             if (bDML)


More information about the Libreoffice-commits mailing list