summaryrefslogtreecommitdiff
path: root/sfx2/source/inc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-04-26 15:43:25 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-04-29 09:46:08 +0200
commitfe9a13dc0e6d1384416c2a2343223b33925fc925 (patch)
treea43a8ea0cc46407b8932dced64cf34d595f3b3e9 /sfx2/source/inc
parentcf36fe5eb41910c26d58fb25e54ccf2e0ee01365 (diff)
weld SfxTemplatePanelControl
Change-Id: Ib3f6d01ddec37afc3987423dc15ab84ad6475f37 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92942 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2/source/inc')
-rw-r--r--sfx2/source/inc/templdgi.hxx211
1 files changed, 64 insertions, 147 deletions
diff --git a/sfx2/source/inc/templdgi.hxx b/sfx2/source/inc/templdgi.hxx
index d707202a58ab..3647dce09d22 100644
--- a/sfx2/source/inc/templdgi.hxx
+++ b/sfx2/source/inc/templdgi.hxx
@@ -26,12 +26,10 @@ class SfxTemplateControllerItem;
#include <array>
#include <memory>
-#include <vcl/button.hxx>
#include <vcl/toolbox.hxx>
-#include <vcl/lstbox.hxx>
+#include <vcl/transfer.hxx>
#include <vcl/weld.hxx>
#include <svl/lstner.hxx>
-#include <vcl/treelistbox.hxx>
#include <svl/eitem.hxx>
#include <svl/style.hxx>
@@ -55,97 +53,6 @@ namespace com { namespace sun { namespace star { namespace frame {
class XModuleManager2;
}}}}
-class DropListBox_Impl : public SvTreeListBox
-{
-private:
- DECL_LINK(OnAsyncExecuteDrop, void *, void);
-
-protected:
- SfxCommonTemplateDialog_Impl* pDialog;
- sal_uInt16 nModifier;
-
-public:
- DropListBox_Impl(vcl::Window* pParent, WinBits nWinBits, SfxCommonTemplateDialog_Impl* pD)
- : SvTreeListBox(pParent, nWinBits)
- , pDialog(pD)
- , nModifier(0)
- {
- SetHighlightRange();
- }
-
- virtual void MouseButtonDown(const MouseEvent& rMEvt) override;
- virtual sal_Int8 AcceptDrop(const AcceptDropEvent& rEvt) override;
- using SvTreeListBox::ExecuteDrop;
- virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent& rEvt) override;
-
- sal_uInt16 GetModifier() const
- {
- return nModifier;
- }
-
- virtual bool EventNotify( NotifyEvent& rNEvt ) override;
- virtual void RequestHelp(const HelpEvent& rHEvt) override;
-};
-
-
-/** TreeListBox class for displaying the hierarchical view of the templates
-*/
-class StyleTreeListBox_Impl : public DropListBox_Impl
-{
-private:
- SvTreeListEntry* pCurEntry;
- Link<LinkParamNone*,void> aDoubleClickLink;
- Link<StyleTreeListBox_Impl&,bool> aDropLink;
- OUString aParent;
- OUString aStyle;
-
-protected:
- virtual bool EventNotify(NotifyEvent& rNEvt) override;
- virtual bool DoubleClickHdl() override;
- virtual bool ExpandingHdl() override;
- virtual void ExpandedHdl() override;
- virtual TriState NotifyMoving(
- SvTreeListEntry* pTarget, SvTreeListEntry* pEntry,
- SvTreeListEntry*& rpNewParent, sal_uLong& rNewChildPos) override;
-public:
- StyleTreeListBox_Impl( SfxCommonTemplateDialog_Impl* pParent, WinBits nWinStyle);
-
- void Recalc();
-
- void SetDoubleClickHdl(const Link<LinkParamNone*,void> &rLink)
- {
- aDoubleClickLink = rLink;
- }
- void SetDropHdl(const Link<StyleTreeListBox_Impl&,bool> &rLink)
- {
- aDropLink = rLink;
- }
-
- using SvTreeListBox::GetParent;
-
- const OUString& GetParent() const
- {
- return aParent;
- }
- const OUString& GetStyle() const
- {
- return aStyle;
- }
- void MakeExpanded_Impl(std::vector<OUString>& rEntries) const;
-
- virtual VclPtr<PopupMenu> CreateContextMenu() override;
-};
-
-class SfxActionListBox : public DropListBox_Impl
-{
-protected:
-public:
- SfxActionListBox( SfxCommonTemplateDialog_Impl* pParent, WinBits nWinBits );
-
- virtual VclPtr<PopupMenu> CreateContextMenu() override;
- void Recalc();
-};
-
enum class StyleFlags {
NONE=0, UpdateFamilyList=1, UpdateFamily=2
};
@@ -153,6 +60,8 @@ namespace o3tl {
template<> struct typed_flags<StyleFlags> : is_typed_flags<StyleFlags, 3> {};
}
+class TreeViewDropTarget;
+
class SfxCommonTemplateDialog_Impl : public SfxListener
{
private:
@@ -169,15 +78,14 @@ protected:
#define MAX_FAMILIES 6
#define COUNT_BOUND_FUNC 14
- friend class DropListBox_Impl;
friend class SfxTemplateControllerItem;
SfxBindings* pBindings;
std::array<std::unique_ptr<SfxTemplateControllerItem>, COUNT_BOUND_FUNC> pBoundItems;
VclPtr<vcl::Window> pWindow;
- std::unique_ptr<VclBuilder> mxBuilder;
- VclPtr<PopupMenu> mxMenu;
+ std::unique_ptr<weld::Builder> mxMenuBuilder;
+ std::unique_ptr<weld::Menu> mxMenu;
OString sLastItemIdent;
SfxModule* pModule;
std::unique_ptr<Idle> pIdle;
@@ -189,15 +97,18 @@ protected:
css::uno::Reference<css::frame::XModuleManager2> xModuleManager;
DeletionWatcher* m_pDeletionWatcher;
- VclPtr<SfxActionListBox> aFmtLb;
- VclPtr<StyleTreeListBox_Impl> pTreeBox;
- VclPtr<CheckBox> aPreviewCheckbox;
- VclPtr<ListBox> aFilterLb;
+ std::unique_ptr<weld::TreeView> mxFmtLb;
+ std::unique_ptr<weld::TreeView> mxTreeBox;
+ std::unique_ptr<weld::CheckButton> mxPreviewCheckbox;
+ std::unique_ptr<weld::ComboBox> mxFilterLb;
+ std::unique_ptr<TreeViewDropTarget> m_xTreeView1DropTargetHelper;
+ std::unique_ptr<TreeViewDropTarget> m_xTreeView2DropTargetHelper;
sal_uInt16 nActFamily; // Id in the ToolBox = Position - 1
sal_uInt16 nActFilter; // FilterIdx
SfxStyleSearchBits nAppFilter; // Filter, which has set the application (for automatic)
+ sal_uInt16 m_nModifier;
bool bDontUpdate :1;
bool bIsWater :1;
bool bUpdate :1;
@@ -211,32 +122,43 @@ protected:
bool bNewByExampleDisabled :1;
bool bUpdateByExampleDisabled :1;
bool bTreeDrag :1;
+ bool bAllowReParentDrop:1;
bool bHierarchical :1;
bool m_bWantHierarchical :1;
bool bBindingUpdate :1;
+ bool m_bNewHasMenu : 1;
+
+ void FmtSelect(weld::TreeView* pTreeView, bool bIsCallback);
+
+ DECL_LINK(FilterSelectHdl, weld::ComboBox&, void );
+ DECL_LINK(FmtSelectHdl, weld::TreeView&, void);
+ DECL_LINK(TreeListApplyHdl, weld::TreeView&, bool);
+ DECL_LINK(MousePressHdl, const MouseEvent&, bool);
+ DECL_LINK(TimeOut, Timer*, void );
+ DECL_LINK(PreviewHdl, weld::Button&, void);
+ DECL_LINK(PopupFlatMenuHdl, const CommandEvent&, bool);
+ DECL_LINK(PopupTreeMenuHdl, const CommandEvent&, bool);
+ DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
+ DECL_LINK(QueryTooltipHdl, const weld::TreeIter&, OUString);
+ DECL_LINK(OnAsyncExecuteDrop, void *, void);
+ DECL_LINK(DragBeginHdl, bool&, bool);
+ DECL_LINK(CustomRenderHdl, weld::TreeView::render_args, void);
+ DECL_STATIC_LINK(SfxCommonTemplateDialog_Impl, CustomGetSizeHdl, weld::TreeView::get_size_args, Size);
- DECL_LINK( FilterSelectHdl, ListBox&, void );
- DECL_LINK( FmtSelectHdl, SvTreeListBox*, void );
- DECL_LINK( ApplyHdl, LinkParamNone*, void );
- DECL_LINK( TreeListApplyHdl, SvTreeListBox*, bool );
- DECL_LINK( DropHdl, StyleTreeListBox_Impl&, bool );
- DECL_LINK( TimeOut, Timer*, void );
- DECL_LINK( PreviewHdl, Button*, void);
+ void DropHdl(const OUString& rStyle, const OUString& rParent);
- virtual void EnableItem(sal_uInt16 /*nMesId*/, bool /*bCheck*/ = true)
+ virtual void EnableItem(const OString& /*rMesId*/, bool /*bCheck*/ = true)
{}
- virtual void CheckItem(sal_uInt16 /*nMesId*/, bool /*bCheck*/ = true)
+ virtual void CheckItem(const OString& /*rMesId*/, bool /*bCheck*/ = true)
{}
- virtual bool IsCheckedItem(sal_uInt16 /*nMesId*/ )
+ virtual bool IsCheckedItem(const OString& /*rMesId*/ )
{
return true;
}
- virtual void LoadedFamilies()
- {}
void InvalidateBindings();
- virtual void InsertFamilyItem( sal_uInt16 nId, const SfxStyleFamilyItem& rItem ) = 0;
- virtual void EnableFamilyItem( sal_uInt16 nId, bool bEnabled ) = 0;
+ virtual void InsertFamilyItem(sal_uInt16 nId, const SfxStyleFamilyItem& rItem) = 0;
+ virtual void EnableFamilyItem(sal_uInt16 nId, bool bEnabled) = 0;
virtual void ClearFamilyList() = 0;
virtual void ReplaceUpdateButtonByMenu();
@@ -265,7 +187,7 @@ protected:
void SetWaterCanState( const SfxBoolItem* pItem );
bool IsSafeForWaterCan() const;
- void SelectStyle( const OUString& rStyle );
+ void SelectStyle(const OUString& rStyle, bool bIsCallback);
bool HasSelectedStyle() const;
void GetSelectedStyle() const;
void FillTreeBox();
@@ -280,7 +202,7 @@ protected:
void FamilySelect( sal_uInt16 nId, bool bPreviewRefresh = false );
void SetFamily(SfxStyleFamily nFamily);
- void ActionSelect( sal_uInt16 nId );
+ void ActionSelect(const OString& rId);
sal_Int32 LoadFactoryStyleFilter( SfxObjectShell const * i_pObjSh );
void SaveFactoryStyleFilter( SfxObjectShell const * i_pObjSh, sal_Int32 i_nFilter );
@@ -288,10 +210,10 @@ protected:
public:
- SfxCommonTemplateDialog_Impl( SfxBindings* pB, vcl::Window* );
+ SfxCommonTemplateDialog_Impl(SfxBindings* pB, vcl::Window*, weld::Builder* pBuilder);
virtual ~SfxCommonTemplateDialog_Impl() override;
- DECL_LINK( MenuSelectHdl, Menu*, bool );
+ void MenuSelect(const OString& rIdent);
DECL_LINK( MenuSelectAsyncHdl, void*, void );
virtual void EnableEdit( bool b )
@@ -335,56 +257,51 @@ public:
return pCurObjShell;
}
- // normally for derivates from SvTreeListBoxes, but in this case the dialog handles context menus
- VclPtr<PopupMenu> const & CreateContextMenu();
-};
+ sal_Int8 AcceptDrop(const AcceptDropEvent& rEvt, const DropTargetHelper& rHelper);
+ sal_Int8 ExecuteDrop(const ExecuteDropEvent& rEvt);
-class DropToolBox_Impl : public ToolBox, public DropTargetHelper
-{
- SfxTemplateDialog_Impl& rParent;
-protected:
- virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
- virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
-public:
- DropToolBox_Impl(vcl::Window* pParent, SfxTemplateDialog_Impl* pTemplateDialog);
+ void CreateContextMenu();
};
+class ToolbarDropTarget;
+class DropTargetHelper;
+
class SfxTemplateDialog_Impl : public SfxCommonTemplateDialog_Impl
{
private:
friend class SfxTemplateControllerItem;
- friend class DropToolBox_Impl;
friend class SfxTemplatePanelControl;
- VclPtr<vcl::Window> m_pFloat;
- VclPtr<DropToolBox_Impl> m_aActionTbL;
- VclPtr<ToolBox> m_aActionTbR;
+ std::unique_ptr<ToolbarDropTarget> m_xToolbarDropTargetHelper;
+ std::unique_ptr<weld::Toolbar> m_xActionTbL;
+ std::unique_ptr<weld::Toolbar> m_xActionTbR;
+ std::unique_ptr<weld::Menu> m_xToolMenu;
+ int m_nActionTbLVisible;
- DECL_LINK( ToolBoxLSelect, ToolBox*, void );
- DECL_LINK( ToolBoxRSelect, ToolBox*, void );
- DECL_LINK( ToolBoxRClick, ToolBox*, void );
- DECL_LINK( MenuSelectHdl, Menu*, bool );
+ void FillToolMenu();
+
+ DECL_LINK(ToolBoxLSelect, const OString&, void);
+ DECL_LINK(ToolBoxRSelect, const OString&, void);
+ DECL_LINK(ToolMenuSelectHdl, const OString&, void);
protected:
virtual void EnableEdit( bool ) override;
- virtual void EnableItem( sal_uInt16 nMesId, bool bCheck = true ) override;
- virtual void CheckItem( sal_uInt16 nMesId, bool bCheck = true ) override;
- virtual bool IsCheckedItem( sal_uInt16 nMesId ) override;
- virtual void LoadedFamilies() override;
- virtual void InsertFamilyItem( sal_uInt16 nId, const SfxStyleFamilyItem& rItem ) override;
- virtual void EnableFamilyItem( sal_uInt16 nId, bool bEnabled ) override;
+ virtual void EnableItem(const OString& rMesId, bool bCheck = true) override;
+ virtual void CheckItem(const OString& rMesId, bool bCheck = true) override;
+ virtual bool IsCheckedItem(const OString& rMesId) override;
+ virtual void InsertFamilyItem(sal_uInt16 nId, const SfxStyleFamilyItem& rItem) override;
+ virtual void EnableFamilyItem(sal_uInt16 nId, bool bEnabled) override;
virtual void ClearFamilyList() override;
virtual void ReplaceUpdateButtonByMenu() override;
- void Resize();
- Size GetMinOutputSizePixel();
-
public:
friend class SfxTemplateDialog;
SfxTemplateDialog_Impl( SfxBindings*, SfxTemplatePanelControl* pDlgWindow );
virtual ~SfxTemplateDialog_Impl() override;
+ sal_Int8 AcceptToolbarDrop(const AcceptDropEvent& rEvt, const DropTargetHelper& rHelper);
+
void Initialize();
};