コード例 #1
0
        private IntPtr CreatePTSContext(int index, TextFormattingMode textFormattingMode)
        {
            PtsHost ptsHost = this._contextPool[index].PtsHost;

            Invariant.Assert(ptsHost != null);
            IntPtr installedObjects;
            int    installedObjectsCount;

            this.InitInstalledObjectsInfo(ptsHost, ref this._contextPool[index].SubtrackParaInfo, ref this._contextPool[index].SubpageParaInfo, out installedObjects, out installedObjectsCount);
            this._contextPool[index].InstalledObjects = installedObjects;
            this.InitGenericInfo(ptsHost, (IntPtr)(index + 1), installedObjects, installedObjectsCount, ref this._contextPool[index].ContextInfo);
            this.InitFloaterObjInfo(ptsHost, ref this._contextPool[index].FloaterInit);
            this.InitTableObjInfo(ptsHost, ref this._contextPool[index].TableobjInit);
            if (this._contextPool[index].IsOptimalParagraphEnabled)
            {
                TextFormatterContext textFormatterContext = new TextFormatterContext();
                TextPenaltyModule    textPenaltyModule    = textFormatterContext.GetTextPenaltyModule();
                IntPtr ptsPenaltyModule = textPenaltyModule.DangerousGetHandle();
                this._contextPool[index].TextPenaltyModule            = textPenaltyModule;
                this._contextPool[index].ContextInfo.ptsPenaltyModule = ptsPenaltyModule;
                this._contextPool[index].TextFormatter = TextFormatter.CreateFromContext(textFormatterContext, textFormattingMode);
                GC.SuppressFinalize(this._contextPool[index].TextPenaltyModule);
            }
            IntPtr result;

            PTS.Validate(PTS.CreateDocContext(ref this._contextPool[index].ContextInfo, out result));
            return(result);
        }