OfficeArtClientTextbox.h 1.64 KB
Newer Older
Alexey.Golubev's avatar
Alexey.Golubev committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
#pragma once

#include "Common.h"

#include "OfficeArtRecordHeader.h"
#include "IOfficeArtRecord.h"

namespace OfficeArt
{
	class OfficeArtClientTextbox : public IOfficeArtRecord
	{
	private:
		static const byte SIZE_IN_BYTES = 12;
	public:

		OfficeArtClientTextbox (): rh(0x0, 0x0, 0xF00D, 0x00000004), clienttextbox(0)
		{
			memset( bytes, 0, SIZE_IN_BYTES );
		}

		OfficeArtClientTextbox (unsigned short textbox) : rh(0x0, 0x0, 0xF00D, 0x00000004), clienttextbox(textbox)
		{
			memset( bytes, 0, SIZE_IN_BYTES );

			unsigned int offset = 0;

			memcpy( ( bytes + offset ), (byte*)(rh), sizeof(rh) );
			offset += sizeof(rh);

			unsigned short nNum	= 0;
			
			memcpy( ( bytes + offset ), &(nNum), sizeof(unsigned short));
			offset += sizeof(unsigned short );
			
			memcpy( ( bytes + offset ), &(clienttextbox), sizeof(unsigned short));
		}

		OfficeArtClientTextbox (const OfficeArtClientTextbox& data) : rh (data.rh), clienttextbox (data.clienttextbox)
		{
			memset(bytes, 0, SIZE_IN_BYTES);
			memcpy(bytes, data.bytes, SIZE_IN_BYTES);
		}

		virtual operator const byte* () const
		{
			return (const byte*)(&bytes);
		}

		virtual operator byte* () const
		{
			return (byte*)(&bytes);
		}

		virtual unsigned int Size() const
		{
			return sizeof(bytes);
		}

		virtual IOfficeArtRecord* New() const
		{
			return new OfficeArtClientTextbox;
		}

		virtual IOfficeArtRecord* Clone() const
		{
			return new OfficeArtClientTextbox(*this);
		}

	protected:

		OfficeArtRecordHeader	rh;

		unsigned short 			clienttextbox;		//	text identifier of the shape
		byte					bytes[SIZE_IN_BYTES];
	};
}