Version 3.4.2.3, tag libreoffice-3.4.2.3 (3.4.2-rc3)
[LibreOffice.git] / l10ntools / inc / helpmerge.hxx
blobe2ec54daa637b8a9a74fb9d0cae641626bbf2bc5
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
28 // local includes
29 #include "export.hxx"
30 #include "xmlparse.hxx"
31 #include <rtl/ustring.hxx>
32 #include <rtl/ustrbuf.hxx>
33 #include <rtl/strbuf.hxx>
34 #include <memory> /* auto_ptr */
35 #include "tools/isofallback.hxx"
37 #define MOVEFILE_REPLACE_EXISTING 0x01
39 /// This Class is responsible for extracting/merging OpenOffice XML Helpfiles
40 class HelpParser
42 private:
43 ByteString sHelpFile;
44 bool bUTF8;
45 bool bHasInputList;
47 /// Copy fallback language String (ENUS,DE) into position of the numeric language iso code
48 /// @PRECOND 0 < langIdx_in < MAX_IDX
49 static void FillInFallbacks( LangHashMap& rElem_out, ByteString sLangIdx_in );
51 /// Debugmethod, prints the content of the map to stdout
52 static void Dump( LangHashMap* rElem_in , const ByteString sKey_in );
54 /// Debugmethod, prints the content of the map to stdout
55 static void Dump( XMLHashMap* rElem_in ) ;
59 public:
60 HelpParser( const ByteString &rHelpFile, bool bUTF8 , bool bHasInputList );
61 ~HelpParser(){};
63 /// Method creates/append a SDF file with the content of a parsed XML file
64 /// @PRECOND rHelpFile is valid
65 static bool CreateSDF( const ByteString &rSDFFile_in, const ByteString &rPrj_in, const ByteString &rRoot_in,
66 const ByteString &sHelpFile, XMLFile *pXmlFile, const ByteString &rGsi1 );
68 static void parse_languages( std::vector<ByteString>& aLanguages , MergeDataFile& aMergeDataFile );
70 /// Method merges the String from the SDFfile into XMLfile. Both Strings must
71 /// point to existing files.
72 bool Merge( const ByteString &rSDFFile_in, const ByteString &rDestinationFile_in , ByteString& sLanguage , MergeDataFile& aMergeDataFile );
73 bool Merge( const ByteString &rSDFFile, const ByteString &rPathX , const ByteString &rPathY , bool bISO
74 , const std::vector<ByteString>& aLanguages , MergeDataFile& aMergeDataFile , bool bCreateDir );
76 private:
77 static ByteString makeAbsolutePath( const ByteString& sHelpFile , const ByteString& rRoot_in );
79 ByteString GetOutpath( const ByteString& rPathX , const ByteString& sCur , const ByteString& rPathY );
80 bool MergeSingleFile( XMLFile* file , MergeDataFile& aMergeDataFile , const ByteString& sLanguage , ByteString sPath );
82 void Process( LangHashMap* aLangHM , const ByteString& sCur , ResData *pResData , MergeDataFile& aMergeDataFile );
83 void ProcessHelp( LangHashMap* aLangHM , const ByteString& sCur , ResData *pResData , MergeDataFile& aMergeDataFile );
84 void MakeDir( const ByteString& sPath );
87 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */