This commit is contained in:
Elena Subbotina
2024-07-24 18:36:10 +03:00
parent ccbeb28f8a
commit ff4425e977
9 changed files with 311 additions and 189 deletions

View File

@ -316,6 +316,9 @@ namespace DocFileFormat
//todooo oбъединить с shape_mapping //todooo oбъединить с shape_mapping
int nColorRGBBase = 0xffffff;
for (size_t i = 0; i < options.size(); i++) for (size_t i = 0; i < options.size(); i++)
{ {
ODRAW::OfficeArtFOPTEPtr & iter = options[i]; ODRAW::OfficeArtFOPTEPtr & iter = options[i];
@ -355,7 +358,7 @@ namespace DocFileFormat
if (!pict->brcBottom) if (!pict->brcBottom)
{ {
ODRAW::OfficeArtCOLORREF bottomColor((_UINT32)iter->op); ODRAW::OfficeArtCOLORREF bottomColor((_UINT32)iter->op);
m_context->_doc->CorrectColor(bottomColor); m_context->_doc->CorrectColor(bottomColor, nColorRGBBase);
if (false == bottomColor.sColorRGB.empty()) if (false == bottomColor.sColorRGB.empty())
m_pXmlWriter->WriteAttribute(L"o:borderbottomcolor", L"#" + bottomColor.sColorRGB); m_pXmlWriter->WriteAttribute(L"o:borderbottomcolor", L"#" + bottomColor.sColorRGB);
} }
@ -364,7 +367,7 @@ namespace DocFileFormat
if (!pict->brcLeft) if (!pict->brcLeft)
{ {
ODRAW::OfficeArtCOLORREF leftColor((_UINT32)iter->op); ODRAW::OfficeArtCOLORREF leftColor((_UINT32)iter->op);
m_context->_doc->CorrectColor(leftColor); m_context->_doc->CorrectColor(leftColor, nColorRGBBase);
if (false == leftColor.sColorRGB.empty()) if (false == leftColor.sColorRGB.empty())
m_pXmlWriter->WriteAttribute(L"o:borderleftcolor", L"#" + leftColor.sColorRGB); m_pXmlWriter->WriteAttribute(L"o:borderleftcolor", L"#" + leftColor.sColorRGB);
} }
@ -373,7 +376,7 @@ namespace DocFileFormat
if (!pict->brcRight) if (!pict->brcRight)
{ {
ODRAW::OfficeArtCOLORREF rightColor((_UINT32)iter->op); ODRAW::OfficeArtCOLORREF rightColor((_UINT32)iter->op);
m_context->_doc->CorrectColor(rightColor); m_context->_doc->CorrectColor(rightColor, nColorRGBBase);
if (false == rightColor.sColorRGB.empty()) if (false == rightColor.sColorRGB.empty())
m_pXmlWriter->WriteAttribute(L"o:borderrightcolor", L"#" + rightColor.sColorRGB); m_pXmlWriter->WriteAttribute(L"o:borderrightcolor", L"#" + rightColor.sColorRGB);
} }
@ -382,7 +385,7 @@ namespace DocFileFormat
if (!pict->brcTop) if (!pict->brcTop)
{ {
ODRAW::OfficeArtCOLORREF topColor((_UINT32)iter->op); ODRAW::OfficeArtCOLORREF topColor((_UINT32)iter->op);
m_context->_doc->CorrectColor(topColor); m_context->_doc->CorrectColor(topColor, nColorRGBBase);
if (false == topColor.sColorRGB.empty()) if (false == topColor.sColorRGB.empty())
m_pXmlWriter->WriteAttribute(L"o:bordertopcolor", L"#" + topColor.sColorRGB); m_pXmlWriter->WriteAttribute(L"o:bordertopcolor", L"#" + topColor.sColorRGB);
} }

View File

@ -323,15 +323,24 @@ namespace DocFileFormat
ODRAW::OfficeArtFOPTEPtr opConnectAngles; ODRAW::OfficeArtFOPTEPtr opConnectAngles;
ODRAW::OfficeArtFOPTEPtr opConnectLocs; ODRAW::OfficeArtFOPTEPtr opConnectLocs;
int nColorRGBBase = 0xffffff, nFillType = 0;
bool bFlipColors = false;
boost::optional<double> fill_left;
boost::optional<double> fill_top;
boost::optional<double> fill_right;
boost::optional<double> fill_bottom;
for (size_t i = 0; i < options.size(); i++) for (size_t i = 0; i < options.size(); i++)
{ {
ODRAW::OfficeArtFOPTEPtr & iter = options[i]; ODRAW::OfficeArtFOPTEPtr & iter = options[i];
switch (iter->opid) switch (iter->opid)
{ {
//BOOLEANS //BOOLEANS
case ODRAW::geometryBooleanProperties: case ODRAW::geometryBooleanProperties:
{ {
ODRAW::GeometryBooleanProperties *booleans = dynamic_cast<ODRAW::GeometryBooleanProperties*>(iter.get()); ODRAW::GeometryBooleanProperties* booleans = dynamic_cast<ODRAW::GeometryBooleanProperties*>(iter.get());
if (booleans->fUsefLineOK && !booleans->fLineOK) if (booleans->fUsefLineOK && !booleans->fLineOK)
{ {
bStroked = false; bStroked = false;
@ -352,7 +361,7 @@ namespace DocFileFormat
break; break;
case ODRAW::fillStyleBooleanProperties: case ODRAW::fillStyleBooleanProperties:
{ {
ODRAW::FillStyleBooleanProperties *booleans = dynamic_cast<ODRAW::FillStyleBooleanProperties *>(iter.get()); ODRAW::FillStyleBooleanProperties* booleans = dynamic_cast<ODRAW::FillStyleBooleanProperties*>(iter.get());
if (booleans->fUsefFilled && !booleans->fFilled) if (booleans->fUsefFilled && !booleans->fFilled)
{ {
bFilled = false; bFilled = false;
@ -365,7 +374,7 @@ namespace DocFileFormat
}break; }break;
case ODRAW::lineStyleBooleanProperties: case ODRAW::lineStyleBooleanProperties:
{ {
ODRAW::LineStyleBooleanProperties *booleans = dynamic_cast<ODRAW::LineStyleBooleanProperties *>(iter.get()); ODRAW::LineStyleBooleanProperties* booleans = dynamic_cast<ODRAW::LineStyleBooleanProperties*>(iter.get());
if (booleans->fUsefLine && !booleans->fLine) if (booleans->fUsefLine && !booleans->fLine)
{ {
bStroked = false; bStroked = false;
@ -383,14 +392,14 @@ namespace DocFileFormat
break; break;
case ODRAW::groupShapeBooleanProperties: case ODRAW::groupShapeBooleanProperties:
{ {
ODRAW::GroupShapeBooleanProperties *booleans = dynamic_cast<ODRAW::GroupShapeBooleanProperties *>(iter.get()); ODRAW::GroupShapeBooleanProperties* booleans = dynamic_cast<ODRAW::GroupShapeBooleanProperties*>(iter.get());
if (booleans->fUsefLayoutInCell) if (booleans->fUsefLayoutInCell)
{ {
layoutInCell = booleans->fLayoutInCell; layoutInCell = booleans->fLayoutInCell;
} }
} }
break; break;
// GEOMETRY // GEOMETRY
case ODRAW::shapePath: case ODRAW::shapePath:
{ {
bHavePath = true; bHavePath = true;
@ -483,7 +492,7 @@ namespace DocFileFormat
case ODRAW::lineColor: case ODRAW::lineColor:
{ {
ODRAW::OfficeArtCOLORREF lineColor((_UINT32)iter->op); ODRAW::OfficeArtCOLORREF lineColor((_UINT32)iter->op);
m_context->_doc->CorrectColor(lineColor); m_context->_doc->CorrectColor(lineColor, nColorRGBBase);
if (false == lineColor.sColorRGB.empty() && !pShape->fBackground) if (false == lineColor.sColorRGB.empty() && !pShape->fBackground)
m_pXmlWriter->WriteAttribute(L"strokecolor", (std::wstring(L"#") + lineColor.sColorRGB)); m_pXmlWriter->WriteAttribute(L"strokecolor", (std::wstring(L"#") + lineColor.sColorRGB));
}break; }break;
@ -542,18 +551,20 @@ namespace DocFileFormat
case 3: m_pXmlWriter->WriteAttribute(L"o:connectortype", L"none"); break; case 3: m_pXmlWriter->WriteAttribute(L"o:connectortype", L"none"); break;
} }
}break; }break;
// FILL // FILL
case ODRAW::fillColor: case ODRAW::fillColor:
{ {
ODRAW::OfficeArtCOLORREF fillColor((_UINT32)iter->op); ODRAW::OfficeArtCOLORREF fillColor((_UINT32)iter->op);
m_context->_doc->CorrectColor(fillColor); m_context->_doc->CorrectColor(fillColor, nColorRGBBase);
if (false == fillColor.sColorRGB.empty()) if (false == fillColor.sColorRGB.empty())
m_pXmlWriter->WriteAttribute(L"fillcolor", (std::wstring(L"#") + fillColor.sColorRGB)); m_pXmlWriter->WriteAttribute(L"fillcolor", (std::wstring(L"#") + fillColor.sColorRGB));
nColorRGBBase = fillColor.nColorRGB;
}break; }break;
case ODRAW::fillBackColor: case ODRAW::fillBackColor:
{ {
ODRAW::OfficeArtCOLORREF fillBackColor((_UINT32)iter->op); ODRAW::OfficeArtCOLORREF fillBackColor((_UINT32)iter->op);
m_context->_doc->CorrectColor(fillBackColor); m_context->_doc->CorrectColor(fillBackColor, nColorRGBBase);
if (false == fillBackColor.sColorRGB.empty()) if (false == fillBackColor.sColorRGB.empty())
appendValueAttribute(&m_fill, L"color2", (std::wstring(L"#") + fillBackColor.sColorRGB)); appendValueAttribute(&m_fill, L"color2", (std::wstring(L"#") + fillBackColor.sColorRGB));
@ -573,13 +584,47 @@ namespace DocFileFormat
}break; }break;
case ODRAW::fillFocus: case ODRAW::fillFocus:
{ {
appendValueAttribute(&m_fill, L"focus", (std::to_wstring(iter->op) + L"%")); appendValueAttribute(&m_fill, L"focus", (std::to_wstring(iter->op) + L"%"));
appendValueAttribute(&m_fill, L"focusposition", L".5, .5");
appendValueAttribute(&m_fill, L"focussize", L""); appendValueAttribute(&m_fill, L"focussize", L"");
}break; }break;
case ODRAW::fillType: case ODRAW::fillType:
{ {
appendValueAttribute(&m_fill, L"type", getFillType(iter->op)); nFillType = iter->op;
appendValueAttribute(&m_fill, L"type", getFillType(nFillType));
if (nFillType == 6)
{
fill_top = 0.5;
fill_left = 0.5;
}
//if (nFillType == 7) bFlipColors = true;
}break;
case ODRAW::fillToLeft:
{
ODRAW::FixedPoint* point = dynamic_cast<ODRAW::FixedPoint*>(iter.get());
if (point) fill_left = point->dVal;
}break;
case ODRAW::fillToTop:
{
ODRAW::FixedPoint* point = dynamic_cast<ODRAW::FixedPoint*>(iter.get());
if (point) fill_top = point->dVal;
}break;
case ODRAW::fillToRight:
{
ODRAW::FixedPoint* point = dynamic_cast<ODRAW::FixedPoint*>(iter.get());
if (point) fill_right = point->dVal;
}break;
case ODRAW::fillToBottom:
{
ODRAW::FixedPoint* point = dynamic_cast<ODRAW::FixedPoint*>(iter.get());
if (point) fill_bottom = point->dVal;
}break;
case ODRAW::fillRectLeft:
case ODRAW::fillRectTop:
case ODRAW::fillRectRight:
case ODRAW::fillRectBottom:
{
}break; }break;
case ODRAW::fillBlip: case ODRAW::fillBlip:
{ {
@ -630,7 +675,7 @@ namespace DocFileFormat
case ODRAW::shadowColor: case ODRAW::shadowColor:
{ {
ODRAW::OfficeArtCOLORREF shadowColor((_UINT32)iter->op); ODRAW::OfficeArtCOLORREF shadowColor((_UINT32)iter->op);
m_context->_doc->CorrectColor(shadowColor); m_context->_doc->CorrectColor(shadowColor, nColorRGBBase);
if (false == shadowColor.sColorRGB.empty()) if (false == shadowColor.sColorRGB.empty())
appendValueAttribute(&m_shadow, L"color", (std::wstring(L"#") + shadowColor.sColorRGB)); appendValueAttribute(&m_shadow, L"color", (std::wstring(L"#") + shadowColor.sColorRGB));
}break; }break;
@ -932,6 +977,18 @@ namespace DocFileFormat
} }
} }
if (fill_top || fill_left)
{
std::wstring focusposition;
if (fill_left) focusposition += FormatUtils::DoubleToFormattedWideString(*fill_left, L"%.2f");
if (fill_top)
{
focusposition += L",";
focusposition += FormatUtils::DoubleToFormattedWideString(*fill_top, L"%.2f");
}
appendValueAttribute(&m_fill, L"focusposition", focusposition);
}
ODRAW::PVertices* pVP = dynamic_cast<ODRAW::PVertices*>(opVerticles.get()); ODRAW::PVertices* pVP = dynamic_cast<ODRAW::PVertices*>(opVerticles.get());
ODRAW::PSegmentInfo* pSI = dynamic_cast<ODRAW::PSegmentInfo*>(opSegmentInfo.get()); ODRAW::PSegmentInfo* pSI = dynamic_cast<ODRAW::PSegmentInfo*>(opSegmentInfo.get());
if (pVP && pSI) if (pVP && pSI)

View File

@ -1029,14 +1029,40 @@ namespace DocFileFormat
return encodingChars; return encodingChars;
} }
} }
void WordDocument::CorrectColor(ODRAW::OfficeArtCOLORREF & color) void WordDocument::CorrectColor(ODRAW::OfficeArtCOLORREF & color, int base_color)
{ {
#if 0 struct _color
{
_color(unsigned char nR, unsigned char nG, unsigned char nB)
{
SetRGB(nR, nG, nB);
}
_color() {}
int nRGB = 0;
std::wstring sRGB;
int index = -1;
bool bScheme = false;
void SetRGB(unsigned char nR, unsigned char nG, unsigned char nB)
{
nRGB = (nR << 16) | (nG << 8) | nB;
sRGB = STR::toRGB(nR, nG, nB);
index = -1;
}
unsigned char GetB() { return (unsigned char)(nRGB); }
unsigned char GetG() { return (unsigned char)(nRGB >> 8); }
unsigned char GetR() { return (unsigned char)(nRGB >> 16); }
double opacity = 0;
};
if (false == color.sColorRGB.empty()) return; if (false == color.sColorRGB.empty()) return;
if (color.fSysIndex) if (color.fSysIndex)
{ {
oox::_color sys_color; _color sys_color;
_UINT32 nColorCode = color.index; _UINT32 nColorCode = color.index;
unsigned short nParameter = (unsigned short)((nColorCode >> 16) & 0x00ff); // the HiByte of nParameter is not zero, an exclusive AND is helping :o unsigned short nParameter = (unsigned short)((nColorCode >> 16) & 0x00ff); // the HiByte of nParameter is not zero, an exclusive AND is helping :o
@ -1045,17 +1071,20 @@ namespace DocFileFormat
unsigned short nColorIndex = (unsigned short)(nColorCode & 0x00ff); unsigned short nColorIndex = (unsigned short)(nColorCode & 0x00ff);
unsigned short nPropColor = 0; unsigned short nPropColor = 0;
_UINT32 systemColors[25] = _UINT32 systemColors[25] =
{ {
0xc0c0c0, 0x008080, 0x000080, 0x808080, 0xc0c0c0, 0xffffff, 0x000000, 0xc0c0c0, 0x008080, 0x000080, 0x808080, 0xc0c0c0, 0xffffff, 0x000000,
0x000000, 0x000000, 0xffffff, 0xc0c0c0, 0xc0c0c0, 0x808080, 0x000080, 0x000000, 0x000000, 0xffffff, 0xc0c0c0, 0xc0c0c0, 0x808080, 0x000080,
0xffffff, 0xc0c0c0, 0x808080, 0x808080, 0x000000, 0xc0c0c0, 0xffffff, 0xffffff, 0xc0c0c0, 0x808080, 0x808080, 0x000000, 0xc0c0c0, 0xffffff,
0x000000, 0xc0c0c0, 0x000000, 0xffffc0 0x000000, 0xc0c0c0, 0x000000, 0xffffc0
}; };
if (nColorIndex == 0xf0)
if (nColorIndex < 25)
{ {
sys_color.SetRGB((unsigned char)(systemColors[nColorIndex]>>16), (unsigned char)(systemColors[nColorIndex]>>8), (unsigned char)(systemColors[nColorIndex])); sys_color.SetRGB((unsigned char)(base_color), (unsigned char)(base_color >> 8), (unsigned char)(base_color >> 16));
}
else if (nColorIndex < 25)
{
sys_color.SetRGB((unsigned char)(systemColors[nColorIndex] >> 16), (unsigned char)(systemColors[nColorIndex] >> 8), (unsigned char)(systemColors[nColorIndex]));
} }
else return; else return;
@ -1083,7 +1112,7 @@ namespace DocFileFormat
BYTE B = static_cast<BYTE>((nInvParameter + (nParameter * sys_color.GetB())) >> 8); BYTE B = static_cast<BYTE>((nInvParameter + (nParameter * sys_color.GetB())) >> 8);
sys_color.SetRGB(R, G, B); sys_color.SetRGB(R, G, B);
}break; }break;
case 0x03: // add grey level RGB(p,p,p) case 0x03: // add grey level RGB(p,p,p)
{ {
short nR = (short)sys_color.GetR() + (short)nParameter; short nR = (short)sys_color.GetR() + (short)nParameter;
@ -1095,7 +1124,7 @@ namespace DocFileFormat
if (nB > 0x00ff) nB = 0x00ff; if (nB > 0x00ff) nB = 0x00ff;
sys_color.SetRGB((BYTE)nR, (BYTE)nG, (BYTE)nB); sys_color.SetRGB((BYTE)nR, (BYTE)nG, (BYTE)nB);
}break; }break;
case 0x04: // substract grey level RGB(p,p,p) case 0x04: // substract grey level RGB(p,p,p)
{ {
short nR = (short)sys_color.GetR() - (short)nParameter; short nR = (short)sys_color.GetR() - (short)nParameter;
@ -1105,7 +1134,7 @@ namespace DocFileFormat
if (nG < 0) nG = 0; if (nG < 0) nG = 0;
if (nB < 0) nB = 0; if (nB < 0) nB = 0;
sys_color.SetRGB((BYTE)nR, (BYTE)nG, (BYTE)nB); sys_color.SetRGB((BYTE)nR, (BYTE)nG, (BYTE)nB);
} break; } break;
case 0x05: // substract from gray level RGB(p,p,p) case 0x05: // substract from gray level RGB(p,p,p)
{ {
short nR = (short)nParameter - (short)sys_color.GetR(); short nR = (short)nParameter - (short)sys_color.GetR();
@ -1115,7 +1144,7 @@ namespace DocFileFormat
if (nG < 0) nG = 0; if (nG < 0) nG = 0;
if (nB < 0) nB = 0; if (nB < 0) nB = 0;
sys_color.SetRGB((BYTE)nR, (BYTE)nG, (BYTE)nB); sys_color.SetRGB((BYTE)nR, (BYTE)nG, (BYTE)nB);
}break; }break;
case 0x06: // per component: black if < p, white if >= p case 0x06: // per component: black if < p, white if >= p
{ {
BYTE R = sys_color.GetR() < nParameter ? 0x00 : 0xff; BYTE R = sys_color.GetR() < nParameter ? 0x00 : 0xff;
@ -1123,7 +1152,7 @@ namespace DocFileFormat
BYTE B = sys_color.GetB() < nParameter ? 0x00 : 0xff; BYTE B = sys_color.GetB() < nParameter ? 0x00 : 0xff;
sys_color.SetRGB(R, G, B); sys_color.SetRGB(R, G, B);
}break; }break;
} }
if (nAdditionalFlags & 0x40) // top-bit invert if (nAdditionalFlags & 0x40) // top-bit invert
sys_color.SetRGB(sys_color.GetR() ^ 0x80, sys_color.GetG() ^ 0x80, sys_color.GetB() ^ 0x80); sys_color.SetRGB(sys_color.GetR() ^ 0x80, sys_color.GetG() ^ 0x80, sys_color.GetB() ^ 0x80);
@ -1141,7 +1170,6 @@ namespace DocFileFormat
// color.sColorRGB = it->second; // color.sColorRGB = it->second;
// } // }
//} //}
#endif
} }
} }

View File

@ -69,11 +69,11 @@ namespace CRYPT
namespace DocFileFormat namespace DocFileFormat
{ {
class WordDocument: public IVisitable class WordDocument : public IVisitable
{ {
friend class FootnotesMapping; friend class FootnotesMapping;
friend class EndnotesMapping; friend class EndnotesMapping;
friend class CommentsMapping; friend class CommentsMapping;
friend class Converter; friend class Converter;
friend class CharacterPropertiesMapping; friend class CharacterPropertiesMapping;
friend class DocumentMapping; friend class DocumentMapping;
@ -94,16 +94,16 @@ namespace DocFileFormat
friend class WordprocessingDocument; friend class WordprocessingDocument;
public: public:
WordDocument (const std::wstring & tempFolder, const int userLCID); WordDocument(const std::wstring& tempFolder, const int userLCID);
virtual ~WordDocument(); virtual ~WordDocument();
_UINT32 LoadDocument(const std::wstring & fileName, const std::wstring & password); _UINT32 LoadDocument(const std::wstring& fileName, const std::wstring& password);
int nWordVersion; int nWordVersion;
int nDocumentCodePage; int nDocumentCodePage;
bool bDocumentCodePage; bool bDocumentCodePage;
int nFontsCodePage; int nFontsCodePage;
inline StructuredStorageReader* GetStorage() const inline StructuredStorageReader* GetStorage() const
{ {
return m_pStorage; return m_pStorage;
@ -115,16 +115,16 @@ namespace DocFileFormat
private: private:
bool LoadDocumentFlat(); bool LoadDocumentFlat();
bool DecryptOfficeFile (CRYPT::Decryptor* Decryptor); bool DecryptOfficeFile(CRYPT::Decryptor* Decryptor);
bool DecryptStream (std::wstring streamName_open, POLE::Storage* storageIn, std::wstring streamName_create, std::shared_ptr<CFCPP::CFStorage> storageOut, CRYPT::Decryptor* Decryptor, bool bDecrypt); bool DecryptStream(std::wstring streamName_open, POLE::Storage* storageIn, std::wstring streamName_create, std::shared_ptr<CFCPP::CFStorage> storageOut, CRYPT::Decryptor* Decryptor, bool bDecrypt);
void DecryptStream (int level, std::wstring streamName, POLE::Storage* storageIn, std::shared_ptr<CFCPP::CFStorage> storageOut, CRYPT::Decryptor* Decryptor); void DecryptStream(int level, std::wstring streamName, POLE::Storage* storageIn, std::shared_ptr<CFCPP::CFStorage> storageOut, CRYPT::Decryptor* Decryptor);
inline OfficeArtContent* GetOfficeArt () inline OfficeArtContent* GetOfficeArt()
{ {
return officeArtContent; return officeArtContent;
} }
inline int FindFileCharPos(int cp) inline int FindFileCharPos(int cp)
{ {
if (FIB->m_FibBase.fComplex) if (FIB->m_FibBase.fComplex)
@ -138,41 +138,41 @@ namespace DocFileFormat
else else
{ {
int fc = cp + FIB->m_FibBase.fcMin; int fc = cp + FIB->m_FibBase.fcMin;
if (fc > FIB->m_FibBase.fcMac) if (fc > FIB->m_FibBase.fcMac)
return -1; return -1;
return fc; return fc;
} }
} }
std::vector<wchar_t>* GetEncodingChars (int fcStart, int fcEnd); std::vector<wchar_t>* GetEncodingChars(int fcStart, int fcEnd);
std::vector<wchar_t>* GetChars (int fcStart, int fcEnd, int cp); std::vector<wchar_t>* GetChars(int fcStart, int fcEnd, int cp);
std::vector<int>* GetFileCharacterPositions ( int fcMin, int fcMax ); std::vector<int>* GetFileCharacterPositions(int fcMin, int fcMax);
std::vector<CharacterPropertyExceptions*>* GetCharacterPropertyExceptions ( int fcMin, int fcMax ); std::vector<CharacterPropertyExceptions*>* GetCharacterPropertyExceptions(int fcMin, int fcMax);
void Clear(); void Clear();
MS_LCID_converter m_lcidConverter; MS_LCID_converter m_lcidConverter;
std::wstring m_sFileName; std::wstring m_sFileName;
std::wstring m_sPassword; std::wstring m_sPassword;
std::wstring m_sTempFolder; std::wstring m_sTempFolder;
std::wstring m_sTempDecryptFileName; std::wstring m_sTempDecryptFileName;
int m_nUserLCID; int m_nUserLCID;
std::wstring m_sXmlApp; std::wstring m_sXmlApp;
std::wstring m_sXmlCore; std::wstring m_sXmlCore;
POLE::Stream * WordDocumentStream; // The stream "WordDocument" POLE::Stream* WordDocumentStream; // The stream "WordDocument"
POLE::Stream * TableStream; // The stream "0Table" or "1Table" POLE::Stream* TableStream; // The stream "0Table" or "1Table"
POLE::Stream * DataStream; // The stream called "Data" POLE::Stream* DataStream; // The stream called "Data"
StructuredStorageReader * m_pStorage; //POLE::Storage* Storage StructuredStorageReader* m_pStorage; //POLE::Storage* Storage
std::vector<wchar_t> * Text; // All text of the Word document std::vector<wchar_t>* Text; // All text of the Word document
std::vector<FormattedDiskPagePAPX*> * AllPapxFkps; // A list of all FKPs that contain PAPX std::vector<FormattedDiskPagePAPX*>* AllPapxFkps; // A list of all FKPs that contain PAPX
std::vector<FormattedDiskPageCHPX*> * AllChpxFkps; // A list of all FKPs that contain CHPX std::vector<FormattedDiskPageCHPX*>* AllChpxFkps; // A list of all FKPs that contain CHPX
std::map<int, ParagraphPropertyExceptions*> * AllPapx; // The value is the PAPX that formats the paragraph. std::map<int, ParagraphPropertyExceptions*>* AllPapx; // The value is the PAPX that formats the paragraph.
std::map<int, SectionPropertyExceptions*> * AllSepx; // The value is the SEPX that formats the section. std::map<int, SectionPropertyExceptions*>* AllSepx; // The value is the SEPX that formats the section.
std::vector<int> * AllPapxVector;// A vector to quick find in AllPapx std::vector<int>* AllPapxVector;// A vector to quick find in AllPapx
std::map<int, int> PictureBulletsCPsMap; std::map<int, int> PictureBulletsCPsMap;
@ -181,79 +181,79 @@ namespace DocFileFormat
struct _bmkStartEnd struct _bmkStartEnd
{ {
int start; int start;
int end; int end;
_UINT32 bookmarkId; _UINT32 bookmarkId;
}; };
std::vector<_bmkStartEnd> BookmarkStartEndCPs; std::vector<_bmkStartEnd> BookmarkStartEndCPs;
std::vector<_bmkStartEnd> BookmarkProtStartEndCPs; std::vector<_bmkStartEnd> BookmarkProtStartEndCPs;
std::vector<_bmkStartEnd> AnnotStartEndCPs; std::vector<_bmkStartEnd> AnnotStartEndCPs;
std::map<int, int> mapAnnotBookmarks; //id, index std::map<int, int> mapAnnotBookmarks; //id, index
std::map<int, int> mapProtBookmarks; std::map<int, int> mapProtBookmarks;
FileInformationBlock * FIB; FileInformationBlock* FIB;
StyleSheet * Styles; // The style sheet of the document StyleSheet* Styles; // The style sheet of the document
PieceTable * m_PieceTable; // PieceTable PieceTable; PieceTable* m_PieceTable; // PieceTable PieceTable;
ListFormatOverrideTable * listFormatOverrideTable; // lists and numberings in the document. ListFormatOverrideTable* listFormatOverrideTable; // lists and numberings in the document.
HeaderAndFooterTable * headerAndFooterTable; HeaderAndFooterTable* headerAndFooterTable;
AnnotationOwnerList * AnnotationOwners; AnnotationOwnerList* AnnotationOwners;
ListTable * listTable; // list numberings in the document. ListTable* listTable; // list numberings in the document.
WordDocumentProperties * DocProperties; WordDocumentProperties* DocProperties;
EncryptionHeader * encryptionHeader; EncryptionHeader* encryptionHeader;
OfficeArtContent * officeArtContent; // info about the drawings in the document. OfficeArtContent* officeArtContent; // info about the drawings in the document.
StringTable<WideString> *RevisionAuthorTable; StringTable<WideString>* RevisionAuthorTable;
StringTable<FontFamilyName> *FontTable; // A list of all font names, used in the doucument StringTable<FontFamilyName>* FontTable; // A list of all font names, used in the doucument
StringTable<WideString> *BookmarkNames; StringTable<WideString>* BookmarkNames;
StringTable<WideString> *AutoTextNames; StringTable<WideString>* AutoTextNames;
StringTable<WideString> *AssocNames; StringTable<WideString>* AssocNames;
StringTable<WideString> *BkmkAnnotNames; StringTable<WideString>* BkmkAnnotNames;
StringTable<WideString> *Captions; StringTable<WideString>* Captions;
StringTable<WideString> *AutoCaptions; StringTable<WideString>* AutoCaptions;
StringTableEx<ProtInfoBookmark> *BkmkProt;
StringTable<WideString> *BkmkProtUser;
Plex<EmptyStructure> *IndividualFootnotesPlex; //A plex of locations of individual footnotes StringTableEx<ProtInfoBookmark>* BkmkProt;
Plex<FootnoteDescriptor> *FootnoteReferenceCharactersPlex; //A plex of footnote reference characters StringTable<WideString>* BkmkProtUser;
Plex<EmptyStructure> *IndividualEndnotesPlex; //A plex of locations of individual endnotes
Plex<EndnoteDescriptor> *EndnoteReferenceCharactersPlex; //A plex of endnote reference characters
Plex<EmptyStructure> *HeaderStoriesPlex; //A plex of the header document
Plex<EmptyStructure> *IndividualCommentsPlex; // A plex with all ATRDPre10 structs
Plex<FTXBXS> *TextboxIndividualPlex;
Plex<Tbkd> *TextboxBreakPlex; // Describes the breaks inside the textbox subdocument
Plex<Tbkd> *TextboxBreakPlexHeader; // Describes the breaks inside the header textbox subdocument
Plex<OutlineListDescriptor> *OutlineListDescriptorPlex;
Plex<Spa> *OfficeDrawingPlex;
Plex<Spa> *OfficeDrawingPlexHeader;
Plex<SectionDescriptor> *SectionPlex;
Plex<BookmarkFirst> *BookmarkStartPlex;
Plex<EmptyStructure> *BookmarkEndPlex;
Plex<BookmarkFirst> *AnnotStartPlex; Plex<EmptyStructure>* IndividualFootnotesPlex; //A plex of locations of individual footnotes
Plex<EmptyStructure> *AnnotEndPlex; Plex<FootnoteDescriptor>* FootnoteReferenceCharactersPlex; //A plex of footnote reference characters
Plex<BookmarkFirst> *BookmarkProtStartPlex; Plex<EmptyStructure>* IndividualEndnotesPlex; //A plex of locations of individual endnotes
Plex<EmptyStructure> *BookmarkProtEndPlex; Plex<EndnoteDescriptor>* EndnoteReferenceCharactersPlex; //A plex of endnote reference characters
Plex<ListNumCache> *ListPlex; Plex<EmptyStructure>* HeaderStoriesPlex; //A plex of the header document
Plex<FieldCharacter> *FieldsPlex; Plex<EmptyStructure>* IndividualCommentsPlex; // A plex with all ATRDPre10 structs
Plex<FieldCharacter> *FootnoteDocumentFieldsPlex;
Plex<FieldCharacter> *EndnoteDocumentFieldsPlex;
Plex<FieldCharacter> *HeadersAndFootersDocumentFieldsPlex;
Plex<FieldCharacter> *AnnotationsFieldsPlex;
Plex<AnnotationReferenceDescriptor> *AnnotationsReferencePlex;
Plex<EmptyStructure> *AutoTextPlex;
AnnotationReferenceExDescriptors *AnnotationsReferencesEx; Plex<FTXBXS>* TextboxIndividualPlex;
//------------------------------------------------------------------------------ Plex<Tbkd>* TextboxBreakPlex; // Describes the breaks inside the textbox subdocument
void CorrectColor(ODRAW::OfficeArtCOLORREF & color); Plex<Tbkd>* TextboxBreakPlexHeader; // Describes the breaks inside the header textbox subdocument
Plex<OutlineListDescriptor>* OutlineListDescriptorPlex;
Plex<Spa>* OfficeDrawingPlex;
Plex<Spa>* OfficeDrawingPlexHeader;
Plex<SectionDescriptor>* SectionPlex;
Plex<BookmarkFirst>* BookmarkStartPlex;
Plex<EmptyStructure>* BookmarkEndPlex;
Plex<BookmarkFirst>* AnnotStartPlex;
Plex<EmptyStructure>* AnnotEndPlex;
Plex<BookmarkFirst>* BookmarkProtStartPlex;
Plex<EmptyStructure>* BookmarkProtEndPlex;
Plex<ListNumCache>* ListPlex;
Plex<FieldCharacter>* FieldsPlex;
Plex<FieldCharacter>* FootnoteDocumentFieldsPlex;
Plex<FieldCharacter>* EndnoteDocumentFieldsPlex;
Plex<FieldCharacter>* HeadersAndFootersDocumentFieldsPlex;
Plex<FieldCharacter>* AnnotationsFieldsPlex;
Plex<AnnotationReferenceDescriptor>* AnnotationsReferencePlex;
Plex<EmptyStructure>* AutoTextPlex;
AnnotationReferenceExDescriptors* AnnotationsReferencesEx;
//------------------------------------------------------------------------------
void CorrectColor(ODRAW::OfficeArtCOLORREF& color, int base_color);
}; };
} }

View File

@ -81,13 +81,7 @@ namespace oox {
0x00666666, 0x00C0C0C0, 0x00DDDDDD, 0x00C0C0C0, 0x00666666, 0x00C0C0C0, 0x00DDDDDD, 0x00C0C0C0,
0x00888888, 0x00FFFFFF, 0x00CCCCCC, 0x00000000 0x00888888, 0x00FFFFFF, 0x00CCCCCC, 0x00000000
}; };
void _color::SetRGB(unsigned char nR, unsigned char nG, unsigned char nB)
{
nRGB = (nR<<16) | (nG<<8) | nB;
sRGB = STR::toRGB(nR, nG, nB);
index = -1;
}
//----------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------
class xlsx_drawing_context_handle::Impl class xlsx_drawing_context_handle::Impl
{ {

View File

@ -94,7 +94,13 @@ struct _color
int index = -1; int index = -1;
bool bScheme = false; bool bScheme = false;
void SetRGB(unsigned char nR, unsigned char nG, unsigned char nB); void SetRGB(unsigned char nR, unsigned char nG, unsigned char nB)
{
nRGB = (nR << 16) | (nG << 8) | nB;
sRGB = STR::toRGB(nR, nG, nB);
index = -1;
}
unsigned char GetB() { return (unsigned char )(nRGB);} unsigned char GetB() { return (unsigned char )(nRGB);}
unsigned char GetG() { return (unsigned char )(nRGB>>8);} unsigned char GetG() { return (unsigned char )(nRGB>>8);}

View File

@ -1503,9 +1503,8 @@ namespace SimpleTypes
SimpleTypes_DefaultString(CVml_Vector2D_Units) SimpleTypes_DefaultString(CVml_Vector2D_Units)
private: private:
double m_dX; // В пунктах
double m_dX; // В пунктах
double m_dY; // В пунктах double m_dY; // В пунктах
}; };
@ -1529,7 +1528,7 @@ namespace SimpleTypes
SimpleTypes_DefaultString(CVml_Vector2D_Percentage) SimpleTypes_DefaultString(CVml_Vector2D_Percentage)
private: private:
double m_dX; // double m_dX; //
double m_dY; // double m_dY; //
}; };
@ -1554,8 +1553,8 @@ namespace SimpleTypes
SimpleTypes_DefaultString(CVml_Vector2D_1_65536) SimpleTypes_DefaultString(CVml_Vector2D_1_65536)
private: private:
double m_dX; // double m_dX; //
double m_dY; // double m_dY; //
}; };
@ -1639,8 +1638,8 @@ namespace SimpleTypes
std::wstring m_sIdX; // Значение для типа Formula иди AdjValue std::wstring m_sIdX; // Значение для типа Formula иди AdjValue
std::wstring m_sIdY; // std::wstring m_sIdY; //
double m_dX; // Значение для типа Constant double m_dX; // Значение для типа Constant
double m_dY; // double m_dY; //
}; };
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
@ -1788,8 +1787,8 @@ namespace SimpleTypes
SimpleTypes_DefaultString(CVml_TextBoxInset) SimpleTypes_DefaultString(CVml_TextBoxInset)
private: private:
double m_dLeft; double m_dLeft;
double m_dTop; double m_dTop;
double m_dRight; double m_dRight;
double m_dBottom; double m_dBottom;

View File

@ -2845,7 +2845,7 @@ void CDrawingConverter::ConvertShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::CX
{ {
pCNvPr->hidden = true; pCNvPr->hidden = true;
} }
CSpTreeElemProps oProps; CSpTreeElemProps oProps;
oProps.IsTop = bIsTop; oProps.IsTop = bIsTop;
std::wstring strMainPos = GetDrawingMainProps(oNodeShape, oCSSParser, oProps); std::wstring strMainPos = GetDrawingMainProps(oNodeShape, oCSSParser, oProps);
@ -2986,6 +2986,7 @@ void CDrawingConverter::ConvertShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::CX
CheckBrushShape(elem, oNodeShape, pPPTShape); CheckBrushShape(elem, oNodeShape, pPPTShape);
CheckBorderShape(elem, oNodeShape, pPPTShape); CheckBorderShape(elem, oNodeShape, pPPTShape);
} }
} }
void CDrawingConverter::ConvertWordArtShape(PPTX::Logic::SpTreeElem* elem, XmlUtils::CXmlNode& oNodeShape, CPPTShape* pPPTShape) void CDrawingConverter::ConvertWordArtShape(PPTX::Logic::SpTreeElem* elem, XmlUtils::CXmlNode& oNodeShape, CPPTShape* pPPTShape)
@ -4548,8 +4549,14 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
oWriter.EndNode(L"wp14:pctHeight"); oWriter.EndNode(L"wp14:pctHeight");
oWriter.EndNode(L"wp14:sizeRelV"); oWriter.EndNode(L"wp14:sizeRelV");
} }
nullable_string alt_content;
XmlMacroReadAttributeBase(oNode, L"alt", alt_content);
std::wstring strId = L"<wp:docPr id=\"" + std::to_wstring(m_lNextId) + L"\" name=\"" + originalId + L"\"" + (bHidden ? L" hidden=\"true\"" : L"") + L"/>"; std::wstring strId = L"<wp:docPr id=\"" + std::to_wstring(m_lNextId) +
L"\" name=\"" + originalId + L"\"" +
(alt_content.IsInit() ? L" descr=\"" + *alt_content + L"\"" : L"") +
(bHidden ? L" hidden=\"true\"" : L"") + L"/>";
m_lNextId++; m_lNextId++;
oWriter.WriteString(strId); oWriter.WriteString(strId);
@ -5009,11 +5016,11 @@ void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils
nullable_string sOpacity2; nullable_string sOpacity2;
nullable_string sColor2; nullable_string sColor2;
nullable_string sColor; nullable_string sColor;
nullable_string sType; nullable < SimpleTypes::CFillType> oType;
nullable_string sFocus; nullable<SimpleTypes::CFixedPercentage> oFocus;
nullable_string sFocusSize; nullable<SimpleTypes::Vml::CVml_Vector2D_Percentage> oFocusSize;
nullable<SimpleTypes::Vml::CVml_Vector2D_Percentage> oFocusPosition; nullable<SimpleTypes::Vml::CVml_Vector2D_Percentage> oFocusPosition;
nullable_string sAngle; nullable<SimpleTypes::CDecimalNumber> oAngle;
nullable_string sColors; nullable_string sColors;
nullable_string sRotate; nullable_string sRotate;
@ -5022,10 +5029,10 @@ void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils
XmlMacroReadAttributeBase(oNodeFill, L"opacity2", sOpacity2); XmlMacroReadAttributeBase(oNodeFill, L"opacity2", sOpacity2);
XmlMacroReadAttributeBase(oNodeFill, L"color", sColor); XmlMacroReadAttributeBase(oNodeFill, L"color", sColor);
XmlMacroReadAttributeBase(oNodeFill, L"color2", sColor2); XmlMacroReadAttributeBase(oNodeFill, L"color2", sColor2);
XmlMacroReadAttributeBase(oNodeFill, L"type", sType); XmlMacroReadAttributeBase(oNodeFill, L"type", oType);
XmlMacroReadAttributeBase(oNodeFill, L"focus", sFocus); XmlMacroReadAttributeBase(oNodeFill, L"focus", oFocus);
XmlMacroReadAttributeBase(oNodeFill, L"focussize", sFocusSize); XmlMacroReadAttributeBase(oNodeFill, L"focussize", oFocusSize);
XmlMacroReadAttributeBase(oNodeFill, L"angle", sAngle); XmlMacroReadAttributeBase(oNodeFill, L"angle", oAngle);
XmlMacroReadAttributeBase(oNodeFill, L"colors", sColors); XmlMacroReadAttributeBase(oNodeFill, L"colors", sColors);
XmlMacroReadAttributeBase(oNodeFill, L"focusposition", oFocusPosition); XmlMacroReadAttributeBase(oNodeFill, L"focusposition", oFocusPosition);
@ -5068,11 +5075,11 @@ void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils
pBlipFill->blip = new PPTX::Logic::Blip(); pBlipFill->blip = new PPTX::Logic::Blip();
pBlipFill->blip->embed = new OOX::RId(*sRid); pBlipFill->blip->embed = new OOX::RId(*sRid);
if (sType.is_init() && ((*sType == L"tile") || (*sType == L"pattern"))) if (oType.is_init() && ((oType->GetValue() == SimpleTypes::filltypeTile) || (oType->GetValue() == SimpleTypes::filltypePattern)))
{ {
pBlipFill->tile = new PPTX::Logic::Tile(); pBlipFill->tile = new PPTX::Logic::Tile();
if (*sType == L"pattern") if (oType->GetValue() == SimpleTypes::filltypePattern)
{ {
PPTX::Logic::Duotone* pDuotone = new PPTX::Logic::Duotone(); PPTX::Logic::Duotone* pDuotone = new PPTX::Logic::Duotone();
@ -5095,12 +5102,16 @@ void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils
} }
} }
if ((sType.is_init() && (*sType == L"gradient" || *sType == L"gradientradial" || *sType == L"gradientRadial")) || if ((oType.is_init() && (oType->GetValue() == SimpleTypes::filltypeGradient ||
(sFocus.is_init() || sColors.is_init() || sAngle.is_init() || sFocusSize.is_init() || oFocusPosition.is_init())) oType->GetValue() == SimpleTypes::filltypeGradientRadial ||
oType->GetValue() == SimpleTypes::filltypeGradientCenter)) ||
(oFocus.is_init() || sColors.is_init() || oAngle.is_init() || oFocusSize.is_init() || oFocusPosition.is_init()))
{ {
PPTX::Logic::GradFill* pGradFill = new PPTX::Logic::GradFill(); PPTX::Logic::GradFill* pGradFill = new PPTX::Logic::GradFill();
pGradFill->m_namespace = L"a"; pGradFill->m_namespace = L"a";
pGradFill->rotWithShape = false;
int nAngle = oAngle.is_init() ? (oAngle->GetValue() < - 90 ? oAngle->GetValue() + 180 : oAngle->GetValue() + 90 ) : 90;
if (sColors.is_init()) if (sColors.is_init())
{ {
std::vector<std::wstring> arSplit; std::vector<std::wstring> arSplit;
@ -5128,7 +5139,7 @@ void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils
pos = 100000 * pos; pos = 100000 * pos;
else else
pos = pos / 65536 * 100000; pos = pos / 65536 * 100000;
Gs_.pos = pos; Gs_.pos = pos;
pGradFill->GsLst.push_back(Gs_); pGradFill->GsLst.push_back(Gs_);
} }
@ -5136,35 +5147,56 @@ void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils
} }
else else
{ {
PPTX::Logic::Gs Gs_; PPTX::Logic::Gs Gs_1;
ConvertColor(Gs_.color, sColor, sOpacity); ConvertColor(Gs_1.color, sColor, sOpacity);
Gs_.pos = 0;
pGradFill->GsLst.push_back(Gs_);
} PPTX::Logic::Gs Gs_2;
if (false == sColors.is_init() && (sColor2.is_init() || sOpacity2.is_init())) ConvertColor(Gs_2.color, sColor2, sOpacity2);
{
PPTX::Logic::Gs Gs_; double focusPoint = oFocus.IsInit() ? abs(oFocus->GetValue()) : 0;
ConvertColor(Gs_.color, sColor2, sOpacity2); bool bColorsInvert = ((oFocus.IsInit() && oFocus->GetValue() > 0 && nAngle == 0) ||
((oFocus.IsInit() && oFocus->GetValue() < 0) && false == oAngle.is_init()));
Gs_.pos = 100 * 1000; if (focusPoint > 0 && focusPoint < 100)
pGradFill->GsLst.push_back( Gs_ ); {
} PPTX::Logic::Gs Gs_3;
if (pGradFill->GsLst.size() == 1) //Sindicatum.docx
{ Gs_1.pos = 0;
PPTX::Logic::Gs Gs_; Gs_3.pos = focusPoint * 1000;
Gs_.pos = 0; Gs_2.pos = 100 * 1000;
Gs_.color.Color = new PPTX::Logic::SrgbClr(); Gs_.color.Color->SetRGB(0xff, 0xff, 0xff);
if (bColorsInvert)
if (pGradFill->GsLst[0].pos == 0) {
Gs_.pos = 100 * 1000; Gs_3.color = Gs_1.color;
Gs_1.color = Gs_2.color;
pGradFill->GsLst.push_back( Gs_ ); }
else
{
Gs_3.color = Gs_2.color;
Gs_2.color = Gs_1.color;
}
pGradFill->GsLst.push_back(Gs_3);
}
else
{
Gs_2.pos = focusPoint * 1000;
Gs_1.pos = (100 - focusPoint) * 1000;
}
pGradFill->GsLst.push_back(Gs_1);
pGradFill->GsLst.push_back(Gs_2);
} }
//if (pGradFill->GsLst.size() == 1) //Sindicatum.docx
//{
// PPTX::Logic::Gs Gs_;
// Gs_.pos = pGradFill->GsLst[0].pos == 0 ? 100 * 1000 : 0;
// Gs_.color.Color = new PPTX::Logic::SrgbClr(); Gs_.color.Color->SetRGB(0xff, 0xff, 0xff);
//
// pGradFill->GsLst.push_back( Gs_ );
//}
//todooo method //todooo method
if (*sType == L"gradientradial" || *sType == L"gradientRadial") if (oType->GetValue() == SimpleTypes::filltypeGradientRadial)
{ {
double x = 0, y = 0; double x = 0, y = 0;
if (oFocusPosition.is_init()) if (oFocusPosition.is_init())
@ -5175,20 +5207,23 @@ void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils
pGradFill->path.Init(); pGradFill->path.Init();
pGradFill->path->path = 2; pGradFill->path->path = 2;
pGradFill->path->rect.Init(); pGradFill->path->rect.Init();
pGradFill->path->rect->m_name = L"a:fillToRect";
pGradFill->path->rect->b = XmlUtils::ToString(100 - int( y * 100)) + L"%"; pGradFill->path->rect->b = XmlUtils::ToString(100 - int( y * 100)) + L"%";
pGradFill->path->rect->r = XmlUtils::ToString(100 - int(x * 100)) + L"%"; pGradFill->path->rect->r = XmlUtils::ToString(100 - int(x * 100)) + L"%";
pGradFill->path->rect->t = XmlUtils::ToString(int(y * 100)) + L"%"; pGradFill->path->rect->t = XmlUtils::ToString(int(y * 100)) + L"%";
pGradFill->path->rect->l = XmlUtils::ToString(int(x * 100)) + L"%"; pGradFill->path->rect->l = XmlUtils::ToString(int(x * 100)) + L"%";
pGradFill->tileRect.Init();
pGradFill->tileRect->m_name = L"a:tileRect";
} }
else else
{ {
if (sAngle.is_init()) pGradFill->lin = new PPTX::Logic::Lin();
pGradFill->lin->scaled = 1;
if (nAngle != 0)
{ {
int nAngle = XmlUtils::GetInteger(*sAngle);
pGradFill->lin = new PPTX::Logic::Lin();
pGradFill->lin->scaled = 1;
pGradFill->lin->ang = (nAngle >= 0 ? nAngle : (360 + nAngle)) * 60000; pGradFill->lin->ang = (nAngle >= 0 ? nAngle : (360 + nAngle)) * 60000;
} }
else if (sRotate.is_init()) else if (sRotate.is_init())
@ -5207,7 +5242,7 @@ void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils
} }
if ((sType.IsInit() && (*sType == L"pattern")) && pSpPr->Fill.m_type != PPTX::Logic::UniFill::blipFill) if ((oType.IsInit() && oType->GetValue() == SimpleTypes::filltypePattern) && pSpPr->Fill.m_type != PPTX::Logic::UniFill::blipFill)
{ {
PPTX::Logic::PattFill* pPattFill = new PPTX::Logic::PattFill(); PPTX::Logic::PattFill* pPattFill = new PPTX::Logic::PattFill();
pPattFill->m_namespace = L"a"; pPattFill->m_namespace = L"a";

View File

@ -2680,7 +2680,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CColor *color, _CP_OPT(odf_types::
} }
else else
{ {
result = OOX::Spreadsheet::CIndexedColors::GetDefaultRGBAByIndex(ind, ucR, ucG, ucB, ucA); result = ind < 64 ? OOX::Spreadsheet::CIndexedColors::GetDefaultRGBAByIndex(ind, ucR, ucG, ucB, ucA) : false;
} }
} }
if (result == true) if (result == true)