Пример #1
0
 /**
  * Creates a PageSettingsBlock with default settings
  */
 public PageSettingsBlock()
 {
     _plsRecords = new List<PLSAggregate>();
     _rowBreaksRecord = new HorizontalPageBreakRecord();
     _columnBreaksRecord = new VerticalPageBreakRecord();
     header = new HeaderRecord(string.Empty);
     footer = new FooterRecord(string.Empty);
     _hCenter = CreateHCenter();
     _vCenter = CreateVCenter();
     printSetup = CreatePrintSetup();
 }
Пример #2
0
 /**
  * Creates a PageSettingsBlock with default settings
  */
 public PageSettingsBlock()
 {
     _rowBreaksRecord = new HorizontalPageBreakRecord();
     _columnBreaksRecord = new VerticalPageBreakRecord();
     _rowRecords = new ArrayList();
     header = CreateHeader();
     footer = CreateFooter();
     _hCenter = CreateHCenter();
     _vCenter = CreateVCenter();
     printSetup = CreatePrintSetup();
 }
Пример #3
0
 public override void Dispose()
 {
     _rowBreaksRecord = null;
     _columnBreaksRecord = null;
     header = null;
     footer = null;
     _hCenter = null;
     _vCenter = null;
     _leftMargin = null;
     _rightMargin = null;
     _topMargin = null;
     _bottomMargin = null;
     _pls = null;
     printSetup = null;
     _bitmap = null;
 }
Пример #4
0
        /**
         * Shifts all the page breaks in the range "count" number of rows/columns
         * @param breaks The page record to be shifted
         * @param start Starting "main" value to shift breaks
         * @param stop Ending "main" value to shift breaks
         * @param count number of units (rows/columns) to shift by
         */
        private static void ShiftBreaks(PageBreakRecord breaks, int start, int stop, int count) {

		IEnumerator iterator = breaks.GetBreaksEnumerator();
		IList shiftedBreak = new ArrayList();
		while(iterator.MoveNext())
		{
			PageBreakRecord.Break breakItem = (PageBreakRecord.Break)iterator.Current;
			int breakLocation = breakItem.main;
			bool inStart = (breakLocation >= start);
			bool inEnd = (breakLocation <= stop);
			if(inStart && inEnd)
				shiftedBreak.Add(breakItem);
		}

		iterator = shiftedBreak.GetEnumerator();
		while (iterator.MoveNext()) {
			PageBreakRecord.Break breakItem = (PageBreakRecord.Break)iterator.Current;
			breaks.RemoveBreak(breakItem.main);
			breaks.AddBreak((short)(breakItem.main+count), breakItem.subFrom, breakItem.subTo);
		}
	}
Пример #5
0
 private static void VisitIfPresent(PageBreakRecord r, RecordVisitor rv)
 {
     if (r != null)
     {
         if (r.IsEmpty)
         {
             // its OK to not serialize empty page break records
             return;
         }
         rv.VisitRecord(r);
     }
 }
Пример #6
0
 private bool ReadARecord(RecordStream rs)
 {
     switch (rs.PeekNextSid())
     {
         case HorizontalPageBreakRecord.sid:
             CheckNotPresent(_rowBreaksRecord);
             _rowBreaksRecord = (PageBreakRecord)rs.GetNext();
             break;
         case VerticalPageBreakRecord.sid:
             CheckNotPresent(_columnBreaksRecord);
             _columnBreaksRecord = (PageBreakRecord)rs.GetNext();
             break;
         case HeaderRecord.sid:
             CheckNotPresent(header);
             header = (HeaderRecord)rs.GetNext();
             break;
         case FooterRecord.sid:
             CheckNotPresent(footer);
             footer = (FooterRecord)rs.GetNext();
             break;
         case HCenterRecord.sid:
             CheckNotPresent(_hCenter);
             _hCenter = (HCenterRecord)rs.GetNext();
             break;
         case VCenterRecord.sid:
             CheckNotPresent(_vCenter);
             _vCenter = (VCenterRecord)rs.GetNext();
             break;
         case LeftMarginRecord.sid:
             CheckNotPresent(_leftMargin);
             _leftMargin = (LeftMarginRecord)rs.GetNext();
             break;
         case RightMarginRecord.sid:
             CheckNotPresent(_rightMargin);
             _rightMargin = (RightMarginRecord)rs.GetNext();
             break;
         case TopMarginRecord.sid:
             CheckNotPresent(_topMargin);
             _topMargin = (TopMarginRecord)rs.GetNext();
             break;
         case BottomMarginRecord.sid:
             CheckNotPresent(_bottomMargin);
             _bottomMargin = (BottomMarginRecord)rs.GetNext();
             break;
         case UnknownRecord.PLS_004D: // PLS
             _plsRecords.Add(new PLSAggregate(rs));
             break;
         case PrintSetupRecord.sid:
             CheckNotPresent(printSetup);
             printSetup = (PrintSetupRecord)rs.GetNext();
             break;
         case UnknownRecord.BITMAP_00E9: // BITMAP
             CheckNotPresent(_bitmap);
             _bitmap = rs.GetNext();
             break;
         case PrintSizeRecord.sid:
             CheckNotPresent(_printSize);
             _printSize = rs.GetNext();
             break;
         case HeaderFooterRecord.sid:
             HeaderFooterRecord hf = (HeaderFooterRecord)rs.GetNext();
             if (hf.IsCurrentSheet)
                 _headerFooter = hf;
             else
                 _sviewHeaderFooters.Add(hf);
             break;
         default:
             // all other record types are not part of the PageSettingsBlock
             return false;
     }
     return true;
 }
Пример #7
0
 private bool ReadARecord(RecordStream rs)
 {
     switch (rs.PeekNextSid())
     {
         case HorizontalPageBreakRecord.sid:
             _rowBreaksRecord = (PageBreakRecord)rs.GetNext();
             _rowRecords.Add(_rowBreaksRecord);
             break;
         case VerticalPageBreakRecord.sid:
             _columnBreaksRecord = (PageBreakRecord)rs.GetNext();
             _rowRecords.Add(_columnBreaksRecord);
             break;
         case HeaderRecord.sid:
             header = (HeaderRecord)rs.GetNext();
             _rowRecords.Add(header);
             break;
         case FooterRecord.sid:
             footer = (FooterRecord)rs.GetNext();
             _rowRecords.Add(footer);
             break;
         case HCenterRecord.sid:
             _hCenter = (HCenterRecord)rs.GetNext();
             _rowRecords.Add(_hCenter);
             break;
         case VCenterRecord.sid:
             _vCenter = (VCenterRecord)rs.GetNext();
             _rowRecords.Add(_vCenter);
             break;
         case LeftMarginRecord.sid:
             _leftMargin = (LeftMarginRecord)rs.GetNext();
             _rowRecords.Add(_leftMargin);
             break;
         case RightMarginRecord.sid:
             _rightMargin = (RightMarginRecord)rs.GetNext();
             _rowRecords.Add(_rightMargin);
             break;
         case TopMarginRecord.sid:
             _topMargin = (TopMarginRecord)rs.GetNext();
             _rowRecords.Add(_topMargin);
             break;
         case BottomMarginRecord.sid:
             _bottomMargin = (BottomMarginRecord)rs.GetNext();
             _rowRecords.Add(_bottomMargin);
             break;
         case 0x004D: // PLS
             _pls = rs.GetNext();
             _rowRecords.Add(_pls);
             break;
         case PrintSetupRecord.sid:
             printSetup = (PrintSetupRecord)rs.GetNext();
             _rowRecords.Add(printSetup);
             break;
         case 0x00E9: // BITMAP
             _bitmap = rs.GetNext();
             _rowRecords.Add(_bitmap);
             break;
         default:
             // all other record types are not part of the PageSettingsBlock
             return false;
     }
     return true;
 }
Пример #8
0
        /**
         * Shifts all the page breaks in the range "count" number of rows/columns
         * @param breaks The page record to be Shifted
         * @param start Starting "main" value to Shift breaks
         * @param stop Ending "main" value to Shift breaks
         * @param count number of Units (rows/columns) to Shift by
         */
        public void ShiftBreaks(PageBreakRecord breaks, short start, short stop, int count)
        {

            if (rowBreaks == null)
                return;
            IEnumerator iterator = breaks.GetBreaksEnumerator();
            IList ShiftedBreak = new ArrayList();
            while (iterator.MoveNext())
            {
                PageBreakRecord.Break breakItem = (PageBreakRecord.Break)iterator.Current;
                int breakLocation = breakItem.main;
                bool inStart = (breakLocation >= start);
                bool inEnd = (breakLocation <= stop);
                if (inStart && inEnd)
                    ShiftedBreak.Add(breakItem);
            }

            iterator = ShiftedBreak.GetEnumerator();
            while (iterator.MoveNext())
            {
                PageBreakRecord.Break breakItem = (PageBreakRecord.Break)iterator.Current;
                breaks.RemoveBreak(breakItem.main);
                breaks.AddBreak(breakItem.main + count, breakItem.subFrom, breakItem.subTo);
            }
        }