merge the formfield patch from ooo-build
[ooovba.git] / transex3 / inc / xrmmerge.hxx
blobd5e3a58f10983b798c9097c6d82d5b734d2bc70c
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xrmmerge.hxx,v $
10 * $Revision: 1.7 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // global includes
32 #include <tools/string.hxx>
35 // XRMResParser
38 class XRMResParser
40 private:
41 ByteString sGID;
42 ByteString sLID;
44 BOOL bError;
45 BOOL bText;
47 bool sLocalized;
49 ByteString sCurrentOpenTag;
50 ByteString sCurrentCloseTag;
51 ByteString sCurrentText;
52 std::vector<ByteString> aLanguages;
54 protected:
55 ByteString GetAttribute( const ByteString &rToken, const ByteString &rAttribute );
56 void Error( const ByteString &rError );
58 virtual void Output( const ByteString& rOutput )=0;
59 virtual void WorkOnText(
60 const ByteString &rOpenTag,
61 ByteString &rText
62 )=0;
63 virtual void EndOfText(
64 const ByteString &rOpenTag,
65 const ByteString &rCloseTag
66 )=0;
68 ByteString GetGID() { return sGID; }
69 ByteString GetLID() { return sLID; }
71 void ConvertStringToDBFormat( ByteString &rString );
72 void ConvertStringToXMLFormat( ByteString &rString );
74 public:
75 XRMResParser();
76 virtual ~XRMResParser();
78 int Execute( int nToken, char * pToken );
80 void SetError( BOOL bErr = TRUE ) { bError = bErr; }
81 BOOL GetError() { return bError; }
85 // class XRMResOutputParser
86 //
88 class XRMResOutputParser : public XRMResParser
90 private:
91 std::vector<ByteString> aLanguages;
92 protected:
93 SvFileStream *pOutputStream;
94 public:
95 XRMResOutputParser ( const ByteString &rOutputFile );
96 virtual ~XRMResOutputParser();
100 // XRMResExport
103 class XRMResExport : public XRMResOutputParser
105 private:
106 ResData *pResData;
107 ByteString sPrj;
108 ByteString sPath;
109 std::vector<ByteString> aLanguages;
111 protected:
112 void WorkOnText(
113 const ByteString &rOpenTag,
114 ByteString &rText
116 void EndOfText(
117 const ByteString &rOpenTag,
118 const ByteString &rCloseTag
120 void Output( const ByteString& rOutput );
122 public:
123 XRMResExport(
124 const ByteString &rOutputFile,
125 const ByteString &rProject,
126 const ByteString &rFilePath
128 virtual ~XRMResExport();
132 // class XRMResMerge
135 class XRMResMerge : public XRMResOutputParser
137 private:
138 MergeDataFile *pMergeDataFile;
139 ByteString sFilename;
140 ResData *pResData;
141 std::vector<ByteString> aLanguages;
143 protected:
144 void WorkOnText(
145 const ByteString &rOpenTag,
146 ByteString &rText
148 void EndOfText(
149 const ByteString &rOpenTag,
150 const ByteString &rCloseTag
152 void Output( const ByteString& rOutput );
153 public:
154 XRMResMerge(
155 const ByteString &rMergeSource,
156 const ByteString &rOutputFile,
157 ByteString &rFilename
159 virtual ~XRMResMerge();