/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
// forward declarations namespace xforms
{ class Model; class EvaluationContext;
} namespace com::sun::star { namespace xml { namespace dom
{ class XNode; class XNodeList;
}
} namespace container { class XNameContainer; } namespace xforms { class XModel; } namespace xsd { class XDataType; }
}
namespace xforms
{
/** An XForms Binding. Contains: * # a connection to its model * # an ID * # a binding expression * # model item properties * # (NOT YET IMPLEMENTED) child bindings (sequence of) * * See http://www.w3.org/TR/xforms/ for more information.
*/
/// nodes on which we are listening for events
std::vector<css::uno::Reference<css::xml::dom::XNode> > maEventNodes;
/// the current MIP object for the first node we are bound to
MIP maMIP;
/// flag to detect recursions in calculate bool mbInCalculate;
// flags to manage deferred notifications: /// if >0, valueModified() and bindingModified() will only set flags
sal_Int32 mnDeferModifyNotifications; bool mbValueModified; /// if true, valueModified needs to be called bool mbBindingModified; /// if true, bindingModified needs to be called
void initializePropertySet();
public:
Binding(); virtual ~Binding() override;
// property methods: get/set value
/// get the model implementation
css::uno::Reference<css::xforms::XModel> getModel() const; /// get XForms model void _setModel( const rtl::Reference<Model>& ); /// set XForms model (only called by Model)
OUString getModelID() const; /// get ID of XForms model
OUString getBindingID() const { return msBindingID;} /// get ID for this binding void setBindingID( const OUString& ); /// set ID for this binding
OUString getBindingExpression() const; /// get binding expression void setBindingExpression( const OUString& ); /// set binding exp.
// MIPs (model item properties)
OUString getReadonlyExpression() const; /// get read-only MIP void setReadonlyExpression( const OUString& ); /// set read-only MIP
OUString getRelevantExpression() const; /// get relevant MIP void setRelevantExpression( const OUString& ); /// set relevant MIP
OUString getRequiredExpression() const; /// get required MIP void setRequiredExpression( const OUString& ); /// set required MIP
OUString getConstraintExpression() const; /// get constraint MIP void setConstraintExpression( const OUString& );/// set constraint MIP
OUString getCalculateExpression() const; /// get calculate MIP void setCalculateExpression( const OUString& ); /// set calculate MIP
OUString getType() const { return msTypeName;} /// get type name MIP (static) void setType( const OUString& ); /// set type name MIP (static)
// a binding expression can only be interpreted with respect to // suitable namespace declarations. We collect those in the model and in a binding.
// access to a binding's namespace // (set-method only changes local namespaces (but may add to model))
css::uno::Reference<css::container::XNameContainer> getBindingNamespaces() const { return mxNamespaces; } void setBindingNamespaces( const css::uno::Reference<css::container::XNameContainer>& ); /// get binding nmsp.
// access to the model's namespaces // (set-method changes model's namespaces (unless a local one is present))
css::uno::Reference<css::container::XNameContainer> getModelNamespaces() const; /// set model namespaces void setModelNamespaces( const css::uno::Reference<css::container::XNameContainer>& ); /// get model nmsp.
// read-only properties that map MIPs to control data source properties bool getReadOnly() const; // MIP readonly bool getRelevant() const; // MIP relevant bool getExternalData() const; // mapped from model's ExternalData property
/// get this binding's context node
xforms::EvaluationContext getEvaluationContext() const;
/// get evaluation contexts for this binding's MIPs
std::vector<xforms::EvaluationContext> getMIPEvaluationContexts();
/// get nodeset the bind is bound to
css::uno::Reference<css::xml::dom::XNodeList> getXNodeList();
/// heuristically determine whether this binding is simple binding /// (here: simple binding == does not depend on other parts of the /// instance, it's not a 'dynamic' binding) bool isSimpleBinding() const;
/// heuristically determine whether this binding's binding /// expression is simple bool isSimpleBindingExpression() const;
/// update this binding (e.g. called by model for refresh ) void update();
/// prevent change notifications being sent to controls void deferNotifications( bool );
/// is this binding valid? (are constraint, type and required MIPs ok?) bool isValid() const;
/// determine whether this binding currently performs a useful /// function, r whether is may be discarded bool isUseful() const;
/// explain why binding is invalid
OUString explainInvalid();
// the ID for XUnoTunnel calls static css::uno::Sequence<sal_Int8> getUnoTunnelId();
private: /// check whether object is live, and throw suitable exception if not /// (to be used be API methods before acting on the object) /// /// @throws css::uno::RuntimeException void checkLive();
/// determine whether object is live /// live: has model, and model has been initialized bool isLive() const;
/// get MIP evaluation contexts /// (only valid if control has already been bound)
std::vector<xforms::EvaluationContext> _getMIPEvaluationContexts() const;
/// bind this binding, and pre-compute the affected nodes void bind( bool bForceRebind = false );
/// the binding value has been changed: /// trigger a modified event on all modified listeners void valueModified();
/// the binding itself has changed: /// force rebind, then call valueModified() void bindingModified();
/// set MIPs defined by this binding on MIP item
MIP getLocalMIP() const;
/// get the data type that applies to this binding
css::uno::Reference<css::xsd::XDataType> getDataType() const;
/// determine whether binding is valid according to the given data type bool isValid_DataType() const;
/// explain validity of binding with respect to the given data type
OUString explainInvalid_DataType();
/// 'clear' this binding - remove all listeners, etc. void clear();
/// distribute MIPs from current node recursively to children void distributeMIP( const css::uno::Reference<css::xml::dom::XNode> &rxNode );
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.