1 /*************************************************************************
3 * OpenOffice.org - a multi-platform office productivity suite
9 * last change: $Author: tml $ $Date: 2008-03-26 02:30:23 +0200 (on, 26 mar 2008) $
11 * The Contents of this file are made available subject to
12 * the terms of GNU Lesser General Public License Version 2.1.
15 * GNU Lesser General Public License Version 2.1
16 * =============================================
17 * Copyright 2005 by Sun Microsystems, Inc.
18 * 901 San Antonio Road, Palo Alto, CA 94303, USA
20 * This library is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU Lesser General Public
22 * License version 2.1, as published by the Free Software Foundation.
24 * This library is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27 * Lesser General Public License for more details.
29 * You should have received a copy of the GNU Lesser General Public
30 * License along with this library; if not, write to the Free Software
31 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
34 ************************************************************************/
35 #ifndef INCLUDED_ODMA_FILEPICKER_HXX
36 #define INCLUDED_ODMA_FILEPICKER_HXX
38 #ifndef _CPPUHELPER_COMPBASE9_HXX_
39 #include <cppuhelper/compbase9.hxx>
42 #ifndef _COM_SUN_STAR_UI_DIALOGS_XFILEPICKERCONTROLACCESS_HPP_
43 #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
45 #ifndef _COM_SUN_STAR_UI_DIALOGS_XFILEPICKERNOTIFIER_HPP_
46 #include <com/sun/star/ui/dialogs/XFilePickerNotifier.hpp>
48 #ifndef _COM_SUN_STAR_UI_DIALOGS_XFILEPREVIEW_HPP_
49 #include <com/sun/star/ui/dialogs/XFilePreview.hpp>
51 #ifndef _COM_SUN_STAR_UI_DIALOGS_XFILTERMANAGER_HPP_
52 #include <com/sun/star/ui/dialogs/XFilterManager.hpp>
54 #ifndef _COM_SUN_STAR_UI_DIALOGS_XFILTERGROUPMANAGER_HPP_
55 #include <com/sun/star/ui/dialogs/XFilterGroupManager.hpp>
57 #ifndef _COM_SUN_STAR_UI_DIALOGS_XFILEPICKERLISTENER_HPP_
58 #include <com/sun/star/ui/dialogs/XFilePickerListener.hpp>
60 #ifndef _COM_SUN_STAR_UTIL_XCANCELLABLE_HPP_
61 #include <com/sun/star/util/XCancellable.hpp>
63 #ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
64 #include <com/sun/star/lang/XServiceInfo.hpp>
66 #ifndef _COM_SUN_STAR_UNO_XCOMPONENT_CONTEXT_HPP_
67 #include <com/sun/star/uno/XComponentContext.hpp>
70 #ifndef _COM_SUN_STAR_LANG_XINITIALIZATION_HPP_
71 #include <com/sun/star/lang/XInitialization.hpp>
74 // class ODMAFilePicker ---------------------------------------------------
76 class ODMAFilePicker
:
77 public cppu::WeakComponentImplHelper9
<
78 ::com::sun::star::ui::dialogs::XFilterManager
,
79 ::com::sun::star::ui::dialogs::XFilterGroupManager
,
80 ::com::sun::star::ui::dialogs::XFilePickerControlAccess
,
81 ::com::sun::star::ui::dialogs::XFilePickerNotifier
,
82 ::com::sun::star::ui::dialogs::XFilePreview
,
83 ::com::sun::star::lang::XInitialization
,
84 ::com::sun::star::util::XCancellable
,
85 ::com::sun::star::lang::XEventListener
,
86 ::com::sun::star::lang::XServiceInfo
>
90 sal_Bool m_bMultiSelectionMode
;
91 rtl::OUString m_aDefaultName
;
92 rtl::OUString m_aDisplayDirectory
;
93 ::com::sun::star::uno::Sequence
< rtl::OUString
> m_aFiles
;
94 enum { OPEN
, SAVE
} m_nDialogKind
;
96 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> m_xSystemFilePicker
;
99 ::osl::Mutex m_rbHelperMtx
;
103 ODMAFilePicker( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& xFactory
);
105 // XFilterManager functions
107 virtual void SAL_CALL
appendFilter( const ::rtl::OUString
& aTitle
,
108 const ::rtl::OUString
& aFilter
)
109 throw( ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
);
111 virtual void SAL_CALL
setCurrentFilter( const ::rtl::OUString
& aTitle
)
112 throw( ::com::sun::star::lang::IllegalArgumentException
,
113 ::com::sun::star::uno::RuntimeException
);
115 virtual ::rtl::OUString SAL_CALL
getCurrentFilter( )
116 throw( ::com::sun::star::uno::RuntimeException
);
118 // XFilterGroupManager functions
120 virtual void SAL_CALL
appendFilterGroup( const ::rtl::OUString
& sGroupTitle
,
121 const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::StringPair
>& aFilters
)
122 throw (::com::sun::star::lang::IllegalArgumentException
,
123 ::com::sun::star::uno::RuntimeException
);
125 // XFilePickerControlAccess functions
127 virtual void SAL_CALL
setValue( sal_Int16 nControlID
,
128 sal_Int16 nControlAction
,
129 const ::com::sun::star::uno::Any
& aValue
)
130 throw( ::com::sun::star::uno::RuntimeException
);
132 virtual ::com::sun::star::uno::Any SAL_CALL
getValue( sal_Int16 nControlID
,
133 sal_Int16 nControlAction
)
134 throw( ::com::sun::star::uno::RuntimeException
);
136 virtual void SAL_CALL
setLabel( sal_Int16 nControlID
,
137 const ::rtl::OUString
& aValue
)
138 throw ( ::com::sun::star::uno::RuntimeException
);
140 virtual ::rtl::OUString SAL_CALL
getLabel( sal_Int16 nControlID
)
141 throw ( ::com::sun::star::uno::RuntimeException
);
143 virtual void SAL_CALL
enableControl( sal_Int16 nControlID
,
145 throw( ::com::sun::star::uno::RuntimeException
);
147 // XFilePicker functions
149 virtual void SAL_CALL
setMultiSelectionMode( sal_Bool bMode
)
150 throw( ::com::sun::star::uno::RuntimeException
);
152 virtual void SAL_CALL
setDefaultName( const ::rtl::OUString
& aName
)
153 throw( ::com::sun::star::uno::RuntimeException
);
155 virtual void SAL_CALL
setDisplayDirectory( const ::rtl::OUString
& aDirectory
)
156 throw( ::com::sun::star::lang::IllegalArgumentException
,
157 ::com::sun::star::uno::RuntimeException
);
159 virtual ::rtl::OUString SAL_CALL
getDisplayDirectory( )
160 throw( ::com::sun::star::uno::RuntimeException
);
162 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getFiles( )
163 throw( ::com::sun::star::uno::RuntimeException
);
165 // XExecutableDialog functions
167 virtual void SAL_CALL
setTitle( const ::rtl::OUString
& aTitle
)
168 throw (::com::sun::star::uno::RuntimeException
);
170 virtual sal_Int16 SAL_CALL
execute( )
171 throw (::com::sun::star::uno::RuntimeException
);
173 // XFilePickerNotifier functions
175 virtual void SAL_CALL
addFilePickerListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::ui::dialogs::XFilePickerListener
>& xListener
)
176 throw ( ::com::sun::star::uno::RuntimeException
);
178 virtual void SAL_CALL
removeFilePickerListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::ui::dialogs::XFilePickerListener
>& xListener
)
179 throw ( ::com::sun::star::uno::RuntimeException
);
181 // XFilePreview functions
183 virtual ::com::sun::star::uno::Sequence
< sal_Int16
> SAL_CALL
getSupportedImageFormats( )
184 throw ( ::com::sun::star::uno::RuntimeException
);
186 virtual sal_Int32 SAL_CALL
getTargetColorDepth( )
187 throw ( ::com::sun::star::uno::RuntimeException
);
189 virtual sal_Int32 SAL_CALL
getAvailableWidth( )
190 throw ( ::com::sun::star::uno::RuntimeException
);
192 virtual sal_Int32 SAL_CALL
getAvailableHeight( )
193 throw ( ::com::sun::star::uno::RuntimeException
);
195 virtual void SAL_CALL
setImage( sal_Int16 aImageFormat
,
196 const ::com::sun::star::uno::Any
& aImage
)
197 throw ( ::com::sun::star::lang::IllegalArgumentException
,
198 ::com::sun::star::uno::RuntimeException
);
200 virtual sal_Bool SAL_CALL
setShowState( sal_Bool bShowState
)
201 throw ( ::com::sun::star::uno::RuntimeException
);
203 virtual sal_Bool SAL_CALL
getShowState( )
204 throw ( ::com::sun::star::uno::RuntimeException
);
206 // XInitialization functions
208 virtual void SAL_CALL
initialize( const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>& aArguments
)
209 throw ( ::com::sun::star::uno::Exception
, ::com::sun::star::uno::RuntimeException
);
211 // XCancellable functions
213 virtual void SAL_CALL
cancel( )
214 throw( ::com::sun::star::uno::RuntimeException
);
216 // XEventListener functions
218 using cppu::WeakComponentImplHelperBase::disposing
;
219 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& aEvent
)
220 throw( ::com::sun::star::uno::RuntimeException
);
222 // XServiceInfo functions
224 virtual ::rtl::OUString SAL_CALL
getImplementationName( )
225 throw( ::com::sun::star::uno::RuntimeException
);
227 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& sServiceName
)
228 throw( ::com::sun::star::uno::RuntimeException
);
230 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames( )
231 throw( ::com::sun::star::uno::RuntimeException
);
233 /* Helper for XServiceInfo */
234 static ::com::sun::star::uno::Sequence
< ::rtl::OUString
> impl_getStaticSupportedServiceNames( );
235 static ::rtl::OUString
impl_getStaticImplementationName( );
237 /* Helper for registry */
238 static ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> SAL_CALL
impl_createInstance ( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& rxContext
)
239 throw( ::com::sun::star::uno::Exception
);
242 #endif // INCLUDED_ODMA_FILEPICKER_HXX