1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
34 #include <tools/pstm.hxx>
36 /*************************************************************************
37 *************************************************************************/
42 /******************** class SvIdlError ***********************************/
47 sal_uInt32 nLine
, nColumn
;
49 SvIdlError() : nLine(0), nColumn(0) {}
50 SvIdlError( sal_uInt32 nL
, sal_uInt32 nC
)
51 : nLine(nL
), nColumn(nC
) {}
53 const ByteString
& GetText() const { return aText
; }
54 void SetText( const ByteString
& rT
) { aText
= rT
; }
55 sal_Bool
IsError() const { return nLine
!= 0; }
56 void Clear() { nLine
= nColumn
= 0; }
57 SvIdlError
& operator = ( const SvIdlError
& rRef
)
60 nColumn
= rRef
.nColumn
;
66 /******************** class SvIdlDataBase ********************************/
72 sal_uInt32 nVerbosity
;
76 SvPersistStream aPersStream
;
77 StringList aIdFileList
;
78 SvStringHashTable
* pIdTable
;
80 SvMetaTypeMemberList aTypeList
;
81 SvMetaClassMemberList aClassList
;
82 SvMetaModuleMemberList aModuleList
;
83 SvMetaAttributeMemberList aAttrList
;
84 SvMetaTypeMemberList aTmpTypeList
; // nicht Persistent
88 ByteString aModulePrefix
;
89 SvMetaObjectMemberStack aContextStack
;
99 explicit SvIdlDataBase( const SvCommand
& rCmd
);
101 static sal_Bool
IsBinaryFormat( SvStream
& rInStm
);
103 void Load( SvStream
& rInStm
);
104 void Save( SvStream
& rInStm
, sal_uInt32 nContextFlags
);
106 SvMetaAttributeMemberList
& GetAttrList() { return aAttrList
; }
107 SvStringHashTable
* GetIdTable() { return pIdTable
; }
108 SvMetaTypeMemberList
& GetTypeList();
109 SvMetaClassMemberList
& GetClassList() { return aClassList
; }
110 SvMetaModuleMemberList
& GetModuleList() { return aModuleList
; }
111 SvMetaModule
* GetModule( const ByteString
& rName
);
113 // Liste der benutzten Typen beim Schreiben
114 SvMetaTypeMemberList aUsedTypes
;
115 ByteString aIFaceName
;
116 SvNumberIdentifier aStructSlotId
;
119 void StartNewFile( const String
& rName
);
120 void SetExportFile( const String
& rName
)
121 { aExportFile
= rName
; }
122 void AppendAttr( SvMetaAttribute
*pSlot
);
123 const ByteString
& GetActModulePrefix() const { return aModulePrefix
; }
124 const SvIdlError
& GetError() const { return aError
; }
125 void SetError( const SvIdlError
& r
)
128 const String
& GetPath() const { return aPath
; }
129 SvMetaObjectMemberStack
& GetStack() { return aContextStack
; }
131 void Write( const ByteString
& rText
);
132 void WriteError( const ByteString
& rErrWrn
,
133 const ByteString
& rFileName
,
134 const ByteString
& rErrorText
,
135 sal_uLong nRow
= 0, sal_uLong nColumn
= 0 ) const;
136 void WriteError( SvTokenStream
& rInStm
);
137 void SetError( const ByteString
& rError
, SvToken
* pTok
);
138 void Push( SvMetaObject
* pObj
);
139 sal_Bool
Pop( sal_Bool bOk
, SvTokenStream
& rInStm
, sal_uInt32 nTokPos
)
145 rInStm
.Seek( nTokPos
);
148 sal_uInt32
GetUniqueId() { return ++nUniqueId
; }
149 sal_Bool
FindId( const ByteString
& rIdName
, sal_uLong
* pVal
);
150 sal_Bool
InsertId( const ByteString
& rIdName
, sal_uLong nVal
);
151 sal_Bool
ReadIdFile( const String
& rFileName
);
153 SvMetaType
* FindType( const ByteString
& rName
);
154 static SvMetaType
* FindType( const SvMetaType
*, SvMetaTypeMemberList
& );
156 SvMetaType
* ReadKnownType( SvTokenStream
& rInStm
);
157 SvMetaAttribute
* ReadKnownAttr( SvTokenStream
& rInStm
,
158 SvMetaType
* pType
= NULL
);
159 SvMetaAttribute
* SearchKnownAttr( const SvNumberIdentifier
& );
160 SvMetaClass
* ReadKnownClass( SvTokenStream
& rInStm
);
165 class SvIdlWorkingBase
: public SvIdlDataBase
168 explicit SvIdlWorkingBase( const SvCommand
& rCmd
);
170 sal_Bool
ReadSvIdl( SvTokenStream
&, sal_Bool bImported
, const String
& rPath
);
171 sal_Bool
WriteSvIdl( SvStream
& );
173 sal_Bool
WriteSfx( SvStream
& );
174 sal_Bool
WriteHelpIds( SvStream
& );
175 sal_Bool
WriteSfxItem( SvStream
& );
176 sal_Bool
WriteCSV( SvStream
& );
177 sal_Bool
WriteDocumentation( SvStream
& );
181 #endif // _DATABASE_HXX