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
22#include <vcl/svapp.hxx>
23#include <vcl/outdev.hxx>
24#include <vcl/settings.hxx>
25
27#include <com/sun/star/awt/FontWeight.hpp>
28#include <com/sun/star/awt/FontWidth.hpp>
30#include <com/sun/star/i18n/ScriptType.hpp>
31#include <comphelper/uno3.hxx>
32#include <unotools/lingucfg.hxx>
35
36
37namespace reportdesign
38{
39
40 using namespace com::sun::star;
41 using namespace comphelper;
42
43static void lcl_getDefaultFonts( vcl::Font& rLatinFont, vcl::Font& rCJKFont, vcl::Font& rCTLFont, LanguageType _eLatin, LanguageType _eCJK, LanguageType _eCTL )
44{
46 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.
52 if (MsLangId::isKorean(eUiLanguage))
53 eLatin = eUiLanguage;
54
55 rLatinFont = OutputDevice::GetDefaultFont( DefaultFontType::LATIN_PRESENTATION, eLatin, GetDefaultFontFlags::OnlyOne );
56 rCJKFont = OutputDevice::GetDefaultFont( DefaultFontType::CJK_PRESENTATION, _eCJK, GetDefaultFontFlags::OnlyOne );
57 rCTLFont = OutputDevice::GetDefaultFont( DefaultFontType::CTL_PRESENTATION, _eCTL, GetDefaultFontFlags::OnlyOne ) ;
58}
60 :nAlign(style::ParagraphAdjust_LEFT)
61 ,nFontEmphasisMark(0)
62 ,nFontRelief(0)
63 ,nTextColor(0)
64 ,nTextLineColor(0)
65 ,nBackgroundColor(COL_TRANSPARENT)
66 ,aVerticalAlignment( style::VerticalAlignment_TOP )
67 ,nCharEscapement(0)
68 ,nCharCaseMap(0)
69 ,nCharKerning(0)
70 ,nCharEscapementHeight(100)
71 ,m_bBackgroundTransparent(true)
72 ,bCharFlash(false)
73 ,bCharAutoKerning(false)
74 ,bCharCombineIsOn(false)
75 ,bCharHidden(false)
76 ,bCharShadowed(false)
77 ,bCharContoured(false)
78{
79 try
80 {
81 SvtLinguConfig aLinguConfig;
82 using namespace ::com::sun::star::i18n::ScriptType;
83
84 aLinguConfig.GetProperty(u"DefaultLocale") >>= aCharLocale;
86 aLinguConfig.GetProperty(u"DefaultLocale_CJK") >>= aCharLocaleAsian;
88 aLinguConfig.GetProperty(u"DefaultLocale_CTL") >>= aCharLocaleComplex;
90
91 vcl::Font aLatin,aCJK,aCTL;
92 lcl_getDefaultFonts(aLatin,aCJK,aCTL,eCurLang,eCurLangCJK,eCurLangCTL);
96 }
97 catch(const uno::Exception&)
98 {
99 }
100 aFontDescriptor.Weight = awt::FontWeight::NORMAL;
101 aFontDescriptor.CharacterWidth = awt::FontWidth::NORMAL;
102}
103
104void OReportComponentProperties::setShape(uno::Reference< drawing::XShape >& _xShape,const uno::Reference< report::XReportComponent>& _xTunnel,oslInterlockedCount& _rRefCount)
105{
106 osl_atomic_increment( &_rRefCount );
107 {
108 m_xProxy.set(_xShape,uno::UNO_QUERY);
109 ::comphelper::query_aggregation(m_xProxy,m_xShape);
110 ::comphelper::query_aggregation(m_xProxy,m_xProperty);
111 _xShape.clear();
112 m_xTypeProvider.set(m_xShape,uno::UNO_QUERY);
113 m_xUnoTunnel.set(m_xShape,uno::UNO_QUERY);
114 m_xServiceInfo.set(m_xShape,uno::UNO_QUERY);
115
116 // set ourself as delegator
117 if ( m_xProxy.is() )
118 m_xProxy->setDelegator( _xTunnel );
119 }
120 osl_atomic_decrement( &_rRefCount );
121}
122
124{
125 if ( m_xProxy.is() )
126 {
127 m_xProxy->setDelegator( nullptr );
128 m_xProxy.clear();
129 }
130}
131
132} // namespace reportdesign
133
134
135/* 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