1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef EXTENSIONS_SOURCE_PROPCTRLR_SUBMISSIONHANDLER_HXX 25 #define EXTENSIONS_SOURCE_PROPCTRLR_SUBMISSIONHANDLER_HXX 26 27 #include "propertyhandler.hxx" 28 #include "eformshelper.hxx" 29 30 /** === begin UNO includes === **/ 31 #include <com/sun/star/xforms/XSubmission.hpp> 32 /** === end UNO includes === **/ 33 #include <comphelper/propmultiplex.hxx> 34 35 namespace comphelper 36 { 37 class OPropertyChangeMultiplexer; 38 } 39 40 //........................................................................ 41 namespace pcr 42 { 43 //........................................................................ 44 45 //==================================================================== 46 //= SubmissionHelper 47 //==================================================================== 48 class SubmissionHelper : public EFormsHelper 49 { 50 public: 51 SubmissionHelper( 52 osl::Mutex& _rMutex, 53 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxIntrospectee, 54 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxContextDocument 55 ); 56 57 /** determines whether the given control model is able to trigger submissions 58 59 Instances of the <type>SubmissionHelper</type> class should not be instantiated 60 for components where this method returned <FALSE/> 61 */ 62 static bool canTriggerSubmissions( 63 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel, 64 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxContextDocument 65 ) SAL_THROW(()); 66 }; 67 68 //==================================================================== 69 //= SubmissionPropertyHandler 70 //==================================================================== 71 class SubmissionPropertyHandler; 72 typedef HandlerComponentBase< SubmissionPropertyHandler > EditPropertyHandler_Base; 73 /** a property handler for any virtual string properties 74 */ 75 class SubmissionPropertyHandler : public EditPropertyHandler_Base, public ::comphelper::OPropertyChangeListener 76 { 77 private: 78 ::osl::Mutex m_aMutex; 79 ::std::auto_ptr< SubmissionHelper > m_pHelper; 80 ::comphelper::OPropertyChangeMultiplexer* m_pPropChangeMultiplexer; 81 82 public: 83 SubmissionPropertyHandler( 84 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext 85 ); 86 87 static ::rtl::OUString SAL_CALL getImplementationName_static( ) throw (::com::sun::star::uno::RuntimeException); 88 static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static( ) throw (::com::sun::star::uno::RuntimeException); 89 90 ~SubmissionPropertyHandler(); 91 92 protected: 93 // XPropertyHandler overriables 94 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& _rPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); 95 virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); 96 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > 97 SAL_CALL getActuatingProperties( ) throw (::com::sun::star::uno::RuntimeException); 98 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > 99 SAL_CALL getSupersededProperties( ) throw (::com::sun::star::uno::RuntimeException); 100 virtual ::com::sun::star::inspection::LineDescriptor 101 SAL_CALL describePropertyLine( const ::rtl::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); 102 virtual void SAL_CALL actuatingPropertyChanged( const ::rtl::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); 103 virtual ::com::sun::star::uno::Any SAL_CALL convertToPropertyValue( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rControlValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); 104 virtual ::com::sun::star::uno::Any SAL_CALL convertToControlValue( const ::rtl::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); 105 106 // PropertyHandler overridables 107 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > 108 SAL_CALL doDescribeSupportedProperties() const; 109 virtual void onNewComponent(); 110 111 private: 112 // OPropertyChangeListener 113 virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& _rEvent) throw( ::com::sun::star::uno::RuntimeException); 114 }; 115 116 //........................................................................ 117 } // namespace pcr 118 //........................................................................ 119 120 #endif // EXTENSIONS_SOURCE_PROPCTRLR_SUBMISSIONHANDLER_HXX 121 122