Files
libreoffice/idl/inc/types.hxx

254 lines
9.1 KiB
C++
Raw Normal View History

2010-10-27 13:11:31 +01:00
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
2000-09-18 15:33:13 +00:00
#ifndef INCLUDED_IDL_INC_TYPES_HXX
#define INCLUDED_IDL_INC_TYPES_HXX
2000-09-18 15:33:13 +00:00
2011-09-20 23:30:51 +01:00
#include <rtl/strbuf.hxx>
2000-09-18 15:33:13 +00:00
#include <tools/ref.hxx>
#include <basobj.hxx>
struct SvSlotElement;
typedef std::vector< SvSlotElement* > SvSlotElementList;
2000-09-18 15:33:13 +00:00
class SvMetaSlot;
class SvMetaType;
typedef tools::SvRef<SvMetaType> SvMetaTypeRef;
2000-09-18 15:33:13 +00:00
class SvMetaAttribute : public SvMetaReference
{
SvMetaTypeRef aType;
SvNumberIdentifier aSlotId;
SvBOOL aAutomation;
SvBOOL aExport;
SvBOOL aReadonly;
SvBOOL aIsCollection;
SvBOOL aReadOnlyDoc;
SvBOOL aHidden;
bool bNewAttr;
2000-09-18 15:33:13 +00:00
protected:
virtual void ReadAttributesSvIdl( SvIdlDataBase & rBase,
SvTokenStream & rInStm ) SAL_OVERRIDE;
2000-09-18 15:33:13 +00:00
public:
TYPEINFO_OVERRIDE();
2000-09-18 15:33:13 +00:00
SvMetaAttribute();
SvMetaAttribute( SvMetaType * );
void SetNewAttribute( bool bNew )
2000-09-18 15:33:13 +00:00
{ bNewAttr = bNew; }
bool IsNewAttribute() const
2000-09-18 15:33:13 +00:00
{ return bNewAttr; }
bool GetReadonly() const;
2000-09-18 15:33:13 +00:00
void SetSlotId( const SvNumberIdentifier & rId )
{ aSlotId = rId; }
const SvNumberIdentifier & GetSlotId() const;
void SetExport( bool bSet )
2000-09-18 15:33:13 +00:00
{ aExport = bSet; }
bool GetExport() const;
2000-09-18 15:33:13 +00:00
void SetHidden( bool bSet )
2000-09-18 15:33:13 +00:00
{ aHidden = bSet; }
bool GetHidden() const;
2000-09-18 15:33:13 +00:00
void SetAutomation( bool bSet )
2000-09-18 15:33:13 +00:00
{ aAutomation = bSet; }
bool GetAutomation() const;
2000-09-18 15:33:13 +00:00
void SetIsCollection( bool bSet )
2000-09-18 15:33:13 +00:00
{ aIsCollection = bSet; }
bool GetIsCollection() const;
void SetReadOnlyDoc( bool bSet )
2000-09-18 15:33:13 +00:00
{ aReadOnlyDoc = bSet; }
bool GetReadOnlyDoc() const;
2000-09-18 15:33:13 +00:00
void SetType( SvMetaType * pT ) { aType = pT; }
SvMetaType * GetType() const;
virtual bool IsMethod() const;
virtual bool IsVariable() const;
virtual OString GetMangleName( bool bVariable ) const;
2000-09-18 15:33:13 +00:00
virtual bool Test( SvIdlDataBase &, SvTokenStream & rInStm ) SAL_OVERRIDE;
virtual bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ) SAL_OVERRIDE;
sal_uLong MakeSfx( OStringBuffer& rAtrrArray );
virtual void Insert( SvSlotElementList&, const OString& rPrefix,
2000-09-18 15:33:13 +00:00
SvIdlDataBase& );
OString Compare( SvMetaAttribute *pAttr );
2000-09-18 15:33:13 +00:00
};
typedef tools::SvRef<SvMetaAttribute> SvMetaAttributeRef;
class SvMetaAttributeMemberList : public SvRefMemberList<SvMetaAttribute *> {};
2000-09-18 15:33:13 +00:00
enum { CALL_VALUE, CALL_POINTER, CALL_REFERENCE };
enum { TYPE_METHOD, TYPE_STRUCT, TYPE_BASE, TYPE_ENUM, TYPE_UNION,
TYPE_CLASS, TYPE_POINTER };
class SvMetaType : public SvMetaExtern
{
SvBOOL aIn; // input parameter
SvBOOL aOut; // return parameter
2000-09-18 15:33:13 +00:00
Svint aCall0, aCall1;
Svint aSbxDataType;
SvIdentifier aSvName;
SvIdentifier aSbxName;
SvIdentifier aOdlName;
SvIdentifier aCName;
SvIdentifier aBasicPostfix;
SvIdentifier aBasicName;
SvMetaAttributeMemberList * pAttrList;
int nType;
bool bIsItem;
bool bIsShell;
2000-09-18 15:33:13 +00:00
char cParserChar;
void WriteSfxItem( const OString& rItemName, SvIdlDataBase & rBase,
2000-09-18 15:33:13 +00:00
SvStream & rOutStm );
protected:
bool ReadNamesSvIdl( SvIdlDataBase & rBase,
2000-09-18 15:33:13 +00:00
SvTokenStream & rInStm );
virtual void ReadAttributesSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ) SAL_OVERRIDE;
virtual void ReadContextSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ) SAL_OVERRIDE;
2000-09-18 15:33:13 +00:00
bool ReadHeaderSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
2000-09-18 15:33:13 +00:00
public:
TYPEINFO_OVERRIDE();
2000-09-18 15:33:13 +00:00
SvMetaType();
SvMetaType( const OString& rTypeName, char cParserChar,
const OString& rCName );
SvMetaType( const OString& rTypeName, const OString& rSbxName,
const OString& rOdlName, char cParserChar,
const OString& rCName, const OString& rBasicName,
const OString& rBasicPostfix );
2000-09-18 15:33:13 +00:00
virtual ~SvMetaType();
2000-09-18 15:33:13 +00:00
SvMetaAttributeMemberList & GetAttrList() const;
sal_uLong GetAttrCount() const
2000-09-18 15:33:13 +00:00
{
return pAttrList ? pAttrList->size() : 0L;
2000-09-18 15:33:13 +00:00
}
void AppendAttr( SvMetaAttribute * pAttr )
{
GetAttrList().push_back( pAttr );
2000-09-18 15:33:13 +00:00
}
void SetType( int nT );
int GetType() const { return nType; }
SvMetaType * GetBaseType() const;
SvMetaType * GetReturnType() const;
bool IsItem() const { return bIsItem; }
bool IsShell() const { return bIsShell; }
2000-09-18 15:33:13 +00:00
void SetIn( bool b ) { aIn = b; }
bool GetIn() const;
2000-09-18 15:33:13 +00:00
void SetOut( bool b ) { aOut = b; }
bool GetOut() const;
2000-09-18 15:33:13 +00:00
void SetCall0( int e );
int GetCall0() const;
void SetCall1( int e);
int GetCall1() const;
void SetBasicName(const OString& rName)
2011-12-29 10:37:09 +00:00
{ aBasicName.setString(rName); }
2000-09-18 15:33:13 +00:00
const OString& GetBasicName() const;
const OString& GetSvName() const;
const OString& GetSbxName() const;
const OString& GetOdlName() const;
const OString& GetCName() const;
2000-09-18 15:33:13 +00:00
char GetParserChar() const { return cParserChar; }
virtual bool SetName( const OString& rName, SvIdlDataBase * = NULL ) SAL_OVERRIDE;
2000-09-18 15:33:13 +00:00
virtual bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ) SAL_OVERRIDE;
2000-09-18 15:33:13 +00:00
sal_uLong MakeSfx( OStringBuffer& rAtrrArray );
2000-09-18 15:33:13 +00:00
virtual void WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm );
bool ReadMethodArgs( SvIdlDataBase & rBase,
2000-09-18 15:33:13 +00:00
SvTokenStream & rInStm );
OString GetParserString() const;
2000-09-18 15:33:13 +00:00
};
class SvMetaTypeMemberList : public SvRefMemberList<SvMetaType *> {};
2000-09-18 15:33:13 +00:00
class SvMetaTypeString : public SvMetaType
{
public:
TYPEINFO_OVERRIDE();
2000-09-18 15:33:13 +00:00
SvMetaTypeString();
};
class SvMetaTypeStringMemberList : public SvRefMemberList<SvMetaTypeString *> {};
2000-09-18 15:33:13 +00:00
class SvMetaEnumValue : public SvMetaName
{
public:
TYPEINFO_OVERRIDE();
2012-01-27 07:52:36 +00:00
SvMetaEnumValue();
2000-09-18 15:33:13 +00:00
virtual bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ) SAL_OVERRIDE;
2000-09-18 15:33:13 +00:00
};
typedef tools::SvRef<SvMetaEnumValue> SvMetaEnumValueRef;
2000-09-18 15:33:13 +00:00
class SvMetaEnumValueMemberList : public SvRefMemberList<SvMetaEnumValue *> {};
2000-09-18 15:33:13 +00:00
class SvMetaTypeEnum : public SvMetaType
{
SvMetaEnumValueMemberList aEnumValueList;
OString aPrefix;
2000-09-18 15:33:13 +00:00
protected:
virtual void ReadContextSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ) SAL_OVERRIDE;
2000-09-18 15:33:13 +00:00
public:
TYPEINFO_OVERRIDE();
2000-09-18 15:33:13 +00:00
SvMetaTypeEnum();
sal_uInt16 GetMaxValue() const;
sal_uLong Count() const { return aEnumValueList.size(); }
const OString& GetPrefix() const { return aPrefix; }
SvMetaEnumValue * GetObject( sal_uLong n ) const
{ return aEnumValueList[n]; }
2000-09-18 15:33:13 +00:00
virtual bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ) SAL_OVERRIDE;
2000-09-18 15:33:13 +00:00
};
typedef tools::SvRef<SvMetaTypeEnum> SvMetaTypeEnumRef;
2000-09-18 15:33:13 +00:00
class SvMetaTypeEnumMemberList : public SvRefMemberList<SvMetaTypeEnum *> {};
2000-09-18 15:33:13 +00:00
class SvMetaTypevoid : public SvMetaType
{
public:
TYPEINFO_OVERRIDE();
2000-09-18 15:33:13 +00:00
SvMetaTypevoid();
};
class SvMetaTypevoidMemberList : public SvRefMemberList<SvMetaTypevoid *> {};
2000-09-18 15:33:13 +00:00
#endif // INCLUDED_IDL_INC_TYPES_HXX
2000-09-18 15:33:13 +00:00
2010-10-27 13:11:31 +01:00
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */