Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
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.
15 : : *
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).
21 : : *
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.
26 : : *
27 : : ************************************************************************/
28 : :
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 : :
36 : : #define MOVEFILE_REPLACE_EXISTING 0x01
37 : :
38 : : /// This Class is responsible for extracting/merging OpenOffice XML Helpfiles
39 : : class HelpParser
40 : : {
41 : : private:
42 : : rtl::OString sHelpFile;
43 : :
44 : : #if OSL_DEBUG_LEVEL > 2
45 : : /// Debugmethod, prints the content of the map to stdout
46 : : static void Dump(LangHashMap* rElem_in , const rtl::OString & sKey_in);
47 : :
48 : : /// Debugmethod, prints the content of the map to stdout
49 : : static void Dump(XMLHashMap* rElem_in);
50 : : #endif
51 : :
52 : : public:
53 : : HelpParser( const rtl::OString &rHelpFile );
54 : 0 : ~HelpParser(){};
55 : :
56 : : /// Method creates/append a SDF file with the content of a parsed XML file
57 : : /// @PRECOND rHelpFile is valid
58 : : static bool CreateSDF( const rtl::OString &rSDFFile_in, const rtl::OString &rPrj_in, const rtl::OString &rRoot_in,
59 : : const rtl::OString &sHelpFile, XMLFile *pXmlFile, const rtl::OString &rGsi1 );
60 : :
61 : : static void parse_languages( std::vector<rtl::OString>& aLanguages , MergeDataFile& aMergeDataFile );
62 : :
63 : : /// Method merges the String from the SDFfile into XMLfile. Both Strings must
64 : : /// point to existing files.
65 : : bool Merge( const rtl::OString &rSDFFile_in, const rtl::OString &rDestinationFile_in ,
66 : : const rtl::OString& sLanguage , MergeDataFile& aMergeDataFile );
67 : : bool Merge( const rtl::OString &rSDFFile, const rtl::OString &rPathX , const rtl::OString &rPathY , bool bISO
68 : : , const std::vector<rtl::OString>& aLanguages , MergeDataFile& aMergeDataFile , bool bCreateDir );
69 : :
70 : : private:
71 : : rtl::OString GetOutpath( const rtl::OString& rPathX , const rtl::OString& sCur , const rtl::OString& rPathY );
72 : : bool MergeSingleFile( XMLFile* file , MergeDataFile& aMergeDataFile , const rtl::OString& sLanguage , rtl::OString const & sPath );
73 : :
74 : : void ProcessHelp( LangHashMap* aLangHM , const rtl::OString& sCur , ResData *pResData , MergeDataFile& aMergeDataFile );
75 : : void MakeDir(const rtl::OString& rPath);
76 : : };
77 : :
78 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|