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 INCLUDED_FPICKER_SOURCE_AQUA_SALAQUAFILEPICKER_HXX
21 #define INCLUDED_FPICKER_SOURCE_AQUA_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"
32 #include <rtl/ustring.hxx>
33 #include "FilterHelper.hxx"
34 #include "AquaFilePickerDelegate.hxx"
36 // Implementation class for the XFilePicker Interface
38 typedef ::cppu::WeakComponentImplHelper4
<
39 ::com::sun::star::ui::dialogs::XFilePicker3
,
40 ::com::sun::star::ui::dialogs::XFilePickerControlAccess
,
41 ::com::sun::star::lang::XInitialization
,
42 ::com::sun::star::lang::XServiceInfo
> SalAquaFilePicker_Base
;
44 class SalAquaFilePicker
:
46 public SalAquaFilePicker_Base
53 // XFilePickerNotifier
55 virtual void SAL_CALL
addFilePickerListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::ui::dialogs::XFilePickerListener
>& xListener
)
56 throw( ::com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
57 virtual void SAL_CALL
removeFilePickerListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::ui::dialogs::XFilePickerListener
>& xListener
)
58 throw( ::com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
60 // XExecutableDialog functions
62 virtual void SAL_CALL
setTitle( const OUString
& aTitle
)
63 throw( ::com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
65 virtual sal_Int16 SAL_CALL
execute( )
66 throw( ::com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
68 // XFilePicker functions
70 virtual void SAL_CALL
setMultiSelectionMode( sal_Bool bMode
)
71 throw( ::com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
73 virtual void SAL_CALL
setDefaultName( const OUString
& aName
)
74 throw( ::com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
76 virtual void SAL_CALL
setDisplayDirectory( const OUString
& aDirectory
)
77 throw( com::sun::star::lang::IllegalArgumentException
,
78 ::com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
80 virtual OUString SAL_CALL
getDisplayDirectory( )
81 throw( ::com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
83 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getFiles( )
84 throw( ::com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
86 // XFilterManager functions
88 virtual void SAL_CALL
appendFilter( const OUString
& aTitle
, const OUString
& aFilter
)
89 throw( ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
91 virtual void SAL_CALL
setCurrentFilter( const OUString
& aTitle
)
92 throw( ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
94 virtual OUString SAL_CALL
getCurrentFilter( )
95 throw( ::com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
97 // XFilterGroupManager functions
99 virtual void SAL_CALL
appendFilterGroup( const OUString
& sGroupTitle
, const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::StringPair
>& aFilters
)
100 throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
102 // XFilePickerControlAccess functions
104 virtual void SAL_CALL
setValue( sal_Int16 nControlId
, sal_Int16 nControlAction
, const ::com::sun::star::uno::Any
& aValue
)
105 throw (::com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
107 virtual ::com::sun::star::uno::Any SAL_CALL
getValue( sal_Int16 aControlId
, sal_Int16 aControlAction
)
108 throw (::com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
110 virtual void SAL_CALL
enableControl( sal_Int16 nControlId
, sal_Bool bEnable
)
111 throw(::com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
113 virtual void SAL_CALL
setLabel( sal_Int16 nControlId
, const OUString
& aLabel
)
114 throw (::com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
116 virtual OUString SAL_CALL
getLabel( sal_Int16 nControlId
)
117 throw (::com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
121 virtual void SAL_CALL
initialize( const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>& aArguments
)
122 throw(::com::sun::star::uno::Exception
, ::com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
126 virtual void SAL_CALL
cancel( )
127 throw( ::com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
131 using cppu::WeakComponentImplHelperBase::disposing
;
132 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& aEvent
)
133 throw(::com::sun::star::uno::RuntimeException
);
137 virtual OUString SAL_CALL
getImplementationName( )
138 throw(::com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
140 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
141 throw(::com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
143 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( )
144 throw(::com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
146 // FilePicker Event functions
148 void SAL_CALL
fileSelectionChanged( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent
);
149 void SAL_CALL
directoryChanged( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent
);
150 // OUString SAL_CALL helpRequested( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent ) const;
151 void SAL_CALL
controlStateChanged( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent
);
152 void SAL_CALL
dialogSizeChanged( );
154 inline AquaFilePickerDelegate
* getDelegate() {
158 inline OUString
getSaveFileName() {
159 return m_sSaveFileName
;
163 SalAquaFilePicker( const SalAquaFilePicker
& ) SAL_DELETED_FUNCTION
;
164 SalAquaFilePicker
& operator=( const SalAquaFilePicker
& ) SAL_DELETED_FUNCTION
;
166 virtual void ensureFilterHelper();
168 ::com::sun::star::uno::Reference
< ::com::sun::star::ui::dialogs::XFilePickerListener
>
171 FilterHelper
*m_pFilterHelper
;
173 OUString m_sSaveFileName
;
175 AquaFilePickerDelegate
*m_pDelegate
;
177 void updateFilterUI();
178 void updateSaveFileNameExtension();
182 virtual ~SalAquaFilePicker();
184 void filterControlChanged();
186 void implInitialize();
190 #endif // INCLUDED_FPICKER_SOURCE_AQUA_SALAQUAFILEPICKER_HXX
192 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */