2004-08-30 16:28:37 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 08:26:56 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2004-08-30 16:28:37 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2004-08-30 16:28:37 +00:00
|
|
|
*
|
2008-04-10 08:26:56 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2004-08-30 16:28:37 +00:00
|
|
|
*
|
2008-04-10 08:26:56 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2004-08-30 16:28:37 +00:00
|
|
|
*
|
2008-04-10 08:26:56 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2004-08-30 16:28:37 +00:00
|
|
|
*
|
2008-04-10 08:26:56 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2004-08-30 16:28:37 +00:00
|
|
|
*
|
2008-04-10 08:26:56 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2004-08-30 16:28:37 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
// local includes
|
|
|
|
#include "export.hxx"
|
|
|
|
#include "xmlparse.hxx"
|
|
|
|
#include <rtl/ustring.hxx>
|
|
|
|
#include <rtl/ustrbuf.hxx>
|
|
|
|
#include <rtl/strbuf.hxx>
|
|
|
|
#include <memory> /* auto_ptr */
|
|
|
|
#include "tools/isofallback.hxx"
|
|
|
|
|
2008-07-07 07:26:54 +00:00
|
|
|
#define MOVEFILE_REPLACE_EXISTING 0x01
|
2004-08-30 16:28:37 +00:00
|
|
|
|
|
|
|
/// This Class is responsible for extracting/merging OpenOffice XML Helpfiles
|
|
|
|
class HelpParser
|
|
|
|
{
|
|
|
|
private:
|
2006-06-19 16:19:10 +00:00
|
|
|
ByteString sHelpFile;
|
2004-08-30 16:28:37 +00:00
|
|
|
bool bUTF8;
|
2006-03-29 12:25:19 +00:00
|
|
|
bool bHasInputList;
|
2004-08-30 16:28:37 +00:00
|
|
|
|
|
|
|
/// Copy fallback language String (ENUS,DE) into position of the numeric language iso code
|
|
|
|
/// @PRECOND 0 < langIdx_in < MAX_IDX
|
2008-03-06 11:33:58 +00:00
|
|
|
static void FillInFallbacks( LangHashMap& rElem_out, ByteString sLangIdx_in );
|
2004-08-30 16:28:37 +00:00
|
|
|
|
|
|
|
/// Debugmethod, prints the content of the map to stdout
|
|
|
|
static void Dump( LangHashMap* rElem_in , const ByteString sKey_in );
|
|
|
|
|
|
|
|
/// Debugmethod, prints the content of the map to stdout
|
|
|
|
static void Dump( XMLHashMap* rElem_in ) ;
|
|
|
|
|
2006-03-29 12:25:19 +00:00
|
|
|
|
|
|
|
|
2004-08-30 16:28:37 +00:00
|
|
|
public:
|
2006-03-29 12:25:19 +00:00
|
|
|
HelpParser( const ByteString &rHelpFile, bool bUTF8 , bool bHasInputList );
|
2004-08-30 16:28:37 +00:00
|
|
|
~HelpParser(){};
|
|
|
|
|
|
|
|
/// Method creates/append a SDF file with the content of a parsed XML file
|
|
|
|
/// @PRECOND rHelpFile is valid
|
2008-03-06 11:33:58 +00:00
|
|
|
static bool CreateSDF( const ByteString &rSDFFile_in, const ByteString &rPrj_in, const ByteString &rRoot_in,
|
|
|
|
const ByteString &sHelpFile, XMLFile *pXmlFile, const ByteString &rGsi1 );
|
2004-08-30 16:28:37 +00:00
|
|
|
|
2006-03-29 12:25:19 +00:00
|
|
|
static void parse_languages( std::vector<ByteString>& aLanguages , MergeDataFile& aMergeDataFile );
|
|
|
|
|
2004-08-30 16:28:37 +00:00
|
|
|
/// Method merges the String from the SDFfile into XMLfile. Both Strings must
|
|
|
|
/// point to existing files.
|
2006-03-29 12:25:19 +00:00
|
|
|
bool Merge( const ByteString &rSDFFile_in, const ByteString &rDestinationFile_in , ByteString& sLanguage , MergeDataFile& aMergeDataFile );
|
|
|
|
bool Merge( const ByteString &rSDFFile, const ByteString &rPathX , const ByteString &rPathY , bool bISO
|
|
|
|
, const std::vector<ByteString>& aLanguages , MergeDataFile& aMergeDataFile , bool bCreateDir );
|
2004-08-30 16:28:37 +00:00
|
|
|
|
|
|
|
private:
|
2008-06-04 08:47:58 +00:00
|
|
|
static ByteString makeAbsolutePath( const ByteString& sHelpFile , const ByteString& rRoot_in );
|
|
|
|
|
2006-01-19 16:58:57 +00:00
|
|
|
ByteString GetOutpath( const ByteString& rPathX , const ByteString& sCur , const ByteString& rPathY );
|
2006-03-29 12:25:19 +00:00
|
|
|
bool MergeSingleFile( XMLFile* file , MergeDataFile& aMergeDataFile , const ByteString& sLanguage , ByteString sPath );
|
2006-06-19 16:19:10 +00:00
|
|
|
|
2006-03-29 12:25:19 +00:00
|
|
|
void Process( LangHashMap* aLangHM , const ByteString& sCur , ResData *pResData , MergeDataFile& aMergeDataFile );
|
|
|
|
void ProcessHelp( LangHashMap* aLangHM , const ByteString& sCur , ResData *pResData , MergeDataFile& aMergeDataFile );
|
2006-01-19 16:58:57 +00:00
|
|
|
void MakeDir( const ByteString& sPath );
|
2004-08-30 16:28:37 +00:00
|
|
|
};
|