diff options
Diffstat (limited to 'editeng/source/uno/unoforou.cxx')
-rw-r--r-- | editeng/source/uno/unoforou.cxx | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/editeng/source/uno/unoforou.cxx b/editeng/source/uno/unoforou.cxx index 144126d25e08..8772ff9a77fa 100644 --- a/editeng/source/uno/unoforou.cxx +++ b/editeng/source/uno/unoforou.cxx @@ -94,18 +94,18 @@ static SfxItemSet ImplOutlinerForwarderGetAttribs( const ESelection& rSel, EditE SfxItemSet SvxOutlinerForwarder::GetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib ) const { - if( mpAttribsCache && ( EditEngineAttribs::All == nOnlyHardAttrib ) ) + if( moAttribsCache && ( EditEngineAttribs::All == nOnlyHardAttrib ) ) { // have we the correct set in cache? if( maAttribCacheSelection == rSel ) { // yes! just return the cache - return *mpAttribsCache; + return *moAttribsCache; } else { // no, we need delete the old cache - mpAttribsCache.reset(); + moAttribsCache.reset(); } } @@ -117,7 +117,7 @@ SfxItemSet SvxOutlinerForwarder::GetAttribs( const ESelection& rSel, EditEngineA if( EditEngineAttribs::All == nOnlyHardAttrib ) { - mpAttribsCache.reset(new SfxItemSet( aSet )); + moAttribsCache.emplace( aSet ); maAttribCacheSelection = rSel; } @@ -130,31 +130,31 @@ SfxItemSet SvxOutlinerForwarder::GetAttribs( const ESelection& rSel, EditEngineA SfxItemSet SvxOutlinerForwarder::GetParaAttribs( sal_Int32 nPara ) const { - if( mpParaAttribsCache ) + if( moParaAttribsCache ) { // have we the correct set in cache? if( nPara == mnParaAttribsCache ) { // yes! just return the cache - return *mpParaAttribsCache; + return *moParaAttribsCache; } else { // no, we need delete the old cache - mpParaAttribsCache.reset(); + moParaAttribsCache.reset(); } } - mpParaAttribsCache.reset(new SfxItemSet( rOutliner.GetParaAttribs( nPara ) )); + moParaAttribsCache.emplace( rOutliner.GetParaAttribs( nPara ) ); mnParaAttribsCache = nPara; EditEngine& rEditEngine = const_cast<EditEngine&>(rOutliner.GetEditEngine()); SfxStyleSheet* pStyle = rEditEngine.GetStyleSheet( nPara ); if( pStyle ) - mpParaAttribsCache->SetParent( &(pStyle->GetItemSet() ) ); + moParaAttribsCache->SetParent( &(pStyle->GetItemSet() ) ); - return *mpParaAttribsCache; + return *moParaAttribsCache; } void SvxOutlinerForwarder::SetParaAttribs( sal_Int32 nPara, const SfxItemSet& rSet ) @@ -186,6 +186,20 @@ void SvxOutlinerForwarder::GetPortions( sal_Int32 nPara, std::vector<sal_Int32>& const_cast<EditEngine&>(rOutliner.GetEditEngine()).GetPortions( nPara, rList ); } +OUString SvxOutlinerForwarder::GetStyleSheet(sal_Int32 nPara) const +{ + if (auto pStyle = rOutliner.GetStyleSheet(nPara)) + return pStyle->GetName(); + return OUString(); +} + +void SvxOutlinerForwarder::SetStyleSheet(sal_Int32 nPara, const OUString& rStyleName) +{ + auto pStyleSheetPool = rOutliner.GetStyleSheetPool(); + if (auto pStyle = pStyleSheetPool ? pStyleSheetPool->Find(rStyleName, SfxStyleFamily::Para) : nullptr) + rOutliner.SetStyleSheet(nPara, static_cast<SfxStyleSheet*>(pStyle)); +} + void SvxOutlinerForwarder::QuickInsertText( const OUString& rText, const ESelection& rSel ) { flushCache(); @@ -217,9 +231,9 @@ void SvxOutlinerForwarder::QuickSetAttribs( const SfxItemSet& rSet, const ESelec rOutliner.QuickSetAttribs( rSet, rSel ); } -OUString SvxOutlinerForwarder::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor ) +OUString SvxOutlinerForwarder::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor, std::optional<FontLineStyle>& rpFldLineStyle ) { - return rOutliner.CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor ); + return rOutliner.CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor, rpFldLineStyle ); } void SvxOutlinerForwarder::FieldClicked( const SvxFieldItem& /*rField*/ ) @@ -230,7 +244,7 @@ bool SvxOutlinerForwarder::IsValid() const { // cannot reliably query outliner state // while in the middle of an update - return rOutliner.GetUpdateMode(); + return rOutliner.IsUpdateLayout(); } SfxItemState SvxOutlinerForwarder::GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const @@ -247,8 +261,8 @@ SfxItemState SvxOutlinerForwarder::GetItemState( sal_Int32 nPara, sal_uInt16 nWh void SvxOutlinerForwarder::flushCache() { - mpAttribsCache.reset(); - mpParaAttribsCache.reset(); + moAttribsCache.reset(); + moParaAttribsCache.reset(); } LanguageType SvxOutlinerForwarder::GetLanguage( sal_Int32 nPara, sal_Int32 nIndex ) const @@ -541,7 +555,7 @@ void SvxOutlinerForwarder::CopyText(const SvxTextForwarder& rSource) const SvxOutlinerForwarder* pSourceForwarder = dynamic_cast< const SvxOutlinerForwarder* >( &rSource ); if( !pSourceForwarder ) return; - std::unique_ptr<OutlinerParaObject> pNewOutlinerParaObject = pSourceForwarder->rOutliner.CreateParaObject(); + std::optional<OutlinerParaObject> pNewOutlinerParaObject = pSourceForwarder->rOutliner.CreateParaObject(); rOutliner.SetText( *pNewOutlinerParaObject ); } |