28#include <editeng/editeng.hxx>
40#include <osl/diagnose.h>
47#include <document.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::Page &&
ScResId(STR_STYLENAME_STANDARD) != rName )
105 pSheet->SetParent(
ScResId(STR_STYLENAME_STANDARD) );
112 OSL_ENSURE( rStyle.
isScStyleSheet(),
"Invalid StyleSheet-class! :-/" );
120 OSL_ENSURE( SfxStyleSearchBits::UserDefined & pStyle->
GetMask(),
121 "SfxStyleSearchBits::UserDefined not set!" );
130 bool bNewStyleHierarchy )
140 if (pDestSheet && bNewStyleHierarchy)
143 pDestSheet = &
Make( rName, eFamily, pStyleSheet->
GetMask() );
145 rDestSet.
PutExtended( rSourceSet, SfxItemState::DONTCARE, SfxItemState::DEFAULT );
147 if ( eFamily == SfxStyleFamily::Page )
153 const SfxItemSet& rSrcSub = pSetItem->GetItemSet();
155 aDestSub.
PutExtended( rSrcSub, SfxItemState::DONTCARE, SfxItemState::DEFAULT );
159 const SfxItemSet& rSrcSub = pSetItem->GetItemSet();
161 aDestSub.
PutExtended( rSrcSub, SfxItemState::DONTCARE, SfxItemState::DEFAULT );
165 else if ( eFamily == SfxStyleFamily::Para )
177 sal_uInt32 nNewFormat = it->second;
183 const OUString aParentName = pStyleSheet->
GetParent();
184 if (!bNewStyleHierarchy || aParentName.isEmpty())
187 CopyStyleFrom(pSrcPool, aParentName, eFamily, bNewStyleHierarchy);
195 std::vector<std::pair<SfxStyleSheetBase*, OUString>> aNewStyles;
197 auto pSrcSheet = pSrcPool->
First(SfxStyleFamily::Frame);
200 if (pSrcSheet->IsUsed() && !
Find(pSrcSheet->GetName(), pSrcSheet->GetFamily()))
202 auto pDestSheet = &
Make(pSrcSheet->GetName(), pSrcSheet->GetFamily(), pSrcSheet->GetMask());
203 aNewStyles.emplace_back(pDestSheet, pSrcSheet->GetParent());
205 SfxItemSet& rDestSet = pDestSheet->GetItemSet();
206 rDestSet.
Put(pSrcSheet->GetItemSet());
209 pSrcSheet = pSrcPool->
Next();
212 for (
const auto& style : aNewStyles)
235 if ( aNewItem !=
rSet.
Get( nItemId ) )
250 const OUString aHelpFile;
255 std::unique_ptr<EditTextObject> pEmptyTxtObj = aEdEngine.
CreateTextObject();
256 std::unique_ptr<EditTextObject> pTxtObj;
264 OUString aStrStandard =
ScResId(STR_STYLENAME_STANDARD);
270 pSheet =
static_cast<ScStyleSheet*
>( &
Make( aStrStandard, SfxStyleFamily::Para, SfxStyleSearchBits::ScStandard ) );
271 pSheet->
SetHelpId( aHelpFile, HID_SC_SHEET_CELL_STD );
287 eLatin = eUiLanguage;
304 SfxStyleFamily::Page,
305 SfxStyleSearchBits::ScStandard ) );
308 pSheet->
SetHelpId( aHelpFile, HID_SC_SHEET_PAGE_STD );
313 pSet->
Put( aHFSetItem );
315 pSet->
Put( aHFSetItem );
326 pSet->
Put( aHeaderItem );
333 nStrLen =
aStr.getLength();
339 pSet->
Put( aFooterItem );
344 SfxStyleFamily::Page,
345 SfxStyleSearchBits::ScStandard ) );
347 pSheet->
SetHelpId( aHelpFile, HID_SC_SHEET_PAGE_REP );
350 aBoxItem.
SetLine( &aBorderLine, SvxBoxItemLine::TOP );
351 aBoxItem.
SetLine( &aBorderLine, SvxBoxItemLine::BOTTOM );
352 aBoxItem.
SetLine( &aBorderLine, SvxBoxItemLine::LEFT );
353 aBoxItem.
SetLine( &aBorderLine, SvxBoxItemLine::RIGHT );
355 aBoxInfoItem.
SetValid( SvxBoxInfoItemValidFlags::TOP );
356 aBoxInfoItem.
SetValid( SvxBoxInfoItemValidFlags::BOTTOM );
357 aBoxInfoItem.
SetValid( SvxBoxInfoItemValidFlags::LEFT );
358 aBoxInfoItem.
SetValid( SvxBoxInfoItemValidFlags::RIGHT );
359 aBoxInfoItem.
SetValid( SvxBoxInfoItemValidFlags::DISTANCE );
364 pHFSet = &(aHFSetItem2.GetItemSet());
367 pHFSet->
Put( aBoxItem );
368 pHFSet->
Put( aBoxInfoItem );
370 pSet->
Put( aHFSetItem2 );
372 pSet->
Put( aHFSetItem2 );
391 pSet->
Put( aHeaderItem );
397 nStrLen =
aStr.getLength();
399 sal_Int32 nStrLen2 =
aStr.getLength();
407 pSet->
Put( aFooterItem );
416 CaseInsensitiveNamePredicate(
const OUString& rName,
SfxStyleFamily eFam)
427 if (mUppercaseName == aUpName)
435 OUString mUppercaseName;
444 CaseInsensitiveNamePredicate aPredicate(rName, eFam);
448 for (
const auto& rPos : aFoundPositions)
454 if (pFound->
GetName() == rName)
467 if (
auto pFound =
Find(
ScResId(STR_STYLENAME_STANDARD), SfxStyleFamily::Para))
468 if (pFound->isScStyleSheet())
478 pSheet->
SetMask(SfxStyleSearchBits::ScStandard);
const LanguageTag & GetUILanguageTag() const
static const AllSettings & GetSettings()
OUString uppercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
sal_uInt32 GetValue() const
std::unique_ptr< EditTextObject > CreateTextObject()
bool SetUpdateLayout(bool bUpdate, bool bRestoring=false)
void QuickInsertField(const SvxFieldItem &rFld, const ESelection &rSel)
static rtl::Reference< SfxItemPool > CreatePool()
LanguageType getLanguageType(bool bResolveSystem=true) const
static bool isKorean(LanguageType nLang)
static vcl::Font GetDefaultFont(DefaultFontType nType, LanguageType eLang, GetDefaultFontFlags nFlags, const OutputDevice *pOutDev=nullptr)
SC_DLLPUBLIC void GetLanguage(LanguageType &rLatin, LanguageType &rCjk, LanguageType &rCtl) const
SvNumberFormatterIndexTable * GetFormatExchangeList() const
void SetTextCurrentDefaults(const EditTextObject &rTextObject)
SetText and apply defaults already set.
static SC_DLLPUBLIC const CharClass & getCharClass()
void SetLeftArea(const EditTextObject &rNew)
void SetCenterArea(const EditTextObject &rNew)
void SetRightArea(const EditTextObject &rNew)
static SC_DLLPUBLIC OUString ProgrammaticToDisplayName(const OUString &rProgName, SfxStyleFamily nType)
ScStyleSheetPool(const SfxItemPool &rPool, ScDocument *pDocument)
virtual ~ScStyleSheetPool() override
void SetDocument(ScDocument *pDocument)
ScStyleSheet * FindCaseIns(const OUString &rName, SfxStyleFamily eFam)
void CopyUsedGraphicStylesFrom(SfxStyleSheetBasePool *pSrcPool)
ScStyleSheet * FindAutoStyle(const OUString &rName)
void CopyStdStylesFrom(ScStyleSheetPool *pSrcPool)
virtual SfxStyleSheetBase & Make(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits nMask=SfxStyleSearchBits::All) override
void CopyStyleFrom(SfxStyleSheetBasePool *pSrcPool, const OUString &rName, SfxStyleFamily eFamily, bool bNewStyleHierarchy=false)
void setAllParaStandard()
virtual rtl::Reference< SfxStyleSheetBase > Create(const OUString &rName, SfxStyleFamily eFamily, SfxStyleSearchBits nMask) override
void CreateStandardStyles()
virtual void Remove(SfxStyleSheetBase *pStyle) override
virtual SC_DLLPUBLIC SfxItemSet & GetItemSet() override
const WhichRangesContainer & GetRanges() const
SfxItemPool * GetPool() const
void PutExtended(const SfxItemSet &, SfxItemState eDontCareAs, SfxItemState eDefaultAs)
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
SfxStyleSheetBase * First(SfxStyleFamily eFamily, SfxStyleSearchBits eMask=SfxStyleSearchBits::All)
SfxStyleSheetBase * GetStyleSheetByPositionInIndex(unsigned pos)
virtual void Remove(SfxStyleSheetBase *)
virtual SfxStyleSheetBase & Make(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits nMask=SfxStyleSearchBits::All)
SfxStyleSheetBase * Next()
const svl::IndexedStyleSheets & GetIndexedStyleSheets() const
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All)
SfxStyleSearchBits GetMask() const
virtual const OUString & GetParent() const
const OUString & GetName() const
SfxStyleFamily GetFamily() const
virtual void SetHelpId(const OUString &r, sal_uLong nId)
virtual bool SetParent(const OUString &)
virtual SfxItemSet & GetItemSet()
virtual bool isScStyleSheet() const
void SetMask(SfxStyleSearchBits mask)
static const sal_Int16 Medium
void SetValid(SvxBoxInfoItemValidFlags nValid, bool bValid=true)
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxItemLine nLine)
void SetAllDistances(sal_Int16 nNew)
sal_Int32 GetNumberOfStyleSheets() const
std::vector< sal_Int32 > FindPositionsByPredicate(StyleSheetPredicate &predicate) const
FontFamily GetFamilyType()
const OUString & GetStyleName() const
const OUString & GetFamilyName() const
rtl_TextEncoding GetCharSet() const
constexpr ::Color COL_LIGHTGRAY(0xC0, 0xC0, 0xC0)
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
constexpr TypedWhichId< SvxFieldItem > EE_FEATURE_FIELD(EE_FEATURE_NOTCONV+1)
constexpr OUStringLiteral STRING_STANDARD
#define LANGUAGE_DONTKNOW
constexpr OUStringLiteral first
PyRef getCharClass(const Runtime &)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
OUString ScResId(TranslateId aId)
constexpr TypedWhichId< SvxFontItem > ATTR_CJK_FONT(111)
constexpr TypedWhichId< SvxSetItem > ATTR_PAGE_HEADERSET(184)
constexpr TypedWhichId< SvxFontItem > ATTR_CTL_FONT(116)
constexpr TypedWhichId< ScPageHFItem > ATTR_PAGE_FOOTERRIGHT(181)
constexpr TypedWhichId< ScPageHFItem > ATTR_PAGE_HEADERRIGHT(180)
constexpr TypedWhichId< SvxBrushItem > ATTR_BACKGROUND(148)
constexpr TypedWhichId< SvxBoxInfoItem > ATTR_BORDER_INNER(151)
constexpr TypedWhichId< SvxBoxItem > ATTR_BORDER(150)
constexpr TypedWhichId< SfxUInt32Item > ATTR_VALUE_FORMAT(146)
constexpr TypedWhichId< SvxFontItem > ATTR_FONT(100)
constexpr TypedWhichId< SvxSetItem > ATTR_PAGE_FOOTERSET(185)
static void lcl_CheckFont(SfxItemSet &rSet, LanguageType eLang, DefaultFontType nFontType, sal_uInt16 nItemId)
virtual bool Check(const SfxStyleSheetBase &styleSheet)=0