Exemplo n.º 1
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 virtual void Dispose(bool disposing)
        {
            //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
            // Must not be run more than once.
            if (m_isDisposed)
            {
                return;
            }

            if (disposing)
            {
            }
            if (m_cpe != null)
            {
                if (Marshal.IsComObject(m_cpe))
                {
                    Marshal.ReleaseComObject(m_cpe);
                }
                m_cpe = null;
            }
            m_cache       = null;
            m_ParaStyle   = null;
            m_ParaStrBldr = null;
            m_ParaProps   = null;

            m_isDisposed = true;
        }
Exemplo n.º 2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Add a hard line break to separate this segment from the previous one. Then insert
		/// this segment as a new run.
		/// </summary>
		/// <param name="bldr">The STRING builder.</param>
		/// <param name="titleParaStyleProxy">The paragraph style proxy of the current title
		/// paragraph.</param>
		/// <param name="props">The text props to use for hard line break character and also
		/// paragraph text if current segment is a paragraph segment.</param>
		/// ------------------------------------------------------------------------------------
		private void AddBookTitleSegment(ITsStrBldr bldr,
			IParaStylePropsProxy titleParaStyleProxy, ITsTextProps props)
		{
			// Add a hard line break, if we have text
			if (bldr.Length > 0)
			{
				// First trim trailing space if necessary
				string s = bldr.Text;
				if (UnicodeCharProps.get_IsSeparator(s[s.Length - 1]))
					bldr.Replace(s.Length - 1, s.Length, null, null);

				AddTextToPara(kHardLineBreak, props, bldr);
			}
			if (m_styleProxy == titleParaStyleProxy)
				AddTextToPara(m_sSegmentText, props, bldr);
			else
				AddTextToPara(m_sSegmentText, m_styleProxy.TsTextProps, bldr);
		}
Exemplo n.º 3
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 virtual void Dispose(bool disposing)
		{
			//Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
			// Must not be run more than once.
			if (m_isDisposed)
				return;

			if (disposing)
			{
			}
			if (m_cpe != null)
			{
				if (Marshal.IsComObject(m_cpe))
					Marshal.ReleaseComObject(m_cpe);
				m_cpe = null;
			}
			m_cache = null;
			m_ParaStyle = null;
			m_ParaStrBldr = null;
			m_ParaProps = null;

			m_isDisposed = true;
		}