1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #ifndef _SFXDOCVOR_HXX 28 #define _SFXDOCVOR_HXX 29 30 31 #ifndef _DIALOG_HXX //autogen 32 #include <vcl/dialog.hxx> 33 #endif 34 #include <svtools/svtreebx.hxx> 35 36 #include <sfx2/objsh.hxx> 37 #include "orgmgr.hxx" 38 39 //========================================================================= 40 41 class SfxDocumentTemplates; 42 class Path; 43 44 //========================================================================= 45 46 #ifndef _SFX_HXX 47 48 class SfxOrganizeDlg_Impl; 49 50 class SfxOrganizeListBox_Impl : public SvTreeListBox 51 { 52 enum BMPTYPE { BMPTYPE_FOLDER, BMPTYPE_DOC }; 53 54 friend class SfxOrganizeDlg_Impl; 55 56 Image aOpenedFolderBmp; 57 Image aClosedFolderBmp; 58 Image aOpenedDocBmp; 59 Image aClosedDocBmp; 60 61 Image aOpenedFolderBmpHC; 62 Image aClosedFolderBmpHC; 63 Image aOpenedDocBmpHC; 64 Image aClosedDocBmpHC; 65 66 SfxOrganizeMgr* pMgr; 67 SfxOrganizeDlg_Impl* pDlg; 68 69 static sal_Bool bDropMoveOk; 70 71 DECL_LINK( OnAsyncExecuteDrop, ExecuteDropEvent* ); 72 73 protected: 74 virtual sal_Bool EditingEntry( SvLBoxEntry* pEntry, Selection & ); 75 virtual sal_Bool EditedEntry( SvLBoxEntry* pEntry, const String& rNewText ); 76 virtual sal_Bool NotifyMoving(SvLBoxEntry *pSource, 77 SvLBoxEntry* pTarget, 78 SvLBoxEntry *&pNewParent, sal_uIntPtr &); 79 virtual sal_Bool NotifyCopying(SvLBoxEntry *pSource, 80 SvLBoxEntry* pTarget, 81 SvLBoxEntry *&pNewParent, sal_uIntPtr &); 82 virtual void RequestingChilds( SvLBoxEntry* pParent ); 83 virtual long ExpandingHdl(); 84 virtual sal_Bool Select( SvLBoxEntry* pEntry, sal_Bool bSelect=sal_True ); 85 86 using SvLBox::ExecuteDrop; 87 // new d&d 88 virtual DragDropMode NotifyStartDrag( TransferDataContainer&, SvLBoxEntry* ); 89 virtual sal_Bool NotifyAcceptDrop( SvLBoxEntry* ); 90 virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ); 91 virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ); 92 virtual void DragFinished( sal_Int8 nDropAction ); 93 94 public: 95 using SvListView::Select; 96 enum DataEnum { VIEW_TEMPLATES, VIEW_FILES } eViewType; 97 98 SfxOrganizeListBox_Impl( SfxOrganizeDlg_Impl* pDlg, Window* pParent, WinBits, DataEnum ); 99 100 DataEnum GetViewType() const { return eViewType; } 101 void SetViewType(DataEnum eType) { eViewType = eType; } 102 103 void SetMgr(SfxOrganizeMgr *pM) { pMgr = pM; } 104 void Reset(); 105 inline void SetBitmaps( 106 const Image &rOFolderBmp, const Image &rCFolderBmp, const Image &rODocBmp, const Image &rCDocBmp, 107 const Image &rOFolderBmpHC, const Image &rCFolderBmpHC, const Image &rODocBmpHC, const Image &rCDocBmpHC ); 108 const Image &GetClosedBmp(sal_uInt16 nLevel) const; 109 const Image &GetOpenedBmp(sal_uInt16 nLevel) const; 110 111 virtual PopupMenu* CreateContextMenu(); 112 113 private: 114 sal_Bool IsStandard_Impl( SvLBoxEntry *) const; 115 sal_Bool MoveOrCopyTemplates(SvLBox *pSourceBox, 116 SvLBoxEntry *pSource, 117 SvLBoxEntry* pTarget, 118 SvLBoxEntry *&pNewParent, 119 sal_uIntPtr &rIdx, 120 sal_Bool bCopy); 121 sal_Bool MoveOrCopyContents(SvLBox *pSourceBox, 122 SvLBoxEntry *pSource, 123 SvLBoxEntry* pTarget, 124 SvLBoxEntry *&pNewParent, 125 sal_uIntPtr &rIdx, 126 sal_Bool bCopy); 127 inline sal_uInt16 GetDocLevel() const; 128 SfxObjectShellRef GetObjectShell( const Path& ); 129 sal_Bool IsUniqName_Impl( const String &rText, 130 SvLBoxEntry* pParent, SvLBoxEntry* pEntry = 0 ) const; 131 sal_uInt16 GetLevelCount_Impl( SvLBoxEntry* pParent ) const; 132 133 SvLBoxEntry* InsertEntryByBmpType( const XubString& rText, BMPTYPE eBmpType, 134 SvLBoxEntry* pParent = NULL, sal_Bool bChildsOnDemand = sal_False, 135 sal_uIntPtr nPos = LIST_APPEND, void* pUserData = NULL ); 136 }; 137 138 #endif // _SFX_HXX 139 140 //========================================================================= 141 142 class SfxTemplateOrganizeDlg : public ModalDialog 143 { 144 friend class SfxOrganizeListBox_Impl; 145 146 class SfxOrganizeDlg_Impl *pImp; 147 148 // virtual void DataChanged( const DataChangedEvent& rDCEvt ); 149 public: 150 SfxTemplateOrganizeDlg(Window * pParent, SfxDocumentTemplates* = 0); 151 ~SfxTemplateOrganizeDlg(); 152 153 #define RET_EDIT_STYLE 100 154 155 virtual short Execute(); 156 }; 157 158 #endif 159