int main() { Book* book = xlCreateBook(); if(book) { Sheet* sheet = book->addSheet("Sheet1"); if(sheet) { sheet->writeStr(2, 1, "Hello, World !"); sheet->writeNum(3, 1, 1000); Format* dateFormat = book->addFormat(); dateFormat->setNumFormat(NUMFORMAT_DATE); sheet->writeNum(4, 1, book->datePack(2008, 4, 29), dateFormat); sheet->setCol(1, 1, 12); } if(book->save("example.xls")) std::cout << "\nFile example.xls has been created." << std::endl; book->release(); } std::cout << "\nPress any key to exit..."; _getch(); return 0; }
void pickUiSample(Sheet& sheet, Widget& selected) { const string name = selected.label(); if(sheet.stripe().sequence().size() > 0) sheet.clear(); if(name == "Dockspace") createUiTestDockspace(sheet); else if(name == "Window") createUiTestWindow(sheet); else if(name == "Filtered List") createUiTestFilteredList(sheet); else if(name == "Custom List") createUiTestCustomList(sheet); else if(name == "Text Editor") createUiTestTextEditor(sheet); else if(name == "Tabs") createUiTestTabs(sheet); else if(name == "Table") createUiTestTable(sheet); else if(name == "Tree") createUiTestTree(sheet); else if(name == "Controls") createUiTestControls(sheet); else if(name == "File Browser") createUiTestFileBrowser(sheet); else if(name == "File Tree") createUiTestFileTree(sheet); else if(name == "Progress Dialog") createUiTestProgressDialog(sheet); }
void ShowSheetCommand::redo() { Sheet* sheet = map->findSheet(sheetName); if (!sheet) return; sheet->hideSheet(false); }
void ShowSheetCommand::undo() { Sheet* sheet = map->findSheet(sheetName); if (!sheet) return; sheet->hideSheet(true); }
QColor Color::color() { if(isDirty()) { setDirty(false); QVariant v = definition(); //qfInfo() << v.toString() << "type:" << v.typeName(); if(v.type() == QVariant::String) { m_color.setNamedColor(v.toString()); if(!m_color.isValid()) { Sheet *ss = rootStyleSheet(); if(ss) { Color *pco = qobject_cast<Color*>(ss->styleObjectForName(SGColor, v.toString())); if(pco) m_color = pco->color(); } } } else if(v.type() == QVariant::Int) { m_color = QColor((Qt::GlobalColor)v.toInt()); } else { m_color = v.value<QColor>(); } } return m_color; }
void Image::drawFrame(const Sheet& sheet, int f, int x, int y, const Transform& transform, Screen& dest) { dest.bindImage(*this); dest.applyTransform(transform, x, y, sheet.getWidth(), sheet.getHeight()); drawFrameRaw(sheet, f, 0, 0, dest); dest.unbindImage(); }
void writeData() { std::string defs; fs::path defs_path = out_dir / (out_file_prepend + ".defs"); print(format("write directory = %s\n") % out_dir); print(format("write file prefix = \"%s\"\n") % out_file_prepend); if(!dry_run) fs::create_directories(out_dir); for(int i = 0; i < packer.numSheets(); i++) { Sheet *s = packer.getSheet(i); fs::path dst = out_dir / str(format("%s%03d.%s") % out_file_prepend % i % "png"); print(format("writing sheet to %s\n") % dst); s->saveImage(dst); defs += getSheetDefinitions(dst, s); } print(format("writing definitions to %s\n") % defs_path); if(!dry_run) { fs::ofstream out(defs_path); out << defs; if(out.fail()) print(format("failed to write %s\n") % defs_path, VERBOSE); } }
void NoteEntryAction::renderKeyboardPreview(QPainter& painter, const MusicCursor& cursor) { Staff* staff = cursor.staff(); Part* part = staff->part(); Sheet* sheet = part->sheet(); Bar* bar = sheet->bar(cursor.bar()); QPointF p = bar->position() + QPointF(0, staff->top()); Voice* voice = cursor.staff()->part()->voice(cursor.voice()); VoiceBar* vb = voice->bar(bar); if (cursor.element() >= vb->elementCount()) { // cursor is past last element in bar, position of cursor is // halfway between last element and end of bar if (vb->elementCount() == 0) { // unless entire voicebar is still empty p.rx() += 15.0; } else { VoiceElement* ve = vb->element(vb->elementCount()-1); p.rx() += (ve->x() + bar->size()) / 2; } } else { // cursor is on an element, get the position of that element p.rx() += vb->element(cursor.element())->x(); } p.ry() += (cursor.staff()->lineCount() - 1)* cursor.staff()->lineSpacing(); p.ry() -= cursor.staff()->lineSpacing() * cursor.line() / 2; m_tool->shape()->renderer()->renderNote(painter, m_duration < QuarterNote ? QuarterNote : m_duration, p, 0, Qt::magenta); }
int main() { Book* book = xlCreateBook(); if(book) { Font* font = book->addFont(); font->setName(L"Impact"); font->setSize(36); Format* format = book->addFormat(); format->setAlignH(ALIGNH_CENTER); format->setBorder(BORDERSTYLE_MEDIUMDASHDOTDOT); format->setBorderColor(COLOR_RED); format->setFont(font); Sheet* sheet = book->addSheet(L"Custom"); if(sheet) { sheet->writeStr(2, 1, L"Format", format); sheet->setCol(1, 1, 25); } if(book->save(L"format.xls")) { ::ShellExecute(NULL, L"open", L"format.xls", NULL, NULL, SW_SHOW); } } return 0; }
void GlobalsSubStreamHandler::handleBoundSheet(BoundSheetRecord* record) { if (!record) return; switch (record->sheetType()) { case BoundSheetRecord::Chart: // chartsheets are worksheets too case BoundSheetRecord::Worksheet: { // create a new sheet Sheet* sheet = new Sheet(d->workbook); sheet->setName(record->sheetName()); sheet->setVisible(record->sheetState() == BoundSheetRecord::Visible); d->workbook->appendSheet(sheet); if(record->sheetType() == BoundSheetRecord::Chart) d->chartSheets << sheet; // update bof position map unsigned bofPos = record->bofPosition(); d->bofMap[ bofPos ] = sheet; } break; default: std::cout << "GlobalsSubStreamHandler::handleBoundSheet: Unhandled type=" << record->sheetType() << std::endl; break; } }
void MainWindow::open(const QString &filename) { Sheet *childSheet = newSheet(); if (!childSheet->open(filename)) { childSheet->close(); } }
void ResizeColumn::slotDefault() { Sheet* sheet = m_selection->activeSheet(); if (!sheet) return; double points = sheet->map()->defaultColumnFormat()->width(); m_pWidth->setValue(m_selection->canvas()->unit().toUserValue(points)); }
void ResizeRow::slotDefault() { Sheet* sheet = m_selection->activeSheet(); if (!sheet) return; double points = sheet->map()->defaultRowFormat()->height(); m_pHeight->setValue(m_selection->canvas()->unit().toUserValue(points)); }
void ApplicationUI::onSheetPageClosed() { Page *page = qobject_cast<Page*>(sender()); Sheet *sheet = qobject_cast<Sheet*>(page->parent()); sheet->close(); sheet->deleteLater(); Application::instance()->setMenuEnabled(true); }
// handles SLOT from faq item void ApplicationUI::faqTriggered() { Sheet *s = Application::instance()->scene()->findChild<Sheet*>("faqSheet"); if (s) { qDebug() << "FAQ triggered and faqSheet found"; s->open(); } else { qDebug() << "FAQ triggered, but no faqSheet found"; } }
bool ProtoMaker::ReadExcel(std::string file_path, std::string output_path, std::string &err) { Book* book = xlCreateBook(); bool ret = true; if (!book) { err = "lib err"; return false; } if (!book->load(file_path.c_str())) { err = "load file failed. path: "; err.append(file_path); book->release(); return false; } int sheet_index = 0; Sheet* sheet = book->getSheet(sheet_index); NodeList node_list; while (sheet != nullptr) { if (!ReadStructDefine(sheet, node_list, err)) { book->release(); return false; } if (!ReadNameDefine(sheet, node_list, err)) { book->release(); return false; } sheet = book->getSheet(++sheet_index); } if(sheet) { size_t max_rows = sheet->lastRow(); size_t max_cols = sheet->lastCol(); for (size_t r=0; r<max_rows; ++r) { for( int c=0; c<max_cols; ++c) { //const wchar_t* s = sheet->readStr(r, c); //int n = sheet->readNum(r, c); } } } book->release(); return true; }
// handles SLOT from helpItem void ApplicationUI::helpTriggered() { Sheet *s = Application::instance()->scene()->findChild<Sheet*>("helpSheet"); if (s) { qDebug() << "help triggered and helpSheet found"; s->open(); } else { qDebug() << "help triggered, but no helpSheet found"; } }
/************************************************************** *** ** EphemView --- write *** ***************************************************************/ void EphemView::write() { //printf( "EphemView::write mode %d widget %ld swidget %ld twidget %ld\n", mode, (long)widget, (long)swidget, (long)twidget ); //printf( "EphemView::write mode %d month %d year %d\n", mode, month, year ); assert( mode >= 0 && mode < MAX_EPHEM_VIEWTYPES ); int ret = 0; expert->prepareMonth( month, year, isLocaltime ); if ( mode == 1 ) { assert( swidget ); Sheet *sheet = swidget->getSheet(); assert( sheet ); sheet->clear(); ret = expert->calcMonth(); SheetWidgetGrid *grid = new SheetWidgetGrid( 1, .5, 100, 100, 1600, 800 ); SheetWidgetItem *w = new GraphicalEphemWidgetItem( props, expert, max_deg, isLocaltime ); grid->addItem( w ); sheet->addItem( grid ); swidget->OnDataChanged(); } else { assert( twidget ); Sheet *sheet = twidget->getSheet(); sheet->clear(); switch ( mode ) { case 2: expert->writeDetails( sheet ); break; case 3: ret = expert->writeIngress( sheet ); break; case 4: expert->writeLunar( sheet ); break; case 5: expert->writeKp( sheet, dasaId ); break; default: ret = expert->writeLongitudes( sheet ); break; } twidget->OnDataChanged(); } Refresh(); if ( ret ) { wxCommandEvent event( SHOW_EPHEM_FILE_WARNING ); event.SetEventObject( (wxWindow*)this ); wxPostEvent( GetParent(), event ); } }
// handles SLOT from about item void ApplicationUI::aboutTriggered() { Sheet *s = Application::instance()->scene()->findChild<Sheet*>( "aboutSheet"); if (s) { qDebug() << "about triggered and aboutSheet found"; s->open(); } else { qDebug() << "about triggered, but no aboutSheet found"; } }
int oogo_sheet_cpy_text(sheet_c s, int x, int y, char* buf, int len) { try { Sheet *sheet = (Sheet*) s.sheet; sheet->copyText(x, y, buf, len); return 0; } catch (Exception &e) { oogo_ebuf_e(e); return 1; } }
// handles SLOT from feedbackItem void OpenDataSpace::feedbackTriggered() { Sheet *s = Application::instance()->scene()->findChild<Sheet*>( "feedbackSheet"); if (s) { qDebug() << "feedback triggered and Feedback Sheet found"; s->open(); } else { qDebug() << "feedback triggered, but no Feedback Sheet found"; } }
int oogo_sheet_set_text(sheet_c s, int x, int y, const char* text) { try { Sheet *sheet = (Sheet*) s.sheet; sheet->setText(x, y, string(text)); return 0; } catch (Exception &e) { oogo_ebuf_e(e); return 1; } }
int oogo_sheet_get_text_l(sheet_c s, int x, int y, int* l) { try { Sheet *sheet = (Sheet*) s.sheet; *l = sheet->getTextLen(x, y); return 0; } catch (Exception &e) { oogo_ebuf_e(e); return 1; } }
int oogo_sheet_get_v(sheet_c s, int x, int y, double* num) { try { Sheet *sheet = (Sheet*) s.sheet; *num = sheet->getValue(x, y); return 0; } catch (Exception &e) { oogo_ebuf_e(e); return 0; } }
int oogo_sheet_set_formula(sheet_c s, int x, int y, const char* val) { try { Sheet *sheet = (Sheet*) s.sheet; sheet->setFormula(x, y, string(val)); return 0; } catch (Exception &e) { oogo_ebuf_e(e); return 1; } }
int oogo_sheet_set_v(sheet_c s, int x, int y, double num) { try { Sheet *sheet = (Sheet*) s.sheet; sheet->setValue(x, y, num); return 0; } catch (Exception &e) { oogo_ebuf_e(e); return 1; } }
int oogo_sheet_end_r_l(sheet_c s, int* col, int* row) { try { Sheet *sheet = (Sheet*) s.sheet; sheet->end_r_l(col, row); return 0; } catch (Exception &e) { oogo_ebuf_e(e); return 1; } }
// handles SLOT from settingsItem void ApplicationUI::settingsTriggered() { Sheet *s = Application::instance()->scene()->findChild<Sheet*>( "preferencesSheet"); if (s) { qDebug() << "preferences triggered and preferencesSheet found"; s->open(); } else { qDebug() << "preferences triggered, but no FpreferencesSheet found"; } }
Sheet* MainWindow::newSheet() { Sheet *childSheet = new Sheet(tabWidget); tabWidget->addTab(childSheet, childSheet->getShortTitle()); tabWidget->setCurrentWidget(childSheet); updateActions(); connect(childSheet, SIGNAL(statusEvent(QString)), this, SLOT(setStatusBarText(QString))); connect(childSheet, SIGNAL(titleChanged()), this, SLOT(updateTabsTitle())); return childSheet; }
QList<KoShape*> PrintJob::shapesOnPage(int pageNumber) { // This method is called only for page preparation; to determine the shapes to wait for. int sheetPageNumber = pageNumber; Sheet* sheet = d->getSheetPageNumber(&sheetPageNumber); if (!sheet) return QList<KoShape*>(); const QRect cellRange = d->printManager(sheet)->cellRange(sheetPageNumber); return shapeManager()->shapesAt(sheet->cellCoordinatesToDocument(cellRange)); }