[Libreoffice-commits] core.git: 3 commits - include/svx include/xmloff svx/source sw/inc sw/source xmloff/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Fri Aug 23 17:36:54 UTC 2019


 include/svx/framelink.hxx                           |    6 +++---
 include/svx/svdobj.hxx                              |    2 ++
 include/svx/svdoedge.hxx                            |    2 ++
 include/svx/svdovirt.hxx                            |    2 +-
 include/svx/txenctab.hxx                            |    2 +-
 include/svx/unoshape.hxx                            |    2 +-
 include/xmloff/xmlcnimp.hxx                         |    4 ++--
 include/xmloff/xmlimp.hxx                           |    8 ++++----
 svx/source/accessibility/AccessibleControlShape.cxx |    2 +-
 svx/source/dialog/txenctab.cxx                      |    2 +-
 svx/source/fmcomp/fmgridif.cxx                      |   12 +-----------
 svx/source/svdraw/svdovirt.cxx                      |    2 +-
 svx/source/svdraw/svdpage.cxx                       |   10 +++++-----
 svx/source/unodraw/unoshap4.cxx                     |    2 +-
 sw/inc/dcontact.hxx                                 |    2 +-
 sw/source/core/draw/dcontact.cxx                    |    2 +-
 xmloff/source/core/SvXMLAttrCollection.cxx          |    4 ++--
 xmloff/source/core/SvXMLAttrCollection.hxx          |    4 ++--
 xmloff/source/core/xmlcnimp.cxx                     |    4 ++--
 xmloff/source/core/xmlimp.cxx                       |    8 ++++----
 xmloff/source/text/txtflde.cxx                      |   12 ++++++------
 21 files changed, 44 insertions(+), 50 deletions(-)

New commits:
commit bc50aa40f9ad790c7a9afc1dd9059ac0755be3fe
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Aug 23 16:41:17 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Aug 23 19:35:46 2019 +0200

    loplugin:returnconstval in xmloff
    
    Change-Id: I200080ff1c44544fdb8211e58228fd62465f3732
    Reviewed-on: https://gerrit.libreoffice.org/78020
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/xmloff/xmlcnimp.hxx b/include/xmloff/xmlcnimp.hxx
index 338a48f753ac..c987e9943138 100644
--- a/include/xmloff/xmlcnimp.hxx
+++ b/include/xmloff/xmlcnimp.hxx
@@ -47,8 +47,8 @@ public:
                   const OUString& rValue );
 
     size_t GetAttrCount() const;
-    const OUString GetAttrNamespace( size_t i ) const;
-    const OUString GetAttrPrefix( size_t i ) const;
+    OUString GetAttrNamespace( size_t i ) const;
+    OUString GetAttrPrefix( size_t i ) const;
     const OUString& GetAttrLName( size_t i ) const;
     const OUString& GetAttrValue( size_t i ) const;
 
diff --git a/include/xmloff/xmlimp.hxx b/include/xmloff/xmlimp.hxx
index 33ab9dab9d68..9713f720f08a 100644
--- a/include/xmloff/xmlimp.hxx
+++ b/include/xmloff/xmlimp.hxx
@@ -376,10 +376,10 @@ public:
     // get import helper for events
     XMLEventImportHelper& GetEventImport();
 
-    static const OUString getNameFromToken( sal_Int32 nToken );
-    static const OUString getNamespacePrefixFromToken(sal_Int32 nToken, const SvXMLNamespaceMap* pMap);
-    static const OUString getNamespaceURIFromToken( sal_Int32 nToken );
-    static const OUString getNamespacePrefixFromURI( const OUString& rURI );
+    static OUString getNameFromToken( sal_Int32 nToken );
+    static OUString getNamespacePrefixFromToken(sal_Int32 nToken, const SvXMLNamespaceMap* pMap);
+    static OUString getNamespaceURIFromToken( sal_Int32 nToken );
+    static OUString getNamespacePrefixFromURI( const OUString& rURI );
 
     SvXMLNamespaceMap& GetNamespaceMap() { return *mpNamespaceMap; }
     const SvXMLNamespaceMap& GetNamespaceMap() const { return *mpNamespaceMap; }
diff --git a/xmloff/source/core/SvXMLAttrCollection.cxx b/xmloff/source/core/SvXMLAttrCollection.cxx
index fd79079a7a40..7217aee6393d 100644
--- a/xmloff/source/core/SvXMLAttrCollection.cxx
+++ b/xmloff/source/core/SvXMLAttrCollection.cxx
@@ -130,7 +130,7 @@ const OUString& SvXMLAttrCollection::GetAttrValue(size_t i) const
     return aAttrs[i].getValue();
 }
 
-const OUString SvXMLAttrCollection::GetAttrNamespace( size_t i ) const
+OUString SvXMLAttrCollection::GetAttrNamespace( size_t i ) const
 {
     OUString sRet;
     sal_uInt16 nPos = GetPrefixPos( i );
@@ -140,7 +140,7 @@ const OUString SvXMLAttrCollection::GetAttrNamespace( size_t i ) const
     return sRet;
 }
 
-const OUString SvXMLAttrCollection::GetAttrPrefix( size_t i ) const
+OUString SvXMLAttrCollection::GetAttrPrefix( size_t i ) const
 {
     OUString sRet;
     sal_uInt16 nPos = GetPrefixPos( i );
diff --git a/xmloff/source/core/SvXMLAttrCollection.hxx b/xmloff/source/core/SvXMLAttrCollection.hxx
index feed18820a26..e029491ce182 100644
--- a/xmloff/source/core/SvXMLAttrCollection.hxx
+++ b/xmloff/source/core/SvXMLAttrCollection.hxx
@@ -52,8 +52,8 @@ public:
     size_t GetAttrCount() const;
     const OUString& GetAttrLName(size_t i) const;
     const OUString& GetAttrValue(size_t i) const;
-    const OUString GetAttrNamespace( size_t i ) const;
-    const OUString GetAttrPrefix( size_t i ) const;
+    OUString GetAttrNamespace( size_t i ) const;
+    OUString GetAttrPrefix( size_t i ) const;
     const OUString& GetNamespace( sal_uInt16 i ) const;
     const OUString& GetPrefix( sal_uInt16 i ) const;
     sal_uInt16 GetFirstNamespaceIndex() const;
diff --git a/xmloff/source/core/xmlcnimp.cxx b/xmloff/source/core/xmlcnimp.cxx
index ce5e9968c24f..f9cc065320a6 100644
--- a/xmloff/source/core/xmlcnimp.cxx
+++ b/xmloff/source/core/xmlcnimp.cxx
@@ -106,12 +106,12 @@ const OUString& SvXMLAttrContainerData::GetAttrValue(size_t i) const
     return pimpl->GetAttrValue(i);
 }
 
-const OUString SvXMLAttrContainerData::GetAttrNamespace( size_t i ) const
+OUString SvXMLAttrContainerData::GetAttrNamespace( size_t i ) const
 {
     return pimpl->GetAttrNamespace(i);
 }
 
-const OUString SvXMLAttrContainerData::GetAttrPrefix( size_t i ) const
+OUString SvXMLAttrContainerData::GetAttrPrefix( size_t i ) const
 {
     return pimpl->GetAttrPrefix(i);
 }
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index 8964eed35002..1d22fd34449b 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -2012,14 +2012,14 @@ bool SvXMLImport::embeddedFontAlreadyProcessed( const OUString& url )
     return false;
 }
 
-const OUString SvXMLImport::getNameFromToken( sal_Int32 nToken )
+OUString SvXMLImport::getNameFromToken( sal_Int32 nToken )
 {
     uno::Sequence< sal_Int8 > aSeq = xTokenHandler->getUTF8Identifier( nToken & TOKEN_MASK );
     return OUString( reinterpret_cast< const char* >(
                     aSeq.getConstArray() ), aSeq.getLength(), RTL_TEXTENCODING_UTF8 );
 }
 
-const OUString SvXMLImport::getNamespacePrefixFromToken(sal_Int32 nToken, const SvXMLNamespaceMap* pMap)
+OUString SvXMLImport::getNamespacePrefixFromToken(sal_Int32 nToken, const SvXMLNamespaceMap* pMap)
 {
     sal_Int32 nNamespaceToken = ( nToken & NMSP_MASK ) >> NMSP_SHIFT;
     auto aIter( aNamespaceMap.find( nNamespaceToken ) );
@@ -2037,7 +2037,7 @@ const OUString SvXMLImport::getNamespacePrefixFromToken(sal_Int32 nToken, const
         return OUString();
 }
 
-const OUString SvXMLImport::getNamespaceURIFromToken( sal_Int32 nToken )
+OUString SvXMLImport::getNamespaceURIFromToken( sal_Int32 nToken )
 {
     sal_Int32 nNamespaceToken = ( nToken & NMSP_MASK ) >> NMSP_SHIFT;
     auto aIter( aNamespaceMap.find( nNamespaceToken ) );
@@ -2047,7 +2047,7 @@ const OUString SvXMLImport::getNamespaceURIFromToken( sal_Int32 nToken )
         return OUString();
 }
 
-const OUString SvXMLImport::getNamespacePrefixFromURI( const OUString& rURI )
+OUString SvXMLImport::getNamespacePrefixFromURI( const OUString& rURI )
 {
     auto aIter( aNamespaceURIPrefixMap.find(rURI) );
     if( aIter != aNamespaceURIPrefixMap.end() )
diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx
index 19d7ed74cad9..67c4e8db7a31 100644
--- a/xmloff/source/text/txtflde.cxx
+++ b/xmloff/source/text/txtflde.cxx
@@ -283,7 +283,7 @@ static bool GetOptionalBoolProperty(const OUString&,
                                               bool bDefault);
 static double GetDoubleProperty(const OUString&,
                                       const Reference<XPropertySet> &);
-static OUString const GetStringProperty(const OUString&,
+static OUString GetStringProperty(const OUString&,
                                         const Reference<XPropertySet> &);
 static sal_Int32 GetIntProperty(const OUString&,
                                       const Reference<XPropertySet> &);
@@ -291,9 +291,9 @@ static sal_Int16 GetInt16Property(const OUString&,
                                         const Reference<XPropertySet> &);
 static sal_Int8 GetInt8Property(const OUString&,
                                       const Reference<XPropertySet> &);
-static util::DateTime const GetDateTimeProperty( const OUString& sPropName,
+static util::DateTime GetDateTimeProperty( const OUString& sPropName,
                                            const Reference<XPropertySet> & xPropSet);
-static Sequence<OUString> const GetStringSequenceProperty(
+static Sequence<OUString> GetStringSequenceProperty(
                                    const OUString& sPropName,
                                    const Reference<XPropertySet> & xPropSet);
 
@@ -3504,7 +3504,7 @@ double GetDoubleProperty(
     return fDouble;
 }
 
-OUString const GetStringProperty(
+OUString GetStringProperty(
     const OUString& sPropName,
     const Reference<XPropertySet> & xPropSet)
 {
@@ -3544,7 +3544,7 @@ sal_Int8 GetInt8Property(
     return nInt;
 }
 
-util::DateTime const GetDateTimeProperty(
+util::DateTime GetDateTimeProperty(
     const OUString& sPropName,
     const Reference<XPropertySet> & xPropSet)
 {
@@ -3554,7 +3554,7 @@ util::DateTime const GetDateTimeProperty(
     return aTime;
 }
 
-Sequence<OUString> const GetStringSequenceProperty(
+Sequence<OUString> GetStringSequenceProperty(
     const OUString& sPropName,
     const Reference<XPropertySet> & xPropSet)
 {
commit 79e1d1353b4bed9a120c44b3a0436d4b041c30f7
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Aug 23 16:06:22 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Aug 23 19:35:35 2019 +0200

    tdf#119388 use virtual to bypass dynamic_cast
    
    in SdrObjList::ReformatAllEdgeObjects, shaves 10% of the time off
    
    Change-Id: Iceee362d0e3326d046f1ef5039457941160cee4f
    Reviewed-on: https://gerrit.libreoffice.org/78019
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx
index 0b1e5c3a832b..2d3dd91f90c0 100644
--- a/include/svx/svdobj.hxx
+++ b/include/svx/svdobj.hxx
@@ -911,6 +911,8 @@ public:
 
     void setSuitableOutlinerBg(Outliner& rOutliner) const;
 
+    virtual bool IsSdrEdgeObj() const { return false; }
+
 protected:
     tools::Rectangle            aOutRect;     // surrounding rectangle for Paint (incl. LineWidth, ...)
     Point                       aAnchor;      // anchor position (Writer)
diff --git a/include/svx/svdoedge.hxx b/include/svx/svdoedge.hxx
index 16127d914ec8..f2b707f7fbe2 100644
--- a/include/svx/svdoedge.hxx
+++ b/include/svx/svdoedge.hxx
@@ -168,6 +168,8 @@ public:
     void SetSuppressDefaultConnect(bool bNew) { mbSuppressDefaultConnect = bNew; }
     bool GetSuppressDefaultConnect() const { return mbSuppressDefaultConnect; }
 
+    virtual bool IsSdrEdgeObj() const override { return true; }
+
 protected:
     virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
 
diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx
index 77941e810db9..0d38249b2d04 100644
--- a/svx/source/svdraw/svdpage.cxx
+++ b/svx/source/svdraw/svdpage.cxx
@@ -612,12 +612,12 @@ void SdrObjList::ReformatAllEdgeObjects()
 
     while(aIter.IsMore())
     {
-        SdrEdgeObj* pSdrEdgeObj = dynamic_cast< SdrEdgeObj* >(aIter.Next());
+        SdrObject* pObj = aIter.Next();
+        if (!pObj->IsSdrEdgeObj())
+            continue;
 
-        if(pSdrEdgeObj)
-        {
-            pSdrEdgeObj->Reformat();
-        }
+        SdrEdgeObj* pSdrEdgeObj = static_cast< SdrEdgeObj* >(pObj);
+        pSdrEdgeObj->Reformat();
     }
 }
 
commit b23b1295af584162f95c1559a3d8f8bbe4824413
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Aug 23 16:10:25 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Aug 23 19:35:04 2019 +0200

    loplugin:returnconstval in svx
    
    Change-Id: I501c341962e1d7e31f1466527b6e80f2294d79ed
    Reviewed-on: https://gerrit.libreoffice.org/78017
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/svx/framelink.hxx b/include/svx/framelink.hxx
index fbcf1a5d1277..4c662700bec6 100644
--- a/include/svx/framelink.hxx
+++ b/include/svx/framelink.hxx
@@ -150,9 +150,9 @@ public:
     explicit Style( const editeng::SvxBorderLine* pBorder, double fScale );
 
     RefMode GetRefMode() const { if(!maImplStyle) return RefMode::Centered; return maImplStyle->meRefMode; }
-    const Color GetColorPrim() const { if(!maImplStyle) return Color(); return maImplStyle->maColorPrim; }
-    const Color GetColorSecn() const { if(!maImplStyle) return Color(); return maImplStyle->maColorSecn; }
-    const Color GetColorGap() const { if(!maImplStyle) return Color(); return maImplStyle->maColorGap; }
+    Color GetColorPrim() const { if(!maImplStyle) return Color(); return maImplStyle->maColorPrim; }
+    Color GetColorSecn() const { if(!maImplStyle) return Color(); return maImplStyle->maColorSecn; }
+    Color GetColorGap() const { if(!maImplStyle) return Color(); return maImplStyle->maColorGap; }
     bool UseGapColor() const { if(!maImplStyle) return false; return maImplStyle->mbUseGapColor; }
     double Prim() const { if(!maImplStyle) return 0.0; return maImplStyle->mfPrim; }
     double Dist() const { if(!maImplStyle) return 0.0; return maImplStyle->mfDist; }
diff --git a/include/svx/svdovirt.hxx b/include/svx/svdovirt.hxx
index 7882d8db17d9..323cce9f18ba 100644
--- a/include/svx/svdovirt.hxx
+++ b/include/svx/svdovirt.hxx
@@ -142,7 +142,7 @@ public:
     virtual bool DoMacro (const SdrObjMacroHitRec& rRec) override;
 
     // #i73248# for default SdrVirtObj, offset is aAnchor, not (0,0)
-    virtual const Point GetOffset() const;
+    virtual Point GetOffset() const;
 };
 
 #endif // INCLUDED_SVX_SVDOVIRT_HXX
diff --git a/include/svx/txenctab.hxx b/include/svx/txenctab.hxx
index 74a72372c896..cb9b7f0db0ad 100644
--- a/include/svx/txenctab.hxx
+++ b/include/svx/txenctab.hxx
@@ -27,7 +27,7 @@
 class SVX_DLLPUBLIC SvxTextEncodingTable
 {
 public:
-    static const OUString GetTextString(const rtl_TextEncoding nEnc);
+    static OUString GetTextString(const rtl_TextEncoding nEnc);
     static rtl_TextEncoding GetTextEncoding(const OUString& rStr);
 };
 
diff --git a/include/svx/unoshape.hxx b/include/svx/unoshape.hxx
index 8d522b3bcab7..062fd5eb6b1b 100644
--- a/include/svx/unoshape.hxx
+++ b/include/svx/unoshape.hxx
@@ -588,7 +588,7 @@ protected:
 
     void resetModifiedState();
 
-    const SvGlobalName GetClassName_Impl(OUString& rHexCLSID);
+    SvGlobalName GetClassName_Impl(OUString& rHexCLSID);
 public:
     SvxOle2Shape(SdrObject* pObj);
     SvxOle2Shape(SdrObject* pObject, const SfxItemPropertyMapEntry* pPropertyMap, const SvxItemPropertySet* pPropertySet);
diff --git a/svx/source/accessibility/AccessibleControlShape.cxx b/svx/source/accessibility/AccessibleControlShape.cxx
index a287b6cf964d..165d0b24dc27 100644
--- a/svx/source/accessibility/AccessibleControlShape.cxx
+++ b/svx/source/accessibility/AccessibleControlShape.cxx
@@ -82,7 +82,7 @@ namespace
         return "LabelControl";
     }
     // return the property which should be used as AccessibleName
-    const OUString lcl_getPreferredAccNameProperty( const Reference< XPropertySetInfo >& _rxPSI )
+    OUString lcl_getPreferredAccNameProperty( const Reference< XPropertySetInfo >& _rxPSI )
     {
         if ( _rxPSI.is() && _rxPSI->hasPropertyByName( lcl_getLabelPropertyName() ) )
             return lcl_getLabelPropertyName();
diff --git a/svx/source/dialog/txenctab.cxx b/svx/source/dialog/txenctab.cxx
index 6755b6365eb2..f14180fb29df 100644
--- a/svx/source/dialog/txenctab.cxx
+++ b/svx/source/dialog/txenctab.cxx
@@ -23,7 +23,7 @@
 #include <svx/txenctab.hxx>
 #include <txenctab.hrc>
 
-const OUString SvxTextEncodingTable::GetTextString(const rtl_TextEncoding nEnc)
+OUString SvxTextEncodingTable::GetTextString(const rtl_TextEncoding nEnc)
 {
     const size_t nCount = SAL_N_ELEMENTS(RID_SVXSTR_TEXTENCODING_TABLE);
 
diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx
index e5c5b4e0ae4d..639edd2f0189 100644
--- a/svx/source/fmcomp/fmgridif.cxx
+++ b/svx/source/fmcomp/fmgridif.cxx
@@ -1017,16 +1017,6 @@ void FmXGridPeer::columnChanged()
 }
 
 
-namespace fmgridif
-{
-    static const OUString getDataModeIdentifier()
-    {
-        return "DataMode";
-    }
-}
-using namespace fmgridif;
-
-
 FmXGridPeer::FmXGridPeer(const Reference< XComponentContext >& _rxContext)
             :m_xContext(_rxContext)
             ,m_aModifyListeners(m_aMutex)
@@ -1034,7 +1024,7 @@ FmXGridPeer::FmXGridPeer(const Reference< XComponentContext >& _rxContext)
             ,m_aContainerListeners(m_aMutex)
             ,m_aSelectionListeners(m_aMutex)
             ,m_aGridControlListeners(m_aMutex)
-            ,m_aMode( getDataModeIdentifier() )
+            ,m_aMode("DataMode")
             ,m_nCursorListening(0)
             ,m_bInterceptingDispatch(false)
 {
diff --git a/svx/source/svdraw/svdovirt.cxx b/svx/source/svdraw/svdovirt.cxx
index c50f17c53e28..18d1a92125aa 100644
--- a/svx/source/svdraw/svdovirt.cxx
+++ b/svx/source/svdraw/svdovirt.cxx
@@ -544,7 +544,7 @@ bool SdrVirtObj::DoMacro(const SdrObjMacroHitRec& rRec)
     return rRefObj.DoMacro(rRec); // TODO: positioning offset
 }
 
-const Point SdrVirtObj::GetOffset() const
+Point SdrVirtObj::GetOffset() const
 {
     // #i73248# default offset of SdrVirtObj is aAnchor
     return aAnchor;
diff --git a/svx/source/unodraw/unoshap4.cxx b/svx/source/unodraw/unoshap4.cxx
index ccab2930ba32..f7629f338858 100644
--- a/svx/source/unodraw/unoshap4.cxx
+++ b/svx/source/unodraw/unoshap4.cxx
@@ -515,7 +515,7 @@ void SvxOle2Shape::resetModifiedState()
     }
 }
 
-const SvGlobalName SvxOle2Shape::GetClassName_Impl(OUString& rHexCLSID)
+SvGlobalName SvxOle2Shape::GetClassName_Impl(OUString& rHexCLSID)
 {
     DBG_TESTSOLARMUTEX();
     SvGlobalName aClassName;
diff --git a/sw/inc/dcontact.hxx b/sw/inc/dcontact.hxx
index 4444a3ddb9fd..9955225a488b 100644
--- a/sw/inc/dcontact.hxx
+++ b/sw/inc/dcontact.hxx
@@ -236,7 +236,7 @@ class SwDrawVirtObj : public SdrVirtObj
             SwDrawContact& _rDrawContact);
 
         /// access to offset
-        virtual const Point GetOffset() const override;
+        virtual Point GetOffset() const override;
 
         virtual SwDrawVirtObj* CloneSdrObject(SdrModel& rTargetModel) const override;
         SwDrawVirtObj& operator= (const SwDrawVirtObj& rObj);
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index 1e5e2723772f..f30b076cb683 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -2293,7 +2293,7 @@ const tools::Rectangle& SwDrawVirtObj::GetLastBoundRect() const
     return aOutRect;
 }
 
-const Point SwDrawVirtObj::GetOffset() const
+Point SwDrawVirtObj::GetOffset() const
 {
     // do NOT use IsEmpty() here, there is already a useful offset
     // in the position


More information about the Libreoffice-commits mailing list