00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef SYMBOL_HXX
00036 #define SYMBOL_HXX
00037
00038 #ifndef _VOS_REFERNCE_HXX_
00039 #include <vos/refernce.hxx>
00040 #endif
00041 #ifndef _FONT_HXX //autogen
00042 #include <vcl/font.hxx>
00043 #endif
00044 #ifndef _LIST_HXX //autogen
00045 #include <tools/list.hxx>
00046 #endif
00047 #ifndef _TOOLS_DEBUG_HXX //autogen
00048 #include <tools/debug.hxx>
00049 #endif
00050 #ifndef _DYNARY_HXX
00051 #include <tools/dynary.hxx>
00052 #endif
00053 #ifndef _SFXLSTNER_HXX //autogen
00054 #include <svtools/lstner.hxx>
00055 #endif
00056 #ifndef _SVARRAY_HXX
00057 #include <svtools/svarray.hxx>
00058 #endif
00059
00060 #ifndef UTILITY_HXX
00061 #include "utility.hxx"
00062 #endif
00063 #ifndef _SMMOD_HXX
00064 #include <smmod.hxx>
00065 #endif
00066
00067 #define SS_ATTR_ACCESS 0x80
00068
00069 #define SYMBOLSET_NONE 0xFFFF
00070 #define SYMBOL_NONE 0xFFFF
00071
00072 class SmSymSetManager;
00073
00075
00076 inline const String GetExportSymbolName( const String &rUiSymbolName )
00077 {
00078 return SM_MOD1()->GetLocSymbolData().GetExportSymbolName( rUiSymbolName );
00079 }
00080
00081
00082 inline const String GetUiSymbolName( const String &rExportSymbolName )
00083 {
00084 return SM_MOD1()->GetLocSymbolData().GetUiSymbolName( rExportSymbolName );
00085 }
00086
00087 inline const String GetExportSymbolSetName( const String &rUiSymbolSetName )
00088 {
00089 return SM_MOD1()->GetLocSymbolData().GetExportSymbolSetName( rUiSymbolSetName );
00090 }
00091
00092
00093 inline const String GetUiSymbolSetName( const String &rExportSymbolSetName )
00094 {
00095 return SM_MOD1()->GetLocSymbolData().GetUiSymbolSetName( rExportSymbolSetName );
00096 }
00097
00099
00100 class SmSym
00101 {
00102 friend class SmSymSetManager;
00103
00104 SmFace Face;
00105 String Name;
00106 String aExportName;
00107 String aSetName;
00108 SmSym *pHashNext;
00109 SmSymSetManager *pSymSetManager;
00110 sal_Unicode Character;
00111 BYTE Attribut;
00112 BOOL bPredefined;
00113 BOOL bDocSymbol;
00114
00115 public:
00116 SmSym();
00117 SmSym(const SmSym& rSymbol);
00118 SmSym(const String& rName, const Font& rFont, sal_Unicode cChar,
00119 const String& rSet, BOOL bIsPredefined = FALSE);
00120
00121 SmSym& operator = (const SmSym& rSymbol);
00122
00123 const Font& GetFace() const { return Face; }
00124 sal_Unicode GetCharacter() const { return Character; }
00125 const String& GetName() const { return Name; }
00126
00127 void SetFace( const Font& rFont ) { Face = rFont; }
00128 void SetCharacter( sal_Unicode cChar ) { Character = cChar; }
00129 void SetName( const String &rTxt ) { Name = rTxt; }
00130
00131 BOOL IsPredefined() const { return bPredefined; }
00132 const String & GetSetName() const { return aSetName; }
00133 void SetSetName( const String &rName ) { aSetName = rName; }
00134 const String & GetExportName() const { return aExportName; }
00135 void SetExportName( const String &rName ) { aExportName = rName; }
00136
00137 BOOL IsDocSymbol() const { return bDocSymbol; }
00138 void SetDocSymbol( BOOL bVal ) { bDocSymbol = bVal; }
00139 };
00140
00141 DECLARE_LIST(SmListSym, SmSym *)
00142 SV_DECL_PTRARR( SymbolArray, SmSym *, 32, 32 )
00143
00144
00145
00146 class SmSymSet
00147 {
00148 friend class SmSymSetManager;
00149
00150 SmListSym SymbolList;
00151 String Name;
00152 SmSymSetManager *pSymSetManager;
00153
00154 public:
00155 SmSymSet();
00156 SmSymSet(const SmSymSet& rSymbolSet);
00157 SmSymSet(const String& rName);
00158 ~SmSymSet();
00159
00160 SmSymSet& operator = (const SmSymSet& rSymbolSet);
00161
00162 const String& GetName() const { return Name; }
00163 void SetName(String& rName);
00164 USHORT GetCount() const { return (USHORT) SymbolList.Count(); }
00165
00166 const SmSym& GetSymbol(USHORT SymbolNo) const
00167 {
00168 DBG_ASSERT(SymbolList.GetObject(SymbolNo), "Symbol nicht vorhanden");
00169 return *SymbolList.GetObject(SymbolNo);
00170 }
00171
00172 USHORT AddSymbol(SmSym* pSymbol);
00173 void DeleteSymbol(USHORT SymbolNo);
00174 SmSym * RemoveSymbol(USHORT SymbolNo);
00175 USHORT GetSymbolPos(const String& rName);
00176 };
00177
00178 DECLARE_DYNARRAY(SmArraySymSet, SmSymSet *)
00179
00180
00181
00182 class SmSymbolDialog;
00183
00184
00185 struct SmSymSetManager_Impl
00186 {
00187 SmArraySymSet SymbolSets;
00188 SmSymSetManager & rSymSetMgr;
00189 SmSym** HashEntries;
00190 USHORT NoSymbolSets;
00191 USHORT NoHashEntries;
00192 BOOL Modified;
00193
00194 SmSymSetManager_Impl( SmSymSetManager &rMgr, USHORT HashTableSize );
00195 ~SmSymSetManager_Impl();
00196
00197 SmSymSetManager_Impl & operator = ( const SmSymSetManager_Impl &rImpl );
00198 };
00199
00200
00201 class SmSymSetManager : public SfxListener
00202 {
00203 friend struct SmSymSetManager_Impl;
00204
00205 SmSymSetManager_Impl *pImpl;
00206
00207 virtual void SFX_NOTIFY(SfxBroadcaster& rBC, const TypeId& rBCType,
00208 const SfxHint& rHint, const TypeId& rHintType);
00209
00210 UINT32 GetHashIndex(const String& rSymbolName);
00211 void EnterHashTable(SmSym& rSymbol);
00212 void EnterHashTable(SmSymSet& rSymbolSet);
00213 void FillHashTable();
00214 void Init();
00215 void Exit();
00216
00217 public:
00218 SmSymSetManager(USHORT HashTableSize = 137);
00219 SmSymSetManager(const SmSymSetManager& rSymbolSetManager);
00220 ~SmSymSetManager();
00221
00222 SmSymSetManager& operator = (const SmSymSetManager& rSymbolSetManager);
00223
00224 void GetSymbols( std::vector< SmSym > &rSymbols ) const;
00225
00226
00227 USHORT AddSymbolSet(SmSymSet* pSymbolSet);
00228 void ChangeSymbolSet(SmSymSet* pSymbolSet);
00229 void DeleteSymbolSet(USHORT SymbolSetNo);
00230 USHORT GetSymbolSetPos(const String& rSymbolSetName) const;
00231 USHORT GetSymbolSetCount() const { return pImpl->NoSymbolSets; }
00232 SmSymSet *GetSymbolSet(USHORT SymbolSetNo) const
00233 {
00234 return pImpl->SymbolSets.Get(SymbolSetNo);
00235 }
00236
00237 SmSym * GetSymbolByName(const String& rSymbolName);
00238 const SmSym * GetSymbolByName(const String& rSymbolName) const
00239 {
00240 return ((SmSymSetManager *) this)->GetSymbolByName(rSymbolName);
00241 }
00242
00243 void AddReplaceSymbol( const SmSym & rSymbol );
00244 USHORT GetSymbolCount() const;
00245 const SmSym * GetSymbolByPos( USHORT nPos ) const;
00246
00247 BOOL IsModified() const { return pImpl->Modified; }
00248 void SetModified(BOOL Modify) { pImpl->Modified = Modify; }
00249
00250 void Load();
00251 void Save();
00252 };
00253
00254 #endif
00255