[Libreoffice-commits] core.git: 2 commits - sw/inc sw/source
Michael Stahl
mstahl at redhat.com
Wed Apr 19 11:06:48 UTC 2017
sw/inc/crsrsh.hxx | 7 --
sw/source/core/crsr/crsrsh.cxx | 95 ++++++++++++-----------------------
sw/source/uibase/dochdl/swdtflvr.cxx | 2
sw/source/uibase/uiview/view.cxx | 4 -
sw/source/uibase/wrtsh/wrtsh1.cxx | 7 +-
5 files changed, 42 insertions(+), 73 deletions(-)
New commits:
commit 31aac86f14d088628979c7809588f14bef643feb
Author: Michael Stahl <mstahl at redhat.com>
Date: Wed Apr 19 12:35:30 2017 +0200
sw: replace rudimentary SwCursorShell::m_nBasicActionCnt
The functions to modify the counter were removed in 2004-2006 and there
is no evidence in the git repo of these functions ever being called, so
the BasicActionPend() condition is effectively equivalent to
ActionPend().
Change-Id: Ic8b9c8c6039c318943c96e90f2370cb5a1046ff9
diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 122cda1406a8..7c5a8dff88dc 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -203,7 +203,6 @@ private:
* (via Find()) can be realised.
*/
sal_uInt16 m_nCursorMove;
- sal_uInt16 m_nBasicActionCnt; ///< Actions which are parenthesized by Basic
CursorMoveState m_eMvState; ///< Status for Cursor-Travelling - GetCursorOfst
OUString m_sMarkedListId;
@@ -747,8 +746,6 @@ public:
// is the whole document protected/hidden (for UI...)
bool IsAllProtect() const { return m_bAllProtect; }
- bool BasicActionPend() const { return m_nBasicActionCnt != mnStartAction; }
-
bool GotoRegion( const OUString& rName );
// show the current selection
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index eca8374a9cda..e22be8f4a772 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -264,29 +264,6 @@ void SwCursorShell::EndAction( const bool bIdleEnd, const bool DoSetPosX )
if( bVis ) // display SV-Cursor again
m_pVisibleCursor->Show();
- // If there is still a ChgCall and just the "basic
- // parenthising(?)" exists, call it. This
- // decouples the internal with the Basic-parenthising, the
- // Shells are switched.
- if( !BasicActionPend() )
- {
- // Within a Basic action, one needs to update the cursor,
- // to e.g. create the table cursor. This is being done in
- // UpdateCursor.
- UpdateCursor( eFlags, bIdleEnd );
-
- {
- // watch Cursor-Moves, call Link if needed, the DTOR is key here!
- SwCallLink aLk( *this, m_nAktNode, m_nAktContent, m_nAktNdTyp,
- m_nLeftFramePos, m_bAktSelection );
-
- }
- if( m_bCallChgLnk && m_bChgCallFlag && m_aChgLnk.IsSet() )
- {
- m_aChgLnk.Call( this );
- m_bChgCallFlag = false; // reset flag
- }
- }
return;
}
@@ -1434,9 +1411,7 @@ void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, bool bIdleEnd )
SET_CURR_SHELL( this );
ClearUpCursors();
- // In a BasicAction the cursor must be updated, e.g. to create the
- // TableCursor. EndAction now calls UpdateCursor!
- if( ActionPend() && BasicActionPend() )
+ if (ActionPend())
{
if ( eFlags & SwCursorShell::READONLY )
m_bIgnoreReadonly = true;
@@ -2275,9 +2250,9 @@ bool SwCursorShell::HasSelection() const
void SwCursorShell::CallChgLnk()
{
- // Do not make any call in start/end action but just remember the change.
- // This will be taken care of in the end action.
- if( BasicActionPend() )
+ // Do not make any call in StartAction/EndAction but just set the flag.
+ // This will be handled in EndAction.
+ if (ActionPend())
m_bChgCallFlag = true; // remember change
else if( m_aChgLnk.IsSet() )
{
@@ -2662,7 +2637,6 @@ SwCursorShell::SwCursorShell( SwCursorShell& rShell, vcl::Window *pInitWin )
, m_nAktNdTyp(SwNodeType::NONE)
, m_bAktSelection(false)
, m_nCursorMove( 0 )
- , m_nBasicActionCnt( 0 )
, m_eMvState( MV_NONE )
, m_sMarkedListId()
, m_nMarkedListLevel( 0 )
@@ -2700,7 +2674,6 @@ SwCursorShell::SwCursorShell( SwDoc& rDoc, vcl::Window *pInitWin,
, m_nAktNdTyp(SwNodeType::NONE)
, m_bAktSelection(false)
, m_nCursorMove( 0 )
- , m_nBasicActionCnt( 0 )
, m_eMvState( MV_NONE ) // state for crsr-travelling - GetCursorOfst
, m_sMarkedListId()
, m_nMarkedListLevel( 0 )
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index 1562752f40a5..27171bf0e836 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -415,7 +415,7 @@ bool SwTransferable::GetData( const DataFlavor& rFlavor, const OUString& rDestDo
// when pending we will not get the correct type, but SelectionType::Text
// as fallback. This *happens* during D&D, so we need to check if we are in
// the fallback and just try to get a graphic
- const bool bPending(m_pWrtShell->BasicActionPend());
+ const bool bPending(m_pWrtShell->ActionPend());
// SEL_GRF is from ContentType of editsh
if(bPending || ((SelectionType::Graphic | SelectionType::DbForm) & nSelectionType))
diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx
index 200e85432559..c2b2d9ea72e9 100644
--- a/sw/source/uibase/uiview/view.cxx
+++ b/sw/source/uibase/uiview/view.cxx
@@ -475,7 +475,7 @@ IMPL_LINK_NOARG(SwView, AttrChangedNotify, SwCursorShell*, void)
if( !m_bAttrChgNotified )
{
- if ( m_pWrtShell->BasicActionPend() || g_bNoInterrupt ||
+ if (m_pWrtShell->ActionPend() || g_bNoInterrupt ||
GetDispatcher().IsLocked() || //do not confuse the SFX
GetViewFrame()->GetBindings().IsInUpdate() )//do not confuse the SFX
{
@@ -508,7 +508,7 @@ IMPL_LINK_NOARG(SwView, AttrChangedNotify, SwCursorShell*, void)
IMPL_LINK_NOARG(SwView, TimeoutHdl, Timer *, void)
{
- if( m_pWrtShell->BasicActionPend() || g_bNoInterrupt )
+ if (m_pWrtShell->ActionPend() || g_bNoInterrupt)
{
m_aTimer.Start();
return;
diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx
index 9e7e6005abc6..18139d02318c 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -1352,12 +1352,11 @@ void SwWrtShell::BulletOn()
SelectionType SwWrtShell::GetSelectionType() const
{
- // ContentType cannot be determined within a
- // Start-/Endaction parentheses.
+ // ContentType cannot be determined within a Start-/EndAction.
// Because there is no invalid value TEXT will be returned.
- // The value does not matter, it may be updated in endaction anyway.
+ // The value does not matter, it may be updated in EndAction anyway.
- if ( BasicActionPend() )
+ if (ActionPend())
return IsSelFrameMode() ? SelectionType::Frame : SelectionType::Text;
SwView &_rView = const_cast<SwView&>(GetView());
commit 876e13576bf112786172fdc113363f3fe54f19f7
Author: Michael Stahl <mstahl at redhat.com>
Date: Wed Apr 19 12:21:18 2017 +0200
sw: resolve m_pCursorStack overload
Both SwCursorShell and SwWrtShell have a m_pCursorStack member, which is
confusing gdb.
Change-Id: Ie4674fa08eafcfae5273740d7ed8271614f311ab
diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 92cd91a466b2..122cda1406a8 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -177,7 +177,7 @@ private:
Link<SwCursorShell&,void> m_aGrfArrivedLnk; ///< Link calls to UI if a graphic is arrived
SwShellCursor* m_pCurrentCursor; ///< current cursor
- SwShellCursor* m_pCursorStack; ///< stack for the cursor
+ SwShellCursor* m_pStackCursor; ///< stack for the cursor
SwVisibleCursor *m_pVisibleCursor; ///< the visible cursor
SwBlockCursor *m_pBlockCursor; ///< interface of cursor for block (=rectangular) selection
@@ -856,7 +856,7 @@ inline SwCursor* SwCursorShell::GetSwCursor() const
return static_cast<SwCursor*>(GetCursor());
}
-inline SwPaM* SwCursorShell::GetStackCursor() const { return m_pCursorStack; }
+inline SwPaM* SwCursorShell::GetStackCursor() const { return m_pStackCursor; }
inline void SwCursorShell::SetMark() { m_pCurrentCursor->SetMark(); }
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 4d44568b6d94..eca8374a9cda 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -1031,7 +1031,7 @@ int SwCursorShell::CompareCursorStackMkCurrPt() const
{
int nRet = 0;
const SwPosition *pFirst = nullptr, *pSecond = nullptr;
- const SwPaM *pCur = GetCursor(), *pStack = m_pCursorStack;
+ const SwPaM *pCur = GetCursor(), *pStack = m_pStackCursor;
// cursor on stack is needed if we compare against stack
if( pStack )
{
@@ -2012,13 +2012,13 @@ void SwCursorShell::Push()
// This seems to work because UpdateCursor() will fix this up on Pop(),
// then MakeBoxSels() will re-create the current m_pCurrentCursor cell ring.
SwShellCursor *const pCurrent((m_pTableCursor) ? m_pTableCursor : m_pCurrentCursor);
- m_pCursorStack = new SwShellCursor( *this, *pCurrent->GetPoint(),
- pCurrent->GetPtPos(), m_pCursorStack );
+ m_pStackCursor = new SwShellCursor( *this, *pCurrent->GetPoint(),
+ pCurrent->GetPtPos(), m_pStackCursor );
if (pCurrent->HasMark())
{
- m_pCursorStack->SetMark();
- *m_pCursorStack->GetMark() = *pCurrent->GetMark();
+ m_pStackCursor->SetMark();
+ *m_pStackCursor->GetMark() = *pCurrent->GetMark();
}
}
@@ -2033,21 +2033,21 @@ bool SwCursorShell::Pop( bool bOldCursor )
SwCallLink aLk( *this ); // watch Cursor-Moves; call Link if needed
// are there any left?
- if( nullptr == m_pCursorStack )
+ if (nullptr == m_pStackCursor)
return false;
- SwShellCursor *pTmp = nullptr, *pOldStack = m_pCursorStack;
+ SwShellCursor *pTmp = nullptr, *pOldStack = m_pStackCursor;
// the successor becomes the current one
- if( m_pCursorStack->GetNext() != m_pCursorStack )
+ if (m_pStackCursor->GetNext() != m_pStackCursor)
{
- pTmp = dynamic_cast<SwShellCursor*>(m_pCursorStack->GetNext());
+ pTmp = dynamic_cast<SwShellCursor*>(m_pStackCursor->GetNext());
}
if( bOldCursor ) // delete from stack
- delete m_pCursorStack;
+ delete m_pStackCursor;
- m_pCursorStack = pTmp; // assign new one
+ m_pStackCursor = pTmp; // assign new one
if( !bOldCursor )
{
@@ -2096,29 +2096,29 @@ bool SwCursorShell::Pop( bool bOldCursor )
void SwCursorShell::Combine()
{
// any others left?
- if( nullptr == m_pCursorStack )
+ if (nullptr == m_pStackCursor)
return;
SwCallLink aLk( *this ); // watch Cursor-Moves; call Link if needed
// rhbz#689053: IsSelOvr must restore the saved stack position, not the
// current one, because current point + stack mark may be invalid PaM
- SwCursorSaveState aSaveState(*m_pCursorStack);
+ SwCursorSaveState aSaveState(*m_pStackCursor);
// stack cursor & current cursor in same Section?
- assert(!m_pCursorStack->HasMark() ||
- CheckNodesRange(m_pCursorStack->GetMark()->nNode,
+ assert(!m_pStackCursor->HasMark() ||
+ CheckNodesRange(m_pStackCursor->GetMark()->nNode,
m_pCurrentCursor->GetPoint()->nNode, true));
- *m_pCursorStack->GetPoint() = *m_pCurrentCursor->GetPoint();
- m_pCursorStack->GetPtPos() = m_pCurrentCursor->GetPtPos();
+ *m_pStackCursor->GetPoint() = *m_pCurrentCursor->GetPoint();
+ m_pStackCursor->GetPtPos() = m_pCurrentCursor->GetPtPos();
SwShellCursor * pTmp = nullptr;
- if( m_pCursorStack->GetNext() != m_pCursorStack )
+ if (m_pStackCursor->GetNext() != m_pStackCursor)
{
- pTmp = dynamic_cast<SwShellCursor*>(m_pCursorStack->GetNext());
+ pTmp = dynamic_cast<SwShellCursor*>(m_pStackCursor->GetNext());
}
delete m_pCurrentCursor;
- m_pCurrentCursor = m_pCursorStack;
- m_pCursorStack->MoveTo(nullptr); // remove from ring
- m_pCursorStack = pTmp;
+ m_pCurrentCursor = m_pStackCursor;
+ m_pStackCursor->MoveTo(nullptr); // remove from ring
+ m_pStackCursor = pTmp;
if( !m_pCurrentCursor->IsInProtectTable( true ) &&
!m_pCurrentCursor->IsSelOvr( SwCursorSelOverFlags::Toggle |
SwCursorSelOverFlags::ChangePos ) )
@@ -2622,8 +2622,8 @@ void SwCursorShell::ParkCursor( const SwNodeIndex &rIdx )
if( dynamic_cast<const SwCursorShell *>(&rTmp) != nullptr)
{
SwCursorShell* pSh = static_cast<SwCursorShell*>(&rTmp);
- if( pSh->m_pCursorStack )
- pSh->ParkPams( pNew.get(), &pSh->m_pCursorStack );
+ if (pSh->m_pStackCursor)
+ pSh->ParkPams(pNew.get(), &pSh->m_pStackCursor);
pSh->ParkPams( pNew.get(), &pSh->m_pCurrentCursor );
if( pSh->m_pTableCursor )
@@ -2650,7 +2650,7 @@ void SwCursorShell::ParkCursor( const SwNodeIndex &rIdx )
SwCursorShell::SwCursorShell( SwCursorShell& rShell, vcl::Window *pInitWin )
: SwViewShell( rShell, pInitWin )
, SwModify( nullptr )
- , m_pCursorStack( nullptr )
+ , m_pStackCursor( nullptr )
, m_pBlockCursor( nullptr )
, m_pTableCursor( nullptr )
, m_pBoxIdx( nullptr )
@@ -2688,7 +2688,7 @@ SwCursorShell::SwCursorShell( SwDoc& rDoc, vcl::Window *pInitWin,
const SwViewOption *pInitOpt )
: SwViewShell( rDoc, pInitWin, pInitOpt )
, SwModify( nullptr )
- , m_pCursorStack( nullptr )
+ , m_pStackCursor( nullptr )
, m_pBlockCursor( nullptr )
, m_pTableCursor( nullptr )
, m_pBoxIdx( nullptr )
@@ -2748,11 +2748,11 @@ SwCursorShell::~SwCursorShell()
delete m_pCurrentCursor;
// free stack
- if( m_pCursorStack )
+ if (m_pStackCursor)
{
- while( m_pCursorStack->GetNext() != m_pCursorStack )
- delete m_pCursorStack->GetNext();
- delete m_pCursorStack;
+ while (m_pStackCursor->GetNext() != m_pStackCursor)
+ delete m_pStackCursor->GetNext();
+ delete m_pStackCursor;
}
// #i54025# - do not give a HTML parser that might potentially hang as
More information about the Libreoffice-commits
mailing list