diff options
author | Armin Le Grand (allotropia) <armin.le.grand.extern@allotropia.de> | 2023-05-12 15:32:51 +0200 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@me.com> | 2023-05-15 15:19:53 +0200 |
commit | 438f0752deaf7d6e6d9d1df381b64aca4628e944 (patch) | |
tree | f1907b25dad1cbf2604b16c657e11f5623c8b5b2 /cui/source | |
parent | efa965969c6d3dfe5745a535605a6b9a482a03bd (diff) |
MCGR: consolidations/cleanups for changes so far
Change-Id: I85cf40e4803b0485bb40349d8e81adc8123666c4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151706
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Diffstat (limited to 'cui/source')
-rw-r--r-- | cui/source/inc/cuitabarea.hxx | 8 | ||||
-rw-r--r-- | cui/source/tabpages/tpgradnt.cxx | 41 | ||||
-rw-r--r-- | cui/source/tabpages/tptrans.cxx | 18 |
3 files changed, 33 insertions, 34 deletions
diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx index 2db104f53c8c..64ec01ef5abf 100644 --- a/cui/source/inc/cuitabarea.hxx +++ b/cui/source/inc/cuitabarea.hxx @@ -170,7 +170,7 @@ class SvxTransparenceTabPage : public SfxTabPage std::unique_ptr<weld::CustomWeld> m_xCtlXRectPreview; // MCGR: Preserve in-between ColorStops until we have an UI to edit these - basegfx::ColorStops maColorStops; + basegfx::BColorStops maColorStops; DECL_LINK(ClickTransOffHdl_Impl, weld::Toggleable&, void); DECL_LINK(ClickTransLinearHdl_Impl, weld::Toggleable&, void); @@ -188,7 +188,7 @@ class SvxTransparenceTabPage : public SfxTabPage void InvalidatePreview (bool bEnable = true ); // MCGR: Preserve in-between ColorStops until we have an UI to edit these - basegfx::ColorStops createColorStops(); + basegfx::BColorStops createColorStops(); public: SvxTransparenceTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs); @@ -368,7 +368,7 @@ private: SfxItemSet& m_rXFSet; // MCGR: Preserve in-between ColorStops until we have an UI to edit these - basegfx::ColorStops m_aColorStops; + basegfx::BColorStops m_aColorStops; SvxXRectPreview m_aCtlPreview; std::unique_ptr<weld::ComboBox> m_xLbGradientType; @@ -410,7 +410,7 @@ private: sal_Int32 SearchGradientList(std::u16string_view rGradientName); // MCGR: Preserve in-between ColorStops until we have an UI to edit these - basegfx::ColorStops createColorStops(); + basegfx::BColorStops createColorStops(); public: SvxGradientTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs); diff --git a/cui/source/tabpages/tpgradnt.cxx b/cui/source/tabpages/tpgradnt.cxx index 57eed4dd4ce5..7f6630747a42 100644 --- a/cui/source/tabpages/tpgradnt.cxx +++ b/cui/source/tabpages/tpgradnt.cxx @@ -84,8 +84,7 @@ SvxGradientTabPage::SvxGradientTabPage(weld::Container* pPage, weld::DialogContr // setting the output device m_rXFSet.Put( XFillStyleItem(drawing::FillStyle_GRADIENT) ); - // XGradient() default already creates [COL_BLACK, COL_WHITE] as defaults - m_rXFSet.Put( XFillGradientItem(OUString(), XGradient())); + m_rXFSet.Put( XFillGradientItem(OUString(), basegfx::BGradient())); m_aCtlPreview.SetAttributes(m_aXFillAttr.GetItemSet()); // set handler @@ -185,18 +184,18 @@ DeactivateRC SvxGradientTabPage::DeactivatePage( SfxItemSet* _pSet ) bool SvxGradientTabPage::FillItemSet( SfxItemSet* rSet ) { - std::unique_ptr<XGradient> pXGradient; + std::unique_ptr<basegfx::BGradient> pBGradient; size_t nPos = m_xGradientLB->IsNoSelection() ? VALUESET_ITEM_NOTFOUND : m_xGradientLB->GetSelectItemPos(); if( nPos != VALUESET_ITEM_NOTFOUND ) { - pXGradient.reset(new XGradient( m_pGradientList->GetGradient( static_cast<sal_uInt16>(nPos) )->GetGradient() )); + pBGradient.reset(new basegfx::BGradient( m_pGradientList->GetGradient( static_cast<sal_uInt16>(nPos) )->GetGradient() )); OUString aString = m_xGradientLB->GetItemText( m_xGradientLB->GetSelectedItemId() ); - rSet->Put( XFillGradientItem( aString, *pXGradient ) ); + rSet->Put( XFillGradientItem( aString, *pBGradient ) ); } else // gradient was passed (unidentified) { - pXGradient.reset(new XGradient( + pBGradient.reset(new basegfx::BGradient( createColorStops(), static_cast<css::awt::GradientStyle>(m_xLbGradientType->get_active()), Degree10(static_cast<sal_Int16>(m_xMtrAngle->get_value(FieldUnit::NONE) * 10)), // should be changed in resource @@ -206,14 +205,14 @@ bool SvxGradientTabPage::FillItemSet( SfxItemSet* rSet ) static_cast<sal_uInt16>(m_xMtrColorFrom->get_value(FieldUnit::NONE)), static_cast<sal_uInt16>(m_xMtrColorTo->get_value(FieldUnit::NONE)), static_cast<sal_uInt16>(m_xMtrIncrement->get_value()) )); - rSet->Put( XFillGradientItem( OUString(), *pXGradient ) ); + rSet->Put( XFillGradientItem( OUString(), *pBGradient ) ); } sal_uInt16 nValue = 0; if (!m_xCbIncrement->get_active()) nValue = m_xMtrIncrement->get_value(); - assert( pXGradient && "XGradient could not be created" ); + assert( pBGradient && "basegfx::BGradient could not be created" ); rSet->Put( XFillStyleItem( drawing::FillStyle_GRADIENT ) ); rSet->Put( XGradientStepCountItem( nValue ) ); return true; @@ -294,7 +293,7 @@ void SvxGradientTabPage::ModifiedHdl_Impl( void const * pControl ) css::awt::GradientStyle eXGS = static_cast<css::awt::GradientStyle>(m_xLbGradientType->get_active()); - XGradient aXGradient( + basegfx::BGradient aBGradient( createColorStops(), eXGS, Degree10(static_cast<sal_Int16>(m_xMtrAngle->get_value(FieldUnit::NONE) * 10)), // should be changed in resource @@ -315,7 +314,7 @@ void SvxGradientTabPage::ModifiedHdl_Impl( void const * pControl ) m_rXFSet.Put( XGradientStepCountItem( nValue ) ); // displaying in XOutDev - m_rXFSet.Put( XFillGradientItem( OUString(), aXGradient ) ); + m_rXFSet.Put( XFillGradientItem( OUString(), aBGradient ) ); m_aCtlPreview.SetAttributes(m_aXFillAttr.GetItemSet()); m_aCtlPreview.Invalidate(); } @@ -361,7 +360,7 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickAddHdl_Impl, weld::Button&, void) if( !nError ) { - XGradient aXGradient( + basegfx::BGradient aBGradient( createColorStops(), static_cast<css::awt::GradientStyle>(m_xLbGradientType->get_active()), Degree10(static_cast<sal_Int16>(m_xMtrAngle->get_value(FieldUnit::NONE) * 10)), // should be changed in resource @@ -372,7 +371,7 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickAddHdl_Impl, weld::Button&, void) static_cast<sal_uInt16>(m_xMtrColorTo->get_value(FieldUnit::NONE)), static_cast<sal_uInt16>(m_xMtrIncrement->get_value()) ); - m_pGradientList->Insert(std::make_unique<XGradientEntry>(aXGradient, aName), nCount); + m_pGradientList->Insert(std::make_unique<XGradientEntry>(aBGradient, aName), nCount); sal_Int32 nId = m_xGradientLB->GetItemId(nCount - 1); //calculate the last ID BitmapEx aBitmap = m_pGradientList->GetBitmapForPreview( nCount, m_xGradientLB->GetIconSize() ); @@ -401,7 +400,7 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickModifyHdl_Impl, weld::Button&, void) OUString aName( m_pGradientList->GetGradient( static_cast<sal_uInt16>(nPos) )->GetName() ); - XGradient aXGradient( + basegfx::BGradient aBGradient( createColorStops(), static_cast<css::awt::GradientStyle>(m_xLbGradientType->get_active()), Degree10(static_cast<sal_Int16>(m_xMtrAngle->get_value(FieldUnit::NONE) * 10)), // should be changed in resource @@ -412,7 +411,7 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickModifyHdl_Impl, weld::Button&, void) static_cast<sal_uInt16>(m_xMtrColorTo->get_value(FieldUnit::NONE)), static_cast<sal_uInt16>(m_xMtrIncrement->get_value()) ); - m_pGradientList->Replace(std::make_unique<XGradientEntry>(aXGradient, aName), nPos); + m_pGradientList->Replace(std::make_unique<XGradientEntry>(aBGradient, aName), nPos); BitmapEx aBitmap = m_pGradientList->GetBitmapForPreview( static_cast<sal_uInt16>(nPos), m_xGradientLB->GetIconSize() ); m_xGradientLB->RemoveItem( nId ); @@ -498,11 +497,11 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ChangeGradientHdl, ValueSet*, void) void SvxGradientTabPage::ChangeGradientHdl_Impl() { - std::unique_ptr<XGradient> pGradient; + std::unique_ptr<basegfx::BGradient> pGradient; size_t nPos = m_xGradientLB->GetSelectItemPos(); if( nPos != VALUESET_ITEM_NOTFOUND ) - pGradient.reset(new XGradient( m_pGradientList->GetGradient( static_cast<sal_uInt16>( nPos ) )->GetGradient() )); + pGradient.reset(new basegfx::BGradient( m_pGradientList->GetGradient( static_cast<sal_uInt16>( nPos ) )->GetGradient() )); else { if( const XFillStyleItem* pFillStyleItem = m_rOutAttrs.GetItemIfSet( GetWhich( XATTR_FILLSTYLE ) ) ) @@ -511,7 +510,7 @@ void SvxGradientTabPage::ChangeGradientHdl_Impl() if( ( drawing::FillStyle_GRADIENT == pFillStyleItem->GetValue() ) && ( pGradientItem = m_rOutAttrs.GetItemIfSet( GetWhich( XATTR_FILLGRADIENT ) ) ) ) { - pGradient.reset(new XGradient( pGradientItem->GetGradientValue() )); + pGradient.reset(new basegfx::BGradient( pGradientItem->GetGradientValue() )); } } if( !pGradient ) @@ -519,7 +518,7 @@ void SvxGradientTabPage::ChangeGradientHdl_Impl() sal_uInt16 nPosition = m_xGradientLB->GetItemId(0); m_xGradientLB->SelectItem( nPosition ); if( nPosition != 0 ) - pGradient.reset(new XGradient( m_pGradientList->GetGradient( 0 )->GetGradient() )); + pGradient.reset(new basegfx::BGradient( m_pGradientList->GetGradient( 0 )->GetGradient() )); } } @@ -551,7 +550,7 @@ void SvxGradientTabPage::ChangeGradientHdl_Impl() // MCGR: preserve in-between ColorStops if given if (pGradient->GetColorStops().size() > 2) - m_aColorStops = basegfx::ColorStops(pGradient->GetColorStops().begin() + 1, pGradient->GetColorStops().end() - 1); + m_aColorStops = basegfx::BColorStops(pGradient->GetColorStops().begin() + 1, pGradient->GetColorStops().end() - 1); else m_aColorStops.clear(); @@ -638,9 +637,9 @@ sal_Int32 SvxGradientTabPage::SearchGradientList(std::u16string_view rGradientNa return nPos; } -basegfx::ColorStops SvxGradientTabPage::createColorStops() +basegfx::BColorStops SvxGradientTabPage::createColorStops() { - basegfx::ColorStops aColorStops; + basegfx::BColorStops aColorStops; aColorStops.emplace_back(0.0, m_xLbColorFrom->GetSelectEntryColor().getBColor()); diff --git a/cui/source/tabpages/tptrans.cxx b/cui/source/tabpages/tptrans.cxx index ef604e6470d5..ce77d61d2fc7 100644 --- a/cui/source/tabpages/tptrans.cxx +++ b/cui/source/tabpages/tptrans.cxx @@ -119,7 +119,7 @@ void SvxTransparenceTabPage::ModifiedTrgrHdl_Impl(const weld::ComboBox* pControl } // preview - XGradient aTmpGradient( + basegfx::BGradient aTmpGradient( createColorStops(), static_cast<css::awt::GradientStyle>(m_xLbTrgrGradientType->get_active()), Degree10(static_cast<sal_Int16>(m_xMtrTrgrAngle->get_value(FieldUnit::DEGREE)) * 10), @@ -287,7 +287,7 @@ bool SvxTransparenceTabPage::FillItemSet(SfxItemSet* rAttrs) || m_xMtrTrgrStartValue->get_value_changed_from_saved() || m_xMtrTrgrEndValue->get_value_changed_from_saved()) { - XGradient aTmpGradient( + basegfx::BGradient aTmpGradient( createColorStops(), static_cast<css::awt::GradientStyle>(m_xLbTrgrGradientType->get_active()), Degree10(static_cast<sal_Int16>(m_xMtrTrgrAngle->get_value(FieldUnit::DEGREE)) * 10), @@ -317,9 +317,9 @@ bool SvxTransparenceTabPage::FillItemSet(SfxItemSet* rAttrs) // disable unused XFillFloatTransparenceItem if(bSwitchOffGradient && (bGradActive || bGradUsed)) { - // XGradient() default already creates [COL_BLACK, COL_WHITE] with same defaults - // XGradient() default also sets the Start/EndIntensity to 100 already - XGradient aGrad; + // basegfx::BGradient() default already creates [COL_BLACK, COL_WHITE] with same defaults + // basegfx::BGradient() default also sets the Start/EndIntensity to 100 already + basegfx::BGradient aGrad; XFillFloatTransparenceItem aItem(aGrad); aItem.SetEnabled(false); @@ -355,7 +355,7 @@ void SvxTransparenceTabPage::Reset(const SfxItemSet* rAttrs) pLinearItem = &rAttrs->Get(XATTR_FILLTRANSPARENCE); // transparence gradient - const XGradient& rGradient = pGradientItem->GetGradientValue(); + const basegfx::BGradient& rGradient = pGradientItem->GetGradientValue(); css::awt::GradientStyle eXGS(rGradient.GetGradientStyle()); m_xLbTrgrGradientType->set_active(sal::static_int_cast< sal_Int32 >(eXGS)); m_xMtrTrgrAngle->set_value(rGradient.GetAngle().get() / 10, FieldUnit::DEGREE); @@ -369,7 +369,7 @@ void SvxTransparenceTabPage::Reset(const SfxItemSet* rAttrs) // MCGR: preserve in-between ColorStops if given if (rGradient.GetColorStops().size() > 2) - maColorStops = basegfx::ColorStops(rGradient.GetColorStops().begin() + 1, rGradient.GetColorStops().end() - 1); + maColorStops = basegfx::BColorStops(rGradient.GetColorStops().begin() + 1, rGradient.GetColorStops().end() - 1); else maColorStops.clear(); @@ -508,9 +508,9 @@ void SvxTransparenceTabPage::InvalidatePreview (bool bEnable) } } -basegfx::ColorStops SvxTransparenceTabPage::createColorStops() +basegfx::BColorStops SvxTransparenceTabPage::createColorStops() { - basegfx::ColorStops aColorStops; + basegfx::BColorStops aColorStops; const sal_uInt8 nStartCol(static_cast<sal_uInt8>((static_cast<sal_uInt16>(m_xMtrTrgrStartValue->get_value(FieldUnit::PERCENT)) * 255) / 100)); const sal_uInt8 nEndCol(static_cast<sal_uInt8>((static_cast<sal_uInt16>(m_xMtrTrgrEndValue->get_value(FieldUnit::PERCENT)) * 255) / 100)); |