update dev300-m58
[ooovba.git] / fpicker / source / office / iodlgimp.hxx
blob8d9df32ee9fc203f616871ecc785680e35aa561e
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: iodlgimp.hxx,v $
10 * $Revision: 1.7 $
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 _IODLGIMP_HXX
31 #define _IODLGIMP_HXX
33 #include <tools/string.hxx>
34 #include <vcl/fixed.hxx>
35 #include <vcl/lstbox.hxx>
36 #include <vcl/menubtn.hxx>
37 #include <vcl/timer.hxx>
38 #include <vcl/group.hxx>
40 #include "svtools/svarray.hxx"
42 #include <vector>
44 //*****************************************************************************
46 class Accelerator;
47 class CheckBox;
48 class SvtFileDialog;
49 class SvStringsDtor;
50 class SvUShorts;
52 //*****************************************************************************
54 #define FILEDIALOG_DEF_EXTSEP ';'
55 #define FILEDIALOG_DEF_WILDCARD '*'
56 #define FILEDIALOG_DEF_IMAGEBORDER 10
57 #define FILEDIALOG_DEF_TIMEOUT 250
59 //*****************************************************************************
60 // SvtFileDialogFilter_Impl
61 //*****************************************************************************
63 /* [Beschreibung]
65 Instanzen dieser Klasse repr"asentieren einen Filter
68 class SvtFileDialogFilter_Impl
70 private:
71 String m_aName; // name of the entry
72 String m_aType; // filter wildcard - if empty, the entry marks a group
74 public:
75 SvtFileDialogFilter_Impl( const String& rName, const String& rType );
76 ~SvtFileDialogFilter_Impl();
78 const String& GetName() const { return m_aName; }
79 const String& GetType() const { return m_aType; }
80 const String GetExtension() const { return m_aType.Copy( 2 ); }
82 sal_Bool isGroupSeparator() const { return 0 == m_aType.Len(); }
85 //*****************************************************************************
86 // SvtFileDialogFilterList_Impl
87 //*****************************************************************************
89 SV_DECL_PTRARR_DEL( SvtFileDialogFilterList_Impl, SvtFileDialogFilter_Impl*, 3, 3 )
91 //*****************************************************************************
92 // SvtFileDlgMode
93 //*****************************************************************************
95 enum SvtFileDlgMode
97 FILEDLG_MODE_OPEN = 0,
98 FILEDLG_MODE_SAVE = 1
101 //*****************************************************************************
102 // SvtFileDlgType
103 //*****************************************************************************
105 enum SvtFileDlgType
107 FILEDLG_TYPE_FILEDLG = 0,
108 FILEDLG_TYPE_PATHDLG
111 //*****************************************************************************
112 // SvtFileDialogURLSelector
113 //*****************************************************************************
114 class SvtFileDialogURLSelector : public MenuButton
116 private:
117 SvtFileDialog* m_pParent;
118 PopupMenu* m_pMenu;
120 protected:
121 inline SvtFileDialog* GetDialogParent() { return m_pParent; }
123 protected:
124 void OpenURL( const String& rURL );
126 virtual void FillURLMenu( PopupMenu* _pMenu ) = 0;
128 protected:
129 SvtFileDialogURLSelector( SvtFileDialog* _pParent, const ResId& _rResId, sal_uInt16 _nButtonId );
130 ~SvtFileDialogURLSelector();
132 virtual void Activate();
135 //*****************************************************************************
136 // SvtUpButton_Impl
137 //*****************************************************************************
139 class SvtUpButton_Impl : public SvtFileDialogURLSelector
141 private:
142 SvStringsDtor* _pURLs;
144 public:
145 SvtUpButton_Impl( SvtFileDialog* pParent, const ResId& rResId );
146 ~SvtUpButton_Impl();
148 protected:
149 virtual void FillURLMenu( PopupMenu* _pMenu );
150 virtual void Select();
151 virtual void Click();
154 //*****************************************************************************
155 // SvtTravelButton_Impl
156 //*****************************************************************************
158 class SvtTravelButton_Impl : public SvtFileDialogURLSelector
160 private:
161 ::std::vector< String > m_aFavourites;
163 public:
164 SvtTravelButton_Impl( SvtFileDialog* pParent, const ResId& rResId );
165 ~SvtTravelButton_Impl();
167 void SetFavouriteLocations( const ::std::vector< String >& _rLocations );
169 protected:
170 virtual void FillURLMenu( PopupMenu* _pMenu );
171 virtual void Select();
172 virtual void Click();
175 //*****************************************************************************
176 // SvtFileDlgState
177 //*****************************************************************************
179 typedef sal_uInt8 SvtFileDlgState;
181 #define FILEDLG_STATE_NONE ((SvtFileDlgState)0x00)
182 #define FILEDLG_STATE_REMOTE ((SvtFileDlgState)0x01)
184 //*****************************************************************************
185 // SvtExpFileDlg_Impl
186 //*****************************************************************************
187 class SvtURLBox;
188 class SvtExpFileDlg_Impl
190 private:
191 DECL_STATIC_LINK( SvtExpFileDlg_Impl, UnClickHdl, Button* );
193 private:
194 ListBox* _pLbFilter;
196 const SvtFileDialogFilter_Impl* _pCurFilter;
197 String m_sCurrentFilterDisplayName; // may differ from _pCurFilter->GetName in case it is a cached entry
199 ::com::sun::star::uno::Sequence< ::rtl::OUString > _aBlackList;
201 public:
202 SvtFileDialogFilterList_Impl* _pFilter;
203 SvtFileDialogFilter_Impl* _pUserFilter;
205 FixedText* _pFtFileName;
206 SvtURLBox* _pEdFileName;
208 FixedText* _pFtFileVersion;
209 ListBox* _pLbFileVersion;
211 FixedText* _pFtTemplates;
212 ListBox* _pLbTemplates;
214 FixedText* _pFtImageTemplates;
215 ListBox* _pLbImageTemplates;
217 FixedText* _pFtFileType;
218 PushButton* _pBtnFileOpen;
219 PushButton* _pBtnCancel;
220 HelpButton* _pBtnHelp;
221 SvtUpButton_Impl* _pBtnUp;
222 ImageButton* _pBtnNewFolder;
223 SvtTravelButton_Impl* _pBtnStandard;
224 CheckBox* _pCbPassword;
225 FixedText* _pFtCurrentPath;
226 CheckBox* _pCbAutoExtension;
227 CheckBox* _pCbOptions;
229 SvtFileDlgMode _eMode;
230 SvtFileDlgType _eDlgType;
231 SvtFileDlgState _nState;
232 WinBits _nStyle;
234 String _aStdDir;
236 // beim traveln der Filterbox erst Zeitversetzt filtern
237 Timer _aFilterTimer;
239 // Zeigt der OpenHdl_Imp(), ob das Open durch einen Doppelclick ausgel"ost wurde
240 sal_Bool _bDoubleClick;
241 sal_Bool m_bNeedDelayedFilterExecute;
243 // Liste mit den 5 zuletzt genutzten Filtern
244 // Defaultfilter fuer <Alle> oder <Alle ...>
245 const SvtFileDialogFilter_Impl* _pDefaultFilter;
247 // Multiselektion?
248 sal_Bool _bMultiSelection;
250 // Fixgr"ossen f"ur Resize merken
251 long _nFixDeltaHeight;
252 Size _a6Size;
253 Size _aDlgSize;
254 String _aIniKey;
256 sal_Bool _bFolderHasOpened;
258 SvtExpFileDlg_Impl( WinBits nBits );
259 ~SvtExpFileDlg_Impl();
262 inline void SetBlackList( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rBlackList ) { _aBlackList = rBlackList; }
263 inline const ::com::sun::star::uno::Sequence< ::rtl::OUString >& GetBlackList() const { return _aBlackList; }
264 void SetStandardDir( const String& _rDir );
265 inline const String& GetStandardDir() const { return _aStdDir; }
266 inline void DisableFilterBoxAutoWidth() { _pLbFilter->EnableDDAutoWidth( FALSE ); }
268 // ------------------------------------------
269 // access to the filter listbox only as Control* - we want to maintain the entries/userdata ourself
270 Control* GetFilterListControl() { return _pLbFilter; }
271 const Control* GetFilterListControl() const { return _pLbFilter; }
272 void CreateFilterListControl( Window* _pParent, const ResId& _rId );
273 inline void SetFilterListSelectHdl( const Link& _rHandler );
275 // inits the listbox for the filters from the filter list (_pFilter)
276 void ClearFilterList( );
277 void InitFilterList( );
278 inline sal_Bool HasFilterListEntry( const String& _rFilterName );
279 inline void SelectFilterListEntry( const String& _rFilterName );
280 inline void SetNoFilterListSelection( );
281 void InsertFilterListEntry( const SvtFileDialogFilter_Impl* _pFilterDesc );
282 // _pFilterDesc must already have been added to _pFilter
283 inline SvtFileDialogFilter_Impl* GetSelectedFilterEntry( String& /* [out] */ _rDisplayName ) const;
284 inline sal_Bool IsFilterListTravelSelect() const;
286 // ------------------------------------------
287 // access to the current filter via methods only - need to care for consistency between _pCurFilter and m_sCurrentFilterDisplayName
288 inline const SvtFileDialogFilter_Impl* GetCurFilter( ) const;
289 inline const String& GetCurFilterDisplayName() const;
290 void SetCurFilter( SvtFileDialogFilter_Impl* _pFilter, const String& _rDisplayName );
291 inline void SetCurFilter( SvtFileDialogFilter_Impl* _pFilter );
294 inline void SvtExpFileDlg_Impl::SetFilterListSelectHdl( const Link& _rHandler )
296 _pLbFilter->SetSelectHdl( _rHandler );
299 inline sal_Bool SvtExpFileDlg_Impl::HasFilterListEntry( const String& _rFilterName )
301 return ( LISTBOX_ENTRY_NOTFOUND != _pLbFilter->GetEntryPos( _rFilterName ) );
304 inline void SvtExpFileDlg_Impl::SelectFilterListEntry( const String& _rFilterName )
306 _pLbFilter->SelectEntry( _rFilterName );
309 inline void SvtExpFileDlg_Impl::SetNoFilterListSelection( )
311 _pLbFilter->SetNoSelection( );
314 inline SvtFileDialogFilter_Impl* SvtExpFileDlg_Impl::GetSelectedFilterEntry( String& _rDisplayName ) const
316 _rDisplayName = _pLbFilter->GetSelectEntry();
317 return static_cast< SvtFileDialogFilter_Impl* >( _pLbFilter->GetEntryData ( _pLbFilter->GetSelectEntryPos() ) );
320 inline sal_Bool SvtExpFileDlg_Impl::IsFilterListTravelSelect() const
322 return _pLbFilter->IsTravelSelect();
325 inline const SvtFileDialogFilter_Impl* SvtExpFileDlg_Impl::GetCurFilter( ) const
327 return _pCurFilter;
330 inline const String& SvtExpFileDlg_Impl::GetCurFilterDisplayName() const
332 return m_sCurrentFilterDisplayName;
335 inline void SvtExpFileDlg_Impl::SetCurFilter( SvtFileDialogFilter_Impl* pFilter )
337 SetCurFilter( pFilter, pFilter->GetName() );
340 #endif // #ifndef _IODLGIMP_HXX