20 #include <svx/svxids.hrc>
32 #include <svx/strings.hrc>
44 #include <com/sun/star/text/VertOrientation.hpp>
45 #include <com/sun/star/style/NumberingType.hpp>
46 #include <com/sun/star/container/XIndexAccess.hpp>
47 #include <com/sun/star/text/DefaultNumberingProvider.hpp>
48 #include <com/sun/star/beans/PropertyValue.hpp>
69 tmp.SetCharSet( RTL_TEXTENCODING_SYMBOL );
70 tmp.SetFamily( FAMILY_DONTKNOW );
71 tmp.SetPitch( PITCH_DONTKNOW );
72 tmp.SetWeight( WEIGHT_DONTKNOW );
73 tmp.SetTransparent(
true );
76 return aDefBulletFont;
93 NumSettings_Impl* pNew =
new NumSettings_Impl;
94 for(
const PropertyValue& rValue : rLevelProps)
96 if(
rValue.Name ==
"NumberingType")
100 pNew->nNumberType =
static_cast<SvxNumType>(nTmp);
102 else if(
rValue.Name ==
"Prefix")
103 rValue.Value >>= pNew->sPrefix;
104 else if(
rValue.Name ==
"Suffix")
105 rValue.Value >>= pNew->sSuffix;
106 else if(
rValue.Name ==
"ParentNumbering")
107 rValue.Value >>= pNew->nParentNumbering;
108 else if(
rValue.Name ==
"BulletChar")
109 rValue.Value >>= pNew->sBulletChar;
110 else if(
rValue.Name ==
"BulletFontName")
111 rValue.Value >>= pNew->sBulletFont;
113 const sal_Unicode cLocalPrefix = pNew->sPrefix.getLength() ? pNew->sPrefix[0] : 0;
114 const sal_Unicode cLocalSuffix = pNew->sSuffix.getLength() ? pNew->sSuffix[0] : 0;
115 if( cLocalPrefix ==
' ') pNew->sPrefix.clear();
116 if( cLocalSuffix ==
' ') pNew->sSuffix.clear();
122 sal_uInt16 NBOTypeMgrBase:: IsSingleLevel(sal_uInt16 nCurLevel)
124 sal_uInt16 nLv = sal_uInt16(0xFFFF);
126 sal_uInt16 nMask = 1;
129 if(nCurLevel & nMask)
140 return sal_uInt16(0xFFFF);
152 aBulletCharFmtName = pBulletCharFmt->
GetValue();
156 aNumCharFmtName = pNumCharFmt->
GetValue();
159 SfxItemState eState = pSet->GetItemState(SID_ATTR_NUMBERING_RULE,
false, &pItem);
160 if(eState == SfxItemState::SET)
162 eCoreUnit = pSet->GetPool()->GetMetric(pSet->GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE));
166 if(eState == SfxItemState::SET)
168 eCoreUnit = pSet->GetPool()->GetMetric(pSet->GetPool()->GetWhich(
EE_PARA_NUMBULLET));
173 void NBOTypeMgrBase::ImplLoad(
const OUString& filename)
176 MapUnit eOldCoreUnit=eCoreUnit;
177 eCoreUnit = MapUnit::Map100thMM;
183 sal_Int32 nNumIndex = 0;
184 xIStm->ReadUInt32( nVersion );
187 xIStm->ReadInt32( nNumIndex );
194 if (aFmt.GetBulletFont()) {
196 Color c=aFont.GetColor();
199 aFmt.SetBulletFont(&aFont);
203 RelplaceNumRule(aNum,nNumIndex,0x1);
204 xIStm->ReadInt32( nNumIndex );
208 eCoreUnit = eOldCoreUnit;
211 void NBOTypeMgrBase::ImplStore(
const OUString& filename)
213 if (bIsLoading)
return;
214 MapUnit eOldCoreUnit=eCoreUnit;
215 eCoreUnit = MapUnit::Map100thMM;
223 xOStm->WriteUInt32( nVersion );
225 if (IsCustomized(nItem)) {
226 SvxNumRule aDefNumRule( SvxNumRuleFlags::BULLET_REL_SIZE | SvxNumRuleFlags::CONTINUOUS | SvxNumRuleFlags::BULLET_COLOR,
229 xOStm->WriteInt32( nItem );
230 ApplyNumRule(aDefNumRule,nItem,0x1,
false,
true);
231 aDefNumRule.
Store(*xOStm);
235 xOStm->WriteInt32( nNumIndex );
237 eCoreUnit = eOldCoreUnit;
241 BulletsSettings* BulletsTypeMgr::pActualBullets[] ={
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr};
242 sal_Unicode BulletsTypeMgr::aDynamicBulletTypes[]={
' ',
' ',
' ',
' ',
' ',
' ',
' ',
' '};
243 sal_Unicode BulletsTypeMgr::aDynamicRTLBulletTypes[]={
' ',
' ',
' ',
' ',
' ',
' ',
' ',
' '};
245 BulletsTypeMgr::BulletsTypeMgr()
253 class theBulletsTypeMgr :
public rtl::Static<BulletsTypeMgr, theBulletsTypeMgr> {};
259 return theBulletsTypeMgr::get();
276 if ( mLevel == sal_uInt16(0xFFFF) || mLevel == 0)
277 return sal_uInt16(0xFFFF);
282 if ( nActLv == sal_uInt16(0xFFFF) )
283 return sal_uInt16(0xFFFF);
297 return sal_uInt16(0xFFFF);
302 if ( mLevel == sal_uInt16(0xFFFF) || mLevel == 0)
310 if ( nActLv == sal_uInt16(0xFFFF) )
315 const vcl::Font* pFont = aFmt.GetBulletFont();
332 sal_uInt16 nMask = 1;
340 aFmt.SetBulletFont(&rActBulletFont);
341 aFmt.SetBulletChar(cChar);
342 aFmt.SetCharFormatName(sBulletCharFormatName);
343 aFmt.SetPrefix(
"" );
344 aFmt.SetSuffix(
"" );
345 if (isResetSize) aFmt.SetBulletRelSize(45);
391 RID_SVXSTR_SINGLENUM_DESCRIPTION_0,
392 RID_SVXSTR_SINGLENUM_DESCRIPTION_1,
393 RID_SVXSTR_SINGLENUM_DESCRIPTION_2,
394 RID_SVXSTR_SINGLENUM_DESCRIPTION_3,
395 RID_SVXSTR_SINGLENUM_DESCRIPTION_4,
396 RID_SVXSTR_SINGLENUM_DESCRIPTION_5,
397 RID_SVXSTR_SINGLENUM_DESCRIPTION_6,
398 RID_SVXSTR_SINGLENUM_DESCRIPTION_7
403 class theNumberingTypeMgr :
public rtl::Static<NumberingTypeMgr, theNumberingTypeMgr> {};
409 return theNumberingTypeMgr::get();
421 aNumberings = xDefNum->getDefaultContinuousNumberingLevels( aLocale );
423 sal_Int32
nLength = aNumberings.getLength();
426 for(sal_Int32
i = 0;
i < nLength;
i++)
429 std::shared_ptr<NumberSettings_Impl> pNumEntry = std::make_shared<NumberSettings_Impl>();
430 pNumEntry->pNumSetting = pNew;
432 pNumEntry->sDescription =
SvxResId(RID_SVXSTR_SINGLENUM_DESCRIPTIONS[i]);
443 if ( mLevel == sal_uInt16(0xFFFF) || mLevel > aNum.
GetLevelCount() || mLevel == 0)
444 return sal_uInt16(0xFFFF);
448 if ( nActLv == sal_uInt16(0xFFFF) )
449 return sal_uInt16(0xFFFF);
454 const OUString&
sPrefix = aFmt.GetPrefix();
455 const OUString& sLclSuffix = aFmt.GetSuffix();
456 sal_Int16 eNumType = aFmt.GetNumberingType();
459 for(sal_uInt16
i = nFromIndex;
i < nCount; ++
i)
465 if (sPrefix == sLocalPrefix &&
466 sLclSuffix == sLocalSuffix &&
474 return sal_uInt16(0xFFFF);
481 if ( nActLv == sal_uInt16(0xFFFF) )
488 if ( nIndex >= nCount )
518 sal_uInt16 nMask = 1;
525 if (eNewType!=aFmt.GetNumberingType()) isResetSize=
true;
530 aFmt.SetCharFormatName(sNumCharFmtName);
531 if (isResetSize) aFmt.SetBulletRelSize(100);
543 if ( nIndex >= nLength )
557 if ( nIndex >= nLength )
580 class theOutlineTypeMgr :
public rtl::Static<OutlineTypeMgr, theOutlineTypeMgr> {};
586 return theOutlineTypeMgr::get();
598 aOutlineAccess = xDefNum->getDefaultOutlineNumberings( aLocale );
600 SvxNumRule aDefNumRule( SvxNumRuleFlags::BULLET_REL_SIZE | SvxNumRuleFlags::CONTINUOUS | SvxNumRuleFlags::BULLET_COLOR,
605 for(sal_Int32 nItem = 0; nItem < nSize; nItem++ )
612 for(sal_Int32 nLevel = 0; nLevel < xLevel->getCount() && nLevel < 5; nLevel++)
614 Any aValueAny = xLevel->getByIndex(nLevel);
616 aValueAny >>= aLevelProps;
620 pNew->
nTabValue = aNumFmt.GetListtabPos();
621 pNew->
eNumAlign = aNumFmt.GetNumAdjust();
624 pItemArr->
pNumSettingsArr->push_back(std::shared_ptr<NumSettings_Impl>(pNew));
636 for(sal_uInt16 iDex = nFromIndex; iDex < nLength; iDex++)
638 bool bNotMatch =
false;
641 for (sal_uInt16 iLevel=0;iLevel < nCount;iLevel++)
647 const OUString&
sPrefix = aFmt.GetPrefix();
648 const OUString& sLclSuffix = aFmt.GetSuffix();
649 sal_Int16 eNumType = aFmt.GetNumberingType();
652 sal_UCS4 cChar = aFmt.GetBulletChar();
657 if ( !((cChar == ccChar) &&
659 _pSet->
nTabValue == aFmt.GetListtabPos() &&
660 _pSet->
eNumAlign == aFmt.GetNumAdjust() &&
670 bool bIsMatch =
false;
671 if (pBrsh1==pBrsh2) bIsMatch =
true;
672 if (pBrsh1 && pBrsh2) {
675 if (pGrf1==pGrf2) bIsMatch =
true;
676 if (pGrf1 && pGrf2) {
678 _pSet->
aSize == aFmt.GetGraphicSize())
688 if (!(sPrefix == _pSet->
sPrefix &&
689 sLclSuffix == _pSet->
sSuffix &&
690 eNumType == eNType &&
692 _pSet->
nTabValue == aFmt.GetListtabPos() &&
693 _pSet->
eNumAlign == aFmt.GetNumAdjust() &&
707 return sal_uInt16(0xFFFF);
713 if ( nIndex >= nLength )
718 for (sal_uInt16 iLevel=0;iLevel < nCount;iLevel++)
733 sal_UCS4 cChar = aFmt.GetBulletChar();
734 OUString sChar(&cChar, 1);
736 if ( aFmt.GetBulletFont() )
737 _pSet->
sBulletFont = aFmt.GetBulletFont()->GetFamilyName();
747 _pSet->
aSize = aFmt.GetGraphicSize();
751 _pSet->
sPrefix = aFmt.GetPrefix();
752 _pSet->
sSuffix = aFmt.GetSuffix();
754 if ( aFmt.GetBulletFont() )
755 _pSet->
sBulletFont = aFmt.GetBulletFont()->GetFamilyName();
786 if(pNumSettingsArr->size() >
i)
787 pLevelSettings = (*pNumSettingsArr)[
i].get();
794 if (pLevelSettings->
nNumberType !=aFmt.GetNumberingType()) isResetSize=
true;
795 aFmt.SetNumberingType( pLevelSettings->
nNumberType );
796 sal_uInt16 nUpperLevelOrChar =
static_cast<sal_uInt16
>(pLevelSettings->
nParentNumbering);
800 pLevelSettings->
sBulletFont != rActBulletFont.GetFamilyName() )
807 pList = pFontListItem ? pFontListItem->
GetFontList() :
nullptr;
813 aFmt.SetBulletFont(&aFont);
819 aCreateFont.
SetCharSet( RTL_TEXTENCODING_DONTKNOW );
824 aFmt.SetBulletFont( &aCreateFont );
827 aFmt.SetBulletFont( &rActBulletFont );
837 if( 0 ==
i && cChar == BulletsTypeMgr::aDynamicBulletTypes[5] )
838 cChar = BulletsTypeMgr::aDynamicRTLBulletTypes[5];
842 if( numberFmt.
GetBulletChar() == BulletsTypeMgr::aDynamicRTLBulletTypes[5] )
843 cChar = BulletsTypeMgr::aDynamicRTLBulletTypes[4];
849 if (isResetSize) aFmt.SetBulletRelSize(45);
854 sal_Int16 eOrient = text::VertOrientation::LINE_CENTER;
855 if (!isResetSize && aFmt.GetGraphicSize()!=
Size(0,0))\
856 aSize = aFmt.GetGraphicSize();
857 else if (aSize.
IsEmpty() && pGrf)
860 aFmt.SetGraphicBrush( pLevelSettings->
pBrushItem, &aSize, &eOrient );
864 aFmt.SetIncludeUpperLevels(sal::static_int_cast< sal_uInt8 >(0 != nUpperLevelOrChar ? aNum.
GetLevelCount() : 0));
866 if (isResetSize) aFmt.SetBulletRelSize(100);
868 if(pNumSettingsArr->size() >
i) {
870 aFmt.SetListtabPos(pLevelSettings->
nTabValue);
871 aFmt.SetNumAdjust(pLevelSettings->
eNumAlign);
872 aFmt.SetFirstLineIndent(pLevelSettings->
nNumAlignAt);
875 aFmt.SetPrefix(pLevelSettings->
sPrefix);
876 aFmt.SetSuffix(pLevelSettings->
sSuffix);
void SetFamily(FontFamily)
SvxNumType GetNumberingType() const
#define DEFAULT_BULLET_TYPES
void SetAlpha(sal_uInt8 nAlpha)
Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
#define DEFAULT_NUM_VALUSET_COUNT
static const AllSettings & GetSettings()
const sal_Unicode cBulletChar
void SetWeight(FontWeight)
void SetCharSet(rtl_TextEncoding)
static SfxObjectShell * Current()
#define DEFAULT_NUMBERING_CACHE_FORMAT_VERSION
bool IsAvailable(const OUString &rName) const
void Store(SvStream &rStream)
css::uno::Any const & rValue
static std::unique_ptr< SvStream > CreateStream(const OUString &rFileName, StreamMode eOpenMode, css::uno::Reference< css::awt::XWindow > xParentWin=nullptr)
OUString SvxResId(const char *pId)
static vcl::Font & lcl_GetDefaultBulletFont()
FontMetric Get(const OUString &rName, const OUString &rStyleName) const
const Graphic * GetGraphic(OUString const &referer=OUString()) const
void SetPitch(FontPitch ePitch)
#define SAL_N_ELEMENTS(arr)
const SfxPoolItem * GetItem(sal_uInt16 nSlotId) const
#define DBG_ASSERT(sCon, aError)
bool Append(OUString const &rTheSegment, EncodeMechanism eMechanism=EncodeMechanism::WasEncoded, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
const OUString & GetValue() const
const SvxNumberFormat & GetLevel(sal_uInt16 nLevel) const
sal_uInt16 GetLevelCount() const
static bool GetLayoutRTL()
BitmapEx GetBitmapEx(const GraphicConversionParameters &rParameters=GraphicConversionParameters()) const
constexpr T & temporary(T &&x)
const LanguageTag & getLocale()
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
void SetTransparent(bool bTransparent)
constexpr TypedWhichId< SvxNumBulletItem > EE_PARA_NUMBULLET(EE_PARA_START+5)
const FontList * GetFontList() const
void SetNumberingType(SvxNumType nSet)
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
void SetLevel(sal_uInt16 nLevel, const SvxNumberFormat &rFmt, bool bIsValid=true)