[Libreoffice-commits] core.git: 10 commits - sw/source
Bjoern Michaelsen
bjoern.michaelsen at canonical.com
Thu Jul 24 05:20:33 PDT 2014
sw/source/core/doc/docbm.cxx | 341 +++++++++++++++++--------------------------
1 file changed, 138 insertions(+), 203 deletions(-)
New commits:
commit 3843766911f7f7eb30da56f86911c30d6c1ffa68
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Thu Jul 24 14:13:29 2014 +0200
use update functor again
Change-Id: I0f0aa7ea9521d4be6b0e16206a39bc61e38ffd84
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index a104394..ea3ee52 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -1389,57 +1389,6 @@ namespace
bool m_isMark;
sal_Int32 m_nCntnt;
};
-
- void _RestoreCntntIdx(std::vector<MarkEntry> &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();
-
- sal_uInt16 n = 0;
- while( n < rSaveArr.size() )
- {
- MarkEntry aSave = rSaveArr[n];
- if( aSave.m_nCntnt >= nChkLen )
- rSaveArr[n].m_nCntnt -= nChkLen;
- else
- {
- SwPosition* pPos = 0;
- {
- SwFrmFmt *pFrmFmt = (*pSpz)[ aSave.m_nIdx ];
- const SwFmtAnchor& rFlyAnchor = pFrmFmt->GetAnchor();
- if( rFlyAnchor.GetCntntAnchor() )
- {
- SwFmtAnchor aNew( rFlyAnchor );
- SwPosition aNewPos( *rFlyAnchor.GetCntntAnchor() );
- aNewPos.nNode = rNd;
- if ( FLY_AT_CHAR == rFlyAnchor.GetAnchorId() )
- {
- aNewPos.nContent.Assign( pCNd, std::min(
- aSave.m_nCntnt, nLen ) );
- }
- else
- {
- aNewPos.nContent.Assign( 0, 0 );
- }
- aNew.SetAnchor( &aNewPos );
- pFrmFmt->SetFmtAttr( aNew );
- }
- }
-
- if( pPos )
- {
- pPos->nNode = rNd;
- pPos->nContent.Assign( pCNd, std::min( aSave.m_nCntnt, nLen ) );
- }
- n -= 1;
- rSaveArr.erase( rSaveArr.begin() + n, rSaveArr.begin() + n + 1);
- }
- }
- }
struct OffsetUpdater
{
const SwCntntNode* m_pNewCntntNode;
@@ -1518,7 +1467,7 @@ namespace
updater_t aUpdater = LimitUpdater(pCNd, nLen, nCorrLen);
RestoreBkmks(pDoc, aUpdater);
RestoreRedlines(pDoc, aUpdater);
- _RestoreCntntIdx(m_aFlyEntries, rNd, nLen, nCorrLen);
+ RestoreFlys(pDoc, aUpdater, false);
RestoreUnoCrsrs(pDoc, aUpdater);
RestoreShellCrsrs(pDoc, aUpdater);
}
commit 1b51bb77e147b8e1d7212bfe3b9587cba20e7a69
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Thu Jul 24 14:12:53 2014 +0200
fix ChkLen updater
Change-Id: Idcd50d38db91b8c1c17a98a76e755322a44bf386
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 02921a9..a104394 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -1466,6 +1466,11 @@ namespace
rPos.nNode = *m_pNewCntntNode;
rPos.nContent.Assign(const_cast<SwCntntNode*>(m_pNewCntntNode), std::min( nCntnt, static_cast<sal_Int32>(m_nLen) ) );
}
+ else
+ {
+ rPos.nNode = *m_pNewCntntNode;
+ rPos.nContent -= m_nCorrLen;
+ }
};
};
struct CntntIdxStoreImpl : sw::mark::CntntIdxStore
commit e331114480107c6976077213e0b8e8219accf5f5
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Thu Jul 24 13:04:09 2014 +0200
use update functor
Change-Id: Iebb43895c7f8a2f1935f3532d4becaca7c2721af
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index ff41505..02921a9 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -1502,7 +1502,7 @@ namespace
updater_t aUpdater = OffsetUpdater(pCNd, nOffset);
RestoreBkmks(pDoc, aUpdater);
RestoreRedlines(pDoc, aUpdater);
- RestoreFlys(pDoc, pCNd, nOffset, bAuto);
+ RestoreFlys(pDoc, aUpdater, bAuto);
RestoreUnoCrsrs(pDoc, aUpdater);
RestoreShellCrsrs(pDoc, aUpdater);
}
@@ -1524,7 +1524,7 @@ namespace
inline void SaveRedlines(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt);
inline void RestoreRedlines(SwDoc* pDoc, updater_t& rUpdater);
inline void SaveFlys(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt, sal_uInt8 nSaveFly);
- inline void RestoreFlys(SwDoc* pDoc, SwCntntNode* pCNd, sal_Int32 nOffset, bool bAuto);
+ inline void RestoreFlys(SwDoc* pDoc, updater_t& rUpdater, bool bAuto);
inline void SaveUnoCrsrs(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt);
inline void RestoreUnoCrsrs(SwDoc* pDoc, updater_t& rUpdater);
inline void SaveShellCrsrs(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt);
@@ -1764,7 +1764,7 @@ void CntntIdxStoreImpl::SaveFlys(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt,
}
}
-void CntntIdxStoreImpl::RestoreFlys(SwDoc* pDoc, SwCntntNode* pCNd, sal_Int32 nOffset, bool bAuto)
+void CntntIdxStoreImpl::RestoreFlys(SwDoc* pDoc, updater_t& rUpdater, bool bAuto)
{
SwFrmFmts* pSpz = pDoc->GetSpzFrmFmts();
BOOST_FOREACH(const MarkEntry& aEntry, m_aFlyEntries)
@@ -1778,13 +1778,8 @@ void CntntIdxStoreImpl::RestoreFlys(SwDoc* pDoc, SwCntntNode* pCNd, sal_Int32 nO
{
SwFmtAnchor aNew( rFlyAnchor );
SwPosition aNewPos( *rFlyAnchor.GetCntntAnchor() );
- aNewPos.nNode = *pCNd;
- if ( FLY_AT_CHAR == rFlyAnchor.GetAnchorId() )
- {
- aNewPos.nContent.Assign( pCNd,
- aEntry.m_nCntnt + nOffset );
- }
- else
+ rUpdater(aNewPos, aEntry.m_nCntnt);
+ if ( FLY_AT_CHAR != rFlyAnchor.GetAnchorId() )
{
aNewPos.nContent.Assign( 0, 0 );
}
@@ -1800,9 +1795,8 @@ void CntntIdxStoreImpl::RestoreFlys(SwDoc* pDoc, SwCntntNode* pCNd, sal_Int32 nO
}
if( pPos )
{
- SAL_INFO("sw.core", "setting " << pPos << " for Index " << aEntry.m_nIdx << " on Node " << pCNd << " from " << pPos->nContent.GetIndex() << " to " << (aEntry.m_nCntnt + nOffset));
- pPos->nNode = *pCNd;
- pPos->nContent.Assign( pCNd, aEntry.m_nCntnt + nOffset );
+ SAL_INFO("sw.core", "setting " << pPos << " for Index " << aEntry.m_nIdx << " from " << pPos->nContent.GetIndex());
+ rUpdater(*pPos, aEntry.m_nCntnt);
}
}
}
commit b9909712a8f0cdfca93d11ea21a459d59929b4f5
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Thu Jul 24 12:54:20 2014 +0200
use BOOST_FOREACH now
Change-Id: Ica24e4a16db8e0016629234ca490374b5f86a7a6
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 5b49ecf..ff41505 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -1767,14 +1767,12 @@ void CntntIdxStoreImpl::SaveFlys(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt,
void CntntIdxStoreImpl::RestoreFlys(SwDoc* pDoc, SwCntntNode* pCNd, sal_Int32 nOffset, bool bAuto)
{
SwFrmFmts* pSpz = pDoc->GetSpzFrmFmts();
- sal_uInt16 n = 0;
- while( n < m_aFlyEntries.size() )
+ BOOST_FOREACH(const MarkEntry& aEntry, m_aFlyEntries)
{
- MarkEntry aSave = m_aFlyEntries[n++];
SwPosition* pPos = 0;
- if(!aSave.m_bOther)
+ if(!aEntry.m_bOther)
{
- SwFrmFmt *pFrmFmt = (*pSpz)[ aSave.m_nIdx ];
+ SwFrmFmt *pFrmFmt = (*pSpz)[ aEntry.m_nIdx ];
const SwFmtAnchor& rFlyAnchor = pFrmFmt->GetAnchor();
if( rFlyAnchor.GetCntntAnchor() )
{
@@ -1784,7 +1782,7 @@ void CntntIdxStoreImpl::RestoreFlys(SwDoc* pDoc, SwCntntNode* pCNd, sal_Int32 nO
if ( FLY_AT_CHAR == rFlyAnchor.GetAnchorId() )
{
aNewPos.nContent.Assign( pCNd,
- aSave.m_nCntnt + nOffset );
+ aEntry.m_nCntnt + nOffset );
}
else
{
@@ -1796,15 +1794,15 @@ void CntntIdxStoreImpl::RestoreFlys(SwDoc* pDoc, SwCntntNode* pCNd, sal_Int32 nO
}
else if( bAuto )
{
- SwFrmFmt *pFrmFmt = (*pSpz)[ aSave.m_nIdx ];
+ SwFrmFmt *pFrmFmt = (*pSpz)[ aEntry.m_nIdx ];
SfxPoolItem *pAnchor = (SfxPoolItem*)&pFrmFmt->GetAnchor();
pFrmFmt->NotifyClients( pAnchor, pAnchor );
}
if( pPos )
{
- SAL_INFO("sw.core", "setting " << pPos << " for Index " << aSave.m_nIdx << " on Node " << pCNd << " from " << pPos->nContent.GetIndex() << " to " << (aSave.m_nCntnt + nOffset));
+ SAL_INFO("sw.core", "setting " << pPos << " for Index " << aEntry.m_nIdx << " on Node " << pCNd << " from " << pPos->nContent.GetIndex() << " to " << (aEntry.m_nCntnt + nOffset));
pPos->nNode = *pCNd;
- pPos->nContent.Assign( pCNd, aSave.m_nCntnt + nOffset );
+ pPos->nContent.Assign( pCNd, aEntry.m_nCntnt + nOffset );
}
}
}
commit 6794856e797ec6c758af6397f4d0df7f9150d2ef
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Thu Jul 24 00:43:06 2014 +0200
we already have the ContentNode
Change-Id: I00c2346d1499f06fcde678cfcf8c19dd795c6a5a
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index d1b8138..5b49ecf 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -1502,7 +1502,7 @@ namespace
updater_t aUpdater = OffsetUpdater(pCNd, nOffset);
RestoreBkmks(pDoc, aUpdater);
RestoreRedlines(pDoc, aUpdater);
- RestoreFlys(pDoc, nNode, nOffset, bAuto);
+ RestoreFlys(pDoc, pCNd, nOffset, bAuto);
RestoreUnoCrsrs(pDoc, aUpdater);
RestoreShellCrsrs(pDoc, aUpdater);
}
@@ -1524,7 +1524,7 @@ namespace
inline void SaveRedlines(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt);
inline void RestoreRedlines(SwDoc* pDoc, updater_t& rUpdater);
inline void SaveFlys(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt, sal_uInt8 nSaveFly);
- inline void RestoreFlys(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nOffset, bool bAuto);
+ inline void RestoreFlys(SwDoc* pDoc, SwCntntNode* pCNd, sal_Int32 nOffset, bool bAuto);
inline void SaveUnoCrsrs(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt);
inline void RestoreUnoCrsrs(SwDoc* pDoc, updater_t& rUpdater);
inline void SaveShellCrsrs(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt);
@@ -1764,9 +1764,8 @@ void CntntIdxStoreImpl::SaveFlys(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt,
}
}
-void CntntIdxStoreImpl::RestoreFlys(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nOffset, bool bAuto)
+void CntntIdxStoreImpl::RestoreFlys(SwDoc* pDoc, SwCntntNode* pCNd, sal_Int32 nOffset, bool bAuto)
{
- SwCntntNode* pCNd = pDoc->GetNodes()[ nNode ]->GetCntntNode();
SwFrmFmts* pSpz = pDoc->GetSpzFrmFmts();
sal_uInt16 n = 0;
while( n < m_aFlyEntries.size() )
@@ -1803,7 +1802,7 @@ void CntntIdxStoreImpl::RestoreFlys(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nOff
}
if( pPos )
{
- SAL_INFO("sw.core", "setting " << pPos << " for Index " << aSave.m_nIdx << " on Node " << nNode << " from " << pPos->nContent.GetIndex() << " to " << (aSave.m_nCntnt + nOffset));
+ SAL_INFO("sw.core", "setting " << pPos << " for Index " << aSave.m_nIdx << " on Node " << pCNd << " from " << pPos->nContent.GetIndex() << " to " << (aSave.m_nCntnt + nOffset));
pPos->nNode = *pCNd;
pPos->nContent.Assign( pCNd, aSave.m_nCntnt + nOffset );
}
commit 45417d7e4a8d0b3dd1c6d21da1c487f9773c200a
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Thu Jul 24 00:23:49 2014 +0200
remove superfluous scope
Change-Id: I0ded0e6dc4976cc13b1d60ce87ea02c01ed22490
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index f52f8f3..d1b8138 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -1688,45 +1688,44 @@ void CntntIdxStoreImpl::SaveFlys(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt,
#endif
if( pFrm ) // Do we have a layout? Then it's a bit cheaper ...
{
- if( pFrm->GetDrawObjs() )
+ if( !pFrm->GetDrawObjs() )
+ return;
+ const SwSortedObjs& rDObj = *pFrm->GetDrawObjs();
+ for( sal_uInt32 n = rDObj.Count(); n; )
{
- const SwSortedObjs& rDObj = *pFrm->GetDrawObjs();
- for( sal_uInt32 n = rDObj.Count(); n; )
+ SwAnchoredObject* pObj = rDObj[ --n ];
+ const SwFrmFmt& rFmt = pObj->GetFrmFmt();
+ const SwFmtAnchor& rAnchor = rFmt.GetAnchor();
+ SwPosition const*const pAPos = rAnchor.GetCntntAnchor();
+ if ( pAPos &&
+ ( ( nSaveFly &&
+ FLY_AT_PARA == rAnchor.GetAnchorId() ) ||
+ ( FLY_AT_CHAR == rAnchor.GetAnchorId() ) ) )
{
- SwAnchoredObject* pObj = rDObj[ --n ];
- const SwFrmFmt& rFmt = pObj->GetFrmFmt();
- const SwFmtAnchor& rAnchor = rFmt.GetAnchor();
- SwPosition const*const pAPos = rAnchor.GetCntntAnchor();
- if ( pAPos &&
- ( ( nSaveFly &&
- FLY_AT_PARA == rAnchor.GetAnchorId() ) ||
- ( FLY_AT_CHAR == rAnchor.GetAnchorId() ) ) )
- {
- aSave.m_bOther = false;
- aSave.m_nCntnt = pAPos->nContent.GetIndex();
+ aSave.m_bOther = false;
+ aSave.m_nCntnt = pAPos->nContent.GetIndex();
- OSL_ENSURE( nNode == pAPos->nNode.GetIndex(),
- "_SaveCntntIdx: Wrong Node-Index" );
- if ( FLY_AT_CHAR == rAnchor.GetAnchorId() )
+ OSL_ENSURE( nNode == pAPos->nNode.GetIndex(),
+ "_SaveCntntIdx: Wrong Node-Index" );
+ if ( FLY_AT_CHAR == rAnchor.GetAnchorId() )
+ {
+ if( nCntnt <= aSave.m_nCntnt )
{
- if( nCntnt <= aSave.m_nCntnt )
- {
- if( SAVEFLY_SPLIT == nSaveFly )
- aSave.m_bOther = true;
- else
- continue;
- }
+ if( SAVEFLY_SPLIT == nSaveFly )
+ aSave.m_bOther = true;
+ else
+ continue;
}
- aSave.m_nIdx = pDoc->GetSpzFrmFmts()->size();
- while( aSave.m_nIdx &&
- &rFmt != (*pDoc->GetSpzFrmFmts())[
- --aSave.m_nIdx ] )
- ; // nothing
- OSL_ENSURE( &rFmt == (*pDoc->GetSpzFrmFmts())[
- aSave.m_nIdx ],
- "_SaveCntntIdx: Lost FrameFormat" );
- m_aFlyEntries.push_back(aSave);
}
+ aSave.m_nIdx = pDoc->GetSpzFrmFmts()->size();
+ while( aSave.m_nIdx &&
+ &rFmt != (*pDoc->GetSpzFrmFmts())[
+ --aSave.m_nIdx ] )
+ ; // nothing
+ OSL_ENSURE( &rFmt == (*pDoc->GetSpzFrmFmts())[
+ aSave.m_nIdx ],
+ "_SaveCntntIdx: Lost FrameFormat" );
+ m_aFlyEntries.push_back(aSave);
}
}
}
commit 070213f800ac967e3da7c583d20fb7257b7d5896
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Thu Jul 24 00:19:40 2014 +0200
remove superfluous scope
Change-Id: I1495cbae761d430f94bd7701a3a27b864c8015dd
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 4cd5c59..f52f8f3 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -1678,78 +1678,35 @@ void CntntIdxStoreImpl::SaveFlys(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt,
// Paragraph anchored objects
MarkEntry aSave;
SwCntntNode *pNode = pDoc->GetNodes()[nNode]->GetCntntNode();
- if( pNode )
- {
-
- SwFrm* pFrm = pNode->getLayoutFrm( pDoc->GetCurrentLayout() );
+ if( !pNode )
+ return;
+ SwFrm* pFrm = pNode->getLayoutFrm( pDoc->GetCurrentLayout() );
#if OSL_DEBUG_LEVEL > 1
- static bool bViaDoc = false;
- if( bViaDoc )
- pFrm = NULL;
+ static bool bViaDoc = false;
+ if( bViaDoc )
+ pFrm = NULL;
#endif
- if( pFrm ) // Do we have a layout? Then it's a bit cheaper ...
- {
- if( pFrm->GetDrawObjs() )
- {
- const SwSortedObjs& rDObj = *pFrm->GetDrawObjs();
- for( sal_uInt32 n = rDObj.Count(); n; )
- {
- SwAnchoredObject* pObj = rDObj[ --n ];
- const SwFrmFmt& rFmt = pObj->GetFrmFmt();
- const SwFmtAnchor& rAnchor = rFmt.GetAnchor();
- SwPosition const*const pAPos = rAnchor.GetCntntAnchor();
- if ( pAPos &&
- ( ( nSaveFly &&
- FLY_AT_PARA == rAnchor.GetAnchorId() ) ||
- ( FLY_AT_CHAR == rAnchor.GetAnchorId() ) ) )
- {
- aSave.m_bOther = false;
- aSave.m_nCntnt = pAPos->nContent.GetIndex();
-
- OSL_ENSURE( nNode == pAPos->nNode.GetIndex(),
- "_SaveCntntIdx: Wrong Node-Index" );
- if ( FLY_AT_CHAR == rAnchor.GetAnchorId() )
- {
- if( nCntnt <= aSave.m_nCntnt )
- {
- if( SAVEFLY_SPLIT == nSaveFly )
- aSave.m_bOther = true;
- else
- continue;
- }
- }
- aSave.m_nIdx = pDoc->GetSpzFrmFmts()->size();
- while( aSave.m_nIdx &&
- &rFmt != (*pDoc->GetSpzFrmFmts())[
- --aSave.m_nIdx ] )
- ; // nothing
- OSL_ENSURE( &rFmt == (*pDoc->GetSpzFrmFmts())[
- aSave.m_nIdx ],
- "_SaveCntntIdx: Lost FrameFormat" );
- m_aFlyEntries.push_back(aSave);
- }
- }
- }
- }
- else // No layout, so it's a bit more expensive ...
+ if( pFrm ) // Do we have a layout? Then it's a bit cheaper ...
+ {
+ if( pFrm->GetDrawObjs() )
{
- for( aSave.m_nIdx = pDoc->GetSpzFrmFmts()->size();
- aSave.m_nIdx ; )
+ const SwSortedObjs& rDObj = *pFrm->GetDrawObjs();
+ for( sal_uInt32 n = rDObj.Count(); n; )
{
- SwFrmFmt* pFrmFmt = (*pDoc->GetSpzFrmFmts())[
- --aSave.m_nIdx ];
- if ( RES_FLYFRMFMT != pFrmFmt->Which() &&
- RES_DRAWFRMFMT != pFrmFmt->Which() )
- continue;
-
- const SwFmtAnchor& rAnchor = pFrmFmt->GetAnchor();
+ SwAnchoredObject* pObj = rDObj[ --n ];
+ const SwFrmFmt& rFmt = pObj->GetFrmFmt();
+ const SwFmtAnchor& rAnchor = rFmt.GetAnchor();
SwPosition const*const pAPos = rAnchor.GetCntntAnchor();
- if ( pAPos && ( nNode == pAPos->nNode.GetIndex() ) &&
- ( FLY_AT_PARA == rAnchor.GetAnchorId() ||
- FLY_AT_CHAR == rAnchor.GetAnchorId() ) )
+ if ( pAPos &&
+ ( ( nSaveFly &&
+ FLY_AT_PARA == rAnchor.GetAnchorId() ) ||
+ ( FLY_AT_CHAR == rAnchor.GetAnchorId() ) ) )
{
aSave.m_bOther = false;
aSave.m_nCntnt = pAPos->nContent.GetIndex();
+
+ OSL_ENSURE( nNode == pAPos->nNode.GetIndex(),
+ "_SaveCntntIdx: Wrong Node-Index" );
if ( FLY_AT_CHAR == rAnchor.GetAnchorId() )
{
if( nCntnt <= aSave.m_nCntnt )
@@ -1760,11 +1717,52 @@ void CntntIdxStoreImpl::SaveFlys(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt,
continue;
}
}
+ aSave.m_nIdx = pDoc->GetSpzFrmFmts()->size();
+ while( aSave.m_nIdx &&
+ &rFmt != (*pDoc->GetSpzFrmFmts())[
+ --aSave.m_nIdx ] )
+ ; // nothing
+ OSL_ENSURE( &rFmt == (*pDoc->GetSpzFrmFmts())[
+ aSave.m_nIdx ],
+ "_SaveCntntIdx: Lost FrameFormat" );
m_aFlyEntries.push_back(aSave);
}
}
}
}
+ else // No layout, so it's a bit more expensive ...
+ {
+ for( aSave.m_nIdx = pDoc->GetSpzFrmFmts()->size();
+ aSave.m_nIdx ; )
+ {
+ SwFrmFmt* pFrmFmt = (*pDoc->GetSpzFrmFmts())[
+ --aSave.m_nIdx ];
+ if ( RES_FLYFRMFMT != pFrmFmt->Which() &&
+ RES_DRAWFRMFMT != pFrmFmt->Which() )
+ continue;
+
+ const SwFmtAnchor& rAnchor = pFrmFmt->GetAnchor();
+ SwPosition const*const pAPos = rAnchor.GetCntntAnchor();
+ if ( pAPos && ( nNode == pAPos->nNode.GetIndex() ) &&
+ ( FLY_AT_PARA == rAnchor.GetAnchorId() ||
+ FLY_AT_CHAR == rAnchor.GetAnchorId() ) )
+ {
+ aSave.m_bOther = false;
+ aSave.m_nCntnt = pAPos->nContent.GetIndex();
+ if ( FLY_AT_CHAR == rAnchor.GetAnchorId() )
+ {
+ if( nCntnt <= aSave.m_nCntnt )
+ {
+ if( SAVEFLY_SPLIT == nSaveFly )
+ aSave.m_bOther = true;
+ else
+ continue;
+ }
+ }
+ m_aFlyEntries.push_back(aSave);
+ }
+ }
+ }
}
void CntntIdxStoreImpl::RestoreFlys(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nOffset, bool bAuto)
commit 61cfe89eedf22834d9567d3f6a8c1df9c61b22ea
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Thu Jul 24 00:15:46 2014 +0200
remove superfluous scope
Change-Id: I7174fdafe6750d45ed8f537825dc1dfa637f1a53
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 3a56874..4cd5c59 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -1677,80 +1677,37 @@ void CntntIdxStoreImpl::SaveFlys(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt,
{
// Paragraph anchored objects
MarkEntry aSave;
+ SwCntntNode *pNode = pDoc->GetNodes()[nNode]->GetCntntNode();
+ if( pNode )
{
- SwCntntNode *pNode = pDoc->GetNodes()[nNode]->GetCntntNode();
- if( pNode )
- {
- SwFrm* pFrm = pNode->getLayoutFrm( pDoc->GetCurrentLayout() );
+ SwFrm* pFrm = pNode->getLayoutFrm( pDoc->GetCurrentLayout() );
#if OSL_DEBUG_LEVEL > 1
- static bool bViaDoc = false;
- if( bViaDoc )
- pFrm = NULL;
+ static bool bViaDoc = false;
+ if( bViaDoc )
+ pFrm = NULL;
#endif
- if( pFrm ) // Do we have a layout? Then it's a bit cheaper ...
- {
- if( pFrm->GetDrawObjs() )
- {
- const SwSortedObjs& rDObj = *pFrm->GetDrawObjs();
- for( sal_uInt32 n = rDObj.Count(); n; )
- {
- SwAnchoredObject* pObj = rDObj[ --n ];
- const SwFrmFmt& rFmt = pObj->GetFrmFmt();
- const SwFmtAnchor& rAnchor = rFmt.GetAnchor();
- SwPosition const*const pAPos = rAnchor.GetCntntAnchor();
- if ( pAPos &&
- ( ( nSaveFly &&
- FLY_AT_PARA == rAnchor.GetAnchorId() ) ||
- ( FLY_AT_CHAR == rAnchor.GetAnchorId() ) ) )
- {
- aSave.m_bOther = false;
- aSave.m_nCntnt = pAPos->nContent.GetIndex();
-
- OSL_ENSURE( nNode == pAPos->nNode.GetIndex(),
- "_SaveCntntIdx: Wrong Node-Index" );
- if ( FLY_AT_CHAR == rAnchor.GetAnchorId() )
- {
- if( nCntnt <= aSave.m_nCntnt )
- {
- if( SAVEFLY_SPLIT == nSaveFly )
- aSave.m_bOther = true;
- else
- continue;
- }
- }
- aSave.m_nIdx = pDoc->GetSpzFrmFmts()->size();
- while( aSave.m_nIdx &&
- &rFmt != (*pDoc->GetSpzFrmFmts())[
- --aSave.m_nIdx ] )
- ; // nothing
- OSL_ENSURE( &rFmt == (*pDoc->GetSpzFrmFmts())[
- aSave.m_nIdx ],
- "_SaveCntntIdx: Lost FrameFormat" );
- m_aFlyEntries.push_back(aSave);
- }
- }
- }
- }
- else // No layout, so it's a bit more expensive ...
+ if( pFrm ) // Do we have a layout? Then it's a bit cheaper ...
+ {
+ if( pFrm->GetDrawObjs() )
{
- for( aSave.m_nIdx = pDoc->GetSpzFrmFmts()->size();
- aSave.m_nIdx ; )
+ const SwSortedObjs& rDObj = *pFrm->GetDrawObjs();
+ for( sal_uInt32 n = rDObj.Count(); n; )
{
- SwFrmFmt* pFrmFmt = (*pDoc->GetSpzFrmFmts())[
- --aSave.m_nIdx ];
- if ( RES_FLYFRMFMT != pFrmFmt->Which() &&
- RES_DRAWFRMFMT != pFrmFmt->Which() )
- continue;
-
- const SwFmtAnchor& rAnchor = pFrmFmt->GetAnchor();
+ SwAnchoredObject* pObj = rDObj[ --n ];
+ const SwFrmFmt& rFmt = pObj->GetFrmFmt();
+ const SwFmtAnchor& rAnchor = rFmt.GetAnchor();
SwPosition const*const pAPos = rAnchor.GetCntntAnchor();
- if ( pAPos && ( nNode == pAPos->nNode.GetIndex() ) &&
- ( FLY_AT_PARA == rAnchor.GetAnchorId() ||
- FLY_AT_CHAR == rAnchor.GetAnchorId() ) )
+ if ( pAPos &&
+ ( ( nSaveFly &&
+ FLY_AT_PARA == rAnchor.GetAnchorId() ) ||
+ ( FLY_AT_CHAR == rAnchor.GetAnchorId() ) ) )
{
aSave.m_bOther = false;
aSave.m_nCntnt = pAPos->nContent.GetIndex();
+
+ OSL_ENSURE( nNode == pAPos->nNode.GetIndex(),
+ "_SaveCntntIdx: Wrong Node-Index" );
if ( FLY_AT_CHAR == rAnchor.GetAnchorId() )
{
if( nCntnt <= aSave.m_nCntnt )
@@ -1761,11 +1718,52 @@ void CntntIdxStoreImpl::SaveFlys(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt,
continue;
}
}
+ aSave.m_nIdx = pDoc->GetSpzFrmFmts()->size();
+ while( aSave.m_nIdx &&
+ &rFmt != (*pDoc->GetSpzFrmFmts())[
+ --aSave.m_nIdx ] )
+ ; // nothing
+ OSL_ENSURE( &rFmt == (*pDoc->GetSpzFrmFmts())[
+ aSave.m_nIdx ],
+ "_SaveCntntIdx: Lost FrameFormat" );
m_aFlyEntries.push_back(aSave);
}
}
}
}
+ else // No layout, so it's a bit more expensive ...
+ {
+ for( aSave.m_nIdx = pDoc->GetSpzFrmFmts()->size();
+ aSave.m_nIdx ; )
+ {
+ SwFrmFmt* pFrmFmt = (*pDoc->GetSpzFrmFmts())[
+ --aSave.m_nIdx ];
+ if ( RES_FLYFRMFMT != pFrmFmt->Which() &&
+ RES_DRAWFRMFMT != pFrmFmt->Which() )
+ continue;
+
+ const SwFmtAnchor& rAnchor = pFrmFmt->GetAnchor();
+ SwPosition const*const pAPos = rAnchor.GetCntntAnchor();
+ if ( pAPos && ( nNode == pAPos->nNode.GetIndex() ) &&
+ ( FLY_AT_PARA == rAnchor.GetAnchorId() ||
+ FLY_AT_CHAR == rAnchor.GetAnchorId() ) )
+ {
+ aSave.m_bOther = false;
+ aSave.m_nCntnt = pAPos->nContent.GetIndex();
+ if ( FLY_AT_CHAR == rAnchor.GetAnchorId() )
+ {
+ if( nCntnt <= aSave.m_nCntnt )
+ {
+ if( SAVEFLY_SPLIT == nSaveFly )
+ aSave.m_bOther = true;
+ else
+ continue;
+ }
+ }
+ m_aFlyEntries.push_back(aSave);
+ }
+ }
+ }
}
}
commit 607390eff8e122ea8618eb65171ecd8d44cba978
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Thu Jul 24 00:05:26 2014 +0200
make RestoreFlys a member
Change-Id: Iac499e054732726f8dd8ce70969fcd5fc8ed48a0
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 18c426b..3a56874 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -1389,55 +1389,6 @@ namespace
bool m_isMark;
sal_Int32 m_nCntnt;
};
- void _RestoreCntntIdx(SwDoc* pDoc,
- std::vector<MarkEntry> &rSaveArr,
- sal_uLong nNode,
- sal_Int32 nOffset,
- bool bAuto)
- {
- SwCntntNode* pCNd = pDoc->GetNodes()[ nNode ]->GetCntntNode();
- SwFrmFmts* pSpz = pDoc->GetSpzFrmFmts();
- sal_uInt16 n = 0;
- while( n < rSaveArr.size() )
- {
- MarkEntry aSave = rSaveArr[n++];
- SwPosition* pPos = 0;
- if(!aSave.m_bOther)
- {
- SwFrmFmt *pFrmFmt = (*pSpz)[ aSave.m_nIdx ];
- const SwFmtAnchor& rFlyAnchor = pFrmFmt->GetAnchor();
- if( rFlyAnchor.GetCntntAnchor() )
- {
- SwFmtAnchor aNew( rFlyAnchor );
- SwPosition aNewPos( *rFlyAnchor.GetCntntAnchor() );
- aNewPos.nNode = *pCNd;
- if ( FLY_AT_CHAR == rFlyAnchor.GetAnchorId() )
- {
- aNewPos.nContent.Assign( pCNd,
- aSave.m_nCntnt + nOffset );
- }
- else
- {
- aNewPos.nContent.Assign( 0, 0 );
- }
- aNew.SetAnchor( &aNewPos );
- pFrmFmt->SetFmtAttr( aNew );
- }
- }
- else if( bAuto )
- {
- SwFrmFmt *pFrmFmt = (*pSpz)[ aSave.m_nIdx ];
- SfxPoolItem *pAnchor = (SfxPoolItem*)&pFrmFmt->GetAnchor();
- pFrmFmt->NotifyClients( pAnchor, pAnchor );
- }
- if( pPos )
- {
- SAL_INFO("sw.core", "setting " << pPos << " for Index " << aSave.m_nIdx << " on Node " << nNode << " from " << pPos->nContent.GetIndex() << " to " << (aSave.m_nCntnt + nOffset));
- pPos->nNode = *pCNd;
- pPos->nContent.Assign( pCNd, aSave.m_nCntnt + nOffset );
- }
- }
- }
void _RestoreCntntIdx(std::vector<MarkEntry> &rSaveArr,
const SwNode& rNd,
@@ -1551,7 +1502,7 @@ namespace
updater_t aUpdater = OffsetUpdater(pCNd, nOffset);
RestoreBkmks(pDoc, aUpdater);
RestoreRedlines(pDoc, aUpdater);
- _RestoreCntntIdx(pDoc, m_aFlyEntries, nNode, nOffset, bAuto);
+ RestoreFlys(pDoc, nNode, nOffset, bAuto);
RestoreUnoCrsrs(pDoc, aUpdater);
RestoreShellCrsrs(pDoc, aUpdater);
}
@@ -1573,6 +1524,7 @@ namespace
inline void SaveRedlines(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt);
inline void RestoreRedlines(SwDoc* pDoc, updater_t& rUpdater);
inline void SaveFlys(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt, sal_uInt8 nSaveFly);
+ inline void RestoreFlys(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nOffset, bool bAuto);
inline void SaveUnoCrsrs(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt);
inline void RestoreUnoCrsrs(SwDoc* pDoc, updater_t& rUpdater);
inline void SaveShellCrsrs(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt);
@@ -1817,6 +1769,52 @@ void CntntIdxStoreImpl::SaveFlys(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt,
}
}
+void CntntIdxStoreImpl::RestoreFlys(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nOffset, bool bAuto)
+{
+ SwCntntNode* pCNd = pDoc->GetNodes()[ nNode ]->GetCntntNode();
+ SwFrmFmts* pSpz = pDoc->GetSpzFrmFmts();
+ sal_uInt16 n = 0;
+ while( n < m_aFlyEntries.size() )
+ {
+ MarkEntry aSave = m_aFlyEntries[n++];
+ SwPosition* pPos = 0;
+ if(!aSave.m_bOther)
+ {
+ SwFrmFmt *pFrmFmt = (*pSpz)[ aSave.m_nIdx ];
+ const SwFmtAnchor& rFlyAnchor = pFrmFmt->GetAnchor();
+ if( rFlyAnchor.GetCntntAnchor() )
+ {
+ SwFmtAnchor aNew( rFlyAnchor );
+ SwPosition aNewPos( *rFlyAnchor.GetCntntAnchor() );
+ aNewPos.nNode = *pCNd;
+ if ( FLY_AT_CHAR == rFlyAnchor.GetAnchorId() )
+ {
+ aNewPos.nContent.Assign( pCNd,
+ aSave.m_nCntnt + nOffset );
+ }
+ else
+ {
+ aNewPos.nContent.Assign( 0, 0 );
+ }
+ aNew.SetAnchor( &aNewPos );
+ pFrmFmt->SetFmtAttr( aNew );
+ }
+ }
+ else if( bAuto )
+ {
+ SwFrmFmt *pFrmFmt = (*pSpz)[ aSave.m_nIdx ];
+ SfxPoolItem *pAnchor = (SfxPoolItem*)&pFrmFmt->GetAnchor();
+ pFrmFmt->NotifyClients( pAnchor, pAnchor );
+ }
+ if( pPos )
+ {
+ SAL_INFO("sw.core", "setting " << pPos << " for Index " << aSave.m_nIdx << " on Node " << nNode << " from " << pPos->nContent.GetIndex() << " to " << (aSave.m_nCntnt + nOffset));
+ pPos->nNode = *pCNd;
+ pPos->nContent.Assign( pCNd, aSave.m_nCntnt + nOffset );
+ }
+ }
+}
+
void CntntIdxStoreImpl::SaveUnoCrsrs(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt)
{
long int nIdx = 0;
commit 7f9de609fb6679907e1e10563c11f475bac7b65c
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Wed Jul 23 23:34:39 2014 +0200
make SaveFlys a member
Change-Id: Ie67c92305b77ae066ffeb4d0a0b8bd0a4f8aef3b
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index a7149a2..18c426b 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -1389,106 +1389,6 @@ namespace
bool m_isMark;
sal_Int32 m_nCntnt;
};
- void _SaveCntntIdx(SwDoc* pDoc,
- sal_uLong nNode,
- sal_Int32 nCntnt,
- std::vector<MarkEntry> &rSaveArr,
- sal_uInt8 nSaveFly)
- {
- // Paragraph anchored objects
- MarkEntry aSave;
- {
- SwCntntNode *pNode = pDoc->GetNodes()[nNode]->GetCntntNode();
- if( pNode )
- {
-
- SwFrm* pFrm = pNode->getLayoutFrm( pDoc->GetCurrentLayout() );
- #if OSL_DEBUG_LEVEL > 1
- static bool bViaDoc = false;
- if( bViaDoc )
- pFrm = NULL;
- #endif
- if( pFrm ) // Do we have a layout? Then it's a bit cheaper ...
- {
- if( pFrm->GetDrawObjs() )
- {
- const SwSortedObjs& rDObj = *pFrm->GetDrawObjs();
- for( sal_uInt32 n = rDObj.Count(); n; )
- {
- SwAnchoredObject* pObj = rDObj[ --n ];
- const SwFrmFmt& rFmt = pObj->GetFrmFmt();
- const SwFmtAnchor& rAnchor = rFmt.GetAnchor();
- SwPosition const*const pAPos = rAnchor.GetCntntAnchor();
- if ( pAPos &&
- ( ( nSaveFly &&
- FLY_AT_PARA == rAnchor.GetAnchorId() ) ||
- ( FLY_AT_CHAR == rAnchor.GetAnchorId() ) ) )
- {
- aSave.m_bOther = false;
- aSave.m_nCntnt = pAPos->nContent.GetIndex();
-
- OSL_ENSURE( nNode == pAPos->nNode.GetIndex(),
- "_SaveCntntIdx: Wrong Node-Index" );
- if ( FLY_AT_CHAR == rAnchor.GetAnchorId() )
- {
- if( nCntnt <= aSave.m_nCntnt )
- {
- if( SAVEFLY_SPLIT == nSaveFly )
- aSave.m_bOther = true;
- else
- continue;
- }
- }
- aSave.m_nIdx = pDoc->GetSpzFrmFmts()->size();
- while( aSave.m_nIdx &&
- &rFmt != (*pDoc->GetSpzFrmFmts())[
- --aSave.m_nIdx ] )
- ; // nothing
- OSL_ENSURE( &rFmt == (*pDoc->GetSpzFrmFmts())[
- aSave.m_nIdx ],
- "_SaveCntntIdx: Lost FrameFormat" );
- rSaveArr.push_back(aSave);
- }
- }
- }
- }
- else // No layout, so it's a bit more expensive ...
- {
- for( aSave.m_nIdx = pDoc->GetSpzFrmFmts()->size();
- aSave.m_nIdx ; )
- {
- SwFrmFmt* pFrmFmt = (*pDoc->GetSpzFrmFmts())[
- --aSave.m_nIdx ];
- if ( RES_FLYFRMFMT != pFrmFmt->Which() &&
- RES_DRAWFRMFMT != pFrmFmt->Which() )
- continue;
-
- const SwFmtAnchor& rAnchor = pFrmFmt->GetAnchor();
- SwPosition const*const pAPos = rAnchor.GetCntntAnchor();
- if ( pAPos && ( nNode == pAPos->nNode.GetIndex() ) &&
- ( FLY_AT_PARA == rAnchor.GetAnchorId() ||
- FLY_AT_CHAR == rAnchor.GetAnchorId() ) )
- {
- aSave.m_bOther = false;
- aSave.m_nCntnt = pAPos->nContent.GetIndex();
- if ( FLY_AT_CHAR == rAnchor.GetAnchorId() )
- {
- if( nCntnt <= aSave.m_nCntnt )
- {
- if( SAVEFLY_SPLIT == nSaveFly )
- aSave.m_bOther = true;
- else
- continue;
- }
- }
- rSaveArr.push_back(aSave);
- }
- }
- }
- }
- }
- }
-
void _RestoreCntntIdx(SwDoc* pDoc,
std::vector<MarkEntry> &rSaveArr,
sal_uLong nNode,
@@ -1641,9 +1541,9 @@ namespace
{
SaveBkmks(pDoc, nNode, nCntnt);
SaveRedlines(pDoc, nNode, nCntnt);
+ SaveFlys(pDoc, nNode, nCntnt, nSaveFly);
SaveUnoCrsrs(pDoc, nNode, nCntnt);
SaveShellCrsrs(pDoc, nNode, nCntnt);
- return _SaveCntntIdx(pDoc, nNode, nCntnt, m_aFlyEntries, nSaveFly);
}
virtual void Restore(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nOffset=0, bool bAuto = false) SAL_OVERRIDE
{
@@ -1672,6 +1572,7 @@ namespace
inline void RestoreBkmks(SwDoc* pDoc, updater_t& rUpdater);
inline void SaveRedlines(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt);
inline void RestoreRedlines(SwDoc* pDoc, updater_t& rUpdater);
+ inline void SaveFlys(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt, sal_uInt8 nSaveFly);
inline void SaveUnoCrsrs(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt);
inline void RestoreUnoCrsrs(SwDoc* pDoc, updater_t& rUpdater);
inline void SaveShellCrsrs(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt);
@@ -1820,6 +1721,102 @@ void CntntIdxStoreImpl::RestoreRedlines(SwDoc* pDoc, updater_t& rUpdater)
}
}
+void CntntIdxStoreImpl::SaveFlys(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt, sal_uInt8 nSaveFly)
+{
+ // Paragraph anchored objects
+ MarkEntry aSave;
+ {
+ SwCntntNode *pNode = pDoc->GetNodes()[nNode]->GetCntntNode();
+ if( pNode )
+ {
+
+ SwFrm* pFrm = pNode->getLayoutFrm( pDoc->GetCurrentLayout() );
+#if OSL_DEBUG_LEVEL > 1
+ static bool bViaDoc = false;
+ if( bViaDoc )
+ pFrm = NULL;
+#endif
+ if( pFrm ) // Do we have a layout? Then it's a bit cheaper ...
+ {
+ if( pFrm->GetDrawObjs() )
+ {
+ const SwSortedObjs& rDObj = *pFrm->GetDrawObjs();
+ for( sal_uInt32 n = rDObj.Count(); n; )
+ {
+ SwAnchoredObject* pObj = rDObj[ --n ];
+ const SwFrmFmt& rFmt = pObj->GetFrmFmt();
+ const SwFmtAnchor& rAnchor = rFmt.GetAnchor();
+ SwPosition const*const pAPos = rAnchor.GetCntntAnchor();
+ if ( pAPos &&
+ ( ( nSaveFly &&
+ FLY_AT_PARA == rAnchor.GetAnchorId() ) ||
+ ( FLY_AT_CHAR == rAnchor.GetAnchorId() ) ) )
+ {
+ aSave.m_bOther = false;
+ aSave.m_nCntnt = pAPos->nContent.GetIndex();
+
+ OSL_ENSURE( nNode == pAPos->nNode.GetIndex(),
+ "_SaveCntntIdx: Wrong Node-Index" );
+ if ( FLY_AT_CHAR == rAnchor.GetAnchorId() )
+ {
+ if( nCntnt <= aSave.m_nCntnt )
+ {
+ if( SAVEFLY_SPLIT == nSaveFly )
+ aSave.m_bOther = true;
+ else
+ continue;
+ }
+ }
+ aSave.m_nIdx = pDoc->GetSpzFrmFmts()->size();
+ while( aSave.m_nIdx &&
+ &rFmt != (*pDoc->GetSpzFrmFmts())[
+ --aSave.m_nIdx ] )
+ ; // nothing
+ OSL_ENSURE( &rFmt == (*pDoc->GetSpzFrmFmts())[
+ aSave.m_nIdx ],
+ "_SaveCntntIdx: Lost FrameFormat" );
+ m_aFlyEntries.push_back(aSave);
+ }
+ }
+ }
+ }
+ else // No layout, so it's a bit more expensive ...
+ {
+ for( aSave.m_nIdx = pDoc->GetSpzFrmFmts()->size();
+ aSave.m_nIdx ; )
+ {
+ SwFrmFmt* pFrmFmt = (*pDoc->GetSpzFrmFmts())[
+ --aSave.m_nIdx ];
+ if ( RES_FLYFRMFMT != pFrmFmt->Which() &&
+ RES_DRAWFRMFMT != pFrmFmt->Which() )
+ continue;
+
+ const SwFmtAnchor& rAnchor = pFrmFmt->GetAnchor();
+ SwPosition const*const pAPos = rAnchor.GetCntntAnchor();
+ if ( pAPos && ( nNode == pAPos->nNode.GetIndex() ) &&
+ ( FLY_AT_PARA == rAnchor.GetAnchorId() ||
+ FLY_AT_CHAR == rAnchor.GetAnchorId() ) )
+ {
+ aSave.m_bOther = false;
+ aSave.m_nCntnt = pAPos->nContent.GetIndex();
+ if ( FLY_AT_CHAR == rAnchor.GetAnchorId() )
+ {
+ if( nCntnt <= aSave.m_nCntnt )
+ {
+ if( SAVEFLY_SPLIT == nSaveFly )
+ aSave.m_bOther = true;
+ else
+ continue;
+ }
+ }
+ m_aFlyEntries.push_back(aSave);
+ }
+ }
+ }
+ }
+ }
+}
+
void CntntIdxStoreImpl::SaveUnoCrsrs(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt)
{
long int nIdx = 0;
More information about the Libreoffice-commits
mailing list