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