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_FORMS_SOURCE_XFORMS_SUBMISSION_HXX
21 #define INCLUDED_FORMS_SOURCE_XFORMS_SUBMISSION_HXX
23 #include <cppuhelper/implbase2.hxx>
24 #include <propertysetbase.hxx>
25 #include <com/sun/star/util/XModifyBroadcaster.hpp>
26 #include <com/sun/star/container/XNamed.hpp>
27 #include <com/sun/star/xml/dom/events/XEventListener.hpp>
28 #include <com/sun/star/lang/XUnoTunnel.hpp>
29 #include <com/sun/star/xml/dom/XNode.hpp>
30 #include <com/sun/star/xml/dom/XDocument.hpp>
31 #include <com/sun/star/xml/dom/XDocumentFragment.hpp>
32 #include <com/sun/star/xml/xpath/XXPathObject.hpp>
33 #include <com/sun/star/xforms/XSubmission.hpp>
35 #include <com/sun/star/uno/Reference.hxx>
36 #include <com/sun/star/uno/Sequence.hxx>
37 #include <computedexpression.hxx>
39 // forward declaractions
40 namespace com
{ namespace sun
{ namespace star
{
41 namespace xforms
{ class XModel
; }
42 namespace uno
{ class Any
; }
43 namespace beans
{ class UnknownPropertyException
;
44 class PropertyVetoException
; }
45 namespace lang
{ class IllegalArgumentException
;
46 class WrappedTargetException
; }
48 namespace xforms
{ class Model
; }
54 /** An XForms submission.
56 * See http://www.w3.org/TR/xforms/ for more information.
58 typedef cppu::ImplInheritanceHelper2
<
60 com::sun::star::lang::XUnoTunnel
,
61 com::sun::star::xforms::XSubmission
64 class Submission
: public Submission_t
66 // submission properties
69 ComputedExpression maRef
;
76 bool mbOmitXmlDeclaration
;
78 OUString msCDataSectionElement
;
81 com::sun::star::uno::Sequence
< OUString
> msIncludeNamespacePrefixes
;
85 /// the Model to which this Submission belongs; may be NULL
86 com::sun::star::uno::Reference
<com::sun::star::xforms::XModel
> mxModel
;
88 // this will extract the document from the model that will be submitted
89 com::sun::star::uno::Reference
< com::sun::star::xml::dom::XDocumentFragment
>
90 createSubmissionDocument(const com::sun::star::uno::Reference
< com::sun::star::xml::xpath::XXPathObject
>& aObject
,
91 bool bRemoveWSNodes
= false);
92 static com::sun::star::uno::Reference
< com::sun::star::xml::dom::XDocument
>
93 getInstanceDocument(const com::sun::star::uno::Reference
< com::sun::star::xml::xpath::XXPathObject
>& aObject
);
97 virtual ~Submission() throw();
100 // property methods: get/set value
104 com::sun::star::uno::Reference
<com::sun::star::xforms::XModel
>
105 getModel() const { return mxModel
;}
109 const com::sun::star::uno::Reference
<com::sun::star::xforms::XModel
>& );
111 OUString
getID() const { return msID
;} /// get ID for this submission
112 void setID( const OUString
& ); /// set ID for this submission
114 OUString
getBind() const { return msBind
;}
115 void setBind( const OUString
& );
117 OUString
getRef() const;
118 void setRef( const OUString
& );
120 OUString
getAction() const { return msAction
;}
121 void setAction( const OUString
& );
123 OUString
getMethod() const { return msMethod
;}
124 void setMethod( const OUString
& );
126 OUString
getVersion() const { return msVersion
;}
127 void setVersion( const OUString
& );
129 bool getIndent() const { return mbIndent
;}
130 void setIndent( bool );
132 OUString
getMediaType() const { return msMediaType
;}
133 void setMediaType( const OUString
& );
135 OUString
getEncoding() const { return msEncoding
;}
136 void setEncoding( const OUString
& );
138 bool getOmitXmlDeclaration() const { return mbOmitXmlDeclaration
;}
139 void setOmitXmlDeclaration( bool );
141 bool getStandalone() const { return mbStandalone
;}
142 void setStandalone( bool );
144 OUString
getCDataSectionElement() const { return msCDataSectionElement
;}
145 void setCDataSectionElement( const OUString
& );
147 OUString
getReplace() const { return msReplace
;}
148 void setReplace( const OUString
& );
150 OUString
getSeparator() const { return msSeparator
;}
151 void setSeparator( const OUString
& );
153 com::sun::star::uno::Sequence
< OUString
> getIncludeNamespacePrefixes() const { return msIncludeNamespacePrefixes
;}
154 void setIncludeNamespacePrefixes( const com::sun::star::uno::Sequence
< OUString
>& );
157 /** perform the submission
158 * @returns if submission was successful */
159 bool doSubmit( const ::com::sun::star::uno::Reference
< ::com::sun::star::task::XInteractionHandler
>& aHandler
);
162 /// release the model (note: Binding is unusable without model)
166 // helpers for UNO tunnel
167 static com::sun::star::uno::Sequence
<sal_Int8
> getUnoTunnelID();
168 static Submission
* getSubmission( const com::sun::star::uno::Reference
<com::sun::star::beans::XPropertySet
>& );
174 /// check whether object is live, and throw suitable exception if not
175 /// (to be used be API methods before acting on the object)
177 throw( com::sun::star::uno::RuntimeException
);
179 /// get the model implementation
180 xforms::Model
* getModelImpl() const;
181 xforms::Model
* getModelImpl( const com::sun::star::uno::Reference
<com::sun::star::xforms::XModel
>& xModel
) const;
188 // XPropertySet & friends:
189 // implement abstract methods from PropertySetHelper
192 virtual sal_Bool SAL_CALL
convertFastPropertyValue(
193 com::sun::star::uno::Any
& rConvertedValue
,
194 com::sun::star::uno::Any
& rOldValue
,
196 const com::sun::star::uno::Any
& rValue
)
197 throw ( com::sun::star::lang::IllegalArgumentException
) SAL_OVERRIDE
;
200 void initializePropertySet();
210 virtual OUString SAL_CALL
getName()
211 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
213 virtual void SAL_CALL
setName( const OUString
& )
214 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
222 virtual sal_Int64 SAL_CALL
getSomething(
223 const com::sun::star::uno::Sequence
<sal_Int8
>& )
224 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
231 virtual void SAL_CALL
submit( )
232 throw ( com::sun::star::util::VetoException
,
233 com::sun::star::lang::WrappedTargetException
,
234 com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
235 virtual void SAL_CALL
submitWithInteraction(
236 const ::com::sun::star::uno::Reference
< ::com::sun::star::task::XInteractionHandler
>& aHandler
)
237 throw ( com::sun::star::util::VetoException
,
238 com::sun::star::lang::WrappedTargetException
,
239 com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
240 virtual void SAL_CALL
addSubmissionVetoListener(
241 const ::com::sun::star::uno::Reference
< ::com::sun::star::form::submission::XSubmissionVetoListener
>& listener
)
242 throw (::com::sun::star::lang::NoSupportException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
243 virtual void SAL_CALL
removeSubmissionVetoListener(
244 const ::com::sun::star::uno::Reference
< ::com::sun::star::form::submission::XSubmissionVetoListener
>& listener
)
245 throw (::com::sun::star::lang::NoSupportException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
249 // (need to disambiguate this)
251 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
252 virtual void SAL_CALL
setPropertyValue( const 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
, std::exception
) SAL_OVERRIDE
;
253 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue( const OUString
& PropertyName
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
254 virtual void SAL_CALL
addPropertyChangeListener( const 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
, std::exception
) SAL_OVERRIDE
;
255 virtual void SAL_CALL
removePropertyChangeListener( const 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
, std::exception
) SAL_OVERRIDE
;
256 virtual void SAL_CALL
addVetoableChangeListener( const 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
, std::exception
) SAL_OVERRIDE
;
257 virtual void SAL_CALL
removeVetoableChangeListener( const 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
, std::exception
) SAL_OVERRIDE
;
261 } // namespace xforms
265 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */