Removing unused serialisation code
Change-Id: Id31c8de69043d393f005f83d5c7eba878af5119c Reviewed-on: https://gerrit.libreoffice.org/41149 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
This commit is contained in:
committed by
Michael Stahl
parent
b607f62fde
commit
b021353dd6
@@ -151,25 +151,10 @@ public:
|
|||||||
void Remove( const SfxPoolItem& );
|
void Remove( const SfxPoolItem& );
|
||||||
const SfxPoolItem& GetDefaultItem( sal_uInt16 nWhich ) const;
|
const SfxPoolItem& GetDefaultItem( sal_uInt16 nWhich ) const;
|
||||||
|
|
||||||
const SfxPoolItem* LoadItem( SvStream &rStream,
|
|
||||||
const SfxItemPool *pRefPool );
|
|
||||||
bool StoreItem( SvStream &rStream,
|
|
||||||
const SfxPoolItem &rItem,
|
|
||||||
bool bDirect ) const;
|
|
||||||
|
|
||||||
sal_uInt32 GetSurrogate(const SfxPoolItem *) const;
|
sal_uInt32 GetSurrogate(const SfxPoolItem *) const;
|
||||||
const SfxPoolItem * GetItem2(sal_uInt16 nWhich, sal_uInt32 nSurrogate) const;
|
const SfxPoolItem * GetItem2(sal_uInt16 nWhich, sal_uInt32 nSurrogate) const;
|
||||||
const SfxPoolItem * GetItem2Default(sal_uInt16 nWhich) const;
|
const SfxPoolItem * GetItem2Default(sal_uInt16 nWhich) const;
|
||||||
sal_uInt32 GetItemCount2(sal_uInt16 nWhich) const;
|
sal_uInt32 GetItemCount2(sal_uInt16 nWhich) const;
|
||||||
const SfxPoolItem* LoadSurrogate(SvStream& rStream,
|
|
||||||
sal_uInt16 &rWhich, sal_uInt16 nSlotId,
|
|
||||||
const SfxItemPool* pRefPool = nullptr );
|
|
||||||
bool StoreSurrogate(SvStream& rStream,
|
|
||||||
const SfxPoolItem *pItem ) const;
|
|
||||||
|
|
||||||
SvStream & Load(SvStream &);
|
|
||||||
SvStream & Store(SvStream &) const;
|
|
||||||
void LoadCompleted();
|
|
||||||
|
|
||||||
sal_uInt16 GetFirstWhich() const;
|
sal_uInt16 GetFirstWhich() const;
|
||||||
sal_uInt16 GetLastWhich() const;
|
sal_uInt16 GetLastWhich() const;
|
||||||
@@ -191,12 +176,8 @@ public:
|
|||||||
sal_uInt16 GetTrueWhich( sal_uInt16 nSlot, bool bDeep = true ) const;
|
sal_uInt16 GetTrueWhich( sal_uInt16 nSlot, bool bDeep = true ) const;
|
||||||
sal_uInt16 GetTrueSlotId( sal_uInt16 nWhich ) const;
|
sal_uInt16 GetTrueSlotId( sal_uInt16 nWhich ) const;
|
||||||
|
|
||||||
void SetVersionMap( sal_uInt16 nVer,
|
|
||||||
sal_uInt16 nOldStart, sal_uInt16 nOldEnd,
|
|
||||||
const sal_uInt16 *pWhichIdTab );
|
|
||||||
sal_uInt16 GetNewWhich( sal_uInt16 nOldWhich ) const;
|
sal_uInt16 GetNewWhich( sal_uInt16 nOldWhich ) const;
|
||||||
void SetFileFormatVersion( sal_uInt16 nFileFormatVersion );
|
void SetFileFormatVersion( sal_uInt16 nFileFormatVersion );
|
||||||
bool IsCurrentVersionLoading() const;
|
|
||||||
|
|
||||||
static bool IsWhich(sal_uInt16 nId) {
|
static bool IsWhich(sal_uInt16 nId) {
|
||||||
return nId && nId <= SFX_WHICH_MAX; }
|
return nId && nId <= SFX_WHICH_MAX; }
|
||||||
|
@@ -202,9 +202,6 @@ public:
|
|||||||
void MergeRange( sal_uInt16 nFrom, sal_uInt16 nTo );
|
void MergeRange( sal_uInt16 nFrom, sal_uInt16 nTo );
|
||||||
const SfxItemSet* GetParent() const { return m_pParent; }
|
const SfxItemSet* GetParent() const { return m_pParent; }
|
||||||
|
|
||||||
void Load( SvStream & );
|
|
||||||
void Store( SvStream &, bool bDirect = false ) const;
|
|
||||||
|
|
||||||
bool operator==(const SfxItemSet &) const;
|
bool operator==(const SfxItemSet &) const;
|
||||||
|
|
||||||
/** Compare possibly ignoring SfxItemPool pointer.
|
/** Compare possibly ignoring SfxItemPool pointer.
|
||||||
@@ -220,8 +217,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool Equals(const SfxItemSet &, bool bComparePool) const;
|
bool Equals(const SfxItemSet &, bool bComparePool) const;
|
||||||
|
|
||||||
sal_Int32 getHash() const;
|
|
||||||
OString stringify() const;
|
|
||||||
void dumpAsXml(struct _xmlTextWriter* pWriter) const;
|
void dumpAsXml(struct _xmlTextWriter* pWriter) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -287,8 +287,6 @@ public:
|
|||||||
|
|
||||||
// create a copy of itself
|
// create a copy of itself
|
||||||
virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override = 0;
|
virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override = 0;
|
||||||
virtual SfxPoolItem* Create(SvStream &, sal_uInt16 nVersion) const override = 0;
|
|
||||||
virtual SvStream& Store(SvStream &, sal_uInt16 nVer) const override;
|
|
||||||
|
|
||||||
const SfxItemSet& GetItemSet() const
|
const SfxItemSet& GetItemSet() const
|
||||||
{ return *pSet; }
|
{ return *pSet; }
|
||||||
|
@@ -75,8 +75,6 @@ public:
|
|||||||
|
|
||||||
virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
|
virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
|
||||||
virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
|
virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
|
||||||
virtual SfxPoolItem* Create( SvStream&, sal_uInt16 ) const override;
|
|
||||||
virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const override;
|
|
||||||
|
|
||||||
// orientation
|
// orientation
|
||||||
SvxPageUsage GetPageUsage() const { return eUse; }
|
SvxPageUsage GetPageUsage() const { return eUse; }
|
||||||
@@ -111,9 +109,6 @@ public:
|
|||||||
MapUnit eCoreMetric,
|
MapUnit eCoreMetric,
|
||||||
MapUnit ePresMetric,
|
MapUnit ePresMetric,
|
||||||
OUString &rText, const IntlWrapper& ) const override;
|
OUString &rText, const IntlWrapper& ) const override;
|
||||||
|
|
||||||
virtual SfxPoolItem* Create( SvStream&, sal_uInt16 nVersion ) const override;
|
|
||||||
virtual SvStream& Store( SvStream&, sal_uInt16 nItemVersion ) const override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -37,7 +37,6 @@ public:
|
|||||||
XFillAttrSetItem(const XFillAttrSetItem& rAttr,
|
XFillAttrSetItem(const XFillAttrSetItem& rAttr,
|
||||||
SfxItemPool* pItemPool);
|
SfxItemPool* pItemPool);
|
||||||
virtual SfxPoolItem* Clone( SfxItemPool* pToPool = nullptr ) const override;
|
virtual SfxPoolItem* Clone( SfxItemPool* pToPool = nullptr ) const override;
|
||||||
virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVersion ) const override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -37,7 +37,6 @@ public:
|
|||||||
XLineAttrSetItem(const XLineAttrSetItem& rAttr,
|
XLineAttrSetItem(const XLineAttrSetItem& rAttr,
|
||||||
SfxItemPool* pItemPool);
|
SfxItemPool* pItemPool);
|
||||||
virtual SfxPoolItem* Clone( SfxItemPool* pToPool = nullptr ) const override;
|
virtual SfxPoolItem* Clone( SfxItemPool* pToPool = nullptr ) const override;
|
||||||
virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVersion ) const override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -64,8 +64,6 @@ public:
|
|||||||
virtual ~ScPatternAttr() override;
|
virtual ~ScPatternAttr() override;
|
||||||
|
|
||||||
virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override;
|
virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override;
|
||||||
virtual SfxPoolItem* Create(SvStream& rStream, sal_uInt16 nVersion) const override;
|
|
||||||
virtual SvStream& Store(SvStream& rStream, sal_uInt16 nItemVersion) const override;
|
|
||||||
|
|
||||||
virtual bool operator==(const SfxPoolItem& rCmp) const override;
|
virtual bool operator==(const SfxPoolItem& rCmp) const override;
|
||||||
|
|
||||||
|
@@ -143,53 +143,6 @@ bool ScPatternAttr::operator==( const SfxPoolItem& rCmp ) const
|
|||||||
StrCmp( GetStyleName(), static_cast<const ScPatternAttr&>(rCmp).GetStyleName() ) );
|
StrCmp( GetStyleName(), static_cast<const ScPatternAttr&>(rCmp).GetStyleName() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
SfxPoolItem* ScPatternAttr::Create( SvStream& rStream, sal_uInt16 /* nVersion */ ) const
|
|
||||||
{
|
|
||||||
OUString* pStr;
|
|
||||||
bool bHasStyle;
|
|
||||||
|
|
||||||
rStream.ReadCharAsBool( bHasStyle );
|
|
||||||
|
|
||||||
if ( bHasStyle )
|
|
||||||
{
|
|
||||||
short eFamDummy;
|
|
||||||
pStr = new OUString;
|
|
||||||
*pStr = rStream.ReadUniOrByteString( rStream.GetStreamCharSet() );
|
|
||||||
rStream.ReadInt16( eFamDummy ); // due to old data format
|
|
||||||
}
|
|
||||||
else
|
|
||||||
pStr = new OUString( ScGlobal::GetRscString(STR_STYLENAME_STANDARD) );
|
|
||||||
|
|
||||||
auto pNewSet = o3tl::make_unique<SfxItemSet>( *GetItemSet().GetPool(),
|
|
||||||
svl::Items<ATTR_PATTERN_START, ATTR_PATTERN_END>{} );
|
|
||||||
pNewSet->Load( rStream );
|
|
||||||
|
|
||||||
ScPatternAttr* pPattern = new ScPatternAttr( std::move(pNewSet) );
|
|
||||||
|
|
||||||
pPattern->pName.reset( pStr );
|
|
||||||
|
|
||||||
return pPattern;
|
|
||||||
}
|
|
||||||
|
|
||||||
SvStream& ScPatternAttr::Store(SvStream& rStream, sal_uInt16 /* nItemVersion */) const
|
|
||||||
{
|
|
||||||
rStream.WriteBool( true );
|
|
||||||
|
|
||||||
if ( pStyle )
|
|
||||||
rStream.WriteUniOrByteString( pStyle->GetName(), rStream.GetStreamCharSet() );
|
|
||||||
else if ( pName ) // when style is/was deleted
|
|
||||||
rStream.WriteUniOrByteString( *pName, rStream.GetStreamCharSet() );
|
|
||||||
else
|
|
||||||
rStream.WriteUniOrByteString( ScGlobal::GetRscString(STR_STYLENAME_STANDARD),
|
|
||||||
rStream.GetStreamCharSet() );
|
|
||||||
|
|
||||||
rStream.WriteInt16( (sal_uInt16) SfxStyleFamily::Para ); // due to old data format
|
|
||||||
|
|
||||||
GetItemSet().Store( rStream );
|
|
||||||
|
|
||||||
return rStream;
|
|
||||||
}
|
|
||||||
|
|
||||||
SvxCellOrientation ScPatternAttr::GetCellOrientation( const SfxItemSet& rItemSet, const SfxItemSet* pCondSet )
|
SvxCellOrientation ScPatternAttr::GetCellOrientation( const SfxItemSet& rItemSet, const SfxItemSet* pCondSet )
|
||||||
{
|
{
|
||||||
SvxCellOrientation eOrient = SVX_ORIENTATION_STANDARD;
|
SvxCellOrientation eOrient = SVX_ORIENTATION_STANDARD;
|
||||||
|
@@ -103,18 +103,14 @@ struct SfxItemPool_Impl
|
|||||||
SfxItemPool* mpMaster;
|
SfxItemPool* mpMaster;
|
||||||
SfxItemPool* mpSecondary;
|
SfxItemPool* mpSecondary;
|
||||||
sal_uInt16* mpPoolRanges;
|
sal_uInt16* mpPoolRanges;
|
||||||
std::deque< SfxPoolVersion_ImplPtr > aVersions;
|
|
||||||
sal_uInt16 mnStart;
|
sal_uInt16 mnStart;
|
||||||
sal_uInt16 mnEnd;
|
sal_uInt16 mnEnd;
|
||||||
sal_uInt16 mnFileFormatVersion;
|
sal_uInt16 mnFileFormatVersion;
|
||||||
sal_uInt16 nVersion;
|
sal_uInt16 nVersion;
|
||||||
sal_uInt16 nLoadingVersion;
|
|
||||||
sal_uInt16 nInitRefCount; // 1, during load, may be 2
|
sal_uInt16 nInitRefCount; // 1, during load, may be 2
|
||||||
sal_uInt16 nVerStart, nVerEnd; // WhichRange in versions
|
sal_uInt16 nVerStart, nVerEnd; // WhichRange in versions
|
||||||
sal_uInt8 nMajorVer, nMinorVer; // The Pool itself
|
|
||||||
MapUnit eDefMetric;
|
MapUnit eDefMetric;
|
||||||
bool bInSetItem;
|
bool bInSetItem;
|
||||||
bool bStreaming; // in Load() or Store()
|
|
||||||
bool mbPersistentRefCounts;
|
bool mbPersistentRefCounts;
|
||||||
|
|
||||||
SfxItemPool_Impl( SfxItemPool* pMaster, const OUString& rName, sal_uInt16 nStart, sal_uInt16 nEnd )
|
SfxItemPool_Impl( SfxItemPool* pMaster, const OUString& rName, sal_uInt16 nStart, sal_uInt16 nEnd )
|
||||||
@@ -129,15 +125,11 @@ struct SfxItemPool_Impl
|
|||||||
, mnEnd(nEnd)
|
, mnEnd(nEnd)
|
||||||
, mnFileFormatVersion(0)
|
, mnFileFormatVersion(0)
|
||||||
, nVersion(0)
|
, nVersion(0)
|
||||||
, nLoadingVersion(0)
|
|
||||||
, nInitRefCount(0)
|
, nInitRefCount(0)
|
||||||
, nVerStart(0)
|
, nVerStart(0)
|
||||||
, nVerEnd(0)
|
, nVerEnd(0)
|
||||||
, nMajorVer(0)
|
|
||||||
, nMinorVer(0)
|
|
||||||
, eDefMetric(MapUnit::MapCM)
|
, eDefMetric(MapUnit::MapCM)
|
||||||
, bInSetItem(false)
|
, bInSetItem(false)
|
||||||
, bStreaming(false)
|
|
||||||
, mbPersistentRefCounts(false)
|
, mbPersistentRefCounts(false)
|
||||||
{
|
{
|
||||||
DBG_ASSERT(mnStart, "Start-Which-Id must be greater 0" );
|
DBG_ASSERT(mnStart, "Start-Which-Id must be greater 0" );
|
||||||
@@ -159,9 +151,6 @@ struct SfxItemPool_Impl
|
|||||||
mpPoolRanges = nullptr;
|
mpPoolRanges = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void readTheItems(SvStream & rStream, sal_uInt32 nCount, sal_uInt16 nVersion,
|
|
||||||
SfxPoolItem const * pDefItem, SfxPoolItemArray_Impl ** pArr);
|
|
||||||
|
|
||||||
// unit testing
|
// unit testing
|
||||||
friend class PoolItemTest;
|
friend class PoolItemTest;
|
||||||
static SfxItemPool_Impl *GetImpl(SfxItemPool const *pPool) { return pPool->pImpl.get(); }
|
static SfxItemPool_Impl *GetImpl(SfxItemPool const *pPool) { return pPool->pImpl.get(); }
|
||||||
|
@@ -178,11 +178,7 @@ SfxItemPool::SfxItemPool
|
|||||||
{
|
{
|
||||||
pImpl->eDefMetric = MapUnit::MapTwip;
|
pImpl->eDefMetric = MapUnit::MapTwip;
|
||||||
pImpl->nVersion = 0;
|
pImpl->nVersion = 0;
|
||||||
pImpl->bStreaming = false;
|
|
||||||
pImpl->nLoadingVersion = 0;
|
|
||||||
pImpl->nInitRefCount = 1;
|
pImpl->nInitRefCount = 1;
|
||||||
pImpl->nVerStart = pImpl->mnStart;
|
|
||||||
pImpl->nVerEnd = pImpl->mnEnd;
|
|
||||||
pImpl->bInSetItem = false;
|
pImpl->bInSetItem = false;
|
||||||
pImpl->mbPersistentRefCounts = bLoadRefCounts;
|
pImpl->mbPersistentRefCounts = bLoadRefCounts;
|
||||||
|
|
||||||
@@ -210,11 +206,7 @@ SfxItemPool::SfxItemPool
|
|||||||
{
|
{
|
||||||
pImpl->eDefMetric = rPool.pImpl->eDefMetric;
|
pImpl->eDefMetric = rPool.pImpl->eDefMetric;
|
||||||
pImpl->nVersion = rPool.pImpl->nVersion;
|
pImpl->nVersion = rPool.pImpl->nVersion;
|
||||||
pImpl->bStreaming = false;
|
|
||||||
pImpl->nLoadingVersion = 0;
|
|
||||||
pImpl->nInitRefCount = 1;
|
pImpl->nInitRefCount = 1;
|
||||||
pImpl->nVerStart = rPool.pImpl->nVerStart;
|
|
||||||
pImpl->nVerEnd = rPool.pImpl->nVerEnd;
|
|
||||||
pImpl->bInSetItem = false;
|
pImpl->bInSetItem = false;
|
||||||
pImpl->mbPersistentRefCounts = rPool.pImpl->mbPersistentRefCounts;
|
pImpl->mbPersistentRefCounts = rPool.pImpl->mbPersistentRefCounts;
|
||||||
|
|
||||||
@@ -241,13 +233,6 @@ SfxItemPool::SfxItemPool
|
|||||||
pImpl->maPoolDefaults[n]->SetKind(SfxItemKind::PoolDefault);
|
pImpl->maPoolDefaults[n]->SetKind(SfxItemKind::PoolDefault);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy Version map
|
|
||||||
for (std::shared_ptr<SfxPoolVersion_Impl>& pOld : rPool.pImpl->aVersions)
|
|
||||||
{
|
|
||||||
SfxPoolVersion_ImplPtr pNew = std::make_shared<SfxPoolVersion_Impl>( *pOld );
|
|
||||||
pImpl->aVersions.push_back( pNew );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Repair linkage
|
// Repair linkage
|
||||||
if ( rPool.pImpl->mpSecondary )
|
if ( rPool.pImpl->mpSecondary )
|
||||||
SetSecondaryPool( rPool.pImpl->mpSecondary->Clone() );
|
SetSecondaryPool( rPool.pImpl->mpSecondary->Clone() );
|
||||||
|
@@ -1323,127 +1323,6 @@ sal_uInt16 SfxItemSet::GetWhichByPos( sal_uInt16 nPos ) const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Saves the SfxItemSet instance to the supplied Stream.
|
|
||||||
* The surrogates as well as the ones with 'bDirect == true' are saved
|
|
||||||
* to the stream in the following way:
|
|
||||||
*
|
|
||||||
* sal_uInt16 ... Count of the set Items
|
|
||||||
* Count* m_pPool->StoreItem()
|
|
||||||
*
|
|
||||||
* @see SfxItemPool::StoreItem() const
|
|
||||||
* @see SfxItemSet::Load(SvStream&,bool,const SfxItemPool*)
|
|
||||||
*/
|
|
||||||
void SfxItemSet::Store
|
|
||||||
(
|
|
||||||
SvStream& rStream, // Target stream for normal Items
|
|
||||||
bool bDirect /* true: Save Items directly
|
|
||||||
false: Surrogates */
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
assert(m_pPool);
|
|
||||||
|
|
||||||
// Remember position of the count (to be able to correct it, if need be)
|
|
||||||
sal_uLong nCountPos = rStream.Tell();
|
|
||||||
rStream.WriteUInt16( m_nCount );
|
|
||||||
|
|
||||||
// If there's nothing to save, don't construct an ItemIter
|
|
||||||
if (m_nCount)
|
|
||||||
{
|
|
||||||
// Keep record of how many Items are really saved
|
|
||||||
sal_uInt16 nWrittenCount = 0; // Count of Items streamed in 'rStream'
|
|
||||||
|
|
||||||
// Iterate over all set Items
|
|
||||||
SfxItemIter aIter(*this);
|
|
||||||
for ( const SfxPoolItem *pItem = aIter.FirstItem();
|
|
||||||
pItem;
|
|
||||||
pItem = aIter.NextItem() )
|
|
||||||
{
|
|
||||||
// Let Items (if need be as a Surrogate) be saved via Pool
|
|
||||||
SAL_WARN_IF(IsInvalidItem(pItem), "svl.items", "can't store invalid items");
|
|
||||||
if ( !IsInvalidItem(pItem) &&
|
|
||||||
m_pPool->StoreItem( rStream, *pItem, bDirect ) )
|
|
||||||
// Item was streamed in 'rStream'
|
|
||||||
++nWrittenCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fewer written than read (e.g. old format)
|
|
||||||
if (nWrittenCount != m_nCount)
|
|
||||||
{
|
|
||||||
// Store real count in the stream
|
|
||||||
sal_uLong nPos = rStream.Tell();
|
|
||||||
rStream.Seek( nCountPos );
|
|
||||||
rStream.WriteUInt16( nWrittenCount );
|
|
||||||
rStream.Seek( nPos );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method loads an SfxItemSet from a stream.
|
|
||||||
* If the SfxItemPool was loaded without RefCounts the loaded Item
|
|
||||||
* references are counted, else we assume the they were accounted for
|
|
||||||
* when loading the SfxItemPool.
|
|
||||||
*
|
|
||||||
* @see SfxItemSet::Store(Stream&,bool) const
|
|
||||||
*/
|
|
||||||
void SfxItemSet::Load
|
|
||||||
(
|
|
||||||
SvStream& rStream // Stream we're loading from
|
|
||||||
)
|
|
||||||
{
|
|
||||||
assert(m_pPool);
|
|
||||||
|
|
||||||
// Resolve Surrogates with ItemSet's Pool
|
|
||||||
const SfxItemPool *pRefPool = m_pPool;
|
|
||||||
|
|
||||||
// Load Item count and as many Items
|
|
||||||
sal_uInt16 nCount = 0;
|
|
||||||
rStream.ReadUInt16( nCount );
|
|
||||||
|
|
||||||
const size_t nMinRecordSize = sizeof(sal_uInt16) * 2;
|
|
||||||
const size_t nMaxRecords = rStream.remainingSize() / nMinRecordSize;
|
|
||||||
if (nCount > nMaxRecords)
|
|
||||||
{
|
|
||||||
SAL_WARN("svl.items", "Parsing error: " << nMaxRecords <<
|
|
||||||
" max possible entries, but " << nCount << " claimed, truncating");
|
|
||||||
nCount = nMaxRecords;
|
|
||||||
}
|
|
||||||
|
|
||||||
for ( sal_uInt16 i = 0; i < nCount; ++i )
|
|
||||||
{
|
|
||||||
// Load Surrogate/Item and resolve Surrogate
|
|
||||||
const SfxPoolItem *pItem =
|
|
||||||
m_pPool->LoadItem( rStream, pRefPool );
|
|
||||||
|
|
||||||
// Did we load an Item or resolve a Surrogate?
|
|
||||||
if ( pItem )
|
|
||||||
{
|
|
||||||
// Find position for Item pointer in the set
|
|
||||||
sal_uInt16 nWhich = pItem->Which();
|
|
||||||
SfxItemArray ppFnd = m_pItems;
|
|
||||||
const sal_uInt16* pPtr = m_pWhichRanges;
|
|
||||||
while ( *pPtr )
|
|
||||||
{
|
|
||||||
// In this Range??
|
|
||||||
if ( *pPtr <= nWhich && nWhich <= *(pPtr+1) )
|
|
||||||
{
|
|
||||||
// Remember Item pointer in the set
|
|
||||||
ppFnd += nWhich - *pPtr;
|
|
||||||
SAL_WARN_IF( *ppFnd, "svl.items", "Item is present twice, with ID/pos " << nWhich);
|
|
||||||
*ppFnd = pItem;
|
|
||||||
++m_nCount;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// In the range array and Item array to the next Which range
|
|
||||||
ppFnd += *(pPtr+1) - *pPtr + 1;
|
|
||||||
pPtr += 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SfxItemSet::operator==(const SfxItemSet &rCmp) const
|
bool SfxItemSet::operator==(const SfxItemSet &rCmp) const
|
||||||
{
|
{
|
||||||
return Equals( rCmp, true);
|
return Equals( rCmp, true);
|
||||||
@@ -1586,20 +1465,6 @@ void SfxItemSet::PutDirect(const SfxPoolItem &rItem)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sal_Int32 SfxItemSet::getHash() const
|
|
||||||
{
|
|
||||||
return stringify().hashCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
OString SfxItemSet::stringify() const
|
|
||||||
{
|
|
||||||
SvMemoryStream aStream;
|
|
||||||
Store(aStream, true);
|
|
||||||
aStream.Flush();
|
|
||||||
return OString(
|
|
||||||
static_cast<char const *>(aStream.GetData()), aStream.GetEndOfData());
|
|
||||||
}
|
|
||||||
|
|
||||||
void SfxItemSet::dumpAsXml(xmlTextWriterPtr pWriter) const
|
void SfxItemSet::dumpAsXml(xmlTextWriterPtr pWriter) const
|
||||||
{
|
{
|
||||||
xmlTextWriterStartElement(pWriter, BAD_CAST("SfxItemSet"));
|
xmlTextWriterStartElement(pWriter, BAD_CAST("SfxItemSet"));
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -72,11 +72,4 @@ bool SfxSetItem::GetPresentation
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SvStream& SfxSetItem::Store(SvStream& rStream, sal_uInt16) const
|
|
||||||
{
|
|
||||||
GetItemSet().Store(rStream);
|
|
||||||
return rStream;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
@@ -229,38 +229,6 @@ bool SvxPageItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SfxPoolItem* SvxPageItem::Create( SvStream& rStream, sal_uInt16 ) const
|
|
||||||
{
|
|
||||||
sal_uInt8 eType;
|
|
||||||
bool bLand;
|
|
||||||
sal_uInt16 nUse;
|
|
||||||
|
|
||||||
// UNICODE: rStream >> sStr;
|
|
||||||
OUString sStr = rStream.ReadUniOrByteString( rStream.GetStreamCharSet() );
|
|
||||||
|
|
||||||
rStream.ReadUChar( eType );
|
|
||||||
rStream.ReadCharAsBool( bLand );
|
|
||||||
rStream.ReadUInt16( nUse );
|
|
||||||
|
|
||||||
SvxPageItem* pPage = new SvxPageItem( Which() );
|
|
||||||
pPage->SetDescName( sStr );
|
|
||||||
pPage->SetNumType( (SvxNumType)eType );
|
|
||||||
pPage->SetLandscape( bLand );
|
|
||||||
pPage->SetPageUsage( (SvxPageUsage)nUse );
|
|
||||||
return pPage;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
SvStream& SvxPageItem::Store( SvStream &rStrm, sal_uInt16 /*nItemVersion*/ ) const
|
|
||||||
{
|
|
||||||
// UNICODE: rStrm << aDescName;
|
|
||||||
rStrm.WriteUniOrByteString(aDescName, rStrm.GetStreamCharSet());
|
|
||||||
|
|
||||||
rStrm.WriteUChar( eNumType ).WriteBool( bLandscape ).WriteUInt16( (sal_uInt16)eUse );
|
|
||||||
return rStrm;
|
|
||||||
}
|
|
||||||
|
|
||||||
// HeaderFooterSet
|
// HeaderFooterSet
|
||||||
SvxSetItem::SvxSetItem( const sal_uInt16 nId, const SfxItemSet& rSet ) :
|
SvxSetItem::SvxSetItem( const sal_uInt16 nId, const SfxItemSet& rSet ) :
|
||||||
|
|
||||||
@@ -298,22 +266,5 @@ bool SvxSetItem::GetPresentation
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SfxPoolItem* SvxSetItem::Create(SvStream &rStrm, sal_uInt16 /*nVersion*/) const
|
|
||||||
{
|
|
||||||
SfxItemSet* _pSet = new SfxItemSet( *GetItemSet().GetPool(),
|
|
||||||
GetItemSet().GetRanges() );
|
|
||||||
|
|
||||||
_pSet->Load( rStrm );
|
|
||||||
|
|
||||||
return new SvxSetItem( Which(), *_pSet );
|
|
||||||
}
|
|
||||||
|
|
||||||
SvStream& SvxSetItem::Store(SvStream &rStrm, sal_uInt16 nItemVersion) const
|
|
||||||
{
|
|
||||||
GetItemSet().Store( rStrm, nItemVersion );
|
|
||||||
|
|
||||||
return rStrm;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
@@ -2918,15 +2918,6 @@ SfxPoolItem* XLineAttrSetItem::Clone( SfxItemPool* pPool ) const
|
|||||||
return new XLineAttrSetItem( *this, pPool );
|
return new XLineAttrSetItem( *this, pPool );
|
||||||
}
|
}
|
||||||
|
|
||||||
/// create a set item out of a stream
|
|
||||||
SfxPoolItem* XLineAttrSetItem::Create( SvStream& rStream, sal_uInt16 /*nVersion*/) const
|
|
||||||
{
|
|
||||||
auto pSet2 = o3tl::make_unique<SfxItemSet>( *GetItemSet().GetPool(),
|
|
||||||
svl::Items<XATTR_LINE_FIRST, XATTR_LINE_LAST>{});
|
|
||||||
pSet2->Load( rStream );
|
|
||||||
return new XLineAttrSetItem( std::move(pSet2) );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// fill attribute set item
|
/// fill attribute set item
|
||||||
XFillAttrSetItem::XFillAttrSetItem( std::unique_ptr<SfxItemSet>&& pItemSet ) :
|
XFillAttrSetItem::XFillAttrSetItem( std::unique_ptr<SfxItemSet>&& pItemSet ) :
|
||||||
SfxSetItem( XATTRSET_FILL, std::move(pItemSet))
|
SfxSetItem( XATTRSET_FILL, std::move(pItemSet))
|
||||||
@@ -2955,13 +2946,4 @@ SfxPoolItem* XFillAttrSetItem::Clone( SfxItemPool* pPool ) const
|
|||||||
return new XFillAttrSetItem( *this, pPool );
|
return new XFillAttrSetItem( *this, pPool );
|
||||||
}
|
}
|
||||||
|
|
||||||
/// create a set item out of a stream
|
|
||||||
SfxPoolItem* XFillAttrSetItem::Create( SvStream& rStream, sal_uInt16 /*nVersion*/) const
|
|
||||||
{
|
|
||||||
auto pSet2 = o3tl::make_unique<SfxItemSet>( *GetItemSet().GetPool(),
|
|
||||||
svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{});
|
|
||||||
pSet2->Load( rStream );
|
|
||||||
return new XFillAttrSetItem( std::move(pSet2) );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
Reference in New Issue
Block a user