Resolves: tdf#96366 replace Edit...() calls with actually working code
... and way less overhead, geez.. Change-Id: Id9277301fbe69bc9a83ca39a907032b0b86b1c81
This commit is contained in:
@@ -92,6 +92,8 @@ public:
|
|||||||
bool EditNextFunc( bool bForward, sal_Int32 nFStart=NOT_FOUND );
|
bool EditNextFunc( bool bForward, sal_Int32 nFStart=NOT_FOUND );
|
||||||
void EditThisFunc(sal_Int32 nFStart);
|
void EditThisFunc(sal_Int32 nFStart);
|
||||||
|
|
||||||
|
OUString GetPrevFuncExpression( bool bStartFromEnd );
|
||||||
|
|
||||||
void StoreFormEditData(FormEditData* pEditData);
|
void StoreFormEditData(FormEditData* pEditData);
|
||||||
|
|
||||||
void Update();
|
void Update();
|
||||||
@@ -206,6 +208,8 @@ public:
|
|||||||
::std::vector< OUString > m_aArguments;
|
::std::vector< OUString > m_aArguments;
|
||||||
Selection aFuncSel;
|
Selection aFuncSel;
|
||||||
|
|
||||||
|
sal_Int32 mnFuncExpStart; ///< current formula position for treeview results
|
||||||
|
|
||||||
FormulaDlg_Impl(Dialog* pParent
|
FormulaDlg_Impl(Dialog* pParent
|
||||||
, bool _bSupportFunctionResult
|
, bool _bSupportFunctionResult
|
||||||
, bool _bSupportResult
|
, bool _bSupportResult
|
||||||
@@ -242,7 +246,8 @@ FormulaDlg_Impl::FormulaDlg_Impl(Dialog* pParent
|
|||||||
bMakingTree (false),
|
bMakingTree (false),
|
||||||
nEdFocus (0),
|
nEdFocus (0),
|
||||||
pFuncDesc (nullptr),
|
pFuncDesc (nullptr),
|
||||||
nArgs (0)
|
nArgs (0),
|
||||||
|
mnFuncExpStart (0)
|
||||||
{
|
{
|
||||||
pParent->get(m_pParaWinBox, "BOX");
|
pParent->get(m_pParaWinBox, "BOX");
|
||||||
pParent->get(m_pTabCtrl, "tabs");
|
pParent->get(m_pTabCtrl, "tabs");
|
||||||
@@ -695,31 +700,25 @@ void FormulaDlg_Impl::MakeTree(StructPage* _pTree,SvTreeListEntry* pParent,Formu
|
|||||||
|
|
||||||
if (bCalcSubformula)
|
if (bCalcSubformula)
|
||||||
{
|
{
|
||||||
/* FIXME: tdf#96366 this simply does not work, disable until solved. */
|
OUString aFormula;
|
||||||
#if 0
|
|
||||||
OUString aStr;
|
|
||||||
OUString aEquals(" = ");
|
|
||||||
|
|
||||||
if (!bMakingTree)
|
if (!bMakingTree)
|
||||||
{ // gets the last subformula result
|
{
|
||||||
|
// gets the last subformula result
|
||||||
bMakingTree = true;
|
bMakingTree = true;
|
||||||
EditThisFunc(0);
|
aFormula = GetPrevFuncExpression( true);
|
||||||
while ( EditNextFunc(true) ) {}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // gets subsequent subformula results (from the back)
|
|
||||||
const IFunctionDescription* pDesc =pFuncPage->GetFuncDesc( pFuncPage->GetFunction() );
|
|
||||||
if(pDesc==pFuncDesc || !pFuncPage->IsVisible())
|
|
||||||
{
|
{
|
||||||
EditNextFunc(false);
|
// gets subsequent subformula results (from the back)
|
||||||
}
|
aFormula = GetPrevFuncExpression( false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( CalcValue( pFuncDesc->getFormula( m_aArguments ), aStr ) )
|
OUString aStr;
|
||||||
|
if (CalcValue( aFormula, aStr))
|
||||||
m_pWndResult->SetText( aStr );
|
m_pWndResult->SetText( aStr );
|
||||||
aStr = m_pWndResult->GetText();
|
aStr = m_pWndResult->GetText();
|
||||||
pStructPage->GetTlbStruct()->SetEntryText(pEntry,aResult + aEquals + aStr);
|
pStructPage->GetTlbStruct()->SetEntryText( pEntry, aResult + " = " + aStr);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
--Count;
|
--Count;
|
||||||
@@ -1200,6 +1199,28 @@ bool FormulaDlg_Impl::EditNextFunc( bool bForward, sal_Int32 nFStart )
|
|||||||
return bFound;
|
return bFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OUString FormulaDlg_Impl::GetPrevFuncExpression( bool bStartFromEnd )
|
||||||
|
{
|
||||||
|
OUString aExpression;
|
||||||
|
|
||||||
|
OUString aFormula( m_pHelper->getCurrentFormula());
|
||||||
|
if (aFormula.isEmpty())
|
||||||
|
return aExpression;
|
||||||
|
|
||||||
|
if (bStartFromEnd || mnFuncExpStart >= aFormula.getLength())
|
||||||
|
mnFuncExpStart = aFormula.getLength() - 1;
|
||||||
|
|
||||||
|
sal_Int32 nFStart = mnFuncExpStart;
|
||||||
|
sal_Int32 nFEnd = 0;
|
||||||
|
if (m_aFormulaHelper.GetNextFunc( aFormula, true, nFStart, &nFEnd))
|
||||||
|
{
|
||||||
|
aExpression = aFormula.copy( nFStart, nFEnd - nFStart); // nFEnd is exclusive
|
||||||
|
mnFuncExpStart = nFStart;
|
||||||
|
}
|
||||||
|
|
||||||
|
return aExpression;
|
||||||
|
}
|
||||||
|
|
||||||
void FormulaDlg_Impl::SaveArg( sal_uInt16 nEd )
|
void FormulaDlg_Impl::SaveArg( sal_uInt16 nEd )
|
||||||
{
|
{
|
||||||
if (nEd<nArgs)
|
if (nEd<nArgs)
|
||||||
|
Reference in New Issue
Block a user