Пример #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Used by constructor.
        /// Sets the text property vars for this proxy, from the name, type, and ws
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private void SetTextProps()
        {
            if (m_Context == ContextValues.EndMarker || m_sStyleName == null || m_sStyleName == string.Empty)
            {                   // props are not relevant for end markers or markers with no style name
                m_ttpRunProps  = m_ws == 0 ? null : StyleUtils.CharStyleTextProps(null, m_ws);
                m_rgbParaProps = null;
                return;
            }
            Debug.Assert(m_StyleType == StyleType.kstCharacter || m_StyleType == StyleType.kstParagraph);
            Debug.Assert(m_ws != 0);

            // For char style, the run props contain writing system & char style name; for para
            // style, they contain only the writing system.
            m_ttpRunProps = StyleUtils.CharStyleTextProps(
                (m_StyleType == StyleType.kstCharacter) ? m_sStyleName : null, m_ws);

            // For char style, the paragraph props are empty; for para style, they contain the
            // para style name.
            if (m_StyleType == StyleType.kstParagraph)
            {
                ITsTextProps props = StyleUtils.ParaStyleTextProps(m_sStyleName);
                using (ArrayPtr rgbFmtBufPtr = MarshalEx.ArrayToNative <byte>(kcbFmtBufMax))
                {
                    int nBytes = props.SerializeRgb(rgbFmtBufPtr, kcbFmtBufMax);
                    m_rgbParaProps = MarshalEx.NativeToArray <byte>(rgbFmtBufPtr, nBytes);
                }
            }
            else
            {
                m_rgbParaProps = null;
            }
        }