1*2d785d7eSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*2d785d7eSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*2d785d7eSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*2d785d7eSAndrew Rist * distributed with this work for additional information 6*2d785d7eSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*2d785d7eSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*2d785d7eSAndrew Rist * "License"); you may not use this file except in compliance 9*2d785d7eSAndrew Rist * with the License. You may obtain a copy of the License at 10*2d785d7eSAndrew Rist * 11*2d785d7eSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*2d785d7eSAndrew Rist * 13*2d785d7eSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*2d785d7eSAndrew Rist * software distributed under the License is distributed on an 15*2d785d7eSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*2d785d7eSAndrew Rist * KIND, either express or implied. See the License for the 17*2d785d7eSAndrew Rist * specific language governing permissions and limitations 18*2d785d7eSAndrew Rist * under the License. 19*2d785d7eSAndrew Rist * 20*2d785d7eSAndrew Rist *************************************************************/ 21*2d785d7eSAndrew Rist 22*2d785d7eSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _SUBMISSION_HXX 25cdf0e10cSrcweir #define _SUBMISSION_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir 28cdf0e10cSrcweir // includes for parent classes 29cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx> 30cdf0e10cSrcweir #include <propertysetbase.hxx> 31cdf0e10cSrcweir #include <com/sun/star/util/XModifyBroadcaster.hpp> 32cdf0e10cSrcweir #include <com/sun/star/container/XNamed.hpp> 33cdf0e10cSrcweir #include <com/sun/star/xml/dom/events/XEventListener.hpp> 34cdf0e10cSrcweir #include <com/sun/star/lang/XUnoTunnel.hpp> 35cdf0e10cSrcweir #include <com/sun/star/xml/dom/XNode.hpp> 36cdf0e10cSrcweir #include <com/sun/star/xml/dom/XDocument.hpp> 37cdf0e10cSrcweir #include <com/sun/star/xml/dom/XDocumentFragment.hpp> 38cdf0e10cSrcweir #include <com/sun/star/xml/xpath/XXPathObject.hpp> 39cdf0e10cSrcweir #include <com/sun/star/xforms/XSubmission.hpp> 40cdf0e10cSrcweir 41cdf0e10cSrcweir // includes for member variables 42cdf0e10cSrcweir #include <com/sun/star/uno/Reference.hxx> 43cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx> 44cdf0e10cSrcweir #include <computedexpression.hxx> 45cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 46cdf0e10cSrcweir 47cdf0e10cSrcweir // forward declaractions 48cdf0e10cSrcweir namespace com { namespace sun { namespace star { 49cdf0e10cSrcweir namespace xforms { class XModel; } 50cdf0e10cSrcweir namespace uno { class Any; } 51cdf0e10cSrcweir namespace beans { class UnknownPropertyException; 52cdf0e10cSrcweir class PropertyVetoException; } 53cdf0e10cSrcweir namespace lang { class IllegalArgumentException; 54cdf0e10cSrcweir class WrappedTargetException; } 55cdf0e10cSrcweir } } } 56cdf0e10cSrcweir namespace xforms { class Model; } 57cdf0e10cSrcweir 58cdf0e10cSrcweir 59cdf0e10cSrcweir namespace xforms 60cdf0e10cSrcweir { 61cdf0e10cSrcweir 62cdf0e10cSrcweir /** An XForms submission. 63cdf0e10cSrcweir * 64cdf0e10cSrcweir * See http://www.w3.org/TR/xforms/ for more information. 65cdf0e10cSrcweir */ 66cdf0e10cSrcweir typedef cppu::ImplInheritanceHelper2< 67cdf0e10cSrcweir PropertySetBase, 68cdf0e10cSrcweir com::sun::star::lang::XUnoTunnel, 69cdf0e10cSrcweir com::sun::star::xforms::XSubmission 70cdf0e10cSrcweir > Submission_t; 71cdf0e10cSrcweir 72cdf0e10cSrcweir class Submission : public Submission_t 73cdf0e10cSrcweir { 74cdf0e10cSrcweir // submission properties 75cdf0e10cSrcweir rtl::OUString msID; 76cdf0e10cSrcweir rtl::OUString msBind; 77cdf0e10cSrcweir ComputedExpression maRef; 78cdf0e10cSrcweir rtl::OUString msAction; 79cdf0e10cSrcweir rtl::OUString msMethod; 80cdf0e10cSrcweir rtl::OUString msVersion; 81cdf0e10cSrcweir bool mbIndent; 82cdf0e10cSrcweir rtl::OUString msMediaType; 83cdf0e10cSrcweir rtl::OUString msEncoding; 84cdf0e10cSrcweir bool mbOmitXmlDeclaration; 85cdf0e10cSrcweir bool mbStandalone; 86cdf0e10cSrcweir rtl::OUString msCDataSectionElement; 87cdf0e10cSrcweir rtl::OUString msReplace; 88cdf0e10cSrcweir rtl::OUString msSeparator; 89cdf0e10cSrcweir com::sun::star::uno::Sequence< rtl::OUString > msIncludeNamespacePrefixes; 90cdf0e10cSrcweir 91cdf0e10cSrcweir private: 92cdf0e10cSrcweir 93cdf0e10cSrcweir /// the Model to which this Submission belongs; may be NULL 94cdf0e10cSrcweir com::sun::star::uno::Reference<com::sun::star::xforms::XModel> mxModel; 95cdf0e10cSrcweir 96cdf0e10cSrcweir // this will extract the document from the model that will be submitted 97cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::xml::dom::XDocumentFragment > 98cdf0e10cSrcweir createSubmissionDocument(const com::sun::star::uno::Reference< com::sun::star::xml::xpath::XXPathObject >& aObject, 99cdf0e10cSrcweir sal_Bool bRemoveWSNodes = sal_False); 100cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::xml::dom::XDocument > 101cdf0e10cSrcweir getInstanceDocument(const com::sun::star::uno::Reference< com::sun::star::xml::xpath::XXPathObject >& aObject); 102cdf0e10cSrcweir 103cdf0e10cSrcweir com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory > m_aFactory; 104cdf0e10cSrcweir public: 105cdf0e10cSrcweir Submission(); 106cdf0e10cSrcweir virtual ~Submission() throw(); 107cdf0e10cSrcweir 108cdf0e10cSrcweir // 109cdf0e10cSrcweir // property methods: get/set value 110cdf0e10cSrcweir // 111cdf0e10cSrcweir 112cdf0e10cSrcweir /// get XForms model 113cdf0e10cSrcweir com::sun::star::uno::Reference<com::sun::star::xforms::XModel> 114cdf0e10cSrcweir getModel() const; 115cdf0e10cSrcweir 116cdf0e10cSrcweir /// set XForms model 117cdf0e10cSrcweir void setModel( 118cdf0e10cSrcweir const com::sun::star::uno::Reference<com::sun::star::xforms::XModel>& ); 119cdf0e10cSrcweir 120cdf0e10cSrcweir rtl::OUString getID() const; /// get ID for this submission 121cdf0e10cSrcweir void setID( const rtl::OUString& ); /// set ID for this submission 122cdf0e10cSrcweir 123cdf0e10cSrcweir rtl::OUString getBind() const; 124cdf0e10cSrcweir void setBind( const rtl::OUString& ); 125cdf0e10cSrcweir 126cdf0e10cSrcweir rtl::OUString getRef() const; 127cdf0e10cSrcweir void setRef( const rtl::OUString& ); 128cdf0e10cSrcweir 129cdf0e10cSrcweir rtl::OUString getAction() const; 130cdf0e10cSrcweir void setAction( const rtl::OUString& ); 131cdf0e10cSrcweir 132cdf0e10cSrcweir rtl::OUString getMethod() const; 133cdf0e10cSrcweir void setMethod( const rtl::OUString& ); 134cdf0e10cSrcweir 135cdf0e10cSrcweir rtl::OUString getVersion() const; 136cdf0e10cSrcweir void setVersion( const rtl::OUString& ); 137cdf0e10cSrcweir 138cdf0e10cSrcweir bool getIndent() const; 139cdf0e10cSrcweir void setIndent( bool ); 140cdf0e10cSrcweir 141cdf0e10cSrcweir rtl::OUString getMediaType() const; 142cdf0e10cSrcweir void setMediaType( const rtl::OUString& ); 143cdf0e10cSrcweir 144cdf0e10cSrcweir rtl::OUString getEncoding() const; 145cdf0e10cSrcweir void setEncoding( const rtl::OUString& ); 146cdf0e10cSrcweir 147cdf0e10cSrcweir bool getOmitXmlDeclaration() const; 148cdf0e10cSrcweir void setOmitXmlDeclaration( bool ); 149cdf0e10cSrcweir 150cdf0e10cSrcweir bool getStandalone() const; 151cdf0e10cSrcweir void setStandalone( bool ); 152cdf0e10cSrcweir 153cdf0e10cSrcweir rtl::OUString getCDataSectionElement() const; 154cdf0e10cSrcweir void setCDataSectionElement( const rtl::OUString& ); 155cdf0e10cSrcweir 156cdf0e10cSrcweir rtl::OUString getReplace() const; 157cdf0e10cSrcweir void setReplace( const rtl::OUString& ); 158cdf0e10cSrcweir 159cdf0e10cSrcweir rtl::OUString getSeparator() const; 160cdf0e10cSrcweir void setSeparator( const rtl::OUString& ); 161cdf0e10cSrcweir 162cdf0e10cSrcweir com::sun::star::uno::Sequence< rtl::OUString > getIncludeNamespacePrefixes() const; 163cdf0e10cSrcweir void setIncludeNamespacePrefixes( const com::sun::star::uno::Sequence< rtl::OUString >& ); 164cdf0e10cSrcweir 165cdf0e10cSrcweir 166cdf0e10cSrcweir /** perform the submission 167cdf0e10cSrcweir * @returns if submission was successful */ 168cdf0e10cSrcweir bool doSubmit( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& aHandler ); 169cdf0e10cSrcweir 170cdf0e10cSrcweir 171cdf0e10cSrcweir /// release the model (note: Binding is unusable without model) 172cdf0e10cSrcweir void releaseModel(); 173cdf0e10cSrcweir 174cdf0e10cSrcweir 175cdf0e10cSrcweir // helpers for UNO tunnel 176cdf0e10cSrcweir static com::sun::star::uno::Sequence<sal_Int8> getUnoTunnelID(); 177cdf0e10cSrcweir static Submission* getSubmission( const com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>& ); 178cdf0e10cSrcweir 179cdf0e10cSrcweir 180cdf0e10cSrcweir 181cdf0e10cSrcweir private: 182cdf0e10cSrcweir 183cdf0e10cSrcweir /// check whether object is live, and throw suitable exception if not 184cdf0e10cSrcweir /// (to be used be API methods before acting on the object) 185cdf0e10cSrcweir void liveCheck() 186cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 187cdf0e10cSrcweir 188cdf0e10cSrcweir /// get the model implementation 189cdf0e10cSrcweir xforms::Model* getModelImpl() const; 190cdf0e10cSrcweir xforms::Model* getModelImpl( const com::sun::star::uno::Reference<com::sun::star::xforms::XModel>& xModel ) const; 191cdf0e10cSrcweir 192cdf0e10cSrcweir 193cdf0e10cSrcweir 194cdf0e10cSrcweir protected: 195cdf0e10cSrcweir 196cdf0e10cSrcweir // 197cdf0e10cSrcweir // XPropertySet & friends: 198cdf0e10cSrcweir // implement abstract methods from PropertySetHelper 199cdf0e10cSrcweir // 200cdf0e10cSrcweir 201cdf0e10cSrcweir virtual sal_Bool SAL_CALL convertFastPropertyValue( 202cdf0e10cSrcweir com::sun::star::uno::Any& rConvertedValue, 203cdf0e10cSrcweir com::sun::star::uno::Any& rOldValue, 204cdf0e10cSrcweir sal_Int32 nHandle, 205cdf0e10cSrcweir const com::sun::star::uno::Any& rValue ) 206cdf0e10cSrcweir throw ( com::sun::star::lang::IllegalArgumentException ); 207cdf0e10cSrcweir 208cdf0e10cSrcweir private: 209cdf0e10cSrcweir void initializePropertySet(); 210cdf0e10cSrcweir 211cdf0e10cSrcweir 212cdf0e10cSrcweir public: 213cdf0e10cSrcweir 214cdf0e10cSrcweir // 215cdf0e10cSrcweir // XNamed: 216cdf0e10cSrcweir // get/set name 217cdf0e10cSrcweir // 218cdf0e10cSrcweir 219cdf0e10cSrcweir virtual rtl::OUString SAL_CALL getName() 220cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 221cdf0e10cSrcweir 222cdf0e10cSrcweir virtual void SAL_CALL setName( const rtl::OUString& ) 223cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 224cdf0e10cSrcweir 225cdf0e10cSrcweir 226cdf0e10cSrcweir 227cdf0e10cSrcweir // 228cdf0e10cSrcweir // XUnoTunnel 229cdf0e10cSrcweir // 230cdf0e10cSrcweir 231cdf0e10cSrcweir virtual sal_Int64 SAL_CALL getSomething( 232cdf0e10cSrcweir const com::sun::star::uno::Sequence<sal_Int8>& ) 233cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 234cdf0e10cSrcweir 235cdf0e10cSrcweir 236cdf0e10cSrcweir // 237cdf0e10cSrcweir // XSubmission 238cdf0e10cSrcweir // 239cdf0e10cSrcweir 240cdf0e10cSrcweir virtual void SAL_CALL submit( ) 241cdf0e10cSrcweir throw ( com::sun::star::util::VetoException, 242cdf0e10cSrcweir com::sun::star::lang::WrappedTargetException, 243cdf0e10cSrcweir com::sun::star::uno::RuntimeException ); 244cdf0e10cSrcweir virtual void SAL_CALL submitWithInteraction( 245cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& aHandler ) 246cdf0e10cSrcweir throw ( com::sun::star::util::VetoException, 247cdf0e10cSrcweir com::sun::star::lang::WrappedTargetException, 248cdf0e10cSrcweir com::sun::star::uno::RuntimeException ); 249cdf0e10cSrcweir virtual void SAL_CALL addSubmissionVetoListener( 250cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::form::submission::XSubmissionVetoListener >& listener ) 251cdf0e10cSrcweir throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); 252cdf0e10cSrcweir virtual void SAL_CALL removeSubmissionVetoListener( 253cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::form::submission::XSubmissionVetoListener >& listener ) 254cdf0e10cSrcweir throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); 255cdf0e10cSrcweir 256cdf0e10cSrcweir // 257cdf0e10cSrcweir // XPropertySet 258cdf0e10cSrcweir // (need to disambiguate this) 259cdf0e10cSrcweir 260cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); 261cdf0e10cSrcweir virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 262cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 263cdf0e10cSrcweir virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 264cdf0e10cSrcweir virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 265cdf0e10cSrcweir virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 266cdf0e10cSrcweir virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 267cdf0e10cSrcweir }; 268cdf0e10cSrcweir 269cdf0e10cSrcweir 270cdf0e10cSrcweir } // namespace xforms 271cdf0e10cSrcweir 272cdf0e10cSrcweir #endif 273