xref: /aoo41x/main/l10ntools/inc/lngmerge.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
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.
14  *
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).
20  *
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.
25  *
26  ************************************************************************/
27 // local includes
28 #include "export.hxx"
29 
30 DECLARE_LIST( LngLineList, ByteString * )
31 
32 #define LNG_OK				0x0000
33 #define LNG_FILE_NOTFOUND	0x0001
34 #define LNG_COULD_NOT_OPEN	0x0002
35 #define SDF_OK				0x0003
36 #define SDF_FILE_NOTFOUND	0x0004
37 #define SDF_COULD_NOT_OPEN	0x0005
38 
39 //
40 // class LngParser
41 //
42 
43 class LngParser
44 {
45 private:
46 	sal_uInt16 nError;
47 	LngLineList *pLines;
48 	ByteString sSource;
49 	sal_Bool bDBIsUTF8;
50 	sal_Bool bULF;
51     bool bQuiet;
52     std::vector<ByteString> aLanguages;
53 
54     void FillInFallbacks( ByteStringHashMap Text );
55     bool isNextGroup(  ByteString &sGroup_out , ByteString &sLine_in);
56     void ReadLine( const ByteString &sLine_in , ByteStringHashMap &rText_inout );
57     void WriteSDF( SvFileStream &aSDFStream , ByteStringHashMap &rText_inout ,
58                     const ByteString &rPrj ,
59                     const ByteString &rRoot , const ByteString &sActFileName , const ByteString &sID );
60 public:
61 	LngParser( const ByteString &rLngFile, sal_Bool bUTF8, sal_Bool bULFFormat );
62 	~LngParser();
63 
64 	sal_Bool CreateSDF( const ByteString &rSDFFile, const ByteString &rPrj, const ByteString &rRoot );
65 	sal_Bool Merge( const ByteString &rSDFFile, const ByteString &rDestinationFile , const ByteString &rPrj );
66 };
67