include/svx/svdpool.hxx | 1 include/svx/xpool.hxx | 3 sc/inc/globstr.hrc | 1 sc/inc/servuno.hxx | 2 sc/qa/extras/scstylefamiliesobj.cxx | 2 sc/source/core/data/stlpool.cxx | 2 sc/source/core/data/stlsheet.cxx | 42 ++++++++ sc/source/ui/unoobj/servuno.cxx | 4 sc/source/ui/unoobj/styleuno.cxx | 183 +++++++++++++++++++++++++++++++----- 9 files changed, 212 insertions(+), 28 deletions(-)
New commits: commit 6db5e15e5b91f34232e90225a723e0673ecfc2f0 Author: Maxim Monastirsky <momonas...@gmail.com> AuthorDate: Fri Mar 17 14:50:25 2023 +0200 Commit: Maxim Monastirsky <momonas...@gmail.com> CommitDate: Tue Mar 21 23:10:01 2023 +0000 sc drawstyles: Implement the styles family Change-Id: I2af6072685e4c79cfe2f177c0aae27044f86d840 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149184 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky <momonas...@gmail.com> diff --git a/include/svx/svdpool.hxx b/include/svx/svdpool.hxx index e61b6fe97005..3d2201edef5b 100644 --- a/include/svx/svdpool.hxx +++ b/include/svx/svdpool.hxx @@ -20,7 +20,6 @@ #pragma once #include <svx/xpool.hxx> -#include <svx/svxdllapi.h> class XLineAttrSetItem; class XFillAttrSetItem; diff --git a/include/svx/xpool.hxx b/include/svx/xpool.hxx index e8fc6f5e7225..13f5fa3d7a7d 100644 --- a/include/svx/xpool.hxx +++ b/include/svx/xpool.hxx @@ -20,6 +20,7 @@ #ifndef INCLUDED_SVX_XPOOL_HXX #define INCLUDED_SVX_XPOOL_HXX +#include <svx/svxdllapi.h> #include <svl/itempool.hxx> #include <memory> @@ -29,7 +30,7 @@ |* \************************************************************************/ -class XOutdevItemPool : public SfxItemPool +class SVXCORE_DLLPUBLIC XOutdevItemPool : public SfxItemPool { protected: std::vector<SfxPoolItem*>* mpLocalPoolDefaults; diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc index 95f7138c81c9..88eca11e5a89 100644 --- a/sc/inc/globstr.hrc +++ b/sc/inc/globstr.hrc @@ -443,6 +443,7 @@ #define STR_FORM_SCROLLBAR NC_("STR_FORM_SCROLLBAR", "Scroll Bar") #define STR_STYLE_FAMILY_CELL NC_("STR_STYLE_FAMILY_CELL", "Cell Styles") #define STR_STYLE_FAMILY_PAGE NC_("STR_STYLE_FAMILY_PAGE", "Page Styles") +#define STR_STYLE_FAMILY_GRAPHICS NC_("STR_STYLE_FAMILY_GRAPHICS", "Drawing Styles") #define STR_ERR_DATAPILOTSOURCE NC_("STR_ERR_DATAPILOTSOURCE", "Pivot table source data is invalid.") #define STR_OPTIONS_WARN_SEPARATORS NC_("STR_OPTIONS_WARN_SEPARATORS", "Because the current formula separator settings conflict with the locale, the formula separators have been reset to their default values.") #define STR_UNDO_INSERT_CURRENT_DATE NC_("STR_UNDO_INSERT_CURRENT_DATE", "Insert Current Date") diff --git a/sc/inc/servuno.hxx b/sc/inc/servuno.hxx index b8a6d49fd172..b705f3ef01b4 100644 --- a/sc/inc/servuno.hxx +++ b/sc/inc/servuno.hxx @@ -32,7 +32,7 @@ public: enum class Type { SHEET , URLFIELD , PAGEFIELD , PAGESFIELD , DATEFIELD , TIMEFIELD , TITLEFIELD , FILEFIELD , - SHEETFIELD , CELLSTYLE , PAGESTYLE , + SHEETFIELD , CELLSTYLE , PAGESTYLE , GRAPHICSTYLE , // sheet AUTOFORMAT , AUTOFORMATS, CELLRANGES , FUNCTIONDESCRIPTIONS , GLOBALSHEETSETTINGS , RECENTFUNCTIONS , diff --git a/sc/qa/extras/scstylefamiliesobj.cxx b/sc/qa/extras/scstylefamiliesobj.cxx index 89ec9a2b46f7..72fb135bd56d 100644 --- a/sc/qa/extras/scstylefamiliesobj.cxx +++ b/sc/qa/extras/scstylefamiliesobj.cxx @@ -82,7 +82,7 @@ private: ScStyleFamiliesObj::ScStyleFamiliesObj() : UnoApiTest("/sc/qa/extras/testdocuments") , XElementAccess(cppu::UnoType<container::XNameContainer>::get()) - , XIndexAccess(2) + , XIndexAccess(3) , XNameAccess("CellStyles") , XServiceInfo("ScStyleFamiliesObj", "com.sun.star.style.StyleFamilies") { diff --git a/sc/source/core/data/stlpool.cxx b/sc/source/core/data/stlpool.cxx index 8f554896ff21..e7f6d26aa0c7 100644 --- a/sc/source/core/data/stlpool.cxx +++ b/sc/source/core/data/stlpool.cxx @@ -101,7 +101,7 @@ rtl::Reference<SfxStyleSheetBase> ScStyleSheetPool::Create( const OUString& rN SfxStyleSearchBits nMaskP ) { rtl::Reference<ScStyleSheet> pSheet = new ScStyleSheet( rName, *this, eFamily, nMaskP ); - if ( eFamily == SfxStyleFamily::Para && ScResId(STR_STYLENAME_STANDARD) != rName ) + if ( eFamily != SfxStyleFamily::Page && ScResId(STR_STYLENAME_STANDARD) != rName ) pSheet->SetParent( ScResId(STR_STYLENAME_STANDARD) ); return pSheet; diff --git a/sc/source/core/data/stlsheet.cxx b/sc/source/core/data/stlsheet.cxx index 4ee18ef0f0fb..665b806ba540 100644 --- a/sc/source/core/data/stlsheet.cxx +++ b/sc/source/core/data/stlsheet.cxx @@ -26,6 +26,10 @@ #include <editeng/frmdiritem.hxx> #include <editeng/lrspitem.hxx> #include <svx/pageitem.hxx> +#include <svx/svddef.hxx> +#include <svx/svdpool.hxx> +#include <svx/xdef.hxx> +#include <editeng/eeitem.hxx> #include <editeng/paperinf.hxx> #include <editeng/shaditem.hxx> #include <editeng/sizeitem.hxx> @@ -77,6 +81,7 @@ bool ScStyleSheet::HasParentSupport () const switch ( GetFamily() ) { case SfxStyleFamily::Para: bHasParentSupport = true; break; + case SfxStyleFamily::Frame: bHasParentSupport = true; break; case SfxStyleFamily::Page: bHasParentSupport = false; break; default: { @@ -217,6 +222,23 @@ SfxItemSet& ScStyleSheet::GetItemSet() } break; + case SfxStyleFamily::Frame: + { + SfxItemPool* pItemPool = &GetPool()->GetPool(); + if (dynamic_cast<SdrItemPool*>(pItemPool) == nullptr) + pItemPool = pItemPool->GetSecondaryPool(); + + pSet = new SfxItemSetFixed< + XATTR_LINE_FIRST, XATTR_LINE_LAST, + XATTR_FILL_FIRST, XATTR_FILL_LAST, + SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST, + SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_WORDWRAP, + SDRATTR_EDGE_FIRST, SDRATTR_MEASURE_LAST, + SDRATTR_3D_FIRST, SDRATTR_3D_LAST, + EE_PARA_START, EE_CHAR_END>(*pItemPool); + } + break; + case SfxStyleFamily::Para: default: pSet = new SfxItemSetFixed<ATTR_PATTERN_START, ATTR_PATTERN_END>( GetPool()->GetPool() ); @@ -272,15 +294,33 @@ bool ScStyleSheet::IsUsed() const eUsage = Usage::NOTUSED; return eUsage == Usage::USED; } + case SfxStyleFamily::Frame: + { + const size_t nListenerCount = GetSizeOfVector(); + for (size_t n = 0; n < nListenerCount; ++n) + { + auto pUser(dynamic_cast<svl::StyleSheetUser*>(GetListener(n))); + if (pUser && pUser->isUsedByModel()) + { + eUsage = Usage::USED; + break; + } + else + eUsage = Usage::NOTUSED; + } + return eUsage == Usage::USED; + } default: return true; } } -void ScStyleSheet::Notify( SfxBroadcaster&, const SfxHint& rHint ) +void ScStyleSheet::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { if ( rHint.GetId() == SfxHintId::Dying ) GetItemSet().SetParent( nullptr ); + if (GetFamily() == SfxStyleFamily::Frame) + SfxStyleSheet::Notify(rBC, rHint); } // Avoid creating a Style "Standard" if this is not the Standard-Name; diff --git a/sc/source/ui/unoobj/servuno.cxx b/sc/source/ui/unoobj/servuno.cxx index 073a57119bb4..855d0ae76b22 100644 --- a/sc/source/ui/unoobj/servuno.cxx +++ b/sc/source/ui/unoobj/servuno.cxx @@ -264,6 +264,7 @@ const ProvNamesId_Type aProvNamesId[] = { "com.sun.star.text.TextField.SheetName", Type::SHEETFIELD }, { "com.sun.star.style.CellStyle", Type::CELLSTYLE }, { "com.sun.star.style.PageStyle", Type::PAGESTYLE }, + { "com.sun.star.style.GraphicStyle", Type::GRAPHICSTYLE }, { "com.sun.star.sheet.TableAutoFormat", Type::AUTOFORMAT }, { "com.sun.star.sheet.TableAutoFormats", Type::AUTOFORMATS }, { "com.sun.star.sheet.SheetCellRanges", Type::CELLRANGES }, @@ -423,6 +424,9 @@ uno::Reference<uno::XInterface> ScServiceProvider::MakeInstance( case Type::PAGESTYLE: xRet.set(static_cast<style::XStyle*>(new ScStyleObj( nullptr, SfxStyleFamily::Page, OUString() ))); break; + case Type::GRAPHICSTYLE: + xRet.set(static_cast<style::XStyle*>(new ScStyleObj( nullptr, SfxStyleFamily::Frame, OUString() ))); + break; case Type::AUTOFORMAT: xRet.set(static_cast<container::XIndexAccess*>(new ScAutoFormatObj( SC_AFMTOBJ_INVALID ))); break; diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx index cddff8c73d00..f4280dd2a679 100644 --- a/sc/source/ui/unoobj/styleuno.cxx +++ b/sc/source/ui/unoobj/styleuno.cxx @@ -26,6 +26,10 @@ #include <svx/pageitem.hxx> #include <editeng/pbinitem.hxx> #include <svx/unomid.hxx> +#include <svx/unoshape.hxx> +#include <svx/unoshprp.hxx> +#include <svx/xflbstit.hxx> +#include <svx/xflbmtit.hxx> #include <editeng/unonrule.hxx> #include <sfx2/bindings.hxx> #include <sfx2/printer.hxx> @@ -42,6 +46,7 @@ #include <tools/UnitConversion.hxx> #include <osl/diagnose.h> +#include <com/sun/star/drawing/BitmapMode.hpp> #include <com/sun/star/table/BorderLine.hpp> #include <com/sun/star/table/TableBorder.hpp> #include <com/sun/star/table/TableBorder2.hpp> @@ -77,6 +82,26 @@ using namespace ::com::sun::star; +static const SfxItemPropertySet* lcl_GetGraphicStyleSet() +{ + static const SfxItemPropertyMapEntry aGraphicStyleMap_Impl[] = + { + SVX_UNOEDIT_NUMBERING_PROPERTY, + SHADOW_PROPERTIES + LINE_PROPERTIES + LINE_PROPERTIES_START_END + FILL_PROPERTIES + EDGERADIUS_PROPERTIES + TEXT_PROPERTIES_DEFAULTS + CONNECTOR_PROPERTIES + SPECIAL_DIMENSIONING_PROPERTIES_DEFAULTS + {SC_UNONAME_HIDDEN, ATTR_HIDDEN, cppu::UnoType<sal_Bool>::get(), 0, 0 }, + {SC_UNONAME_DISPNAME, SC_WID_UNO_DISPNAME, cppu::UnoType<OUString>::get(), beans::PropertyAttribute::READONLY, 0 }, + }; + static SfxItemPropertySet aGraphicStyleSet_Impl( aGraphicStyleMap_Impl ); + return &aGraphicStyleSet_Impl; +} + static const SfxItemPropertySet* lcl_GetCellStyleSet() { static const SfxItemPropertyMapEntry aCellStyleMap_Impl[] = @@ -381,18 +406,20 @@ static const SfxItemPropertyMap* lcl_GetFooterStyleMap() return &aFooterStyleMap; } -// access index on the style types: 0 = Cell, 1 = Page +// access index on the style types: 0 = Cell, 1 = Page, 2 = Drawing -#define SC_STYLE_FAMILY_COUNT 2 +#define SC_STYLE_FAMILY_COUNT 3 constexpr OUStringLiteral SC_FAMILYNAME_CELL = u"CellStyles"; constexpr OUStringLiteral SC_FAMILYNAME_PAGE = u"PageStyles"; +constexpr OUStringLiteral SC_FAMILYNAME_GRAPHIC = u"GraphicStyles"; -const SfxStyleFamily aStyleFamilyTypes[SC_STYLE_FAMILY_COUNT] = { SfxStyleFamily::Para, SfxStyleFamily::Page }; +const SfxStyleFamily aStyleFamilyTypes[SC_STYLE_FAMILY_COUNT] = { SfxStyleFamily::Para, SfxStyleFamily::Page, SfxStyleFamily::Frame }; constexpr OUStringLiteral SCSTYLE_SERVICE = u"com.sun.star.style.Style"; constexpr OUStringLiteral SCCELLSTYLE_SERVICE = u"com.sun.star.style.CellStyle"; constexpr OUStringLiteral SCPAGESTYLE_SERVICE = u"com.sun.star.style.PageStyle"; +constexpr OUStringLiteral SCGRAPHICSTYLE_SERVICE = u"com.sun.star.style.GraphicStyle"; SC_SIMPLE_SERVICE_INFO( ScStyleFamiliesObj, "ScStyleFamiliesObj", "com.sun.star.style.StyleFamilies" ) SC_SIMPLE_SERVICE_INFO( ScStyleFamilyObj, "ScStyleFamilyObj", "com.sun.star.style.StyleFamily" ) @@ -442,6 +469,8 @@ rtl::Reference<ScStyleFamilyObj> ScStyleFamiliesObj::GetObjectByType_Impl(SfxSty return new ScStyleFamilyObj( pDocShell, SfxStyleFamily::Para ); else if ( nType == SfxStyleFamily::Page ) return new ScStyleFamilyObj( pDocShell, SfxStyleFamily::Page ); + else if ( nType == SfxStyleFamily::Frame ) + return new ScStyleFamilyObj( pDocShell, SfxStyleFamily::Frame ); } OSL_FAIL("getStyleFamilyByType: no DocShell or wrong SfxStyleFamily"); return nullptr; @@ -463,6 +492,8 @@ rtl::Reference<ScStyleFamilyObj> ScStyleFamiliesObj::GetObjectByName_Impl(std::u return new ScStyleFamilyObj( pDocShell, SfxStyleFamily::Para ); else if ( aName == SC_FAMILYNAME_PAGE ) return new ScStyleFamilyObj( pDocShell, SfxStyleFamily::Page ); + else if ( aName == SC_FAMILYNAME_GRAPHIC ) + return new ScStyleFamilyObj( pDocShell, SfxStyleFamily::Frame ); } // no assertion - called directly from getByName return nullptr; @@ -510,12 +541,12 @@ uno::Any SAL_CALL ScStyleFamiliesObj::getByName( const OUString& aName ) uno::Sequence<OUString> SAL_CALL ScStyleFamiliesObj::getElementNames() { - return {SC_FAMILYNAME_CELL, SC_FAMILYNAME_PAGE}; + return {SC_FAMILYNAME_CELL, SC_FAMILYNAME_PAGE, SC_FAMILYNAME_GRAPHIC}; } sal_Bool SAL_CALL ScStyleFamiliesObj::hasByName( const OUString& aName ) { - return aName == SC_FAMILYNAME_CELL || aName == SC_FAMILYNAME_PAGE; + return aName == SC_FAMILYNAME_CELL || aName == SC_FAMILYNAME_PAGE || aName == SC_FAMILYNAME_GRAPHIC; } // style::XStyleLoader @@ -755,7 +786,7 @@ void SAL_CALL ScStyleFamilyObj::removeByName( const OUString& aName ) //! InvalidateAttribs(); // Bindings-Invalidate } - else + else if ( eFamily == SfxStyleFamily::Page ) { if ( rDoc.RemovePageStyleInUse( aString ) ) pDocShell->PageStyleModified( ScResId(STR_STYLENAME_STANDARD), true ); @@ -767,6 +798,15 @@ void SAL_CALL ScStyleFamilyObj::removeByName( const OUString& aName ) pBindings->Invalidate( SID_STYLE_FAMILY4 ); pDocShell->SetDocumentModified(); } + else + { + pStylePool->Remove( pStyle ); + + SfxBindings* pBindings = pDocShell->GetViewBindings(); + if (pBindings) + pBindings->Invalidate( SID_STYLE_FAMILY3 ); + pDocShell->SetDocumentModified(); + } } } @@ -897,6 +937,8 @@ uno::Any SAL_CALL ScStyleFamilyObj::getPropertyValue( const OUString& sPropertyN pResId = STR_STYLE_FAMILY_CELL; break; case SfxStyleFamily::Page: pResId = STR_STYLE_FAMILY_PAGE; break; + case SfxStyleFamily::Frame: + pResId = STR_STYLE_FAMILY_GRAPHICS; break; default: OSL_FAIL( "ScStyleFamilyObj::getPropertyValue(): invalid family" ); } @@ -932,12 +974,18 @@ void SAL_CALL ScStyleFamilyObj::removeVetoableChangeListener( const OUString&, c // default ctor is needed for reflection ScStyleObj::ScStyleObj(ScDocShell* pDocSh, SfxStyleFamily eFam, OUString aName) - : pPropSet( (eFam == SfxStyleFamily::Para) ? lcl_GetCellStyleSet() : lcl_GetPageStyleSet() ) - , pDocShell(pDocSh) + : pDocShell(pDocSh) , eFamily(eFam) , aStyleName(std::move(aName)) , pStyle_cached(nullptr) { + if (eFam == SfxStyleFamily::Para) + pPropSet = lcl_GetCellStyleSet(); + else if (eFam == SfxStyleFamily::Page) + pPropSet = lcl_GetPageStyleSet(); + else + pPropSet = lcl_GetGraphicStyleSet(); + // if create by ServiceProvider then pDocShell is NULL if (pDocShell) @@ -1055,12 +1103,14 @@ void SAL_CALL ScStyleObj::setParentStyle( const OUString& rParentStyle ) pDocShell->SetDocumentModified(); } } - else + else if ( eFamily == SfxStyleFamily::Page ) { //! ModifyStyleSheet on document (save old values) pDocShell->PageStyleModified( aStyleName, true ); } + else + static_cast<SfxStyleSheet*>(GetStyle_Impl())->Broadcast(SfxHint(SfxHintId::DataChanged)); } // container::XNamed @@ -1098,9 +1148,9 @@ void SAL_CALL ScStyleObj::setName( const OUString& aNewName ) if ( eFamily == SfxStyleFamily::Para && !rDoc.IsImportingXML() ) rDoc.GetPool()->CellStyleCreated( aNewName, rDoc ); - // cell styles = 2, page styles = 4 - sal_uInt16 nId = ( eFamily == SfxStyleFamily::Para ) ? - SID_STYLE_FAMILY2 : SID_STYLE_FAMILY4; + // cell styles = 2, drawing styles = 3, page styles = 4 + sal_uInt16 nId = eFamily == SfxStyleFamily::Para ? SID_STYLE_FAMILY2 : + (eFamily == SfxStyleFamily::Page ? SID_STYLE_FAMILY4 : SID_STYLE_FAMILY3); SfxBindings* pBindings = pDocShell->GetViewBindings(); if (pBindings) { @@ -1165,7 +1215,23 @@ beans::PropertyState ScStyleObj::getPropertyState_Impl( std::u16string_view aPro { nWhich = ATTR_BORDER; } - if ( IsScItemWid( nWhich ) ) + if ( nWhich == OWN_ATTR_FILLBMP_MODE ) + { + if ( pItemSet->GetItemState( XATTR_FILLBMP_STRETCH, false ) == SfxItemState::SET || + pItemSet->GetItemState( XATTR_FILLBMP_TILE, false ) == SfxItemState::SET ) + { + eRet = beans::PropertyState_DIRECT_VALUE; + } + else + { + eRet = beans::PropertyState_AMBIGUOUS_VALUE; + } + } + else if ( nWhich == SDRATTR_TEXTDIRECTION ) + { + eRet = beans::PropertyState_DEFAULT_VALUE; + } + else if ( IsScItemWid( nWhich ) || eFamily == SfxStyleFamily::Frame ) { SfxItemState eState = pItemSet->GetItemState( nWhich, false ); @@ -1178,11 +1244,10 @@ beans::PropertyState ScStyleObj::getPropertyState_Impl( std::u16string_view aPro eRet = beans::PropertyState_DIRECT_VALUE; else if ( eState == SfxItemState::DEFAULT ) eRet = beans::PropertyState_DEFAULT_VALUE; - else if ( eState == SfxItemState::DONTCARE ) - eRet = beans::PropertyState_AMBIGUOUS_VALUE; // should not happen else { - OSL_FAIL("unknown ItemState"); + assert(eFamily == SfxStyleFamily::Frame); + eRet = beans::PropertyState_AMBIGUOUS_VALUE; } } } @@ -1299,6 +1364,19 @@ uno::Any ScStyleObj::getPropertyDefault_Impl( std::u16string_view aPropertyName break; } } + else if ( nWhich == SDRATTR_TEXTDIRECTION ) + { + aAny <<= false; + } + else if ( nWhich == OWN_ATTR_FILLBMP_MODE ) + { + aAny <<= css::drawing::BitmapMode_REPEAT; + } + else if ( nWhich != OWN_ATTR_TEXTCOLUMNS ) + { + SfxItemSet aItemSet(*pStyleSet->GetPool(), pStyleSet->GetRanges()); + aAny = SvxItemPropertySet_getPropertyValue(pResultEntry, aItemSet); + } } return aAny; } @@ -1410,7 +1488,7 @@ void SAL_CALL ScStyleObj::setAllPropertiesToDefault() pDocShell->SetDocumentModified(); } } - else + else if ( eFamily == SfxStyleFamily::Page ) { // #i22448# apply the default BoxInfoItem for page styles again // (same content as in ScStyleSheet::GetItemSet, to control the dialog) @@ -1422,6 +1500,8 @@ void SAL_CALL ScStyleObj::setAllPropertiesToDefault() pDocShell->PageStyleModified( aStyleName, true ); } + else + static_cast<SfxStyleSheet*>(GetStyle_Impl())->Broadcast(SfxHint(SfxHintId::DataChanged)); } void SAL_CALL ScStyleObj::setPropertiesToDefault( const uno::Sequence<OUString>& aPropertyNames ) @@ -1730,6 +1810,37 @@ void ScStyleObj::setPropertyValue_Impl( std::u16string_view rPropertyName, const break; } } + else if (pEntry->nWID == OWN_ATTR_FILLBMP_MODE) + { + css::drawing::BitmapMode eMode; + if (!pValue) + { + rSet.ClearItem(XATTR_FILLBMP_STRETCH); + rSet.ClearItem(XATTR_FILLBMP_TILE); + } + else if (*pValue >>= eMode) + { + rSet.Put(XFillBmpStretchItem(eMode == css::drawing::BitmapMode_STRETCH)); + rSet.Put(XFillBmpTileItem(eMode == css::drawing::BitmapMode_REPEAT)); + } + } + else if(pEntry->nMemberId == MID_NAME && + (pEntry->nWID == XATTR_FILLBITMAP || pEntry->nWID == XATTR_FILLGRADIENT || + pEntry->nWID == XATTR_FILLHATCH || pEntry->nWID == XATTR_FILLFLOATTRANSPARENCE || + pEntry->nWID == XATTR_LINESTART || pEntry->nWID == XATTR_LINEEND || pEntry->nWID == XATTR_LINEDASH)) + { + OUString aTempName; + if (*pValue >>= aTempName) + SvxShape::SetFillAttribute(pEntry->nWID, aTempName, rSet); + } + else if(pEntry->nWID == SDRATTR_TEXTDIRECTION) + { + return; // not yet implemented for styles + } + else if(!SvxUnoTextRangeBase::SetPropertyValueHelper(pEntry, *pValue, rSet)) + { + SvxItemPropertySet_setPropertyValue(pEntry, *pValue, rSet); + } } //! DocFunc-?? @@ -1757,12 +1868,14 @@ void ScStyleObj::setPropertyValue_Impl( std::u16string_view rPropertyName, const } } } - else + else if ( eFamily == SfxStyleFamily::Page ) { //! ModifyStyleSheet on document (save old values) pDocShell->PageStyleModified( aStyleName, true ); } + else + static_cast<SfxStyleSheet*>(GetStyle_Impl())->Broadcast(SfxHint(SfxHintId::DataChanged)); } uno::Any ScStyleObj::getPropertyValue_Impl( std::u16string_view aPropertyName ) @@ -1889,6 +2002,30 @@ uno::Any ScStyleObj::getPropertyValue_Impl( std::u16string_view aPropertyName ) break; } } + else if ( nWhich == SDRATTR_TEXTDIRECTION ) + { + aAny <<= false; + } + else if ( nWhich == OWN_ATTR_FILLBMP_MODE ) + { + const XFillBmpStretchItem* pStretchItem = pItemSet->GetItem<XFillBmpStretchItem>(XATTR_FILLBMP_STRETCH); + const XFillBmpTileItem* pTileItem = pItemSet->GetItem<XFillBmpTileItem>(XATTR_FILLBMP_TILE); + + if ( pStretchItem && pTileItem ) + { + if ( pTileItem->GetValue() ) + aAny <<= css::drawing::BitmapMode_REPEAT; + else if ( pStretchItem->GetValue() ) + aAny <<= css::drawing::BitmapMode_STRETCH; + else + aAny <<= css::drawing::BitmapMode_NO_REPEAT; + } + } + else if ( nWhich != OWN_ATTR_TEXTCOLUMNS ) + { + if (!SvxUnoTextRangeBase::GetPropertyValueHelper(*pItemSet, pResultEntry, aAny)) + aAny = SvxItemPropertySet_getPropertyValue(pResultEntry, *pItemSet); + } } } @@ -1919,11 +2056,13 @@ sal_Bool SAL_CALL ScStyleObj::supportsService( const OUString& rServiceName ) uno::Sequence<OUString> SAL_CALL ScStyleObj::getSupportedServiceNames() { - const bool bPage = ( eFamily == SfxStyleFamily::Page ); + if (eFamily == SfxStyleFamily::Page) + return {SCSTYLE_SERVICE, SCPAGESTYLE_SERVICE}; + + if (eFamily == SfxStyleFamily::Frame) + return {SCSTYLE_SERVICE, SCGRAPHICSTYLE_SERVICE}; - return {SCSTYLE_SERVICE, - (bPage ? OUString(SCPAGESTYLE_SERVICE) - : OUString(SCCELLSTYLE_SERVICE))}; + return {SCSTYLE_SERVICE, SCCELLSTYLE_SERVICE}; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */