Lines 65-70
Link Here
|
65 |
|
65 |
|
66 |
#pragma hdrstop |
66 |
#pragma hdrstop |
67 |
|
67 |
|
|
|
68 |
#include <map> |
69 |
|
68 |
#define ITEMID_BOXINFO SID_ATTR_BORDER_INNER |
70 |
#define ITEMID_BOXINFO SID_ATTR_BORDER_INNER |
69 |
#define ITEMID_SIZE SID_ATTR_PAGE_SIZE |
71 |
#define ITEMID_SIZE SID_ATTR_PAGE_SIZE |
70 |
#include <hintids.hxx> |
72 |
#include <hintids.hxx> |
Lines 1595-1600
Link Here
|
1595 |
|* |
1597 |
|* |
1596 |
|*************************************************************************/ |
1598 |
|*************************************************************************/ |
1597 |
|
1599 |
|
|
|
1600 |
std::map<const void*, std::pair<const void*, int> > aGlobalCache; |
1601 |
|
1598 |
SwBorderAttrs::SwBorderAttrs( const SwModify *pMod, const SwFrm *pConstructor ) : |
1602 |
SwBorderAttrs::SwBorderAttrs( const SwModify *pMod, const SwFrm *pConstructor ) : |
1599 |
SwCacheObj( pMod ), |
1603 |
SwCacheObj( pMod ), |
1600 |
rAttrSet( pConstructor->IsCntntFrm() |
1604 |
rAttrSet( pConstructor->IsCntntFrm() |
Lines 1616-1625
Link Here
|
1616 |
bCacheGetLine = bCachedGetTopLine = bCachedGetBottomLine = FALSE; |
1620 |
bCacheGetLine = bCachedGetTopLine = bCachedGetBottomLine = FALSE; |
1617 |
|
1621 |
|
1618 |
bBorderDist = 0 != (pConstructor->GetType() & (FRM_CELL)); |
1622 |
bBorderDist = 0 != (pConstructor->GetType() & (FRM_CELL)); |
|
|
1623 |
|
1624 |
std::pair<const void *, int> aTest(&rAttrSet, 0); |
1625 |
aGlobalCache[GetOwner()] = aTest; |
1626 |
} |
1627 |
|
1628 |
const SvxBoxItem &SwBorderAttrs::GetBox() const |
1629 |
{ |
1630 |
typedef std::map<const void*, std::pair<const void*, int> > |
1631 |
::const_iterator myciter; |
1632 |
|
1633 |
for (myciter aIter = aGlobalCache.begin(); |
1634 |
aIter != aGlobalCache.end(); ++aIter) |
1635 |
{ |
1636 |
const std::pair<const void *, int> &rTest = aIter->second; |
1637 |
if ((rTest.first == &rAttrSet) && (rTest.second != 0)) |
1638 |
{ |
1639 |
ASSERT(!(rTest.second & 0x1), "use of deleted cache entry"); |
1640 |
ASSERT(!(rTest.second & 0x2), "use of changed attrset"); |
1641 |
return rAttrSet.GetBox(); |
1642 |
} |
1643 |
} |
1644 |
|
1645 |
const SvxBoxItem *pTest = &rAttrSet.GetBox(); |
1646 |
ASSERT(pTest == &rBox, |
1647 |
"who changed my box without either cache knowing about it!"); |
1648 |
return rBox; |
1619 |
} |
1649 |
} |
1620 |
|
1650 |
|
1621 |
SwBorderAttrs::~SwBorderAttrs() |
1651 |
SwBorderAttrs::~SwBorderAttrs() |
1622 |
{ |
1652 |
{ |
|
|
1653 |
aGlobalCache.erase(pOwner); |
1623 |
((SwModify*)pOwner)->SetInCache( FALSE ); |
1654 |
((SwModify*)pOwner)->SetInCache( FALSE ); |
1624 |
} |
1655 |
} |
1625 |
|
1656 |
|