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