Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_SUBMISSIONHANDLER_HXX
21 : #define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_SUBMISSIONHANDLER_HXX
22 :
23 : #include "propertyhandler.hxx"
24 : #include "eformshelper.hxx"
25 :
26 : #include <com/sun/star/xforms/XSubmission.hpp>
27 : #include <comphelper/propmultiplex.hxx>
28 :
29 : namespace comphelper
30 : {
31 : class OPropertyChangeMultiplexer;
32 : }
33 :
34 :
35 : namespace pcr
36 : {
37 :
38 :
39 :
40 : //= SubmissionHelper
41 :
42 0 : class SubmissionHelper : public EFormsHelper
43 : {
44 : public:
45 : SubmissionHelper(
46 : osl::Mutex& _rMutex,
47 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxIntrospectee,
48 : const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxContextDocument
49 : );
50 :
51 : /** determines whether the given control model is able to trigger submissions
52 :
53 : Instances of the <type>SubmissionHelper</type> class should not be instantiated
54 : for components where this method returned <FALSE/>
55 : */
56 : static bool canTriggerSubmissions(
57 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel,
58 : const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxContextDocument
59 : );
60 : };
61 :
62 :
63 : //= SubmissionPropertyHandler
64 :
65 : class SubmissionPropertyHandler;
66 : typedef HandlerComponentBase< SubmissionPropertyHandler > EditPropertyHandler_Base;
67 : /** a property handler for any virtual string properties
68 : */
69 : class SubmissionPropertyHandler : public EditPropertyHandler_Base, public ::comphelper::OPropertyChangeListener
70 : {
71 : private:
72 : ::osl::Mutex m_aMutex;
73 : ::std::unique_ptr< SubmissionHelper > m_pHelper;
74 : ::comphelper::OPropertyChangeMultiplexer* m_pPropChangeMultiplexer;
75 :
76 : public:
77 : SubmissionPropertyHandler(
78 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext
79 : );
80 :
81 : static OUString SAL_CALL getImplementationName_static( ) throw (::com::sun::star::uno::RuntimeException);
82 : static ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames_static( ) throw (::com::sun::star::uno::RuntimeException);
83 :
84 : virtual ~SubmissionPropertyHandler();
85 :
86 : protected:
87 : // XPropertyHandler overriables
88 : virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& _rPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
89 : virtual void SAL_CALL setPropertyValue( const OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
90 : virtual ::com::sun::star::uno::Sequence< OUString >
91 : SAL_CALL getActuatingProperties( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
92 : virtual ::com::sun::star::uno::Sequence< OUString >
93 : SAL_CALL getSupersededProperties( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
94 : virtual ::com::sun::star::inspection::LineDescriptor
95 : SAL_CALL describePropertyLine( const OUString& _rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& _rxControlFactory ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
96 : virtual void SAL_CALL actuatingPropertyChanged( const OUString& _rActuatingPropertyName, const ::com::sun::star::uno::Any& _rNewValue, const ::com::sun::star::uno::Any& _rOldValue, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxInspectorUI, sal_Bool ) throw (::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
97 : virtual ::com::sun::star::uno::Any SAL_CALL convertToPropertyValue( const OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rControlValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
98 : virtual ::com::sun::star::uno::Any SAL_CALL convertToControlValue( const OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rPropertyValue, const ::com::sun::star::uno::Type& _rControlValueType ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
99 :
100 : // PropertyHandler overridables
101 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >
102 : SAL_CALL doDescribeSupportedProperties() const SAL_OVERRIDE;
103 : virtual void onNewComponent() SAL_OVERRIDE;
104 :
105 : private:
106 : // OPropertyChangeListener
107 : virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& _rEvent) throw( ::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
108 : };
109 :
110 :
111 : } // namespace pcr
112 :
113 :
114 : #endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_SUBMISSIONHANDLER_HXX
115 :
116 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|