From 46b4370cda2a90f719e366242810a607b01161a1 Mon Sep 17 00:00:00 2001 From: Vladimir Glazounov Date: Wed, 23 Mar 2005 10:36:36 +0000 Subject: INTEGRATION: CWS eforms4 (1.2.6); FILE MERGED 2004/12/15 11:03:17 dvo 1.2.6.1: #i35397# use model namespaces (when possible) Issue number: Submitted by: Reviewed by: --- forms/source/xforms/computedexpression.cxx | 42 +++++++++--------------------- forms/source/xforms/computedexpression.hxx | 7 ++--- forms/source/xforms/evaluationcontext.hxx | 12 ++++++--- 3 files changed, 23 insertions(+), 38 deletions(-) (limited to 'forms') diff --git a/forms/source/xforms/computedexpression.cxx b/forms/source/xforms/computedexpression.cxx index 1f34967658ca..58e94c55d41d 100644 --- a/forms/source/xforms/computedexpression.cxx +++ b/forms/source/xforms/computedexpression.cxx @@ -2,9 +2,9 @@ * * $RCSfile: computedexpression.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: obo $ $Date: 2004-11-16 10:49:37 $ + * last change: $Author: vg $ $Date: 2005-03-23 11:35:02 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -102,7 +102,6 @@ namespace xforms ComputedExpression::ComputedExpression() : msExpression(), - mxNamespaces( new NameContainer() ), mbIsEmpty( true ), mbIsSimple( true ), mxResult() @@ -129,23 +128,6 @@ void ComputedExpression::setExpression( const OUString& rExpression ) } -Reference ComputedExpression::getNamespaces() const -{ - return mxNamespaces; -} - -void ComputedExpression::setNamespaces( - const Reference& xNamespaces ) -{ - OSL_ENSURE( xNamespaces.is(), "need namespaces" ); - OSL_ENSURE( xNamespaces->getElementType() == - getCppuType( static_cast( NULL ) ), - "namespaces must be string container" ); - - mxNamespaces = xNamespaces; -} - - bool ComputedExpression::_checkExpression( const sal_Char* pExpression ) const { OSL_ENSURE( pExpression != NULL, "no expression?" ); @@ -272,16 +254,18 @@ Reference ComputedExpression::_getXPathAPI(const xforms::EvaluationCo xXPath->registerExtensionInstance(aExtension); // register namespaces - OSL_ENSURE( mxNamespaces.is(), "no namespaces!" ); - Sequence aPrefixes = mxNamespaces->getElementNames(); - sal_Int32 nCount = aPrefixes.getLength(); - const OUString* pPrefixes = aPrefixes.getConstArray(); - for( sal_Int32 i = 0; i < nCount; i++ ) + if( aContext.mxNamespaces.is() ) { - const OUString* pNamePrefix = &pPrefixes[i]; - OUString sNameURL; - mxNamespaces->getByName( *pNamePrefix ) >>= sNameURL; - xXPath->registerNS( *pNamePrefix, sNameURL ); + Sequence aPrefixes =aContext.mxNamespaces->getElementNames(); + sal_Int32 nCount = aPrefixes.getLength(); + const OUString* pPrefixes = aPrefixes.getConstArray(); + for( sal_Int32 i = 0; i < nCount; i++ ) + { + const OUString* pNamePrefix = &pPrefixes[i]; + OUString sNameURL; + aContext.mxNamespaces->getByName( *pNamePrefix ) >>= sNameURL; + xXPath->registerNS( *pNamePrefix, sNameURL ); + } } // done, so return xXPath-object diff --git a/forms/source/xforms/computedexpression.hxx b/forms/source/xforms/computedexpression.hxx index fe180c9f51e1..397d64a5be0b 100644 --- a/forms/source/xforms/computedexpression.hxx +++ b/forms/source/xforms/computedexpression.hxx @@ -2,9 +2,9 @@ * * $RCSfile: computedexpression.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: obo $ $Date: 2004-11-16 10:49:51 $ + * last change: $Author: vg $ $Date: 2005-03-23 11:35:16 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -95,9 +95,6 @@ class ComputedExpression /// the expression string rtl::OUString msExpression; - /// the namespaces that are used to interpret the expression string - com::sun::star::uno::Reference mxNamespaces; - /// is msExpression empty? bool mbIsEmpty; diff --git a/forms/source/xforms/evaluationcontext.hxx b/forms/source/xforms/evaluationcontext.hxx index f7e3af28dd36..a1609ffe3660 100644 --- a/forms/source/xforms/evaluationcontext.hxx +++ b/forms/source/xforms/evaluationcontext.hxx @@ -2,9 +2,9 @@ * * $RCSfile: evaluationcontext.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: obo $ $Date: 2004-11-16 10:52:39 $ + * last change: $Author: vg $ $Date: 2005-03-23 11:36:36 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -63,6 +63,7 @@ #define _EVALUATIONCONTEXT_HXX #include +#include #include namespace xforms @@ -76,6 +77,7 @@ public: EvaluationContext() : mxContextNode(), mxModel(), + mxNamespaces(), mnContextPosition( 0 ), mnContextSize( 0 ) { } @@ -83,18 +85,20 @@ public: EvaluationContext( const com::sun::star::uno::Reference& xContextNode, const com::sun::star::uno::Reference& xModel, + const com::sun::star::uno::Reference& xNamespaces, sal_Int32 nPosition, sal_Int32 nSize ) : mxContextNode( xContextNode ), mxModel( xModel ), + mxNamespaces( xNamespaces ), mnContextPosition( nPosition ), mnContextSize( nSize ) { } com::sun::star::uno::Reference mxContextNode; com::sun::star::uno::Reference mxModel; - // ??? - // com::sun::star::uno::Reference mxContextNode; + com::sun::star::uno::Reference mxNamespaces; + sal_Int32 mnContextPosition; sal_Int32 mnContextSize; }; -- cgit