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