xref: /aoo41x/main/sfx2/inc/orgmgr.hxx (revision cdf0e10c)
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 _SFX_ORGMGR_HXX
28 #define _SFX_ORGMGR_HXX
29 
30 #include <svl/svarray.hxx>
31 
32 class SfxDocumentTemplates;
33 class SfxOrganizeListBox_Impl;
34 class SfxObjectShell;
35 struct _FileListEntry;
36 
37 //=========================================================================
38 
39 SV_DECL_PTRARR_SORT(_SfxObjectList, _FileListEntry*, 1, 4)
40 
41 class SfxObjectList: public _SfxObjectList
42 {
43 public:
44 	SfxObjectList();
45 	~SfxObjectList();
46 
47 	const String&	GetBaseName( sal_uInt16 nId ) const;
48 	const String&	GetFileName( sal_uInt16 nId ) const;
49 };
50 
51 class IntlWrapper;
52 struct SfxOrganizeMgr_Impl
53 {
54 	SfxObjectList*		pDocList;
55 	IntlWrapper*		pIntlWrapper;
56 
57 	SfxOrganizeMgr_Impl() :  pDocList( NULL ), pIntlWrapper( NULL ) {}
58 };
59 
60 //=========================================================================
61 
62 class SfxOrganizeMgr
63 {
64 private:
65 	SfxOrganizeMgr_Impl*		pImpl;
66 	SfxDocumentTemplates* 		pTemplates;
67 	SfxOrganizeListBox_Impl* 	pLeftBox;
68 	SfxOrganizeListBox_Impl* 	pRightBox;
69 	sal_Bool						bDeleteTemplates	:1;
70 	sal_Bool						bModified			:1;
71 
72 	SfxOrganizeListBox_Impl*	GetOther( SfxOrganizeListBox_Impl* );
73 
74 public:
75 	SfxOrganizeMgr( SfxOrganizeListBox_Impl* pLeft,
76 					SfxOrganizeListBox_Impl* pRight,
77 					SfxDocumentTemplates* pTempl = NULL );
78 	~SfxOrganizeMgr();
79 
80 	sal_Bool	Copy( sal_uInt16 nTargetRegion, sal_uInt16 nTargetIdx, sal_uInt16 nSourceRegion, sal_uInt16 nSourceIdx );
81 	sal_Bool	Move( sal_uInt16 nTargetRegion, sal_uInt16 nTargetIdx, sal_uInt16 nSourceRegion, sal_uInt16 nSourceIdx );
82 	sal_Bool	Delete( SfxOrganizeListBox_Impl* pCaller, sal_uInt16 nRegion, sal_uInt16 nIdx );
83 	sal_Bool	InsertDir( SfxOrganizeListBox_Impl* pCaller, const String& rName, sal_uInt16 nRegion );
84 	sal_Bool	SetName( const String& rName, sal_uInt16 nRegion, sal_uInt16 nIdx = USHRT_MAX );
85 	sal_Bool	CopyTo( sal_uInt16 nRegion, sal_uInt16 nIdx, const String& rName ) const;
86 	sal_Bool	CopyFrom( SfxOrganizeListBox_Impl* pCaller, sal_uInt16 nRegion, sal_uInt16 nIdx, String& rName );
87 
88 	sal_Bool	Rescan();
89 	sal_Bool	InsertFile( SfxOrganizeListBox_Impl* pCaller, const String& rFileName );
90 
91 	sal_Bool	IsModified() const { return bModified ? sal_True : sal_False; }
92 
93 	const SfxDocumentTemplates*	GetTemplates() const { return pTemplates; }
94 	SfxObjectList&				GetObjectList() { return *pImpl->pDocList; }
95 	const SfxObjectList&		GetObjectList() const { return *pImpl->pDocList; }
96 
97 	SfxObjectShellRef	CreateObjectShell( sal_uInt16 nIdx );
98 	SfxObjectShellRef	CreateObjectShell( sal_uInt16 nRegion, sal_uInt16 nIdx );
99 	sal_Bool				DeleteObjectShell( sal_uInt16 );
100 	sal_Bool				DeleteObjectShell( sal_uInt16, sal_uInt16 );
101 	void				SaveAll( Window* pParent );
102 };
103 
104 #endif // #ifndef _SFX_ORGMGR_HXX
105 
106 
107