[Libreoffice-commits] core.git: Branch 'private/mst/sw_redlinehide_3' - 5 commits - sw/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Oct 29 18:25:35 UTC 2018
Rebased ref, commits from common ancestor:
commit e4ea2f3aee390fc739526c869dc3ddcd832d60cf
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Oct 29 19:23:42 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Mon Oct 29 19:23:42 2018 +0100
sw_redlinehide_3: adapt SwWrtShell::NumOrBulletOn/Off
Change-Id: I5cd89bc0595f96125d58a05e01d9e33b965621fe
diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx
index 9ddfd9fe39e8..c0181c34402d 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -56,6 +56,7 @@
#include <fmtftn.hxx>
#include <fmthdft.hxx>
#include <fmtpdsc.hxx>
+#include <txtfrm.hxx>
#include <wdocsh.hxx>
#include <basesh.hxx>
#include <swmodule.hxx>
@@ -1026,8 +1027,8 @@ void SwWrtShell::NumOrBulletOn(bool bNum)
// check, if text node at current cursor positioned is counted.
// If not, let it been counted. Then it has to be checked,
// of the outline numbering has to be activated or continued.
- SwTextNode* pTextNode =
- GetCursor()->GetPoint()->nNode.GetNode().GetTextNode();
+ SwTextNode const*const pTextNode = sw::GetParaPropsNode(
+ *GetLayout(), GetCursor()->GetPoint()->nNode);
if ( pTextNode && !pTextNode->IsCountedInList() )
{
// check, if numbering of the outline level of the paragraph
@@ -1133,7 +1134,8 @@ void SwWrtShell::NumOrBulletOn(bool bNum)
// do not change found numbering/bullet rule, if it should only be continued.
if ( !bContinueFoundNumRule )
{
- SwTextNode * pTextNode = GetCursor()->GetPoint()->nNode.GetNode().GetTextNode();
+ SwTextNode const*const pTextNode = sw::GetParaPropsNode(
+ *GetLayout(), GetCursor()->GetPoint()->nNode);
if (pTextNode)
{
@@ -1197,7 +1199,8 @@ void SwWrtShell::NumOrBulletOn(bool bNum)
pChrFormat = GetCharFormatFromPool( RES_POOLCHR_BUL_LEVEL );
}
- const SwTextNode* pTextNode = GetCursor()->GetPoint()->nNode.GetNode().GetTextNode();
+ const SwTextNode *const pTextNode = sw::GetParaPropsNode(*GetLayout(),
+ GetCursor()->GetPoint()->nNode);
const SwTwips nWidthOfTabs = pTextNode
? pTextNode->GetWidthOfLeadingTabs()
: 0;
@@ -1306,7 +1309,7 @@ void SwWrtShell::NumOrBulletOff()
SwNumRule aNumRule(*pCurNumRule);
SwTextNode * pTextNode =
- GetCursor()->GetPoint()->nNode.GetNode().GetTextNode();
+ sw::GetParaPropsNode(*GetLayout(), GetCursor()->GetPoint()->nNode);
if (pTextNode)
{
@@ -1413,7 +1416,7 @@ SelectionType SwWrtShell::GetSelectionType() const
if ( pNumRule )
{
const SwTextNode* pTextNd =
- GetCursor()->GetPoint()->nNode.GetNode().GetTextNode();
+ sw::GetParaPropsNode(*GetLayout(), GetCursor()->GetPoint()->nNode);
if ( pTextNd && pTextNd->IsInList() )
{
commit c9bc8a8916e8c16d29564a5cd80b9a8edabca1d6
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Oct 29 18:54:56 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Mon Oct 29 18:54:56 2018 +0100
sw_redlinehide_3: adapt SwFEShell::GetNumRuleNodeAtPos()/IsNumLabel()
Change-Id: Ifd65b7b294cd7bc2a93c9e574712dce200bdfcf3
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 05890b2e1803..a00a35ec6f77 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -1304,7 +1304,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
&& IsAttrAtPos::NumLabel & rContentAtPos.eContentAtPos)
{
bRet = aTmpState.m_bInNumPortion;
- rContentAtPos.aFnd.pNode = pTextNd;
+ rContentAtPos.aFnd.pNode = sw::GetParaPropsNode(*GetLayout(), aPos.nNode);
Size aSizeLogic(aTmpState.m_nInNumPortionOffset, 0);
Size aSizePixel = GetWin()->LogicToPixel(aSizeLogic);
commit 6e1f648e2ae00fc80b41c7d5eaf168ac06eeaf26
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Oct 29 15:58:25 2018 +0100
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Mon Oct 29 15:58:25 2018 +0100
remove this nonsense, see SwPam::Delete
Change-Id: Ic8425801e51219627fd37e0b63161590a61b2857
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx
index de507fa6aea3..6597f7109ec6 100644
--- a/sw/source/core/edit/ednumber.cxx
+++ b/sw/source/core/edit/ednumber.cxx
@@ -398,12 +398,6 @@ bool SwEditShell::MoveParagraph( long nOffset )
StartAllAction();
SwPaM *pCursor = GetCursor();
- if( !pCursor->HasMark() )
- {
- // Ensures that Bound1 and Bound2 are in the same Node
- pCursor->SetMark();
- pCursor->DeleteMark();
- }
bool bRet = GetDoc()->MoveParagraph( *pCursor, nOffset );
commit 511f786e0f5581d0ba41c48e6b2af4b5d7d4e977
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Oct 26 17:22:48 2018 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Mon Oct 29 13:07:34 2018 +0100
sw_redlinehide_3: adapt even more SwEditShell Num
IsNoNum(), GetNumLevel(), IsNumRuleStart(), GetNodeNumStart()
Change-Id: I38e592835f3e6e3e7faa901e5b6533b2222fb35a
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx
index 58ccd7c7b73e..de507fa6aea3 100644
--- a/sw/source/core/edit/ednumber.cxx
+++ b/sw/source/core/edit/ednumber.cxx
@@ -667,7 +667,7 @@ bool SwEditShell::IsNoNum( bool bChkStart ) const
&& !HasSelection()
&& ( !bChkStart || IsSttPara() ) )
{
- const SwTextNode* pTextNd = GetCursor()->GetNode().GetTextNode();
+ const SwTextNode* pTextNd = sw::GetParaPropsNode(*GetLayout(), GetCursor()->GetPoint()->nNode);
if ( pTextNd != nullptr )
{
bResult = !pTextNd->IsCountedInList();
@@ -683,7 +683,7 @@ sal_uInt8 SwEditShell::GetNumLevel() const
sal_uInt8 nLevel = MAXLEVEL;
SwPaM* pCursor = GetCursor();
- const SwTextNode* pTextNd = pCursor->GetNode().GetTextNode();
+ const SwTextNode *const pTextNd = sw::GetParaPropsNode(*GetLayout(), pCursor->GetPoint()->nNode);
OSL_ENSURE( pTextNd, "GetNumLevel() without text node" );
if ( pTextNd == nullptr )
@@ -838,7 +838,7 @@ void SwEditShell::SetNumRuleStart( bool bFlag, SwPaM* pPaM )
bool SwEditShell::IsNumRuleStart( SwPaM* pPaM ) const
{
SwPaM* pCursor = pPaM ? pPaM : GetCursor( );
- const SwTextNode* pTextNd = pCursor->GetNode().GetTextNode();
+ const SwTextNode *const pTextNd = sw::GetParaPropsNode(*GetLayout(), pCursor->GetPoint()->nNode);
return pTextNd && pTextNd->IsListRestart();
}
@@ -871,7 +871,7 @@ void SwEditShell::SetNodeNumStart( sal_uInt16 nStt )
sal_uInt16 SwEditShell::GetNodeNumStart( SwPaM* pPaM ) const
{
SwPaM* pCursor = pPaM ? pPaM : GetCursor();
- const SwTextNode* pTextNd = pCursor->GetNode().GetTextNode();
+ const SwTextNode *const pTextNd = sw::GetParaPropsNode(*GetLayout(), pCursor->GetPoint()->nNode);
// correction: check, if list restart value is set at text node and
// use new method <SwTextNode::GetAttrListRestartValue()>.
// return USHRT_MAX, if no list restart value is found.
commit 8f7722f4307f09855b3335b0688bdd463210ca37
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Oct 26 17:20:17 2018 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Mon Oct 29 13:07:34 2018 +0100
sw_redlinehide_3: adapt more SwEditShell Num
ReplaceNumRule(), SetNumRuleStart(), SetNodeNumStart()
Change-Id: I7e58d477b02e0e242ce3c12eca0071856533debf
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx
index 272a83e8122c..58ccd7c7b73e 100644
--- a/sw/source/core/edit/ednumber.cxx
+++ b/sw/source/core/edit/ednumber.cxx
@@ -651,7 +651,8 @@ bool SwEditShell::NumOrNoNum(
&& ( !bChkStart || IsSttPara() ) )
{
StartAllAction();
- bRet = GetDoc()->NumOrNoNum( GetCursor()->GetPoint()->nNode, !bNumOn );
+ SwPosition const pos(sw::GetParaPropsPos(*GetLayout(), *GetCursor()->GetPoint()));
+ bRet = GetDoc()->NumOrNoNum(pos.nNode, !bNumOn);
EndAllAction();
}
return bRet;
@@ -804,7 +805,8 @@ void SwEditShell::ChgNumRuleFormats( const SwNumRule& rRule )
void SwEditShell::ReplaceNumRule( const OUString& rOldRule, const OUString& rNewRule )
{
StartAllAction();
- GetDoc()->ReplaceNumRule( *GetCursor()->GetPoint(), rOldRule, rNewRule );
+ SwPosition const pos(sw::GetParaPropsPos(*GetLayout(), *GetCursor()->GetPoint()));
+ GetDoc()->ReplaceNumRule( pos, rOldRule, rNewRule );
EndAllAction();
}
@@ -818,11 +820,17 @@ void SwEditShell::SetNumRuleStart( bool bFlag, SwPaM* pPaM )
SwPamRanges aRangeArr( *pCursor );
SwPaM aPam( *pCursor->GetPoint() );
for( size_t n = 0; n < aRangeArr.Count(); ++n )
- GetDoc()->SetNumRuleStart( *aRangeArr.SetPam( n, aPam ).GetPoint(), bFlag );
+ {
+ SwPosition const pos(sw::GetParaPropsPos(*GetLayout(), *aRangeArr.SetPam( n, aPam ).GetPoint()));
+ GetDoc()->SetNumRuleStart( pos, bFlag );
+ }
GetDoc()->GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr );
}
else
- GetDoc()->SetNumRuleStart( *pCursor->GetPoint(), bFlag );
+ {
+ SwPosition const pos(sw::GetParaPropsPos(*GetLayout(), *GetCursor()->GetPoint()));
+ GetDoc()->SetNumRuleStart(pos, bFlag);
+ }
EndAllAction();
}
@@ -845,11 +853,17 @@ void SwEditShell::SetNodeNumStart( sal_uInt16 nStt )
SwPamRanges aRangeArr( *pCursor );
SwPaM aPam( *pCursor->GetPoint() );
for( size_t n = 0; n < aRangeArr.Count(); ++n )
- GetDoc()->SetNodeNumStart( *aRangeArr.SetPam( n, aPam ).GetPoint(), nStt );
+ {
+ SwPosition const pos(sw::GetParaPropsPos(*GetLayout(), *aRangeArr.SetPam( n, aPam ).GetPoint()));
+ GetDoc()->SetNodeNumStart( pos, nStt );
+ }
GetDoc()->GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr );
}
else
- GetDoc()->SetNodeNumStart( *pCursor->GetPoint(), nStt );
+ {
+ SwPosition const pos(sw::GetParaPropsPos(*GetLayout(), *pCursor->GetPoint()));
+ GetDoc()->SetNodeNumStart( pos, nStt );
+ }
EndAllAction();
}
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index bac7372cd27e..d74f5d4dd2d0 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -102,6 +102,7 @@ std::unique_ptr<sw::MergedPara> CheckParaRedlineMerge(SwTextFrame & rFrame, SwTe
bool FrameContainsNode(SwContentFrame const& rFrame, sal_uLong nNodeIndex);
bool IsParaPropsNode(SwRootFrame const& rLayout, SwTextNode const& rNode);
SwTextNode * GetParaPropsNode(SwRootFrame const& rLayout, SwNodeIndex const& rNode);
+SwPosition GetParaPropsPos(SwRootFrame const& rLayout, SwPosition const& rPos);
TextFrameIndex UpdateMergedParaForDelete(MergedPara & rMerged,
bool isRealDelete,
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index e1f4beaefc3d..24d6b5fdb347 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -341,6 +341,19 @@ namespace sw {
}
}
+ SwPosition
+ GetParaPropsPos(SwRootFrame const& rLayout, SwPosition const& rPos)
+ {
+ SwPosition pos(rPos);
+ SwTextNode const*const pNode(pos.nNode.GetNode().GetTextNode());
+ if (pNode)
+ {
+ pos.nNode = *sw::GetParaPropsNode(rLayout, *pNode);
+ pos.nContent.Assign(pos.nNode.GetNode().GetContentNode(), 0);
+ }
+ return pos;
+ }
+
} // namespace sw
/// Switches width and height of the text frame
More information about the Libreoffice-commits
mailing list