Kaydet (Commit) b880be3c authored tarafından Bjoern Michaelsen's avatar Bjoern Michaelsen

reformat/reorg docbm.cxx

Change-Id: I73035e39c30056811d6518c5473c5793d0e5c943
üst 3df855e6
......@@ -1126,45 +1126,6 @@ namespace sw { namespace mark
namespace
{
class _SwSaveTypeCountContent
{
bool bCharBound;
sal_uInt16 nCount;
sal_Int32 nContent;
public:
_SwSaveTypeCountContent() { bCharBound=false; nCount=0; nContent = 0; }
_SwSaveTypeCountContent( const std::vector<sal_uLong> &rArr, sal_uInt16& rPos )
{
bCharBound = static_cast<bool>(rArr[ rPos++ ]);
nCount = static_cast<sal_uInt16>(rArr[ rPos++ ]);
nContent = static_cast<sal_Int32>(rArr[ rPos++ ]);
}
void Add( std::vector<sal_uLong> &rArr )
{
rArr.push_back( bCharBound );
rArr.push_back( nCount );
rArr.push_back( nContent );
}
void SetCharBound( bool bCB ) { bCharBound = bCB; }
bool IsCharBound() const { return bCharBound; }
void SetCount( sal_uInt16 n ) { nCount = n; }
sal_uInt16 GetCount() const { return nCount; }
sal_uInt16 DecCount() { return --nCount; }
void SetContent( sal_Int32 n ) { nContent = n; }
sal_Int32 GetContent() const { return nContent; }
#if OSL_DEBUG_LEVEL > 0
void Dump()
{
SAL_INFO("sw.core", "Count: " << GetCount() << "\tType: " << IsCharBound() << "\tContent: " << GetContent());
}
#endif
};
// #i59534: If a paragraph will be splitted we have to restore some redline positions
// This help function checks a position compared with a node and an content index
......@@ -1197,18 +1158,6 @@ namespace
{
return rPos.nNode > rNdIdx || ( pIdx && rPos.nNode == rNdIdx && rPos.nContent > pIdx->GetIndex() );
}
#if 0
static void DumpSaves(std::vector<sal_uLong> &rSaveArr)
{
sal_uInt16 n = 0;
while( n < rSaveArr.size() )
{
_SwSaveTypeCountContent aSave( rSaveArr, n );
aSave.Dump();
}
}
#endif
}
// IDocumentMarkAccess for SwDoc
......@@ -1419,12 +1368,71 @@ void _DelBookmarks(
}
void _SaveCntntIdx(SwDoc* pDoc,
namespace
{
struct MarkEntry
{
long int m_nIdx;
bool m_bOther;
sal_Int32 m_nCntnt;
#if 0
void Dump()
{
SAL_INFO("sw.core", "Index: " << m_nIdx << "\tOther: " << m_bOther << "\tContent: " << m_nCntnt);
}
#endif
};
struct PaMEntry
{
SwPaM* m_pPaM;
bool m_isMark;
sal_Int32 m_nCntnt;
};
class _SwSaveTypeCountContent
{
bool bCharBound;
sal_uInt16 nCount;
sal_Int32 nContent;
public:
_SwSaveTypeCountContent() { bCharBound=false; nCount=0; nContent = 0; }
_SwSaveTypeCountContent( const std::vector<sal_uLong> &rArr, sal_uInt16& rPos )
{
bCharBound = static_cast<bool>(rArr[ rPos++ ]);
nCount = static_cast<sal_uInt16>(rArr[ rPos++ ]);
nContent = static_cast<sal_Int32>(rArr[ rPos++ ]);
}
void Add( std::vector<sal_uLong> &rArr )
{
rArr.push_back( bCharBound );
rArr.push_back( nCount );
rArr.push_back( nContent );
}
void SetCharBound( bool bCB ) { bCharBound = bCB; }
bool IsCharBound() const { return bCharBound; }
void SetCount( sal_uInt16 n ) { nCount = n; }
sal_uInt16 GetCount() const { return nCount; }
sal_uInt16 DecCount() { return --nCount; }
void SetContent( sal_Int32 n ) { nContent = n; }
sal_Int32 GetContent() const { return nContent; }
#if OSL_DEBUG_LEVEL > 0
void Dump()
{
SAL_INFO("sw.core", "Count: " << GetCount() << "\tType: " << IsCharBound() << "\tContent: " << GetContent());
}
#endif
};
void _SaveCntntIdx(SwDoc* pDoc,
sal_uLong nNode,
sal_Int32 nCntnt,
std::vector<sal_uLong> &rSaveArr,
sal_uInt8 nSaveFly)
{
{
// 1. Bookmarks
_SwSaveTypeCountContent aSave;
// 4. Paragraph anchored objects
......@@ -1434,11 +1442,11 @@ void _SaveCntntIdx(SwDoc* pDoc,
{
SwFrm* pFrm = pNode->getLayoutFrm( pDoc->GetCurrentLayout() );
#if OSL_DEBUG_LEVEL > 1
#if OSL_DEBUG_LEVEL > 1
static bool bViaDoc = false;
if( bViaDoc )
pFrm = NULL;
#endif
#endif
if( pFrm ) // Do we have a layout? Then it's a bit cheaper ...
{
if( pFrm->GetDrawObjs() )
......@@ -1518,14 +1526,14 @@ void _SaveCntntIdx(SwDoc* pDoc,
}
}
}
}
}
void _RestoreCntntIdx(SwDoc* pDoc,
void _RestoreCntntIdx(SwDoc* pDoc,
std::vector<sal_uLong> &rSaveArr,
sal_uLong nNode,
sal_Int32 nOffset,
bool bAuto)
{
{
SwCntntNode* pCNd = pDoc->GetNodes()[ nNode ]->GetCntntNode();
SwFrmFmts* pSpz = pDoc->GetSpzFrmFmts();
sal_uInt16 n = 0;
......@@ -1563,21 +1571,21 @@ void _RestoreCntntIdx(SwDoc* pDoc,
}
if( pPos )
{
#if OSL_DEBUG_LEVEL > 0
#if OSL_DEBUG_LEVEL > 0
aSave.Dump();
#endif
#endif
SAL_INFO("sw.core", "setting " << pPos << " for Index " << aSave.GetCount() << " on Node " << nNode << " from " << pPos->nContent.GetIndex() << " to " << (aSave.GetContent() + nOffset));
pPos->nNode = *pCNd;
pPos->nContent.Assign( pCNd, aSave.GetContent() + nOffset );
}
}
}
}
void _RestoreCntntIdx(std::vector<sal_uLong> &rSaveArr,
void _RestoreCntntIdx(std::vector<sal_uLong> &rSaveArr,
const SwNode& rNd,
sal_Int32 nLen,
sal_Int32 nChkLen)
{
{
const SwDoc* pDoc = rNd.GetDoc();
const SwFrmFmts* pSpz = pDoc->GetSpzFrmFmts();
SwCntntNode* pCNd = (SwCntntNode*)rNd.GetCntntNode();
......@@ -1622,28 +1630,7 @@ void _RestoreCntntIdx(std::vector<sal_uLong> &rSaveArr,
rSaveArr.erase( rSaveArr.begin() + n, rSaveArr.begin() + n + 2);
}
}
}
namespace
{
struct MarkEntry
{
long int m_nIdx;
bool m_bOther;
sal_Int32 m_nCntnt;
#if 0
void Dump()
{
SAL_INFO("sw.core", "Index: " << m_nIdx << "\tOther: " << m_bOther << "\tContent: " << m_nCntnt);
}
#endif
};
struct PaMEntry
{
SwPaM* m_pPaM;
bool m_isMark;
sal_Int32 m_nCntnt;
};
struct OffsetUpdater
{
const SwCntntNode* m_pNewCntntNode;
......@@ -1774,12 +1761,22 @@ namespace
rPaMEntries.push_back(aEntry);
}
}
#if 0
static void DumpEntries(std::vector<MarkEntry>* pEntries)
{
BOOST_FOREACH(MarkEntry& aEntry, *pEntries)
aEntry.Dump();
}
static void DumpSaves(std::vector<sal_uLong> &rSaveArr)
{
sal_uInt16 n = 0;
while( n < rSaveArr.size() )
{
_SwSaveTypeCountContent aSave( rSaveArr, n );
aSave.Dump();
}
}
#endif
}
......@@ -1967,6 +1964,7 @@ void CntntIdxStoreImpl::RestoreShellCrsrs(SwDoc* /* pDoc */, updater_t& rUpdater
rUpdater(aEntry.m_pPaM->GetBound(aEntry.m_isMark), aEntry.m_nCntnt);
}
}
namespace sw { namespace mark {
boost::shared_ptr<CntntIdxStore> CntntIdxStore::Create()
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment