summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2016-01-16 21:01:00 +1100
committerChris Sherlock <chris.sherlock79@gmail.com>2016-01-16 16:11:28 +0000
commit2b297116cb6bb1061c43e5714e2609c8ee9f57d2 (patch)
tree9622cff5a49a891f64899e34c48b53e8d462e96e /sw
parent7d93bb8fcb406773d2dc68b25ab7cee6e114d482 (diff)
vcl: rename Font::GetName to Font::GetFamilyName
Change-Id: I83927e0992dfe0a2a79d139818a9f45d3761aae5 Reviewed-on: https://gerrit.libreoffice.org/21509 Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com> Tested-by: Chris Sherlock <chris.sherlock79@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/doc/DocumentStylePoolManager.cxx8
-rw-r--r--sw/source/core/edit/autofmt.cxx2
-rw-r--r--sw/source/core/inc/swfont.hxx2
-rw-r--r--sw/source/core/text/txtfld.cxx2
-rw-r--r--sw/source/core/txtnode/fntcache.cxx4
-rw-r--r--sw/source/core/txtnode/txtedt.cxx2
-rw-r--r--sw/source/core/unocore/unocrsrhelper.cxx2
-rw-r--r--sw/source/core/unocore/unostyle.cxx995
-rw-r--r--sw/source/filter/ascii/parasc.cxx2
-rw-r--r--sw/source/filter/html/htmlform.cxx2
-rw-r--r--sw/source/filter/html/htmlforw.cxx2
-rw-r--r--sw/source/filter/writer/writer.cxx2
-rw-r--r--sw/source/filter/ww8/wrtw8num.cxx4
-rw-r--r--sw/source/ui/config/optpage.cxx6
-rw-r--r--sw/source/ui/dialog/ascfldlg.cxx4
-rw-r--r--sw/source/uibase/app/docshini.cxx6
-rw-r--r--sw/source/uibase/config/fontcfg.cxx2
-rw-r--r--sw/source/uibase/docvw/srcedtw.cxx2
-rw-r--r--sw/source/uibase/lingu/hhcwrp.cxx4
-rw-r--r--sw/source/uibase/shells/annotsh.cxx8
-rw-r--r--sw/source/uibase/shells/drwtxtsh.cxx8
-rw-r--r--sw/source/uibase/shells/textsh.cxx8
22 files changed, 599 insertions, 478 deletions
diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx b/sw/source/core/doc/DocumentStylePoolManager.cxx
index f9137bc4b791..57cc458cbdf3 100644
--- a/sw/source/core/doc/DocumentStylePoolManager.cxx
+++ b/sw/source/core/doc/DocumentStylePoolManager.cxx
@@ -127,7 +127,7 @@ namespace
vcl::Font aFnt( OutputDevice::GetDefaultFont( nFntType,
nLng, GetDefaultFontFlags::OnlyOne ) );
- rSet.Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(),
+ rSet.Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetFamilyName(),
OUString(), aFnt.GetPitch(),
aFnt.GetCharSet(), aArr[n].nResFntId ));
}
@@ -156,7 +156,7 @@ namespace
vcl::Font aFnt( OutputDevice::GetDefaultFont( aArr[n].nFntType,
nLng, GetDefaultFontFlags::OnlyOne ) );
- rSet.Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(),
+ rSet.Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetFamilyName(),
OUString(), aFnt.GetPitch(),
aFnt.GetCharSet(), aArr[n].nResFntId ));
}
@@ -469,7 +469,7 @@ SwTextFormatColl* DocumentStylePoolManager::GetTextCollFromPool( sal_uInt16 nId,
vcl::Font aFnt( OutputDevice::GetDefaultFont( nFontTypes[i],
nLng, GetDefaultFontFlags::OnlyOne ) );
- aSet.Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(),
+ aSet.Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetFamilyName(),
OUString(), aFnt.GetPitch(),
aFnt.GetCharSet(), aFontWhich[i] ));
}
@@ -1202,7 +1202,7 @@ SwFormat* DocumentStylePoolManager::GetFormatFromPool( sal_uInt16 nId )
{
const vcl::Font& rBulletFont = numfunc::GetDefBulletFont();
SetAllScriptItem( aSet, SvxFontItem( rBulletFont.GetFamily(),
- rBulletFont.GetName(), rBulletFont.GetStyleName(),
+ rBulletFont.GetFamilyName(), rBulletFont.GetStyleName(),
rBulletFont.GetPitch(), rBulletFont.GetCharSet(), RES_CHRATR_FONT ));
}
break;
diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index 2c1c57d4dcc3..bd5e6a52a191 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -1620,7 +1620,7 @@ void SwAutoFormat::BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel )
m_aDelPam.GetMark()->nContent = 1;
SetAllScriptItem( aSet,
SvxFontItem( m_aFlags.aBulletFont.GetFamily(),
- m_aFlags.aBulletFont.GetName(),
+ m_aFlags.aBulletFont.GetFamilyName(),
m_aFlags.aBulletFont.GetStyleName(),
m_aFlags.aBulletFont.GetPitch(),
m_aFlags.aBulletFont.GetCharSet(),
diff --git a/sw/source/core/inc/swfont.hxx b/sw/source/core/inc/swfont.hxx
index 60c2eed78c76..3f52b090a5fe 100644
--- a/sw/source/core/inc/swfont.hxx
+++ b/sw/source/core/inc/swfont.hxx
@@ -287,7 +287,7 @@ public:
sal_uInt16 GetOrientation( const bool bVertLayout = false ) const;
inline const OUString& GetName( const sal_uInt8 nWhich ) const
- { return m_aSub[nWhich].GetName(); }
+ { return m_aSub[nWhich].GetFamilyName(); }
inline LanguageType GetLanguage( const sal_uInt8 nWhich ) const
{ return m_aSub[nWhich].GetLanguage(); }
inline rtl_TextEncoding GetCharSet( const sal_uInt8 nWhich ) const
diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index c470a067f710..dc01d799dd9a 100644
--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -537,7 +537,7 @@ SwNumberPortion *SwTextFormatter::NewNumberPortion( SwTextFormatInfo &rInf ) con
{
const sal_uInt8 nAct = pNumFnt->GetActual();
pNumFnt->SetFamily( pFormatFnt->GetFamily(), nAct );
- pNumFnt->SetName( pFormatFnt->GetName(), nAct );
+ pNumFnt->SetName( pFormatFnt->GetFamilyName(), nAct );
pNumFnt->SetStyleName( pFormatFnt->GetStyleName(), nAct );
pNumFnt->SetCharSet( pFormatFnt->GetCharSet(), nAct );
pNumFnt->SetPitch( pFormatFnt->GetPitch(), nAct );
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index abd97f7ed2a4..3bc1da5c22dc 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -361,7 +361,7 @@ sal_uInt16 SwFntObj::GetFontLeading( const SwViewShell *pSh, const OutputDevice&
bSymbol = RTL_TEXTENCODING_SYMBOL == aMet.GetCharSet();
GuessLeading( *pSh, aMet );
nExtLeading = static_cast<sal_uInt16>(aMet.GetExternalLeading());
- /* HACK: There is something wrong with Writer's bullet rendering, causing lines
+ /* HACK: FIXME There is something wrong with Writer's bullet rendering, causing lines
with bullets to be higher than they should be. I think this is because
Writer uses font's external leading incorrect, as the vertical distance
added to every line instead of only a distance between multiple lines,
@@ -376,7 +376,7 @@ sal_uInt16 SwFntObj::GetFontLeading( const SwViewShell *pSh, const OutputDevice&
Interestingly enough, bSymbol is false for 'StarSymbol; Arial Unicode MS', so
also check explicitly.
*/
- if( bSymbol || IsStarSymbol( pPrtFont->GetName()))
+ if( bSymbol || IsStarSymbol( pPrtFont->GetFamilyName()))
nExtLeading = 0;
}
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index ecb3bfb90088..7ae1320d46f1 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -1084,7 +1084,7 @@ void SwTextNode::SetLanguageAndFont( const SwPaM &rPaM,
if (pFont)
{
SvxFontItem aFontItem = static_cast<const SvxFontItem&>( aSet.Get( nFontWhichId ) );
- aFontItem.SetFamilyName( pFont->GetName());
+ aFontItem.SetFamilyName( pFont->GetFamilyName());
aFontItem.SetFamily( pFont->GetFamily());
aFontItem.SetStyleName( pFont->GetStyleName());
aFontItem.SetPitch( pFont->GetPitch());
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx
index 41904cebfdbb..0bd244589e2f 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -816,7 +816,7 @@ void setNumberingProperty(const Any& rValue, SwPaM& rPam)
if(
!pBulletFontNames[i].isEmpty() &&
!SwXNumberingRules::isInvalidStyle(pBulletFontNames[i]) &&
- (!aFormat.GetBulletFont() || aFormat.GetBulletFont()->GetName() != pBulletFontNames[i])
+ (!aFormat.GetBulletFont() || aFormat.GetBulletFont()->GetFamilyName() != pBulletFontNames[i])
)
{
const SvxFontListItem* pFontListItem =
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index f18f9ef29fb8..118d4d524aab 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -89,7 +89,6 @@
#include <cassert>
#include <memory>
#include <set>
-#include <limits>
namespace
{
@@ -244,8 +243,6 @@ namespace sw
};
}
-
-class SwStyleBase_Impl;
class SwXStyle : public cppu::WeakImplHelper
<
css::style::XStyle,
@@ -272,8 +269,6 @@ protected:
css::uno::Reference<css::container::XNameAccess> m_xStyleFamily;
css::uno::Reference<css::beans::XPropertySet> m_xStyleData;
- template<sal_uInt16>
- void SetPropertyValue(const SfxItemPropertySimpleEntry&, const SfxItemPropertySet&, const uno::Any&, SwStyleBase_Impl&);
void SAL_CALL SetPropertyValues_Impl( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Sequence< css::uno::Any >& aValues )
throw (css::beans::UnknownPropertyException,
css::beans::PropertyVetoException,
@@ -364,8 +359,6 @@ public:
void Invalidate();
void ApplyDescriptorProperties();
void SetStyleName(const OUString& rSet){ m_sStyleName = rSet;}
- void SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, const SfxItemPropertySet& rPropSet, const uno::Any& rValue, SwStyleBase_Impl& rBase) throw(beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException, std::exception);
- void PutItemToSet(const SvxSetItem* pSetItem, const SfxItemPropertySet& rPropSet, const SfxItemPropertySimpleEntry& rEntry, const uno::Any& rVal, SwStyleBase_Impl& rBaseImpl);
};
class SwXFrameStyle
@@ -1099,7 +1092,7 @@ static uno::Reference<beans::XPropertySet> lcl_InitStandardStyle(const SfxStyleF
if(eFamily != SFX_STYLE_FAMILY_PARA && eFamily != SFX_STYLE_FAMILY_PAGE)
return {};
auto aResult(rxStyleFamily->getByName("Standard"));
- if(!aResult.has<return_t>())
+ if(!aResult.isExtractableTo(cppu::UnoType<return_t>::get()))
return {};
return aResult.get<return_t>();
}
@@ -1115,7 +1108,7 @@ static uno::Reference<container::XNameAccess> lcl_InitStyleFamily(SwDoc* pDoc, c
uno::Reference<style::XStyleFamiliesSupplier> xFamilySupplier(xModel, uno::UNO_QUERY);
auto xFamilies = xFamilySupplier->getStyleFamilies();
auto aResult(xFamilies->getByName(rEntry.m_sName));
- if(!aResult.has<return_t>())
+ if(!aResult.isExtractableTo(cppu::UnoType<return_t>::get()))
return {};
return aResult.get<return_t>();
}
@@ -1406,453 +1399,580 @@ const SwPageDesc* SwStyleBase_Impl::GetOldPageDesc()
return m_pOldPageDesc;
}
-static void lcl_SetDefaultWay(const SfxItemPropertySimpleEntry& rEntry, const SfxItemPropertySet& rPropSet, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
-{
- // default ItemSet handling
- SfxItemSet& rStyleSet = o_rStyleBase.GetItemSet();
- SfxItemSet aSet(*rStyleSet.GetPool(), rEntry.nWID, rEntry.nWID);
- aSet.SetParent(&rStyleSet);
- rPropSet.setPropertyValue(rEntry, rValue, aSet);
- rStyleSet.Put(aSet);
-}
-sal_uInt8 lcl_TranslateMetric(const SfxItemPropertySimpleEntry& rEntry, SwDoc* pDoc, uno::Any& o_aValue)
-{
- // check for needed metric translation
- if(!(rEntry.nMemberId & SFX_METRIC_ITEM))
- return rEntry.nMemberId;
- // exception: If these ItemTypes are used, do not convert when these are negative
- // since this means they are intended as percent values
- if((XATTR_FILLBMP_SIZEX == rEntry.nWID || XATTR_FILLBMP_SIZEY == rEntry.nWID)
- && o_aValue.has<sal_Int32>()
- && o_aValue.get<sal_Int32>() < 0)
- return rEntry.nMemberId;
- if(!pDoc)
- return rEntry.nMemberId & (~SFX_METRIC_ITEM);
+static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
+ const SfxItemPropertySet& rPropSet,
+ const uno::Any& rValue,
+ SwStyleBase_Impl& rBase,
+ SfxStyleSheetBasePool* pBasePool,
+ SwDoc* pDoc,
+ SfxStyleFamily eFamily)
+ throw(beans::PropertyVetoException, lang::IllegalArgumentException,
+ lang::WrappedTargetException, uno::RuntimeException,
+ std::exception)
- const SfxItemPool& rPool = pDoc->GetAttrPool();
- const SfxMapUnit eMapUnit(rPool.GetMetric(rEntry.nWID));
- if(eMapUnit != SFX_MAPUNIT_100TH_MM)
- SvxUnoConvertFromMM(eMapUnit, o_aValue);
- return rEntry.nMemberId & (~SFX_METRIC_ITEM);
-}
-template<>
-void SwXStyle::SetPropertyValue<FN_UNO_HIDDEN>(const SfxItemPropertySimpleEntry& rEntry, const SfxItemPropertySet& rPropSet, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
-{
- bool bHidden = false;
- if(rValue >>= bHidden)
- {
- //make it a 'real' style - necessary for pooled styles
- o_rStyleBase.getNewBase()->GetItemSet();
- o_rStyleBase.getNewBase()->SetHidden(bHidden);
- }
- lcl_SetDefaultWay(rEntry, rPropSet, rValue, o_rStyleBase);
-}
-template<>
-void SwXStyle::SetPropertyValue<FN_UNO_STYLE_INTEROP_GRAB_BAG>(const SfxItemPropertySimpleEntry& rEntry, const SfxItemPropertySet& rPropSet, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
-{
- o_rStyleBase.getNewBase()->GetItemSet();
- o_rStyleBase.getNewBase()->SetGrabBagItem(rValue);
- lcl_SetDefaultWay(rEntry, rPropSet, rValue, o_rStyleBase);
-}
-template<>
-void SwXStyle::SetPropertyValue<XATTR_FILLGRADIENT>(const SfxItemPropertySimpleEntry& rEntry, const SfxItemPropertySet& rPropSet, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
{
+ //UUUU adapted switch logic to a more readable state; removed goto's and made
+ // execution of standard setting of proerty in ItemSet dependent of this variable
+ bool bDone(false);
+
+ //UUUU
+ const sal_uInt8 nMemberId(rEntry.nMemberId & (~SFX_METRIC_ITEM));
uno::Any aValue(rValue);
- const auto nMemberId(lcl_TranslateMetric(rEntry, m_pDoc, aValue));
- if(MID_NAME == nMemberId)
+
+ //UUUU check for needed metric translation
+ if(rEntry.nMemberId & SFX_METRIC_ITEM)
{
- // add set commands for FillName items
- SfxItemSet& rStyleSet = o_rStyleBase.GetItemSet();
- if(!aValue.has<OUString>())
- throw lang::IllegalArgumentException();
- SvxShape::SetFillAttribute(rEntry.nWID, aValue.get<OUString>(), rStyleSet);
+ bool bDoIt(true);
+
+ if(XATTR_FILLBMP_SIZEX == rEntry.nWID || XATTR_FILLBMP_SIZEY == rEntry.nWID)
+ {
+ // exception: If these ItemTypes are used, do not convert when these are negative
+ // since this means they are intended as percent values
+ sal_Int32 nValue = 0;
+
+ if(aValue >>= nValue)
+ {
+ bDoIt = nValue > 0;
+ }
+ }
+
+ if(bDoIt && pDoc)
+ {
+ const SfxItemPool& rPool = pDoc->GetAttrPool();
+ const SfxMapUnit eMapUnit(rPool.GetMetric(rEntry.nWID));
+
+ if(eMapUnit != SFX_MAPUNIT_100TH_MM)
+ {
+ SvxUnoConvertFromMM(eMapUnit, aValue);
+ }
+ }
}
- else if(MID_GRAFURL == nMemberId)
+
+ switch(rEntry.nWID)
{
- if(XATTR_FILLBITMAP == rEntry.nWID)
+ case FN_UNO_HIDDEN:
{
- // Bitmap also has the MID_GRAFURL mode where a Bitmap URL is used
- const Graphic aNullGraphic;
- SfxItemSet& rStyleSet = o_rStyleBase.GetItemSet();
- XFillBitmapItem aXFillBitmapItem(rStyleSet.GetPool(), aNullGraphic);
- aXFillBitmapItem.PutValue(aValue, nMemberId);
- rStyleSet.Put(aXFillBitmapItem);
+ bool bHidden = false;
+ if ( rValue >>= bHidden )
+ {
+ //make it a 'real' style - necessary for pooled styles
+ rBase.getNewBase()->GetItemSet();
+ rBase.getNewBase()->SetHidden( bHidden );
+ }
}
- }
- else
- lcl_SetDefaultWay(rEntry, rPropSet, aValue, o_rStyleBase);
-}
-template<>
-void SwXStyle::SetPropertyValue<RES_BACKGROUND>(const SfxItemPropertySimpleEntry& rEntry, const SfxItemPropertySet&, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
-{
- SfxItemSet& rStyleSet = o_rStyleBase.GetItemSet();
- const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rStyleSet, RES_BACKGROUND, true, m_pDoc->IsInXMLImport()));
- SvxBrushItem aChangedBrushItem(aOriginalBrushItem);
+ break;
- uno::Any aValue(rValue);
- const auto nMemberId(lcl_TranslateMetric(rEntry, m_pDoc, aValue));
- aChangedBrushItem.PutValue(aValue, nMemberId);
+ case FN_UNO_STYLE_INTEROP_GRAB_BAG:
+ {
+ rBase.getNewBase()->GetItemSet();
+ rBase.getNewBase()->SetGrabBagItem(rValue);
+ }
+ break;
- // 0xff is already the default - but if BackTransparent is set
- // to true, it must be applied in the item set on ODF import
- // to potentially override parent style, which is unknown yet
- if(aChangedBrushItem == aOriginalBrushItem && (MID_GRAPHIC_TRANSPARENT != nMemberId || !aValue.has<bool>() || !aValue.get<bool>()))
- return;
+ case XATTR_FILLGRADIENT:
+ case XATTR_FILLHATCH:
+ case XATTR_FILLBITMAP:
+ case XATTR_FILLFLOATTRANSPARENCE:
+ // not yet needed; activate when LineStyle support may be added
+ // case XATTR_LINESTART:
+ // case XATTR_LINEEND:
+ // case XATTR_LINEDASH:
+ {
+ if(MID_NAME == nMemberId)
+ {
+ //UUUU add set commands for FillName items
+ OUString aTempName;
+ SfxItemSet& rStyleSet = rBase.GetItemSet();
- setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, rStyleSet);
-}
-template<>
-void SwXStyle::SetPropertyValue<OWN_ATTR_FILLBMP_MODE>(const SfxItemPropertySimpleEntry&, const SfxItemPropertySet&, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
-{
- drawing::BitmapMode eMode;
- if(!(rValue >>= eMode))
- {
- if(!rValue.has<sal_Int32>())
- throw lang::IllegalArgumentException();
- eMode = ((drawing::BitmapMode)rValue.get<sal_Int32>());
- }
- SfxItemSet& rStyleSet = o_rStyleBase.GetItemSet();
- rStyleSet.Put(XFillBmpStretchItem(drawing::BitmapMode_STRETCH == eMode));
- rStyleSet.Put(XFillBmpTileItem(drawing::BitmapMode_REPEAT == eMode));
-}
-template<>
-void SwXStyle::SetPropertyValue<RES_PAPER_BIN>(const SfxItemPropertySimpleEntry& rEntry, const SfxItemPropertySet& rPropSet, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
-{
- if(!rValue.has<OUString>())
- throw lang::IllegalArgumentException();
- SfxPrinter* pPrinter = m_pDoc->getIDocumentDeviceAccess().getPrinter(true);
- OUString sValue(rValue.get<OUString>());
- using printeridx_t = decltype(pPrinter->GetPaperBinCount());
- printeridx_t nBin = std::numeric_limits<printeridx_t>::max();
- if(sValue == "[From printer settings]")
- nBin = std::numeric_limits<printeridx_t>::max()-1;
- else if(pPrinter)
- {
- for(sal_uInt16 i=0, nEnd = pPrinter->GetPaperBinCount(); i < nEnd; ++i)
+ if(!(aValue >>= aTempName))
+ {
+ throw lang::IllegalArgumentException();
+ }
+
+ SvxShape::SetFillAttribute(rEntry.nWID, aTempName, rStyleSet);
+ bDone = true;
+ }
+ else if(MID_GRAFURL == nMemberId)
+ {
+ if(XATTR_FILLBITMAP == rEntry.nWID)
+ {
+ //UUUU Bitmap also has the MID_GRAFURL mode where a Bitmap URL is used
+ const Graphic aNullGraphic;
+ SfxItemSet& rStyleSet = rBase.GetItemSet();
+ XFillBitmapItem aXFillBitmapItem(rStyleSet.GetPool(), aNullGraphic);
+
+ aXFillBitmapItem.PutValue(aValue, nMemberId);
+ rStyleSet.Put(aXFillBitmapItem);
+ bDone = true;
+ }
+ }
+
+ break;
+ }
+ case RES_BACKGROUND:
{
- if (sValue == pPrinter->GetPaperBinName(i))
+ //UUUU
+ SfxItemSet& rStyleSet = rBase.GetItemSet();
+ const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rStyleSet, RES_BACKGROUND, true, pDoc->IsInXMLImport()));
+ SvxBrushItem aChangedBrushItem(aOriginalBrushItem);
+
+ aChangedBrushItem.PutValue(aValue, nMemberId);
+
+ if (!(aChangedBrushItem == aOriginalBrushItem) ||
+ // 0xff is already the default - but if BackTransparent is set
+ // to true, it must be applied in the item set on ODF import
+ // to potentially override parent style, which is unknown yet
+ (MID_GRAPHIC_TRANSPARENT == nMemberId && aValue.has<bool>() && aValue.get<bool>()))
{
- nBin = i;
- break;
+ setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, rStyleSet);
}
+
+ bDone = true;
+ break;
}
- }
- if(nBin == std::numeric_limits<printeridx_t>::max())
- throw lang::IllegalArgumentException();
- SfxItemSet& rStyleSet = o_rStyleBase.GetItemSet();
- SfxItemSet aSet(*rStyleSet.GetPool(), rEntry.nWID, rEntry.nWID);
- aSet.SetParent(&rStyleSet);
- rPropSet.setPropertyValue(rEntry, uno::makeAny(static_cast<sal_Int8>(nBin == std::numeric_limits<printeridx_t>::max()-1 ? -1 : nBin)), aSet);
- rStyleSet.Put(aSet);
-}
-template<>
-void SwXStyle::SetPropertyValue<FN_UNO_NUM_RULES>(const SfxItemPropertySimpleEntry&, const SfxItemPropertySet&, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
-{
- if(!rValue.has<uno::Reference<container::XIndexReplace>>() || !rValue.has<uno::Reference<lang::XUnoTunnel>>())
- throw lang::IllegalArgumentException();
- auto xNumberTunnel(rValue.get<uno::Reference<lang::XUnoTunnel>>());
- SwXNumberingRules* pSwXRules = reinterpret_cast<SwXNumberingRules*>(sal::static_int_cast<sal_IntPtr>(xNumberTunnel->getSomething(SwXNumberingRules::getUnoTunnelId())));
- if(!pSwXRules)
- return;
- SwNumRule aSetRule(*pSwXRules->GetNumRule());
- for(sal_uInt16 i = 0; i < MAXLEVEL; ++i)
- {
- const SwNumFormat* pFormat = aSetRule.GetNumFormat(i);
- if(!pFormat)
- continue;
- SwNumFormat aFormat(*pFormat);
- const auto pCharName(pSwXRules->GetNewCharStyleNames()[i]);
- if(!pCharName.isEmpty()
- && !SwXNumberingRules::isInvalidStyle(pCharName)
- && (!pFormat->GetCharFormat() || pFormat->GetCharFormat()->GetName() != pCharName))
+ case OWN_ATTR_FILLBMP_MODE:
+ {
+ //UUUU
+ drawing::BitmapMode eMode;
+
+ if(!(aValue >>= eMode))
+ {
+ sal_Int32 nMode = 0;
+
+ if(!(aValue >>= nMode))
+ {
+ throw lang::IllegalArgumentException();
+ }
+
+ eMode = (drawing::BitmapMode)nMode;
+ }
+
+ SfxItemSet& rStyleSet = rBase.GetItemSet();
+
+ rStyleSet.Put(XFillBmpStretchItem(drawing::BitmapMode_STRETCH == eMode));
+ rStyleSet.Put(XFillBmpTileItem(drawing::BitmapMode_REPEAT == eMode));
+
+ bDone = true;
+ break;
+ }
+ case RES_PAPER_BIN:
{
- auto pCharFormatIt(std::find_if(m_pDoc->GetCharFormats()->begin(), m_pDoc->GetCharFormats()->end(),
- [pCharName] (SwCharFormat* pF) { return pF->GetName() == pCharName; }));
- if(pCharFormatIt != m_pDoc->GetCharFormats()->end())
- aFormat.SetCharFormat(*pCharFormatIt);
- else if(m_pBasePool)
+ SfxPrinter *pPrinter = pDoc->getIDocumentDeviceAccess().getPrinter( true );
+ OUString sTmp;
+ sal_uInt16 nBin = USHRT_MAX;
+ if ( !( aValue >>= sTmp ) )
+ throw lang::IllegalArgumentException();
+ if ( sTmp == "[From printer settings]" )
+ nBin = USHRT_MAX-1;
+ else if ( pPrinter )
{
- auto pBase(static_cast<SfxStyleSheetBasePool*>(m_pBasePool)->Find(pCharName, SFX_STYLE_FAMILY_CHAR));
- if(!pBase)
- pBase = &m_pBasePool->Make(pCharName, SFX_STYLE_FAMILY_CHAR);
- aFormat.SetCharFormat(static_cast<SwDocStyleSheet*>(pBase)->GetCharFormat());
+ for (sal_uInt16 i=0, nEnd = pPrinter->GetPaperBinCount(); i < nEnd; i++ )
+ {
+ if (sTmp == pPrinter->GetPaperBinName ( i ) )
+ {
+ nBin = i;
+ break;
+ }
+ }
}
+ if ( nBin == USHRT_MAX )
+ throw lang::IllegalArgumentException();
else
- aFormat.SetCharFormat(nullptr);
+ {
+ SfxItemSet& rStyleSet = rBase.GetItemSet();
+ SfxItemSet aSet(*rStyleSet.GetPool(), rEntry.nWID, rEntry.nWID);
+ aSet.SetParent(&rStyleSet);
+ rPropSet.setPropertyValue(rEntry, uno::makeAny ( static_cast < sal_Int8 > ( nBin == USHRT_MAX-1 ? -1 : nBin ) ), aSet);
+ rStyleSet.Put(aSet);
+ }
+
+ bDone = true;
+ break;
}
- // same for fonts:
- const auto pBulletName(pSwXRules->GetBulletFontNames()[i]);
- if(!pBulletName.isEmpty()
- && !SwXNumberingRules::isInvalidStyle(pBulletName)
- && (!pFormat->GetBulletFont() || pFormat->GetBulletFont()->GetName() != pBulletName))
+ case FN_UNO_NUM_RULES: // special handling for a SvxNumRuleItem:
{
- const auto pFontListItem(static_cast<const SvxFontListItem*>(m_pDoc->GetDocShell()->GetItem(SID_ATTR_CHAR_FONTLIST)));
- const auto pList(pFontListItem->GetFontList());
- FontMetric aFontInfo(pList->Get(pBulletName, WEIGHT_NORMAL, ITALIC_NONE));
- vcl::Font aFont(aFontInfo);
- aFormat.SetBulletFont(&aFont);
+ if(aValue.getValueType() == cppu::UnoType<container::XIndexReplace>::get())
+ {
+ uno::Reference< container::XIndexReplace > const * pxRulesRef =
+ static_cast<uno::Reference< container::XIndexReplace > const *>(aValue.getValue());
+
+ uno::Reference<lang::XUnoTunnel> xNumberTunnel( *pxRulesRef, uno::UNO_QUERY);
+
+ SwXNumberingRules* pSwXRules = nullptr;
+ if(xNumberTunnel.is())
+ {
+ pSwXRules = reinterpret_cast< SwXNumberingRules * >(
+ sal::static_int_cast< sal_IntPtr >(xNumberTunnel->getSomething( SwXNumberingRules::getUnoTunnelId()) ));
+ }
+ if(pSwXRules)
+ {
+ const OUString* pCharStyleNames = pSwXRules->GetNewCharStyleNames();
+ const OUString* pBulletFontNames = pSwXRules->GetBulletFontNames();
+
+ SwNumRule aSetRule(*pSwXRules->GetNumRule());
+ const SwCharFormats* pFormats = pDoc->GetCharFormats();
+ const size_t nChCount = pFormats->size();
+ for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
+ {
+
+ const SwNumFormat* pFormat = aSetRule.GetNumFormat( i );
+ if(pFormat)
+ {
+ SwNumFormat aFormat(*pFormat);
+ if (!pCharStyleNames[i].isEmpty() &&
+ !SwXNumberingRules::isInvalidStyle(pCharStyleNames[i]) &&
+ (!pFormat->GetCharFormat() || pFormat->GetCharFormat()->GetName() != pCharStyleNames[i]) )
+ {
+
+ SwCharFormat* pCharFormat = nullptr;
+ for(size_t j = 0; j< nChCount; ++j)
+ {
+ SwCharFormat* pTmp = (*pFormats)[j];
+ if(pTmp->GetName() == pCharStyleNames[i])
+ {
+ pCharFormat = pTmp;
+ break;
+ }
+ }
+ if(!pCharFormat && pBasePool)
+ {
+
+ SfxStyleSheetBase* pBase;
+ pBase = static_cast<SfxStyleSheetBasePool*>(pBasePool)->Find(pCharStyleNames[i], SFX_STYLE_FAMILY_CHAR);
+ if(!pBase)
+ pBase = &pBasePool->Make(pCharStyleNames[i], SFX_STYLE_FAMILY_CHAR);
+ pCharFormat = static_cast<SwDocStyleSheet*>(pBase)->GetCharFormat();
+
+ }
+
+ aFormat.SetCharFormat( pCharFormat );
+ }
+ // same for fonts:
+ if (!pBulletFontNames[i].isEmpty() &&
+ !SwXNumberingRules::isInvalidStyle(pBulletFontNames[i]) &&
+ (!pFormat->GetBulletFont() || pFormat->GetBulletFont()->GetFamilyName() != pBulletFontNames[i]) )
+ {
+ const SvxFontListItem* pFontListItem =
+ static_cast<const SvxFontListItem*>(pDoc->GetDocShell()
+ ->GetItem( SID_ATTR_CHAR_FONTLIST ));
+ const FontList* pList = pFontListItem->GetFontList();
+ FontMetric aFontMetric = pList->Get(
+ pBulletFontNames[i],WEIGHT_NORMAL, ITALIC_NONE);
+ vcl::Font aFont(aFontMetric);
+ aFormat.SetBulletFont(&aFont);
+ }
+ aSetRule.Set( i, &aFormat );
+ }
+ }
+ rBase.getNewBase()->SetNumRule(aSetRule);
+ }
+ }
+ else
+ throw lang::IllegalArgumentException();
+
+ bDone = true;
+ break;
}
- aSetRule.Set(i, &aFormat);
- }
- o_rStyleBase.getNewBase()->SetNumRule(aSetRule);
-}
-template<>
-void SwXStyle::SetPropertyValue<RES_PARATR_OUTLINELEVEL>(const SfxItemPropertySimpleEntry&, const SfxItemPropertySet&, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
-{
- if(!rValue.has<sal_Int16>())
- return;
- const auto nLevel(rValue.get<sal_Int16>());
- if(0 <= nLevel && nLevel <= MAXLEVEL)
- o_rStyleBase.getNewBase()->GetCollection()->SetAttrOutlineLevel(nLevel);
-}
-template<>
-void SwXStyle::SetPropertyValue<FN_UNO_FOLLOW_STYLE>(const SfxItemPropertySimpleEntry&, const SfxItemPropertySet&, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
-{
- if(!rValue.has<OUString>())
- return;
- const auto sValue(rValue.get<OUString>());
- OUString aString;
- SwStyleNameMapper::FillUIName(sValue, aString, m_rEntry.m_aPoolId, true);
- o_rStyleBase.getNewBase()->SetFollow(aString);
-}
-template<>
-void SwXStyle::SetPropertyValue<RES_PAGEDESC>(const SfxItemPropertySimpleEntry& rEntry, const SfxItemPropertySet& rPropSet, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
-{
- if(MID_PAGEDESC_PAGEDESCNAME != rEntry.nMemberId)
- {
- lcl_SetDefaultWay(rEntry, rPropSet, rValue, o_rStyleBase);
- return;
- }
- if(!rValue.has<OUString>())
- throw lang::IllegalArgumentException();
- // special handling for RES_PAGEDESC
- SfxItemSet& rStyleSet = o_rStyleBase.GetItemSet();
- std::unique_ptr<SwFormatPageDesc> pNewDesc;
- const SfxPoolItem* pItem;
- if(SfxItemState::SET == rStyleSet.GetItemState(RES_PAGEDESC, true, &pItem))
- pNewDesc.reset(new SwFormatPageDesc(*static_cast<const SwFormatPageDesc*>(pItem)));
- else
- pNewDesc.reset(new SwFormatPageDesc);
- const auto sValue(rValue.get<OUString>());
- OUString sDescName;
- SwStyleNameMapper::FillUIName(sValue, sDescName, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC, true);
- if(pNewDesc->GetPageDesc() && pNewDesc->GetPageDesc()->GetName() == sDescName)
- return;
- if(sDescName.isEmpty())
- {
- rStyleSet.ClearItem(RES_BREAK);
- rStyleSet.Put(SwFormatPageDesc());
- }
- else
- {
- SwPageDesc* pPageDesc(SwPageDesc::GetByName(*m_pDoc, sDescName));
- if(!pPageDesc)
- throw lang::IllegalArgumentException();
- pNewDesc->RegisterToPageDesc(*pPageDesc);
- rStyleSet.Put(*pNewDesc);
- }
-}
-template<>
-void SwXStyle::SetPropertyValue<RES_TEXT_VERT_ADJUST>(const SfxItemPropertySimpleEntry&, const SfxItemPropertySet&, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
-{
- if(!m_pDoc || !rValue.has<drawing::TextVerticalAdjust>() || !o_rStyleBase.GetOldPageDesc())
- return;
- SwPageDesc* pPageDesc = m_pDoc->FindPageDesc(o_rStyleBase.GetOldPageDesc()->GetName());
- if(pPageDesc)
- pPageDesc->SetVerticalAdjustment(rValue.get<drawing::TextVerticalAdjust>());
-}
-template<>
-void SwXStyle::SetPropertyValue<FN_UNO_IS_AUTO_UPDATE>(const SfxItemPropertySimpleEntry&, const SfxItemPropertySet&, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
-{
- if(!rValue.has<bool>())
- throw lang::IllegalArgumentException();
- const bool bAuto(rValue.get<bool>());
- if(SFX_STYLE_FAMILY_PARA == m_rEntry.m_eFamily)
- o_rStyleBase.getNewBase()->GetCollection()->SetAutoUpdateFormat(bAuto);
- else if(SFX_STYLE_FAMILY_FRAME == m_rEntry.m_eFamily)
- o_rStyleBase.getNewBase()->GetFrameFormat()->SetAutoUpdateFormat(bAuto);
-}
-template<>
-void SwXStyle::SetPropertyValue<FN_UNO_PARA_STYLE_CONDITIONS>(const SfxItemPropertySimpleEntry&, const SfxItemPropertySet&, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
-{
- static_assert(COND_COMMAND_COUNT == 28, "invalid size of command count?");
- using expectedarg_t = uno::Sequence<beans::NamedValue>;
- if(!rValue.has<expectedarg_t>() || !m_pBasePool)
- throw lang::IllegalArgumentException();
- SwCondCollItem aCondItem;
- for(auto& rNamedValue : rValue.get<expectedarg_t>())
- {
- if(!rNamedValue.Value.has<OUString>())
- throw lang::IllegalArgumentException();
-
- const OUString sValue(rNamedValue.Value.get<OUString>());
- // get UI style name from programmatic style name
- OUString aStyleName;
- SwStyleNameMapper::FillUIName(sValue, aStyleName, lcl_GetSwEnumFromSfxEnum(m_rEntry.m_eFamily), true);
-
- // check for correct context and style name
- const auto nIdx(GetCommandContextIndex(rNamedValue.Name));
- if(nIdx == -1)
- throw lang::IllegalArgumentException();
- m_pBasePool->SetSearchMask(SFX_STYLE_FAMILY_PARA);
- for(auto pBase = m_pBasePool->First(); pBase->GetName() != aStyleName; pBase = m_pBasePool->Next())
+
+ case RES_PARATR_OUTLINELEVEL:
{
- if(!pBase)
+ sal_Int16 nLevel = 0;
+ aValue >>= nLevel;
+ if( 0 <= nLevel && nLevel <= MAXLEVEL)
+ rBase.getNewBase()->GetCollection()->SetAttrOutlineLevel( nLevel );
+
+ bDone = true;
+ break;
+ }
+
+ case FN_UNO_FOLLOW_STYLE:
+ {
+ OUString sTmp;
+ aValue >>= sTmp;
+ OUString aString;
+ SwStyleNameMapper::FillUIName(sTmp, aString, lcl_GetSwEnumFromSfxEnum ( eFamily ), true ) ;
+ rBase.getNewBase()->SetFollow( aString );
+
+ bDone = true;
+ break;
+ }
+ case RES_PAGEDESC :
+ {
+ if (MID_PAGEDESC_PAGEDESCNAME != nMemberId)
+ break;
+ // special handling for RES_PAGEDESC
+ if(aValue.getValueType() != ::cppu::UnoType<OUString>::get())
throw lang::IllegalArgumentException();
+ SfxItemSet& rStyleSet = rBase.GetItemSet();
+
+ std::unique_ptr<SwFormatPageDesc> pNewDesc;
+ const SfxPoolItem* pItem;
+ if(SfxItemState::SET == rStyleSet.GetItemState( RES_PAGEDESC, true, &pItem ) )
+ {
+ pNewDesc.reset( new SwFormatPageDesc(*static_cast<const SwFormatPageDesc*>(pItem)) );
+ }
+ else
+ pNewDesc.reset( new SwFormatPageDesc );
+ OUString uDescName;
+ aValue >>= uDescName;
+ OUString sDescName;
+ SwStyleNameMapper::FillUIName(uDescName, sDescName, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC, true );
+ if(!pNewDesc->GetPageDesc() || pNewDesc->GetPageDesc()->GetName() != sDescName)
+ {
+ bool bPut = false;
+ if (!sDescName.isEmpty())
+ {
+ SwPageDesc* pPageDesc = SwPageDesc::GetByName(*pDoc, sDescName);
+ if(pPageDesc)
+ {
+ pNewDesc->RegisterToPageDesc( *pPageDesc );
+ bPut = true;
+ }
+ else
+ {
+ throw lang::IllegalArgumentException();
+ }
+ }
+ if(!bPut)
+ {
+ rStyleSet.ClearItem(RES_BREAK);
+ rStyleSet.Put(SwFormatPageDesc());
+ }
+ else
+ rStyleSet.Put(*pNewDesc);
+
+ }
+ bDone = true;
+ break;
}
- aCondItem.SetStyle(&aStyleName, nIdx);
- }
- o_rStyleBase.GetItemSet().Put(aCondItem);
-}
-template<>
-void SwXStyle::SetPropertyValue<FN_UNO_CATEGORY>(const SfxItemPropertySimpleEntry&, const SfxItemPropertySet&, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
-{
- using paragraphstyle_t = std::remove_const<decltype(style::ParagraphStyleCategory::TEXT)>::type;
- using paragraphcorestyle_t = sal_uInt16;
- if(!o_rStyleBase.getNewBase()->IsUserDefined() || !rValue.has<paragraphstyle_t>())
- throw lang::IllegalArgumentException();
- static std::unique_ptr<std::map<paragraphstyle_t, paragraphcorestyle_t>> pUnoToCore;
- if(!pUnoToCore)
- {
- pUnoToCore.reset(new std::map<paragraphstyle_t, paragraphcorestyle_t> {
- { style::ParagraphStyleCategory::TEXT, SWSTYLEBIT_TEXT },
- { style::ParagraphStyleCategory::CHAPTER, SWSTYLEBIT_CHAPTER },
- { style::ParagraphStyleCategory::LIST, SWSTYLEBIT_LIST },
- { style::ParagraphStyleCategory::INDEX, SWSTYLEBIT_IDX },
- { style::ParagraphStyleCategory::EXTRA, SWSTYLEBIT_EXTRA },
- { style::ParagraphStyleCategory::HTML, SWSTYLEBIT_HTML }
- });
- }
- const auto pUnoToCoreIt(pUnoToCore->find(rValue.get<paragraphstyle_t>()));
- if(pUnoToCoreIt == pUnoToCore->end())
- throw lang::IllegalArgumentException();
- o_rStyleBase.getNewBase()->SetMask( pUnoToCoreIt->second|SFXSTYLEBIT_USERDEF );
-}
-template<>
-void SwXStyle::SetPropertyValue<SID_SWREGISTER_COLLECTION>(const SfxItemPropertySimpleEntry&, const SfxItemPropertySet&, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
-{
- OUString sName;
- rValue >>= sName;
- SwRegisterItem aReg(!sName.isEmpty());
- aReg.SetWhich(SID_SWREGISTER_MODE);
- o_rStyleBase.GetItemSet().Put(aReg);
- OUString aString;
- SwStyleNameMapper::FillUIName(sName, aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, true);
- o_rStyleBase.GetItemSet().Put(SfxStringItem(SID_SWREGISTER_COLLECTION, aString ) );
-}
-template<>
-void SwXStyle::SetPropertyValue<RES_TXTATR_CJK_RUBY>(const SfxItemPropertySimpleEntry& rEntry, const SfxItemPropertySet& rPropSet, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
-{
- if(MID_RUBY_CHARSTYLE != rEntry.nMemberId)
- return;
- if(!rValue.has<OUString>())
- throw lang::IllegalArgumentException();
- const auto sValue(rValue.get<OUString>());
- SfxItemSet& rStyleSet(o_rStyleBase.GetItemSet());
- std::unique_ptr<SwFormatRuby> pRuby;
- const SfxPoolItem* pItem;
- if(SfxItemState::SET == rStyleSet.GetItemState(RES_TXTATR_CJK_RUBY, true, &pItem))
- pRuby.reset(new SwFormatRuby(*static_cast<const SwFormatRuby*>(pItem)));
- else
- pRuby.reset(new SwFormatRuby(OUString()));
- OUString sStyle;
- SwStyleNameMapper::FillUIName(sValue, sStyle, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, true);
- pRuby->SetCharFormatName(sValue);
- pRuby->SetCharFormatId(0);
- if(!sValue.isEmpty())
- {
- const sal_uInt16 nId(SwStyleNameMapper::GetPoolIdFromUIName(sValue, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT));
- pRuby->SetCharFormatId(nId);
- }
- rStyleSet.Put(*pRuby);
- lcl_SetDefaultWay(rEntry, rPropSet, rValue, o_rStyleBase);
-}
-template<>
-void SwXStyle::SetPropertyValue<RES_PARATR_DROP>(const SfxItemPropertySimpleEntry& rEntry, const SfxItemPropertySet&, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
-{
- if(MID_DROPCAP_CHAR_STYLE_NAME != rEntry.nMemberId)
- return;
- if(!rValue.has<OUString>())
- throw lang::IllegalArgumentException();
- SfxItemSet& rStyleSet(o_rStyleBase.GetItemSet());
- std::unique_ptr<SwFormatDrop> pDrop;
- const SfxPoolItem* pItem;
- if(SfxItemState::SET == rStyleSet.GetItemState(RES_PARATR_DROP, true, &pItem))
- pDrop.reset(new SwFormatDrop(*static_cast<const SwFormatDrop*>(pItem)));
- else
- pDrop.reset(new SwFormatDrop);
- const auto sValue(rValue.get<OUString>());
- OUString sStyle;
- SwStyleNameMapper::FillUIName(sValue, sStyle, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, true);
- auto pStyle(static_cast<SwDocStyleSheet*>(m_pDoc->GetDocShell()->GetStyleSheetPool()->Find(sStyle, SFX_STYLE_FAMILY_CHAR)));
- if(!pStyle)
- throw lang::IllegalArgumentException();
- pDrop->SetCharFormat(pStyle->GetCharFormat());
- rStyleSet.Put(*pDrop);
-}
-template<>
-void SwXStyle::SetPropertyValue<RES_PARATR_NUMRULE>(const SfxItemPropertySimpleEntry& rEntry, const SfxItemPropertySet& rPropSet, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
-{
- uno::Any aValue(rValue);
- lcl_TranslateMetric(rEntry, m_pDoc, aValue);
- lcl_SetDefaultWay(rEntry, rPropSet, aValue, o_rStyleBase);
- // --> OD 2006-10-18 #i70223#
- if(SFX_STYLE_FAMILY_PARA == m_rEntry.m_eFamily &&
- o_rStyleBase.getNewBase().is() && o_rStyleBase.getNewBase()->GetCollection() &&
- //rBase.getNewBase()->GetCollection()->GetOutlineLevel() < MAXLEVEL /* assigned to list level of outline style */) //#outline level,removed by zhaojianwei
- o_rStyleBase.getNewBase()->GetCollection()->IsAssignedToListLevelOfOutlineStyle()) ////<-end,add by zhaojianwei
- {
- OUString sNewNumberingRuleName;
- aValue >>= sNewNumberingRuleName;
- if(sNewNumberingRuleName.isEmpty() || sNewNumberingRuleName != m_pDoc->GetOutlineNumRule()->GetName())
- o_rStyleBase.getNewBase()->GetCollection()->DeleteAssignmentToListLevelOfOutlineStyle();
- }
-}
+ case RES_TEXT_VERT_ADJUST:
+ {
+ if( pDoc )
+ {
+ const SwPageDesc* pOldPageDesc = rBase.GetOldPageDesc();
+ SwPageDesc* pPageDesc = pOldPageDesc ? pDoc->FindPageDesc(pOldPageDesc->GetName()) : nullptr;
+ if (pPageDesc)
+ {
+ drawing::TextVerticalAdjust nVA;
+ rValue >>= nVA;
+ pPageDesc->SetVerticalAdjustment( nVA );
+ }
+ }
+ bDone = true;
+ break;
+ }
+ case FN_UNO_IS_AUTO_UPDATE:
+ {
+ bool bAuto = *static_cast<sal_Bool const *>(aValue.getValue());
+ if(SFX_STYLE_FAMILY_PARA == eFamily)
+ rBase.getNewBase()->GetCollection()->SetAutoUpdateFormat(bAuto);
+ else if(SFX_STYLE_FAMILY_FRAME == eFamily)
+ rBase.getNewBase()->GetFrameFormat()->SetAutoUpdateFormat(bAuto);
-void SwXStyle::SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, const SfxItemPropertySet& rPropSet, const uno::Any& rValue, SwStyleBase_Impl& rBase) throw(beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
-{
- using propertytype_t = decltype(rEntry.nWID);
- using coresetter_t = std::function<void(SwXStyle&, const SfxItemPropertySimpleEntry&, const SfxItemPropertySet&, const uno::Any&, SwStyleBase_Impl&)>;
- static std::unique_ptr<std::map<propertytype_t, coresetter_t>> pUnoToCore;
- if(!pUnoToCore)
- {
- pUnoToCore.reset(new std::map<propertytype_t, coresetter_t> {
- // these explicit std::mem_fn() calls shouldnt be needed, but apparently MSVC is currently too stupid for C++11 again
- { FN_UNO_HIDDEN, std::mem_fn(&SwXStyle::SetPropertyValue<FN_UNO_HIDDEN>) },
- { FN_UNO_STYLE_INTEROP_GRAB_BAG, std::mem_fn(&SwXStyle::SetPropertyValue<FN_UNO_STYLE_INTEROP_GRAB_BAG>) },
- { XATTR_FILLGRADIENT, std::mem_fn(&SwXStyle::SetPropertyValue<XATTR_FILLGRADIENT>) },
- { XATTR_FILLHATCH, std::mem_fn(&SwXStyle::SetPropertyValue<XATTR_FILLGRADIENT>) },
- { XATTR_FILLBITMAP, std::mem_fn(&SwXStyle::SetPropertyValue<XATTR_FILLGRADIENT>) },
- { XATTR_FILLFLOATTRANSPARENCE, std::mem_fn(&SwXStyle::SetPropertyValue<XATTR_FILLGRADIENT>) },
- { RES_BACKGROUND, std::mem_fn(&SwXStyle::SetPropertyValue<RES_BACKGROUND>) },
- { OWN_ATTR_FILLBMP_MODE, std::mem_fn(&SwXStyle::SetPropertyValue<OWN_ATTR_FILLBMP_MODE>) },
- { RES_PAPER_BIN, std::mem_fn(&SwXStyle::SetPropertyValue<RES_PAPER_BIN>) },
- { FN_UNO_NUM_RULES, std::mem_fn(&SwXStyle::SetPropertyValue<FN_UNO_NUM_RULES>) },
- { RES_PARATR_OUTLINELEVEL, std::mem_fn(&SwXStyle::SetPropertyValue<RES_PARATR_OUTLINELEVEL>) },
- { FN_UNO_FOLLOW_STYLE, std::mem_fn(&SwXStyle::SetPropertyValue<FN_UNO_FOLLOW_STYLE>) },
- { RES_PAGEDESC, std::mem_fn(&SwXStyle::SetPropertyValue<RES_PAGEDESC>) },
- { RES_TEXT_VERT_ADJUST, std::mem_fn(&SwXStyle::SetPropertyValue<RES_TEXT_VERT_ADJUST>) },
- { FN_UNO_IS_AUTO_UPDATE, std::mem_fn(&SwXStyle::SetPropertyValue<FN_UNO_IS_AUTO_UPDATE>) },
- { FN_UNO_PARA_STYLE_CONDITIONS, std::mem_fn(&SwXStyle::SetPropertyValue<FN_UNO_PARA_STYLE_CONDITIONS>) },
- { FN_UNO_CATEGORY, std::mem_fn(&SwXStyle::SetPropertyValue<FN_UNO_CATEGORY>) },
- { SID_SWREGISTER_COLLECTION, std::mem_fn(&SwXStyle::SetPropertyValue<SID_SWREGISTER_COLLECTION>) },
- { RES_TXTATR_CJK_RUBY, std::mem_fn(&SwXStyle::SetPropertyValue<RES_TXTATR_CJK_RUBY>) },
- { RES_PARATR_DROP, std::mem_fn(&SwXStyle::SetPropertyValue<RES_PARATR_DROP>) },
- { RES_PARATR_DROP, std::mem_fn(&SwXStyle::SetPropertyValue<RES_PARATR_DROP>) },
- { RES_PARATR_NUMRULE, std::mem_fn(&SwXStyle::SetPropertyValue<RES_PARATR_NUMRULE>) }
- });
+ bDone = true;
+ break;
+ }
+ case FN_UNO_PARA_STYLE_CONDITIONS:
+ {
+ uno::Sequence< beans::NamedValue > aSeq;
+ if (!(aValue >>= aSeq))
+ throw lang::IllegalArgumentException();
+
+ OSL_ENSURE(COND_COMMAND_COUNT == 28,
+ "invalid size of command count?");
+ const beans::NamedValue *pSeq = aSeq.getConstArray();
+ const sal_Int32 nLen = aSeq.getLength();
+
+ bool bFailed = false;
+ SwCondCollItem aCondItem;
+ for(sal_Int32 i = 0; i < nLen; ++i)
+ {
+ OUString aTmp;
+ if ((pSeq[i].Value >>= aTmp))
+ {
+ // get UI style name from programmatic style name
+ OUString aStyleName;
+ SwStyleNameMapper::FillUIName(aTmp, aStyleName,
+ lcl_GetSwEnumFromSfxEnum(eFamily), true);
+
+ // check for correct context and style name
+
+ sal_Int16 nIdx = GetCommandContextIndex( pSeq[i].Name );
+
+ bool bStyleFound = false;
+ if (pBasePool)
+ {
+ pBasePool->SetSearchMask( SFX_STYLE_FAMILY_PARA);
+ const SfxStyleSheetBase* pBase = pBasePool->First();
+ while (pBase && !bStyleFound)
+ {
+ if(pBase->GetName() == aStyleName)
+ bStyleFound = true;
+ pBase = pBasePool->Next();
+ }
+ }
+
+ if (nIdx == -1 || !bStyleFound)
+ {
+ bFailed = true;
+ break;
+ }
+
+ aCondItem.SetStyle(&aStyleName, nIdx);
+ }
+ else
+ bFailed = true;
+ }
+ if (bFailed)
+ throw lang::IllegalArgumentException();
+ rBase.GetItemSet().Put( aCondItem );
+ bDone = true;
+ break;
+ }
+ case FN_UNO_CATEGORY:
+ {
+ if(!rBase.getNewBase()->IsUserDefined())
+ throw lang::IllegalArgumentException();
+ short nSet = 0;
+ aValue >>= nSet;
+
+ sal_uInt16 nId;
+ switch( nSet )
+ {
+ case style::ParagraphStyleCategory::TEXT:
+ nId = SWSTYLEBIT_TEXT;
+ break;
+ case style::ParagraphStyleCategory::CHAPTER:
+ nId = SWSTYLEBIT_CHAPTER;
+ break;
+ case style::ParagraphStyleCategory::LIST:
+ nId = SWSTYLEBIT_LIST;
+ break;
+ case style::ParagraphStyleCategory::INDEX:
+ nId = SWSTYLEBIT_IDX;
+ break;
+ case style::ParagraphStyleCategory::EXTRA:
+ nId = SWSTYLEBIT_EXTRA;
+ break;
+ case style::ParagraphStyleCategory::HTML:
+ nId = SWSTYLEBIT_HTML;
+ break;
+ default: throw lang::IllegalArgumentException();
+ }
+
+ rBase.getNewBase()->SetMask( nId|SFXSTYLEBIT_USERDEF );
+ bDone = true;
+ break;
+ }
+ case SID_SWREGISTER_COLLECTION:
+ {
+ OUString sName;
+ aValue >>= sName;
+ SwRegisterItem aReg( !sName.isEmpty() );
+ aReg.SetWhich(SID_SWREGISTER_MODE);
+ rBase.GetItemSet().Put(aReg);
+ OUString aString;
+ SwStyleNameMapper::FillUIName(sName, aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, true);
+
+ rBase.GetItemSet().Put(SfxStringItem(SID_SWREGISTER_COLLECTION, aString ) );
+ bDone = true;
+ break;
+ }
+ case RES_TXTATR_CJK_RUBY:
+ {
+ if(MID_RUBY_CHARSTYLE == nMemberId )
+ {
+ OUString sTmp;
+ if(aValue >>= sTmp)
+ {
+ SfxItemSet& rStyleSet = rBase.GetItemSet();
+ std::unique_ptr<SwFormatRuby> pRuby;
+ const SfxPoolItem* pItem;
+ if(SfxItemState::SET == rStyleSet.GetItemState( RES_TXTATR_CJK_RUBY, true, &pItem ) )
+ pRuby.reset(new SwFormatRuby(*static_cast<const SwFormatRuby*>(pItem)));
+ else
+ pRuby.reset(new SwFormatRuby(OUString()));
+ OUString sStyle;
+ SwStyleNameMapper::FillUIName(sTmp, sStyle, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, true );
+ pRuby->SetCharFormatName( sTmp );
+ pRuby->SetCharFormatId( 0 );
+ if(!sTmp.isEmpty())
+ {
+ sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName( sTmp, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT );
+ pRuby->SetCharFormatId(nId);
+ }
+ rStyleSet.Put(*pRuby);
+ }
+ else
+ throw lang::IllegalArgumentException();
+ }
+ break;
+ }
+ case RES_PARATR_DROP:
+ {
+ if( MID_DROPCAP_CHAR_STYLE_NAME == nMemberId)
+ {
+ if(aValue.getValueType() == ::cppu::UnoType<OUString>::get())
+ {
+ SfxItemSet& rStyleSet = rBase.GetItemSet();
+
+ std::unique_ptr<SwFormatDrop> pDrop;
+ const SfxPoolItem* pItem;
+ if(SfxItemState::SET == rStyleSet.GetItemState( RES_PARATR_DROP, true, &pItem ) )
+ pDrop.reset(new SwFormatDrop(*static_cast<const SwFormatDrop*>(pItem)));
+ else
+ pDrop.reset( new SwFormatDrop );
+ OUString uStyle;
+ aValue >>= uStyle;
+ OUString sStyle;
+ SwStyleNameMapper::FillUIName(uStyle, sStyle, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, true );
+ SwDocStyleSheet* pStyle =
+ static_cast<SwDocStyleSheet*>(pDoc->GetDocShell()->GetStyleSheetPool()->Find(sStyle, SFX_STYLE_FAMILY_CHAR));
+ if(pStyle)
+ pDrop->SetCharFormat(pStyle->GetCharFormat());
+ else
+ throw lang::IllegalArgumentException();
+ rStyleSet.Put(*pDrop);
+ }
+ else
+ throw lang::IllegalArgumentException();
+
+ bDone = true;
+ }
+ break;
+ }
+ default:
+ {
+ // nothing to do
+ break;
+ }
}
- const auto pUnoToCoreIt(pUnoToCore->find(rEntry.nWID));
- if(pUnoToCoreIt != pUnoToCore->end())
- pUnoToCoreIt->second(*this, rEntry, rPropSet, rValue, rBase);
- else
+
+ if(!bDone)
{
- //UUUU adapted switch logic to a more readable state; removed goto's and made
- // execution of standard setting of proerty in ItemSet dependent of this variable
- uno::Any aValue(rValue);
- lcl_TranslateMetric(rEntry, m_pDoc, aValue);
- lcl_SetDefaultWay(rEntry, rPropSet, aValue, rBase);
+ // default ItemSet handling
+ SfxItemSet& rStyleSet = rBase.GetItemSet();
+ SfxItemSet aSet(*rStyleSet.GetPool(), rEntry.nWID, rEntry.nWID);
+ aSet.SetParent(&rStyleSet);
+ rPropSet.setPropertyValue(rEntry, aValue, aSet);
+ rStyleSet.Put(aSet);
+
+ // --> OD 2006-10-18 #i70223#
+ if ( SFX_STYLE_FAMILY_PARA == eFamily &&
+ rEntry.nWID == RES_PARATR_NUMRULE &&
+ rBase.getNewBase().is() && rBase.getNewBase()->GetCollection() &&
+ //rBase.getNewBase()->GetCollection()->GetOutlineLevel() < MAXLEVEL /* assigned to list level of outline style */) //#outline level,removed by zhaojianwei
+ rBase.getNewBase()->GetCollection()->IsAssignedToListLevelOfOutlineStyle() ) ////<-end,add by zhaojianwei
+ {
+ OUString sNewNumberingRuleName;
+ aValue >>= sNewNumberingRuleName;
+ if ( sNewNumberingRuleName.isEmpty() ||
+ sNewNumberingRuleName != pDoc->GetOutlineNumRule()->GetName() )
+ {
+ rBase.getNewBase()->GetCollection()->DeleteAssignmentToListLevelOfOutlineStyle();
+ }
+ }
}
}
@@ -1895,7 +2015,7 @@ void SAL_CALL SwXStyle::SetPropertyValues_Impl(
throw beans::PropertyVetoException ("Property is read-only: " + pNames[nProp], static_cast<cppu::OWeakObject*>(this));
if(aBaseImpl.getNewBase().is())
{
- SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl);
+ lcl_SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl, m_pBasePool, m_pDoc, m_rEntry.m_eFamily);
}
else if(m_bIsDescriptor)
{
@@ -2933,20 +3053,20 @@ SwXPageStyle::~SwXPageStyle()
}
-void SwXStyle::PutItemToSet(const SvxSetItem* pSetItem, const SfxItemPropertySet& rPropSet, const SfxItemPropertySimpleEntry& rEntry, const uno::Any& rVal, SwStyleBase_Impl& rBaseImpl)
+static void lcl_putItemToSet(const SvxSetItem* pSetItem, const SfxItemPropertySet& rPropSet, const SfxItemPropertySimpleEntry& rEntry, const uno::Any& rVal, SwStyleBase_Impl& rBaseImpl, SfxStyleSheetBasePool* pPool, SwDoc *pDoc, SfxStyleFamily eFamily)
{
// create a new SvxSetItem and get it's ItemSet as new target
SvxSetItem* pNewSetItem = static_cast< SvxSetItem* >(pSetItem->Clone());
SfxItemSet& rSetSet = pNewSetItem->GetItemSet();
// set parent to ItemSet to ensure XFILL_NONE as XFillStyleItem
- rSetSet.SetParent(&m_pDoc->GetDfltFrameFormat()->GetAttrSet());
+ rSetSet.SetParent(&pDoc->GetDfltFrameFormat()->GetAttrSet());
// replace the used SfxItemSet at the SwStyleBase_Impl temporarily and use the
// default method to set the property
{
SwStyleBase_Impl::ItemSetOverrider o(rBaseImpl, &rSetSet);
- SetStyleProperty(rEntry, rPropSet, rVal, rBaseImpl);
+ lcl_SetStyleProperty(rEntry, rPropSet, rVal, rBaseImpl, pPool, pDoc, eFamily);
}
// reset paret at ItemSet from SetItem
@@ -3035,7 +3155,7 @@ void SAL_CALL SwXPageStyle::SetPropertyValues_Impl(
if (lcl_GetHeaderFooterItem(aBaseImpl.GetItemSet(),
rPropName, bFooter, pSetItem))
{
- PutItemToSet(pSetItem, *pPropSet, *pEntry, pValues[nProp], aBaseImpl);
+ lcl_putItemToSet(pSetItem, *pPropSet, *pEntry, pValues[nProp], aBaseImpl, m_pBasePool, GetDoc(), GetFamily());
if (pEntry->nWID == SID_ATTR_PAGE_SHARED_FIRST)
{
@@ -3044,7 +3164,7 @@ void SAL_CALL SwXPageStyle::SetPropertyValues_Impl(
bFooter ? SID_ATTR_PAGE_HEADERSET : SID_ATTR_PAGE_FOOTERSET,
false, reinterpret_cast<const SfxPoolItem**>(&pSetItem)))
{
- PutItemToSet(pSetItem, *pPropSet, *pEntry, pValues[nProp], aBaseImpl);
+ lcl_putItemToSet(pSetItem, *pPropSet, *pEntry, pValues[nProp], aBaseImpl, m_pBasePool, GetDoc(), GetFamily());
}
}
}
@@ -3099,7 +3219,7 @@ void SAL_CALL SwXPageStyle::SetPropertyValues_Impl(
default:
{
// part of PageStyle, fallback to default
- SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl);
+ lcl_SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl, m_pBasePool, GetDoc(), GetFamily());
}
}
}
@@ -3150,7 +3270,7 @@ void SAL_CALL SwXPageStyle::SetPropertyValues_Impl(
// default method to set the property
{
SwStyleBase_Impl::ItemSetOverrider o(aBaseImpl, &rSetSet);
- SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl);
+ lcl_SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl, m_pBasePool, GetDoc(), GetFamily());
}
// reset paret at ItemSet from SetItem
@@ -3164,7 +3284,7 @@ void SAL_CALL SwXPageStyle::SetPropertyValues_Impl(
else
{
// part of PageStyle, fallback to default
- SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl);
+ lcl_SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl, m_pBasePool, GetDoc(), GetFamily());
}
break;
@@ -3193,7 +3313,8 @@ void SAL_CALL SwXPageStyle::SetPropertyValues_Impl(
}
default:
{
- SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl);
+ //UUUU
+ lcl_SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl, m_pBasePool, GetDoc(), GetFamily());
break;
}
}
diff --git a/sw/source/filter/ascii/parasc.cxx b/sw/source/filter/ascii/parasc.cxx
index 5c6f63ecf85d..aec0ecd8aa3b 100644
--- a/sw/source/filter/ascii/parasc.cxx
+++ b/sw/source/filter/ascii/parasc.cxx
@@ -116,7 +116,7 @@ SwASCIIParser::SwASCIIParser(SwDoc* pD, const SwPaM& rCursor, SvStream& rIn,
vcl::Font aTextFont( rOpt.GetFontName(), Size( 0, 10 ) );
if( pDoc->getIDocumentDeviceAccess().getPrinter( false ) )
aTextFont = pDoc->getIDocumentDeviceAccess().getPrinter( false )->GetFontMetric( aTextFont );
- SvxFontItem aFont( aTextFont.GetFamily(), aTextFont.GetName(),
+ SvxFontItem aFont( aTextFont.GetFamily(), aTextFont.GetFamilyName(),
OUString(), aTextFont.GetPitch(), aTextFont.GetCharSet(), RES_CHRATR_FONT );
pItemSet->Put( aFont );
pItemSet->Put( aFont, RES_CHRATR_CJK_FONT );
diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx
index 94794a79faa3..8e6b4a2a3ae7 100644
--- a/sw/source/filter/html/htmlform.cxx
+++ b/sw/source/filter/html/htmlform.cxx
@@ -612,7 +612,7 @@ static void lcl_html_setFixedFontProperty(
DefaultFontType::FIXED, LANGUAGE_ENGLISH_US,
GetDefaultFontFlags::OnlyOne ) );
Any aTmp;
- aTmp <<= OUString( aFixedFont.GetName() );
+ aTmp <<= OUString( aFixedFont.GetFamilyName() );
rPropSet->setPropertyValue("FontName", aTmp );
aTmp <<= OUString( aFixedFont.GetStyleName() );
diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx
index 539d77a0522b..4479c535cd83 100644
--- a/sw/source/filter/html/htmlforw.cxx
+++ b/sw/source/filter/html/htmlforw.cxx
@@ -1078,7 +1078,7 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt,
DefaultFontType::FIXED, LANGUAGE_ENGLISH_US,
GetDefaultFontFlags::OnlyOne ) );
OUString aFName( *static_cast<OUString const *>(aTmp.getValue()) );
- if( !bEdit || aFName != aFixedFont.GetName() )
+ if( !bEdit || aFName != aFixedFont.GetFamilyName() )
{
FontFamily eFamily = FAMILY_DONTKNOW;
if( xPropSetInfo->hasPropertyByName( "FontFamily" ) )
diff --git a/sw/source/filter/writer/writer.cxx b/sw/source/filter/writer/writer.cxx
index 6eff01aecd90..b696e7f9bcc3 100644
--- a/sw/source/filter/writer/writer.cxx
+++ b/sw/source/filter/writer/writer.cxx
@@ -332,7 +332,7 @@ void Writer::PutNumFormatFontsInAttrPool()
bCheck = true;
_AddFontItem( rPool, SvxFontItem( pFont->GetFamily(),
- pFont->GetName(), pFont->GetStyleName(),
+ pFont->GetFamilyName(), pFont->GetStyleName(),
pFont->GetPitch(), pFont->GetCharSet(), RES_CHRATR_FONT ));
}
}
diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx
index 084254fd3599..9b58dd38a469 100644
--- a/sw/source/filter/ww8/wrtw8num.cxx
+++ b/sw/source/filter/ww8/wrtw8num.cxx
@@ -424,7 +424,7 @@ void MSWordExportBase::AbstractNumberingDefinitions()
}
eChrSet = pBulletFont->GetCharSet();
- sFontName = pBulletFont->GetName();
+ sFontName = pBulletFont->GetFamilyName();
eFamily = pBulletFont->GetFamily();
if ( IsStarSymbol(sFontName) )
@@ -498,7 +498,7 @@ void MSWordExportBase::AbstractNumberingDefinitions()
aSet.ClearItem( RES_CHRATR_FONT );
if ( sFontName.isEmpty() )
- sFontName = pBulletFont->GetName();
+ sFontName = pBulletFont->GetFamilyName();
pPseudoFont = new wwFont( sFontName, pBulletFont->GetPitch(),
eFamily, eChrSet);
diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index e3eecbd256d8..016b35b62d23 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -641,7 +641,7 @@ static void lcl_SetColl(SwWrtShell* pWrtShell, sal_uInt16 nType,
if( pPrt )
aFont = pPrt->GetFontMetric( aFont );
SwTextFormatColl *pColl = pWrtShell->GetTextCollFromPool(nType);
- pColl->SetFormatAttr(SvxFontItem(aFont.GetFamily(), aFont.GetName(),
+ pColl->SetFormatAttr(SvxFontItem(aFont.GetFamily(), aFont.GetFamilyName(),
aEmptyOUStr, aFont.GetPitch(), aFont.GetCharSet(), nFontWhich));
}
@@ -717,7 +717,7 @@ bool SwStdFontTabPage::FillItemSet( SfxItemSet* )
vcl::Font aFont( sStandard, Size( 0, 10 ) );
if( pPrinter )
aFont = pPrinter->GetFontMetric( aFont );
- m_pWrtShell->SetDefault(SvxFontItem(aFont.GetFamily(), aFont.GetName(),
+ m_pWrtShell->SetDefault(SvxFontItem(aFont.GetFamily(), aFont.GetFamilyName(),
aEmptyOUStr, aFont.GetPitch(), aFont.GetCharSet(), nFontWhich));
SwTextFormatColl *pColl = m_pWrtShell->GetTextCollFromPool(RES_POOLCOLL_STANDARD);
pColl->ResetFormatAttr(nFontWhich);
@@ -829,7 +829,7 @@ void SwStdFontTabPage::Reset( const SfxItemSet* rSet)
for( int i = 0; i < nFontNames; i++ )
{
FontMetric aFontMetric( m_pPrt->GetDevFont( i ) );
- aFontNames.insert( aFontMetric.GetName() );
+ aFontNames.insert( aFontMetric.GetFamilyName() );
}
// insert to listboxes
diff --git a/sw/source/ui/dialog/ascfldlg.cxx b/sw/source/ui/dialog/ascfldlg.cxx
index b0ee67ead375..beb36a6a5359 100644
--- a/sw/source/ui/dialog/ascfldlg.cxx
+++ b/sw/source/ui/dialog/ascfldlg.cxx
@@ -191,7 +191,7 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( vcl::Window* pParent, SwDocShell& rDocSh,
for( int i = 0; i < nFontNames; i++ )
{
FontMetric aFontMetric( pPrt->GetDevFont( i ) );
- aFontNames.insert( aFontMetric.GetName() );
+ aFontNames.insert( aFontMetric.GetFamilyName() );
}
// insert into listbox
@@ -205,7 +205,7 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( vcl::Window* pParent, SwDocShell& rDocSh,
{
LanguageType eLang = aOpt.GetLanguage();
vcl::Font aTmpFont(OutputDevice::GetDefaultFont(DefaultFontType::FIXED, eLang, GetDefaultFontFlags::OnlyOne, pPrt));
- aOpt.SetFontName(aTmpFont.GetName());
+ aOpt.SetFontName(aTmpFont.GetFamilyName());
}
m_pFontLB->SelectEntry( aOpt.GetFontName() );
diff --git a/sw/source/uibase/app/docshini.cxx b/sw/source/uibase/app/docshini.cxx
index 2844b23cde5b..448986570fb5 100644
--- a/sw/source/uibase/app/docshini.cxx
+++ b/sw/source/uibase/app/docshini.cxx
@@ -196,7 +196,7 @@ bool SwDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor )
aFont = pPrt->GetFontMetric( aFont );
}
- pFontItem.reset(new SvxFontItem(aFont.GetFamily(), aFont.GetName(),
+ pFontItem.reset(new SvxFontItem(aFont.GetFamily(), aFont.GetFamilyName(),
aEmptyOUStr, aFont.GetPitch(), aFont.GetCharSet(), nFontWhich));
}
else
@@ -213,7 +213,7 @@ bool SwDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor )
nFontTypes[i],
eLanguage,
GetDefaultFontFlags::OnlyOne );
- pFontItem.reset(new SvxFontItem(aLangDefFont.GetFamily(), aLangDefFont.GetName(),
+ pFontItem.reset(new SvxFontItem(aLangDefFont.GetFamily(), aLangDefFont.GetFamilyName(),
aEmptyOUStr, aLangDefFont.GetPitch(), aLangDefFont.GetCharSet(), nFontWhich));
}
m_pDoc->SetDefault(*pFontItem);
@@ -281,7 +281,7 @@ bool SwDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor )
SfxItemState::SET != pColl->GetAttrSet().GetItemState(
nFontWhich, false ) )
{
- pColl->SetFormatAttr(SvxFontItem(aFont.GetFamily(), aFont.GetName(),
+ pColl->SetFormatAttr(SvxFontItem(aFont.GetFamily(), aFont.GetFamilyName(),
aEmptyOUStr, aFont.GetPitch(), aFont.GetCharSet(), nFontWhich));
}
}
diff --git a/sw/source/uibase/config/fontcfg.cxx b/sw/source/uibase/config/fontcfg.cxx
index 8aa42336a9d5..1f30c3920c51 100644
--- a/sw/source/uibase/config/fontcfg.cxx
+++ b/sw/source/uibase/config/fontcfg.cxx
@@ -257,7 +257,7 @@ OUString SwStdFontConfig::GetDefaultFor(sal_uInt16 nFontType, LanguageType eLan
nFontId = DefaultFontType::LATIN_TEXT;
}
vcl::Font aFont = OutputDevice::GetDefaultFont(nFontId, eLang, GetDefaultFontFlags::OnlyOne);
- return aFont.GetName();
+ return aFont.GetFamilyName();
}
sal_Int32 SwStdFontConfig::GetDefaultHeightFor(sal_uInt16 nFontType, LanguageType eLang)
diff --git a/sw/source/uibase/docvw/srcedtw.cxx b/sw/source/uibase/docvw/srcedtw.cxx
index 3a06617af7fa..353397e2b3d8 100644
--- a/sw/source/uibase/docvw/srcedtw.cxx
+++ b/sw/source/uibase/docvw/srcedtw.cxx
@@ -983,7 +983,7 @@ void SwSrcEditWindow::SetFont()
else
aFont = OutputDevice::GetDefaultFont(DefaultFontType::SANS_UNICODE,
Application::GetSettings().GetLanguageTag().getLanguageType(), GetDefaultFontFlags::NONE, this);
- sFontName = aFont.GetName();
+ sFontName = aFont.GetFamilyName();
}
const SvxFontListItem* pFontListItem =
static_cast<const SvxFontListItem* >(pSrcView->GetDocShell()->GetItem( SID_ATTR_CHAR_FONTLIST ));
diff --git a/sw/source/uibase/lingu/hhcwrp.cxx b/sw/source/uibase/lingu/hhcwrp.cxx
index fde324abb0f0..7a9b020743e3 100644
--- a/sw/source/uibase/lingu/hhcwrp.cxx
+++ b/sw/source/uibase/lingu/hhcwrp.cxx
@@ -151,7 +151,7 @@ SwHHCWrapper::~SwHHCWrapper()
const vcl::Font *pFont = GetTargetFont();
if (pFont)
{
- SvxFontItem aFontItem( pFont->GetFamily(), pFont->GetName(),
+ SvxFontItem aFontItem( pFont->GetFamily(), pFont->GetFamilyName(),
pFont->GetStyleName(), pFont->GetPitch(),
pFont->GetCharSet(), RES_CHRATR_CJK_FONT );
pDoc->SetDefault( aFontItem );
@@ -492,7 +492,7 @@ void SwHHCWrapper::ReplaceUnit(
if (pTargetFont && pNewUnitLanguage)
{
SvxFontItem aFontItem(static_cast<const SvxFontItem&>( aSet.Get( RES_CHRATR_CJK_FONT ) ));
- aFontItem.SetFamilyName( pTargetFont->GetName());
+ aFontItem.SetFamilyName( pTargetFont->GetFamilyName());
aFontItem.SetFamily( pTargetFont->GetFamily());
aFontItem.SetStyleName( pTargetFont->GetStyleName());
aFontItem.SetPitch( pTargetFont->GetPitch());
diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx
index 2d46ca8ceda0..3e8b08591ab1 100644
--- a/sw/source/uibase/shells/annotsh.cxx
+++ b/sw/source/uibase/shells/annotsh.cxx
@@ -1723,7 +1723,7 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq)
if ( pCItem )
{
sSym = pCItem->GetValue();
- aOpt.SetSymbolFont(aFont.GetName());
+ aOpt.SetSymbolFont(aFont.GetFamilyName());
SW_MOD()->ApplyUsrPref(aOpt, &rView);
}
}
@@ -1749,7 +1749,7 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq)
// Attributing (set font)
SfxItemSet aSetFont( *aFontSet.GetPool(), aFontSet.GetRanges() );
- SvxFontItem aFontItem (aFont.GetFamily(), aFont.GetName(),
+ SvxFontItem aFontItem (aFont.GetFamily(), aFont.GetFamilyName(),
aFont.GetStyleName(), aFont.GetPitch(),
aFont.GetCharSet(),
EE_CHAR_FONTINFO );
@@ -1776,8 +1776,8 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq)
pOLV->ShowCursor();
rReq.AppendItem( SfxStringItem( GetPool().GetWhich(SID_CHARMAP), sSym ) );
- if(!aFont.GetName().isEmpty())
- rReq.AppendItem( SfxStringItem( SID_ATTR_SPECIALCHAR, aFont.GetName() ) );
+ if(!aFont.GetFamilyName().isEmpty())
+ rReq.AppendItem( SfxStringItem( SID_ATTR_SPECIALCHAR, aFont.GetFamilyName() ) );
rReq.Done();
}
}
diff --git a/sw/source/uibase/shells/drwtxtsh.cxx b/sw/source/uibase/shells/drwtxtsh.cxx
index 391d0f175f6d..6072b7ef53dc 100644
--- a/sw/source/uibase/shells/drwtxtsh.cxx
+++ b/sw/source/uibase/shells/drwtxtsh.cxx
@@ -760,7 +760,7 @@ void SwDrawTextShell::InsertSymbol(SfxRequest& rReq)
if ( pCItem )
{
sSym = pCItem->GetValue();
- aOpt.SetSymbolFont(aFont.GetName());
+ aOpt.SetSymbolFont(aFont.GetFamilyName());
SW_MOD()->ApplyUsrPref(aOpt, &rView);
}
}
@@ -786,7 +786,7 @@ void SwDrawTextShell::InsertSymbol(SfxRequest& rReq)
// assign attributes (Set font)
SfxItemSet aFontAttribSet( *aFontSet.GetPool(), aFontSet.GetRanges() );
- SvxFontItem aFontItem (aFont.GetFamily(), aFont.GetName(),
+ SvxFontItem aFontItem (aFont.GetFamily(), aFont.GetFamilyName(),
aFont.GetStyleName(), aFont.GetPitch(),
aFont.GetCharSet(),
EE_CHAR_FONTINFO );
@@ -813,8 +813,8 @@ void SwDrawTextShell::InsertSymbol(SfxRequest& rReq)
pOLV->ShowCursor();
rReq.AppendItem( SfxStringItem( GetPool().GetWhich(SID_CHARMAP), sSym ) );
- if(!aFont.GetName().isEmpty())
- rReq.AppendItem( SfxStringItem( SID_ATTR_SPECIALCHAR, aFont.GetName() ) );
+ if(!aFont.GetFamilyName().isEmpty())
+ rReq.AppendItem( SfxStringItem( SID_ATTR_SPECIALCHAR, aFont.GetFamilyName() ) );
rReq.Done();
}
}
diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx
index 3a91e23780e2..058a82825620 100644
--- a/sw/source/uibase/shells/textsh.cxx
+++ b/sw/source/uibase/shells/textsh.cxx
@@ -955,7 +955,7 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq )
if ( pCItem )
{
aChars = pCItem->GetValue();
- aOpt.SetSymbolFont(aNewFont.GetName());
+ aOpt.SetSymbolFont(aNewFont.GetFamilyName());
SW_MOD()->ApplyUsrPref(aOpt, &GetView());
}
}
@@ -991,10 +991,10 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq )
rSh.Insert( aChars );
// #108876# a font attribute has to be set always due to a guessed script type
- if( !aNewFont.GetName().isEmpty() )
+ if( !aNewFont.GetFamilyName().isEmpty() )
{
SvxFontItem aNewFontItem( aFont );
- aNewFontItem.SetFamilyName( aNewFont.GetName());
+ aNewFontItem.SetFamilyName( aNewFont.GetFamilyName() );
aNewFontItem.SetFamily( aNewFont.GetFamily());
aNewFontItem.SetPitch( aNewFont.GetPitch());
aNewFontItem.SetCharSet( aNewFont.GetCharSet() );
@@ -1045,7 +1045,7 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq )
if ( !aChars.isEmpty() )
{
rReq.AppendItem( SfxStringItem( GetPool().GetWhich(SID_CHARMAP), aChars ) );
- rReq.AppendItem( SfxStringItem( SID_ATTR_SPECIALCHAR, aNewFont.GetName() ) );
+ rReq.AppendItem( SfxStringItem( SID_ATTR_SPECIALCHAR, aNewFont.GetFamilyName() ) );
rReq.Done();
}
}