2010-10-12 15:53:47 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2000-09-18 15:33:13 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 08:39:44 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 15:33:13 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-09-18 15:33:13 +00:00
|
|
|
*
|
2008-04-11 08:39:44 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 15:33:13 +00:00
|
|
|
*
|
2008-04-11 08:39:44 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 15:33:13 +00:00
|
|
|
*
|
2008-04-11 08:39:44 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-09-18 15:33:13 +00:00
|
|
|
*
|
2008-04-11 08:39:44 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-09-18 15:33:13 +00:00
|
|
|
*
|
2008-04-11 08:39:44 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-09-18 15:33:13 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-16 11:47:56 +00:00
|
|
|
|
2000-09-18 15:33:13 +00:00
|
|
|
#include <ctype.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include <module.hxx>
|
|
|
|
#include <globals.hxx>
|
|
|
|
#include <database.hxx>
|
|
|
|
#include <tools/fsys.hxx>
|
|
|
|
#include <tools/debug.hxx>
|
|
|
|
|
|
|
|
SV_IMPL_META_FACTORY1( SvMetaModule, SvMetaExtern );
|
|
|
|
|
|
|
|
SvMetaModule::SvMetaModule()
|
2010-11-03 15:49:08 +01:00
|
|
|
: bImported( sal_False )
|
|
|
|
, bIsModified( sal_False )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-11-03 15:49:08 +01:00
|
|
|
SvMetaModule::SvMetaModule( const String & rIdlFileName, sal_Bool bImp )
|
2000-09-18 15:33:13 +00:00
|
|
|
: aIdlFileName( rIdlFileName )
|
2010-11-03 15:49:08 +01:00
|
|
|
, bImported( bImp ), bIsModified( sal_False )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
#define MODULE_VER 0x0001
|
|
|
|
void SvMetaModule::Load( SvPersistStream & rStm )
|
|
|
|
{
|
2011-03-12 02:42:58 +01:00
|
|
|
bImported = sal_True; // import always
|
2000-09-18 15:33:13 +00:00
|
|
|
SvMetaExtern::Load( rStm );
|
|
|
|
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_uInt16 nVer;
|
2000-09-18 15:33:13 +00:00
|
|
|
|
2011-02-13 18:06:10 +01:00
|
|
|
rStm >> nVer; // version
|
2008-11-10 15:06:12 +00:00
|
|
|
DBG_ASSERT( (nVer & ~IDL_WRITE_MASK) == MODULE_VER, "false version" );
|
2000-09-18 15:33:13 +00:00
|
|
|
|
|
|
|
rStm >> aClassList;
|
|
|
|
rStm >> aTypeList;
|
|
|
|
rStm >> aAttrList;
|
2011-02-13 18:06:10 +01:00
|
|
|
// browser
|
2012-01-06 08:50:03 +00:00
|
|
|
aIdlFileName = rStm.ReadUniOrByteString( rStm.GetStreamCharSet() );
|
2011-12-29 10:37:09 +00:00
|
|
|
aHelpFileName.setString(read_lenPrefixed_uInt8s_ToOString<sal_uInt16>(rStm));
|
|
|
|
aSlotIdFile.setString(read_lenPrefixed_uInt8s_ToOString<sal_uInt16>(rStm));
|
|
|
|
aModulePrefix.setString(read_lenPrefixed_uInt8s_ToOString<sal_uInt16>(rStm));
|
2000-09-18 15:33:13 +00:00
|
|
|
|
2011-02-13 18:06:10 +01:00
|
|
|
// read compiler data
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_uInt16 nCmpLen;
|
2000-09-18 15:33:13 +00:00
|
|
|
rStm >> nCmpLen;
|
|
|
|
DBG_ASSERT( (nVer & IDL_WRITE_MASK) == IDL_WRITE_COMPILER,
|
2008-11-10 15:06:12 +00:00
|
|
|
"no idl compiler format" );
|
2000-09-18 15:33:13 +00:00
|
|
|
rStm >> aBeginName;
|
|
|
|
rStm >> aEndName;
|
|
|
|
rStm >> aNextName;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SvMetaModule::Save( SvPersistStream & rStm )
|
|
|
|
{
|
|
|
|
SvMetaExtern::Save( rStm );
|
|
|
|
|
2010-11-03 15:49:08 +01:00
|
|
|
rStm << (sal_uInt16)(MODULE_VER | IDL_WRITE_COMPILER); // Version
|
2000-09-18 15:33:13 +00:00
|
|
|
|
|
|
|
rStm << aClassList;
|
|
|
|
rStm << aTypeList;
|
|
|
|
rStm << aAttrList;
|
2011-02-13 18:06:10 +01:00
|
|
|
// browser
|
2011-12-21 10:45:54 +00:00
|
|
|
rStm.WriteUniOrByteString( aIdlFileName, rStm.GetStreamCharSet() );
|
2011-12-29 10:37:09 +00:00
|
|
|
write_lenPrefixed_uInt8s_FromOString<sal_uInt16>(rStm, aHelpFileName.getString());
|
|
|
|
write_lenPrefixed_uInt8s_FromOString<sal_uInt16>(rStm, aSlotIdFile.getString());
|
|
|
|
write_lenPrefixed_uInt8s_FromOString<sal_uInt16>(rStm, aModulePrefix.getString());
|
2000-09-18 15:33:13 +00:00
|
|
|
|
2011-02-13 18:06:10 +01:00
|
|
|
// write compiler data
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_uInt16 nCmpLen = 0;
|
2011-01-13 09:32:03 +01:00
|
|
|
sal_uLong nLenPos = rStm.Tell();
|
2000-09-18 15:33:13 +00:00
|
|
|
rStm << nCmpLen;
|
|
|
|
rStm << aBeginName;
|
|
|
|
rStm << aEndName;
|
|
|
|
rStm << aNextName;
|
2011-02-13 18:06:10 +01:00
|
|
|
// write length of compiler data
|
2011-01-13 09:32:03 +01:00
|
|
|
sal_uLong nPos = rStm.Tell();
|
2000-09-18 15:33:13 +00:00
|
|
|
rStm.Seek( nLenPos );
|
2010-11-03 15:49:08 +01:00
|
|
|
rStm << (sal_uInt16)( nPos - nLenPos - sizeof( sal_uInt16 ) );
|
2000-09-18 15:33:13 +00:00
|
|
|
rStm.Seek( nPos );
|
|
|
|
}
|
|
|
|
|
2012-01-27 07:52:36 +00:00
|
|
|
sal_Bool SvMetaModule::SetName( const rtl::OString& rName, SvIdlDataBase * pBase )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
if( pBase )
|
|
|
|
{
|
|
|
|
if( pBase->GetModule( rName ) )
|
2010-11-03 15:49:08 +01:00
|
|
|
return sal_False;
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
return SvMetaExtern::SetName( rName );
|
|
|
|
}
|
|
|
|
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_Bool SvMetaModule::FillNextName( SvGlobalName * pName )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
*pName = aNextName;
|
|
|
|
|
|
|
|
if( aNextName < aEndName )
|
|
|
|
{
|
|
|
|
++aNextName;
|
2010-11-03 15:49:08 +01:00
|
|
|
bIsModified = sal_True;
|
|
|
|
return sal_True;
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
2010-11-03 15:49:08 +01:00
|
|
|
return sal_False;
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SvMetaModule::ReadAttributesSvIdl( SvIdlDataBase & rBase,
|
|
|
|
SvTokenStream & rInStm )
|
|
|
|
{
|
|
|
|
SvMetaExtern::ReadAttributesSvIdl( rBase, rInStm );
|
|
|
|
|
|
|
|
aHelpFileName.ReadSvIdl( SvHash_HelpFile(), rInStm );
|
|
|
|
if( aSlotIdFile.ReadSvIdl( SvHash_SlotIdFile(), rInStm ) )
|
|
|
|
{
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_uInt32 nTokPos = rInStm.Tell();
|
2012-07-02 16:02:38 +01:00
|
|
|
if( !rBase.ReadIdFile( rtl::OStringToOUString(aSlotIdFile.getString(), RTL_TEXTENCODING_ASCII_US)) )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2011-12-13 23:13:22 +00:00
|
|
|
rtl::OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM("cannot read file: "));
|
2011-12-29 10:37:09 +00:00
|
|
|
aStr.append(aSlotIdFile.getString());
|
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 );
|
|
|
|
|
|
|
|
rInStm.Seek( nTokPos );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
aTypeLibFile.ReadSvIdl( SvHash_TypeLibFile(), rInStm );
|
|
|
|
aModulePrefix.ReadSvIdl( SvHash_ModulePrefix(), rInStm );
|
|
|
|
}
|
|
|
|
|
|
|
|
void SvMetaModule::WriteAttributesSvIdl( SvIdlDataBase & rBase,
|
|
|
|
SvStream & rOutStm,
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_uInt16 nTab )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
SvMetaExtern::WriteAttributesSvIdl( rBase, rOutStm, nTab );
|
2012-01-26 09:46:41 +00:00
|
|
|
if( !aTypeLibFile.getString().isEmpty() || !aSlotIdFile.getString().isEmpty() || !aTypeLibFile.getString().isEmpty() )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2012-01-26 09:46:41 +00:00
|
|
|
if( !aHelpFileName.getString().isEmpty() )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
WriteTab( rOutStm, nTab );
|
|
|
|
aHelpFileName.WriteSvIdl( SvHash_HelpFile(), rOutStm, nTab +1 );
|
|
|
|
rOutStm << ';' << endl;
|
|
|
|
}
|
2012-01-26 09:46:41 +00:00
|
|
|
if( !aSlotIdFile.getString().isEmpty() )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
WriteTab( rOutStm, nTab );
|
|
|
|
aSlotIdFile.WriteSvIdl( SvHash_SlotIdFile(), rOutStm, nTab +1 );
|
|
|
|
rOutStm << ';' << endl;
|
|
|
|
}
|
2012-01-26 09:46:41 +00:00
|
|
|
if( !aTypeLibFile.getString().isEmpty() )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
WriteTab( rOutStm, nTab );
|
|
|
|
aTypeLibFile.WriteSvIdl( SvHash_TypeLibFile(), rOutStm, nTab +1 );
|
|
|
|
rOutStm << ';' << endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SvMetaModule::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
|
|
|
if( rInStm.GetToken()->Is( SvHash_interface() )
|
|
|
|
|| rInStm.GetToken()->Is( SvHash_shell() ) )
|
|
|
|
{
|
|
|
|
SvMetaClassRef aClass = new SvMetaClass();
|
|
|
|
if( aClass->ReadSvIdl( rBase, rInStm ) )
|
|
|
|
{
|
|
|
|
aClassList.Append( aClass );
|
2011-02-13 18:06:10 +01:00
|
|
|
// announce globally
|
2000-09-18 15:33:13 +00:00
|
|
|
rBase.GetClassList().Append( aClass );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if( rInStm.GetToken()->Is( SvHash_enum() ) )
|
|
|
|
{
|
|
|
|
SvMetaTypeEnumRef aEnum = new SvMetaTypeEnum();
|
|
|
|
|
|
|
|
if( aEnum->ReadSvIdl( rBase, rInStm ) )
|
|
|
|
{
|
2011-02-13 18:06:10 +01:00
|
|
|
// declared in module
|
2000-09-18 15:33:13 +00:00
|
|
|
aTypeList.Append( aEnum );
|
2011-02-13 18:06:10 +01:00
|
|
|
// announce globally
|
2000-09-18 15:33:13 +00:00
|
|
|
rBase.GetTypeList().Append( aEnum );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if( rInStm.GetToken()->Is( SvHash_item() )
|
|
|
|
|| rInStm.GetToken()->Is( SvHash_struct() )
|
|
|
|
|| rInStm.GetToken()->Is( SvHash_typedef() ) )
|
|
|
|
{
|
|
|
|
SvMetaTypeRef xItem = new SvMetaType();
|
|
|
|
|
|
|
|
if( xItem->ReadSvIdl( rBase, rInStm ) )
|
|
|
|
{
|
2011-02-13 18:06:10 +01:00
|
|
|
// declared in module
|
2000-09-18 15:33:13 +00:00
|
|
|
aTypeList.Append( xItem );
|
2011-02-13 18:06:10 +01:00
|
|
|
// announce globally
|
2000-09-18 15:33:13 +00:00
|
|
|
rBase.GetTypeList().Append( xItem );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if( rInStm.GetToken()->Is( SvHash_include() ) )
|
|
|
|
{
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_Bool bOk = sal_False;
|
2000-09-18 15:33:13 +00:00
|
|
|
rInStm.GetToken_Next();
|
|
|
|
SvToken * pTok = rInStm.GetToken_Next();
|
|
|
|
if( pTok->IsString() )
|
|
|
|
{
|
2012-07-02 16:02:38 +01:00
|
|
|
DirEntry aFullName( rtl::OStringToOUString(pTok->GetString(), RTL_TEXTENCODING_ASCII_US) );
|
2000-09-18 15:33:13 +00:00
|
|
|
rBase.StartNewFile( aFullName.GetFull() );
|
|
|
|
if( aFullName.Find( rBase.GetPath() ) )
|
|
|
|
{
|
2011-11-08 18:51:13 +01:00
|
|
|
rBase.AddDepFile(aFullName.GetFull());
|
2000-09-18 15:33:13 +00:00
|
|
|
SvTokenStream aTokStm( aFullName.GetFull() );
|
|
|
|
if( SVSTREAM_OK == aTokStm.GetStream().GetError() )
|
|
|
|
{
|
2011-02-13 18:06:10 +01:00
|
|
|
// rescue error from old file
|
2000-09-18 15:33:13 +00:00
|
|
|
SvIdlError aOldErr = rBase.GetError();
|
2011-02-13 18:06:10 +01:00
|
|
|
// reset error
|
2000-09-18 15:33:13 +00:00
|
|
|
rBase.SetError( SvIdlError() );
|
|
|
|
|
2011-03-12 02:42:58 +01:00
|
|
|
sal_uInt32 nBeginPos = 0xFFFFFFFF; // can not happen with Tell
|
2000-09-18 15:33:13 +00:00
|
|
|
while( nBeginPos != aTokStm.Tell() )
|
|
|
|
{
|
|
|
|
nBeginPos = aTokStm.Tell();
|
|
|
|
ReadContextSvIdl( rBase, aTokStm );
|
|
|
|
aTokStm.ReadDelemiter();
|
|
|
|
}
|
|
|
|
bOk = aTokStm.GetToken()->IsEof();
|
|
|
|
if( !bOk )
|
|
|
|
{
|
|
|
|
rBase.WriteError( aTokStm );
|
|
|
|
}
|
2011-02-13 18:06:10 +01:00
|
|
|
// recover error from old file
|
2000-09-18 15:33:13 +00:00
|
|
|
rBase.SetError( aOldErr );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-11-27 08:21:00 +00:00
|
|
|
rtl::OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM(
|
|
|
|
"cannot open file: "));
|
|
|
|
aStr.append(rtl::OUStringToOString(aFullName.GetFull(),
|
|
|
|
RTL_TEXTENCODING_UTF8));
|
|
|
|
rBase.SetError(aStr.makeStringAndClear(), pTok);
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-11-27 08:21:00 +00:00
|
|
|
rtl::OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM(
|
|
|
|
"cannot find file:"));
|
|
|
|
aStr.append(rtl::OUStringToOString(aFullName.GetFull(),
|
|
|
|
RTL_TEXTENCODING_UTF8));
|
|
|
|
rBase.SetError(aStr.makeStringAndClear(), pTok);
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if( !bOk )
|
|
|
|
rInStm.Seek( nTokPos );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SvMetaSlotRef xSlot = new SvMetaSlot();
|
|
|
|
|
|
|
|
if( xSlot->ReadSvIdl( rBase, rInStm ) )
|
|
|
|
{
|
|
|
|
if( xSlot->Test( rBase, rInStm ) )
|
|
|
|
{
|
2011-02-13 18:06:10 +01:00
|
|
|
// declared in module
|
2000-09-18 15:33:13 +00:00
|
|
|
aAttrList.Append( xSlot );
|
2011-02-13 18:06:10 +01:00
|
|
|
// announce globally
|
2000-09-18 15:33:13 +00:00
|
|
|
rBase.AppendAttr( xSlot );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SvMetaModule::WriteContextSvIdl( SvIdlDataBase & rBase,
|
|
|
|
SvStream & rOutStm,
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_uInt16 nTab )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
SvMetaExtern::WriteContextSvIdl( rBase, rOutStm, nTab );
|
2011-01-13 09:32:03 +01:00
|
|
|
sal_uLong n;
|
2000-09-18 15:33:13 +00:00
|
|
|
for( n = 0; n < aTypeList.Count(); n++ )
|
|
|
|
{
|
|
|
|
WriteTab( rOutStm, nTab );
|
|
|
|
aTypeList.GetObject( n )->WriteSvIdl( rBase, rOutStm, nTab );
|
|
|
|
}
|
|
|
|
rOutStm << endl;
|
|
|
|
for( n = 0; n < aAttrList.Count(); n++ )
|
|
|
|
{
|
|
|
|
WriteTab( rOutStm, nTab );
|
|
|
|
aAttrList.GetObject( n )->WriteSvIdl( rBase, rOutStm, nTab );
|
|
|
|
}
|
|
|
|
rOutStm << endl;
|
|
|
|
for( n = 0; n < aClassList.Count(); n++ )
|
|
|
|
{
|
|
|
|
WriteTab( rOutStm, nTab );
|
|
|
|
aClassList.GetObject( n )->WriteSvIdl( rBase, rOutStm, nTab );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_Bool SvMetaModule::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2011-03-12 02:42:58 +01:00
|
|
|
bIsModified = sal_True; // up to now always when compiler running
|
2000-09-18 15:33:13 +00:00
|
|
|
|
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();
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_Bool bOk = sal_False;
|
2000-09-18 15:33:13 +00:00
|
|
|
bOk = pTok->Is( SvHash_module() );
|
|
|
|
if( bOk )
|
|
|
|
{
|
|
|
|
pTok = rInStm.GetToken_Next();
|
|
|
|
if( pTok->IsString() )
|
2012-07-02 16:02:38 +01:00
|
|
|
bOk = aBeginName.MakeId(rtl::OStringToOUString(pTok->GetString(), RTL_TEXTENCODING_ASCII_US));
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
rInStm.ReadDelemiter();
|
|
|
|
if( bOk )
|
|
|
|
{
|
|
|
|
pTok = rInStm.GetToken_Next();
|
|
|
|
if( pTok->IsString() )
|
2012-07-02 16:02:38 +01:00
|
|
|
bOk = aEndName.MakeId(rtl::OStringToOUString(pTok->GetString(), RTL_TEXTENCODING_ASCII_US));
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
rInStm.ReadDelemiter();
|
|
|
|
if( bOk )
|
|
|
|
{
|
|
|
|
aNextName = aBeginName;
|
|
|
|
|
2011-02-13 18:06:10 +01:00
|
|
|
rBase.Push( this ); // onto the context stack
|
2000-09-18 15:33:13 +00:00
|
|
|
|
|
|
|
if( ReadNameSvIdl( rBase, rInStm ) )
|
|
|
|
{
|
2011-02-13 18:06:10 +01:00
|
|
|
// set pointer to itself
|
2000-09-18 15:33:13 +00:00
|
|
|
SetModule( rBase );
|
|
|
|
bOk = SvMetaName::ReadSvIdl( rBase, rInStm );
|
|
|
|
}
|
2011-02-13 18:06:10 +01:00
|
|
|
rBase.GetStack().Pop(); // remove from stack
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
if( !bOk )
|
|
|
|
rInStm.Seek( nTokPos );
|
|
|
|
return bOk;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SvMetaModule::WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm,
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_uInt16 nTab )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2012-01-27 07:52:36 +00:00
|
|
|
rOutStm << SvHash_module()->GetName().getStr() << endl
|
2000-09-18 15:33:13 +00:00
|
|
|
<< '\"';
|
2011-12-21 10:45:54 +00:00
|
|
|
rOutStm.WriteUniOrByteString( aBeginName.GetHexName(), rOutStm.GetStreamCharSet() );
|
2000-09-18 15:33:13 +00:00
|
|
|
rOutStm << '\"' << endl << '\"';
|
2011-12-21 10:45:54 +00:00
|
|
|
rOutStm.WriteUniOrByteString( aEndName.GetHexName(), rOutStm.GetStreamCharSet() );
|
2000-09-18 15:33:13 +00:00
|
|
|
rOutStm << '\"' << endl;
|
|
|
|
SvMetaExtern::WriteSvIdl( rBase, rOutStm, nTab );
|
|
|
|
}
|
|
|
|
|
|
|
|
void SvMetaModule::WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm )
|
|
|
|
{
|
2011-01-13 09:32:03 +01:00
|
|
|
for( sal_uLong n = 0; n < aClassList.Count(); n++ )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
SvMetaClass * pClass = aClassList.GetObject( n );
|
|
|
|
pClass->WriteSfx( rBase, rOutStm );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SvMetaModule::WriteHelpIds( SvIdlDataBase & rBase, SvStream & rOutStm,
|
2012-03-11 12:03:11 +02:00
|
|
|
HelpIdTable& rTable )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2011-01-13 09:32:03 +01:00
|
|
|
for( sal_uLong n = 0; n < aClassList.Count(); n++ )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
SvMetaClass * pClass = aClassList.GetObject( n );
|
2012-03-11 12:03:11 +02:00
|
|
|
pClass->WriteHelpIds( rBase, rOutStm, rTable );
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SvMetaModule::WriteAttributes( SvIdlDataBase & rBase,
|
|
|
|
SvStream & rOutStm,
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_uInt16 nTab,
|
2000-09-18 15:33:13 +00:00
|
|
|
WriteType nT, WriteAttribute nA )
|
|
|
|
{
|
|
|
|
SvMetaExtern::WriteAttributes( rBase, rOutStm, nTab, nT, nA );
|
2012-01-26 09:46:41 +00:00
|
|
|
if( !aHelpFileName.getString().isEmpty() )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
WriteTab( rOutStm, nTab );
|
|
|
|
rOutStm << "// class SvMetaModule" << endl;
|
|
|
|
WriteTab( rOutStm, nTab );
|
2012-01-26 09:46:41 +00:00
|
|
|
rOutStm << "helpfile(\"" << aHelpFileName.getString().getStr() << "\");" << endl;
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SvMetaModule::Write( SvIdlDataBase & rBase, SvStream & rOutStm,
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_uInt16 nTab,
|
2000-09-18 15:33:13 +00:00
|
|
|
WriteType nT, WriteAttribute nA )
|
|
|
|
{
|
|
|
|
switch ( nT )
|
|
|
|
{
|
|
|
|
case WRITE_ODL:
|
|
|
|
{
|
2012-01-26 09:46:41 +00:00
|
|
|
if( !aSlotIdFile.getString().isEmpty() )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
WriteTab( rOutStm, nTab );
|
2012-01-26 09:46:41 +00:00
|
|
|
rOutStm << "#include \"" << aSlotIdFile.getString().getStr() << '"' << endl << endl;
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
SvMetaExtern::Write( rBase, rOutStm, nTab, nT, nA );
|
|
|
|
rOutStm << endl;
|
|
|
|
WriteTab( rOutStm, nTab );
|
2012-01-26 09:46:41 +00:00
|
|
|
rOutStm << "library " << GetName().getString().getStr() << endl;
|
2000-09-18 15:33:13 +00:00
|
|
|
WriteTab( rOutStm, nTab );
|
|
|
|
rOutStm << '{' << endl;
|
|
|
|
WriteTab( rOutStm, nTab );
|
|
|
|
rOutStm << "importlib(\"STDOLE.TLB\");" << endl;
|
|
|
|
|
2011-01-13 09:32:03 +01:00
|
|
|
for( sal_uLong n = 0; n < aClassList.Count(); n++ )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
SvMetaClass * pClass = aClassList.GetObject( n );
|
|
|
|
if( !pClass->IsShell() && pClass->GetAutomation() )
|
|
|
|
{
|
|
|
|
WriteTab( rOutStm, nTab );
|
|
|
|
WriteStars( rOutStm );
|
|
|
|
pClass->Write( rBase, rOutStm, nTab +1, nT, nA );
|
|
|
|
if( n +1 < aClassList.Count() )
|
|
|
|
rOutStm << endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
rOutStm << '}' << endl;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case WRITE_DOCU:
|
|
|
|
{
|
|
|
|
rOutStm << "SvIDL interface documentation" << endl << endl;
|
2012-01-26 09:46:41 +00:00
|
|
|
rOutStm << "<MODULE>" << endl << GetName().getString().getStr() << endl;
|
2006-06-19 09:42:12 +00:00
|
|
|
WriteDescription( rOutStm );
|
2000-09-18 15:33:13 +00:00
|
|
|
rOutStm << "</MODULE>" << endl << endl;
|
|
|
|
|
|
|
|
rOutStm << "<CLASSES>" << endl;
|
2011-01-13 09:32:03 +01:00
|
|
|
for( sal_uLong n = 0; n < aClassList.Count(); n++ )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
SvMetaClass * pClass = aClassList.GetObject( n );
|
|
|
|
if( !pClass->IsShell() )
|
|
|
|
{
|
2012-01-26 09:46:41 +00:00
|
|
|
rOutStm << pClass->GetName().getString().getStr();
|
2000-09-18 15:33:13 +00:00
|
|
|
SvMetaClass* pSC = pClass->GetSuperClass();
|
|
|
|
if( pSC )
|
2012-01-26 09:46:41 +00:00
|
|
|
rOutStm << " : " << pSC->GetName().getString().getStr();
|
2000-09-18 15:33:13 +00:00
|
|
|
|
2011-02-13 18:06:10 +01:00
|
|
|
// imported classes
|
2000-09-18 15:33:13 +00:00
|
|
|
const SvClassElementMemberList& rClassList = pClass->GetClassList();
|
|
|
|
if ( rClassList.Count() )
|
|
|
|
{
|
|
|
|
rOutStm << " ( ";
|
|
|
|
|
2012-01-26 09:46:41 +00:00
|
|
|
for( sal_uLong m=0; m<rClassList.Count(); ++m )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
SvClassElement *pEle = rClassList.GetObject(m);
|
|
|
|
SvMetaClass *pCl = pEle->GetClass();
|
2012-01-26 09:46:41 +00:00
|
|
|
rOutStm << pCl->GetName().getString().getStr();
|
2000-09-18 15:33:13 +00:00
|
|
|
if ( m+1 == rClassList.Count() )
|
|
|
|
rOutStm << " )";
|
|
|
|
else
|
|
|
|
rOutStm << " , ";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
rOutStm << endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
rOutStm << "</CLASSES>" << endl << endl;
|
2011-02-13 18:06:10 +01:00
|
|
|
// no break!
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case WRITE_C_SOURCE:
|
|
|
|
case WRITE_C_HEADER:
|
|
|
|
{
|
2011-01-13 09:32:03 +01:00
|
|
|
for( sal_uLong n = 0; n < aClassList.Count(); n++ )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
SvMetaClass * pClass = aClassList.GetObject( n );
|
2011-02-13 18:06:10 +01:00
|
|
|
if( !pClass->IsShell() )
|
2000-09-18 15:33:13 +00:00
|
|
|
pClass->Write( rBase, rOutStm, nTab, nT, nA );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2006-06-19 09:42:12 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-12 15:53:47 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|