Factored out common getDigitLanguage.

This commit is contained in:
Stephan Bergmann
2011-12-07 16:34:32 +01:00
parent 17c7711948
commit 8576bd1784
5 changed files with 102 additions and 37 deletions

View File

@@ -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 \

View File

@@ -36,8 +36,6 @@
#include <drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx>
#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
#include <canvas/canvastools.hxx>
#include <svl/ctloptions.hxx>
#include <vcl/svapp.hxx>
#include <drawinglayer/primitive2d/maskprimitive2d.hxx>
#include <basegfx/polygon/b2dpolygonclipper.hxx>
#include <drawinglayer/primitive2d/pagepreviewprimitive2d.hxx>
@@ -69,6 +67,8 @@
#include <helperwrongspellrenderer.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
#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

View File

@@ -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 <sbergman@redhat.com>
* (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: */

View File

@@ -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 <sbergman@redhat.com>
* (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: */

View File

@@ -52,8 +52,6 @@
#include <drawinglayer/primitive2d/markerarrayprimitive2d.hxx>
#include <drawinglayer/primitive2d/pointarrayprimitive2d.hxx>
#include <drawinglayer/primitive2d/wrongspellprimitive2d.hxx>
#include <svl/ctloptions.hxx>
#include <vcl/svapp.hxx>
#include <drawinglayer/primitive2d/pagepreviewprimitive2d.hxx>
#include <tools/diagnose_ex.h>
#include <vcl/metric.hxx>
@@ -61,6 +59,8 @@
#include <drawinglayer/primitive2d/epsprimitive2d.hxx>
#include <vcl/rendergraphicrasterizer.hxx>
#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()