cui/qa/uitest/tabpages/tpcolor.py | 4 cui/source/inc/cuitabarea.hxx | 41 +- cui/source/tabpages/backgrnd.cxx | 30 - cui/source/tabpages/tparea.cxx | 343 +++++++++-------- cui/uiconfig/ui/areatabpage.ui | 275 +++++++------ sc/qa/uitest/calc_tests/cellBackgroundColorSelector.py | 16 sc/qa/uitest/chart/chartArea.py | 4 sc/qa/uitest/chart/chartWall.py | 4 sd/qa/uitest/impress_tests/tdf134734.py | 4 sd/qa/uitest/impress_tests/tdf137729.py | 4 sd/qa/uitest/impress_tests/tdf152295.py | 20 sd/qa/uitest/impress_tests2/tdf125449.py | 4 sd/qa/uitest/impress_tests2/tdf149787.py | 4 sw/qa/uitest/table/tableProperties.py | 8 sw/qa/uitest/table/tdf109083.py | 4 sw/qa/uitest/table/tdf116737.py | 4 sw/qa/uitest/table/tdf144843.py | 5 sw/qa/uitest/writer_tests/tdf134734.py | 4 sw/qa/uitest/writer_tests2/formatParagraph.py | 16 sw/qa/uitest/writer_tests3/pageDialog.py | 36 + sw/qa/uitest/writer_tests5/tdf122045.py | 4 uitest/impress_tests/backgrounds.py | 36 + 22 files changed, 495 insertions(+), 375 deletions(-)
New commits: commit 3ce2ecdaf23ded550f3a99958463173fc16433c8 Author: Parth Raiyani <[email protected]> AuthorDate: Wed Dec 17 17:39:44 2025 +0530 Commit: Caolán McNamara <[email protected]> CommitDate: Wed Dec 17 17:15:06 2025 +0100 a11y: Convert AreaTabPage from toggle buttons to proper GtkNotebook tabs - Replace toggle button in AreaTabpage with proper GtkNotebook implementation for better accessibility - Fix relevant test cases Change-Id: Ia6e43699c45dcfdb25251af94f9738d3597c0a25 Signed-off-by: Parth Raiyani <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195382 Tested-by: Caolán McNamara <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/cui/qa/uitest/tabpages/tpcolor.py b/cui/qa/uitest/tabpages/tpcolor.py index 4a48c6f3f913..99742f297bd7 100644 --- a/cui/qa/uitest/tabpages/tpcolor.py +++ b/cui/qa/uitest/tabpages/tpcolor.py @@ -52,8 +52,8 @@ class Test(UITestCase): # Area select_pos(tabControl, "0") # Color - btnColor = xDialog.getChild("btncolor") - btnColor.executeAction("CLICK", tuple()) + xFillTypeTabs = xDialog.getChild("nbFillType") + select_pos(xFillTypeTabs, "1") paletteSelector = xDialog.getChild("paletteselector") select_by_text(paletteSelector, "Theme colors") colorSelector = xDialog.getChild("iconview_colors") diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx index fd489491199c..31519ea6e900 100644 --- a/cui/source/inc/cuitabarea.hxx +++ b/cui/source/inc/cuitabarea.hxx @@ -211,12 +211,30 @@ public: /************************************************************************/ +enum FillType +{ + TRANSPARENT_FILL, + SOLID_FILL, + GRADIENT_FILL, + HATCH_FILL, + BITMAP_FILL, + PATTERN_FILL, + USE_BACKGROUND_FILL +}; + +inline constexpr OUString TABID_NONE = u"lbnone"_ustr; +inline constexpr OUString TABID_COLOR = u"lbcolor"_ustr; +inline constexpr OUString TABID_GRADIENT = u"lbgradient"_ustr; +inline constexpr OUString TABID_HATCH = u"lbhatch"_ustr; +inline constexpr OUString TABID_BITMAP = u"lbbitmap"_ustr; +inline constexpr OUString TABID_PATTERN = u"lbpattern"_ustr; +inline constexpr OUString TABID_USE_BACKGROUND = u"lbusebackground"_ustr; + class SvxAreaTabPage : public SfxTabPage { static const WhichRangesContainer pAreaRanges; private: std::unique_ptr<SfxTabPage> m_xFillTabPage; - ButtonBox maBox; XColorListRef m_pColorList; XGradientListRef m_pGradientList; @@ -238,23 +256,22 @@ private: bool m_bBtnClicked = false; protected: - std::unique_ptr<weld::Container> m_xFillTab; - std::unique_ptr<weld::Toggleable> m_xBtnNone; - std::unique_ptr<weld::Toggleable> m_xBtnColor; - std::unique_ptr<weld::Toggleable> m_xBtnGradient; - std::unique_ptr<weld::Toggleable> m_xBtnHatch; - std::unique_ptr<weld::Toggleable> m_xBtnBitmap; - std::unique_ptr<weld::Toggleable> m_xBtnPattern; - std::unique_ptr<weld::Toggleable> m_xBtnUseBackground; + std::unique_ptr<weld::Notebook> m_xNotebook; + std::map<OUString, FillType> maFillTypeMap; - void SetOptimalSize(weld::DialogController* pController); + void SetOptimalSize(); - void SelectFillType( weld::Toggleable& rButton, const SfxItemSet* _pSet = nullptr ); + void SelectFillType(FillType eFillType, const SfxItemSet* _pSet = nullptr); bool IsBtnClicked() const { return m_bBtnClicked; } private: - DECL_LINK(SelectFillTypeHdl_Impl, weld::Toggleable&, void); + DECL_LINK(SwitchPageHdl_Impl, const OUString&, void); + + std::unique_ptr<SfxTabPage> CreateFillStyleTabPage(FillType eFillType); + void SelectFillTypeByPage(FillType eFillType, const SfxItemSet* _pSet = nullptr); + + OUString getPageId(FillType eFillType); template< typename TabPage > bool FillItemSet_Impl( SfxItemSet* ); diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx index aa53dcd64afe..f7b76250d68f 100644 --- a/cui/source/tabpages/backgrnd.cxx +++ b/cui/source/tabpages/backgrnd.cxx @@ -28,6 +28,7 @@ #include <svx/flagsdef.hxx> #include <svl/intitem.hxx> #include <svx/unobrushitemhelper.hxx> +#include <cuitabarea.hxx> using namespace css; @@ -66,10 +67,14 @@ SvxBkgTabPage::SvxBkgTabPage(weld::Container* pPage, weld::DialogController* pCo m_aAttrSet(*rInAttrs.GetPool(), rInAttrs.GetRanges().MergeRange(XATTR_FILL_FIRST, XATTR_FILL_LAST)) { - m_xBtnGradient->hide(); - m_xBtnHatch->hide(); - m_xBtnBitmap->hide(); - m_xBtnPattern->hide(); + if (m_xNotebook->get_page_index(TABID_GRADIENT) != -1) + m_xNotebook->remove_page(TABID_GRADIENT); + if (m_xNotebook->get_page_index(TABID_HATCH) != -1) + m_xNotebook->remove_page(TABID_HATCH); + if (m_xNotebook->get_page_index(TABID_BITMAP) != -1) + m_xNotebook->remove_page(TABID_BITMAP); + if (m_xNotebook->get_page_index(TABID_PATTERN) != -1) + m_xNotebook->remove_page(TABID_PATTERN); } SvxBkgTabPage::~SvxBkgTabPage() @@ -224,7 +229,7 @@ bool SvxBkgTabPage::FillItemSet(SfxItemSet* pCoreSet) std::unique_ptr<SfxTabPage> SvxBkgTabPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrs) { auto xRet = std::make_unique<SvxBkgTabPage>(pPage, pController, *rAttrs); - xRet->SetOptimalSize(pController); + xRet->SetOptimalSize(); return xRet; } @@ -236,7 +241,6 @@ void SvxBkgTabPage::PageCreated(const SfxAllItemSet& aSet) SvxBackgroundTabFlags nFlags = static_cast<SvxBackgroundTabFlags>(pFlagItem->GetValue()); if ( nFlags & SvxBackgroundTabFlags::SHOW_TBLCTL ) { - m_xBtnBitmap->show(); m_xTblLBox = m_xBuilder->weld_combo_box(u"tablelb"_ustr); m_xTblLBox->connect_changed(LINK(this, SvxBkgTabPage, TblDestinationHdl_Impl)); m_xTblLBox->show(); @@ -247,9 +251,7 @@ void SvxBkgTabPage::PageCreated(const SfxAllItemSet& aSet) m_bHighlighting = bool(nFlags & SvxBackgroundTabFlags::SHOW_HIGHLIGHTING); m_bCharBackColor = bool(nFlags & SvxBackgroundTabFlags::SHOW_CHAR_BKGCOLOR); } - if (nFlags & SvxBackgroundTabFlags::SHOW_SELECTOR) - m_xBtnBitmap->show(); - SetOptimalSize(GetDialogController()); + SetOptimalSize(); } SfxObjectShell* pObjSh = SfxObjectShell::Current(); @@ -267,7 +269,7 @@ void SvxBkgTabPage::PageCreated(const SfxAllItemSet& aSet) SetColorList(xColorTable); // sometimes we have the bitmap page - if (m_xBtnBitmap->get_visible()) + if (m_xNotebook->get_n_pages() > 4) { XBitmapListRef xBitmapList; if (pObjSh) @@ -306,7 +308,7 @@ void SvxBkgTabPage::SetActiveTableDestinationBrushItem() } else { - SelectFillType(*m_xBtnNone, &m_aAttrSet); + SelectFillType(FillType::TRANSPARENT_FILL, &m_aAttrSet); return; } @@ -317,17 +319,17 @@ void SvxBkgTabPage::SetActiveTableDestinationBrushItem() default: case drawing::FillStyle_NONE: { - SelectFillType(*m_xBtnNone, &m_aAttrSet); + SelectFillType(FillType::TRANSPARENT_FILL, &m_aAttrSet); break; } case drawing::FillStyle_SOLID: { - SelectFillType(*m_xBtnColor, &m_aAttrSet); + SelectFillType(FillType::SOLID_FILL, &m_aAttrSet); break; } case drawing::FillStyle_BITMAP: { - SelectFillType(*m_xBtnBitmap, &m_aAttrSet); + SelectFillType(FillType::BITMAP_FILL, &m_aAttrSet); break; } } diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx index 068d08283f70..7490acb77ab9 100644 --- a/cui/source/tabpages/tparea.cxx +++ b/cui/source/tabpages/tparea.cxx @@ -34,22 +34,6 @@ using namespace com::sun::star; // static ---------------------------------------------------------------- - -namespace { - -enum FillType -{ - TRANSPARENT, - SOLID, - GRADIENT, - HATCH, - BITMAP, - PATTERN, - USE_BACKGROUND_FILL -}; - -} - const WhichRangesContainer SvxAreaTabPage::pAreaRanges( svl::Items< XATTR_GRADIENTSTEPCOUNT, XATTR_GRADIENTSTEPCOUNT, @@ -97,77 +81,94 @@ SvxAreaTabPage::SvxAreaTabPage(weld::Container* pPage, weld::DialogController* p , m_pnColorListState(&maFixed_ChangeType) , m_aXFillAttr(rInAttrs.GetPool()) , m_rXFSet(m_aXFillAttr.GetItemSet()) - , m_xFillTab(m_xBuilder->weld_container(u"fillstylebox"_ustr)) - , m_xBtnNone(m_xBuilder->weld_toggle_button(u"btnnone"_ustr)) - , m_xBtnColor(m_xBuilder->weld_toggle_button(u"btncolor"_ustr)) - , m_xBtnGradient(m_xBuilder->weld_toggle_button(u"btngradient"_ustr)) - , m_xBtnHatch(m_xBuilder->weld_toggle_button(u"btnhatch"_ustr)) - , m_xBtnBitmap(m_xBuilder->weld_toggle_button(u"btnbitmap"_ustr)) - , m_xBtnPattern(m_xBuilder->weld_toggle_button(u"btnpattern"_ustr)) - , m_xBtnUseBackground(m_xBuilder->weld_toggle_button(u"btnusebackground"_ustr)) + , m_xNotebook(m_xBuilder->weld_notebook(u"nbFillType"_ustr)) { - maBox.AddButton(m_xBtnNone.get()); - maBox.AddButton(m_xBtnColor.get()); - maBox.AddButton(m_xBtnGradient.get()); - maBox.AddButton(m_xBtnHatch.get()); - maBox.AddButton(m_xBtnBitmap.get()); - maBox.AddButton(m_xBtnPattern.get()); - - Link<weld::Toggleable&, void> aLink = LINK(this, SvxAreaTabPage, SelectFillTypeHdl_Impl); - m_xBtnNone->connect_toggled(aLink); - m_xBtnColor->connect_toggled(aLink); - m_xBtnGradient->connect_toggled(aLink); - m_xBtnHatch->connect_toggled(aLink); - m_xBtnBitmap->connect_toggled(aLink); - m_xBtnPattern->connect_toggled(aLink); - if (bSlideBackground) + if (!bSlideBackground) { - maBox.AddButton(m_xBtnUseBackground.get()); - m_xBtnUseBackground->connect_toggled(aLink); + if (m_xNotebook->get_page_index(TABID_USE_BACKGROUND) != -1) + m_xNotebook->remove_page(TABID_USE_BACKGROUND); } - else - m_xBtnUseBackground->hide(); + + maFillTypeMap = { + {TABID_NONE, FillType::TRANSPARENT_FILL}, + {TABID_COLOR, FillType::SOLID_FILL}, + {TABID_GRADIENT, FillType::GRADIENT_FILL}, + {TABID_HATCH, FillType::HATCH_FILL}, + {TABID_BITMAP, FillType::BITMAP_FILL}, + {TABID_PATTERN, FillType::PATTERN_FILL}, + {TABID_USE_BACKGROUND, FillType::USE_BACKGROUND_FILL} + }; + + m_xNotebook->connect_enter_page(LINK(this, SvxAreaTabPage, SwitchPageHdl_Impl)); SetExchangeSupport(); } -void SvxAreaTabPage::SetOptimalSize(weld::DialogController* pController) +OUString SvxAreaTabPage::getPageId(FillType eFillType) +{ + for (const auto& entry : maFillTypeMap) + { + if (entry.second == eFillType) + return entry.first; + } + return OUString(); +} + +void SvxAreaTabPage::SetOptimalSize() { - m_xFillTab->set_size_request(-1, -1); + Size aSize; - // Calculate optimal size of all pages... - m_xFillTabPage = SvxColorTabPage::Create(m_xFillTab.get(), pController, &m_rXFSet); - Size aSize(m_xFillTab->get_preferred_size()); + auto getPageSize = [&](const OUString& rPageId) -> Size { + weld::Container* pPage = m_xNotebook->get_page(rPageId); + if (!pPage) + return Size(); - if (m_xBtnGradient->get_visible()) - { - m_xFillTabPage = SvxGradientTabPage::Create(m_xFillTab.get(), pController, &m_rXFSet); - Size aGradientSize = m_xFillTab->get_preferred_size(); + std::unique_ptr<SfxTabPage> xTempPage; + Size aPageSize; + + auto it = maFillTypeMap.find(rPageId); + if (it != maFillTypeMap.end()) + { + xTempPage = CreateFillStyleTabPage(it->second); + if (xTempPage) + { + aPageSize = pPage->get_preferred_size(); + xTempPage.reset(); + } + } + + return aPageSize; + }; + + Size aColorSize = getPageSize(TABID_COLOR); + if (aColorSize.Width() > 0) + aSize = aColorSize; + + Size aGradientSize = getPageSize(TABID_GRADIENT); + if (aGradientSize.Width() > 0) lclExtendSize(aSize, aGradientSize); - } - if (m_xBtnBitmap->get_visible()) - { - m_xFillTabPage = SvxBitmapTabPage::Create(m_xFillTab.get(), pController, &m_rXFSet); - Size aBitmapSize = m_xFillTab->get_preferred_size(); + + Size aBitmapSize = getPageSize(TABID_BITMAP); + if (aBitmapSize.Width() > 0) lclExtendSize(aSize, aBitmapSize); - } - if (m_xBtnHatch->get_visible()) - { - m_xFillTabPage = SvxHatchTabPage::Create(m_xFillTab.get(), pController, &m_rXFSet); - Size aHatchSize = m_xFillTab->get_preferred_size(); + + Size aHatchSize = getPageSize(TABID_HATCH); + if (aHatchSize.Width() > 0) lclExtendSize(aSize, aHatchSize); - } - if (m_xBtnPattern->get_visible()) - { - m_xFillTabPage = SvxPatternTabPage::Create(m_xFillTab.get(), pController, &m_rXFSet); - Size aPatternSize = m_xFillTab->get_preferred_size(); + + Size aPatternSize = getPageSize(TABID_PATTERN); + if (aPatternSize.Width() > 0) lclExtendSize(aSize, aPatternSize); + + if (aSize.Width() == 0 || aSize.Height() == 0) + { + aSize = Size(m_xNotebook->get_approximate_digit_width() * 50, + m_xNotebook->get_text_height() * 20); } - m_xFillTabPage.reset(); aSize.extendBy(10, 10); // apply a bit of margin - m_xFillTab->set_size_request(aSize.Width(), aSize.Height()); + m_xNotebook->set_size_request(aSize.Width(), aSize.Height()); } SvxAreaTabPage::~SvxAreaTabPage() @@ -177,6 +178,9 @@ SvxAreaTabPage::~SvxAreaTabPage() void SvxAreaTabPage::ActivatePage( const SfxItemSet& rSet ) { + if (m_bBtnClicked) + return; + drawing::FillStyle eXFS = drawing::FillStyle_NONE; if( rSet.GetItemState( XATTR_FILLSTYLE ) != SfxItemState::INVALID ) { @@ -185,29 +189,27 @@ void SvxAreaTabPage::ActivatePage( const SfxItemSet& rSet ) m_rXFSet.Put( aFillStyleItem ); } + FillType eTargetFillType; switch(eXFS) { default: case drawing::FillStyle_NONE: { const XFillUseSlideBackgroundItem& aBckItem( rSet.Get(XATTR_FILLUSESLIDEBACKGROUND)); - if (aBckItem.GetValue()) - SelectFillType(*m_xBtnUseBackground); - else - SelectFillType(*m_xBtnNone); + eTargetFillType = aBckItem.GetValue() ? FillType::USE_BACKGROUND_FILL : FillType::TRANSPARENT_FILL; break; } case drawing::FillStyle_SOLID: { m_rXFSet.Put( rSet.Get( GetWhich( XATTR_FILLCOLOR ) ) ); - SelectFillType(*m_xBtnColor); + eTargetFillType = FillType::SOLID_FILL; break; } case drawing::FillStyle_GRADIENT: { m_rXFSet.Put( rSet.Get( GetWhich( XATTR_FILLGRADIENT ) ) ); m_rXFSet.Put(rSet.Get(GetWhich(XATTR_GRADIENTSTEPCOUNT))); - SelectFillType(*m_xBtnGradient); + eTargetFillType = FillType::GRADIENT_FILL; break; } case drawing::FillStyle_HATCH: @@ -215,7 +217,7 @@ void SvxAreaTabPage::ActivatePage( const SfxItemSet& rSet ) m_rXFSet.Put( rSet.Get(XATTR_FILLHATCH) ); m_rXFSet.Put( rSet.Get(XATTR_FILLUSESLIDEBACKGROUND) ); m_rXFSet.Put( rSet.Get(XATTR_FILLCOLOR) ); - SelectFillType(*m_xBtnHatch); + eTargetFillType = FillType::HATCH_FILL; break; } case drawing::FillStyle_BITMAP: @@ -223,13 +225,12 @@ void SvxAreaTabPage::ActivatePage( const SfxItemSet& rSet ) const bool bPattern = rSet.Get(GetWhich(XATTR_FILLBITMAP)).isPattern(); // pass full item set here, bitmap fill has many attributes (tiling, size, offset etc.) m_rXFSet.Put( rSet ); - if (!bPattern) - SelectFillType(*m_xBtnBitmap); - else - SelectFillType(*m_xBtnPattern); + eTargetFillType = bPattern ? FillType::PATTERN_FILL : FillType::BITMAP_FILL; break; } } + + SelectFillType(eTargetFillType); } template< typename TTabPage > @@ -240,10 +241,15 @@ DeactivateRC SvxAreaTabPage::DeactivatePage_Impl( SfxItemSet* _pSet ) DeactivateRC SvxAreaTabPage::DeactivatePage( SfxItemSet* _pSet ) { - FillType eFillType = static_cast<FillType>(maBox.GetCurrentButtonPos()); + OUString sCurrentPage = m_xNotebook->get_current_page_ident(); + auto it = maFillTypeMap.find(sCurrentPage); + if (it == maFillTypeMap.end()) + return DeactivateRC::LeavePage; + + FillType eFillType = it->second; switch( eFillType ) { - case TRANSPARENT: + case TRANSPARENT_FILL: { // Fill: None doesn't have its own tabpage and thus // implementation of FillItemSet, so we supply it here @@ -256,15 +262,15 @@ DeactivateRC SvxAreaTabPage::DeactivatePage( SfxItemSet* _pSet ) } break; } - case SOLID: + case SOLID_FILL: return DeactivatePage_Impl<SvxColorTabPage>(_pSet); - case GRADIENT: + case GRADIENT_FILL: return DeactivatePage_Impl<SvxGradientTabPage>(_pSet); - case HATCH: + case HATCH_FILL: return DeactivatePage_Impl<SvxHatchTabPage>(_pSet); - case BITMAP: - return DeactivatePage_Impl<SvxBitmapTabPage&>(_pSet); - case PATTERN: + case BITMAP_FILL: + return DeactivatePage_Impl<SvxBitmapTabPage>(_pSet); + case PATTERN_FILL: return DeactivatePage_Impl<SvxPatternTabPage>(_pSet); case USE_BACKGROUND_FILL: { @@ -292,13 +298,12 @@ bool SvxAreaTabPage::FillItemSet_Impl( SfxItemSet* rAttrs) OUString SvxAreaTabPage::GetAllStrings() { OUString sAllStrings; - OUString toggleButton[] = { u"btnnone"_ustr, u"btncolor"_ustr, u"btngradient"_ustr, u"btnbitmap"_ustr, - u"btnpattern"_ustr, u"btnhatch"_ustr, u"btnusebackground"_ustr }; + OUString tabLabels[] = { u"None"_ustr, u"Color"_ustr, u"Gradient"_ustr, u"Hatch"_ustr, + u"Image"_ustr, u"Pattern"_ustr, u"Use Background"_ustr }; - for (const auto& toggle : toggleButton) + for (const auto& label : tabLabels) { - if (const auto pString = m_xBuilder->weld_toggle_button(toggle)) - sAllStrings += pString->get_label() + " "; + sAllStrings += label + " "; } return sAllStrings.replaceAll("_", ""); @@ -306,32 +311,37 @@ OUString SvxAreaTabPage::GetAllStrings() bool SvxAreaTabPage::FillItemSet( SfxItemSet* rAttrs ) { - FillType eFillType = static_cast<FillType>(maBox.GetCurrentButtonPos()); + OUString sCurrentPage = m_xNotebook->get_current_page_ident(); + auto it = maFillTypeMap.find(sCurrentPage); + if (it == maFillTypeMap.end()) + return false; + + FillType eFillType = it->second; switch( eFillType ) { - case TRANSPARENT: + case TRANSPARENT_FILL: { rAttrs->Put( XFillStyleItem( drawing::FillStyle_NONE ) ); rAttrs->Put( XFillUseSlideBackgroundItem( false ) ); return true; } - case SOLID: + case SOLID_FILL: { return FillItemSet_Impl<SvxColorTabPage>( rAttrs ); } - case GRADIENT: + case GRADIENT_FILL: { return FillItemSet_Impl<SvxGradientTabPage>( rAttrs ); } - case HATCH: + case HATCH_FILL: { return FillItemSet_Impl<SvxHatchTabPage>( rAttrs ); } - case BITMAP: + case BITMAP_FILL: { return FillItemSet_Impl<SvxBitmapTabPage>( rAttrs ); } - case PATTERN: + case PATTERN_FILL: { return FillItemSet_Impl<SvxPatternTabPage>( rAttrs ); } @@ -355,30 +365,35 @@ void SvxAreaTabPage::Reset_Impl( const SfxItemSet* rAttrs ) void SvxAreaTabPage::Reset( const SfxItemSet* rAttrs ) { m_bBtnClicked = false; - auto eFillType = maBox.GetCurrentButtonPos(); + OUString sCurrentPage = m_xNotebook->get_current_page_ident(); + auto it = maFillTypeMap.find(sCurrentPage); + if (it == maFillTypeMap.end()) + return; + + FillType eFillType = it->second; switch(eFillType) { - case SOLID: + case SOLID_FILL: { Reset_Impl<SvxColorTabPage>( rAttrs ); break; } - case GRADIENT: + case GRADIENT_FILL: { Reset_Impl<SvxGradientTabPage>( rAttrs ); break; } - case HATCH: + case HATCH_FILL: { Reset_Impl<SvxHatchTabPage>( rAttrs ); break; } - case BITMAP: + case BITMAP_FILL: { Reset_Impl<SvxBitmapTabPage>( rAttrs ); break; } - case PATTERN: + case PATTERN_FILL: { Reset_Impl<SvxPatternTabPage>( rAttrs ); break; @@ -391,7 +406,7 @@ void SvxAreaTabPage::Reset( const SfxItemSet* rAttrs ) std::unique_ptr<SfxTabPage> SvxAreaTabPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrs) { auto xRet = std::make_unique<SvxAreaTabPage>(pPage, pController, *rAttrs); - xRet->SetOptimalSize(pController); + xRet->SetOptimalSize(); return xRet; } @@ -399,56 +414,98 @@ std::unique_ptr<SfxTabPage> SvxAreaTabPage::CreateWithSlideBackground( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrs) { auto xRet = std::make_unique<SvxAreaTabPage>(pPage, pController, *rAttrs, true); - xRet->SetOptimalSize(pController); + xRet->SetOptimalSize(); return xRet; } -namespace { - -std::unique_ptr<SfxTabPage> lcl_CreateFillStyleTabPage(sal_uInt16 nId, weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet) +void SvxAreaTabPage::SelectFillTypeByPage(FillType eFillType, const SfxItemSet* _pSet) { - CreateTabPage fnCreate = nullptr; - switch(nId) + if (_pSet) + m_rXFSet.Set(*_pSet); + + OUString sPageId = getPageId(eFillType); + if (sPageId.isEmpty()) + return; + + weld::Container* pContainer = m_xNotebook->get_page(sPageId); + if (!pContainer) + return; + + m_xFillTabPage = CreateFillStyleTabPage(eFillType); + if (m_xFillTabPage) { - case TRANSPARENT: fnCreate = nullptr; break; - case SOLID: fnCreate = &SvxColorTabPage::Create; break; - case GRADIENT: fnCreate = &SvxGradientTabPage::Create; break; - case HATCH: fnCreate = &SvxHatchTabPage::Create; break; - case BITMAP: fnCreate = &SvxBitmapTabPage::Create; break; - case PATTERN: fnCreate = &SvxPatternTabPage::Create; break; - case USE_BACKGROUND_FILL: fnCreate = nullptr; break; + m_xFillTabPage->SetDialogController(GetDialogController()); + CreatePage(eFillType, *m_xFillTabPage); } - return fnCreate ? (*fnCreate)( pPage, pController, &rSet ) : nullptr; } +IMPL_LINK(SvxAreaTabPage, SwitchPageHdl_Impl, const OUString&, rPageIdent, void) +{ + m_bBtnClicked = true; + auto it = maFillTypeMap.find(rPageIdent); + if (it != maFillTypeMap.end()) + { + FillType eFillType = it->second; + SelectFillTypeByPage(eFillType); + m_bBtnClicked = true; + } } -IMPL_LINK(SvxAreaTabPage, SelectFillTypeHdl_Impl, weld::Toggleable&, rButton, void) +std::unique_ptr<SfxTabPage> SvxAreaTabPage::CreateFillStyleTabPage(FillType eFillType) { - //tdf#124549 - If the button is already active do not toggle it back. - if(!rButton.get_active()) - rButton.set_active(true); + OUString sPageId = getPageId(eFillType); - SelectFillType(rButton); - m_bBtnClicked = true; + weld::Container* pPage = m_xNotebook->get_page(sPageId); + if (!pPage) + return nullptr; + + CreateTabPage fnCreate = nullptr; + switch(eFillType) + { + case TRANSPARENT_FILL: + fnCreate = nullptr; + break; + case SOLID_FILL: + fnCreate = &SvxColorTabPage::Create; + break; + case GRADIENT_FILL: + fnCreate = &SvxGradientTabPage::Create; + break; + case HATCH_FILL: + fnCreate = &SvxHatchTabPage::Create; + break; + case BITMAP_FILL: + fnCreate = &SvxBitmapTabPage::Create; + break; + case PATTERN_FILL: + fnCreate = &SvxPatternTabPage::Create; + break; + case USE_BACKGROUND_FILL: + fnCreate = nullptr; + break; + } + + if (!fnCreate) + return nullptr; + + std::unique_ptr<SfxTabPage> pTabPage = (*fnCreate)(pPage, GetDialogController(), &m_rXFSet); + return pTabPage; } -void SvxAreaTabPage::SelectFillType(weld::Toggleable& rButton, const SfxItemSet* _pSet) +void SvxAreaTabPage::SelectFillType(FillType eFillType, const SfxItemSet* _pSet) { if (_pSet) m_rXFSet.Set(*_pSet); - sal_Int32 nPos = maBox.GetButtonPos(&rButton); - if (nPos != -1 && (_pSet || nPos != maBox.GetCurrentButtonPos())) + const OUString pageId = getPageId(eFillType); + if(!pageId.isEmpty()) + m_xNotebook->set_current_page(pageId); + + m_xFillTabPage = CreateFillStyleTabPage(eFillType); + if (m_xFillTabPage) { - maBox.SelectButton(&rButton); - FillType eFillType = static_cast<FillType>(maBox.GetCurrentButtonPos()); - m_xFillTabPage = lcl_CreateFillStyleTabPage(eFillType, m_xFillTab.get(), GetDialogController(), m_rXFSet); - if (m_xFillTabPage) - { - m_xFillTabPage->SetDialogController(GetDialogController()); - CreatePage(eFillType, *m_xFillTabPage); - } + m_xFillTabPage->SetDialogController(GetDialogController()); + CreatePage(eFillType, *m_xFillTabPage); } } @@ -474,7 +531,7 @@ void SvxAreaTabPage::PageCreated(const SfxAllItemSet& aSet) void SvxAreaTabPage::CreatePage(sal_Int32 nId, SfxTabPage& rTab) { - if(nId == SOLID ) + if(nId == SOLID_FILL ) { auto& rColorTab = static_cast<SvxColorTabPage&>(rTab); rColorTab.SetColorList(m_pColorList); @@ -484,7 +541,7 @@ void SvxAreaTabPage::CreatePage(sal_Int32 nId, SfxTabPage& rTab) rColorTab.Reset(&m_rXFSet); rColorTab.set_visible(true); } - else if(nId == GRADIENT) + else if(nId == GRADIENT_FILL) { auto& rGradientTab = static_cast<SvxGradientTabPage&>(rTab); rGradientTab.SetColorList(m_pColorList); @@ -495,7 +552,7 @@ void SvxAreaTabPage::CreatePage(sal_Int32 nId, SfxTabPage& rTab) rGradientTab.Reset(&m_rXFSet); rGradientTab.set_visible(true); } - else if(nId == HATCH) + else if(nId == HATCH_FILL) { auto& rHatchTab = static_cast<SvxHatchTabPage&>(rTab); rHatchTab.SetColorList(m_pColorList); @@ -506,7 +563,7 @@ void SvxAreaTabPage::CreatePage(sal_Int32 nId, SfxTabPage& rTab) rHatchTab.Reset(&m_rXFSet); rHatchTab.set_visible(true); } - else if(nId == BITMAP) + else if(nId == BITMAP_FILL) { auto& rBitmapTab = static_cast<SvxBitmapTabPage&>(rTab); rBitmapTab.SetBitmapList(m_pBitmapList); @@ -515,7 +572,7 @@ void SvxAreaTabPage::CreatePage(sal_Int32 nId, SfxTabPage& rTab) rBitmapTab.Reset(&m_rXFSet); rBitmapTab.set_visible(true); } - else if(nId == PATTERN) + else if(nId == PATTERN_FILL) { auto& rPatternTab = static_cast<SvxPatternTabPage&>(rTab); rPatternTab.SetColorList(m_pColorList); diff --git a/cui/uiconfig/ui/areatabpage.ui b/cui/uiconfig/ui/areatabpage.ui index 157a7d0ce968..a02c08f59915 100644 --- a/cui/uiconfig/ui/areatabpage.ui +++ b/cui/uiconfig/ui/areatabpage.ui @@ -18,7 +18,7 @@ <property name="orientation">vertical</property> <property name="spacing">3</property> <child> - <object class="GtkBox" id="buttonbox1"> + <object class="GtkBox" id="tablebox"> <property name="visible">True</property> <property name="can-focus">False</property> <property name="halign">center</property> @@ -46,165 +46,200 @@ <property name="position">0</property> </packing> </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkNotebook" id="nbFillType"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="show-border">False</property> + + <!-- None Tab --> <child> - <object class="GtkToggleButton" id="btnnone"> - <property name="label" translatable="yes" context="areatabpage|btnnone">None</property> + <object class="GtkGrid" id="gdNone"> <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="receives-default">True</property> - <child internal-child="accessible"> - <object class="AtkObject" id="btnnone-atkobject"> - <property name="AtkObject::accessible-description" translatable="yes" context="areatabpage|extended_tip|btnnone">Do not fill the selected object.</property> - </object> + <property name="can-focus">False</property> + <property name="margin-start">6</property> + <property name="margin-end">6</property> + <property name="margin-top">6</property> + <property name="margin-bottom">6</property> + <property name="vexpand">True</property> + <property name="row-spacing">6</property> + <property name="column-spacing">6</property> + <child> + <placeholder/> </child> </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> </child> + <child type="tab"> + <object class="GtkLabel" id="lbnone"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="label" translatable="yes" context="areatabpage|btnnone">None</property> + </object> + </child> + + <!-- Color Tab --> <child> - <object class="GtkToggleButton" id="btncolor"> - <property name="label" translatable="yes" context="areatabpage|btncolor">Color</property> + <object class="GtkGrid" id="gdColor"> <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="receives-default">True</property> - <child internal-child="accessible"> - <object class="AtkObject" id="btncolor-atkobject"> - <property name="AtkObject::accessible-description" translatable="yes" context="areatabpage|extended_tip|btncolor">Fills the object with a color selected on this page.</property> - </object> + <property name="can-focus">False</property> + <property name="margin-start">6</property> + <property name="margin-end">6</property> + <property name="margin-top">6</property> + <property name="margin-bottom">6</property> + <property name="vexpand">True</property> + <property name="row-spacing">6</property> + <property name="column-spacing">6</property> + <child> + <placeholder/> </child> </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> </child> + <child type="tab"> + <object class="GtkLabel" id="lbcolor"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="label" translatable="yes" context="areatabpage|btncolor">Color</property> + </object> + </child> + + <!-- Gradient Tab --> <child> - <object class="GtkToggleButton" id="btngradient"> - <property name="label" translatable="yes" context="areatabpage|btngradient">Gradient</property> + <object class="GtkGrid" id="gdGradient"> <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="receives-default">True</property> - <child internal-child="accessible"> - <object class="AtkObject" id="btngradient-atkobject"> - <property name="AtkObject::accessible-description" translatable="yes" context="areatabpage|extended_tip|btngradient">Fills the object with a gradient selected on this page.</property> - </object> + <property name="can-focus">False</property> + <property name="margin-start">6</property> + <property name="margin-end">6</property> + <property name="margin-top">6</property> + <property name="margin-bottom">6</property> + <property name="vexpand">True</property> + <property name="row-spacing">6</property> + <property name="column-spacing">6</property> + <child> + <placeholder/> </child> </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">3</property> - </packing> </child> + <child type="tab"> + <object class="GtkLabel" id="lbgradient"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="label" translatable="yes" context="areatabpage|btngradient">Gradient</property> + </object> + </child> + + <!-- Hatch Tab --> <child> - <object class="GtkToggleButton" id="btnbitmap"> - <property name="label" translatable="yes" context="areatabpage|btnbitmap">Image</property> + <object class="GtkGrid" id="gdHatch"> <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="receives-default">True</property> - <child internal-child="accessible"> - <object class="AtkObject" id="btnbitmap-atkobject"> - <property name="AtkObject::accessible-description" translatable="yes" context="areatabpage|extended_tip|btnbitmap">Fills the object with a bitmap image selected on this page.</property> - </object> + <property name="can-focus">False</property> + <property name="margin-start">6</property> + <property name="margin-end">6</property> + <property name="margin-top">6</property> + <property name="margin-bottom">6</property> + <property name="vexpand">True</property> + <property name="row-spacing">6</property> + <property name="column-spacing">6</property> + <child> + <placeholder/> </child> </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">4</property> - </packing> </child> + <child type="tab"> + <object class="GtkLabel" id="lbhatch"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="label" translatable="yes" context="areatabpage|btnhatch">Hatch</property> + </object> + </child> + + <!-- Bitmap/Image Tab --> <child> - <object class="GtkToggleButton" id="btnpattern"> - <property name="label" translatable="yes" context="areatabpage|btnpattern">Pattern</property> + <object class="GtkGrid" id="gdBitmap"> <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="receives-default">True</property> - <child internal-child="accessible"> - <object class="AtkObject" id="btnpattern-atkobject"> - <property name="AtkObject::accessible-description" translatable="yes" context="areatabpage|extended_tip|btnpattern">Fills the object with a dot pattern selected on this page.</property> - </object> + <property name="can-focus">False</property> + <property name="margin-start">6</property> + <property name="margin-end">6</property> + <property name="margin-top">6</property> + <property name="margin-bottom">6</property> + <property name="vexpand">True</property> + <property name="row-spacing">6</property> + <property name="column-spacing">6</property> + <child> + <placeholder/> </child> </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">5</property> - </packing> </child> + <child type="tab"> + <object class="GtkLabel" id="lbbitmap"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="label" translatable="yes" context="areatabpage|btnbitmap">Image</property> + </object> + </child> + + <!-- Pattern Tab --> <child> - <object class="GtkToggleButton" id="btnhatch"> - <property name="label" translatable="yes" context="areatabpage|btnhatch">Hatch</property> + <object class="GtkGrid" id="gdPattern"> <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="receives-default">True</property> - <child internal-child="accessible"> - <object class="AtkObject" id="btnhatch-atkobject"> - <property name="AtkObject::accessible-description" translatable="yes" context="areatabpage|extended_tip|btnhatch">Fills the object with a hatching pattern selected on this page.</property> - </object> + <property name="can-focus">False</property> + <property name="margin-start">6</property> + <property name="margin-end">6</property> + <property name="margin-top">6</property> + <property name="margin-bottom">6</property> + <property name="vexpand">True</property> + <property name="row-spacing">6</property> + <property name="column-spacing">6</property> + <child> + <placeholder/> </child> </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">6</property> - </packing> </child> + <child type="tab"> + <object class="GtkLabel" id="lbpattern"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="label" translatable="yes" context="areatabpage|btnpattern">Pattern</property> + </object> + </child> + + <!-- Use Background Tab --> <child> - <object class="GtkToggleButton" id="btnusebackground"> - <property name="label" translatable="yes" context="areatabpage|btnusebackground">Use Background</property> + <object class="GtkGrid" id="gdUseBackground"> <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="receives-default">True</property> - <child internal-child="accessible"> - <object class="AtkObject" id="btnusebackground-atkobject"> - <property name="AtkObject::accessible-description" translatable="yes" context="areatabpage|extended_tip|btnusebackground">Displays the underlying slide background.</property> - </object> + <property name="can-focus">False</property> + <property name="margin-start">6</property> + <property name="margin-end">6</property> + <property name="margin-top">6</property> + <property name="margin-bottom">6</property> + <property name="vexpand">True</property> + <property name="row-spacing">6</property> + <property name="column-spacing">6</property> + <child> + <placeholder/> </child> </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">7</property> - </packing> </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkSeparator" id="separator1"> - <property name="visible">True</property> - <property name="can-focus">False</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkBox" id="fillstylebox"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> - <property name="orientation">vertical</property> - <child> - <placeholder/> + <child type="tab"> + <object class="GtkLabel" id="lbusebackground"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="label" translatable="yes" context="areatabpage|btnusebackground">Use Background</property> + </object> </child> </object> <packing> <property name="expand">True</property> <property name="fill">True</property> - <property name="position">2</property> + <property name="position">1</property> </packing> </child> </object> diff --git a/sc/qa/uitest/calc_tests/cellBackgroundColorSelector.py b/sc/qa/uitest/calc_tests/cellBackgroundColorSelector.py index 550c180023e1..37d8c975072c 100644 --- a/sc/qa/uitest/calc_tests/cellBackgroundColorSelector.py +++ b/sc/qa/uitest/calc_tests/cellBackgroundColorSelector.py @@ -27,8 +27,8 @@ class CalcCellBackgroundColorSelector(UITestCase): xTabs = xDialog.getChild("tabcontrol") select_pos(xTabs, "6") #tab Numbers # click on color btn - xbtncolor = xDialog.getChild("btncolor") - xbtncolor.executeAction("CLICK",tuple()) + xFillTypeTabs = xDialog.getChild("nbFillType") + select_pos(xFillTypeTabs, "1") xpaletteselector = xDialog.getChild("paletteselector") # Now we have the ColorPage that we can get the color selector from it @@ -152,8 +152,8 @@ class CalcCellBackgroundColorSelector(UITestCase): xTabs = xDialog.getChild("tabcontrol") select_pos(xTabs, "6") #tab Numbers # click on color btn - xbtncolor = xDialog.getChild("btncolor") - xbtncolor.executeAction("CLICK",tuple()) + xFillTypeTabs = xDialog.getChild("nbFillType") + select_pos(xFillTypeTabs, "1") # we will select color for cell A5 to be able to predict the latest color in # recent color selector @@ -166,11 +166,7 @@ class CalcCellBackgroundColorSelector(UITestCase): # Select Color with id 1 color_element2 = color_selector.getChild("1") color_element2.executeAction("SELECT", mkPropertyValues({})) - print("Available properties:", list(get_state_as_dict(color_selector).keys())) recent_state = get_state_as_dict(color_selector) - print("Parth see the following:") - for key, value in recent_state.items(): - print(f"{key}: {value}") self.assertEqual(get_state_as_dict(color_selector)["SelectedItemId"], "1") self.assertEqual(get_state_as_dict(color_selector)["SelectedItemPos"], "1") self.assertEqual(get_state_as_dict(color_selector)["VisibleCount"], "12") @@ -185,8 +181,8 @@ class CalcCellBackgroundColorSelector(UITestCase): xTabs = xDialog.getChild("tabcontrol") select_pos(xTabs, "6") #tab Numbers # click on color btn - xbtncolor = xDialog.getChild("btncolor") - xbtncolor.executeAction("CLICK",tuple()) + xFillTypeTabs = xDialog.getChild("nbFillType") + select_pos(xFillTypeTabs, "1") xColorpage = xDialog.getChild("ColorPage") recent_color_selector = xColorpage.getChild("iconview_recent_colors") diff --git a/sc/qa/uitest/chart/chartArea.py b/sc/qa/uitest/chart/chartArea.py index 520ab8e83a2d..7cfe4256c949 100644 --- a/sc/qa/uitest/chart/chartArea.py +++ b/sc/qa/uitest/chart/chartArea.py @@ -70,8 +70,8 @@ class chartArea(UITestCase): tabcontrol = xDialog.getChild("tabcontrol") select_pos(tabcontrol, "1") - btncolor = xDialog.getChild("btncolor") - btncolor.executeAction("CLICK", tuple()) + xFillTypeTabs = xDialog.getChild("nbFillType") + select_pos(xFillTypeTabs, "1") rCustom = xDialog.getChild("R_custom") gCustom = xDialog.getChild("G_custom") diff --git a/sc/qa/uitest/chart/chartWall.py b/sc/qa/uitest/chart/chartWall.py index 8afacc0c54ba..f0fe37829149 100644 --- a/sc/qa/uitest/chart/chartWall.py +++ b/sc/qa/uitest/chart/chartWall.py @@ -75,8 +75,8 @@ class chartWall(UITestCase): tabcontrol = xDialog.getChild("tabcontrol") select_pos(tabcontrol, "1") - btncolor = xDialog.getChild("btncolor") - btncolor.executeAction("CLICK", tuple()) + xFillTypeTabs = xDialog.getChild("nbFillType") + select_pos(xFillTypeTabs, "1") rCustom = xDialog.getChild("R_custom") gCustom = xDialog.getChild("G_custom") diff --git a/sd/qa/uitest/impress_tests/tdf134734.py b/sd/qa/uitest/impress_tests/tdf134734.py index cd8f9c8d5dd6..a29622fdcf20 100644 --- a/sd/qa/uitest/impress_tests/tdf134734.py +++ b/sd/qa/uitest/impress_tests/tdf134734.py @@ -39,8 +39,8 @@ class TestClass(UITestCase): spinMargBot.executeAction("UP",tuple()) xTabs = DrawPageDialog.getChild("tabcontrol") select_pos(xTabs, "1") - btncolor = DrawPageDialog.getChild("btncolor") - btncolor.executeAction("CLICK",tuple()) + xFillTypeTabs = DrawPageDialog.getChild("nbFillType") + select_pos(xFillTypeTabs, "1") self.assertEqual(document.DrawPages[0].Background.FillStyle, SOLID) self.assertEqual(document.DrawPages[0].BorderLeft, 1016) diff --git a/sd/qa/uitest/impress_tests/tdf137729.py b/sd/qa/uitest/impress_tests/tdf137729.py index 80175b66ab22..2fbf3450b61e 100644 --- a/sd/qa/uitest/impress_tests/tdf137729.py +++ b/sd/qa/uitest/impress_tests/tdf137729.py @@ -26,8 +26,8 @@ class tdf137729(UITestCase): tabcontrol = xPageSetupDlg.getChild("tabcontrol") select_pos(tabcontrol, "1") - xBtn = xPageSetupDlg.getChild('btnhatch') - xBtn.executeAction("CLICK", tuple()) + xFillTypeTabs = xPageSetupDlg.getChild("nbFillType") + select_pos(xFillTypeTabs, "3") xDistance = xPageSetupDlg.getChild('distancemtr') xDistance.executeAction("UP", tuple()) diff --git a/sd/qa/uitest/impress_tests/tdf152295.py b/sd/qa/uitest/impress_tests/tdf152295.py index 87836ede5172..752095285ef5 100644 --- a/sd/qa/uitest/impress_tests/tdf152295.py +++ b/sd/qa/uitest/impress_tests/tdf152295.py @@ -22,28 +22,28 @@ class tdf152295(UITestCase): with self.ui_test.execute_dialog_through_command(".uno:PageSetup") as DrawPageDialog: xTabs = DrawPageDialog.getChild("tabcontrol") select_pos(xTabs, "1") - btnbitmap = DrawPageDialog.getChild("btnbitmap") - btnbitmap.executeAction("CLICK",tuple()) - width = DrawPageDialog.getChild("width") + xFillTypeTabs = DrawPageDialog.getChild("nbFillType") + select_pos(xFillTypeTabs, "4") + width = xFillTypeTabs.getChild("width") for _ in range(50): width.executeAction("UP",tuple()) - height = DrawPageDialog.getChild("height") + height = xFillTypeTabs.getChild("height") for _ in range(50): height.executeAction("UP",tuple()) with self.ui_test.execute_dialog_through_command(".uno:PageSetup") as DrawPageDialog: xTabs = DrawPageDialog.getChild("tabcontrol") select_pos(xTabs, "1") - btnbitmap = DrawPageDialog.getChild("btnbitmap") - btnbitmap.executeAction("CLICK",tuple()) + xFillTypeTabs = DrawPageDialog.getChild("nbFillType") + select_pos(xFillTypeTabs, "4") with self.ui_test.execute_dialog_through_command(".uno:PageSetup") as DrawPageDialog: xTabs = DrawPageDialog.getChild("tabcontrol") select_pos(xTabs, "1") - btnbitmap = DrawPageDialog.getChild("btnbitmap") - btnbitmap.executeAction("CLICK",tuple()) - width = DrawPageDialog.getChild("width") - height = DrawPageDialog.getChild("height") + xFillTypeTabs = DrawPageDialog.getChild("nbFillType") + select_pos(xFillTypeTabs, "4") + width = xFillTypeTabs.getChild("width") + height = xFillTypeTabs.getChild("height") # Without the fix in place, this test would have failed with # AssertionError: '6.00 cm' != '13.55 cm' diff --git a/sd/qa/uitest/impress_tests2/tdf125449.py b/sd/qa/uitest/impress_tests2/tdf125449.py index 59acced973f9..029db09dab1a 100644 --- a/sd/qa/uitest/impress_tests2/tdf125449.py +++ b/sd/qa/uitest/impress_tests2/tdf125449.py @@ -26,8 +26,8 @@ class tdf125449(UITestCase): tabcontrol = xPageSetupDlg.getChild("tabcontrol") select_pos(tabcontrol, "1") - xBtn = xPageSetupDlg.getChild('btngradient') - xBtn.executeAction("CLICK", tuple()) + xFillTypeTabs = xPageSetupDlg.getChild("nbFillType") + select_pos(xFillTypeTabs, "2") xAngle = xPageSetupDlg.getChild('anglemtr') xAngle.executeAction("UP", tuple()) diff --git a/sd/qa/uitest/impress_tests2/tdf149787.py b/sd/qa/uitest/impress_tests2/tdf149787.py index 3d65f1c0bb87..94d3b8af41dc 100644 --- a/sd/qa/uitest/impress_tests2/tdf149787.py +++ b/sd/qa/uitest/impress_tests2/tdf149787.py @@ -28,8 +28,8 @@ class TestTdf149787(UITestCase): with self.ui_test.execute_dialog_through_command(".uno:FormatArea", close_button="cancel") as xDialog: tabControl = xDialog.getChild("tabcontrol") select_pos(tabControl, "0") - btnColor = xDialog.getChild("btncolor") - btnColor.executeAction("CLICK", tuple()) + xFillTypeTabs = xDialog.getChild("nbFillType") + select_pos(xFillTypeTabs, "1") btnMoreColors = xDialog.getChild("btnMoreColors") with self.ui_test.execute_blocking_action(btnMoreColors.executeAction, args=('CLICK', ()), close_button="buttonClose") as dialog: diff --git a/sw/qa/uitest/table/tableProperties.py b/sw/qa/uitest/table/tableProperties.py index 1549dfec63c7..a45ffd3408f4 100644 --- a/sw/qa/uitest/table/tableProperties.py +++ b/sw/qa/uitest/table/tableProperties.py @@ -160,8 +160,8 @@ class tableProperties(UITestCase): tabcontrol = xDialog.getChild("tabcontrol") select_pos(tabcontrol, "4") - btncolor = xDialog.getChild("btncolor") - btncolor.executeAction("CLICK", tuple()) + xFillTypeTabs = xDialog.getChild("nbFillType") + select_pos(xFillTypeTabs, "1") R_custom = xDialog.getChild("R_custom") G_custom = xDialog.getChild("G_custom") B_custom = xDialog.getChild("B_custom") @@ -181,8 +181,8 @@ class tableProperties(UITestCase): with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: tabcontrol = xDialog.getChild("tabcontrol") select_pos(tabcontrol, "4") - btncolor = xDialog.getChild("btncolor") - btncolor.executeAction("CLICK", tuple()) + xFillTypeTabs = xDialog.getChild("nbFillType") + select_pos(xFillTypeTabs, "1") R_custom = xDialog.getChild("R_custom") G_custom = xDialog.getChild("G_custom") B_custom = xDialog.getChild("B_custom") diff --git a/sw/qa/uitest/table/tdf109083.py b/sw/qa/uitest/table/tdf109083.py index d369ee8a53d3..f71226ae1a93 100644 --- a/sw/qa/uitest/table/tdf109083.py +++ b/sw/qa/uitest/table/tdf109083.py @@ -50,8 +50,8 @@ class tdf109083(UITestCase): with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: xTabs = xDialog.getChild("tabcontrol") select_pos(xTabs, "4") #tab Background - btncolor = xDialog.getChild("btncolor") - btncolor.executeAction("CLICK", tuple()) + xFillTypeTabs = xDialog.getChild("nbFillType") + select_pos(xFillTypeTabs, "1") hex_custom = xDialog.getChild("hex_custom") if i >= 2: self.assertEqual(get_state_as_dict(hex_custom)["Text"], "ffff00") diff --git a/sw/qa/uitest/table/tdf116737.py b/sw/qa/uitest/table/tdf116737.py index 0002b4bc616e..bad78f9a67ec 100644 --- a/sw/qa/uitest/table/tdf116737.py +++ b/sw/qa/uitest/table/tdf116737.py @@ -30,8 +30,8 @@ class tdf116737(UITestCase): xTabs = xDialog.getChild("tabcontrol") select_pos(xTabs, "4") #tab Background - btncolor = xDialog.getChild("btncolor") - btncolor.executeAction("CLICK", tuple()) + xFillTypeTabs = xDialog.getChild("nbFillType") + select_pos(xFillTypeTabs, "1") R_custom = xDialog.getChild("R_custom") G_custom = xDialog.getChild("G_custom") diff --git a/sw/qa/uitest/table/tdf144843.py b/sw/qa/uitest/table/tdf144843.py index 1920cda02700..281c9461e8df 100644 --- a/sw/qa/uitest/table/tdf144843.py +++ b/sw/qa/uitest/table/tdf144843.py @@ -9,6 +9,7 @@ from uitest.framework import UITestCase from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import select_pos class tdf144843(UITestCase): @@ -23,8 +24,8 @@ class tdf144843(UITestCase): # Without the fix in place, this test would have crashed here with self.ui_test.execute_dialog_through_command(".uno:BackgroundDialog") as xDialog: - btncolor = xDialog.getChild("btncolor") - btncolor.executeAction("CLICK", tuple()) + xFillTypeTabs = xDialog.getChild("nbFillType") + select_pos(xFillTypeTabs, "1") hex_custom = xDialog.getChild("hex_custom") hex_custom.executeAction("TYPE", mkPropertyValues({"TEXT":"101010"})) diff --git a/sw/qa/uitest/writer_tests/tdf134734.py b/sw/qa/uitest/writer_tests/tdf134734.py index 44edf6c1af5c..2a692d82842d 100644 --- a/sw/qa/uitest/writer_tests/tdf134734.py +++ b/sw/qa/uitest/writer_tests/tdf134734.py @@ -35,8 +35,8 @@ class TestClass(UITestCase): spinMargBot.executeAction("UP",tuple()) xTabs = DrawPageDialog.getChild("tabcontrol") select_pos(xTabs, "2") - btncolor = DrawPageDialog.getChild("btncolor") - btncolor.executeAction("CLICK",tuple()) + xFillTypeTabs = DrawPageDialog.getChild("nbFillType") + select_pos(xFillTypeTabs, "1") xStyle = document.StyleFamilies["PageStyles"]["Standard"] diff --git a/sw/qa/uitest/writer_tests2/formatParagraph.py b/sw/qa/uitest/writer_tests2/formatParagraph.py index bfa6eff48dc9..885f5cc5fe92 100644 --- a/sw/qa/uitest/writer_tests2/formatParagraph.py +++ b/sw/qa/uitest/writer_tests2/formatParagraph.py @@ -451,17 +451,13 @@ class formatParagraph(UITestCase): xTabs = xDialog.getChild("tabcontrol") select_pos(xTabs, "8") - xColor = xDialog.getChild("btncolor") - xGradient = xDialog.getChild("btngradient") - xBitmap = xDialog.getChild("btnbitmap") - xPattern = xDialog.getChild("btnpattern") - xHatch = xDialog.getChild("btnhatch") + xFillTypeTabs = xDialog.getChild("nbFillType") - xColor.executeAction("CLICK", tuple()) - xGradient.executeAction("CLICK", tuple()) - xBitmap.executeAction("CLICK", tuple()) - xPattern.executeAction("CLICK", tuple()) - xHatch.executeAction("CLICK", tuple()) + select_pos(xFillTypeTabs, "1") + select_pos(xFillTypeTabs, "2") + select_pos(xFillTypeTabs, "3") + select_pos(xFillTypeTabs, "4") + select_pos(xFillTypeTabs, "5") def test_format_paragraph_transparency(self): with self.ui_test.create_doc_in_start_center("writer"): diff --git a/sw/qa/uitest/writer_tests3/pageDialog.py b/sw/qa/uitest/writer_tests3/pageDialog.py index 7e95e08d8570..06f8e5acff2c 100644 --- a/sw/qa/uitest/writer_tests3/pageDialog.py +++ b/sw/qa/uitest/writer_tests3/pageDialog.py @@ -22,19 +22,23 @@ class WriterPageDialog(UITestCase): xButton = dialog.getChild(button) xButton.executeAction("CLICK", tuple()) - def check_default_area(self, btn): + def click_tab(self, dialog, index): + xFillTypeTabs = dialog.getChild("nbFillType") + select_pos(xFillTypeTabs, index) + + def check_default_area(self, tab): document = self.ui_test.get_component() - if btn == 'btnnone': + if tab == 'lbnone': self.assertEqual( document.StyleFamilies.PageStyles.Standard.BackColor, -1) - elif btn == 'btncolor': + elif tab == 'lbcolor': self.assertEqual( hex(document.StyleFamilies.PageStyles.Standard.BackColor), '0x729fcf') self.assertEqual( hex(document.StyleFamilies.PageStyles.Standard.FillColor), '0x729fcf') self.assertEqual( hex(document.StyleFamilies.PageStyles.Standard.FillColor), '0x729fcf') - elif btn == 'btngradient': + elif tab == 'lbgradient': self.assertEqual( document.StyleFamilies.PageStyles.Standard.FillGradient.Style, LINEAR) self.assertEqual( @@ -53,7 +57,7 @@ class WriterPageDialog(UITestCase): document.StyleFamilies.PageStyles.Standard.FillGradient.EndIntensity, 100) self.assertEqual( document.StyleFamilies.PageStyles.Standard.FillGradientName, 'Pastel Bouquet') - elif btn == 'btnhatch': + elif tab == 'lbhatch': self.assertEqual( document.StyleFamilies.PageStyles.Standard.FillHatch.Style, SINGLE ) self.assertEqual( @@ -64,7 +68,7 @@ class WriterPageDialog(UITestCase): document.StyleFamilies.PageStyles.Standard.FillHatch.Angle, 0) self.assertEqual( document.StyleFamilies.PageStyles.Standard.FillHatchName, 'Black 0 Degrees') - elif btn == 'btnbitmap': + elif tab == 'lbbitmap': self.assertEqual( document.StyleFamilies.PageStyles.Standard.FillBitmapMode, REPEAT) self.assertEqual( @@ -89,7 +93,7 @@ class WriterPageDialog(UITestCase): document.StyleFamilies.PageStyles.Standard.FillBitmapSizeY, 1000) self.assertEqual( document.StyleFamilies.PageStyles.Standard.FillBitmapName, 'Painted White') - elif btn == 'btnpattern': + elif tab == 'lbpattern': self.assertEqual( document.StyleFamilies.PageStyles.Standard.FillBitmapMode, REPEAT) self.assertEqual( @@ -121,23 +125,29 @@ class WriterPageDialog(UITestCase): with change_measurement_unit(self, "Centimeter"): - buttons = ['btnbitmap', 'btncolor', 'btngradient', 'btnhatch', 'btnpattern'] - for index, button in enumerate(buttons): + tab_mapping = { + 'lbbitmap' : "4", + 'lbcolor' : "1", + 'lbgradient' : "2", + 'lbhatch' : "3", + 'lbpattern' : "5" + } + for tab, index in tab_mapping.items(): with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog: tabcontrol = xDialog.getChild("tabcontrol") select_pos(tabcontrol, "2") - self.click_button(xDialog, button) + self.click_tab(xDialog, index) - self.check_default_area(button) + self.check_default_area(tab) with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog: tabcontrol = xDialog.getChild("tabcontrol") select_pos(tabcontrol, "2") - self.click_button(xDialog, 'btnnone') + self.click_tab(xDialog, "0") - self.check_default_area('btnnone') + self.check_default_area('lbnone') def test_paper_format(self): diff --git a/sw/qa/uitest/writer_tests5/tdf122045.py b/sw/qa/uitest/writer_tests5/tdf122045.py index a43c6b378cb7..848a099427df 100644 --- a/sw/qa/uitest/writer_tests5/tdf122045.py +++ b/sw/qa/uitest/writer_tests5/tdf122045.py @@ -21,8 +21,8 @@ class tdf122045(UITestCase): xTabs = xDialog.getChild("tabcontrol") select_pos(xTabs, "2") - btncolor = xDialog.getChild("btncolor") - btncolor.executeAction("CLICK", tuple()) + xFillTypeTabs = xDialog.getChild("nbFillType") + select_pos(xFillTypeTabs, "1") xApplyBtn = xDialog.getChild("apply") xApplyBtn.executeAction("CLICK", tuple()) diff --git a/uitest/impress_tests/backgrounds.py b/uitest/impress_tests/backgrounds.py index 1bfeab320ecc..4320410407df 100644 --- a/uitest/impress_tests/backgrounds.py +++ b/uitest/impress_tests/backgrounds.py @@ -16,16 +16,16 @@ from com.sun.star.drawing.RectanglePoint import MIDDLE_MIDDLE class ImpressBackgrounds(UITestCase): - def checkDefaultBackground(self, btn): + def checkDefaultBackground(self, tab): document = self.ui_test.get_component() - if btn == 'btnnone': + if tab == 'lbnone': self.assertEqual(document.DrawPages[0].Background, None) - elif btn == 'btncolor': + elif tab == 'lbcolor': self.assertEqual( hex(document.DrawPages[0].Background.FillColor), '0x729fcf') self.assertEqual( hex(document.DrawPages[0].Background.FillColor), '0x729fcf') - elif btn == 'btngradient': + elif tab == 'lbgradient': self.assertEqual( document.DrawPages[0].Background.FillGradient.Style, LINEAR) self.assertEqual( @@ -44,7 +44,7 @@ class ImpressBackgrounds(UITestCase): document.DrawPages[0].Background.FillGradient.EndIntensity, 100) self.assertEqual( document.DrawPages[0].Background.FillGradientName, 'Pastel Bouquet') - elif btn == 'btnhatch': + elif tab == 'lbhatch': self.assertEqual( document.DrawPages[0].Background.FillHatch.Style, SINGLE ) self.assertEqual( @@ -55,7 +55,7 @@ class ImpressBackgrounds(UITestCase): document.DrawPages[0].Background.FillHatch.Angle, 0) self.assertEqual( document.DrawPages[0].Background.FillHatchName, 'Black 0 Degrees') - elif btn == 'btnbitmap': + elif tab == 'lbbitmap': self.assertEqual( document.DrawPages[0].Background.FillBitmapMode, REPEAT) self.assertEqual( @@ -79,7 +79,7 @@ class ImpressBackgrounds(UITestCase): self.assertEqual( document.DrawPages[0].Background.FillBitmapSizeY, 2540) self.assertEqual(document.DrawPages[0].Background.FillBitmapName, 'Painted White') - elif btn == 'btnpattern': + elif tab == 'lbpattern': self.assertEqual( document.DrawPages[0].Background.FillBitmapMode, REPEAT) self.assertEqual( @@ -114,31 +114,37 @@ class ImpressBackgrounds(UITestCase): xCancelBtn = xTemplateDlg.getChild("close") self.ui_test.close_dialog_through_button(xCancelBtn) - buttons = ['btnbitmap', 'btncolor', 'btngradient', 'btnhatch', 'btnpattern'] - for index, button in enumerate(buttons): + tab_mapping = { + 'lbbitmap' : "4", + 'lbcolor' : "1", + 'lbgradient' : "2", + 'lbhatch' : "3", + 'lbpattern' : "5" + } + for tab, index in tab_mapping.items(): with self.ui_test.execute_dialog_through_command(".uno:PageSetup") as xPageSetupDlg: tabcontrol = xPageSetupDlg.getChild("tabcontrol") select_pos(tabcontrol, "1") - xBtn = xPageSetupDlg.getChild(button) - xBtn.executeAction("CLICK", tuple()) + xFillTypeTabs = xPageSetupDlg.getChild("nbFillType") + select_pos(xFillTypeTabs, index) # tdf#100024: Without the fix in place, this test would have crashed here # changing the background to bitmap - self.checkDefaultBackground(button) + self.checkDefaultBackground(tab) with self.ui_test.execute_dialog_through_command(".uno:PageSetup") as xPageSetupDlg: tabcontrol = xPageSetupDlg.getChild("tabcontrol") select_pos(tabcontrol, "1") - xBtn = xPageSetupDlg.getChild('btnnone') - xBtn.executeAction("CLICK", tuple()) + xFillTypeTabs = xPageSetupDlg.getChild("nbFillType") + select_pos(xFillTypeTabs, "0") - self.checkDefaultBackground('btnnone') + self.checkDefaultBackground('lbnone') # vim: set shiftwidth=4 softtabstop=4 expandtab:
