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 _SALAQUAFILEPICKER_HXX_
21 #define _SALAQUAFILEPICKER_HXX_
23 #include <cppuhelper/compbase4.hxx>
24 #include <com/sun/star/lang/XInitialization.hpp>
25 #include <com/sun/star/lang/XServiceInfo.hpp>
26 #include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
27 #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
28 #include <com/sun/star/beans/StringPair.hpp>
30 #include "SalAquaPicker.hxx"
35 #include <rtl/ustring.hxx>
36 #include "FilterHelper.hxx"
37 #include "AquaFilePickerDelegate.hxx"
39 //----------------------------------------------------------
40 // Implementation class for the XFilePicker Interface
41 //----------------------------------------------------------
43 //----------------------------------------------------------
44 // forward declarations
45 //----------------------------------------------------------
47 //----------------------------------------------------------
49 //----------------------------------------------------------
51 typedef ::cppu::WeakComponentImplHelper4
<
52 ::com::sun::star::ui::dialogs::XFilePicker3
,
53 ::com::sun::star::ui::dialogs::XFilePickerControlAccess
,
54 ::com::sun::star::lang::XInitialization
,
55 ::com::sun::star::lang::XServiceInfo
> SalAquaFilePicker_Base
;
57 class SalAquaFilePicker
:
59 public SalAquaFilePicker_Base
66 //------------------------------------------------------------------------------------
67 // XFilePickerNotifier
68 //------------------------------------------------------------------------------------
70 virtual void SAL_CALL
addFilePickerListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::ui::dialogs::XFilePickerListener
>& xListener
)
71 throw( ::com::sun::star::uno::RuntimeException
);
72 virtual void SAL_CALL
removeFilePickerListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::ui::dialogs::XFilePickerListener
>& xListener
)
73 throw( ::com::sun::star::uno::RuntimeException
);
75 //------------------------------------------------------------------------------------
76 // XExecutableDialog functions
77 //------------------------------------------------------------------------------------
79 virtual void SAL_CALL
setTitle( const OUString
& aTitle
)
80 throw( ::com::sun::star::uno::RuntimeException
);
82 virtual sal_Int16 SAL_CALL
execute( )
83 throw( ::com::sun::star::uno::RuntimeException
);
85 //------------------------------------------------------------------------------------
86 // XFilePicker functions
87 //------------------------------------------------------------------------------------
89 virtual void SAL_CALL
setMultiSelectionMode( sal_Bool bMode
)
90 throw( ::com::sun::star::uno::RuntimeException
);
92 virtual void SAL_CALL
setDefaultName( const OUString
& aName
)
93 throw( ::com::sun::star::uno::RuntimeException
);
95 virtual void SAL_CALL
setDisplayDirectory( const OUString
& aDirectory
)
96 throw( com::sun::star::lang::IllegalArgumentException
,
97 ::com::sun::star::uno::RuntimeException
);
99 virtual OUString SAL_CALL
getDisplayDirectory( )
100 throw( ::com::sun::star::uno::RuntimeException
);
102 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getFiles( )
103 throw( ::com::sun::star::uno::RuntimeException
);
105 //------------------------------------------------------------------------------------
106 // XFilterManager functions
107 //------------------------------------------------------------------------------------
109 virtual void SAL_CALL
appendFilter( const OUString
& aTitle
, const OUString
& aFilter
)
110 throw( ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
);
112 virtual void SAL_CALL
setCurrentFilter( const OUString
& aTitle
)
113 throw( ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
);
115 virtual OUString SAL_CALL
getCurrentFilter( )
116 throw( ::com::sun::star::uno::RuntimeException
);
118 //------------------------------------------------------------------------------------
119 // XFilterGroupManager functions
120 //------------------------------------------------------------------------------------
122 virtual void SAL_CALL
appendFilterGroup( const OUString
& sGroupTitle
, const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::StringPair
>& aFilters
)
123 throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
);
125 //------------------------------------------------------------------------------------
126 // XFilePickerControlAccess functions
127 //------------------------------------------------------------------------------------
129 virtual void SAL_CALL
setValue( sal_Int16 nControlId
, sal_Int16 nControlAction
, 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 aControlId
, sal_Int16 aControlAction
)
133 throw (::com::sun::star::uno::RuntimeException
);
135 virtual void SAL_CALL
enableControl( sal_Int16 nControlId
, sal_Bool bEnable
)
136 throw(::com::sun::star::uno::RuntimeException
);
138 virtual void SAL_CALL
setLabel( sal_Int16 nControlId
, const OUString
& aLabel
)
139 throw (::com::sun::star::uno::RuntimeException
);
141 virtual OUString SAL_CALL
getLabel( sal_Int16 nControlId
)
142 throw (::com::sun::star::uno::RuntimeException
);
144 //------------------------------------------------
146 //------------------------------------------------
148 virtual void SAL_CALL
initialize( const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>& aArguments
)
149 throw(::com::sun::star::uno::Exception
, ::com::sun::star::uno::RuntimeException
);
151 //------------------------------------------------
153 //------------------------------------------------
155 virtual void SAL_CALL
cancel( )
156 throw( ::com::sun::star::uno::RuntimeException
);
158 //------------------------------------------------
160 //------------------------------------------------
162 using cppu::WeakComponentImplHelperBase::disposing
;
163 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& aEvent
)
164 throw(::com::sun::star::uno::RuntimeException
);
166 //------------------------------------------------
168 //------------------------------------------------
170 virtual OUString SAL_CALL
getImplementationName( )
171 throw(::com::sun::star::uno::RuntimeException
);
173 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
174 throw(::com::sun::star::uno::RuntimeException
);
176 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( )
177 throw(::com::sun::star::uno::RuntimeException
);
179 //------------------------------------------------------------------------------------
180 // FilePicker Event functions
181 //------------------------------------------------------------------------------------
183 void SAL_CALL
fileSelectionChanged( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent
);
184 void SAL_CALL
directoryChanged( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent
);
185 // OUString SAL_CALL helpRequested( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent ) const;
186 void SAL_CALL
controlStateChanged( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent
);
187 void SAL_CALL
dialogSizeChanged( );
189 inline AquaFilePickerDelegate
* getDelegate() {
193 inline OUString
getSaveFileName() {
194 return m_sSaveFileName
;
198 // prevent copy and assignment
199 SalAquaFilePicker( const SalAquaFilePicker
& );
200 SalAquaFilePicker
& operator=( const SalAquaFilePicker
& );
202 virtual void ensureFilterHelper();
204 ::com::sun::star::uno::Reference
< ::com::sun::star::ui::dialogs::XFilePickerListener
>
207 FilterHelper
*m_pFilterHelper
;
209 OUString m_sSaveFileName
;
211 AquaFilePickerDelegate
*m_pDelegate
;
213 void updateFilterUI();
214 void updateSaveFileNameExtension();
218 virtual ~SalAquaFilePicker();
220 void filterControlChanged();
222 void implInitialize();
226 #endif // _SALAQUAFILEPICKER_HXX_
228 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */