📄 globalrec.cpp
字号:
//Delete_Pointer(m_pCurrentData); m_pCurrentData = (CUnit*)(new CStyle(*style)); if(style != (--m_Styles.end())) {// if it was'nt the last font from the list, increment to get the next one style++; } else {// if it was the last from the list, change the DumpState m_DumpState = GLOBAL_BOUNDSHEETS; style = m_Styles.begin(); } } else {// if the list is empty, change the dump state. m_DumpState = GLOBAL_BOUNDSHEETS; //style = m_Styles.begin(); repeat = true; } break; } case GLOBAL_BOUNDSHEETS: // ********** STATE 7 ************* { repeat = false; XTRACE("\tBOUNDSHEETS"); if(!m_BoundSheets.empty()) {// First check if the list of fonts is not empty... //Delete_Pointer(m_pCurrentData); m_pCurrentData = (CUnit*)(new CBSheet(*bsheet)); if(bsheet != (--m_BoundSheets.end())) {// if it was'nt the last font from the list, increment to get the next one bsheet++; } else {// if it was the last from the list, change the DumpState m_DumpState = GLOBAL_EOF; bsheet = m_BoundSheets.begin(); } } else {// if the list is empty, change the dump state. m_DumpState = GLOBAL_EOF; bsheet = m_BoundSheets.begin(); repeat = true; } break; } case GLOBAL_EOF:// ********** STATE 8 ************* XTRACE("\tEOF"); repeat = false; //Delete_Pointer(m_pCurrentData); m_pCurrentData = (CUnit*)(new CEof()); m_DumpState = GLOBAL_FINISH; break; case GLOBAL_FINISH: // ********** STATE 9 ************* XTRACE("\tFINISH"); //Delete_Pointer(m_pCurrentData); m_pCurrentData = NULL; m_DumpState = GLOBAL_INIT; break; default: /* It shouldn't get here */ XTRACE("\tDEFAULT"); break; } }while(repeat); return m_pCurrentData;}/**********************************************************************************/void CGlobalRecords::AddBoundingSheet(unsigned32_t streampos, unsigned16_t attributes, string& sheetname, unsigned16_t biffversion){ boundsheet_t* bsheetdef = new boundsheet_t; bsheetdef->worksheet = (bool)((attributes & BSHEET_ATTR_WORKSHEET ) == BSHEET_ATTR_WORKSHEET ); bsheetdef->ex4macro = (bool)((attributes & BSHEET_ATTR_EX4MACRO ) == BSHEET_ATTR_EX4MACRO ); bsheetdef->chart = (bool)((attributes & BSHEET_ATTR_CHART ) == BSHEET_ATTR_CHART ); bsheetdef->vbmodule = (bool)((attributes & BSHEET_ATTR_VBMODULE ) == BSHEET_ATTR_VBMODULE ); bsheetdef->visible = (bool)((attributes & BSHEET_ATTR_VISIBLE ) == BSHEET_ATTR_VISIBLE ); bsheetdef->hidden = (bool)((attributes & BSHEET_ATTR_HIDDEN ) == BSHEET_ATTR_HIDDEN ); bsheetdef->veryhidden = (bool)((attributes & BSHEET_ATTR_VERYHIDDEN ) == BSHEET_ATTR_VERYHIDDEN); bsheetdef->sheetname = sheetname; bsheetdef->streampos = streampos; if(biffversion == VERSION_BIFF57) bsheetdef->biff8 = false; else bsheetdef->biff8 = true; m_BoundSheets.push_back(bsheetdef);}/**********************************************************************************/void CGlobalRecords::AddBoundingSheet(boundsheet_t* bsheetdef){ m_BoundSheets.push_back(bsheetdef);}/*****************************************It returns pointers to BoundingSheets one by one untilall are spanned, in which case the returned pointer is NULL*****************************************/void CGlobalRecords::GetBoundingSheets(Boundsheet_List_Itor_t& bs){ if(bs != m_BoundSheets.end()) bs++; else bs = m_BoundSheets.begin();}Boundsheet_List_Itor_t CGlobalRecords::GetFirstBoundSheet(){ return m_BoundSheets.begin();}Boundsheet_List_Itor_t CGlobalRecords::GetEndBoundSheet(){ return m_BoundSheets.end();}/**********************************************************************************/font_t* CGlobalRecords::AddFont(font_t* newfont ){ newfont->SetIndex(0x0000); pair<Font_Set_Itor_t, bool> itorpair = m_Fonts.insert(newfont); if(newfont != *itorpair.first) delete newfont; return(*itorpair.first);}/**********************************************************************************/format_t* CGlobalRecords::AddFormat(format_t* newformat ){ newformat->SetIndex(0x0000); m_Formats.push_back(newformat); return(m_Formats.back());}/**********************************************************************************/xf_t* CGlobalRecords::AddXFormat(xf_t* xf){ xf->SetIndex(0x0000); pair<XF_Set_Itor_t, bool> itorpair = m_XFs.insert(xf); if(xf != *itorpair.first) delete xf; return(*itorpair.first);}xf_t* CGlobalRecords::ReplaceXFormat(xf_t* xf, xf_t* xfnew){ XF_Set_Itor_t existing_xf; existing_xf = m_XFs.find(xf); xf_t* inserted = NULL; if(existing_xf != m_XFs.end()) { xf_t* todiexf = *existing_xf; m_XFs.erase(existing_xf); delete todiexf; pair<XF_Set_Itor_t, bool> itorpair = m_XFs.insert(xfnew); inserted = *itorpair.first; if(inserted != xfnew) delete xfnew; } else { // This should never happen // since the previous pointer is taken // from the container itself... but anyway pair<XF_Set_Itor_t, bool> itorpair = m_XFs.insert(xfnew); inserted = *itorpair.first; if(inserted != xfnew) delete xfnew; } return inserted;}font_t* CGlobalRecords::ReplaceFont(font_t* fnt, font_t* fntnew){ Font_Set_Itor_t existing_font; existing_font = m_Fonts.find(fnt); font_t *inserted = NULL; if(existing_font != m_Fonts.end()) { font_t* todiefont = *existing_font; m_Fonts.erase(existing_font); delete todiefont; pair<Font_Set_Itor_t, bool> itorpair = m_Fonts.insert(fntnew); inserted = *itorpair.first; if(inserted != fntnew) delete fntnew; } else { // This should never happen // since the previous pointer is taken // from the container itself... but anyway pair<Font_Set_Itor_t, bool> itorpair = m_Fonts.insert(fntnew); inserted = *itorpair.first; if(inserted != fntnew) delete fntnew; } return inserted;}font_t* CGlobalRecords::GetDefaultFont(void){ return *m_DefaultFonts.begin();}xf_t* CGlobalRecords::GetDefaultXF(void){ return m_DefaultXFs.back();}/*****************************************Maybe the implementation of this procedurecan be optimized.*****************************************/unsigned32_t CGlobalRecords::GetSize(void){ CUnit* pdata = NULL; unsigned32_t total_datasize = 0; bool keep = true; do { pdata = DumpData(); if(pdata != NULL) { total_datasize += pdata->GetDataSize(); delete pdata; } else { keep = false; } }while(keep); return total_datasize;} /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * $Log: globalrec.cpp,v $ * Revision 1.1.1.1 2004/08/27 16:31:56 darioglz * Initial Import. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -