1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: submission.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _SUBMISSION_HXX
32 #define _SUBMISSION_HXX
35 // includes for parent classes
36 #include <cppuhelper/implbase2.hxx>
37 #include <propertysetbase.hxx>
38 #include <com/sun/star/util/XModifyBroadcaster.hpp>
39 #include <com/sun/star/container/XNamed.hpp>
40 #include <com/sun/star/xml/dom/events/XEventListener.hpp>
41 #include <com/sun/star/lang/XUnoTunnel.hpp>
42 #include <com/sun/star/xml/dom/XNode.hpp>
43 #include <com/sun/star/xml/dom/XDocument.hpp>
44 #include <com/sun/star/xml/dom/XDocumentFragment.hpp>
45 #include <com/sun/star/xml/xpath/XXPathObject.hpp>
46 #include <com/sun/star/xforms/XSubmission.hpp>
48 // includes for member variables
49 #include <com/sun/star/uno/Reference.hxx>
50 #include <com/sun/star/uno/Sequence.hxx>
51 #include <computedexpression.hxx>
52 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
54 // forward declaractions
55 namespace com
{ namespace sun
{ namespace star
{
56 namespace xforms
{ class XModel
; }
57 namespace uno
{ class Any
; }
58 namespace beans
{ class UnknownPropertyException
;
59 class PropertyVetoException
; }
60 namespace lang
{ class IllegalArgumentException
;
61 class WrappedTargetException
; }
63 namespace xforms
{ class Model
; }
69 /** An XForms submission.
71 * See http://www.w3.org/TR/xforms/ for more information.
73 typedef cppu::ImplInheritanceHelper2
<
75 com::sun::star::lang::XUnoTunnel
,
76 com::sun::star::xforms::XSubmission
79 class Submission
: public Submission_t
81 // submission properties
84 ComputedExpression maRef
;
85 rtl::OUString msAction
;
86 rtl::OUString msMethod
;
87 rtl::OUString msVersion
;
89 rtl::OUString msMediaType
;
90 rtl::OUString msEncoding
;
91 bool mbOmitXmlDeclaration
;
93 rtl::OUString msCDataSectionElement
;
94 rtl::OUString msReplace
;
95 rtl::OUString msSeparator
;
96 com::sun::star::uno::Sequence
< rtl::OUString
> msIncludeNamespacePrefixes
;
100 /// the Model to which this Submission belongs; may be NULL
101 com::sun::star::uno::Reference
<com::sun::star::xforms::XModel
> mxModel
;
103 // this will extract the document from the model that will be submitted
104 com::sun::star::uno::Reference
< com::sun::star::xml::dom::XDocumentFragment
>
105 createSubmissionDocument(const com::sun::star::uno::Reference
< com::sun::star::xml::xpath::XXPathObject
>& aObject
,
106 sal_Bool bRemoveWSNodes
= sal_False
);
107 com::sun::star::uno::Reference
< com::sun::star::xml::dom::XDocument
>
108 getInstanceDocument(const com::sun::star::uno::Reference
< com::sun::star::xml::xpath::XXPathObject
>& aObject
);
110 com::sun::star::uno::Reference
<com::sun::star::lang::XMultiServiceFactory
> m_aFactory
;
113 virtual ~Submission() throw();
116 // property methods: get/set value
120 com::sun::star::uno::Reference
<com::sun::star::xforms::XModel
>
125 const com::sun::star::uno::Reference
<com::sun::star::xforms::XModel
>& );
127 rtl::OUString
getID() const; /// get ID for this submission
128 void setID( const rtl::OUString
& ); /// set ID for this submission
130 rtl::OUString
getBind() const;
131 void setBind( const rtl::OUString
& );
133 rtl::OUString
getRef() const;
134 void setRef( const rtl::OUString
& );
136 rtl::OUString
getAction() const;
137 void setAction( const rtl::OUString
& );
139 rtl::OUString
getMethod() const;
140 void setMethod( const rtl::OUString
& );
142 rtl::OUString
getVersion() const;
143 void setVersion( const rtl::OUString
& );
145 bool getIndent() const;
146 void setIndent( bool );
148 rtl::OUString
getMediaType() const;
149 void setMediaType( const rtl::OUString
& );
151 rtl::OUString
getEncoding() const;
152 void setEncoding( const rtl::OUString
& );
154 bool getOmitXmlDeclaration() const;
155 void setOmitXmlDeclaration( bool );
157 bool getStandalone() const;
158 void setStandalone( bool );
160 rtl::OUString
getCDataSectionElement() const;
161 void setCDataSectionElement( const rtl::OUString
& );
163 rtl::OUString
getReplace() const;
164 void setReplace( const rtl::OUString
& );
166 rtl::OUString
getSeparator() const;
167 void setSeparator( const rtl::OUString
& );
169 com::sun::star::uno::Sequence
< rtl::OUString
> getIncludeNamespacePrefixes() const;
170 void setIncludeNamespacePrefixes( const com::sun::star::uno::Sequence
< rtl::OUString
>& );
173 /** perform the submission
174 * @returns if submission was successful */
175 bool doSubmit( const ::com::sun::star::uno::Reference
< ::com::sun::star::task::XInteractionHandler
>& aHandler
);
178 /// release the model (note: Binding is unusable without model)
182 // helpers for UNO tunnel
183 static com::sun::star::uno::Sequence
<sal_Int8
> getUnoTunnelID();
184 static Submission
* getSubmission( const com::sun::star::uno::Reference
<com::sun::star::beans::XPropertySet
>& );
190 /// check whether object is live, and throw suitable exception if not
191 /// (to be used be API methods before acting on the object)
193 throw( com::sun::star::uno::RuntimeException
);
195 /// get the model implementation
196 xforms::Model
* getModelImpl() const;
197 xforms::Model
* getModelImpl( const com::sun::star::uno::Reference
<com::sun::star::xforms::XModel
>& xModel
) const;
204 // XPropertySet & friends:
205 // implement abstract methods from PropertySetHelper
208 virtual sal_Bool SAL_CALL
convertFastPropertyValue(
209 com::sun::star::uno::Any
& rConvertedValue
,
210 com::sun::star::uno::Any
& rOldValue
,
212 const com::sun::star::uno::Any
& rValue
)
213 throw ( com::sun::star::lang::IllegalArgumentException
);
216 void initializePropertySet();
226 virtual rtl::OUString SAL_CALL
getName()
227 throw( com::sun::star::uno::RuntimeException
);
229 virtual void SAL_CALL
setName( const rtl::OUString
& )
230 throw( com::sun::star::uno::RuntimeException
);
238 virtual sal_Int64 SAL_CALL
getSomething(
239 const com::sun::star::uno::Sequence
<sal_Int8
>& )
240 throw( com::sun::star::uno::RuntimeException
);
247 virtual void SAL_CALL
submit( )
248 throw ( com::sun::star::util::VetoException
,
249 com::sun::star::lang::WrappedTargetException
,
250 com::sun::star::uno::RuntimeException
);
251 virtual void SAL_CALL
submitWithInteraction(
252 const ::com::sun::star::uno::Reference
< ::com::sun::star::task::XInteractionHandler
>& aHandler
)
253 throw ( com::sun::star::util::VetoException
,
254 com::sun::star::lang::WrappedTargetException
,
255 com::sun::star::uno::RuntimeException
);
256 virtual void SAL_CALL
addSubmissionVetoListener(
257 const ::com::sun::star::uno::Reference
< ::com::sun::star::form::submission::XSubmissionVetoListener
>& listener
)
258 throw (::com::sun::star::lang::NoSupportException
, ::com::sun::star::uno::RuntimeException
);
259 virtual void SAL_CALL
removeSubmissionVetoListener(
260 const ::com::sun::star::uno::Reference
< ::com::sun::star::form::submission::XSubmissionVetoListener
>& listener
)
261 throw (::com::sun::star::lang::NoSupportException
, ::com::sun::star::uno::RuntimeException
);
265 // (need to disambiguate this)
267 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException
);
268 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
);
269 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
);
270 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
);
271 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
);
272 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
);
273 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
);
277 } // namespace xforms