summaryrefslogtreecommitdiff
path: root/sc/source/core/inc
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2000-09-18 23:16:46 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2000-09-18 23:16:46 +0000
commitd0484bcdcbffd42d242647a2fdc1a203d176b775 (patch)
tree5a55e322eba52fffac58b43beb88568721d13a9b /sc/source/core/inc
parent9ae5a91f7955e44d3b24a3f7741f9bca02ac7f24 (diff)
initial import
Diffstat (limited to 'sc/source/core/inc')
-rw-r--r--sc/source/core/inc/addinlis.hxx145
-rw-r--r--sc/source/core/inc/adiasync.hxx127
-rw-r--r--sc/source/core/inc/bcaslot.hxx197
-rw-r--r--sc/source/core/inc/core_pch.hxx312
-rw-r--r--sc/source/core/inc/ddelink.hxx135
-rw-r--r--sc/source/core/inc/interpre.hxx721
-rw-r--r--sc/source/core/inc/makefile.mk61
-rw-r--r--sc/source/core/inc/refupdat.hxx120
-rw-r--r--sc/source/core/inc/sctictac.hxx164
9 files changed, 1982 insertions, 0 deletions
diff --git a/sc/source/core/inc/addinlis.hxx b/sc/source/core/inc/addinlis.hxx
new file mode 100644
index 000000000000..af34ef2a6cb9
--- /dev/null
+++ b/sc/source/core/inc/addinlis.hxx
@@ -0,0 +1,145 @@
+/*************************************************************************
+ *
+ * $RCSfile: addinlis.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-19 00:16:16 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef SC_ADDINLIS_HXX
+#define SC_ADDINLIS_HXX
+
+#ifndef _SC_ADIASYNC_HXX
+#include "adiasync.hxx" // for ScAddInDocs PtrArr
+#endif
+
+#ifndef _COM_SUN_STAR_SHEET_XRESULTLISTENER_HPP_
+#include <com/sun/star/sheet/XResultListener.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_SHEET_XVOLATILERESULT_HPP_
+#include <com/sun/star/sheet/XVolatileResult.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+
+#ifndef _CPPUHELPER_IMPLBASE2_HXX_
+#include <cppuhelper/implbase2.hxx>
+#endif
+
+
+
+class ScDocument;
+
+
+class ScAddInListener : public cppu::WeakImplHelper2<
+ com::sun::star::sheet::XResultListener,
+ com::sun::star::lang::XServiceInfo >,
+ public SfxBroadcaster
+{
+private:
+ com::sun::star::uno::Reference<com::sun::star::sheet::XVolatileResult> xVolRes;
+ com::sun::star::uno::Any aResult;
+ ScAddInDocs* pDocs; // documents where this is used
+
+ static List aAllListeners;
+
+ // always allocated via CreateListener
+ ScAddInListener(
+ com::sun::star::uno::Reference<
+ com::sun::star::sheet::XVolatileResult> xVR,
+ ScDocument* pD );
+
+public:
+ virtual ~ScAddInListener();
+
+ // create Listener and put it into global list
+ static ScAddInListener* CreateListener(
+ com::sun::star::uno::Reference<
+ com::sun::star::sheet::XVolatileResult> xVR,
+ ScDocument* pDoc );
+
+ static ScAddInListener* Get( com::sun::star::uno::Reference<
+ com::sun::star::sheet::XVolatileResult> xVR );
+ static void RemoveDocument( ScDocument* pDocument );
+
+ BOOL HasDocument( ScDocument* pDoc ) const { return pDocs->Seek_Entry( pDoc ); }
+ void AddDocument( ScDocument* pDoc ) { pDocs->Insert( pDoc ); }
+ const com::sun::star::uno::Any& GetResult() const { return aResult; }
+
+
+ // XResultListener
+ virtual void SAL_CALL modified( const ::com::sun::star::sheet::ResultEvent& aEvent )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( )
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
+ throw(::com::sun::star::uno::RuntimeException);
+};
+
+
+#endif
+
diff --git a/sc/source/core/inc/adiasync.hxx b/sc/source/core/inc/adiasync.hxx
new file mode 100644
index 000000000000..a51f1dd0aa99
--- /dev/null
+++ b/sc/source/core/inc/adiasync.hxx
@@ -0,0 +1,127 @@
+/*************************************************************************
+ *
+ * $RCSfile: adiasync.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-19 00:16:16 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SC_ADIASYNC_HXX
+#define _SC_ADIASYNC_HXX
+
+#ifndef _SFXBRDCST_HXX //autogen
+#include <svtools/brdcst.hxx>
+#endif
+
+#include "callform.hxx"
+
+extern "C" {
+void CALLTYPE ScAddInAsyncCallBack( double& nHandle, void* pData );
+}
+
+
+class ScAddInAsync;
+typedef ScAddInAsync* ScAddInAsyncPtr;
+SV_DECL_PTRARR_SORT( ScAddInAsyncs, ScAddInAsyncPtr, 4, 4 );
+extern ScAddInAsyncs theAddInAsyncTbl; // in adiasync.cxx
+
+class ScDocument;
+typedef ScDocument* ScAddInDocPtr;
+SV_DECL_PTRARR_SORT( ScAddInDocs, ScAddInDocPtr, 1, 1 );
+
+class String;
+
+class ScAddInAsync : public SfxBroadcaster
+{
+private:
+ union
+ {
+ double nVal; // aktueller Wert
+ String* pStr;
+ };
+ ScAddInDocs* pDocs; // Liste der benutzenden Dokumente
+ FuncData* pFuncData; // Zeiger auf die Daten in der Collection
+ ULONG nHandle; // wird von double auf ULONG gecasted
+ ParamType eType; // PTR_DOUBLE oder PTR_STRING Ergebnis
+ BOOL bValid; // ob Wert gueltig
+
+public:
+ // cTor nur wenn ScAddInAsync::Get fehlschlaegt!
+ // nIndex: Index aus der FunctionCollection
+ ScAddInAsync( ULONG nHandle, USHORT nIndex,
+ ScDocument* pDoc );
+ // default-cTor nur fuer das eine globale aSeekObj !!!
+ ScAddInAsync();
+ virtual ~ScAddInAsync();
+ static ScAddInAsync* Get( ULONG nHandle );
+ static void CallBack( ULONG nHandle, void* pData );
+ static void RemoveDocument( ScDocument* pDocument );
+ BOOL IsValid() const { return bValid; }
+ ParamType GetType() const { return eType; }
+ double GetValue() const { return nVal; }
+ const String& GetString() const { return *pStr; }
+ BOOL HasDocument( ScDocument* pDoc ) const
+ { return pDocs->Seek_Entry( pDoc ); }
+ void AddDocument( ScDocument* pDoc ) { pDocs->Insert( pDoc ); }
+
+ // Vergleichsoperatoren fuer PtrArrSort
+ BOOL operator < ( const ScAddInAsync& r ) { return nHandle < r.nHandle; }
+ BOOL operator ==( const ScAddInAsync& r ) { return nHandle == r.nHandle; }
+};
+
+
+
+#endif
diff --git a/sc/source/core/inc/bcaslot.hxx b/sc/source/core/inc/bcaslot.hxx
new file mode 100644
index 000000000000..3b7d4ec37ab5
--- /dev/null
+++ b/sc/source/core/inc/bcaslot.hxx
@@ -0,0 +1,197 @@
+/*************************************************************************
+ *
+ * $RCSfile: bcaslot.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-19 00:16:16 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SC_BCASLOT_HXX
+#define _SC_BCASLOT_HXX
+
+#ifndef _SFXBRDCST_HXX //autogen
+#include <svtools/brdcst.hxx>
+#endif
+#ifndef _SVARRAY_HXX //autogen
+#include <svtools/svarray.hxx>
+#endif
+
+#include "global.hxx"
+#include "brdcst.hxx"
+
+class ScBroadcastArea;
+class ScBroadcastAreaList;
+
+#define BCA_INITGROWSIZE 16
+typedef ScBroadcastArea* ScBroadcastAreaPtr;
+SV_DECL_PTRARR_SORT( ScBroadcastAreas, ScBroadcastAreaPtr,
+ BCA_INITGROWSIZE, BCA_INITGROWSIZE );
+
+// wird in einem nach Objekten sortierten SV_PTRARR_SORT benutzt
+class ScBroadcastArea : public ScRange, public SfxBroadcaster
+{
+private:
+ ScBroadcastArea* pUpdateChainNext;
+ USHORT nRefCount;
+ BOOL bInUpdateChain;
+
+public:
+ ScBroadcastArea( const ScRange& rRange )
+ : ScRange( rRange ), SfxBroadcaster(), pUpdateChainNext( NULL ),
+ nRefCount( 0 ), bInUpdateChain( FALSE ) {}
+ inline void UpdateRange( const ScRange& rNewRange )
+ { aStart = rNewRange.aStart; aEnd = rNewRange.aEnd; }
+ inline ScAddress GetStart() const { return aStart; }
+ inline ScAddress GetEnd() const { return aEnd; }
+ inline void IncRef() { ++nRefCount; }
+ inline USHORT DecRef() { return --nRefCount; }
+ inline ScBroadcastArea* GetUpdateChainNext() const { return pUpdateChainNext; }
+ inline void SetUpdateChainNext( ScBroadcastArea* p ) { pUpdateChainNext = p; }
+ inline BOOL IsInUpdateChain() const { return bInUpdateChain; }
+ inline void SetInUpdateChain( BOOL b ) { bInUpdateChain = b; }
+
+ // zur Sortierung wird die linke obere Ecke herangezogen,
+ // ist diese gleich, zaehlt auch die rechte untere Ecke
+ BOOL operator < ( const ScBroadcastArea& rArea ) const
+ { return aStart < rArea.aStart ||
+ (aStart == rArea.aStart && aEnd < rArea.aEnd) ; }
+ BOOL operator ==( const ScBroadcastArea& rArea ) const
+ { return aStart == rArea.aStart && aEnd == rArea.aEnd; }
+};
+class ScBroadcastAreaSlotMachine;
+
+// Sammlung von BroadcastAreas
+class ScBroadcastAreaSlot
+{
+private:
+ ScBroadcastAreas* pBroadcastAreaTbl;
+ ScBroadcastArea* pTmpSeekBroadcastArea; // fuer Seek_Entry
+ ScDocument* pDoc;
+ ScBroadcastAreaSlotMachine* pBASM;
+
+ USHORT FindBroadcastArea( const ScRange& rRange ) const;
+ ScBroadcastArea* GetBroadcastArea( const ScRange& rRange ) const;
+
+public:
+ ScBroadcastAreaSlot( ScDocument* pDoc,
+ ScBroadcastAreaSlotMachine* pBASM );
+ ~ScBroadcastAreaSlot();
+ const ScBroadcastAreas& GetBroadcastAreas() const
+ { return *pBroadcastAreaTbl; }
+ void StartListeningArea( const ScRange& rRange,
+ SfxListener* pListener,
+ ScBroadcastArea*& rpArea );
+ void EndListeningArea( const ScRange& rRange,
+ SfxListener* pListener,
+ ScBroadcastArea*& rpArea );
+ BOOL AreaBroadcast( const ScAddress& rAddress,
+ const ScHint& rHint ) const;
+ // return: mindestens ein Broadcast gewesen
+ void DelBroadcastAreasInRange( const ScRange& rRange );
+ void UpdateRemove( UpdateRefMode eUpdateRefMode,
+ const ScRange& rRange,
+ short nDx, short nDy, short nDz );
+ void UpdateInsert( ScBroadcastArea* pArea );
+};
+
+
+/*
+ BroadcastAreaSlots und deren Verwaltung, einmal je Dokument
+
+ +---+---+
+ | 0 | 2 | Anordnung Cols/Rows
+ +---+---+
+ | 1 | 3 |
+ +---+---+
+ */
+
+class ScBroadcastAreaSlotMachine
+{
+private:
+ ScBroadcastAreaSlot** ppSlots;
+ ScDocument* pDoc;
+ ScBroadcastAreaList* pBCAlwaysList; // fuer den RC_ALWAYS Spezialbereich
+ ScBroadcastArea* pUpdateChain;
+ ScBroadcastArea* pEOUpdateChain;
+
+ inline USHORT ComputeSlotOffset( const ScAddress& rAddress ) const;
+ void ComputeAreaPoints( const ScRange& rRange,
+ USHORT& nStart, USHORT& nEnd,
+ USHORT& nRowBreak ) const;
+
+public:
+ ScBroadcastAreaSlotMachine( ScDocument* pDoc );
+ ~ScBroadcastAreaSlotMachine();
+ void StartListeningArea( const ScRange& rRange,
+ SfxListener* pListener );
+ void EndListeningArea( const ScRange& rRange,
+ SfxListener* pListener );
+ BOOL AreaBroadcast( const ScAddress& rAddress,
+ const ScHint& rHint ) const;
+ // return: mindestens ein Broadcast gewesen
+ void DelBroadcastAreasInRange( const ScRange& rRange );
+ void UpdateBroadcastAreas( UpdateRefMode eUpdateRefMode,
+ const ScRange& rRange,
+ short nDx, short nDy, short nDz );
+ inline ScBroadcastArea* GetUpdateChain() const { return pUpdateChain; }
+ inline void SetUpdateChain( ScBroadcastArea* p ) { pUpdateChain = p; }
+ inline ScBroadcastArea* GetEOUpdateChain() const { return pEOUpdateChain; }
+ inline void SetEOUpdateChain( ScBroadcastArea* p ) { pEOUpdateChain = p; }
+};
+
+
+
+#endif
diff --git a/sc/source/core/inc/core_pch.hxx b/sc/source/core/inc/core_pch.hxx
new file mode 100644
index 000000000000..1586a5724e71
--- /dev/null
+++ b/sc/source/core/inc/core_pch.hxx
@@ -0,0 +1,312 @@
+/*************************************************************************
+ *
+ * $RCSfile: core_pch.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-19 00:16:16 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+// ItemID-Defines etc. muessen immer ganz vorne stehen
+
+#include "scitems.hxx"
+#include "eetext.hxx"
+
+#define ITEMID_FIELD EE_FEATURE_FIELD
+
+#define _ZFORLIST_DECLARE_TABLE
+
+#define SC_PROGRESS_CXX
+
+// ab hier automatisch per makepch generiert
+// folgende duerfen nicht aufgenommen werden:
+// setjmp.h
+
+#include <tools/solar.h>
+#include <string.h>
+#include <tools/string.hxx>
+#include <tools/rtti.hxx>
+#include <limits.h>
+#include <tools/ref.hxx>
+#include <tools/list.hxx>
+#include <tools/contnr.hxx>
+#include <tools/link.hxx>
+#include <tools/stream.hxx>
+#include <tools/errinf.hxx>
+#include <tools/errcode.hxx>
+#include <vcl/sv.h>
+#include <global.hxx>
+#include <vcl/color.hxx>
+#include <tools/lang.hxx>
+#include <tools/debug.hxx>
+#include <tools/gen.hxx>
+#include <svtools/svarray.hxx>
+#include <markarr.hxx>
+#include <vcl/timer.hxx>
+#include <rangelst.hxx>
+#include <document.hxx>
+#include <vcl/prntypes.hxx>
+#include <table.hxx>
+#include <column.hxx>
+#include <svtools/hint.hxx>
+#include <svtools/lstner.hxx>
+#include <svtools/args.hxx>
+#include <svtools/poolitem.hxx>
+#include <tools/time.hxx>
+#include <svtools/solar.hrc>
+#include <tools/date.hxx>
+#include <svtools/brdcst.hxx>
+#include <svx/svxids.hrc>
+#include <svtools/memberid.hrc>
+#include <sfx2/sfx.hrc>
+#include <sfx2/sfxsids.hrc>
+#include <svtools/cntwids.hrc>
+#include <tools/intn.hxx>
+#include <tools/resid.hxx>
+#include <tools/table.hxx>
+#include <stdarg.h>
+#include <vcl/rc.hxx>
+#include <tools/rc.hxx>
+#include <tools/resmgr.hxx>
+#include <vcl/resid.hxx>
+#include <tools/unqidx.hxx>
+#include <rsc/rscsfx.hxx>
+#include <svtools/sbxdef.hxx>
+#include <svtools/itemset.hxx>
+#include <stddef.h>
+#include <collect.hxx>
+#include <scitems.hxx>
+#include <tools/globname.hxx>
+#include <tools/fract.hxx>
+#include <sfx2/shell.hxx>
+#include <cell.hxx>
+#include <tools/mempool.hxx>
+#include <vcl/color.hxx>
+#include <vcl/region.hxx>
+#include <vcl/mapmod.hxx>
+#include <vcl/bitmap.hxx>
+#include <svtools/eitem.hxx>
+#include <svtools/intitem.hxx>
+#include <sot/object.hxx>
+#include <sot/factory.hxx>
+#include <sot/sotdata.hxx>
+#include <vcl/keycod.hxx>
+#include <vcl/keycodes.hxx>
+#include <sot/sotref.hxx>
+#include <rechead.hxx>
+#include <tools/unqid.hxx>
+#include <vcl/apptypes.hxx>
+#include <vcl/fonttype.hxx>
+#include <globstr.hrc>
+#include <compiler.hrc>
+#include <tools/shl.hxx>
+#include <compiler.hxx>
+#include <vcl/font.hxx>
+#include <svtools/smplhint.hxx>
+#include <vcl/wall.hxx>
+#include <vcl/settings.hxx>
+#include <vcl/accel.hxx>
+#include <vcl/gdiobj.hxx>
+#include <patattr.hxx>
+#include <svtools/zforlist.hxx>
+#include <tools/pstm.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/outdev.hxx>
+#include <vcl/pointr.hxx>
+#include <vcl/ptrstyle.hxx>
+#include <vcl/wintypes.hxx>
+#include <vcl/event.hxx>
+#include <sot/dtrans.hxx>
+#include <tools/ownlist.hxx>
+#include <svtools/itempool.hxx>
+#include <tools/datetime.hxx>
+#include <so3/factory.hxx>
+#include <so3/so2dll.hxx>
+#include <so3/iface.hxx>
+#include <attrib.hxx>
+#include <so3/so2ref.hxx>
+#include <so3/persist.hxx>
+#include <docpool.hxx>
+#include <sot/storage.hxx>
+#include <so3/so2defs.hxx>
+#include <sfx2/objsh.hxx>
+#include <vcl/window.hxx>
+#include <sfx2/cfgitem.hxx>
+#include <svtools/confitem.hxx>
+#include <vcl/syswin.hxx>
+#include <sc.hrc>
+#include <svx/dialogs.hrc>
+#include <math.h>
+#include <svtools/style.hxx>
+#include <svtools/style.hrc>
+#include <stdlib.h>
+#include <vcl/prntypes.hxx>
+#include <vcl/jobset.hxx>
+#include <vcl/gdimtf.hxx>
+//#include <setjmp.h>
+#include <tools/urlobj.hxx>
+#include <vcl/print.hxx>
+#include <docoptio.hxx>
+#include <markdata.hxx>
+#include <vcl/system.hxx>
+#include <vcl/wrkwin.hxx>
+#include <stlpool.hxx>
+#include <sfx2/app.hxx>
+#include <svtools/inetmsg.hxx>
+#include <svtools/compat.hxx>
+#include <svtools/inetdef.hxx>
+#include <svtools/inethist.hxx>
+#include <svtools/cancel.hxx>
+#include <vcl/accel.hxx>
+#include <sfx2/sfxdefs.hxx>
+#include <sfx2/module.hxx>
+#include <sfx2/imgdef.hxx>
+#include <segmentc.hxx>
+#include <tcov.hxx>
+#include <vcl/ctrl.hxx>
+#include <vcl/field.hxx>
+#include <vcl/spinfld.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/timer.hxx>
+#include <vcl/combobox.hxx>
+#include <vcl/combobox.h>
+#include <refupdat.hxx>
+#include <svx/boxitem.hxx>
+#include <conditio.hxx>
+#include <brdcst.hxx>
+#include <svx/svxenum.hxx>
+#include <dociter.hxx>
+#include <scdll.hxx>
+#include <stdio.h>
+#include <stlsheet.hxx>
+#include <vcl/gdiobj.hxx>
+#include <vcl/mapmod.hxx>
+#include <progress.hxx>
+#include <sfx2/progress.hxx>
+#include <so3/dtrans.hxx>
+#include <vcl/event.hxx>
+#include <vcl/window.hxx>
+#include <so3/advise.hxx>
+#include <svx/algitem.hxx>
+#include <scspew.hxx>
+#include <vcl/field.hxx>
+#include <svx/svdtypes.hxx>
+#include <vcl/graph.hxx>
+#include <vcl/bitmapex.hxx>
+#include <vcl/animate.hxx>
+#include <vcl/graph.h>
+#include <drwlayer.hxx>
+#include <svx/svdmodel.hxx>
+#include <scresid.hxx>
+#include <vcl/print.hxx>
+#include <attarray.hxx>
+#include <so3/pseudo.hxx>
+#include <svtools/ownlist.hxx>
+#include <interpre.hxx>
+#include <subtotal.hxx>
+#include <rangenam.hxx>
+#include <scmatrix.hxx>
+#include <svx/pageitem.hxx>
+#include <dbcolect.hxx>
+#include <userlist.hxx>
+#include <svx/editdata.hxx>
+#include <svtools/sbxvar.hxx>
+#include <svtools/sbxcore.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdsob.hxx>
+#include <svx/svdglue.hxx>
+#include <svx/langitem.hxx>
+#include <svx/eeitem.hxx>
+#include <callform.hxx>
+#include <validat.hxx>
+#include <so3/linkmgr.hxx>
+#include <svx/brshitem.hxx>
+#include <so3/lnkbase.hxx>
+#include <vcl/exchange.hxx>
+#include <sot/exchange.hxx>
+#include <so3/linkname.hxx>
+#include <so3/moniker.hxx>
+#include <svx/editeng.hxx>
+#include <vcl/fonttype.hxx>
+#include <svx/editobj.hxx>
+#include <svx/wghtitem.hxx>
+#include <svx/fhgtitem.hxx>
+#include <svtools/stritem.hxx>
+#include <pivot.hxx>
+#include <vcl/gdimtf.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdlayer.hxx>
+#include <svx/linkmgr.hxx>
+#include <ctype.h>
+#include <vcl/font.hxx>
+#include <svx/fontitem.hxx>
+#include <svx/postitem.hxx>
+#include <so3/protocol.hxx>
+#include <svx/svditer.hxx>
+#include <svx/udlnitem.hxx>
+#include <adiasync.hxx>
+#include <sfx2/bindings.hxx>
+#include <ddelink.hxx>
+#include <chartlis.hxx>
+#include <sfx2/minarray.hxx>
+#include <svtools/iniman.hxx>
+#include <svtools/txtcmp.hxx>
+#include <olinetab.hxx>
+#include <svtools/sbxobj.hxx>
+#include <cfgids.hxx>
+
+
+
+
diff --git a/sc/source/core/inc/ddelink.hxx b/sc/source/core/inc/ddelink.hxx
new file mode 100644
index 000000000000..463a1903cb33
--- /dev/null
+++ b/sc/source/core/inc/ddelink.hxx
@@ -0,0 +1,135 @@
+/*************************************************************************
+ *
+ * $RCSfile: ddelink.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-19 00:16:16 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef SC_DDELINK_HXX
+#define SC_DDELINK_HXX
+
+#ifndef _LNKBASE_HXX //autogen
+#include <so3/lnkbase.hxx>
+#endif
+#ifndef _SFXBRDCST_HXX //autogen
+#include <svtools/brdcst.hxx>
+#endif
+
+class ScDocument;
+class ScMatrix;
+class ScMultipleReadHeader;
+class ScMultipleWriteHeader;
+
+#define SC_DDE_DEFAULT 0
+#define SC_DDE_ENGLISH 1
+#define SC_DDE_TEXT 2
+
+class ScDdeLink : public SvBaseLink, public SfxBroadcaster
+{
+private:
+static BOOL bIsInUpdate;
+
+ ScDocument* pDoc;
+
+ String aAppl; // Verbindungsdaten
+ String aTopic;
+ String aItem;
+ BYTE nMode; // Zahlformat-Modus
+
+ BOOL bNeedUpdate; // wird gesetzt, wenn Update nicht moeglich war
+
+ ScMatrix* pResult; // Ergebnis
+
+public:
+ TYPEINFO();
+
+ ScDdeLink( ScDocument* pD,
+ const String& rA, const String& rT, const String& rI,
+ BYTE nM );
+ ScDdeLink( ScDocument* pD, SvStream& rStream, ScMultipleReadHeader& rHdr );
+ ScDdeLink( ScDocument* pD, const ScDdeLink& rOther );
+ virtual ~ScDdeLink();
+
+ void Store( SvStream& rStream, ScMultipleWriteHeader& rHdr ) const;
+
+ // von SvBaseLink ueberladen:
+ virtual void Closed();
+ virtual void DataChanged( SvData& );
+
+ // von SfxBroadcaster ueberladen:
+ virtual void ListenersGone();
+
+ // fuer Interpreter:
+
+ const ScMatrix* GetResult() const { return pResult; }
+
+ const String& GetAppl() const { return aAppl; }
+ const String& GetTopic() const { return aTopic; }
+ const String& GetItem() const { return aItem; }
+ BYTE GetMode() const { return nMode; }
+
+ void ResetValue(); // Wert zuruecksetzen
+ void TryUpdate();
+
+ BOOL NeedsUpdate() const { return bNeedUpdate; }
+
+ static BOOL IsInUpdate() { return bIsInUpdate; }
+};
+
+
+#endif
+
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
new file mode 100644
index 000000000000..3c8bc3b1b7dd
--- /dev/null
+++ b/sc/source/core/inc/interpre.hxx
@@ -0,0 +1,721 @@
+/*************************************************************************
+ *
+ * $RCSfile: interpre.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-19 00:16:16 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef SC_INTERPRE_HXX
+#define SC_INTERPRE_HXX
+
+#define SC_SPEW_ENABLED 0
+
+#include <math.h>
+
+#include <tools/solmath.hxx> // SOMA_FPSIGNAL_JUMP
+
+#include "compiler.hxx"
+#include "cell.hxx"
+#include "scdll.hxx"
+#if SC_SPEW_ENABLED
+#include "scspew.hxx"
+#endif
+
+class ScDocument;
+class ScMatrix;
+class SbxVariable;
+class ScBaseCell;
+class ScFormulaCell;
+class SvNumberFormatter;
+
+#define MAX_ANZ_MAT 150
+ // Maximale Anzahl fuer Zwischenergebnis
+ // Matrizen
+ // Maximum ca. 85 wird bei Invertierung
+ // von 128 x 128 benoetigt!
+
+
+#ifndef MSC
+ #include <setjmp.h>
+#else
+ extern "C"
+ {
+ #define _JBLEN 9 /* bp, di, si, sp, ret addr, ds */
+ typedef int jmp_buf[_JBLEN];
+ #define _JMP_BUF_DEFINED
+ #define setjmp _setjmp
+ int __cdecl _setjmp(jmp_buf);
+ void __cdecl longjmp(jmp_buf, int);
+ };
+#endif
+
+#ifndef _TABOPLIST_DECLARED
+#define _TABOPLIST_DECLARED
+DECLARE_LIST (TabOpList, USHORT*);
+#endif
+
+struct ScCompare
+{
+ double nVal[2];
+ String* pVal[2];
+ BOOL bVal[2];
+ BOOL bEmpty[2];
+ ScCompare( String* p1, String* p2 )
+ {
+ pVal[ 0 ] = p1;
+ pVal[ 1 ] = p2;
+ bEmpty[0] = FALSE;
+ bEmpty[1] = FALSE;
+ }
+};
+
+struct ScToken;
+
+#define MAXSTACK (4096 / sizeof(ScToken*))
+
+class ScTokenStack
+{
+public:
+ DECL_FIXEDMEMPOOL_NEWDEL( ScTokenStack )
+ ScToken* pPointer[ MAXSTACK ];
+};
+
+class ScErrorStack
+{
+public:
+ DECL_FIXEDMEMPOOL_NEWDEL( ScErrorStack )
+ USHORT pPointer[ MAXSTACK ];
+};
+
+enum ScIterFunc {
+ ifSUM, // Aufsummieren
+ ifSUMSQ, // Quadratsummen
+ ifPRODUCT, // Multiplizieren
+ ifAVERAGE, // Durchschnitt
+ ifCOUNT, // Anzahl Werte
+ ifCOUNT2, // Anzahl Werte (nichtleer)
+ ifMIN, // Minimum
+ ifMAX // Maximum
+};
+
+class ScInterpreter
+{
+public:
+ DECL_FIXEDMEMPOOL_NEWDEL( ScInterpreter )
+#if SOMA_FPSIGNAL_JUMP
+ static jmp_buf* pJumpBuf; // fuer die mySignal-Funktion
+ static ScLibSignalFunc pSignalFunc; // signal() Wrapper der App
+#endif
+ static USHORT nGlobalError; // globale Fehlervariable
+ static ULONG nInterpCount; // Zaehlt aktuelle Interpreteraufrufe
+ static TabOpList aTableOpList; // Liste von Ref-Arrays fuer Mehrfachoperat.
+#if SC_SPEW_ENABLED
+ static ScSpew theSpew;
+#endif
+
+ static void GlobalExit(); // aus ScGlobal::Clear() gerufen
+ static BOOL MayBeRegExp( const String& ); // vielleicht regular expression?
+private:
+ static ScTokenStack* pGlobalStack;
+ static ScErrorStack* pGlobalErrorStack;
+ static BOOL bGlobalStackInUse;
+ static const sal_Unicode cEmptyString; // =0 for return &cEmptyString
+
+ ScTokenIterator aCode;
+ ScAddress aPos;
+ ScTokenArray& rArr;
+ String aResult;
+ ScDocument* pDok; // Pointer aufs Dokument
+ double nResult;
+ ScMatrix* pResult;
+ ScFormulaCell* pMyFormulaCell; // die Zelle mit der Formel
+ SvNumberFormatter* pFormatter;
+ StackVar eResult;
+
+ USHORT nGlobError; // lokale Kopie
+#if SOMA_FPSIGNAL_JUMP
+ jmp_buf* pLocalJumpBuf; // lokale Kopie
+#endif
+ const ScToken* pCur; // aktuelles Token
+ String aTempStr; // fuer GetString()
+ ScTokenStack* pStackObj; // enthaelt den Stack
+ ScToken** pStack; // der Stack
+ ScErrorStack* pErrorStackObj; // enthaelt den ErrorStack
+ USHORT* pErrorStack; // der ErrorStack
+ USHORT sp; // der Stackpointer
+ USHORT maxsp; // der maximale StackPointer
+ double** ppGlobSortArray; // Pointer auf Array zum Sortieren
+ USHORT* pTableOp; // der lokale Pointer auf das aktuelle TableOp
+ ScMatrix** ppTempMatArray; // Array fuer temporaere Matrizen
+ USHORT nMatCount; // dazugehoeriger Zaehler
+ BOOL bMatDel; // und Kontrollvariable
+ USHORT nRetMat; // Index der Return-Matrix
+ ULONG nFuncFmtIndex; // NumberFormatIndex einer Funktion
+ ULONG nCurFmtIndex; // aktueller NumberFormatIndex
+ ULONG nRetFmtIndex; // ggbf. NumberFormatIndex des Ausdrucks
+ short nFuncFmtType; // NumberFormatTyp einer Funktion
+ short nCurFmtType; // aktueller NumberFormatTyp
+ short nRetFmtType; // NumberFormatTyp des Ausdrucks
+ BOOL glSubTotal; // Flag fuer Subtotalfunktionen
+ BYTE cPar; // aktuelle Anzahl Parameter
+ BOOL bCalcAsShown; // Genauigkeit wie angezeigt
+ BOOL bMatrixFormula; // Formelzelle ist Matrixformel
+
+//---------------------------------Funktionen in interpre.cxx---------
+// nMust <= nAct <= nMax ? ok : SetError, PushInt
+inline BOOL MustHaveParamCount( BYTE nAct, BYTE nMust );
+inline BOOL MustHaveParamCount( BYTE nAct, BYTE nMust, BYTE nMax );
+inline BOOL MustHaveParamCountMin( BYTE nAct, BYTE nMin );
+void SetParameterExpected();
+void SetIllegalParameter();
+void SetIllegalArgument();
+void SetNoValue();
+void SetNV();
+//-------------------------------------------------------------------------
+// Funktionen für den Zugriff auf das Document
+//-------------------------------------------------------------------------
+void ReplaceCell( ScAddress& ); // fuer MehrfachOp.
+ULONG GetCellNumberFormat( const ScAddress&, const ScBaseCell* );
+double GetCellValue( const ScAddress&, const ScBaseCell* );
+double GetCellValueOrZero( const ScAddress&, const ScBaseCell* );
+double GetValueCellValue( const ScAddress&, const ScValueCell* );
+ScBaseCell* GetCell( const ScAddress& );
+void GetCellString( String& rStr, const ScBaseCell* pCell );
+USHORT GetCellErrCode( const ScBaseCell* pCell );
+inline CellType GetCellType( const ScBaseCell* pCell )
+ { return pCell ? pCell->GetCellType() : CELLTYPE_NONE; }
+inline BOOL HasCellValueData( const ScBaseCell* pCell )
+ { return pCell ? pCell->HasValueData() : FALSE; }
+inline BOOL HasCellStringData( const ScBaseCell* pCell )
+ { return pCell ? pCell->HasStringData() : FALSE; }
+BOOL CreateDoubleArr(USHORT nCol1, USHORT nRow1, USHORT nTab1,
+ USHORT nCol2, USHORT nRow2, USHORT nTab2, BYTE* pCellArr);
+BOOL CreateStringArr(USHORT nCol1, USHORT nRow1, USHORT nTab1,
+ USHORT nCol2, USHORT nRow2, USHORT nTab2, BYTE* pCellArr);
+BOOL CreateCellArr(USHORT nCol1, USHORT nRow1, USHORT nTab1,
+ USHORT nCol2, USHORT nRow2, USHORT nTab2, BYTE* pCellArr);
+//-----------------------------------------------------------------------------
+// Stackoperationen
+//-----------------------------------------------------------------------------
+void Push( ScToken& r );
+void PushTempToken( const ScToken& );
+void PushTempToken( ScDoubleToken* ); //! see warnings in interpr4.cxx
+void Pop();
+void PopError();
+BYTE PopByte();
+double PopDouble();
+const sal_Unicode* PopString();
+void PopSingleRef( ScAddress& );
+void PopSingleRef(USHORT& rCol, USHORT &rRow, USHORT& rTab);
+void PopDoubleRef( ScRange& );
+void PopDoubleRef(USHORT& rCol1, USHORT &rRow1, USHORT& rTab1,
+ USHORT& rCol2, USHORT &rRow2, USHORT& rTab2);
+BOOL PopDoubleRefOrSingleRef( ScAddress& rAdr );
+void PopDoubleRefPushMatrix();
+inline void MatrixDoubleRefToMatrix(); // wenn MatrixFormula: PopDoubleRefPushMatrix
+ScMatrix* PopMatrix();
+//void PushByte(BYTE nVal);
+void PushDouble(double nVal);
+void PushInt( int nVal );
+void PushString(const sal_Unicode* cString);
+void PushStringObject(const String& aString);
+void PushSingleRef(USHORT nCol, USHORT nRow, USHORT nTab);
+void PushDoubleRef(USHORT nCol1, USHORT nRow1, USHORT nTab1,
+ USHORT nCol2, USHORT nRow2, USHORT nTab2);
+void PushMatrix(ScMatrix* pMat);
+BYTE GetStackType();
+// peek StackType of Parameter, Parameter 1 == TOS, 2 == TOS-1, ...
+StackVar GetStackType( BYTE nParam );
+BYTE GetByte() { return cPar; }
+/*
+short GetShort();
+double GetLong();
+*/
+// generiert aus DoubleRef positionsabhaengige SingleRef
+BOOL DoubleRefToPosSingleRef( const ScRange& rRange, ScAddress& rAdr );
+double GetDouble();
+BOOL GetBool() { return GetDouble() != 0.0; }
+const sal_Unicode* GetString();
+ScMatrix* GetMatrix(USHORT& nMatInd); // in interpr2.cxx
+void ScTableOp(); // Mehrfachoperationen
+void ScErrCell(); // Sonderbehandlung
+ // Fehlerzelle
+void ScDefPar(); // DefaultParameter
+//-----------------------------allgemeine Hilfsfunktionen
+void SetMaxIterationCount(USHORT n);
+inline void CurFmtToFuncFmt()
+ { nFuncFmtType = nCurFmtType; nFuncFmtIndex = nCurFmtIndex; }
+//---------------------------------Funktionen in interpr1.cxx---------
+//-----------------------------Textfunktionen
+void ScIfJump();
+void ScChoseJump();
+short CompareFunc( const ScCompare& rComp );
+short Compare();
+ScMatrix* CompareMat();
+void ScEqual();
+void ScNotEqual();
+void ScLess();
+void ScGreater();
+void ScLessEqual();
+void ScGreaterEqual();
+void ScAnd();
+void ScOr();
+void ScNot();
+void ScNeg();
+void ScIntersect();
+void ScPi();
+void ScRandom();
+void ScTrue();
+void ScFalse();
+void ScDeg();
+void ScRad();
+void ScSin();
+void ScCos();
+void ScTan();
+void ScCot();
+void ScArcSin();
+void ScArcCos();
+void ScArcTan();
+void ScArcCot();
+void ScSinHyp();
+void ScCosHyp();
+void ScTanHyp();
+void ScCotHyp();
+void ScArcSinHyp();
+void ScArcCosHyp();
+void ScArcTanHyp();
+void ScArcCotHyp();
+void ScExp();
+void ScLn();
+void ScLog10();
+void ScSqrt();
+void ScIsEmpty();
+short IsString();
+void ScIsString();
+void ScIsNonString();
+void ScIsLogical(UINT16 aOldNumType);
+void ScType();
+void ScIsRef();
+void ScIsValue();
+void ScIsFormula();
+void ScFormula();
+void ScIsNV();
+void ScIsErr();
+void ScIsError();
+short IsEven();
+void ScIsEven();
+void ScIsOdd();
+void ScN();
+void ScCode();
+void ScTrim();
+void ScUpper();
+void ScPropper();
+void ScLower();
+void ScLen();
+void ScT();
+void ScValue();
+void ScClean();
+void ScChar();
+void ScMin( BOOL bTextAsZero = FALSE );
+void ScMax( BOOL bTextAsZero = FALSE );
+double IterateParameters( ScIterFunc, BOOL bTextAsZero = FALSE );
+void ScSumSQ();
+void ScSum();
+void ScProduct();
+void ScAverage( BOOL bTextAsZero = FALSE );
+void ScCount();
+void ScCount2();
+void GetStVarParams( double& rVal, double& rValCount, BOOL bTextAsZero = FALSE );
+void ScVar( BOOL bTextAsZero = FALSE );
+void ScVarP( BOOL bTextAsZero = FALSE );
+void ScStDev( BOOL bTextAsZero = FALSE );
+void ScStDevP( BOOL bTextAsZero = FALSE );
+void ScColumns();
+void ScRows();
+void ScTables();
+void ScColumn();
+void ScRow();
+void ScTable();
+void ScMatch();
+void ScCountIf();
+void ScSumIf();
+void ScCountEmptyCells();
+void ScLookup();
+void ScHLookup();
+void ScVLookup();
+void ScSubTotal();
+BOOL GetDBParams(USHORT& rTab, ScQueryParam& rParam);
+void DBIterator( ScIterFunc );
+void ScDBSum();
+void ScDBCount();
+void ScDBCount2();
+void ScDBAverage();
+void ScDBGet();
+void ScDBMax();
+void ScDBMin();
+void ScDBProduct();
+ULONG StdDev( double& rSum, double& rSum2 );
+void ScDBStdDev();
+void ScDBStdDevP();
+void ScDBVar();
+void ScDBVarP();
+void ScIndirect();
+void ScAdress();
+void ScOffset();
+void ScIndex();
+void ScMultiArea();
+void ScAreas();
+void ScCurrency();
+void ScReplace();
+void ScFixed();
+void ScFind();
+void ScExact();
+void ScLeft();
+void ScRight();
+void ScSearch();
+void ScMid();
+void ScText();
+void ScSubstitute();
+void ScRept();
+void ScConcat();
+void ScExternal();
+void ScMissing();
+void ScMacro();
+BOOL SetSbxVariable( SbxVariable* pVar, const ScAddress& );
+BOOL SetSbxVariable( SbxVariable* pVar, USHORT nCol, USHORT nRow, USHORT nTab );
+void ScErrorType();
+void ScDBArea();
+void ScColRowNameAuto();
+void ScCalcTeam();
+void ScAnswer();
+void ScTTT();
+void ScSpewFunc();
+void ScGame();
+
+//----------------Funktionen in interpr2.cxx---------------
+double GetDate(INT16 nYear, INT16 nMonth, INT16 nDay);
+void ScGetActDate();
+void ScGetActTime();
+void ScGetYear();
+void ScGetMonth();
+void ScGetDay();
+void ScGetDayOfWeek();
+void ScGetWeekOfYear();
+void ScEasterSunday();
+void ScGetHour();
+void ScGetMin();
+void ScGetSec();
+void ScPlusMinus();
+void ScAbs();
+void ScInt();
+void ScEven();
+void ScOdd();
+void ScCeil();
+void ScFloor();
+void RoundNumber( SolarMathRoundingMode eMode );
+void ScRound();
+void ScRoundUp();
+void ScRoundDown();
+void ScGetDateValue();
+void ScGetTimeValue();
+void ScArcTan2();
+void ScLog();
+void ScGetDate();
+void ScGetTime();
+void ScGetDiffDate();
+void ScGetDiffDate360();
+void ScNBW();
+void ScIKV();
+void ScPower();
+void ScAmpersand();
+void ScAdd();
+void ScSub();
+void ScMul();
+void ScDiv();
+void ScPow();
+void ScCurrent();
+void ScStyle();
+void ScDde();
+void ScBase();
+void ScDecimal();
+void ScConvert();
+
+//----------------------- Finanzfunktionen ------------------------------------
+double ScGetBw(double fZins, double fZzr, double fRmz,
+ double fZw, double fF);
+void ScBW();
+void ScDIA();
+double ScGetGDA(double fWert, double fRest, double fDauer,
+ double fPeriode, double fFaktor);
+void ScGDA();
+void ScGDA2();
+double ScInterVDB(double fWert,double fRest,double fDauer,double fDauer1,
+ double fPeriode,double fFaktor);
+void ScVDB();
+void ScLaufz();
+void ScLIA();
+double ScGetRmz(double fZins, double fZzr, double fBw,
+ double fZw, double fF);
+void ScRMZ();
+void ScZGZ();
+double ScGetZw(double fZins, double fZzr, double fRmz,
+ double fBw, double fF);
+void ScZW();
+void ScZZR();
+double GetZinsIterationEps(double fZzr, double fRmz, double fBw, double fZw,
+ double fF, double& fSchaetzwert);
+void ScZins();
+double ScGetZinsZ(double fZins, double fZr, double fZzr, double fBw,
+ double fZw, double fF, double& fRmz);
+void ScZinsZ();
+void ScKapz();
+void ScKumZinsZ();
+void ScKumKapZ();
+void ScEffektiv();
+void ScNominal();
+void ScMod();
+void ScBackSolver();
+void ScIntercept();
+//-------------------------Funktionen in interpr5.cxx--------------------------
+double ScGetGGT(double fx, double fy);
+void ScGGT();
+void ScKGV();
+//-------------------------- Matrixfunktionen ---------------------------------
+ScMatrix* GetNewMat(USHORT nC, USHORT nR, USHORT& nMatInd);
+void ResetNewMat(USHORT nIndex);
+void ScMatValue();
+void MEMat(ScMatrix* mM, USHORT n);
+void MFastMult(ScMatrix* pA, ScMatrix* pB, ScMatrix* pR, USHORT n, USHORT m, USHORT l);
+void MFastSub(ScMatrix* pA, ScMatrix* pB, ScMatrix* pR, USHORT n, USHORT m);
+void MFastTrans(ScMatrix* pA, ScMatrix* pR, USHORT n, USHORT m);
+BOOL MFastBackSubst(ScMatrix* pA, ScMatrix* pR, USHORT n, BOOL bIsUpper);
+BOOL ScMatLUP(ScMatrix* mA, USHORT m, USHORT p,
+ ScMatrix* mL, ScMatrix* mU, ScMatrix* mP,
+ USHORT& rPermutCounter, BOOL& bIsInvertable);
+void ScMatDet();
+void ScMatInv();
+void ScMatMult();
+void ScMatTrans();
+void ScEMat();
+void ScMatRef();
+ScMatrix* MatAdd(ScMatrix* pMat1, ScMatrix* pMat2);
+ScMatrix* MatSub(ScMatrix* pMat1, ScMatrix* pMat2);
+ScMatrix* MatMul(ScMatrix* pMat1, ScMatrix* pMat2);
+ScMatrix* MatDiv(ScMatrix* pMat1, ScMatrix* pMat2);
+ScMatrix* MatPow(ScMatrix* pMat1, ScMatrix* pMat2);
+ScMatrix* MatConcat(ScMatrix* pMat1, ScMatrix* pMat2);
+void ScSumProduct();
+void ScSumX2MY2();
+void ScSumX2DY2();
+void ScSumXMY2();
+void ScGrowth();
+// multiple Regression: Varianzen der Koeffizienten
+BOOL RGetVariances( ScMatrix* pV, ScMatrix* pX, USHORT nC, USHORT nR,
+ BOOL bSwapColRow, BOOL bZeroConstant );
+void ScRGP();
+void ScRKP();
+void ScForecast();
+//--------------------------------------------------------------------------------
+// Funktionen in interpr3.cxx
+// Statistik:
+void ScNoName();
+double phi(double x);
+double taylor(double* pPolynom, USHORT nMax, double x);
+double gauss(double x);
+double gaussinv(double x);
+double GetGammaDist(double x, double alpha, double beta);
+double GetBetaDist(double x, double alpha, double beta);
+double GetChiDist(double fChi, double fDF);
+double GetFDist(double x, double fF1, double fF2);
+double GetTDist(double T, double fDF);
+double Fakultaet(double x);
+double BinomKoeff(double n, double k);
+double GammaHelp(double& x, BOOL& bReflect);
+double GetGamma(double x);
+double GetLogGamma(double x);
+void ScLogGamma();
+void ScPhi();
+void ScGauss();
+void ScStdNormDist();
+void ScFisher();
+void ScFisherInv();
+void ScFact();
+void ScNormDist();
+void ScGammaDist();
+void ScGammaInv();
+void ScExpDist();
+void ScBinomDist();
+void ScPoissonDist();
+void ScKombin();
+void ScKombin2();
+void ScVariationen();
+void ScVariationen2();
+void ScB();
+void ScHypGeomDist();
+void ScLogNormDist();
+void ScLogNormInv();
+void ScTDist();
+void ScFDist();
+void ScChiDist();
+void ScWeibull();
+void ScBetaDist();
+void ScFInv();
+void ScTInv();
+void ScChiInv();
+void ScBetaInv();
+void ScCritBinom();
+void ScNegBinomDist();
+void ScKurt();
+void ScHarMean();
+void ScGeoMean();
+void ScStandard();
+void ScSkew();
+void ScMedian();
+void GetSortArray(BYTE nParamCount, double** ppSortArray, ULONG& nSize);
+void QuickSort(long nLo, long nHi, double* pSortArr);
+void ScModalValue();
+void ScAveDev();
+void ScDevSq();
+void ScZTest();
+void ScTTest();
+void ScFTest();
+void ScChiTest();
+void ScRank();
+void ScPercentile();
+void ScPercentrank();
+void ScLarge();
+void ScSmall();
+void ScFrequency();
+void ScQuartile();
+void ScNormInv();
+void ScSNormInv();
+void ScConfidence();
+void ScTrimMean();
+void ScProbability();
+void ScCorrel();
+void ScCovar();
+void ScPearson();
+void ScRSQ();
+void ScSTEXY();
+void ScSlope();
+void ScTrend();
+
+
+public:
+ ScInterpreter( ScFormulaCell* pCell, ScDocument* pDoc,
+ const ScAddress&, ScTokenArray& );
+ ~ScInterpreter();
+
+ StackVar Interpret();
+
+ static void SetError(USHORT nError)
+ { if (nError && !nGlobalError) nGlobalError = nError; }
+
+ static USHORT GetError() { return nGlobalError; }
+ static void MySigFunc(int sig);
+
+ const String& GetStringResult() { return aResult; }
+ double GetNumResult() { return nResult; }
+ ScMatrix* GetMatrixResult() { return pResult; }
+ StackVar GetResultType() { return eResult; }
+ short GetRetFormatType() { return nRetFmtType; }
+ ULONG GetRetFormatIndex() { return nRetFmtIndex; }
+ BOOL HadMatrix() const { return bMatDel; }
+};
+
+
+inline void ScInterpreter::MatrixDoubleRefToMatrix()
+{
+ if ( bMatrixFormula && GetStackType() == svDoubleRef )
+ PopDoubleRefPushMatrix();
+}
+
+
+inline BOOL ScInterpreter::MustHaveParamCount( BYTE nAct, BYTE nMust )
+{
+ if ( nAct == nMust )
+ return TRUE;
+ if ( nAct < nMust )
+ SetParameterExpected();
+ else
+ SetIllegalParameter();
+ return FALSE;
+}
+
+
+inline BOOL ScInterpreter::MustHaveParamCount( BYTE nAct, BYTE nMust, BYTE nMax )
+{
+ if ( nMust <= nAct && nAct <= nMax )
+ return TRUE;
+ if ( nAct < nMust )
+ SetParameterExpected();
+ else
+ SetIllegalParameter();
+ return FALSE;
+}
+
+
+inline BOOL ScInterpreter::MustHaveParamCountMin( BYTE nAct, BYTE nMin )
+{
+ if ( nAct >= nMin )
+ return TRUE;
+ SetParameterExpected();
+ return FALSE;
+}
+
+
+#endif
diff --git a/sc/source/core/inc/makefile.mk b/sc/source/core/inc/makefile.mk
new file mode 100644
index 000000000000..1bfe37abc598
--- /dev/null
+++ b/sc/source/core/inc/makefile.mk
@@ -0,0 +1,61 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-19 00:16:16 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
diff --git a/sc/source/core/inc/refupdat.hxx b/sc/source/core/inc/refupdat.hxx
new file mode 100644
index 000000000000..ef07d7b8e7bc
--- /dev/null
+++ b/sc/source/core/inc/refupdat.hxx
@@ -0,0 +1,120 @@
+/*************************************************************************
+ *
+ * $RCSfile: refupdat.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-19 00:16:16 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef SC_REFUPDAT_HXX
+#define SC_REFUPDAT_HXX
+
+#include "global.hxx"
+
+class ScDocument;
+class ScBigRange;
+struct ComplRefData;
+
+enum ScRefUpdateRes {
+ UR_NOTHING = 0, // keine Anpassungen
+ UR_UPDATED = 1, // Anpassungen erfolgt
+ UR_INVALID = 2 // Referenz wurde ungueltig
+};
+
+class ScRefUpdate
+{
+public:
+ static ScRefUpdateRes Update
+ ( ScDocument* pDoc, UpdateRefMode eUpdateRefMode,
+ USHORT nCol1, USHORT nRow1, USHORT nTab1,
+ USHORT nCol2, USHORT nRow2, USHORT nTab2,
+ short nDx, short nDy, short nDz,
+ USHORT& theCol1, USHORT& theRow1, USHORT& theTab1,
+ USHORT& theCol2, USHORT& theRow2, USHORT& theTab2 );
+
+ static ScRefUpdateRes Update( UpdateRefMode eUpdateRefMode,
+ const ScBigRange& rWhere,
+ INT32 nDx, INT32 nDy, INT32 nDz,
+ ScBigRange& rWhat );
+
+ static ScRefUpdateRes Update( ScDocument* pDoc,
+ UpdateRefMode eUpdateRefMode,
+ const ScAddress& rPos, const ScRange& rRange,
+ short nDx, short nDy, short nDz,
+ ComplRefData& rRef );
+ static ScRefUpdateRes Move( ScDocument* pDoc, const ScAddress& rPos,
+ short nDx, short nDy, short nDz,
+ ComplRefData& rRef, BOOL bWrap, BOOL bAbsolute );
+ static void MoveRelWrap( ScDocument* pDoc, const ScAddress& rPos,
+ ComplRefData& rRef );
+
+ static ScRefUpdateRes UpdateTranspose( ScDocument* pDoc,
+ const ScRange& rSource, const ScAddress& rDest,
+ ComplRefData& rRef );
+ static void DoTranspose( short& rCol, short& rRow, short& rTab, ScDocument* pDoc,
+ const ScRange& rSource, const ScAddress& rDest );
+
+ static ScRefUpdateRes UpdateGrow(
+ const ScRange& rArea, USHORT nGrowX, USHORT nGrowY,
+ ComplRefData& rRef );
+
+ static ScRefUpdateRes DoGrow( const ScRange& rArea, USHORT nGrowX, USHORT nGrowY,
+ ScRange& rRef );
+};
+
+
+#endif
+
diff --git a/sc/source/core/inc/sctictac.hxx b/sc/source/core/inc/sctictac.hxx
new file mode 100644
index 000000000000..7c34a6d0afba
--- /dev/null
+++ b/sc/source/core/inc/sctictac.hxx
@@ -0,0 +1,164 @@
+/*************************************************************************
+ *
+ * $RCSfile: sctictac.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-19 00:16:16 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef SC_SCTICTAC_HXX
+#define SC_SCTICTAC_HXX
+
+//#define TICTACTOE_MAIN
+#ifdef TICTACTOE_MAIN
+#define TICTACTOE_STDOUT
+#else
+//#define TICTACTOE_STDOUT
+#endif
+#ifndef TICTACTOE_STDOUT
+#define TICTACTOE_SC
+#endif
+
+#ifdef TICTACTOE_SC
+class ScDocument;
+#include "global.hxx"
+#else
+#include <tools/string.hxx>
+#endif
+
+static const int ScTicTacToe_Squares = 9;
+static const int ScTicTacToe_Possible_Wins = 8;
+typedef sal_Unicode Square_Type;
+typedef Square_Type Board_Type[ScTicTacToe_Squares];
+
+class ScTicTacToe
+{
+private:
+ /* Structure to hold a move and its heuristic */
+ typedef struct {
+ int Square;
+ int Heuristic;
+ } Move_Heuristic_Type;
+
+ static const Square_Type Empty;
+ static const Square_Type Human;
+ static const Square_Type Compi;
+ static const int Infinity; /* Higher value than any score */
+ static const int Maximum_Moves; /* Maximum moves in a game */
+
+ Board_Type Board;
+#ifdef TICTACTOE_SC
+ ScAddress aPos; // linke obere Ecke des Boards
+ ScDocument* pDoc;
+#endif
+ ByteString aStdOut;
+ int Total_Nodes; /* Nodes searched with minimax */
+ int nMove;
+ Square_Type aPlayer;
+ BOOL bInitialized;
+
+ /* Array describing the eight combinations of three squares in a row */
+ static const int Three_in_a_Row[ScTicTacToe_Possible_Wins][3];
+
+ /* Array used in heuristic formula for each move. */
+ static const int Heuristic_Array[4][4];
+
+
+ Square_Type Winner();
+ inline Square_Type Other( Square_Type Player );
+ inline void Play( int Square, Square_Type Player );
+ int Evaluate( Square_Type Player );
+ int BestMove( Square_Type Player, int *Square,
+ int Move_Nbr, int Alpha, int Beta );
+ void Describe( int Score );
+ void Move( int& Square );
+ Square_Type TryMove( int& Square ); // return Winner()
+ void PromptHuman();
+#ifdef TICTACTOE_SC
+ // -1 == Fehler/Redraw, 0 == keine Aenderung, >0 == UserMoveSquare+1
+ int GetStatus();
+ void DrawBoard();
+ void DrawPos( int nSquare, const String& rStr );
+#endif
+#ifdef TICTACTOE_STDOUT
+ void Print();
+#endif
+
+ ScTicTacToe( const ScTicTacToe& );
+ ScTicTacToe& operator=( const ScTicTacToe& );
+
+public:
+#ifdef TICTACTOE_SC
+ ScTicTacToe( ScDocument* pDoc, const ScAddress& );
+#else
+ ScTicTacToe();
+#endif
+ ~ScTicTacToe() {}
+ void Initialize( BOOL bHumanFirst );
+ Square_Type GetEmpty() { return Empty; }
+#ifdef TICTACTOE_SC
+ Square_Type CalcMove(); // return Winner()
+#endif
+#ifdef TICTACTOE_STDOUT
+ void Game();
+ void GetOutput( ByteString& rStr );
+#else
+ void GetOutput( String& rStr );
+#endif
+};
+
+#endif
+