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