xref: /aoo41x/main/l10ntools/source/merge.cxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_l10ntools.hxx"
30*cdf0e10cSrcweir #include <stdio.h>
31*cdf0e10cSrcweir #include <tools/fsys.hxx>
32*cdf0e10cSrcweir #include "export.hxx"
33*cdf0e10cSrcweir #include "utf8conv.hxx"
34*cdf0e10cSrcweir #include <iostream>
35*cdf0e10cSrcweir 
36*cdf0e10cSrcweir using namespace std;
37*cdf0e10cSrcweir 
38*cdf0e10cSrcweir namespace
39*cdf0e10cSrcweir {
40*cdf0e10cSrcweir     static ::rtl::OString lcl_NormalizeFilename(const ::rtl::OString& rFilename)
41*cdf0e10cSrcweir     {
42*cdf0e10cSrcweir         return rFilename.copy(
43*cdf0e10cSrcweir             ::std::max(
44*cdf0e10cSrcweir                 rFilename.lastIndexOf( "\\" ),
45*cdf0e10cSrcweir                 rFilename.lastIndexOf( "/" ))+1);
46*cdf0e10cSrcweir     };
47*cdf0e10cSrcweir }
48*cdf0e10cSrcweir 
49*cdf0e10cSrcweir extern void ConvertHalfwitdhToFullwidth( String& rString );
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir //
52*cdf0e10cSrcweir // class PFormEntrys
53*cdf0e10cSrcweir //
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir ByteString PFormEntrys::Dump()
56*cdf0e10cSrcweir {
57*cdf0e10cSrcweir     ByteString sRet( "PFormEntrys\n" );
58*cdf0e10cSrcweir     ByteString a("sText");
59*cdf0e10cSrcweir     if(sText.size())
60*cdf0e10cSrcweir         Export::DumpMap(a , sText);
61*cdf0e10cSrcweir     return sRet;
62*cdf0e10cSrcweir }
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir sal_Bool PFormEntrys::GetTransex3Text( ByteString &rReturn,
65*cdf0e10cSrcweir     sal_uInt16 nTyp, const ByteString &nLangIndex, sal_Bool bDel )
66*cdf0e10cSrcweir {
67*cdf0e10cSrcweir     sal_Bool rc = GetText( rReturn , nTyp , nLangIndex , bDel );
68*cdf0e10cSrcweir     ByteString test( rReturn );
69*cdf0e10cSrcweir     for( sal_uInt16 idx = 0; idx < rReturn.Len(); idx++ )
70*cdf0e10cSrcweir     {
71*cdf0e10cSrcweir         if( rReturn.GetChar( idx ) == '\"' && ( idx >= 1 )  &&  rReturn.GetChar( idx-1 ) == '\\' )
72*cdf0e10cSrcweir         {
73*cdf0e10cSrcweir             rReturn.Erase( idx-1 , 1 );
74*cdf0e10cSrcweir         }
75*cdf0e10cSrcweir     }
76*cdf0e10cSrcweir     //if( !rReturn.Equals( test ) )
77*cdf0e10cSrcweir     //    printf("*CHANGED******************\n%s\n%s\n",test.GetBuffer(),rReturn.GetBuffer());
78*cdf0e10cSrcweir     return rc;
79*cdf0e10cSrcweir }
80*cdf0e10cSrcweir /*****************************************************************************/
81*cdf0e10cSrcweir sal_Bool PFormEntrys::GetText( ByteString &rReturn,
82*cdf0e10cSrcweir     sal_uInt16 nTyp, const ByteString &nLangIndex, sal_Bool bDel )
83*cdf0e10cSrcweir {
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir     sal_Bool bReturn=sal_True;
86*cdf0e10cSrcweir     switch ( nTyp ) {
87*cdf0e10cSrcweir         case STRING_TYP_TEXT :
88*cdf0e10cSrcweir             rReturn = sText[ nLangIndex ];
89*cdf0e10cSrcweir             if ( bDel )
90*cdf0e10cSrcweir                 sText[ nLangIndex ] = "";
91*cdf0e10cSrcweir             bReturn = bTextFirst[ nLangIndex ];
92*cdf0e10cSrcweir             bTextFirst[ nLangIndex ] = sal_False;
93*cdf0e10cSrcweir             break;
94*cdf0e10cSrcweir         case STRING_TYP_HELPTEXT :
95*cdf0e10cSrcweir             rReturn = sHelpText;
96*cdf0e10cSrcweir             break;
97*cdf0e10cSrcweir         case STRING_TYP_QUICKHELPTEXT :
98*cdf0e10cSrcweir             rReturn = sQuickHelpText[ nLangIndex ];
99*cdf0e10cSrcweir             if ( bDel )
100*cdf0e10cSrcweir                 sQuickHelpText[ nLangIndex ] = "";
101*cdf0e10cSrcweir             bReturn = bQuickHelpTextFirst[ nLangIndex ];
102*cdf0e10cSrcweir             bQuickHelpTextFirst[ nLangIndex ] = sal_False;
103*cdf0e10cSrcweir             break;
104*cdf0e10cSrcweir         case STRING_TYP_TITLE :
105*cdf0e10cSrcweir             rReturn = sTitle[ nLangIndex ];
106*cdf0e10cSrcweir             if ( bDel )
107*cdf0e10cSrcweir                 sTitle[ nLangIndex ] = "";
108*cdf0e10cSrcweir             bReturn = bTitleFirst[ nLangIndex ];
109*cdf0e10cSrcweir             bTitleFirst[ nLangIndex ] = sal_False;
110*cdf0e10cSrcweir             break;
111*cdf0e10cSrcweir     }
112*cdf0e10cSrcweir     return bReturn;
113*cdf0e10cSrcweir }
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir 
116*cdf0e10cSrcweir //
117*cdf0e10cSrcweir // class MergeData
118*cdf0e10cSrcweir //
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir MergeData::~MergeData()
121*cdf0e10cSrcweir {
122*cdf0e10cSrcweir }
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir PFormEntrys* MergeData::GetPFormEntrys(ResData*)
125*cdf0e10cSrcweir {
126*cdf0e10cSrcweir     if( aMap.find( ByteString("HACK") ) != aMap.end() )
127*cdf0e10cSrcweir         return aMap[ ByteString("HACK") ];
128*cdf0e10cSrcweir     return NULL;
129*cdf0e10cSrcweir }
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir void MergeData::Insert(const ByteString&, PFormEntrys* pfEntrys )
132*cdf0e10cSrcweir {
133*cdf0e10cSrcweir     aMap.insert( PFormEntrysHashMap::value_type( ByteString("HACK") , pfEntrys ) );
134*cdf0e10cSrcweir }
135*cdf0e10cSrcweir 
136*cdf0e10cSrcweir ByteString MergeData::Dump(){
137*cdf0e10cSrcweir     ByteString sRet( "MergeData\n" );
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir     printf("MergeData sTyp = %s , sGid = %s , sLid =%s , sFilename = %s\n",sTyp.GetBuffer(),sGID.GetBuffer(),sLID.GetBuffer(), sFilename.GetBuffer() );
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir     PFormEntrysHashMap::const_iterator idbg;
142*cdf0e10cSrcweir     for( idbg = aMap.begin() ; idbg != aMap.end(); ++idbg )
143*cdf0e10cSrcweir     {
144*cdf0e10cSrcweir         printf("aMap[ %s ] = " ,idbg->first.GetBuffer());
145*cdf0e10cSrcweir         ( (PFormEntrys*)(idbg->second) )->Dump();
146*cdf0e10cSrcweir         printf("\n");
147*cdf0e10cSrcweir     }
148*cdf0e10cSrcweir     printf("\n");
149*cdf0e10cSrcweir     return sRet;
150*cdf0e10cSrcweir }
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir PFormEntrys* MergeData::GetPFObject( const ByteString& rPFO ){
153*cdf0e10cSrcweir     if( aMap.find( ByteString("HACK") ) != aMap.end() )
154*cdf0e10cSrcweir         return aMap[ rPFO ];
155*cdf0e10cSrcweir     return NULL;
156*cdf0e10cSrcweir }
157*cdf0e10cSrcweir 
158*cdf0e10cSrcweir 
159*cdf0e10cSrcweir PFormEntrys *MergeData::InsertEntry( const ByteString &rPForm )
160*cdf0e10cSrcweir {
161*cdf0e10cSrcweir     PFormEntrys* pFEntrys = new PFormEntrys( rPForm );
162*cdf0e10cSrcweir     aMap.insert( PFormEntrysHashMap::value_type( rPForm , pFEntrys ) );
163*cdf0e10cSrcweir     return pFEntrys;
164*cdf0e10cSrcweir }
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir sal_Bool MergeData::operator==( ResData *pData )
167*cdf0e10cSrcweir {
168*cdf0e10cSrcweir     ByteString sResTyp_upper( pData->sResTyp );
169*cdf0e10cSrcweir     sResTyp_upper.ToUpperAscii();
170*cdf0e10cSrcweir     ByteString sTyp_upper( sTyp );
171*cdf0e10cSrcweir     sTyp_upper.ToUpperAscii();
172*cdf0e10cSrcweir 
173*cdf0e10cSrcweir     return (( pData->sId == sLID ) &&
174*cdf0e10cSrcweir             ( pData->sGId == sGID ) &&
175*cdf0e10cSrcweir             ( sResTyp_upper  ==  sTyp_upper )
176*cdf0e10cSrcweir             );
177*cdf0e10cSrcweir }
178*cdf0e10cSrcweir 
179*cdf0e10cSrcweir //
180*cdf0e10cSrcweir // class MergeDataFile
181*cdf0e10cSrcweir //
182*cdf0e10cSrcweir 
183*cdf0e10cSrcweir #define FFORMAT_UNKNOWN 0x0000
184*cdf0e10cSrcweir #define FFORMAT_NEW     0x0001
185*cdf0e10cSrcweir #define FFORMAT_OLD     0x0002
186*cdf0e10cSrcweir 
187*cdf0e10cSrcweir 
188*cdf0e10cSrcweir MergeDataFile::MergeDataFile(
189*cdf0e10cSrcweir     const ByteString &rFileName,
190*cdf0e10cSrcweir     const ByteString& sFile,
191*cdf0e10cSrcweir     sal_Bool bErrLog,
192*cdf0e10cSrcweir     CharSet aCharSet,
193*cdf0e10cSrcweir     bool bCaseSensitive)
194*cdf0e10cSrcweir     : bErrorLog( bErrLog )
195*cdf0e10cSrcweir {
196*cdf0e10cSrcweir     SvFileStream aInputStream( String( rFileName, RTL_TEXTENCODING_ASCII_US ), STREAM_STD_READ );
197*cdf0e10cSrcweir     aInputStream.SetStreamCharSet( aCharSet );
198*cdf0e10cSrcweir     ByteString sLine;
199*cdf0e10cSrcweir     const ByteString sHACK("HACK");
200*cdf0e10cSrcweir     const ::rtl::OString sFileNormalized(lcl_NormalizeFilename(sFile));
201*cdf0e10cSrcweir     const bool isFileEmpty = sFileNormalized.getLength();
202*cdf0e10cSrcweir 
203*cdf0e10cSrcweir     if( !aInputStream.IsOpen() )
204*cdf0e10cSrcweir     {
205*cdf0e10cSrcweir         printf("Warning : Can't open %s\n", rFileName.GetBuffer());
206*cdf0e10cSrcweir         return;
207*cdf0e10cSrcweir     }
208*cdf0e10cSrcweir     while ( !aInputStream.IsEof())
209*cdf0e10cSrcweir     {
210*cdf0e10cSrcweir         xub_StrLen nToks;
211*cdf0e10cSrcweir         aInputStream.ReadLine( sLine );
212*cdf0e10cSrcweir         sLine = sLine.Convert( RTL_TEXTENCODING_MS_1252, aCharSet );
213*cdf0e10cSrcweir 
214*cdf0e10cSrcweir         nToks = sLine.GetTokenCount( '\t' );
215*cdf0e10cSrcweir         if ( nToks == 15 )
216*cdf0e10cSrcweir         {
217*cdf0e10cSrcweir             // Skip all wrong filenames
218*cdf0e10cSrcweir             const ::rtl::OString filename = lcl_NormalizeFilename(sLine.GetToken( 1 , '\t' ));
219*cdf0e10cSrcweir             if(isFileEmpty || sFileNormalized.equals("") || (!isFileEmpty && filename.equals(sFileNormalized)) )
220*cdf0e10cSrcweir             {
221*cdf0e10cSrcweir                 xub_StrLen rIdx = 0;
222*cdf0e10cSrcweir                 const ByteString sTYP = sLine.GetToken( 3, '\t', rIdx );
223*cdf0e10cSrcweir                 const ByteString sGID = sLine.GetToken( 0, '\t', rIdx ); // 4
224*cdf0e10cSrcweir                 const ByteString sLID = sLine.GetToken( 0, '\t', rIdx ); // 5
225*cdf0e10cSrcweir                 ByteString sPFO = sLine.GetToken( 1, '\t', rIdx ); // 7
226*cdf0e10cSrcweir                 sPFO = sHACK;
227*cdf0e10cSrcweir                 ByteString nLANG = sLine.GetToken( 1, '\t', rIdx ); // 9
228*cdf0e10cSrcweir                 nLANG.EraseLeadingAndTrailingChars();
229*cdf0e10cSrcweir                 const ByteString sTEXT = sLine.GetToken( 0, '\t', rIdx ); // 10
230*cdf0e10cSrcweir                 const ByteString sQHTEXT = sLine.GetToken( 1, '\t', rIdx ); // 12
231*cdf0e10cSrcweir                 const ByteString sTITLE = sLine.GetToken( 0, '\t', rIdx );  // 13
232*cdf0e10cSrcweir 
233*cdf0e10cSrcweir 
234*cdf0e10cSrcweir #ifdef MERGE_SOURCE_LANGUAGES
235*cdf0e10cSrcweir                 if( true )
236*cdf0e10cSrcweir #else
237*cdf0e10cSrcweir                 if( !nLANG.EqualsIgnoreCaseAscii("en-US") )
238*cdf0e10cSrcweir #endif
239*cdf0e10cSrcweir                 {
240*cdf0e10cSrcweir                     aLanguageSet.insert(nLANG);
241*cdf0e10cSrcweir                     InsertEntry( sTYP, sGID, sLID, sPFO, nLANG, sTEXT, sQHTEXT, sTITLE, filename, bCaseSensitive );
242*cdf0e10cSrcweir                 }
243*cdf0e10cSrcweir             }
244*cdf0e10cSrcweir         }
245*cdf0e10cSrcweir         else if ( nToks == 10 )
246*cdf0e10cSrcweir         {
247*cdf0e10cSrcweir             printf("ERROR: File format is obsolete and no longer supported!\n");
248*cdf0e10cSrcweir         }
249*cdf0e10cSrcweir     }
250*cdf0e10cSrcweir     aInputStream.Close();
251*cdf0e10cSrcweir }
252*cdf0e10cSrcweir 
253*cdf0e10cSrcweir MergeDataFile::~MergeDataFile()
254*cdf0e10cSrcweir {
255*cdf0e10cSrcweir }
256*cdf0e10cSrcweir 
257*cdf0e10cSrcweir ByteString MergeDataFile::Dump(){
258*cdf0e10cSrcweir     ByteString sRet( "MergeDataFile\n" );
259*cdf0e10cSrcweir 
260*cdf0e10cSrcweir     printf("MergeDataFile\n");
261*cdf0e10cSrcweir     MergeDataHashMap::const_iterator idbg;
262*cdf0e10cSrcweir     for( idbg = aMap.begin() ; idbg != aMap.end(); ++idbg )
263*cdf0e10cSrcweir     {
264*cdf0e10cSrcweir         printf("aMap[ %s ] = ",idbg->first.GetBuffer());
265*cdf0e10cSrcweir         ((MergeData*) (idbg->second))->Dump();
266*cdf0e10cSrcweir         printf("\n");
267*cdf0e10cSrcweir     }
268*cdf0e10cSrcweir     printf("\n");
269*cdf0e10cSrcweir     return sRet;
270*cdf0e10cSrcweir }
271*cdf0e10cSrcweir 
272*cdf0e10cSrcweir void MergeDataFile::WriteError( const ByteString &rLine )
273*cdf0e10cSrcweir {
274*cdf0e10cSrcweir     if ( bErrorLog )
275*cdf0e10cSrcweir     {
276*cdf0e10cSrcweir         if ( !aErrLog.IsOpen())
277*cdf0e10cSrcweir             aErrLog.Open( String( sErrorLog, RTL_TEXTENCODING_ASCII_US ), STREAM_STD_WRITE | STREAM_TRUNC );
278*cdf0e10cSrcweir         aErrLog.WriteLine( rLine );
279*cdf0e10cSrcweir     }
280*cdf0e10cSrcweir     else
281*cdf0e10cSrcweir         fprintf( stderr, "%s\n", rLine.GetBuffer());
282*cdf0e10cSrcweir }
283*cdf0e10cSrcweir 
284*cdf0e10cSrcweir std::vector<ByteString> MergeDataFile::GetLanguages(){
285*cdf0e10cSrcweir     return std::vector<ByteString>(aLanguageSet.begin(),aLanguageSet.end());
286*cdf0e10cSrcweir }
287*cdf0e10cSrcweir 
288*cdf0e10cSrcweir MergeData *MergeDataFile::GetMergeData( ResData *pResData , bool bCaseSensitive )
289*cdf0e10cSrcweir {
290*cdf0e10cSrcweir     ByteString sOldG = pResData->sGId;
291*cdf0e10cSrcweir     ByteString sOldL = pResData->sId;
292*cdf0e10cSrcweir     ByteString sGID = pResData->sGId;
293*cdf0e10cSrcweir     ByteString sLID;
294*cdf0e10cSrcweir     if(!sGID.Len())
295*cdf0e10cSrcweir         sGID = pResData->sId;
296*cdf0e10cSrcweir     else
297*cdf0e10cSrcweir         sLID = pResData->sId;
298*cdf0e10cSrcweir     pResData->sGId = sGID;
299*cdf0e10cSrcweir     pResData->sId = sLID;
300*cdf0e10cSrcweir 
301*cdf0e10cSrcweir     ByteString sKey = CreateKey( pResData->sResTyp , pResData->sGId , pResData->sId , pResData->sFilename , bCaseSensitive );
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir     if(aMap.find( sKey ) != aMap.end())
304*cdf0e10cSrcweir     {
305*cdf0e10cSrcweir         pResData->sGId = sOldG;
306*cdf0e10cSrcweir         pResData->sId = sOldL;
307*cdf0e10cSrcweir         return aMap[ sKey ];
308*cdf0e10cSrcweir     }
309*cdf0e10cSrcweir     pResData->sGId = sOldG;
310*cdf0e10cSrcweir     pResData->sId = sOldL;
311*cdf0e10cSrcweir     return NULL;
312*cdf0e10cSrcweir }
313*cdf0e10cSrcweir 
314*cdf0e10cSrcweir 
315*cdf0e10cSrcweir PFormEntrys *MergeDataFile::GetPFormEntrys( ResData *pResData )
316*cdf0e10cSrcweir {
317*cdf0e10cSrcweir     // search for requested PFormEntrys
318*cdf0e10cSrcweir     MergeData *pData = GetMergeData( pResData );
319*cdf0e10cSrcweir     if ( pData )
320*cdf0e10cSrcweir         return pData->GetPFormEntrys( pResData );
321*cdf0e10cSrcweir     return NULL;
322*cdf0e10cSrcweir }
323*cdf0e10cSrcweir 
324*cdf0e10cSrcweir PFormEntrys *MergeDataFile::GetPFormEntrysCaseSensitive( ResData *pResData )
325*cdf0e10cSrcweir {
326*cdf0e10cSrcweir     // search for requested PFormEntrys
327*cdf0e10cSrcweir     MergeData *pData = GetMergeData( pResData , true );
328*cdf0e10cSrcweir     if ( pData )
329*cdf0e10cSrcweir         return pData->GetPFormEntrys( pResData );
330*cdf0e10cSrcweir     return NULL;
331*cdf0e10cSrcweir }
332*cdf0e10cSrcweir 
333*cdf0e10cSrcweir void MergeDataFile::InsertEntry(
334*cdf0e10cSrcweir     const ByteString &rTYP, const ByteString &rGID,
335*cdf0e10cSrcweir     const ByteString &rLID, const ByteString &rPFO,
336*cdf0e10cSrcweir     const ByteString &nLANG, const ByteString &rTEXT,
337*cdf0e10cSrcweir     const ByteString &rQHTEXT, const ByteString &rTITLE ,
338*cdf0e10cSrcweir     const ByteString &rInFilename , bool bCaseSensitive
339*cdf0e10cSrcweir     )
340*cdf0e10cSrcweir {
341*cdf0e10cSrcweir     MergeData *pData;
342*cdf0e10cSrcweir 
343*cdf0e10cSrcweir     // search for MergeData
344*cdf0e10cSrcweir     ByteString sKey = CreateKey( rTYP , rGID , rLID , rInFilename , bCaseSensitive );
345*cdf0e10cSrcweir     MergeDataHashMap::const_iterator mit;
346*cdf0e10cSrcweir     mit = aMap.find( sKey );
347*cdf0e10cSrcweir     if( mit != aMap.end() )
348*cdf0e10cSrcweir     {
349*cdf0e10cSrcweir         pData = mit->second;
350*cdf0e10cSrcweir     }
351*cdf0e10cSrcweir     else
352*cdf0e10cSrcweir     {
353*cdf0e10cSrcweir         pData = new MergeData( rTYP, rGID, rLID, rInFilename );
354*cdf0e10cSrcweir         aMap.insert( MergeDataHashMap::value_type( sKey, pData ) );
355*cdf0e10cSrcweir     }
356*cdf0e10cSrcweir 
357*cdf0e10cSrcweir     PFormEntrys *pFEntrys = 0;
358*cdf0e10cSrcweir 
359*cdf0e10cSrcweir     // search for PFormEntrys
360*cdf0e10cSrcweir     pFEntrys = pData->GetPFObject( rPFO );
361*cdf0e10cSrcweir     if( !pFEntrys )
362*cdf0e10cSrcweir     {
363*cdf0e10cSrcweir         // create new PFormEntrys, cause no one exists with current properties
364*cdf0e10cSrcweir         pFEntrys = new PFormEntrys( rPFO );
365*cdf0e10cSrcweir         pData->Insert( rPFO , pFEntrys );
366*cdf0e10cSrcweir     }
367*cdf0e10cSrcweir 
368*cdf0e10cSrcweir     // finaly insert the cur string
369*cdf0e10cSrcweir     pFEntrys->InsertEntry( nLANG , rTEXT, rQHTEXT, rTITLE );
370*cdf0e10cSrcweir }
371*cdf0e10cSrcweir 
372*cdf0e10cSrcweir ByteString MergeDataFile::CreateKey( const ByteString& rTYP , const ByteString& rGID , const ByteString& rLID , const ByteString& rFilename , bool bCaseSensitive )
373*cdf0e10cSrcweir {
374*cdf0e10cSrcweir     static const ::rtl::OString sStroke('-');
375*cdf0e10cSrcweir     ::rtl::OString sKey( rTYP );
376*cdf0e10cSrcweir     sKey += sStroke;
377*cdf0e10cSrcweir     sKey += rGID;
378*cdf0e10cSrcweir     sKey += sStroke;
379*cdf0e10cSrcweir     sKey += rLID;
380*cdf0e10cSrcweir     sKey += sStroke;
381*cdf0e10cSrcweir     sKey += lcl_NormalizeFilename(rFilename);
382*cdf0e10cSrcweir     OSL_TRACE("created key: %s", sKey.getStr());
383*cdf0e10cSrcweir     if(bCaseSensitive)
384*cdf0e10cSrcweir         return sKey;         // officecfg case sensitive identifier
385*cdf0e10cSrcweir     return sKey.toAsciiUpperCase();
386*cdf0e10cSrcweir }
387