/// ------------------------------------------------------------------------------------
        /// <summary>
        /// Configure a PublicationControl
        /// </summary>
        /// <param name="fAddSubStream">if set to <c>true</c> add subordinate stream.</param>
        /// <param name="fAddContent">if set to <c>true</c> add real content, otherwise add
        /// rectangle for paragraph.</param>
        /// ------------------------------------------------------------------------------------
        private void ConfigurePublication(bool fAddSubStream, bool fAddContent)
        {
            // When called for test setup, they will be null.
            // When called from within as test
            if (m_ScrPubCtrl != null)
            {
                m_ScrPubCtrl.Dispose();
            }
            if (m_division != null)
            {
                m_division.Dispose();
            }
            m_division = new DummyDivision(new DummyLazyPrintConfigurer(Cache, fAddSubStream,
                                                                        fAddContent), 1);

            FwStyleSheet styleSheet = new FwStyleSheet();

            styleSheet.Init(Cache, Cache.LangProject.TranslatedScriptureOA.Hvo,
                            ScriptureTags.kflidStyles);

            FootnoteVc footnoteVc = new FootnoteVc(TeStVc.LayoutViewTarget.targetPrint, -1);

            footnoteVc.Cache      = Cache;
            footnoteVc.Stylesheet = styleSheet;

            DummyPrintConfigurer configurer = m_division.Configurer as DummyPrintConfigurer;

            configurer.RootOnEachPage    = true;
            configurer.DependentRootFrag = (int)FootnoteFrags.kfrRootInPageSeq;
            configurer.DependentRootTag  = ScrBookTags.kflidFootnotes;
            configurer.StyleSheet        = styleSheet;
            configurer.DependentRootVc   = footnoteVc;

            m_dbPub = Cache.LangProject.TranslatedScriptureOA.PublicationsOC.ToArray()[0];
            m_dbPub.BaseFontSize    = 12000;
            m_dbPub.BaseLineSpacing = 15;
            IPubDivision pubDiv =
                Cache.ServiceLocator.GetInstance <IPubDivisionFactory>().Create();

            m_dbPub.DivisionsOS.Add(pubDiv);
            pubDiv.PageLayoutOA = Cache.ServiceLocator.GetInstance <IPubPageLayoutFactory>().Create();
            pubDiv.NumColumns   = 1;
            pubDiv.StartAt      = DivisionStartOption.NewPage;

            m_ScrPubCtrl = new DummyScripturePublicationNoDb(m_dbPub, styleSheet, m_division, DateTime.Now,
                                                             m_filterInstance);

            m_ScrPubCtrl.IsLeftBound = true;

            // Set up the publication
            m_ScrPubCtrl.PageHeight  = 72000 * 11;         // 11 inches
            m_ScrPubCtrl.PageWidth   = (int)(72000 * 8.5); // 8.5 inches
            m_division.TopMargin     = 36000;              // Half inch
            m_division.BottomMargin  = 18000;              // Quarter inch
            m_division.InsideMargin  = 9000;               // 1/8 inch
            m_division.OutsideMargin = 4500;               // 1/16 inch
            m_ScrPubCtrl.Width       = 3 * 96;             // represents a window that is 3" wide at 96 DPI
            m_ScrPubCtrl.Configure();
        }
        public void OneColumnOneBook()
        {
            foreach (PubDivision div in m_dbPub.DivisionsOS)
            {
                div.NumColumns = 1;
            }

            m_BookFilter.UpdateFilter(
                Cache.LangProject.TranslatedScriptureOA.ScriptureBooksOS.HvoArray[1]);
            Assert.AreEqual(1, m_BookFilter.BookCount);

            m_ScrPubCtrl.Configure();
            m_ScrPubCtrl.CreatePages();

            // Verify that both divisions are one-column
            Assert.AreEqual(2, m_ScrPubCtrl.Divisions.Count);
            DivisionLayoutMgr divTitleIntro = m_ScrPubCtrl.Divisions[0];
            DivisionLayoutMgr divScripture  = m_ScrPubCtrl.Divisions[1];

            Assert.AreEqual(divTitleIntro.AvailableMainStreamColumWidthInPrinterPixels,
                            divScripture.AvailableMainStreamColumWidthInPrinterPixels);
            Assert.AreEqual(divTitleIntro.AvailableMainStreamColumWidthInPrinterPixels,
                            divTitleIntro.AvailablePageWidthInPrinterPixels);
            Assert.AreNotEqual(DivisionStartOption.Continuous, divTitleIntro.StartAt);
            Assert.AreEqual(DivisionStartOption.Continuous, divScripture.StartAt);
            Assert.Greater(divTitleIntro.MainRootBox.Height, 0);
            Assert.Greater(divScripture.MainRootBox.Height, 0);
            Assert.Greater(divScripture.MainRootBox.Height, divTitleIntro.MainRootBox.Height);

            Assert.Greater(m_ScrPubCtrl.PageCount, 2);

            Assert.IsNotNull(divTitleIntro.MainVc as ScriptureBookIntroVc);
            Assert.IsNotNull(divScripture.MainVc as ScriptureBodyVc);

            foreach (DivisionLayoutMgr div in m_ScrPubCtrl.Divisions)
            {
                IVwLayoutStream layoutStream = div.MainLayoutStream;
                Assert.IsNotNull(layoutStream);
                Assert.IsNotNull(layoutStream as IVwRootBox);
            }
        }
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Configure a PublicationControl
		/// </summary>
		/// <param name="fAddSubStream">if set to <c>true</c> add subordinate stream.</param>
		/// <param name="fAddContent">if set to <c>true</c> add real content, otherwise add
		/// rectangle for paragraph.</param>
		/// ------------------------------------------------------------------------------------
		private void ConfigurePublication(bool fAddSubStream, bool fAddContent)
		{
			// When called for test setup, they will be null.
			// When called from within as test
			if (m_ScrPubCtrl != null)
				m_ScrPubCtrl.Dispose();
			if (m_division != null)
				m_division.Dispose();
			m_division = new DummyDivision(new DummyLazyPrintConfigurer(Cache, fAddSubStream,
				fAddContent), 1);

			FwStyleSheet styleSheet = new FwStyleSheet();
			styleSheet.Init(Cache, Cache.LangProject.TranslatedScriptureOAHvo,
				(int)Scripture.ScriptureTags.kflidStyles);

			FootnoteVc footnoteVc = new FootnoteVc(-1, TeStVc.LayoutViewTarget.targetPrint,
				Cache.DefaultVernWs);
			footnoteVc.Cache = Cache;
			footnoteVc.Stylesheet = styleSheet;

			DummyPrintConfigurer configurer = m_division.Configurer as DummyPrintConfigurer;
			configurer.RootOnEachPage = true;
			configurer.DependentRootFrag = (int)FootnoteFrags.kfrRootInPageSeq;
			configurer.DependentRootTag = DummyVirtualHandler.InstallDummyHandler(Cache.VwCacheDaAccessor,
					"Scripture", "FootnotesOnPage", (int)CellarModuleDefns.kcptReferenceSequence).Tag;
			configurer.StyleSheet = styleSheet;
			configurer.DependentRootVc = footnoteVc;

			m_dbPub = new Publication(Cache,
				Cache.LangProject.TranslatedScriptureOA.PublicationsOC.HvoArray[0]);
			m_dbPub.BaseFontSize = 12;
			m_dbPub.BaseLineSpacing = 15;
			PubDivision pubDiv = new PubDivision();
			m_dbPub.DivisionsOS.Append(pubDiv);
			pubDiv.PageLayoutOA = new PubPageLayout();
			pubDiv.NumColumns = 1;
			pubDiv.StartAt = DivisionStartOption.NewPage;

			m_ScrPubCtrl = new DummyScripturePublicationNoDb(m_dbPub, styleSheet, m_division, DateTime.Now,
				m_filterInstance);

			m_ScrPubCtrl.IsLeftBound = true;

			// Set up the publication
			m_ScrPubCtrl.PageHeight = 72000 * 11; // 11 inches
			m_ScrPubCtrl.PageWidth = (int)(72000 * 8.5); // 8.5 inches
			m_division.TopMargin = 36000; // Half inch
			m_division.BottomMargin = 18000; // Quarter inch
			m_division.InsideMargin = 9000; // 1/8 inch
			m_division.OutsideMargin = 4500; // 1/16 inch
			m_ScrPubCtrl.Width = 3 * 96; // represents a window that is 3" wide at 96 DPI
			m_ScrPubCtrl.Configure();
		}
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Configure a PublicationControl
        /// </summary>
        /// <param name="fAddSubStream">if set to <c>true</c> add subordinate stream.</param>
        /// <param name="fAddContent">if set to <c>true</c> add real content, otherwise add
        /// rectangle for paragraph.</param>
        /// ------------------------------------------------------------------------------------
        private void ConfigurePublication(bool fAddSubStream, bool fAddContent)
        {
            // When called for test setup, they will be null.
            // When called from within as test
            if (m_ScrPubCtrl != null)
            {
                m_ScrPubCtrl.Dispose();
            }
            if (m_division != null)
            {
                m_division.Dispose();
            }
            m_division = new DummyDivision(new DummyLazyPrintConfigurer(Cache, fAddSubStream,
                                                                        fAddContent), 1);

            FwStyleSheet styleSheet = new FwStyleSheet();

            styleSheet.Init(Cache, Cache.LangProject.TranslatedScriptureOAHvo,
                            (int)Scripture.ScriptureTags.kflidStyles);

            FootnoteVc footnoteVc = new FootnoteVc(-1, TeStVc.LayoutViewTarget.targetPrint,
                                                   Cache.DefaultVernWs);

            footnoteVc.Cache      = Cache;
            footnoteVc.Stylesheet = styleSheet;

            DummyPrintConfigurer configurer = m_division.Configurer as DummyPrintConfigurer;

            configurer.RootOnEachPage    = true;
            configurer.DependentRootFrag = (int)FootnoteFrags.kfrRootInPageSeq;
            configurer.DependentRootTag  = DummyVirtualHandler.InstallDummyHandler(Cache.VwCacheDaAccessor,
                                                                                   "Scripture", "FootnotesOnPage", (int)CellarModuleDefns.kcptReferenceSequence).Tag;
            configurer.StyleSheet      = styleSheet;
            configurer.DependentRootVc = footnoteVc;

            m_dbPub = new Publication(Cache,
                                      Cache.LangProject.TranslatedScriptureOA.PublicationsOC.HvoArray[0]);
            m_dbPub.BaseFontSize    = 12;
            m_dbPub.BaseLineSpacing = 15;
            PubDivision pubDiv = new PubDivision();

            m_dbPub.DivisionsOS.Append(pubDiv);
            pubDiv.PageLayoutOA = new PubPageLayout();
            pubDiv.NumColumns   = 1;
            pubDiv.StartAt      = DivisionStartOption.NewPage;

            m_ScrPubCtrl = new DummyScripturePublicationNoDb(m_dbPub, styleSheet, m_division, DateTime.Now,
                                                             m_filterInstance);

            m_ScrPubCtrl.IsLeftBound = true;

            // Set up the publication
            m_ScrPubCtrl.PageHeight  = 72000 * 11;         // 11 inches
            m_ScrPubCtrl.PageWidth   = (int)(72000 * 8.5); // 8.5 inches
            m_division.TopMargin     = 36000;              // Half inch
            m_division.BottomMargin  = 18000;              // Quarter inch
            m_division.InsideMargin  = 9000;               // 1/8 inch
            m_division.OutsideMargin = 4500;               // 1/16 inch
            m_ScrPubCtrl.Width       = 3 * 96;             // represents a window that is 3" wide at 96 DPI
            m_ScrPubCtrl.Configure();
        }
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Configures the publication.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected void ConfigurePublication()
		{
			m_division = new DummyDivision(new DummyLazyPrintConfigurer(Cache, false,
				true), 1);
			Publication pub = new Publication(Cache,
				Cache.LangProject.TranslatedScriptureOA.PublicationsOC.HvoArray[0]);
			pub.BaseFontSize = 12;
			pub.BaseLineSpacing = 15;
			PubDivision pubDiv = new PubDivision();
			pub.DivisionsOS.Append(pubDiv);
			pubDiv.PageLayoutOA = new PubPageLayout();
			pubDiv.NumColumns = 1;
			pubDiv.StartAt = DivisionStartOption.NewPage;

			FwStyleSheet styleSheet = new FwStyleSheet();
			styleSheet.Init(Cache, Cache.LangProject.TranslatedScriptureOAHvo,
				(int)Scripture.ScriptureTags.kflidStyles);
			m_pubCtrl = new DummyScripturePublicationNoDb(pub, styleSheet,
				m_division, DateTime.Now, m_filterInstance);
			m_pubCtrl.Configure();
			m_pubCtrl.BookHvo = m_genesis.Hvo;

			m_pageInfo = new DummyPageInfo();
			m_pageInfo.m_publication = m_pubCtrl;
			int filterInstance = 123456789;
			FilteredScrBooks bookFilter = new FilteredScrBooks(Cache, filterInstance);
			m_vc = new TeHeaderFooterVc(Cache, m_pageInfo, Cache.DefaultVernWs,
				DateTime.Now, filterInstance, (int)ScrBook.ScrBookTags.kflidSections);
		}
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Configure a PublicationControl
		/// </summary>
		/// <param name="fAddSubStream">if set to <c>true</c> add subordinate stream.</param>
		/// <param name="fAddContent">if set to <c>true</c> add real content, otherwise add
		/// rectangle for paragraph.</param>
		/// ------------------------------------------------------------------------------------
		private void ConfigurePublication(bool fAddSubStream, bool fAddContent)
		{
			// When called for test setup, they will be null.
			// When called from within as test
			if (m_ScrPubCtrl != null)
				m_ScrPubCtrl.Dispose();
			if (m_division != null)
				m_division.Dispose();
			m_division = new DummyDivision(new DummyLazyPrintConfigurer(Cache, fAddSubStream,
				fAddContent), 1);

			FwStyleSheet styleSheet = new FwStyleSheet();
			styleSheet.Init(Cache, Cache.LangProject.TranslatedScriptureOA.Hvo,
				ScriptureTags.kflidStyles);

			FootnoteVc footnoteVc = new FootnoteVc(TeStVc.LayoutViewTarget.targetPrint, -1);
			footnoteVc.Cache = Cache;
			footnoteVc.Stylesheet = styleSheet;

			DummyPrintConfigurer configurer = m_division.Configurer as DummyPrintConfigurer;
			configurer.RootOnEachPage = true;
			configurer.DependentRootFrag = (int)FootnoteFrags.kfrRootInPageSeq;
			configurer.DependentRootTag = ScrBookTags.kflidFootnotes;
			configurer.StyleSheet = styleSheet;
			configurer.DependentRootVc = footnoteVc;

			m_dbPub = Cache.LangProject.TranslatedScriptureOA.PublicationsOC.ToArray()[0];
			m_dbPub.BaseFontSize = 12000;
			m_dbPub.BaseLineSpacing = 15;
			IPubDivision pubDiv =
				Cache.ServiceLocator.GetInstance<IPubDivisionFactory>().Create();
			m_dbPub.DivisionsOS.Add(pubDiv);
			pubDiv.PageLayoutOA = Cache.ServiceLocator.GetInstance<IPubPageLayoutFactory>().Create();
			pubDiv.NumColumns = 1;
			pubDiv.StartAt = DivisionStartOption.NewPage;

			m_ScrPubCtrl = new DummyScripturePublicationNoDb(m_dbPub, styleSheet, m_division, DateTime.Now,
				m_filterInstance);

			m_ScrPubCtrl.IsLeftBound = true;

			// Set up the publication
			m_ScrPubCtrl.PageHeight = 72000 * 11; // 11 inches
			m_ScrPubCtrl.PageWidth = (int)(72000 * 8.5); // 8.5 inches
			m_division.TopMargin = 36000; // Half inch
			m_division.BottomMargin = 18000; // Quarter inch
			m_division.InsideMargin = 9000; // 1/8 inch
			m_division.OutsideMargin = 4500; // 1/16 inch
			m_ScrPubCtrl.Width = 3 * 96; // represents a window that is 3" wide at 96 DPI
			m_ScrPubCtrl.Configure();
		}
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Configures the publication.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected void ConfigurePublication()
		{
			m_division = new DummyDivision(new DummyLazyPrintConfigurer(Cache, false,
				true), 1);
			IPublication pub = Cache.LangProject.TranslatedScriptureOA.PublicationsOC.ToArray()[0];
			pub.BaseFontSize = 12000;
			pub.BaseLineSpacing = 15;
			IPubDivision pubDiv = Cache.ServiceLocator.GetInstance<IPubDivisionFactory>().Create();
			pub.DivisionsOS.Add(pubDiv);
			pubDiv.PageLayoutOA = Cache.ServiceLocator.GetInstance<IPubPageLayoutFactory>().Create();
			pubDiv.NumColumns = 1;
			pubDiv.StartAt = DivisionStartOption.NewPage;

			FwStyleSheet styleSheet = new FwStyleSheet();
			styleSheet.Init(Cache, Cache.LangProject.TranslatedScriptureOA.Hvo,
				ScriptureTags.kflidStyles);
			m_pubCtrl = new DummyScripturePublicationNoDb(pub, styleSheet,
				m_division, DateTime.Now, m_filterInstance);
			m_pubCtrl.Configure();
			m_pubCtrl.BookHvo = m_genesis.Hvo;

			m_pageInfo = new DummyPageInfo();
			m_pageInfo.m_publication = m_pubCtrl;
			Cache.ServiceLocator.GetInstance<IFilteredScrBookRepository>().GetFilterInstance(m_filterInstance);  // this creates the book filter!
			m_vc = new TeHeaderFooterVc(Cache, m_pageInfo, Cache.DefaultVernWs,
				DateTime.Now, m_filterInstance);
		}