aboutsummaryrefslogtreecommitdiff
path: root/source/ne/svx
diff options
context:
space:
mode:
Diffstat (limited to 'source/ne/svx')
0 files changed, 0 insertions, 0 deletions
eometry-provider LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
path: root/sc/source/ui
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2009-01-08 10:47:13 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2009-01-08 10:47:13 +0000
commit87307aba9e8dbca16672e6df701d9f905b9e1786 (patch)
treec4c94029c34c3a5dc7e0ed2d6cee8cebc5d31e6b /sc/source/ui
parentb142ca03365a5a5bfd8487fda9bfeea2e6db0d0b (diff)
CWS-TOOLING: integrate CWS frmdlg
2008-12-18 09:13:09 +0100 oj r265667 : merge from odff05 2008-12-18 07:58:16 +0100 oj r265658 : #i94555# patch from <regina>, ODFF: Add GAMMA, CHISQDIST, CHISQINV. Make the 'cumulative' parameter of GAMMADIST optional. Adapt the domain of CHIDIST to allow negative x. Remove the constraint "degrees of freedom < 1.0E5" from CHIDIST and CHIINV. Plus a mechanism to write the now optional parameter of GAMMADIST to PODF and ODFF if omitted, for backwards compatibility. 2008-12-15 14:06:11 +0100 oj r265490 : CWS-TOOLING: rebase CWS frmdlg to trunk@264807 (milestone: DEV300:m37) 2008-12-15 13:55:28 +0100 oj r265488 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:55:07 +0100 oj r265487 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:54:48 +0100 oj r265486 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:54:36 +0100 oj r265485 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:54:24 +0100 oj r265484 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:48:11 +0100 oj r265483 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:31:12 +0100 oj r265479 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:13:58 +0100 oj r265477 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:10:09 +0100 oj r265476 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:05:11 +0100 oj r265475 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 10:47:17 +0100 oj r265467 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 10:46:19 +0100 oj r265466 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 10:45:47 +0100 oj r265465 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 07:35:07 +0100 oj r265458 : add dependency to formula 2008-12-15 07:34:24 +0100 oj r265457 : add dependency to formula 2008-12-12 13:22:00 +0100 msc r265413 : #i97089# 2008-12-12 13:20:25 +0100 msc r265412 : #i97089# 2008-12-12 12:35:12 +0100 msc r265406 : #i97089# 2008-12-12 12:34:16 +0100 msc r265405 : #i97089# 2008-12-12 12:33:05 +0100 msc r265404 : #i97089# 2008-12-12 12:31:11 +0100 msc r265403 : #i97089# 2008-12-08 11:59:10 +0100 oj r264981 : insert RTL_LOG 2008-12-08 11:50:17 +0100 oj r264980 : some small changes 2008-12-05 12:57:57 +0100 oj r264902 : eof changed 2008-12-05 12:56:46 +0100 oj r264901 : eof changed 2008-12-05 12:28:47 +0100 oj r264899 : wrong var used 2008-12-05 10:08:57 +0100 oj r264890 : token order reversed 2008-12-04 13:49:22 +0100 oc r264843 : #i96688: Adapt autotests because of outsourced functionwizard 2008-12-04 13:45:27 +0100 oc r264842 : #i96688: Adapt autotests because of outsourced functionwizard 2008-12-04 13:42:54 +0100 oc r264841 : #i96688: Adapt autotests because of outsourced functionwizard 2008-12-04 13:37:41 +0100 oc r264840 : #i96688: Adapt autotests because of outsourced functionwizard 2008-12-04 13:34:11 +0100 oc r264839 : #i96688: Adapt autotests because of outsourced functionwizard 2008-12-04 12:35:31 +0100 oj r264835 : new help ids for struct and function tabpage 2008-12-04 12:00:35 +0100 oj r264828 : set explicit help id 2008-12-03 14:53:27 +0100 oj r264786 : #i96845# change ref button 2008-12-03 14:51:49 +0100 oj r264785 : #i96845# change ref button 2008-12-03 08:51:57 +0100 oj r264746 : convert dos to unix lineends 2008-12-03 08:50:45 +0100 oj r264745 : convert dos to unix lineends 2008-12-03 08:50:05 +0100 oj r264744 : convert dos to unix lineends 2008-12-02 12:28:33 +0100 oj r264686 : clear help text when new helpid is set 2008-12-02 12:28:02 +0100 oj r264685 : set help id for listbox category 2008-12-02 07:15:56 +0100 oj r264655 : remove define to auto generate help ids 2008-12-01 14:36:43 +0100 oj r264604 : use temp var 2008-12-01 14:18:31 +0100 oj r264601 : moved ScJumpToken to formula 2008-12-01 14:18:11 +0100 oj r264600 : moved ScJumpToken to formula 2008-12-01 14:14:35 +0100 oj r264599 : moved ScJumpToken from sc 2008-12-01 10:48:51 +0100 oj r264589 : change quickhelptext from Shrink to Select 2008-12-01 10:28:41 +0100 oj r264588 : fix opcode data, has to be Any.Void 2008-11-28 11:16:48 +0100 oj r264532 : add help ids 2008-11-28 10:16:56 +0100 oj r264529 : set help id 2008-11-28 10:16:43 +0100 oj r264528 : set help id 2008-11-26 13:55:04 +0100 oj r264381 : #94535# use of optional instead of deleting a string myself and some small changes 2008-11-26 09:53:20 +0100 oj r264346 : compile error with debug/without debug 2008-11-25 07:41:28 +0100 oj r264271 : put static into the method which make use of them 2008-11-24 08:16:07 +0100 oj r264196 : removed not needed classes for op code 2008-11-24 08:13:44 +0100 oj r264195 : removed not needed classes for op code 2008-11-21 14:05:53 +0100 oj r264135 : make GetOpCode inline 2008-11-21 12:35:27 +0100 oj r264124 : hold symbols 2008-11-20 09:27:27 +0100 oj r264028 : merged code from DEV300_m35 which got lost 2008-11-19 20:42:12 +0100 oj r264022 : more changes for formula dialog remove 2008-11-19 20:37:41 +0100 oj r264021 : removed unused var 2008-11-19 20:35:35 +0100 oj r264020 : some more changes at token 2008-11-19 10:59:47 +0100 oj r263967 : deleted 2008-11-19 10:58:24 +0100 oj r263966 : add forui and for res files 2008-11-18 15:27:36 +0100 oj r263777 : unused para removed 2008-11-18 15:23:23 +0100 oj r263775 : add insert button to add field dlg 2008-11-18 13:39:53 +0100 oj r263764 : enable the formula dialog as well for conditional print as for conditional formatting 2008-11-18 12:03:25 +0100 oj r263760 : rename isRef in IsRef 2008-11-17 11:46:16 +0100 oj r263711 : patches for function handling 2008-11-17 11:36:22 +0100 oj r263710 : add new for forui and res file 2008-11-17 09:21:12 +0100 oj r263704 : patches for some resource for libformula 2008-11-15 12:45:30 +0100 oj r263701 : changes for formula editor extraction 2008-11-07 08:23:27 +0100 oj r263416 : merge from DEV300:m35 2008-11-07 08:22:35 +0100 oj r263415 : merge from DEV300:m35 2008-11-07 08:22:16 +0100 oj r263414 : merge from DEV300:m35 2008-11-07 08:21:41 +0100 oj r263413 : merge from DEV300:m35 2008-11-07 08:21:31 +0100 oj r263412 : merge from DEV300:m35 2008-11-07 08:20:38 +0100 oj r263411 : merge from DEV300:m35 2008-11-07 08:20:00 +0100 oj r263410 : merge from DEV300:m35 2008-11-07 08:18:50 +0100 oj r263409 : merge from DEV300:m35 2008-11-07 08:18:19 +0100 oj r263408 : merge from DEV300:m35 2008-11-07 08:10:27 +0100 oj r263407 : merge from DEV300:m35 2008-10-21 07:43:46 +0200 oj r262560 : some compile errors resolved 2008-10-17 16:40:01 +0200 oj r262291 : dep for 1st target 2008-10-07 10:08:39 +0200 oj r262077 : copy 2008-10-07 09:45:31 +0200 oj r262076 : #i94535# 2008-10-07 09:44:26 +0200 oj r262075 : #i94535# new base class 2008-10-07 09:43:21 +0200 oj r262074 : moved to formula 2008-10-07 09:41:51 +0200 oj r262073 : new images 2008-10-07 09:03:01 +0200 oj r262072 : new ids for formula 2008-10-02 08:46:27 +0200 oj r262024 : #i94535# move the formula compiler to formula 2008-10-02 08:08:54 +0200 oj r262023 : #i94535# 2008-10-02 08:06:28 +0200 oj r262022 : #i94535# 2008-10-02 08:05:52 +0200 oj r262021 : #i94535# 2008-10-01 17:15:29 +0200 oj r262014 : #i94535# 2008-10-01 17:12:40 +0200 oj r262013 : new module formula 2008-10-01 17:04:55 +0200 oj r262012 : #i94535# 2008-10-01 16:49:03 +0200 oj r262010 : #i94535# 2008-10-01 16:46:59 +0200 oj r262009 : #i94535#
Diffstat (limited to 'sc/source/ui')
-rw-r--r--sc/source/ui/app/inputhdl.cxx4
-rw-r--r--sc/source/ui/app/inputwin.cxx4
-rw-r--r--sc/source/ui/app/scmod.cxx14
-rw-r--r--sc/source/ui/attrdlg/condfrmt.cxx12
-rw-r--r--sc/source/ui/dbgui/consdlg.cxx20
-rw-r--r--sc/source/ui/dbgui/dbnamdlg.cxx2
-rw-r--r--sc/source/ui/dbgui/foptmgr.cxx4
-rw-r--r--sc/source/ui/dbgui/pvlaydlg.cxx2
-rw-r--r--sc/source/ui/dbgui/sfiltdlg.cxx8
-rw-r--r--sc/source/ui/dbgui/tpsort.cxx2
-rw-r--r--sc/source/ui/dbgui/validate.cxx2
-rw-r--r--sc/source/ui/docshell/docfunc.cxx20
-rw-r--r--sc/source/ui/docshell/docsh3.cxx2
-rw-r--r--sc/source/ui/docshell/docsh4.cxx2
-rw-r--r--sc/source/ui/docshell/externalrefmgr.cxx4
-rw-r--r--sc/source/ui/docshell/impex.cxx9
-rw-r--r--sc/source/ui/docshell/tablink.cxx2
-rw-r--r--sc/source/ui/formdlg/dwfunctr.cxx2370
-rw-r--r--sc/source/ui/formdlg/formdata.cxx39
-rw-r--r--sc/source/ui/formdlg/formdlgs.hrc87
-rw-r--r--sc/source/ui/formdlg/formdlgs.src386
-rw-r--r--sc/source/ui/formdlg/formula.cxx1927
-rw-r--r--sc/source/ui/formdlg/funcpage.cxx253
-rw-r--r--sc/source/ui/formdlg/funcutl.cxx859
-rw-r--r--sc/source/ui/formdlg/makefile.mk21
-rw-r--r--sc/source/ui/formdlg/parawin.cxx615
-rw-r--r--sc/source/ui/formdlg/parawin.hrc56
-rw-r--r--sc/source/ui/formdlg/parawin.src179
-rw-r--r--sc/source/ui/formdlg/structpg.cxx236
-rw-r--r--sc/source/ui/inc/IAnyRefDialog.hxx67
-rw-r--r--sc/source/ui/inc/anyrefdg.hxx139
-rw-r--r--sc/source/ui/inc/areasdlg.hxx16
-rw-r--r--sc/source/ui/inc/condfrmt.hxx26
-rw-r--r--sc/source/ui/inc/consdlg.hxx14
-rw-r--r--sc/source/ui/inc/crnrdlg.hxx10
-rw-r--r--sc/source/ui/inc/dbnamdlg.hxx4
-rw-r--r--sc/source/ui/inc/docfunc.hxx10
-rw-r--r--sc/source/ui/inc/dwfunctr.hxx1
-rw-r--r--sc/source/ui/inc/filtdlg.hxx14
-rw-r--r--sc/source/ui/inc/foptmgr.hxx9
-rw-r--r--sc/source/ui/inc/formdata.hxx45
-rw-r--r--sc/source/ui/inc/formula.hxx207
-rw-r--r--sc/source/ui/inc/funcutl.hxx12
-rw-r--r--sc/source/ui/inc/highred.hxx4
-rw-r--r--sc/source/ui/inc/namedlg.hxx4
-rw-r--r--sc/source/ui/inc/optsolver.hxx38
-rw-r--r--sc/source/ui/inc/parawin.hxx12
-rw-r--r--sc/source/ui/inc/pvlaydlg.hxx4
-rw-r--r--sc/source/ui/inc/simpref.hxx4
-rw-r--r--sc/source/ui/inc/solvrdlg.hxx10
-rw-r--r--sc/source/ui/inc/structpg.hxx146
-rw-r--r--sc/source/ui/inc/tabopdlg.hxx14
-rw-r--r--sc/source/ui/inc/undoblk.hxx2
-rw-r--r--sc/source/ui/inc/undotab.hxx8
-rw-r--r--sc/source/ui/miscdlgs/anyrefdg.cxx1215
-rw-r--r--sc/source/ui/miscdlgs/crnrdlg.cxx2350
-rw-r--r--sc/source/ui/miscdlgs/highred.cxx2
-rw-r--r--sc/source/ui/miscdlgs/optsolver.cxx2138
-rw-r--r--sc/source/ui/miscdlgs/simpref.cxx2
-rw-r--r--sc/source/ui/miscdlgs/solvrdlg.cxx632
-rw-r--r--sc/source/ui/miscdlgs/tabopdlg.cxx748
-rw-r--r--sc/source/ui/namedlg/namedlg.cxx1302
-rw-r--r--sc/source/ui/pagedlg/areasdlg.cxx1818
-rw-r--r--sc/source/ui/src/sc.src35
-rw-r--r--sc/source/ui/src/scfuncs.src2
-rw-r--r--sc/source/ui/undo/undotab.cxx4
-rw-r--r--sc/source/ui/unoobj/appluno.cxx7
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx50
-rw-r--r--sc/source/ui/unoobj/fmtuno.cxx32
-rw-r--r--sc/source/ui/unoobj/funcuno.cxx18
-rw-r--r--sc/source/ui/unoobj/nameuno.cxx20
-rw-r--r--sc/source/ui/unoobj/servuno.cxx8
-rw-r--r--sc/source/ui/unoobj/tokenuno.cxx314
-rw-r--r--sc/source/ui/vba/vbaapplication.cxx1918
-rw-r--r--sc/source/ui/vba/vbarange.cxx56
-rw-r--r--sc/source/ui/vba/vbarange.hxx550
-rw-r--r--sc/source/ui/view/colrowba.cxx2
-rw-r--r--sc/source/ui/view/gridwin.cxx7
-rw-r--r--sc/source/ui/view/tabview3.cxx2
-rw-r--r--sc/source/ui/view/tabvwsh3.cxx6
-rw-r--r--sc/source/ui/view/tabvwsh4.cxx2
-rw-r--r--sc/source/ui/view/tabvwsha.cxx3
-rw-r--r--sc/source/ui/view/tabvwshc.cxx3
-rw-r--r--sc/source/ui/view/viewfun2.cxx2
-rw-r--r--sc/source/ui/view/viewfun5.cxx7
-rw-r--r--sc/source/ui/view/viewfunc.cxx13
86 files changed, 8358 insertions, 12871 deletions
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 6381c9150b44..8d1cd4179516 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -162,7 +162,7 @@ handle_r1c1:
if( nPos < nLen && nPos > 0 &&
'-' == pChar[nPos] && '[' == pChar[nPos-1] &&
NULL != pDoc &&
- ScAddress::CONV_XL_R1C1 == pDoc->GetAddressConvention() )
+ formula::FormulaGrammar::CONV_XL_R1C1 == pDoc->GetAddressConvention() )
{
nPos++;
goto handle_r1c1;
@@ -3384,7 +3384,7 @@ void ScInputHandler::NotifyChange( const ScInputHdlState* pState,
if ( !aPosStr.Len() ) // kein Name -> formatieren
{
USHORT nFlags = 0;
- if( aAddrDetails.eConv == ScAddress::CONV_XL_R1C1 )
+ if( aAddrDetails.eConv == formula::FormulaGrammar::CONV_XL_R1C1 )
nFlags |= SCA_COL_ABSOLUTE | SCA_ROW_ABSOLUTE;
if ( rSPos != rEPos )
{
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index e1ec599e8fbe..8fd3c1f8ac0b 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -70,7 +70,7 @@
#include "docsh.hxx"
#include "appoptio.hxx"
#include "rangenam.hxx"
-#include "compiler.hrc"
+#include <formula/compiler.hrc>
#include "dbcolect.hxx"
#include "rangeutl.hxx"
#include "docfunc.hxx"
@@ -1539,7 +1539,7 @@ ScNameInputType lcl_GetInputType( const String& rText )
ScViewData* pViewData = pViewSh->GetViewData();
ScDocument* pDoc = pViewData->GetDocument();
SCTAB nTab = pViewData->GetTabNo();
- ScAddress::Convention eConv = pDoc->GetAddressConvention();
+ formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
// test in same order as in SID_CURRENTCELL execute
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 60f2ae2729ad..98885067c5b0 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -52,6 +52,8 @@
#include <sfx2/objface.hxx>
#include <svx/hyprlink.hxx>
+#include "IAnyRefDialog.hxx"
+
#include <svtools/ehdl.hxx>
#include <svtools/accessibilityoptions.hxx>
#include <svtools/ctloptions.hxx>
@@ -1687,7 +1689,7 @@ BOOL ScModule::IsModalMode(SfxObjectShell* pDocSh)
SfxChildWindow* pChildWnd = lcl_GetChildWinFromAnyView( nCurRefDlgId );
if ( pChildWnd )
{
- ScAnyRefDlg* pRefDlg = (ScAnyRefDlg*)pChildWnd->GetWindow();
+ IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow());
bIsModal = pChildWnd->IsVisible() &&
!( pRefDlg->IsRefInputMode() && pRefDlg->IsDocAllowed(pDocSh) );
}
@@ -1725,7 +1727,7 @@ BOOL ScModule::IsTableLocked()
{
SfxChildWindow* pChildWnd = lcl_GetChildWinFromAnyView( nCurRefDlgId );
if ( pChildWnd )
- bLocked = ((ScAnyRefDlg*)pChildWnd->GetWindow())->IsTableLocked();
+ bLocked = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow())->IsTableLocked();
else
bLocked = TRUE; // for other views, see IsModalMode
}
@@ -1764,7 +1766,7 @@ BOOL ScModule::IsFormulaMode()
SfxChildWindow* pChildWnd = lcl_GetChildWinFromAnyView( nCurRefDlgId );
if ( pChildWnd )
{
- ScAnyRefDlg* pRefDlg = (ScAnyRefDlg*)pChildWnd->GetWindow();
+ IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow());
bIsFormula = pChildWnd->IsVisible() && pRefDlg->IsRefInputMode();
}
}
@@ -1824,7 +1826,7 @@ void ScModule::SetReference( const ScRange& rRef, ScDocument* pDoc,
aNew.aEnd.SetTab(nEndTab);
}
- ScAnyRefDlg* pRefDlg = (ScAnyRefDlg*)pChildWnd->GetWindow();
+ IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow());
// hide the (color) selection now instead of later from LoseFocus,
// don't abort the ref input that causes this call (bDoneRefMode = FALSE)
@@ -1855,7 +1857,7 @@ void ScModule::AddRefEntry() // "Mehrfachselektion"
DBG_ASSERT( pChildWnd, "NoChildWin" );
if ( pChildWnd )
{
- ScAnyRefDlg* pRefDlg = (ScAnyRefDlg*)pChildWnd->GetWindow();
+ IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow());
pRefDlg->AddRefEntry();
}
}
@@ -1882,7 +1884,7 @@ void ScModule::EndReference()
DBG_ASSERT( pChildWnd, "NoChildWin" );
if ( pChildWnd )
{
- ScAnyRefDlg* pRefDlg = (ScAnyRefDlg*)pChildWnd->GetWindow();
+ IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow());
pRefDlg->SetActive();
}
}
diff --git a/sc/source/ui/attrdlg/condfrmt.cxx b/sc/source/ui/attrdlg/condfrmt.cxx
index b9ffd5a55242..e97b13405af0 100644
--- a/sc/source/ui/attrdlg/condfrmt.cxx
+++ b/sc/source/ui/attrdlg/condfrmt.cxx
@@ -66,10 +66,10 @@ ScConditionalFormatDlg::ScConditionalFormatDlg(
aLbCond11 ( this, ScResId( LB_COND1_1 ) ),
aLbCond12 ( this, ScResId( LB_COND1_2 ) ),
aEdtCond11 ( this, ScResId( EDT_COND1_1 ) ),
- aRbCond11 ( this, ScResId( RB_COND1_1 ), &aEdtCond11 ),
+ aRbCond11 ( this, ScResId( RB_COND1_1 ), &aEdtCond11,this ),
aFtCond1And ( this, ScResId( FT_COND1_AND ) ),
aEdtCond12 ( this, ScResId( EDT_COND1_2 ) ),
- aRbCond12 ( this, ScResId( RB_COND1_2 ), &aEdtCond12 ),
+ aRbCond12 ( this, ScResId( RB_COND1_2 ), &aEdtCond12,this ),
aFtCond1Template ( this, ScResId( FT_COND1_TEMPLATE ) ),
aLbCond1Template ( this, ScResId( LB_COND1_TEMPLATE ) ),
aFlSep1 ( this, ScResId( FL_SEP1 ) ),
@@ -78,10 +78,10 @@ ScConditionalFormatDlg::ScConditionalFormatDlg(
aLbCond21 ( this, ScResId( LB_COND2_1 ) ),
aLbCond22 ( this, ScResId( LB_COND2_2 ) ),
aEdtCond21 ( this, ScResId( EDT_COND2_1 ) ),
- aRbCond21 ( this, ScResId( RB_COND2_1 ), &aEdtCond21 ),
+ aRbCond21 ( this, ScResId( RB_COND2_1 ), &aEdtCond21,this ),
aFtCond2And ( this, ScResId( FT_COND2_AND ) ),
aEdtCond22 ( this, ScResId( EDT_COND2_2 ) ),
- aRbCond22 ( this, ScResId( RB_COND2_2 ), &aEdtCond22 ),
+ aRbCond22 ( this, ScResId( RB_COND2_2 ), &aEdtCond22,this ),
aFtCond2Template ( this, ScResId( FT_COND2_TEMPLATE ) ),
aLbCond2Template ( this, ScResId( LB_COND2_TEMPLATE ) ),
aFlSep2 ( this, ScResId( FL_SEP2 ) ),
@@ -90,10 +90,10 @@ ScConditionalFormatDlg::ScConditionalFormatDlg(
aLbCond31 ( this, ScResId( LB_COND3_1 ) ),
aLbCond32 ( this, ScResId( LB_COND3_2 ) ),
aEdtCond31 ( this, ScResId( EDT_COND3_1 ) ),
- aRbCond31 ( this, ScResId( RB_COND3_1 ), &aEdtCond31 ),
+ aRbCond31 ( this, ScResId( RB_COND3_1 ), &aEdtCond31,this ),
aFtCond3And ( this, ScResId( FT_COND3_AND ) ),
aEdtCond32 ( this, ScResId( EDT_COND3_2 ) ),
- aRbCond32 ( this, ScResId( RB_COND3_2 ), &aEdtCond32 ),
+ aRbCond32 ( this, ScResId( RB_COND3_2 ), &aEdtCond32,this ),
aFtCond3Template ( this, ScResId( FT_COND3_TEMPLATE ) ),
aLbCond3Template ( this, ScResId( LB_COND3_TEMPLATE ) ),
diff --git a/sc/source/ui/dbgui/consdlg.cxx b/sc/source/ui/dbgui/consdlg.cxx
index 5d8d6baad874..d0a0ff55a307 100644
--- a/sc/source/ui/dbgui/consdlg.cxx
+++ b/sc/source/ui/dbgui/consdlg.cxx
@@ -98,12 +98,12 @@ ScConsolidateDlg::ScConsolidateDlg( SfxBindings* pB, SfxChildWindow* pCW, Window
aLbDataArea ( this, ScResId( LB_DATA_AREA ) ),
aFtDataArea ( this, ScResId( FT_DATA_AREA ) ),
aEdDataArea ( this, ScResId( ED_DATA_AREA ) ),
- aRbDataArea ( this, ScResId( RB_DATA_AREA ), &aEdDataArea ),
+ aRbDataArea ( this, ScResId( RB_DATA_AREA ), &aEdDataArea, this ),
aLbDestArea ( this, ScResId( LB_DEST_AREA ) ),
aFtDestArea ( this, ScResId( FT_DEST_AREA ) ),
aEdDestArea ( this, ScResId( ED_DEST_AREA ) ),
- aRbDestArea ( this, ScResId( RB_DEST_AREA ), &aEdDestArea ),
+ aRbDestArea ( this, ScResId( RB_DEST_AREA ), &aEdDestArea, this),
aFlConsBy ( this, ScResId( FL_CONSBY ) ),
aBtnByRow ( this, ScResId( BTN_BYROW ) ),
@@ -192,7 +192,7 @@ void ScConsolidateDlg::Init()
// Einlesen der Konsolidierungsbereiche
aLbConsAreas.Clear();
- const ScAddress::Convention eConv = pDoc->GetAddressConvention();
+ const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
for ( i=0; i<theConsData.nDataAreaCount; i++ )
{
const ScArea& rArea = *(theConsData.ppDataAreas[i] );
@@ -298,7 +298,7 @@ void ScConsolidateDlg::SetReference( const ScRange& rRef, ScDocument* pDocP )
String aStr;
USHORT nFmt = SCR_ABS_3D; //!!! nCurTab fehlt noch
- const ScAddress::Convention eConv = pDocP->GetAddressConvention();
+ const formula::FormulaGrammar::AddressConvention eConv = pDocP->GetAddressConvention();
if ( rRef.aStart.Tab() != rRef.aEnd.Tab() )
nFmt |= SCA_TAB2_3D;
@@ -354,7 +354,7 @@ void __EXPORT ScConsolidateDlg::Deactivate()
//----------------------------------------------------------------------------
-BOOL ScConsolidateDlg::VerifyEdit( ScRefEdit* pEd )
+BOOL ScConsolidateDlg::VerifyEdit( formula::RefEdit* pEd )
{
if ( !pRangeUtil || !pDoc || !pViewData ||
((pEd != &aEdDataArea) && (pEd != &aEdDestArea)) )
@@ -363,7 +363,7 @@ BOOL ScConsolidateDlg::VerifyEdit( ScRefEdit* pEd )
SCTAB nTab = pViewData->GetTabNo();
BOOL bEditOk = FALSE;
String theCompleteStr;
- const ScAddress::Convention eConv = pDoc->GetAddressConvention();
+ const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
if ( pEd == &aEdDataArea )
{
@@ -395,7 +395,7 @@ IMPL_LINK( ScConsolidateDlg, GetFocusHdl, Control*, pCtr )
if ( pCtr ==(Control*)&aEdDataArea ||
pCtr ==(Control*)&aEdDestArea)
{
- pRefInputEdit = (ScRefEdit*)pCtr;
+ pRefInputEdit = (formula::RefEdit*)pCtr;
}
else if(pCtr ==(Control*)&aLbDataArea )
{
@@ -420,7 +420,7 @@ IMPL_LINK( ScConsolidateDlg, OkHdl, void*, EMPTYARG )
ScRefAddress aDestAddress;
SCTAB nTab = pViewData->GetTabNo();
String aDestPosStr( aEdDestArea.GetText() );
- const ScAddress::Convention eConv = pDoc->GetAddressConvention();
+ const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
if ( pRangeUtil->IsAbsPos( aDestPosStr, pDoc, nTab, NULL, &aDestAddress, eConv ) )
{
@@ -484,7 +484,7 @@ IMPL_LINK( ScConsolidateDlg, ClickHdl, PushButton*, pBtn )
String aNewEntry( aEdDataArea.GetText() );
ScArea** ppAreas = NULL;
USHORT nAreaCount = 0;
- const ScAddress::Convention eConv = pDoc->GetAddressConvention();
+ const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
if ( pRangeUtil->IsAbsTabArea( aNewEntry, pDoc, &ppAreas, &nAreaCount, TRUE, eConv ) )
{
@@ -586,7 +586,7 @@ IMPL_LINK( ScConsolidateDlg, SelectHdl, ListBox*, pLb )
//----------------------------------------------------------------------------
-IMPL_LINK( ScConsolidateDlg, ModifyHdl, ScRefEdit*, pEd )
+IMPL_LINK( ScConsolidateDlg, ModifyHdl, formula::RefEdit*, pEd )
{
if ( pEd == &aEdDataArea )
{
diff --git a/sc/source/ui/dbgui/dbnamdlg.cxx b/sc/source/ui/dbgui/dbnamdlg.cxx
index d5a8c8aaade6..66f270213ce4 100644
--- a/sc/source/ui/dbgui/dbnamdlg.cxx
+++ b/sc/source/ui/dbgui/dbnamdlg.cxx
@@ -148,7 +148,7 @@ ScDbNameDlg::ScDbNameDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent,
aFlAssign ( this, ScResId( FL_ASSIGN ) ),
aEdAssign ( this, ScResId( ED_DBAREA ) ),
- aRbAssign ( this, ScResId( RB_DBAREA ), &aEdAssign ),
+ aRbAssign ( this, ScResId( RB_DBAREA ), &aEdAssign, this ),
aFlOptions ( this, ScResId( FL_OPTIONS ) ),
aBtnHeader ( this, ScResId( BTN_HEADER ) ),
diff --git a/sc/source/ui/dbgui/foptmgr.cxx b/sc/source/ui/dbgui/foptmgr.cxx
index 44c4f14de22d..603a9a3a5eea 100644
--- a/sc/source/ui/dbgui/foptmgr.cxx
+++ b/sc/source/ui/dbgui/foptmgr.cxx
@@ -65,7 +65,7 @@ ScFilterOptionsMgr::ScFilterOptionsMgr(
CheckBox& refBtnDestPers,
ListBox& refLbCopyArea,
Edit& refEdCopyArea,
- ScRefButton& refRbCopyArea,
+ formula::RefButton& refRbCopyArea,
FixedText& refFtDbAreaLabel,
FixedInfo& refFtDbArea,
FixedLine& refFlOptions,
@@ -148,7 +148,7 @@ void ScFilterOptionsMgr::Init()
ScDBCollection* pDBColl = pDoc->GetDBCollection();
String theDbArea;
String theDbName = rStrNoName;
- const ScAddress::Convention eConv = pDoc->GetAddressConvention();
+ const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
theCurArea.Format( theAreaStr, SCR_ABS_3D, pDoc, eConv );
diff --git a/sc/source/ui/dbgui/pvlaydlg.cxx b/sc/source/ui/dbgui/pvlaydlg.cxx
index 5a0321935fe0..fba9846e331f 100644
--- a/sc/source/ui/dbgui/pvlaydlg.cxx
+++ b/sc/source/ui/dbgui/pvlaydlg.cxx
@@ -123,7 +123,7 @@ ScDPLayoutDlg::ScDPLayoutDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pPar
aLbOutPos ( this, ScResId( LB_OUTAREA ) ),
aFtOutArea ( this, ScResId( FT_OUTAREA ) ),
aEdOutPos ( this, ScResId( ED_OUTAREA ) ),
- aRbOutPos ( this, ScResId( RB_OUTAREA ), &aEdOutPos ),
+ aRbOutPos ( this, ScResId( RB_OUTAREA ), &aEdOutPos, this ),
aBtnIgnEmptyRows( this, ScResId( BTN_IGNEMPTYROWS ) ),
aBtnDetectCat ( this, ScResId( BTN_DETECTCAT ) ),
aBtnTotalCol ( this, ScResId( BTN_TOTALCOL ) ),
diff --git a/sc/source/ui/dbgui/sfiltdlg.cxx b/sc/source/ui/dbgui/sfiltdlg.cxx
index cba8a0b28c85..dbff3c6dabab 100644
--- a/sc/source/ui/dbgui/sfiltdlg.cxx
+++ b/sc/source/ui/dbgui/sfiltdlg.cxx
@@ -76,7 +76,7 @@ ScSpecialFilterDlg::ScSpecialFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, Wi
aLbFilterArea ( this, ScResId( LB_CRITERIA_AREA ) ),
aFtFilterArea ( this, ScResId( FT_CRITERIA_AREA ) ),
aEdFilterArea ( this, ScResId( ED_CRITERIA_AREA ) ),
- aRbFilterArea ( this, ScResId( RB_CRITERIA_AREA ), &aEdFilterArea ),
+ aRbFilterArea ( this, ScResId( RB_CRITERIA_AREA ), &aEdFilterArea, this ),
//
_INIT_COMMON_FILTER_RSCOBJS
//
@@ -249,7 +249,7 @@ void ScSpecialFilterDlg::SetReference( const ScRange& rRef, ScDocument* pDocP )
RefInputStart( pRefInputEdit );
String aRefStr;
- const ScAddress::Convention eConv = pDocP->GetAddressConvention();
+ const formula::FormulaGrammar::AddressConvention eConv = pDocP->GetAddressConvention();
if ( pRefInputEdit == &aEdCopyArea)
rRef.aStart.Format( aRefStr, SCA_ABS_3D, pDocP, eConv );
@@ -324,7 +324,7 @@ IMPL_LINK( ScSpecialFilterDlg, EndDlgHdl, Button*, pBtn )
BOOL bEditInputOk = TRUE;
BOOL bQueryOk = FALSE;
ScRange theFilterArea;
- const ScAddress::Convention eConv = pDoc->GetAddressConvention();
+ const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
if ( aBtnCopyResult.IsChecked() )
{
@@ -490,7 +490,7 @@ IMPL_LINK( ScSpecialFilterDlg, FilterAreaSelHdl, ListBox*, pLb )
//----------------------------------------------------------------------------
-IMPL_LINK( ScSpecialFilterDlg, FilterAreaModHdl, ScRefEdit*, pEd )
+IMPL_LINK( ScSpecialFilterDlg, FilterAreaModHdl, formula::RefEdit*, pEd )
{
if ( pEd == &aEdFilterArea )
{
diff --git a/sc/source/ui/dbgui/tpsort.cxx b/sc/source/ui/dbgui/tpsort.cxx
index 080e2a2ccb05..a5b42fc9f364 100644
--- a/sc/source/ui/dbgui/tpsort.cxx
+++ b/sc/source/ui/dbgui/tpsort.cxx
@@ -636,7 +636,7 @@ void ScTabPageSortOptions::Init()
String theDbArea;
String theDbName = aStrNoName;
const SCTAB nCurTab = pViewData->GetTabNo();
- const ScAddress::Convention eConv = pDoc->GetAddressConvention();
+ const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
aLbOutPos.Clear();
aLbOutPos.InsertEntry( aStrUndefined, 0 );
diff --git a/sc/source/ui/dbgui/validate.cxx b/sc/source/ui/dbgui/validate.cxx
index d547bae25de9..8700c936e0f5 100644
--- a/sc/source/ui/dbgui/validate.cxx
+++ b/sc/source/ui/dbgui/validate.cxx
@@ -52,7 +52,7 @@
#include "validate.hrc"
#include "validate.hxx"
#include "compiler.hxx"
-#include "opcode.hxx" //CHINA001
+#include "formula/opcode.hxx" //CHINA001
// ============================================================================
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 4208014ee491..6e9010d7856b 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -957,7 +957,7 @@ ScTokenArray* lcl_ScDocFunc_CreateTokenArrayXML( const String& rText )
ScBaseCell* ScDocFunc::InterpretEnglishString( const ScAddress& rPos,
- const String& rText, const ScGrammar::Grammar eGrammar )
+ const String& rText, const formula::FormulaGrammar::Grammar eGrammar )
{
ScDocument* pDoc = rDocShell.GetDocument();
ScBaseCell* pNewCell = NULL;
@@ -972,7 +972,8 @@ ScBaseCell* ScDocFunc::InterpretEnglishString( const ScAddress& rPos,
}
else
{
- ScCompiler aComp( pDoc, rPos, eGrammar );
+ ScCompiler aComp( pDoc, rPos );
+ aComp.SetGrammar(eGrammar);
pCode = aComp.CompileString( rText );
}
pNewCell = new ScFormulaCell( pDoc, rPos, pCode, eGrammar, MM_NONE );
@@ -1004,7 +1005,7 @@ ScBaseCell* ScDocFunc::InterpretEnglishString( const ScAddress& rPos,
BOOL ScDocFunc::SetCellText( const ScAddress& rPos, const String& rText,
BOOL bInterpret, BOOL bEnglish, BOOL bApi,
- const ScGrammar::Grammar eGrammar )
+ const formula::FormulaGrammar::Grammar eGrammar )
{
// SetCellText ruft PutCell oder SetNormalString
@@ -2411,7 +2412,7 @@ BOOL ScDocFunc::SetLayoutRTL( SCTAB nTab, BOOL bRTL, BOOL /* bApi */ )
return TRUE;
}
-BOOL ScDocFunc::SetGrammar( ScGrammar::Grammar eGrammar )
+BOOL ScDocFunc::SetGrammar( formula::FormulaGrammar::Grammar eGrammar )
{
ScDocument* pDoc = rDocShell.GetDocument();
@@ -3115,7 +3116,7 @@ BOOL ScDocFunc::AutoFormat( const ScRange& rRange, const ScMarkData* pTabMark,
BOOL ScDocFunc::EnterMatrix( const ScRange& rRange, const ScMarkData* pTabMark,
const ScTokenArray* pTokenArray,
const String& rString, BOOL bApi, BOOL bEnglish,
- const ScGrammar::Grammar eGrammar )
+ const formula::FormulaGrammar::Grammar eGrammar )
{
ScDocShellModificator aModificator( rDocShell );
@@ -3170,7 +3171,8 @@ BOOL ScDocFunc::EnterMatrix( const ScRange& rRange, const ScMarkData* pTabMark,
}
else if (bEnglish)
{
- ScCompiler aComp( pDoc, rRange.aStart, eGrammar);
+ ScCompiler aComp( pDoc, rRange.aStart);
+ aComp.SetGrammar(eGrammar);
ScTokenArray* pCode = aComp.CompileString( rString );
pDoc->InsertMatrixFormula( nStartCol, nStartRow, nEndCol, nEndRow,
aMark, EMPTY_STRING, pCode, eGrammar);
@@ -4039,7 +4041,7 @@ BOOL ScDocFunc::InsertNameList( const ScAddress& rStartPos, BOOL bApi )
ICCQsortNameCompare );
#endif
String aName;
- String aContent;
+ rtl::OUStringBuffer aContent;
String aFormula;
SCROW nOutRow = nStartRow;
for (j=0; j<nValidCount; j++)
@@ -4114,11 +4116,11 @@ BOOL ScDocFunc::ResizeMatrix( const ScRange& rOldRange, const ScAddress& rNewEnd
if ( DeleteContents( aMark, IDF_CONTENTS, TRUE, bApi ) )
{
// GRAM_PODF_A1 for API compatibility.
- bRet = EnterMatrix( aNewRange, &aMark, NULL, aFormula, bApi, FALSE, ScGrammar::GRAM_PODF_A1 );
+ bRet = EnterMatrix( aNewRange, &aMark, NULL, aFormula, bApi, FALSE,formula::FormulaGrammar::GRAM_PODF_A1 );
if (!bRet)
{
// versuchen, alten Zustand wiederherzustellen
- EnterMatrix( rOldRange, &aMark, NULL, aFormula, bApi, FALSE, ScGrammar::GRAM_PODF_A1 );
+ EnterMatrix( rOldRange, &aMark, NULL, aFormula, bApi, FALSE,formula::FormulaGrammar::GRAM_PODF_A1 );
}
}
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index 2a627bc2d047..786e99921b63 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -1042,7 +1042,7 @@ void ScDocShell::MergeDocument( ScDocument& rOtherDoc, bool bShared, bool bCheck
aValue.Erase( aValue.Len()-1, 1 );
GetDocFunc().EnterMatrix( aSourceRange,
NULL, NULL, aValue, FALSE, FALSE,
- ScGrammar::GRAM_DEFAULT );
+ formula::FormulaGrammar::GRAM_DEFAULT );
}
break;
case MM_REFERENCE : // do nothing
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index a7709367a659..3da74feae40e 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -2474,7 +2474,7 @@ long __EXPORT ScDocShell::DdeSetData( const String& rItem,
}
}
ScRange aRange;
- ScAddress::Convention eConv = aDocument.GetAddressConvention();
+ formula::FormulaGrammar::AddressConvention eConv = aDocument.GetAddressConvention();
BOOL bValid = ( ( aRange.Parse( aPos, &aDocument, eConv ) & SCA_VALID ) ||
( aRange.aStart.Parse( aPos, &aDocument, eConv ) & SCA_VALID ) );
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index 5b580796458c..ca8204203f18 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -1416,7 +1416,7 @@ ScExternalRefCache::TokenArrayRef ScExternalRefManager::getRangeNameTokens(sal_u
{
case svSingleRef:
{
- const SingleRefData& rRef = pToken->GetSingleRef();
+ const ScSingleRefData& rRef = pToken->GetSingleRef();
String aTabName;
pSrcDoc->GetName(rRef.nTab, aTabName);
ScExternalSingleRefToken aNewToken(nFileId, aTabName, pToken->GetSingleRef());
@@ -1426,7 +1426,7 @@ ScExternalRefCache::TokenArrayRef ScExternalRefManager::getRangeNameTokens(sal_u
break;
case svDoubleRef:
{
- const SingleRefData& rRef = pToken->GetSingleRef();
+ const ScSingleRefData& rRef = pToken->GetSingleRef();
String aTabName;
pSrcDoc->GetName(rRef.nTab, aTabName);
ScExternalDoubleRefToken aNewToken(nFileId, aTabName, pToken->GetDoubleRef());
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index c463533a1924..10f39e7d8676 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -172,7 +172,7 @@ ScImportExport::ScImportExport( ScDocument* p, const String& rPos )
pData->GetSymbol( aPos ); // mit dem Inhalt weitertesten
}
}
- ScAddress::Convention eConv = pDoc->GetAddressConvention();
+ formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
// Bereich?
if( aRange.Parse( aPos, pDoc, eConv ) & SCA_VALID )
bSingle = FALSE;
@@ -1479,8 +1479,9 @@ BOOL ScImportExport::Sylk2Doc( SvStream& rStrm )
/* FIXME: do we want GRAM_ODFF_A1 instead? At the
* end it probably should be GRAM_ODFF_R1C1, since
* R1C1 is what Excel writes in SYLK. */
- const ScGrammar::Grammar eGrammar = ScGrammar::GRAM_PODF_A1;
- ScCompiler aComp( pDoc, aPos, eGrammar );
+ const formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_PODF_A1;
+ ScCompiler aComp( pDoc, aPos);
+ aComp.SetGrammar(eGrammar);
ScTokenArray* pCode = aComp.CompileString( aText );
if ( ch == 'M' )
{
@@ -1680,7 +1681,7 @@ BOOL ScImportExport::Doc2Sylk( SvStream& rStrm )
aCellStr.Erase();
break;
default:
- pFCell->GetFormula( aCellStr, ScGrammar::GRAM_PODF_A1);
+ pFCell->GetFormula( aCellStr,formula::FormulaGrammar::GRAM_PODF_A1);
/* FIXME: do we want GRAM_ODFF_A1 instead? At
* the end it probably should be
* GRAM_ODFF_R1C1, since R1C1 is what Excel
diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx
index 9a06e945dbd6..9f7c201c8aca 100644
--- a/sc/source/ui/docshell/tablink.cxx
+++ b/sc/source/ui/docshell/tablink.cxx
@@ -64,7 +64,7 @@
#include "hints.hxx"
#include "cell.hxx"
#include "dociter.hxx"
-#include "opcode.hxx"
+#include "formula/opcode.hxx"
struct TableLink_Impl
{
diff --git a/sc/source/ui/formdlg/dwfunctr.cxx b/sc/source/ui/formdlg/dwfunctr.cxx
index 9a713fe09d52..787932f59c53 100644
--- a/sc/source/ui/formdlg/dwfunctr.cxx
+++ b/sc/source/ui/formdlg/dwfunctr.cxx
@@ -1,1185 +1,1185 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: dwfunctr.cxx,v $
- * $Revision: 1.15 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sc.hxx"
-
-
-
-// INCLUDE ---------------------------------------------------------------
-
-#include <svx/editview.hxx>
-#include <sfx2/bindings.hxx>
-#include <sfx2/dispatch.hxx>
-#include <sfx2/objsh.hxx>
-#include <sfx2/viewsh.hxx>
-
-#include "sc.hrc"
-#include "global.hxx" // ScAddress
-#include "scresid.hxx"
-#include "reffact.hxx"
-#include "document.hxx"
-#include "cell.hxx"
-#include "scmod.hxx"
-#include "inputhdl.hxx"
-#include "tabvwsh.hxx"
-#include "appoptio.hxx"
-#include "compiler.hxx"
-
-#include "dwfunctr.hrc"
-#include "dwfunctr.hxx"
-
-// -----------------------------------------------------------------------
-
-#define ARG_SEPERATOR String("; ")
-SFX_IMPL_DOCKINGWINDOW( ScFunctionChildWindow, FID_FUNCTION_BOX )
-
-/*************************************************************************
-#* Member: ScFunctionChildWindow Datum:06.10.97
-#*------------------------------------------------------------------------
-#*
-#* Klasse: ScFunctionChildWindow
-#*
-#* Funktion: Konstruktor der Klasse ScFunctionChildWindow
-#* Ableitung vom SfxChildWindow als "Behaelter" fuer
-#* Funktions- Fenster in Clac
-#*
-#* Input: ---
-#*
-#* Output: ---
-#*
-#************************************************************************/
-
-__EXPORT ScFunctionChildWindow::ScFunctionChildWindow( Window* pParentP,
- USHORT nId,
- SfxBindings* pBindings,
- SfxChildWinInfo* pInfo ) :
- SfxChildWindow( pParentP, nId )
-{
- ScFunctionDockWin* pWin = new ScFunctionDockWin( pBindings, this,
- pParentP, ScResId( FID_FUNCTION_BOX ) );
- pWindow = pWin;
-
- eChildAlignment = SFX_ALIGN_RIGHT;
-
- pWin->Initialize( pInfo );
-}
-
-/*************************************************************************
-#* Member: ScFunctionDockWin Datum:06.10.97
-#*------------------------------------------------------------------------
-#*
-#* Klasse: ScFunctionDockWin
-#*
-#* Funktion: Konstruktor der Klasse ScFunctionDockWin
-#*
-#* Input: Sfx- Verknuepfungen, Fenster, Resource
-#*
-#* Output: ---
-#*
-#************************************************************************/
-
-ScFunctionDockWin::ScFunctionDockWin( SfxBindings* pBindingsP,
- SfxChildWindow *pCW, Window* pParent, const ResId& rResId ) :
-
- SfxDockingWindow( pBindingsP, pCW, pParent, rResId ),
- aPrivatSplit ( this, ResId( FT_SPLIT, *rResId.GetResMgr() ),SC_SPLIT_VERT),
- aCatBox ( this, ResId( CB_CAT, *rResId.GetResMgr() ) ),
- aFuncList ( this, ResId( LB_FUNC, *rResId.GetResMgr() ) ),
- aDDFuncList ( this, ResId( DDLB_FUNC, *rResId.GetResMgr() ) ),
- aInsertButton ( this, ResId( IMB_INSERT, *rResId.GetResMgr() ) ),
- aFiFuncDesc ( this, ResId( FI_FUNCDESC, *rResId.GetResMgr() ) ),
- aOldSize (0,0)
-{
- FreeResource();
- InitLRUList();
- SetStyle(GetStyle()|WB_CLIPCHILDREN);
-
- aTimer.SetTimeout(200);
- aTimer.SetTimeoutHdl(LINK( this, ScFunctionDockWin, TimerHdl));
-
- eSfxNewAlignment=GetAlignment();
- eSfxOldAlignment=eSfxNewAlignment;
- aFiFuncDesc.SetUpdateMode(TRUE);
- pAllFuncList=&aFuncList;
- aDDFuncList.Disable();
- aDDFuncList.Hide();
- nArgs=0;
- nDockMode=0;
- bSizeFlag=FALSE;
- aCatBox.SetDropDownLineCount(9);
- Font aFont=aFiFuncDesc.GetFont();
- aFont.SetColor(Color(COL_BLACK));
- aFiFuncDesc.SetFont(aFont);
- aFiFuncDesc.SetBackground( GetBackground() ); //! never transparent?
-//? SetBackground();
-
- Link aLink=LINK( this, ScFunctionDockWin, SelHdl);
- aCatBox.SetSelectHdl(aLink);
- aFuncList.SetSelectHdl(aLink);
- aDDFuncList.SetSelectHdl(aLink);
-
- Link a2Link=LINK( this, ScFunctionDockWin, SetSelectionHdl);
- aFuncList.SetDoubleClickHdl(a2Link);
- aDDFuncList.SetSelectHdl(aLink);
- aInsertButton.SetClickHdl(a2Link);
-
- Link a3Link=LINK( this, ScFunctionDockWin, SetSplitHdl);
- aPrivatSplit.SetCtrModifiedHdl(a3Link);
- StartListening( *pBindingsP, TRUE );
-
- Point aTopLeft=aCatBox.GetPosPixel();
- //String aString=aCatBox.GetEntry( 0)+String("www");
- String aString=String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("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);
- bInit=TRUE;
-}
-
-/*************************************************************************
-#* Member: ScFunctionDockWin Datum:06.10.97
-#*------------------------------------------------------------------------
-#*
-#* Klasse: ScFunctionDockWin
-#*
-#* Funktion: Destruktor der Klasse ScFunctionDockWin
-#*
-#* Input: ---
-#*
-#* Output: ---
-#*
-#************************************************************************/
-
-__EXPORT ScFunctionDockWin::~ScFunctionDockWin()
-{
- EndListening( GetBindings() );
-}
-
-/*************************************************************************
-#* Member: UpdateFunctionList Datum:06.10.97
-#*------------------------------------------------------------------------
-#*
-#* Klasse: ScFunctionDockWin
-#*
-#* Funktion: Aktualisiert die Liste der Funktionen ab-
-#* haengig von der eingestellten Kategorie.
-#*
-#* Input: ---
-#*
-#* Output: ---
-#*
-#************************************************************************/
-
-void ScFunctionDockWin::InitLRUList()
-{
- const ScAppOptions& rAppOpt = SC_MOD()->GetAppOptions();
- USHORT nLRUFuncCount = Min( rAppOpt.GetLRUFuncListCount(), (USHORT)LRU_MAX );
- USHORT* pLRUListIds = rAppOpt.GetLRUFuncList();
-
- USHORT i;
- for ( i=0; i<LRU_MAX; i++ )
- aLRUList[i] = NULL;
-
- if ( pLRUListIds )
- {
- ScFunctionMgr* pFuncMgr = ScGlobal::GetStarCalcFunctionMgr();
- for ( i=0; i<nLRUFuncCount; i++ )
- aLRUList[i] = pFuncMgr->Get( pLRUListIds[i] );
- }
-
- USHORT nSelPos = aCatBox.GetSelectEntryPos();
-
- if(nSelPos == 0)
- UpdateFunctionList();
-}
-
-/*************************************************************************
-#* Member: UpdateFunctionList Datum:10.12.99
-#*------------------------------------------------------------------------
-#*
-#* Klasse: ScFunctionDockWin
-#*
-#* Funktion: Aktualisiert die Liste der zuletzt verwendeten Funktionen.
-#*
-#* Input: ---
-#*
-#* Output: ---
-#*
-#************************************************************************/
-
-void ScFunctionDockWin::UpdateLRUList()
-{
- if (pFuncDesc && pFuncDesc->nFIndex!=0)
- {
- ScModule* pScMod = SC_MOD();
- pScMod->InsertEntryToLRUList(pFuncDesc->nFIndex);
- }
-}
-
-
-/*************************************************************************
-#* Member: SetSize Datum:06.10.97
-#*------------------------------------------------------------------------
-#*
-#* Klasse: ScFunctionDockWin
-#*
-#* Funktion: Groesse fuer die einzelnen Controls einzustellen.
-#*
-#* Input: ---
-#*
-#* Output: ---
-#*
-#************************************************************************/
-
-void ScFunctionDockWin::SetSize()
-{
- USHORT nSelEntry=0;
- SfxChildAlignment aChildAlign=eSfxOldAlignment;//GetAlignment();
- short nNewDockMode;
- switch(aChildAlign)
- {
- case SFX_ALIGN_HIGHESTTOP:
- case SFX_ALIGN_TOP:
- case SFX_ALIGN_LOWESTTOP:
- case SFX_ALIGN_LOWESTBOTTOM:
- case SFX_ALIGN_BOTTOM:
- case SFX_ALIGN_TOOLBOXTOP:
- case SFX_ALIGN_TOOLBOXBOTTOM:
-
-
- nNewDockMode=1;
- if(nDockMode!=nNewDockMode)
- {
- nDockMode=nNewDockMode;
- nSelEntry=aFuncList.GetSelectEntryPos();
- aFuncList.Clear();
- aFiFuncDesc.SetPosPixel(aFuncList.GetPosPixel());
- aDDFuncList.Enable();
- aDDFuncList.Show();
- aPrivatSplit.Disable();
- aPrivatSplit.Hide();
- aFuncList.Disable();
- aFuncList.Hide();
- pAllFuncList=&aDDFuncList;
- SelHdl(&aCatBox);
- aDDFuncList.SelectEntryPos(nSelEntry);
- }
- break;
-
- default: nNewDockMode=0;
- if(nDockMode!=nNewDockMode)
- {
- nDockMode=nNewDockMode;
- nSelEntry=aDDFuncList.GetSelectEntryPos();
- aDDFuncList.Clear();
- aDDFuncList.Disable();
- aDDFuncList.Hide();
- aPrivatSplit.Enable();
- aPrivatSplit.Show();
- aFuncList.Enable();
- aFuncList.Show();
- pAllFuncList=&aFuncList;
- SelHdl(&aCatBox);
- aFuncList.SelectEntryPos(nSelEntry);
- }
- break;
- }
-
- if(nDockMode==0)
- {
- SetLeftRightSize();
- }
- else
- {
- SetTopBottonSize();
- }
-}
-/*************************************************************************
-#* Member: SetLeftRightSize Datum:15.10.97
-#*------------------------------------------------------------------------
-#*
-#* Klasse: ScFunctionDockWin
-#*
-#* Funktion: Groesse fuer die einzelnen Controls einstellen,
-#* wenn Links oder Rechts angedockt wird.
-#*
-#* Input: ---
-#*
-#* Output: ---
-#*
-#************************************************************************/
-
-void ScFunctionDockWin::SetLeftRightSize()
-{
- if(bSizeFlag==FALSE)
- {
- bSizeFlag=TRUE;
-
- Size aDiffSize=GetSizePixel();
- Size aNewSize=GetOutputSizePixel();
- aDiffSize.Width()-=aNewSize.Width();
- aDiffSize.Height()-=aNewSize.Height();
-
- //@ SetUpdateMode( FALSE);
-
- String aString = String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("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();
- //SetSizePixel(aNewSize);
- //@ SetUpdateMode( TRUE);
- bSizeFlag=FALSE;
- }
-
-}
-/*************************************************************************
-#* Member: SetTopBottonSize Datum:15.10.97
-#*------------------------------------------------------------------------
-#*
-#* Klasse: ScFunctionDockWin
-#*
-#* Funktion: Groesse fuer die einzelnen Controls einzustellen.
-#* wenn oben oder unten angedockt wird.
-#*
-#* Input: ---
-#*
-#* Output: ---
-#*
-#************************************************************************/
-
-void ScFunctionDockWin::SetTopBottonSize()
-{
- if(bSizeFlag==FALSE)
- {
- bSizeFlag=TRUE;
- Size aDiffSize=GetSizePixel();
- Size aNewSize=GetOutputSizePixel();
- aDiffSize.Width()-=aNewSize.Width();
- aDiffSize.Height()-=aNewSize.Height();
-
- SetMyWidthToBo(aNewSize);
- SetMyHeightToBo(aNewSize);
-
- aNewSize.Width()+=aDiffSize.Width();
- aNewSize.Height()+=aDiffSize.Height();
- //SetSizePixel(aNewSize);
- //@ SetUpdateMode( TRUE);
- bSizeFlag=FALSE;
- }
-}
-
-/*************************************************************************
-#* Member: SetMyWidthLeRi Datum:15.10.97
-#*------------------------------------------------------------------------
-#*
-#* Klasse: ScFunctionDockWin
-#*
-#* Funktion: Breite fuer die einzelnen Controls und
-#* das Fenster einstellen,wenn Li oder Re
-#*
-#* Input: neue Fenstergroesse
-#*
-#* Output: ---
-#*
-#************************************************************************/
-
-void ScFunctionDockWin::SetMyWidthLeRi(Size &aNewSize)
-{
- if((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();
- Point aSplitterTopLeft=aPrivatSplit.GetPosPixel();
- Point aFDTopLeft=aFiFuncDesc.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 Datum:06.10.97
-#*------------------------------------------------------------------------
-#*
-#* Klasse: ScFunctionDockWin
-#*
-#* Funktion: Hoehe fuer die einzelnen Controls und
-#* das Fenster einstellen bei Li oder Re
-#*
-#* Input: neue Fenstergroesse
-#*
-#* Output: ---
-#*
-#************************************************************************/
-
-void ScFunctionDockWin::SetMyHeightLeRi(Size &aNewSize)
-{
- if((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: SetMyWidthToBo Datum:16.10.97
-#*------------------------------------------------------------------------
-#*
-#* Klasse: ScFunctionDockWin
-#*
-#* Funktion: Breite fuer die einzelnen Controls und
-#* das Fenster einstellen, wenn oben oder
-#* unten angedockt werden soll.
-#*
-#* Input: neue Fenstergroesse
-#*
-#* Output: ---
-#*
-#************************************************************************/
-
-void ScFunctionDockWin::SetMyWidthToBo(Size &aNewSize)
-{
- if((ULONG)aNewSize.Width()<nMinWidth) aNewSize.Width()=nMinWidth;
-
- Size aCDSize=aCatBox.GetSizePixel();
- Size aDdFLSize=aDDFuncList.GetSizePixel();
- Size aFDSize=aFiFuncDesc.GetSizePixel();
-
- Point aCDTopLeft=aCatBox.GetPosPixel();
- Point aDdFLTopLeft=aDDFuncList.GetPosPixel();
- Point aFDTopLeft=aFiFuncDesc.GetPosPixel();
-
- aCDSize.Width()=aDdFLTopLeft.X()-aFDTopLeft.X()-aCDTopLeft.X();
- aDdFLTopLeft.X()=aCDSize.Width()+aCDTopLeft.X()+aFDTopLeft.X();
-
- aDdFLSize.Width()=aNewSize.Width()-aDdFLTopLeft.X()-aFDTopLeft.X();
-
- aFDSize.Width()=aNewSize.Width()-2*aFDTopLeft.X();
-
- aDDFuncList.SetPosPixel(aDdFLTopLeft);
- aDDFuncList.SetSizePixel(aDdFLSize);
- aCatBox.SetSizePixel(aCDSize);
- aFiFuncDesc.SetSizePixel(aFDSize);
-}
-
-/*************************************************************************
-#* Member: SetHeight Datum:16.10.97
-#*------------------------------------------------------------------------
-#*
-#* Klasse: ScFunctionDockWin
-#*
-#* Funktion: Hoehe fuer die einzelnen Controls und
-#* das Fenster einstellen, wenn oben oder
-#* unten angedockt werden soll.
-#*
-#* Input: neue Fenstergroesse
-#*
-#* Output: ---
-#*
-#************************************************************************/
-
-void ScFunctionDockWin::SetMyHeightToBo(Size &aNewSize)
-{
- if((ULONG)aNewSize.Height()<nMinHeight) aNewSize.Height()=nMinHeight;
-
- Size aFDSize=aFiFuncDesc.GetSizePixel();
-
- Point aFDTopLeft=aFiFuncDesc.GetPosPixel();
- Point aCBTopLeft=aCatBox.GetPosPixel();
- aFDSize.Height()=aNewSize.Height()-aFDTopLeft.Y()-aCBTopLeft.Y();
- aFiFuncDesc.SetSizePixel(aFDSize);
-
-}
-
-/*************************************************************************
-#* Member: SetDescription Datum:13.10.97
-#*------------------------------------------------------------------------
-#*
-#* Klasse: ScFunctionDockWin
-#*
-#* Funktion: Erklaerungstext fuer die Funktion einstellen.
-#*
-#* Input: ---
-#*
-#* Output: ---
-#*
-#************************************************************************/
-
-void ScFunctionDockWin::SetDescription()
-{
- aFiFuncDesc.SetText( EMPTY_STRING );
- const ScFuncDesc* pDesc =
- (const ScFuncDesc*)pAllFuncList->GetEntryData(
- pAllFuncList->GetSelectEntryPos() );
- if (pDesc)
- {
- pDesc->InitArgumentInfo(); // full argument info is needed
-
- String aString=pAllFuncList->GetSelectEntry();
- if(nDockMode==0)
- {
- aString.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ":\n\n" ));
- }
- else
- {
- aString.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ": " ));
- }
-
- aString+=pDesc->GetParamList();
-
- if(nDockMode==0)
- {
- aString.AppendAscii(RTL_CONSTASCII_STRINGPARAM( "\n\n" ));
- }
- else
- {
- aString += '\n';
- }
-
- aString+=*(pDesc->pFuncDesc);
-
- aFiFuncDesc.SetText(aString);
- aFiFuncDesc.StateChanged(STATE_CHANGE_TEXT);
- aFiFuncDesc.Invalidate();
- aFiFuncDesc.Update();
-
- }
- }
-
-/*************************************************************************
-#* Member: Resizing Datum:06.10.97
-#*------------------------------------------------------------------------
-#*
-#* Klasse: ScFunctionDockWin
-#*
-#* Funktion: Ueberladene Funktion um die Groesse der
-#* einzelnen Controls einzustellen.
-#*
-#* Input: neue Groesse
-#*
-#* Output: ---
-#*
-#************************************************************************/
-
-void __EXPORT ScFunctionDockWin::Resizing( Size& rNewSize )
-{
- if((ULONG)rNewSize.Width()<nMinWidth) rNewSize.Width()=nMinWidth;
- if((ULONG)rNewSize.Height()<nMinHeight) rNewSize.Height()=nMinHeight;
-
-}
-
-/*************************************************************************
-#* Member: Close Datum:07.10.97
-#*------------------------------------------------------------------------
-#*
-#* Klasse: ScFunctionDockWin
-#*
-#* Funktion: Schliessen des Fensters
-#*
-#* Input: ---
-#*
-#* Output: TRUE
-#*
-#************************************************************************/
-
-BOOL __EXPORT ScFunctionDockWin::Close()
-{
- SfxBoolItem aItem( FID_FUNCTION_BOX, FALSE );
-
- GetBindings().GetDispatcher()->Execute( FID_FUNCTION_BOX,
- SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
- &aItem, 0L );
-
- SfxDockingWindow::Close();
-
- return( TRUE );
-}
-
-
-/*************************************************************************
-#* Member: CheckAlignment Datum:16.10.97
-#*------------------------------------------------------------------------
-#*
-#* Klasse: ScFunctionDockWin
-#*
-#* Funktion: Ueberprueft den Andockmodus und stellt die
-#* Groessen dementsprechend ein.
-#*
-#* Input: Das neue Alignment
-#*
-#* Output: Das uebergebene Alignment
-#*
-#************************************************************************/
-SfxChildAlignment __EXPORT ScFunctionDockWin::CheckAlignment(SfxChildAlignment /* abla */,
- SfxChildAlignment aChildAlign)
-{
- String aString = String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("ww"));
- Size aTxtSize( aFiFuncDesc.GetTextWidth(aString), aFiFuncDesc.GetTextHeight() );
- if(!bInit)
- {
- eSfxOldAlignment=eSfxNewAlignment;
- eSfxNewAlignment=aChildAlign;
- }
- else
- {
- bInit=FALSE;
- eSfxOldAlignment=aChildAlign;
- eSfxNewAlignment=aChildAlign;
- }
-
- switch(eSfxOldAlignment)
- {
- case SFX_ALIGN_HIGHESTTOP:
- case SFX_ALIGN_TOP:
- case SFX_ALIGN_LOWESTTOP:
- case SFX_ALIGN_LOWESTBOTTOM:
- case SFX_ALIGN_BOTTOM:
- case SFX_ALIGN_TOOLBOXTOP:
- case SFX_ALIGN_TOOLBOXBOTTOM:
-
- nMinWidth= 0;/*aDDFuncList.GetPosPixel().X()+
- 10*aTxtSize.Width()+
- aFuncList.GetPosPixel().X();*/
- nMinHeight=0;
-
- break;
-
- case SFX_ALIGN_NOALIGNMENT:
-
- aString = aCatBox.GetEntry(0);
- aString.AppendAscii(RTL_CONSTASCII_STRINGPARAM("www"));
- aTxtSize = Size( aFiFuncDesc.GetTextWidth(aString),
- aFiFuncDesc.GetTextHeight() );
-
- default: Point aTopLeft=aCatBox.GetPosPixel();
- nMinWidth=aTxtSize.Width()+aTopLeft.X()
- +2*aFuncList.GetPosPixel().X();
- nMinHeight=19*aTxtSize.Height();
- //aCatBox.SelectEntryPos(0);
-
- break;
- }
-
- return aChildAlign;
-}
-/*************************************************************************
-#* Member: Close Datum:07.10.97
-#*------------------------------------------------------------------------
-#*
-#* Klasse: ScFunctionDockWin
-#*
-#* Funktion: Aenderungen erkennen
-#*
-#* Input: ---
-#*
-#* Output: TRUE
-#*
-#************************************************************************/
-void ScFunctionDockWin::Notify( SfxBroadcaster&, const SfxHint& /* rHint */ )
-{
-// const SfxPoolItemHint *pPoolItemHint = PTR_CAST(SfxPoolItemHint, &rHint);
- /*
- if ( pPoolItemHint
- && ( pPoolItemHint->GetObject()->ISA( SvxColorTableItem ) ) )
- {
- // Die Liste der Farben hat sich geaendert
- pColorTable = ( (SvxColorTableItem*) pPoolItemHint->GetObject() )->GetColorTable();
- FillValueSet();
- }
- */
-}
-
-
-/*************************************************************************
-#* Member: Resize Datum:06.10.97
-#*------------------------------------------------------------------------
-#*
-#* Klasse: ScFunctionDockWin
-#*
-#* Funktion: Ueberladene Funktion um die Groesse der
-#* einzelnen Controls einzustellen.
-#*
-#* Input: neue Groesse
-#*
-#* Output: ---
-#*
-#************************************************************************/
-
-void __EXPORT ScFunctionDockWin::Resize()
-{
- if ( !IsFloatingMode() ||
- !GetFloatingWindow()->IsRollUp() )
- {
- Size aQSize=GetOutputSizePixel();
- Resizing( aQSize);
- SetSize();
- }
- SfxDockingWindow::Resize();
-}
-
-/*************************************************************************
-#* Member: UpdateFunctionList Datum:06.10.97
-#*------------------------------------------------------------------------
-#*
-#* Klasse: ScFunctionDockWin
-#*
-#* Funktion: Aktualisiert die Liste der Funktionen ab-
-#* haengig von der eingestellten Kategorie.
-#*
-#* Input: ---
-#*
-#* Output: ---
-#*
-#************************************************************************/
-
-void ScFunctionDockWin::UpdateFunctionList()
-{
- USHORT nSelPos = aCatBox.GetSelectEntryPos();
- USHORT nCategory = ( LISTBOX_ENTRY_NOTFOUND != nSelPos )
- ? (nSelPos-1) : 0;
-
- pAllFuncList->Clear();
- pAllFuncList->SetUpdateMode( FALSE );
-
- if ( nSelPos > 0 )
- {
- ScFunctionMgr* pFuncMgr = ScGlobal::GetStarCalcFunctionMgr();
-
- const ScFuncDesc* pDesc = pFuncMgr->First( nCategory );
- while ( pDesc )
- {
- pAllFuncList->SetEntryData(
- pAllFuncList->InsertEntry( *(pDesc->pFuncName) ),
- (void*)pDesc );
- pDesc = pFuncMgr->Next();
- }
- }
- else // LRU-Liste
- {
- for ( USHORT i=0; i<LRU_MAX && aLRUList[i]; i++ )
- {
- const ScFuncDesc* pDesc = aLRUList[i];
- pAllFuncList->SetEntryData(
- pAllFuncList->InsertEntry( *(pDesc->pFuncName) ),
- (void*)pDesc );
- }
- }
-
-
- //------------------------------------------------------
- pAllFuncList->SetUpdateMode( TRUE );
-
- if ( pAllFuncList->GetEntryCount() > 0 )
- {
- pAllFuncList->Enable();
- pAllFuncList->SelectEntryPos( 0 );
- }
- else
- {
- pAllFuncList->Disable();
- }
-}
-
-/*************************************************************************
-#* Member: DoEnter Datum:06.10.97
-#*------------------------------------------------------------------------
-#*
-#* Klasse: ScFunctionDockWin
-#*
-#* Funktion: Eingabe ins Dokument uebernehmen. Wird aufgerufen
-#* nach betaetigen der Uebernehmen- Schaltflaeche
-#* oder einem Doppelklick in die Funktionsliste.
-#*
-#* Input: ---
-#*
-#* Output: ---
-#*
-#************************************************************************/
-
-void ScFunctionDockWin::DoEnter(BOOL /* bOk */) //@@ ???
-{
- String aFirstArgStr;
- String aParaStr;
- String aArgStr;
- String aString=pAllFuncList->GetSelectEntry();
- SfxViewShell* pCurSh = SfxViewShell::Current();
- nArgs=0;
-
- if(aString.Len()>0)
- {
-
- ScModule* pScMod = SC_MOD();
- ScTabViewShell* pViewSh = PTR_CAST( ScTabViewShell, pCurSh);
- ScInputHandler* pHdl = pScMod->GetInputHdl( pViewSh );
- if(!pScMod->IsEditMode())
- {
- pScMod->SetInputMode(SC_INPUT_TABLE);
- aString = '=';
- aString += pAllFuncList->GetSelectEntry();
- if (pHdl)
- pHdl->ClearText();
- }
- const ScFuncDesc* pDesc =
- (const ScFuncDesc*)pAllFuncList->GetEntryData(
- pAllFuncList->GetSelectEntryPos() );
- if (pDesc)
- {
- pFuncDesc=pDesc;
- UpdateLRUList();
- nArgs = pDesc->nArgCount;
- if(nArgs>0)
- {
- // NOTE: Theoretically the first parameter could have the
- // suppress flag as well, but practically it doesn't.
- aFirstArgStr = *(pDesc->ppDefArgNames[0]);
- aFirstArgStr.EraseLeadingAndTrailingChars();
- aFirstArgStr.SearchAndReplaceAll(' ', '_');
- aArgStr = aFirstArgStr;
- if ( nArgs != VAR_ARGS )
- { // no VarArgs or Fix plus VarArgs, but not VarArgs only
- String aArgSep = String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM( "; " ));
- USHORT nFix = ( nArgs < VAR_ARGS ? nArgs : nArgs - VAR_ARGS + 1 );
- for ( USHORT nArg = 1;
- nArg < nFix && !pDesc->pDefArgFlags[nArg].bOptional; nArg++ )
- {
- if (!pDesc->pDefArgFlags[nArg].bSuppress)
- {
- aArgStr += aArgSep;
- String sTmp(*(pDesc->ppDefArgNames[nArg]));
- sTmp.EraseLeadingAndTrailingChars();
- sTmp.SearchAndReplaceAll(' ', '_');
- aArgStr += sTmp;
- }
- }
- }
- }
- }
- if (pHdl)
- {
- if(pHdl->GetEditString().Len()==0)
- {
- aString = '=';
- aString += pAllFuncList->GetSelectEntry();
- }
- EditView *pEdView=pHdl->GetActiveView();
- if(pEdView!=NULL) // @ Wegen Absturz bei Namen festlegen
- {
- if(nArgs>0)
- {
- pHdl->InsertFunction(aString);
- pEdView->InsertText(aArgStr,TRUE);
- ESelection aESel=pEdView->GetSelection();
- aESel.nEndPos=aESel.nStartPos+aFirstArgStr.Len();
- pEdView->SetSelection(aESel);
- pHdl->DataChanged();
- }
- else
- {
- aString.AppendAscii(RTL_CONSTASCII_STRINGPARAM( "()" ));
- pEdView->InsertText(aString,FALSE);
- pHdl->DataChanged();
- }
- }
- }
- InitLRUList();
- }
- if ( pCurSh )
- {
- Window* pShellWnd = pCurSh->GetWindow();
-
- if ( pShellWnd )
- pShellWnd->GrabFocus();
- }
-
-
-}
-
-
-
-/*************************************************************************
-#* Handle: SelHdl Datum:06.10.97
-#*------------------------------------------------------------------------
-#*
-#* Klasse: ScFunctionDockWin
-#*
-#* Funktion: Bei einer Aenderung der Kategorie wird die
-#* die Liste der Funktionen aktualisiert.
-#*
-#* Input: ---
-#*
-#* Output: ---
-#*
-#************************************************************************/
-
-IMPL_LINK( ScFunctionDockWin, SelHdl, ListBox*, pLb )
-{
- if ( pLb == &aCatBox)
- {
- UpdateFunctionList();
- SetDescription();
- }
-
- if ( pLb == &aFuncList||pLb == &aDDFuncList)
- {
- SetDescription();
- }
-
-
- //SetSize();
- return 0;
-}
-
-/*************************************************************************
-#* Handle: SelHdl Datum:06.10.97
-#*------------------------------------------------------------------------
-#*
-#* Klasse: ScFunctionDockWin
-#*
-#* Funktion: Bei einer Aenderung der Kategorie wird die
-#* die Liste der Funktionen aktualisiert.
-#*
-#* Input: ---
-#*
-#* Output: ---
-#*
-#************************************************************************/
-
-IMPL_LINK( ScFunctionDockWin, SetSelectionHdl, void*, pCtrl )
-{
- if ((ImageButton *)pCtrl == &aInsertButton ||
- (ListBox *)pCtrl == &aFuncList)
- {
- DoEnter(TRUE); // Uebernimmt die Eingabe
- }
- //...
-
- return 0;
-}
-
-/*************************************************************************
-#* Handle: SetSplitHdl Datum:13.10.97
-#*------------------------------------------------------------------------
-#*
-#* Klasse: ScFunctionDockWin
-#*
-#* Funktion: Bei einer Aenderung des Split- Controls werden die
-#* einzelnen Controls an die neue Groesse angepasst.
-#*
-#* Input: Zeiger auf Control
-#*
-#* Output: ---
-#*
-#************************************************************************/
-
-IMPL_LINK( ScFunctionDockWin, SetSplitHdl, ScPrivatSplit*, pCtrl )
-{
- if (pCtrl == &aPrivatSplit)
- {
- 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);
- /*
- aFuncList.Invalidate();
- aFuncList.Update();
- aFiFuncDesc.Invalidate();
- aFiFuncDesc.Update();
- */
- }
- //...
-
- return 0;
-}
-
-void ScFunctionDockWin::ToggleFloatingMode()
-{
- aSplitterInitPos = Point();
- SfxDockingWindow::ToggleFloatingMode();
-
- eSfxNewAlignment=GetAlignment();
- eSfxOldAlignment=eSfxNewAlignment;
-
- aOldSize.Height()=0;
- aOldSize.Width()=0;
- aTimer.Start();
-}
-
-IMPL_LINK( ScFunctionDockWin, TimerHdl, Timer*, EMPTYARG )
-{
- CheckAlignment(eSfxOldAlignment,eSfxNewAlignment);
- SetSize();
- return 0;
-}
-
-void ScFunctionDockWin::Initialize(SfxChildWinInfo *pInfo)
-{
- String aStr;
- if(pInfo!=NULL)
- {
- if ( pInfo->aExtraString.Len() )
- {
- xub_StrLen nPos = pInfo->aExtraString.Search(
- String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("ScFuncList:")));
-
- // Versuche, den Alignment-String "ALIGN:(...)" einzulesen; wenn
- // er nicht vorhanden ist, liegt eine "altere Version vor
- if ( nPos != STRING_NOTFOUND )
- {
- xub_StrLen n1 = pInfo->aExtraString.Search('(', nPos);
- if ( n1 != STRING_NOTFOUND )
- {
- xub_StrLen n2 = pInfo->aExtraString.Search(')', n1);
- if ( n2 != STRING_NOTFOUND )
- {
- // Alignment-String herausschneiden
- aStr = pInfo->aExtraString.Copy(nPos, n2 - nPos + 1);
- pInfo->aExtraString.Erase(nPos, n2 - nPos + 1);
- aStr.Erase(0, n1-nPos+1);
- }
- }
- }
- }
- }
- SfxDockingWindow::Initialize(pInfo);
-
- if ( aStr.Len())
- {
- aSplitterInitPos=aPrivatSplit.GetPosPixel();
- aSplitterInitPos.Y()=(USHORT) aStr.ToInt32();
- xub_StrLen n1 = aStr.Search(';');
- aStr.Erase(0, n1+1);
- USHORT nSelPos=sal::static_int_cast<USHORT>( aStr.ToInt32() );
- aCatBox.SelectEntryPos(nSelPos);
- SelHdl(&aCatBox);
-
- // if the window has already been shown (from SfxDockingWindow::Initialize if docked),
- // set the splitter position now, otherwise it is set in StateChanged with type INITSHOW
-
- UseSplitterInitPos();
- }
-}
-
-//-------------------------------------------------------------------------
-
-void ScFunctionDockWin::FillInfo(SfxChildWinInfo& rInfo) const
-{
- SfxDockingWindow::FillInfo(rInfo);
- Point aPoint=aPrivatSplit.GetPosPixel();
- rInfo.aExtraString.AppendAscii(RTL_CONSTASCII_STRINGPARAM( "ScFuncList:(" ));
- rInfo.aExtraString += String::CreateFromInt32(aPoint.Y());
- rInfo.aExtraString += ';';
- rInfo.aExtraString += String::CreateFromInt32(aCatBox.GetSelectEntryPos());
- rInfo.aExtraString += ')';
-}
-
-void ScFunctionDockWin::UseSplitterInitPos()
-{
- if ( IsVisible() && aPrivatSplit.IsEnabled() && aSplitterInitPos != Point() )
- {
- aPrivatSplit.MoveSplitTo(aSplitterInitPos);
- aSplitterInitPos = Point(); // use only once
- }
-}
-
-void ScFunctionDockWin::StateChanged( StateChangedType nStateChange )
-{
- SfxDockingWindow::StateChanged( nStateChange );
-
- if (nStateChange == STATE_CHANGE_INITSHOW)
- {
- UseSplitterInitPos(); // set initial splitter position if necessary
- }
-}
-
-
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dwfunctr.cxx,v $
+ * $Revision: 1.15 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sc.hxx"
+
+
+
+// INCLUDE ---------------------------------------------------------------
+
+#include <svx/editview.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/viewsh.hxx>
+
+#include "sc.hrc"
+#include "global.hxx" // ScAddress
+#include "scresid.hxx"
+#include "reffact.hxx"
+#include "document.hxx"
+#include "cell.hxx"
+#include "scmod.hxx"
+#include "inputhdl.hxx"
+#include "tabvwsh.hxx"
+#include "appoptio.hxx"
+#include "compiler.hxx"
+
+#include "dwfunctr.hrc"
+#include "dwfunctr.hxx"
+
+// -----------------------------------------------------------------------
+
+#define ARG_SEPERATOR String("; ")
+SFX_IMPL_DOCKINGWINDOW( ScFunctionChildWindow, FID_FUNCTION_BOX )
+
+/*************************************************************************
+#* Member: ScFunctionChildWindow Datum:06.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: ScFunctionChildWindow
+#*
+#* Funktion: Konstruktor der Klasse ScFunctionChildWindow
+#* Ableitung vom SfxChildWindow als "Behaelter" fuer
+#* Funktions- Fenster in Clac
+#*
+#* Input: ---
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+__EXPORT ScFunctionChildWindow::ScFunctionChildWindow( Window* pParentP,
+ USHORT nId,
+ SfxBindings* pBindings,
+ SfxChildWinInfo* pInfo ) :
+ SfxChildWindow( pParentP, nId )
+{
+ ScFunctionDockWin* pWin = new ScFunctionDockWin( pBindings, this,
+ pParentP, ScResId( FID_FUNCTION_BOX ) );
+ pWindow = pWin;
+
+ eChildAlignment = SFX_ALIGN_RIGHT;
+
+ pWin->Initialize( pInfo );
+}
+
+/*************************************************************************
+#* Member: ScFunctionDockWin Datum:06.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: ScFunctionDockWin
+#*
+#* Funktion: Konstruktor der Klasse ScFunctionDockWin
+#*
+#* Input: Sfx- Verknuepfungen, Fenster, Resource
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+ScFunctionDockWin::ScFunctionDockWin( SfxBindings* pBindingsP,
+ SfxChildWindow *pCW, Window* pParent, const ResId& rResId ) :
+
+ SfxDockingWindow( pBindingsP, pCW, pParent, rResId ),
+ aPrivatSplit ( this, ResId( FT_SPLIT, *rResId.GetResMgr() ),SC_SPLIT_VERT),
+ aCatBox ( this, ResId( CB_CAT, *rResId.GetResMgr() ) ),
+ aFuncList ( this, ResId( LB_FUNC, *rResId.GetResMgr() ) ),
+ aDDFuncList ( this, ResId( DDLB_FUNC, *rResId.GetResMgr() ) ),
+ aInsertButton ( this, ResId( IMB_INSERT, *rResId.GetResMgr() ) ),
+ aFiFuncDesc ( this, ResId( FI_FUNCDESC, *rResId.GetResMgr() ) ),
+ aOldSize (0,0)
+{
+ FreeResource();
+ InitLRUList();
+ SetStyle(GetStyle()|WB_CLIPCHILDREN);
+
+ aTimer.SetTimeout(200);
+ aTimer.SetTimeoutHdl(LINK( this, ScFunctionDockWin, TimerHdl));
+
+ eSfxNewAlignment=GetAlignment();
+ eSfxOldAlignment=eSfxNewAlignment;
+ aFiFuncDesc.SetUpdateMode(TRUE);
+ pAllFuncList=&aFuncList;
+ aDDFuncList.Disable();
+ aDDFuncList.Hide();
+ nArgs=0;
+ nDockMode=0;
+ bSizeFlag=FALSE;
+ aCatBox.SetDropDownLineCount(9);
+ Font aFont=aFiFuncDesc.GetFont();
+ aFont.SetColor(Color(COL_BLACK));
+ aFiFuncDesc.SetFont(aFont);
+ aFiFuncDesc.SetBackground( GetBackground() ); //! never transparent?
+//? SetBackground();
+
+ Link aLink=LINK( this, ScFunctionDockWin, SelHdl);
+ aCatBox.SetSelectHdl(aLink);
+ aFuncList.SetSelectHdl(aLink);
+ aDDFuncList.SetSelectHdl(aLink);
+
+ Link a2Link=LINK( this, ScFunctionDockWin, SetSelectionHdl);
+ aFuncList.SetDoubleClickHdl(a2Link);
+ aDDFuncList.SetSelectHdl(aLink);
+ aInsertButton.SetClickHdl(a2Link);
+
+ Link a3Link=LINK( this, ScFunctionDockWin, SetSplitHdl);
+ aPrivatSplit.SetCtrModifiedHdl(a3Link);
+ StartListening( *pBindingsP, TRUE );
+
+ Point aTopLeft=aCatBox.GetPosPixel();
+ //String aString=aCatBox.GetEntry( 0)+String("www");
+ String aString=String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("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);
+ bInit=TRUE;
+}
+
+/*************************************************************************
+#* Member: ScFunctionDockWin Datum:06.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: ScFunctionDockWin
+#*
+#* Funktion: Destruktor der Klasse ScFunctionDockWin
+#*
+#* Input: ---
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+__EXPORT ScFunctionDockWin::~ScFunctionDockWin()
+{
+ EndListening( GetBindings() );
+}
+
+/*************************************************************************
+#* Member: UpdateFunctionList Datum:06.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: ScFunctionDockWin
+#*
+#* Funktion: Aktualisiert die Liste der Funktionen ab-
+#* haengig von der eingestellten Kategorie.
+#*
+#* Input: ---
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+void ScFunctionDockWin::InitLRUList()
+{
+ const ScAppOptions& rAppOpt = SC_MOD()->GetAppOptions();
+ USHORT nLRUFuncCount = Min( rAppOpt.GetLRUFuncListCount(), (USHORT)LRU_MAX );
+ USHORT* pLRUListIds = rAppOpt.GetLRUFuncList();
+
+ USHORT i;
+ for ( i=0; i<LRU_MAX; i++ )
+ aLRUList[i] = NULL;
+
+ if ( pLRUListIds )
+ {
+ ScFunctionMgr* pFuncMgr = ScGlobal::GetStarCalcFunctionMgr();
+ for ( i=0; i<nLRUFuncCount; i++ )
+ aLRUList[i] = pFuncMgr->Get( pLRUListIds[i] );
+ }
+
+ USHORT nSelPos = aCatBox.GetSelectEntryPos();
+
+ if(nSelPos == 0)
+ UpdateFunctionList();
+}
+
+/*************************************************************************
+#* Member: UpdateFunctionList Datum:10.12.99
+#*------------------------------------------------------------------------
+#*
+#* Klasse: ScFunctionDockWin
+#*
+#* Funktion: Aktualisiert die Liste der zuletzt verwendeten Funktionen.
+#*
+#* Input: ---
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+void ScFunctionDockWin::UpdateLRUList()
+{
+ if (pFuncDesc && pFuncDesc->nFIndex!=0)
+ {
+ ScModule* pScMod = SC_MOD();
+ pScMod->InsertEntryToLRUList(pFuncDesc->nFIndex);
+ }
+}
+
+
+/*************************************************************************
+#* Member: SetSize Datum:06.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: ScFunctionDockWin
+#*
+#* Funktion: Groesse fuer die einzelnen Controls einzustellen.
+#*
+#* Input: ---
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+void ScFunctionDockWin::SetSize()
+{
+ USHORT nSelEntry=0;
+ SfxChildAlignment aChildAlign=eSfxOldAlignment;//GetAlignment();
+ short nNewDockMode;
+ switch(aChildAlign)
+ {
+ case SFX_ALIGN_HIGHESTTOP:
+ case SFX_ALIGN_TOP:
+ case SFX_ALIGN_LOWESTTOP:
+ case SFX_ALIGN_LOWESTBOTTOM:
+ case SFX_ALIGN_BOTTOM:
+ case SFX_ALIGN_TOOLBOXTOP:
+ case SFX_ALIGN_TOOLBOXBOTTOM:
+
+
+ nNewDockMode=1;
+ if(nDockMode!=nNewDockMode)
+ {
+ nDockMode=nNewDockMode;
+ nSelEntry=aFuncList.GetSelectEntryPos();
+ aFuncList.Clear();
+ aFiFuncDesc.SetPosPixel(aFuncList.GetPosPixel());
+ aDDFuncList.Enable();
+ aDDFuncList.Show();
+ aPrivatSplit.Disable();
+ aPrivatSplit.Hide();
+ aFuncList.Disable();
+ aFuncList.Hide();
+ pAllFuncList=&aDDFuncList;
+ SelHdl(&aCatBox);
+ aDDFuncList.SelectEntryPos(nSelEntry);
+ }
+ break;
+
+ default: nNewDockMode=0;
+ if(nDockMode!=nNewDockMode)
+ {
+ nDockMode=nNewDockMode;
+ nSelEntry=aDDFuncList.GetSelectEntryPos();
+ aDDFuncList.Clear();
+ aDDFuncList.Disable();
+ aDDFuncList.Hide();
+ aPrivatSplit.Enable();
+ aPrivatSplit.Show();
+ aFuncList.Enable();
+ aFuncList.Show();
+ pAllFuncList=&aFuncList;
+ SelHdl(&aCatBox);
+ aFuncList.SelectEntryPos(nSelEntry);
+ }
+ break;
+ }
+
+ if(nDockMode==0)
+ {
+ SetLeftRightSize();
+ }
+ else
+ {
+ SetTopBottonSize();
+ }
+}
+/*************************************************************************
+#* Member: SetLeftRightSize Datum:15.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: ScFunctionDockWin
+#*
+#* Funktion: Groesse fuer die einzelnen Controls einstellen,
+#* wenn Links oder Rechts angedockt wird.
+#*
+#* Input: ---
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+void ScFunctionDockWin::SetLeftRightSize()
+{
+ if(bSizeFlag==FALSE)
+ {
+ bSizeFlag=TRUE;
+
+ Size aDiffSize=GetSizePixel();
+ Size aNewSize=GetOutputSizePixel();
+ aDiffSize.Width()-=aNewSize.Width();
+ aDiffSize.Height()-=aNewSize.Height();
+
+ //@ SetUpdateMode( FALSE);
+
+ String aString = String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("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();
+ //SetSizePixel(aNewSize);
+ //@ SetUpdateMode( TRUE);
+ bSizeFlag=FALSE;
+ }
+
+}
+/*************************************************************************
+#* Member: SetTopBottonSize Datum:15.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: ScFunctionDockWin
+#*
+#* Funktion: Groesse fuer die einzelnen Controls einzustellen.
+#* wenn oben oder unten angedockt wird.
+#*
+#* Input: ---
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+void ScFunctionDockWin::SetTopBottonSize()
+{
+ if(bSizeFlag==FALSE)
+ {
+ bSizeFlag=TRUE;
+ Size aDiffSize=GetSizePixel();
+ Size aNewSize=GetOutputSizePixel();
+ aDiffSize.Width()-=aNewSize.Width();
+ aDiffSize.Height()-=aNewSize.Height();
+
+ SetMyWidthToBo(aNewSize);
+ SetMyHeightToBo(aNewSize);
+
+ aNewSize.Width()+=aDiffSize.Width();
+ aNewSize.Height()+=aDiffSize.Height();
+ //SetSizePixel(aNewSize);
+ //@ SetUpdateMode( TRUE);
+ bSizeFlag=FALSE;
+ }
+}
+
+/*************************************************************************
+#* Member: SetMyWidthLeRi Datum:15.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: ScFunctionDockWin
+#*
+#* Funktion: Breite fuer die einzelnen Controls und
+#* das Fenster einstellen,wenn Li oder Re
+#*
+#* Input: neue Fenstergroesse
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+void ScFunctionDockWin::SetMyWidthLeRi(Size &aNewSize)
+{
+ if((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();
+ Point aSplitterTopLeft=aPrivatSplit.GetPosPixel();
+ Point aFDTopLeft=aFiFuncDesc.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 Datum:06.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: ScFunctionDockWin
+#*
+#* Funktion: Hoehe fuer die einzelnen Controls und
+#* das Fenster einstellen bei Li oder Re
+#*
+#* Input: neue Fenstergroesse
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+void ScFunctionDockWin::SetMyHeightLeRi(Size &aNewSize)
+{
+ if((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: SetMyWidthToBo Datum:16.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: ScFunctionDockWin
+#*
+#* Funktion: Breite fuer die einzelnen Controls und
+#* das Fenster einstellen, wenn oben oder
+#* unten angedockt werden soll.
+#*
+#* Input: neue Fenstergroesse
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+void ScFunctionDockWin::SetMyWidthToBo(Size &aNewSize)
+{
+ if((ULONG)aNewSize.Width()<nMinWidth) aNewSize.Width()=nMinWidth;
+
+ Size aCDSize=aCatBox.GetSizePixel();
+ Size aDdFLSize=aDDFuncList.GetSizePixel();
+ Size aFDSize=aFiFuncDesc.GetSizePixel();
+
+ Point aCDTopLeft=aCatBox.GetPosPixel();
+ Point aDdFLTopLeft=aDDFuncList.GetPosPixel();
+ Point aFDTopLeft=aFiFuncDesc.GetPosPixel();
+
+ aCDSize.Width()=aDdFLTopLeft.X()-aFDTopLeft.X()-aCDTopLeft.X();
+ aDdFLTopLeft.X()=aCDSize.Width()+aCDTopLeft.X()+aFDTopLeft.X();
+
+ aDdFLSize.Width()=aNewSize.Width()-aDdFLTopLeft.X()-aFDTopLeft.X();
+
+ aFDSize.Width()=aNewSize.Width()-2*aFDTopLeft.X();
+
+ aDDFuncList.SetPosPixel(aDdFLTopLeft);
+ aDDFuncList.SetSizePixel(aDdFLSize);
+ aCatBox.SetSizePixel(aCDSize);
+ aFiFuncDesc.SetSizePixel(aFDSize);
+}
+
+/*************************************************************************
+#* Member: SetHeight Datum:16.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: ScFunctionDockWin
+#*
+#* Funktion: Hoehe fuer die einzelnen Controls und
+#* das Fenster einstellen, wenn oben oder
+#* unten angedockt werden soll.
+#*
+#* Input: neue Fenstergroesse
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+void ScFunctionDockWin::SetMyHeightToBo(Size &aNewSize)
+{
+ if((ULONG)aNewSize.Height()<nMinHeight) aNewSize.Height()=nMinHeight;
+
+ Size aFDSize=aFiFuncDesc.GetSizePixel();
+
+ Point aFDTopLeft=aFiFuncDesc.GetPosPixel();
+ Point aCBTopLeft=aCatBox.GetPosPixel();
+ aFDSize.Height()=aNewSize.Height()-aFDTopLeft.Y()-aCBTopLeft.Y();
+ aFiFuncDesc.SetSizePixel(aFDSize);
+
+}
+
+/*************************************************************************
+#* Member: SetDescription Datum:13.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: ScFunctionDockWin
+#*
+#* Funktion: Erklaerungstext fuer die Funktion einstellen.
+#*
+#* Input: ---
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+void ScFunctionDockWin::SetDescription()
+{
+ aFiFuncDesc.SetText( EMPTY_STRING );
+ const ScFuncDesc* pDesc =
+ (const ScFuncDesc*)pAllFuncList->GetEntryData(
+ pAllFuncList->GetSelectEntryPos() );
+ if (pDesc)
+ {
+ pDesc->initArgumentInfo(); // full argument info is needed
+
+ String aString=pAllFuncList->GetSelectEntry();
+ if(nDockMode==0)
+ {
+ aString.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ":\n\n" ));
+ }
+ else
+ {
+ aString.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ": " ));
+ }
+
+ aString+=pDesc->GetParamList();
+
+ if(nDockMode==0)
+ {
+ aString.AppendAscii(RTL_CONSTASCII_STRINGPARAM( "\n\n" ));
+ }
+ else
+ {
+ aString += '\n';
+ }
+
+ aString+=*(pDesc->pFuncDesc);
+
+ aFiFuncDesc.SetText(aString);
+ aFiFuncDesc.StateChanged(STATE_CHANGE_TEXT);
+ aFiFuncDesc.Invalidate();
+ aFiFuncDesc.Update();
+
+ }
+ }
+
+/*************************************************************************
+#* Member: Resizing Datum:06.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: ScFunctionDockWin
+#*
+#* Funktion: Ueberladene Funktion um die Groesse der
+#* einzelnen Controls einzustellen.
+#*
+#* Input: neue Groesse
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+void __EXPORT ScFunctionDockWin::Resizing( Size& rNewSize )
+{
+ if((ULONG)rNewSize.Width()<nMinWidth) rNewSize.Width()=nMinWidth;
+ if((ULONG)rNewSize.Height()<nMinHeight) rNewSize.Height()=nMinHeight;
+
+}
+
+/*************************************************************************
+#* Member: Close Datum:07.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: ScFunctionDockWin
+#*
+#* Funktion: Schliessen des Fensters
+#*
+#* Input: ---
+#*
+#* Output: TRUE
+#*
+#************************************************************************/
+
+BOOL __EXPORT ScFunctionDockWin::Close()
+{
+ SfxBoolItem aItem( FID_FUNCTION_BOX, FALSE );
+
+ GetBindings().GetDispatcher()->Execute( FID_FUNCTION_BOX,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
+ &aItem, 0L );
+
+ SfxDockingWindow::Close();
+
+ return( TRUE );
+}
+
+
+/*************************************************************************
+#* Member: CheckAlignment Datum:16.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: ScFunctionDockWin
+#*
+#* Funktion: Ueberprueft den Andockmodus und stellt die
+#* Groessen dementsprechend ein.
+#*
+#* Input: Das neue Alignment
+#*
+#* Output: Das uebergebene Alignment
+#*
+#************************************************************************/
+SfxChildAlignment __EXPORT ScFunctionDockWin::CheckAlignment(SfxChildAlignment /* abla */,
+ SfxChildAlignment aChildAlign)
+{
+ String aString = String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("ww"));
+ Size aTxtSize( aFiFuncDesc.GetTextWidth(aString), aFiFuncDesc.GetTextHeight() );
+ if(!bInit)
+ {
+ eSfxOldAlignment=eSfxNewAlignment;
+ eSfxNewAlignment=aChildAlign;
+ }
+ else
+ {
+ bInit=FALSE;
+ eSfxOldAlignment=aChildAlign;
+ eSfxNewAlignment=aChildAlign;
+ }
+
+ switch(eSfxOldAlignment)
+ {
+ case SFX_ALIGN_HIGHESTTOP:
+ case SFX_ALIGN_TOP:
+ case SFX_ALIGN_LOWESTTOP:
+ case SFX_ALIGN_LOWESTBOTTOM:
+ case SFX_ALIGN_BOTTOM:
+ case SFX_ALIGN_TOOLBOXTOP:
+ case SFX_ALIGN_TOOLBOXBOTTOM:
+
+ nMinWidth= 0;/*aDDFuncList.GetPosPixel().X()+
+ 10*aTxtSize.Width()+
+ aFuncList.GetPosPixel().X();*/
+ nMinHeight=0;
+
+ break;
+
+ case SFX_ALIGN_NOALIGNMENT:
+
+ aString = aCatBox.GetEntry(0);
+ aString.AppendAscii(RTL_CONSTASCII_STRINGPARAM("www"));
+ aTxtSize = Size( aFiFuncDesc.GetTextWidth(aString),
+ aFiFuncDesc.GetTextHeight() );
+
+ default: Point aTopLeft=aCatBox.GetPosPixel();
+ nMinWidth=aTxtSize.Width()+aTopLeft.X()
+ +2*aFuncList.GetPosPixel().X();
+ nMinHeight=19*aTxtSize.Height();
+ //aCatBox.SelectEntryPos(0);
+
+ break;
+ }
+
+ return aChildAlign;
+}
+/*************************************************************************
+#* Member: Close Datum:07.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: ScFunctionDockWin
+#*
+#* Funktion: Aenderungen erkennen
+#*
+#* Input: ---
+#*
+#* Output: TRUE
+#*
+#************************************************************************/
+void ScFunctionDockWin::Notify( SfxBroadcaster&, const SfxHint& /* rHint */ )
+{
+// const SfxPoolItemHint *pPoolItemHint = PTR_CAST(SfxPoolItemHint, &rHint);
+ /*
+ if ( pPoolItemHint
+ && ( pPoolItemHint->GetObject()->ISA( SvxColorTableItem ) ) )
+ {
+ // Die Liste der Farben hat sich geaendert
+ pColorTable = ( (SvxColorTableItem*) pPoolItemHint->GetObject() )->GetColorTable();
+ FillValueSet();
+ }
+ */
+}
+
+
+/*************************************************************************
+#* Member: Resize Datum:06.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: ScFunctionDockWin
+#*
+#* Funktion: Ueberladene Funktion um die Groesse der
+#* einzelnen Controls einzustellen.
+#*
+#* Input: neue Groesse
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+void __EXPORT ScFunctionDockWin::Resize()
+{
+ if ( !IsFloatingMode() ||
+ !GetFloatingWindow()->IsRollUp() )
+ {
+ Size aQSize=GetOutputSizePixel();
+ Resizing( aQSize);
+ SetSize();
+ }
+ SfxDockingWindow::Resize();
+}
+
+/*************************************************************************
+#* Member: UpdateFunctionList Datum:06.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: ScFunctionDockWin
+#*
+#* Funktion: Aktualisiert die Liste der Funktionen ab-
+#* haengig von der eingestellten Kategorie.
+#*
+#* Input: ---
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+void ScFunctionDockWin::UpdateFunctionList()
+{
+ USHORT nSelPos = aCatBox.GetSelectEntryPos();
+ USHORT nCategory = ( LISTBOX_ENTRY_NOTFOUND != nSelPos )
+ ? (nSelPos-1) : 0;
+
+ pAllFuncList->Clear();
+ pAllFuncList->SetUpdateMode( FALSE );
+
+ if ( nSelPos > 0 )
+ {
+ ScFunctionMgr* pFuncMgr = ScGlobal::GetStarCalcFunctionMgr();
+
+ const ScFuncDesc* pDesc = pFuncMgr->First( nCategory );
+ while ( pDesc )
+ {
+ pAllFuncList->SetEntryData(
+ pAllFuncList->InsertEntry( *(pDesc->pFuncName) ),
+ (void*)pDesc );
+ pDesc = pFuncMgr->Next();
+ }
+ }
+ else // LRU-Liste
+ {
+ for ( USHORT i=0; i<LRU_MAX && aLRUList[i]; i++ )
+ {
+ const ScFuncDesc* pDesc = aLRUList[i];
+ pAllFuncList->SetEntryData(
+ pAllFuncList->InsertEntry( *(pDesc->pFuncName) ),
+ (void*)pDesc );
+ }
+ }
+
+
+ //------------------------------------------------------
+ pAllFuncList->SetUpdateMode( TRUE );
+
+ if ( pAllFuncList->GetEntryCount() > 0 )
+ {
+ pAllFuncList->Enable();
+ pAllFuncList->SelectEntryPos( 0 );
+ }
+ else
+ {
+ pAllFuncList->Disable();
+ }
+}
+
+/*************************************************************************
+#* Member: DoEnter Datum:06.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: ScFunctionDockWin
+#*
+#* Funktion: Eingabe ins Dokument uebernehmen. Wird aufgerufen
+#* nach betaetigen der Uebernehmen- Schaltflaeche
+#* oder einem Doppelklick in die Funktionsliste.
+#*
+#* Input: ---
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+void ScFunctionDockWin::DoEnter(BOOL /* bOk */) //@@ ???
+{
+ String aFirstArgStr;
+ String aParaStr;
+ String aArgStr;
+ String aString=pAllFuncList->GetSelectEntry();
+ SfxViewShell* pCurSh = SfxViewShell::Current();
+ nArgs=0;
+
+ if(aString.Len()>0)
+ {
+
+ ScModule* pScMod = SC_MOD();
+ ScTabViewShell* pViewSh = PTR_CAST( ScTabViewShell, pCurSh);
+ ScInputHandler* pHdl = pScMod->GetInputHdl( pViewSh );
+ if(!pScMod->IsEditMode())
+ {
+ pScMod->SetInputMode(SC_INPUT_TABLE);
+ aString = '=';
+ aString += pAllFuncList->GetSelectEntry();
+ if (pHdl)
+ pHdl->ClearText();
+ }
+ const ScFuncDesc* pDesc =
+ (const ScFuncDesc*)pAllFuncList->GetEntryData(
+ pAllFuncList->GetSelectEntryPos() );
+ if (pDesc)
+ {
+ pFuncDesc=pDesc;
+ UpdateLRUList();
+ nArgs = pDesc->nArgCount;
+ if(nArgs>0)
+ {
+ // NOTE: Theoretically the first parameter could have the
+ // suppress flag as well, but practically it doesn't.
+ aFirstArgStr = *(pDesc->ppDefArgNames[0]);
+ aFirstArgStr.EraseLeadingAndTrailingChars();
+ aFirstArgStr.SearchAndReplaceAll(' ', '_');
+ aArgStr = aFirstArgStr;
+ if ( nArgs != VAR_ARGS )
+ { // no VarArgs or Fix plus VarArgs, but not VarArgs only
+ String aArgSep = String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM( "; " ));
+ USHORT nFix = ( nArgs < VAR_ARGS ? nArgs : nArgs - VAR_ARGS + 1 );
+ for ( USHORT nArg = 1;
+ nArg < nFix && !pDesc->pDefArgFlags[nArg].bOptional; nArg++ )
+ {
+ if (!pDesc->pDefArgFlags[nArg].bSuppress)
+ {
+ aArgStr += aArgSep;
+ String sTmp(*(pDesc->ppDefArgNames[nArg]));
+ sTmp.EraseLeadingAndTrailingChars();
+ sTmp.SearchAndReplaceAll(' ', '_');
+ aArgStr += sTmp;
+ }
+ }
+ }
+ }
+ }
+ if (pHdl)
+ {
+ if(pHdl->GetEditString().Len()==0)
+ {
+ aString = '=';
+ aString += pAllFuncList->GetSelectEntry();
+ }
+ EditView *pEdView=pHdl->GetActiveView();
+ if(pEdView!=NULL) // @ Wegen Absturz bei Namen festlegen
+ {
+ if(nArgs>0)
+ {
+ pHdl->InsertFunction(aString);
+ pEdView->InsertText(aArgStr,TRUE);
+ ESelection aESel=pEdView->GetSelection();
+ aESel.nEndPos=aESel.nStartPos+aFirstArgStr.Len();
+ pEdView->SetSelection(aESel);
+ pHdl->DataChanged();
+ }
+ else
+ {
+ aString.AppendAscii(RTL_CONSTASCII_STRINGPARAM( "()" ));
+ pEdView->InsertText(aString,FALSE);
+ pHdl->DataChanged();
+ }
+ }
+ }
+ InitLRUList();
+ }
+ if ( pCurSh )
+ {
+ Window* pShellWnd = pCurSh->GetWindow();
+
+ if ( pShellWnd )
+ pShellWnd->GrabFocus();
+ }
+
+
+}
+
+
+
+/*************************************************************************
+#* Handle: SelHdl Datum:06.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: ScFunctionDockWin
+#*
+#* Funktion: Bei einer Aenderung der Kategorie wird die
+#* die Liste der Funktionen aktualisiert.
+#*
+#* Input: ---
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+IMPL_LINK( ScFunctionDockWin, SelHdl, ListBox*, pLb )
+{
+ if ( pLb == &aCatBox)
+ {
+ UpdateFunctionList();
+ SetDescription();
+ }
+
+ if ( pLb == &aFuncList||pLb == &aDDFuncList)
+ {
+ SetDescription();
+ }
+
+
+ //SetSize();
+ return 0;
+}
+
+/*************************************************************************
+#* Handle: SelHdl Datum:06.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: ScFunctionDockWin
+#*
+#* Funktion: Bei einer Aenderung der Kategorie wird die
+#* die Liste der Funktionen aktualisiert.
+#*
+#* Input: ---
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+IMPL_LINK( ScFunctionDockWin, SetSelectionHdl, void*, pCtrl )
+{
+ if ((ImageButton *)pCtrl == &aInsertButton ||
+ (ListBox *)pCtrl == &aFuncList)
+ {
+ DoEnter(TRUE); // Uebernimmt die Eingabe
+ }
+ //...
+
+ return 0;
+}
+
+/*************************************************************************
+#* Handle: SetSplitHdl Datum:13.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: ScFunctionDockWin
+#*
+#* Funktion: Bei einer Aenderung des Split- Controls werden die
+#* einzelnen Controls an die neue Groesse angepasst.
+#*
+#* Input: Zeiger auf Control
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+IMPL_LINK( ScFunctionDockWin, SetSplitHdl, ScPrivatSplit*, pCtrl )
+{
+ if (pCtrl == &aPrivatSplit)
+ {
+ 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);
+ /*
+ aFuncList.Invalidate();
+ aFuncList.Update();
+ aFiFuncDesc.Invalidate();
+ aFiFuncDesc.Update();
+ */
+ }
+ //...
+
+ return 0;
+}
+
+void ScFunctionDockWin::ToggleFloatingMode()
+{
+ aSplitterInitPos = Point();
+ SfxDockingWindow::ToggleFloatingMode();
+
+ eSfxNewAlignment=GetAlignment();
+ eSfxOldAlignment=eSfxNewAlignment;
+
+ aOldSize.Height()=0;
+ aOldSize.Width()=0;
+ aTimer.Start();
+}
+
+IMPL_LINK( ScFunctionDockWin, TimerHdl, Timer*, EMPTYARG )
+{
+ CheckAlignment(eSfxOldAlignment,eSfxNewAlignment);
+ SetSize();
+ return 0;
+}
+
+void ScFunctionDockWin::Initialize(SfxChildWinInfo *pInfo)
+{
+ String aStr;
+ if(pInfo!=NULL)
+ {
+ if ( pInfo->aExtraString.Len() )
+ {
+ xub_StrLen nPos = pInfo->aExtraString.Search(
+ String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("ScFuncList:")));
+
+ // Versuche, den Alignment-String "ALIGN:(...)" einzulesen; wenn
+ // er nicht vorhanden ist, liegt eine "altere Version vor
+ if ( nPos != STRING_NOTFOUND )
+ {
+ xub_StrLen n1 = pInfo->aExtraString.Search('(', nPos);
+ if ( n1 != STRING_NOTFOUND )
+ {
+ xub_StrLen n2 = pInfo->aExtraString.Search(')', n1);
+ if ( n2 != STRING_NOTFOUND )
+ {
+ // Alignment-String herausschneiden
+ aStr = pInfo->aExtraString.Copy(nPos, n2 - nPos + 1);
+ pInfo->aExtraString.Erase(nPos, n2 - nPos + 1);
+ aStr.Erase(0, n1-nPos+1);
+ }
+ }
+ }
+ }
+ }
+ SfxDockingWindow::Initialize(pInfo);
+
+ if ( aStr.Len())
+ {
+ aSplitterInitPos=aPrivatSplit.GetPosPixel();
+ aSplitterInitPos.Y()=(USHORT) aStr.ToInt32();
+ xub_StrLen n1 = aStr.Search(';');
+ aStr.Erase(0, n1+1);
+ USHORT nSelPos=sal::static_int_cast<USHORT>( aStr.ToInt32() );
+ aCatBox.SelectEntryPos(nSelPos);
+ SelHdl(&aCatBox);
+
+ // if the window has already been shown (from SfxDockingWindow::Initialize if docked),
+ // set the splitter position now, otherwise it is set in StateChanged with type INITSHOW
+
+ UseSplitterInitPos();
+ }
+}
+
+//-------------------------------------------------------------------------
+
+void ScFunctionDockWin::FillInfo(SfxChildWinInfo& rInfo) const
+{
+ SfxDockingWindow::FillInfo(rInfo);
+ Point aPoint=aPrivatSplit.GetPosPixel();
+ rInfo.aExtraString.AppendAscii(RTL_CONSTASCII_STRINGPARAM( "ScFuncList:(" ));
+ rInfo.aExtraString += String::CreateFromInt32(aPoint.Y());
+ rInfo.aExtraString += ';';
+ rInfo.aExtraString += String::CreateFromInt32(aCatBox.GetSelectEntryPos());
+ rInfo.aExtraString += ')';
+}
+
+void ScFunctionDockWin::UseSplitterInitPos()
+{
+ if ( IsVisible() && aPrivatSplit.IsEnabled() && aSplitterInitPos != Point() )
+ {
+ aPrivatSplit.MoveSplitTo(aSplitterInitPos);
+ aSplitterInitPos = Point(); // use only once
+ }
+}
+
+void ScFunctionDockWin::StateChanged( StateChangedType nStateChange )
+{
+ SfxDockingWindow::StateChanged( nStateChange );
+
+ if (nStateChange == STATE_CHANGE_INITSHOW)
+ {
+ UseSplitterInitPos(); // set initial splitter position if necessary
+ }
+}
+
+
diff --git a/sc/source/ui/formdlg/formdata.cxx b/sc/source/ui/formdlg/formdata.cxx
index 1a7338986538..e9d4a293888d 100644
--- a/sc/source/ui/formdlg/formdata.cxx
+++ b/sc/source/ui/formdlg/formdata.cxx
@@ -38,53 +38,20 @@
//============================================================================
-ScFormEditData::ScFormEditData()
+ScFormEditData::ScFormEditData() : formula::FormEditData()
{
Reset();
}
ScFormEditData::~ScFormEditData()
{
- delete pParent;
}
-ScFormEditData::ScFormEditData( const ScFormEditData& r )
+ScFormEditData::ScFormEditData( const ScFormEditData& r ) : formula::FormEditData(r)
{
*this = r;
}
-
-void ScFormEditData::Reset()
-{
- pParent = NULL;
- nMode = 0;
- nFStart = 0;
- nCatSel = 1; //! oder 0 (zuletzt benutzte)
- nFuncSel = 0;
- nOffset = 0;
- nEdFocus = 0;
- bMatrix =FALSE;
- nUniqueId=0;
- aSelection.Min()=0;
- aSelection.Max()=0;
- aUndoStr.Erase();
-}
-
-const ScFormEditData& ScFormEditData::operator=( const ScFormEditData& r )
-{
- pParent = r.pParent;
- nMode = r.nMode;
- nFStart = r.nFStart;
- nCatSel = r.nCatSel;
- nFuncSel = r.nFuncSel;
- nOffset = r.nOffset;
- nEdFocus = r.nEdFocus;
- aUndoStr = r.aUndoStr;
- bMatrix = r.bMatrix ;
- nUniqueId = r.nUniqueId;
- aSelection = r.aSelection;
- return *this;
-}
-
+// -----------------------------------------------------------------------------
void ScFormEditData::SaveValues()
{
ScFormEditData* pTemp = new ScFormEditData(*this);
diff --git a/sc/source/ui/formdlg/formdlgs.hrc b/sc/source/ui/formdlg/formdlgs.hrc
deleted file mode 100644
index 8c554c3b0870..000000000000
--- a/sc/source/ui/formdlg/formdlgs.hrc
+++ /dev/null
@@ -1,87 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: formdlgs.hrc,v $
- * $Revision: 1.4 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "sc.hrc" // -> RID_SCDLG_FORMULA
-
-
-
-#define FT_RESULT 1
-#define WND_RESULT 2
-#define FT_EDITNAME 3
-#define STR_TITLE1 4
-#define STR_TITLE2 5
-#define BTN_HELP 6
-#define BTN_CANCEL 7
-#define BTN_BACKWARD 8
-#define BTN_FORWARD 9
-#define BTN_END 10
-#define BTN_MATRIX 11
-#define FT_FUNCNAME 12
-#define FT_FUNCDESC 13
-#define FT_HEADLINE 14
-#define GB_EDIT 15
-#define FT_FORMULA 16
-#define ED_FORMULA 17
-#define TC_FUNCTION 18
-#define ED_REF 19
-#define RB_REF 20
-#define FT_FORMULA_RESULT 21
-#define WND_FORMULA_RESULT 22
-// Fuer Tabpage
-#define TP_FUNCTION 1
-#define TP_STRUCT 2
-
-// Funktions-Tabpage
-#define FT_FUNCTION 1
-#define FT_CATEGORY 2
-#define LB_CATEGORY 3
-#define LB_FUNCTION 4
-#define IB_FUNCTION 5
-
-
-// Struktur-Tabpage
-#define FT_STRUCT 1
-#define TLB_STRUCT 2
-
-// Bitmaps
-#define BMP_STR_CLOSE 1
-#define BMP_STR_OPEN 2
-#define BMP_STR_END 3
-#define BMP_STR_ERROR 4
-#define BMP_STR_CLOSE_H 11
-#define BMP_STR_OPEN_H 12
-#define BMP_STR_END_H 13
-#define BMP_STR_ERROR_H 14
-
-// Texte
-#define STR_STRUCT_ERR1 1
-#define STR_STRUCT_ERR2 2
-
-
diff --git a/sc/source/ui/formdlg/formdlgs.src b/sc/source/ui/formdlg/formdlgs.src
index 4d730e42e8d5..2e9ceb6b1dd3 100644
--- a/sc/source/ui/formdlg/formdlgs.src
+++ b/sc/source/ui/formdlg/formdlgs.src
@@ -1,354 +1,32 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: formdlgs.src,v $
- * $Revision: 1.49 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "formdlgs.hrc"
- //---------------------------------------------------------------------------
-TabPage RID_SCTAB_FUNCTION
-{
- Hide = TRUE ;
- Size = MAP_APPFONT ( 96 , 180 ) ;
- // Titel wird dynamisch gesetzt (s.u.)
- // 1. Seite
- ImageButton IB_FUNCTION
- {
- Hide = TRUE ;
- //@new
- Pos = MAP_APPFONT ( 81 , 29 ) ;
- Size = MAP_APPFONT ( 13 , 13 ) ;
- TabStop = TRUE ;
- ButtonImage = Image
- {
- ImageBitmap = Bitmap
- {
- File = "sc06300.bmp" ;
- };
- };
- QuickHelpText [ en-US ] = "Apply Function" ;
- };
- ListBox LB_CATEGORY
- {
- Border = TRUE ;
- Pos = MAP_APPFONT ( 6 , 14 ) ;
- Size = MAP_APPFONT ( 86 , 112 ) ;
- DropDown = TRUE ;
- StringList [ en-US ] =
- {
- < "Last Used" ; Default ; > ;
- < "All" ; Default ; > ;
- < "Database" ; Default ; > ;
- < "Date&Time" ; Default ; > ;
- < "Financial" ; Default ; > ;
- < "Information" ; Default ; > ;
- < "Logical" ; Default ; > ;
- < "Mathematical" ; Default ; > ;
- < "Array" ; Default ; > ;
- < "Statistical" ; Default ; > ;
- < "Spreadsheet" ; Default ; > ;
- < "Text" ; Default ; > ;
- < "Add-in" ; Default ; > ;
- };
- };
- ListBox LB_FUNCTION
- {
- Border = TRUE ;
- Pos = MAP_APPFONT ( 6 , 43 ) ;
- Size = MAP_APPFONT ( 86 , 133 ) ;
- // Sort = TRUE;
- };
- FixedText FT_CATEGORY
- {
- Pos = MAP_APPFONT ( 6 , 3 ) ;
- Size = MAP_APPFONT ( 84 , 8 ) ;
- Text [ en-US ] = "~Category" ;
- };
- FixedText FT_FUNCTION
- {
- Pos = MAP_APPFONT ( 6 , 32 ) ;
- Size = MAP_APPFONT ( 72 , 8 ) ;
- Text [ en-US ] = "~Function" ;
- };
-};
-TabPage RID_SCTAB_STRUCT
-{
- Hide = TRUE ;
- Size = MAP_APPFONT ( 96 , 180 ) ;
- // Titel wird dynamisch gesetzt (s.u.)
- // 1. Seite
- Control TLB_STRUCT
- {
- Border = TRUE ;
- TabStop = TRUE ;
- Pos = MAP_APPFONT ( 6 , 14 ) ;
- Size = MAP_APPFONT ( 86 , 162 ) ;
- HelpId = HID_SC_FAP_STRUCT ;
- };
- FixedText FT_STRUCT
- {
- Pos = MAP_APPFONT ( 6 , 3 ) ;
- Size = MAP_APPFONT ( 86 , 8 ) ;
- Text [ en-US ] = "~Structure" ;
- };
- Image BMP_STR_CLOSE
- {
- ImageBitmap = Bitmap { File = "fapclose.bmp"; };
- MaskColor = SC_HC_MASKCOLOR;
- };
- Image BMP_STR_CLOSE_H
- {
- ImageBitmap = Bitmap { File = "fapclose_h.bmp"; };
- MaskColor = SC_HC_MASKCOLOR;
- };
- Image BMP_STR_OPEN
- {
- ImageBitmap = Bitmap { File = "fapopen.bmp"; };
- MaskColor = SC_HC_MASKCOLOR;
- };
- Image BMP_STR_OPEN_H
- {
- ImageBitmap = Bitmap { File = "fapopen_h.bmp"; };
- MaskColor = SC_HC_MASKCOLOR;
- };
- Image BMP_STR_END
- {
- ImageBitmap = Bitmap { File = "fapok.bmp"; };
- MaskColor = SC_HC_MASKCOLOR;
- };
- Image BMP_STR_END_H
- {
- ImageBitmap = Bitmap { File = "fapok_h.bmp"; };
- MaskColor = SC_HC_MASKCOLOR;
- };
- Image BMP_STR_ERROR
- {
- ImageBitmap = Bitmap { File = "faperror.bmp"; };
- MaskColor = SC_HC_MASKCOLOR;
- };
- Image BMP_STR_ERROR_H
- {
- ImageBitmap = Bitmap { File = "faperror_h.bmp"; };
- MaskColor = SC_HC_MASKCOLOR;
- };
- String STR_STRUCT_ERR1
- {
- Text [ en-US ] = "=?" ;
- };
- String STR_STRUCT_ERR2
- {
- Text [ en-US ] = "Error" ;
- };
-};
-ModelessDialog RID_SCDLG_FORMULA
-{
- OutputSize = TRUE ;
- Hide = TRUE ;
- SVLook = TRUE ;
- Size = MAP_APPFONT ( 321 , 228 ) ;
- HelpId = HID_SCDLG_FORMULA ;
- Moveable = TRUE ;
- // Titel wird dynamisch gesetzt (s.u.)
- TabControl TC_FUNCTION
- {
- Pos = MAP_APPFONT ( 6 , 5 ) ;
- Size = MAP_APPFONT ( 102 , 199 ) ;
- PageList =
- {
- PageItem
- {
- Identifier = TP_FUNCTION ;
- Text [ en-US ] = "Functions" ;
- };
- PageItem
- {
- Identifier = TP_STRUCT ;
- Text [ en-US ] = "Structure" ;
- };
- };
- };
- FixedText FT_HEADLINE
- {
- Pos = MAP_APPFONT ( 115 , 24 ) ;
- Size = MAP_APPFONT ( 194 , 8 ) ;
- WordBreak = TRUE ;
- };
- FixedText FT_FUNCNAME
- {
- Pos = MAP_APPFONT ( 115 , 38 ) ;
- Size = MAP_APPFONT ( 194 , 24 ) ;
- WordBreak = TRUE ;
- };
- FixedText FT_FUNCDESC
- {
- Pos = MAP_APPFONT ( 115 , 68 ) ;
- Size = MAP_APPFONT ( 194 , 64 ) ;
- WordBreak = TRUE ;
- };
- // 2. Seite
- FixedText FT_EDITNAME
- {
- Pos = MAP_APPFONT ( 113 , 6 ) ;
- Size = MAP_APPFONT ( 83 , 10 ) ;
- };
- GroupBox GB_EDIT
- {
- Pos = MAP_APPFONT ( 112 , 18 ) ;
- Size = MAP_APPFONT ( 203 , 128 ) ;
- };
- FixedText FT_FORMULA
- {
- Pos = MAP_APPFONT ( 112 , 151 ) ;
- Size = MAP_APPFONT ( 50 , 10 ) ;
- WordBreak = TRUE ;
- Text [ en-US ] = "For~mula" ;
- };
- Control ED_FORMULA
- {
- Border = TRUE ;
- Pos = MAP_APPFONT ( 112 , 161 ) ;
- Size = MAP_APPFONT ( 203 , 43 ) ;
- //TabStop = TRUE ;
- HelpId = HID_SC_FAP_FORMULA ;
- };
- FixedText FT_RESULT
- {
- Pos = MAP_APPFONT ( 198 , 6 ) ;
- Size = MAP_APPFONT ( 55 , 10 ) ;
- Right = TRUE ;
- Text [ en-US ] = "Function result" ;
- };
- Window WND_RESULT
- {
- Border = TRUE ;
- Pos = MAP_APPFONT ( 255 , 4 ) ;
- Size = MAP_APPFONT ( 60 , 12 ) ;
- };
- FixedText FT_FORMULA_RESULT
- {
- Pos = MAP_APPFONT ( 217 , 149 ) ;
- Size = MAP_APPFONT ( 35 , 10 ) ;
- Text [ en-US ] = "Result" ;
- Right = TRUE ;
- };
- Window WND_FORMULA_RESULT
- {
- Border = TRUE ;
- Pos = MAP_APPFONT ( 255 , 147 ) ;
- Size = MAP_APPFONT ( 60 , 12 ) ;
- };
- // gemeinsam
- CheckBox BTN_MATRIX
- {
- Pos = MAP_APPFONT ( 6 , 208 ) ;
- Size = MAP_APPFONT ( 50 , 10 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "Array" ;
- };
- Edit ED_REF
- {
- Border = TRUE ;
- Pos = MAP_APPFONT ( 76 , 205 ) ;
- Size = MAP_APPFONT ( 66 , 12 ) ;
- };
- ImageButton RB_REF
- {
- Pos = MAP_APPFONT ( 144 , 205 ) ;
- Size = MAP_APPFONT ( 13 , 15 ) ;
- TabStop = FALSE ;
- QuickHelpText [ en-US ] = "Maximize" ;
- };
- //
- HelpButton BTN_HELP
- {
- Pos = MAP_APPFONT ( 72 , 208 ) ;
- Size = MAP_APPFONT ( 45 , 14 ) ;
- TabStop = TRUE ;
- };
- CancelButton BTN_CANCEL
- {
- Pos = MAP_APPFONT ( 121 , 208 ) ;
- Size = MAP_APPFONT ( 45 , 14 ) ;
- TabStop = TRUE ;
- };
- PushButton BTN_BACKWARD
- {
- // Disable = FALSE ;
- Pos = MAP_APPFONT ( 171 , 208 ) ;
- Size = MAP_APPFONT ( 45 , 14 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "<< ~Back" ;
- };
- PushButton BTN_FORWARD
- {
- Pos = MAP_APPFONT ( 219 , 208 ) ;
- Size = MAP_APPFONT ( 45 , 14 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "~Next >>" ;
- };
- OKButton BTN_END
- {
- Pos = MAP_APPFONT ( 270 , 208 ) ;
- Size = MAP_APPFONT ( 45 , 14 ) ;
- TabStop = TRUE ;
- DefButton = TRUE ;
- };
- //
- String STR_TITLE1
- {
- Text [ en-US ] = "Function Wizard" ;
- };
- String STR_TITLE2
- {
- Text [ en-US ] = "Function Wizard -" ;
- };
-};
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: formdlgs.src,v $
+ * $Revision: 1.49 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "sc.hrc"
+ //---------------------------------------------------------------------------
diff --git a/sc/source/ui/formdlg/formula.cxx b/sc/source/ui/formdlg/formula.cxx
index 8b13021c7262..a244704b76af 100644
--- a/sc/source/ui/formdlg/formula.cxx
+++ b/sc/source/ui/formdlg/formula.cxx
@@ -40,16 +40,19 @@
#include <sfx2/docfile.hxx>
#include <sfx2/objsh.hxx>
#include <svtools/zforlist.hxx>
+#include <svtools/stritem.hxx>
+#include <svtools/svtreebx.hxx>
#include <sfx2/viewfrm.hxx>
#include <sfx2/topfrm.hxx>
#include <vcl/svapp.hxx>
#include <vcl/mnemonic.hxx>
#include <unotools/charclass.hxx>
-#include <svtools/stritem.hxx>
#include <tools/urlobj.hxx>
+#include <formula/formulahelper.hxx>
+#include <formula/IFunctionDescription.hxx>
+#include "tokenuno.hxx"
#include "formula.hxx"
-#include "formdlgs.hrc"
#include "formdata.hxx"
#include "globstr.hrc"
#include "scresid.hxx"
@@ -62,185 +65,87 @@
#include "appoptio.hxx"
#include "docsh.hxx"
#include "funcdesc.hxx"
+#include "formula/token.hxx"
+#include "tokenarray.hxx"
+#include "sc.hrc"
+#include "servuno.hxx"
+#include "unonames.hxx"
+
+#include <com/sun/star/table/CellAddress.hpp>
//============================================================================
+using namespace formula;
+using namespace com::sun::star;
ScDocument* ScFormulaDlg::pDoc = NULL;
ScAddress ScFormulaDlg::aCursorPos;
-inline void ShowHide( Window& rWin, BOOL bShow )
-{
- if (bShow)
- rWin.Show();
- else
- rWin.Hide();
-}
-
// --------------------------------------------------------------------------
// Initialisierung / gemeinsame Funktionen fuer Dialog
// --------------------------------------------------------------------------
ScFormulaDlg::ScFormulaDlg( SfxBindings* pB, SfxChildWindow* pCW,
- Window* pParent, ScViewData* pViewData ) :
- ScAnyRefDlg ( pB, pCW, pParent, RID_SCDLG_FORMULA ),
- //
- aTabCtrl ( this, ScResId( TC_FUNCTION ) ),
- aGbEdit ( this, ScResId( GB_EDIT ) ),
- aScParaWin ( this, aGbEdit.GetPosPixel()),
- aFtHeadLine ( this, ScResId( FT_HEADLINE ) ),
- aFtFuncName ( this, ScResId( FT_FUNCNAME ) ),
- aFtFuncDesc ( this, ScResId( FT_FUNCDESC ) ),
- //
- aFtEditName ( this, ScResId( FT_EDITNAME ) ),
- aFtResult ( this, ScResId( FT_RESULT ) ),
- aWndResult ( this, ScResId( WND_RESULT ) ),
-
- aFtFormula ( this, ScResId( FT_FORMULA ) ),
- aMEFormula ( this, ScResId( ED_FORMULA ) ),
- //
- aBtnMatrix ( this, ScResId( BTN_MATRIX ) ),
- aBtnHelp ( this, ScResId( BTN_HELP ) ),
- aBtnCancel ( this, ScResId( BTN_CANCEL ) ),
- aBtnBackward ( this, ScResId( BTN_BACKWARD ) ),
- aBtnForward ( this, ScResId( BTN_FORWARD ) ),
- aBtnEnd ( this, ScResId( BTN_END ) ),
- aEdRef ( this, ScResId( ED_REF) ),
- aRefBtn ( this, ScResId( RB_REF),&aEdRef ),
- aFtFormResult ( this, ScResId( FT_FORMULA_RESULT)),
- aWndFormResult ( this, ScResId( WND_FORMULA_RESULT)),
- //
- pTheRefEdit (NULL),
- pScTokA (NULL),
- pMEdit (NULL),
- bUserMatrixFlag (FALSE),
- //
- aTitle1 ( ScResId( STR_TITLE1 ) ), // lokale Resource
- aTitle2 ( ScResId( STR_TITLE2 ) ), // lokale Resource
- aTxtEnd ( ScResId( SCSTR_END ) ), // globale Resource
- aTxtOk ( aBtnEnd.GetText() ),
- //
- nActivWinId (0),
- bIsShutDown (FALSE),
- nEdFocus (0),
- pFuncDesc (NULL),
- nArgs (0),
- pArgArr (NULL)
+ Window* pParent, ScViewData* pViewData,formula::IFunctionManager* _pFunctionMgr )
+ : formula::FormulaDlg( pB, pCW, pParent, true,true,true,this, _pFunctionMgr,this)
+ , m_aHelper(this,pB)
{
- FreeResource();
- SetText(aTitle1);
-
- aEdRef.Hide();
- aRefBtn.Hide();
-
- pMEdit=aMEFormula.GetEdit();
- bEditFlag=FALSE;
- bStructUpdate=TRUE;
- Point aPos=aGbEdit.GetPosPixel();
- aScParaWin.SetPosPixel(aPos);
- aScParaWin.SetArgModifiedHdl(LINK( this, ScFormulaDlg, ModifyHdl ) );
- aScParaWin.SetFxHdl(LINK( this, ScFormulaDlg, FxHdl ) );
-
- pScFuncPage= new ScFuncPage( &aTabCtrl);
- pScStructPage= new ScStructPage( &aTabCtrl);
- pScFuncPage->Hide();
- pScStructPage->Hide();
- aTabCtrl.SetTabPage( TP_FUNCTION, pScFuncPage);
- aTabCtrl.SetTabPage( TP_STRUCT, pScStructPage);
-
- nOldHelp = GetHelpId(); // HelpId aus Resource immer fuer "Seite 1"
- nOldUnique = GetUniqueId();
-
- aBtnMatrix.SetClickHdl(LINK( this, ScFormulaDlg, MatrixHdl ) );
- aBtnCancel .SetClickHdl( LINK( this, ScFormulaDlg, BtnHdl ) );
- aBtnEnd .SetClickHdl( LINK( this, ScFormulaDlg, BtnHdl ) );
- aBtnForward .SetClickHdl( LINK( this, ScFormulaDlg, BtnHdl ) );
- aBtnBackward.SetClickHdl( LINK( this, ScFormulaDlg, BtnHdl ) );
-
- pScFuncPage->SetDoubleClickHdl( LINK( this, ScFormulaDlg, DblClkHdl ) );
- pScFuncPage->SetSelectHdl( LINK( this, ScFormulaDlg, FuncSelHdl) );
- pScStructPage->SetSelectionHdl( LINK( this, ScFormulaDlg, StructSelHdl ) );
- pMEdit->SetModifyHdl( LINK( this, ScFormulaDlg, FormulaHdl ) );
- aMEFormula .SetSelChangedHdl( LINK( this, ScFormulaDlg, FormulaCursorHdl ) );
-
- aFntLight = aFtFormula.GetFont();
- aFntLight.SetTransparent( TRUE );
- aFntBold = aFntLight;
- aFntBold.SetWeight( WEIGHT_BOLD );
-
- aScParaWin.SetArgumentFonts(aFntBold,aFntLight);
-
- // function description for choosing a function is no longer in a different color
-
- aFtHeadLine.SetFont(aFntBold);
- aFtFuncName.SetFont(aFntLight);
- aFtFuncDesc.SetFont(aFntLight);
-
+ m_aHelper.SetWindow(this);
ScModule* pScMod = SC_MOD();
+ pScMod->InputEnterHandler();
+ ScTabViewShell* pScViewShell = NULL;
- ScInputHandler* pInputHdl = pScMod->GetInputHdl();
- if ( pInputHdl )
- pInputHdl->NotifyChange( NULL );
-
+ // title has to be from the view that opened the dialog,
+ // even if it's not the current view
- ScFormEditData* pData = pScMod->GetFormEditData();
- String rStrExp;
- if (pData)
+ SfxObjectShell* pParentDoc = NULL;
+ if ( pB )
{
- // Daten schon vorhanden -> Zustand wiederherstellen (nach Umschalten)
- // pDoc und aCursorPos nicht neu initialisieren
- //pDoc = pViewData->GetDocument();
- if(IsInputHdl(pData->GetInputHandler()))
- {
- pScMod->SetRefInputHdl(pData->GetInputHandler());
- }
- else
+ SfxDispatcher* pMyDisp = pB->GetDispatcher();
+ if (pMyDisp)
{
- PtrTabViewShell pTabViewShell;
- pInputHdl=GetNextInputHandler(pData->GetDocShell(),&pTabViewShell);
-
- if(pInputHdl==NULL) //DocShell hat keinen InputHandler mehr,
- { //hat der Anwender halt Pech gehabt.
- aBtnEnd.Disable();
- pInputHdl=pScMod->GetInputHdl();
- }
- else
+ SfxViewFrame* pMyViewFrm = pMyDisp->GetFrame();
+ if (pMyViewFrm)
{
- pInputHdl->SetRefViewShell(pTabViewShell);
+ pScViewShell = PTR_CAST( ScTabViewShell, pMyViewFrm->GetViewShell() );
+ if( pScViewShell )
+ pScViewShell->UpdateInputHandler(TRUE);
+ pParentDoc = pMyViewFrm->GetObjectShell();
}
- pScMod->SetRefInputHdl(pInputHdl);
- pData->SetInputHandler(pInputHdl);
}
+ }
+ //if ( !pParentDoc && pScViewShell ) // use current only if above fails
+ // pParentDoc = pScViewShell->GetObjectShell();
+ //if ( pParentDoc )
+ // aDocName = pParentDoc->GetTitle();
- String aOldFormulaTmp(pScMod->InputGetFormulaStr());
- pScMod->InputSetSelection( 0, aOldFormulaTmp.Len());
+ if ( pDoc == NULL )
+ pDoc = pViewData->GetDocument();
+ m_xParser.set(ScServiceProvider::MakeInstance(SC_SERVICE_FORMULAPARS,(ScDocShell*)pDoc->GetDocumentShell()),uno::UNO_QUERY);
+ uno::Reference< beans::XPropertySet> xSet(m_xParser,uno::UNO_QUERY);
+ xSet->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_COMPILEFAP)),uno::makeAny(sal_True));
+ xSet->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_REFERENCEPOS)),uno::makeAny(table::CellAddress(aCursorPos.Tab(),aCursorPos.Col(),aCursorPos.Row())));
- rStrExp=pData->GetUndoStr();
- pScMod->InputReplaceSelection(rStrExp);
- pMEdit->SetText(rStrExp);
- pMEdit->SetSelection( pData->GetSelection());
- aMEFormula.UpdateOldSel();
+ m_xOpCodeMapper.set(ScServiceProvider::MakeInstance(SC_SERVICE_OPCODEMAPPER,(ScDocShell*)pDoc->GetDocumentShell()),uno::UNO_QUERY);
- pCell = new ScFormulaCell( pDoc, aCursorPos, rStrExp );
- pComp=new ScCompiler( pDoc, aCursorPos, pDoc->GetGrammar() );
- pComp->SetCompileForFAP(TRUE);
- UpdateTokenArray(pMEdit->GetText());
- FormulaCursorHdl(&aMEFormula);
- CalcStruct(rStrExp);
- if(pData->GetMode()==SC_FORMDLG_FORMULA)
- aTabCtrl.SetCurPageId(TP_FUNCTION);
- else
- aTabCtrl.SetCurPageId(TP_STRUCT);
- aBtnMatrix.Check(pData->GetMatrixFlag());
- aTimer.SetTimeout(200);
- aTimer.SetTimeoutHdl(LINK( this, ScFormulaDlg, UpdateFocusHdl));
- aTimer.Start();
+ ScInputHandler* pInputHdl = SC_MOD()->GetInputHdl(pScViewShell);
- // Jetzt nochmals zurueckschalten, da evtl. neues Doc geoeffnet wurde!
- pScMod->SetRefInputHdl(NULL);
- }
- else
+ DBG_ASSERT( pInputHdl, "Missing input handler :-/" );
+
+ if ( pInputHdl )
+ pInputHdl->NotifyChange( NULL );
+
+ m_aHelper.enableInput( FALSE );
+ m_aHelper.EnableSpreadsheets();
+ m_aHelper.Init();
+ m_aHelper.SetDispatcherLock( TRUE );
+
+ notifyChange();
+ fill();
+
+ ScFormEditData* pData = pScMod->GetFormEditData();
+ if (!pData)
{
//Nun wird es Zeit den Inputhandler festzulegen
pScMod->SetRefInputHdl(pScMod->GetInputHdl());
@@ -258,7 +163,7 @@ ScFormulaDlg::ScFormulaDlg( SfxBindings* pB, SfxChildWindow* pCW,
DBG_ASSERT(pData,"FormEditData ist nicht da");
- ScFormulaDlgMode eMode = SC_FORMDLG_FORMULA; // Default...
+ formula::FormulaDlgMode eMode = FORMULA_FORMDLG_FORMULA; // Default...
// Formel vorhanden? Dann editieren
@@ -268,56 +173,19 @@ ScFormulaDlg::ScFormulaDlg( SfxBindings* pB, SfxChildWindow* pCW,
BOOL bMatrix = FALSE;
if ( bEdit )
{
- pMEdit->GrabFocus();
- xub_StrLen nLen = aFormula.Len();
- bMatrix = nLen > 3 // Matrix-Formel ?
- && aFormula.GetChar(0) == '{'
- && aFormula.GetChar(1) == '='
- && aFormula.GetChar(nLen-1) == '}';
- if ( bMatrix )
- {
- aFormula.Erase( 0, 1 );
- aFormula.Erase( aFormula.Len()-1, 1);
- aBtnMatrix.Check( bMatrix );
- aBtnMatrix.Disable();
- }
-
- // #40892# auch Formeln mit Fehlern koennen editiert werden
- // (ob ueberhaupt gueltige Funktionen enthalten sind, wird bei
- // ScFormulaUtil::GetNextFunc getestet)
-#if 0
- // Test auf Fehler (ohne Interpretieren, also nur Compiler-Fehler)
- ScFormulaCell aCell( pDoc, aCursorPos, aFormula);
- BOOL bAutoCalc = pDoc->GetAutoCalc();
- pDoc->SetAutoCalc( FALSE ); // Interpretieren fuer GetErrCode abstellen
- USHORT nErrCode = aCell.GetErrCode();
- pDoc->SetAutoCalc( bAutoCalc );
- bEdit = ( nErrCode == 0 );
-#endif
- }
-
- if ( bEdit )
- {
- aTabCtrl.SetCurPageId(TP_STRUCT);
+ bMatrix = CheckMatrix(aFormula);
xub_StrLen nFStart = 0;
xub_StrLen nFEnd = 0;
- if ( ScFormulaUtil::GetNextFunc( aFormula, FALSE, nFStart, &nFEnd) )
+ if ( GetFormulaHelper().GetNextFunc( aFormula, FALSE, nFStart, &nFEnd) )
{
pScMod->InputReplaceSelection( aFormula );
pScMod->InputSetSelection( nFStart, nFEnd );
- if(!bEditFlag)
- pMEdit->SetText(pScMod->InputGetFormulaStr());
xub_StrLen PrivStart, PrivEnd;
pScMod->InputGetSelection( PrivStart, PrivEnd);
- pMEdit->SetSelection( Selection(PrivStart, PrivEnd));
- aMEFormula.UpdateOldSel();
- pMEdit->Invalidate();
- HighlightFunctionParas(pMEdit->GetSelected());
- eMode = SC_FORMDLG_EDIT;
-
- pData->SetFStart(nFStart );
- aBtnMatrix.Check( bMatrix );
+
+ eMode = SetMeText(pScMod->InputGetFormulaStr(),PrivStart, PrivEnd,bMatrix,TRUE,TRUE);
+ pData->SetFStart( nFStart );
}
else
bEdit = FALSE;
@@ -326,73 +194,98 @@ ScFormulaDlg::ScFormulaDlg( SfxBindings* pB, SfxChildWindow* pCW,
if ( !bEdit )
{
String aNewFormula = '=';
- if(aFormula.Len()>0)
- {
- if ( aFormula.GetChar(0) == '=' )
- aNewFormula=aFormula;
- }
+ if ( aFormula.Len() > 0 && aFormula.GetChar(0) == '=' )
+ aNewFormula=aFormula;
+
pScMod->InputReplaceSelection( aNewFormula );
pScMod->InputSetSelection( 1, aNewFormula.Len()+1 );
- if(!bEditFlag)
- pMEdit->SetText(pScMod->InputGetFormulaStr());
xub_StrLen PrivStart, PrivEnd;
pScMod->InputGetSelection( PrivStart, PrivEnd);
- if(!bEditFlag)
- pMEdit->SetSelection( Selection(PrivStart, PrivEnd));
+ SetMeText(pScMod->InputGetFormulaStr(),PrivStart, PrivEnd,bMatrix,FALSE,FALSE);
pData->SetFStart( 1 ); // hinter dem "="
}
pData->SetMode( (USHORT) eMode );
- rStrExp=pMEdit->GetText();
+ String rStrExp = GetMeText();
+
pCell = new ScFormulaCell( pDoc, aCursorPos, rStrExp );
- pComp=new ScCompiler( pDoc, aCursorPos, pDoc->GetGrammar() );
- pComp->SetCompileForFAP(TRUE);
- CalcStruct(rStrExp);
- FillDialog();
- //aBtnForward.Enable(TRUE); //@New
- FuncSelHdl(NULL);
- }
+ Update(rStrExp);
+ } // if (!pData)
+
}
-__EXPORT ScFormulaDlg::~ScFormulaDlg()
+void ScFormulaDlg::notifyChange()
{
ScModule* pScMod = SC_MOD();
- ScFormEditData* pData = pScMod->GetFormEditData();
- if (pData) // wird nicht ueber Close zerstoert;
+ ScInputHandler* pInputHdl = pScMod->GetInputHdl();
+ if ( pInputHdl )
+ pInputHdl->NotifyChange( NULL );
+}
+// -----------------------------------------------------------------------------
+void ScFormulaDlg::fill()
+{
+ ScModule* pScMod = SC_MOD();
+ ScFormEditData* pData = pScMod->GetFormEditData();
+ notifyChange();
+ String rStrExp;
+ if (pData)
{
- //Referenz Inputhandler zuruecksetzen
-
- pScMod->SetRefInputHdl(NULL);
-
- if(aTimer.IsActive())
+ // Daten schon vorhanden -> Zustand wiederherstellen (nach Umschalten)
+ // pDoc und aCursorPos nicht neu initialisieren
+ //pDoc = pViewData->GetDocument();
+ if(IsInputHdl(pData->GetInputHandler()))
{
- aTimer.SetTimeoutHdl(Link());
- aTimer.Stop();
+ pScMod->SetRefInputHdl(pData->GetInputHandler());
}
- bIsShutDown=TRUE;// Setzen, damit PreNotify keinen GetFocus speichert.
+ else
+ {
+ PtrTabViewShell pTabViewShell;
+ ScInputHandler* pInputHdl = GetNextInputHandler(pData->GetDocShell(),&pTabViewShell);
- pData->SetFStart((xub_StrLen)pMEdit->GetSelection().Min());
- pData->SetSelection(pMEdit->GetSelection());
+ if ( pInputHdl == NULL ) //DocShell hat keinen InputHandler mehr,
+ { //hat der Anwender halt Pech gehabt.
+ disableOk();
+ pInputHdl = pScMod->GetInputHdl();
+ }
+ else
+ {
+ pInputHdl->SetRefViewShell(pTabViewShell);
+ }
+ pScMod->SetRefInputHdl(pInputHdl);
+ pData->SetInputHandler(pInputHdl);
+ }
- if(aTabCtrl.GetCurPageId()==TP_FUNCTION)
- pData->SetMode( (USHORT) SC_FORMDLG_FORMULA );
- else
- pData->SetMode( (USHORT) SC_FORMDLG_EDIT );
- pData->SetUndoStr(pMEdit->GetText());
- pData->SetMatrixFlag(aBtnMatrix.IsChecked());
+ String aOldFormulaTmp(pScMod->InputGetFormulaStr());
+ pScMod->InputSetSelection( 0, aOldFormulaTmp.Len());
+
+ rStrExp=pData->GetUndoStr();
+ pScMod->InputReplaceSelection(rStrExp);
+
+ SetMeText(rStrExp);
+
+ pCell = new ScFormulaCell( pDoc, aCursorPos, rStrExp );
+
+ Update();
+ // Jetzt nochmals zurueckschalten, da evtl. neues Doc geoeffnet wurde!
+ pScMod->SetRefInputHdl(NULL);
}
+}
- aTabCtrl.RemovePage(TP_FUNCTION);
- aTabCtrl.RemovePage(TP_STRUCT);
+__EXPORT ScFormulaDlg::~ScFormulaDlg()
+{
+ ScModule* pScMod = SC_MOD();
+ ScFormEditData* pData = pScMod->GetFormEditData();
+
+ if (pData) // wird nicht ueber Close zerstoert;
+ {
+ //Referenz Inputhandler zuruecksetzen
+ pScMod->SetRefInputHdl(NULL);
+ } // if (pData) // wird nicht ueber Close zerstoert;
- delete pComp;
delete pCell;
- delete pScStructPage;
- delete pScFuncPage;
- DeleteArgs();
}
BOOL ScFormulaDlg::IsInputHdl(ScInputHandler* pHdl)
@@ -436,973 +329,110 @@ ScInputHandler* ScFormulaDlg::GetNextInputHandler(ScDocShell* pDocShell,PtrTabVi
}
-
-void ScFormulaDlg::FillDialog(BOOL nFlag)
-{
- if(nFlag) FillControls();
- FillListboxes();
-
- String aStrResult;
-
- ScModule* pScMod = SC_MOD();
- if ( CalcValue(pScMod->InputGetFormulaStr(), aStrResult ) )
- aWndFormResult.SetValue( aStrResult );
- else
- {
- aStrResult.Erase();
- aWndFormResult.SetValue( aStrResult );
- }
-
-}
-
-void ScFormulaDlg::FillListboxes()
-{
- // Umschalten zwischen den "Seiten"
-
- ScModule* pScMod = SC_MOD();
- ScFormEditData* pData = pScMod->GetFormEditData();
-
- String aNewTitle;
- // 1. Seite: Funktion auswaehlen
-
- if(pFuncDesc)
- {
- if(pScFuncPage->GetCategory()!=pFuncDesc->nCategory+1)
- pScFuncPage->SetCategory(pFuncDesc->nCategory+1);
-
- USHORT nPos=pScFuncPage->GetFuncPos(pFuncDesc);
-
- pScFuncPage->SetFunction(nPos);
- }
- else if (pData)
- {
- pScFuncPage->SetCategory(pData->GetCatSel() );
- pScFuncPage->SetFunction( pData->GetFuncSel() );
- }
- FuncSelHdl(NULL);
-
- // ResizeArgArr jetzt schon in UpdateFunctionDesc
-
- //pScFuncPage->GetFunctionPtr()->GrabFocus();
-
- SetDispatcherLock( TRUE ); // Modal-Modus einschalten
-
- /*
- aBtnBackward.Enable(FALSE);
- aBtnForward.Enable(TRUE);
- */
- aNewTitle = aTitle1;
-
- // HelpId fuer 1. Seite ist die aus der Resource
- SetHelpId( nOldHelp );
- SetUniqueId( nOldUnique );
-
-}
-void ScFormulaDlg::FillControls()
-{
- // Umschalten zwischen den "Seiten"
-
- ScModule* pScMod = SC_MOD();
- ScFormEditData* pData = pScMod->GetFormEditData();
- if (!pData) return;
-
- String aNewTitle;
- // 2. Seite oder Editieren: ausgewaehlte Funktion anzeigen
-
- xub_StrLen nFStart = pData->GetFStart();
- String aFormula = pScMod->InputGetFormulaStr();
- xub_StrLen nNextFStart = nFStart;
- xub_StrLen nNextFEnd = 0;
-
- aFormula.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " )" ));
- DeleteArgs();
- const ScFuncDesc* pOldFuncDesc=pFuncDesc;
- BOOL bTestFlag=FALSE;
-
- if ( ScFormulaUtil::GetNextFunc( aFormula, FALSE,
- nNextFStart, &nNextFEnd, &pFuncDesc, &pArgArr ) )
- {
- bTestFlag=(pOldFuncDesc!=pFuncDesc);
- if(bTestFlag)
- {
- aFtHeadLine.Hide();
- aFtFuncName.Hide();
- aFtFuncDesc.Hide();
- aScParaWin.SetFunctionDesc(pFuncDesc);
- if(pFuncDesc->pFuncName)
- aFtEditName.SetText( *(pFuncDesc->pFuncName) );
- else
- aFtEditName.SetText( EMPTY_STRING);
-
- }
-
- xub_StrLen nOldStart, nOldEnd;
- pScMod->InputGetSelection( nOldStart, nOldEnd );
- if ( nOldStart != nNextFStart || nOldEnd != nNextFEnd )
- {
- pScMod->InputSetSelection( nNextFStart, nNextFEnd );
- }
- aFuncSel.Min()=nNextFStart;
- aFuncSel.Max()=nNextFEnd;
-
- if(!bEditFlag)
- pMEdit->SetText(pScMod->InputGetFormulaStr());
- xub_StrLen PrivStart, PrivEnd;
- pScMod->InputGetSelection( PrivStart, PrivEnd);
- if(!bEditFlag)
- pMEdit->SetSelection( Selection(PrivStart, PrivEnd));
-
- nArgs = pFuncDesc->GetSuppressedArgCount();
- USHORT nOffset = pData->GetOffset();
- nEdFocus = pData->GetEdFocus();
-
- // Verkettung der Edit's fuer Focus-Kontrolle
-
- if(bTestFlag)
- aScParaWin.SetArgumentOffset(nOffset);
- USHORT nActiv=0;
- xub_StrLen nArgPos=ScFormulaUtil::GetArgStart( aFormula, nFStart, 0 );
- xub_StrLen nEditPos=(xub_StrLen) pMEdit->GetSelection().Min();
- BOOL bFlag=FALSE;
-
- for(USHORT i=0;i<nArgs;i++)
- {
- xub_StrLen nLength=(pArgArr[i])->Len()+1;
- aScParaWin.SetArgument(i,*(pArgArr[i]));
- if(nArgPos<=nEditPos && nEditPos<nArgPos+nLength)
- {
- nActiv=i;
- bFlag=TRUE;
- }
- nArgPos = sal::static_int_cast<xub_StrLen>( nArgPos + nLength );
- }
- aScParaWin.UpdateParas();
-
- if(bFlag)
- {
- aScParaWin.SetActiveLine(nActiv);
- }
-
- //aScParaWin.SetEdFocus( nEdFocus );
- UpdateValues();
- }
- else
- {
- aFtEditName.SetText(EMPTY_STRING);
- }
- // Test, ob vorne/hinten noch mehr Funktionen sind
-
- xub_StrLen nTempStart = ScFormulaUtil::GetArgStart( aFormula, nFStart, 0 );
- BOOL bNext = ScFormulaUtil::GetNextFunc( aFormula, FALSE, nTempStart );
- nTempStart=(xub_StrLen)pMEdit->GetSelection().Min();
- pData->SetFStart(nTempStart);
- BOOL bPrev = ScFormulaUtil::GetNextFunc( aFormula, TRUE, nTempStart );
- aBtnBackward.Enable(bPrev);
- aBtnForward.Enable(bNext);
-}
-
-void ScFormulaDlg::ClearAllParas()
-{
- DeleteArgs();
- pFuncDesc=NULL;
- aScParaWin.ClearAll();
- aWndResult.SetValue(EMPTY_STRING);
- aFtEditName.SetText(EMPTY_STRING);
- FuncSelHdl(NULL);
-
- if(pScFuncPage->IsVisible())
- {
- aBtnForward.Enable(TRUE); //@new
- aFtHeadLine.Show();
- aFtFuncName.Show();
- aFtFuncDesc.Show();
- aFtHeadLine.ToTop();
- aFtFuncName.ToTop();
- aFtFuncDesc.ToTop();
- }
-}
-
-void ScFormulaDlg::DeleteArgs()
-{
- if ( pArgArr )
- {
- for ( USHORT i=0; i<nArgs; i++ )
- delete pArgArr[i];
- delete [] pArgArr;
- }
-
- pArgArr = NULL;
- nArgs = 0;
-}
-
BOOL __EXPORT ScFormulaDlg::Close()
{
DoEnter(FALSE);
return TRUE;
}
-void ScFormulaDlg::DoEnter(BOOL bOk)
-{
- // Eingabe ins Dokument uebernehmen oder abbrechen
-
- ScModule* pScMod = SC_MOD();
-
- if ( bOk)
- {
- // ggf. Dummy-Argumente entfernen
- String aInputFormula=pScMod->InputGetFormulaStr();
- String aString=RepairFormula(pMEdit->GetText());
- pScMod->InputSetSelection(0, aInputFormula.Len());
- pScMod->InputReplaceSelection(aString);
- }
-
- // auf das Dokument zurueckschalten
- // (noetig, weil ein fremdes oben sein kann - #34222#)
- ScInputHandler* pHdl = pScMod->GetInputHdl();
- if ( pHdl )
- {
- pHdl->ViewShellGone(NULL); // -> aktive View neu holen
- pHdl->ShowRefFrame();
- }
-
- // aktuelle Tabelle ggF. restaurieren (wg. Maus-RefInput)
- ScTabViewShell* pScViewShell = PTR_CAST(ScTabViewShell, SfxViewShell::Current());
- if ( pScViewShell )
- {
- ScViewData* pVD=pScViewShell->GetViewData();
- SCTAB nExecTab = aCursorPos.Tab();
- if ( nExecTab != pVD->GetTabNo() )
- pScViewShell->SetTabNo( nExecTab );
-
- SCROW nRow=aCursorPos.Row();
- SCCOL nCol=aCursorPos.Col();
-
- if(pVD->GetCurX()!=nCol || pVD->GetCurY()!=nRow)
- pScViewShell->SetCursor(nCol,nRow);
- }
-
- SfxBoolItem aRetItem( SID_DLG_RETOK, bOk );
- SfxBoolItem aMatItem( SID_DLG_MATRIX, aBtnMatrix.IsChecked() );
- SfxStringItem aStrItem( SCITEM_STRING, pScMod->InputGetFormulaStr() );
-
- // Wenn durch Dokument-Umschalterei die Eingabezeile weg war/ist,
- // ist der String leer. Dann nicht die alte Formel loeschen.
- if ( !aStrItem.GetValue().Len() )
- aRetItem.SetValue( FALSE ); // FALSE = Cancel
-
- SetDispatcherLock( FALSE ); // Modal-Modus ausschalten
-
- pDoc = NULL;
-
- //Referenz Inputhandler zuruecksetzen
-
- pScMod->SetRefInputHdl(NULL);
-
-
- // Enable() der Eingabezeile erzwingen:
- if ( pScViewShell )
- pScViewShell->UpdateInputHandler();
- GetBindings().GetDispatcher()->Execute( SID_INS_FUNCTION,
- SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
- &aRetItem, &aStrItem, &aMatItem, 0L );
-
- // Daten loeschen
- pScMod->ClearFormEditData(); // pData wird ungueltig!
-
- /*
-
- ScInputHandler* pInputHdl = pScMod->GetInputHdl();
- if ( pInputHdl )
- pInputHdl->NotifyChange( NULL );
-
- */
- // Dialog schliessen
- DoClose( ScFormulaDlgWrapper::GetChildWindowId() );
-}
-
-IMPL_LINK( ScFormulaDlg, BtnHdl, PushButton*, pBtn )
-{
- if ( pBtn == &aBtnCancel )
- {
- DoEnter(FALSE); // schliesst den Dialog
- }
- else if ( pBtn == &aBtnEnd )
- {
- DoEnter(TRUE); // schliesst den Dialog
- }
- else if ( pBtn == &aBtnForward )
- {
- //@pMEdit->GrabFocus(); // Damit die Selektion auch angezeigt wird.
- const ScFuncDesc* pDesc =pScFuncPage->GetFuncDesc(
- pScFuncPage->GetFunction() );
-
- if(pDesc==pFuncDesc || !pScFuncPage->IsVisible())
- EditNextFunc( TRUE );
- else
- {
- DblClkHdl(pScFuncPage); //new
- aBtnForward.Enable(FALSE); //new
- }
- //@EditNextFunc( TRUE );
- }
- else if ( pBtn == &aBtnBackward )
- {
- bEditFlag=FALSE;
- aBtnForward.Enable(TRUE);
- EditNextFunc( FALSE );
- aMEFormula.Invalidate();
- aMEFormula.Update();
- }
- //...
-
- return 0;
-}
-
-
-// --------------------------------------------------------------------------
-// Funktionen fuer 1. Seite
-// --------------------------------------------------------------------------
-
-//UNUSED2008-05 void ScFormulaDlg::ResizeArgArr( const ScFuncDesc* pNewFunc )
-//UNUSED2008-05 {
-//UNUSED2008-05 if ( pFuncDesc != pNewFunc )
-//UNUSED2008-05 {
-//UNUSED2008-05 DeleteArgs();
-//UNUSED2008-05
-//UNUSED2008-05 if ( pNewFunc )
-//UNUSED2008-05 {
-//UNUSED2008-05 nArgs = pNewFunc->GetSuppressedArgCount();
-//UNUSED2008-05 if ( nArgs > 0 )
-//UNUSED2008-05 {
-//UNUSED2008-05 pArgArr = new String*[nArgs];
-//UNUSED2008-05 for ( USHORT i=0; i<nArgs; i++ )
-//UNUSED2008-05 pArgArr[i] = new String;
-//UNUSED2008-05 }
-//UNUSED2008-05 }
-//UNUSED2008-05
-//UNUSED2008-05 pFuncDesc = pNewFunc;
-//UNUSED2008-05 }
-//UNUSED2008-05 }
-
-// Handler fuer Listboxen
-
-IMPL_LINK( ScFormulaDlg, DblClkHdl, ScFuncPage*, EMPTYARG )
-{
- ScModule* pScMod = SC_MOD();
-
- USHORT nFunc = pScFuncPage->GetFunction();
-
- // ex-UpdateLRUList
- const ScFuncDesc* pDesc = pScFuncPage->GetFuncDesc(nFunc);
- if (pDesc && pDesc->nFIndex!=0)
- pScMod->InsertEntryToLRUList(pDesc->nFIndex);
-
- String aFuncName=pScFuncPage->GetSelFunctionName();
- aFuncName.AppendAscii(RTL_CONSTASCII_STRINGPARAM( "()" ));
- pScMod->InputReplaceSelection(aFuncName);
- pMEdit->ReplaceSelected(aFuncName);
-
- Selection aSel=pMEdit->GetSelection();
- aSel.Max()=aSel.Max()-1;
- pMEdit->SetSelection(aSel);
-
- FormulaHdl(pMEdit);
-
- aSel.Min()=aSel.Max();
- pMEdit->SetSelection(aSel);
-
- if(nArgs==0)
- {
- BtnHdl(&aBtnBackward);
- }
-
- aScParaWin.SetEdFocus(0);
- aBtnForward.Enable(FALSE); //@New
-
- return 0;
-}
-
// --------------------------------------------------------------------------
// Funktionen fuer rechte Seite
// --------------------------------------------------------------------------
-
-void ScFormulaDlg::EditThisFunc(xub_StrLen nFStart)
-{
- ScModule* pScMod = SC_MOD();
- ScFormEditData* pData = pScMod->GetFormEditData();
- if (!pData) return;
-
- String aFormula = pScMod->InputGetFormulaStr();
-
- if(nFStart==NOT_FOUND)
- {
- nFStart = pData->GetFStart();
- }
- else
- {
- pData->SetFStart(nFStart);
- }
-
- xub_StrLen nNextFStart = nFStart;
- xub_StrLen nNextFEnd = 0;
-
- BOOL bFound;
-
- //@bFound = ScFormulaUtil::GetNextFunc( aFormula, FALSE, nNextFStart, &nNextFEnd, &pFuncDesc );
-
- bFound = ScFormulaUtil::GetNextFunc( aFormula, FALSE, nNextFStart, &nNextFEnd);
- if ( bFound )
- {
- xub_StrLen nFEnd;
-
- // Selektion merken und neue setzen
- pScMod->InputGetSelection( nFStart, nFEnd );
- pScMod->InputSetSelection( nNextFStart, nNextFEnd );
- if(!bEditFlag)
- pMEdit->SetText(pScMod->InputGetFormulaStr());
-
- xub_StrLen PrivStart, PrivEnd;
- pScMod->InputGetSelection( PrivStart, PrivEnd);
- if(!bEditFlag)
- {
- pMEdit->SetSelection( Selection(PrivStart, PrivEnd));
- aMEFormula.UpdateOldSel();
- }
-
- pData->SetFStart( nNextFStart );
- pData->SetOffset( 0 );
- pData->SetEdFocus( 0 );
-
- HighlightFunctionParas(aFormula.Copy(PrivStart, PrivEnd-PrivStart));
- FillDialog();
- }
- else
- {
- ClearAllParas();
- /*
- aScParaWin.ClearAll();
- aWndResult.SetValue(EMPTY_STRING);
- aFtEditName.SetText(EMPTY_STRING);
- */
- }
-}
-
-void ScFormulaDlg::EditNextFunc( BOOL bForward, xub_StrLen nFStart )
-{
- ScModule* pScMod = SC_MOD();
- ScFormEditData* pData = pScMod->GetFormEditData();
- if (!pData) return;
-
- String aFormula = pScMod->InputGetFormulaStr();
-
- if(nFStart==NOT_FOUND)
- {
- nFStart = pData->GetFStart();
- }
- else
- {
- pData->SetFStart(nFStart);
- }
-
- xub_StrLen nNextFStart = 0;
- xub_StrLen nNextFEnd = 0;
-
- BOOL bFound;
- if ( bForward )
- {
- nNextFStart = ScFormulaUtil::GetArgStart( aFormula, nFStart, 0 );
- //@bFound = ScFormulaUtil::GetNextFunc( aFormula, FALSE, nNextFStart, &nNextFEnd, &pFuncDesc );
- bFound = ScFormulaUtil::GetNextFunc( aFormula, FALSE, nNextFStart, &nNextFEnd);
- }
- else
- {
- nNextFStart = nFStart;
- //@bFound = ScFormulaUtil::GetNextFunc( aFormula, TRUE, nNextFStart, &nNextFEnd, &pFuncDesc );
- bFound = ScFormulaUtil::GetNextFunc( aFormula, TRUE, nNextFStart, &nNextFEnd);
- }
-
- if ( bFound )
- {
- xub_StrLen nFEnd;
-
- // Selektion merken und neue setzen
- pScMod->InputGetSelection( nFStart, nFEnd );
- pScMod->InputSetSelection( nNextFStart, nNextFEnd );
- if(!bEditFlag)
- pMEdit->SetText(pScMod->InputGetFormulaStr());
-
- xub_StrLen PrivStart, PrivEnd;
- pScMod->InputGetSelection( PrivStart, PrivEnd);
- if(!bEditFlag)
- {
- pMEdit->SetSelection( Selection(PrivStart, PrivEnd));
- aMEFormula.UpdateOldSel();
- }
-
- pData->SetFStart( nNextFStart );
- pData->SetOffset( 0 );
- pData->SetEdFocus( 0 );
-
- FillDialog();
- }
-}
-
-//UNUSED2008-05 IMPL_LINK( ScFormulaDlg, ScrollHdl, ScParaWin*, EMPTYARG )
-//UNUSED2008-05 {
-//UNUSED2008-05 ScModule* pScMod = SC_MOD();
-//UNUSED2008-05 ScFormEditData* pData = pScMod->GetFormEditData();
-//UNUSED2008-05 if (!pData) return 0;
-//UNUSED2008-05 USHORT nOffset = aScParaWin.GetSliderPos();
-//UNUSED2008-05 pData->SetOffset( nOffset );
-//UNUSED2008-05
-//UNUSED2008-05 aScParaWin.UpdateParas();
-//UNUSED2008-05
-//UNUSED2008-05 UpdateValues();
-//UNUSED2008-05
-//UNUSED2008-05 return 0;
-//UNUSED2008-05 }
-
-BOOL ScFormulaDlg::CalcValue( const String& rStrExp, String& rStrResult )
+bool ScFormulaDlg::calculateValue( const String& rStrExp, String& rStrResult )
{
BOOL bResult = TRUE;
- if ( rStrExp.Len() > 0 )
- {
- // nur, wenn keine Tastatureingabe mehr anliegt, den Wert berechnen:
-
- if ( !Application::AnyInput( INPUT_KEYBOARD ) )
- {
- ScFormulaCell* pFCell = new ScFormulaCell( pDoc, aCursorPos, rStrExp );
-
- // #35521# HACK! um bei ColRowNames kein #REF! zu bekommen,
- // wenn ein Name eigentlich als Bereich in die Gesamt-Formel
- // eingefuegt wird, bei der Einzeldarstellung aber als
- // single-Zellbezug interpretiert wird
- BOOL bColRowName = pCell->HasColRowName();
- if ( bColRowName )
- {
- // ColRowName im RPN-Code?
- if ( pCell->GetCode()->GetCodeLen() <= 1 )
- { // ==1: einzelner ist als Parameter immer Bereich
- // ==0: es waere vielleicht einer, wenn..
- String aBraced( '(' );
- aBraced += rStrExp;
- aBraced += ')';
- delete pFCell;
- pFCell = new ScFormulaCell( pDoc, aCursorPos, aBraced );
- }
- else
- bColRowName = FALSE;
- }
-
- USHORT nErrCode = pFCell->GetErrCode();
- if ( nErrCode == 0 )
- {
- SvNumberFormatter& aFormatter = *(pDoc->GetFormatTable());
- Color* pColor;
- if ( pFCell->IsValue() )
- {
- double n = pFCell->GetValue();
- ULONG nFormat = aFormatter.GetStandardFormat( n, 0,
- pFCell->GetFormatType(), ScGlobal::eLnge );
- aFormatter.GetOutputString( n, nFormat,
- rStrResult, &pColor );
- }
- else
- {
- String aStr;
-
- pFCell->GetString( aStr );
- ULONG nFormat = aFormatter.GetStandardFormat(
- pFCell->GetFormatType(), ScGlobal::eLnge);
- aFormatter.GetOutputString( aStr, nFormat,
- rStrResult, &pColor );
- }
-
- ScRange aTestRange;
- if ( bColRowName || (aTestRange.Parse(rStrExp) & SCA_VALID) )
- rStrResult.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " ..." ));
- // Bereich
- }
- else
- rStrResult += ScGlobal::GetErrorString(nErrCode);
+ ::std::auto_ptr<ScFormulaCell> pFCell( new ScFormulaCell( pDoc, aCursorPos, rStrExp ) );
- if(!bUserMatrixFlag && pFCell->GetMatrixFlag())
- {
- aBtnMatrix.Check();
- }
-
- delete pFCell;
+ // #35521# HACK! um bei ColRowNames kein #REF! zu bekommen,
+ // wenn ein Name eigentlich als Bereich in die Gesamt-Formel
+ // eingefuegt wird, bei der Einzeldarstellung aber als
+ // single-Zellbezug interpretiert wird
+ BOOL bColRowName = pCell->HasColRowName();
+ if ( bColRowName )
+ {
+ // ColRowName im RPN-Code?
+ if ( pCell->GetCode()->GetCodeLen() <= 1 )
+ { // ==1: einzelner ist als Parameter immer Bereich
+ // ==0: es waere vielleicht einer, wenn..
+ String aBraced( '(' );
+ aBraced += rStrExp;
+ aBraced += ')';
+ pFCell.reset( new ScFormulaCell( pDoc, aCursorPos, aBraced ) );
}
else
- bResult = FALSE;
+ bColRowName = FALSE;
}
- return bResult;
-}
-
-void ScFormulaDlg::UpdateValues()
-{
- ScModule* pScMod = SC_MOD();
- String aStrResult;
-
- if ( CalcValue( pFuncDesc->GetFormulaString( pArgArr ), aStrResult ) )
- aWndResult.SetValue( aStrResult );
-
- aStrResult.Erase();
- if ( CalcValue(pScMod->InputGetFormulaStr(), aStrResult ) )
- aWndFormResult.SetValue( aStrResult );
- else
- {
- aStrResult.Erase();
- aWndFormResult.SetValue( aStrResult );
- }
- CalcStruct(pMEdit->GetText());
-}
-
-void ScFormulaDlg::SaveArg( USHORT nEd )
-{
- if (nEd<nArgs)
+ USHORT nErrCode = pFCell->GetErrCode();
+ if ( nErrCode == 0 )
{
- USHORT i;
- for(i=0;i<=nEd;i++)
+ SvNumberFormatter& aFormatter = *(pDoc->GetFormatTable());
+ Color* pColor;
+ if ( pFCell->IsValue() )
{
- if(pArgArr[i]->Len()==0)
- *(pArgArr[i]) = ' ';
+ double n = pFCell->GetValue();
+ ULONG nFormat = aFormatter.GetStandardFormat( n, 0,
+ pFCell->GetFormatType(), ScGlobal::eLnge );
+ aFormatter.GetOutputString( n, nFormat,
+ rStrResult, &pColor );
}
- if(aScParaWin.GetArgument(nEd).Len()!=0)
- *(pArgArr[nEd]) = aScParaWin.GetArgument(nEd);
-
- USHORT nClearPos=nEd+1;
- for(i=nEd+1;i<nArgs;i++)
+ else
{
- if(aScParaWin.GetArgument(i).Len()!=0)
- {
- nClearPos=i+1;
- }
- }
+ String aStr;
- for(i=nClearPos;i<nArgs;i++)
- {
- *(pArgArr[i]) = EMPTY_STRING;
+ pFCell->GetString( aStr );
+ ULONG nFormat = aFormatter.GetStandardFormat(
+ pFCell->GetFormatType(), ScGlobal::eLnge);
+ aFormatter.GetOutputString( aStr, nFormat,
+ rStrResult, &pColor );
}
- }
-}
-IMPL_LINK( ScFormulaDlg, FxHdl, ScParaWin*, pPtr )
-{
- if(pPtr==&aScParaWin)
- {
- aBtnForward.Enable(TRUE); //@ Damit eine neue Fkt eingegeben werden kann.
- aTabCtrl.SetCurPageId(TP_FUNCTION);
- ScModule* pScMod = SC_MOD();
- String aUndoStr = pScMod->InputGetFormulaStr(); // bevor unten ein ";" eingefuegt wird
- ScFormEditData* pData = pScMod->GetFormEditData();
- if (!pData) return 0;
-
- USHORT nArgNo = aScParaWin.GetActiveLine();
- nEdFocus=nArgNo;
-
- SaveArg(nArgNo);
- UpdateSelection();
-
- xub_StrLen nFormulaStrPos = pData->GetFStart();
-
- String aFormula = pScMod->InputGetFormulaStr();
- xub_StrLen n1 = ScFormulaUtil::GetArgStart( aFormula, nFormulaStrPos, nEdFocus+pData->GetOffset() );
-
- pData->SetEdFocus( nEdFocus );
- pData->SaveValues();
- pData->SetMode( (USHORT) SC_FORMDLG_FORMULA );
- pData->SetFStart( n1 );
- pData->SetUndoStr( aUndoStr );
- ClearAllParas();
-
- FillDialog(FALSE);
- pScFuncPage->SetFocus(); //Da Parawin nicht mehr sichtbar
- }
- return 0;
-}
-
-IMPL_LINK( ScFormulaDlg, ModifyHdl, ScParaWin*, pPtr )
-{
- if(pPtr==&aScParaWin)
- {
- SaveArg(aScParaWin.GetActiveLine());
- UpdateValues();
-
- UpdateSelection();
- CalcStruct(pMEdit->GetText());
- }
- return 0;
-}
-
-IMPL_LINK( ScFormulaDlg, FormulaHdl, MultiLineEdit*, EMPTYARG )
-{
- ScModule* pScMod = SC_MOD();
- ScFormEditData* pData = pScMod->GetFormEditData();
- if (!pData) return 0;
-
- bEditFlag=TRUE;
- String aInputFormula=pScMod->InputGetFormulaStr();
- String aString=pMEdit->GetText();
-
- Selection aSel =pMEdit->GetSelection();
- xub_StrLen nTest=0;
-
- if(aString.Len()==0) //falls alles geloescht wurde
- {
- aString +='=';
- pMEdit->SetText(aString);
- aSel .Min()=1;
- aSel .Max()=1;
- pMEdit->SetSelection(aSel);
- }
- else if(aString.GetChar(nTest)!='=') //falls ersetzt wurde;
- {
- aString.Insert( (sal_Unicode)'=', 0 );
- pMEdit->SetText(aString);
- aSel .Min()+=1;
- aSel .Max()+=1;
- pMEdit->SetSelection(aSel);
- }
-
-
- pScMod->InputSetSelection(0, aInputFormula.Len());
- pScMod->InputReplaceSelection(aString);
- pScMod->InputSetSelection((xub_StrLen)aSel.Min(),(xub_StrLen)aSel.Max());
-
- xub_StrLen nPos=(xub_StrLen)aSel.Min()-1;
-
- String aStrResult;
-
- if ( CalcValue(pScMod->InputGetFormulaStr(), aStrResult ) )
- aWndFormResult.SetValue( aStrResult );
- else
- {
- aStrResult.Erase();
- aWndFormResult.SetValue( aStrResult );
- }
- CalcStruct(aString);
-
- nPos=GetFunctionPos(nPos);
-
- if(nPos<aSel.Min()-1)
- {
- xub_StrLen nPos1=aString.Search('(',nPos);
- EditNextFunc( FALSE, nPos1);
+ ScRange aTestRange;
+ if ( bColRowName || (aTestRange.Parse(rStrExp) & SCA_VALID) )
+ rStrResult.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " ..." ));
+ // Bereich
}
else
- {
- ClearAllParas();
- /*
- aScParaWin.ClearAll();
- aWndResult.SetValue(EMPTY_STRING);
- aFtEditName.SetText(EMPTY_STRING);
- */
- }
-
- pScMod->InputSetSelection((xub_StrLen)aSel.Min(),(xub_StrLen)aSel.Max());
- bEditFlag=FALSE;
- return 0;
-}
-
-IMPL_LINK( ScFormulaDlg, FormulaCursorHdl, ScEditBox*, EMPTYARG )
-{
- ScModule* pScMod = SC_MOD();
- ScFormEditData* pData = pScMod->GetFormEditData();
- if (!pData) return 0;
- xub_StrLen nFStart = pData->GetFStart();
-
- bEditFlag=TRUE;
-
- String aInputFormula=pScMod->InputGetFormulaStr();
- String aString=pMEdit->GetText();
+ rStrResult += ScGlobal::GetErrorString(nErrCode);
- Selection aSel =pMEdit->GetSelection();
- pScMod->InputSetSelection((xub_StrLen)aSel.Min(),(xub_StrLen)aSel.Max());
-
-
- if(aSel.Min()==0)
+ if(!isUserMatrix() && pFCell->GetMatrixFlag())
{
- aSel.Min()=1;
- pMEdit->SetSelection(aSel);
- }
-
- if(aSel.Min()!=aString.Len())
- {
-
- xub_StrLen nPos=(xub_StrLen)aSel.Min();
-
- nFStart=GetFunctionPos(nPos-1);
-
- if(nFStart<nPos)
- {
- xub_StrLen nPos1=ScFormulaUtil::GetFunctionEnd(aString,nFStart);
-
- if(nPos1>nPos || nPos1==STRING_NOTFOUND)
- {
- EditThisFunc(nFStart);
- }
- else
- {
- xub_StrLen n=nPos;
- short nCount=1;
- while(n>0)
- {
- if(aString.GetChar(n)==')')
- nCount++;
- else if(aString.GetChar(n)=='(')
- nCount--;
- if(nCount==0) break;
- n--;
- }
- if(nCount==0)
- {
- nFStart=ScFormulaUtil::GetFunctionStart(aString,n,TRUE);
- EditThisFunc(nFStart);
- }
- else
- {
- ClearAllParas();
- }
- }
- }
- else
- {
- ClearAllParas();
- }
+ CheckMatrix();
}
- pScMod->InputSetSelection((xub_StrLen)aSel.Min(),(xub_StrLen)aSel.Max());
- bEditFlag=FALSE;
- return 0;
+ return bResult;
}
-void ScFormulaDlg::UpdateSelection()
-{
- ScModule* pScMod = SC_MOD();
-
- pScMod->InputSetSelection((xub_StrLen)aFuncSel.Min(),(xub_StrLen)aFuncSel.Max());
-
- pScMod->InputReplaceSelection( pFuncDesc->GetFormulaString( pArgArr ) );
- pMEdit->SetText(pScMod->InputGetFormulaStr());
- xub_StrLen PrivStart, PrivEnd;
- pScMod->InputGetSelection( PrivStart, PrivEnd);
- aFuncSel.Min()=PrivStart;
- aFuncSel.Max()=PrivEnd;
-
- nArgs = pFuncDesc->GetSuppressedArgCount();
- String aFormula=pMEdit->GetText();
- xub_StrLen nArgPos=ScFormulaUtil::GetArgStart( aFormula,PrivStart,0);
-
- USHORT nPos=aScParaWin.GetActiveLine();
-
- for(USHORT i=0;i<nPos;i++)
- {
- xub_StrLen nTmpLength=(pArgArr[i])->Len();
- nArgPos+=nTmpLength+1;
- }
- xub_StrLen nLength=(pArgArr[nPos])->Len();
-
- Selection aSel(nArgPos,nArgPos+nLength);
- pScMod->InputSetSelection(nArgPos,nArgPos+nLength);
- pMEdit->SetSelection(aSel);
- aMEFormula.UpdateOldSel();
-}
// virtuelle Methoden von ScAnyRefDlg:
-void ScFormulaDlg::RefInputStart( ScRefEdit* pEdit, ScRefButton* pButton )
+void ScFormulaDlg::RefInputStart( formula::RefEdit* pEdit, formula::RefButton* pButton )
{
- aEdRef.Show();
- pTheRefEdit = pEdit;
- pTheRefButton = pButton;
-
- if( pTheRefEdit )
- {
- aEdRef.SetRefString( pTheRefEdit->GetText() );
- aEdRef.SetSelection( pTheRefEdit->GetSelection() );
- aEdRef.SetHelpId( pTheRefEdit->GetHelpId() );
- aEdRef.SetUniqueId( pTheRefEdit->GetUniqueId() );
- }
-
- aRefBtn.Show( pButton != NULL );
- ScAnyRefDlg::RefInputStart( &aEdRef, pButton ? &aRefBtn : NULL );
- aRefBtn.SetEndImage();
-
- if( pTheRefEdit )
- {
- String aStr = aTitle2;
- aStr += ' ';
- aStr += aFtEditName.GetText();
- aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "( " ) );
- if( aScParaWin.GetActiveLine() > 0 )
- aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "...; " ) );
- aStr += aScParaWin.GetActiveArgName();
- if( aScParaWin.GetActiveLine() + 1 < nArgs )
- aStr.AppendAscii(RTL_CONSTASCII_STRINGPARAM( "; ..." ));
- aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " )" ) );
-
- SetText( MnemonicGenerator::EraseAllMnemonicChars( aStr ) );
- }
+ ::std::pair<formula::RefButton*,formula::RefEdit*> aPair = RefInputStartBefore( pEdit, pButton );
+ m_aHelper.RefInputStart( aPair.second, aPair.first);
+ RefInputStartAfter( aPair.second, aPair.first );
}
-
void ScFormulaDlg::RefInputDone( BOOL bForced )
{
- ScAnyRefDlg::RefInputDone( bForced );
- aRefBtn.SetStartImage();
- if( bForced || !aRefBtn.IsVisible() )
- {
- aEdRef.Hide();
- aRefBtn.Hide();
- if( pTheRefEdit )
- {
- pTheRefEdit->SetRefString( aEdRef.GetText() );
- pTheRefEdit->GrabFocus();
-
- if( pTheRefButton )
- pTheRefButton->SetStartImage();
-
- USHORT nPrivActiv = aScParaWin.GetActiveLine();
- aScParaWin.SetArgument( nPrivActiv, aEdRef.GetText() );
- ModifyHdl( &aScParaWin );
- pTheRefEdit = NULL;
- }
- SetText( aTitle1 );
- }
+ m_aHelper.RefInputDone( bForced );
+ RefInputDoneAfter( bForced );
}
void ScFormulaDlg::SetReference( const ScRange& rRef, ScDocument* pRefDoc )
{
- if (nArgs > 0 )
+ const IFunctionDescription* pFunc = getCurrentFunctionDescription();
+ if ( pFunc && pFunc->getSuppressedArgumentCount() > 0 )
{
- aScParaWin.SetRefMode(TRUE);
+ Selection theSel;
+ BOOL bRefNull = UpdateParaWin(theSel);
- Selection theSel;
- String aStrEd;
- Edit* pEd = GetCurrRefEdit();
- if(pEd!=NULL && pTheRefEdit==NULL)
- {
- theSel=pEd->GetSelection();
- theSel.Justify();
- aStrEd=pEd->GetText();
- aEdRef.SetRefString(aStrEd);
- aEdRef.SetSelection( theSel );
- }
- else
+ if ( rRef.aStart != rRef.aEnd && bRefNull )
{
- theSel=aEdRef.GetSelection();
- theSel.Justify();
- aStrEd=aEdRef.GetText();
- }
- String aRefStr;
-
- if ( rRef.aStart != rRef.aEnd && pTheRefEdit==NULL)
- {
- RefInputStart(aScParaWin.GetActiveEdit());
+ RefInputStart(GetActiveEdit());
}
+ String aRefStr;
BOOL bOtherDoc = ( pRefDoc != pDoc && pRefDoc->GetDocumentShell()->HasName() );
if ( bOtherDoc )
{
@@ -1432,26 +462,14 @@ void ScFormulaDlg::SetReference( const ScRange& rRef, ScDocument* pRefDoc )
rRef.Format( aRefStr, nFmt, pRefDoc, pRefDoc->GetAddressConvention() );
}
- aEdRef.ReplaceSelected( aRefStr );
- theSel.Max() = theSel.Min() + aRefStr.Len();
- aEdRef.SetSelection( theSel );
-
- //-------------------------------------
- // Manuelles Update der Ergebnisfelder:
- //-------------------------------------
- USHORT nPrivActiv=aScParaWin.GetActiveLine();
- aScParaWin.SetArgument(nPrivActiv,aEdRef.GetText());
- aScParaWin.UpdateParas();
-
- if(pEd!=NULL) pEd->SetSelection( theSel );
-
- aScParaWin.SetRefMode(FALSE);
+ UpdateParaWin(theSel,aRefStr);
}
}
BOOL ScFormulaDlg::IsRefInputMode() const
{
- BOOL bRef = (nArgs > 0)&& (pDoc!=NULL);
+ const IFunctionDescription* pDesc = getCurrentFunctionDescription();
+ BOOL bRef = (!pDesc || (pDesc->getSuppressedArgumentCount() > 0)) && (pDoc!=NULL);
return bRef;
}
@@ -1467,490 +485,181 @@ BOOL ScFormulaDlg::IsDocAllowed(SfxObjectShell* pDocSh) const
void ScFormulaDlg::SetActive()
{
- if(nArgs > 0)
+ const IFunctionDescription* pFunc = getCurrentFunctionDescription();
+ if ( pFunc && pFunc->getSuppressedArgumentCount() > 0 )
{
RefInputDone();
- Edit* pEd = GetCurrRefEdit()/*aScParaWin.GetActiveEdit()*/;
- if( pEd )
- {
- Selection theSel=aEdRef.GetSelection();
- // Edit may have the focus -> call ModifyHdl in addition
- // to what's happening in GetFocus
- pEd->GetModifyHdl().Call(pEd);
- pEd->GrabFocus();
- pEd->SetSelection(theSel);
- }
+ SetEdSelection();
}
}
-void ScFormulaDlg::MakeTree(SvLBoxEntry* pParent,ScToken* pScToken,long Count,
- ScTokenArray* pScTokAP, ScCompiler* pCompP)
+void ScFormulaDlg::SaveLRUEntry(const ScFuncDesc* pFuncDescP)
{
- if(pScToken!=NULL && Count>0)
+ if (pFuncDescP && pFuncDescP->nFIndex!=0)
{
- String aResult;
- long nParas=pScToken->GetParamCount();
- OpCode eOp = pScToken->GetOpCode();
-
- if(nParas>0)
- {
- pCompP->CreateStringFromToken( aResult,pScToken);
-
- SvLBoxEntry* pEntry;
-
- String aTest=pScStructPage->GetEntryText(pParent);
-
- if(aTest==aResult &&
- (eOp==ocAdd || eOp==ocMul ||
- eOp==ocAmpersand))
- {
- pEntry=pParent;
- }
- else
- {
- if(eOp==ocBad)
- {
- pEntry=pScStructPage->InsertEntry(aResult,pParent,STRUCT_ERROR,0,pScToken);
- }
- else
- {
- pEntry=pScStructPage->InsertEntry(aResult,pParent,STRUCT_FOLDER,0,pScToken);
- }
- }
-
- MakeTree(pEntry,pScTokAP->PrevRPN(),nParas,pScTokAP,pCompP);
- --Count;
- pScTokAP->NextRPN();
- MakeTree(pParent,pScTokAP->PrevRPN(),Count,pScTokAP,pCompP);
- }
- else
- {
- pCompP->CreateStringFromToken( aResult,pScToken);
-
- if(eOp==ocBad)
- {
- pScStructPage->InsertEntry(aResult,pParent,STRUCT_ERROR,0,pScToken);
- }
- else
- {
- pScStructPage->InsertEntry(aResult,pParent,STRUCT_END,0,pScToken);
- }
- --Count;
- MakeTree(pParent,pScTokAP->PrevRPN(),Count,pScTokAP,pCompP);
- }
+ ScModule* pScMod = SC_MOD();
+ pScMod->InsertEntryToLRUList(pFuncDescP->nFIndex);
}
}
-
-void ScFormulaDlg::UpdateTokenArray( const String& rStrExp)
+void ScFormulaDlg::doClose(BOOL /*_bOk*/)
{
- if(pScTokA!=NULL) delete pScTokA;
- pScTokA=pComp->CompileString(rStrExp);
- pComp->CompileTokenArray();
+ m_aHelper.DoClose( ScFormulaDlgWrapper::GetChildWindowId() );
}
-
-xub_StrLen ScFormulaDlg::GetFunctionPos(xub_StrLen nPos)
+void ScFormulaDlg::insertEntryToLRUList(const formula::IFunctionDescription* _pDesc)
{
- const sal_Unicode sep = ScCompiler::GetStringFromOpCode(ocSep).GetChar(0);
-
- xub_StrLen nTokPos=1;
- xub_StrLen nOldTokPos=1;
- xub_StrLen nFuncPos=STRING_NOTFOUND; //@ Testweise
- xub_StrLen nPrevFuncPos=1;
- short nBracketCount=0;
- BOOL bFlag=FALSE;
- String aFormString=pMEdit->GetText();
- ScGlobal::pCharClass->toUpper( aFormString );
- if(pScTokA!=NULL)
- {
- ScToken* pToken=pScTokA->First();
- while(pToken!=NULL)
- {
- String aString;
- OpCode eOp = pToken->GetOpCode();
- pComp->CreateStringFromToken( aString,pToken);
- ScToken* pNextToken=pScTokA->Next();
-
- if(!bUserMatrixFlag && pToken->IsMatrixFunction())
- {
- aBtnMatrix.Check();
- }
-
- if(eOp==ocPush || eOp==ocSpaces)
- {
- xub_StrLen n1=aFormString.Search(sep, nTokPos);
- xub_StrLen n2=aFormString.Search(')',nTokPos);
- xub_StrLen nXXX=nTokPos;
- if(n1<n2)
- {
- nTokPos=n1;
- }
- else
- {
- nTokPos=n2;
- }
- if(pNextToken!=NULL)
- {
- String a2String;
- pComp->CreateStringFromToken( a2String,pNextToken);
- xub_StrLen n3=aFormString.Search(a2String,nXXX);
-
- if(n3<nTokPos)
- nTokPos=n3;
- }
- }
- else
- {
- nTokPos = sal::static_int_cast<xub_StrLen>( nTokPos + aString.Len() );
- }
-
- if(eOp==ocOpen)
- {
- nBracketCount++;
- bFlag=TRUE;
- }
- else if(eOp==ocClose)
- {
- nBracketCount--;
- bFlag=FALSE;
- nFuncPos=nPrevFuncPos;
- }
-
- if((pToken->IsFunction()|| ocArcTan2<=eOp) && ocSpaces!=eOp)
- {
- nPrevFuncPos=nFuncPos;
- nFuncPos=nOldTokPos;
- }
-
- if(nOldTokPos<=nPos && nPos<nTokPos)
- {
- if(!(pToken->IsFunction()|| ocArcTan2<=eOp))
- {
- if(nBracketCount<1)
- {
- nFuncPos=pMEdit->GetText().Len();
- }
- else if(!bFlag)
- {
- nFuncPos=nPrevFuncPos;
- }
- }
- break;
- }
-
- pToken=pNextToken;
- nOldTokPos=nTokPos;
- }
- }
-
- return nFuncPos;
+ const ScFuncDesc* pDesc = dynamic_cast<const ScFuncDesc*>(_pDesc);
+ SaveLRUEntry(pDesc);
}
-
-BOOL ScFormulaDlg::CalcStruct( const String& rStrExp)
+void ScFormulaDlg::showReference(const String& _sFormula)
{
- BOOL bResult = TRUE;
- xub_StrLen nLength=rStrExp.Len();
-
- if ( rStrExp.Len() > 0 && aOldFormula!=rStrExp && bStructUpdate)
- {
- // nur, wenn keine Tastatureingabe mehr anliegt, den Wert berechnen:
-
- if ( !Application::AnyInput( INPUT_KEYBOARD ) )
- {
- pScStructPage->ClearStruct();
-
- String aString=rStrExp;
- if(rStrExp.GetChar(nLength-1)=='(')
- {
- aString.Erase((xub_StrLen)(nLength-1));
- }
-
- aString.EraseAllChars('\n');
- String aStrResult;
-
- if ( CalcValue(aString, aStrResult ) )
- aWndFormResult.SetValue( aStrResult );
-
- UpdateTokenArray(aString);
-
- ScToken* pScToken=pScTokA->LastRPN();
-
- if(pScToken!=NULL)
- {
- MakeTree(NULL,pScToken,1,pScTokA,pComp);
- }
- aOldFormula=rStrExp;
- if(rStrExp.GetChar(nLength-1)=='(')
- UpdateTokenArray(rStrExp);
- }
- else
- bResult = FALSE;
- }
- return bResult;
+ ShowReference(_sFormula);
}
-
-IMPL_LINK( ScFormulaDlg, StructSelHdl, ScStructPage*, pStruP )
+void ScFormulaDlg::ShowReference(const String& _sFormula)
{
- bStructUpdate=FALSE;
- if(pScStructPage->IsVisible()) aBtnForward.Enable(FALSE); //@New
-
- if(pScStructPage==pStruP)
- {
- ScToken* pSelToken = pScStructPage->GetSelectedToken();
- ScToken* pOrigToken = ((pSelToken && pSelToken->GetType() == svFAP) ?
- pSelToken->GetFAPOrigToken() : pSelToken);
- xub_StrLen nTokPos=1;
-
- if(pScTokA!=NULL)
- {
- ScToken* pToken = pScTokA->First();
-
- while(pToken!=NULL)
- {
- String aString;
- if ( pToken == pOrigToken )
- break;
- pComp->CreateStringFromToken( aString,pToken);
- nTokPos = sal::static_int_cast<xub_StrLen>( nTokPos + aString.Len() );
- pToken=pScTokA->Next();
- }
- EditThisFunc(nTokPos);
- }
-
- if( pOrigToken )
- {
- String aStr;
- pComp->CreateStringFromToken( aStr, pOrigToken );
- String aEntryTxt=pScStructPage->GetSelectedEntryText();
-
- if(aEntryTxt!=aStr)
- ShowReference(aEntryTxt);
- }
-
- }
- bStructUpdate=TRUE;
- return 0;
+ m_aHelper.ShowReference(_sFormula);
}
-
-ULONG ScFormulaDlg::FindFocusWin(Window *pWin)
+void ScFormulaDlg::HideReference( BOOL bDoneRefMode )
{
- ULONG nUniqueId=0;
- if(pWin->HasFocus())
- {
- nUniqueId=pWin->GetUniqueId();
- if(nUniqueId==0)
- {
- Window* pParent=pWin->GetParent();
- while(pParent!=NULL)
- {
- nUniqueId=pParent->GetUniqueId();
-
- if(nUniqueId!=0) break;
-
- pParent=pParent->GetParent();
- }
- }
- }
- else
- {
- USHORT nCount=pWin->GetChildCount();
-
- for(USHORT i=0;i<nCount;i++)
- {
- Window* pChild=pWin->GetChild(i);
- nUniqueId=FindFocusWin(pChild);
- if(nUniqueId>0) break;
- }
- }
- return nUniqueId;
+ m_aHelper.HideReference(bDoneRefMode);
}
-
-void ScFormulaDlg::SetFocusWin(Window *pWin,ULONG nUniqueId)
+void ScFormulaDlg::ViewShellChanged( ScTabViewShell* pScViewShell )
{
- if(pWin->GetUniqueId()==nUniqueId)
- {
- pWin->GrabFocus();
- }
- else
- {
- USHORT nCount=pWin->GetChildCount();
-
- for(USHORT i=0;i<nCount;i++)
- {
- Window* pChild=pWin->GetChild(i);
- SetFocusWin(pChild,nUniqueId);
- }
- }
+ m_aHelper.ViewShellChanged( pScViewShell );
}
+void ScFormulaDlg::AddRefEntry( )
+{
-IMPL_LINK( ScFormulaDlg, MatrixHdl, CheckBox *, EMPTYARG )
+}
+BOOL ScFormulaDlg::IsTableLocked( ) const
{
- bUserMatrixFlag=TRUE;
- return 0;
+ // per Default kann bei Referenzeingabe auch die Tabelle umgeschaltet werden
+ return FALSE;
}
-
-IMPL_LINK( ScFormulaDlg, FuncSelHdl, ScFuncPage*, EMPTYARG )
+void ScFormulaDlg::ToggleCollapsed( formula::RefEdit* pEdit, formula::RefButton* pButton)
+{
+ m_aHelper.ToggleCollapsed(pEdit,pButton);
+}
+void ScFormulaDlg::ReleaseFocus( formula::RefEdit* pEdit, formula::RefButton* pButton)
+{
+ m_aHelper.ReleaseFocus(pEdit,pButton);
+}
+void ScFormulaDlg::dispatch(BOOL _bOK,BOOL _bMartixChecked)
{
- USHORT nCat = pScFuncPage->GetCategory();
- if ( nCat == LISTBOX_ENTRY_NOTFOUND ) nCat = 0;
- USHORT nFunc = pScFuncPage->GetFunction();
- if ( nFunc == LISTBOX_ENTRY_NOTFOUND ) nFunc = 0;
+ SfxBoolItem aRetItem( SID_DLG_RETOK, _bOK );
+ SfxBoolItem aMatItem( SID_DLG_MATRIX, _bMartixChecked );
+ SfxStringItem aStrItem( SCITEM_STRING, getCurrentFormula() );
- if ( (pScFuncPage->GetFunctionEntryCount() > 0)
- && (pScFuncPage->GetFunction() != LISTBOX_ENTRY_NOTFOUND) )
- {
- const ScFuncDesc* pDesc =pScFuncPage->GetFuncDesc(
- pScFuncPage->GetFunction() );
+ // Wenn durch Dokument-Umschalterei die Eingabezeile weg war/ist,
+ // ist der String leer. Dann nicht die alte Formel loeschen.
+ if ( !aStrItem.GetValue().Len() )
+ aRetItem.SetValue( FALSE ); // FALSE = Cancel
- if(pDesc!=pFuncDesc) aBtnForward.Enable(TRUE); //new
+ m_aHelper.SetDispatcherLock( FALSE ); // Modal-Modus ausschalten
- if (pDesc)
- {
- pDesc->InitArgumentInfo(); // full argument info is needed
+ clear();
- String aSig = pDesc->GetSignature();
- if(pDesc->pFuncName)
- aFtHeadLine.SetText( *(pDesc->pFuncName) );
- else
- aFtHeadLine.SetText( EMPTY_STRING);
- aFtFuncName.SetText( aSig );
- if(pDesc->pFuncDesc)
- aFtFuncDesc.SetText( *(pDesc->pFuncDesc) );
- else
- aFtFuncDesc.SetText( EMPTY_STRING);
- }
- }
- else
- {
- aFtHeadLine.SetText( EMPTY_STRING );
- aFtFuncName.SetText( EMPTY_STRING );
- aFtFuncDesc.SetText( EMPTY_STRING );
- }
- return 0;
+ GetBindings().GetDispatcher()->Execute( SID_INS_FUNCTION,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
+ &aRetItem, &aStrItem, &aMatItem, 0L );
}
-
-IMPL_LINK( ScFormulaDlg, UpdateFocusHdl, Timer*, EMPTYARG )
+void ScFormulaDlg::setDispatcherLock( BOOL bLock )
+{
+ m_aHelper.SetDispatcherLock( bLock );
+}
+void ScFormulaDlg::setReferenceInput(const formula::FormEditData* _pData)
{
ScModule* pScMod = SC_MOD();
- ScFormEditData* pData = pScMod->GetFormEditData();
-
- if (pData) // wird nicht ueber Close zerstoert;
- {
- pScMod->SetRefInputHdl(pData->GetInputHandler());
- ULONG nUniqueId=pData->GetUniqueId();
- SetFocusWin((Window *)this,nUniqueId);
- }
- return 0;
+ ScFormEditData* pData = const_cast<ScFormEditData*>(dynamic_cast<const ScFormEditData*>(_pData));
+ pScMod->SetRefInputHdl(pData->GetInputHandler());
}
-
-long ScFormulaDlg::PreNotify( NotifyEvent& rNEvt )
+void ScFormulaDlg::deleteFormData()
{
- USHORT nSwitch=rNEvt.GetType();
- if(nSwitch==EVENT_GETFOCUS && !bIsShutDown)
- {
- Window* pWin=rNEvt.GetWindow();
- if(pWin!=NULL)
- {
- nActivWinId=pWin->GetUniqueId();
- if(nActivWinId==0)
- {
- Window* pParent=pWin->GetParent();
- while(pParent!=NULL)
- {
- nActivWinId=pParent->GetUniqueId();
-
- if(nActivWinId!=0) break;
-
- pParent=pParent->GetParent();
- }
- }
- if(nActivWinId!=0)
- {
- ScModule* pScMod = SC_MOD();
- ScFormEditData* pData = pScMod->GetFormEditData();
-
- if (pData && !aTimer.IsActive()) // wird nicht ueber Close zerstoert;
- {
- pData->SetUniqueId(nActivWinId);
- }
- }
- }
- }
- return ScAnyRefDlg::PreNotify(rNEvt);
+ ScModule* pScMod = SC_MOD();
+ pScMod->ClearFormEditData(); // pData wird ungueltig!
}
-
-String ScFormulaDlg::RepairFormula(const String& aFormula)
+void ScFormulaDlg::clear()
{
- String aResult('=');
- String aString2;
- BOOL bSep=FALSE;
-
- ScFunctionMgr* pFuncMgr = ScGlobal::GetStarCalcFunctionMgr();
+ pDoc = NULL;
- UpdateTokenArray(aFormula);
+ //Referenz Inputhandler zuruecksetzen
+ ScModule* pScMod = SC_MOD();
+ pScMod->SetRefInputHdl(NULL);
- if(pScTokA!=NULL)
+ // Enable() der Eingabezeile erzwingen:
+ ScTabViewShell* pScViewShell = PTR_CAST(ScTabViewShell, SfxViewShell::Current());
+ if ( pScViewShell )
+ pScViewShell->UpdateInputHandler();
+}
+void ScFormulaDlg::switchBack()
+{
+ ScModule* pScMod = SC_MOD();
+ // auf das Dokument zurueckschalten
+ // (noetig, weil ein fremdes oben sein kann - #34222#)
+ ScInputHandler* pHdl = pScMod->GetInputHdl();
+ if ( pHdl )
{
- ScToken* pToken=pScTokA->First();
- while(pToken!=NULL)
- {
- String aString;
- OpCode eOp = pToken->GetOpCode();
- pComp->CreateStringFromToken( aString,pToken);
- ScToken* pNextToken=pScTokA->Next();
-
- if(eOp==ocSep)
- {
- bSep=TRUE;
- //aResult+=aString2;
- aString2+=aString;
- }
- else if(eOp==ocClose &&bSep)
- {
- aString2.Erase();
- bSep=FALSE;
- aResult+=aString;
- }
- else if(eOp!=ocSpaces)
- {
- if(bSep)
- {
- aResult+=aString2;
- aString2.Erase();
- bSep=FALSE;
- }
- aResult+=aString;
- }
-
- const ScFuncDesc* pDesc= pFuncMgr->Get(aString);
+ pHdl->ViewShellGone(NULL); // -> aktive View neu holen
+ pHdl->ShowRefFrame();
+ }
- SaveLRUEntry(pDesc); //! is this necessary?? (EnterData updates the list)
+ // aktuelle Tabelle ggF. restaurieren (wg. Maus-RefInput)
+ ScTabViewShell* pScViewShell = PTR_CAST(ScTabViewShell, SfxViewShell::Current());
+ if ( pScViewShell )
+ {
+ ScViewData* pVD=pScViewShell->GetViewData();
+ SCTAB nExecTab = aCursorPos.Tab();
+ if ( nExecTab != pVD->GetTabNo() )
+ pScViewShell->SetTabNo( nExecTab );
- pToken=pNextToken;
- }
+ SCROW nRow=aCursorPos.Row();
+ SCCOL nCol=aCursorPos.Col();
+ if(pVD->GetCurX()!=nCol || pVD->GetCurY()!=nRow)
+ pScViewShell->SetCursor(nCol,nRow);
}
-
- return aResult;
}
-
-void ScFormulaDlg::HighlightFunctionParas(const String& aFormula)
+formula::FormEditData* ScFormulaDlg::getFormEditData() const
{
- ShowReference(aFormula);
+ ScModule* pScMod = SC_MOD();
+ return pScMod->GetFormEditData();
}
-
-void ScFormulaDlg::SaveLRUEntry(const ScFuncDesc* pFuncDescP)
+void ScFormulaDlg::setCurrentFormula(const String& _sReplacement)
{
- if (pFuncDescP && pFuncDescP->nFIndex!=0)
- {
- ScModule* pScMod = SC_MOD();
- pScMod->InsertEntryToLRUList(pFuncDescP->nFIndex);
- }
+ ScModule* pScMod = SC_MOD();
+ pScMod->InputReplaceSelection(_sReplacement);
}
-
-ScRefEdit* ScFormulaDlg::GetCurrRefEdit()
+void ScFormulaDlg::setSelection(xub_StrLen _nStart,xub_StrLen _nEnd)
{
- return aEdRef.IsVisible() ? &aEdRef : aScParaWin.GetActiveEdit();
+ ScModule* pScMod = SC_MOD();
+ pScMod->InputSetSelection( _nStart, _nEnd );
+}
+void ScFormulaDlg::getSelection(xub_StrLen& _nStart,xub_StrLen& _nEnd) const
+{
+ ScModule* pScMod = SC_MOD();
+ pScMod->InputGetSelection( _nStart, _nEnd );
+}
+String ScFormulaDlg::getCurrentFormula() const
+{
+ ScModule* pScMod = SC_MOD();
+ return pScMod->InputGetFormulaStr();
+}
+formula::IFunctionManager* ScFormulaDlg::getFunctionManager()
+{
+ return ScGlobal::GetStarCalcFunctionMgr();
+}
+uno::Reference< sheet::XFormulaParser> ScFormulaDlg::getFormulaParser() const
+{
+ return m_xParser;
+}
+uno::Reference< sheet::XFormulaOpCodeMapper> ScFormulaDlg::getFormulaOpCodeMapper() const
+{
+ return m_xOpCodeMapper;
+}
+::std::auto_ptr<formula::FormulaTokenArray> ScFormulaDlg::convertToTokenArray(const uno::Sequence< sheet::FormulaToken >& _aTokenList)
+{
+ ::std::auto_ptr<formula::FormulaTokenArray> pArray(new ScTokenArray());
+ pArray->Fill(_aTokenList);
+ return pArray;
}
-
diff --git a/sc/source/ui/formdlg/funcpage.cxx b/sc/source/ui/formdlg/funcpage.cxx
deleted file mode 100644
index 4d2570d5f4d1..000000000000
--- a/sc/source/ui/formdlg/funcpage.cxx
+++ /dev/null
@@ -1,253 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: funcpage.cxx,v $
- * $Revision: 1.7.32.1 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sc.hxx"
-
-
-
-//----------------------------------------------------------------------------
-
-#include "scitems.hxx"
-#include <sfx2/dispatch.hxx>
-#include <sfx2/docfile.hxx>
-#include <sfx2/objsh.hxx>
-#include <svtools/zforlist.hxx>
-#include <svtools/stritem.hxx>
-
-#include "funcpage.hxx"
-#include "formdlgs.hrc"
-#include "formdata.hxx"
-#include "globstr.hrc"
-#include "scresid.hxx"
-#include "reffact.hxx"
-#include "document.hxx"
-#include "cell.hxx"
-#include "scmod.hxx"
-#include "inputhdl.hxx"
-#include "tabvwsh.hxx"
-#include "appoptio.hxx"
-#include "funcdesc.hxx"
-
-//============================================================================
-
-ScListBox::ScListBox( Window* pParent, const ResId& rResId ):
- ListBox(pParent,rResId)
-{}
-
-void ScListBox::KeyInput( const KeyEvent& rKEvt )
-{
- KeyEvent aKEvt=rKEvt;
- //ListBox::KeyInput(rKEvt);
-
- if(aKEvt.GetCharCode()==' ')
- DoubleClick();
-}
-
-long ScListBox::PreNotify( NotifyEvent& rNEvt )
-{
- NotifyEvent aNotifyEvt=rNEvt;
-
- long nResult=ListBox::PreNotify(rNEvt);
-
- USHORT nSwitch=aNotifyEvt.GetType();
- if(nSwitch==EVENT_KEYINPUT)
- {
- KeyInput(*aNotifyEvt.GetKeyEvent());
- }
- return nResult;
-}
-
-
-
-//============================================================================
-
-inline USHORT Lb2Cat( USHORT nLbPos )
-{
- // Kategorie 0 == LRU, sonst Categories == LbPos-1
- if ( nLbPos > 0 )
- nLbPos -= 1;
-
- return nLbPos;
-}
-
-//============================================================================
-
-ScFuncPage::ScFuncPage(Window* pParent):
- TabPage(pParent,ScResId(RID_SCTAB_FUNCTION)),
- //
- aFtCategory ( this, ScResId( FT_CATEGORY ) ),
- aLbCategory ( this, ScResId( LB_CATEGORY ) ),
- aFtFunction ( this, ScResId( FT_FUNCTION ) ),
- aLbFunction ( this, ScResId( LB_FUNCTION ) ),
- aIBFunction ( this, ScResId( IB_FUNCTION ) )
-{
- FreeResource();
- InitLRUList();
- aLbCategory.SelectEntryPos(1);
- UpdateFunctionList();
- aLbCategory.SetSelectHdl( LINK( this, ScFuncPage, SelHdl ) );
- aLbFunction.SetSelectHdl( LINK( this, ScFuncPage, SelHdl ) );
- aLbFunction.SetDoubleClickHdl( LINK( this, ScFuncPage, DblClkHdl ) );
- aIBFunction.SetClickHdl( LINK( this, ScFuncPage, DblClkHdl ) );
-}
-
-void ScFuncPage::UpdateFunctionList()
-{
- USHORT nSelPos = aLbCategory.GetSelectEntryPos();
- USHORT nCategory = ( LISTBOX_ENTRY_NOTFOUND != nSelPos )
- ? Lb2Cat( nSelPos ) : 0;
-
- aLbFunction.Clear();
- aLbFunction.SetUpdateMode( FALSE );
- //------------------------------------------------------
-
- if ( nSelPos > 0 )
- {
- ScFunctionMgr* pFuncMgr = ScGlobal::GetStarCalcFunctionMgr();
-
- const ScFuncDesc* pDesc = pFuncMgr->First( nCategory );
- while ( pDesc )
- {
- aLbFunction.SetEntryData(
- aLbFunction.InsertEntry(*(pDesc->pFuncName) ),(void*)pDesc );
- pDesc = pFuncMgr->Next();
- }
- }
- else // LRU-Liste
- {
- for ( USHORT i=0; i<LRU_MAX && aLRUList[i]; i++ )
- {
- const ScFuncDesc* pDesc = aLRUList[i];
- aLbFunction.SetEntryData(
- aLbFunction.InsertEntry( *(pDesc->pFuncName) ),(void*)pDesc );
- }
- }
-
- //------------------------------------------------------
- aLbFunction.SetUpdateMode( TRUE );
- aLbFunction.SelectEntryPos(0);
-
- if(IsVisible()) SelHdl(&aLbFunction);
-}
-
-IMPL_LINK( ScFuncPage, SelHdl, ListBox*, pLb )
-{
- if(pLb==&aLbFunction)
- {
- aSelectionLink.Call(this);
- }
- else
- {
- UpdateFunctionList();
- }
- return 0;
-}
-
-IMPL_LINK( ScFuncPage, DblClkHdl, ListBox*, EMPTYARG )
-{
- aDoubleClickLink.Call(this);
- return 0;
-}
-
-void ScFuncPage::SetCategory(USHORT nCat)
-{
- aLbCategory.SelectEntryPos(nCat);
- UpdateFunctionList();
-}
-
-void ScFuncPage::SetFunction(USHORT nFunc)
-{
- aLbFunction.SelectEntryPos(nFunc);
-}
-
-void ScFuncPage::SetFocus()
-{
- aLbFunction.GrabFocus();
-}
-
-USHORT ScFuncPage::GetCategory()
-{
- return aLbCategory.GetSelectEntryPos();
-}
-
-USHORT ScFuncPage::GetFunction()
-{
- return aLbFunction.GetSelectEntryPos();
-}
-
-USHORT ScFuncPage::GetFunctionEntryCount()
-{
- return aLbFunction.GetSelectEntryCount();
-}
-
-const ScFuncDesc* ScFuncPage::GetFuncDesc( USHORT nPos ) const
-{
- // nicht schoen, aber hoffentlich selten
- return (const ScFuncDesc*) aLbFunction.GetEntryData(nPos);
-}
-
-USHORT ScFuncPage::GetFuncPos(const ScFuncDesc* pFuncDesc)
-{
- if(pFuncDesc!=NULL && pFuncDesc->pFuncName!=NULL)
- {
- return aLbFunction.GetEntryPos(*(pFuncDesc->pFuncName));
- }
- else
- {
- return LISTBOX_ENTRY_NOTFOUND;
- }
-}
-String ScFuncPage::GetSelFunctionName() const
-{
- return aLbFunction.GetSelectEntry();
-}
-
-void ScFuncPage::InitLRUList()
-{
- const ScAppOptions& rAppOpt = SC_MOD()->GetAppOptions();
- USHORT nLRUFuncCount = Min( rAppOpt.GetLRUFuncListCount(), (USHORT)LRU_MAX );
- USHORT* pLRUListIds = rAppOpt.GetLRUFuncList();
-
- USHORT i;
- for ( i=0; i<LRU_MAX; i++ )
- aLRUList[i] = NULL;
-
- if ( pLRUListIds )
- {
- ScFunctionMgr* pFuncMgr = ScGlobal::GetStarCalcFunctionMgr();
- for ( i=0; i<nLRUFuncCount; i++ )
- aLRUList[i] = pFuncMgr->Get( pLRUListIds[i] );
- }
-}
-
-
-
-
diff --git a/sc/source/ui/formdlg/funcutl.cxx b/sc/source/ui/formdlg/funcutl.cxx
deleted file mode 100644
index cdfac01eda8a..000000000000
--- a/sc/source/ui/formdlg/funcutl.cxx
+++ /dev/null
@@ -1,859 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: funcutl.cxx,v $
- * $Revision: 1.9.32.2 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sc.hxx"
-
-
-
-//----------------------------------------------------------------------------
-
-#include <vcl/sound.hxx>
-#include <vcl/svapp.hxx>
-
-#include "funcutl.hxx"
-
-
-//============================================================================
-// class ValWnd
-//----------------------------------------------------------------------------
-
-ValWnd::ValWnd( Window* pParent, const ResId& rId ) : Window( pParent, rId )
-{
- Font aFnt( GetFont() );
- aFnt.SetTransparent( TRUE );
- aFnt.SetWeight( WEIGHT_LIGHT );
- if ( pParent->IsBackground() )
- {
- Wallpaper aBack = pParent->GetBackground();
- SetFillColor( aBack.GetColor() );
- SetBackground( aBack );
- aFnt.SetFillColor( aBack.GetColor() );
- }
- else
- {
- SetFillColor();
- SetBackground();
- }
- SetFont( aFnt );
- SetLineColor();
-
- Size aSzWnd = GetOutputSizePixel();
- long nHeight = GetTextHeight();
- long nDiff = aSzWnd.Height()-nHeight;
-
- aRectOut = Rectangle( Point( 1, ( nDiff<2 ) ? 1 : nDiff/2),
- Size ( aSzWnd.Width()-2, nHeight ) );
- SetClipRegion( Region( aRectOut ) );
-}
-
-//----------------------------------------------------------------------------
-
-void __EXPORT ValWnd::Paint( const Rectangle& )
-{
- DrawText( aRectOut.TopLeft(), aStrValue );
-}
-
-//----------------------------------------------------------------------------
-
-void ValWnd::SetValue( const String& rStrVal )
-{
- if ( aStrValue != rStrVal )
- {
- aStrValue = rStrVal;
- DrawRect( aRectOut ); // alten Text loeschen