summaryrefslogtreecommitdiff
path: root/l10ntools
diff options
context:
space:
mode:
Diffstat (limited to 'l10ntools')
-rw-r--r--l10ntools/inc/cfgmerge.hxx35
-rw-r--r--l10ntools/inc/export.hxx41
-rw-r--r--l10ntools/inc/gsicheck.hxx10
-rw-r--r--l10ntools/inc/helpmerge.hxx3
-rw-r--r--l10ntools/inc/inireader.hxx52
-rw-r--r--l10ntools/inc/l10ntools/directory.hxx3
-rw-r--r--l10ntools/inc/l10ntools/file.hxx3
-rw-r--r--l10ntools/inc/l10ntools/vosapp.hxx10
-rw-r--r--l10ntools/inc/lngmerge.hxx6
-rw-r--r--l10ntools/inc/pch/precompiled_l10ntools.cxx2
-rw-r--r--l10ntools/inc/pch/precompiled_l10ntools.hxx2
-rw-r--r--l10ntools/inc/srciter.hxx2
-rw-r--r--l10ntools/inc/tagtest.hxx100
-rw-r--r--l10ntools/inc/tokens.h3
-rw-r--r--l10ntools/inc/treeconfig.hxx28
-rw-r--r--l10ntools/inc/utf8conv.hxx44
-rw-r--r--l10ntools/inc/wtranode.hxx2
-rw-r--r--l10ntools/inc/wtratree.hxx2
-rw-r--r--l10ntools/inc/xmlparse.hxx49
-rw-r--r--l10ntools/inc/xmlutil.hxx2
-rw-r--r--l10ntools/inc/xrmmerge.hxx2
-rwxr-xr-xl10ntools/java/jpropex/build.xml169
-rw-r--r--l10ntools/java/jpropex/java/JPropEx.java509
-rw-r--r--l10ntools/java/jpropex/java/Main.java38
-rw-r--r--l10ntools/java/jpropex/java/NoLocalizeFilter.java54
-rw-r--r--l10ntools/java/jpropex/java/OrderedHashMap.java96
-rw-r--r--l10ntools/java/jpropex/java/SdfData.java108
-rw-r--r--l10ntools/java/jpropex/java/SdfEntity.java255
-rwxr-xr-xl10ntools/java/jpropex/jpropex12
-rwxr-xr-xl10ntools/java/jpropex/jpropex.MF1
-rwxr-xr-xl10ntools/java/jpropex/makefile.mk36
-rwxr-xr-xl10ntools/java/l10nconv/build.xml229
-rwxr-xr-xl10ntools/java/l10nconv/converter.MF1
-rwxr-xr-xl10ntools/java/l10nconv/documentation/readmeConverter.sxwbin9824 -> 0 bytes
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/DirtyTagWrapCheck.java82
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/DirtyTagWrapper.java249
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/Tag.java246
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/TagPair.java307
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/Convert.java550
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/Converter.java520
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/ConverterException.java76
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/DataHandler.java146
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/DataReader.java76
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/DataWriter.java88
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/ExtMap.java94
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/FileMaker.java84
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/GSIReader.java247
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/GSIWriter.java243
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/GSIandSDFMerger.java164
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/LineErrorException.java78
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/OutputHandler.java225
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/ResTypeResolver.java68
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/Resolver.java95
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/SDFReader.java632
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/SDFWriter.java172
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/XLIFFReader.java742
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/XLIFFWriter.java532
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/converter/dtd/xliff.dtd391
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/languageResolver/LanguageResolver.java198
-rwxr-xr-xl10ntools/java/l10nconv/java/com/sun/star/tooling/languageResolver/lang.map41
-rwxr-xr-xl10ntools/java/l10nconv/makefile.mk35
-rwxr-xr-xl10ntools/java/receditor/build.xml169
-rw-r--r--l10ntools/java/receditor/java/transex3/controller/EditorController.java334
-rw-r--r--l10ntools/java/receditor/java/transex3/controller/Main.java10
-rw-r--r--l10ntools/java/receditor/java/transex3/model/ResourceFile.java77
-rw-r--r--l10ntools/java/receditor/java/transex3/model/SdfEntity.java211
-rw-r--r--l10ntools/java/receditor/java/transex3/model/SdfString.java167
-rw-r--r--l10ntools/java/receditor/java/transex3/view/Editor.java97
-rw-r--r--l10ntools/java/receditor/java/transex3/view/SdfTable.java24
-rwxr-xr-xl10ntools/java/receditor/makefile.mk35
-rwxr-xr-xl10ntools/java/receditor/receditor.MF1
-rw-r--r--l10ntools/layout/layoutparse.cxx27
-rw-r--r--l10ntools/layout/layoutparse.hxx3
-rw-r--r--l10ntools/layout/makefile.mk4
-rw-r--r--l10ntools/layout/tralay.cxx56
-rw-r--r--l10ntools/prj/build.lst4
-rw-r--r--l10ntools/prj/d.lst123
-rwxr-xr-xl10ntools/scripts/localize.pl242
-rwxr-xr-xl10ntools/scripts/localize_old.pl1070
-rw-r--r--l10ntools/scripts/makefile.mk59
-rw-r--r--l10ntools/scripts/tool/const.py39
-rw-r--r--l10ntools/scripts/tool/l10ntool.py220
-rw-r--r--l10ntools/scripts/tool/pseudo.py184
-rw-r--r--l10ntools/scripts/tool/sdf.py170
-rw-r--r--l10ntools/scripts/tool/xhtex.py136
-rw-r--r--l10ntools/scripts/tool/xtxex.py94
-rwxr-xr-xl10ntools/scripts/xhtex46
-rwxr-xr-xl10ntools/scripts/xtxex47
-rw-r--r--l10ntools/source/cfg_yy_wrapper.c3
-rw-r--r--l10ntools/source/cfglex.l8
-rw-r--r--l10ntools/source/cfgmerge.cxx59
-rw-r--r--l10ntools/source/directory.cxx50
-rw-r--r--l10ntools/source/export.cxx299
-rw-r--r--l10ntools/source/export2.cxx66
-rw-r--r--l10ntools/source/file.cxx3
-rw-r--r--l10ntools/source/filter/merge/makefile.mk15
-rw-r--r--l10ntools/source/filter/utils/Cache.java2
-rw-r--r--l10ntools/source/gsicheck.cxx76
-rw-r--r--l10ntools/source/gsiconv.cxx369
-rw-r--r--l10ntools/source/help/HelpCompiler.cxx19
-rw-r--r--[-rwxr-xr-x]l10ntools/source/help/HelpCompiler.hxx14
-rw-r--r--[-rwxr-xr-x]l10ntools/source/help/HelpLinker.cxx62
-rw-r--r--l10ntools/source/help/compilehelp.hxx5
-rw-r--r--l10ntools/source/help/makefile.mk4
-rw-r--r--l10ntools/source/helpex.cxx6
-rw-r--r--l10ntools/source/helpmerge.cxx30
-rw-r--r--l10ntools/source/inireader.cxx132
-rw-r--r--l10ntools/source/lngex.cxx14
-rw-r--r--l10ntools/source/lngmerge.cxx78
-rw-r--r--l10ntools/source/localize.cxx152
-rw-r--r--l10ntools/source/makefile.mk81
-rw-r--r--l10ntools/source/merge.cxx4
-rw-r--r--l10ntools/source/src_yy_wrapper.c3
-rw-r--r--l10ntools/source/srciter.cxx25
-rw-r--r--l10ntools/source/tagtest.cxx132
-rw-r--r--l10ntools/source/treeconfig.cxx128
-rw-r--r--l10ntools/source/utf8conv.cxx74
-rw-r--r--l10ntools/source/wtranode.cxx2
-rw-r--r--l10ntools/source/wtratree.cxx2
-rw-r--r--l10ntools/source/xgfconv.cxx66
-rw-r--r--l10ntools/source/xmlparse.cxx244
-rw-r--r--l10ntools/source/xrm_yy_wrapper.c3
-rw-r--r--l10ntools/source/xrmmerge.cxx23
123 files changed, 845 insertions, 13347 deletions
diff --git a/l10ntools/inc/cfgmerge.hxx b/l10ntools/inc/cfgmerge.hxx
index 2f6418e1aa3f..9308d0c727a8 100644
--- a/l10ntools/inc/cfgmerge.hxx
+++ b/l10ntools/inc/cfgmerge.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -29,10 +30,10 @@
#define _CFG_MERGE_HXX
#include <tools/string.hxx>
-#include <tools/list.hxx>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
+#include <vector>
-typedef std::hash_map<ByteString , ByteString , hashByteString,equalByteString>
+typedef boost::unordered_map<ByteString , ByteString , hashByteString,equalByteString>
ByteStringHashMap;
@@ -68,21 +69,32 @@ public:
// class CfgStack
//
-DECLARE_LIST( CfgStackList, CfgStackData * )
+typedef ::std::vector< CfgStackData* > CfgStackList;
-class CfgStack : public CfgStackList
+class CfgStack
{
+private:
+ CfgStackList maList;
+
public:
- CfgStack() : CfgStackList( 10, 10 ) {}
+ CfgStack() {}
~CfgStack();
- sal_uLong Push( CfgStackData *pStackData );
+ size_t Push( CfgStackData *pStackData );
CfgStackData *Push( const ByteString &rTag, const ByteString &rId );
- CfgStackData *Pop() { return Remove( Count() - 1 ); }
+ CfgStackData *Pop()
+ {
+ if ( maList.empty() ) return NULL;
+ CfgStackData* temp = maList.back();
+ maList.pop_back();
+ return temp;
+ }
- CfgStackData *GetStackData( sal_uLong nPos = LIST_APPEND );
+ CfgStackData *GetStackData( size_t nPos = LIST_APPEND );
- ByteString GetAccessPath( sal_uLong nPos = LIST_APPEND );
+ ByteString GetAccessPath( size_t nPos = LIST_APPEND );
+
+ size_t size() const { return maList.size(); }
};
//
@@ -181,7 +193,6 @@ private:
std::vector<ByteString> aLanguages;
ResData *pResData;
- sal_Bool bGerman;
ByteString sFilename;
sal_Bool bEnglish;
@@ -203,3 +214,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/inc/export.hxx b/l10ntools/inc/export.hxx
index b315d6cb3040..0d707abe9898 100644
--- a/l10ntools/inc/export.hxx
+++ b/l10ntools/inc/export.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -33,17 +34,13 @@
#include <l10ntools/directory.hxx>
#endif
-
-// #define MERGE_SOURCE_LANGUAGES <- To merge en-US and de resource
-
#include <tools/string.hxx>
-#include <tools/list.hxx>
#include <tools/stream.hxx>
#include <tools/fsys.hxx>
#include <osl/file.hxx>
#include <osl/file.h>
-#include <hash_map> /* std::hashmap*/
+#include <boost/unordered_map.hpp>
#include <iterator> /* std::iterator*/
#include <set> /* std::set*/
#include <vector> /* std::vector*/
@@ -79,8 +76,7 @@ struct lessByteString{
struct hashByteString{
size_t operator()( const ByteString& rName ) const{
- std::hash< const char* > myHash;
- return myHash( rName.GetBuffer() );
+ return rtl_str_hashCode_WithLength(rName.GetBuffer(), rName.Len() );
}
};
@@ -88,38 +84,45 @@ class PFormEntrys;
class MergeData;
typedef std::set<ByteString , lessByteString > ByteStringSet;
-typedef std::hash_map<ByteString , ByteString , hashByteString,equalByteString>
+typedef boost::unordered_map<ByteString , ByteString , hashByteString,equalByteString>
ByteStringHashMap;
-typedef std::hash_map<ByteString , bool , hashByteString,equalByteString>
+typedef boost::unordered_map<ByteString , bool , hashByteString,equalByteString>
ByteStringBoolHashMap;
-typedef std::hash_map<ByteString , PFormEntrys* , hashByteString,equalByteString>
+typedef boost::unordered_map<ByteString , PFormEntrys* , hashByteString,equalByteString>
PFormEntrysHashMap;
-typedef std::hash_map<ByteString , MergeData* , hashByteString,equalByteString>
+typedef boost::unordered_map<ByteString , MergeData* , hashByteString,equalByteString>
MergeDataHashMap;
#define SOURCE_LANGUAGE ByteString("en-US")
#define LIST_REFID "LIST_REFID"
typedef ByteStringHashMap ExportListEntry;
-
-DECLARE_LIST( ExportListBase, ExportListEntry * )
+typedef ::std::vector< ExportListEntry* > ExportListBase;
//
// class ExportList
//
-class ExportList : public ExportListBase
+class ExportList
{
private:
+ ExportListBase maList;
sal_uLong nSourceLanguageListEntryCount;
public:
- ExportList() : ExportListBase() { nSourceLanguageListEntryCount = 0; }
+ ExportList() { nSourceLanguageListEntryCount = 0; }
sal_uLong GetSourceLanguageListEntryCount() { return nSourceLanguageListEntryCount; }
void NewSourceLanguageListEntry() { nSourceLanguageListEntryCount++; }
+ size_t size() const { return maList.size(); }
+ void push_back( ExportListEntry* item ) { maList.push_back( item ); }
+
+ ExportListEntry* operator [] ( size_t i )
+ {
+ return ( i < maList.size() ) ? maList[ i ] : NULL;
+ }
};
#define REFID_NONE 0xFFFF
@@ -282,7 +285,7 @@ public:
#define MERGE_MODE_NORMAL 0x0000
#define MERGE_MODE_LIST 0x0001
-DECLARE_LIST( ResStack, ResData * )
+typedef ::std::vector< ResData* > ResStack;
// forwards
class WordTransformer;
class ParserQueue;
@@ -339,7 +342,6 @@ public:
static bool hasUTF8ByteOrderMarker( const ByteString &rString );
static void RemoveUTF8ByteOrderMarkerFromFile( const ByteString &rFilename );
static bool fileHasUTF8ByteOrderMarker( const ByteString &rString );
- static ByteString GetIsoLangByIndex( sal_uInt16 nIndex );
static void QuotHTML( ByteString &rString );
static bool CopyFile( const ByteString& source , const ByteString& dest );
@@ -452,6 +454,7 @@ public:
const ByteString &rTitle
)
{
+
sText[ nId ] = rText;
bTextFirst[ nId ] = true;
sQuickHelpText[ nId ] = rQuickHelpText;
@@ -511,7 +514,7 @@ class MergeDataFile
sal_Bool bErrorLog;
ByteString sErrorLog;
SvFileStream aErrLog;
- MergeDataHashMap aMap;
+ MergeDataHashMap aMap;
std::set<ByteString> aLanguageSet;
MergeData *GetMergeData( ResData *pResData , bool bCaseSensitve = false );
@@ -528,6 +531,7 @@ class MergeDataFile
MergeDataFile( const ByteString &rFileName, const ByteString& rFile , sal_Bool bErrLog, CharSet aCharSet, bool bCaseSensitive = false );
~MergeDataFile();
+
std::vector<ByteString> GetLanguages();
PFormEntrys *GetPFormEntrys( ResData *pResData );
@@ -576,3 +580,4 @@ private:
};
#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/inc/gsicheck.hxx b/l10ntools/inc/gsicheck.hxx
index 6779557a4bb6..971f85016fbd 100644
--- a/l10ntools/inc/gsicheck.hxx
+++ b/l10ntools/inc/gsicheck.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -29,6 +30,7 @@
#define _GSICHECK_HXX_
#include "tagtest.hxx"
+#include <vector>
//
// class GSILine
@@ -74,7 +76,7 @@ public:
void SetTitle( ByteString &aNew ) { aTitle = aNew; ReassembleLine(); }
ParserMessageList* GetMessageList() { return &aMessages; };
- sal_Bool HasMessages(){ return ( aMessages.Count() > 0 ); };
+ sal_Bool HasMessages(){ return ( aMessages.size() > 0 ); };
sal_Bool IsOK() const { return bOK; }
void NotOK();
@@ -87,13 +89,14 @@ public:
// class GSIBlock
//
-DECLARE_LIST( GSIBlock_Impl, GSILine * )
+typedef ::std::vector< GSILine* > GSIBlock_Impl;
class LazySvFileStream;
-class GSIBlock : public GSIBlock_Impl
+class GSIBlock
{
private:
+ GSIBlock_Impl maList;
GSILine *pSourceLine;
GSILine *pReferenceLine;
void PrintList( ParserMessageList *pList, ByteString aPrefix, GSILine *pLine );
@@ -126,3 +129,4 @@ public:
#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/inc/helpmerge.hxx b/l10ntools/inc/helpmerge.hxx
index cfa221bc6055..e2ec54daa637 100644
--- a/l10ntools/inc/helpmerge.hxx
+++ b/l10ntools/inc/helpmerge.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -82,3 +83,5 @@ private:
void ProcessHelp( LangHashMap* aLangHM , const ByteString& sCur , ResData *pResData , MergeDataFile& aMergeDataFile );
void MakeDir( const ByteString& sPath );
};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/inc/inireader.hxx b/l10ntools/inc/inireader.hxx
deleted file mode 100644
index 0861290adf9f..000000000000
--- a/l10ntools/inc/inireader.hxx
+++ /dev/null
@@ -1,52 +0,0 @@
-#include <string>
-#include <hash_map>
-#include <unicode/regex.h>
-
-using namespace std;
-
-namespace transex3
-{
-
-struct eqstr
-{
- bool operator()( const string s1 , const string s2) const
- {
- return s1.compare( s2 ) == 0;
- }
-};
-
-typedef std::hash_map< string , string > stringmap;
-typedef std::hash_map< string, stringmap* > INImap;
-
-class INIreader
-{
- private:
- UErrorCode section_status;
- UErrorCode parameter_status;
- RegexMatcher* section_match;
- RegexMatcher* parameter_match;
-
- public:
- INIreader(): section_status ( U_ZERO_ERROR ) ,
- parameter_status ( U_ZERO_ERROR )
- {
- section_match = new RegexMatcher ( "^\\s*\\[([a-zA-Z0-9]*)\\].*" , 0 , section_status );
- parameter_match = new RegexMatcher ( "^\\s*([a-zA-Z0-9]*)\\s*=\\s*([a-zA-Z0-9 ]*).*" , 0 , parameter_status ) ;
- }
- ~INIreader()
- {
- delete section_match;
- delete parameter_match;
- }
- // open "filename", fill hash_map with sections / paramaters
- bool read( INImap& myMap , string& filename );
-
- private:
- bool is_section( string& line , string& section_str );
- bool is_parameter( string& line , string& parameter_key , string& parameter_value );
- inline void check_status( UErrorCode status );
- inline void toStlString ( const UnicodeString& str, string& stl_str );
- inline void trim( string& str );
-};
-
-}
diff --git a/l10ntools/inc/l10ntools/directory.hxx b/l10ntools/inc/l10ntools/directory.hxx
index 6b71f59435f7..30ceb3f664fc 100644
--- a/l10ntools/inc/l10ntools/directory.hxx
+++ b/l10ntools/inc/l10ntools/directory.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#include <vector>
#include <algorithm>
#include <rtl/ustring.hxx>
@@ -52,3 +53,5 @@ class Directory
};
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/inc/l10ntools/file.hxx b/l10ntools/inc/l10ntools/file.hxx
index e3a1a46b4ee8..9b90c2766500 100644
--- a/l10ntools/inc/l10ntools/file.hxx
+++ b/l10ntools/inc/l10ntools/file.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#include "rtl/ustring.hxx"
namespace transex
@@ -21,3 +22,5 @@ class File
};
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/inc/l10ntools/vosapp.hxx b/l10ntools/inc/l10ntools/vosapp.hxx
index ccfe07006f76..e8e97fb71fef 100644
--- a/l10ntools/inc/l10ntools/vosapp.hxx
+++ b/l10ntools/inc/l10ntools/vosapp.hxx
@@ -1,10 +1,10 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#ifndef VOSAPP_HXX
#define VOSAPP_HXX
#include <sal/main.h>
#include <tools/solar.h>
#include <tools/string.hxx>
-#include <vos/process.hxx>
// Mininmal vcl/svapp compatibility without vcl dependence
class Application
@@ -18,16 +18,16 @@ public:
// Urg: Cut & Paste from svapp.cxx: we don't want to depend on vcl
sal_uInt16 Application::GetCommandLineParamCount()
{
- vos::OStartupInfo aStartInfo;
- return (sal_uInt16)aStartInfo.getCommandArgCount();
+ return osl_getCommandArgCount();
}
XubString Application::GetCommandLineParam( sal_uInt16 nParam )
{
- vos::OStartupInfo aStartInfo;
rtl::OUString aParam;
- aStartInfo.getCommandArg( nParam, aParam );
+ osl_getCommandArg( nParam, &aParam.pData );
return XubString( aParam );
}
#endif /* VOSAPP_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/inc/lngmerge.hxx b/l10ntools/inc/lngmerge.hxx
index dce939386539..8aaf98d3d782 100644
--- a/l10ntools/inc/lngmerge.hxx
+++ b/l10ntools/inc/lngmerge.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -26,8 +27,9 @@
************************************************************************/
// local includes
#include "export.hxx"
+#include <vector>
-DECLARE_LIST( LngLineList, ByteString * )
+typedef ::std::vector< ByteString* > LngLineList;
#define LNG_OK 0x0000
#define LNG_FILE_NOTFOUND 0x0001
@@ -64,3 +66,5 @@ public:
sal_Bool CreateSDF( const ByteString &rSDFFile, const ByteString &rPrj, const ByteString &rRoot );
sal_Bool Merge( const ByteString &rSDFFile, const ByteString &rDestinationFile , const ByteString &rPrj );
};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/inc/pch/precompiled_l10ntools.cxx b/l10ntools/inc/pch/precompiled_l10ntools.cxx
index 3ee4157f7bb3..227eec55ca55 100644
--- a/l10ntools/inc/pch/precompiled_l10ntools.cxx
+++ b/l10ntools/inc/pch/precompiled_l10ntools.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -27,3 +28,4 @@
#include "precompiled_l10ntools.hxx"
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/inc/pch/precompiled_l10ntools.hxx b/l10ntools/inc/pch/precompiled_l10ntools.hxx
index ea5d5ea28683..876028762f2e 100644
--- a/l10ntools/inc/pch/precompiled_l10ntools.hxx
+++ b/l10ntools/inc/pch/precompiled_l10ntools.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -30,3 +31,4 @@
#ifdef PRECOMPILED_HEADERS
#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/inc/srciter.hxx b/l10ntools/inc/srciter.hxx
index 91e2c20a768a..c859d2356c1a 100644
--- a/l10ntools/inc/srciter.hxx
+++ b/l10ntools/inc/srciter.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -56,3 +57,4 @@ public:
};
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/inc/tagtest.hxx b/l10ntools/inc/tagtest.hxx
index ef2a696d71d7..1a41f508533f 100644
--- a/l10ntools/inc/tagtest.hxx
+++ b/l10ntools/inc/tagtest.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -29,8 +30,8 @@
#define _TAGTEST_HXX_
#include <tools/string.hxx>
-#include <tools/list.hxx>
-#include <hash_map> /* std::hashmap*/
+#include <boost/unordered_map.hpp>
+#include <vector>
class GSILine;
@@ -39,11 +40,10 @@ typedef sal_uInt16 TokenId;
#define TOK_INVALIDPOS sal_uInt16( 0xFFFF )
class ParserMessage;
+typedef ::std::vector< ParserMessage* > Impl_ParserMessageList;
-DECLARE_LIST( Impl_ParserMessageList, ParserMessage* )
class ParserMessageList;
-
struct equalByteString{
bool operator()( const ByteString& rKey1, const ByteString& rKey2 ) const {
return rKey1.CompareTo( rKey2 )==COMPARE_EQUAL;
@@ -57,14 +57,11 @@ struct lessByteString{
struct hashByteString{
size_t operator()( const ByteString& rName ) const{
- std::hash< const char* > myHash;
- return myHash( rName.GetBuffer() );
+ return rtl_str_hashCode(rName.GetBuffer());
}
};
-
-
-typedef std::hash_map<ByteString , String , hashByteString,equalByteString>
+typedef boost::unordered_map<ByteString , String , hashByteString,equalByteString>
StringHashMap;
class TokenInfo
@@ -122,13 +119,21 @@ explicit TokenInfo( TokenId pnId, sal_uInt16 nP, String paStr, ParserMessageL
};
-class ParserMessageList : public Impl_ParserMessageList
+class ParserMessageList
{
+private:
+ Impl_ParserMessageList maList;
+
public:
+ ~ParserMessageList() { clear(); }
void AddError( sal_uInt16 nErrorNr, ByteString aErrorText, const TokenInfo &rTag );
void AddWarning( sal_uInt16 nErrorNr, ByteString aErrorText, const TokenInfo &rTag );
sal_Bool HasErrors();
+ bool empty() const { return maList.empty(); }
+ size_t size() const { return maList.size(); }
+ ParserMessage* operator [] ( size_t i ) { return ( i < maList.size() ) ? maList[ i ] : NULL; }
+ void clear();
};
@@ -216,62 +221,42 @@ public:
#define TAG_UNKNOWN_TAG ( TAG_GROUP_MULTI << TAG_GROUPSHIFT | 0x800 )
-DECLARE_LIST( TokenListImpl, TokenInfo* )
+typedef ::std::vector< TokenInfo* > TokenListImpl;
-class TokenList : private TokenListImpl
+class TokenList
{
private:
-
+ TokenListImpl maList;
TokenList& operator =( const TokenList& rList );
-// { TokenListImpl::operator =( rList ); return *this; }
-
public:
- using TokenListImpl::Count;
-
+ TokenList() {};
+ ~TokenList(){ clear(); };
- TokenList() : TokenListImpl(){};
- ~TokenList(){ Clear(); };
-
- void Clear()
+ size_t size() const { return maList.size(); }
+ void clear()
{
- for ( sal_uLong i = 0 ; i < Count() ; i++ )
- delete TokenListImpl::GetObject( i );
- TokenListImpl::Clear();
+ for ( size_t i = 0 ; i < maList.size() ; i++ )
+ delete maList[ i ];
+ maList.clear();
}
- void Insert( TokenInfo p, sal_uLong nIndex = LIST_APPEND )
- { TokenListImpl::Insert( new TokenInfo(p), nIndex ); }
-/* TokenInfo Remove( sal_uLong nIndex )
- {
- TokenInfo aT = GetObject( nIndex );
- delete TokenListImpl::GetObject( nIndex );
- TokenListImpl::Remove( nIndex );
- return aT;
- }*/
-// TokenInfo Remove( TokenInfo p ){ return Remove( GetPos( p ) ); }
-// TokenInfo GetCurObject() const { return *TokenListImpl::GetCurObject(); }
- TokenInfo& GetObject( sal_uLong nIndex ) const
+
+ void insert( TokenInfo p, size_t nIndex = size_t(-1) )
{
-// if ( TokenListImpl::GetObject(nIndex) )
- return *TokenListImpl::GetObject(nIndex);
-// else
-// return TokenInfo();
+ if ( nIndex < maList.size() ) {
+ TokenListImpl::iterator it = maList.begin();
+ ::std::advance( it, nIndex );
+ maList.insert( it, new TokenInfo(p) );
+ } else {
+ maList.push_back( new TokenInfo(p) );
+ }
}
-/* sal_uLong GetPos( const TokenInfo p ) const
+ TokenInfo& operator [] ( size_t nIndex ) const
{
- for ( sal_uLong i = 0 ; i < Count() ; i++ )
- if ( p == GetObject( i ) )
- return i;
- return LIST_ENTRY_NOTFOUND;
- }*/
+ return *maList[ nIndex ];
+ }
TokenList( const TokenList& rList );
-/* {
- for ( sal_uLong i = 0 ; i < rList.Count() ; i++ )
- {
- Insert( rList.GetObject( i ), LIST_APPEND );
- }
- }*/
};
class ParserMessage
@@ -362,8 +347,6 @@ class TokenParser
public:
TokenParser();
void Parse( const String &aCode, ParserMessageList* pList );
-// ParserMessageList& GetErrors(){ return aErrorList; }
-// sal_Bool HasErrors(){ return ( aErrorList.Count() > 0 ); }
TokenList& GetTokenList(){ return aParser.GetTokenList(); }
};
@@ -380,17 +363,12 @@ public:
void CheckReference( GSILine *aReference );
void CheckTestee( GSILine *aTestee, sal_Bool bHasSourceLine, sal_Bool bFixTags );
-// ParserMessageList& GetReferenceErrors(){ return aReferenceParser.GetErrors(); }
-// sal_Bool HasReferenceErrors(){ return aReferenceParser.HasErrors(); }
-
-// ParserMessageList& GetTesteeErrors(){ return aTesteeParser.GetErrors(); }
-// sal_Bool HasTesteeErrors(){ return aTesteeParser.HasErrors(); }
-
ParserMessageList& GetCompareWarnings(){ return aCompareWarningList; }
- sal_Bool HasCompareWarnings(){ return ( aCompareWarningList.Count() > 0 ); }
+ sal_Bool HasCompareWarnings(){ return ( !aCompareWarningList.empty() ); }
String GetFixedTestee(){ return aFixedTestee; }
};
#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/inc/tokens.h b/l10ntools/inc/tokens.h
index 12a06fa45ccf..b8c658ee0c14 100644
--- a/l10ntools/inc/tokens.h
+++ b/l10ntools/inc/tokens.h
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -107,3 +108,5 @@
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/inc/treeconfig.hxx b/l10ntools/inc/treeconfig.hxx
deleted file mode 100644
index 96d693b0d376..000000000000
--- a/l10ntools/inc/treeconfig.hxx
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <vector>
-#include <string>
-
-#include "inireader.hxx"
-
-namespace transex3{
-
-class Treeconfig
-{
-
- private:
- INIreader inireader;
- INImap map;
- bool has_config_file;
- void getCurrentDir( string& dir );
- bool isConfigFilePresent();
-
- public:
-
- Treeconfig() : has_config_file( false ) { parseConfig(); }
- // read the config file, returns true in case a config file had been found
- bool parseConfig();
- // returns a string vector containing all active repositories, returns true in case we are deep inside
- // of a source tree. This could affect the behavour of the tool
- bool getActiveRepositories( vector<string>& active_repos);
-};
-
-}
diff --git a/l10ntools/inc/utf8conv.hxx b/l10ntools/inc/utf8conv.hxx
deleted file mode 100644
index e4f8fbe4fd51..000000000000
--- a/l10ntools/inc/utf8conv.hxx
+++ /dev/null
@@ -1,44 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-// global includes
-#include <rtl/textcvt.h>
-#include <tools/string.hxx>
-
-//
-// class UTF8Converter
-//
-
-class UTF8Converter
-{
-private:
- static void Convert( ByteString &rBuffer, rtl_TextEncoding nSourceENC, rtl_TextEncoding nDestENC );
-
-public:
- static ByteString ConvertToUTF8( const ByteString &rASCII, rtl_TextEncoding nEncoding );
- static ByteString ConvertFromUTF8( const ByteString &rUTF8, rtl_TextEncoding nEncoding );
-};
diff --git a/l10ntools/inc/wtranode.hxx b/l10ntools/inc/wtranode.hxx
index 99afe462a9ab..b2c10e07d2d2 100644
--- a/l10ntools/inc/wtranode.hxx
+++ b/l10ntools/inc/wtranode.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -116,3 +117,4 @@ WTT_Node::ReplaceString() const
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/inc/wtratree.hxx b/l10ntools/inc/wtratree.hxx
index 5ed45d350348..c06be49b183c 100644
--- a/l10ntools/inc/wtratree.hxx
+++ b/l10ntools/inc/wtratree.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -157,3 +158,4 @@ WordTransTree::CalculateBranch(u_char i_cInputChar) const
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/inc/xmlparse.hxx b/l10ntools/inc/xmlparse.hxx
index 5be58ffb50a7..97e56df59253 100644
--- a/l10ntools/inc/xmlparse.hxx
+++ b/l10ntools/inc/xmlparse.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -33,7 +34,6 @@
#include <rtl/ustring.hxx>
#include <rtl/ustrbuf.hxx>
#include "tools/string.hxx"
-#include "tools/list.hxx"
#define ENABLE_BYTESTRING_STREAM_OPERATORS
#include "tools/stream.hxx"
#include "tools/isofallback.hxx"
@@ -50,7 +50,7 @@ class XMLElement;
using namespace ::rtl;
using namespace std;
-#include <hash_map> /* std::hashmap*/
+#include <boost/unordered_map.hpp>
#include <deque> /* std::deque*/
#include <iterator> /* std::iterator*/
#include <list> /* std::list*/
@@ -63,7 +63,6 @@ using namespace std;
#define MAX_LANGUAGES 99
-//#define TESTDRIVER /* use xml2gsi testclass */
//-------------------------------------------------------------------------
/** Holds data of Attributes
@@ -95,7 +94,7 @@ public:
}
};
-DECLARE_LIST( XMLAttributeList, XMLAttribute * )
+typedef ::std::vector< XMLAttribute* > XMLAttributeList;
//-------------------------------------------------------------------------
@@ -133,7 +132,7 @@ public:
virtual ~XMLChildNode(){};
};
-DECLARE_LIST( XMLChildNodeList, XMLChildNode * )
+typedef ::std::vector< XMLChildNode* > XMLChildNodeList;
//-------------------------------------------------------------------------
@@ -144,9 +143,9 @@ class XMLData;
class XMLParentNode : public XMLChildNode
{
private:
- XMLChildNodeList *pChildList;
+ XMLChildNodeList* pChildList;
static int dbgcnt;
- //int nParentPos;
+
protected:
XMLParentNode( XMLParentNode *pPar )
: XMLChildNode( pPar ), pChildList( NULL )
@@ -173,7 +172,7 @@ public:
);
void AddChild(
- XMLChildNode *pChild , int pos /// the new child
+ XMLChildNode *pChild , size_t pos /// the new child
);
virtual int GetPosition( ByteString id );
@@ -188,20 +187,18 @@ public:
//-------------------------------------------------------------------------
-DECLARE_LIST( XMLStringList, XMLElement* )
-
/// Mapping numeric Language code <-> XML Element
-typedef std::hash_map< ByteString ,XMLElement* , hashByteString,equalByteString > LangHashMap;
+typedef boost::unordered_map< ByteString ,XMLElement* , hashByteString,equalByteString > LangHashMap;
/// Mapping XML Element string identifier <-> Language Map
-typedef std::hash_map<ByteString , LangHashMap* ,
+typedef boost::unordered_map<ByteString , LangHashMap* ,
hashByteString,equalByteString> XMLHashMap;
/// Mapping iso alpha string code <-> iso numeric code
-typedef std::hash_map<ByteString, int, hashByteString,equalByteString> HashMap;
+typedef boost::unordered_map<ByteString, int, hashByteString,equalByteString> HashMap;
/// Mapping XML tag names <-> have localizable strings
-typedef std::hash_map<ByteString , sal_Bool ,
+typedef boost::unordered_map<ByteString , sal_Bool ,
hashByteString,equalByteString> TagMap;
/** Holds information of a XML file, is root node of tree
@@ -273,31 +270,9 @@ public:
/// UnQuot the XML characters and restore \n \t
static void UnQuotHTML ( String &rString );
-
- /// Return the numeric iso language code
- //sal_uInt16 GetLangByIsoLang( const ByteString &rIsoLang );
-
- /// Return the alpha strings representation
- ByteString GetIsoLangByIndex( sal_uInt16 nIndex );
-
- static XMLUtil& Instance();
- ~XMLUtil();
-
- void dump();
-
private:
- /// Mapping iso alpha string code <-> iso numeric code
- HashMap lMap;
-
- /// Mapping iso numeric code <-> iso alpha string code
- ByteString isoArray[MAX_LANGUAGES];
-
static void UnQuotData( String &rString );
static void UnQuotTags( String &rString );
-
- XMLUtil();
- XMLUtil(const XMLUtil&);
-
};
@@ -548,3 +523,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/inc/xmlutil.hxx b/l10ntools/inc/xmlutil.hxx
index 812f50b85c45..2c131a987edf 100644
--- a/l10ntools/inc/xmlutil.hxx
+++ b/l10ntools/inc/xmlutil.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#define ENGLISH_US 1
#define ENGLISH_US_ISO "en-US"
#define ENGLISH_US_PROPERTY "en_US"
@@ -7,3 +8,4 @@
#define GERMAN_DE_INDEX 3
#define GERMAN_ISO2 "de-DE"
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/inc/xrmmerge.hxx b/l10ntools/inc/xrmmerge.hxx
index 91981aa41619..f0b213a54ce3 100644
--- a/l10ntools/inc/xrmmerge.hxx
+++ b/l10ntools/inc/xrmmerge.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -156,3 +157,4 @@ public:
virtual ~XRMResMerge();
};
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/java/jpropex/build.xml b/l10ntools/java/jpropex/build.xml
deleted file mode 100755
index d74fb3975d0f..000000000000
--- a/l10ntools/java/jpropex/build.xml
+++ /dev/null
@@ -1,169 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- Copyright 2000, 2010 Oracle and/or its affiliates.
-
- OpenOffice.org - a multi-platform office productivity suite
-
- This file is part of OpenOffice.org.
-
- 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.
-
- 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).
-
- 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.
-
--->
-<project name="jpropex" default="main" basedir=".">
-
- <!-- ================================================================= -->
- <!-- settings -->
- <!-- ================================================================= -->
-
- <!-- name of this sub target used in recursive builds -->
- <property name="target" value="jpropex"/>
-
- <!-- name of jar file created, without .jar extension -->
- <property name="jarname" value="jpropex"/>
-
- <!-- relative path to project directory -->
- <property name="prj" value="."/>
-
- <!-- build output directory -->
- <property name="out" value="build"/>
-
- <!-- build directories -->
- <property name="build.dir" value="${out}"/>
- <property name="build.class" value="${build.dir}/class/jpropex"/>
- <property name="build.misc" value="${build.dir}/misc/jpropex"/>
-
- <!-- start of java source code package structure -->
- <property name="java.dir" value="java"/>
-
- <!-- define how to handle CLASSPATH environment -->
- <property name="build.sysclasspath" value="ignore"/>
-
- <!-- classpath settings for compile and javadoc tasks -->
- <path id="classpath">
- <pathelement location="."/>
- <pathelement location="${build.class}"/>
- </path>
-
- <!-- name to display in documentation -->
- <!-- <property name="docname" value="l10n converter"/> -->
-
- <!-- set "modern" java compiler -->
- <property name="build.compiler" value="modern"/>
-
- <!-- set wether we want to compile with debug information -->
- <property name="debug" value="on"/>
-
- <!-- set wether we want to compile with optimisation -->
- <property name="optimize" value="off"/>
-
- <!-- set wether we want to compile with or without deprecation -->
- <property name="deprecation" value="on"/>
-
- <target name="info">
- <echo message="--------------------"/>
- <echo message="${target}"/>
- <echo message="--------------------"/>
- </target>
-
- <!-- ================================================================= -->
- <!-- custom targets -->
- <!-- ================================================================= -->
-
- <!-- the main target, called in recursive builds -->
- <target name="main" depends="info,prepare,compile,jar"/>
-
- <!-- prepare output directories -->
- <target name="prepare">
- <mkdir dir="${build.dir}"/>
- <mkdir dir="${build.class}"/>
- <mkdir dir="${build.misc}"/>
- </target>
-
-
- <target name="res" depends="prepare">
- <copy todir="${build.class}">
- <fileset dir="${java.dir}">
- <include name="**/*.properties"/>
- <include name="**/*.css"/>
- <include name="**/*.dtd"/>
- <include name="**/*.form"/>
- <include name="**/*.gif "/>
- <include name="**/*.htm"/>
- <include name="**/*.html"/>
- <include name="**/*.js"/>
- <include name="**/*.mod"/>
- <include name="**/*.sql"/>
- <include name="**/*.xml"/>
- <include name="**/*.xsl"/>
- <include name="**/*.map"/>
-
- </fileset>
- </copy>
- </target>
-
-
- <target name="compile" depends="prepare,res">
- <javac destdir="${build.class}"
- debug="${debug}"
- deprecation="${deprication}"
- optimize="${optimize}"
- classpathref="classpath">
- <src path="${java.dir}"/>
- <include name="**/*.java"/>
- </javac>
- </target>
-
- <!-- clean up -->
- <target name="clean" depends="prepare">
- <delete includeEmptyDirs="true">
- <fileset dir="${build.class}">
- <patternset>
- <include name="${package}/**/*.class"/>
- </patternset>
- </fileset>
- </delete>
- </target>
-
- <!-- create jar file -->
- <target name="jar" depends="prepare,compile" if="build.class">
- <jar jarfile="${build.class}/${jarname}.jar"
- basedir="${build.class}"
- manifest="${jarname}.MF">
- <include name="**/*.class"/>
- <include name="**/*.properties"/>
- <include name="**/*.css"/>
- <include name="**/*.dtd"/>
- <include name="**/*.form"/>
- <include name="**/*.gif "/>
- <include name="**/*.htm"/>
- <include name="**/*.html"/>
- <include name="**/*.js"/>
- <include name="**/*.mod"/>
- <include name="**/*.sql"/>
- <include name="**/*.xml"/>
- <include name="**/*.xsl"/>
- <include name="**/*.map"/>
- </jar>
- </target>
-
- <target name="test" depends="prepare">
- </target>
-
-</project>
-
diff --git a/l10ntools/java/jpropex/java/JPropEx.java b/l10ntools/java/jpropex/java/JPropEx.java
deleted file mode 100644
index 9ff8bf96fe44..000000000000
--- a/l10ntools/java/jpropex/java/JPropEx.java
+++ /dev/null
@@ -1,509 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-
-import java.util.*;
-import java.io.*;
-
-public class JPropEx
-{
- private String inputFileArg = "";
- private String outputFileArg = "";
- private String pathPrefixArg = "";
- private String pathPostfixArg = "";
- private String projectArg = "";
- private String rootArg = "";
- private Vector forcedLangsArg;
- private Vector langsArg;
- private String inputSdfFileArg = "";
- private boolean isQuiet = false;
- private final String resourceType = "javaproperties";
- private final String sourceLanguage = "en-US";
-
- static final int JAVA_TYPE = 0;
- static final int JAVA_ENUS_TYPE = 1;
- static final int EXTENSION_TYPE = 2;
-
- public JPropEx()
- {
- //data = new SdfData();
- }
-
- public JPropEx( String args[] )
- {
- super();
- parseArguments( args );
- testCL();
- //testArguments();
- if( inputSdfFileArg != null && inputSdfFileArg.length() > 0 )
- merge();
- else
- extract();
- }
-
- private String getSimpleArg( String[] args , int x )
- {
- if( x < args.length ) x++;
- else
- {
- System.err.println("ERROR: Missing arg for "+args[ x ]+"\n");
- help();
- }
- return args[ x ];
- }
- private Vector getComplexArg( String[] args , int x )
- {
- if( x < args.length ) x++;
- else
- {
- System.err.println("ERROR: Missing arg for "+args[ x ]+"\n");
- help();
- }
- String value = args[ x ];
- Vector values = new Vector( Arrays.asList( value.split(",") ) );
- return values;
- }
-
- private void testCL()
- {
- if( inputFileArg.length()>0 && ( ( pathPrefixArg.length()>0 && pathPostfixArg.length()>0 ) || outputFileArg.length()>0 ) && projectArg.length()>0 && rootArg.length()>0 && langsArg.size()>0 )
- if( ( inputSdfFileArg.length()>0 && ( outputFileArg.length()>0 || ( pathPrefixArg.length()>0 && pathPostfixArg.length()>0 ) ) ) || ( inputFileArg.length()>0 && outputFileArg.length()>0 ) )
- return;
- System.out.println("ERROR: Strange parameters!");
- help();
- System.exit( -1 );
- }
- private void help()
- {
- System.out.println("jpropex -> extract / merge java properties files");
- System.out.println("-p <project> -r <project_root> -i <input>|@<input> -o <output> -x <path1> -y <path2> -m <sdf_file> -l <lang>\n");
- System.out.println("Example:\ncd /data/cws/l10ntooling17/DEV300/ooo/reportbuilder/java/com/sun/star/report/function/metadata");
- System.out.println("Extract:\njpropex -p reportbuilder -r ../../../../../../.. -i Title-Function.properties -o new.sdf -l en-US");
- System.out.println("Merge: use either ( -x path -y more_path ) or ( -o ) and ( -i filename ) or ( -i @filename ). @filename contains a list with files");
- System.out.println("jpropex -p reportbuilder -r ../../../../../../.. -x ../../../../../../../unxlngx6.pro/class/com/sun/star/report/function/metadata -y ivo -i @abc -l all -lf en-US,de,fr,pt -m ../../../../../../../common.pro/misc/reportbuilder/java/com/sun/star/report/function/metadata/localize.sdf");
- System.out.println("jpropex -p reportbuilder -r ../../../../../../.. -x ../../../../../../../unxlngx6.pro/class/com/sun/star/report/function/metadata -y ivo -i @abc -l all -lf en-US,de,fr,pt -m ../../../../../../../common.pro/misc/reportbuilder/java/com/sun/star/report/function/metadata/localize.sdf");
- System.out.println("jpropex -p reportbuilder -r ../../../../../../.. -o ../../../../../../../unxlngx6.pro/class/com/sun/star/report/function/metadata/ -i Title-Function.properties -l all -lf en-US,de,fr,pt -m ../../../../../../../common.pro/misc/reportbuilder/java/com/sun/star/report/function/metadata/localize.sdf");
- System.out.println("jpropex -p reportbuilder -r ../../../../../../.. -x ../../../../../../../unxlngx6.pro/class/com/sun/star/report/function/metadata -y ivooo -i Title-Function.properties -l all -lf en-US,de,fr,pt -m ../../../../../../../common.pro/misc/reportbuilder/java/com/sun/star/report/function/metadata/localize.sdf");
- System.exit( -1 );
- }
-
- private void extract()
- {
- SdfData data = new SdfData();
- java.util.Properties prop = loadProp( inputFileArg );
-
- // Get a prototype that already contains the most common settings
- SdfEntity dolly = prepareSdfObj( inputFileArg );
- String key;
- SdfEntity currentStr;
- String value;
- String str;
- for( Enumeration e = prop.propertyNames() ; e.hasMoreElements() ; )
- {
- key = (String) e.nextElement();
- currentStr = (SdfEntity) dolly.clone();
- // Set the new GID and the string text
- currentStr.setGid( key );
- value = prop.getProperty( key , "" );
- //if( value.equals("") ) System.err.println("Warning: in file "+inputFileArg+" the string with the key "+key+" has a empty string!");
- str = (prop.getProperty( key )).replaceAll("\t" , " " ); // remove tab
- str = str.replaceAll("\n"," "); // remove return
- currentStr.setText( str );
- if( str.length() > 0 )
- data.add( currentStr );
- }
- data.write( outputFileArg );
- }
-
- private SdfEntity prepareSdfObj( String filename )
- {
- String path = makeAbs( filename ).trim();
- String myRootArg = makeAbs( rootArg ).trim();
- myRootArg = myRootArg.replace( "\\","/");
- myRootArg += "/";
- path = path.replace("\\","/");
- path = path.replace( myRootArg, "" );
- path = path.replace("/","\\");
- // TODO: Make this static
- java.text.SimpleDateFormat dateformat = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- String date = dateformat.format( new Date() );
- return new SdfEntity( projectArg , path , "0" /* dummy1 */ , resourceType , "", "" , "" , "" , "0" /* dummy2 */ ,
- sourceLanguage , "", "" , "" , "" , date );
- }
-
- private void merge()
- {
- SdfData data = getSdfData();
- if( inputFileArg.startsWith("@") )
- {
- // Read files
- Vector fileList = readFileList( inputFileArg );
- for( Enumeration e = fileList.elements(); e.hasMoreElements(); )
- mergeFile( (String) e.nextElement() , data , false );
- }
- else
- {
- // Single file
- mergeFile( inputFileArg , data , true );
- }
- }
-
- private Vector readFileList( String filename )
- {
- Vector lines = new Vector();
- try
- {
- BufferedReader in = new BufferedReader( new FileReader( filename.substring( 1 ) ) );
- while( in.ready() )
- lines.add( in.readLine().trim() );
- }
- catch( IOException e )
- {
- System.out.println("ERROR: Can't open file '"+filename.substring( 1 )+"'");
- System.exit( -1 );
- }
- return lines;
- }
-
- private void mergeFile( String filename , SdfData data , boolean isSingleFile )
- {
- int type = detectFormat( filename );
- java.util.Properties sourceProp = loadProp( filename );
- Vector langs = getLanguages( data );
- HashMap props = new HashMap();
- // Create a properties object for every language
- for( Enumeration e = langs.elements(); e.hasMoreElements();)
- {
- props.put( (String)e.nextElement() , new java.util.Properties() );
- }
- // Get a prototype that already contains the most common settings
-
- SdfEntity dolly = prepareSdfObj( filename );
- String key;
- String sourceString;
- SdfEntity curStr;
- SdfEntity curEntity;
- SdfEntity mergedEntity;
- String curLang;
- for( Enumeration e = sourceProp.propertyNames() ; e.hasMoreElements() ; ) // For all property keys
- {
- key = (String) e.nextElement();
- sourceString = sourceProp.getProperty( key );
- curStr = (SdfEntity) dolly.clone();
- curStr.setGid( key );
- for( Enumeration lang = langs.elements(); lang.hasMoreElements(); ) // merge in every language
- {
- curEntity = (SdfEntity) curStr.clone();
- curLang = (String) lang.nextElement();
- curEntity.setLangid( curLang );
- mergedEntity = data.get( curEntity );
- if( mergedEntity == null )
- {
- // in case there is no translation then fallback to the en-US source string
- ( (java.util.Properties) props.get( curLang )).setProperty( curEntity.getGid() , sourceString );
- }
- else
- {
- // Set the merged text from the sdf file
- ( (java.util.Properties) props.get( curLang )).setProperty( mergedEntity.getGid() , mergedEntity.getText() ); // TODO: Quoting ???
- }
- }
-
- }
- // Now write them out
- String lang;
- for( Iterator i = props.keySet().iterator() ; i.hasNext() ; )
- {
- lang = (String) i.next();
- writeSinglePropertiesFile( filename , (java.util.Properties) props.get( lang ) , lang , isSingleFile , type );
- }
- }
- private void writeSinglePropertiesFile( String filename , java.util.Properties prop , String lang , boolean isSingleFile , int type )
- {
- // Prepare path to file
- int filenameIdx = filename.lastIndexOf( "/" ) > 0 ? filename.lastIndexOf( "/" )+1 : 0 ;
- String path = new String();
- String name = new String();
- String lcLang = lang.toLowerCase();
- // use of -x <path> -y <more_path>
- // -> <path>/<lang>/<more_path>
- if( pathPrefixArg != null && pathPrefixArg.length()>0 && pathPostfixArg != null && pathPostfixArg.length()>0 )
- {
- path = new StringBuffer().append( pathPrefixArg ).append( "/" ).append( lcLang ).append( "/" ).append( pathPostfixArg ).append( "/" ).toString();
- name += formatFilename( filename , filenameIdx , lang , type );
- }
- //use of -i <one_filename>
- else if( !isSingleFile && outputFileArg != null && outputFileArg.length()>0 )
- {
- //name = outputFileArg;
- path = outputFileArg;
- name += formatFilename( filename , filenameIdx , lang , type );
- }
- //use of -i @<file_containing_many_filenames>
- else if( isSingleFile && outputFileArg != null && outputFileArg.length()>0 )
- {
- //name = outputFileArg;
- path = outputFileArg;
- name += formatFilename( filename , filenameIdx , lang , type );
- }
- else
- {
- System.err.println("ERROR: No outputfile specified .. either -o or -x -y !");
- System.exit( -1 );
- }
-
- File dir = new File( path );
- try
- {
- if( !dir.exists() && path.length()>0 )
- {
- if( !dir.mkdirs() )
- {
- System.out.println("ERROR: Can't create directory '"+path+"' !!!");
- System.exit( -1 );
- }
- }
- }
- catch( SecurityException e )
- {
- System.out.println("ERROR: Can't create directory '"+path+"'!!!Wrong Permissions?");
- System.exit( -1 );
- }
- path += name;
- // Write the properties file
- //System.out.println("DBG: Writing to "+path);
- try{
- BufferedOutputStream out = new BufferedOutputStream( new FileOutputStream( path ) );
- if( prop == null )
- System.out.println("DBG: prop == null!!!");
- prop.store( out , "" ); // Legal headers?
- }
- catch( IOException e )
- {
- System.out.println("ERROR: Can't write file '"+path+"' !!!!");
- System.exit( -1 );
- }
- }
-
- // we have different types of properties in the source code
- // each needs a different file nameing scheme
- private int detectFormat( String filename )
- {
- if( filename.endsWith( "_en_US.properties" ) )
- return EXTENSION_TYPE;
- else if( filename.endsWith("_en_us.properties" ) )
- return JAVA_ENUS_TYPE;
- else if( filename.endsWith( ".properties" ) )
- return JAVA_TYPE;
-
- // Can not detect, exit
- System.err.println("ERROR: Invalid file name. Only allowed (case sensitive!) *_en_US.properties , *_en_us.properties or *.properties\n");
- System.exit(-1);
- return JAVA_TYPE; // dummy
- }
-
- private String formatFilename( String filename , int filenameIdx , String lang , int type )
- {
-
- if( !lang.equals( "en-US" ) )
- {
- // Parse iso code
- int pos = lang.indexOf("-");
- String langpart1 = new String();
- String langpart2 = new String();
- if( pos == -1 )
- {
- langpart1 = lang;
- }
- else if( pos > 0 )
- {
- langpart1 = lang.substring( 0 , pos );
- langpart2 = lang.substring( pos+1 , lang.length() );
- }
- // change filename according to the type
- switch( type )
- {
- // -> de_DE
- case EXTENSION_TYPE:
- lang = langpart1.toLowerCase();
- if( langpart2.length() > 0 ) // -> en_US
- lang += "_" + langpart2.toUpperCase();
- else // -> de_DE
- lang += "_" + langpart1.toUpperCase();
- return new StringBuffer().append( filename.substring( filenameIdx , filename.lastIndexOf( "_en_US.properties" ) ) )
- .append( "_" ).append( lang.replaceAll("-","_") ).append( ".properties" ).toString();
- // -> de
- case JAVA_ENUS_TYPE:
- lang = langpart1.toLowerCase();
- if( langpart2.length() > 0 )
- lang += "_" + langpart2.toLowerCase();
- return new StringBuffer().append( filename.substring( filenameIdx , filename.lastIndexOf( "_en_us.properties" ) ) )
- .append( "_" ).append( lang.replaceAll("-","_") ).append( ".properties" ).toString();
- // -> de
- case JAVA_TYPE:
- lang = langpart1.toLowerCase();
- if( langpart2.length() > 0 )
- lang += "_" + langpart2.toLowerCase();
- return new StringBuffer().append( filename.substring( filenameIdx , filename.lastIndexOf( ".properties" ) ) )
- .append( "_" ).append( lang.replaceAll("-","_") ).append( ".properties" ).toString();
- default:
- System.err.println("ERROR: Something is really broken here, l10ntools/java/jprop/java/JPropEx.java :: formatFilename()");
- System.exit( -1 );
- break;
- }
- }
- return filename; // don't change en-US source file name
- }
- private SdfData getSdfData()
- {
- SdfData data = new SdfData( inputSdfFileArg );
- data.read();
- return data;
- }
- private Vector getLanguages( SdfData data )
- {
- Vector langs = new Vector();
-
- if( ((String)langsArg.get( 0 )).equalsIgnoreCase( "all" ) ) // for "-l all" use all languages found in the -m sdf file
- langs.addAll( data.getLanguages() );
- else
- langs.addAll( langsArg ); // use the langs giving by -l
-
- if( forcedLangsArg != null )
- langs.addAll( forcedLangsArg );
-
- return removeDupes( langs );
- }
- private Vector removeDupes( Vector vec )
- {
- Collection coll = new LinkedHashSet( vec );
- return new Vector( coll );
- }
- private java.util.Properties loadProp( String filename )
- {
- java.util.Properties prop = new java.util.Properties();
- try
- {
- prop.load( new BufferedInputStream( new NoLocalizeFilter( new FileInputStream( filename ) ) ) );
- }
- catch( IOException e )
- {
- System.err.println("ERROR: Can't read file '"+filename+"'!!!");
- }
- return prop;
- }
- private void parseArguments( String[] args )
- {
-
- if( args.length == 0 )
- {
- System.out.println("ERROR: No args???");
- help();
- System.exit( -1 );
- }
- for( int x = 0; x < args.length ; x++ )
- {
- if( args[ x ].equalsIgnoreCase("-i") )
- {
- // Input resource file
- inputFileArg = getSimpleArg( args , x );
- }
- else if( args[ x ].equalsIgnoreCase("-o") )
- {
- // Output sdf file
- outputFileArg = getSimpleArg( args , x );
- }
- else if( args[ x ].equalsIgnoreCase("-x") )
- {
- // path prefix
- pathPrefixArg = getSimpleArg( args , x );
- }
- else if( args[ x ].equalsIgnoreCase("-y") )
- {
- // path postfix
- pathPostfixArg = getSimpleArg( args , x );
- }
- else if( args[ x ].equalsIgnoreCase("-p") )
- {
- // project
- projectArg = getSimpleArg( args , x );
- }
- else if( args[ x ].equalsIgnoreCase("-r") )
- {
- // root
- rootArg = getSimpleArg( args , x );
- rootArg = makeAbs( rootArg );
- }
- else if( args[ x ].equalsIgnoreCase("-lf") )
- {
- // forced langs
- forcedLangsArg = getComplexArg( args , x );
- }
- else if( args[ x ].equalsIgnoreCase("-l") )
- {
- // langs
- langsArg = getComplexArg( args , x );
- }
- else if( args[ x ].equalsIgnoreCase("-m") )
- {
- // input sdf file
- inputSdfFileArg = getSimpleArg( args , x );
- }
- else if( args[ x ].equalsIgnoreCase("-qq") )
- {
- isQuiet = true;
- }
- }
- }
- private String makeAbs( String path )
- {
- File file;
- try
- {
- file = new File( path );
- return file.getCanonicalPath();
- }catch( IOException e )
- {
- e.printStackTrace();
- System.exit( -1 );
- }
- return null;
- }
-/* private boolean testArguments()
- {
- // nice merge
- if( inputSdfFileArg != null && inputSdfFileArg.length()>0 )
- // nice merge
- return projectArg != null && rootArg != null && inputFileArg != null && pathPrefixArg != null && pathPostfixArg != null && langsArg != null &&
- projectArg.length()>0 && rootArg.length()>0 && inputFileArg.length()>0 && pathPrefixArg.length()>0 && pathPostfixArg.length()>0 && langsArg.size()>0 ;
- else
- // nice extract
- return projectArg != null && rootArg != null && inputFileArg != null && outputFileArg != null && langsArg != null &&
- projectArg.length()>0 && rootArg.length()>0 && inputFileArg.length()>0 && outputFileArg.length()>0 && langsArg.size()>0;
- }
-*/
-}
diff --git a/l10ntools/java/jpropex/java/Main.java b/l10ntools/java/jpropex/java/Main.java
deleted file mode 100644
index 23dc477ddec3..000000000000
--- a/l10ntools/java/jpropex/java/Main.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-
-class Main
-{
-
- public static void main( String args[] )
- {
- JPropEx jpropex = new JPropEx( args );
- //jpropex.init();
- }
-}
-
diff --git a/l10ntools/java/jpropex/java/NoLocalizeFilter.java b/l10ntools/java/jpropex/java/NoLocalizeFilter.java
deleted file mode 100644
index 989ee64bfc86..000000000000
--- a/l10ntools/java/jpropex/java/NoLocalizeFilter.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-
-import java.io.*;
-import java.util.regex.*;
-
-// exit if the sequence x-no-localize is found in stream!
-public class NoLocalizeFilter extends FilterInputStream
-{
- InputStream in;
- Pattern p = Pattern.compile("#[\\s]*x-no-translate");
-
- public NoLocalizeFilter( InputStream in ) {
- super(in);
- this.in = in;
- }
- public int read(byte[] b, int off, int len) throws IOException
- {
- String search = new String( b );
- Matcher m = p.matcher( search );
- if( m.find() )
- {
- in.close();
- close();
- System.exit( 0 );
- }
- return in.read( b , off , len );
- }
-}
diff --git a/l10ntools/java/jpropex/java/OrderedHashMap.java b/l10ntools/java/jpropex/java/OrderedHashMap.java
deleted file mode 100644
index a462d598b307..000000000000
--- a/l10ntools/java/jpropex/java/OrderedHashMap.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-
-import java.util.*;
-
-// LinkedHashMap implrementation
-public class OrderedHashMap
-{
- private HashMap hm = new HashMap();
- private LinkedList list = new LinkedList();
-
- public Iterator iterator() { return list.iterator(); }
-
- public boolean isEmpty() { return hm.isEmpty(); }
- public Object get( Object key ) { return hm.get( key ); }
- public Object get( int index ) { return hm.get( list.get( index ) ); }
- public Iterator keys() { return list.iterator(); }
- public Object add( Object key , Object value )
- {
- list.add( key );
- return hm.put( key, value );
- }
- public Object add( int index , Object key , Object value )
- {
- list.add( index , key );
- return hm.put( key, value );
- }
- public Object remove( Object key )
- {
- list.remove( list.indexOf( key ) );
- return hm.remove( key );
- }
- public void move( int idxFrom , int idxTo )
- {
- Object key = list.get( idxFrom );
- list.remove( idxFrom );
- list.add( idxTo , key );
- }
- public void move( Object key , int idxTo )
- {
- move( list.indexOf( key ) , idxTo );
- }
- public int size()
- {
- return hm.size();
- }
- public Enumeration elements()
- {
- return new OHMenum( this );
- }
-}
-
-final class OHMenum implements Enumeration
-{
- OrderedHashMap ohm;
- int index = 0;
-
- private OHMenum(){};
- public OHMenum( OrderedHashMap ohm ){
- this.ohm = ohm ;
- }
-
- public boolean hasMoreElements()
- {
- return index < ohm.size();
- }
- public Object nextElement()
- {
- return ohm.get( index++ );
- }
-}
diff --git a/l10ntools/java/jpropex/java/SdfData.java b/l10ntools/java/jpropex/java/SdfData.java
deleted file mode 100644
index 98eddbeca20f..000000000000
--- a/l10ntools/java/jpropex/java/SdfData.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-
-import java.util.*;
-import java.io.*;
-
-public class SdfData
-{
- private String filename;
- private OrderedHashMap ohm;
- private LinkedHashSet languagesFound;
-
- public SdfData()
- {
- languagesFound = new LinkedHashSet();
- ohm = new OrderedHashMap();
- languagesFound = new LinkedHashSet();
- }
- public SdfData( String filename )
- {
- this();
- this.filename = filename;
- }
-
- public LinkedHashSet getLanguages()
- {
- return languagesFound;
- }
- public SdfEntity get( SdfEntity obj )
- {
- return (SdfEntity) ohm.get( (String)obj.getId() );
- }
- public SdfEntity get( String key ){
- return (SdfEntity) ohm.get( key );
- }
- public void add( SdfEntity obj )
- {
- ohm.add( obj.getId() , obj );
- }
-
- public void read()
- {
- BufferedReader in;
- try
- {
- in = new BufferedReader( new InputStreamReader( new FileInputStream( filename ), "UTF-8" ) );
- SdfEntity entity;
- while( in.ready() )
- {
- String line = in.readLine();
- if( line.length() > 0 )
- {
- entity = new SdfEntity( line );
- ohm.add( entity.getId() , entity ); // test if is valid
- languagesFound.add( entity.getLangid() );
- }
- }
- in.close();
- }
- catch( IOException e )
- {
- System.out.println("Warning: can not read file " + filename);
- }
- }
- public void write( String filename )
- {
- FileWriter out;
- try
- {
- out = new FileWriter( filename , true ); // Always append
- for( Enumeration e = ohm.elements(); e.hasMoreElements(); )
- {
- out.write( ( (SdfEntity) e.nextElement() ).toString() + "\n" );
- }
- out.close();
- }
- catch( IOException e )
- {
- System.out.println("Error: Can't write to file " + filename);
- System.exit( -1 );
- }
- }
-}
diff --git a/l10ntools/java/jpropex/java/SdfEntity.java b/l10ntools/java/jpropex/java/SdfEntity.java
deleted file mode 100644
index 7723238815e7..000000000000
--- a/l10ntools/java/jpropex/java/SdfEntity.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-
-public class SdfEntity implements Cloneable{
- private String project = new String("");
- private String source_file = new String("");
- private String dummy1 = new String("");
- private String resource_type= new String("");
- private String gid = new String("");
- private String lid = new String("");
- private String helpid = new String("");
- private String platform = new String("");
- private String dummy2 = new String("");
- private String langid = new String("");
- private String text = new String("");
- private String helptext = new String("");
- private String quickhelptext= new String("");
- private String title = new String("");
- private String date = new String("");
-
- public static int PROJECT_POS = 0;
- public static int SOURCE_FILE_POS = 1;
- public static int DUMMY1_POS = 2;
- public static int RESOURCE_TYPE_POS = 3;
- public static int GID_POS = 4;
- public static int LID_POS = 5;
- public static int HELPID_POS = 6;
- public static int PLATFORM_POS = 7;
- public static int DUMMY2_POS = 8;
- public static int LANGID_POS = 9;
- public static int TEXT_POS = 10;
- public static int HELPTEXT_POS = 11;
- public static int QUICKHELPTEXT_POS = 12;
- public static int TITLE_POS = 13;
- public static int DATE_POS = 14;
-
- public Object clone()
- {
- try
- {
- return super.clone();
- }
- catch( CloneNotSupportedException e )
- {
- System.out.println("ERROR: Can not clone, something is broken here ....");
- System.exit( -1 );
- }
- return null; // dummy
- }
-
- public SdfEntity( String line ){
- // isValid?
- setProperties( line ) ;
- }
- public SdfEntity(String project, String source_file, String dummy1, String resource_type, String gid, String lid, String helpid, String platform, String dummy2, String langid, String text, String helptext, String quickhelptext, String title , String date) {
- super();
- this.project = project;
- this.source_file = source_file;
- this.dummy1 = dummy1;
- this.resource_type = resource_type;
- this.gid = gid;
- this.lid = lid;
- this.helpid = helpid;
- this.platform = platform;
- this.dummy2 = dummy2;
- this.langid = langid;
- this.text = text;
- this.helptext = helptext;
- this.quickhelptext = quickhelptext;
- this.title = title;
- this.date = date;
- }
-
- public void setProperties( String line ){
- if( line != null )
- {
- String[] splitted = line.split("\t",15);
- setProject( splitted[ SdfEntity.PROJECT_POS ] );
- setSource_file( splitted[ SdfEntity.SOURCE_FILE_POS ] );
- setDummy1( splitted[ SdfEntity.DUMMY1_POS ] );
- setResource_type( splitted[ SdfEntity.RESOURCE_TYPE_POS ] );
- setGid( splitted[ SdfEntity.GID_POS ] );
- setLid( splitted[ SdfEntity.LID_POS ] );
- setHelpid( splitted[ SdfEntity.HELPID_POS ] );
- setPlatform( splitted[ SdfEntity.PLATFORM_POS ] );
- setDummy2( splitted[ SdfEntity.DUMMY2_POS ] );
- setLangid( splitted[ SdfEntity.LANGID_POS ] );
- setText( splitted[ SdfEntity.TEXT_POS ] );
- setHelptext( splitted[ SdfEntity.HELPTEXT_POS ] );
- setQuickhelptext( splitted[ SdfEntity.QUICKHELPTEXT_POS ] );
- setTitle( splitted[ SdfEntity.TITLE_POS ] );
- setDate( splitted[ SdfEntity.DATE_POS ] );
- }
- }
-
- public String getFileId(){
- return project+"\\"+source_file;
- }
- public String getResourcePath(){
- return source_file.substring(0 , source_file.lastIndexOf( "\\" )-1 );
- }
- public String toString(){
- return new StringBuffer( project ).append( "\t" ).append( source_file ).append( "\t" ).append( dummy1 ).append( "\t" ).append( resource_type ).append( "\t" ).append( gid ).append( "\t" )
- .append( lid ).append( "\t" ).append( helpid ).append( "\t" ).append( platform ).append( "\t" ).append( dummy2 ).append( "\t" ).append( langid ).append( "\t" )
- .append( text ).append( "\t" ).append( helptext ).append( "\t" ).append( quickhelptext ).append( "\t" ).append( title ).append( "\t" ).append( date ).toString();
- }
- public String getId(){
- return new StringBuffer( project ).append( gid ).append( lid ).append( source_file ).append( resource_type ).append( platform ).append( helpid ).append( langid ).toString();
- }
-
- public String getDummy1() {
- return dummy1;
- }
-
- public void setDummy1(String dummy1) {
- this.dummy1 = dummy1;
- }
-
- public String getPlatform() {
- return platform;
- }
-
- public void setPlatform(String platform) {
- this.platform = platform;
- }
-
- public String getDummy2() {
- return dummy2;
- }
-
- public void setDummy2(String dummy2) {
- this.dummy2 = dummy2;
- }
-
- public String getGid() {
- return gid;
- }
-
- public void setGid(String gid) {
- this.gid = gid;
- }
-
- public String getHelpid() {
- return helpid;
- }
-
- public void setHelpid(String helpid) {
- this.helpid = helpid;
- }
-
- public String getHelptext() {
- return helptext;
- }
-
- public void setHelptext(String helptext) {
- this.helptext = helptext;
- }
-
- public String getLangid() {
- return langid;
- }
-
- public void setLangid(String langid) {
- this.langid = langid;
- }
-
- public String getLid() {
- return lid;
- }
-
- public void setLid(String lid) {
- this.lid = lid;
- }
-
- public String getProject() {
- return project;
- }
-
- public void setProject(String project) {
- this.project = project;
- }
-
- public String getQuickhelptext() {
- return quickhelptext;
- }
-
- public void setQuickhelptext(String quickhelptext) {
- this.quickhelptext = quickhelptext;
- }
-
- public String getResource_type() {
- return resource_type;
- }
-
- public void setResource_type(String resource_type) {
- this.resource_type = resource_type;
- }
-
- public String getSource_file() {
- return source_file;
- }
-
- public void setSource_file(String source_file) {
- this.source_file = source_file;
- }
-
- public String getText() {
- return text;
- }
-
- public void setText(String text) {
- this.text = text;
- }
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
- public String getDate() {
- return date;
- }
- public void setDate(String date) {
- this.date = date;
- }
-
-
-}
diff --git a/l10ntools/java/jpropex/jpropex b/l10ntools/java/jpropex/jpropex
deleted file mode 100755
index 8c9982f2b1d3..000000000000
--- a/l10ntools/java/jpropex/jpropex
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-if [ x${SOLARENV}x = xx ]; then
- echo No environment found, please use 'configure' or 'setsolar'
- exit 1
-fi
-
-if [ x${JAVA_HOME}x = xx ]; then
- echo ERROR: No java found
- exit 1
-fi
-
-exec java -DSOLARSRC=${SOLARSRC} -DWORK_STAMP=${WORK_STAMP} -DUSE_SHELL= -jar ${SOLARVER}/${INPATH}/bin${UPDMINOREXT}/jpropex.jar "$@"
diff --git a/l10ntools/java/jpropex/jpropex.MF b/l10ntools/java/jpropex/jpropex.MF
deleted file mode 100755
index 3e22e7e9bfbf..000000000000
--- a/l10ntools/java/jpropex/jpropex.MF
+++ /dev/null
@@ -1 +0,0 @@
-Main-Class: Main
diff --git a/l10ntools/java/jpropex/makefile.mk b/l10ntools/java/jpropex/makefile.mk
deleted file mode 100755
index f86d2c830025..000000000000
--- a/l10ntools/java/jpropex/makefile.mk
+++ /dev/null
@@ -1,36 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# 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.
-#
-# 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).
-#
-# 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.
-#
-#*************************************************************************
-
-
-PRJ=../..
-PRJNAME=transex3
-TARGET=jpropex
-
-.INCLUDE : ant.mk
-
-ALLTAR : ANTBUILD
-
diff --git a/l10ntools/java/l10nconv/build.xml b/l10ntools/java/l10nconv/build.xml
deleted file mode 100755
index 7103ff05d58f..000000000000
--- a/l10ntools/java/l10nconv/build.xml
+++ /dev/null
@@ -1,229 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- Copyright 2000, 2010 Oracle and/or its affiliates.
-
- OpenOffice.org - a multi-platform office productivity suite
-
- This file is part of OpenOffice.org.
-
- 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.
-
- 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).
-
- 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.
-
--->
-<project name="l10nconv" default="main" basedir=".">
-
- <!-- ================================================================= -->
- <!-- settings -->
- <!-- ================================================================= -->
-
- <!-- name of this sub target used in recursive builds -->
- <property name="target" value="l10nconv"/>
-
- <!-- name of jar file created, without .jar extension -->
- <property name="jarname" value="converter"/>
-
- <!-- relative path to project directory -->
- <property name="prj" value="."/>
-
- <!-- build output directory -->
- <property name="out" value="build"/>
-
- <!-- build directories -->
- <property name="build.dir" value="${out}"/>
- <property name="build.class" value="${build.dir}/class/converter"/>
- <property name="build.misc" value="${build.dir}/misc/converter"/>
-
- <!-- start of java source code package structure -->
- <property name="java.dir" value="java"/>
-
- <!-- define how to handle CLASSPATH environment -->
- <property name="build.sysclasspath" value="ignore"/>
-
- <!-- classpath settings for compile and javadoc tasks -->
- <path id="classpath">
- <pathelement location="."/>
- <pathelement location="${build.class}"/>
- </path>
-
- <!-- name to display in documentation -->
- <property name="docname" value="l10n converter"/>
-
- <!-- set "modern" java compiler -->
- <property name="build.compiler" value="modern"/>
-
- <!-- set wether we want to compile with debug information -->
- <property name="debug" value="on"/>
-
- <!-- set wether we want to compile with optimisation -->
- <property name="optimize" value="off"/>
-
- <!-- set wether we want to compile with or without deprecation -->
- <property name="deprecation" value="on"/>
-
- <target name="info">
- <echo message="--------------------"/>
- <echo message="${target}"/>
- <echo message="--------------------"/>
- </target>
-
- <!-- ================================================================= -->
- <!-- custom targets -->
- <!-- ================================================================= -->
-
- <!-- the main target, called in recursive builds -->
- <target name="main" depends="info,prepare,compile,jar,javadoc,zipdoc"/>
-
- <!-- prepare output directories -->
- <target name="prepare">
- <mkdir dir="${build.dir}"/>
- <mkdir dir="${build.dir}/doc"/>
- <mkdir dir="${build.dir}/doc/javadoc"/>
- <mkdir dir="${build.class}"/>
- <mkdir dir="${build.misc}"/>
- </target>
-
-
- <target name="res" depends="prepare">
- <copy todir="${build.class}">
- <fileset dir="${java.dir}">
- <include name="**/*.properties"/>
- <include name="**/*.css"/>
- <include name="**/*.dtd"/>
- <include name="**/*.form"/>
- <include name="**/*.gif "/>
- <include name="**/*.htm"/>
- <include name="**/*.html"/>
- <include name="**/*.js"/>
- <include name="**/*.mod"/>
- <include name="**/*.sql"/>
- <include name="**/*.xml"/>
- <include name="**/*.xsl"/>
- <include name="**/*.map"/>
-
- </fileset>
- </copy>
- </target>
-
-
- <target name="compile" depends="prepare,res">
- <javac destdir="${build.class}"
- debug="${debug}"
- deprecation="${deprication}"
- optimize="${optimize}"
- classpathref="classpath">
- <src path="${java.dir}"/>
- <include name="**/*.java"/>
- </javac>
- </target>
-
- <!-- check if javadoc is up to date -->
- <target name="javadoc_check" depends="prepare" if="build.dir">
- <uptodate property="javadocBuild.notRequired" value="true"
- targetfile="${build.dir}/doc/converter_javadoc.zip">
- <srcfiles dir="${java.dir}" includes="**/*.java"/>
- </uptodate>
- </target>
-
- <!-- generate java documentation -->
- <target name="javadoc" depends="prepare,javadoc_check,compile"
- unless="javadocBuild.notRequired"
- if="build.dir">
-
- <javadoc destdir="${build.dir}/doc/javadoc"
- verbose="false"
- author="false"
- nodeprecated="true"
- nodeprecatedlist="true"
- use="true"
- Doctitle="${docname}"
- windowtitle="${docname}"
- classpathref="classpath">
-
- <packageset dir="${java.dir}" defaultexcludes="yes">
- <include name="com/**"/>
- </packageset>
-
- <link offline="true" href="http://java.sun.com/j2se/1.4.2/docs/api"
- packagelistLoc="${common.doc}/jdk1.4.2"/>
- <link offline="true"
- href="http://java.sun.com/products/servlet/2.3/javadoc"
- packagelistLoc="${common.doc}/servlet2.3"/>
- <link offline="true"
- href="http://logging.apache.org/log4j/docs/api"
- packagelistLoc="${common.doc}/log4j-1.2.8"/>
- <link offline="true"
- href="http://java.sun.com/products/javabeans/glasgow/javadocs"
- packagelistLoc="${common.doc}/jaf-1.0.2"/>
- <link offline="true"
- href="http://java.sun.com/products/javamail/javadocs"
- packagelistLoc="${common.doc}/javamail-1.3.1"/>
- <link offline="true"
- href="http://ws.apache.org/soap/docs"
- packagelistLoc="${common.doc}/soap-2.3.1"/>
-
- <bottom>&lt;i&gt;Copyright &amp;#169; 2004 Sun Microsystems, Inc., 901 San Antonio Road, Palo Alto, CA 94303 USA&lt;/i&gt;</bottom>
- <header>${docname}</header>
-
- </javadoc>
- </target>
-
- <!-- zip documentation and store in build/misc -->
- <target name="zipdoc" depends="javadoc" if="build.dir" unless="javadocBuild.notRequired">
- <zip zipfile="${build.dir}/doc/converter_javadoc.zip"
- basedir="${build.dir}/doc/javadoc"
- update="true"/>
- </target>
-
- <!-- clean up -->
- <target name="clean" depends="prepare">
- <delete includeEmptyDirs="true">
- <fileset dir="${build.class}">
- <patternset>
- <include name="${package}/**/*.class"/>
- </patternset>
- </fileset>
- </delete>
- </target>
-
- <!-- create jar file -->
- <target name="jar" depends="prepare,compile" if="build.class">
- <jar jarfile="${build.class}/${jarname}.jar"
- basedir="${build.class}"
- manifest="${jarname}.MF">
- <include name="**/*.class"/>
- <include name="**/*.properties"/>
- <include name="**/*.css"/>
- <include name="**/*.dtd"/>
- <include name="**/*.form"/>
- <include name="**/*.gif "/>
- <include name="**/*.htm"/>
- <include name="**/*.html"/>
- <include name="**/*.js"/>
- <include name="**/*.mod"/>
- <include name="**/*.sql"/>
- <include name="**/*.xml"/>
- <include name="**/*.xsl"/>
- <include name="**/*.map"/>
- </jar>
- </target>
-
- <target name="test" depends="prepare">
- </target>
-
-</project>
-
diff --git a/l10ntools/java/l10nconv/converter.MF b/l10ntools/java/l10nconv/converter.MF
deleted file mode 100755
index 843d500b7548..000000000000
--- a/l10ntools/java/l10nconv/converter.MF
+++ /dev/null
@@ -1 +0,0 @@
-Main-Class: com.sun.star.tooling.converter.Convert
diff --git a/l10ntools/java/l10nconv/documentation/readmeConverter.sxw b/l10ntools/java/l10nconv/documentation/readmeConverter.sxw
deleted file mode 100755
index f779e10acb2c..000000000000
--- a/l10ntools/java/l10nconv/documentation/readmeConverter.sxw
+++ /dev/null
Binary files differ
diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/DirtyTagWrapCheck.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/DirtyTagWrapCheck.java
deleted file mode 100755
index 7338e8d6a669..000000000000
--- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/DirtyTagWrapCheck.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-/*
- * Created on 2005
- * by Christian Schmidt
- */
-package com.sun.star.tooling.DirtyTags;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-
-
-
-public class DirtyTagWrapCheck {
- static String line="";
- public static void main(String[] args) {
- try {
- File fi = new File("D:\\Testfiles\\KID_helpcontent.sdf");//Copy of
- FileReader fr = new FileReader(fi);
- BufferedReader br = new BufferedReader(fr);
-
- int readCounter=0;
- int missCounter=0;
- int lineErrorCounter=0;
- while((line=br.readLine())!=null){
- readCounter++;
- String [] split = line.split("\t");
- if(split.length<15){
-
- lineErrorCounter++;
- continue;
- }
- String string = split[10];
- String wrapped = DirtyTagWrapper.wrapString(string);
- String unwrapped=DirtyTagWrapper.unwrapString(wrapped);
- if(!string.equals(unwrapped)){
-
- missCounter++;
- System.out.println(""+readCounter+"\n"+string+"\n"+unwrapped+"\n"+wrapped+"\n");
- }
- }
- System.out.println("Fertig "+readCounter+" "+missCounter+" "+lineErrorCounter);
- } catch (FileNotFoundException e) {
- //
- e.printStackTrace();
- } catch (IOException e) {
- //
- e.printStackTrace();
- } catch (DirtyTagWrapper.TagWrapperException e) {
- System.out.println(e.getMessage()+"\n"+line+"\n");
-
- }
-
- }
-}
diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/DirtyTagWrapper.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/DirtyTagWrapper.java
deleted file mode 100755
index 6b76b75b75d6..000000000000
--- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/DirtyTagWrapper.java
+++ /dev/null
@@ -1,249 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-/*
- * Created on 2005
- * by Christian Schmidt
- */
-package com.sun.star.tooling.DirtyTags;
-
-import java.io.IOException;
-import java.util.ArrayList;
-
-/**
- * Solves the problem with translating strings from the
- * Star-Office Help. This Strings contain XML snippets
- * (that means parts of an xml dokument). I call them 'dirty'
- * because the start of a tag (<) and the and of an tag (>)
- * are quoted by a single backslash(\<.....\>). This is done
- * because the text out of th tags should not contain '<' and '>'
- * as Entity references (&lt; or &gt;) but as readable signs.
- * This is for translation purposes.
- * Because translators get mad while find out the really translatable
- * parts between all the markup information, the XLIFF Specification
- * allows to wrap parts of a String that should not be translated by
- * special tags (<ept>, <bpt>).
- * This Class has two static methods that do the wrapping and unwrapping
- * NOTE: this won't work with not 'dirty' Strings.
- *
- * @author Christian Schmidt 2005
- *
- */
-public class DirtyTagWrapper {
-
- private static boolean doWrap=true;
- public static void setWrapping(boolean doWrap){
- DirtyTagWrapper.doWrap=doWrap;
- }
-
- /**
- * Unwraps the 'dirty' parts of a String from ept and bpt tags
- *
- * @param checkString The String to unwrap
- * @return the unwrapped String
- */
- public static String unwrapString(String checkString){
- //remove the ept and bpt tags
- String[] splitted =checkString.split("(<ept ([^<>])*>)|(</ept>)|(<bpt ([^<>])*>)|(</bpt>)|(<sub([^<>])*>)|(</sub>)|(<ex ([^<>])*/>)");
- StringBuffer workBuffer= new StringBuffer();
- for(int i=0;i<splitted.length;i++){
- workBuffer.append(splitted[i]);
- }
- String string = new String(workBuffer);
- //replace Entity references
- string=string.replaceAll( "&amp;","&").replaceAll( "&lt;","<").replaceAll( "&gt;",">").replaceAll( "&quot;","\"").replaceAll( "&apos;","'");
-
- //remove the nsub tags
- splitted =string.split("(<sub([^<>])*>)|(</sub>)");
- StringBuffer returnBuffer= new StringBuffer();
- for(int i=0;i<splitted.length;i++){
- returnBuffer.append(splitted[i]);
- }
- String returnString = new String(returnBuffer);
- return returnString;
- }
-
-
- /**
- * Wrap the dirty parts of a string
- *
- * @param checkString The String to check if there are dirty Parts to wrap
- * @return A String with wrapped dirty parts
- * @throws TagWrapperException
- * @throws IOException
- */
- public static String wrapString(String checkString) throws TagWrapperException, IOException {
- // if no wrapping should be done return the given string
- if(!doWrap) return checkString;
- // let's wrap
- String[] parts=null;
- int idx=0;
- //split the string at tag ends
- String[] parts2 = checkString.split("\\\\>");
-
- ArrayList tagString =new ArrayList();
- // put the while splitting lost parts to the end of the single strings
- for(int j=0;j<parts2.length-1;j++){
- parts2[j]+="\\>";
- }
- // same for the last string
- if (checkString.endsWith("\\>")){
- parts2[parts2.length-1]+="\\>";
- }
- // split the leading text from the real tag string (<...>)
- for(int j=0;j<parts2.length;j++){
-
- //is it just a tag
- if(parts2[j].startsWith("\\<")){
- tagString.add(parts2[j]);
- // or is it a tag with leading text?
- }else if((idx=parts2[j].indexOf("\\<"))>0&&parts2[j].indexOf("\\>")>0){
- //...then split it in two parts
- // the leading text
- tagString.add(parts2[j].substring(0,(parts2[j].indexOf("\\<"))));
- // ...and the tag
- tagString.add(parts2[j].substring(parts2[j].indexOf("\\<")));
-
- }else{
- //no tag...must be text only
- tagString.add(parts2[j]);
- }
-
- }
- ArrayList tagNames=new ArrayList();
- String item="";
- for(int i=0;i<tagString.size();i++){
- item=((String)tagString.get(i));
- int start=item.indexOf("\\<")+2;
- // check if we have an index that is ok
- if(start==1) start=-1;
- int end=item.lastIndexOf("\\>");
- if(start>=0&&end>0){
- boolean isStandalone=false;
- if(item.endsWith("/\\>")){
- // this is a standalone tag
- isStandalone=true;
- }
- item=item.substring(start,end);
-
- if(item.indexOf(" ")>0){
- item=item.substring(0,item.indexOf(" "));
- }
- if(isStandalone){
- item=item+"/";
- }
- tagNames.add(item);
- }else{
- tagNames.add("");
- }
- }
- ArrayList tagType=new ArrayList();
- for(int i=0;i<tagNames.size();i++){
- if(((String)tagNames.get(i)).equals("")){
- tagType.add("Text");
- }else if(((String)tagNames.get(i)).startsWith("/")){
- tagType.add("EndTag");
- }else if(((String)tagNames.get(i)).endsWith("/")){
- tagType.add("StartAndEndTag");
- }else {
- tagType.add("StartTag");
- }
-
- }
-
- ArrayList tagList=new ArrayList();
- for(int i=0;i<tagNames.size();i++){
- tagList.add(new Tag(
- (String)tagType.get(i),
- (String)tagNames.get(i),
- (String)tagString.get(i)));
- }
- tagType=null;
- tagNames=null;
- tagString=null;
-
- TagPair start;
- StringBuffer returnBuffer=new StringBuffer();
- while(tagList.size()>0){
- try{
- start=new TagPair(tagList);
- returnBuffer.append(start.getWrapped());
- }catch(TagPair.TagPairConstructionException e){
- throw (new DirtyTagWrapper()).new TagWrapperException(e);
- }
- }
- TagPair.resetCounter();
- return new String(returnBuffer);
- }
- /**
- * @author Christian Schmidt 2005
- *
- */
- public class TagWrapperException extends Exception {
-
- /**
- * Create a new Instance of TagWrapperException
- *
- *
- */
- public TagWrapperException() {
- super();
- //
- }
-
- /**
- * Create a new Instance of TagWrapperException
- *
- * @param arg0
- */
- public TagWrapperException(String arg0) {
- super(arg0);
- //
- }
-
- /**
- * Create a new Instance of TagWrapperException
- *
- * @param arg0
- * @param arg1
- */
- public TagWrapperException(String arg0, Throwable arg1) {
- super(arg0, arg1);
- //
- }
-
- /**
- * Create a new Instance of TagWrapperException
- *
- * @param arg0
- */
- public TagWrapperException(Throwable arg0) {
- super(arg0);
- //
- }
-
- }
-}
diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/Tag.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/Tag.java
deleted file mode 100755
index 223885571007..000000000000
--- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/Tag.java
+++ /dev/null
@@ -1,246 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-/*
- * Created on 2005
- * by Christian Schmidt
- */
-package com.sun.star.tooling.DirtyTags;
-
-import java.io.IOException;
-import java.util.Map;
-
-import com.sun.star.tooling.converter.ExtMap;
-
-/**
- * @author Christian Schmidt 2005
- *
- */
-public class Tag {
- private static int indent=0;
- Map tagNames;
- private String tagType;
- private String tagName;
- private String tagString;
- public static Tag EMPTYTAG=new Tag("","","");
-
- /**
- * Create a new Instance of Tag
- *
- * @param tagType
- * @param tagName
- * @param tagString
- */
- public Tag(String tagType, String tagName, String tagString) {
-
- this.tagType=tagType;
- this.tagName=tagName;
- this.tagString=tagString;
-
- tagNames=new ExtMap();
- tagNames.put("link","name");
- tagNames.put("caption","xml-lang");
- tagNames.put("alt","xml-lang");
- }
-
- public String getWrappedTagString() throws IOException{
- if(this.canHaveTranslateableContent()){
- return this.wrapTagStringIntern();
- }else{
- return xmlString(this.tagString);
- }
- }
-
- private final String xmlString( final String string) throws java.io.IOException {
- if (string == null)
- return string; // ""
- String str = string;
-
- for(int i=0;i<str.length();i++){
- if(str.charAt(i)=='&'){
- str=str.substring(0, i)+"&amp;"+str.substring(i+1);
- continue;
- }
-
- if(str.charAt(i)=='<'){
- str=str.substring(0, i)+"&lt;"+str.substring(i+1);
- continue;
- }
-
- if(str.charAt(i)=='>'){
- str=str.substring(0, i)+"&gt;"+str.substring(i+1);
- continue;
- }
-
- if(str.charAt(i)=='"'){
- str=str.substring(0, i)+"&quot;"+str.substring(i+1);
- continue;
- }
-
- if(str.charAt(i)=='\''){
- str=str.substring(0, i)+"&apos;"+str.substring(i+1);
- continue;
- }
- }
-
- return str;
- }
- /**
- * @return
- */
- private boolean canHaveTranslateableContent() {
- return (tagNames.containsKey(this.tagName));
-
- }
-
- /**
- * @throws IOException
- *
- */
- private String wrapTagStringIntern() throws IOException {
-
-
- String[] split=this.tagString.split("=");
- int length=split.length;
- // no attribute found;
- if (length==0) return xmlString(tagString);
- else{
- int i=0;
-
- while(i<length-1/*the last part can only contain an attribute value*/){
- String attributeName = split[i].trim();
- if(split[i]. indexOf("</sub>")<0) split[i]=xmlString(split[i]);
- i++;
- String value;
- attributeName=(attributeName.substring(attributeName.lastIndexOf(" ")).trim());
- if((value=translateableAttributeValue(this.tagName)).equals(attributeName)){
- int valueStart=0;
- int valueEnd=0;
-
- // get the value to the found attribute name
- // it must either be surrounded by '"'...
- if((valueStart=split[i].indexOf('"'))>=0){
- valueEnd = split[i].lastIndexOf('"');
- //...or surrounded by "'"
- }else if((valueStart=split[i].indexOf("'"))>=0){
- valueEnd = split[i].lastIndexOf("'");
- }else{
- // there seems to be an error,
- // we found an '=' (we split there) but no '"' or '''
- // but although we don't check the syntax
- // we just continue
- continue;
- }
- //ok we found the border of a value that might be translated
- //now we wrap it with the tags
-
- split[i]=xmlString(split[i].substring(0,valueStart+1))+"<sub>"+xmlString(split[i].substring(valueStart+1,valueEnd))+"</sub>"+xmlString(split[i].substring(valueEnd));
-
- }
- }
- String wrappedString="";
- // we have the wrapped parts, now we put them together
- int j=0;
- for(j=0;j<split.length-1;j++){
- wrappedString+=(split[j]+"=");
- }
- wrappedString+=split[j];
-// System.out.println(this.tagString);
-// System.out.println(wrappedString);
- return wrappedString;
- }
-
- }
-
-
-
- /**
- * @param tagName the name of the tag to check
- * @return the name of the attribute that can contain translateable value
- */
- private String translateableAttributeValue(String tagName) {
-
- return (String)this.tagNames.get(tagName);
- }
-
-
- /**
- * Create a new Instance of Tag
- *
- *
- */
- public Tag(String tagString) {
- this(extractTagType(extractTagName(tagString)),extractTagName(tagString),tagString);
- }
-
- private static String extractTagName(String tagString){
-
- int start=tagString.indexOf('<')+1;
- int end=tagString.lastIndexOf('\\');
- if(start>=0&&end>0){
- tagString=tagString.substring(start,end);
-
- if(tagString.indexOf(" ")>0){
- tagString=tagString.substring(0,tagString.indexOf(" "));
- }
- return tagString;
- }else{
- return "";
- }
- }
- private static String extractTagType(String tagName){
- if(tagName.equals("")){
- return "Text";
- }else if(tagName.startsWith("/")){
- return "EndTag";
- }else if(tagName.endsWith("/")){
- return "StartAndEndTag";
- }else {
- return "StartTag";
- }
- }
-
- /**
- * @return Returns the tagName.
- */
- public String getTagName() {
- return this.tagName;
- }
- /**
- * @return Returns the tagString.
- */
- public String getTagString() {
- return this.tagString;
- }
- /**
- * @return Returns the tagType.
- */
- public String getTagType() {
- return this.tagType;
- }
-
-
-}
diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/TagPair.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/TagPair.java
deleted file mode 100755
index cc362a96e740..000000000000
--- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/DirtyTags/TagPair.java
+++ /dev/null
@@ -1,307 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-/*
- * Created on 2005
- * by Christian Schmidt
- */
-package com.sun.star.tooling.DirtyTags;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-
-/**
- * @author Christian Schmidt 2005
- *
- */
-public class TagPair {
-
-
- private Tag startTag=Tag.EMPTYTAG;
- private Tag endTag=Tag.EMPTYTAG;
- private String startingText="";
- private ArrayList enclosedTags=new ArrayList();
- private long id;
- private static int ElementCounter=1;
- private String endingText="";
-
- /**
- * @author Christian Schmidt 2005
- *
- */
- public class TagPairConstructionException extends Exception {
-
- /**
- * Create a new Instance of TagPairConstructionException
- *
- * @param string
- */
- public TagPairConstructionException(String string) {
-
- }
-
- }
-
- /**
- * Create a new Instance of TagPair
- *
- *
- */
- public TagPair() {
-
- }
-
-
- /**
- * Create a new Instance of TagPair
- *
- * Find matching tags in tagList, create a TagPair of it, create
- * tagPairs from the content in the tagPair and remove all used
- * tags from tagList. The rest of the tagList starts after the
- * endTag of this TagPair.
- *
- * @param tagList a List of the tags to check
- *
- * @throws TagPairConstructionException
- */
- public TagPair(ArrayList tagList) throws TagPairConstructionException {
-
- if(tagList.size()==0){
- return;
- }
- ArrayList contentList=new ArrayList();;
- Tag tag=(Tag)tagList.get(0);
- tagList.remove(0);
-
-
- if("Text".equals(tag.getTagType())){
- // is this Text the only content
- // of this Tag ?
- if(tagList.size()==0){
- //yes...then it is the starting Text of this TagPair
- this.startingText=tag.getTagString();
- return;
- }else{
- //no...the tag is normal content
- contentList.add(tag);
- }
- this.startingText=tag.getTagString();
-
- }else if("EndTag".equals(tag.getTagType())){
- //ERRor throw EXception
- }else if("StartTag".equals(tag.getTagType())){
- // find the matching end tag
- this.startTag=tag;
- Iterator iter=tagList.iterator();
-
- int equivalentTagCounter=0;
- while(iter.hasNext()){
- //is this the end tag?
- if((tag=(Tag)iter.next()).getTagName().equals('/'+this.startTag.getTagName())&&equivalentTagCounter==0){
- //found the corresponding end tag
-
- //this TagPair is complete
- //so it needs an id
- this.id=TagPair.ElementCounter++;
- this.endTag=tag;
- //...remove it from list
- tagList.removeAll(contentList);
- tagList.remove(tag);
- break;
- }else{
- // tag is not the end tag
- // so it is between the start and the end tag
- // and belongs to the content
- // but first check if it has the same name as the current tag
- if(tag.getTagName().equals(this.startTag.getTagName())){
- // if this is a start tag like the current start tag
- // we count it to find out the matching end tag in nested tags
- if(tag.getTagType().equals("StartTag")){
- equivalentTagCounter++;
- }
- }
- if(tag.getTagName().equals("/"+this.startTag.getTagName())){
- if(tag.getTagType().equals("EndTag")){
- equivalentTagCounter--;
- }
- }
-
- contentList.add(tag);
- }
- }
- //found the end tag ?
- //no...
- if (this.endTag.getTagType()==""){
-
- throw new TagPairConstructionException("ERROR: Missing end tag ("+
- this.startTag.getTagString()+").");
- //...yes
- }else{
- //We need to check whether the content is starting or ending with text
- //...check starting with text
- if(contentList.size()>=1&&((String)((Tag)contentList.get(0)).getTagType()).equals("Text")){
- //yes...store it as startingText
- this.startingText=(String)((Tag)contentList.get(0)).getTagString();
- //remove it from list
- contentList.remove(0);
- }
- // ...check ending with text
- if(contentList.size()>=1&&((String)((Tag)contentList.get(contentList.size()-1)).getTagType()).equals("Text")){
- //yes...store it as endingText
- this.endingText=(String)((Tag)contentList.get(contentList.size()-1)).getTagString();
- //remove it from list
- contentList.remove(contentList.size()-1);
- }
- //create the list of tags enclosed by this tagPair
- createEnclosedTags(contentList);
- }
- //if stand AloneTag create own TagObject...give ID...add to List
- }else if("StartAndEndTag".equals(tag.getTagType())){
- this.startTag=tag;
- this.endTag=new Tag("EndOfStandAlone","","");
- createEnclosedTags(contentList);
- }
-
- }
-
- /**
- * @param contentList
- * @throws TagPairConstructionException
- */
- private void createEnclosedTags(ArrayList contentList) throws TagPairConstructionException {
- while(contentList.size()>0){
- //create the inner TagPairs
- this.enclosedTags.add(new TagPair(contentList));
- }
-
- }
-
- public String toString(){
- StringBuffer outString= new StringBuffer(this.startTag.toString());
- TagPair help=new TagPair();
- Iterator iter=enclosedTags.iterator();
- outString.append(this.startingText);
- while(iter.hasNext()){
- if((help=(TagPair)iter.next())==null){
- continue;
- }else{
- outString.append(help.toString());
- }
- }
- outString.append(this.endingText);
- outString.append(this.endTag.toString());
- return new String(outString);
- }
-
- public String getWrapped() throws IOException{
- Iterator iter=enclosedTags.iterator();
- StringBuffer returnBuffer=new StringBuffer();
-
- returnBuffer.append(wrap(this.startTag)+xmlString(this.startingText));
- while(iter.hasNext()){
- returnBuffer.append(((TagPair)iter.next()).getWrapped());
- }
- returnBuffer.append(xmlString(this.endingText)+wrap(this.endTag));
-
-
-
- return new String(returnBuffer);
- }
-
- private String wrap(Tag tag) throws IOException{
- String string="";
- //can be a start tag
- if(tag.getTagType().startsWith("Start")){
- return new String("<bpt id='"+this.id+"'>"+tag.getWrappedTagString()+"</bpt>");
- //...or a end tag
- }else if (tag.getTagType().startsWith("End")){
- //maybe the end tag of a Start and end tag
-// if("EndOfStandAlone".equals(tag.getTagType())){
-// return new String("<ex id='"+this.id+"'/>");
-// }else{
- string=tag.getWrappedTagString();
- return new String("<ept id='"+this.id+"'>"+string+"</ept>");
-// }
-
- //...or text
- }else{
- return xmlString(tag.getTagString());
- }
- }
- /**
- * Replaces all characters that mustn't be in XLIFF PCdata
- *
- * @param string the string to check
- * @return the checked string with all characters replaced
- * @throws java.io.IOException
- */
- private final String xmlString( final String string) throws java.io.IOException {
- if (string == null)
- return string; // ""
- String str = string;
-
- for(int i=0;i<str.length();i++){
- if(str.charAt(i)=='&'){
- str=str.substring(0, i)+"&amp;"+str.substring(i+1);
- continue;
- }
-
- if(str.charAt(i)=='<'){
- str=str.substring(0, i)+"&lt;"+str.substring(i+1);
- continue;
- }
-
- if(str.charAt(i)=='>'){
- str=str.substring(0, i)+"&gt;"+str.substring(i+1);
- continue;
- }
-
- if(str.charAt(i)=='"'){
- str=str.substring(0, i)+"&quot;"+str.substring(i+1);
- continue;
- }
-
- if(str.charAt(i)=='\''){
- str=str.substring(0, i)+"&apos;"+str.substring(i+1);
- continue;
- }
- }
-
- return str;
- }
-
- /**
- *
- */
- public static void resetCounter() {
- TagPair.ElementCounter=1;
-
- }
-
-
-}
diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/Convert.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/Convert.java
deleted file mode 100755
index d6fddfd049ae..000000000000
--- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/Convert.java
+++ /dev/null
@@ -1,550 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-/*
- * the main Class
- *
- * Command Line arguments are reviewed
- * and a Converter is constructed
- */
-package com.sun.star.tooling.converter;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.Calendar;
-
-import com.sun.star.tooling.DirtyTags.DirtyTagWrapper;
-
-/**
- * The main class of the converter tool
- *
- * The converter tool is command line based.
- * Its classes allow the converting between the
- * file formats sdf, gsi and <a href="http://www.oasis-open.org/committees/xliff/documents/cs-xliff-core-1.1-20031031.htm">xliff</a>.
- *
- * Those file formats are used in localization
- * of Star-Office and Open-Office.
- *
- * Information about the whole localization process can be found in
- * <a href="http://ded-1.germany.sun.com/webcontent/guidelines/pdf/L10NSO8.pdf">http://ded-1.germany.sun.com/webcontent/guidelines/pdf/L10NSO8.pdf</a>
- *
- * @author Christian Schmidt 2005
- *
- */
-public class Convert {
-
- private static Calendar cal;
-
- private static final String EMPTY = "";
-
- /**
- * The name of the file containing the debug information
- * that where found while converting (every output goes here too)
- */
- private static String dbgName = EMPTY;
-
- /**
- * the character that separates the extension from the file name
- */
- private static final char extensionSeperator = '.';
-
- /**
- * the log File
- */
- private static File log;
-
- /**
- * the name of the log file
- */
- private static String logString = EMPTY;
-
- /**
- * indicates whether existing sources should be overwritten
- * without asking
- */
- private static boolean overwrite = false;
-
- /**
- * A second Source File needed for GSI Merging
- */
- private static File secondSource;
-
- //private static final char pathSeperator = '\\';
-
- /**
- * The language that should be the source language
- * that means the language to translate from
- */
- private static String sourceLanguage = "en-US";
-
- /**
- * the name of the source file
- */
- private static String sourceName = EMPTY;
-
- /**
- * the type of the source file (sdf,xliff,...)
- */
- private static String sourceType = EMPTY;
-
- /**
- * The time when converting started
- */
- private static String startTime = EMPTY;
- /**
- * The language that should be the target language
- * that means the language to translate to
- */
- private static String TargetLanguage = EMPTY;
-
- /**
- * the name of the target file
- */
- private static String targetName = EMPTY;
-
- /**
- * the type of the target file (sdf,xliff,...)
- */
- private static String targetType = EMPTY;
-
- /**
- * Store the current version ID and number of this tool
- */
- final static String version = " Prod.20050710:1255 ";
-
- /**
- * The name of the (original) sdf file used as second source for gsi->sdf merging
- */
- private static String secondSourceName=EMPTY;
- /**
- * Indicate whether strings in xliff files should
- * be wrapped with ept/bpt or sub tags to enable translation tools
- * to synchronize source language string with there translation
- *
- * @see <a href="http://ded-1.germany.sun.com/webcontent/guidelines/pdf/L10NSO8.pdf">http://ded-1.germany.sun.com/webcontent/guidelines/pdf/L10NSO8.pdf</a>
- */
- private static boolean doWrap=true;
-
-
-
- public static void main(String[] args) throws IOException, Exception {
- try{
-
- //go, parse and check the command line parameters
- ParameterChecker.checkClParameters(args);
- ParameterChecker.createContentOfClParameters();
- //Initialize the tagWrapper
- DirtyTagWrapper.setWrapping(doWrap);
- //create an instance of converter
- Converter conv = new Converter(sourceType, sourceName, sourceLanguage,
- targetType, targetName, TargetLanguage,secondSourceName, overwrite);
- // get aktual time
- cal = Calendar.getInstance();
- startTime = cal.getTime().toString();
- //show infos
- printPreamble();
- //do the job
- conv.convert();
-
- showStatistic();
-
- //close log, debug...
- OutputHandler.closeAll();
-
- } catch(Exception e){
- System.out.print("An EXCEPTION occured, please check your commad line settings \n"+e.getMessage());
- System.exit(-1);
- }catch(Throwable t){
- System.out.print("A FATAL ERROR occured, please check your commad line settings \n"+t.getMessage());
- System.exit(-1);
- }
-
- }
-
- /**
- * show the command line help
- */
- private static void printHelp() {
-
- final String ls = System.getProperty("line.separator");
- System.out
- .println(
-
- "File Converting Tool 'converter' Version "
- + Convert.version
- + ls
- + "Converts SDF files to wellformed XLIFF or GSI files and vice versa" + ls
- + ls
- + "Use: " + ls
- + "convert [-h]|[SourcePath [TargetPath] [-T Type] [[-S Type [secondSourcePath]] " + ls
- + " [-s LanguageID] [-t LanguageID] [-l [LogPath]] [-o]]" + ls
- + ls
- + "-h show this help." + ls
- + "SourcePath path of the file to convert." + ls
- + "secondSourcePath path of the SDF file to merge to (GSI -> SDF only!)." + ls
- + "TargetPath path where to store the result." + ls
- + "LogPath path of the log file" + ls
- + "-T Type the type of the target file (xliff,sdf,gsi)" + ls
- + "-S Type the type of the source file (xliff,sdf,gsi)" + ls
- + "-s LanguageID the ISO language code of the source language (de, fr...)." + ls
- + " Default is 'en-US' " + ls
- + "-t LanguageID the language code of the target language (de, fr...)." + ls
- + " Default is first found Language other than source language." + ls
- + "-l [LogPath] write a log file, you can name the file." + ls
- + "-o overwrite existing files without asking." + ls
- + "-nw disable the wrapping with ept/bpt tags." + ls
- + ls
- + "The created files were stored in the SourceFile Path if nothing else is given. " + ls
- + "The extension is '.xliff','.sdf' depending on the source file and '.log' " + ls
- + "for the logfile." + ls);
- }
-
- /**
- * show the parameters the converter starts with
- *
- * @throws IOException
- */
- final private static void printPreamble() throws IOException {
- OutputHandler.out(EMPTY);
- OutputHandler.out("Source File is: " + sourceName);
- OutputHandler.out("Target File is: " + targetName);
- if (OutputHandler.doLog) {
- OutputHandler.out("Log File is: " + logString);
- } else {
- OutputHandler.out("Log File is: disabled");
- }
-
- OutputHandler.out(EMPTY);
-
- }
-
- /**
- * show some statistic data
- *
- * @throws IOException
- */
- final private static void showStatistic() throws IOException {
- OutputHandler.dbg(EMPTY);
- OutputHandler
- .out((targetType.equalsIgnoreCase("xliff") ? "TransUnits written: "
- : "Lines written : ")
- + Converter.getLineCounter());
- OutputHandler.dbg(EMPTY);
- OutputHandler.out("Started at : " + Convert.startTime);
- Convert.cal = Calendar.getInstance();
- OutputHandler.out("Finished at : " + Convert.cal.getTime());
- OutputHandler.dbg(EMPTY);
-
- }
-
- /**
- * Get the extensiion of a file name
- * (sdf,xliff,gsi)
- *
- * @param sourceString the file name
- * @return the extension
- */
- static protected String extractExtension(String sourceString) {
- String ext = sourceString.substring(sourceString
- .lastIndexOf(Convert.extensionSeperator) + 1);
- return ext;
- }
-
-// static protected String extractFileName(String sourceString) {
-// String sName = EMPTY;
-// sName = (sourceString.substring(sourceString
-// .lastIndexOf(File.separator) + 1, sourceString
-// .lastIndexOf(Convert.extensionSeperator)));
-//
-// return sName;
-// }
-//
-// static protected String extractPath(String sourceString) {
-// String sPath = sourceString.substring(0, sourceString
-// .lastIndexOf(File.separator) + 1);
-// return sPath;
-// }
-
- /**
- *
- */
- public Convert() {
- }
-
- /**
- *
- * Verify a parameter array and create content useable by the programm
- * from the switches and attributes set at command line
- *
- * @author Christian Schmidt 2005
- */
- private static class ParameterChecker {
-
- /**
- * Holds the path of the source file
- */
- private static String filePath;
- /**
- * Holds the name of the source file
- */
- private static String fileName;
-
- /**
- * Create a new Instance of ParameterChecker
- *
- *
- */
- public ParameterChecker(){};
- /**
- * Checks the command line parameters
- *
- * @param args the parameters to check and to parse
- * @throws IOException
- */
- private static void checkClParameters(String[] args) throws IOException {
- try {
- //show help if no attrributes...
- if (args.length == 0) {
- printHelp();
- System.exit(-1);
- }
- //...or attribute is -h
- if (args[0].equals("-h")) {
- printHelp();
- System.exit(0);
- }
- if (args[0].equals("-ver")) {
- System.out.println("File Converting Tool Version "+version);
- System.exit(0);
- }
- //source file Location and path is always first attribute
- sourceName = new String(args[0]);
-
- File source = new File(sourceName);
- //break if there is no source to convert
- if (!source.exists())
- throw new IOException("ERROR:Can not find Source File '"
- + sourceName + "'. Aborting...");
-
- // String name=source.getName();
- // String parent=source.getParent();
- // String path=source.getPath();
-
- filePath = (source.getParent()==null)?"":source.getParent()+File.separator; //extractPath(sourceName);
- fileName = source.getName().substring(0,source.getName().lastIndexOf(extensionSeperator));
-
- for (int i = 1; i < args.length; i++) {
-
-
- if ("-s".equals(args[i])) {
- if (args.length > i + 1) {
- sourceLanguage = args[++i];
-
- } else {
- throw new ConverterException(
- "missing argument for -s source language");
- }
- continue;
- }
-
- if ("-S".equals(args[i])) {
- if (args.length > i + 1) {
- sourceType = args[++i];
- if (args.length > i +1 &&!args[i+1].startsWith("-")) {
- secondSourceName = args[++i];
- }
-
- } else {
- throw new ConverterException(
- "missing argument for -S source type");
- }
- continue;
- }
-
- if ("-T".equals(args[i])) {
- if (args.length > i + 1) {
- targetType = args[++i];
-
-
- } else {
- throw new ConverterException(
- "missing argument for -T target type");
- }
- continue;
- }
-
- if ("-l".equals(args[i])) {
- OutputHandler.doLog = true;
- if (args.length > i + 1
- && (!args[i + 1].startsWith("-"))) {
- logString = args[++i];
- } else {
- logString = EMPTY;
- }
- continue;
- }
-
- if ("-o".equals(args[i])) {
- overwrite = true;
- continue;
- }
-
- if ("-nw".equals(args[i])) {
- doWrap = false;
- continue;
- }
-
- if ("-h".equals(args[i])) {
- printHelp();
- System.exit(0);
- }
-
- if ("-dbg".equals(args[i])) {
- OutputHandler.doDebug = true;
- continue;
- }
-
- if ("-t".equals(args[i])) {
- if (args.length > i + 1) {
- TargetLanguage = args[++i];
- } else {
- throw new ConverterException(
- "missing argument for -t target language");
- }
- continue;
- }
-
- if (i == 1 && !args[i].startsWith("-")) { //target file
- // found
- targetName = args[i];
- continue;
- }
- //if we come here we
- //can not match the Attribute
- throw new ConverterException("unknown Attribute: "
- + args[i]);
-
-
- }//end for
- } catch (ConverterException e) {
- OutputHandler.out("ERROR: "+e.getMessage());
- System.exit(-1);
- } catch (Throwable t){
- System.out.print("An Error occured while parsing the command line,\n please check your commad line settings.\n "+t.getMessage());
- System.exit(-1);
- }
-
- }//end checkClParameters
-
- /**
- * Creates the appropriate content of what ever data
- * we found in the command line
- *
- * @throws IOException
- */
- private static void createContentOfClParameters() throws IOException {
-
- try {
- if (OutputHandler.doDebug) {
- // if the -dbg switch is set, we
- // create
- // a file that gets all information
- // produced by this tool
-
- OutputHandler.dbgFile = new BufferedWriter(new FileWriter(
- new File(new String(filePath + fileName + ".dbg"))));
- }
-
- if (OutputHandler.doLog) {// create a logfile?
- //given at command line?
- if (EMPTY.equals(logString) || logString == null) {
- logString = new String(filePath + fileName + ".log");
- }
- log = FileMaker.newFile(logString, overwrite);
- OutputHandler.logFile = (new BufferedWriter(new FileWriter(
- log)));
- }
-
- if (EMPTY.equals(sourceType) || sourceType == null) {
- // not given at command line?
- if (!(EMPTY.equals(sourceName) || sourceName == null)) {
- sourceType = extractExtension(sourceName);
- } else {
- throw new ConverterException("Source type is missing");
- }
- }
-
- if(sourceType.equalsIgnoreCase("gsi")){
-
- if(EMPTY.equals(Convert.secondSourceName)){
- Convert.secondSourceName=filePath+fileName+".sdf";
- }
- //secondSource=new File(Convert.secondSourceName);
-
- }
-
- if (EMPTY.equals(sourceName)) {
- sourceName = filePath + fileName + "." + sourceType;
- }
- //no target type given at command line?
- if (EMPTY.equals(targetType) || targetType == null) {
- if (!(EMPTY.equals(targetName) || targetName == null)) {
- targetType = extractExtension(targetName);
- } else {
- throw new ConverterException("Target type is missing");
-
- }
- }
- //no target File specified at command line
- if (EMPTY.equals(targetName) || targetName == null) {
- targetName = filePath + fileName + "." + targetType;
- if (targetName.equals(Convert.secondSourceName)){
- OutputHandler.out("ERROR: \nSource '"+Convert.secondSourceName+"' and \nTarget'"+targetName+"' are the same");
- System.exit(0);
- }else if (targetName.equals(Convert.sourceName)){
- OutputHandler.out("ERROR: \nSource '"+Convert.sourceName+"' and \nTarget'"+targetName+"' are the same");
- System.exit(0);
- }
- }else if (targetName.equals(Convert.secondSourceName)){
- OutputHandler.out("ERROR: \nSource '"+Convert.secondSourceName+"' and \nTarget'"+targetName+"' are the same");
- System.exit(0);
- }else if (targetName.equals(Convert.sourceName)){
- OutputHandler.out("ERROR: \nSource '"+Convert.sourceName+"' and \nTarget'"+targetName+"' are the same");
- System.exit(0);
- }
-
-
- } catch (ConverterException e) {
- OutputHandler.out(e.getMessage());
- }
-
- }
-
- }
-
-} \ No newline at end of file
diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/Converter.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/Converter.java
deleted file mode 100755
index ad846ae88295..000000000000
--- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/Converter.java
+++ /dev/null
@@ -1,520 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-/*
- * Converter.java
- *
- * create Source and Target
- * for converting
- * TODO maybe a factory would be good here
- */
-
-package com.sun.star.tooling.converter;
-
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-
-import org.xml.sax.EntityResolver;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.DefaultHandler;
-
-/**
- *
- * This class handles the creating of the source to read from,
- * the target to write to and the appropriate DataHandler
- *
- * @author Christian Schmidt 2005
- */
-public final class Converter {
-
- /**
- * the used charset f.e. UTF-8
- */
- private final static String CHARSET = new String("UTF-8");
-
- private static final String EMPTY = new String("");
-
- /**
- * The DataHandler use to connect reader and writer
- */
- private static DataHandler handler;
-
- /**
- * Counting the lines written by a writer
- */
- private static int lineCounter;
-
- /**
- * The target to write to
- */
- private static DataWriter theTargetWriter;
-
-
- /**
- * Overwrite existing files
- */
- private boolean overwrite = false;
- /**
- * The source to read from
- */
- private Source reader;
- /**
- * The name of the source file
- */
- private String sourceString;
- /**
- * the Type of the Source file(SDF,GSI,XLIFF)
- */
- private String sourceType;
- /**
- * The name of the target fille
- */
- private String targetString;
- /**
- * the Type of the Target file(SDF,GSI,XLIFF)
- */
- private String targetType;
- /**
- * The writer that handles the output
- */
- private Target writer;
-
- /**
- * The sourceLanguage
- */
- String sourceLanguage = "en-US";
-
- /**
- * The targetLanguage
- */
- String targetLanguage = "";
-
- /**
- * The name of the second source, needed for GSI to SDF merge
- */
- private String secondSourceString=EMPTY;
-
-
- /**
- * Get the line counter
- * @return Returns the lineCounter.
- */
- public static int getLineCounter() {
- return lineCounter;
- }
-
- /**
- * increment the lineCounter
- */
- final static void countLine() {
- lineCounter++;
- }
-
- /**
- * Creates a new instance of Converter
- *
- * @param sourceType the type of the sourceFile
- * @param sourceString the name of the sourceFile
- * @param SourceLanguage the ISO Id of the sourceLanguage
- * @param targetType the type of the targetFile
- * @param targetString the name of the targetFile
- * @param TargetLanguage the ISO Id of the targetLanguage
- * @param secondSourceString the name of the second sourceFile (GSI merge only)
- * @param overwrite indicates whether overwrite existing files
- * @throws IOException
- * @throws Exception
- */
- public Converter(String sourceType, String sourceString,
- String SourceLanguage, String targetType, String targetString,
- String TargetLanguage,String secondSourceString, boolean overwrite) throws IOException,
- Exception {
-
- this.sourceType = sourceType;
- this.sourceString = sourceString;
- this.sourceLanguage = SourceLanguage;
- this.targetType = targetType;
- this.targetString = targetString;
- this.targetLanguage = TargetLanguage;
- this.secondSourceString=secondSourceString;
- this.overwrite = overwrite;
-
- handler = new DataHandler();
-
- if ("sdf".equalsIgnoreCase(sourceType)) {
- reader = new SDFSource();
- } else if ("xliff".equalsIgnoreCase(sourceType)||"dbxliff".equalsIgnoreCase(sourceType)) {
- reader = new XLIFFSource();
- } else if ("gsi".equalsIgnoreCase(sourceType)) {
- reader = new GSISource();
- } else {
- throw new ConverterException("Unknown Source File Type: '"+sourceType+"'");
- }
-
- if ("sdf".equalsIgnoreCase(targetType)) {
- writer = new SDFTarget();
- } else if ("xliff".equalsIgnoreCase(targetType)) {
- writer = new XLIFFTarget();
- } else if ("gsi".equalsIgnoreCase(targetType)) {
- writer = new GSITarget();
- } else {
- throw new ConverterException("Unknown Target File Type: '"+targetType+"'");
- }
-
- }
-
- /**
- * Do the converting from the source file format to the target file format
- *
- * @throws IOException
- */
- public final void convert() throws IOException {
-
- try {
-
- reader.convertTo(writer);
-
- //TODO this belongs in the Target Class
- theTargetWriter.flush();
- theTargetWriter.close();
- } catch (Exception e) {
- OutputHandler.out(e.getMessage());
- }
-
- }
-
-
- /**
- *
- * Encapsulate the reading from an GSI file
- *
- * @author Christian Schmidt 2005
- *
- */
- private class GSISource implements Source {
- DataReader theSourceReader;
- /**
- * Create a new Instance of GSISource
- *
- * @throws IOException
- * @throws Exception
- */
- public GSISource() throws IOException {
-
- theSourceReader = new GSIandSDFMerger(new File(sourceString),new File(secondSourceString), sourceLanguage,
- targetLanguage, CHARSET);
- }
-
- public void convertTo(Target t) {
-
- try {
- theTargetWriter = t.getWriter();
- while (handler.fillDataFrom(theSourceReader)) {
-
- theTargetWriter.getDatafrom(handler);
- theTargetWriter.writeData();
- }
- } catch (IOException e) {
- OutputHandler.out(e.getMessage());
-
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
-
- }
- /**
- *
- * Encapsulate to write to a GSI file
- *
- * @author Christian Schmidt 2005
- *
- */
- private class GSITarget implements Target {
-
- File target;
-
- /**
- * Create a new Instance of GSITarget
- *
- * @throws FileNotFoundException
- * @throws IOException
- */
- public GSITarget() throws FileNotFoundException, IOException {
-
- target = FileMaker.newFile(targetString, overwrite);
- theTargetWriter = new GSIWriter(new BufferedOutputStream(
- new FileOutputStream(target)), CHARSET);
- }
-
- public DataWriter getWriter() {
-
- return theTargetWriter;
- }
-
- }
- /**
- *
- * Encapsulate the reading from an SDF file
- *
- * @author Christian Schmidt 2005
- *
- */
- private final class SDFSource implements Source {
-
- DataReader Source;
-
- /**
- * Create a new Instance of SDFSource
- * @throws IOException
- * @throws Exception
- */
- public SDFSource() throws IOException, Exception {
-
- Source = new SDFReader(new File(sourceString), sourceLanguage,
- targetLanguage, CHARSET);
- }
-
- public void convertTo(Target t) {
- try {
- theTargetWriter = t.getWriter();
- while (handler.fillDataFrom(Source)) {
-
- theTargetWriter.getDatafrom(handler);
- theTargetWriter.writeData();
- }
-
- } catch (IOException e) {
- OutputHandler.out(e.getMessage());
-
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
-
- }
- /**
- * Encapsulate writing to a SDF file
- *
- * @author Christian Schmidt 2005
- *
- */
- private class SDFTarget implements Target {
-
- /**
- * Create a new Instance of SDFTarget
- *
- * @throws IOException
- */
- public SDFTarget() throws IOException {
- File target = FileMaker.newFile(targetString, overwrite);
- theTargetWriter = new SDFWriter(new BufferedOutputStream(
- new FileOutputStream(target)), CHARSET);
- }
-
- /* (non-Javadoc)
- * @see com.sun.star.tooling.converter.Converter.Target#getWriter()
- */
- public DataWriter getWriter() {
-
- return theTargetWriter;
- }
-
- }
-
- /**
- * The interface for all convertable sources
- *
- * @author Christian Schmidt 2005
- *
- */
- private interface Source {
-
- DataReader Source=null;
- /**
- * Convert this. to the designated target
- * @param target the target of the converting
- * @throws IOException
- */
- abstract void convertTo(Target target) throws IOException;
- }
-
- /**
- * The interface for all creatable targets
- *
- * @author Christian Schmidt 2005
- *
- */
- private interface Target {
- /**
- * The writer to use
- */
- public OutputStream writer = null;
-
- /**
- * Get the writer
- * this target uses to write the
- * data in the correct format.
- *
- * @return the used DataWriter
- */
- abstract DataWriter getWriter();
-
- }
- /**
- * Encapsulate the reading from an XLIFF file
- *
- * @author Christian Schmidt 2005
- *
- */
- private class XLIFFSource implements Source {
- File source;
-
- /**
- * Create a new Instance of XLIFFSource
- *
- *
- */
- public XLIFFSource() {
-
- source = new File(sourceString);
- }
-
- public void convertTo(Target t) throws IOException {
- try {
- System.setProperty("entityExpansionLimit", "1000000");
- boolean laden = source.canRead();
- if (laden) {
- DefaultHandler contentHandler=null;
- if("dbxliff".equalsIgnoreCase(sourceType)){
- contentHandler = new XLIFFReader(handler, t
- .getWriter(),false);
- }else{
- contentHandler = new XLIFFReader(handler, t
- .getWriter());
- }
- SAXParserFactory factory = SAXParserFactory.newInstance();
- factory.setNamespaceAware( true );
- factory.setValidating( true );
-
- SAXParser parser=factory.newSAXParser();
- XMLReader xliffreader=parser.getXMLReader();
-
-
-
-// XMLReader xliffreader = XMLReaderFactory
-// .createXMLReader("org.apache.crimson.parser.XMLReaderImpl");
- xliffreader.setErrorHandler(contentHandler);
- xliffreader.setContentHandler(contentHandler);
- /* one possibility to resolve an extern entity (DTD) */
- EntityResolver res = new Resolver();
- xliffreader.setEntityResolver(res);
- /*
- * a second possibility to resolve an extern entity (DTD)
- *
- * xliffreader.setFeature("xml.org/sax/features/validation",true);
- * xliffreader.setEntityResolver(new EntityResolver() {
- * public InputSource resolveEntity(java.lang.String
- * publicId, java.lang.String systemId) throws SAXException,
- * java.io.IOException { if (publicId.equals("-//XLIFF//DTD
- * XLIFF//EN")) // this deactivates the open office DTD
- * return new InputSource(new ByteArrayInputStream( " <?xml
- * version='1.0' encoding='UTF-8'?>" .getBytes())); else
- * return null; } });
- *
- */
-
- xliffreader.parse(sourceString);
-
- } else {
- System.out.println("Datei existiert nicht");
- }
-
- } catch (SAXParseException e) {
- try {
- theTargetWriter.flush();
- } catch (IOException e1) {
-
- e1.printStackTrace();
- }
- OutputHandler.out("PARSE ERROR Zeile " + e.getLineNumber()
- + ", " + e.getMessage());
-
- }catch (SAXException e){
- try {
- theTargetWriter.flush();
- } catch (IOException e1) {
-
- e1.printStackTrace();
- }
- OutputHandler.out("PARSE EXCEPTION " + e.getMessage());
- } catch (ParserConfigurationException e) {
- OutputHandler.out("PARSER Configuration failed\n " + e.getMessage());
- }
- }
-
- }
- /**
- * Encapsulate writing to a XLIFF file
- *
- * @author Christian Schmidt 2005
- *
- */
- private class XLIFFTarget implements Target {
- File target;
-
- /**
- * Create a new Instance of XLIFFTarget
- *
- * @throws FileNotFoundException
- * @throws IOException
- */
- public XLIFFTarget() throws FileNotFoundException, IOException {
- target = FileMaker.newFile(targetString, overwrite);
- theTargetWriter = new XLIFFWriter(new BufferedOutputStream(
- new FileOutputStream(target)), CHARSET);
-
- }
-
- public DataWriter getWriter() {
-
- return theTargetWriter;
- }
- }
-
-
-} \ No newline at end of file
diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/ConverterException.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/ConverterException.java
deleted file mode 100755
index 0b630978098d..000000000000
--- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/ConverterException.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-/*
- * a simple exception
- * just to seperate
- * it from other
- * exceptions
- */
-package com.sun.star.tooling.converter;
-
-/**
- * @author Christian Schmidt
- *
- * Thrown if an error occurs during converting from one file format to another
- * that does not belong to an other exception
- */
-public class ConverterException extends Exception {
-
- /**
- *
- */
- public ConverterException() {
- super();
-
- }
-
- /**
- * @param arg0
- */
- public ConverterException(String arg0) {
- super(arg0);
-
- }
-
- /**
- * @param arg0
- */
- public ConverterException(Throwable arg0) {
- super(arg0);
-
- }
-
- /**
- * @param arg0
- * @param arg1
- */
- public ConverterException(String arg0, Throwable arg1) {
- super(arg0, arg1);
-
- }
-
-} \ No newline at end of file
diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/DataHandler.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/DataHandler.java
deleted file mode 100755
index fcc95905d3be..000000000000
--- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/DataHandler.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-/*
- * DataHandler.java
- *
- * take the data from the reader
- * and put it to the Writer
- *
- */
-
-package com.sun.star.tooling.converter;
-
-import java.util.*;
-
-/**
- * Handle the Data to get it from the Source
- * readable to the Target
- *
- * @author Christian Schmidt
- */
-public class DataHandler {
-
- /**
- * An arrays that holds the names that will be
- * keys for the HashMap containing the data
- *
- */
- private final String[] dataNames = { "BlockNr", "Project",
- "SourceFile", "Dummy", "ResType", "GID", "LID", "HID", "Platform",
- "Width", "SourceLanguageID", "SourceText", "SourceHText",
- "SourceQText", "SourceTitle", "TargetLanguageID", "TargetText",
- "TargetHText", "TargetQText", "TargetTitle", "TimeStamp" };
-
- private static final String EMPTY = new String("");
-
- /**
- * The HashMap containing the data
- */
- private final Map data = new ExtMap(dataNames, null);
-
- /** Creates a new instance of DataHandler */
- public DataHandler() {
- }
-
- /**
- * fill the data from the desired source
- *
- * @param source where to get the data from
- * @return true if data is read and false if null is read
- * @throws IOException
- * @throws ConverterException
- */
- public boolean fillDataFrom(DataReader source) throws java.io.IOException,
- ConverterException {
-
- Map line = null;
-
- line = source.getData();
- if (line == null){
-
- return false;
- }else{
-
- this.data.putAll(line);
- return true;
- }
-
-
- }
-
- /**
- * fill this data with the inData
- *
- * @param inData the data to handle by this handler
- */
- public void fillDataWith(Map inData) {
- data.putAll(inData);
- }
-
-// public void transfer(DataWriter target, DataReader source) {
-//
-// source.setHandler(this);
-//
-// }
-
- /**
- * The designated output is filled with the content of this handler
- *
- * @param output an array of Maps [0] should hold the source language data [1] the target language data
- * @throws java.io.IOException
- */
- public void putDataTo(Map[] output) throws java.io.IOException {
- String aKey = EMPTY;
- for (int j = 0; j < output.length; j++) {
- Set keys = output[j].keySet();
- Iterator iter = keys.iterator();
- while (iter.hasNext()) {
- aKey = (String) iter.next();
- output[j].put(aKey, data.get(aKey));
- }
- }
-
- }
- /**
- * The designated output is filled with the content of this handler
- *
- * @param output a Map that should hold the source language data and the target language data
- * @throws java.io.IOException
- */
- public void putDataTo(Map output) throws java.io.IOException {
- String aKey = EMPTY;
-
- Set keys = output.keySet();
- Iterator iter = keys.iterator();
- while (iter.hasNext()) {
- aKey = (String) iter.next();
- output.put(aKey, data.get(aKey));
- }
-
- }
-
-} \ No newline at end of file
diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/DataReader.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/DataReader.java
deleted file mode 100755
index d6bb2ed85d73..000000000000
--- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/DataReader.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-package com.sun.star.tooling.converter;
-
-import java.io.*;
-import java.util.*;
-
-/**
- * Gets Line counting from LineNumberReader all Converter Reader classes inherit
- * from this.
- * The abstract parent class of all converter reader classes
- *
- * @author Christian Schmidt
- */
-abstract public class DataReader extends LineNumberReader {
-
- /**
- * Creates a new instance of DataReader
- *
- * @param isr
- * InputStreamReader used as Source for this class
- */
- public DataReader(InputStreamReader isr) {
- super(isr);
- }
-
- /**
-
- * @throws java.io.IOException
- * @throws ConverterException
- *
- * TODO this should no longer use an array as return type better a Map
- *
- */
- /**
- * The next block of the SDF file is reviewed and the Line including the
- * source language and the Line including the target Language are given back
- * in an array
- *
- *
- * @return A Map including the source language
- * and the target Language content are given back
- *
- * @throws java.io.IOException
- * @throws ConverterException
- */
- public Map getData() throws java.io.IOException, ConverterException {
- return null;
- }
-
-
-} \ No newline at end of file
diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/DataWriter.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/DataWriter.java
deleted file mode 100755
index 497bb54bbdb8..000000000000
--- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/DataWriter.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-/*
- * DataWriter.java
- *
- * parent of all XXXWriter classes used by
- * Converter
- */
-
-package com.sun.star.tooling.converter;
-
-import java.io.BufferedOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-
-/**
- * The abstract parent class of all converter writer classes
- *
- * @author Christian Schmidt
- */
-abstract public class DataWriter extends OutputStreamWriter {
- protected final String seperator = new String("|");
-
- /**
- * the char sequence used as line seperator
- */
- protected final String lineEnd = java.lang.System.getProperty(
- "line.seperator", "\n");
-
- /** Creates a new instance of DataWriter */
- /**
- * @param bos the buffered output stream holding the data
- * @param encoding the encoding to use for read from bos
- * @throws java.io.UnsupportedEncodingException
- */
- public DataWriter(BufferedOutputStream bos, String encoding)
- throws java.io.UnsupportedEncodingException {
- super(bos, encoding);
- }
-
-// abstract protected void writeData(Map[] data) throws java.io.IOException;
-
- /**
- * get the data that should be written from the DataHandler
- *
- * @param handler the DataHandler having the data
- * @throws java.io.IOException
- */
- abstract protected void getDataFrom(DataHandler handler)
- throws java.io.IOException;
-
- /**
- * write the Data
- *
- * @throws java.io.IOException
- */
- abstract protected void writeData() throws java.io.IOException;
-
- /**
- * @param handler
- * @throws IOException
- */
- abstract protected void getDatafrom(DataHandler handler) throws IOException;
-} \ No newline at end of file
diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/ExtMap.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/ExtMap.java
deleted file mode 100755
index a26665e1629e..000000000000
--- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/ExtMap.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-/*
- * A special HashMap,
- * can be constructed of
- * two Arrays
- */
-package com.sun.star.tooling.converter;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author Christian Schmidt
- *
- * Create a Hash Map from two Arrays
- *
- */
-public class ExtMap extends HashMap {
-
- /**
- *
- */
- public ExtMap() {
- super();
-
- }
-
- /**
- * @see java.util.HashMap
- * @param arg0
- */
- public ExtMap(int arg0) {
- super(arg0);
-
- }
-
- /**
- * @param arg0
- * @param arg1
- */
- public ExtMap(int arg0, float arg1) {
- super(arg0, arg1);
-
- }
-
- /**
- * @param arg0
- */
- public ExtMap(Map arg0) {
- super(arg0);
-
- }
-
- // create a new Map from two string arrays
- public ExtMap(String[] names, String[] content) {
- super(names.length);
- if (content == null)
- content = new String[names.length];
- for (int i = 0; i < names.length; i++) {
- if (i >= content.length) {
- break;
- } else {
- this.put(names[i], content[i]);
- }
- }
-
- }
-
-} \ No newline at end of file
diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/FileMaker.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/FileMaker.java
deleted file mode 100755
index 600687c41d29..000000000000
--- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/FileMaker.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-/*
- * creates new files
- * checks if they exist or
- * can be overwritten
- *
- */
-package com.sun.star.tooling.converter;
-
-import java.io.File;
-import java.io.IOException;
-
-/**
- * Creates new files only if the file does not yet exist
- * or overwriting is allowed
- *
- * @author Christian Schmidt 2005
- *
- */
-public final class FileMaker {
-
- /**
- * Create a new file if overwriting is not alowed
- * ask if existing files should be overwritten
- *
- * @param fileName the files name to overwrite
- * @param overwrite indicates wether the file can be overwritten
- * @return the File created from the fileName
- * @throws IOException
- */
- public final static File newFile(String fileName, boolean overwrite)
- throws IOException {
- File file = new File(fileName);
- if (file.exists()) {
- if (!overwrite) {
- char c = 0;
-
- System.out.print("Warning: File " + fileName
- + " already exist.\n" + "Overwrite (y/n) ? :");
- byte[] waste = new byte[10];
- System.in.read(waste);
- c = (char) waste[0];
- if (c == 'y') {
- OutputHandler.out("...overwriting " + fileName);
- } else {
- OutputHandler.out(
- "\nPlease set '-o' switch at command line to overwrite.\n\nProgramm Aborted.");
- System.exit(-1);
- }
- } else {
- OutputHandler.out("...overwriting " + fileName);
- }
- } else {
- OutputHandler.out("...creating new target file " + fileName);
- }
- return file;
- }
-
-} \ No newline at end of file
diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/GSIReader.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/GSIReader.java
deleted file mode 100755
index 398fcc9b686b..000000000000
--- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/GSIReader.java
+++ /dev/null
@@ -1,247 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-/*
- * Created on 2005
- * by Christian Schmidt
- */
-package com.sun.star.tooling.converter;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.HashMap;
-import java.util.Map;
-
-import com.sun.star.tooling.languageResolver.LanguageResolver;
-import com.sun.star.tooling.languageResolver.LanguageResolver.LanguageResolvingException;
-
-/**
- * @author Christian Schmidt 2005
- *
- */
-public class GSIReader extends DataReader {
- /**
- * A Map holding an empty GSIBlock
- */
- private Map EmptyGSIBlock;
-
- /**
- * @see LanguageResolver
- */
- LanguageResolver languageResolver;
-
- /**
- * The source language identifier
- */
- protected String sourceLanguage;
-
- /**
- * The target language identifier
- */
- protected String targetLanguage;
-
- /**
- * The number of the last block
- */
- private String oldBlockNr;
-
- /**
- * A buffer holding one GSILine
- */
- private Map GSILineBuffer;
-
- /**
- * Indicates whether to use the buffered line
- */
- private boolean useBuffer = false;
-
- private static final String EMPTY = new String("");
-
- /**
- * An empty Map to fill with language depending data
- */
- private ExtMap EmptyLanguageMap;
-
- /**
- * Indicates whether the first block is read
- */
- private boolean isFirst = true;
-
- private int lineCounter;
-
- private int blockCounter;
- /**
- * Indicates whether the last line is read
- */
- private boolean lastLineFound = false;
-
- /**
- * Create a new Instance of GSIReader
- *
- * @param source
- * the file to read from
- * @param sourceLanguage
- * the sourceLanguage (must not be empty)
- * @param targetLanguage
- * the targetLanguage
- * @param charset
- * the charset used to read source
- * @throws java.io.IOException
- * @throws Exception
- */
- public GSIReader(File source, String sourceLanguage, String targetLanguage,
- String charset) throws java.io.IOException {
- super(new InputStreamReader(new FileInputStream(source), charset));
- this.languageResolver = new LanguageResolver();
- this.sourceLanguage = sourceLanguage;
- this.targetLanguage = targetLanguage;
-
- EmptyLanguageMap = new ExtMap(new String[0], new String[0]);
-
- }
-
- /**
- * Read the next GSIBlock and return the data
- *
- * @return A Map containing the data of the read GSIBlock the keys for the language depending data are the language id (numeric) the
- * single language are acessible with the keys "BlockNr", "resType", "languageNr", "status","content".
- *
- * @throws IOException
- */
- public Map getGSIData() throws IOException {
- String help;
- Map helpmap;
- Map GSIBlock = new HashMap();
- GSIBlock.put(sourceLanguage, EmptyLanguageMap.clone());
- GSIBlock.put(targetLanguage, EmptyLanguageMap.clone());
- String line = EMPTY;
- String[] splitLine;
- Map GSILine;
- String[] GSINames = { "BlockNr", "resType", "languageNr", "status",
- "content" };
-
- while (useBuffer || (line = readLine()) != null) {
-
-
-
- if (useBuffer) {
- GSILine = GSILineBuffer;
- GSIBlock.put(sourceLanguage, EmptyLanguageMap.clone());
- GSIBlock.put(targetLanguage, EmptyLanguageMap.clone());
- GSIBlock.put("BlockNr", GSILine.get("BlockNr"));
- useBuffer = false;
- } else {
- this.lineCounter++;
- if ((splitLine = split(line)) == null) {
- continue;
- }
- GSILine = new ExtMap(GSINames, splitLine);
- if (isFirst) {
- GSIBlock.put("BlockNr", GSILine.get("BlockNr"));
- oldBlockNr = (String) GSILine.get("BlockNr");
- isFirst = false;
- }
- }
- if (oldBlockNr == null) {
- oldBlockNr = (String) GSILine.get("BlockNr");
- }
- if (!oldBlockNr.equals((String) GSILine.get("BlockNr"))) {
- GSILineBuffer = GSILine;
- oldBlockNr = (String) GSILine.get("BlockNr");
- useBuffer = true;
- break;
- }
- String lang;
- try {
- // Is there the source language in this line?
- if ((lang = languageResolver.getISOfromNr((String) GSILine
- .get("languageNr"))).equals(this.sourceLanguage)) {
- // ok..store it as Source String under the depending
- // ressource type
-
- ((Map) GSIBlock.get(sourceLanguage)).put("Source"
- + ResTypeResolver.getInternKey((String) GSILine
- .get("resType")), GSILine.get("content"));
- // ..maybe the target language?
- } else {
- if (targetLanguage.equals(EMPTY)) {
- // if no target language is given at command line
- targetLanguage = lang;
- GSIBlock.put(targetLanguage, EmptyLanguageMap.clone());
- }
- if (lang.equals(this.targetLanguage)) {
-
- // ok..store it as target String under the depending
- // ressource type
- ((Map) GSIBlock.get(targetLanguage)).put("Target"
- + ResTypeResolver.getInternKey((String) GSILine
- .get("resType")), GSILine
- .get("content"));
- }
- }
- } catch (LanguageResolvingException e) {
- OutputHandler.out("Can not resolve the language "+e.getMessage());
- }
-
- }
- if (line == null) {
- if (lastLineFound){
- OutputHandler.out("\n\n");
- OutputHandler.out("GSI Blocks : " + this.blockCounter);
- OutputHandler.out("GSI Lines : " + this.lineCounter);
-
- return null;
- }else{
- lastLineFound = true;
- this.blockCounter++;
- return GSIBlock;
- }
- } else {
- this.blockCounter++;
- return GSIBlock;
- }
-
- }
-
- /**
- * Split a GSILine to single fields
- *
- * @param line
- * The line to split
- * @return An array containing the contents of the columns in the given line
- */
- private String[] split(String line) {
- String[] splitLine = (line.substring(0, line.length() - 1))
- .split("\\(\\$\\$\\)");
- if (splitLine.length != 5)
- return null;
- else
- return splitLine;
- }
-
-}
diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/GSIWriter.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/GSIWriter.java
deleted file mode 100755
index 0f7aee811569..000000000000
--- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/GSIWriter.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-package com.sun.star.tooling.converter;
-import java.io.*;
-import java.util.Map;
-
-import com.sun.star.tooling.languageResolver.LanguageResolver;
-import com.sun.star.tooling.languageResolver.LanguageResolver.LanguageResolvingException;
-/**
- *
- * @author cs156069
- */
-public class GSIWriter extends DataWriter {
- /**
- * The seperator used to seperate GSI columns
- */
- final String seperator=new String("($$)");
-
- /**
- * Holding the keys used by a map holding the content of an GSI Line contianing the source language
- */
- final static String[] sourceLineNames= {"Project","SourceFile","Dummy","ResType","GID","LID","HID","Platform","Width","SourceLanguageID","SourceText","SourceHText","SourceQText","SourceTitle","TimeStamp"};
- /**
- * Holding the keys used by a map holding the content of an GSI Line contianing the target language
- */
- final static String[] targetLineNames= {"Project","SourceFile","Dummy","ResType","GID","LID","HID","Platform","Width","TargetLanguageID","TargetText","TargetHText","TargetQText","TargetTitle","TimeStamp"};
- /**
- * Holding the keys used by a map holding the content of an GSI Line contianing the source and the target language
- */
- final static String[] outLineNames= {"BlockNr","Project","SourceFile","Dummy","ResType","GID","LID","HID","Platform","Width","SourceLanguageID","SourceText","SourceHText","SourceQText","SourceTitle","TargetLanguageID","TargetText","TargetHText","TargetQText","TargetTitle","TimeStamp"};
-
- /**
- * A map holding the content of an GSI Line contianing the source language
- */
- private ExtMap sourceLine=new ExtMap(sourceLineNames,null);
- /**
- * A map holding the content of an GSI Line contianing the target language
- */
- private ExtMap targetLine=new ExtMap(targetLineNames,null);
- /**
- * A map holding the content of an GSI Line contianing the source and the target language
- */
- private ExtMap outData=new ExtMap(outLineNames, null);
-
- private static final String EMPTY = new String("");
- /**
- * The sourceLanguage to use
- */
- private String sourceLanguage;
- /**
- * The sourceLanguage to use
- */
- private String targetLanguage;
-
- /**
- * GSILines have a special Line End
- */
- private final static String lineEnd="!"+'\r'+'\n';
- //private boolean SourceIsFirst=false;
-
- /**
- * The blockNr of the current line
- */
- private String blockNr;
-
-
-
-
- /**
- * Create a new Instance of GSIWriter
- *
- * @param bos the Buffered Output Stream to write to
- * @param charset the used charset
- * @throws java.io.UnsupportedEncodingException
- */
- public GSIWriter(BufferedOutputStream bos,String charset) throws java.io.UnsupportedEncodingException {
- super(bos,charset);
-
-
-
- }
-
- /* (non-Javadoc)
- * @see com.sun.star.tooling.converter.DataWriter#writeData()
- */
- public final void writeData() throws java.io.IOException {
-
- StringBuffer buffer=new StringBuffer("");
- if(this.sourceLanguage==null&&this.targetLanguage==null){
- LanguageResolver lang =new LanguageResolver();
- try {
- this.sourceLanguage=lang.getNrFromISO((String)outData.get("SourceLanguageID"));
- this.targetLanguage=lang.getNrFromISO((String)outData.get("TargetLanguageID"));
- } catch (LanguageResolvingException e) {
-
- OutputHandler.out(e.getMessage());
- System.exit(0);
- }
- }
-
-
- this.blockNr=(String)outData.get("BlockNr");
- // get the values of the found fields
- //create the gsi lines
- //
- //at first the source language line
- buffer.append(getSourceLine("Text"));
- buffer.append(getSourceLine("HText"));
- buffer.append(getSourceLine("QText"));
- buffer.append(getSourceLine("Title"));
-
- //now the target language line
- // put them together for output
- buffer.append(getTargetLine("Text"));
- buffer.append(getTargetLine("HText"));
- buffer.append(getTargetLine("QText"));
- buffer.append(getTargetLine("Title"));
- //ok...put all to disk;
- this.write(buffer.toString());
-
- }
-
- /**
- * Create a line containing the source string from the data
- * @param resType
- * @return The StringBuffer containing the line
- */
- private StringBuffer getSourceLine(String resType){
- StringBuffer buffer =new StringBuffer(200);
- String resString = "Source"+resType;
-
- String help;
- if(EMPTY.equals((String)outData.get(resString))||" ".equals(outData.get(resString))) return new StringBuffer(EMPTY);
- else {
- // put them together for output
- buffer.append(this.blockNr);
- // seperate the fields with ($$)
- buffer.append(this.seperator);
- buffer.append(ResTypeResolver.getExternKey(resType));
- // seperate the fields with ($$)
- buffer.append(this.seperator);
- buffer.append(this.sourceLanguage);
- // seperate the fields with ($$)
- buffer.append(this.seperator);
- buffer.append("int");
- // seperate the fields with ($$)
- buffer.append(this.seperator);
- buffer.append(outData.get(resString));
-
- // this line is full
- // so close it with '! cr lf'
- buffer.append(GSIWriter.lineEnd);
- Converter.countLine();
- return buffer;
- }
-
- }
- /**
- * Create a line containing the target string from the data
- * @param resType
- * @return The StringBuffer containing the line
- */
- private StringBuffer getTargetLine(String resType){
- StringBuffer buffer =new StringBuffer(200);
- String resString = "Target"+resType;
-
- if(EMPTY.equals((String)outData.get(resString))||" ".equals(outData.get(resString))) return new StringBuffer(EMPTY);
- else {
- // put them together for output
- buffer.append(this.blockNr);
- // seperate the fields with ($$)
- buffer.append(this.seperator);
- buffer.append(ResTypeResolver.getExternKey(resType));
- // seperate the fields with ($$)
- buffer.append(this.seperator);
- buffer.append(this.targetLanguage);
- // seperate the fields with ($$)
- buffer.append(this.seperator);
- buffer.append("ext");
- // seperate the fields with ($$)
- buffer.append(this.seperator);
- buffer.append(outData.get(resString));
-
- // this line is full
- // so close it with '! cr lf'
- buffer.append(GSIWriter.lineEnd);
- Converter.countLine();
- return buffer;
- }
-
- }
-
-
- /* (non-Javadoc)
- * @see com.sun.star.tooling.converter.DataWriter#writeData(java.util.Map[])
- */
- protected void writeData(Map[] data) throws IOException {
- // TODO redesign DataHandler in the way that this is not nessesary any more
-
- }
-
- /* (non-Javadoc)
- * @see com.sun.star.tooling.converter.DataWriter#getDataFrom(com.sun.star.tooling.converter.DataHandler)
- */
- protected void getDataFrom(DataHandler handler) throws IOException {
-
- handler.putDataTo(this.outData);
- }
-
- /* (non-Javadoc)
- * @see com.sun.star.tooling.converter.DataWriter#getDatafrom(com.sun.star.tooling.converter.DataHandler)
- */
- protected void getDatafrom(DataHandler handler) throws IOException {
-
- handler.putDataTo(this.outData);
-
- }
-}
diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/GSIandSDFMerger.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/GSIandSDFMerger.java
deleted file mode 100755
index 526f3ca75640..000000000000
--- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/GSIandSDFMerger.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-/*
- * Created on 2005
- * by Christian Schmidt
- */
-package com.sun.star.tooling.converter;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Merge GSIFiles back to to the original (!) SDFFile
- *
- *
- * @author Christian Schmidt 2005
- *
- */
-public class GSIandSDFMerger extends SDFReader {
-
- int lineCounter=0;
-
- GSIReader gsiReader;
-
- private Map temp=new HashMap();
- private int j;
- private boolean skip=true;
- Map gsiBlock=null;
- Map sdfBlock=null;
-
- private boolean dontLoadGSI=false;
-
- private int count;
- /**
- * Merge the GSIFile back to the original(!) SDFFile
- *
- * @param source the file to read from
- * @param sourceLanguage the source language in the source file
- * @param targetLanguage the target language in the source file
- * @param charset the charset of the files
- * @throws java.io.IOException
- * @throws Exception
- */
- public GSIandSDFMerger(File source, File secondSource,String sourceLanguage,
- String targetLanguage, String charset) throws IOException {
- // merging GSI and SDF requieres two Sources
- //this. is the SDF source
- super(secondSource, sourceLanguage, targetLanguage, charset);
- //create the GSI Source
-
- gsiReader=new GSIReader(source,sourceLanguage,targetLanguage,charset);
-
- }
-
- /* (non-Javadoc)
- * @see com.sun.star.tooling.converter.DataReader#getData()
- */
- public Map getData()throws java.io.IOException{
- do{
- skip=false;
- this.temp=matchGSI();
- }while(skip);
- if(temp==null){
- OutputHandler.out("Blocks merged : "+this.lineCounter);
- }
- return temp;
-
- }
-
- /**
- * Read each block of the GSIFile and check whether there is a matching
- * block in the SDFFile. Match depends on the BlockNr and BlockId.
- *
- * @return A Map that contains the source language content
- * and the target language content.
- * @throws IOException
- * @throws ConverterException
- */
- public Map matchGSI() throws IOException{
-
-
- try {
- //System.out.println("Start...");
-
- if (dontLoadGSI||(gsiBlock=gsiReader.getGSIData())!=null){
- dontLoadGSI=false;
- //check if we must update this block
- //if so its BlockNr is in the gsi file
- if((sdfBlock = super.getData())!=null){
-
- if(((String)sdfBlock.get("BlockNr")).equals((String)gsiBlock.get("BlockNr"))){
-
- gsiBlock.remove(EMPTY);
- //if the target language string is empty this may be caused by an error in the source sdf File
- //I don't want to overwrite a possibly correct translation with an empty string
- // so remove the target part from the gsiBlock
- Map mp=(Map)gsiBlock.get(gsiReader.targetLanguage);
- if (mp.size()!=0&&!((String)mp.get("TargetText")).equals("")){
-
- // target language part in this gsiBlock
-// if(((String)mp.get("TargetText")).equals("")){
-// gsiBlock.remove(targetLanguage);
-// }
- // count the merged blocks
- lineCounter++;
- Map helpMap = (Map)gsiBlock.get(super.targetLanguage);//"ja"
- sdfBlock.putAll(helpMap);
- skip=false;
- }else{
- //no target language part in this gsiBlock
- skip=true;
-//
-// return null;
- }
- }else{
-// skip=true;
-//
-// // we cant match this gsi block to the current sdf block
- // try matching the next sdf block with this gsi line
- dontLoadGSI=true;
- }
- }
- return sdfBlock;
- }
-
- } catch (IOException e) {
-
- e.printStackTrace();
- }
- return null;
- }
-
-
-
-
-
-
-}
diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/LineErrorException.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/LineErrorException.java
deleted file mode 100755
index 26ce5a6518eb..000000000000
--- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/LineErrorException.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-/*
- * Exception for errors in
- * SDFLines
- */
-package com.sun.star.tooling.converter;
-
-
-/**
- * This Exeption is thrown if a DataReader finds an error in a read Line
- * f. e. wrong column number
- *
- * @author Christian Schmidt 2005
- *
- */
-public class LineErrorException extends Exception {
-
- public int tokenCount;
- /**
- *
- */
- public LineErrorException() {
- super();
-
- }
-
- /**
- * @param arg0
- */
- public LineErrorException(String arg0) {
- super(arg0);
-
- }
-
- /**
- * @param arg0
- */
- public LineErrorException(Throwable arg0) {
- super(arg0);
-
- }
-
- /**
- * @param arg0
- * @param arg1
- */
- public LineErrorException(String arg0, Throwable arg1) {
- super(arg0, arg1);
-
- }
-
-
-} \ No newline at end of file
diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/OutputHandler.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/OutputHandler.java
deleted file mode 100755
index 997a522acedb..000000000000
--- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/OutputHandler.java
+++ /dev/null
@@ -1,225 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-/*
- * Creates logfile and file for debug information
- *
- */
-package com.sun.star.tooling.converter;
-
-import java.io.BufferedWriter;
-import java.io.IOException;
-
-/**
- * Handle the whole output during converting process except the converted files.
- * Write output to logfiles and to screen depending on switches given
- * at command line.
- * @author Christian Schmidt 2005
- *
- */
-public class OutputHandler {
-
- private static final String EMPTY = "";
-
- /**
- * The logfile to write
- */
- public static BufferedWriter logFile;
-
- /**
- * Indicates whether excisting files should be overwritten
- */
- public static boolean doLog = false;
-
- /**
- * Indicate whether the debug information should be written
- */
- public static boolean doDebug = false;
-
- /**
- * The File to write the debug information to
- */
- public static BufferedWriter dbgFile;
-
- /**
- * Write the data to screen and if the switches were set to
- * logfile and debugfile
- *
- * @param out the String to write
- */
- final static void out(String out) {
- try {
- if (doDebug)
- OutputHandler.dbg(out);
-
- if (!doLog || logFile == null) {
- System.out.println(out);
- } else {
- System.out.println(out);
- if (EMPTY.equals(out)) {
- OutputHandler.log(EMPTY);
- } else {
- OutputHandler.log(out);
- }
- }
- } catch (IOException e) {
-
- OutputHandler.log(e.toString());
- }
- }
-
- /**
- * make a dot on the screen to show the user that it is going on
- */
- final static void printDot() {
- System.out.print(".");
-
- }
-
- /**
- * write the data to log file and if the switch is set
- * to the debug file
- *
- * @param out the String to write
- */
- final static void log(String out) {
- try {
- if(out==null) return;
- if (doDebug)
-
- OutputHandler.dbg(out);
-
- if (doLog) {
- if (!EMPTY.equals(out)) {
- logFile.write(out);
- }
- logFile.newLine();
- logFile.flush();
- }
- } catch (IOException e) {
-
- System.out.println(e.getMessage());
- }
- }
-
- /**
- * write the string to the debug file
- *
- * @param out the String to write
- * @throws IOException
- */
- final static void dbg(String out) throws IOException {
- if(out==null) return;
- if (doDebug) {
- if (!EMPTY.equals(out)) {
- dbgFile.write(out);
-
- }
- dbgFile.newLine();
- dbgFile.flush();
- }
- }
-
- /**
- * Set a new value to indicate whether a debug file should be written or not
- *
- * @param doDebug
- * The debug value to set.
- */
- private static void setDebug(boolean doDebug) {
- OutputHandler.doDebug = doDebug;
- }
-
- // /**
- // * @return Returns the doDebug.
- // */
- // private static boolean isDebug() {
- // return doDebug;
- // }
-
- /**
- * Set the debug file to write to.
- *
- * @param dbgFile
- * The debug File to use.
- */
- private static void setDbgFile(BufferedWriter dbgFile) {
- OutputHandler.dbgFile = dbgFile;
- }
-
- /**
- * @return Returns the debug File.
- */
- private static BufferedWriter getDbgFile() {
- return dbgFile;
- }
-
- /**
- * @param doLog
- * The log value to set.
- */
- private static void setLog(boolean doLog) {
- OutputHandler.doLog = doLog;
- }
-
- /**
- * @return Returns the log value.
- */
- private static boolean isLog() {
- return doLog;
- }
-
- /**
- * @param logFile
- * The logFile to set.
- */
- private static void setLogFile(BufferedWriter logFile) {
- OutputHandler.logFile = logFile;
- }
-
- /**
- * @return Returns the logFile.
- */
- private static BufferedWriter getLogFile() {
- return logFile;
- }
-
- /**
- * @throws IOException
- * close log and dbg
- */
- public static void closeAll() throws IOException {
- if (OutputHandler.logFile != null) {
- OutputHandler.logFile.flush();
- OutputHandler.logFile.close();
- }
- if (OutputHandler.dbgFile != null) {
- OutputHandler.dbgFile.flush();
- OutputHandler.dbgFile.close();
- }
- }
-
-} \ No newline at end of file
diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/ResTypeResolver.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/ResTypeResolver.java
deleted file mode 100755
index 585f69fe2c88..000000000000
--- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/ResTypeResolver.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-/*
- * Created on 2005
- * by Christian Schmidt
- */
-package com.sun.star.tooling.converter;
-
-import java.util.Map;
-
-/**
- * Helps resolving restype descriptors used outside the tool to
- * restype descriptors used by this tool
- *
- * @author Christian Schmidt 2005
- *
- */
-public class ResTypeResolver {
- final static String[] inFields={"Text","QText","HText","Title"};
- final static String[] outFields={"res","res-quickhelp","res-help","res-title"};
- final static Map internKeys=new ExtMap(inFields,outFields);
- final static Map externKeys=new ExtMap(outFields,inFields);
-
- /**
- * Get the intern key depending to the given extern key
- *
- * @param externKey the externKey {"res","res-quickhelp","res-help","title"}
- * @return the depending intern key
- */
- public static String getInternKey(String externKey){
- return (String)externKeys.get(externKey);
- }
-
- /**
- * Get the extern key to the given intern key
- *
- * @param internKey the internal key
- * @return the external key
- */
- public static String getExternKey(String internKey){
- return (String)internKeys.get(internKey);
- }
-
-}
diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/Resolver.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/Resolver.java
deleted file mode 100755
index 557731fe88f1..000000000000
--- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/Resolver.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-/*
- * Created on 27.01.2005
- *
- */
-package com.sun.star.tooling.converter;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.xml.sax.EntityResolver;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-/**
- * Resolve external entities by provide the
- * XLIFF DTD stored in the jar file
- */
-public class Resolver implements EntityResolver {
-
- /**
- * Resolver constructor.
- */
- public Resolver() {
- }
-
- /**
- * Allow the application to resolve external entities.
- *
- * The Parser will call this method before opening any external entity
- * except the top-level document entity (including the external DTD subset,
- * external entities referenced within the DTD, and external entities
- * referenced within the document element): the application may request that
- * the parser resolve the entity itself, that it use an alternative URI, or
- * that it use an entirely different input source.
- */
-
- /* (non-Javadoc)
- * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String)
- */
-
- public InputSource resolveEntity(String publicId, String systemId)
- throws SAXException, IOException {
-
- if ((publicId != null) && (publicId.equals("-//XLIFF//DTD XLIFF//EN"))) {
- systemId = "dtd:///xliff.dtd";
- }
- if (systemId != null) {
- if (systemId.startsWith("dtd://")) {
- String dtd = "com/sun/star/tooling/converter/dtd"
- + systemId.substring(6);
- ClassLoader cl = this.getClass().getClassLoader();
- InputStream in = cl.getResourceAsStream(dtd);
- InputSource ins = new InputSource(in);
- ins.setSystemId(systemId);
- return ins;
- } /*
- * else if ( systemId.startsWith("jar:") ) { try { URL url=new
- * URL(systemId); JarURLConnection jarConn =
- * (JarURLConnection)url.openConnection(); InputSource ins=new
- * InputSource(jarConn.getInputStream());
- * ins.setSystemId(systemId); return ins; }
- * catch(MalformedURLException me){ throw new SAXException(me);
- * Incorrect URL format used } }
- */
- }
- return null;
- }
-
-} \ No newline at end of file
diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/SDFReader.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/SDFReader.java
deleted file mode 100755
index 9e47ae73c719..000000000000
--- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/SDFReader.java
+++ /dev/null
@@ -1,632 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-/*
- * SDFReader.java
- *
- *
- */
-
-package com.sun.star.tooling.converter;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.text.DecimalFormat;
-import java.util.*;
-
-/**
- *
- * SDFReader is a FileReader that knows about
- * the content of SDFFiles
- *
- * A SDFBlock is read of the given file. A SDFBlock
- * consists of all SDFLines that are traanslations of the
- * same String and the SDFLine containing the source string
- * itself. SDFFile lines are read and checked whether they
- * have the allowed column count and don't contain illeagal
- * characters (like most unprintable characters below 0x00df).
- * If the given source language is not found in the first
- * block of SDFLines a ConverterException is thrown at runtime.
- * If the given target language is "" (that means not given)
- * the first language that is not the given source language
- * is taken for target language. The found values are returned in HashMaps that
- * use the following keys:
- * <br/>
- * "BlockNr" originally coming from reading the sdf file, contains 'block nr in sdf file'+'-'+'hash value of the sdf id fields'.<br/>
- * "Project" first column in sdf file format.<br/>
- * "SourceFile" second column in sdf file format.<br/>
- * "Dummy" third column in sdf file format.<br/>
- * "ResType" 4. column in sdf file format.<br/>
- * "GID" 5. column in sdf file format. <br/>
- * "LID" 6. column in sdf file format.<br/>
- * "HID" 7. column in sdf file format.<br/>
- * "Platform" 8. column in sdf file format. <br/>
- * "Width", 9. column in sdf file format.<br/>
- * "SourceLanguageID" 10. column in sdf file format(in the line with the source language).<br/>
- * "SourceText" 11. column in sdf file format(in the line with the source language).<br/>
- * "SourceHText" 12. column in sdf file format(in the line with the source language).<br/>
- * "SourceQText" 13. column in sdf file format(in the line with the source language).<br/>
- * "SourceTitle" 14. column in sdf file format(in the line with the source language).<br/>
- * "TargetLanguageID" 10. column in sdf file format (in the line with the target language).<br/>
- * "TargetText" 11. column in sdf file format (in the line with the target language).<br/>
- * "TargetHText" 12. column in sdf file format (in the line with the target language).<br/>
- * "TargetQText" 13. column in sdf file format (in the line with the target language).<br/>
- * "TargetTitle", 14. column in sdf file format (in the line with the target language).<br/>
- * "TimeStamp" 15. column in sdf file format.<br/>
- *
- * @author Christian Schmidt 2005
- *
- */
-
-public class SDFReader extends DataReader {
-
- /**
- * an array of the SDF files column names
- */
- final static String[] fieldnames = { "Project", "SourceFile", "Dummy",
- "ResType", "GID", "LID", "HID", "Platform", "Width", "LanguageID",
- "Text", "HText", "QText", "Title", "TimeStamp" };
-
- /**
- * an array of the SDF files column names if the source language is in
- */
- final static String[] sourceLineNames = { "Project", "SourceFile", "Dummy",
- "ResType", "GID", "LID", "HID", "Platform", "Width",
- "SourceLanguageID", "SourceText", "SourceHText", "SourceQText",
- "SourceTitle", "TimeStamp" };
-
- /**
- * an array of the SDF files column names if the target language is in
- */
- final static String[] targetLineNames = { "Project", "SourceFile", "Dummy",
- "ResType", "GID", "LID", "HID", "Platform", "Width",
- "TargetLanguageID", "TargetText", "TargetHText", "TargetQText",
- "TargetTitle", "TimeStamp" };
-
- final static String EMPTY = new String("");
-
- private int dotCount = 0;
-
- /**
- * a Map containing an SDF line with source language
- */
- private Map sourceMap;
-
- /**
- * a Map containing an SDF line with target language
- */
- private Map targetMap;
-
- /**
- * a Map containing an SDF
- */
- private Map SDFMap;
-
- /**
- * a Map Array containing one SDF source language line and one SDF target
- * language line
- */
- private Map[] data = { sourceMap, targetMap };
-
- /**
- * The Id of the current SDFBlock
- */
- private String CurrentBlockId;
-
- /**
- * The SDF file to read from
- */
- private File sourceFile;
-
- /**
- * The language in the source file that should be handelt as source language
- */
- protected String sourceLanguage;
-
- /**
- * The language in the source file that should be handelt as target language
- */
- protected String targetLanguage;
-
- /**
- * A counter holding the number of blocks just read
- * from this file
- */
- private long blockNr = 0;// If we use Integer, more then numbers greater than 128k would be signed
-
- /**
- * A counter holding the number of skipped lines that means
- * lines that can not be worked with because they contain an error
- */
- private int skippedLines = 0;
-
- /**
- * This switch is set for indicating that all source file lines
- * are read and no lines remain buffered. Finding this like 'true'
- * means the source file is finished
- */
- private boolean endIt = false;
-
- /**
- * Indicates whether the targetLanguage is found in this source file so far
- */
- private boolean foundTarget = false;
- /**
- * Indicates whether the sourceLanguage is found in this source file so far
- */
- private boolean foundSource = false;
-
- /**
- * Counts how many lines were skipped because the language is
- * neither sourceLanguage nor targetLanguage
- */
- private int langMiss;
-
- /**
- * Indicates whether there is a line in the read buffer or not
- */
- private boolean useBuffer = false;
-
- /**
- * A buffer for SDFLines
- */
- private String lineBuffer;
-
- /**
- * The buffer for the already splitted SDFLines
- */
- private String[] splittedLineBuffer;
-
- /**
- * Counts how many Blocks were skipped
- * f.e. because no sourceLanguage is found
- * in it
- */
- private int skippedBlocks;
-
- /**
- * Counts the blocks without targetLanguage
- */
- private int targetLangMiss;
-
- /**
- * Counts the blocks without sourceLanguage
- */
- private int sourceLangMiss;
-
- /**
- * Counts the lines where no targetLanguage line was found
- * and so empty lines were created
- */
- private int targetLangCreate;
-
-
- DecimalFormat blockNrFormatter = new DecimalFormat("000000");
-
- /**
- * The hashcode of the current block
- */
- private int CurrentBlockHash;
-
- private boolean skip;
-
- /**
- * Create a new Instance of SDFREader
- *
- * @param source the file to read from
- * @param sourceLanguage the sourceLanguage (must not be empty)
- * @param targetLanguage the targetLanguage
- * @param charset the charset used to read source
- * @throws java.io.IOException
- * @throws Exception
- */
- public SDFReader(File source, String sourceLanguage, String targetLanguage,
- String charset) throws java.io.IOException {
- super(new InputStreamReader(new FileInputStream(source), charset));
- sourceFile = source;
- this.sourceLanguage = sourceLanguage;
- this.targetLanguage = targetLanguage;
- String line;
- String[] splitLine;
- //read first line to get the first
- //SDF block id
- mark(16000);
- if ((line = readLine()) != null) {
- if ((splitLine = split(line)) != null){
- this.CurrentBlockId = getSDFBlockId(splitLine);
- this.CurrentBlockHash=this.CurrentBlockId.hashCode();
- //found the first
- this.blockNr++;
- }
- this.splittedLineBuffer = splitLine;
- }
- reset();
-
- }
-
- /* (non-Javadoc)
- * @see com.sun.star.tooling.converter.DataReader#getData()
- */
- public Map getData()throws IOException {
-
- Map map=new HashMap();
-// do {
- this.skip=false;
- Map[] help=readBlock();
- if(help==null||help[1]==null||help[0]==null){
- return null;
-// }else if (help[1].get("TargetLanguageID")==null||help[0].get("SourceLanguageID")==null) {
-// OutputHandler.log("Missing Language Id in block "+blockNr+"\nthe block is skipped." );
-// this.skippedBlocks++;
-// this.skip=true;
- }else{
- map.putAll(help[1]);
- map.putAll(help[0]);
-
- }
-// }while(this.skip=true);
- return map;
- }
-
-
- /**
- * Read a Block from the sdf file and return
- * @return a Map[] where [0] holds the source and [1] the target language data.
- *
- * @throws java.io.IOException
- */
- public Map[] readBlock() throws java.io.IOException {
- String line = EMPTY;
- String blockId = EMPTY;
- String[] splittedLine = null;
- data[0]=new ExtMap();
- data[1]=new ExtMap();
- String help;
- String c = null;
- //read next line or use buffered line
- while (useBuffer || (line = readLine()) != null) { //works because '||' is shortcut
-
- try {
- // buffer used?
- if (useBuffer) {
- line = this.lineBuffer;
- splittedLine = this.splittedLineBuffer;
- this.SDFMap = new ExtMap(SDFReader.fieldnames, splittedLine);
-
- try {
- checkLanguage(splittedLine);
- } catch (ConverterException e) {
- throw e;
- }finally{
-
- useBuffer = false;
- }
- } else {
- //...are there wrong characters?
- if ((check(line)).length() < line.length()) {
- throw new LineErrorException(getLineNumber()
- + " : Line contains wrong character "
- //+ Integer.toHexString(Integer.parseInt(c))
- + " \n" + line);
- }
- //...is the number of columns ok?
- if ((splittedLine = split(line)) == null) {
-
- throw new LineErrorException(super.getLineNumber()
- + " : Line has wrong column number \n" + line);
- //continue;
- } else {
- // TODO makeDot is better in Data Handler
- makeDot();
- // ...is this line in a new SDF block ?
- if ((blockId = getSDFBlockId(splittedLine))
- .equals(CurrentBlockId)) {
-
- this.SDFMap = new ExtMap(SDFReader.fieldnames,
- splittedLine);
- //what language is in it ?
- checkLanguage(splittedLine);
-
- } else {
-
- /*
- * we found the next block , but do we have the
- * target text?
- */
-
- if (!foundTarget) {
- createTargetLine();
- }
-
- blockNr++;
- splittedLineBuffer = splittedLine;//read one line
- // too much so
- // buffer it
- lineBuffer = line;
- useBuffer = true;//reset();
-
- this.CurrentBlockId = blockId;
- this.CurrentBlockHash=this.CurrentBlockId.hashCode();
-
- /* ...and what about the source text ? */
- if (!foundSource) {
-
- OutputHandler
- .log("Error in Line:"
- + getLineNumber()
- + "Source Language is missing maybe "
- + "previous block has an error.\nBlock "
- + (blockNr - 1)
- + " is skipped. before line: \n"
- + line);
-
- foundTarget = false;//no target without source
- skippedBlocks++;
- skippedLines++;
- sourceLangMiss++;
- continue;// skip output of this block if no
- // source language is found
-
- }
-
- break;
-
- }
- }
-
- }
-
- } catch (LineErrorException e) {
-
- OutputHandler.log(e.getMessage());
- this.skippedLines++;
- } catch (ConverterException e) {
- OutputHandler.log(e.getMessage());
- }
-
- }
- // did we read the whole stuff?
- if (null != line) {
- // no
- foundSource = false;
- foundTarget = false;
-
- return this.data;
-
- } else {
- // ok , its the end but is everything written now?
- if (!endIt) {
- // there is something to write
- // but next time we can end it
- endIt = true;
- if(!foundTarget){
- createTargetLine();
- }
- // write
- return this.data;//last lines
- } else {
-
- showStat();
- return null;
- }
- }
- // }catch(ConverterException e) {
- // Converter.log(e.getMessage());
- // return null;
- // }
- }
-
- /**
- *
- */
- private void createTargetLine() {
- targetLangMiss++;
- // if not, create one ...
- data[1] = new ExtMap(SDFReader.targetLineNames,
- splittedLineBuffer);
- data[1].put("TargetLanguageID",
- this.targetLanguage);
- if ((String) data[1].get("TargetText") != EMPTY)
- data[1].put("TargetText", EMPTY);
- if ((String) data[1].get("TargetHText") != EMPTY)
- data[1].put("TargetHText", EMPTY);
- if ((String) data[1].get("TargetQText") != EMPTY)
- data[1].put("TargetQText", EMPTY);
- if ((String) data[1].get("TargetTitle") != EMPTY)
- data[1].put("TargetTitle", EMPTY);
- this.data[1].put("BlockNr", blockNrFormatter.format(blockNr)+'-'+Integer.toString(this.CurrentBlockHash));
- targetLangCreate++;
- }
-
- /**
- * Show the statistic information got while
- * reading the file
- *
- * @throws IOException
- */
- private void showStat() throws IOException {
- OutputHandler.out(EMPTY);OutputHandler.out(EMPTY);
- // OutputHandler.out("Hashes: " + (theHashes.size()) + " ");
- OutputHandler.out("Blocks found: " + blockNr + " ");
- OutputHandler.out(EMPTY);
- OutputHandler.out("Lines read: " + (getLineNumber()) + " ");
- OutputHandler
- .dbg("Lines created " + (targetLangCreate) + " ");
- OutputHandler.dbg(" -------");
- OutputHandler.dbg("Lines total: "
- + (getLineNumber() + targetLangCreate) + " ");
- OutputHandler.dbg("Lines skipped: " + skippedLines + " ");
-
- OutputHandler.dbg("Source Language misses: " + sourceLangMiss + " ");
- OutputHandler.dbg("Target Language misses: " + targetLangMiss + " ");
- OutputHandler.dbg("Blocks found: " + blockNr + " ");
- OutputHandler.dbg("Blocks skipped: " + skippedBlocks + " ");
- if ((sourceLangMiss + skippedBlocks + skippedLines) > 0)
- OutputHandler.out("\n---! Errors found !--- view Logfile.\n\n"
- + "To enable logfile use -l option at command line.\n"
- + "For help type 'convert -h {Enter}'.\n");
- }
-
- /**
- * Check the current line whether the source language
- * or target language is in it
- *
- * @throws ConverterException if a not needed language or no target language is found
- * in this block
- * @throws IOException
- *
- */
- final private void checkLanguage(String[] splittedLine)
- throws ConverterException, IOException {
- String langID = (String) SDFMap.get("LanguageID");
-
- //maybe the source language is in this line
- if (!foundSource && this.sourceLanguage.equals(langID)) {
-// found the next source language line
- this.data[0] = new ExtMap(SDFReader.sourceLineNames, splittedLine);
-
-// this.data[0].put("BlockNr", Integer.toHexString(blockNr));
-// this.data[0].put("BlockHash", Integer.toHexString(this.CurrentBlockHash));
- this.data[0].put("BlockNr", blockNrFormatter.format(blockNr)+'-'+Integer.toHexString(this.CurrentBlockHash));
-// this.data[0].put("BlockHash", blockHashFormatter.format(this.CurrentBlockHash));
- foundSource = true;
- return;
-
- } else {
- // or the target language is in this line
- if (!foundTarget) {
- //no target language is given at command line
- if (this.targetLanguage.equals(EMPTY)) {
- //try if we can use the current lines language for target
- // language
- if (!langID.equals(this.sourceLanguage)) {
- //yes , we can use this lines laanguage as target
- this.targetLanguage = langID;
-
- //source and target language both are known: show it
- OutputHandler.out("Source Language is: "
- + this.sourceLanguage + " ");
- OutputHandler.out("Target Language is: "
- + this.targetLanguage + " ");
- OutputHandler.out(EMPTY);
- System.out.println("Start");
-
- } else {
- throw new ConverterException("(" + getLineNumber()
- + ") No target language found: "
- + this.targetLanguage);
- }
- }
- if (this.targetLanguage.equals(langID)) {
- this.data[1] = new ExtMap(SDFReader.targetLineNames,
- splittedLine);// found the next target language line
- this.data[1].put("BlockNr", blockNrFormatter.format(blockNr)+'-'+Integer.toHexString(this.CurrentBlockHash));
- foundTarget = true;
-
- return;
- }
- }//end !foundTarget
- }
- //if we go here we dont need the found language...
- throw new ConverterException("found not needed language '"
- + this.SDFMap.get("LanguageID") + "' in Line: "
- + getLineNumber());
-
- }
-
- /**
- * Make a dot on the screen to show the user that it is going on
- */
- private void makeDot() {
- int count = 0;
- if ((count = (int) super.getLineNumber() / 1000) > this.dotCount) {
- this.dotCount = count;
- OutputHandler.printDot();
- }
-
- }
-
- /**
- * split the SDFLine in its columns
- *
- * @param line the current SDFLine
- * @return the splitted SDFLine as array of String
- * or null if an error occours
- * @throws IOException
- */
- private String[] split(String line) throws IOException {
- check(line);
- String[] splitLine;
- if ((splitLine = line.split("\t")).length == 15)
- return splitLine;
- else
- //an error occured
- return null;
- }
-
- /**
- * create a block Id from a splitted SDFLine
- * the blockId consists of the column one to eight of an SDF File
- *
- * @param splitLine the line to create a block id from
- * @return the blockId as String
- */
- private String getSDFBlockId(String[] splitLine) {
- StringBuffer BlockId = new StringBuffer("");
- for (int i = 0; i < 8; i++) {
- BlockId.append(splitLine[i]);
- }
- return BlockId.toString();
- }
-
-// public final boolean canRead() {
-// return this.sourceFile.canRead();
-// }
-
- /**
- * Check if there are not allowed characters in this line
- *
- * @param line the SDFLine to check
- * @return if everything, ok the original
- * else the wrong character as String
- *
- * @throws java.io.IOException
- */
- private String check(String line) throws java.io.IOException {
- char c = ' ';
- for (int i = 0; i < line.length(); i++) {
- c = line.charAt(i);
- if (c < 30 && c != 9) {
- return (new Character(c)).toString();
- }
-
- }
- return line;
-
- }
-} \ No newline at end of file
diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/SDFWriter.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/SDFWriter.java
deleted file mode 100755
index 4c79cd113f6f..000000000000
--- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/SDFWriter.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-/*
- * SDFWriter.java
- *
- *
- */
-
-package com.sun.star.tooling.converter;
-import java.io.*;
-import java.util.Map;
-
-/**
- * Write data to a SDFFile
- *
- * @author Christian Schmidt 2005
- *
- */
-public class SDFWriter extends DataWriter {
- /**
- * the seperator the seperate columns
- */
- final String seperator=new String("\t");
- /**
- * an array of the SDF files column names if the source language is in
- */
- final static String[] sourceLineNames= {"Project","SourceFile","Dummy","ResType","GID","LID","HID","Platform","Width","SourceLanguageID","SourceText","SourceHText","SourceQText","SourceTitle","TimeStamp"};
- /**
- * an array of the SDF files column names if the target language is in
- */
- final static String[] targetLineNames= {"Project","SourceFile","Dummy","ResType","GID","LID","HID","Platform","Width","TargetLanguageID","TargetText","TargetHText","TargetQText","TargetTitle","TimeStamp"};
- /**
- * an array of the SDF files column names if the source and the target language is in
- */
- final static String[] outLineNames= {"BlockNr","Project","SourceFile","Dummy","ResType","GID","LID","HID","Platform","Width","SourceLanguageID","SourceText","SourceHText","SourceQText","SourceTitle","TargetLanguageID","TargetText","TargetHText","TargetQText","TargetTitle","TimeStamp"};
-
- /**
- * A Map holding the source language line content
- */
- private ExtMap sourceLine=new ExtMap(sourceLineNames,null);
- /**
- * A Map holding the target language line content
- */
- private ExtMap targetLine=new ExtMap(targetLineNames,null);
- /**
- * A Map holding the whole content for output
- */
- private ExtMap outData=new ExtMap(outLineNames, null);
-// private ExtMap SDFLine;
-// private InputStreamReader isr;
- /**
- * The language to translate from
- */
- private String sourceLanguage;
- /**
- * The language to translate to
- */
- private String targetLanguage;
-
-// private boolean SourceIsFirst=false;
-
-
-
-
- /**
- * Create a new Instance of SDFWriter
- *
- * @param bos BufferedWriter to write to
- * @param charset the charset to use to write
- * @throws java.io.UnsupportedEncodingException
- */
- public SDFWriter(BufferedOutputStream bos,String charset) throws java.io.UnsupportedEncodingException {
- super(bos,charset);
-
- }
-
- /* (non-Javadoc)
- * @see com.sun.star.tooling.converter.DataWriter#writeData()
- */
- public final void writeData() throws java.io.IOException {
-
- StringBuffer buffer=new StringBuffer("");
-
- // get the values of the found fields
- //create the two sdf lines
-
- //at first the source language line
- for(int i=0;i<sourceLineNames.length;i++){
- // put them together for output
- buffer.append(outData.get(sourceLineNames[i]));
- if(i!=sourceLineNames.length-1) {
- // seperate the fields with tab
- buffer.append(seperator);
- }else{
- // this line is full
- // so close it with lf
- buffer.append(lineEnd);
- Converter.countLine();
- }
- }
- // is there a target line with anything in the strings?
- if (!(outData.get("TargetLanguageID")==null||((outData.get("TargetTitle").equals("")&&outData.get("TargetText").equals("")&&outData.get("TargetHText").equals("")&&outData.get("TargetQText").equals(""))))){
- //now the target language line
- for(int i=0;i<targetLineNames.length;i++){
- // put them together for output
- buffer.append(outData.get(targetLineNames[i]));
- if(i!=targetLineNames.length-1) {
- // seperate the fields with tab
- buffer.append(seperator);
- }else{
- // this line is full
- //so close it with lf
- buffer.append(lineEnd);
- Converter.countLine();
- }
- }
- }
- this.write(buffer.toString());
-
- }
-
-
-
- /* (non-Javadoc)
- * @see com.sun.star.tooling.converter.DataWriter#writeData(java.util.Map[])
- */
- protected void writeData(Map[] data) throws IOException {
- // TODO redesign DataHandler in the way that this is not nessesary any more
-
- }
-
- /* (non-Javadoc)
- * @see com.sun.star.tooling.converter.DataWriter#getDataFrom(com.sun.star.tooling.converter.DataHandler)
- */
- protected void getDataFrom(DataHandler handler) throws IOException {
-
- handler.putDataTo(this.outData);
- }
-
- /* (non-Javadoc)
- * @see com.sun.star.tooling.converter.DataWriter#getDatafrom(com.sun.star.tooling.converter.DataHandler)
- */
- protected void getDatafrom(DataHandler handler) throws IOException {
-
- handler.putDataTo(this.outData);
-
- }
-}
diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/XLIFFReader.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/XLIFFReader.java
deleted file mode 100755
index 76d14bd98569..000000000000
--- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/XLIFFReader.java
+++ /dev/null
@@ -1,742 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-/*
- * XLIFFReader.java
- *
- *
- */
-package com.sun.star.tooling.converter;
-
-import java.io.IOException;
-import java.util.Hashtable;
-import java.util.Map;
-
-import com.sun.star.tooling.languageResolver.LanguageResolver;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.helpers.AttributesImpl;
-import org.xml.sax.helpers.DefaultHandler;
-
-
-/**
- * Parse the given file and extract the content needed.
- * <br/>
- * This Reader understands the parts of the
- * <a href="http://www.oasis-open.org/committees/xliff/documents/cs-xliff-core-1.1-20031031.htm">xliff</a> spezification used to translate
- * the strings in Star-Office and Open-Office.
- * <br/>
- * The given file is parsed and the content is stored in a HashMap with those keys:
- * <br/>
- * "BlockNr" originally coming from reading the sdf file, contains 'block nr in sdf file'+'-'+'hash value of the sdf id fields'.<br/>
- * "Project" first column in sdf file format.<br/>
- * "SourceFile" second column in sdf file format.<br/>
- * "Dummy" third column in sdf file format.<br/>
- * "ResType" 4. column in sdf file format.<br/>
- * "GID" 5. column in sdf file format. <br/>
- * "LID" 6. column in sdf file format.<br/>
- * "HID" 7. column in sdf file format.<br/>
- * "Platform" 8. column in sdf file format. <br/>
- * "Width", 9. column in sdf file format.<br/>
- * "SourceLanguageID" 10. column in sdf file format(in the line with the source language).<br/>
- * "SourceText" 11. column in sdf file format(in the line with the source language).<br/>
- * "SourceHText" 12. column in sdf file format(in the line with the source language).<br/>
- * "SourceQText" 13. column in sdf file format(in the line with the source language).<br/>
- * "SourceTitle" 14. column in sdf file format(in the line with the source language).<br/>
- * "TargetLanguageID" 10. column in sdf file format (in the line with the target language).<br/>
- * "TargetText" 11. column in sdf file format (in the line with the target language).<br/>
- * "TargetHText" 12. column in sdf file format (in the line with the target language).<br/>
- * "TargetQText" 13. column in sdf file format (in the line with the target language).<br/>
- * "TargetTitle", 14. column in sdf file format (in the line with the target language).<br/>
- * "TimeStamp" 15. column in sdf file format.<br/>
- * @
- * @author Christian Schmidt 2005
- *
- */
-public class XLIFFReader extends DefaultHandler {
-
- /**
- * A String array holding the keys used by the HashMap holding the Data
- */
- private final String[] dataNames = { "BlockNr", "Project",
- "SourceFile", "Dummy", "ResType", "GID", "LID", "HID", "Platform",
- "Width", "SourceLanguageID", "SourceText", "SourceHText",
- "SourceQText", "SourceTitle", "TargetLanguageID", "TargetText",
- "TargetHText", "TargetQText", "TargetTitle", "TimeStamp" };
-
- /**
- * Used to index in the data array
- */
- static int index = 0;
-
- /**
- * The Map that holds the data returned by this class
- */
- private Map moveData = new ExtMap();
-
- /**
- * A Map that holds yet incomplete data
- * until all depending transunits are found
- */
- private Hashtable DataStore = new Hashtable();
-
- /**
- * An Elements name
- */
- private String name = new String("");
-
- /**
- *List of Attributes used by an Element
- */
- private Attributes attrs;
-
-// private String tagElement = new String("");
-
- /**
- * Indicates whether the next found content string should be printed
- */
- private boolean printThis = false;
- /**
- * Indicates whether the next found content string should be stored
- */
- private boolean storeIt = false;
-
- /**
- * data holds the information created while parsing
- *
- */
- private String[] data = new String[26];
-
- /**
- * The handler used by this class
- */
- private final DataHandler handler;
- /**
- * The target used by this class
- */
- private final DataWriter target;
-
-// private boolean searchForText = false;
-
- /**
- * counts how many dots are made
- */
- private int dotCount;
-
- /**
- * Counts how many Trans Units are read
- */
- private int transUnitCounter;
-
- /**
- * used source Language
- */
- private String sourceLanguage;
-
- /**
- * used target language
- */
- private String targetLanguage;
-
- /**
- * indicates whether this is the first Transunit
- */
- private boolean isFirst = true;
-
- private static final String EMPTY = new String("");
-
- /**
- * the last index in data where something is written
- */
- private int oldindex;
-
-// private boolean isBptEptTag;
-
-// private String innerString;
-//
-// private String key;
-
- /**
- * Index for the BlockNr in the data array
- */
- private static final int BLOCKNR_IDX = 0;
- /**
- * Index for the Project in the data array
- */
- private static final int PROJECT_IDX = 1;
- /**
- * Index for the Sourcefile name in the data array
- */
- private static final int SOURCEFILE_IDX = 2;
- /**
- * Index for the 'dummy' in the data array
- */
- private static final int DUMMY_IDX = 3;
- /**
- * Index for the Group Id in the data array
- */
- private static final int GID_IDX = 4;
- /**
- * Index for the Local Id in the data array
- */
- private static final int LID_IDX = 5;
- /**
- * Index for the Help Id in the data array
- */
- private static final int HID_IDX = 6;
- /**
- * Index for the Platform in the data array
- */
- private static final int PLATFORM_IDX = 7;
- /**
- * Index for the 'Width' in the data array
- */
- private static final int WIDTH_IDX = 8;
- /**
- * Index for the Sourcelanguage Id in the data array
- */
- private static final int SOURCE_LANGUAGE_ID_IDX = 10;
- /**
- * Index for the Source Text in the data array
- */
- private static final int SOURCE_TEXT_IDX = 11;
- /**
- * Index for the Source Helptext in the data array
- */
- private static final int SOURCE_HELPTEXT_IDX = 12;
- /**
- * Index for the Source Quickhelp Text in the data array
- */
- private static final int SOURCE_QUICK_HELPTEXT_IDX = 13;
- /**
- * Index for the Source Titletext in the data array
- */
- private static final int SOURCE_TITLETEXT_IDX = 14;
- /**
- * Index for the Timestamp in the data array
- */
- private static final int TIMESTAMP_IDX = 15;
- /**
- * Index for the res type in the data array
- */
- private static final int RESTYPE_IDX = 16;
- /**
- * Index for the Target Language Id in the data array
- */
- private static final int TARGET_LANGUAGE_ID_IDX = 20;
- /**
- * Index for the Target Text in the data array
- */
- private static final int TARGET_TEXT_IDX = 21;
- /**
- * Index for the Target Helptext in the data array
- */
- private static final int TARGET_HELP_TEXT_IDX = 22;
- /**
- * Index for the Target Quickhelp Text in the data array
- */
- private static final int TARGET_QUICKHELP_TEXT_IDX = 23;
- /**
- * Index for the Target Titletext in the data array
- */
- private static final int TARGET_TITLE_TEXT_IDX = 24;
- /**
- * Index for the Found Parts Counter in the data array
- */
- private static final int FOUND_PARTS_COUNTER_IDX = 18;
-
- /**
- * used to find the matching ISO or RFC3066 language code
- */
- LanguageResolver languageResolver;
-
- private boolean doBlockCompleteCheck=true;
-
-
-
- /**
- * Create a new Instance of XLIFFReader
- *
- * @param handler the DataHandler to use
- * @param target the target used
- * @throws IOException
- */
- public XLIFFReader(DataHandler handler, DataWriter target) throws IOException {
- this.languageResolver = new LanguageResolver();
- this.handler = handler;
- this.target = target;
- }
-
- /**
- * Create a new Instance of XLIFFReader
- *
- * @param handler the DataHandler to use
- * @param target the target used
- * @param doBlockCompleteCheck indicates whether every single transunit should be returned or the whole block data is to be collected
- *
- * @throws IOException
- */
- public XLIFFReader(DataHandler handler, DataWriter target,boolean doBlockCompleteCheck) throws IOException {
- this(handler, target);
- this.languageResolver = new LanguageResolver();
- this.doBlockCompleteCheck=doBlockCompleteCheck;
-
- }
-
- /**
- * delete and initialize the data content
- */
- public void initData() {
- for (int i = BLOCKNR_IDX; i < SOURCE_LANGUAGE_ID_IDX; i++) {
- data[i] = "";
- }
- for (int i = SOURCE_TEXT_IDX; i < TIMESTAMP_IDX; i++) { // skip Time Stamp
- data[i] = "";
- }
- for (int i = RESTYPE_IDX; i < TARGET_LANGUAGE_ID_IDX; i++) { // skip Source language ID
- data[i] = "";
- }
- for (int i = TARGET_TEXT_IDX; i < 26; i++) {// skip Target language ID,
- data[i] = "";
- }
-
- data[DUMMY_IDX] = "0";//dummy
- data[FOUND_PARTS_COUNTER_IDX] = "1";//parts found
-
- }
-
- /** (non-Javadoc)
- * @see org.xml.sax.ContentHandler#startDocument()
- */
- public void startDocument() {
- initData();
- //System.out.print("Start");
-
- }
-
- /** (non-Javadoc)
- * @see org.xml.sax.ContentHandler#endDocument()
- */
- public void endDocument() {
-
- try {
- showStatistic();
- } catch (IOException e) {
-
- OutputHandler.log(e.getMessage());
-
- }
- }
-
- /** (non-Javadoc)
- * @throws SAXException
- * @see org.xml.sax.ContentHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
- */
- public void startElement(String namespaceURI, String sName, String qName,
- Attributes attrs) throws SAXException {
- this.name = new String(qName);
- this.attrs = new AttributesImpl(attrs);
- String resType;
-
- String attributeName = new String("");
- String attribute = new String("");
- String tagElement = new String("");
- int i;
-
- if (qName.equals("bpt")||qName.equals("ept")||qName.equals("sub")||qName.equals("ex")) {
- //ignore bpt, ept, ex and sub tags
- // content of the tags will be stored
-
- storeIt=true;
- return;
-
- }
- if (qName.equals("target")) {
- if ((resType = data[RESTYPE_IDX]) == null) {
-
- } else {
- if ("res".equals(resType)) {
- index = TARGET_TEXT_IDX;
-
- storeIt = true;
- return;
- }
- // if("res-Help".equals(resType)){
- // index=TARGET_HELP_TEXT_IDX;
- // storeIt=true;
- // return;
- // }
- if ("res-QuickHelp".equals(resType)) {
- index = TARGET_QUICKHELP_TEXT_IDX;
-
- storeIt = true;
- return;
- }
- if ("res-Title".equals(resType)) {
- index = TARGET_TITLE_TEXT_IDX;
-
- storeIt = true;
- return;
- }
- }
-
- }
- if (qName.equals("source")) {
- if ((resType = data[RESTYPE_IDX]) == null) {
- //throw new SAXException("Ressource type not found");
- } else {
- if ("res".equals(resType)) {
- index = SOURCE_TEXT_IDX;
-
- storeIt = true;
- return;
- }
- // if("res-Help".equals(resType)){
- // index=SOURCEHELPTEXT_IDX;
- // storeIt=true;
- // return;
- // }
- if ("res-QuickHelp".equals(resType)) {
- index = SOURCE_QUICK_HELPTEXT_IDX;
- storeIt = true;
- return;
- }
- if ("res-Title".equals(resType)) {
- index = SOURCE_TITLETEXT_IDX;
- storeIt = true;
- return;
- }
- }
- }
-
- if (qName.equals("file")) {
- data[TIMESTAMP_IDX] = attrs.getValue("date");
- //data[17]=(attrs.getValue("original"));
- try{
- data[SOURCE_LANGUAGE_ID_IDX] = (languageResolver.getISOFromRFC((String)attrs.getValue("source-language")));
- if(languageResolver.getISOFromRFC((String)attrs.getValue("target-language"))!=null){
- data[TARGET_LANGUAGE_ID_IDX] = (languageResolver.getISOFromRFC((String)attrs.getValue("target-language")));
- }
- }catch(Exception e){
- OutputHandler.log(e.getMessage());
- }
- return;
- }
- if (qName.equals("trans-unit")) {
- String id = attrs.getValue("id");
- if ((DataStore.get(id)) != null) {
- //TODO arraycopy might not be nessessary
- System.arraycopy((String[]) DataStore.get(id), 0, data, 0,
- data.length);
- int help = (new Integer(data[FOUND_PARTS_COUNTER_IDX])).intValue(); //found one more part
- help++; // refresh the actual found parts
- data[FOUND_PARTS_COUNTER_IDX] = (new Integer(help)).toString(); // belonging to this information
-
- DataStore.remove(attrs.getValue("id")); // TODO this can be deleted?
- } else {
-
- data[BLOCKNR_IDX] = (attrs.getValue("id")); // a new part
- }
- data[RESTYPE_IDX] = (attrs.getValue("restype"));
-
- return;
- }
-
- if (qName.equals("context")) {
-
- String value = attrs.getValue("context-type");
-
- if ("SourceHelpText".equals(value)) {
- index = SOURCE_HELPTEXT_IDX;
- storeIt = true;
- return;
- }else if ("TargetHelpText".equals(value)) {
- index = TARGET_HELP_TEXT_IDX;
- storeIt = true;
- return;
- }else if ("DBType".equals(value)) {
- //index=SOURCEFILE_IDX;
- //storeIt=true;
- return;
- }else if ("Project".equals(value)) {
- index = PROJECT_IDX;
- storeIt = true;
- return;
- }else if ("Filename".equals(value)) {
- index = SOURCEFILE_IDX;
- storeIt = true;
- return;
- }else if ("Type".equals(value)) {
- index = RESTYPE_IDX;
- storeIt = true;
- return;
- }else if ("GID".equals(value)) {
- index = GID_IDX;
- storeIt = true;
- return;
- }else if ("LID".equals(value)) {
- index = LID_IDX;
- storeIt = true;
- return;
- }else if ("HID".equals(value)) {
- index = HID_IDX;
- storeIt = true;
- return;
- }else if ("Platform".equals(value)) {
- index = PLATFORM_IDX;
- storeIt = true;
- return;
- }else if ("Width".equals(value)) {
- index = WIDTH_IDX;
- storeIt = true;
- return;
- }
-
- }
-
- }
-
- /** (non-Javadoc)
- * @see org.xml.sax.ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String)
- */
- public void endElement(String namespaceURI, String sName, String qName)
- throws SAXException {
- //we ignore bpt and ept tags
- if(!(qName.equals("bpt")||qName.equals("ept")||qName.equals("sub")||qName.equals("ex"))){
- storeIt = false;
- }
- if (qName.equals("trans-unit")) {
- showData();
- }
-
- }
-
- /** (non-Javadoc)
- * @see org.xml.sax.ContentHandler#characters(char[], int, int)
- */
- public void characters(char[] ch, int start, int length) {
-
- // checkContent();
- String str2 = new String(ch, start, length);
-
- if (storeIt) {
-
- String str = new String(ch, start, length);
- if (index == oldindex) {
- data[index] += str;
- } else {
- data[index] = str;
- }
-
- }
- oldindex = index;
-
- }
-
- /** (non-Javadoc)
- * @see org.xml.sax.ErrorHandler#error(org.xml.sax.SAXParseException)
- */
- public void error(SAXParseException e) throws SAXParseException {
-
- OutputHandler.log(e.getMessage());
- }
-
- /** (non-Javadoc)
- * @see org.xml.sax.ErrorHandler#fatalError(org.xml.sax.SAXParseException)
- */
- public void fatalError(SAXParseException e) throws SAXParseException {
-
- OutputHandler.log("PARSE ERROR in line " + e.getLineNumber() + ", "
- + e.getMessage() );
-
- }
-
- /** (non-Javadoc)
- * @see org.xml.sax.ErrorHandler#warning(org.xml.sax.SAXParseException)
- */
- public void warning(SAXParseException e) throws SAXParseException {
- //throw e;
- OutputHandler.log(e.getMessage());
- }
-
- /**
- * Put the Data to the DataHandler
- * tell the Writer to write it
- *
- * @throws SAXException
- */
- public void showData() throws SAXException {
- transUnitCounter++;
- makeDot();
- if (isComplete()) {
-
- try {
- moveData();
- if (isFirst == true) {
- this.sourceLanguage = (String) this.moveData
- .get("SourceLanguageID");
- this.targetLanguage = (String) this.moveData
- .get("TargetLanguageID");
- OutputHandler.out(EMPTY);
- OutputHandler.out("Source Language is: "
- + this.sourceLanguage);
- OutputHandler.out("Target Language is: "
- + this.targetLanguage);
- OutputHandler.out(EMPTY);
- OutputHandler.out("Start");
- OutputHandler.out(EMPTY);
- isFirst = false;
- }
- target.getDataFrom(handler);
- target.writeData();
-
- } catch (java.io.IOException e) {
- throw new SAXException(e);
- }
-
- } else {
- DataStore.put(data[BLOCKNR_IDX], data.clone());
- initData();
-
- }
- initData();
- }
-
-
- /**
- * put the data in an Map in the format that
- * DataHandler can handle it
- */
- final public void moveData() {
-
- moveData.put("BlockNr", data[BLOCKNR_IDX]);
-
- moveData.put("Project", data[PROJECT_IDX]);
-
- moveData.put("SourceFile", data[SOURCEFILE_IDX]);
-
- moveData.put("Dummy", "0");
-
- moveData.put("ResType", data[RESTYPE_IDX]);
-
- moveData.put("GID", data[GID_IDX]);
-
- moveData.put("LID", data[LID_IDX]);
-
- moveData.put("HID", data[HID_IDX]);
-
- moveData.put("Platform", data[PLATFORM_IDX]);
-
- if (EMPTY.equals(data[WIDTH_IDX]))
- data[WIDTH_IDX] = "0";
- moveData.put("Width", data[WIDTH_IDX]);
-
- moveData.put("SourceLanguageID", data[SOURCE_LANGUAGE_ID_IDX]);
-
- moveData.put("SourceText", data[SOURCE_TEXT_IDX]);
-
- moveData.put("SourceHText", data[SOURCE_HELPTEXT_IDX]);
-
- moveData.put("SourceQText", data[SOURCE_QUICK_HELPTEXT_IDX]);
-
- moveData.put("SourceTitle", data[SOURCE_TITLETEXT_IDX]);
-
- moveData.put("TargetLanguageID", data[TARGET_LANGUAGE_ID_IDX]);
-
- moveData.put("TargetText", data[TARGET_TEXT_IDX]);
-
- moveData.put("TargetHText", data[TARGET_HELP_TEXT_IDX]);
-
- moveData.put("TargetQText", data[TARGET_QUICKHELP_TEXT_IDX]);
-
- moveData.put("TargetTitle", data[TARGET_TITLE_TEXT_IDX]);
-
- moveData.put("TimeStamp", data[TIMESTAMP_IDX]);
-
- //and give it to the data handler
- this.handler.fillDataWith(moveData);
- }
-
- /**
- * complete means all depending parts have been found esp. all res types
- * that belong to the same SDF Line
- *
- * @return true if the data is complete
- *
- */
- final public boolean isComplete() {
-
- if(!doBlockCompleteCheck){
- return true;
- }
-
- String sParts;
- if (data[FOUND_PARTS_COUNTER_IDX] == EMPTY)
- data[FOUND_PARTS_COUNTER_IDX] = "1"; //this is the first part
-
- String sFoundParts = data[FOUND_PARTS_COUNTER_IDX];
- //create the new 'id'
- sParts = data[BLOCKNR_IDX].substring(data[BLOCKNR_IDX].lastIndexOf(":") + 1);
-
- if (sFoundParts.equals(sParts)) {
- return true;
- }
- return false;
- }
-
- // TODO this belongs in OutputHandler
- /**
- * show the user that it is going
- * on by printing dots on the screen
- *
- */
- private void makeDot() {
- int count = 0;
- if ((count = (int) this.transUnitCounter / 1000) > this.dotCount) {
- this.dotCount = count;
- OutputHandler.printDot();
- }
- }
-
- /**
- * show the statistic data found while parse this file
- *
- * @throws IOException
- */
- final void showStatistic() throws IOException {
- OutputHandler.out(EMPTY);
- OutputHandler.out("TransUnits found: " + this.transUnitCounter);
- // every data in DataStore is
- // skipped 'cause its not complete
- // TODO count really every transunit not only the data (might consist of
- // more than one
- OutputHandler.dbg("TransUnits skip : " + this.DataStore.size());
- //Converter.out(EMPTY);
- }
-}
-
diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/XLIFFWriter.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/XLIFFWriter.java
deleted file mode 100755
index d7b6160dcc95..000000000000
--- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/XLIFFWriter.java
+++ /dev/null
@@ -1,532 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-/*
- *
- /*
- * XLIFFWriter.java
- *
- *
- */
-
-package com.sun.star.tooling.converter;
-
-import java.io.*;
-import java.util.*;
-
-import com.sun.star.tooling.DirtyTags.DirtyTagWrapper;
-import com.sun.star.tooling.languageResolver.LanguageResolver;
-import com.sun.star.tooling.languageResolver.LanguageResolver.LanguageResolvingException;
-
-/**
- * Write the Data to a wellformed XLIFF File
- *
- * @author Christian Schmidt
- */
-public class XLIFFWriter extends DataWriter {
-
- /**
- * An array holding the keys of the HashMap containing the source language string
- */
- private final static String[] sourceLineNames = { "Project", "SourceFile",
- "Dummy", "ResType", "GID", "LID", "HID", "Platform", "Width",
- "SourceLanguageID", "SourceText", "SourceHText", "SourceQText",
- "SourceTitle", "TimeStamp" };
- /**
- * An array holding the keys of the HashMap containing the target language string
- */
- private final static String[] targetLineNames = { "Project", "SourceFile",
- "Dummy", "ResType", "GID", "LID", "HID", "Platform", "Width",
- "TargetLanguageID", "TargetText", "TargetHText", "TargetQText",
- "TargetTitle", "TimeStamp" };
- /**
- * An array holding the keys of the HashMap containing the source and target language string
- */
- private final static String[] outLineNames = { "BlockNr", "Project",
- "SourceFile", "Dummy", "ResType", "GID", "LID", "HID", "Platform",
- "Width", "SourceLanguageID", "SourceText", "SourceHText",
- "SourceQText", "SourceTitle", "TargetLanguageID", "TargetText",
- "TargetHText", "TargetQText", "TargetTitle", "TimeStamp" };
- /**
- * An Map holding the source and target content
- */
- private final Map data = new ExtMap(outLineNames, null);
-
-
- /**
- * Indicates if this is the first Transunit to write
- */
- boolean isFirst = true;
-
- LanguageResolver languageResolver;
-
-
- /**
- * Create a new Instance of XLIFFWriter
- *
- * @param bos the Buffered Output Stream to write to
- * @param charset the charset to use
- * @throws IOException
- */
- public XLIFFWriter(BufferedOutputStream bos, String charset)
- throws IOException {
- super(bos, charset);
- this.languageResolver =new LanguageResolver();
-
-
- }
-
- /* (non-Javadoc)
- * @see com.sun.star.tooling.converter.DataWriter#getDatafrom(com.sun.star.tooling.converter.DataHandler)
- */
- public void getDatafrom(DataHandler handler) throws java.io.IOException {
- handler.putDataTo(this.data);
- }
-
- /**
- * check if the item is an empty String
- *
- * @param item the string to check
- * @return true if it is not empty, false if it is empty
- */
- private final boolean isUsed(String item) {
- if (!"".equals(item))
- return true;
- return false;
- }
-
- /**
- * Replaces all characters that mustn't be in XLIFF PCdata
- *
- * @param string the string to check
- * @return the checked string with all characters replaced
- * @throws java.io.IOException
- */
- private final String xmlString( final String string) throws java.io.IOException {
- if (string == null)
- return string; // ""
- String str = string;
-// str = str.replaceAll("&", "&amp;");
-// str = str.replaceAll("<", "&lt;");
-// str = str.replaceAll(">", "&gt;");
-// str = str.replaceAll("\"", "&quot;");
-// str = str.replaceAll("'", "&apos;");
- for(int i=0;i<str.length();i++){
- if(str.charAt(i)=='&'){
- str=str.substring(0, i)+"&amp;"+str.substring(i+1);
- continue;
- }
-
- if(str.charAt(i)=='<'){
- str=str.substring(0, i)+"&lt;"+str.substring(i+1);
- continue;
- }
-
- if(str.charAt(i)=='>'){
- str=str.substring(0, i)+"&gt;"+str.substring(i+1);
- continue;
- }
-
- if(str.charAt(i)=='"'){
- str=str.substring(0, i)+"&quot;"+str.substring(i+1);
- continue;
- }
-
- if(str.charAt(i)=='\''){
- str=str.substring(0, i)+"&apos;"+str.substring(i+1);
- continue;
- }
- }
-
- return str;
- }
-
- /* (non-Javadoc)
- * @see java.io.Writer#close()
- */
- public void close() throws IOException {
- this.writeTrailer();
-
- super.close();
- }
-
- /* (non-Javadoc)
- * @see com.sun.star.tooling.converter.DataWriter#writeData()
- */
- public void writeData() throws IOException {
- if (isFirst) {
-
- writeHeader();
- isFirst = false;
- }
- try{
- writeTransUnit();
- }catch(DirtyTagWrapper.TagWrapperException e){
-
- }
- }
-
- /**
- * Write the XLIFFFiles header
- *
- * @throws IOException
- */
- private void writeHeader() throws IOException {
-
- this.write(getHeader());
- }
-
- /**
- * Write the XLIFFFiles Trailer
- *
- * @throws IOException
- */
- private void writeTrailer() throws IOException {
- this.write(getTrailer());
- }
-
- /**
- * Write the next TransUnit
- *
- * @throws IOException
- */
- private void writeTransUnit() throws IOException, DirtyTagWrapper.TagWrapperException {
- try{
- StringBuffer writeBuffer = new StringBuffer(1000);
-
- StringBuffer allLinesEnd = new StringBuffer(200);
- String sRessource = "";
- int parts = 0;
- if (data == null) {
- OutputHandler.out("error");// TBD Exception
- }
-
- if (!(this.data.get("SourceText").equals("") || this.data.get(
- "SourceText").equals(" "))) {
- parts++;
- }
- // if(!(this.data.get("SourceHText").equals("")||this.data.get("SourceHText").equals("
- // "))){
- // parts++;
- // }
- if (!(this.data.get("SourceQText").equals("") || this.data.get(
- "SourceQText").equals(" "))) {
- parts++;
- }
- if (!(this.data.get("SourceTitle").equals("") || this.data.get(
- "SourceTitle").equals(" "))) {
- parts++;
- }
- if (!(this.data.get("SourceText").equals("") || this.data.get(
- "SourceText").equals(" "))) {
- sRessource = "res"; // normal TEXT source
-
- allLinesEnd
- .append("\t\t\t\t<context-group name=\"StarOffice Attributes\">\n");
-
- if (isUsed((String) this.data.get("ResType")))
- allLinesEnd
- .append("\t\t\t\t\t<context context-type=\"DBType\">"
- + xmlString((String) this.data.get("ResType"))
- + "</context>\n");
- if (isUsed((String) this.data.get("Project")))
- allLinesEnd
- .append("\t\t\t\t\t<context context-type=\"Project\">"
- + xmlString((String) this.data.get("Project"))
- + "</context>\n");
- if (isUsed((String) this.data.get("SourceFile")))
- allLinesEnd
- .append("\t\t\t\t\t<context context-type=\"Filename\">"
- + xmlString((String) this.data
- .get("SourceFile")) + "</context>\n");
- if (isUsed((String) this.data.get("SourceHText")))
- allLinesEnd
- .append("\t\t\t\t\t<context context-type=\"SourceHelpText\">"
- + xmlString((String) this.data
- .get("SourceHText")) + "</context>\n");
- if (isUsed((String) this.data.get("TargetHText")))
- allLinesEnd
- .append("\t\t\t\t\t<context context-type=\"TargetHelpText\">"
- + xmlString((String) this.data
- .get("TargetHText")) + "</context>\n");
- if (isUsed((String) this.data.get("ResType")))
- allLinesEnd.append("\t\t\t\t\t<context context-type=\"Type\">"
- + xmlString((String) this.data.get("ResType"))
- + "</context>\n");
- if (isUsed((String) this.data.get("GID")))
- allLinesEnd.append("\t\t\t\t\t<context context-type=\"GID\">"
- + xmlString((String) this.data.get("GID"))
- + "</context>\n");
- if (isUsed((String) this.data.get("LID")))
- allLinesEnd.append("\t\t\t\t\t<context context-type=\"LID\">"
- + xmlString((String) this.data.get("LID"))
- + "</context>\n");
- if (isUsed((String) this.data.get("HID")))
- allLinesEnd.append("\t\t\t\t\t<context context-type=\"HID\">"
- + xmlString((String) this.data.get("HID"))
- + "</context>\n");
- if (isUsed((String) this.data.get("Platform")))
- allLinesEnd
- .append("\t\t\t\t\t<context context-type=\"Platform\">"
- + xmlString((String) this.data.get("Platform"))
- + "</context>\n");
- if (isUsed((String) this.data.get("Width")))
- allLinesEnd.append("\t\t\t\t\t<context context-type=\"Width\">"
- + xmlString((String) this.data.get("Width"))
- + "</context>\n");
- allLinesEnd.append("\t\t\t\t</context-group>\n"
- + "\t\t\t</trans-unit>\n");
-
- writeBuffer.append("\t\t\t<trans-unit id=\""
- + this.data.get("BlockNr") + ":" + parts + "\" restype=\""
- + sRessource + "\" translate=\"yes\">\n");
- if (isUsed((String) this.data.get("SourceText")))
- writeBuffer.append("\t\t\t\t<source xml:lang=\""
- + languageResolver.getRFCFromISO((String)this.data.get("SourceLanguageID")) + "\">"
- + DirtyTagWrapper.wrapString((String) this.data.get("SourceText"))
- + "</source>\n");
-
- if (isUsed((String) this.data.get("TargetText")))
- writeBuffer
- .append("\t\t\t\t<target state=\"to_translate\" xml:lang=\""
- + languageResolver.getRFCFromISO((String)this.data.get("TargetLanguageID"))
- + "\">"
- +DirtyTagWrapper.wrapString((String) this.data
- .get("TargetText")) + "</target>\n");
- writeBuffer.append(allLinesEnd);
- Converter.countLine();
-
- }
- // if(!(this.data.get("SourceHText").equals("")||this.data.get("SourceHText").equals("
- // "))){
- // sRessource="res-Help"; //Source is Help
- // //sLineNumber=String.valueOf(iLineNumber);//
- // writeBuffer.append("\t\t<trans-unit
- // id=\""+this.data.get("BlockNr")+":"+parts+"\"
- // restype=\""+sRessource+"\" translate=\"yes\">\n");//always translate
- // if(isUsed((String)this.data.get("SourceHText")))
- // writeBuffer.append("\t\t\t<source
- // xml:lang=\""+this.data.get("SourceLanguageID")+"\">"+xmlString((String)this.data.get("SourceHText"))+"</source>\n");
- // if(isUsed((String)this.data.get("TargetHText")))
- // writeBuffer.append("\t\t\t<target state=\"to_translate\"
- // xml:lang=\""+this.data.get("TargetLanguageID")+"\">"+xmlString((String)this.data.get("TargetHText"))+"</target>\n");
- // writeBuffer.append(allLinesEnd);
- // Converter.countLine();
- // }
-
- if (!(this.data.get("SourceQText").equals("") || this.data.get(
- "SourceQText").equals(" "))) {
- sRessource = "res-QuickHelp"; // Source is OuickHelp
- // sLineNumber=String.valueOf(iLineNumber);//
- writeBuffer.append("\t\t\t<trans-unit id=\""
- + this.data.get("BlockNr") + ":" + parts + "\" restype=\""
- + sRessource + "\" translate=\"yes\">\n");// always translate
- if (isUsed((String) this.data.get("SourceQText")))
- writeBuffer.append("\t\t\t\t<source xml:lang=\""
- + languageResolver.getRFCFromISO((String)this.data.get("SourceLanguageID")) + "\">"
- + DirtyTagWrapper.wrapString((String) this.data.get("SourceQText"))
- + "</source>\n");
- if (isUsed((String) this.data.get("TargetQText")))
- writeBuffer
- .append("\t\t\t\t<target state=\"to_translate\" xml:lang=\""
- + languageResolver.getRFCFromISO((String)this.data.get("TargetLanguageID"))
- + "\">"
- + DirtyTagWrapper.wrapString((String) this.data
- .get("TargetQText")) + "</target>\n");
- writeBuffer.append(allLinesEnd);
- Converter.countLine();
- }
-
- if (!(this.data.get("SourceTitle").equals("") || this.data.get(
- "SourceTitle").equals(" "))) {
- sRessource = "res-Title"; // Source is Title
-
- writeBuffer.append("\t\t\t<trans-unit id=\""
- + this.data.get("BlockNr") + ":" + parts + "\" restype=\""
- + sRessource + "\" translate=\"yes\">\n");// always translate
- if (isUsed((String) this.data.get("SourceTitle")))
- writeBuffer.append("\t\t\t\t<source xml:lang=\""
- + languageResolver.getRFCFromISO((String)this.data.get("SourceLanguageID")) + "\">"
- + DirtyTagWrapper.wrapString((String) this.data.get("SourceTitle"))
- + "</source>\n");
- if (isUsed((String) this.data.get("TargetTitle")))
- writeBuffer
- .append("\t\t\t\t<target state=\"to_translate\" xml:lang=\""
- + languageResolver.getRFCFromISO((String)this.data.get("TargetLanguageID"))
- + "\">"
- + DirtyTagWrapper.wrapString((String) this.data
- .get("TargetTitle")) + "</target>\n");
- writeBuffer.append(allLinesEnd);
- Converter.countLine();
- }
- this.write(writeBuffer.toString());
- }catch(Exception e){
- OutputHandler.log(e.getMessage());
- }
- }
-
- /**
- * Create the XLIFFFiles Header
- *
- * @return the header as string
- * @throws java.io.UnsupportedEncodingException
- */
- private String getHeader() throws java.io.UnsupportedEncodingException {
- return new String(
- (getProcessingInstructionTag() + getDTDLine()
- + openVersionLine() + openFileLine() + getHeaderTag() + openBodyTag())
- .getBytes(), "UTF8");
-
- }
-
- /**
- * Create the XLIFFFiles Trailer
- *
- * @return the trailer as string
- */
- private String getTrailer() {
- return closeBodyTag() + closeFileLine() + closeVersionLine();
- }
-
- /**
- * Create the Processing Instruction Tag used by this XLIFFFile
- * @return the Processing Instruction Tag used by this XLIFFFile
- */
- private String getProcessingInstructionTag() {
- String sPITagStart = "<?";
- String sPIName = "xml ";
- String sPIVersion = "version=\"1.0\" ";
- String sPIEncoding = "encoding=\"UTF-8\"";
- String sPITagEnd = "?>";
- return sPITagStart + sPIName + sPIVersion + sPIEncoding
- + /* sPIStandalone+ */sPITagEnd + '\n';
- }
-
- /**
- * Create the line holding the DTD referenced by this XLIFFFile
- * @return a string holding the DTD referenced by this XLIFFFile
- */
- private String getDTDLine() {
- String sDTDTagStart = "<!DOCTYPE ";
- String sDTDType = "xliff ";
- String sDTDSource = "PUBLIC \"-//XLIFF//DTD XLIFF//EN\" \"http://www.oasis-open.org/committees/xliff/documents/xliff.dtd\">";// http://www.oasis-open.org/committees/xliff/documents/
- String sDTSTagEnd = ">";
- return sDTDTagStart + sDTDType + sDTDSource + '\n';
- }
-
- /**
- * Create the beginning of the line holding the version of this XIFFFile
- *
- * @return a string with the beginning of the line holding the version of this XIFFFile
- */
- private String openVersionLine() {
- return "<xliff version=\"1.0\">\n";
- }
- /**
- * Create the ending of the line holding the version of this XIFFFile
- *
- * @return a string with the ending of the line holding the version of this XIFFFile
- */
- private String closeVersionLine() {
- return "</xliff>";
- }
- /**
- * Create the beginning of the line holding the file tag of this XIFFFile
- *
- * @return a string with the beginning of the file tag of this XIFFFile
- */
- private String openFileLine() {
-
- String FileTagStart = "\t<file";
- String FileDataType = " datatype=\"STAROFFICE\"";
- String FileDate = " date=\"" + this.data.get("TimeStamp") + "\"";
- String FileOriginal = " original=\"" + this.data.get("SourceFile")
- + "\"";
- String FileSourceLanguage="";
- String FileTargetLanguage="";
- try {
- FileSourceLanguage = " source-language=\""
- + languageResolver.getRFCFromISO((String)this.data.get("SourceLanguageID")) + "\" ";
- FileTargetLanguage = " target-language=\""
- + languageResolver.getRFCFromISO((String)this.data.get("TargetLanguageID")) + "\" ";
- } catch (LanguageResolvingException e) {
- OutputHandler.out(e.getMessage());
- }
- String FileTagEnd = ">";
- return FileTagStart + FileDataType + FileDate + FileOriginal
- + FileSourceLanguage + FileTargetLanguage + FileTagEnd;
-
- }
- /**
- * Create the ending of the line holding the file tag of this XIFFFile
- *
- * @return a string with the ending of the file tag of this XIFFFile
- */
- private String closeFileLine() {
- return "\t</file>";
- }
- /**
- * Create a String containing the header tag
- * @return the String containing the header tag
- */
- private String getHeaderTag() {
- return "<header></header>\n";
- }
- /**
- * Create the begining of the line holding the body tag of this XIFFFile
- *
- * @return a string with the begining of the body tag of this XIFFFile
- */
- private String openBodyTag() {
- return "\t\t<body>\n";
- }
- /**
- * Create the ending of the line holding the body tag of this XIFFFile
- *
- * @return a string with the ending of the body tag of this XIFFFile
- */
- private String closeBodyTag() {
- return "\t\t</body>";
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.sun.star.tooling.converter.DataWriter#writeData(java.util.Map[])
- */
- protected void writeData(Map[] data) throws IOException {
- // TODO Auto-generated method stub
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.sun.star.tooling.converter.DataWriter#getDataFrom(com.sun.star.tooling.converter.DataHandler)
- */
- protected void getDataFrom(DataHandler handler) { }
-
-}
diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/dtd/xliff.dtd b/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/dtd/xliff.dtd
deleted file mode 100755
index 91262ec28204..000000000000
--- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/converter/dtd/xliff.dtd
+++ /dev/null
@@ -1,391 +0,0 @@
-<!-- XLIFF
-
-Public Identifier: "-//XLIFF//DTD XLIFF//EN"
-
-History of modifications (latest first):
-
-Jul-14-2003 by YS: Added extype definition (was missing)
-Jan-28-2003 by YS: Implemented fixes for resname
-Jan-28-2002 by YS: Implemented fixes after OASIS TC spec revision
-May-15-2001 by YS: Add phase-name to <trans-unit> and <bin-unit>
-May-15-2001 by YS: Reverse id for <trans-unit> to required
-Apr-19-2001 by YS: Enda+JohnR last changes
-Apr-18-2001 by YS: Removed empty ATTLISTs
-Apr-12-2001 by YS: Changed target* to target+ in trans-match
-Apr-11-2001 by YS: Fixed DOCTYPE id
-Apr-10-2001 by YS: Synchronize from conference call
-Apr-05-2001 by YS: Synchronize with latest specs
-Apr-04-2001 by YS: Synchronize with latest specs
-Apr-03-2001 by YS: Added name in <prop-group>
-Apr-02-2001 by YS: Implemented JR fixes
-Mar-29-2001 by JC: fixes for xml:space and bin-unit
-Mar-28-2001 by YS: First draft version
-
--->
-
-
-<!ENTITY % CodeContent "#PCDATA|sub" >
-<!ENTITY % TextContent "#PCDATA|g|bpt|ept|ph|it|mrk|x|bx|ex" >
-
-<!ENTITY lt "&#38;#60;" >
-<!ENTITY amp "&#38;#38;" >
-<!ENTITY gt "&#62;" >
-<!ENTITY apos "&#39;" >
-<!ENTITY quot "&#34;" >
-
-
-<!-- ***************************************************************** -->
-<!-- Structural Elements -->
-<!-- ***************************************************************** -->
-
-<!ELEMENT xliff (file)+ >
-<!ATTLIST xliff
- version CDATA #FIXED "1.0"
- xml:lang CDATA #IMPLIED
->
-
-<!ELEMENT file (header,body) >
-<!ATTLIST file
- original CDATA #REQUIRED
- source-language CDATA #REQUIRED
- datatype CDATA #REQUIRED
- tool CDATA #IMPLIED
- date CDATA #IMPLIED
- xml:space (default|preserve) "default"
- ts CDATA #IMPLIED
- category CDATA #IMPLIED
- target-language CDATA #IMPLIED
- product-name CDATA #IMPLIED
- product-version CDATA #IMPLIED
- build-num CDATA #IMPLIED
->
-<!-- tool default = "manual" -->
-
-
-<!ELEMENT header (skl?,phase-group?,(prop-group|glossary|reference|note|count-group)*) >
-
-<!ELEMENT skl (internal-file|external-file) >
-
-<!ELEMENT internal-file (#PCDATA) >
-<!ATTLIST internal-file
- form CDATA #IMPLIED
- crc NMTOKEN #IMPLIED
->
-<!-- text|base64 (text is default) -->
-
-<!ELEMENT external-file EMPTY >
-<!ATTLIST external-file
- href CDATA #REQUIRED
- crc NMTOKEN #IMPLIED
- uid NMTOKEN #IMPLIED
->
-
-<!ELEMENT glossary (internal-file|external-file) >
-
-<!ELEMENT reference (internal-file|external-file) >
-
-<!ELEMENT note (#PCDATA) >
-<!ATTLIST note
- xml:lang CDATA #IMPLIED
- priority (1|2|3|4|5|6|7|8|9|10) "1"
- from CDATA #IMPLIED
->
-
-<!ELEMENT prop-group (prop)+ >
-<!ATTLIST prop-group
- name CDATA #IMPLIED
->
-
-<!ELEMENT prop (#PCDATA) >
-<!ATTLIST prop
- prop-type CDATA #REQUIRED
- xml:lang CDATA #IMPLIED
->
-
-<!ELEMENT context-group (context)+ >
-<!ATTLIST context-group
- name CDATA #REQUIRED
- crc NMTOKEN #IMPLIED
->
-
-<!-- Processing instructions related to <context-group>:
-
-<?xliff-show-context-group name='value' ?>
-
-Indicates that any <context-group> element with a name set to 'value' should be
-displayed to the end-user.
-
--->
-
-<!ELEMENT context (#PCDATA) >
-<!ATTLIST context
- context-type CDATA #REQUIRED
- match-mandatory (yes|no) "no"
- crc NMTOKEN #IMPLIED
->
-
-<!-- Processing instructions related to <context>:
-
-<?xliff-show-context context-type='value' ?>
-
-Indicates that any <context> element with a context-type set to 'value' should
-be displayed to the end-user.
-
--->
-
-<!ELEMENT phase-group (phase)+ >
-
-<!ELEMENT phase (note)* >
-<!ATTLIST phase
- phase-name CDATA #REQUIRED
- process-name CDATA #REQUIRED
- company-name CDATA #IMPLIED
- tool CDATA #IMPLIED
- date CDATA #IMPLIED
- job-id CDATA #IMPLIED
- contact-name CDATA #IMPLIED
- contact-email CDATA #IMPLIED
- contact-phone CDATA #IMPLIED
->
-
-<!ELEMENT count-group (count)* >
-<!ATTLIST count-group
- name CDATA #REQUIRED
->
-
-<!ELEMENT count (#PCDATA) >
-<!ATTLIST count
- count-type CDATA #IMPLIED
- unit CDATA #IMPLIED
->
-
-<!ELEMENT body (group|trans-unit|bin-unit)* >
-
-<!ELEMENT group ((context-group*,count-group*,prop-group*,note*),(group|trans-unit|bin-unit)*)
->
-<!ATTLIST group
- id NMTOKEN #IMPLIED
- datatype CDATA #IMPLIED
- xml:space (default|preserve) "default"
- ts CDATA #IMPLIED
- restype CDATA #IMPLIED
- resname CDATA #IMPLIED
- extradata CDATA #IMPLIED
- extype CDATA #IMPLIED
- help-id NMTOKEN #IMPLIED
- menu CDATA #IMPLIED
- menu-option CDATA #IMPLIED
- menu-name CDATA #IMPLIED
- coord CDATA #IMPLIED
- font CDATA #IMPLIED
- css-style CDATA #IMPLIED
- style NMTOKEN #IMPLIED
- exstyle NMTOKEN #IMPLIED
->
-
-<!ELEMENT trans-unit (source,target?,(count-group|note|context-group|prop-group|alt-trans)*) >
-<!ATTLIST trans-unit
- id NMTOKEN #REQUIRED
- approved (yes|no) #IMPLIED
- translate (yes|no) "yes"
- reformat (yes|no) "yes"
- xml:space (default|preserve) "default"
- datatype CDATA #IMPLIED
- ts CDATA #IMPLIED
- restype CDATA #IMPLIED
- resname CDATA #IMPLIED
- extradata CDATA #IMPLIED
- extype CDATA #IMPLIED
- help-id NMTOKEN #IMPLIED
- menu CDATA #IMPLIED
- menu-option CDATA #IMPLIED
- menu-name CDATA #IMPLIED
- coord CDATA #IMPLIED
- font CDATA #IMPLIED
- css-style CDATA #IMPLIED
- style NMTOKEN #IMPLIED
- exstyle NMTOKEN #IMPLIED
- size-unit CDATA #IMPLIED
- maxwidth NMTOKEN #IMPLIED
- minwidth NMTOKEN #IMPLIED
- maxheight NMTOKEN #IMPLIED
- minheight NMTOKEN #IMPLIED
- maxbytes NMTOKEN #IMPLIED
- minbytes NMTOKEN #IMPLIED
- charclass CDATA #IMPLIED
- phase-name CDATA #IMPLIED
->
-<!-- size-unit: char|byte|pixel|glyph|dlgunit default='pixel' -->
-
-<!ELEMENT source (%TextContent;)* >
-<!ATTLIST source
- xml:lang CDATA #IMPLIED
- ts CDATA #IMPLIED
->
-<!-- coord = "x;y;cx;cy"
- font= "fontname[;size[;weight]]"
--->
-
-<!ELEMENT target (%TextContent;)* >
-<!ATTLIST target
- state NMTOKEN #IMPLIED
- phase-name NMTOKEN #IMPLIED
- xml:lang CDATA #IMPLIED
- ts CDATA #IMPLIED
- restype CDATA #IMPLIED
- resname CDATA #IMPLIED
- coord CDATA #IMPLIED
- font CDATA #IMPLIED
- css-style CDATA #IMPLIED
- style NMTOKEN #IMPLIED
- exstyle NMTOKEN #IMPLIED
->
-
-<!ELEMENT alt-trans (source?,target+,(note|context-group|prop-group)*) >
-<!ATTLIST alt-trans
- match-quality CDATA #IMPLIED
- tool CDATA #IMPLIED
- crc NMTOKEN #IMPLIED
- xml:lang CDATA #IMPLIED
- origin CDATA #IMPLIED
- datatype CDATA #IMPLIED
- xml:space (default|preserve) "default"
- ts CDATA #IMPLIED
- restype CDATA #IMPLIED
- resname CDATA #IMPLIED
- extradata CDATA #IMPLIED
- extype CDATA #IMPLIED
- help-id NMTOKEN #IMPLIED
- menu CDATA #IMPLIED
- menu-option CDATA #IMPLIED
- menu-name CDATA #IMPLIED
- coord CDATA #IMPLIED
- font CDATA #IMPLIED
- css-style CDATA #IMPLIED
- style NMTOKEN #IMPLIED
- exstyle NMTOKEN #IMPLIED
->
-
-
-<!ELEMENT bin-unit (bin-source,bin-target?,(note|context-group|prop-group|trans-unit)*) >
-<!ATTLIST bin-unit
- id NMTOKEN #REQUIRED
- mime-type NMTOKEN #REQUIRED
- approved (yes|no) #IMPLIED
- translate (yes|no) "yes"
- reformat (yes|no) "yes"
- ts CDATA #IMPLIED
- restype CDATA #IMPLIED
- resname CDATA #IMPLIED
- phase-name CDATA #IMPLIED
->
-
-<!ELEMENT bin-source (internal-file|external-file) >
-<!ATTLIST bin-source
- ts CDATA #IMPLIED
->
-
-<!ELEMENT bin-target (internal-file|external-file) >
-<!ATTLIST bin-target
- mime-type NMTOKEN #IMPLIED
- ts CDATA #IMPLIED
- state NMTOKEN #IMPLIED
- phase-name NMTOKEN #IMPLIED
- restype CDATA #IMPLIED
- resname CDATA #IMPLIED
->
-
-
-
-<!-- ***************************************************************** -->
-<!-- In-Line Elements -->
-<!-- ***************************************************************** -->
-
-<!ELEMENT g (%TextContent;)* >
-<!ATTLIST g
- id CDATA #REQUIRED
- ctype CDATA #IMPLIED
- clone (yes|no) "yes"
- ts CDATA #IMPLIED
->
-
-<!ELEMENT x EMPTY >
-<!ATTLIST x
- id CDATA #REQUIRED
- ctype CDATA #IMPLIED
- clone (yes|no) "yes"
- ts CDATA #IMPLIED
->
-
-<!ELEMENT bx EMPTY >
-<!ATTLIST bx
- id CDATA #REQUIRED
- rid NMTOKEN #IMPLIED
- ctype CDATA #IMPLIED
- clone (yes|no) "yes"
- ts CDATA #IMPLIED
->
-
-<!ELEMENT ex EMPTY >
-<!ATTLIST ex
- id CDATA #REQUIRED
- rid NMTOKEN #IMPLIED
- ts CDATA #IMPLIED
->
-
-<!ELEMENT ph (%CodeContent;)* >
-<!ATTLIST ph
- id CDATA #REQUIRED
- ctype CDATA #IMPLIED
- ts CDATA #IMPLIED
- crc NMTOKEN #IMPLIED
- assoc CDATA #IMPLIED
->
-
-<!ELEMENT bpt (%CodeContent;)* >
-<!ATTLIST bpt
- id CDATA #REQUIRED
- rid NMTOKEN #IMPLIED
- ctype CDATA #IMPLIED
- ts CDATA #IMPLIED
- crc NMTOKEN #IMPLIED
->
-
-<!ELEMENT ept (%CodeContent;)* >
-<!ATTLIST ept
- id CDATA #REQUIRED
- rid NMTOKEN #IMPLIED
- ts CDATA #IMPLIED
- crc NMTOKEN #IMPLIED
->
-
-<!ELEMENT it (%CodeContent;)* >
-<!ATTLIST it
- id CDATA #REQUIRED
- pos (open|close) #REQUIRED
- rid NMTOKEN #IMPLIED
- ctype CDATA #IMPLIED
- ts CDATA #IMPLIED
- crc NMTOKEN #IMPLIED
->
-
-<!ELEMENT mrk (%TextContent;)* >
-<!ATTLIST mrk
- mtype CDATA #REQUIRED
- mid NMTOKEN #IMPLIED
- comment CDATA #IMPLIED
- ts CDATA #IMPLIED
->
-
-<!ELEMENT sub (%TextContent;)* >
-<!ATTLIST sub
- datatype CDATA #IMPLIED
- ctype CDATA #IMPLIED
->
-
-
-
-<!-- ***** End of DTD ************************************************ -->
-
-
-
diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/languageResolver/LanguageResolver.java b/l10ntools/java/l10nconv/java/com/sun/star/tooling/languageResolver/LanguageResolver.java
deleted file mode 100755
index 4015c3acd2a7..000000000000
--- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/languageResolver/LanguageResolver.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-/*
- * Created on 2005
- * by Christian Schmidt
- */
-package com.sun.star.tooling.languageResolver;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.ListIterator;
-
-/**
- * Translate language codes into another format
- * between ISO, RFC3066 and numeric
- *
- * @author Christian Schmidt 2005
- *
- */
-public class LanguageResolver {
- private final static int ISO =2;
- private final static int LANGID =0;
- private final static int LANGNAME =1;
- private final static int RFC3066 =3;
-
- ArrayList languages=new ArrayList();
-
-// public static void main(String[] args){
-// try {
-// LanguageResolver lr=new LanguageResolver();
-// } catch (IOException e) {
-// //
-// e.printStackTrace();
-// }
-// }
-
- /**
- * Create a new Instance of LanguageResolver
- *
- * @throws IOException
- */
- public LanguageResolver() throws IOException{
- String lang = "com/sun/star/tooling/languageResolver/lang.map";
- ClassLoader cl = this.getClass().getClassLoader();
- InputStream in = cl.getResourceAsStream(lang);
- BufferedReader languageTable= new BufferedReader(new InputStreamReader(in));
-
- String line;
-
- while((line=(languageTable.readLine()))!=null){
- languages.add(line.split(","));
- }
- }
- /**
- * Get the numeric value of the given ISO Language Code
- *
- * @param isoCode the ISO Language Code to find
- * @return numeric value of the given isoCode
- * @throws LanguageResolvingException if the Language ISO Code is not known
- */
- public String getNrFromISO(String isoCode) throws LanguageResolvingException{
- if("".equals(isoCode)) return "";
- ListIterator iter=languages.listIterator();
- String[] line=new String[5];
- while(isoCode!="" && iter.hasNext()){
- line=(String[]) iter.next();
- if(line[ISO].equals(isoCode)) return line[LANGID];
- }
- throw new LanguageResolvingException("Can not find ISO Code: "+isoCode );
-
- }
-
- /**
- * Get the ISO Language Code corresponding with the given Language ID
- *
- * @param ID the numeric language id to find
- * @return the ISO Language Code corresponding with the given Language ID
- * @throws LanguageResolvingException if the Language ID is not known
- */
- public String getISOfromNr(String ID) throws LanguageResolvingException{
- if("".equals(ID)) return "";
- ListIterator iter=languages.listIterator();
- String[] line=new String[5];
- while(iter.hasNext()){
- line=(String[]) iter.next();
- if(line[LANGID].equals(ID)) return line[ISO];
- }
- throw new LanguageResolvingException("Can not find Language Id: "+ID );
- }
-
- /**
- * Get the RFC3066 value of the given ISO Language Code
- *
- * @param isoCode the ISO Language Code to find
- * @return RFC3066 value of the given isoCode
- * @throws LanguageResolvingException if the Language ISO Code is not known
- */
- public String getRFCFromISO(String isoCode) throws LanguageResolvingException{
- if("".equals(isoCode)) return "";
- ListIterator iter=languages.listIterator();
- String[] line=new String[5];
- while(iter.hasNext()){
- line=(String[]) iter.next();
- if(line[ISO].equals(isoCode)) return line[RFC3066];
- }
- throw new LanguageResolvingException("Can not find ISO Code: "+isoCode );
- }
-
- /**
- * Get the ISO Language Code corresponding with the given RFC3066 code
- *
- * @param RFC RFC3066 language id to find
- * @return the ISO Language Code corresponding with the given RFC3066 code
- * @throws LanguageResolvingException if the RFC3066 code is not known
- */
- public String getISOFromRFC(String RFC) throws LanguageResolvingException{
- if("".equals(RFC)) return "";
- ListIterator iter=languages.listIterator();
- String[] line=new String[5];
- while(iter.hasNext()){
- line=(String[]) iter.next();
- if(line[RFC3066].equals(RFC)) return line[ISO];
- }
- throw new LanguageResolvingException("Can not find Language Id: "+RFC );
- }
-
-
- /**
- * This Exception is thrown if a Language Identfier is unknown
- *
- * @author Christian Schmidt 2005
- *
- */
- public class LanguageResolvingException extends Exception {
-
- /**
- *
- */
- public LanguageResolvingException() {
- super();
- //
- }
-
- /**
- * @param arg0
- */
- public LanguageResolvingException(String arg0) {
- super(arg0);
- //
- }
-
- /**
- * @param arg0
- * @param arg1
- */
- public LanguageResolvingException(String arg0, Throwable arg1) {
- super(arg0, arg1);
- //
- }
-
- /**
- * @param arg0
- */
- public LanguageResolvingException(Throwable arg0) {
- super(arg0);
- //
- }
-
- }
-
-}
diff --git a/l10ntools/java/l10nconv/java/com/sun/star/tooling/languageResolver/lang.map b/l10ntools/java/l10nconv/java/com/sun/star/tooling/languageResolver/lang.map
deleted file mode 100755
index a43e8f5e0218..000000000000
--- a/l10ntools/java/l10nconv/java/com/sun/star/tooling/languageResolver/lang.map
+++ /dev/null
@@ -1,41 +0,0 @@
-1,English,en-US,en-US,1033
-3,Portuguese,pt,pt-PT,2070
-30,Greek,el,el-GR,1032
-33,French,fr,fr-FR,1036
-35,Finnish,fi,fi-FI,1035
-39,Italian,it,it-IT,1040
-43,Slowak,sk,sk-SK,1051
-46,Swedish,sv,sv-SE,1053
-48,Polish,pl,pl-PL,1045
-55,Portuguese (Brasil),pt-BR,pt-BR,2070
-82,Korean,ko,ko-KR,1042
-88,Chinese (traditional),zh-TW,zh-TW,1028
-96,Arabic,ar,,1025
-97,Hebrew,he,he-IL,1037
-7,Russian,ru,ru-RU,1049
-31,Dutch,nl,nl-NL,1043
-34,Spanish,es,es-ES,1034
-36,Hungarian,hu,hu-HU,1038
-42,Czech,cs,cs-CZ,1029
-45,Danish,da,da-DK,1030
-47,Norwegian (Bokmal),nb,nb-NB,1044
-49,German,de,de-DE,1031
-81,Japanese,ja,ja-JP,1041
-86,Chinese (simple),zh-CN,zh-CN,2052
-90,Turkish,tr,tr-TR,1055
-37,Catalan,ca,,
-66,Thai,th,th-TH,
-91,Hindi,hi-IN,hi-IN,
-77,Estonian,et,et,
-50,Slovenian,sl,sl,
-79,Norwegian Nynorsk,nn,nn-NN,
-53,Welsh,cy,cy,
-27,Afrikaans,af,af-ZA,
-38,Galician,gl-ES,gl-ES,
-58,Lithuanian,lt,lt-LT,
-29,Tswana,tn,tn-TN,
-76,Khmer ( Cambodia ),km,km,
-26,Northern Sotho,ns,ns-ZA,
-28,Zulu,zu,zu-ZA,
-10,Basque,eu,eu-ES,
-93,Kannada,kn,kn-KN, \ No newline at end of file
diff --git a/l10ntools/java/l10nconv/makefile.mk b/l10ntools/java/l10nconv/makefile.mk
deleted file mode 100755
index 423f3275fc37..000000000000
--- a/l10ntools/java/l10nconv/makefile.mk
+++ /dev/null
@@ -1,35 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# 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.
-#
-# 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).
-#
-# 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.
-#
-#*************************************************************************
-
-PRJ=../..
-PRJNAME=l10ntools
-TARGET=converter
-
-.INCLUDE : ant.mk
-
-ALLTAR : ANTBUILD
-
diff --git a/l10ntools/java/receditor/build.xml b/l10ntools/java/receditor/build.xml
deleted file mode 100755
index 4a88f61e4fc5..000000000000
--- a/l10ntools/java/receditor/build.xml
+++ /dev/null
@@ -1,169 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- Copyright 2000, 2010 Oracle and/or its affiliates.
-
- OpenOffice.org - a multi-platform office productivity suite
-
- This file is part of OpenOffice.org.
-
- 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.
-
- 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).
-
- 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.
-
--->
-<project name="receditor" default="main" basedir=".">
-
- <!-- ================================================================= -->
- <!-- settings -->
- <!-- ================================================================= -->
-
- <!-- name of this sub target used in recursive builds -->
- <property name="target" value="receditor"/>
-
- <!-- name of jar file created, without .jar extension -->
- <property name="jarname" value="receditor"/>
-
- <!-- relative path to project directory -->
- <property name="prj" value="."/>
-
- <!-- build output directory -->
- <property name="out" value="build"/>
-
- <!-- build directories -->
- <property name="build.dir" value="${out}"/>
- <property name="build.class" value="${build.dir}/class/receditor"/>
- <property name="build.misc" value="${build.dir}/misc/receditor"/>
-
- <!-- start of java source code package structure -->
- <property name="java.dir" value="java"/>
-
- <!-- define how to handle CLASSPATH environment -->
- <property name="build.sysclasspath" value="ignore"/>
-
- <!-- classpath settings for compile and javadoc tasks -->
- <path id="classpath">
- <pathelement location="."/>
- <pathelement location="${build.class}"/>
- </path>
-
- <!-- name to display in documentation -->
- <!-- <property name="docname" value="l10n converter"/> -->
-
- <!-- set "modern" java compiler -->
- <property name="build.compiler" value="modern"/>
-
- <!-- set wether we want to compile with debug information -->
- <property name="debug" value="on"/>
-
- <!-- set wether we want to compile with optimisation -->
- <property name="optimize" value="off"/>
-
- <!-- set wether we want to compile with or without deprecation -->
- <property name="deprecation" value="on"/>
-
- <target name="info">
- <echo message="--------------------"/>
- <echo message="${target}"/>
- <echo message="--------------------"/>
- </target>
-
- <!-- ================================================================= -->
- <!-- custom targets -->
- <!-- ================================================================= -->
-
- <!-- the main target, called in recursive builds -->
- <target name="main" depends="info,prepare,compile,jar"/>
-
- <!-- prepare output directories -->
- <target name="prepare">
- <mkdir dir="${build.dir}"/>
- <mkdir dir="${build.class}"/>
- <mkdir dir="${build.misc}"/>
- </target>
-
-
- <target name="res" depends="prepare">
- <copy todir="${build.class}">
- <fileset dir="${java.dir}">
- <include name="**/*.properties"/>
- <include name="**/*.css"/>
- <include name="**/*.dtd"/>
- <include name="**/*.form"/>
- <include name="**/*.gif "/>
- <include name="**/*.htm"/>
- <include name="**/*.html"/>
- <include name="**/*.js"/>
- <include name="**/*.mod"/>
- <include name="**/*.sql"/>
- <include name="**/*.xml"/>
- <include name="**/*.xsl"/>
- <include name="**/*.map"/>
-
- </fileset>
- </copy>
- </target>
-
-
- <target name="compile" depends="prepare,res">
- <javac destdir="${build.class}"
- debug="${debug}"
- deprecation="${deprication}"
- optimize="${optimize}"
- classpathref="classpath">
- <src path="${java.dir}"/>
- <include name="**/*.java"/>
- </javac>
- </target>
-
- <!-- clean up -->
- <target name="clean" depends="prepare">
- <delete includeEmptyDirs="true">
- <fileset dir="${build.class}">
- <patternset>
- <include name="${package}/**/*.class"/>
- </patternset>
- </fileset>
- </delete>
- </target>
-
- <!-- create jar file -->
- <target name="jar" depends="prepare,compile" if="build.class">
- <jar jarfile="${build.class}/${jarname}.jar"
- basedir="${build.class}"
- manifest="${jarname}.MF">
- <include name="**/*.class"/>
- <include name="**/*.properties"/>
- <include name="**/*.css"/>
- <include name="**/*.dtd"/>
- <include name="**/*.form"/>
- <include name="**/*.gif "/>
- <include name="**/*.htm"/>
- <include name="**/*.html"/>
- <include name="**/*.js"/>
- <include name="**/*.mod"/>
- <include name="**/*.sql"/>
- <include name="**/*.xml"/>
- <include name="**/*.xsl"/>
- <include name="**/*.map"/>
- </jar>
- </target>
-
- <target name="test" depends="prepare">
- </target>
-
-</project>
-
diff --git a/l10ntools/java/receditor/java/transex3/controller/EditorController.java b/l10ntools/java/receditor/java/transex3/controller/EditorController.java
deleted file mode 100644
index 38462d665304..000000000000
--- a/l10ntools/java/receditor/java/transex3/controller/EditorController.java
+++ /dev/null
@@ -1,334 +0,0 @@
-package transex3.controller;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.*;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.lang.Runtime;
-import java.util.*;
-
-import javax.swing.ListSelectionModel;
-import javax.swing.WindowConstants;
-import javax.swing.event.*;
-
-import transex3.model.*;
-
-import java.io.*;
-import javax.swing.*;
-//import transex3.model.*;
-public class EditorController {
- public final String[] RESTYPES = { ".src",".hrc",".xcu",".xrm",".xhp" };
- public final String RECFILE = ".recommand";
- // Editor View
- static transex3.view.Editor aEditor = null;
- // Editor Model
- static Vector sdfstrings = new Vector();
- static HashMap hashedsdfstrings = new HashMap();
- int oldindex = 0;
- //HashMap hashedfilenames = new HashMap();
- // Search for source Strings
- public String fetchSourceStrings( String rootdir ){
-
- //String outputfile = "h:\\workspace\\recommandEditor\\null2";
- File tempfile = null;
-
- try {
- tempfile = File.createTempFile( "receditor" , "tmp" );
- } catch (IOException e1) {
- // TODO Auto-generated catch block
- System.err.println("Can not create temp file\n");
- e1.printStackTrace();
- }
-
- String outputfile = tempfile.getAbsolutePath();
- try
- {
- //System.out.println("localize_sl -QQ -skip_links -e -l en-US -f "+outputfile+" -d "+rootdir);
- System.out.println("localize_sl -QQ -skip_links -e -l en-US -f "+outputfile );
- java.lang.Process aProc = Runtime.getRuntime().exec("localize_sl -QQ -skip_links -e -l en-US -f "+outputfile);
-
- //java.lang.Process aProc = Runtime.getRuntime().exec("localize_sl -QQ -e -l en-US -f "+outputfile+" -d "+rootdir);
- BufferedReader aBR = new BufferedReader( new InputStreamReader( aProc.getInputStream() ) );
- String line = aBR.readLine();
- while( line != null && line.length() > 0 ){
- //System.out.print( line );
- line = aBR.readLine();
- }
-
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return outputfile;
- }
- // Search for recommand files
- public void findRecommandFiles( File rootdir , Vector list ){
- System.out.print(".");
- System.out.flush();
- File[] aFileArray = rootdir.listFiles();
- if( aFileArray != null ){
- for( int cnt = 0; aFileArray.length > cnt ; cnt++ ){
- if( aFileArray[ cnt ].isDirectory() && !aFileArray[ cnt ].getAbsolutePath().endsWith(".lnk") )
- findRecommandFiles( aFileArray[ cnt ] , list);
- else if( aFileArray[ cnt ].isFile() && isRecommandFile( aFileArray[ cnt ] ) )
- list.add( aFileArray[ cnt ]);
- }
- }
- }
- private boolean isResourceType( File aFile ){
- String filename = aFile.getName();
- boolean isResType = false;
- for(int cnt = 0; cnt < RESTYPES.length ; cnt++){
- if( filename.endsWith( RESTYPES[ cnt ] ) )
- isResType = true;
- }
- return isResType;
- }
- private boolean isRecommandFile( File aFile ){
- return aFile.getName().endsWith( RECFILE );
- }
- public void clearAllRows( JTable aTable ){
- for ( int n = 0; n < aTable.getRowCount() ; n++ ){
- aTable.setValueAt( null , n , 0 );
- aTable.setValueAt( null , n , 1 );
- aTable.setValueAt( null , n , 2 );
- aTable.setValueAt( null , n , 3 );
- aTable.setValueAt( null , n , 4 );
- }
- }
- // Add all data to view
- void updateData(){
- JTable recTable =transex3.controller.EditorController.aEditor.getRectable();
-
- SdfString aSdfString = (SdfString) sdfstrings.get( oldindex );
- Vector newStrings = new Vector();
- for ( int n = 1; n < recTable.getRowCount() ; n++ ){
- String lang = (String) recTable.getValueAt(n , 0 );
- String text = (String) recTable.getValueAt(n , 1 );
- String htext = (String) recTable.getValueAt(n , 2 );
- String qhtext = (String) recTable.getValueAt(n , 3 );
- String ttext = (String) recTable.getValueAt(n , 4 );
- if( lang != null && text != null ){
- //System.out.println("Data "+ lang + " " + text );
- SdfEntity aSdfEntity = new SdfEntity();
- aSdfEntity.setLangid( lang );
- aSdfEntity.setText( text );
- aSdfEntity.setHelptext( htext );
- aSdfEntity.setQuickhelptext( qhtext );
- aSdfEntity.setTitle( ttext );
- newStrings.add( aSdfEntity );
- aSdfString.setLanguageStrings( newStrings );
- }
- }
- }
-
- public void initView(){
- Object[][] sourceStringData = new Object[ sdfstrings.size() ][ 4 ];
- Object[][] firstData = new Object[100][5];
- // Set the files
- Iterator aIter = sdfstrings.iterator();
- int counter = 0;
- while( aIter.hasNext() ){
- SdfString aSdfString = (SdfString) aIter.next();
- sourceStringData[ counter ][ 0 ] = aSdfString.getSourceString().getProject()+"\\"+aSdfString.getSourceString().getSource_file();
- sourceStringData[ counter ][ 1 ] = aSdfString.getSourceString().getGid();
- sourceStringData[ counter ][ 2 ] = aSdfString.getSourceString().getLid();
- sourceStringData[ counter ][ 3 ] = aSdfString.getSourceString().getText();
- if( counter == 0 ){
- firstData[ 0 ][ 0 ] = "en-US";
- firstData[ 0 ][ 1 ] = aSdfString.getSourceString().getText();
- firstData[ 0 ][ 2 ] = aSdfString.getSourceString().getHelptext();
- firstData[ 0 ][ 3 ] = aSdfString.getSourceString().getQuickhelptext();
- firstData[ 0 ][ 4 ] = aSdfString.getSourceString().getTitle();
- aSdfString = (SdfString) sdfstrings.get( 0 );
- Vector values = aSdfString.getLanguageStrings();
- for( int n = 0; n < values.size() ; n++ )
- {
- SdfEntity aEntity = (SdfEntity) values.get( n );
- firstData[ n+1 ][ 0 ] = aEntity.getLangid();
- firstData[ n+1 ][ 1 ] = aEntity.getText();
- firstData[ n+1 ][ 2 ] = aEntity.getHelptext();
- firstData[ n+1 ][ 3 ] = aEntity.getQuickhelptext();
- firstData[ n+1 ][ 4 ] = aEntity.getTitle();
- }
- }
- counter++;
- }
- // Set the source srtings
-
-
- //aEditor = new transex3.view.Editor( sourceStringData , filedata.toArray() );
- aEditor = new transex3.view.Editor( sourceStringData , firstData );
-
- aEditor.setBounds(100,100,800,900);
- aEditor.setDefaultCloseOperation( WindowConstants.DISPOSE_ON_CLOSE );
- aEditor.setVisible(true);
- aEditor.repaint();
- aEditor.addWindowListener( new WindowAdapter(){
- public void windowClosed(WindowEvent e ){
- System.exit( 0 );
- }
- });
-
- aEditor.getMiExit().addActionListener( new ActionListener(){
- public void actionPerformed( ActionEvent e ){
- System.exit( 0 );
- }
- });
-
- aEditor.getMiSave().addActionListener( new ActionListener(){
- public void actionPerformed( ActionEvent e ){
- Iterator aIter = sdfstrings.iterator();
- String lastFile="";
- while( aIter.hasNext() )
- {
- SdfString aSdfString = (SdfString )aIter.next();
- if( aSdfString.getFileId().compareTo( lastFile ) != 0 ){
- //aSdfString.removeFile();
- }
- aSdfString.writeString();
- lastFile = aSdfString.getFileId();
- }
- }
- });
-
- //aEditor.getRectable().putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
- aEditor.getRectable().addFocusListener( new FocusListener(){
- public void focusLost(FocusEvent e){
- //super.focusLost( e );
- //System.out.println("focus lost");
- JTable aTable = aEditor.getRectable();
- if( aTable.getSelectedRow() != -1 && aTable.getSelectedColumn() != -1 )
- aTable.getCellEditor( aTable.getSelectedRow(), aTable.getSelectedColumn() ).stopCellEditing();
- updateData();
- }
- public void focusGained( FocusEvent e){
- //super.focusGained( e );
- //System.out.println("focus gained");
- }
- });
- //setDefaultEditor(Object.class, new transex3.view.FocusCellEditor(new JTextField()));
-
- aEditor.getRectable().getModel().addTableModelListener( new TableModelListener() {
- public void tableChanged( TableModelEvent e ){
- //System.out.println( e );
- }});
-
-
- aEditor.getRectable().getSelectionModel().addListSelectionListener( new ListSelectionListener(){
- public void valueChanged( ListSelectionEvent e ){
- JTable aTable = aEditor.getRectable();
- //if( aTable.getSelectedRow() != -1 && aTable.getSelectedColumn() != -1 )
- //aTable.getCellEditor( aTable.getSelectedRow(), aTable.getSelectedColumn() ).stopCellEditing();
-
- updateData();
- }
- });
-
- aEditor.getTable().setSelectionMode( ListSelectionModel.SINGLE_SELECTION );
- aEditor.getTable().getSelectionModel().addListSelectionListener( new ListSelectionListener(){
- public void valueChanged( ListSelectionEvent e ){
- //System.out.println("Selected = " +e.getFirstIndex()+"\n");
- JTable table =transex3.controller.EditorController.aEditor.getTable();
- JTable recTable =transex3.controller.EditorController.aEditor.getRectable();
- SdfString aSdfString;
- JTable aTable = aEditor.getRectable();
- if( aTable.getSelectedRow() != -1 && aTable.getSelectedColumn() != -1 )
- aTable.getCellEditor( aTable.getSelectedRow(), aTable.getSelectedColumn() ).stopCellEditing();
-
- updateData();
- clearAllRows( recTable );
-
- aSdfString = (SdfString) sdfstrings.get( table.getSelectedRow() );
- recTable.setValueAt( "en-US" , 0, 0 );
- recTable.setValueAt( aSdfString.getSourceString().getText() , 0, 1 );
- recTable.setValueAt( aSdfString.getSourceString().getHelptext() , 0, 2 );
- recTable.setValueAt( aSdfString.getSourceString().getQuickhelptext() , 0, 3 );
- recTable.setValueAt( aSdfString.getSourceString().getTitle() , 0, 4 );
- Vector values = aSdfString.getLanguageStrings();
- for( int n = 0; n < values.size() ; n++ )
- {
- SdfEntity aEntity = (SdfEntity) values.get( n );
- recTable.setValueAt( aEntity.getLangid() , n+1 , 0 );
- recTable.setValueAt( aEntity.getText() , n+1 , 1 );
- recTable.setValueAt( aEntity.getHelptext() , n+1 , 2 );
- recTable.setValueAt( aEntity.getQuickhelptext() , n+1 , 3 );
- recTable.setValueAt( aEntity.getTitle() , n+1 , 4 );
- }
- oldindex = table.getSelectedRow();
- }
- });
- //System.out.println("initView successfully");
- }
- public void initInitialStrings(){
- String rootdir = java.lang.System.getProperty("SOLARSRC");
- String sourcestringsfile = null;
- Vector recList = new Vector();
- sourcestringsfile = fetchSourceStrings( rootdir );
- //findRecommandFiles( new File( rootdir ) , recList );
- readStrings( sourcestringsfile , recList );
- File sfile = new File ( sourcestringsfile );
- sfile.delete();
- initView();
- aEditor.repaint();
- }
- // Connect recommand strings with source strings
- public void readStrings( String sourcefiles , Vector recfiles ) {
- BufferedReader aBR = null;
- try {
- //System.out.println("DBG: sourcefiles = " +sourcefiles);
- aBR = new BufferedReader( new FileReader( sourcefiles ) );
- String current = aBR.readLine();
- SdfString aSdfString = null;
- SdfEntity aSdfEntity = null;
- while( current != null ){
- aSdfEntity = new SdfEntity();
- aSdfEntity.setProperties( current );
- aSdfString = new SdfString();
- aSdfString.addSourceString( aSdfEntity );
- hashedsdfstrings.put( aSdfString.getId() , aSdfString );
- //System.out.println("Put ID '"+aSdfString.getId()+"'");
- sdfstrings.add( aSdfString );
- current = aBR.readLine();
-
- }
- Iterator aIter=recfiles.iterator();
- File aFile;
- BufferedReader aBR2 = null;
- //System.out.println("Connecting strings");
- while( aIter.hasNext() ){
- aFile = (File) aIter.next();
- aBR2 = new BufferedReader( new FileReader( aFile ) ) ;
- String current2 = aBR2.readLine();
-
- while ( current2 != null ){
- SdfEntity aEntity = new SdfEntity();
- aEntity.setProperties( current2 );
-
- if( hashedsdfstrings.containsKey( aEntity.getId() ) )
- {
- aSdfString = (SdfString) hashedsdfstrings.get( aEntity.getId() );
- aSdfString.addLanguageString( aEntity );
- }
- else
- {
- System.out.println("DBG: Can't find source string '"+aEntity.getId()+"'" );
- }
- current2 = aBR2.readLine();
- }
- }
- } catch (FileNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch ( IOException e){
- e.printStackTrace();
- }
-
- }
-}
diff --git a/l10ntools/java/receditor/java/transex3/controller/Main.java b/l10ntools/java/receditor/java/transex3/controller/Main.java
deleted file mode 100644
index e8dd06ce9f85..000000000000
--- a/l10ntools/java/receditor/java/transex3/controller/Main.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package transex3.controller;
-
-public class Main {
-
- public static void main( String args[] ){
- EditorController aEditor = new EditorController();
- aEditor.initInitialStrings();
- }
-}
-
diff --git a/l10ntools/java/receditor/java/transex3/model/ResourceFile.java b/l10ntools/java/receditor/java/transex3/model/ResourceFile.java
deleted file mode 100644
index 51fabb3a4b7a..000000000000
--- a/l10ntools/java/receditor/java/transex3/model/ResourceFile.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package transex3.model;
-
-import java.util.*;
-
-public class ResourceFile {
- Vector sdfStrings = new Vector();
- HashMap sdfHashMap = new HashMap();
- String filepathid = null;
- String modulename = null;
- String filename = null;
-
-
- public String getModuleName(){
- return modulename;
- }
- public String getFilePath(){
- return filepathid;
- }
- public String getFileName(){
- return filename;
- }
-/* public List readSoureStrings( java.io.File aSdfFile ){
- List sdfList=null;
- return sdfList;
- };*/
- public void addString( SdfString aSdfstring ){
- sdfStrings.add( aSdfstring );
- sdfHashMap.put( aSdfstring.getFileId() , aSdfstring );
- if( filepathid == null )
- filepathid = aSdfstring.getFilePath();
- if( modulename == null )
- modulename = aSdfstring.getModuleName();
- if( filename == null )
- filename = aSdfstring.getFileName();
- }
-
-
- public void ParseString( String aSourceString ){
- //sourceString = new SdfEntity();
- SdfEntity aSdfEntity = new SdfEntity();
- aSdfEntity.setProperties( aSourceString );
- SdfString sdfstring = null;
- if( sdfHashMap.containsKey( aSdfEntity.getFileId() ) ){
- sdfstring = (SdfString) sdfHashMap.get( aSdfEntity.getFileId() );
- }
- else
- {
- sdfstring = new SdfString();
- addString( sdfstring );
- }
- sdfstring.addLanguageString( aSdfEntity );
-
-
- }
- /*public void ParseSdfFile( java.util.Vector aSdfList ){
- ListIterator aLI = aSdfList.listIterator();
- String current;
- String[] splitted;
- SdfEntity aSdfEntity;
- SdfString aSdfString = new SdfString();
- while( aLI.hasNext() ){
- aSdfEntity = new SdfEntity();
- aSdfEntity.setProperties( (String) aLI.next() );
- SdfString aString;
-
- if( sdfHashMap.containsKey( aSdfEntity.getFileId() ) )
- aString = (SdfString) sdfHashMap.get( aSdfEntity.getFileId() );
- else
- {
- aString = new SdfString();
- addString( aString );
- }
- aString.addLanguageString( aSdfEntity );
- }
-
- }*/
-}
diff --git a/l10ntools/java/receditor/java/transex3/model/SdfEntity.java b/l10ntools/java/receditor/java/transex3/model/SdfEntity.java
deleted file mode 100644
index 4b293421fd28..000000000000
--- a/l10ntools/java/receditor/java/transex3/model/SdfEntity.java
+++ /dev/null
@@ -1,211 +0,0 @@
-package transex3.model;
-
-public class SdfEntity {
- private String project;
- private String source_file;
- private String dummy1;
- private String resource_type;
- private String gid;
- private String lid;
- private String helpid;
- private String platform;
- private String dummy2;
- private String langid;
- private String text;
- private String helptext;
- private String quickhelptext;
- private String title;
- private String date;
-
- public static int PROJECT_POS = 0;
- public static int SOURCE_FILE_POS = 1;
- public static int DUMMY1_POS = 2;
- public static int RESOURCE_TYPE_POS = 3;
- public static int GID_POS = 4;
- public static int LID_POS = 5;
- public static int HELPID_POS = 6;
- public static int PLATFORM_POS = 7;
- public static int DUMMY2_POS = 8;
- public static int LANGID_POS = 9;
- public static int TEXT_POS = 10;
- public static int HELPTEXT_POS = 11;
- public static int QUICKHELPTEXT_POS = 12;
- public static int TITLE_POS = 13;
- public static int DATE_POS = 14;
-
- public SdfEntity(){}
- public SdfEntity(String project, String source_file, String dummy1, String resource_type, String gid, String lid, String helpid, String platform, String dummy2, String langid, String text, String helptext, String quickhelptext, String title , String date) {
- super();
- this.project = project;
- this.source_file = source_file;
- this.dummy1 = dummy1;
- this.resource_type = resource_type;
- this.gid = gid;
- this.lid = lid;
- this.helpid = helpid;
- this.platform = platform;
- this.dummy2 = dummy2;
- this.langid = langid;
- this.text = text;
- this.helptext = helptext;
- this.quickhelptext = quickhelptext;
- this.title = title;
- this.date = date;
- }
-
- public void setProperties( String line ){
-
- String[] splitted = line.split("\t");
-
- setProject( splitted[ SdfEntity.PROJECT_POS ] );
- setSource_file( splitted[ SdfEntity.SOURCE_FILE_POS ] );
- setDummy1( splitted[ SdfEntity.DUMMY1_POS ] );
- setResource_type( splitted[ SdfEntity.RESOURCE_TYPE_POS ] );
- setGid( splitted[ SdfEntity.GID_POS ] );
- setLid( splitted[ SdfEntity.LID_POS ] );
- setHelpid( splitted[ SdfEntity.HELPID_POS ] );
- setPlatform( splitted[ SdfEntity.PLATFORM_POS ] );
- setDummy2( splitted[ SdfEntity.DUMMY2_POS ] );
- setLangid( splitted[ SdfEntity.LANGID_POS ] );
- setText( splitted[ SdfEntity.TEXT_POS ] );
- setHelptext( splitted[ SdfEntity.HELPTEXT_POS ] );
- setQuickhelptext( splitted[ SdfEntity.QUICKHELPTEXT_POS ] );
- setTitle( splitted[ SdfEntity.TITLE_POS ] );
- setDate( splitted[ SdfEntity.DATE_POS ] );
- }
-
- public String getFileId(){
- return project+"\\"+source_file;
- }
- public String getResourcePath(){
- return source_file.substring(0 , source_file.lastIndexOf( "\\" )-1 );
- }
- public String toString(){
- return project+"\t"+source_file+"\t"+dummy1+"\t"+resource_type+"\t"+gid+"\t"
- +lid+"\t"+helpid+"\t"+platform+"\t"+dummy2+"\t"+langid+"\t"
- +text+"\t"+helptext+"\t"+quickhelptext+"\t"+title+"\t"+date;
- }
- public String getId(){
- return project+gid+lid+source_file+resource_type+platform+helpid;
- }
-
- public String getDummy1() {
- return dummy1;
- }
-
- public void setDummy1(String dummy1) {
- this.dummy1 = dummy1;
- }
-
- public String getPlatform() {
- return platform;
- }
-
- public void setPlatform(String platform) {
- this.platform = platform;
- }
-
- public String getDummy2() {
- return dummy2;
- }
-
- public void setDummy2(String dummy2) {
- this.dummy2 = dummy2;
- }
-
- public String getGid() {
- return gid;
- }
-
- public void setGid(String gid) {
- this.gid = gid;
- }
-
- public String getHelpid() {
- return helpid;
- }
-
- public void setHelpid(String helpid) {
- this.helpid = helpid;
- }
-
- public String getHelptext() {
- return helptext;
- }
-
- public void setHelptext(String helptext) {
- this.helptext = helptext;
- }
-
- public String getLangid() {
- return langid;
- }
-
- public void setLangid(String langid) {
- this.langid = langid;
- }
-
- public String getLid() {
- return lid;
- }
-
- public void setLid(String lid) {
- this.lid = lid;
- }
-
- public String getProject() {
- return project;
- }
-
- public void setProject(String project) {
- this.project = project;
- }
-
- public String getQuickhelptext() {
- return quickhelptext;
- }
-
- public void setQuickhelptext(String quickhelptext) {
- this.quickhelptext = quickhelptext;
- }
-
- public String getResource_type() {
- return resource_type;
- }
-
- public void setResource_type(String resource_type) {
- this.resource_type = resource_type;
- }
-
- public String getSource_file() {
- return source_file;
- }
-
- public void setSource_file(String source_file) {
- this.source_file = source_file;
- }
-
- public String getText() {
- return text;
- }
-
- public void setText(String text) {
- this.text = text;
- }
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
- public String getDate() {
- return date;
- }
- public void setDate(String date) {
- this.date = date;
- }
-
-
-}
diff --git a/l10ntools/java/receditor/java/transex3/model/SdfString.java b/l10ntools/java/receditor/java/transex3/model/SdfString.java
deleted file mode 100644
index 7eec2151b7c3..000000000000
--- a/l10ntools/java/receditor/java/transex3/model/SdfString.java
+++ /dev/null
@@ -1,167 +0,0 @@
-package transex3.model;
-import java.util.*;
-import java.io.*;
-public class SdfString {
- private SdfEntity sourceString = null;
- //private java.util.HashMap languageStrings = new HashMap();
- private Vector languageList = new Vector();
- private String id = null;
- private String fileid = null;
- private String filename = null;
- private String modulename = null;
- private String filepath = null;
-
- /*public HashMap getLanguageStrings() {
- return languageStrings;
- }*/
- public Vector getLanguageStrings() {
- return languageList;
- }
-
- public void setLanguageStrings(Vector languageStrings) {
- this.languageList = languageStrings;
- }
-
- public void addSourceString( SdfEntity aSdfEntity )
- {
- if( id == null )
- id = aSdfEntity.getId();
- if ( fileid == null )
- fileid = aSdfEntity.getFileId();
- if( modulename == null )
- modulename = aSdfEntity.getProject();
- if( filename == null )
- filename = aSdfEntity.getSource_file();
- if( filepath == null )
- filepath = aSdfEntity.getResourcePath();
- setSourceString( aSdfEntity );
- }
- public void addLanguageString( SdfEntity aSdfEntity ){
- if( !aSdfEntity.getLangid().equals( "en-US" ) )
- {
- if( id == null )
- id = aSdfEntity.getId();
- if ( fileid == null )
- fileid = aSdfEntity.getFileId();
- if( modulename == null )
- modulename = aSdfEntity.getProject();
- if( filename == null )
- filename = aSdfEntity.getSource_file();
- if( filepath == null )
- filepath = aSdfEntity.getResourcePath();
-
- //if( aSdfEntity.getLangid().equals( "en-US" ) )
- //{
- // setSourceString( aSdfEntity );
- //}
- //else
- //{
- //languageStrings.put( aSdfEntity.getLangid() , aSdfEntity );
- languageList.add( aSdfEntity );
- //}
- id = aSdfEntity.getId();
- }
- }
-
- public SdfEntity getSourceString() {
- return sourceString;
- }
-
- public void setSourceString(SdfEntity sourceString) {
- this.sourceString = sourceString;
- id = sourceString.getId();
- }
- public String getFilePath(){
- return filepath;
- }
- public String getId(){
- //return id;
- return sourceString.getId();
- }
- public String getFileId(){
- return fileid;
- }
-
- public String getFileName() {
- return filename;
- }
-
- public void setFileName(String filename) {
- this.filename = filename;
- }
-
- public String getModuleName() {
- return modulename;
- }
-
- public void setModuleName(String modulename) {
- this.modulename = modulename;
- }
-
- public String getRealFileName(){
- String filepart = sourceString.getFileId();
- filepart = filepart.replaceAll( "\\\\" , "_" );
- String filename = "/so/ws/merge/In/" + java.lang.System.getProperty( "WORK_STAMP" ) + "/" + filepart + ".sdf";
- return filename;
- }
- public void removeFile(){
- String filename = getRealFileName();
- File aFile = new File( filename );
- if( aFile.exists() ){
- if( ! aFile.delete() )
- {
- System.out.println("Can't delete File "+filename+"\nWrong access rights?\n");
- }
- }
- }
- public void writeString(){
- String filename = getRealFileName();
- try {
- if( languageList.size() > 0 )
- {
- System.out.print("\nWrite to "+filename );
- BufferedWriter aBW = new BufferedWriter( new FileWriter( filename , true) );
- aBW.write( sourceString + "\n" );
- Iterator aIter = languageList.iterator();
- while( aIter.hasNext() ){
- SdfEntity aEntity = (SdfEntity)aIter.next();
- aBW.write( sourceString.getProject()+"\t" );
- aBW.write( sourceString.getSource_file()+"\t" );
- aBW.write( sourceString.getDummy1()+"\t" );
- aBW.write( sourceString.getResource_type()+"\t" );
- aBW.write( sourceString.getGid()+"\t" );
- aBW.write( sourceString.getLid()+"\t" );
- aBW.write( sourceString.getHelpid()+"\t" );
- aBW.write( sourceString.getPlatform()+"\t" );
- aBW.write( sourceString.getDummy2()+"\t" );
- if( aEntity.getLangid() == null )
- aBW.write( "\t" );
- else
- aBW.write( aEntity.getLangid()+"\t" );
- if( aEntity.getText() == null )
- aBW.write( "\t" );
- else
- aBW.write( aEntity.getText()+"\t" );
- if( aEntity.getHelptext() == null )
- aBW.write( "\t" );
- else
- aBW.write( aEntity.getHelptext()+"\t" );
- if( aEntity.getQuickhelptext() == null )
- aBW.write( "\t" );
- else
- aBW.write( aEntity.getQuickhelptext()+"\t" );
- if( aEntity.getTitle() == null )
- aBW.write( "\t" );
- else
- aBW.write( aEntity.getTitle()+"\t" );
- aBW.write( "2002-02-02 02:02:02\n" );
- }
- aBW.close();
- }
- } catch (IOException e) {
- // TODO Auto-generated catch block
- //e.printStackTrace();
- System.out.println("\nERROR: Can't write to file '"+filename+"'\nPlease contact RE/Tooling!");
- }
- }
-}
diff --git a/l10ntools/java/receditor/java/transex3/view/Editor.java b/l10ntools/java/receditor/java/transex3/view/Editor.java
deleted file mode 100644
index f46a82a11a2b..000000000000
--- a/l10ntools/java/receditor/java/transex3/view/Editor.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package transex3.view;
-import javax.swing.*;
-import java.awt.*;
-
-public class Editor extends JFrame{
- Object[] columnnames = { "File" , "GID" , "LID" , "String" };
- Object[] stringcolnames = { "Language", "Text", "Helptext" , "Quickhelptext","Title"};
- //Object[][] data = new Object[4][1];//{ { "a " }, { "v " }, { "v " } , { "a " } };
- JTable table = null;
- JTable rectable = null;
- JComboBox cBox = null;
- JMenuBar menubar = null;
- JMenu filemenu = null;
- JMenuItem miNew = null;
- JMenuItem miSave = null;
- JMenuItem miExit = null;
- //JButton button = null;
-
- public Editor( Object[][] tabledata , Object[][] firstdata ){
- table = new JTable( tabledata , columnnames );
- rectable = new SdfTable( firstdata , stringcolnames );
- menubar = new JMenuBar();
- filemenu = new JMenu("File");
- //miNew = new JMenuItem("New");
- miSave = new JMenuItem("Save");
- miExit = new JMenuItem("Exit");
- //button = new JButton("Edit");
- //filemenu.add( miNew );
- filemenu.add( miSave );
- filemenu.add( miExit );
- menubar.add( filemenu );
-
- Container contentPane = getContentPane();
- //contentPane.add( new ControlPanel() , BorderLayout.NORTH );
- contentPane.add( menubar , BorderLayout.NORTH );
- //JPanel aPanel = new JPanel( new FlowLayout( FlowLayout.CENTER) );
- JPanel aPanel = new JPanel( new GridLayout( 2,1 ) );
- aPanel.add( new JScrollPane( table ) );
- aPanel.add( new JScrollPane( rectable ) );
- contentPane.add( aPanel , BorderLayout.CENTER );
- //contentPane.add( button , BorderLayout.SOUTH );
- //contentPane.add( new JScrollPane( table ), BorderLayout.CENTER );
- //contentPane.add( new JScrollPane( table ), BorderLayout.SOUTH );
- //contentPane.add( new JScrollPane( rectable ), BorderLayout.SOUTH );
- //contentPane.add( new JScrollPane( rectable ), BorderLayout.SOUTH );
- this.repaint();
-
- }
-
- public JTable getRectable() {
- return rectable;
- }
-
- public void setRectable(JTable rectable) {
- this.rectable = rectable;
- }
-
- public JTable getTable() {
- return table;
- }
-
- public void setTable(JTable table) {
- this.table = table;
- }
-
- /*public JButton getButton() {
- return button;
- }
-
- public void setButton(JButton button) {
- this.button = button;
- }*/
-
- public JMenuItem getMiExit() {
- return miExit;
- }
-
- public void setMiExit(JMenuItem miExit) {
- this.miExit = miExit;
- }
-
- public JMenuItem getMiSave() {
- return miSave;
- }
-
- public void setMiSave(JMenuItem miSave) {
- this.miSave = miSave;
- }
-
- /*public void setTableData(){
-
- }*/
-
-}
-
-//class ControlPanel extends JPanel{}
-
diff --git a/l10ntools/java/receditor/java/transex3/view/SdfTable.java b/l10ntools/java/receditor/java/transex3/view/SdfTable.java
deleted file mode 100644
index f0cc7bd84a34..000000000000
--- a/l10ntools/java/receditor/java/transex3/view/SdfTable.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package transex3.view;
-
-import javax.swing.JTable;
-
-class SdfTable extends JTable{
- //private String tableId;
- public SdfTable( Object[][] obj1 , Object[] obj2){
- super(obj1,obj2);
- }
- //@Override
- public boolean isCellEditable(int row, int col) {
- if( row == 0 && col == 0 || row == 0 && col == 1 || row == 0 && col == 2 || row == 0 && col == 3 || row == 0 && col == 4 )
- return false;
- else
- return true;
- }
- /*public String getTableId() {
- return tableId;
- }
- public void setTableId(String tableId) {
- this.tableId = tableId;
- }*/
-
-} \ No newline at end of file
diff --git a/l10ntools/java/receditor/makefile.mk b/l10ntools/java/receditor/makefile.mk
deleted file mode 100755
index 63587a557ec6..000000000000
--- a/l10ntools/java/receditor/makefile.mk
+++ /dev/null
@@ -1,35 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# 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.
-#
-# 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).
-#
-# 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.
-#
-#*************************************************************************
-
-PRJ=../..
-PRJNAME=l10ntools
-TARGET=receditor
-
-.INCLUDE : ant.mk
-
-ALLTAR : ANTBUILD
-
diff --git a/l10ntools/java/receditor/receditor.MF b/l10ntools/java/receditor/receditor.MF
deleted file mode 100755
index dced97882df9..000000000000
--- a/l10ntools/java/receditor/receditor.MF
+++ /dev/null
@@ -1 +0,0 @@
-Main-Class: transex3.controller.Main
diff --git a/l10ntools/layout/layoutparse.cxx b/l10ntools/layout/layoutparse.cxx
index f24cc432bf41..d3d80b6e95af 100644
--- a/l10ntools/layout/layoutparse.cxx
+++ b/l10ntools/layout/layoutparse.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -44,11 +45,15 @@ LayoutXMLFile::SearchL10NElements( XMLParentNode* pCur, int )
/* Recurse int children, SearchL10NElements does not do that for us. */
if ( XMLChildNodeList* lst = pCur->GetChildList() )
- for ( sal_uLong i = 0; i < lst->Count(); i++ )
- if ( lst->GetObject( i )->GetNodeType() == XML_NODE_TYPE_ELEMENT )
- HandleElement( ( XMLElement* )lst->GetObject( i ) );
- else if ( lst->GetObject( i )->GetNodeType() == XML_NODE_TYPE_COMMENT )
- lst->Remove( i-- );
+ for ( size_t i = 0; i < lst->size(); i++ )
+ if ( (*lst)[ i ]->GetNodeType() == XML_NODE_TYPE_ELEMENT )
+ HandleElement( ( XMLElement* )(*lst)[ i ] );
+ else if ( (*lst)[ i ]->GetNodeType() == XML_NODE_TYPE_COMMENT ) {
+ XMLChildNodeList::iterator it = lst->begin();
+ ::std::advance( it, i );
+ lst->erase( it );
+ i--;
+ }
}
std::vector<XMLAttribute*>
@@ -56,11 +61,11 @@ interestingAttributes( XMLAttributeList* lst )
{
std::vector<XMLAttribute*> interesting;
if ( lst )
- for ( sal_uLong i = 0; i < lst->Count(); i++ )
- if ( lst->GetObject( i )->Equals( STRING( "id" ) ) )
- interesting.insert( interesting.begin(), lst->GetObject( i ) );
- else if ( ! BSTRING( *lst->GetObject( i ) ).CompareTo( "_", 1 ) )
- interesting.push_back( lst->GetObject( i ) );
+ for ( size_t i = 0; i < lst->size(); i++ )
+ if ( (*lst)[ i ]->Equals( STRING( "id" ) ) )
+ interesting.insert( interesting.begin(), (*lst)[ i ] );
+ else if ( ! BSTRING( *(*lst)[ i ]).CompareTo( "_", 1 ) )
+ interesting.push_back( (*lst)[ i ] );
return interesting;
}
@@ -133,3 +138,5 @@ sal_Bool LayoutXMLFile::Write( ByteString &aFilename )
}
return false;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/layout/layoutparse.hxx b/l10ntools/layout/layoutparse.hxx
index 2cf560b96893..a9155eaa7503 100644
--- a/l10ntools/layout/layoutparse.hxx
+++ b/l10ntools/layout/layoutparse.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -49,3 +50,5 @@ public:
std::vector<XMLAttribute*> interestingAttributes( XMLAttributeList* lst );
#endif /* LAYOUTPARSE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/layout/makefile.mk b/l10ntools/layout/makefile.mk
index 95d6aa9863f4..dee3c6e81b33 100644
--- a/l10ntools/layout/makefile.mk
+++ b/l10ntools/layout/makefile.mk
@@ -31,7 +31,6 @@ INCPRE=$(MISC)
PRJNAME=l10ntools
TARGET=tralay
-#TARGETTYPE=GUI
TARGETTYPE=CUI
LIBTARGET=no
@@ -62,9 +61,8 @@ APP1OBJS = $(OBJFILES)
APP1STDLIBS =\
$(TOOLSLIB)\
$(EXPATASCII3RDLIB)\
- $(VOSLIB)\
$(CPPULIB) \
- $(SALLIB)
+ $(SALLIB)
# --- Targets ------------------------------------------------------
diff --git a/l10ntools/layout/tralay.cxx b/l10ntools/layout/tralay.cxx
index 9e6fa32bb094..e8c614450ca9 100644
--- a/l10ntools/layout/tralay.cxx
+++ b/l10ntools/layout/tralay.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -26,9 +27,11 @@
************************************************************************/
#include <com/sun/star/xml/sax/SAXException.hpp>
-#include <l10ntools/vosapp.hxx>
#include <osl/file.hxx>
+#include <osl/process.h>
+
+#include <l10ntools/vosapp.hxx>
#include "export.hxx"
#include "layoutparse.hxx"
@@ -163,9 +166,9 @@ void TranslateLayout::ParseCommandLine()
static XMLAttribute*
findAttribute( XMLAttributeList* lst, String const& name )
{
- for ( sal_uLong i = 0; i < lst->Count(); i++ )
- if ( lst->GetObject( i )->Equals( name ) )
- return lst->GetObject( i );
+ for ( size_t i = 0; i < lst->size(); i++ )
+ if ( (*lst)[ i ]->Equals( name ) )
+ return (*lst)[ i ];
return 0;
}
@@ -174,7 +177,17 @@ translateAttribute( XMLAttributeList* lst,
String const& name, String const& translation )
{
if ( XMLAttribute* a = findAttribute( lst, name ) )
- return lst->Replace ( new XMLAttribute( name.Copy( 1 ), translation ), a );
+ {
+ for ( XMLAttributeList::iterator it = lst->begin(); it < lst->end(); ++it )
+ {
+ if ( *it == a )
+ {
+ delete *it;
+ *it = new XMLAttribute( name.Copy( 1 ), translation );
+ return *it;
+ }
+ }
+ }
return 0;
}
@@ -201,13 +214,8 @@ translateElement( XMLElement* element, ByteString const& lang,
{
ByteString translation;
entry->GetText( translation, STRING_TYP_TEXT, lang, true );
- // ByteString original = removeContent( element );
if ( !translation.Len() )
-#if 0
- translation = original;
-#else
translation = BSTRING( ( *i )->GetValue() );
-#endif
delete translateAttribute( attributes, **i , STRING( translation ) );
}
}
@@ -221,7 +229,7 @@ static bool is_dir( ByteString const& name )
FileBase::getFileURLFromSystemPath( sFileURL, sFileURL );
if( DirectoryItem::get( sFileURL, aItem ) == FileBase::E_None )
{
- FileStatus aStatus(FileStatusMask_Type);
+ FileStatus aStatus(osl_FileStatus_Mask_Type);
if( aItem.getFileStatus( aStatus ) == FileBase::E_None )
{
if( aStatus.getFileType() == FileStatus::Directory )
@@ -241,17 +249,23 @@ static void make_directory( ByteString const& name )
static void insertMarker( XMLParentNode *p, ByteString const& file )
{
if ( XMLChildNodeList* lst = p->GetChildList() )
- if ( lst->Count() )
+ if ( !lst->empty() )
{
- sal_uLong i = 1;
+ size_t i = 1;
// Skip newline, if possible.
- if ( lst->Count() > 1
- && lst->GetObject( 2 )->GetNodeType() == XML_NODE_TYPE_DEFAULT )
+ if ( lst->size() > 2
+ && (*lst)[ 2 ]->GetNodeType() == XML_NODE_TYPE_DEFAULT )
i++;
- OUString marker = OUString::createFromAscii( "\n NOTE: This file has been generated automagically by transex3/layout/tralay,\n from source template: " )
+ OUString marker = OUString(RTL_CONSTASCII_USTRINGPARAM("\n NOTE: This file has been generated automagically by transex3/layout/tralay,\n from source template: "))
+ STRING( file )
- + OUString::createFromAscii( ".\n Do not edit, changes will be lost.\n" );
- lst->Insert( new XMLComment( marker, 0 ), i );
+ + OUString(RTL_CONSTASCII_USTRINGPARAM(".\n Do not edit, changes will be lost.\n"));
+ if ( i < lst->size() ) {
+ XMLChildNodeList::iterator it = lst->begin();
+ ::std::advance( it, i );
+ lst->insert( it, new XMLComment( marker, 0 ) );
+ } else {
+ lst->push_back( new XMLComment( marker, 0 ) );
+ }
}
}
@@ -362,14 +376,14 @@ void TranslateLayout::Main()
aStr += OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US );
}
fprintf( stderr, "error: parsing: '%s'\n", aStr.getStr() );
- OSL_ENSURE( 0, aStr.getStr() );
+ OSL_FAIL( aStr.getStr() );
}
catch ( uno::Exception& rExc )
{
OString aStr( OUStringToOString( rExc.Message,
RTL_TEXTENCODING_ASCII_US ) );
fprintf( stderr, "error: UNO: '%s'\n", aStr.getStr() );
- OSL_ENSURE( 0, aStr.getStr() );
+ OSL_FAIL( aStr.getStr() );
}
}
@@ -397,3 +411,5 @@ SAL_IMPLEMENT_MAIN()
t.Main();
return 0;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/prj/build.lst b/l10ntools/prj/build.lst
index d8a2e8c00649..acd989c9e129 100644
--- a/l10ntools/prj/build.lst
+++ b/l10ntools/prj/build.lst
@@ -1,10 +1,8 @@
-tr l10ntools : tools LIBXSLT:libxslt BERKELEYDB:berkeleydb LUCENE:lucene PYTHON:python NULL
+tr l10ntools : tools LIBXSLT:libxslt BERKELEYDB:berkeleydb LUCENE:lucene NULL
tr l10ntools usr1 - all tr_mkout NULL
tr l10ntools\inc nmake - all tr_inc NULL
-tr l10ntools\scripts nmake - all tr_scripts NULL
tr l10ntools\source nmake - all tr_src tr_inc NULL
tr l10ntools\layout nmake - all rt_layout tr_src tr_inc NULL
-tr l10ntools\java\jpropex nmake - all tr_blah NULL
tr l10ntools\source\help nmake - all tr_bla_help NULL
tr l10ntools\source\filter\utils nmake - all tr_bla_utils NULL
tr l10ntools\source\filter\merge nmake - all tr_bla_merge tr_bla_utils NULL
diff --git a/l10ntools/prj/d.lst b/l10ntools/prj/d.lst
index 29dd21cee543..f2051d79068a 100644
--- a/l10ntools/prj/d.lst
+++ b/l10ntools/prj/d.lst
@@ -1,77 +1,54 @@
-mkdir: %_DEST%\inc%_EXT%\l10ntools
-mkdir: %_DEST%\bin%_EXT%
-mkdir: %_DEST%\bin%_EXT%\help
-mkdir: %_DEST%\bin%_EXT%\help\com
-mkdir: %_DEST%\bin%_EXT%\help\com\sun
-mkdir: %_DEST%\bin%_EXT%\help\com\sun\star
-mkdir: %_DEST%\bin%_EXT%\help\com\sun\star\help
+mkdir: %_DEST%\inc\l10ntools
+mkdir: %_DEST%\bin
+mkdir: %_DEST%\bin\help
+mkdir: %_DEST%\bin\help\com
+mkdir: %_DEST%\bin\help\com\sun
+mkdir: %_DEST%\bin\help\com\sun\star
+mkdir: %_DEST%\bin\help\com\sun\star\help
-..\%__SRC%\bin\cfgex.exe %_DEST%\bin%_EXT%\cfgex.exe
-..\%__SRC%\bin\cfgex %_DEST%\bin%_EXT%\cfgex
-..\%__SRC%\bin\transex3.exe %_DEST%\bin%_EXT%\transex3.exe
-..\%__SRC%\bin\transex3 %_DEST%\bin%_EXT%\transex3
-..\%__SRC%\bin\lngex.exe %_DEST%\bin%_EXT%\lngex.exe
-..\%__SRC%\bin\lngex %_DEST%\bin%_EXT%\lngex
-..\%__SRC%\bin\localize_sl.exe %_DEST%\bin%_EXT%\localize_sl.exe
-..\%__SRC%\bin\localize_sl %_DEST%\bin%_EXT%\localize_sl
-..\%__SRC%\bin\xrmex.exe %_DEST%\bin%_EXT%\xrmex.exe
-..\%__SRC%\bin\xrmex %_DEST%\bin%_EXT%\xrmex
-..\%__SRC%\bin\gsicheck.exe %_DEST%\bin%_EXT%\gsicheck.exe
-..\%__SRC%\bin\gsicheck %_DEST%\bin%_EXT%\gsicheck
-..\%__SRC%\bin\helpex.exe %_DEST%\bin%_EXT%\helpex.exe
-..\%__SRC%\bin\helpex %_DEST%\bin%_EXT%\helpex
-..\%__SRC%\bin\ulfex.exe %_DEST%\bin%_EXT%\ulfex.exe
-..\%__SRC%\bin\ulfex %_DEST%\bin%_EXT%\ulfex
-..\%__SRC%\bin\txtconv.exe %_DEST%\bin%_EXT%\txtconv.exe
-..\%__SRC%\bin\txtconv %_DEST%\bin%_EXT%\txtconv
-..\%__SRC%\bin\tralay.exe %_DEST%\bin%_EXT%\tralay.exe
-..\%__SRC%\bin\tralay %_DEST%\bin%_EXT%\tralay
-..\%__SRC%\bin\ulfconv %_DEST%\bin%_EXT%\ulfconv
-..\%__SRC%\class\FCFGMerge.jar %_DEST%\bin%_EXT%\FCFGMerge.jar
-..\%__SRC%\class\HelpIndexerTool.jar %_DEST%\bin%_EXT%\HelpIndexerTool.jar
-..\%__SRC%\class\jpropex\jpropex.jar %_DEST%\bin%_EXT%\jpropex.jar
-..\%__SRC%\bin\HelpLinker %_DEST%\bin%_EXT%\HelpLinker
-..\%__SRC%\bin\HelpCompiler %_DEST%\bin%_EXT%\HelpCompiler
-..\%__SRC%\bin\HelpCompiler.exe %_DEST%\bin%_EXT%\HelpCompiler.exe
-..\%__SRC%\bin\HelpLinker.exe %_DEST%\bin%_EXT%\HelpLinker.exe
-..\%__SRC%\bin\HelpLinker* %_DEST%\bin%_EXT%
+..\%__SRC%\bin\cfgex.exe %_DEST%\bin\cfgex.exe
+..\%__SRC%\bin\cfgex %_DEST%\bin\cfgex
+..\%__SRC%\bin\transex3.exe %_DEST%\bin\transex3.exe
+..\%__SRC%\bin\transex3 %_DEST%\bin\transex3
+..\%__SRC%\bin\lngex.exe %_DEST%\bin\lngex.exe
+..\%__SRC%\bin\lngex %_DEST%\bin\lngex
+..\%__SRC%\bin\localize_sl.exe %_DEST%\bin\localize_sl.exe
+..\%__SRC%\bin\localize_sl %_DEST%\bin\localize_sl
+..\%__SRC%\bin\xrmex.exe %_DEST%\bin\xrmex.exe
+..\%__SRC%\bin\xrmex %_DEST%\bin\xrmex
+..\%__SRC%\bin\gsicheck.exe %_DEST%\bin\gsicheck.exe
+..\%__SRC%\bin\gsicheck %_DEST%\bin\gsicheck
+..\%__SRC%\bin\helpex.exe %_DEST%\bin\helpex.exe
+..\%__SRC%\bin\helpex %_DEST%\bin\helpex
+..\%__SRC%\bin\ulfex.exe %_DEST%\bin\ulfex.exe
+..\%__SRC%\bin\ulfex %_DEST%\bin\ulfex
+..\%__SRC%\bin\txtconv.exe %_DEST%\bin\txtconv.exe
+..\%__SRC%\bin\txtconv %_DEST%\bin\txtconv
+..\%__SRC%\bin\tralay.exe %_DEST%\bin\tralay.exe
+..\%__SRC%\bin\tralay %_DEST%\bin\tralay
+..\%__SRC%\bin\ulfconv %_DEST%\bin\ulfconv
+..\%__SRC%\class\FCFGMerge.jar %_DEST%\bin\FCFGMerge.jar
+..\%__SRC%\class\HelpIndexerTool.jar %_DEST%\bin\HelpIndexerTool.jar
+..\%__SRC%\class\jpropex\jpropex.jar %_DEST%\bin\jpropex.jar
+..\%__SRC%\bin\HelpLinker %_DEST%\bin\HelpLinker
+..\%__SRC%\bin\HelpCompiler %_DEST%\bin\HelpCompiler
+..\%__SRC%\bin\HelpCompiler.exe %_DEST%\bin\HelpCompiler.exe
+..\%__SRC%\bin\HelpLinker.exe %_DEST%\bin\HelpLinker.exe
+..\%__SRC%\bin\HelpLinker* %_DEST%\bin
-..\%__SRC%\class\converter\converter.jar %_DEST%\bin%_EXT%\converter.jar
-..\%__SRC%\doc\converter_javadoc.zip %_DEST%\bin%_EXT%\converter_javadoc.zip
+..\scripts\localize.pl %_DEST%\bin\localize.pl
+..\scripts\localize %_DEST%\bin\localize
+..\scripts\fast_merge.pl %_DEST%\bin\fast_merge.pl
+..\scripts\keyidGen.pl %_DEST%\bin\keyidGen.pl
+..\inc\export.hxx %_DEST%\inc\l10ntools\export.hxx
+..\inc\l10ntools\directory.hxx %_DEST%\inc\l10ntools\directory.hxx
+..\inc\l10ntools\file.hxx %_DEST%\inc\l10ntools\file.hxx
+..\inc\l10ntools\vosapp.hxx %_DEST%\inc\l10ntools\vosapp.hxx
+..\source\filter\merge\FCFGMerge.cfg %_DEST%\inc\l10ntools\FCFGMerge.cfg
-..\%__SRC%\class\receditor\receditor.jar %_DEST%\bin%_EXT%\receditor.jar
+..\%__SRC%\lib\transex.lib %_DEST%\lib\transex.lib
+..\%__SRC%\lib\libtransex.a %_DEST%\lib\libtransex.a
-..\java\jpropex\jpropex %_DEST%\bin%_EXT%\jpropex
-..\scripts\localize.pl %_DEST%\bin%_EXT%\localize.pl
-..\scripts\localize_old.pl %_DEST%\bin%_EXT%\localize_old.pl
-..\scripts\localize %_DEST%\bin%_EXT%\localize
-..\scripts\fast_merge.pl %_DEST%\bin%_EXT%\fast_merge.pl
-..\scripts\keyidGen.pl %_DEST%\bin%_EXT%\keyidGen.pl
-..\scripts\xtxex %_DEST%\bin%_EXT%\xtxex
-..\scripts\xhtex %_DEST%\bin%_EXT%\xhtex
-..\%__SRC%\bin\const.py %_DEST%\bin%_EXT%\const.py
-..\%__SRC%\bin\l10ntool.py %_DEST%\bin%_EXT%\l10ntool.py
-..\%__SRC%\bin\pseudo.py %_DEST%\bin%_EXT%\pseudo.py
-..\%__SRC%\bin\sdf.py %_DEST%\bin%_EXT%\sdf.py
-..\%__SRC%\bin\const.pyc %_DEST%\bin%_EXT%\const.pyc
-..\%__SRC%\bin\l10ntool.pyc %_DEST%\bin%_EXT%\l10ntool.pyc
-..\%__SRC%\bin\pseudo.pyc %_DEST%\bin%_EXT%\pseudo.pyc
-..\%__SRC%\bin\sdf.pyc %_DEST%\bin%_EXT%\sdf.pyc
-..\%__SRC%\bin\xhtex.py %_DEST%\bin%_EXT%\xhtex.py
-..\%__SRC%\bin\xtxex.py %_DEST%\bin%_EXT%\xtxex.py
-..\%__SRC%\bin\xhtex.pyc %_DEST%\bin%_EXT%\xhtex.pyc
-..\%__SRC%\bin\xtxex.pyc %_DEST%\bin%_EXT%\xtxex.pyc
-..\inc\export.hxx %_DEST%\inc%_EXT%\l10ntools\export.hxx
-..\inc\l10ntools\directory.hxx %_DEST%\inc%_EXT%\l10ntools\directory.hxx
-..\inc\l10ntools\file.hxx %_DEST%\inc%_EXT%\l10ntools\file.hxx
-..\inc\l10ntools\vosapp.hxx %_DEST%\inc%_EXT%\l10ntools\vosapp.hxx
-..\source\filter\merge\FCFGMerge.cfg %_DEST%\inc%_EXT%\l10ntools\FCFGMerge.cfg
-
-..\inc\utf8conv.hxx %_DEST%\inc%_EXT%\l10ntools\utf8conv.hxx
-..\%__SRC%\lib\transex.lib %_DEST%\lib%_EXT%\transex.lib
-..\%__SRC%\lib\libtransex.a %_DEST%\lib%_EXT%\libtransex.a
-
-..\source\help\compilehelp.hxx %_DEST%\inc%_EXT%\l10ntools\compilehelp.hxx
-#..\source\help\helplinkerdllapi.h %_DEST%\inc%_EXT%\l10ntools\helplinkerdllapi.h
-..\%__SRC%\lib\* %_DEST%\lib%_EXT%\*
-..\%__SRC%\class\com\sun\star\help\* %_DEST%\bin%_EXT%\help\com\sun\star\help\*
+..\source\help\compilehelp.hxx %_DEST%\inc\l10ntools\compilehelp.hxx
+..\%__SRC%\lib\* %_DEST%\lib\*
+..\%__SRC%\class\com\sun\star\help\* %_DEST%\bin\help\com\sun\star\help\*
diff --git a/l10ntools/scripts/localize.pl b/l10ntools/scripts/localize.pl
index 6dac386011e0..82e77930c2e0 100755
--- a/l10ntools/scripts/localize.pl
+++ b/l10ntools/scripts/localize.pl
@@ -73,9 +73,6 @@ my $srcpath = '';
my $languages;
#my %sl_modules; # Contains all modules where en-US and de is source language
my $use_default_date = '0';
-my $force_ooo_module = '0';
-my %is_ooo_module;
-my %is_so_module;
# ( leftpart ) ( rightpart )
# prj file dummy type gid lid helpid pform width lang text helptext qhelptext title timestamp
@@ -89,17 +86,7 @@ my @sdfparticles;
parse_options();
my $binpath = '';
-if( defined $ENV{UPDMINOREXT} )
-{
- $binpath = $ENV{SOLARVER}."/".$ENV{INPATH}."/bin".$ENV{UPDMINOREXT}."/" ;
-}
-else
-{
- $binpath = $ENV{SOLARVER}."/".$ENV{INPATH}."/bin/" ;
-}
-
-#%sl_modules = fetch_sourcelanguage_dirlist();
-
+$binpath = $ENV{SOLARVER}."/".$ENV{INPATH}."/bin/" ;
if ( $mode eq "merge" ) {
if ( ! $no_gsicheck ){
@@ -140,9 +127,6 @@ sub splitfile{
# my %lang_hash;
my %string_hash_ooo;
- my %string_hash_so;
- my %so_modules;
- $so_modules{ "extras_full" } = "TRUE";
while( <MYFILE>){
if( /$sdf_regex/ ){
@@ -158,38 +142,20 @@ sub splitfile{
next if( $prj eq "binfilter" ); # Don't merge strings into binfilter module
chomp( $line );
- if( $force_ooo_module )
- {
- $string_hash_ooo { $lang }{ "$prj\t$file\t$type\t$gid\t$lid\t$helpid\t$plattform\t$lang" } = $line;
- }
- else
- {
- $string_hash_so{ $lang }{ "$prj\t$file\t$type\t$gid\t$lid\t$helpid\t$plattform\t$lang" } = $line;
- }
+ $string_hash_ooo { $lang }{ "$prj\t$file\t$type\t$gid\t$lid\t$helpid\t$plattform\t$lang" } = $line;
}
}
close( MYFILE );
- if( !defined $ENV{SOURCE_ROOT_DIR} ){
- print "Error, no SOURCE_ROOT_DIR in env found.\n";
+ if( !defined $ENV{SRC_ROOT} ){
+ print "Error, no SRC_ROOT in env found.\n";
exit( -1 );
}
- my $src_root = $ENV{SOURCE_ROOT_DIR};
- my $ooo_src_root = $src_root."/l10n";
- my $so_l10n_path = $src_root."/sun/l10n_so/source";
- my $ooo_l10n_path = $ooo_src_root."/l10n/source";
-
- #print "$so_l10n_path\n";
- #print "$ooo_l10n_path\n";
+ my $src_root = $ENV{SRC_ROOT};
+ my $ooo_src_root = $ENV{SRC_ROOT};
+ my $ooo_l10n_path = $ooo_src_root."/translations/source";
- if( $force_ooo_module )
- {
- write_sdf( \%string_hash_ooo , $ooo_l10n_path );
- }
- else
- {
- write_sdf( \%string_hash_so , $so_l10n_path );
- }
+ write_sdf( \%string_hash_ooo , $ooo_l10n_path );
}
sub write_sdf
@@ -314,8 +280,9 @@ sub merge_gsicheck{
$command .= "$ENV{SOLARVER}/$ENV{INPATH}/bin/gsicheck";
my $errfile = $sdffile.".err";
- $command .= " -k -c -wcf $tmpfile -wef $errfile -l \"\" $sdffile";
+ $command .= " -k -c -wcf $tmpfile -wef ".fix_cygwin_path($errfile)." -l \"\" ".fix_cygwin_path($sdffile);
#my $rc = system( $command );
+ if ($bVerbose) { print STDOUT "localize.pl running $command\n"; }
my $output = `$command`;
my $rc = $? << 8;
if ( $output ne "" ){
@@ -330,24 +297,11 @@ sub merge_gsicheck{
}
$sdffile = $tmpfile;
}
-#########################################################
-# find search function
-sub wanted
-{
- my $file = $File::Find::name;
- if( -f $file && $file =~ /.*localize.sdf$/ && !( $file =~ /.*\.svn.*/ ) ) {
- push @sdfparticles , $file;
- if( $bVerbose eq "1" ) { print STDOUT "$file\n"; }
- else { print "."; }
- }
-}
-
sub add_paths
{
my $langhash_ref = shift;
my $root_dir = $ENV{ SRC_ROOT };
- my $ooo_l10n_dir = "$root_dir/l10n/source";
- my $so_l10n_dir = "$root_dir/l10n_so/source";
+ my $ooo_l10n_dir = "$root_dir/translations/source";
if( -e $ooo_l10n_dir )
{
@@ -362,20 +316,6 @@ sub add_paths
}
}
else { die "ERROR: Can not find directory $ooo_l10n_dir!!!" }
- if( -e $so_l10n_dir )
- {
- foreach my $lang ( keys( %{ $langhash_ref } ) )
- {
- my $loc_file = "$so_l10n_dir/$lang/localize.sdf";
- if( -e $loc_file )
- {
- push @sdfparticles , "$ooo_l10n_dir/$lang/localize.sdf";
- }
- else { #print "WARNING: $loc_file not found ....\n";
- }
- }
-
- }
}
sub collectfiles{
print STDOUT "### Localize\n";
@@ -387,7 +327,7 @@ sub collectfiles{
STDOUT->autoflush( 1 );
my $working_path = getcwd();
- chdir $ENV{SOURCE_ROOT_DIR}, if defined $ENV{SOURCE_ROOT_DIR};
+ chdir $ENV{SRC_ROOT}, if defined $ENV{SRC_ROOT};
add_paths( $langhash_ref );
my ( $LOCALIZEPARTICLE , $localizeSDF ) = File::Temp::tempfile();
@@ -409,12 +349,12 @@ sub collectfiles{
}else{
$command = $binpath."localize_sl";
}
- print $command;
+ print $command . "\n";
# -e
# if ( -x $command ){
if( $command ){
if( !$bVerbose ){ $args .= " "; }
- $args .= " -e -f $localizeSDF -l ";
+ $args .= " -e -f ".fix_cygwin_path($localizeSDF)." -l ";
my $bFlag="";
if( $bAll ) {$args .= " en-US";}
else{
@@ -626,147 +566,9 @@ sub collectfiles{
#print STDOUT "DBG: \$localizeSDF $localizeSDF \$particleSDF_merged $particleSDF_merged\n";
unlink $localizeSDF , $particleSDF_merged , $my_localize_log;
-
- #sort_outfile( $outputfile );
- #remove_obsolete( $outputfile ) , if $bHasSourceLanguage ne "";
}
#########################################################
-sub remove_obsolete{
- my $outfile = shift;
- my @lines;
- my $enusleftpart;
- my @good_lines;
-
- print STDOUT "### Removing obsolete strings\n";
-
- # Kick out all strings without en-US reference
- if ( open ( SORTEDFILE , "< $outfile" ) ){
- while( <SORTEDFILE> ){
- if( /$sdf_regex/ ){
- my $line = defined $_ ? $_ : '';
- my $language = defined $12 ? $12 : '';
- my $prj = defined $3 ? $3 : '';
- my $file = defined $4 ? $4 : '';
- my $type = defined $6 ? $6 : '';
- my $gid = defined $7 ? $7 : '';
- my $lid = defined $8 ? $8 : '';
- my $plattform = defined $10 ? $10 : '';
- my $helpid = defined $9 ? $9 : '';
-
- my $leftpart = $prj.$gid.$lid.$file.$type.$plattform.$helpid;
-
- if( $language eq "en-US" ){ # source string found, 1. entry
- $enusleftpart = $leftpart;
- push @good_lines , $line;
- }else{
- if( !defined $enusleftpart or !defined $leftpart ){
- print STDERR "BADLINE: $line\n";
- print STDERR "\$enusleftpart = $enusleftpart\n";
- print STDERR "\$leftpart = $leftpart\n";
- }
- if( $enusleftpart eq $leftpart ){ # matching language
- push @good_lines , $line;
- }
- #else{
- # print STDERR "OUT: \$enusleftpart=$enusleftpart \$leftpart=$leftpart \$line=$line\n";
- #}
- }
- }
- }
- close SORTEDFILE;
- } else { print STDERR "ERROR: Can't open file $outfile\n";}
-
- # Write file
- if ( open ( SORTEDFILE , "> $outfile" ) ){
- foreach my $newline ( @good_lines ) {
- print SORTEDFILE $newline;
- }
- close SORTEDFILE;
- } else { print STDERR "ERROR: Can't open file $outfile\n";}
-
-}
-#########################################################
-sub sort_outfile{
- my $outfile = shift;
- print STDOUT "### Sorting ... $outfile ...";
- my @lines;
- my @sorted_lines;
-
-
- #if ( open ( SORTEDFILE , "< $outputfile" ) ){
- if ( open ( SORTEDFILE , "< $outfile" ) ){
- my $line;
- while ( <SORTEDFILE> ){
- $line = $_;
- if( $line =~ /^[^\#]/ ){
- push @lines , $line;
- }
- }
- close SORTEDFILE;
- @sorted_lines = sort {
- my $xa_lang = "";
- my $xa_left_part = "";
- my $xa_right_part = "";
- my $xa_timestamp = "";
- my $xb_lang = "";
- my $xb_left_part = "";
- my $xb_right_part = "";
- my $xb_timestamp = "";
- my $xa = "";
- my $xb = "";
- my @alist;
- my @blist;
-
- if( $a=~ /$sdf_regex/ ){
- $xa_left_part = defined $2 ? $2 : '';
- $xa_lang = defined $12 ? $12 : '';
- $xa_right_part = defined $13 ? $13 : '';
- $xa_left_part = remove_last_column( $xa_left_part );
-
- }
- if( $b=~ /$sdf_regex/ ){
- $xb_left_part = defined $2 ? $2 : '';
- $xb_lang = defined $12 ? $12 : '';
- $xb_right_part = defined $13 ? $13 : '';
- $xb_left_part = remove_last_column( $xb_left_part );
-
-
- }
- if( ( $xa_left_part cmp $xb_left_part ) == 0 ){ # Left part equal
- if( ( $xa_lang cmp $xb_lang ) == 0 ){ # Lang equal
- return ( $xa_right_part cmp $xb_right_part ); # Right part compare
- }
- elsif( $xa_lang eq "en-US" ) { return -1; } # en-US wins
- elsif( $xb_lang eq "en-US" ) { return 1; } # en-US wins
- else { return $xa_lang cmp $xb_lang; } # lang compare
- }
- else {
- return $xa_left_part cmp $xb_left_part; # Left part compare
- }
- } @lines;
-
- if ( open ( SORTEDFILE , "> $outfile" ) ){
- print SORTEDFILE get_license_header();
- foreach my $newline ( @sorted_lines ) {
- print SORTEDFILE $newline;
- #print STDOUT $newline;
- }
- }
- close SORTEDFILE;
- } else { print STDERR "WARNING: Can't open file $outfile\n";}
- print "done\n";
-
-}
-#########################################################
-sub remove_last_column{
- my $string = shift;
- my @alist = split ( "\t" , $string );
- pop @alist;
- return join( "\t" , @alist );
-}
-
-#########################################################
sub rename_language{
my $fallbackhashhash_ref = shift;
my $cur_fallback = shift;
@@ -1011,7 +813,7 @@ sub parse_options{
my $extract;
my $success = GetOptions('f=s' => \$sdffile , 'l=s' => \$languages , 's=s' => \$srcpath , 'h' => \$help , 'v' => \$bVerbose ,
'm' => \$merge , 'e' => \$extract , 'x' => \$no_sort , 'd' => \$use_default_date , 'c' => \$create_dirs ,
- 'n' => \$no_gsicheck , 'o' => \$force_ooo_module );
+ 'n' => \$no_gsicheck );
$outputfile = $sdffile;
#print STDOUT "DBG: lang = $languages\n";
@@ -1068,7 +870,6 @@ sub usage{
print STDERR " -h File with localize.sdf's\n!";
print STDERR " -n No gsicheck\n";
print STDERR " -i Module to merge\n";
- print STDERR " -o force using ooo localization from the l10n module instead of l10n_so; \n";
print STDERR " useful if the type can't be detected by the .svn tags; \n";
print STDERR " -v Verbose\n";
print STDERR "\nExample:\n";
@@ -1076,3 +877,16 @@ sub usage{
print STDERR "\nlocalize -m -l cs -f my.sdf\n( Merge cs translation into the sourcecode ) \n";
}
+sub fix_cygwin_path
+{
+ my ( $path ) = @_;
+
+ if ( $^O eq 'cygwin' )
+ {
+ $path = qx{cygpath -m "$path"};
+ chomp($path);
+ }
+
+ return $path;
+}
+
diff --git a/l10ntools/scripts/localize_old.pl b/l10ntools/scripts/localize_old.pl
deleted file mode 100755
index d6b66d6bb535..000000000000
--- a/l10ntools/scripts/localize_old.pl
+++ /dev/null
@@ -1,1070 +0,0 @@
-:
-eval 'exec perl -wS $0 ${1+"$@"}'
- if 0;
-
-
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# 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.
-#
-# 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).
-#
-# 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.
-#
-#*************************************************************************
-
-use strict;
-use Getopt::Long;
-use IO::Handle;
-use File::Find;
-use File::Temp;
-use File::Copy;
-use File::Glob qw(:glob csh_glob);
-use Cwd;
-
-# ver 1.1
-#
-#### module lookup
-#use lib ("$ENV{SOLARENV}/bin/modules", "$ENV{COMMON_ENV_TOOLS}/modules");
-
-#### module lookup
-# OOo conform
-my @lib_dirs;
-BEGIN {
- if ( !defined($ENV{SOLARENV}) ) {
- die "No environment found (environment variable SOLARENV is undefined)";
- }
- push(@lib_dirs, "$ENV{SOLARENV}/bin/modules");
- push(@lib_dirs, "$ENV{COMMON_ENV_TOOLS}/modules") if defined($ENV{COMMON_ENV_TOOLS});
-}
-use lib (@lib_dirs);
-
-#### globals ####
-my $sdffile = '';
-my $no_sort = '';
-my $outputfile = '';
-my $mode = '';
-my $bVerbose="0";
-my $srcpath = '';
-my $languages;
-#my %sl_modules; # Contains all modules where en-US and de is source language
-my $use_default_date = '0';
-
- # ( leftpart ) ( rightpart )
- # prj file dummy type gid lid helpid pform width lang text helptext qhelptext title timestamp
-my $sdf_regex = "((([^\t]*)\t([^\t]*)\t([^\t]*)\t([^\t]*)\t([^\t]*)\t([^\t]*)\t([^\t]*)\t([^\t]*)\t([^\t]*))\t([^\t]*)\t(([^\t]*)\t([^\t]*)\t([^\t]*)\t([^\t]*)\t)([^\t]*))";
-my $file_types = "(src|hrc|xcs|xcu|lng|ulf|xrm|xhp|xcd|xgf|xxl|xrb)";
-# Always use this date to prevent cvs conflicts
-my $default_date = "2002-02-02 02:02:02";
-
-#### main ####
-parse_options();
-
-#%sl_modules = fetch_sourcelanguage_dirlist();
-
-
-if ( $mode eq "merge" ) {
- merge_gsicheck();
- splitfile( $sdffile );
- unlink $sdffile; # remove temp file!
-}
-elsif( $mode eq "extract" ) {
- collectfiles( $outputfile );
-}
-else {
- usage();
-}
-
-exit(0);
-
-#########################################################
-sub splitfile{
-
- my $lastFile = '';
- my $currentFile = '';
- my $cur_sdffile = '';
- my $last_sdffile = '';
- my $delim;
- my $badDelim;
- my $start = 'TRUE';
- my %index = ();
- my %block;
-
- STDOUT->autoflush( 1 );
-
- #print STDOUT "Open File $sdffile\n";
- open MYFILE , "< $sdffile"
- or die "Can't open '$sdffile'\n";
-
- while( <MYFILE>){
- if( /$sdf_regex/ ){
- my $line = defined $_ ? $_ : '';
- my $prj = defined $3 ? $3 : '';
- my $file = defined $4 ? $4 : '';
- my $type = defined $6 ? $6 : '';
- my $gid = defined $7 ? $7 : '';
- my $lid = defined $8 ? $8 : '';
- my $lang = defined $12 ? $12 : '';
- my $plattform = defined $10 ? $10 : '';
- my $helpid = defined $9 ? $9 : '';
-
- next if( $prj eq "binfilter" ); # Don't merge strings into binfilter module
- chomp( $line );
- $currentFile = $srcpath . '\\' . $prj . '\\' . $file;
- $currentFile =~ s/\\/\//g;
-
- $cur_sdffile = $currentFile;
- #if( $cur_sdffile =~ /\.$file_types[\s]*$/ ){
- $cur_sdffile =~ s/\/[^\/]*\.$file_types[\s]*$/\/localize.sdf/;
- #}
-
- # Set default date
- if( $line =~ /(.*)\t[^\t\$]*$/ ){
- $line = $1."\t".$default_date;
- }
-
- if( $start ){
- $start='';
- $lastFile = $currentFile; # ?
- $last_sdffile = $cur_sdffile;
- }
-
- if( $lang eq "en-US" ){}
- elsif( $cur_sdffile eq $last_sdffile )
- {
- $block{ "$prj\t$file\t$type\t$gid\t$lid\t$helpid\t$plattform\t$lang" } = $line ;
- }
- else
- {
- writesdf( $lastFile , \%block );
- $lastFile = $currentFile; #?
- $last_sdffile = $cur_sdffile;
- %block = ();
- #if( ! $lang eq "en-US" ) {
- $block{ "$prj\t$file\t$type\t$gid\t$lid\t$helpid\t$plattform\t$lang" } = $line ;
- #}
-
- }
- } #else { print STDOUT "splitfile REGEX kaputt\n";}
-
- }
- writesdf( $lastFile , \%block );
- %block = ();
- close( MYFILE );
-
-}
-#########################################################
-
-sub writesdf{
-
- my $lastFile = shift;
- my $blockhash_ref = shift;
- my $localizeFile = $lastFile;
- my %index=();
-
- if( $localizeFile =~ /\.$file_types[\s]*$/ ){
- $localizeFile =~ s/\/[^\/]*\.$file_types[\s]*$/\/localize.sdf/;
- }else {
- print STDERR "Strange filetype found '$localizeFile'\n";
- return;
- }
- if( open DESTFILE , "< $localizeFile" ){
-
- #or die "Can't open/create '\$localizeFile'";
-
- #### Build hash
- while(<DESTFILE>){
- if( /$sdf_regex/ ){
- my $line = defined $_ ? $_ : '';
- my $prj = defined $3 ? $3 : '';
- my $file = defined $4 ? $4 : '';
- my $type = defined $6 ? $6 : '';
- my $gid = defined $7 ? $7 : '';
- my $lid = defined $8 ? $8 : '';
- my $lang = defined $12 ? $12 : '';
- my $plattform = defined $10 ? $10 : '';
- my $helpid = defined $9 ? $9 : '';
-
- chomp( $line );
- $index{ "$prj\t$file\t$type\t$gid\t$lid\t$helpid\t$plattform\t$lang" } = $line ;
-
- } #else { print STDOUT "writesdf REGEX kaputt $_\n";}
-
- }
- close( DESTFILE );
- }
- #### Copy new strings
- my @mykeys = keys( %{ $blockhash_ref } );
- my $isDirty = "FALSE";
- foreach my $key( @mykeys ){
- if( ! defined $index{ $key } ){
- # Add new entry
- $index{ $key } = $blockhash_ref->{ $key} ;
- $isDirty = "TRUE";
- }elsif( $index{ $key } ne $blockhash_ref->{ $key } ){
- # Overwrite old entry
- $index{ $key } = $blockhash_ref->{ $key };
- $isDirty = "TRUE";
- }else {
- }
- }
-
- #### Write file
-
- if( !$bVerbose ){ print STDOUT "."; }
- if( $isDirty eq "TRUE" ){
- if( $bVerbose ){ print STDOUT "$localizeFile\n"; }
- if( open DESTFILE , "+> $localizeFile" ){
- print DESTFILE get_license_header();
- @mykeys = sort keys( %index );
- foreach my $key( @mykeys ){
- print DESTFILE ( $index{ $key } , "\n" );
- }
- close DESTFILE;
- }else {
- print STDOUT "WARNING: File $localizeFile is not writable , try to merge ...\n";
- my ( $TMPFILE , $tmpfile ) = File::Temp::tempfile();
- if( open DESTFILE , "+> $tmpfile " ){
- @mykeys = keys( %index );
- foreach my $key( @mykeys ){
- print DESTFILE ( $index{ $key } , "\n" );
- }
- close DESTFILE;
- if( move( $localizeFile , $localizeFile.".backup" ) ){
- if( copy( $tmpfile , $localizeFile ) ){
- unlink $localizeFile.".backup";
- } else { print STDERR "Can't open/create '$localizeFile', original file is renamed to $localizeFile.backup\n"; }
- } else { print STDERR "Can't open/create '$localizeFile'\n"; }
- }else{
- print STDERR "WARNING: Can't open/create '$localizeFile'\n";
- }
- unlink $tmpfile;
- }
- }
-# if( $no_sort eq '' ){
-# sort_outfile( $localizeFile );
-# }
-}
-
-sub get_license_header{
- return
-"#\n".
-"# #### ### # # ### ##### ##### #### ##### ##### \n".
-"# # # # # ## # # # # # # # # # \n".
-"# # # # # # # # # # # ### # # # # \n".
-"# # # # # # ## # # # # # # # # \n".
-"# #### ### # # ### # ##### #### ##### # \n".
-"#\n".
-"# DO NOT EDIT! This file will be overwritten by localisation process\n".
-"#\n".
-"#*************************************************************************\n".
-"#\n".
-"# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.\n".
-"# \n".
-"# Copyright 2000, 2010 Oracle and/or its affiliates.\n".
-"#\n".
-"# OpenOffice.org - a multi-platform office productivity suite\n".
-"#\n".
-"# This file is part of OpenOffice.org.\n".
-"#\n".
-"# OpenOffice.org is free software: you can redistribute it and/or modify\n".
-"# it under the terms of the GNU Lesser General Public License version 3\n".
-"# only, as published by the Free Software Foundation.\n".
-"#\n".
-"# OpenOffice.org is distributed in the hope that it will be useful,\n".
-"# but WITHOUT ANY WARRANTY; without even the implied warranty of\n".
-"# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n".
-"# GNU Lesser General Public License version 3 for more details\n".
-"# (a copy is included in the LICENSE file that accompanied this code).\n".
-"#\n".
-"# You should have received a copy of the GNU Lesser General Public License\n".
-"# version 3 along with OpenOffice.org. If not, see\n".
-"# <http://www.openoffice.org/license.html>\n".
-"# for a copy of the LGPLv3 License.\n".
-"#\n".
-"#*************************************************************************\n";
-}
-######## Check input sdf file and use only the correct part
-sub merge_gsicheck{
- my $command = '';
- my ( $TMPHANDLE , $tmpfile ) = File::Temp::tempfile();
- my ( $TMPHANDLE2 , $tmpfile2 ) = File::Temp::tempfile();
- close ( $TMPHANDLE );
- close ( $TMPHANDLE2 );
-
- unlink $tmpfile2;
- my $output2 = `cat $sdffile | sort > $tmpfile2`;
- my $rc2 = $? << 8;
- if( $rc2 ne 0 ){
- printf("ERROR: Failed -> cat $sdffile | sort > $tmpfile2\n$output2\n");
- exit( -1 );
- }
-
-# if( $ENV{WRAPCMD} ){
-# $command = "$ENV{WRAPCMD} gsicheck";
-# }else{
-# $command = "gsicheck";
-# }
-# my $errfile = $tmpfile.".err";
-# $command .= " -k -c -wcf $tmpfile -wef $errfile -l \"\" $tmpfile2";
-# my $output = `$command`;
-# my $rc = $? << 8;
-# if ( $output ne "" ){
-# print STDOUT "### gsicheck ###\n";
-# print STDOUT "### The file $errfile have been written containing the errors in your sdf file. Those lines will not be merged: ###\n\n";
-# print STDOUT "$output\n";
-# print STDOUT "################\n";
-#
-# }else{
-# # Remove the 0 Byte file
-# unlink $errfile;
-# }
- $sdffile = $tmpfile2;
-# unlink $tmpfile2;
-}
-#########################################################
-sub collectfiles{
- print STDOUT "### Localize\n";
- my @sdfparticles;
- my $localizehash_ref;
- my ( $bAll , $bUseLocalize, $langhash_ref , $bHasSourceLanguage , $bFakeEnglish ) = parseLanguages();
-
- # Enable autoflush on STDOUT
- # $| = 1;
- STDOUT->autoflush( 1 );
-
- ### Search sdf particles
- print STDOUT "### Searching sdf particles\n";
- my $working_path = getcwd();
- chdir $srcpath;
- find sub {
- my $file = $File::Find::name;
- if( -f && $file =~ /.*localize.sdf$/ ) {
- push @sdfparticles , $file;
- if( $bVerbose eq "1" ) { print STDOUT "$file\n"; }
- else { print "."; }
-
- }
- } , getcwd() ;#"."; #$srcpath;
- chdir $working_path;
-
- my $nFound = $#sdfparticles +1;
- print "\n $nFound files found !\n";
-
- my ( $LOCALIZEPARTICLE , $localizeSDF ) = File::Temp::tempfile();
- close( $LOCALIZEPARTICLE );
-
- my ( $ALLPARTICLES_MERGED , $particleSDF_merged ) = File::Temp::tempfile();
- close( $ALLPARTICLES_MERGED );
- my ( $LOCALIZE_LOG , $my_localize_log ) = File::Temp::tempfile();
- close( $LOCALIZE_LOG );
-
- ## Get the localize de,en-US extract
- if( $bAll || $bUseLocalize ){
- print "### Fetching source language strings\n";
- my $command = "";
- my $args = "";
-
- if( $ENV{WRAPCMD} ){
- $command = "$ENV{WRAPCMD} localize_sl";
- }else{
- $command = "localize_sl";
- }
-
- # -e
- # if ( -x $command ){
- if( $command ){
- if( !$bVerbose ){ $args .= " -QQ -skip_links "; }
- $args .= " -e -f $localizeSDF -l ";
- my $bFlag="";
- if( $bAll ) {$args .= " en-US";}
- else{
- my @list;
- foreach my $isokey ( keys( %{ $langhash_ref } ) ){
- push @list , $isokey;
- if( $langhash_ref->{ $isokey } ne "" ){
- push @list , $langhash_ref->{ $isokey };
- }
- }
- remove_duplicates( \@list );
- foreach my $isokey ( @list ){
- switch :{
- #( $isokey=~ /^de$/i )
- # && do{
- # if( $bFlag eq "TRUE" ){ $args .= ",de"; }
- # else {
- # $args .= "de"; $bFlag = "TRUE";
- # }
- # };
- ( $isokey=~ /^en-US$/i )
- && do{
- if( $bFlag eq "TRUE" ){ $args .= ",en-US"; }
- else {
- $args .= "en-US"; $bFlag = "TRUE";
- }
- };
-
- } #switch
- } #foreach
- } # if
- } # if
- if ( $bVerbose ) { print STDOUT $command.$args."\n"; }
-
- my $rc = system( $command.$args );
-
- #my $output = `$command.$args`;
- #my $rc = $? << 8;
-
- if( $rc < 0 ){ print STDERR "ERROR: localize rc = $rc\n"; exit( -1 ); }
- ( $localizehash_ref ) = read_file( $localizeSDF , $langhash_ref );
-
- }
- ## Get sdf particles
- open ALLPARTICLES_MERGED , "+>> $particleSDF_merged"
- or die "Can't open $particleSDF_merged";
-
- ## Fill fackback hash
- my( $fallbackhashhash_ref ) = fetch_fallback( \@sdfparticles , $localizeSDF , $langhash_ref );
-# my( $fallbackhashhash_ref ) = fetch_fallback( \@sdfparticles , $localizeSDF , $langhash_ref );
- my %block;
- my $cur_fallback;
- if( !$bAll) {
- foreach my $cur_lang ( keys( %{ $langhash_ref } ) ){
- #print STDOUT "DBG: G1 cur_lang=$cur_lang\n";
- $cur_fallback = $langhash_ref->{ $cur_lang };
- if( $cur_fallback ne "" ){
- # Insert fallback strings
- #print STDOUT "DBG: Renaming $cur_fallback to $cur_lang in fallbackhash\n";
- rename_language( $fallbackhashhash_ref , $cur_fallback , $cur_lang );
- }
- foreach my $currentfile ( @sdfparticles ){
- if ( open MYFILE , "< $currentfile" ) {
- while(<MYFILE>){
- if( /$sdf_regex/ ){
- my $line = defined $_ ? $_ : '';
- my $prj = defined $3 ? $3 : '';
- my $file = defined $4 ? $4 : '';
- my $type = defined $6 ? $6 : '';
- my $gid = defined $7 ? $7 : '';
- my $lid = defined $8 ? $8 : '';
- my $lang = defined $12 ? $12 : '';
- my $plattform = defined $10 ? $10 : '';
- my $helpid = defined $9 ? $9 : '';
-
- chomp( $line );
-
- if ( $lang eq $cur_lang ){
- # Overwrite fallback strings with collected strings
- #if( ( !has_two_sourcelanguages( $cur_lang) && $cur_lang eq "de" ) || $cur_lang ne "en-US" ){
- $fallbackhashhash_ref->{ $cur_lang }{ $prj.$gid.$lid.$file.$type.$plattform.$helpid } = $line ;
- #}
-
- }
- }
- }
- }else { print STDERR "WARNING: Can't open file $currentfile"; }
- }
-
- foreach my $line ( keys( %{$fallbackhashhash_ref->{ $cur_lang } } )) {
- if( #$cur_lang ne "de" &&
- $cur_lang ne "en-US" ){
- print ALLPARTICLES_MERGED ( $fallbackhashhash_ref->{ $cur_lang }{ $line }, "\n" );
- }
- }
- }
- } else {
- foreach my $currentfile ( @sdfparticles ){
- if ( open MYFILE , "< $currentfile" ) {
- while( <MYFILE> ){
- print ALLPARTICLES_MERGED ( $_, "\n" ); # recheck de / en-US !
- }
- }
- else { print STDERR "WARNING: Can't open file $currentfile"; }
- }
- }
- close ALLPARTICLES_MERGED;
-
-
- # Hash of array
- my %output;
- my @order;
-
- ## Join both
- if( $outputfile ){
- if( open DESTFILE , "+> $outputfile" ){
- if( !open LOCALIZEPARTICLE , "< $localizeSDF" ) { print STDERR "ERROR: Can't open file $localizeSDF\n"; }
- if( !open ALLPARTICLES_MERGED , "< $particleSDF_merged" ) { print STDERR "ERROR: Can't open file $particleSDF_merged\n"; }
-
- # Insert localize
- my $extract_date="";
- while ( <LOCALIZEPARTICLE> ){
- if( /$sdf_regex/ ){
- my $leftpart = defined $2 ? $2 : '';
- my $lang = defined $12 ? $12 : '';
- my $rightpart = defined $13 ? $13 : '';
- my $timestamp = defined $18 ? $18 : '';
-
- my $prj = defined $3 ? $3 : '';
- my $file = defined $4 ? $4 : '';
- my $type = defined $6 ? $6 : '';
- my $gid = defined $7 ? $7 : '';
- my $lid = defined $8 ? $8 : '';
- #my $lang = defined $12 ? $12 : '';
- my $plattform = defined $10 ? $10 : '';
- my $helpid = defined $9 ? $9 : '';
-
-
- if( $use_default_date )
- {
- $extract_date = "$default_date\n" ;
- }
- elsif( $extract_date eq "" ) {
- $extract_date = $timestamp ;
- $extract_date =~ tr/\r\n//d;
- $extract_date .= "\n";
- }
-
- if( $bAll ){ print DESTFILE $leftpart."\t".$lang."\t".$rightpart.$extract_date ; }
- else {
- foreach my $sLang ( keys( %{ $langhash_ref } ) ){
- if( $sLang=~ /all/i ) {
- push @{ $output{ $prj.$gid.$lid.$file.$type.$plattform.$helpid } } , $leftpart."\t".$lang."\t".$rightpart.$extract_date ;
- #print DESTFILE $leftpart."\t".$lang."\t".$rightpart.$extract_date;
- }
- #if( $sLang eq "de" && $lang eq "de" ) {
- # push @{ $output{ $prj.$gid.$lid.$file.$type.$plattform.$helpid } } , $leftpart."\t".$lang."\t".$rightpart.$extract_date ;
- #print DESTFILE $leftpart."\t".$lang."\t".$rightpart.$extract_date;
- #}
- if( $sLang eq "en-US" && $lang eq "en-US" ) {
- push @order , $prj.$gid.$lid.$file.$type.$plattform.$helpid;
- if( !$bFakeEnglish ){ push @{ $output{ $prj.$gid.$lid.$file.$type.$plattform.$helpid } } , $leftpart."\t".$lang."\t".$rightpart.$extract_date ; }
- #print DESTFILE $leftpart."\t".$lang."\t".$rightpart.$extract_date;
- }
-
- }
- }
- }
- }
- # Insert particles
- while ( <ALLPARTICLES_MERGED> ){
- if( /$sdf_regex/ ){
- my $leftpart = defined $2 ? $2 : '';
- my $prj = defined $3 ? $3 : '';
- my $lang = defined $12 ? $12 : '';
- my $rightpart = defined $13 ? $13 : '';
- my $timestamp = defined $18 ? $18 : '';
-
- #my $prj = defined $3 ? $3 : '';
- my $file = defined $4 ? $4 : '';
- my $type = defined $6 ? $6 : '';
- my $gid = defined $7 ? $7 : '';
- my $lid = defined $8 ? $8 : '';
- #my $lang = defined $12 ? $12 : '';
- my $plattform = defined $10 ? $10 : '';
- my $helpid = defined $9 ? $9 : '';
-
-
- if( $use_default_date )
- {
- $extract_date = "$default_date\n" ;
- }
- elsif( $extract_date eq "" )
- {
- $extract_date = $timestamp;
- }
-
- if( ! ( $prj =~ /binfilter/i ) ) {
- push @{ $output{ $prj.$gid.$lid.$file.$type.$plattform.$helpid } } , $leftpart."\t".$lang."\t".$rightpart.$extract_date ;
- #print DESTFILE $leftpart."\t".$lang."\t".$rightpart.$extract_date ;
- }
- }
- }
-
- # Write!
- foreach my $curkey ( @order ){
- foreach my $curlist ( $output{ $curkey } ){
- foreach my $line ( @{$curlist} ){
- print DESTFILE $line;
- }
- }
- }
-
- }else { print STDERR "Can't open $outputfile";}
- }
- close DESTFILE;
- close LOCALIZEPARTICLE;
- close ALLPARTICLES_MERGED;
-
- #print STDOUT "DBG: \$localizeSDF $localizeSDF \$particleSDF_merged $particleSDF_merged\n";
- unlink $localizeSDF , $particleSDF_merged , $my_localize_log;
-
- #sort_outfile( $outputfile );
- #remove_obsolete( $outputfile ) , if $bHasSourceLanguage ne "";
- }
-
-#########################################################
-sub remove_obsolete{
- my $outfile = shift;
- my @lines;
- my $enusleftpart;
- my @good_lines;
-
- print STDOUT "### Removing obsolete strings\n";
-
- # Kick out all strings without en-US reference
- if ( open ( SORTEDFILE , "< $outfile" ) ){
- while( <SORTEDFILE> ){
- if( /$sdf_regex/ ){
- my $line = defined $_ ? $_ : '';
- my $language = defined $12 ? $12 : '';
- my $prj = defined $3 ? $3 : '';
- my $file = defined $4 ? $4 : '';
- my $type = defined $6 ? $6 : '';
- my $gid = defined $7 ? $7 : '';
- my $lid = defined $8 ? $8 : '';
- my $plattform = defined $10 ? $10 : '';
- my $helpid = defined $9 ? $9 : '';
-
- my $leftpart = $prj.$gid.$lid.$file.$type.$plattform.$helpid;
-
- if( $language eq "en-US" ){ # source string found, 1. entry
- $enusleftpart = $leftpart;
- push @good_lines , $line;
- }else{
- if( !defined $enusleftpart or !defined $leftpart ){
- print STDERR "BADLINE: $line\n";
- print STDERR "\$enusleftpart = $enusleftpart\n";
- print STDERR "\$leftpart = $leftpart\n";
- }
- if( $enusleftpart eq $leftpart ){ # matching language
- push @good_lines , $line;
- }
- #else{
- # print STDERR "OUT: \$enusleftpart=$enusleftpart \$leftpart=$leftpart \$line=$line\n";
- #}
- }
- }
- }
- close SORTEDFILE;
- } else { print STDERR "ERROR: Can't open file $outfile\n";}
-
- # Write file
- if ( open ( SORTEDFILE , "> $outfile" ) ){
- foreach my $newline ( @good_lines ) {
- print SORTEDFILE $newline;
- }
- close SORTEDFILE;
- } else { print STDERR "ERROR: Can't open file $outfile\n";}
-
-}
-#########################################################
-sub sort_outfile{
- my $outfile = shift;
- print STDOUT "### Sorting ... $outfile ...";
- my @lines;
- my @sorted_lines;
-
-
- #if ( open ( SORTEDFILE , "< $outputfile" ) ){
- if ( open ( SORTEDFILE , "< $outfile" ) ){
- my $line;
- while ( <SORTEDFILE> ){
- $line = $_;
- if( $line =~ /^[^\#]/ ){
- push @lines , $line;
- }
- }
- close SORTEDFILE;
- @sorted_lines = sort {
- my $xa_lang = "";
- my $xa_left_part = "";
- my $xa_right_part = "";
- my $xa_timestamp = "";
- my $xb_lang = "";
- my $xb_left_part = "";
- my $xb_right_part = "";
- my $xb_timestamp = "";
- my $xa = "";
- my $xb = "";
- my @alist;
- my @blist;
-
- if( $a=~ /$sdf_regex/ ){
- $xa_left_part = defined $2 ? $2 : '';
- $xa_lang = defined $12 ? $12 : '';
- $xa_right_part = defined $13 ? $13 : '';
- $xa_left_part = remove_last_column( $xa_left_part );
-
- }
- if( $b=~ /$sdf_regex/ ){
- $xb_left_part = defined $2 ? $2 : '';
- $xb_lang = defined $12 ? $12 : '';
- $xb_right_part = defined $13 ? $13 : '';
- $xb_left_part = remove_last_column( $xb_left_part );
-
-
- }
- if( ( $xa_left_part cmp $xb_left_part ) == 0 ){ # Left part equal
- if( ( $xa_lang cmp $xb_lang ) == 0 ){ # Lang equal
- return ( $xa_right_part cmp $xb_right_part ); # Right part compare
- }
- elsif( $xa_lang eq "en-US" ) { return -1; } # en-US wins
- elsif( $xb_lang eq "en-US" ) { return 1; } # en-US wins
- else { return $xa_lang cmp $xb_lang; } # lang compare
- }
- else {
- return $xa_left_part cmp $xb_left_part; # Left part compare
- }
- } @lines;
-
- if ( open ( SORTEDFILE , "> $outfile" ) ){
- print SORTEDFILE get_license_header();
- foreach my $newline ( @sorted_lines ) {
- print SORTEDFILE $newline;
- #print STDOUT $newline;
- }
- }
- close SORTEDFILE;
- } else { print STDERR "WARNING: Can't open file $outfile\n";}
- print "done\n";
-
-}
-#########################################################
-sub remove_last_column{
- my $string = shift;
- my @alist = split ( "\t" , $string );
- pop @alist;
- return join( "\t" , @alist );
-}
-
-#########################################################
-sub rename_language{
- my $fallbackhashhash_ref = shift;
- my $cur_fallback = shift;
- my $cur_lang = shift;
- my $line;
-
- foreach my $key( keys ( %{ $fallbackhashhash_ref->{ $cur_fallback } } ) ){
- $line = $fallbackhashhash_ref->{ $cur_fallback }{ $key };
- if( $line =~ /$sdf_regex/ ){
- my $leftpart = defined $2 ? $2 : '';
- my $lang = defined $12 ? $12 : '';
- my $rightpart = defined $13 ? $13 : '';
-
- $fallbackhashhash_ref->{ $cur_lang }{ $key } = $leftpart."\t".$cur_lang."\t".$rightpart;
- }
- }
-}
-
-############################################################
-sub remove_duplicates{
- my $list_ref = shift;
- my %tmphash;
- foreach my $key ( @{ $list_ref } ){ $tmphash{ $key } = '' ; }
- @{$list_ref} = keys( %tmphash );
-}
-
-##############################################################
-sub fetch_fallback{
- my $sdfparticleslist_ref = shift;
- my $localizeSDF = shift;
- my $langhash_ref = shift;
- my %fallbackhashhash;
- my $cur_lang;
- my @langlist;
-
- foreach my $key ( keys ( %{ $langhash_ref } ) ){
- $cur_lang = $langhash_ref->{ $key };
- if ( $cur_lang ne "" ) {
- push @langlist , $cur_lang;
- }
- }
- remove_duplicates( \@langlist );
- foreach $cur_lang ( @langlist ){
- if( $cur_lang eq "en-US" ){
- read_fallbacks_from_source( $localizeSDF , $cur_lang , \%fallbackhashhash );
- }
- }
-
- # remove de / en-US
- my @tmplist;
- foreach $cur_lang( @langlist ){
- if( $cur_lang ne "en-US" ){
- push @tmplist , $cur_lang;
-
- }
- }
- @langlist = @tmplist;
- if ( $#langlist +1 ){
- read_fallbacks_from_particles( $sdfparticleslist_ref , \@langlist , \%fallbackhashhash );
-
- }
- return (\%fallbackhashhash);
-}
-
-#########################################################
-sub write_file{
-
- my $localizeFile = shift;
- my $index_ref = shift;
-
- if( open DESTFILE , "+> $localizeFile" ){
- foreach my $key( %{ $index_ref } ){
- print DESTFILE ($index_ref->{ $key }, "\n" );
- }
- close DESTFILE;
- }else {
- print STDERR "Can't open/create '$localizeFile'";
- }
-}
-
-#########################################################
-sub read_file{
-
- my $sdffile = shift;
- my $langhash_ref = shift;
- my %block = ();
-
- open MYFILE , "< $sdffile"
- or die "Can't open '$sdffile'\n";
- while( <MYFILE>){
- if( /$sdf_regex/ ){
- my $line = defined $_ ? $_ : '';
- my $prj = defined $3 ? $3 : '';
- my $file = defined $4 ? $4 : '';
- my $type = defined $6 ? $6 : '';
- my $gid = defined $7 ? $7 : '';
- my $lid = defined $8 ? $8 : '';
- my $plattform = defined $10 ? $10 : '';
- my $lang = defined $12 ? $12 : '';
- my $helpid = defined $9 ? $9 : '';
-
- foreach my $isolang ( keys ( %{ $langhash_ref } ) ){
- if( $isolang=~ /$lang/i || $isolang=~ /all/i ) { $block{$prj.$gid.$lid.$file.$type.$plattform.$helpid } = $line ; }
- }
- }
- }
- return (\%block);
-}
-
-#########################################################
-sub read_fallbacks_from_particles{
-
- my $sdfparticleslist_ref = shift;
- my $isolanglist_ref = shift;
- my $fallbackhashhash_ref = shift;
- my $block_ref;
- foreach my $currentfile ( @{ $sdfparticleslist_ref } ){
- if ( open MYFILE , "< $currentfile" ) {
- while(<MYFILE>){
- if( /$sdf_regex/ ){
- my $line = defined $_ ? $_ : '';
- my $prj = defined $3 ? $3 : '';
- my $file = defined $4 ? $4 : '';
- my $type = defined $6 ? $6 : '';
- my $gid = defined $7 ? $7 : '';
- my $lid = defined $8 ? $8 : '';
- my $lang = defined $12 ? $12 : '';
- my $plattform = defined $10 ? $10 : '';
- my $helpid = defined $9 ? $9 : '';
-
- chomp( $line );
-
- foreach my $isolang ( @{$isolanglist_ref} ){
- if( $isolang=~ /$lang/i ) {
- $fallbackhashhash_ref->{ $isolang }{ $prj.$gid.$lid.$file.$type.$plattform.$helpid } = $line ;
- }
- }
- }
- }
- }else { print STDERR "WARNING: Can't open file $currentfile"; }
- }
-}
-
-#########################################################
-sub read_fallbacks_from_source{
-
- my $sdffile = shift;
- my $isolang = shift;
- my $fallbackhashhash_ref = shift;
- my $block_ref;
- # read fallback for single file
- open MYFILE , "< $sdffile"
- or die "Can't open '$sdffile'\n";
-
- while( <MYFILE>){
- if( /$sdf_regex/ ){
- my $line = defined $_ ? $_ : '';
- my $prj = defined $3 ? $3 : '';
- my $file = defined $4 ? $4 : '';
- my $type = defined $6 ? $6 : '';
- my $gid = defined $7 ? $7 : '';
- my $lid = defined $8 ? $8 : '';
- my $helpid = defined $9 ? $9 : '';
- my $lang = defined $12 ? $12 : '';
- my $plattform = defined $10 ? $10 : '';
-
- chomp( $line );
- if( $isolang=~ /$lang/i ) { $fallbackhashhash_ref->{ $isolang }{ $prj.$gid.$lid.$file.$type.$plattform.$helpid } = $line ;
- }
- }
- }
-}
-
-#########################################################
-sub parseLanguages{
-
- my $bAll;
- my $bUseLocalize;
- my $bHasSourceLanguage="";
- my $bFakeEnglish="";
- my %langhash;
- my $iso="";
- my $fallback="";
-
- #### -l all
- if( $languages=~ /all/ ){
- $bAll = "TRUE";
- $bHasSourceLanguage = "TRUE";
- }
- ### -l fr=de,de
- elsif( $languages=~ /.*,.*/ ){
- my @tmpstr = split "," , $languages;
- for my $lang ( @tmpstr ){
- if( $lang=~ /([a-zA-Z]{2,3}(-[a-zA-Z\-]*)*)(=([a-zA-Z]{2,3}(-[a-zA-Z\-]*)*))?/ ){
- $iso = $1;
- $fallback = $4;
-
- if( ( $iso && $iso=~ /(en-US)/i ) || ( $fallback && $fallback=~ /(en-US)/i ) ) {
- $bUseLocalize = "TRUE";
- }
- if( ( $iso && $iso=~ /(en-US)/i ) ) {
- $bHasSourceLanguage = "TRUE";
- }
- if( $fallback ) { $langhash{ $iso } = $fallback; }
- else { $langhash{ $iso } = ""; }
- }
- }
- }
- ### -l de
- else{
- if( $languages=~ /([a-zA-Z]{2,3}(-[a-zA-Z\-]*)*)(=([a-zA-Z]{2,3}(-[a-zA-Z\-]*)*))?/ ){
- $iso = $1;
- $fallback = $4;
-
- if( ( $iso && $iso=~ /(en-US)/i ) || ( $fallback && $fallback=~ /(en-US)/i ) ) {
- $bUseLocalize = "TRUE";
-
- }
- if( ( $iso && $iso=~ /(en-US)/i ) ) {
- $bHasSourceLanguage = "TRUE";
- }
-
- if( $fallback ) { $langhash{ $iso } = $fallback; }
- else { $langhash{ $iso } = ""; }
- }
- }
- # HACK en-US always needed!
- if( !$bHasSourceLanguage ){
- #$bHasSourceLanguage = "TRUE";
- $bUseLocalize = "TRUE";
- $bFakeEnglish = "TRUE";
- $langhash{ "en-US" } = "";
- }
- return ( $bAll , $bUseLocalize , \%langhash , $bHasSourceLanguage, $bFakeEnglish);
-}
-
-#########################################################
-sub parse_options{
-
- my $help;
- my $merge;
- my $extract;
- my $success = GetOptions('f=s' => \$sdffile , 'l=s' => \$languages , 's=s' => \$srcpath , 'h' => \$help , 'v' => \$bVerbose ,
- 'm' => \$merge , 'e' => \$extract , 'x' => \$no_sort , 'd' => \$use_default_date );
- $outputfile = $sdffile;
-
- #print STDOUT "DBG: lang = $languages\n";
- if( !$srcpath ){
- #$srcpath = "$ENV{SRC_ROOT}";
- if( !$srcpath ){
- print STDERR "No path to the source root found!\n\n";
- usage();
- exit(1);
- }
- }
- if( $help || !$success || $#ARGV > 1 || ( !$sdffile ) ){
- usage();
- exit(1);
- }
- if( $merge && $sdffile && ! ( -r $sdffile)){
- print STDERR "Can't open file '$sdffile'\n";
- exit(1);
- }
- if( !( $languages=~ /[a-zA-Z]{2,3}(-[a-zA-Z\-]*)*(=[a-zA-Z]{2,3}(-[a-zA-Z\-]*)*)?(,[a-zA-Z]{2,3}(-[a-zA-Z\-]*)*(=[a-zA-Z]{2,3}(-[a-zA-Z\-]*)*)?)*/ ) ){
- print STDERR "Please check the -l iso code\n";
- exit(1);
- }
- if( ( !$merge && !$extract ) || ( $merge && $extract ) ){ usage();exit( -1 );}
- if( $extract ){ $mode = "extract"; }
- else { $mode = "merge"; }
-}
-
-#########################################################
-sub usage{
-
- print STDERR "Usage: localize.pl\n";
- print STDERR "Split or collect SDF files\n";
- print STDERR " merge: -m -f <sdffile> -l l1[=f1][,l2[=f2]][...] [ -s <sourceroot> ]\n";
- print STDERR " extract: -e -f <outputfile> -l <lang> [ -s <sourceroot> ] [-d]\n";
- print STDERR "Options:\n";
- print STDERR " -h help\n";
- print STDERR " -m Merge mode\n";
- print STDERR " -e Extract mode\n";
- print STDERR " -f <sdffile> To split a big SDF file into particles\n";
- print STDERR " <outputfile> To collect and join all particles to one big file\n";
- print STDERR " -s <sourceroot> Path to the modules, if no \$SRC_ROOT is set\n";
- print STDERR " -l ( all | <isocode> | <isocode>=fallback ) comma seperated languages\n";
- print STDERR " -d Use default date in extracted sdf file\n";
- print STDERR " -v Verbose\n";
- print STDERR "\nExample:\n";
- print STDERR "\nlocalize -e -l en-US,pt-BR=en-US -f my.sdf\n( Extract en-US and pt-BR with en-US fallback )\n";
- print STDERR "\nlocalize -m -l cs -f my.sdf\n( Merge cs translation into the sourcecode ) \n";
-}
-
-# my $line = defined $_ ? $_ : '';
-# my $leftpart = defined $2 ? $2 : '';
-# my $prj = defined $3 ? $3 : '';
-# my $file = defined $4 ? $4 : '';
-# my $dummy = defined $5 ? $5 : '';
-# my $type = defined $6 ? $6 : '';
-# my $gid = defined $7 ? $7 : '';
-# my $lid = defined $8 ? $8 : '';
-# my $helpid = defined $9 ? $9 : '';
-# my $plattform = defined $10 ? $10 : '';
-# my $width = defined $11 ? $11 : '';
-# my $lang = defined $12 ? $12 : '';
-# my $rightpart = defined $13 ? $13 : '';
-# my $text = defined $14 ? $14 : '';
-# my $helptext = defined $15 ? $15 : '';
-# my $quickhelptext = defined $16 ? $16 : '';
-# my $title = defined $17 ? $17 : '';
-# my $timestamp = defined $18 ? $18 : '';
-
diff --git a/l10ntools/scripts/makefile.mk b/l10ntools/scripts/makefile.mk
deleted file mode 100644
index 8bfa64e3fbad..000000000000
--- a/l10ntools/scripts/makefile.mk
+++ /dev/null
@@ -1,59 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# 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.
-#
-# 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).
-#
-# 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.
-#
-#*************************************************************************
-
-# Copy *.py files into output tree and call a script once to
-# force python to create the *.pyc files.
-
-PRJ=..
-TARGET = l10ntools_dummy_pyc
-
-.INCLUDE: settings.mk
-
-.IF "$(SYSTEM_PYTHON)"!="YES"
-PYTHON=$(AUGMENT_LIBRARY_PATH) $(WRAPCMD) $(SOLARBINDIR)/python
-.ELSE # "$(SYSTEM_PYTHON)"!="YES"
-PYTHON=$(AUGMENT_LIBRARY_PATH) $(WRAPCMD) python
-.ENDIF # "$(SYSTEM_PYTHON)"!="YES"
-
-PYFILES = $(BIN)$/const.py \
- $(BIN)$/l10ntool.py \
- $(BIN)$/pseudo.py \
- $(BIN)$/sdf.py \
- $(BIN)$/xhtex.py \
- $(BIN)$/xtxex.py
-
-.INCLUDE: target.mk
-
-.IGNORE : create_pyc
-ALLTAR : create_pyc
-create_pyc : $(PYFILES)
- @$(PYTHON) $(BIN)/xtxex.py >& /dev/null
-
-$(BIN)$/%.py : tool/%.py
- @$(COPY) $< $@
-
-
diff --git a/l10ntools/scripts/tool/const.py b/l10ntools/scripts/tool/const.py
deleted file mode 100644
index 2d514eabdab6..000000000000
--- a/l10ntools/scripts/tool/const.py
+++ /dev/null
@@ -1,39 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# 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.
-#
-# 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).
-#
-# 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.
-#
-#*************************************************************************
-
-# Pseudo const
-class _const:
- class ConstError(TypeError): pass
- def __setattr__(self, name, value):
- if self.__dict__.has_key(name):
- raise self.ConstError, "Can't rebind const(%s)"%name
- self.__dict__[name] = value
-
-import sys
-sys.modules[__name__] = _const()
-
-
diff --git a/l10ntools/scripts/tool/l10ntool.py b/l10ntools/scripts/tool/l10ntool.py
deleted file mode 100644
index 126b991c377b..000000000000
--- a/l10ntools/scripts/tool/l10ntool.py
+++ /dev/null
@@ -1,220 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# 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.
-#
-# 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).
-#
-# 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.
-#
-#*************************************************************************
-
-from optparse import OptionParser
-from sdf import SdfData
-from pseudo import PseudoSet
-
-import sys
-import os
-import shutil
-
-class AbstractL10nTool:
- _options = {}
- _args = ""
- _resource_type = ""
- _source_language = "en-US"
-
- ##### Implement these abstract methods
-
- ##### Nameing scheme for the output files
- def get_outputfile_format_str(self):
- # filename,fileNoExt,language,extension,pathPrefix,pathPostFix,path
- #return "{path}/{fileNoExt}_{language}.{extension}"
- return self._options.pattern
-
- ################################# Merge single files ###########################################
-
- ##### Merge a single file
- def merge_file(self, inputfilename, outputfilename, parsed_file_ref, lang, is_forced_lang, sdfdata):
- pass
-
- ##### Helper for parse-once-use-often like parsing a xml file is needed implement it here
- def parse_file(self, filename):
- return None
-
- ################### Merge one big file containing all strings in all languages #################
- def merge_one_big_file(self, inputfile, outputfilename, parsed_file_ref, lang, sdfdata):
- pass
-
- ################### Extract a single File ######################################################
- def extract_file(self, inputfile):
- pass
-
- ################################################################################################
-
- def format_outputfile(self, filename, language):
- extension = filename[filename.rfind('.')+1:]
- file = filename[:filename.rfind('.')]
- # Python 2.3.x friendly
- return self.get_outputfile_format_str().replace('[', '%(').replace(']',')s') % \
- { 'filename': filename, 'fileNoExt': file, 'language': language, 'extension': extension, 'path_prefix': self._options.path_prefix,
- 'path_postfix': self._options.path_postfix, 'path': self.get_path() }
-
- #return self.get_outputfile_format_str().replace('[', '{').replace(']','}').format(
- # filename=filename, fileNoExt=file, language=language, extension=extension, path_prefix=self._options.path_prefix,
- # path_postfix=self._options.path_postfix, path=self.get_path())
-
- def get_path(self):
- if self._options.outputfile.find('/') == -1:
- return ""
- else:
- return self._options.outputfile[:self._options.outputfile.rfind('/')]
-
- def merge(self, sdfdata):
- langset,forcedset, foundset = PseudoSet(), PseudoSet() , PseudoSet()
-
- if self._options.languages:
- langset = PseudoSet(self._options.languages)
- if self._options.forcedlanguages:
- forcedset = PseudoSet(self._options.forcedlanguages)
- if sdfdata.get_languages_found_in_sdf():
- foundset = sdfdata.get_languages_found_in_sdf()
-
- if self.has_multi_inputfiles():
- filelist = self.read_inputfile_list()
- else:
- filelist = self._options.inputfile
-
- for inputfile in filelist:
- ref = self.parse_file(inputfile)
- # Don't write that files if there is no l10n present
- if ((langset & foundset) - forcedset): # all langs given and found in sdf without enforced
- [self.merge_file(inputfile,self.format_outputfile(inputfile, lang), ref, lang, False, sdfdata) for lang in ((langset & foundset) - forcedset)]
- # Always write those files even if there is no l10n available
- if forcedset: # all enforced langs
- [self.merge_file(inputfile, self.format_outputfile(inputfile, lang), ref, lang, True, sdfdata) for lang in forcedset]
- # In case a big file have to be written
- if ((langset & foundset) | forcedset): # all langs given ,found in sdf and enforced ones
- self.merge_one_big_file(inputfile, self.format_outputfile(inputfile, lang), ref, ((langset & foundset) | forcedset), sdfdata)
-
- def has_multi_inputfiles(self):
- return self._options.inputfile[0] == '@'
-
- def copy_file(self, inputfilename, outputfilename):
- try:
- os.remove(outputfilename)
- except:
- pass
-
- try:
- os.remove(outputfilename)
- except:
- pass
-
- try:
- shutil.copy(inputfilename, outputfilename)
- except IOError:
- print "ERROR: Can not copy file '" + inputfilename + "' to " + "'" + outputfilename + "'"
- sys.exit(-1)
-
- def extract(self):
- try:
- f = open(self._options.outputfile, "w+")
- f.write(self.extract_file(self._options.inputfile))
- except IOError:
- print "ERROR: Can not write file " + self._options.outputfile
- else:
- f.close()
-
- # Parse the common options
- def parse_options(self):
- parser = OptionParser()
- parser.add_option("-i", "--inputfile", dest="inputfile", metavar="FILE", help="resource file to read" )
- parser.add_option("-o", "--outputfile", dest="outputfile", metavar="FILE", help="extracted sdf or merged file" )
- parser.add_option("-m", "--inputsdffile", dest="input_sdf_file", metavar="FILE", help="merge this sdf file" )
- parser.add_option("-x", "--pathprefix", dest="path_prefix", metavar="PATH", help="" )
- parser.add_option("-y", "--pathpostfix", dest="path_postfix", metavar="PATH", help="" )
- parser.add_option("-p", "--projectname", dest="project_name", metavar="NAME", help="" )
- parser.add_option("-r", "--projectroot", dest="project_root", metavar="PATH", help="" )
- parser.add_option("-f", "--forcedlanguages", dest="forcedlanguages", metavar="ISOCODE[,ISOCODE]", help="Always merge those langs even if no l10n is available for those langs" )
- parser.add_option("-l", "--languages", dest="languages", metavar="ISOCODE[,ISOCODE]", help="Merge those langs if l10n is found for each")
- parser.add_option("-s", "--pattern", dest="pattern", metavar="", help="" )
- parser.add_option("-q", "--quiet", action="store_true", dest="quietmode", help="",default=False)
- (self._options, self.args) = parser.parse_args()
-
- # -l "de,pr,pt-BR" => [ "de" , "pt" , "pt-BR" ]
- parse_complex_arg = lambda arg: arg.split(",")
-
- if self._options.forcedlanguages:
- self._options.forcedlanguages = parse_complex_arg(self._options.forcedlanguages)
- if self._options.languages:
- self._options.languages = parse_complex_arg(self._options.languages)
- self.test_options()
-
- def __init__(self):
- self.parse_options()
- if self._options.input_sdf_file != None and len(self._options.input_sdf_file):
- sdfdata = SdfData(self._options.input_sdf_file)
- sdfdata.read()
- self.merge(sdfdata)
- else:
- self.extract()
-
- def make_dirs(self, filename):
- dir = filename[:filename.rfind('/')]
- if os.path.exists(dir):
- if os.path.isfile(dir):
- print "ERROR: There is a file '"+dir+"' where I want create a directory"
- sys.exit(-1)
- else:
- return
- else:
- try:
- os.makedirs(dir)
- except IOError:
- print "Error: Can not create dir " + dir
- sys.exit(-1)
-
- def test_options(self):
- opt = self._options
- is_valid = lambda x: x != None and len(x) > 0
- return is_valid(opt.project_root) and is_valid(opt.project_name) and is_valid(opt.languages) and \
- ( is_valid(opt.inputfile) and (( is_valid(opt.path_prefix) and is_valid(opt.path_postfix) ) or is_valid(opt.outputfile)) and \
- ( ( is_valid(opt.input_sdf_file) and ( is_valid(opt.outputfile) or ( is_valid(opt.path_prefix) and is_valid(opt.path_postfix) ) or \
- ( is_valid(opt.inputfile) and is_valid(opt.outputFile)) ))))
- print "Strange options ..."
- sys.exit( -1 )
-
- def read_inputfile_list(self):
- if self.has_multi_inputfiles():
- lines = []
- try:
- f = open(self._options.inputfile[1:], "r")
- lines = [line.strip('\n') for line in f.readlines()]
- except IOError:
- print "ERROR: Can not read file list " + self._options.inputfile[2:]
- sys.exit(-1)
- else:
- f.close()
- return lines
-
- def get_filename_string(self, inputfile):
- absfile = os.path.realpath(os.path.abspath(inputfile))
- absroot = os.path.realpath(os.path.abspath(self._options.project_root))
- return absfile[len(absroot)+1:].replace('/','\\')
-
diff --git a/l10ntools/scripts/tool/pseudo.py b/l10ntools/scripts/tool/pseudo.py
deleted file mode 100644
index 0956325e31db..000000000000
--- a/l10ntools/scripts/tool/pseudo.py
+++ /dev/null
@@ -1,184 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# 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.
-#
-# 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).
-#
-# 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.
-#
-#*************************************************************************
-
-# to support macosx baseline machines from Cretaceous period
-
-# incomplete set() class implementation of Python 2.4
-class PseudoSet:
- _list = []
-
- def __str__(self):
- return str(self._list)
-
- def __init__(self, newlist=[]):
- self._list = self._remove_dupes(newlist)
-
- def __or__(self, other):
- tmplist = []
- if self._list != None and other != None:
- tmplist.extend(self._list)
- tmplist.extend(other)
- return PseudoSet(self._remove_dupes(tmplist))
- else:
- print "__or__(None)"
-
- def __sub__(self,other):
- tmplist = []
- if self._list != None and other != None:
- tmplist.extend(self._list)
- [tmplist.remove(key) for key in other if key in tmplist]
- else:
- print "__sub__(none)"
- return PseudoSet(tmplist)
-
- def __and__(self, other):
- tmplist = []
- if other != None and self._list != None:
- [tmplist.append(key) for key in self._list if key in other]
- return PseudoSet(tmplist)
- else:
- print "__and__(None)"
-
- def __iter__(self):
- return self._list.__iter__()
-
- def __items__(self):
- return self._list.items()
-
- def __keys__(self):
- return keys(self._list)
-
- def _remove_dupes(self, list):
- tmpdict = {}
- for key in list:
- tmpdict[key] = 1
- return tmpdict.keys()
-
-# incomplete OrderedDict() class implementation
-class PseudoOrderedDict(dict):
- _keylist = []
- _valuelist = []
-
- def __init__(self, defaults={}):
- dict.__init__(self)
- for n,v in defaults.items():
- self[n] = v
-
- def __setitem__(self, key, value):
- self._keylist.append(key)
- self._valuelist.append(value)
- return dict.__setitem__(self, key, value)
-
- def __delattr__(self, key):
- self._keylist.__delattr__(key)
- self._valuelist.__delattr__(dict[key])
- return dict.__delattr__(self, key)
-
- def __delitem__(self, key):
- self._keylist.__delitem__(key)
- self._valuelist.__delitem__(dict[key])
- return dict.__delitem__(self, key)
-
- def __iter__(self):
- raise NotImplementedError("__iter__")
-
- def __iterkeys__(self):
- return self._keylist
-
- def iteritems(self):
- #return self._valuelist
- return zip(self._keylist, self._valuelist)
-
- def items(self):
- return zip(self._keylist,self._valuelist)
-
- def __keys__(self):
- return self._keylist
-
- def keys(self):
- return self._keylist
-
- def __keysattr__(self):
- return self._keylist
-
- def pop(self, key):
- self._keylist.pop(key)
- self._valuelist.pop(key)
- return dict.__pop__(self, key)
-
- def popitem(self):
- raise NotImplementedError("popitem")
-
-def _testdriver_set():
- list, list1 = [] ,[]
- list.append("a")
- list.append("b")
- list.append("c")
-
- list1.append("a")
- list1.append("b")
- list1.append("d")
- list1.append("e")
- list1.append("e")
-
- if "a" in list:
- print "YEAH!"
-
- a = PseudoSet(list)
- b = PseudoSet(list1)
-
- print "a="+str(a)
- print "b="+str(b)
- print "a|b=" + str(a|b)
- print "a="+str(a)
- print "b="+str(b)
- print "a&b=" + str(a&b)
- print "a="+str(a)
- print "b="+str(b)
- print "a-b" + str(a-b)
-
- for key in a:
- print key
-
-def _testdriver_dict():
- d = PseudoOrderedDict()
- d["a"] = 1
- d["b"] = 2
- d["c"] = 3
- d["d"] = 4
- d["e"] = 5
- d["f"] = 6
-
- print "a="+str(d["a"])
- print "e="+str(d["e"])
- for key,value in d.iteritems():
- print "d["+key+"]="+str(d[key])
- print "key="+str(key)+" value="+str(value)
-
- print "keys="+str(d.keys())
-
-#_testdriver_dict()
diff --git a/l10ntools/scripts/tool/sdf.py b/l10ntools/scripts/tool/sdf.py
deleted file mode 100644
index 96afbed1452c..000000000000
--- a/l10ntools/scripts/tool/sdf.py
+++ /dev/null
@@ -1,170 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# 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.
-#
-# 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).
-#
-# 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.
-#
-#*************************************************************************
-
-from pseudo import PseudoSet,PseudoOrderedDict
-from time import gmtime, strftime
-
-class SdfData:
- _filename = "";
- _dict = PseudoOrderedDict()
- _languages_found = [];
-
- def __init__ (self, filename=""):
- self._filename = filename
-
- def __getitem__(self, key):
- if self._dict.has_key(key):
- return self._dict[key]
- else:
- return None
-
- def has_key(self, key):
- return self._dict.has_key(key)
-
- def __setitem__(self, key, value):
- self._dict[key] = value
-
- def get_languages_found_in_sdf(self):
- return PseudoSet(self._languages_found)
-
- def read(self):
- try:
- f = open(self._filename, "r")
- lines = [line.rstrip('\n') for line in f.readlines()]
- except IOError:
- print "ERROR: Trying to read "+ self._filename
- raise
- else:
- f.close()
- for line in lines:
- entity = SdfEntity()
- entity.set_properties(line)
- self._dict[entity.get_id()] = entity
- self._languages_found.append(entity.langid)
-
- def write(self, filename):
- try:
- f = open(filename, "w+")
- for value in self._dict.itervalues():
- #f.write( repr(value)+"\n" )
- f.write(value + "\n")
- except IOError:
- print "ERROR: Trying to write " + filename
- raise
- else:
- f.close()
-
-import sys
-class SdfEntity:
- # Sdf format columns
- project = ""
- source_file = ""
- dummy1 = ""
- resource_type = ""
- gid = ""
- lid = ""
- helpid = ""
- platform = ""
- dummy2 = ""
- langid = ""
- text = ""
- helptext = ""
- quickhelptext = ""
- title = ""
- date = ""
-
- import const
- const._PROJECT_POS = 0
- const._SOURCE_FILE_POS = 1
- const._DUMMY1_POS = 2
- const._RESOURCE_TYPE_POS = 3
- const._GID_POS = 4
- const._LID_POS = 5
- const._HELPID_POS = 6
- const._PLATFORM_POS = 7
- const._DUMMY2_POS = 8
- const._LANGID_POS = 9
- const._TEXT_POS = 10
- const._HELPTEXT_POS = 11
- const._QUICKHELPTEXT_POS = 12
- const._TITLE_POS = 13
- const._DATE_POS = 14
-
- def __init__(self, project="", source_file="", dummy1="0", resource_type="", gid="", lid="", helpid="", platform="", dummy2="0", langid="",
- text="", helptext="", quickhelptext="", title="", date=""):
- self.project = project;
- self.source_file = source_file;
- self.dummy1 = dummy1;
- self.resource_type = resource_type;
- self.gid = gid;
- self.lid = lid;
- self.helpid = helpid;
- self.platform = platform;
- self.dummy2 = dummy2;
- self.langid = langid;
- self.text = text;
- self.helptext = helptext;
- self.quickhelptext = quickhelptext;
- self.title = title;
- if date != "":
- self.date = date;
- else:
- self.date = strftime("%Y-%m-%d %H:%M:%S",gmtime())
-
-
- def set_properties(self, line):
- splitted = line.split("\t")
- if len(splitted) == 15:
- self.project = splitted[ self.const._PROJECT_POS ]
- self.source_file = splitted[ self.const._SOURCE_FILE_POS ]
- self.dummy1 = splitted[ self.const._DUMMY1_POS ]
- self.resource_type = splitted[ self.const._RESOURCE_TYPE_POS ]
- self.gid = splitted[ self.const._GID_POS ]
- self.lid = splitted[ self.const._LID_POS ]
- self.helpid = splitted[ self.const._HELPID_POS ]
- self.platform = splitted[ self.const._PLATFORM_POS ]
- self.dummy2 = splitted[ self.const._DUMMY2_POS ]
- self.langid = splitted[ self.const._LANGID_POS ]
- self.text = splitted[ self.const._TEXT_POS ]
- self.helptext = splitted[ self.const._HELPTEXT_POS ]
- self.quickhelptext = splitted[ self.const._QUICKHELPTEXT_POS ]
- self.title = splitted[ self.const._TITLE_POS ]
- self.date = splitted[ self.const._DATE_POS ]
-
- def get_file_id(self):
- return self.project + "\\" + self.source_file
-
- def get_resource_path(self):
- return self.source_file[0:self.source_file.rfind( "\\" )-1]
-
- def __str__(self):
- return ''.join([self.project, "\t", self.source_file, "\t", self.dummy1, "\t", self.resource_type, "\t" ,
- self.gid, "\t", self.lid, "\t", self.helpid, "\t", self.platform, "\t", self.dummy2, "\t" , self.langid,
- "\t", self.text, "\t", self.helptext, "\t", self.quickhelptext, "\t" , self.title, "\t", self.date ])
-
- def get_id(self):
- return ''.join([self.project, self.gid, self.lid, self.source_file, self.resource_type, self.platform, self.helpid, self.langid])
diff --git a/l10ntools/scripts/tool/xhtex.py b/l10ntools/scripts/tool/xhtex.py
deleted file mode 100644
index d916fc675944..000000000000
--- a/l10ntools/scripts/tool/xhtex.py
+++ /dev/null
@@ -1,136 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# 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.
-#
-# 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).
-#
-# 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.
-#
-#*************************************************************************
-
-from l10ntool import AbstractL10nTool
-from sdf import SdfEntity
-import sys
-import xml.dom.minidom
-
-class Xhtex(AbstractL10nTool):
- _resource_type = "xht"
- _sdfdata = ()
- _lang = ""
-
- # Extract methods
- def extract_topic(self, list, inputfile):
- topics = []
- for elem in list:
- if elem.childNodes[0].nodeType == elem.TEXT_NODE and len(elem.childNodes[0].data.strip()):
- topics.append(self.prepare_sdf_line(id=elem.getAttribute("id").strip(), text=elem.childNodes[0].data, inputfile=inputfile))
- return topics
-
- def extract_title(self, list, inputfile):
- titles = []
- for elem in list:
- if len(elem.getAttribute("title").strip()):
- titles.append(self.prepare_sdf_line(id=elem.getAttribute("id").strip(), text=elem.getAttribute("title").strip(), inputfile=inputfile))
- return titles
-
- # Merge methods
- def merge_topic(self, list, sdfdata, lang, inputfilename, dom):
- for elem in list:
- if elem.childNodes[0].nodeType == elem.TEXT_NODE and elem.getAttribute("id").strip():
- obj = self.prepare_sdf_line(inputfile=inputfilename, lang=lang, id=elem.getAttribute("id").strip())
- if sdfdata[obj.get_id()]:
- elem.childNodes[0].data = unicode(str(sdfdata[obj.get_id()].text),"utf8")
-
-
- def merge_title(self, list, sdfdata, lang, inputfilename):
- for elem in list:
- obj = self.prepare_sdf_line(inputfile=inputfilename, lang=lang, id=elem.getAttribute("id").strip())
- if elem.getAttribute("id").strip() and sdfdata[obj.get_id()]:
- elem.setAttribute("title", unicode(str(sdfdata[obj.get_id()].text),"utf8"))
-
- # L10N tool
- def __init__(self):
- AbstractL10nTool.__init__(self)
-
- def parse_file(self, filename):
- document = ""
- try:
- f = open(filename, "r+")
- document = f.read()
- except IOError:
- print "ERROR: Can not read file " + filename
- sys.exit(-1)
- else:
- f.close()
- return xml.dom.minidom.parseString(document)
-
-
- def merge_file(self, inputfilename, outputfilename, parsed_file_ref, lang,is_forced_lang, sdfdata):
- if lang == "en-US":
- mod_outputfilename = outputfilename.replace("_en-US",'')
- self.make_dirs(mod_outputfilename)
- self.copy_file(inputfilename, mod_outputfilename)
- return
- dom = parsed_file_ref.cloneNode(True)
- #dom = self.parse_file(inputfilename) # in case cloneNode is buggy just parse it always
-
- self.merge_topic(dom.getElementsByTagName("topic"), sdfdata, lang, inputfilename, dom)
- self.merge_title(dom.getElementsByTagName("node"), sdfdata, lang, inputfilename)
- self.merge_title(dom.getElementsByTagName("help_section"), sdfdata, lang, inputfilename)
- self.make_dirs(outputfilename)
- try:
- f = open(outputfilename, "w+")
- str = dom.toxml()
- f.write(str.encode("utf-8"))
- except IOError:
- print "ERROR: Can not write file " + outputfilename
- sys.exit(-1)
- else:
- f.close()
-
- ##### Helper for parse-once-use-often like parsing a xml file is needed implement it here
- def parse_file(self, filename):
- document = ""
- try:
- f = open(filename,"r")
- document = f.read()
- except IOError:
- print "ERROR: Can not read file " + filename
- else:
- f.close()
- return xml.dom.minidom.parseString(document)
-
- ##### Extract a single File
- def extract_file(self, inputfile):
- sdf_data = []
- dom = self.parse_file(inputfile)
- sdf_data.extend(self.extract_topic(dom.getElementsByTagName("topic"), inputfile))
- sdf_data.extend(self.extract_title(dom.getElementsByTagName("help_section"), inputfile))
- sdf_data.extend(self.extract_title(dom.getElementsByTagName("node"), inputfile))
- return ''.join([str(line)+"\n" for line in sdf_data])
-
- def prepare_sdf_line(self, inputfile="", lang="" , id="" , text=""):
- if lang == "":
- lang = self._source_language
- return SdfEntity(project=self._options.project_name, source_file=self.get_filename_string(inputfile),
- resource_type=self._resource_type, gid=id, lid="", langid=lang,text=text)
-
-run = Xhtex()
-
diff --git a/l10ntools/scripts/tool/xtxex.py b/l10ntools/scripts/tool/xtxex.py
deleted file mode 100644
index 96912754b7df..000000000000
--- a/l10ntools/scripts/tool/xtxex.py
+++ /dev/null
@@ -1,94 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# 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.
-#
-# 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).
-#
-# 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.
-#
-#*************************************************************************
-
-from l10ntool import AbstractL10nTool
-from sdf import SdfEntity
-import sys
-import shutil
-
-class Xtxex(AbstractL10nTool):
- _resource_type = "xtx"
-
- def __init__(self):
- AbstractL10nTool.__init__(self)
-
- def merge_file(self, inputfilename, outputfilename, parsed_file_ref, lang, is_forced_lang, sdfdata):
- # Special handling for en-US files
- if lang == "en-US":
- mod_outputfilename = outputfilename
- # mod here if needed
- self.copy_file(inputfilename, mod_outputfilename)
- return
- # merge usual lang
- sdfline = self.prepare_sdf_line(inputfilename,lang)
- if sdfdata.has_key(sdfline.get_id()):
- line = sdfdata[sdfline.get_id()].text.replace("\\n", '\n')
- self.make_dirs(outputfilename)
- try:
- f = open(outputfilename, "w+")
- f.write(line)
- except IOError:
- print "ERROR: Can not write file " + outputfilename
- sys.exit(-1)
- else:
- f.close()
- return
- # no sdf data found then copy en-US source file
- if is_forced_lang:
- self.copy_file(inputfilename, outputfilename)
-
- ##### Extract a single File
- def extract_file(self, inputfile):
- lines = []
- try:
- f = open(inputfile, "r")
- lines = f.readlines()
- except IOError:
- print "ERROR: Can not open file " + inputfile
- sys.exit(-1)
- else:
- f.close()
- # remove legal header
- lines = [line for line in lines if len(line) > 0 and not line[0] == '#']
- # escape all returns
- lines = [line.replace('\n', "\\n") for line in lines]
- line = ''.join(lines)
- test = str(line)
- if len(test.strip()):
- sdf_entity = self.prepare_sdf_line(inputfile);
- sdf_entity.text = line
- return str(sdf_entity)
- else:
- return ""
-
- def prepare_sdf_line(self, inputfile="", lang=""):
- if lang == "":
- lang = self._source_language
- return SdfEntity(project=self._options.project_name, source_file=self.get_filename_string(inputfile),
- resource_type=self._resource_type, gid="none", lid="none", langid=lang,text="")
-
-run = Xtxex()
diff --git a/l10ntools/scripts/xhtex b/l10ntools/scripts/xhtex
deleted file mode 100755
index 5409f179777d..000000000000
--- a/l10ntools/scripts/xhtex
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/sh
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# 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.
-#
-# 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).
-#
-# 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.
-#
-#*************************************************************************
-
-if [ x${SOLARENV}x = xx ]; then
- echo No environment found, please use 'setsolar'
-exit 1
-fi
-
-if [ ${GUI} = "WNT" ]; then
-if [ x${SOLARVER}x = xx -o x${UPDMINOREXT}x = xx ]; then
- exec python $SOLARVERSION/$INPATH/bin/xhtex.py "$@"
-else
- exec python $SOLARVERSION/$INPATH/bin$UPDMINOREXT/xhtex.py "$@"
-fi
-else
-if [ x${SOLARVER}x = xx -o x${UPDMINOREXT}x = xx ]; then
- exec python $SOLARVERSION/$INPATH/bin/xhtex.py "$@"
-else
- exec python $SOLARVERSION/$INPATH/bin$UPDMINOREXT/xhtex.py "$@"
-fi
-fi
diff --git a/l10ntools/scripts/xtxex b/l10ntools/scripts/xtxex
deleted file mode 100755
index 39da89fd81ce..000000000000
--- a/l10ntools/scripts/xtxex
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/bin/sh
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# 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.
-#
-# 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).
-#
-# 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.
-#
-#*************************************************************************
-
-if [ x${SOLARENV}x = xx ]; then
- echo No environment found, please use 'setsolar'
-exit 1
-fi
-
-if [ ${GUI} = "WNT" ]; then
-if [ x${SOLARVER}x = xx -o x${UPDMINOREXT}x = xx ]; then
- exec python $SOLARVERSION/$INPATH/bin/xtxex.py "$@"
-else
- exec python $SOLARVERSION/$INPATH/bin$UPDMINOREXT/xtxex.py "$@"
-fi
-else
-if [ x${SOLARVER}x = xx -o x${UPDMINOREXT}x = xx ]; then
- exec python $SOLARVERSION/$INPATH/bin/xtxex.py "$@"
-else
- exec python $SOLARVERSION/$INPATH/bin$UPDMINOREXT/xtxex.py "$@"
-fi
-fi
-
diff --git a/l10ntools/source/cfg_yy_wrapper.c b/l10ntools/source/cfg_yy_wrapper.c
index ac678d17f399..ecfb35b30df5 100644
--- a/l10ntools/source/cfg_yy_wrapper.c
+++ b/l10ntools/source/cfg_yy_wrapper.c
@@ -1,2 +1,5 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
// Helper to suppress warnings in lex generated c code, see #i57362#
#include "cfg_yy.c"
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/source/cfglex.l b/l10ntools/source/cfglex.l
index 3fc3aa5b965c..a6f6b366a8d5 100644
--- a/l10ntools/source/cfglex.l
+++ b/l10ntools/source/cfglex.l
@@ -30,6 +30,9 @@
#pragma warning(push, 1)
#endif
+int yycolumn = 1;
+#define YY_USER_ACTION yycolumn += yyleng;
+
/* external functions (C++ code, declared as extren "C" */
extern int WorkOnTokenSet( int, char* );
extern int InitCfgExport( char * , char *);
@@ -116,6 +119,7 @@ int bText=0;
}
.|\n {
+ yycolumn = 1;
if ( bText == 1 )
WorkOnTokenSet( CFG_TEXTCHAR, yytext );
else
@@ -138,7 +142,7 @@ void YYWarning( char *s )
{
/* write warning to stderr */
fprintf( stderr,
- "Warning: \"%s\" in line %d: \"%s\"\n", s, yylineno, yytext );
+ "Warning: \"%s\" in line %d, column %d: \"%s\"\n", s, yylineno, yycolumn, yytext );
}
/*****************************************************************************/
@@ -151,7 +155,7 @@ void yyerror ( char *s )
{
/* write error to stderr */
fprintf( stderr,
- "Error: \"%s\" in line %d: \"%s\"\n", s, yylineno, yytext );
+ "Error: \"%s\" in line %d, column %d: \"%s\"\n", s, yylineno, yycolumn, yytext );
SetError();
}
diff --git a/l10ntools/source/cfgmerge.cxx b/l10ntools/source/cfgmerge.cxx
index ab53f28a1092..c4f24edeb487 100644
--- a/l10ntools/source/cfgmerge.cxx
+++ b/l10ntools/source/cfgmerge.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -35,7 +36,6 @@
#include "export.hxx"
#include "cfgmerge.hxx"
#include "tokens.h"
-#include "utf8conv.hxx"
extern "C" { int yyerror( char * ); }
extern "C" { int YYWarning( char * ); }
@@ -252,7 +252,7 @@ extern FILE *GetCfgFile()
// create file name, beginnig with project root
// (e.g.: source\ui\src\menue.src)
-// printf("sFullEntry = %s\n",sFullEntry.GetBuffer());
+// printf("sFullEntry = %s\n",sFullEntry.GetBuffer());
sActFileName = sFullEntry.Copy( sPrjEntry.Len() + 1 );
// printf("sActFileName = %s\n",sActFileName.GetBuffer());
@@ -297,7 +297,7 @@ int GetError()
CfgStackData* CfgStack::Push( const ByteString &rTag, const ByteString &rId )
{
CfgStackData *pD = new CfgStackData( rTag, rId );
- Insert( pD, LIST_APPEND );
+ maList.push_back( pD );
return pD;
}
@@ -309,19 +309,20 @@ CfgStackData* CfgStack::Push( const ByteString &rTag, const ByteString &rId )
CfgStack::~CfgStack()
/*****************************************************************************/
{
- for ( sal_uLong i = 0; i < Count(); i++ )
- delete GetObject( i );
+ for ( size_t i = 0, n = maList.size(); i < n; i++ )
+ delete maList[ i ];
+ maList.clear();
}
/*****************************************************************************/
-ByteString CfgStack::GetAccessPath( sal_uLong nPos )
+ByteString CfgStack::GetAccessPath( size_t nPos )
/*****************************************************************************/
{
if ( nPos == LIST_APPEND )
- nPos = Count() - 1;
+ nPos = maList.size() - 1;
ByteString sReturn;
- for ( sal_uLong i = 0; i <= nPos; i++ ) {
+ for ( size_t i = 0; i <= nPos; i++ ) {
if ( i )
sReturn += ".";
sReturn += GetStackData( i )->GetIdentifier();
@@ -331,13 +332,18 @@ ByteString CfgStack::GetAccessPath( sal_uLong nPos )
}
/*****************************************************************************/
-CfgStackData *CfgStack::GetStackData( sal_uLong nPos )
+CfgStackData *CfgStack::GetStackData( size_t nPos )
/*****************************************************************************/
{
if ( nPos == LIST_APPEND )
- nPos = Count() - 1;
+ {
+ if (!maList.empty())
+ nPos = maList.size() - 1;
+ else
+ return 0;
+ }
- return GetObject( nPos );
+ return maList[ nPos ];
}
//
@@ -502,7 +508,7 @@ int CfgParser::ExecuteAnalyzedToken( int nToken, char *pToken )
pStackData = aStack.GetStackData();
}
else {
- ByteString sError( "Missplaced close tag: " );
+ ByteString sError( "Misplaced close tag: " );
ByteString sInFile(" in file ");
sError += sToken;
sError += sInFile;
@@ -576,9 +582,6 @@ int CfgParser::Execute( int nToken, char * pToken )
void CfgParser::Error( const ByteString &rError )
/*****************************************************************************/
{
-// ByteString sError( rError );
-// sError.Append("Error: In file ");
-// sError.Append( sActFileName );
yyerror(( char * ) rError.GetBuffer());
}
@@ -655,18 +658,14 @@ void CfgExport::WorkOnRessourceEnd()
pStackData->sText[ ByteString("en-US") ].Len() )))
{
ByteString sFallback = pStackData->sText[ ByteString("en-US") ];
-
- //if ( pStackData->sText[ ByteString("en-US") ].Len())
- // sFallback = pStackData->sText[ ByteString("en-US") ];
-
ByteString sLocalId = pStackData->sIdentifier;
ByteString sGroupId;
- if ( aStack.Count() == 1 ) {
+ if ( aStack.size() == 1 ) {
sGroupId = sLocalId;
sLocalId = "";
}
else {
- sGroupId = aStack.GetAccessPath( aStack.Count() - 2 );
+ sGroupId = aStack.GetAccessPath( aStack.size() - 2 );
}
ByteString sTimeStamp( Export::GetTimeStamp());
@@ -693,7 +692,6 @@ void CfgExport::WorkOnRessourceEnd()
sOutput += sText; sOutput += "\t\t\t\t";
sOutput += sTimeStamp;
- //if( !sCur.EqualsIgnoreCaseAscii("de") ||( sCur.EqualsIgnoreCaseAscii("de") && !Export::isMergingGermanAllowed( sPrj ) ) )
pOutputStream->WriteLine( sOutput );
}
}
@@ -723,7 +721,6 @@ CfgMerge::CfgMerge(
: CfgOutputParser( rOutputFile ),
pMergeDataFile( NULL ),
pResData( NULL ),
- bGerman( sal_False ),
sFilename( rFilename ),
bEnglish( sal_False )
{
@@ -759,12 +756,12 @@ void CfgMerge::WorkOnText(
if ( !pResData ) {
ByteString sLocalId = pStackData->sIdentifier;
ByteString sGroupId;
- if ( aStack.Count() == 1 ) {
+ if ( aStack.size() == 1 ) {
sGroupId = sLocalId;
sLocalId = "";
}
else {
- sGroupId = aStack.GetAccessPath( aStack.Count() - 2 );
+ sGroupId = aStack.GetAccessPath( aStack.size() - 2 );
}
ByteString sPlatform( "" );
@@ -774,8 +771,6 @@ void CfgMerge::WorkOnText(
pResData->sResTyp = pStackData->sResTyp;
}
- //if ( nLangIndex.EqualsIgnoreCaseAscii("de") )
- // bGerman = sal_True;
if (( nLangIndex.EqualsIgnoreCaseAscii("en-US") ))
bEnglish = sal_True;
@@ -805,10 +800,10 @@ void CfgMerge::Output( const ByteString& rOutput )
pOutputStream->Write( rOutput.GetBuffer(), rOutput.Len());
}
-sal_uLong CfgStack::Push( CfgStackData *pStackData )
+size_t CfgStack::Push( CfgStackData *pStackData )
{
- Insert( pStackData, LIST_APPEND );
- return Count() - 1;
+ maList.push_back( pStackData );
+ return maList.size() - 1;
}
/*****************************************************************************/
@@ -827,7 +822,6 @@ void CfgMerge::WorkOnRessourceEnd()
ByteString sContent;
pEntrys->GetText( sContent, STRING_TYP_TEXT, sCur , sal_True );
if (
- // (!sCur.EqualsIgnoreCaseAscii("de") ) &&
( !sCur.EqualsIgnoreCaseAscii("en-US") ) &&
( sContent != "-" ) && ( sContent.Len()))
@@ -867,6 +861,7 @@ void CfgMerge::WorkOnRessourceEnd()
}
delete pResData;
pResData = NULL;
- bGerman = sal_False;
bEnglish = sal_False;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/source/directory.cxx b/l10ntools/source/directory.cxx
index c354d54ad4ea..97be7c2332fb 100644
--- a/l10ntools/source/directory.cxx
+++ b/l10ntools/source/directory.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,6 +29,11 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_l10ntools.hxx"
+
+#ifdef WNT
+#include <windows.h>
+#endif
+
#include <l10ntools/directory.hxx>
#include "tools/string.hxx"
#include <iostream>
@@ -101,9 +107,6 @@ void Directory::readDirectory()
}
#ifdef WNT
-#include <tools/prewin.h>
-#include <windows.h>
-#include <tools/postwin.h>
void Directory::readDirectory ( const rtl::OUString& sFullpath )
{
@@ -190,23 +193,36 @@ void Directory::readDirectory( const rtl::OUString& sFullpath )
if( sFullpath.getLength() < 1 ) return;
- rtl::OString sFullpathext = rtl::OUStringToOString( sFullpath , RTL_TEXTENCODING_UTF8 , sFullpath.getLength() ).getStr();
+ rtl::OString sFullpathext = rtl::OUStringToOString( sFullpath , RTL_TEXTENCODING_UTF8 );
// stat
- if( stat( sFullpathext.getStr() , &statbuf ) < 0 ){ printf("warning: Can not stat %s" , sFullpathext.getStr() ); return; }// error }
+ if( stat( sFullpathext.getStr(), &statbuf ) < 0 )
+ {
+ printf("warning: Can not stat %s" , sFullpathext.getStr() );
+ return;
+ }
- if( S_ISDIR(statbuf.st_mode ) == 0 ) { return; }// error } return; // not dir
+ if( S_ISDIR(statbuf.st_mode ) == 0 )
+ return;
- if( (dir = opendir( sFullpathext.getStr() ) ) == NULL ) {printf("readerror 2 in %s \n",sFullpathext.getStr()); return; } // error } return; // error
+ if( (dir = opendir( sFullpathext.getStr() ) ) == NULL )
+ {
+ printf("readerror 2 in %s \n",sFullpathext.getStr());
+ return;
+ }
dirholder aHolder(dir);
- sFullpathext += rtl::OString( "/" );
-
const rtl::OString sDot ( "." ) ;
const rtl::OString sDDot( ".." );
- if ( chdir( sFullpathext.getStr() ) == -1 ) { printf("chdir error in %s \n",sFullpathext.getStr()); return; } // error
+ if ( chdir( sFullpathext.getStr() ) == -1 )
+ {
+ printf("chdir error in %s \n",sFullpathext.getStr());
+ return;
+ }
+
+ sFullpathext += rtl::OString( "/" );
while( ( dirp = readdir( dir ) ) != NULL )
{
@@ -222,7 +238,7 @@ void Directory::readDirectory( const rtl::OUString& sFullpath )
// stat new entry
if( lstat( sEntity.getStr() , &statbuf2 ) < 0 )
{
- printf("error on entry %s\n" , sEntity.getStr() ) ; // error
+ printf("error on entry %s\n" , sEntity.getStr() ) ;
continue;
}
@@ -258,8 +274,14 @@ void Directory::readDirectory( const rtl::OUString& sFullpath )
}
}
}
- if ( chdir( ".." ) == -1 ) { printf("chdir error in .. \n"); return; } // error
- if( aHolder.close() < 0 ) return ; // error
+ if ( chdir( ".." ) == -1 )
+ {
+ printf("chdir error in .. \n");
+ return;
+ }
+
+ if ( aHolder.close() < 0 )
+ return;
std::sort( aFileVec.begin() , aFileVec.end() , File::lessFile );
std::sort( aDirVec.begin() , aDirVec.end() , Directory::lessDir );
@@ -268,3 +290,5 @@ void Directory::readDirectory( const rtl::OUString& sFullpath )
#endif
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/source/export.cxx b/l10ntools/source/export.cxx
index 1012e19b6064..69f1e967b13c 100644
--- a/l10ntools/source/export.cxx
+++ b/l10ntools/source/export.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -32,8 +33,8 @@
#include <tools/fsys.hxx>
#include "export.hxx"
#include "tokens.h"
-#include "utf8conv.hxx"
#include <iostream>
+#include <vector>
extern "C" { int yyerror( char * ); }
extern "C" { int YYWarning( char * ); }
@@ -54,7 +55,7 @@ Export *pExport = 0L;
#define STATE_LANGUAGES 0X000B
// set of global variables
-DECLARE_LIST( FileList, ByteString * )
+typedef ::std::vector< ByteString* > FileList;
FileList aInputFileList;
sal_Bool bEnableExport;
sal_Bool bMergeMode;
@@ -150,7 +151,7 @@ extern char *GetOutputFile( int argc, char* argv[])
return NULL; // no valid command line
}
case STATE_INPUT: {
- aInputFileList.Insert( new ByteString( argv[ i ]), LIST_APPEND );
+ aInputFileList.push_back( new ByteString( argv[ i ] ) );
bInput = sal_True; // min. one source file found
}
break;
@@ -218,7 +219,7 @@ int EndExport()
extern const char* getFilename()
{
- return (*(aInputFileList.GetObject( 0 ))).GetBuffer();
+ return (*(aInputFileList[ 0 ])).GetBuffer();
}
/*****************************************************************************/
extern FILE *GetNextFile()
@@ -232,14 +233,14 @@ extern FILE *GetNextFile()
aTemp.Kill();
}
- while ( aInputFileList.Count()) {
- ByteString sFileName( *(aInputFileList.GetObject( 0 )));
+ while ( !aInputFileList.empty() ) {
+ ByteString sFileName( *(aInputFileList[ 0 ]) );
ByteString sOrigFile( sFileName );
sFileName = Export::GetNativeFile( sFileName );
- delete aInputFileList.GetObject(( sal_uLong ) 0 );
- aInputFileList.Remove(( sal_uLong ) 0 );
+ delete aInputFileList[ 0 ];
+ aInputFileList.erase( aInputFileList.begin() );
if ( sFileName == "" ) {
fprintf( stderr, "ERROR: Could not precompile File %s\n",
@@ -355,12 +356,10 @@ void ResData::Dump(){
}
void ResData::addFallbackData( ByteString& sId_in , const ByteString& sText_in ){
- //printf(" ResData::addFallbackData ( sId = %s , sText = %s )\n", sId_in.GetBuffer() , sText_in.GetBuffer() );
aFallbackData[ sId_in ] = sText_in;
}
bool ResData::getFallbackData( ByteString& sId_in , ByteString& sText_inout ){
sText_inout = aFallbackData[ sId_in ];
- //printf("ResData::getFallbackData( sId = %s , return sText = %s \n" , sId_in.GetBuffer(), sText_inout.GetBuffer());
return sText_inout.Len() > 0;
}
@@ -503,10 +502,9 @@ void Export::Init()
nList = LIST_NON;
nListLang = ByteString( String::CreateFromAscii(""),RTL_TEXTENCODING_ASCII_US );
nListIndex = 0;
- while ( aResStack.Count()) {
- delete aResStack.GetObject(( sal_uLong ) 0 );
- aResStack.Remove(( sal_uLong ) 0 );
- }
+ for ( size_t i = 0, n = aResStack.size(); i < n; ++i )
+ delete aResStack[ i ];
+ aResStack.clear();
}
/*****************************************************************************/
@@ -518,16 +516,14 @@ Export::~Export()
// close output stream
if ( bEnableExport )
aOutput.Close();
- while ( aResStack.Count()) {
- delete aResStack.GetObject(( sal_uLong ) 0 );
- aResStack.Remove(( sal_uLong ) 0 );
- }
+ for ( size_t i = 0, n = aResStack.size(); i < n; ++i )
+ delete aResStack[ i ];
+ aResStack.clear();
if ( bMergeMode && !bUnmerge ) {
if ( !pMergeDataFile )
pMergeDataFile = new MergeDataFile( sMergeSrc,sFile , bErrorLog, aCharSet);//, bUTF8 );
- //pMergeDataFile->WriteErrorLog( sActFileName );
delete pMergeDataFile;
}
}
@@ -539,10 +535,6 @@ int Export::Execute( int nToken, const char * pToken )
ByteString sToken( pToken );
ByteString sOrig( sToken );
-/* printf("+---------------\n");
- printf("sToken = %s\n",sToken.GetBuffer());
- printf("nToken = %d\n",nToken);
- printf("+---------------\n"); */
sal_Bool bWriteToMerged = bMergeMode;
if ( nToken == CONDITION ) {
@@ -565,7 +557,7 @@ int Export::Execute( int nToken, const char * pToken )
ResData *pResData = NULL;
if ( nLevel ) {
// res. exists at cur. level
- pResData = aResStack.GetObject( nLevel-1 );
+ pResData = ( (nLevel-1) < aResStack.size() ) ? aResStack[ nLevel-1 ] : NULL;
}
else if (( nToken != RESSOURCE ) &&
( nToken != RESSOURCEEXPR ) &&
@@ -598,11 +590,6 @@ int Export::Execute( int nToken, const char * pToken )
// end of macro found, so destroy res.
bDefine = sal_False;
if ( bMergeMode ) {
- /*if ( bDontWriteOutput && bUnmerge ) {
- bDontWriteOutput = sal_False;
- bNextMustBeDefineEOL = sal_False;
- bDefine = sal_True;
- }*/
MergeRest( pResData );
}
bNextMustBeDefineEOL = sal_False;
@@ -620,13 +607,6 @@ int Export::Execute( int nToken, const char * pToken )
// cur. line has macro line end
ByteString sTmpLine( sToken );
sTmpLine.EraseAllChars( '\t' ); sTmpLine.EraseAllChars( ' ' );
- #if 0
- // impossible, unsigned is never negative
- if( sTmpLine.Len() < 0 ){
- if ( sTmpLine.GetChar(( sal_uInt16 )( sTmpLine.Len() - 1 )) != '\\' )
- bNextMustBeDefineEOL = sal_True;
- }
- #endif
}
}
}
@@ -658,7 +638,6 @@ int Export::Execute( int nToken, const char * pToken )
switch ( nToken ) {
case NORMDEFINE:
- //printf("sToken = '%s'",sToken.GetBuffer());
while( sToken.SearchAndReplace( "\r", " " ) != STRING_NOTFOUND ) {};
while( sToken.SearchAndReplace( "\t", " " ) != STRING_NOTFOUND ) {};
while( sToken.SearchAndReplace( " ", " " ) != STRING_NOTFOUND ) {};
@@ -683,13 +662,13 @@ int Export::Execute( int nToken, const char * pToken )
// this is the beginning of a new res.
nLevel++;
if ( nLevel > 1 ) {
- aResStack.GetObject( nLevel - 2 )->bChild = sal_True;
+ aResStack[ nLevel - 2 ]->bChild = sal_True;
}
// create new instance for this res. and fill mandatory fields
pResData = new ResData( sActPForm, FullId() , sFilename );
- aResStack.Insert( pResData, LIST_APPEND );
+ aResStack.push_back( pResData );
ByteString sBackup( sToken );
sToken.EraseAllChars( '\n' );
sToken.EraseAllChars( '\r' );
@@ -725,13 +704,13 @@ int Export::Execute( int nToken, const char * pToken )
bNextMustBeDefineEOL = sal_False;
nLevel++;
if ( nLevel > 1 ) {
- aResStack.GetObject( nLevel - 2 )->bChild = sal_True;
+ aResStack[ nLevel - 2 ]->bChild = sal_True;
}
// create new instance for this res. and fill mandatory fields
pResData = new ResData( sActPForm, FullId() , sFilename );
- aResStack.Insert( pResData, LIST_APPEND );
+ aResStack.push_back( pResData );
sToken.EraseAllChars( '\n' );
sToken.EraseAllChars( '\r' );
sToken.EraseAllChars( '{' );
@@ -754,12 +733,12 @@ int Export::Execute( int nToken, const char * pToken )
sLowerTyp = "unknown";
nLevel++;
if ( nLevel > 1 ) {
- aResStack.GetObject( nLevel - 2 )->bChild = sal_True;
+ aResStack[ nLevel - 2 ]->bChild = sal_True;
}
ResData *pNewData = new ResData( sActPForm, FullId() , sFilename );
pNewData->sResTyp = sLowerTyp;
- aResStack.Insert( pNewData, LIST_APPEND );
+ aResStack.push_back( pNewData );
}
break;
case LEVELDOWN: {
@@ -772,8 +751,10 @@ int Export::Execute( int nToken, const char * pToken )
bNextMustBeDefineEOL = sal_False;
}
WriteData( pResData );
- delete aResStack.GetObject( nLevel - 1 );
- aResStack.Remove( nLevel - 1 );
+ ResStack::iterator it = aResStack.begin();
+ ::std::advance( it, nLevel-1 );
+ delete *it;
+ aResStack.erase( it );
nLevel--;
}
}
@@ -806,34 +787,22 @@ int Export::Execute( int nToken, const char * pToken )
pResData->sHelpId = sValue;
}
else if ( sKey == "STRINGLIST" ) {
- //if ( bUnmerge ){
- // ( sOrig.SearchAndReplace( "=", "[ de ] =" ));
- //}
-
pResData->bList = sal_True;
nList = LIST_STRING;
- //ByteString sLang("en-US" , RTL_TEXTENCODING_ASCII_US );
nListLang = SOURCE_LANGUAGE;
nListIndex = 0;
nListLevel = 0;
}
else if ( sKey == "FILTERLIST" ) {
- //if ( bUnmerge ){
- // ( sOrig.SearchAndReplace( "=", "[ de ] =" ));
- //}
pResData->bList = sal_True;
nList = LIST_FILTER;
- //ByteString sLang("en-US" , RTL_TEXTENCODING_ASCII_US );
nListLang = SOURCE_LANGUAGE;
nListIndex = 0;
nListLevel = 0;
}
else if ( sKey == "UIENTRIES" ) {
- //if ( bUnmerge ){
- // ( sOrig.SearchAndReplace( "=", "[ de ] =" ));}
pResData->bList = sal_True;
nList = LIST_UIENTRIES;
- //ByteString sLang("en-US" , RTL_TEXTENCODING_ASCII_US );
nListLang = SOURCE_LANGUAGE;
nListIndex = 0;
nListLevel = 0;
@@ -841,11 +810,8 @@ int Export::Execute( int nToken, const char * pToken )
if (( sToken.Search( "{" ) != STRING_NOTFOUND ) &&
( sToken.GetTokenCount( '{' ) > sToken.GetTokenCount( '}' )))
{
- //WorkOnTokenSet( LEVELUP, pTkn );
Parse( LEVELUP, "" );
}
- //if ( bUnmerge && ( nListLang.EqualsIgnoreCaseAscii("de") || nListLang.EqualsIgnoreCaseAscii("en-US") ) && ListExists( pResData, nList ))
- // bDontWriteOutput = sal_True;
}
break;
case UIENTRIES:
@@ -854,12 +820,8 @@ int Export::Execute( int nToken, const char * pToken )
ByteString sTmpToken( sToken);
sTmpToken.EraseAllChars(' ');
sal_uInt16 nPos = 0;
- //nPos = sTmpToken.ToLowerAscii().Search("[de]=");
nPos = sTmpToken.ToLowerAscii().Search("[en-us]=");
if( nPos != STRING_NOTFOUND ) {
- //if ( bUnmerge ){
- // ( sOrig.SearchAndReplace( "=", "[ de ] =" ));
- //}
ByteString sKey = sTmpToken.Copy( 0 , nPos );
sKey.EraseAllChars( ' ' );
sKey.EraseAllChars( '\t' );
@@ -868,7 +830,6 @@ int Export::Execute( int nToken, const char * pToken )
if ( sKey.ToUpperAscii() == "STRINGLIST" ) {
pResData->bList = sal_True;
nList = LIST_STRING;
- //ByteString sLang("en-US" , RTL_TEXTENCODING_ASCII_US );
nListLang = SOURCE_LANGUAGE;
nListIndex = 0;
nListLevel = 0;
@@ -876,7 +837,6 @@ int Export::Execute( int nToken, const char * pToken )
else if ( sKey == "FILTERLIST" ) {
pResData->bList = sal_True;
nList = LIST_FILTER;
- //ByteString sLang("en-US" , RTL_TEXTENCODING_ASCII_US );
nListLang = SOURCE_LANGUAGE;
nListIndex = 0;
nListLevel = 0;
@@ -885,7 +845,6 @@ int Export::Execute( int nToken, const char * pToken )
else if ( sKey == "PAIREDLIST" ) {
pResData->bList = sal_True;
nList = LIST_PAIRED;
- //ByteString sLang("en-US" , RTL_TEXTENCODING_ASCII_US );
nListLang = SOURCE_LANGUAGE;
nListIndex = 0;
nListLevel = 0;
@@ -894,7 +853,6 @@ int Export::Execute( int nToken, const char * pToken )
else if ( sKey == "ITEMLIST" ) {
pResData->bList = sal_True;
nList = LIST_ITEM;
- //ByteString sLang("en-US" , RTL_TEXTENCODING_ASCII_US );
nListLang = SOURCE_LANGUAGE;
nListIndex = 0;
nListLevel = 0;
@@ -902,15 +860,10 @@ int Export::Execute( int nToken, const char * pToken )
else if ( sKey == "UIENTRIES" ) {
pResData->bList = sal_True;
nList = LIST_UIENTRIES;
- //ByteString sLang("en-US" , RTL_TEXTENCODING_ASCII_US );
nListLang = SOURCE_LANGUAGE;
nListIndex = 0;
nListLevel = 0;
}
- /*if ( bUnmerge && ( nListLang.EqualsIgnoreCaseAscii( "de" )
- || nListLang.EqualsIgnoreCaseAscii("en-US" ) )
- && ListExists( pResData, nList ))
- bDontWriteOutput = sal_True;*/
}
else {
// new res. is a String- or FilterList
@@ -931,12 +884,8 @@ int Export::Execute( int nToken, const char * pToken )
ByteString sLang=sToken.GetToken( 1, '[' ).GetToken( 0, ']' );
CleanValue( sLang );
nListLang = sLang;
- /*if (( bUnmerge ) && ( !nListLang.EqualsIgnoreCaseAscii("de")) && ( !nListLang.EqualsIgnoreCaseAscii("en-US")))
- bDontWriteOutput = sal_True;*/
nListIndex = 0;
nListLevel = 0;
- /*if ( bUnmerge && nListLang.EqualsIgnoreCaseAscii("de") && ListExists( pResData, nList ) )
- bDontWriteOutput = sal_True;*/
}
}
}
@@ -952,8 +901,6 @@ int Export::Execute( int nToken, const char * pToken )
sEntry += "\"";
if ( sEntry == "\\\"" )
sEntry = "\"";
- //sEntry = sEntry.Convert( aCharSet, RTL_TEXTENCODING_MS_1252 );
- //sEntry = sEntry.Convert( RTL_TEXTENCODING_MS_1252, RTL_TEXTENCODING_UTF8 );
InsertListEntry( sEntry, sOrig );
if ( bMergeMode && ( sEntry != "\"" )) {
PrepareTextToMerge( sOrig, nList, nListLang, pResData );
@@ -988,11 +935,7 @@ int Export::Execute( int nToken, const char * pToken )
( sKey == "SLOTNAME" ) ||
( sKey == "UINAME" ))
{
- //if ( bUnmerge && sToken.GetToken( 0, '=' ).Search( "[" ) == STRING_NOTFOUND )
- // ( sOrig.SearchAndReplace( "=", "[ de ] =" ));
-
SetChildWithText();
- //if ( nLangIndex.EqualsIgnoreCaseAscii("en-US") )
if ( Export::isSourceLanguage( nLangIndex ) )
pResData->SetId( sText, ID_LEVEL_TEXT );
@@ -1000,8 +943,6 @@ int Export::Execute( int nToken, const char * pToken )
pResData->sTextTyp = sOrigKey;
if ( bMergeMode ) {
PrepareTextToMerge( sOrig, STRING_TYP_TEXT, nLangIndex, pResData );
- //if ( bUnmerge )
- // pResData->sText[ nLangIndex ] = sText;
}
else {
if ( pResData->sText[ nLangIndex ].Len()) {
@@ -1013,9 +954,6 @@ int Export::Execute( int nToken, const char * pToken )
}
}
else if ( sKey == "HELPTEXT" ) {
- //if ( bUnmerge && sToken.GetToken( 0, '=' ).Search( "[" ) == STRING_NOTFOUND ){
- // ( sOrig.SearchAndReplace( "=", "[ de ] =" ));
- // }
SetChildWithText();
pResData->bHelpText = sal_True;
if ( bBreakWhenHelpText ) {
@@ -1026,8 +964,6 @@ int Export::Execute( int nToken, const char * pToken )
}
if ( bMergeMode )
PrepareTextToMerge( sOrig, STRING_TYP_HELPTEXT, nLangIndex, pResData );
- //if ( bUnmerge )
- // pResData->sHelpText[ nLangIndex ] = sText;
else {
if ( pResData->sHelpText[ nLangIndex ].Len()) {
ByteString sError( "Language " );
@@ -1038,15 +974,10 @@ int Export::Execute( int nToken, const char * pToken )
}
}
else if ( sKey == "QUICKHELPTEXT" ) {
- //if ( bUnmerge && sToken.GetToken( 0, '=' ).Search( "[" ) == STRING_NOTFOUND ){
- // ( sOrig.SearchAndReplace( "=", "[ de ] =" ));
- // }
SetChildWithText();
pResData->bQuickHelpText = sal_True;
if ( bMergeMode )
PrepareTextToMerge( sOrig, STRING_TYP_QUICKHELPTEXT, nLangIndex, pResData );
- //if ( bUnmerge )
- // pResData->sQuickHelpText[ nLangIndex ] = sText;
else {
if ( pResData->sQuickHelpText[ nLangIndex ].Len()) {
ByteString sError( "Language " );
@@ -1057,15 +988,10 @@ int Export::Execute( int nToken, const char * pToken )
}
}
else if ( sKey == "TITLE" ) {
- //if ( bUnmerge && sToken.GetToken( 0, '=' ).Search( "[" ) == STRING_NOTFOUND ){
- // ( sOrig.SearchAndReplace( "=", "[ de ] =" ));
- // }
SetChildWithText();
pResData->bTitle = sal_True;
if ( bMergeMode )
PrepareTextToMerge( sOrig, STRING_TYP_TITLE, nLangIndex, pResData );
- //if ( bUnmerge )
- // pResData->sTitle[ nLangIndex ] = sText;
else {
if ( pResData->sTitle[ nLangIndex ].Len()) {
ByteString sError( "Language " );
@@ -1086,12 +1012,6 @@ int Export::Execute( int nToken, const char * pToken )
break;
case NEWTEXTINRES: {
bDontWriteOutput = sal_True;
- // this means something like // ### Achtung : Neuer Text ...
- /*ByteString sLang( "GERMAN" );
- ByteString sText = sToken.GetToken( 2, ':' ).GetToken( 0, '*' );
- CleanValue( sText );
- if ( sText.Len())
- pResData->sText[ sLang ] = sText;*/
}
break;
case APPFONTMAPPING: {
@@ -1159,7 +1079,6 @@ int Export::Execute( int nToken, const char * pToken )
bDefine = sal_False;
while ( nLevel )
Parse( LEVELDOWN, "" );
- //WorkOnTokenSet( LEVELDOWN, pTkn );
}
}
break;
@@ -1188,22 +1107,6 @@ int Export::Execute( int nToken, const char * pToken )
break;
case TEXTREFID : {
bDontWriteOutput = sal_True;
- /*ByteString sK = sToken.GetToken( 0, '=' );
- ByteString sKey = sK.EraseAllChars( '\t' ).EraseAllChars( ' ' );
- ByteString sT = sToken.GetToken( 1, '=' ).GetToken( 0, ';' );
- sal_uInt16 nRefId = ( sal_uInt16 ) sT.EraseAllChars( '\t' ).EraseAllChars( ' ' ).ToInt32();
- if (( sKey.ToUpperAscii() == "TEXT" ) ||
- ( sKey == "MESSAGE" ) ||
- ( sKey == "CUSTOMUNITTEXT" ) ||
- ( sKey == "SLOTNAME" ) ||
- ( sKey == "UINAME" ))
- pResData->nTextRefId = nRefId;
- else if ( sKey == "HELPTEXT" )
- pResData->nHelpTextRefId = nRefId;
- else if ( sKey == "QUICKHELPTEXT" )
- pResData->nQuickHelpTextRefId = nRefId;
- else if ( sKey == "TITLE" )
- pResData->nTitleRefId = nRefId;*/
}
}
if ( bWriteToMerged ) {
@@ -1221,7 +1124,6 @@ int Export::Execute( int nToken, const char * pToken )
if ( bExecuteDown ) {
Parse( LEVELDOWN, "" );
- //WorkOnTokenSet( LEVELDOWN, pTkn );
}
return 1;
@@ -1290,25 +1192,15 @@ sal_Bool Export::WriteData( ResData *pResData, sal_Bool bCreateNew )
if ( bUnmerge )
return sal_True;
-/* ByteStringHashMap::iterator pos3 = pResData->sText.begin();
- ByteStringHashMap::iterator end3 = pResData->sText.end();
- for(;pos3!=end3;++pos3){
-
- printf("[%s]=%s\n", pos3->first.GetBuffer(), pos3->second.GetBuffer() );
- }*/
// mandatory to export: en-US
- if (( //pResData->sText[ ByteString("de") ].Len() &&
- ( pResData->sText[ SOURCE_LANGUAGE ].Len()))
+ if (( pResData->sText[ SOURCE_LANGUAGE ].Len())
||
- ( //pResData->sHelpText[ ByteString("de") ].Len() &&
- ( pResData->sHelpText[ SOURCE_LANGUAGE ].Len()))
+ ( pResData->sHelpText[ SOURCE_LANGUAGE ].Len())
||
- ( //pResData->sQuickHelpText[ ByteString("de") ].Len() &&
- ( pResData->sQuickHelpText[ SOURCE_LANGUAGE ].Len()))
+ ( pResData->sQuickHelpText[ SOURCE_LANGUAGE ].Len())
||
- ( //pResData->sTitle[ ByteString("de") ].Len() &&
- ( pResData->sTitle[ SOURCE_LANGUAGE ].Len())))
+ ( pResData->sTitle[ SOURCE_LANGUAGE ].Len()))
{
FillInFallbacks( pResData );
@@ -1335,52 +1227,32 @@ sal_Bool Export::WriteData( ResData *pResData, sal_Bool bCreateNew )
sXText = pResData->sText[ sCur ];
else {
sXText = pResData->sText[ SOURCE_LANGUAGE ];
- /*if ( !sXText.Len())
- sXText = pResData->sText[ ByteString("en") ];
- if ( !sXText.Len())
- sXText = pResData->sText[ ByteString("de") ];*/
}
if ( pResData->sHelpText[ sCur ].Len())
sXHText = pResData->sHelpText[ sCur ];
else {
sXHText = pResData->sHelpText[ SOURCE_LANGUAGE ];
- /*if ( !sXHText.Len())
- sXHText = pResData->sHelpText[ ByteString("en") ];
- if ( !sXText.Len())
- sXHText = pResData->sHelpText[ ByteString("de") ];*/
}
if ( pResData->sQuickHelpText[ sCur ].Len())
sXQHText = pResData->sQuickHelpText[ sCur ];
else {
sXQHText = pResData->sQuickHelpText[ SOURCE_LANGUAGE ];
- /*if ( !sXQHText.Len())
- sXQHText = pResData->sQuickHelpText[ ByteString("en") ];
- if ( !sXQHText.Len())
- sXQHText = pResData->sQuickHelpText[ ByteString("de") ];*/
}
if ( pResData->sTitle[ sCur ].Len())
sXTitle = pResData->sTitle[ sCur ];
else {
sXTitle = pResData->sTitle[ SOURCE_LANGUAGE ];
- /*if ( !sXTitle.Len())
- sXTitle = pResData->sTitle[ ByteString("en") ];
- if ( !sXTitle.Len())
- sXTitle = pResData->sTitle[ ByteString("de") ];*/
}
if ( !sXText.Len())
sXText = "-";
if ( !sXHText.Len()) {
- /*if ( pResData->sHelpText[ ByteString("de") ].Len())
- sXHText = pResData->sHelpText[ ByteString("de") ];*/
if ( pResData->sHelpText[ SOURCE_LANGUAGE ].Len())
sXHText = pResData->sHelpText[ SOURCE_LANGUAGE ];
- /*else if ( pResData->sHelpText[ ByteString("en") ].Len())
- sXHText = pResData->sHelpText[ ByteString("en") ];*/
}
}
else
@@ -1406,7 +1278,6 @@ sal_Bool Export::WriteData( ResData *pResData, sal_Bool bCreateNew )
sOutput += sXTitle; sOutput += "\t";
sOutput += sTimeStamp;
- // if( !sCur.EqualsIgnoreCaseAscii("de") ||( sCur.EqualsIgnoreCaseAscii("de") && !Export::isMergingGermanAllowed( sProject ) ) )
aOutput.WriteLine( sOutput );
}
@@ -1492,20 +1363,16 @@ sal_Bool Export::WriteExportList( ResData *pResData, ExportList *pExportList,
ByteString sTimeStamp( Export::GetTimeStamp());
ByteString sCur;
- for ( sal_uLong i = 0; pExportList != NULL && i < pExportList->Count(); i++ ) {
- ExportListEntry *pEntry = pExportList->GetObject( i );
- // mandatory for export: german and eng. and/or enus
- //ByteString a("Export::WriteExportList::pEntry");
- //Export::DumpMap( a, *pEntry );
+ for ( size_t i = 0; pExportList != NULL && i < pExportList->size(); i++ ) {
+ ExportListEntry *pEntry = (*pExportList)[ i ];
+ // mandatory for export: german and eng. and/or enus
+ // ByteString a("Export::WriteExportList::pEntry");
+ // Export::DumpMap( a, *pEntry );
ByteString sLID( ByteString::CreateFromInt64( i + 1 ));
for( unsigned int n = 0; n < aLanguages.size(); n++ ){
sCur = aLanguages[ n ];
- if ( //1 )
- //(*pEntry)[ ByteString("de") ].Len() &&
- (*pEntry)[ SOURCE_LANGUAGE ].Len() )
- //||
- // (*pEntry)[ ByteString("en") ].Len()))
+ if ( (*pEntry)[ SOURCE_LANGUAGE ].Len() )
{
if ( bEnableExport )
{
@@ -1519,15 +1386,9 @@ sal_Bool Export::WriteExportList( ResData *pResData, ExportList *pExportList,
sText = GetPairedListString( sText );
}
else{
- //if ((*pEntry)[ sCur ].Len()){
- // if( sCur.EqualsIgnoreCaseAscii("de") ){
- // sText = StripList( (*pEntry)[ sCur ] );
- // }
- // else
sText = StripList( (*pEntry)[ sCur ] );
if( sText == "\\\"" )
sText = "\"";
- //}
}
ByteString sOutput( sProject ); sOutput += "\t";
@@ -1543,7 +1404,6 @@ sal_Bool Export::WriteExportList( ResData *pResData, ExportList *pExportList,
sOutput += sText; sOutput += "\t\t\t\t";
sOutput += sTimeStamp;
- //if( !sCur.EqualsIgnoreCaseAscii("de") ||( sCur.EqualsIgnoreCaseAscii("de") && !Export::isMergingGermanAllowed( sProject ) ) )
aOutput.WriteLine( sOutput );
}
@@ -1564,9 +1424,9 @@ ByteString Export::FullId()
{
ByteString sFull;
if ( nLevel > 1 ) {
- sFull = aResStack.GetObject( 0 )->sId;
- for ( sal_uInt16 i = 1; i < nLevel - 1; i++ ) {
- ByteString sToAdd = aResStack.GetObject( i )->sId;
+ sFull = aResStack[ 0 ]->sId;
+ for ( size_t i = 1; i < nLevel - 1; i++ ) {
+ ByteString sToAdd = aResStack[ i ]->sId;
if ( sToAdd.Len()) {
sFull += ".";
sFull += sToAdd;
@@ -1587,7 +1447,7 @@ ByteString Export::FullId()
void Export::InsertListEntry( const ByteString &rText, const ByteString &rLine )
/*****************************************************************************/
{
- ResData *pResData = aResStack.GetObject( nLevel-1 );
+ ResData *pResData = ( nLevel-1 < aResStack.size() ) ? aResStack[ nLevel-1 ] : NULL;
ExportList *pList = NULL;
if ( nList == LIST_STRING ) {
@@ -1633,12 +1493,12 @@ void Export::InsertListEntry( const ByteString &rText, const ByteString &rLine )
else
return;
- if ( nListIndex + 1 > pList->Count()) {
+ if ( nListIndex + 1 > pList->size()) {
ExportListEntry *pNew = new ExportListEntry();
(*pNew)[ LIST_REFID ] = ByteString::CreateFromInt32( REFID_NONE );
- pList->Insert( pNew, LIST_APPEND );
+ pList->push_back( pNew );
}
- ExportListEntry *pCurEntry = pList->GetObject( nListIndex );
+ ExportListEntry *pCurEntry = (*pList)[ nListIndex ];
// For paired list use the line to set proper lid
if( nList == LIST_PAIRED ){
@@ -1647,7 +1507,6 @@ void Export::InsertListEntry( const ByteString &rText, const ByteString &rLine )
(*pCurEntry)[ nListLang ] = rText;
// Remember en-US fallback string, so each list has the same amount of elements
- //if ( nListLang.EqualsIgnoreCaseAscii("en-US") ) {
if ( Export::isSourceLanguage( nListLang ) ) {
if( nList == LIST_PAIRED ){
const ByteString sPlist("pairedlist");
@@ -1668,7 +1527,6 @@ void Export::InsertListEntry( const ByteString &rText, const ByteString &rLine )
// new fallback
}
- //if ( nListLang.EqualsIgnoreCaseAscii("en-US") ) {
if ( Export::isSourceLanguage( nListLang ) ) {
if( nList == LIST_PAIRED ){
(*pCurEntry)[ SOURCE_LANGUAGE ] = rLine;
@@ -1791,11 +1649,6 @@ void Export::WriteToMerged( const ByteString &rText , bool bSDFContent )
static ByteString RETURN ('\n');
//printf("%s\n",rText.GetBuffer() );
- #if 0
- // statement has no effect
- if( pParseQueue->bMflag && !bSDFContent ) pParseQueue->bMflag;
- #endif
-
if ( !bDontWriteOutput || !bUnmerge ) {
ByteString sText( rText );
while ( sText.SearchAndReplace( " \n", "\n" ) != STRING_NOTFOUND ) {};
@@ -1953,11 +1806,8 @@ sal_Bool Export::PrepareTextToMerge( ByteString &rText, sal_uInt16 nTyp,
}
if ( pList ) {
- ExportListEntry *pCurEntry = pList->GetObject( nListIndex - 1 );
+ ExportListEntry *pCurEntry = (*pList)[ nListIndex - 1 ];
if ( pCurEntry ) {
- //printf("%s\n",Export::DumpMap( "pCurEntry", *pCurEntry ).GetBuffer() );
- //ByteString a("pCurEntry");
- //Export::DumpMap( a , *pCurEntry );
rText = (*pCurEntry)[ SOURCE_LANGUAGE ];
if( nTyp == LIST_PAIRED ){
pResData->addMergedLanguage( nLangIndex );
@@ -2006,15 +1856,6 @@ sal_Bool Export::PrepareTextToMerge( ByteString &rText, sal_uInt16 nTyp,
case STRING_TYP_QUICKHELPTEXT :
case STRING_TYP_TITLE :
{
- /*if ( bUnmerge ) {
- if (( nLangIndex != ByteString("de") ) &&
- ( nLangIndex != ByteString("en-US") ))
- {
- bDontWriteOutput = sal_True;
- }
- return sal_True;
- }*/
-
nStart = rText.Search( "=" );
if ( nStart == STRING_NOTFOUND ) {
rText = sOrigText;
@@ -2065,15 +1906,8 @@ sal_Bool Export::PrepareTextToMerge( ByteString &rText, sal_uInt16 nTyp,
else if( !isInitialized )InitLanguages();
}
-// printf("*************DUMPING****************\n");
-// printf("%s\n",pMergeDataFile->Dump().GetBuffer());
-// printf("*************DUMPING****************\n");
-// printf("Dumping ResData\n");
-// pResData->Dump();
PFormEntrys *pEntrys = pMergeDataFile->GetPFormEntrys( pResData );
- //printf("Dumping pEntrys\n");
- //if( pEntrys ) pEntrys->Dump();
pResData->sId = sOldId;
pResData->sGId = sOldGId;
pResData->sResTyp = sOldTyp;
@@ -2085,13 +1919,11 @@ sal_Bool Export::PrepareTextToMerge( ByteString &rText, sal_uInt16 nTyp,
ByteString sContent;
pEntrys->GetTransex3Text( sContent, nTyp, nLangIndex );
- //if ( !sContent.Len() && ( ! nLangIndex.EqualsIgnoreCaseAscii("en-US") )) {
if ( !sContent.Len() && ( ! Export::isSourceLanguage( nLangIndex ) )) {
rText = sOrigText;
return sal_False; // no data found
}
- //if ( nLangIndex.EqualsIgnoreCaseAscii("en-US") ) {
if ( Export::isSourceLanguage( nLangIndex ) ) {
return sal_False;
}
@@ -2099,12 +1931,10 @@ sal_Bool Export::PrepareTextToMerge( ByteString &rText, sal_uInt16 nTyp,
ByteString sPostFix( rText.Copy( ++nEnd ));
rText.Erase( nStart );
- //ConvertMergeContent( sContent, nTyp );
ConvertMergeContent( sContent );
- //printf("Merged %s\n",nLangIndex.GetBuffer());
// merge new res. in text line
rText += sContent;
rText += sPostFix;
@@ -2116,10 +1946,6 @@ sal_Bool Export::PrepareTextToMerge( ByteString &rText, sal_uInt16 nTyp,
void Export::MergeRest( ResData *pResData, sal_uInt16 nMode )
/*****************************************************************************/
{
- //if ( bUnmerge ) { return;}
-
- //pResData->Dump();
-
if ( !pMergeDataFile ){
pMergeDataFile = new MergeDataFile( sMergeSrc, sFile ,bErrorLog, aCharSet);//, bUTF8 );
@@ -2158,7 +1984,6 @@ void Export::MergeRest( ResData *pResData, sal_uInt16 nMode )
bFirst=sal_False;
sOutput += "\t";
sOutput += pResData->sTextTyp;
- //if ( !sCur.EqualsIgnoreCaseAscii("en-US")) {
if ( ! Export::isSourceLanguage( sCur ) ) {
sOutput += "[ ";
sOutput += sCur;
@@ -2211,7 +2036,6 @@ void Export::MergeRest( ResData *pResData, sal_uInt16 nMode )
bFirst=sal_False;
sOutput += "\t";
sOutput += "QuickHelpText";
- //if ( !sCur.EqualsIgnoreCaseAscii("en-US") ) {
if ( ! Export::isSourceLanguage( sCur ) ) {
sOutput += "[ ";
sOutput += sCur;
@@ -2258,7 +2082,6 @@ void Export::MergeRest( ResData *pResData, sal_uInt16 nMode )
bFirst=sal_False;
sOutput += "\t";
sOutput += "Title";
- //if ( !sCur.EqualsIgnoreCaseAscii("en-US") ) {
if ( ! Export::isSourceLanguage( sCur ) ) {
sOutput += "[ ";
sOutput += sCur;
@@ -2286,9 +2109,6 @@ void Export::MergeRest( ResData *pResData, sal_uInt16 nMode )
// Merge Lists
if ( pResData->bList ) {
- //printf("Dumping ResData\n");
- //pResData->Dump();
-
bool bPairedList = false;
ByteString sOldId = pResData->sId;
ByteString sOldGId = pResData->sGId;
@@ -2315,7 +2135,7 @@ void Export::MergeRest( ResData *pResData, sal_uInt16 nMode )
// Set matching pairedlist identifier
if( bPairedList && pResData->pPairedList && ( nIdx == 1 ) ){
- ExportListEntry* pListE = ( ExportListEntry* ) pResData->pPairedList->GetObject( nIdx-1 );
+ ExportListEntry* pListE = ( ExportListEntry* ) (*pResData->pPairedList)[ nIdx-1 ];
pResData->sId = GetPairedListID ( (*pListE)[ SOURCE_LANGUAGE ] );
}
else
@@ -2328,7 +2148,6 @@ void Export::MergeRest( ResData *pResData, sal_uInt16 nMode )
nMaxIndex = pList->GetSourceLanguageListEntryCount();
pEntrys = pMergeDataFile->GetPFormEntrys( pResData );
while( pEntrys && ( nLIndex < nMaxIndex )) {
- //printf("Lang %s, List Index %d\n",sCur.GetBuffer(),(int)nLIndex);
ByteString sText;
sal_Bool bText;
bText = pEntrys->GetTransex3Text( sText, STRING_TYP_TEXT, sCur, sal_True );
@@ -2336,7 +2155,6 @@ void Export::MergeRest( ResData *pResData, sal_uInt16 nMode )
bText = pEntrys->GetTransex3Text( sText , STRING_TYP_TEXT, SOURCE_LANGUAGE , sal_False );
// Use fallback, if data is missing in sdf file
- //if( !bText && pResData->sResTyp.Equals( "pairedlist" ) ){
if( !bText && bPairedList ){
if( pResData->isMerged( sCur ) ) break;
const ByteString sPlist("pairedlist");
@@ -2350,7 +2168,6 @@ void Export::MergeRest( ResData *pResData, sal_uInt16 nMode )
} // new fallback
if ( bText && sText.Len()) {
- //if( pEntrys ) pEntrys->Dump();
if ( nIdx == 1 ) {
ByteString sHead;
if ( bNextMustBeDefineEOL )
@@ -2380,8 +2197,8 @@ void Export::MergeRest( ResData *pResData, sal_uInt16 nMode )
WriteToMerged( sHead , true);
}
ByteString sLine;
- if ( pList && pList->GetObject( nLIndex ))
- sLine = ( *pList->GetObject( nLIndex ))[ SOURCE_LANGUAGE ];
+ if ( pList && (*pList)[ nLIndex ] )
+ sLine = ( *(*pList)[ nLIndex ])[ SOURCE_LANGUAGE ];
if ( !sLine.Len())
sLine = sLastListLine;
@@ -2426,13 +2243,12 @@ void Export::MergeRest( ResData *pResData, sal_uInt16 nMode )
sText1 += " ;\n";
sText1 += sSpace;
sText1 += "\t";
- //printf("Writing '%s'\n",sText1.GetBuffer());
WriteToMerged( sText1 ,true );
// Set matching pairedlist identifier
if ( bPairedList ){
nIdx++;
- ExportListEntry* pListE = ( ExportListEntry* ) pResData->pPairedList->GetObject( ( nIdx ) -1 );
+ ExportListEntry* pListE = ( ExportListEntry* )(*pResData->pPairedList)[ ( nIdx ) -1 ];
if( pListE ){
pResData->sId = GetPairedListID ( (*pListE)[ SOURCE_LANGUAGE ] );
}
@@ -2444,7 +2260,7 @@ void Export::MergeRest( ResData *pResData, sal_uInt16 nMode )
break;
nLIndex ++;
PFormEntrys *oldEntry = pEntrys;
- pEntrys = pMergeDataFile->GetPFormEntrys( pResData ); // <--- game over
+ pEntrys = pMergeDataFile->GetPFormEntrys( pResData );
if( !pEntrys )
pEntrys = oldEntry;
}
@@ -2484,8 +2300,8 @@ void Export::MergeRest( ResData *pResData, sal_uInt16 nMode )
if ( pList )
nMaxIndex = pList->GetSourceLanguageListEntryCount();
ByteString sLine;
- if ( pList && pList->GetObject( nListIndex ))
- sLine = ( *pList->GetObject( nListIndex ))[ SOURCE_LANGUAGE ];
+ if ( pList && (*pList)[ nListIndex ] )
+ sLine = ( *(*pList)[ nListIndex ])[ SOURCE_LANGUAGE ];
if ( !sLine.Len())
sLine = sLastListLine;
@@ -2509,8 +2325,8 @@ void Export::MergeRest( ResData *pResData, sal_uInt16 nMode )
sText += "\t";
WriteToMerged( sText ,false );
nListIndex++;
- if ( pList && pList->GetObject( nListIndex ))
- sLine = ( *pList->GetObject( nListIndex ))[ SOURCE_LANGUAGE ];
+ if ( pList && (*pList)[ nListIndex ])
+ sLine = ( *(*pList)[ nListIndex ])[ SOURCE_LANGUAGE ];
if ( !sLine.Len())
sLine = sLastListLine;
sLine += " ;";
@@ -2534,15 +2350,14 @@ ByteString Export::MergePairedList( ByteString& sLine , ByteString& sText ){
void Export::SetChildWithText()
/*****************************************************************************/
{
- if ( aResStack.Count() > 1 ) {
- for ( sal_uLong i = 0; i < aResStack.Count() - 1; i++ ) {
- aResStack.GetObject( i )->bChildWithText = sal_True;
+ if ( aResStack.size() > 1 ) {
+ for ( size_t i = 0; i < aResStack.size() - 1; i++ ) {
+ aResStack[ i ]->bChildWithText = sal_True;
}
}
}
void ParserQueue::Push( const QueueEntry& aEntry ){
-// printf("nTyp = %d ",aEntry.nTyp);
sal_uInt16 nLen = aEntry.sLine.Len();
if( !bStart ){
@@ -2643,3 +2458,5 @@ ParserQueue::~ParserQueue(){
if( aQueueNext ) delete aQueueNext;
if( aQueueCur ) delete aQueueCur;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/source/export2.cxx b/l10ntools/source/export2.cxx
index eb5f8d5fbf15..0b7fb44d8a95 100644
--- a/l10ntools/source/export2.cxx
+++ b/l10ntools/source/export2.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,13 +29,13 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_l10ntools.hxx"
#include "export.hxx"
-#include "utf8conv.hxx"
#include <tools/datetime.hxx>
#include <tools/isofallback.hxx>
#include <stdio.h>
#include <osl/time.h>
#include <osl/process.h>
#include <rtl/ustring.hxx>
+#include <sal/macros.h>
#include <iostream>
#include <iomanip>
#include <tools/urlobj.hxx>
@@ -52,32 +53,32 @@ ResData::~ResData()
{
if ( pStringList ) {
// delete existing res. of type StringList
- for ( sal_uLong i = 0; i < pStringList->Count(); i++ ) {
- ExportListEntry* test = pStringList->GetObject( i );
+ for ( size_t i = 0; i < pStringList->size(); i++ ) {
+ ExportListEntry* test = (*pStringList)[ i ];
if( test != NULL ) delete test;
}
delete pStringList;
}
if ( pFilterList ) {
// delete existing res. of type FilterList
- for ( sal_uLong i = 0; i < pFilterList->Count(); i++ ) {
- ExportListEntry* test = pFilterList->GetObject( i );
+ for ( size_t i = 0; i < pFilterList->size(); i++ ) {
+ ExportListEntry* test = (*pFilterList)[ i ];
delete test;
}
delete pFilterList;
}
if ( pItemList ) {
// delete existing res. of type ItemList
- for ( sal_uLong i = 0; i < pItemList->Count(); i++ ) {
- ExportListEntry* test = pItemList->GetObject( i );
+ for ( size_t i = 0; i < pItemList->size(); i++ ) {
+ ExportListEntry* test = (*pItemList)[ i ];
delete test;
}
delete pItemList;
}
if ( pUIEntries ) {
// delete existing res. of type UIEntries
- for ( sal_uLong i = 0; i < pUIEntries->Count(); i++ ) {
- ExportListEntry* test = pUIEntries->GetObject( i );
+ for ( size_t i = 0; i < pUIEntries->size(); i++ ) {
+ ExportListEntry* test = (*pUIEntries)[ i ];
delete test;
}
delete pUIEntries;
@@ -98,8 +99,8 @@ void Export::DumpExportList( ByteString& sListName , ExportList& aList ){
printf( "%s\n", sListName.GetBuffer() );
ByteString l("");
ExportListEntry* aEntry;
- for( unsigned int x = 0; x < aList.Count() ; x++ ){
- aEntry = (ExportListEntry*) aList.GetObject( x );
+ for( unsigned int x = 0; x < aList.size() ; x++ ){
+ aEntry = (ExportListEntry*) aList[ x ];
Export::DumpMap( l , *aEntry );
}
printf("\n");
@@ -145,7 +146,6 @@ void Export::QuotHTMLXRM( ByteString &rString )
/*****************************************************************************/
{
ByteString sReturn;
- //sal_Bool bBreak = sal_False;
for ( sal_uInt16 i = 0; i < rString.Len(); i++ ) {
ByteString sTemp = rString.Copy( i );
if ( sTemp.Search( "<Arg n=" ) == 0 ) {
@@ -298,13 +298,11 @@ void Export::RemoveUTF8ByteOrderMarkerFromFile( const ByteString &rFilename ){
aFileIn.ReadLine( sLine );
// Test header
if( hasUTF8ByteOrderMarker( sLine ) ){
- //cout << "UTF8 Header found!\n";
DirEntry aTempFile = Export::GetTempFile();
ByteString sTempFile = ByteString( aTempFile.GetFull() , RTL_TEXTENCODING_ASCII_US );
SvFileStream aNewFile( String( sTempFile , RTL_TEXTENCODING_ASCII_US ) , STREAM_WRITE );
// Remove header
RemoveUTF8ByteOrderMarker( sLine );
- //cout << "Copy stripped stuff to " << sTempFile.GetBuffer() << endl;
aNewFile.WriteLine( sLine );
// Copy the rest
while( !aFileIn.IsEof() ){
@@ -314,40 +312,15 @@ void Export::RemoveUTF8ByteOrderMarkerFromFile( const ByteString &rFilename ){
if( aFileIn.IsOpen() ) aFileIn.Close();
if( aNewFile.IsOpen() ) aNewFile.Close();
DirEntry aEntry( rFilename.GetBuffer() );
- //cout << "Removing file " << rFilename.GetBuffer() << "\n";
aEntry.Kill();
- //cout << "Renaming file " << sTempFile.GetBuffer() << " to " << rFilename.GetBuffer() << "\n";
DirEntry( sTempFile ).MoveTo( DirEntry( rFilename.GetBuffer() ) );
}
}
if( aFileIn.IsOpen() ) aFileIn.Close();
}
-// Merge it into source code!
-//bool Export::isMergingGermanAllowed( const ByteString& rPrj ){
-// (void) rPrj;
-// return true;
-/* static ByteStringBoolHashMap aHash;
-
- if( aHash.find( rPrj ) != aHash.end() ){
- return aHash[ rPrj ];
- }
-
- ByteString sFile = Export::GetEnv( "SRC_ROOT" ) ;
- sFile.Append("/");
- sFile.Append( rPrj );
- sFile.Append("/prj/l10n");
-#if defined(WNT) || defined(OS2)
- sFile.SearchAndReplaceAll('/','\\');
-#endif
- DirEntry aFlagfile( sFile );
-
- aHash[ rPrj ] = !aFlagfile.Exists();
- return aHash[ rPrj ];*/
-//}
bool Export::CopyFile( const ByteString& source , const ByteString& dest )
{
-// cout << "CopyFile( " << source.GetBuffer() << " , " << dest.GetBuffer() << " )\n";
const int BUFFERSIZE = 8192;
char buf[ BUFFERSIZE ];
@@ -474,7 +447,7 @@ void Export::InitForcedLanguages( bool bMergeMode ){
ByteString Export::GetFallbackLanguage( const ByteString nLanguage )
/*****************************************************************************/
{
- ByteString sFallback=nLanguage;
+ rtl::OString sFallback=nLanguage;
GetIsoFallback( sFallback );
return sFallback;
}
@@ -558,8 +531,8 @@ void Export::FillInListFallbacks(
/*****************************************************************************/
{
- for ( sal_uLong i = 0; i < pList->Count(); i++ ) {
- ExportListEntry *pEntry = pList->GetObject( i );
+ for ( size_t i = 0; i < pList->size(); i++ ) {
+ ExportListEntry *pEntry = (*pList)[ i ];
if ( !( *pEntry )[ nSource ].Len()){
( *pEntry )[ nSource ] = ( *pEntry )[ nFallback ];
ByteString x = ( *pEntry )[ nSource ];
@@ -665,7 +638,7 @@ void Export::getCurrentDir( string& dir )
void Export::getRandomName( const ByteString& sPrefix , ByteString& sRandStr , const ByteString& sPostfix )
{
static const char LETTERS[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
- static const int COUNT_OF_LETTERS = sizeof(LETTERS)/sizeof(LETTERS[0]) - 1;
+ static const int COUNT_OF_LETTERS = SAL_N_ELEMENTS(LETTERS) - 1;
sRandStr.Append( sPrefix );
static sal_uInt64 value;
@@ -676,7 +649,8 @@ void Export::getRandomName( const ByteString& sPrefix , ByteString& sRandStr , c
int i;
osl_getSystemTime( &tv );
- oslProcessInfo proInfo;
+ oslProcessInfo proInfo;
+ proInfo.Size = sizeof(oslProcessInfo);
osl_getProcessInfo( 0 , osl_Process_IDENTIFIER , &proInfo );
value += ((sal_uInt64) ( tv.Nanosec / 1000 ) << 16) ^ ( tv.Nanosec / 1000 ) ^ proInfo.Ident;
@@ -715,7 +689,7 @@ DirEntry Export::GetTempFile()
String sDecodedStr = INetURLObject::decode( strTmp , '%' , eMechanism );
ByteString sTmp( sDecodedStr , RTL_TEXTENCODING_UTF8 );
-#if defined(WNT) || defined(OS2)
+#if defined(WNT)
sTmp.SearchAndReplace("file:///","");
sTmp.SearchAndReplaceAll('/','\\');
#else
@@ -732,3 +706,5 @@ DirEntry Export::GetTempFile()
delete sTempFilename;
return aDirEntry;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/source/file.cxx b/l10ntools/source/file.cxx
index c6e177ce9c15..d57c20d92c04 100644
--- a/l10ntools/source/file.cxx
+++ b/l10ntools/source/file.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -53,3 +54,5 @@ bool File::lessFile ( const File& rKey1, const File& rKey2 )
}
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/source/filter/merge/makefile.mk b/l10ntools/source/filter/merge/makefile.mk
index f8f8fb640249..8ef73debd743 100644
--- a/l10ntools/source/filter/merge/makefile.mk
+++ b/l10ntools/source/filter/merge/makefile.mk
@@ -35,18 +35,10 @@ PACKAGE = com$/sun$/star$/filter$/config$/tools$/merge
.INCLUDE: settings.mk
#----- compile .java files -----------------------------------------
-#.IF "$(L10N_framework)"==""
OWNCOPY = \
$(MISC)$/$(TARGET)_copied.done
-#JARFILES = \
-# ridl.jar \
-# unoil.jar \
-# jurt.jar \
-# juh.jar \
-# java_uno.jar
-
CFGFILES = \
FCFGMerge.cfg
@@ -73,7 +65,7 @@ JARCOMPRESS = TRUE
.INCLUDE : target.mk
-.IF "$(SOLAR_JAVA)" != "" || "$(GUI)"=="OS2"
+.IF "$(SOLAR_JAVA)" != ""
ALLTAR : $(OWNCOPY)
.IF "$(JARTARGETN)" != ""
@@ -85,8 +77,3 @@ $(OWNCOPY) : $(CFGFILES)
$(COPY) $? $(CLASSDIR)$/$(PACKAGE) && $(TOUCH) $@
.ENDIF # "$(SOLAR_JAVA)" != ""
-
-#.ELSE
-#pseudo:
-
-#.ENDIF
diff --git a/l10ntools/source/filter/utils/Cache.java b/l10ntools/source/filter/utils/Cache.java
index d1d4766398d2..a8fbaaa953a9 100644
--- a/l10ntools/source/filter/utils/Cache.java
+++ b/l10ntools/source/filter/utils/Cache.java
@@ -1787,7 +1787,7 @@ public class Cache
{
// last token was not a delimiter - new one is such delim
// => ignore this delimiter - but save the information, that
- // it occured
+ // it occurred
bLastWasDelim = true;
}
}
diff --git a/l10ntools/source/gsicheck.cxx b/l10ntools/source/gsicheck.cxx
index 61c7cf02fea3..89fb66775d54 100644
--- a/l10ntools/source/gsicheck.cxx
+++ b/l10ntools/source/gsicheck.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -30,7 +31,6 @@
#include <stdio.h>
#include <tools/fsys.hxx>
#include <tools/stream.hxx>
-#include <tools/list.hxx>
// local includes
#include "tagtest.hxx"
@@ -197,7 +197,6 @@ GSILine::GSILine( const ByteString &rLine, sal_uLong nLine )
}
if ( nPos != STRING_NOTFOUND )
{
-// ByteString aStatus = sTmp.Copy( nStart, nPos - nStart ); // ext int ...
nStart = nPos + 4; // + length of the delemiter
}
if ( nPos != STRING_NOTFOUND )
@@ -305,8 +304,9 @@ GSIBlock::~GSIBlock()
delete pSourceLine;
delete pReferenceLine;
- for ( sal_uLong i = 0; i < Count(); i++ )
- delete ( GetObject( i ));
+ for ( size_t i = 0, n = maList.size(); i < n; ++i )
+ delete maList[ i ];
+ maList.clear();
}
/*****************************************************************************/
@@ -328,23 +328,22 @@ void GSIBlock::InsertLine( GSILine* pLine, ByteString aSourceLang)
return;
}
}
- sal_uLong nPos = 0;
if ( aSourceLang.Len() ) // only check blockstructure if source lang is given
{
- while ( nPos < Count() )
+ for ( size_t nPos = 0, n = maList.size(); nPos < n; ++nPos )
{
- if ( GetObject( nPos )->GetLanguageId().Equals( pLine->GetLanguageId() ) )
+ if ( maList[ nPos ]->GetLanguageId().Equals( pLine->GetLanguageId() ) )
{
PrintError( "Translation Language entry double. Checking both.", "File format", "", pLine->GetLineNumber(), pLine->GetUniqId() );
bHasBlockError = sal_True;
- GetObject( nPos )->NotOK();
+ maList[ nPos ]->NotOK();
pLine->NotOK();
}
nPos++;
}
}
- Insert( pLine, LIST_APPEND );
+ maList.push_back( pLine );
}
/*****************************************************************************/
@@ -375,10 +374,9 @@ void GSIBlock::PrintList( ParserMessageList *pList, ByteString aPrefix,
GSILine *pLine )
/*****************************************************************************/
{
- sal_uLong i;
- for ( i = 0 ; i < pList->Count() ; i++ )
+ for ( size_t i = 0 ; i < pList->size() ; i++ )
{
- ParserMessage *pMsg = pList->GetObject( i );
+ ParserMessage *pMsg = (*pList)[ i ];
ByteString aContext;
if ( bPrintContext )
{
@@ -612,7 +610,7 @@ sal_Bool GSIBlock::CheckSyntax( sal_uLong nLine, sal_Bool bRequireSourceLine, sa
if ( pSourceLine )
pSource = pSourceLine;
else
- pSource = GetObject( 0 ); // get some other line
+ pSource = maList.empty() ? NULL : maList[ 0 ]; // get some other line
if ( pSource )
PrintError( "No reference line found. Entry is new in source file", "File format", "", pSource->GetLineNumber(), pSource->GetUniqId() );
else
@@ -636,21 +634,21 @@ sal_Bool GSIBlock::CheckSyntax( sal_uLong nLine, sal_Bool bRequireSourceLine, sa
if ( pSourceLine )
bHasError |= !TestUTF8( pSourceLine, bFixTags );
- sal_uLong i;
- for ( i = 0; i < Count(); i++ )
+ for ( size_t i = 0, n = maList.size(); i < n; ++i )
{
- aTester.CheckTestee( GetObject( i ), pSourceLine != NULL, bFixTags );
- if ( GetObject( i )->HasMessages() || aTester.HasCompareWarnings() )
+ GSILine* pItem = maList[ i ];
+ aTester.CheckTestee( pItem, pSourceLine != NULL, bFixTags );
+ if ( pItem->HasMessages() || aTester.HasCompareWarnings() )
{
- if ( GetObject( i )->HasMessages() || aTester.GetCompareWarnings().HasErrors() )
- GetObject( i )->NotOK();
+ if ( pItem->HasMessages() || aTester.GetCompareWarnings().HasErrors() )
+ pItem->NotOK();
bHasError = sal_True;
- PrintList( GetObject( i )->GetMessageList(), "Translation", GetObject( i ) );
- PrintList( &(aTester.GetCompareWarnings()), "Translation Tag Missmatch", GetObject( i ) );
+ PrintList( pItem->GetMessageList(), "Translation", pItem );
+ PrintList( &(aTester.GetCompareWarnings()), "Translation Tag Mismatch", pItem );
}
- bHasError |= !TestUTF8( GetObject( i ), bFixTags );
+ bHasError |= !TestUTF8( pItem, bFixTags );
if ( pSourceLine )
- bHasError |= HasSuspiciousChars( GetObject( i ), pSourceLine );
+ bHasError |= HasSuspiciousChars( pItem, pSourceLine );
}
return bHasError || bHasBlockError;
@@ -663,14 +661,14 @@ void GSIBlock::WriteError( LazySvFileStream &aErrOut, sal_Bool bRequireSourceLin
sal_Bool bHasError = sal_False;
sal_Bool bCopyAll = ( !pSourceLine && bRequireSourceLine ) || ( pSourceLine && !pSourceLine->IsOK() && !bCheckTranslationLang ) || bHasBlockError;
- sal_uLong i;
- for ( i = 0; i < Count(); i++ )
+ for ( size_t i = 0, n = maList.size(); i < n; ++i )
{
- if ( !GetObject( i )->IsOK() || bCopyAll )
+ GSILine* pItem = maList[ i ];
+ if ( !pItem->IsOK() || bCopyAll )
{
bHasError = sal_True;
aErrOut.LazyOpen();
- aErrOut.WriteLine( *GetObject( i ) );
+ aErrOut.WriteLine( *pItem );
}
}
@@ -687,18 +685,18 @@ void GSIBlock::WriteCorrect( LazySvFileStream &aOkOut, sal_Bool bRequireSourceLi
return;
sal_Bool bHasOK = sal_False;
- sal_uLong i;
- for ( i = 0; i < Count(); i++ )
+ for ( size_t i = 0, n = maList.size(); i < n; ++i )
{
- if ( ( GetObject( i )->IsOK() || bCheckSourceLang ) && !bHasBlockError )
+ GSILine* pItem = maList[ i ];
+ if ( ( pItem->IsOK() || bCheckSourceLang ) && !bHasBlockError )
{
bHasOK = sal_True;
aOkOut.LazyOpen();
- aOkOut.WriteLine( *GetObject( i ) );
+ aOkOut.WriteLine( *pItem );
}
}
- if ( ( pSourceLine && pSourceLine->IsOK() && ( Count() || !bCheckTranslationLang ) ) || ( bHasOK && bCheckTranslationLang ) )
+ if ( ( pSourceLine && pSourceLine->IsOK() && ( !maList.empty() || !bCheckTranslationLang ) ) || ( bHasOK && bCheckTranslationLang ) )
{
aOkOut.LazyOpen();
aOkOut.WriteLine( *pSourceLine );
@@ -711,14 +709,14 @@ void GSIBlock::WriteFixed( LazySvFileStream &aFixOut, sal_Bool /*bRequireSourceL
return;
sal_Bool bHasFixes = sal_False;
- sal_uLong i;
- for ( i = 0; i < Count(); i++ )
+ for ( size_t i = 0, n = maList.size(); i < n; ++i )
{
- if ( GetObject( i )->IsFixed() )
+ GSILine* pItem = maList[ i ];
+ if ( pItem->IsFixed() )
{
bHasFixes = sal_True;
aFixOut.LazyOpen();
- aFixOut.WriteLine( *GetObject( i ) );
+ aFixOut.WriteLine( *pItem );
}
}
@@ -777,7 +775,7 @@ void Help()
}
/*****************************************************************************/
-#if defined(UNX) || defined(OS2)
+#if defined(UNX)
int main( int argc, char *argv[] )
#else
int _cdecl main( int argc, char *argv[] )
@@ -1114,8 +1112,6 @@ int _cdecl main( int argc, char *argv[] )
}
else if ( pReferenceLine->GetUniqId() > aId )
{
-// if ( pGSILine->GetLanguageId() == aSourceLang )
-// PrintError( "No reference line found. Entry is new in source file", "File format", "", bPrintContext, pGSILine->GetLineNumber(), aId );
bContinueSearching = sal_False;
}
else
@@ -1172,3 +1168,5 @@ int _cdecl main( int argc, char *argv[] )
else
return 0;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/source/gsiconv.cxx b/l10ntools/source/gsiconv.cxx
deleted file mode 100644
index 5e332ac945a0..000000000000
--- a/l10ntools/source/gsiconv.cxx
+++ /dev/null
@@ -1,369 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_l10ntools.hxx"
-#include <stdio.h>
-#include <tools/fsys.hxx>
-#include <tools/stream.hxx>
-
-// local includes
-#include "utf8conv.hxx"
-
-#define GSI_FILE_UNKNOWN 0x0000
-#define GSI_FILE_OLDSTYLE 0x0001
-#define GSI_FILE_L10NFRAMEWORK 0x0002
-
-/*****************************************************************************/
-sal_uInt16 GetGSIFileType( SvStream &rStream )
-/*****************************************************************************/
-{
- sal_uInt16 nFileType = GSI_FILE_UNKNOWN;
-
- sal_uLong nPos( rStream.Tell());
- rStream.Seek( STREAM_SEEK_TO_BEGIN );
-
- ByteString sLine;
- while( !rStream.IsEof() && !sLine.Len())
- rStream.ReadLine( sLine );
-
- if( sLine.Len()) {
- if( sLine.Search( "($$)" ) != STRING_NOTFOUND )
- nFileType = GSI_FILE_OLDSTYLE;
- else
- nFileType = GSI_FILE_L10NFRAMEWORK;
- }
-
- rStream.Seek( nPos );
-
- return nFileType;
-}
-
-/*****************************************************************************/
-ByteString GetGSILineId( const ByteString &rLine, sal_uInt16 nFileType )
-/*****************************************************************************/
-{
- ByteString sId;
- switch ( nFileType ) {
- case GSI_FILE_OLDSTYLE:
- sId = rLine;
- sId.SearchAndReplaceAll( "($$)", "\t" );
- sId = sId.GetToken( 0, '\t' );
- break;
-
- case GSI_FILE_L10NFRAMEWORK:
- sId = rLine.GetToken( 0, '\t' );
- sId += "\t";
- sId += rLine.GetToken( 1, '\t' );
- sId += "\t";
- sId += rLine.GetToken( 4, '\t' );
- sId += "\t";
- sId += rLine.GetToken( 5, '\t' );
- break;
- }
- return sId;
-}
-
-/*****************************************************************************/
-ByteString GetGSILineLangId( const ByteString &rLine, sal_uInt16 nFileType )
-/*****************************************************************************/
-{
- ByteString sLangId;
- switch ( nFileType ) {
- case GSI_FILE_OLDSTYLE:
- sLangId = rLine;
- sLangId.SearchAndReplaceAll( "($$)", "\t" );
- sLangId = sLangId.GetToken( 2, '\t' );
- break;
-
- case GSI_FILE_L10NFRAMEWORK:
- sLangId = rLine.GetToken( 9, '\t' );
- break;
- }
- return sLangId;
-}
-
-/*****************************************************************************/
-void ConvertGSILine( sal_Bool bToUTF8, ByteString &rLine,
- rtl_TextEncoding nEncoding, sal_uInt16 nFileType )
-/*****************************************************************************/
-{
- switch ( nFileType ) {
- case GSI_FILE_OLDSTYLE:
- if ( bToUTF8 )
- rLine = UTF8Converter::ConvertToUTF8( rLine, nEncoding );
- else
- rLine = UTF8Converter::ConvertFromUTF8( rLine, nEncoding );
- break;
-
- case GSI_FILE_L10NFRAMEWORK: {
- ByteString sConverted;
- for ( sal_uInt16 i = 0; i < rLine.GetTokenCount( '\t' ); i++ ) {
- ByteString sToken = rLine.GetToken( i, '\t' );
- if (( i > 9 ) && ( i < 14 )) {
- if( bToUTF8 )
- sToken = UTF8Converter::ConvertToUTF8( sToken, nEncoding );
- else
- sToken = UTF8Converter::ConvertFromUTF8( sToken, nEncoding );
- }
- if ( i )
- sConverted += "\t";
- sConverted += sToken;
- }
- rLine = sConverted;
- }
- break;
- }
-}
-
-/*****************************************************************************/
-void Help()
-/*****************************************************************************/
-{
- fprintf( stdout, "\n" );
- fprintf( stdout, "gsiconv (c)1999 by StarOffice Entwicklungs GmbH\n" );
- fprintf( stdout, "===============================================\n" );
- fprintf( stdout, "\n" );
- fprintf( stdout, "gsiconv converts strings in GSI-Files (Gutschmitt Interface) from or to UTF-8\n" );
- fprintf( stdout, "\n" );
- fprintf( stdout, "Syntax: gsiconv (-t|-f langid charset)|(-p n) filename\n" );
- fprintf( stdout, "Switches: -t => conversion from charset to UTF-8\n" );
- fprintf( stdout, " -f => conversion from UTF-8 to charset\n" );
- fprintf( stdout, " -p n => creates several files with ca. n lines\n" );
- fprintf( stdout, "\n" );
- fprintf( stdout, "Allowed charsets:\n" );
- fprintf( stdout, " MS_932 => Japanese\n" );
- fprintf( stdout, " MS_936 => Chinese Simplified\n" );
- fprintf( stdout, " MS_949 => Korean\n" );
- fprintf( stdout, " MS_950 => Chinese Traditional\n" );
- fprintf( stdout, " MS_1250 => East Europe\n" );
- fprintf( stdout, " MS_1251 => Cyrillic\n" );
- fprintf( stdout, " MS_1252 => West Europe\n" );
- fprintf( stdout, " MS_1253 => Greek\n" );
- fprintf( stdout, " MS_1254 => Turkish\n" );
- fprintf( stdout, " MS_1255 => Hebrew\n" );
- fprintf( stdout, " MS_1256 => Arabic\n" );
- fprintf( stdout, "\n" );
- fprintf( stdout, "Allowed langids:\n" );
- fprintf( stdout, " 1 => ENGLISH_US\n" );
- fprintf( stdout, " 3 => PORTUGUESE \n" );
- fprintf( stdout, " 4 => GERMAN_DE (new german style)\n" );
- fprintf( stdout, " 7 => RUSSIAN\n" );
- fprintf( stdout, " 30 => GREEK\n" );
- fprintf( stdout, " 31 => DUTCH\n" );
- fprintf( stdout, " 33 => FRENCH\n" );
- fprintf( stdout, " 34 => SPANISH\n" );
- fprintf( stdout, " 35 => FINNISH\n" );
- fprintf( stdout, " 36 => HUNGARIAN\n" );
- fprintf( stdout, " 39 => ITALIAN\n" );
- fprintf( stdout, " 42 => CZECH\n" );
- fprintf( stdout, " 44 => ENGLISH (UK)\n" );
- fprintf( stdout, " 45 => DANISH\n" );
- fprintf( stdout, " 46 => SWEDISH\n" );
- fprintf( stdout, " 47 => NORWEGIAN\n" );
- fprintf( stdout, " 49 => GERMAN (old german style)\n" );
- fprintf( stdout, " 55 => PORTUGUESE_BRAZILIAN\n" );
- fprintf( stdout, " 81 => JAPANESE\n" );
- fprintf( stdout, " 82 => KOREAN\n" );
- fprintf( stdout, " 86 => CHINESE_SIMPLIFIED\n" );
- fprintf( stdout, " 88 => CHINESE_TRADITIONAL\n" );
- fprintf( stdout, " 90 => TURKISH\n" );
- fprintf( stdout, " 96 => ARABIC\n" );
- fprintf( stdout, " 97 => HEBREW\n" );
- fprintf( stdout, "\n" );
-}
-
-/*****************************************************************************/
-#if defined(UNX) || defined(OS2)
-int main( int argc, char *argv[] )
-#else
-int _cdecl main( int argc, char *argv[] )
-#endif
-/*****************************************************************************/
-{
- if (( argc != 5 ) && ( argc != 4 )) {
- Help();
- exit ( 0 );
- }
-
- if ( argc == 4 ) {
- if ( ByteString( argv[ 1 ] ) == "-p" ) {
-
- DirEntry aSource = DirEntry( String( argv[ 3 ], RTL_TEXTENCODING_ASCII_US ));
- if ( !aSource.Exists()) {
- fprintf( stderr, "\nERROR: GSI-File %s not found!\n\n", ByteString( argv[ 3 ] ).GetBuffer());
- exit ( 2 );
- }
-
- DirEntry aOutput( aSource );
-
- String sBase = aOutput.GetBase();
- String sExt = aOutput.GetExtension();
-
- String sGSI( argv[ 3 ], RTL_TEXTENCODING_ASCII_US );
- SvFileStream aGSI( sGSI, STREAM_STD_READ );
- if ( !aGSI.IsOpen()) {
- fprintf( stderr, "\nERROR: Could not open GSI-File %s!\n\n", ByteString( argv[ 3 ] ).GetBuffer());
- exit ( 3 );
- }
-
- sal_uInt16 nFileType( GetGSIFileType( aGSI ));
-
- sal_uLong nMaxLines = (sal_uLong) ByteString( argv[ 2 ] ).ToInt64();
- if ( !nMaxLines ) {
- fprintf( stderr, "\nERROR: Linecount must be at least 1!\n\n" );
- exit ( 3 );
- }
-
- ByteString sGSILine;
- ByteString sOldId;
- sal_uLong nLine = 0;
- sal_uLong nOutputFile = 1;
-
- String sOutput( sBase );
- sOutput += String( "_", RTL_TEXTENCODING_ASCII_US );
- sOutput += String::CreateFromInt64( nOutputFile );
- if ( sExt.Len()) {
- sOutput += String( ".", RTL_TEXTENCODING_ASCII_US );
- sOutput += sExt;
- }
- nOutputFile ++;
-
- aOutput.SetName( sOutput );
- SvFileStream aOutputStream( aOutput.GetFull(), STREAM_STD_WRITE | STREAM_TRUNC );
-
- while ( !aGSI.IsEof()) {
-
- aGSI.ReadLine( sGSILine );
- ByteString sId( GetGSILineId( sGSILine, nFileType ));
-
- nLine++;
-
- if (( nLine >= nMaxLines ) && ( sId != sOldId )) {
- aOutputStream.Close();
-
- ByteString sText( aOutput.GetFull(), gsl_getSystemTextEncoding());
- sText += " with ";
- sText += ByteString::CreateFromInt64( nLine );
- sText += " lines written.";
-
- fprintf( stdout, "%s\n", sText.GetBuffer());
- String sOutput1( sBase );
- sOutput1 += String( "_", RTL_TEXTENCODING_ASCII_US );
- sOutput1 += String::CreateFromInt64( nOutputFile );
- if ( sExt.Len()) {
- sOutput1 += String( ".", RTL_TEXTENCODING_ASCII_US );
- sOutput1 += sExt;
- }
- nOutputFile ++;
-
- aOutput.SetName( sOutput1 );
-
- aOutputStream.Open( aOutput.GetFull(), STREAM_STD_WRITE | STREAM_TRUNC );
- nLine = 0;
- }
-
- aOutputStream.WriteLine( sGSILine );
-
- sOldId = sId;
- }
-
- aGSI.Close();
- aOutputStream.Close();
-
- ByteString sText( aOutput.GetFull(), RTL_TEXTENCODING_ASCII_US );
- sText += " with ";
- sText += ByteString::CreateFromInt64( nLine );
- sText += " lines written.";
- }
- else {
- Help();
- exit( 1 );
- }
- }
- else {
- if ( ByteString( argv[ 1 ] ) == "-t" || ByteString( argv[ 1 ] ) == "-f" ) {
- rtl_TextEncoding nEncoding;
-
- ByteString sCurLangId( argv[ 2 ] );
-
- ByteString sCharset( argv[ 3 ] );
- sCharset.ToUpperAscii();
-
- if ( sCharset == "MS_932" ) nEncoding = RTL_TEXTENCODING_MS_932;
- else if ( sCharset == "MS_936" ) nEncoding = RTL_TEXTENCODING_MS_936;
- else if ( sCharset == "MS_949" ) nEncoding = RTL_TEXTENCODING_MS_949;
- else if ( sCharset == "MS_950" ) nEncoding = RTL_TEXTENCODING_MS_950;
- else if ( sCharset == "MS_1250" ) nEncoding = RTL_TEXTENCODING_MS_1250;
- else if ( sCharset == "MS_1251" ) nEncoding = RTL_TEXTENCODING_MS_1251;
- else if ( sCharset == "MS_1252" ) nEncoding = RTL_TEXTENCODING_MS_1252;
- else if ( sCharset == "MS_1253" ) nEncoding = RTL_TEXTENCODING_MS_1253;
- else if ( sCharset == "MS_1254" ) nEncoding = RTL_TEXTENCODING_MS_1254;
- else if ( sCharset == "MS_1255" ) nEncoding = RTL_TEXTENCODING_MS_1255;
- else if ( sCharset == "MS_1256" ) nEncoding = RTL_TEXTENCODING_MS_1256;
- else if ( sCharset == "MS_1257" ) nEncoding = RTL_TEXTENCODING_MS_1257;
- else if ( sCharset == "UTF8" ) nEncoding = RTL_TEXTENCODING_UTF8;
-
- else {
- Help();
- exit ( 1 );
- }
-
- DirEntry aSource = DirEntry( String( argv[ 4 ], RTL_TEXTENCODING_ASCII_US ));
- if ( !aSource.Exists()) {
- fprintf( stderr, "\nERROR: GSI-File %s not found!\n\n", ByteString( argv[ 3 ] ).GetBuffer());
- exit ( 2 );
- }
-
- String sGSI( argv[ 4 ], RTL_TEXTENCODING_ASCII_US );
- SvFileStream aGSI( sGSI, STREAM_STD_READ );
- if ( !aGSI.IsOpen()) {
- fprintf( stderr, "\nERROR: Could not open GSI-File %s!\n\n", ByteString( argv[ 3 ] ).GetBuffer());
- exit ( 3 );
- }
- sal_uInt16 nFileType( GetGSIFileType( aGSI ));
-
- ByteString sGSILine;
- while ( !aGSI.IsEof()) {
-
- aGSI.ReadLine( sGSILine );
- ByteString sLangId( GetGSILineLangId( sGSILine, nFileType ));
- if ( sLangId == sCurLangId )
- ConvertGSILine(( ByteString( argv[ 1 ] ) == "-t" ), sGSILine, nEncoding, nFileType );
-
- fprintf( stdout, "%s\n", sGSILine.GetBuffer());
- }
-
- aGSI.Close();
- }
- else {
- Help();
- exit( 1 );
- }
- }
- return 0;
-}
diff --git a/l10ntools/source/help/HelpCompiler.cxx b/l10ntools/source/help/HelpCompiler.cxx
index 79e41d37ea3f..df2093931126 100644
--- a/l10ntools/source/help/HelpCompiler.cxx
+++ b/l10ntools/source/help/HelpCompiler.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -34,10 +35,6 @@
#include <libxslt/xsltInternals.h>
#include <libxslt/transform.h>
#include <libxslt/xsltutils.h>
-#ifdef __MINGW32__
-#include <tools/prewin.h>
-#include <tools/postwin.h>
-#endif
#include <osl/thread.hxx>
static void impl_sleep( sal_uInt32 nSec )
@@ -467,7 +464,7 @@ bool HelpCompiler::compile( void ) throw( HelpProcessingException )
streamTable.default_helptexts = aparser.helptexts;
streamTable.default_keywords = aparser.keywords;
}
- else if (modulename == module)
+ else
{
streamTable.dropappl();
streamTable.appl_doc = docResolvedDoc;
@@ -475,14 +472,6 @@ bool HelpCompiler::compile( void ) throw( HelpProcessingException )
streamTable.appl_helptexts = aparser.helptexts;
streamTable.appl_keywords = aparser.keywords;
}
- else
- {
- std::stringstream aStrStream;
- aStrStream << "ERROR: Found unexpected module name \"" << modulename
- << "\" in file" << src.native_file_string().c_str() << std::endl;
- throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() );
- }
-
} // end iteration over all applications
streamTable.document_id = documentId;
@@ -566,7 +555,7 @@ namespace fs
rtl::OUString suFilename = aStatus.getFileName();
rtl::OUString suFullFileURL;
suFullFileURL += _suDirURL;
- suFullFileURL += rtl::OUString::createFromAscii("/");
+ suFullFileURL += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/"));
suFullFileURL += suFilename;
if (aStatus.getFileType() == osl::FileStatus::Directory)
@@ -587,4 +576,4 @@ namespace fs
}
}
-/* vi:set tabstop=4 shiftwidth=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/source/help/HelpCompiler.hxx b/l10ntools/source/help/HelpCompiler.hxx
index 8ce6098d21a9..016f7eefb8bc 100755..100644
--- a/l10ntools/source/help/HelpCompiler.hxx
+++ b/l10ntools/source/help/HelpCompiler.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -29,7 +30,7 @@
#define HELPCOMPILER_HXX
#include <string>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <vector>
#include <list>
#include <fstream>
@@ -37,8 +38,8 @@
#include <sstream>
#include <algorithm>
#include <ctype.h>
-#ifdef SYSTEM_DB
-#include <db.h>
+#ifdef SYSTEM_DB_HEADER
+#include SYSTEM_DB_HEADER
#else
#include <berkeleydb/db.h>
#endif
@@ -222,11 +223,11 @@ struct SuperFastHash
#define pref_hash joaat_hash
-typedef std::hash_map<std::string, std::string, pref_hash> Stringtable;
+typedef boost::unordered_map<std::string, std::string, pref_hash> Stringtable;
typedef std::list<std::string> LinkedList;
typedef std::vector<std::string> HashSet;
-typedef std::hash_map<std::string, LinkedList, pref_hash> Hashtable;
+typedef boost::unordered_map<std::string, LinkedList, pref_hash> Hashtable;
class StreamTable
{
@@ -281,6 +282,7 @@ struct HelpProcessingException
HelpProcessingException( HelpProcessingErrorClass eErrorClass, const std::string& aErrorMsg )
: m_eErrorClass( eErrorClass )
, m_aErrorMsg( aErrorMsg )
+ , m_nXMLParsingLine( 0 )
{}
HelpProcessingException( const std::string& aErrorMsg, const std::string& aXMLParsingFile, int nXMLParsingLine )
: m_eErrorClass( HELPPROCESSING_XMLPARSING_ERROR )
@@ -322,4 +324,4 @@ private:
#endif
-/* vi:set tabstop=4 shiftwidth=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/source/help/HelpLinker.cxx b/l10ntools/source/help/HelpLinker.cxx
index 036208520ede..81a96ce37899 100755..100644
--- a/l10ntools/source/help/HelpLinker.cxx
+++ b/l10ntools/source/help/HelpLinker.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -25,6 +26,10 @@
*
************************************************************************/
+#ifdef AIX
+# undef _THREAD_SAFE
+#endif
+
#include "HelpCompiler.hxx"
#include <map>
@@ -205,7 +210,7 @@ void writeKeyValue_DBHelp( FILE* pFile, const std::string& aKeyStr, const std::s
class HelpKeyword
{
private:
- typedef std::hash_map<std::string, Data, pref_hash> DataHashtable;
+ typedef boost::unordered_map<std::string, Data, pref_hash> DataHashtable;
DataHashtable _hash;
public:
@@ -298,18 +303,6 @@ private:
void addBookmark( DB* dbBase, FILE* pFile_DBHelp, std::string thishid,
const std::string& fileB, const std::string& anchorB,
const std::string& jarfileB, const std::string& titleB );
-#if 0
- /**
- * @param outputFile
- * @param module
- * @param lang
- * @param hid
- * @param helpFiles
- * @param additionalFiles
- */
-
- private HelpURLStreamHandlerFactory urlHandler = null;
-#endif
};
namespace URLEncoder
@@ -407,7 +400,6 @@ void HelpLinker::link() throw( HelpProcessingException )
if( bExtensionMode )
{
- //indexDirParentName = sourceRoot;
indexDirParentName = extensionDestination;
}
else
@@ -494,10 +486,8 @@ void HelpLinker::link() throw( HelpProcessingException )
if( !bExtensionMode )
{
-#ifndef OS2 // YD @TODO@ crashes libc runtime :-(
std::cout << "Making " << outputFile.native_file_string() <<
" from " << helpFiles.size() << " input files" << std::endl;
-#endif
}
// here we start our loop over the hzip files.
@@ -572,13 +562,6 @@ void HelpLinker::link() throw( HelpProcessingException )
if (documentTitle.empty())
documentTitle = "<notitle>";
-#if 0
- std::cout << "for " << xhpFileName << " documentBaseId is " << documentBaseId << "\n";
- std::cout << "for " << xhpFileName << " documentPath is " << documentPath << "\n";
- std::cout << "for " << xhpFileName << " documentJarfile is " << documentJarfile << "\n";
- std::cout << "for " << xhpFileName << " documentPath is " << documentTitle << "\n";
-#endif
-
const std::string& fileB = documentPath;
const std::string& jarfileB = documentJarfile;
std::string& titleB = documentTitle;
@@ -741,16 +724,6 @@ void HelpLinker::link() throw( HelpProcessingException )
fs::copy( fsAdditionalFileName, fsTargetName );
}
}
-
-/*
- /////////////////////////////////////////////////////////////////////////
- /// remove temprary directory for index creation
- /////////////////////////////////////////////////////////////////////////
-#ifndef CMC_DEBUG
- if( !bExtensionMode )
- fs::remove_all( indexDirParentName );
-#endif
-*/
}
@@ -986,8 +959,8 @@ void HelpLinker::main( std::vector<std::string> &args,
throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() );
}
- if (!bExtensionMode && idxCaptionStylesheet.empty()
- || !extsource.empty() && idxCaptionStylesheet.empty())
+ if ( (!bExtensionMode && idxCaptionStylesheet.empty())
+ || (!extsource.empty() && idxCaptionStylesheet.empty()) )
{
//No extension mode and extension mode using commandline
//!extsource.empty indicates extension mode using commandline
@@ -1001,7 +974,7 @@ void HelpLinker::main( std::vector<std::string> &args,
//This part is used when compileExtensionHelp is called from the extensions manager.
//If extension help is compiled using helplinker in the build process
rtl::OUString aIdxCaptionPathFileURL( *pOfficeHelpPath );
- aIdxCaptionPathFileURL += rtl::OUString::createFromAscii( "/idxcaption.xsl" );
+ aIdxCaptionPathFileURL += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/idxcaption.xsl"));
rtl::OString aOStr_IdxCaptionPathFileURL( rtl::OUStringToOString
( aIdxCaptionPathFileURL, fs::getThreadTextEncoding() ) );
@@ -1010,8 +983,8 @@ void HelpLinker::main( std::vector<std::string> &args,
idxCaptionStylesheet = fs::path( aStdStr_IdxCaptionPathFileURL );
}
- if (!bExtensionMode && idxContentStylesheet.empty()
- || !extsource.empty() && idxContentStylesheet.empty())
+ if ( (!bExtensionMode && idxContentStylesheet.empty())
+ || (!extsource.empty() && idxContentStylesheet.empty()) )
{
//No extension mode and extension mode using commandline
//!extsource.empty indicates extension mode using commandline
@@ -1026,7 +999,7 @@ void HelpLinker::main( std::vector<std::string> &args,
//then -idxcontent must be supplied
//This part is used when compileExtensionHelp is called from the extensions manager.
rtl::OUString aIdxContentPathFileURL( *pOfficeHelpPath );
- aIdxContentPathFileURL += rtl::OUString::createFromAscii( "/idxcontent.xsl" );
+ aIdxContentPathFileURL += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/idxcontent.xsl"));
rtl::OString aOStr_IdxContentPathFileURL( rtl::OUStringToOString
( aIdxContentPathFileURL, fs::getThreadTextEncoding() ) );
@@ -1085,9 +1058,7 @@ int main(int argc, char**argv)
exit(1);
}
sal_uInt32 endtime = osl_getGlobalTimer();
-#ifndef OS2 // YD @TODO@ crashes libc runtime :-(
std::cout << "time taken was " << (endtime-starttime)/1000.0 << " seconds" << std::endl;
-#endif
return 0;
}
@@ -1184,18 +1155,18 @@ HELPLINKER_DLLPUBLIC bool compileExtensionHelp
// i83624: Tree files
::rtl::OUString aTreeFileURL = aExtensionLanguageRoot;
- aTreeFileURL += rtl::OUString::createFromAscii( "/help.tree" );
+ aTreeFileURL += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/help.tree"));
osl::DirectoryItem aTreeFileItem;
osl::FileBase::RC rcGet = osl::DirectoryItem::get( aTreeFileURL, aTreeFileItem );
- osl::FileStatus aFileStatus( FileStatusMask_FileSize );
+ osl::FileStatus aFileStatus( osl_FileStatus_Mask_FileSize );
if( rcGet == osl::FileBase::E_None &&
aTreeFileItem.getFileStatus( aFileStatus ) == osl::FileBase::E_None &&
- aFileStatus.isValid( FileStatusMask_FileSize ) )
+ aFileStatus.isValid( osl_FileStatus_Mask_FileSize ) )
{
sal_uInt64 ret, len = aFileStatus.getFileSize();
char* s = new char[ int(len) ]; // the buffer to hold the installed files
osl::File aFile( aTreeFileURL );
- aFile.open( OpenFlag_Read );
+ aFile.open( osl_File_OpenFlag_Read );
aFile.read( s, len, ret );
aFile.close();
@@ -1219,3 +1190,4 @@ HELPLINKER_DLLPUBLIC bool compileExtensionHelp
return bSuccess;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/source/help/compilehelp.hxx b/l10ntools/source/help/compilehelp.hxx
index 9c59083bf038..b81ddfbdadf2 100644
--- a/l10ntools/source/help/compilehelp.hxx
+++ b/l10ntools/source/help/compilehelp.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -37,8 +38,6 @@
#endif
#define HELPLINKER_DLLPRIVATE SAL_DLLPRIVATE
-
-//#include <helplinkerdllapi.h>
#include <rtl/ustring.hxx>
enum HelpProcessingErrorClass
@@ -77,3 +76,5 @@ HELPLINKER_DLLPUBLIC bool compileExtensionHelp
);
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/source/help/makefile.mk b/l10ntools/source/help/makefile.mk
index b66077501a8d..3fd6879a9989 100644
--- a/l10ntools/source/help/makefile.mk
+++ b/l10ntools/source/help/makefile.mk
@@ -44,9 +44,7 @@ LIBXSLTINCDIR=external$/libxslt
CFLAGS+= -I$(SOLARINCDIR)$/$(LIBXSLTINCDIR)
.ENDIF
-.IF "$(SYSTEM_DB)" == "YES"
-CFLAGS+=-DSYSTEM_DB -I$(DB_INCLUDES)
-.ENDIF
+CFLAGS+= $(SYSTEM_DB_CFLAGS)
.IF "$(SYSTEM_EXPAT)" == "YES"
CFLAGS+=-DSYSTEM_EXPAT
diff --git a/l10ntools/source/helpex.cxx b/l10ntools/source/helpex.cxx
index 0055c233a434..e67f9793b899 100644
--- a/l10ntools/source/helpex.cxx
+++ b/l10ntools/source/helpex.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -145,7 +146,6 @@ sal_Bool ParseCommandLine( int argc, char* argv[])
break;
case STATE_PRJ: {
sPrj = argv[ i ];
-// sPrj.ToLowerAscii(); // the project
}
break;
case STATE_ROOT: {
@@ -201,7 +201,7 @@ void Help()
/*****************************************************************************/
#ifndef TESTDRIVER
-#if defined(UNX) || defined(OS2)
+#if defined(UNX)
int main( int argc, char *argv[] )
#else
int _cdecl main( int argc, char *argv[] )
@@ -288,3 +288,5 @@ int _cdecl main( int argc, char *argv[] )
return 1;
}
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/source/helpmerge.cxx b/l10ntools/source/helpmerge.cxx
index 58f8af7d3446..9203fd94b5e7 100644
--- a/l10ntools/source/helpmerge.cxx
+++ b/l10ntools/source/helpmerge.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -33,7 +34,6 @@
#include <stdio.h>
#include <stdlib.h>
#include "helpmerge.hxx"
-#include "utf8conv.hxx"
#include <algorithm>
#include <sys/types.h>
#include <sys/stat.h>
@@ -42,11 +42,9 @@
#include <vector>
#include "rtl/strbuf.hxx"
#ifdef WNT
-#include <direct.h>
-//#include <WinBase.h>
-#include "tools/prewin.h"
#include <windows.h>
-#include "tools/postwin.h"
+#undef CopyFile
+#include <direct.h>
#endif
/*****************************************************************************/
@@ -59,7 +57,7 @@ void HelpParser::FillInFallbacks( LangHashMap& rElem_out, ByteString sLangIdx_in
XMLElement* pTmp2 = NULL;
sCur = sLangIdx_in;
- ByteString sFallback( sCur );
+ rtl::OString sFallback( sCur );
GetIsoFallback( sFallback );
if( (rElem_out.find( sFallback ) != rElem_out.end()) && rElem_out[ sFallback ] != NULL ){
pTmp2 = rElem_out[ sFallback ];
@@ -165,7 +163,6 @@ bool HelpParser::CreateSDF(
if(file.get() == NULL){
printf("%s\n",ByteString(aParser.GetError().sMessage,RTL_TEXTENCODING_ASCII_US).GetBuffer());
exit(-1);
- //return false;
}
file->Extract();
if( !file->CheckExportStatus() ){
@@ -185,8 +182,6 @@ bool HelpParser::CreateSDF(
LangHashMap* pElem;
XMLElement* pXMLElement = NULL;
- //Dump(aXMLStrHM);
-
ByteString sTimeStamp( Export::GetTimeStamp() );
OUString sOUTimeStamp( sTimeStamp.GetBuffer() , sTimeStamp.Len() , RTL_TEXTENCODING_ASCII_US );
@@ -244,16 +239,12 @@ bool HelpParser::CreateSDF(
sBuffer.append( GSI_SEQUENCE4 ); //"\t\t\t\t";
sBuffer.append( sOUTimeStamp );
ByteString sOut( sBuffer.makeStringAndClear().getStr() , RTL_TEXTENCODING_UTF8 );
- //if( !sCur.EqualsIgnoreCaseAscii("de") ||( sCur.EqualsIgnoreCaseAscii("de") && !Export::isMergingGermanAllowed( rPrj_in ) ) )
- //{
if( data.getLength() > 0 ) aSDFStream.WriteLine( sOut );
- //}
pXMLElement=NULL;
}else fprintf(stdout,"\nDBG: NullPointer in HelpParser::CreateSDF , Language %s\n",sCur.GetBuffer() );
}
}
- //Dump(aXMLStrHM);
aSDFStream.Close();
if( !sUsedTempFile.EqualsIgnoreCaseAscii( "" ) ){
@@ -398,7 +389,6 @@ bool HelpParser::Merge(
{
printf("%s\n",ByteString(aParser.GetError().sMessage,RTL_TEXTENCODING_UTF8).GetBuffer());
exit(-1);
- //return false;
}
@@ -479,7 +469,7 @@ bool HelpParser::MergeSingleFile( XMLFile* file , MergeDataFile& aMergeDataFile
if( !Export::CopyFile( sTempFile , sTempFileCopy ) )
{
-#if defined(UNX) || defined(OS2)
+#if defined(UNX)
sleep( 3 );
#else
Sleep( 3 );
@@ -490,7 +480,6 @@ bool HelpParser::MergeSingleFile( XMLFile* file , MergeDataFile& aMergeDataFile
return false;
}
}
- //remove( sTargetFile.GetBuffer() );
FileStat aFSTest( aTar );
if( aFSTest.GetSize() < 1 )
@@ -498,7 +487,7 @@ bool HelpParser::MergeSingleFile( XMLFile* file , MergeDataFile& aMergeDataFile
remove( sTargetFile.GetBuffer() );
}
int rc;
-#if defined(UNX) || defined(OS2)
+#if defined(UNX)
rc = rename( sTempFile.GetBuffer() , sTargetFile.GetBuffer() );
#else
rc = MoveFileEx( sTempFile.GetBuffer() , sTargetFile.GetBuffer(), MOVEFILE_REPLACE_EXISTING );
@@ -514,7 +503,7 @@ bool HelpParser::MergeSingleFile( XMLFile* file , MergeDataFile& aMergeDataFile
// if( aFS.GetSize() < 1 )
//#endif
{
-#if defined(UNX) || defined(OS2)
+#if defined(UNX)
sleep( 3 );
#else
Sleep( 3 );
@@ -524,7 +513,7 @@ bool HelpParser::MergeSingleFile( XMLFile* file , MergeDataFile& aMergeDataFile
{
remove( sTargetFile.GetBuffer() );
}
-#if defined(UNX) || defined(OS2)
+#if defined(UNX)
rc = rename( sTempFileCopy.GetBuffer() , sTargetFile.GetBuffer() );
#else
rc = MoveFileEx( sTempFileCopy.GetBuffer() , sTargetFile.GetBuffer() , MOVEFILE_REPLACE_EXISTING );
@@ -595,7 +584,6 @@ void HelpParser::ProcessHelp( LangHashMap* aLangHM , const ByteString& sCur , Re
XMLElement* pXMLElement = NULL;
PFormEntrys *pEntrys = NULL;
XMLData *data = NULL;
- XMLParentNode *parent = NULL;
String sNewdata;
ByteString sLId;
@@ -615,7 +603,6 @@ void HelpParser::ProcessHelp( LangHashMap* aLangHM , const ByteString& sCur , Re
}
if( pXMLElement != NULL )
{
- parent = pXMLElement->GetParent();
sLId = pXMLElement->GetOldref();
pResData->sId = sLId;
@@ -714,3 +701,4 @@ void HelpParser::Process( LangHashMap* aLangHM , const ByteString& sCur , ResDat
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/source/inireader.cxx b/l10ntools/source/inireader.cxx
deleted file mode 100644
index 63f902a5a1da..000000000000
--- a/l10ntools/source/inireader.cxx
+++ /dev/null
@@ -1,132 +0,0 @@
-#include <unicode/regex.h>
-#include <unicode/unistr.h>
-#include <string>
-#include <fstream>
-#include <iostream>
-#include "inireader.hxx"
-
-using namespace std;
-namespace transex3
-{
-
-bool INIreader::read( INImap& myMap , string& filename )
-{
- ifstream aFStream( filename.c_str() );
- if( aFStream && aFStream.is_open())
- {
- string line;
- string section;
- string param_key;
- string param_value;
- stringmap* myvalues = 0;
-
- while( std::getline( aFStream , line ) )
- {
- trim( line );
- if( line.empty() ){
- }
- else if( is_section( line , section ) )
- {
- //cerr << "[" << section << "]\n";
- myvalues = new stringmap();
- myMap[ section ] = myvalues ;
- }
- else if ( is_parameter( line , param_key , param_value ) )
- {
- //cerr << "" << param_key << " = " << param_value << "\n";
- if( myvalues )
- {
- (*myvalues)[ param_key ] = param_value ;
- }
- else
- {
- cerr << "ERROR: The INI file " << filename << " appears to be broken ... parameters without a section?!?\n";
- if( aFStream.is_open() ) aFStream.close();
- return false;
- }
- }
- }
-
- if( aFStream.is_open() )
- aFStream.close();
-
- return true;
- }
- else
- {
- cerr << "ERROR: Can't open file '" << filename << "'\n";
- }
- return false;
-}
-
-bool INIreader::is_section( string& line , string& section_str )
-{
- // Error in regex ?
- check_status( section_status );
- UnicodeString target( line.c_str() , line.length() );
-
- section_match->reset( target );
- check_status( section_status );
-
- if( section_match->find() )
- {
- check_status( section_status );
- UnicodeString result( section_match->group( 1 , section_status) );
- check_status( section_status );
- toStlString( result , section_str );
-
- return true;
- }
- return false;
-}
-
-bool INIreader::is_parameter( string& line , string& parameter_key , string& parameter_value )
-{
- // Error in regex ?
- check_status( parameter_status );
- UnicodeString target( line.c_str() , line.length() );
-
- parameter_match->reset( target );
- check_status( parameter_status );
-
- if( parameter_match->find() )
- {
- check_status( parameter_status );
-
- UnicodeString result1( parameter_match->group( 1 , parameter_status) );
- check_status( parameter_status );
- toStlString( result1 , parameter_key );
- UnicodeString result2( parameter_match->group( 2 , parameter_status) );
- check_status( parameter_status );
- toStlString( result2 , parameter_value );
-
- return true;
- }
- return false;
-}
-
-void INIreader::check_status( UErrorCode status )
-{
- if( U_FAILURE( status) )
- {
- cerr << "Error in or while using regex: " << u_errorName( status ) << "\n";
- exit(-1);
- }
-}
-
-void INIreader::toStlString( const UnicodeString& str , string& stl_str)
-{
- // convert to string
- char* buffer = new char[ str.length()*3 ];
- str.extract( 0 , str.length() , buffer );
- stl_str = string( buffer );
- delete [] buffer;
-}
-
-void INIreader::trim( string& str )
-{
- string str1 = str.substr( 0 , str.find_last_not_of(' ') + 1 );
- str = str1.empty() ? str1 : str1.substr( str1.find_first_not_of(' ') );
-}
-
-}
diff --git a/l10ntools/source/lngex.cxx b/l10ntools/source/lngex.cxx
index 119a6009d8b1..f9c286f43b25 100644
--- a/l10ntools/source/lngex.cxx
+++ b/l10ntools/source/lngex.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -101,14 +102,6 @@ sal_Bool ParseCommandLine( int argc, char* argv[])
nState = STATE_UTF8;
bUTF8 = sal_True;
}
-/* else if ( sSwitch == "-NOUTF8" ) {
- nState = STATE_UTF8;
- bUTF8 = sal_False;
- }*/
-/* else if ( sSwitch == "-ULF" ) {
- nState = STATE_ULF;
- bULF = sal_True;
- }*/
else if ( sSwitch == "-L" ) {
nState = STATE_LANGUAGES;
}
@@ -129,7 +122,6 @@ sal_Bool ParseCommandLine( int argc, char* argv[])
break;
case STATE_PRJ: {
sPrj = argv[ i ];
-// sPrj.ToLowerAscii(); // the project
}
break;
case STATE_ROOT: {
@@ -179,7 +171,7 @@ void Help()
}
/*****************************************************************************/
-#if defined(UNX) || defined(OS2)
+#if defined(UNX)
int main( int argc, char *argv[] )
#else
int _cdecl main( int argc, char *argv[] )
@@ -203,3 +195,5 @@ int _cdecl main( int argc, char *argv[] )
return 0;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/source/lngmerge.cxx b/l10ntools/source/lngmerge.cxx
index f63469cff75b..e89640015773 100644
--- a/l10ntools/source/lngmerge.cxx
+++ b/l10ntools/source/lngmerge.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -31,7 +32,6 @@
// local includes
#include "lngmerge.hxx"
-#include "utf8conv.hxx"
#include <iostream>
using namespace std;
//
@@ -47,7 +47,7 @@ LngParser::LngParser( const ByteString &rLngFile, sal_Bool bUTF8, sal_Bool bULFF
bDBIsUTF8( bUTF8 ),
bULF( bULFFormat )
{
- pLines = new LngLineList( 100, 100 );
+ pLines = new LngLineList();
DirEntry aEntry( String( sSource, RTL_TEXTENCODING_ASCII_US ));
if ( aEntry.Exists()) {
SvFileStream aStream( String( sSource, RTL_TEXTENCODING_ASCII_US ), STREAM_STD_READ );
@@ -62,7 +62,7 @@ LngParser::LngParser( const ByteString &rLngFile, sal_Bool bUTF8, sal_Bool bULFF
bFirstLine = false;
}
- pLines->Insert( new ByteString( sLine ), LIST_APPEND );
+ pLines->push_back( new ByteString( sLine ) );
}
}
else
@@ -76,8 +76,9 @@ LngParser::LngParser( const ByteString &rLngFile, sal_Bool bUTF8, sal_Bool bULFF
LngParser::~LngParser()
/*****************************************************************************/
{
- for ( sal_uLong i = 0; i < pLines->Count(); i++ )
- delete pLines->GetObject( i );
+ for ( size_t i = 0, n = pLines->size(); i < n; i++ )
+ delete (*pLines)[ i ];
+ pLines->clear();
delete pLines;
}
@@ -124,26 +125,25 @@ sal_Bool LngParser::CreateSDF(
sFullEntry.Copy( sPrjEntry.Len() + 1 ), gsl_getSystemTextEncoding());
sActFileName.SearchAndReplaceAll( "/", "\\" );
- sal_uLong nPos = 0;
+ size_t nPos = 0;
sal_Bool bStart = true;
ByteString sGroup;
- ByteStringHashMap Text;
+ ByteStringHashMap Text;
ByteString sID;
ByteString sLine;
- while( nPos < pLines->Count() ){
- sLine = *pLines->GetObject( nPos++ );
- while( nPos < pLines->Count() && !isNextGroup( sGroup , sLine ) ){
+ while( nPos < pLines->size() ) {
+ sLine = *(*pLines)[ nPos++ ];
+ while( nPos < pLines->size() && !isNextGroup( sGroup , sLine ) ) {
ReadLine( sLine , Text );
sID = sGroup;
- sLine = *pLines->GetObject( nPos++ );
+ sLine = *(*pLines)[ nPos++ ];
};
- if( bStart ){
+ if( bStart ) {
bStart = false;
sID = sGroup;
}
else {
-
WriteSDF( aSDFStream , Text , rPrj , rRoot , sActFileName , sID );
}
}
@@ -176,7 +176,6 @@ sal_Bool LngParser::CreateSDF(
sOutput += sCur; sOutput += "\t";
sOutput += sAct; sOutput += "\t\t\t\t";
sOutput += sTimeStamp;
- //if( !sCur.EqualsIgnoreCaseAscii("de") ||( sCur.EqualsIgnoreCaseAscii("de") && !Export::isMergingGermanAllowed( rPrj ) ) )
aSDFStream.WriteLine( sOutput );
}
}
@@ -194,7 +193,6 @@ sal_Bool LngParser::CreateSDF(
return false;
}
void LngParser::ReadLine( const ByteString &sLine_in , ByteStringHashMap &rText_inout){
- //printf("sLine -> '%s'\n",sLine_in.GetBuffer());
ByteString sLang = sLine_in.GetToken( 0, '=' );
sLang.EraseLeadingChars( ' ' );
sLang.EraseTrailingChars( ' ' );
@@ -217,7 +215,6 @@ sal_Bool LngParser::Merge(
nError = LNG_COULD_NOT_OPEN;
}
nError = LNG_OK;
-// MergeDataFile( const ByteString &rFileName, const ByteString& rFile , sal_Bool bErrLog, CharSet aCharSet, sal_Bool bUTF8 );
MergeDataFile aMergeDataFile( rSDFFile, sSource , sal_False, RTL_TEXTENCODING_MS_1252);//, bDBIsUTF8 );
ByteString sTmp( Export::sLanguages );
@@ -225,13 +222,13 @@ sal_Bool LngParser::Merge(
Export::SetLanguages( aMergeDataFile.GetLanguages() );
aLanguages = Export::GetLanguages();
- sal_uLong nPos = 0;
+ size_t nPos = 0;
sal_Bool bGroup = sal_False;
ByteString sGroup;
// seek to next group
- while ( nPos < pLines->Count() && !bGroup ) {
- ByteString sLine( *pLines->GetObject( nPos ));
+ while ( nPos < pLines->size() && !bGroup ) {
+ ByteString sLine( *(*pLines)[ nPos ] );
sLine.EraseLeadingChars( ' ' );
sLine.EraseTrailingChars( ' ' );
if (( sLine.GetChar( 0 ) == '[' ) &&
@@ -245,7 +242,7 @@ sal_Bool LngParser::Merge(
nPos ++;
}
- while ( nPos < pLines->Count()) {
+ while ( nPos < pLines->size()) {
ByteStringHashMap Text;
ByteString sID( sGroup );
sal_uLong nLastLangPos = 0;
@@ -258,8 +255,8 @@ sal_Bool LngParser::Merge(
ByteString sLanguagesDone;
- while ( nPos < pLines->Count() && !bGroup ) {
- ByteString sLine( *pLines->GetObject( nPos ));
+ while ( nPos < pLines->size() && !bGroup ) {
+ ByteString sLine( *(*pLines)[ nPos ] );
sLine.EraseLeadingChars( ' ' );
sLine.EraseTrailingChars( ' ' );
if (( sLine.GetChar( 0 ) == '[' ) &&
@@ -282,7 +279,9 @@ sal_Bool LngParser::Merge(
sSearch += ";";
if (( sLanguagesDone.Search( sSearch ) != STRING_NOTFOUND )) {
- pLines->Remove( nPos );
+ LngLineList::iterator it = pLines->begin();
+ ::std::advance( it, nPos );
+ pLines->erase( it );
}
if( bULF && pEntrys )
{
@@ -293,14 +292,13 @@ sal_Bool LngParser::Merge(
pEntrys->GetText( sNewText, STRING_TYP_TEXT, sLang, sal_True );
if ( sNewText.Len()) {
- ByteString *pLine = pLines->GetObject( nPos );
-
- ByteString sText1( sLang );
- sText1 += " = \"";
- sText1 += sNewText;
- sText1 += "\"";
- *pLine = sText1;
- //}
+ ByteString *pLine = (*pLines)[ nPos ];
+
+ ByteString sText1( sLang );
+ sText1 += " = \"";
+ sText1 += sNewText;
+ sText1 += "\"";
+ *pLine = sText1;
Text[ sLang ] = sNewText;
}
}
@@ -321,9 +319,7 @@ sal_Bool LngParser::Merge(
if ( nLastLangPos ) {
for( unsigned int n = 0; n < aLanguages.size(); n++ ){
sCur = aLanguages[ n ];
- if( //( !sCur.EqualsIgnoreCaseAscii("de") ||
- //( sCur.EqualsIgnoreCaseAscii("de") && Export::isMergingGermanAllowed( rPrj ) ) )
- !sCur.EqualsIgnoreCaseAscii("en-US") && !Text[ sCur ].Len() && pEntrys ){
+ if( !sCur.EqualsIgnoreCaseAscii("en-US") && !Text[ sCur ].Len() && pEntrys ) {
ByteString sNewText;
pEntrys->GetText( sNewText, STRING_TYP_TEXT, sCur, sal_True );
@@ -339,7 +335,13 @@ sal_Bool LngParser::Merge(
nLastLangPos++;
nPos++;
- pLines->Insert( new ByteString( sLine ), nLastLangPos );
+ if ( nLastLangPos < pLines->size() ) {
+ LngLineList::iterator it = pLines->begin();
+ ::std::advance( it, nLastLangPos );
+ pLines->insert( it, new ByteString( sLine ) );
+ } else {
+ pLines->push_back( new ByteString( sLine ) );
+ }
}
}
}
@@ -348,9 +350,11 @@ sal_Bool LngParser::Merge(
delete pResData;
}
- for ( sal_uLong i = 0; i < pLines->Count(); i++ )
- aDestination.WriteLine( *pLines->GetObject( i ));
+ for ( size_t i = 0; i < pLines->size(); i++ )
+ aDestination.WriteLine( *(*pLines)[ i ] );
aDestination.Close();
return sal_True;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/source/localize.cxx b/l10ntools/source/localize.cxx
index 276048659e3f..a0c3775b9ee7 100644
--- a/l10ntools/source/localize.cxx
+++ b/l10ntools/source/localize.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -30,7 +31,6 @@
#include "srciter.hxx"
#include "export.hxx"
-#include "treeconfig.hxx"
#include <string>
#include <vector>
#include <stdio.h>
@@ -43,6 +43,8 @@
#include <l10ntools/file.hxx>
#endif
+using namespace std;
+
namespace transex3
{
@@ -53,18 +55,12 @@ namespace transex3
const char *ExeTable[][5] = {
{ "src", "transex3", " -UTF8 -e", "negative", "noiso" },
{ "hrc", "transex3", " -UTF8 -e", "positive", "noiso" },
- { "tree", "xhtex", "", "negative", "noiso" },
- { "xtx", "xtxex", "", "negative", "noiso" },
{ "ulf", "ulfex", " -e", "negative", "noiso" },
- { "xrb", "xmlex", "-UTF8 -e", "negative", "iso" },
- { "xxl", "xmlex", "-UTF8 -e", "negative", "iso" },
- { "xgf", "xmlex", "-UTF8 -e -t:xgf", "negative", "iso" },
{ "xcd", "cfgex", "-UTF8 -e", "negative", "iso" },
{ "xcu", "cfgex", "-UTF8 -e", "negative", "iso" },
{ "xcs", "cfgex", "-UTF8 -e -f", "negative", "iso" },
{ "xrm", "xrmex", "-UTF8 -e", "negative", "iso" },
{ "xhp", "helpex", " -e", "negative", "noiso" },
- { "properties", "jpropex", " -e", "negative", "noiso" },
{ "NULL", "NULL", "NULL", "NULL", "NULL" }
};
@@ -117,6 +113,56 @@ const char *PositiveList[] = {
"NULL"
};
+const char *ModuleList[] = {
+ "accessibility",
+ "avmedia",
+ "basctl",
+ "basic",
+ "chart2",
+ "connectivity",
+ "crashrep",
+ "cui",
+ "dbaccess",
+ "desktop",
+ "editeng",
+ "extensions",
+ "filter",
+ "forms",
+ "formula",
+ "fpicker",
+ "framework",
+ "helpcontent2",
+ "instsetoo_native",
+ "mysqlc",
+ "officecfg",
+ "padmin",
+ "readlicense_oo",
+ "reportbuilder",
+ "reportdesign",
+ "sc",
+ "scaddins",
+ "sccomp",
+ "scp2",
+ "sd",
+ "sdext",
+ "setup_native",
+ "sfx2",
+ "shell",
+ "starmath",
+ "svl",
+ "svtools",
+ "svx",
+ "sw",
+ "swext",
+ "sysui",
+ "ucbhelper",
+ "uui",
+ "vcl",
+ "wizards",
+ "xmlsecurity",
+ "NULL",
+};
+
const char PRJ_DIR_NAME[] = "prj";
const char DLIST_NAME[] = "d.lst";
@@ -258,8 +304,16 @@ const ByteString SourceTreeLocalizer::GetProjectRootRel()
bool skipProject( ByteString sPrj )
{
- static const ByteString READLICENSE( "readlicense" );
- return sPrj.EqualsIgnoreCaseAscii( READLICENSE );
+ int nIndex = 0;
+ bool bReturn = true;
+ ByteString sModule( ModuleList[ nIndex ] );
+ while( !sModule.Equals( "NULL" ) && bReturn ) {
+ if( sPrj.Equals ( sModule ) )
+ bReturn = false;
+ nIndex++;
+ sModule = ModuleList[ nIndex ];
+ }
+ return bReturn;
}
/*****************************************************************************/
@@ -286,7 +340,7 @@ void SourceTreeLocalizer::WorkOnFile(
ByteString sTempFile( aTemp.GetFull(), RTL_TEXTENCODING_ASCII_US );
ByteString sDel;
-#if defined(WNT) || defined(OS2)
+#if defined(WNT)
sDel=ByteString("\\");
#else
sDel=ByteString("/");
@@ -294,13 +348,14 @@ void SourceTreeLocalizer::WorkOnFile(
ByteString sPath1( Export::GetEnv("SOLARVER") );
ByteString sPath2( Export::GetEnv("INPATH") );
ByteString sPath3( "bin" );
- ByteString sPath4( Export::GetEnv("UPDMINOREXT") );
ByteString sExecutable( sPath1 );
+#if defined(WNT)
+ sExecutable.SearchAndReplaceAll( "/", sDel );
+#endif
sExecutable += sDel ;
sExecutable += sPath2 ;
sExecutable += sDel;
sExecutable += sPath3 ;
- sExecutable += sPath4 ;
sExecutable += sDel ;
sExecutable += rExecutable ;
@@ -753,7 +808,6 @@ sal_Bool SourceTreeLocalizer::Merge( const ByteString &rSourceFile , const ByteS
sal_Bool bReturn = aSDF.IsOpen();
if ( bReturn ) {
bReturn = ExecuteMerge();
-// aSDF.Close();
}
aSDF.Close();
nMode = LOCALIZE_NONE;
@@ -780,7 +834,8 @@ void Help()
"====================================\n" );
fprintf( stdout,
"As part of the L10N framework, localize extracts and merges translations\n"
- "out of and into the whole source tree.\n\n"
+ "out of and into the toplevel modules defined in ModuleList array in\n"
+ "l10ntools/source/localize.cxx.\n\n"
"Syntax: localize -e -l en-US -f FileName \n"
"Parameter:\n"
"\t-e: Extract mode\n"
@@ -794,7 +849,7 @@ void Help()
"\nExample 1:\n"
"==========\n"
"localize -e -l en-US -f MyFile\n\n"
- "All strings will be extracted for language de and language en-US.\n"
+ "All strings will be extracted for language en-US.\n"
);
}
@@ -815,7 +870,7 @@ sal_Bool CheckLanguages( ByteString &rLanguages )
}
/*****************************************************************************/
-#if defined(UNX) || defined(OS2)
+#if defined(UNX)
int main( int argc, char *argv[] )
#else
int _cdecl main( int argc, char *argv[] )
@@ -909,62 +964,17 @@ int _cdecl main( int argc, char *argv[] )
//printf("B %s\nA %s\n",rDestinationFile.GetBuffer(), sFile.GetBuffer());
sFileName = sFileABS;
- Treeconfig treeconfig;
- vector<string> repos;
- bool hasPwd = treeconfig.getActiveRepositories( repos );
- if( hasPwd ) cout << "Found special path!\n";
-
- string minor_ext;
- bool has_minor_ext;
-
- if( Export::GetEnv("UPDMINOREXT") != NULL )
- {
- minor_ext = string( Export::GetEnv("UPDMINOREXT") );
- has_minor_ext = minor_ext.size();
+ string pwd;
+ Export::getCurrentDir( pwd );
+ cout << "Localizing directory " << pwd << "\n";
+ SourceTreeLocalizer aIter( ByteString( pwd.c_str() ) , sVersion , (sOutput.Len() > 0) , bSkipLinks );
+ aIter.SetLanguageRestriction( sLanguages );
+ if ( bExport ){
+ fflush( stdout );
+ aIter.Extract( sFileName );
+ printf("\n%d files found!\n",aIter.GetFileCnt());
}
- else
- has_minor_ext = false;
-
- // localize through all repositories
- for( vector<string>::iterator iter = repos.begin(); iter != repos.end() ; ++iter )
- {
- string curRepository;
- if( has_minor_ext )
- curRepository = string( Export::GetEnv("SOURCE_ROOT_DIR") ) + "/" + *iter + minor_ext;
- else
- curRepository = string( Export::GetEnv("SOURCE_ROOT_DIR") ) + "/" + *iter;
- cout << "Localizing repository " << curRepository << "\n";
- SourceTreeLocalizer aIter( ByteString( curRepository.c_str() ) , sVersion , (sOutput.Len() > 0) , bSkipLinks );
- aIter.SetLanguageRestriction( sLanguages );
- if ( bExport ){
- fflush( stdout );
- if( *iter == "ooo" )
- aIter.Extract( sFileName );
- else
- {
- ByteString sFileNameWithExt( sFileName );
- sFileNameWithExt += ByteString( "." );
- sFileNameWithExt += ByteString( (*iter).c_str() );
- aIter.Extract( sFileNameWithExt );
- }
- printf("\n%d files found!\n",aIter.GetFileCnt());
- }
- }
- if( hasPwd )
- {
- string pwd;
- Export::getCurrentDir( pwd );
- cout << "Localizing repository " << pwd << "\n";
- SourceTreeLocalizer aIter( ByteString( pwd.c_str() ) , sVersion , (sOutput.Len() > 0) , bSkipLinks );
- aIter.SetLanguageRestriction( sLanguages );
- if ( bExport ){
- fflush( stdout );
- aIter.Extract( sFileName );
- printf("\n%d files found!\n",aIter.GetFileCnt());
- }
-
- }
-
return 0;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/source/makefile.mk b/l10ntools/source/makefile.mk
index a8f17e8d6570..86bcea3cbd0e 100644
--- a/l10ntools/source/makefile.mk
+++ b/l10ntools/source/makefile.mk
@@ -33,12 +33,14 @@ PRJNAME=l10ntools
TARGET=transex
TARGETTYPE=CUI
LIBTARGET=no
+
# --- Settings -----------------------------------------------------
+
ENABLE_EXCEPTIONS=TRUE
.INCLUDE : settings.mk
+
CDEFS+= -DYY_NEVER_INTERACTIVE=1
-#CDEFS+= -pg
.IF "$(SYSTEM_EXPAT)" == "YES"
CFLAGS+=-DSYSTEM_EXPAT
@@ -52,7 +54,6 @@ OBJFILES= \
$(OBJ)$/export2.obj \
$(OBJ)$/merge.obj \
$(OBJ)$/srciter.obj \
- $(OBJ)$/utf8conv.obj \
$(OBJ)$/xmlparse.obj \
$(OBJ)$/helpmerge.obj \
$(OBJ)$/helpex.obj \
@@ -62,70 +63,35 @@ OBJFILES= \
LIB1TARGET= $(LB)$/$(TARGET).lib
LIB1ARCHIV= $(LB)$/libtransex.a
-#LIB1FILES= $(LB)$/transex3.lib
LIB1OBJFILES= $(OBJ)$/export.obj \
$(OBJ)$/export2.obj \
$(OBJ)$/merge.obj \
$(OBJ)$/srciter.obj \
$(OBJ)$/file.obj \
- $(OBJ)$/directory.obj \
- $(OBJ)$/utf8conv.obj
-
+ $(OBJ)$/directory.obj
APP1VERSIONMAP=exports.map
# extractor and merger for *.src and *.hrc
APP1TARGET= transex3
-#APP1OBJS= $(OBJ)$/src_yy.obj
APP1OBJS= $(OBJ)$/src_yy_wrapper.obj
-
APP1STDLIBS+= \
$(TOOLSLIB) \
- $(VOSLIB) \
$(SALLIB)
-
-.IF "$(OS)"=="MACOSX"
-# static libs at end for OS X
-.ENDIF
-
APP1LIBS+= $(LB)$/$(TARGET).lib
APP1DEPN= $(OBJ)$/src_yy_wrapper.obj $(LB)$/$(TARGET).lib
APP2TARGET= helpex
-APP2OBJS= $(OBJ)$/helpmerge.obj $(OBJ)$/xmlparse.obj $(OBJ)$/export2.obj $(OBJ)$/utf8conv.obj $(OBJ)$/merge.obj $(OBJ)$/helpex.obj
+APP2OBJS= $(OBJ)$/helpmerge.obj $(OBJ)$/xmlparse.obj $(OBJ)$/export2.obj $(OBJ)$/merge.obj $(OBJ)$/helpex.obj
APP2RPATH= NONE
-
-.IF "$(OS)"!="MACOSX"
-.ENDIF
-
-APP2STDLIBS+=$(SALLIB) $(EXPATASCII3RDLIB) $(TOOLSLIB) $(VOSLIB)
-
-.IF "$(OS)"=="MACOSX"
-# static libs at end for OS X
-.ENDIF
+APP2STDLIBS+=$(SALLIB) $(EXPATASCII3RDLIB) $(TOOLSLIB)
# extractor and merger for *.lng and *.lng
APP3TARGET= ulfex
-APP3OBJS= $(OBJ)$/lngmerge.obj $(OBJ)$/merge.obj $(OBJ)$/export2.obj $(OBJ)$/lngex.obj $(OBJ)$/utf8conv.obj
+APP3OBJS= $(OBJ)$/lngmerge.obj $(OBJ)$/merge.obj $(OBJ)$/export2.obj $(OBJ)$/lngex.obj
APP3RPATH= NONE
-
-.IF "$(OS)"!="MACOSX"
-#APP3STDLIBS+= $(BTSTRPLIB)
-.ENDIF
APP3STDLIBS+= \
$(TOOLSLIB) \
- $(VOSLIB) \
- $(SALLIB)
-.IF "$(OS)"=="MACOSX"
-# static libs at end for OS X
-.ENDIF
-
-# encoding converter for *.gsi
-APP4TARGET= gsiconv
-APP4OBJS= $(OBJ)$/utf8conv.obj $(OBJ)$/gsiconv.obj
-APP4STDLIBS+= \
- $(TOOLSLIB) \
- $(VOSLIB) \
$(SALLIB)
# tag checker for *.gsi
@@ -133,60 +99,33 @@ APP5TARGET= gsicheck
APP5OBJS= $(OBJ)$/gsicheck.obj $(OBJ)$/tagtest.obj
APP5STDLIBS+= \
$(TOOLSLIB) \
- $(VOSLIB) \
$(SALLIB)
# extractor and merger for *.cfg
APP6TARGET= cfgex
-APP6OBJS= $(OBJ)$/cfgmerge.obj $(OBJ)$/cfg_yy_wrapper.obj $(OBJ)$/merge.obj $(OBJ)$/export2.obj $(OBJ)$/utf8conv.obj
-
-.IF "$(OS)"!="MACOSX"
-#APP6STDLIBS+= $(BTSTRPLIB)
-.ENDIF
-
+APP6OBJS= $(OBJ)$/cfgmerge.obj $(OBJ)$/cfg_yy_wrapper.obj $(OBJ)$/merge.obj $(OBJ)$/export2.obj
APP6STDLIBS+= \
$(TOOLSLIB) \
- $(VOSLIB) \
$(SALLIB)
-.IF "$(OS)"=="MACOSX"
-# static libs at end for OS X
-.ENDIF
-
# extractor and merger for *.xrm
APP7TARGET= xrmex
-APP7OBJS= $(OBJ)$/xrmmerge.obj $(OBJ)$/xrm_yy_wrapper.obj $(OBJ)$/merge.obj $(OBJ)$/export2.obj $(OBJ)$/utf8conv.obj
+APP7OBJS= $(OBJ)$/xrmmerge.obj $(OBJ)$/xrm_yy_wrapper.obj $(OBJ)$/merge.obj $(OBJ)$/export2.obj
APP7RPATH= NONE
-
-.IF "$(OS)"!="MACOSX"
-.ENDIF
-
APP7STDLIBS+= \
$(TOOLSLIB) \
- $(VOSLIB) \
$(SALLIB)
-.IF "$(OS)"=="MACOSX"
-# static libs at end for OS X
-.ENDIF
-
-#
-#APP8TARGET= treeconfig
-#APP8OBJS= $(OBJ)$/treeconfig.obj $(OBJ)$/inireader.obj $(OBJ)$/export2.obj
-#APP8STDLIBS=$(TOOLSLIB) $(SALLIB) $(VOSLIB) $(ICUINLIB) $(STLPORT)
-
# localizer for l10n framework
APP9TARGET= localize_sl
EXCEPTIONSFILES= \
$(OBJ)$/localize.obj
-APP9OBJS= $(OBJ)$/localize.obj $(OBJ)$/utf8conv.obj $(OBJ)$/srciter.obj $(OBJ)$/export2.obj $(OBJ)$/file.obj $(OBJ)$/directory.obj $(OBJ)$/treeconfig.obj $(OBJ)$/inireader.obj
+APP9OBJS= $(OBJ)$/localize.obj $(OBJ)$/srciter.obj $(OBJ)$/export2.obj $(OBJ)$/file.obj $(OBJ)$/directory.obj
APP9STDLIBS+= \
$(TOOLSLIB) \
- $(VOSLIB) \
$(ICUINLIB) \
$(ICUUCLIB) \
- $(STLPORTLIB) \
$(SALLIB)
DEPOBJFILES=$(APP1OBJS) $(APP2OBJS) $(APP3OBJS) $(APP4OBJS) $(APP5OBJS) $(APP6OBJS) $(APP7OBJS) $(APP8OBJS) $(APP9OBJS)
diff --git a/l10ntools/source/merge.cxx b/l10ntools/source/merge.cxx
index 21002d79141e..35a61211bdbb 100644
--- a/l10ntools/source/merge.cxx
+++ b/l10ntools/source/merge.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -30,7 +31,6 @@
#include <stdio.h>
#include <tools/fsys.hxx>
#include "export.hxx"
-#include "utf8conv.hxx"
#include <iostream>
using namespace std;
@@ -384,3 +384,5 @@ ByteString MergeDataFile::CreateKey( const ByteString& rTYP , const ByteString&
return sKey; // officecfg case sensitive identifier
return sKey.toAsciiUpperCase();
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/source/src_yy_wrapper.c b/l10ntools/source/src_yy_wrapper.c
index d326b9a94e86..974068de2d88 100644
--- a/l10ntools/source/src_yy_wrapper.c
+++ b/l10ntools/source/src_yy_wrapper.c
@@ -1,2 +1,5 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
// Helper to suppress warnings in lex generated c code, see #i57362#
#include "src_yy.c"
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/source/srciter.cxx b/l10ntools/source/srciter.cxx
index 3434d4c39c55..6a16d92d0227 100644
--- a/l10ntools/source/srciter.cxx
+++ b/l10ntools/source/srciter.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -63,14 +64,15 @@ void SourceTreeIterator::ExecuteDirectory( transex::Directory& aDirectory )
if ( bInExecute ) {
rtl::OUString sDirName = aDirectory.getDirectoryName();
- static rtl::OUString WCARD1 ( rtl::OUString::createFromAscii( "unxlng" ) );
- static rtl::OUString WCARD2 ( rtl::OUString::createFromAscii( "unxsol" ) );
- static rtl::OUString WCARD3 ( rtl::OUString::createFromAscii( "wntmsc" ) );
- static rtl::OUString WCARD4 ( rtl::OUString::createFromAscii( "common" ) );
- static rtl::OUString WCARD5 ( rtl::OUString::createFromAscii( "unxmac" ) );
- static rtl::OUString WCARD6 ( rtl::OUString::createFromAscii( "unxubt" ) );
- static rtl::OUString WCARD7 ( rtl::OUString::createFromAscii( ".svn" ) );
- static rtl::OUString WCARD8 ( rtl::OUString::createFromAscii( ".hg" ) );
+ static rtl::OUString WCARD1 ( RTL_CONSTASCII_USTRINGPARAM("unxlng") );
+ static rtl::OUString WCARD2 ( RTL_CONSTASCII_USTRINGPARAM("unxsol") );
+ static rtl::OUString WCARD3 ( RTL_CONSTASCII_USTRINGPARAM("wntmsc") );
+ static rtl::OUString WCARD4 ( RTL_CONSTASCII_USTRINGPARAM("common") );
+ static rtl::OUString WCARD5 ( RTL_CONSTASCII_USTRINGPARAM("unxmac") );
+ static rtl::OUString WCARD6 ( RTL_CONSTASCII_USTRINGPARAM("unxubt") );
+ static rtl::OUString WCARD7 ( RTL_CONSTASCII_USTRINGPARAM(".git") );
+ static rtl::OUString WCARD8 ( RTL_CONSTASCII_USTRINGPARAM("clone") );
+ static rtl::OUString WCARD9 ( RTL_CONSTASCII_USTRINGPARAM("install") );
if( sDirName.indexOf( WCARD1 , 0 ) > -1 ||
@@ -80,7 +82,10 @@ void SourceTreeIterator::ExecuteDirectory( transex::Directory& aDirectory )
sDirName.indexOf( WCARD5 , 0 ) > -1 ||
sDirName.indexOf( WCARD6 , 0 ) > -1 ||
sDirName.indexOf( WCARD7 , 0 ) > -1 ||
- sDirName.indexOf( WCARD8 , 0 ) > -1
+#ifndef WNT
+ sDirName.indexOf( WCARD8 , 0 ) > -1 ||
+#endif
+ sDirName.indexOf( WCARD9 , 0 ) > -1
) return;
//printf("**** %s \n", OUStringToOString( sDirName , RTL_TEXTENCODING_UTF8 , sDirName.getLength() ).getStr() );
@@ -138,3 +143,5 @@ void SourceTreeIterator::OnExecuteDirectory( const rtl::OUString &rDirectory )
{
fprintf( stdout, "%s\n", rtl::OUStringToOString( rDirectory, RTL_TEXTENCODING_UTF8, rDirectory.getLength() ).getStr() );
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/source/tagtest.cxx b/l10ntools/source/tagtest.cxx
index f60785343c91..c3706aa4cd30 100644
--- a/l10ntools/source/tagtest.cxx
+++ b/l10ntools/source/tagtest.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -550,23 +551,29 @@ String TokenInfo::MakeTag() const
void ParserMessageList::AddError( sal_uInt16 nErrorNr, ByteString aErrorText, const TokenInfo &rTag )
{
- Insert( new ParserError( nErrorNr, aErrorText, rTag ), LIST_APPEND );
+ maList.push_back( new ParserError( nErrorNr, aErrorText, rTag ) );
}
void ParserMessageList::AddWarning( sal_uInt16 nErrorNr, ByteString aErrorText, const TokenInfo &rTag )
{
- Insert( new ParserWarning( nErrorNr, aErrorText, rTag ), LIST_APPEND );
+ maList.push_back( new ParserWarning( nErrorNr, aErrorText, rTag ) );
}
sal_Bool ParserMessageList::HasErrors()
{
- sal_uInt16 i;
- for ( i=0 ; i < Count() ; i++ )
- if ( GetObject( i )->IsError() )
+ for ( size_t i = 0, n = maList.size(); i < n; ++i )
+ if ( maList[ i ]->IsError() )
return sal_True;
return sal_False;
}
+void ParserMessageList::clear()
+{
+ for ( size_t i = 0, n = maList.size(); i < n; ++i )
+ delete maList[ i ];
+ maList.clear();
+}
+
struct Tag
{
String GetName() const { return String::CreateFromAscii( pName ); };
@@ -663,7 +670,7 @@ void SimpleParser::Parse( String PaSource )
nPos = 0;
aLastToken.Erase();
aNextTag = TokenInfo( TAG_NOMORETAGS, TOK_INVALIDPOS );
- aTokenList.Clear();
+ aTokenList.clear();
};
TokenInfo SimpleParser::GetNextToken( ParserMessageList &rErrorList )
@@ -735,24 +742,18 @@ TokenInfo SimpleParser::GetNextToken( ParserMessageList &rErrorList )
if ( aResult.nId == TAG_UNKNOWN_TAG )
aResult = TokenInfo( TAG_UNKNOWN_TAG, nTokenStartPos, aLastToken );
- aTokenList.Insert( aResult, LIST_APPEND );
+ aTokenList.insert( aResult );
return aResult;
}
String SimpleParser::GetNextTokenString( ParserMessageList &rErrorList, sal_uInt16 &rTagStartPos )
{
-// sal_uInt16 nStyle1StartPos = aSource.SearchAscii( "<#", nPos );
sal_uInt16 nStyle2StartPos = aSource.SearchAscii( "$[", nPos );
sal_uInt16 nStyle3StartPos = aSource.SearchAscii( "\\<", nPos );
sal_uInt16 nStyle4StartPos = aSource.SearchAscii( "\\\\", nPos ); // this is only to kick out quoted backslashes
rTagStartPos = 0;
-/* removing since a \<... is not likely
- // check if the tag starts with a letter to avoid things like <> <= ... >
- while ( STRING_NOTFOUND != nStyle3StartPos && !( aSource.Copy( nStyle3StartPos+2, 1 ).IsAlphaAscii() || aSource.GetChar( nStyle3StartPos+2 ) == '/' ) )
- nStyle3StartPos = aSource.SearchAscii( "\\<", nStyle3StartPos+1 );
-*/
if ( STRING_NOTFOUND == nStyle2StartPos && STRING_NOTFOUND == nStyle3StartPos )
return String(); // no more tokens
@@ -762,19 +763,7 @@ String SimpleParser::GetNextTokenString( ParserMessageList &rErrorList, sal_uInt
return GetNextTokenString( rErrorList, rTagStartPos );
}
-/* if ( nStyle1StartPos < nStyle2StartPos && nStyle1StartPos <= nStyle3StartPos ) // <= to make sure our spechial tags are recognized before all others
- { // test for <# ... > style tokens
- sal_uInt16 nEndPos = aSource.SearchAscii( ">", nStyle1StartPos );
- if ( nEndPos == STRING_NOTFOUND )
- { // Token is incomplete. Skip start and search for better ones
- nPos = nStyle1StartPos +2;
- return GetNextTokenString( rErrorList, rTagStartPos );
- }
- nPos = nEndPos;
- rTagStartPos = nStyle1StartPos;
- return aSource.Copy( nStyle1StartPos, nEndPos-nStyle1StartPos +1 ).ToUpperAscii();
- }
- else*/ if ( nStyle2StartPos < nStyle3StartPos )
+ if ( nStyle2StartPos < nStyle3StartPos )
{ // test for $[ ... ] style tokens
sal_uInt16 nEndPos = aSource.SearchAscii( "]", nStyle2StartPos);
if ( nEndPos == STRING_NOTFOUND )
@@ -876,11 +865,6 @@ void TokenParser::Parse( const String &aCode, ParserMessageList* pList )
ParseError( 17, "<#UNDER> expected before <#/UNDER>.", aTag );
}
break;
-/* case TAG_MISSPARENTHESIS:
- {
- ParseError( 14, "missing closing parenthesis '>'", aTag );
- }
- break;*/
case TAG_AEND:
{
ParseError( 5, "Extra Tag <#AEND>. <#AVIS> or <#AHID> expected.", aTag );
@@ -969,7 +953,6 @@ void TokenParser::Paragraph()
Paragraph();
}
break;
- case TAG_OS2:
case TAG_WIN:
case TAG_UNIX:
case TAG_MAC: //...
@@ -1032,7 +1015,6 @@ void TokenParser::PfCase()
CaseEnd();
}
break;
- case TAG_OS2:
case TAG_WIN:
case TAG_UNIX:
case TAG_MAC: //First (PfBegin)
@@ -1051,7 +1033,6 @@ void TokenParser::PfCaseBegin()
{
switch ( aTag.nId )
{
- case TAG_OS2:
case TAG_WIN:
case TAG_UNIX:
case TAG_MAC:
@@ -1421,13 +1402,9 @@ sal_Bool LingTest::IsTagMandatory( TokenInfo const &aToken, TokenId &aMetaTokens
void LingTest::CheckTags( TokenList &aReference, TokenList &aTestee, sal_Bool bFixTags )
{
- sal_uLong i=0,j=0;
+ size_t i=0,j=0;
// Clean old Warnings
- while ( aCompareWarningList.Count() )
- {
- delete aCompareWarningList.GetCurObject();
- aCompareWarningList.Remove();
- }
+ aCompareWarningList.clear();
/* in xml tags, do not require the following tags
comment
@@ -1439,35 +1416,35 @@ void LingTest::CheckTags( TokenList &aReference, TokenList &aTestee, sal_Bool bF
// filter uninteresting Tags
TokenId aMetaTokens = 0;
- for ( i=0 ; i < aReference.Count() ; i++ )
+ for ( i=0 ; i < aReference.size() ; i++ )
{
- if ( !IsTagMandatory( aReference.GetObject( i ), aMetaTokens ) )
- aReference.GetObject( i ).SetDone();
+ if ( !IsTagMandatory( aReference[ i ], aMetaTokens ) )
+ aReference[ i ].SetDone();
}
aMetaTokens = 0;
- for ( i=0 ; i < aTestee.Count() ; i++ )
+ for ( i=0 ; i < aTestee.size() ; i++ )
{
- if ( !IsTagMandatory( aTestee.GetObject( i ), aMetaTokens ) )
- aTestee.GetObject( i ).SetDone();
+ if ( !IsTagMandatory( aTestee[ i ], aMetaTokens ) )
+ aTestee[ i ].SetDone();
}
// remove all matching tags
- for ( i=0 ; i < aReference.Count() ; i++ )
+ for ( i=0 ; i < aReference.size() ; i++ )
{
- if ( aReference.GetObject( i ).IsDone() )
+ if ( aReference[ i ].IsDone() )
continue;
sal_Bool bTagFound = sal_False;
- for ( j=0 ; j < aTestee.Count() && !bTagFound ; j++ )
+ for ( j=0 ; j < aTestee.size() && !bTagFound ; j++ )
{
- if ( aTestee.GetObject( j ).IsDone() )
+ if ( aTestee[ j ].IsDone() )
continue;
- if ( aReference.GetObject( i ).MatchesTranslation( aTestee.GetObject( j ), sal_False, aCompareWarningList ) )
+ if ( aReference[ i ].MatchesTranslation( aTestee[ j ], sal_False, aCompareWarningList ) )
{
- aReference.GetObject( i ).SetDone();
- aTestee.GetObject( j ).SetDone();
+ aReference[ i ].SetDone();
+ aTestee[ j ].SetDone();
bTagFound = sal_True;
}
}
@@ -1479,62 +1456,62 @@ void LingTest::CheckTags( TokenList &aReference, TokenList &aTestee, sal_Bool bF
{
// we fix only if its a really simple case
sal_uInt16 nTagCount = 0;
- for ( i=0 ; i < aReference.Count() ; i++ )
- if ( !aReference.GetObject( i ).IsDone() )
+ for ( i=0 ; i < aReference.size() ; i++ )
+ if ( !aReference[ i ].IsDone() )
nTagCount++;
if ( nTagCount > 1 )
bCanFix = sal_False;
nTagCount = 0;
- for ( i=0 ; i < aTestee.Count() ; i++ )
- if ( !aTestee.GetObject( i ).IsDone() )
+ for ( i=0 ; i < aTestee.size() ; i++ )
+ if ( !aTestee[ i ].IsDone() )
nTagCount++;
if ( nTagCount > 1 )
bCanFix = sal_False;
}
// generate errors for tags that have differing attributes
- for ( i=0 ; i < aReference.Count() ; i++ )
+ for ( i=0 ; i < aReference.size() ; i++ )
{
- if ( aReference.GetObject( i ).IsDone() )
+ if ( aReference[ i ].IsDone() )
continue;
sal_Bool bTagFound = sal_False;
- for ( j=0 ; j < aTestee.Count() && !bTagFound ; j++ )
+ for ( j=0 ; j < aTestee.size() && !bTagFound ; j++ )
{
- if ( aTestee.GetObject( j ).IsDone() )
+ if ( aTestee[ j ].IsDone() )
continue;
- if ( aReference.GetObject( i ).MatchesTranslation( aTestee.GetObject( j ), sal_True, aCompareWarningList, bCanFix && bFixTags ) )
+ if ( aReference[ i ].MatchesTranslation( aTestee[ j ], sal_True, aCompareWarningList, bCanFix && bFixTags ) )
{
- aReference.GetObject( i ).SetDone();
- aTestee.GetObject( j ).SetDone();
+ aReference[ i ].SetDone();
+ aTestee[ j ].SetDone();
bTagFound = sal_True;
}
}
}
// list remaining tags as errors
- for ( i=0 ; i < aReference.Count() ; i++ )
+ for ( i=0 ; i < aReference.size() ; i++ )
{
- if ( aReference.GetObject( i ).IsDone() )
+ if ( aReference[ i ].IsDone() )
continue;
- aCompareWarningList.AddError( 20, "Missing Tag in Translation", aReference.GetObject( i ) );
+ aCompareWarningList.AddError( 20, "Missing Tag in Translation", aReference[ i ] );
}
- for ( i=0 ; i < aTestee.Count() ; i++ )
+ for ( i=0 ; i < aTestee.size() ; i++ )
{
- if ( aTestee.GetObject( i ).IsDone() )
+ if ( aTestee[ i ].IsDone() )
continue;
- aCompareWarningList.AddError( 21, "Extra Tag in Translation", aTestee.GetObject( i ) );
+ aCompareWarningList.AddError( 21, "Extra Tag in Translation", aTestee[ i ] );
}
- for ( i=0 ; i < aReference.Count() ; i++ )
- aReference.GetObject( i ).SetDone( sal_False );
+ for ( i=0 ; i < aReference.size() ; i++ )
+ aReference[ i ].SetDone( sal_False );
- for ( i=0 ; i < aTestee.Count() ; i++ )
- aTestee.GetObject( i ).SetDone( sal_False );
+ for ( i=0 ; i < aTestee.size() ; i++ )
+ aTestee[ i ].SetDone( sal_False );
}
void LingTest::CheckReference( GSILine *aReference )
@@ -1556,12 +1533,12 @@ void LingTest::CheckTestee( GSILine *aTestee, sal_Bool bHasSourceLine, sal_Bool
sal_Bool bFixesDone = sal_False;
// count backwards to allow replacing from right to left
int i;
- for ( i=aTesteeTokens.Count()-1 ; i>=0 ; i-- )
+ for ( i = aTesteeTokens.size() ; i > 0 ; )
{
- if ( aTesteeTokens.GetObject( i ).HasBeenFixed() )
+ if ( aTesteeTokens[ --i ].HasBeenFixed() )
{
bFixesDone = sal_True;
- aFixedTestee.Replace( aTesteeTokens.GetObject( i ).nPos, aTesteeTokens.GetObject( i ).aTokenString.Len(), aTesteeTokens.GetObject( i ).MakeTag() );
+ aFixedTestee.Replace( aTesteeTokens[ i ].nPos, aTesteeTokens[ i ].aTokenString.Len(), aTesteeTokens[ i ].MakeTag() );
}
}
if ( bFixesDone )
@@ -1572,3 +1549,4 @@ void LingTest::CheckTestee( GSILine *aTestee, sal_Bool bHasSourceLine, sal_Bool
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/source/treeconfig.cxx b/l10ntools/source/treeconfig.cxx
deleted file mode 100644
index 137492c39a50..000000000000
--- a/l10ntools/source/treeconfig.cxx
+++ /dev/null
@@ -1,128 +0,0 @@
-#include <vector>
-#include <string>
-#include <iostream>
-#include "treeconfig.hxx"
-#include "export.hxx"
-#ifdef WNT
-#include <direct.h>
-#include <io.h>
-#else
-#include <dirent.h>
-#endif
-#include <sys/stat.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-using namespace std;
-
-namespace transex3
-{
-
-bool Treeconfig::parseConfig(){
-
- string source_config_file = string( static_cast<ByteString>( Export::GetEnv("SOURCE_ROOT_DIR") ).GetBuffer() );
- if( source_config_file.empty() )
- {
- cerr << "Error: no suitable environment set?!?";
- exit( -1 );
- }
- source_config_file += string("/source_config");
- if( isConfigFilePresent() )
- {
- inireader.read( map , source_config_file );
- return true;
- }
- else return false;
-}
-
-// ALWAYS add all repositories from source_config file to the container active_repos
-// if a config_file is present ALWAYS return false
-// if you are in the root of a repository also add it to the container active_repos
-// if you are far inside a repository /my/path/ooo/sw/source then don't add it to the container but return true
-// if you are in some misc place like /tmp then return true
-// => the application can decide what to do in case the function returns true thus how to handle pwd() path
-bool Treeconfig::getActiveRepositories( vector<string>& active_repos ){
-
- bool isPresent = isConfigFilePresent();
- bool hasPath = false;
- string pwd;
- string guessedRepo;
- Export::getCurrentDir( pwd );
- string source_root = Export::GetEnv( "SOURCE_ROOT_DIR" );
- string solarsrc = Export::GetEnv( "SOLARSRC" );
- string partial;
-
- // if we are inside of a repository root then active it otherwise let the app handle the return!
- string::size_type pos = pwd.find_first_of( source_root );
- if( pos != string::npos && ( pos + source_root.length() +1 ) < pwd.length()){ // I am within SOURCE_ROOT_DIR
- partial = pwd.substr( pos + source_root.length() +1 , pwd.length());
- string::size_type nextPart = partial.find_first_of( "/" );
- if( nextPart != string::npos )
- hasPath = true;
- else
- guessedRepo = partial;
- }
- else // I am NOT within SOURCE_ROOT_DIR
- hasPath = true;
-
- if( isPresent )
- {
- hasPath = false; // if config_file is present don't care about pwd
- stringmap* repos = static_cast<stringmap*>( map[ string("repositories") ] );
- if( repos != 0 )
- {
- for( stringmap::iterator iter = repos->begin() ; iter != repos->end() ; ++iter )
- {
- if( static_cast<string>( iter->second ) == string( "active" ) )
- {
- active_repos.push_back( iter->first );
- if( static_cast<string>( iter->first ) == guessedRepo )
- {
- guessedRepo.clear(); // don't add double in case it is present in config_file
- }
- }
- }
- }
- else
- {
- cerr << "Error: source_config files doesn't contain a 'repositories' section ?!?";
- exit( -1 );
- }
- }
- if( !guessedRepo.empty() ){
- active_repos.push_back( guessedRepo ); // add myrepo
- }
- return hasPath; // are we deep inside of a source tree or outside of SOURCE_ROOT_DIR?
-}
-
-void Treeconfig::getCurrentDir( string& dir )
-{
- char buffer[64000];
- if( getcwd( buffer , sizeof( buffer ) ) == 0 ){
- cerr << "Error: getcwd failed!\n";
- exit( -1 );
- }
- dir = string( buffer );
-}
-
-bool Treeconfig::isConfigFilePresent()
-{
- string config_file = Export::GetEnv( "SOURCE_ROOT_DIR" );
- config_file += "/source_config";
-
- struct stat status;
- if( stat( config_file.c_str() , &status ) < 0 )
- {
- return false;
- }
-#ifdef WNT
- return ( status.st_mode & _S_IFREG ) && ( _access( config_file.c_str() , 4 ) >= 0 ) ;
-#else
- return ( status.st_mode & S_IFREG ) && ( access( config_file.c_str() , R_OK ) >= 0 ) ;
-#endif
-}
-
-
-
-}
diff --git a/l10ntools/source/utf8conv.cxx b/l10ntools/source/utf8conv.cxx
deleted file mode 100644
index 23642a29c88a..000000000000
--- a/l10ntools/source/utf8conv.cxx
+++ /dev/null
@@ -1,74 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_l10ntools.hxx"
-#include "utf8conv.hxx"
-
-//
-// class UTF8Converter
-//
-
-#define MAX_CONV_BUFFER_SIZE 0xFF00
-
-#define TO_CVTFLAGS (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_MAPTOPRIVATE |\
- RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT |\
- RTL_TEXTTOUNICODE_FLAGS_INVALID_DEFAULT)
-
-#define FROM_CVTFLAGS (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_DEFAULT |\
- RTL_UNICODETOTEXT_FLAGS_INVALID_DEFAULT |\
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACE |\
- RTL_UNICODETOTEXT_FLAGS_PRIVATE_MAPTO0)
-
-/*****************************************************************************/
-void UTF8Converter::Convert( ByteString &rBuffer,
- rtl_TextEncoding nSourceENC, rtl_TextEncoding nDestENC )
-/*****************************************************************************/
-{
- String sTemp( rBuffer, nSourceENC );
- rBuffer = ByteString( sTemp, nDestENC );
-}
-
-/*****************************************************************************/
-ByteString UTF8Converter::ConvertToUTF8(
- const ByteString &rASCII, rtl_TextEncoding nEncoding )
-/*****************************************************************************/
-{
- ByteString sReturn( rASCII );
- Convert( sReturn, nEncoding, RTL_TEXTENCODING_UTF8 );
- return sReturn;
-}
-
-/*****************************************************************************/
-ByteString UTF8Converter::ConvertFromUTF8(
- const ByteString &rUTF8, rtl_TextEncoding nEncoding )
-/*****************************************************************************/
-{
- ByteString sReturn( rUTF8 );
- Convert( sReturn, RTL_TEXTENCODING_UTF8, nEncoding );
- return sReturn;
-}
diff --git a/l10ntools/source/wtranode.cxx b/l10ntools/source/wtranode.cxx
index 1f51fea49d02..5ddbe0f0cd46 100644
--- a/l10ntools/source/wtranode.cxx
+++ b/l10ntools/source/wtranode.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -106,3 +107,4 @@ WTT_Node::~WTT_Node()
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/source/wtratree.cxx b/l10ntools/source/wtratree.cxx
index efd60ad48442..7e3bf4fda724 100644
--- a/l10ntools/source/wtratree.cxx
+++ b/l10ntools/source/wtratree.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -416,3 +417,4 @@ WordTransTree::Handle_TokenToTransform()
*pOutputPosition = '\0';
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/source/xgfconv.cxx b/l10ntools/source/xgfconv.cxx
deleted file mode 100644
index 0f406ca20b25..000000000000
--- a/l10ntools/source/xgfconv.cxx
+++ /dev/null
@@ -1,66 +0,0 @@
-#include <stdio.h>
-
-#include "export.hxx"
-#include "utf8conv.hxx"
-
-/*****************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_l10ntools.hxx"
-#if defined(UNX) || defined(OS2)
-int main( int argc, char *argv[] )
-#else
-int _cdecl main( int argc, char *argv[] )
-#endif
-/*****************************************************************************/
-{
- if ( argc != 3 ) {
- fprintf( stderr, "xgfconv InputFile OutputFile\n" );
- return ( 5 );
- }
-
- ByteString sInput( argv[ 1 ] );
- ByteString sOutput( argv[ 2 ] );
-
- SvFileStream aInput( String( sInput, RTL_TEXTENCODING_ASCII_US ), STREAM_STD_READ );
- if ( !aInput.IsOpen()) {
- fprintf( stderr, "ERROR: Unable to open input file!\n" );
- return ( 5 );
- }
-
- SvFileStream aOutput( String( sOutput, RTL_TEXTENCODING_ASCII_US ), STREAM_STD_WRITE | STREAM_TRUNC );
- if ( !aOutput.IsOpen()) {
- fprintf( stderr, "ERROR: Unable to open output file!\n" );
- aInput.Close();
- return ( 5 );
- }
-
- ByteString sLine;
- sal_Bool bFirst = sal_True;
- while ( !aInput.IsEof()) {
- aInput.ReadLine( sLine );
- ByteString sLangId = sLine.GetToken( 0, '\t' );
- ByteString sFile = sLine.GetToken( 1, '\t' );
- ByteString sText = sLine.Copy( sLangId.Len() + sFile.Len() + 2 );
-
- sal_uInt16 nLangId = sLangId.ToInt32();
- CharSet aCharSet = Export::GetCharSet( nLangId );
- if ( aCharSet != 0xFFFF && sText.Len()) {
- sText = UTF8Converter::ConvertToUTF8( sText, aCharSet );
- ByteString sOutput = sFile;
- sOutput += "\t";
- sOutput += sText;
- if ( !bFirst ) {
- ByteString sEmpty;
- aOutput.WriteLine( sEmpty );
- }
- else
- bFirst = sal_False;
- aOutput.Write( sOutput.GetBuffer(), sOutput.Len());
- }
- }
- aInput.Close();
- aOutput.Close();
- return ( 0 );
-}
-
diff --git a/l10ntools/source/xmlparse.cxx b/l10ntools/source/xmlparse.cxx
index 06e86e0358e4..7b0b11817687 100644
--- a/l10ntools/source/xmlparse.cxx
+++ b/l10ntools/source/xmlparse.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -37,10 +38,7 @@
#include <iostream>
#include <osl/mutex.hxx>
#include <osl/thread.hxx>
-#ifdef __MINGW32__
-#include <tools/prewin.h>
-#include <tools/postwin.h>
-#endif
+
using namespace std;
using namespace osl;
@@ -96,8 +94,8 @@ XMLParentNode::XMLParentNode( const XMLParentNode& obj)
if( obj.pChildList ){
pChildList=new XMLChildNodeList();
XMLChildNode* pNode = NULL;
- for ( sal_uLong i = 0; i < obj.pChildList->Count(); i++ ){
- pNode = obj.pChildList->GetObject( i );
+ for ( size_t i = 0; i < obj.pChildList->size(); i++ ){
+ pNode = (*obj.pChildList)[ i ];
if( pNode != NULL){
switch(pNode->GetNodeType()){
case XML_NODE_TYPE_ELEMENT:
@@ -126,8 +124,8 @@ XMLParentNode& XMLParentNode::operator=(const XMLParentNode& obj){
}
if( obj.pChildList ){
pChildList=new XMLChildNodeList();
- for ( sal_uLong i = 0; i < obj.pChildList->Count(); i++ )
- AddChild( obj.pChildList->GetObject( i ) );
+ for ( size_t i = 0; i < obj.pChildList->size(); i++ )
+ AddChild( (*obj.pChildList)[ i ] );
}else pChildList = NULL;
}
@@ -139,16 +137,23 @@ void XMLParentNode::AddChild( XMLChildNode *pChild )
{
if ( !pChildList )
pChildList = new XMLChildNodeList();
- pChildList->Insert( pChild, LIST_APPEND );
+ pChildList->push_back( pChild );
}
/*****************************************************************************/
-void XMLParentNode::AddChild( XMLChildNode *pChild , int pos )
+void XMLParentNode::AddChild( XMLChildNode *pChild , size_t pos )
/*****************************************************************************/
{
if ( !pChildList )
pChildList = new XMLChildNodeList();
- pChildList->Insert( pChild, pos );
+ if ( pos < pChildList->size() )
+ {
+ XMLChildNodeList::iterator it = pChildList->begin();
+ ::std::advance( it, pos );
+ pChildList->insert( it, pChild );
+ } else {
+ pChildList->push_back( pChild );
+ }
}
/*****************************************************************************/
@@ -160,8 +165,8 @@ int XMLParentNode::GetPosition( ByteString id ){
static const ByteString sDeStr = ByteString(String::CreateFromAscii(GERMAN_ISO2).ToLowerAscii() , RTL_TEXTENCODING_ASCII_US ).ToLowerAscii();
if ( pChildList ){
- for ( sal_uLong i = 0; i < pChildList->Count(); i++ ) {
- XMLChildNode *pChild = pChildList->GetObject( i );
+ for ( size_t i = 0; i < pChildList->size(); i++ ) {
+ XMLChildNode *pChild = (*pChildList)[ i ];
if ( pChild->GetNodeType() == XML_NODE_TYPE_ELEMENT ){
a = static_cast<XMLElement* >(pChild);
ByteString elemid( a->GetId() );
@@ -188,8 +193,8 @@ int XMLParentNode::RemoveChild( XMLElement *pRefElement )
{
XMLElement* a;
if ( pChildList ){
- for ( sal_uLong i = 0; i < pChildList->Count(); i++ ) {
- XMLChildNode *pChild = pChildList->GetObject( i );
+ for ( size_t i = 0; i < pChildList->size(); i++ ) {
+ XMLChildNode *pChild = (*pChildList)[ i ];
if ( pChild->GetNodeType() == XML_NODE_TYPE_ELEMENT ){
a = static_cast<XMLElement* >(pChild);
ByteString elemid( a->GetId() );
@@ -202,7 +207,9 @@ int XMLParentNode::RemoveChild( XMLElement *pRefElement )
&& elemLID.Equals( pRefLID ) )
{
if( pRefElement->ToOString().compareTo( a->ToOString() )==0 ){
- pChildList->Remove( i );
+ XMLChildNodeList::iterator it = pChildList->begin();
+ ::std::advance( it, i );
+ pChildList->erase( it );
delete a; // Test
return i;
}
@@ -218,9 +225,9 @@ int XMLParentNode::RemoveChild( XMLElement *pRefElement )
void XMLParentNode::RemoveAndDeleteAllChilds(){
/*****************************************************************************/
if ( pChildList ) {
- for ( sal_uLong i = 0; i < pChildList->Count(); i++ )
- delete pChildList->GetObject( i );
- pChildList->Clear();
+ for ( size_t i = 0; i < pChildList->size(); i++ )
+ delete (*pChildList)[ i ];
+ pChildList->clear();
}
}
@@ -228,8 +235,8 @@ void XMLParentNode::RemoveAndDeleteAllChilds(){
XMLElement *XMLParentNode::GetChildElement( XMLElement *pRefElement )
/*****************************************************************************/
{
- for ( sal_uLong i = 0; i < pChildList->Count(); i++ ) {
- XMLChildNode *pChild = pChildList->GetObject( i );
+ for ( size_t i = 0; i < pChildList->size(); i++ ) {
+ XMLChildNode *pChild = (*pChildList)[ i ];
if ( pChild->GetNodeType() == XML_NODE_TYPE_ELEMENT )
if ((( XMLElement * ) pChild )->GetName() ==
pRefElement->GetName())
@@ -239,8 +246,8 @@ XMLElement *XMLParentNode::GetChildElement( XMLElement *pRefElement )
return ( XMLElement * ) pChild;
sal_Bool bMatch = sal_False;
- for ( sal_uLong j = 0; j < pList->Count() && bMatch; j++ ) {
- XMLAttribute *pAttribute = pList->GetObject( j );
+ for ( size_t j = 0; j < pList->size() && bMatch; j++ ) {
+ XMLAttribute *pAttribute = (*pList)[ j ];
XMLAttribute *pCandidate =
(( XMLElement * ) pChild )->GetAttribute(
*pAttribute );
@@ -277,7 +284,6 @@ sal_Bool XMLFile::Write( ByteString &aFilename )
if( !aFStream ) // From time to time the stream can not be opened the first time on NFS volumes,
{ // I wasn't able to track this down. I think this is an NFS issue .....
- //cerr << "ERROR: - helpex - Can't write to tempfile " << aFilename.GetBuffer() << " No#" << x << "\n";
TimeValue aTime;
aTime.Seconds = 3;
aTime.Nanosec = 0;
@@ -297,7 +303,6 @@ sal_Bool XMLFile::Write( ByteString &aFilename )
if( aFileStat.GetSize() < 1 )
{
//retry
- //cerr << "WARNING: - helpex - Can't create file " << aFilename.GetBuffer() << " No#" << x << "\n";
aTarget.Kill();
}
else
@@ -325,17 +330,14 @@ void XMLFile::WriteString( ofstream &rStream, const String &sString )
sal_Bool XMLFile::Write( ofstream &rStream , XMLNode *pCur )
{
- XMLUtil& xmlutil = XMLUtil::Instance();
- (void) xmlutil;
-
if ( !pCur )
Write( rStream, this );
else {
switch( pCur->GetNodeType()) {
case XML_NODE_TYPE_FILE: {
if( GetChildList())
- for ( sal_uLong i = 0; i < GetChildList()->Count(); i++ )
- Write( rStream, GetChildList()->GetObject( i ));
+ for ( size_t i = 0; i < GetChildList()->size(); i++ )
+ Write( rStream, (*GetChildList())[ i ] );
}
break;
case XML_NODE_TYPE_ELEMENT: {
@@ -343,14 +345,14 @@ sal_Bool XMLFile::Write( ofstream &rStream , XMLNode *pCur )
rStream << "<";
WriteString( rStream, pElement->GetName());
if ( pElement->GetAttributeList())
- for ( sal_uLong j = 0; j < pElement->GetAttributeList()->Count(); j++ ) {
+ for ( size_t j = 0; j < pElement->GetAttributeList()->size(); j++ ) {
rStream << " ";
- String sData(*pElement->GetAttributeList()->GetObject( j ));
- xmlutil.QuotHTML( sData );
+ String sData(* (*pElement->GetAttributeList())[ j ] );
+ XMLUtil::QuotHTML( sData );
WriteString( rStream , sData );
rStream << "=\"";
- sData=pElement->GetAttributeList()->GetObject( j )->GetValue();
- xmlutil.QuotHTML( sData );
+ sData = (*pElement->GetAttributeList())[ j ]->GetValue();
+ XMLUtil::QuotHTML( sData );
WriteString( rStream , sData );
rStream << "\"";
}
@@ -358,8 +360,8 @@ sal_Bool XMLFile::Write( ofstream &rStream , XMLNode *pCur )
rStream << "/>";
else {
rStream << ">";
- for ( sal_uLong k = 0; k < pElement->GetChildList()->Count(); k++ )
- Write( rStream, pElement->GetChildList()->GetObject( k ));
+ for ( size_t k = 0; k < pElement->GetChildList()->size(); k++ )
+ Write( rStream, (*pElement->GetChildList())[ k ] );
rStream << "</";
WriteString( rStream, pElement->GetName());
rStream << ">";
@@ -369,7 +371,7 @@ sal_Bool XMLFile::Write( ofstream &rStream , XMLNode *pCur )
case XML_NODE_TYPE_DATA: {
XMLData *pData = ( XMLData * ) pCur;
String sData( pData->GetData());
- xmlutil.QuotHTML( sData );
+ XMLUtil::QuotHTML( sData );
WriteString( rStream, sData );
}
break;
@@ -400,8 +402,8 @@ void XMLFile::Print( XMLNode *pCur, sal_uInt16 nLevel )
switch( pCur->GetNodeType()) {
case XML_NODE_TYPE_FILE: {
if( GetChildList())
- for ( sal_uLong i = 0; i < GetChildList()->Count(); i++ )
- Print( GetChildList()->GetObject( i ));
+ for ( size_t i = 0; i < GetChildList()->size(); i++ )
+ Print( (*GetChildList())[ i ] );
}
break;
case XML_NODE_TYPE_ELEMENT: {
@@ -409,12 +411,12 @@ void XMLFile::Print( XMLNode *pCur, sal_uInt16 nLevel )
fprintf( stdout, "<%s", ByteString( pElement->GetName(), RTL_TEXTENCODING_UTF8 ).GetBuffer());
if ( pElement->GetAttributeList())
- for ( sal_uLong j = 0; j < pElement->GetAttributeList()->Count(); j++ ){
- ByteString aAttrName( *pElement->GetAttributeList()->GetObject( j ), RTL_TEXTENCODING_UTF8 );
+ for ( size_t j = 0; j < pElement->GetAttributeList()->size(); j++ ){
+ ByteString aAttrName( *(*pElement->GetAttributeList())[ j ], RTL_TEXTENCODING_UTF8 );
if( !aAttrName.EqualsIgnoreCaseAscii( XML_LANG ) ) {
fprintf( stdout, " %s=\"%s\"",
aAttrName.GetBuffer(),
- ByteString( pElement->GetAttributeList()->GetObject( j )->GetValue(),
+ ByteString( (*pElement->GetAttributeList())[ j ]->GetValue(),
RTL_TEXTENCODING_UTF8 ).GetBuffer());
}
}
@@ -422,8 +424,8 @@ void XMLFile::Print( XMLNode *pCur, sal_uInt16 nLevel )
fprintf( stdout, "/>" );
else {
fprintf( stdout, ">" );
- for ( sal_uLong k = 0; k < pElement->GetChildList()->Count(); k++ )
- Print( pElement->GetChildList()->GetObject( k ), nLevel + 1 );
+ for ( size_t k = 0; k < pElement->GetChildList()->size(); k++ )
+ Print( (*pElement->GetChildList())[ k ], nLevel + 1 );
fprintf( stdout, "</%s>", ByteString( pElement->GetName(), RTL_TEXTENCODING_UTF8 ).GetBuffer());
}
}
@@ -469,7 +471,6 @@ XMLFile::XMLFile( const String &rFileName ) // the file name, empty if created f
XMLStrings ( NULL )
{
-// nodes_localize.insert( TagMap::value_type(ByteString(String::CreateFromAscii("bookmark_value"),RTL_TEXTENCODING_ASCII_US) , sal_True) );
nodes_localize.insert( TagMap::value_type(ByteString(String::CreateFromAscii("bookmark"),RTL_TEXTENCODING_ASCII_US) , sal_True) );
nodes_localize.insert( TagMap::value_type(ByteString(String::CreateFromAscii("variable"),RTL_TEXTENCODING_ASCII_US) , sal_True) );
nodes_localize.insert( TagMap::value_type(ByteString(String::CreateFromAscii("paragraph"),RTL_TEXTENCODING_ASCII_US) , sal_True) );
@@ -517,13 +518,13 @@ void XMLFile::InsertL10NElement( XMLElement* pElement ){
LangHashMap* elem;
if( pElement->GetAttributeList() != NULL ){
- for ( sal_uLong j = 0; j < pElement->GetAttributeList()->Count(); j++ ){
- tmpStr=ByteString( *pElement->GetAttributeList()->GetObject( j ),RTL_TEXTENCODING_UTF8 );
+ for ( size_t j = 0; j < pElement->GetAttributeList()->size(); j++ ){
+ tmpStr=ByteString( *(*pElement->GetAttributeList())[ j ], RTL_TEXTENCODING_UTF8 );
if( tmpStr.CompareTo(ID)==COMPARE_EQUAL ){ // Get the "id" Attribute
- id = ByteString( pElement->GetAttributeList()->GetObject( j )->GetValue(),RTL_TEXTENCODING_UTF8 );
+ id = ByteString( (*pElement->GetAttributeList())[ j ]->GetValue(),RTL_TEXTENCODING_UTF8 );
}
if( tmpStr.CompareTo( XML_LANG ) == COMPARE_EQUAL ){ // Get the "xml-lang" Attribute
- language = ByteString( pElement->GetAttributeList()->GetObject( j )->GetValue(),RTL_TEXTENCODING_UTF8 );
+ language = ByteString( (*pElement->GetAttributeList())[ j ]->GetValue(),RTL_TEXTENCODING_UTF8 );
}
}
@@ -633,8 +634,8 @@ void XMLFile::SearchL10NElements( XMLParentNode *pCur , int pos)
case XML_NODE_TYPE_FILE: {
XMLParentNode* pElement;
if( GetChildList()){
- for ( sal_uLong i = 0; i < GetChildList()->Count(); i++ ){
- pElement = (XMLParentNode*) GetChildList()->GetObject( i );
+ for ( size_t i = 0; i < GetChildList()->size(); i++ ){
+ pElement = (XMLParentNode*) (*GetChildList())[ i ];
if( pElement->GetNodeType() == XML_NODE_TYPE_ELEMENT ) SearchL10NElements( pElement , i);
}
}
@@ -645,20 +646,19 @@ void XMLFile::SearchL10NElements( XMLParentNode *pCur , int pos)
ByteString sName(pElement->GetName(),RTL_TEXTENCODING_ASCII_US);
ByteString language,tmpStrVal,oldref;
if ( pElement->GetAttributeList()){
- for ( sal_uLong j = 0 , cnt = pElement->GetAttributeList()->Count(); j < cnt && bInsert; j++ ){
- const ByteString tmpStr( *pElement->GetAttributeList()->GetObject( j ),RTL_TEXTENCODING_UTF8 );
+ for ( size_t j = 0 , cnt = pElement->GetAttributeList()->size(); j < cnt && bInsert; j++ ){
+ const ByteString tmpStr( *(*pElement->GetAttributeList())[ j ],RTL_TEXTENCODING_UTF8 );
if( tmpStr.CompareTo(THEID)==COMPARE_EQUAL ){ // Get the "id" Attribute
- tmpStrVal=ByteString( pElement->GetAttributeList()->GetObject( j )->GetValue(),RTL_TEXTENCODING_UTF8 );
- //printf("Checking id = %s\n",tmpStrVal.GetBuffer() );
+ tmpStrVal=ByteString( (*pElement->GetAttributeList())[ j ]->GetValue(),RTL_TEXTENCODING_UTF8 );
}
if( tmpStr.CompareTo(LOCALIZE)==COMPARE_EQUAL ){ // Get the "localize" Attribute
bInsert=false;
}
if( tmpStr.CompareTo(XML_LANG)==COMPARE_EQUAL ){ // Get the "xml-lang" Attribute
- language=ByteString( pElement->GetAttributeList()->GetObject( j )->GetValue(),RTL_TEXTENCODING_UTF8 );
+ language=ByteString( (*pElement->GetAttributeList())[ j ]->GetValue(),RTL_TEXTENCODING_UTF8 );
}
if( tmpStr.CompareTo(OLDREF)==COMPARE_EQUAL ){ // Get the "oldref" Attribute
- oldref=ByteString( pElement->GetAttributeList()->GetObject( j )->GetValue(),RTL_TEXTENCODING_UTF8 );
+ oldref=ByteString( (*pElement->GetAttributeList())[ j ]->GetValue(),RTL_TEXTENCODING_UTF8 );
}
}
pElement->SetLanguageId ( language );
@@ -670,8 +670,8 @@ void XMLFile::SearchL10NElements( XMLParentNode *pCur , int pos)
if ( bInsert && ( nodes_localize.find( sName.ToLowerAscii() ) != nodes_localize.end() ) )
InsertL10NElement(pElement);
else if ( bInsert && pElement->GetChildList() ){
- for ( sal_uLong k = 0; k < pElement->GetChildList()->Count(); k++ )
- SearchL10NElements( (XMLParentNode*) pElement->GetChildList()->GetObject( k ) , k);
+ for ( size_t k = 0; k < pElement->GetChildList()->size(); k++ )
+ SearchL10NElements( (XMLParentNode*)(*pElement->GetChildList())[ k ], k);
}
}
break;
@@ -707,8 +707,8 @@ bool XMLFile::CheckExportStatus( XMLParentNode *pCur )
case XML_NODE_TYPE_FILE: {
XMLParentNode* pElement;
if( GetChildList()){
- for ( sal_uLong i = 0; i < GetChildList()->Count(); i++ ){
- pElement = (XMLParentNode*) GetChildList()->GetObject( i );
+ for ( size_t i = 0; i < GetChildList()->size(); i++ ){
+ pElement = (XMLParentNode*)(*GetChildList())[ i ];
if( pElement->GetNodeType() == XML_NODE_TYPE_ELEMENT ) CheckExportStatus( pElement );//, i);
}
}
@@ -719,10 +719,10 @@ bool XMLFile::CheckExportStatus( XMLParentNode *pCur )
ByteString sName(pElement->GetName(),RTL_TEXTENCODING_ASCII_US);
if( sName.EqualsIgnoreCaseAscii( TOPIC ) ){
if ( pElement->GetAttributeList()){
- for ( sal_uLong j = 0 , cnt = pElement->GetAttributeList()->Count(); j < cnt && bInsert; j++ ){
- const ByteString tmpStr( *pElement->GetAttributeList()->GetObject( j ),RTL_TEXTENCODING_UTF8 );
+ for ( size_t j = 0 , cnt = pElement->GetAttributeList()->size(); j < cnt && bInsert; j++ ){
+ const ByteString tmpStr( *(*pElement->GetAttributeList())[ j ],RTL_TEXTENCODING_UTF8 );
if( tmpStr.EqualsIgnoreCaseAscii( STATUS ) ){
- ByteString tmpStrVal=ByteString( pElement->GetAttributeList()->GetObject( j )->GetValue(),RTL_TEXTENCODING_UTF8 );
+ ByteString tmpStrVal=ByteString( (*pElement->GetAttributeList())[ j ]->GetValue(),RTL_TEXTENCODING_UTF8 );
if( !tmpStrVal.EqualsIgnoreCaseAscii( PUBLISH ) &&
!tmpStrVal.EqualsIgnoreCaseAscii( DEPRECATED )){
bStatusExport = false;
@@ -733,8 +733,8 @@ bool XMLFile::CheckExportStatus( XMLParentNode *pCur )
}
}
else if ( pElement->GetChildList() ){
- for ( sal_uLong k = 0; k < pElement->GetChildList()->Count(); k++ )
- CheckExportStatus( (XMLParentNode*) pElement->GetChildList()->GetObject( k ) );//, k);
+ for ( size_t k = 0; k < pElement->GetChildList()->size(); k++ )
+ CheckExportStatus( (XMLParentNode*)(*pElement->GetChildList())[ k ] );
}
}
break;
@@ -768,8 +768,8 @@ XMLElement::XMLElement(const XMLElement& obj)
{
if ( obj.pAttributes ){
pAttributes = new XMLAttributeList();
- for ( sal_uLong i = 0; i < obj.pAttributes->Count(); i++ )
- AddAttribute( *obj.pAttributes->GetObject( i ) , obj.pAttributes->GetObject( i )->GetValue() );
+ for ( size_t i = 0; i < obj.pAttributes->size(); i++ )
+ AddAttribute( *(*obj.pAttributes)[ i ], (*obj.pAttributes)[ i ]->GetValue() );
}
}
@@ -788,14 +788,14 @@ XMLElement& XMLElement::operator=(const XMLElement& obj){
nPos =obj.nPos;
if ( pAttributes ){
- for ( sal_uLong i = 0; i < pAttributes->Count(); i++ )
- delete pAttributes->GetObject( i );
+ for ( size_t i = 0; i < pAttributes->size(); i++ )
+ delete (*pAttributes)[ i ];
delete pAttributes;
}
if ( obj.pAttributes ){
pAttributes =new XMLAttributeList();
- for ( sal_uLong i = 0; i < obj.pAttributes->Count(); i++ )
- AddAttribute( *obj.pAttributes->GetObject( i ) , obj.pAttributes->GetObject( i )->GetValue() );
+ for ( size_t i = 0; i < obj.pAttributes->size(); i++ )
+ AddAttribute( *(*obj.pAttributes)[ i ], (*obj.pAttributes)[ i ]->GetValue() );
}
}
return *this;
@@ -807,7 +807,7 @@ void XMLElement::AddAttribute( const String &rAttribute, const String &rValue )
{
if ( !pAttributes )
pAttributes = new XMLAttributeList();
- pAttributes->Insert( new XMLAttribute( rAttribute, rValue ), LIST_APPEND );
+ pAttributes->push_back( new XMLAttribute( rAttribute, rValue ) );
}
/*****************************************************************************/
@@ -816,9 +816,9 @@ void XMLElement::ChangeLanguageTag( const String &rValue ){
static const String rName = String::CreateFromAscii("xml-lang");
SetLanguageId( ByteString(rValue,RTL_TEXTENCODING_UTF8) );
if ( pAttributes ){
- for ( sal_uLong i = 0; i < pAttributes->Count(); i++ ){
- if ( *pAttributes->GetObject( i ) == rName ){
- pAttributes->GetObject( i )->setValue(rValue);
+ for ( size_t i = 0; i < pAttributes->size(); i++ ){
+ if ( *(*pAttributes)[ i ] == rName ){
+ (*pAttributes)[ i ]->setValue(rValue);
}
}
}
@@ -827,8 +827,8 @@ void XMLElement::ChangeLanguageTag( const String &rValue ){
XMLChildNodeList* pCList = GetChildList();
if( pCList != NULL ){
- for ( sal_uLong i = 0; i < pCList->Count(); i++ ){
- pNode = pCList->GetObject( i );
+ for ( size_t i = 0; i < pCList->size(); i++ ){
+ pNode = (*pCList)[ i ];
if( pNode != NULL && pNode->GetNodeType() == XML_NODE_TYPE_ELEMENT ){
pElem = static_cast< XMLElement* >(pNode);
pElem->ChangeLanguageTag( rValue );
@@ -845,9 +845,9 @@ XMLAttribute *XMLElement::GetAttribute( const String &rName )
/*****************************************************************************/
{
if ( pAttributes )
- for ( sal_uLong i = 0; i < pAttributes->Count(); i++ )
- if ( *pAttributes->GetObject( i ) == rName )
- return pAttributes->GetObject( i );
+ for ( size_t i = 0; i < pAttributes->size(); i++ )
+ if ( *(*pAttributes)[ i ] == rName )
+ return (*pAttributes)[ i ];
return NULL;
}
@@ -857,8 +857,8 @@ XMLElement::~XMLElement()
/*****************************************************************************/
{
if ( pAttributes ) {
- for ( sal_uLong i = 0; i < pAttributes->Count(); i++ )
- delete pAttributes->GetObject( i );
+ for ( size_t i = 0; i < pAttributes->size(); i++ )
+ delete (*pAttributes)[ i ];
delete pAttributes;
pAttributes = NULL;
@@ -898,7 +898,7 @@ void XMLElement::Print(XMLNode *pCur, OUStringBuffer& buffer , bool rootelement
/*****************************************************************************/
//YD FIXME somewhere COMMENT is defined as 4!
static const String _COMMENT = String::CreateFromAscii("comment");
- static const OUString XML_LANG ( OUString::createFromAscii("xml-lang") );
+ static const OUString XML_LANG ( RTL_CONSTASCII_USTRINGPARAM("xml-lang") );
if(pCur!=NULL){
if(rootelement){
@@ -906,8 +906,8 @@ void XMLElement::Print(XMLNode *pCur, OUStringBuffer& buffer , bool rootelement
if ( pElement->GetAttributeList()){
if ( pElement->GetChildList()){
XMLChildNode* tmp=NULL;
- for ( sal_uLong k = 0; k < pElement->GetChildList()->Count(); k++ ){
- tmp=pElement->GetChildList()->GetObject( k );
+ for ( size_t k = 0; k < pElement->GetChildList()->size(); k++ ){
+ tmp = (*pElement->GetChildList())[ k ];
Print( tmp, buffer , false);
}
}
@@ -920,34 +920,34 @@ void XMLElement::Print(XMLNode *pCur, OUStringBuffer& buffer , bool rootelement
XMLElement *pElement = ( XMLElement * ) pCur;
if( !pElement->GetName().EqualsIgnoreCaseAscii( _COMMENT ) ){
- buffer.append( OUString::createFromAscii("\\<") );
+ buffer.append( OUString(RTL_CONSTASCII_USTRINGPARAM("\\<")) );
buffer.append( pElement->GetName() );
if ( pElement->GetAttributeList()){
- for ( sal_uLong j = 0; j < pElement->GetAttributeList()->Count(); j++ ){
+ for ( size_t j = 0; j < pElement->GetAttributeList()->size(); j++ ){
- OUString aAttrName( *pElement->GetAttributeList()->GetObject( j ) );
+ OUString aAttrName( *(*pElement->GetAttributeList())[ j ] );
if( !aAttrName.equalsIgnoreAsciiCase( XML_LANG ) ) {
- buffer.append( OUString::createFromAscii(" ") );
+ buffer.append( OUString(RTL_CONSTASCII_USTRINGPARAM(" ")) );
buffer.append( aAttrName );
- buffer.append( OUString::createFromAscii("=") );
- buffer.append( OUString::createFromAscii("\\\"") );
- buffer.append( pElement->GetAttributeList()->GetObject( j )->GetValue() );
- buffer.append( OUString::createFromAscii("\\\"") );
+ buffer.append( OUString(RTL_CONSTASCII_USTRINGPARAM("=")) );
+ buffer.append( OUString(RTL_CONSTASCII_USTRINGPARAM("\\\"")) );
+ buffer.append( (*pElement->GetAttributeList())[ j ]->GetValue() );
+ buffer.append( OUString(RTL_CONSTASCII_USTRINGPARAM("\\\"")) );
}
}
}
if ( !pElement->GetChildList())
- buffer.append( OUString::createFromAscii("/\\>") );
+ buffer.append( OUString(RTL_CONSTASCII_USTRINGPARAM("/\\>")) );
else {
- buffer.append( OUString::createFromAscii("\\>") );
+ buffer.append( OUString(RTL_CONSTASCII_USTRINGPARAM("\\>")) );
XMLChildNode* tmp=NULL;
- for ( sal_uLong k = 0; k < pElement->GetChildList()->Count(); k++ ){
- tmp=pElement->GetChildList()->GetObject( k );
+ for ( size_t k = 0; k < pElement->GetChildList()->size(); k++ ){
+ tmp = (*pElement->GetChildList())[ k ];
Print( tmp, buffer , false);
}
- buffer.append( OUString::createFromAscii("\\</") );
+ buffer.append( OUString(RTL_CONSTASCII_USTRINGPARAM("\\</")) );
buffer.append( pElement->GetName() );
- buffer.append( OUString::createFromAscii("\\>") );
+ buffer.append( OUString(RTL_CONSTASCII_USTRINGPARAM("\\>")) );
}
}
}
@@ -960,9 +960,9 @@ void XMLElement::Print(XMLNode *pCur, OUStringBuffer& buffer , bool rootelement
break;
case XML_NODE_TYPE_COMMENT: {
XMLComment *pComment = ( XMLComment * ) pCur;
- buffer.append( OUString::createFromAscii("<!--") );
+ buffer.append( OUString(RTL_CONSTASCII_USTRINGPARAM("<!--")) );
buffer.append( pComment->GetComment() );
- buffer.append( OUString::createFromAscii("-->") );
+ buffer.append( OUString(RTL_CONSTASCII_USTRINGPARAM("-->")) );
}
break;
case XML_NODE_TYPE_DEFAULT: {
@@ -1335,8 +1335,6 @@ void XMLUtil::QuotHTML( String &rString )
case '>': sReturn.append( GT );i++;break;
case '\\': sReturn.append( QUOT );i++;break;
case '\"': sReturn.append( APOS );i++;break;
- //case '\'': sReturn += "\'";i++;break;
- //case '&' : sRetrun += "&";i++;break;
default: sReturn.append( SLASH );break;
}
@@ -1355,10 +1353,6 @@ void XMLUtil::QuotHTML( String &rString )
sReturn.append( QQUOT );
break;
-/* case '\'':
- sReturn += "&apos;";
- break;
-*/
case '&':
if (
( ( i + 4 ) < rString.Len()) &&
@@ -1420,34 +1414,4 @@ void XMLUtil::UnQuotData( String &rString_in ){
}
-XMLUtil::XMLUtil(){
-}
-
-
-/*****************************************************************************/
-void XMLUtil::dump(){
-/*****************************************************************************/
- int cnt=1;
- printf("size=%lu\n",static_cast<unsigned long>(lMap.size()));
- for(HashMap::iterator pos = lMap.begin(); pos != lMap.end() ; ++pos){
- fprintf(stdout,"key=%s , value=%d , no=%d\n",pos->first.GetBuffer(),pos->second,cnt++);
- }
-}
-/*****************************************************************************/
-XMLUtil& XMLUtil::Instance(){
-/*****************************************************************************/
- static XMLUtil instance;
- return instance;
-}
-/*****************************************************************************/
-XMLUtil::~XMLUtil(){}
-/*****************************************************************************/
-/*****************************************************************************/
-ByteString XMLUtil::GetIsoLangByIndex( sal_uInt16 nIndex )
-/*****************************************************************************/
-{
- if(nIndex > 0 && MAX_LANGUAGES >= nIndex )
- return isoArray[nIndex];
- return "";
-}
-
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/source/xrm_yy_wrapper.c b/l10ntools/source/xrm_yy_wrapper.c
index 6a304d0d09dc..2724ad0797ba 100644
--- a/l10ntools/source/xrm_yy_wrapper.c
+++ b/l10ntools/source/xrm_yy_wrapper.c
@@ -1,2 +1,5 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
// Helper to suppress warnings in lex generated c code, see #i57362#
#include "xrm_yy.c"
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/source/xrmmerge.cxx b/l10ntools/source/xrmmerge.cxx
index c5754a05f6a4..875fd457cf93 100644
--- a/l10ntools/source/xrmmerge.cxx
+++ b/l10ntools/source/xrmmerge.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -34,7 +35,6 @@
// local includes
#include "export.hxx"
#include "xrmmerge.hxx"
-#include "utf8conv.hxx"
#include "tokens.h"
#include <iostream>
#include <vector>
@@ -321,9 +321,6 @@ int XRMResParser::Execute( int nToken, char * pToken )
sLID = "";
sGID += ".";
sGID += GetAttribute( rToken, "id" );
- //sLocalized = "1";
-
- //sLocalized = "X:";
sLocalized = true;
break;
@@ -335,11 +332,6 @@ int XRMResParser::Execute( int nToken, char * pToken )
sLID = "";
sGID += ".";
sGID += GetAttribute( rToken, "id" );
-// if ( GetAttribute( rToken, "localized" ) == "false" )
-// sLocalized += "0";
-// sLocalized = false;
-// else
-// sLocalized += "1";
sLocalized = true;
break;
@@ -378,7 +370,7 @@ int XRMResParser::Execute( int nToken, char * pToken )
ByteString sLang = GetAttribute( sCurrentOpenTag, "xml:lang" );
WorkOnText( sCurrentOpenTag, sCurrentText );
Output( sCurrentText );
- EndOfText( sCurrentOpenTag, sCurrentCloseTag );// <---
+ EndOfText( sCurrentOpenTag, sCurrentCloseTag );
bText = sal_False;
rToken = ByteString("");
sCurrentText = ByteString("");
@@ -445,9 +437,7 @@ void XRMResParser::ConvertStringToDBFormat( ByteString &rString )
do {
sResult = rString;
rString.EraseLeadingChars( _LF );
- // rString.EraseLeadingChars( ' ' );
rString.EraseLeadingChars( '\t' );
- // rString.EraseTrailingChars( ' ' );
rString.EraseTrailingChars( '\t' );
} while ( sResult != rString );
@@ -562,9 +552,6 @@ void XRMResExport::EndOfText(
char cSearch = 0x00;
ByteString sSearch( cSearch );
- // if ( !pResData->sText[ ByteString("en-US") ].Len() )
- // pResData->sText[ ByteString("en-US") ] = pResData->sText[ ByteString("de") ];
-
Export::FillInFallbacks( pResData );
ByteString sTimeStamp( Export::GetTimeStamp());
@@ -573,7 +560,6 @@ void XRMResExport::EndOfText(
sCur = aLanguages[ n ];
ByteString sAct = pResData->sText[ sCur ];
- //Export::UnquotHTML( sAct );
sAct.EraseAllChars( 0x0A );
ByteString sOutput( sPrj ); sOutput += "\t";
@@ -593,7 +579,6 @@ void XRMResExport::EndOfText(
sOutput += sTimeStamp;
sOutput.SearchAndReplaceAll( sSearch, "_" );
- //if( !sCur.EqualsIgnoreCaseAscii("de") ||( sCur.EqualsIgnoreCaseAscii("de") && !Export::isMergingGermanAllowed( sPrj ) ) )
if( sAct.Len() > 1 )
pOutputStream->WriteLine( sOutput );
}
@@ -646,7 +631,6 @@ void XRMResMerge::WorkOnText(
if ( pMergeDataFile ) {
if ( !pResData ) {
ByteString sPlatform( "" );
-// pResData = new ResData( sPlatform, GetGID() , sFilename );
pResData = new ResData( sPlatform, GetLID() , sFilename );
pResData->sId = GetLID();
@@ -701,8 +685,6 @@ void XRMResMerge::EndOfText(
( sContent != "-" ) && ( sContent.Len()))
{
ByteString sText( sContent );
- //Export::QuotHTMLXRM( sText );
-
ByteString sAdditionalLine( "\t" );
sAdditionalLine += rOpenTag;
ByteString sSearch = "xml:lang=\"";
@@ -729,3 +711,4 @@ void XRMResMerge::EndOfText(
pResData = NULL;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */