xref: /aoo42x/main/forms/source/xforms/submission.hxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef _SUBMISSION_HXX
29*cdf0e10cSrcweir #define _SUBMISSION_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir // includes for parent classes
33*cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx>
34*cdf0e10cSrcweir #include <propertysetbase.hxx>
35*cdf0e10cSrcweir #include <com/sun/star/util/XModifyBroadcaster.hpp>
36*cdf0e10cSrcweir #include <com/sun/star/container/XNamed.hpp>
37*cdf0e10cSrcweir #include <com/sun/star/xml/dom/events/XEventListener.hpp>
38*cdf0e10cSrcweir #include <com/sun/star/lang/XUnoTunnel.hpp>
39*cdf0e10cSrcweir #include <com/sun/star/xml/dom/XNode.hpp>
40*cdf0e10cSrcweir #include <com/sun/star/xml/dom/XDocument.hpp>
41*cdf0e10cSrcweir #include <com/sun/star/xml/dom/XDocumentFragment.hpp>
42*cdf0e10cSrcweir #include <com/sun/star/xml/xpath/XXPathObject.hpp>
43*cdf0e10cSrcweir #include <com/sun/star/xforms/XSubmission.hpp>
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir // includes for member variables
46*cdf0e10cSrcweir #include <com/sun/star/uno/Reference.hxx>
47*cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx>
48*cdf0e10cSrcweir #include <computedexpression.hxx>
49*cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir // forward declaractions
52*cdf0e10cSrcweir namespace com { namespace sun { namespace star {
53*cdf0e10cSrcweir     namespace xforms { class XModel; }
54*cdf0e10cSrcweir     namespace uno { class Any; }
55*cdf0e10cSrcweir     namespace beans { class UnknownPropertyException;
56*cdf0e10cSrcweir                       class PropertyVetoException; }
57*cdf0e10cSrcweir     namespace lang { class IllegalArgumentException;
58*cdf0e10cSrcweir                      class WrappedTargetException; }
59*cdf0e10cSrcweir } } }
60*cdf0e10cSrcweir namespace xforms { class Model; }
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir namespace xforms
64*cdf0e10cSrcweir {
65*cdf0e10cSrcweir 
66*cdf0e10cSrcweir /** An XForms submission.
67*cdf0e10cSrcweir  *
68*cdf0e10cSrcweir  * See http://www.w3.org/TR/xforms/ for more information.
69*cdf0e10cSrcweir  */
70*cdf0e10cSrcweir typedef cppu::ImplInheritanceHelper2<
71*cdf0e10cSrcweir     PropertySetBase,
72*cdf0e10cSrcweir     com::sun::star::lang::XUnoTunnel,
73*cdf0e10cSrcweir     com::sun::star::xforms::XSubmission
74*cdf0e10cSrcweir > Submission_t;
75*cdf0e10cSrcweir 
76*cdf0e10cSrcweir class Submission : public Submission_t
77*cdf0e10cSrcweir {
78*cdf0e10cSrcweir     // submission properties
79*cdf0e10cSrcweir     rtl::OUString msID;
80*cdf0e10cSrcweir     rtl::OUString msBind;
81*cdf0e10cSrcweir     ComputedExpression maRef;
82*cdf0e10cSrcweir     rtl::OUString msAction;
83*cdf0e10cSrcweir     rtl::OUString msMethod;
84*cdf0e10cSrcweir     rtl::OUString msVersion;
85*cdf0e10cSrcweir     bool mbIndent;
86*cdf0e10cSrcweir     rtl::OUString msMediaType;
87*cdf0e10cSrcweir     rtl::OUString msEncoding;
88*cdf0e10cSrcweir     bool mbOmitXmlDeclaration;
89*cdf0e10cSrcweir     bool mbStandalone;
90*cdf0e10cSrcweir     rtl::OUString msCDataSectionElement;
91*cdf0e10cSrcweir     rtl::OUString msReplace;
92*cdf0e10cSrcweir     rtl::OUString msSeparator;
93*cdf0e10cSrcweir     com::sun::star::uno::Sequence< rtl::OUString > msIncludeNamespacePrefixes;
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir private:
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir     /// the Model to which this Submission belongs; may be NULL
98*cdf0e10cSrcweir     com::sun::star::uno::Reference<com::sun::star::xforms::XModel> mxModel;
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir     // this will extract the document from the model that will be submitted
101*cdf0e10cSrcweir     com::sun::star::uno::Reference< com::sun::star::xml::dom::XDocumentFragment >
102*cdf0e10cSrcweir         createSubmissionDocument(const com::sun::star::uno::Reference< com::sun::star::xml::xpath::XXPathObject >& aObject,
103*cdf0e10cSrcweir                                  sal_Bool bRemoveWSNodes = sal_False);
104*cdf0e10cSrcweir     com::sun::star::uno::Reference< com::sun::star::xml::dom::XDocument >
105*cdf0e10cSrcweir         getInstanceDocument(const com::sun::star::uno::Reference< com::sun::star::xml::xpath::XXPathObject >& aObject);
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir     com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory > m_aFactory;
108*cdf0e10cSrcweir public:
109*cdf0e10cSrcweir     Submission();
110*cdf0e10cSrcweir     virtual ~Submission() throw();
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir     //
113*cdf0e10cSrcweir     // property methods: get/set value
114*cdf0e10cSrcweir     //
115*cdf0e10cSrcweir 
116*cdf0e10cSrcweir     /// get XForms model
117*cdf0e10cSrcweir     com::sun::star::uno::Reference<com::sun::star::xforms::XModel>
118*cdf0e10cSrcweir         getModel() const;
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir     /// set XForms model
121*cdf0e10cSrcweir     void setModel(
122*cdf0e10cSrcweir         const com::sun::star::uno::Reference<com::sun::star::xforms::XModel>& );
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir     rtl::OUString getID() const;         /// get ID for this submission
125*cdf0e10cSrcweir     void setID( const rtl::OUString& );  /// set ID for this submission
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir     rtl::OUString getBind() const;
128*cdf0e10cSrcweir     void setBind( const rtl::OUString& );
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir     rtl::OUString getRef() const;
131*cdf0e10cSrcweir     void setRef( const rtl::OUString& );
132*cdf0e10cSrcweir 
133*cdf0e10cSrcweir     rtl::OUString getAction() const;
134*cdf0e10cSrcweir     void setAction( const rtl::OUString& );
135*cdf0e10cSrcweir 
136*cdf0e10cSrcweir     rtl::OUString getMethod() const;
137*cdf0e10cSrcweir     void setMethod( const rtl::OUString& );
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir     rtl::OUString getVersion() const;
140*cdf0e10cSrcweir     void setVersion( const rtl::OUString& );
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir     bool getIndent() const;
143*cdf0e10cSrcweir     void setIndent( bool );
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir     rtl::OUString getMediaType() const;
146*cdf0e10cSrcweir     void setMediaType( const rtl::OUString& );
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir     rtl::OUString getEncoding() const;
149*cdf0e10cSrcweir     void setEncoding( const rtl::OUString& );
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir     bool getOmitXmlDeclaration() const;
152*cdf0e10cSrcweir     void setOmitXmlDeclaration( bool );
153*cdf0e10cSrcweir 
154*cdf0e10cSrcweir     bool getStandalone() const;
155*cdf0e10cSrcweir     void setStandalone( bool );
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir     rtl::OUString getCDataSectionElement() const;
158*cdf0e10cSrcweir     void setCDataSectionElement( const rtl::OUString& );
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir     rtl::OUString getReplace() const;
161*cdf0e10cSrcweir     void setReplace( const rtl::OUString& );
162*cdf0e10cSrcweir 
163*cdf0e10cSrcweir     rtl::OUString getSeparator() const;
164*cdf0e10cSrcweir     void setSeparator( const rtl::OUString& );
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir     com::sun::star::uno::Sequence< rtl::OUString > getIncludeNamespacePrefixes() const;
167*cdf0e10cSrcweir     void setIncludeNamespacePrefixes( const com::sun::star::uno::Sequence< rtl::OUString >& );
168*cdf0e10cSrcweir 
169*cdf0e10cSrcweir 
170*cdf0e10cSrcweir 	/** perform the submission
171*cdf0e10cSrcweir 	 * @returns if submission was successful */
172*cdf0e10cSrcweir 	bool doSubmit( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& aHandler );
173*cdf0e10cSrcweir 
174*cdf0e10cSrcweir 
175*cdf0e10cSrcweir     /// release the model (note: Binding is unusable without model)
176*cdf0e10cSrcweir     void releaseModel();
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir 
179*cdf0e10cSrcweir     // helpers for UNO tunnel
180*cdf0e10cSrcweir     static com::sun::star::uno::Sequence<sal_Int8> getUnoTunnelID();
181*cdf0e10cSrcweir     static Submission* getSubmission( const com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>& );
182*cdf0e10cSrcweir 
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir 
185*cdf0e10cSrcweir private:
186*cdf0e10cSrcweir 
187*cdf0e10cSrcweir     /// check whether object is live, and throw suitable exception if not
188*cdf0e10cSrcweir     /// (to be used be API methods before acting on the object)
189*cdf0e10cSrcweir     void liveCheck()
190*cdf0e10cSrcweir         throw( com::sun::star::uno::RuntimeException );
191*cdf0e10cSrcweir 
192*cdf0e10cSrcweir     /// get the model implementation
193*cdf0e10cSrcweir     xforms::Model* getModelImpl() const;
194*cdf0e10cSrcweir     xforms::Model* getModelImpl( const com::sun::star::uno::Reference<com::sun::star::xforms::XModel>& xModel ) const;
195*cdf0e10cSrcweir 
196*cdf0e10cSrcweir 
197*cdf0e10cSrcweir 
198*cdf0e10cSrcweir protected:
199*cdf0e10cSrcweir 
200*cdf0e10cSrcweir     //
201*cdf0e10cSrcweir     // XPropertySet & friends:
202*cdf0e10cSrcweir     //   implement abstract methods from PropertySetHelper
203*cdf0e10cSrcweir     //
204*cdf0e10cSrcweir 
205*cdf0e10cSrcweir     virtual sal_Bool SAL_CALL convertFastPropertyValue(
206*cdf0e10cSrcweir         com::sun::star::uno::Any& rConvertedValue,
207*cdf0e10cSrcweir         com::sun::star::uno::Any& rOldValue,
208*cdf0e10cSrcweir         sal_Int32 nHandle,
209*cdf0e10cSrcweir         const com::sun::star::uno::Any& rValue )
210*cdf0e10cSrcweir 		throw ( com::sun::star::lang::IllegalArgumentException );
211*cdf0e10cSrcweir 
212*cdf0e10cSrcweir private:
213*cdf0e10cSrcweir     void initializePropertySet();
214*cdf0e10cSrcweir 
215*cdf0e10cSrcweir 
216*cdf0e10cSrcweir public:
217*cdf0e10cSrcweir 
218*cdf0e10cSrcweir     //
219*cdf0e10cSrcweir     // XNamed:
220*cdf0e10cSrcweir     //   get/set name
221*cdf0e10cSrcweir     //
222*cdf0e10cSrcweir 
223*cdf0e10cSrcweir     virtual rtl::OUString SAL_CALL getName()
224*cdf0e10cSrcweir         throw( com::sun::star::uno::RuntimeException );
225*cdf0e10cSrcweir 
226*cdf0e10cSrcweir     virtual void SAL_CALL setName( const rtl::OUString& )
227*cdf0e10cSrcweir         throw( com::sun::star::uno::RuntimeException );
228*cdf0e10cSrcweir 
229*cdf0e10cSrcweir 
230*cdf0e10cSrcweir 
231*cdf0e10cSrcweir     //
232*cdf0e10cSrcweir     // XUnoTunnel
233*cdf0e10cSrcweir     //
234*cdf0e10cSrcweir 
235*cdf0e10cSrcweir     virtual sal_Int64 SAL_CALL getSomething(
236*cdf0e10cSrcweir         const com::sun::star::uno::Sequence<sal_Int8>& )
237*cdf0e10cSrcweir         throw( com::sun::star::uno::RuntimeException );
238*cdf0e10cSrcweir 
239*cdf0e10cSrcweir 
240*cdf0e10cSrcweir     //
241*cdf0e10cSrcweir     // XSubmission
242*cdf0e10cSrcweir     //
243*cdf0e10cSrcweir 
244*cdf0e10cSrcweir     virtual void SAL_CALL submit(  )
245*cdf0e10cSrcweir         throw ( com::sun::star::util::VetoException,
246*cdf0e10cSrcweir                 com::sun::star::lang::WrappedTargetException,
247*cdf0e10cSrcweir                 com::sun::star::uno::RuntimeException );
248*cdf0e10cSrcweir     virtual void SAL_CALL submitWithInteraction(
249*cdf0e10cSrcweir         const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& aHandler )
250*cdf0e10cSrcweir         throw ( com::sun::star::util::VetoException,
251*cdf0e10cSrcweir                 com::sun::star::lang::WrappedTargetException,
252*cdf0e10cSrcweir                 com::sun::star::uno::RuntimeException );
253*cdf0e10cSrcweir     virtual void SAL_CALL addSubmissionVetoListener(
254*cdf0e10cSrcweir         const ::com::sun::star::uno::Reference< ::com::sun::star::form::submission::XSubmissionVetoListener >& listener )
255*cdf0e10cSrcweir         throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
256*cdf0e10cSrcweir     virtual void SAL_CALL removeSubmissionVetoListener(
257*cdf0e10cSrcweir         const ::com::sun::star::uno::Reference< ::com::sun::star::form::submission::XSubmissionVetoListener >& listener )
258*cdf0e10cSrcweir         throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
259*cdf0e10cSrcweir 
260*cdf0e10cSrcweir     //
261*cdf0e10cSrcweir     // XPropertySet
262*cdf0e10cSrcweir     // (need to disambiguate this)
263*cdf0e10cSrcweir 
264*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException);
265*cdf0e10cSrcweir     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);
266*cdf0e10cSrcweir     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);
267*cdf0e10cSrcweir     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);
268*cdf0e10cSrcweir     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);
269*cdf0e10cSrcweir     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);
270*cdf0e10cSrcweir     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);
271*cdf0e10cSrcweir };
272*cdf0e10cSrcweir 
273*cdf0e10cSrcweir 
274*cdf0e10cSrcweir } // namespace xforms
275*cdf0e10cSrcweir 
276*cdf0e10cSrcweir #endif
277