Kaydet (Commit) e0b93ef5 authored tarafından Dennis Francis's avatar Dennis Francis Kaydeden (comit) Eike Rathke

tdf#34094 : Allow column and row selections while creating a formula

Change-Id: I516ca96c0743840fb03d8208f7236ca25027bc45
Reviewed-on: https://gerrit.libreoffice.org/20102Reviewed-by: 's avatarEike Rathke <erack@redhat.com>
Tested-by: 's avatarEike Rathke <erack@redhat.com>
üst f88576cb
......@@ -102,7 +102,7 @@ ScFormulaDlg::ScFormulaDlg( SfxBindings* pB, SfxChildWindow* pCW,
if ( pInputHdl )
pInputHdl->NotifyChange( nullptr );
ScFormulaReferenceHelper::enableInput( false );
ScFormulaReferenceHelper::enableInput( true );
ScFormulaReferenceHelper::EnableSpreadsheets();
m_aHelper.Init();
ScFormulaReferenceHelper::SetDispatcherLock( true );
......
......@@ -25,16 +25,17 @@
class ScHeaderFunctionSet;
class ScHeaderSelectionEngine;
class ScTabView;
class ScColBar : public ScHeaderControl
{
ScViewData* pViewData;
ScHSplitPos eWhich;
ScHeaderFunctionSet* pFuncSet;
public:
ScColBar( vcl::Window* pParent, ScViewData* pData, ScHSplitPos eWhichPos,
ScHeaderFunctionSet* pFunc, ScHeaderSelectionEngine* pEng );
ScColBar( vcl::Window* pParent, ScHSplitPos eWhichPos,
ScHeaderFunctionSet* pFunc, ScHeaderSelectionEngine* pEng,
ScTabView* pTab );
virtual ~ScColBar();
virtual SCCOLROW GetPos() const override;
......@@ -60,13 +61,13 @@ public:
class ScRowBar : public ScHeaderControl
{
ScViewData* pViewData;
ScVSplitPos eWhich;
ScHeaderFunctionSet* pFuncSet;
public:
ScRowBar( vcl::Window* pParent, ScViewData* pData, ScVSplitPos eWhichPos,
ScHeaderFunctionSet* pFunc, ScHeaderSelectionEngine* pEng );
ScRowBar( vcl::Window* pParent, ScVSplitPos eWhichPos,
ScHeaderFunctionSet* pFunc, ScHeaderSelectionEngine* pEng,
ScTabView* pTab );
virtual ~ScRowBar();
virtual SCCOLROW GetPos() const override;
......
......@@ -29,6 +29,8 @@
// Size of the sliders
#define HDR_SLIDERSIZE 2
class ScTabView;
class ScHeaderControl : public vcl::Window
{
private:
......@@ -57,6 +59,8 @@ private:
bool bIgnoreMove;
bool bDoneInitRef;
long GetScrPos( SCCOLROW nEntryNo ) const;
SCCOLROW GetMousePos( const MouseEvent& rMEvt, bool& rBorder ) const;
bool IsSelectionAllowed(SCCOLROW nPos) const;
......@@ -67,6 +71,8 @@ private:
void DrawShadedRect( long nStart, long nEnd, const Color& rBaseColor );
protected:
ScTabView* pTabView;
// Window overrides
virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) override;
......@@ -102,7 +108,7 @@ protected:
public:
ScHeaderControl( vcl::Window* pParent, SelectionEngine* pSelectionEngine,
SCCOLROW nNewSize, bool bNewVertical );
SCCOLROW nNewSize, bool bNewVertical, ScTabView* pTab );
virtual ~ScHeaderControl();
void SetIgnoreMove(bool bSet) { bIgnoreMove = bSet; }
......
This diff is collapsed.
......@@ -32,6 +32,8 @@
#include "gridmerg.hxx"
#include "document.hxx"
#include "markdata.hxx"
#include "tabview.hxx"
#include "viewdata.hxx"
#define SC_DRAG_MIN 2
......@@ -45,7 +47,7 @@
#define SC_HDRPAINT_COUNT 7
ScHeaderControl::ScHeaderControl( vcl::Window* pParent, SelectionEngine* pSelectionEngine,
SCCOLROW nNewSize, bool bNewVertical ) :
SCCOLROW nNewSize, bool bNewVertical, ScTabView* pTab ) :
Window ( pParent ),
pSelEngine ( pSelectionEngine ),
bVertical ( bNewVertical ),
......@@ -58,7 +60,9 @@ ScHeaderControl::ScHeaderControl( vcl::Window* pParent, SelectionEngine* pSelect
nDragStart ( 0 ),
nDragPos ( 0 ),
bDragMoved ( false ),
bIgnoreMove ( false )
bIgnoreMove ( false ),
bDoneInitRef( false ),
pTabView ( pTab )
{
// --- RTL --- no default mirroring for this window, the spreadsheet itself
// is also not mirrored
......@@ -656,6 +660,26 @@ void ScHeaderControl::MouseButtonDown( const MouseEvent& rMEvt )
return;
if ( ! rMEvt.IsLeft() )
return;
if ( SC_MOD()->IsFormulaMode() )
{
if( !pTabView )
return;
SCTAB nTab = pTabView->GetViewData().GetTabNo();
if( !rMEvt.IsShift() )
pTabView->DoneRefMode();
bDoneInitRef = true;
if( !bVertical )
{
pTabView->InitRefMode( nHitNo, 0, nTab, SC_REFTYPE_REF );
pTabView->UpdateRef( nHitNo, MAXROW, nTab );
}
else
{
pTabView->InitRefMode( 0, nHitNo, nTab, SC_REFTYPE_REF );
pTabView->UpdateRef( MAXCOL, nHitNo, nTab );
}
return;
}
if ( bIsBorder && ResizeAllowed() )
{
nDragNo = nHitNo;
......@@ -714,6 +738,13 @@ void ScHeaderControl::MouseButtonUp( const MouseEvent& rMEvt )
if ( IsDisabled() )
return;
if ( SC_MOD()->IsFormulaMode() )
{
SC_MOD()->EndReference();
bDoneInitRef = false;
return;
}
SetMarking( false );
bIgnoreMove = false;
......@@ -767,6 +798,21 @@ void ScHeaderControl::MouseMove( const MouseEvent& rMEvt )
return;
}
if ( bDoneInitRef && rMEvt.IsLeft() && SC_MOD()->IsFormulaMode() )
{
if( !pTabView )
return;
bool bTmp;
SCCOLROW nHitNo = GetMousePos( rMEvt, bTmp );
SCTAB nTab = pTabView->GetViewData().GetTabNo();
if( !bVertical )
pTabView->UpdateRef( nHitNo, MAXROW, nTab );
else
pTabView->UpdateRef( MAXCOL, nHitNo, nTab );
return;
}
if ( bDragging )
{
long nNewPos = bVertical ? rMEvt.GetPosPixel().Y() : rMEvt.GetPosPixel().X();
......
......@@ -1479,11 +1479,11 @@ void ScTabView::UpdateShow()
pRowOutline[SC_SPLIT_TOP] = VclPtr<ScOutlineWindow>::Create( pFrameWin, SC_OUTLINE_VER, &aViewData, SC_SPLIT_TOPLEFT );
if (bShowH && bHeader && !pColBar[SC_SPLIT_RIGHT])
pColBar[SC_SPLIT_RIGHT] = VclPtr<ScColBar>::Create( pFrameWin, &aViewData, SC_SPLIT_RIGHT,
&aHdrFunc, pHdrSelEng );
pColBar[SC_SPLIT_RIGHT] = VclPtr<ScColBar>::Create( pFrameWin, SC_SPLIT_RIGHT,
&aHdrFunc, pHdrSelEng, this );
if (bShowV && bHeader && !pRowBar[SC_SPLIT_TOP])
pRowBar[SC_SPLIT_TOP] = VclPtr<ScRowBar>::Create( pFrameWin, &aViewData, SC_SPLIT_TOP,
&aHdrFunc, pHdrSelEng );
pRowBar[SC_SPLIT_TOP] = VclPtr<ScRowBar>::Create( pFrameWin, SC_SPLIT_TOP,
&aHdrFunc, pHdrSelEng, this );
// show Windows
......
......@@ -85,11 +85,11 @@ void ScTabView::Init()
pHdrSelEng = new ScHeaderSelectionEngine( pFrameWin, &aHdrFunc );
pColBar[SC_SPLIT_LEFT] = VclPtr<ScColBar>::Create( pFrameWin, &aViewData, SC_SPLIT_LEFT,
&aHdrFunc, pHdrSelEng );
pColBar[SC_SPLIT_LEFT] = VclPtr<ScColBar>::Create( pFrameWin, SC_SPLIT_LEFT,
&aHdrFunc, pHdrSelEng, this );
pColBar[SC_SPLIT_RIGHT] = nullptr;
pRowBar[SC_SPLIT_BOTTOM] = VclPtr<ScRowBar>::Create( pFrameWin, &aViewData, SC_SPLIT_BOTTOM,
&aHdrFunc, pHdrSelEng );
pRowBar[SC_SPLIT_BOTTOM] = VclPtr<ScRowBar>::Create( pFrameWin, SC_SPLIT_BOTTOM,
&aHdrFunc, pHdrSelEng, this );
pRowBar[SC_SPLIT_TOP] = nullptr;
for (i=0; i<2; i++)
pColOutline[i] = pRowOutline[i] = nullptr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment