summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-07-16 08:50:39 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-07-17 17:44:50 +0200
commit3fec689480644c274501740013ff83388cb24245 (patch)
tree1f26b05e33e4b9c342f59c77a25ac8ee16470304
parent18387b547ffbab2d19ab4968ea8194f7aee07192 (diff)
use WhichRangesContainer in sw
Change-Id: I8662b2e03b0dbe3a7206d8b59ae3556e3b2e75a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119007 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sw/inc/charfmt.hxx2
-rw-r--r--sw/inc/fmtcol.hxx12
-rw-r--r--sw/inc/format.hxx4
-rw-r--r--sw/inc/frmfmt.hxx4
-rw-r--r--sw/inc/hintids.hxx27
-rw-r--r--sw/inc/swatrset.hxx1
-rw-r--r--sw/inc/swtblfmt.hxx6
-rw-r--r--sw/source/core/attr/format.cxx8
-rw-r--r--sw/source/core/attr/swatrset.cxx15
-rw-r--r--sw/source/core/bastyp/init.cxx84
-rw-r--r--sw/source/core/doc/DocumentStylePoolManager.cxx8
-rw-r--r--sw/source/core/doc/docedt.cxx11
-rw-r--r--sw/source/core/doc/docfmt.cxx12
-rw-r--r--sw/source/core/doc/docnew.cxx14
-rw-r--r--sw/source/core/fields/expfld.cxx8
-rw-r--r--sw/source/core/layout/atrfrm.cxx8
-rw-r--r--sw/source/core/undo/untbl.cxx13
-rw-r--r--sw/source/core/unocore/unocrsrhelper.cxx2
-rw-r--r--sw/source/core/unocore/unoframe.cxx14
-rw-r--r--sw/source/core/unocore/unoobj.cxx3
-rw-r--r--sw/source/core/unocore/unostyle.cxx8
-rw-r--r--sw/source/filter/html/htmldrawreader.cxx8
-rw-r--r--sw/source/filter/html/htmltab.cxx8
-rw-r--r--sw/source/uibase/app/docshini.cxx19
-rw-r--r--sw/source/uibase/frmdlg/frmmgr.cxx6
-rw-r--r--sw/source/uibase/inc/tabsh.hxx2
-rw-r--r--sw/source/uibase/lingu/hhcwrp.cxx6
-rw-r--r--sw/source/uibase/shells/tabsh.cxx10
-rw-r--r--sw/source/uibase/uiview/viewsrch.cxx14
29 files changed, 147 insertions, 190 deletions
diff --git a/sw/inc/charfmt.hxx b/sw/inc/charfmt.hxx
index 27d6e5c0f896..b42dd303e953 100644
--- a/sw/inc/charfmt.hxx
+++ b/sw/inc/charfmt.hxx
@@ -29,7 +29,7 @@ class SwCharFormat final : public SwFormat
SwCharFormat( SwAttrPool& rPool, const OUString &rFormatName,
SwCharFormat *pDerivedFrom )
- : SwFormat( rPool, rFormatName, aCharFormatSetRange, pDerivedFrom, RES_CHRFMT )
+ : SwFormat( rPool, rFormatName, &aCharFormatSetRange, pDerivedFrom, RES_CHRFMT )
{}
public:
diff --git a/sw/inc/fmtcol.hxx b/sw/inc/fmtcol.hxx
index 10a41b9d9b78..2ea13c159cae 100644
--- a/sw/inc/fmtcol.hxx
+++ b/sw/inc/fmtcol.hxx
@@ -36,13 +36,13 @@ class SAL_DLLPUBLIC_RTTI SwFormatColl: public SwFormat
{
protected:
SwFormatColl( SwAttrPool& rPool, const char* pFormatName,
- const sal_uInt16* pWhichRanges, SwFormatColl* pDerFrom,
+ const WhichRangesContainer* pWhichRanges, SwFormatColl* pDerFrom,
sal_uInt16 nFormatWhich )
: SwFormat( rPool, pFormatName, pWhichRanges, pDerFrom, nFormatWhich )
{ SetAuto(false); }
SwFormatColl( SwAttrPool& rPool, const OUString &rFormatName,
- const sal_uInt16* pWhichRanges, SwFormatColl* pDerFrom,
+ const WhichRangesContainer* pWhichRanges, SwFormatColl* pDerFrom,
sal_uInt16 nFormatWhich )
: SwFormat( rPool, rFormatName, pWhichRanges, pDerFrom, nFormatWhich )
{ SetAuto(false); }
@@ -74,7 +74,7 @@ protected:
SwTextFormatColl( SwAttrPool& rPool, const char* pFormatCollName,
SwTextFormatColl* pDerFrom = nullptr,
sal_uInt16 nFormatWh = RES_TXTFMTCOLL )
- : SwFormatColl(rPool, pFormatCollName, aTextFormatCollSetRange, pDerFrom, nFormatWh)
+ : SwFormatColl(rPool, pFormatCollName, &aTextFormatCollSetRange, pDerFrom, nFormatWh)
, mbStayAssignedToListLevelOfOutlineStyle(false)
, mbAssignedToOutlineStyle(false)
, m_bInSwFntCache(false)
@@ -85,7 +85,7 @@ protected:
SwTextFormatColl( SwAttrPool& rPool, const OUString &rFormatCollName,
SwTextFormatColl* pDerFrom,
sal_uInt16 nFormatWh = RES_TXTFMTCOLL )
- : SwFormatColl(rPool, rFormatCollName, aTextFormatCollSetRange, pDerFrom, nFormatWh)
+ : SwFormatColl(rPool, rFormatCollName, &aTextFormatCollSetRange, pDerFrom, nFormatWh)
, mbStayAssignedToListLevelOfOutlineStyle(false)
, mbAssignedToOutlineStyle(false)
, m_bInSwFntCache(false)
@@ -170,13 +170,13 @@ class SwGrfFormatColl final : public SwFormatColl
SwGrfFormatColl( SwAttrPool& rPool, const char* pFormatCollName,
SwGrfFormatColl* pDerFrom = nullptr )
- : SwFormatColl( rPool, pFormatCollName, aGrfFormatCollSetRange,
+ : SwFormatColl( rPool, pFormatCollName, &aGrfFormatCollSetRange,
pDerFrom, RES_GRFFMTCOLL )
{}
SwGrfFormatColl( SwAttrPool& rPool, const OUString &rFormatCollName,
SwGrfFormatColl* pDerFrom )
- : SwFormatColl( rPool, rFormatCollName, aGrfFormatCollSetRange,
+ : SwFormatColl( rPool, rFormatCollName, &aGrfFormatCollSetRange,
pDerFrom, RES_GRFFMTCOLL )
{}
};
diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx
index c3d2aec20773..03d1350d2ed1 100644
--- a/sw/inc/format.hxx
+++ b/sw/inc/format.hxx
@@ -67,8 +67,8 @@ class SW_DLLPUBLIC SwFormat : public sw::BorderCacheOwner, public sw::Broadcasti
protected:
SwFormat( SwAttrPool& rPool, const char* pFormatNm,
- const sal_uInt16* pWhichRanges, SwFormat *pDrvdFrame, sal_uInt16 nFormatWhich );
- SwFormat( SwAttrPool& rPool, const OUString &rFormatNm, const sal_uInt16* pWhichRanges,
+ const WhichRangesContainer* pWhichRanges, SwFormat *pDrvdFrame, sal_uInt16 nFormatWhich );
+ SwFormat( SwAttrPool& rPool, const OUString &rFormatNm, const WhichRangesContainer* pWhichRanges,
SwFormat *pDrvdFrame, sal_uInt16 nFormatWhich );
SwFormat( const SwFormat& rFormat );
virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
diff --git a/sw/inc/frmfmt.hxx b/sw/inc/frmfmt.hxx
index 71f9a59e312c..243f12b05683 100644
--- a/sw/inc/frmfmt.hxx
+++ b/sw/inc/frmfmt.hxx
@@ -88,14 +88,14 @@ protected:
const char* pFormatNm,
SwFrameFormat *pDrvdFrame,
sal_uInt16 nFormatWhich = RES_FRMFMT,
- const sal_uInt16* pWhichRange = nullptr);
+ const WhichRangesContainer* pWhichRange = nullptr);
SwFrameFormat(
SwAttrPool& rPool,
const OUString &rFormatNm,
SwFrameFormat *pDrvdFrame,
sal_uInt16 nFormatWhich = RES_FRMFMT,
- const sal_uInt16* pWhichRange = nullptr);
+ const WhichRangesContainer* pWhichRange = nullptr);
virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx
index 66ecb9fb27e8..739a6de59e2e 100644
--- a/sw/inc/hintids.hxx
+++ b/sw/inc/hintids.hxx
@@ -23,6 +23,7 @@
#include <svx/xdef.hxx>
#include "swdllapi.h"
#include <svl/typedwhich.hxx>
+#include <svl/whichranges.hxx>
#include <vector>
class SfxStringItem;
@@ -550,32 +551,32 @@ sal_Unicode GetCharOfTextAttr(const SwTextAttr& rAttr);
// all Sets defined in init.cxx
// AttrSet-Range for the 3 Break-Attribute
-extern sal_uInt16 const aBreakSetRange[];
+extern WhichRangesContainer const aBreakSetRange;
// AttrSet-Range for TextFormatColl
-extern sal_uInt16 const aTextFormatCollSetRange[];
+extern WhichRangesContainer const aTextFormatCollSetRange;
// AttrSet-Range for GrfFormatColl
-extern sal_uInt16 const aGrfFormatCollSetRange[];
+extern WhichRangesContainer const aGrfFormatCollSetRange;
// AttrSet-Range for TextNode
-SW_DLLPUBLIC extern sal_uInt16 const aTextNodeSetRange[];
+SW_DLLPUBLIC extern WhichRangesContainer const aTextNodeSetRange;
// AttrSet-Range for NoTextNode
-extern sal_uInt16 const aNoTextNodeSetRange[];
+extern WhichRangesContainer const aNoTextNodeSetRange;
// AttrSet-Range for SwTable
-extern sal_uInt16 const aTableSetRange[];
+extern WhichRangesContainer const aTableSetRange;
// AttrSet-Range for SwTableLine
-extern sal_uInt16 const aTableLineSetRange[];
+extern WhichRangesContainer const aTableLineSetRange;
// AttrSet-Range for SwTableBox
-extern sal_uInt16 const aTableBoxSetRange[];
+extern WhichRangesContainer const aTableBoxSetRange;
// AttrSet-Range for SwFrameFormat
-SW_DLLPUBLIC extern sal_uInt16 const aFrameFormatSetRange[];
+SW_DLLPUBLIC extern WhichRangesContainer const aFrameFormatSetRange;
// AttrSet-Range for SwCharFormat
-extern sal_uInt16 const aCharFormatSetRange[];
+extern WhichRangesContainer const aCharFormatSetRange;
// AttrSet-Range for the autostyles
-extern sal_uInt16 const aCharAutoFormatSetRange[];
+extern WhichRangesContainer const aCharAutoFormatSetRange;
// AttrSet-Range for SwPageDescFormat
-extern sal_uInt16 const aPgFrameFormatSetRange[];
+extern WhichRangesContainer const aPgFrameFormatSetRange;
// check if ID is InRange of AttrSet-Ids
-bool IsInRange(const sal_uInt16* pRange, const sal_uInt16 nId);
+bool IsInRange(const WhichRangesContainer& pRange, const sal_uInt16 nId);
#endif
diff --git a/sw/inc/swatrset.hxx b/sw/inc/swatrset.hxx
index 6edd8fba4165..1129914b378b 100644
--- a/sw/inc/swatrset.hxx
+++ b/sw/inc/swatrset.hxx
@@ -162,7 +162,6 @@ class SW_DLLPUBLIC SwAttrSet final : public SfxItemSet
void PutChgd( const SfxPoolItem& rI ) { SfxItemSet::PutDirect( rI ); }
public:
SwAttrSet( SwAttrPool&, sal_uInt16 nWhich1, sal_uInt16 nWhich2 );
- SwAttrSet( SwAttrPool&, const sal_uInt16* nWhichPairTable );
SwAttrSet( SwAttrPool&, const WhichRangesContainer& nWhichPairTable );
SwAttrSet( const SwAttrSet& );
diff --git a/sw/inc/swtblfmt.hxx b/sw/inc/swtblfmt.hxx
index 14b200164b5d..fa3aed69e216 100644
--- a/sw/inc/swtblfmt.hxx
+++ b/sw/inc/swtblfmt.hxx
@@ -27,7 +27,7 @@ class SAL_DLLPUBLIC_RTTI SwTableFormat final : public SwFrameFormat
SwTableFormat( SwAttrPool& rPool, const OUString &rFormatNm,
SwFrameFormat *pDrvdFrame )
- : SwFrameFormat( rPool, rFormatNm, pDrvdFrame, RES_FRMFMT, aTableSetRange )
+ : SwFrameFormat( rPool, rFormatNm, pDrvdFrame, RES_FRMFMT, &aTableSetRange )
{}
public:
@@ -39,7 +39,7 @@ class SwTableLineFormat final : public SwFrameFormat
friend class SwDoc;
SwTableLineFormat( SwAttrPool& rPool, SwFrameFormat *pDrvdFrame )
- : SwFrameFormat( rPool, OUString(), pDrvdFrame, RES_FRMFMT, aTableLineSetRange )
+ : SwFrameFormat( rPool, OUString(), pDrvdFrame, RES_FRMFMT, &aTableLineSetRange )
{}
public:
@@ -51,7 +51,7 @@ class SAL_DLLPUBLIC_RTTI SwTableBoxFormat final : public SwFrameFormat
friend class SwDoc;
SwTableBoxFormat( SwAttrPool& rPool, SwFrameFormat *pDrvdFrame )
- : SwFrameFormat( rPool, OUString(), pDrvdFrame, RES_FRMFMT, aTableBoxSetRange )
+ : SwFrameFormat( rPool, OUString(), pDrvdFrame, RES_FRMFMT, &aTableBoxSetRange )
{}
// For recognition of changes (especially TableBoxAttribute).
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index b6fa7bb6b179..aa2675fc919f 100644
--- a/sw/source/core/attr/format.cxx
+++ b/sw/source/core/attr/format.cxx
@@ -38,10 +38,10 @@
using namespace com::sun::star;
SwFormat::SwFormat( SwAttrPool& rPool, const char* pFormatNm,
- const sal_uInt16* pWhichRanges, SwFormat *pDrvdFrame,
+ const WhichRangesContainer* pWhichRanges, SwFormat *pDrvdFrame,
sal_uInt16 nFormatWhich ) :
m_aFormatName( OUString::createFromAscii(pFormatNm) ),
- m_aSet( rPool, pWhichRanges ),
+ m_aSet( rPool, pWhichRanges ? *pWhichRanges : WhichRangesContainer() ),
m_nWhichId( nFormatWhich ),
m_nPoolFormatId( USHRT_MAX ),
m_nPoolHelpId( USHRT_MAX ),
@@ -59,10 +59,10 @@ SwFormat::SwFormat( SwAttrPool& rPool, const char* pFormatNm,
}
SwFormat::SwFormat( SwAttrPool& rPool, const OUString& rFormatNm,
- const sal_uInt16* pWhichRanges, SwFormat* pDrvdFrame,
+ const WhichRangesContainer* pWhichRanges, SwFormat* pDrvdFrame,
sal_uInt16 nFormatWhich ) :
m_aFormatName( rFormatNm ),
- m_aSet( rPool, pWhichRanges ),
+ m_aSet( rPool, pWhichRanges ? *pWhichRanges : WhichRangesContainer() ),
m_nWhichId( nFormatWhich ),
m_nPoolFormatId( USHRT_MAX ),
m_nPoolHelpId( USHRT_MAX ),
diff --git a/sw/source/core/attr/swatrset.cxx b/sw/source/core/attr/swatrset.cxx
index f09d9111e8eb..dea4ccfef5aa 100644
--- a/sw/source/core/attr/swatrset.cxx
+++ b/sw/source/core/attr/swatrset.cxx
@@ -97,13 +97,9 @@ SwAttrSet::SwAttrSet( SwAttrPool& rPool, sal_uInt16 nWh1, sal_uInt16 nWh2 )
{
}
-SwAttrSet::SwAttrSet( SwAttrPool& rPool, const sal_uInt16* nWhichPairTable )
- : SfxItemSet( rPool, nWhichPairTable ), m_pOldSet( nullptr ), m_pNewSet( nullptr )
-{
-}
-
SwAttrSet::SwAttrSet( SwAttrPool& rPool, const WhichRangesContainer& nWhichPairTable )
- : SfxItemSet( rPool, nWhichPairTable ), m_pOldSet( nullptr ), m_pNewSet( nullptr )
+ : SfxItemSet( rPool, nWhichPairTable )
+ , m_pOldSet( nullptr ), m_pNewSet( nullptr )
{
}
@@ -435,13 +431,12 @@ void SwAttrSet::CopyToModify( sw::BroadcastingModify& rMod ) const
}
/// check if ID is in range of attribute set IDs
-bool IsInRange( const sal_uInt16* pRange, const sal_uInt16 nId )
+bool IsInRange( const WhichRangesContainer& pRange, const sal_uInt16 nId )
{
- while( *pRange )
+ for(const auto& rPair : pRange)
{
- if( *pRange <= nId && nId <= *(pRange+1) )
+ if( rPair.first <= nId && nId <= rPair.second )
return true;
- pRange += 2;
}
return false;
}
diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx
index 8bc7296b250f..f0a05c70e8c6 100644
--- a/sw/source/core/bastyp/init.cxx
+++ b/sw/source/core/bastyp/init.cxx
@@ -138,36 +138,33 @@ using namespace ::com::sun::star;
// some ranges for sets in collections/ nodes
// AttrSet range for the 2 break attributes
-sal_uInt16 const aBreakSetRange[] = {
- RES_PAGEDESC, RES_BREAK,
- 0
-};
+WhichRangesContainer const aBreakSetRange(svl::Items<
+ RES_PAGEDESC, RES_BREAK
+>::value);
// AttrSet range for TextFormatColl
// list attributes ( RES_PARATR_LIST_BEGIN - RES_PARATR_LIST_END ) are not
// included in the paragraph style's itemset.
-sal_uInt16 const aTextFormatCollSetRange[] = {
+WhichRangesContainer const aTextFormatCollSetRange(svl::Items<
RES_CHRATR_BEGIN, RES_CHRATR_END-1,
RES_PARATR_BEGIN, RES_PARATR_END-1,
RES_FRMATR_BEGIN, RES_FRMATR_END-1,
RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
// FillAttribute support
- XATTR_FILL_FIRST, XATTR_FILL_LAST,
+ XATTR_FILL_FIRST, XATTR_FILL_LAST
- 0
-};
+>::value);
// AttrSet range for GrfFormatColl
-sal_uInt16 const aGrfFormatCollSetRange[] = {
+WhichRangesContainer const aGrfFormatCollSetRange(svl::Items<
RES_FRMATR_BEGIN, RES_FRMATR_END-1,
RES_GRFATR_BEGIN, RES_GRFATR_END-1,
- RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
- 0
-};
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1
+>::value);
// AttrSet range for TextNode
-sal_uInt16 const aTextNodeSetRange[] = {
+WhichRangesContainer const aTextNodeSetRange(svl::Items<
RES_CHRATR_BEGIN, RES_CHRATR_END-1,
RES_PARATR_BEGIN, RES_PARATR_END-1,
RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END-1,
@@ -175,20 +172,18 @@ sal_uInt16 const aTextNodeSetRange[] = {
RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
// FillAttribute support (paragraph FillStyle)
- XATTR_FILL_FIRST, XATTR_FILL_LAST,
+ XATTR_FILL_FIRST, XATTR_FILL_LAST
- 0
-};
+>::value);
// AttrSet range for NoTextNode
-sal_uInt16 const aNoTextNodeSetRange[] = {
+WhichRangesContainer const aNoTextNodeSetRange(svl::Items<
RES_FRMATR_BEGIN, RES_FRMATR_END-1,
RES_GRFATR_BEGIN, RES_GRFATR_END-1,
- RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
- 0
-};
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1
+>::value);
-sal_uInt16 const aTableSetRange[] = {
+WhichRangesContainer const aTableSetRange(svl::Items<
RES_FILL_ORDER, RES_FRM_SIZE,
RES_LR_SPACE, RES_BREAK,
RES_HORI_ORIENT, RES_HORI_ORIENT,
@@ -200,11 +195,10 @@ sal_uInt16 const aTableSetRange[] = {
RES_COLLAPSING_BORDERS, RES_COLLAPSING_BORDERS,
// <-- collapsing
RES_FRMATR_GRABBAG, RES_FRMATR_GRABBAG,
- RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
- 0
-};
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1
+>::value);
-sal_uInt16 const aTableLineSetRange[] = {
+WhichRangesContainer const aTableLineSetRange(svl::Items<
RES_FILL_ORDER, RES_FRM_SIZE,
// HasTextChangesOnly
RES_LR_SPACE, RES_UL_SPACE,
@@ -214,11 +208,10 @@ sal_uInt16 const aTableLineSetRange[] = {
RES_BACKGROUND, RES_SHADOW,
RES_ROW_SPLIT, RES_ROW_SPLIT,
RES_FRMATR_GRABBAG, RES_FRMATR_GRABBAG,
- RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
- 0
-};
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1
+>::value);
-sal_uInt16 const aTableBoxSetRange[] = {
+WhichRangesContainer const aTableBoxSetRange(svl::Items<
RES_FILL_ORDER, RES_FRM_SIZE,
RES_LR_SPACE, RES_UL_SPACE,
RES_PROTECT, RES_PROTECT,
@@ -227,42 +220,37 @@ sal_uInt16 const aTableBoxSetRange[] = {
RES_FRAMEDIR, RES_FRAMEDIR,
RES_FRMATR_GRABBAG, RES_FRMATR_GRABBAG,
RES_BOXATR_BEGIN, RES_BOXATR_END-1,
- RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
- 0
-};
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1
+>::value);
// AttrSet range for SwFrameFormat
-sal_uInt16 const aFrameFormatSetRange[] = {
+WhichRangesContainer const aFrameFormatSetRange(svl::Items<
RES_FRMATR_BEGIN, RES_FRMATR_END-1,
RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
// FillAttribute support (TextFrame, OLE, Writer GraphicObject)
- XATTR_FILL_FIRST, XATTR_FILL_LAST,
+ XATTR_FILL_FIRST, XATTR_FILL_LAST
- 0
-};
+>::value);
// AttrSet range for SwCharFormat
-sal_uInt16 const aCharFormatSetRange[] = {
+WhichRangesContainer const aCharFormatSetRange(svl::Items<
RES_CHRATR_BEGIN, RES_CHRATR_END-1,
- RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
- 0
-};
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1
+>::value);
// AttrSet range for character autostyles
-sal_uInt16 const aCharAutoFormatSetRange[] = {
+WhichRangesContainer const aCharAutoFormatSetRange(svl::Items<
RES_CHRATR_BEGIN, RES_CHRATR_END-1,
RES_TXTATR_UNKNOWN_CONTAINER, RES_TXTATR_UNKNOWN_CONTAINER,
- RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
- 0
-};
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1
+>::value);
// AttrSet range for SwPageDescFormat
-sal_uInt16 const aPgFrameFormatSetRange[] = {
+WhichRangesContainer const aPgFrameFormatSetRange(svl::Items<
RES_FRMATR_BEGIN, RES_FRMATR_END-1,
- RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
- 0
-};
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1
+>::value);
// create table for accessing default format attributes
SwDfltAttrTab aAttrTab( POOLATTR_END - POOLATTR_BEGIN, nullptr );
diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx b/sw/source/core/doc/DocumentStylePoolManager.cxx
index 49e399a78a07..858addfb27ec 100644
--- a/sw/source/core/doc/DocumentStylePoolManager.cxx
+++ b/sw/source/core/doc/DocumentStylePoolManager.cxx
@@ -1431,7 +1431,7 @@ SwFormat* DocumentStylePoolManager::GetFormatFromPool( sal_uInt16 nId )
SwFormatsBase* pArray[ 2 ];
sal_uInt16 nArrCnt = 1;
const char* pRCId = nullptr;
- sal_uInt16 const * pWhichRange = nullptr;
+ WhichRangesContainer const * pWhichRange = nullptr;
switch( nId & (COLL_GET_RANGE_BITS + POOLGRP_NOCOLLID) )
{
@@ -1439,7 +1439,7 @@ SwFormat* DocumentStylePoolManager::GetFormatFromPool( sal_uInt16 nId )
{
pArray[0] = m_rDoc.GetCharFormats();
pDeriveFormat = m_rDoc.GetDfltCharFormat();
- pWhichRange = aCharFormatSetRange;
+ pWhichRange = &aCharFormatSetRange;
if (nId >= RES_POOLCHR_HTML_BEGIN && nId < RES_POOLCHR_HTML_END)
pRCId = STR_POOLCHR_HTML_ARY[nId - RES_POOLCHR_HTML_BEGIN];
@@ -1459,7 +1459,7 @@ SwFormat* DocumentStylePoolManager::GetFormatFromPool( sal_uInt16 nId )
pArray[1] = m_rDoc.GetSpzFrameFormats();
pDeriveFormat = m_rDoc.GetDfltFrameFormat();
nArrCnt = 2;
- pWhichRange = aFrameFormatSetRange;
+ pWhichRange = &aFrameFormatSetRange;
// Fault: unknown Format, but a FrameFormat
// -> return the first one
@@ -1491,7 +1491,7 @@ SwFormat* DocumentStylePoolManager::GetFormatFromPool( sal_uInt16 nId )
}
OUString aNm(SwResId(pRCId));
- SwAttrSet aSet( m_rDoc.GetAttrPool(), pWhichRange );
+ SwAttrSet aSet( m_rDoc.GetAttrPool(), pWhichRange ? *pWhichRange : WhichRangesContainer() );
{
bool bIsModified = m_rDoc.getIDocumentState().IsModified();
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index 9efeb5c1ec75..66ca0bb4c3ed 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -307,19 +307,14 @@ void SaveRedlEndPosForRestore::Restore()
}
/// Convert list of ranges of whichIds to a corresponding list of whichIds
-static std::vector<sal_uInt16> lcl_RangesToVector(const sal_uInt16 * pRanges)
+static std::vector<sal_uInt16> lcl_RangesToVector(const WhichRangesContainer& pRanges)
{
std::vector<sal_uInt16> aResult;
- int i = 0;
- while (pRanges[i] != 0)
+ for(const WhichPair& rPair : pRanges)
{
- OSL_ENSURE(pRanges[i+1] != 0, "malformed ranges");
-
- for (sal_uInt16 j = pRanges[i]; j <= pRanges[i+1]; j++)
+ for (sal_uInt16 j = rPair.first; j <= rPair.second; j++)
aResult.push_back(j);
-
- i += 2;
}
return aResult;
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index fd6346b33ffc..d3b742ee9f93 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -1834,19 +1834,17 @@ void SwDoc::SetFormatItemByAutoFormat( const SwPaM& rPam, const SfxItemSet& rSet
}
const sal_Int32 nEnd(rPam.End()->nContent.GetIndex());
- std::vector<sal_uInt16> whichIds;
+ std::vector<WhichPair> whichIds;
SfxItemIter iter(rSet);
for (SfxPoolItem const* pItem = iter.GetCurItem(); pItem; pItem = iter.NextItem())
{
- whichIds.push_back(pItem->Which());
- whichIds.push_back(pItem->Which());
+ whichIds.push_back({pItem->Which(), pItem->Which()});
}
- whichIds.push_back(0);
- SfxItemSet currentSet(GetAttrPool(), whichIds.data());
+ SfxItemSet currentSet(GetAttrPool(), WhichRangesContainer(whichIds.data(), whichIds.size()));
pTNd->GetParaAttr(currentSet, nEnd, nEnd);
- for (size_t i = 0; whichIds[i]; i += 2)
+ for (const WhichPair& rPair : whichIds)
{ // yuk - want to explicitly set the pool defaults too :-/
- currentSet.Put(currentSet.Get(whichIds[i]));
+ currentSet.Put(currentSet.Get(rPair.first));
}
getIDocumentContentOperations().InsertItemSet( rPam, rSet, SetAttrMode::DONTEXPAND );
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index b1ed62e0bccc..53ccf3c902c1 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -844,23 +844,21 @@ void SwDoc::InitTOXTypes()
void SwDoc::ReplaceDefaults(const SwDoc& rSource)
{
// copy property defaults
- const sal_uInt16 aRangeOfDefaults[] =
- {
+ static const WhichRangesContainer aRangeOfDefaults(svl::Items<
RES_CHRATR_BEGIN, RES_CHRATR_END-1,
RES_PARATR_BEGIN, RES_PARATR_END-1,
RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END-1,
RES_FRMATR_BEGIN, RES_FRMATR_END-1,
RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
- XATTR_START, XATTR_END-1,
- 0
- };
+ XATTR_START, XATTR_END-1
+ >::value);
SfxItemSet aNewDefaults(GetAttrPool(), aRangeOfDefaults);
- for (auto nRange = 0; aRangeOfDefaults[nRange] != 0; nRange += 2)
+ for (const WhichPair& rPair : aRangeOfDefaults)
{
- for (sal_uInt16 nWhich = aRangeOfDefaults[nRange];
- nWhich <= aRangeOfDefaults[nRange + 1]; ++nWhich)
+ for (sal_uInt16 nWhich = rPair.first;
+ nWhich <= rPair.second; ++nWhich)
{
const SfxPoolItem& rSourceAttr =
rSource.mpAttrPool->GetDefaultItem(nWhich);
diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx
index 2a078ce5055e..1f6b21645bcc 100644
--- a/sw/source/core/fields/expfld.cxx
+++ b/sw/source/core/fields/expfld.cxx
@@ -985,16 +985,14 @@ sal_Int32 SwGetExpField::GetReferenceTextPos( const SwFormatField& rFormat, SwDo
// now check if sNodeText starts with a non-alphanumeric character plus blanks
sal_uInt16 nSrcpt = g_pBreakIt->GetRealScriptOfText( sNodeText, 0 );
- static const sal_uInt16 nIds[] =
- {
+ static const WhichRangesContainer nIds(svl::Items<
RES_CHRATR_FONT, RES_CHRATR_FONT,
RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE,
RES_CHRATR_CJK_FONT, RES_CHRATR_CJK_FONT,
RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_LANGUAGE,
RES_CHRATR_CTL_FONT, RES_CHRATR_CTL_FONT,
- RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_LANGUAGE,
- 0
- };
+ RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_LANGUAGE
+ >::value);
SwAttrSet aSet(rDoc.GetAttrPool(), nIds);
rTextNode.GetParaAttr(aSet, nRet, nRet+1);
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 605da4a1e1bf..68352c7ff642 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -2516,8 +2516,8 @@ SwFrameFormat::SwFrameFormat(
const char* pFormatNm,
SwFrameFormat *pDrvdFrame,
sal_uInt16 nFormatWhich,
- const sal_uInt16* pWhichRange)
-: SwFormat(rPool, pFormatNm, (pWhichRange ? pWhichRange : aFrameFormatSetRange), pDrvdFrame, nFormatWhich),
+ const WhichRangesContainer* pWhichRange)
+: SwFormat(rPool, pFormatNm, pWhichRange ? pWhichRange : &aFrameFormatSetRange, pDrvdFrame, nFormatWhich),
m_wXObject(),
maFillAttributes(),
m_ffList(nullptr),
@@ -2530,8 +2530,8 @@ SwFrameFormat::SwFrameFormat(
const OUString &rFormatNm,
SwFrameFormat *pDrvdFrame,
sal_uInt16 nFormatWhich,
- const sal_uInt16* pWhichRange)
-: SwFormat(rPool, rFormatNm, (pWhichRange ? pWhichRange : aFrameFormatSetRange), pDrvdFrame, nFormatWhich),
+ const WhichRangesContainer* pWhichRange)
+: SwFormat(rPool, rFormatNm, (pWhichRange ? pWhichRange : &aFrameFormatSetRange), pDrvdFrame, nFormatWhich),
m_wXObject(),
maFillAttributes(),
m_ffList(nullptr),
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index ee509e6b602c..121d9f712bc7 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -222,13 +222,12 @@ private:
};
-sal_uInt16 const aSave_BoxContentSet[] = {
+WhichRangesContainer const aSave_BoxContentSet(svl::Items<
RES_CHRATR_COLOR, RES_CHRATR_CROSSEDOUT,
RES_CHRATR_FONT, RES_CHRATR_FONTSIZE,
RES_CHRATR_POSTURE, RES_CHRATR_POSTURE,
RES_CHRATR_SHADOWED, RES_CHRATR_WEIGHT,
- RES_PARATR_ADJUST, RES_PARATR_ADJUST,
- 0 };
+ RES_PARATR_ADJUST, RES_PARATR_ADJUST>::value);
SwUndoInsTable::SwUndoInsTable( const SwPosition& rPos, sal_uInt16 nCl, sal_uInt16 nRw,
sal_uInt16 nAdj, const SwInsertTableOptions& rInsTableOpts,
@@ -1243,12 +1242,8 @@ void SaveBox::RestoreAttr( SwTableBox& rBox, SaveTable& rSTable )
std::shared_ptr<SfxItemSet> pSet((*m_Ptrs.pContentAttrs)[nSet++]);
if( pSet )
{
- sal_uInt16 const *pRstAttr = aSave_BoxContentSet;
- while( *pRstAttr )
- {
- pCNd->ResetAttr( *pRstAttr, *(pRstAttr+1) );
- pRstAttr += 2;
- }
+ for( const WhichPair& rPair : aSave_BoxContentSet )
+ pCNd->ResetAttr( rPair.first, rPair.second );
pCNd->SetAttr( *pSet );
}
else
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx
index a04341135117..f50cc69cb5b0 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -1331,7 +1331,7 @@ void makeRedline( SwPaM const & rPaM,
{
sal_uInt16 nStylePoolId = USHRT_MAX;
OUString sParaStyleName;
- SfxItemSet aItemSet(rDoc.GetAttrPool(), nullptr);
+ SfxItemSet aItemSet(rDoc.GetAttrPool(), WhichRangesContainer());
for (const auto& [nWhich1, nWhich2] : aWhichPairs)
aItemSet.MergeRange(nWhich1, nWhich2);
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index d7f08efa80e4..6c685a16de9e 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -2707,22 +2707,16 @@ void SwXFrame::attachToRange(uno::Reference<text::XTextRange> const& xTextRange,
SwNode& rNode = pDoc->GetNodes().GetEndOfContent();
SwPaM aPam(rNode);
aPam.Move( fnMoveBackward, GoInDoc );
- static sal_uInt16 const aFrameAttrRange[] =
- {
+ static WhichRangesContainer const aFrameAttrRange(svl::Items<
RES_FRMATR_BEGIN, RES_FRMATR_END-1,
RES_UNKNOWNATR_CONTAINER, RES_UNKNOWNATR_CONTAINER,
// FillAttribute support
XATTR_FILL_FIRST, XATTR_FILL_LAST,
- SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
- 0
- };
- static sal_uInt16 const aGrAttrRange[] =
- {
- RES_GRFATR_BEGIN, RES_GRFATR_END-1,
- 0
- };
+ SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER>::value);
+ static WhichRangesContainer const aGrAttrRange(svl::Items<
+ RES_GRFATR_BEGIN, RES_GRFATR_END-1>::value);
SfxItemSet aGrSet(pDoc->GetAttrPool(), aGrAttrRange );
SfxItemSet aFrameSet(pDoc->GetAttrPool(), aFrameAttrRange );
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index 38bfe951f343..c6a7da8ea41a 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -1771,8 +1771,7 @@ void SwUnoCursorHelper::SetPropertyValues(
OUString aUnknownExMsg, aPropertyVetoExMsg;
// Build set of attributes we want to fetch
- const sal_uInt16 zero = 0;
- SfxItemSet aItemSet(rDoc.GetAttrPool(), &zero);
+ SfxItemSet aItemSet(rDoc.GetAttrPool(), WhichRangesContainer());
std::vector<std::pair<const SfxItemPropertyMapEntry*, const uno::Any&>> aEntries;
aEntries.reserve(rPropertyValues.getLength());
for (const auto& rPropVal : rPropertyValues)
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 724bd28831f4..1729a86c56e9 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -3530,13 +3530,13 @@ uno::Reference< style::XAutoStyle > SwXAutoStyleFamily::insertStyle(
throw uno::RuntimeException();
}
- const sal_uInt16* pRange = nullptr;
+ const WhichRangesContainer* pRange = nullptr;
const SfxItemPropertySet* pPropSet = nullptr;
switch( m_eFamily )
{
case IStyleAccess::AUTO_STYLE_CHAR:
{
- pRange = aCharAutoFormatSetRange;
+ pRange = &aCharAutoFormatSetRange;
pPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_CHAR_AUTO_STYLE);
break;
}
@@ -3548,7 +3548,7 @@ uno::Reference< style::XAutoStyle > SwXAutoStyleFamily::insertStyle(
}
case IStyleAccess::AUTO_STYLE_PARA:
{
- pRange = aTextNodeSetRange; // checked, already added support for [XATTR_FILL_FIRST, XATTR_FILL_LAST]
+ pRange = &aTextNodeSetRange; // checked, already added support for [XATTR_FILL_FIRST, XATTR_FILL_LAST]
pPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_PARA_AUTO_STYLE);
break;
}
@@ -3558,7 +3558,7 @@ uno::Reference< style::XAutoStyle > SwXAutoStyleFamily::insertStyle(
if( !pPropSet)
throw uno::RuntimeException();
- SwAttrSet aSet( m_pDocShell->GetDoc()->GetAttrPool(), pRange );
+ SwAttrSet aSet( m_pDocShell->GetDoc()->GetAttrPool(), pRange ? *pRange : WhichRangesContainer() );
const bool bTakeCareOfDrawingLayerFillStyle(IStyleAccess::AUTO_STYLE_PARA == m_eFamily);
if(!bTakeCareOfDrawingLayerFillStyle)
diff --git a/sw/source/filter/html/htmldrawreader.cxx b/sw/source/filter/html/htmldrawreader.cxx
index 61ab1d493982..cbf09d6ccccd 100644
--- a/sw/source/filter/html/htmldrawreader.cxx
+++ b/sw/source/filter/html/htmldrawreader.cxx
@@ -368,10 +368,10 @@ void SwHTMLParser::NewMarquee( HTMLTable *pCurTable )
eAniDir = SdrTextAniDirection::Right;
// re set the attributes needed for scrolling
- sal_uInt16 const aWhichMap[] { XATTR_FILL_FIRST, XATTR_FILL_LAST,
- SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
- EE_CHAR_START, EE_CHAR_END,
- 0 };
+ static WhichRangesContainer const aWhichMap(svl::Items<
+ XATTR_FILL_FIRST, XATTR_FILL_LAST,
+ SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
+ EE_CHAR_START, EE_CHAR_END>::value);
SfxItemSet aItemSet( pModel->GetItemPool(), aWhichMap );
aItemSet.Put( makeSdrTextAutoGrowWidthItem( false ) );
aItemSet.Put( makeSdrTextAutoGrowHeightItem( true ) );
diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx
index 6c5ec09b2578..c234c58fa5b9 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -3211,17 +3211,15 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
// the table has no content yet, this means the actual table needs
// to be created first
- static sal_uInt16 aWhichIds[] =
- {
+ static const WhichRangesContainer aWhichIds(svl::Items<
RES_PARATR_SPLIT, RES_PARATR_SPLIT,
RES_PAGEDESC, RES_PAGEDESC,
RES_BREAK, RES_BREAK,
RES_BACKGROUND, RES_BACKGROUND,
RES_KEEP, RES_KEEP,
RES_LAYOUT_SPLIT, RES_LAYOUT_SPLIT,
- RES_FRAMEDIR, RES_FRAMEDIR,
- 0
- };
+ RES_FRAMEDIR, RES_FRAMEDIR
+ >::value);
SfxItemSet aItemSet( m_xDoc->GetAttrPool(), aWhichIds );
SvxCSS1PropertyInfo aPropInfo;
diff --git a/sw/source/uibase/app/docshini.cxx b/sw/source/uibase/app/docshini.cxx
index 284d4a84afdd..85039593eb4a 100644
--- a/sw/source/uibase/app/docshini.cxx
+++ b/sw/source/uibase/app/docshini.cxx
@@ -620,19 +620,22 @@ void SwDocShell::SubInitNew()
bool bWeb = dynamic_cast< const SwWebDocShell *>( this ) != nullptr;
- sal_uInt16 nRange[] = {
+ static const WhichRangesContainer nRange1(svl::Items<
+ RES_CHRATR_COLOR, RES_CHRATR_COLOR,
+ RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE,
+ RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_LANGUAGE,
+ RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_LANGUAGE,
+ RES_PARATR_ADJUST, RES_PARATR_ADJUST
+ >::value);
+ static const WhichRangesContainer nRange2(svl::Items<
RES_CHRATR_COLOR, RES_CHRATR_COLOR,
RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE,
RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_LANGUAGE,
RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_LANGUAGE,
RES_PARATR_ADJUST, RES_PARATR_ADJUST,
- 0, 0, 0 };
- if(!bWeb)
- {
- nRange[ SAL_N_ELEMENTS(nRange) - 3 ] = RES_PARATR_TABSTOP;
- nRange[ SAL_N_ELEMENTS(nRange) - 2 ] = RES_PARATR_HYPHENZONE;
- }
- SfxItemSet aDfltSet( m_xDoc->GetAttrPool(), nRange );
+ RES_PARATR_TABSTOP, RES_PARATR_HYPHENZONE
+ >::value);
+ SfxItemSet aDfltSet( m_xDoc->GetAttrPool(), bWeb ? nRange1 : nRange2 );
//! get lingu options without loading lingu DLL
SvtLinguOptions aLinguOpt;
diff --git a/sw/source/uibase/frmdlg/frmmgr.cxx b/sw/source/uibase/frmdlg/frmmgr.cxx
index 2146b05d44e9..35afdc5d0336 100644
--- a/sw/source/uibase/frmdlg/frmmgr.cxx
+++ b/sw/source/uibase/frmdlg/frmmgr.cxx
@@ -46,7 +46,7 @@
using namespace ::com::sun::star;
-static sal_uInt16 aFrameMgrRange[] = {
+const WhichRangesContainer aFrameMgrRange(svl::Items<
RES_FRMATR_BEGIN, RES_FRMATR_END-1, // 87-129
// RotGrfFlyFrame: Support here, but seems not to be
@@ -58,8 +58,8 @@ static sal_uInt16 aFrameMgrRange[] = {
XATTR_FILL_FIRST, XATTR_FILL_LAST, // 1014-1033
SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
- FN_SET_FRM_NAME, FN_SET_FRM_NAME,
- 0};
+ FN_SET_FRM_NAME, FN_SET_FRM_NAME
+ >::value);
// determine frame attributes via Shell
SwFlyFrameAttrMgr::SwFlyFrameAttrMgr( bool bNew, SwWrtShell* pSh, Frmmgr_Type nType, const SvGlobalName* pName ) :
diff --git a/sw/source/uibase/inc/tabsh.hxx b/sw/source/uibase/inc/tabsh.hxx
index c29d822a7a57..691486745cd5 100644
--- a/sw/source/uibase/inc/tabsh.hxx
+++ b/sw/source/uibase/inc/tabsh.hxx
@@ -27,7 +27,7 @@ class SwWrtShell;
SW_DLLPUBLIC void ItemSetToTableParam( const SfxItemSet& rSet, SwWrtShell &rSh );
-SW_DLLPUBLIC const sal_uInt16* SwuiGetUITableAttrRange();
+SW_DLLPUBLIC const WhichRangesContainer& SwuiGetUITableAttrRange();
class SwTableShell: public SwBaseShell
{
diff --git a/sw/source/uibase/lingu/hhcwrp.cxx b/sw/source/uibase/lingu/hhcwrp.cxx
index 372737149744..b5672a5aa211 100644
--- a/sw/source/uibase/lingu/hhcwrp.cxx
+++ b/sw/source/uibase/lingu/hhcwrp.cxx
@@ -315,9 +315,9 @@ void SwHHCWrapper::ChangeText_impl( const OUString &rNewText, bool bKeepAttribut
if (bKeepAttributes)
{
// get item set with all relevant attributes
- sal_uInt16 const aRanges[] {
- RES_CHRATR_BEGIN, RES_FRMATR_END,
- 0, 0, 0 };
+ static const WhichRangesContainer aRanges(svl::Items<
+ RES_CHRATR_BEGIN, RES_FRMATR_END
+ >::value);
SfxItemSet aItemSet( m_rWrtShell.GetAttrPool(), aRanges );
// get all attributes spanning the whole selection in order to
// restore those for the new text
diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx
index 78df3fd11f3e..bb02cda4ccaa 100644
--- a/sw/source/uibase/shells/tabsh.cxx
+++ b/sw/source/uibase/shells/tabsh.cxx
@@ -94,8 +94,7 @@ void SwTableShell::InitInterface_Impl()
}
-const sal_uInt16 aUITableAttrRange[] =
-{
+const WhichRangesContainer aUITableAttrRange(svl::Items<
RES_LR_SPACE, RES_UL_SPACE,
RES_PAGEDESC, RES_BREAK,
RES_BACKGROUND, RES_BACKGROUND,
@@ -118,11 +117,10 @@ const sal_uInt16 aUITableAttrRange[] =
FN_TABLE_BOX_TEXTORIENTATION, FN_TABLE_BOX_TEXTORIENTATION,
FN_PARAM_TABLE_NAME, FN_PARAM_TABLE_NAME,
FN_PARAM_TABLE_HEADLINE, FN_PARAM_TABLE_HEADLINE,
- FN_PARAM_TABLE_SPACE, FN_PARAM_TABLE_SPACE,
- 0
-};
+ FN_PARAM_TABLE_SPACE, FN_PARAM_TABLE_SPACE
+>::value);
-const sal_uInt16* SwuiGetUITableAttrRange()
+const WhichRangesContainer& SwuiGetUITableAttrRange()
{
return aUITableAttrRange;
}
diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx
index a68d90c08207..451eee04eb4f 100644
--- a/sw/source/uibase/uiview/viewsrch.cxx
+++ b/sw/source/uibase/uiview/viewsrch.cxx
@@ -388,8 +388,7 @@ void SwView::ExecSearch(SfxRequest& rReq)
case FID_SEARCH_SEARCHSET:
case FID_SEARCH_REPLACESET:
{
- static const sal_uInt16 aNormalAttr[] =
- {
+ static const WhichRangesContainer aNormalAttr(svl::Items<
/* 0 */ RES_CHRATR_CASEMAP, RES_CHRATR_CASEMAP,
/* 2 */ RES_CHRATR_COLOR, RES_CHRATR_POSTURE,
/* 4 */ RES_CHRATR_SHADOWED, RES_CHRATR_WORDLINEMODE,
@@ -402,9 +401,8 @@ void SwView::ExecSearch(SfxRequest& rReq)
/*18 */ RES_PARATR_REGISTER, RES_PARATR_REGISTER,
/*20 */ RES_PARATR_VERTALIGN, RES_PARATR_VERTALIGN,
/*22 */ RES_LR_SPACE, RES_UL_SPACE,
-/*24 */ SID_ATTR_PARA_MODEL, SID_ATTR_PARA_KEEP,
-/*26 */ 0
- };
+/*24 */ SID_ATTR_PARA_MODEL, SID_ATTR_PARA_KEEP
+ >::value);
SfxItemSet aSet(m_pWrtShell->GetAttrPool(), aNormalAttr);
@@ -740,12 +738,12 @@ sal_uLong SwView::FUNC_Search( const SwSearchOptions& rOptions )
m_pWrtShell->SttSelect();
- static const sal_uInt16 aSearchAttrRange[] = {
+ static const WhichRangesContainer aSearchAttrRange(svl::Items<
RES_CHRATR_BEGIN, RES_CHRATR_END-1,
RES_PARATR_BEGIN, RES_PARATR_END-1,
RES_FRMATR_BEGIN, RES_FRMATR_END-1,
- SID_ATTR_PARA_MODEL, SID_ATTR_PARA_KEEP,
- 0 };
+ SID_ATTR_PARA_MODEL, SID_ATTR_PARA_KEEP
+ >::value);
SfxItemSet aSrchSet( m_pWrtShell->GetAttrPool(), aSearchAttrRange);
if( s_xSearchList && s_xSearchList->Count() )