[Libreoffice-commits] core.git: sw/source
Mike Kaganski (via logerrit)
logerrit at kemper.freedesktop.org
Tue Dec 8 18:14:07 UTC 2020
sw/source/core/SwNumberTree/SwNodeNum.cxx | 11 ++++-------
sw/source/core/doc/DocumentRedlineManager.cxx | 13 +++++--------
sw/source/core/doc/docnum.cxx | 3 +--
sw/source/core/doc/docruby.cxx | 3 +--
sw/source/core/txtnode/ndtxt.cxx | 10 ++++------
sw/source/core/unocore/unocrsrhelper.cxx | 4 +---
sw/source/core/unocore/unoobj.cxx | 3 +--
sw/source/uibase/shells/langhelper.cxx | 7 ++-----
sw/source/uibase/uiview/view2.cxx | 4 +---
sw/source/uibase/wrtsh/wrtsh1.cxx | 2 +-
10 files changed, 21 insertions(+), 39 deletions(-)
New commits:
commit e225b642518ad1df3ddd02f2cfb10393065f55e0
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Tue Dec 8 19:21:37 2020 +0300
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Tue Dec 8 19:13:20 2020 +0100
Simplify attribute set definitions a little
Change-Id: I5dfc626d4e8eafa30d48b698f1c1bf89dd5834b4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107431
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/sw/source/core/SwNumberTree/SwNodeNum.cxx b/sw/source/core/SwNumberTree/SwNodeNum.cxx
index a097f3b7a74f..6bf92d3eb73a 100644
--- a/sw/source/core/SwNumberTree/SwNodeNum.cxx
+++ b/sw/source/core/SwNumberTree/SwNodeNum.cxx
@@ -336,13 +336,10 @@ void SwNodeNum::UnregisterMeAndChildrenDueToRootDelete( SwNodeNum& rNodeNum )
pTextNode->RemoveFromList();
// --> clear all list attributes and the list style
- o3tl::sorted_vector<sal_uInt16> aResetAttrsArray;
- aResetAttrsArray.insert( RES_PARATR_LIST_ID );
- aResetAttrsArray.insert( RES_PARATR_LIST_LEVEL );
- aResetAttrsArray.insert( RES_PARATR_LIST_ISRESTART );
- aResetAttrsArray.insert( RES_PARATR_LIST_RESTARTVALUE );
- aResetAttrsArray.insert( RES_PARATR_LIST_ISCOUNTED );
- aResetAttrsArray.insert( RES_PARATR_NUMRULE );
+ const o3tl::sorted_vector<sal_uInt16> aResetAttrsArray{
+ RES_PARATR_LIST_ID, RES_PARATR_LIST_LEVEL, RES_PARATR_LIST_ISRESTART,
+ RES_PARATR_LIST_RESTARTVALUE, RES_PARATR_LIST_ISCOUNTED, RES_PARATR_NUMRULE
+ };
SwPaM aPam( *pTextNode );
pTextNode->GetDoc().ResetAttrs( aPam, false,
aResetAttrsArray,
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index 7b004695dbd6..016151161dc5 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -812,18 +812,15 @@ namespace
SwPaM aPam( *pTNd, pTNd->GetText().getLength() );
o3tl::sorted_vector<sal_uInt16> aResetAttrsArray;
- sal_uInt16 aResetableSetRange[] = {
- RES_PARATR_BEGIN, RES_PARATR_END - 1,
- RES_PARATR_LIST_BEGIN, RES_FRMATR_END - 1,
- 0
+ constexpr std::pair<sal_uInt16, sal_uInt16> aResetableSetRange[] = {
+ { RES_PARATR_BEGIN, RES_PARATR_END - 1 },
+ { RES_PARATR_LIST_BEGIN, RES_FRMATR_END - 1 },
};
- const sal_uInt16 *pUShorts = aResetableSetRange;
- while (*pUShorts)
+ for (const auto& [nBegin, nEnd] : aResetableSetRange)
{
- for (sal_uInt16 i = pUShorts[0]; i <= pUShorts[1]; ++i)
+ for (sal_uInt16 i = nBegin; i <= nEnd; ++i)
aResetAttrsArray.insert( i );
- pUShorts += 2;
}
rDoc.ResetAttrs(aPam, false, aResetAttrsArray);
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index f8ac5687b6cc..194ba1e2450e 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -60,8 +60,7 @@ namespace {
void lcl_ResetIndentAttrs(SwDoc *pDoc, const SwPaM &rPam, sal_uInt16 marker,
SwRootFrame const*const pLayout)
{
- o3tl::sorted_vector<sal_uInt16> aResetAttrsArray;
- aResetAttrsArray.insert( marker );
+ const o3tl::sorted_vector<sal_uInt16> aResetAttrsArray{ marker };
// #i114929#
// On a selection setup a corresponding Point-and-Mark in order to get
// the indentation attribute reset on all paragraphs touched by the selection
diff --git a/sw/source/core/doc/docruby.cxx b/sw/source/core/doc/docruby.cxx
index 283195ee1c8d..122fd266e7ee 100644
--- a/sw/source/core/doc/docruby.cxx
+++ b/sw/source/core/doc/docruby.cxx
@@ -94,8 +94,7 @@ sal_uInt16 SwDoc::FillRubyList( const SwPaM& rPam, SwRubyList& rList )
void SwDoc::SetRubyList( const SwPaM& rPam, const SwRubyList& rList )
{
GetIDocumentUndoRedo().StartUndo( SwUndoId::SETRUBYATTR, nullptr );
- o3tl::sorted_vector<sal_uInt16> aDelArr;
- aDelArr.insert( RES_TXTATR_CJK_RUBY );
+ const o3tl::sorted_vector<sal_uInt16> aDelArr{ RES_TXTATR_CJK_RUBY };
SwRubyList::size_type nListEntry = 0;
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index c128973cdf63..4172d573e39d 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -3720,12 +3720,10 @@ void SwTextNode::ReplaceText( const SwIndex& rStart, const sal_Int32 nDelLen,
namespace {
void lcl_ResetParAttrs( SwTextNode &rTextNode )
{
- o3tl::sorted_vector<sal_uInt16> aAttrs;
- aAttrs.insert( RES_PARATR_LIST_ID );
- aAttrs.insert( RES_PARATR_LIST_LEVEL );
- aAttrs.insert( RES_PARATR_LIST_ISRESTART );
- aAttrs.insert( RES_PARATR_LIST_RESTARTVALUE );
- aAttrs.insert( RES_PARATR_LIST_ISCOUNTED );
+ const o3tl::sorted_vector<sal_uInt16> aAttrs{ RES_PARATR_LIST_ID, RES_PARATR_LIST_LEVEL,
+ RES_PARATR_LIST_ISRESTART,
+ RES_PARATR_LIST_RESTARTVALUE,
+ RES_PARATR_LIST_ISCOUNTED };
SwPaM aPam( rTextNode );
// #i96644#
// suppress side effect "send data changed events"
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx
index 99de9745078f..1abb9f207cf2 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -1016,9 +1016,7 @@ void resetCursorPropertyValue(const SfxItemPropertySimpleEntry& rEntry, SwPaM& r
break;
case FN_UNO_CHARFMT_SEQUENCE:
{
- o3tl::sorted_vector<sal_uInt16> aWhichIds;
- aWhichIds.insert( RES_TXTATR_CHARFMT);
- rDoc.ResetAttrs(rPam, true, aWhichIds);
+ rDoc.ResetAttrs(rPam, true, { RES_TXTATR_CHARFMT });
}
break;
}
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index 38315904adb2..b8f64541ab58 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -2025,8 +2025,7 @@ void SwUnoCursorHelper::SetPropertyToDefault(
if (pEntry->nWID < RES_FRMATR_END)
{
- o3tl::sorted_vector<sal_uInt16> aWhichIds;
- aWhichIds.insert( pEntry->nWID );
+ const o3tl::sorted_vector<sal_uInt16> aWhichIds{ pEntry->nWID };
if (pEntry->nWID < RES_PARATR_BEGIN)
{
rDoc.ResetAttrs(rPaM, true, aWhichIds);
diff --git a/sw/source/uibase/shells/langhelper.cxx b/sw/source/uibase/shells/langhelper.cxx
index ac328ded6f7c..aa7f5ae06089 100644
--- a/sw/source/uibase/shells/langhelper.cxx
+++ b/sw/source/uibase/shells/langhelper.cxx
@@ -374,11 +374,8 @@ namespace SwLangHelper
}
else
{
- o3tl::sorted_vector<sal_uInt16> aAttribs;
- aAttribs.insert( RES_CHRATR_LANGUAGE );
- aAttribs.insert( RES_CHRATR_CJK_LANGUAGE );
- aAttribs.insert( RES_CHRATR_CTL_LANGUAGE );
- rWrtSh.ResetAttr( aAttribs );
+ rWrtSh.ResetAttr(
+ { RES_CHRATR_LANGUAGE, RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CTL_LANGUAGE });
}
}
diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx
index 67a4a1b72c43..9995cfa94219 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -173,9 +173,7 @@ static void lcl_SetAllTextToDefaultLanguage( SwWrtShell &rWrtSh, sal_uInt16 nWhi
rWrtSh.ExtendedSelectAll();
// set language attribute to default for all text
- o3tl::sorted_vector<sal_uInt16> aAttribs;
- aAttribs.insert( nWhichId );
- rWrtSh.ResetAttr( aAttribs );
+ rWrtSh.ResetAttr({ nWhichId });
rWrtSh.Pop(SwCursorShell::PopMode::DeleteCurrent);
rWrtSh.LockView( false );
diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx
index 04d028f692d0..0019de241a1f 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -1609,7 +1609,7 @@ void SwWrtShell::AutoUpdatePara(SwTextFormatColl* pColl, const SfxItemSet& rStyl
StartAction();
if(bReset)
{
- ResetAttr( o3tl::sorted_vector<sal_uInt16>(), pCursor );
+ ResetAttr({}, pCursor);
SetAttrSet(aCoreSet, SetAttrMode::DEFAULT, pCursor);
}
mxDoc->ChgFormat(*pColl, rStyleSet );
More information about the Libreoffice-commits
mailing list