LibreOffice Module reportdesign (master) 1
ReportComponent.cxx
Go to the documentation of this file.
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 <vcl/svapp.hxx>
22#include <vcl/outdev.hxx>
23#include <vcl/settings.hxx>
24
26#include <com/sun/star/awt/FontWeight.hpp>
27#include <com/sun/star/awt/FontWidth.hpp>
29#include <com/sun/star/i18n/ScriptType.hpp>
30#include <comphelper/uno3.hxx>
31#include <unotools/lingucfg.hxx>
34
35
36namespace reportdesign
37{
38
39 using namespace com::sun::star;
40 using namespace comphelper;
41
42static void lcl_getDefaultFonts( vcl::Font& rLatinFont, vcl::Font& rCJKFont, vcl::Font& rCTLFont, LanguageType _eLatin, LanguageType _eCJK, LanguageType _eCTL )
43{
44 LanguageType eLatin = _eLatin;
45
46 // If the UI language is Korean, the default Latin font has to
47 // be queried for Korean, too (the Latin language from the document can't be Korean).
48 // This is the same logic as in SwDocShell::InitNew.
50 if (MsLangId::isKorean(eUiLanguage))
51 eLatin = eUiLanguage;
52
53 rLatinFont = OutputDevice::GetDefaultFont( DefaultFontType::LATIN_PRESENTATION, eLatin, GetDefaultFontFlags::OnlyOne );
54 rCJKFont = OutputDevice::GetDefaultFont( DefaultFontType::CJK_PRESENTATION, _eCJK, GetDefaultFontFlags::OnlyOne );
55 rCTLFont = OutputDevice::GetDefaultFont( DefaultFontType::CTL_PRESENTATION, _eCTL, GetDefaultFontFlags::OnlyOne ) ;
56}
58 :nAlign(style::ParagraphAdjust_LEFT)
59 ,nFontEmphasisMark(0)
60 ,nFontRelief(0)
61 ,nTextColor(0)
62 ,nTextLineColor(0)
63 ,nBackgroundColor(COL_TRANSPARENT)
64 ,aVerticalAlignment( style::VerticalAlignment_TOP )
65 ,nCharEscapement(0)
66 ,nCharCaseMap(0)
67 ,nCharKerning(0)
68 ,nCharEscapementHeight(100)
69 ,m_bBackgroundTransparent(true)
70 ,bCharFlash(false)
71 ,bCharAutoKerning(false)
72 ,bCharCombineIsOn(false)
73 ,bCharHidden(false)
74 ,bCharShadowed(false)
75 ,bCharContoured(false)
76{
77 try
78 {
79 SvtLinguConfig aLinguConfig;
80 using namespace ::com::sun::star::i18n::ScriptType;
81
82 aLinguConfig.GetProperty(u"DefaultLocale") >>= aCharLocale;
84 aLinguConfig.GetProperty(u"DefaultLocale_CJK") >>= aCharLocaleAsian;
86 aLinguConfig.GetProperty(u"DefaultLocale_CTL") >>= aCharLocaleComplex;
88
89 vcl::Font aLatin,aCJK,aCTL;
90 lcl_getDefaultFonts(aLatin,aCJK,aCTL,eCurLang,eCurLangCJK,eCurLangCTL);
94 }
95 catch(const uno::Exception&)
96 {
97 }
98 aFontDescriptor.Weight = awt::FontWeight::NORMAL;
99 aFontDescriptor.CharacterWidth = awt::FontWidth::NORMAL;
100}
101
102void OReportComponentProperties::setShape(uno::Reference< drawing::XShape >& _xShape,const uno::Reference< report::XReportComponent>& _xTunnel,oslInterlockedCount& _rRefCount)
103{
104 osl_atomic_increment( &_rRefCount );
105 {
106 m_xProxy.set(_xShape,uno::UNO_QUERY);
107 ::comphelper::query_aggregation(m_xProxy,m_xShape);
108 ::comphelper::query_aggregation(m_xProxy,m_xProperty);
109 _xShape.clear();
110 m_xTypeProvider.set(m_xShape,uno::UNO_QUERY);
111 m_xUnoTunnel.set(m_xShape,uno::UNO_QUERY);
112 m_xServiceInfo.set(m_xShape,uno::UNO_QUERY);
113
114 // set ourself as delegator
115 if ( m_xProxy.is() )
116 m_xProxy->setDelegator( _xTunnel );
117 }
118 osl_atomic_decrement( &_rRefCount );
119}
120
122{
123 if ( m_xProxy.is() )
124 {
125 m_xProxy->setDelegator( nullptr );
126 m_xProxy.clear();
127 }
128}
129
130} // namespace reportdesign
131
132
133/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define COMPLEX
Definition: UITools.cxx:172
#define ASIAN
Definition: UITools.cxx:171
const LanguageTag & GetUILanguageTag() const
static const AllSettings & GetSettings()
LanguageType getLanguageType(bool bResolveSystem=true) const
static LanguageType convertToLanguageType(const css::lang::Locale &rLocale, bool bResolveSystem=true)
static LanguageType resolveSystemLanguageByScriptType(LanguageType nLang, sal_Int16 nType)
static bool isKorean(LanguageType nLang)
static vcl::Font GetDefaultFont(DefaultFontType nType, LanguageType eLang, GetDefaultFontFlags nFlags, const OutputDevice *pOutDev=nullptr)
css::uno::Any GetProperty(std::u16string_view rPropertyName) const
static css::awt::FontDescriptor CreateFontDescriptor(const vcl::Font &rFont)
css::uno::Reference< css::lang::XUnoTunnel > m_xUnoTunnel
css::uno::Reference< css::uno::XAggregation > m_xProxy
css::uno::Reference< css::drawing::XShape > m_xShape
css::uno::Reference< css::lang::XTypeProvider > m_xTypeProvider
css::uno::Reference< css::lang::XServiceInfo > m_xServiceInfo
css::uno::Reference< css::beans::XPropertySet > m_xProperty
void setShape(css::uno::Reference< css::drawing::XShape > &xShape, const css::uno::Reference< css::report::XReportComponent > &xTunnel, oslInterlockedCount &rRefCount)
constexpr ::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
float u
static void lcl_getDefaultFonts(vcl::Font &rLatinFont, vcl::Font &rCJKFont, vcl::Font &rCTLFont, LanguageType _eLatin, LanguageType _eCJK, LanguageType _eCTL)
css::awt::FontDescriptor aAsianFontDescriptor
css::awt::FontDescriptor aFontDescriptor
css::awt::FontDescriptor aComplexFontDescriptor