[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 2 commits - sw/inc sw/source
Oliver-Rainer Wittmann
orw at apache.org
Fri Jun 27 07:08:22 PDT 2014
sw/inc/doc.hxx | 12 +
sw/inc/editsh.hxx | 6
sw/inc/fmtcol.hxx | 69 +++++-----
sw/inc/ndtxt.hxx | 8 -
sw/source/core/attr/format.cxx | 4
sw/source/core/doc/docfmt.cxx | 173 +++++++++----------------
sw/source/core/doc/docglbl.cxx | 3
sw/source/core/doc/doctxm.cxx | 51 +++----
sw/source/core/doc/fmtcol.cxx | 55 +++-----
sw/source/core/edit/edfcol.cxx | 2
sw/source/core/txtnode/ndtxt.cxx | 1
sw/source/core/undo/unfmco.cxx | 13 -
sw/source/core/unocore/unosett.cxx | 21 +--
sw/source/core/unocore/unostyle.cxx | 17 --
sw/source/filter/rtf/swparrtf.cxx | 5
sw/source/filter/ww8/ww8par.cxx | 240 ++++++++++++++----------------------
sw/source/filter/ww8/ww8par.hxx | 25 +--
sw/source/filter/ww8/ww8par2.cxx | 5
sw/source/filter/ww8/ww8par2.hxx | 58 +++++++-
sw/source/filter/ww8/ww8par3.cxx | 71 ++++------
sw/source/filter/ww8/ww8par5.cxx | 44 ------
sw/source/filter/ww8/ww8par6.cxx | 31 +++-
sw/source/filter/xml/swxml.cxx | 13 -
23 files changed, 407 insertions(+), 520 deletions(-)
New commits:
commit 3b168ead25db16c12524054692512e5ba83b85e0
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date: Fri Jun 27 12:34:10 2014 +0000
78498: WW8 import - improvements/corrections regarding outline level & Co
- import outline level attribute at Paragraph Styles
- import outline level attribute at paragraphs
- refactor code to apply list level properties to Outline Style
-- only consider WW8 list styles applied to WW8 Built-in Heading Styles
-- only assign AOO counterparts of WW8 Built-in Heading Styles to Outline Style
diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx
index 15e81c5..7807512 100644
--- a/sw/source/filter/rtf/swparrtf.cxx
+++ b/sw/source/filter/rtf/swparrtf.cxx
@@ -3922,11 +3922,10 @@ SwTxtFmtColl* SwRTFParser::MakeColl(const String& rName, sal_uInt16 nPos,
if( !nPos )
{
pColl = pDoc->GetTxtCollFromPool( RES_POOLCOLL_STANDARD, false );
- //pColl->SetOutlineLevel( nOutlineLevel ); //#outline level,removed by zhaojianwei
- if(nOutlineLevel < MAXLEVEL ) //->add by zhaojianwei
+ if ( nOutlineLevel < MAXLEVEL )
pColl->AssignToListLevelOfOutlineStyle( nOutlineLevel );
else
- pColl->DeleteAssignmentToListLevelOfOutlineStyle(); //<-end,zhaojianwei
+ pColl->DeleteAssignmentToListLevelOfOutlineStyle();
return pColl;
}
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 14046d5..246ac97 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -3792,7 +3792,6 @@ SwWW8ImplReader::SwWW8ImplReader(sal_uInt8 nVersionPara, SvStorage* pStorage,
mpDrawEditEngine = 0;
pWWZOrder = 0;
pFormImpl = 0;
- mpChosenOutlineNumRule = 0;
pNumFldType = 0;
nFldNum = 0;
@@ -4449,7 +4448,7 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
pStyles->PostProcessStyles();
if (pCollA)
- SetOutLineStyles();
+ SetOutlineStyles();
pSBase = new WW8ScannerBase(pStrm,pTableStream,pDataStream,pWwFib);
@@ -5186,178 +5185,135 @@ public:
}
};
-void SwWW8ImplReader::SetOutLineStyles()
+
+void SwWW8ImplReader::SetOutlineStyles()
{
- /*
- #i3674# - Load new document and insert document cases.
- */
- SwNumRule aOutlineRule(*rDoc.GetOutlineNumRule());
- // #i53044,i53213#
- // <mpChosenOutlineNumRule> has to be set to point to local variable
- // <aOutlineRule>, because its used below to be compared this <&aOutlineRule>.
- // But at the end of the method <mpChosenOutlineNumRule> has to be set to
- // <rDoc.GetOutlineNumRule()>, because <aOutlineRule> will be destroyed.
- mpChosenOutlineNumRule = &aOutlineRule;
-
- sw::ParaStyles aOutLined(sw::util::GetParaStyles(rDoc));
- // #i98791# - sorting algorithm adjusted
- sw::util::SortByAssignedOutlineStyleListLevel(aOutLined);
-
- typedef sw::ParaStyleIter myParaStyleIter;
- /*
- If we are inserted into a document then don't clobber existing existing
- levels.
- */
- sal_uInt16 nFlagsStyleOutlLevel = 0;
- if (!mbNewDoc)
+
+ // If we are inserted into a document then don't clobber existing outline levels.
+ sal_uInt16 nOutlineStyleListLevelWithAssignment = 0;
+ if ( !mbNewDoc )
{
- // #i70748# - backward iteration needed due to the outline level attribute
+ sw::ParaStyles aOutLined( sw::util::GetParaStyles( rDoc ) );
+ sw::util::SortByAssignedOutlineStyleListLevel( aOutLined );
sw::ParaStyles::reverse_iterator aEnd = aOutLined.rend();
- for ( sw::ParaStyles::reverse_iterator aIter = aOutLined.rbegin(); aIter < aEnd; ++aIter)
+ for ( sw::ParaStyles::reverse_iterator aIter = aOutLined.rbegin(); aIter < aEnd; ++aIter )
{
- if ((*aIter)->IsAssignedToListLevelOfOutlineStyle())
- nFlagsStyleOutlLevel |= 1 << (*aIter)->GetAssignedOutlineStyleLevel();
+ if ( ( *aIter )->IsAssignedToListLevelOfOutlineStyle() )
+ nOutlineStyleListLevelWithAssignment |= 1 << ( *aIter )->GetAssignedOutlineStyleLevel();
else
break;
}
}
- else
+
+ // Check applied WW8 list styles at WW8 Built-In Heading Styles
+ // - Choose the list style which occurs most often as the one which provides
+ // the list level properties for the Outline Style.
+ // - Populate temporary list of WW8 Built-In Heading Styles for further iteration
+ std::vector< SwWW8StyInf* > aWW8BuiltInHeadingStyles;
+ const SwNumRule* pChosenWW8ListStyle = NULL;
{
- /*
- Only import *one* of the possible multiple outline numbering rules, so
- pick the one that affects most styles. If we're not importing a new
- document, we got to stick with what is already there.
- */
- // use index in text format collection
- // array <pCollA> as key of the outline numbering map <aRuleMap>
- // instead of the memory pointer of the outline numbering rule
- // to assure that, if two outline numbering rule affect the same
- // count of text formats, always the same outline numbering rule is chosen.
- std::map<sal_uInt16, int>aRuleMap;
- typedef std::map<sal_uInt16, int>::iterator myIter;
- for (sal_uInt16 nI = 0; nI < nColls; ++nI)
+ std::map< const SwNumRule*, int > aWW8ListStyleCounts;
+ for ( sal_uInt16 nI = 0; nI < nColls; ++nI )
{
- SwWW8StyInf& rSI = pCollA[ nI ];
- if (
- (MAXLEVEL > rSI.nOutlineLevel) && rSI.pOutlineNumrule &&
- rSI.pFmt
- )
+ SwWW8StyInf& rSI = pCollA[nI];
+
+ if ( !rSI.IsWW8BuiltInHeadingStyle()
+ || !rSI.HasWW8OutlineLevel() )
{
- myIter aIter = aRuleMap.find(nI);
- if (aIter == aRuleMap.end())
- {
- aRuleMap[nI] = 1;
- }
- else
- ++(aIter->second);
+ continue;
}
- }
- int nMax = 0;
- myIter aEnd2 = aRuleMap.end();
- for (myIter aIter = aRuleMap.begin(); aIter != aEnd2; ++aIter++)
- {
- if (aIter->second > nMax)
+ aWW8BuiltInHeadingStyles.push_back( &rSI );
+
+ const SwNumRule* pWW8ListStyle = rSI.GetOutlineNumrule();
+ if ( pWW8ListStyle != NULL )
{
- nMax = aIter->second;
- mpChosenOutlineNumRule = pCollA[ aIter->first ].pOutlineNumrule;
+ std::map< const SwNumRule*, int >::iterator aCountIter =
+ aWW8ListStyleCounts.find( pWW8ListStyle );
+ if ( aCountIter == aWW8ListStyleCounts.end() )
+ {
+ aWW8ListStyleCounts[pWW8ListStyle] = 1;
+ }
+ else
+ {
+ ++(aCountIter->second);
+ }
}
}
- ASSERT(mpChosenOutlineNumRule, "Impossible");
- if (mpChosenOutlineNumRule)
- aOutlineRule = *mpChosenOutlineNumRule;
-
- if (mpChosenOutlineNumRule != &aOutlineRule)
+ int nCurrentMaxCount = 0;
+ std::map< const SwNumRule*, int >::iterator aCountIterEnd =
+ aWW8ListStyleCounts.end();
+ for ( std::map< const SwNumRule*, int >::iterator aIter = aWW8ListStyleCounts.begin();
+ aIter != aCountIterEnd;
+ ++aIter )
{
- // #i70748# - backward iteration needed due to the outline level attribute
- sw::ParaStyles::reverse_iterator aEnd = aOutLined.rend();
- for ( sw::ParaStyles::reverse_iterator aIter = aOutLined.rbegin(); aIter < aEnd; ++aIter)
+ if ( aIter->second > nCurrentMaxCount )
{
- if((*aIter)->IsAssignedToListLevelOfOutlineStyle())
- (*aIter)->DeleteAssignmentToListLevelOfOutlineStyle();
-
- else
- break;
+ nCurrentMaxCount = aIter->second;
+ pChosenWW8ListStyle = aIter->first;
}
}
}
- sal_uInt16 nOldFlags = nFlagsStyleOutlLevel;
+ if ( pChosenWW8ListStyle == NULL )
+ {
+ // no WW8 list style for Outline Style found --> nothing to do
+ return;
+ }
- for (sal_uInt16 nI = 0; nI < nColls; ++nI)
+ // - set list level properties of Outline Style - ODF's list style applied by default to headings
+ // - assign corresponding Heading Paragraph Styles to the Outline Style
+ // - If a heading Paragraph Styles is not applying the WW8 list style which had been chosen as
+ // the one which provides the list level properties for the Outline Style, its assignment to
+ // the Outline Style is removed and a potential applied WW8 list style is assigned directly.
+ SwNumRule aOutlineRule( *rDoc.GetOutlineNumRule() );
+ bool bAppliedChangedOutlineStyle = false;
+ std::vector< SwWW8StyInf* >::iterator aStylesIterEnd =
+ aWW8BuiltInHeadingStyles.end();
+ for ( std::vector< SwWW8StyInf* >::iterator aStyleIter = aWW8BuiltInHeadingStyles.begin();
+ aStyleIter != aStylesIterEnd;
+ ++aStyleIter )
{
- SwWW8StyInf& rSI = pCollA[nI];
+ SwWW8StyInf* pStyleInf = (*aStyleIter);
- if (rSI.IsOutlineNumbered())
+ const sal_uInt16 nOutlineStyleListLevelOfWW8BuiltInHeadingStyle = 1 << pStyleInf->mnWW8OutlineLevel;
+ if ( nOutlineStyleListLevelOfWW8BuiltInHeadingStyle & nOutlineStyleListLevelWithAssignment )
{
- sal_uInt16 nAktFlags = 1 << rSI.nOutlineLevel;
- if (
- (nAktFlags & nFlagsStyleOutlLevel) ||
- (rSI.pOutlineNumrule != mpChosenOutlineNumRule)
- )
- {
- /*
- If our spot is already taken by something we can't replace
- then don't insert and remove our outline level.
- */
- rSI.pFmt->SetFmtAttr(
- SwNumRuleItem( rSI.pOutlineNumrule->GetName() ) );
- //((SwTxtFmtColl*)rSI.pFmt)->SetOutlineLevel(NO_NUMBERING);
- ((SwTxtFmtColl*)rSI.pFmt)->DeleteAssignmentToListLevelOfOutlineStyle();//#outline level,zhaojianwei
- }
- else
- {
- /*
- If there is a style already set for this outline
- numbering level and its not a style set by us already
- then we can remove it outline numbering.
- (its one of the default headings in a new document
- so we can clobber it)
- Of course if we are being inserted into a document that
- already has some set we can't do this, thats covered by
- the list of level in nFlagsStyleOutlLevel to ignore.
- */
- outlineeq aCmp(rSI.nOutlineLevel);
- myParaStyleIter aResult = std::find_if(aOutLined.begin(),
- aOutLined.end(), aCmp);
-
- myParaStyleIter aEnd = aOutLined.end();
- while (aResult != aEnd && aCmp(*aResult))
- {
- //(*aResult)->SetOutlineLevel(NO_NUMBERING);//#outline level,zhaojianwei
- (*aResult)->DeleteAssignmentToListLevelOfOutlineStyle();
- ++aResult;
- }
+ continue;
+ }
- /*
- #i1886#
- I believe that when a list is registered onto a winword
- style which is an outline numbering style (i.e.
- nOutlineLevel is set) that the style of numbering is for
- the level is indexed by the *list* level that was
- registered on that style, and not the outlinenumbering
- level, which is probably a logical sequencing, and not a
- physical mapping into the list style reged on that outline
- style.
- */
- sal_uInt8 nFromLevel = rSI.nListLevel;
- sal_uInt8 nToLevel = rSI.nOutlineLevel;
- const SwNumFmt& rRule=rSI.pOutlineNumrule->Get(nFromLevel);
- aOutlineRule.Set(nToLevel, rRule);
- // Set my outline level
- //((SwTxtFmtColl*)rSI.pFmt)->SetOutlineLevel(nToLevel);//#outline level,zhaojianwei
- ((SwTxtFmtColl*)rSI.pFmt)->AssignToListLevelOfOutlineStyle(nToLevel); //<-end,zhaojianwei
- // If there are more styles on this level ignore them
- nFlagsStyleOutlLevel |= nAktFlags;
+#if OSL_DEBUG_LEVEL > 1
+ ASSERT( pStyleInf->mnWW8OutlineLevel == pStyleInf->nListLevel,
+ "WW8 import - <SwWW8ImplReader::SetOutlineStyles()> - it is not expected that WW8 Built-In Heading styles have different outline level and list level" );
+#endif
+ const SwNumFmt& rRule = pChosenWW8ListStyle->Get( pStyleInf->mnWW8OutlineLevel );
+ aOutlineRule.Set( pStyleInf->mnWW8OutlineLevel, rRule );
+ bAppliedChangedOutlineStyle = true;
+ // in case that there are more styles on this level ignore them
+ nOutlineStyleListLevelWithAssignment |= nOutlineStyleListLevelOfWW8BuiltInHeadingStyle;
+
+ SwTxtFmtColl* pTxtFmtColl = static_cast<SwTxtFmtColl*>(pStyleInf->pFmt);
+ if ( pStyleInf->GetOutlineNumrule() != pChosenWW8ListStyle )
+ {
+ // WW8 Built-In Heading Style does not apply the chosen one.
+ // --> delete assignment to OutlineStyle, but keep its current outline level
+ pTxtFmtColl->DeleteAssignmentToListLevelOfOutlineStyle( false );
+ // Apply existing WW8 list style a normal list style at the Paragraph Style
+ if ( pStyleInf->GetOutlineNumrule() != NULL )
+ {
+ pTxtFmtColl->SetFmtAttr( SwNumRuleItem( pStyleInf->GetOutlineNumrule()->GetName() ) );
}
}
+ else
+ {
+ pTxtFmtColl->AssignToListLevelOfOutlineStyle( pStyleInf->mnWW8OutlineLevel );
+ }
}
- if (nOldFlags != nFlagsStyleOutlLevel)
- rDoc.SetOutlineNumRule(aOutlineRule);
- if ( mpChosenOutlineNumRule == &aOutlineRule )
+
+ if ( bAppliedChangedOutlineStyle )
{
- mpChosenOutlineNumRule = rDoc.GetOutlineNumRule();
+ rDoc.SetOutlineNumRule(aOutlineRule);
}
}
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index e3a862c..2adad32 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -301,7 +301,12 @@ public:
void NewAttr(const SwPosition& rPos, const SfxPoolItem& rAttr);
- virtual void SetAttr(const SwPosition& rPos, sal_uInt16 nAttrId=0, sal_Bool bTstEnde=sal_True, long nHand=LONG_MAX, sal_Bool consumedByField=sal_False);
+ virtual void SetAttr(
+ const SwPosition& rPos,
+ sal_uInt16 nAttrId = 0,
+ sal_Bool bTstEnde = sal_True,
+ long nHand = LONG_MAX,
+ sal_Bool consumedByField = sal_False );
void SetToggleAttr(sal_uInt8 nId, bool bOn)
{
@@ -1032,14 +1037,6 @@ private:
std::stack<rtl_TextEncoding> maFontSrcCharSets;
std::stack<rtl_TextEncoding> maFontSrcCJKCharSets;
- /*
- Winword numbering gets imported as SwNumRules, there is a problem that
- winword can have multiple outline numberings, only one gets chosen as
- the writer outline numbering rule. The one that gets chosen is set here
- as mpChosenOutlineNumRule
- */
- SwNumRule *mpChosenOutlineNumRule;
-
SwMSConvertControls *pFormImpl; // Control-Implementierung
SwFlyFrmFmt* pFlyFmtOfJustInsertedGraphic;
@@ -1500,8 +1497,11 @@ private:
// Ver8-Listen
- void RegisterNumFmtOnTxtNode(sal_uInt16 nActLFO, sal_uInt8 nActLevel,
- bool bSetAttr = true);
+ void RegisterNumFmtOnTxtNode(
+ sal_uInt16 nActLFO,
+ sal_uInt8 nActLevel,
+ const bool bSetAttr = true );
+
void RegisterNumFmtOnStyle(sal_uInt16 nStyle);
void SetStylesList(sal_uInt16 nStyle, sal_uInt16 nActLFO,
sal_uInt8 nActLevel);
@@ -1537,7 +1537,7 @@ private:
SwTwips MoveOutsideFly(SwFrmFmt *pFlyFmt, const SwPosition &rPos,
bool bTableJoin = true);
- void SetOutLineStyles();
+ void SetOutlineStyles();
bool SetSpacing(SwPaM &rMyPam, int nSpace, bool bIsUpper);
bool SetUpperSpacing(SwPaM &pMyPam, int nSpace);
@@ -1700,7 +1700,6 @@ public: // eigentlich private, geht aber leider nur public
eF_ResT Read_F_NoteReference( WW8FieldDesc* pF, String& rStr );
eF_ResT Read_F_Tox( WW8FieldDesc* pF, String& rStr );
- bool AddExtraOutlinesAsExtraStyles(SwTOXBase& rBase);
eF_ResT Read_F_Symbol( WW8FieldDesc*, String& rStr );
eF_ResT Read_F_Embedd( WW8FieldDesc*, String& rStr );
eF_ResT Read_F_FormTextBox( WW8FieldDesc* pF, String& rStr);
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 05e24e4..a44e3b8 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -833,8 +833,7 @@ void SwWW8ImplReader::Read_ANLevelNo( sal_uInt16, const sal_uInt8* pData, short
{
nSwNumLevel = *pData - 1;
if (!bNoAttrImport)
- //((SwTxtFmtColl*)pAktColl)->SetOutlineLevel( nSwNumLevel ); //#outline level,zhaojianwei
- ((SwTxtFmtColl*)pAktColl)->AssignToListLevelOfOutlineStyle( nSwNumLevel ); //<-end,zhaojianwei
+ ( (SwTxtFmtColl*) pAktColl )->AssignToListLevelOfOutlineStyle( nSwNumLevel );
// Bei WW-NoNumbering koennte auch NO_NUMBERING gesetzt
// werden. ( Bei normaler Nummerierung muss NO_NUM gesetzt
// werden: NO_NUM : Nummerierungs-Pause,
@@ -4036,7 +4035,7 @@ bool WW8RStyle::PrepareStyle(SwWW8StyInf &rSI, ww::sti eSti, sal_uInt16 nThisSty
rSI.eCJKFontSrcCharSet = pj->eCJKFontSrcCharSet;
rSI.n81Flags = pj->n81Flags;
rSI.n81BiDiFlags = pj->n81BiDiFlags;
- rSI.nOutlineLevel = pj->nOutlineLevel;
+ rSI.mnWW8OutlineLevel = pj->mnWW8OutlineLevel;
rSI.bParaAutoBefore = pj->bParaAutoBefore;
rSI.bParaAutoAfter = pj->bParaAutoAfter;
diff --git a/sw/source/filter/ww8/ww8par2.hxx b/sw/source/filter/ww8/ww8par2.hxx
index a7e0855..8b5fd9e 100644
--- a/sw/source/filter/ww8/ww8par2.hxx
+++ b/sw/source/filter/ww8/ww8par2.hxx
@@ -129,6 +129,8 @@ class SwWW8StyInf
{
String sWWStyleName;
sal_uInt16 nWWStyleId;
+
+
public:
rtl_TextEncoding eLTRFontSrcCharSet; // rtl_TextEncoding fuer den Font
rtl_TextEncoding eRTLFontSrcCharSet; // rtl_TextEncoding fuer den Font
@@ -141,7 +143,15 @@ public:
sal_uInt16 nFollow;
sal_uInt16 nLFOIndex;
sal_uInt8 nListLevel;
- sal_uInt8 nOutlineLevel; // falls Gliederungs-Style
+
+ // WW8 outline level is zero-based:
+ // 0: outline level 1
+ // 1: outline level 2
+ // ...
+ // 8: outline level 9
+ // 9: body text
+ sal_uInt8 mnWW8OutlineLevel;
+
sal_uInt16 n81Flags; // Fuer Bold, Italic, ...
sal_uInt16 n81BiDiFlags; // Fuer Bold, Italic, ...
SvxLRSpaceItem maWordLR;
@@ -173,7 +183,7 @@ public:
nFollow( 0 ),
nLFOIndex( USHRT_MAX ),
nListLevel(WW8ListManager::nMaxLevel),
- nOutlineLevel( MAXLEVEL ),
+ mnWW8OutlineLevel( MAXLEVEL ),
n81Flags( 0 ),
n81BiDiFlags(0),
maWordLR( RES_LR_SPACE ),
@@ -199,25 +209,61 @@ public:
sWWStyleName = rName;
nWWStyleId = nId;
}
- sal_uInt16 GetWWStyleId() const { return nWWStyleId; }
+
const String& GetOrgWWName() const
{
return sWWStyleName;
}
- bool IsOutline() const
+
+ bool HasWW8OutlineLevel() const
{
- return (pFmt && (MAXLEVEL > nOutlineLevel));
+ return ( pFmt != NULL && (MAXLEVEL > mnWW8OutlineLevel) );
}
+
bool IsOutlineNumbered() const
{
- return pOutlineNumrule && IsOutline();
+ return pOutlineNumrule != NULL && HasWW8OutlineLevel();
}
+
const SwNumRule* GetOutlineNumrule() const
{
return pOutlineNumrule;
}
+
CharSet GetCharSet() const;
CharSet GetCJKCharSet() const;
+
+ inline sal_uInt16 GetWWStyleId() const
+ {
+ return nWWStyleId;
+ }
+
+ inline bool IsWW8BuiltInHeadingStyle()
+ {
+ return GetWWStyleId() >= 1 && GetWWStyleId() <= 9;
+ }
+
+ inline bool IsWW8BuiltInDefaultStyle()
+ {
+ return GetWWStyleId() == 0;
+ }
+
+ static sal_uInt8 WW8OutlineLevelToOutlinelevel( const sal_uInt8 nWW8OutlineLevel )
+ {
+ if ( nWW8OutlineLevel < MAXLEVEL )
+ {
+ if ( nWW8OutlineLevel == 9 )
+ {
+ return 0; // no outline level --> body text
+ }
+ else
+ {
+ return nWW8OutlineLevel + 1; // outline level 1..9
+ }
+ }
+
+ return 0;
+ }
};
class WW8RStyle: public WW8Style
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index 498be3c..6be732b 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -1738,24 +1738,24 @@ bool SwWW8ImplReader::SetTxtFmtCollAndListLevel(
bool bRes = true;
if( rStyleInfo.pFmt && rStyleInfo.bColl )
{
- bRes = rDoc.SetTxtFmtColl(rRg, (SwTxtFmtColl*)rStyleInfo.pFmt)
- ? true : false;
+ bRes = rDoc.SetTxtFmtColl(rRg, (SwTxtFmtColl*)rStyleInfo.pFmt) ? true : false;
SwTxtNode* pTxtNode = pPaM->GetNode()->GetTxtNode();
- ASSERT( pTxtNode, "No Text-Node at PaM-Position" );
- // --> OD 2006-10-19 #134160# - make code robust
- if ( !pTxtNode )
+ ASSERT( pTxtNode != NULL, "No Text-Node at PaM-Position" );
+ if ( pTxtNode == NULL )
{
+ // make code robust
return bRes;
}
- // <--
- SwNumRule * pNumRule = pTxtNode->GetNumRule(); // #i27610#
+ const SwNumRule * pNumRule = pTxtNode->GetNumRule(); // #i27610#
- if( !IsInvalidOrToBeMergedTabCell() &&
- ! (pNumRule && pNumRule->IsOutlineRule()) ) // #i27610#
+ if( !IsInvalidOrToBeMergedTabCell()
+ && ! (pNumRule && pNumRule->IsOutlineRule()) ) // #i27610#
+ {
pTxtNode->ResetAttr( RES_PARATR_NUMRULE );
+ }
- if( !rStyleInfo.pOutlineNumrule )
+ if ( rStyleInfo.GetOutlineNumrule() == NULL )
{
if (
(USHRT_MAX > rStyleInfo.nLFOIndex) &&
@@ -1766,19 +1766,6 @@ bool SwWW8ImplReader::SetTxtFmtCollAndListLevel(
rStyleInfo.nListLevel, false);
}
}
- else
- {
- // --> OD 2005-11-07 #127520#
- // Use outline level set at the style info <rStyleInfo> instead of
- // the outline level at the text format, because the WW8 document
- // could contain more than one outline numbering rule and the one
- // of the text format isn't the one, which a chosen as the Writer
- // outline rule.
-// pTxtNode->
-// SetLevel(((SwTxtFmtColl*) rStyleInfo.pFmt)->GetOutlineLevel());
- pTxtNode->SetAttrListLevel( rStyleInfo.nOutlineLevel );
- // <--
- }
}
return bRes;
}
@@ -1865,25 +1852,27 @@ void SwWW8ImplReader::RegisterNumFmtOnStyle( sal_uInt16 nStyle )
// Phase 2: aktualisieren der StyleDef nach einlesen aller Listen
SwNumRule* pNmRule = 0;
- sal_uInt16 nLFO = rStyleInf.nLFOIndex;
- sal_uInt8 nLevel = rStyleInf.nListLevel;
+ const sal_uInt16 nLFO = rStyleInf.nLFOIndex;
+ const sal_uInt8 nLevel = rStyleInf.nListLevel;
if (
(USHRT_MAX > nLFO) &&
(WW8ListManager::nMaxLevel > nLevel)
)
{
std::vector<sal_uInt8> aParaSprms;
- pNmRule = pLstManager->GetNumRuleForActivation(nLFO, nLevel,
- aParaSprms);
+ pNmRule =
+ pLstManager->GetNumRuleForActivation( nLFO, nLevel, aParaSprms );
- if (pNmRule)
+ if ( pNmRule != NULL )
{
- if( MAXLEVEL > rStyleInf.nOutlineLevel )
+ if ( rStyleInf.IsWW8BuiltInHeadingStyle()
+ && rStyleInf.HasWW8OutlineLevel() )
+ {
rStyleInf.pOutlineNumrule = pNmRule;
+ }
else
{
- rStyleInf.pFmt->SetFmtAttr(
- SwNumRuleItem( pNmRule->GetName() ) );
+ rStyleInf.pFmt->SetFmtAttr( SwNumRuleItem( pNmRule->GetName() ) );
rStyleInf.bHasStyNumRule = true;
}
}
@@ -1897,7 +1886,7 @@ void SwWW8ImplReader::RegisterNumFmtOnStyle( sal_uInt16 nStyle )
void SwWW8ImplReader::RegisterNumFmtOnTxtNode(
sal_uInt16 nActLFO,
sal_uInt8 nActLevel,
- bool bSetAttr)
+ const bool bSetAttr)
{
// beachte: die Methode haengt die NumRule an den Text Node, falls
// bSetAttr (dann muessen natuerlich vorher die Listen gelesen sein)
@@ -1910,11 +1899,13 @@ void SwWW8ImplReader::RegisterNumFmtOnTxtNode(
SwTxtNode* pTxtNd = pPaM->GetNode()->GetTxtNode();
ASSERT(pTxtNd, "Kein Text-Node an PaM-Position");
- const SwNumRule* pRule = bSetAttr ?
- pLstManager->GetNumRuleForActivation( nActLFO, nActLevel,
- aParaSprms, pTxtNd) : 0;
+ const SwNumRule* pRule =
+ bSetAttr
+ ? pLstManager->GetNumRuleForActivation( nActLFO, nActLevel, aParaSprms, pTxtNd)
+ : 0;
- if (pRule || !bSetAttr)
+ if ( pRule != NULL
+ || !bSetAttr)
{
//#i24136# old is the same as new, and its the outline numbering,
//then we don't set the numrule again, and we just take the num node
@@ -1926,15 +1917,11 @@ void SwWW8ImplReader::RegisterNumFmtOnTxtNode(
is the one that was chosen to be the outline numbering then all
is unchanged
*/
- // --> OD 2005-11-04 #???# - correct condition according to the
- // above given comment.
- if ( pTxtNd->GetNumRule() == rDoc.GetOutlineNumRule() &&
- pRule == mpChosenOutlineNumRule )
- // <--
+ if ( pTxtNd->GetNumRule() == rDoc.GetOutlineNumRule() )
{
bUnchangedOutlineNumbering = true;
}
- if (!bUnchangedOutlineNumbering)
+ if ( !bUnchangedOutlineNumbering )
{
//If its normal numbering, see if its the same as it already
//was, if its not, and we have been asked to set it, then set
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index 9cfa749..2afa4f1 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -2868,38 +2868,6 @@ void lcl_toxMatchACSwitch( SwWW8ImplReader& /*rReader*/,
}
}
-//For all outline styles that are not in the outline numbering add them here as
-//custom extra styles
-bool SwWW8ImplReader::AddExtraOutlinesAsExtraStyles(SwTOXBase& rBase)
-{
- bool bExtras = false;
- //This is the case if the winword outline numbering is set while the
- //writer one is not
- for (sal_uInt16 nI = 0; nI < nColls; ++nI)
- {
- SwWW8StyInf& rSI = pCollA[nI];
- if (rSI.IsOutline())
- {
- const SwTxtFmtColl *pFmt = (const SwTxtFmtColl*)(rSI.pFmt);
- sal_uInt16 nStyleLevel = rSI.nOutlineLevel;
- sal_uInt16 nMaxLevel = rBase.GetLevel();
- if (
- //nStyleLevel != pFmt->GetOutlineLevel() && //#outline level,zhaojianwei
- nStyleLevel != (pFmt->GetAttrOutlineLevel()-1) && //<-end,zhaojianwei
- nStyleLevel < nMaxLevel
- )
- {
- String sStyles(rBase.GetStyleNames(rSI.nOutlineLevel));
- if( sStyles.Len())
- sStyles += TOX_STYLE_DELIMITER;
- sStyles += pFmt->GetName();
- rBase.SetStyleNames(sStyles, rSI.nOutlineLevel);
- bExtras = true;
- }
- }
- }
- return bExtras;
-}
static void EnsureMaxLevelForTemplates(SwTOXBase& rBase)
{
@@ -3390,13 +3358,9 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, String& rStr )
sal_uInt16 eEffectivelyFrom = eCreateFrom ? eCreateFrom : nsSwTOXElement::TOX_OUTLINELEVEL;
if (eEffectivelyFrom & nsSwTOXElement::TOX_OUTLINELEVEL)
{
- if (AddExtraOutlinesAsExtraStyles(*pBase))
- eCreateFrom |= (nsSwTOXElement::TOX_TEMPLATE | nsSwTOXElement::TOX_OUTLINELEVEL);
-
- // --> FME 2004-12-16 #i19683# Insert a text token " " between the
- // number and entry token. In an ideal world we could handle the
- // tab stop between the number and the entry correctly, but I
- // currently have no clue how to obtain the tab stop position.
+ // #i19683# Insert a text token " " between the number and entry token.
+ // In an ideal world we could handle the tab stop between the number and
+ // the entry correctly, but I currently have no clue how to obtain the tab stop position.
// It is _not_ set at the paragraph style.
SwForm* pForm = 0;
for (sal_uInt16 nI = 0; nI < nColls; ++nI)
@@ -3404,7 +3368,7 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, String& rStr )
const SwWW8StyInf& rSI = pCollA[nI];
if (rSI.IsOutlineNumbered())
{
- sal_uInt16 nStyleLevel = rSI.nOutlineLevel;
+ sal_uInt16 nStyleLevel = rSI.mnWW8OutlineLevel;
const SwNumFmt& rFmt = rSI.GetOutlineNumrule()->Get( nStyleLevel );
if ( SVX_NUM_NUMBER_NONE != rFmt.GetNumberingType() )
{
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index 36fc499..36751a7 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -277,8 +277,9 @@ void SwWW8ImplReader::SetDocumentGrid(SwFrmFmt &rFmt, const wwSection &rSection)
sal_uInt32 nCharWidth=240;
for (sal_uInt16 nI = 0; nI < pStyles->GetCount(); ++nI)
{
- if (pCollA[nI].bValid && pCollA[nI].pFmt &&
- pCollA[nI].GetWWStyleId() == 0)
+ if (pCollA[nI].bValid
+ && pCollA[nI].pFmt != NULL
+ && pCollA[nI].IsWW8BuiltInDefaultStyle())
{
nCharWidth = ItemGet<SvxFontHeightItem>(*(pCollA[nI].pFmt),
RES_CHRATR_CJK_FONTSIZE).GetHeight();
@@ -2863,20 +2864,34 @@ void SwWW8ImplReader::Read_PicLoc(sal_uInt16 , const sal_uInt8* pData, short nLe
}
}
+
void SwWW8ImplReader::Read_POutLvl(sal_uInt16, const sal_uInt8* pData, short nLen )
{
- if (pAktColl && (0 < nLen))
+ if ( nLen < 0 )
+ {
+ pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_PARATR_OUTLINELEVEL );
+ return;
+ }
+
+ if ( pAktColl != NULL )
{
- if (SwWW8StyInf* pSI = GetStyle(nAktColl))
+ SwWW8StyInf* pSI = GetStyle( nAktColl );
+ if ( pSI != NULL )
{
- pSI->nOutlineLevel = static_cast< sal_uInt8 >(
- ( (1 <= pSI->GetWWStyleId()) && (9 >= pSI->GetWWStyleId()) )
- ? pSI->GetWWStyleId()-1
- : (pData ? *pData : 0) );
+ pSI->mnWW8OutlineLevel =
+ static_cast< sal_uInt8 >( ( pData ? *pData : 0 ) );
+ NewAttr( SfxUInt16Item( RES_PARATR_OUTLINELEVEL, SwWW8StyInf::WW8OutlineLevelToOutlinelevel( pSI->mnWW8OutlineLevel ) ) );
}
}
+ else if ( pPaM != NULL )
+ {
+ const sal_uInt8 nOutlineLevel =
+ SwWW8StyInf::WW8OutlineLevelToOutlinelevel( static_cast< sal_uInt8 >( ( pData ? *pData : 0 ) ) );
+ NewAttr( SfxUInt16Item( RES_PARATR_OUTLINELEVEL, nOutlineLevel ) );
+ }
}
+
void SwWW8ImplReader::Read_Symbol(sal_uInt16, const sal_uInt8* pData, short nLen )
{
if( !bIgnoreText )
diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx
index fa91bae..1f44928 100644
--- a/sw/source/filter/xml/swxml.cxx
+++ b/sw/source/filter/xml/swxml.cxx
@@ -386,7 +386,7 @@ sal_Int32 ReadThroughComponent(
return ERR_SWG_READ_ERROR;
}
-// --> OD 2005-09-06 #i44177#
+
void lcl_AdjustOutlineStylesForOOo( SwDoc& _rDoc )
{
// array containing the names of the default outline styles ('Heading 1',
@@ -445,18 +445,15 @@ void lcl_AdjustOutlineStylesForOOo( SwDoc& _rDoc )
const SwNumRule* pOutlineRule = _rDoc.GetOutlineNumRule();
for ( sal_uInt8 i = 0; i < MAXLEVEL; ++i )
{
- // --> OD 2007-01-11 #i73361#
+ // #i73361#
// Do not change assignment of already created default outline style
// to a certain outline level.
-// if ( aCreatedDefaultOutlineStyles[ i ] != 0 && !aOutlineLevelAssigned[ i ] )
if ( !aOutlineLevelAssigned[ i ] &&
aCreatedDefaultOutlineStyles[ i ] != 0 &&
! aCreatedDefaultOutlineStyles[ i ]->IsAssignedToListLevelOfOutlineStyle() )
- // <--
{
// apply outline level at created default outline style
- //aCreatedDefaultOutlineStyles[ i ]->SetOutlineLevel( i );
- aCreatedDefaultOutlineStyles[ i ]->AssignToListLevelOfOutlineStyle(i);//#outline level added by zhaojianwei
+ aCreatedDefaultOutlineStyles[i]->AssignToListLevelOfOutlineStyle( i ); //#outline level added by zhaojianwei
// apply outline numbering rule, if none is set.
const SfxPoolItem& rItem =
@@ -470,9 +467,8 @@ void lcl_AdjustOutlineStylesForOOo( SwDoc& _rDoc )
}
}
-// <--
-// --> OD 2006-02-22 #b6382898#
+
void lcl_ConvertSdrOle2ObjsToSdrGrafObjs( SwDoc& _rDoc )
{
if ( _rDoc.GetDrawModel() &&
@@ -510,7 +506,6 @@ void lcl_ConvertSdrOle2ObjsToSdrGrafObjs( SwDoc& _rDoc )
}
}
}
-// <--
sal_uLong XMLReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPaM, const String & rName )
commit 5910f43232e85b52edf73dced0387c70b64347e5
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date: Fri Jun 27 12:27:55 2014 +0000
78498: Do not keep OutlineLevel attribute at paragraph when a Paragraph Style is assigned.
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 01375e3..929ba55 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1310,7 +1310,7 @@ public:
sal_Bool bBroadcast = sal_False);
void DelTxtFmtColl(sal_uInt16 nFmt, sal_Bool bBroadcast = sal_False);
void DelTxtFmtColl( SwTxtFmtColl* pColl, sal_Bool bBroadcast = sal_False );
- // --> OD 2007-11-06 #i62675#
+
// Add 4th optional parameter <bResetListAttrs>.
// 'side effect' of <SetTxtFmtColl> with <bReset = true> is that the hard
// attributes of the affected text nodes are cleared, except the break
@@ -1318,10 +1318,12 @@ public:
// The new parameter <bResetListAttrs> indicates, if the list attributes
// (list style, restart at and restart with) are cleared as well in case
// that <bReset = true> and the paragraph style has a list style attribute set.
- sal_Bool SetTxtFmtColl( const SwPaM &rRg, SwTxtFmtColl *pFmt,
- bool bReset = true,
- bool bResetListAttrs = false );
- // <--
+ sal_Bool SetTxtFmtColl(
+ const SwPaM &rRg,
+ SwTxtFmtColl *pFmt,
+ const bool bReset = true,
+ const bool bResetListAttrs = false );
+
SwTxtFmtColl* FindTxtFmtCollByName( const String& rName ) const
{ return (SwTxtFmtColl*)FindFmtByName( (SvPtrarr&)*pTxtFmtCollTbl, rName ); }
diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx
index bbb2b8f..2396391 100644
--- a/sw/inc/editsh.hxx
+++ b/sw/inc/editsh.hxx
@@ -303,11 +303,11 @@ public:
sal_uInt16 GetTxtFmtCollCount() const;
SwTxtFmtColl& GetTxtFmtColl( sal_uInt16 nTxtFmtColl) const;
SwTxtFmtColl* GetCurTxtFmtColl() const;
- // --> OD 2007-11-06 #i62675#
+
// Add 2nd optional parameter <bResetListAttrs> - see also <SwDoc::SetTxtFmtColl(..)>
void SetTxtFmtColl( SwTxtFmtColl*,
- bool bResetListAttrs = false );
- // <--
+ const bool bResetListAttrs = false );
+
SwTxtFmtColl *MakeTxtFmtColl(const String &rFmtCollName,
SwTxtFmtColl *pDerivedFrom = 0);
void FillByEx(SwTxtFmtColl*, sal_Bool bReset = sal_False);
diff --git a/sw/inc/fmtcol.hxx b/sw/inc/fmtcol.hxx
index f25e9e6..a27a0b5 100644
--- a/sw/inc/fmtcol.hxx
+++ b/sw/inc/fmtcol.hxx
@@ -69,29 +69,31 @@ protected:
SwTxtFmtColl *pNextTxtFmtColl;
- SwTxtFmtColl( SwAttrPool& rPool, const sal_Char* pFmtCollName,
- SwTxtFmtColl* pDerFrom = 0,
- sal_uInt16 nFmtWh = RES_TXTFMTCOLL )
- : SwFmtColl( rPool, pFmtCollName, aTxtFmtCollSetRange,
- pDerFrom, nFmtWh ),
- // --> OD 2007-01-24 #i73790#
- mbStayAssignedToListLevelOfOutlineStyle( false ),
- // <--
- //nOutlineLevel( NO_NUMBERING ) //<-#outline level,removed by zhaojianwei
- mbAssignedToOutlineStyle(false) //<-#outline level,added by zhaojianwei
- { pNextTxtFmtColl = this; }
-
- SwTxtFmtColl( SwAttrPool& rPool, const String &rFmtCollName,
- SwTxtFmtColl* pDerFrom = 0,
- sal_uInt16 nFmtWh = RES_TXTFMTCOLL )
- : SwFmtColl( rPool, rFmtCollName, aTxtFmtCollSetRange,
- pDerFrom, nFmtWh ),
- // --> OD 2007-01-24 #i73790#
- mbStayAssignedToListLevelOfOutlineStyle( false ),
- // <--
- //nOutlineLevel( NO_NUMBERING ) //<-#outline level,removed by zhaojianwei
- mbAssignedToOutlineStyle(false) //<-#outline level,added by zhaojianwei
- { pNextTxtFmtColl = this; }
+ SwTxtFmtColl(
+ SwAttrPool& rPool,
+ const sal_Char* pFmtCollName,
+ SwTxtFmtColl* pDerFrom = 0,
+ sal_uInt16 nFmtWh = RES_TXTFMTCOLL )
+ : SwFmtColl( rPool, pFmtCollName, aTxtFmtCollSetRange
+ , pDerFrom, nFmtWh )
+ , mbStayAssignedToListLevelOfOutlineStyle( false )
+ , mbAssignedToOutlineStyle( false )
+ {
+ pNextTxtFmtColl = this;
+ }
+
+ SwTxtFmtColl(
+ SwAttrPool& rPool,
+ const String &rFmtCollName,
+ SwTxtFmtColl* pDerFrom = 0,
+ sal_uInt16 nFmtWh = RES_TXTFMTCOLL )
+ : SwFmtColl( rPool, rFmtCollName, aTxtFmtCollSetRange
+ , pDerFrom, nFmtWh )
+ , mbStayAssignedToListLevelOfOutlineStyle( false )
+ , mbAssignedToOutlineStyle( false )
+ {
+ pNextTxtFmtColl = this;
+ }
// zum "abfischen" von UL-/LR-/FontHeight Aenderungen
virtual void Modify( const SfxPoolItem*, const SfxPoolItem* );
@@ -105,29 +107,30 @@ public:
sal_Bool IsAtDocNodeSet() const;
- // --> OD 2006-11-22 #i71574#
- //<-#outline level,zhaojianwei
void SetAttrOutlineLevel( int );
- int GetAttrOutlineLevel() const;
- int GetAssignedOutlineStyleLevel() const;
+ int GetAttrOutlineLevel() const;
+
+ // Return the list level of the Outline Style - the List Style for the outline numbering -
+ // to which the Paragraph Style is assigned.
+ int GetAssignedOutlineStyleLevel() const;
+
inline bool IsAssignedToListLevelOfOutlineStyle() const
{
return mbAssignedToOutlineStyle;
}
+
+ // If a Paragraph Style is assigned to list level N of the Outline Style,
+ // then its outline level - AttrOutlineLevel - is set to N+1
void AssignToListLevelOfOutlineStyle(const int nAssignedListLevel);
- void DeleteAssignmentToListLevelOfOutlineStyle();
- //<-end
- // <--
- // --> OD 2008-03-04 #refactorlists#
+ void DeleteAssignmentToListLevelOfOutlineStyle( const bool bResetOutlineLevel = true );
+
// override to recognize changes on the <SwNumRuleItem> and register/unregister
// the paragragh style at the corresponding <SwNumRule> instance
virtual sal_Bool SetFmtAttr( const SfxPoolItem& rAttr );
virtual sal_Bool SetFmtAttr( const SfxItemSet& rSet );
virtual sal_Bool ResetFmtAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 = 0 );
- // <--
- // --> OD 2007-01-24 #i73790#
// override <ResetAllFmtAttr()> to stay assigned to list level of outline style
virtual sal_uInt16 ResetAllFmtAttr();
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index 4559498..6519f6f 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -600,7 +600,7 @@ public:
@return outline level or NO_NUMBERING if there is no outline level
*/
- int GetAttrOutlineLevel() const;//#OutlineLevel,added by zhaojianwei
+ int GetAttrOutlineLevel() const;
/**
Sets the out line level *at* a text node.
@@ -615,14 +615,12 @@ public:
NOTE: This is subject to change, see GetOutlineLevel.
*/
- //void SetOutlineLevel(int nLevel);
- void SetAttrOutlineLevel(int nLevel);//#OutlineLevel,added by zhaojianwei
+ void SetAttrOutlineLevel(int nLevel);
- // --> OD 2008-11-19 #i70748#
bool IsEmptyListStyleDueToSetOutlineLevelAttr();
void SetEmptyListStyleDueToSetOutlineLevelAttr();
void ResetEmptyListStyleDueToResetOutlineLevelAttr();
- // <--
+
/**
Returns the width of leading tabs/blanks in this paragraph.
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index 2a8e6a7..456d9d1 100644
--- a/sw/source/core/attr/format.cxx
+++ b/sw/source/core/attr/format.cxx
@@ -548,12 +548,10 @@ sal_Bool SwFmt::SetFmtAttr(const SfxPoolItem& rAttr )
{
if( 0 != ( bRet = (0 != aSet.Put( rAttr ))) )
aSet.SetModifyAtAttr( this );
- // --> OD 2006-11-22 #i71574#
if ( nFmtWhich == RES_TXTFMTCOLL && rAttr.Which() == RES_PARATR_NUMRULE )
{
TxtFmtCollFunc::CheckTxtFmtCollForDeletionOfAssignmentToOutlineStyle( this );
}
- // <--
}
else
{
@@ -656,12 +654,10 @@ sal_Bool SwFmt::SetFmtAttr( const SfxItemSet& rSet )
{
if( 0 != ( bRet = (0 != aSet.Put( aTempSet ))) )
aSet.SetModifyAtAttr( this );
- // --> OD 2006-11-22 #i71574#
if ( nFmtWhich == RES_TXTFMTCOLL )
{
TxtFmtCollFunc::CheckTxtFmtCollForDeletionOfAssignmentToOutlineStyle( this );
}
- // <--
}
else
{
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index d7f2dbd..20950c0 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -116,14 +116,10 @@ struct ParaRstFmt
const SfxItemSet* pDelSet;
sal_uInt16 nWhich;
bool bReset;
- // --> OD 2007-11-06 #i62575#
bool bResetListAttrs;
- // <--
bool bResetAll;
bool bInclRefToxMark;
- bool bKeepOutlineLevelAttr; //#outline level,add by zhaojianwei
-
ParaRstFmt( const SwPosition* pStt, const SwPosition* pEnd,
SwHistory* pHst, sal_uInt16 nWhch = 0, const SfxItemSet* pSet = 0 )
: pFmtColl(0),
@@ -132,14 +128,12 @@ struct ParaRstFmt
pEndNd(pEnd),
pDelSet(pSet),
nWhich(nWhch),
- // --> OD 2007-11-06 #i62675#
bReset( false ),
bResetListAttrs( false ),
- // <--
bResetAll( true ),
- bInclRefToxMark( false ),
- bKeepOutlineLevelAttr( false ) //#outline level,add by zhaojianwei
- {}
+ bInclRefToxMark( false )
+ {
+ }
ParaRstFmt( SwHistory* pHst )
: pFmtColl(0),
@@ -148,14 +142,12 @@ struct ParaRstFmt
pEndNd(0),
pDelSet(0),
nWhich(0),
- // --> OD 2007-11-06 #i62675#
bReset( false ),
bResetListAttrs( false ),
- // <--
bResetAll( true ),
- bInclRefToxMark( false ),
- bKeepOutlineLevelAttr( false ) //#outline level,add by zhaojianwei
- {}
+ bInclRefToxMark( false )
+ {
+ }
};
/* in pArgs steht die ChrFmtTablle vom Dokument
@@ -197,8 +189,8 @@ sal_Bool lcl_RstTxtAttr( const SwNodePtr& rpNd, void* pArgs )
sal_Bool lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs )
{
- ParaRstFmt* pPara = (ParaRstFmt*)pArgs;
- SwCntntNode* pNode = (SwCntntNode*)rpNd->GetCntntNode();
+ const ParaRstFmt* pPara = (ParaRstFmt*) pArgs;
+ SwCntntNode* pNode = (SwCntntNode*) rpNd->GetCntntNode();
if( pNode && pNode->HasSwAttrSet() )
{
const sal_Bool bLocked = pNode->IsModifyLocked();
@@ -206,31 +198,24 @@ sal_Bool lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs )
SwDoc* pDoc = pNode->GetDoc();
- // --> OD 2008-04-14 #refactorlists#
- // remove unused attribute RES_LR_SPACE
- // add list attributes
- SfxItemSet aSet( pDoc->GetAttrPool(),
- RES_PAGEDESC, RES_BREAK,
- RES_PARATR_NUMRULE, RES_PARATR_NUMRULE,
- RES_PARATR_OUTLINELEVEL,RES_PARATR_OUTLINELEVEL,//#outline level,removed by zhaojianwei
- RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END - 1,
- 0 );
- const SfxItemSet* pSet = pNode->GetpSwAttrSet();
-
- // --> OD 2008-04-15 #refactorlists#
-// std::vector<sal_uInt16> aClearWhichIds;
+ SfxItemSet aSavedAttrsSet(
+ pDoc->GetAttrPool(),
+ RES_PAGEDESC, RES_BREAK,
+ RES_PARATR_NUMRULE, RES_PARATR_NUMRULE,
+ RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END - 1,
+ 0 );
+ const SfxItemSet* pAttrSetOfNode = pNode->GetpSwAttrSet();
+
SvUShorts aClearWhichIds;
- // <--
- // --> OD 2008-04-15 #refactorlists#
// restoring all paragraph list attributes
{
SfxItemSet aListAttrSet( pDoc->GetAttrPool(),
RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END - 1,
0 );
- aListAttrSet.Set( *pSet );
+ aListAttrSet.Set( *pAttrSetOfNode );
if ( aListAttrSet.Count() )
{
- aSet.Put( aListAttrSet );
+ aSavedAttrsSet.Put( aListAttrSet );
SfxItemIter aIter( aListAttrSet );
const SfxPoolItem* pItem = aIter.GetCurItem();
while( pItem )
@@ -240,94 +225,72 @@ sal_Bool lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs )
}
}
}
- // <--
const SfxPoolItem* pItem;
- // sal_uInt16 __READONLY_DATA aSavIds[ 3 ] = { RES_PAGEDESC, RES_BREAK, //#outline level,removed by zhaojianwei
- // RES_PARATR_NUMRULE };
- //for( sal_uInt16 n = 0; n < 3; ++n )
- sal_uInt16 __READONLY_DATA aSavIds[ 4 ] = { RES_PAGEDESC, RES_BREAK, //->add by zhaojianwei
- RES_PARATR_NUMRULE,
- RES_PARATR_OUTLINELEVEL };
- for( sal_uInt16 n = 0; n < 4; ++n ) //<-end,zhaojianwei
- {
- if( SFX_ITEM_SET == pSet->GetItemState( aSavIds[ n ], sal_False, &pItem ))
+ sal_uInt16 __READONLY_DATA aSavIds[3] =
+ { RES_PAGEDESC, RES_BREAK, RES_PARATR_NUMRULE };
+ for ( sal_uInt16 n = 0; n < 3; ++n )
+ {
+ if ( SFX_ITEM_SET == pAttrSetOfNode->GetItemState( aSavIds[n], sal_False, &pItem ) )
{
bool bSave = false;
- switch( aSavIds[ n ] )
+ switch (aSavIds[n])
{
- case RES_PAGEDESC:
- bSave = 0 != ((SwFmtPageDesc*)pItem)->GetPageDesc();
+ case RES_PAGEDESC:
+ bSave = 0 != ( (SwFmtPageDesc*) pItem )->GetPageDesc();
break;
- case RES_BREAK:
- bSave = SVX_BREAK_NONE != ((SvxFmtBreakItem*)pItem)->GetBreak();
+ case RES_BREAK:
+ bSave = SVX_BREAK_NONE != ( (SvxFmtBreakItem*) pItem )->GetBreak();
break;
- case RES_PARATR_NUMRULE:
- {
- bSave = 0 != ((SwNumRuleItem*)pItem)->GetValue().Len();
- }
+ case RES_PARATR_NUMRULE:
+ bSave = 0 != ( (SwNumRuleItem*) pItem )->GetValue().Len();
break;
- case RES_PARATR_OUTLINELEVEL: //#outline level,add by zhaojianwei
- {
- bSave = pPara && pPara->bKeepOutlineLevelAttr;
- }
- break; //<-end,zhaojianwei
}
- if( bSave )
+ if ( bSave )
{
- aSet.Put( *pItem );
- // --> OD 2008-04-15 #refactorlists#
-// aClearWhichIds.push_back( aSavIds[n] );
+ aSavedAttrsSet.Put( *pItem );
aClearWhichIds.Insert( aSavIds[n], aClearWhichIds.Count() );
}
}
}
- // --> OD 2008-04-14 #refactorlists#
// do not clear items directly from item set and only clear to be kept
// attributes, if no deletion item set is found.
-// pNode->ClearItemsFromAttrSet( aClearWhichIds );
const bool bKeepAttributes =
!pPara || !pPara->pDelSet || pPara->pDelSet->Count() == 0;
if ( bKeepAttributes )
{
pNode->ResetAttr( aClearWhichIds );
}
- // <--
if( !bLocked )
pNode->UnlockModify();
- if( pPara )
+ if ( pPara )
{
SwRegHistory aRegH( pNode, *pNode, pPara->pHistory );
- if( pPara->pDelSet && pPara->pDelSet->Count() )
+ if ( pPara->pDelSet && pPara->pDelSet->Count() )
{
- // --> OD 2008-04-15 #refactorlists#
ASSERT( !bKeepAttributes,
"<lcl_RstAttr(..)> - certain attributes are kept, but not needed. -> please inform OD" );
- // <--
SfxItemIter aIter( *pPara->pDelSet );
pItem = aIter.FirstItem();
- while( sal_True )
+ while ( sal_True )
{
- // --> OD 2008-04-14 #refactorlists#
- //
if ( ( pItem->Which() != RES_PAGEDESC &&
pItem->Which() != RES_BREAK &&
pItem->Which() != RES_PARATR_NUMRULE ) ||
- ( aSet.GetItemState( pItem->Which(), sal_False ) != SFX_ITEM_SET ) )
+ ( aSavedAttrsSet.GetItemState( pItem->Which(), sal_False ) != SFX_ITEM_SET ) )
{
pNode->ResetAttr( pItem->Which() );
}
- // <--
- if( aIter.IsAtEnd() )
+ if ( aIter.IsAtEnd() )
break;
pItem = aIter.NextItem();
}
}
- else if( pPara->bResetAll )
+ else if ( pPara->bResetAll )
pNode->ResetAllAttr();
else
pNode->ResetAttr( RES_PARATR_BEGIN, POOLATTR_END - 1 );
@@ -335,22 +298,21 @@ sal_Bool lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs )
else
pNode->ResetAllAttr();
- // --> OD 2008-04-15 #refactorlists#
// only restore saved attributes, if needed
- if ( bKeepAttributes && aSet.Count() )
- // <--
+ if ( bKeepAttributes && aSavedAttrsSet.Count() )
{
pNode->LockModify();
- pNode->SetAttr( aSet );
+ pNode->SetAttr( aSavedAttrsSet );
- if( !bLocked )
+ if ( !bLocked )
pNode->UnlockModify();
}
}
return sal_True;
}
+
void SwDoc::RstTxtAttrs(const SwPaM &rRg, sal_Bool bInclRefToxMark )
{
SwHistory* pHst = 0;
@@ -1746,23 +1708,17 @@ void SwDoc::DelTxtFmtColl( SwTxtFmtColl *pColl, sal_Bool bBroadcast )
sal_Bool lcl_SetTxtFmtColl( const SwNodePtr& rpNode, void* pArgs )
{
- // ParaSetFmtColl * pPara = (ParaSetFmtColl*)pArgs;
- SwCntntNode* pCNd = (SwCntntNode*)rpNode->GetTxtNode();
- if( pCNd )
+ SwCntntNode* pCNd = (SwCntntNode*) rpNode->GetTxtNode();
+ if ( pCNd )
{
- ParaRstFmt* pPara = (ParaRstFmt*)pArgs;
+ ParaRstFmt* pPara = (ParaRstFmt*) pArgs;
- SwTxtFmtColl* pFmt = static_cast<SwTxtFmtColl*>(pPara->pFmtColl);
+ SwTxtFmtColl* pFmt = static_cast< SwTxtFmtColl* >( pPara->pFmtColl );
if ( pPara->bReset )
{
- if( pFmt->GetAttrOutlineLevel() == 0 && pPara )
- pPara->bKeepOutlineLevelAttr = true;
-
lcl_RstAttr( pCNd, pPara );
- // --> OD 2007-11-06 #i62675#
- // --> OD 2008-04-15 #refactorlists#
// check, if paragraph style has changed
if ( pPara->bResetListAttrs &&
pFmt != pCNd->GetFmtColl() &&
@@ -1790,7 +1746,6 @@ sal_Bool lcl_SetTxtFmtColl( const SwNodePtr& rpNode, void* pArgs )
if ( bChangeOfListStyleAtParagraph )
{
- // --> OD 2008-04-08 #refactorlists#
std::auto_ptr< SwRegHistory > pRegH;
if ( pPara->pHistory )
{
@@ -1806,9 +1761,7 @@ sal_Bool lcl_SetTxtFmtColl( const SwNodePtr& rpNode, void* pArgs )
pCNd->ResetAttr( RES_PARATR_LIST_ISCOUNTED );
pCNd->ResetAttr( RES_PARATR_LIST_ID );
}
- // <--
}
- // <--
}
// erst in die History aufnehmen, damit ggfs. alte Daten
@@ -1824,10 +1777,12 @@ sal_Bool lcl_SetTxtFmtColl( const SwNodePtr& rpNode, void* pArgs )
return sal_True;
}
-sal_Bool SwDoc::SetTxtFmtColl( const SwPaM &rRg,
- SwTxtFmtColl *pFmt,
- bool bReset,
- bool bResetListAttrs )
+
+sal_Bool SwDoc::SetTxtFmtColl(
+ const SwPaM &rRg,
+ SwTxtFmtColl *pFmt,
+ const bool bReset,
+ const bool bResetListAttrs )
{
SwDataChanged aTmp( rRg, 0 );
const SwPosition *pStt = rRg.Start(), *pEnd = rRg.End();
@@ -1836,11 +1791,9 @@ sal_Bool SwDoc::SetTxtFmtColl( const SwPaM &rRg,
if (GetIDocumentUndoRedo().DoesUndo())
{
- // --> OD 2008-04-15 #refactorlists#
SwUndoFmtColl* pUndo = new SwUndoFmtColl( rRg, pFmt,
bReset,
bResetListAttrs );
- // <--
pHst = pUndo->GetHistory();
GetIDocumentUndoRedo().AppendUndo(pUndo);
}
@@ -1848,17 +1801,18 @@ sal_Bool SwDoc::SetTxtFmtColl( const SwPaM &rRg,
ParaRstFmt aPara( pStt, pEnd, pHst );
aPara.pFmtColl = pFmt;
aPara.bReset = bReset;
- // --> OD 2007-11-06 #i62675#
aPara.bResetListAttrs = bResetListAttrs;
- // <--
GetNodes().ForEach( pStt->nNode.GetIndex(), pEnd->nNode.GetIndex()+1,
lcl_SetTxtFmtColl, &aPara );
- if( !aPara.nWhich )
+ if ( !aPara.nWhich )
bRet = sal_False; // keinen gueltigen Node gefunden
- if( bRet )
+ if ( bRet )
+ {
SetModified();
+ }
+
return bRet;
}
@@ -1954,11 +1908,9 @@ SwTxtFmtColl* SwDoc::CopyTxtColl( const SwTxtFmtColl& rColl )
pNewColl->CopyAttrs( rColl, sal_True );
// setze noch den Outline-Level
- //if( NO_NUMBERING != rColl.GetOutlineLevel() ) //#outline level,zhaojianwei
- // pNewColl->SetOutlineLevel( rColl.GetOutlineLevel() );
- if(rColl.IsAssignedToListLevelOfOutlineStyle())
- pNewColl->AssignToListLevelOfOutlineStyle(rColl.GetAssignedOutlineStyleLevel());//<-end,zhaojianwei
- //<-end
+ if ( rColl.IsAssignedToListLevelOfOutlineStyle() )
+ pNewColl->AssignToListLevelOfOutlineStyle( rColl.GetAssignedOutlineStyleLevel() );
+
pNewColl->SetPoolFmtId( rColl.GetPoolFmtId() );
pNewColl->SetPoolHelpId( rColl.GetPoolHelpId() );
@@ -2111,11 +2063,8 @@ void SwDoc::CopyFmtArr( const SvPtrarr& rSourceArr,
rDestArr, pSrcColl->GetNextTxtFmtColl().GetName() ) );
// setze noch den Outline-Level
- //if( NO_NUMBERING != pSrcColl->GetOutlineLevel() ) //#outline level,zhaojianwei
- // pDstColl->SetOutlineLevel( pSrcColl->GetOutlineLevel() );
if(pSrcColl->IsAssignedToListLevelOfOutlineStyle())
- pDstColl->AssignToListLevelOfOutlineStyle(pSrcColl->GetAssignedOutlineStyleLevel());//<-end,zhaojianwei
- //<-end
+ pDstColl->AssignToListLevelOfOutlineStyle(pSrcColl->GetAssignedOutlineStyleLevel());
//FEATURE::CONDCOLL
if( RES_CONDTXTFMTCOLL == pSrc->Which() )
diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx
index 1d2cd54..e739251 100644
--- a/sw/source/core/doc/docglbl.cxx
+++ b/sw/source/core/doc/docglbl.cxx
@@ -125,8 +125,7 @@ sal_Bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath,
{
// wenn keine OutlineNumerierung ist, dann benutze eigenes Array
// und sammel die Nodes zusammen.
- //if( NO_NUMBERING == pSplitColl->GetOutlineLevel() )//#outline level,zhaojianwei
- if( pSplitColl->GetAttrOutlineLevel() == 0 )//<-end,zhaojianwei, 0814
+ if( pSplitColl->GetAttrOutlineLevel() == 0 )
{
pOutlNds = new SwOutlineNodes( 8, 8 );
SwIterator<SwTxtNode,SwFmtColl> aIter( *pSplitColl );
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index e1275cb..0bdb4e0 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -1536,24 +1536,24 @@ void SwTOXBaseSection::UpdateCntnt( SwTOXElement eMyType,
TOX_OBJECTS != SwTOXBase::GetType() )
{
const SwTxtNode* pOutlNd = ::lcl_FindChapterNode( *pCNd,
- MAXLEVEL - 1 );
- if( pOutlNd )
+ MAXLEVEL - 1 );
+ if ( pOutlNd )
{
- //sal_uInt16 nTmp = pOutlNd->GetTxtColl()->GetOutlineLevel();//#outline level,zhaojianwei
- //if( nTmp < NO_NUMBERING )
- // nSetLevel = nTmp + 1;
- if( pOutlNd->GetTxtColl()->IsAssignedToListLevelOfOutlineStyle())
- nSetLevel = pOutlNd->GetTxtColl()->GetAttrOutlineLevel() ;//<-end,zhaojianwei
+ if ( pOutlNd->GetTxtColl()->IsAssignedToListLevelOfOutlineStyle() )
+ {
+ nSetLevel = pOutlNd->GetTxtColl()->GetAttrOutlineLevel();
+ }
}
}
- if( pCNd->getLayoutFrm( pDoc->GetCurrentLayout() ) && ( !IsFromChapter() ||
- ::lcl_FindChapterNode( *pCNd, 0 ) == pOwnChapterNode ))
+ if ( pCNd->getLayoutFrm( pDoc->GetCurrentLayout() ) && ( !IsFromChapter() ||
+ ::lcl_FindChapterNode( *pCNd, 0 ) == pOwnChapterNode ) )
{
- SwTOXPara * pNew = new SwTOXPara( *pCNd, eMyType,
- ( USHRT_MAX != nSetLevel )
- ? static_cast<sal_uInt16>(nSetLevel)
- : FORM_ALPHA_DELIMITTER );
+ SwTOXPara * pNew =
+ new SwTOXPara(
+ *pCNd,
+ eMyType,
+ ( USHRT_MAX != nSetLevel ) ? static_cast< sal_uInt16 >( nSetLevel ) : FORM_ALPHA_DELIMITTER );
InsertSorted( pNew );
}
}
@@ -1585,30 +1585,27 @@ void SwTOXBaseSection::UpdateTable( const SwTxtNode* pOwnChapterNode )
SwNodeIndex aCntntIdx( *pTblNd, 1 );
SwCntntNode* pCNd;
- while( 0 != ( pCNd = rNds.GoNext( &aCntntIdx ) ) &&
- aCntntIdx.GetIndex() < pTblNd->EndOfSectionIndex() )
+ while (0 != ( pCNd = rNds.GoNext( &aCntntIdx ) ) &&
+ aCntntIdx.GetIndex() < pTblNd->EndOfSectionIndex())
{
- if( pCNd->getLayoutFrm( pDoc->GetCurrentLayout() ) && (!IsFromChapter() ||
- ::lcl_FindChapterNode( *pCNd, 0 ) == pOwnChapterNode ))
+ if ( pCNd->getLayoutFrm( pDoc->GetCurrentLayout() )
+ && ( !IsFromChapter()
+ || ::lcl_FindChapterNode( *pCNd, 0 ) == pOwnChapterNode ) )
{
SwTOXTable * pNew = new SwTOXTable( *pCNd );
- if( IsLevelFromChapter() && TOX_TABLES != SwTOXBase::GetType())
+ if ( IsLevelFromChapter() && TOX_TABLES != SwTOXBase::GetType() )
{
- const SwTxtNode* pOutlNd =
- ::lcl_FindChapterNode( *pCNd, MAXLEVEL - 1 );
- if( pOutlNd )
+ const SwTxtNode* pOutlNd = ::lcl_FindChapterNode( *pCNd, MAXLEVEL - 1 );
+ if ( pOutlNd )
{
- //sal_uInt16 nTmp = pOutlNd->GetTxtColl()->GetOutlineLevel();//#outline level,zhaojianwei
- //if( nTmp < NO_NUMBERING )
- // pNew->SetLevel( nTmp + 1 );
- if( pOutlNd->GetTxtColl()->IsAssignedToListLevelOfOutlineStyle())
+ if ( pOutlNd->GetTxtColl()->IsAssignedToListLevelOfOutlineStyle() )
{
const int nTmp = pOutlNd->GetTxtColl()->GetAttrOutlineLevel();
- pNew->SetLevel( static_cast<sal_uInt16>(nTmp) );//<-end ,zhaojianwei
+ pNew->SetLevel( static_cast< sal_uInt16 >( nTmp ) );
}
}
}
- InsertSorted(pNew);
+ InsertSorted( pNew );
break;
}
}
diff --git a/sw/source/core/doc/fmtcol.cxx b/sw/source/core/doc/fmtcol.cxx
index 76855b3..c90ca77 100644
--- a/sw/source/core/doc/fmtcol.cxx
+++ b/sw/source/core/doc/fmtcol.cxx
@@ -65,17 +65,14 @@ namespace TxtFmtCollFunc
return;
}
- // --> OD 2007-01-24 #i73790#
- // if ( pTxtFmtColl->AssignedToListLevelOfOutlineStyle() )
- if ( !pTxtFmtColl->StayAssignedToListLevelOfOutlineStyle() &&
- pTxtFmtColl->IsAssignedToListLevelOfOutlineStyle() )
- // <--
+ if ( !pTxtFmtColl->StayAssignedToListLevelOfOutlineStyle()
+ && pTxtFmtColl->IsAssignedToListLevelOfOutlineStyle() )
{
- if ( !pNewNumRuleItem )
+ if ( pNewNumRuleItem == NULL )
{
pTxtFmtColl->GetItemState( RES_PARATR_NUMRULE, sal_False, (const SfxPoolItem**)&pNewNumRuleItem );
}
- if ( pNewNumRuleItem )
+ if ( pNewNumRuleItem != NULL )
{
String sNumRuleName = pNewNumRuleItem->GetValue();
if ( sNumRuleName.Len() == 0 ||
@@ -87,7 +84,7 @@ namespace TxtFmtCollFunc
}
}
}
- // <--
+
SwNumRule* GetNumRule( SwTxtFmtColl& rTxtFmtColl )
{
@@ -212,7 +209,6 @@ void SwTxtFmtColl::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
case RES_CHRATR_CTL_FONTSIZE:
aFontSizeArr[2] = (SvxFontHeightItem*)pNew;
break;
- // --> OD 2006-10-17 #i70223#
case RES_PARATR_NUMRULE:
{
if ( bAssignedToListLevelOfOutlineStyle )
@@ -220,17 +216,16 @@ void SwTxtFmtColl::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
pNewNumRuleItem = (SwNumRuleItem*)pNew;
}
}
+ break;
default:
break;
}
- // --> OD 2006-10-17 #i70223#
- if ( bAssignedToListLevelOfOutlineStyle && pNewNumRuleItem )
+ if ( bAssignedToListLevelOfOutlineStyle
+ && pNewNumRuleItem != NULL )
{
- TxtFmtCollFunc::CheckTxtFmtCollForDeletionOfAssignmentToOutlineStyle(
- this, pNewNumRuleItem );
+ TxtFmtCollFunc::CheckTxtFmtCollForDeletionOfAssignmentToOutlineStyle( this, pNewNumRuleItem );
}
- // <--
int bWeiter = sal_True;
@@ -416,28 +411,24 @@ sal_Bool SwTxtFmtColl::ResetFmtAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 )
}
// <--
-// --> OD 2007-01-24 #i73790#
+
sal_uInt16 SwTxtFmtColl::ResetAllFmtAttr()
{
const bool bOldState( mbStayAssignedToListLevelOfOutlineStyle );
mbStayAssignedToListLevelOfOutlineStyle = true;
- // --> OD 2008-12-16 #i70748#
// Outline level is no longer a member, it is a attribute now.
// Thus, it needs to be restored, if the paragraph style is assigned
// to the outline style
const int nAssignedOutlineStyleLevel = IsAssignedToListLevelOfOutlineStyle()
? GetAssignedOutlineStyleLevel()
: -1;
- // <--
sal_uInt16 nRet = SwFmtColl::ResetAllFmtAttr();
- // --> OD 2008-12-16 #i70748#
if ( nAssignedOutlineStyleLevel != -1 )
{
AssignToListLevelOfOutlineStyle( nAssignedOutlineStyleLevel );
}
- // <--
mbStayAssignedToListLevelOfOutlineStyle = bOldState;
@@ -654,7 +645,9 @@ void SwConditionTxtFmtColl::SetConditions( const SwFmtCollConditions& rCndClls )
aCondColls.Insert( pNew, n );
}
}
-//#outline level, zhaojianwei
+//FEATURE::CONDCOLL
+
+
void SwTxtFmtColl::SetAttrOutlineLevel( int nLevel)
{
ASSERT( 0 <= nLevel && nLevel <= MAXLEVEL ,"SwTxtFmtColl: Level Out Of Range" );
@@ -662,24 +655,26 @@ void SwTxtFmtColl::SetAttrOutlineLevel( int nLevel)
static_cast<sal_uInt16>(nLevel) ) );
}
+
int SwTxtFmtColl::GetAttrOutlineLevel() const
{
- return ((const SfxUInt16Item &)GetFmtAttr(RES_PARATR_OUTLINELEVEL)).GetValue();
+ return ( (const SfxUInt16Item &) GetFmtAttr( RES_PARATR_OUTLINELEVEL ) ).GetValue();
}
+
int SwTxtFmtColl::GetAssignedOutlineStyleLevel() const
{
ASSERT( IsAssignedToListLevelOfOutlineStyle(),
- "<SwTxtFmtColl::GetAssignedOutlineStyleLevel()> - misuse of method");
+ "<SwTxtFmtColl::GetAssignedOutlineStyleLevel()> - misuse of method" );
return GetAttrOutlineLevel() - 1;
}
+
void SwTxtFmtColl::AssignToListLevelOfOutlineStyle(const int nAssignedListLevel)
{
mbAssignedToOutlineStyle = true;
- SetAttrOutlineLevel(nAssignedListLevel+1);
+ SetAttrOutlineLevel( nAssignedListLevel + 1 );
- // --> OD 2009-03-18 #i100277#
SwIterator<SwTxtFmtColl,SwFmtColl> aIter( *this );
SwTxtFmtColl* pDerivedTxtFmtColl = aIter.First();
while ( pDerivedTxtFmtColl != 0 )
@@ -699,14 +694,16 @@ void SwTxtFmtColl::AssignToListLevelOfOutlineStyle(const int nAssignedListLevel)
pDerivedTxtFmtColl = aIter.Next();
}
- // <--
}
-void SwTxtFmtColl::DeleteAssignmentToListLevelOfOutlineStyle()
+
+void SwTxtFmtColl::DeleteAssignmentToListLevelOfOutlineStyle(
+ const bool bResetOutlineLevel )
{
mbAssignedToOutlineStyle = false;
- ResetFmtAttr(RES_PARATR_OUTLINELEVEL);
+ if ( bResetOutlineLevel )
+ {
+ ResetFmtAttr( RES_PARATR_OUTLINELEVEL );
+ }
}
-//<-end,zhaojianwei
-//FEATURE::CONDCOLL
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 85af11a..df23a38 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -66,7 +66,7 @@ SwTxtFmtColl& SwEditShell::GetTxtFmtColl( sal_uInt16 nFmtColl) const
// --> OD 2007-11-06 #i62675#
void SwEditShell::SetTxtFmtColl( SwTxtFmtColl *pFmt,
- bool bResetListAttrs )
+ const bool bResetListAttrs )
{
SwTxtFmtColl *pLocal = pFmt? pFmt: (*GetDoc()->GetTxtFmtColls())[0];
StartAllAction();
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index d5967ea..c1c7057 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -4680,6 +4680,7 @@ namespace {
// --> OD 2008-11-19 #i70748#
if ( mbOutlineLevelSet )
{
+ mrTxtNode.GetNodes().UpdateOutlineNode( mrTxtNode );
if ( mrTxtNode.GetAttrOutlineLevel() == 0 )
{
mrTxtNode.ResetEmptyListStyleDueToResetOutlineLevelAttr();
diff --git a/sw/source/core/undo/unfmco.cxx b/sw/source/core/undo/unfmco.cxx
index 8baddb0..478a198 100644
--- a/sw/source/core/undo/unfmco.cxx
+++ b/sw/source/core/undo/unfmco.cxx
@@ -94,14 +94,13 @@ void SwUndoFmtColl::DoSetFmtColl(SwDoc & rDoc, SwPaM & rPaM)
sal_uInt16 const nPos = rDoc.GetTxtFmtColls()->GetPos(
(SwTxtFmtColl*)pFmtColl );
// does the format still exist?
- if( USHRT_MAX != nPos )
+ if ( USHRT_MAX != nPos )
{
- // --> OD 2008-04-15 #refactorlists#
- rDoc.SetTxtFmtColl(rPaM,
- (SwTxtFmtColl*)pFmtColl,
- mbReset,
- mbResetListAttrs );
- // <--
+ rDoc.SetTxtFmtColl(
+ rPaM,
+ (SwTxtFmtColl*) pFmtColl,
+ mbReset,
+ mbResetListAttrs );
}
}
diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx
index df0a4a1..ca2ceeb 100644
--- a/sw/source/core/unocore/unosett.cxx
+++ b/sw/source/core/unocore/unosett.cxx
@@ -2167,29 +2167,24 @@ void SwXNumberingRules::SetNumberingRuleByIndex(
OUString uTmp;
pData->aVal >>= uTmp;
String sStyleName;
- SwStyleNameMapper::FillUIName(uTmp, sStyleName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True );
+ SwStyleNameMapper::FillUIName( uTmp, sStyleName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True );
const SwTxtFmtColls* pColls = pDocShell->GetDoc()->GetTxtFmtColls();
const sal_uInt16 nCount = pColls->Count();
- for(sal_uInt16 k = 0; k < nCount; ++k)
+ for ( sal_uInt16 k = 0; k < nCount; ++k )
{
- SwTxtFmtColl &rTxtColl = *((*pColls)[k]);
- if(rTxtColl.IsDefault())
+ SwTxtFmtColl &rTxtColl = *( ( *pColls )[k] );
+ if ( rTxtColl.IsDefault() )
continue;
- //if(rTxtColl.GetOutlineLevel() == nIndex && //#outline level,removed by zhaojianwei
- // rTxtColl.GetName() != sStyleName)
- // rTxtColl..SetOutlineLevel(NO_NUMBERING);
- //else if(rTxtColl.GetName() == sStyleName)
- // rTxtColl.SetOutlineLevel(sal_Int8(nIndex));
- if ( rTxtColl.IsAssignedToListLevelOfOutlineStyle() && //add by zhaojianwei
- rTxtColl.GetAssignedOutlineStyleLevel() == nIndex &&
- rTxtColl.GetName() != sStyleName )
+ if ( rTxtColl.IsAssignedToListLevelOfOutlineStyle()
+ && rTxtColl.GetAssignedOutlineStyleLevel() == nIndex
+ && rTxtColl.GetName() != sStyleName )
{
rTxtColl.DeleteAssignmentToListLevelOfOutlineStyle();
}
else if ( rTxtColl.GetName() == sStyleName )
{
rTxtColl.AssignToListLevelOfOutlineStyle( nIndex );
- } //<-end,,zhaojianwei,
+ }
}
}
break;
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 071f28a..751aaea 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -2075,18 +2075,8 @@ throw(beans::PropertyVetoException, lang::IllegalArgumentException, lang::Wrappe
bDone = true;
break;
}
- // case FN_UNO_DEFAULT_OUTLINE_LEVEL: //#outline level,removed by zahojianwei
- //{
- // sal_Int8 nLevel = 0;
- // if( aValue >>= nLevel )
- // rBase.getNewBase()->GetCollection()->SetOutlineLevel( nLevel );
- // else
- // rBase.getNewBase()->GetCollection()->SetOutlineLevel( NO_NUMBERING );
- //
- // bDone = true;
- // break;
- //}
- case RES_PARATR_OUTLINELEVEL: //add by zahojianwei
+
+ case RES_PARATR_OUTLINELEVEL:
{
sal_Int16 nLevel = 0;
aValue >>= nLevel;
@@ -2094,8 +2084,9 @@ throw(beans::PropertyVetoException, lang::IllegalArgumentException, lang::Wrappe
rBase.getNewBase()->GetCollection()->SetAttrOutlineLevel( nLevel );
bDone = true;
- break; //<-end,zhaojianwei
+ break;
}
+
case FN_UNO_FOLLOW_STYLE:
{
OUString sTmp;
More information about the Libreoffice-commits
mailing list