2010-10-12 15:53:47 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-07-11 19:49:09 +01:00
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
2016-01-06 07:52:56 +01:00
|
|
|
#include <sal/config.h>
|
2006-09-16 11:47:56 +00:00
|
|
|
|
2016-01-06 07:52:56 +01:00
|
|
|
#include <algorithm>
|
2000-09-18 15:33:13 +00:00
|
|
|
#include <ctype.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2011-09-20 23:30:51 +01:00
|
|
|
#include <rtl/strbuf.hxx>
|
2014-11-14 22:52:35 +01:00
|
|
|
#include <osl/diagnose.h>
|
2011-09-20 23:30:51 +01:00
|
|
|
|
2000-09-18 15:33:13 +00:00
|
|
|
#include <object.hxx>
|
|
|
|
#include <globals.hxx>
|
|
|
|
#include <database.hxx>
|
|
|
|
|
|
|
|
|
|
|
|
SvClassElement::SvClassElement()
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
|
|
|
SvMetaClass::SvMetaClass()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void SvMetaClass::ReadAttributesSvIdl( SvIdlDataBase & rBase,
|
|
|
|
SvTokenStream & rInStm )
|
|
|
|
{
|
|
|
|
SvMetaType::ReadAttributesSvIdl( rBase, rInStm );
|
|
|
|
}
|
|
|
|
|
|
|
|
void SvMetaClass::ReadContextSvIdl( SvIdlDataBase & rBase,
|
|
|
|
SvTokenStream & rInStm )
|
|
|
|
{
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_uInt32 nTokPos = rInStm.Tell();
|
2000-09-18 15:33:13 +00:00
|
|
|
SvToken * pTok = rInStm.GetToken_Next();
|
|
|
|
|
|
|
|
if( pTok->Is( SvHash_import() ) )
|
|
|
|
{
|
|
|
|
SvMetaClass * pClass = rBase.ReadKnownClass( rInStm );
|
|
|
|
if( pClass )
|
|
|
|
{
|
2015-08-03 15:12:26 +02:00
|
|
|
tools::SvRef<SvClassElement> xEle = new SvClassElement();
|
2000-09-18 15:33:13 +00:00
|
|
|
xEle->SetClass( pClass );
|
2012-08-07 16:56:51 +02:00
|
|
|
aClassList.push_back( xEle );
|
2000-09-18 15:33:13 +00:00
|
|
|
|
2015-07-03 11:31:14 +02:00
|
|
|
pTok = &rInStm.GetToken();
|
2000-09-18 15:33:13 +00:00
|
|
|
if( pTok->IsString() )
|
|
|
|
{
|
|
|
|
xEle->SetPrefix( pTok->GetString() );
|
|
|
|
rInStm.GetToken_Next();
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-02-13 18:06:10 +01:00
|
|
|
// set error
|
2000-09-18 15:33:13 +00:00
|
|
|
rBase.SetError( "unknown imported interface", rInStm.GetToken() );
|
|
|
|
rBase.WriteError( rInStm );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rInStm.Seek( nTokPos );
|
|
|
|
SvMetaType * pType = rBase.ReadKnownType( rInStm );
|
|
|
|
|
2014-05-08 11:42:16 +02:00
|
|
|
bool bOk = false;
|
2000-09-18 15:33:13 +00:00
|
|
|
SvMetaAttributeRef xAttr;
|
|
|
|
if( !pType || pType->IsItem() )
|
|
|
|
{
|
|
|
|
xAttr = new SvMetaSlot( pType );
|
|
|
|
if( xAttr->ReadSvIdl( rBase, rInStm ) )
|
|
|
|
bOk = xAttr->Test( rBase, rInStm );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
xAttr = new SvMetaAttribute( pType );
|
|
|
|
if( xAttr->ReadSvIdl( rBase, rInStm ) )
|
|
|
|
bOk = xAttr->Test( rBase, rInStm );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( bOk )
|
|
|
|
bOk = TestAttribute( rBase, rInStm, *xAttr );
|
|
|
|
if( bOk )
|
|
|
|
{
|
|
|
|
if( !xAttr->GetSlotId().IsSet() )
|
|
|
|
{
|
2015-08-27 14:42:39 +02:00
|
|
|
SvIdentifier aI;
|
2000-09-18 15:33:13 +00:00
|
|
|
aI.SetValue( rBase.GetUniqueId() );
|
|
|
|
xAttr->SetSlotId( aI );
|
|
|
|
}
|
2012-08-07 16:56:51 +02:00
|
|
|
aAttrList.push_back( xAttr );
|
2000-09-18 15:33:13 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
rInStm.Seek( nTokPos );
|
|
|
|
}
|
|
|
|
|
2014-05-08 11:42:16 +02:00
|
|
|
bool SvMetaClass::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2011-01-13 09:32:03 +01:00
|
|
|
sal_uLong nTokPos = rInStm.Tell();
|
2000-09-18 15:33:13 +00:00
|
|
|
if( SvMetaType::ReadHeaderSvIdl( rBase, rInStm ) && GetType() == TYPE_CLASS )
|
|
|
|
{
|
2014-05-08 11:42:16 +02:00
|
|
|
bool bOk = true;
|
2000-09-18 15:33:13 +00:00
|
|
|
if( rInStm.Read( ':' ) )
|
|
|
|
{
|
|
|
|
aSuperClass = rBase.ReadKnownClass( rInStm );
|
|
|
|
bOk = aSuperClass.Is();
|
|
|
|
if( !bOk )
|
|
|
|
{
|
2011-02-13 18:06:10 +01:00
|
|
|
// set error
|
2015-07-03 11:31:14 +02:00
|
|
|
rBase.SetError( "unknown super class", rInStm.GetToken() );
|
2000-09-18 15:33:13 +00:00
|
|
|
rBase.WriteError( rInStm );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if( bOk )
|
|
|
|
{
|
2013-04-07 12:06:47 +02:00
|
|
|
rBase.Write(OString('.'));
|
2015-08-28 11:53:11 +02:00
|
|
|
bOk = SvMetaObject::ReadSvIdl( rBase, rInStm );
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
if( bOk )
|
|
|
|
return bOk;
|
|
|
|
}
|
|
|
|
rInStm.Seek( nTokPos );
|
2014-05-08 11:42:16 +02:00
|
|
|
return false;
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
|
2014-05-08 11:42:16 +02:00
|
|
|
bool SvMetaClass::TestAttribute( SvIdlDataBase & rBase, SvTokenStream & rInStm,
|
2000-09-18 15:33:13 +00:00
|
|
|
SvMetaAttribute & rAttr ) const
|
|
|
|
{
|
2015-09-30 16:10:07 +02:00
|
|
|
if ( !rAttr.GetRef() && dynamic_cast<const SvMetaSlot *>(&rAttr) != nullptr )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2011-03-01 19:07:44 +01:00
|
|
|
OSL_FAIL( "Neuer Slot : " );
|
2012-01-26 09:46:41 +00:00
|
|
|
OSL_FAIL( rAttr.GetSlotId().getString().getStr() );
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
|
2012-08-07 16:56:51 +02:00
|
|
|
for( sal_uLong n = 0; n < aAttrList.size(); n++ )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2012-08-07 16:56:51 +02:00
|
|
|
SvMetaAttribute * pS = aAttrList[n];
|
2011-12-29 10:37:09 +00:00
|
|
|
if( pS->GetName().getString() == rAttr.GetName().getString() )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2011-02-13 18:06:10 +01:00
|
|
|
// values have to match
|
2000-09-18 15:33:13 +00:00
|
|
|
if( pS->GetSlotId().GetValue() != rAttr.GetSlotId().GetValue() )
|
|
|
|
{
|
2014-05-08 12:14:50 +01:00
|
|
|
OSL_FAIL( "Same Name in MetaClass : " );
|
2012-01-26 09:46:41 +00:00
|
|
|
OSL_FAIL( pS->GetName().getString().getStr() );
|
|
|
|
OSL_FAIL( pS->GetSlotId().getString().getStr() );
|
|
|
|
OSL_FAIL( rAttr.GetSlotId().getString().getStr() );
|
2000-09-18 15:33:13 +00:00
|
|
|
|
2013-11-20 10:05:20 +02:00
|
|
|
OStringBuffer aStr("Attribute's ");
|
2011-12-29 10:37:09 +00:00
|
|
|
aStr.append(pS->GetName().getString());
|
2013-11-20 10:05:20 +02:00
|
|
|
aStr.append(" with different id's");
|
2011-12-13 23:13:22 +00:00
|
|
|
rBase.SetError(aStr.makeStringAndClear(), rInStm.GetToken());
|
2000-09-18 15:33:13 +00:00
|
|
|
rBase.WriteError( rInStm );
|
2014-05-08 11:42:16 +02:00
|
|
|
return false;
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_uInt32 nId1 = pS->GetSlotId().GetValue();
|
|
|
|
sal_uInt32 nId2 = rAttr.GetSlotId().GetValue();
|
2011-02-13 18:06:10 +01:00
|
|
|
if( nId1 == nId2 && nId1 != 0 )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2011-03-01 19:07:44 +01:00
|
|
|
OSL_FAIL( "Gleiche Id in MetaClass : " );
|
2013-08-21 15:07:31 +02:00
|
|
|
OSL_FAIL(OString::number(pS->GetSlotId().GetValue()).getStr());
|
2012-01-26 09:46:41 +00:00
|
|
|
OSL_FAIL( pS->GetSlotId().getString().getStr() );
|
|
|
|
OSL_FAIL( rAttr.GetSlotId().getString().getStr() );
|
2000-09-18 15:33:13 +00:00
|
|
|
|
2013-11-20 10:05:20 +02:00
|
|
|
OStringBuffer aStr("Attribute ");
|
2011-12-29 10:37:09 +00:00
|
|
|
aStr.append(pS->GetName().getString());
|
2013-11-20 10:05:20 +02:00
|
|
|
aStr.append(" and Attribute ");
|
2011-12-29 10:37:09 +00:00
|
|
|
aStr.append(rAttr.GetName().getString());
|
2013-11-20 10:05:20 +02:00
|
|
|
aStr.append(" with equal id's");
|
2011-12-13 23:13:22 +00:00
|
|
|
rBase.SetError(aStr.makeStringAndClear(), rInStm.GetToken());
|
2000-09-18 15:33:13 +00:00
|
|
|
rBase.WriteError( rInStm );
|
2014-05-08 11:42:16 +02:00
|
|
|
return false;
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SvMetaClass * pSC = aSuperClass;
|
|
|
|
if( pSC )
|
|
|
|
return pSC->TestAttribute( rBase, rInStm, rAttr );
|
2014-05-08 11:42:16 +02:00
|
|
|
return true;
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_uInt16 SvMetaClass::WriteSlotParamArray( SvIdlDataBase & rBase,
|
2000-09-18 15:33:13 +00:00
|
|
|
SvSlotElementList & rSlotList,
|
|
|
|
SvStream & rOutStm )
|
|
|
|
{
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_uInt16 nCount = 0;
|
2011-04-20 20:59:37 -07:00
|
|
|
for ( size_t i = 0, n = rSlotList.size(); i < n; ++i )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2011-04-20 20:59:37 -07:00
|
|
|
SvSlotElement *pEle = rSlotList[ i ];
|
2011-03-29 18:12:25 +02:00
|
|
|
SvMetaSlot *pAttr = pEle->xSlot;
|
2006-06-19 09:42:24 +00:00
|
|
|
nCount = nCount + pAttr->WriteSlotParamArray( rBase, rOutStm );
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return nCount;
|
|
|
|
}
|
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
sal_uInt16 SvMetaClass::WriteSlots( const OString& rShellName,
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_uInt16 nCount, SvSlotElementList & rSlotList,
|
2000-09-18 15:33:13 +00:00
|
|
|
SvIdlDataBase & rBase,
|
|
|
|
SvStream & rOutStm )
|
|
|
|
{
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_uInt16 nSCount = 0;
|
2011-04-20 20:59:37 -07:00
|
|
|
for ( size_t i = 0, n = rSlotList.size(); i < n; ++i )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2011-04-20 20:59:37 -07:00
|
|
|
SvSlotElement * pEle = rSlotList[ i ];
|
2011-03-29 18:12:25 +02:00
|
|
|
SvMetaSlot * pAttr = pEle->xSlot;
|
2006-06-19 09:42:24 +00:00
|
|
|
nSCount = nSCount + pAttr->WriteSlotMap( rShellName, nCount + nSCount,
|
2014-09-21 15:46:10 +02:00
|
|
|
rSlotList, i, rBase,
|
2000-09-18 15:33:13 +00:00
|
|
|
rOutStm );
|
|
|
|
}
|
|
|
|
|
|
|
|
return nSCount;
|
|
|
|
}
|
|
|
|
|
2011-03-12 02:42:58 +01:00
|
|
|
void SvMetaClass::InsertSlots( SvSlotElementList& rList, std::vector<sal_uLong>& rSuperList,
|
2000-09-18 15:33:13 +00:00
|
|
|
SvMetaClassList &rClassList,
|
2013-04-07 12:06:47 +02:00
|
|
|
const OString& rPrefix, SvIdlDataBase& rBase)
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2011-02-13 18:06:10 +01:00
|
|
|
// was this class already written?
|
2010-12-30 07:02:52 -08:00
|
|
|
for ( size_t i = 0, n = rClassList.size(); i < n ; ++i )
|
|
|
|
if ( rClassList[ i ] == this )
|
|
|
|
return;
|
2000-09-18 15:33:13 +00:00
|
|
|
|
2010-12-30 07:02:52 -08:00
|
|
|
rClassList.push_back( this );
|
2000-09-18 15:33:13 +00:00
|
|
|
|
2011-02-13 18:06:10 +01:00
|
|
|
// write all direct attributes
|
2011-01-13 09:32:03 +01:00
|
|
|
sal_uLong n;
|
2012-08-07 16:56:51 +02:00
|
|
|
for( n = 0; n < aAttrList.size(); n++ )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2012-08-07 16:56:51 +02:00
|
|
|
SvMetaAttribute * pAttr = aAttrList[n];
|
2000-09-18 15:33:13 +00:00
|
|
|
|
2011-01-13 09:32:03 +01:00
|
|
|
sal_uLong nId = pAttr->GetSlotId().GetValue();
|
2000-09-18 15:33:13 +00:00
|
|
|
|
2011-03-12 02:42:58 +01:00
|
|
|
std::vector<sal_uLong>::iterator iter = std::find(rSuperList.begin(),
|
2011-02-27 21:35:16 -08:00
|
|
|
rSuperList.end(),nId);
|
|
|
|
|
|
|
|
if( iter == rSuperList.end() )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2011-02-13 18:06:10 +01:00
|
|
|
// Write only if not already written by subclass or
|
|
|
|
// imported interface.
|
2011-02-27 21:35:16 -08:00
|
|
|
rSuperList.push_back(nId);
|
2000-09-18 15:33:13 +00:00
|
|
|
pAttr->Insert(rList, rPrefix, rBase);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-13 18:06:10 +01:00
|
|
|
// All Interfaces already imported by SuperShells should not be
|
|
|
|
// written any more.
|
|
|
|
// It is prohibited that Shell and SuperShell directly import the same
|
|
|
|
//class.
|
2000-09-18 15:33:13 +00:00
|
|
|
if( IsShell() && aSuperClass.Is() )
|
|
|
|
aSuperClass->FillClasses( rClassList );
|
|
|
|
|
2011-02-13 18:06:10 +01:00
|
|
|
// Write all attributes of the imported classes, as long as they have
|
|
|
|
// not already been imported by the superclass.
|
2012-08-07 16:56:51 +02:00
|
|
|
for( n = 0; n < aClassList.size(); n++ )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2012-08-07 16:56:51 +02:00
|
|
|
SvClassElement * pEle = aClassList[n];
|
2000-09-18 15:33:13 +00:00
|
|
|
SvMetaClass * pCl = pEle->GetClass();
|
2013-04-07 12:06:47 +02:00
|
|
|
OStringBuffer rPre(rPrefix);
|
2013-06-17 20:32:03 +02:00
|
|
|
if( !rPre.isEmpty() && !pEle->GetPrefix().isEmpty() )
|
2011-09-20 23:30:51 +01:00
|
|
|
rPre.append('.');
|
|
|
|
rPre.append(pEle->GetPrefix());
|
2000-09-18 15:33:13 +00:00
|
|
|
|
2011-02-13 18:06:10 +01:00
|
|
|
// first of all write direct imported interfaces
|
2011-09-20 23:30:51 +01:00
|
|
|
pCl->InsertSlots( rList, rSuperList, rClassList,
|
|
|
|
rPre.makeStringAndClear(), rBase );
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
|
2011-02-13 18:06:10 +01:00
|
|
|
// only write superclass if no shell and not in the list
|
2000-09-18 15:33:13 +00:00
|
|
|
if( !IsShell() && aSuperClass.Is() )
|
|
|
|
{
|
|
|
|
aSuperClass->InsertSlots( rList, rSuperList, rClassList, rPrefix, rBase );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SvMetaClass::FillClasses( SvMetaClassList & rList )
|
|
|
|
{
|
2011-02-13 18:06:10 +01:00
|
|
|
// Am I not yet in?
|
2010-12-30 07:02:52 -08:00
|
|
|
for ( size_t i = 0, n = rList.size(); i < n; ++i )
|
|
|
|
if ( rList[ i ] == this )
|
|
|
|
return;
|
2000-09-18 15:33:13 +00:00
|
|
|
|
2010-12-30 07:02:52 -08:00
|
|
|
rList.push_back( this );
|
2000-09-18 15:33:13 +00:00
|
|
|
|
2011-02-13 18:06:10 +01:00
|
|
|
// my imports
|
2015-05-28 14:29:05 +02:00
|
|
|
for( size_t n = 0; n < aClassList.size(); n++ )
|
2010-12-30 07:02:52 -08:00
|
|
|
{
|
2012-08-07 16:56:51 +02:00
|
|
|
SvClassElement * pEle = aClassList[n];
|
2010-12-30 07:02:52 -08:00
|
|
|
SvMetaClass * pCl = pEle->GetClass();
|
|
|
|
pCl->FillClasses( rList );
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
2010-12-30 07:02:52 -08:00
|
|
|
|
2011-02-13 18:06:10 +01:00
|
|
|
// my superclass
|
2010-12-30 07:02:52 -08:00
|
|
|
if( aSuperClass.Is() )
|
|
|
|
aSuperClass->FillClasses( rList );
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
void SvMetaClass::WriteSlotStubs( const OString& rShellName,
|
2000-09-18 15:33:13 +00:00
|
|
|
SvSlotElementList & rSlotList,
|
|
|
|
ByteStringList & rList,
|
|
|
|
SvStream & rOutStm )
|
|
|
|
{
|
2011-03-29 18:12:25 +02:00
|
|
|
// write all attributes
|
2011-04-20 20:59:37 -07:00
|
|
|
for ( size_t i = 0, n = rSlotList.size(); i < n; ++i )
|
2011-03-29 18:12:25 +02:00
|
|
|
{
|
2011-04-20 20:59:37 -07:00
|
|
|
SvSlotElement *pEle = rSlotList[ i ];
|
2011-03-29 18:12:25 +02:00
|
|
|
SvMetaSlot *pAttr = pEle->xSlot;
|
|
|
|
pAttr->WriteSlotStubs( rShellName, rList, rOutStm );
|
|
|
|
}
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SvMetaClass::WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm )
|
|
|
|
{
|
|
|
|
WriteStars( rOutStm );
|
2011-02-13 18:06:10 +01:00
|
|
|
// define class
|
2014-01-16 12:40:11 +02:00
|
|
|
rOutStm.WriteCharPtr( "#ifdef " ).WriteCharPtr( GetName().getString().getStr() ) << endl;
|
|
|
|
rOutStm.WriteCharPtr( "#undef ShellClass" ) << endl;
|
|
|
|
rOutStm.WriteCharPtr( "#undef " ).WriteCharPtr( GetName().getString().getStr() ) << endl;
|
|
|
|
rOutStm.WriteCharPtr( "#define ShellClass " ).WriteCharPtr( GetName().getString().getStr() ) << endl;
|
2000-09-18 15:33:13 +00:00
|
|
|
|
2011-02-13 18:06:10 +01:00
|
|
|
// no slotmaps get written for interfaces
|
2000-09-18 15:33:13 +00:00
|
|
|
if( !IsShell() )
|
|
|
|
{
|
2014-01-16 12:40:11 +02:00
|
|
|
rOutStm.WriteCharPtr( "#endif" ) << endl << endl;
|
2000-09-18 15:33:13 +00:00
|
|
|
return;
|
|
|
|
}
|
2011-02-13 18:06:10 +01:00
|
|
|
// write parameter array
|
2014-04-18 07:57:15 +02:00
|
|
|
rOutStm.WriteCharPtr("static SfxFormalArgument a").WriteCharPtr(GetName().getString().getStr()).WriteCharPtr("Args_Impl[] =") << endl;
|
|
|
|
rOutStm.WriteChar('{') << endl;
|
2000-09-18 15:33:13 +00:00
|
|
|
|
2011-03-12 02:42:58 +01:00
|
|
|
std::vector<sal_uLong> aSuperList;
|
2006-06-19 09:42:24 +00:00
|
|
|
SvMetaClassList classList;
|
2000-09-18 15:33:13 +00:00
|
|
|
SvSlotElementList aSlotList;
|
2013-04-07 12:06:47 +02:00
|
|
|
InsertSlots(aSlotList, aSuperList, classList, OString(), rBase);
|
2011-04-20 20:59:37 -07:00
|
|
|
for ( size_t i = 0, n = aSlotList.size(); i < n; ++i )
|
2011-03-29 18:12:25 +02:00
|
|
|
{
|
2011-04-20 20:59:37 -07:00
|
|
|
SvSlotElement *pEle = aSlotList[ i ];
|
2011-03-29 18:12:25 +02:00
|
|
|
SvMetaSlot *pSlot = pEle->xSlot;
|
2011-04-20 20:59:37 -07:00
|
|
|
pSlot->SetListPos( i );
|
2011-03-29 18:12:25 +02:00
|
|
|
}
|
2000-09-18 15:33:13 +00:00
|
|
|
|
2011-04-20 20:59:37 -07:00
|
|
|
size_t nSlotCount = aSlotList.size();
|
2000-09-18 15:33:13 +00:00
|
|
|
|
2011-02-13 18:06:10 +01:00
|
|
|
// write all attributes
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_uInt16 nArgCount = WriteSlotParamArray( rBase, aSlotList, rOutStm );
|
2000-09-18 15:33:13 +00:00
|
|
|
if( nArgCount )
|
|
|
|
Back2Delemitter( rOutStm );
|
|
|
|
else
|
|
|
|
{
|
2015-07-02 18:23:08 +02:00
|
|
|
// at least one dummy
|
2000-09-18 15:33:13 +00:00
|
|
|
WriteTab( rOutStm, 1 );
|
2014-04-18 11:00:19 +02:00
|
|
|
rOutStm.WriteCharPtr("{ (const SfxType*) &aSfxVoidItem_Impl, 0, 0 }" ) << endl;
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
2014-01-16 12:40:11 +02:00
|
|
|
rOutStm << endl;
|
|
|
|
rOutStm.WriteCharPtr( "};" ) << endl << endl;
|
2000-09-18 15:33:13 +00:00
|
|
|
|
|
|
|
ByteStringList aStringList;
|
2011-12-29 10:37:09 +00:00
|
|
|
WriteSlotStubs( GetName().getString(), aSlotList, aStringList, rOutStm );
|
2010-12-28 18:25:01 -08:00
|
|
|
for ( size_t i = 0, n = aStringList.size(); i < n; ++i )
|
|
|
|
delete aStringList[ i ];
|
|
|
|
aStringList.clear();
|
2000-09-18 15:33:13 +00:00
|
|
|
|
|
|
|
rOutStm << endl;
|
|
|
|
|
2011-02-13 18:06:10 +01:00
|
|
|
// write slotmap
|
2014-04-18 11:38:19 +02:00
|
|
|
rOutStm.WriteCharPtr("static SfxSlot a").WriteCharPtr(GetName().getString().getStr()).WriteCharPtr("Slots_Impl[] =") << endl;
|
2014-01-16 12:40:11 +02:00
|
|
|
rOutStm.WriteChar( '{' ) << endl;
|
2000-09-18 15:33:13 +00:00
|
|
|
|
2011-02-13 18:06:10 +01:00
|
|
|
// write all attributes
|
2011-12-29 10:37:09 +00:00
|
|
|
WriteSlots( GetName().getString(), 0, aSlotList, rBase, rOutStm );
|
2000-09-18 15:33:13 +00:00
|
|
|
if( nSlotCount )
|
|
|
|
Back2Delemitter( rOutStm );
|
|
|
|
else
|
|
|
|
{
|
2011-02-13 18:06:10 +01:00
|
|
|
// at least one dummy
|
2000-09-18 15:33:13 +00:00
|
|
|
WriteTab( rOutStm, 1 );
|
2014-01-16 12:40:11 +02:00
|
|
|
rOutStm.WriteCharPtr( "SFX_SLOT_ARG(" ).WriteCharPtr( GetName().getString().getStr() )
|
|
|
|
.WriteCharPtr( ", 0, 0, " )
|
|
|
|
.WriteCharPtr( "SFX_STUB_PTR_EXEC_NONE," )
|
|
|
|
.WriteCharPtr( "SFX_STUB_PTR_STATE_NONE," )
|
2015-02-24 13:21:11 +02:00
|
|
|
.WriteCharPtr( "SfxSlotMode::NONE, SfxVoidItem, 0, 0, \"\", SfxSlotMode::NONE )" ) << endl;
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
2014-01-16 12:40:11 +02:00
|
|
|
rOutStm << endl;
|
|
|
|
rOutStm.WriteCharPtr( "};" ) << endl;
|
|
|
|
rOutStm.WriteCharPtr( "#endif" ) << endl << endl;
|
2000-09-18 15:33:13 +00:00
|
|
|
|
2011-04-20 20:59:37 -07:00
|
|
|
for( size_t i = 0, n = aSlotList.size(); i < n; ++i )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2011-04-20 20:59:37 -07:00
|
|
|
SvSlotElement* pEle = aSlotList[ i ];
|
2011-03-29 18:12:25 +02:00
|
|
|
SvMetaSlot* pAttr = pEle->xSlot;
|
|
|
|
pAttr->ResetSlotPointer();
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
2011-03-29 18:12:25 +02:00
|
|
|
|
2011-04-20 20:59:37 -07:00
|
|
|
for( size_t i = 0, n = aSlotList.size(); i < n; ++i )
|
|
|
|
delete aSlotList[ i ];
|
|
|
|
aSlotList.clear();
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
|
2010-10-12 15:53:47 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|