You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by or...@apache.org on 2014/03/28 12:13:57 UTC
svn commit: r1582697 - in /openoffice/trunk/main/sw: inc/tox.hxx
source/core/tox/tox.cxx source/filter/ww8/ww8par5.cxx
Author: orw
Date: Fri Mar 28 11:13:57 2014
New Revision: 1582697
URL: http://svn.apache.org/r1582697
Log:
124451: WW8 import: apply correct index entry template patterns which are used for e.g. TOC
Modified:
openoffice/trunk/main/sw/inc/tox.hxx
openoffice/trunk/main/sw/source/core/tox/tox.cxx
openoffice/trunk/main/sw/source/filter/ww8/ww8par5.cxx
Modified: openoffice/trunk/main/sw/inc/tox.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/inc/tox.hxx?rev=1582697&r1=1582696&r2=1582697&view=diff
==============================================================================
--- openoffice/trunk/main/sw/inc/tox.hxx (original)
+++ openoffice/trunk/main/sw/inc/tox.hxx Fri Mar 28 11:13:57 2014
@@ -382,10 +382,8 @@ public:
void SetPattern(sal_uInt16 nLevel, const String& rStr);
const SwFormTokens& GetPattern(sal_uInt16 nLevel) const;
- // fill tab stop positions from template to pattern
- // #i21237#
- void AdjustTabStops(SwDoc& rDoc,
- sal_Bool bInsertNewTabStops = sal_False);
+ // fill tab stop positions from template to pattern- #i21237#
+ void AdjustTabStops( SwDoc& rDoc );
inline TOXTypes GetTOXType() const;
inline sal_uInt16 GetFormMax() const;
@@ -601,9 +599,14 @@ public:
const String& GetSortAlgorithm()const {return sSortAlgorithm;}
void SetSortAlgorithm(const String& rSet) {sSortAlgorithm = rSet;}
+
// #i21237#
- void AdjustTabStops(SwDoc & rDoc, sal_Bool bDefaultRightTabStop);
- SwTOXBase& operator=(const SwTOXBase& rSource);
+ inline void AdjustTabStops( SwDoc & rDoc )
+ {
+ aForm.AdjustTabStops( rDoc );
+ }
+
+ SwTOXBase& operator=(const SwTOXBase& rSource);
void RegisterToTOXType( SwTOXType& rMark );
};
@@ -754,11 +757,6 @@ inline const String& SwTOXBase::GetTypeN
inline const SwForm& SwTOXBase::GetTOXForm() const
{ return aForm; }
-inline void SwTOXBase::AdjustTabStops(SwDoc & rDoc, sal_Bool bDefaultRightTabStop)
-{
- aForm.AdjustTabStops(rDoc, bDefaultRightTabStop);
-}
-
inline void SwTOXBase::SetCreate(sal_uInt16 nCreate)
{ nCreateType = nCreate; }
Modified: openoffice/trunk/main/sw/source/core/tox/tox.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/tox/tox.cxx?rev=1582697&r1=1582696&r2=1582697&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/core/tox/tox.cxx (original)
+++ openoffice/trunk/main/sw/source/core/tox/tox.cxx Fri Mar 28 11:13:57 2014
@@ -428,78 +428,53 @@ bool operator == (const SwFormToken & rT
}
//-----------------------------------------------------------------------------
-void SwForm::AdjustTabStops(SwDoc& rDoc, sal_Bool bInsertNewTapStops) // #i21237#
+void SwForm::AdjustTabStops( SwDoc& rDoc ) // #i21237#
{
for(sal_uInt16 nLevel = 1; nLevel < GetFormMax(); nLevel++)
{
const String& sTemplateName = GetTemplate(nLevel);
SwTxtFmtColl* pColl = rDoc.FindTxtFmtCollByName( sTemplateName );
- if( !pColl )
+ if( pColl == NULL )
{
- sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName
- ( sTemplateName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL ); // #i21237#
- if( USHRT_MAX != nId )
+ const sal_uInt16 nId =
+ SwStyleNameMapper::GetPoolIdFromUIName( sTemplateName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ if ( USHRT_MAX != nId )
pColl = rDoc.GetTxtCollFromPool( nId );
}
- const SvxTabStopItem* pTabStops = 0;
- sal_uInt16 nTabCount = 0;
- if( pColl &&
- 0 != ( pTabStops = &pColl->GetTabStops(sal_False) ) &&
- 0 != ( nTabCount = pTabStops->Count() ) )
+ const SvxTabStopItem* pTabStops = pColl != NULL ? &pColl->GetTabStops(sal_False) : 0;
+ const sal_uInt16 nTabCount = pTabStops != NULL ? pTabStops->Count() : 0;
+ if( pTabStops != NULL
+ && nTabCount != 0 )
{
- // #i21237#
SwFormTokens aCurrentPattern = GetPattern(nLevel);
SwFormTokens::iterator aIt = aCurrentPattern.begin();
- sal_Bool bChanged = sal_False;
-
+ bool bChanged = false;
for(sal_uInt16 nTab = 0; nTab < nTabCount; ++nTab)
{
const SvxTabStop& rTab = (*pTabStops)[nTab];
- // --> FME 2004-12-16 #i29178#
- // For Word import, we do not want to replace exising tokens,
- // we insert new tabstop tokens without a tabstop character:
- if ( bInsertNewTapStops )
+ aIt = find_if( aIt, aCurrentPattern.end(), SwFormTokenEqualToFormTokenType(TOKEN_TAB_STOP) );
+ if ( aIt != aCurrentPattern.end() )
{
- if ( SVX_TAB_ADJUST_DEFAULT != rTab.GetAdjustment() )
- {
- bChanged = sal_True;
- SwFormToken aToken(TOKEN_TAB_STOP);
- aToken.bWithTab = sal_False;
- aToken.nTabStopPosition = rTab.GetTabPos();
- aToken.eTabAlign = rTab.GetAdjustment();
- aToken.cTabFillChar = rTab.GetFill();
- aCurrentPattern.push_back(aToken);
- }
+ bChanged = true;
+ aIt->nTabStopPosition = rTab.GetTabPos();
+ aIt->eTabAlign =
+ ( nTab == nTabCount - 1
+ && rTab.GetAdjustment() == SVX_TAB_ADJUST_RIGHT )
+ ? SVX_TAB_ADJUST_END
+ : rTab.GetAdjustment();
+ aIt->cTabFillChar = rTab.GetFill();
+ ++aIt;
}
- // <--
else
- {
- aIt = find_if(aIt, aCurrentPattern.end(),
- SwFormTokenEqualToFormTokenType
- (TOKEN_TAB_STOP));
- if ( aIt != aCurrentPattern.end() )
- {
- bChanged = sal_True;
- aIt->nTabStopPosition = rTab.GetTabPos();
- aIt->eTabAlign = nTab == nTabCount - 1 &&
- SVX_TAB_ADJUST_RIGHT == rTab.GetAdjustment() ?
- SVX_TAB_ADJUST_END :
- rTab.GetAdjustment();
- aIt->cTabFillChar = rTab.GetFill();
- ++aIt;
- }
- else
- break; // no more tokens to replace
- }
+ break; // no more tokens to replace
}
- // <--
- if(bChanged)
- SetPattern(nLevel, aCurrentPattern); // #i21237#
+ if ( bChanged )
+ SetPattern( nLevel, aCurrentPattern );
}
}
}
Modified: openoffice/trunk/main/sw/source/filter/ww8/ww8par5.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/filter/ww8/ww8par5.cxx?rev=1582697&r1=1582696&r2=1582697&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/filter/ww8/ww8par5.cxx (original)
+++ openoffice/trunk/main/sw/source/filter/ww8/ww8par5.cxx Fri Mar 28 11:13:57 2014
@@ -3446,16 +3446,11 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8
for(sal_uInt16 nLevel = 1; nLevel <= nEnd; ++nLevel)
{
SwFormTokens aPattern = aOldForm.GetPattern(nLevel);
-
- SwFormTokens::iterator new_end=remove_if(aPattern.begin(), aPattern.end(),
- SwFormTokenEqualToFormTokenType(TOKEN_ENTRY_NO));
-
- aPattern.erase (new_end, aPattern.end() ); // #124710#: table index imported with wrong page number format
-
- aForm.SetPattern(nLevel, aPattern);
-
- aForm.SetTemplate( nLevel,
- aOldForm.GetTemplate(nLevel));
+ SwFormTokens::iterator new_end =
+ remove_if(aPattern.begin(), aPattern.end(), SwFormTokenEqualToFormTokenType(TOKEN_ENTRY_NO));
+ aPattern.erase(new_end, aPattern.end() ); // #124710#: table index imported with wrong page number format
+ aForm.SetPattern( nLevel, aPattern );
+ aForm.SetTemplate( nLevel, aOldForm.GetTemplate(nLevel) );
}
// <- #i21237#
@@ -3475,17 +3470,10 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8
break;
} // ToxBase fertig
- // no Update of TOC anymore as its actual content is imported and kept.
- //rDoc.SetUpdateTOX(true);
-
- // #i21237#
- // propagate tab stops from paragraph styles used in TOX to
- // patterns of the TOX
- pBase->AdjustTabStops(rDoc, sal_True);
-
- //#i10028# inserting a toc implicltly acts like a parabreak
- //in word and writer
+ // #i21237# - propagate tab stops from paragraph styles used in TOX to patterns of the TOX
+ pBase->AdjustTabStops( rDoc );
+ //#i10028# inserting a toc implicltly acts like a parabreak in word and writer
if ( pPaM->End() &&
pPaM->End()->nNode.GetNode().GetTxtNode() &&
pPaM->End()->nNode.GetNode().GetTxtNode()->Len() != 0 )