예제 #1
0
void SST::writeFields(CFRecord& record)
{
	record << cstTotal << cstUnique;

	std::list<CFRecordPtr>& recs = continue_records[rt_Continue];
	for (BiffStructurePtrVector::iterator it = rgb.begin(), itEnd = rgb.end(); it != itEnd ; ++it)
	{
		XLUnicodeRichExtendedStringPtr element = boost::dynamic_pointer_cast<XLUnicodeRichExtendedString>(*it);
		if(!element)
		{
			throw;// EXCEPT::LE::WrongAPIUsage("boost::shared_dynamic_cast failed to cast to XLUnicodeRichExtendedStringPtr", __FUNCTION__);
		}
		CFRecord& current_record = recs.size() ? *recs.back() : record; // Points to the original 'record' or the last created 'Continue'

		_UINT32 ssss;
		if(!current_record.checkFitWriteSafe(ssss = element->getNonVariablePartSize())) // If we cannot write non-variable part into the current record
		{
			current_record.commitData();
			CFRecordPtr cont_record(new CFRecord(rt_Continue, record.getGlobalWorkbookInfo()));
			recs.push_back(cont_record);
			*cont_record << *element;
		}
		else
		{
			current_record << *element;
		}
	}
	if(recs.size())
	{
		recs.back()->commitData();
	}
}
예제 #2
0
void PtgRefErr3d::loadFields(CFRecord& record)
{
	global_info = record.getGlobalWorkbookInfo();

	record >> ixti;
	record.skipNunBytes(4); // unused
}
예제 #3
0
파일: String.cpp 프로젝트: ONLYOFFICE/core
void String::readFields(CFRecord& record)
{
	if (record.getGlobalWorkbookInfo()->Version < 0x0600)
	{
		LPAnsiString s;
		record >> s;
		string = s;
	}
예제 #4
0
void WriteAccess::readFields(CFRecord& record)
{
	if (record.getGlobalWorkbookInfo()->Version < 0x0600)
	{
		ShortXLAnsiString name;
		record >> name;

		userName = name;
	}
예제 #5
0
void DefColWidth::readFields(CFRecord& record)
{
	GlobalWorkbookInfoPtr global_info = record.getGlobalWorkbookInfo();
	record >> cchdefColWidth;

	if (!global_info->sheets_info.empty())
	{
		global_info->sheets_info.back().defaultColumnWidth = cchdefColWidth ;
	}
}
예제 #6
0
파일: RK.cpp 프로젝트: ONLYOFFICE/core
void RK::readFields(CFRecord& record)
{
	global_info_ = record.getGlobalWorkbookInfo();

	Rw rw;
	Col col;
	
	record >> rw >> col;
	record >> rkrec;
	
	cell = Cell(rw, col, rkrec.get_ixfe());
}
예제 #7
0
파일: Label.cpp 프로젝트: ShockwaveNN/core
void Label::readFields(CFRecord& record)
{
	global_info_ = record.getGlobalWorkbookInfo();
	
	record >> cell;
	
	if (global_info_->Version < 0x0600)
	{
		LPAnsiString name;
		record >> name;
		
		st = name;
	}
예제 #8
0
파일: Footer.cpp 프로젝트: ShockwaveNN/core
void Footer::readFields(CFRecord& record)
{
	if(!record.isEOF())
	{
		if (record.getGlobalWorkbookInfo()->Version < 0x0600)
		{
			ShortXLAnsiString name;
			record >> name;
			
			ast = name;
		}
		else
		{	
예제 #9
0
void StyleXF::load(CFRecord& record)
{
	m_GlobalWorkbookInfo = record.getGlobalWorkbookInfo();

	if (m_GlobalWorkbookInfo->Version < 0x0600)
	{
		_UINT16 flags1;
		_UINT32 flags2;
		_UINT32 flags3;

		record >> flags1 >> flags2 >> flags3;
		
		alc					= static_cast<unsigned char>(GETBITS(flags1, 0, 2));
		fWrap				= GETBIT(flags1, 3);
		alcV				= static_cast<unsigned char>(GETBITS(flags1, 4, 6));
		fJustLast			= GETBIT(flags1, 7);
		trot				= 0;//static_cast<unsigned char>(GETBITS(flags1, 8, 15));	
		cIndent				= 0;//static_cast<unsigned char>(GETBITS(flags1, 16, 19));
		fShrinkToFit		= 0;//GETBIT(flags1, 20);
		iReadOrder			= 0;//static_cast<unsigned char>(GETBITS(flags1, 22, 23));

		char orient			= GETBITS(flags1, 8, 10);
		
		switch(orient)
		{
			case 0:	trot = 0;		break;		// Text orientation: not rotated.
			case 1: trot = 0xff;	break;		// Text orientation: vertically stacked.
			case 2: trot = 90;		break;		// Text orientation: 90 deg counterclockwise.
			case 3: trot = 270;		break;		// Text orientation: 90 deg clockwise.
		}	

		fill.fls = static_cast<unsigned char>(GETBITS(flags2, 16, 21));
		
		fill.icvFore = GETBITS(flags2, 0, 6);
		fill.icvBack = GETBITS(flags2, 7, 13);
		
		border.dgTop		= static_cast<unsigned char>(GETBITS(flags3, 0, 2));
		border.dgLeft		= static_cast<unsigned char>(GETBITS(flags3, 3, 5));
		border.dgRight		= static_cast<unsigned char>(GETBITS(flags3, 6, 8));		
		border.dgBottom		= static_cast<unsigned char>(GETBITS(flags2, 22, 24));	
		border.dgDiag		= 0;
		border.grbitDiag	= 0;

		border.icvLeft		= (0 != border.dgLeft)	? static_cast<unsigned char>(GETBITS(flags3, 16, 22))	: 0;
		border.icvRight		= (0 != border.dgRight)	? static_cast<unsigned char>(GETBITS(flags3, 23, 29))	: 0;
		border.icvTop		= (0 != border.dgTop)	? static_cast<unsigned char>(GETBITS(flags3,  9, 15))	: 0;
		border.icvBottom	= (0 != border.dgBottom)? static_cast<unsigned char>(GETBITS(flags2, 25, 31))	: 0;
		border.icvDiag		= 0;
	}
예제 #10
0
void ExternSheet::readFields(CFRecord& record)
{
	if (record.getGlobalWorkbookInfo()->Version < 0x0600)
	{
		unsigned char type;

		ShortXLAnsiString stName;
		record >> type >> stName;

		name = stName.value();
		//int type	= stName.value().substr(0, 1).c_str()[0];
		//if (!name.empty())
		//	record.getGlobalWorkbookInfo()->arExternalNames.push_back(name);

	}
예제 #11
0
void MulRk::readFields(CFRecord& record)
{
	global_info_ = record.getGlobalWorkbookInfo();

// A little hack to extract colLast before it is used
	record.skipNunBytes(record.getDataSize() - sizeof(unsigned short));
	record >> colLast;
	record.resetPointerToBegin();
//------------------
	record >> rw >> colFirst;
	for(unsigned short i = colFirst; i <= colLast; ++i)
	{
		RkRec rec;
		record >> rec;
		rgrkrec.push_back(RkRecPtr(new RkRec(rec)));
		cells.push_back(CellPtr(new Cell(rw, i, rec.get_ixfe())));
	}

	record.skipNunBytes(sizeof(unsigned short));
}
예제 #12
0
void PtgArea::loadFields(CFRecord& record)
{
	if (record.getGlobalWorkbookInfo()->Version < 0x600)
	{
		unsigned char	colFirst, colLast;
		_UINT16			rwFirst, rwLast;

		record >> rwFirst >> rwLast >> colFirst >> colLast;

		area.rowFirstRelative	= rwFirst & 0x8000;
		area.columnLastRelative	= rwFirst & 0x4000;
		
		area.columnFirst		= colFirst;
		area.rowFirst			= rwFirst & 0x3FFF;

		area.rowLastRelative	= rwLast & 0x8000;
		area.columnLastRelative	= rwLast & 0x4000;
		
		area.columnLast			= colLast;
		area.rowLast			= rwLast & 0x3FFF;
	}
예제 #13
0
void Palette::readFields(CFRecord& record)
{
	GlobalWorkbookInfoPtr global_info = record.getGlobalWorkbookInfo();
	
	unsigned short ccv;
	record >> ccv;
	
	for(int i = 0; i < 8; ++i)
	{	
		global_info->RegisterPaletteColor(i, standart_color[i].substr(2,6));
	}

	for(int i = 0; i < ccv; ++i)
	{
		LongRGBPtr rgb(new LongRGB);
		record >> *rgb;
		rgColor.push_back(rgb);

		global_info->RegisterPaletteColor(i+8, rgb->strRGB);
	}
}
예제 #14
0
파일: FtCmo.cpp 프로젝트: ShockwaveNN/core
void FtCmo::load(CFRecord& record)
{
	record.skipNunBytes(4); // reserved

	record >> ot >> id;
	
	if (record.getGlobalWorkbookInfo()->Version < 0x0600)
	{
		unsigned char flags;
		record >> flags;
		
		fLocked			= GETBIT(flags, 0);
		fDefaultSize	= GETBIT(flags, 2);
		fPublished		= GETBIT(flags, 3);
		fPrint			= GETBIT(flags, 4);
		fDisabled		= GETBIT(flags, 7);
		
		fUIObj			= false;
		fRecalcObj		= false;
		fRecalcObjAlways = false;
	}
예제 #15
0
void Text::readFields(CFRecord& record)
{
	unsigned short flags1;
	unsigned short flags2;
	record >> at  >> vat >> wBkgMode >> rgbText >> x >> y >> dx >> dy >> flags1;
	
	if (record.getGlobalWorkbookInfo()->Version < 0x0600)
	{
		int orient = GETBITS(flags1, 8, 10);
		switch(orient)
		{
			case 0:	trot = 0;		break;		// Text orientation: not rotated.
			case 1: trot = 0xff;	break;		// Text orientation: vertically stacked.
			case 2: trot = 90;		break;		// Text orientation: 90 deg counterclockwise.
			case 3: trot = 270;		break;		// Text orientation: 90 deg clockwise.
		}
	}
	else
	{
		record >> icvText >> flags2 >> trot;
		//icv -> from Palette
		dlp				= static_cast<unsigned char>(GETBITS(flags2, 0, 3));
		iReadingOrder	= static_cast<unsigned char>(GETBITS(flags2, 14, 15));
	}
	
	fAutoColor			= GETBIT(flags1, 0);
	fShowKey			= GETBIT(flags1, 1);
	fShowValue			= GETBIT(flags1, 2);
	fAutoText			= GETBIT(flags1, 4);
	fGenerated			= GETBIT(flags1, 5);
	fDeleted			= GETBIT(flags1, 6);
	fAutoMode			= GETBIT(flags1, 7);
	fShowLabelAndPerc	= GETBIT(flags1, 11);
	fShowPercent		= GETBIT(flags1, 12);
	fShowBubbleSizes	= GETBIT(flags1, 13);
	fShowLabel			= GETBIT(flags1, 14);

}
예제 #16
0
파일: Pls.cpp 프로젝트: ONLYOFFICE/core
void Pls::readFields(CFRecord& record)
{
	record.skipNunBytes(2); // reserved
	
	if (record.loadAnyData(rgb) == false) return;

	if (continue_records.size() > 0)
	{
		std::list<CFRecordPtr>& recs = continue_records[rt_Continue];

		if (recs.size())
		{
			while( !recs.empty() )
			{
				record.appendRawData(recs.front()->getData(), recs.front()->getDataSize());
				recs.pop_front();
			}
		}
	}

	int size			= record.getDataSize() - 2;
	const BYTE* data	= (BYTE*)record.getData() + 2;
	
	boost::shared_array<BYTE> buffer(new BYTE[size]);
    memcpy(buffer.get(), data, size);
	
	bin_data_id = -1;

	GlobalWorkbookInfo* globla_info = record.getGlobalWorkbookInfo().get();
	if (globla_info)
	{
		globla_info->bin_data.push_back(std::pair<boost::shared_array<BYTE>, size_t>(buffer, size));

		bin_data_id = globla_info->bin_data.size() - 1;
	}

	record.skipNunBytes(record.getDataSize() - record.getRdPtr()); // avoid size inconsistency warning
}
예제 #17
0
void Row::readFields(CFRecord& record)
{
	global_info_ = record.getGlobalWorkbookInfo();
	record >> rw >> colMic >> colMac >> miyRw;

	record.skipNunBytes(4); // reserved / unused

	unsigned short flags;
	record >> flags;
	
	iOutLevel	= GETBITS(flags, 0, 2);
	fCollapsed	= GETBIT(flags, 4);
	fDyZero		= GETBIT(flags, 5);
	fUnsynced	= GETBIT(flags, 6);
	fGhostDirty = GETBIT(flags, 7);

	record >> flags;

	ixfe_val	= GETBITS(flags, 0, 11);
	fExAsc		= GETBIT(flags, 12);
	fExDes		= GETBIT(flags, 13);
	fPhonetic	= GETBIT(flags, 14);
}
예제 #18
0
파일: XF.cpp 프로젝트: ONLYOFFICE/core
void XF::readFields(CFRecord& record)
{
	global_info = record.getGlobalWorkbookInfo();
	
	unsigned short	flags;
	FontIndex		ifnt;

	record >> ifnt >> ifmt >> flags;

	font_index = ifnt.getValue();
	
	if (font_index >= 0 && font_index < global_info->m_arFonts.size())
	{
		Font* pFont = dynamic_cast<Font*>(global_info->m_arFonts[font_index].get());
		if (pFont)
		{
			pFont->set(font);
		}
	}

	fLocked		= GETBIT(flags, 0);
	fHidden		= GETBIT(flags, 1);
	fStyle		= GETBIT(flags, 2);
	f123Prefix	= GETBIT(flags, 3);
	ixfParent	= GETBITS(flags, 4, 15);
	
	if (global_info->Version < 0x0600)
	{
		_UINT16 flags1;
		_UINT32 flags2;
		_UINT32 flags3;

		record >> flags1 >> flags2 >> flags3;
		
		alc					= GETBITS(flags1, 0, 2);
		fWrap				= GETBIT (flags1, 3);
		alcV				= GETBITS(flags1, 4, 6);
		fJustLast			= GETBIT (flags1, 7);
		trot				= 0;//static_cast<unsigned char>(GETBITS(flags1, 8, 15));	
		cIndent				= 0;//static_cast<unsigned char>(GETBITS(flags1, 16, 19));
		fShrinkToFit		= 0;//GETBIT(flags1, 20);
		iReadOrder			= 0;//static_cast<unsigned char>(GETBITS(flags1, 22, 23));
			
		char orient			= static_cast<unsigned char>(GETBITS(flags1, 8, 10));

		switch(orient)
		{
			case 0:	trot = 0;		break;		// Text orientation: not rotated.
			case 1: trot = 0xff;	break;		// Text orientation: vertically stacked.
			case 2: trot = 90;		break;		// Text orientation: 90 deg counterclockwise.
			case 3: trot = 270;		break;		// Text orientation: 90 deg clockwise.
		}
		if(!fStyle)
		{
			fAtrNum = GETBIT(flags2, 10);
			fAtrFnt = GETBIT(flags2, 11);
			fAtrAlc = GETBIT(flags2, 12);
			fAtrBdr = GETBIT(flags2, 13);
			fAtrPat = GETBIT(flags2, 14);
			fAtrProt = GETBIT(flags2, 15);
		}

		fill.fls = static_cast<unsigned char>(GETBITS(flags2, 16, 21));
		
		fill.icvFore = GETBITS(flags2, 0, 6);
		fill.icvBack = GETBITS(flags2, 7, 13);
		
		border.dgTop		= static_cast<unsigned char>(GETBITS(flags3, 0, 2));
		border.dgLeft		= static_cast<unsigned char>(GETBITS(flags3, 3, 5));
		border.dgRight		= static_cast<unsigned char>(GETBITS(flags3, 6, 8));		
		border.dgBottom		= static_cast<unsigned char>(GETBITS(flags2, 22, 24));	
		border.dgDiag		= 0;
		border.grbitDiag	= 0;
		
		border.icvTop		= (0 != border.dgTop)	? static_cast<unsigned char>(GETBITS(flags3,  9, 15))	: 0;
		border.icvLeft		= (0 != border.dgLeft)	? static_cast<unsigned char>(GETBITS(flags3, 16, 22))	: 0;
		border.icvRight		= (0 != border.dgRight)	? static_cast<unsigned char>(GETBITS(flags3, 23, 29))	: 0;
		border.icvBottom	= (0 != border.dgBottom)? static_cast<unsigned char>(GETBITS(flags2, 25, 31))	: 0;
		border.icvDiag		= 0;
	}