(cherry picked from commit 53d5f4517b)
This commit is contained in:
ElenaSubbotina
2025-08-08 09:59:00 +03:00
parent fee71647a9
commit 6e1357f276
8 changed files with 336 additions and 315 deletions

View File

@ -356,7 +356,7 @@ namespace DocFileFormat
if (!pict->brcBottom)
{
ODRAW::OfficeArtCOLORREF bottomColor((_UINT32)iter->op);
m_context->_doc->CorrectColor(bottomColor, nColorRGBBase);
m_context->_doc->CorrectColor(bottomColor, nColorRGBBase, 5);
if (false == bottomColor.sColorRGB.empty())
m_pXmlWriter->WriteAttribute(L"o:borderbottomcolor", L"#" + bottomColor.sColorRGB);
}
@ -365,7 +365,7 @@ namespace DocFileFormat
if (!pict->brcLeft)
{
ODRAW::OfficeArtCOLORREF leftColor((_UINT32)iter->op);
m_context->_doc->CorrectColor(leftColor, nColorRGBBase);
m_context->_doc->CorrectColor(leftColor, nColorRGBBase, 5);
if (false == leftColor.sColorRGB.empty())
m_pXmlWriter->WriteAttribute(L"o:borderleftcolor", L"#" + leftColor.sColorRGB);
}
@ -374,7 +374,7 @@ namespace DocFileFormat
if (!pict->brcRight)
{
ODRAW::OfficeArtCOLORREF rightColor((_UINT32)iter->op);
m_context->_doc->CorrectColor(rightColor, nColorRGBBase);
m_context->_doc->CorrectColor(rightColor, nColorRGBBase, 5);
if (false == rightColor.sColorRGB.empty())
m_pXmlWriter->WriteAttribute(L"o:borderrightcolor", L"#" + rightColor.sColorRGB);
}
@ -383,7 +383,7 @@ namespace DocFileFormat
if (!pict->brcTop)
{
ODRAW::OfficeArtCOLORREF topColor((_UINT32)iter->op);
m_context->_doc->CorrectColor(topColor, nColorRGBBase);
m_context->_doc->CorrectColor(topColor, nColorRGBBase, 5);
if (false == topColor.sColorRGB.empty())
m_pXmlWriter->WriteAttribute(L"o:bordertopcolor", L"#" + topColor.sColorRGB);
}

View File

@ -233,50 +233,50 @@ namespace DocFileFormat
{
if ((NULL == pContainer) || (pContainer->Children.empty())) return;
Shape* pShape = static_cast<Shape*>(pContainer->Children[0]);
Shape* pShape = static_cast<Shape*>(pContainer->Children[0]);
if (!pShape) return;
int indexOLE = -1;
bool freeform = true;
bool freeform = true;
std::wstring sShapeId;
std::vector<ODRAW::OfficeArtFOPTEPtr> options = pContainer->ExtractOptions();
ChildAnchor* pAnchor = pContainer->FirstChildWithType<ChildAnchor>();
ClientAnchor* clientAnchor = pContainer->FirstChildWithType<ClientAnchor>();
std::vector<ODRAW::OfficeArtFOPTEPtr> options = pContainer->ExtractOptions();
WriteBeginShapeNode (pShape);
ChildAnchor* pAnchor = pContainer->FirstChildWithType<ChildAnchor>();
ClientAnchor* clientAnchor = pContainer->FirstChildWithType<ClientAnchor>();
WriteBeginShapeNode(pShape);
m_shapeId = GetShapeID(pShape);
if (m_shapeId.empty())
{
m_context->_doc->GetOfficeArt()->m_uLastShapeId++;
m_shapeId = std::wstring(L"_x0000_s") + std::to_wstring(m_context->_doc->GetOfficeArt()->m_uLastShapeId);
m_shapeId = std::wstring(L"_x0000_s") + std::to_wstring(m_context->_doc->GetOfficeArt()->m_uLastShapeId);
}
m_pXmlWriter->WriteAttribute ( L"id", m_shapeId );
if ( !pShape->fBackground )
m_pXmlWriter->WriteAttribute(L"id", m_shapeId);
if (!pShape->fBackground)
{
bool twistDimensions = false;
if (pShape->GetShapeType())
{
freeform = false;
m_pXmlWriter->WriteAttribute( L"type", (std::wstring(L"#") + VMLShapeTypeMapping::GenerateTypeId(pShape->GetShapeType())));
freeform = false;
m_pXmlWriter->WriteAttribute(L"type", (std::wstring(L"#") + VMLShapeTypeMapping::GenerateTypeId(pShape->GetShapeType())));
}
m_pXmlWriter->WriteAttribute( L"style", FormatUtils::XmlEncode(buildStyle(pShape, pAnchor, options, pContainer->m_nIndex, twistDimensions)));
m_pXmlWriter->WriteAttribute(L"style", FormatUtils::XmlEncode(buildStyle(pShape, pAnchor, options, pContainer->m_nIndex, twistDimensions)));
if (pShape->is<LineType>())
{
//append "from" and "to" attributes
m_pXmlWriter->WriteAttribute(L"from", GetLineFrom(pAnchor, twistDimensions));
m_pXmlWriter->WriteAttribute(L"to", GetLineTo(pAnchor, twistDimensions));
m_pXmlWriter->WriteAttribute(L"to", GetLineTo(pAnchor, twistDimensions));
}
if (m_isBullete)
{
m_pXmlWriter->WriteAttribute(L"o:bullet", L"t");
m_pXmlWriter->WriteAttribute(L"o:bullet", L"t");
}
}
@ -292,33 +292,34 @@ namespace DocFileFormat
boost::optional<double> viewPointOriginY;
boost::optional<double> ShadowOriginX;
boost::optional<double> ShadowOriginY;
boost::optional<size_t> xCoord;
boost::optional<size_t> yCoord;
boost::optional<size_t> xCoord;
boost::optional<size_t> yCoord;
boost::optional<size_t> xCoord2;
boost::optional<size_t> yCoord2;
boost::optional<int> matrix[4];
bool bStroked = true;
bool bFilled = true;
bool hasTextbox = false;
bool layoutInCell = true; //anmeldebogenfos.doc
bool b3D = false;
bool bShadow = false;
bool bPicturePresent = false;
int ndxTextLeft = -1;
int ndyTextTop = -1;
int ndxTextRight = -1;
int ndyTextBottom = -1;
bool bStroked = true;
bool bFilled = true;
bool hasTextbox = false;
bool layoutInCell = true; //anmeldebogenfos.doc
bool b3D = false;
bool bShadow = false;
bool bPicturePresent = false;
bool bHavePath = false;
int nShapePath = -1;
int nAdjValues = 0;
int nLTxID = -1;
int ndxTextLeft = -1;
int ndyTextTop = -1;
int ndxTextRight = -1;
int ndyTextBottom = -1;
bool bHavePath = false;
int nShapePath = -1;
int nAdjValues = 0;
int nLTxID = -1;
int nProperty = 0;
std::wstring sTextboxStyle;
ODRAW::OfficeArtFOPTEPtr opSegmentInfo;
ODRAW::OfficeArtFOPTEPtr opVerticles;
ODRAW::OfficeArtFOPTEPtr opInscribe;
@ -328,7 +329,7 @@ namespace DocFileFormat
int nColorRGBBase = 0xffffff, nFillType = 0;
bool bFlipColors = false;
boost::optional<double> fill_left;
boost::optional<double> fill_top;
boost::optional<double> fill_right;
@ -336,7 +337,7 @@ namespace DocFileFormat
for (size_t i = 0; i < options.size(); i++)
{
ODRAW::OfficeArtFOPTEPtr & iter = options[i];
ODRAW::OfficeArtFOPTEPtr& iter = options[i];
switch (iter->opid)
{
//BOOLEANS
@ -502,7 +503,7 @@ namespace DocFileFormat
case ODRAW::lineColor:
{
ODRAW::OfficeArtCOLORREF lineColor((_UINT32)iter->op);
m_context->_doc->CorrectColor(lineColor, nColorRGBBase);
m_context->_doc->CorrectColor(lineColor, nColorRGBBase, 5);
if (false == lineColor.sColorRGB.empty() && !pShape->fBackground)
m_pXmlWriter->WriteAttribute(L"strokecolor", (std::wstring(L"#") + lineColor.sColorRGB));
}break;
@ -565,7 +566,7 @@ namespace DocFileFormat
case ODRAW::fillColor:
{
ODRAW::OfficeArtCOLORREF fillColor((_UINT32)iter->op);
m_context->_doc->CorrectColor(fillColor, nColorRGBBase);
m_context->_doc->CorrectColor(fillColor, nColorRGBBase, 1);
if (false == fillColor.sColorRGB.empty())
m_pXmlWriter->WriteAttribute(L"fillcolor", (std::wstring(L"#") + fillColor.sColorRGB));
@ -574,7 +575,7 @@ namespace DocFileFormat
case ODRAW::fillBackColor:
{
ODRAW::OfficeArtCOLORREF fillBackColor((_UINT32)iter->op);
m_context->_doc->CorrectColor(fillBackColor, nColorRGBBase);
m_context->_doc->CorrectColor(fillBackColor, nColorRGBBase, 2);
if (false == fillBackColor.sColorRGB.empty())
appendValueAttribute(&m_fill, L"color2", (std::wstring(L"#") + fillBackColor.sColorRGB));
@ -652,7 +653,7 @@ namespace DocFileFormat
if ((pFillBlip != NULL) && copyPicture(pFillBlip))
{
appendValueAttribute(&m_fill, L"r:id", std::wstring((L"rId") + std::to_wstring(m_nImageId)));
appendValueAttribute(&m_fill, L"r:id", std::wstring((L"rId") + std::to_wstring(m_nImageId)));
}
bPicturePresent = true;
@ -676,7 +677,7 @@ namespace DocFileFormat
double opa = (iter->op / pow((double)2, (double)16));
appendValueAttribute(&m_fill, L"o:opacity2", FormatUtils::DoubleToFormattedWideString(opa, L"%.2f"));
}break;
// SHADOW
// SHADOW
case ODRAW::shadowType:
{
appendValueAttribute(&m_shadow, L"type", getShadowType(iter->op));
@ -685,7 +686,7 @@ namespace DocFileFormat
case ODRAW::shadowColor:
{
ODRAW::OfficeArtCOLORREF shadowColor((_UINT32)iter->op);
m_context->_doc->CorrectColor(shadowColor, nColorRGBBase);
m_context->_doc->CorrectColor(shadowColor, nColorRGBBase, 3);
if (false == shadowColor.sColorRGB.empty())
appendValueAttribute(&m_shadow, L"color", (std::wstring(L"#") + shadowColor.sColorRGB));
}break;
@ -713,6 +714,22 @@ namespace DocFileFormat
{
ShadowOriginY = (iter->op / pow((double)2, (double)16));
}break;
case ODRAW::shadowScaleXToX:
{
matrix[0] = iter->op;
}break;
case ODRAW::shadowScaleYToX:
{
matrix[1] = iter->op;
}break;
case ODRAW::shadowScaleXToY:
{
matrix[2] = iter->op;
}break;
case ODRAW::shadowScaleYToY:
{
matrix[3] = iter->op;
}break;
case ODRAW::shadowOpacity:
{
double shadowOpa = (iter->op / pow((double)2, (double)16));
@ -730,12 +747,12 @@ namespace DocFileFormat
}
}
}break;
// OLE
// OLE
case ODRAW::pictureId:
{
indexOLE = iter->op;
}break;
// PICTURE
// PICTURE
case ODRAW::pib:
{
int index = (int)(iter->op - 1);
@ -745,7 +762,7 @@ namespace DocFileFormat
BlipStoreEntry* oBlip = static_cast<BlipStoreEntry*>(m_pBlipStore->Children[index]);
if (copyPicture(oBlip))
{
appendValueAttribute(&m_imagedata, L"r:id", (std::wstring(L"rId") + std::to_wstring(m_nImageId)));
appendValueAttribute(&m_imagedata, L"r:id", (std::wstring(L"rId") + std::to_wstring(m_nImageId)));
}
}
bPicturePresent = true;
@ -764,226 +781,226 @@ namespace DocFileFormat
}break;
case ODRAW::pictureContrast:
{
appendValueAttribute(&m_imagedata, L"gain", (std::to_wstring(iter->op) + L"f"));
appendValueAttribute(&m_imagedata, L"gain", (std::to_wstring(iter->op) + L"f"));
}break;
case ODRAW::pictureBrightness:
{
appendValueAttribute(&m_imagedata, L"blacklevel", (std::to_wstring(iter->op) + L"f"));
appendValueAttribute(&m_imagedata, L"blacklevel", (std::to_wstring(iter->op) + L"f"));
}break;
case ODRAW::pictureGamma:
{
appendValueAttribute(&m_imagedata, L"gamma", (std::to_wstring(iter->op) + L"f"));
appendValueAttribute(&m_imagedata, L"gamma", (std::to_wstring(iter->op) + L"f"));
}break;
//CROPPING
case ODRAW::cropFromBottom:
{
//cast to signed integer
int cropBottom = (int)iter->op;
appendValueAttribute(&m_imagedata, L"cropbottom", std::to_wstring(cropBottom) + L"f");
appendValueAttribute(&m_imagedata, L"cropbottom", std::to_wstring(cropBottom) + L"f");
}
break;
case ODRAW::cropFromLeft:
{
//cast to signed integer
int cropLeft = (int)iter->op;
appendValueAttribute(&m_imagedata, L"cropleft", std::to_wstring(cropLeft) + L"f");
appendValueAttribute(&m_imagedata, L"cropleft", std::to_wstring(cropLeft) + L"f");
}
break;
case ODRAW::cropFromRight:
{
//cast to signed integer
int cropRight = (int)iter->op;
appendValueAttribute(&m_imagedata, L"cropright", std::to_wstring(cropRight) + L"f");
appendValueAttribute(&m_imagedata, L"cropright", std::to_wstring(cropRight) + L"f");
}
break;
case ODRAW::cropFromTop:
{
//cast to signed integer
int cropTop = (int)iter->op;
appendValueAttribute(&m_imagedata, L"croptop", std::to_wstring(cropTop) + L"f");
appendValueAttribute(&m_imagedata, L"croptop", std::to_wstring(cropTop) + L"f");
}
break;
// 3D STYLE
// 3D STYLE
case ODRAW::threeDStyleBooleanProperties:
{
ODRAW::ThreeDStyleBooleanProperties* booleans = dynamic_cast<ODRAW::ThreeDStyleBooleanProperties*>(iter.get());
}break;
{
ODRAW::ThreeDStyleBooleanProperties* booleans = dynamic_cast<ODRAW::ThreeDStyleBooleanProperties*>(iter.get());
}break;
case ODRAW::threeDObjectBooleanProperties:
{
ODRAW::ThreeDObjectBooleanProperties* booleans = dynamic_cast<ODRAW::ThreeDObjectBooleanProperties*>(iter.get());
{
ODRAW::ThreeDObjectBooleanProperties* booleans = dynamic_cast<ODRAW::ThreeDObjectBooleanProperties*>(iter.get());
if ((booleans) && (booleans->fUsef3D && !booleans->f3D))
b3D = false;
}break;
if ((booleans) && (booleans->fUsef3D && !booleans->f3D))
b3D = false;
}break;
case ODRAW::c3DRenderMode:
{
}break;
{
}break;
case ODRAW::c3DExtrudeBackward:
{
EmuValue backwardValue( (int)iter->op );
std::wstring depth = FormatUtils::DoubleToWideString( backwardValue.ToPoints() ) + L"pt";
appendValueAttribute(&m_3dstyle, L"backdepth", depth);
}break;
{
EmuValue backwardValue((int)iter->op);
std::wstring depth = FormatUtils::DoubleToWideString(backwardValue.ToPoints()) + L"pt";
appendValueAttribute(&m_3dstyle, L"backdepth", depth);
}break;
case ODRAW::c3DAmbientIntensity:
{
std::wstring intens = std::to_wstring((int)iter->op) + L"f";
appendValueAttribute(&m_3dstyle, L"brightness", intens);
}break;
{
std::wstring intens = std::to_wstring((int)iter->op) + L"f";
appendValueAttribute(&m_3dstyle, L"brightness", intens);
}break;
case ODRAW::c3DSpecularAmt:
{
std::wstring amt = std::to_wstring((int)iter->op) + L"f";
appendValueAttribute(&m_3dstyle, L"specularity", amt);
}break;
{
std::wstring amt = std::to_wstring((int)iter->op) + L"f";
appendValueAttribute(&m_3dstyle, L"specularity", amt);
}break;
case ODRAW::c3DDiffuseAmt:
{
std::wstring amt = std::to_wstring((int)iter->op) + L"f";
appendValueAttribute(&m_3dstyle, L"diffusity", amt);
}break;
{
std::wstring amt = std::to_wstring((int)iter->op) + L"f";
appendValueAttribute(&m_3dstyle, L"diffusity", amt);
}break;
case ODRAW::c3DKeyIntensity:
{
std::wstring amt = std::to_wstring((int)iter->op);
appendValueAttribute(&m_3dstyle, L"lightlevel", amt);
}break;
{
std::wstring amt = std::to_wstring((int)iter->op);
appendValueAttribute(&m_3dstyle, L"lightlevel", amt);
}break;
case ODRAW::c3DExtrusionColor:
{
std::wstring color = FormatUtils::IntToFormattedWideString(iter->op, L"#%06x");
appendValueAttribute(&m_3dstyle, L"color", color);
}break;
{
std::wstring color = FormatUtils::IntToFormattedWideString(iter->op, L"#%06x");
appendValueAttribute(&m_3dstyle, L"color", color);
}break;
case ODRAW::c3DSkewAngle:
{
ODRAW::FixedPoint* point = dynamic_cast<ODRAW::FixedPoint*>(iter.get());
if (point) appendValueAttribute(&m_3dstyle, L"skewangle", FormatUtils::DoubleToWideString( point->dVal ));
}break;
{
ODRAW::FixedPoint* point = dynamic_cast<ODRAW::FixedPoint*>(iter.get());
if (point) appendValueAttribute(&m_3dstyle, L"skewangle", FormatUtils::DoubleToWideString(point->dVal));
}break;
case ODRAW::c3DXViewpoint:
{
ODRAW::FixedPoint* point = dynamic_cast<ODRAW::FixedPoint*>(iter.get());
if (point) ViewPointX = EmuValue( (int)point->dVal );
}break;
{
ODRAW::FixedPoint* point = dynamic_cast<ODRAW::FixedPoint*>(iter.get());
if (point) ViewPointX = EmuValue((int)point->dVal);
}break;
case ODRAW::c3DYViewpoint:
{
ODRAW::FixedPoint* point = dynamic_cast<ODRAW::FixedPoint*>(iter.get());
if (point) ViewPointY = EmuValue( (int)point->dVal );
}break;
{
ODRAW::FixedPoint* point = dynamic_cast<ODRAW::FixedPoint*>(iter.get());
if (point) ViewPointY = EmuValue((int)point->dVal);
}break;
case ODRAW::c3DZViewpoint:
{
ODRAW::FixedPoint* point = dynamic_cast<ODRAW::FixedPoint*>(iter.get());
if (point) ViewPointZ = EmuValue( (int)point->dVal );
}break;
{
ODRAW::FixedPoint* point = dynamic_cast<ODRAW::FixedPoint*>(iter.get());
if (point) ViewPointZ = EmuValue((int)point->dVal);
}break;
case ODRAW::c3DOriginX:
{
ODRAW::FixedPoint* point = dynamic_cast<ODRAW::FixedPoint*>(iter.get());
if (point) viewPointOriginX = point->dVal;
}break;
{
ODRAW::FixedPoint* point = dynamic_cast<ODRAW::FixedPoint*>(iter.get());
if (point) viewPointOriginX = point->dVal;
}break;
case ODRAW::c3DOriginY:
{
ODRAW::FixedPoint* point = dynamic_cast<ODRAW::FixedPoint*>(iter.get());
if (point) viewPointOriginY = point->dVal;
}break;
// TEXTBOX
{
ODRAW::FixedPoint* point = dynamic_cast<ODRAW::FixedPoint*>(iter.get());
if (point) viewPointOriginY = point->dVal;
}break;
// TEXTBOX
case ODRAW::lTxid:
{
hasTextbox = true;
nLTxID = (((iter->op) >> 16) & 0xFFFF);
}break;
case ODRAW::dxTextLeft: {ndxTextLeft = (int)iter->op; break;}
case ODRAW::dyTextTop: {ndyTextTop = (int)iter->op; break;}
case ODRAW::dxTextRight: {ndxTextRight = (int)iter->op; break;}
case ODRAW::dyTextBottom: {ndyTextBottom = (int)iter->op; break;}
{
hasTextbox = true;
nLTxID = (((iter->op) >> 16) & 0xFFFF);
}break;
case ODRAW::dxTextLeft: {ndxTextLeft = (int)iter->op; break; }
case ODRAW::dyTextTop: {ndyTextTop = (int)iter->op; break; }
case ODRAW::dxTextRight: {ndxTextRight = (int)iter->op; break; }
case ODRAW::dyTextBottom: {ndyTextBottom = (int)iter->op; break; }
case ODRAW::txflTextFlow:
{
switch (iter->op)
{
switch(iter->op)
{
case 0:
case 4://обычный
break;
case 1:
case 3:
case 5://верт (склони голову направо)
appendStyleProperty(sTextboxStyle, L"layout-flow", L"vertical");
break;
case 2://верт (склони голову налево)
appendStyleProperty(sTextboxStyle, L"layout-flow", L"vertical");
appendStyleProperty(sTextboxStyle, L"mso-layout-flow-alt", L"bottom-to-top");
break;
}
}break;
case 0:
case 4://обычный
break;
case 1:
case 3:
case 5://верт (склони голову направо)
appendStyleProperty(sTextboxStyle, L"layout-flow", L"vertical");
break;
case 2://верт (склони голову налево)
appendStyleProperty(sTextboxStyle, L"layout-flow", L"vertical");
appendStyleProperty(sTextboxStyle, L"mso-layout-flow-alt", L"bottom-to-top");
break;
}
}break;
case ODRAW::hspNext:
{
appendStyleProperty(sTextboxStyle, L"mso-next-textbox", std::wstring(L"_x0000_s") + std::to_wstring((unsigned int)iter->op));
}break;
{
appendStyleProperty(sTextboxStyle, L"mso-next-textbox", std::wstring(L"_x0000_s") + std::to_wstring((unsigned int)iter->op));
}break;
case ODRAW::textBooleanProperties:
{
ODRAW::TextBooleanProperties *props = dynamic_cast<ODRAW::TextBooleanProperties*>(iter.get());
{
ODRAW::TextBooleanProperties* props = dynamic_cast<ODRAW::TextBooleanProperties*>(iter.get());
if (props->fUsefFitShapeToText && props->fFitShapeToText)
{
appendStyleProperty(sTextboxStyle, L"mso-fit-shape-to-text", L"t");
}
}break;
// Word Art
if (props->fUsefFitShapeToText && props->fFitShapeToText)
{
appendStyleProperty(sTextboxStyle, L"mso-fit-shape-to-text", L"t");
}
}break;
// Word Art
case ODRAW::gtextUNICODE:
{
ODRAW::AnyString* str = dynamic_cast<ODRAW::AnyString*>(iter.get());
if ((str) && (!str->string_.empty()))
{
ODRAW::AnyString* str = dynamic_cast<ODRAW::AnyString*>(iter.get());
if ((str) && (!str->string_.empty()))
{
appendValueAttribute(&m_textpath, L"string", str->string_);
}
}break;
appendValueAttribute(&m_textpath, L"string", str->string_);
}
}break;
case ODRAW::gtextFont:
{
ODRAW::AnyString* str = dynamic_cast<ODRAW::AnyString*>(iter.get());
if (str)
{
ODRAW::AnyString* str = dynamic_cast<ODRAW::AnyString*>(iter.get());
if (str)
{
appendStyleProperty(m_textPathStyle, L"font-family", str->string_);
}
}break;
appendStyleProperty(m_textPathStyle, L"font-family", str->string_);
}
}break;
case ODRAW::gtextSize:
{
std::wstring fontSize = std::to_wstring(iter->op/65535);
appendStyleProperty(m_textPathStyle, L"font-size", fontSize + L"pt");
}break;
{
std::wstring fontSize = std::to_wstring(iter->op / 65535);
appendStyleProperty(m_textPathStyle, L"font-size", fontSize + L"pt");
}break;
case ODRAW::gtextSpacing:
{
std::wstring spacing = std::to_wstring(iter->op);
appendStyleProperty(m_textPathStyle, L"v-text-spacing", spacing + L"f");
}break;
{
std::wstring spacing = std::to_wstring(iter->op);
appendStyleProperty(m_textPathStyle, L"v-text-spacing", spacing + L"f");
}break;
case ODRAW::geometryTextBooleanProperties:
{
ODRAW::GeometryTextBooleanProperties* props = dynamic_cast<ODRAW::GeometryTextBooleanProperties*>(iter.get());
if (props->fUsegFShrinkFit && props->fShrinkFit && (props->fStretch || props->fUsegFStretch))
{
ODRAW::GeometryTextBooleanProperties *props = dynamic_cast<ODRAW::GeometryTextBooleanProperties*>(iter.get());
if (props->fUsegFShrinkFit && props->fShrinkFit && (props->fStretch || props->fUsegFStretch))
{
appendValueAttribute(&m_textpath, L"fitshape", L"t");
}
if (props->fUsegFBestFit && props->fBestFit && (!props->fStretch || !props->fUsegFStretch))
{
appendValueAttribute(&m_textpath, L"fitshape", L"t");
}
if (props->fUsegFShrinkFit && props->fShrinkFit)
{
appendValueAttribute(&m_textpath, L"trim", L"t");
}
if (props->fUsegFVertical && props->fVertical)
{
appendStyleProperty(m_textPathStyle, L"v-rotate-letters", L"t");
//_twistDimension = true;
}
if (props->fUsegFKern && props->fKern)
{
appendStyleProperty(m_textPathStyle, L"v-text-kern", L"t");
}
if (props->fUsegFItalic && props->fItalic)
{
appendStyleProperty(m_textPathStyle, L"font-style", L"italic");
}
if (props->fUsegFBold && props->fBold)
{
appendStyleProperty(m_textPathStyle, L"font-weight", L"bold");
}
}break;
appendValueAttribute(&m_textpath, L"fitshape", L"t");
}
if (props->fUsegFBestFit && props->fBestFit && (!props->fStretch || !props->fUsegFStretch))
{
appendValueAttribute(&m_textpath, L"fitshape", L"t");
}
if (props->fUsegFShrinkFit && props->fShrinkFit)
{
appendValueAttribute(&m_textpath, L"trim", L"t");
}
if (props->fUsegFVertical && props->fVertical)
{
appendStyleProperty(m_textPathStyle, L"v-rotate-letters", L"t");
//_twistDimension = true;
}
if (props->fUsegFKern && props->fKern)
{
appendStyleProperty(m_textPathStyle, L"v-text-kern", L"t");
}
if (props->fUsegFItalic && props->fItalic)
{
appendStyleProperty(m_textPathStyle, L"font-style", L"italic");
}
if (props->fUsegFBold && props->fBold)
{
appendStyleProperty(m_textPathStyle, L"font-weight", L"bold");
}
}break;
default:
{
nProperty = iter->op;
}break;
{
nProperty = iter->op;
}break;
}
}
@ -999,37 +1016,37 @@ namespace DocFileFormat
appendValueAttribute(&m_fill, L"focusposition", focusposition);
}
ODRAW::PVertices* pVP = dynamic_cast<ODRAW::PVertices*>(opVerticles.get());
ODRAW::PSegmentInfo* pSI = dynamic_cast<ODRAW::PSegmentInfo*>(opSegmentInfo.get());
ODRAW::PVertices* pVP = dynamic_cast<ODRAW::PVertices*>(opVerticles.get());
ODRAW::PSegmentInfo* pSI = dynamic_cast<ODRAW::PSegmentInfo*>(opSegmentInfo.get());
if (pVP && pSI)
{
ODRAW::PathParser oParser (pSI->complex.data, pVP->complex.data, m_arrGuides, xCoord, yCoord);
{
ODRAW::PathParser oParser(pSI->complex.data, pVP->complex.data, m_arrGuides, xCoord, yCoord);
std::wstring path = oParser.GetVmlPath();
if (false == path.empty())
m_pXmlWriter->WriteAttribute (L"path", path);
m_pXmlWriter->WriteAttribute(L"path", path);
}
if (freeform && (!xCoord || !yCoord ))
if (freeform && (!xCoord || !yCoord))
{
xCoord = 21600;
yCoord = 21600;
}
if ( !bFilled )
if (!bFilled)
{
m_pXmlWriter->WriteAttribute( L"filled", L"f" );
m_pXmlWriter->WriteAttribute(L"filled", L"f");
}
if ( !bStroked )
if (!bStroked)
{
m_pXmlWriter->WriteAttribute( L"stroked", L"f" );
m_pXmlWriter->WriteAttribute(L"stroked", L"f");
}
if (!layoutInCell)
if (!layoutInCell)
{
m_pXmlWriter->WriteAttribute(L"o:allowincell", L"f");
}
if ( xCoord && yCoord )
if (xCoord && yCoord)
{
if (xCoord2 && yCoord2)
{
@ -1040,17 +1057,17 @@ namespace DocFileFormat
{
m_pXmlWriter->WriteAttribute(L"coordsize", (FormatUtils::SizeTToWideString(*xCoord) + L"," + FormatUtils::SizeTToWideString(*yCoord)));
}
}
}
int nCode = 0;
int nCode = 0;
if (pShape->GetShapeType())
{
nCode = pShape->GetShapeType()->GetTypeCode();
nCode = pShape->GetShapeType()->GetTypeCode();
}
if (DocFileFormat::msosptRoundRectangle == nCode)
{
if (nAdjValues)
if (nAdjValues)
{
double dArcsize = m_nAdjValues[0] / 21600.;
m_pXmlWriter->WriteAttribute(L"arcsize", dArcsize);
@ -1063,7 +1080,7 @@ namespace DocFileFormat
}
else
{
if (nAdjValues > 0)
if (nAdjValues > 0)
{
std::wstring adjTag;
@ -1076,36 +1093,36 @@ namespace DocFileFormat
}
}
m_pXmlWriter->WriteNodeEnd( L"", true, false );
m_pXmlWriter->WriteNodeEnd(L"", true, false);
//build shadow offsets
//build shadow offsets
std::wstring offset;
if ( ShadowOffsetX)
if (ShadowOffsetX)
{
offset += FormatUtils::DoubleToWideString( ShadowOffsetX->ToPoints() );
offset += FormatUtils::DoubleToWideString(ShadowOffsetX->ToPoints());
offset += L"pt";
}
if ( ShadowOffsetY )
if (ShadowOffsetY)
{
offset += L",";
offset += FormatUtils::DoubleToWideString( ShadowOffsetY->ToPoints() );
offset += FormatUtils::DoubleToWideString(ShadowOffsetY->ToPoints());
offset += L"pt";
}
if ( !offset.empty() )
if (!offset.empty())
{
appendValueAttribute(&m_shadow, L"offset", offset);
}
std::wstring offset2;
if ( SecondShadowOffsetX)
if (SecondShadowOffsetX)
{
offset2 += FormatUtils::DoubleToWideString( SecondShadowOffsetX->ToPoints() );
offset2 += FormatUtils::DoubleToWideString(SecondShadowOffsetX->ToPoints());
offset2 += L"pt";
}
if ( SecondShadowOffsetY)
if (SecondShadowOffsetY)
{
offset2 += L",";
offset2 += FormatUtils::DoubleToWideString(SecondShadowOffsetY->ToPoints());
@ -1117,12 +1134,22 @@ namespace DocFileFormat
appendValueAttribute(&m_shadow, L"offset2", offset2);
}
//build shadow origin
if ( ShadowOriginX && ShadowOriginY)
//build shadow origin
if (ShadowOriginX && ShadowOriginY)
{
appendValueAttribute(&m_shadow, L"origin", FormatUtils::DoubleToWideString(*ShadowOriginX) + std::wstring(L"," ) + FormatUtils::DoubleToWideString(*ShadowOriginY));
appendValueAttribute(&m_shadow, L"origin", FormatUtils::DoubleToWideString(*ShadowOriginX) + std::wstring(L",") + FormatUtils::DoubleToWideString(*ShadowOriginY));
}
//build shadow matrix scale
if (matrix[0] || matrix[1] || matrix[2] || matrix[3])
{
std::wstring matrix_str;
for (auto m : matrix)
{
matrix_str += L",";
if (m) matrix_str += std::to_wstring(*m) + L"f";
}
appendValueAttribute(&m_shadow, L"matrix", matrix_str.substr(1));
}
//write the viewpoint
if ( ViewPointX || ViewPointY || ViewPointZ )
{
@ -1154,7 +1181,6 @@ namespace DocFileFormat
{
viewPointOrigin += FormatUtils::DoubleToFormattedWideString( *viewPointOriginX, L"%.2f" );
}
if ( viewPointOriginY )
{
viewPointOrigin += L",";

View File

@ -1046,7 +1046,7 @@ namespace DocFileFormat
return encodingChars;
}
}
void WordDocument::CorrectColor(ODRAW::OfficeArtCOLORREF & color, int base_color)
void WordDocument::CorrectColor(ODRAW::OfficeArtCOLORREF & color, int base_color, int type)
{
struct _color
{
@ -1088,12 +1088,39 @@ namespace DocFileFormat
unsigned short nColorIndex = (unsigned short)(nColorCode & 0x00ff);
unsigned short nPropColor = 0;
_UINT32 systemColors[25] =
_UINT32 systemColors[35] =
{
0xc0c0c0, 0x008080, 0x000080, 0x808080, 0xc0c0c0, 0xffffff, 0x000000,
0x000000, 0x000000, 0xffffff, 0xc0c0c0, 0xc0c0c0, 0x808080, 0x000080,
0xffffff, 0xc0c0c0, 0x808080, 0x808080, 0x000000, 0xc0c0c0, 0xffffff,
0x000000, 0xc0c0c0, 0x000000, 0xffffc0
0xc0c0c0, //COLOR_SCROLLBAR
0x008080, //COLOR_BACKGROUND
0x000080, //COLOR_ACTIVECAPTION
0x808080, //COLOR_INACTIVECAPTION
0xc0c0c0, //COLOR_MENU
0xffffff, //COLOR_WINDOW
0x000000, //COLOR_WINDOWFRAME
0x000000, //COLOR_MENUTEXT
0x000000, //COLOR_WINDOWTEXT
0xffffff, //COLOR_CAPTIONTEXT
0xc0c0c0, //COLOR_ACTIVEBORDER
0xc0c0c0, //COLOR_INACTIVEBORDER
0x808080, //COLOR_APPWORKSPACE
0x000080, //COLOR_HIGHLIGHT
0xffffff, //COLOR_HIGHLIGHTTEXT
0xc0c0c0, //COLOR_3DFACE
0x808080, //COLOR_3DSHADOW
0x808080, //COLOR_GRAYTEXT
0x000000, //COLOR_BTNTEXT
0xc0c0c0, //COLOR_INACTIVECAPTIONTEXT
0xffffff, //COLOR_3DHIGHLIGHT
0x000000, //COLOR_3DDKSHADOW
0xc0c0c0, //COLOR_3DLIGHT
0xffffff, //COLOR_INFOTEXT
0xffffc0, //COLOR_INFOBK
0xb8b4b8, //COLOR_ALTERNATEBTNFACE
0x0000ff, //COLOR_HOTLIGHT
0x1020d0, //COLOR_GRADIENTACTIVECAPTION
0xb8b4b8, //COLOR_GRADIENTINACTIVECAPTION
0x000000, //COLOR_MENUHILIGHT
0x000000 //COLOR_MENUBAR
};
if (nColorIndex == 0xf0)
{
@ -1101,6 +1128,9 @@ namespace DocFileFormat
}
else if (nColorIndex < 25)
{
if (type != 4 && (nColorIndex == 7 || nColorIndex == 8 || nColorIndex == 9 || nColorIndex == 14 ||
nColorIndex == 17 || nColorIndex == 18 || nColorIndex == 19 || nColorIndex == 23)) return;
sys_color.SetRGB((unsigned char)(systemColors[nColorIndex] >> 16), (unsigned char)(systemColors[nColorIndex] >> 8), (unsigned char)(systemColors[nColorIndex]));
}
else return;

View File

@ -256,7 +256,7 @@ namespace DocFileFormat
AnnotationReferenceExDescriptors* AnnotationsReferencesEx;
//------------------------------------------------------------------------------
void CorrectColor(ODRAW::OfficeArtCOLORREF& color, int base_color);
//------------------------------------------------------------------------------
void CorrectColor(ODRAW::OfficeArtCOLORREF& color, int base_color, int type = 1); //fill, back, shadow, text, border
};
}

View File

@ -3664,39 +3664,6 @@ namespace SimpleTypes
m_dSyx = 0; m_dSyy = 1;
m_dPx = 0; m_dPy = 0;
}
void CVml_Matrix::SetMatrix(double dSxx, double dSxy, double dSyx, double dSyy, double dPx, double dPy)
{
m_dSxx = dSxx; m_dSxy = dSxy;
m_dSyx = dSyx; m_dSyy = dSyy;
m_dPx = dPx; m_dPy = dPy;
}
double CVml_Matrix::Get_Sxx() const
{
return m_dSxx;
}
double CVml_Matrix::Get_Sxy() const
{
return m_dSxy;
}
double CVml_Matrix::Get_Syx() const
{
return m_dSyx;
}
double CVml_Matrix::Get_Syy() const
{
return m_dSyy;
}
double CVml_Matrix::Get_Px() const
{
return m_dPx;
}
double CVml_Matrix::Get_Py() const
{
return m_dPy;
}
double CVml_Matrix::FromString(const std::wstring &sValue)
{
ResetMatrix();
@ -3796,8 +3763,8 @@ namespace SimpleTypes
{
m_dX = 0;
m_dY = 0;
m_bUnitsX = true;
m_bUnitsY = true;
m_bUnitsX = false;
m_bUnitsY = false;
}
double CVml_Vector2D_Units_Or_Percentage::GetX() const
@ -3829,15 +3796,15 @@ namespace SimpleTypes
{
m_dX = 0;
m_dY = 0;
m_bUnitsX = true;
m_bUnitsY = true;
m_bUnitsX = false;
m_bUnitsY = false;
int nLen = (int)sValue.length();
if ( nLen < 1)
size_t nLen = sValue.length();
if ( nLen == std::wstring::npos)
return 0;
int nPos = (int)sValue.find( L"," );
if ( -1 == nPos )
size_t nPos = sValue.find( L"," );
if (nPos == std::wstring::npos)
return 0;
std::wstring sTemp = sValue.substr( 0, nPos );
@ -3845,7 +3812,6 @@ namespace SimpleTypes
{
SimpleTypes::CPercentage oPerc = sTemp;
m_dX = oPerc.GetValue();
m_bUnitsX = false;
}
else
{
@ -3859,7 +3825,6 @@ namespace SimpleTypes
{
SimpleTypes::CPercentage oPerc = sTemp;
m_dY = oPerc.GetValue();
m_bUnitsY = false;
}
else
{

View File

@ -1717,20 +1717,10 @@ namespace SimpleTypes
CVml_Matrix &operator =(const std::wstring& wsStr);
void ResetMatrix();
void SetMatrix(double dSxx, double dSxy, double dSyx, double dSyy, double dPx, double dPy);
double Get_Sxx() const;
double Get_Sxy() const;
double Get_Syx() const;
double Get_Syy() const;
double Get_Px() const;
double Get_Py() const;
virtual double FromString(const std::wstring &sValue);
virtual std::wstring ToString () const;
virtual std::wstring ToString () const;
private:
double m_dSxx;
double m_dSxy;
double m_dSyx;
@ -1760,11 +1750,11 @@ namespace SimpleTypes
SimpleTypes_DefaultString(CVml_Vector2D_Units_Or_Percentage)
private:
double m_dX; //
double m_dY; //
double m_dX;
double m_dY;
bool m_bUnitsX;
bool m_bUnitsY;
bool m_bUnitsX;
bool m_bUnitsY;
};
//--------------------------------------------------------------------------------

View File

@ -1113,13 +1113,6 @@ namespace OOX
}
void CShadow::ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Выставляем значения по умолчанию
m_oColor.SetRGB( 128, 128, 128 );
m_oColor2.SetRGB( 203, 203, 203 );
m_oOffset.SetValue_Points( 2, 2 );
m_oOffset2.SetValue_Points( -2, -2 );
m_oOrigin.SetValue( 0, 0 );
if ( oReader.GetAttributesCount() <= 0 )
return;

View File

@ -4920,6 +4920,7 @@ void CDrawingConverter::CheckEffectShape(PPTX::Logic::SpTreeElem* oElem, XmlUtil
oMod.val = nA;
pEffectLst->outerShdw->Color.Color->Modifiers.push_back(oMod);
}
double offsetX = oOffset.IsXinPoints() ? oOffset.GetX() : 0;
double offsetY = oOffset.IsYinPoints() ? oOffset.GetY() : 0;
@ -4928,9 +4929,25 @@ void CDrawingConverter::CheckEffectShape(PPTX::Logic::SpTreeElem* oElem, XmlUtil
if (offsetX < 0) dir += 180;
if (dir < 0) dir += 360;
pEffectLst->outerShdw->dist = dist * (635 * 20);
pEffectLst->outerShdw->dir = (int)(dir * 60000);
if (dist > 0 && dir > 0)
{
pEffectLst->outerShdw->dist = dist * (635 * 20);
pEffectLst->outerShdw->dir = (int)(dir * 60000);
}
pEffectLst->outerShdw->rotWithShape = false;
if (oMatrix.IsInit())
{
if (oMatrix->m_dSxx > 1.001 || oMatrix->m_dSxx < 0.999)
pEffectLst->outerShdw->sx = (int)(oMatrix->m_dSxx / 65535. * 100000);
if (oMatrix->m_dSyy > 1.001 || oMatrix->m_dSyy < 0.999)
pEffectLst->outerShdw->sy = (int)(oMatrix->m_dSyy / 65535. * 100000);
if (oMatrix->m_dSxy > 0.001 || oMatrix->m_dSxy < 0)
pEffectLst->outerShdw->ky = (int)(oMatrix->m_dSxy / 65535. * 100000);
if (oMatrix->m_dSyx > 0.001 || oMatrix->m_dSyx < 0)
pEffectLst->outerShdw->kx = (int)(oMatrix->m_dSyx / 65535. * 100000);
}
}
}