Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef _SFXDOCVOR_HXX
20 : #define _SFXDOCVOR_HXX
21 :
22 :
23 : #include <vcl/dialog.hxx>
24 : #include <svtools/treelistbox.hxx>
25 :
26 : #include <sfx2/objsh.hxx>
27 : #include "orgmgr.hxx"
28 :
29 : //=========================================================================
30 :
31 : class SfxDocumentTemplates;
32 : class Path;
33 :
34 : //=========================================================================
35 :
36 : #ifndef _SFX_HXX
37 :
38 : class SfxOrganizeDlg_Impl;
39 :
40 0 : class SfxOrganizeListBox_Impl : public SvTreeListBox
41 : {
42 : enum BMPTYPE { BMPTYPE_FOLDER, BMPTYPE_DOC };
43 :
44 : friend class SfxOrganizeDlg_Impl;
45 :
46 : Image aOpenedFolderBmp;
47 : Image aClosedFolderBmp;
48 : Image aOpenedDocBmp;
49 : Image aClosedDocBmp;
50 :
51 : SfxOrganizeMgr* pMgr;
52 : SfxOrganizeDlg_Impl* pDlg;
53 :
54 : static sal_Bool bDropMoveOk;
55 :
56 : DECL_LINK( OnAsyncExecuteDrop, ExecuteDropEvent* );
57 :
58 : protected:
59 : virtual sal_Bool EditingEntry( SvTreeListEntry* pEntry, Selection & );
60 : virtual sal_Bool EditedEntry( SvTreeListEntry* pEntry, const rtl::OUString& rNewText );
61 : virtual sal_Bool NotifyMoving(SvTreeListEntry *pSource,
62 : SvTreeListEntry* pTarget,
63 : SvTreeListEntry *&pNewParent, sal_uIntPtr &);
64 : virtual sal_Bool NotifyCopying(SvTreeListEntry *pSource,
65 : SvTreeListEntry* pTarget,
66 : SvTreeListEntry *&pNewParent, sal_uIntPtr &);
67 : virtual void RequestingChildren( SvTreeListEntry* pParent );
68 : virtual long ExpandingHdl();
69 : virtual sal_Bool Select( SvTreeListEntry* pEntry, sal_Bool bSelect=sal_True );
70 :
71 : using SvTreeListBox::ExecuteDrop;
72 : // new d&d
73 : virtual DragDropMode NotifyStartDrag( TransferDataContainer&, SvTreeListEntry* );
74 : virtual sal_Bool NotifyAcceptDrop( SvTreeListEntry* );
75 : virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
76 : virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
77 : virtual void DragFinished( sal_Int8 nDropAction );
78 :
79 : public:
80 : using SvListView::Select;
81 : enum DataEnum { VIEW_TEMPLATES, VIEW_FILES } eViewType;
82 :
83 : SfxOrganizeListBox_Impl(Window* pParent, WinBits nBits);
84 :
85 : void Init(SfxOrganizeDlg_Impl* pArgDlg, DataEnum eType);
86 :
87 0 : DataEnum GetViewType() const { return eViewType; }
88 0 : void SetViewType(DataEnum eType) { eViewType = eType; }
89 :
90 0 : void SetMgr(SfxOrganizeMgr *pM) { pMgr = pM; }
91 : void Reset();
92 : inline void SetBitmaps(
93 : const Image &rOFolderBmp, const Image &rCFolderBmp, const Image &rODocBmp, const Image &rCDocBmp
94 : );
95 : const Image &GetClosedBmp(sal_uInt16 nLevel) const;
96 : const Image &GetOpenedBmp(sal_uInt16 nLevel) const;
97 :
98 : virtual PopupMenu* CreateContextMenu();
99 :
100 : private:
101 : sal_Bool IsStandard_Impl( SvTreeListEntry *) const;
102 : sal_Bool MoveOrCopyTemplates(SvTreeListBox *pSourceBox,
103 : SvTreeListEntry *pSource,
104 : SvTreeListEntry* pTarget,
105 : SvTreeListEntry *&pNewParent,
106 : sal_uIntPtr &rIdx,
107 : sal_Bool bCopy);
108 : sal_Bool MoveOrCopyContents(SvTreeListBox *pSourceBox,
109 : SvTreeListEntry *pSource,
110 : SvTreeListEntry* pTarget,
111 : SvTreeListEntry *&pNewParent,
112 : sal_uIntPtr &rIdx,
113 : sal_Bool bCopy);
114 : inline sal_uInt16 GetDocLevel() const;
115 : SfxObjectShellRef GetObjectShell( const Path& );
116 : sal_Bool IsUniqName_Impl( const String &rText,
117 : SvTreeListEntry* pParent, SvTreeListEntry* pEntry = 0 ) const;
118 : sal_uInt16 GetLevelCount_Impl( SvTreeListEntry* pParent ) const;
119 :
120 : SvTreeListEntry* InsertEntryByBmpType( const OUString& rText, BMPTYPE eBmpType,
121 : SvTreeListEntry* pParent = NULL, sal_Bool bChildrenOnDemand = sal_False,
122 : sal_uIntPtr nPos = LIST_APPEND, void* pUserData = NULL );
123 : };
124 :
125 : #endif // _SFX_HXX
126 :
127 : //=========================================================================
128 :
129 : class SfxTemplateOrganizeDlg : public ModalDialog
130 : {
131 : friend class SfxOrganizeListBox_Impl;
132 :
133 : class SfxOrganizeDlg_Impl *pImp;
134 :
135 : public:
136 : SfxTemplateOrganizeDlg(Window * pParent, SfxDocumentTemplates* = 0);
137 : ~SfxTemplateOrganizeDlg();
138 :
139 : #define RET_EDIT_STYLE 100
140 :
141 : virtual short Execute();
142 : };
143 :
144 : #endif
145 :
146 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|