This commit is contained in:
Elena Subbotina
2024-08-20 08:39:02 +03:00
parent 8843c3dd36
commit 685165d270
2 changed files with 16 additions and 8 deletions

View File

@ -34,23 +34,31 @@
namespace DocFileFormat
{
BorderCode::BorderCode(): cv(0), dptLineWidth(0), brcType(0), ico( Global::ColorIdentifier[0] ), dptSpace(0), fShadow(false), fFrame(false), fNil(false)
BorderCode::BorderCode(): dptLineWidth(0), brcType(0), ico( Global::ColorIdentifier[0] ), dptSpace(0), fShadow(false), fFrame(false), fNil(false)
{
}
/// Parses the unsigned char for a BRC
BorderCode::BorderCode( unsigned char* bytes, int size ):
cv(0), dptLineWidth(0), brcType(0), ico( Global::ColorIdentifier[0] ), dptSpace(0), fShadow(false), fFrame(false), fNil(false)
dptLineWidth(0), brcType(0), ico( Global::ColorIdentifier[0] ), dptSpace(0), fShadow(false), fFrame(false), fNil(false)
{
if ( FormatUtils::ArraySum( bytes, size ) == ( size * 255 ) )
{
fNil = true;
}
else if ( size == 8 )
{
//it's a border code of Word 2000/2003
{ //it's a border code of Word 2000/2003
cv = FormatUtils::BytesToInt32( bytes, 0, size );
cv = cv & 0x00ffffff;
BYTE auto_ = GETBITS(*cv, 24, 31);
if (auto_ == 0)
{
BYTE B = GETBITS(*cv, 0, 7);
BYTE G = GETBITS(*cv, 8, 15);
BYTE R = GETBITS(*cv, 16, 23);
cv = (B << 16) + (G << 8) + (R);
}
else cv = boost::none;
ico = std::wstring( Global::ColorIdentifier[0] );
@ -104,9 +112,9 @@ namespace DocFileFormat
}
std::wstring BorderCode::getColor()
{
if (cv != 0)
if (cv)
{
return FormatUtils::IntToFormattedWideString(cv, L"#%06x");
return FormatUtils::IntToFormattedWideString(*cv, L"#%06x");
}
else if (false == ico.empty())
{