diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-04-06 13:52:02 +0900 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-04-09 09:53:48 +0900 |
commit | 7e1d93056be5d43a6307dd75744cd006144f5cb8 (patch) | |
tree | 16bb1cb03bc5ce129a9d8d052077bbeb5f0c09e5 /sfx2/source | |
parent | 49a7470417d8ba32140b35318176e0e2593a66a5 (diff) |
cleanup templdgi
Change-Id: I1148321236ba3ea5ed3e8df478800686c40e00ea
Diffstat (limited to 'sfx2/source')
-rw-r--r-- | sfx2/source/inc/templdgi.hxx | 414 |
1 files changed, 238 insertions, 176 deletions
diff --git a/sfx2/source/inc/templdgi.hxx b/sfx2/source/inc/templdgi.hxx index 580f3ade0c2a..a983a7f130e1 100644 --- a/sfx2/source/inc/templdgi.hxx +++ b/sfx2/source/inc/templdgi.hxx @@ -57,70 +57,83 @@ private: protected: SfxCommonTemplateDialog_Impl* pDialog; - sal_uInt16 nModifier; + sal_uInt16 nModifier; public: - DropListBox_Impl( vcl::Window* pParent, const ResId& rId, SfxCommonTemplateDialog_Impl* pD ) + DropListBox_Impl(vcl::Window* pParent, const ResId& rId, SfxCommonTemplateDialog_Impl* pD) : SvTreeListBox(pParent, rId) , pDialog(pD) , nModifier(0) {} - DropListBox_Impl( vcl::Window* pParent, WinBits nWinBits, SfxCommonTemplateDialog_Impl* pD ) + + DropListBox_Impl(vcl::Window* pParent, WinBits nWinBits, SfxCommonTemplateDialog_Impl* pD) : SvTreeListBox(pParent, nWinBits) , pDialog(pD) , nModifier(0) {} - virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; - virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) SAL_OVERRIDE; + + virtual void MouseButtonDown(const MouseEvent& rMEvt) SAL_OVERRIDE; + virtual sal_Int8 AcceptDrop(const AcceptDropEvent& rEvt) SAL_OVERRIDE; using SvTreeListBox::ExecuteDrop; - virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) SAL_OVERRIDE; + virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent& rEvt) SAL_OVERRIDE; - sal_uInt16 GetModifier() const { return nModifier; } + sal_uInt16 GetModifier() const + { + return nModifier; + } - virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE; + virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE; }; typedef std::vector<OUString> ExpandedEntries_t; -/* [Description] - - TreeListBox class for displaying the hierarchical view of the templates +/** TreeListBox class for displaying the hierarchical view of the templates */ - class StyleTreeListBox_Impl : public DropListBox_Impl { private: - SvTreeListEntry* pCurEntry; - Link aDoubleClickLink; - Link aDropLink; - OUString aParent; - OUString aStyle; + SvTreeListEntry* pCurEntry; + Link aDoubleClickLink; + Link aDropLink; + OUString aParent; + OUString aStyle; protected: - virtual void Command( const CommandEvent& rMEvt ) SAL_OVERRIDE; - virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE; - virtual bool DoubleClickHdl() SAL_OVERRIDE; - virtual bool ExpandingHdl() SAL_OVERRIDE; - virtual void ExpandedHdl() SAL_OVERRIDE; - virtual TriState NotifyMoving(SvTreeListEntry* pTarget, - SvTreeListEntry* pEntry, - SvTreeListEntry*& rpNewParent, - sal_uIntPtr& rNewChildPos) SAL_OVERRIDE; + virtual void Command(const CommandEvent& rMEvt) SAL_OVERRIDE; + virtual bool Notify(NotifyEvent& rNEvt) SAL_OVERRIDE; + virtual bool DoubleClickHdl() SAL_OVERRIDE; + virtual bool ExpandingHdl() SAL_OVERRIDE; + virtual void ExpandedHdl() SAL_OVERRIDE; + virtual TriState NotifyMoving( + SvTreeListEntry* pTarget, SvTreeListEntry* pEntry, + SvTreeListEntry*& rpNewParent, sal_uIntPtr& rNewChildPos) SAL_OVERRIDE; public: StyleTreeListBox_Impl( SfxCommonTemplateDialog_Impl* pParent, WinBits nWinStyle = 0); - void SetDoubleClickHdl(const Link &rLink) { aDoubleClickLink = rLink; } - void SetDropHdl(const Link &rLink) { aDropLink = rLink; } + void SetDoubleClickHdl(const Link &rLink) + { + aDoubleClickLink = rLink; + } + void SetDropHdl(const Link &rLink) + { + aDropLink = rLink; + } + using SvTreeListBox::GetParent; - const OUString& GetParent() const { return aParent; } - const OUString& GetStyle() const { return aStyle; } - void MakeExpanded_Impl(ExpandedEntries_t& rEntries) const; + + const OUString& GetParent() const + { + return aParent; + } + const OUString& GetStyle() const + { + return aStyle; + } + void MakeExpanded_Impl(ExpandedEntries_t& rEntries) const; virtual PopupMenu* CreateContextMenu( void ) SAL_OVERRIDE; }; -// class SfxActionListBox ------------------------------------------------ - class SfxActionListBox : public DropListBox_Impl { protected: @@ -130,19 +143,18 @@ public: virtual PopupMenu* CreateContextMenu( void ) SAL_OVERRIDE; }; -// class SfxCommonTemplateDialog_Impl ------------------------------------ - class SfxCommonTemplateDialog_Impl : public SfxListener { private: class DeletionWatcher; friend class DeletionWatcher; + bool mbIgnoreSelect; - void ReadResource(); - void ClearResource(); + void ReadResource(); + void ClearResource(); void impl_clear(); - DeletionWatcher * impl_setDeletionWatcher(DeletionWatcher* pNewWatcher); + DeletionWatcher* impl_setDeletionWatcher(DeletionWatcher* pNewWatcher); protected: #define MAX_FAMILIES 5 @@ -154,109 +166,120 @@ protected: friend class DropListBox_Impl; friend class SfxTemplateControllerItem; - SfxBindings* pBindings; - SfxTemplateControllerItem* pBoundItems[COUNT_BOUND_FUNC]; - - vcl::Window* pWindow; - SfxModule* pModule; - Idle* pIdle; - - ResId* m_pStyleFamiliesId; - SfxStyleFamilies* pStyleFamilies; - SfxTemplateItem* pFamilyState[MAX_FAMILIES]; - SfxStyleSheetBasePool* pStyleSheetPool; - StyleTreeListBox_Impl* pTreeBox; - SfxObjectShell* pCurObjShell; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 > - xModuleManager; - DeletionWatcher* m_pDeletionWatcher; - - SfxActionListBox aFmtLb; - ListBox aFilterLb; - Size aSize; - - sal_uInt16 nActFamily; // Id in the ToolBox = Position - 1 - sal_uInt16 nActFilter; // FilterIdx - sal_uInt16 nAppFilter; // Filter, which has set the application (for automatic) - - bool bDontUpdate :1, - bIsWater :1, - bEnabled :1, - bUpdate :1, - bUpdateFamily :1, - bCanEdit :1, - bCanDel :1, - bCanNew :1, - bCanHide :1, - bCanShow :1, - bWaterDisabled :1, - bNewByExampleDisabled :1, - bUpdateByExampleDisabled:1, - bTreeDrag :1, - bHierarchical :1, - m_bWantHierarchical :1, - bBindingUpdate :1; - - DECL_LINK( FilterSelectHdl, ListBox * ); - DECL_LINK( FmtSelectHdl, SvTreeListBox * ); - DECL_LINK( ApplyHdl, Control * ); - DECL_LINK( DropHdl, StyleTreeListBox_Impl * ); - DECL_LINK( TimeOut, Timer * ); - - - virtual void EnableItem( sal_uInt16 /*nMesId*/, bool /*bCheck*/ = true ) {} - virtual void CheckItem( sal_uInt16 /*nMesId*/, bool /*bCheck*/ = true ) {} - virtual bool IsCheckedItem( sal_uInt16 /*nMesId*/ ) { return true; } - virtual void LoadedFamilies() {} - void Update() { UpdateStyles_Impl(UPDATE_FAMILY_LIST); } - void InvalidateBindings(); - virtual void InsertFamilyItem( sal_uInt16 nId, const SfxStyleFamilyItem* pIten ) = 0; - virtual void EnableFamilyItem( sal_uInt16 nId, bool bEnabled = true ) = 0; - virtual void ClearFamilyList() = 0; - virtual void ReplaceUpdateButtonByMenu(); - - void NewHdl( void* ); - void EditHdl( void* ); - void DeleteHdl( void* ); - void HideHdl( void* ); - void ShowHdl( void* ); - - bool Execute_Impl( sal_uInt16 nId, const OUString& rStr, const OUString& rRefStr, - sal_uInt16 nFamily, sal_uInt16 nMask = 0, - sal_uInt16* pIdx = NULL, const sal_uInt16* pModifier = NULL ); - - void UpdateStyles_Impl(sal_uInt16 nFlags); - const SfxStyleFamilyItem* GetFamilyItem_Impl() const; - bool IsInitialized() const { return nActFamily != 0xffff; } - void ResetFocus(); - void EnableDelete(); - void Initialize(); - void EnableHierarchical(bool); - - void FilterSelect( sal_uInt16 nFilterIdx, bool bForce = false ); - void SetFamilyState( sal_uInt16 nSlotId, const SfxTemplateItem* ); - void SetWaterCanState( const SfxBoolItem* pItem ); - - void SelectStyle( const OUString& rStyle ); - bool HasSelectedStyle() const; - SfxStyleSheetBase *GetSelectedStyle() const; - void FillTreeBox(); - void Update_Impl(); - void UpdateFamily_Impl(); + SfxBindings* pBindings; + SfxTemplateControllerItem* pBoundItems[COUNT_BOUND_FUNC]; + + vcl::Window* pWindow; + SfxModule* pModule; + Idle* pIdle; + + ResId* m_pStyleFamiliesId; + SfxStyleFamilies* pStyleFamilies; + SfxTemplateItem* pFamilyState[MAX_FAMILIES]; + SfxStyleSheetBasePool* pStyleSheetPool; + StyleTreeListBox_Impl* pTreeBox; + SfxObjectShell* pCurObjShell; + css::uno::Reference<css::frame::XModuleManager2> xModuleManager; + DeletionWatcher* m_pDeletionWatcher; + + SfxActionListBox aFmtLb; + ListBox aFilterLb; + Size aSize; + + sal_uInt16 nActFamily; // Id in the ToolBox = Position - 1 + sal_uInt16 nActFilter; // FilterIdx + sal_uInt16 nAppFilter; // Filter, which has set the application (for automatic) + + bool bDontUpdate :1; + bool bIsWater :1; + bool bEnabled :1; + bool bUpdate :1; + bool bUpdateFamily :1; + bool bCanEdit :1; + bool bCanDel :1; + bool bCanNew :1; + bool bCanHide :1; + bool bCanShow :1; + bool bWaterDisabled :1; + bool bNewByExampleDisabled :1; + bool bUpdateByExampleDisabled :1; + bool bTreeDrag :1; + bool bHierarchical :1; + bool m_bWantHierarchical :1; + bool bBindingUpdate :1; + + DECL_LINK( FilterSelectHdl, ListBox* ); + DECL_LINK( FmtSelectHdl, SvTreeListBox* ); + DECL_LINK( ApplyHdl, Control* ); + DECL_LINK( DropHdl, StyleTreeListBox_Impl* ); + DECL_LINK( TimeOut, Timer* ); + + virtual void EnableItem(sal_uInt16 /*nMesId*/, bool /*bCheck*/ = true) + {} + virtual void CheckItem(sal_uInt16 /*nMesId*/, bool /*bCheck*/ = true) + {} + virtual bool IsCheckedItem(sal_uInt16 /*nMesId*/ ) + { + return true; + } + virtual void LoadedFamilies() + {} + void Update() + { + UpdateStyles_Impl(UPDATE_FAMILY_LIST); + } + + void InvalidateBindings(); + virtual void InsertFamilyItem( sal_uInt16 nId, const SfxStyleFamilyItem* pItem ) = 0; + virtual void EnableFamilyItem( sal_uInt16 nId, bool bEnabled = true ) = 0; + virtual void ClearFamilyList() = 0; + virtual void ReplaceUpdateButtonByMenu(); + + void NewHdl( void* ); + void EditHdl( void* ); + void DeleteHdl( void* ); + void HideHdl( void* ); + void ShowHdl( void* ); + + bool Execute_Impl(sal_uInt16 nId, const OUString& rStr, const OUString& rRefStr, + sal_uInt16 nFamily, sal_uInt16 nMask = 0, + sal_uInt16* pIdx = NULL, const sal_uInt16* pModifier = NULL ); + + void UpdateStyles_Impl(sal_uInt16 nFlags); + const SfxStyleFamilyItem* GetFamilyItem_Impl() const; + bool IsInitialized() const + { + return nActFamily != 0xffff; + } + void ResetFocus(); + void EnableDelete(); + void Initialize(); + void EnableHierarchical(bool); + + void FilterSelect( sal_uInt16 nFilterIdx, bool bForce = false ); + void SetFamilyState( sal_uInt16 nSlotId, const SfxTemplateItem* ); + void SetWaterCanState( const SfxBoolItem* pItem ); + + void SelectStyle( const OUString& rStyle ); + bool HasSelectedStyle() const; + SfxStyleSheetBase* GetSelectedStyle() const; + void FillTreeBox(); + void Update_Impl(); + void UpdateFamily_Impl(); // In which FamilyState do I have to look , in order to get the // information of the ith Family in the pStyleFamilies. - sal_uInt16 StyleNrToInfoOffset( sal_uInt16 i ); + sal_uInt16 StyleNrToInfoOffset( sal_uInt16 i ); - void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE; + void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE; - void FamilySelect( sal_uInt16 nId ); - void SetFamily( sal_uInt16 nId ); - void ActionSelect( sal_uInt16 nId ); + void FamilySelect( sal_uInt16 nId ); + void SetFamily( sal_uInt16 nId ); + void ActionSelect( sal_uInt16 nId ); - sal_Int32 LoadFactoryStyleFilter( SfxObjectShell* i_pObjSh ); - void SaveFactoryStyleFilter( SfxObjectShell* i_pObjSh, sal_Int32 i_nFilter ); - SfxObjectShell * SaveSelection(); + sal_Int32 LoadFactoryStyleFilter( SfxObjectShell* i_pObjSh ); + void SaveFactoryStyleFilter( SfxObjectShell* i_pObjSh, sal_Int32 i_nFilter ); + SfxObjectShell* SaveSelection(); public: TYPEINFO_OVERRIDE(); @@ -266,28 +289,67 @@ public: DECL_LINK( MenuSelectHdl, Menu * ); - virtual void EnableEdit( bool b = true ) { bCanEdit = b; } - void EnableDel( bool b = true ) { bCanDel = b; } - void EnableNew( bool b = true ) { bCanNew = b; } - void EnableHide( bool b = true ) { bCanHide = b; } - void EnableShow( bool b = true ) { bCanShow = b; } - - vcl::Window* GetWindow() { return pWindow; } - - void EnableTreeDrag( bool b = true ); - void EnableExample_Impl( sal_uInt16 nId, bool bEnable ); - SfxStyleFamily GetActualFamily() const; - OUString GetSelectedEntry() const; - SfxObjectShell* GetObjectShell() const { return pCurObjShell; } - - inline bool CanEdit( void ) const { return bCanEdit; } - inline bool CanDel( void ) const { return bCanDel; } - inline bool CanNew( void ) const { return bCanNew; } - inline bool CanHide( void ) const { return bCanHide; } - inline bool CanShow( void ) const { return bCanShow; } + virtual void EnableEdit( bool b = true ) + { + bCanEdit = b; + } + void EnableDel( bool b = true ) + { + bCanDel = b; + } + void EnableNew( bool b = true ) + { + bCanNew = b; + } + void EnableHide( bool b = true ) + { + bCanHide = b; + } + void EnableShow( bool b = true ) + { + bCanShow = b; + } + + vcl::Window* GetWindow() + { + return pWindow; + } + + void EnableTreeDrag(bool b = true); + void EnableExample_Impl(sal_uInt16 nId, bool bEnable); + SfxStyleFamily GetActualFamily() const; + OUString GetSelectedEntry() const; + + SfxObjectShell* GetObjectShell() const + { + return pCurObjShell; + } + + inline bool CanEdit( void ) const + { + return bCanEdit; + } + inline bool CanDel( void ) const + { + return bCanDel; + } + inline bool CanNew( void ) const + { + return bCanNew; + } + + inline bool CanHide( void ) const + { + return bCanHide; + } + + inline bool CanShow( void ) const + { + return bCanShow; + } // normally for derivates from SvTreeListBoxes, but in this case the dialog handles context menus - PopupMenu* CreateContextMenu( void ); + PopupMenu* CreateContextMenu( void ); }; class DropToolBox_Impl : public ToolBox, public DropTargetHelper @@ -309,31 +371,31 @@ private: friend class SfxTemplatePanelControl; vcl::Window* m_pFloat; - bool m_bZoomIn; - DropToolBox_Impl m_aActionTbL; - ToolBox m_aActionTbR; + bool m_bZoomIn; + DropToolBox_Impl m_aActionTbL; + ToolBox m_aActionTbR; - DECL_LINK( ToolBoxLSelect, ToolBox * ); - DECL_LINK( ToolBoxRSelect, ToolBox * ); - DECL_LINK( ToolBoxRClick, ToolBox * ); + DECL_LINK( ToolBoxLSelect, ToolBox* ); + DECL_LINK( ToolBoxRSelect, ToolBox* ); + DECL_LINK( ToolBoxRClick, ToolBox* ); DECL_LINK( MenuSelectHdl, Menu* ); protected: - virtual void EnableEdit( bool = true ) SAL_OVERRIDE; - virtual void EnableItem( sal_uInt16 nMesId, bool bCheck = true ) SAL_OVERRIDE; - virtual void CheckItem( sal_uInt16 nMesId, bool bCheck = true ) SAL_OVERRIDE; - virtual bool IsCheckedItem( sal_uInt16 nMesId ) SAL_OVERRIDE; - virtual void LoadedFamilies() SAL_OVERRIDE; - virtual void InsertFamilyItem( sal_uInt16 nId, const SfxStyleFamilyItem* pIten ) SAL_OVERRIDE; - virtual void EnableFamilyItem( sal_uInt16 nId, bool bEnabled = true ) SAL_OVERRIDE; - virtual void ClearFamilyList() SAL_OVERRIDE; - virtual void ReplaceUpdateButtonByMenu() SAL_OVERRIDE; - - void Resize(); - Size GetMinOutputSizePixel(); - - void updateFamilyImages(); - void updateNonFamilyImages(); + virtual void EnableEdit( bool = true ) SAL_OVERRIDE; + virtual void EnableItem( sal_uInt16 nMesId, bool bCheck = true ) SAL_OVERRIDE; + virtual void CheckItem( sal_uInt16 nMesId, bool bCheck = true ) SAL_OVERRIDE; + virtual bool IsCheckedItem( sal_uInt16 nMesId ) SAL_OVERRIDE; + virtual void LoadedFamilies() SAL_OVERRIDE; + virtual void InsertFamilyItem( sal_uInt16 nId, const SfxStyleFamilyItem* pIten ) SAL_OVERRIDE; + virtual void EnableFamilyItem( sal_uInt16 nId, bool bEnabled = true ) SAL_OVERRIDE; + virtual void ClearFamilyList() SAL_OVERRIDE; + virtual void ReplaceUpdateButtonByMenu() SAL_OVERRIDE; + + void Resize(); + Size GetMinOutputSizePixel(); + + void updateFamilyImages(); + void updateNonFamilyImages(); public: friend class SfxTemplateDialog; |