Kaydet (Commit) db41e274 authored tarafından Caolán McNamara's avatar Caolán McNamara

Resolves: tdf#87548 don't create a new list for each multiselection portion

create one list and share it among all the subsections

possibly a regression from/triggered by

 author	Oliver-Rainer Wittmann <orw@apache.org>	2014-03-18 14:33:39 (GMT)

 Resolves: #i124371# When changing the numbering or bullet styling...  of a set
 of paragraph which have more than one different List Style applied create a new
 List Style and put the paragraphs into a new list.

 (cherry picked from commit 0087ca89)

Change-Id: I9416b97d6afe323ac99150fdcc23f71ecea98a58
üst c8e39299
...@@ -1106,10 +1106,12 @@ public: ...@@ -1106,10 +1106,12 @@ public:
Parameters <bCreateNewList> and <sContinuedListId>: Parameters <bCreateNewList> and <sContinuedListId>:
<bCreateNewList> indicates, if a new list is created by applying the given list style. <bCreateNewList> indicates, if a new list is created by applying the given list style.
If <bCreateNewList> equals false, <sContinuedListId> may contain the If <bCreateNewList> equals false, <sContinuedListId> may contain the
list Id of a list, which has to be continued by applying the given list style */ list Id of a list, which has to be continued by applying the given list style
void SetNumRule( const SwPaM&,
Returns the set ListId if bSetItem is true */
OUString SetNumRule( const SwPaM&,
const SwNumRule&, const SwNumRule&,
const bool bCreateNewList, bool bCreateNewList,
const OUString& sContinuedListId = OUString(), const OUString& sContinuedListId = OUString(),
bool bSetItem = true, bool bSetItem = true,
const bool bResetIndentAttrs = false ); const bool bResetIndentAttrs = false );
......
...@@ -816,13 +816,15 @@ static void lcl_ChgNumRule( SwDoc& rDoc, const SwNumRule& rRule ) ...@@ -816,13 +816,15 @@ static void lcl_ChgNumRule( SwDoc& rDoc, const SwNumRule& rRule )
rDoc.UpdateNumRule(); rDoc.UpdateNumRule();
} }
void SwDoc::SetNumRule( const SwPaM& rPam, OUString SwDoc::SetNumRule( const SwPaM& rPam,
const SwNumRule& rRule, const SwNumRule& rRule,
const bool bCreateNewList, const bool bCreateNewList,
const OUString& sContinuedListId, const OUString& sContinuedListId,
bool bSetItem, bool bSetItem,
const bool bResetIndentAttrs ) const bool bResetIndentAttrs )
{ {
OUString sListId;
SwUndoInsNum * pUndo = NULL; SwUndoInsNum * pUndo = NULL;
if (GetIDocumentUndoRedo().DoesUndo()) if (GetIDocumentUndoRedo().DoesUndo())
{ {
...@@ -856,7 +858,6 @@ void SwDoc::SetNumRule( const SwPaM& rPam, ...@@ -856,7 +858,6 @@ void SwDoc::SetNumRule( const SwPaM& rPam,
if ( bSetItem ) if ( bSetItem )
{ {
OUString sListId;
if ( bCreateNewList ) if ( bCreateNewList )
{ {
if ( bNewNumRuleCreated ) if ( bNewNumRuleCreated )
...@@ -935,8 +936,9 @@ void SwDoc::SetNumRule( const SwPaM& rPam, ...@@ -935,8 +936,9 @@ void SwDoc::SetNumRule( const SwPaM& rPam,
} }
getIDocumentState().SetModified(); getIDocumentState().SetModified();
}
return sListId;
}
void SwDoc::SetCounted(const SwPaM & rPam, bool bCounted) void SwDoc::SetCounted(const SwPaM & rPam, bool bCounted)
{ {
......
...@@ -731,8 +731,8 @@ const SwNumRule* SwEditShell::GetNumRuleAtCurrentSelection() const ...@@ -731,8 +731,8 @@ const SwNumRule* SwEditShell::GetNumRuleAtCurrentSelection() const
} }
void SwEditShell::SetCurNumRule( const SwNumRule& rRule, void SwEditShell::SetCurNumRule( const SwNumRule& rRule,
const bool bCreateNewList, bool bCreateNewList,
const OUString& sContinuedListId, const OUString& rContinuedListId,
const bool bResetIndentAttrs ) const bool bResetIndentAttrs )
{ {
StartAllAction(); StartAllAction();
...@@ -744,19 +744,29 @@ void SwEditShell::SetCurNumRule( const SwNumRule& rRule, ...@@ -744,19 +744,29 @@ void SwEditShell::SetCurNumRule( const SwNumRule& rRule,
{ {
SwPamRanges aRangeArr( *pCrsr ); SwPamRanges aRangeArr( *pCrsr );
SwPaM aPam( *pCrsr->GetPoint() ); SwPaM aPam( *pCrsr->GetPoint() );
OUString sContinuedListId(rContinuedListId);
for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n ) for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
{ {
aRangeArr.SetPam( n, aPam ); aRangeArr.SetPam( n, aPam );
GetDoc()->SetNumRule( aPam, rRule, OUString sListId = GetDoc()->SetNumRule( aPam, rRule,
bCreateNewList, sContinuedListId, bCreateNewList, sContinuedListId,
true, bResetIndentAttrs ); true, bResetIndentAttrs );
//tdf#87548 On creating a new list for a multi-selection only
//create a single new list for the multi-selection, not one per selection
if (bCreateNewList)
{
sContinuedListId = sListId;
bCreateNewList = false;
}
GetDoc()->SetCounted( aPam, true ); GetDoc()->SetCounted( aPam, true );
} }
} }
else else
{ {
GetDoc()->SetNumRule( *pCrsr, rRule, GetDoc()->SetNumRule( *pCrsr, rRule,
bCreateNewList, sContinuedListId, bCreateNewList, rContinuedListId,
true, bResetIndentAttrs ); true, bResetIndentAttrs );
GetDoc()->SetCounted( *pCrsr, true ); GetDoc()->SetCounted( *pCrsr, true );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment