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 .
22 #include <cppuhelper/implbase.hxx>
23 #include "propertysetbase.hxx"
24 #include <com/sun/star/xml/dom/XDocument.hpp>
25 #include <com/sun/star/xml/dom/XDocumentFragment.hpp>
26 #include <com/sun/star/xml/xpath/XXPathObject.hpp>
27 #include <com/sun/star/xforms/XSubmission.hpp>
29 #include <com/sun/star/uno/Reference.hxx>
30 #include <com/sun/star/uno/Sequence.hxx>
31 #include "computedexpression.hxx"
33 // forward declarations
34 namespace com::sun::star
{
35 namespace xforms
{ class XModel
; }
36 namespace uno
{ class Any
; }
37 namespace beans
{ class UnknownPropertyException
;
38 class PropertyVetoException
; }
39 namespace lang
{ class IllegalArgumentException
;
40 class WrappedTargetException
; }
42 namespace xforms
{ class Model
; }
48 /** An XForms submission.
50 * See http://www.w3.org/TR/xforms/ for more information.
52 typedef cppu::ImplInheritanceHelper
<
54 css::xforms::XSubmission
57 class Submission
: public Submission_t
59 // submission properties
62 ComputedExpression maRef
;
69 bool mbOmitXmlDeclaration
;
71 OUString msCDataSectionElement
;
74 css::uno::Sequence
< OUString
> msIncludeNamespacePrefixes
;
78 /// the Model to which this Submission belongs; may be NULL
79 rtl::Reference
<Model
> mxModel
;
81 // this will extract the document from the model that will be submitted
82 css::uno::Reference
< css::xml::dom::XDocumentFragment
>
83 createSubmissionDocument(const css::uno::Reference
< css::xml::xpath::XXPathObject
>& aObject
,
85 static css::uno::Reference
< css::xml::dom::XDocument
>
86 getInstanceDocument(const css::uno::Reference
< css::xml::xpath::XXPathObject
>& aObject
);
90 virtual ~Submission() noexcept override
;
93 // property methods: get/set value
97 css::uno::Reference
<css::xforms::XModel
> getModel() const;
99 /// get the model implementation
100 xforms::Model
* getModelImpl() const { return mxModel
.get(); }
104 const css::uno::Reference
<css::xforms::XModel
>& );
106 OUString
getID() const { return msID
;} /// get ID for this submission
107 void setID( const OUString
& ); /// set ID for this submission
109 OUString
getBind() const { return msBind
;}
110 void setBind( const OUString
& );
112 OUString
getRef() const;
113 void setRef( const OUString
& );
115 OUString
getAction() const { return msAction
;}
116 void setAction( const OUString
& );
118 OUString
getMethod() const { return msMethod
;}
119 void setMethod( const OUString
& );
121 OUString
getVersion() const { return msVersion
;}
122 void setVersion( const OUString
& );
124 bool getIndent() const { return mbIndent
;}
125 void setIndent( bool );
127 OUString
getMediaType() const { return msMediaType
;}
128 void setMediaType( const OUString
& );
130 OUString
getEncoding() const { return msEncoding
;}
131 void setEncoding( const OUString
& );
133 bool getOmitXmlDeclaration() const { return mbOmitXmlDeclaration
;}
134 void setOmitXmlDeclaration( bool );
136 bool getStandalone() const { return mbStandalone
;}
137 void setStandalone( bool );
139 OUString
getCDataSectionElement() const { return msCDataSectionElement
;}
140 void setCDataSectionElement( const OUString
& );
142 OUString
getReplace() const { return msReplace
;}
143 void setReplace( const OUString
& );
145 OUString
getSeparator() const { return msSeparator
;}
146 void setSeparator( const OUString
& );
148 css::uno::Sequence
< OUString
> getIncludeNamespacePrefixes() const { return msIncludeNamespacePrefixes
;}
149 void setIncludeNamespacePrefixes( const css::uno::Sequence
< OUString
>& );
151 /** perform the submission
152 * @returns if submission was successful */
153 bool doSubmit( const css::uno::Reference
< css::task::XInteractionHandler
>& aHandler
);
157 /// check whether object is live, and throw suitable exception if not
158 /// (to be used be API methods before acting on the object)
160 /// @throws css::uno::RuntimeException
166 // XPropertySet & friends:
167 // implement abstract methods from PropertySetHelper
170 virtual sal_Bool SAL_CALL
convertFastPropertyValue(
171 css::uno::Any
& rConvertedValue
,
172 css::uno::Any
& rOldValue
,
174 const css::uno::Any
& rValue
) override
;
177 void initializePropertySet();
187 virtual OUString SAL_CALL
getName() override
;
189 virtual void SAL_CALL
setName( const OUString
& ) override
;
195 virtual void SAL_CALL
submit( ) override
;
196 virtual void SAL_CALL
submitWithInteraction(
197 const css::uno::Reference
< css::task::XInteractionHandler
>& aHandler
) override
;
198 virtual void SAL_CALL
addSubmissionVetoListener(
199 const css::uno::Reference
< css::form::submission::XSubmissionVetoListener
>& listener
) override
;
200 virtual void SAL_CALL
removeSubmissionVetoListener(
201 const css::uno::Reference
< css::form::submission::XSubmissionVetoListener
>& listener
) override
;
205 // (need to disambiguate this)
207 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) override
;
208 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
, const css::uno::Any
& aValue
) override
;
209 virtual css::uno::Any SAL_CALL
getPropertyValue( const OUString
& PropertyName
) override
;
210 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
) override
;
211 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
< css::beans::XPropertyChangeListener
>& aListener
) override
;
212 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
, const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
213 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
, const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
217 } // namespace xforms
219 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */