include/sfx2/newstyle.hxx | 6 +++--- sc/source/ui/view/formatsh.cxx | 2 +- sfx2/source/dialog/newstyle.cxx | 10 ++++++---- sfx2/source/dialog/templdlg.cxx | 2 +- sw/source/uibase/app/docst.cxx | 3 ++- 5 files changed, 13 insertions(+), 10 deletions(-)
New commits: commit 224c155d89e4d957c0d566a5aea6004a466d54e9 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sun May 3 20:49:54 2020 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Mon May 4 17:47:49 2020 +0200 make Search family and mask explicit for SfxNewStyleDlg Change-Id: Ib3e5765d37474188d6505f1d9965969ee6c24f0c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93358 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/include/sfx2/newstyle.hxx b/include/sfx2/newstyle.hxx index e7016b55386e..c61685d87fae 100644 --- a/include/sfx2/newstyle.hxx +++ b/include/sfx2/newstyle.hxx @@ -22,14 +22,14 @@ #include <comphelper/string.hxx> #include <sal/config.h> #include <sfx2/dllapi.h> +#include <svl/style.hxx> #include <vcl/weld.hxx> -class SfxStyleSheetBasePool; - class SFX2_DLLPUBLIC SfxNewStyleDlg final : public weld::GenericDialogController { private: SfxStyleSheetBasePool& m_rPool; + SfxStyleFamily m_eSearchFamily; std::unique_ptr<weld::EntryTreeView> m_xColBox; std::unique_ptr<weld::Button> m_xOKBtn; @@ -41,7 +41,7 @@ private: DECL_DLLPRIVATE_LINK(ModifyHdl, weld::ComboBox&, void); public: - SfxNewStyleDlg(weld::Window* pParent, SfxStyleSheetBasePool&); + SfxNewStyleDlg(weld::Window* pParent, SfxStyleSheetBasePool& rPool, SfxStyleFamily eFam, SfxStyleSearchBits nMask); virtual ~SfxNewStyleDlg() override; OUString GetName() const { return comphelper::string::stripStart(m_xColBox->get_active_text(), ' '); } diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index 4c6cda17ac60..7b5ae956bb2b 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -433,7 +433,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) weld::Window* pDialogParent = rReq.GetFrameWeld(); if (!pDialogParent) pDialogParent = pTabViewShell->GetFrameWeld(); - SfxNewStyleDlg aDlg(pDialogParent, *pStylePool); + SfxNewStyleDlg aDlg(pDialogParent, *pStylePool, eFamily, SfxStyleSearchBits::All); if (aDlg.run() != RET_OK) return; aStyleName = aDlg.GetName(); diff --git a/sfx2/source/dialog/newstyle.cxx b/sfx2/source/dialog/newstyle.cxx index ed7a20f70d63..288fc39c1244 100644 --- a/sfx2/source/dialog/newstyle.cxx +++ b/sfx2/source/dialog/newstyle.cxx @@ -30,7 +30,7 @@ IMPL_LINK_NOARG(SfxNewStyleDlg, OKClickHdl, weld::Button&, void) { const OUString aName(m_xColBox->get_active_text()); - SfxStyleSheetBase* pStyle = m_rPool.Find(aName, m_rPool.GetSearchFamily()); + SfxStyleSheetBase* pStyle = m_rPool.Find(aName, m_eSearchFamily); if ( pStyle ) { if ( !pStyle->IsUserDefined() ) @@ -60,9 +60,10 @@ IMPL_LINK(SfxNewStyleDlg, ModifyHdl, weld::ComboBox&, rBox, void) m_xOKBtn->set_sensitive(!rBox.get_active_text().replaceAll(" ", "").isEmpty()); } -SfxNewStyleDlg::SfxNewStyleDlg(weld::Window* pParent, SfxStyleSheetBasePool& rInPool) +SfxNewStyleDlg::SfxNewStyleDlg(weld::Window* pParent, SfxStyleSheetBasePool& rInPool, SfxStyleFamily eFam, SfxStyleSearchBits nMask) : GenericDialogController(pParent, "sfx/ui/newstyle.ui", "CreateStyleDialog") , m_rPool(rInPool) + , m_eSearchFamily(eFam) , m_xColBox(m_xBuilder->weld_entry_tree_view("stylegrid", "stylename", "styles")) , m_xOKBtn(m_xBuilder->weld_button("ok")) , m_xQueryOverwriteBox(Application::CreateMessageDialog(m_xDialog.get(), VclMessageType::Question, VclButtonsType::YesNo, @@ -75,11 +76,12 @@ SfxNewStyleDlg::SfxNewStyleDlg(weld::Window* pParent, SfxStyleSheetBasePool& rIn m_xColBox->connect_changed(LINK(this, SfxNewStyleDlg, ModifyHdl)); m_xColBox->connect_row_activated(LINK(this, SfxNewStyleDlg, OKHdl)); - SfxStyleSheetBase *pStyle = m_rPool.First(); + auto xIter = m_rPool.CreateIterator(eFam, nMask); + SfxStyleSheetBase *pStyle = xIter->First(); while (pStyle) { m_xColBox->append_text(pStyle->GetName()); - pStyle = m_rPool.Next(); + pStyle = xIter->Next(); } } diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index 9fe35922cd39..6cfc649abf44 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -1621,7 +1621,7 @@ void SfxCommonTemplateDialog_Impl::ActionSelect(const OString& rEntry) pStyleSheetPool->SetSearchMask( eFam, SfxStyleSearchBits::UserDefined ); // why? : FloatingWindow must not be parent of a modal dialog - SfxNewStyleDlg aDlg(pWindow ? pWindow->GetFrameWeld() : nullptr, *pStyleSheetPool); + SfxNewStyleDlg aDlg(pWindow ? pWindow->GetFrameWeld() : nullptr, *pStyleSheetPool, eFam, SfxStyleSearchBits::UserDefined); if (aDlg.run() == RET_OK) { pStyleSheetPool->SetSearchMask(eFam, nFilter); diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index 72aaf1e8f918..9b7d70ae15c7 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/uibase/app/docst.cxx @@ -372,7 +372,8 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq ) { case SID_STYLE_NEW_BY_EXAMPLE: { - SfxNewStyleDlg aDlg(GetView()->GetFrameWeld(), *GetStyleSheetPool()); + SfxStyleSheetBasePool& rPool = *GetStyleSheetPool(); + SfxNewStyleDlg aDlg(GetView()->GetFrameWeld(), rPool, rPool.GetSearchFamily(), rPool.GetSearchMask()); if (aDlg.run() == RET_OK) { aParam = aDlg.GetName(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits