cui/source/dialogs/cuigaldlg.cxx | 8 cui/source/factory/dlgfact.cxx | 8 cui/source/factory/dlgfact.hxx | 9 cui/source/inc/cuigaldlg.hxx | 10 include/sfx2/tabdlg.hxx | 2 include/svtools/valueset.hxx | 2 include/svx/galctrl.hxx | 120 +----- include/svx/galmisc.hxx | 15 include/svx/galtheme.hxx | 21 - include/svx/strings.hrc | 4 include/svx/svxdlg.hxx | 9 include/vcl/customweld.hxx | 9 include/vcl/layout.hxx | 17 include/vcl/weld.hxx | 7 sfx2/source/dialog/tabdlg.cxx | 2 solenv/clang-format/blacklist | 2 svtools/source/control/valueset.cxx | 14 svx/Library_svx.mk | 1 svx/Library_svxcore.mk | 2 svx/UIConfig_svx.mk | 1 svx/inc/GalleryControl.hxx | 16 svx/inc/bitmaps.hlst | 2 svx/inc/galbrws2.hxx | 91 ++-- svx/inc/pch/precompiled_svx.hxx | 94 ---- svx/inc/pch/precompiled_svxcore.hxx | 11 svx/source/gallery2/GalleryControl.cxx | 204 ---------- svx/source/gallery2/GallerySplitter.cxx | 38 - svx/source/gallery2/GallerySplitter.hxx | 44 -- svx/source/gallery2/galbrws1.cxx | 341 +++++------------ svx/source/gallery2/galbrws1.hxx | 75 +-- svx/source/gallery2/galbrws2.cxx | 637 +++++++++++++++----------------- svx/source/gallery2/galctrl.cxx | 476 +++++------------------ svx/source/gallery2/galmisc.cxx | 47 +- svx/source/gallery2/galtheme.cxx | 10 svx/uiconfig/ui/gallerymenu1.ui | 6 svx/uiconfig/ui/gallerymenu2.ui | 10 svx/uiconfig/ui/sidebargallery.ui | 345 +++++++++++++++++ vcl/source/app/customweld.cxx | 5 vcl/source/app/salvtables.cxx | 14 vcl/source/window/layout.cxx | 12 vcl/unx/gtk3/gtk3gtkinst.cxx | 290 +++++++++----- 41 files changed, 1369 insertions(+), 1662 deletions(-)
New commits: commit fa8c85fa90e9565a357b247a69f930098d11ff84 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Thu Jan 16 16:38:15 2020 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Tue Jan 21 09:57:58 2020 +0100 weld gallery panel Change-Id: I4aebb3f90e9943044d106a507972c39434988f03 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87003 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx index 21726bb73c7c..fcf0d4cb79ac 100644 --- a/cui/source/dialogs/cuigaldlg.cxx +++ b/cui/source/dialogs/cuigaldlg.cxx @@ -367,7 +367,7 @@ void TakeProgress::LaunchThread() maTakeThread->launch(); } -ActualizeProgress::ActualizeProgress(weld::Window* pWindow, GalleryTheme* pThm) +ActualizeProgress::ActualizeProgress(weld::Widget* pWindow, GalleryTheme* pThm) : GenericDialogController(pWindow, "cui/ui/galleryupdateprogress.ui", "GalleryUpdateProgress") , pIdle(nullptr) @@ -416,7 +416,7 @@ IMPL_LINK( ActualizeProgress, ActualizeHdl, const INetURLObject&, rURL, void ) m_xFtActualizeFile->set_label(GetReducedString(rURL, 30)); } -TitleDialog::TitleDialog(weld::Window* pParent, const OUString& rOldTitle) +TitleDialog::TitleDialog(weld::Widget* pParent, const OUString& rOldTitle) : GenericDialogController(pParent, "cui/ui/gallerytitledialog.ui", "GalleryTitleDialog") , m_xEdit(m_xBuilder->weld_entry("entry")) { @@ -428,7 +428,7 @@ TitleDialog::~TitleDialog() { } -GalleryIdDialog::GalleryIdDialog(weld::Window* pParent, GalleryTheme* _pThm) +GalleryIdDialog::GalleryIdDialog(weld::Widget* pParent, GalleryTheme* _pThm) : GenericDialogController(pParent, "cui/ui/gallerythemeiddialog.ui", "GalleryThemeIDDialog") , m_pThm(_pThm) , m_xBtnOk(m_xBuilder->weld_button("ok")) @@ -476,7 +476,7 @@ IMPL_LINK_NOARG(GalleryIdDialog, ClickOkHdl, weld::Button&, void) m_xDialog->response(RET_OK); } -GalleryThemeProperties::GalleryThemeProperties(weld::Window* pParent, +GalleryThemeProperties::GalleryThemeProperties(weld::Widget* pParent, ExchangeData* _pData, SfxItemSet const * pItemSet) : SfxTabDialogController(pParent, "cui/ui/gallerythemedialog.ui", "GalleryThemeDialog", pItemSet) diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index 1b84c073f51d..0825c040c9e3 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -1103,7 +1103,7 @@ VclPtr<AbstractSpellDialog> AbstractDialogFactory_Impl::CreateSvxSpellDialog( return VclPtr<AbstractSpellDialog_Impl>::Create(std::make_unique<svx::SpellDialog>(pSpellChildWindow, pParent, pBindings)); } -VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateActualizeProgressDialog(weld::Window* pParent, +VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateActualizeProgressDialog(weld::Widget* pParent, GalleryTheme* pThm) { return VclPtr<CuiAbstractController_Impl>::Create(std::make_unique<ActualizeProgress>(pParent, pThm)); @@ -1136,19 +1136,19 @@ VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateSvxScriptOrgDialog(w return VclPtr<CuiAbstractController_Impl>::Create(std::make_unique<SvxScriptOrgDialog>(pParent, rLanguage)); } -VclPtr<AbstractTitleDialog> AbstractDialogFactory_Impl::CreateTitleDialog(weld::Window* pParent, +VclPtr<AbstractTitleDialog> AbstractDialogFactory_Impl::CreateTitleDialog(weld::Widget* pParent, const OUString& rOldText) { return VclPtr<AbstractTitleDialog_Impl>::Create(std::make_unique<TitleDialog>(pParent, rOldText)); } -VclPtr<AbstractGalleryIdDialog> AbstractDialogFactory_Impl::CreateGalleryIdDialog(weld::Window* pParent, +VclPtr<AbstractGalleryIdDialog> AbstractDialogFactory_Impl::CreateGalleryIdDialog(weld::Widget* pParent, GalleryTheme* pThm) { return VclPtr<AbstractGalleryIdDialog_Impl>::Create(std::make_unique<GalleryIdDialog>(pParent, pThm)); } -VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateGalleryThemePropertiesDialog(weld::Window* pParent, +VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateGalleryThemePropertiesDialog(weld::Widget* pParent, ExchangeData* pData, SfxItemSet* pItemSet) { diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index 174417214907..9c60124748a1 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -839,13 +839,14 @@ public: SfxBindings* pBindings, svx::SpellDialogChildWindow* pSpellChildWindow ) override; - virtual VclPtr<VclAbstractDialog> CreateActualizeProgressDialog(weld::Window* pParent, GalleryTheme* pThm) override; - virtual VclPtr<AbstractTitleDialog> CreateTitleDialog(weld::Window* pParent, const OUString& rOldText) override; - virtual VclPtr<AbstractGalleryIdDialog> CreateGalleryIdDialog(weld::Window* pParent, + virtual VclPtr<VclAbstractDialog> CreateActualizeProgressDialog(weld::Widget* pParent, GalleryTheme* pThm) override; + virtual VclPtr<AbstractTitleDialog> CreateTitleDialog(weld::Widget* pParent, const OUString& rOldText) override; + virtual VclPtr<AbstractGalleryIdDialog> CreateGalleryIdDialog(weld::Widget* pParent, GalleryTheme* pThm) override; - virtual VclPtr<VclAbstractDialog> CreateGalleryThemePropertiesDialog(weld::Window* pParent, + virtual VclPtr<VclAbstractDialog> CreateGalleryThemePropertiesDialog(weld::Widget* pParent, ExchangeData* pData, SfxItemSet* pItemSet) override; + virtual VclPtr<AbstractURLDlg> CreateURLDialog(weld::Widget* pParent, const OUString& rURL, const OUString& rAltText, const OUString& rDescription, const OUString& rTarget, const OUString& rName, diff --git a/cui/source/inc/cuigaldlg.hxx b/cui/source/inc/cuigaldlg.hxx index f472d283b2fd..0ad85b65401d 100644 --- a/cui/source/inc/cuigaldlg.hxx +++ b/cui/source/inc/cuigaldlg.hxx @@ -147,7 +147,7 @@ private: DECL_LINK(ActualizeHdl, const INetURLObject&, void); public: - ActualizeProgress(weld::Window* pWindow, GalleryTheme* pThm); + ActualizeProgress(weld::Widget* pWindow, GalleryTheme* pThm); virtual ~ActualizeProgress() override; virtual short run() override; @@ -158,7 +158,7 @@ class TitleDialog : public weld::GenericDialogController private: std::unique_ptr<weld::Entry> m_xEdit; public: - TitleDialog(weld::Window* pParent, const OUString& rOldText); + TitleDialog(weld::Widget* pParent, const OUString& rOldText); virtual ~TitleDialog() override; OUString GetTitle() const { return m_xEdit->get_text(); } }; @@ -172,7 +172,7 @@ private: DECL_LINK(ClickOkHdl, weld::Button&, void); public: - GalleryIdDialog(weld::Window* pParent, GalleryTheme* pThm); + GalleryIdDialog(weld::Widget* pParent, GalleryTheme* pThm); virtual ~GalleryIdDialog() override; sal_uInt32 GetId() const { return m_xLbResName->get_active(); } }; @@ -184,7 +184,7 @@ class GalleryThemeProperties : public SfxTabDialogController virtual void PageCreated(const OString& rId, SfxTabPage &rPage) override; public: - GalleryThemeProperties(weld::Window* pParent, ExchangeData* pData, SfxItemSet const * pItemSet); + GalleryThemeProperties(weld::Widget* pParent, ExchangeData* pData, SfxItemSet const * pItemSet); }; class TPGalleryThemeGeneral : public SfxTabPage @@ -231,7 +231,7 @@ class TPGalleryThemeProperties : public SfxTabPage css::uno::Reference< css::media::XPlayer > xMediaPlayer; css::uno::Reference< css::ui::dialogs::XFolderPicker2 > xFolderPicker; - SvxGalleryPreview m_aWndPreview; + DialogGalleryPreview m_aWndPreview; std::unique_ptr<weld::ComboBox> m_xCbbFileType; std::unique_ptr<weld::TreeView> m_xLbxFound; std::unique_ptr<weld::Button> m_xBtnSearch; diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx index f4c4b9c7b14b..05230e58310b 100644 --- a/include/sfx2/tabdlg.hxx +++ b/include/sfx2/tabdlg.hxx @@ -101,7 +101,7 @@ protected: */ void SavePosAndId(); public: - SfxTabDialogController(weld::Window* pParent, const OUString& rUIXMLDescription, const OString& rID, + SfxTabDialogController(weld::Widget* pParent, const OUString& rUIXMLDescription, const OString& rID, const SfxItemSet * = nullptr, bool bEditFmt = false); virtual ~SfxTabDialogController() override; diff --git a/include/svtools/valueset.hxx b/include/svtools/valueset.hxx index 5d520e2bb097..fed18733ec3c 100644 --- a/include/svtools/valueset.hxx +++ b/include/svtools/valueset.hxx @@ -479,6 +479,8 @@ public: virtual void LoseFocus() override; virtual void Resize() override; virtual void StyleUpdated() override; + virtual void Show() override; + virtual void Hide() override; virtual OUString RequestHelp(tools::Rectangle& rHelpRect) override; void Select(); diff --git a/include/svx/galctrl.hxx b/include/svx/galctrl.hxx index ddbcbb3a60cf..d88a156850e0 100644 --- a/include/svx/galctrl.hxx +++ b/include/svx/galctrl.hxx @@ -24,52 +24,50 @@ #include <vcl/customweld.hxx> #include <vcl/transfer.hxx> #include <svtools/valueset.hxx> -#include <svtools/brwbox.hxx> #include <vcl/GraphicObject.hxx> #include <svx/svxdllapi.h> +class GalleryDragDrop; class GalleryTheme; class GalleryBrowser2; class INetURLObject; -class GalleryPreview final : public vcl::Window, public DropTargetHelper, public DragSourceHelper +class GalleryPreview final : public weld::CustomWidgetController { private: - GraphicObject aGraphicObj; - tools::Rectangle aPreviewRect; - GalleryTheme* const mpTheme; + std::unique_ptr<GalleryDragDrop> mxDragDropTargetHelper; + std::unique_ptr<weld::ScrolledWindow> mxScrolledWindow; + GraphicObject aGraphicObj; + tools::Rectangle aPreviewRect; + GalleryBrowser2* mpParent; + GalleryTheme* mpTheme; bool ImplGetGraphicCenterRect( const Graphic& rGraphic, tools::Rectangle& rResultRect ) const; - void InitSettings(); // Window virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; - virtual Size GetOptimalSize() const override; - virtual void MouseButtonDown(const MouseEvent& rMEvt) override; - virtual void Command(const CommandEvent& rCEvt) override; - virtual void KeyInput( const KeyEvent& rKEvt ) override; - virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; + virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; + virtual bool MouseButtonDown(const MouseEvent& rMEvt) override; + virtual bool Command(const CommandEvent& rCEvt) override; + virtual bool KeyInput( const KeyEvent& rKEvt ) override; +public: - // DropTargetHelper - virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override; - virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override; + GalleryPreview(GalleryBrowser2* pParent, std::unique_ptr<weld::ScrolledWindow> xScrolledWindow); + void SetTheme(GalleryTheme* pTheme) { mpTheme = pTheme; } + virtual ~GalleryPreview() override; - // DragSourceHelper - virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) override; + virtual bool StartDrag() override; -public: - - GalleryPreview(vcl::Window* pParent, - WinBits nStyle = WB_TABSTOP | WB_BORDER, - GalleryTheme* pTheme = nullptr); + virtual void Show() override; + virtual void Hide() override; void SetGraphic( const Graphic& rGraphic ) { aGraphicObj.SetGraphic( rGraphic ); } static void PreviewMedia( const INetURLObject& rURL ); }; -class SVX_DLLPUBLIC SvxGalleryPreview final : public weld::CustomWidgetController +class SVX_DLLPUBLIC DialogGalleryPreview final : public weld::CustomWidgetController { private: GraphicObject aGraphicObj; @@ -81,92 +79,40 @@ private: public: - SvxGalleryPreview(); + DialogGalleryPreview(); virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; void SetGraphic( const Graphic& rGraphic ) { aGraphicObj.SetGraphic( rGraphic ); } bool SetGraphic( const INetURLObject& ); }; -class GalleryIconView final : public ValueSet, public DropTargetHelper, public DragSourceHelper +class GalleryIconView final : public SvtValueSet { - using ValueSet::StartDrag; - private: + std::unique_ptr<GalleryDragDrop> mxDragDropTargetHelper; + GalleryBrowser2* mpParent; GalleryTheme* mpTheme; - void InitSettings(); - // ValueSet virtual void UserDraw( const UserDrawEvent& rUDEvt ) override; // Window - virtual void MouseButtonDown( const MouseEvent& rMEvt ) override; - virtual void Command( const CommandEvent& rCEvt ) override; - virtual void KeyInput( const KeyEvent& rKEvt ) override; - virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; - - // DropTargetHelper - virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override; - virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override; - - // DragSourceHelper - virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) override; - -public: - - GalleryIconView( GalleryBrowser2* pParent, GalleryTheme* pTheme ); -}; + virtual bool MouseButtonDown( const MouseEvent& rMEvt ) override; + virtual bool Command( const CommandEvent& rCEvt ) override; + virtual bool KeyInput( const KeyEvent& rKEvt ) override; -class GalleryListView final : public BrowseBox -{ - using BrowseBox::AcceptDrop; - using BrowseBox::ExecuteDrop; - -private: - - Link<GalleryListView*,void> maSelectHdl; - GalleryTheme* mpTheme; - sal_uInt32 mnCurRow; - - void InitSettings(); - - // BrowseBox - virtual bool SeekRow( long nRow ) override; - virtual void PaintField( vcl::RenderContext& rDev, const tools::Rectangle& rRect, sal_uInt16 nColumnId ) const override; - virtual void DoubleClick( const BrowserMouseEvent& rEvt ) override; - virtual void Select() override; - virtual sal_Int8 AcceptDrop( const BrowserAcceptDropEvent& rEvt ) override; - virtual sal_Int8 ExecuteDrop( const BrowserExecuteDropEvent& rEvt ) override; - virtual void KeyInput( const KeyEvent& rKEvt ) override; - - // Window - virtual void Command( const CommandEvent& rCEvt ) override; - virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; - - // DragSourceHelper - virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) override; + virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; public: - GalleryListView( GalleryBrowser2* pParent, GalleryTheme* pTheme ); - - void SetSelectHdl( const Link<GalleryListView*,void>& rSelectHdl ) { maSelectHdl = rSelectHdl; } + GalleryIconView(GalleryBrowser2* pParent, std::unique_ptr<weld::ScrolledWindow> xScrolledWindow); + void SetTheme(GalleryTheme* pTheme) { mpTheme = pTheme; } + virtual ~GalleryIconView() override; - /** GetCellText returns the text at the given position - @param _nRow - the number of the row - @param _nColId - the ID of the column - @return - the text out of the cell - */ - virtual OUString GetCellText(long _nRow, sal_uInt16 _nColId) const override; + virtual bool StartDrag() override; - // from IAccessibleTableProvider - virtual tools::Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex) override; - virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint) override; + static void drawTransparenceBackground(vcl::RenderContext& rOut, const Point& rPos, const Size& rSize); }; #endif // INCLUDED_SVX_GALCTRL_HXX diff --git a/include/svx/galmisc.hxx b/include/svx/galmisc.hxx index b3236cf9c37b..2ac010e0ed06 100644 --- a/include/svx/galmisc.hxx +++ b/include/svx/galmisc.hxx @@ -91,7 +91,6 @@ bool FileExists( const INetURLObject& rURL ); bool CreateDir( const INetURLObject& rURL ); bool CopyFile( const INetURLObject& rSrcURL, const INetURLObject& rDstURL ); bool KillFile( const INetURLObject& rURL ); -BitmapEx GalleryResGetBitmapEx(const OUString& rId); class SgaIMapInfo final : public SdrObjUserData, public SfxListener { @@ -131,22 +130,26 @@ class SVX_DLLPUBLIC GalleryProgress class GalleryTheme; class GraphicObject; -class GalleryTransferable final : public TransferableHelper +class GalleryTransferable final : public TransferDataContainer { friend class GalleryTheme; using TransferableHelper::CopyToClipboard; GalleryTheme* mpTheme; - SgaObjKind const meObjectKind; - sal_uInt32 const mnObjectPos; + SgaObjKind meObjectKind; + sal_uInt32 mnObjectPos; tools::SvRef<SotStorageStream> mxModelStream; std::unique_ptr<GraphicObject> mpGraphicObject; std::unique_ptr<INetURLObject> mpURL; + void InitData( bool bLazy ); + +public: GalleryTransferable( GalleryTheme* pTheme, sal_uInt32 nObjectPos, bool bLazy ); virtual ~GalleryTransferable() override; - void InitData( bool bLazy ); + void SelectObject(sal_uInt32 nObjectPos); + sal_uInt32 GetObject() const { return mnObjectPos; } // TransferableHelper virtual void AddSupportedFormats() override; @@ -155,7 +158,7 @@ using TransferableHelper::CopyToClipboard; virtual void DragFinished( sal_Int8 nDropAction ) override; virtual void ObjectReleased() override; - void StartDrag( vcl::Window* pWindow, sal_Int8 nDragSourceActions ); + bool StartDrag(); }; enum class GalleryHintType diff --git a/include/svx/galtheme.hxx b/include/svx/galtheme.hxx index 64a3c7e5cfc4..ff7200ded31b 100644 --- a/include/svx/galtheme.hxx +++ b/include/svx/galtheme.hxx @@ -90,7 +90,11 @@ private: SAL_DLLPRIVATE bool ImplWriteSgaObject(const SgaObject& rObj, sal_uInt32 nPos, GalleryObject* pExistentEntry); SAL_DLLPRIVATE void ImplWrite(); SAL_DLLPRIVATE const GalleryObject* ImplGetGalleryObject(sal_uInt32 nPos) const - { return aObjectList[ nPos ].get(); } + { + if (nPos < aObjectList.size()) + return aObjectList[ nPos ].get(); + return nullptr; + } const GalleryObject* ImplGetGalleryObject( const INetURLObject& rURL ); SAL_DLLPRIVATE sal_uInt32 ImplGetGalleryObjectPos( const GalleryObject* pObj ) const @@ -162,12 +166,12 @@ public: public: - SAL_DLLPRIVATE SgaObjKind GetObjectKind(sal_uInt32 nPos) const - { - DBG_ASSERT( nPos < GetObjectCount(), "Position out of range" ); - return ImplGetGalleryObject( nPos )->eObjKind; - } - + SAL_DLLPRIVATE SgaObjKind GetObjectKind(sal_uInt32 nPos) const + { + if (nPos < GetObjectCount()) + return ImplGetGalleryObject( nPos )->eObjKind; + return SgaObjKind::NONE; + } SAL_DLLPRIVATE const INetURLObject& GetObjectURL(sal_uInt32 nPos) const { @@ -192,8 +196,7 @@ public: SAL_DLLPRIVATE bool InsertTransferable(const css::uno::Reference< css::datatransfer::XTransferable >& rxTransferable, sal_uInt32 nInsertPos); - SAL_DLLPRIVATE void CopyToClipboard(vcl::Window* pWindow, sal_uInt32 nPos); - SAL_DLLPRIVATE void StartDrag(vcl::Window* pWindow, sal_uInt32 nPos); + SAL_DLLPRIVATE void CopyToClipboard(sal_uInt32 nPos); public: diff --git a/include/svx/strings.hrc b/include/svx/strings.hrc index 993b03a9c8e9..02d249e64664 100644 --- a/include/svx/strings.hrc +++ b/include/svx/strings.hrc @@ -938,7 +938,6 @@ // Tango colors, see: http://tango.freedesktop.org/Tango_Icon_Theme_Guidelines #define RID_SVXSTR_COLOR_TANGO_ALUMINIUM NC_("RID_SVXSTR_COLOR_TANGO_ALUMINIUM", "Tango: Aluminium") #define RID_SVXSTR_GALLERYPROPS_GALTHEME NC_("RID_SVXSTR_GALLERYPROPS_GALTHEME", "Gallery Theme") -#define RID_SVXSTR_GALLERY_THEMEITEMS NC_("RID_SVXSTR_GALLERY_THEMEITEMS", "Theme Items") #define RID_SVXSTR_GALLERY_PREVIEW NC_("RID_SVXSTR_GALLERY_PREVIEW", "Preview") #define RID_SVXSTR_SUCCESSRECOV NC_("RID_SVXSTR_SUCCESSRECOV", "Successfully recovered") #define RID_SVXSTR_ORIGDOCRECOV NC_("RID_SVXSTR_ORIGDOCRECOV", "Original document recovered") @@ -966,10 +965,7 @@ #define RID_SVXSTR_GALLERY_FILTER NC_("RID_SVXSTR_GALLERY_FILTER", "Graphics filter") #define RID_SVXSTR_GALLERY_NEWTHEME NC_("RID_SVXSTR_GALLERY_NEWTHEME", "New Theme") -#define RID_SVXSTR_GALLERY_CREATETHEME NC_("RID_SVXSTR_GALLERY_CREATETHEME", "New Theme...") #define RID_SVXSTR_GALLERY_TITLE NC_("RID_SVXSTR_GALLERY_TITLE", "Title") -#define RID_SVXSTR_GALLERY_ICONVIEW NC_("RID_SVXSTR_GALLERY_ICONVIEW", "Icon View") -#define RID_SVXSTR_GALLERY_LISTVIEW NC_("RID_SVXSTR_GALLERY_LISTVIEW", "Detailed View") #define RID_GALLERYSTR_THEME_3D NC_("RID_GALLERYSTR_THEME_3D", "3D Effects") #define RID_GALLERYSTR_THEME_ANIMATIONS NC_("RID_GALLERYSTR_THEME_ANIMATIONS", "Animations") diff --git a/include/svx/svxdlg.hxx b/include/svx/svxdlg.hxx index 2fce5d60b1b5..22b6139eb0bd 100644 --- a/include/svx/svxdlg.hxx +++ b/include/svx/svxdlg.hxx @@ -344,15 +344,16 @@ public: SfxBindings* pBindings, svx::SpellDialogChildWindow* pSpellChildWindow )=0; - virtual VclPtr<VclAbstractDialog> CreateActualizeProgressDialog(weld::Window* pParent, + virtual VclPtr<VclAbstractDialog> CreateActualizeProgressDialog(weld::Widget* pParent, GalleryTheme* pThm) = 0; - virtual VclPtr<AbstractTitleDialog> CreateTitleDialog(weld::Window* pParent, + virtual VclPtr<AbstractTitleDialog> CreateTitleDialog(weld::Widget* pParent, const OUString& rOldText) = 0; - virtual VclPtr<AbstractGalleryIdDialog> CreateGalleryIdDialog(weld::Window* pParent, + virtual VclPtr<AbstractGalleryIdDialog> CreateGalleryIdDialog(weld::Widget* pParent, GalleryTheme* pThm) = 0; - virtual VclPtr<VclAbstractDialog> CreateGalleryThemePropertiesDialog(weld::Window* pParent, + virtual VclPtr<VclAbstractDialog> CreateGalleryThemePropertiesDialog(weld::Widget* pParent, ExchangeData* pData, SfxItemSet* pItemSet ) = 0; + virtual VclPtr<AbstractURLDlg> CreateURLDialog(weld::Widget* pParent, const OUString& rURL, const OUString& rAltText, const OUString& rDescription, const OUString& rTarget, const OUString& rName, diff --git a/include/vcl/customweld.hxx b/include/vcl/customweld.hxx index 330ab167e37d..148bd6ac6554 100644 --- a/include/vcl/customweld.hxx +++ b/include/vcl/customweld.hxx @@ -19,6 +19,7 @@ class VCL_DLLPUBLIC CustomWidgetController private: Size m_aSize; weld::DrawingArea* m_pDrawingArea; + DECL_LINK(DragBeginHdl, weld::DrawingArea&, bool); public: virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() @@ -72,6 +73,14 @@ public: void SetPointer(PointerStyle ePointerStyle) { m_pDrawingArea->set_cursor(ePointerStyle); } void SetHelpId(const OString& rHelpId) { m_pDrawingArea->set_help_id(rHelpId); } void SetAccessibleName(const OUString& rName) { m_pDrawingArea->set_accessible_name(rName); } + void SetDragDataTransferrable(rtl::Reference<TransferDataContainer>& rTransferrable, + sal_uInt8 eDNDConstants) + { + m_pDrawingArea->enable_drag_source(rTransferrable, eDNDConstants); + m_pDrawingArea->connect_drag_begin(LINK(this, CustomWidgetController, DragBeginHdl)); + } + // return true to disallow drag, false to allow + virtual bool StartDrag() { return false; } void set_size_request(int nWidth, int nHeight) { m_pDrawingArea->set_size_request(nWidth, nHeight); diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx index 9d8290929db6..7989c011cc7f 100644 --- a/include/vcl/layout.hxx +++ b/include/vcl/layout.hxx @@ -19,6 +19,7 @@ #include <vcl/window.hxx> #include <vcl/settings.hxx> #include <vcl/event.hxx> +#include <vcl/transfer.hxx> #include <vcl/vclptr.hxx> #include <vcl/IContext.hxx> #include <vcl/commandevent.hxx> @@ -630,10 +631,13 @@ public: }; class VCL_DLLPUBLIC VclDrawingArea final : public Control + , public DragSourceHelper { private: FactoryFunction m_pFactoryFunction; void* m_pUserData; + rtl::Reference<TransferDataContainer> m_xTransferHelper; + sal_Int8 m_nDragAction; Link<std::pair<vcl::RenderContext&, const tools::Rectangle&>, void> m_aPaintHdl; Link<const Size&, void> m_aResizeHdl; Link<const MouseEvent&, bool> m_aMousePressHdl; @@ -644,6 +648,7 @@ private: Link<VclDrawingArea&, void> m_aStyleUpdatedHdl; Link<const CommandEvent&, bool> m_aCommandHdl; Link<tools::Rectangle&, OUString> m_aQueryTooltipHdl; + Link<VclDrawingArea*, bool> m_aStartDragHdl; virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override { @@ -723,6 +728,7 @@ private: Help::ShowQuickHelp(this, aHelpArea, sHelpTip, eHelpWinStyle); } } + virtual void StartDrag(sal_Int8 nAction, const Point& rPosPixel) override; virtual FactoryFunction GetUITestFactory() const override { if (m_pFactoryFunction) @@ -733,8 +739,10 @@ private: public: VclDrawingArea(vcl::Window *pParent, WinBits nStyle) : Control(pParent, nStyle) + , DragSourceHelper(this) , m_pFactoryFunction(nullptr) , m_pUserData(nullptr) + , m_nDragAction(0) { SetBackground(); } @@ -787,6 +795,15 @@ public: { m_aQueryTooltipHdl = rLink; } + void SetStartDragHdl(const Link<VclDrawingArea*, bool>& rLink) + { + m_aStartDragHdl = rLink; + } + void SetDragHelper(rtl::Reference<TransferDataContainer>& rHelper, sal_uInt8 eDNDConstants) + { + m_xTransferHelper = rHelper; + m_nDragAction = eDNDConstants; + } }; //Get first window of a pTopLevel window as diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 9ac53dd91a9e..c61b73782087 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -1874,6 +1874,8 @@ protected: Link<const CommandEvent&, bool> m_aCommandHdl; Link<Widget&, tools::Rectangle> m_aGetFocusRectHdl; Link<tools::Rectangle&, OUString> m_aQueryTooltipHdl; + // if handler returns true, drag is disallowed + Link<DrawingArea&, bool> m_aDragBeginHdl; OUString signal_query_tooltip(tools::Rectangle& rHelpArea) { @@ -1892,10 +1894,15 @@ public: { m_aQueryTooltipHdl = rLink; } + void connect_drag_begin(const Link<DrawingArea&, bool>& rLink) { m_aDragBeginHdl = rLink; } virtual void queue_draw() = 0; virtual void queue_draw_area(int x, int y, int width, int height) = 0; virtual void queue_resize() = 0; + virtual void enable_drag_source(rtl::Reference<TransferDataContainer>& rTransferrable, + sal_uInt8 eDNDConstants) + = 0; + virtual void set_cursor(PointerStyle ePointerStyle) = 0; // use return here just to generate matching VirtualDevices diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index f21c4e50874b..210b6fb87dc4 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -302,7 +302,7 @@ const SfxItemSet* SfxTabPage::GetDialogExampleSet() const SfxTabDialogController::SfxTabDialogController ( - weld::Window* pParent, // Parent Window + weld::Widget* pParent, // Parent Window const OUString& rUIXMLDescription, const OString& rID, // Dialog .ui path, Dialog Name const SfxItemSet* pItemSet, // Itemset with the data; // can be NULL, when Pages are onDemand diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist index 4ffdd13ad8f1..ce28416b0cdc 100644 --- a/solenv/clang-format/blacklist +++ b/solenv/clang-format/blacklist @@ -14056,8 +14056,6 @@ svx/source/form/tbxform.cxx svx/source/form/typemap.cxx svx/source/form/xfm_addcondition.cxx svx/source/gallery2/GalleryControl.cxx -svx/source/gallery2/GallerySplitter.cxx -svx/source/gallery2/GallerySplitter.hxx svx/source/gallery2/codec.cxx svx/source/gallery2/codec.hxx svx/source/gallery2/galbrws1.cxx diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx index 414f3ae6a2ad..69d674be295d 100644 --- a/svtools/source/control/valueset.cxx +++ b/svtools/source/control/valueset.cxx @@ -4013,4 +4013,18 @@ void SvtValueSet::SetColor(const Color& rColor) Invalidate(); } +void SvtValueSet::Show() +{ + if (mxScrolledWindow) + mxScrolledWindow->show(); + CustomWidgetController::Show(); +} + +void SvtValueSet::Hide() +{ + CustomWidgetController::Hide(); + if (mxScrolledWindow) + mxScrolledWindow->hide(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/Library_svx.mk b/svx/Library_svx.mk index 66138648dca0..a2f22cd7c700 100644 --- a/svx/Library_svx.mk +++ b/svx/Library_svx.mk @@ -181,7 +181,6 @@ $(eval $(call gb_Library_add_exception_objects,svx,\ svx/source/sidebar/nbdtmg \ svx/source/sidebar/nbdtmgfact \ svx/source/sidebar/PanelFactory \ - svx/source/sidebar/PanelLayout \ svx/source/sidebar/SelectionAnalyzer \ svx/source/sidebar/SelectionChangeHandler \ svx/source/sidebar/text/TextCharacterSpacingControl \ diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk index 89067b0ca03f..e07289cc80f7 100644 --- a/svx/Library_svxcore.mk +++ b/svx/Library_svxcore.mk @@ -153,7 +153,6 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\ svx/source/gallery2/galobj \ svx/source/gallery2/galtheme \ svx/source/gallery2/GalleryControl \ - svx/source/gallery2/GallerySplitter \ svx/source/items/chrtitem \ svx/source/items/clipfmtitem \ svx/source/items/customshapeitem \ @@ -274,6 +273,7 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\ svx/source/sdr/properties/connectorproperties \ svx/source/sdr/properties/e3dcompoundproperties \ svx/source/sdr/properties/oleproperties \ + svx/source/sidebar/PanelLayout \ svx/source/svdraw/clonelist \ svx/source/svdraw/charthelper \ svx/source/svdraw/gradtrns \ diff --git a/svx/UIConfig_svx.mk b/svx/UIConfig_svx.mk index aa3486ae3a51..bd58d87d32e1 100644 --- a/svx/UIConfig_svx.mk +++ b/svx/UIConfig_svx.mk @@ -96,6 +96,7 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\ svx/uiconfig/ui/selectionmenu \ svx/uiconfig/ui/sidebararea \ svx/uiconfig/ui/sidebarshadow \ + svx/uiconfig/ui/sidebargallery \ svx/uiconfig/ui/sidebargraphic \ svx/uiconfig/ui/sidebarline \ svx/uiconfig/ui/sidebarparagraph \ diff --git a/svx/inc/GalleryControl.hxx b/svx/inc/GalleryControl.hxx index 4ed3dd7ec7b7..8e65bb50d13a 100644 --- a/svx/inc/GalleryControl.hxx +++ b/svx/inc/GalleryControl.hxx @@ -19,13 +19,12 @@ #ifndef INCLUDED_SVX_INC_GALLERYCONTROL_HXX #define INCLUDED_SVX_INC_GALLERYCONTROL_HXX -#include <vcl/window.hxx> +#include <svx/sidebar/PanelLayout.hxx> #include <svx/svxdllapi.h> class SfxBindings; class Gallery; -class GallerySplitter; class GalleryBrowser1; class GalleryBrowser2; class FmFormModel; @@ -34,27 +33,20 @@ class Splitter; namespace svx { namespace sidebar { -class SVX_DLLPUBLIC GalleryControl final : public vcl::Window +class SVX_DLLPUBLIC GalleryControl final : public PanelLayout { public: GalleryControl( vcl::Window* pParentWindow ); - bool GalleryKeyInput( const KeyEvent& rKEvt ); - private: Gallery* mpGallery; - VclPtr<GallerySplitter> mpSplitter; - VclPtr<GalleryBrowser1> mpBrowser1; - VclPtr<GalleryBrowser2> mpBrowser2; - bool mbIsInitialResize; + std::unique_ptr<GalleryBrowser1> mxBrowser1; + std::unique_ptr<GalleryBrowser2> mxBrowser2; void InitSettings(); - virtual void Resize() override; virtual void GetFocus() override; - DECL_LINK(SplitHdl, Splitter*, void); - virtual ~GalleryControl() override; virtual void dispose() override; }; diff --git a/svx/inc/bitmaps.hlst b/svx/inc/bitmaps.hlst index 158b66175691..7316b88f7fec 100644 --- a/svx/inc/bitmaps.hlst +++ b/svx/inc/bitmaps.hlst @@ -145,8 +145,6 @@ #define RID_SVXBMP_GALLERY_SOUND_5 "svx/res/galsnd5.png" #define RID_SVXBMP_GALLERY_SOUND_6 "svx/res/galsnd6.png" #define RID_SVXBMP_GALLERY_SOUND_7 "svx/res/galsnd7.png" -#define RID_SVXBMP_GALLERY_VIEW_ICON "svx/res/galicon.png" -#define RID_SVXBMP_GALLERY_VIEW_LIST "svx/res/gallist.png" #define BMP_NONE_ICON "svx/res/symphony/blank.png" #define BMP_WIDTH1_ICON "svx/res/symphony/width1.png" diff --git a/svx/inc/galbrws2.hxx b/svx/inc/galbrws2.hxx index d37ddad93e65..6b25012b6af4 100644 --- a/svx/inc/galbrws2.hxx +++ b/svx/inc/galbrws2.hxx @@ -56,46 +56,39 @@ namespace o3tl } -class GalleryToolBox final : public ToolBox -{ -private: - - virtual void KeyInput( const KeyEvent& rKEvt ) override; - -public: - - GalleryToolBox( GalleryBrowser2* pParent ); -}; - - class Gallery; +class GalleryDragDrop; class GalleryTheme; class GalleryIconView; class GalleryListView; class GalleryPreview; +class GalleryTransferable; class Menu; class SgaObject; struct DispatchInfo; namespace svx { namespace sidebar { class GalleryControl; } } -class GalleryBrowser2 : public Control, public SfxListener +class GalleryBrowser2 : public SfxListener { friend class GalleryBrowser; friend class svx::sidebar::GalleryControl; - using Window::KeyInput; private: SvtMiscOptions maMiscOptions; Gallery* mpGallery; GalleryTheme* mpCurTheme; - VclPtr<GalleryIconView> mpIconView; - VclPtr<GalleryListView> mpListView; - VclPtr<GalleryPreview> mpPreview; - VclPtr<GalleryToolBox> maViewBox; - VclPtr<FixedLine> maSeparator; - VclPtr<FixedText> maInfoBar; + std::unique_ptr<GalleryIconView> mxIconView; + std::unique_ptr<weld::CustomWeld> mxIconViewWin; + std::unique_ptr<weld::TreeView> mxListView; + std::unique_ptr<GalleryDragDrop> mxDragDropTargetHelper; + std::unique_ptr<GalleryPreview> mxPreview; + std::unique_ptr<weld::CustomWeld> mxPreviewWin; + std::unique_ptr<weld::ToggleButton> mxIconButton; + std::unique_ptr<weld::ToggleButton> mxListButton; + std::unique_ptr<weld::Label> mxInfoBar; + rtl::Reference<GalleryTransferable> m_xHelper; sal_uInt32 mnCurActionPos; GalleryBrowserMode meMode; GalleryBrowserMode meLastMode; @@ -103,24 +96,25 @@ private: css::uno::Reference< css::uno::XComponentContext > m_xContext; css::uno::Reference< css::util::XURLTransformer > m_xTransformer; - void InitSettings(); - void ImplUpdateViews( sal_uInt16 nSelectionId ); void ImplUpdateInfoBar(); sal_uInt32 ImplGetSelectedItemId( const Point* pSelPosPixel, Point& rSelPos ); void ImplSelectItemId(sal_uInt32 nItemId); - - // Control - virtual void Resize() override; - virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; + void ImplUpdateSelection(); + void UpdateVisibleRows(); // SfxListener virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; - DECL_LINK( SelectObjectHdl, GalleryListView*, void ); - DECL_LINK( SelectObjectValueSetHdl, ValueSet*, void ); - DECL_LINK( SelectTbxHdl, ToolBox*, void ); - DECL_LINK( MiscHdl, LinkParamNone*, void ); + DECL_LINK( SelectObjectHdl, weld::TreeView&, void ); + DECL_LINK( SelectObjectValueSetHdl, SvtValueSet*, void ); + DECL_LINK( SelectTbxHdl, weld::ToggleButton&, void ); + DECL_LINK( PopupMenuHdl, const CommandEvent&, bool ); + DECL_LINK( KeyInputHdl, const KeyEvent&, bool ); + DECL_LINK( RowActivatedHdl, weld::TreeView&, bool ); + DECL_LINK( DragBeginHdl, weld::TreeView&, bool ); + DECL_LINK( VisRowsScrolledHdl, weld::TreeView&, void ); + DECL_LINK( SizeAllocHdl, const Size&, void ); private: @@ -132,16 +126,15 @@ public: public: - GalleryBrowser2(vcl::Window* pParent, Gallery* pGallery); - virtual ~GalleryBrowser2() override; - virtual void dispose() override; + GalleryBrowser2(weld::Builder& rBuilder, Gallery* pGallery); + ~GalleryBrowser2(); void SelectTheme( const OUString& rThemeName ); GalleryBrowserMode GetMode() const { return meMode; } void SetMode( GalleryBrowserMode eMode ); - vcl::Window* GetViewWindow() const; + weld::Widget* GetViewWindow() const; void Travel( GalleryBrowserTravel eTravel ); @@ -150,10 +143,11 @@ public: sal_Int8 AcceptDrop( DropTargetHelper& rTarget ); sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ); - void StartDrag( const Point* pDragPoint = nullptr ); + bool StartDrag(); void TogglePreview(); - void ShowContextMenu( const Point* pContextPoint ); - bool KeyInput( const KeyEvent& rEvt, vcl::Window* pWindow ); + void ShowContextMenu(const CommandEvent& rCEvt); + bool KeyInput(const KeyEvent& rEvt); + bool ViewBoxHasFocus() const; static css::uno::Reference< css::frame::XFrame > GetFrame(); const css::uno::Reference< css::util::XURLTransformer >& GetURLTransformer() const { return m_xTransformer; } @@ -165,6 +159,29 @@ public: DECL_STATIC_LINK( GalleryBrowser2, AsyncDispatch_Impl, void*, void ); }; +class GalleryDragDrop : public DropTargetHelper +{ +private: + GalleryBrowser2* m_pParent; + + virtual sal_Int8 AcceptDrop(const AcceptDropEvent& /*rEvt*/) override + { + return m_pParent->AcceptDrop(*this); + } + + virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent& rEvt) override + { + return m_pParent->ExecuteDrop(rEvt); + } + +public: + GalleryDragDrop(GalleryBrowser2* pParent, const css::uno::Reference<css::datatransfer::dnd::XDropTarget>& rDropTarget) + : DropTargetHelper(rDropTarget) + , m_pParent(pParent) + { + } +}; + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/inc/pch/precompiled_svx.hxx b/svx/inc/pch/precompiled_svx.hxx index fd54e6804165..69189bb5b1d6 100644 --- a/svx/inc/pch/precompiled_svx.hxx +++ b/svx/inc/pch/precompiled_svx.hxx @@ -13,7 +13,7 @@ manual changes will be rewritten by the next run of update_pch.sh (which presumably also fixes all possible problems, so it's usually better to use it). - Generated on 2020-01-14 14:50:22 using: + Generated on 2020-01-17 19:33:52 using: ./bin/update_pch svx svx --cutoff=3 --exclude:system --exclude:module --include:local If after updating build fails, use the following command to locate conflicting headers: @@ -47,27 +47,20 @@ #endif // PCH_LEVEL >= 1 #if PCH_LEVEL >= 2 #include <osl/diagnose.h> -#include <osl/diagnose.hxx> #include <osl/doublecheckedlocking.h> #include <osl/file.hxx> #include <osl/getglobalmutex.hxx> #include <osl/interlck.h> #include <osl/mutex.hxx> -#include <osl/nlsupport.h> -#include <osl/security.hxx> #include <osl/thread.h> #include <rtl/alloc.h> #include <rtl/bootstrap.hxx> #include <rtl/instance.hxx> -#include <rtl/math.hxx> #include <rtl/ref.hxx> -#include <rtl/string.h> -#include <rtl/string.hxx> +#include <rtl/strbuf.hxx> #include <rtl/tencinfo.h> #include <rtl/textenc.h> -#include <rtl/uri.hxx> #include <rtl/ustrbuf.hxx> -#include <rtl/ustring.h> #include <rtl/ustring.hxx> #include <rtl/uuid.h> #include <sal/config.h> @@ -78,7 +71,7 @@ #include <sal/typesizes.h> #include <vcl/BitmapFilter.hxx> #include <vcl/EnumContext.hxx> -#include <vcl/IContext.hxx> +#include <vcl/GraphicObject.hxx> #include <vcl/Scanline.hxx> #include <vcl/alpha.hxx> #include <vcl/bitmapex.hxx> @@ -100,23 +93,17 @@ #include <vcl/fixed.hxx> #include <vcl/font.hxx> #include <vcl/gdimtf.hxx> -#include <vcl/gradient.hxx> #include <vcl/graph.hxx> -#include <vcl/help.hxx> #include <vcl/idle.hxx> #include <vcl/image.hxx> #include <vcl/imap.hxx> #include <vcl/imapobj.hxx> -#include <vcl/layout.hxx> -#include <vcl/mapmod.hxx> #include <vcl/menu.hxx> #include <vcl/metric.hxx> #include <vcl/outdev.hxx> #include <vcl/ptrstyle.hxx> -#include <vcl/region.hxx> #include <vcl/scrbar.hxx> #include <vcl/settings.hxx> -#include <vcl/split.hxx> #include <vcl/status.hxx> #include <vcl/svapp.hxx> #include <vcl/task.hxx> @@ -135,48 +122,35 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/matrix/b3dhommatrix.hxx> #include <basegfx/point/b2dpoint.hxx> +#include <basegfx/point/b2ipoint.hxx> #include <basegfx/point/b3dpoint.hxx> -#include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> -#include <basegfx/polygon/b2dpolypolygon.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> -#include <basegfx/polygon/b3dpolypolygon.hxx> #include <basegfx/range/b2irectangle.hxx> -#include <basegfx/range/b3drange.hxx> +#include <basegfx/tuple/b2dtuple.hxx> +#include <basegfx/vector/b2enums.hxx> #include <basegfx/vector/b3dvector.hxx> #include <com/sun/star/accessibility/AccessibleEventId.hpp> -#include <com/sun/star/accessibility/AccessibleEventObject.hpp> #include <com/sun/star/accessibility/AccessibleRelationType.hpp> #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/accessibility/XAccessible.hpp> #include <com/sun/star/accessibility/XAccessibleContext.hpp> #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> -#include <com/sun/star/awt/FontDescriptor.hpp> -#include <com/sun/star/awt/FontSlant.hpp> #include <com/sun/star/awt/GradientStyle.hpp> +#include <com/sun/star/awt/Point.hpp> #include <com/sun/star/awt/Rectangle.hpp> -#include <com/sun/star/awt/XWindow.hpp> #include <com/sun/star/beans/NamedValue.hpp> -#include <com/sun/star/beans/PropertyChangeEvent.hpp> #include <com/sun/star/beans/PropertyState.hpp> #include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/beans/XMultiPropertySet.hpp> -#include <com/sun/star/beans/XMultiPropertyStates.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertySetInfo.hpp> -#include <com/sun/star/beans/XPropertyState.hpp> -#include <com/sun/star/container/XChild.hpp> -#include <com/sun/star/container/XEnumerationAccess.hpp> #include <com/sun/star/container/XIndexAccess.hpp> -#include <com/sun/star/container/XIndexReplace.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/drawing/FillStyle.hpp> #include <com/sun/star/drawing/LineCap.hpp> #include <com/sun/star/drawing/TextFitToSizeType.hpp> -#include <com/sun/star/drawing/XShapeDescriptor.hpp> -#include <com/sun/star/drawing/XShapes.hpp> #include <com/sun/star/frame/XController.hpp> #include <com/sun/star/frame/XController2.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> @@ -185,32 +159,20 @@ #include <com/sun/star/frame/XStatusListener.hpp> #include <com/sun/star/frame/XToolbarController.hpp> #include <com/sun/star/i18n/BreakIterator.hpp> -#include <com/sun/star/i18n/UnicodeScript.hpp> -#include <com/sun/star/i18n/WordType.hpp> #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/lang/EventObject.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> #include <com/sun/star/lang/Locale.hpp> #include <com/sun/star/lang/XInitialization.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XTypeProvider.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp> -#include <com/sun/star/style/LineSpacing.hpp> #include <com/sun/star/style/NumberingType.hpp> -#include <com/sun/star/style/TabStop.hpp> #include <com/sun/star/style/XStyle.hpp> #include <com/sun/star/text/DefaultNumberingProvider.hpp> +#include <com/sun/star/text/WritingMode2.hpp> #include <com/sun/star/text/XNumberingFormatter.hpp> -#include <com/sun/star/text/XNumberingTypeInfo.hpp> -#include <com/sun/star/text/XTextAppend.hpp> -#include <com/sun/star/text/XTextContent.hpp> -#include <com/sun/star/text/XTextCopy.hpp> -#include <com/sun/star/text/XTextCursor.hpp> -#include <com/sun/star/text/XTextRange.hpp> -#include <com/sun/star/text/XTextRangeCompare.hpp> -#include <com/sun/star/text/XTextRangeMover.hpp> #include <com/sun/star/text/textfield/Type.hpp> #include <com/sun/star/ui/XContextChangeEventListener.hpp> #include <com/sun/star/uno/Any.h> @@ -228,16 +190,13 @@ #include <com/sun/star/uno/XWeak.hpp> #include <com/sun/star/uno/genfunc.hxx> #include <com/sun/star/util/NumberFormat.hpp> -#include <com/sun/star/util/URL.hpp> #include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XModifyListener.hpp> #include <com/sun/star/util/XUpdatable.hpp> #include <com/sun/star/view/XSelectionChangeListener.hpp> #include <com/sun/star/view/XSelectionSupplier.hpp> -#include <comphelper/accessibleeventnotifier.hxx> #include <comphelper/broadcasthelper.hxx> #include <comphelper/comphelperdllapi.h> -#include <comphelper/interfacecontainer2.hxx> #include <comphelper/lok.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/proparrhlp.hxx> @@ -262,42 +221,37 @@ #include <cppuhelper/propshlp.hxx> #include <cppuhelper/queryinterface.hxx> #include <cppuhelper/supportsservice.hxx> -#include <cppuhelper/typeprovider.hxx> #include <cppuhelper/weak.hxx> -#include <cppuhelper/weakagg.hxx> -#include <cppuhelper/weakref.hxx> #include <drawinglayer/drawinglayerdllapi.h> #include <drawinglayer/geometry/viewinformation2d.hxx> #include <drawinglayer/primitive2d/baseprimitive2d.hxx> -#include <editeng/boxitem.hxx> #include <editeng/brushitem.hxx> #include <editeng/colritem.hxx> #include <editeng/editdata.hxx> #include <editeng/editeng.hxx> #include <editeng/editengdllapi.h> #include <editeng/editstat.hxx> -#include <editeng/editview.hxx> +#include <editeng/eedata.hxx> #include <editeng/eeitem.hxx> #include <editeng/fhgtitem.hxx> #include <editeng/flditem.hxx> #include <editeng/fontitem.hxx> +#include <editeng/frmdir.hxx> #include <editeng/itemtype.hxx> #include <editeng/kernitem.hxx> #include <editeng/lrspitem.hxx> -#include <editeng/memberids.h> #include <editeng/numdef.hxx> #include <editeng/numitem.hxx> #include <editeng/outliner.hxx> #include <editeng/outlobj.hxx> +#include <editeng/paragraphdata.hxx> #include <editeng/postitem.hxx> #include <editeng/sizeitem.hxx> #include <editeng/svxenum.hxx> +#include <editeng/svxfont.hxx> #include <editeng/udlnitem.hxx> #include <editeng/ulspitem.hxx> #include <editeng/unoedhlp.hxx> -#include <editeng/unoedsrc.hxx> -#include <editeng/unolingu.hxx> -#include <editeng/unotext.hxx> #include <editeng/wghtitem.hxx> #include <i18nlangtag/lang.h> #include <i18nlangtag/languagetag.hxx> @@ -305,6 +259,7 @@ #include <o3tl/cow_wrapper.hxx> #include <o3tl/deleter.hxx> #include <o3tl/optional.hxx> +#include <o3tl/safeint.hxx> #include <o3tl/typed_flags_set.hxx> #include <o3tl/underlyingenumvalue.hxx> #include <officecfg/Office/Common.hxx> @@ -352,12 +307,10 @@ #include <svl/stylesheetuser.hxx> #include <svl/svldllapi.h> #include <svl/typedwhich.hxx> -#include <svl/urihelper.hxx> +#include <svl/undo.hxx> #include <svl/zforlist.hxx> #include <svtools/colorcfg.hxx> -#include <svtools/ctrltool.hxx> #include <svtools/ehdl.hxx> -#include <svtools/miscopt.hxx> #include <svtools/popupwindowcontroller.hxx> #include <svtools/svtdllapi.h> #include <svtools/svtresid.hxx> @@ -365,7 +318,6 @@ #include <svtools/toolboxcontroller.hxx> #include <svtools/unitconv.hxx> #include <svtools/valueset.hxx> -#include <toolkit/helper/convert.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <tools/color.hxx> #include <tools/date.hxx> @@ -374,7 +326,9 @@ #include <tools/diagnose_ex.h> #include <tools/fldunit.hxx> #include <tools/fontenum.hxx> +#include <tools/fract.hxx> #include <tools/gen.hxx> +#include <tools/helpers.hxx> #include <tools/link.hxx> #include <tools/mapunit.hxx> #include <tools/poly.hxx> @@ -384,16 +338,15 @@ #include <tools/time.hxx> #include <tools/toolsdllapi.h> #include <tools/urlobj.hxx> -#include <unicode/uchar.h> #include <uno/data.h> #include <uno/sequence2.h> #include <unotools/accessiblerelationsethelper.hxx> #include <unotools/accessiblestatesethelper.hxx> +#include <unotools/configitem.hxx> #include <unotools/fontcvt.hxx> #include <unotools/localedatawrapper.hxx> #include <unotools/options.hxx> #include <unotools/pathoptions.hxx> -#include <unotools/syslocale.hxx> #include <unotools/unotoolsdllapi.h> #include <unotools/viewoptions.hxx> #endif // PCH_LEVEL >= 3 @@ -420,17 +373,14 @@ #include <svx/fmpage.hxx> #include <svx/fmshell.hxx> #include <svx/fmtools.hxx> -#include <svx/gallery.hxx> #include <svx/galmisc.hxx> #include <svx/itemwin.hxx> #include <svx/itextprovider.hxx> -#include <svx/msdffdef.hxx> #include <svx/obj3d.hxx> #include <svx/pageitem.hxx> #include <svx/rotmodit.hxx> #include <svx/rulritem.hxx> -#include <svx/scene3d.hxx> -#include <svx/sdasitm.hxx> +#include <svx/sdooitm.hxx> #include <svx/sdprcitm.hxx> #include <svx/sdrpaintwindow.hxx> #include <svx/sdshitm.hxx> @@ -441,24 +391,22 @@ #include <svx/srchdlg.hxx> #include <svx/strarray.hxx> #include <svx/svddef.hxx> -#include <svx/svdetc.hxx> #include <svx/svditer.hxx> #include <svx/svdmodel.hxx> #include <svx/svdoashp.hxx> #include <svx/svdoattr.hxx> #include <svx/svdobj.hxx> -#include <svx/svdogrp.hxx> #include <svx/svdopath.hxx> #include <svx/svdorect.hxx> #include <svx/svdotable.hxx> #include <svx/svdotext.hxx> -#include <svx/svdoutl.hxx> #include <svx/svdpage.hxx> #include <svx/svdpagv.hxx> #include <svx/svdtext.hxx> #include <svx/svdtrans.hxx> #include <svx/svdtypes.hxx> #include <svx/svdview.hxx> +#include <svx/svx3ditems.hxx> #include <svx/svxdlg.hxx> #include <svx/svxdllapi.h> #include <svx/tbxcolor.hxx> @@ -466,10 +414,8 @@ #include <svx/unomid.hxx> #include <svx/unopage.hxx> #include <svx/unoprov.hxx> -#include <svx/unoshape.hxx> #include <svx/unoshtxt.hxx> #include <svx/viewpt3d.hxx> -#include <svx/xbtmpit.hxx> #include <svx/xcolit.hxx> #include <svx/xdef.hxx> #include <svx/xenum.hxx> @@ -486,10 +432,8 @@ #include <svx/xlnstit.hxx> #include <svx/xlntrit.hxx> #include <svx/xlnwtit.hxx> -#include <svx/xoutbmp.hxx> #include <svx/xtable.hxx> #include <svx/zoomslideritem.hxx> -#include <uiobject.hxx> #endif // PCH_LEVEL >= 4 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/inc/pch/precompiled_svxcore.hxx b/svx/inc/pch/precompiled_svxcore.hxx index e1dc18dadb0b..bc5d37d92124 100644 --- a/svx/inc/pch/precompiled_svxcore.hxx +++ b/svx/inc/pch/precompiled_svxcore.hxx @@ -13,7 +13,7 @@ manual changes will be rewritten by the next run of update_pch.sh (which presumably also fixes all possible problems, so it's usually better to use it). - Generated on 2020-01-14 14:50:28 using: + Generated on 2020-01-19 20:29:49 using: ./bin/update_pch svx svxcore --cutoff=7 --exclude:system --include:module --exclude:local If after updating build fails, use the following command to locate conflicting headers: @@ -61,12 +61,10 @@ #include <osl/getglobalmutex.hxx> #include <osl/interlck.h> #include <osl/mutex.hxx> -#include <osl/process.h> #include <osl/thread.h> #include <osl/time.h> #include <rtl/alloc.h> #include <rtl/character.hxx> -#include <rtl/crc.h> #include <rtl/instance.hxx> #include <rtl/locale.h> #include <rtl/math.h> @@ -93,7 +91,6 @@ #include <sal/saldllapi.h> #include <sal/types.h> #include <sal/typesizes.h> -#include <vcl/AccessibleBrowseBoxObjType.hxx> #include <vcl/EnumContext.hxx> #include <vcl/GraphicExternalLink.hxx> #include <vcl/NotebookBarAddonsMerger.hxx> @@ -124,7 +121,6 @@ #include <vcl/gfxlink.hxx> #include <vcl/graph.hxx> #include <vcl/graphicfilter.hxx> -#include <vcl/headbar.hxx> #include <vcl/idle.hxx> #include <vcl/image.hxx> #include <vcl/keycod.hxx> @@ -145,6 +141,7 @@ #include <vcl/task.hxx> #include <vcl/textfilter.hxx> #include <vcl/timer.hxx> +#include <vcl/toolbox.hxx> #include <vcl/transfer.hxx> #include <vcl/vclenum.hxx> #include <vcl/vclevent.hxx> @@ -331,7 +328,6 @@ #include <editeng/writingmodeitem.hxx> #include <i18nlangtag/i18nlangtagdllapi.h> #include <i18nlangtag/lang.h> -#include <i18nlangtag/languagetag.hxx> #include <libxml/xmlwriter.h> #include <o3tl/cow_wrapper.hxx> #include <o3tl/deleter.hxx> @@ -386,7 +382,6 @@ #include <tools/helpers.hxx> #include <tools/link.hxx> #include <tools/mapunit.hxx> -#include <tools/poly.hxx> #include <tools/ref.hxx> #include <tools/solar.h> #include <tools/stream.hxx> @@ -415,7 +410,6 @@ #endif // PCH_LEVEL >= 3 #if PCH_LEVEL >= 4 #include <svx/XPropertyTable.hxx> -#include <svx/cube3d.hxx> #include <svx/dialmgr.hxx> #include <svx/e3dsceneupdater.hxx> #include <svx/extrud3d.hxx> @@ -458,7 +452,6 @@ #include <svx/sdtfchim.hxx> #include <svx/sdynitm.hxx> #include <svx/selectioncontroller.hxx> -#include <svx/sphere3d.hxx> #include <svx/svddef.hxx> #include <svx/svddrag.hxx> #include <svx/svdedtv.hxx> diff --git a/svx/source/gallery2/GalleryControl.cxx b/svx/source/gallery2/GalleryControl.cxx index c3fc9a1cbcef..89ae895a967d 100644 --- a/svx/source/gallery2/GalleryControl.cxx +++ b/svx/source/gallery2/GalleryControl.cxx @@ -23,43 +23,23 @@ #include <svx/gallery1.hxx> #include "galbrws1.hxx" #include <galbrws2.hxx> -#include "GallerySplitter.hxx" #include <vcl/svapp.hxx> #include <vcl/settings.hxx> #include <sfx2/sidebar/Theme.hxx> namespace svx::sidebar { -static const sal_Int32 gnInitialVerticalSplitPosition (150); - -GalleryControl::GalleryControl ( - vcl::Window* pParentWindow) - : Window(pParentWindow, WB_SIZEABLE|WB_MOVEABLE|WB_CLOSEABLE|WB_HIDE), - mpGallery (Gallery::GetGalleryInstance()), - mpSplitter(VclPtr<GallerySplitter>::Create( - this, - WB_HSCROLL, - [this] () { return this->InitSettings(); })), - mpBrowser1(VclPtr<GalleryBrowser1>::Create( - this, +GalleryControl::GalleryControl(vcl::Window* pParent) + : PanelLayout(pParent, "GalleryPanel", "svx/ui/sidebargallery.ui", nullptr, true) + , mpGallery(Gallery::GetGalleryInstance()) + , mxBrowser1(new GalleryBrowser1( + *m_xBuilder, mpGallery, - [this] (KeyEvent const& rEvent, vcl::Window *const /*pWindow*/) - { return this->GalleryKeyInput(rEvent); }, [this] () - { return mpBrowser2->SelectTheme(mpBrowser1->GetSelectedTheme()); })), - mpBrowser2(VclPtr<GalleryBrowser2>::Create(this, mpGallery)), - mbIsInitialResize(true) + { return mxBrowser2->SelectTheme(mxBrowser1->GetSelectedTheme()); })) + , mxBrowser2(new GalleryBrowser2(*m_xBuilder, mpGallery)) { - mpBrowser1->SelectTheme(0); - mpBrowser1->Show(); - - mpBrowser2->Show(); - - mpSplitter->SetHorizontal(false); - mpSplitter->SetSplitHdl( LINK( this, GalleryControl, SplitHdl ) ); - mpSplitter->Show(); - - InitSettings(); + mxBrowser1->SelectTheme(0); } GalleryControl::~GalleryControl() @@ -69,176 +49,18 @@ GalleryControl::~GalleryControl() void GalleryControl::dispose() { - mpBrowser2.disposeAndClear(); - mpBrowser1.disposeAndClear(); - mpSplitter.disposeAndClear(); - vcl::Window::dispose(); -} - -void GalleryControl::InitSettings() -{ - SetBackground( Wallpaper( GALLERY_DLG_COLOR ) ); - SetControlBackground( GALLERY_DLG_COLOR ); - SetControlForeground( GALLERY_DLG_COLOR ); - - mpSplitter->SetBackground( Wallpaper( GALLERY_DLG_COLOR ) ); - mpSplitter->SetControlBackground( GALLERY_DLG_COLOR ); - mpSplitter->SetControlForeground( GALLERY_DLG_COLOR ); - - mpBrowser1->SetBackground( Wallpaper( GALLERY_DLG_COLOR ) ); - mpBrowser1->SetControlBackground( GALLERY_DLG_COLOR ); - mpBrowser1->SetControlForeground( GALLERY_DLG_COLOR ); - - mpBrowser2->SetBackground( Wallpaper( GALLERY_DLG_COLOR ) ); - mpBrowser2->SetControlBackground( GALLERY_DLG_COLOR ); - mpBrowser2->SetControlForeground( GALLERY_DLG_COLOR ); - - const Wallpaper aBackground (sfx2::sidebar::Theme::GetWallpaper(sfx2::sidebar::Theme::Paint_PanelBackground)); - mpSplitter->SetBackground(aBackground); - SetBackground(aBackground); - mpBrowser2->SetBackground(aBackground); -} - -void GalleryControl::Resize() -{ - // call parent - Window::Resize(); - - // update hor/ver - const Size aNewSize( GetOutputSizePixel() ); - if (aNewSize.Width()<=0 || aNewSize.Height()<=0) - return; - - const bool bNewLayoutHorizontal(aNewSize.Width() > aNewSize.Height()); - const bool bOldLayoutHorizontal(mpSplitter->IsHorizontal()); - long nSplitPos( bOldLayoutHorizontal ? mpSplitter->GetPosPixel().X() : mpSplitter->GetPosPixel().Y()); - const long nSplitSize( bOldLayoutHorizontal ? mpSplitter->GetOutputSizePixel().Width() : mpSplitter->GetOutputSizePixel().Height()); - - if(bNewLayoutHorizontal != bOldLayoutHorizontal) - { - mpSplitter->SetHorizontal(bNewLayoutHorizontal); - } - else - { - if (mbIsInitialResize) - { - nSplitPos = gnInitialVerticalSplitPosition; - if (nSplitPos > aNewSize.Height()/2) - nSplitPos = aNewSize.Height()/2; - } - } - mbIsInitialResize = false; - - const long nFrameLen = LogicToPixel(Size(3, 0), MapMode(MapUnit::MapAppFont)).Width(); - const long nFrameLen2 = nFrameLen << 1; - - if(bNewLayoutHorizontal) - { - mpBrowser1->SetPosSizePixel( - Point( nFrameLen, nFrameLen ), - Size(nSplitPos - nFrameLen, aNewSize.Height() - nFrameLen2) ); - - mpSplitter->SetPosSizePixel( - Point( nSplitPos, 0), - Size( nSplitSize, aNewSize.Height() ) ); - - mpSplitter->SetDragRectPixel( - tools::Rectangle( - Point( nFrameLen2, 0 ), - Size( aNewSize.Width() - ( nFrameLen2 << 1 ) - nSplitSize, aNewSize.Height() ) ) ); - - mpBrowser2->SetPosSizePixel( - Point( nSplitPos + nSplitSize, nFrameLen ), - Size( aNewSize.Width() - nSplitSize - nSplitPos - nFrameLen, aNewSize.Height() - nFrameLen2 ) ); - } - else - { - mpBrowser1->SetPosSizePixel( - Point( nFrameLen, nFrameLen ), - Size(aNewSize.Width() - nFrameLen2, nSplitPos - nFrameLen)); - - mpSplitter->SetPosSizePixel( - Point( 0, nSplitPos), - Size( aNewSize.Width(), nSplitSize ) ); - - mpSplitter->SetDragRectPixel( - tools::Rectangle( - Point( 0, nFrameLen2 ), - Size( aNewSize.Width(), aNewSize.Height() - ( nFrameLen2 << 1 ) - nSplitSize ) )); - - mpBrowser2->SetPosSizePixel( - Point( nFrameLen, nSplitPos + nSplitSize ), - Size( aNewSize.Width() - nFrameLen2, aNewSize.Height() - nSplitSize - nSplitPos - nFrameLen )); - } -} - -bool GalleryControl::GalleryKeyInput( const KeyEvent& rKEvt ) -{ - const sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode(); - bool bRet = ( !rKEvt.GetKeyCode().IsMod1() && - ( ( KEY_TAB == nCode ) || ( KEY_F6 == nCode && rKEvt.GetKeyCode().IsMod2() ) ) ); - - if( bRet ) - { - if( !rKEvt.GetKeyCode().IsShift() ) - { - if( mpBrowser1->maNewTheme->HasFocus() ) - mpBrowser1->mpThemes->GrabFocus(); - else if( mpBrowser1->mpThemes->HasChildPathFocus( true ) ) - mpBrowser2->maViewBox->GrabFocus(); - else if( mpBrowser2->maViewBox->HasFocus() ) - mpBrowser2->GetViewWindow()->GrabFocus(); - else - { - if( mpBrowser1->maNewTheme->IsEnabled() ) - mpBrowser1->maNewTheme->GrabFocus(); - else - mpBrowser1->mpThemes->GrabFocus(); - } - } - else - { - if( mpBrowser2->GetViewWindow()->HasFocus() ) - mpBrowser2->maViewBox->GrabFocus(); - else if( mpBrowser2->maViewBox->HasFocus() ) - mpBrowser1->mpThemes->GrabFocus(); - else if( mpBrowser1->mpThemes->HasChildPathFocus( true ) ) - { - if( mpBrowser1->maNewTheme->IsEnabled() ) - mpBrowser1->maNewTheme->GrabFocus(); - else - mpBrowser2->GetViewWindow()->GrabFocus(); - } - else - mpBrowser2->GetViewWindow()->GrabFocus(); - } - } - - return bRet; + mxBrowser2.reset(); + mxBrowser1.reset(); + PanelLayout::dispose(); } void GalleryControl::GetFocus() { Window::GetFocus(); - if (mpBrowser1) - mpBrowser1->GrabFocus(); -} - -IMPL_LINK_NOARG( GalleryControl, SplitHdl, Splitter*, void ) -{ - if(mpSplitter->IsHorizontal()) - { - mpSplitter->SetPosPixel( Point( mpSplitter->GetSplitPosPixel(), mpSplitter->GetPosPixel().Y() ) ); - } - else - { - mpSplitter->SetPosPixel( Point( mpSplitter->GetPosPixel().X(), mpSplitter->GetSplitPosPixel() ) ); - } - - Resize(); + if (mxBrowser1) + mxBrowser1->GrabFocus(); } - } // end of namespace svx::sidebar /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/gallery2/GallerySplitter.cxx b/svx/source/gallery2/GallerySplitter.cxx deleted file mode 100644 index 21dc47c72b89..000000000000 --- a/svx/source/gallery2/GallerySplitter.cxx +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "GallerySplitter.hxx" - -GallerySplitter::GallerySplitter( - vcl::Window* pParent, - WinBits nStyle, - const ::std::function<void ()>& rDataChangeFunctor) - : Splitter(pParent, nStyle) - , maDataChangeFunctor(rDataChangeFunctor) -{ -} - -void GallerySplitter::DataChanged( const DataChangedEvent& rDCEvt ) -{ - Splitter::DataChanged( rDCEvt ); - if (maDataChangeFunctor) - maDataChangeFunctor(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/gallery2/GallerySplitter.hxx b/svx/source/gallery2/GallerySplitter.hxx deleted file mode 100644 index 8c6e05f15ab7..000000000000 --- a/svx/source/gallery2/GallerySplitter.hxx +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_SVX_SOURCE_GALLERY2_GALLERYSPLITTER_HXX -#define INCLUDED_SVX_SOURCE_GALLERY2_GALLERYSPLITTER_HXX - -#include <vcl/split.hxx> - -#include <functional> - -class GallerySplitter : public Splitter -{ -public: - GallerySplitter( - vcl::Window* pParent, - WinBits nStyle, - const ::std::function<void ()>& rDataChangeFunctor); - -protected: - virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; - -private: - ::std::function<void ()> const maDataChangeFunctor; -}; - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/gallery2/galbrws1.cxx b/svx/source/gallery2/galbrws1.cxx index 8a435a5c31df..aefb42511d1f 100644 --- a/svx/source/gallery2/galbrws1.cxx +++ b/svx/source/gallery2/galbrws1.cxx @@ -47,126 +47,53 @@ using namespace ::com::sun::star; - -GalleryButton::GalleryButton( GalleryBrowser1* pParent, WinBits nWinBits ) : - PushButton( pParent, nWinBits ) -{ -} - -void GalleryButton::KeyInput( const KeyEvent& rKEvt ) -{ - if( !static_cast< GalleryBrowser1* >( GetParent() )->KeyInput( rKEvt, this ) ) - PushButton::KeyInput( rKEvt ); -} - - -GalleryThemeListBox::GalleryThemeListBox( GalleryBrowser1* pParent, WinBits nWinBits ) : - ListBox( pParent, nWinBits ) -{ - InitSettings(); -} - -void GalleryThemeListBox::InitSettings() -{ - SetBackground( Wallpaper( GALLERY_BG_COLOR ) ); - SetControlBackground( GALLERY_BG_COLOR ); - SetControlForeground( GALLERY_FG_COLOR ); -} - -void GalleryThemeListBox::DataChanged( const DataChangedEvent& rDCEvt ) -{ - if ( ( rDCEvt.GetType() == DataChangedEventType::SETTINGS ) && ( rDCEvt.GetFlags() & AllSettingsFlags::STYLE ) ) - InitSettings(); - else - ListBox::DataChanged( rDCEvt ); -} - -bool GalleryThemeListBox::PreNotify( NotifyEvent& rNEvt ) -{ - bool bDone = false; - - if( rNEvt.GetType() == MouseNotifyEvent::COMMAND ) - { - const CommandEvent* pCEvt = rNEvt.GetCommandEvent(); - - if( pCEvt && pCEvt->GetCommand() == CommandEventId::ContextMenu ) - static_cast< GalleryBrowser1* >( GetParent() )->ShowContextMenu(); - } - else if( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT ) - { - const KeyEvent* pKEvt = rNEvt.GetKeyEvent(); - - if( pKEvt ) - bDone = static_cast< GalleryBrowser1* >( GetParent() )->KeyInput( *pKEvt, this ); - } - - return( bDone || ListBox::PreNotify( rNEvt ) ); -} - - GalleryBrowser1::GalleryBrowser1( - vcl::Window* pParent, + weld::Builder& rBuilder, Gallery* pGallery, - const std::function<sal_Bool (const KeyEvent&,Window*)>& rKeyInputHandler, const std::function<void ()>& rThemeSlectionHandler) : - Control ( pParent, WB_TABSTOP ), - maNewTheme ( VclPtr<GalleryButton>::Create(this, WB_3DLOOK) ), - mpThemes ( VclPtr<GalleryThemeListBox>::Create( this, WB_TABSTOP | WB_3DLOOK | WB_BORDER | WB_HSCROLL | WB_VSCROLL | WB_AUTOHSCROLL | WB_SORT ) ), + mxNewTheme(rBuilder.weld_button("insert")), + mxThemes(rBuilder.weld_tree_view("themelist")), mpGallery ( pGallery ), mpExchangeData ( new ExchangeData ), - aImgNormal ( GalleryResGetBitmapEx( RID_SVXBMP_THEME_NORMAL ) ), - aImgDefault ( GalleryResGetBitmapEx( RID_SVXBMP_THEME_DEFAULT ) ), - aImgReadOnly ( GalleryResGetBitmapEx( RID_SVXBMP_THEME_READONLY ) ), - maKeyInputHandler(rKeyInputHandler), + aImgNormal ( RID_SVXBMP_THEME_NORMAL ), + aImgDefault ( RID_SVXBMP_THEME_DEFAULT ), + aImgReadOnly ( RID_SVXBMP_THEME_READONLY ), maThemeSlectionHandler(rThemeSlectionHandler) { - StartListening( *mpGallery ); + mxNewTheme->set_help_id(HID_GALLERY_NEWTHEME); + mxNewTheme->connect_clicked( LINK( this, GalleryBrowser1, ClickNewThemeHdl ) ); - maNewTheme->SetHelpId( HID_GALLERY_NEWTHEME ); - maNewTheme->SetText( SvxResId(RID_SVXSTR_GALLERY_CREATETHEME)); - maNewTheme->SetClickHdl( LINK( this, GalleryBrowser1, ClickNewThemeHdl ) ); + mxThemes->make_sorted(); + mxThemes->set_help_id( HID_GALLERY_THEMELIST ); + mxThemes->connect_changed( LINK( this, GalleryBrowser1, SelectThemeHdl ) ); + mxThemes->connect_popup_menu(LINK(this, GalleryBrowser1, PopupMenuHdl)); + mxThemes->connect_key_press(LINK(this, GalleryBrowser1, KeyInputHdl)); + mxThemes->set_size_request(-1, mxThemes->get_height_rows(6)); // disable creation of new themes if a writable directory is not available if( mpGallery->GetUserURL().GetProtocol() == INetProtocol::NotValid ) - maNewTheme->Disable(); + mxNewTheme->set_sensitive(false); - mpThemes->SetHelpId( HID_GALLERY_THEMELIST ); - mpThemes->SetSelectHdl( LINK( this, GalleryBrowser1, SelectThemeHdl ) ); - mpThemes->SetAccessibleName(SvxResId(RID_SVXSTR_GALLERYPROPS_GALTHEME)); + StartListening( *mpGallery ); - for( size_t i = 0, nCount = mpGallery->GetThemeCount(); i < nCount; i++ ) + for (size_t i = 0, nCount = mpGallery->GetThemeCount(); i < nCount; ++i) ImplInsertThemeEntry( mpGallery->GetThemeInfo( i ) ); - - ImplAdjustControls(); - maNewTheme->Show(); - mpThemes->Show(); } GalleryBrowser1::~GalleryBrowser1() -{ - disposeOnce(); -} - -void GalleryBrowser1::dispose() { EndListening( *mpGallery ); - mpThemePropertiesDialog.clear(); - mpThemes.disposeAndClear(); mpExchangeData.reset(); - maNewTheme.disposeAndClear(); - Control::dispose(); } -sal_uIntPtr GalleryBrowser1::ImplInsertThemeEntry( const GalleryThemeEntry* pEntry ) +void GalleryBrowser1::ImplInsertThemeEntry( const GalleryThemeEntry* pEntry ) { static const bool bShowHiddenThemes = ( getenv( "GALLERY_SHOW_HIDDEN_THEMES" ) != nullptr ); - sal_uIntPtr nRet = LISTBOX_ENTRY_NOTFOUND; - if( pEntry && ( !pEntry->IsHidden() || bShowHiddenThemes ) ) { - const Image* pImage; + const OUString* pImage; if( pEntry->IsReadOnly() ) pImage = &aImgReadOnly; @@ -175,23 +102,8 @@ sal_uIntPtr GalleryBrowser1::ImplInsertThemeEntry( const GalleryThemeEntry* pEnt else pImage = &aImgNormal; - nRet = mpThemes->InsertEntry( pEntry->GetThemeName(), *pImage ); + mxThemes->append("", pEntry->GetThemeName(), *pImage); } - - return nRet; -} - -void GalleryBrowser1::ImplAdjustControls() -{ - const Size aOutSize( GetOutputSizePixel() ); - const long nNewThemeHeight = LogicToPixel(Size(0, 14), MapMode(MapUnit::MapAppFont)).Height(); - const long nStartY = nNewThemeHeight + 4; - - maNewTheme->SetPosSizePixel( Point(), - Size( aOutSize.Width(), nNewThemeHeight ) ); - - mpThemes->SetPosSizePixel( Point( 0, nStartY ), - Size( aOutSize.Width(), aOutSize.Height() - nStartY ) ); } void GalleryBrowser1::ImplFillExchangeData( const GalleryTheme* pThm, ExchangeData& rData ) @@ -267,18 +179,20 @@ void GalleryBrowser1::ImplGalleryThemeProperties( const OUString & rThemeName, b ImplFillExchangeData( pTheme, *mpExchangeData ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - mpThemePropertiesDialog = pFact->CreateGalleryThemePropertiesDialog(GetFrameWeld(), mpExchangeData.get(), mpThemePropsDlgItemSet.get()); + VclPtr<VclAbstractDialog> xThemePropertiesDialog = pFact->CreateGalleryThemePropertiesDialog(mxThemes.get(), mpExchangeData.get(), mpThemePropsDlgItemSet.get()); if ( bCreateNew ) { - mpThemePropertiesDialog->StartExecuteAsync([this](sal_Int32 nResult){ + xThemePropertiesDialog->StartExecuteAsync([xThemePropertiesDialog, this](sal_Int32 nResult){ EndNewThemePropertiesDlgHdl(nResult); + xThemePropertiesDialog->disposeOnce(); }); } else { - mpThemePropertiesDialog->StartExecuteAsync([this](sal_Int32 nResult){ + xThemePropertiesDialog->StartExecuteAsync([xThemePropertiesDialog, this](sal_Int32 nResult){ EndThemePropertiesDlgHdl(nResult); + xThemePropertiesDialog->disposeOnce(); }); } } @@ -304,8 +218,8 @@ void GalleryBrowser1::ImplEndGalleryThemeProperties(bool bCreateNew, sal_Int32 n if ( bCreateNew ) { - mpThemes->SelectEntry( mpExchangeData->pTheme->GetName() ); - SelectThemeHdl( *mpThemes ); + mxThemes->select_text( mpExchangeData->pTheme->GetName() ); + SelectThemeHdl( *mxThemes ); } } @@ -316,9 +230,6 @@ void GalleryBrowser1::ImplEndGalleryThemeProperties(bool bCreateNew, sal_Int32 n { mpGallery->RemoveTheme( aThemeName ); } - - // destroy mpThemeProps asynchronously - Application::PostUserEvent( LINK( this, GalleryBrowser1, DestroyThemePropertiesDlgHdl ), nullptr, true ); } void GalleryBrowser1::EndNewThemePropertiesDlgHdl(sal_Int32 nResult) @@ -331,12 +242,6 @@ void GalleryBrowser1::EndThemePropertiesDlgHdl(sal_Int32 nResult) ImplEndGalleryThemeProperties(false, nResult); } -IMPL_LINK( GalleryBrowser1, DestroyThemePropertiesDlgHdl, void*, /*p*/, void ) -{ - mpThemePropertiesDialog.disposeAndClear(); - mpThemePropsDlgItemSet.reset(); -} - void GalleryBrowser1::ImplExecute(const OString &rIdent) { if (rIdent == "update") @@ -344,17 +249,17 @@ void GalleryBrowser1::ImplExecute(const OString &rIdent) GalleryTheme* pTheme = mpGallery->AcquireTheme( GetSelectedTheme(), *this ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<VclAbstractDialog> aActualizeProgress(pFact->CreateActualizeProgressDialog(GetFrameWeld(), pTheme)); + ScopedVclPtr<VclAbstractDialog> aActualizeProgress(pFact->CreateActualizeProgressDialog(mxThemes.get(), pTheme)); aActualizeProgress->Execute(); mpGallery->ReleaseTheme( pTheme, *this ); } else if (rIdent == "delete") { - std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "svx/ui/querydeletethemedialog.ui")); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(mxThemes.get(), "svx/ui/querydeletethemedialog.ui")); std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("QueryDeleteThemeDialog")); if (xQuery->run() == RET_YES) - mpGallery->RemoveTheme( mpThemes->GetSelectedEntry() ); + mpGallery->RemoveTheme( mxThemes->get_selected_text() ); } else if (rIdent == "rename") { @@ -362,7 +267,7 @@ void GalleryBrowser1::ImplExecute(const OString &rIdent) const OUString aOldName( pTheme->GetName() ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractTitleDialog> aDlg(pFact->CreateTitleDialog(GetFrameWeld(), aOldName)); + ScopedVclPtr<AbstractTitleDialog> aDlg(pFact->CreateTitleDialog(mxThemes.get(), aOldName)); if( aDlg->Execute() == RET_OK ) { @@ -391,7 +296,7 @@ void GalleryBrowser1::ImplExecute(const OString &rIdent) { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractGalleryIdDialog> aDlg(pFact->CreateGalleryIdDialog(GetFrameWeld(), pTheme)); + ScopedVclPtr<AbstractGalleryIdDialog> aDlg(pFact->CreateGalleryIdDialog(mxThemes.get(), pTheme)); if( aDlg->Execute() == RET_OK ) pTheme->SetId( aDlg->GetId(), true ); } @@ -404,19 +309,12 @@ void GalleryBrowser1::ImplExecute(const OString &rIdent) } } -void GalleryBrowser1::Resize() +void GalleryBrowser1::GrabFocus() { - Control::Resize(); - ImplAdjustControls(); -} - -void GalleryBrowser1::GetFocus() -{ - Control::GetFocus(); - if( maNewTheme->IsEnabled() ) - maNewTheme->GrabFocus(); + if (mxNewTheme->get_sensitive()) + mxNewTheme->grab_focus(); else - mpThemes->GrabFocus(); + mxThemes->grab_focus(); } void GalleryBrowser1::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -431,41 +329,41 @@ void GalleryBrowser1::Notify( SfxBroadcaster&, const SfxHint& rHint ) case GalleryHintType::THEME_RENAMED: { - const sal_Int32 nCurSelectPos = mpThemes->GetSelectedEntryPos(); - const sal_Int32 nRenameEntryPos = mpThemes->GetEntryPos( rGalleryHint.GetThemeName() ); + const sal_Int32 nCurSelectPos = mxThemes->get_selected_index(); + const sal_Int32 nRenameEntryPos = mxThemes->find_text( rGalleryHint.GetThemeName() ); - mpThemes->RemoveEntry( rGalleryHint.GetThemeName() ); + mxThemes->remove_text( rGalleryHint.GetThemeName() ); ImplInsertThemeEntry( mpGallery->GetThemeInfo( rGalleryHint.GetStringData() ) ); if( nCurSelectPos == nRenameEntryPos ) { - mpThemes->SelectEntry( rGalleryHint.GetStringData() ); - SelectThemeHdl( *mpThemes ); + mxThemes->select_text( rGalleryHint.GetStringData() ); + SelectThemeHdl( *mxThemes ); } } break; case GalleryHintType::THEME_REMOVED: { - mpThemes->RemoveEntry( rGalleryHint.GetThemeName() ); + mxThemes->remove_text( rGalleryHint.GetThemeName() ); } break; case GalleryHintType::CLOSE_THEME: { - const sal_Int32 nCurSelectPos = mpThemes->GetSelectedEntryPos(); - const sal_Int32 nCloseEntryPos = mpThemes->GetEntryPos( rGalleryHint.GetThemeName() ); + const sal_Int32 nCurSelectPos = mxThemes->get_selected_index(); + const sal_Int32 nCloseEntryPos = mxThemes->find_text( rGalleryHint.GetThemeName() ); if( nCurSelectPos == nCloseEntryPos ) { - if( nCurSelectPos < ( mpThemes->GetEntryCount() - 1 ) ) - mpThemes->SelectEntryPos( nCurSelectPos + 1 ); + if( nCurSelectPos < ( mxThemes->n_children() - 1 ) ) + mxThemes->select( nCurSelectPos + 1 ); else if( nCurSelectPos ) - mpThemes->SelectEntryPos( nCurSelectPos - 1 ); + mxThemes->select( nCurSelectPos - 1 ); else - mpThemes->SetNoSelection(); + mxThemes->select(-1); - SelectThemeHdl( *mpThemes ); + SelectThemeHdl( *mxThemes ); } } break; @@ -475,121 +373,108 @@ void GalleryBrowser1::Notify( SfxBroadcaster&, const SfxHint& rHint ) } } -void GalleryBrowser1::ShowContextMenu() +void GalleryBrowser1::ShowContextMenu(const CommandEvent& rCEvt) { - Application::PostUserEvent( LINK( this, GalleryBrowser1, ShowContextMenuHdl ), this, true ); + PopupMenuHdl(rCEvt); } -bool GalleryBrowser1::KeyInput( const KeyEvent& rKEvt, vcl::Window* pWindow ) +IMPL_LINK(GalleryBrowser1, KeyInputHdl, const KeyEvent&, rKEvt, bool) { bool bRet = false; - if (maKeyInputHandler) - bRet = maKeyInputHandler(rKEvt, pWindow); - if( !bRet ) + std::vector<OString> aExecVector; + ImplGetExecuteVector(aExecVector); + OString sExecuteIdent; + bool bMod1 = rKEvt.GetKeyCode().IsMod1(); + + switch( rKEvt.GetKeyCode().GetCode() ) { - std::vector<OString> aExecVector; - ImplGetExecuteVector(aExecVector); - OString sExecuteIdent; - bool bMod1 = rKEvt.GetKeyCode().IsMod1(); + case KEY_INSERT: + ClickNewThemeHdl(*mxNewTheme); + break; - switch( rKEvt.GetKeyCode().GetCode() ) + case KEY_I: { - case KEY_INSERT: - ClickNewThemeHdl( nullptr ); - break; + if( bMod1 ) + ClickNewThemeHdl(*mxNewTheme); + } + break; - case KEY_I: - { - if( bMod1 ) - ClickNewThemeHdl( nullptr ); - } - break; + case KEY_U: + { + if( bMod1 ) + sExecuteIdent = "update"; + } + break; - case KEY_U: - { - if( bMod1 ) - sExecuteIdent = "update"; - } - break; + case KEY_DELETE: + sExecuteIdent = "delete"; + break; - case KEY_DELETE: + case KEY_D: + { + if( bMod1 ) sExecuteIdent = "delete"; - break; - - case KEY_D: - { - if( bMod1 ) - sExecuteIdent = "delete"; - } - break; - - case KEY_R: - { - if( bMod1 ) - sExecuteIdent = "rename"; - } - break; + } + break; - case KEY_RETURN: - { - if( bMod1 ) - sExecuteIdent = "properties"; - } - break; + case KEY_R: + { + if( bMod1 ) + sExecuteIdent = "rename"; } + break; - if (!sExecuteIdent.isEmpty() && (std::find( aExecVector.begin(), aExecVector.end(), sExecuteIdent) != aExecVector.end())) + case KEY_RETURN: { - ImplExecute(sExecuteIdent); - bRet = true; + if( bMod1 ) + sExecuteIdent = "properties"; } + break; + } + + if (!sExecuteIdent.isEmpty() && (std::find( aExecVector.begin(), aExecVector.end(), sExecuteIdent) != aExecVector.end())) + { + ImplExecute(sExecuteIdent); + bRet = true; } return bRet; } -IMPL_LINK_NOARG(GalleryBrowser1, ShowContextMenuHdl, void*, void) +IMPL_LINK(GalleryBrowser1, PopupMenuHdl, const CommandEvent&, rCEvt, bool) { + if (rCEvt.GetCommand() != CommandEventId::ContextMenu) + return false; + std::vector<OString> aExecVector; ImplGetExecuteVector(aExecVector); - if( aExecVector.empty() ) - return; - - VclBuilder aBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "svx/ui/gallerymenu1.ui", ""); - VclPtr<PopupMenu> aMenu(aBuilder.get_menu("menu")); + if (aExecVector.empty()) + return true; - aMenu->EnableItem( aMenu->GetItemId("update"), std::find( aExecVector.begin(), aExecVector.end(), "update" ) != aExecVector.end() ); - aMenu->EnableItem( aMenu->GetItemId("rename"), std::find( aExecVector.begin(), aExecVector.end(), "rename" ) != aExecVector.end() ); - aMenu->EnableItem( aMenu->GetItemId("delete"), std::find( aExecVector.begin(), aExecVector.end(), "delete" ) != aExecVector.end() ); - aMenu->EnableItem( aMenu->GetItemId("assign"), std::find( aExecVector.begin(), aExecVector.end(), "assign" ) != aExecVector.end() ); - aMenu->EnableItem( aMenu->GetItemId("properties"), std::find( aExecVector.begin(), aExecVector.end(), "properties" ) != aExecVector.end() ); - aMenu->SetSelectHdl( LINK( this, GalleryBrowser1, PopupMenuHdl ) ); - aMenu->RemoveDisabledEntries(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(mxThemes.get(), "svx/ui/gallerymenu1.ui")); + std::unique_ptr<weld::Menu> xMenu(xBuilder->weld_menu("menu")); - const tools::Rectangle aThemesRect( mpThemes->GetPosPixel(), mpThemes->GetOutputSizePixel() ); - Point aSelPos( mpThemes->GetBoundingRectangle( mpThemes->GetSelectedEntryPos() ).Center() ); + xMenu->set_visible("update", std::find( aExecVector.begin(), aExecVector.end(), "update" ) != aExecVector.end()); + xMenu->set_visible("rename", std::find( aExecVector.begin(), aExecVector.end(), "rename" ) != aExecVector.end()); + xMenu->set_visible("delete", std::find( aExecVector.begin(), aExecVector.end(), "delete" ) != aExecVector.end()); + xMenu->set_visible("assign", std::find( aExecVector.begin(), aExecVector.end(), "assign" ) != aExecVector.end()); + xMenu->set_visible("properties", std::find( aExecVector.begin(), aExecVector.end(), "properties" ) != aExecVector.end()); - aSelPos.setX( std::max( std::min( aSelPos.X(), aThemesRect.Right() ), aThemesRect.Left() ) ); - aSelPos.setY( std::max( std::min( aSelPos.Y(), aThemesRect.Bottom() ), aThemesRect.Top() ) ); + OString sCommand(xMenu->popup_at_rect(mxThemes.get(), tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1)))); + ImplExecute(sCommand); - aMenu->Execute( this, aSelPos ); -} - -IMPL_LINK( GalleryBrowser1, PopupMenuHdl, Menu*, pMenu, bool ) -{ - ImplExecute(pMenu->GetCurItemIdent()); - return false; + return true; } -IMPL_LINK_NOARG(GalleryBrowser1, SelectThemeHdl, ListBox&, void) +IMPL_LINK_NOARG(GalleryBrowser1, SelectThemeHdl, weld::TreeView&, void) { if (maThemeSlectionHandler) maThemeSlectionHandler(); } -IMPL_LINK_NOARG(GalleryBrowser1, ClickNewThemeHdl, Button*, void) +IMPL_LINK_NOARG(GalleryBrowser1, ClickNewThemeHdl, weld::Button&, void) { OUString aNewTheme( SvxResId(RID_SVXSTR_GALLERY_NEWTHEME) ); OUString aName( aNewTheme ); diff --git a/svx/source/gallery2/galbrws1.hxx b/svx/source/gallery2/galbrws1.hxx index 825d773801af..288ff6d804ff 100644 --- a/svx/source/gallery2/galbrws1.hxx +++ b/svx/source/gallery2/galbrws1.hxx @@ -31,31 +31,6 @@ class GalleryBrowser1; -class GalleryButton : public PushButton -{ -private: - - virtual void KeyInput( const KeyEvent& rKEvt ) override; - -public: - - GalleryButton( GalleryBrowser1* pParent, WinBits nWinBits ); -}; - - -class GalleryThemeListBox final : public ListBox -{ - void InitSettings(); - - virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; - virtual bool PreNotify( NotifyEvent& rNEvt ) override; - -public: - - GalleryThemeListBox( GalleryBrowser1* pParent, WinBits nWinBits ); -}; - - class Gallery; class GalleryThemeEntry; class GalleryTheme; @@ -65,31 +40,26 @@ class SfxItemSet; namespace svx { namespace sidebar { class GalleryControl; } } -class GalleryBrowser1 : public Control, public SfxListener +class GalleryBrowser1 final : public SfxListener { friend class GalleryBrowser; friend class svx::sidebar::GalleryControl; - friend class GalleryThemeListBox; - using Window::KeyInput; private: - VclPtr<GalleryButton> maNewTheme; - VclPtr<GalleryThemeListBox> mpThemes; - VclPtr<VclAbstractDialog> mpThemePropertiesDialog; // to keep it alive during execution - Gallery* mpGallery; + std::unique_ptr<weld::Button> mxNewTheme; + std::unique_ptr<weld::TreeView> mxThemes; + Gallery* mpGallery; std::unique_ptr<ExchangeData> mpExchangeData; - std::unique_ptr<SfxItemSet> mpThemePropsDlgItemSet; + std::unique_ptr<SfxItemSet> mpThemePropsDlgItemSet; - Image aImgNormal; - Image aImgDefault; - Image aImgReadOnly; + OUString aImgNormal; + OUString aImgDefault; + OUString aImgReadOnly; - ::std::function<sal_Bool (const KeyEvent&,Window*)> const maKeyInputHandler; ::std::function<void ()> const maThemeSlectionHandler; - void ImplAdjustControls(); - sal_uIntPtr ImplInsertThemeEntry( const GalleryThemeEntry* pEntry ); + void ImplInsertThemeEntry( const GalleryThemeEntry* pEntry ); static void ImplFillExchangeData( const GalleryTheme* pThm, ExchangeData& rData ); void ImplGetExecuteVector(std::vector<OString>& o_aExec); void ImplExecute(const OString &rIdent); @@ -98,33 +68,28 @@ private: void EndThemePropertiesDlgHdl(sal_Int32 nResult); void ImplEndGalleryThemeProperties(bool bCreateNew, sal_Int32 nResult); - // Control - virtual void Resize() override; - virtual void GetFocus() override; - // SfxListener virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; - DECL_LINK( ClickNewThemeHdl, Button*, void ); - DECL_LINK( SelectThemeHdl, ListBox&, void ); - DECL_LINK( ShowContextMenuHdl, void*, void ); - DECL_LINK( PopupMenuHdl, Menu*, bool ); - DECL_LINK( DestroyThemePropertiesDlgHdl, void*, void ); + DECL_LINK( ClickNewThemeHdl, weld::Button&, void ); + DECL_LINK( SelectThemeHdl, weld::TreeView&, void ); + DECL_LINK( PopupMenuHdl, const CommandEvent&, bool ); + DECL_LINK( KeyInputHdl, const KeyEvent&, bool ); public: GalleryBrowser1( - vcl::Window* pParent, + weld::Builder& rBuilder, Gallery* pGallery, - const ::std::function<sal_Bool (const KeyEvent&,Window*)>& rKeyInputHandler, const ::std::function<void ()>& rThemeSlectionHandler); - virtual ~GalleryBrowser1() override; - virtual void dispose() override; - void SelectTheme( sal_uInt16 nThemePos ) { mpThemes->SelectEntryPos( nThemePos ); SelectThemeHdl( *mpThemes ); } - OUString GetSelectedTheme() const { return mpThemes->GetEntryCount() ? mpThemes->GetSelectedEntry() : OUString(); } + ~GalleryBrowser1(); + + void SelectTheme( sal_uInt16 nThemePos ) { mxThemes->select( nThemePos ); SelectThemeHdl( *mxThemes ); } + OUString GetSelectedTheme() const { return mxThemes->get_selected_text(); } + void GrabFocus(); - void ShowContextMenu(); + void ShowContextMenu(const CommandEvent& rCEvt); bool KeyInput( const KeyEvent& rKEvt, vcl::Window* pWindow ); }; diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx index eb70b0d0a8a5..d973a43596a9 100644 --- a/svx/source/gallery2/galbrws2.cxx +++ b/svx/source/gallery2/galbrws2.cxx @@ -24,6 +24,7 @@ #include <svl/intitem.hxx> #include <svl/eitem.hxx> #include <vcl/transfer.hxx> +#include <vcl/virdev.hxx> #include <sfx2/bindings.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/viewfrm.hxx> @@ -59,9 +60,6 @@ #include <memory> #include <cppuhelper/implbase.hxx> -#define TBX_ID_ICON 1 -#define TBX_ID_LIST 2 - GalleryBrowserMode GalleryBrowser2::meInitMode = GALLERYBROWSERMODE_ICON; struct DispatchInfo @@ -109,10 +107,10 @@ private: const GalleryTheme* mpTheme; sal_uInt32 const mnObjectPos; bool const mbPreview; - VclBuilder maBuilder; - VclPtr<PopupMenu> mpPopupMenu; - VclPtr<PopupMenu> mpBackgroundPopup; - VclPtr<GalleryBrowser2> mpBrowser; + std::unique_ptr<weld::Builder> mxBuilder; + std::unique_ptr<weld::Menu> mxPopupMenu; + std::unique_ptr<weld::Menu> mxBackgroundPopup; + GalleryBrowser2* mpBrowser; typedef std::map< int, CommandInfo > CommandInfoMap; CommandInfoMap m_aCommandInfo; @@ -120,15 +118,16 @@ private: static void Execute( const CommandInfo &rCmdInfo, const css::uno::Sequence< css::beans::PropertyValue > &rArguments ); - DECL_LINK( MenuSelectHdl, Menu*, bool ); - DECL_LINK( BackgroundMenuSelectHdl, Menu*, bool ); + void MenuSelectHdl(const OString& rIdent); + void BackgroundMenuSelectHdl(sal_uInt16 nId); public: - GalleryThemePopup( const GalleryTheme* pTheme, - sal_uInt32 nObjectPos, - bool bPreview, - GalleryBrowser2* pBrowser ); + GalleryThemePopup(weld::Widget* pParent, + const GalleryTheme* pTheme, + sal_uInt32 nObjectPos, + bool bPreview, + GalleryBrowser2* pBrowser); - void ExecutePopup( vcl::Window *pParent, const ::Point &aPos ); + void ExecutePopup(weld::Widget* pParent, const ::Point &rPos); virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent &rEvent) override; virtual void SAL_CALL disposing( const css::lang::EventObject &rSource) override; @@ -136,6 +135,7 @@ public: GalleryThemePopup::GalleryThemePopup( + weld::Widget* pParent, const GalleryTheme* pTheme, sal_uInt32 nObjectPos, bool bPreview, @@ -143,13 +143,11 @@ GalleryThemePopup::GalleryThemePopup( : mpTheme( pTheme ) , mnObjectPos( nObjectPos ) , mbPreview( bPreview ) - , maBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "svx/ui/gallerymenu2.ui", "") - , mpPopupMenu(maBuilder.get_menu("menu")) - , mpBackgroundPopup( VclPtr<PopupMenu>::Create() ) + , mxBuilder(Application::CreateBuilder(pParent, "svx/ui/gallerymenu2.ui")) + , mxPopupMenu(mxBuilder->weld_menu("menu")) + , mxBackgroundPopup(mxBuilder->weld_menu("backgroundmenu")) , mpBrowser( pBrowser ) { - mpPopupMenu->SetPopupMenu(mpPopupMenu->GetItemId("background"), mpBackgroundPopup); - // SID_GALLERY_ENABLE_ADDCOPY m_aCommandInfo.emplace( SID_GALLERY_ENABLE_ADDCOPY, @@ -173,26 +171,26 @@ void SAL_CALL GalleryThemePopup::statusChanged( { if ( !rEvent.IsEnabled ) { - mpPopupMenu->EnableItem(mpPopupMenu->GetItemId("add"), false); + mxPopupMenu->set_visible("add", false); } } else if ( rURL == ".uno:BackgroundImage" ) { - mpBackgroundPopup->Clear(); + mxBackgroundPopup->clear(); if ( rEvent.IsEnabled ) { OUString sItem; css::uno::Sequence< OUString > sItems; if ( ( rEvent.State >>= sItem ) && sItem.getLength() ) { - mpBackgroundPopup->InsertItem( 1, sItem ); + mxBackgroundPopup->append(OUString::number(1), sItem); } else if ( ( rEvent.State >>= sItems ) && sItems.hasElements() ) { sal_uInt16 nId = 1; for ( const OUString& rStr : std::as_const(sItems) ) { - mpBackgroundPopup->InsertItem( nId, rStr ); + mxBackgroundPopup->append(OUString::number(nId), rStr); nId++; } } @@ -222,7 +220,7 @@ void GalleryThemePopup::Execute( } } -void GalleryThemePopup::ExecutePopup( vcl::Window *pWindow, const ::Point &aPos ) +void GalleryThemePopup::ExecutePopup(weld::Widget* pParent, const ::Point &rPos) { css::uno::Reference< css::frame::XStatusListener > xThis( this ); @@ -232,27 +230,27 @@ void GalleryThemePopup::ExecutePopup( vcl::Window *pWindow, const ::Point &aPos const_cast< GalleryTheme* >( mpTheme )->GetURL( mnObjectPos, aURL ); const bool bValidURL = ( aURL.GetProtocol() != INetProtocol::NotValid ); - mpPopupMenu->EnableItem(mpPopupMenu->GetItemId("add"), bValidURL && SgaObjKind::Sound != eObjKind); + mxPopupMenu->set_visible("add", bValidURL && SgaObjKind::Sound != eObjKind); - mpPopupMenu->EnableItem(mpPopupMenu->GetItemId("preview"), bValidURL); - mpPopupMenu->CheckItem("preview", mbPreview); + mxPopupMenu->set_visible("preview", bValidURL); + mxPopupMenu->set_active("preview", mbPreview); if( mpTheme->IsReadOnly() || !mpTheme->GetObjectCount() ) { - mpPopupMenu->EnableItem(mpPopupMenu->GetItemId("delete"), false); - mpPopupMenu->EnableItem(mpPopupMenu->GetItemId("title"), false); + mxPopupMenu->set_visible("delete", false); + mxPopupMenu->set_visible("title", false); if (mpTheme->IsReadOnly()) - mpPopupMenu->EnableItem(mpPopupMenu->GetItemId("paste"), false); + mxPopupMenu->set_visible("paste", false); if (!mpTheme->GetObjectCount()) - mpPopupMenu->EnableItem(mpPopupMenu->GetItemId("copy"), false); + mxPopupMenu->set_visible("copy", false); } else { ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits