[Libreoffice-commits] core.git: 3 commits - scp2/source sw/source

David Tardon dtardon at redhat.com
Tue May 14 07:02:59 PDT 2013


 scp2/source/ooo/directory_ooo.scp        |   11 +++++
 scp2/source/ooo/module_lang_template.scp |    3 +
 sw/source/ui/inc/glosdoc.hxx             |    3 -
 sw/source/ui/misc/glosdoc.cxx            |   60 ++++++++++++++++---------------
 4 files changed, 46 insertions(+), 31 deletions(-)

New commits:
commit 16a0badd3ec3588d4a6561a3cba7992cbef6b5da
Author: David Tardon <dtardon at redhat.com>
Date:   Tue May 14 15:53:23 2013 +0200

    always create dirs for autotext files
    
    ... thus avoiding an annoing warning when a user tries to use autotext.
    
    I think we can drop DEFAULT_TO_ENGLISH_FOR_PACKING now.
    
    Change-Id: I230341c8bf1c925c51a4059b93153d5cd83d5310

diff --git a/scp2/source/ooo/directory_ooo.scp b/scp2/source/ooo/directory_ooo.scp
index 08ea22d..fda0f9c 100644
--- a/scp2/source/ooo/directory_ooo.scp
+++ b/scp2/source/ooo/directory_ooo.scp
@@ -156,6 +156,17 @@ End
 
 #endif
 
+Directory gid_Dir_Share_Autotext
+    ParentID = gid_Brand_Dir_Share;
+    DosName = "autotext";
+End
+
+Directory gid_Dir_Autotext_Language
+    ParentID = gid_Dir_Share_Autotext;
+    DIR_ISOLANGUAGE_ALL_LANG_2;
+    Styles = (CREATE);
+End
+
 Directory gid_Dir_Share_Xslt
     ParentID = gid_Brand_Dir_Share;
     DosName = "xslt";
diff --git a/scp2/source/ooo/module_lang_template.scp b/scp2/source/ooo/module_lang_template.scp
index 1b8e45f..0b51889 100644
--- a/scp2/source/ooo/module_lang_template.scp
+++ b/scp2/source/ooo/module_lang_template.scp
@@ -62,7 +62,8 @@ Module gid_Module_Langpack_Basis_Template
              gid_File_Share_Registry_Ctl_Xcd,
              gid_File_Share_Registry_Ctlseqcheck_Xcd,
              gid_File_InfoPlist_Lang);
-    Dirs = (gid_Dir_Samples_Language);
+    Dirs = (gid_Dir_Samples_Language,
+            gid_Dir_Autotext_Language);
 End
 
 Module gid_Module_Langpack_Resource_Template
commit fbed11a411eb3c013f465660c5cd3e6db0508806
Author: David Tardon <dtardon at redhat.com>
Date:   Tue May 14 14:32:08 2013 +0200

    don't accumulate dirs in error string
    
    Change-Id: Ied7437026009f07052dd07d41ba08c82bb6db295

diff --git a/sw/source/ui/inc/glosdoc.hxx b/sw/source/ui/inc/glosdoc.hxx
index 6ab31ac..a3a6c79 100644
--- a/sw/source/ui/inc/glosdoc.hxx
+++ b/sw/source/ui/inc/glosdoc.hxx
@@ -50,8 +50,7 @@ class SW_DLLPUBLIC SwGlossaries
     UnoAutoTextEntries      m_aGlossaryEntries;
 
     String                  m_aPath;
-    String                  m_sOldErrPath;
-    String                  m_sErrPath;
+    std::vector<rtl::OUString> m_aInvalidPaths;
     std::vector<String>     m_PathArr;
     std::vector<String>     m_GlosArr;
     sal_Bool                m_bError;
diff --git a/sw/source/ui/misc/glosdoc.cxx b/sw/source/ui/misc/glosdoc.cxx
index e869643..681be51 100644
--- a/sw/source/ui/misc/glosdoc.cxx
+++ b/sw/source/ui/misc/glosdoc.cxx
@@ -397,6 +397,20 @@ SwGlossaries::SwGlossaries()
     Description: set new path and recreate internal array
 ------------------------------------------------------------------------*/
 
+rtl::OUString lcl_makePath(const std::vector<rtl::OUString>& rPaths)
+{
+    std::vector<rtl::OUString>::const_iterator aIt(rPaths.begin());
+    const std::vector<rtl::OUString>::const_iterator aEnd(rPaths.end());
+    rtl::OUStringBuffer aPath(*aIt);
+    for (++aIt; aIt != aEnd; ++aIt)
+    {
+        aPath.append(SVT_SEARCHPATH_DELIMITER);
+        const INetURLObject aTemp(*aIt);
+        aPath.append(aTemp.GetFull());
+    }
+    return aPath.getStr();
+}
+
 void SwGlossaries::UpdateGlosPath(sal_Bool bFull)
 {
     SvtPathOptions aPathOpt;
@@ -410,6 +424,7 @@ void SwGlossaries::UpdateGlosPath(sal_Bool bFull)
 
         sal_uInt16 nTokenCount = comphelper::string::getTokenCount(m_aPath, SVT_SEARCHPATH_DELIMITER);
         std::vector<String> aDirArr;
+        std::vector<rtl::OUString> aInvalidPaths;
         for( sal_uInt16 i = 0; i < nTokenCount; i++ )
         {
             String sPth(m_aPath.GetToken(i, SVT_SEARCHPATH_DELIMITER));
@@ -422,26 +437,27 @@ void SwGlossaries::UpdateGlosPath(sal_Bool bFull)
             }
             aDirArr.push_back(sPth);
             if( !FStatHelper::IsFolder( sPth ) )
-            {
-                if( m_sErrPath.Len() )
-                    m_sErrPath += SVT_SEARCHPATH_DELIMITER;
-                INetURLObject aTemp( sPth );
-                m_sErrPath += String(aTemp.GetFull());
-            }
+                aInvalidPaths.push_back(sPth);
             else
                 m_PathArr.push_back(sPth);
         }
 
-        if(!nTokenCount ||
-            (m_sErrPath.Len() && (bPathChanged || m_sOldErrPath != m_sErrPath)) )
+        if(!nTokenCount || !aInvalidPaths.empty())
         {
-            m_sOldErrPath = m_sErrPath;
-            // wrong path, that means AutoText directory doesn't exist
+            std::sort(aInvalidPaths.begin(), aInvalidPaths.end());
+            aInvalidPaths.erase(std::unique(aInvalidPaths.begin(), aInvalidPaths.end()), aInvalidPaths.end());
+            if (bPathChanged || (m_aInvalidPaths != aInvalidPaths))
+            {
+                m_aInvalidPaths = aInvalidPaths;
+                // wrong path, that means AutoText directory doesn't exist
 
-            ErrorHandler::HandleError( *new StringErrorInfo(
-                                    ERR_AUTOPATH_ERROR, m_sErrPath,
-                                    ERRCODE_BUTTON_OK | ERRCODE_MSG_ERROR ));
-            m_bError = sal_True;
+                ErrorHandler::HandleError( *new StringErrorInfo(
+                                        ERR_AUTOPATH_ERROR, lcl_makePath(m_aInvalidPaths),
+                                        ERRCODE_BUTTON_OK | ERRCODE_MSG_ERROR ));
+                m_bError = sal_True;
+            }
+            else
+                m_bError = sal_False;
         }
         else
             m_bError = sal_False;
@@ -457,7 +473,7 @@ void SwGlossaries::UpdateGlosPath(sal_Bool bFull)
 void SwGlossaries::ShowError()
 {
     sal_uInt32 nPathError = *new StringErrorInfo(ERR_AUTOPATH_ERROR,
-                                            m_sErrPath, ERRCODE_BUTTON_OK );
+                                            lcl_makePath(m_aInvalidPaths), ERRCODE_BUTTON_OK );
     ErrorHandler::HandleError( nPathError );
 }
 
commit c55b08547e7f30ad76ddcdeb7cb8ed7725b2d322
Author: David Tardon <dtardon at redhat.com>
Date:   Tue May 14 14:09:18 2013 +0200

    bin dynamic alloc. nonsense
    
    Change-Id: Iaed4e27a92937ddbdb0cde783c0e3be611eec7ca

diff --git a/sw/source/ui/misc/glosdoc.cxx b/sw/source/ui/misc/glosdoc.cxx
index 38be8d4..e869643 100644
--- a/sw/source/ui/misc/glosdoc.cxx
+++ b/sw/source/ui/misc/glosdoc.cxx
@@ -18,6 +18,7 @@
  */
 
 
+#include <algorithm>
 #include <memory>
 
 #include <com/sun/star/container/XNamed.hpp>
@@ -396,17 +397,6 @@ SwGlossaries::SwGlossaries()
     Description: set new path and recreate internal array
 ------------------------------------------------------------------------*/
 
-/* --------------------------------------------------
-*   #61050# double paths cause irritation - get rid of it
- * --------------------------------------------------*/
-static bool lcl_FindSameEntry(const std::vector<String*>& rDirArr, const String& rEntryURL)
-{
-    for(std::vector<String*>::const_iterator it(rDirArr.begin()); it != rDirArr.end(); ++it)
-        if( **it == rEntryURL )
-            return true;
-    return false;
-}
-
 void SwGlossaries::UpdateGlosPath(sal_Bool bFull)
 {
     SvtPathOptions aPathOpt;
@@ -419,18 +409,18 @@ void SwGlossaries::UpdateGlosPath(sal_Bool bFull)
         m_PathArr.clear();
 
         sal_uInt16 nTokenCount = comphelper::string::getTokenCount(m_aPath, SVT_SEARCHPATH_DELIMITER);
-        std::vector<String*> aDirArr;
+        std::vector<String> aDirArr;
         for( sal_uInt16 i = 0; i < nTokenCount; i++ )
         {
             String sPth(m_aPath.GetToken(i, SVT_SEARCHPATH_DELIMITER));
             sPth = URIHelper::SmartRel2Abs(
                 INetURLObject(), sPth, URIHelper::GetMaybeFileHdl());
 
-            if(i && lcl_FindSameEntry(aDirArr, sPth))
+            if(i && std::find(aDirArr.begin(), aDirArr.end(), sPth) != aDirArr.end())
             {
                 continue;
             }
-            aDirArr.push_back(new String(sPth));
+            aDirArr.push_back(sPth);
             if( !FStatHelper::IsFolder( sPth ) )
             {
                 if( m_sErrPath.Len() )
@@ -441,8 +431,6 @@ void SwGlossaries::UpdateGlosPath(sal_Bool bFull)
             else
                 m_PathArr.push_back(sPth);
         }
-        for(std::vector<String*>::const_iterator it(aDirArr.begin()); it != aDirArr.end(); ++it)
-            delete *it;
 
         if(!nTokenCount ||
             (m_sErrPath.Len() && (bPathChanged || m_sOldErrPath != m_sErrPath)) )


More information about the Libreoffice-commits mailing list