diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-04-03 12:39:07 +0100 |
---|---|---|
committer | Adolfo Jayme Barrientos <fitojb@ubuntu.com> | 2015-04-09 12:38:01 +0000 |
commit | f9ed8781e66dd430b746c8fb66f321567b7bfe53 (patch) | |
tree | 8a75ff7c07be5148beeb9cf4f98d5cf909cbd575 | |
parent | bdbb20758c210a4ac3732dc7d7d0e6e8aa048615 (diff) |
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 0087ca89e3905009ed947c651f3dc70f3d61ea93)
Change-Id: I9416b97d6afe323ac99150fdcc23f71ecea98a58
(cherry picked from commit db41e274747e6f1d3eee2bd5efb3321cfcbd6b75)
Reviewed-on: https://gerrit.libreoffice.org/15138
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Tested-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
-rw-r--r-- | sw/inc/doc.hxx | 8 | ||||
-rw-r--r-- | sw/source/core/doc/docnum.cxx | 8 | ||||
-rw-r--r-- | sw/source/core/edit/ednumber.cxx | 18 |
3 files changed, 24 insertions, 10 deletions
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index a7b882998635..2abd17c49656 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -1111,10 +1111,12 @@ public: Parameters <bCreateNewList> and <sContinuedListId>: <bCreateNewList> indicates, if a new list is created by applying the given list style. If <bCreateNewList> equals false, <sContinuedListId> may contain the - list Id of a list, which has to be continued by applying the given list style */ - void SetNumRule( const SwPaM&, + list Id of a list, which has to be continued by applying the given list style + + Returns the set ListId if bSetItem is true */ + OUString SetNumRule( const SwPaM&, const SwNumRule&, - const bool bCreateNewList, + bool bCreateNewList, const OUString& sContinuedListId = OUString(), bool bSetItem = true, const bool bResetIndentAttrs = false ); diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index ebd6f46d5417..835b1e1cdcb9 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -828,13 +828,15 @@ static void lcl_ChgNumRule( SwDoc& rDoc, const SwNumRule& rRule ) rDoc.UpdateNumRule(); } -void SwDoc::SetNumRule( const SwPaM& rPam, +OUString SwDoc::SetNumRule( const SwPaM& rPam, const SwNumRule& rRule, const bool bCreateNewList, const OUString& sContinuedListId, bool bSetItem, const bool bResetIndentAttrs ) { + OUString sListId; + SwUndoInsNum * pUndo = NULL; if (GetIDocumentUndoRedo().DoesUndo()) { @@ -868,7 +870,6 @@ void SwDoc::SetNumRule( const SwPaM& rPam, if ( bSetItem ) { - OUString sListId; if ( bCreateNewList ) { if ( bNewNumRuleCreated ) @@ -947,8 +948,9 @@ void SwDoc::SetNumRule( const SwPaM& rPam, } getIDocumentState().SetModified(); -} + return sListId; +} void SwDoc::SetCounted(const SwPaM & rPam, bool bCounted) { diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx index 33c5e0692b34..7108bf03c82c 100644 --- a/sw/source/core/edit/ednumber.cxx +++ b/sw/source/core/edit/ednumber.cxx @@ -735,8 +735,8 @@ const SwNumRule* SwEditShell::GetNumRuleAtCurrentSelection() const } void SwEditShell::SetCurNumRule( const SwNumRule& rRule, - const bool bCreateNewList, - const OUString& sContinuedListId, + bool bCreateNewList, + const OUString& rContinuedListId, const bool bResetIndentAttrs ) { StartAllAction(); @@ -748,19 +748,29 @@ void SwEditShell::SetCurNumRule( const SwNumRule& rRule, { SwPamRanges aRangeArr( *pCrsr ); SwPaM aPam( *pCrsr->GetPoint() ); + OUString sContinuedListId(rContinuedListId); for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n ) { aRangeArr.SetPam( n, aPam ); - GetDoc()->SetNumRule( aPam, rRule, + OUString sListId = GetDoc()->SetNumRule( aPam, rRule, bCreateNewList, sContinuedListId, 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 ); } } else { GetDoc()->SetNumRule( *pCrsr, rRule, - bCreateNewList, sContinuedListId, + bCreateNewList, rContinuedListId, true, bResetIndentAttrs ); GetDoc()->SetCounted( *pCrsr, true ); } |