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