summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorOliver-Rainer Wittmann <orw@apache.org>2014-06-27 12:27:55 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-06-27 17:22:09 +0100
commitb733d208b02facaaad8c4925277b34b9f7fd928f (patch)
treefb9c0ea612d3d970632f8e2f1fdcbe3ae74afceb /sw
parent852c8e53d7bdb978951ab2703085341ee529a211 (diff)
Related: #i78498# Do not keep OutlineLevel attribute at paragraph...
when a Paragraph Style is assigned. (cherry picked from commit 6a1564284d90c7e175f7848520924f7f6a5884b7) (cherry picked from commit 4a381b1124f60b76cabb558fa24827448a1caab0) Conflicts: sw/inc/doc.hxx sw/inc/editsh.hxx sw/inc/fmtcol.hxx sw/inc/ndtxt.hxx sw/source/core/attr/format.cxx sw/source/core/doc/docfmt.cxx sw/source/core/doc/docglbl.cxx sw/source/core/doc/doctxm.cxx sw/source/core/doc/fmtcol.cxx sw/source/core/edit/edfcol.cxx sw/source/core/txtnode/ndtxt.cxx sw/source/core/undo/unfmco.cxx sw/source/core/unocore/unosett.cxx sw/source/core/unocore/unostyle.cxx Change-Id: Ifa1214876df296f2e1210cc4a35f2df67f9f6bc4
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/doc.hxx6
-rw-r--r--sw/inc/editsh.hxx3
-rw-r--r--sw/inc/fmtcol.hxx36
-rw-r--r--sw/source/core/doc/docfmt.cxx94
-rw-r--r--sw/source/core/doc/doctxm.cxx4
-rw-r--r--sw/source/core/doc/fmtcol.cxx14
-rw-r--r--sw/source/core/edit/edfcol.cxx4
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx5
-rw-r--r--sw/source/core/undo/unfmco.cxx6
-rw-r--r--sw/source/core/unocore/unostyle.cxx2
10 files changed, 88 insertions, 86 deletions
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 75eac111ab24..37a6fda6bc59 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1086,9 +1086,9 @@ 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. */
- bool SetTxtFmtColl( const SwPaM &rRg, SwTxtFmtColl *pFmt,
- bool bReset = true,
- bool bResetListAttrs = false );
+ bool SetTxtFmtColl(const SwPaM &rRg, SwTxtFmtColl *pFmt,
+ const bool bReset = true,
+ const bool bResetListAttrs = false);
SwTxtFmtColl* FindTxtFmtCollByName( const OUString& rName ) const
{ return (SwTxtFmtColl*)FindFmtByName( (SwFmtsBase&)*mpTxtFmtCollTbl, rName ); }
diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx
index d85b55dded1c..6691202eba95 100644
--- a/sw/inc/editsh.hxx
+++ b/sw/inc/editsh.hxx
@@ -332,8 +332,7 @@ public:
// #i62675#
/// Add 2nd optional parameter <bResetListAttrs> - see also <SwDoc::SetTxtFmtColl(..)>
- void SetTxtFmtColl( SwTxtFmtColl*,
- bool bResetListAttrs = false );
+ void SetTxtFmtColl(SwTxtFmtColl*, const bool bResetListAttrs = false);
SwTxtFmtColl *MakeTxtFmtColl(const OUString &rFmtCollName,
SwTxtFmtColl *pDerivedFrom = 0);
void FillByEx(SwTxtFmtColl*, bool bReset = false);
diff --git a/sw/inc/fmtcol.hxx b/sw/inc/fmtcol.hxx
index 1b77f1542df2..a3c5df690a64 100644
--- a/sw/inc/fmtcol.hxx
+++ b/sw/inc/fmtcol.hxx
@@ -67,23 +67,22 @@ protected:
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; }
+ : SwFmtColl(rPool, pFmtCollName, aTxtFmtCollSetRange, pDerFrom, nFmtWh)
+ , mbStayAssignedToListLevelOfOutlineStyle(false)
+ , mbAssignedToOutlineStyle(false)
+ {
+ pNextTxtFmtColl = this;
+ }
SwTxtFmtColl( SwAttrPool& rPool, const OUString &rFmtCollName,
SwTxtFmtColl* pDerFrom = 0,
sal_uInt16 nFmtWh = RES_TXTFMTCOLL )
- : SwFmtColl( rPool, rFmtCollName, aTxtFmtCollSetRange,
- pDerFrom, nFmtWh ),
-
- mbStayAssignedToListLevelOfOutlineStyle( false ),
-
- mbAssignedToOutlineStyle(false)
- { pNextTxtFmtColl = this; }
+ : SwFmtColl(rPool, rFmtCollName, aTxtFmtCollSetRange, pDerFrom, nFmtWh)
+ , mbStayAssignedToListLevelOfOutlineStyle(false)
+ , mbAssignedToOutlineStyle(false)
+ {
+ pNextTxtFmtColl = this;
+ }
/// To get UL- / LR- / FontHeight-changes.
virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) SAL_OVERRIDE;
@@ -99,13 +98,22 @@ public:
void SetAttrOutlineLevel( int );
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();
+ void DeleteAssignmentToListLevelOfOutlineStyle(const bool bResetOutlineLevel
+ = true);
/** Override to recognize changes on the <SwNumRuleItem> and register/unregister
the paragragh style at the corresponding <SwNumRule> instance. */
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 312c6c50446f..6e3d5d975efa 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -100,22 +100,21 @@ struct ParaRstFmt
bool bResetListAttrs; // #i62575#
bool bResetAll;
bool bInclRefToxMark;
- bool bKeepOutlineLevelAttr;
-
- ParaRstFmt( const SwPosition* pStt, const SwPosition* pEnd,
- SwHistory* pHst, sal_uInt16 nWhch = 0, const SfxItemSet* pSet = 0 )
- : pFmtColl(0),
- pHistory(pHst),
- pSttNd(pStt),
- pEndNd(pEnd),
- pDelSet(pSet),
- nWhich(nWhch),
- bReset( false ), // #i62675#
- bResetListAttrs( false ),
- bResetAll( true ),
- bInclRefToxMark( false ),
- bKeepOutlineLevelAttr( false )
- {}
+
+ ParaRstFmt(const SwPosition* pStt, const SwPosition* pEnd,
+ SwHistory* pHst, sal_uInt16 nWhch = 0, const SfxItemSet* pSet = 0)
+ : pFmtColl(0)
+ , pHistory(pHst)
+ , pSttNd(pStt)
+ , pEndNd(pEnd)
+ , pDelSet(pSet)
+ , nWhich(nWhch)
+ , bReset(false) // #i62675#
+ , bResetListAttrs(false)
+ , bResetAll(true)
+ , bInclRefToxMark(false)
+ {
+ }
};
/** @params pArgs contains the document's ChrFmtTable
@@ -156,7 +155,7 @@ static bool lcl_RstTxtAttr( const SwNodePtr& rpNd, void* pArgs )
static bool lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs )
{
- ParaRstFmt* pPara = (ParaRstFmt*)pArgs;
+ const ParaRstFmt* pPara = (ParaRstFmt*)pArgs;
SwCntntNode* pNode = (SwCntntNode*)rpNd->GetCntntNode();
if( pNode && pNode->HasSwAttrSet() )
{
@@ -167,22 +166,20 @@ static bool lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs )
// 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,
- RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END - 1,
- 0 );
- const SfxItemSet* pSet = pNode->GetpSwAttrSet();
+ 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();
std::vector<sal_uInt16> aClearWhichIds;
// restoring all paragraph list attributes
{
SfxItemSet aListAttrSet( pDoc->GetAttrPool(), RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END - 1 );
- 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 )
@@ -195,12 +192,10 @@ static bool lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs )
const SfxPoolItem* pItem;
- sal_uInt16 const aSavIds[ 4 ] = { RES_PAGEDESC, RES_BREAK,
- RES_PARATR_NUMRULE,
- RES_PARATR_OUTLINELEVEL };
- for( sal_uInt16 n = 0; n < 4; ++n )
+ sal_uInt16 const aSavIds[3] = { RES_PAGEDESC, RES_BREAK, RES_PARATR_NUMRULE };
+ for (sal_uInt16 n = 0; n < 3; ++n)
{
- if( SFX_ITEM_SET == pSet->GetItemState( aSavIds[ n ], false, &pItem ))
+ if (SFX_ITEM_SET == pAttrSetOfNode->GetItemState(aSavIds[n], false, &pItem))
{
bool bSave = false;
switch( aSavIds[ n ] )
@@ -212,20 +207,13 @@ static bool lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs )
bSave = SVX_BREAK_NONE != ((SvxFmtBreakItem*)pItem)->GetBreak();
break;
case RES_PARATR_NUMRULE:
- {
bSave = !((SwNumRuleItem*)pItem)->GetValue().isEmpty();
- }
- break;
- case RES_PARATR_OUTLINELEVEL:
- {
- bSave = pPara && pPara->bKeepOutlineLevelAttr;
- }
break;
}
if( bSave )
{
- aSet.Put( *pItem );
- aClearWhichIds.push_back( aSavIds[n] );
+ aSavedAttrsSet.Put(*pItem);
+ aClearWhichIds.push_back(aSavIds[n]);
}
}
}
@@ -257,11 +245,11 @@ static bool lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs )
if ( ( pItem->Which() != RES_PAGEDESC &&
pItem->Which() != RES_BREAK &&
pItem->Which() != RES_PARATR_NUMRULE ) ||
- ( aSet.GetItemState( pItem->Which(), false ) != SFX_ITEM_SET ) )
+ ( aSavedAttrsSet.GetItemState( pItem->Which(), false ) != SFX_ITEM_SET ) )
{
pNode->ResetAttr( pItem->Which() );
}
- if( aIter.IsAtEnd() )
+ if (aIter.IsAtEnd())
break;
pItem = aIter.NextItem();
}
@@ -275,11 +263,11 @@ static bool lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs )
pNode->ResetAllAttr();
// only restore saved attributes, if needed
- if ( bKeepAttributes && aSet.Count() )
+ if (bKeepAttributes && aSavedAttrsSet.Count())
{
pNode->LockModify();
- pNode->SetAttr( aSet );
+ pNode->SetAttr(aSavedAttrsSet);
if( !bLocked )
pNode->UnlockModify();
@@ -1682,10 +1670,7 @@ static bool lcl_SetTxtFmtColl( const SwNodePtr& rpNode, void* pArgs )
SwTxtFmtColl* pFmt = static_cast<SwTxtFmtColl*>(pPara->pFmtColl);
if ( pPara->bReset )
{
- if( pFmt->GetAttrOutlineLevel() == 0 )
- pPara->bKeepOutlineLevelAttr = true;
-
- lcl_RstAttr( pCNd, pPara );
+ lcl_RstAttr(pCNd, pPara);
// #i62675# check, if paragraph style has changed
if ( pPara->bResetListAttrs &&
@@ -1742,10 +1727,10 @@ static bool lcl_SetTxtFmtColl( const SwNodePtr& rpNode, void* pArgs )
return true;
}
-bool SwDoc::SetTxtFmtColl( const SwPaM &rRg,
- SwTxtFmtColl *pFmt,
- bool bReset,
- bool bResetListAttrs )
+bool SwDoc::SetTxtFmtColl(const SwPaM &rRg,
+ SwTxtFmtColl *pFmt,
+ const bool bReset,
+ const bool bResetListAttrs)
{
SwDataChanged aTmp( rRg );
const SwPosition *pStt = rRg.Start(), *pEnd = rRg.End();
@@ -1772,8 +1757,11 @@ bool SwDoc::SetTxtFmtColl( const SwPaM &rRg,
if( !aPara.nWhich )
bRet = false; // didn't find a valid Node
- if( bRet )
+ if (bRet)
+ {
SetModified();
+ }
+
return bRet;
}
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index d98edcac5f5a..e6011536806c 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -1463,7 +1463,9 @@ void SwTOXBaseSection::UpdateCntnt( SwTOXElement eMyType,
if( pOutlNd )
{
if( pOutlNd->GetTxtColl()->IsAssignedToListLevelOfOutlineStyle())
+ {
nSetLevel = pOutlNd->GetTxtColl()->GetAttrOutlineLevel();
+ }
}
}
@@ -1518,7 +1520,7 @@ void SwTOXBaseSection::UpdateTable( const SwTxtNode* pOwnChapterNode )
if( pOutlNd->GetTxtColl()->IsAssignedToListLevelOfOutlineStyle())
{
const int nTmp = pOutlNd->GetTxtColl()->GetAttrOutlineLevel();
- pNew->SetLevel( static_cast<sal_uInt16>(nTmp) );
+ pNew->SetLevel(static_cast<sal_uInt16>(nTmp));
}
}
}
diff --git a/sw/source/core/doc/fmtcol.cxx b/sw/source/core/doc/fmtcol.cxx
index 6843a81617ad..37332818b0d2 100644
--- a/sw/source/core/doc/fmtcol.cxx
+++ b/sw/source/core/doc/fmtcol.cxx
@@ -186,12 +186,11 @@ void SwTxtFmtColl::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
break;
// #i70223#
case RES_PARATR_NUMRULE:
- {
- if ( bAssignedToListLevelOfOutlineStyle )
+ if (bAssignedToListLevelOfOutlineStyle)
{
pNewNumRuleItem = (SwNumRuleItem*)pNew;
}
- }
+ break;
default:
break;
}
@@ -607,6 +606,7 @@ void SwConditionTxtFmtColl::SetConditions( const SwFmtCollConditions& rCndClls )
}
}
+// FEATURE::CONDCOLL
void SwTxtFmtColl::SetAttrOutlineLevel( int nLevel)
{
OSL_ENSURE( 0 <= nLevel && nLevel <= MAXLEVEL ,"SwTxtFmtColl: Level Out Of Range" );
@@ -653,10 +653,14 @@ void SwTxtFmtColl::AssignToListLevelOfOutlineStyle(const int nAssignedListLevel)
}
}
-void SwTxtFmtColl::DeleteAssignmentToListLevelOfOutlineStyle()
+void SwTxtFmtColl::DeleteAssignmentToListLevelOfOutlineStyle(
+ const bool bResetOutlineLevel)
{
mbAssignedToOutlineStyle = false;
- ResetFmtAttr(RES_PARATR_OUTLINELEVEL);
+ if (bResetOutlineLevel)
+ {
+ ResetFmtAttr(RES_PARATR_OUTLINELEVEL);
+ }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 313195616803..1a02d9fd0715 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -48,8 +48,8 @@ SwTxtFmtColl& SwEditShell::GetTxtFmtColl( sal_uInt16 nFmtColl) const
}
// #i62675#
-void SwEditShell::SetTxtFmtColl( SwTxtFmtColl *pFmt,
- bool bResetListAttrs )
+void SwEditShell::SetTxtFmtColl(SwTxtFmtColl *pFmt,
+ 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 01f9e9a1f5f3..2ba1b2b0a26c 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -4538,9 +4538,10 @@ namespace {
}
// #i70748#
- if ( mbOutlineLevelSet )
+ if (mbOutlineLevelSet)
{
- if ( mrTxtNode.GetAttrOutlineLevel() == 0 )
+ 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 d9d4b9765b3f..21b7b1dabc33 100644
--- a/sw/source/core/undo/unfmco.cxx
+++ b/sw/source/core/undo/unfmco.cxx
@@ -77,10 +77,8 @@ void SwUndoFmtColl::DoSetFmtColl(SwDoc & rDoc, SwPaM & rPaM)
// does the format still exist?
if( USHRT_MAX != nPos )
{
- rDoc.SetTxtFmtColl(rPaM,
- (SwTxtFmtColl*)pFmtColl,
- mbReset,
- mbResetListAttrs );
+ rDoc.SetTxtFmtColl(rPaM, (SwTxtFmtColl*)pFmtColl, mbReset,
+ mbResetListAttrs);
}
}
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index f79beed7e57c..49ede1a22d4e 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -1902,6 +1902,7 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
bDone = true;
break;
}
+
case RES_PARATR_OUTLINELEVEL:
{
sal_Int16 nLevel = 0;
@@ -1912,6 +1913,7 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
bDone = true;
break;
}
+
case FN_UNO_FOLLOW_STYLE:
{
OUString sTmp;