1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _TYPES_HXX 29 #define _TYPES_HXX 30 31 #include <tools/ref.hxx> 32 #include <basobj.hxx> 33 34 class SvSlotElementList; 35 struct SvSlotElement; 36 37 /******************** class SvMetaAttribute *****************************/ 38 SV_DECL_REF(SvMetaType) 39 SV_DECL_REF(SvMetaAttribute) 40 SV_DECL_PERSIST_LIST(SvMetaAttribute,SvMetaAttribute *) 41 class SvMetaAttribute : public SvMetaReference 42 { 43 SvMetaTypeRef aType; 44 SvNumberIdentifier aSlotId; 45 SvBOOL aAutomation; 46 SvBOOL aExport; 47 SvBOOL aReadonly; 48 SvBOOL aIsCollection; 49 SvBOOL aReadOnlyDoc; 50 SvBOOL aHidden; 51 sal_Bool bNewAttr; 52 53 protected: 54 #ifdef IDL_COMPILER 55 virtual void WriteCSource( SvIdlDataBase & rBase, 56 SvStream & rOutStm, sal_Bool bSet ); 57 sal_uLong MakeSlotValue( SvIdlDataBase & rBase, sal_Bool bVariable ) const; 58 virtual void WriteAttributes( SvIdlDataBase & rBase, 59 SvStream & rOutStm, sal_uInt16 nTab, 60 WriteType, WriteAttribute = 0 ); 61 virtual void ReadAttributesSvIdl( SvIdlDataBase & rBase, 62 SvTokenStream & rInStm ); 63 virtual void WriteAttributesSvIdl( SvIdlDataBase & rBase, 64 SvStream & rOutStm, sal_uInt16 nTab ); 65 #endif 66 public: 67 SV_DECL_META_FACTORY1( SvMetaAttribute, SvMetaReference, 2 ) 68 SvMetaAttribute(); 69 SvMetaAttribute( SvMetaType * ); 70 71 void SetNewAttribute( sal_Bool bNew ) 72 { bNewAttr = bNew; } 73 sal_Bool IsNewAttribute() const 74 { return bNewAttr; } 75 sal_Bool GetReadonly() const; 76 77 void SetSlotId( const SvNumberIdentifier & rId ) 78 { aSlotId = rId; } 79 const SvNumberIdentifier & GetSlotId() const; 80 81 void SetExport( sal_Bool bSet ) 82 { aExport = bSet; } 83 sal_Bool GetExport() const; 84 85 void SetHidden( sal_Bool bSet ) 86 { aHidden = bSet; } 87 sal_Bool GetHidden() const; 88 89 void SetAutomation( sal_Bool bSet ) 90 { aAutomation = bSet; } 91 sal_Bool GetAutomation() const; 92 93 void SetIsCollection( sal_Bool bSet ) 94 { aIsCollection = bSet; } 95 sal_Bool GetIsCollection() const; 96 void SetReadOnlyDoc( sal_Bool bSet ) 97 { aReadOnlyDoc = bSet; } 98 sal_Bool GetReadOnlyDoc() const; 99 100 void SetType( SvMetaType * pT ) { aType = pT; } 101 SvMetaType * GetType() const; 102 103 virtual sal_Bool IsMethod() const; 104 virtual sal_Bool IsVariable() const; 105 virtual ByteString GetMangleName( sal_Bool bVariable ) const; 106 107 // void FillSbxObject( SbxInfo * pInfo, sal_uInt16 nSbxFlags = 0 ); 108 // virtual void FillSbxObject( SvIdlDataBase & rBase, SbxObject * pObj, sal_Bool bVariable ); 109 110 #ifdef IDL_COMPILER 111 virtual sal_Bool Test( SvIdlDataBase &, SvTokenStream & rInStm ); 112 virtual sal_Bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ); 113 virtual void WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab ); 114 virtual void WriteParam( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab, 115 WriteType ); 116 void WriteRecursiv_Impl( SvIdlDataBase & rBase, 117 SvStream & rOutStm, sal_uInt16 nTab, 118 WriteType, WriteAttribute ); 119 virtual void Write( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab, 120 WriteType, WriteAttribute = 0 ); 121 sal_uLong MakeSfx( ByteString * pAtrrArray ); 122 virtual void Insert( SvSlotElementList&, const ByteString & rPrefix, 123 SvIdlDataBase& ); 124 virtual void WriteHelpId( SvIdlDataBase & rBase, SvStream & rOutStm, 125 Table * pIdTable ); 126 virtual void WriteSrc( SvIdlDataBase & rBase, SvStream & rOutStm, 127 Table * pIdTable ); 128 virtual void WriteCSV( SvIdlDataBase&, SvStream& ); 129 void FillIDTable(Table *pIDTable); 130 ByteString Compare( SvMetaAttribute *pAttr ); 131 #endif 132 }; 133 SV_IMPL_REF(SvMetaAttribute) 134 SV_IMPL_PERSIST_LIST(SvMetaAttribute,SvMetaAttribute *) 135 136 137 /******************** class SvType *********************************/ 138 enum { CALL_VALUE, CALL_POINTER, CALL_REFERENCE }; 139 enum { TYPE_METHOD, TYPE_STRUCT, TYPE_BASE, TYPE_ENUM, TYPE_UNION, 140 TYPE_CLASS, TYPE_POINTER }; 141 class SvMetaType : public SvMetaExtern 142 { 143 SvBOOL aIn; // Eingangsparameter 144 SvBOOL aOut; // Returnparameter 145 Svint aCall0, aCall1; 146 Svint aSbxDataType; 147 SvIdentifier aSvName; 148 SvIdentifier aSbxName; 149 SvIdentifier aOdlName; 150 SvIdentifier aCName; 151 SvIdentifier aBasicPostfix; 152 SvIdentifier aBasicName; 153 SvMetaAttributeMemberList * pAttrList; 154 int nType; 155 sal_Bool bIsItem; 156 sal_Bool bIsShell; 157 char cParserChar; 158 159 #ifdef IDL_COMPILER 160 void WriteSfxItem( const ByteString & rItemName, SvIdlDataBase & rBase, 161 SvStream & rOutStm ); 162 protected: 163 sal_Bool ReadNamesSvIdl( SvIdlDataBase & rBase, 164 SvTokenStream & rInStm ); 165 virtual void ReadAttributesSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ); 166 virtual void WriteAttributesSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab ); 167 virtual void ReadContextSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ); 168 virtual void WriteContextSvIdl( SvIdlDataBase &, SvStream & rOutStm, 169 sal_uInt16 nTab ); 170 171 virtual void WriteContext( SvIdlDataBase & rBase, SvStream & rOutStm, 172 sal_uInt16 nTab, 173 WriteType, WriteAttribute = 0 ); 174 virtual void WriteAttributes( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab, 175 WriteType, WriteAttribute = 0 ); 176 sal_Bool ReadHeaderSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ); 177 void WriteHeaderSvIdl( SvIdlDataBase &, SvStream & rOutStm, 178 sal_uInt16 nTab ); 179 #endif 180 public: 181 SV_DECL_META_FACTORY1( SvMetaType, SvMetaExtern, 18 ) 182 SvMetaType(); 183 SvMetaType( const ByteString & rTypeName, char cParserChar, 184 const ByteString & rCName ); 185 SvMetaType( const ByteString & rTypeName, const ByteString & rSbxName, 186 const ByteString & rOdlName, char cParserChar, 187 const ByteString & rCName, const ByteString & rBasicName, 188 const ByteString & rBasicPostfix/*, SbxDataType nT = SbxEMPTY */); 189 190 SvMetaAttributeMemberList & GetAttrList() const; 191 sal_uLong GetAttrCount() const 192 { 193 return pAttrList ? pAttrList->Count() : 0L; 194 } 195 void AppendAttr( SvMetaAttribute * pAttr ) 196 { 197 GetAttrList().Append( pAttr ); 198 } 199 200 void SetType( int nT ); 201 int GetType() const { return nType; } 202 SvMetaType * GetBaseType() const; 203 SvMetaType * GetReturnType() const; 204 sal_Bool IsItem() const { return bIsItem; } 205 sal_Bool IsShell() const { return bIsShell; } 206 207 // void SetSbxDataType( SbxDataType nT ) 208 // { aSbxDataType = (int)nT; } 209 // SbxDataType GetSbxDataType() const; 210 211 void SetIn( sal_Bool b ) { aIn = b; } 212 sal_Bool GetIn() const; 213 214 void SetOut( sal_Bool b ) { aOut = b; } 215 sal_Bool GetOut() const; 216 217 void SetCall0( int e ); 218 int GetCall0() const; 219 220 void SetCall1( int e); 221 int GetCall1() const; 222 223 void SetBasicName(const ByteString& rName) 224 { aBasicName = rName; } 225 226 const ByteString & GetBasicName() const; 227 ByteString GetBasicPostfix() const; 228 const ByteString & GetSvName() const; 229 const ByteString & GetSbxName() const; 230 const ByteString & GetOdlName() const; 231 const ByteString & GetCName() const; 232 char GetParserChar() const { return cParserChar; } 233 234 virtual sal_Bool SetName( const ByteString & rName, SvIdlDataBase * = NULL ); 235 236 // void FillSbxObject( SbxVariable * pObj, sal_Bool bVariable ); 237 238 #ifdef IDL_COMPILER 239 virtual sal_Bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ); 240 virtual void WriteSvIdl( SvIdlDataBase & rBase, 241 SvStream & rOutStm, sal_uInt16 nTab ); 242 virtual void Write( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab, 243 WriteType, WriteAttribute = 0 ); 244 ByteString GetCString() const; 245 void WriteSvIdlType( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab ); 246 void WriteOdlType( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab ); 247 void AppendParserString (ByteString &rString); 248 249 sal_uLong MakeSfx( ByteString * pAtrrArray ); 250 virtual void WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm ); 251 //sal_Bool ReadTypePrefix( SvIdlDataBase &, SvTokenStream & rInStm ); 252 sal_Bool ReadMethodArgs( SvIdlDataBase & rBase, 253 SvTokenStream & rInStm ); 254 void WriteTypePrefix( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab, WriteType ); 255 void WriteMethodArgs( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab, WriteType ); 256 void WriteTheType( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab, WriteType ); 257 ByteString GetParserString() const; 258 void WriteParamNames( SvIdlDataBase & rBase, SvStream & rOutStm, 259 const ByteString & rChief ); 260 #endif 261 }; 262 SV_IMPL_REF(SvMetaType) 263 DECLARE_LIST(SvMetaTypeList,SvMetaType *) 264 SV_DECL_IMPL_PERSIST_LIST(SvMetaType,SvMetaType *) 265 266 267 /******************** class SvTypeString *********************************/ 268 class SvMetaTypeString : public SvMetaType 269 { 270 public: 271 SV_DECL_META_FACTORY1( SvMetaTypeString, SvMetaType, 19 ) 272 SvMetaTypeString(); 273 }; 274 SV_DECL_IMPL_REF(SvMetaTypeString) 275 SV_DECL_IMPL_PERSIST_LIST(SvMetaTypeString,SvMetaTypeString *) 276 277 278 /******************** class SvMetaEnumValue **********************************/ 279 class SvMetaEnumValue : public SvMetaName 280 { 281 ByteString aEnumValue; 282 public: 283 SV_DECL_META_FACTORY1( SvMetaEnumValue, SvMetaName, 20 ) 284 SvMetaEnumValue(); 285 286 #ifdef IDL_COMPILER 287 virtual sal_Bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ); 288 virtual void WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab ); 289 virtual void Write( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab, 290 WriteType, WriteAttribute = 0 ); 291 #endif 292 }; 293 SV_DECL_IMPL_REF(SvMetaEnumValue) 294 SV_DECL_IMPL_PERSIST_LIST(SvMetaEnumValue,SvMetaEnumValue *) 295 296 297 /******************** class SvTypeEnum *********************************/ 298 class SvMetaTypeEnum : public SvMetaType 299 { 300 SvMetaEnumValueMemberList aEnumValueList; 301 ByteString aPrefix; 302 protected: 303 #ifdef IDL_COMPILER 304 virtual void ReadContextSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ); 305 virtual void WriteContextSvIdl( SvIdlDataBase &, SvStream & rOutStm, 306 sal_uInt16 nTab ); 307 virtual void WriteContext( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab, 308 WriteType, WriteAttribute = 0 ); 309 #endif 310 public: 311 SV_DECL_META_FACTORY1( SvMetaTypeEnum, SvMetaType, 21 ) 312 SvMetaTypeEnum(); 313 314 sal_uInt16 GetMaxValue() const; 315 sal_uLong Count() const { return aEnumValueList.Count(); } 316 const ByteString & GetPrefix() const { return aPrefix; } 317 SvMetaEnumValue * GetObject( sal_uLong n ) const 318 { return aEnumValueList.GetObject( n ); } 319 320 #ifdef IDL_COMPILER 321 virtual sal_Bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ); 322 virtual void WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab ); 323 324 virtual void Write( SvIdlDataBase & rBase, SvStream & rOutStm, 325 sal_uInt16 nTab, 326 WriteType, WriteAttribute = 0 ); 327 #endif 328 }; 329 SV_DECL_IMPL_REF(SvMetaTypeEnum) 330 SV_DECL_IMPL_PERSIST_LIST(SvMetaTypeEnum,SvMetaTypeEnum *) 331 332 333 /******************** class SvTypeVoid ***********************************/ 334 class SvMetaTypevoid : public SvMetaType 335 { 336 public: 337 SV_DECL_META_FACTORY1( SvMetaTypevoid, SvMetaName, 22 ) 338 SvMetaTypevoid(); 339 }; 340 SV_DECL_IMPL_REF(SvMetaTypevoid) 341 SV_DECL_IMPL_PERSIST_LIST(SvMetaTypevoid,SvMetaTypevoid *) 342 343 344 #endif // _TYPES_HXX 345 346