/// <summary>
        /// return the root formatting object
        /// </summary>
        /// <param name="regionId"></param>
        /// <param name="tick"></param>
        /// <returns></returns>
        public override FormattingObject GetFormattingObject(TimeCode tick)
        {
            // if there is no body. then empty regions would be pruned
            // see 9.3.3.  part 5. map each non-empty region element to
            // an fo:block-container element...
            if (m_body == null)
            {
                return(null);
            }
            if (!m_body.TemporallyActive(tick))
            {
                return(null);
            }

            #region create single root and flow for the document.
            var root = new Formatting.Root(this);
            var flow = new Formatting.Flow(null);
            flow.Parent = root;
            root.Children.Add(flow);
            #endregion

            #region add a block container to the flow for each temporally active region
            foreach (var region in Regions.Values)
            {
                if (region.TemporallyActive(tick))
                {
                    var blockContainer = region.GetFormattingObject(tick);
                    #region apply animations on regions
                    foreach (var child in region.Children)
                    {
                        if (child is SetElement)
                        {
                            var fo = ((child as SetElement).GetFormattingObject(tick));
                            if (fo is Animation)
                            {
                                blockContainer.Animations.Add(fo as Animation);
                            }
                        }
                    }
                    #endregion

                    blockContainer.Parent = flow;
                    flow.Children.Add(blockContainer);

                    #region create a new subtree for the body element
                    /// select it into this region by adding its children
                    /// to block container
                    var block = m_body.GetFormattingObject(tick);
                    if (block != null)
                    {
                        block.Prune(region.Id);  // deselect any content not for this region
                        if (block.Children.Count > 0)
                        {
                            if (block.Children[0].Children.Count > 0)
                            {
                                blockContainer.Children.Add(block);
                                block.Parent = blockContainer;
                            }
                        }
                    }
                    #endregion
                }
            }
            #endregion
            return(root);
        }
        /// <summary>
        /// return the root formatting object
        /// </summary>
        /// <param name="regionId"></param>
        /// <param name="tick"></param>
        /// <returns></returns>
        public override FormattingObject GetFormattingObject(TimeCode tick)
        {
            // if there is no body. then empty regions would be pruned
            // see 9.3.3.  part 5. map each non-empty region element to 
            // an fo:block-container element...
            if (m_body == null) return null;
            if (!m_body.TemporallyActive(tick)) return null;

            #region create single root and flow for the document.
            var root = new Formatting.Root(this);
            var flow = new Formatting.Flow(null);
            flow.Parent = root;
            root.Children.Add(flow);
            #endregion

            #region add a block container to the flow for each temporally active region
            foreach (var region in Regions.Values)
            {
                if (region.TemporallyActive(tick))
                {
                    var blockContainer = region.GetFormattingObject(tick);
                    #region apply animations on regions
                    foreach (var child in region.Children)
                    {
                        if (child is SetElement)
                        {
                            var fo = ((child as SetElement).GetFormattingObject(tick));
                            if (fo is Animation)
                            {
                                blockContainer.Animations.Add(fo as Animation);
                            }
                        }
                    }
                    #endregion

                    blockContainer.Parent = flow;
                    flow.Children.Add(blockContainer);

                    #region create a new subtree for the body element
                    /// select it into this region by adding its children 
                    /// to block container
                    var block = m_body.GetFormattingObject(tick);
                    if (block != null)
                    {
                        block.Prune(region.Id);  // deselect any content not for this region
                        if (block.Children.Count > 0)
                        {
                            if (block.Children[0].Children.Count > 0)
                            {
                                blockContainer.Children.Add(block);
                                block.Parent = blockContainer;
                            }
                        }
                    }
                    #endregion
                }
            }
            #endregion
            return root;
        }