[Libreoffice-commits] core.git: 10 commits - comphelper/inc comphelper/Library_comphelper.mk comphelper/Package_inc.mk comphelper/source configmgr/Library_configmgr.mk configmgr/source filter/Library_filterconfig.mk filter/source framework/source xmlhelp/Library_tvhlp1.mk xmlhelp/Library_ucpchelp1.mk xmlhelp/source
Eike Rathke
erack at redhat.com
Wed Mar 27 17:39:31 PDT 2013
comphelper/Library_comphelper.mk | 1
comphelper/Package_inc.mk | 1
comphelper/inc/comphelper/locale.hxx | 370 ----------
comphelper/source/misc/locale.cxx | 327 --------
configmgr/Library_configmgr.mk | 1
configmgr/source/configurationprovider.cxx | 20
filter/Library_filterconfig.mk | 1
filter/source/config/cache/filtercache.cxx | 4
framework/source/accelerators/acceleratorconfiguration.cxx | 18
framework/source/accelerators/documentacceleratorconfiguration.cxx | 5
framework/source/accelerators/globalacceleratorconfiguration.cxx | 7
framework/source/accelerators/moduleacceleratorconfiguration.cxx | 5
framework/source/accelerators/presethandler.cxx | 56 -
framework/source/inc/accelerators/acceleratorconfiguration.hxx | 13
framework/source/inc/accelerators/presethandler.hxx | 20
xmlhelp/Library_tvhlp1.mk | 1
xmlhelp/Library_ucpchelp1.mk | 1
xmlhelp/source/cxxhelp/provider/databases.cxx | 20
xmlhelp/source/treeview/tvread.cxx | 10
19 files changed, 83 insertions(+), 798 deletions(-)
New commits:
commit 567a3ea42caa79ecdfcce6e9eaa2eac804d85653
Author: Eike Rathke <erack at redhat.com>
Date: Thu Mar 28 01:36:40 2013 +0100
ditched now unused comphelper::Locale
Change-Id: Iddfce58d2cce01e777d51054f1a70c25ad06b15c
diff --git a/comphelper/Library_comphelper.mk b/comphelper/Library_comphelper.mk
index 93b0f3b..76e6834 100644
--- a/comphelper/Library_comphelper.mk
+++ b/comphelper/Library_comphelper.mk
@@ -90,7 +90,6 @@ $(eval $(call gb_Library_add_exception_objects,comphelper,\
comphelper/source/misc/instancelocker \
comphelper/source/misc/interaction \
comphelper/source/misc/listenernotification \
- comphelper/source/misc/locale \
comphelper/source/misc/logging \
comphelper/source/misc/mediadescriptor \
comphelper/source/misc/mimeconfighelper \
diff --git a/comphelper/Package_inc.mk b/comphelper/Package_inc.mk
index 35552f6..f03f56d 100644
--- a/comphelper/Package_inc.mk
+++ b/comphelper/Package_inc.mk
@@ -72,7 +72,6 @@ $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/streamsection.hx
$(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/accessibletexthelper.hxx,comphelper/accessibletexthelper.hxx))
$(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/accessibleselectionhelper.hxx,comphelper/accessibleselectionhelper.hxx))
$(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/serviceinfohelper.hxx,comphelper/serviceinfohelper.hxx))
-$(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/locale.hxx,comphelper/locale.hxx))
$(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/numberedcollection.hxx,comphelper/numberedcollection.hxx))
$(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/ChainablePropertySet.hxx,comphelper/ChainablePropertySet.hxx))
$(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/stl_types.hxx,comphelper/stl_types.hxx))
diff --git a/comphelper/inc/comphelper/locale.hxx b/comphelper/inc/comphelper/locale.hxx
deleted file mode 100644
index 418fff3..0000000
--- a/comphelper/inc/comphelper/locale.hxx
+++ /dev/null
@@ -1,370 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef _COMPHELPER_LOCALE_HXX_
-#define _COMPHELPER_LOCALE_HXX_
-
-#include <vector>
-#include <rtl/ustring.hxx>
-#include "comphelper/comphelperdllapi.h"
-
-namespace comphelper{
-
-/** @short A Locale object represents a specific geographical, political, or cultural region.
-
- @descr This Locale class can be used to:
- - provide the different parts of a Locale (Language, Country, Variant)
- - converting it from/to ISO formated string values (like e.g. "en-US")
- - provide some predefined (static) Locale objects
- */
-class COMPHELPER_DLLPUBLIC Locale
-{
- public:
-
- /** @short seperates LANGUAGE and COUNTRY part of an ISO formated Locale. */
- static const sal_Unicode SEPERATOR_LC;
-
- /** @short seperates COUNTRY and VARIANT part of an ISO formated Locale. */
- static const sal_Unicode SEPERATOR_CV;
-
- /** @short seperates COUNTRY and VARIANT part of an ISO formated Locale.
- @descr Its true for some linux derivates only :-( */
- static const sal_Unicode SEPERATOR_CV_LINUX;
-
- /** @short some predefined Locale objects. */
- static const Locale EN_US();
- static const Locale X_DEFAULT();
- static const Locale X_NOTRANSLATE();
-
- //-------------------------------------------
- // types
-
- public:
-
- /** @short will be throw during convertion, if a Locale cant be interpreted. */
- struct MalFormedLocaleException
- {
- public:
- ::rtl::OUString Message;
-
- MalFormedLocaleException()
- {}
-
- MalFormedLocaleException(const ::rtl::OUString& sMessage)
- : Message(sMessage)
- {}
- };
-
- //-------------------------------------------
- // member
-
- private :
-
- //---------------------------------------
- /** @short must be a valid ISO Language Code.
-
- @descr These codes are the lower-case two-letter codes as defined by ISO-639.
- You can find a full list of these codes at a number of sites, such as:
- <BR><a href ="http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt">
- http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt</a>
- */
- ::rtl::OUString m_sLanguage;
-
- //---------------------------------------
- /** @short must be a valid ISO Country Code.
- @descr These codes are the upper-case two-letter codes as defined by ISO-3166.
- You can find a full list of these codes at a number of sites, such as:
- <BR><a href="http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html">
- http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html</a>
- */
- ::rtl::OUString m_sCountry;
-
- //---------------------------------------
- /** @short Variant codes are vendor and browser-specific.
- @descr For example, use WIN for Windows, MAC for Macintosh, and POSIX for POSIX.
- Where there are two variants, separate them with an underscore, and
- put the most important one first. For example, a Traditional Spanish collation
- might be referenced, with "ES", "ES", "Traditional_WIN".
- */
- ::rtl::OUString m_sVariant;
-
- //-------------------------------------------
- // interface
-
- public :
-
- //---------------------------------------
- /** @short needed by outside users!
-
- @descr Otherwise it wouldnt be possible to use
- any instance of such Locale static ...
- */
- Locale();
-
- //---------------------------------------
- /** @short construct a Locale from an ISO formated string value.
-
- @seealso fromISO()
-
- @param sISO
- an ISO formated string value, which can be parsed and
- tokenized into a Lamnguage, Country and Variant part.
-
- @throw MalFormedLocaleException
- if conversion failed.
- */
- Locale(const ::rtl::OUString& sISO)
- throw(MalFormedLocaleException);
-
- //---------------------------------------
- /** @short construct a Locale from language, country and variant.
-
- @seealso setLanguage()
- @seealso setCountry()
- @seealso setVariant()
-
- @param sLanguage
- lowercase two-letter ISO-639 code.
-
- @param sCountry
- uppercase two-letter ISO-3166 code.
-
- @param sVariant
- vendor and browser specific code.
- */
- Locale(const ::rtl::OUString& sLanguage ,
- const ::rtl::OUString& sCountry ,
- const ::rtl::OUString& sVariant = ::rtl::OUString());
-
- //---------------------------------------
- /** @short copy constructor.
-
- @param aCopy
- the copy object.
- */
- Locale(const Locale& aCopy);
-
- //---------------------------------------
- /** @short returns the language code for this locale.
-
- @descr That will either be the empty string or
- a lowercase ISO 639 code.
-
- @return [string]
- the language code.
- */
- ::rtl::OUString getLanguage() const;
-
- //---------------------------------------
- /** @short returns the country/region code for this locale.
-
- @descr That will either be the empty string or an
- upercase ISO 3166 2-letter code.
-
- @return [string]
- the country code.
- */
- ::rtl::OUString getCountry() const;
-
- //---------------------------------------
- /** @short returns the variant code for this locale.
-
- @return [string]
- the variant code.
- */
- ::rtl::OUString getVariant() const;
-
- //---------------------------------------
- /** @short set the new language code for this locale.
-
- @descr That will either be the empty string or
- a lowercase ISO 639 code.
-
- @param sLanguage
- the language code.
- */
- void setLanguage(const ::rtl::OUString& sLanguage);
-
- //---------------------------------------
- /** @short set the new country/region code for this locale.
-
- @descr That will either be the empty string or an
- upercase ISO 3166 2-letter code.
-
- @param sCountry
- the country code.
- */
- void setCountry(const ::rtl::OUString& sCountry);
-
- //---------------------------------------
- /** @short set the new variant code for this locale.
-
- @param sVariant
- the variant code.
- */
- void setVariant(const ::rtl::OUString& sVariant);
-
- //---------------------------------------
- /** @short take over new Locale information.
-
- @seealso Locale(const ::rtl::OUString& sISO)
-
- @param sISO
- an ISO formated string value, which can be parsed and
- tokenized into a Lamnguage, Country and Variant part.
- e.g. "en-US" or "en-US_WIN"
-
- @throw MalFormedLocaleException
- if conversion failed.
- */
- void fromISO(const ::rtl::OUString& sISO)
- throw(MalFormedLocaleException);
-
- //---------------------------------------
- /** @short converts this Locale to an ISO formated string value.
-
- @descr The different parts of this Locale will be assempled
- e.g. to "en-US" or "en-US_WIN"
-
- @return [string]
- the ISO formated string.
- */
- ::rtl::OUString toISO() const;
-
- //---------------------------------------
- /** @short check, if two Locale objects are equals.
-
- @descr All parts of a Locale (means Language, Country and Variant)
- will be checked.
-
- @param aComparable
- the Locale object for compare.
-
- @return [boolean]
- TRUE if both objects uses the same values for
- Language, Country and Variant.
- */
- sal_Bool equals(const Locale& aComparable) const;
-
- //---------------------------------------
- /** @short check, if two Locale objects
- uses the same language.
-
- @descr The Country and Variant parts of a Locale
- wont be checked here.
-
- @return [boolean]
- TRUE if both objects uses the same
- Language value.
- */
- sal_Bool similar(const Locale& aComparable) const;
-
- //---------------------------------------
- /** @short search for an equal or at least for a similar
- Locale in a list of possible ones.
-
- @descr First it searches for a Locale, which is equals
- to the reference Locale.
- (means: same Language, Country, Variant)
-
- If the reference Locale couldnt be located, it will
- tried again - but we are checking for "similar" Locales then.
- (means: same Language)
-
- If no similar Locale could be located, we search
- for a Locale "en-US" inside the given Locale list.
-
- If "en-US" could not be located, we search for
- a Locale "en" inside the given list.
-
- If no "same" nor any "similar" locale could be found,
- we try "x-default" and "x-notranslate" explicitly.
- Sometimes localized variables are optimized and doesnt use
- localzation realy. E.g. in case the localized value is a fix
- product name.
-
- If no locale match till now, we use any other existing
- locale, which exists inside the set of given ones!
-
- @seealso equals()
- @seealso similar()
-
- @param lISOList
- the list of possible Locales
- (as formated ISO strings).
-
- @param sReferenceISO
- the reference Locale, which should be searched
- if its equals or similar to any Locale inside
- the provided Locale list.
-
- @return An iterator, which points to the found element
- inside the given Locale list.
- If no matching Locale could be found, it points
- to the end of the list.
-
- @throw [MalFormedLocaleException]
- if at least one ISO formated string couldnt
- be converted to a valid Locale Object.
- */
- static ::std::vector< ::rtl::OUString >::const_iterator getFallback(const ::std::vector< ::rtl::OUString >& lISOList ,
- const ::rtl::OUString& sReferenceISO)
- throw(MalFormedLocaleException);
-
- //---------------------------------------
- /** @short assign elements of another locale
- to this instance.
-
- @param rCopy
- another locale object.
- */
- void operator=(const Locale& rCopy);
-
- //---------------------------------------
- /** @short check if two Locale objects are equals.
-
- @seealso equals()
-
- @param aComparable
- the Locale object for compare.
-
- @return [boolean]
- TRUE if both objects uses the same values for
- Language, Country and Variant.
- */
- sal_Bool operator==(const Locale& aComparable) const;
-
- //---------------------------------------
- /** @short check if two Locale objects are different.
-
- @param aComparable
- the Locale object for compare.
-
- @return [boolean]
- TRUE if at least one part of such Locale
- isnt the same.
- */
- sal_Bool operator!=(const Locale& aComparable) const;
-};
-
-} // namespace salhelper
-
-#endif // _COMPHELPER_LOCALE_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/comphelper/source/misc/locale.cxx b/comphelper/source/misc/locale.cxx
deleted file mode 100644
index d1d528c..0000000
--- a/comphelper/source/misc/locale.cxx
+++ /dev/null
@@ -1,327 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <comphelper/locale.hxx>
-
-#include <rtl/ustrbuf.hxx>
-
-
-namespace comphelper{
-
-//-----------------------------------------------
-const sal_Unicode Locale::SEPERATOR_LC = (sal_Unicode)'-';
-const sal_Unicode Locale::SEPERATOR_CV = (sal_Unicode)'_';
-const sal_Unicode Locale::SEPERATOR_CV_LINUX = (sal_Unicode)'.';
-
-//-----------------------------------------------
-const Locale Locale::X_DEFAULT()
-{
- return Locale(::rtl::OUString("x"), ::rtl::OUString("default"));
-}
-
-//-----------------------------------------------
-const Locale Locale::EN_US()
-{
- return Locale(::rtl::OUString("en"), ::rtl::OUString("US"));
-}
-
-//-----------------------------------------------
-const Locale Locale::X_NOTRANSLATE()
-{
- return Locale(::rtl::OUString("x"), ::rtl::OUString("notranslate"));
-}
-
-//-----------------------------------------------
-Locale::Locale(const ::rtl::OUString& sISO)
- throw(Locale::MalFormedLocaleException)
-{
- fromISO(sISO);
-}
-
-//-----------------------------------------------
-Locale::Locale(const ::rtl::OUString& sLanguage,
- const ::rtl::OUString& sCountry ,
- const ::rtl::OUString& sVariant )
-{
- // Use set methods to check values too!
- setLanguage(sLanguage);
- setCountry (sCountry );
- setVariant (sVariant );
-}
-
-//-----------------------------------------------
-Locale::Locale()
-{
- // Initialize instance ... otherwise user will
- // may be get exceptions if he e.g. copy this instance ...
- (*this) = X_NOTRANSLATE();
-}
-
-//-----------------------------------------------
-Locale::Locale(const Locale& aCopy)
-{
- (*this) = aCopy; // recycle assign operator
-}
-
-//-----------------------------------------------
-::rtl::OUString Locale::getLanguage() const
-{
- return m_sLanguage;
-}
-
-//-----------------------------------------------
-::rtl::OUString Locale::getCountry() const
-{
- return m_sCountry;
-}
-
-//-----------------------------------------------
-::rtl::OUString Locale::getVariant() const
-{
- return m_sVariant;
-}
-
-//-----------------------------------------------
-void Locale::setLanguage(const ::rtl::OUString& sLanguage)
-{
- m_sLanguage = sLanguage;
-}
-
-//-----------------------------------------------
-void Locale::setCountry(const ::rtl::OUString& sCountry)
-{
- m_sCountry = sCountry;
-}
-
-//-----------------------------------------------
-void Locale::setVariant(const ::rtl::OUString& sVariant)
-{
- m_sVariant = sVariant;
-}
-
-//-----------------------------------------------
-/* Attention: Use own interface methods to set the
- different parts of this locale. Because the
- check the incoming value and throw an exception
- automaticly ...
- */
-void Locale::fromISO(const ::rtl::OUString& sISO)
- throw(Locale::MalFormedLocaleException)
-{
- m_sLanguage = "";
- m_sCountry = "";
- m_sVariant = "";
-
- ::rtl::OUString sParser(sISO);
- sParser = sParser.trim();
-
- sal_Int32 nStart = 0;
- sal_Int32 nEnd = 0;
-
- // extract language part
- nEnd = sParser.indexOf(SEPERATOR_LC, nStart);
- if (nEnd<0)
- {
- setLanguage(sParser);
- return;
- }
- setLanguage(sParser.copy(nStart, nEnd-nStart));
- nStart = nEnd+1;
-
- // extract country
- nEnd = sParser.indexOf(SEPERATOR_CV, nStart);
- if (nEnd<0)
- nEnd = sParser.indexOf(SEPERATOR_CV_LINUX, nStart);
- if (nEnd<0)
- {
- setCountry(sParser.copy(nStart, sParser.getLength()-nStart));
- return;
- }
- nStart = nEnd+1;
-
- // extract variant
- setVariant(sParser.copy(nStart, sParser.getLength()-nStart));
-}
-
-//-----------------------------------------------
-::rtl::OUString Locale::toISO() const
-{
- ::rtl::OUStringBuffer sISO(64);
-
- sISO.append(m_sLanguage);
- if (!m_sCountry.isEmpty())
- {
- sISO.append(SEPERATOR_LC);
- sISO.append(m_sCountry);
-
- if (!m_sVariant.isEmpty())
- {
- sISO.append(SEPERATOR_CV);
- sISO.append(m_sVariant);
- }
- }
-
- return sISO.makeStringAndClear();
-}
-
-//-----------------------------------------------
-sal_Bool Locale::equals(const Locale& aComparable) const
-{
- return (
- m_sLanguage.equals(aComparable.m_sLanguage) &&
- m_sCountry.equals (aComparable.m_sCountry ) &&
- m_sVariant.equals (aComparable.m_sVariant )
- );
-}
-
-//-----------------------------------------------
-sal_Bool Locale::similar(const Locale& aComparable) const
-{
- return (m_sLanguage.equals(aComparable.m_sLanguage));
-}
-
-//-----------------------------------------------
-::std::vector< ::rtl::OUString >::const_iterator Locale::getFallback(const ::std::vector< ::rtl::OUString >& lISOList ,
- const ::rtl::OUString& sReferenceISO)
- throw(Locale::MalFormedLocaleException)
-{
- Locale aReference(sReferenceISO);
-
- // Note: The same language or "en"/"en-US" should be preferred as fallback.
- // On the other side some localized variables doesnt use localzation in real.
- // May be the use a "fix" value only ... marked as X-DEFAULT or X-NOTRANSLATE.
- // At least it can be discussed, if any language is a valid fallback ...
- // But in case some office functionality depends on that (that means real functionality instead
- // of pure UI descriptions) we should do anything, so it can work.
-
- ::std::vector< ::rtl::OUString >::const_iterator pSimilar = lISOList.end();
- ::std::vector< ::rtl::OUString >::const_iterator pEN_US = lISOList.end();
- ::std::vector< ::rtl::OUString >::const_iterator pEN = lISOList.end();
- ::std::vector< ::rtl::OUString >::const_iterator pXDefault = lISOList.end();
- ::std::vector< ::rtl::OUString >::const_iterator pXNoTranslate = lISOList.end();
- ::std::vector< ::rtl::OUString >::const_iterator pAny = lISOList.end();
-
- ::std::vector< ::rtl::OUString >::const_iterator pIt;
- for ( pIt = lISOList.begin();
- pIt != lISOList.end() ;
- ++pIt )
- {
- Locale aCheck(*pIt);
- // found Locale, which match with 100% => return it
- if (aCheck.equals(aReference))
- return pIt;
-
- // found similar Locale => safe it as possible fallback
- if (
- (pSimilar == lISOList.end()) &&
- (aCheck.similar(aReference))
- )
- {
- pSimilar = pIt;
- }
- else
- // found en-US => safe it as fallback
- if (
- (pEN_US == lISOList.end()) &&
- (aCheck.equals(EN_US()) )
- )
- {
- pEN_US = pIt;
- }
- else
- // found en[-XX] => safe it as fallback
- if (
- (pEN == lISOList.end() ) &&
- (aCheck.similar(EN_US()))
- )
- {
- pEN = pIt;
- }
- else
- // found an explicit default value(!) => safe it as fallback
- if (
- (pXDefault == lISOList.end()) &&
- (aCheck.equals(X_DEFAULT()) )
- )
- {
- pXDefault = pIt;
- }
- else
- // found an implicit default value(!) => safe it as fallback
- if (
- (pXNoTranslate == lISOList.end()) &&
- (aCheck.equals(X_NOTRANSLATE()) )
- )
- {
- pXNoTranslate = pIt;
- }
- else
- // safe the first locale, which isn't an explicit fallback
- // as "last possible fallback"
- if (pAny == lISOList.end())
- pAny = pIt;
- }
-
- if (pSimilar != lISOList.end())
- return pSimilar;
-
- if (pEN_US != lISOList.end())
- return pEN_US;
-
- if (pEN != lISOList.end())
- return pEN;
-
- if (pXDefault != lISOList.end())
- return pXDefault;
-
- if (pXNoTranslate != lISOList.end())
- return pXNoTranslate;
-
- if (pAny != lISOList.end())
- return pAny;
-
- return lISOList.end();
-}
-
-//-----------------------------------------------
-void Locale::operator=(const Locale& rCopy)
-{
- // Take over these values without checking ...
- // They was already checked if the copy was constructed
- // and must be valid now!
- m_sLanguage = rCopy.m_sLanguage;
- m_sCountry = rCopy.m_sCountry;
- m_sVariant = rCopy.m_sVariant;
-}
-
-//-----------------------------------------------
-sal_Bool Locale::operator==(const Locale& aComparable) const
-{
- return equals(aComparable);
-}
-
-//-----------------------------------------------
-sal_Bool Locale::operator!=(const Locale& aComparable) const
-{
- return !equals(aComparable);
-}
-
-} // namespace comphelper
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 876cb832e2ef4eca09899c9484b1ffdaab6c4a0e
Author: Eike Rathke <erack at redhat.com>
Date: Thu Mar 28 01:08:17 2013 +0100
unused comphelper/locale.hxx
Change-Id: I7f554c04b7697bc847dc44b88dfec8eab63941f6
diff --git a/filter/source/config/cache/filtercache.cxx b/filter/source/config/cache/filtercache.cxx
index c16ef1d..2ca1296 100644
--- a/filter/source/config/cache/filtercache.cxx
+++ b/filter/source/config/cache/filtercache.cxx
@@ -40,7 +40,6 @@
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/document/CorruptedFilterConfigurationException.hpp>
#include <comphelper/sequenceasvector.hxx>
-#include <comphelper/locale.hxx>
#include <comphelper/processfactory.hxx>
#include <unotools/configpaths.hxx>
commit 7d33da474ce15133ba651c3295dd55f612415021
Author: Eike Rathke <erack at redhat.com>
Date: Thu Mar 28 01:07:13 2013 +0100
unused comphelper/locale.hxx
Change-Id: I54958974b01d753dcb2cb797dbb028aa51a7a765
diff --git a/configmgr/source/configurationprovider.cxx b/configmgr/source/configurationprovider.cxx
index c9f75dc..2f6f075 100644
--- a/configmgr/source/configurationprovider.cxx
+++ b/configmgr/source/configurationprovider.cxx
@@ -43,7 +43,6 @@
#include "com/sun/star/util/XFlushable.hpp"
#include "com/sun/star/util/XRefreshListener.hpp"
#include "com/sun/star/util/XRefreshable.hpp"
-#include "comphelper/locale.hxx"
#include "cppu/unotype.hxx"
#include "cppuhelper/compbase5.hxx"
#include "cppuhelper/factory.hxx"
commit 25010515d9617bf6955ac187792244958257b2a9
Author: Eike Rathke <erack at redhat.com>
Date: Thu Mar 28 01:03:22 2013 +0100
use LanguageTag instead of comphelper::Locale
Change-Id: I6e5e85e2c81030f9b599e3ade416ba25f7be4e5e
diff --git a/configmgr/source/configurationprovider.cxx b/configmgr/source/configurationprovider.cxx
index bd84e8c..c9f75dc 100644
--- a/configmgr/source/configurationprovider.cxx
+++ b/configmgr/source/configurationprovider.cxx
@@ -332,8 +332,7 @@ void Service::setLocale(css::lang::Locale const & eLocale)
throw (css::uno::RuntimeException)
{
osl::MutexGuard guard(*lock_);
- locale_ = comphelper::Locale(
- eLocale.Language, eLocale.Country, eLocale.Variant).toISO();
+ locale_ = LanguageTag( eLocale).getBcp47();
}
css::lang::Locale Service::getLocale() throw (css::uno::RuntimeException) {
commit bcc73432eefc08421f6ee16b3c179cba3add636a
Author: Eike Rathke <erack at redhat.com>
Date: Thu Mar 28 01:00:10 2013 +0100
use LanguageTag instead of comphelper::Locale
Change-Id: Id8239b3e34c343fc114a66ab9216c179b1746d56
diff --git a/xmlhelp/Library_tvhlp1.mk b/xmlhelp/Library_tvhlp1.mk
index 5607920..95c63cb 100644
--- a/xmlhelp/Library_tvhlp1.mk
+++ b/xmlhelp/Library_tvhlp1.mk
@@ -42,6 +42,7 @@ $(eval $(call gb_Library_use_libraries,tvhlp1,\
cppuhelper \
sal \
utl \
+ i18nisolang1 \
))
$(eval $(call gb_Library_add_exception_objects,tvhlp1,\
diff --git a/xmlhelp/Library_ucpchelp1.mk b/xmlhelp/Library_ucpchelp1.mk
index 5472eaa..3d7d057 100644
--- a/xmlhelp/Library_ucpchelp1.mk
+++ b/xmlhelp/Library_ucpchelp1.mk
@@ -71,6 +71,7 @@ $(eval $(call gb_Library_use_libraries,ucpchelp1,\
sal \
ucbhelper \
utl \
+ i18nisolang1 \
))
$(eval $(call gb_Library_add_exception_objects,ucpchelp1,\
diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx
index 8660b53..c875840 100644
--- a/xmlhelp/source/cxxhelp/provider/databases.cxx
+++ b/xmlhelp/source/cxxhelp/provider/databases.cxx
@@ -50,7 +50,7 @@
#include <com/sun/star/uri/UriReferenceFactory.hpp>
#include <com/sun/star/uri/XVndSunStarExpandUrl.hpp>
#include <com/sun/star/script/XInvocation.hpp>
-#include <comphelper/locale.hxx>
+#include <i18npool/languagetag.hxx>
#include <com/sun/star/awt/XToolkit.hpp>
#include <com/sun/star/awt/XExtendedToolkit.hpp>
@@ -648,6 +648,8 @@ Databases::getCollator( const rtl::OUString& Language,
else if( langStr.compareToAscii("ko") == 0 )
countryStr = rtl::OUString("KR");
}
+ /* FIXME-BCP47: all this does not look right for language tag context,
+ * also check processLang() and country() methods */
it->second->loadDefaultCollator( Locale( langStr,
countryStr,
rtl::OUString() ),
@@ -1491,13 +1493,7 @@ rtl::OUString ExtensionIteratorBase::implGetFileFromPackage(
::std::vector< ::rtl::OUString > av;
implGetLanguageVectorFromPackage( av, xPackage );
- ::std::vector< ::rtl::OUString >::const_iterator pFound = av.end();
- try
- {
- pFound = ::comphelper::Locale::getFallback( av, m_aLanguage );
- }
- catch( ::comphelper::Locale::MalFormedLocaleException& )
- {}
+ ::std::vector< ::rtl::OUString >::const_iterator pFound = LanguageTag::getFallback( av, m_aLanguage );
if( pFound != av.end() )
aLanguage = *pFound;
}
@@ -1634,13 +1630,7 @@ helpdatafileproxy::Hdf* DataBaseIterator::implGetHdfFromPackage( Reference< depl
{
::std::vector< ::rtl::OUString > av;
implGetLanguageVectorFromPackage( av, xPackage );
- ::std::vector< ::rtl::OUString >::const_iterator pFound = av.end();
- try
- {
- pFound = ::comphelper::Locale::getFallback( av, m_aLanguage );
- }
- catch( ::comphelper::Locale::MalFormedLocaleException& )
- {}
+ ::std::vector< ::rtl::OUString >::const_iterator pFound = LanguageTag::getFallback( av, m_aLanguage );
if( pFound != av.end() )
{
aUsedLanguage = *pFound;
diff --git a/xmlhelp/source/treeview/tvread.cxx b/xmlhelp/source/treeview/tvread.cxx
index b47a2ab..30800a0 100644
--- a/xmlhelp/source/treeview/tvread.cxx
+++ b/xmlhelp/source/treeview/tvread.cxx
@@ -34,7 +34,7 @@
#include <com/sun/star/util/theMacroExpander.hpp>
#include <com/sun/star/uri/UriReferenceFactory.hpp>
#include <com/sun/star/uri/XVndSunStarExpandUrl.hpp>
-#include <comphelper/locale.hxx>
+#include <i18npool/languagetag.hxx>
#include <comphelper/string.hxx>
namespace treeview {
@@ -1324,13 +1324,7 @@ rtl::OUString TreeFileIterator::implGetTreeFileFromPackage
::std::vector< ::rtl::OUString > av;
implGetLanguageVectorFromPackage( av, xPackage );
- ::std::vector< ::rtl::OUString >::const_iterator pFound = av.end();
- try
- {
- pFound = ::comphelper::Locale::getFallback( av, m_aLanguage );
- }
- catch( ::comphelper::Locale::MalFormedLocaleException& )
- {}
+ ::std::vector< ::rtl::OUString >::const_iterator pFound = LanguageTag::getFallback( av, m_aLanguage );
if( pFound != av.end() )
aLanguage = *pFound;
}
commit 2ac8508a2fd538183953dfa0a283c8c829bb066f
Author: Eike Rathke <erack at redhat.com>
Date: Thu Mar 28 00:44:33 2013 +0100
we really don't need to assign the same value again
... to be extra sure?
Change-Id: I00d6cfafe5419b01e3e827377be030b5d1a4ee34
diff --git a/framework/source/accelerators/presethandler.cxx b/framework/source/accelerators/presethandler.cxx
index 7e50028..304f92f 100644
--- a/framework/source/accelerators/presethandler.cxx
+++ b/framework/source/accelerators/presethandler.cxx
@@ -807,6 +807,12 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::impl_openPathIgnoring
if (bAllowFallbacks)
{
pFound = LanguageTag::getFallback(lLocalizedValues, rLanguageTag);
+ // if we found a valid locale ... take it over to our in/out parameter
+ // rLanguageTag
+ if (pFound != lLocalizedValues.end())
+ {
+ rLanguageTag = *pFound;
+ }
}
else
{
@@ -819,12 +825,6 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::impl_openPathIgnoring
}
}
- // if we found a valid locale ... take it over to our in/out parameter rLanguageTag
- if (pFound != lLocalizedValues.end())
- {
- rLanguageTag = *pFound;
- }
-
return pFound;
}
commit 3106c4d37f70114c41ceca1213f12eb1bc0f92d4
Author: Eike Rathke <erack at redhat.com>
Date: Thu Mar 28 00:39:06 2013 +0100
eliminated useless back and forth conversion
Why convert back and forth between LanguageTag (formerly
comphelper::Locale) if all you need and use is a BCP47 string.
Change-Id: I1ec12186284211bcd7d115ee092c195b926e7cd0
diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx
index c7a5f4e..2a0330d 100644
--- a/framework/source/accelerators/acceleratorconfiguration.cxx
+++ b/framework/source/accelerators/acceleratorconfiguration.cxx
@@ -53,7 +53,6 @@
#include <unotools/configpaths.hxx>
#include <rtl/logfile.hxx>
#include <svtools/acceleratorexecute.hxx>
-#include <i18npool/languagetag.hxx>
#include <stdio.h>
@@ -608,7 +607,7 @@ AcceleratorCache& XMLBasedAcceleratorConfiguration::impl_getCFG(sal_Bool bWriteA
}
//-----------------------------------------------
-LanguageTag XMLBasedAcceleratorConfiguration::impl_ts_getLocale() const
+OUString XMLBasedAcceleratorConfiguration::impl_ts_getLocale() const
{
// SAFE -> ----------------------------------
ReadGuard aReadLock(m_aLock);
@@ -623,8 +622,8 @@ LanguageTag XMLBasedAcceleratorConfiguration::impl_ts_getLocale() const
xProp->getPropertyValue("ooLocale") >>= sISOLocale;
if (sISOLocale.isEmpty())
- return LanguageTag( LANGUAGE_ENGLISH_US);
- return LanguageTag(sISOLocale);
+ return OUString("en-US");
+ return sISOLocale;
}
/*******************************************************************************
@@ -1264,7 +1263,7 @@ void XCUBasedAcceleratorConfiguration::impl_ts_load( sal_Bool bPreferred, const
xModules->getByName(m_sModuleCFG) >>= xAccess;
}
- const ::rtl::OUString sIsoLang = impl_ts_getLocale().getBcp47();
+ const ::rtl::OUString sIsoLang = impl_ts_getLocale();
const ::rtl::OUString sDefaultLocale("en-US");
css::uno::Reference< css::container::XNameAccess > xKey;
@@ -1492,7 +1491,7 @@ void XCUBasedAcceleratorConfiguration::insertKeyToConfiguration( const css::awt:
xContainer->getByName(sKey) >>= xKey;
xKey->getByName(CFG_PROP_COMMAND) >>= xCommand;
- ::rtl::OUString sLocale = impl_ts_getLocale().getBcp47();
+ ::rtl::OUString sLocale = impl_ts_getLocale();
if ( !xCommand->hasByName(sLocale) )
xCommand->insertByName(sLocale, css::uno::makeAny(sCommand));
else
@@ -1574,7 +1573,7 @@ void XCUBasedAcceleratorConfiguration::reloadChanged( const ::rtl::OUString& sPr
if (xContainer->hasByName(sKey))
{
- ::rtl::OUString sLocale = impl_ts_getLocale().getBcp47();
+ ::rtl::OUString sLocale = impl_ts_getLocale();
xContainer->getByName(sKey) >>= xKey;
xKey->getByName(CFG_PROP_COMMAND) >>= xCommand;
xCommand->getByName(sLocale) >>= sCommand;
@@ -1646,7 +1645,7 @@ AcceleratorCache& XCUBasedAcceleratorConfiguration::impl_getCFG(sal_Bool bPrefer
}
//-----------------------------------------------
-LanguageTag XCUBasedAcceleratorConfiguration::impl_ts_getLocale() const
+OUString XCUBasedAcceleratorConfiguration::impl_ts_getLocale() const
{
// SAFE -> ----------------------------------
ReadGuard aReadLock(m_aLock);
@@ -1661,8 +1660,8 @@ LanguageTag XCUBasedAcceleratorConfiguration::impl_ts_getLocale() const
xProp->getPropertyValue("ooLocale") >>= sISOLocale;
if (sISOLocale.isEmpty())
- return LanguageTag( LANGUAGE_ENGLISH_US);
- return LanguageTag(sISOLocale);
+ return OUString("en-US");
+ return sISOLocale;
}
} // namespace framework
diff --git a/framework/source/accelerators/presethandler.cxx b/framework/source/accelerators/presethandler.cxx
index d65e2fa..7e50028 100644
--- a/framework/source/accelerators/presethandler.cxx
+++ b/framework/source/accelerators/presethandler.cxx
@@ -488,7 +488,7 @@ void PresetHandler::connectToResource( PresetHandler::EConfigType
{
// First try to find the right localized set inside share layer.
// Fallbacks are allowed there.
- LanguageTag aShareLocale( rLanguageTag);
+ OUString aShareLocale( rLanguageTag.getBcp47());
::rtl::OUString sLocalizedSharePath(sRelPathShare);
sal_Bool bAllowFallbacks = sal_True ;
xShare = impl_openLocalizedPathIgnoringErrors(sLocalizedSharePath, eShareMode, sal_True , aShareLocale, bAllowFallbacks);
@@ -496,7 +496,7 @@ void PresetHandler::connectToResource( PresetHandler::EConfigType
// The try to locate the right sub dir inside user layer ... without using fallbacks!
// Normaly the corresponding sub dir should be created matching the specified locale.
// Because we allow creation of storages inside user layer by default.
- LanguageTag aUserLocale( rLanguageTag);
+ OUString aUserLocale( rLanguageTag.getBcp47());
::rtl::OUString sLocalizedUserPath(sRelPathUser);
bAllowFallbacks = sal_False ;
xUser = impl_openLocalizedPathIgnoringErrors(sLocalizedUserPath, eUserMode , sal_False, aUserLocale, bAllowFallbacks);
@@ -800,22 +800,21 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::impl_openPathIgnoring
//-----------------------------------------------
::std::vector< ::rtl::OUString >::const_iterator PresetHandler::impl_findMatchingLocalizedValue(
const ::std::vector< ::rtl::OUString >& lLocalizedValues,
- LanguageTag& rLanguageTag,
+ OUString& rLanguageTag,
sal_Bool bAllowFallbacks )
{
::std::vector< ::rtl::OUString >::const_iterator pFound = lLocalizedValues.end();
if (bAllowFallbacks)
{
- pFound = LanguageTag::getFallback(lLocalizedValues, rLanguageTag.getBcp47());
+ pFound = LanguageTag::getFallback(lLocalizedValues, rLanguageTag);
}
else
{
- OUString aCheck( rLanguageTag.getBcp47());
for ( pFound = lLocalizedValues.begin();
pFound != lLocalizedValues.end() ;
++pFound )
{
- if (*pFound == aCheck)
+ if (*pFound == rLanguageTag)
break;
}
}
@@ -823,7 +822,7 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::impl_openPathIgnoring
// if we found a valid locale ... take it over to our in/out parameter rLanguageTag
if (pFound != lLocalizedValues.end())
{
- rLanguageTag.reset( *pFound);
+ rLanguageTag = *pFound;
}
return pFound;
@@ -834,7 +833,7 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::impl_openLocalizedPat
::rtl::OUString& sPath ,
sal_Int32 eMode ,
sal_Bool bShare ,
- LanguageTag& rLanguageTag ,
+ OUString& rLanguageTag ,
sal_Bool bAllowFallback)
{
css::uno::Reference< css::embed::XStorage > xPath = impl_openPathIgnoringErrors(sPath, eMode, bShare);
@@ -857,7 +856,7 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::impl_openLocalizedPat
if (pLocaleFolder != lSubFolders.end())
sLocalizedPath += *pLocaleFolder;
else
- sLocalizedPath += rLanguageTag.getBcp47();
+ sLocalizedPath += rLanguageTag;
css::uno::Reference< css::embed::XStorage > xLocalePath = impl_openPathIgnoringErrors(sLocalizedPath, eMode, bShare);
diff --git a/framework/source/inc/accelerators/acceleratorconfiguration.hxx b/framework/source/inc/accelerators/acceleratorconfiguration.hxx
index 38889fa..a918a46 100644
--- a/framework/source/inc/accelerators/acceleratorconfiguration.hxx
+++ b/framework/source/inc/accelerators/acceleratorconfiguration.hxx
@@ -48,7 +48,6 @@
#include <cppuhelper/propshlp.hxx>
#include <cppuhelper/weak.hxx>
-#include <i18npool/languagetag.hxx>
#include <salhelper/singletonref.hxx>
//__________________________________________
@@ -210,10 +209,10 @@ class XMLBasedAcceleratorConfiguration : protected ThreadHelpBase
@descr We does not cache this value, because we are not listen
for changes on the configuration layer ...
- @return LanguageTag
- The current office locale.
+ @return OUString
+ The current office locale as BCP47 string.
*/
- LanguageTag impl_ts_getLocale() const;
+ OUString impl_ts_getLocale() const;
//______________________________________
// helper
@@ -428,10 +427,10 @@ class XCUBasedAcceleratorConfiguration : protected ThreadHelpBase
@descr We does not cache this value, because we are not listen
for changes on the configuration layer ...
- @return LanguageTag
- The current office locale.
+ @return OUString
+ The current office locale as BCP47 string.
*/
- LanguageTag impl_ts_getLocale() const;
+ OUString impl_ts_getLocale() const;
//______________________________________
// helper
diff --git a/framework/source/inc/accelerators/presethandler.hxx b/framework/source/inc/accelerators/presethandler.hxx
index c1069f3..d5325f9 100644
--- a/framework/source/inc/accelerators/presethandler.hxx
+++ b/framework/source/inc/accelerators/presethandler.hxx
@@ -455,7 +455,7 @@ class PresetHandler : private ThreadHelpBase // attention! Must be the first bas
As a negative result the special iterator lLocalizedValues.end() will be returned.
*/
::std::vector< ::rtl::OUString >::const_iterator impl_findMatchingLocalizedValue(const ::std::vector< ::rtl::OUString >& lLocalizedValues,
- LanguageTag& rLanguageTag ,
+ OUString& rLanguageTag ,
sal_Bool bAllowFallbacks );
//---------------------------------------
@@ -489,7 +489,7 @@ class PresetHandler : private ThreadHelpBase // attention! Must be the first bas
css::uno::Reference< css::embed::XStorage > impl_openLocalizedPathIgnoringErrors(::rtl::OUString& sPath ,
sal_Int32 eMode ,
sal_Bool bShare ,
- LanguageTag& rLanguageTag ,
+ OUString& rLanguageTag ,
sal_Bool bAllowFallback);
//---------------------------------------
commit 68fac46e71e954d559eeb8591383f304f3038ad6
Author: Eike Rathke <erack at redhat.com>
Date: Thu Mar 28 00:13:14 2013 +0100
use LanguageTag instead of comphelper::Locale
Change-Id: I2c6d07bbdef62fa17e9c90ca87be6e742268c54f
diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx
index 5df1ab2..c7a5f4e 100644
--- a/framework/source/accelerators/acceleratorconfiguration.cxx
+++ b/framework/source/accelerators/acceleratorconfiguration.cxx
@@ -53,6 +53,7 @@
#include <unotools/configpaths.hxx>
#include <rtl/logfile.hxx>
#include <svtools/acceleratorexecute.hxx>
+#include <i18npool/languagetag.hxx>
#include <stdio.h>
@@ -607,7 +608,7 @@ AcceleratorCache& XMLBasedAcceleratorConfiguration::impl_getCFG(sal_Bool bWriteA
}
//-----------------------------------------------
-::comphelper::Locale XMLBasedAcceleratorConfiguration::impl_ts_getLocale() const
+LanguageTag XMLBasedAcceleratorConfiguration::impl_ts_getLocale() const
{
// SAFE -> ----------------------------------
ReadGuard aReadLock(m_aLock);
@@ -622,8 +623,8 @@ AcceleratorCache& XMLBasedAcceleratorConfiguration::impl_getCFG(sal_Bool bWriteA
xProp->getPropertyValue("ooLocale") >>= sISOLocale;
if (sISOLocale.isEmpty())
- return ::comphelper::Locale::EN_US();
- return ::comphelper::Locale(sISOLocale);
+ return LanguageTag( LANGUAGE_ENGLISH_US);
+ return LanguageTag(sISOLocale);
}
/*******************************************************************************
@@ -1263,7 +1264,7 @@ void XCUBasedAcceleratorConfiguration::impl_ts_load( sal_Bool bPreferred, const
xModules->getByName(m_sModuleCFG) >>= xAccess;
}
- const ::rtl::OUString sIsoLang = impl_ts_getLocale().toISO();
+ const ::rtl::OUString sIsoLang = impl_ts_getLocale().getBcp47();
const ::rtl::OUString sDefaultLocale("en-US");
css::uno::Reference< css::container::XNameAccess > xKey;
@@ -1491,7 +1492,7 @@ void XCUBasedAcceleratorConfiguration::insertKeyToConfiguration( const css::awt:
xContainer->getByName(sKey) >>= xKey;
xKey->getByName(CFG_PROP_COMMAND) >>= xCommand;
- ::rtl::OUString sLocale = impl_ts_getLocale().toISO();
+ ::rtl::OUString sLocale = impl_ts_getLocale().getBcp47();
if ( !xCommand->hasByName(sLocale) )
xCommand->insertByName(sLocale, css::uno::makeAny(sCommand));
else
@@ -1573,7 +1574,7 @@ void XCUBasedAcceleratorConfiguration::reloadChanged( const ::rtl::OUString& sPr
if (xContainer->hasByName(sKey))
{
- ::rtl::OUString sLocale = impl_ts_getLocale().toISO();
+ ::rtl::OUString sLocale = impl_ts_getLocale().getBcp47();
xContainer->getByName(sKey) >>= xKey;
xKey->getByName(CFG_PROP_COMMAND) >>= xCommand;
xCommand->getByName(sLocale) >>= sCommand;
@@ -1645,7 +1646,7 @@ AcceleratorCache& XCUBasedAcceleratorConfiguration::impl_getCFG(sal_Bool bPrefer
}
//-----------------------------------------------
-::comphelper::Locale XCUBasedAcceleratorConfiguration::impl_ts_getLocale() const
+LanguageTag XCUBasedAcceleratorConfiguration::impl_ts_getLocale() const
{
// SAFE -> ----------------------------------
ReadGuard aReadLock(m_aLock);
@@ -1660,8 +1661,8 @@ AcceleratorCache& XCUBasedAcceleratorConfiguration::impl_getCFG(sal_Bool bPrefer
xProp->getPropertyValue("ooLocale") >>= sISOLocale;
if (sISOLocale.isEmpty())
- return ::comphelper::Locale::EN_US();
- return ::comphelper::Locale(sISOLocale);
+ return LanguageTag( LANGUAGE_ENGLISH_US);
+ return LanguageTag(sISOLocale);
}
} // namespace framework
diff --git a/framework/source/accelerators/documentacceleratorconfiguration.cxx b/framework/source/accelerators/documentacceleratorconfiguration.cxx
index 9df1772..9ef571f 100644
--- a/framework/source/accelerators/documentacceleratorconfiguration.cxx
+++ b/framework/source/accelerators/documentacceleratorconfiguration.cxx
@@ -44,6 +44,7 @@
#include <com/sun/star/xml/sax/XParser.hpp>
#include <comphelper/sequenceashashmap.hxx>
+#include <i18npool/languagetag.hxx>
namespace framework
@@ -156,7 +157,7 @@ void DocumentAcceleratorConfiguration::impl_ts_fillCache()
// get current office locale ... but dont cache it.
// Otherwise we must be listener on the configuration layer
// which seems to superflous for this small implementation .-)
- ::comphelper::Locale aLocale = impl_ts_getLocale();
+ LanguageTag aLanguageTag( impl_ts_getLocale());
// May be the current document does not contain any
// accelerator config? Handle it gracefully :-)
@@ -171,7 +172,7 @@ void DocumentAcceleratorConfiguration::impl_ts_fillCache()
PresetHandler::RESOURCETYPE_ACCELERATOR(),
::rtl::OUString(),
xDocumentRoot,
- aLocale);
+ aLanguageTag);
DocumentAcceleratorConfiguration::reload();
m_aPresetHandler.addStorageListener(this);
diff --git a/framework/source/accelerators/globalacceleratorconfiguration.cxx b/framework/source/accelerators/globalacceleratorconfiguration.cxx
index fdc1505..8389028 100644
--- a/framework/source/accelerators/globalacceleratorconfiguration.cxx
+++ b/framework/source/accelerators/globalacceleratorconfiguration.cxx
@@ -33,7 +33,7 @@
#include <com/sun/star/util/XChangesNotifier.hpp>
#include <vcl/svapp.hxx>
-#include <comphelper/locale.hxx>
+#include <i18npool/languagetag.hxx>
#include <comphelper/configurationhelper.hxx>
@@ -87,10 +87,13 @@ void SAL_CALL GlobalAcceleratorConfiguration::initialize(const css::uno::Sequenc
//-----------------------------------------------
void GlobalAcceleratorConfiguration::impl_ts_fillCache()
{
+#if 0
// get current office locale ... but dont cache it.
// Otherwise we must be listener on the configuration layer
// which seems to superflous for this small implementation .-)
- ::comphelper::Locale aLocale = ::comphelper::Locale(m_sLocale);
+ // XXX: what is this good for? it was a comphelper::Locale but unused
+ LanguageTag aLanguageTag(m_sLocale);
+#endif
// May be there exists no accelerator config? Handle it gracefully :-)
try
diff --git a/framework/source/accelerators/moduleacceleratorconfiguration.cxx b/framework/source/accelerators/moduleacceleratorconfiguration.cxx
index 39c9b18..2a675cc 100644
--- a/framework/source/accelerators/moduleacceleratorconfiguration.cxx
+++ b/framework/source/accelerators/moduleacceleratorconfiguration.cxx
@@ -118,10 +118,13 @@ void ModuleAcceleratorConfiguration::impl_ts_fillCache()
aReadLock.unlock();
// <- SAFE ----------------------------------
+#if 0
// get current office locale ... but dont cache it.
// Otherwise we must be listener on the configuration layer
// which seems to superflous for this small implementation .-)
- ::comphelper::Locale aLocale = ::comphelper::Locale(m_sLocale);
+ // XXX: what is this good for? it was a comphelper::Locale but unused
+ LanguageTag aLanguageTag(m_sLocale);
+#endif
// May be the current app module does not have any
// accelerator config? Handle it gracefully :-)
diff --git a/framework/source/accelerators/presethandler.cxx b/framework/source/accelerators/presethandler.cxx
index a6be0dd..d65e2fa 100644
--- a/framework/source/accelerators/presethandler.cxx
+++ b/framework/source/accelerators/presethandler.cxx
@@ -38,6 +38,7 @@
#include <vcl/svapp.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <rtl/ustrbuf.hxx>
+#include <i18npool/languagetag.hxx>
#define SUBSTORAGE_GLOBAL DECLARE_ASCII("global" )
@@ -103,13 +104,14 @@ PresetHandler::PresetHandler(const css::uno::Reference< css::lang::XMultiService
, m_xSMGR (xSMGR )
, m_aSharedStorages ( )
, m_lDocumentStorages()
- , m_aLocale (::comphelper::Locale::X_NOTRANSLATE())
+ , m_aLanguageTag (LANGUAGE_USER_PRIV_NOTRANSLATE)
{
}
//-----------------------------------------------
PresetHandler::PresetHandler(const PresetHandler& rCopy)
: ThreadHelpBase (&Application::GetSolarMutex() )
+ , m_aLanguageTag( rCopy.m_aLanguageTag)
{
m_xSMGR = rCopy.m_xSMGR;
m_eConfigType = rCopy.m_eConfigType;
@@ -121,7 +123,6 @@ PresetHandler::PresetHandler(const PresetHandler& rCopy)
m_xWorkingStorageUser = rCopy.m_xWorkingStorageUser;
m_lPresets = rCopy.m_lPresets;
m_lTargets = rCopy.m_lTargets;
- m_aLocale = rCopy.m_aLocale;
m_lDocumentStorages = rCopy.m_lDocumentStorages;
m_sRelPathShare = rCopy.m_sRelPathShare;
m_sRelPathNoLang = rCopy.m_sRelPathNoLang;
@@ -371,7 +372,7 @@ void PresetHandler::connectToResource( PresetHandler::EConfigType
const ::rtl::OUString& sResource ,
const ::rtl::OUString& sModule ,
const css::uno::Reference< css::embed::XStorage >& xDocumentRoot,
- const ::comphelper::Locale& aLocale )
+ const LanguageTag& rLanguageTag )
{
// TODO free all current open storages!
@@ -381,7 +382,7 @@ void PresetHandler::connectToResource( PresetHandler::EConfigType
m_eConfigType = eConfigType ;
m_sResourceType = sResource ;
m_sModule = sModule ;
- m_aLocale = aLocale ;
+ m_aLanguageTag = rLanguageTag ;
aWriteLock.unlock();
// <- SAFE ----------------------------------
@@ -481,13 +482,13 @@ void PresetHandler::connectToResource( PresetHandler::EConfigType
sRelPathNoLang = sRelPathShare;
if (
- (aLocale != ::comphelper::Locale::X_NOTRANSLATE()) && // localized level?
+ (rLanguageTag != LanguageTag(LANGUAGE_USER_PRIV_NOTRANSLATE)) && // localized level?
(eConfigType != E_DOCUMENT ) // no localization in document mode!
)
{
// First try to find the right localized set inside share layer.
// Fallbacks are allowed there.
- ::comphelper::Locale aShareLocale = aLocale ;
+ LanguageTag aShareLocale( rLanguageTag);
::rtl::OUString sLocalizedSharePath(sRelPathShare);
sal_Bool bAllowFallbacks = sal_True ;
xShare = impl_openLocalizedPathIgnoringErrors(sLocalizedSharePath, eShareMode, sal_True , aShareLocale, bAllowFallbacks);
@@ -495,7 +496,7 @@ void PresetHandler::connectToResource( PresetHandler::EConfigType
// The try to locate the right sub dir inside user layer ... without using fallbacks!
// Normaly the corresponding sub dir should be created matching the specified locale.
// Because we allow creation of storages inside user layer by default.
- ::comphelper::Locale aUserLocale = aLocale ;
+ LanguageTag aUserLocale( rLanguageTag);
::rtl::OUString sLocalizedUserPath(sRelPathUser);
bAllowFallbacks = sal_False ;
xUser = impl_openLocalizedPathIgnoringErrors(sLocalizedUserPath, eUserMode , sal_False, aUserLocale, bAllowFallbacks);
@@ -797,48 +798,48 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::impl_openPathIgnoring
}
//-----------------------------------------------
-::std::vector< ::rtl::OUString >::const_iterator PresetHandler::impl_findMatchingLocalizedValue(const ::std::vector< ::rtl::OUString >& lLocalizedValues,
- ::comphelper::Locale& aLocale ,
- sal_Bool bAllowFallbacks )
+::std::vector< ::rtl::OUString >::const_iterator PresetHandler::impl_findMatchingLocalizedValue(
+ const ::std::vector< ::rtl::OUString >& lLocalizedValues,
+ LanguageTag& rLanguageTag,
+ sal_Bool bAllowFallbacks )
{
::std::vector< ::rtl::OUString >::const_iterator pFound = lLocalizedValues.end();
if (bAllowFallbacks)
{
- pFound = ::comphelper::Locale::getFallback(lLocalizedValues, aLocale.toISO());
+ pFound = LanguageTag::getFallback(lLocalizedValues, rLanguageTag.getBcp47());
}
else
{
+ OUString aCheck( rLanguageTag.getBcp47());
for ( pFound = lLocalizedValues.begin();
pFound != lLocalizedValues.end() ;
++pFound )
{
- const ::rtl::OUString& sCheckISO = *pFound;
- ::comphelper::Locale aCheckLocale(sCheckISO);
- if (aCheckLocale.equals(aLocale))
+ if (*pFound == aCheck)
break;
}
}
- // if we found a valid locale ... take it over to our in/out parameter aLocale
+ // if we found a valid locale ... take it over to our in/out parameter rLanguageTag
if (pFound != lLocalizedValues.end())
{
- const ::rtl::OUString& sISOLocale = *pFound;
- aLocale.fromISO(sISOLocale);
+ rLanguageTag.reset( *pFound);
}
return pFound;
}
//-----------------------------------------------
-css::uno::Reference< css::embed::XStorage > PresetHandler::impl_openLocalizedPathIgnoringErrors(::rtl::OUString& sPath ,
- sal_Int32 eMode ,
- sal_Bool bShare ,
- ::comphelper::Locale& aLocale ,
- sal_Bool bAllowFallback)
+css::uno::Reference< css::embed::XStorage > PresetHandler::impl_openLocalizedPathIgnoringErrors(
+ ::rtl::OUString& sPath ,
+ sal_Int32 eMode ,
+ sal_Bool bShare ,
+ LanguageTag& rLanguageTag ,
+ sal_Bool bAllowFallback)
{
css::uno::Reference< css::embed::XStorage > xPath = impl_openPathIgnoringErrors(sPath, eMode, bShare);
::std::vector< ::rtl::OUString > lSubFolders = impl_getSubFolderNames(xPath);
- ::std::vector< ::rtl::OUString >::const_iterator pLocaleFolder = impl_findMatchingLocalizedValue(lSubFolders, aLocale, bAllowFallback);
+ ::std::vector< ::rtl::OUString >::const_iterator pLocaleFolder = impl_findMatchingLocalizedValue(lSubFolders, rLanguageTag, bAllowFallback);
// no fallback ... creation not allowed => no storage
if (
@@ -856,7 +857,7 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::impl_openLocalizedPat
if (pLocaleFolder != lSubFolders.end())
sLocalizedPath += *pLocaleFolder;
else
- sLocalizedPath += aLocale.toISO();
+ sLocalizedPath += rLanguageTag.getBcp47();
css::uno::Reference< css::embed::XStorage > xLocalePath = impl_openPathIgnoringErrors(sLocalizedPath, eMode, bShare);
diff --git a/framework/source/inc/accelerators/acceleratorconfiguration.hxx b/framework/source/inc/accelerators/acceleratorconfiguration.hxx
index 99ba6a0..38889fa 100644
--- a/framework/source/inc/accelerators/acceleratorconfiguration.hxx
+++ b/framework/source/inc/accelerators/acceleratorconfiguration.hxx
@@ -48,7 +48,7 @@
#include <cppuhelper/propshlp.hxx>
#include <cppuhelper/weak.hxx>
-#include <comphelper/locale.hxx>
+#include <i18npool/languagetag.hxx>
#include <salhelper/singletonref.hxx>
//__________________________________________
@@ -210,10 +210,10 @@ class XMLBasedAcceleratorConfiguration : protected ThreadHelpBase
@descr We does not cache this value, because we are not listen
for changes on the configuration layer ...
- @return ::comphelper::Locale
+ @return LanguageTag
The current office locale.
*/
- ::comphelper::Locale impl_ts_getLocale() const;
+ LanguageTag impl_ts_getLocale() const;
//______________________________________
// helper
@@ -428,10 +428,10 @@ class XCUBasedAcceleratorConfiguration : protected ThreadHelpBase
@descr We does not cache this value, because we are not listen
for changes on the configuration layer ...
- @return ::comphelper::Locale
+ @return LanguageTag
The current office locale.
*/
- ::comphelper::Locale impl_ts_getLocale() const;
+ LanguageTag impl_ts_getLocale() const;
//______________________________________
// helper
diff --git a/framework/source/inc/accelerators/presethandler.hxx b/framework/source/inc/accelerators/presethandler.hxx
index 922f12a..c1069f3 100644
--- a/framework/source/inc/accelerators/presethandler.hxx
+++ b/framework/source/inc/accelerators/presethandler.hxx
@@ -31,7 +31,7 @@
#include <comphelper/processfactory.hxx>
#include <salhelper/singletonref.hxx>
-#include <comphelper/locale.hxx>
+#include <i18npool/languagetag.hxx>
namespace framework
{
@@ -203,9 +203,9 @@ class PresetHandler : private ThreadHelpBase // attention! Must be the first bas
/** @short its the current office locale and will be used
to handle localized presets.
- @descr Default is "x-notranslate" which disable any
+ @descr Default is "x-no-translate" which disable any
localized handling inside this class! */
- ::comphelper::Locale m_aLocale;
+ LanguageTag m_aLanguageTag;
//---------------------------------------
/** @short knows the relative path from the root. */
@@ -306,7 +306,7 @@ class PresetHandler : private ThreadHelpBase // attention! Must be the first bas
configuration files. Note: Thats not the real root of the document ...
its only a sub storage. But we interpret it as our root storage.
- @param aLocale
+ @param rLanguageTag
in case this configuration supports localized entries,
the current locale must be set.
@@ -325,7 +325,7 @@ class PresetHandler : private ThreadHelpBase // attention! Must be the first bas
const ::rtl::OUString& sResourceType ,
const ::rtl::OUString& sModule ,
const css::uno::Reference< css::embed::XStorage >& xDocumentRoot ,
- const ::comphelper::Locale& aLocale = ::comphelper::Locale(::comphelper::Locale::X_NOTRANSLATE()));
+ const LanguageTag& rLanguageTag = LanguageTag(LANGUAGE_USER_PRIV_NOTRANSLATE));
//---------------------------------------
/** @short try to copy the specified preset from the share
@@ -442,9 +442,9 @@ class PresetHandler : private ThreadHelpBase // attention! Must be the first bas
b) search with using fallbacks
@param lLocalizedValues
- list of ISO locale codes
+ list of BCP47 language tags / locale codes
- @param aLocale
+ @param rLanguageTag
[IN ] the current office locale, which should be searched inside lLocalizedValues.
[OUT] in case fallbacks was allowed, it contains afterwards the fallback locale.
@@ -455,7 +455,7 @@ class PresetHandler : private ThreadHelpBase // attention! Must be the first bas
As a negative result the special iterator lLocalizedValues.end() will be returned.
*/
::std::vector< ::rtl::OUString >::const_iterator impl_findMatchingLocalizedValue(const ::std::vector< ::rtl::OUString >& lLocalizedValues,
- ::comphelper::Locale& aLocale ,
+ LanguageTag& rLanguageTag ,
sal_Bool bAllowFallbacks );
//---------------------------------------
@@ -477,7 +477,7 @@ class PresetHandler : private ThreadHelpBase // attention! Must be the first bas
@param bShare
force using of the share layer instead of the user layer.
- @param aLocale
+ @param rLanguageTag
[IN ] contains the start locale for searching localized sub dirs.
[OUT] contains the locale of a found localized sub dir
@@ -489,7 +489,7 @@ class PresetHandler : private ThreadHelpBase // attention! Must be the first bas
css::uno::Reference< css::embed::XStorage > impl_openLocalizedPathIgnoringErrors(::rtl::OUString& sPath ,
sal_Int32 eMode ,
sal_Bool bShare ,
- ::comphelper::Locale& aLocale ,
+ LanguageTag& rLanguageTag ,
sal_Bool bAllowFallback);
//---------------------------------------
commit 66a63c1608cfd5e755fb141b636e4a84c118179a
Author: Eike Rathke <erack at redhat.com>
Date: Wed Mar 27 22:56:13 2013 +0100
use LanguageTag instead of comphelper::Locale
Change-Id: I628c7fdd9e14c8fdd55800aa470268abf4ed2632
diff --git a/filter/Library_filterconfig.mk b/filter/Library_filterconfig.mk
index 1a2af91..577167d 100644
--- a/filter/Library_filterconfig.mk
+++ b/filter/Library_filterconfig.mk
@@ -39,6 +39,7 @@ $(eval $(call gb_Library_use_libraries,filterconfig,\
cppu \
sal \
salhelper \
+ i18nisolang1 \
$(gb_UWINAPI) \
))
diff --git a/filter/source/config/cache/filtercache.cxx b/filter/source/config/cache/filtercache.cxx
index af342df..c16ef1d 100644
--- a/filter/source/config/cache/filtercache.cxx
+++ b/filter/source/config/cache/filtercache.cxx
@@ -49,6 +49,7 @@
#include <rtl/uri.hxx>
#include <tools/urlobj.hxx>
#include <tools/wldcrd.hxx>
+#include <i18npool/languagetag.hxx>
#include <comphelper/configurationhelper.hxx>
@@ -1631,7 +1632,7 @@ void FilterCache::impl_readPatchUINames(const css::uno::Reference< css::containe
// find right UIName for current office locale
// Use fallbacks too!
- pLocale = ::comphelper::Locale::getFallback(lLocales, sActLocale);
+ pLocale = LanguageTag::getFallback(lLocales, sActLocale);
if (pLocale == lLocales.end())
{
#if OSL_DEBUG_LEVEL > 0
commit 4f79c03ba8ca14c3b9798565272a82e4e14ac3d0
Author: Eike Rathke <erack at redhat.com>
Date: Wed Mar 27 22:49:35 2013 +0100
use LanguageTag instead of comphelper::Locale
Change-Id: I98cac783ff1db94d1d7135dd0db8ee0d809b3457
diff --git a/configmgr/Library_configmgr.mk b/configmgr/Library_configmgr.mk
index 3cd2ff1..3cc6bee 100644
--- a/configmgr/Library_configmgr.mk
+++ b/configmgr/Library_configmgr.mk
@@ -74,6 +74,7 @@ $(eval $(call gb_Library_use_libraries,configmgr, \
sal \
salhelper \
xmlreader \
+ i18nisolang1 \
$(gb_UWINAPI) \
))
diff --git a/configmgr/source/configurationprovider.cxx b/configmgr/source/configurationprovider.cxx
index 84f9456..bd84e8c 100644
--- a/configmgr/source/configurationprovider.cxx
+++ b/configmgr/source/configurationprovider.cxx
@@ -57,6 +57,8 @@
#include "rtl/ustring.h"
#include "rtl/ustring.hxx"
+#include <i18npool/languagetag.hxx>
+
#include "components.hxx"
#include "configurationprovider.hxx"
#include "lock.hxx"
@@ -337,20 +339,10 @@ void Service::setLocale(css::lang::Locale const & eLocale)
css::lang::Locale Service::getLocale() throw (css::uno::RuntimeException) {
osl::MutexGuard guard(*lock_);
css::lang::Locale loc;
- if ( locale_ == "*" ) {
+ if ( locale_ == "*" ) { /* FIXME-BCP47: WTF is this?!? */
loc.Language = locale_;
} else if (! locale_.isEmpty()) {
- try {
- comphelper::Locale l(locale_);
- loc.Language = l.getLanguage();
- loc.Country = l.getCountry();
- loc.Variant = l.getVariant();
- } catch (comphelper::Locale::MalFormedLocaleException & e) {
- throw css::uno::RuntimeException(
- (OUString("MalformedLocaleException: ") +
- e.Message),
- static_cast< cppu::OWeakObject * >(this));
- }
+ loc = LanguageTag( locale_).getLocale( false);
}
return loc;
}
More information about the Libreoffice-commits
mailing list