Esempio n. 1
0
void WorksheetSubStreamHandler::handleRecord(Record* record)
{
    if (!record) return;

    const unsigned type = record->rtti();

    if (type == BottomMarginRecord::id)
        handleBottomMargin(static_cast<BottomMarginRecord*>(record));
    else if (type == BoolErrRecord::id)
        handleBoolErr(static_cast<BoolErrRecord*>(record));
    else if (type == BlankRecord::id)
        handleBlank(static_cast<BlankRecord*>(record));
    else if (type == CalcModeRecord::id)
        handleCalcMode(static_cast<CalcModeRecord*>(record));
    else if (type == ColInfoRecord::id)
        handleColInfo(static_cast<ColInfoRecord*>(record));
    else if (type == DataTableRecord::id)
        handleDataTable(static_cast<DataTableRecord*>(record));
    else if (type == FormulaRecord::id)
        handleFormula(static_cast<FormulaRecord*>(record));
    else if (type == FooterRecord::id)
        handleFooter(static_cast<FooterRecord*>(record));
    else if (type == HeaderRecord::id)
        handleHeader(static_cast<HeaderRecord*>(record));
    else if (type == LabelRecord::id)
        handleLabel(static_cast<LabelRecord*>(record));
    else if (type == LabelSSTRecord::id)
        handleLabelSST(static_cast<LabelSSTRecord*>(record));
    else if (type == LeftMarginRecord::id)
        handleLeftMargin(static_cast<LeftMarginRecord*>(record));
    else if (type == MergedCellsRecord::id)
        handleMergedCells(static_cast<MergedCellsRecord*>(record));
    else if (type == MulBlankRecord::id)
        handleMulBlank(static_cast<MulBlankRecord*>(record));
    else if (type == MulRKRecord::id)
        handleMulRK(static_cast<MulRKRecord*>(record));
    else if (type == NumberRecord::id)
        handleNumber(static_cast<NumberRecord*>(record));
    else if (type == RightMarginRecord::id)
        handleRightMargin(static_cast<RightMarginRecord*>(record));
    else if (type == RKRecord::id)
        handleRK(static_cast<RKRecord*>(record));
    else if (type == RowRecord::id)
        handleRow(static_cast<RowRecord*>(record));
    else if (type == RStringRecord::id)
        handleRString(static_cast<RStringRecord*>(record));
    else if (type == SharedFormulaRecord::id)
        handleSharedFormula(static_cast<SharedFormulaRecord*>(record));
    else if (type == StringRecord::id)
        handleString(static_cast<StringRecord*>(record));
    else if (type == TopMarginRecord::id)
        handleTopMargin(static_cast<TopMarginRecord*>(record));
    else if (type == HLinkRecord::id)
        handleHLink(static_cast<HLinkRecord*>(record));
    else if (type == NoteRecord::id)
        handleNote(static_cast<NoteRecord*>(record));
    else if (type == ObjRecord::id)
        handleObj(static_cast<ObjRecord*>(record));
    else if (type == TxORecord::id)
        handleTxO(static_cast<TxORecord*>(record));
    else if (type == BOFRecord::id)
        handleBOF(static_cast<BOFRecord*>(record));
    else if (type == DefaultRowHeightRecord::id)
        handleDefaultRowHeight(static_cast<DefaultRowHeightRecord*>(record));
    else if (type == DefaultColWidthRecord::id)
        handleDefaultColWidth(static_cast<DefaultColWidthRecord*>(record));
    else if (type == SetupRecord::id)
        handleSetup(static_cast<SetupRecord*>(record));
    else if (type == HCenterRecord::id)
        handleHCenter(static_cast<HCenterRecord*>(record));
    else if (type == VCenterRecord::id)
        handleVCenter(static_cast<VCenterRecord*>(record));
    else if (type == ZoomLevelRecord::id)
        handleZoomLevel(static_cast<ZoomLevelRecord*>(record));
    else if (type == 0xA) {} //EofRecord
    else if (type == DimensionRecord::id)
        handleDimension(static_cast<DimensionRecord*>(record));
    else if (type == MsoDrawingRecord::id)
        handleMsoDrawing(static_cast<MsoDrawingRecord*>(record));
    else if (type == Window2Record::id)
        handleWindow2(static_cast<Window2Record*>(record));
    else if (type == PasswordRecord::id)
        handlePassword(static_cast<PasswordRecord*>(record));
    else if (type == BkHimRecord::id)
        handleBkHim(static_cast<BkHimRecord*>(record));
    else if (type == VerticalPageBreaksRecord::id)
        handleVerticalPageBreaksRecord(static_cast<VerticalPageBreaksRecord*>(record));
    else if (type == HorizontalPageBreaksRecord::id)
        handleHorizontalPageBreaksRecord(static_cast<HorizontalPageBreaksRecord*>(record));
    else if (type == CondFmtRecord::id)
        handleCondFmtRecord(static_cast<CondFmtRecord*>(record));
    else if (type == CFRecord::id)
        handleCFRecord(static_cast<CFRecord*>(record));
    else {
        //std::cout << "Unhandled worksheet record with type=" << type << " name=" << record->name() << std::endl;
    }
}
Esempio n. 2
0
/*
 * dispHelp
 */
static int dispHelp( char *str, VTAB *tab )
{
    EVENT               ev;
    bool                done;
    int                 lastline;
    int                 start;
    SAREA               use;
    SAREA               line;
    char                helpname[81];

    ignoreMouseRelease = true;
    helpSet( str, helpname, sizeof( helpname ) );
    if( uivopen( &helpScreen ) == NULL )
        return( HELP_NO_VOPEN );

    use.height = helpScreen.area.height - 3;
    use.width = helpScreen.area.width;
    use.col = 0;

    line.height = 1;
    line.width = helpScreen.area.width;
    line.col = 0;

    topPos = HelpTell( helpFileHdl );
    mygetline();

    handleHeader( &start, &line );
    use.row = start;
    use.height -= start;
    handleFooter( &start, &use, &line );
    setupScrollBar( &use );

    if( helpLines > 0 ) {
        maxPos = helpLines + 1;
        helpPos = HelpMemAlloc( maxPos * sizeof( *helpPos ) );
    } else {
        maxPos = 0;
        helpPos = NULL;
    }
    maxLine = 0;
    lastHelpLine = 0;
    save_line( 0, topPos );
    currLine = helpStack->line;
    seek_line( currLine );
    lastline = currLine + use.height;
    done = false;
    ev = EV_NO_EVENT;
    while( !done ) {
        currentColour = C_PLAIN;
        currentAttr = AT( ATTR_NORMAL );
        if( lastline != currLine ) {
            lastline = scrollHelp( &use, lastline, ( ev != EV_NO_EVENT ) );
        }
        ev = hlpwait( tab );
        switch( ev ) {
        case E_UP:
        case EV_CURSOR_UP:
        case EV_TOP:
            if( currLine > 0 ) {
                --currLine;
            }
            break;
        case E_DOWN:
        case EV_CURSOR_DOWN:
        case EV_BOTTOM:
            ++currLine;
            if( maxLine != 0 && currLine+use.height > maxLine ) {
                --currLine;
            }
            break;
        case EV_SCROLL_VERTICAL:
            currLine = vGadget.pos;
            break;
        case EV_PAGE_UP:
            currLine -= use.height;
            if( currLine < 0 ) {
                currLine = 0;
            }
            break;
        case EV_PAGE_DOWN:
            currLine += use.height;
            if( maxLine != 0 && currLine >= maxLine ) {
                currLine -= use.height;
            }
            break;
        default:
            done = true;
            break;
        }
    }
    clearline();
    uivclose( &helpScreen );
    if( helpPos != NULL ) {
        HelpMemFree( helpPos );
        helpPos = NULL;
    }
    return( HELP_OK );
}