diff options
Diffstat (limited to 'sfx2/inc')
-rw-r--r-- | sfx2/inc/sfx2/templateabstractview.hxx | 62 | ||||
-rw-r--r-- | sfx2/inc/sfx2/templatelocalview.hxx | 12 | ||||
-rw-r--r-- | sfx2/inc/sfx2/templateproperties.hxx | 1 | ||||
-rw-r--r-- | sfx2/inc/sfx2/templateremoteview.hxx | 4 | ||||
-rw-r--r-- | sfx2/inc/sfx2/templateview.hxx | 66 | ||||
-rw-r--r-- | sfx2/inc/sfx2/thumbnailview.hxx | 3 | ||||
-rw-r--r-- | sfx2/inc/templatedlg.hxx | 22 |
7 files changed, 57 insertions, 113 deletions
diff --git a/sfx2/inc/sfx2/templateabstractview.hxx b/sfx2/inc/sfx2/templateabstractview.hxx index bfbd2aa01bfb..16a82e4869fd 100644 --- a/sfx2/inc/sfx2/templateabstractview.hxx +++ b/sfx2/inc/sfx2/templateabstractview.hxx @@ -10,7 +10,10 @@ #ifndef __SFX2_TEMPLATEABSTRACTVIEW_HXX__ #define __SFX2_TEMPLATEABSTRACTVIEW_HXX__ +#include <sfx2/templateproperties.hxx> #include <sfx2/thumbnailview.hxx> +#include <vcl/button.hxx> +#include <vcl/fixed.hxx> //template thumbnail item defines #define TEMPLATE_ITEM_MAX_WIDTH 160 @@ -23,7 +26,6 @@ #define TEMPLATE_THUMBNAIL_MAX_HEIGHT TEMPLATE_ITEM_THUMBNAIL_MAX_HEIGHT - 2*TEMPLATE_ITEM_PADDING #define TEMPLATE_THUMBNAIL_MAX_WIDTH TEMPLATE_ITEM_MAX_WIDTH - 2*TEMPLATE_ITEM_PADDING -class TemplateView; class SfxDocumentTemplates; enum FILTER_APPLICATION @@ -80,63 +82,53 @@ public: virtual ~TemplateAbstractView (); - // Fill view with template folders thumbnails - virtual void Populate () { }; - - virtual void reload () { }; + // Fill view with new item list + void insertItems (const std::vector<TemplateItemProperties> &rTemplates); - virtual void filterTemplatesByApp (const FILTER_APPLICATION &eApp); - - virtual sal_uInt16 createRegion (const OUString &rName) = 0; - - void showOverlay (bool bVisible); - - void setItemDimensions (long ItemWidth, long ThumbnailHeight, long DisplayHeight, int itemPadding); + // Fill view with template folders thumbnails + virtual void Populate () { } - sal_uInt16 getOverlayRegionId () const; + virtual void reload () { } - const OUString& getOverlayName () const; + virtual void showRootRegion () = 0; - // Check if the overlay is visible or not. - bool isOverlayVisible () const; + virtual void showRegion (ThumbnailViewItem *pItem) = 0; - void deselectOverlayItems (); + virtual sal_uInt16 createRegion (const OUString &rName) = 0; - void sortOverlayItems (const boost::function<bool (const ThumbnailViewItem*, - const ThumbnailViewItem*) > &func); + sal_uInt16 getCurRegionId () const; - virtual void filterTemplatesByKeyword (const OUString &rKeyword); + const OUString& getCurRegionName () const; - void setOverlayItemStateHdl (const Link &aLink) { maOverlayItemStateHdl = aLink; } + // Check if the root region is visible or not. + bool isNonRootRegionVisible () const; - void setOpenHdl (const Link &rLink); + void setOpenRegionHdl(const Link &rLink); - void setOverlayCloseHdl (const Link &rLink); + void setOpenTemplateHdl (const Link &rLink); static BitmapEx scaleImg (const BitmapEx &rImg, long width, long height); - static BitmapEx fetchThumbnail (const OUString &msURL, long width, long height); + static BitmapEx getDefaultThumbnail( const rtl::OUString& rPath ); - virtual void Resize(); + static BitmapEx fetchThumbnail (const OUString &msURL, long width, long height); protected: - virtual void Paint( const Rectangle& rRect ); - - virtual void DrawItem (ThumbnailViewItem *pItem); - - DECL_LINK(OverlayItemStateHdl, const ThumbnailViewItem*); + DECL_LINK(ShowRootRegionHdl, void*); virtual void OnItemDblClicked(ThumbnailViewItem *pItem); protected: - TemplateView *mpItemView; - Link maOverlayItemStateHdl; - Link maOpenHdl; + sal_uInt16 mnCurRegionId; + OUString maCurRegionName; + + PushButton maAllButton; + FixedText maFTName; - bool mbFilteredResults; // Flag keep track if overlay has been filtered so folders can get filtered too afterwards - FILTER_APPLICATION meFilterOption; + Link maOpenRegionHdl; + Link maOpenTemplateHdl; }; #endif // __SFX2_TEMPLATEABSTRACTVIEW_HXX__ diff --git a/sfx2/inc/sfx2/templatelocalview.hxx b/sfx2/inc/sfx2/templatelocalview.hxx index 5fc14c931f60..cf12ddc39a8f 100644 --- a/sfx2/inc/sfx2/templatelocalview.hxx +++ b/sfx2/inc/sfx2/templatelocalview.hxx @@ -13,7 +13,6 @@ #include <set> #include <sfx2/templateabstractview.hxx> -#include <sfx2/templateproperties.hxx> class SfxDocumentTemplates; class TemplateContainerItem; @@ -26,6 +25,8 @@ namespace com { class SFX2_DLLPUBLIC TemplateLocalView : public TemplateAbstractView { + typedef bool (*selection_cmp_fn)(const ThumbnailViewItem*,const ThumbnailViewItem*); + public: TemplateLocalView ( Window* pParent, const ResId& rResId, bool bDisableTransientChildren = false ); @@ -37,6 +38,12 @@ public: virtual void reload (); + virtual void showRootRegion (); + + virtual void showRegion (ThumbnailViewItem *pItem); + + sal_uInt16 getRegionId (size_t pos) const; + std::vector<OUString> getFolderNames (); std::vector<TemplateItemProperties> @@ -51,7 +58,7 @@ public: bool moveTemplate (const ThumbnailViewItem* pItem, const sal_uInt16 nSrcItem, const sal_uInt16 nTargetItem, bool bCopy); - bool moveTemplates (std::set<const ThumbnailViewItem*> &rItems, const sal_uInt16 nTargetItem, bool bCopy); + bool moveTemplates (const std::set<const ThumbnailViewItem*,selection_cmp_fn> &rItems, const sal_uInt16 nTargetItem, bool bCopy); bool copyFrom (const sal_uInt16 nRegionItemId, const BitmapEx &rThumbnail, const OUString &rPath); @@ -74,6 +81,7 @@ public: private: SfxDocumentTemplates *mpDocTemplates; + std::vector<TemplateContainerItem* > maRegions; }; #endif // TEMPLATEFOLDERVIEW_HXX diff --git a/sfx2/inc/sfx2/templateproperties.hxx b/sfx2/inc/sfx2/templateproperties.hxx index 0760f604242d..1f109c525105 100644 --- a/sfx2/inc/sfx2/templateproperties.hxx +++ b/sfx2/inc/sfx2/templateproperties.hxx @@ -15,6 +15,7 @@ struct TemplateItemProperties { + bool aIsFolder; sal_uInt16 nId; ///< Index for ThumbnailView sal_uInt16 nDocId; ///< Index based on SfxTemplateDocument sal_uInt16 nRegionId; diff --git a/sfx2/inc/sfx2/templateremoteview.hxx b/sfx2/inc/sfx2/templateremoteview.hxx index 34da0850c5f0..a2341c42d553 100644 --- a/sfx2/inc/sfx2/templateremoteview.hxx +++ b/sfx2/inc/sfx2/templateremoteview.hxx @@ -25,6 +25,10 @@ public: virtual ~TemplateRemoteView (); + virtual void showRootRegion (); + + virtual void showRegion (ThumbnailViewItem *pItem); + bool loadRepository (TemplateRepository* pRepository, bool bRefresh); virtual sal_uInt16 createRegion (const OUString &rName); diff --git a/sfx2/inc/sfx2/templateview.hxx b/sfx2/inc/sfx2/templateview.hxx deleted file mode 100644 index 104cb1180b12..000000000000 --- a/sfx2/inc/sfx2/templateview.hxx +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * Copyright 2012 LibreOffice contributors. - * - * 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/. - */ - -#ifndef TEMPLATEVIEW_HXX -#define TEMPLATEVIEW_HXX - -#include <sfx2/templateproperties.hxx> -#include <sfx2/thumbnailview.hxx> -#include <vcl/button.hxx> -#include <vcl/fixed.hxx> - -class Edit; -class TemplateViewItem; - -class TemplateView : public ThumbnailView -{ -public: - - TemplateView (Window *pParent); - - virtual ~TemplateView (); - - void setId (const sal_uInt16 nId) { mnId = nId; } - - sal_uInt16 getId () const { return mnId; } - - void setName (const OUString &rName); - - const OUString& getName () const { return maName; } - - void InsertItems (const std::vector<TemplateItemProperties> &rTemplates); - - void setCloseHdl (const Link &rLink) { maAllButton.SetClickHdl(rLink); } - - - // FIXME Kept only during the refactoring - void setOpenHdl (const Link &rLink) { maOpenHdl = rLink; } - virtual void OnItemDblClicked(ThumbnailViewItem *pItem) { maOpenHdl.Call(pItem); } - void setMasterView(TemplateAbstractView* pMasterView) { mpMasterView = pMasterView; } - virtual bool renameItem(ThumbnailViewItem* pItem, rtl::OUString sNewTitle); - -protected: - - virtual void Resize (); - -private: - - Link maOpenHdl; - TemplateAbstractView* mpMasterView; - - PushButton maAllButton; - FixedText maFTName; - sal_uInt16 mnId; - OUString maName; -}; - -#endif // TEMPLATEVIEW_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff --git a/sfx2/inc/sfx2/thumbnailview.hxx b/sfx2/inc/sfx2/thumbnailview.hxx index c46a85444b72..8d7f46ad326f 100644 --- a/sfx2/inc/sfx2/thumbnailview.hxx +++ b/sfx2/inc/sfx2/thumbnailview.hxx @@ -183,6 +183,9 @@ public: void Clear(); + // Change current thumbnail item list with new one (invalidates all pointers to a thumbnail item) + void updateItems(const std::vector<ThumbnailViewItem *> &items); + size_t GetItemPos( sal_uInt16 nItemId ) const; sal_uInt16 GetItemId( size_t nPos ) const; diff --git a/sfx2/inc/templatedlg.hxx b/sfx2/inc/templatedlg.hxx index 0a6be502838d..894e70a8c289 100644 --- a/sfx2/inc/templatedlg.hxx +++ b/sfx2/inc/templatedlg.hxx @@ -39,6 +39,8 @@ namespace com { class SfxTemplateManagerDlg : public ModelessDialog { + typedef bool (*selection_cmp_fn)(const ThumbnailViewItem*,const ThumbnailViewItem*); + public: SfxTemplateManagerDlg (Window *parent = DIALOG_NO_PARENT); @@ -51,29 +53,23 @@ public: DECL_LINK(ActivatePageHdl, void*); - static BitmapEx getDefaultThumbnail( const rtl::OUString& rPath ); - private: - virtual void MouseButtonDown( const MouseEvent& rMEvt ); - virtual void Resize (); - DECL_LINK(CloseOverlayHdl, void*); - DECL_LINK(TBXViewHdl, void*); DECL_LINK(TBXActionHdl, void*); DECL_LINK(TBXTemplateHdl, void*); DECL_LINK(TBXDropdownHdl, ToolBox*); - DECL_LINK(TVFolderStateHdl, const ThumbnailViewItem*); - DECL_LINK(TVTemplateStateHdl, const ThumbnailViewItem*); + DECL_LINK(TVItemStateHdl, const ThumbnailViewItem*); DECL_LINK(MenuSelectHdl, Menu*); DECL_LINK(MoveMenuSelectHdl, Menu*); DECL_LINK(RepositoryMenuSelectHdl, Menu*); DECL_LINK(DefaultTemplateMenuSelectHdl, Menu*); + DECL_LINK(OpenRegionHdl, void*); DECL_LINK(OpenTemplateHdl, ThumbnailViewItem*); DECL_LINK(SearchUpdateHdl, void*); @@ -85,8 +81,14 @@ private: void OnTemplateDelete (); void OnTemplateAsDefault (); void OnTemplateExport (); + + void OnTemplateState (const ThumbnailViewItem *pItem); + void OnFolderNew (); void OnFolderDelete (); + + void OnRegionState (const ThumbnailViewItem *pItem); + void OnRepositoryDelete (); void OnTemplateSaveAs (); @@ -143,8 +145,8 @@ private: PopupMenu *mpRepositoryMenu; PopupMenu *mpTemplateDefaultMenu; - std::set<const ThumbnailViewItem*> maSelTemplates; - std::set<const ThumbnailViewItem*> maSelFolders; + std::set<const ThumbnailViewItem*,selection_cmp_fn> maSelTemplates; + std::set<const ThumbnailViewItem*,selection_cmp_fn> maSelFolders; bool mbIsSaveMode; ///< Flag that indicates if we are in save mode or not. com::sun::star::uno::Reference< com::sun::star::frame::XModel > m_xModel; |