/// ------------------------------------------------------------------------------------ /// <summary> /// Creates and returns the primary view construtor for the main view in the layout. /// This is only called once. /// </summary> /// <param name="div"></param> /// <returns>The view constructor to be used for the main view</returns> /// ------------------------------------------------------------------------------------ public override IVwViewConstructor MakeMainVc(DivisionLayoutMgr div) { BtPrintLayoutSideBySideVc vc = new BtPrintLayoutSideBySideVc( TeStVc.LayoutViewTarget.targetPrint, div.FilterInstance, m_styleSheet, m_fdoCache, m_ws); vc.HeightEstimator = this; return vc; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Makes a call to MakeSubordinateView, to add a view containing footnotes. /// </summary> /// <param name="div">The PrintLayout manager object</param> /// ------------------------------------------------------------------------------------ public override void ConfigureSubordinateViews(DivisionLayoutMgr div) { int hvoScripture = m_fdoCache.LangProject.TranslatedScriptureOA.Hvo; BtFootnotePrintLayoutSideBySideVc footnoteVc = new BtFootnotePrintLayoutSideBySideVc( TeStVc.LayoutViewTarget.targetPrint, div.FilterInstance, m_styleSheet, m_fdoCache, m_ws); NLevelOwnerSvd ownerSvd = new NLevelOwnerSvd(2, new ScrBookFilterDecorator(m_fdoCache, m_bookFilterInstance), hvoScripture); div.AddSubordinateStream(hvoScripture, (int)FootnoteFrags.kfrScripture, footnoteVc, ownerSvd); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Creates and returns the primary view construtor for the main view in the layout. /// This is only called once. /// </summary> /// <param name="div"></param> /// <returns>The view constructor to be used for the main view</returns> /// ------------------------------------------------------------------------------------ public virtual IVwViewConstructor MakeMainVc(DivisionLayoutMgr div) { DraftViewVc vc; if (m_divisionPortion == PrintLayoutPortion.TitleAndIntro) { vc = new ScriptureBookIntroVc(TeStVc.LayoutViewTarget.targetPrint, div.FilterInstance, m_styleSheet, false); } else if (m_divisionPortion == PrintLayoutPortion.ScriptureSections) { vc = new ScriptureBodyVc(TeStVc.LayoutViewTarget.targetPrint, div.FilterInstance, m_styleSheet, false); } else { vc = new DraftViewVc(TeStVc.LayoutViewTarget.targetPrint, div.FilterInstance, m_styleSheet, false); } vc.HeightEstimator = this; if ((m_viewType & TeViewType.BackTranslation) != 0) { vc.ContentType = Options.UseInterlinearBackTranslation ? StVc.ContentTypes.kctSegmentBT : StVc.ContentTypes.kctSimpleBT; vc.DefaultWs = m_ws; } vc.Cache = m_fdoCache; vc.PrintLayout = true; return vc; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Creates and returns the primary view construtor for the main view in the layout. /// This is only called once. /// </summary> /// <returns>The view constructor to be used for the main view</returns> /// <param name="div"></param> /// ------------------------------------------------------------------------------------ public override IVwViewConstructor MakeMainVc(DivisionLayoutMgr div) { return new DummyMainLazyViewVc(m_fdoCache, m_fAddContent); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Adds a page element, representing a layout stream in a particular location on the /// page. /// </summary> /// <param name="division">The division</param> /// <param name="stream">The stream (rootbox) which supplies data for this element</param> /// <param name="fPageElementOwnsStream"><c>true</c> if this element is responsible for /// closing its stream when it is destoyed</param> /// <param name="locationOnPage">Location where this stream is laid out, in printer /// pixels, relative to the top left of the physical page</param> /// <param name="dypOffsetToTopOfDataOnPage">Offset in stream to top of data being shown /// on this page, in printer pixels</param> /// <param name="fMainStream"><c>true</c> if this element is for a "main" stream; /// <c>false</c> if it's for a subordinate stream or a Header/Footer stream</param> /// <param name="currentColumn">The current column (1-based).</param> /// <param name="totalColumns">The total columns in the specified stream.</param> /// <param name="columnGap">The gap between the columns.</param> /// <param name="columnHeight">The height of the current column.</param> /// <param name="dypOverlapWithPreviousElement"></param> /// <param name="isRightToLeft">if set to <c>true</c> the stream is right-to-left. /// Otherwise, it is left-to-right.</param> /// <param name="fReducesFreeSpaceFromTop">Flag indicating whether additoin of this /// element reduces the free space from top or bottom.</param> /// ------------------------------------------------------------------------------------ internal protected void AddPageElement(DivisionLayoutMgr division, IVwLayoutStream stream, bool fPageElementOwnsStream, Rectangle locationOnPage, int dypOffsetToTopOfDataOnPage, bool fMainStream, int currentColumn, int totalColumns, int columnGap, int columnHeight, int dypOverlapWithPreviousElement, bool isRightToLeft, bool fReducesFreeSpaceFromTop) { CheckDisposed(); PageElement newElement = new PageElement(division, stream, fPageElementOwnsStream, locationOnPage, dypOffsetToTopOfDataOnPage, fMainStream, currentColumn, totalColumns, columnGap, columnHeight, dypOverlapWithPreviousElement, isRightToLeft); InsertPageElement(newElement); AdjustFreeSpace(locationOnPage, fReducesFreeSpaceFromTop, newElement); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Gets the last element. /// </summary> /// <param name="division">The division.</param> /// <param name="xd">[out] the outer edge of the page element (i.e. 0 for right-to- /// left or right position for left-to-right); except that if this page overlaps /// the next, it will be an xd that belongs to a line on this page.</param> /// <returns>The last page element that displays <paramref name="division"/> on this /// page, or <c>null</c> if no page element displays <paramref name="division"/>.</returns> /// ------------------------------------------------------------------------------------ protected PageElement GetLastElement(DivisionLayoutMgr division, out int xd) { xd = 0; PageElement lastMainElement = null; Point ptEndOfStream = new Point(0, 0); // Find (one of) the bottom-most page elements. foreach (PageElement pe in m_pageElements) { if (pe.m_fMainStream) // Don't care about footnote or H/F streams { if (lastMainElement == null) { lastMainElement = pe; continue; } // If the top of the current element is below the bottom of lastMainElement, // we need to set the current element to the lastMainElement. if (pe.LocationOnPage.Top >= lastMainElement.LocationOnPage.Bottom) lastMainElement = pe; } } if (lastMainElement == null) // TE-6345 return null; // Find the division for the current lastMainElement, if have not set it yet. if (division.MainLayoutStream != lastMainElement.m_stream) { foreach (DivisionLayoutMgr div in PubControl.Divisions) { if (div.MainLayoutStream == lastMainElement.m_stream) division = div; } } // If the lastMainElement is one of two or more columns... if (lastMainElement.m_totalColumns > 1) { // We need to compare it with other page elements that are columns in case // they are closer to the end of the page (i.e. on the trailing edge). // Now, make sure that the bottom element we have selected is on the most-trailing // edge of the page. foreach (PageElement pe in m_pageElements) { if (pe != lastMainElement && pe.m_stream == division.MainLayoutStream) { Debug.Assert(pe.LocationOnPage.Top == lastMainElement.LocationOnPage.Top, "A column page element in the same division should have the same top as other columns."); Debug.Assert(pe.m_totalColumns > 1, "Page element should be one of at least two columns"); // The page element is in the last division. Now determine if it is on the trailing edge. if (TowardsTrailingEdge(pe, lastMainElement, division.MainStreamIsRightToLeft)) { // We found a column which is closer to the trailing edge. // Update the last element to this page element. lastMainElement = pe; } } } } xd = division.MainStreamIsRightToLeft ? 0 : lastMainElement.LocationOnPage.Right; // See if we need to adjust xd so it is on a line on this page. if (lastMainElement.m_stream != lastMainElement.Division.MainLayoutStream) return lastMainElement; // only main streams have overlap PublicationControl pub = PubControl; if (pub == null) return lastMainElement; // can't check further Page nextPage = pub.PageAfter(this); if (nextPage == null) return lastMainElement; // can't be in overlap, no more pages. PageElement peNext = nextPage.GetFirstElementForStream(lastMainElement.m_stream); if (peNext == null || peNext.OverlapWithPreviousElement == 0) return lastMainElement; // no more elements in stream, or no overlap int yd = lastMainElement.OffsetToTopPageBoundary + lastMainElement.ColumnHeight - 1; // If it's NOT in the next element's part of the overlap, it should be in this one's! xd = peNext.XNotInOurPartOfOverlap(xd, yd, division.MainStreamIsRightToLeft); return lastMainElement; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Makes a call to MakeSubordinateView, to add a view containing footnotes. /// </summary> /// <param name="div">The PrintLayout manager object</param> /// ------------------------------------------------------------------------------------ public override void ConfigureSubordinateViews(DivisionLayoutMgr div) { int hvoScripture = m_fdoCache.LangProject.TranslatedScriptureOAHvo; BtFootnotePrintLayoutSideBySideVc footnoteVc = new BtFootnotePrintLayoutSideBySideVc( TeStVc.LayoutViewTarget.targetPrint, div.FilterInstance, m_styleSheet, m_fdoCache, m_ws); NLevelOwnerSvd ownerSvd = new NLevelOwnerSvd(2, m_fdoCache.MainCacheAccessor, hvoScripture); IVwVirtualHandler vh = FilteredScrBooks.GetFilterInstance(m_fdoCache, div.FilterInstance); if (vh != null) { ownerSvd.AddTagLookup((int)Scripture.ScriptureTags.kflidScriptureBooks, vh.Tag); } div.AddSubordinateStream(hvoScripture, (int)FootnoteFrags.kfrScripture, footnoteVc, ownerSvd); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Find index of the given page. This is broken out as a method in case /// we decide to change to a linked list or something more complex. /// </summary> /// <param name="div"></param> /// <returns></returns> /// ------------------------------------------------------------------------------------ public int IndexOfDiv(DivisionLayoutMgr div) { CheckDisposed(); return m_divisions.IndexOf(div); }
protected int CreatePagesForDiv(DivisionLayoutMgr div, int iDiv, int spaceLeftFromPrevDiv) { lock (m_pages) { int pageNumber = m_pages.Count + 1; Debug.WriteLine(string.Format("Creating page {0} for division {1}, spaceLeftFromPrevDiv={2}", pageNumber, iDiv, spaceLeftFromPrevDiv)); int dxpLayoutWidth = div.AvailableMainStreamColumWidthInPrinterPixels; int dypHeightOfDiv = div.EstimateHeight(dxpLayoutWidth); // If a division wants to start on a new page or if it doesn't share the // (footnote) substream then we have to start at the top of the new page. // REVIEW (EberhardB): This might not work if we have any other kind of // substream. if (div.StartAt != DivisionStartOption.Continuous || div.HasOwnedSubStreams) spaceLeftFromPrevDiv = 0; int dypLayoutHeight = div.AvailablePageHeightInPrinterPixels; int numberOfPages = PagesPerDiv(dypHeightOfDiv - spaceLeftFromPrevDiv, dypLayoutHeight); Debug.WriteLine(string.Format("dxpLayoutWidth={0}, dypHeightOfDiv={1}", dxpLayoutWidth, dypHeightOfDiv)); Debug.WriteLine(string.Format("spaceLeftFromPrevDiv={0}, dypLayoutHeight={1}", spaceLeftFromPrevDiv, dypLayoutHeight)); Debug.WriteLine(string.Format("numberOfPages={0}", numberOfPages)); Debug.WriteLine(string.Format("div.TopMargin={0}, div.BottomMargin={1}", div.TopMarginInPrinterPixels, div.BottomMarginInPrinterPixels)); for (int i = 0; i < numberOfPages; i++) m_pages.Add(CreatePage(this, iDiv, spaceLeftFromPrevDiv + i * dypLayoutHeight, pageNumber++, div.TopMarginInPrinterPixels, div.BottomMarginInPrinterPixels)); return SpaceLeftOnLastPageForDiv(dypHeightOfDiv, dypLayoutHeight); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Makes a call to MakeSubordinateView, to add a views containing footnotes. /// </summary> /// <param name="div">The division layout manager</param> /// ------------------------------------------------------------------------------------ public virtual void ConfigureSubordinateViews(DivisionLayoutMgr div) { int hvoScr = m_fdoCache.LangProject.TranslatedScriptureOA.Hvo; if (m_sharedStream == null) { div.AddSubordinateStream(hvoScr, DummyFirstSubViewVc.kfragScrFootnotes, new DummyFirstSubViewVc(), new NLevelOwnerSvd(2, m_fdoCache.MainCacheAccessor, hvoScr)); } else { int hvoRoot; IVwViewConstructor vc; int frag; IVwStylesheet stylesheet; ((IVwRootBox)m_sharedStream).GetRootObject(out hvoRoot, out vc, out frag, out stylesheet); div.AddSharedSubordinateStream(m_sharedStream, vc, new NLevelOwnerSvd(2, m_fdoCache.MainCacheAccessor, hvoScr)); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Creates and returns the primary view construtor for the main view in the layout. /// This is only called once. /// </summary> /// <returns>The view constructor to be used for the main view</returns> /// ------------------------------------------------------------------------------------ public virtual IVwViewConstructor MakeMainVc(DivisionLayoutMgr div) { StVc vc = new StVc(); vc.Cache = m_fdoCache; return vc; }
///// <summary>type of width for this page element across the page</summary> //internal readonly PageElementWidthType m_widthType; #endregion #region Constructor /// ------------------------------------------------------------------------------------ /// <summary> /// Constructor /// </summary> /// <param name="division">The division.</param> /// <param name="stream">The stream.</param> /// <param name="fPageElementOwnsStream">if set to <c>true</c> the page element owns /// the stream.</param> /// <param name="locationOnPage">The location on page.</param> /// <param name="dypOffsetToTopOfDataOnPage">The dyp offset to top of data on page.</param> /// <param name="fMainStream">set to <c>true</c> if <paramref name="stream"/> is the /// main stream of <paramref name="division"/>, otherwise <c>false</c>.</param> /// <param name="columnNumber">The column number of the page element (1-based)</param> /// <param name="totalColumns">The total number of columns on the page for this stream.</param> /// <param name="columnGap">The gap between the columns, which is used if there are two /// or more columns.</param> /// <param name="columnHeight">The height of the current column.</param> /// <param name="dypOverlapWithPreviousElement"></param> /// <param name="fInRightToLeftStream">if set to <c>true</c> the page element is in a /// right-to-left stream.</param> /// ------------------------------------------------------------------------------------ public PageElement(DivisionLayoutMgr division, IVwLayoutStream stream, bool fPageElementOwnsStream, Rectangle locationOnPage, int dypOffsetToTopOfDataOnPage, bool fMainStream, int columnNumber, int totalColumns, int columnGap, int columnHeight, int dypOverlapWithPreviousElement, bool fInRightToLeftStream) { m_division = division; m_stream = stream; m_fPageElementOwnsStream = fPageElementOwnsStream; m_locationOnPage = locationOnPage; m_dypOffsetToTopOfDataOnPage = dypOffsetToTopOfDataOnPage; m_fMainStream = fMainStream; m_column = columnNumber; m_totalColumns = totalColumns; m_fInRightToLeftStream = fInRightToLeftStream; m_columnGap = columnGap; m_columnHeight = columnHeight; m_dypOverlapWithPreviousElement = dypOverlapWithPreviousElement; }
/// ------------------------------------------------------------------------------------ /// <summary> /// No subordinate views for this dummy configurer. /// </summary> /// <param name="div">The division layout manager</param> /// ------------------------------------------------------------------------------------ public override void ConfigureSubordinateViews(DivisionLayoutMgr div) { }
/// -------------------------------------------------------------------------------- /// <summary> /// Calls the get last element. /// </summary> /// <param name="division">The division.</param> /// <param name="xd">The xd.</param> /// <returns></returns> /// -------------------------------------------------------------------------------- public PageElement CallGetLastElement(DivisionLayoutMgr division, out int xd) { return GetLastElement(division, out xd); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Makes a call to MakeSubordinateView, to add a view containing footnotes. /// </summary> /// <param name="div">The division layout manager</param> /// ------------------------------------------------------------------------------------ public virtual void ConfigureSubordinateViews(DivisionLayoutMgr div) { int hvoScripture = m_fdoCache.LangProject.TranslatedScriptureOA.Hvo; ISilDataAccess decorator; if (m_divisionPortion != PrintLayoutPortion.AllContent) decorator = new PrintLayoutDataByFlidDecorator(m_fdoCache, m_bookFilterInstance, m_divisionPortion == PrintLayoutPortion.TitleAndIntro); else decorator = new ScrBookFilterDecorator(m_fdoCache, m_bookFilterInstance); NLevelOwnerSvd ownerSvd = new NLevelOwnerSvd(2, decorator, hvoScripture); if (m_sharedStream == null) { FootnoteVc footnoteVc = new FootnoteVc(TeStVc.LayoutViewTarget.targetPrint, div.FilterInstance); footnoteVc.DefaultWs = DefaultWs; footnoteVc.Cache = m_fdoCache; footnoteVc.DisplayTranslation = (m_viewType & TeViewType.BackTranslation) != 0; div.AddSubordinateStream(hvoScripture, (int)FootnoteFrags.kfrScripture, footnoteVc, ownerSvd); } else { int hvoRoot; IVwViewConstructor vc; int frag; IVwStylesheet stylesheet; ((IVwRootBox)m_sharedStream).GetRootObject(out hvoRoot, out vc, out frag, out stylesheet); div.AddSharedSubordinateStream(m_sharedStream, vc, ownerSvd); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="T:TeDummyPublication"/> class. /// </summary> /// <param name="pub">The pub.</param> /// <param name="div">The div.</param> /// <param name="printDateTime">The print date time.</param> /// ------------------------------------------------------------------------------------ public TeDummyPublication(Publication pub, DivisionLayoutMgr div, DateTime printDateTime) : base(pub, div, printDateTime) { }
/// ------------------------------------------------------------------------------------ /// <summary> /// Append a division to this publication. /// </summary> /// <param name="divLayoutMgr"></param> /// <remarks>No testing has been done to support multiple divisions yet</remarks> /// ------------------------------------------------------------------------------------ public void AddDivision(DivisionLayoutMgr divLayoutMgr) { CheckDisposed(); m_divisions.Add(divLayoutMgr); divLayoutMgr.Publication = this; // Configure the division only if the publication is already configured, // otherwise we will do it in PublicationControl.Configure(). if (m_fConfigured) divLayoutMgr.Configure(); }
/// ----------------------------------------------------------------------------------- /// <summary> /// Initializes a new instance of the <see cref="DummyPublication"/> class. /// </summary> /// ----------------------------------------------------------------------------------- public DummyPublication(IPublication pub, DivisionLayoutMgr div, DateTime printDateTime) : this(pub, null, div, printDateTime, false) { }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="T:PublicationControl"/> class with /// a single division. /// </summary> /// <param name="divLayoutMgr">The division</param> /// <param name="stylesheet">The stylesheet.</param> /// <param name="publication">The publication that this PublicationControl gets /// it's information from (or null to keep the defaults)</param> /// <param name="printDateTime">The printing date and time</param> /// <param name="fApplyStyleOverrides">if set to <c>true</c>, apply style overrides.</param> /// <param name="fUniformLineSpacing">if set to <c>true</c> apply uniform line spacing, /// rather than proportional spacing.</param> /// <param name="helpTopicProvider">The help topic provider.</param> /// <remarks>Only used for testing</remarks> /// ------------------------------------------------------------------------------------ protected PublicationControl(DivisionLayoutMgr divLayoutMgr, FwStyleSheet stylesheet, IPublication publication, DateTime printDateTime, bool fApplyStyleOverrides, bool fUniformLineSpacing, IHelpTopicProvider helpTopicProvider) : this(stylesheet, publication, printDateTime, fApplyStyleOverrides, fUniformLineSpacing, helpTopicProvider) { AddDivision(divLayoutMgr); }
/// ----------------------------------------------------------------------------------- /// <summary> /// Initializes a new instance of the <see cref="DummyPublication"/> class. /// </summary> /// ----------------------------------------------------------------------------------- public DummyPublication(IPublication pub, FwStyleSheet stylesheet, DivisionLayoutMgr div, DateTime printDateTime, bool fApplyStyleOverrides) : base(div, stylesheet, pub, printDateTime, fApplyStyleOverrides, false, null) { // If we use 720 and 1440 as DPI we get a more realistic test; however, we run into // rounding problems on different platforms. Therefore we use a hack // and handcraft the dpi. The tests use Times New Roman font which has a value of // 2048 as unit per em (can be seen e.g. on Linux by running ttx Times_New_Roman.ttf). // The font height gets calculated (in VwGraphics.cpp) as // heightInMilliPoints * dpiY / 72000 with heightInMilliPoints=10000. If we // want to eliminate rounding errors we need to use a font height that is a multiple // of unitPerEm. This leads us to the value of 14745.6f for printerDpiY. // Because this changes the font size the width will also be different, so we also // need to adjust printerDpiX. //m_printerDpiX = 720.0f; //m_printerDpiY = 1440.0f; m_printerDpiY = 14746.0f; // Math.Round(2048.0f / 10000 * 72000); m_printerDpiX = 7373.0f; // 14746 / 1440 * 720.0f; }
/// -------------------------------------------------------------------------------- /// <summary> /// Calls Page.AddPageElement(). /// </summary> /// <param name="division">The division</param> /// <param name="stream">The stream (rootbox) which supplies data for this element</param> /// <param name="fPageElementOwnsStream"><c>true</c> if this element is responsible for /// closing its stream when it is destoyed</param> /// <param name="locationOnPage">Location where this stream is laid out, in printer /// pixels, relative to the top left of the physical page</param> /// <param name="dypOffsetToTopPageBoundaryOnPage">Offset in stream to top of data being shown /// on this page, in printer pixels</param> /// <param name="fMainStream"><c>true</c> if this element is for a "main" stream; /// <c>false</c> if it's for a subordinate stream or a Header/Footer stream</param> /// <param name="currentColumn">The current column (1-based).</param> /// <param name="totalColumns">The total columns in the specified stream.</param> /// <param name="columnGap">The gap between the columns.</param> /// <param name="columnHeight">The height of the current column.</param> /// <param name="isRightToLeft">if set to <c>true</c> the stream is right-to-left. /// Otherwise, it is left-to-right.</param> /// <param name="fReducesFreeSpaceFromTop">Flag indicating whether additoin of this /// element reduces the free space from top or bottom.</param> /// -------------------------------------------------------------------------------- public void CallAddPageElement(DivisionLayoutMgr division, IVwLayoutStream stream, bool fPageElementOwnsStream, Rectangle locationOnPage, int dypOffsetToTopPageBoundaryOnPage, bool fMainStream, int currentColumn, int totalColumns, int columnGap, int columnHeight, bool isRightToLeft, bool fReducesFreeSpaceFromTop) { base.AddPageElement(division, stream, fPageElementOwnsStream, locationOnPage, dypOffsetToTopPageBoundaryOnPage, fMainStream, currentColumn, totalColumns, columnGap, columnHeight, 0, isRightToLeft, fReducesFreeSpaceFromTop); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Creates and returns the primary view construtor for the main view in the layout. /// This is only called once. /// </summary> /// <param name="div"></param> /// <returns>The view constructor to be used for the main view</returns> /// ------------------------------------------------------------------------------------ public virtual IVwViewConstructor MakeMainVc(DivisionLayoutMgr div) { return new EmptyTePrintLayoutVc(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Gets the element bounds. /// </summary> /// <param name="division">The division</param> /// <param name="dysSpaceUsedOnPage">The space used on page.</param> /// <param name="currentColumn">The current column (1-based).</param> /// <param name="numberColumns">The number columns.</param> /// <param name="leftMargin">The left margin.</param> /// <param name="offsetFromTopOfDiv">The offset from top of div.</param> /// <param name="columnHeight">Height of the column.</param> /// <returns>The element bounds in printer pixels</returns> /// ------------------------------------------------------------------------------------ internal Rectangle GetElementBounds(DivisionLayoutMgr division, int dysSpaceUsedOnPage, int currentColumn, int numberColumns, int leftMargin, int offsetFromTopOfDiv, int columnHeight) { Debug.Assert(numberColumns > 0, "Number of columns must be 1 or greater."); int columnWidth = division.AvailableMainStreamColumWidthInPrinterPixels; // the column gap adjustment is used to determine the X coordinate of the column. int columnGapAdjustment = division.ColumnGapWidthInPrinterPixels; // For left-to-right streams, layout columns from left side of page. Otherwise, // layout from right side. int xLoc = leftMargin + (columnWidth + columnGapAdjustment) * (division.MainStreamIsRightToLeft ? (numberColumns - currentColumn) : (currentColumn - 1)); Rectangle rect = new Rectangle(xLoc, FreeSpace.Top, columnWidth, dysSpaceUsedOnPage); return rect; }
/// ------------------------------------------------------------------------------------ /// <summary> /// No-op /// </summary> /// <param name="div">The division layout manager</param> /// ------------------------------------------------------------------------------------ public virtual void ConfigureSubordinateViews(DivisionLayoutMgr div) { }
/// ------------------------------------------------------------------------------------ /// <summary> /// Gets the number of printer pixels (source/layout units) from the top of the given /// division's main layout stream to the top of the data represented by the first page /// element on this page for that stream. This may only be an estimate, particularly if: /// <list type="normal"> /// <item>this page has no elements (at least for the given division)</item> /// <item>this page is broken</item> /// <item>there are previous pages that are not fully laid out (or broken)</item> /// </list> /// </summary> /// <param name="div">The division layout manager.</param> /// <returns>The offset</returns> /// <remarks>Public to make testing easier.</remarks> /// ------------------------------------------------------------------------------------ public int OffsetFromTopOfDiv(DivisionLayoutMgr div) { Debug.Assert(div != null); PageElement pe; return OffsetFromTopOfDiv(div.MainLayoutStream, div, out pe); }
/// ----------------------------------------------------------------------------------- /// <summary> /// Initializes a new instance of the <see cref="ReallyStupidPubCtrl"/> class. /// </summary> /// ----------------------------------------------------------------------------------- public ReallyStupidPubCtrl(Publication pub, FwStyleSheet stylesheet, DivisionLayoutMgr div, DateTime printDateTime, bool fApplyStyleOverrides) : base(pub, stylesheet, div, printDateTime, fApplyStyleOverrides) { }
/// ------------------------------------------------------------------------------------ /// <summary> /// Gets the number of printer pixels (source/layout units) from the top of the given /// division's main layout stream to the top of the data represented by the first page /// element on this page for that stream. This may only be an estimate, particularly if: /// <list type="normal"> /// <item>this page has no elements (at least for the given division)</item> /// <item>this page is broken</item> /// <item>there are previous pages that are not fully laid out (or broken)</item> /// </list> /// </summary> /// <param name="stream">The stream whose offset we want (may or may not be the main /// layout stream for the given division, but must not be null).</param> /// <param name="div">The division layout manager (can be null if the stream is not /// a main layout stream).</param> /// <param name="pe">The first page element on this page for the given stream.</param> /// <returns>The offset</returns> /// ------------------------------------------------------------------------------------ internal int OffsetFromTopOfDiv(IVwLayoutStream stream, DivisionLayoutMgr div, out PageElement pe) { CheckDisposed(); pe = GetFirstElementForStream(stream); if (pe != null) return pe.OffsetToTopPageBoundary; return (div == PubControl.Divisions[FirstDivOnPage]) ? m_ypOffsetFromTopOfDiv : 0; }
/// ----------------------------------------------------------------------------------- /// <summary> /// Initializes a new instance of the <see cref="DummyPublication"/> class. /// </summary> /// ----------------------------------------------------------------------------------- public DummyScripturePublicationNoDb(IPublication pub, FwStyleSheet stylesheet, DivisionLayoutMgr div, DateTime printDateTime, int filterInstance) : base(stylesheet, filterInstance, pub, TeViewType.PrintLayout, printDateTime) { m_printerDpiX = 720.0f; m_printerDpiY = 1440.0f; }
/// ------------------------------------------------------------------------------------ /// <summary> /// No subordinate views for this dummy configurer. /// </summary> /// <param name="div">The division layout manager</param> /// ------------------------------------------------------------------------------------ public override void ConfigureSubordinateViews(DivisionLayoutMgr div) { if (m_fAddSubordinateStreams) { int hvoScr = m_fdoCache.LangProject.TranslatedScriptureOAHvo; div.AddSubordinateStream(hvoScr, DummyFirstSubViewVc.kfragScrFootnotes, new DummyFirstSubViewVc(), new NLevelOwnerSvd(2, m_fdoCache.MainCacheAccessor, hvoScr)); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Makes a call to MakeSubordinateView, to add a view containing footnotes. /// </summary> /// <param name="div">The division layout manager</param> /// ------------------------------------------------------------------------------------ public virtual void ConfigureSubordinateViews(DivisionLayoutMgr div) { int hvoScripture = m_fdoCache.LangProject.TranslatedScriptureOAHvo; int wsDefault = ((m_viewType & TeViewType.BackTranslation) != 0 ? m_fdoCache.DefaultAnalWs : m_fdoCache.DefaultVernWs); NLevelOwnerSvd ownerSvd = new NLevelOwnerSvd(2, m_fdoCache.MainCacheAccessor, hvoScripture); IVwVirtualHandler vh = FilteredScrBooks.GetFilterInstance(m_fdoCache, div.FilterInstance); if (vh != null) { ownerSvd.AddTagLookup((int)Scripture.ScriptureTags.kflidScriptureBooks, vh.Tag); } if (m_sharedStream == null) { FootnoteVc footnoteVc = new FootnoteVc(div.FilterInstance, TeStVc.LayoutViewTarget.targetPrint, wsDefault); footnoteVc.Cache = m_fdoCache; footnoteVc.DisplayTranslation = (m_viewType & TeViewType.BackTranslation) != 0; div.AddSubordinateStream(hvoScripture, (int)FootnoteFrags.kfrScripture, footnoteVc, ownerSvd); } else { int hvoRoot; IVwViewConstructor vc; int frag; IVwStylesheet stylesheet; ((IVwRootBox)m_sharedStream).GetRootObject(out hvoRoot, out vc, out frag, out stylesheet); div.AddSharedSubordinateStream(m_sharedStream, vc, ownerSvd); } }