From 8576bd17844d9c5843e84c330a7d2df79d79db7f Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 7 Dec 2011 16:34:32 +0100 Subject: Factored out common getDigitLanguage. --- drawinglayer/Library_drawinglayer.mk | 1 + .../source/processor2d/canvasprocessor.cxx | 21 ++-------- .../source/processor2d/getdigitlanguage.cxx | 49 ++++++++++++++++++++++ .../source/processor2d/getdigitlanguage.hxx | 46 ++++++++++++++++++++ drawinglayer/source/processor2d/vclprocessor2d.cxx | 22 ++-------- 5 files changed, 102 insertions(+), 37 deletions(-) create mode 100644 drawinglayer/source/processor2d/getdigitlanguage.cxx create mode 100644 drawinglayer/source/processor2d/getdigitlanguage.hxx (limited to 'drawinglayer') diff --git a/drawinglayer/Library_drawinglayer.mk b/drawinglayer/Library_drawinglayer.mk index 7b884141a68b..d2934d767443 100644 --- a/drawinglayer/Library_drawinglayer.mk +++ b/drawinglayer/Library_drawinglayer.mk @@ -153,6 +153,7 @@ $(eval $(call gb_Library_add_exception_objects,drawinglayer,\ drawinglayer/source/processor2d/baseprocessor2d \ drawinglayer/source/processor2d/canvasprocessor \ drawinglayer/source/processor2d/contourextractor2d \ + drawinglayer/source/processor2d/getdigitlanguage \ drawinglayer/source/processor2d/helperchartrenderer \ drawinglayer/source/processor2d/helperwrongspellrenderer \ drawinglayer/source/processor2d/hittestprocessor2d \ diff --git a/drawinglayer/source/processor2d/canvasprocessor.cxx b/drawinglayer/source/processor2d/canvasprocessor.cxx index 1365c5de33a3..e916b293da9f 100644 --- a/drawinglayer/source/processor2d/canvasprocessor.cxx +++ b/drawinglayer/source/processor2d/canvasprocessor.cxx @@ -36,8 +36,6 @@ #include #include #include -#include -#include #include #include #include @@ -69,6 +67,8 @@ #include #include +#include "getdigitlanguage.hxx" + ////////////////////////////////////////////////////////////////////////////// using namespace com::sun::star; @@ -969,29 +969,14 @@ namespace drawinglayer maBColorModifierStack(), maDrawinglayerOpt(), maClipPolyPolygon(), - meLang(LANGUAGE_SYSTEM) + meLang(drawinglayer::detail::getDigitLanguage()) { - const SvtCTLOptions aSvtCTLOptions; - canvas::tools::initViewState(maViewState); canvas::tools::initRenderState(maRenderState); canvas::tools::setViewStateTransform(maViewState, getViewInformation2D().getViewTransformation()); // set digit language, derived from SvtCTLOptions to have the correct // number display for arabic/hindi numerals - if(SvtCTLOptions::NUMERALS_HINDI == aSvtCTLOptions.GetCTLTextNumerals()) - { - meLang = LANGUAGE_ARABIC_SAUDI_ARABIA; - } - else if(SvtCTLOptions::NUMERALS_ARABIC == aSvtCTLOptions.GetCTLTextNumerals()) - { - meLang = LANGUAGE_ENGLISH; - } - else - { - meLang = (LanguageType)Application::GetSettings().GetLanguage(); - } - rOutDev.SetDigitLanguage(meLang); // prepare output directly to pixels diff --git a/drawinglayer/source/processor2d/getdigitlanguage.cxx b/drawinglayer/source/processor2d/getdigitlanguage.cxx new file mode 100644 index 000000000000..000588e55614 --- /dev/null +++ b/drawinglayer/source/processor2d/getdigitlanguage.cxx @@ -0,0 +1,49 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * Major Contributor(s): + * [ Copyright (C) 2011 Red Hat, Inc., Stephan Bergmann + * (initial developer) ] + * + * All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include "sal/config.h" + +#include "i18npool/lang.h" +#include "svl/ctloptions.hxx" +#include "vcl/svapp.hxx" + +#include "getdigitlanguage.hxx" + +LanguageType drawinglayer::detail::getDigitLanguage() { + switch (SvtCTLOptions().GetCTLTextNumerals()) { + case SvtCTLOptions::NUMERALS_ARABIC: + return LANGUAGE_ENGLISH; + case SvtCTLOptions::NUMERALS_HINDI: + return LANGUAGE_ARABIC_SAUDI_ARABIA; + default: + return Application::GetSettings().GetLanguage(); + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/drawinglayer/source/processor2d/getdigitlanguage.hxx b/drawinglayer/source/processor2d/getdigitlanguage.hxx new file mode 100644 index 000000000000..1f186f645be2 --- /dev/null +++ b/drawinglayer/source/processor2d/getdigitlanguage.hxx @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * Major Contributor(s): + * [ Copyright (C) 2011 Red Hat, Inc., Stephan Bergmann + * (initial developer) ] + * + * All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#ifndef INCLUDED_DRAWINGLAYER_SOURCE_PROCESSOR2D_GETDIGITLANGUAGE_HXX +#define INCLUDED_DRAWINGLAYER_SOURCE_PROCESSOR2D_GETDIGITLANGUAGE_HXX + +#include "sal/config.h" + +#include "i18npool/lang.h" + +namespace drawinglayer { namespace detail { + +/// Get digit language derived from SvtCTLOptions +LanguageType getDigitLanguage(); + +} } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 5598cde09969..d27826bd388b 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -52,8 +52,6 @@ #include #include #include -#include -#include #include #include #include @@ -61,6 +59,8 @@ #include #include +#include "getdigitlanguage.hxx" + ////////////////////////////////////////////////////////////////////////////// // control support @@ -1566,23 +1566,7 @@ namespace drawinglayer { // set digit language, derived from SvtCTLOptions to have the correct // number display for arabic/hindi numerals - const SvtCTLOptions aSvtCTLOptions; - LanguageType eLang(LANGUAGE_SYSTEM); - - if(SvtCTLOptions::NUMERALS_HINDI == aSvtCTLOptions.GetCTLTextNumerals()) - { - eLang = LANGUAGE_ARABIC_SAUDI_ARABIA; - } - else if(SvtCTLOptions::NUMERALS_ARABIC == aSvtCTLOptions.GetCTLTextNumerals()) - { - eLang = LANGUAGE_ENGLISH; - } - else - { - eLang = (LanguageType)Application::GetSettings().GetLanguage(); - } - - rOutDev.SetDigitLanguage(eLang); + rOutDev.SetDigitLanguage(drawinglayer::detail::getDigitLanguage()); } VclProcessor2D::~VclProcessor2D() -- cgit v1.2.3