1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _FILEPICKER_HXX_
21 #define _FILEPICKER_HXX_
23 #include <cppuhelper/compbase6.hxx>
24 #include <osl/mutex.hxx>
25 #include <com/sun/star/lang/XInitialization.hpp>
26 #include <com/sun/star/lang/XServiceInfo.hpp>
27 #include <com/sun/star/ui/dialogs/XFilePicker2.hpp>
28 #include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
29 #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
30 #include <com/sun/star/ui/dialogs/XFilePreview.hpp>
31 #include "asynceventnotifier.hxx"
32 #include "eventnotification.hxx"
36 //----------------------------------------------------------
37 // Implementation class for the XFilePicker Interface
38 //----------------------------------------------------------
40 //----------------------------------------------------------
41 // forward declarations
42 //----------------------------------------------------------
44 class CWinFileOpenImpl
;
46 //----------------------------------------------------------
48 //----------------------------------------------------------
50 class CFilePickerDummy
54 osl::Mutex m_rbHelperMtx
;
57 typedef ::cppu::WeakComponentImplHelper6
<
58 ::com::sun::star::ui::dialogs::XFilePicker2
,
59 ::com::sun::star::ui::dialogs::XFilePicker3
,
60 ::com::sun::star::ui::dialogs::XFilePickerControlAccess
,
61 ::com::sun::star::ui::dialogs::XFilePreview
,
62 ::com::sun::star::lang::XInitialization
,
63 ::com::sun::star::lang::XServiceInfo
> CFilePicker_Base
;
66 public CFilePickerDummy
,
67 public CFilePicker_Base
72 CFilePicker( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& xServiceMgr
);
74 //------------------------------------------------------------------------------------
75 // XFilePickerNotifier
76 //------------------------------------------------------------------------------------
78 virtual void SAL_CALL
addFilePickerListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::ui::dialogs::XFilePickerListener
>& xListener
)
79 throw( ::com::sun::star::uno::RuntimeException
);
80 virtual void SAL_CALL
removeFilePickerListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::ui::dialogs::XFilePickerListener
>& xListener
)
81 throw( ::com::sun::star::uno::RuntimeException
);
83 //------------------------------------------------------------------------------------
84 // XExecutableDialog functions
85 //------------------------------------------------------------------------------------
87 virtual void SAL_CALL
setTitle( const OUString
& aTitle
)
88 throw( ::com::sun::star::uno::RuntimeException
);
90 virtual sal_Int16 SAL_CALL
execute( )
91 throw( ::com::sun::star::uno::RuntimeException
);
93 //------------------------------------------------------------------------------------
94 // XFilePicker functions
95 //------------------------------------------------------------------------------------
97 virtual void SAL_CALL
setMultiSelectionMode( sal_Bool bMode
)
98 throw( ::com::sun::star::uno::RuntimeException
);
100 virtual void SAL_CALL
setDefaultName( const OUString
& aName
)
101 throw( ::com::sun::star::uno::RuntimeException
);
103 virtual void SAL_CALL
setDisplayDirectory( const OUString
& aDirectory
)
104 throw( ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
);
106 virtual OUString SAL_CALL
getDisplayDirectory( )
107 throw( ::com::sun::star::uno::RuntimeException
);
109 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getFiles( )
110 throw( ::com::sun::star::uno::RuntimeException
);
112 //------------------------------------------------------------------------------------
113 // XFilePicker2 functions
114 //------------------------------------------------------------------------------------
115 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSelectedFiles( )
116 throw (::com::sun::star::uno::RuntimeException
);
118 //------------------------------------------------------------------------------------
119 // XFilterManager functions
120 //------------------------------------------------------------------------------------
122 virtual void SAL_CALL
appendFilter( const OUString
& aTitle
, const OUString
& aFilter
)
123 throw( ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
);
125 virtual void SAL_CALL
setCurrentFilter( const OUString
& aTitle
)
126 throw( ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
);
128 virtual OUString SAL_CALL
getCurrentFilter( )
129 throw( ::com::sun::star::uno::RuntimeException
);
131 //------------------------------------------------------------------------------------
132 // XFilterGroupManager functions
133 //------------------------------------------------------------------------------------
135 virtual void SAL_CALL
appendFilterGroup( const OUString
& sGroupTitle
, const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::StringPair
>& aFilters
)
136 throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
);
138 //------------------------------------------------------------------------------------
139 // XFilePickerControlAccess functions
140 //------------------------------------------------------------------------------------
142 virtual void SAL_CALL
setValue( sal_Int16 aControlId
, sal_Int16 aControlAction
, const ::com::sun::star::uno::Any
& aValue
)
143 throw (::com::sun::star::uno::RuntimeException
);
145 virtual ::com::sun::star::uno::Any SAL_CALL
getValue( sal_Int16 aControlId
, sal_Int16 aControlAction
)
146 throw (::com::sun::star::uno::RuntimeException
);
148 virtual void SAL_CALL
enableControl( sal_Int16 aControlId
, sal_Bool bEnable
)
149 throw(::com::sun::star::uno::RuntimeException
);
151 virtual void SAL_CALL
setLabel( sal_Int16 aControlId
, const OUString
& aLabel
)
152 throw (::com::sun::star::uno::RuntimeException
);
154 virtual OUString SAL_CALL
getLabel( sal_Int16 aControlId
)
155 throw (::com::sun::star::uno::RuntimeException
);
157 //------------------------------------------------
159 //------------------------------------------------
161 virtual ::com::sun::star::uno::Sequence
< sal_Int16
> SAL_CALL
getSupportedImageFormats( ) throw (::com::sun::star::uno::RuntimeException
);
163 virtual sal_Int32 SAL_CALL
getTargetColorDepth( ) throw (::com::sun::star::uno::RuntimeException
);
165 virtual sal_Int32 SAL_CALL
getAvailableWidth( ) throw (::com::sun::star::uno::RuntimeException
);
167 virtual sal_Int32 SAL_CALL
getAvailableHeight( ) throw (::com::sun::star::uno::RuntimeException
);
169 virtual void SAL_CALL
setImage( sal_Int16 aImageFormat
, const ::com::sun::star::uno::Any
& aImage
) throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
);
171 virtual sal_Bool SAL_CALL
setShowState( sal_Bool bShowState
) throw (::com::sun::star::uno::RuntimeException
);
173 virtual sal_Bool SAL_CALL
getShowState( ) throw (::com::sun::star::uno::RuntimeException
);
175 //------------------------------------------------
177 //------------------------------------------------
179 virtual void SAL_CALL
initialize( const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>& aArguments
)
180 throw(::com::sun::star::uno::Exception
, ::com::sun::star::uno::RuntimeException
);
182 //------------------------------------------------
184 //------------------------------------------------
186 virtual void SAL_CALL
cancel( )
187 throw(::com::sun::star::uno::RuntimeException
);
189 //------------------------------------------------
191 //------------------------------------------------
193 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& aEvent
)
194 throw(::com::sun::star::uno::RuntimeException
);
196 //------------------------------------------------
198 //------------------------------------------------
200 virtual OUString SAL_CALL
getImplementationName( )
201 throw(::com::sun::star::uno::RuntimeException
);
203 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
204 throw(::com::sun::star::uno::RuntimeException
);
206 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( )
207 throw(::com::sun::star::uno::RuntimeException
);
209 //------------------------------------------------------------------------------------
210 // FilePicker Event functions
211 //------------------------------------------------------------------------------------
213 void SAL_CALL
fileSelectionChanged( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent
);
214 void SAL_CALL
directoryChanged( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent
);
215 OUString SAL_CALL
helpRequested( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent
) const;
216 void SAL_CALL
controlStateChanged( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent
);
217 void SAL_CALL
dialogSizeChanged( );
219 bool startupEventNotification(bool bStartupSuspended
);
220 void shutdownEventNotification();
221 void suspendEventNotification();
222 void resumeEventNotification();
225 // prevent copy and assignment
226 CFilePicker( const CFilePicker
& );
227 CFilePicker
& operator=( const CFilePicker
& );
229 using WeakComponentImplHelperBase::disposing
;
232 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> m_xServiceMgr
; // to instanciate own services
233 CAsyncEventNotifier m_aAsyncEventNotifier
;
234 std::auto_ptr
<CWinFileOpenImpl
> m_pImpl
;
239 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */