xref: /aoo42x/main/sfx2/inc/docvor.hxx (revision 353d8f4d)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _SFXDOCVOR_HXX
24 #define _SFXDOCVOR_HXX
25 
26 
27 #ifndef _DIALOG_HXX //autogen
28 #include <vcl/dialog.hxx>
29 #endif
30 #include <svtools/svtreebx.hxx>
31 
32 #include <sfx2/objsh.hxx>
33 #include "orgmgr.hxx"
34 
35 //=========================================================================
36 
37 class SfxDocumentTemplates;
38 class Path;
39 
40 //=========================================================================
41 
42 #ifndef _SFX_HXX
43 
44 class SfxOrganizeDlg_Impl;
45 
46 class SfxOrganizeListBox_Impl : public SvTreeListBox
47 {
48 	enum BMPTYPE			{ BMPTYPE_FOLDER, BMPTYPE_DOC };
49 
50 friend class SfxOrganizeDlg_Impl;
51 
52 	Image					aOpenedFolderBmp;
53 	Image					aClosedFolderBmp;
54 	Image					aOpenedDocBmp;
55 	Image					aClosedDocBmp;
56 
57 	Image					aOpenedFolderBmpHC;
58 	Image					aClosedFolderBmpHC;
59 	Image					aOpenedDocBmpHC;
60 	Image					aClosedDocBmpHC;
61 
62 	SfxOrganizeMgr*			pMgr;
63 	SfxOrganizeDlg_Impl*	pDlg;
64 
65 	static sal_Bool				bDropMoveOk;
66 
67 	DECL_LINK( OnAsyncExecuteDrop, ExecuteDropEvent* );
68 
69 protected:
70 	virtual sal_Bool EditingEntry( SvLBoxEntry* pEntry, Selection & );
71 	virtual sal_Bool EditedEntry( SvLBoxEntry* pEntry, const String& rNewText );
72 	virtual sal_Bool NotifyMoving(SvLBoxEntry *pSource,
73 							SvLBoxEntry* pTarget,
74 							SvLBoxEntry *&pNewParent, sal_uIntPtr &);
75 	virtual sal_Bool NotifyCopying(SvLBoxEntry *pSource,
76 							SvLBoxEntry* pTarget,
77 							SvLBoxEntry *&pNewParent, sal_uIntPtr &);
78 	virtual void RequestingChilds( SvLBoxEntry* pParent );
79 	virtual long ExpandingHdl();
80 	virtual sal_Bool Select( SvLBoxEntry* pEntry, sal_Bool bSelect=sal_True );
81 
82         using SvLBox::ExecuteDrop;
83 	// new d&d
84 	virtual DragDropMode	NotifyStartDrag( TransferDataContainer&, SvLBoxEntry* );
85 	virtual sal_Bool			NotifyAcceptDrop( SvLBoxEntry* );
86 	virtual sal_Int8		AcceptDrop( const AcceptDropEvent& rEvt );
87 	virtual sal_Int8		ExecuteDrop( const ExecuteDropEvent& rEvt );
88     virtual void            DragFinished( sal_Int8 nDropAction );
89 
90 public:
91         using SvListView::Select;
92 	enum DataEnum	{ VIEW_TEMPLATES, VIEW_FILES } eViewType;
93 
94 	SfxOrganizeListBox_Impl( SfxOrganizeDlg_Impl* pDlg, Window* pParent, WinBits, DataEnum );
95 
GetViewType() const96 	DataEnum	GetViewType() const { return eViewType; }
SetViewType(DataEnum eType)97 	void		SetViewType(DataEnum eType) { eViewType = eType; }
98 
SetMgr(SfxOrganizeMgr * pM)99 	void SetMgr(SfxOrganizeMgr *pM) { pMgr = pM; }
100 	void Reset();
101 	inline void SetBitmaps(
102 					const Image &rOFolderBmp, const Image &rCFolderBmp, const Image &rODocBmp, const Image &rCDocBmp,
103 					const Image &rOFolderBmpHC, const Image &rCFolderBmpHC, const Image &rODocBmpHC, const Image &rCDocBmpHC );
104 	const Image &GetClosedBmp(sal_uInt16 nLevel) const;
105 	const Image &GetOpenedBmp(sal_uInt16 nLevel) const;
106 
107 	virtual PopupMenu*	CreateContextMenu();
108 
109 private:
110 	sal_Bool IsStandard_Impl( SvLBoxEntry *) const;
111 	sal_Bool MoveOrCopyTemplates(SvLBox *pSourceBox,
112 							SvLBoxEntry *pSource,
113 							SvLBoxEntry* pTarget,
114 							SvLBoxEntry *&pNewParent,
115 							sal_uIntPtr &rIdx,
116 							sal_Bool bCopy);
117 	sal_Bool MoveOrCopyContents(SvLBox *pSourceBox,
118 							SvLBoxEntry *pSource,
119 							SvLBoxEntry* pTarget,
120 							SvLBoxEntry *&pNewParent,
121 							sal_uIntPtr &rIdx,
122 							sal_Bool bCopy);
123 	inline sal_uInt16		GetDocLevel() const;
124 	SfxObjectShellRef	GetObjectShell( const Path& );
125 	sal_Bool				IsUniqName_Impl( const String &rText,
126 										 SvLBoxEntry* pParent, SvLBoxEntry* pEntry = 0 ) const;
127 	sal_uInt16				GetLevelCount_Impl( SvLBoxEntry* pParent ) const;
128 
129 	SvLBoxEntry*		InsertEntryByBmpType( const XubString& rText, BMPTYPE eBmpType,
130 							SvLBoxEntry* pParent = NULL, sal_Bool bChildsOnDemand = sal_False,
131 							sal_uIntPtr nPos = LIST_APPEND, void* pUserData = NULL );
132 };
133 
134 #endif // _SFX_HXX
135 
136 //=========================================================================
137 
138 class SfxTemplateOrganizeDlg : public ModalDialog
139 {
140 friend class SfxOrganizeListBox_Impl;
141 
142 	class SfxOrganizeDlg_Impl *pImp;
143 
144 //	virtual void	DataChanged( const DataChangedEvent& rDCEvt );
145 public:
146 	SfxTemplateOrganizeDlg(Window * pParent, SfxDocumentTemplates* = 0);
147 	~SfxTemplateOrganizeDlg();
148 
149 #define RET_EDIT_STYLE       100
150 
151 	virtual short Execute();
152 };
153 
154 #endif
155