Ejemplo n.º 1
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Configure a PublicationControl
		/// </summary>
		/// <param name="fAddSubStream">if set to <c>true</c> add subordinate stream.</param>
		/// ------------------------------------------------------------------------------------
		private void ConfigurePublication(bool fAddSubStream)
		{
			// When called for test setup, they will be null.
			// When called from within as test
			if (m_pub != null)
				m_pub.Dispose();
			if (m_division != null)
				m_division.Dispose();
			m_division = new DummyDivision(new DummyLazyPrintConfigurer(Cache, fAddSubStream), 1);
			Publication pub = new Publication(Cache,
				Cache.LangProject.TranslatedScriptureOA.PublicationsOC.HvoArray[0]);
			m_pub = new DummyPublication(pub, m_division, DateTime.Now);
			m_pub.Configure();

			// Check initial state
			Assert.AreEqual(m_division, m_pub.Divisions[0]);
			Assert.IsNotNull(m_division.MainVc as DummyMainLazyViewVc);
			IVwLayoutStream layoutStream = m_division.MainLayoutStream;
			Assert.IsNotNull(layoutStream);
			m_pub.IsLeftBound = true;
		}
Ejemplo n.º 2
0
		/// ------------------------------------------------------------------------------------
		/// <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)
		{
		}
Ejemplo n.º 3
0
		/// ------------------------------------------------------------------------------------
		/// <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();
		}
Ejemplo n.º 4
0
		/// -----------------------------------------------------------------------------------
		/// <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)
		{
		}
Ejemplo n.º 5
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Configure a PublicationControl
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public void ConfigurePublication()
		{
			if (m_division != null)
				m_division.Dispose();
			if (m_ScrPubCtrl != null)
				m_ScrPubCtrl.Dispose();
			m_division = new DummyDivision(new DummyPrintConfigurer(m_fdoCache, null), 1);
			Publication pub = new Publication(m_fdoCache,
				m_fdoCache.LangProject.TranslatedScriptureOA.PublicationsOC.HvoArray[0]);
			m_ScrPubCtrl = new TeDummyPublication(pub, m_division, DateTime.Now);
			m_ScrPubCtrl.Configure();

			// Check initial state
			Assert.AreEqual(m_division, m_ScrPubCtrl.Divisions[0]);
			Assert.IsNotNull(m_division.MainVc as StVc);
			IVwLayoutStream layoutStream = m_division.MainLayoutStream;
			Assert.IsNotNull(layoutStream);
			Assert.AreEqual(layoutStream, m_division.MainLayoutStream,
				"MainLayoutStream should not contruct a new stream each time");
			IVwRootBox rootbox = layoutStream as IVwRootBox;
			Assert.IsNotNull(rootbox);
			IVwSelection sel = rootbox.Selection;
			Assert.IsNotNull(sel);
			int ich, hvo, tag, ws; // dummies
			bool fAssocPrev;
			ITsString tss;
			sel.TextSelInfo(false, out tss, out ich, out fAssocPrev, out hvo, out tag, out ws);
			Assert.AreEqual("14", tss.Text.Substring(0, 2));
		}
Ejemplo n.º 6
0
		/// ------------------------------------------------------------------------------------
		/// <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_pub != null)
				m_pub.Dispose();
			if (m_division != null)
				m_division.Dispose();
			m_division = new DummyDivision(new DummyLazyPrintConfigurer(Cache, fAddSubStream,
				fAddContent), 2);
			Publication pub = new Publication(Cache,
				Cache.LangProject.TranslatedScriptureOA.PublicationsOC.HvoArray[0]);
			m_pub = new DummyPublication(pub, m_division, DateTime.Now);
			m_pub.Configure();

			// Check initial state
			Assert.AreEqual(m_division, m_pub.Divisions[0]);
			Assert.IsNotNull(m_division.MainVc as DummyMainLazyViewVc);
			IVwLayoutStream layoutStream = m_division.MainLayoutStream;
			Assert.IsNotNull(layoutStream);
			m_pub.IsLeftBound = true;

			// Set up the publication
			m_pub.PageHeight = 72000 * 11; // 11 inches
			m_pub.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
			DummyMainLazyViewVc vc = m_division.MainVc as DummyMainLazyViewVc;
			vc.m_estBookHeight = 2000;
			vc.m_estSectionHeight = 2000;
			m_pub.Width = 3 * 96; // represents a window that is 3" wide at 96 DPI
		}
Ejemplo n.º 7
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initialize the cache before it gets used
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected override void InitializeCache()
		{
			base.InitializeCache();
			m_pub = new Publication();
			m_inMemoryCache.InitializeLexDb();
			Cache.LangProject.LexDbOA.PublicationsOC.Add(m_pub);
		}
Ejemplo n.º 8
0
		/// ------------------------------------------------------------------------------------
		/// <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);
		}
Ejemplo n.º 9
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates 2 fake HF sets for use in testing
		/// </summary>
		/// <returns>the created publication</returns>
		/// ------------------------------------------------------------------------------------
		private IPublication CreateFakeHFSets()
		{
			// create a publication
			IPublication pub = new Publication();
			Cache.LangProject.LexDbOA.PublicationsOC.Add(pub);
			IPubDivision pubDiv = new PubDivision();
			pub.DivisionsOS.Append(pubDiv);

			// create the current HF set for the publication
			pubDiv.HFSetOA = new PubHFSet();
			pubDiv.HFSetOA.DefaultHeaderOA = new PubHeader();
			pubDiv.HFSetOA.DefaultFooterOA = new PubHeader();
			pubDiv.HFSetOA.FirstHeaderOA = new PubHeader();
			pubDiv.HFSetOA.FirstFooterOA = new PubHeader();
			pubDiv.HFSetOA.EvenHeaderOA = new PubHeader();
			pubDiv.HFSetOA.EvenFooterOA = new PubHeader();
			pubDiv.HFSetOA.Name = "Test HF Set of Matthew printed in Tabaluga";

			// create a dummy HF set
			IPubHFSet hfset = new PubHFSet();
			m_hfSets.Add(hfset);
			hfset.Name = "Test HF Set created today";
			hfset.Description.Text = "This is a test HF set";
			hfset.DefaultHeaderOA = new PubHeader();
			hfset.DefaultFooterOA = new PubHeader();
			hfset.EvenHeaderOA = new PubHeader();
			hfset.EvenFooterOA = new PubHeader();
			hfset.FirstFooterOA = new PubHeader();
			hfset.FirstHeaderOA = new PubHeader();
			hfset.DefaultFooterOA.OutsideAlignedText.Text = "outside text";
			hfset.DefaultFooterOA.CenteredText.Text = "Song of songs";
			hfset.EvenHeaderOA.CenteredText.Text = "Song even pages";
			hfset.EvenHeaderOA.InsideAlignedText.Text = "Inside text";
			hfset.FirstFooterOA.InsideAlignedText.Text = "Inside text";

			// create another dummy HF set
			IPubHFSet hfset2 = new PubHFSet();
			m_hfSets.Add(hfset2);
			hfset2.Name = "Test HF Set of Matthew printed in Tabaluga";
			hfset2.Description.Text = "This is another test HF set";
			hfset2.DefaultHeaderOA = new PubHeader();
			hfset2.DefaultFooterOA = new PubHeader();
			hfset2.EvenHeaderOA = new PubHeader();
			hfset2.EvenFooterOA = new PubHeader();
			hfset2.FirstFooterOA = new PubHeader();
			hfset2.FirstHeaderOA = new PubHeader();
			hfset2.DefaultHeaderOA.OutsideAlignedText.UnderlyingTsString =
				StringUtils.CreateOrcFromGuid(HeaderFooterVc.PageNumberGuid,
				FwObjDataTypes.kodtContextString, Cache.DefaultUserWs);
			hfset2.DefaultFooterOA.CenteredText.Text = "Matthew";
			hfset2.EvenFooterOA.CenteredText.Text = "From Reference";
			hfset2.EvenHeaderOA.InsideAlignedText.Text = "nothing";
			hfset2.FirstFooterOA.InsideAlignedText.Text = "Inside text";

			return pub;
		}
Ejemplo n.º 10
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates a publication and adds it to a collection of Publications on the
		/// CmMajorObject AnnotationDefs.
		/// </summary>
		/// <param name="pageHeight">Height of the page.</param>
		/// <param name="pageWidth">Width of the page.</param>
		/// <param name="fIsLandscape">if set to <c>true</c> the publication is landscape.</param>
		/// <param name="name">The name of the publication.</param>
		/// <param name="gutterMargin">The gutter margin.</param>
		/// <param name="bindingSide">The side on which the publication will be bound (i.e., the
		/// gutter location).</param>
		/// <param name="footnoteSepWidth">Width of the footnote seperator.</param>
		/// <returns>the new publication</returns>
		/// <remarks>Adds the publication to AnnotationDefs because we need a
		/// CmMajorObject where we can attach the Publication and Scripture is not visible here.
		/// </remarks>
		/// ------------------------------------------------------------------------------------
		public IPublication CreatePublication(int pageHeight, int pageWidth, bool fIsLandscape,
			string name, int gutterMargin, BindingSide bindingSide, int footnoteSepWidth)
		{
			Debug.Assert(Cache.LangProject != null, "The language project is null");
			Debug.Assert(Cache.LangProject.AnnotationDefsOA != null,
				"The annotation definitions are null.");

			Publication pub = new Publication();
			Cache.LangProject.AnnotationDefsOA.PublicationsOC.Add(pub);
			pub.PageHeight = pageHeight;
			pub.PageWidth = pageWidth;
			pub.IsLandscape = fIsLandscape;
			pub.Name = name;
			pub.GutterMargin = gutterMargin;
			pub.BindingEdge = bindingSide;
			pub.FootnoteSepWidth = footnoteSepWidth;

			return (IPublication)pub;
		}
Ejemplo n.º 11
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Called to make the test data for the tests
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected override void CreateTestData()
		{
			base.CreateTestData();

			m_pub = new Publication(m_scrInMemoryCache.Cache, m_scr.PublicationsOC.HvoArray[0]);
			Assert.IsNotNull(m_pub);
			m_realStylesheet = new FwStyleSheet();
			m_realStylesheet.Init(Cache, m_scr.Hvo, (int)Scripture.ScriptureTags.kflidStyles);
			SetFontSizeLineHeightAndSpaceBeforeAfter(m_realStylesheet, ScrStyleNames.Normal,
				null, 10000, -12000, -1, -1);
			SetFontSizeLineHeightAndSpaceBeforeAfter(m_realStylesheet, ScrStyleNames.NormalParagraph,
				ScrStyleNames.Normal, -1, -1, -1, -1);
			SetFontSizeLineHeightAndSpaceBeforeAfter(m_realStylesheet, ScrStyleNames.NormalFootnoteParagraph,
				ScrStyleNames.NormalParagraph, 8000, 10000, -1, -1);
			SetFontSizeLineHeightAndSpaceBeforeAfter(m_realStylesheet, ScrStyleNames.IntroParagraph,
				ScrStyleNames.NormalParagraph, 9000, -11000, -1, -1);
			SetFontSizeLineHeightAndSpaceBeforeAfter(m_realStylesheet, ScrStyleNames.IntroSectionHead,
				ScrStyleNames.SectionHead, 8000, -10000, -1, -1);
			SetFontSizeLineHeightAndSpaceBeforeAfter(m_realStylesheet, ScrStyleNames.SectionHead,
				ScrStyleNames.NormalParagraph, 9000, -1, 8000, 4000);
			SetFontSizeLineHeightAndSpaceBeforeAfter(m_realStylesheet, ScrStyleNames.MainBookTitle,
				ScrStyleNames.SectionHead, 20000, -24000, 36000, 12000);

			m_pub.DivisionsOS.Append(new PubDivision());
		}
Ejemplo n.º 12
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Configure a PublicationControl
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public void ConfigurePublication()
		{
			Dictionary<string, string> cacheOptions = new Dictionary<string, string>();
			cacheOptions.Add("db", "TestLangProj");
			m_fdoCache = FdoCache.Create(cacheOptions);
			// Make sure we don't call InstallLanguage during tests.
			m_fdoCache.LanguageWritingSystemFactoryAccessor.BypassInstall = true;

			if (m_pub != null)
				m_pub.Dispose();
			m_division = new DummyDivision(new DummyHFPrintConfigurer(m_fdoCache), 1);
			Publication pub = new Publication(m_fdoCache,
				m_fdoCache.LangProject.TranslatedScriptureOA.PublicationsOC.HvoArray[0]);
			m_pub = new DummyPublication(pub, m_division, DateTime.Now);
			m_pub.Configure();

			// Check initial state
			Assert.AreEqual(m_division, m_pub.Divisions[0]);
			IVwLayoutStream layoutStream = m_division.MainLayoutStream;
			Assert.IsNotNull(layoutStream);
		}
Ejemplo n.º 13
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initialize scripture publications
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public void InitializeScrPublications()
		{
			CheckDisposed();
			Publication pub = new Publication();
			m_lp.TranslatedScriptureOA.PublicationsOC.Add(pub);
			pub.IsLeftBound = true;
		}
Ejemplo n.º 14
0
		//private Form m_form;
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates the division and publication.
		/// </summary>
		/// <param name="columns">The number of columns.</param>
		/// <param name="fSharedSubStreams">if set to <c>true</c> configure the print layout
		/// view using shared sub streams; otherwise, each division will create an owned
		/// substream.</param>
		/// ------------------------------------------------------------------------------------
		private void CreateDivisionAndPublication(int columns, bool fSharedSubStreams)
		{
			if (m_firstDivision != null)
				m_firstDivision.Dispose();
			if (m_pub != null)
				m_pub.Dispose();
			m_subStream = null;
			if (fSharedSubStreams)
				m_subStream = VwLayoutStreamClass.Create();
			m_firstDivision = new DummyDivision(new DummyPrintConfigurer(m_fdoCache, m_subStream),
				columns);
			Publication pub = new Publication(m_fdoCache,
				m_fdoCache.LangProject.TranslatedScriptureOA.PublicationsOC.HvoArray[0]);
			m_pub = new DummyPublication(pub, m_firstDivision, DateTime.Now);
			if (fSharedSubStreams)
			{
				int hvoScr = m_fdoCache.LangProject.TranslatedScriptureOAHvo;
				IVwRootBox rootbox = (IVwRootBox)m_subStream;
				rootbox.DataAccess = m_fdoCache.MainCacheAccessor;
				rootbox.SetRootObject(hvoScr, new DummyFirstSubViewVc(),
					DummyFirstSubViewVc.kfragScrFootnotes, null);

				m_pub.AddSharedSubstream(m_subStream);
			}

		}