[Libreoffice-commits] core.git: 2 commits - idl/inc idl/source sc/sdi
Noel Grandin
noel at peralex.com
Tue Feb 16 09:59:44 UTC 2016
idl/inc/bastype.hxx | 1
idl/inc/object.hxx | 6 +-
idl/inc/parser.hxx | 4 +
idl/inc/types.hxx | 3 -
idl/source/objects/object.cxx | 2
idl/source/prj/parser.cxx | 119 +++++++++++++++++++++++++++++++++++++++++-
sc/sdi/cellsh.sdi | 3 -
sc/sdi/docsh.sdi | 1
8 files changed, 128 insertions(+), 11 deletions(-)
New commits:
commit aa8c854590e76a437521596c566ce1327efffb6e
Author: Noel Grandin <noel at peralex.com>
Date: Tue Feb 16 11:49:07 2016 +0200
tighten up the attribute parsing, and drop some unused slots
Change-Id: I6f2ff99c919851b21ce120c40286c133bf65c778
diff --git a/idl/inc/parser.hxx b/idl/inc/parser.hxx
index 78a62af..8059cfd 100644
--- a/idl/inc/parser.hxx
+++ b/idl/inc/parser.hxx
@@ -45,7 +45,7 @@ public:
void ReadInterfaceOrShell( SvMetaModule& rModule, MetaTypeType aMetaTypeType );
void ReadInterfaceOrShellEntry( SvMetaClass& rClass );
bool ReadInterfaceOrShellSlot( SvMetaSlot& rSlot );
- bool ReadInterfaceOrShellAttribute( SvMetaAttribute& rAttr );
+ bool ReadInterfaceOrShellMethodOrAttribute( SvMetaAttribute& rAttr );
void ReadItem();
void ReadStruct();
void ReadEnum();
diff --git a/idl/source/prj/parser.cxx b/idl/source/prj/parser.cxx
index 7773598..9d77a36 100644
--- a/idl/source/prj/parser.cxx
+++ b/idl/source/prj/parser.cxx
@@ -338,7 +338,7 @@ void SvIdlParser::ReadInterfaceOrShellEntry(SvMetaClass& rClass)
else
{
xAttr = new SvMetaAttribute( pType );
- bOk = ReadInterfaceOrShellAttribute(*xAttr);
+ bOk = ReadInterfaceOrShellMethodOrAttribute(*xAttr);
}
if( bOk )
bOk = xAttr->Test( rInStm );
@@ -392,20 +392,21 @@ bool SvIdlParser::ReadInterfaceOrShellSlot(SvMetaSlot& rSlot)
return bOk;
}
-bool SvIdlParser::ReadInterfaceOrShellAttribute( SvMetaAttribute& rAttr )
+bool SvIdlParser::ReadInterfaceOrShellMethodOrAttribute( SvMetaAttribute& rAttr )
{
sal_uInt32 nTokPos = rInStm.Tell();
bool bOk = false;
rAttr.SetName( ReadIdentifier() );
- rAttr.aSlotId.ReadSvIdl( rBase, rInStm );
+ rAttr.aSlotId.setString( ReadIdentifier() );
+ sal_uLong n;
+ if( !rBase.FindId( rAttr.aSlotId.getString(), &n ) )
+ throw SvParseException( rInStm, "no value for identifier <" + rAttr.aSlotId.getString() + "> " );
+ rAttr.aSlotId.SetValue(n);
bOk = true;
SvToken& rTok = rInStm.GetToken();
if( rTok.IsChar() && rTok.GetChar() == '(' )
{
- tools::SvRef<SvMetaType> xT(new SvMetaType() );
- xT->SetRef(rAttr.GetType() );
- rAttr.aType = xT;
bOk = rAttr.aType->ReadMethodArgs( rBase, rInStm );
}
if( bOk && rInStm.ReadIf( '[' ) )
diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi
index 126c6f7..cf94574 100644
--- a/sc/sdi/cellsh.sdi
+++ b/sc/sdi/cellsh.sdi
@@ -19,9 +19,6 @@
interface CellSelection
{
- SbxObject Movement
- [
- ]
// Slot's die in der DrawShell disabled werden. {
FID_DEFINE_NAME [ ExecMethod = ExecuteEdit; StateMethod = GetState; ]
FID_ADD_NAME [ ExecMethod = ExecuteEdit; StateMethod = GetState; ]
diff --git a/sc/sdi/docsh.sdi b/sc/sdi/docsh.sdi
index d103ee7..6964d6b 100644
--- a/sc/sdi/docsh.sdi
+++ b/sc/sdi/docsh.sdi
@@ -71,7 +71,6 @@ interface TableDocument
SID_PIVOT_GET [ StateMethod = GetSbxState; ]
SID_SC_ACTIVEOBJECT [ StateMethod = GetDrawObjState; ]
SID_ATTR_YEAR2000 [ StateMethod = GetState; ExecMethod = Execute; ]
- SbxObject OLEObjects []
SID_CHART_SOURCE [ ExecMethod = Execute; ]
SID_CHART_ADDSOURCE [ ExecMethod = Execute; ]
FID_AUTO_CALC [ ExecMethod = Execute; StateMethod = GetState; ]
commit 314cb543fe69d2a08fa40084512f40062437bed1
Author: Noel Grandin <noel at peralex.com>
Date: Tue Feb 16 08:55:36 2016 +0200
parse shell/interface entries in SvIdlParser
Change-Id: Ief68b26be0a0890ffdfa02a5904ba9d2cb364c65
diff --git a/idl/inc/bastype.hxx b/idl/inc/bastype.hxx
index ef7a88c..afe3642 100644
--- a/idl/inc/bastype.hxx
+++ b/idl/inc/bastype.hxx
@@ -52,6 +52,7 @@ class SvIdentifier
sal_uInt32 nValue;
public:
SvIdentifier() : nValue( 0 ) {};
+ SvIdentifier(sal_uInt32 n) : nValue( n ) {};
void setString(const OString& rStr) { m_aStr = rStr; }
const OString& getString() const { return m_aStr; }
diff --git a/idl/inc/object.hxx b/idl/inc/object.hxx
index 12f5af2..6d56eeb 100644
--- a/idl/inc/object.hxx
+++ b/idl/inc/object.hxx
@@ -50,12 +50,12 @@ class SvMetaClass : public SvMetaType
{
public:
tools::SvRef<SvMetaClass> aSuperClass;
-private:
- SvRefMemberList<SvMetaAttribute *> aAttrList;
std::vector<SvClassElement> aClassElementList;
-
+ SvRefMemberList<SvMetaAttribute *> aAttrList;
bool TestAttribute( SvIdlDataBase & rBase, SvTokenStream & rInStm,
SvMetaAttribute & rAttr ) const;
+private:
+
static void WriteSlotStubs( const OString& rShellName,
SvSlotElementList & rSlotList,
ByteStringList & rList,
diff --git a/idl/inc/parser.hxx b/idl/inc/parser.hxx
index 2258369..78a62af 100644
--- a/idl/inc/parser.hxx
+++ b/idl/inc/parser.hxx
@@ -29,6 +29,7 @@ class SvMetaModule;
class SvMetaTypeEnum;
class SvStringHashEntry;
class SvMetaType;
+class SvMetaClass;
class SvIdlParser
{
@@ -42,6 +43,9 @@ public:
void ReadModuleElement( SvMetaModule& rModule );
void ReadInclude( SvMetaModule& rModule );
void ReadInterfaceOrShell( SvMetaModule& rModule, MetaTypeType aMetaTypeType );
+ void ReadInterfaceOrShellEntry( SvMetaClass& rClass );
+ bool ReadInterfaceOrShellSlot( SvMetaSlot& rSlot );
+ bool ReadInterfaceOrShellAttribute( SvMetaAttribute& rAttr );
void ReadItem();
void ReadStruct();
void ReadEnum();
diff --git a/idl/inc/types.hxx b/idl/inc/types.hxx
index 3be88e1b..ec7a0de 100644
--- a/idl/inc/types.hxx
+++ b/idl/inc/types.hxx
@@ -30,10 +30,9 @@ typedef SvRefMemberList< SvMetaSlot* > SvSlotElementList;
class SvMetaAttribute : public SvMetaReference
{
-protected:
+public:
virtual void ReadAttributesSvIdl( SvIdlDataBase & rBase,
SvTokenStream & rInStm ) override;
-public:
tools::SvRef<SvMetaType> aType;
SvIdentifier aSlotId;
SvMetaAttribute();
diff --git a/idl/source/objects/object.cxx b/idl/source/objects/object.cxx
index 711ca195..31b6515 100644
--- a/idl/source/objects/object.cxx
+++ b/idl/source/objects/object.cxx
@@ -102,7 +102,7 @@ void SvMetaClass::ReadContextSvIdl( SvIdlDataBase & rBase,
bool SvMetaClass::TestAttribute( SvIdlDataBase & rBase, SvTokenStream & rInStm,
SvMetaAttribute & rAttr ) const
{
- if ( !rAttr.GetRef() && dynamic_cast<const SvMetaSlot *>(&rAttr) != nullptr )
+ if ( !rAttr.GetRef() && dynamic_cast<const SvMetaSlot *>(&rAttr) )
{
OSL_FAIL( "Neuer Slot : " );
OSL_FAIL( rAttr.GetSlotId().getString().getStr() );
diff --git a/idl/source/prj/parser.cxx b/idl/source/prj/parser.cxx
index 8f368b4..7773598 100644
--- a/idl/source/prj/parser.cxx
+++ b/idl/source/prj/parser.cxx
@@ -292,7 +292,7 @@ void SvIdlParser::ReadInterfaceOrShell( SvMetaModule& rModule, MetaTypeType aMet
while( nBeginPos != rInStm.Tell() )
{
nBeginPos = rInStm.Tell();
- aClass->ReadContextSvIdl( rBase, rInStm );
+ ReadInterfaceOrShellEntry(*aClass);
rInStm.ReadIfDelimiter();
}
ReadChar( '}' );
@@ -302,6 +302,122 @@ void SvIdlParser::ReadInterfaceOrShell( SvMetaModule& rModule, MetaTypeType aMet
rBase.GetClassList().push_back( aClass );
}
+void SvIdlParser::ReadInterfaceOrShellEntry(SvMetaClass& rClass)
+{
+ sal_uInt32 nTokPos = rInStm.Tell();
+ SvToken& rTok = rInStm.GetToken_Next();
+
+ if( rTok.Is( SvHash_import() ) )
+ {
+ SvMetaClass * pClass = rBase.ReadKnownClass( rInStm );
+ if( !pClass )
+ throw SvParseException( rInStm, "unknown imported interface" );
+ SvClassElement xEle;
+ xEle.SetClass( pClass );
+ rClass.aClassElementList.push_back( xEle );
+
+ rTok = rInStm.GetToken();
+ if( rTok.IsString() )
+ {
+ xEle.SetPrefix( rTok.GetString() );
+ rInStm.GetToken_Next();
+ }
+ return;
+ }
+ else
+ {
+ rInStm.Seek( nTokPos );
+ SvMetaType * pType = rBase.ReadKnownType( rInStm );
+ tools::SvRef<SvMetaAttribute> xAttr;
+ bool bOk = false;
+ if( !pType || pType->IsItem() )
+ {
+ xAttr = new SvMetaSlot( pType );
+ bOk = ReadInterfaceOrShellSlot(static_cast<SvMetaSlot&>(*xAttr));
+ }
+ else
+ {
+ xAttr = new SvMetaAttribute( pType );
+ bOk = ReadInterfaceOrShellAttribute(*xAttr);
+ }
+ if( bOk )
+ bOk = xAttr->Test( rInStm );
+ if( bOk )
+ bOk = rClass.TestAttribute( rBase, rInStm, *xAttr );
+ if( bOk )
+ {
+ if( !xAttr->GetSlotId().IsSet() )
+ xAttr->SetSlotId( SvIdentifier(rBase.GetUniqueId()) );
+ rClass.aAttrList.push_back( xAttr );
+ return;
+ }
+ }
+ rInStm.Seek( nTokPos );
+}
+
+bool SvIdlParser::ReadInterfaceOrShellSlot(SvMetaSlot& rSlot)
+{
+ sal_uInt32 nTokPos = rInStm.Tell();
+ bool bOk = true;
+
+ SvMetaAttribute * pAttr = rBase.ReadKnownAttr( rInStm, rSlot.GetType() );
+ if( pAttr )
+ {
+ SvMetaSlot * pKnownSlot = dynamic_cast<SvMetaSlot*>( pAttr );
+ if( !pKnownSlot )
+ throw SvParseException( rInStm, "attribute " + pAttr->GetName() + " is method or variable but not a slot" );
+ rSlot.SetRef( pKnownSlot );
+ rSlot.SetName( pKnownSlot->GetName() );
+ bOk = rSlot.SvMetaObject::ReadSvIdl( rBase, rInStm );
+ }
+ else
+ {
+ bOk = rSlot.SvMetaAttribute::ReadSvIdl( rBase, rInStm );
+ SvMetaAttribute *pAttr2 = rBase.SearchKnownAttr( rSlot.GetSlotId() );
+ if( pAttr2 )
+ {
+ SvMetaSlot * pKnownSlot = dynamic_cast<SvMetaSlot*>( pAttr2 );
+ if( !pKnownSlot )
+ throw SvParseException( rInStm, "attribute " + pAttr2->GetName() + " is method or variable but not a slot" );
+ rSlot.SetRef( pKnownSlot );
+ // names may differ, because explicitly given
+ if ( pKnownSlot->GetName() != rSlot.GetName() )
+ throw SvParseException( rInStm, "Illegal definition!" );
+ }
+ }
+
+ if( !bOk )
+ rInStm.Seek( nTokPos );
+
+ return bOk;
+}
+
+bool SvIdlParser::ReadInterfaceOrShellAttribute( SvMetaAttribute& rAttr )
+{
+ sal_uInt32 nTokPos = rInStm.Tell();
+ bool bOk = false;
+ rAttr.SetName( ReadIdentifier() );
+ rAttr.aSlotId.ReadSvIdl( rBase, rInStm );
+
+ bOk = true;
+ SvToken& rTok = rInStm.GetToken();
+ if( rTok.IsChar() && rTok.GetChar() == '(' )
+ {
+ tools::SvRef<SvMetaType> xT(new SvMetaType() );
+ xT->SetRef(rAttr.GetType() );
+ rAttr.aType = xT;
+ bOk = rAttr.aType->ReadMethodArgs( rBase, rInStm );
+ }
+ if( bOk && rInStm.ReadIf( '[' ) )
+ {
+ ReadChar( ']' );
+ }
+
+ if( !bOk )
+ rInStm.Seek( nTokPos );
+ return bOk;
+}
+
SvMetaType * SvIdlParser::ReadKnownType()
{
OString aName = ReadIdentifier();
More information about the Libreoffice-commits
mailing list