merged tag ooo/OOO330_m14
[LibreOffice.git] / l10ntools / inc / xrmmerge.hxx
blobe8c3d322c92ba7c7acf30b87f0b0ab59d0d12e2d
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 ************************************************************************/
28 // global includes
29 #include <tools/string.hxx>
32 // XRMResParser
35 class XRMResParser
37 private:
38 ByteString sGID;
39 ByteString sLID;
41 BOOL bError;
42 BOOL bText;
44 bool sLocalized;
46 ByteString sCurrentOpenTag;
47 ByteString sCurrentCloseTag;
48 ByteString sCurrentText;
49 std::vector<ByteString> aLanguages;
51 protected:
52 ByteString GetAttribute( const ByteString &rToken, const ByteString &rAttribute );
53 void Error( const ByteString &rError );
55 virtual void Output( const ByteString& rOutput )=0;
56 virtual void WorkOnText(
57 const ByteString &rOpenTag,
58 ByteString &rText
59 )=0;
60 virtual void EndOfText(
61 const ByteString &rOpenTag,
62 const ByteString &rCloseTag
63 )=0;
65 ByteString GetGID() { return sGID; }
66 ByteString GetLID() { return sLID; }
68 void ConvertStringToDBFormat( ByteString &rString );
69 void ConvertStringToXMLFormat( ByteString &rString );
71 public:
72 XRMResParser();
73 virtual ~XRMResParser();
75 int Execute( int nToken, char * pToken );
77 void SetError( BOOL bErr = TRUE ) { bError = bErr; }
78 BOOL GetError() { return bError; }
82 // class XRMResOutputParser
85 class XRMResOutputParser : public XRMResParser
87 private:
88 std::vector<ByteString> aLanguages;
89 protected:
90 SvFileStream *pOutputStream;
91 public:
92 XRMResOutputParser ( const ByteString &rOutputFile );
93 virtual ~XRMResOutputParser();
97 // XRMResExport
100 class XRMResExport : public XRMResOutputParser
102 private:
103 ResData *pResData;
104 ByteString sPrj;
105 ByteString sPath;
106 std::vector<ByteString> aLanguages;
108 protected:
109 void WorkOnText(
110 const ByteString &rOpenTag,
111 ByteString &rText
113 void EndOfText(
114 const ByteString &rOpenTag,
115 const ByteString &rCloseTag
117 void Output( const ByteString& rOutput );
119 public:
120 XRMResExport(
121 const ByteString &rOutputFile,
122 const ByteString &rProject,
123 const ByteString &rFilePath
125 virtual ~XRMResExport();
129 // class XRMResMerge
132 class XRMResMerge : public XRMResOutputParser
134 private:
135 MergeDataFile *pMergeDataFile;
136 ByteString sFilename;
137 ResData *pResData;
138 std::vector<ByteString> aLanguages;
140 protected:
141 void WorkOnText(
142 const ByteString &rOpenTag,
143 ByteString &rText
145 void EndOfText(
146 const ByteString &rOpenTag,
147 const ByteString &rCloseTag
149 void Output( const ByteString& rOutput );
150 public:
151 XRMResMerge(
152 const ByteString &rMergeSource,
153 const ByteString &rOutputFile,
154 ByteString &rFilename
156 virtual ~XRMResMerge();