Exemple #1
0
        private void AddEditCell(IVwEnv vwenv, IVwCacheDa cda, int i)
        {
            XmlNode node = m_columns[i - 1];
            // Make a cell and embed an editable virtual string for the column.
            var editable = XmlUtils.GetOptionalBooleanAttributeValue(node, "editable", true);

            if (!editable)
            {
                vwenv.set_IntProperty((int)FwTextPropType.ktptBackColor, (int)FwTextPropVar.ktpvDefault, NoEditBackgroundColor);
            }
            vwenv.OpenTableCell(1, 1);
            int flid = XMLViewsDataCache.ktagEditColumnBase + i;
            int ws   = WritingSystemServices.GetWritingSystem(m_cache, node, null,
                                                              m_cache.ServiceLocator.WritingSystems.DefaultAnalysisWritingSystem.Handle).Handle;

            // Paragraph directionality must be set before the paragraph is opened.
            bool fRTL = IsWsRTL(ws);

            vwenv.set_IntProperty((int)FwTextPropType.ktptRightToLeft,
                                  (int)FwTextPropVar.ktpvEnum, fRTL ? -1 : 0);
            vwenv.set_IntProperty((int)FwTextPropType.ktptAlign,
                                  (int)FwTextPropVar.ktpvEnum,
                                  fRTL ? (int)FwTextAlign.ktalRight : (int)FwTextAlign.ktalLeft);

            // Fill in the cell with the virtual property.
            vwenv.OpenParagraph();
            vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
                                  (int)FwTextPropVar.ktpvEnum,
                                  editable ? (int)TptEditable.ktptIsEditable : (int)TptEditable.ktptNotEditable);
            vwenv.AddStringAltMember(flid, ws, this);
            vwenv.CloseParagraph();
            vwenv.CloseTableCell();
        }