tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / forms / source / xforms / submission.hxx
blobcf6ec8402720ae296c8fad62c88b0995b50bad74
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #pragma once
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; }
45 namespace xforms
48 /** An XForms submission.
50 * See http://www.w3.org/TR/xforms/ for more information.
52 typedef cppu::ImplInheritanceHelper<
53 PropertySetBase,
54 css::xforms::XSubmission
55 > Submission_t;
57 class Submission : public Submission_t
59 // submission properties
60 OUString msID;
61 OUString msBind;
62 ComputedExpression maRef;
63 OUString msAction;
64 OUString msMethod;
65 OUString msVersion;
66 bool mbIndent;
67 OUString msMediaType;
68 OUString msEncoding;
69 bool mbOmitXmlDeclaration;
70 bool mbStandalone;
71 OUString msCDataSectionElement;
72 OUString msReplace;
73 OUString msSeparator;
74 css::uno::Sequence< OUString > msIncludeNamespacePrefixes;
76 private:
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,
84 bool bRemoveWSNodes);
85 static css::uno::Reference< css::xml::dom::XDocument >
86 getInstanceDocument(const css::uno::Reference< css::xml::xpath::XXPathObject >& aObject);
88 public:
89 Submission();
90 virtual ~Submission() noexcept override;
93 // property methods: get/set value
96 /// get XForms model
97 css::uno::Reference<css::xforms::XModel> getModel() const;
99 /// get the model implementation
100 xforms::Model* getModelImpl() const { return mxModel.get(); }
102 /// set XForms model
103 void setModel(
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 );
155 private:
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
161 void liveCheck();
163 protected:
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,
173 sal_Int32 nHandle,
174 const css::uno::Any& rValue ) override;
176 private:
177 void initializePropertySet();
180 public:
183 // XNamed:
184 // get/set name
187 virtual OUString SAL_CALL getName() override;
189 virtual void SAL_CALL setName( const OUString& ) override;
192 // XSubmission
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;
204 // XPropertySet
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: */