1b557fc96SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3b557fc96SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4b557fc96SAndrew Rist * or more contributor license agreements. See the NOTICE file
5b557fc96SAndrew Rist * distributed with this work for additional information
6b557fc96SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7b557fc96SAndrew Rist * to you under the Apache License, Version 2.0 (the
8b557fc96SAndrew Rist * "License"); you may not use this file except in compliance
9b557fc96SAndrew Rist * with the License. You may obtain a copy of the License at
10b557fc96SAndrew Rist *
11b557fc96SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12b557fc96SAndrew Rist *
13b557fc96SAndrew Rist * Unless required by applicable law or agreed to in writing,
14b557fc96SAndrew Rist * software distributed under the License is distributed on an
15b557fc96SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16b557fc96SAndrew Rist * KIND, either express or implied. See the License for the
17b557fc96SAndrew Rist * specific language governing permissions and limitations
18b557fc96SAndrew Rist * under the License.
19b557fc96SAndrew Rist *
20b557fc96SAndrew Rist *************************************************************/
21b557fc96SAndrew Rist
22b557fc96SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_fpicker.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir // includes *******************************************************************
28cdf0e10cSrcweir
29cdf0e10cSrcweir #include "iodlgimp.hxx"
30cdf0e10cSrcweir #include "svtools/headbar.hxx"
31cdf0e10cSrcweir #include <tools/debug.hxx>
32cdf0e10cSrcweir #include <tools/wldcrd.hxx>
33cdf0e10cSrcweir #include <tools/urlobj.hxx>
34cdf0e10cSrcweir #include <vcl/menu.hxx>
35cdf0e10cSrcweir #include <vcl/msgbox.hxx>
36cdf0e10cSrcweir #include <vcl/lstbox.hxx>
37cdf0e10cSrcweir #include <vcl/svapp.hxx>
38cdf0e10cSrcweir // #97148# ---------------
39cdf0e10cSrcweir #include "svl/ctypeitm.hxx"
40cdf0e10cSrcweir #include "svl/eitem.hxx"
41cdf0e10cSrcweir #include "unotools/viewoptions.hxx"
42cdf0e10cSrcweir #include "svtools/fileview.hxx"
43cdf0e10cSrcweir #include "svtools/inettbc.hxx"
44cdf0e10cSrcweir #include "iodlg.hxx"
45cdf0e10cSrcweir #include "iodlg.hrc"
46cdf0e10cSrcweir #include "svtools/imagemgr.hxx"
47cdf0e10cSrcweir #include <unotools/localfilehelper.hxx>
48cdf0e10cSrcweir #include "unotools/useroptions.hxx"
49cdf0e10cSrcweir #include "rtl/instance.hxx"
50cdf0e10cSrcweir #include <svl/svl.hrc>
51cdf0e10cSrcweir
52cdf0e10cSrcweir #define _SVSTDARR_STRINGSSORTDTOR
53cdf0e10cSrcweir #define _SVSTDARR_STRINGSDTOR
54cdf0e10cSrcweir #define _SVSTDARR_USHORTS
55cdf0e10cSrcweir #include "svl/svstdarr.hxx"
56cdf0e10cSrcweir
57cdf0e10cSrcweir using namespace ::com::sun::star::uno;
58cdf0e10cSrcweir using namespace ::com::sun::star::lang;
59cdf0e10cSrcweir using namespace ::utl;
60cdf0e10cSrcweir
61cdf0e10cSrcweir // some stuff for easier changes for SvtViewOptions
62cdf0e10cSrcweir static const sal_Char* pViewOptDataName = "dialog data";
63cdf0e10cSrcweir #define VIEWOPT_DATANAME ::rtl::OUString::createFromAscii( pViewOptDataName )
64cdf0e10cSrcweir
SetViewOptUserItem(SvtViewOptions & rOpt,const String & rData)65cdf0e10cSrcweir static inline void SetViewOptUserItem( SvtViewOptions& rOpt, const String& rData )
66cdf0e10cSrcweir {
67cdf0e10cSrcweir rOpt.SetUserItem( VIEWOPT_DATANAME, makeAny( ::rtl::OUString( rData ) ) );
68cdf0e10cSrcweir }
69cdf0e10cSrcweir
GetViewOptUserItem(const SvtViewOptions & rOpt)70cdf0e10cSrcweir static inline String GetViewOptUserItem( const SvtViewOptions& rOpt )
71cdf0e10cSrcweir {
72cdf0e10cSrcweir Any aAny( rOpt.GetUserItem( VIEWOPT_DATANAME ) );
73cdf0e10cSrcweir ::rtl::OUString aUserData;
74cdf0e10cSrcweir aAny >>= aUserData;
75cdf0e10cSrcweir
76cdf0e10cSrcweir return String( aUserData );
77cdf0e10cSrcweir }
78cdf0e10cSrcweir
79cdf0e10cSrcweir
80cdf0e10cSrcweir // defines f"ur den Style der BrowseBox
81cdf0e10cSrcweir
82cdf0e10cSrcweir #define STYLE_MULTI_SELECTION \
83cdf0e10cSrcweir CNTVIEWSTYLE_NODE_BUTTONS | \
84cdf0e10cSrcweir CNTVIEWSTYLE_NODE_BUTTONS_AT_ROOT | \
85cdf0e10cSrcweir CNTVIEWSTYLE_SHOW_MESSAGES | \
86cdf0e10cSrcweir CNTVIEWSTYLE_SHOW_FOLDERS | \
87cdf0e10cSrcweir CNTVIEWSTYLE_NO_SMARTHIGHLIGHT | \
88cdf0e10cSrcweir CNTVIEWSTYLE_HIDE_OPENMENU | \
89cdf0e10cSrcweir CNTVIEWSTYLE_DEFAULT_APPEARANCE | \
90cdf0e10cSrcweir CNTVIEWSTYLE_SORT_BY_FOLDER
91cdf0e10cSrcweir
92cdf0e10cSrcweir #define STYLE_SINGLE_SELECTION \
93cdf0e10cSrcweir STYLE_MULTI_SELECTION | CNTVIEWSTYLE_SINGLE_SELECTION
94cdf0e10cSrcweir
95cdf0e10cSrcweir #define BOOL_NOT_INITIALIZE ((sal_Bool)2)
96cdf0e10cSrcweir
97cdf0e10cSrcweir //*****************************************************************************
98cdf0e10cSrcweir // ResMgrHolder / SvtSimpleResId
99cdf0e10cSrcweir //*****************************************************************************
100cdf0e10cSrcweir namespace
101cdf0e10cSrcweir {
102cdf0e10cSrcweir struct ResMgrHolder
103cdf0e10cSrcweir {
operator ()__anone81cf7da0111::ResMgrHolder104cdf0e10cSrcweir ResMgr * operator ()()
105cdf0e10cSrcweir {
106*a3709ba9SAriel Constenla-Haile return ResMgr::CreateResMgr (CREATEVERSIONRESMGR_NAME(svl));
107cdf0e10cSrcweir }
getOrCreate__anone81cf7da0111::ResMgrHolder108cdf0e10cSrcweir static ResMgr * getOrCreate()
109cdf0e10cSrcweir {
110cdf0e10cSrcweir return rtl_Instance<
111cdf0e10cSrcweir ResMgr, ResMgrHolder,
112cdf0e10cSrcweir osl::MutexGuard, osl::GetGlobalMutex >::create (
113cdf0e10cSrcweir ResMgrHolder(), osl::GetGlobalMutex());
114cdf0e10cSrcweir }
115cdf0e10cSrcweir };
116cdf0e10cSrcweir
117cdf0e10cSrcweir struct SvtSimpleResId : public ResId
118cdf0e10cSrcweir {
SvtSimpleResId__anone81cf7da0111::SvtSimpleResId119cdf0e10cSrcweir SvtSimpleResId (sal_uInt16 nId) : ResId (nId, *ResMgrHolder::getOrCreate()) {}
120cdf0e10cSrcweir };
121cdf0e10cSrcweir }
122cdf0e10cSrcweir
123cdf0e10cSrcweir //*****************************************************************************
124cdf0e10cSrcweir // SvtFileDialogFilter_Impl
125cdf0e10cSrcweir //*****************************************************************************
126cdf0e10cSrcweir
DBG_NAME(SvtFileDialogFilter_Impl)127cdf0e10cSrcweir DBG_NAME( SvtFileDialogFilter_Impl )
128cdf0e10cSrcweir SvtFileDialogFilter_Impl::SvtFileDialogFilter_Impl( const String& rName, const String& rType )
129cdf0e10cSrcweir :m_aName( rName )
130cdf0e10cSrcweir ,m_aType( rType )
131cdf0e10cSrcweir {
132cdf0e10cSrcweir DBG_CTOR( SvtFileDialogFilter_Impl, NULL );
133cdf0e10cSrcweir
134cdf0e10cSrcweir m_aType.ToLowerAscii();
135cdf0e10cSrcweir }
136cdf0e10cSrcweir
137cdf0e10cSrcweir //*****************************************************************************
138cdf0e10cSrcweir
~SvtFileDialogFilter_Impl()139cdf0e10cSrcweir SvtFileDialogFilter_Impl::~SvtFileDialogFilter_Impl()
140cdf0e10cSrcweir {
141cdf0e10cSrcweir DBG_DTOR( SvtFileDialogFilter_Impl, NULL );
142cdf0e10cSrcweir }
143cdf0e10cSrcweir
144cdf0e10cSrcweir //*****************************************************************************
145cdf0e10cSrcweir // SvtFileDialogFilterList_Impl
146cdf0e10cSrcweir //*****************************************************************************
147cdf0e10cSrcweir
148cdf0e10cSrcweir SV_IMPL_PTRARR( SvtFileDialogFilterList_Impl, SvtFileDialogFilter_Impl* );
149cdf0e10cSrcweir
150cdf0e10cSrcweir //=============================================================================
151cdf0e10cSrcweir //= SvtFileDialogURLSelector
152cdf0e10cSrcweir //=============================================================================
153cdf0e10cSrcweir
154cdf0e10cSrcweir //-----------------------------------------------------------------------------
SvtFileDialogURLSelector(SvtFileDialog * _pParent,const ResId & _rResId,sal_uInt16 _nButtonId)155cdf0e10cSrcweir SvtFileDialogURLSelector::SvtFileDialogURLSelector( SvtFileDialog* _pParent, const ResId& _rResId, sal_uInt16 _nButtonId )
156cdf0e10cSrcweir :MenuButton ( _pParent, _rResId )
157cdf0e10cSrcweir ,m_pParent ( _pParent )
158cdf0e10cSrcweir ,m_pMenu ( new PopupMenu )
159cdf0e10cSrcweir {
160cdf0e10cSrcweir SetStyle( GetStyle() | WB_NOPOINTERFOCUS | WB_RECTSTYLE | WB_SMALLSTYLE );
161cdf0e10cSrcweir SetModeImage( m_pParent->GetButtonImage( _nButtonId ) );
162cdf0e10cSrcweir SetMenuMode( MENUBUTTON_MENUMODE_TIMED );
163cdf0e10cSrcweir SetDropDown( PUSHBUTTON_DROPDOWN_TOOLBOX );
164cdf0e10cSrcweir }
165cdf0e10cSrcweir
166cdf0e10cSrcweir //-----------------------------------------------------------------------------
~SvtFileDialogURLSelector()167cdf0e10cSrcweir SvtFileDialogURLSelector::~SvtFileDialogURLSelector()
168cdf0e10cSrcweir {
169cdf0e10cSrcweir delete m_pMenu;
170cdf0e10cSrcweir }
171cdf0e10cSrcweir
172cdf0e10cSrcweir //-----------------------------------------------------------------------------
OpenURL(const String & rURL)173cdf0e10cSrcweir void SvtFileDialogURLSelector::OpenURL( const String& rURL )
174cdf0e10cSrcweir {
175cdf0e10cSrcweir INetURLObject aObj( rURL );
176cdf0e10cSrcweir DBG_ASSERT( aObj.GetProtocol() != INET_PROT_NOT_VALID, "SvtFileDialogURLSelector::OpenURL: Invalid URL!" );
177cdf0e10cSrcweir m_pParent->OpenURL_Impl( aObj.GetMainURL( INetURLObject::NO_DECODE ) );
178cdf0e10cSrcweir }
179cdf0e10cSrcweir
180cdf0e10cSrcweir //-----------------------------------------------------------------------------
Activate()181cdf0e10cSrcweir void SvtFileDialogURLSelector::Activate()
182cdf0e10cSrcweir {
183cdf0e10cSrcweir m_pMenu->Clear();
184cdf0e10cSrcweir
185cdf0e10cSrcweir FillURLMenu( m_pMenu );
186cdf0e10cSrcweir
187cdf0e10cSrcweir SetPopupMenu( m_pMenu );
188cdf0e10cSrcweir }
189cdf0e10cSrcweir
190cdf0e10cSrcweir //=============================================================================
191cdf0e10cSrcweir //= SvtUpButton_Impl
192cdf0e10cSrcweir //=============================================================================
193cdf0e10cSrcweir
194cdf0e10cSrcweir //-----------------------------------------------------------------------------
SvtUpButton_Impl(SvtFileDialog * pParent,const ResId & rResId)195cdf0e10cSrcweir SvtUpButton_Impl::SvtUpButton_Impl( SvtFileDialog* pParent, const ResId& rResId )
196cdf0e10cSrcweir :SvtFileDialogURLSelector( pParent, rResId, IMG_FILEDLG_BTN_UP )
197cdf0e10cSrcweir ,_pURLs ( NULL )
198cdf0e10cSrcweir {
199cdf0e10cSrcweir }
200cdf0e10cSrcweir
201cdf0e10cSrcweir //-----------------------------------------------------------------------------
~SvtUpButton_Impl()202cdf0e10cSrcweir SvtUpButton_Impl::~SvtUpButton_Impl()
203cdf0e10cSrcweir {
204cdf0e10cSrcweir delete _pURLs;
205cdf0e10cSrcweir }
206cdf0e10cSrcweir
207cdf0e10cSrcweir //-----------------------------------------------------------------------------
FillURLMenu(PopupMenu * _pMenu)208cdf0e10cSrcweir void SvtUpButton_Impl::FillURLMenu( PopupMenu* _pMenu )
209cdf0e10cSrcweir {
210cdf0e10cSrcweir SvtFileView* pBox = GetDialogParent()->GetView();
211cdf0e10cSrcweir
212cdf0e10cSrcweir sal_uInt16 nItemId = 1;
213cdf0e10cSrcweir
214cdf0e10cSrcweir delete _pURLs;
215cdf0e10cSrcweir _pURLs = new SvStringsDtor;
216cdf0e10cSrcweir
217cdf0e10cSrcweir // "Ubergeordnete Ebenen bestimmen.
218cdf0e10cSrcweir INetURLObject aObject( pBox->GetViewURL() );
219cdf0e10cSrcweir sal_Int32 nCount = aObject.getSegmentCount();
220cdf0e10cSrcweir
221cdf0e10cSrcweir ::svtools::VolumeInfo aVolInfo( sal_True /* volume */, sal_False /* remote */,
222cdf0e10cSrcweir sal_False /* removable */, sal_False /* floppy */,
223cdf0e10cSrcweir sal_False /* compact disk */ );
224cdf0e10cSrcweir sal_Bool bIsHighContrast = pBox->GetSettings().GetStyleSettings().GetHighContrastMode();
225cdf0e10cSrcweir Image aVolumeImage( SvFileInformationManager::GetFolderImage( aVolInfo, bIsHighContrast ) );
226cdf0e10cSrcweir
227cdf0e10cSrcweir while ( nCount >= 1 )
228cdf0e10cSrcweir {
229cdf0e10cSrcweir aObject.removeSegment();
230cdf0e10cSrcweir String* pParentURL = new String( aObject.GetMainURL( INetURLObject::NO_DECODE ) );
231cdf0e10cSrcweir
232cdf0e10cSrcweir if ( GetDialogParent()->isUrlAllowed( *pParentURL ) )
233cdf0e10cSrcweir {
234cdf0e10cSrcweir String aTitle;
235cdf0e10cSrcweir // 97148# --------------------------------
236cdf0e10cSrcweir if ( !GetDialogParent()->ContentGetTitle( *pParentURL, aTitle ) || aTitle.Len() == 0 )
237cdf0e10cSrcweir aTitle = aObject.getName();
238cdf0e10cSrcweir
239cdf0e10cSrcweir Image aImage = ( nCount > 1 ) // if nCount == 1 means workplace, which detects the wrong image
240cdf0e10cSrcweir ? SvFileInformationManager::GetImage( aObject, bIsHighContrast )
241cdf0e10cSrcweir : aVolumeImage;
242cdf0e10cSrcweir
243cdf0e10cSrcweir _pMenu->InsertItem( nItemId++, aTitle, aImage );
244cdf0e10cSrcweir _pURLs->Insert( pParentURL, _pURLs->Count() );
245cdf0e10cSrcweir
246cdf0e10cSrcweir if ( nCount == 1 )
247cdf0e10cSrcweir {
248cdf0e10cSrcweir // adjust the title of the top level entry (the workspace)
249cdf0e10cSrcweir _pMenu->SetItemText( --nItemId, SvtSimpleResId( STR_SVT_MIMETYPE_CNT_FSYSBOX ) );
250cdf0e10cSrcweir }
251cdf0e10cSrcweir }
252cdf0e10cSrcweir
253cdf0e10cSrcweir --nCount;
254cdf0e10cSrcweir }
255cdf0e10cSrcweir }
256cdf0e10cSrcweir
257cdf0e10cSrcweir //-----------------------------------------------------------------------------
Select()258cdf0e10cSrcweir void SvtUpButton_Impl::Select()
259cdf0e10cSrcweir {
260cdf0e10cSrcweir sal_uInt16 nId = GetCurItemId();
261cdf0e10cSrcweir
262cdf0e10cSrcweir if ( nId )
263cdf0e10cSrcweir {
264cdf0e10cSrcweir --nId;
265cdf0e10cSrcweir DBG_ASSERT( nId <= _pURLs->Count(), "SvtUpButton_Impl:falscher Index" );
266cdf0e10cSrcweir
267cdf0e10cSrcweir String aURL = *(_pURLs->GetObject( nId ));
268cdf0e10cSrcweir GetDialogParent()->OpenURL_Impl( aURL );
269cdf0e10cSrcweir }
270cdf0e10cSrcweir }
271cdf0e10cSrcweir
272cdf0e10cSrcweir //-----------------------------------------------------------------------------
Click()273cdf0e10cSrcweir void SvtUpButton_Impl::Click()
274cdf0e10cSrcweir {
275cdf0e10cSrcweir GetDialogParent()->PrevLevel_Impl();
276cdf0e10cSrcweir }
277cdf0e10cSrcweir
278cdf0e10cSrcweir //=============================================================================
279cdf0e10cSrcweir //= SvtTravelButton_Impl
280cdf0e10cSrcweir //=============================================================================
281cdf0e10cSrcweir
282cdf0e10cSrcweir //-----------------------------------------------------------------------------
SvtTravelButton_Impl(SvtFileDialog * pParent,const ResId & rResId)283cdf0e10cSrcweir SvtTravelButton_Impl::SvtTravelButton_Impl( SvtFileDialog* pParent, const ResId& rResId )
284cdf0e10cSrcweir :SvtFileDialogURLSelector ( pParent, rResId, IMG_FILEDLG_BTN_STD )
285cdf0e10cSrcweir {
286cdf0e10cSrcweir SetDropDown( 0 ); // by default, don't drop down, as we don't have favourites
287cdf0e10cSrcweir }
288cdf0e10cSrcweir
289cdf0e10cSrcweir //-----------------------------------------------------------------------------
SetFavouriteLocations(const::std::vector<String> & _rLocations)290cdf0e10cSrcweir void SvtTravelButton_Impl::SetFavouriteLocations( const ::std::vector< String >& _rLocations )
291cdf0e10cSrcweir {
292cdf0e10cSrcweir m_aFavourites = _rLocations;
293cdf0e10cSrcweir // enable the drop down if and only if we have favourites
294cdf0e10cSrcweir SetDropDown( m_aFavourites.empty() ? 0 : PUSHBUTTON_DROPDOWN_TOOLBOX );
295cdf0e10cSrcweir }
296cdf0e10cSrcweir
297cdf0e10cSrcweir //-----------------------------------------------------------------------------
~SvtTravelButton_Impl()298cdf0e10cSrcweir SvtTravelButton_Impl::~SvtTravelButton_Impl()
299cdf0e10cSrcweir {
300cdf0e10cSrcweir }
301cdf0e10cSrcweir
302cdf0e10cSrcweir //-----------------------------------------------------------------------------
FillURLMenu(PopupMenu * _pMenu)303cdf0e10cSrcweir void SvtTravelButton_Impl::FillURLMenu( PopupMenu* _pMenu )
304cdf0e10cSrcweir {
305cdf0e10cSrcweir if ( m_aFavourites.empty() )
306cdf0e10cSrcweir // though we claimed that we do not want to have a drop down button
307cdf0e10cSrcweir // in this case, VCL nevertheless behaves as if we had one .... :(
308cdf0e10cSrcweir return;
309cdf0e10cSrcweir
310cdf0e10cSrcweir _pMenu->Clear();
311cdf0e10cSrcweir
312cdf0e10cSrcweir sal_Bool bIsHighContrast = GetDialogParent()->GetView()->GetSettings().GetStyleSettings().GetHighContrastMode();
313cdf0e10cSrcweir
314cdf0e10cSrcweir sal_uInt16 nItemId = 1;
315cdf0e10cSrcweir String sDisplayName;
316cdf0e10cSrcweir
317cdf0e10cSrcweir ::std::vector< String >::const_iterator aLoop;
318cdf0e10cSrcweir for ( aLoop = m_aFavourites.begin(); aLoop != m_aFavourites.end(); ++aLoop, ++nItemId )
319cdf0e10cSrcweir {
320cdf0e10cSrcweir if ( GetDialogParent()->isUrlAllowed( *aLoop ) )
321cdf0e10cSrcweir {
322cdf0e10cSrcweir Image aImage = SvFileInformationManager::GetImage(
323cdf0e10cSrcweir INetURLObject(*aLoop), bIsHighContrast );
324cdf0e10cSrcweir if ( LocalFileHelper::ConvertURLToSystemPath(*aLoop, sDisplayName) )
325cdf0e10cSrcweir _pMenu->InsertItem( nItemId, sDisplayName, aImage );
326cdf0e10cSrcweir else
327cdf0e10cSrcweir _pMenu->InsertItem( nItemId, *aLoop, aImage );
328cdf0e10cSrcweir }
329cdf0e10cSrcweir }
330cdf0e10cSrcweir }
331cdf0e10cSrcweir
332cdf0e10cSrcweir //-----------------------------------------------------------------------------
Select()333cdf0e10cSrcweir void SvtTravelButton_Impl::Select()
334cdf0e10cSrcweir {
335cdf0e10cSrcweir sal_uInt16 nId = GetCurItemId();
336cdf0e10cSrcweir if ( nId )
337cdf0e10cSrcweir {
338cdf0e10cSrcweir --nId;
339cdf0e10cSrcweir DBG_ASSERT( nId < m_aFavourites.size(), "SvtTravelButton_Impl::Select: invalid index!" );
340cdf0e10cSrcweir if ( nId < m_aFavourites.size() )
341cdf0e10cSrcweir OpenURL( m_aFavourites[ nId ] );
342cdf0e10cSrcweir }
343cdf0e10cSrcweir }
344cdf0e10cSrcweir
345cdf0e10cSrcweir //-----------------------------------------------------------------------------
Click()346cdf0e10cSrcweir void SvtTravelButton_Impl::Click()
347cdf0e10cSrcweir {
348cdf0e10cSrcweir OpenURL( GetDialogParent()->GetStandardDir() );
349cdf0e10cSrcweir }
350cdf0e10cSrcweir
351cdf0e10cSrcweir //*****************************************************************************
352cdf0e10cSrcweir // SvtExpFileDlg_Impl
353cdf0e10cSrcweir //*****************************************************************************
354cdf0e10cSrcweir
SvtExpFileDlg_Impl(WinBits)355cdf0e10cSrcweir SvtExpFileDlg_Impl::SvtExpFileDlg_Impl( WinBits ) :
356cdf0e10cSrcweir
357cdf0e10cSrcweir _pLbFilter ( NULL ),
358cdf0e10cSrcweir _pCurFilter ( NULL ),
359cdf0e10cSrcweir _pFilter ( new SvtFileDialogFilterList_Impl() ),
360cdf0e10cSrcweir _pUserFilter ( NULL ),
361cdf0e10cSrcweir _pFtFileName ( NULL ),
362cdf0e10cSrcweir _pEdFileName ( NULL ),
363cdf0e10cSrcweir _pFtFileVersion ( NULL ),
364cdf0e10cSrcweir _pLbFileVersion ( NULL ),
365cdf0e10cSrcweir _pFtTemplates ( NULL ),
366cdf0e10cSrcweir _pLbTemplates ( NULL ),
367cdf0e10cSrcweir _pFtImageTemplates ( NULL ),
368cdf0e10cSrcweir _pLbImageTemplates ( NULL ),
369cdf0e10cSrcweir _pFtFileType ( NULL ),
370cdf0e10cSrcweir _pBtnFileOpen ( NULL ),
371cdf0e10cSrcweir _pBtnCancel ( NULL ),
372cdf0e10cSrcweir _pBtnHelp ( NULL ),
373cdf0e10cSrcweir _pBtnUp ( NULL ),
374cdf0e10cSrcweir _pBtnNewFolder ( NULL ),
375cdf0e10cSrcweir _pBtnStandard ( NULL ),
376cdf0e10cSrcweir _pCbPassword ( NULL ),
377cdf0e10cSrcweir _pFtCurrentPath ( NULL ),
378cdf0e10cSrcweir _pCbAutoExtension ( NULL ),
379cdf0e10cSrcweir _pCbOptions ( NULL ),
380cdf0e10cSrcweir _nState ( FILEDLG_STATE_REMOTE ),
381cdf0e10cSrcweir _nStyle ( 0 ),
382cdf0e10cSrcweir _bDoubleClick ( sal_False ),
383cdf0e10cSrcweir m_bNeedDelayedFilterExecute ( sal_False ),
384cdf0e10cSrcweir _pDefaultFilter ( NULL ),
385cdf0e10cSrcweir _bMultiSelection ( sal_False ),
386cdf0e10cSrcweir _nFixDeltaHeight ( 0 ),
387cdf0e10cSrcweir _bFolderHasOpened ( sal_False )
388cdf0e10cSrcweir {
389cdf0e10cSrcweir }
390cdf0e10cSrcweir
391cdf0e10cSrcweir //*****************************************************************************
392cdf0e10cSrcweir
~SvtExpFileDlg_Impl()393cdf0e10cSrcweir SvtExpFileDlg_Impl::~SvtExpFileDlg_Impl()
394cdf0e10cSrcweir {
395cdf0e10cSrcweir delete _pFtCurrentPath;
396cdf0e10cSrcweir delete _pCbPassword;
397cdf0e10cSrcweir delete _pCbAutoExtension;
398cdf0e10cSrcweir delete _pCbOptions;
399cdf0e10cSrcweir delete _pBtnStandard;
400cdf0e10cSrcweir delete _pBtnNewFolder;
401cdf0e10cSrcweir delete _pBtnUp;
402cdf0e10cSrcweir delete _pBtnHelp;
403cdf0e10cSrcweir delete _pBtnCancel;
404cdf0e10cSrcweir delete _pBtnFileOpen;
405cdf0e10cSrcweir delete _pLbFilter;
406cdf0e10cSrcweir delete _pFtFileType;
407cdf0e10cSrcweir delete _pLbFileVersion;
408cdf0e10cSrcweir delete _pFtFileVersion;
409cdf0e10cSrcweir delete _pFtTemplates;
410cdf0e10cSrcweir delete _pLbTemplates;
411cdf0e10cSrcweir delete _pFtImageTemplates;
412cdf0e10cSrcweir delete _pLbImageTemplates;
413cdf0e10cSrcweir delete _pEdFileName;
414cdf0e10cSrcweir delete _pFtFileName;
415cdf0e10cSrcweir delete _pUserFilter;
416cdf0e10cSrcweir delete _pFilter;
417cdf0e10cSrcweir }
418cdf0e10cSrcweir
419cdf0e10cSrcweir //*****************************************************************************
420cdf0e10cSrcweir
SetStandardDir(const String & _rDir)421cdf0e10cSrcweir void SvtExpFileDlg_Impl::SetStandardDir( const String& _rDir )
422cdf0e10cSrcweir {
423cdf0e10cSrcweir _aStdDir = _rDir;
424cdf0e10cSrcweir if ( 0 == _aStdDir.Len() )
425cdf0e10cSrcweir _aStdDir.AssignAscii( "file:///" );
426cdf0e10cSrcweir }
427cdf0e10cSrcweir
428cdf0e10cSrcweir //*****************************************************************************
429cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0
430cdf0e10cSrcweir //-----------------------------------------------------------------------------
431cdf0e10cSrcweir namespace {
lcl_DecoratedFilter(const String & _rOriginalFilter)432cdf0e10cSrcweir String lcl_DecoratedFilter( const String& _rOriginalFilter )
433cdf0e10cSrcweir {
434cdf0e10cSrcweir String aDecoratedFilter = '<';
435cdf0e10cSrcweir aDecoratedFilter += _rOriginalFilter;
436cdf0e10cSrcweir aDecoratedFilter += '>';
437cdf0e10cSrcweir return aDecoratedFilter;
438cdf0e10cSrcweir }
439cdf0e10cSrcweir }
440cdf0e10cSrcweir #endif
441cdf0e10cSrcweir //-----------------------------------------------------------------------------
442cdf0e10cSrcweir
ClearFilterList()443cdf0e10cSrcweir void SvtExpFileDlg_Impl::ClearFilterList( )
444cdf0e10cSrcweir {
445cdf0e10cSrcweir _pLbFilter->Clear();
446cdf0e10cSrcweir }
447cdf0e10cSrcweir
448cdf0e10cSrcweir //-----------------------------------------------------------------------------
SetCurFilter(SvtFileDialogFilter_Impl * pFilter,const String & rDisplayName)449cdf0e10cSrcweir void SvtExpFileDlg_Impl::SetCurFilter( SvtFileDialogFilter_Impl* pFilter, const String& rDisplayName )
450cdf0e10cSrcweir {
451cdf0e10cSrcweir DBG_ASSERT( pFilter, "SvtExpFileDlg_Impl::SetCurFilter: invalid filter!" );
452cdf0e10cSrcweir DBG_ASSERT( ( rDisplayName == pFilter->GetName() )
453cdf0e10cSrcweir || ( rDisplayName == lcl_DecoratedFilter( pFilter->GetName() ) ),
454cdf0e10cSrcweir "SvtExpFileDlg_Impl::SetCurFilter: arguments are inconsistent!" );
455cdf0e10cSrcweir
456cdf0e10cSrcweir _pCurFilter = pFilter;
457cdf0e10cSrcweir m_sCurrentFilterDisplayName = rDisplayName;
458cdf0e10cSrcweir }
459cdf0e10cSrcweir
460cdf0e10cSrcweir //-----------------------------------------------------------------------------
InsertFilterListEntry(const SvtFileDialogFilter_Impl * _pFilterDesc)461cdf0e10cSrcweir void SvtExpFileDlg_Impl::InsertFilterListEntry( const SvtFileDialogFilter_Impl* _pFilterDesc )
462cdf0e10cSrcweir {
463cdf0e10cSrcweir String sName = _pFilterDesc->GetName();
464cdf0e10cSrcweir if ( _pFilterDesc->isGroupSeparator() )
465cdf0e10cSrcweir sName = String::CreateFromAscii( "------------------------------------------" );
466cdf0e10cSrcweir else
467cdf0e10cSrcweir sName = _pFilterDesc->GetName();
468cdf0e10cSrcweir
469cdf0e10cSrcweir // insert an set user data
470cdf0e10cSrcweir sal_uInt16 nPos = _pLbFilter->InsertEntry( sName );
471cdf0e10cSrcweir _pLbFilter->SetEntryData( nPos, const_cast< void* >( static_cast< const void* >( _pFilterDesc ) ) );
472cdf0e10cSrcweir }
473cdf0e10cSrcweir
474cdf0e10cSrcweir //-----------------------------------------------------------------------------
475cdf0e10cSrcweir
InitFilterList()476cdf0e10cSrcweir void SvtExpFileDlg_Impl::InitFilterList( )
477cdf0e10cSrcweir {
478cdf0e10cSrcweir // clear the current list
479cdf0e10cSrcweir ClearFilterList( );
480cdf0e10cSrcweir
481cdf0e10cSrcweir // reinit it
482cdf0e10cSrcweir sal_uInt16 nPos = _pFilter->Count();
483cdf0e10cSrcweir
484cdf0e10cSrcweir // search for the first entry which is no group separator
485cdf0e10cSrcweir while ( nPos-- && _pFilter->GetObject( nPos ) && _pFilter->GetObject( nPos )->isGroupSeparator() )
486cdf0e10cSrcweir ;
487cdf0e10cSrcweir
488cdf0e10cSrcweir // add all following entries
489cdf0e10cSrcweir while ( (sal_Int16)nPos >= 0 )
490cdf0e10cSrcweir InsertFilterListEntry( _pFilter->GetObject( nPos-- ) );
491cdf0e10cSrcweir }
492cdf0e10cSrcweir
493cdf0e10cSrcweir //-----------------------------------------------------------------------------
494cdf0e10cSrcweir
CreateFilterListControl(Window * _pParent,const ResId & _rId)495cdf0e10cSrcweir void SvtExpFileDlg_Impl::CreateFilterListControl( Window* _pParent, const ResId& _rId )
496cdf0e10cSrcweir {
497cdf0e10cSrcweir DBG_ASSERT( !_pLbFilter, "SvtExpFileDlg_Impl::CreateFilterListControl: already created the control!" );
498cdf0e10cSrcweir if ( !_pLbFilter )
499cdf0e10cSrcweir {
500cdf0e10cSrcweir _pLbFilter = new ListBox( _pParent, _rId );
501cdf0e10cSrcweir _pLbFilter->SetDropDownLineCount( 10 );
502cdf0e10cSrcweir }
503cdf0e10cSrcweir }
504