예제 #1
0
        internal unsafe void SetTabs(
            int         incrementalTab, 
            LsTbd*      tabStops, 
            int         tabStopCount
            ) 
        {
            Invariant.Assert(_ploc.Value != System.IntPtr.Zero);
            LsErr lserr = UnsafeNativeMethods.LoSetTabs(
                _ploc.Value, 
                incrementalTab,
                tabStopCount, 
                tabStops 
                );
 
            if(lserr != LsErr.None)
            {
                ThrowExceptionFromLsError(SR.Get(SRID.SetTabsFailure, lserr), lserr);
            } 
        }
예제 #2
0
        internal void SetTabs(TextFormatterContext context)
        {
            unsafe
            {
                ParaProp pap = _store.Pap;
                FormatSettings settings = _store.Settings;

                // set up appropriate tab stops
                int incrementalTab = TextFormatterImp.RealToIdeal(pap.DefaultIncrementalTab);
                int lsTbdCount = pap.Tabs != null ? pap.Tabs.Count : 0;
                LsTbd[] lsTbds;

                if (_markerStore != null)
                {
                    if (pap.Tabs != null && pap.Tabs.Count > 0)
                    {
                        lsTbdCount = pap.Tabs.Count + 1;
                        lsTbds = new LsTbd[lsTbdCount];
                        lsTbds[0].ur = settings.TextIndent; // marker requires a tab stop at text start position
                        fixed (LsTbd* plsTbds = &lsTbds[1])
                        {
                            CreateLsTbds(pap, plsTbds, lsTbdCount - 1);
                            context.SetTabs(incrementalTab, plsTbds - 1, lsTbdCount);
                        }
                    }
                    else
                    {
                        LsTbd markerRequiredLsTbd = new LsTbd();
                        markerRequiredLsTbd.ur = settings.TextIndent; // marker requires a tab stop at text start position
                        context.SetTabs(incrementalTab, &markerRequiredLsTbd, 1);
                    }
                }
                else
                {
                    if (pap.Tabs != null && pap.Tabs.Count > 0)
                    {
                        lsTbds = new LsTbd[lsTbdCount];
                        fixed (LsTbd* plsTbds = &lsTbds[0])
                        {
                            CreateLsTbds(pap, plsTbds, lsTbdCount);
                            context.SetTabs(incrementalTab, plsTbds, lsTbdCount);
                        }
                    }
                    else
                    {
                        // work with only incremental tab
                        context.SetTabs(incrementalTab, null, 0);
                    }
                }
            }
        }
예제 #3
0
        private unsafe void CreateLsTbds(
            ParaProp        pap,
            LsTbd*          plsTbds,
            int             lsTbdCount
            )
        {
            for (int i = 0; i < lsTbdCount; i++)
            {
                TextTabProperties tab = (TextTabProperties)pap.Tabs[i];
                plsTbds[i].lskt = Convert.LsKTabFromTabAlignment(tab.Alignment);
                plsTbds[i].ur = TextFormatterImp.RealToIdeal(tab.Location);

                if (tab.TabLeader != 0)
                {
                    // Note: LS does not currently support surrogate character as tab leader and aligning character
                    plsTbds[i].wchTabLeader = (char)tab.TabLeader;

                    // tab leader requires state at display time for tab leader width fetching
                    _statusFlags |= StatusFlags.KeepState;
                }
                plsTbds[i].wchCharTab = (char)tab.AligningCharacter;
            }
        }
예제 #4
0
 internal static unsafe extern LsErr LoSetTabs(
     IntPtr                  ploc,
     int                     durIncrementalTab,
     int                     tabCount,
     LsTbd*                  pTabs
     );