Issue 20771 - Thesaurus must be shared
Summary: Thesaurus must be shared
Status: CLOSED FIXED
Alias: None
Product: Infrastructure
Classification: Infrastructure
Component: Website general issues (show other issues)
Version: current
Hardware: PC Windows 2000
: P3 Trivial (vote)
Target Milestone: ---
Assignee: khendricks
QA Contact: issues@lingucomponent
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-10-06 14:23 UTC by maison.godard
Modified: 2013-02-24 20:34 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description maison.godard 2003-10-06 14:23:39 UTC
Hi Kevin
As suggested, here is the issue

Hi all,

is it a "by design" feature that thesaurus has to be instaleld in share/dict/ooo
Installing it for one user only in users/wordbook doesn't work. Thesaurus menu 
is not available

Let me know

Laurent 

Your Response
-------------
Hi,

It was an artifact left over when we only had one thesaurus to worry about.  I 
will fix this for 1.1.1 so that it can be located in either place but for OOo 
1.1.0 it must be shared.

Kevin
Comment 1 khendricks 2003-10-09 13:46:21 UTC
Hi, 
 
Targeting this one to 1.1.1 
 
Also here is a patch to allow both user and shared thesauri just as with dictioanries 
and hyphenation for approval for the 1.1.1 tree. 
 
--- thesimp.cxx.~1.13.~ 2003-06-12 06:41:13.000000000 -0400 
+++ thesimp.cxx 2003-10-09 08:35:50.000000000 -0400 
@@ -187,10 +187,23 @@ 
        MutexGuard      aGuard( GetLinguMutex() ); 
 
         dictentry * spthes;  // shared thesaurus list entry pointer 
+        dictentry * upthes;  // shared thesaurus list entry pointer 
         SvtPathOptions aPathOpt; 
+        int numusr;          // number of user dictionary entries 
+        int numshr;          // number of shared dictionary entries 
 
        if (!numthes) { 
 
+            // invoke a dictionary manager to get the user dictionary list 
+            OUString usrlst = aPathOpt.GetUserDictionaryPath() + 
A2OU("/dictionary.lst"); 
+            OUString ulst; 
+           osl::FileBase::getSystemPathFromFileURL(usrlst,ulst); 
+            OString uTmp(OU2ENC(ulst, osl_getThreadTextEncoding())); 
+           DictMgr* udMgr = new DictMgr(uTmp.getStr(),"THES"); 
+            numusr = 0; 
+            if (udMgr) 
+                 numusr = udMgr->get_list(&upthes); 
+ 
             // invoke a dictionary manager to get the shared thesaurus list 
             OUString shrlst = aPathOpt.GetLinguisticPath() + 
A2OU("/ooo/dictionary.lst"); 
             OUString slst; 
@@ -198,11 +211,14 @@ 
             OString sTmp(OU2ENC(slst, osl_getThreadTextEncoding())); 
            DictMgr* sdMgr = new DictMgr(sTmp.getStr(),"THES"); 
             if (sdMgr) 
-                 numthes = sdMgr->get_list(&spthes); 
+                 numshr = sdMgr->get_list(&spthes); 
+ 
 
-            // we are implicitly limiting thesauri to be installed in 
-            // shared locations only (no user installs) since they 
-            // are "processed files" and not text based 
+            // we really should merge these and remove duplicates but since 
+            // users can name their dictionaries anything they want it would 
+            // be impossible to know if a real duplication exists unless we 
+            // add some unique key to each dictionary 
+            numthes = numshr + numusr; 
 
             if (numthes) { 
                aThes = new ThesLookup* [numthes]; 
@@ -217,8 +233,33 @@ 
                 int i,j; 
                 int k = 0; 
 
-                // add the thesauri 
-                for (i = 0; i < numthes; i++) { 
+                //first add the user dictionaries 
+                for (i = 0; i < numusr; i++) { 
+                   Locale nLoc( A2OU(upthes->lang), A2OU(upthes->region), OUString() 
); 
+                    newloc = 1; 
+                   for (j = 0; j < numlocs; j++) { 
+                        if (nLoc == pLocale[j]) newloc = 0; 
+                    } 
+                    if (newloc) { 
+                        pLocale[numlocs] = nLoc; 
+                        numlocs++; 
+                    } 
+                    aTLocs[k] = nLoc; 
+                    aThes[k] = NULL; 
+                    const char * enc_string = get_default_enc(upthes->lang); 
+                    if (enc_string) { 
+                       aTEncs[k] = rtl_getTextEncodingFromUnixCharset(enc_string); 
+                    } else { 
+                       aTEncs[k] = rtl_getTextEncodingFromUnixCharset("ISO8859-1"); 
+                    } 
+                    aTNames[k] = aPathOpt.GetUserDictionaryPath() + A2OU("/") + 
A2OU(upthes->filename); 
+                    aCharSetInfo[k] = new CharClass(nLoc); 
+                    k++; 
+                    upthes++; 
+                } 
+ 
+                // now add the shared thesauri 
+                for (i = 0; i < numshr; i++) { 
                    Locale nLoc( A2OU(spthes->lang), A2OU(spthes->region), OUString() 
); 
                     newloc = 1; 
                    for (j = 0; j < numlocs; j++) { 
@@ -256,6 +297,11 @@ 
             } 
 
             /* de-allocation of memory is handled inside the DictMgr */ 
+            upthes = NULL; 
+            if (udMgr) { 
+                  delete udMgr; 
+                  udMgr = NULL; 
+            } 
             spthes = NULL; 
             if (sdMgr) { 
                   delete sdMgr; 
 
Comment 2 Martin Hollmichel 2003-10-09 15:22:46 UTC
mh: target approved.
Comment 3 khendricks 2003-10-10 16:27:19 UTC
Hi, 
 
Committed the fix to this to OOo 1.1.1 
 
So I am resolving this as fixed.  Please verify when OOo 1.1.1 is released and then 
close this issue. 
 
(I personally tested this by removing my thesaurus and entry in dictionary.lst from 
share/dict/ooo/ and installing them in user/wordbook/ and after restarting OOo I was 
able to access the thesaurus just fine). 
 
Kevin 
 
Comment 4 maison.godard 2003-10-10 17:26:18 UTC
Thanks a lot Kevin
Waiting for 1.1.1 ;-))

Laurent
Comment 5 Martin Hollmichel 2004-02-27 13:36:57 UTC
close issue