[Libreoffice-commits] core.git: oox/source

Eike Rathke erack at redhat.com
Thu Jul 4 12:09:22 PDT 2013


 oox/source/docprop/docprophandler.cxx |   18 ++----------------
 oox/source/docprop/docprophandler.hxx |    1 -
 2 files changed, 2 insertions(+), 17 deletions(-)

New commits:
commit 633ca742749ed006351d89852211fc2a8c48b523
Author: Eike Rathke <erack at redhat.com>
Date:   Thu Jul 4 21:07:26 2013 +0200

    use LanguageTag instead of mouth-painted implementation
    
    Change-Id: Idd84ce9740de179c399702f896b7d39ab321f6f7

diff --git a/oox/source/docprop/docprophandler.cxx b/oox/source/docprop/docprophandler.cxx
index 50d5d4c..85df37d 100644
--- a/oox/source/docprop/docprophandler.cxx
+++ b/oox/source/docprop/docprophandler.cxx
@@ -24,6 +24,7 @@
 #include <com/sun/star/lang/Locale.hpp>
 
 #include <osl/time.h>
+#include <i18nlangtag/languagetag.hxx>
 
 #include <vector>
 #include <boost/algorithm/string.hpp>
@@ -178,21 +179,6 @@ uno::Sequence< OUString > OOXMLDocPropHandler::GetKeywordsSet( const OUString& a
     }
     return uno::Sequence< OUString >();
 }
-// ------------------------------------------------
-lang::Locale OOXMLDocPropHandler::GetLanguage( const OUString& aChars )
-{
-    lang::Locale aResult;
-    if ( aChars.getLength() >= 2 )
-    {
-        aResult.Language = aChars.copy( 0, 2 );
-        if ( aChars.getLength() >= 5 && aChars.getStr()[2] == (sal_Unicode)'-' )
-            aResult.Country = aChars.copy( 3, 2 );
-
-        // TODO/LATER: the variant could be also detected
-    }
-
-    return aResult;
-}
 
 // ------------------------------------------------
 void OOXMLDocPropHandler::UpdateDocStatistic( const OUString& aChars )
@@ -423,7 +409,7 @@ void SAL_CALL OOXMLDocPropHandler::characters( const OUString& aChars )
 
                 case DC_TOKEN( language ):
                     if ( aChars.getLength() >= 2 )
-                        m_xDocProp->setLanguage( GetLanguage( aChars ) );
+                        m_xDocProp->setLanguage( LanguageTag( aChars).getLocale() );
                     break;
 
                 case COREPR_TOKEN( lastModifiedBy ):
diff --git a/oox/source/docprop/docprophandler.hxx b/oox/source/docprop/docprophandler.hxx
index b3e7904..00a3d38 100644
--- a/oox/source/docprop/docprophandler.hxx
+++ b/oox/source/docprop/docprophandler.hxx
@@ -62,7 +62,6 @@ public:
 
     ::com::sun::star::util::DateTime GetDateTimeFromW3CDTF( const OUString& aChars );
     ::com::sun::star::uno::Sequence< OUString > GetKeywordsSet( const OUString& aChars );
-    ::com::sun::star::lang::Locale GetLanguage( const OUString& aChars );
     void UpdateDocStatistic( const OUString& aChars );
 
     // com.sun.star.xml.sax.XFastDocumentHandler


More information about the Libreoffice-commits mailing list