temporarily cripple formula panel by removing FT_SPLIT

Change-Id: I0a96a812b597aa657138ef061e4918018111cfa6
This commit is contained in:
Caolán McNamara
2016-10-23 20:41:11 +01:00
parent d64a72be9f
commit d02e96e0f2
4 changed files with 2 additions and 268 deletions

View File

@@ -55,25 +55,18 @@
ScFunctionWin::ScFunctionWin(vcl::Window* pParent, const ResId& rResId) :
vcl::Window(pParent, rResId),
aIdle ( "sc formdlg ScFunctionWin" ),
aPrivatSplit ( VclPtr<ScPrivatSplit>::Create( this, ResId( FT_SPLIT, *rResId.GetResMgr() ) ) ),
aCatBox ( VclPtr<ListBox>::Create( this, ResId( CB_CAT, *rResId.GetResMgr() ) ) ),
aFuncList ( VclPtr<ListBox>::Create( this, ResId( LB_FUNC, *rResId.GetResMgr() ) ) ),
aInsertButton ( VclPtr<ImageButton>::Create( this, ResId( IMB_INSERT, *rResId.GetResMgr() ) ) ),
aFiFuncDesc ( VclPtr<FixedText>::Create( this, ResId( FI_FUNCDESC, *rResId.GetResMgr() ) ) ),
aOldSize (0,0),
pFuncDesc (nullptr)
{
FreeResource();
InitLRUList();
SetStyle(GetStyle()|WB_CLIPCHILDREN);
aIdle.SetPriority(SchedulerPriority::LOWER);
aIdle.SetIdleHdl(LINK( this, ScFunctionWin, TimerHdl));
aFiFuncDesc->SetUpdateMode(true);
nArgs=0;
bSizeFlag=false;
aCatBox->SetDropDownLineCount(9);
vcl::Font aFont=aFiFuncDesc->GetFont();
aFont.SetColor(Color(COL_BLACK));
@@ -87,20 +80,8 @@ ScFunctionWin::ScFunctionWin(vcl::Window* pParent, const ResId& rResId) :
aFuncList->SetDoubleClickHdl(LINK( this, ScFunctionWin, SetSelectionHdl));
aInsertButton->SetClickHdl(LINK( this, ScFunctionWin, SetSelectionClickHdl));
Link<ScPrivatSplit&,void> a3Link=LINK( this, ScFunctionWin, SetSplitHdl);
aPrivatSplit->SetCtrModifiedHdl(a3Link);
Point aTopLeft=aCatBox->GetPosPixel();
OUString aString("ww");
Size aTxtSize( aFiFuncDesc->GetTextWidth(aString), aFiFuncDesc->GetTextHeight() );
nMinWidth=aTxtSize.Width()+aTopLeft.X()
+2*aFuncList->GetPosPixel().X();
nMinHeight=19*aTxtSize.Height();
aCatBox->SelectEntryPos(0);
Range aYRange(3*aTxtSize.Height()+aFuncList->GetPosPixel().Y(),
GetOutputSizePixel().Height()-2*aTxtSize.Height());
aPrivatSplit->SetYRange(aYRange);
SelHdl(*aCatBox.get());
}
@@ -125,7 +106,6 @@ ScFunctionWin::~ScFunctionWin()
void ScFunctionWin::dispose()
{
aPrivatSplit.disposeAndClear();
aCatBox.disposeAndClear();
aFuncList.disposeAndClear();
aInsertButton.disposeAndClear();
@@ -182,158 +162,6 @@ void ScFunctionWin::UpdateLRUList()
}
}
/*************************************************************************
#* Member: SetSize
#*------------------------------------------------------------------------
#*
#* Klasse: ScFunctionWin
#*
#* Funktion: Groesse fuer die einzelnen Controls einzustellen.
#*
#* Input: ---
#*
#* Output: ---
#*
#************************************************************************/
void ScFunctionWin::SetSize()
{
SetLeftRightSize();
}
/*************************************************************************
#* Member: SetLeftRightSize
#*------------------------------------------------------------------------
#*
#* Klasse: ScFunctionWin
#*
#* Funktion: Groesse fuer die einzelnen Controls einstellen,
#* wenn Links oder Rechts angedockt wird.
#*
#* Input: ---
#*
#* Output: ---
#*
#************************************************************************/
void ScFunctionWin::SetLeftRightSize()
{
if(!bSizeFlag)
{
bSizeFlag = true;
Size aDiffSize=GetSizePixel();
Size aNewSize=GetOutputSizePixel();
aDiffSize.Width()-=aNewSize.Width();
aDiffSize.Height()-=aNewSize.Height();
OUString aString("ww");
Size aTxtSize( aFuncList->GetTextWidth(aString), aFuncList->GetTextHeight() );
Range aYRange(3*aTxtSize.Height()+aFuncList->GetPosPixel().Y(),
GetOutputSizePixel().Height()-2*aTxtSize.Height());
aPrivatSplit->SetYRange(aYRange);
if(aOldSize.Width()!=aNewSize.Width())
SetMyWidthLeRi(aNewSize);
if(aOldSize.Height()!=aNewSize.Height())
SetMyHeightLeRi(aNewSize);
aOldSize=aNewSize;
aNewSize.Width()+=aDiffSize.Width();
aNewSize.Height()+=aDiffSize.Height();
bSizeFlag=false;
}
}
/*************************************************************************
#* Member: SetMyWidthLeRi
#*------------------------------------------------------------------------
#*
#* Klasse: ScFunctionWin
#*
#* Funktion: Breite fuer die einzelnen Controls und
#* das Fenster einstellen,wenn Li oder Re
#*
#* Input: neue Fenstergroesse
#*
#* Output: ---
#*
#************************************************************************/
void ScFunctionWin::SetMyWidthLeRi(Size &aNewSize)
{
if((sal_uLong)aNewSize.Width()<nMinWidth) aNewSize.Width()=nMinWidth;
Size aCDSize=aCatBox->GetSizePixel();
Size aFLSize=aFuncList->GetSizePixel();
Size aSplitterSize=aPrivatSplit->GetSizePixel();
Size aFDSize=aFiFuncDesc->GetSizePixel();
Point aCDTopLeft=aCatBox->GetPosPixel();
Point aFLTopLeft=aFuncList->GetPosPixel();
aCDSize.Width()=aNewSize.Width()-aCDTopLeft.X()-aFLTopLeft.X();
aFLSize.Width()=aNewSize.Width()-2*aFLTopLeft.X();
aFDSize.Width()=aFLSize.Width();
aSplitterSize.Width()=aFLSize.Width();
aCatBox->SetSizePixel(aCDSize);
aFuncList->SetSizePixel(aFLSize);
aPrivatSplit->SetSizePixel(aSplitterSize);
aFiFuncDesc->SetSizePixel(aFDSize);
}
/*************************************************************************
#* Member: SetHeight
#*------------------------------------------------------------------------
#*
#* Klasse: ScFunctionWin
#*
#* Funktion: Hoehe fuer die einzelnen Controls und
#* das Fenster einstellen bei Li oder Re
#*
#* Input: neue Fenstergroesse
#*
#* Output: ---
#*
#************************************************************************/
void ScFunctionWin::SetMyHeightLeRi(Size &aNewSize)
{
if((sal_uLong)aNewSize.Height()<nMinHeight) aNewSize.Height()=nMinHeight;
Size aFLSize=aFuncList->GetSizePixel();
Size aSplitterSize=aPrivatSplit->GetSizePixel();
Size aFDSize=aFiFuncDesc->GetSizePixel();
Point aFLTopLeft=aFuncList->GetPosPixel();
Point aSplitterTopLeft=aPrivatSplit->GetPosPixel();
Point aFDTopLeft=aFiFuncDesc->GetPosPixel();
long nTxtHeight = aFuncList->GetTextHeight();
short nY=(short)(3*nTxtHeight+
aFuncList->GetPosPixel().Y()+aSplitterSize.Height());
aFDTopLeft.Y()=aNewSize.Height()-aFDSize.Height()-4;
if(nY>aFDTopLeft.Y())
{
aFDSize.Height()-=nY-aFDTopLeft.Y();
aFDTopLeft.Y()=nY;
}
aSplitterTopLeft.Y()=aFDTopLeft.Y()-aSplitterSize.Height()-1;
aFLSize.Height()=aSplitterTopLeft.Y()-aFLTopLeft.Y()-1;
aFuncList->SetSizePixel(aFLSize);
aPrivatSplit->SetPosPixel(aSplitterTopLeft);
aFiFuncDesc->SetPosPixel(aFDTopLeft);
aFiFuncDesc->SetSizePixel(aFDSize);
}
/*************************************************************************
#* Member: SetDescription
#*------------------------------------------------------------------------
@@ -372,13 +200,6 @@ void ScFunctionWin::SetDescription()
}
}
/// override to set new size of the controls
void ScFunctionWin::Resize()
{
SetSize();
vcl::Window::Resize();
}
/*************************************************************************
#* Member: UpdateFunctionList
#*------------------------------------------------------------------------
@@ -614,66 +435,4 @@ IMPL_LINK_NOARG( ScFunctionWin, SetSelectionHdl, ListBox&, void )
DoEnter(); // Uebernimmt die Eingabe
}
/*************************************************************************
#* Handle: SetSplitHdl
#*------------------------------------------------------------------------
#*
#* Klasse: ScFunctionWin
#*
#* Funktion: Bei einer Aenderung des Split- Controls werden die
#* einzelnen Controls an die neue Groesse angepasst.
#*
#* Input: Zeiger auf Control
#*
#* Output: ---
#*
#************************************************************************/
IMPL_LINK( ScFunctionWin, SetSplitHdl, ScPrivatSplit&, rCtrl, void )
{
if (&rCtrl == aPrivatSplit.get())
{
short nDeltaY=aPrivatSplit->GetDeltaY();
Size aFLSize=aFuncList->GetSizePixel();
Size aFDSize=aFiFuncDesc->GetSizePixel();
Point aFDTopLeft=aFiFuncDesc->GetPosPixel();
aFLSize.Height()+=nDeltaY;
aFDSize.Height()-=nDeltaY;
aFDTopLeft.Y()+=nDeltaY;
aFuncList->SetSizePixel(aFLSize);
aFiFuncDesc->SetPosPixel(aFDTopLeft);
aFiFuncDesc->SetSizePixel(aFDSize);
}
}
IMPL_LINK_NOARG(ScFunctionWin, TimerHdl, Idle *, void)
{
OUString aString("ww");
Size aTxtSize( aFiFuncDesc->GetTextWidth(aString), aFiFuncDesc->GetTextHeight() );
Point aTopLeft=aCatBox->GetPosPixel();
nMinWidth=aTxtSize.Width()+aTopLeft.X() +2*aFuncList->GetPosPixel().X();
nMinHeight=19*aTxtSize.Height();
SetSize();
}
void ScFunctionWin::UseSplitterInitPos()
{
if ( IsVisible() && aPrivatSplit->IsEnabled() && aSplitterInitPos != Point() )
{
aPrivatSplit->MoveSplitTo(aSplitterInitPos);
aSplitterInitPos = Point(); // use only once
}
}
void ScFunctionWin::StateChanged( StateChangedType nStateChange )
{
vcl::Window::StateChanged( nStateChange );
if (nStateChange == StateChangedType::InitShow)
{
UseSplitterInitPos(); // set initial splitter position if necessary
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -21,6 +21,5 @@
#define LB_FUNC 2
#define IMB_INSERT 1
#define FI_FUNCDESC 1
#define FT_SPLIT 2
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -70,11 +70,6 @@ Window FID_FUNCTION_BOX
Pos = MAP_APPFONT ( 3 , 115 ) ;
Size = MAP_APPFONT ( 72 , 40 ) ;
};
Control FT_SPLIT
{
Pos = MAP_APPFONT ( 3 , 110 ) ;
Size = MAP_APPFONT ( 72 , 3 ) ;
};
ImageButton IMB_INSERT
{
HelpID = "sc:ImageButton:FID_FUNCTION_BOX:IMB_INSERT";

View File

@@ -35,18 +35,11 @@ class ScFunctionWin : public vcl::Window
{
private:
Idle aIdle;
VclPtr<ScPrivatSplit> aPrivatSplit;
VclPtr<ListBox> aCatBox;
VclPtr<ListBox> aFuncList;
VclPtr<ImageButton> aInsertButton;
VclPtr<FixedText> aFiFuncDesc;
sal_uLong nMinWidth;
sal_uLong nMinHeight;
Size aOldSize;
bool bSizeFlag;
Point aSplitterInitPos;
const ScFuncDesc* pFuncDesc;
sal_uInt16 nArgs;
@@ -56,27 +49,15 @@ private:
void UpdateLRUList();
void DoEnter();
void SetDescription();
void SetLeftRightSize();
void SetMyWidthLeRi(Size &aNewSize);
void SetMyHeightLeRi(Size &aNewSize);
void UseSplitterInitPos();
DECL_LINK( SetSelectionHdl, ListBox&, void );
DECL_LINK( SetSelectionClickHdl, Button*, void );
DECL_LINK( SelHdl, ListBox&, void );
DECL_LINK( SetSplitHdl, ScPrivatSplit&, void );
DECL_LINK( TimerHdl, Idle*, void );
protected:
virtual void Resize() override;
void SetSize();
virtual void StateChanged( StateChangedType nStateChange ) override;
public:
ScFunctionWin(vcl::Window* pParent, const ResId& rResId);
ScFunctionWin(vcl::Window* pParent, const ResId& rResId);
virtual ~ScFunctionWin() override;
virtual ~ScFunctionWin() override;
virtual void dispose() override;
void InitLRUList();