/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace ::com::sun::star; void SvxUnoFontDescriptor::ConvertToFont( const awt::FontDescriptor& rDesc, vcl::Font& rFont ) { rFont.SetFamilyName( rDesc.Name ); rFont.SetStyleName( rDesc.StyleName ); rFont.SetFontSize( Size( rDesc.Width, rDesc.Height ) ); rFont.SetFamily( (FontFamily)rDesc.Family ); rFont.SetCharSet( (rtl_TextEncoding)rDesc.CharSet ); rFont.SetPitch( (FontPitch)rDesc.Pitch ); rFont.SetOrientation( (short)(rDesc.Orientation*10) ); rFont.SetKerning( rDesc.Kerning ? FontKerning::FontSpecific : FontKerning::NONE ); rFont.SetWeight( VCLUnoHelper::ConvertFontWeight(rDesc.Weight) ); rFont.SetItalic( (FontItalic)rDesc.Slant ); rFont.SetUnderline( (FontLineStyle)rDesc.Underline ); rFont.SetStrikeout( (FontStrikeout)rDesc.Strikeout ); rFont.SetWordLineMode( rDesc.WordLineMode ); } void SvxUnoFontDescriptor::ConvertFromFont( const vcl::Font& rFont, awt::FontDescriptor& rDesc ) { rDesc.Name = rFont.GetFamilyName(); rDesc.StyleName = rFont.GetStyleName(); rDesc.Width = sal::static_int_cast< sal_Int16 >(rFont.GetFontSize().Width()); rDesc.Height = sal::static_int_cast< sal_Int16 >(rFont.GetFontSize().Height()); rDesc.Family = sal::static_int_cast< sal_Int16 >(rFont.GetFamilyType()); rDesc.CharSet = rFont.GetCharSet(); rDesc.Pitch = sal::static_int_cast< sal_Int16 >(rFont.GetPitch()); rDesc.Orientation = static_cast< float >(rFont.GetOrientation() / 10); rDesc.Kerning = rFont.IsKerning(); rDesc.Weight = VCLUnoHelper::ConvertFontWeight( rFont.GetWeight() ); rDesc.Slant = VCLUnoHelper::ConvertFontSlant( rFont.GetItalic() ); rDesc.Underline = sal::static_int_cast< sal_Int16 >(rFont.GetUnderline()); rDesc.Strikeout = sal::static_int_cast< sal_Int16 >(rFont.GetStrikeout()); rDesc.WordLineMode = rFont.IsWordLineMode(); } void SvxUnoFontDescriptor::FillItemSet( const awt::FontDescriptor& rDesc, SfxItemSet& rSet ) { uno::Any aTemp; { SvxFontItem aFontItem( EE_CHAR_FONTINFO ); aFontItem.SetFamilyName( rDesc.Name); aFontItem.SetStyleName( rDesc.StyleName); aFontItem.SetFamily( (FontFamily)rDesc.Family); aFontItem.SetCharSet( rDesc.CharSet ); aFontItem.SetPitch( (FontPitch)rDesc.Pitch); rSet.Put(aFontItem); } { SvxFontHeightItem aFontHeightItem( 0, 100, EE_CHAR_FONTHEIGHT ); aTemp <<= (float)rDesc.Height; static_cast(&aFontHeightItem)->PutValue( aTemp, MID_FONTHEIGHT|CONVERT_TWIPS ); rSet.Put(aFontHeightItem); } { SvxPostureItem aPostureItem( (FontItalic)0, EE_CHAR_ITALIC ); aTemp <<= rDesc.Slant; static_cast(&aPostureItem)->PutValue( aTemp, MID_POSTURE ); rSet.Put(aPostureItem); } { SvxUnderlineItem aUnderlineItem( (FontLineStyle)0, EE_CHAR_UNDERLINE ); aTemp <<= (sal_Int16)rDesc.Underline; static_cast(&aUnderlineItem)->PutValue( aTemp, MID_TL_STYLE ); rSet.Put( aUnderlineItem ); } { SvxWeightItem aWeightItem( (FontWeight)0, EE_CHAR_WEIGHT ); aTemp <<= rDesc.Weight; static_cast(&aWeightItem)->PutValue( aTemp, MID_WEIGHT ); rSet.Put( aWeightItem ); } { SvxCrossedOutItem aCrossedOutItem( (FontStrikeout)0, EE_CHAR_STRIKEOUT ); aTemp <<= rDesc.Strikeout; static_cast(&aCrossedOutItem)->PutValue( aTemp, MID_CROSS_OUT ); rSet.Put( aCrossedOutItem ); } { SvxWordLineModeItem aWLMItem( rDesc.WordLineMode, EE_CHAR_WLM ); rSet.Put( aWLMItem ); } } void SvxUnoFontDescriptor::FillFromItemSet( const SfxItemSet& rSet, awt::FontDescriptor& rDesc ) { const SfxPoolItem* pItem = nullptr; { const SvxFontItem* pFontItem = static_cast(&rSet.Get( EE_CHAR_FONTINFO )); rDesc.Name = pFontItem->GetFamilyName(); rDesc.StyleName = pFontItem->GetStyleName(); rDesc.Family = sal::static_int_cast< sal_Int16 >( pFontItem->GetFamily()); rDesc.CharSet = pFontItem->GetCharSet(); rDesc.Pitch = sal::static_int_cast< sal_Int16 >( pFontItem->GetPitch()); } { pItem = &rSet.Get( EE_CHAR_FONTHEIGHT ); uno::Any aHeight; if( pItem->QueryValue( aHeight, MID_FONTHEIGHT ) ) aHeight >>= rDesc.Height; } { pItem = &rSet.Get( EE_CHAR_ITALIC ); uno::Any aFontSlant; if(pItem->QueryValue( aFontSlant, MID_POSTURE )) aFontSlant >>= rDesc.Slant; } { pItem = &rSet.Get( EE_CHAR_UNDERLINE ); uno::Any aUnderline; if(pItem->QueryValue( aUnderline, MID_TL_STYLE )) aUnderline >>= rDesc.Underline; } { pItem = &rSet.Get( EE_CHAR_WEIGHT ); uno::Any aWeight; if(pItem->QueryValue( aWeight, MID_WEIGHT )) aWeight >>= rDesc.Weight; } { pItem = &rSet.Get( EE_CHAR_STRIKEOUT ); uno::Any aStrikeOut; if(pItem->QueryValue( aStrikeOut, MID_CROSS_OUT )) aStrikeOut >>= rDesc.Strikeout; } { const SvxWordLineModeItem* pWLMItem = static_cast(&rSet.Get( EE_CHAR_WLM )); rDesc.WordLineMode = pWLMItem->GetValue(); } } void SvxUnoFontDescriptor::setPropertyToDefault( SfxItemSet& rSet ) { rSet.InvalidateItem( EE_CHAR_FONTINFO ); rSet.InvalidateItem( EE_CHAR_FONTHEIGHT ); rSet.InvalidateItem( EE_CHAR_ITALIC ); rSet.InvalidateItem( EE_CHAR_UNDERLINE ); rSet.InvalidateItem( EE_CHAR_WEIGHT ); rSet.InvalidateItem( EE_CHAR_STRIKEOUT ); rSet.InvalidateItem( EE_CHAR_WLM ); } uno::Any SvxUnoFontDescriptor::getPropertyDefault( SfxItemPool* pPool ) { SfxItemSet aSet( *pPool, EE_CHAR_FONTINFO, EE_CHAR_FONTINFO, EE_CHAR_FONTHEIGHT, EE_CHAR_FONTHEIGHT, EE_CHAR_ITALIC, EE_CHAR_ITALIC, EE_CHAR_UNDERLINE, EE_CHAR_UNDERLINE, EE_CHAR_WEIGHT, EE_CHAR_WEIGHT, EE_CHAR_STRIKEOUT, EE_CHAR_STRIKEOUT, EE_CHAR_WLM, EE_CHAR_WLM, 0 ); uno::Any aAny; if(!SfxItemPool::IsWhich(EE_CHAR_FONTINFO)|| !SfxItemPool::IsWhich(EE_CHAR_FONTHEIGHT)|| !SfxItemPool::IsWhich(EE_CHAR_ITALIC)|| !SfxItemPool::IsWhich(EE_CHAR_UNDERLINE)|| !SfxItemPool::IsWhich(EE_CHAR_WEIGHT)|| !SfxItemPool::IsWhich(EE_CHAR_STRIKEOUT)|| !SfxItemPool::IsWhich(EE_CHAR_WLM)) return aAny; aSet.Put(pPool->GetDefaultItem(EE_CHAR_FONTINFO)); aSet.Put(pPool->GetDefaultItem(EE_CHAR_FONTHEIGHT)); aSet.Put(pPool->GetDefaultItem(EE_CHAR_ITALIC)); aSet.Put(pPool->GetDefaultItem(EE_CHAR_UNDERLINE)); aSet.Put(pPool->GetDefaultItem(EE_CHAR_WEIGHT)); aSet.Put(pPool->GetDefaultItem(EE_CHAR_STRIKEOUT)); aSet.Put(pPool->GetDefaultItem(EE_CHAR_WLM)); awt::FontDescriptor aDesc; FillFromItemSet( aSet, aDesc ); aAny <<= aDesc; return aAny; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ option value='distro/suse/suse-4.0'>distro/suse/suse-4.0 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-06-13clang-tidy modernize-pass-by-value in connectivityNoel Grandin
Change-Id: I1f1b609254c7f8cfba14c248167f81b51684d8e8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135727 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-05-02throw() -> noexcept, part 2/3: Automatic loplugin:noexcept rewriteStephan Bergmann
Change-Id: I076f16d0536b534abf0ced4d76051eadb4c0e033 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114949 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-03-23tdf#124176 Use pragma once in connectivityVincent LE GARREC
Change-Id: I4a57cd6dcbc180fe9a378d2713c687a66476ee79 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111979 Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
2017-06-20create comphelper::RefCountedMutexNoel Grandin
and merge the two existing implementations of the idea - SotMutexHolder from package and RefCountedMutex from connectivity Change-Id: I87f09f359ac798cf934381a2c75225dab71dd43e Reviewed-on: https://gerrit.libreoffice.org/38972 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-01-26Remove dynamic exception specificationsStephan Bergmann
...(for now, from LIBO_INTERNAL_CODE only). See the mail thread starting at <https://lists.freedesktop.org/archives/libreoffice/2017-January/076665.html> "Dynamic Exception Specifications" for details. Most changes have been done automatically by the rewriting loplugin:dynexcspec (after enabling the rewriting mode, to be committed shortly). The way it only removes exception specs from declarations if it also sees a definition, it identified some dead declarations-w/o-definitions (that have been removed manually) and some cases where a definition appeared in multiple include files (which have also been cleaned up manually). There's also been cases of macro paramters (that were used to abstract over exception specs) that have become unused now (and been removed). Furthermore, some code needed to be cleaned up manually (avmedia/source/quicktime/ and connectivity/source/drivers/kab/), as I had no configurations available that would actually build that code. Missing @throws documentation has not been applied in such manual clean-up. Change-Id: I3408691256c9b0c12bc5332de976743626e13960 Reviewed-on: https://gerrit.libreoffice.org/33574 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2016-05-30com::sun::star->css in connectivityNoel Grandin
Change-Id: I9489e92dc89a6d83a26ff4f0d9aad26acd28ad9f Reviewed-on: https://gerrit.libreoffice.org/25537 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2015-12-23loplugin:unusedfields in connectivityNoel Grandin
Change-Id: I32226b6959b2bfd316de6ed93b070b68ad875562
2015-10-12Replace "SAL_OVERRIDE" with "override" in LIBO_INTERNAL_ONLY codeStephan Bergmann
Change-Id: I2ea407acd763ef2d7dae2d3b8f32525523ac8274
2015-09-03tdf#88462 connectivity convert manual XInterfaceDaniel Robertson
Convert postgresql driver ReflectionBase manual XInterface implementation to use ::cppu::WeakComponentImplHelper. Change-Id: I738bd7df33de9c0fe0e3242eb5a4fab6a8dcb3f0 Reviewed-on: https://gerrit.libreoffice.org/18207 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2014-04-19fixincludeguards.sh: connectivityThomas Arnhold
2014-03-26First batch of adding SAL_OVERRRIDE to overriding function declarationsStephan Bergmann
...mostly done with a rewriting Clang plugin, with just some manual tweaking necessary to fix poor macro usage. Change-Id: I71fa20213e86be10de332ece0aa273239df7b61a
2014-02-26cppuhelper: retrofit std::exception into overriding exception specsStephan Bergmann
Change-Id: I56e32131b7991ee9948ce46765632eb823d463b3
2014-02-18add missing vim modelinesCaolán McNamara
Change-Id: I72d565b77fad98e176e2f47368201ad1585aef3f
2013-04-30Move to MPLv2 license headers, with ESC decision and author's permission.Michael Meeks
2013-04-07mass removal of rtl:: prefixes for O(U)String*Luboš Luňák
Modules sal, salhelper, cppu, cppuhelper, codemaker (selectively) and odk have kept them, in order not to break external API (the automatic using declaration is LO-internal). Change-Id: I588fc9e0c45b914f824f91c0376980621d730f09