Ejemplo n.º 1
0
 public Task WriteTextAsync(string text, string reference, DocumentInstructionContextV1 context)
 {
     _pageXmlTextWriter.WriteStartElement("span");
     _pageXmlTextWriter.WriteString(text);
     _pageXmlTextWriter.WriteEndElement();
     return(Task.CompletedTask);
 }
Ejemplo n.º 2
0
 private void AppendIndentation(DocumentInstructionContextV1 context)
 {
     foreach (var listItemIndex in context.ListItemIndexPath)
     {
         _stringBuilder.Append("\t");
     }
 }
Ejemplo n.º 3
0
        public Task BeginWriteListAsync(int startIndex, DocumentInstructionContextV1 context)
        {
            _pageXmlTextWriter.WriteStartElement("ol");
            _pageXmlTextWriter.WriteAttributeString("start", (startIndex + 1).ToString());

            return(Task.CompletedTask);
        }
        public Task BeginWriteBlockAsync(DocumentInstructionContextV1 context)
        {
            FlushText();

            if (!context.IsFirstChild)
            {
                WriteParagraphBreak();
            }

            return(Task.CompletedTask);
        }
Ejemplo n.º 5
0
        private void AppendListIndex(DocumentInstructionContextV1 context)
        {
            AppendIndentation(context);

            foreach (var listItemIndex in context.ListItemIndexPath)
            {
                _stringBuilder.Append((listItemIndex + 1) + ".");
            }

            _stringBuilder.Append(" ");
        }
Ejemplo n.º 6
0
        public Task BeginWriteDocumentAsync(DocumentRenderModel model, DocumentInstructionContextV1 context)
        {
            if (_isRendering || _isComplete)
            {
                throw new InvalidOperationException("Document writing already started");
            }

            _isRendering = true;

            return(Task.CompletedTask);
        }
Ejemplo n.º 7
0
        public Task BeginWriteListItemAsync(ListIndexPath path, DocumentInstructionContextV1 context)
        {
            if (!context.IsFirstChild)
            {
                BeginParagraph();
            }

            AppendListIndex(context);

            return(Task.CompletedTask);
        }
Ejemplo n.º 8
0
        public Task BeginWritePageAsync(DocumentInstructionContextV1 context)
        {
            _pageStringWriter              = new StringWriter();
            _pageXmlTextWriter             = new XmlTextWriter(_pageStringWriter);
            _pageXmlTextWriter.Formatting  = Formatting.Indented;
            _pageXmlTextWriter.Indentation = 4;

            _pageXmlTextWriter.WriteStartElement("div");
            WriteClass("page");

            return(Task.CompletedTask);
        }
Ejemplo n.º 9
0
        public Task EndWriteDocumentAsync(DocumentInstructionContextV1 context)
        {
            if (!_isRendering || _isComplete)
            {
                throw new InvalidOperationException("Document writing has not started");
            }

            _isRendering = false;
            _isComplete  = true;

            return(Task.CompletedTask);
        }
Ejemplo n.º 10
0
        public Task BeginWriteSignatureAreaAsync(string signatoryId, DocumentInstructionContextV1 context)
        {
            _pageXmlTextWriter.WriteStartElement("div");
            WriteClass("signature");

            if (!string.IsNullOrEmpty(signatoryId))
            {
                _pageXmlTextWriter.WriteAttributeString("data-signatory-id", signatoryId);
            }

            return(Task.CompletedTask);
        }
Ejemplo n.º 11
0
        public Task BeginWritePageAsync(DocumentInstructionContextV1 context)
        {
            if (!context.IsFirstChild)
            {
                Debug.Assert(context.Previous == "page");
                BeginParagraph();
            }

            _pageLocations.Add(_lineCount);

            return(Task.CompletedTask);
        }
Ejemplo n.º 12
0
        public Task BeginWriteListAsync(int startIndex, DocumentInstructionContextV1 context)
        {
            if (!context.IsFirstChild || context.Parent == "list-item")
            {
                BeginParagraph();
            }
            else
            {
                AppendIndentation(context);
            }

            return(Task.CompletedTask);
        }
        public Task BeginWriteListItemAsync(ListIndexPath path, DocumentInstructionContextV1 context)
        {
            DebugAssertTextFlushed(); // List cannot contain text elements

            if (!context.IsFirstChild)
            {
                WriteParagraphBreak();
            }

            _instructions.Add(new BeginWriteListItemInstruction(path));

            return(Task.CompletedTask);
        }
        public Task BeginWriteListAsync(int startIndex, DocumentInstructionContextV1 context)
        {
            FlushText();

            if (!context.IsFirstChild)
            {
                WriteParagraphBreak();
            }

            _instructions.Add(new BeginWriteListInstruction());

            return(Task.CompletedTask);
        }
Ejemplo n.º 15
0
        public Task BeginWriteListItemAsync(ListIndexPath path, DocumentInstructionContextV1 context)
        {
            _pageXmlTextWriter.WriteStartElement("li");

            _pageXmlTextWriter.WriteStartElement("div");
            WriteClass("label");
            _pageXmlTextWriter.WriteString(path.Format());
            _pageXmlTextWriter.WriteFullEndElement();

            _pageXmlTextWriter.WriteStartElement("div");
            WriteClass("content");

            return(Task.CompletedTask);
        }
Ejemplo n.º 16
0
        public Task BeginWriteBlockAsync(DocumentInstructionContextV1 context)
        {
            _pageXmlTextWriter.WriteStartElement("div");

            var cssClassValue = "block";

            if (!context.HasContent)
            {
                cssClassValue += " empty";
            }
            WriteClass(cssClassValue);

            return(Task.CompletedTask);
        }
Ejemplo n.º 17
0
        public Task EndWritePageAsync(DocumentInstructionContextV1 context)
        {
            _pageXmlTextWriter.WriteFullEndElement();;

            _pages.Add(_pageStringWriter.ToString());

            _pageXmlTextWriter.Dispose();
            _pageStringWriter.Dispose();

            _pageXmlTextWriter = null;
            _pageStringWriter  = null;

            return(Task.CompletedTask);
        }
Ejemplo n.º 18
0
        public Task BeginWriteBlockAsync(DocumentInstructionContextV1 context)
        {
            if (!context.IsFirstChild)
            {
                BeginParagraph();

                if (context.Parent == "list-item")
                {
                    AppendIndentation(context);
                }
            }

            return(Task.CompletedTask);
        }
Ejemplo n.º 19
0
        public Task WriteTextAsync(string text, string expression, DocumentInstructionContextV1 context)
        {
            if (IsParagraphElement(context.Previous))
            {
                BeginParagraph();
            }

            //if (context.Parent == "list-item" && !context.IsFirstChild)
            //{
            //    AppendIndentation(context);
            //}

            _stringBuilder.Append(text);

            return(Task.CompletedTask);
        }
        public Task WriteTextAsync(string text, string reference, DocumentInstructionContextV1 context)
        {
            if (IsBlockElement(context.Previous))
            {
                // Text should flow to new paragraph if it follows a block element.
                WriteParagraphBreak();
            }

            if (string.IsNullOrEmpty(reference))
            {
                _pendingText.Add(text);
            }
            else
            {
                // If this is from a reference, then we want to generate an instruction which contains only this reference.
                FlushText();
                _instructions.Add(new WriteTextInstruction(text, reference, _currentConditionals.AsEnumerable()));
            }

            return(Task.CompletedTask);
        }
 public Task BeginConditionalAsync(string expression, DocumentInstructionContextV1 context)
 {
     FlushText();
     _currentConditionals.Push(expression);
     return(Task.CompletedTask);
 }
 public Task EndCondititionalAsync(DocumentInstructionContextV1 context)
 {
     FlushText();
     _currentConditionals.Pop();
     return(Task.CompletedTask);
 }
Ejemplo n.º 23
0
 public Task EndWriteSignatureAreaAsync(DocumentInstructionContextV1 context)
 {
     return(Task.CompletedTask);
 }
Ejemplo n.º 24
0
 public Task BeginWriteSignatureAreaAsync(string signatoryId, DocumentInstructionContextV1 context)
 {
     return(Task.CompletedTask);
 }
 public Task BeginWritePageAsync(DocumentInstructionContextV1 context)
 {
     DebugAssertTextFlushed();
     _instructions.Add(new BeginWritePageInstruction());
     return(Task.CompletedTask);
 }
 public Task EndWritePageAsync(DocumentInstructionContextV1 context)
 {
     FlushText();
     _instructions.Add(new EndWritePageInstruction());
     return(Task.CompletedTask);
 }
Ejemplo n.º 27
0
 public Task BeginConditionalAsync(string expression, DocumentInstructionContextV1 context)
 {
     return(Task.CompletedTask);
 }
Ejemplo n.º 28
0
 public Task EndCondititionalAsync(DocumentInstructionContextV1 context)
 {
     return(Task.CompletedTask);
 }
Ejemplo n.º 29
0
 public Task EndWriteBlockAsync(DocumentInstructionContextV1 context)
 {
     return(Task.CompletedTask);
 }
 public Task EndWriteListAsync(DocumentInstructionContextV1 context)
 {
     DebugAssertTextFlushed(); // List cannot contain text elements
     _instructions.Add(new EndWriteListInstruction());
     return(Task.CompletedTask);
 }