xref: /AOO41X/main/forms/source/xforms/binding.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
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 _BINDING_HXX
29*cdf0e10cSrcweir #define _BINDING_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <com/sun/star/uno/Reference.hxx>
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir // forward declaractions
34*cdf0e10cSrcweir namespace xforms
35*cdf0e10cSrcweir {
36*cdf0e10cSrcweir     class Model;
37*cdf0e10cSrcweir     class EvaluationContext;
38*cdf0e10cSrcweir }
39*cdf0e10cSrcweir namespace com { namespace sun { namespace star {
40*cdf0e10cSrcweir     namespace xml {
41*cdf0e10cSrcweir         namespace xpath { class XXPathAPI; }
42*cdf0e10cSrcweir         namespace dom
43*cdf0e10cSrcweir         {
44*cdf0e10cSrcweir             class XNode;
45*cdf0e10cSrcweir             class XNodeList;
46*cdf0e10cSrcweir         }
47*cdf0e10cSrcweir     }
48*cdf0e10cSrcweir     namespace container { class XNameContainer; }
49*cdf0e10cSrcweir     namespace xforms { class XModel; }
50*cdf0e10cSrcweir     namespace xsd { class XDataType; }
51*cdf0e10cSrcweir } } }
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir // includes for parent classes
54*cdf0e10cSrcweir #include <cppuhelper/implbase8.hxx>
55*cdf0e10cSrcweir #include <propertysetbase.hxx>
56*cdf0e10cSrcweir #include <com/sun/star/form/binding/XValueBinding.hpp>
57*cdf0e10cSrcweir #include <com/sun/star/form/binding/XListEntrySource.hpp>
58*cdf0e10cSrcweir #include <com/sun/star/form/validation/XValidator.hpp>
59*cdf0e10cSrcweir #include <com/sun/star/util/XModifyBroadcaster.hpp>
60*cdf0e10cSrcweir #include <com/sun/star/container/XNamed.hpp>
61*cdf0e10cSrcweir #include <com/sun/star/xml/dom/events/XEventListener.hpp>
62*cdf0e10cSrcweir #include <com/sun/star/lang/XUnoTunnel.hpp>
63*cdf0e10cSrcweir #include <com/sun/star/util/XCloneable.hpp>
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir // includes for member variables
66*cdf0e10cSrcweir #include "pathexpression.hxx"
67*cdf0e10cSrcweir #include "boolexpression.hxx"
68*cdf0e10cSrcweir #include "mip.hxx"
69*cdf0e10cSrcweir #include <rtl/ustring.hxx>
70*cdf0e10cSrcweir #include <vector>
71*cdf0e10cSrcweir #include <memory> // auto_ptr
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir 
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir namespace xforms
76*cdf0e10cSrcweir {
77*cdf0e10cSrcweir 
78*cdf0e10cSrcweir /** An XForms Binding. Contains:
79*cdf0e10cSrcweir  *  # a connection to its model
80*cdf0e10cSrcweir  *  # an ID
81*cdf0e10cSrcweir  *  # an binding expression
82*cdf0e10cSrcweir  *  # model item properties
83*cdf0e10cSrcweir  *  # (NOT YET IMPLEMENTED) child bindings (sequence of)
84*cdf0e10cSrcweir  *
85*cdf0e10cSrcweir  * See http://www.w3.org/TR/xforms/ for more information.
86*cdf0e10cSrcweir  */
87*cdf0e10cSrcweir 
88*cdf0e10cSrcweir typedef cppu::ImplInheritanceHelper8<
89*cdf0e10cSrcweir     PropertySetBase,
90*cdf0e10cSrcweir     com::sun::star::form::binding::XValueBinding,
91*cdf0e10cSrcweir     com::sun::star::form::binding::XListEntrySource,
92*cdf0e10cSrcweir     com::sun::star::form::validation::XValidator,
93*cdf0e10cSrcweir     com::sun::star::util::XModifyBroadcaster,
94*cdf0e10cSrcweir     com::sun::star::container::XNamed,
95*cdf0e10cSrcweir     com::sun::star::xml::dom::events::XEventListener,
96*cdf0e10cSrcweir     com::sun::star::lang::XUnoTunnel,
97*cdf0e10cSrcweir     com::sun::star::util::XCloneable
98*cdf0e10cSrcweir > Binding_t;
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir class Binding : public Binding_t
101*cdf0e10cSrcweir {
102*cdf0e10cSrcweir public:
103*cdf0e10cSrcweir     typedef com::sun::star::uno::Reference<com::sun::star::xforms::XModel> Model_t;
104*cdf0e10cSrcweir     typedef com::sun::star::uno::Reference<com::sun::star::util::XModifyListener> XModifyListener_t;
105*cdf0e10cSrcweir     typedef std::vector<XModifyListener_t> ModifyListeners_t;
106*cdf0e10cSrcweir     typedef com::sun::star::uno::Reference<com::sun::star::form::validation::XValidityConstraintListener> XValidityConstraintListener_t;
107*cdf0e10cSrcweir     typedef std::vector<XValidityConstraintListener_t> XValidityConstraintListeners_t;
108*cdf0e10cSrcweir     typedef com::sun::star::uno::Reference<com::sun::star::form::binding::XListEntryListener> XListEntryListener_t;
109*cdf0e10cSrcweir     typedef std::vector<XListEntryListener_t> XListEntryListeners_t;
110*cdf0e10cSrcweir     typedef com::sun::star::uno::Reference<com::sun::star::container::XNameContainer> XNameContainer_t;
111*cdf0e10cSrcweir     typedef com::sun::star::uno::Reference<com::sun::star::xml::dom::XNode> XNode_t;
112*cdf0e10cSrcweir     typedef com::sun::star::uno::Reference<com::sun::star::xml::dom::XNodeList> XNodeList_t;
113*cdf0e10cSrcweir     typedef com::sun::star::uno::Reference<com::sun::star::util::XCloneable> XCloneable_t;
114*cdf0e10cSrcweir     typedef com::sun::star::uno::Sequence<sal_Int8> IntSequence_t;
115*cdf0e10cSrcweir     typedef com::sun::star::uno::Sequence<rtl::OUString> StringSequence_t;
116*cdf0e10cSrcweir     typedef std::vector<MIP> MIPs_t;
117*cdf0e10cSrcweir     typedef std::vector<XNode_t> XNodes_t;
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir private:
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir     /// the Model to which this Binding belongs; may be NULL
124*cdf0e10cSrcweir     Model_t mxModel;
125*cdf0e10cSrcweir 
126*cdf0e10cSrcweir     /// binding-ID. A document-wide unique ID for this binding element.
127*cdf0e10cSrcweir     rtl::OUString msBindingID;
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir     /// an XPath-expression to be instantiated on the data instance
130*cdf0e10cSrcweir     PathExpression maBindingExpression;
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir     /// an XPath-expression to determine read-only status
133*cdf0e10cSrcweir     BoolExpression maReadonly;
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir     /// an XPath-expression to determine relevance
136*cdf0e10cSrcweir     BoolExpression maRelevant;
137*cdf0e10cSrcweir 
138*cdf0e10cSrcweir     /// an XPath-expression to determine if item is required
139*cdf0e10cSrcweir     BoolExpression maRequired;
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir     /// an XPath-expression to determine if item is valid
142*cdf0e10cSrcweir     BoolExpression maConstraint;
143*cdf0e10cSrcweir 
144*cdf0e10cSrcweir     /// user-readable explanation of the constraint
145*cdf0e10cSrcweir     rtl::OUString msExplainConstraint;
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir     /// an XPath-expression to calculate values
148*cdf0e10cSrcweir     ComputedExpression maCalculate;
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir     /// the XML namespaces used for XML names/XPath-expressions in this binding
151*cdf0e10cSrcweir     XNameContainer_t mxNamespaces;
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir     /// a type name
154*cdf0e10cSrcweir     rtl::OUString msTypeName;
155*cdf0e10cSrcweir 
156*cdf0e10cSrcweir     /// modify listeners
157*cdf0e10cSrcweir     ModifyListeners_t maModifyListeners;
158*cdf0e10cSrcweir 
159*cdf0e10cSrcweir     /// list entry listener
160*cdf0e10cSrcweir     XListEntryListeners_t maListEntryListeners;
161*cdf0e10cSrcweir 
162*cdf0e10cSrcweir     /// validity listeners;
163*cdf0e10cSrcweir     XValidityConstraintListeners_t maValidityListeners;
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir     /// nodes on which we are listening for events
166*cdf0e10cSrcweir     XNodes_t maEventNodes;
167*cdf0e10cSrcweir 
168*cdf0e10cSrcweir     /// the current MIP object for the first node we are bound to
169*cdf0e10cSrcweir     MIP maMIP;
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir     /// flag to detect recursions in calculate
172*cdf0e10cSrcweir     bool mbInCalculate;
173*cdf0e10cSrcweir 
174*cdf0e10cSrcweir     // flags to manage deferred notifications:
175*cdf0e10cSrcweir     /// if >0, valueModified() and bindingModified() will only set flags
176*cdf0e10cSrcweir     sal_Int32 mnDeferModifyNotifications;
177*cdf0e10cSrcweir     bool mbValueModified;   /// if true, valueModified needs to be called
178*cdf0e10cSrcweir     bool mbBindingModified; /// if true, bindingModified needs to be called
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir 
181*cdf0e10cSrcweir     void initializePropertySet();
182*cdf0e10cSrcweir 
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir public:
185*cdf0e10cSrcweir     Binding();
186*cdf0e10cSrcweir     virtual ~Binding() throw();
187*cdf0e10cSrcweir 
188*cdf0e10cSrcweir     //
189*cdf0e10cSrcweir     // property methods: get/set value
190*cdf0e10cSrcweir     //
191*cdf0e10cSrcweir 
192*cdf0e10cSrcweir     Model_t getModel() const;   /// get XForms model
193*cdf0e10cSrcweir     void _setModel( const Model_t& ); /// set XForms model (only called by Model)
194*cdf0e10cSrcweir 
195*cdf0e10cSrcweir 
196*cdf0e10cSrcweir     rtl::OUString getModelID() const;   /// get ID of XForms model
197*cdf0e10cSrcweir 
198*cdf0e10cSrcweir     rtl::OUString getBindingID() const;         /// get ID for this binding
199*cdf0e10cSrcweir     void setBindingID( const rtl::OUString& );  /// set ID for this binding
200*cdf0e10cSrcweir 
201*cdf0e10cSrcweir     rtl::OUString getBindingExpression() const; /// get binding expression
202*cdf0e10cSrcweir     void setBindingExpression( const rtl::OUString& );  /// set binding exp.
203*cdf0e10cSrcweir 
204*cdf0e10cSrcweir     // MIPs (model item properties)
205*cdf0e10cSrcweir 
206*cdf0e10cSrcweir     rtl::OUString getReadonlyExpression() const;         /// get read-only MIP
207*cdf0e10cSrcweir     void setReadonlyExpression( const rtl::OUString& );  /// set read-only MIP
208*cdf0e10cSrcweir 
209*cdf0e10cSrcweir     rtl::OUString getRelevantExpression() const;         /// get relevant MIP
210*cdf0e10cSrcweir     void setRelevantExpression( const rtl::OUString& );  /// set relevant MIP
211*cdf0e10cSrcweir 
212*cdf0e10cSrcweir     rtl::OUString getRequiredExpression() const;         /// get required MIP
213*cdf0e10cSrcweir     void setRequiredExpression( const rtl::OUString& );  /// set required MIP
214*cdf0e10cSrcweir 
215*cdf0e10cSrcweir     rtl::OUString getConstraintExpression() const;       /// get constraint MIP
216*cdf0e10cSrcweir     void setConstraintExpression( const rtl::OUString& );/// set constraint MIP
217*cdf0e10cSrcweir 
218*cdf0e10cSrcweir     rtl::OUString getCalculateExpression() const;        /// get calculate MIP
219*cdf0e10cSrcweir     void setCalculateExpression( const rtl::OUString& ); /// set calculate MIP
220*cdf0e10cSrcweir 
221*cdf0e10cSrcweir     rtl::OUString getType() const;         /// get type name MIP (static)
222*cdf0e10cSrcweir     void setType( const rtl::OUString& );  /// set type name MIP (static)
223*cdf0e10cSrcweir 
224*cdf0e10cSrcweir     // a binding expression can only be interpreted with respect to
225*cdf0e10cSrcweir     // suitable namespace declarations. We collect those in the model and in a binding.
226*cdf0e10cSrcweir 
227*cdf0e10cSrcweir     // access to a binding's namespace
228*cdf0e10cSrcweir     // (set-method only changes local namespaces (but may add to model))
229*cdf0e10cSrcweir     XNameContainer_t getBindingNamespaces() const;  /// set binding namespaces
230*cdf0e10cSrcweir     void setBindingNamespaces( const XNameContainer_t& ); /// get binding nmsp.
231*cdf0e10cSrcweir 
232*cdf0e10cSrcweir     // access to the model's namespaces
233*cdf0e10cSrcweir     // (set-method changes model's namespaces (unless a local one is present))
234*cdf0e10cSrcweir     XNameContainer_t getModelNamespaces() const;  /// set model namespaces
235*cdf0e10cSrcweir     void setModelNamespaces( const XNameContainer_t& ); /// get model nmsp.
236*cdf0e10cSrcweir 
237*cdf0e10cSrcweir 
238*cdf0e10cSrcweir     // read-only properties that map MIPs to control data source properties
239*cdf0e10cSrcweir     bool getReadOnly() const;       // MIP readonly
240*cdf0e10cSrcweir     bool getRelevant() const;       // MIP relevant
241*cdf0e10cSrcweir     bool getExternalData() const;   // mapped from model's ExternalData property
242*cdf0e10cSrcweir 
243*cdf0e10cSrcweir 
244*cdf0e10cSrcweir     // missing binding properties:
245*cdf0e10cSrcweir     // - type (static; default: xsd:string)
246*cdf0e10cSrcweir     // - minOccurs/maxOccurs (computed XPath; default: 0/inf)
247*cdf0e10cSrcweir     // - p3ptype (static; no default)
248*cdf0e10cSrcweir 
249*cdf0e10cSrcweir 
250*cdf0e10cSrcweir 
251*cdf0e10cSrcweir 
252*cdf0e10cSrcweir     /// get this binding's context node
253*cdf0e10cSrcweir     xforms::EvaluationContext getEvaluationContext() const;
254*cdf0e10cSrcweir 
255*cdf0e10cSrcweir     /// get evalation contexts for this binding's MIPs
256*cdf0e10cSrcweir     std::vector<xforms::EvaluationContext> getMIPEvaluationContexts();
257*cdf0e10cSrcweir 
258*cdf0e10cSrcweir     /// get nodeset the bind is bound to
259*cdf0e10cSrcweir     XNodeList_t getXNodeList();
260*cdf0e10cSrcweir 
261*cdf0e10cSrcweir     /// heuristically determine whether this binding is simple binding
262*cdf0e10cSrcweir     /// (here: simple binding == does not depend on other parts of the
263*cdf0e10cSrcweir     ///                          instance, it's not a 'dynamic' binding)
264*cdf0e10cSrcweir     bool isSimpleBinding() const;
265*cdf0e10cSrcweir 
266*cdf0e10cSrcweir     /// heuristically determine whether this binding's binding
267*cdf0e10cSrcweir     /// expression is simple
268*cdf0e10cSrcweir     bool isSimpleBindingExpression() const;
269*cdf0e10cSrcweir 
270*cdf0e10cSrcweir     /// update this binding (e.g. called by model for refresh )
271*cdf0e10cSrcweir     void update();
272*cdf0e10cSrcweir 
273*cdf0e10cSrcweir     /// prevent change notifications being sent to controls
274*cdf0e10cSrcweir     void deferNotifications( bool );
275*cdf0e10cSrcweir 
276*cdf0e10cSrcweir     /// is this binding valid? (are constraint, type and required MIPs ok?)
277*cdf0e10cSrcweir     bool isValid();
278*cdf0e10cSrcweir 
279*cdf0e10cSrcweir     /// determine whether this binding currently performs a useful
280*cdf0e10cSrcweir     /// function, r whether is may be discarded
281*cdf0e10cSrcweir     bool isUseful();
282*cdf0e10cSrcweir 
283*cdf0e10cSrcweir     /// explain why binding is invalid
284*cdf0e10cSrcweir     rtl::OUString explainInvalid();
285*cdf0e10cSrcweir 
286*cdf0e10cSrcweir 
287*cdf0e10cSrcweir     // the ID for XUnoTunnel calls
288*cdf0e10cSrcweir     static IntSequence_t getUnoTunnelID();
289*cdf0e10cSrcweir     static Binding* getBinding( const com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>& );
290*cdf0e10cSrcweir 
291*cdf0e10cSrcweir     //
292*cdf0e10cSrcweir     // class-scoped typedef for easy-to-read UNO interfaces
293*cdf0e10cSrcweir     //
294*cdf0e10cSrcweir 
295*cdf0e10cSrcweir     // basic types
296*cdf0e10cSrcweir     typedef com::sun::star::uno::Any Any_t;
297*cdf0e10cSrcweir     typedef com::sun::star::uno::Sequence<com::sun::star::uno::Type> Sequence_Type_t;
298*cdf0e10cSrcweir     typedef com::sun::star::uno::Type Type_t;
299*cdf0e10cSrcweir 
300*cdf0e10cSrcweir     // reference types
301*cdf0e10cSrcweir     typedef com::sun::star::uno::Reference<com::sun::star::beans::XPropertyChangeListener> XPropertyChangeListener_t;
302*cdf0e10cSrcweir     typedef com::sun::star::uno::Reference<com::sun::star::beans::XPropertySetInfo> XPropertySetInfo_t;
303*cdf0e10cSrcweir     typedef com::sun::star::uno::Reference<com::sun::star::beans::XVetoableChangeListener> XVetoableChangeListener_t;
304*cdf0e10cSrcweir     typedef com::sun::star::uno::Reference<com::sun::star::xml::xpath::XXPathAPI> XXPathAPI_t;
305*cdf0e10cSrcweir     typedef com::sun::star::uno::Reference<com::sun::star::xml::dom::events::XEvent> XEvent_t;
306*cdf0e10cSrcweir     typedef com::sun::star::uno::Reference<com::sun::star::xsd::XDataType> XDataType_t;
307*cdf0e10cSrcweir 
308*cdf0e10cSrcweir     // exceptions
309*cdf0e10cSrcweir     typedef com::sun::star::beans::PropertyVetoException PropertyVetoException_t;
310*cdf0e10cSrcweir     typedef com::sun::star::beans::UnknownPropertyException UnknownPropertyException_t;
311*cdf0e10cSrcweir     typedef com::sun::star::lang::IllegalArgumentException IllegalArgumentException_t;
312*cdf0e10cSrcweir     typedef com::sun::star::lang::NoSupportException NoSupportException_t;
313*cdf0e10cSrcweir     typedef com::sun::star::lang::WrappedTargetException WrappedTargetException_t;
314*cdf0e10cSrcweir     typedef com::sun::star::uno::RuntimeException RuntimeException_t;
315*cdf0e10cSrcweir     typedef com::sun::star::form::binding::IncompatibleTypesException IncompatibleTypesException_t;
316*cdf0e10cSrcweir     typedef com::sun::star::form::binding::InvalidBindingStateException InvalidBindingStateException_t;
317*cdf0e10cSrcweir     typedef com::sun::star::lang::NullPointerException NullPointerException_t;
318*cdf0e10cSrcweir     typedef com::sun::star::lang::IndexOutOfBoundsException IndexOutOfBoundsException_t;
319*cdf0e10cSrcweir 
320*cdf0e10cSrcweir 
321*cdf0e10cSrcweir 
322*cdf0e10cSrcweir private:
323*cdf0e10cSrcweir     /// check whether object is live, and throw suitable exception if not
324*cdf0e10cSrcweir     /// (to be used be API methods before acting on the object)
325*cdf0e10cSrcweir     void checkLive() throw( RuntimeException_t );
326*cdf0e10cSrcweir 
327*cdf0e10cSrcweir     /// check whether binding has a model, and throw exception if not
328*cdf0e10cSrcweir     /// (to be used be API methods before acting on the object)
329*cdf0e10cSrcweir     void checkModel() throw( RuntimeException_t );
330*cdf0e10cSrcweir 
331*cdf0e10cSrcweir     /// determine whether object is live
332*cdf0e10cSrcweir     /// live: has model, and model has been initialized
333*cdf0e10cSrcweir     bool isLive() const;
334*cdf0e10cSrcweir 
335*cdf0e10cSrcweir     /// get the model implementation
336*cdf0e10cSrcweir     xforms::Model* getModelImpl() const;
337*cdf0e10cSrcweir     xforms::Model* getModelImpl( const Model_t& xModel ) const;
338*cdf0e10cSrcweir 
339*cdf0e10cSrcweir     /// get MIP evaluation contexts
340*cdf0e10cSrcweir     /// (only valid if control has already been bound)
341*cdf0e10cSrcweir     std::vector<xforms::EvaluationContext> _getMIPEvaluationContexts() const;
342*cdf0e10cSrcweir 
343*cdf0e10cSrcweir     /// bind this binding, and pre-compute the affected nodes
344*cdf0e10cSrcweir     void bind( bool bForceRebind = false );
345*cdf0e10cSrcweir 
346*cdf0e10cSrcweir     /// the binding value has been changed:
347*cdf0e10cSrcweir     ///   trigger a modified event on all modified listeners
348*cdf0e10cSrcweir     void valueModified();
349*cdf0e10cSrcweir 
350*cdf0e10cSrcweir     /// the binding itself has changed:
351*cdf0e10cSrcweir     ///   force rebind, then call valueModified()
352*cdf0e10cSrcweir     void bindingModified();
353*cdf0e10cSrcweir 
354*cdf0e10cSrcweir 
355*cdf0e10cSrcweir     /// register the event listeners for
356*cdf0e10cSrcweir     void registerListeners();
357*cdf0e10cSrcweir 
358*cdf0e10cSrcweir     /// set MIPs defined by this binding on MIP item
359*cdf0e10cSrcweir     MIP getLocalMIP() const;
360*cdf0e10cSrcweir 
361*cdf0e10cSrcweir     /// get the data type that applies to this binding
362*cdf0e10cSrcweir     XDataType_t getDataType();
363*cdf0e10cSrcweir 
364*cdf0e10cSrcweir     /// determine whether binding is valid according to the given data type
365*cdf0e10cSrcweir     bool isValid_DataType();
366*cdf0e10cSrcweir 
367*cdf0e10cSrcweir     /// explain validity of binding with respect to the given data type
368*cdf0e10cSrcweir     rtl::OUString explainInvalid_DataType();
369*cdf0e10cSrcweir 
370*cdf0e10cSrcweir     /// 'clear' this binding - remove all listeners, etc.
371*cdf0e10cSrcweir     void clear();
372*cdf0e10cSrcweir 
373*cdf0e10cSrcweir 	/// distribute MIPs from current node recursively to childs
374*cdf0e10cSrcweir 	void distributeMIP( const XNode_t &rxNode );
375*cdf0e10cSrcweir 
376*cdf0e10cSrcweir     /// implement get*Namespaces()
377*cdf0e10cSrcweir     XNameContainer_t _getNamespaces() const;
378*cdf0e10cSrcweir 
379*cdf0e10cSrcweir     /// implement set*Namespaces()
380*cdf0e10cSrcweir     void _setNamespaces( const XNameContainer_t&, bool bBinding );
381*cdf0e10cSrcweir 
382*cdf0e10cSrcweir     /// set a useful default binding ID (if none is set)
383*cdf0e10cSrcweir     void _checkBindingID();
384*cdf0e10cSrcweir 
385*cdf0e10cSrcweir public:
386*cdf0e10cSrcweir     /// for debugging purposes only: get the MIPs defined by this binding
387*cdf0e10cSrcweir     const MIP* _getMIP();
388*cdf0e10cSrcweir 
389*cdf0e10cSrcweir 
390*cdf0e10cSrcweir 
391*cdf0e10cSrcweir 
392*cdf0e10cSrcweir 
393*cdf0e10cSrcweir     //
394*cdf0e10cSrcweir     // XValueBinding:
395*cdf0e10cSrcweir     //
396*cdf0e10cSrcweir 
397*cdf0e10cSrcweir public:
398*cdf0e10cSrcweir 
399*cdf0e10cSrcweir     virtual Sequence_Type_t SAL_CALL getSupportedValueTypes()
400*cdf0e10cSrcweir         throw( RuntimeException_t );
401*cdf0e10cSrcweir 
402*cdf0e10cSrcweir     virtual sal_Bool SAL_CALL supportsType( const Type_t& aType )
403*cdf0e10cSrcweir         throw( RuntimeException_t );
404*cdf0e10cSrcweir 
405*cdf0e10cSrcweir     virtual Any_t SAL_CALL getValue( const Type_t& aType )
406*cdf0e10cSrcweir         throw( IncompatibleTypesException_t,
407*cdf0e10cSrcweir                RuntimeException_t );
408*cdf0e10cSrcweir 
409*cdf0e10cSrcweir     virtual void SAL_CALL setValue( const Any_t& aValue )
410*cdf0e10cSrcweir         throw( IncompatibleTypesException_t,
411*cdf0e10cSrcweir                InvalidBindingStateException_t,
412*cdf0e10cSrcweir                NoSupportException_t,
413*cdf0e10cSrcweir                RuntimeException_t );
414*cdf0e10cSrcweir 
415*cdf0e10cSrcweir 
416*cdf0e10cSrcweir 
417*cdf0e10cSrcweir     //
418*cdf0e10cSrcweir     // XListEntry Source
419*cdf0e10cSrcweir     //
420*cdf0e10cSrcweir 
421*cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getListEntryCount()
422*cdf0e10cSrcweir         throw( RuntimeException_t );
423*cdf0e10cSrcweir 
424*cdf0e10cSrcweir     virtual rtl::OUString SAL_CALL getListEntry( sal_Int32 nPosition )
425*cdf0e10cSrcweir         throw( IndexOutOfBoundsException_t,
426*cdf0e10cSrcweir                RuntimeException_t );
427*cdf0e10cSrcweir 
428*cdf0e10cSrcweir     virtual StringSequence_t SAL_CALL getAllListEntries()
429*cdf0e10cSrcweir         throw( RuntimeException_t );
430*cdf0e10cSrcweir 
431*cdf0e10cSrcweir     virtual void SAL_CALL addListEntryListener( const XListEntryListener_t& )
432*cdf0e10cSrcweir         throw( NullPointerException_t,
433*cdf0e10cSrcweir                RuntimeException_t );
434*cdf0e10cSrcweir 
435*cdf0e10cSrcweir     virtual void SAL_CALL removeListEntryListener( const XListEntryListener_t&)
436*cdf0e10cSrcweir         throw( NullPointerException_t,
437*cdf0e10cSrcweir                RuntimeException_t );
438*cdf0e10cSrcweir 
439*cdf0e10cSrcweir 
440*cdf0e10cSrcweir 
441*cdf0e10cSrcweir     //
442*cdf0e10cSrcweir     // XValidator:
443*cdf0e10cSrcweir     //
444*cdf0e10cSrcweir 
445*cdf0e10cSrcweir     virtual sal_Bool SAL_CALL isValid(
446*cdf0e10cSrcweir         const Any_t& )
447*cdf0e10cSrcweir         throw( RuntimeException_t );
448*cdf0e10cSrcweir 
449*cdf0e10cSrcweir     virtual rtl::OUString SAL_CALL explainInvalid(
450*cdf0e10cSrcweir         const Any_t& )
451*cdf0e10cSrcweir         throw( RuntimeException_t );
452*cdf0e10cSrcweir 
453*cdf0e10cSrcweir     virtual void SAL_CALL addValidityConstraintListener(
454*cdf0e10cSrcweir         const XValidityConstraintListener_t& xListener )
455*cdf0e10cSrcweir         throw( NullPointerException_t,
456*cdf0e10cSrcweir                RuntimeException_t );
457*cdf0e10cSrcweir 
458*cdf0e10cSrcweir     virtual void SAL_CALL removeValidityConstraintListener(
459*cdf0e10cSrcweir         const XValidityConstraintListener_t& xListener )
460*cdf0e10cSrcweir         throw( NullPointerException_t,
461*cdf0e10cSrcweir                RuntimeException_t );
462*cdf0e10cSrcweir 
463*cdf0e10cSrcweir 
464*cdf0e10cSrcweir     //
465*cdf0e10cSrcweir     // XModifyBroadcaster & friends:
466*cdf0e10cSrcweir     //   inform listeners about changes in our values
467*cdf0e10cSrcweir     //
468*cdf0e10cSrcweir 
469*cdf0e10cSrcweir public:
470*cdf0e10cSrcweir 
471*cdf0e10cSrcweir     virtual void SAL_CALL addModifyListener(
472*cdf0e10cSrcweir         const XModifyListener_t& xListener )
473*cdf0e10cSrcweir         throw( RuntimeException_t );
474*cdf0e10cSrcweir 
475*cdf0e10cSrcweir     virtual void SAL_CALL removeModifyListener(
476*cdf0e10cSrcweir         const XModifyListener_t& xListener )
477*cdf0e10cSrcweir         throw( RuntimeException_t );
478*cdf0e10cSrcweir 
479*cdf0e10cSrcweir 
480*cdf0e10cSrcweir 
481*cdf0e10cSrcweir 
482*cdf0e10cSrcweir     //
483*cdf0e10cSrcweir     // XNamed:
484*cdf0e10cSrcweir     //   get/set name
485*cdf0e10cSrcweir     //
486*cdf0e10cSrcweir 
487*cdf0e10cSrcweir public:
488*cdf0e10cSrcweir 
489*cdf0e10cSrcweir     virtual rtl::OUString SAL_CALL getName()
490*cdf0e10cSrcweir         throw( RuntimeException_t );
491*cdf0e10cSrcweir 
492*cdf0e10cSrcweir     virtual void SAL_CALL setName( const rtl::OUString& )
493*cdf0e10cSrcweir         throw( RuntimeException_t );
494*cdf0e10cSrcweir 
495*cdf0e10cSrcweir 
496*cdf0e10cSrcweir 
497*cdf0e10cSrcweir     //
498*cdf0e10cSrcweir     // xml::dom::event::XEventListener
499*cdf0e10cSrcweir     //   receive an event if our node changed
500*cdf0e10cSrcweir     //
501*cdf0e10cSrcweir 
502*cdf0e10cSrcweir     virtual void SAL_CALL handleEvent(
503*cdf0e10cSrcweir         const XEvent_t& xEvent )
504*cdf0e10cSrcweir         throw( RuntimeException_t );
505*cdf0e10cSrcweir 
506*cdf0e10cSrcweir 
507*cdf0e10cSrcweir 
508*cdf0e10cSrcweir     //
509*cdf0e10cSrcweir     // XUnoTunnel
510*cdf0e10cSrcweir     //
511*cdf0e10cSrcweir 
512*cdf0e10cSrcweir     virtual sal_Int64 SAL_CALL getSomething( const IntSequence_t& )
513*cdf0e10cSrcweir         throw( RuntimeException_t );
514*cdf0e10cSrcweir 
515*cdf0e10cSrcweir 
516*cdf0e10cSrcweir     //
517*cdf0e10cSrcweir     // XCloneable
518*cdf0e10cSrcweir     //
519*cdf0e10cSrcweir 
520*cdf0e10cSrcweir     virtual XCloneable_t SAL_CALL createClone()
521*cdf0e10cSrcweir         throw( RuntimeException_t );
522*cdf0e10cSrcweir };
523*cdf0e10cSrcweir 
524*cdf0e10cSrcweir 
525*cdf0e10cSrcweir } // namespace xforms
526*cdf0e10cSrcweir 
527*cdf0e10cSrcweir #endif
528