28 #include <editeng/editeng.hxx>
40 #include <osl/diagnose.h>
45 #include <globstr.hrc>
47 #include <document.hxx>
49 #include <stlpool.hxx>
50 #include <stlsheet.hxx>
57 pActualStyleSheet( nullptr ),
59 bHasStandardStyles(
false )
83 OSL_FAIL(
"renaming additional default style");
85 for ( sal_uInt32 nAdd = 1; nAdd <= nCount; nAdd++ )
87 OUString aNewName =
ScResId(STR_STYLENAME_STANDARD) + OUString::number( nAdd );
88 if (
Find( aNewName, eFam ) ==
nullptr )
104 if ( eFamily == SfxStyleFamily::Para &&
ScResId(STR_STYLENAME_STANDARD) != rName )
105 pSheet->SetParent(
ScResId(STR_STYLENAME_STANDARD) );
112 OSL_ENSURE( rStyle.
isScStyleSheet(),
"Invalid StyleSheet-class! :-/" );
113 return new ScStyleSheet( static_cast<const ScStyleSheet&>(rStyle) );
120 OSL_ENSURE( SfxStyleSearchBits::UserDefined & pStyle->
GetMask(),
121 "SfxStyleSearchBits::UserDefined not set!" );
140 pDestSheet = &
Make( rName, eFamily );
142 rDestSet.
PutExtended( rSourceSet, SfxItemState::DONTCARE, SfxItemState::DEFAULT );
144 if ( eFamily == SfxStyleFamily::Page )
150 const SfxItemSet& rSrcSub = pSetItem->GetItemSet();
152 aDestSub.
PutExtended( rSrcSub, SfxItemState::DONTCARE, SfxItemState::DEFAULT );
156 const SfxItemSet& rSrcSub = pSetItem->GetItemSet();
158 aDestSub.
PutExtended( rSrcSub, SfxItemState::DONTCARE, SfxItemState::DEFAULT );
174 sal_uInt32 nNewFormat = it->second;
199 if ( aNewItem != rSet.
Get( nItemId ) )
202 rSet.
Put( aNewItem );
214 const OUString aHelpFile;
219 std::unique_ptr<EditTextObject> pEmptyTxtObj = aEdEngine.
CreateTextObject();
220 std::unique_ptr<EditTextObject> pTxtObj;
228 OUString aStrStandard =
ScResId(STR_STYLENAME_STANDARD);
234 pSheet =
static_cast<ScStyleSheet*
>( &
Make( aStrStandard, SfxStyleFamily::Para, SfxStyleSearchBits::ScStandard ) );
235 pSheet->
SetHelpId( aHelpFile, HID_SC_SHEET_CELL_STD );
251 eLatin = eUiLanguage;
268 SfxStyleFamily::Page,
269 SfxStyleSearchBits::ScStandard ) );
272 pSheet->
SetHelpId( aHelpFile, HID_SC_SHEET_PAGE_STD );
277 pSet->
Put( aHFSetItem );
279 pSet->
Put( aHFSetItem );
290 pSet->
Put( aHeaderItem );
295 aStr =
ScResId( STR_PAGE ) +
" ";
297 nStrLen = aStr.getLength();
303 pSet->
Put( aFooterItem );
308 SfxStyleFamily::Page,
309 SfxStyleSearchBits::ScStandard ) );
311 pSheet->
SetHelpId( aHelpFile, HID_SC_SHEET_PAGE_REP );
314 aBoxItem.
SetLine( &aBorderLine, SvxBoxItemLine::TOP );
315 aBoxItem.
SetLine( &aBorderLine, SvxBoxItemLine::BOTTOM );
316 aBoxItem.
SetLine( &aBorderLine, SvxBoxItemLine::LEFT );
317 aBoxItem.
SetLine( &aBorderLine, SvxBoxItemLine::RIGHT );
319 aBoxInfoItem.
SetValid( SvxBoxInfoItemValidFlags::TOP );
320 aBoxInfoItem.
SetValid( SvxBoxInfoItemValidFlags::BOTTOM );
321 aBoxInfoItem.
SetValid( SvxBoxInfoItemValidFlags::LEFT );
322 aBoxInfoItem.
SetValid( SvxBoxInfoItemValidFlags::RIGHT );
323 aBoxInfoItem.
SetValid( SvxBoxInfoItemValidFlags::DISTANCE );
328 pHFSet = &(aHFSetItem2.GetItemSet());
331 pHFSet->
Put( aBoxItem );
332 pHFSet->
Put( aBoxInfoItem );
334 pSet->
Put( aHFSetItem2 );
336 pSet->
Put( aHFSetItem2 );
355 pSet->
Put( aHeaderItem );
360 aStr =
ScResId( STR_PAGE ) +
" ";
361 nStrLen = aStr.getLength();
363 sal_Int32 nStrLen2 = aStr.getLength();
371 pSet->
Put( aFooterItem );
380 CaseInsensitiveNamePredicate(
const OUString& rName,
SfxStyleFamily eFam)
391 if (mUppercaseName == aUpName)
399 OUString mUppercaseName;
408 CaseInsensitiveNamePredicate aPredicate(rName, eFam);
411 for (
const auto& rPos : aFoundPositions)
416 return static_cast<ScStyleSheet*>(pFound);
426 pSheet->
SetMask(SfxStyleSearchBits::ScStandard);
SfxStyleSheetBase * First(SfxStyleFamily eFamily, SfxStyleSearchBits eMask=SfxStyleSearchBits::All)
static vcl::Font GetDefaultFont(DefaultFontType nType, LanguageType eLang, GetDefaultFontFlags nFlags, const OutputDevice *pOutDev=nullptr)
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
const OUString & GetFamilyName() const
OUString ScResId(TranslateId aId)
constexpr TypedWhichId< SvxBoxItem > ATTR_BORDER(150)
void CopyStdStylesFrom(ScStyleSheetPool *pSrcPool)
const LanguageTag & GetUILanguageTag() const
const OUString & GetStyleName() const
LanguageType getLanguageType(bool bResolveSystem=true) const
void QuickInsertField(const SvxFieldItem &rFld, const ESelection &rSel)
virtual void Remove(SfxStyleSheetBase *)
static const AllSettings & GetSettings()
const WhichRangesContainer & GetRanges() const
ScStyleSheet * FindCaseIns(const OUString &rName, SfxStyleFamily eFam)
static void lcl_CheckFont(SfxItemSet &rSet, LanguageType eLang, DefaultFontType nFontType, sal_uInt16 nItemId)
constexpr TypedWhichId< SvxBoxInfoItem > ATTR_BORDER_INNER(151)
constexpr OUStringLiteral STRING_STANDARD
static SC_DLLPUBLIC OUString ProgrammaticToDisplayName(const OUString &rProgName, SfxStyleFamily nType)
constexpr TypedWhichId< SvxFontItem > ATTR_FONT(100)
virtual SfxItemSet & GetItemSet()
constexpr::Color COL_LIGHTGRAY(0xC0, 0xC0, 0xC0)
virtual void Remove(SfxStyleSheetBase *pStyle) override
SfxStyleFamily GetFamily() const
SfxStyleSearchBits GetMask() const
void SetDocument(ScDocument *pDocument)
FontFamily GetFamilyType()
virtual void SetHelpId(const OUString &r, sal_uLong nId)
virtual bool Check(const SfxStyleSheetBase &styleSheet)=0
void SetLeftArea(const EditTextObject &rNew)
static rtl::Reference< SfxItemPool > CreatePool()
constexpr TypedWhichId< ScPageHFItem > ATTR_PAGE_HEADERRIGHT(180)
void SetMask(SfxStyleSearchBits mask)
virtual ~ScStyleSheetPool() override
SfxStyleSheetBase * GetStyleSheetByPositionInIndex(unsigned pos)
const OUString & GetName() const
constexpr TypedWhichId< SvxFieldItem > EE_FEATURE_FIELD(EE_FEATURE_NOTCONV+1)
void SetCenterArea(const EditTextObject &rNew)
static const sal_Int16 Medium
void SetAllDistances(sal_uInt16 nNew)
std::vector< sal_Int32 > FindPositionsByPredicate(StyleSheetPredicate &predicate) const
void SetTextCurrentDefaults(const EditTextObject &rTextObject)
SetText and apply defaults already set.
constexpr TypedWhichId< SvxSetItem > ATTR_PAGE_HEADERSET(184)
virtual SfxStyleSheetBase & Make(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits nMask=SfxStyleSearchBits::All)
static SC_DLLPUBLIC const CharClass & getCharClass()
sal_Int32 GetNumberOfStyleSheets() const
std::unique_ptr< EditTextObject > CreateTextObject()
OUString uppercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
virtual rtl::Reference< SfxStyleSheetBase > Create(const OUString &rName, SfxStyleFamily eFamily, SfxStyleSearchBits nMask) override
void PutExtended(const SfxItemSet &, SfxItemState eDontCareAs, SfxItemState eDefaultAs)
#define LANGUAGE_DONTKNOW
constexpr TypedWhichId< SfxUInt32Item > ATTR_VALUE_FORMAT(146)
void SetRightArea(const EditTextObject &rNew)
constexpr TypedWhichId< SvxFontItem > ATTR_CTL_FONT(116)
ScStyleSheetPool(const SfxItemPool &rPool, ScDocument *pDocument)
SfxItemPool * GetPool() const
bool SetUpdateLayout(bool bUpdate, bool bRestoring=false)
constexpr TypedWhichId< SvxFontItem > ATTR_CJK_FONT(111)
constexpr TypedWhichId< SvxBrushItem > ATTR_BACKGROUND(148)
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
PyRef getCharClass(const Runtime &)
const svl::IndexedStyleSheets & GetIndexedStyleSheets() const
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
void CopyStyleFrom(ScStyleSheetPool *pSrcPool, const OUString &rName, SfxStyleFamily eFamily)
void setAllParaStandard()
SfxStyleSheetBase * Next()
void CreateStandardStyles()
virtual SfxStyleSheetBase & Make(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits nMask=SfxStyleSearchBits::All) override
virtual SC_DLLPUBLIC SfxItemSet & GetItemSet() override
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
static bool isKorean(LanguageType nLang)
sal_uInt32 GetValue() const
void SetValid(SvxBoxInfoItemValidFlags nValid, bool bValid=true)
constexpr TypedWhichId< ScPageHFItem > ATTR_PAGE_FOOTERRIGHT(181)
SC_DLLPUBLIC void GetLanguage(LanguageType &rLatin, LanguageType &rCjk, LanguageType &rCtl) const
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All)
constexpr TypedWhichId< SvxSetItem > ATTR_PAGE_FOOTERSET(185)
SvNumberFormatterIndexTable * GetFormatExchangeList() const
rtl_TextEncoding GetCharSet() const
bool m_bDetectedRangeSegmentation false
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxItemLine nLine)
virtual bool isScStyleSheet() const