private void UpdateView(WebPageInstantView instantView) { var processed = 0; PageBlock previousBlock = null; FrameworkElement previousElement = null; foreach (var block in instantView.PageBlocks) { var element = ProcessBlock(block); var spacing = SpacingBetweenBlocks(previousBlock, block); var padding = PaddingForBlock(block); if (element != null) { if (block is PageBlockChatLink && previousBlock is PageBlockCover) { if (previousElement is StackPanel stack && element is Button) { element.Style = Resources["CoverChannelBlockStyle"] as Style; element.Margin = new Thickness(padding, -40, padding, 0); stack.Children.Insert(1, element); } } else { element.Margin = new Thickness(padding, spacing, padding, 0); ScrollingHost.Items.Add(element); } } previousBlock = block; previousElement = element; processed++; } }
/// <summary> /// Generates a local url for the given page block. /// </summary> /// <param name="app">The application service</param> /// <param name="block">The block</param> /// <returns>The url</returns> public static string Url(this IApplicationService app, PageBlock block) { if (block != null) { return(Url(app, block.Body)); } return(""); }
public void Visit(PageBlock block, IDictionary <string, object> context) { var contents = block.GetAll <IHtmlContentComponent>().Select(c => c.Render(_request)); if (contents.Count() > 0) { _renderedBlocks[block.Uid] = contents; } }
private double PaddingForBlock(PageBlock block) { if (block is PageBlockCover || block is PageBlockPreformatted || block is PageBlockPhoto || block is PageBlockVideo || block is PageBlockSlideshow || block is PageBlockChatLink) { return(0.0); } return(_padding); }
public void Visit(PageBlock block, IDictionary <string, object> context) { var template = block.Get <ITemplateComponent>(); if (template != null) { _template = template; } var layout = block.Get <BlockLayoutComponent>(); AddBlockContentsToSlot(layout != null ? layout.Slot : "Default", block.Uid); }
public static PageBlockModel GetPageBlockModel(PageBlock block) { return block != null ? new PageBlockModel { Id = block.Id, IdBlockType = block.IdBlockType, IdPage = block.IdPage, Name = block.Name, Type = GetPageBlockTypeModel(block.Type), Page = GetPageModel(block.Page) } : null; }
public void SavePageInHelloWorldSite() { var page = _site.CreatePage("TestPages/" + Guid.NewGuid().ToString()); var mainContentBlock = new PageBlock(); mainContentBlock.AddComponent(new HtmlContentComponent { Contents = "<div> <strong>XD</strong> </div>" }); mainContentBlock.AddComponent(new SuperSimpleViewEngineTemplateComponent { TemplateLocation = Path.Combine(_dir, "Template.html") }); page.AddBlock(mainContentBlock); page.Save(); }
public void AddChildToIndex() { var page = _site.CreatePage("Index/" + Guid.NewGuid().ToString()); var mainContentBlock = new PageBlock(); mainContentBlock.AddComponent(new HtmlContentComponent { Contents = "<div> <strong>I'm a index child</strong> </div>" }); mainContentBlock.AddComponent(new SuperSimpleViewEngineTemplateComponent { TemplateLocation = Path.Combine(_dir, "Template.html") }); page.AddBlock(mainContentBlock); page.Save(); }
private PageBlock SavePageBlock(PageBlock pageBlock) { if (pageBlock.Id == 0) { db.Entry(pageBlock).State = EntityState.Added; } else if (pageBlock.Id > 0) { var pr = db.PageBlocks.FirstOrDefault(o => o.Id == pageBlock.Id); db.Entry(pr).CurrentValues.SetValues(pageBlock); } try { db.SaveChanges(); } catch (Exception e) { return(null); } return(pageBlock); }
/// <see cref="IEventRepository.SaveDescriptionSchema" /> public bool SaveDescriptionSchema(int id, PageBlock pageBlock, UserPageCategory cat, int eventId) { cat = SaveUserPageCategory(cat); var page = SavePage(pageBlock.Page); if (page == null) { return(false); } pageBlock.IdPage = page.Id; var pageblock = SavePageBlock(pageBlock); if (pageblock == null) { return(false); } var desc = db.EventDescriptions.FirstOrDefault(o => o.Id == id); if (desc == null) { desc = new EventDescription { IdType = 1, IdEvent = eventId }; db.Entry(desc).State = EntityState.Added; } desc.IdBlock = pageblock.Id; desc.IdUserPageCategory = cat?.Id; try { db.SaveChanges(); } catch (Exception e) { return(false); } return(true); }
public int Insert(PageBlock model) { return(af.Insert(model)); }
private FrameworkElement ProcessEmbedPost(PageBlockEmbeddedPost block) { var element = new StackPanel { Style = Resources["BlockEmbedPostStyle"] as Style }; var header = new Grid(); header.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) }); header.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) }); header.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Auto) }); header.ColumnDefinitions.Add(new ColumnDefinition()); header.Margin = new Thickness(_padding, 0, 0, 0); var photo = block.AuthorPhoto; if (photo != null) { var ellipse = new Ellipse(); ellipse.Width = 36; ellipse.Height = 36; ellipse.Margin = new Thickness(0, 0, _padding, 0); ellipse.Fill = new ImageBrush { ImageSource = (ImageSource)DefaultPhotoConverter.Convert(photo, true), Stretch = Stretch.UniformToFill, AlignmentX = AlignmentX.Center, AlignmentY = AlignmentY.Center }; Grid.SetRowSpan(ellipse, 2); header.Children.Add(ellipse); } var textAuthor = new TextBlock(); textAuthor.Text = block.Author; textAuthor.VerticalAlignment = VerticalAlignment.Bottom; Grid.SetColumn(textAuthor, 1); Grid.SetRow(textAuthor, 0); var textDate = new TextBlock(); textDate.Text = BindConvert.Current.DateTime(block.Date).ToString("dd MMMM yyyy"); textDate.VerticalAlignment = VerticalAlignment.Top; textDate.Style = (Style)Resources["CaptionTextBlockStyle"]; textDate.Foreground = (SolidColorBrush)Resources["SystemControlDisabledChromeDisabledLowBrush"]; Grid.SetColumn(textDate, 1); Grid.SetRow(textDate, 1); header.Children.Add(textAuthor); header.Children.Add(textDate); element.Children.Add(header); PageBlock previousBlock = null; FrameworkElement previousElement = null; foreach (var subBlock in block.PageBlocks) { var subLayout = ProcessBlock(subBlock); var spacing = SpacingBetweenBlocks(previousBlock, block); if (subLayout != null) { subLayout.Margin = new Thickness(_padding, spacing, _padding, 0); element.Children.Add(subLayout); } previousBlock = block; previousElement = subLayout; } return(element); }
private FrameworkElement ProcessText(PageBlock block, bool caption) { RichText text = null; switch (block) { case PageBlockTitle title: text = title.Title; break; case PageBlockSubtitle subtitle: text = subtitle.Subtitle; break; case PageBlockHeader header: text = header.Header; break; case PageBlockSubheader subheader: text = subheader.Subheader; break; case PageBlockFooter footer: text = footer.Footer; break; case PageBlockParagraph paragraphz: text = paragraphz.Text; break; case PageBlockPreformatted preformatted: text = preformatted.Text; break; case PageBlockPhoto photo: text = photo.Caption; break; case PageBlockVideo video: text = video.Caption; break; case PageBlockSlideshow slideshow: text = slideshow.Caption; break; case PageBlockEmbedded embed: text = embed.Caption; break; case PageBlockEmbeddedPost embedPost: text = embedPost.Caption; break; case PageBlockBlockQuote blockquote: text = caption ? blockquote.Caption : blockquote.Text; break; case PageBlockPullQuote pullquote: text = caption ? pullquote.Caption : pullquote.Text; break; } if (text == null || text is RichTextPlain plain && string.IsNullOrEmpty(plain.Text)) { return(null); } var textBlock = new RichTextBlock(); var span = new Span(); var paragraph = new Paragraph(); paragraph.Inlines.Add(span); textBlock.Blocks.Add(paragraph); textBlock.TextWrapping = TextWrapping.Wrap; //textBlock.Margin = new Thickness(12, 0, 12, 12); ProcessRichText(text, span); switch (block) { case PageBlockTitle title: textBlock.FontSize = 28; textBlock.FontFamily = new FontFamily("Times New Roman"); //textBlock.TextLineBounds = TextLineBounds.TrimToBaseline; break; case PageBlockSubtitle subtitle: textBlock.FontSize = 17; //textBlock.FontFamily = new FontFamily("Times New Roman"); //textBlock.TextLineBounds = TextLineBounds.TrimToBaseline; break; case PageBlockHeader header: textBlock.FontSize = 24; textBlock.FontFamily = new FontFamily("Times New Roman"); //textBlock.TextLineBounds = TextLineBounds.TrimToBaseline; break; case PageBlockSubheader subheader: textBlock.FontSize = 19; textBlock.FontFamily = new FontFamily("Times New Roman"); //textBlock.TextLineBounds = TextLineBounds.TrimToBaseline; break; case PageBlockParagraph paragraphz: textBlock.FontSize = 17; break; case PageBlockPreformatted preformatted: textBlock.FontSize = 16; break; case PageBlockFooter footer: textBlock.FontSize = 15; textBlock.Foreground = (SolidColorBrush)Resources["SystemControlDisabledChromeDisabledLowBrush"]; //textBlock.TextAlignment = TextAlignment.Center; break; case PageBlockPhoto photo: case PageBlockVideo video: textBlock.FontSize = 15; textBlock.Foreground = (SolidColorBrush)Resources["SystemControlDisabledChromeDisabledLowBrush"]; textBlock.TextAlignment = TextAlignment.Center; break; case PageBlockSlideshow slideshow: case PageBlockEmbedded embed: case PageBlockEmbeddedPost embedPost: textBlock.FontSize = 15; textBlock.Foreground = (SolidColorBrush)Resources["SystemControlDisabledChromeDisabledLowBrush"]; //textBlock.TextAlignment = TextAlignment.Center; break; case PageBlockBlockQuote blockquote: textBlock.FontSize = caption ? 15 : 17; if (caption) { textBlock.Foreground = (SolidColorBrush)Resources["SystemControlDisabledChromeDisabledLowBrush"]; textBlock.Margin = new Thickness(0, 12, 0, 0); } break; case PageBlockPullQuote pullquote: textBlock.FontSize = caption ? 15 : 17; if (caption) { textBlock.Foreground = (SolidColorBrush)Resources["SystemControlDisabledChromeDisabledLowBrush"]; } else { textBlock.FontFamily = new FontFamily("Times New Roman"); //textBlock.TextLineBounds = TextLineBounds.TrimToBaseline; textBlock.TextAlignment = TextAlignment.Center; } break; } return(textBlock); }
private FrameworkElement ProcessBlock(PageBlock block) { switch (block) { case PageBlockCover cover: return(ProcessCover(cover)); case PageBlockAuthorDate authorDate: return(ProcessAuthorDate(authorDate)); case PageBlockHeader header: case PageBlockSubheader subheader: case PageBlockTitle title: case PageBlockSubtitle subtitle: case PageBlockFooter footer: case PageBlockParagraph paragraph: return(ProcessText(block, false)); case PageBlockBlockQuote blockquote: return(ProcessBlockquote(blockquote)); case PageBlockDivider divider: return(ProcessDivider(divider)); case PageBlockPhoto photo: return(ProcessPhoto(photo)); case PageBlockList list: return(ProcessList(list)); case PageBlockVideo video: return(ProcessVideo(video)); case PageBlockAnimation animation: return(ProcessAnimation(animation)); case PageBlockEmbeddedPost embedPost: return(ProcessEmbedPost(embedPost)); case PageBlockSlideshow slideshow: return(ProcessSlideshow(slideshow)); case PageBlockCollage collage: return(ProcessCollage(collage)); case PageBlockEmbedded embed: return(ProcessEmbed(embed)); case PageBlockPullQuote pullquote: return(ProcessPullquote(pullquote)); case PageBlockAnchor anchor: return(ProcessAnchor(anchor)); case PageBlockPreformatted preformatted: return(ProcessPreformatted(preformatted)); case PageBlockChatLink channel: return(ProcessChannel(channel)); } return(null); }
public void AddBlock(PageBlock block) { LoadBlocksIfNotLoaded(); _blocks.Add(block); }
public void RemoveBlock(PageBlock block) { LoadBlocksIfNotLoaded(); _blocks.Remove(block); }
private static GalleryContent CountBlock(IProtoService protoService, WebPageInstantView webPage, PageBlock pageBlock) { if (pageBlock is PageBlockPhoto photoBlock) { return(new GalleryPhoto(protoService, photoBlock.Photo, photoBlock.Caption.ToPlainText())); } else if (pageBlock is PageBlockVideo videoBlock) { return(new GalleryVideo(protoService, videoBlock.Video, videoBlock.Caption.ToPlainText())); } else if (pageBlock is PageBlockAnimation animationBlock) { return(new GalleryAnimation(protoService, animationBlock.Animation, animationBlock.Caption.ToPlainText())); } return(null); }
/// <summary> /// Saves the given page model /// </summary> /// <param name="model">The page model</param> /// <param name="isDraft">If the model should be saved as a draft</param> private async Task <IEnumerable <Guid> > Save <T>(T model, bool isDraft) where T : Models.PageBase { var type = App.PageTypes.GetById(model.TypeId); var affected = new List <Guid>(); var isNew = false; var lastModified = DateTime.MinValue; if (type != null) { IQueryable <Page> pageQuery = _db.Pages; if (isDraft) { pageQuery = pageQuery.AsNoTracking(); } // FirstOrDefaultAsync(p => p.Id ... pageQuery = pageQuery.OrderBy(p => p.Id); var page = await pageQuery .Include(p => p.Permissions) .Include(p => p.Blocks).ThenInclude(b => b.Block).ThenInclude(b => b.Fields) .Include(p => p.Fields) .AsSplitQuery() .FirstOrDefaultAsync(p => p.Id == model.Id) .ConfigureAwait(false); if (page == null) { isNew = true; } else { lastModified = page.LastModified; } if (model.OriginalPageId.HasValue) { var originalPageIsCopy = (await _db.Pages.AsNoTracking().FirstOrDefaultAsync(p => p.Id == model.OriginalPageId).ConfigureAwait(false))?.OriginalPageId.HasValue ?? false; if (originalPageIsCopy) { throw new InvalidOperationException("Can not set copy of a copy"); } var originalPageType = (await _db.Pages.AsNoTracking().FirstOrDefaultAsync(p => p.Id == model.OriginalPageId).ConfigureAwait(false))?.PageTypeId; if (originalPageType != model.TypeId) { throw new InvalidOperationException("Copy can not have a different content type"); } // Transform the model if (page == null) { page = new Page() { Id = model.Id != Guid.Empty ? model.Id : Guid.NewGuid(), Created = DateTime.Now, }; if (!isDraft) { await _db.Pages.AddAsync(page).ConfigureAwait(false); // Make room for the new page var dest = await _db.Pages.Where(p => p.SiteId == model.SiteId && p.ParentId == model.ParentId).ToListAsync().ConfigureAwait(false); affected.AddRange(MovePages(dest, page.Id, model.SiteId, model.SortOrder, true)); } } else { // Check if the page has been moved if (!isDraft && (page.ParentId != model.ParentId || page.SortOrder != model.SortOrder)) { var source = await _db.Pages.Where(p => p.SiteId == page.SiteId && p.ParentId == page.ParentId && p.Id != model.Id).ToListAsync().ConfigureAwait(false); var dest = page.ParentId == model.ParentId ? source : await _db.Pages.Where(p => p.SiteId == model.SiteId && p.ParentId == model.ParentId).ToListAsync().ConfigureAwait(false); // Remove the old position for the page affected.AddRange(MovePages(source, page.Id, page.SiteId, page.SortOrder + 1, false)); // Add room for the new position of the page affected.AddRange(MovePages(dest, page.Id, model.SiteId, model.SortOrder, true)); } } if (!isDraft && (isNew || page.Title != model.Title || page.NavigationTitle != model.NavigationTitle)) { // If this is new page or title has been updated it means // the global sitemap changes. Notify the service. affected.Add(page.Id); } page.ContentType = type.IsArchive ? "Blog" : "Page"; page.PageTypeId = model.TypeId; page.OriginalPageId = model.OriginalPageId; page.SiteId = model.SiteId; page.Title = model.Title; page.NavigationTitle = model.NavigationTitle; page.Slug = model.Slug; page.ParentId = model.ParentId; page.SortOrder = model.SortOrder; page.IsHidden = model.IsHidden; page.Route = model.Route; page.Published = model.Published; page.LastModified = DateTime.Now; page.Permissions.Clear(); foreach (var permission in model.Permissions) { page.Permissions.Add(new PagePermission { PageId = page.Id, Permission = permission }); } if (!isDraft) { await _db.SaveChangesAsync().ConfigureAwait(false); } else { var draft = await _db.PageRevisions .FirstOrDefaultAsync(r => r.PageId == page.Id && r.Created > lastModified) .ConfigureAwait(false); if (draft == null) { draft = new PageRevision { Id = Guid.NewGuid(), PageId = page.Id }; await _db.PageRevisions .AddAsync(draft) .ConfigureAwait(false); } draft.Data = JsonConvert.SerializeObject(page); draft.Created = page.LastModified; await _db.SaveChangesAsync().ConfigureAwait(false); } return(affected); } // Transform the model if (page == null) { page = new Page { Id = model.Id != Guid.Empty ? model.Id : Guid.NewGuid(), ParentId = model.ParentId, SortOrder = model.SortOrder, PageTypeId = model.TypeId, Created = DateTime.Now, LastModified = DateTime.Now }; model.Id = page.Id; if (!isDraft) { await _db.Pages.AddAsync(page).ConfigureAwait(false); // Make room for the new page var dest = await _db.Pages.Where(p => p.SiteId == model.SiteId && p.ParentId == model.ParentId).ToListAsync().ConfigureAwait(false); affected.AddRange(MovePages(dest, page.Id, model.SiteId, model.SortOrder, true)); } } else { // Check if the page has been moved if (!isDraft && (page.ParentId != model.ParentId || page.SortOrder != model.SortOrder)) { var source = await _db.Pages.Where(p => p.SiteId == page.SiteId && p.ParentId == page.ParentId && p.Id != model.Id).ToListAsync().ConfigureAwait(false); var dest = page.ParentId == model.ParentId ? source : await _db.Pages.Where(p => p.SiteId == model.SiteId && p.ParentId == model.ParentId).ToListAsync().ConfigureAwait(false); // Remove the old position for the page affected.AddRange(MovePages(source, page.Id, page.SiteId, page.SortOrder + 1, false)); // Add room for the new position of the page affected.AddRange(MovePages(dest, page.Id, model.SiteId, model.SortOrder, true)); } page.LastModified = DateTime.Now; } if (isNew || page.Title != model.Title || page.NavigationTitle != model.NavigationTitle) { // If this is new page or title has been updated it means // the global sitemap changes. Notify the service. affected.Add(page.Id); } page = _contentService.Transform <T>(model, type, page); page.ContentType = type.IsArchive ? "Blog" : "Page"; // Set if comments should be enabled page.EnableComments = model.EnableComments; page.CloseCommentsAfterDays = model.CloseCommentsAfterDays; // Update permissions page.Permissions.Clear(); foreach (var permission in model.Permissions) { page.Permissions.Add(new PagePermission { PageId = page.Id, Permission = permission }); } // Make sure foreign key is set for fields if (!isDraft) { foreach (var field in page.Fields) { if (field.PageId == Guid.Empty) { field.PageId = page.Id; await _db.PageFields.AddAsync(field).ConfigureAwait(false); } } } // Transform blocks var blockModels = model.Blocks; if (blockModels != null) { var blocks = _contentService.TransformBlocks(blockModels); var current = blocks.Select(b => b.Id).ToArray(); // Delete removed blocks var removed = page.Blocks .Where(b => !current.Contains(b.BlockId) && !b.Block.IsReusable && b.Block.ParentId == null) .Select(b => b.Block); var removedItems = page.Blocks .Where(b => !current.Contains(b.BlockId) && b.Block.ParentId != null && removed.Select(p => p.Id).ToList().Contains(b.Block.ParentId.Value)) .Select(b => b.Block); if (!isDraft) { _db.Blocks.RemoveRange(removed); _db.Blocks.RemoveRange(removedItems); } // Delete the old page blocks page.Blocks.Clear(); // Now map the new block for (var n = 0; n < blocks.Count; n++) { IQueryable <Block> blockQuery = _db.Blocks; if (isDraft) { blockQuery = blockQuery.AsNoTracking(); } var block = await blockQuery .Include(b => b.Fields) .FirstOrDefaultAsync(b => b.Id == blocks[n].Id) .ConfigureAwait(false); if (block == null) { block = new Block { Id = blocks[n].Id != Guid.Empty ? blocks[n].Id : Guid.NewGuid(), Created = DateTime.Now }; if (!isDraft) { await _db.Blocks.AddAsync(block).ConfigureAwait(false); } } block.ParentId = blocks[n].ParentId; block.CLRType = blocks[n].CLRType; block.IsReusable = blocks[n].IsReusable; block.Title = blocks[n].Title; block.LastModified = DateTime.Now; var currentFields = blocks[n].Fields.Select(f => f.FieldId).Distinct(); var removedFields = block.Fields.Where(f => !currentFields.Contains(f.FieldId)); if (!isDraft) { _db.BlockFields.RemoveRange(removedFields); } foreach (var newField in blocks[n].Fields) { var field = block.Fields.FirstOrDefault(f => f.FieldId == newField.FieldId); if (field == null) { field = new BlockField { Id = newField.Id != Guid.Empty ? newField.Id : Guid.NewGuid(), BlockId = block.Id, FieldId = newField.FieldId }; if (!isDraft) { await _db.BlockFields.AddAsync(field).ConfigureAwait(false); } block.Fields.Add(field); } field.SortOrder = newField.SortOrder; field.CLRType = newField.CLRType; field.Value = newField.Value; } // Create the page block var pageBlock = new PageBlock { Id = Guid.NewGuid(), BlockId = block.Id, Block = block, PageId = page.Id, SortOrder = n }; if (!isDraft) { await _db.PageBlocks.AddAsync(pageBlock).ConfigureAwait(false); } page.Blocks.Add(pageBlock); } } if (!isDraft) { await _db.SaveChangesAsync().ConfigureAwait(false); } else { var draft = await _db.PageRevisions .FirstOrDefaultAsync(r => r.PageId == page.Id && r.Created > lastModified) .ConfigureAwait(false); if (draft == null) { draft = new PageRevision { Id = Guid.NewGuid(), PageId = page.Id }; await _db.PageRevisions .AddAsync(draft) .ConfigureAwait(false); } draft.Data = JsonConvert.SerializeObject(page); draft.Created = page.LastModified; await _db.SaveChangesAsync().ConfigureAwait(false); } } return(affected); }
public void Update(PageBlock model) { af.Update(model); }
/// <summary> /// Generates an absolute url for the given page block. /// </summary> /// <param name="app">The application service</param> /// <param name="block">The block</param> /// <returns>The url</returns> public static string AbsoluteUrl(this IApplicationService app, PageBlock block) { return($"{ AbsoluteUrlStart(app) }{ Url(app, block) }"); }
private double SpacingBetweenBlocks(PageBlock upper, PageBlock lower) { if (lower is PageBlockCover || lower is PageBlockChatLink) { return(0); } return(12); if (lower is PageBlockCover || lower is PageBlockChatLink) { return(0); } else if (lower is PageBlockDivider || upper is PageBlockDivider) { return(15); // 25; } else if (lower is PageBlockBlockQuote || upper is PageBlockBlockQuote || lower is PageBlockPullQuote || upper is PageBlockPullQuote) { return(17); // 27; } else if (lower is PageBlockTitle) { return(12); // 20; } else if (lower is PageBlockAuthorDate) { if (upper is PageBlockTitle) { return(16); // 26; } else { return(12); // 20; } } else if (lower is PageBlockParagraph) { if (upper is PageBlockTitle || upper is PageBlockAuthorDate) { return(20); // 34; } else if (upper is PageBlockHeader || upper is PageBlockSubheader) { return(15); // 25; } else if (upper is PageBlockParagraph) { return(15); // 25; } else if (upper is PageBlockList) { return(19); // 31; } else if (upper is PageBlockPreformatted) { return(11); // 19; } else { return(12); // 20; } } else if (lower is PageBlockList) { if (upper is PageBlockTitle || upper is PageBlockAuthorDate) { return(20); // 34; } else if (upper is PageBlockHeader || upper is PageBlockSubheader) { return(19); // 31; } else if (upper is PageBlockParagraph || upper is PageBlockList) { return(19); // 31; } else if (upper is PageBlockPreformatted) { return(11); // 19; } else { return(12); // 20; } } else if (lower is PageBlockPreformatted) { if (upper is PageBlockParagraph) { return(11); // 19; } else { return(12); // 20; } } else if (lower is PageBlockHeader) { return(20); // 32; } else if (lower is PageBlockSubheader) { return(20); // 32; } else if (lower == null) { if (upper is PageBlockFooter) { return(14); // 24; } else { return(14); // 24; } } return(12); // 20; }