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_VCL_UNX_KDE_UNXFILEPICKER_HXX
21 #define INCLUDED_VCL_UNX_KDE_UNXFILEPICKER_HXX
23 #include <cppuhelper/compbase5.hxx>
24 #include <osl/conditn.hxx>
25 #include <osl/mutex.hxx>
26 #include <rtl/ustrbuf.hxx>
28 #include <com/sun/star/lang/XInitialization.hpp>
29 #include <com/sun/star/lang/XServiceInfo.hpp>
30 #include <com/sun/star/ui/dialogs/XFilePicker2.hpp>
31 #include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
32 #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
33 #include <com/sun/star/uno/XComponentContext.hpp>
37 class UnxFilePickerCommandThread
;
38 class UnxFilePickerNotifyThread
;
41 class UnxFilePickerDummy
45 osl::Mutex m_rbHelperMtx
;
48 typedef ::cppu::WeakComponentImplHelper5
<
49 ::com::sun::star::ui::dialogs::XFilePicker2
,
50 ::com::sun::star::ui::dialogs::XFilePicker3
,
51 ::com::sun::star::ui::dialogs::XFilePickerControlAccess
,
52 // TODO ::com::sun::star::ui::dialogs::XFilePreview,
53 ::com::sun::star::lang::XInitialization
,
54 ::com::sun::star::lang::XServiceInfo
> UnxFilePicker_Base
;
57 public UnxFilePickerDummy
,
58 public UnxFilePicker_Base
62 pid_t m_nFilePickerPid
;
63 int m_nFilePickerWrite
; // (kde|...)filepicker gets it as stdin
64 int m_nFilePickerRead
; // (kde|...)filepicker gets it as stdout
66 UnxFilePickerNotifyThread
*m_pNotifyThread
;
67 UnxFilePickerCommandThread
*m_pCommandThread
;
72 UnxFilePicker( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& );
73 virtual ~UnxFilePicker();
77 using cppu::WeakComponentImplHelperBase::disposing
;
79 // XFilePickerNotifier
81 virtual void SAL_CALL
addFilePickerListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::ui::dialogs::XFilePickerListener
>& xListener
) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
82 virtual void SAL_CALL
removeFilePickerListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::ui::dialogs::XFilePickerListener
>& xListener
) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
84 // XExecutableDialog functions
86 virtual void SAL_CALL
setTitle( const OUString
&rTitle
) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
87 virtual sal_Int16 SAL_CALL
execute() throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
89 // XFilePicker functions
91 virtual void SAL_CALL
setMultiSelectionMode( sal_Bool bMode
) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
92 virtual void SAL_CALL
setDefaultName( const OUString
&rName
) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
93 virtual void SAL_CALL
setDisplayDirectory( const OUString
&rDirectory
) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
94 virtual OUString SAL_CALL
getDisplayDirectory() throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
95 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getFiles() throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
97 // XFilterManager functions
99 virtual void SAL_CALL
appendFilter( const OUString
&rTitle
, const OUString
&rFilter
) throw( ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
100 virtual void SAL_CALL
setCurrentFilter( const OUString
&rTitle
) throw( ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
101 virtual OUString SAL_CALL
getCurrentFilter() throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
103 // XFilterGroupManager functions
105 virtual void SAL_CALL
appendFilterGroup( const OUString
&rGroupTitle
, const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::StringPair
> &rFilters
) throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
107 // XFilePickerControlAccess functions
109 virtual void SAL_CALL
setValue( sal_Int16 nControlId
, sal_Int16 nControlAction
, const ::com::sun::star::uno::Any
&rValue
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
110 virtual ::com::sun::star::uno::Any SAL_CALL
getValue( sal_Int16 nControlId
, sal_Int16 nControlAction
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
111 virtual void SAL_CALL
enableControl( sal_Int16 nControlId
, sal_Bool bEnable
) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
112 virtual void SAL_CALL
setLabel( sal_Int16 nControlId
, const OUString
&rLabel
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
113 virtual OUString SAL_CALL
getLabel( sal_Int16 nControlId
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
117 virtual ::com::sun::star::uno::Sequence< sal_Int16 > SAL_CALL getSupportedImageFormats( ) throw (::com::sun::star::uno::RuntimeException);
118 virtual sal_Int32 SAL_CALL getTargetColorDepth( ) throw (::com::sun::star::uno::RuntimeException);
119 virtual sal_Int32 SAL_CALL getAvailableWidth( ) throw (::com::sun::star::uno::RuntimeException);
120 virtual sal_Int32 SAL_CALL getAvailableHeight( ) throw (::com::sun::star::uno::RuntimeException);
121 virtual void SAL_CALL setImage( sal_Int16 aImageFormat, const ::com::sun::star::uno::Any &rImage ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
122 virtual sal_Bool SAL_CALL setShowState( sal_Bool bShowState ) throw (::com::sun::star::uno::RuntimeException);
123 virtual sal_Bool SAL_CALL getShowState( ) throw (::com::sun::star::uno::RuntimeException);
128 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSelectedFiles()
129 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
133 virtual void SAL_CALL
initialize( const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
> &rArguments
) throw( ::com::sun::star::uno::Exception
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
137 virtual void SAL_CALL
cancel( ) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
141 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
&rEvent
) throw( ::com::sun::star::uno::RuntimeException
);
145 virtual OUString SAL_CALL
getImplementationName() throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
146 virtual sal_Bool SAL_CALL
supportsService( const OUString
&rServiceName
) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
147 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
150 // prevent copy and assignment
151 UnxFilePicker( const UnxFilePicker
& );
152 UnxFilePicker
& operator=( const UnxFilePicker
& );
155 void initFilePicker();
156 void checkFilePicker() throw( ::com::sun::star::uno::RuntimeException
);
159 void sendCommand( const OUString
&rCommand
);
160 // Synchronized sendCommand
161 void sendCommand( const OUString
&rCommand
, ::osl::Condition
&rCondition
);
162 void appendEscaped( OUStringBuffer
&rBuffer
, const OUString
&rString
);
165 bool controlIdInfo( sal_Int16 nControlId
, OUString
&rType
, sal_Int32
&rTitleId
);
166 bool controlActionInfo( sal_Int16 nControlId
, OUString
&rType
);
167 void sendAppendControlCommand( sal_Int16 nControlId
);
170 #endif // INCLUDED_VCL_UNX_KDE_UNXFILEPICKER_HXX
172 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */