summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCédric Bosdonnat <cedric.bosdonnat.ooo@free.fr>2011-09-13 14:05:45 +0200
committerCédric Bosdonnat <cedric.bosdonnat.ooo@free.fr>2011-09-13 14:11:14 +0200
commit59585dab4bf00e4979fdfd8ce6c038ead143996e (patch)
treeebbfb65aa5bfb2d5f37ac4c2589f98cd9fff2b3e /sw
parentc0251bf65d1e972be395514724a413995ef53af8 (diff)
Header/Footer: fixed the Ctrl+PgUp and Ctrl+PdDown behaviors
When in a header and hitting Ctrl+PgDown, go to the end of the page if there is no footer in it instead of staying in the header. The same case for footers has been fixed too. Removed the cursor positioning hackery in ToggleHeaderFooterEdit(): this is now handled by the caller. Show the Header/Footer edition when hitting Ctrl+PgUp and Ctrl+PgDown and actually landing into a header or footer.
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/crsrsh.hxx3
-rw-r--r--sw/inc/viewsh.hxx2
-rw-r--r--sw/source/core/crsr/crsrsh.cxx51
-rw-r--r--sw/source/ui/docvw/edtwin.cxx5
-rw-r--r--sw/source/ui/shells/txtcrsr.cxx12
5 files changed, 23 insertions, 50 deletions
diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 3dc677e81e54..780e1d8046ff 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -190,7 +190,6 @@ private:
SwShellCrsr* pCurCrsr; // current cursor
SwShellCrsr* pCrsrStk; // stack for the cursor
SwVisCrsr *pVisCrsr; // the visible cursor
- SwShellCrsr* pCrsrBack; // Backup cursor for header/footer edit mode
IBlockCursor *pBlockCrsr; // interface of cursor for block (=rectangular) selection
@@ -851,8 +850,6 @@ public:
String GetCrsrDescr() const;
SwRect GetRectOfCurrentChar();
-
- virtual void ToggleHeaderFooterEdit( );
};
// Cursor Inlines:
diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index 3cb4748bc96c..8c2cab872725 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -565,7 +565,7 @@ public:
const SwPostItMgr* GetPostItMgr() const { return (const_cast<ViewShell*>(this))->GetPostItMgr(); }
SwPostItMgr* GetPostItMgr();
- virtual void ToggleHeaderFooterEdit( );
+ void ToggleHeaderFooterEdit( );
sal_Bool IsHeaderFooterEdit( ) const { return bHeaderFooterEdit; }
sal_Bool IsShowHeaderFooterSeparator( ) { return bShowHeaderFooterSeparator; }
void SetShowHeaderFooterSeparator( sal_Bool bShow ) { bShowHeaderFooterSeparator = bShow; }
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 67bbdad2c892..7339aba81000 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -1320,6 +1320,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 +2550,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 +2578,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 +2640,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 +3452,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: */
diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
index e7aa37db3dab..8b1ccca3cd97 100644
--- a/sw/source/ui/docvw/edtwin.cxx
+++ b/sw/source/ui/docvw/edtwin.cxx
@@ -1312,6 +1312,11 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt)
else if ( rKEvt.GetKeyCode().GetCode() == KEY_ESCAPE &&
rSh.IsHeaderFooterEdit( ) )
{
+ bool bHeader = FRMTYPE_HEADER & rSh.GetFrmType(0,sal_False);
+ if ( bHeader )
+ rSh.SttPg();
+ else
+ rSh.EndPg();
rSh.ToggleHeaderFooterEdit();
}
diff --git a/sw/source/ui/shells/txtcrsr.cxx b/sw/source/ui/shells/txtcrsr.cxx
index 2b27752741db..0be69175adda 100644
--- a/sw/source/ui/shells/txtcrsr.cxx
+++ b/sw/source/ui/shells/txtcrsr.cxx
@@ -293,7 +293,11 @@ void SwTextShell::ExecMoveMisc(SfxRequest &rReq)
if ( FRMTYPE_HEADER & rSh.GetFrmType(0,sal_False) )
rSh.SttPg();
else
- rSh.GotoHeaderTxt();
+ {
+ bool bMoved = rSh.GotoHeaderTxt();
+ if ( !bMoved )
+ rSh.SttPg();
+ }
bSetRetVal = sal_False;
break;
case FN_TO_FOOTER:
@@ -301,7 +305,11 @@ void SwTextShell::ExecMoveMisc(SfxRequest &rReq)
if ( FRMTYPE_FOOTER & rSh.GetFrmType(0,sal_False) )
rSh.EndPg();
else
- rSh.GotoFooterTxt();
+ {
+ bool bMoved = rSh.GotoFooterTxt();
+ if ( !bMoved )
+ rSh.EndPg();
+ }
bSetRetVal = sal_False;
break;
case FN_FOOTNOTE_TO_ANCHOR: