/// ------------------------------------------------------------------------------------
            /// <summary>
            /// Set up a new view constructor.
            /// </summary>
            /// <param name="flid">Not used.</param>
            /// ------------------------------------------------------------------------------------
            protected override VwBaseVc  CreateVc(int flid)
            {
                FootnoteVc vc = new FootnoteVc(TeStVc.LayoutViewTarget.targetDraft, 456);

                vc.Cache = m_fdoCache;
                return(vc);
            }
예제 #2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        protected override void Dispose(bool disposing)
        {
            //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
            // Must not be run more than once.
            if (IsDisposed)
            {
                return;
            }

            base.Dispose(disposing);

            if (disposing)
            {
                if (components != null)
                {
                    components.Dispose();
                }
                if (m_FootnoteVc != null)
                {
                    m_FootnoteVc.Dispose();
                }
            }
            m_FootnoteVc  = null;
            m_Scripture   = null;
            m_persistence = null;
            m_draftView   = null;
            m_bookFilter  = null;
        }
        /// ------------------------------------------------------------------------------------
        /// <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();
        }
예제 #4
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Make the root box.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public override void MakeRoot()
        {
            CheckDisposed();

            if (m_fdoCache == null || DesignMode)
            {
                return;
            }

            if (FwEditingHelper.ApplicableStyleContexts != null)
            {
                FwEditingHelper.ApplicableStyleContexts = new List <ContextValues>(2);
                FwEditingHelper.ApplicableStyleContexts.Add(ContextValues.Note);
                FwEditingHelper.ApplicableStyleContexts.Add(ContextValues.General);
            }

            // This is muy importante. If a spurious rootbox got made already and we just replace
            // it with a new one, the old one will fire an assertion in its destructor.
            // REVIEW: Is this okay? Is there any way to prevent early creation of rootboxes?
            if (m_rootb == null)
            {
                m_rootb = VwRootBoxClass.Create();
            }

            m_rootb.SetSite(this);

            // Set up a new view constructor.
            m_FootnoteVc = new FootnoteVc(m_filterInstance, TeStVc.LayoutViewTarget.targetDraft,
                                          m_isBackTranslation ? m_btWs : m_fdoCache.DefaultVernWs);
            m_FootnoteVc.ContentType = this.ContentType;

            m_FootnoteVc.Cache           = m_fdoCache;
            m_FootnoteVc.HeightEstimator = Group as IHeightEstimator;
            m_FootnoteVc.Editable        = EditingHelper.Editable;
            m_bookFilter = FilteredScrBooks.GetFilterInstance(m_fdoCache, m_filterInstance);

            m_FootnoteVc.Cache = m_fdoCache;

            m_rootb.DataAccess = m_fdoCache.MainCacheAccessor;
            //EditingHelper.RootObjects = new int[]{ScriptureObj.Hvo};
            m_rootb.SetRootObject(ScriptureObj.Hvo, m_FootnoteVc,
                                  (int)FootnoteFrags.kfrScripture, m_styleSheet);

            base.MakeRoot();
            m_dxdLayoutWidth = kForceLayout;             // Don't try to draw until we get OnSize and do layout.

            //TODO:
            //ptmw->RegisterRootBox(qrootb);

            Synchronize(m_rootb);
        }
예제 #5
0
        /// ------------------------------------------------------------------------------------
        /// <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);
            }
        }
예제 #6
0
        /// ------------------------------------------------------------------------------------
        /// <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);
            }
        }
예제 #7
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Make the root box.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public override void MakeRoot()
		{
			CheckDisposed();

			if (m_fdoCache == null || DesignMode)
				return;

			if (FwEditingHelper.ApplicableStyleContexts != null)
			{
				FwEditingHelper.ApplicableStyleContexts = new List<ContextValues>(2);
				FwEditingHelper.ApplicableStyleContexts.Add(ContextValues.Note);
				FwEditingHelper.ApplicableStyleContexts.Add(ContextValues.General);
			}

			// This is muy importante. If a spurious rootbox got made already and we just replace
			// it with a new one, the old one will fire an assertion in its destructor.
			// REVIEW: Is this okay? Is there any way to prevent early creation of rootboxes?
			if (m_rootb == null)
				m_rootb = VwRootBoxClass.Create();

			m_rootb.SetSite(this);

			// Set up a new view constructor.
			m_FootnoteVc = new FootnoteVc(m_filterInstance, TeStVc.LayoutViewTarget.targetDraft,
				m_isBackTranslation ? m_btWs : m_fdoCache.DefaultVernWs);
			m_FootnoteVc.ContentType = this.ContentType;

			m_FootnoteVc.Cache = m_fdoCache;
			m_FootnoteVc.HeightEstimator = Group as IHeightEstimator;
			m_FootnoteVc.Editable = EditingHelper.Editable;
			m_bookFilter = FilteredScrBooks.GetFilterInstance(m_fdoCache, m_filterInstance);

			m_FootnoteVc.Cache = m_fdoCache;

			m_rootb.DataAccess = m_fdoCache.MainCacheAccessor;
			//EditingHelper.RootObjects = new int[]{ScriptureObj.Hvo};
			m_rootb.SetRootObject(ScriptureObj.Hvo, m_FootnoteVc,
				(int)FootnoteFrags.kfrScripture, m_styleSheet);

			base.MakeRoot();
			m_dxdLayoutWidth = kForceLayout; // Don't try to draw until we get OnSize and do layout.

			//TODO:
			//ptmw->RegisterRootBox(qrootb);

			Synchronize(m_rootb);
		}
예제 #8
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected override void Dispose( bool disposing )
		{
			//Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
			// Must not be run more than once.
			if (IsDisposed)
				return;

			base.Dispose(disposing);

			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
				if (m_FootnoteVc != null)
					m_FootnoteVc.Dispose();
			}
			m_FootnoteVc = null;
			m_Scripture = null;
			m_persistence = null;
			m_draftView = null;
			m_bookFilter = null;
		}
예제 #9
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();
		}
예제 #10
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();
        }
			/// ------------------------------------------------------------------------------------
			/// <summary>
			/// Set up a new view constructor.
			/// </summary>
			/// <param name="flid">Not used.</param>
			/// ------------------------------------------------------------------------------------
			protected override VwBaseVc  CreateVc(int flid)
			{
				FootnoteVc vc = new FootnoteVc(TeStVc.LayoutViewTarget.targetDraft, 456);
				vc.Cache = m_fdoCache;
				return vc;
			}
예제 #12
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Gets the shared substream.
		/// </summary>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		private IVwLayoutStream GetSharedSubstream()
		{
			IVwLayoutStream sharedStream;
			if (m_sharedStreams.Count == 0)
			{
				// Add shared footnote stream
				int hvoScr = m_cache.LangProject.TranslatedScriptureOAHvo;
				sharedStream = VwLayoutStreamClass.Create();
				SetAccessibleStreamName(sharedStream, AccessibleName + "_SharedStream");

				IVwRootBox rootbox = (IVwRootBox)sharedStream;
				rootbox.DataAccess = m_cache.MainCacheAccessor;

				int wsDefault = ((m_viewType & TeViewType.BackTranslation) != 0 ?
					BackTranslationWS : ViewConstructorWS);
				FootnoteVc footnoteVc = new FootnoteVc(m_filterInstance,
					TeStVc.LayoutViewTarget.targetPrint, wsDefault);
				footnoteVc.Cache = m_cache;
				footnoteVc.ContentType = ContentType;
				rootbox.SetRootObject(hvoScr, footnoteVc, (int)FootnoteFrags.kfrScripture,
					m_stylesheet);

				AddSharedSubstream(sharedStream);
			}

			// TODO: handle multiple shared streams
			sharedStream = m_sharedStreams[0];
			return sharedStream;
		}
예제 #13
0
		/// ------------------------------------------------------------------------------------
		/// <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);
			}
		}
예제 #14
0
		/// <summary>
		/// Executes in two distinct scenarios.
		///
		/// 1. If disposing is true, the method has been called directly
		/// or indirectly by a user's code via the Dispose method.
		/// Both managed and unmanaged resources can be disposed.
		///
		/// 2. If disposing is false, the method has been called by the
		/// runtime from inside the finalizer and you should not reference (access)
		/// other managed objects, as they already have been garbage collected.
		/// Only unmanaged resources can be disposed.
		/// </summary>
		/// <param name="disposing"></param>
		/// <remarks>
		/// If any exceptions are thrown, that is fine.
		/// If the method is being done in a finalizer, it will be ignored.
		/// If it is thrown by client code calling Dispose,
		/// it needs to be handled by fixing the bug.
		///
		/// If subclasses override this method, they should call the base implementation.
		/// </remarks>
		protected override void Dispose(bool disposing)
		{
			// Must not be run more than once.
			if (IsDisposed)
				return;

			if (disposing)
			{
				// Dispose managed resources here.
			}

			// Dispose unmanaged resources here, whether disposing is true or false.
			m_bookFilter = null;
			m_footnoteVc = null;

			base.Dispose(disposing);
		}
예제 #15
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.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();
		}
예제 #16
0
		/// ------------------------------------------------------------------------------------
		/// <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);
			}
		}