xref: /aoo41x/main/idl/source/objects/basobj.cxx (revision 79aad27f)
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 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_idl.hxx"
26 
27 #include <ctype.h>
28 #include <stdio.h>
29 
30 #include <tools/debug.hxx>
31 
32 #include <attrib.hxx>
33 #include <basobj.hxx>
34 #include <module.hxx>
35 #include <globals.hxx>
36 #include <database.hxx>
37 
38 /****************** SvMetaObject *****************************************/
SV_IMPL_META_FACTORY1(SvMetaObject,SvRttiBase)39 SV_IMPL_META_FACTORY1( SvMetaObject, SvRttiBase )
40 /*************************************************************************
41 |*    SvMetaObject::SvMetaObject()
42 |*
43 |*    Beschreibung
44 *************************************************************************/
45 SvMetaObject::SvMetaObject()
46 {
47 }
48 
Load(SvPersistStream &)49 void SvMetaObject::Load( SvPersistStream & )
50 {
51 }
52 
Save(SvPersistStream &)53 void SvMetaObject::Save( SvPersistStream & )
54 {
55 }
56 
57 /*************************************************************************
58 |*    SvMetaObject::WriteTab()
59 |*
60 |*    Beschreibung
61 *************************************************************************/
62 #ifdef IDL_COMPILER
WriteTab(SvStream & rOutStm,sal_uInt16 nTab)63 void SvMetaObject::WriteTab( SvStream & rOutStm, sal_uInt16 nTab )
64 {
65     while( nTab-- )
66         rOutStm << "    ";
67 //        rOutStm << '\t';
68 }
69 
70 /*************************************************************************
71 |*    SvMetaObject::WriteStart()
72 |*
73 |*    Beschreibung
74 *************************************************************************/
WriteStars(SvStream & rOutStm)75 void SvMetaObject::WriteStars( SvStream & rOutStm )
76 {
77     rOutStm << '/';
78 	for( int i = 6; i > 0; i-- )
79         rOutStm << "**********";
80     rOutStm << '/' << endl;
81 }
82 
83 /*************************************************************************
84 |*    SvMetaObject::TestAndSeekSpaceOnly()
85 |*
86 |*    Beschreibung
87 *************************************************************************/
TestAndSeekSpaceOnly(SvStream & rOutStm,sal_uLong nBegPos)88 sal_Bool SvMetaObject::TestAndSeekSpaceOnly( SvStream & rOutStm, sal_uLong nBegPos )
89 {
90     // keine leeren Klammern schreiben
91     sal_uLong nPos = rOutStm.Tell();
92     rOutStm.Seek( nBegPos );
93     sal_Bool bOnlySpace = sal_True;
94     while( bOnlySpace && rOutStm.Tell() < nPos )
95     {
96         char c;
97         rOutStm >> c;
98         if( !isspace( c ) )
99             bOnlySpace = sal_False;
100     }
101     if( bOnlySpace )
102         // nichts geschrieben
103         rOutStm.Seek( nBegPos );
104     else
105         rOutStm.Seek( nPos );
106 	return bOnlySpace;
107 }
108 
109 /*************************************************************************
110 |*    SvMetaObject::Back2Delemitter()
111 |*
112 |*    Beschreibung
113 *************************************************************************/
Back2Delemitter(SvStream & rOutStm)114 void SvMetaObject::Back2Delemitter( SvStream & rOutStm )
115 {
116     // keine leeren Klammern schreiben
117     sal_uLong nPos = rOutStm.Tell();
118     rOutStm.SeekRel( -1 );
119 	char c = 0;
120 	rOutStm >> c;
121 
122     while( isspace( c ) && rOutStm.Tell() != 1 )
123     {
124 	    rOutStm.SeekRel( -2 );
125 		rOutStm >> c;
126     }
127 
128 	if( c == ';' || c == ',' )
129 	    rOutStm.SeekRel( -1 );
130 	else
131     	rOutStm.Seek( nPos );
132 }
133 
134 /*************************************************************************
135 |*    SvMetaObject::ReadSvIdl()
136 |*
137 |*    Beschreibung
138 *************************************************************************/
ReadSvIdl(SvIdlDataBase &,SvTokenStream &)139 sal_Bool SvMetaObject::ReadSvIdl( SvIdlDataBase &, SvTokenStream & )
140 {
141     return sal_False;
142 }
143 
144 /*************************************************************************
145 |*    SvMetaObject::WriteSvIdl()
146 |*
147 |*    Beschreibung
148 *************************************************************************/
WriteSvIdl(SvIdlDataBase &,SvStream &,sal_uInt16)149 void SvMetaObject::WriteSvIdl( SvIdlDataBase &, SvStream &, sal_uInt16 /*nTab */ )
150 {
151 }
152 
153 /*************************************************************************
154 |*    SvMetaObject::Write()
155 |*
156 |*    Beschreibung
157 *************************************************************************/
Write(SvIdlDataBase &,SvStream &,sal_uInt16,WriteType,WriteAttribute)158 void SvMetaObject::Write( SvIdlDataBase &, SvStream &, sal_uInt16 /*nTab */,
159 		 					WriteType, WriteAttribute )
160 {
161 }
162 
163 /*************************************************************************
164 |*    SvMetaObject::WriteCxx()
165 |*
166 |*    Beschreibung
167 *************************************************************************/
WriteCxx(SvIdlDataBase &,SvStream &,sal_uInt16)168 void SvMetaObject::WriteCxx( SvIdlDataBase &, SvStream &, sal_uInt16 /*nTab */ )
169 {
170 }
171 
172 /*************************************************************************
173 |*    SvMetaObject::WriteHxx()
174 |*
175 |*    Beschreibung
176 *************************************************************************/
WriteHxx(SvIdlDataBase &,SvStream &,sal_uInt16)177 void SvMetaObject::WriteHxx( SvIdlDataBase &, SvStream &, sal_uInt16 /*nTab */ )
178 {
179 }
180 
181 #endif
182 
183 /****************** SvMetaName *****************************************/
184 SV_IMPL_META_FACTORY1( SvMetaName, SvMetaObject );
185 /*************************************************************************
186 |*    SvMetaName::SvMetaName()
187 |*
188 |*    Beschreibung
189 *************************************************************************/
SvMetaName()190 SvMetaName::SvMetaName()
191 {
192 }
193 
Load(SvPersistStream & rStm)194 void SvMetaName::Load( SvPersistStream & rStm )
195 {
196     SvMetaObject::Load( rStm );
197     sal_uInt8 nMask;
198     rStm >> nMask;
199 
200     if( nMask >= 0x20 )
201     {
202         rStm.SetError( SVSTREAM_FILEFORMAT_ERROR );
203         DBG_ERROR( "wrong format" );
204         return;
205     }
206     if( nMask & 0x01 )	rStm >> aName;
207     if( nMask & 0x02 )  rStm >> aHelpContext;
208     if( nMask & 0x04 )	rStm >> aHelpText;
209     if( nMask & 0x08 )	rStm >> aConfigName;
210     if( nMask & 0x10 )	rStm >> aDescription;
211 }
212 
Save(SvPersistStream & rStm)213 void SvMetaName::Save( SvPersistStream & rStm )
214 {
215     SvMetaObject::Save( rStm );
216     sal_uInt8 nMask = 0;
217     if( aName.IsSet() )			nMask |= 0x01;
218     if( aHelpContext.IsSet() )  nMask |= 0x02;
219     if( aHelpText.IsSet() )   	nMask |= 0x04;
220     if( aConfigName.IsSet() ) 	nMask |= 0x08;
221     if( aDescription.IsSet() ) 	nMask |= 0x10;
222 
223     rStm << nMask;
224     if( nMask & 0x01 ) rStm << aName;
225     if( nMask & 0x02 ) rStm << aHelpContext;
226     if( nMask & 0x04 ) rStm << aHelpText;
227     if( nMask & 0x08 ) rStm << aConfigName;
228     if( nMask & 0x10 ) rStm << aDescription;
229 }
230 
231 /*************************************************************************
232 |*
233 |*
234 |*    Beschreibung
235 *************************************************************************/
SetName(const ByteString & rName,SvIdlDataBase *)236 sal_Bool SvMetaName::SetName( const ByteString & rName, SvIdlDataBase * )
237 {
238     aName = rName;
239     return sal_True;
240 }
241 
242 #ifdef IDL_COMPILER
243 /*************************************************************************
244 |*    SvMetaName::ReadNameSvIdl()
245 |*
246 |*    Beschreibung
247 *************************************************************************/
ReadNameSvIdl(SvIdlDataBase & rBase,SvTokenStream & rInStm)248 sal_Bool SvMetaName::ReadNameSvIdl( SvIdlDataBase & rBase,
249                                 SvTokenStream & rInStm )
250 {
251     sal_uInt32 nTokPos = rInStm.Tell();
252     SvToken * pTok = rInStm.GetToken_Next();
253 
254     // Modulnamen lesen
255     if( pTok->IsIdentifier() )
256         if( SetName( pTok->GetString(), &rBase ) )
257             return sal_True;
258 
259     rInStm.Seek( nTokPos );
260     return sal_False;
261 }
262 
263 /*************************************************************************
264 |*    SvMetaName::ReadSvIdl()
265 |*
266 |*    Beschreibung
267 *************************************************************************/
ReadAttributesSvIdl(SvIdlDataBase & rBase,SvTokenStream & rInStm)268 void SvMetaName::ReadAttributesSvIdl( SvIdlDataBase & rBase,
269                                       SvTokenStream & rInStm )
270 {
271     sal_uInt32 nTokPos = rInStm.Tell();
272     if( aName.ReadSvIdl( SvHash_Name(), rInStm ) )
273     {
274         if( !SetName( aName, &rBase ) )
275             rInStm.Seek( nTokPos );
276     }
277     aHelpContext.ReadSvIdl( rBase, SvHash_HelpContext(), rInStm );
278     aHelpText.ReadSvIdl( rBase, rInStm );
279     aConfigName.ReadSvIdl( SvHash_ConfigName(), rInStm );
280     aDescription.ReadSvIdl( SvHash_Description(), rInStm );
281 /*
282     aHelpContext.ReadSvIdl( GetModule()->GetInfo()->GetHelpContextContainer(),
283                           rInStm );
284 */
285 }
286 
287 /*************************************************************************
288 |*    SvMetaName::DoReadContextSvIdl()
289 |*
290 |*    Beschreibung
291 *************************************************************************/
DoReadContextSvIdl(SvIdlDataBase & rBase,SvTokenStream & rInStm,char cDel)292 void SvMetaName::DoReadContextSvIdl( SvIdlDataBase & rBase,
293                                    SvTokenStream & rInStm, char cDel )
294 {
295     sal_uInt32 nBeginPos = 0; // kann mit Tell nicht vorkommen
296     while( nBeginPos != rInStm.Tell() )
297     {
298         nBeginPos = rInStm.Tell();
299         ReadContextSvIdl( rBase, rInStm );
300 		if( cDel == '\0' )
301         	rInStm.ReadDelemiter();
302 		else
303         	rInStm.Read( cDel );
304     }
305 }
306 
307 /*************************************************************************
308 |*    SvMetaName::ReadSvIdl()
309 |*
310 |*    Beschreibung
311 *************************************************************************/
ReadContextSvIdl(SvIdlDataBase &,SvTokenStream &)312 void SvMetaName::ReadContextSvIdl( SvIdlDataBase &, SvTokenStream & )
313 {
314 }
315 
316 /*************************************************************************
317 |*    SvMetaName::Test()
318 |*
319 |*    Beschreibung
320 *************************************************************************/
Test(SvIdlDataBase &,SvTokenStream &)321 sal_Bool SvMetaName::Test( SvIdlDataBase &, SvTokenStream & )
322 {
323     return sal_True;
324 }
325 
326 /*************************************************************************
327 |*    SvMetaName::WriteContextSvIdl()
328 |*
329 |*    Beschreibung
330 *************************************************************************/
WriteContextSvIdl(SvIdlDataBase &,SvStream &,sal_uInt16)331 void SvMetaName::WriteContextSvIdl( SvIdlDataBase &, SvStream &, sal_uInt16 )
332 {
333 }
334 
335 /*************************************************************************
336 |*    SvMetaName::WriteDescription()
337 |*
338 |*    Beschreibung
339 *************************************************************************/
WriteDescription(SvStream & rOutStm)340 void SvMetaName::WriteDescription( SvStream & rOutStm )
341 {
342 	rOutStm << "<DESCRIPTION>" << endl;
343 
344 	ByteString aDesc( GetDescription() );
345 	sal_uInt16 nPos = aDesc.Search( '\n' );
346 	while ( nPos != STRING_NOTFOUND )
347 	{
348         rOutStm << aDesc.Copy( 0, nPos ).GetBuffer() << endl;
349         aDesc.Erase(0,nPos+1);
350 		nPos = aDesc.Search( '\n' );
351 	}
352 
353     rOutStm << aDesc.GetBuffer() << endl << "</DESCRIPTION>" << endl;
354 }
355 
356 /*************************************************************************
357 |*    SvMetaName::WriteAttributesIdl()
358 |*
359 |*    Beschreibung
360 *************************************************************************/
WriteAttributesSvIdl(SvIdlDataBase & rBase,SvStream & rOutStm,sal_uInt16 nTab)361 void SvMetaName::WriteAttributesSvIdl( SvIdlDataBase & rBase,
362                                        SvStream & rOutStm,
363                                        sal_uInt16 nTab )
364 {
365     if( aHelpContext.IsSet() || aHelpText.IsSet() || aConfigName.IsSet() )
366 	{
367     	WriteTab( rOutStm, nTab );
368     	rOutStm << "// class SvMetaName" << endl;
369 	}
370     if( aHelpContext.IsSet() )
371     {
372         WriteTab( rOutStm, nTab );
373         aHelpContext.WriteSvIdl( SvHash_HelpContext(), rOutStm, nTab );
374         rOutStm << ';' << endl;
375     }
376     if( aHelpText.IsSet() )
377     {
378         WriteTab( rOutStm, nTab );
379         aHelpText.WriteSvIdl( rBase, rOutStm, nTab );
380         rOutStm << ';' << endl;
381     }
382     if( aConfigName.IsSet() )
383     {
384         WriteTab( rOutStm, nTab );
385         aConfigName.WriteSvIdl( SvHash_ConfigName(), rOutStm, nTab );
386         rOutStm << ';' << endl;
387     }
388 }
389 
390 /*************************************************************************
391 |*    SvMetaName::ReadSvIdl()
392 |*
393 |*    Beschreibung
394 *************************************************************************/
ReadSvIdl(SvIdlDataBase & rBase,SvTokenStream & rInStm)395 sal_Bool SvMetaName::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm )
396 {
397     sal_uInt32 nTokPos = rInStm.Tell();
398     sal_Bool bOk = sal_True;
399     if( rInStm.Read( '[' ) )
400     {
401         sal_uInt32 nBeginPos = 0; // kann mit Tell nicht vorkommen
402         while( nBeginPos != rInStm.Tell() )
403         {
404             nBeginPos = rInStm.Tell();
405             ReadAttributesSvIdl( rBase, rInStm );
406             rInStm.ReadDelemiter();
407         }
408         bOk = rInStm.Read( ']' );
409     }
410 
411     if( bOk )
412     {
413         if( rInStm.Read( '{' ) )
414         {
415 			DoReadContextSvIdl( rBase, rInStm );
416             bOk = rInStm.Read( '}' );
417         }
418     }
419 
420     if( !bOk )
421         rInStm.Seek( nTokPos );
422     return bOk;
423 }
424 
425 /*************************************************************************
426 |*    SvMetaName::WriteSvIdl()
427 |*
428 |*    Beschreibung
429 *************************************************************************/
WriteSvIdl(SvIdlDataBase & rBase,SvStream & rOutStm,sal_uInt16 nTab)430 void SvMetaName::WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm,
431                              sal_uInt16 nTab )
432 {
433     sal_uLong nBeginPos = rOutStm.Tell();
434     WriteTab( rOutStm, nTab );
435     rOutStm << '[' << endl;
436     sal_uLong nOldPos = rOutStm.Tell();
437     WriteAttributesSvIdl( rBase, rOutStm, nTab +1 );
438 
439     // keine leeren Klammern schreiben
440 	if( TestAndSeekSpaceOnly( rOutStm, nOldPos ) )
441         // nichts geschrieben
442         rOutStm.Seek( nBeginPos );
443     else
444     {
445         WriteTab( rOutStm, nTab );
446         rOutStm << ']';
447 	    nBeginPos = rOutStm.Tell();
448 	  	rOutStm << endl;
449     }
450 
451     WriteTab( rOutStm, nTab );
452     rOutStm << '{' << endl;
453     nOldPos = rOutStm.Tell();
454     WriteContextSvIdl( rBase, rOutStm, nTab +1 );
455 
456     // keine leeren Klammern schreiben
457 	if( TestAndSeekSpaceOnly( rOutStm, nOldPos ) )
458         // nichts geschrieben
459         rOutStm.Seek( nBeginPos );
460     else
461     {
462         WriteTab( rOutStm, nTab );
463         rOutStm << '}';
464     }
465 }
466 
467 /*************************************************************************
468 |*    SvMetaName::Write()
469 |*
470 |*    Beschreibung
471 *************************************************************************/
Write(SvIdlDataBase & rBase,SvStream & rOutStm,sal_uInt16 nTab,WriteType nT,WriteAttribute nA)472 void SvMetaName::Write( SvIdlDataBase & rBase, SvStream & rOutStm,
473                        	sal_uInt16 nTab,
474 		 				WriteType nT, WriteAttribute nA )
475 {
476     sal_uLong nBeginPos = rOutStm.Tell();
477     WriteTab( rOutStm, nTab );
478     rOutStm << '[' << endl;
479     sal_uLong nOldPos = rOutStm.Tell();
480     WriteAttributes( rBase, rOutStm, nTab +1, nT, nA );
481 
482     // keine leeren Klammern schreiben
483     sal_uLong nPos = rOutStm.Tell();
484     rOutStm.Seek( nOldPos );
485     sal_Bool bOnlySpace = sal_True;
486     while( bOnlySpace && rOutStm.Tell() < nPos )
487     {
488         char c;
489         rOutStm >> c;
490         if( !isspace( c ) )
491             bOnlySpace = sal_False;
492     }
493     if( bOnlySpace )
494         // nichts geschrieben
495         rOutStm.Seek( nBeginPos );
496     else
497     {
498         rOutStm.Seek( nPos );
499         WriteTab( rOutStm, nTab );
500         rOutStm << ']' << endl;
501     }
502 }
503 
504 /*************************************************************************
505 |*    SvMetaName::WriteAttributes()
506 |*
507 |*    Beschreibung
508 *************************************************************************/
WriteAttributes(SvIdlDataBase &,SvStream & rOutStm,sal_uInt16 nTab,WriteType,WriteAttribute)509 void SvMetaName::WriteAttributes( SvIdlDataBase &, SvStream & rOutStm,
510                             	sal_uInt16 nTab,
511 		 						WriteType, WriteAttribute )
512 {
513     if( GetHelpText().IsSet() || GetHelpContext().IsSet() )
514 	{
515 		WriteTab( rOutStm, nTab );
516 		rOutStm << "// class SvMetaName" << endl;
517     }
518 	if( GetHelpText().IsSet() )
519 	{
520 		WriteTab( rOutStm, nTab );
521         rOutStm << "helpstring(\"" << GetHelpText().GetBuffer() << "\")," << endl;
522 	}
523     if( GetHelpContext().IsSet() )
524 	{
525 		WriteTab( rOutStm, nTab );
526         rOutStm << "helpcontext("
527                 << ByteString::CreateFromInt64(
528                     GetHelpContext().GetValue() ).GetBuffer()
529                 << ")," << endl;
530 	}
531 }
532 
533 /*************************************************************************
534 |*    SvMetaName::WriteContext()
535 |*
536 |*    Beschreibung
537 *************************************************************************/
WriteContext(SvIdlDataBase &,SvStream &,sal_uInt16,WriteType,WriteAttribute)538 void SvMetaName::WriteContext( SvIdlDataBase &, SvStream &,
539                             	sal_uInt16,
540 		 						WriteType, WriteAttribute )
541 {
542 }
543 #endif // IDL_COMPILER
544 
545 /****************** SvMetaReference *****************************************/
546 SV_IMPL_META_FACTORY1( SvMetaReference, SvMetaName );
547 
548 /*************************************************************************
549 |*    SvMetaReference::SvMetaReference()
550 |*
551 |*    Beschreibung
552 *************************************************************************/
SvMetaReference()553 SvMetaReference::SvMetaReference()
554 {
555 }
556 
Load(SvPersistStream & rStm)557 void SvMetaReference::Load( SvPersistStream & rStm )
558 {
559     SvMetaName::Load( rStm );
560 
561     sal_uInt8 nMask;
562     rStm >> nMask;
563     if( nMask >= 0x2 )
564     {
565         rStm.SetError( SVSTREAM_FILEFORMAT_ERROR );
566         DBG_ERROR( "wrong format" );
567         return;
568     }
569     if( nMask & 0x01 )
570     {
571         SvMetaReference * pRef;
572         rStm >> pRef;
573         aRef = pRef;
574     }
575 }
576 
Save(SvPersistStream & rStm)577 void SvMetaReference::Save( SvPersistStream & rStm )
578 {
579     SvMetaName::Save( rStm );
580 
581     // Maske erstellen
582     sal_uInt8 nMask = 0;
583     if( aRef.Is() )
584         nMask |= 0x01;
585 
586     // Daten schreiben
587     rStm << nMask;
588     if( nMask & 0x01 ) rStm << aRef;
589 }
590 
591 /**************************************************************************/
592 /****************** SvMetaExtern ******************************************/
593 SV_IMPL_META_FACTORY1( SvMetaExtern, SvMetaReference );
594 
595 /*************************************************************************
596 |*    SvMetaExtern::SvMetaExtern()
597 |*
598 |*    Beschreibung
599 *************************************************************************/
SvMetaExtern()600 SvMetaExtern::SvMetaExtern()
601     : pModule( NULL )
602 	, bReadUUId( sal_False )
603 	, bReadVersion( sal_False )
604 {
605 }
606 
Load(SvPersistStream & rStm)607 void SvMetaExtern::Load( SvPersistStream & rStm )
608 {
609     SvMetaReference::Load( rStm );
610 
611     sal_uInt8 nMask;
612     rStm >> nMask;
613     if( nMask >= 0x20 )
614     {
615         rStm.SetError( SVSTREAM_FILEFORMAT_ERROR );
616         DBG_ERROR( "wrong format" );
617         return;
618     }
619     if( nMask & 0x01 ) rStm >> pModule;
620     if( nMask & 0x02 ) rStm >> aUUId;
621     if( nMask & 0x04 ) rStm >> aVersion;
622     if( nMask & 0x08 ) bReadUUId = sal_True;
623     if( nMask & 0x10 ) bReadVersion = sal_True;
624 }
625 
Save(SvPersistStream & rStm)626 void SvMetaExtern::Save( SvPersistStream & rStm )
627 {
628     SvMetaReference::Save( rStm );
629 
630     // Maske erstellen
631     sal_uInt8 nMask = 0;
632     if( pModule )                	nMask |= 0x01;
633     if( aUUId != SvGlobalName() )	nMask |= 0x02;
634     if( aVersion != SvVersion() )	nMask |= 0x04;
635     if( bReadUUId ) 				nMask |= 0x08;
636     if( bReadVersion )  			nMask |= 0x10;
637 
638     // Daten schreiben
639     rStm << nMask;
640     if( nMask & 0x01 ) rStm << pModule;
641     if( nMask & 0x02 ) rStm << aUUId;
642     if( nMask & 0x04 ) rStm << aVersion;
643 }
644 
645 /*************************************************************************
646 |*    SvMetaExtern::GetModule()
647 |*
648 |*    Beschreibung
649 *************************************************************************/
GetModule() const650 SvMetaModule * SvMetaExtern::GetModule() const
651 {
652     DBG_ASSERT( pModule != NULL, "module not set" );
653     return pModule;
654 }
655 
656 /*************************************************************************
657 |*    SvMetaExtern::GetUUId()
658 |*
659 |*    Beschreibung
660 *************************************************************************/
GetUUId() const661 const SvGlobalName & SvMetaExtern::GetUUId() const
662 {
663 #ifdef IDL_COMPILER
664     if( aUUId == SvGlobalName() )
665         GetModule()->FillNextName( &((SvMetaExtern *)this)->aUUId );
666 #endif
667     return aUUId;
668 }
669 
670 #ifdef IDL_COMPILER
671 /*************************************************************************
672 |*    SvMetaExtern::SetModule()
673 |*
674 |*    Beschreibung
675 *************************************************************************/
SetModule(SvIdlDataBase & rBase)676 void SvMetaExtern::SetModule( SvIdlDataBase & rBase )
677 {
678     pModule = (SvMetaModule *)rBase.GetStack().Get( TYPE( SvMetaModule ) );
679 }
680 
681 /*************************************************************************
682 |*    SvMetaExtern::ReadAttributesSvIdl()
683 |*
684 |*    Beschreibung
685 *************************************************************************/
ReadAttributesSvIdl(SvIdlDataBase & rBase,SvTokenStream & rInStm)686 void SvMetaExtern::ReadAttributesSvIdl( SvIdlDataBase & rBase,
687                                         SvTokenStream & rInStm )
688 {
689 	SvMetaReference::ReadAttributesSvIdl( rBase, rInStm );
690     if( aUUId.ReadSvIdl( rBase, rInStm ) )
691 		bReadUUId = sal_True;
692     if( aVersion.ReadSvIdl( rInStm ) )
693 		bReadVersion = sal_True;
694 }
695 
696 /*************************************************************************
697 |*    SvMetaExtern::WriteAttributesSvIdl()
698 |*
699 |*    Beschreibung
700 *************************************************************************/
WriteAttributesSvIdl(SvIdlDataBase & rBase,SvStream & rOutStm,sal_uInt16 nTab)701 void SvMetaExtern::WriteAttributesSvIdl( SvIdlDataBase & rBase,
702                                          SvStream & rOutStm, sal_uInt16 nTab )
703 {
704 	SvMetaReference::WriteAttributesSvIdl( rBase, rOutStm, nTab );
705 	if( bReadUUId || bReadVersion )
706     {
707 		WriteTab( rOutStm, nTab );
708 		rOutStm << "// class SvMetaExtern" << endl;
709 
710 		if( bReadUUId )
711 		{
712 		    WriteTab( rOutStm, nTab );
713 		    aUUId.WriteSvIdl( rOutStm );
714 		    rOutStm << ';' << endl;
715 		}
716 		if( bReadVersion )
717 		{
718 		    WriteTab( rOutStm, nTab );
719 		    aVersion.WriteSvIdl( rOutStm );
720 	    	rOutStm << ';' << endl;
721 		}
722 	}
723 }
724 
725 /*************************************************************************
726 |*    SvMetaExtern::ReadSvIdl()
727 |*
728 |*    Beschreibung
729 *************************************************************************/
ReadSvIdl(SvIdlDataBase & rBase,SvTokenStream & rInStm)730 sal_Bool SvMetaExtern::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm )
731 {
732 	SetModule( rBase );
733     GetUUId(); // Id wird angelegt
734     return SvMetaReference::ReadSvIdl( rBase, rInStm );
735 }
736 
737 /*************************************************************************
738 |*    SvMetaExtern::WriteSvIdl()
739 |*
740 |*    Beschreibung
741 *************************************************************************/
WriteSvIdl(SvIdlDataBase & rBase,SvStream & rOutStm,sal_uInt16 nTab)742 void SvMetaExtern::WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm,
743                                sal_uInt16 nTab )
744 {
745     SvMetaReference::WriteSvIdl( rBase, rOutStm, nTab );
746 }
747 
748 /*************************************************************************
749 |*    SvMetaExtern::Write()
750 |*
751 |*    Beschreibung
752 *************************************************************************/
Write(SvIdlDataBase & rBase,SvStream & rOutStm,sal_uInt16 nTab,WriteType nT,WriteAttribute nA)753 void SvMetaExtern::Write( SvIdlDataBase & rBase, SvStream & rOutStm,
754                         sal_uInt16 nTab,
755 		 				WriteType nT, WriteAttribute nA )
756 {
757 	SvMetaReference::Write( rBase, rOutStm, nTab, nT, nA );
758 }
759 
760 /*************************************************************************
761 |*    SvMetaExtern::WriteAttributes()
762 |*
763 |*    Beschreibung
764 *************************************************************************/
WriteAttributes(SvIdlDataBase & rBase,SvStream & rOutStm,sal_uInt16 nTab,WriteType nT,WriteAttribute nA)765 void SvMetaExtern::WriteAttributes( SvIdlDataBase & rBase, SvStream & rOutStm,
766                              		sal_uInt16 nTab,
767 					 				WriteType nT, WriteAttribute nA )
768 {
769 	SvMetaReference::WriteAttributes( rBase, rOutStm, nTab, nT, nA );
770 
771 	WriteTab( rOutStm, nTab );
772 	rOutStm << "// class SvMetaExtern" << endl;
773 	WriteTab( rOutStm, nTab );
774     rOutStm << "uuid(" << ByteString( GetUUId().GetHexName(), RTL_TEXTENCODING_UTF8 ).GetBuffer() << ")," << endl;
775 	WriteTab( rOutStm, nTab );
776     rOutStm << "version(" << ByteString::CreateFromInt32( aVersion.GetMajorVersion() ).GetBuffer() << '.'
777              << ByteString::CreateFromInt32( aVersion.GetMinorVersion() ).GetBuffer() << ")," << endl;
778 }
779 
780 #endif // IDL_COMPILER
781 
782 
783