[ooo-build-commit] .: sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Mon Oct 4 14:31:38 PDT 2010
sc/source/ui/view/tabcont.cxx | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
New commits:
commit e0bf78d6f572000cf5f9dda2a85dd15a8b350e18
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Mon Oct 4 17:27:20 2010 -0400
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.
diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx
index 073ab30..2f122da 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 )
More information about the ooo-build-commit
mailing list