summaryrefslogtreecommitdiff
path: root/sw/source/core/crsr/crsrsh.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/crsr/crsrsh.cxx')
-rw-r--r--sw/source/core/crsr/crsrsh.cxx54
1 files changed, 9 insertions, 45 deletions
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 67bbdad2c892..6278e620a865 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -614,7 +614,8 @@ SwFrm* lcl_IsInHeaderFooter( const SwNodeIndex& rIdx, Point& rPt )
SwCntntNode* pCNd = rIdx.GetNode().GetCntntNode();
if( pCNd )
{
- pFrm = pCNd->getLayoutFrm( pCNd->GetDoc()->GetCurrentLayout(), &rPt, 0, sal_False )->GetUpper();
+ SwCntntFrm *pCntFrm = pCNd->getLayoutFrm( pCNd->GetDoc()->GetCurrentLayout(), &rPt, 0, sal_False );
+ pFrm = pCntFrm ? pCntFrm->GetUpper() : NULL;
while( pFrm && !pFrm->IsHeaderFrm() && !pFrm->IsFooterFrm() )
pFrm = pFrm->IsFlyFrm() ? ((SwFlyFrm*)pFrm)->AnchorFrm()
: pFrm->GetUpper();
@@ -1320,6 +1321,11 @@ void SwCrsrShell::UpdateCrsr( sal_uInt16 eFlags, sal_Bool bIdleEnd )
return; // wenn nicht, dann kein Update !!
}
+ bool bInHeaderFooter = IsInHeaderFooter( );
+ if ( ( bInHeaderFooter && !IsHeaderFooterEdit( ) ) ||
+ ( !bInHeaderFooter && IsHeaderFooterEdit( ) ) )
+ ToggleHeaderFooterEdit( );
+
// #i27301#
SwNotifyAccAboutInvalidTextSelections aInvalidateTextSelections( *this );
@@ -2545,7 +2551,7 @@ void SwCrsrShell::ParkCrsr( const SwNodeIndex &rIdx )
SwCrsrShell::SwCrsrShell( SwCrsrShell& rShell, Window *pInitWin )
: ViewShell( rShell, pInitWin ),
- SwModify( 0 ), pCrsrStk( 0 ), pCrsrBack( 0 ), pBlockCrsr( 0 ), pTblCrsr( 0 ),
+ SwModify( 0 ), pCrsrStk( 0 ), pBlockCrsr( 0 ), pTblCrsr( 0 ),
pBoxIdx( 0 ), pBoxPtr( 0 ), nCrsrMove( 0 ), nBasicActionCnt( 0 ),
eMvState( MV_NONE ),
sMarkedListId(),
@@ -2573,7 +2579,7 @@ SwCrsrShell::SwCrsrShell( SwCrsrShell& rShell, Window *pInitWin )
SwCrsrShell::SwCrsrShell( SwDoc& rDoc, Window *pInitWin,
const SwViewOption *pInitOpt )
: ViewShell( rDoc, pInitWin, pInitOpt ),
- SwModify( 0 ), pCrsrStk( 0 ), pCrsrBack( 0 ), pBlockCrsr( 0 ), pTblCrsr( 0 ),
+ SwModify( 0 ), pCrsrStk( 0 ), pBlockCrsr( 0 ), pTblCrsr( 0 ),
pBoxIdx( 0 ), pBoxPtr( 0 ), nCrsrMove( 0 ), nBasicActionCnt( 0 ),
eMvState( MV_NONE ), // state for crsr-travelling - GetCrsrOfst
sMarkedListId(),
@@ -2635,9 +2641,6 @@ SwCrsrShell::~SwCrsrShell()
delete pCrsrStk;
}
- if( pCrsrBack )
- delete pCrsrBack;
-
// JP 27.07.98: Bug 54025 - ggfs. den HTML-Parser, der als Client in
// der CursorShell haengt keine Chance geben, sich an den
// TextNode zu haengen.
@@ -3450,43 +3453,4 @@ void SwCrsrShell::GetSmartTagTerm( const Point& rPt, SwRect& rSelectRect,
}
-void SwCrsrShell::ToggleHeaderFooterEdit( )
-{
- ViewShell::ToggleHeaderFooterEdit();
-
- SET_CURR_SHELL( this );
-
- if ( IsHeaderFooterEdit() )
- {
- pCrsrBack = new SwShellCrsr( *this, *pCurCrsr->GetPoint(),
- pCurCrsr->GetPtPos() );
-
- if ( pCurCrsr->HasMark() )
- {
- pCrsrBack->SetMark();
- *pCrsrBack->GetMark() = *pCurCrsr->GetMark();
- }
- }
- else
- {
- SwPosition& rPos = *pCurCrsr->GetPoint();
- rPos.nNode = pCrsrBack->GetPoint()->nNode;
- rPos.nContent = pCrsrBack->GetPoint()->nContent;
-
- if ( pCrsrBack->HasMark( ) )
- {
- pCurCrsr->SetMark();
- rPos = *pCurCrsr->GetMark();
- rPos.nNode = pCrsrBack->GetMark()->nNode;
- rPos.nContent = pCrsrBack->GetMark()->nContent;
- }
-
- delete pCrsrBack;
- pCrsrBack = NULL;
-
- UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE |
- SwCrsrShell::READONLY );
- }
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */