Esempio n. 1
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Inserts a footnote into the book of Exodus, in the first section, first paragraph.
		/// This is the actual implementation method. Don't call it directly.
		/// </summary>
		/// <param name="howfar">How far (as a percentage) the insertion point should be
		/// located into the paragraph. 100 would put the insertion point at the end of the
		/// paragraph and zero would put it at the beginning.</param>
		/// <param name="footnoteParaStyleId">The paragraph style name</param>
		/// <param name="updateAutoMarkers">True to update the auto numbered footnotes, false
		/// otherwise</param>
		/// <param name="book">Returns the first ScrBook</param>
		/// <param name="para">Returns paragraph containing footnote</param>
		/// <param name="insertPos">Returns position in paragraph where footnote
		/// was inserted</param>
		/// <returns>The inserted footnote</returns>
		/// ------------------------------------------------------------------------------------
		private ScrFootnote InsertTestFootnote(int howfar, string footnoteParaStyleId,
			bool updateAutoMarkers, out IScrBook book, out IStTxtPara para, out int insertPos)
		{
			//Exodus - book 0, doesn't have footnotes. This method will add one to it.
			book = m_scr.ScriptureBooksOS[0];
			IScrSection section = book.SectionsOS[0];
			para = (IStTxtPara)section.ContentOA.ParagraphsOS[0];

			insertPos = (int) (para.Contents.Length * ((double)howfar / 100));

			m_draftView.SetInsertionPoint(0, 0, 0, insertPos, false);
			SelectionHelper helper = SelectionHelper.Create(m_draftView);

			IgnorePropChanged ignorePropChanged = null;

			if (!updateAutoMarkers)
			{
				ignorePropChanged = new IgnorePropChanged(Cache,
					PropChangedHandling.SuppressChangeWatcher);
			}

			StFootnote footnote = m_draftView.InsertFootnote(helper, footnoteParaStyleId);

			if (ignorePropChanged != null)
				ignorePropChanged.Dispose();

			m_draftView.RefreshDisplay();
			return new ScrFootnote(footnote.Cache, footnote.Hvo);
		}
Esempio n. 2
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)
		{
			//Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
			// Must not be run more than once.
			if (IsDisposed)
				return;

			if (disposing)
			{
				// Dispose managed resources here.
				if (m_draftForm != null)
					m_draftForm.Dispose();
				if (m_IgnorePropChanged != null)
					m_IgnorePropChanged.Dispose();
			}

			// Dispose unmanaged resources here, whether disposing is true or false.
			m_draftForm = null;
			m_draftView = null; // Comes from m_draftForm, which is to dispose it.
			m_group = null;
			m_IgnorePropChanged = null;

			base.Dispose(disposing);
		}
Esempio n. 3
0
		public override void Exit()
		{
			CheckDisposed();

			m_draftView = null;
			m_draftForm.Close();
			m_draftForm = null;
			m_group = null;
			m_IgnorePropChanged.Dispose();
			m_IgnorePropChanged = null;

			// Restore prompt setting
			m_IgnorePropChanged.Dispose();
			base.Exit();
		}
Esempio n. 4
0
		public override void Initialize()
		{
			CheckDisposed();
			base.Initialize();

			m_draftForm = new DummyDraftViewForm();
			m_draftForm.DeleteRegistryKey();
			m_group = m_draftForm.CreateSyncDraftView(Cache);
			m_IgnorePropChanged = new IgnorePropChanged(Cache,
				PropChangedHandling.SuppressChangeWatcher);

			m_draftView = m_draftForm.DraftView;
			m_draftView.RootBox.MakeSimpleSel(true, true, false, true);

			Application.DoEvents();
		}
		public override void Exit()
		{
			CheckDisposed();

			m_draftView = null;
			m_draftForm.Close(); // Should dispose it.
			m_draftForm = null;

			// Restore prompt setting
			Options.ShowEmptyParagraphPromptsSetting = m_saveShowPrompts;
			m_IgnorePropChanged.Dispose();
			m_IgnorePropChanged = null;
			m_book = null;

			base.Exit();
		}
		public override void Initialize()
		{
			CheckDisposed();
			base.Initialize();

			// Save value of user prompt setting - restored in Cleanup.
			m_saveShowPrompts = Options.ShowEmptyParagraphPromptsSetting;
			Options.ShowEmptyParagraphPromptsSetting = false;

			m_draftForm = new DummyDraftViewForm();
			m_draftForm.DeleteRegistryKey();
			m_draftForm.CreateDraftView(Cache);
			m_IgnorePropChanged = new IgnorePropChanged(Cache,
				PropChangedHandling.SuppressChangeWatcher);

			//Application.DoEvents();
			//m_draftForm.Show();
			m_draftView = m_draftForm.DraftView;
			m_draftView.TeEditingHelper.InTestMode = true;
			m_scr.RestartFootnoteSequence = true;
			m_draftView.RootBox.MakeSimpleSel(true, true, false, true);

			Application.DoEvents();
		}