Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
4b3a535a
Kaydet (Commit)
4b3a535a
authored
Nis 08, 2015
tarafından
Michael Stahl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
svl: prefix members of SfxItemSet
Change-Id: I801aaa8ad9a4ff08dedd2f92b09d98c870c725b8
üst
e3efae3e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
242 additions
and
235 deletions
+242
-235
itemiter.hxx
include/svl/itemiter.hxx
+3
-3
itemset.hxx
include/svl/itemset.hxx
+11
-11
README
svl/README
+2
-2
itemiter.cxx
svl/source/items/itemiter.cxx
+3
-3
itemset.cxx
svl/source/items/itemset.cxx
+223
-216
No files found.
include/svl/itemiter.hxx
Dosyayı görüntüle @
4b3a535a
...
@@ -39,12 +39,12 @@ public:
...
@@ -39,12 +39,12 @@ public:
// falls es diese gibt, returne sie, sonst 0
// falls es diese gibt, returne sie, sonst 0
const
SfxPoolItem
*
FirstItem
()
const
SfxPoolItem
*
FirstItem
()
{
_nAkt
=
_nStt
;
{
_nAkt
=
_nStt
;
return
_rSet
.
_nCount
?
*
(
_rSet
.
_aItems
+
_nAkt
)
:
0
;
}
return
_rSet
.
m_nCount
?
*
(
_rSet
.
m_pItems
+
_nAkt
)
:
nullptr
;
}
const
SfxPoolItem
*
LastItem
()
const
SfxPoolItem
*
LastItem
()
{
_nAkt
=
_nEnd
;
{
_nAkt
=
_nEnd
;
return
_rSet
.
_nCount
?
*
(
_rSet
.
_aItems
+
_nAkt
)
:
0
;
}
return
_rSet
.
m_nCount
?
*
(
_rSet
.
m_pItems
+
_nAkt
)
:
nullptr
;
}
const
SfxPoolItem
*
GetCurItem
()
const
SfxPoolItem
*
GetCurItem
()
{
return
_rSet
.
_nCount
?
*
(
_rSet
.
_aItems
+
_nAkt
)
:
0
;
}
{
return
_rSet
.
m_nCount
?
*
(
_rSet
.
m_pItems
+
_nAkt
)
:
nullptr
;
}
const
SfxPoolItem
*
NextItem
();
const
SfxPoolItem
*
NextItem
();
bool
IsAtStart
()
const
{
return
_nAkt
==
_nStt
;
}
bool
IsAtStart
()
const
{
return
_nAkt
==
_nStt
;
}
...
...
include/svl/itemset.hxx
Dosyayı görüntüle @
4b3a535a
...
@@ -41,11 +41,11 @@ class SVL_DLLPUBLIC SfxItemSet
...
@@ -41,11 +41,11 @@ class SVL_DLLPUBLIC SfxItemSet
{
{
friend
class
SfxItemIter
;
friend
class
SfxItemIter
;
SfxItemPool
*
_pPool
;
// pool, which is used
SfxItemPool
*
m_pPool
;
///< pool that stores the items
const
SfxItemSet
*
_pParent
;
//
derivation
const
SfxItemSet
*
m_pParent
;
///<
derivation
SfxItemArray
_aItems
;
// field
of items
SfxItemArray
m_pItems
;
///< array
of items
sal_uInt16
*
_pWhichRanges
;
//
array of Which Ranges
sal_uInt16
*
m_pWhichRanges
;
///<
array of Which Ranges
sal_uInt16
_nCount
;
//
number of items
sal_uInt16
m_nCount
;
///<
number of items
friend
class
SfxItemPoolCache
;
friend
class
SfxItemPoolCache
;
friend
class
SfxAllItemSet
;
friend
class
SfxAllItemSet
;
...
@@ -57,7 +57,7 @@ private:
...
@@ -57,7 +57,7 @@ private:
SVL_DLLPRIVATE
void
InitRanges_Impl
(
sal_uInt16
nWh1
,
sal_uInt16
nWh2
);
SVL_DLLPRIVATE
void
InitRanges_Impl
(
sal_uInt16
nWh1
,
sal_uInt16
nWh2
);
public
:
public
:
SfxItemArray
GetItems_Impl
()
const
{
return
_a
Items
;
}
SfxItemArray
GetItems_Impl
()
const
{
return
m_p
Items
;
}
private
:
private
:
const
SfxItemSet
&
operator
=
(
const
SfxItemSet
&
)
SAL_DELETED_FUNCTION
;
const
SfxItemSet
&
operator
=
(
const
SfxItemSet
&
)
SAL_DELETED_FUNCTION
;
...
@@ -80,7 +80,7 @@ public:
...
@@ -80,7 +80,7 @@ public:
virtual
SfxItemSet
*
Clone
(
bool
bItems
=
true
,
SfxItemPool
*
pToPool
=
0
)
const
;
virtual
SfxItemSet
*
Clone
(
bool
bItems
=
true
,
SfxItemPool
*
pToPool
=
0
)
const
;
// Get number of items
// Get number of items
sal_uInt16
Count
()
const
{
return
_nCount
;
}
sal_uInt16
Count
()
const
{
return
m
_nCount
;
}
sal_uInt16
TotalCount
()
const
;
sal_uInt16
TotalCount
()
const
;
const
SfxPoolItem
&
Get
(
sal_uInt16
nWhich
,
bool
bSrchInParent
=
true
)
const
;
const
SfxPoolItem
&
Get
(
sal_uInt16
nWhich
,
bool
bSrchInParent
=
true
)
const
;
...
@@ -123,11 +123,11 @@ public:
...
@@ -123,11 +123,11 @@ public:
void
Differentiate
(
const
SfxItemSet
&
rSet
);
void
Differentiate
(
const
SfxItemSet
&
rSet
);
void
MergeValue
(
const
SfxPoolItem
&
rItem
,
bool
bOverwriteDefaults
=
false
);
void
MergeValue
(
const
SfxPoolItem
&
rItem
,
bool
bOverwriteDefaults
=
false
);
SfxItemPool
*
GetPool
()
const
{
return
_pPool
;
}
SfxItemPool
*
GetPool
()
const
{
return
m
_pPool
;
}
const
sal_uInt16
*
GetRanges
()
const
{
return
_pWhichRanges
;
}
const
sal_uInt16
*
GetRanges
()
const
{
return
m
_pWhichRanges
;
}
void
SetRanges
(
const
sal_uInt16
*
pRanges
);
void
SetRanges
(
const
sal_uInt16
*
pRanges
);
void
MergeRange
(
sal_uInt16
nFrom
,
sal_uInt16
nTo
);
void
MergeRange
(
sal_uInt16
nFrom
,
sal_uInt16
nTo
);
const
SfxItemSet
*
GetParent
()
const
{
return
_pParent
;
}
const
SfxItemSet
*
GetParent
()
const
{
return
m
_pParent
;
}
SvStream
&
Load
(
SvStream
&
,
bool
bDirect
=
false
,
SvStream
&
Load
(
SvStream
&
,
bool
bDirect
=
false
,
const
SfxItemPool
*
pRefPool
=
0
);
const
SfxItemPool
*
pRefPool
=
0
);
...
@@ -141,7 +141,7 @@ public:
...
@@ -141,7 +141,7 @@ public:
inline
void
SfxItemSet
::
SetParent
(
const
SfxItemSet
*
pNew
)
inline
void
SfxItemSet
::
SetParent
(
const
SfxItemSet
*
pNew
)
{
{
_pParent
=
pNew
;
m
_pParent
=
pNew
;
}
}
class
SVL_DLLPUBLIC
SfxAllItemSet
:
public
SfxItemSet
class
SVL_DLLPUBLIC
SfxAllItemSet
:
public
SfxItemSet
...
...
svl/README
Dosyayı görüntüle @
4b3a535a
...
@@ -44,7 +44,7 @@ set's SfxItemPool, and for poolable items only a single instance that
...
@@ -44,7 +44,7 @@ set's SfxItemPool, and for poolable items only a single instance that
compares equal under the predicate operator== will be stored in the pool,
compares equal under the predicate operator== will be stored in the pool,
regardless of how many sets contain it, thus conserving memory.
regardless of how many sets contain it, thus conserving memory.
There are members _pWhichRanges for the valid ranges (as pairs of WhichIds),
There are members
m
_pWhichRanges for the valid ranges (as pairs of WhichIds),
_nCount for the number of items contained, and _a
Items for the pointers to
m_nCount for the number of items contained, and m_p
Items for the pointers to
the actual items.
the actual items.
svl/source/items/itemiter.cxx
Dosyayı görüntüle @
4b3a535a
...
@@ -25,14 +25,14 @@
...
@@ -25,14 +25,14 @@
SfxItemIter
::
SfxItemIter
(
const
SfxItemSet
&
rItemSet
)
SfxItemIter
::
SfxItemIter
(
const
SfxItemSet
&
rItemSet
)
:
_rSet
(
rItemSet
)
:
_rSet
(
rItemSet
)
{
{
if
(
!
_rSet
.
_nCount
)
if
(
!
_rSet
.
m_nCount
)
{
{
_nStt
=
1
;
_nStt
=
1
;
_nEnd
=
0
;
_nEnd
=
0
;
}
}
else
else
{
{
SfxItemArray
ppFnd
=
_rSet
.
_a
Items
;
SfxItemArray
ppFnd
=
_rSet
.
m_p
Items
;
// Find the first Item that is set
// Find the first Item that is set
for
(
_nStt
=
0
;
!*
(
ppFnd
+
_nStt
);
++
_nStt
)
for
(
_nStt
=
0
;
!*
(
ppFnd
+
_nStt
);
++
_nStt
)
...
@@ -53,7 +53,7 @@ SfxItemIter::~SfxItemIter()
...
@@ -53,7 +53,7 @@ SfxItemIter::~SfxItemIter()
const
SfxPoolItem
*
SfxItemIter
::
NextItem
()
const
SfxPoolItem
*
SfxItemIter
::
NextItem
()
{
{
SfxItemArray
ppFnd
=
_rSet
.
_a
Items
;
SfxItemArray
ppFnd
=
_rSet
.
m_p
Items
;
if
(
_nAkt
<
_nEnd
)
if
(
_nAkt
<
_nEnd
)
{
{
...
...
svl/source/items/itemset.cxx
Dosyayı görüntüle @
4b3a535a
...
@@ -51,7 +51,7 @@ const sal_Char *DbgCheckItemSet( const void* pVoid )
...
@@ -51,7 +51,7 @@ const sal_Char *DbgCheckItemSet( const void* pVoid )
sal_uInt16
nCount
=
0
,
n
=
0
;
sal_uInt16
nCount
=
0
,
n
=
0
;
for
(
sal_uInt16
nWh
=
aIter
.
FirstWhich
();
nWh
;
nWh
=
aIter
.
NextWhich
(),
++
n
)
for
(
sal_uInt16
nWh
=
aIter
.
FirstWhich
();
nWh
;
nWh
=
aIter
.
NextWhich
(),
++
n
)
{
{
const
SfxPoolItem
*
pItem
=
pSet
->
_a
Items
[
n
];
const
SfxPoolItem
*
pItem
=
pSet
->
m_p
Items
[
n
];
if
(
pItem
)
if
(
pItem
)
{
{
++
nCount
;
++
nCount
;
...
@@ -66,7 +66,7 @@ const sal_Char *DbgCheckItemSet( const void* pVoid )
...
@@ -66,7 +66,7 @@ const sal_Char *DbgCheckItemSet( const void* pVoid )
}
}
}
}
assert
(
pSet
->
_nCount
==
nCount
);
assert
(
pSet
->
m
_nCount
==
nCount
);
return
0
;
return
0
;
}
}
...
@@ -86,9 +86,9 @@ SfxItemSet::SfxItemSet
...
@@ -86,9 +86,9 @@ SfxItemSet::SfxItemSet
added to this SfxItemSet */
added to this SfxItemSet */
bool
bTotalRanges
/* Take over complete pool ranges? */
bool
bTotalRanges
/* Take over complete pool ranges? */
)
)
:
_pPool
(
&
rPool
),
:
m_pPool
(
&
rPool
)
_pParent
(
0
),
,
m_pParent
(
nullptr
)
_nCount
(
0
)
,
m_nCount
(
0
)
{
{
// DBG_ASSERT( bTotalRanges || abs( &bTotalRanges - this ) < 1000,
// DBG_ASSERT( bTotalRanges || abs( &bTotalRanges - this ) < 1000,
// "please use suitable ranges" );
// "please use suitable ranges" );
...
@@ -99,22 +99,22 @@ SfxItemSet::SfxItemSet
...
@@ -99,22 +99,22 @@ SfxItemSet::SfxItemSet
(
void
)
bTotalRanges
;
// avoid warnings
(
void
)
bTotalRanges
;
// avoid warnings
#endif
#endif
_pWhichRanges
=
const_cast
<
sal_uInt16
*>
(
_pPool
->
GetFrozenIdRanges
());
m_pWhichRanges
=
const_cast
<
sal_uInt16
*>
(
m
_pPool
->
GetFrozenIdRanges
());
assert
(
_pWhichRanges
&&
"don't create ItemSets with full range before FreezeIdRanges()"
);
assert
(
m
_pWhichRanges
&&
"don't create ItemSets with full range before FreezeIdRanges()"
);
if
(
!
_pWhichRanges
)
if
(
!
m_pWhichRanges
)
_pPool
->
FillItemIdRanges_Impl
(
_pWhichRanges
);
m_pPool
->
FillItemIdRanges_Impl
(
m
_pWhichRanges
);
const
sal_uInt16
nSize
=
TotalCount
();
const
sal_uInt16
nSize
=
TotalCount
();
_a
Items
=
new
const
SfxPoolItem
*
[
nSize
];
m_p
Items
=
new
const
SfxPoolItem
*
[
nSize
];
memset
(
(
void
*
)
_aItems
,
0
,
nSize
*
sizeof
(
SfxPoolItem
*
)
);
memset
(
static_cast
<
void
*>
(
m_pItems
),
0
,
nSize
*
sizeof
(
SfxPoolItem
*
)
);
}
}
SfxItemSet
::
SfxItemSet
(
SfxItemPool
&
rPool
,
sal_uInt16
nWhich1
,
sal_uInt16
nWhich2
)
:
SfxItemSet
::
SfxItemSet
(
SfxItemPool
&
rPool
,
sal_uInt16
nWhich1
,
sal_uInt16
nWhich2
)
_pPool
(
&
rPool
),
:
m_pPool
(
&
rPool
)
_pParent
(
0
),
,
m_pParent
(
nullptr
)
_nCount
(
0
)
,
m_nCount
(
0
)
{
{
assert
(
nWhich1
<=
nWhich2
);
assert
(
nWhich1
<=
nWhich2
);
...
@@ -125,32 +125,32 @@ SfxItemSet::SfxItemSet( SfxItemPool& rPool, sal_uInt16 nWhich1, sal_uInt16 nWhic
...
@@ -125,32 +125,32 @@ SfxItemSet::SfxItemSet( SfxItemPool& rPool, sal_uInt16 nWhich1, sal_uInt16 nWhic
void
SfxItemSet
::
InitRanges_Impl
(
sal_uInt16
nWh1
,
sal_uInt16
nWh2
)
void
SfxItemSet
::
InitRanges_Impl
(
sal_uInt16
nWh1
,
sal_uInt16
nWh2
)
{
{
_pWhichRanges
=
new
sal_uInt16
[
3
];
m
_pWhichRanges
=
new
sal_uInt16
[
3
];
*
(
_pWhichRanges
+
0
)
=
nWh1
;
*
(
m
_pWhichRanges
+
0
)
=
nWh1
;
*
(
_pWhichRanges
+
1
)
=
nWh2
;
*
(
m
_pWhichRanges
+
1
)
=
nWh2
;
*
(
_pWhichRanges
+
2
)
=
0
;
*
(
m
_pWhichRanges
+
2
)
=
0
;
const
sal_uInt16
nRg
=
nWh2
-
nWh1
+
1
;
const
sal_uInt16
nRg
=
nWh2
-
nWh1
+
1
;
_a
Items
=
new
const
SfxPoolItem
*
[
nRg
];
m_p
Items
=
new
const
SfxPoolItem
*
[
nRg
];
memset
(
(
void
*
)
_aItems
,
0
,
nRg
*
sizeof
(
SfxPoolItem
*
)
);
memset
(
static_cast
<
void
*>
(
m_pItems
),
0
,
nRg
*
sizeof
(
SfxPoolItem
*
)
);
}
}
void
SfxItemSet
::
InitRanges_Impl
(
va_list
pArgs
,
sal_uInt16
nWh1
,
sal_uInt16
nWh2
,
sal_uInt16
nNull
)
void
SfxItemSet
::
InitRanges_Impl
(
va_list
pArgs
,
sal_uInt16
nWh1
,
sal_uInt16
nWh2
,
sal_uInt16
nNull
)
{
{
sal_uInt16
nSize
=
InitializeRanges_Impl
(
_pWhichRanges
,
pArgs
,
nWh1
,
nWh2
,
nNull
);
sal_uInt16
nSize
=
InitializeRanges_Impl
(
m_pWhichRanges
,
pArgs
,
nWh1
,
nWh2
,
nNull
);
_a
Items
=
new
const
SfxPoolItem
*
[
nSize
];
m_p
Items
=
new
const
SfxPoolItem
*
[
nSize
];
memset
(
(
void
*
)
_aItems
,
0
,
sizeof
(
SfxPoolItem
*
)
*
nSize
);
memset
(
static_cast
<
void
*>
(
m_pItems
),
0
,
sizeof
(
SfxPoolItem
*
)
*
nSize
);
}
}
SfxItemSet
::
SfxItemSet
(
SfxItemPool
&
rPool
,
SfxItemSet
::
SfxItemSet
(
SfxItemPool
&
rPool
,
USHORT_ARG
nWh1
,
USHORT_ARG
nWh2
,
USHORT_ARG
nNull
,
...
)
:
USHORT_ARG
nWh1
,
USHORT_ARG
nWh2
,
USHORT_ARG
nNull
,
...)
_pPool
(
&
rPool
),
:
m_pPool
(
&
rPool
)
_pParent
(
0
),
,
m_pParent
(
nullptr
)
_pWhichRanges
(
0
),
,
m_pWhichRanges
(
nullptr
)
_nCount
(
0
)
,
m_nCount
(
0
)
{
{
assert
(
nWh1
<=
nWh2
);
assert
(
nWh1
<=
nWh2
);
...
@@ -181,54 +181,54 @@ void SfxItemSet::InitRanges_Impl(const sal_uInt16 *pWhichPairTable)
...
@@ -181,54 +181,54 @@ void SfxItemSet::InitRanges_Impl(const sal_uInt16 *pWhichPairTable)
pPtr
+=
2
;
pPtr
+=
2
;
}
}
_a
Items
=
new
const
SfxPoolItem
*
[
nCnt
];
m_p
Items
=
new
const
SfxPoolItem
*
[
nCnt
];
memset
(
(
void
*
)
_aItems
,
0
,
sizeof
(
SfxPoolItem
*
)
*
nCnt
);
memset
(
static_cast
<
void
*>
(
m_pItems
),
0
,
sizeof
(
SfxPoolItem
*
)
*
nCnt
);
std
::
ptrdiff_t
cnt
=
pPtr
-
pWhichPairTable
+
1
;
std
::
ptrdiff_t
cnt
=
pPtr
-
pWhichPairTable
+
1
;
_pWhichRanges
=
new
sal_uInt16
[
cnt
];
m
_pWhichRanges
=
new
sal_uInt16
[
cnt
];
memcpy
(
_pWhichRanges
,
pWhichPairTable
,
sizeof
(
sal_uInt16
)
*
cnt
);
memcpy
(
m
_pWhichRanges
,
pWhichPairTable
,
sizeof
(
sal_uInt16
)
*
cnt
);
}
}
SfxItemSet
::
SfxItemSet
(
SfxItemPool
&
rPool
,
const
sal_uInt16
*
pWhichPairTable
)
SfxItemSet
::
SfxItemSet
(
SfxItemPool
&
rPool
,
const
sal_uInt16
*
pWhichPairTable
)
:
_pPool
(
&
rPool
)
:
m
_pPool
(
&
rPool
)
,
_pParent
(
0
)
,
m_pParent
(
nullptr
)
,
_aItems
(
0
)
,
m_pItems
(
nullptr
)
,
_pWhichRanges
(
0
)
,
m_pWhichRanges
(
nullptr
)
,
_nCount
(
0
)
,
m
_nCount
(
0
)
{
{
// pWhichPairTable == 0 ist f"ur das SfxAllEnumItemSet
// pWhichPairTable == 0 ist f"ur das SfxAllEnumItemSet
if
(
pWhichPairTable
)
if
(
pWhichPairTable
)
InitRanges_Impl
(
pWhichPairTable
);
InitRanges_Impl
(
pWhichPairTable
);
}
}
SfxItemSet
::
SfxItemSet
(
const
SfxItemSet
&
rASet
)
:
SfxItemSet
::
SfxItemSet
(
const
SfxItemSet
&
rASet
)
_pPool
(
rASet
.
_pPool
),
:
m_pPool
(
rASet
.
m_pPool
)
_pParent
(
rASet
.
_pParent
),
,
m_pParent
(
rASet
.
m_pParent
)
_nCount
(
rASet
.
_nCount
)
,
m_nCount
(
rASet
.
m
_nCount
)
{
{
// Calculate the attribute count
// Calculate the attribute count
sal_uInt16
nCnt
=
0
;
sal_uInt16
nCnt
=
0
;
sal_uInt16
*
pPtr
=
rASet
.
_pWhichRanges
;
sal_uInt16
*
pPtr
=
rASet
.
m
_pWhichRanges
;
while
(
*
pPtr
)
while
(
*
pPtr
)
{
{
nCnt
+=
(
*
(
pPtr
+
1
)
-
*
pPtr
)
+
1
;
nCnt
+=
(
*
(
pPtr
+
1
)
-
*
pPtr
)
+
1
;
pPtr
+=
2
;
pPtr
+=
2
;
}
}
_a
Items
=
new
const
SfxPoolItem
*
[
nCnt
];
m_p
Items
=
new
const
SfxPoolItem
*
[
nCnt
];
// Copy attributes
// Copy attributes
SfxItemArray
ppDst
=
_aItems
,
ppSrc
=
rASet
.
_a
Items
;
SfxItemArray
ppDst
=
m_pItems
,
ppSrc
=
rASet
.
m_p
Items
;
for
(
sal_uInt16
n
=
nCnt
;
n
;
--
n
,
++
ppDst
,
++
ppSrc
)
for
(
sal_uInt16
n
=
nCnt
;
n
;
--
n
,
++
ppDst
,
++
ppSrc
)
if
(
0
==
*
ppSrc
||
// Current Default?
if
(
0
==
*
ppSrc
||
// Current Default?
IsInvalidItem
(
*
ppSrc
)
||
// DontCare?
IsInvalidItem
(
*
ppSrc
)
||
// DontCare?
IsStaticDefaultItem
(
*
ppSrc
)
)
// Defaults that are not to be pooled?
IsStaticDefaultItem
(
*
ppSrc
)
)
// Defaults that are not to be pooled?
// Just copy the pointer
// Just copy the pointer
*
ppDst
=
*
ppSrc
;
*
ppDst
=
*
ppSrc
;
else
if
(
_pPool
->
IsItemFlag
(
**
ppSrc
,
SFX_ITEM_POOLABLE
)
)
else
if
(
m_pPool
->
IsItemFlag
(
**
ppSrc
,
SFX_ITEM_POOLABLE
)
)
{
{
// Just copy the pointer and increase RefCount
// Just copy the pointer and increase RefCount
*
ppDst
=
*
ppSrc
;
*
ppDst
=
*
ppSrc
;
...
@@ -238,12 +238,12 @@ SfxItemSet::SfxItemSet( const SfxItemSet& rASet ):
...
@@ -238,12 +238,12 @@ SfxItemSet::SfxItemSet( const SfxItemSet& rASet ):
*
ppDst
=
(
*
ppSrc
)
->
Clone
();
*
ppDst
=
(
*
ppSrc
)
->
Clone
();
else
else
// !IsPoolable() => assign via Pool
// !IsPoolable() => assign via Pool
*
ppDst
=
&
_pPool
->
Put
(
**
ppSrc
);
*
ppDst
=
&
m
_pPool
->
Put
(
**
ppSrc
);
// Copy the WhichRanges
// Copy the WhichRanges
std
::
ptrdiff_t
cnt
=
pPtr
-
rASet
.
_pWhichRanges
+
1
;
std
::
ptrdiff_t
cnt
=
pPtr
-
rASet
.
m
_pWhichRanges
+
1
;
_pWhichRanges
=
new
sal_uInt16
[
cnt
];
m
_pWhichRanges
=
new
sal_uInt16
[
cnt
];
memcpy
(
_pWhichRanges
,
rASet
.
_pWhichRanges
,
sizeof
(
sal_uInt16
)
*
cnt
);
memcpy
(
m_pWhichRanges
,
rASet
.
m
_pWhichRanges
,
sizeof
(
sal_uInt16
)
*
cnt
);
}
}
...
@@ -253,7 +253,7 @@ SfxItemSet::~SfxItemSet()
...
@@ -253,7 +253,7 @@ SfxItemSet::~SfxItemSet()
sal_uInt16
nCount
=
TotalCount
();
sal_uInt16
nCount
=
TotalCount
();
if
(
Count
()
)
if
(
Count
()
)
{
{
SfxItemArray
ppFnd
=
_a
Items
;
SfxItemArray
ppFnd
=
m_p
Items
;
for
(
sal_uInt16
nCnt
=
nCount
;
nCnt
;
--
nCnt
,
++
ppFnd
)
for
(
sal_uInt16
nCnt
=
nCount
;
nCnt
;
--
nCnt
,
++
ppFnd
)
if
(
*
ppFnd
&&
!
IsInvalidItem
(
*
ppFnd
)
)
if
(
*
ppFnd
&&
!
IsInvalidItem
(
*
ppFnd
)
)
{
{
...
@@ -266,16 +266,16 @@ SfxItemSet::~SfxItemSet()
...
@@ -266,16 +266,16 @@ SfxItemSet::~SfxItemSet()
else
else
if
(
!
IsDefaultItem
(
*
ppFnd
)
)
if
(
!
IsDefaultItem
(
*
ppFnd
)
)
// Delete from Pool
// Delete from Pool
_pPool
->
Remove
(
**
ppFnd
);
m
_pPool
->
Remove
(
**
ppFnd
);
}
}
}
}
}
}
// FIXME: could be delete[] (SfxPoolItem **)
_a
Items;
// FIXME: could be delete[] (SfxPoolItem **)
m_p
Items;
delete
[]
_a
Items
;
delete
[]
m_p
Items
;
if
(
_pWhichRanges
!=
_pPool
->
GetFrozenIdRanges
()
)
if
(
m_pWhichRanges
!=
m_pPool
->
GetFrozenIdRanges
()
)
delete
[]
_pWhichRanges
;
delete
[]
m
_pWhichRanges
;
_pWhichRanges
=
0
;
// for invariant-testing
m_pWhichRanges
=
nullptr
;
// for invariant-testing
}
}
...
@@ -288,11 +288,11 @@ sal_uInt16 SfxItemSet::ClearItem( sal_uInt16 nWhich )
...
@@ -288,11 +288,11 @@ sal_uInt16 SfxItemSet::ClearItem( sal_uInt16 nWhich )
return
0
;
return
0
;
sal_uInt16
nDel
=
0
;
sal_uInt16
nDel
=
0
;
SfxItemArray
ppFnd
=
_a
Items
;
SfxItemArray
ppFnd
=
m_p
Items
;
if
(
nWhich
)
if
(
nWhich
)
{
{
const
sal_uInt16
*
pPtr
=
_pWhichRanges
;
const
sal_uInt16
*
pPtr
=
m
_pWhichRanges
;
while
(
*
pPtr
)
while
(
*
pPtr
)
{
{
// Within this range?
// Within this range?
...
@@ -303,7 +303,7 @@ sal_uInt16 SfxItemSet::ClearItem( sal_uInt16 nWhich )
...
@@ -303,7 +303,7 @@ sal_uInt16 SfxItemSet::ClearItem( sal_uInt16 nWhich )
if
(
*
ppFnd
)
if
(
*
ppFnd
)
{
{
// Due to the assertions in the sub calls, we need to do the following
// Due to the assertions in the sub calls, we need to do the following
--
_nCount
;
--
m
_nCount
;
const
SfxPoolItem
*
pItemToClear
=
*
ppFnd
;
const
SfxPoolItem
*
pItemToClear
=
*
ppFnd
;
*
ppFnd
=
0
;
*
ppFnd
=
0
;
...
@@ -311,14 +311,14 @@ sal_uInt16 SfxItemSet::ClearItem( sal_uInt16 nWhich )
...
@@ -311,14 +311,14 @@ sal_uInt16 SfxItemSet::ClearItem( sal_uInt16 nWhich )
{
{
if
(
nWhich
<=
SFX_WHICH_MAX
)
if
(
nWhich
<=
SFX_WHICH_MAX
)
{
{
const
SfxPoolItem
&
rNew
=
_pParent
const
SfxPoolItem
&
rNew
=
m
_pParent
?
_pParent
->
Get
(
nWhich
,
true
)
?
m
_pParent
->
Get
(
nWhich
,
true
)
:
_pPool
->
GetDefaultItem
(
nWhich
);
:
m
_pPool
->
GetDefaultItem
(
nWhich
);
Changed
(
*
pItemToClear
,
rNew
);
Changed
(
*
pItemToClear
,
rNew
);
}
}
if
(
pItemToClear
->
Which
()
)
if
(
pItemToClear
->
Which
()
)
_pPool
->
Remove
(
*
pItemToClear
);
m
_pPool
->
Remove
(
*
pItemToClear
);
}
}
++
nDel
;
++
nDel
;
}
}
...
@@ -332,16 +332,16 @@ sal_uInt16 SfxItemSet::ClearItem( sal_uInt16 nWhich )
...
@@ -332,16 +332,16 @@ sal_uInt16 SfxItemSet::ClearItem( sal_uInt16 nWhich )
}
}
else
else
{
{
nDel
=
_nCount
;
nDel
=
m
_nCount
;
sal_uInt16
*
pPtr
=
_pWhichRanges
;
sal_uInt16
*
pPtr
=
m
_pWhichRanges
;
while
(
*
pPtr
)
while
(
*
pPtr
)
{
{
for
(
nWhich
=
*
pPtr
;
nWhich
<=
*
(
pPtr
+
1
);
++
nWhich
,
++
ppFnd
)
for
(
nWhich
=
*
pPtr
;
nWhich
<=
*
(
pPtr
+
1
);
++
nWhich
,
++
ppFnd
)
if
(
*
ppFnd
)
if
(
*
ppFnd
)
{
{
// Due to the assertions in the sub calls, we need to do this
// Due to the assertions in the sub calls, we need to do this
--
_nCount
;
--
m
_nCount
;
const
SfxPoolItem
*
pItemToClear
=
*
ppFnd
;
const
SfxPoolItem
*
pItemToClear
=
*
ppFnd
;
*
ppFnd
=
0
;
*
ppFnd
=
0
;
...
@@ -349,9 +349,9 @@ sal_uInt16 SfxItemSet::ClearItem( sal_uInt16 nWhich )
...
@@ -349,9 +349,9 @@ sal_uInt16 SfxItemSet::ClearItem( sal_uInt16 nWhich )
{
{
if
(
nWhich
<=
SFX_WHICH_MAX
)
if
(
nWhich
<=
SFX_WHICH_MAX
)
{
{
const
SfxPoolItem
&
rNew
=
_pParent
const
SfxPoolItem
&
rNew
=
m
_pParent
?
_pParent
->
Get
(
nWhich
,
true
)
?
m
_pParent
->
Get
(
nWhich
,
true
)
:
_pPool
->
GetDefaultItem
(
nWhich
);
:
m
_pPool
->
GetDefaultItem
(
nWhich
);
Changed
(
*
pItemToClear
,
rNew
);
Changed
(
*
pItemToClear
,
rNew
);
}
}
...
@@ -366,7 +366,7 @@ sal_uInt16 SfxItemSet::ClearItem( sal_uInt16 nWhich )
...
@@ -366,7 +366,7 @@ sal_uInt16 SfxItemSet::ClearItem( sal_uInt16 nWhich )
else
else
{
{
// remove item from pool
// remove item from pool
_pPool
->
Remove
(
*
pItemToClear
);
m
_pPool
->
Remove
(
*
pItemToClear
);
}
}
}
}
}
}
...
@@ -380,14 +380,14 @@ sal_uInt16 SfxItemSet::ClearItem( sal_uInt16 nWhich )
...
@@ -380,14 +380,14 @@ sal_uInt16 SfxItemSet::ClearItem( sal_uInt16 nWhich )
void
SfxItemSet
::
ClearInvalidItems
(
bool
bHardDefault
)
void
SfxItemSet
::
ClearInvalidItems
(
bool
bHardDefault
)
{
{
sal_uInt16
*
pPtr
=
_pWhichRanges
;
sal_uInt16
*
pPtr
=
m
_pWhichRanges
;
SfxItemArray
ppFnd
=
_a
Items
;
SfxItemArray
ppFnd
=
m_p
Items
;
if
(
bHardDefault
)
if
(
bHardDefault
)
while
(
*
pPtr
)
while
(
*
pPtr
)
{
{
for
(
sal_uInt16
nWhich
=
*
pPtr
;
nWhich
<=
*
(
pPtr
+
1
);
++
nWhich
,
++
ppFnd
)
for
(
sal_uInt16
nWhich
=
*
pPtr
;
nWhich
<=
*
(
pPtr
+
1
);
++
nWhich
,
++
ppFnd
)
if
(
IsInvalidItem
(
*
ppFnd
)
)
if
(
IsInvalidItem
(
*
ppFnd
)
)
*
ppFnd
=
&
_pPool
->
Put
(
_pPool
->
GetDefaultItem
(
nWhich
)
);
*
ppFnd
=
&
m_pPool
->
Put
(
m
_pPool
->
GetDefaultItem
(
nWhich
)
);
pPtr
+=
2
;
pPtr
+=
2
;
}
}
else
else
...
@@ -397,7 +397,7 @@ void SfxItemSet::ClearInvalidItems( bool bHardDefault )
...
@@ -397,7 +397,7 @@ void SfxItemSet::ClearInvalidItems( bool bHardDefault )
if
(
IsInvalidItem
(
*
ppFnd
)
)
if
(
IsInvalidItem
(
*
ppFnd
)
)
{
{
*
ppFnd
=
0
;
*
ppFnd
=
0
;
--
_nCount
;
--
m
_nCount
;
}
}
pPtr
+=
2
;
pPtr
+=
2
;
}
}
...
@@ -405,15 +405,16 @@ void SfxItemSet::ClearInvalidItems( bool bHardDefault )
...
@@ -405,15 +405,16 @@ void SfxItemSet::ClearInvalidItems( bool bHardDefault )
void
SfxItemSet
::
InvalidateDefaultItems
()
void
SfxItemSet
::
InvalidateDefaultItems
()
{
{
sal_uInt16
*
pPtr
=
_pWhichRanges
;
sal_uInt16
*
pPtr
=
m
_pWhichRanges
;
SfxItemArray
ppFnd
=
_a
Items
;
SfxItemArray
ppFnd
=
m_p
Items
;
while
(
*
pPtr
)
while
(
*
pPtr
)
{
{
for
(
sal_uInt16
nWhich
=
*
pPtr
;
nWhich
<=
*
(
pPtr
+
1
);
++
nWhich
,
++
ppFnd
)
for
(
sal_uInt16
nWhich
=
*
pPtr
;
nWhich
<=
*
(
pPtr
+
1
);
++
nWhich
,
++
ppFnd
)
if
(
*
ppFnd
&&
*
ppFnd
!=
reinterpret_cast
<
SfxPoolItem
*>
(
-
1
)
&&
**
ppFnd
==
_pPool
->
GetDefaultItem
(
nWhich
)
)
if
(
*
ppFnd
&&
*
ppFnd
!=
reinterpret_cast
<
SfxPoolItem
*>
(
-
1
)
&&
**
ppFnd
==
m_pPool
->
GetDefaultItem
(
nWhich
))
{
{
_pPool
->
Remove
(
**
ppFnd
);
m
_pPool
->
Remove
(
**
ppFnd
);
*
ppFnd
=
reinterpret_cast
<
SfxPoolItem
*>
(
-
1
);
*
ppFnd
=
reinterpret_cast
<
SfxPoolItem
*>
(
-
1
);
}
}
pPtr
+=
2
;
pPtr
+=
2
;
...
@@ -422,9 +423,9 @@ void SfxItemSet::InvalidateDefaultItems()
...
@@ -422,9 +423,9 @@ void SfxItemSet::InvalidateDefaultItems()
void
SfxItemSet
::
InvalidateAllItems
()
void
SfxItemSet
::
InvalidateAllItems
()
{
{
assert
(
!
_nCount
&&
"There are still Items set"
);
assert
(
!
m
_nCount
&&
"There are still Items set"
);
m_nCount
=
TotalCount
();
memset
(
(
void
*
)
_aItems
,
-
1
,
(
_nCount
=
TotalCount
()
)
*
sizeof
(
SfxPoolItem
*
)
);
memset
(
static_cast
<
void
*>
(
m_pItems
),
-
1
,
m_nCount
*
sizeof
(
SfxPoolItem
*
)
);
}
}
...
@@ -438,8 +439,8 @@ SfxItemState SfxItemSet::GetItemState( sal_uInt16 nWhich,
...
@@ -438,8 +439,8 @@ SfxItemState SfxItemSet::GetItemState( sal_uInt16 nWhich,
SfxItemState
eRet
=
SfxItemState
::
UNKNOWN
;
SfxItemState
eRet
=
SfxItemState
::
UNKNOWN
;
do
do
{
{
SfxItemArray
ppFnd
=
pAktSet
->
_a
Items
;
SfxItemArray
ppFnd
=
pAktSet
->
m_p
Items
;
const
sal_uInt16
*
pPtr
=
pAktSet
->
_pWhichRanges
;
const
sal_uInt16
*
pPtr
=
pAktSet
->
m
_pWhichRanges
;
if
(
pPtr
)
if
(
pPtr
)
{
{
while
(
*
pPtr
)
while
(
*
pPtr
)
...
@@ -473,7 +474,7 @@ SfxItemState SfxItemSet::GetItemState( sal_uInt16 nWhich,
...
@@ -473,7 +474,7 @@ SfxItemState SfxItemSet::GetItemState( sal_uInt16 nWhich,
pPtr
+=
2
;
pPtr
+=
2
;
}
}
}
}
}
while
(
bSrchInParent
&&
0
!=
(
pAktSet
=
pAktSet
->
_pParent
));
}
while
(
bSrchInParent
&&
nullptr
!=
(
pAktSet
=
pAktSet
->
m_pParent
));
return
eRet
;
return
eRet
;
}
}
...
@@ -492,8 +493,8 @@ const SfxPoolItem* SfxItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhich
...
@@ -492,8 +493,8 @@ const SfxPoolItem* SfxItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhich
if
(
!
nWhich
)
if
(
!
nWhich
)
return
0
;
//FIXME: Only because of Outliner bug
return
0
;
//FIXME: Only because of Outliner bug
SfxItemArray
ppFnd
=
_a
Items
;
SfxItemArray
ppFnd
=
m_p
Items
;
const
sal_uInt16
*
pPtr
=
_pWhichRanges
;
const
sal_uInt16
*
pPtr
=
m
_pWhichRanges
;
while
(
*
pPtr
)
while
(
*
pPtr
)
{
{
if
(
*
pPtr
<=
nWhich
&&
nWhich
<=
*
(
pPtr
+
1
)
)
if
(
*
pPtr
<=
nWhich
&&
nWhich
<=
*
(
pPtr
+
1
)
)
...
@@ -509,14 +510,14 @@ const SfxPoolItem* SfxItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhich
...
@@ -509,14 +510,14 @@ const SfxPoolItem* SfxItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhich
// Will 'dontcare' or 'disabled' be overwritten with some real value?
// Will 'dontcare' or 'disabled' be overwritten with some real value?
if
(
rItem
.
Which
()
&&
(
IsInvalidItem
(
*
ppFnd
)
||
!
(
*
ppFnd
)
->
Which
()
)
)
if
(
rItem
.
Which
()
&&
(
IsInvalidItem
(
*
ppFnd
)
||
!
(
*
ppFnd
)
->
Which
()
)
)
{
{
*
ppFnd
=
&
_pPool
->
Put
(
rItem
,
nWhich
);
*
ppFnd
=
&
m
_pPool
->
Put
(
rItem
,
nWhich
);
return
*
ppFnd
;
return
*
ppFnd
;
}
}
// Turns into disabled?
// Turns into disabled?
if
(
!
rItem
.
Which
()
)
if
(
!
rItem
.
Which
()
)
{
{
*
ppFnd
=
rItem
.
Clone
(
_pPool
);
*
ppFnd
=
rItem
.
Clone
(
m
_pPool
);
return
0
;
return
0
;
}
}
else
else
...
@@ -526,32 +527,32 @@ const SfxPoolItem* SfxItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhich
...
@@ -526,32 +527,32 @@ const SfxPoolItem* SfxItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhich
return
0
;
return
0
;
// Add the new one, remove the old one
// Add the new one, remove the old one
const
SfxPoolItem
&
rNew
=
_pPool
->
Put
(
rItem
,
nWhich
);
const
SfxPoolItem
&
rNew
=
m
_pPool
->
Put
(
rItem
,
nWhich
);
const
SfxPoolItem
*
pOld
=
*
ppFnd
;
const
SfxPoolItem
*
pOld
=
*
ppFnd
;
*
ppFnd
=
&
rNew
;
*
ppFnd
=
&
rNew
;
if
(
nWhich
<=
SFX_WHICH_MAX
)
if
(
nWhich
<=
SFX_WHICH_MAX
)
Changed
(
*
pOld
,
rNew
);
Changed
(
*
pOld
,
rNew
);
_pPool
->
Remove
(
*
pOld
);
m
_pPool
->
Remove
(
*
pOld
);
}
}
}
}
else
else
{
{
++
_nCount
;
++
m
_nCount
;
if
(
!
rItem
.
Which
()
)
if
(
!
rItem
.
Which
()
)
*
ppFnd
=
rItem
.
Clone
(
_pPool
);
*
ppFnd
=
rItem
.
Clone
(
m
_pPool
);
else
{
else
{
const
SfxPoolItem
&
rNew
=
_pPool
->
Put
(
rItem
,
nWhich
);
const
SfxPoolItem
&
rNew
=
m
_pPool
->
Put
(
rItem
,
nWhich
);
*
ppFnd
=
&
rNew
;
*
ppFnd
=
&
rNew
;
if
(
nWhich
<=
SFX_WHICH_MAX
)
if
(
nWhich
<=
SFX_WHICH_MAX
)
{
{
const
SfxPoolItem
&
rOld
=
_pParent
const
SfxPoolItem
&
rOld
=
m
_pParent
?
_pParent
->
Get
(
nWhich
,
true
)
?
m
_pParent
->
Get
(
nWhich
,
true
)
:
_pPool
->
GetDefaultItem
(
nWhich
);
:
m
_pPool
->
GetDefaultItem
(
nWhich
);
Changed
(
rOld
,
rNew
);
Changed
(
rOld
,
rNew
);
}
}
}
}
}
}
SFX_ASSERT
(
!
_pPool
->
IsItemFlag
(
nWhich
,
SFX_ITEM_POOLABLE
)
||
SFX_ASSERT
(
!
m
_pPool
->
IsItemFlag
(
nWhich
,
SFX_ITEM_POOLABLE
)
||
rItem
.
ISA
(
SfxSetItem
)
||
**
ppFnd
==
rItem
,
rItem
.
ISA
(
SfxSetItem
)
||
**
ppFnd
==
rItem
,
nWhich
,
"putted Item unequal"
);
nWhich
,
"putted Item unequal"
);
return
*
ppFnd
;
return
*
ppFnd
;
...
@@ -569,8 +570,8 @@ bool SfxItemSet::Put( const SfxItemSet& rSet, bool bInvalidAsDefault )
...
@@ -569,8 +570,8 @@ bool SfxItemSet::Put( const SfxItemSet& rSet, bool bInvalidAsDefault )
bool
bRet
=
false
;
bool
bRet
=
false
;
if
(
rSet
.
Count
()
)
if
(
rSet
.
Count
()
)
{
{
SfxItemArray
ppFnd
=
rSet
.
_a
Items
;
SfxItemArray
ppFnd
=
rSet
.
m_p
Items
;
const
sal_uInt16
*
pPtr
=
rSet
.
_pWhichRanges
;
const
sal_uInt16
*
pPtr
=
rSet
.
m
_pWhichRanges
;
while
(
*
pPtr
)
while
(
*
pPtr
)
{
{
for
(
sal_uInt16
nWhich
=
*
pPtr
;
nWhich
<=
*
(
pPtr
+
1
);
++
nWhich
,
++
ppFnd
)
for
(
sal_uInt16
nWhich
=
*
pPtr
;
nWhich
<=
*
(
pPtr
+
1
);
++
nWhich
,
++
ppFnd
)
...
@@ -618,8 +619,8 @@ void SfxItemSet::PutExtended
...
@@ -618,8 +619,8 @@ void SfxItemSet::PutExtended
)
)
{
{
// don't "optimize" with "if( rSet.Count()" because of dont-care + defaults
// don't "optimize" with "if( rSet.Count()" because of dont-care + defaults
SfxItemArray
ppFnd
=
rSet
.
_a
Items
;
SfxItemArray
ppFnd
=
rSet
.
m_p
Items
;
const
sal_uInt16
*
pPtr
=
rSet
.
_pWhichRanges
;
const
sal_uInt16
*
pPtr
=
rSet
.
m
_pWhichRanges
;
while
(
*
pPtr
)
while
(
*
pPtr
)
{
{
for
(
sal_uInt16
nWhich
=
*
pPtr
;
nWhich
<=
*
(
pPtr
+
1
);
++
nWhich
,
++
ppFnd
)
for
(
sal_uInt16
nWhich
=
*
pPtr
;
nWhich
<=
*
(
pPtr
+
1
);
++
nWhich
,
++
ppFnd
)
...
@@ -688,7 +689,7 @@ void SfxItemSet::MergeRange( sal_uInt16 nFrom, sal_uInt16 nTo )
...
@@ -688,7 +689,7 @@ void SfxItemSet::MergeRange( sal_uInt16 nFrom, sal_uInt16 nTo )
return
;
return
;
// merge new range
// merge new range
SfxUShortRanges
aRanges
(
_pWhichRanges
);
SfxUShortRanges
aRanges
(
m
_pWhichRanges
);
aRanges
+=
SfxUShortRanges
(
nFrom
,
nTo
);
aRanges
+=
SfxUShortRanges
(
nFrom
,
nTo
);
SetRanges
(
aRanges
);
SetRanges
(
aRanges
);
}
}
...
@@ -701,9 +702,9 @@ void SfxItemSet::MergeRange( sal_uInt16 nFrom, sal_uInt16 nTo )
...
@@ -701,9 +702,9 @@ void SfxItemSet::MergeRange( sal_uInt16 nFrom, sal_uInt16 nTo )
void
SfxItemSet
::
SetRanges
(
const
sal_uInt16
*
pNewRanges
)
void
SfxItemSet
::
SetRanges
(
const
sal_uInt16
*
pNewRanges
)
{
{
// Identical Ranges?
// Identical Ranges?
if
(
_pWhichRanges
==
pNewRanges
)
if
(
m_pWhichRanges
==
pNewRanges
)
return
;
return
;
const
sal_uInt16
*
pOld
=
_pWhichRanges
;
const
sal_uInt16
*
pOld
=
m
_pWhichRanges
;
const
sal_uInt16
*
pNew
=
pNewRanges
;
const
sal_uInt16
*
pNew
=
pNewRanges
;
while
(
*
pOld
==
*
pNew
)
while
(
*
pOld
==
*
pNew
)
{
{
...
@@ -716,7 +717,7 @@ void SfxItemSet::SetRanges( const sal_uInt16 *pNewRanges )
...
@@ -716,7 +717,7 @@ void SfxItemSet::SetRanges( const sal_uInt16 *pNewRanges )
sal_uLong
nSize
=
Capacity_Impl
(
pNewRanges
);
sal_uLong
nSize
=
Capacity_Impl
(
pNewRanges
);
SfxItemArray
aNewItems
=
new
const
SfxPoolItem
*
[
nSize
];
SfxItemArray
aNewItems
=
new
const
SfxPoolItem
*
[
nSize
];
sal_uInt16
nNewCount
=
0
;
sal_uInt16
nNewCount
=
0
;
if
(
_nCount
==
0
)
if
(
m_nCount
==
0
)
memset
(
aNewItems
,
0
,
nSize
*
sizeof
(
SfxPoolItem
*
)
);
memset
(
aNewItems
,
0
,
nSize
*
sizeof
(
SfxPoolItem
*
)
);
else
else
{
{
...
@@ -756,29 +757,29 @@ void SfxItemSet::SetRanges( const sal_uInt16 *pNewRanges )
...
@@ -756,29 +757,29 @@ void SfxItemSet::SetRanges( const sal_uInt16 *pNewRanges )
sal_uInt16
nOldTotalCount
=
TotalCount
();
sal_uInt16
nOldTotalCount
=
TotalCount
();
for
(
sal_uInt16
nItem
=
0
;
nItem
<
nOldTotalCount
;
++
nItem
)
for
(
sal_uInt16
nItem
=
0
;
nItem
<
nOldTotalCount
;
++
nItem
)
{
{
const
SfxPoolItem
*
pItem
=
_a
Items
[
nItem
];
const
SfxPoolItem
*
pItem
=
m_p
Items
[
nItem
];
if
(
pItem
&&
!
IsInvalidItem
(
pItem
)
&&
pItem
->
Which
()
)
if
(
pItem
&&
!
IsInvalidItem
(
pItem
)
&&
pItem
->
Which
()
)
_pPool
->
Remove
(
*
pItem
);
m
_pPool
->
Remove
(
*
pItem
);
}
}
}
}
// replace old items-array and ranges
// replace old items-array and ranges
delete
[]
_a
Items
;
delete
[]
m_p
Items
;
_a
Items
=
aNewItems
;
m_p
Items
=
aNewItems
;
_nCount
=
nNewCount
;
m
_nCount
=
nNewCount
;
if
(
pNewRanges
==
GetPool
()
->
GetFrozenIdRanges
()
)
if
(
pNewRanges
==
GetPool
()
->
GetFrozenIdRanges
()
)
{
{
delete
[]
_pWhichRanges
;
delete
[]
m
_pWhichRanges
;
_pWhichRanges
=
const_cast
<
sal_uInt16
*>
(
pNewRanges
);
m
_pWhichRanges
=
const_cast
<
sal_uInt16
*>
(
pNewRanges
);
}
}
else
else
{
{
sal_uInt16
nCount
=
Count_Impl
(
pNewRanges
)
+
1
;
sal_uInt16
nCount
=
Count_Impl
(
pNewRanges
)
+
1
;
if
(
_pWhichRanges
!=
_pPool
->
GetFrozenIdRanges
()
)
if
(
m_pWhichRanges
!=
m_pPool
->
GetFrozenIdRanges
()
)
delete
[]
_pWhichRanges
;
delete
[]
m
_pWhichRanges
;
_pWhichRanges
=
new
sal_uInt16
[
nCount
];
m
_pWhichRanges
=
new
sal_uInt16
[
nCount
];
memcpy
(
_pWhichRanges
,
pNewRanges
,
sizeof
(
sal_uInt16
)
*
nCount
);
memcpy
(
m
_pWhichRanges
,
pNewRanges
,
sizeof
(
sal_uInt16
)
*
nCount
);
}
}
}
}
...
@@ -819,7 +820,7 @@ bool SfxItemSet::Set
...
@@ -819,7 +820,7 @@ bool SfxItemSet::Set
)
)
{
{
bool
bRet
=
false
;
bool
bRet
=
false
;
if
(
_nCount
)
if
(
m_nCount
)
ClearItem
();
ClearItem
();
if
(
bDeep
)
if
(
bDeep
)
{
{
...
@@ -864,7 +865,9 @@ const SfxPoolItem* SfxItemSet::GetItem
...
@@ -864,7 +865,9 @@ const SfxPoolItem* SfxItemSet::GetItem
SfxItemState
eState
=
GetItemState
(
nWhich
,
bSrchInParent
,
&
pItem
);
SfxItemState
eState
=
GetItemState
(
nWhich
,
bSrchInParent
,
&
pItem
);
if
(
bSrchInParent
&&
SfxItemState
::
DEFAULT
==
eState
&&
if
(
bSrchInParent
&&
SfxItemState
::
DEFAULT
==
eState
&&
nWhich
<=
SFX_WHICH_MAX
)
nWhich
<=
SFX_WHICH_MAX
)
pItem
=
&
_pPool
->
GetDefaultItem
(
nWhich
);
{
pItem
=
&
m_pPool
->
GetDefaultItem
(
nWhich
);
}
if
(
pItem
)
if
(
pItem
)
{
{
...
@@ -891,8 +894,8 @@ const SfxPoolItem& SfxItemSet::Get( sal_uInt16 nWhich, bool bSrchInParent) const
...
@@ -891,8 +894,8 @@ const SfxPoolItem& SfxItemSet::Get( sal_uInt16 nWhich, bool bSrchInParent) const
{
{
if
(
pAktSet
->
Count
()
)
if
(
pAktSet
->
Count
()
)
{
{
SfxItemArray
ppFnd
=
pAktSet
->
_a
Items
;
SfxItemArray
ppFnd
=
pAktSet
->
m_p
Items
;
const
sal_uInt16
*
pPtr
=
pAktSet
->
_pWhichRanges
;
const
sal_uInt16
*
pPtr
=
pAktSet
->
m
_pWhichRanges
;
while
(
*
pPtr
)
while
(
*
pPtr
)
{
{
if
(
*
pPtr
<=
nWhich
&&
nWhich
<=
*
(
pPtr
+
1
)
)
if
(
*
pPtr
<=
nWhich
&&
nWhich
<=
*
(
pPtr
+
1
)
)
...
@@ -903,10 +906,10 @@ const SfxPoolItem& SfxItemSet::Get( sal_uInt16 nWhich, bool bSrchInParent) const
...
@@ -903,10 +906,10 @@ const SfxPoolItem& SfxItemSet::Get( sal_uInt16 nWhich, bool bSrchInParent) const
{
{
if
(
reinterpret_cast
<
SfxPoolItem
*>
(
-
1
)
==
*
ppFnd
)
{
if
(
reinterpret_cast
<
SfxPoolItem
*>
(
-
1
)
==
*
ppFnd
)
{
//FIXME: The following code is duplicated further down
//FIXME: The following code is duplicated further down
SFX_ASSERT
(
_pPool
,
nWhich
,
"no Pool, but status is ambiguous"
);
SFX_ASSERT
(
m
_pPool
,
nWhich
,
"no Pool, but status is ambiguous"
);
//!((SfxAllItemSet *)this)->aDefault.SetWhich(nWhich);
//!((SfxAllItemSet *)this)->aDefault.SetWhich(nWhich);
//!return aDefault;
//!return aDefault;
return
_pPool
->
GetDefaultItem
(
nWhich
);
return
m
_pPool
->
GetDefaultItem
(
nWhich
);
}
}
#ifdef DBG_UTIL
#ifdef DBG_UTIL
const
SfxPoolItem
*
pItem
=
*
ppFnd
;
const
SfxPoolItem
*
pItem
=
*
ppFnd
;
...
@@ -924,11 +927,11 @@ const SfxPoolItem& SfxItemSet::Get( sal_uInt16 nWhich, bool bSrchInParent) const
...
@@ -924,11 +927,11 @@ const SfxPoolItem& SfxItemSet::Get( sal_uInt16 nWhich, bool bSrchInParent) const
//TODO: Search until end of Range: What are we supposed to do now? To the Parent or Default??
//TODO: Search until end of Range: What are we supposed to do now? To the Parent or Default??
// if( !*pPtr ) // Until the end of the search Range?
// if( !*pPtr ) // Until the end of the search Range?
// break;
// break;
}
while
(
bSrchInParent
&&
0
!=
(
pAktSet
=
pAktSet
->
_pParent
));
}
while
(
bSrchInParent
&&
nullptr
!=
(
pAktSet
=
pAktSet
->
m_pParent
));
// Get the Default from the Pool and return
// Get the Default from the Pool and return
SFX_ASSERT
(
_pPool
,
nWhich
,
"no Pool, but status is ambiguous"
);
SFX_ASSERT
(
m
_pPool
,
nWhich
,
"no Pool, but status is ambiguous"
);
const
SfxPoolItem
*
pItem
=
&
_pPool
->
GetDefaultItem
(
nWhich
);
const
SfxPoolItem
*
pItem
=
&
m
_pPool
->
GetDefaultItem
(
nWhich
);
return
*
pItem
;
return
*
pItem
;
}
}
...
@@ -944,7 +947,7 @@ void SfxItemSet::Changed( const SfxPoolItem&, const SfxPoolItem& )
...
@@ -944,7 +947,7 @@ void SfxItemSet::Changed( const SfxPoolItem&, const SfxPoolItem& )
sal_uInt16
SfxItemSet
::
TotalCount
()
const
sal_uInt16
SfxItemSet
::
TotalCount
()
const
{
{
sal_uInt16
nRet
=
0
;
sal_uInt16
nRet
=
0
;
sal_uInt16
*
pPtr
=
_pWhichRanges
;
sal_uInt16
*
pPtr
=
m
_pWhichRanges
;
while
(
*
pPtr
)
while
(
*
pPtr
)
{
{
nRet
+=
(
*
(
pPtr
+
1
)
-
*
pPtr
)
+
1
;
nRet
+=
(
*
(
pPtr
+
1
)
-
*
pPtr
)
+
1
;
...
@@ -960,7 +963,7 @@ sal_uInt16 SfxItemSet::TotalCount() const
...
@@ -960,7 +963,7 @@ sal_uInt16 SfxItemSet::TotalCount() const
*/
*/
void
SfxItemSet
::
Intersect
(
const
SfxItemSet
&
rSet
)
void
SfxItemSet
::
Intersect
(
const
SfxItemSet
&
rSet
)
{
{
assert
(
_pPool
&&
"Not implemented without Pool"
);
assert
(
m
_pPool
&&
"Not implemented without Pool"
);
if
(
!
Count
()
)
// None set?
if
(
!
Count
()
)
// None set?
return
;
return
;
...
@@ -973,8 +976,8 @@ void SfxItemSet::Intersect( const SfxItemSet& rSet )
...
@@ -973,8 +976,8 @@ void SfxItemSet::Intersect( const SfxItemSet& rSet )
// Test whether the Which Ranges are different
// Test whether the Which Ranges are different
bool
bEqual
=
true
;
bool
bEqual
=
true
;
sal_uInt16
*
pWh1
=
_pWhichRanges
;
sal_uInt16
*
pWh1
=
m
_pWhichRanges
;
sal_uInt16
*
pWh2
=
rSet
.
_pWhichRanges
;
sal_uInt16
*
pWh2
=
rSet
.
m
_pWhichRanges
;
sal_uInt16
nSize
=
0
;
sal_uInt16
nSize
=
0
;
for
(
sal_uInt16
n
=
0
;
*
pWh1
&&
*
pWh2
;
++
pWh1
,
++
pWh2
,
++
n
)
for
(
sal_uInt16
n
=
0
;
*
pWh1
&&
*
pWh2
;
++
pWh1
,
++
pWh2
,
++
n
)
...
@@ -992,8 +995,8 @@ void SfxItemSet::Intersect( const SfxItemSet& rSet )
...
@@ -992,8 +995,8 @@ void SfxItemSet::Intersect( const SfxItemSet& rSet )
// If the Ranges are identical, we can easily process it
// If the Ranges are identical, we can easily process it
if
(
bEqual
)
if
(
bEqual
)
{
{
SfxItemArray
ppFnd1
=
_a
Items
;
SfxItemArray
ppFnd1
=
m_p
Items
;
SfxItemArray
ppFnd2
=
rSet
.
_a
Items
;
SfxItemArray
ppFnd2
=
rSet
.
m_p
Items
;
for
(
;
nSize
;
--
nSize
,
++
ppFnd1
,
++
ppFnd2
)
for
(
;
nSize
;
--
nSize
,
++
ppFnd1
,
++
ppFnd2
)
if
(
*
ppFnd1
&&
!*
ppFnd2
)
if
(
*
ppFnd1
&&
!*
ppFnd2
)
...
@@ -1004,16 +1007,16 @@ void SfxItemSet::Intersect( const SfxItemSet& rSet )
...
@@ -1004,16 +1007,16 @@ void SfxItemSet::Intersect( const SfxItemSet& rSet )
sal_uInt16
nWhich
=
(
*
ppFnd1
)
->
Which
();
sal_uInt16
nWhich
=
(
*
ppFnd1
)
->
Which
();
if
(
nWhich
<=
SFX_WHICH_MAX
)
if
(
nWhich
<=
SFX_WHICH_MAX
)
{
{
const
SfxPoolItem
&
rNew
=
_pParent
const
SfxPoolItem
&
rNew
=
m
_pParent
?
_pParent
->
Get
(
nWhich
,
true
)
?
m
_pParent
->
Get
(
nWhich
,
true
)
:
_pPool
->
GetDefaultItem
(
nWhich
);
:
m
_pPool
->
GetDefaultItem
(
nWhich
);
Changed
(
**
ppFnd1
,
rNew
);
Changed
(
**
ppFnd1
,
rNew
);
}
}
_pPool
->
Remove
(
**
ppFnd1
);
m
_pPool
->
Remove
(
**
ppFnd1
);
}
}
*
ppFnd1
=
0
;
*
ppFnd1
=
0
;
--
_nCount
;
--
m
_nCount
;
}
}
}
}
else
else
...
@@ -1043,8 +1046,8 @@ void SfxItemSet::Differentiate( const SfxItemSet& rSet )
...
@@ -1043,8 +1046,8 @@ void SfxItemSet::Differentiate( const SfxItemSet& rSet )
// Test whether the Which Ranges are different
// Test whether the Which Ranges are different
bool
bEqual
=
true
;
bool
bEqual
=
true
;
sal_uInt16
*
pWh1
=
_pWhichRanges
;
sal_uInt16
*
pWh1
=
m
_pWhichRanges
;
sal_uInt16
*
pWh2
=
rSet
.
_pWhichRanges
;
sal_uInt16
*
pWh2
=
rSet
.
m
_pWhichRanges
;
sal_uInt16
nSize
=
0
;
sal_uInt16
nSize
=
0
;
for
(
sal_uInt16
n
=
0
;
*
pWh1
&&
*
pWh2
;
++
pWh1
,
++
pWh2
,
++
n
)
for
(
sal_uInt16
n
=
0
;
*
pWh1
&&
*
pWh2
;
++
pWh1
,
++
pWh2
,
++
n
)
...
@@ -1062,8 +1065,8 @@ void SfxItemSet::Differentiate( const SfxItemSet& rSet )
...
@@ -1062,8 +1065,8 @@ void SfxItemSet::Differentiate( const SfxItemSet& rSet )
// If the Ranges are identical, we can easily process it
// If the Ranges are identical, we can easily process it
if
(
bEqual
)
if
(
bEqual
)
{
{
SfxItemArray
ppFnd1
=
_a
Items
;
SfxItemArray
ppFnd1
=
m_p
Items
;
SfxItemArray
ppFnd2
=
rSet
.
_a
Items
;
SfxItemArray
ppFnd2
=
rSet
.
m_p
Items
;
for
(
;
nSize
;
--
nSize
,
++
ppFnd1
,
++
ppFnd2
)
for
(
;
nSize
;
--
nSize
,
++
ppFnd1
,
++
ppFnd2
)
if
(
*
ppFnd1
&&
*
ppFnd2
)
if
(
*
ppFnd1
&&
*
ppFnd2
)
...
@@ -1074,16 +1077,16 @@ void SfxItemSet::Differentiate( const SfxItemSet& rSet )
...
@@ -1074,16 +1077,16 @@ void SfxItemSet::Differentiate( const SfxItemSet& rSet )
sal_uInt16
nWhich
=
(
*
ppFnd1
)
->
Which
();
sal_uInt16
nWhich
=
(
*
ppFnd1
)
->
Which
();
if
(
nWhich
<=
SFX_WHICH_MAX
)
if
(
nWhich
<=
SFX_WHICH_MAX
)
{
{
const
SfxPoolItem
&
rNew
=
_pParent
const
SfxPoolItem
&
rNew
=
m
_pParent
?
_pParent
->
Get
(
nWhich
,
true
)
?
m
_pParent
->
Get
(
nWhich
,
true
)
:
_pPool
->
GetDefaultItem
(
nWhich
);
:
m
_pPool
->
GetDefaultItem
(
nWhich
);
Changed
(
**
ppFnd1
,
rNew
);
Changed
(
**
ppFnd1
,
rNew
);
}
}
_pPool
->
Remove
(
**
ppFnd1
);
m
_pPool
->
Remove
(
**
ppFnd1
);
}
}
*
ppFnd1
=
0
;
*
ppFnd1
=
0
;
--
_nCount
;
--
m
_nCount
;
}
}
}
}
else
else
...
@@ -1256,8 +1259,8 @@ void SfxItemSet::MergeValues( const SfxItemSet& rSet, bool bIgnoreDefaults )
...
@@ -1256,8 +1259,8 @@ void SfxItemSet::MergeValues( const SfxItemSet& rSet, bool bIgnoreDefaults )
// Test if the which Ranges are different
// Test if the which Ranges are different
bool
bEqual
=
true
;
bool
bEqual
=
true
;
sal_uInt16
*
pWh1
=
_pWhichRanges
;
sal_uInt16
*
pWh1
=
m
_pWhichRanges
;
sal_uInt16
*
pWh2
=
rSet
.
_pWhichRanges
;
sal_uInt16
*
pWh2
=
rSet
.
m
_pWhichRanges
;
sal_uInt16
nSize
=
0
;
sal_uInt16
nSize
=
0
;
for
(
sal_uInt16
n
=
0
;
*
pWh1
&&
*
pWh2
;
++
pWh1
,
++
pWh2
,
++
n
)
for
(
sal_uInt16
n
=
0
;
*
pWh1
&&
*
pWh2
;
++
pWh1
,
++
pWh2
,
++
n
)
...
@@ -1275,11 +1278,11 @@ void SfxItemSet::MergeValues( const SfxItemSet& rSet, bool bIgnoreDefaults )
...
@@ -1275,11 +1278,11 @@ void SfxItemSet::MergeValues( const SfxItemSet& rSet, bool bIgnoreDefaults )
// If the Ranges match, they are easier to process!
// If the Ranges match, they are easier to process!
if
(
bEqual
)
if
(
bEqual
)
{
{
SfxItemArray
ppFnd1
=
_a
Items
;
SfxItemArray
ppFnd1
=
m_p
Items
;
SfxItemArray
ppFnd2
=
rSet
.
_a
Items
;
SfxItemArray
ppFnd2
=
rSet
.
m_p
Items
;
for
(
;
nSize
;
--
nSize
,
++
ppFnd1
,
++
ppFnd2
)
for
(
;
nSize
;
--
nSize
,
++
ppFnd1
,
++
ppFnd2
)
MergeItem_Impl
(
_pPool
,
_nCount
,
ppFnd1
,
*
ppFnd2
,
bIgnoreDefaults
);
MergeItem_Impl
(
m_pPool
,
m_nCount
,
ppFnd1
,
*
ppFnd2
,
bIgnoreDefaults
);
}
}
else
else
{
{
...
@@ -1308,8 +1311,8 @@ void SfxItemSet::MergeValues( const SfxItemSet& rSet, bool bIgnoreDefaults )
...
@@ -1308,8 +1311,8 @@ void SfxItemSet::MergeValues( const SfxItemSet& rSet, bool bIgnoreDefaults )
void
SfxItemSet
::
MergeValue
(
const
SfxPoolItem
&
rAttr
,
bool
bIgnoreDefaults
)
void
SfxItemSet
::
MergeValue
(
const
SfxPoolItem
&
rAttr
,
bool
bIgnoreDefaults
)
{
{
SfxItemArray
ppFnd
=
_a
Items
;
SfxItemArray
ppFnd
=
m_p
Items
;
const
sal_uInt16
*
pPtr
=
_pWhichRanges
;
const
sal_uInt16
*
pPtr
=
m
_pWhichRanges
;
const
sal_uInt16
nWhich
=
rAttr
.
Which
();
const
sal_uInt16
nWhich
=
rAttr
.
Which
();
while
(
*
pPtr
)
while
(
*
pPtr
)
{
{
...
@@ -1317,7 +1320,7 @@ void SfxItemSet::MergeValue( const SfxPoolItem& rAttr, bool bIgnoreDefaults )
...
@@ -1317,7 +1320,7 @@ void SfxItemSet::MergeValue( const SfxPoolItem& rAttr, bool bIgnoreDefaults )
if
(
*
pPtr
<=
nWhich
&&
nWhich
<=
*
(
pPtr
+
1
)
)
if
(
*
pPtr
<=
nWhich
&&
nWhich
<=
*
(
pPtr
+
1
)
)
{
{
ppFnd
+=
nWhich
-
*
pPtr
;
ppFnd
+=
nWhich
-
*
pPtr
;
MergeItem_Impl
(
_pPool
,
_nCount
,
ppFnd
,
&
rAttr
,
bIgnoreDefaults
);
MergeItem_Impl
(
m_pPool
,
m_nCount
,
ppFnd
,
&
rAttr
,
bIgnoreDefaults
);
break
;
break
;
}
}
ppFnd
+=
*
(
pPtr
+
1
)
-
*
pPtr
+
1
;
ppFnd
+=
*
(
pPtr
+
1
)
-
*
pPtr
+
1
;
...
@@ -1329,8 +1332,8 @@ void SfxItemSet::MergeValue( const SfxPoolItem& rAttr, bool bIgnoreDefaults )
...
@@ -1329,8 +1332,8 @@ void SfxItemSet::MergeValue( const SfxPoolItem& rAttr, bool bIgnoreDefaults )
void
SfxItemSet
::
InvalidateItem
(
sal_uInt16
nWhich
)
void
SfxItemSet
::
InvalidateItem
(
sal_uInt16
nWhich
)
{
{
SfxItemArray
ppFnd
=
_a
Items
;
SfxItemArray
ppFnd
=
m_p
Items
;
const
sal_uInt16
*
pPtr
=
_pWhichRanges
;
const
sal_uInt16
*
pPtr
=
m
_pWhichRanges
;
while
(
*
pPtr
)
while
(
*
pPtr
)
{
{
if
(
*
pPtr
<=
nWhich
&&
nWhich
<=
*
(
pPtr
+
1
)
)
if
(
*
pPtr
<=
nWhich
&&
nWhich
<=
*
(
pPtr
+
1
)
)
...
@@ -1342,14 +1345,14 @@ void SfxItemSet::InvalidateItem( sal_uInt16 nWhich )
...
@@ -1342,14 +1345,14 @@ void SfxItemSet::InvalidateItem( sal_uInt16 nWhich )
{
{
if
(
reinterpret_cast
<
SfxPoolItem
*>
(
-
1
)
!=
*
ppFnd
)
// Not yet dontcare!
if
(
reinterpret_cast
<
SfxPoolItem
*>
(
-
1
)
!=
*
ppFnd
)
// Not yet dontcare!
{
{
_pPool
->
Remove
(
**
ppFnd
);
m
_pPool
->
Remove
(
**
ppFnd
);
*
ppFnd
=
reinterpret_cast
<
SfxPoolItem
*>
(
-
1
);
*
ppFnd
=
reinterpret_cast
<
SfxPoolItem
*>
(
-
1
);
}
}
}
}
else
else
{
{
*
ppFnd
=
reinterpret_cast
<
SfxPoolItem
*>
(
-
1
);
*
ppFnd
=
reinterpret_cast
<
SfxPoolItem
*>
(
-
1
);
++
_nCount
;
++
m
_nCount
;
}
}
break
;
break
;
}
}
...
@@ -1363,7 +1366,7 @@ void SfxItemSet::InvalidateItem( sal_uInt16 nWhich )
...
@@ -1363,7 +1366,7 @@ void SfxItemSet::InvalidateItem( sal_uInt16 nWhich )
sal_uInt16
SfxItemSet
::
GetWhichByPos
(
sal_uInt16
nPos
)
const
sal_uInt16
SfxItemSet
::
GetWhichByPos
(
sal_uInt16
nPos
)
const
{
{
sal_uInt16
n
=
0
;
sal_uInt16
n
=
0
;
sal_uInt16
*
pPtr
=
_pWhichRanges
;
sal_uInt16
*
pPtr
=
m
_pWhichRanges
;
while
(
*
pPtr
)
while
(
*
pPtr
)
{
{
n
=
(
*
(
pPtr
+
1
)
-
*
pPtr
)
+
1
;
n
=
(
*
(
pPtr
+
1
)
-
*
pPtr
)
+
1
;
...
@@ -1383,7 +1386,7 @@ sal_uInt16 SfxItemSet::GetWhichByPos( sal_uInt16 nPos ) const
...
@@ -1383,7 +1386,7 @@ sal_uInt16 SfxItemSet::GetWhichByPos( sal_uInt16 nPos ) const
* to the stream in the following way:
* to the stream in the following way:
*
*
* sal_uInt16 ... Count of the set Items
* sal_uInt16 ... Count of the set Items
* Count* _pPool->StoreItem()
* Count*
m
_pPool->StoreItem()
*
*
* @see SfxItemPool::StoreItem() const
* @see SfxItemPool::StoreItem() const
* @see SfxItemSet::Load(SvStream&,bool,const SfxItemPool*)
* @see SfxItemSet::Load(SvStream&,bool,const SfxItemPool*)
...
@@ -1395,14 +1398,14 @@ SvStream &SfxItemSet::Store
...
@@ -1395,14 +1398,14 @@ SvStream &SfxItemSet::Store
false: Surrogates */
false: Surrogates */
)
const
)
const
{
{
assert
(
_pPool
);
assert
(
m
_pPool
);
// Remember position of the count (to be able to correct it, if need be)
// Remember position of the count (to be able to correct it, if need be)
sal_uLong
nCountPos
=
rStream
.
Tell
();
sal_uLong
nCountPos
=
rStream
.
Tell
();
rStream
.
WriteUInt16
(
_nCount
);
rStream
.
WriteUInt16
(
m
_nCount
);
// If there's nothing to save, don't construct an ItemIter
// If there's nothing to save, don't construct an ItemIter
if
(
_nCount
)
if
(
m_nCount
)
{
{
// Keep record of how many Items are really saved
// Keep record of how many Items are really saved
sal_uInt16
nWrittenCount
=
0
;
// Count of Items streamed in 'rStream'
sal_uInt16
nWrittenCount
=
0
;
// Count of Items streamed in 'rStream'
...
@@ -1416,13 +1419,13 @@ SvStream &SfxItemSet::Store
...
@@ -1416,13 +1419,13 @@ SvStream &SfxItemSet::Store
// Let Items (if need be as a Surrogate) be saved via Pool
// Let Items (if need be as a Surrogate) be saved via Pool
SAL_WARN_IF
(
IsInvalidItem
(
pItem
),
"svl.items"
,
"can't store invalid items"
);
SAL_WARN_IF
(
IsInvalidItem
(
pItem
),
"svl.items"
,
"can't store invalid items"
);
if
(
!
IsInvalidItem
(
pItem
)
&&
if
(
!
IsInvalidItem
(
pItem
)
&&
_pPool
->
StoreItem
(
rStream
,
*
pItem
,
bDirect
)
)
m
_pPool
->
StoreItem
(
rStream
,
*
pItem
,
bDirect
)
)
// Item was streamed in 'rStream'
// Item was streamed in 'rStream'
++
nWrittenCount
;
++
nWrittenCount
;
}
}
// Fewer written than read (e.g. old format)
// Fewer written than read (e.g. old format)
if
(
nWrittenCount
!=
_nCount
)
if
(
nWrittenCount
!=
m_nCount
)
{
{
// Store real count in the stream
// Store real count in the stream
sal_uLong
nPos
=
rStream
.
Tell
();
sal_uLong
nPos
=
rStream
.
Tell
();
...
@@ -1459,11 +1462,11 @@ SvStream &SfxItemSet::Load
...
@@ -1459,11 +1462,11 @@ SvStream &SfxItemSet::Load
(e.g. when inserting documents) */
(e.g. when inserting documents) */
)
)
{
{
assert
(
_pPool
);
assert
(
m
_pPool
);
// No RefPool => Resolve Surrogates with ItemSet's Pool
// No RefPool => Resolve Surrogates with ItemSet's Pool
if
(
!
pRefPool
)
if
(
!
pRefPool
)
pRefPool
=
_pPool
;
pRefPool
=
m
_pPool
;
// Load Item count and as many Items
// Load Item count and as many Items
sal_uInt16
nCount
=
0
;
sal_uInt16
nCount
=
0
;
...
@@ -1482,15 +1485,15 @@ SvStream &SfxItemSet::Load
...
@@ -1482,15 +1485,15 @@ SvStream &SfxItemSet::Load
{
{
// Load Surrogate/Item and resolve Surrogate
// Load Surrogate/Item and resolve Surrogate
const
SfxPoolItem
*
pItem
=
const
SfxPoolItem
*
pItem
=
_pPool
->
LoadItem
(
rStream
,
bDirect
,
pRefPool
);
m
_pPool
->
LoadItem
(
rStream
,
bDirect
,
pRefPool
);
// Did we load an Item or resolve a Surrogate?
// Did we load an Item or resolve a Surrogate?
if
(
pItem
)
if
(
pItem
)
{
{
// Find position for Item pointer in the set
// Find position for Item pointer in the set
sal_uInt16
nWhich
=
pItem
->
Which
();
sal_uInt16
nWhich
=
pItem
->
Which
();
SfxItemArray
ppFnd
=
_a
Items
;
SfxItemArray
ppFnd
=
m_p
Items
;
const
sal_uInt16
*
pPtr
=
_pWhichRanges
;
const
sal_uInt16
*
pPtr
=
m
_pWhichRanges
;
while
(
*
pPtr
)
while
(
*
pPtr
)
{
{
// In this Range??
// In this Range??
...
@@ -1500,7 +1503,7 @@ SvStream &SfxItemSet::Load
...
@@ -1500,7 +1503,7 @@ SvStream &SfxItemSet::Load
ppFnd
+=
nWhich
-
*
pPtr
;
ppFnd
+=
nWhich
-
*
pPtr
;
SFX_ASSERT
(
!*
ppFnd
,
nWhich
,
"Item is present twice"
);
SFX_ASSERT
(
!*
ppFnd
,
nWhich
,
"Item is present twice"
);
*
ppFnd
=
pItem
;
*
ppFnd
=
pItem
;
++
_nCount
;
++
m
_nCount
;
break
;
break
;
}
}
...
@@ -1519,8 +1522,8 @@ SvStream &SfxItemSet::Load
...
@@ -1519,8 +1522,8 @@ SvStream &SfxItemSet::Load
bool
SfxItemSet
::
operator
==
(
const
SfxItemSet
&
rCmp
)
const
bool
SfxItemSet
::
operator
==
(
const
SfxItemSet
&
rCmp
)
const
{
{
// Values we can get quickly need to be the same
// Values we can get quickly need to be the same
if
(
_pParent
!=
rCmp
.
_pParent
||
if
(
m_pParent
!=
rCmp
.
m
_pParent
||
_pPool
!=
rCmp
.
_pPool
||
m_pPool
!=
rCmp
.
m
_pPool
||
Count
()
!=
rCmp
.
Count
()
)
Count
()
!=
rCmp
.
Count
()
)
return
false
;
return
false
;
...
@@ -1531,9 +1534,10 @@ bool SfxItemSet::operator==(const SfxItemSet &rCmp) const
...
@@ -1531,9 +1534,10 @@ bool SfxItemSet::operator==(const SfxItemSet &rCmp) const
return
false
;
return
false
;
// Are the Ranges themselves unequal?
// Are the Ranges themselves unequal?
for
(
sal_uInt16
nRange
=
0
;
_pWhichRanges
[
nRange
];
nRange
+=
2
)
for
(
sal_uInt16
nRange
=
0
;
m_pWhichRanges
[
nRange
];
nRange
+=
2
)
if
(
_pWhichRanges
[
nRange
]
!=
rCmp
.
_pWhichRanges
[
nRange
]
||
{
_pWhichRanges
[
nRange
+
1
]
!=
rCmp
.
_pWhichRanges
[
nRange
+
1
]
)
if
(
m_pWhichRanges
[
nRange
]
!=
rCmp
.
m_pWhichRanges
[
nRange
]
||
m_pWhichRanges
[
nRange
+
1
]
!=
rCmp
.
m_pWhichRanges
[
nRange
+
1
])
{
{
// We must use the slow method then
// We must use the slow method then
SfxWhichIter
aIter
(
*
this
);
SfxWhichIter
aIter
(
*
this
);
...
@@ -1547,21 +1551,22 @@ bool SfxItemSet::operator==(const SfxItemSet &rCmp) const
...
@@ -1547,21 +1551,22 @@ bool SfxItemSet::operator==(const SfxItemSet &rCmp) const
rCmp
.
GetItemState
(
nWh
,
false
,
&
pItem2
)
||
rCmp
.
GetItemState
(
nWh
,
false
,
&
pItem2
)
||
(
pItem1
!=
pItem2
&&
(
pItem1
!=
pItem2
&&
(
!
pItem1
||
IsInvalidItem
(
pItem1
)
||
(
!
pItem1
||
IsInvalidItem
(
pItem1
)
||
(
_pPool
->
IsItemFlag
(
*
pItem1
,
SFX_ITEM_POOLABLE
)
&&
(
m
_pPool
->
IsItemFlag
(
*
pItem1
,
SFX_ITEM_POOLABLE
)
&&
*
pItem1
!=
*
pItem2
)
)
)
)
*
pItem1
!=
*
pItem2
)
)
)
)
return
false
;
return
false
;
}
}
return
true
;
return
true
;
}
}
}
// Are all pointers the same?
// Are all pointers the same?
if
(
0
==
memcmp
(
_aItems
,
rCmp
.
_aItems
,
nCount1
*
sizeof
(
_aItems
[
0
])
)
)
if
(
0
==
memcmp
(
m_pItems
,
rCmp
.
m_pItems
,
nCount1
*
sizeof
(
m_pItems
[
0
])
)
)
return
true
;
return
true
;
// We need to compare each one separately then
// We need to compare each one separately then
const
SfxPoolItem
**
ppItem1
=
(
const
SfxPoolItem
**
)
_a
Items
;
const
SfxPoolItem
**
ppItem1
=
m_p
Items
;
const
SfxPoolItem
**
ppItem2
=
(
const
SfxPoolItem
**
)
rCmp
.
_a
Items
;
const
SfxPoolItem
**
ppItem2
=
rCmp
.
m_p
Items
;
for
(
sal_uInt16
nPos
=
0
;
nPos
<
nCount1
;
++
nPos
)
for
(
sal_uInt16
nPos
=
0
;
nPos
<
nCount1
;
++
nPos
)
{
{
// If the pointers of the poolable Items are not the same, the Items
// If the pointers of the poolable Items are not the same, the Items
...
@@ -1569,7 +1574,7 @@ bool SfxItemSet::operator==(const SfxItemSet &rCmp) const
...
@@ -1569,7 +1574,7 @@ bool SfxItemSet::operator==(const SfxItemSet &rCmp) const
if
(
*
ppItem1
!=
*
ppItem2
&&
if
(
*
ppItem1
!=
*
ppItem2
&&
(
(
!*
ppItem1
||
!*
ppItem2
)
||
(
(
!*
ppItem1
||
!*
ppItem2
)
||
(
IsInvalidItem
(
*
ppItem1
)
||
IsInvalidItem
(
*
ppItem2
)
)
||
(
IsInvalidItem
(
*
ppItem1
)
||
IsInvalidItem
(
*
ppItem2
)
)
||
(
_pPool
->
IsItemFlag
(
**
ppItem1
,
SFX_ITEM_POOLABLE
)
)
||
(
m_pPool
->
IsItemFlag
(
**
ppItem1
,
SFX_ITEM_POOLABLE
)
)
||
**
ppItem1
!=
**
ppItem2
)
)
**
ppItem1
!=
**
ppItem2
)
)
return
false
;
return
false
;
...
@@ -1584,9 +1589,9 @@ bool SfxItemSet::operator==(const SfxItemSet &rCmp) const
...
@@ -1584,9 +1589,9 @@ bool SfxItemSet::operator==(const SfxItemSet &rCmp) const
SfxItemSet
*
SfxItemSet
::
Clone
(
bool
bItems
,
SfxItemPool
*
pToPool
)
const
SfxItemSet
*
SfxItemSet
::
Clone
(
bool
bItems
,
SfxItemPool
*
pToPool
)
const
{
{
if
(
pToPool
&&
pToPool
!=
_pPool
)
if
(
pToPool
&&
pToPool
!=
m_pPool
)
{
{
SfxItemSet
*
pNewSet
=
new
SfxItemSet
(
*
pToPool
,
_pWhichRanges
);
SfxItemSet
*
pNewSet
=
new
SfxItemSet
(
*
pToPool
,
m_pWhichRanges
);
if
(
bItems
)
if
(
bItems
)
{
{
SfxWhichIter
aIter
(
*
pNewSet
);
SfxWhichIter
aIter
(
*
pNewSet
);
...
@@ -1604,18 +1609,18 @@ SfxItemSet *SfxItemSet::Clone(bool bItems, SfxItemPool *pToPool ) const
...
@@ -1604,18 +1609,18 @@ SfxItemSet *SfxItemSet::Clone(bool bItems, SfxItemPool *pToPool ) const
else
else
return
bItems
return
bItems
?
new
SfxItemSet
(
*
this
)
?
new
SfxItemSet
(
*
this
)
:
new
SfxItemSet
(
*
_pPool
,
_pWhichRanges
);
:
new
SfxItemSet
(
*
m_pPool
,
m
_pWhichRanges
);
}
}
int
SfxItemSet
::
PutDirect
(
const
SfxPoolItem
&
rItem
)
int
SfxItemSet
::
PutDirect
(
const
SfxPoolItem
&
rItem
)
{
{
SfxItemArray
ppFnd
=
_a
Items
;
SfxItemArray
ppFnd
=
m_p
Items
;
const
sal_uInt16
*
pPtr
=
_pWhichRanges
;
const
sal_uInt16
*
pPtr
=
m
_pWhichRanges
;
const
sal_uInt16
nWhich
=
rItem
.
Which
();
const
sal_uInt16
nWhich
=
rItem
.
Which
();
#ifdef DBG_UTIL
#ifdef DBG_UTIL
IsPoolDefaultItem
(
&
rItem
)
||
_pPool
->
GetSurrogate
(
&
rItem
);
IsPoolDefaultItem
(
&
rItem
)
||
m
_pPool
->
GetSurrogate
(
&
rItem
);
// Only cause assertion in the callees
// Only cause assertion in the callees
#endif
#endif
while
(
*
pPtr
)
while
(
*
pPtr
)
...
@@ -1629,14 +1634,14 @@ int SfxItemSet::PutDirect(const SfxPoolItem &rItem)
...
@@ -1629,14 +1634,14 @@ int SfxItemSet::PutDirect(const SfxPoolItem &rItem)
{
{
if
(
rItem
==
**
ppFnd
)
if
(
rItem
==
**
ppFnd
)
return
sal_False
;
// Already present!
return
sal_False
;
// Already present!
_pPool
->
Remove
(
*
pOld
);
m
_pPool
->
Remove
(
*
pOld
);
}
}
else
else
++
_nCount
;
++
m
_nCount
;
// Add the new one
// Add the new one
if
(
IsPoolDefaultItem
(
&
rItem
)
)
if
(
IsPoolDefaultItem
(
&
rItem
)
)
*
ppFnd
=
&
_pPool
->
Put
(
rItem
);
*
ppFnd
=
&
m
_pPool
->
Put
(
rItem
);
else
else
{
{
*
ppFnd
=
&
rItem
;
*
ppFnd
=
&
rItem
;
...
@@ -1660,11 +1665,11 @@ SfxAllItemSet::SfxAllItemSet( SfxItemPool &rPool )
...
@@ -1660,11 +1665,11 @@ SfxAllItemSet::SfxAllItemSet( SfxItemPool &rPool )
nFree
(
nInitCount
)
nFree
(
nInitCount
)
{
{
// Initially no Items
// Initially no Items
_aItems
=
0
;
m_pItems
=
nullptr
;
// Allocate nInitCount pairs at USHORTs for Ranges
// Allocate nInitCount pairs at USHORTs for Ranges
_pWhichRanges
=
new
sal_uInt16
[
nInitCount
+
1
];
m
_pWhichRanges
=
new
sal_uInt16
[
nInitCount
+
1
];
memset
(
_pWhichRanges
,
0
,
(
nInitCount
+
1
)
*
sizeof
(
sal_uInt16
)
);
memset
(
m_pWhichRanges
,
0
,
(
nInitCount
+
1
)
*
sizeof
(
sal_uInt16
)
);
}
}
...
@@ -1760,11 +1765,11 @@ static SfxItemArray AddItem_Impl(SfxItemArray pItems, sal_uInt16 nOldSize, sal_u
...
@@ -1760,11 +1765,11 @@ static SfxItemArray AddItem_Impl(SfxItemArray pItems, sal_uInt16 nOldSize, sal_u
*/
*/
const
SfxPoolItem
*
SfxAllItemSet
::
Put
(
const
SfxPoolItem
&
rItem
,
sal_uInt16
nWhich
)
const
SfxPoolItem
*
SfxAllItemSet
::
Put
(
const
SfxPoolItem
&
rItem
,
sal_uInt16
nWhich
)
{
{
sal_uInt16
nPos
=
0
;
// Position for 'rItem' in '
_a
Items'
sal_uInt16
nPos
=
0
;
// Position for 'rItem' in '
m_p
Items'
const
sal_uInt16
nItemCount
=
TotalCount
();
const
sal_uInt16
nItemCount
=
TotalCount
();
// Let's see first whether there's a suitable Range already
// Let's see first whether there's a suitable Range already
sal_uInt16
*
pPtr
=
_pWhichRanges
;
sal_uInt16
*
pPtr
=
m
_pWhichRanges
;
while
(
*
pPtr
)
while
(
*
pPtr
)
{
{
// WhichId is within this Range?
// WhichId is within this Range?
...
@@ -1775,7 +1780,7 @@ const SfxPoolItem* SfxAllItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhi
...
@@ -1775,7 +1780,7 @@ const SfxPoolItem* SfxAllItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhi
break
;
break
;
}
}
// Carry over the position of the Item in
_a
Items
// Carry over the position of the Item in
m_p
Items
nPos
+=
*
(
pPtr
+
1
)
-
*
pPtr
+
1
;
nPos
+=
*
(
pPtr
+
1
)
-
*
pPtr
+
1
;
// To the next Range
// To the next Range
...
@@ -1786,7 +1791,7 @@ const SfxPoolItem* SfxAllItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhi
...
@@ -1786,7 +1791,7 @@ const SfxPoolItem* SfxAllItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhi
if
(
!*
pPtr
)
if
(
!*
pPtr
)
{
{
// Let's see if we can attach it somewhere
// Let's see if we can attach it somewhere
pPtr
=
_pWhichRanges
;
pPtr
=
m
_pWhichRanges
;
nPos
=
0
;
nPos
=
0
;
while
(
*
pPtr
)
while
(
*
pPtr
)
{
{
...
@@ -1797,7 +1802,7 @@ const SfxPoolItem* SfxAllItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhi
...
@@ -1797,7 +1802,7 @@ const SfxPoolItem* SfxAllItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhi
(
*
pPtr
)
--
;
(
*
pPtr
)
--
;
// Make room before first Item of this Range
// Make room before first Item of this Range
_aItems
=
AddItem_Impl
(
_a
Items
,
nItemCount
,
nPos
);
m_pItems
=
AddItem_Impl
(
m_p
Items
,
nItemCount
,
nPos
);
break
;
break
;
}
}
...
@@ -1809,11 +1814,11 @@ const SfxPoolItem* SfxAllItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhi
...
@@ -1809,11 +1814,11 @@ const SfxPoolItem* SfxAllItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhi
// Make room after last Item of this Range
// Make room after last Item of this Range
nPos
+=
nWhich
-
*
pPtr
;
nPos
+=
nWhich
-
*
pPtr
;
_aItems
=
AddItem_Impl
(
_a
Items
,
nItemCount
,
nPos
);
m_pItems
=
AddItem_Impl
(
m_p
Items
,
nItemCount
,
nPos
);
break
;
break
;
}
}
// Carry over position of the Item in
_a
Items
// Carry over position of the Item in
m_p
Items
nPos
+=
*
(
pPtr
+
1
)
-
*
pPtr
+
1
;
nPos
+=
*
(
pPtr
+
1
)
-
*
pPtr
+
1
;
// To the next Range
// To the next Range
...
@@ -1824,54 +1829,56 @@ const SfxPoolItem* SfxAllItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhi
...
@@ -1824,54 +1829,56 @@ const SfxPoolItem* SfxAllItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhi
// No extensible Range found?
// No extensible Range found?
if
(
!*
pPtr
)
if
(
!*
pPtr
)
{
{
// No room left in _pWhichRanges? => Expand!
// No room left in
m
_pWhichRanges? => Expand!
std
::
ptrdiff_t
nSize
=
pPtr
-
_pWhichRanges
;
std
::
ptrdiff_t
nSize
=
pPtr
-
m
_pWhichRanges
;
if
(
!
nFree
)
if
(
!
nFree
)
{
{
_pWhichRanges
=
AddRanges_Impl
(
_pWhichRanges
,
nSize
,
nInitCount
);
m_pWhichRanges
=
AddRanges_Impl
(
m
_pWhichRanges
,
nSize
,
nInitCount
);
nFree
+=
nInitCount
;
nFree
+=
nInitCount
;
}
}
// Attach new WhichRange
// Attach new WhichRange
pPtr
=
_pWhichRanges
+
nSize
;
pPtr
=
m
_pWhichRanges
+
nSize
;
*
pPtr
++
=
nWhich
;
*
pPtr
++
=
nWhich
;
*
pPtr
=
nWhich
;
*
pPtr
=
nWhich
;
nFree
-=
2
;
nFree
-=
2
;
// Expand ItemArray
// Expand ItemArray
nPos
=
nItemCount
;
nPos
=
nItemCount
;
_aItems
=
AddItem_Impl
(
_a
Items
,
nItemCount
,
nPos
);
m_pItems
=
AddItem_Impl
(
m_p
Items
,
nItemCount
,
nPos
);
}
}
// Add new Item to Pool
// Add new Item to Pool
const
SfxPoolItem
&
rNew
=
_pPool
->
Put
(
rItem
,
nWhich
);
const
SfxPoolItem
&
rNew
=
m
_pPool
->
Put
(
rItem
,
nWhich
);
// Remember old Item
// Remember old Item
bool
bIncrementCount
=
false
;
bool
bIncrementCount
=
false
;
const
SfxPoolItem
*
pOld
=
*
(
_a
Items
+
nPos
);
const
SfxPoolItem
*
pOld
=
*
(
m_p
Items
+
nPos
);
if
(
reinterpret_cast
<
SfxPoolItem
*
>
(
-
1
)
==
pOld
)
// state "dontcare"
if
(
reinterpret_cast
<
SfxPoolItem
*
>
(
-
1
)
==
pOld
)
// state "dontcare"
pOld
=
NULL
;
pOld
=
NULL
;
if
(
!
pOld
)
if
(
!
pOld
)
{
{
bIncrementCount
=
true
;
bIncrementCount
=
true
;
pOld
=
_pParent
?
pOld
=
(
m_pParent
)
&
_pParent
->
Get
(
nWhich
,
true
)
?
&
m_pParent
->
Get
(
nWhich
,
true
)
:
nWhich
<=
SFX_WHICH_MAX
?
&
_pPool
->
GetDefaultItem
(
nWhich
)
:
0
;
:
((
nWhich
<=
SFX_WHICH_MAX
)
?
&
m_pPool
->
GetDefaultItem
(
nWhich
)
:
nullptr
);
}
}
// Add new Item to ItemSet
// Add new Item to ItemSet
*
(
_a
Items
+
nPos
)
=
&
rNew
;
*
(
m_p
Items
+
nPos
)
=
&
rNew
;
// Send Changed Notification
// Send Changed Notification
if
(
pOld
)
if
(
pOld
)
{
{
Changed
(
*
pOld
,
rNew
);
Changed
(
*
pOld
,
rNew
);
if
(
!
IsDefaultItem
(
pOld
)
)
if
(
!
IsDefaultItem
(
pOld
)
)
_pPool
->
Remove
(
*
pOld
);
m
_pPool
->
Remove
(
*
pOld
);
}
}
if
(
bIncrementCount
)
if
(
bIncrementCount
)
++
_nCount
;
++
m
_nCount
;
return
&
rNew
;
return
&
rNew
;
}
}
...
@@ -1890,7 +1897,7 @@ void SfxItemSet::DisableItem(sal_uInt16 nWhich)
...
@@ -1890,7 +1897,7 @@ void SfxItemSet::DisableItem(sal_uInt16 nWhich)
SfxItemSet
*
SfxAllItemSet
::
Clone
(
bool
bItems
,
SfxItemPool
*
pToPool
)
const
SfxItemSet
*
SfxAllItemSet
::
Clone
(
bool
bItems
,
SfxItemPool
*
pToPool
)
const
{
{
if
(
pToPool
&&
pToPool
!=
_pPool
)
if
(
pToPool
&&
pToPool
!=
m_pPool
)
{
{
SfxAllItemSet
*
pNewSet
=
new
SfxAllItemSet
(
*
pToPool
);
SfxAllItemSet
*
pNewSet
=
new
SfxAllItemSet
(
*
pToPool
);
if
(
bItems
)
if
(
bItems
)
...
@@ -1898,7 +1905,7 @@ SfxItemSet *SfxAllItemSet::Clone(bool bItems, SfxItemPool *pToPool ) const
...
@@ -1898,7 +1905,7 @@ SfxItemSet *SfxAllItemSet::Clone(bool bItems, SfxItemPool *pToPool ) const
return
pNewSet
;
return
pNewSet
;
}
}
else
else
return
bItems
?
new
SfxAllItemSet
(
*
this
)
:
new
SfxAllItemSet
(
*
_pPool
);
return
bItems
?
new
SfxAllItemSet
(
*
this
)
:
new
SfxAllItemSet
(
*
m
_pPool
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment