Files
core/ASCOfficeDocFile/DocDocxConverter/DrawingObjectGrid.h

67 lines
2.4 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#pragma once
namespace DocFileFormat
{
class DrawingObjectGrid
{
friend class SettingsMapping;
private:
/// x-coordinate of the upper left-hand corner of the grid
short xaGrid;
/// y-coordinate of the upper left-hand corner of the grid
short yaGrid;
/// Width of each grid square
short dxaGrid;
/// Height of each grid square
short dyaGrid;
/// The number of grid squares (in the y direction) between each
/// gridline drawn on the screen. 0 means dont display any
/// gridlines in the y direction.
short dyGridDisplay;
/// Suppress display of gridlines
bool fTurnItOff;
/// The number of grid squares (in the x direction) between each
/// gridline drawn on the screen. 0 means dont display any
/// gridlines in the y direction.
short dxGridDisplay;
/// If true, the grid will start at the left and top margins and
/// ignore xaGrid and yaGrid
bool fFollowMargins;
public:
virtual ~DrawingObjectGrid()
{
}
DrawingObjectGrid():
xaGrid(0), yaGrid(0), dxaGrid(0), dyaGrid(0), dyGridDisplay(0), fTurnItOff(false), dxGridDisplay(0),
fFollowMargins(false)
{
}
/// Parses the bytes to retrieve a DrawingObjectGrid
DrawingObjectGrid( byte* bytes, int size ):
xaGrid(0), yaGrid(0), dxaGrid(0), dyaGrid(0), dyGridDisplay(0), fTurnItOff(false), dxGridDisplay(0),
fFollowMargins(false)
{
if ( size == 10 )
{
this->xaGrid = FormatUtils::BytesToInt16( bytes, 0, size );
this->yaGrid = FormatUtils::BytesToInt16( bytes, 2, size );
this->dxaGrid = FormatUtils::BytesToInt16( bytes, 4, size );
this->dyaGrid = FormatUtils::BytesToInt16( bytes, 6, size );
//split byte 8 and 9 into bits
this->dyGridDisplay = (short)FormatUtils::GetUIntFromBytesBits( ( bytes + 8 ), 2, 0, 7 );
this->fTurnItOff = FormatUtils::GetBitFromBytes( ( bytes + 8 ), 2, 7 );
this->dxGridDisplay = (short)FormatUtils::GetUIntFromBytesBits( ( bytes + 8 ), 2, 8, 7 );
this->fFollowMargins = FormatUtils::GetBitFromBytes( ( bytes + 8 ), 2, 15 );
}
else
{
//throw new ByteParseException("Cannot parse the struct DOGRID, the length of the struct doesn't match");
}
}
};
}