[Libreoffice-commits] core.git: Branch 'aoo/trunk' - sw/inc sw/source
Oliver-Rainer Wittmann
orw at apache.org
Tue Mar 18 09:08:08 PDT 2014
sw/inc/doc.hxx | 58 +----
sw/inc/docsh.hxx | 9
sw/inc/editsh.hxx | 54 ++--
sw/source/core/doc/docnum.cxx | 259 +++++++----------------
sw/source/core/docnode/ndcopy.cxx | 15 -
sw/source/core/edit/autofmt.cxx | 41 +--
sw/source/core/edit/ednumber.cxx | 133 ++++++------
sw/source/core/undo/unnum.cxx | 27 --
sw/source/core/unocore/unocrsrhelper.cxx | 31 --
sw/source/filter/ww1/fltshell.cxx | 39 +--
sw/source/ui/app/docst.cxx | 111 +++++-----
sw/source/ui/docvw/edtwin.cxx | 28 +-
sw/source/ui/inc/textsh.hxx | 9
sw/source/ui/misc/num.cxx | 2
sw/source/ui/shells/listsh.cxx | 2
sw/source/ui/shells/textsh1.cxx | 115 +++++-----
sw/source/ui/shells/txtattr.cxx | 2
sw/source/ui/shells/txtnum.cxx | 339 +++++++++----------------------
sw/source/ui/uiview/formatclipboard.cxx | 4
sw/source/ui/uiview/view2.cxx | 4
sw/source/ui/wrtsh/wrtsh1.cxx | 6
21 files changed, 509 insertions(+), 779 deletions(-)
New commits:
commit 0087ca89e3905009ed947c651f3dc70f3d61ea93
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date: Tue Mar 18 14:33:39 2014 +0000
124371: 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.
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 38802a3..c8e3b29 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1539,44 +1539,29 @@ public:
sal_Bool GotoOutline( SwPosition& rPos, const String& rName ) const;
// die Aenderungen an den Gliederungsvorlagen in die OutlineRule uebernehmen
- // setzt, wenn noch keine Numerierung, sonst wird geaendert
- // arbeitet mit alten und neuen Regeln, nur Differenzen aktualisieren
- // --> OD 2005-02-18 #i42921# - re-use unused 3rd parameter
- // --> OD 2008-02-08 #newlistlevelattrs#
- // Add optional parameter <bResetIndentAttrs> - default value sal_False.
- // If <bResetIndentAttrs> equals true, the indent attributes "before text"
- // and "first line indent" are additionally reset at the provided PaM, if
- // the list style makes use of the new list level attributes.
- // --> OD 2008-03-17 #refactorlists#
- // introduce parameters <bCreateNewList> and <sContinuedListId>
- // <bCreateNewList> indicates, if a new list is created by applying the
- // given list style.
+ // Optional parameter <bResetIndentAttrs> - default value false:
+ // If <bResetIndentAttrs> equals true, the indent attributes "before text"
+ // and "first line indent" are additionally reset at the provided PaM, if
+ // the list style makes use of the new list level attributes.
+ // 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&,
const SwNumRule&,
const bool bCreateNewList,
const String sContinuedListId = String(),
- sal_Bool bSetItem = sal_True,
+ bool bSetItem = true,
const bool bResetIndentAttrs = false );
- // <--
- void SetCounted( const SwPaM&, bool bCounted);
-
- // --> OD 2009-08-25 #i86492#
- // no longer needed.
- // SwDoc::SetNumRule( rPaM, rNumRule, false, <ListId>, sal_True, true ) have to be used instead.
-// /**
-// Replace numbering rules in a PaM by another numbering rule.
-// \param rPaM PaM to replace the numbering rules in
-// \param rNumRule numbering rule to replace the present numbering rules
-// */
-// void ReplaceNumRule(const SwPaM & rPaM, const SwNumRule & rNumRule);
+ void SetCounted( const SwPaM&, bool bCounted);
void MakeUniqueNumRules(const SwPaM & rPaM);
void SetNumRuleStart( const SwPosition& rPos, sal_Bool bFlag = sal_True );
void SetNodeNumStart( const SwPosition& rPos, sal_uInt16 nStt );
- SwNumRule* GetCurrNumRule( const SwPosition& rPos ) const;
+ SwNumRule* GetNumRuleAtPos( const SwPosition& rPos ) const;
const SwNumRuleTbl& GetNumRuleTbl() const { return *pNumRuleTbl; }
@@ -2096,11 +2081,10 @@ public:
*/
String GetPaMDescr(const SwPaM & rPaM) const;
- // -> #i23726#
- sal_Bool IsFirstOfNumRule(SwPosition & rPos);
- // <- #i23726#
+ bool IsFirstOfNumRuleAtPos( const SwPosition & rPos );
+
- // --> #i31958# access methods for XForms model(s)
+ // access methods for XForms model(s)
/// access container for XForms model; will be NULL if !isXForms()
com::sun::star::uno::Reference<com::sun::star::container::XNameContainer>
@@ -2117,32 +2101,32 @@ public:
void disposeXForms( ); // #i113606#, for disposing XForms
- // --> OD 2006-03-21 #b6375613#
+
inline bool ApplyWorkaroundForB6375613() const
{
return mbApplyWorkaroundForB6375613;
}
void SetApplyWorkaroundForB6375613( bool p_bApplyWorkaroundForB6375613 );
- // <--
+
//Update all the page masters
void SetDefaultPageMode(bool bSquaredPageMode);
sal_Bool IsSquaredPageMode() const;
- // i#78591#
- void Setn32DummyCompatabilityOptions1( sal_uInt32 CompatabilityOptions1 )
+
+ void Setn32DummyCompatabilityOptions1( const sal_uInt32 CompatabilityOptions1 )
{
n32DummyCompatabilityOptions1 = CompatabilityOptions1;
}
- sal_uInt32 Getn32DummyCompatabilityOptions1( )
+ sal_uInt32 Getn32DummyCompatabilityOptions1()
{
return n32DummyCompatabilityOptions1;
}
- void Setn32DummyCompatabilityOptions2( sal_uInt32 CompatabilityOptions2 )
+ void Setn32DummyCompatabilityOptions2( const sal_uInt32 CompatabilityOptions2 )
{
n32DummyCompatabilityOptions2 = CompatabilityOptions2;
}
- sal_uInt32 Getn32DummyCompatabilityOptions2( )
+ sal_uInt32 Getn32DummyCompatabilityOptions2()
{
return n32DummyCompatabilityOptions2;
}
diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx
index 7f84972..e3de862 100644
--- a/sw/inc/docsh.hxx
+++ b/sw/inc/docsh.hxx
@@ -120,8 +120,13 @@ class SW_DLLPUBLIC SwDocShell: public SfxObjectShell, public SfxListener
const sal_Bool bBasic = sal_False );
SW_DLLPRIVATE sal_uInt16 Delete(const String &rName, sal_uInt16 nFamily);
- SW_DLLPRIVATE sal_uInt16 ApplyStyles(const String &rName, sal_uInt16 nFamily, SwWrtShell* pShell = 0,
- sal_uInt16 nMode = 0 );
+
+ SW_DLLPRIVATE sal_uInt16 ApplyStyles(
+ const String &rName,
+ const sal_uInt16 nFamily,
+ SwWrtShell* pShell = 0,
+ const sal_uInt16 nMode = 0 );
+
SW_DLLPRIVATE sal_uInt16 DoWaterCan( const String &rName, sal_uInt16 nFamily);
SW_DLLPRIVATE sal_uInt16 UpdateStyle(const String &rName, sal_uInt16 nFamily, SwWrtShell* pShell = 0);
SW_DLLPRIVATE sal_uInt16 MakeByExample(const String &rName,
diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx
index 7f9d8c8..bbb2b8f 100644
--- a/sw/inc/editsh.hxx
+++ b/sw/inc/editsh.hxx
@@ -430,28 +430,26 @@ public:
// Outlines and SubOutline are protected ?
sal_Bool IsProtectedOutlinePara() const;
- // Numerierung Aufzaehlunglisten
- // liefert Regelwerk der aktuellen Aufzaehlung (sal_False sonst)
- const SwNumRule* GetCurNumRule() const;
-
- // setzt, wenn noch keine Numerierung, sonst wird geaendert
- // arbeitet mit alten und neuen Regeln, nur Differenzen aktualisieren
- // --> OD 2008-02-08 #newlistlevelattrs#
- // Add optional parameter <bResetIndentAttrs> (default value sal_False).
- // If <bResetIndentAttrs> equals true, the indent attributes "before text"
- // and "first line indent" are additionally reset at the current selection,
- // if the list style makes use of the new list level attributes.
- // --> OD 2008-03-17 #refactorlists#
- // introduce parameters <bCreateNewList> and <sContinuedListId>
- // <bCreateNewList> indicates, if a new list is created by applying the
- // given list style.
- // If <bCreateNewList> equals sal_False, <sContinuedListId> may contain the
- // list Id of a list, which has to be continued by applying the given list style
+
+ const SwNumRule* GetNumRuleAtCurrCrsrPos() const;
+
+ // Returns the numbering rule found at the paragraphs of the current selection,
+ // if all paragraphs of the current selection have the same or none numbering rule applied.
+ const SwNumRule* GetNumRuleAtCurrentSelection() const;
+
+ // Optional parameter <bResetIndentAttrs> (default value sal_False).
+ // If <bResetIndentAttrs> equals true, the indent attributes "before text"
+ // and "first line indent" are additionally reset at the current selection,
+ // if the list style makes use of the new list level attributes.
+ // 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 SetCurNumRule( const SwNumRule&,
const bool bCreateNewList /*= false*/,
const String sContinuedListId = String(),
const bool bResetIndentAttrs = false );
- // <--
+
// Absaetze ohne Numerierung, aber mit Einzuegen
sal_Bool NoNum();
// Loeschen, Splitten der Aufzaehlungsliste
@@ -459,30 +457,22 @@ public:
// Hoch-/Runterstufen
sal_Bool NumUpDown( sal_Bool bDown = sal_True );
// Hoch-/Runtermoven sowohl innerhalb als auch ausserhalb von Numerierungen
- sal_Bool MoveParagraph( long nOffset = 1);
+ sal_Bool MoveParagraph( long nOffset = 1 );
sal_Bool MoveNumParas( sal_Bool bUpperLower, sal_Bool bUpperLeft );
// No-/Numerierung ueber Delete/Backspace ein/abschalten #115901#
- sal_Bool NumOrNoNum( sal_Bool bDelete = sal_False, sal_Bool bChkStart = sal_True);
+ sal_Bool NumOrNoNum( sal_Bool bDelete = sal_False, sal_Bool bChkStart = sal_True );
// -> #i23726#
- // --> OD 2008-06-09 #i90078#
- // Remove unused default parameter <nLevel> and <bRelative>.
- // Adjust method name and parameter name
- void ChangeIndentOfAllListLevels( short nDiff );
- // Adjust method name
+
+ void ChangeIndentOfAllListLevels( const short nDiff );
void SetIndent(short nIndent, const SwPosition & rPos);
- // <--
- sal_Bool IsFirstOfNumRule() const;
- sal_Bool IsFirstOfNumRule(const SwPaM & rPaM) const;
- // <- #i23726#
+ bool IsFirstOfNumRuleAtCrsrPos() const;
sal_Bool IsNoNum( sal_Bool bChkStart = sal_True ) const;
// returne den Num-Level des Nodes, in dem sich der Point vom
// Cursor befindet. Return kann sein :
// - NO_NUMBERING, 0..MAXLEVEL-1, NO_NUMLEVEL .. NO_NUMLEVEL|MAXLEVEL-1
- // --> OD 2008-02-29 #refactorlists# - removed <pHasChilds>
-// sal_uInt8 GetNumLevel( sal_Bool* pHasChilds = 0 ) const;
sal_uInt8 GetNumLevel() const;
- // <--
+
// detect highest and lowest level to check moving of outline levels
void GetCurrentOutlineLevels( sal_uInt8& rUpper, sal_uInt8& rLower );
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 1350e76..48d489f 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -868,67 +868,44 @@ sal_Bool SwDoc::GotoOutline( SwPosition& rPos, const String& rName ) const
// <--
-void lcl_ChgNumRule( SwDoc& rDoc, const SwNumRule& rRule )
+void lcl_ChgNumRule(
+ SwDoc& rDoc,
+ const SwNumRule& rRule )
{
SwNumRule* pOld = rDoc.FindNumRulePtr( rRule.GetName() );
ASSERT( pOld, "ohne die alte NumRule geht gar nichts" );
- sal_uInt16 nChgFmtLevel = 0, nMask = 1;
- sal_uInt8 n;
+ sal_uInt16 nChgFmtLevel = 0;
+ sal_uInt16 nMask = 1;
- for( n = 0; n < MAXLEVEL; ++n, nMask <<= 1 )
+ for ( sal_uInt8 n = 0; n < MAXLEVEL; ++n, nMask <<= 1 )
{
- const SwNumFmt& rOldFmt = pOld->Get( n ),
- & rNewFmt = rRule.Get( n );
+ const SwNumFmt& rOldFmt = pOld->Get( n ), &rNewFmt = rRule.Get( n );
- if( rOldFmt != rNewFmt )
+ if ( rOldFmt != rNewFmt )
{
nChgFmtLevel |= nMask;
}
- else if( SVX_NUM_NUMBER_NONE > rNewFmt.GetNumberingType() && 1 < rNewFmt.GetIncludeUpperLevels() &&
- 0 != (nChgFmtLevel & GetUpperLvlChg( n, rNewFmt.GetIncludeUpperLevels(),nMask )) )
+ else if ( SVX_NUM_NUMBER_NONE > rNewFmt.GetNumberingType()
+ && 1 < rNewFmt.GetIncludeUpperLevels()
+ && 0 != ( nChgFmtLevel & GetUpperLvlChg( n, rNewFmt.GetIncludeUpperLevels(), nMask ) ) )
+ {
nChgFmtLevel |= nMask;
+ }
}
if( !nChgFmtLevel ) // es wurde nichts veraendert?
{
- // --> OD 2006-04-27 #i64311#
const bool bInvalidateNumRule( pOld->IsContinusNum() != rRule.IsContinusNum() );
- // <--
pOld->CheckCharFmts( &rDoc );
pOld->SetContinusNum( rRule.IsContinusNum() );
- // --> OD 2008-06-17 #i87166#
- // Do NOT change list style type
-// pOld->SetRuleType( rRule.GetRuleType() );
- // <--
- // --> OD 2006-04-27 #i64311#
if ( bInvalidateNumRule )
{
pOld->SetInvalidRule(sal_True);
}
- // <--
return ;
}
- // --> OD 2008-02-19 #refactorlists#
-// SwNumRuleInfo* pUpd = new SwNumRuleInfo( rRule.GetName() );
-// pUpd->MakeList( rDoc );
-
-// sal_uInt8 nLvl;
-// for( sal_uLong nFirst = 0, nLast = pUpd->GetList().Count();
-// nFirst < nLast; ++nFirst )
-// {
-// SwTxtNode* pTxtNd = pUpd->GetList().GetObject( nFirst );
-// nLvl = static_cast<sal_uInt8>(pTxtNd->GetLevel());
-
-// if( nLvl < MAXLEVEL )
-// {
-// if( nChgFmtLevel & ( 1 << nLvl ))
-// {
-// pTxtNd->NumRuleChgd();
-// }
-// }
-// }
SwNumRule::tTxtNodeList aTxtNodeList;
pOld->GetTxtNodeList( aTxtNodeList );
sal_uInt8 nLvl( 0 );
@@ -946,34 +923,24 @@ void lcl_ChgNumRule( SwDoc& rDoc, const SwNumRule& rRule )
}
}
}
- // <--
- for( n = 0; n < MAXLEVEL; ++n )
- if( nChgFmtLevel & ( 1 << n ))
- pOld->Set( n, rRule.GetNumFmt( n ));
+ for ( sal_uInt8 n = 0; n < MAXLEVEL; ++n )
+ if ( nChgFmtLevel & ( 1 << n ) )
+ pOld->Set( n, rRule.GetNumFmt( n ) );
pOld->CheckCharFmts( &rDoc );
- pOld->SetInvalidRule(sal_True);
+ pOld->SetInvalidRule( sal_True );
pOld->SetContinusNum( rRule.IsContinusNum() );
- // --> OD 2008-06-17 #i87166#
- // Do NOT change list style type
-// pOld->SetRuleType( rRule.GetRuleType() );
- // <--
-
- // --> OD 2008-02-19 #refactorlists#
-// delete pUpd;
- // <--
rDoc.UpdateNumRule();
}
-// OD 2008-02-08 #newlistlevelattrs# - add handling of parameter <bResetIndentAttrs>
-// --> OD 2008-03-17 #refactorlists#
+
void SwDoc::SetNumRule( const SwPaM& rPam,
const SwNumRule& rRule,
const bool bCreateNewList,
const String sContinuedListId,
- sal_Bool bSetItem,
+ bool bSetItem,
const bool bResetIndentAttrs )
{
SwUndoInsNum * pUndo = NULL;
@@ -985,70 +952,69 @@ void SwDoc::SetNumRule( const SwPaM& rPam,
GetIDocumentUndoRedo().AppendUndo(pUndo);
}
- SwNumRule * pNew = FindNumRulePtr( rRule.GetName() );
- bool bUpdateRule = false;
-
- if( !pNew )
- {
- pNew = (*pNumRuleTbl)[ MakeNumRule( rRule.GetName(), &rRule ) ];
- }
- else if (rRule != *pNew)
+ SwNumRule* pNewOrChangedNumRule = FindNumRulePtr( rRule.GetName() );
+ bool bNewNumRuleCreated = false;
+ if ( pNewOrChangedNumRule == NULL )
{
- bUpdateRule = true;
+ // create new numbering rule based on given one
+ pNewOrChangedNumRule = ( *pNumRuleTbl )[MakeNumRule( rRule.GetName(), &rRule )];
+ bNewNumRuleCreated = true;
}
-
- if (bUpdateRule)
+ else if ( rRule != *pNewOrChangedNumRule )
{
- if( pUndo )
+ // change existing numbering rule
+ if( pUndo != NULL )
{
- pUndo->SaveOldNumRule( *pNew );
- ::lcl_ChgNumRule( *this, rRule );
- pUndo->SetLRSpaceEndPos();
+ pUndo->SaveOldNumRule( *pNewOrChangedNumRule );
}
- else
+ ::lcl_ChgNumRule( *this, rRule );
+ if( pUndo != NULL )
{
- ::lcl_ChgNumRule( *this, rRule );
+ pUndo->SetLRSpaceEndPos();
}
}
if ( bSetItem )
{
+ String sListId;
if ( bCreateNewList )
{
- String sListId;
- if ( !bUpdateRule )
+ if ( bNewNumRuleCreated )
{
// apply list id of list, which has been created for the new list style
- sListId = pNew->GetDefaultListId();
+ sListId = pNewOrChangedNumRule->GetDefaultListId();
}
else
{
// create new list and apply its list id
- SwList* pNewList = createList( String(), pNew->GetName() );
+ const SwList* pNewList = createList( String(), pNewOrChangedNumRule->GetName() );
ASSERT( pNewList,
"<SwDoc::SetNumRule(..)> - could not create new list. Serious defect -> please inform OD." );
sListId = pNewList->GetListId();
}
- InsertPoolItem( rPam, SfxStringItem( RES_PARATR_LIST_ID, sListId ), 0 );
}
else if ( sContinuedListId.Len() > 0 )
{
// apply given list id
- InsertPoolItem( rPam, SfxStringItem( RES_PARATR_LIST_ID, sContinuedListId ), 0 );
+ sListId = sContinuedListId;
+ }
+ if ( sListId.Len() > 0 )
+ {
+ InsertPoolItem( rPam, SfxStringItem( RES_PARATR_LIST_ID, sListId ), 0 );
}
}
- if ( ! rPam.HasMark())
+ if ( !rPam.HasMark() )
{
SwTxtNode * pTxtNd = rPam.GetPoint()->nNode.GetNode().GetTxtNode();
- // consider case that the PaM doesn't denote a text node - e.g. it denotes a graphic node
- if ( pTxtNd )
+ // robust code: consider case that the PaM doesn't denote a text node - e.g. it denotes a graphic node
+ if ( pTxtNd != NULL )
{
SwNumRule * pRule = pTxtNd->GetNumRule();
- if (pRule && pRule->GetName() == pNew->GetName())
+ if (pRule && pRule->GetName() == pNewOrChangedNumRule->GetName())
{
- bSetItem = sal_False;
+ bSetItem = false;
if ( !pTxtNd->IsInList() )
{
pTxtNd->AddToList();
@@ -1062,10 +1028,10 @@ void SwDoc::SetNumRule( const SwPaM& rPam,
if ( pColl )
{
SwNumRule* pCollRule = FindNumRulePtr(pColl->GetNumRule().GetValue());
- if ( pCollRule && pCollRule->GetName() == pNew->GetName() )
+ if ( pCollRule && pCollRule->GetName() == pNewOrChangedNumRule->GetName() )
{
pTxtNd->ResetAttr( RES_PARATR_NUMRULE );
- bSetItem = sal_False;
+ bSetItem = false;
}
}
}
@@ -1074,11 +1040,11 @@ void SwDoc::SetNumRule( const SwPaM& rPam,
if ( bSetItem )
{
- InsertPoolItem( rPam, SwNumRuleItem( pNew->GetName() ), 0 );
+ InsertPoolItem( rPam, SwNumRuleItem( pNewOrChangedNumRule->GetName() ), 0 );
}
- if ( bResetIndentAttrs &&
- pNew && pNew->Get( 0 ).GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
+ if ( bResetIndentAttrs
+ && pNewOrChangedNumRule->Get( 0 ).GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
{
SvUShortsSort aResetAttrsArray;
aResetAttrsArray.Insert( RES_LR_SPACE );
@@ -1107,6 +1073,7 @@ void SwDoc::SetNumRule( const SwPaM& rPam,
SetModified();
}
+
void SwDoc::SetCounted(const SwPaM & rPam, bool bCounted)
{
if ( bCounted )
@@ -1347,15 +1314,18 @@ void SwDoc::StopNumRuleAnimations( OutputDevice* pOut )
}
}
-sal_Bool SwDoc::ReplaceNumRule( const SwPosition& rPos,
- const String& rOldRule, const String& rNewRule )
+sal_Bool SwDoc::ReplaceNumRule(
+ const SwPosition& rPos,
+ const String& rOldRule,
+ const String& rNewRule )
{
sal_Bool bRet = sal_False;
- SwNumRule *pOldRule = FindNumRulePtr( rOldRule ),
- *pNewRule = FindNumRulePtr( rNewRule );
- if( pOldRule && pNewRule && pOldRule != pNewRule )
+ SwNumRule* pOldRule = FindNumRulePtr( rOldRule );
+ SwNumRule* pNewRule = FindNumRulePtr( rNewRule );
+ if ( pOldRule != NULL
+ && pNewRule != NULL
+ && pOldRule != pNewRule )
{
- // --> OD 2008-02-19 #refactorlists#
SwUndoInsNum* pUndo = 0;
if (GetIDocumentUndoRedo().DoesUndo())
{
@@ -1365,49 +1335,10 @@ sal_Bool SwDoc::ReplaceNumRule( const SwPosition& rPos,
GetIDocumentUndoRedo().AppendUndo(pUndo);
}
- // --> OD 2008-02-19 #refactorlists#
- // apply new list style <pNewRule> to all text nodes, which have the
- // old list style <pOldNRule> applied and belong to the same list as
- // the text node of the given <SwPosition>.
-// SwNumRuleInfo aUpd( rOldRule );
-// aUpd.MakeList( *this );
-
-// if (aUpd.GetList().Count() > 0) // #106897#
SwNumRule::tTxtNodeList aTxtNodeList;
pOldRule->GetTxtNodeList( aTxtNodeList );
if ( aTxtNodeList.size() > 0 )
{
-// // Position suchen und bestimme ob ein Node davor oder dahinter
-// // einen Start erzwingt
-// SwTxtNode* pTxtNd;
-// sal_uLong nFndPos, nFirst, nLast;
-
-// if( TABLE_ENTRY_NOTFOUND != aUpd.GetList().SearchKey(
-// rPos.nNode.GetIndex(), &nFndPos ))
-// ++nFndPos;
-
-// for( nLast = nFndPos; nLast < aUpd.GetList().Count(); ++nLast )
-// {
-// pTxtNd = aUpd.GetList().GetObject( nLast );
-// if(pTxtNd->IsRestart())
-// break;
-// }
-// for( nFirst = nFndPos; nFirst; )
-// {
-// pTxtNd = aUpd.GetList().GetObject( --nFirst );
-// if( pTxtNd->IsRestart() )
-// break;
-// }
-// // dann neue Numerierung ueber diesen Bereich
-// // definieren und den Start am Anfang/Ende zurueck setzen
-// pTxtNd = aUpd.GetList().GetObject( nFirst );
-// if( pTxtNd->IsRestart() )
-// {
-// pTxtNd->SetRestart(false);
-// if( pUndo )
-// pUndo->SetSttNum( pTxtNd->GetIndex() );
-// }
-
SwRegHistory aRegH( pUndo ? pUndo->GetHistory() : 0 );
sal_uInt16 nChgFmtLevel = 0;
for( sal_uInt8 n = 0; n < MAXLEVEL; ++n )
@@ -1422,15 +1353,6 @@ sal_Bool SwDoc::ReplaceNumRule( const SwPosition& rPos,
const SwTxtNode* pGivenTxtNode = rPos.nNode.GetNode().GetTxtNode();
SwNumRuleItem aRule( rNewRule );
-// for( ; nFirst < nLast; ++nFirst )
-// {
-// pTxtNd = aUpd.GetList().GetObject( nFirst );
-
-// aRegH.RegisterInModify( pTxtNd, *pTxtNd );
-
-// pTxtNd->SwCntntNode::SetAttr( aRule );
-// pTxtNd->NumRuleChgd();
-// }
for ( SwNumRule::tTxtNodeList::iterator aIter = aTxtNodeList.begin();
aIter != aTxtNodeList.end(); ++aIter )
{
@@ -1455,7 +1377,7 @@ sal_Bool SwDoc::ReplaceNumRule( const SwPosition& rPos,
return bRet;
}
-// --> OD 2008-03-18 #refactorlists#
+
namespace
{
struct ListStyleData
@@ -1471,22 +1393,17 @@ namespace
{}
};
}
-// <--
void SwDoc::MakeUniqueNumRules(const SwPaM & rPaM)
{
ASSERT( rPaM.GetDoc() == this, "need same doc" );
- // --> OD 2008-03-18 #refactorlists#
-// map<SwNumRule *, SwNumRule *> aMyNumRuleMap;
::std::map<SwNumRule *, ListStyleData> aMyNumRuleMap;
- // <--
-
- sal_uLong nStt = rPaM.Start()->nNode.GetIndex();
- sal_uLong nEnd = rPaM.End()->nNode.GetIndex();
bool bFirst = true;
+ const sal_uLong nStt = rPaM.Start()->nNode.GetIndex();
+ const sal_uLong nEnd = rPaM.End()->nNode.GetIndex();
for (sal_uLong n = nStt; n <= nEnd; n++)
{
SwTxtNode * pCNd = GetNodes()[n]->GetTxtNode();
@@ -1497,11 +1414,8 @@ void SwDoc::MakeUniqueNumRules(const SwPaM & rPaM)
if (pRule && pRule->IsAutoRule() && ! pRule->IsOutlineRule())
{
- // --> OD 2008-03-18 #refactorlists#
-// SwNumRule * pReplaceNumRule = aMyNumRuleMap[pRule];
ListStyleData aListStyleData = aMyNumRuleMap[pRule];
-// if (! pReplaceNumRule)
if ( aListStyleData.pReplaceNumRule == 0 )
{
if (bFirst)
@@ -1514,26 +1428,20 @@ void SwDoc::MakeUniqueNumRules(const SwPaM & rPaM)
aListStyleData.sListId, true ));
}
-// if (! pReplaceNumRule)
if ( aListStyleData.pReplaceNumRule == 0 )
{
-// pReplaceNumRule = new SwNumRule(*pRule);
-// pReplaceNumRule->SetName(GetUniqueNumRuleName());
aListStyleData.pReplaceNumRule = new SwNumRule(*pRule);
- // --> OD 2008-07-08 #i91400#
- aListStyleData.pReplaceNumRule->SetName(
- GetUniqueNumRuleName(), *this );
- // <--
+ aListStyleData.pReplaceNumRule->SetName( GetUniqueNumRuleName(), *this );
aListStyleData.bCreateNewList = true;
}
-// aMyNumRuleMap[pRule] = pReplaceNumRule;
aMyNumRuleMap[pRule] = aListStyleData;
}
SwPaM aPam(*pCNd);
- SetNumRule( aPam, *aListStyleData.pReplaceNumRule,
+ SetNumRule( aPam,
+ *aListStyleData.pReplaceNumRule,
aListStyleData.bCreateNewList,
aListStyleData.sListId );
if ( aListStyleData.bCreateNewList )
@@ -2401,16 +2309,13 @@ sal_Bool SwDoc::NumOrNoNum( const SwNodeIndex& rIdx, sal_Bool bDel )
return bResult;
}
-SwNumRule* SwDoc::GetCurrNumRule( const SwPosition& rPos ) const
+SwNumRule* SwDoc::GetNumRuleAtPos( const SwPosition& rPos ) const
{
- SwNumRule* pRet = 0;
+ SwNumRule* pRet = NULL;
SwTxtNode* pTNd = rPos.nNode.GetNode().GetTxtNode();
- if( pTNd )
+ if ( pTNd != NULL )
{
- // --> OD 2008-02-20 #refactorlists#
-// pTNd->SyncNumberAndNumRule();
- // <--
pRet = pTNd->GetNumRule();
}
@@ -2602,7 +2507,7 @@ void SwDoc::UpdateNumRule()
rNmTbl[ n ]->Validate();
}
-// --> OD 2008-04-02 #refactorlists#
+
void SwDoc::MarkListLevel( const String& sListId,
const int nListLevel,
const sal_Bool bValue )
@@ -2622,27 +2527,22 @@ void SwDoc::MarkListLevel( SwList& rList,
// Set new marked list level and notify all affected nodes of the changed mark.
rList.MarkListLevel( nListLevel, bValue );
}
-// <- #i27615#
-// <--
-// #i23726#
-sal_Bool SwDoc::IsFirstOfNumRule(SwPosition & rPos)
+
+bool SwDoc::IsFirstOfNumRuleAtPos( const SwPosition & rPos )
{
- sal_Bool bResult = sal_False;
- SwTxtNode * pTxtNode = rPos.nNode.GetNode().GetTxtNode();
+ bool bResult = false;
- if (pTxtNode)
+ const SwTxtNode* pTxtNode = rPos.nNode.GetNode().GetTxtNode();
+ if ( pTxtNode != NULL )
{
- SwNumRule * pNumRule = pTxtNode->GetNumRule();
-
- if (pNumRule)
- bResult = pTxtNode->IsFirstOfNumRule();
+ bResult = pTxtNode->IsFirstOfNumRule();
}
return bResult;
}
-// --> OD 2007-10-26 #i83479#
+
// implementation for interface <IDocumentListItems>
bool SwDoc::lessThanNodeNum::operator()( const SwNodeNum* pNodeNumOne,
const SwNodeNum* pNodeNumTwo ) const
@@ -2722,9 +2622,8 @@ void SwDoc::getNumItems( tSortedNodeNumList& orNodeNumList ) const
}
}
}
-// <--
-// --> OD 2007-11-15 #i83479#
+
// implementation for interface <IDocumentOutlineNodes>
sal_Int32 SwDoc::getOutlineNodesCount() const
{
diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx
index d1b487c..11d300a 100644
--- a/sw/source/core/docnode/ndcopy.cxx
+++ b/sw/source/core/docnode/ndcopy.cxx
@@ -1306,13 +1306,16 @@ bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos,
*pCpyRange->GetMark() = *aCpyPam.GetMark();
}
- if ( pNumRuleToPropagate )
+ if ( pNumRuleToPropagate != NULL )
{
- // --> OD 2009-08-25 #i86492#
- // use <SwDoc::SetNumRule(..)>, because it also handles the <ListId>
-// pDoc->ReplaceNumRule(aCpyPam, *pNumRuleToPropagate);
- pDoc->SetNumRule( aCpyPam, *pNumRuleToPropagate, false,
- aListIdToPropagate, sal_True, true );
+ // replace list
+ pDoc->SetNumRule(
+ aCpyPam,
+ *pNumRuleToPropagate,
+ false,
+ aListIdToPropagate,
+ true,
+ true );
}
pDoc->SetRedlineMode_intern( eOld );
diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index d56748a..e03ebbc 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -1663,24 +1663,23 @@ void SwAutoFormat::BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel )
bChgEnum = sal_False;
}
- if( bChgEnum || bChgBullet )
+ if ( bChgEnum || bChgBullet )
{
aDelPam.DeleteMark();
aDelPam.GetPoint()->nNode = aNdIdx;
- if( aFlags.bSetNumRule )
+ if ( aFlags.bSetNumRule )
{
- if( aFlags.bAFmtByInput )
+ if ( aFlags.bAFmtByInput )
{
aDelPam.SetMark();
aDelPam.GetMark()->nNode++;
- aDelPam.GetNode(sal_False)->GetTxtNode()->SetAttrListLevel( nLvl );
+ aDelPam.GetNode( sal_False )->GetTxtNode()->SetAttrListLevel( nLvl );
}
- pAktTxtNd->SetAttrListLevel(nLvl);
+ pAktTxtNd->SetAttrListLevel( nLvl );
pAktTxtNd->SetNumLSpace( sal_True );
- // --> OD 2008-03-17 #refactorlists#
// start new list
pDoc->SetNumRule( aDelPam, aRule, true );
// <--
@@ -1689,45 +1688,47 @@ void SwAutoFormat::BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel )
aDelPam.GetPoint()->nContent.Assign( pAktTxtNd, 0 );
}
else
- aDelPam.GetPoint()->nContent.Assign( pAktTxtNd,
- bChgEnum ? (nTxtStt - nOrigTxtStt) : 0 );
+ {
+ aDelPam.GetPoint()->nContent.Assign( pAktTxtNd, bChgEnum ? ( nTxtStt - nOrigTxtStt ) : 0 );
+ }
aDelPam.SetMark();
- if( bChgBullet )
+ if ( bChgBullet )
nTxtStt += 2;
- while( nTxtStt < rStr.Len() && IsSpace( rStr.GetChar( nTxtStt ) ))
+ while (nTxtStt < rStr.Len() && IsSpace( rStr.GetChar( nTxtStt ) ))
nTxtStt++;
aDelPam.GetPoint()->nContent = nTxtStt - nOrigTxtStt;
DeleteSel( aDelPam );
- if( !aFlags.bSetNumRule )
+ if ( !aFlags.bSetNumRule )
{
String sChgStr( '\t' );
- if( bChgBullet )
+ if ( bChgBullet )
sChgStr.Insert( aFlags.cBullet, 0 );
pDoc->InsertString( aDelPam, sChgStr );
SfxItemSet aSet( pDoc->GetAttrPool(), aTxtNodeSetRange );
- if( bChgBullet )
+ if ( bChgBullet )
{
aDelPam.GetPoint()->nContent = 0;
aDelPam.SetMark();
aDelPam.GetMark()->nContent = 1;
SetAllScriptItem( aSet,
- SvxFontItem( aFlags.aBulletFont.GetFamily(),
- aFlags.aBulletFont.GetName(),
- aFlags.aBulletFont.GetStyleName(),
- aFlags.aBulletFont.GetPitch(),
- aFlags.aBulletFont.GetCharSet(),
- RES_CHRATR_FONT ) );
+ SvxFontItem( aFlags.aBulletFont.GetFamily(),
+ aFlags.aBulletFont.GetName(),
+ aFlags.aBulletFont.GetStyleName(),
+ aFlags.aBulletFont.GetPitch(),
+ aFlags.aBulletFont.GetCharSet(),
+ RES_CHRATR_FONT ) );
pDoc->SetFmtItemByAutoFmt( aDelPam, aSet );
aDelPam.DeleteMark();
nAutoCorrPos = 2;
aSet.ClearItem();
}
- SvxTabStopItem aTStops( RES_PARATR_TABSTOP ); aTStops.Insert( SvxTabStop( 0 ));
+ SvxTabStopItem aTStops( RES_PARATR_TABSTOP );
+ aTStops.Insert( SvxTabStop( 0 ) );
aSet.Put( aTStops );
pDoc->SetFmtItemByAutoFmt( aDelPam, aSet );
}
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx
index bbb2e93..dc39752 100644
--- a/sw/source/core/edit/ednumber.cxx
+++ b/sw/source/core/edit/ednumber.cxx
@@ -352,101 +352,63 @@ sal_Bool SwEditShell::NumUpDown( sal_Bool bDown )
EndAllAction();
return bRet;
}
-// -> #i23726#
-sal_Bool SwEditShell::IsFirstOfNumRule() const
-{
- sal_Bool bResult = sal_False;
-
- SwPaM * pCrsr = GetCrsr();
- if (pCrsr->GetNext() == pCrsr)
- {
- bResult = IsFirstOfNumRule(*pCrsr);
- }
- return bResult;
-}
-sal_Bool SwEditShell::IsFirstOfNumRule(const SwPaM & rPaM) const
+bool SwEditShell::IsFirstOfNumRuleAtCrsrPos() const
{
- sal_Bool bResult = sal_False;
-
- SwPosition aPos(*rPaM.GetPoint());
- bResult = GetDoc()->IsFirstOfNumRule(aPos);
-
- return bResult;
+ return GetDoc()->IsFirstOfNumRuleAtPos( *GetCrsr()->GetPoint() );
}
-// <- #i23726#
-// -> #i23725#
-// --> OD 2008-06-09 #i90078#
-// Remove unused default parameter <nLevel> and <bRelative>.
-// Adjust method name and parameter name
-void SwEditShell::ChangeIndentOfAllListLevels( short nDiff )
+
+void SwEditShell::ChangeIndentOfAllListLevels( const short nDiff )
{
StartAllAction();
- const SwNumRule *pCurNumRule = GetCurNumRule();
- //#120911# check if numbering rule really exists
- if (pCurNumRule)
+ const SwNumRule *pCurNumRule = GetNumRuleAtCurrCrsrPos();
+ if ( pCurNumRule != NULL )
{
SwNumRule aRule(*pCurNumRule);
- // --> OD 2008-06-09 #i90078#
aRule.ChangeIndent( nDiff );
- // <--
- // --> OD 2008-03-17 #refactorlists#
- // no start of new list
SetCurNumRule( aRule, false );
- // <--
}
EndAllAction();
}
-// --> OD 2008-06-09 #i90078#
-// Adjust method name
-void SwEditShell::SetIndent(short nIndent, const SwPosition & rPos)
-// <--
+
+void SwEditShell::SetIndent(
+ short nIndent,
+ const SwPosition & rPos )
{
StartAllAction();
- SwNumRule *pCurNumRule = GetDoc()->GetCurrNumRule(rPos);
+ SwNumRule *pCurNumRule = GetDoc()->GetNumRuleAtPos(rPos);
if (pCurNumRule)
{
- SwPaM aPaM(rPos);
- SwTxtNode * pTxtNode = aPaM.GetNode()->GetTxtNode();
-
- // --> OD 2008-06-09 #i90078#
-// int nLevel = -1;
-// int nReferenceLevel = pTxtNode->GetActualListLevel();
-// if (! IsFirstOfNumRule(aPaM))
-// nLevel = nReferenceLevel;
-
SwNumRule aRule(*pCurNumRule);
-// aRule.ChangeIndent(nIndent, nLevel, nReferenceLevel, sal_False);
- if ( IsFirstOfNumRule() )
+ if ( !IsMultiSelection() && IsFirstOfNumRuleAtCrsrPos() )
{
aRule.SetIndentOfFirstListLevelAndChangeOthers( nIndent );
}
- else if ( pTxtNode->GetActualListLevel() >= 0 )
+ else
{
- aRule.SetIndent( nIndent,
- static_cast<sal_uInt16>(pTxtNode->GetActualListLevel()) );
+ const SwTxtNode* pTxtNode = rPos.nNode.GetNode().GetTxtNode();
+ if ( pTxtNode != NULL
+ && pTxtNode->GetActualListLevel() >= 0 )
+ {
+ aRule.SetIndent( nIndent, static_cast< sal_uInt16 >( pTxtNode->GetActualListLevel() ) );
+ }
}
- // <--
- // --> OD 2005-02-18 #i42921# - 3rd parameter = false in order to
- // suppress setting of num rule at <aPaM>.
- // --> OD 2008-03-17 #refactorlists#
- // do not apply any list
- GetDoc()->SetNumRule( aPaM, aRule, false, String(), sal_False );
- // <--
+ // change numbering rule - changed numbering rule is not applied at <aPaM>
+ SwPaM aPaM(rPos);
+ GetDoc()->SetNumRule( aPaM, aRule, false, String(), false );
}
EndAllAction();
}
-// <- #i23725#
sal_Bool SwEditShell::MoveParagraph( long nOffset )
{
@@ -758,13 +720,51 @@ sal_uInt8 SwEditShell::GetNumLevel() const
return nLevel;
}
-const SwNumRule* SwEditShell::GetCurNumRule() const
+const SwNumRule* SwEditShell::GetNumRuleAtCurrCrsrPos() const
{
- return GetDoc()->GetCurrNumRule( *GetCrsr()->GetPoint() );
+ return GetDoc()->GetNumRuleAtPos( *GetCrsr()->GetPoint() );
}
-// OD 2008-02-08 #newlistlevelattrs# - add handling of parameter <bResetIndentAttrs>
-// --> OD 2008-03-17 #refactorlists#
+const SwNumRule* SwEditShell::GetNumRuleAtCurrentSelection() const
+{
+ const SwNumRule* pNumRuleAtCurrentSelection = NULL;
+
+ const SwPaM* pCurrentCrsr = GetCrsr();
+ bool bDifferentNumRuleFound = false;
+ const SwPaM* pCrsr = pCurrentCrsr;
+ do
+ {
+ const SwNodeIndex aEndNode = pCrsr->End()->nNode;
+
+ for ( SwNodeIndex aNode = pCrsr->Start()->nNode; aNode <= aEndNode; aNode++ )
+ {
+ const SwNumRule* pNumRule = GetDoc()->GetNumRuleAtPos( SwPosition( aNode ) );
+ if ( pNumRule == NULL )
+ {
+ continue;
+ }
+ else if ( pNumRule != pNumRuleAtCurrentSelection )
+ {
+ if ( pNumRuleAtCurrentSelection == NULL )
+ {
+ pNumRuleAtCurrentSelection = pNumRule;
+ }
+ else
+ {
+ pNumRuleAtCurrentSelection = NULL;
+ bDifferentNumRuleFound = true;
+ break;
+ }
+ }
+ }
+
+ pCrsr = static_cast< const SwPaM* >(pCrsr->GetNext());
+ } while ( !bDifferentNumRuleFound && pCrsr != pCurrentCrsr );
+
+ return pNumRuleAtCurrentSelection;
+}
+
+
void SwEditShell::SetCurNumRule( const SwNumRule& rRule,
const bool bCreateNewList,
const String sContinuedListId,
@@ -784,7 +784,7 @@ void SwEditShell::SetCurNumRule( const SwNumRule& rRule,
aRangeArr.SetPam( n, aPam );
GetDoc()->SetNumRule( aPam, rRule,
bCreateNewList, sContinuedListId,
- sal_True, bResetIndentAttrs );
+ true, bResetIndentAttrs );
GetDoc()->SetCounted( aPam, true );
}
}
@@ -792,7 +792,7 @@ void SwEditShell::SetCurNumRule( const SwNumRule& rRule,
{
GetDoc()->SetNumRule( *pCrsr, rRule,
bCreateNewList, sContinuedListId,
- sal_True, bResetIndentAttrs );
+ true, bResetIndentAttrs );
GetDoc()->SetCounted( *pCrsr, true );
}
GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
@@ -800,6 +800,7 @@ void SwEditShell::SetCurNumRule( const SwNumRule& rRule,
EndAllAction();
}
+
String SwEditShell::GetUniqueNumRuleName( const String* pChkStr, sal_Bool bAutoNum ) const
{
return GetDoc()->GetUniqueNumRuleName( pChkStr, bAutoNum );
diff --git a/sw/source/core/undo/unnum.cxx b/sw/source/core/undo/unnum.cxx
index 84ebf3d..c9e2084 100644
--- a/sw/source/core/undo/unnum.cxx
+++ b/sw/source/core/undo/unnum.cxx
@@ -136,22 +136,18 @@ void SwUndoInsNum::RedoImpl(::sw::UndoRedoContext & rContext)
{
SwDoc & rDoc = rContext.GetDoc();
- if( pOldNumRule )
+ if ( pOldNumRule )
rDoc.ChgNumRuleFmts( aNumRule );
- else if( pHistory )
+ else if ( pHistory )
{
- SwPaM & rPam( AddUndoRedoPaM(rContext) );
- if( sReplaceRule.Len() )
+ SwPaM & rPam( AddUndoRedoPaM( rContext ) );
+ if ( sReplaceRule.Len() )
{
- rDoc.ReplaceNumRule(*rPam.GetPoint(),
- sReplaceRule, aNumRule.GetName() );
+ rDoc.ReplaceNumRule( *rPam.GetPoint(), sReplaceRule, aNumRule.GetName() );
}
else
{
- // --> OD 2005-02-25 #i42921# - adapt to changed signature
- // --> OD 2008-03-18 #refactorlists#
- rDoc.SetNumRule(rPam, aNumRule, false);
- // <--
+ rDoc.SetNumRule( rPam, aNumRule, false );
}
}
}
@@ -164,15 +160,12 @@ void SwUndoInsNum::SetLRSpaceEndPos()
void SwUndoInsNum::RepeatImpl(::sw::RepeatContext & rContext)
{
- SwDoc & rDoc(rContext.GetDoc());
- if( nSttNode )
+ SwDoc & rDoc( rContext.GetDoc() );
+ if ( nSttNode )
{
- if( !sReplaceRule.Len() )
+ if ( !sReplaceRule.Len() )
{
- // --> OD 2005-02-25 #i42921# - adapt to changed signature
- // --> OD 2008-03-18 #refactorlists#
- rDoc.SetNumRule(rContext.GetRepeatPaM(), aNumRule, false);
- // <--
+ rDoc.SetNumRule( rContext.GetRepeatPaM(), aNumRule, false );
}
}
else
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx
index 981e22c..4b25c4c 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -307,7 +307,7 @@ sal_Bool getCrsrPropertyValue(
getNumberingProperty(rPam, eNewState, pAny);
else
{
- if( !rPam.GetDoc()->GetCurrNumRule( *rPam.GetPoint() ) )
+ if( !rPam.GetDoc()->GetNumRuleAtPos( *rPam.GetPoint() ) )
eNewState = PropertyState_DEFAULT_VALUE;
}
break;
@@ -686,55 +686,42 @@ void setNumberingProperty(const Any& rValue, SwPaM& rPam)
}
UnoActionContext aAction(pDoc);
- if( rPam.GetNext() != &rPam ) // Mehrfachselektion ?
+ if ( rPam.GetNext() != &rPam ) // Mehrfachselektion ?
{
pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
SwPamRanges aRangeArr( rPam );
SwPaM aPam( *rPam.GetPoint() );
- for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
+ for ( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
{
- // --> OD 2008-03-17 #refactorlists#
- // no start of a new list
pDoc->SetNumRule( aRangeArr.SetPam( n, aPam ), aRule, false );
- // <--
}
pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
}
else
{
- // --> OD 2008-03-17 #refactorlists#
- // no start of a new list
pDoc->SetNumRule( rPam, aRule, false );
- // <--
}
-
-
}
- else if(pSwNum->GetCreatedNumRuleName().Len())
+ else if ( pSwNum->GetCreatedNumRuleName().Len() )
{
- UnoActionContext aAction(pDoc);
+ UnoActionContext aAction( pDoc );
SwNumRule* pRule = pDoc->FindNumRulePtr( pSwNum->GetCreatedNumRuleName() );
- if(!pRule)
+ if ( !pRule )
throw RuntimeException();
- // --> OD 2008-03-17 #refactorlists#
- // no start of a new list
pDoc->SetNumRule( rPam, *pRule, false );
- // <--
}
- // --> OD 2009-08-18 #i103817#
- // outline numbering
else
{
+ // outline numbering
UnoActionContext aAction(pDoc);
SwNumRule* pRule = pDoc->GetOutlineNumRule();
if(!pRule)
throw RuntimeException();
pDoc->SetNumRule( rPam, *pRule, false );
}
- // <--
}
}
- else if(rValue.getValueType() == ::getVoidCppuType())
+ else if ( rValue.getValueType() == ::getVoidCppuType() )
{
rPam.GetDoc()->DelNumRules(rPam);
}
@@ -746,7 +733,7 @@ void setNumberingProperty(const Any& rValue, SwPaM& rPam)
* --------------------------------------------------*/
void getNumberingProperty(SwPaM& rPam, PropertyState& eState, Any * pAny )
{
- const SwNumRule* pNumRule = rPam.GetDoc()->GetCurrNumRule( *rPam.GetPoint() );
+ const SwNumRule* pNumRule = rPam.GetDoc()->GetNumRuleAtPos( *rPam.GetPoint() );
if(pNumRule)
{
uno::Reference< XIndexReplace > xNum = new SwXNumberingRules(*pNumRule);
diff --git a/sw/source/filter/ww1/fltshell.cxx b/sw/source/filter/ww1/fltshell.cxx
index dc6f02c..da30ca2 100644
--- a/sw/source/filter/ww1/fltshell.cxx
+++ b/sw/source/filter/ww1/fltshell.cxx
@@ -521,34 +521,31 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, SwFltStackEntry*
break;
case RES_FLTR_NUMRULE: // Numrule 'reinsetzen
+ {
+ const String& rNumNm = ( (SfxStringItem*) pEntry->pAttr )->GetValue();
+ SwNumRule* pNumRule = pDoc->FindNumRulePtr( rNumNm );
+ if ( pNumRule )
{
- const String& rNumNm = ((SfxStringItem*)pEntry->pAttr)->GetValue();
- SwNumRule* pRul = pDoc->FindNumRulePtr( rNumNm );
- if( pRul )
+ if ( pEntry->MakeRegion( pDoc, aRegion, sal_True ) )
{
- if( pEntry->MakeRegion(pDoc, aRegion, sal_True))
+ SwNodeIndex aTmpStart( aRegion.Start()->nNode );
+ SwNodeIndex aTmpEnd( aTmpStart );
+ SwNodeIndex& rRegEndNd = aRegion.End()->nNode;
+ while (IterateNumrulePiece( rRegEndNd, aTmpStart, aTmpEnd ))
{
- SwNodeIndex aTmpStart( aRegion.Start()->nNode );
- SwNodeIndex aTmpEnd( aTmpStart );
- SwNodeIndex& rRegEndNd = aRegion.End()->nNode;
- while( IterateNumrulePiece( rRegEndNd,
- aTmpStart, aTmpEnd ) )
- {
- SwPaM aTmpPam( aTmpStart, aTmpEnd );
- // --> OD 2008-03-17 #refactorlists#
- // no start of a new list
- pDoc->SetNumRule( aTmpPam, *pRul, false );
- // <--
-
- aTmpStart = aTmpEnd; // Start fuer naechstes Teilstueck
- aTmpStart++;
- }
+ SwPaM aTmpPam( aTmpStart, aTmpEnd );
+ pDoc->SetNumRule( aTmpPam, *pNumRule, false );
+
+ aTmpStart = aTmpEnd; // Start fuer naechstes Teilstueck
+ aTmpStart++;
}
- else
- pDoc->DelNumRule( rNumNm );
}
+ else
+ pDoc->DelNumRule( rNumNm );
}
+ }
break;
+
case RES_FLTR_NUMRULE_NUM:
break;
case RES_FLTR_BOOKMARK:
diff --git a/sw/source/ui/app/docst.cxx b/sw/source/ui/app/docst.cxx
index 3da2638..f2f8691 100644
--- a/sw/source/ui/app/docst.cxx
+++ b/sw/source/ui/app/docst.cxx
@@ -219,7 +219,7 @@ void SwDocShell::StateStyleSheet(SfxItemSet& rSet, SwWrtShell* pSh)
break;
case SID_STYLE_FAMILY5:
{
- const SwNumRule* pRule = pShell->GetCurNumRule();
+ const SwNumRule* pRule = pShell->GetNumRuleAtCurrCrsrPos();
if( pRule )
aName = pRule->GetName();
@@ -239,7 +239,7 @@ void SwDocShell::StateStyleSheet(SfxItemSet& rSet, SwWrtShell* pSh)
? SFX_STYLE_FAMILY_FRAME != nActualFamily
: ( SFX_STYLE_FAMILY_FRAME == nActualFamily ||
SFX_STYLE_FAMILY_PAGE == nActualFamily ||
- (SFX_STYLE_FAMILY_PSEUDO == nActualFamily && !pShell->GetCurNumRule())) )
+ (SFX_STYLE_FAMILY_PSEUDO == nActualFamily && !pShell->GetNumRuleAtCurrCrsrPos())) )
{
rSet.DisableItem( nWhich );
}
@@ -249,7 +249,7 @@ void SwDocShell::StateStyleSheet(SfxItemSet& rSet, SwWrtShell* pSh)
if( (pShell->IsFrmSelected()
? SFX_STYLE_FAMILY_FRAME != nActualFamily
: SFX_STYLE_FAMILY_FRAME == nActualFamily) ||
- (SFX_STYLE_FAMILY_PSEUDO == nActualFamily && !pShell->GetCurNumRule()) )
+ (SFX_STYLE_FAMILY_PSEUDO == nActualFamily && !pShell->GetNumRuleAtCurrCrsrPos()) )
{
rSet.DisableItem( nWhich );
}
@@ -857,65 +857,68 @@ sal_uInt16 SwDocShell::Delete(const String &rName, sal_uInt16 nFamily)
--------------------------------------------------------------------*/
-sal_uInt16 SwDocShell::ApplyStyles(const String &rName, sal_uInt16 nFamily,
- SwWrtShell* pShell, sal_uInt16 nMode )
+sal_uInt16 SwDocShell::ApplyStyles(
+ const String &rName,
+ const sal_uInt16 nFamily,
+ SwWrtShell* pShell,
+ const sal_uInt16 nMode )
{
- SwDocStyleSheet* pStyle =
- (SwDocStyleSheet*)mxBasePool->Find(rName, (SfxStyleFamily)nFamily);
+ SwDocStyleSheet* pStyle = (SwDocStyleSheet*) mxBasePool->Find( rName, (SfxStyleFamily) nFamily );
- ASSERT(pStyle, "Wo ist der StyleSheet");
- if(!pStyle)
+ ASSERT( pStyle, "Wo ist der StyleSheet" );
+ if ( !pStyle )
return sal_False;
SwWrtShell *pSh = pShell ? pShell : GetWrtShell();
- ASSERT( pSh, "Keine Shell, keine Styles");
+ ASSERT( pSh, "Keine Shell, keine Styles" );
pSh->StartAllAction();
- switch(nFamily)
+ switch (nFamily)
{
- case SFX_STYLE_FAMILY_CHAR:
- {
- SwFmtCharFmt aFmt(pStyle->GetCharFmt());
- pSh->SetAttrItem( aFmt, (nMode & KEY_SHIFT) ?
- nsSetAttrMode::SETATTR_DONTREPLACE : nsSetAttrMode::SETATTR_DEFAULT );
- break;
- }
- case SFX_STYLE_FAMILY_PARA:
- {
- // --> OD 2007-11-06 #i62675#
- // clear also list attributes at affected text nodes, if paragraph
- // style has the list style attribute set.
- pSh->SetTxtFmtColl( pStyle->GetCollection(), true );
- // <--
- break;
- }
- case SFX_STYLE_FAMILY_FRAME:
- {
- if ( pSh->IsFrmSelected() )
- pSh->SetFrmFmt( pStyle->GetFrmFmt() );
- break;
- }
- case SFX_STYLE_FAMILY_PAGE:
- {
- pSh->SetPageStyle(pStyle->GetPageDesc()->GetName());
- break;
- }
- case SFX_STYLE_FAMILY_PSEUDO:
- {
- // --> OD 2008-02-08 #newlistlevelattrs#
- // reset indent attribute on applying list style
- // --> OD 2008-03-17 #refactorlists#
- // continue list of list style
- const SwNumRule* pNumRule = pStyle->GetNumRule();
- const String sListIdForStyle =pNumRule->GetDefaultListId();
- pSh->SetCurNumRule( *pNumRule, false, sListIdForStyle, true );
- // <--
- break;
- }
- default:
- DBG_ERROR("Unbekannte Familie");
+ case SFX_STYLE_FAMILY_CHAR:
+ {
+ SwFmtCharFmt aFmt( pStyle->GetCharFmt() );
+ pSh->SetAttrItem( aFmt, ( nMode & KEY_SHIFT ) ? nsSetAttrMode::SETATTR_DONTREPLACE : nsSetAttrMode::SETATTR_DEFAULT );
+ break;
+ }
+ case SFX_STYLE_FAMILY_PARA:
+ {
+ // --> OD 2007-11-06 #i62675#
+ // clear also list attributes at affected text nodes, if paragraph
+ // style has the list style attribute set.
+ pSh->SetTxtFmtColl( pStyle->GetCollection(), true );
+ // <--
+ break;
+ }
+ case SFX_STYLE_FAMILY_FRAME:
+ {
+ if ( pSh->IsFrmSelected() )
+ pSh->SetFrmFmt( pStyle->GetFrmFmt() );
+ break;
+ }
+ case SFX_STYLE_FAMILY_PAGE:
+ {
+ pSh->SetPageStyle( pStyle->GetPageDesc()->GetName() );
+ break;
+ }
+
+ case SFX_STYLE_FAMILY_PSEUDO:
+ {
+ // --> OD 2008-02-08 #newlistlevelattrs#
+ // reset indent attribute on applying list style
+ // --> OD 2008-03-17 #refactorlists#
+ // continue list of list style
+ const SwNumRule* pNumRule = pStyle->GetNumRule();
+ const String sListIdForStyle = pNumRule->GetDefaultListId();
+ pSh->SetCurNumRule( *pNumRule, false, sListIdForStyle, true );
+ // <--
+ break;
+ }
+
+ default:
+ DBG_ERROR( "Unbekannte Familie" );
}
pSh->EndAllAction();
@@ -1058,7 +1061,7 @@ sal_uInt16 SwDocShell::UpdateStyle(const String &rName, sal_uInt16 nFamily, SwWr
{
const SwNumRule* pCurRule;
if( pStyle->GetNumRule() &&
- 0 != ( pCurRule = pCurrWrtShell->GetCurNumRule() ))
+ 0 != ( pCurRule = pCurrWrtShell->GetNumRuleAtCurrCrsrPos() ))
{
SwNumRule aRule( *pCurRule );
// --> OD 2008-07-08 #i91400#
@@ -1219,7 +1222,7 @@ sal_uInt16 SwDocShell::MakeByExample( const String &rName, sal_uInt16 nFamily,
{
pCurrWrtShell->StartAllAction();
- SwNumRule aRule( *pCurrWrtShell->GetCurNumRule() );
+ SwNumRule aRule( *pCurrWrtShell->GetNumRuleAtCurrCrsrPos() );
String sOrigRule( aRule.GetName() );
// --> OD 2008-07-08 #i91400#
aRule.SetName( pStyle->GetNumRule()->GetName(),
diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
index 3e3aed7..7764701 100644
--- a/sw/source/ui/docvw/edtwin.cxx
+++ b/sw/source/ui/docvw/edtwin.cxx
@@ -1819,8 +1819,8 @@ KEYINPUT_CHECKTABLE_INSDEL:
//RETURN und leerer Absatz in Numerierung -> Num. beenden
else if( !aInBuffer.Len() &&
- rSh.GetCurNumRule() &&
- !rSh.GetCurNumRule()->IsOutlineRule() &&
+ rSh.GetNumRuleAtCurrCrsrPos() &&
+ !rSh.GetNumRuleAtCurrCrsrPos()->IsOutlineRule() &&
!rSh.HasSelection() &&
rSh.IsSttPara() && rSh.IsEndPara() )
eKeyState = KS_NumOff, eNextKeyState = KS_OutlineLvOff;
@@ -1840,7 +1840,7 @@ KEYINPUT_CHECKTABLE_INSDEL:
case KEY_RETURN | KEY_MOD2: // ALT-Return
if ( !rSh.HasReadonlySel()
&& !rSh.IsSttPara()
- && rSh.GetCurNumRule()
+ && rSh.GetNumRuleAtCurrCrsrPos()
&& !rSh.CrsrInsideInputFld() )
{
eKeyState = KS_NoNum;
@@ -1864,7 +1864,7 @@ KEYINPUT_CHECKTABLE_INSDEL:
const bool bOnlyBackspaceKey( KEY_BACKSPACE == rKeyCode.GetFullCode() );
if ( rSh.IsSttPara()
&& !rSh.HasSelection()
- && ( rSh.GetCurNumRule() == NULL
+ && ( rSh.GetNumRuleAtCurrCrsrPos() == NULL
|| ( rSh.IsNoNum() && bOnlyBackspaceKey ) ) )
{
bDone = rSh.TryRemoveIndent();
@@ -1917,7 +1917,7 @@ KEYINPUT_CHECKTABLE_INSDEL:
&& rSh.IsEndPara()
&& !rSh.HasSelection() )
{
- const SwNumRule* pCurrNumRule( rSh.GetCurNumRule() );
+ const SwNumRule* pCurrNumRule( rSh.GetNumRuleAtCurrCrsrPos() );
if ( pCurrNumRule != NULL
&& pCurrNumRule != rSh.GetOutlineNumRule() )
{
@@ -1957,12 +1957,13 @@ KEYINPUT_CHECKTABLE_INSDEL:
GetView().GetViewFrame()->GetDispatcher()->Execute( FN_GOTO_NEXT_INPUTFLD );
eKeyState = KS_Ende;
}
- else if( rSh.GetCurNumRule()
+ else if( rSh.GetNumRuleAtCurrCrsrPos()
&& rSh.IsSttOfPara()
&& !rSh.HasReadonlySel() )
{
- if ( rSh.IsFirstOfNumRule() &&
- numfunc::ChangeIndentOnTabAtFirstPosOfFirstListItem() )
+ if ( !rSh.IsMultiSelection()
+ && rSh.IsFirstOfNumRuleAtCrsrPos()
+ && numfunc::ChangeIndentOnTabAtFirstPosOfFirstListItem() )
eKeyState = KS_NumIndentInc;
else
eKeyState = KS_NumDown;
@@ -2016,12 +2017,13 @@ KEYINPUT_CHECKTABLE_INSDEL:
GetView().GetViewFrame()->GetDispatcher()->Execute( FN_GOTO_PREV_INPUTFLD );
eKeyState = KS_Ende;
}
- else if( rSh.GetCurNumRule()
+ else if( rSh.GetNumRuleAtCurrCrsrPos()
&& rSh.IsSttOfPara()
&& !rSh.HasReadonlySel() )
{
- if ( rSh.IsFirstOfNumRule() &&
- numfunc::ChangeIndentOnTabAtFirstPosOfFirstListItem() )
+ if ( !rSh.IsMultiSelection()
+ && rSh.IsFirstOfNumRuleAtCrsrPos()
+ && numfunc::ChangeIndentOnTabAtFirstPosOfFirstListItem() )
eKeyState = KS_NumIndentDec;
else
eKeyState = KS_NumUp;
@@ -4896,11 +4898,11 @@ void SwEditWin::Command( const CommandEvent& rCEvt )
pItem = new SvxPostureItem( ITALIC_NONE, RES_CHRATR_POSTURE );
break;
case DICTATIONCOMMAND_NUMBERING_ON:
- if ( !rSh.GetCurNumRule() )
+ if ( !rSh.GetNumRuleAtCurrCrsrPos() )
nSlotId = FN_NUM_NUMBERING_ON;
break;
case DICTATIONCOMMAND_NUMBERING_OFF:
- if ( rSh.GetCurNumRule() )
+ if ( rSh.GetNumRuleAtCurrCrsrPos() )
nSlotId = FN_NUM_NUMBERING_ON;
break;
case DICTATIONCOMMAND_TAB:
diff --git a/sw/source/ui/inc/textsh.hxx b/sw/source/ui/inc/textsh.hxx
index f91b849..5163c01 100644
--- a/sw/source/ui/inc/textsh.hxx
+++ b/sw/source/ui/inc/textsh.hxx
@@ -35,11 +35,16 @@ class SwTextShell: public SwBaseShell
SwFldMgr* pPostItFldMgr;
void InsertSymbol( SfxRequest& );
- void InsertHyperlink(const SvxHyperlinkItem& rHlnkItem);
+ void InsertHyperlink( const SvxHyperlinkItem& rHlnkItem );
bool InsertMediaDlg( SfxRequest& );
- void ChangeHeaderOrFooter(const String& rStyleName, sal_Bool bHeader, sal_Bool bOn, sal_Bool bShowWarning);
+ void ChangeHeaderOrFooter(
+ const String& rStyleName,
+ sal_Bool bHeader,
+ sal_Bool bOn,
+ sal_Bool bShowWarning );
public:
+
SFX_DECL_INTERFACE(SW_TEXTSHELL)
TYPEINFO();
diff --git a/sw/source/ui/misc/num.cxx b/sw/source/ui/misc/num.cxx
index d797573..89b8282 100644
--- a/sw/source/ui/misc/num.cxx
+++ b/sw/source/ui/misc/num.cxx
@@ -1070,7 +1070,7 @@ SwSvxNumBulletTabDialog::SwSvxNumBulletTabDialog(Window* pParent,
GetUserButton()->SetText(sRemoveText);
GetUserButton()->SetHelpId(HID_NUM_RESET);
GetUserButton()->SetClickHdl(LINK(this, SwSvxNumBulletTabDialog, RemoveNumberingHdl));
- if(!rWrtSh.GetCurNumRule())
+ if(!rWrtSh.GetNumRuleAtCurrCrsrPos())
GetUserButton()->Enable(sal_False);
AddTabPage( RID_SVXPAGE_PICK_SINGLE_NUM );
AddTabPage( RID_SVXPAGE_PICK_BULLET );
diff --git a/sw/source/ui/shells/listsh.cxx b/sw/source/ui/shells/listsh.cxx
index b24b348..eec2cdc 100644
--- a/sw/source/ui/shells/listsh.cxx
+++ b/sw/source/ui/shells/listsh.cxx
@@ -149,7 +149,7 @@ void SwListShell::Execute(SfxRequest &rReq)
SwWrtShell& rSh = GetShell();
// --> FME 2005-01-04 #i35572#
- const SwNumRule* pCurRule = rSh.GetCurNumRule();
+ const SwNumRule* pCurRule = rSh.GetNumRuleAtCurrCrsrPos();
ASSERT( pCurRule, "SwListShell::Execute without NumRule" )
bool bOutline = pCurRule && pCurRule->IsOutlineRule();
// <--
diff --git a/sw/source/ui/shells/textsh1.cxx b/sw/source/ui/shells/textsh1.cxx
index ae9180f..722a6bb 100644
--- a/sw/source/ui/shells/textsh1.cxx
+++ b/sw/source/ui/shells/textsh1.cxx
@@ -950,7 +950,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
nDefPage = ((SfxUInt16Item *)pItem)->GetValue();
// Numerierungseigenschaften
- if(rWrtSh.GetCurNumRule())
+ if(rWrtSh.GetNumRuleAtCurrCrsrPos())
{
SfxBoolItem aStart( FN_NUMBER_NEWSTART, rWrtSh.IsNumRuleStart() );
aCoreSet.Put(aStart);
@@ -1107,51 +1107,49 @@ void SwTextShell::Execute(SfxRequest &rReq)
// <--
}
break;
+
case FN_SELECT_PARA:
{
- if(!rWrtSh.IsSttOfPara())
- rWrtSh.SttPara(sal_False);
+ if ( !rWrtSh.IsSttOfPara() )
+ rWrtSh.SttPara( sal_False );
else
rWrtSh.EnterStdMode();
- rWrtSh.EndPara(sal_True);
+ rWrtSh.EndPara( sal_True );
}
break;
case SID_DEC_INDENT:
case SID_INC_INDENT:
- //According to the requirement, modified the behavior when user
- //using the indent button on the toolbar. Now if we increase/decrease indent for a
- //paragraph which has bullet style it will increase/decrease the bullet level.
- {
- //If the current paragraph has bullet call the function to
- //increase or decrease the bullet level.
- //Why could I know wheter a paragraph has bullet or not by checking the below conditions?
- //Please refer to the "case KEY_TAB:" section in SwEditWin::KeyInput(..) :
- // if( rSh.GetCurNumRule() && rSh.IsSttOfPara() &&
- // !rSh.HasReadonlySel() )
- // eKeyState = KS_NumDown;
- //Above code demonstrates that when the cursor is at the start of a paragraph which has bullet,
- //press TAB will increase the bullet level.
- //So I copied from that ^^
- if ( rWrtSh.GetCurNumRule() && !rWrtSh.HasReadonlySel() )
- {
- rWrtSh.NumUpDown( SID_INC_INDENT == nSlot );
- }
- else//execute the original processing functions
- {
- //below is copied of the old codes
- rWrtSh.MoveLeftMargin( SID_INC_INDENT == nSlot,
- rReq.GetModifier() != KEY_MOD1 );
- }
+ //According to the requirement, modified the behavior when user
+ //using the indent button on the toolbar. Now if we increase/decrease indent for a
+ //paragraph which has bullet style it will increase/decrease the bullet level.
+ {
+ //If the current paragraph has bullet call the function to
+ //increase or decrease the bullet level.
+ //Why could I know wheter a paragraph has bullet or not by checking the below conditions?
+ //Please refer to the "case KEY_TAB:" section in SwEditWin::KeyInput(..) :
+ // if( rSh.GetCurNumRule() && rSh.IsSttOfPara() &&
+ // !rSh.HasReadonlySel() )
+ // eKeyState = KS_NumDown;
+ //Above code demonstrates that when the cursor is at the start of a paragraph which has bullet,
+ //press TAB will increase the bullet level.
+ //So I copied from that ^^
+ if ( rWrtSh.GetNumRuleAtCurrCrsrPos() && !rWrtSh.HasReadonlySel() )
+ {
+ rWrtSh.NumUpDown( SID_INC_INDENT == nSlot );
}
- //rWrtSh.MoveLeftMargin( SID_INC_INDENT == nSlot,
- // rReq.GetModifier() != KEY_MOD1 );
- rReq.Done();
- break;
+ else //execute the original processing functions
+ {
+ //below is copied of the old codes
+ rWrtSh.MoveLeftMargin( SID_INC_INDENT == nSlot, rReq.GetModifier() != KEY_MOD1 );
+ }
+ }
+ rReq.Done();
+ break;
+
case FN_DEC_INDENT_OFFSET:
case FN_INC_INDENT_OFFSET:
- rWrtSh.MoveLeftMargin( FN_INC_INDENT_OFFSET == nSlot,
- rReq.GetModifier() == KEY_MOD1 );
+ rWrtSh.MoveLeftMargin( FN_INC_INDENT_OFFSET == nSlot, rReq.GetModifier() == KEY_MOD1 );
rReq.Done();
break;
@@ -1463,7 +1461,7 @@ void SwTextShell::GetState( SfxItemSet &rSet )
break;
case FN_NUMBER_NEWSTART :
- if(!rSh.GetCurNumRule())
+ if(!rSh.GetNumRuleAtCurrCrsrPos())
rSet.DisableItem(nWhich);
else
rSet.Put(SfxBoolItem(FN_NUMBER_NEWSTART,
@@ -1555,37 +1553,31 @@ void SwTextShell::GetState( SfxItemSet &rSet )
case SID_DEC_INDENT:
case SID_INC_INDENT:
+ {
+ //if the paragrah has bullet we'll do the following things:
+ //1: if the bullet level is the first level, disable the decrease-indent button
+ //2: if the bullet level is the last level, disable the increase-indent button
+ if ( rSh.GetNumRuleAtCurrCrsrPos() && !rSh.HasReadonlySel() )
{
- //if the paragrah has bullet we'll do the following things:
- //1: if the bullet level is the first level, disable the decrease-indent button
- //2: if the bullet level is the last level, disable the increase-indent button
- if ( rSh.GetCurNumRule() && !rSh.HasReadonlySel() )
+ const sal_uInt8 nLevel = rSh.GetNumLevel();
+ if ( ( nLevel == ( MAXLEVEL - 1 ) && nWhich == SID_INC_INDENT )
+ || ( nLevel == 0 && nWhich == SID_DEC_INDENT ) )
{
- sal_uInt8 nLevel = rSh.GetNumLevel();
- if ( nLevel == (MAXLEVEL-1) && nWhich == SID_INC_INDENT ||
- nLevel == 0 && nWhich == SID_DEC_INDENT )
- {
- rSet.DisableItem( nWhich );
- }
+ rSet.DisableItem( nWhich );
}
- else//if the paragraph has no bullet, execute the original functions
+ }
+ else
+ {
+ sal_uInt16 nHtmlMode = ::GetHtmlMode( GetView().GetDocShell() );
+ nHtmlMode &= HTMLMODE_ON | HTMLMODE_SOME_STYLES;
+ if ( ( nHtmlMode == HTMLMODE_ON )
+ || !rSh.IsMoveLeftMargin( SID_INC_INDENT == nWhich, sal_True ) )
{
- //below is copied of the old codes
- sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
- nHtmlMode &= HTMLMODE_ON|HTMLMODE_SOME_STYLES;
- if( (nHtmlMode == HTMLMODE_ON) || !rSh.IsMoveLeftMargin(
- SID_INC_INDENT == nWhich, sal_True ))
rSet.DisableItem( nWhich );
}
- //old code begins
- //sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
- //nHtmlMode &= HTMLMODE_ON|HTMLMODE_SOME_STYLES;
- //if( (nHtmlMode == HTMLMODE_ON) || !rSh.IsMoveLeftMargin(
- // SID_INC_INDENT == nWhich, TRUE ))
- // rSet.DisableItem( nWhich );
- //old code ends
}
- break;
+ }
+ break;
case FN_DEC_INDENT_OFFSET:
case FN_INC_INDENT_OFFSET:
@@ -1802,16 +1794,19 @@ void SwTextShell::GetState( SfxItemSet &rSet )
rSet.DisableItem(nWhich);
}
break;
+
case FN_NUM_NUMBERING_ON:
rSet.Put(SfxBoolItem(FN_NUM_NUMBERING_ON,rSh.SelectionHasNumber()));
break;
+
case FN_NUM_BULLET_ON:
rSet.Put(SfxBoolItem(FN_NUM_BULLET_ON,rSh.SelectionHasBullet()));
break;
+
case FN_BUL_NUM_RULE_INDEX:
case FN_NUM_NUM_RULE_INDEX:
{
- SwNumRule* pCurRule = (SwNumRule*)(GetShell().GetCurNumRule());
+ SwNumRule* pCurRule = (SwNumRule*)(GetShell().GetNumRuleAtCurrCrsrPos());
sal_uInt16 nActNumLvl = (sal_uInt16)0xFFFF;
rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,DEFAULT_NONE));
rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,DEFAULT_NONE));
diff --git a/sw/source/ui/shells/txtattr.cxx b/sw/source/ui/shells/txtattr.cxx
index ba2ef4d..2202927 100644
--- a/sw/source/ui/shells/txtattr.cxx
+++ b/sw/source/ui/shells/txtattr.cxx
@@ -471,7 +471,7 @@ SET_LINESPACE:
aAdjust.SetWhich(SID_ATTR_PARA_ADJUST);
GetView().GetViewFrame()->GetBindings().SetState( aAdjust );
// Toggle numbering alignment
- const SwNumRule* pCurRule = GetShell().GetCurNumRule();
+ const SwNumRule* pCurRule = GetShell().GetNumRuleAtCurrCrsrPos();
if( pCurRule )
{
SvxNumRule aRule = pCurRule->MakeSvxNumRule();
diff --git a/sw/source/ui/shells/txtnum.cxx b/sw/source/ui/shells/txtnum.cxx
index 40bbc86..cc102cc 100644
--- a/sw/source/ui/shells/txtnum.cxx
+++ b/sw/source/ui/shells/txtnum.cxx
@@ -26,9 +26,7 @@
#include <hintids.hxx>
-#ifndef _MSGBOX_HXX //autogen
#include <vcl/msgbox.hxx>
-#endif
#include <sfx2/request.hxx>
#include <svl/eitem.hxx>
#include <svl/stritem.hxx>
@@ -50,7 +48,6 @@
#include <svx/nbdtmgfact.hxx>
#include <sfx2/viewfrm.hxx>
#include <sfx2/bindings.hxx>
-using namespace svx::sidebar;
void SwTextShell::ExecEnterNum(SfxRequest &rReq)
{
@@ -115,334 +112,202 @@ void SwTextShell::ExecEnterNum(SfxRequest &rReq)
GetShell().EndAllAction();
}
break;
+
case FN_NUMBER_BULLETS:
case SID_OUTLINE_BULLET:
{
- // --> OD 2008-02-29 #refactorlists#
-// // per default sal_True, damit die Schleife im Dialog richtig arbeitet!
-// sal_Bool bHasChild = sal_True;
- // <--
- SfxItemSet aSet(GetPool(),
- SID_HTML_MODE, SID_HTML_MODE,
- SID_ATTR_NUMBERING_RULE, SID_PARAM_CUR_NUM_LEVEL,
- 0 );
+ SfxItemSet aSet( GetPool(),
+ SID_HTML_MODE, SID_HTML_MODE,
+ SID_ATTR_NUMBERING_RULE, SID_PARAM_CUR_NUM_LEVEL,
+ 0 );
SwDocShell* pDocSh = GetView().GetDocShell();
- sal_Bool bHtml = 0 != PTR_CAST(SwWebDocShell, pDocSh);
- const SwNumRule* pCurRule = GetShell().GetCurNumRule();
- if( pCurRule )
+ const bool bHtml = 0 != PTR_CAST( SwWebDocShell, pDocSh );
+ const SwNumRule* pNumRuleAtCurrentSelection = GetShell().GetNumRuleAtCurrentSelection();
+ if ( pNumRuleAtCurrentSelection != NULL )
{
- SvxNumRule aRule = pCurRule->MakeSvxNumRule();
+ SvxNumRule aRule = pNumRuleAtCurrentSelection->MakeSvxNumRule();
//convert type of linked bitmaps from SVX_NUM_BITMAP to (SVX_NUM_BITMAP|LINK_TOKEN)
- for(sal_uInt16 i = 0; i < aRule.GetLevelCount(); i++)
+ for ( sal_uInt16 i = 0; i < aRule.GetLevelCount(); i++ )
{
- SvxNumberFormat aFmt(aRule.GetLevel(i));
- if(SVX_NUM_BITMAP == aFmt.GetNumberingType())
+ SvxNumberFormat aFmt( aRule.GetLevel( i ) );
+ if ( SVX_NUM_BITMAP == aFmt.GetNumberingType() )
{
const SvxBrushItem* pBrush = aFmt.GetBrush();
- const String* pLinkStr;
- if(pBrush &&
- 0 != (pLinkStr = pBrush->GetGraphicLink()) &&
- pLinkStr->Len())
- aFmt.SetNumberingType(SvxExtNumType(SVX_NUM_BITMAP|LINK_TOKEN));
- aRule.SetLevel(i, aFmt, aRule.Get(i) != 0);
+ const String* pLinkStr = pBrush != NULL
+ ? pBrush->GetGraphicLink()
+ : NULL;
+ if ( pLinkStr != NULL && pLinkStr->Len() > 0 )
+ {
+ aFmt.SetNumberingType( SvxExtNumType( SVX_NUM_BITMAP | LINK_TOKEN ) );
+ }
+ aRule.SetLevel( i, aFmt, aRule.Get( i ) != 0 );
}
}
- if(bHtml)
- aRule.SetFeatureFlag(NUM_ENABLE_EMBEDDED_BMP, sal_False);
+ if ( bHtml )
+ aRule.SetFeatureFlag( NUM_ENABLE_EMBEDDED_BMP, sal_False );
- aSet.Put(SvxNumBulletItem(aRule));
- // --> OD 2008-02-29 #refactorlists# - removed <bHasChild>
+ aSet.Put( SvxNumBulletItem( aRule ) );
ASSERT( GetShell().GetNumLevel() < MAXLEVEL,
"<SwTextShell::ExecEnterNum()> - numbered node without valid list level. Serious defect -> please inform OD." );
sal_uInt16 nLevel = GetShell().GetNumLevel();
- // <--
- if( nLevel < MAXLEVEL )
+ if ( nLevel < MAXLEVEL )
{
- nLevel = 1<<nLevel;
- aSet.Put( SfxUInt16Item( SID_PARAM_CUR_NUM_LEVEL, nLevel ));
+ nLevel = 1 << nLevel;
+ aSet.Put( SfxUInt16Item( SID_PARAM_CUR_NUM_LEVEL, nLevel ) );
}
}
else
{
- // --> OD 2008-02-11 #newlistlevelattrs#
SwNumRule aRule( GetShell().GetUniqueNumRuleName(),
- // --> OD 2008-06-06 #i89178#
numfunc::GetDefaultPositionAndSpaceMode() );
- // <--
- // <--
SvxNumRule aSvxRule = aRule.MakeSvxNumRule();
const bool bRightToLeft = GetShell().IsInRightToLeftText( 0 );
- if( bHtml || bRightToLeft )
+ if ( bHtml || bRightToLeft )
{
- for( sal_uInt8 n = 0; n < MAXLEVEL; ++n )
+ for ( sal_uInt8 n = 0; n < MAXLEVEL; ++n )
{
SvxNumberFormat aFmt( aSvxRule.GetLevel( n ) );
if ( n && bHtml )
{
// 1/2" fuer HTML
- aFmt.SetLSpace(720);
- aFmt.SetAbsLSpace(n * 720);
+ aFmt.SetLSpace( 720 );
+ aFmt.SetAbsLSpace( n * 720 );
}
- // --> FME 2005-01-21 #i38904# Default alignment for
- // numbering/bullet should be rtl in rtl paragraph:
+ // Default alignment for numbering/bullet should be rtl in rtl paragraph:
if ( bRightToLeft )
{
aFmt.SetNumAdjust( SVX_ADJUST_RIGHT );
}
- // <--
aSvxRule.SetLevel( n, aFmt, sal_False );
}
- aSvxRule.SetFeatureFlag(NUM_ENABLE_EMBEDDED_BMP, sal_False);
+ aSvxRule.SetFeatureFlag( NUM_ENABLE_EMBEDDED_BMP, sal_False );
}
- aSet.Put(SvxNumBulletItem(aSvxRule));
+ aSet.Put( SvxNumBulletItem( aSvxRule ) );
}
- aSet.Put( SfxBoolItem( SID_PARAM_NUM_PRESET,sal_False ));
+ aSet.Put( SfxBoolItem( SID_PARAM_NUM_PRESET, sal_False ) );
// vor dem Dialog wird der HtmlMode an der DocShell versenkt
- pDocSh->PutItem(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(pDocSh)));
+ pDocSh->PutItem( SfxUInt16Item( SID_HTML_MODE, ::GetHtmlMode( pDocSh ) ) );
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- DBG_ASSERT(pFact, "Dialogdiet fail!");
- SfxAbstractTabDialog* pDlg = pFact->CreateSwTabDialog( DLG_SVXTEST_NUM_BULLET,
- GetView().GetWindow(), &aSet, GetShell());
+ DBG_ASSERT( pFact, "Dialogdiet fail!" );
+ SfxAbstractTabDialog* pDlg =
+ pFact->CreateSwTabDialog( DLG_SVXTEST_NUM_BULLET, GetView().GetWindow(), &aSet, GetShell() );
DBG_ASSERT(pDlg, "Dialogdiet fail!");
- sal_uInt16 nRet = pDlg->Execute();
+ const sal_uInt16 nRet = pDlg->Execute();
const SfxPoolItem* pItem;
- if( RET_OK == nRet )
+ if ( RET_OK == nRet )
{
- if( SFX_ITEM_SET == pDlg->GetOutputItemSet()->GetItemState( SID_ATTR_NUMBERING_RULE, sal_False, &pItem ))
+ if ( SFX_ITEM_SET == pDlg->GetOutputItemSet()->GetItemState( SID_ATTR_NUMBERING_RULE, sal_False, &pItem ) )
{
- rReq.AppendItem(*pItem);
+ rReq.AppendItem( *pItem );
rReq.Done();
- SvxNumRule* pSetRule = ((SvxNumBulletItem*)pItem)->GetNumRule();
+ SvxNumRule* pSetRule = ( (SvxNumBulletItem*) pItem )->GetNumRule();
pSetRule->UnLinkGraphics();
- // --> OD 2008-02-11 #newlistlevelattrs#
- SwNumRule aSetRule( pCurRule
- ? pCurRule->GetName()
- : GetShell().GetUniqueNumRuleName(),
- // --> OD 2008-06-06 #i89178#
- numfunc::GetDefaultPositionAndSpaceMode() );
- // <--
- // <--
- aSetRule.SetSvxRule( *pSetRule, GetShell().GetDoc());
+ SwNumRule aSetRule( pNumRuleAtCurrentSelection != NULL
+ ? pNumRuleAtCurrentSelection->GetName()
+ : GetShell().GetUniqueNumRuleName(),
+ numfunc::GetDefaultPositionAndSpaceMode() );
+ aSetRule.SetSvxRule( *pSetRule, GetShell().GetDoc() );
aSetRule.SetAutoRule( sal_True );
- // --> OD 2008-03-17 #refactorlists#
// No start of new list, if an existing list style is edited.
// Otherwise start a new list.
- const bool bCreateList = (pCurRule == 0);
+ const bool bCreateList = ( pNumRuleAtCurrentSelection == NULL );
GetShell().SetCurNumRule( aSetRule, bCreateList );
- // <--
}
// wenn der Dialog mit OK verlassen wurde, aber nichts ausgewaehlt
// wurde dann muss die Numerierung zumindest eingeschaltet werden,
// wenn sie das noch nicht ist
- else if( !pCurRule && SFX_ITEM_SET == aSet.GetItemState( SID_ATTR_NUMBERING_RULE, sal_False, &pItem ))
+ else if ( pNumRuleAtCurrentSelection == NULL
+ && SFX_ITEM_SET == aSet.GetItemState( SID_ATTR_NUMBERING_RULE, sal_False, &pItem ) )
{
rReq.AppendItem( *pItem );
rReq.Done();
- SvxNumRule* pSetRule = ((SvxNumBulletItem*)pItem)->GetNumRule();
- // --> OD 2008-02-11 #newlistlevelattrs#
- SwNumRule aSetRule( GetShell().GetUniqueNumRuleName(),
- // --> OD 2008-06-06 #i89178#
- numfunc::GetDefaultPositionAndSpaceMode() );
- // <--
- // <--
- aSetRule.SetSvxRule(*pSetRule, GetShell().GetDoc());
+ SvxNumRule* pSetRule = ( (SvxNumBulletItem*) pItem )->GetNumRule();
+ SwNumRule aSetRule(
+ GetShell().GetUniqueNumRuleName(),
+ numfunc::GetDefaultPositionAndSpaceMode() );
+ aSetRule.SetSvxRule( *pSetRule, GetShell().GetDoc() );
aSetRule.SetAutoRule( sal_True );
- // --> OD 2008-03-17 #refactorlists#
// start new list
GetShell().SetCurNumRule( aSetRule, true );
- // <--
}
}
- else if(RET_USER == nRet)
+ else if ( RET_USER == nRet )
GetShell().DelNumRules();
delete pDlg;
}
- break;
+ break;
+
default:
- ASSERT(sal_False, falscher Dispatcher);
+ ASSERT( sal_False, "wrong Dispatcher" );
return;
}
}
+
void SwTextShell::ExecSetNumber(SfxRequest &rReq)
{
- SwNumRule aRule( GetShell().GetUniqueNumRuleName(),
- // --> OD 2008-06-06 #i89178#
- numfunc::GetDefaultPositionAndSpaceMode() );
- // <--
-
- SvxNumRule aSvxRule = aRule.MakeSvxNumRule();
- const bool bRightToLeft = GetShell().IsInRightToLeftText( 0 );
-
- if( bRightToLeft )
- {
- for( sal_uInt8 n = 0; n < MAXLEVEL; ++n )
- {
- SvxNumberFormat aFmt( aSvxRule.GetLevel( n ) );
- /* if ( n && bHtml )
- {
- // 1/2" fuer HTML
- aFmt.SetLSpace(720);
- aFmt.SetAbsLSpace(n * 720);
- }*/
- // --> FME 2005-01-21 #i38904# Default alignment for
- // numbering/bullet should be rtl in rtl paragraph:
- if ( bRightToLeft )
- {
- aFmt.SetNumAdjust( SVX_ADJUST_RIGHT );
- }
- // <--
- aSvxRule.SetLevel( n, aFmt, sal_False );
- }
- aSvxRule.SetFeatureFlag(NUM_ENABLE_EMBEDDED_BMP, sal_False);
- }
-
- const SwNumRule* pCurRule = GetShell().GetCurNumRule();
- sal_uInt16 nActNumLvl = (sal_uInt16)0xFFFF;
- if( pCurRule )
- {
- sal_uInt16 nLevel = GetShell().GetNumLevel();
- if( nLevel < MAXLEVEL )
- {
- nActNumLvl = 1<<nLevel;
- }
-
- aSvxRule = pCurRule->MakeSvxNumRule();
-
- //convert type of linked bitmaps from SVX_NUM_BITMAP to (SVX_NUM_BITMAP|LINK_TOKEN)
- for(sal_uInt16 i = 0; i < aSvxRule.GetLevelCount(); i++)
- {
- SvxNumberFormat aFmt(aSvxRule.GetLevel(i));
- if(SVX_NUM_BITMAP == aFmt.GetNumberingType())
- {
- const SvxBrushItem* pBrush = aFmt.GetBrush();
- const String* pLinkStr;
- if(pBrush &&
- 0 != (pLinkStr = pBrush->GetGraphicLink()) &&
- pLinkStr->Len())
- aFmt.SetNumberingType(SvxExtNumType(SVX_NUM_BITMAP|LINK_TOKEN));
- aSvxRule.SetLevel(i, aFmt, aSvxRule.Get(i) != 0);
- }
- }
- }
-
-
- switch(rReq.GetSlot())
+ const sal_uInt16 nSlot = rReq.GetSlot();
+ switch ( nSlot )
{
case FN_SVX_SET_NUMBER:
- {
- SFX_REQUEST_ARG( rReq, pItem, SfxUInt16Item, FN_SVX_SET_NUMBER , sal_False );
- if (pItem)
- {
- sal_uInt16 nIdx = pItem->GetValue();
- if (nIdx==DEFAULT_NONE) {
- GetShell().DelNumRules();
- break;
- }
- --nIdx;
-
- NBOTypeMgrBase* pNumbering = NBOutlineTypeMgrFact::CreateInstance(eNBOType::NUMBERING);
- if ( pNumbering )
- {
- SwNumRule aTmpRule( GetShell().GetUniqueNumRuleName(),
- numfunc::GetDefaultPositionAndSpaceMode() );
-
- SvxNumRule aTempRule = aTmpRule.MakeSvxNumRule();
- // set unit attribute to NB Manager
- SfxItemSet aSet(GetPool(),
- SID_ATTR_NUMBERING_RULE, SID_PARAM_CUR_NUM_LEVEL,
- 0 );
- aSet.Put(SvxNumBulletItem(aTempRule));
- pNumbering->SetItems(&aSet);
- pNumbering->ApplyNumRule(aTempRule,nIdx,nActNumLvl);
-
- sal_uInt16 nMask = 1;
- for(sal_uInt16 i = 0; i < aSvxRule.GetLevelCount(); i++)
- {
- if(nActNumLvl & nMask)
- {
- SvxNumberFormat aFmt(aTempRule.GetLevel(i));
- aSvxRule.SetLevel(i, aFmt);
- }
- nMask <<= 1 ;
- }
-
- aSvxRule.UnLinkGraphics();
- SwNumRule aSetRule( pCurRule
- ? pCurRule->GetName()
- : GetShell().GetUniqueNumRuleName(),
- numfunc::GetDefaultPositionAndSpaceMode() );
- aSetRule.SetSvxRule( aSvxRule, GetShell().GetDoc());
-
- aSetRule.SetAutoRule( sal_True );
- const bool bCreateList = (pCurRule == 0);
- GetShell().SetCurNumRule( aSetRule, bCreateList );
- }
- //End
- }
- break;
- }
case FN_SVX_SET_BULLET:
{
- SFX_REQUEST_ARG( rReq, pItem, SfxUInt16Item, FN_SVX_SET_BULLET , sal_False );
- if (pItem)
+ SFX_REQUEST_ARG( rReq, pItem, SfxUInt16Item, nSlot, sal_False );
+ if ( pItem != NULL )
{
- sal_uInt16 nIdx = pItem->GetValue();
- if (nIdx==DEFAULT_NONE) {
+ const sal_uInt16 nChoosenItemIdx = pItem->GetValue();
+ if ( nChoosenItemIdx == DEFAULT_NONE )
+ {
GetShell().DelNumRules();
- break;
}
- nIdx--;
-
- NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(eNBOType::MIXBULLETS);
- if ( pBullets )
+ else
{
- SwNumRule aTmpRule( GetShell().GetUniqueNumRuleName(),
- numfunc::GetDefaultPositionAndSpaceMode() );
-
- SvxNumRule aTempRule = aTmpRule.MakeSvxNumRule();
- // set unit attribute to NB Manager
- SfxItemSet aSet(GetPool(),
- SID_ATTR_NUMBERING_RULE, SID_PARAM_CUR_NUM_LEVEL,
- 0 );
- aSet.Put(SvxNumBulletItem(aTempRule));
- pBullets->SetItems(&aSet);
-
- //SvxNumRule aTempRule( 0, 10, false );
- pBullets->ApplyNumRule(aTempRule,nIdx,nActNumLvl);
- sal_uInt16 nMask = 1;
- for(sal_uInt16 i = 0; i < aSvxRule.GetLevelCount(); i++)
+ svx::sidebar::NBOTypeMgrBase* pNBOTypeMgr =
+ nSlot == FN_SVX_SET_NUMBER
+ ? svx::sidebar::NBOutlineTypeMgrFact::CreateInstance( svx::sidebar::eNBOType::NUMBERING )
+ : svx::sidebar::NBOutlineTypeMgrFact::CreateInstance( svx::sidebar::eNBOType::MIXBULLETS );
+ if ( pNBOTypeMgr != NULL )
{
- if(nActNumLvl & nMask)
+ const SwNumRule* pNumRuleAtCurrentSelection = GetShell().GetNumRuleAtCurrentSelection();
+ sal_uInt16 nActNumLvl = (sal_uInt16) 0xFFFF;
+ if ( pNumRuleAtCurrentSelection != NULL )
{
- SvxNumberFormat aFmt(aTempRule.GetLevel(i));
- aSvxRule.SetLevel(i, aFmt);
+ sal_uInt16 nLevel = GetShell().GetNumLevel();
+ if ( nLevel < MAXLEVEL )
+ {
+ nActNumLvl = 1 << nLevel;
+ }
}
- nMask <<= 1;
+ SwNumRule aNewNumRule(
+ pNumRuleAtCurrentSelection != NULL ? pNumRuleAtCurrentSelection->GetName() : GetShell().GetUniqueNumRuleName(),
+ numfunc::GetDefaultPositionAndSpaceMode() );
+ SvxNumRule aNewSvxNumRule = pNumRuleAtCurrentSelection != NULL
+ ? pNumRuleAtCurrentSelection->MakeSvxNumRule()
+ : aNewNumRule.MakeSvxNumRule();
+ // set unit attribute to NB Manager
+ SfxItemSet aSet( GetPool(), SID_ATTR_NUMBERING_RULE, SID_PARAM_CUR_NUM_LEVEL, 0 );
+ aSet.Put( SvxNumBulletItem( aNewSvxNumRule ) );
+ pNBOTypeMgr->SetItems( &aSet );
+ pNBOTypeMgr->ApplyNumRule( aNewSvxNumRule, nChoosenItemIdx - 1, nActNumLvl );
+
+ aNewNumRule.SetSvxRule( aNewSvxNumRule, GetShell().GetDoc() );
+ aNewNumRule.SetAutoRule( sal_True );
+ const bool bCreateNewList = ( pNumRuleAtCurrentSelection == NULL );
+ GetShell().SetCurNumRule( aNewNumRule, bCreateNewList );
}
- aSvxRule.UnLinkGraphics();
-
- SwNumRule aSetRule( pCurRule
- ? pCurRule->GetName()
- : GetShell().GetUniqueNumRuleName(),
- numfunc::GetDefaultPositionAndSpaceMode() );
-
- aSetRule.SetSvxRule( aSvxRule, GetShell().GetDoc());
-
- aSetRule.SetAutoRule( sal_True );
- const bool bCreateList = (pCurRule == 0);
- GetShell().SetCurNumRule( aSetRule, bCreateList );
}
- //End
}
-
}
break;
+
+ default:
+ ASSERT( sal_False, "wrong Dispatcher" );
+ return;
}
}
diff --git a/sw/source/ui/uiview/formatclipboard.cxx b/sw/source/ui/uiview/formatclipboard.cxx
index b3d66d2..9aadeec 100644
--- a/sw/source/ui/uiview/formatclipboard.cxx
+++ b/sw/source/ui/uiview/formatclipboard.cxx
@@ -397,7 +397,7 @@ void SwFormatClipboard::Copy( SwWrtShell& rWrtShell, SfxItemPool& rPool, bool bP
rWrtShell.GetCurAttr(*pItemSet);
// additional numbering properties for paragraph styles
- if( nSelectionType & nsSelectionType::SEL_TXT && rWrtShell.GetCurNumRule() )
+ if( nSelectionType & nsSelectionType::SEL_TXT && rWrtShell.GetNumRuleAtCurrCrsrPos() )
{
SfxBoolItem aStart(FN_NUMBER_NEWSTART, rWrtShell.IsNumRuleStart());
pItemSet->Put(aStart);
@@ -553,7 +553,7 @@ void SwFormatClipboard::Paste( SwWrtShell& rWrtShell, SfxStyleSheetBasePool* pPo
rWrtShell.SetAttrSet(*pTemplateItemSet);
// additional numbering properties for paragraph styles
- if( nSelectionType & nsSelectionType::SEL_TXT && rWrtShell.GetCurNumRule() )
+ if( nSelectionType & nsSelectionType::SEL_TXT && rWrtShell.GetNumRuleAtCurrCrsrPos() )
{
if( SFX_ITEM_SET == pTemplateItemSet->GetItemState(FN_NUMBER_NEWSTART) )
{
diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx
index 6835b5b..9d7caaf 100644
--- a/sw/source/ui/uiview/view2.cxx
+++ b/sw/source/ui/uiview/view2.cxx
@@ -1473,7 +1473,7 @@ void SwView::StateStatusLine(SfxItemSet &rSet)
//}//<-removed end ,zhaojianwei
//-->#outline level,added by zhaojianwei
- const SwNumRule* pNumRule = rShell.GetCurNumRule();
+ const SwNumRule* pNumRule = rShell.GetNumRuleAtCurrCrsrPos();
const bool bOutlineNum = pNumRule ? pNumRule->IsOutlineRule() : 0;
//((SwTxtFmtColl*)rShell.GetCrsr()->GetNode()->GetTxtNode()->GetFmtColl())->IsAssignedToListLevelOfOutlineStyle();
@@ -1739,7 +1739,7 @@ void SwView::ExecuteStatusLine(SfxRequest &rReq)
nId = FN_EDIT_REGION;
else
{
- const SwNumRule* pNumRule = rSh.GetCurNumRule();
+ const SwNumRule* pNumRule = rSh.GetNumRuleAtCurrCrsrPos();
if( pNumRule ) // Cursor in Numerierung
{
if( pNumRule->IsAutoRule() )
diff --git a/sw/source/ui/wrtsh/wrtsh1.cxx b/sw/source/ui/wrtsh/wrtsh1.cxx
index ac32b34..b4ce9c8 100644
--- a/sw/source/ui/wrtsh/wrtsh1.cxx
+++ b/sw/source/ui/wrtsh/wrtsh1.cxx
@@ -1076,7 +1076,7 @@ void SwWrtShell::SplitNode( sal_Bool bAutoFmt, sal_Bool bCheckTableStart )
void SwWrtShell::NumOrBulletOn(sal_Bool bNum)
{
// determine numbering rule found at current cursor position in the docment.
- const SwNumRule* pCurRule = GetCurNumRule();
+ const SwNumRule* pCurRule = GetNumRuleAtCurrCrsrPos();
StartUndo(UNDO_NUMORNONUM);
@@ -1433,7 +1433,7 @@ void SwWrtShell::NumOn()
void SwWrtShell::NumOrBulletOff()
{
- const SwNumRule * pCurNumRule = GetCurNumRule();
+ const SwNumRule * pCurNumRule = GetNumRuleAtCurrCrsrPos();
if (pCurNumRule)
{
@@ -1551,7 +1551,7 @@ SelectionType SwWrtShell::GetSelectionType() const
nCnt |= (nsSelectionType::SEL_TBL | nsSelectionType::SEL_TBL_CELLS);
// Do not pop up numbering toolbar, if the text node has a numbering of type SVX_NUM_NUMBER_NONE.
- const SwNumRule* pNumRule = GetCurNumRule();
+ const SwNumRule* pNumRule = GetNumRuleAtCurrCrsrPos();
if ( pNumRule )
{
const SwTxtNode* pTxtNd =
More information about the Libreoffice-commits
mailing list