Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
5 : : * This Source Code Form is subject to the terms of the Mozilla Public
6 : : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
11 : : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : : * contributor license agreements. See the NOTICE file distributed
13 : : * with this work for additional information regarding copyright
14 : : * ownership. The ASF licenses this file to you under the Apache
15 : : * License, Version 2.0 (the "License"); you may not use this file
16 : : * except in compliance with the License. You may obtain a copy of
17 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : : */
19 : : #include "ReportComponent.hxx"
20 : :
21 : : #include "corestrings.hrc"
22 : : #include <vcl/svapp.hxx>
23 : : #include <vcl/outdev.hxx>
24 : : #include <toolkit/helper/vclunohelper.hxx>
25 : : #include <com/sun/star/awt/FontWeight.hpp>
26 : : #include <com/sun/star/awt/FontWidth.hpp>
27 : : #include "ReportControlModel.hxx"
28 : : #include <com/sun/star/reflection/XProxyFactory.hpp>
29 : : #include <com/sun/star/text/ParagraphVertAlign.hpp>
30 : : #include <com/sun/star/style/ParagraphAdjust.hpp>
31 : : #include <com/sun/star/i18n/ScriptType.hpp>
32 : : #include <editeng/unolingu.hxx>
33 : : #include <unotools/syslocale.hxx>
34 : : #include <unotools/lingucfg.hxx>
35 : : #include <i18npool/mslangid.hxx>
36 : :
37 : : // =============================================================================
38 : : namespace reportdesign
39 : : {
40 : : // =============================================================================
41 : : using namespace com::sun::star;
42 : : using namespace comphelper;
43 : :
44 : 0 : void lcl_getDefaultFonts( Font& rLatinFont, Font& rCJKFont, Font& rCTLFont,LanguageType _eLatin,LanguageType _eCJK,LanguageType _eCTL )
45 : : {
46 : 0 : LanguageType eLatin = _eLatin;
47 : :
48 : : // If the UI language is Korean, the default Latin font has to
49 : : // be queried for Korean, too (the Latin language from the document can't be Korean).
50 : : // This is the same logic as in SwDocShell::InitNew.
51 : 0 : LanguageType eUiLanguage = Application::GetSettings().GetUILanguage();
52 [ # # ]: 0 : if (MsLangId::isKorean(eUiLanguage))
53 : 0 : eLatin = eUiLanguage;
54 : :
55 [ # # ]: 0 : rLatinFont = OutputDevice::GetDefaultFont( DEFAULTFONT_LATIN_PRESENTATION, eLatin, DEFAULTFONT_FLAGS_ONLYONE );
56 [ # # ]: 0 : rCJKFont = OutputDevice::GetDefaultFont( DEFAULTFONT_CJK_PRESENTATION, _eCJK, DEFAULTFONT_FLAGS_ONLYONE );
57 [ # # ]: 0 : rCTLFont = OutputDevice::GetDefaultFont( DEFAULTFONT_CTL_PRESENTATION, _eCTL, DEFAULTFONT_FLAGS_ONLYONE ) ;
58 : 0 : }
59 : 0 : OFormatProperties::OFormatProperties()
60 : : :nAlign(style::ParagraphAdjust_LEFT)
61 : : ,nFontEmphasisMark(0)
62 : : ,nFontRelief(0)
63 : : ,nTextColor(0)
64 : : ,nTextLineColor(0)
65 : : ,nCharUnderlineColor(0xFFFFFFFF)
66 : : ,nBackgroundColor(COL_TRANSPARENT)
67 : : ,aVerticalAlignment( style::VerticalAlignment_TOP )
68 : : ,nCharEscapement(0)
69 : : ,nCharCaseMap(0)
70 : : ,nCharKerning(0)
71 : : ,nCharEscapementHeight(100)
72 : : ,m_bBackgroundTransparent(sal_True)
73 : : ,bCharFlash(sal_False)
74 : : ,bCharAutoKerning(sal_False)
75 : : ,bCharCombineIsOn(sal_False)
76 : : ,bCharHidden(sal_False)
77 : : ,bCharShadowed(sal_False)
78 : 0 : ,bCharContoured(sal_False)
79 : : {
80 : : try
81 : : {
82 [ # # ]: 0 : SvtLinguConfig aLinguConfig;
83 : : using namespace ::com::sun::star::i18n::ScriptType;
84 : :
85 [ # # ][ # # ]: 0 : aLinguConfig.GetProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultLocale"))) >>= aCharLocale;
[ # # ]
86 [ # # ][ # # ]: 0 : LanguageType eCurLang = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage(aCharLocale), LATIN);
87 [ # # ][ # # ]: 0 : aLinguConfig.GetProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultLocale_CJK"))) >>= aCharLocaleAsian;
[ # # ]
88 [ # # ][ # # ]: 0 : LanguageType eCurLangCJK = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage(aCharLocaleAsian), ASIAN);
89 [ # # ][ # # ]: 0 : aLinguConfig.GetProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultLocale_CTL"))) >>= aCharLocaleComplex;
[ # # ]
90 [ # # ][ # # ]: 0 : LanguageType eCurLangCTL = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage(aCharLocaleComplex), COMPLEX);
91 : :
92 [ # # ][ # # ]: 0 : Font aLatin,aCJK,aCTL;
[ # # ]
93 [ # # ]: 0 : lcl_getDefaultFonts(aLatin,aCJK,aCTL,eCurLang,eCurLangCJK,eCurLangCTL);
94 [ # # ]: 0 : aFontDescriptor = VCLUnoHelper::CreateFontDescriptor(aLatin);
95 [ # # ]: 0 : aAsianFontDescriptor = VCLUnoHelper::CreateFontDescriptor(aCJK);
96 [ # # ][ # # ]: 0 : aComplexFontDescriptor = VCLUnoHelper::CreateFontDescriptor(aCTL);
[ # # ][ # # ]
[ # # ][ # # ]
97 : : }
98 [ # # ]: 0 : catch(const uno::Exception&)
99 : : {
100 : : }
101 : 0 : aFontDescriptor.Weight = awt::FontWeight::NORMAL;
102 : 0 : aFontDescriptor.CharacterWidth = awt::FontWidth::NORMAL;
103 : 0 : }
104 : : // -----------------------------------------------------------------------------
105 : 0 : void OReportComponentProperties::setShape(uno::Reference< drawing::XShape >& _xShape,const uno::Reference< report::XReportComponent>& _xTunnel,oslInterlockedCount& _rRefCount)
106 : : {
107 : 0 : osl_incrementInterlockedCount( &_rRefCount );
108 : : {
109 : 0 : m_xProxy.set(_xShape,uno::UNO_QUERY);
110 : 0 : ::comphelper::query_aggregation(m_xProxy,m_xShape);
111 : 0 : ::comphelper::query_aggregation(m_xProxy,m_xProperty);
112 : 0 : _xShape.clear();
113 : 0 : m_xTypeProvider.set(m_xShape,uno::UNO_QUERY);
114 : 0 : m_xUnoTunnel.set(m_xShape,uno::UNO_QUERY);
115 : 0 : m_xServiceInfo.set(m_xShape,uno::UNO_QUERY);
116 : :
117 : : // set ourself as delegator
118 [ # # ]: 0 : if ( m_xProxy.is() )
119 : 0 : m_xProxy->setDelegator( _xTunnel );
120 : : }
121 : 0 : osl_decrementInterlockedCount( &_rRefCount );
122 : 0 : }
123 : : // -----------------------------------------------------------------------------
124 [ # # ][ # # ]: 0 : OReportComponentProperties::~OReportComponentProperties()
125 : : {
126 [ # # ]: 0 : if ( m_xProxy.is() )
127 : : {
128 [ # # ][ # # ]: 0 : m_xProxy->setDelegator( NULL );
[ # # ]
129 : 0 : m_xProxy.clear();
130 : : }
131 : 0 : }
132 : : // =============================================================================
133 : : } // namespace reportdesign
134 : : // =============================================================================
135 : :
136 : :
137 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|