summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kyoshida@novell.com>2010-10-04 17:27:20 -0400
committerKohei Yoshida <kyoshida@novell.com>2010-10-04 17:27:20 -0400
commite0bf78d6f572000cf5f9dda2a85dd15a8b350e18 (patch)
treeda01a97472ab2a97aedb13735e004e4285f1ff11
parent7c5ca3a2ec39576045b4fb3c1739acdb39a15f96 (diff)
Ported calc-insert-new-sheet-tab-sc.diff from ooo-build.
Display a 'plus' button at the right end of the sheet tabs, to allow quick insertion of new sheets.
-rw-r--r--sc/source/ui/view/tabcont.cxx18
1 files changed, 15 insertions, 3 deletions
diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx
index 073ab3064..2f122da37 100644
--- a/sc/source/ui/view/tabcont.cxx
+++ b/sc/source/ui/view/tabcont.cxx
@@ -54,7 +54,7 @@
//==================================================================
ScTabControl::ScTabControl( Window* pParent, ScViewData* pData ) :
- TabBar( pParent, WinBits( WB_BORDER | WB_3DLOOK | WB_SCROLL |
+ TabBar( pParent, WinBits( WB_BORDER | WB_3DLOOK | WB_SCROLL | WB_INSERTTAB |
WB_RANGESELECT | WB_MULTISELECT | WB_DRAG | WB_SIZEABLE ) ),
DropTargetHelper( this ),
DragSourceHelper( this ),
@@ -161,7 +161,7 @@ void ScTabControl::MouseButtonDown( const MouseEvent& rMEvt )
Needing clean left click without modifiers (may be context menu).
#106948# Remember clicks to all pages, to be able to move mouse pointer later. */
if( rMEvt.IsLeft() && (rMEvt.GetModifier() == 0) )
- nMouseClickPageId = GetPageId( rMEvt.GetPosPixel() );
+ nMouseClickPageId = GetPageId( rMEvt.GetPosPixel(), true );
else
nMouseClickPageId = TabBar::PAGE_NOT_FOUND;
@@ -173,13 +173,25 @@ void ScTabControl::MouseButtonUp( const MouseEvent& rMEvt )
Point aPos = PixelToLogic( rMEvt.GetPosPixel() );
// mouse button down and up on same page?
- if( nMouseClickPageId != GetPageId( aPos ) )
+ if( nMouseClickPageId != GetPageId( aPos, true ) )
nMouseClickPageId = TabBar::PAGE_NOT_FOUND;
+ if (nMouseClickPageId == TabBar::INSERT_TAB_POS)
+ {
+ // Insert a new sheet at the right end, with default name.
+ ScDocument* pDoc = pViewData->GetDocument();
+ String aName;
+ pDoc->CreateValidTabName(aName);
+ SCTAB nTabCount = pDoc->GetTableCount();
+ pViewData->GetViewShell()->InsertTable(aName, nTabCount);
+ return;
+ }
+
if ( rMEvt.GetClicks() == 2 && rMEvt.IsLeft() && nMouseClickPageId != 0 && nMouseClickPageId != TAB_PAGE_NOTFOUND )
{
SfxDispatcher* pDispatcher = pViewData->GetViewShell()->GetViewFrame()->GetDispatcher();
pDispatcher->Execute( FID_TAB_MENU_RENAME, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD );
+ return;
}
if( nMouseClickPageId == 0 )