Commit dce58b62 authored by ElenaSubbotina's avatar ElenaSubbotina

fix bug #36322

parent bae85402
......@@ -33,6 +33,8 @@
#include "IMapping.h"
#define GETBITS(from, numL, numH) ((from & (((1 << (numH - numL + 1)) - 1) << numL)) >> numL)
namespace DocFileFormat
{
class IVisitable
......
......@@ -462,10 +462,18 @@ namespace DocFileFormat
void PropertiesMapping::appendShading( XMLTools::XMLElement* parent, const ShadingDescriptor& desc )
{
std::wstring pattern = getShadingPattern( desc );
if ( ( parent != NULL ) && ( desc.shadingSpecialValue == shadingSpecialValueNormal ))
{
XMLTools::XMLElement shd( L"w:shd" );
//pattern
XMLTools::XMLAttribute val( L"w:val" );
val.SetValue( pattern);
shd.AppendAttribute( val );
if (pattern != L"nil")
{
//fill color
XMLTools::XMLAttribute fill( L"w:fill" );
......@@ -507,12 +515,7 @@ namespace DocFileFormat
}
shd.AppendAttribute( color );
//pattern
XMLTools::XMLAttribute val( L"w:val" );
val.SetValue( getShadingPattern( desc ));
shd.AppendAttribute( val );
}
parent->RemoveChildByName( L"w:shd" );
parent->AppendChild( shd );
}
......
......@@ -174,9 +174,9 @@ namespace DocFileFormat
//it's a Word 97 SPRM
short val = FormatUtils::BytesToInt16(bytes, 0, size);
icoFore = (val & 0x1F);
icoBack = ((val >> 5) & 0x1F);
ipat = (ShadingPattern) ((val >> 10) & 0x3F);
icoFore = GETBITS(val, 0, 4);
icoBack = GETBITS(val, 5, 9);
ipat = (ShadingPattern) GETBITS(val, 10, 15);
shadingType = shadingTypeShd80;
......@@ -209,7 +209,7 @@ namespace DocFileFormat
else if (0x0F == icoFore) { cvFore = RGB2 (0x80, 0x80, 0x80); }
else if (0x10 == icoFore) { cvFore = RGB2 (0xC0, 0xC0, 0xC0); }
if (0x00 == icoBack) { cvBack = RGB2 (0x00, 0x00, 0x00); cvBackAuto = true; }
if (0x00 == icoBack) { cvBack = RGB2 (0xFF, 0xFF, 0xFF); cvBackAuto = true; }
else if (0x01 == icoBack) { cvBack = RGB2 (0x00, 0x00, 0x00); }
else if (0x02 == icoBack) { cvBack = RGB2 (0x00, 0x00, 0xFF); }
else if (0x03 == icoBack) { cvBack = RGB2 (0x00, 0xFF, 0xFF); }
......
......@@ -349,7 +349,7 @@ namespace DocFileFormat
void TableCellPropertiesMapping::apppendCellShading (unsigned char* sprmArg, int size, int cellIndex)
{
if (sprmArg)
if (sprmArg && cellIndex >= 0)
{
//shading descriptor can have 10 bytes (Word 2000) or 2 bytes (Word 97)
int shdLength = 2;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment