[Libreoffice-commits] .: Branch 'libreoffice-3-5' - 2 commits - sw/source
Michael Stahl
mst at kemper.freedesktop.org
Mon Jan 30 13:40:56 PST 2012
sw/source/core/fields/reffld.cxx | 39 ++++++++++++++++++++++++---------------
1 file changed, 24 insertions(+), 15 deletions(-)
New commits:
commit 5de902f2b66e64bc4b4755356db3b259c01ddcdd
Author: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>
Date: Mon Jan 30 11:35:42 2012 +0100
fdo#35669: more robust references merging
(cherry picked from commit 458d56d9b35f2ecb2eea2589737079390b10ee26)
Signed-off-by: Michael Stahl <mstahl at redhat.com>
diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index c15c542..eca22ba 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -974,11 +974,13 @@ void _RefIdsMap::Init( SwDoc& rDoc, SwDoc& rDestDoc, sal_Bool bField )
GetFieldIdsFromDoc( rDoc, aDstIds );
// Define the mappings now
- sal_uInt16 nMaxDstId = *aIds.end();
+ sal_uInt16 nMaxDstId = -1;
+ if ( !aIds.empty() )
+ nMaxDstId = *aIds.rbegin();
// Map all the src fields to their value + nMaxDstId
for ( std::set<sal_uInt16>::iterator pIt = aDstIds.begin(); pIt != aDstIds.end(); ++pIt )
- AddId( nMaxDstId++, *pIt );
+ AddId( ++nMaxDstId, *pIt );
// Change the Sequence number of all the SetExp fields in the destination document
SwFieldType* pType = rDoc.GetFldType( RES_SETEXPFLD, aName, false );
commit d3294590d6c15205cc0a176e96ef04f2816079cd
Author: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>
Date: Thu Jan 26 15:30:01 2012 +0100
fdo#35669: properly merge ref fields in master documents
(cherry picked from commit 5e51960dede5015b862df05b7b16f02884647889)
Signed-off-by: Michael Stahl <mstahl at redhat.com>
diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index 98111d0..c15c542 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -972,6 +972,26 @@ void _RefIdsMap::Init( SwDoc& rDoc, SwDoc& rDestDoc, sal_Bool bField )
{
GetFieldIdsFromDoc( rDestDoc, aIds );
GetFieldIdsFromDoc( rDoc, aDstIds );
+
+ // Define the mappings now
+ sal_uInt16 nMaxDstId = *aIds.end();
+
+ // Map all the src fields to their value + nMaxDstId
+ for ( std::set<sal_uInt16>::iterator pIt = aDstIds.begin(); pIt != aDstIds.end(); ++pIt )
+ AddId( nMaxDstId++, *pIt );
+
+ // Change the Sequence number of all the SetExp fields in the destination document
+ SwFieldType* pType = rDoc.GetFldType( RES_SETEXPFLD, aName, false );
+ if( pType )
+ {
+ SwIterator<SwFmtFld,SwFieldType> aIter( *pType );
+ for( SwFmtFld* pF = aIter.First(); pF; pF = aIter.Next() )
+ if( pF->GetTxtFld() )
+ {
+ sal_uInt16 n = ((SwSetExpField*)pF->GetFld())->GetSeqNumber( );
+ ((SwSetExpField*)pF->GetFld())->SetSeqNumber( sequencedIds[ n ] );
+ }
+ }
}
else
{
@@ -1030,21 +1050,8 @@ void _RefIdsMap::Check( SwDoc& rDoc, SwDoc& rDestDoc, SwGetRefField& rFld,
AddId( n, nSeqNo );
rFld.SetSeqNo( n );
- // und noch die Felder oder Fuss-/EndNote auf die neue
- // Id umsetzen
- if( bField )
- {
- SwFieldType* pType = rDoc.GetFldType( RES_SETEXPFLD, aName, false );
- if( pType )
- {
- SwIterator<SwFmtFld,SwFieldType> aIter( *pType );
- for( SwFmtFld* pF = aIter.First(); pF; pF = aIter.Next() )
- if( pF->GetTxtFld() && nSeqNo ==
- ((SwSetExpField*)pF->GetFld())->GetSeqNumber() )
- ((SwSetExpField*)pF->GetFld())->SetSeqNumber( n );
- }
- }
- else
+ // und noch die Fuss-/EndNote auf die neue Id umsetzen
+ if( !bField )
{
SwTxtFtn* pFtnIdx;
for( sal_uInt16 i = 0, nCnt = rDoc.GetFtnIdxs().Count(); i < nCnt; ++i )
More information about the Libreoffice-commits
mailing list