Esempio n. 1
0
        /**
         * Set a RtfHeaderFooter to be displayed at a certain position
         *
         * @param headerFooter The RtfHeaderFooter to display
         * @param displayAt The display location to use
         */
        public void SetHeaderFooter(RtfHeaderFooter headerFooter, int displayAt)
        {
            this.mode = MODE_MULTIPLE;
            headerFooter.SetRtfDocument(this.document);
            headerFooter.SetType(this.type);
            headerFooter.SetDisplayAt(displayAt);
            switch (displayAt)
            {
            case RtfHeaderFooter.DISPLAY_ALL_PAGES:
                headerAll = headerFooter;
                break;

            case RtfHeaderFooter.DISPLAY_FIRST_PAGE:
                headerFirst = headerFooter;
                break;

            case RtfHeaderFooter.DISPLAY_LEFT_PAGES:
                headerLeft = headerFooter;
                break;

            case RtfHeaderFooter.DISPLAY_RIGHT_PAGES:
                headerRight = headerFooter;
                break;
            }
        }
Esempio n. 2
0
 /**
  * Set that this RtfHeaderFooterGroup should have facing pages. If only
  * a header / footer for all pages exists, then it will be copied to the left
  * and right pages aswell.
  */
 public void SetHasFacingPages()
 {
     if (this.mode == MODE_SINGLE)
     {
         this.mode       = MODE_MULTIPLE;
         this.headerLeft = new RtfHeaderFooter(this.document, this.headerAll, RtfHeaderFooter.DISPLAY_LEFT_PAGES);
         this.headerLeft.SetType(this.type);
         this.headerRight = new RtfHeaderFooter(this.document, this.headerAll, RtfHeaderFooter.DISPLAY_RIGHT_PAGES);
         this.headerRight.SetType(this.type);
         this.headerAll = null;
     }
     else if (this.mode == MODE_MULTIPLE)
     {
         if (this.headerLeft == null && this.headerAll != null)
         {
             this.headerLeft = new RtfHeaderFooter(this.document, this.headerAll, RtfHeaderFooter.DISPLAY_LEFT_PAGES);
             this.headerLeft.SetType(this.type);
         }
         if (this.headerRight == null && this.headerAll != null)
         {
             this.headerRight = new RtfHeaderFooter(this.document, this.headerAll, RtfHeaderFooter.DISPLAY_RIGHT_PAGES);
             this.headerRight.SetType(this.type);
         }
         this.headerAll = null;
     }
 }
Esempio n. 3
0
 /**
  * Constructs a RtfHeaderGroup for a certain HeaderFooter
  *
  * @param doc The RtfDocument this RtfHeaderFooter belongs to
  * @param headerFooter The HeaderFooter to display
  * @param type The typ of RtfHeaderFooterGroup to create
  */
 public RtfHeaderFooterGroup(RtfDocument doc, HeaderFooter headerFooter, int type) : base(new Phrase(""), false)
 {
     this.document = doc;
     this.type     = type;
     this.mode     = MODE_SINGLE;
     headerAll     = new RtfHeaderFooter(doc, headerFooter, type, RtfHeaderFooter.DISPLAY_ALL_PAGES);
     headerAll.SetType(this.type);
 }
Esempio n. 4
0
 /**
  * Set that this RtfHeaderFooterGroup should have a title page. If only
  * a header / footer for all pages exists, then it will be copied to the
  * first page aswell.
  */
 public void SetHasTitlePage()
 {
     if (this.mode == MODE_SINGLE)
     {
         this.mode   = MODE_MULTIPLE;
         headerFirst = new RtfHeaderFooter(this.document, headerAll, RtfHeaderFooter.DISPLAY_FIRST_PAGE);
         headerFirst.SetType(this.type);
     }
 }
Esempio n. 5
0
 /**
  * Constructs a RtfHeaderFooter as a copy of an existing RtfHeaderFooter.
  * For internal use only.
  *
  * @param doc The RtfDocument this RtfHeaderFooter belongs to
  * @param headerFooter The RtfHeaderFooter to copy
  * @param displayAt The display location of this RtfHeaderFooter
  */
 protected internal RtfHeaderFooter(RtfDocument doc, RtfHeaderFooter headerFooter, int displayAt) : base(new Phrase(""), false)
 {
     this.document  = doc;
     this.content   = headerFooter.GetContent();
     this.displayAt = displayAt;
     for (int i = 0; i < this.content.Length; i++)
     {
         if (this.content[i] is IElement)
         {
             try {
                 this.content[i] = this.document.GetMapper().MapElement((IElement)this.content[i])[0];
             } catch (DocumentException) {
             }
         }
         if (this.content[i] is IRtfBasicElement)
         {
             ((IRtfBasicElement)this.content[i]).SetInHeader(true);
         }
     }
 }
Esempio n. 6
0
        /**
         * Set a HeaderFooter to be displayed at a certain position
         *
         * @param headerFooter The HeaderFooter to set
         * @param displayAt The display location to use
         */
        public void SetHeaderFooter(HeaderFooter headerFooter, int displayAt)
        {
            this.mode = MODE_MULTIPLE;
            switch (displayAt)
            {
            case RtfHeaderFooter.DISPLAY_ALL_PAGES:
                headerAll = new RtfHeaderFooter(this.document, headerFooter, this.type, displayAt);
                break;

            case RtfHeaderFooter.DISPLAY_FIRST_PAGE:
                headerFirst = new RtfHeaderFooter(this.document, headerFooter, this.type, displayAt);
                break;

            case RtfHeaderFooter.DISPLAY_LEFT_PAGES:
                headerLeft = new RtfHeaderFooter(this.document, headerFooter, this.type, displayAt);
                break;

            case RtfHeaderFooter.DISPLAY_RIGHT_PAGES:
                headerRight = new RtfHeaderFooter(this.document, headerFooter, this.type, displayAt);
                break;
            }
        }
Esempio n. 7
0
 /**
  * Constructs a RtfHeaderFooterGroup by copying the content of the original
  * RtfHeaderFooterGroup
  *
  * @param doc The RtfDocument this RtfHeaderFooter belongs to
  * @param headerFooter The RtfHeaderFooterGroup to copy
  * @param type The type of RtfHeaderFooterGroup to create
  */
 public RtfHeaderFooterGroup(RtfDocument doc, RtfHeaderFooterGroup headerFooter, int type) : base(new Phrase(""), false)
 {
     this.document = doc;
     this.mode     = headerFooter.GetMode();
     this.type     = type;
     if (headerFooter.GetHeaderAll() != null)
     {
         this.headerAll = new RtfHeaderFooter(this.document, headerFooter.GetHeaderAll(), RtfHeaderFooter.DISPLAY_ALL_PAGES);
     }
     if (headerFooter.GetHeaderFirst() != null)
     {
         this.headerFirst = new RtfHeaderFooter(this.document, headerFooter.GetHeaderFirst(), RtfHeaderFooter.DISPLAY_FIRST_PAGE);
     }
     if (headerFooter.GetHeaderLeft() != null)
     {
         this.headerLeft = new RtfHeaderFooter(this.document, headerFooter.GetHeaderLeft(), RtfHeaderFooter.DISPLAY_LEFT_PAGES);
     }
     if (headerFooter.GetHeaderRight() != null)
     {
         this.headerRight = new RtfHeaderFooter(this.document, headerFooter.GetHeaderRight(), RtfHeaderFooter.DISPLAY_RIGHT_PAGES);
     }
     SetType(this.type);
 }