summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorThomas Lange <tl@openoffice.org>2001-05-02 15:58:48 +0000
committerThomas Lange <tl@openoffice.org>2001-05-02 15:58:48 +0000
commitecb9bc1488a13a5deec4cfeac86f050da3f4bc1c (patch)
tree73c944e8a07c8c2c420fb53cd9bae393bf27cfba /starmath
parente6eedc6fd472bbc8daccda88b1ce82f5aadb411b (diff)
Math configuration and Symbol/SymbolSet/SymbolSetManager
Diffstat (limited to 'starmath')
-rw-r--r--starmath/inc/config.hxx67
-rw-r--r--starmath/inc/dialog.hxx41
-rw-r--r--starmath/inc/document.hxx5
-rw-r--r--starmath/inc/format.hxx14
-rw-r--r--starmath/inc/smmod.hxx10
-rw-r--r--starmath/inc/starmath.hrc12
-rw-r--r--starmath/inc/symbol.hxx99
-rw-r--r--starmath/sdi/smath.sdi23
-rw-r--r--starmath/sdi/smslots.sdi14
-rw-r--r--starmath/source/config.cxx244
-rw-r--r--starmath/source/dialog.cxx113
-rw-r--r--starmath/source/document.cxx100
-rw-r--r--starmath/source/format.cxx39
-rw-r--r--starmath/source/makefile.mk14
-rw-r--r--starmath/source/parse.cxx11
-rw-r--r--starmath/source/smdll.cxx6
-rw-r--r--starmath/source/smmod.cxx29
-rw-r--r--starmath/source/symbol.cxx433
-rw-r--r--starmath/source/toolbox.cxx6
-rw-r--r--starmath/source/view.cxx8
20 files changed, 515 insertions, 773 deletions
diff --git a/starmath/inc/config.hxx b/starmath/inc/config.hxx
index 77b6455ccc7e..ac09e0075bc9 100644
--- a/starmath/inc/config.hxx
+++ b/starmath/inc/config.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: config.hxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 16:57:24 $
+ * last change: $Author: tl $ $Date: 2001-05-02 16:58:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -75,8 +75,7 @@
#include "format.hxx"
#endif
-#define HINT_CONFIGCHANGED 10002
-#define SMCONFIGITEM (SID_SMA_START+1)
+#include "cfgitem.hxx"
class SmPreferenceDialog;
@@ -84,76 +83,18 @@ class SmPrintDialog;
class SmPrintOptionDialog;
class SfxItemSet;
-enum SmPrintSize { PRINT_SIZE_NORMAL, PRINT_SIZE_SCALED, PRINT_SIZE_ZOOMED };
-
-class SmConfig : public SfxBroadcaster, public SfxListener, public SfxConfigItem
+class SmConfig : public SmMathConfig, public SfxBroadcaster
{
- String aSymbolFile;
- SmFormat aStandardFormat;
SmFontPickList vFontPickList[7];
- SmPrintSize ePrintSize;
- USHORT nPrintZoom;
-
- BOOL bPrintTitle,
- bPrintText,
- bPrintFrame,
- bWarnNoSymbols,
- bToolBoxVisible,
- bCmdBoxWindow,
- bAutoRedraw,
- bFormulaCursor,
- bNoRightSpaces; // ignorieren von ~ und ` am Zeilenende
-
- virtual void SFX_NOTIFY(SfxBroadcaster &rBC, const TypeId &rBCType,
- const SfxHint &rHint, const TypeId &rHintType);
-
- void ConfigChangedAction();
- void SetValueIfNE(BOOL &rItem, const BOOL bVal);
-
public:
SmConfig();
virtual ~SmConfig();
- virtual int Load (SvStream &rStream);
- virtual BOOL Store(SvStream &rStream);
-
- virtual void UseDefault();
- virtual String GetName() const;
-
- SmFormat & GetFormat() { return aStandardFormat; }
SmFontPickList & GetFontPickList(USHORT nIdent) { return vFontPickList[nIdent]; }
- const String & GetSymbolFile() const { return aSymbolFile; }
- void SetSymbolFile(const String &rText);
-
- SmPrintSize GetPrintSize() const { return ePrintSize; }
- USHORT GetPrintZoom() const { return nPrintZoom; }
-
- BOOL IsCmdBoxWindowEnabled() const { return bCmdBoxWindow; }
-
- BOOL IsPrintTitle() const { return bPrintTitle; }
- BOOL IsPrintText() const { return bPrintText; }
- BOOL IsPrintFrame() const { return bPrintFrame; }
- BOOL IsNoRightSpaces() const { return bNoRightSpaces; }
-
- BOOL IsToolBoxVisible() const { return bToolBoxVisible; }
- void SetToolBoxVisible(BOOL bVal) { SetValueIfNE(bToolBoxVisible, bVal); }
-
- BOOL IsAutoRedraw() const { return bAutoRedraw; }
- void SetAutoRedraw(BOOL bVal) { SetValueIfNE(bAutoRedraw, bVal); }
-
- BOOL IsWarnNoSymbols() const { return bWarnNoSymbols; }
- void SetWarnNoSymbols(BOOL bVal) { SetValueIfNE(bWarnNoSymbols, bVal); }
-
- BOOL IsShowFormulaCursor() const { return bFormulaCursor; }
- void SetShowFormulaCursor(BOOL bVal) { SetValueIfNE(bFormulaCursor, bVal); }
-
void ItemSetToConfig(const SfxItemSet &rSet);
void ConfigToItemSet(SfxItemSet &rSet) const;
-
- friend SvStream & operator << (SvStream &rStream, const SmConfig &rConfig);
- friend SvStream & operator >> (SvStream &rStream, SmConfig &rConfig);
};
#endif
diff --git a/starmath/inc/dialog.hxx b/starmath/inc/dialog.hxx
index d6074f056eec..d8458e5a156e 100644
--- a/starmath/inc/dialog.hxx
+++ b/starmath/inc/dialog.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: dialog.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: os $ $Date: 2001-03-22 14:09:28 $
+ * last change: $Author: tl $ $Date: 2001-05-02 16:58:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -173,42 +173,6 @@ public:
SmPrintOptionsTabPage(Window *pParent, const SfxItemSet &rOptions);
};
-
-#ifdef NEVER
-class SmGeneralTabPage : public SvxGeneralTabPage
-{
-public :
- static SfxTabPage* Create(Window* pWindow, const SfxItemSet& rSet);
-
- SmGeneralTabPage (Window *pParent, const SfxItemSet &rAttrSet) :
- SvxGeneralTabPage (pParent, rAttrSet)
- {
- }
-};
-#endif //NEVER
-
-/**************************************************************************/
-
-#ifdef NEVER
-class SmExtraOptionsTabPage : public SfxTabPage
-{
- CheckBox aAutoRedraw;
- FixedText aFixedText1;
- SmInfoText aSymbolFile;
- PushButton aBrowseButton;
-
- DECL_LINK(SymClickHdl, PushButton*);
-
- virtual BOOL FillItemSet(SfxItemSet& rOutSet);
- virtual void Reset(const SfxItemSet& rOutSet);
-
-public:
- SmExtraOptionsTabPage(const SfxItemSet& rInSet, Window *pParent, BOOL bFreeRes = TRUE);
-
- static SfxTabPage* Create(Window* pWindow, const SfxItemSet& rSet);
-};
-#endif //NEVER
-
/**************************************************************************/
class SmShowFont : public Control
@@ -482,6 +446,7 @@ class SmSymbolDialog : public ModalDialog
public:
SmSymbolDialog(Window * pParent, SmSymSetManager &rSymSetMgr, BOOL bFreeRes = TRUE);
+ virtual ~SmSymbolDialog();
BOOL SelectSymbolSet(const XubString &rSymbolSetName);
void SelectSymbol(USHORT nSymbolNo);
diff --git a/starmath/inc/document.hxx b/starmath/inc/document.hxx
index bd97d58f3ba2..6dacc372c123 100644
--- a/starmath/inc/document.hxx
+++ b/starmath/inc/document.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: document.hxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: tl $ $Date: 2001-04-19 14:44:29 $
+ * last change: $Author: tl $ $Date: 2001-05-02 16:58:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -96,6 +96,7 @@
#endif
class SmNode;
+class SmSymSetManager;
class SfxPrinter;
class Printer;
diff --git a/starmath/inc/format.hxx b/starmath/inc/format.hxx
index 8b17d8893fb9..8ff06a603692 100644
--- a/starmath/inc/format.hxx
+++ b/starmath/inc/format.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: format.hxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 16:57:24 $
+ * last change: $Author: tl $ $Date: 2001-05-02 16:58:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -162,7 +162,7 @@ public:
const SmFace & GetFont(USHORT nIdent) const { return vFont[nIdent]; }
SmFace & Font (USHORT nIdent) { return vFont[nIdent]; }
- void SetFont(USHORT nIdent, const SmFace &rFont) { vFont[nIdent] = rFont; }
+ void SetFont(USHORT nIdent, const SmFace &rFont);
USHORT GetRelSize(USHORT nIdent) const { return vSize[nIdent]; }
void SetRelSize(USHORT nIdent, USHORT nVal) { vSize[nIdent] = nVal;}
@@ -186,6 +186,9 @@ public:
SmFormat & operator = (const SmFormat &rFormat);
+ BOOL operator == (const SmFormat &rFormat) const;
+ inline BOOL operator != (const SmFormat &rFormat) const;
+
void RequestApplyChanges() const
{
((SmFormat *) this)->Broadcast(SfxSimpleHint(HINT_FORMATCHANGED));
@@ -199,5 +202,10 @@ public:
friend SvStream & operator >> (SvStream &rStream, SmFormat &rFormat);
};
+inline BOOL SmFormat::operator != (const SmFormat &rFormat) const
+{
+ return !(*this == rFormat);
+}
+
#endif
diff --git a/starmath/inc/smmod.hxx b/starmath/inc/smmod.hxx
index a99ca19e654c..42aad1b48388 100644
--- a/starmath/inc/smmod.hxx
+++ b/starmath/inc/smmod.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: smmod.hxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 16:57:24 $
+ * last change: $Author: tl $ $Date: 2001-05-02 16:58:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -72,7 +72,6 @@ class SvxErrorHandler;
class SvFactory;
class SmConfig;
-class SmSymSetManager;
class SmModule;
/*************************************************************************
@@ -92,7 +91,6 @@ class SmRectCache;
class SmModule : public SmModuleDummy
{
SmConfig *pConfig;
- SmSymSetManager *pSymSetManager;
SmRectCache *pRectCache;
virtual void FillStatusBar(StatusBar &rBar);
@@ -107,12 +105,10 @@ public:
virtual SfxModule * Load();
virtual void Free();
- SmConfig * GetConfig() { return pConfig; }
- SmSymSetManager * GetSymSetManager() { return pSymSetManager; }
+ SmConfig * GetConfig();
SmRectCache * GetRectCache() { return pRectCache; }
void GetState(SfxItemSet&);
- void InitManager();
//virtuelle Methoden fuer den Optionendialog
virtual SfxItemSet* CreateItemSet( USHORT nId );
diff --git a/starmath/inc/starmath.hrc b/starmath/inc/starmath.hrc
index f44d8ec4abf4..6289624786e4 100644
--- a/starmath/inc/starmath.hrc
+++ b/starmath/inc/starmath.hrc
@@ -2,9 +2,9 @@
*
* $RCSfile: starmath.hrc,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: mib $ $Date: 2001-02-06 15:56:00 $
+ * last change: $Author: tl $ $Date: 2001-05-02 16:58:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -88,7 +88,7 @@
#define SID_FONTSIZE (SID_SMA_START + 51)
#define SID_DISTANCE (SID_SMA_START + 52)
#define SID_ALIGN (SID_SMA_START + 53)
-#define SID_SYMBOLS_LOAD (SID_SMA_START + 54)
+
#define SID_AUTO_REDRAW (SID_SMA_START + 55)
#define SID_SYMBOLS (SID_SMA_START + 56) // Muss erstmal wieder aufgenommen werden !
#define SID_TEXTMODE (SID_SMA_START + 57)
@@ -114,7 +114,7 @@
#define SID_COPYOBJECT (SID_SMA_START + 117)
#define SID_PASTEOBJECT (SID_SMA_START + 118)
#define SID_AUTOREDRAW (SID_SMA_START + 119)
-#define SID_SYMBOLFILE (SID_SMA_START + 120)
+
#define SID_GETEDITTEXT (SID_SMA_START + 121)
#define SID_CMDBOXWINDOW (SID_SMA_START + 122)
#define SID_TOOLBOXWINDOW (SID_SMA_START + 123)
@@ -450,6 +450,10 @@
#define RID_XPP_OVERBRACE (RID_APP_START + 3022)
#define RID_XPP_UNDERBRACE (RID_APP_START + 3023)
+#define RID_LOCALIZED_SYMBOL_NAMES (RID_APP_START + 3101)
+#define RID_UI_SYMBOL_NAMES (RID_APP_START + 3102)
+#define RID_EXPORT_SYMBOL_NAMES (RID_APP_START + 3103)
+
#define HID_SMA_OPTIONSDIALOG (HID_SMA_START + 1)
#define HID_SMA_FONTDIALOG (HID_SMA_START + 2)
#define HID_SMA_FONTSIZEDIALOG (HID_SMA_START + 3)
diff --git a/starmath/inc/symbol.hxx b/starmath/inc/symbol.hxx
index d05589acb016..6402ddc70b53 100644
--- a/starmath/inc/symbol.hxx
+++ b/starmath/inc/symbol.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: symbol.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: cmc $ $Date: 2001-01-18 14:55:58 $
+ * last change: $Author: tl $ $Date: 2001-05-02 16:58:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -61,6 +61,9 @@
#ifndef SYMBOL_HXX
#define SYMBOL_HXX
+#ifndef _VOS_REFERNCE_HXX_
+#include <vos/refernce.hxx>
+#endif
#ifndef _FONT_HXX //autogen
#include <vcl/font.hxx>
#endif
@@ -70,12 +73,16 @@
#ifndef _TOOLS_DEBUG_HXX //autogen
#include <tools/debug.hxx>
#endif
+#ifndef _DYNARY_HXX
+#include <tools/dynary.hxx>
+#endif
#ifndef _SFXLSTNER_HXX //autogen
#include <svtools/lstner.hxx>
#endif
-#ifndef _DYNARY_HXX //autogen
-#include <tools/dynary.hxx>
+#ifndef _SVARRAY_HXX
+#include <svtools/svarray.hxx>
#endif
+
#ifndef UTILITY_HXX
#include "utility.hxx"
#endif
@@ -88,25 +95,38 @@
////////////////////////////////////////////////////////////////////////////////
+String GetExportSymbolName( const String &rUiSymbolName );
+String GetUiSymbolName( const String &rExportSymbolName );
+
+////////////////////////////////////////////////////////////////////////////////
+
class SmSym
{
friend class SmSymSetManager;
+ friend SvStream& operator << (SvStream& rStream, const SmSym& rSymbol);
+ friend SvStream& operator >> (SvStream& rStream, SmSym& rSymbol);
+
SmFace Face;
String Name;
+ String aExportName;
+ String aSetName;
SmSym *pHashNext;
SmSymSetManager *pSymSetManager;
sal_Unicode Character;
BYTE Attribut;
+ BOOL bPredefined;
+ BOOL bDocSymbol;
public:
SmSym();
SmSym(const SmSym& rSymbol);
- SmSym(const String& rName, const Font& rFont, sal_Unicode aChar);
+ SmSym(const String& rName, const Font& rFont, sal_Unicode cChar,
+ const String& rSet, BOOL bIsPredefined = FALSE);
SmSym& operator = (const SmSym& rSymbol);
- void SetSymbolName(const String& rName);
+ void SetSymbolName(const String& rName);
const Font& GetFace() const { return Face; }
sal_Unicode GetCharacter() const { return Character; }
@@ -116,11 +136,17 @@ public:
sal_Unicode& GetCharacter() { return Character; }
String& GetName() { return Name; }
- friend SvStream& operator << (SvStream& rStream, const SmSym& rSymbol);
- friend SvStream& operator >> (SvStream& rStream, SmSym& rSymbol);
+ BOOL IsPredefined() const { return bPredefined; }
+ const String & GetSetName() const { return aSetName; }
+ const String & GetExportName() const { return aExportName; }
+ void SetExportName( const String &rName ) { aExportName = rName; }
+
+ BOOL IsDocSymbol() const { return bDocSymbol; }
+ void SetDocSymbol( BOOL bVal ) { bDocSymbol = bVal; }
};
DECLARE_LIST(SmListSym, SmSym *);
+SV_DECL_PTRARR( SymbolArray, SmSym *, 32, 32 );
/**************************************************************************/
@@ -128,6 +154,9 @@ class SmSymSet
{
friend class SmSymSetManager;
+ friend SvStream& operator << (SvStream& rStream, const SmSymSet& rSymbolSet);
+ friend SvStream& operator >> (SvStream& rStream, SmSymSet& rSymbolSet);
+
SmListSym SymbolList;
String Name;
SmSymSetManager *pSymSetManager;
@@ -156,9 +185,6 @@ public:
void ReplaceSymbol(USHORT SymbolNo, SmSym& rSymbol);
SmSym * RemoveSymbol(USHORT SymbolNo);
USHORT GetSymbolPos(const String& rName);
-
- friend SvStream& operator << (SvStream& rStream, const SmSymSet& rSymbolSet);
- friend SvStream& operator >> (SvStream& rStream, SmSymSet& rSymbolSet);
};
DECLARE_DYNARRAY(SmArraySymSet, SmSymSet *)
@@ -167,14 +193,21 @@ DECLARE_DYNARRAY(SmArraySymSet, SmSymSet *)
class SmSymbolDialog;
-class SmSymSetManager : public SfxListener
+
+struct SmSymSetManager_Impl
{
- SmArraySymSet SymbolSets;
+ SmArraySymSet SymbolSets;
String aStreamName;
- SmSym **HashEntries;
- UINT32 NoSymbolSets;
- UINT32 NoHashEntries;
- BOOL Modified;
+ SmSym** HashEntries;
+ USHORT NoSymbolSets;
+ USHORT NoHashEntries;
+ BOOL Modified;
+};
+
+
+class SmSymSetManager : public SfxListener
+{
+ SmSymSetManager_Impl *pImpl;
virtual void SFX_NOTIFY(SfxBroadcaster& rBC, const TypeId& rBCType,
const SfxHint& rHint, const TypeId& rHintType);
@@ -182,24 +215,25 @@ class SmSymSetManager : public SfxListener
UINT32 GetHashIndex(const String& rSymbolName);
void EnterHashTable(SmSymSet& rSymbolSet);
void FillHashTable();
-
-public:
void Init();
void Exit();
- SmSymSetManager(UINT32 HashTableSize = 137);
- SmSymSetManager(const SmSymSetManager& rSymbolSetManager);
- ~SmSymSetManager();
+public:
+ SmSymSetManager(USHORT HashTableSize = 137);
+ SmSymSetManager(const SmSymSetManager& rSymbolSetManager);
+ ~SmSymSetManager();
SmSymSetManager& operator = (const SmSymSetManager& rSymbolSetManager);
- UINT32 GetCount() const { return NoSymbolSets; }
- SmSymSet *GetSymbolSet(USHORT SymbolSetNo) const { return SymbolSets.Get(SymbolSetNo);}
-
USHORT AddSymbolSet(SmSymSet* pSymbolSet);
void ChangeSymbolSet(SmSymSet* pSymbolSet);
void DeleteSymbolSet(USHORT SymbolSetNo);
USHORT GetSymbolSetPos(const String& rSymbolSetName) const;
+ USHORT GetSymbolSetCount() const { return pImpl->NoSymbolSets; }
+ SmSymSet *GetSymbolSet(USHORT SymbolSetNo) const
+ {
+ return pImpl->SymbolSets.Get(SymbolSetNo);
+ }
SmSym * GetSymbol(const String& rSymbolName);
const SmSym * GetSymbol(const String& rSymbolName) const
@@ -207,18 +241,15 @@ public:
return ((SmSymSetManager *) this)->GetSymbol(rSymbolName);
}
- void AppendExtraSymbolSet(SmSymSet* pSymbolSet) {}
- void ResetAccessedSymbols() {}
- SmSymSet GetAccessedSymbols() { return SmSymSet(); }
+ void AddReplaceSymbol( const SmSym & rSymbol );
+ USHORT GetSymbolCount() const;
+ const SmSym * GetSymbol( USHORT nPos ) const;
- BOOL IsModified() const { return (Modified); }
- void SetModified(BOOL Modify) { Modified = Modify; }
+ BOOL IsModified() const { return pImpl->Modified; }
+ void SetModified(BOOL Modify) { pImpl->Modified = Modify; }
- void Load(const String& rURL);
+ void Load();
void Save();
-
- friend SvStream& operator << (SvStream& rStream, SmSymSetManager& rSymbolSetManager);
- friend SvStream& operator >> (SvStream& rStream, SmSymSetManager& rSymbolSetManager);
};
#endif
diff --git a/starmath/sdi/smath.sdi b/starmath/sdi/smath.sdi
index be4e6bc82250..0ac0945e9481 100644
--- a/starmath/sdi/smath.sdi
+++ b/starmath/sdi/smath.sdi
@@ -534,29 +534,6 @@ SfxVoidItem ChangeFontSize SID_FONTSIZE
]
//--------------------------------------------------------------------------
-SfxVoidItem SymbolsLoad SID_SYMBOLS_LOAD
-()
-[
- /* flags: */
- AutoUpdate = FALSE,
- Cachable = Cachable,
- FastCall = FALSE,
- HasCoreId = FALSE,
- HasDialog = TRUE,
- ReadOnlyDoc = TRUE,
- Toggle = FALSE,
- Container = FALSE,
- Synchron;
-
- /* config: */
- AccelConfig = TRUE,
- MenuConfig = TRUE,
- StatusBarConfig = FALSE,
- ToolBoxConfig = TRUE,
- GroupId = GID_OPTIONS;
-]
-
-//--------------------------------------------------------------------------
SfxVoidItem SaveSymbols SID_SAVESYMBOLS
()
[
diff --git a/starmath/sdi/smslots.sdi b/starmath/sdi/smslots.sdi
index 3ca9d366cb2f..f081822db6f3 100644
--- a/starmath/sdi/smslots.sdi
+++ b/starmath/sdi/smslots.sdi
@@ -5,8 +5,8 @@
#*
#* Beschreibung Starmath IDL-File
#*
-#* Letzte Aenderung $Author: hr $ $Date: 2000-09-18 16:57:26 $
-#* $Revision: 1.1.1.1 $
+#* Letzte Aenderung $Author: tl $ $Date: 2001-05-02 16:58:48 $
+#* $Revision: 1.2 $
#*
#* $Logfile: T:/starmath/sdi/smslots.sdv $
#*
@@ -16,7 +16,7 @@
Source Code Control System - Header
- $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/starmath/sdi/smslots.sdi,v 1.1.1.1 2000-09-18 16:57:26 hr Exp $
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/starmath/sdi/smslots.sdi,v 1.2 2001-05-02 16:58:48 tl Exp $
*************************************************************************/
@@ -70,11 +70,6 @@ interface FormulaDocument : OfficeDocument
ExecMethod = Execute ;
StateMethod = GetState ;
]
- SID_SYMBOLS_LOAD //idlpp ole : no , status : no
- [
- ExecMethod = Execute ;
- StateMethod = GetState ;
- ]
SID_AUTO_REDRAW //idlpp ole : no , status : no
[
ExecMethod = Execute ;
@@ -323,6 +318,9 @@ shell SmViewShell : SfxViewShell
Source Code Control System - History
$Log: not supported by cvs2svn $
+ Revision 1.1.1.1 2000/09/18 16:57:26 hr
+ initial import
+
Revision 1.61 1999/07/02 10:22:24 TL
#67357# SID_MARKERROR deleted.
diff --git a/starmath/source/config.cxx b/starmath/source/config.cxx
index c9d6e566f487..f29769c946db 100644
--- a/starmath/source/config.cxx
+++ b/starmath/source/config.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: config.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: mib $ $Date: 2001-02-06 16:02:19 $
+ * last change: $Author: tl $ $Date: 2001-05-02 16:58:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -106,193 +106,59 @@
#include "starmath.hrc"
#endif
-#define DEFSYMFILE "starmath$(lang).sms"
-#define CONFIGVERSION (INT16)0x0001;
+/////////////////////////////////////////////////////////////////
-
-SmConfig::SmConfig() :
- SfxConfigItem(SMCONFIGITEM)
+SmConfig::SmConfig()
{
- UseDefault();
- StartListening(aStandardFormat);
}
SmConfig::~SmConfig()
{
- EndListening(aStandardFormat);
-}
-
-
-void SmConfig::SFX_NOTIFY(SfxBroadcaster &, const TypeId &,
- const SfxHint &rHint, const TypeId &)
-{
- switch (((SfxSimpleHint &) rHint).GetId())
- {
- case HINT_FORMATCHANGED:
- SetModified(TRUE);
- SetDefault (FALSE);
- break;
- }
-}
-
-
-void SmConfig::ConfigChangedAction()
-{
- SetModified(TRUE);
- SetDefault(FALSE);
- //Broadcast(SfxSimpleHint(HINT_CONFIGCHANGED));
-}
-
-
-void SmConfig::SetValueIfNE(BOOL &rItem, const BOOL bVal)
- // "Set 'Modified' and 'Value' if not equal"
-{
- if (rItem != bVal)
- { rItem = bVal;
- ConfigChangedAction();
- }
-}
-
-
-void SmConfig::SetSymbolFile(const String &rText)
-{
- if (aSymbolFile != rText)
- {
- aSymbolFile = rText;
- ConfigChangedAction();
- }
-}
-
-
-int SmConfig::Load(SvStream &rStream)
-{
- // Da die Fileformat Version in ConfigItems nur einen Defaultwert hat setzen
- // wir diesen hier auf die aktuelle Version, damit beim folgenden (impliziten)
- // einlesen des 'SmFormat' Objekts aus dem Stream dieses entsprechend
- // reagieren kann.
- rStream.SetVersion(SOFFICE_FILEFORMAT_50);
-
- rStream >> *this;
- SetDefault(FALSE);
- return SfxConfigItem::ERR_OK;
-}
-
-
-BOOL SmConfig::Store(SvStream &rStream)
-{
- rStream << *this;
- return TRUE;
-}
-
-/**************************************************************************/
-
-void SmConfig::UseDefault()
-{
- SfxConfigItem::UseDefault(); // this implicitly calls 'SetDefault(TRUE)'
-
- bToolBoxVisible = bCmdBoxWindow = bAutoRedraw = bFormulaCursor =
- bPrintTitle = bPrintText = bPrintFrame = bWarnNoSymbols =
- bNoRightSpaces = TRUE;
-
- aSymbolFile = C2S(DEFSYMFILE);
- SvtPathOptions aOpt;
- aOpt.SearchFile( aSymbolFile, SvtPathOptions::PATH_USERCONFIG );
-
- ePrintSize = PRINT_SIZE_NORMAL;
- nPrintZoom = 100;
-}
-
-/**************************************************************************/
-
-String SmConfig::GetName() const
-{
- return C2S("StarMath");
}
-/**************************************************************************/
void SmConfig::ItemSetToConfig(const SfxItemSet &rSet)
{
const SfxPoolItem *pItem = NULL;
- BOOL bModified = FALSE;
- String aSymbolFile;
-
- if (rSet.GetItemState(SID_SYMBOLFILE, TRUE, &pItem) == SFX_ITEM_SET)
- { aSymbolFile = ((const SfxStringItem *) pItem)->GetValue();
- DBG_ASSERT(aSymbolFile.Len() > 0, "Symboldatei nicht angegeben !");
-
- if (aSymbolFile != aSymbolFile)
- {
- SfxModule *p = SM_MOD1();
- SmModule *pp = (SmModule *) p;
-
- pp->GetConfig()->SetWarnNoSymbols(TRUE);
- aSymbolFile = aSymbolFile;
-
- bModified = TRUE;
- }
- }
UINT16 nU16;
+ BOOL bVal;
if (rSet.GetItemState(SID_PRINTSIZE, TRUE, &pItem) == SFX_ITEM_SET)
{ nU16 = ((const SfxUInt16Item *) pItem)->GetValue();
- if (ePrintSize != nU16)
- { ePrintSize = (SmPrintSize) nU16;
- bModified = TRUE;
- }
+ SetPrintSize( (SmPrintSize) nU16 );
}
if (rSet.GetItemState(SID_PRINTZOOM, TRUE, &pItem) == SFX_ITEM_SET)
{ nU16 = ((const SfxUInt16Item *) pItem)->GetValue();
- if (nPrintZoom != nU16)
- { nPrintZoom = (USHORT) nU16;
- bModified = TRUE;
- }
+ SetPrintZoomFactor( nU16 );
}
-
- BOOL bVal;
if (rSet.GetItemState(SID_PRINTTITLE, TRUE, &pItem) == SFX_ITEM_SET)
{ bVal = ((const SfxBoolItem *) pItem)->GetValue();
- if (bPrintTitle != bVal)
- { bPrintTitle = bVal;
- bModified = TRUE;
- }
+ SetPrintTitle( bVal );
}
if (rSet.GetItemState(SID_PRINTTEXT, TRUE, &pItem) == SFX_ITEM_SET)
{ bVal = ((const SfxBoolItem *) pItem)->GetValue();
- if (bPrintText != bVal)
- { bPrintText = bVal;
- bModified = TRUE;
- }
+ SetPrintFormulaText( bVal );
}
if (rSet.GetItemState(SID_PRINTFRAME, TRUE, &pItem) == SFX_ITEM_SET)
{ bVal = ((const SfxBoolItem *) pItem)->GetValue();
- if (bPrintFrame != bVal)
- { bPrintFrame = bVal;
- bModified = TRUE;
- }
+ SetPrintFrame( bVal );
}
if (rSet.GetItemState(SID_AUTOREDRAW, TRUE, &pItem) == SFX_ITEM_SET)
{ bVal = ((const SfxBoolItem *) pItem)->GetValue();
- if (bAutoRedraw != bVal)
- { bAutoRedraw = bVal;
- bModified = TRUE;
- }
+ SetAutoRedraw( bVal );
}
if (rSet.GetItemState(SID_NO_RIGHT_SPACES, TRUE, &pItem) == SFX_ITEM_SET)
{ bVal = ((const SfxBoolItem *) pItem)->GetValue();
- if (bNoRightSpaces != bVal)
- { bNoRightSpaces = bVal;
- bModified = TRUE;
+ if (IsIgnoreSpacesRight() != bVal)
+ {
+ SetIgnoreSpacesRight( bVal );
// (angezeigte) Formeln mssen entsprechen neu formatiert werden.
// Das erreichen wir mit:
Broadcast(SfxSimpleHint(HINT_FORMATCHANGED));
}
}
-
- if (bModified)
- ConfigChangedAction();
}
@@ -300,85 +166,19 @@ void SmConfig::ConfigToItemSet(SfxItemSet &rSet) const
{
const SfxItemPool *pPool = rSet.GetPool();
- rSet.Put(SfxStringItem(pPool->GetWhich(SID_SYMBOLFILE),
- aSymbolFile));
-
rSet.Put(SfxUInt16Item(pPool->GetWhich(SID_PRINTSIZE),
- (UINT16) ePrintSize));
+ (UINT16) GetPrintSize()));
rSet.Put(SfxUInt16Item(pPool->GetWhich(SID_PRINTZOOM),
- (UINT16) nPrintZoom));
+ (UINT16) GetPrintZoomFactor()));
- rSet.Put(SfxBoolItem(pPool->GetWhich(SID_PRINTTITLE), bPrintTitle));
- rSet.Put(SfxBoolItem(pPool->GetWhich(SID_PRINTTEXT), bPrintText));
- rSet.Put(SfxBoolItem(pPool->GetWhich(SID_PRINTFRAME), bPrintFrame));
- rSet.Put(SfxBoolItem(pPool->GetWhich(SID_AUTOREDRAW), bAutoRedraw));
- rSet.Put(SfxBoolItem(pPool->GetWhich(SID_NO_RIGHT_SPACES), bNoRightSpaces));
+ rSet.Put(SfxBoolItem(pPool->GetWhich(SID_PRINTTITLE), IsPrintTitle()));
+ rSet.Put(SfxBoolItem(pPool->GetWhich(SID_PRINTTEXT), IsPrintFormulaText()));
+ rSet.Put(SfxBoolItem(pPool->GetWhich(SID_PRINTFRAME), IsPrintFrame()));
+ rSet.Put(SfxBoolItem(pPool->GetWhich(SID_AUTOREDRAW), IsAutoRedraw()));
+ rSet.Put(SfxBoolItem(pPool->GetWhich(SID_NO_RIGHT_SPACES), IsIgnoreSpacesRight()));
}
-/**************************************************************************/
-
-
-SvStream & operator << (SvStream &rStream, const SmConfig &rConfig)
-{
- rStream << CONFIGVERSION;
-
- UINT16 nFlags = rConfig.bPrintTitle
- | (rConfig.bPrintText << 1)
- | (rConfig.bPrintFrame << 2)
- | (rConfig.bWarnNoSymbols << 3)
- | (rConfig.bToolBoxVisible << 4)
- | (rConfig.bCmdBoxWindow << 5)
- | (rConfig.bAutoRedraw << 6)
- | (rConfig.bFormulaCursor << 7)
- | (rConfig.bNoRightSpaces << 8);
-
- rStream << nFlags;
-
- rStream << (INT16) rConfig.ePrintSize;
- rStream << (INT16) rConfig.nPrintZoom;
-
- rStream.WriteByteString(rConfig.aSymbolFile, gsl_getSystemTextEncoding());
- rStream << rConfig.aStandardFormat;
-
- for (int i = 0; i < 7; i++)
- rStream << rConfig.vFontPickList[i];
-
- return rStream;
-}
-
-
-SvStream & operator >> (SvStream &rStream, SmConfig &rConfig)
-{
- INT16 nVer;
- rStream >> nVer;
-
- UINT16 nFlags;
- rStream >> nFlags;
-
- rConfig.bPrintTitle = nFlags & 0x01;
- rConfig.bPrintText = (nFlags >> 1) & 0x01;
- rConfig.bPrintFrame = (nFlags >> 2) & 0x01;
- rConfig.bWarnNoSymbols = (nFlags >> 3) & 0x01;
- rConfig.bToolBoxVisible = (nFlags >> 4) & 0x01;
- rConfig.bCmdBoxWindow = (nFlags >> 5) & 0x01;
- rConfig.bAutoRedraw = (nFlags >> 6) & 0x01;
- rConfig.bFormulaCursor = (nFlags >> 7) & 0x01;
- rConfig.bNoRightSpaces = (nFlags >> 8) & 0x01;
-
- INT16 nI16;
- rStream >> nI16;
- rConfig.ePrintSize = (SmPrintSize) nI16;
- rStream >> nI16;
- rConfig.nPrintZoom = (USHORT) nI16;
-
- rStream.ReadByteString(rConfig.aSymbolFile, gsl_getSystemTextEncoding());
- rStream >> rConfig.aStandardFormat;
-
- for (int i = 0; i < 7; i++)
- rStream >> rConfig.vFontPickList[i];
-
- return rStream;
-}
+/////////////////////////////////////////////////////////////////
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx
index dc37f00b82c7..d5faf29af94a 100644
--- a/starmath/source/dialog.cxx
+++ b/starmath/source/dialog.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: dialog.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: tl $ $Date: 2001-02-07 12:46:52 $
+ * last change: $Author: tl $ $Date: 2001-05-02 16:58:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -294,75 +294,6 @@ SfxTabPage* SmPrintOptionsTabPage::Create(Window* pWindow, const SfxItemSet& rSe
/**************************************************************************/
-#ifdef NEVER
-SmExtraOptionsTabPage::SmExtraOptionsTabPage(const SfxItemSet& rInSet, Window * pParent, BOOL bFreeRes)
- : SfxTabPage(pParent, SmResId(RID_EXTRAOPTIONPAGE), rInSet),
- aAutoRedraw (this, ResId(1)),
- aFixedText1 (this, ResId(1)),
- aSymbolFile (this, ResId(2), 32),
- aBrowseButton (this, ResId(1))
-{
- if (bFreeRes)
- FreeResource();
-
- aBrowseButton.SetClickHdl(LINK(this, SmExtraOptionsTabPage, SymClickHdl));
-}
-
-
-IMPL_LINK( SmExtraOptionsTabPage, SymClickHdl, PushButton *, pPushButton )
-{
- SfxSimpleFileDialog *pFileDialog =
- new SfxSimpleFileDialog(this, WinBits(WB_OPEN | WB_3DLOOK));
-
-#ifdef MAC
- pFileDialog->AddFilter(SmResId(RID_SYMBOLFILESSTR), SmResId(RID_FILESYMTYP));
- pFileDialog->AddFilter(SmResId(RID_ALLFILESSTR), "****");
-
- pFileDialog->SetCurFilter(SmResId(RID_SYMBOLFILESSTR));
-#else
- pFileDialog->AddFilter(SmResId(RID_SYMBOLFILESSTR), C2S("*.sms"));
- pFileDialog->AddFilter(SmResId(RID_ALLFILESSTR), C2S("*.*"));
-
- pFileDialog->SetCurFilter(SmResId(RID_SYMBOLFILESSTR));
-
- pFileDialog->SetDefaultExt(C2S("*.sms"));
-#endif
-
- pFileDialog->SetPath(aSymbolFile.GetText());
-
- if (pFileDialog->Execute() == RET_OK)
- aSymbolFile.SetText(pFileDialog->GetPath());
-
- delete pFileDialog;
- return 0;
-}
-
-
-BOOL SmExtraOptionsTabPage::FillItemSet(SfxItemSet& rOutSet)
-{
- rOutSet.Put(SfxBoolItem(GetWhich(SID_AUTOREDRAW), aAutoRedraw.IsChecked()));
- rOutSet.Put(SfxStringItem(GetWhich(SID_SYMBOLFILE), aSymbolFile.GetText()));
-
- return (TRUE);
-}
-
-
-void SmExtraOptionsTabPage::Reset(const SfxItemSet& rOutSet)
-{
- aAutoRedraw.Check(((const SfxBoolItem&)rOutSet.Get(GetWhich(SID_AUTOREDRAW))).GetValue());
- aSymbolFile.SetText(((const SfxStringItem&)rOutSet.Get(GetWhich(SID_SYMBOLFILE))).GetValue());
-}
-
-
-SfxTabPage* SmExtraOptionsTabPage::Create(Window* pWindow, const SfxItemSet& rSet)
-{
- return (new SmExtraOptionsTabPage(rSet, pWindow));
-}
-#endif //NEVER
-
-/**************************************************************************/
-
-
void SmShowFont::Paint(const Rectangle&)
{
XubString Text (GetFont().GetName());
@@ -494,7 +425,9 @@ IMPL_LINK( SmFontSizeDialog, DefaultButtonClickHdl, Button *, pButton )
if (pQueryBox->Execute() == RET_YES)
{
SmModule *pp = SM_MOD1();
- WriteTo(pp->GetConfig()->GetFormat());
+ SmFormat aFmt( pp->GetConfig()->GetStandardFormat() );
+ WriteTo( aFmt );
+ pp->GetConfig()->SetStandardFormat( aFmt );
}
delete pQueryBox;
@@ -598,7 +531,9 @@ IMPL_LINK_INLINE_START( SmFontTypeDialog, DefaultButtonClickHdl, Button *, pButt
if (pQueryBox->Execute() == RET_YES)
{
SmModule *pp = SM_MOD1();
- WriteTo(pp->GetConfig()->GetFormat());
+ SmFormat aFmt( pp->GetConfig()->GetStandardFormat() );
+ WriteTo( aFmt );
+ pp->GetConfig()->SetStandardFormat( aFmt );
}
delete pQueryBox;
@@ -801,7 +736,9 @@ IMPL_LINK( SmDistanceDialog, DefaultButtonClickHdl, Button *, pButton )
if (pQueryBox->Execute() == RET_YES)
{
SmModule *pp = SM_MOD1();
- WriteTo(pp->GetConfig()->GetFormat());
+ SmFormat aFmt( pp->GetConfig()->GetStandardFormat() );
+ WriteTo( aFmt );
+ pp->GetConfig()->SetStandardFormat( aFmt );
}
delete pQueryBox;
return 0;
@@ -1093,7 +1030,9 @@ IMPL_LINK( SmAlignDialog, DefaultButtonClickHdl, Button *, pButton )
if (pQueryBox->Execute() == RET_YES)
{
SmModule *pp = SM_MOD1();
- WriteTo(pp->GetConfig()->GetFormat());
+ SmFormat aFmt( pp->GetConfig()->GetStandardFormat() );
+ WriteTo( aFmt );
+ pp->GetConfig()->SetStandardFormat( aFmt );
}
delete pQueryBox;
@@ -1390,7 +1329,7 @@ void SmSymbolDialog::FillSymbolSets(BOOL bDeleteText)
if (bDeleteText)
aSymbolSets.SetNoSelection();
- USHORT nNumSymSets = rSymSetMgr.GetCount();
+ USHORT nNumSymSets = rSymSetMgr.GetSymbolSetCount();
for (USHORT i = 0; i < nNumSymSets; i++)
aSymbolSets.InsertEntry(rSymSetMgr.GetSymbolSet(i)->GetName());
}
@@ -1521,6 +1460,12 @@ SmSymbolDialog::SmSymbolDialog(Window *pParent, SmSymSetManager &rMgr, BOOL bFre
}
+SmSymbolDialog::~SmSymbolDialog()
+{
+ rSymSetMgr.Save();
+}
+
+
BOOL SmSymbolDialog::SelectSymbolSet(const XubString &rSymbolSetName)
{
BOOL bRet = FALSE;
@@ -1764,7 +1709,7 @@ void SmSymDefineDialog::FillSymbolSets(ComboBox &rComboBox, BOOL bDeleteText)
if (bDeleteText)
rComboBox.SetText(XubString());
- USHORT nNumSymSets = aSymSetMgrCopy.GetCount();
+ USHORT nNumSymSets = aSymSetMgrCopy.GetSymbolSetCount();
for (USHORT i = 0; i < nNumSymSets; i++)
rComboBox.InsertEntry(aSymSetMgrCopy.GetSymbolSet(i)->GetName());
}
@@ -1919,7 +1864,8 @@ IMPL_LINK( SmSymDefineDialog, AddClickHdl, Button *, pButton )
// Symbol ins SymbolSet einfgen
SmSym *pSym = new SmSym(aSymbols.GetText(), aCharsetDisplay.GetFont(),
- aCharsetDisplay.GetSelectChar());
+ aCharsetDisplay.GetSelectChar(),
+ aSymbolSets.GetText());
pSymSet->AddSymbol(pSym);
// update der Hash Tabelle erzwingen (damit aAddBtn disabled wird).
@@ -2156,7 +2102,7 @@ short SmSymDefineDialog::Execute()
// leere SymbolSets aus dem Ergebnis entfernen.
// Dabei von hinten durch das array iterieren, da beim lschen die
// Elemente aufrcken.
- USHORT nSymbolSets = aSymSetMgrCopy.GetCount();
+ USHORT nSymbolSets = aSymSetMgrCopy.GetSymbolSetCount();
for (int i = nSymbolSets - 1; i >= 0; i--)
if (aSymSetMgrCopy.GetSymbolSet(i)->GetCount() == 0)
aSymSetMgrCopy.DeleteSymbolSet(i);
@@ -2410,12 +2356,3 @@ void SmSymDefineDialog::SelectChar(xub_Unicode cChar)
/**************************************************************************/
-#ifdef NEVER
-SfxTabPage* SmGeneralTabPage::Create(Window* pWindow, const SfxItemSet& rSet)
-{
- return new SmGeneralTabPage(pWindow, rSet);
-}
-#endif NEVER
-
-
-
diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx
index cfee3c01eaea..a5e903c3c022 100644
--- a/starmath/source/document.cxx
+++ b/starmath/source/document.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: document.cxx,v $
*
- * $Revision: 1.24 $
+ * $Revision: 1.25 $
*
- * last change: $Author: tl $ $Date: 2001-04-19 14:47:39 $
+ * last change: $Author: tl $ $Date: 2001-05-02 16:58:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -273,19 +273,6 @@ void SmDocShell::SFX_NOTIFY(SfxBroadcaster&, const TypeId&,
{
switch (((SfxSimpleHint&)rHint).GetId())
{
- case HINT_CONFIGCHANGED:
- {
- SmModule *pp = SM_MOD1();
-
- if (pp->GetConfig()->IsAutoRedraw())
- { nModifyCount++; //! merkwrdig...
- // ohne dies wird die Grafik letztlich
- // nicht geupdatet
- Resize();
- }
- break;
- }
-
case HINT_FORMATCHANGED:
SetFormulaArranged(FALSE);
nModifyCount++; //! merkwrdig...
@@ -298,14 +285,7 @@ void SmDocShell::SFX_NOTIFY(SfxBroadcaster&, const TypeId&,
void SmDocShell::LoadSymbols()
{
- SmModule *pp = SM_MOD1();
- String sURL( pp->GetConfig()->GetSymbolFile() );
-
- SvtPathOptions aOpt;
- sURL = aOpt.SubstituteVariable( sURL );
- if( !FStatHelper::IsDocument( sURL ) )
- aOpt.SearchFile( sURL, SvtPathOptions::PATH_USERCONFIG );
- GetSymSetManager().Load( sURL );
+ GetSymSetManager().Load();
}
@@ -643,7 +623,7 @@ SmDocShell::SmDocShell(SfxObjectCreateMode eMode) :
SetPool(&SFX_APP()->GetPool());
SmModule *pp = SM_MOD1();
- aFormat = pp->GetConfig()->GetFormat();
+ aFormat = pp->GetConfig()->GetStandardFormat();
StartListening(aFormat);
StartListening(*pp->GetConfig());
@@ -665,8 +645,6 @@ SmDocShell::~SmDocShell()
EndListening(aFormat);
EndListening(*pp->GetConfig());
- SaveSymbols();
-
delete pEditEngine;
delete pEditEngineItemPool;
delete pTree;
@@ -894,7 +872,9 @@ void SmDocShell::ImplSave( SvStorageStreamRef xStrm )
<< 'T';
xStrm->WriteByteString(exString);
*xStrm << 'F' << aFormat
- << 'S' << GetSymSetManager().GetAccessedSymbols()
+ << 'S';
+ xStrm->WriteByteString( ExportString(C2S("unknown")) );
+ *xStrm << (USHORT) 0
<< '\0';
}
@@ -1090,10 +1070,7 @@ BOOL SmDocShell::ImportSM20File(SvStream *pStream, BOOL bInsert)
case 'S':
pSymbolSet = new SmSymSet();
ReadSM20SymSet(pStream, pSymbolSet);
- if (!bInsert)
- GetSymSetManager().AppendExtraSymbolSet(pSymbolSet);
- else
- delete pSymbolSet;
+ delete pSymbolSet;
break;
default:
@@ -1127,46 +1104,6 @@ void SmDocShell::Execute(SfxRequest& rReq)
break;
}
- case SID_SYMBOLS_LOAD:
- {
- SmModule *pp = SM_MOD1();
-
- SfxSimpleFileDialog *pFileDialog =
- new SfxSimpleFileDialog(0, WinBits(WB_OPEN | WB_3DLOOK));
-
-#ifdef MAC
- pFileDialog->AddFilter(SmResId(RID_SYMBOLFILESSTR), SmResId(RID_FILESYMTYP));
- pFileDialog->AddFilter(SmResId(RID_ALLFILESSTR), C2S("****"));
-
- pFileDialog->SetCurFilter(SmResId(RID_SYMBOLFILESSTR));
-#else
- String aExt( C2S("*.sms" ));
- pFileDialog->AddFilter(SmResId(RID_SYMBOLFILESSTR), aExt);
- pFileDialog->AddFilter(SmResId(RID_ALLFILESSTR), C2S("*.*"));
- pFileDialog->SetCurFilter(SmResId(RID_SYMBOLFILESSTR));
- pFileDialog->SetDefaultExt(aExt);
-#endif
-
- pFileDialog->SetPath(pp->GetConfig()->GetSymbolFile());
-
- if ( RET_OK == pFileDialog->Execute() )
- {
- // save old symbols and sets if necessary
- if (GetSymSetManager().IsModified())
- GetSymSetManager().Save();
- // load new symbols and sets from file
- INetURLObject aURLObj;
- aURLObj.SetSmartProtocol( INET_PROT_FILE );
- aURLObj.SetSmartURL( pFileDialog->GetPath() );
- GetSymSetManager().Load( aURLObj.GetMainURL() );
- // make that file the new default symbolfile
- SM_MOD1()->GetConfig()->SetSymbolFile( pFileDialog->GetPath() );
- }
-
- delete pFileDialog;
- }
- break;
-
case SID_AUTO_REDRAW :
{
SmModule *pp = SM_MOD1();
@@ -1321,16 +1258,19 @@ void SmDocShell::Execute(SfxRequest& rReq)
pAlignDialog->ReadFrom(GetFormat());
if (pAlignDialog->Execute() == RET_OK)
{
- SmFormat& rOldFormat = GetFormat();
+ SmFormat aOldFormat(GetFormat());
pAlignDialog->WriteTo(GetFormat());
+
SmModule *pp = SM_MOD1();
- pAlignDialog->WriteTo(pp->GetConfig()->GetFormat());
+ SmFormat aFmt( pp->GetConfig()->GetStandardFormat() );
+ pAlignDialog->WriteTo( aFmt );
+ pp->GetConfig()->SetStandardFormat( aFmt );
SfxUndoManager *pUndoMgr = GetUndoManager();
if (pUndoMgr)
pUndoMgr->AddUndoAction(
- new SmFormatAction(this, rOldFormat, GetFormat()));
+ new SmFormatAction(this, aOldFormat, GetFormat()));
if (aText.Len ())
{
@@ -1594,7 +1534,6 @@ BOOL SmDocShell::Try3x (SvStorage *pStor,
long lTime;
ULONG lDate;
String aBuffer;
- SmSymSet *pSymbolSet;
*pSvStream >> lIdent >> lVersion;
@@ -1638,10 +1577,10 @@ BOOL SmDocShell::Try3x (SvStorage *pStor,
case 'S':
{
- pSymbolSet = new SmSymSet();
- *pSvStream >> *pSymbolSet;
-
- GetSymSetManager().AppendExtraSymbolSet(pSymbolSet);
+ String aTmp;
+ USHORT n;
+ pSvStream->ReadByteString(aTmp, gsl_getSystemTextEncoding());
+ *pSvStream >> n;
break;
}
@@ -1738,8 +1677,7 @@ BOOL SmDocShell::Try2x (SvStorage *pStor,
{
pSymbolSet = new SmSymSet();
ReadSM20SymSet(pSvStream, pSymbolSet);
-
- GetSymSetManager().AppendExtraSymbolSet(pSymbolSet);
+ delete pSymbolSet;
break;
}
diff --git a/starmath/source/format.cxx b/starmath/source/format.cxx
index f79388822b41..2f86a4819141 100644
--- a/starmath/source/format.cxx
+++ b/starmath/source/format.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: format.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: tl $ $Date: 2000-11-02 15:07:16 $
+ * last change: $Author: tl $ $Date: 2001-05-02 16:58:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -129,6 +129,13 @@ SmFormat::SmFormat()
}
+void SmFormat::SetFont(USHORT nIdent, const SmFace &rFont)
+{
+ vFont[nIdent] = rFont;
+ vFont[nIdent].SetTransparent( TRUE );
+ vFont[nIdent].SetAlign( ALIGN_BASELINE );
+}
+
SmFormat & SmFormat::operator = (const SmFormat &rFormat)
{
SetBaseSize(rFormat.GetBaseSize());
@@ -149,6 +156,34 @@ SmFormat & SmFormat::operator = (const SmFormat &rFormat)
}
+BOOL SmFormat::operator == (const SmFormat &rFormat) const
+{
+ BOOL bRes = aBaseSize == rFormat.aBaseSize &&
+ eHorAlign == rFormat.eHorAlign &&
+ bIsTextmode == rFormat.bIsTextmode &&
+ bScaleNormalBrackets == rFormat.bScaleNormalBrackets;
+
+ USHORT i;
+ for (i = 0; i <= SIZ_END && bRes; ++i)
+ {
+ if (vSize[i] != rFormat.vSize[i])
+ bRes = FALSE;
+ }
+ for (i = 0; i <= DIS_END && bRes; ++i)
+ {
+ if (vDist[i] != rFormat.vDist[i])
+ bRes = FALSE;
+ }
+ for (i = 0; i <= FNT_END && bRes; ++i)
+ {
+ if (vFont[i] != rFormat.vFont[i])
+ bRes = FALSE;
+ }
+
+ return bRes;
+}
+
+
SvStream & operator << (SvStream &rStream, const SmFormat &rFormat)
{
//Da hier keinerlei Kompatibilitt vorgesehen ist muessen wir leider
diff --git a/starmath/source/makefile.mk b/starmath/source/makefile.mk
index 4ddd184983b5..fc78e3f879c3 100644
--- a/starmath/source/makefile.mk
+++ b/starmath/source/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.5 $
+# $Revision: 1.6 $
#
-# last change: $Author: as $ $Date: 2001-03-19 13:02:50 $
+# last change: $Author: tl $ $Date: 2001-05-02 16:58:48 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -91,14 +91,16 @@ SMDLL=TRUE
SRS2NAME =smres
SRC2FILES = smres.src \
+ symbol.src \
commands.src
SLOFILES = \
- $(SLO)$/register.obj \
- $(SLO)$/typemap.obj \
+ $(SLO)$/register.obj \
+ $(SLO)$/typemap.obj \
$(SLO)$/symbol.obj \
$(SLO)$/toolbox.obj \
$(SLO)$/action.obj \
+ $(SLO)$/cfgitem.obj \
$(SLO)$/config.obj \
$(SLO)$/dialog.obj \
$(SLO)$/document.obj \
@@ -109,7 +111,7 @@ SLOFILES = \
$(SLO)$/parse.obj \
$(SLO)$/utility.obj \
$(SLO)$/smdll.obj \
- $(SLO)$/smmod.obj \
+ $(SLO)$/smmod.obj \
$(SLO)$/view.obj \
$(SLO)$/edit.obj \
$(SLO)$/rect.obj \
@@ -117,7 +119,7 @@ SLOFILES = \
$(SLO)$/xchar.obj
EXCEPTIONSFILES = \
- $(SLO)$/register.obj \
+ $(SLO)$/register.obj \
$(SLO)$/mathml.obj \
$(SLO)$/unomodel.obj
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index 40794b2ceabd..4cfc76da1363 100644
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: parse.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: tl $ $Date: 2001-04-25 15:13:15 $
+ * last change: $Author: tl $ $Date: 2001-05-02 16:58:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -722,7 +722,10 @@ void SmParser::NextToken()
CurToken.nRow = Row;
CurToken.nCol = nTmpStart - ColOff + 1;
- rnEndPos = aTmpRes.EndPos;
+ if (aTmpRes.EndPos > rnEndPos)
+ rnEndPos = aTmpRes.EndPos;
+ else
+ ++rnEndPos;
}
break;
case '[':
@@ -1314,7 +1317,7 @@ void SmParser::Blank()
// Blanks am Zeilenende ignorieren wenn die entsprechende Option gesetzt ist
if (CurToken.eType == TNEWLINE || CurToken.eType == TEND
- && SM_MOD1()->GetConfig()->IsNoRightSpaces())
+ && SM_MOD1()->GetConfig()->IsIgnoreSpacesRight())
pBlankNode->Clear();
NodeStack.Push(pBlankNode);
diff --git a/starmath/source/smdll.cxx b/starmath/source/smdll.cxx
index e1b1bbb97758..3b5c892ad7d0 100644
--- a/starmath/source/smdll.cxx
+++ b/starmath/source/smdll.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: smdll.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: tl $ $Date: 2001-02-13 08:00:47 $
+ * last change: $Author: tl $ $Date: 2001-05-02 16:58:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -147,8 +147,6 @@ void SmDLL::Init()
SmToolBoxWrapper::RegisterChildWindow(TRUE);
SmCmdBoxWrapper::RegisterChildWindow(TRUE);
-
- ((SmModule*) *ppShlPtr)->InitManager ();
}
/*************************************************************************
diff --git a/starmath/source/smmod.cxx b/starmath/source/smmod.cxx
index 7e1342e3294e..9f987208619f 100644
--- a/starmath/source/smmod.cxx
+++ b/starmath/source/smmod.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: smmod.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 16:57:26 $
+ * last change: $Author: tl $ $Date: 2001-05-02 16:58:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -124,25 +124,32 @@ SFX_IMPL_INTERFACE(SmModule, SfxModule, SmResId(RID_APPLICATION))
SFX_STATUSBAR_REGISTRATION(SmResId(RID_STATUSBAR));
}
+
SmModule::SmModule(SvFactory* pObjFact) :
SmModuleDummy(SFX_APP()->CreateResManager("sm"), FALSE, pObjFact)
{
SetName( C2S("StarMath" ));
- pConfig = new SmConfig;
- pConfig->Initialize();
-
- pSymSetManager = new SmSymSetManager;
- pRectCache = new SmRectCache;
+ pConfig = 0;
+ pRectCache = new SmRectCache;
}
+
SmModule::~SmModule()
{
delete pConfig;
- delete pSymSetManager;
delete pRectCache;
}
+
+SmConfig * SmModule::GetConfig()
+{
+ if(!pConfig)
+ pConfig = new SmConfig;
+ return pConfig;
+}
+
+
void SmModule::GetState(SfxItemSet &rSet)
{
SfxWhichIter aIter(rSet);
@@ -172,12 +179,6 @@ void SmModule::Free()
{
}
-void SmModule::InitManager()
-{
- pSymSetManager->Init();
-}
-
-
SfxModule *SmModuleDummy::Load()
{
diff --git a/starmath/source/symbol.cxx b/starmath/source/symbol.cxx
index df51ef5e2f05..7e596927759a 100644
--- a/starmath/source/symbol.cxx
+++ b/starmath/source/symbol.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: symbol.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: tl $ $Date: 2001-04-09 09:48:32 $
+ * last change: $Author: tl $ $Date: 2001-05-02 16:58:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -61,12 +61,18 @@
#pragma hdrstop
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
#ifndef _UCBHELPER_CONTENT_HXX
#include <ucbhelper/content.hxx>
#endif
#ifndef _SV_MSGBOX_HXX //autogen
#include <vcl/msgbox.hxx>
#endif
+#ifndef _SV_RESARY_HXX
+#include <vcl/resary.hxx>
+#endif
#ifndef _SFXDISPATCH_HXX //autogen
#include <sfx2/dispatch.hxx>
#endif
@@ -79,6 +85,7 @@
#include "utility.hxx"
#include "dialog.hxx"
#include "config.hxx"
+#include "cfgitem.hxx"
#include "smmod.hxx"
#include "starmath.hrc"
@@ -104,6 +111,8 @@ using namespace ::rtl;
#define SF_IDENT 0x30334D53L
+SV_IMPL_PTRARR( SymbolArray, SmSym * );
+
/**************************************************************************/
/*
**
@@ -113,6 +122,74 @@ using namespace ::rtl;
long SF_Ident = SF_IDENT;
+/**************************************************************************/
+
+class SmMathConfigResource : public Resource
+{
+ ResStringArray aUiSymbolNamesAry;
+ ResStringArray aExportSymbolNamesAry;
+
+public:
+ SmMathConfigResource();
+
+ ResStringArray& GetUiSymbolNamesArray() { return aUiSymbolNamesAry; }
+ ResStringArray& GetExportSymbolNamesArray() { return aExportSymbolNamesAry; }
+};
+
+
+SmMathConfigResource::SmMathConfigResource() :
+ Resource( SmResId(RID_LOCALIZED_SYMBOL_NAMES) ),
+ aUiSymbolNamesAry ( ResId(RID_UI_SYMBOL_NAMES) ),
+ aExportSymbolNamesAry ( ResId(RID_EXPORT_SYMBOL_NAMES) )
+{
+ FreeResource();
+}
+
+/**************************************************************************/
+
+String GetExportSymbolName( const String &rUiSymbolName )
+{
+ String aRes;
+
+ SmMathConfigResource aCfgRes;
+ ResStringArray &rUiNames = aCfgRes.GetUiSymbolNamesArray();
+ ResStringArray &rExportNames = aCfgRes.GetExportSymbolNamesArray();
+ USHORT nCount = rUiNames.Count();
+
+ for (USHORT i = 0; i < nCount; ++i)
+ {
+ if (rUiSymbolName == rUiNames.GetString(i))
+ {
+ aRes = rExportNames.GetString(i);
+ break;
+ }
+ }
+
+ return aRes;
+}
+
+
+String GetUiSymbolName( const String &rExportSymbolName )
+{
+ String aRes;
+
+ SmMathConfigResource aCfgRes;
+ ResStringArray &rUiNames = aCfgRes.GetUiSymbolNamesArray();
+ ResStringArray &rExportNames = aCfgRes.GetExportSymbolNamesArray();
+ USHORT nCount = rExportNames.Count();
+
+ for (USHORT i = 0; i < nCount; ++i)
+ {
+ if (rExportSymbolName == rExportNames.GetString(i))
+ {
+ aRes = rUiNames.GetString(i);
+ break;
+ }
+ }
+
+ return aRes;
+}
+
/**************************************************************************/
/*
@@ -125,26 +202,40 @@ SmSym::SmSym() :
Name(C2S("unknown")),
Character('\0'),
pHashNext(0),
- pSymSetManager(0)
+ pSymSetManager(0),
+ bPredefined(FALSE),
+ bDocSymbol(FALSE),
+ aSetName(C2S("unknown"))
{
+ aExportName = Name;
Face.SetTransparent(TRUE);
}
+
SmSym::SmSym(const SmSym& rSymbol)
{
- Name = rSymbol.Name;
- Face = rSymbol.Face;
- Character = rSymbol.Character;
+ Name = rSymbol.Name;
+ Face = rSymbol.Face;
+ Character = rSymbol.Character;
+ aSetName = rSymbol.aSetName;
+ bPredefined = rSymbol.bPredefined;
+ bDocSymbol = rSymbol.bDocSymbol;
+ aExportName = rSymbol.aExportName;
pHashNext = 0;
pSymSetManager = 0;
}
-SmSym::SmSym(const String& rName, const Font& rFont, sal_Unicode aChar)
+
+SmSym::SmSym(const String& rName, const Font& rFont, sal_Unicode aChar,
+ const String& rSet, BOOL bIsPredefined)
{
- Name = rName;
- Face = rFont;
- Character = aChar;
+ Name = aExportName = rName;
+ Face = rFont;
+ Character = aChar;
+ aSetName = rSet;
+ bPredefined = bIsPredefined;
+ bDocSymbol = FALSE;
pHashNext = 0;
pSymSetManager = 0;
@@ -153,9 +244,13 @@ SmSym::SmSym(const String& rName, const Font& rFont, sal_Unicode aChar)
SmSym& SmSym::operator = (const SmSym& rSymbol)
{
- Name = rSymbol.Name;
- Face = rSymbol.Face;
- Character = rSymbol.Character;
+ Name = rSymbol.Name;
+ Face = rSymbol.Face;
+ Character = rSymbol.Character;
+ aSetName = rSymbol.aSetName;
+ bPredefined = rSymbol.bPredefined;
+ bDocSymbol = rSymbol.bDocSymbol;
+ aExportName = rSymbol.aExportName;
pHashNext = 0;
@@ -360,40 +455,40 @@ SvStream& operator >> (SvStream& rStream, SmSymSet& rSymbolSet)
/**************************************************************************/
+
+static osl::Mutex & lcl_GetSymSetMgrMutex()
+{
+ static osl::Mutex aMutex;
+ return aMutex;
+}
+
+
void SmSymSetManager::SFX_NOTIFY(SfxBroadcaster& rBC, const TypeId& rBCType,
const SfxHint& rHint, const TypeId& rHintType)
{
- if (((SfxSimpleHint&)rHint).GetId() == HINT_CONFIGCHANGED)
- {
- SmViewShell *pViewSh = SmGetActiveView();
- if (pViewSh)
- {
- SfxDispatcher &rDis = *pViewSh->GetViewFrame()->GetDispatcher();
- rDis.Execute(SID_SAVESYMBOLS);
- rDis.Execute(SID_LOADSYMBOLS);
- }
- }
}
+
UINT32 SmSymSetManager::GetHashIndex(const String& rSymbolName)
{
UINT32 x = 0;
for (xub_StrLen i = 0; i < rSymbolName.Len(); i++)
x += x * rSymbolName.GetChar(i);
- return x % NoHashEntries;
+ return x % pImpl->NoHashEntries;
}
+
void SmSymSetManager::EnterHashTable(SmSymSet& rSymbolSet)
{
for (int i = 0; i < rSymbolSet.GetCount(); i++)
{
int j = GetHashIndex(rSymbolSet.GetSymbol(i).GetName());
- if (HashEntries[j] == 0)
- HashEntries[j] = rSymbolSet.SymbolList.GetObject(i);
+ if (pImpl->HashEntries[j] == 0)
+ pImpl->HashEntries[j] = rSymbolSet.SymbolList.GetObject(i);
else
{
- SmSym *p = HashEntries[j];
+ SmSym *p = pImpl->HashEntries[j];
while (p->pHashNext)
p = p->pHashNext;
p->pHashNext = rSymbolSet.SymbolList.GetObject(i);
@@ -404,12 +499,12 @@ void SmSymSetManager::EnterHashTable(SmSymSet& rSymbolSet)
void SmSymSetManager::FillHashTable()
{
- if (HashEntries)
+ if (pImpl->HashEntries)
{
- memset(HashEntries, 0, NoHashEntries * sizeof(SmSym *));
+ memset( pImpl->HashEntries, 0, pImpl->NoHashEntries * sizeof(SmSym *) );
- for (int i = 0; i < NoSymbolSets; i++)
- EnterHashTable(*GetSymbolSet(i));
+ for (UINT32 i = 0; i < pImpl->NoSymbolSets; i++)
+ EnterHashTable( *GetSymbolSet( (USHORT) i ) );
}
}
@@ -419,67 +514,53 @@ void SmSymSetManager::Init()
StartListening(*pp->GetConfig());
}
+
void SmSymSetManager::Exit()
{
SmModule *pp = SM_MOD1();
EndListening(*pp->GetConfig());
}
-SmSymSetManager::SmSymSetManager(UINT32 HashTableSize)
+
+SmSymSetManager::SmSymSetManager(USHORT HashTableSize)
{
- SymbolSets.Clear();
- NoSymbolSets = 0;
- NoHashEntries = HashTableSize;
- HashEntries = new SmSym *[NoHashEntries];
- memset(HashEntries, 0, sizeof(SmSym *) * NoHashEntries);
- Modified = FALSE;
+ pImpl = new SmSymSetManager_Impl;
+ pImpl->SymbolSets.Clear();
+ pImpl->NoSymbolSets = 0;
+ pImpl->NoHashEntries = HashTableSize;
+ pImpl->HashEntries = new SmSym *[pImpl->NoHashEntries];
+ memset( pImpl->HashEntries, 0, sizeof(SmSym *) * pImpl->NoHashEntries );
+ pImpl->Modified = FALSE;
}
SmSymSetManager::SmSymSetManager(const SmSymSetManager& rSymbolSetManager)
{
- SymbolSets.Clear();
- NoSymbolSets = 0;
- NoHashEntries = rSymbolSetManager.NoHashEntries;
- HashEntries = new SmSym *[NoHashEntries];
- memset(HashEntries, 0, sizeof(SmSym *) * NoHashEntries);
-
- for (int i = 0; i < rSymbolSetManager.GetCount(); i++)
- AddSymbolSet(new SmSymSet(*rSymbolSetManager.GetSymbolSet(i)));
-
- Modified = rSymbolSetManager.Modified;
}
SmSymSetManager::~SmSymSetManager()
{
- for (int i = 0; i< NoSymbolSets; i++)
- delete SymbolSets.Get(i);
+ USHORT i;
+ for (i = 0; i< pImpl->NoSymbolSets; i++)
+ delete pImpl->SymbolSets.Get(i);
+ delete pImpl->HashEntries;
- delete HashEntries;
+ delete pImpl;
+ pImpl = 0;
}
+
SmSymSetManager& SmSymSetManager::operator = (const SmSymSetManager& rSymbolSetManager)
{
- int i;
- for (i = 0; i< NoSymbolSets; i++)
- delete SymbolSets.Get(i);
-
- SymbolSets.Clear();
- NoSymbolSets = 0;
-
- for (i = 0; i < rSymbolSetManager.GetCount(); i++)
- AddSymbolSet(new SmSymSet(*rSymbolSetManager.GetSymbolSet(i)));
-
- Modified = rSymbolSetManager.Modified;
-
return *this;
}
+
USHORT SmSymSetManager::AddSymbolSet(SmSymSet* pSymbolSet)
{
- if (NoSymbolSets >= SymbolSets.GetSize())
- SymbolSets.SetSize(NoSymbolSets + 1);
+ if (pImpl->NoSymbolSets >= pImpl->SymbolSets.GetSize())
+ pImpl->SymbolSets.SetSize(pImpl->NoSymbolSets + 1);
- SymbolSets.Put(NoSymbolSets++, pSymbolSet);
+ pImpl->SymbolSets.Put(pImpl->NoSymbolSets++, pSymbolSet);
pSymbolSet->pSymSetManager = this;
@@ -487,9 +568,9 @@ USHORT SmSymSetManager::AddSymbolSet(SmSymSet* pSymbolSet)
pSymbolSet->SymbolList.GetObject(i)->pSymSetManager = this;
FillHashTable();
- Modified = TRUE;
+ pImpl->Modified = TRUE;
- return NoSymbolSets - 1;
+ return (USHORT) (pImpl->NoSymbolSets - 1);
}
void SmSymSetManager::ChangeSymbolSet(SmSymSet* pSymbolSet)
@@ -497,156 +578,182 @@ void SmSymSetManager::ChangeSymbolSet(SmSymSet* pSymbolSet)
if (pSymbolSet)
{
FillHashTable();
- Modified = TRUE;
+ pImpl->Modified = TRUE;
}
}
void SmSymSetManager::DeleteSymbolSet(USHORT SymbolSetNo)
{
- delete SymbolSets.Get(SymbolSetNo);
- NoSymbolSets--;
+ delete pImpl->SymbolSets.Get(SymbolSetNo);
+ pImpl->NoSymbolSets--;
- for (int i = SymbolSetNo; i < NoSymbolSets; i++)
- SymbolSets.Put(i, SymbolSets.Get(i + 1));
+ for (UINT32 i = SymbolSetNo; i < pImpl->NoSymbolSets; i++)
+ pImpl->SymbolSets.Put(i, pImpl->SymbolSets.Get(i + 1));
FillHashTable();
- Modified = TRUE;
+ pImpl->Modified = TRUE;
}
USHORT SmSymSetManager::GetSymbolSetPos(const String& rSymbolSetName) const
{
- for (USHORT i = 0; i < NoSymbolSets; i++)
- if (SymbolSets.Get(i)->GetName() == rSymbolSetName)
+ for (USHORT i = 0; i < pImpl->NoSymbolSets; i++)
+ if (pImpl->SymbolSets.Get(i)->GetName() == rSymbolSetName)
return (i);
return SYMBOLSET_NONE;
}
-
SmSym *SmSymSetManager::GetSymbol(const String& rSymbolName)
{
- SmSym *p = HashEntries[GetHashIndex(rSymbolName)];
- while (p)
+ SmSym *pSym = pImpl->HashEntries[GetHashIndex(rSymbolName)];
+ while (pSym)
{
- if (p->Name == rSymbolName)
+ if (pSym->Name == rSymbolName)
break;
- p = p->pHashNext;
+ pSym = pSym->pHashNext;
}
- return p;
+
+ return pSym;
}
-void SmSymSetManager::Load( const String &rURL )
+
+void SmSymSetManager::AddReplaceSymbol( const SmSym &rSymbol )
{
- if( aStreamName != rURL )
+ SmSym *pSym = GetSymbol( rSymbol.GetName() );
+ if (pSym)
{
- for (int i = 0; i< NoSymbolSets; i++)
- delete SymbolSets.Get(i);
+ *pSym = rSymbol;
+ }
+ else
+ {
+ USHORT nPos = GetSymbolSetPos( rSymbol.GetSetName() );
+ if (SYMBOLSET_NONE == nPos)
+ {
+ AddSymbolSet( new SmSymSet( rSymbol.GetSetName() ) );
+ nPos = GetSymbolSetPos( rSymbol.GetSetName() );
+ }
+ DBG_ASSERT( nPos != SYMBOLSET_NONE, "SymbolSet not found");
+ GetSymbolSet( nPos )->AddSymbol( new SmSym( rSymbol ) );
+ }
+ SetModified( TRUE );
+}
- SymbolSets.Clear();
- NoSymbolSets = 0;
- aStreamName = rURL;
+USHORT SmSymSetManager::GetSymbolCount() const
+{
+ USHORT nRes = 0;
+ USHORT nSets = GetSymbolSetCount();
+ for (USHORT i = 0; i < nSets; ++i)
+ nRes += GetSymbolSet(i)->GetCount();
+ return nRes;
+}
- // get stream to use
- SfxMedium aMedium( aStreamName,
- STREAM_READ | STREAM_SHARE_DENYWRITE, FALSE );
- aMedium.SetTransferPriority( SFX_TFPRIO_SYNCHRON );
- SvStream *pStream = aMedium.GetInStream();
- if( pStream && !pStream->GetError() )
- {
- *pStream >> *this;
- Modified = FALSE;
- }
- else
- {
- SmModule *pp = SM_MOD1();
+const SmSym * SmSymSetManager::GetSymbol( USHORT nPos ) const
+{
+ const SmSym *pRes = 0;
- if ( pp->GetConfig()->IsWarnNoSymbols() )
- {
- ErrorBox aErrorBox( NULL, SmResId( RID_READSYMBOLERROR ) );
- String aString( aErrorBox.GetMessText() );
- aString.SearchAndReplaceAscii( "%FILE%", aStreamName );
- aErrorBox.SetMessText( aString );
- aErrorBox.Execute();
-
- Modified = FALSE;
- pp->GetConfig()->SetWarnNoSymbols(FALSE);
- }
- }
+ INT16 nIdx = 0;
+ USHORT nSets = GetSymbolSetCount();
+ USHORT i = 0;
+ while (i < nSets && !pRes)
+ {
+ USHORT nEntries = GetSymbolSet(i)->GetCount();
+ if (nPos < nIdx + nEntries)
+ pRes = &GetSymbolSet(i)->GetSymbol( nPos - nIdx );
+ else
+ nIdx += nEntries;
+ ++i;
}
+
+ return pRes;
}
-void SmSymSetManager::Save()
+
+void SmSymSetManager::Load()
{
- if (Modified)
- {
- SfxMedium aMedium( aStreamName,
- STREAM_WRITE | STREAM_TRUNC | STREAM_SHARE_DENYALL, FALSE );
- SvStream *pStream = aMedium.GetOutStream();
+ SmMathConfig &rCfg = *SM_MOD1()->GetConfig();
- if( pStream && !pStream->GetError() )
+ USHORT nCount = rCfg.GetSymbolCount();
+ USHORT i;
+ for (i = 0; i < nCount; ++i)
+ {
+ const SmSym *pSym = rCfg.GetSymbol(i);
+ if (pSym)
{
- *pStream << *this;
- Modified = FALSE;
+ const String &rSetName = pSym->GetSetName();
+ if (SYMBOLSET_NONE == GetSymbolSetPos( rSetName ))
+ AddSymbolSet( new SmSymSet( rSetName ) );
+ USHORT nSetPos = GetSymbolSetPos( rSetName );
+ SmSymSet *pSymSet = GetSymbolSet( nSetPos );
+ if (pSymSet)
+ {
+ pSymSet->AddSymbol( new SmSym( *pSym ) );
+ }
}
- else
- {
- ErrorBox aErrorBox( NULL, SmResId(RID_WRITESYMBOLERROR));
- String aString (aErrorBox.GetMessText());
- USHORT nPos = aString.SearchAscii("%FILE%");
+ }
+ // build HashTables
+ nCount = GetSymbolSetCount();
+ for (i = 0; i < nCount; ++i)
+ ChangeSymbolSet( GetSymbolSet( i ) );
- aString.Erase(nPos, 6);
- aString.Insert(aStreamName, nPos);
- aErrorBox.SetMessText(aString);
+
+ if (0 == nCount)
+ {
+ SmModule *pp = SM_MOD1();
+ if ( pp->GetConfig()->IsNoSymbolsWarning() )
+ {
+ ErrorBox aErrorBox( NULL, SmResId( RID_READSYMBOLERROR ) );
+ String aString( aErrorBox.GetMessText() );
+ aString.SearchAndReplaceAscii( "%FILE%", pImpl->aStreamName );
+ aErrorBox.SetMessText( aString );
aErrorBox.Execute();
+
+ pImpl->Modified = FALSE;
+ pp->GetConfig()->SetNoSymbolsWarning(FALSE);
}
- aMedium.Commit();
}
}
-
-SvStream& operator << (SvStream& rStream, SmSymSetManager& rSymbolSetManager)
+void SmSymSetManager::Save()
{
- rStream << (long)SF_IDENT << (USHORT) rSymbolSetManager.NoSymbolSets;
+ SmMathConfig &rCfg = *SM_MOD1()->GetConfig();
- for (int i = 0; i < rSymbolSetManager.NoSymbolSets; i++)
- rStream << *rSymbolSetManager.GetSymbolSet(i);
+ // get number of Symbols
+ USHORT nSymbolCount = 0;
+ USHORT nSetCount = GetSymbolSetCount();
+ USHORT i;
+ for (i = 0; i < nSetCount; ++i)
+ nSymbolCount += GetSymbolSet( i )->GetCount();
- return rStream;
-}
-
-SvStream& operator >> (SvStream& rStream, SmSymSetManager& rSymbolSetManager)
-{
- rStream >> SF_Ident;
- if (SF_Ident == SF_IDENT || SF_Ident == SF_SM20IDENT)
+ if (nSymbolCount)
{
- USHORT n;
- rStream >> n;
-
- if (rSymbolSetManager.HashEntries)
- memset(rSymbolSetManager.HashEntries, 0,
- rSymbolSetManager.NoHashEntries * sizeof(SmSym *));
-
- for (int i = 0; i < n; i++)
+ USHORT nSaveSymbolCnt = 0;
+ const SmSym **pSymbols = new const SmSym* [ nSymbolCount ];
+ const SmSym **pSym = pSymbols;
+ for (i = 0; i < nSetCount; ++i)
{
- SmSymSet *pSymbolSet;
-
- if ((pSymbolSet = new SmSymSet) == 0)
- break;
-
- rStream >> *pSymbolSet;
- rSymbolSetManager.AddSymbolSet(pSymbolSet);
+ const SmSymSet *pSymSet = GetSymbolSet( i );
+ USHORT n = pSymSet->GetCount();
+ for (USHORT j = 0; j < n; ++j)
+ {
+ const SmSym &rSym = pSymSet->GetSymbol( j );
+ if (!rSym.IsDocSymbol())
+ {
+ *pSym++ = &rSym;
+ ++nSaveSymbolCnt;
+ }
+ }
}
+ DBG_ASSERT(pSym - pSymbols == nSaveSymbolCnt, "wrong number of symbols" );
+ rCfg.ReplaceSymbols( pSymbols, nSaveSymbolCnt );
+ delete pSymbols;
}
-
- SF_Ident = SF_IDENT;
-
- return rStream;
}
+
void ReadSM20SymSet(SvStream *pStream, SmSymSet *pSymbolSet)
{
SF_Ident = SF_SM20IDENT;
diff --git a/starmath/source/toolbox.cxx b/starmath/source/toolbox.cxx
index b215e8bd4717..20c405f0a442 100644
--- a/starmath/source/toolbox.cxx
+++ b/starmath/source/toolbox.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: toolbox.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 16:57:27 $
+ * last change: $Author: tl $ $Date: 2001-05-02 16:58:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -251,7 +251,7 @@ IMPL_LINK_INLINE_END( SmToolBoxWindow, CmdSelectHdl, ToolBox*, pToolBox)
void SmToolBoxWindow::ShowWindows()
{
- if ( SM_MOD1()->GetConfig()->IsToolBoxVisible() )
+ if ( SM_MOD1()->GetConfig()->IsToolboxVisible() )
Show();
}
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index b1afe771cf5c..0edcdb9d1ce0 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: view.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: tl $ $Date: 2001-03-08 09:27:43 $
+ * last change: $Author: tl $ $Date: 2001-05-02 16:58:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -1055,7 +1055,7 @@ USHORT SmViewShell::Print(SfxProgress &rProgress, PrintDialog *pPrintDialog)
}
// output text on bottom
- if (pp->GetConfig()->IsPrintText())
+ if (pp->GetConfig()->IsPrintFormulaText())
{
// Font aFont(FAMILY_DONTKNOW, Size(0, 600));
Font aFont;
@@ -1116,7 +1116,7 @@ USHORT SmViewShell::Print(SfxProgress &rProgress, PrintDialog *pPrintDialog)
case PRINT_SIZE_ZOOMED:
{
SmModule *pp = SM_MOD1();
- Fraction aFraction (pp->GetConfig()->GetPrintZoom(), 100);
+ Fraction aFraction (pp->GetConfig()->GetPrintZoomFactor(), 100);
OutputMapMode = MapMode(MAP_100TH_MM, aZeroPoint, aFraction, aFraction);
break;