core.git: editeng/source
editeng/source/items/borderline.cxx | 24 +++- editeng/source/items/itemtype.cxx |6 +++--- editeng/source/items/paraitem.cxx |2 +- 3 files changed, 15 insertions(+), 17 deletions(-) New commits: commit f0a79b4dc1e96eb5dda35097d0975aae9f3e0c98 Author: Tuukka Orava AuthorDate: Sat May 4 20:00:25 2024 +0300 Commit: Hossein CommitDate: Wed Jul 24 10:32:08 2024 +0200 tdf#147021 Use std::size instead of SAL_N_ELEMENTS in editeng Change-Id: I6cf0557b1e44dff08fa1efa4aefa14dec276458e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167134 Reviewed-by: Hossein Tested-by: Jenkins diff --git a/editeng/source/items/borderline.cxx b/editeng/source/items/borderline.cxx index 05742eb95131..e258d876c398 100644 --- a/editeng/source/items/borderline.cxx +++ b/editeng/source/items/borderline.cxx @@ -455,24 +455,22 @@ void SvxBorderLine::GuessLinesWidths( SvxBorderLineStyle nStyle, sal_uInt16 nOut SvxBorderLineStyle::THICKTHIN_LARGEGAP }; -static size_t const len = SAL_N_ELEMENTS(aDoubleStyles); tools::Long nWidth = 0; -SvxBorderLineStyle nTestStyle(SvxBorderLineStyle::NONE); -for (size_t i = 0; i < len && nWidth == 0; ++i) +for (auto nTestStyle : aDoubleStyles) { -nTestStyle = aDoubleStyles[i]; BorderWidthImpl aWidthImpl = getWidthImpl( nTestStyle ); nWidth = aWidthImpl.GuessWidth( nOut, nIn, nDist ); +if (nWidth != 0) +{ +// If anything matched, then set it +nStyle = nTestStyle; +SetBorderLineStyle(nStyle); +m_nWidth = nWidth; +break; +} } -// If anything matched, then set it -if ( nWidth > 0 ) -{ -nStyle = nTestStyle; -SetBorderLineStyle(nStyle); -m_nWidth = nWidth; -} -else +if (nWidth == 0) { // fdo#38542: not a known double, default to something custom... SetBorderLineStyle(nStyle); @@ -664,7 +662,7 @@ OUString SvxBorderLine::GetValueString(MapUnit eSrcUnit, }; OUString aStr = "(" + ::GetColorString(m_aColor) + cpDelim; -if ( static_cast(m_nStyle) < int(SAL_N_ELEMENTS(aStyleIds)) ) +if ( static_cast(m_nStyle) < std::size(aStyleIds) ) { TranslateId pResId = aStyleIds[static_cast(m_nStyle)]; aStr += EditResId(pResId); diff --git a/editeng/source/items/itemtype.cxx b/editeng/source/items/itemtype.cxx index cbb83c83be35..b95c62c1a386 100644 --- a/editeng/source/items/itemtype.cxx +++ b/editeng/source/items/itemtype.cxx @@ -146,7 +146,7 @@ OUString GetColorString( const Color& rCol ) COL_LIGHTRED, COL_LIGHTMAGENTA, COL_YELLOW, COL_WHITE }; sal_uInt16 nColor = 0; -while ( nColor < SAL_N_ELEMENTS(aColAry) && +while ( nColor < std::size(aColAry) && aColAry[nColor] != rCol.GetRGBColor() ) { nColor += 1; @@ -172,10 +172,10 @@ OUString GetColorString( const Color& rCol ) RID_SVXITEMS_COLOR_WHITE }; -static_assert(SAL_N_ELEMENTS(aColAry) == SAL_N_ELEMENTS(RID_SVXITEMS_COLORS), "must match"); +static_assert(std::size(aColAry) == std::size(RID_SVXITEMS_COLORS), "must match"); OUString sStr; -if ( nColor < SAL_N_ELEMENTS(aColAry) ) +if ( nColor < std::size(aColAry) ) sStr = EditResId(RID_SVXITEMS_COLORS[nColor]); if ( sStr.isEmpty() ) diff --git a/editeng/source/items/paraitem.cxx b/editeng/source/items/paraitem.cxx index 87d892dc3409..f70ff274e787 100644 --- a/editeng/source/items/paraitem.cxx +++ b/editeng/source/items/paraitem.cxx @@ -451,7 +451,7 @@ OUString SvxAdjustItem::GetValueTextByPos( sal_uInt16 nPos ) RID_SVXITEMS_ADJUST_CENTER, RID_SVXITEMS_ADJUST_BLOCKLINE }; -static_assert(SAL_N_ELEMENTS(RID_SVXITEMS_ADJUST) - 1 == size_t(SvxAdjust::BlockLine), "unexpected size"); +static_assert(std::size(RID_SVXITEMS_ADJUST) - 1 == static_cast(SvxAdjust::BlockLine), "unexpected size"); assert(nPos <= sal_uInt16(SvxAdjust::BlockLine) && "enum overflow!"); return EditResId(RID_SVXITEMS_ADJUST[nPos]); }
core.git: basic/source
basic/source/runtime/methods.cxx | 178 +-- 1 file changed, 81 insertions(+), 97 deletions(-) New commits: commit f3d0a184c4da57907a1fcf1ed784340be7d974d6 Author: Tuukka Orava AuthorDate: Tue Apr 9 09:28:27 2024 +0300 Commit: Mike Kaganski CommitDate: Tue Apr 9 10:51:14 2024 +0200 tdf#147132 Flatten Basic function implementations Change-Id: I077e042c82cbefd1d46db5ca8d5983a0870a296c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165903 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index a97e66dc6c41..4dfcdc210ea3 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -429,18 +429,14 @@ void SbRtl_CurDir(StarBASIC *, SbxArray & rPar, bool) void SbRtl_ChDir(StarBASIC * pBasic, SbxArray & rPar, bool) { rPar.Get(0)->PutEmpty(); -if (rPar.Count() == 2) -{ -// VBA: track current directory per document type (separately for Writer, Calc, Impress, etc.) -if( SbiRuntime::isVBAEnabled() ) -{ -::basic::vba::registerCurrentDirectory(getDocumentModel(pBasic), - rPar.Get(1)->GetOUString()); -} -} -else +if (rPar.Count() != 2) +return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); + +// VBA: track current directory per document type (separately for Writer, Calc, Impress, etc.) +if( SbiRuntime::isVBAEnabled() ) { -StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); +::basic::vba::registerCurrentDirectory(getDocumentModel(pBasic), +rPar.Get(1)->GetOUString()); } } @@ -448,9 +444,7 @@ void SbRtl_ChDrive(StarBASIC *, SbxArray & rPar, bool) { rPar.Get(0)->PutEmpty(); if (rPar.Count() != 2) -{ -StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); -} +return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); } @@ -499,129 +493,119 @@ void implStepRenameOSL( const OUString& aSource, const OUString& aDest ) void SbRtl_FileCopy(StarBASIC *, SbxArray & rPar, bool) { rPar.Get(0)->PutEmpty(); -if (rPar.Count() == 3) +if (rPar.Count() != 3) +return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); + +OUString aSource = rPar.Get(1)->GetOUString(); +OUString aDest = rPar.Get(2)->GetOUString(); +if( hasUno() ) { -OUString aSource = rPar.Get(1)->GetOUString(); -OUString aDest = rPar.Get(2)->GetOUString(); -if( hasUno() ) +const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = getFileAccess(); +if( xSFI.is() ) { -const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = getFileAccess(); -if( xSFI.is() ) +try { -try -{ -xSFI->copy( getFullPath( aSource ), getFullPath( aDest ) ); -} -catch(const Exception & ) -{ -StarBASIC::Error( ERRCODE_BASIC_PATH_NOT_FOUND ); -} +xSFI->copy( getFullPath( aSource ), getFullPath( aDest ) ); } -} -else -{ -FileBase::RC nRet = File::copy( getFullPath( aSource ), getFullPath( aDest ) ); -if( nRet != FileBase::E_None ) +catch(const Exception & ) { StarBASIC::Error( ERRCODE_BASIC_PATH_NOT_FOUND ); } } } else -StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); +{ +FileBase::RC nRet = File::copy( getFullPath( aSource ), getFullPath( aDest ) ); +if( nRet != FileBase::E_None ) +{ +StarBASIC::Error( ERRCODE_BASIC_PATH_NOT_FOUND ); +} +} } void SbRtl_Kill(StarBASIC *, SbxArray & rPar, bool) { rPar.Get(0)->PutEmpty(); -if (rPar.Count() == 2) -{ -OUString aFileSpec = rPar.Get(1)->GetOUString(); +if (rPar.Count() != 2) +return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); -if( hasUno() ) +OUString aFileSpec = rPar.Get(1)->GetOUString(); + +if( hasUno() ) +{ +const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = getFileAccess(); +if( xSFI.is() ) { -const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = getFileAccess(); -if( xSFI.is() ) +OUString aFullPath = getFullPath( aFileSpec ); +if( !xSFI->exists( aFullPath ) || xSFI->isFolder( aFullPath ) ) { -OUString aFullPath = getFullPath( aFileSpec ); -if( !xSFI->exists( aFullPath ) || xSFI->isFolder( aFullPath ) ) -{ -StarBASIC::Error( ERRCODE_BASIC_FILE_NOT_FOUND ); -return; -} -try -{
core.git: sw/inc sw/source
sw/inc/redline.hxx |2 -- sw/inc/swevent.hxx |2 -- sw/source/core/access/accfrmobjslist.hxx |6 -- 3 files changed, 10 deletions(-) New commits: commit c5bb6b0972f8f03b6c9d397d2d0f16c154c58e1c Author: Tuukka Orava AuthorDate: Mon Mar 11 00:26:05 2024 +0200 Commit: Mike Kaganski CommitDate: Mon Mar 11 05:39:23 2024 +0100 tdf#157664 Drop operator != where respective operator == is defined Change-Id: Id0313cbaf399af94df7ced18a8ad55deec53be33 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164638 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sw/inc/redline.hxx b/sw/inc/redline.hxx index a8be390b1490..ef7c8129ce6a 100644 --- a/sw/inc/redline.hxx +++ b/sw/inc/redline.hxx @@ -120,8 +120,6 @@ public: ( m_pExtraData && rCmp.m_pExtraData && *m_pExtraData == *rCmp.m_pExtraData )); } -bool operator!=( const SwRedlineData& rCmp ) const -{ return !operator==( rCmp ); } RedlineType GetType() const { return m_eType; } diff --git a/sw/inc/swevent.hxx b/sw/inc/swevent.hxx index b25246cb2e12..62bd39429a13 100644 --- a/sw/inc/swevent.hxx +++ b/sw/inc/swevent.hxx @@ -99,8 +99,6 @@ struct SwCallMouseEvent final PTR.pFormat == rEvent.PTR.pFormat && PTR.IMAP.pIMapObj == rEvent.PTR.IMAP.pIMapObj; } -bool operator!=( const SwCallMouseEvent& rEvent ) const -{ return !( *this == rEvent );} void Clear() { diff --git a/sw/source/core/access/accfrmobjslist.hxx b/sw/source/core/access/accfrmobjslist.hxx index 9df293d71e2f..e4f3141f4275 100644 --- a/sw/source/core/access/accfrmobjslist.hxx +++ b/sw/source/core/access/accfrmobjslist.hxx @@ -52,12 +52,6 @@ public: return m_aCurr == r.m_aCurr; } -bool operator!=( -const SwAccessibleChildSList_const_iterator& r ) const -{ -return !(*this == r); -} - SwAccessibleChildSList_const_iterator& operator++(); const sw::access::SwAccessibleChild& operator*() const
core.git: vcl/inc
vcl/inc/graphic/GraphicFormatDetector.hxx |5 + vcl/inc/graphic/Manager.hxx |5 + vcl/inc/graphic/UnoGraphic.hxx|5 + vcl/inc/graphic/UnoGraphicDescriptor.hxx |5 + 4 files changed, 4 insertions(+), 16 deletions(-) New commits: commit ef6212158d8308d60d3edb6c87117958758436e2 Author: Tuukka Orava AuthorDate: Mon Feb 5 13:13:56 2024 +0200 Commit: Ilmari Lauhakangas CommitDate: Mon Feb 5 18:28:26 2024 +0100 tdf#143148 Use pragma once in vcl/inc/graphic Change-Id: Id88d0c64f02d9a0ca111de3d08e3d542dfba2a1c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162997 Tested-by: Jenkins Tested-by: Ilmari Lauhakangas Reviewed-by: Ilmari Lauhakangas diff --git a/vcl/inc/graphic/GraphicFormatDetector.hxx b/vcl/inc/graphic/GraphicFormatDetector.hxx index d6791e377fc1..24ffcab18b7a 100644 --- a/vcl/inc/graphic/GraphicFormatDetector.hxx +++ b/vcl/inc/graphic/GraphicFormatDetector.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_VCL_INC_GRAPHICFORMATDETECTOR_HXX -#define INCLUDED_VCL_INC_GRAPHICFORMATDETECTOR_HXX +#pragma once #include #include @@ -203,6 +202,4 @@ private: }; } -#endif // INCLUDED_VCL_INC_GRAPHICFORMATDETECTOR_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/graphic/Manager.hxx b/vcl/inc/graphic/Manager.hxx index 65e92146491c..d239f6a8b01d 100644 --- a/vcl/inc/graphic/Manager.hxx +++ b/vcl/inc/graphic/Manager.hxx @@ -7,8 +7,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef INCLUDED_VCL_INC_GRAPHIC_MANAGER_HXX -#define INCLUDED_VCL_INC_GRAPHIC_MANAGER_HXX +#pragma once #include #include @@ -76,6 +75,4 @@ public: } // end namespace vcl::graphic -#endif // INCLUDED_VCL_INC_GRAPHIC_MANAGER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/graphic/UnoGraphic.hxx b/vcl/inc/graphic/UnoGraphic.hxx index ce060c98f40c..94fcb361dcd1 100644 --- a/vcl/inc/graphic/UnoGraphic.hxx +++ b/vcl/inc/graphic/UnoGraphic.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_VCL_SOURCE_GRAPHIC_GRAPHIC_HXX -#define INCLUDED_VCL_SOURCE_GRAPHIC_GRAPHIC_HXX +#pragma once #include #include @@ -84,6 +83,4 @@ private: } -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/graphic/UnoGraphicDescriptor.hxx b/vcl/inc/graphic/UnoGraphicDescriptor.hxx index 2adc19dac059..3631c504fa92 100644 --- a/vcl/inc/graphic/UnoGraphicDescriptor.hxx +++ b/vcl/inc/graphic/UnoGraphicDescriptor.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_VCL_SOURCE_GRAPHIC_DESCRIPTOR_HXX -#define INCLUDED_VCL_SOURCE_GRAPHIC_DESCRIPTOR_HXX +#pragma once #include #include @@ -114,6 +113,4 @@ private: } -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */