diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-05-17 11:51:14 +0900 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-05-17 12:25:53 +0900 |
commit | e4164351dc311839f4a7eb2743be8af17592b8e5 (patch) | |
tree | 238d894fa2c4ec95052927de49db77a3d6277935 /sc | |
parent | 6aab2eceaa386c14c2283631d3107cab7484f0f8 (diff) |
tabbar: use a button for adding of tabs, move button before tabs
Change-Id: I89fcf7427694ea6fc9468220bae639b221d9ec28
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/inc/tabcont.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/tabcont.cxx | 40 |
2 files changed, 20 insertions, 22 deletions
diff --git a/sc/source/ui/inc/tabcont.hxx b/sc/source/ui/inc/tabcont.hxx index 3b0d687f201c..d1515c56b843 100644 --- a/sc/source/ui/inc/tabcont.hxx +++ b/sc/source/ui/inc/tabcont.hxx @@ -61,6 +61,8 @@ protected: virtual void EndRenaming() SAL_OVERRIDE; virtual void Mirror() SAL_OVERRIDE; + virtual void AddTabClick() SAL_OVERRIDE; + public: ScTabControl( vcl::Window* pParent, ScViewData* pData ); virtual ~ScTabControl(); diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx index 7801b719c08b..1c19b55751bf 100644 --- a/sc/source/ui/view/tabcont.cxx +++ b/sc/source/ui/view/tabcont.cxx @@ -174,13 +174,8 @@ void ScTabControl::MouseButtonDown( const MouseEvent& rMEvt ) pViewData->GetView()->ActiveGrabFocus(); } - /* Click into free area -> insert new sheet (like in Draw). - Needing clean left click without modifiers (may be context menu). - Remember clicks to all pages, to be able to move mouse pointer later. */ - if( rMEvt.IsLeft() && (rMEvt.GetModifier() == 0) ) - nMouseClickPageId = GetPageId( rMEvt.GetPosPixel(), true ); - else - nMouseClickPageId = TabBar::PAGE_NOT_FOUND; + if (rMEvt.IsLeft() && rMEvt.GetModifier() == 0) + nMouseClickPageId = GetPageId(rMEvt.GetPosPixel()); TabBar::MouseButtonDown( rMEvt ); } @@ -190,23 +185,9 @@ void ScTabControl::MouseButtonUp( const MouseEvent& rMEvt ) Point aPos = PixelToLogic( rMEvt.GetPosPixel() ); // mouse button down and up on same page? - if( nMouseClickPageId != GetPageId( aPos, true ) ) + if( nMouseClickPageId != GetPageId(aPos)) 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(); - ScModule* pScMod = SC_MOD(); - if (!pDoc->IsDocEditable() || pScMod->IsTableLocked()) - return; - OUString 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(); @@ -229,6 +210,21 @@ void ScTabControl::MouseButtonUp( const MouseEvent& rMEvt ) TabBar::MouseButtonUp( rMEvt ); } +void ScTabControl::AddTabClick() +{ + TabBar::AddTabClick(); + + // Insert a new sheet at the right end, with default name. + ScDocument* pDoc = pViewData->GetDocument(); + ScModule* pScMod = SC_MOD(); + if (!pDoc->IsDocEditable() || pScMod->IsTableLocked()) + return; + OUString aName; + pDoc->CreateValidTabName(aName); + SCTAB nTabCount = pDoc->GetTableCount(); + pViewData->GetViewShell()->InsertTable(aName, nTabCount); +} + void ScTabControl::Select() { /* Remember last clicked page ID. */ |