summaryrefslogtreecommitdiff
path: root/svx/source/svdraw
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2025-03-19 13:23:22 +0500
committerMike Kaganski <mike.kaganski@collabora.com>2025-03-19 17:24:38 +0100
commit599ab8dc3ae9d8b8749b6400e87d98a6dad2a03c (patch)
tree9e00bf1e54d609ca6a01dc327f377022ab1d31cc /svx/source/svdraw
parent7af8b3d3305fe8344cb9339269c5dc3f1cd44650 (diff)
Rename con-const vcl::Font property getters for clarity
There are two sets of getters there; and the non-const ones may copy the COW mpImplFont, and may call its AskConfig. The name overload is unfortunate. It is not obvious at the call site, which of the two will be called; and what is different. IMO, the way to fix it would be to keep only one set of getters (the const one), and make the call to AskConfig explicit (in the places that set font name, and know that resolution of other properties will be needed). But in this change, I only rename the non-const getters, making sure to keep the behavior unchanged (at least the intention is to have a non-functional change, meaning that the places that called non-const overload, now use the renamed functions), to make it clear where we actually may copy and initialize it. Change-Id: I9a5cd91d5c1c0de7ff8577b9b982d165e4cdd2c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183116 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'svx/source/svdraw')
-rw-r--r--svx/source/svdraw/svdfmtf.cxx10
-rw-r--r--svx/source/svdraw/svdmodel.cxx12
-rw-r--r--svx/source/svdraw/svdpdf.cxx19
3 files changed, 22 insertions, 19 deletions
diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx
index a79fb3a2f2a1..8cb0c248d59d 100644
--- a/svx/source/svdraw/svdfmtf.cxx
+++ b/svx/source/svdraw/svdfmtf.cxx
@@ -396,11 +396,11 @@ void ImpSdrGDIMetaFileImport::SetAttributes(SdrObject* pObj, bool bForceTextAttr
vcl::Font aFnt(mpVD->GetFont());
const sal_uInt32 nHeight(basegfx::fround(implMap(aFnt.GetFontSize()).Height() * mfScaleY));
- mpTextAttr->Put( SvxFontItem( aFnt.GetFamilyType(), aFnt.GetFamilyName(), aFnt.GetStyleName(), aFnt.GetPitch(), aFnt.GetCharSet(), EE_CHAR_FONTINFO ) );
- mpTextAttr->Put( SvxFontItem( aFnt.GetFamilyType(), aFnt.GetFamilyName(), aFnt.GetStyleName(), aFnt.GetPitch(), aFnt.GetCharSet(), EE_CHAR_FONTINFO_CJK ) );
- mpTextAttr->Put( SvxFontItem( aFnt.GetFamilyType(), aFnt.GetFamilyName(), aFnt.GetStyleName(), aFnt.GetPitch(), aFnt.GetCharSet(), EE_CHAR_FONTINFO_CTL ) );
- mpTextAttr->Put(SvxPostureItem(aFnt.GetItalic(), EE_CHAR_ITALIC));
- mpTextAttr->Put(SvxWeightItem(aFnt.GetWeight(), EE_CHAR_WEIGHT));
+ mpTextAttr->Put( SvxFontItem( aFnt.GetFamilyTypeMaybeAskConfig(), aFnt.GetFamilyName(), aFnt.GetStyleName(), aFnt.GetPitchMaybeAskConfig(), aFnt.GetCharSet(), EE_CHAR_FONTINFO ) );
+ mpTextAttr->Put( SvxFontItem( aFnt.GetFamilyTypeMaybeAskConfig(), aFnt.GetFamilyName(), aFnt.GetStyleName(), aFnt.GetPitchMaybeAskConfig(), aFnt.GetCharSet(), EE_CHAR_FONTINFO_CJK ) );
+ mpTextAttr->Put( SvxFontItem( aFnt.GetFamilyTypeMaybeAskConfig(), aFnt.GetFamilyName(), aFnt.GetStyleName(), aFnt.GetPitchMaybeAskConfig(), aFnt.GetCharSet(), EE_CHAR_FONTINFO_CTL ) );
+ mpTextAttr->Put(SvxPostureItem(aFnt.GetItalicMaybeAskConfig(), EE_CHAR_ITALIC));
+ mpTextAttr->Put(SvxWeightItem(aFnt.GetWeightMaybeAskConfig(), EE_CHAR_WEIGHT));
mpTextAttr->Put( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT ) );
mpTextAttr->Put( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CJK ) );
mpTextAttr->Put( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CTL ) );
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index 5d83be0ebe10..c510ec95b6e0 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -651,28 +651,28 @@ void SdrModel::SetTextDefaults( SfxItemPool* pItemPool, sal_Int32 nDefTextHgt )
// get DEFAULTFONT_LATIN_TEXT and set at pool as dynamic default
vcl::Font aFont(OutputDevice::GetDefaultFont(DefaultFontType::LATIN_TEXT, nLanguage, GetDefaultFontFlags::OnlyOne));
- aSvxFontItem.SetFamily(aFont.GetFamilyType());
+ aSvxFontItem.SetFamily(aFont.GetFamilyTypeMaybeAskConfig());
aSvxFontItem.SetFamilyName(aFont.GetFamilyName());
aSvxFontItem.SetStyleName(OUString());
- aSvxFontItem.SetPitch( aFont.GetPitch());
+ aSvxFontItem.SetPitch( aFont.GetPitchMaybeAskConfig());
aSvxFontItem.SetCharSet( aFont.GetCharSet() );
pItemPool->SetUserDefaultItem(aSvxFontItem);
// get DEFAULTFONT_CJK_TEXT and set at pool as dynamic default
vcl::Font aFontCJK(OutputDevice::GetDefaultFont(DefaultFontType::CJK_TEXT, nLanguage, GetDefaultFontFlags::OnlyOne));
- aSvxFontItemCJK.SetFamily( aFontCJK.GetFamilyType());
+ aSvxFontItemCJK.SetFamily( aFontCJK.GetFamilyTypeMaybeAskConfig());
aSvxFontItemCJK.SetFamilyName(aFontCJK.GetFamilyName());
aSvxFontItemCJK.SetStyleName(OUString());
- aSvxFontItemCJK.SetPitch( aFontCJK.GetPitch());
+ aSvxFontItemCJK.SetPitch( aFontCJK.GetPitchMaybeAskConfig());
aSvxFontItemCJK.SetCharSet( aFontCJK.GetCharSet());
pItemPool->SetUserDefaultItem(aSvxFontItemCJK);
// get DEFAULTFONT_CTL_TEXT and set at pool as dynamic default
vcl::Font aFontCTL(OutputDevice::GetDefaultFont(DefaultFontType::CTL_TEXT, nLanguage, GetDefaultFontFlags::OnlyOne));
- aSvxFontItemCTL.SetFamily(aFontCTL.GetFamilyType());
+ aSvxFontItemCTL.SetFamily(aFontCTL.GetFamilyTypeMaybeAskConfig());
aSvxFontItemCTL.SetFamilyName(aFontCTL.GetFamilyName());
aSvxFontItemCTL.SetStyleName(OUString());
- aSvxFontItemCTL.SetPitch( aFontCTL.GetPitch() );
+ aSvxFontItemCTL.SetPitch( aFontCTL.GetPitchMaybeAskConfig() );
aSvxFontItemCTL.SetCharSet( aFontCTL.GetCharSet());
pItemPool->SetUserDefaultItem(aSvxFontItemCTL);
diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx
index b128a05fc13b..7c0251c8b0b1 100644
--- a/svx/source/svdraw/svdpdf.cxx
+++ b/svx/source/svdraw/svdpdf.cxx
@@ -344,14 +344,17 @@ void ImpSdrPdfImport::SetAttributes(SdrObject* pObj, bool bForceTextAttr)
const sal_uInt32 nHeight(
basegfx::fround<sal_uInt32>(aFnt.GetFontSize().Height() * mfScaleY));
- mpTextAttr->Put(SvxFontItem(aFnt.GetFamilyType(), aFnt.GetFamilyName(), aFnt.GetStyleName(),
- aFnt.GetPitch(), aFnt.GetCharSet(), EE_CHAR_FONTINFO));
- mpTextAttr->Put(SvxFontItem(aFnt.GetFamilyType(), aFnt.GetFamilyName(), aFnt.GetStyleName(),
- aFnt.GetPitch(), aFnt.GetCharSet(), EE_CHAR_FONTINFO_CJK));
- mpTextAttr->Put(SvxFontItem(aFnt.GetFamilyType(), aFnt.GetFamilyName(), aFnt.GetStyleName(),
- aFnt.GetPitch(), aFnt.GetCharSet(), EE_CHAR_FONTINFO_CTL));
- mpTextAttr->Put(SvxPostureItem(aFnt.GetItalic(), EE_CHAR_ITALIC));
- mpTextAttr->Put(SvxWeightItem(aFnt.GetWeight(), EE_CHAR_WEIGHT));
+ mpTextAttr->Put(SvxFontItem(aFnt.GetFamilyTypeMaybeAskConfig(), aFnt.GetFamilyName(),
+ aFnt.GetStyleName(), aFnt.GetPitchMaybeAskConfig(),
+ aFnt.GetCharSet(), EE_CHAR_FONTINFO));
+ mpTextAttr->Put(SvxFontItem(aFnt.GetFamilyTypeMaybeAskConfig(), aFnt.GetFamilyName(),
+ aFnt.GetStyleName(), aFnt.GetPitchMaybeAskConfig(),
+ aFnt.GetCharSet(), EE_CHAR_FONTINFO_CJK));
+ mpTextAttr->Put(SvxFontItem(aFnt.GetFamilyTypeMaybeAskConfig(), aFnt.GetFamilyName(),
+ aFnt.GetStyleName(), aFnt.GetPitchMaybeAskConfig(),
+ aFnt.GetCharSet(), EE_CHAR_FONTINFO_CTL));
+ mpTextAttr->Put(SvxPostureItem(aFnt.GetItalicMaybeAskConfig(), EE_CHAR_ITALIC));
+ mpTextAttr->Put(SvxWeightItem(aFnt.GetWeightMaybeAskConfig(), EE_CHAR_WEIGHT));
mpTextAttr->Put(SvxFontHeightItem(nHeight, 100, EE_CHAR_FONTHEIGHT));
mpTextAttr->Put(SvxFontHeightItem(nHeight, 100, EE_CHAR_FONTHEIGHT_CJK));
mpTextAttr->Put(SvxFontHeightItem(nHeight, 100, EE_CHAR_FONTHEIGHT_CTL));