Ejemplo n.º 1
0
        /**
         * Creates a PartagraphProperties object from a papx stored in the
         * StyleDescription at the index istd in the StyleDescription array. The PAP
         * is placed in the StyleDescription at istd after its been Created. Not
         * every StyleDescription will contain a papx. In these cases this function
         * does nothing
         *
         * @param istd The index of the StyleDescription to create the
         *        ParagraphProperties  from (and also place the finished PAP in)
         */
        private void CreatePap(int istd)
        {
            StyleDescription    sd  = _styleDescriptions[istd];
            ParagraphProperties pap = sd.GetPAP();

            byte[] papx      = sd.GetPAPX();
            int    baseIndex = sd.GetBaseStyle();

            if (pap == null && papx != null)
            {
                ParagraphProperties parentPAP = new ParagraphProperties();
                if (baseIndex != NIL_STYLE)
                {
                    parentPAP = _styleDescriptions[baseIndex].GetPAP();
                    if (parentPAP == null)
                    {
                        if (baseIndex == istd)
                        {
                            // Oh dear, style claims that it is its own parent
                            throw new InvalidOperationException("Pap style " + istd + " claimed to have itself as its parent, which isn't allowed");
                        }
                        // Create the parent style
                        CreatePap(baseIndex);
                        parentPAP = _styleDescriptions[baseIndex].GetPAP();
                    }
                }

                pap = ParagraphSprmUncompressor.UncompressPAP(parentPAP, papx, 2);
                sd.SetPAP(pap);
            }
        }
Ejemplo n.º 2
0
        public ParagraphProperties GetParagraphProperties(StyleSheet ss)
        {
            if (ss == null)
            {
                // TODO Fix up for Word 6/95
                return(new ParagraphProperties());
            }

            short istd = GetIstd();
            ParagraphProperties baseStyle = ss.GetParagraphStyle(istd);
            ParagraphProperties props     = ParagraphSprmUncompressor.UncompressPAP(baseStyle, GetGrpprl(), 2);

            return(props);
        }