[Libreoffice-commits] core.git: include/sfx2 include/vcl sfx2/source vcl/source vcl/unx
include/sfx2/weldutils.hxx|4 ++ include/vcl/weld.hxx |1 sfx2/source/toolbox/weldutils.cxx | 52 +- vcl/source/app/salvtables.cxx | 22 vcl/unx/gtk3/gtk3gtkinst.cxx | 23 5 files changed, 101 insertions(+), 1 deletion(-) New commits: commit ac748be2f0a3d5ba965eb8a3ace0b526a65a48cb Author: Caolán McNamara AuthorDate: Thu Jan 16 10:47:37 2020 + Commit: Caolán McNamara CommitDate: Thu Jan 16 15:19:24 2020 +0100 use sidebar icon size setting for welded toolboxes in sidebars Change-Id: Ie582a76e87126effca9260b58d8a8bef51c147ae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86908 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/include/sfx2/weldutils.hxx b/include/sfx2/weldutils.hxx index 2486ca97307e..8c577f9a1651 100644 --- a/include/sfx2/weldutils.hxx +++ b/include/sfx2/weldutils.hxx @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -30,12 +31,15 @@ class SFX2_DLLPUBLIC ToolbarUnoDispatcher { private: css::uno::Reference m_xFrame; +SvtMiscOptions m_aToolbarOptions; weld::Toolbar* m_pToolbar; DECL_LINK(SelectHdl, const OString&, void); DECL_LINK(ToggleMenuHdl, const OString&, void); +DECL_LINK(ChangedIconSizeHandler, LinkParamNone*, void); void CreateController(const OUString& rCommand); +vcl::ImageType GetIconSize() const; typedef std::map> ControllerContainer; diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 6d99c3516589..9890be5d4bc0 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -1995,6 +1995,7 @@ public: virtual void set_item_tooltip_text(int nIndex, const OUString& rTip) = 0; virtual vcl::ImageType get_icon_size() const = 0; +virtual void set_icon_size(vcl::ImageType eType) = 0; void connect_clicked(const Link& rLink) { m_aClickHdl = rLink; } void connect_menu_toggled(const Link& rLink) { m_aToggleMenuHdl = rLink; } diff --git a/sfx2/source/toolbox/weldutils.cxx b/sfx2/source/toolbox/weldutils.cxx index 112f285297c5..327373d45819 100644 --- a/sfx2/source/toolbox/weldutils.cxx +++ b/sfx2/source/toolbox/weldutils.cxx @@ -7,6 +7,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include #include #include #include @@ -52,6 +53,25 @@ bool lcl_RTLizeCommandURL(OUString& rCommandURL) } } +// for now all controllers are in the sidebar +vcl::ImageType ToolbarUnoDispatcher::GetIconSize() const +{ +vcl::ImageType eType = vcl::ImageType::Size16; +switch (m_aToolbarOptions.GetSidebarIconSize()) +{ +case ToolBoxButtonSize::Large: +eType = vcl::ImageType::Size26; +break; +case ToolBoxButtonSize::Size32: +eType = vcl::ImageType::Size32; +break; +case ToolBoxButtonSize::DontCare: +case ToolBoxButtonSize::Small: +break; +} +return eType; +} + ToolbarUnoDispatcher::ToolbarUnoDispatcher(weld::Toolbar& rToolbar, const css::uno::Reference& rFrame) : m_xFrame(rFrame) @@ -61,7 +81,8 @@ ToolbarUnoDispatcher::ToolbarUnoDispatcher(weld::Toolbar& rToolbar, rToolbar.connect_menu_toggled(LINK(this, ToolbarUnoDispatcher, ToggleMenuHdl)); OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(rFrame)); -vcl::ImageType eSize = rToolbar.get_icon_size(); +vcl::ImageType eSize = GetIconSize(); +rToolbar.set_icon_size(eSize); bool bRTL = AllSettings::GetLayoutRTL(); @@ -82,6 +103,8 @@ ToolbarUnoDispatcher::ToolbarUnoDispatcher(weld::Toolbar& rToolbar, CreateController(sCommand); } + +m_aToolbarOptions.AddListenerLink(LINK(this, ToolbarUnoDispatcher, ChangedIconSizeHandler)); } void ToolbarUnoDispatcher::CreateController(const OUString& rCommand) @@ -121,11 +144,38 @@ IMPL_LINK(ToolbarUnoDispatcher, ToggleMenuHdl, const OString&, rCommand, void) xController->click(); } +IMPL_LINK_NOARG(ToolbarUnoDispatcher, ChangedIconSizeHandler, LinkParamNone*, void) +{ +vcl::ImageType eSize = GetIconSize(); +m_pToolbar->set_icon_size(eSize); + +for (int i = 0, nItems = m_pToolbar->get_n_items(); i < nItems; ++i) +{ +OUString sCommand = OUString::fromUtf8(m_pToolbar->get_item_ident(i)); +auto xImage(vcl::CommandInfoProvider::GetXGraphicForCommand(sCommand, m_xFrame, eSize)); +m_pToolbar->set_item_image(i, xImage); +} + +for (auto const& it : maControllers) +{ +css::uno::Reference xController(it.second, + css::uno::UNO_QUERY); +if (xController.is() && xController->opensSubToolbar()) +{ +// The button should show the last function that was selected from the +// dropdown.
[Libreoffice-commits] core.git: include/sfx2 include/vcl sfx2/source vcl/source vcl/unx
include/sfx2/tabdlg.hxx |2 + include/vcl/layout.hxx|8 --- include/vcl/vclenum.hxx |7 ++ include/vcl/weld.hxx |9 sfx2/source/dialog/tabdlg.cxx | 31 vcl/source/app/salvtables.cxx | 26 +++ vcl/unx/gtk3/gtk3gtkinst.cxx | 46 ++ 7 files changed, 121 insertions(+), 8 deletions(-) New commits: commit 574d02a7a81f99d08512410fcd3262b41db8c209 Author: Caolán McNamara Date: Thu Jun 14 12:05:10 2018 +0100 do setPreviewsToSamePlace at SfxTabDialogController display time Change-Id: Ia38c1a577b7d054ab4e7e70a8f2cbce16a3573f5 Reviewed-on: https://gerrit.libreoffice.org/55793 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx index bdae835ffca2..163693d9fe9b 100644 --- a/include/sfx2/tabdlg.hxx +++ b/include/sfx2/tabdlg.hxx @@ -239,6 +239,7 @@ private: std::unique_ptr m_xUserBtn; std::unique_ptr m_xCancelBtn; std::unique_ptr m_xResetBtn; +std::unique_ptr m_xSizeGroup; SfxItemSet* m_pSet; std::unique_ptr m_pOutSet; @@ -250,6 +251,7 @@ private: DECL_DLLPRIVATE_LINK(DeactivatePageHdl, const OString&, bool); SAL_DLLPRIVATE void Init_Impl(bool bFmtFlag); SAL_DLLPRIVATE void CreatePages(); +SAL_DLLPRIVATE void setPreviewsToSamePlace(); protected: virtual short Ok(); diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx index d2fefe01f875..298601da6e8f 100644 --- a/include/vcl/layout.hxx +++ b/include/vcl/layout.hxx @@ -564,14 +564,6 @@ public: virtual void Command(const CommandEvent& rCEvt) override; }; -enum class VclSizeGroupMode -{ -NONE, -Horizontal, -Vertical, -Both -}; - class VCL_DLLPUBLIC VclSizeGroup { private: diff --git a/include/vcl/vclenum.hxx b/include/vcl/vclenum.hxx index 8697465af32d..0de6703f6aba 100644 --- a/include/vcl/vclenum.hxx +++ b/include/vcl/vclenum.hxx @@ -242,6 +242,13 @@ enum class VclMessageType Error }; +enum class VclSizeGroupMode +{ +NONE, +Horizontal, +Vertical, +Both +}; #endif // INCLUDED_VCL_VCLENUM_HXX diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 86718d52a642..d0c5c220f375 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -864,6 +864,14 @@ public: virtual ~Menu() {} }; +class VCL_DLLPUBLIC SizeGroup +{ +public: +virtual void add_widget(weld::Widget* pWidget) = 0; +virtual void set_mode(VclSizeGroupMode eMode) = 0; +virtual ~SizeGroup() {} +}; + class VCL_DLLPUBLIC Builder { private: @@ -914,6 +922,7 @@ public: void* pUserData = nullptr, bool bTakeOwnership = false) = 0; virtual Menu* weld_menu(const OString& id, bool bTakeOwnership = true) = 0; +virtual SizeGroup* create_size_group() = 0; virtual ~Builder() {} }; diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index 5521fe9a0305..48e721c2baf7 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -1957,6 +1957,35 @@ void SfxTabDialogController::CreatePages() } } +void SfxTabDialogController::setPreviewsToSamePlace() +{ +//where tab pages have the same basic layout with a preview on the right, +//get both of their non-preview areas to request the same size so that the +//preview appears in the same place in each one so flipping between tabs +//isn't distracting as it jumps around +std::vector> aGrids; +for (auto pDataObject : m_pImpl->aData) +{ +if (pDataObject->pTabPage) +continue; +if (!pDataObject->pTabPage->m_xBuilder) +continue; +weld::Widget* pGrid = pDataObject->pTabPage->m_xBuilder->weld_widget("maingrid"); +if (!pGrid) +continue; +aGrids.emplace_back(pGrid); +} + +m_xSizeGroup.reset(); + +if (aGrids.size() <= 1) +return; + +m_xSizeGroup.reset(m_xBuilder->create_size_group()); +for (auto& rGrid : aGrids) +m_xSizeGroup->add_widget(rGrid.get()); +} + void SfxTabDialogController::RemoveTabPage(const OString& rId) /* [Description] @@ -2000,6 +2029,8 @@ void SfxTabDialogController::Start_Impl() { CreatePages(); +setPreviewsToSamePlace(); + assert(m_pImpl->aData.size() == static_cast(m_xTabCtrl->get_n_pages()) && "not all pages registered"); diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 00ff6c6a9090..20f957af82d3 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -457,6 +457,27 @@ public: } }; +class SalInstanceSizeGroup : public weld::SizeGroup +{ +private: +std::shared_ptr m_xGroup; +public: +SalInstanceSizeGroup() +: m_xGroup(new VclSizeGroup) +{ +
[Libreoffice-commits] core.git: include/sfx2 include/vcl sfx2/source vcl/source
include/sfx2/tabdlg.hxx |2 ++ include/vcl/tabpage.hxx |2 -- sfx2/source/dialog/tabdlg.cxx |7 +++ vcl/source/window/tabpage.cxx |8 4 files changed, 9 insertions(+), 10 deletions(-) New commits: commit 32a10a772d07fc12e5b1332925b8d53c7ab8e928 Author: Caolán McNamara Date: Mon Apr 23 10:06:24 2018 +0100 move GetConfigId from TabPage to SfxTabPage Change-Id: Id2c687c2270cb1c2419cc6664200292b2740d0a4 Reviewed-on: https://gerrit.libreoffice.org/53325 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx index f171de346dce..e288e07cd8f7 100644 --- a/include/sfx2/tabdlg.hxx +++ b/include/sfx2/tabdlg.hxx @@ -302,6 +302,8 @@ public: void SetFrame(const css::uno::Reference< css::frame::XFrame >& xFrame); css::uno::Reference< css::frame::XFrame > GetFrame(); + +OString GetConfigId() const; }; #endif diff --git a/include/vcl/tabpage.hxx b/include/vcl/tabpage.hxx index a837ee2761e4..3845da4fffed 100644 --- a/include/vcl/tabpage.hxx +++ b/include/vcl/tabpage.hxx @@ -52,8 +52,6 @@ public: virtual voidActivatePage(); virtual voidDeactivatePage(); -OString GetConfigId() const; - //To-Do, consider inheriting from VclContainer virtual voidSetPosSizePixel(const Point& rNewPos, const Size& rNewSize) override; virtual voidSetPosPixel(const Point& rNewPos) override; diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index c63a62e3fdc5..ff5c508efdf9 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -312,6 +312,13 @@ SfxTabDialog* SfxTabPage::GetTabDialog() const return dynamic_cast(GetParentDialog()); } +OString SfxTabPage::GetConfigId() const +{ +OString sId(GetHelpId()); +if (sId.isEmpty() && isLayoutEnabled(this)) +sId = GetWindow(GetWindowType::FirstChild)->GetHelpId(); +return sId; +} SfxTabDialog::SfxTabDialog diff --git a/vcl/source/window/tabpage.cxx b/vcl/source/window/tabpage.cxx index f44385002574..a9d44ffa20e1 100644 --- a/vcl/source/window/tabpage.cxx +++ b/vcl/source/window/tabpage.cxx @@ -181,14 +181,6 @@ void TabPage::DeactivatePage() { } -OString TabPage::GetConfigId() const -{ -OString sId(GetHelpId()); -if (sId.isEmpty() && isLayoutEnabled(this)) -sId = GetWindow(GetWindowType::FirstChild)->GetHelpId(); -return sId; -} - Size TabPage::GetOptimalSize() const { if (isLayoutEnabled(this)) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: include/sfx2 include/vcl sfx2/source vcl/source
include/sfx2/tabdlg.hxx |1 - include/vcl/tabpage.hxx |2 ++ sfx2/source/dialog/tabdlg.cxx | 35 --- vcl/source/window/tabpage.cxx |8 4 files changed, 38 insertions(+), 8 deletions(-) New commits: commit 6fa98a08f2f4b57b660fc39542a9ceb20779d769 Author: Caolán McNamara Date: Wed Apr 2 16:15:59 2014 +0100 Related: fdo#75307 use the unique auto help id to identify tabpages and dialogs that are loaded from the .ui format Change-Id: Id8abff6d89818ca7384d9691a05eacd378a5905c diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx index 4bc1138..54baa7a 100644 --- a/include/sfx2/tabdlg.hxx +++ b/include/sfx2/tabdlg.hxx @@ -91,7 +91,6 @@ friend class SfxTabDialogController; SfxItemSet* pOutSet; TabDlg_Impl*pImpl; sal_uInt16* pRanges; -sal_uInt32 nResId; sal_uInt16 nAppPageId; boolbItemsReset; sal_BoolbFmt; // sal_True, sal_False or 2(some kind of hack) diff --git a/include/vcl/tabpage.hxx b/include/vcl/tabpage.hxx index a8ac279..88a1ead 100644 --- a/include/vcl/tabpage.hxx +++ b/include/vcl/tabpage.hxx @@ -53,6 +53,8 @@ public: virtual voidActivatePage(); virtual voidDeactivatePage(); +OString GetConfigId() const; + //To-Do, consider inheriting from VclContainer virtual voidSetPosSizePixel(const Point& rNewPos, const Size& rNewSize) SAL_OVERRIDE; virtual voidSetPosPixel(const Point& rNewPos) SAL_OVERRIDE; diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index d12b5c4..853c806 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -405,7 +405,6 @@ SfxTabDialog::SfxTabDialog , pSet(pItemSet) , pOutSet(0) , pRanges(0) -, nResId(0) , nAppPageId(USHRT_MAX) , bItemsReset(false) , bFmt(bEditFmt) @@ -436,7 +435,6 @@ SfxTabDialog::SfxTabDialog , pSet(pItemSet) , pOutSet(0) , pRanges(0) -, nResId(0) , nAppPageId(USHRT_MAX) , bItemsReset(false) , bFmt(bEditFmt) @@ -464,7 +462,15 @@ SfxTabDialog::~SfxTabDialog() if ( !aPageData.isEmpty() ) { // save settings of all pages (user data) -SvtViewOptions aPageOpt( E_TABPAGE, OUString::number( pDataObject->nId ) ); +OUString sConfigId = OStringToOUString(pDataObject->pTabPage->GetConfigId(), +RTL_TEXTENCODING_UTF8); +if (sConfigId.isEmpty()) +{ +SAL_WARN("sfx.config", "Tabpage needs to be converted to .ui format"); +sConfigId = OUString::number(pDataObject->nId); +} + +SvtViewOptions aPageOpt(E_TABPAGE, sConfigId); aPageOpt.SetUserItem( USERITEM_NAME, makeAny( OUString( aPageData ) ) ); } @@ -685,7 +691,7 @@ void SfxTabDialog::Start_Impl() sal_uInt16 nActPage = m_pTabCtrl->GetPageId( 0 ); // load old settings, when exists -SvtViewOptions aDlgOpt( E_TABDIALOG, OUString::number( nResId ) ); +SvtViewOptions aDlgOpt(E_TABDIALOG, OStringToOUString(GetHelpId(),RTL_TEXTENCODING_UTF8)); if ( aDlgOpt.Exists() ) { SetWindowState(OUStringToOString(aDlgOpt.GetWindowState().getStr(), RTL_TEXTENCODING_ASCII_US)); @@ -806,7 +812,15 @@ void SfxTabDialog::RemoveTabPage( sal_uInt16 nId ) if ( !aPageData.isEmpty() ) { // save settings of this page (user data) -SvtViewOptions aPageOpt( E_TABPAGE, OUString::number( pDataObject->nId ) ); +OUString sConfigId = OStringToOUString(pDataObject->pTabPage->GetConfigId(), +RTL_TEXTENCODING_UTF8); +if (sConfigId.isEmpty()) +{ +SAL_WARN("sfx.config", "Tabpage needs to be converted to .ui format"); +sConfigId = OUString::number(pDataObject->nId); +} + +SvtViewOptions aPageOpt(E_TABPAGE, sConfigId); aPageOpt.SetUserItem( USERITEM_NAME, makeAny( OUString( aPageData ) ) ); } @@ -882,8 +896,9 @@ SfxTabPage* SfxTabDialog::GetTabPage( sal_uInt16 nPageId ) const void SfxTabDialog::SavePosAndId() { // save settings (screen position and current page) -SvtViewOptions aDlgOpt( E_TABDIALOG, OUString::number( nResId ) ); +SvtViewOptions aDlgOpt(E_TABDIALOG, OStringToOUString(GetHelpId(),RTL_TEXTENCODING_UTF8)); aDlgOpt.SetWindowState(OStringToOUString(GetWindowState(WINDOWSTATE_MASK_POS),RTL_TEXTENCODING_ASCII_US)); +// to-do replace with name of page when all pages are converted to .ui aDlgOpt.SetPageID( m_pTabCtrl->GetCurPageId() ); } @@ -1252,7 +1267,13 @@ IMPL_LINK( SfxTabDialog, ActivatePageHdl, TabControl *, pTabCtrl ) DBG_ASSERT( NULL == pDataObje