static void add_worksheet(Workbook *wb, psiconv_sheet_worksheet psi_worksheet,int nr, psiconv_formula_list psi_formulas) { Sheet *sheet; char *sheet_name; GnmStyle *default_style; psiconv_sheet_grid_section grid; sheet_name = g_strdup_printf (_("Sheet%d"),nr); sheet = sheet_new (wb, sheet_name, 256, 65536); g_free (sheet_name); if (!sheet) return; /* Default layout */ default_style = gnm_style_new_default(); if (!default_style) { g_object_unref (sheet); return; } set_layout(default_style,psi_worksheet->default_layout); /* TODO: Add show_zeros */ grid = psi_worksheet->grid; if (grid) { sheet_row_set_default_size_pts (sheet, cm2pts (grid->default_row_height)); sheet_col_set_default_size_pts (sheet, cm2pts (grid->default_column_width)); if (grid->row_heights) set_row_heights (sheet, grid->row_heights); if (grid->column_heights) set_col_widths (sheet, grid->column_heights); } add_cells(sheet,psi_worksheet->cells,psi_formulas,default_style); /* TODO: What about the NULL? */ sheet_flag_recompute_spans(sheet); workbook_sheet_attach (wb, sheet); gnm_style_unref (default_style); }
static void set_row_heights (Sheet *sheet, psiconv_sheet_grid_size_list heights) { psiconv_u32 i; psiconv_sheet_grid_size psi_height; for (i = 0; i < psiconv_list_length(heights); i++) { if ((psi_height = psiconv_list_get (heights, i))) sheet_row_set_size_pts (sheet, psi_height->line_number, cm2pts (psi_height->size), TRUE); } }
static void set_col_widths (Sheet *sheet, psiconv_sheet_grid_size_list widths) { psiconv_u32 i; psiconv_sheet_grid_size psi_width; for (i = 0; i < psiconv_list_length(widths); i++) { if ((psi_width = psiconv_list_get (widths, i))) sheet_col_set_size_pts (sheet, psi_width->line_number, cm2pts (psi_width->size), TRUE); } }
double ShapePlug::parseUnit(const QString &unit) { QString sCM(unitGetUntranslatedStrFromIndex(SC_CM)); QString sMM(unitGetUntranslatedStrFromIndex(SC_MM)); QString sIN(unitGetUntranslatedStrFromIndex(SC_IN)); QString sPT(unitGetUntranslatedStrFromIndex(SC_PT)); QString sPX("px"); bool noUnit = false; QString unitval(unit); if( unit.right( 2 ) == sPT ) unitval.replace( sPT, "" ); else if( unit.right( 2 ) == sCM ) unitval.replace( sCM, "" ); else if( unit.right( 2 ) == sMM ) unitval.replace( sMM , "" ); else if( unit.right( 2 ) == sIN ) unitval.replace( sIN, "" ); else if( unit.right( 2 ) == sPX ) unitval.replace( sPX, "" ); if (unitval == unit) noUnit = true; double value = ScCLocale::toDoubleC(unitval); if( unit.right( 2 ) == sPT ) {}/* value = value; */ //no change else if( unit.right( 2 ) == sCM ) { value = cm2pts(value); Conversion = 1/unitGetRatioFromIndex(SC_CM); } else if( unit.right( 2 ) == sMM ) { value = mm2pts(value); Conversion = 1/unitGetRatioFromIndex(SC_MM); } else if( unit.right( 2 ) == sIN ) { value = in2pts(value); Conversion = 1/unitGetRatioFromIndex(SC_IN); } else if( unit.right( 2 ) == sPX ) { value = value * 0.8; Conversion = 0.8; } else if(noUnit) {}/* value = value; */ //no change return value; }