update emoji autocorrect entries from po-files
[LibreOffice.git] / fpicker / source / office / commonpicker.hxx
bloba08c31ee2ba0227a6280ab36df8cc2f60375c1dd
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_OFFICE_COMMONPICKER_HXX
21 #define INCLUDED_FPICKER_SOURCE_OFFICE_COMMONPICKER_HXX
23 #include <cppuhelper/compbase5.hxx>
24 #include <com/sun/star/ui/dialogs/XControlInformation.hpp>
25 #include <com/sun/star/ui/dialogs/XControlAccess.hpp>
26 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
27 #include <com/sun/star/lang/DisposedException.hpp>
28 #include <com/sun/star/awt/XWindow.hpp>
29 #include <com/sun/star/util/XCancellable.hpp>
30 #include <com/sun/star/lang/XInitialization.hpp>
31 #include <comphelper/broadcasthelper.hxx>
32 #include <comphelper/propertycontainer.hxx>
33 #include <comphelper/proparrhlp.hxx>
34 #include <comphelper/uno3.hxx>
35 #include <tools/link.hxx>
36 #include <vcl/vclptr.hxx>
38 class SvtFileDialog;
39 namespace vcl { class Window; }
40 struct ImplSVEvent;
42 namespace svt
46 typedef ::cppu::WeakComponentImplHelper5 < ::com::sun::star::ui::dialogs::XControlAccess
47 , ::com::sun::star::ui::dialogs::XControlInformation
48 , ::com::sun::star::lang::XEventListener
49 , ::com::sun::star::util::XCancellable
50 , ::com::sun::star::lang::XInitialization
51 > OCommonPicker_Base;
52 /** implements common functionality for the 2 UNO picker components
54 class OCommonPicker
55 :public ::comphelper::OBaseMutex
56 ,public OCommonPicker_Base
57 ,public ::comphelper::OPropertyContainer
58 ,public ::comphelper::OPropertyArrayUsageHelper< OCommonPicker >
60 private:
61 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xORB;
63 // <properties>
64 OUString m_sHelpURL;
65 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xWindow;
66 // </properties>
68 VclPtr<SvtFileDialog> m_pDlg;
69 ImplSVEvent * m_nCancelEvent;
70 bool m_bExecuting;
72 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xDialogParent;
74 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xWindowListenerAdapter;
75 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xParentListenerAdapter;
77 protected:
78 OUString m_aTitle;
79 OUString m_aDisplayDirectory;
81 protected:
82 inline SvtFileDialog* getDialog() { return m_pDlg; }
84 inline const ::cppu::OBroadcastHelper& GetBroadcastHelper() const { return OCommonPicker_Base::rBHelper; }
85 inline ::cppu::OBroadcastHelper& GetBroadcastHelper() { return OCommonPicker_Base::rBHelper; }
87 public:
88 OCommonPicker( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory );
90 protected:
91 virtual ~OCommonPicker();
93 // overridables
95 // will be called with locked SolarMutex
96 virtual VclPtr<SvtFileDialog> implCreateDialog( vcl::Window* _pParent ) = 0;
97 virtual sal_Int16 implExecutePicker( ) = 0;
98 // do NOT override XExecutableDialog::execute! We need to do some stuff there ourself ...
100 protected:
102 // disambiguate XInterface
104 DECLARE_XINTERFACE( )
107 // disambiguate XTypeProvider
109 DECLARE_XTYPEPROVIDER( )
112 // ComponentHelper/XComponent
114 virtual void SAL_CALL disposing() SAL_OVERRIDE;
117 // XEventListner
119 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
122 // property set related methods
125 // XPropertySet pure methods
126 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
127 // OPropertySetHelper pure methods
128 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE;
129 // OPropertyArrayUsageHelper pure methods
130 virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const SAL_OVERRIDE;
132 // OPropertySetHelper overridden methods
133 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
134 sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue ) throw (::com::sun::star::uno::Exception, std::exception) SAL_OVERRIDE;
137 // XExecutableDialog functions
139 virtual void SAL_CALL setTitle( const OUString& _rTitle ) throw( ::com::sun::star::uno::RuntimeException, std::exception );
140 virtual sal_Int16 SAL_CALL execute() throw( ::com::sun::star::uno::RuntimeException, std::exception );
143 // XControlAccess functions
145 virtual void SAL_CALL setControlProperty( const OUString& aControlName, const OUString& aControlProperty, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
146 virtual ::com::sun::star::uno::Any SAL_CALL getControlProperty( const OUString& aControlName, const OUString& aControlProperty ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
149 // XControlInformation functions
151 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedControls( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
152 virtual sal_Bool SAL_CALL isControlSupported( const OUString& aControlName ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
153 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedControlProperties( const OUString& aControlName ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
154 virtual sal_Bool SAL_CALL isControlPropertySupported( const OUString& aControlName, const OUString& aControlProperty ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
157 // XCancellable functions
159 virtual void SAL_CALL cancel( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
162 // XInitialization functions
165 virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw ( ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
168 // misc
170 void checkAlive() const;
172 void prepareDialog();
174 protected:
175 bool createPicker();
177 /** handle a single argument from the XInitialization::initialize method
179 @return <TRUE/> if the argument could be handled
181 virtual bool implHandleInitializationArgument(
182 const OUString& _rName,
183 const ::com::sun::star::uno::Any& _rValue
186 private:
187 void stopWindowListening();
189 DECL_LINK( OnCancelPicker, void* );
192 } // namespace svt
195 #endif // INCLUDED_FPICKER_SOURCE_OFFICE_COMMONPICKER_HXX
197 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */