/* -*- 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 com::sun::star
{ namespace xml::dom { class XDocument; } namespace xml::dom { class XNode; } namespace beans { class XPropertySet; } namespace container { class XNameContainer; }
} namespace xforms
{ class BindingCollection; class SubmissionCollection; class InstanceCollection; class EvaluationContext; class ODataTypeRepository;
}
namespace xforms
{
/** An XForms Model. Contains: * # (set of) instance data (XML DOM tree) * # (set of) bindings * # (set of) submissions * # (NOT YET IMPLEMENTED) actions (set of) * * See http://www.w3.org/TR/xforms/ for more information.
*/ typedef cppu::ImplInheritanceHelper<
PropertySetBase,
css::xforms::XModel2,
css::xforms::XFormsUIHelper1,
css::util::XUpdatable,
css::lang::XServiceInfo
> Model_t; class Model : public Model_t
{ // a number of local typedefs, to make the remaining header readable typedef css::uno::Reference<css::xml::dom::XNode> XNode_t; typedef css::uno::Reference<css::beans::XPropertySet> XPropertySet_t;
OUString msID; /// the model ID
rtl::Reference<BindingCollection> mxBindings; /// the bindings
rtl::Reference<SubmissionCollection> mxSubmissions; /// the submissions
rtl::Reference<InstanceCollection> mxInstances; /// the instance(s)
rtl::Reference<ODataTypeRepository> mxDataTypes; /// the XSD data-types used
css::uno::Reference<css::xml::dom::XDocument> mxForeignSchema; /// the XSD-schema part we cannot /// map onto data types
OUString msSchemaRef; /// xforms:model/@schema attribute
css::uno::Reference<css::container::XNameContainer> mxNamespaces; /// namespaces for entire model
MIPs_t maMIPs; /// map nodes to their MIPs
bool mbInitialized; /// has model been initialized ? bool mbExternalData; /// is the data of this model to be considered an integral part of the document?
void initializePropertySet();
void ensureAtLeastOneInstance();
public:
/// create a new model with an empty, default instance
Model(); virtual ~Model() noexcept override;
xforms::EvaluationContext getEvaluationContext();
// get/set that part of the schema, that we can't interpret as data types
css::uno::Reference<css::xml::dom::XDocument> getForeignSchema() const { return mxForeignSchema;} void setForeignSchema( const css::uno::Reference<css::xml::dom::XDocument>& );
// register MIPs which apply to a given node; only to be called by bindings // (The pTag parameter serves only to be able to remove the MIPs // that were added using the same tag. No functions will be // performed on it; hence the void* type.) void addMIP( void* pTag, const XNode_t&, const MIP& ); void removeMIPs( voidconst * pTag );
/// query which MIPs apply to the given node
MIP queryMIP( const XNode_t& xNode ) const;
/// re-bind all bindings void rebind();
/// call defer notifications on all bindings void deferNotifications( bool );
/// set a data value in the instance /// (also defers notifications) bool setSimpleContent( const XNode_t&, const OUString& );
// XFormsUIHelper1 & friends: // (implementation in model_ui.cxx)
/// determine a reasonable control service for a given node /// (based on data type MIP assigned to the node) virtual OUString SAL_CALL getDefaultServiceNameForNode( const css::uno::Reference<css::xml::dom::XNode>& xNode ) override;
/// determine a reasonable default binding expression for a given node /// and a given evaluation context /// @returns expression, or empty string if no expression could be derived
OUString getDefaultBindingExpressionForNode( const XNode_t&, const EvaluationContext& );
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 und die Messung sind noch experimentell.