Пример #1
0
 protected virtual void OnDataBound(PDFDataContext context)
 {
     if (null != this.DataBound)
     {
         this.DataBound(this, new PDFDataBindEventArgs(context));
     }
 }
Пример #2
0
        public static object EvaluateValueExpression(XPathExpression expr, PDFDataContext context)
        {
            throw new NotSupportedException("No Longer using the XPathDataHelper");

            //if (null == expr)
            //    throw new ArgumentNullException("expr");
            //if (null == context)
            //    throw new ArgumentNullException("context");
            //if (false == context.DataStack.HasData)
            //    throw new ArgumentOutOfRangeException("context.DataStack.Current");
            //if (null == context.DataStack.Current)
            //    throw new ArgumentNullException("context.DataStack.Current");

            //object currentData = context.DataStack.Pop();
            //object result = null;



            //try
            //{
            //    //Need the current data to be an XPathNavigator
            //    System.Xml.XPath.XPathNavigator navigator;
            //    if (currentData is System.Xml.XPath.XPathNavigator)
            //    {
            //        navigator = currentData as System.Xml.XPath.XPathNavigator;
            //    }
            //    else if (currentData is System.Xml.XPath.IXPathNavigable)
            //    {
            //        System.Xml.XPath.IXPathNavigable nav = (System.Xml.XPath.IXPathNavigable)currentData;
            //        navigator = nav.CreateNavigator();
            //    }
            //    else
            //        throw new InvalidCastException(Errors.DatabindingSourceNotXPath);

            //    // For position() and data context relative functions we also need to provide the
            //    // iterator the current XPathNavigator we extracted from if available.

            //    System.Xml.XPath.XPathNodeIterator parentItterator;

            //    if (context.DataStack.HasData && context.DataStack.Current is System.Xml.XPath.XPathNodeIterator)
            //        parentItterator = context.DataStack.Current as System.Xml.XPath.XPathNodeIterator;
            //    else
            //        parentItterator = null;

            //    if (null != context.NamespaceResolver)
            //        expr.SetContext(context.NamespaceResolver);

            //    result = navigator.Evaluate(expr, parentItterator);
            //}
            //finally
            //{
            //    //make sure we put the stack back to the original state.

            //    context.DataStack.Push(currentData, null);
            //}

            //return result;
        }
Пример #3
0
 public PDFTemplateItemDataBoundArgs(IPDFComponent item, PDFDataContext context)
 {
     this._item    = item;
     this._context = context;
 }
Пример #4
0
 protected virtual void DoDataBind(PDFDataContext context)
 {
 }
Пример #5
0
        //
        // Binding
        //

        #region IPDFBindableComponent Members


        /// <summary>
        /// Databinds this outline
        /// </summary>
        /// <param name="context"></param>
        public void DataBind(PDFDataContext context)
        {
            this.OnDataBinding(context);
            this.DoDataBind(context);
            this.OnDataBound(context);
        }
Пример #6
0
        /// <summary>
        /// Returns the required binding data based upon the specified parameters or null if there is no required source.
        /// </summary>
        /// <param name="datasourceComponent">The Component in the document that implements the IPDFDataSource interface.
        /// Set it to null to ignore this parameter.
        /// If it is set, and so is the select path, then this path will be used
        /// by the IPDFDataSource to extract the required source.
        /// </param>
        /// <param name="datasourcevalue">The value of the data source.
        /// If not null then the value will be returned unless a select path is set.
        /// If the select path is set then this value must be IXPathNavigable and the returned value will be the result of a select on the navigator</param>
        /// <param name="stack">If neither the Component or value are set, then the current data from the stack will be
        /// used (if and only if theres is a select path). If there is no select path then null will be returned.
        /// If there is a select path then the current data must implement IXPathNavigable</param>
        /// <param name="selectpath">The path to  use to extract values</param>
        /// <returns>The required data or null.</returns>
        public static object GetBindingData(IPDFDataSource datasourceComponent, object datasourcevalue, string selectpath, PDFDataContext context)
        {
            throw new NotSupportedException("No Longer using the XPathDataHelper");

            //object data = null;

            //try
            //{

            //    if (null != datasourceComponent)
            //    {
            //        data = datasourceComponent.Select(selectpath, context);
            //    }
            //    else if (datasourcevalue != null)
            //    {
            //        if (!string.IsNullOrEmpty(selectpath))
            //        {
            //            if (datasourcevalue is System.Xml.XPath.IXPathNavigable)
            //            {
            //                System.Xml.XPath.XPathNavigator nav = ((System.Xml.XPath.IXPathNavigable)data).CreateNavigator();
            //                System.Xml.XPath.XPathNodeIterator itter = nav.Select(selectpath, context.NamespaceResolver);

            //                data = itter;
            //            }
            //            else
            //                new ArgumentException(Errors.DatabindingSourceNotXPath, "selectpath");
            //        }
            //        else
            //            data = datasourcevalue;
            //    }
            //    else if (!string.IsNullOrEmpty(selectpath))
            //    {
            //        data = context.DataStack.Current;
            //        if (null == data || !(data is System.Xml.XPath.IXPathNavigable))
            //            new ArgumentException(Errors.DatabindingSourceNotXPath, "stack.Current");
            //        data = ((System.Xml.XPath.IXPathNavigable)data).CreateNavigator().Select(selectpath, context.NamespaceResolver);
            //    }
            //}
            //catch (Exception ex)
            //{
            //    throw new PDFException("Could not get the binding data for expression '" + selectpath + "'", ex);
            //}

            //return data;
        }
Пример #7
0
        public static bool EvaluateTestExpression(System.Xml.XPath.XPathExpression expr, PDFDataContext context)
        {
            throw new NotSupportedException("No Longer using the XPathDataHelper");

            //object value = EvaluateValueExpression(expr, context);

            //if (null == value)
            //    return false;
            //else if (value is bool)
            //    return (bool)value;
            //else
            //    return false;
        }
Пример #8
0
 /// <summary>
 /// Creates a new instance of the PDFDataBindEventArgs
 /// </summary>
 /// <param name="context"></param>
 public PDFDataBindEventArgs(PDFDataContext context)
 {
     this._context = context;
 }