Commit e4925ca4 authored by Elen.Subbotina's avatar Elen.Subbotina Committed by Alexander Trofimov

PPTFormat правка по результатам тестирования

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@65399 954022d7-b5bf-4e40-9824-e11837661b57
parent 4998e410
...@@ -552,7 +552,7 @@ void CPPTUserInfo::LoadSlide(DWORD dwSlideID, CSlide* pSlide) ...@@ -552,7 +552,7 @@ void CPPTUserInfo::LoadSlide(DWORD dwSlideID, CSlide* pSlide)
pShape->SetupProperties(pSlide, pTheme, pLayout); pShape->SetupProperties(pSlide, pTheme, pLayout);
pSlide->m_bIsBackground = true; pSlide->m_bIsBackground = true;
pSlide->m_oBackground = pShape->m_oShape.m_oBrush; pSlide->m_oBackground = pShape->m_oBrush;
} }
RELEASEOBJECT(pElem); RELEASEOBJECT(pElem);
continue; continue;
...@@ -812,7 +812,7 @@ void CPPTUserInfo::LoadMainMaster(DWORD dwMasterID, const LONG& lOriginWidth, co ...@@ -812,7 +812,7 @@ void CPPTUserInfo::LoadMainMaster(DWORD dwMasterID, const LONG& lOriginWidth, co
pShape->SetupProperties(NULL, pTheme, pLayout); pShape->SetupProperties(NULL, pTheme, pLayout);
pTheme->m_bIsBackground = true; pTheme->m_bIsBackground = true;
pTheme->m_oBackground = pShape->m_oShape.m_oBrush; pTheme->m_oBackground = pShape->m_oBrush;
} }
RELEASEINTERFACE(pElem); RELEASEINTERFACE(pElem);
...@@ -985,7 +985,7 @@ void CPPTUserInfo::LoadNoMainMaster(DWORD dwMasterID, const LONG& lOriginWidth, ...@@ -985,7 +985,7 @@ void CPPTUserInfo::LoadNoMainMaster(DWORD dwMasterID, const LONG& lOriginWidth,
pShape->SetupProperties(NULL, pTheme, pLayout); pShape->SetupProperties(NULL, pTheme, pLayout);
pLayout->m_bIsBackground = true; pLayout->m_bIsBackground = true;
pLayout->m_oBackground = pShape->m_oShape.m_oBrush; pLayout->m_oBackground = pShape->m_oBrush;
} }
RELEASEINTERFACE(pElem); RELEASEINTERFACE(pElem);
continue; continue;
......
...@@ -1052,23 +1052,52 @@ namespace NSPresentationEditor ...@@ -1052,23 +1052,52 @@ namespace NSPresentationEditor
{ {
public: public:
bool Visible; bool Visible;
double DistanceX;
double DistanceY; double DistanceX;
double BlurSize; double DistanceY;
CColor Color;
long Alpha; double OriginX;
double OriginY;
double BlurSize;
CColor Color;
long Alpha;
int Type;
double ScaleXToX;
double ScaleXToY;
double ScaleYToX;
double ScaleYToY;
int PerspectiveX;
int PerspectiveY;
public: public:
void SetDefaultParams() void SetDefaultParams()
{ {
Visible = false; Visible = false;
DistanceX = 0.1; DistanceX = 0.1;
DistanceY = 0.1; DistanceY = 0.1;
BlurSize = 0; BlurSize = 0;
Color = 0; Alpha = 255;
Alpha = 255;
OriginX = 0;
OriginY = 0;
Type = -1;
ScaleXToX = 1.;
ScaleXToY = 1.;
ScaleYToX = 1.;
ScaleYToY = 1.;
PerspectiveX = 0;
PerspectiveY = 0;
Color.SetRGB(0x80, 0x80, 0x80);
} }
public: public:
...@@ -1079,23 +1108,45 @@ namespace NSPresentationEditor ...@@ -1079,23 +1108,45 @@ namespace NSPresentationEditor
} }
CShadow( const CShadow& other ) CShadow( const CShadow& other )
{ {
Visible = other.Visible; Visible = other.Visible;
DistanceX = other.DistanceX; DistanceX = other.DistanceX;
DistanceY = other.DistanceY; DistanceY = other.DistanceY;
BlurSize = other.BlurSize; OriginX = other.OriginX;
Color = other.Color; OriginY = other.OriginY;
Alpha = other.Alpha; BlurSize = other.BlurSize;
Color = other.Color;
Alpha = other.Alpha;
Type = other.Type;
ScaleXToX = other.ScaleXToX;
ScaleXToY = other.ScaleXToY;
ScaleYToX = other.ScaleYToX;
ScaleYToY = other.ScaleYToY;
PerspectiveX= other.PerspectiveX;
PerspectiveY= other.PerspectiveY;
} }
CShadow& operator=(const CShadow& other) CShadow& operator=(const CShadow& other)
{ {
Visible = other.Visible; Visible = other.Visible;
DistanceX = other.DistanceX; DistanceX = other.DistanceX;
DistanceY = other.DistanceY; DistanceY = other.DistanceY;
BlurSize = other.BlurSize; OriginX = other.OriginX;
Color = other.Color; OriginY = other.OriginY;
Alpha = other.Alpha; BlurSize = other.BlurSize;
Color = other.Color;
Alpha = other.Alpha;
Type = other.Type;
PerspectiveX= other.PerspectiveX;
PerspectiveY= other.PerspectiveY;
ScaleXToX = other.ScaleXToX;
ScaleXToY = other.ScaleXToY;
ScaleYToX = other.ScaleYToX;
ScaleYToY = other.ScaleYToY;
return *this; return *this;
} }
virtual ~CShadow() virtual ~CShadow()
......
...@@ -33,6 +33,10 @@ namespace NSPresentationEditor ...@@ -33,6 +33,10 @@ namespace NSPresentationEditor
CAnimationInfo m_oAnimations; CAnimationInfo m_oAnimations;
CEffects m_oEffects; CEffects m_oEffects;
CPen m_oPen;
CBrush m_oBrush;
CShadow m_oShadow;
int m_lID; int m_lID;
int m_lLayoutID; int m_lLayoutID;
...@@ -191,6 +195,10 @@ namespace NSPresentationEditor ...@@ -191,6 +195,10 @@ namespace NSPresentationEditor
pDublicate->m_pTheme = m_pTheme; pDublicate->m_pTheme = m_pTheme;
pDublicate->m_pLayout = m_pLayout; pDublicate->m_pLayout = m_pLayout;
pDublicate->m_oPen = m_oPen;
pDublicate->m_oBrush = m_oBrush;
pDublicate->m_oShadow = m_oShadow;
} }
public: public:
......
...@@ -603,9 +603,9 @@ namespace NSPresentationEditor ...@@ -603,9 +603,9 @@ namespace NSPresentationEditor
SetupTextProperties(pSlide, pTheme, pLayout); SetupTextProperties(pSlide, pTheme, pLayout);
CalculateColor(m_oShape.m_oPen.Color , pSlide, pTheme, pLayout); CalculateColor(m_oPen.Color , pSlide, pTheme, pLayout);
CalculateColor(m_oShape.m_oBrush.Color1 , pSlide, pTheme, pLayout); CalculateColor(m_oBrush.Color1 , pSlide, pTheme, pLayout);
CalculateColor(m_oShape.m_oBrush.Color2 , pSlide, pTheme, pLayout); CalculateColor(m_oBrush.Color2 , pSlide, pTheme, pLayout);
} }
virtual void SetupTextProperties(CSlide* pSlide, CTheme* pTheme, CLayout* pLayout); virtual void SetupTextProperties(CSlide* pSlide, CTheme* pTheme, CLayout* pLayout);
...@@ -649,89 +649,89 @@ namespace NSPresentationEditor ...@@ -649,89 +649,89 @@ namespace NSPresentationEditor
} }
case CElementProperty::epBrushType: case CElementProperty::epBrushType:
{ {
m_oShape.m_oBrush.Type = (LONG)pProperty->m_dwValue; m_oBrush.Type = (LONG)pProperty->m_dwValue;
break; break;
} }
case CElementProperty::epBrushColor1: case CElementProperty::epBrushColor1:
{ {
m_oShape.m_oBrush.Color1.SetSBGR(pProperty->m_dwValue); m_oBrush.Color1.SetSBGR(pProperty->m_dwValue);
CalculateColor(m_oShape.m_oBrush.Color1, pSlide, pTheme, pLayout); CalculateColor(m_oBrush.Color1, pSlide, pTheme, pLayout);
break; break;
} }
case CElementProperty::epBrushColor2: case CElementProperty::epBrushColor2:
{ {
m_oShape.m_oBrush.Color2.SetSBGR(pProperty->m_dwValue); m_oBrush.Color2.SetSBGR(pProperty->m_dwValue);
CalculateColor(m_oShape.m_oBrush.Color2, pSlide, pTheme, pLayout); CalculateColor(m_oBrush.Color2, pSlide, pTheme, pLayout);
break; break;
} }
case CElementProperty::epBrushAlpha1: case CElementProperty::epBrushAlpha1:
{ {
m_oShape.m_oBrush.Alpha1 = (BYTE)pProperty->m_dwValue; m_oBrush.Alpha1 = (BYTE)pProperty->m_dwValue;
break; break;
} }
case CElementProperty::epBrushAlpha2: case CElementProperty::epBrushAlpha2:
{ {
m_oShape.m_oBrush.Alpha2 = (BYTE)pProperty->m_dwValue; m_oBrush.Alpha2 = (BYTE)pProperty->m_dwValue;
break; break;
} }
case CElementProperty::epBrushTxPath: case CElementProperty::epBrushTxPath:
{ {
m_oShape.m_oBrush.TexturePath = pProperty->m_strAdvanced; m_oBrush.TexturePath = pProperty->m_strAdvanced;
break; break;
} }
case CElementProperty::epBrushTxMode: case CElementProperty::epBrushTxMode:
{ {
m_oShape.m_oBrush.TextureMode = (LONG)pProperty->m_dwValue; m_oBrush.TextureMode = (LONG)pProperty->m_dwValue;
break; break;
} }
case CElementProperty::epFilled: case CElementProperty::epFilled:
{ {
if (0 == pProperty->m_dwValue) if (0 == pProperty->m_dwValue)
{ {
m_oShape.m_oBrush.Alpha1 = 0; m_oBrush.Alpha1 = 0;
} }
break; break;
} }
case CElementProperty::epPenColor: case CElementProperty::epPenColor:
{ {
m_oShape.m_oPen.Color.SetSBGR(pProperty->m_dwValue); m_oPen.Color.SetSBGR(pProperty->m_dwValue);
CalculateColor(m_oShape.m_oPen.Color, pSlide, pTheme, pLayout); CalculateColor(m_oPen.Color, pSlide, pTheme, pLayout);
break; break;
} }
case CElementProperty::epPenAlpha: case CElementProperty::epPenAlpha:
{ {
m_oShape.m_oPen.Alpha = (BYTE)pProperty->m_dwValue; m_oPen.Alpha = (BYTE)pProperty->m_dwValue;
break; break;
} }
case CElementProperty::epPenWidth: case CElementProperty::epPenWidth:
{ {
m_oShape.m_oPen.Size = (double)pProperty->m_dwValue / 0xFFFF; m_oPen.Size = (double)pProperty->m_dwValue / 0xFFFF;
break; break;
} }
case CElementProperty::epPenJoin: case CElementProperty::epPenJoin:
{ {
m_oShape.m_oPen.LineJoin = (BYTE)pProperty->m_dwValue; m_oPen.LineJoin = (BYTE)pProperty->m_dwValue;
break; break;
} }
case CElementProperty::epLineDash: case CElementProperty::epLineDash:
{ {
m_oShape.m_oPen.DashStyle = (BYTE)pProperty->m_dwValue; m_oPen.DashStyle = (BYTE)pProperty->m_dwValue;
break; break;
} }
case CElementProperty::epLineStartCap: case CElementProperty::epLineStartCap:
{ {
m_oShape.m_oPen.LineStartCap = (BYTE)pProperty->m_dwValue; m_oPen.LineStartCap = (BYTE)pProperty->m_dwValue;
break; break;
} }
case CElementProperty::epLineEndCap: case CElementProperty::epLineEndCap:
{ {
m_oShape.m_oPen.LineEndCap = (BYTE)pProperty->m_dwValue; m_oPen.LineEndCap = (BYTE)pProperty->m_dwValue;
break; break;
} }
case CElementProperty::epStroked: case CElementProperty::epStroked:
{ {
if (0 == pProperty->m_dwValue) if (0 == pProperty->m_dwValue)
m_oShape.m_oPen.Alpha = 0; m_oPen.Alpha = 0;
break; break;
} }
......
...@@ -615,8 +615,8 @@ namespace NSCustomVML ...@@ -615,8 +615,8 @@ namespace NSCustomVML
bool bBreak = false; bool bBreak = false;
LONG lMinF = (LONG)0x80000000; long lMinF = (_INT32)0x80000000;
LONG lMaxF = (LONG)0x8000007F; long lMaxF = (_INT32)0x8000007F;
int nGuideIndex_x , nGuideIndex_y; int nGuideIndex_x , nGuideIndex_y;
...@@ -628,13 +628,12 @@ namespace NSCustomVML ...@@ -628,13 +628,12 @@ namespace NSCustomVML
{ {
nGuideIndex_x = nGuideIndex_y = -1; nGuideIndex_x = nGuideIndex_y = -1;
if (lMinF <= (DWORD)m_arVertices[nIndex].x) nGuideIndex_x = (DWORD)m_arVertices[nIndex].x - 0x80000000; if (lMaxF > m_arVertices[nIndex].x ) nGuideIndex_x = (DWORD)m_arVertices[nIndex].x - (DWORD)lMinF;
if (lMinF <= (DWORD)m_arVertices[nIndex].y) nGuideIndex_y = (DWORD)m_arVertices[nIndex].y - 0x80000000; if (lMaxF > m_arVertices[nIndex].y ) nGuideIndex_y = (DWORD)m_arVertices[nIndex].y - (DWORD)lMinF;
CString str = _T(""); CString str = _T("");
if (nGuideIndex_x >= 0 ) if (nGuideIndex_x >= 0 )
{ {
//str.Format(_T("gd%d,"), nGuideIndex_x);
str.Format(_T("%d,"), m_arGuides[nGuideIndex_x].m_param_value1); str.Format(_T("%d,"), m_arGuides[nGuideIndex_x].m_param_value1);
strPath += str; strPath += str;
} }
...@@ -645,7 +644,6 @@ namespace NSCustomVML ...@@ -645,7 +644,6 @@ namespace NSCustomVML
} }
if (nGuideIndex_y >= 0) if (nGuideIndex_y >= 0)
{ {
//str.Format(_T("gd%d,"), nGuideIndex_y);
str.Format(_T("%d,"), m_arGuides[nGuideIndex_y].m_param_value1); str.Format(_T("%d,"), m_arGuides[nGuideIndex_y].m_param_value1);
strPath += str; strPath += str;
} }
...@@ -711,13 +709,12 @@ namespace NSCustomVML ...@@ -711,13 +709,12 @@ namespace NSCustomVML
{ {
nGuideIndex_x = nGuideIndex_y = -1; nGuideIndex_x = nGuideIndex_y = -1;
if (lMinF <= (DWORD)m_arVertices[nV].x) nGuideIndex_x = (DWORD)m_arVertices[nV].x - 0x80000000; if (lMaxF > m_arVertices[nV].x ) nGuideIndex_x = (DWORD)m_arVertices[nV].x - (DWORD)lMinF;
if (lMinF <= (DWORD)m_arVertices[nV].y) nGuideIndex_y = (DWORD)m_arVertices[nV].y - 0x80000000; if (lMaxF > m_arVertices[nV].y ) nGuideIndex_y = (DWORD)m_arVertices[nV].y - (DWORD)lMinF;
CString str = _T(""); CString str = _T("");
if (nGuideIndex_x >= 0 ) if (nGuideIndex_x >= 0 )
{ {
//str.Format(_T("gd%d,"), nGuideIndex_x);
str.Format(_T("%d,"), m_arGuides[nGuideIndex_x].m_param_value1); str.Format(_T("%d,"), m_arGuides[nGuideIndex_x].m_param_value1);
strPath += str; strPath += str;
} }
...@@ -728,7 +725,6 @@ namespace NSCustomVML ...@@ -728,7 +725,6 @@ namespace NSCustomVML
} }
if (nGuideIndex_y >= 0) if (nGuideIndex_y >= 0)
{ {
//str.Format(_T("gd%d,"), nGuideIndex_y);//m_arGuides[nGuideIndex_y].m_param_value1);
str.Format(_T("%d,"), m_arGuides[nGuideIndex_y].m_param_value1); str.Format(_T("%d,"), m_arGuides[nGuideIndex_y].m_param_value1);
strPath += str; strPath += str;
} }
......
...@@ -34,11 +34,8 @@ public: ...@@ -34,11 +34,8 @@ public:
long m_lLimoX; long m_lLimoX;
long m_lLimoY; long m_lLimoY;
CPen m_oPen;
CBrush m_oBrush;
CTextAttributesEx m_oText; CTextAttributesEx m_oText;
CShadow m_oShadow;
double m_dWidthLogic; double m_dWidthLogic;
double m_dHeightLogic; double m_dHeightLogic;
...@@ -128,17 +125,17 @@ public: ...@@ -128,17 +125,17 @@ public:
} }
virtual CString GetBrushXml() //virtual CString GetBrushXml()
{ //{
if (!m_pShape->m_bConcentricFill) // if (!m_pShape->m_bConcentricFill)
return _T(""); // return _T("");
return m_oBrush.ToString(); // return m_oBrush.ToString();
} //}
virtual CString GetPenXml() //virtual CString GetPenXml()
{ //{
return m_oPen.ToString(); // return m_oPen.ToString();
} //}
virtual void GetTextRect(CGeomShapeInfo& oInfo) virtual void GetTextRect(CGeomShapeInfo& oInfo)
{ {
...@@ -297,7 +294,9 @@ public: ...@@ -297,7 +294,9 @@ public:
m_pShape->m_oPath.SetCoordsize((LONG)m_dWidthLogic, (LONG)m_dHeightLogic); m_pShape->m_oPath.SetCoordsize((LONG)m_dWidthLogic, (LONG)m_dHeightLogic);
CString strDrawing = m_pShape->ToXML(oGeomInfo, pInfo, dStartTime, dEndTime, m_oBrush, m_oPen); CBrush brush; //
CPen pen;
CString strDrawing = m_pShape->ToXML(oGeomInfo, pInfo, dStartTime, dEndTime, brush, pen);
if (m_lDrawType & c_ShapeDrawType_Graphic) if (m_lDrawType & c_ShapeDrawType_Graphic)
{ {
strImageTransform += strDrawing; strImageTransform += strDrawing;
...@@ -321,11 +320,13 @@ public: ...@@ -321,11 +320,13 @@ public:
if (m_lDrawType & c_ShapeDrawType_Graphic) if (m_lDrawType & c_ShapeDrawType_Graphic)
{ {
m_oPen.SetToRenderer(pRenderer); //m_oPen.SetToRenderer(pRenderer);
m_oBrush.SetToRenderer(pRenderer); //m_oBrush.SetToRenderer(pRenderer);
//m_oShadow.SetToRenderer(pRenderer); //m_oShadow.SetToRenderer(pRenderer);
CBrush brush; //
CPen pen;
m_pShape->ToRenderer(pRenderer, oGeomInfo, dStartTime, dEndTime, m_oPen, m_oBrush, pInfo); m_pShape->ToRenderer(pRenderer, oGeomInfo, dStartTime, dEndTime, pen, brush, pInfo);
} }
} }
...@@ -377,23 +378,20 @@ public: ...@@ -377,23 +378,20 @@ public:
if(Shape == NULL) if(Shape == NULL)
return false; return false;
Shape->m_dStartTime = m_dStartTime; Shape->m_dStartTime = m_dStartTime;
Shape->m_dEndTime = m_dEndTime; Shape->m_dEndTime = m_dEndTime;
Shape->m_rcBounds = m_rcBounds; Shape->m_rcBounds = m_rcBounds;
Shape->m_lLimoX = m_lLimoX; Shape->m_lLimoX = m_lLimoX;
Shape->m_lLimoY = m_lLimoY; Shape->m_lLimoY = m_lLimoY;
Shape->m_oPen = m_oPen; Shape->m_oText = m_oText;
Shape->m_oBrush = m_oBrush;
Shape->m_oText = m_oText;
Shape->m_oShadow = m_oShadow;
Shape->m_dWidthLogic = m_dWidthLogic; Shape->m_dWidthLogic = m_dWidthLogic;
Shape->m_dHeightLogic = m_dHeightLogic; Shape->m_dHeightLogic = m_dHeightLogic;
Shape->m_lDrawType = m_lDrawType; Shape->m_lDrawType = m_lDrawType;
Shape->m_dTextMarginX = m_dTextMarginX; Shape->m_dTextMarginX = m_dTextMarginX;
Shape->m_dTextMarginY = m_dTextMarginY; Shape->m_dTextMarginY = m_dTextMarginY;
...@@ -412,21 +410,21 @@ public: ...@@ -412,21 +410,21 @@ public:
if (oNodePict.GetNode(_T("stroke"), oNodeTemplate)) if (oNodePict.GetNode(_T("stroke"), oNodeTemplate))
{ {
CString strColor = oNodeTemplate.GetAttributeOrValue(_T("strokecolor")); CString strColor = oNodeTemplate.GetAttributeOrValue(_T("strokecolor"));
if (strColor != _T("")) //if (strColor != _T(""))
m_oPen.Color.FromString(strColor); // m_oPen.Color.FromString(strColor);
CString strSize = oNodeTemplate.GetAttributeOrValue(_T("strokeweight")); //CString strSize = oNodeTemplate.GetAttributeOrValue(_T("strokeweight"));
if (strSize != _T("")) //if (strSize != _T(""))
m_oPen.Size = XmlUtils::GetDouble(strSize); // m_oPen.Size = XmlUtils::GetDouble(strSize);
CString strStroke = oNodeTemplate.GetAttributeOrValue(_T("stroked")); //CString strStroke = oNodeTemplate.GetAttributeOrValue(_T("stroked"));
if (strStroke != _T("")) //if (strStroke != _T(""))
m_oPen.Alpha = 0; // m_oPen.Alpha = 0;
} }
if (oNodePict.GetNode(_T("v:stroke"), oNodeTemplate)) if (oNodePict.GetNode(_T("v:stroke"), oNodeTemplate))
{ {
CString strColor = oNodeTemplate.GetAttributeOrValue(_T("dashstyle")); CString strColor = oNodeTemplate.GetAttributeOrValue(_T("dashstyle"));
if (strColor != _T("")) //if (strColor != _T(""))
m_oPen.DashStyle = XmlUtils::GetInteger(strColor); // m_oPen.DashStyle = XmlUtils::GetInteger(strColor);
} }
} }
...@@ -436,8 +434,8 @@ public: ...@@ -436,8 +434,8 @@ public:
if (oNodePict.GetNode(_T("fillcolor"), oNodeTemplate)) if (oNodePict.GetNode(_T("fillcolor"), oNodeTemplate))
{ {
CString strColor = oNodeTemplate.GetAttributeOrValue(_T("val")); CString strColor = oNodeTemplate.GetAttributeOrValue(_T("val"));
if (strColor != _T("")) //if (strColor != _T(""))
m_oBrush.Color1.FromString(strColor); // m_oBrush.Color1.FromString(strColor);
} }
} }
......
...@@ -32,16 +32,12 @@ NSPresentationEditor::CShapeWriter::CShapeWriter() ...@@ -32,16 +32,12 @@ NSPresentationEditor::CShapeWriter::CShapeWriter()
m_pImageElement = NULL; m_pImageElement = NULL;
m_pShapeElement = NULL; m_pShapeElement = NULL;
} }
CString NSPresentationEditor::CShapeWriter::ConvertLine() CString NSPresentationEditor::CShapeWriter::ConvertLine(CPen & pen)
{ {
if (m_pShapeElement->m_bLine == false) return _T("");
NSPresentationEditor::CStringWriter line_writer; NSPresentationEditor::CStringWriter line_writer;
CPen* pPen = &m_pShapeElement->m_oShape.m_oPen;
CString strLine = _T(""); CString strLine = _T("");
strLine.Format(_T("<a:ln w=\"%d\">"), (int)(pPen->Size * 36000)); strLine.Format(_T("<a:ln w=\"%d\">"), (int)(pen.Size * 36000));
line_writer.WriteString(strLine); line_writer.WriteString(strLine);
if (m_bWordArt) if (m_bWordArt)
...@@ -51,7 +47,7 @@ CString NSPresentationEditor::CShapeWriter::ConvertLine() ...@@ -51,7 +47,7 @@ CString NSPresentationEditor::CShapeWriter::ConvertLine()
else else
{ {
line_writer.WriteString(std::wstring(L"<a:solidFill>")); line_writer.WriteString(std::wstring(L"<a:solidFill>"));
line_writer.WriteString(ConvertColor(pPen->Color, pPen->Alpha)); line_writer.WriteString(ConvertColor(pen.Color, pen.Alpha));
line_writer.WriteString(std::wstring(L"</a:solidFill>")); line_writer.WriteString(std::wstring(L"</a:solidFill>"));
} }
...@@ -114,36 +110,120 @@ CString NSPresentationEditor::CShapeWriter::ConvertBrush(CBrush & brush) ...@@ -114,36 +110,120 @@ CString NSPresentationEditor::CShapeWriter::ConvertBrush(CBrush & brush)
return brush_writer.GetData(); return brush_writer.GetData();
} }
CString NSPresentationEditor::CShapeWriter::ConvertShadow() CString NSPresentationEditor::CShapeWriter::ConvertShadow(CShadow & shadow)
{ {
if (m_pShapeElement->m_oShape.m_oShadow.Visible == false) return _T(""); std::wstring Preset;
if (abs(m_pShapeElement->m_oShape.m_oShadow.DistanceY) < 0.001) return _T(""); bool Inner = false;
double dist = sqrt(m_pShapeElement->m_oShape.m_oShadow.DistanceY * m_pShapeElement->m_oShape.m_oShadow.DistanceY + if (shadow.Visible == false) return _T("");
m_pShapeElement->m_oShape.m_oShadow.DistanceX * m_pShapeElement->m_oShape.m_oShadow.DistanceX);
double dist = sqrt(shadow.DistanceY * shadow.DistanceY + shadow.DistanceX * shadow.DistanceX);
double dir = 0;
if (abs(shadow.DistanceY) > 0)
{
dir = 180 * atan(shadow.DistanceX / shadow.DistanceY) / 3.1415926;
double dir = 180 * atan(m_pShapeElement->m_oShape.m_oShadow.DistanceX / m_pShapeElement->m_oShape.m_oShadow.DistanceY) / 3.1415926; if (dir < 0) dir += 180;
if (dir < 0) dir += 360; if (shadow.DistanceX < 0 && shadow.DistanceY < 0) dir *= 10;
}
CString strDir = _T(""); if (shadow.Type == 1) Preset = L"shdw13";
strDir.Format(_T(" dir=\"%d\""), (int)(dir * 60000));
if (shadow.Type == 5)
{
if (shadow.DistanceX < 0 && shadow.DistanceY < 0) Preset = L"shdw18";
else Preset = L"shdw17";
}
if (shadow.Type == 2 && shadow.OriginX < 0)
{
if (shadow.OriginX < -1.4)
{
if (shadow.ScaleYToY < 0) Preset = L"shdw15";
else Preset = L"shdw11";
}
else
{
if (shadow.ScaleYToY < 0) Preset = L"shdw16";
else Preset = L"shdw12";
}
}
CString strDir = _T("");
CString strDist = _T(""); CString strDist = _T("");
strDist.Format(_T(" dist=\"%d\""), (int)(dist * 36000));
if (shadow.DistanceY != 0 && shadow.DistanceX != 0)
{
if (shadow.DistanceY < 0 && shadow.DistanceX < 0) dir /=2;
strDir.Format(_T(" dir=\"%d\""), (int)(dir * 60000));
strDist.Format(_T(" dist=\"%d\""), (int)(dist * 36000));
}
CString strSY = _T("");
if (shadow.ScaleYToY < 1 || shadow.ScaleYToY > 1)
{
if (shadow.ScaleYToX < 1)shadow.ScaleYToY = -shadow.ScaleYToY;
strSY.Format(_T(" sy=\"%d\""), (int)(shadow.ScaleYToY * 100000));
}
CString strSX = _T("");
if (shadow.ScaleYToX < 1 || shadow.ScaleYToX > 1)
{
//strSX.Format(_T(" sx=\"%d\""), (int)(shadow.ScaleYToX * 100000));
strSX.Format(_T(" kx=\"%d\""), (int)((shadow.ScaleYToX + 0.5) * 360000));
}
NSPresentationEditor::CStringWriter shadow_writer; NSPresentationEditor::CStringWriter shadow_writer;
shadow_writer.WriteString(std::wstring(L"<a:effectLst>")); shadow_writer.WriteString(std::wstring(L"<a:effectLst>"));
shadow_writer.WriteString(std::wstring(L"<a:outerShdw"));
shadow_writer.WriteString(std::wstring(L" rotWithShape=\"0\" algn=\"ctr\"")); if (!Preset.empty())
shadow_writer.WriteString(strDir); {
shadow_writer.WriteString(strDist); shadow_writer.WriteString(std::wstring(L"<a:prstShdw"));
shadow_writer.WriteString(std::wstring(L">")); shadow_writer.WriteString(std::wstring(L" prst=\"") + Preset + std::wstring(L"\""));
//shadow_writer.WriteString(std::wstring(L" rotWithShape=\"0\" algn=\"ctr\""));
shadow_writer.WriteString(ConvertColor(m_pShapeElement->m_oShape.m_oShadow.Color,m_pShapeElement->m_oShape.m_oShadow.Alpha)); shadow_writer.WriteString(strDir);
shadow_writer.WriteString(std::wstring(L"</a:outerShdw>")); shadow_writer.WriteString(strDist);
shadow_writer.WriteString(std::wstring(L">"));
shadow_writer.WriteString(ConvertColor(shadow.Color,shadow.Alpha));
shadow_writer.WriteString(std::wstring(L"</a:prstShdw>"));
}
else if (Inner)
{
shadow_writer.WriteString(std::wstring(L"<a:innerShdw"));
shadow_writer.WriteString(std::wstring(L" rotWithShape=\"0\""));
if (strSX.IsEmpty() && strSY.IsEmpty())
{
shadow_writer.WriteString(std::wstring(L" algn=\"ctr\""));
}
shadow_writer.WriteString(strSX);
shadow_writer.WriteString(strSY);
shadow_writer.WriteString(strDir);
shadow_writer.WriteString(strDist);
shadow_writer.WriteString(std::wstring(L">"));
shadow_writer.WriteString(ConvertColor(shadow.Color,shadow.Alpha));
shadow_writer.WriteString(std::wstring(L"</a:innerShdw>"));
}
else
{
shadow_writer.WriteString(std::wstring(L"<a:outerShdw"));
shadow_writer.WriteString(std::wstring(L" rotWithShape=\"0\""));
if (strSX.IsEmpty() && strSY.IsEmpty())
{
shadow_writer.WriteString(std::wstring(L" algn=\"ctr\""));
}
shadow_writer.WriteString(strSX);
shadow_writer.WriteString(strSY);
shadow_writer.WriteString(strDir);
shadow_writer.WriteString(strDist);
shadow_writer.WriteString(std::wstring(L">"));
shadow_writer.WriteString(ConvertColor(shadow.Color,shadow.Alpha));
shadow_writer.WriteString(std::wstring(L"</a:outerShdw>"));
}
shadow_writer.WriteString(std::wstring(L"</a:effectLst>")); shadow_writer.WriteString(std::wstring(L"</a:effectLst>"));
return shadow_writer.GetData(); return shadow_writer.GetData();
} }
...@@ -581,7 +661,7 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo() ...@@ -581,7 +661,7 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
if (m_bWordArt) if (m_bWordArt)
{ {
m_oWriter.WriteString(ConvertBrush(m_pShapeElement->m_oShape.m_oBrush)); m_oWriter.WriteString(ConvertBrush(m_pShapeElement->m_oBrush));
} }
else else
{ {
...@@ -734,26 +814,22 @@ CString NSPresentationEditor::CShapeWriter::ConvertShape() ...@@ -734,26 +814,22 @@ CString NSPresentationEditor::CShapeWriter::ConvertShape()
m_pShapeElement->m_oShape.ToRenderer(dynamic_cast<IRenderer*>(this), oInfo, m_oMetricInfo, 0.0, 1.0); m_pShapeElement->m_oShape.ToRenderer(dynamic_cast<IRenderer*>(this), oInfo, m_oMetricInfo, 0.0, 1.0);
} }
if (prstTxWarp.empty()) if ((prstGeom.empty() == false || m_pShapeElement->m_bShapePreset) && prstTxWarp.empty())
{ {
if (m_pShapeElement->m_bShapePreset) if (prstGeom.empty()) prstGeom = L"rect";
m_oWriter.WriteString(std::wstring(L"<a:prstGeom"));
{ {
if (prstGeom.empty()) prstGeom = L"rect"; m_oWriter.WriteString(std::wstring(L" prst=\"") + prstGeom + std::wstring(L"\">"));
if (!m_bWordArt)
m_oWriter.WriteString(std::wstring(L"<a:prstGeom"));
{ {
m_oWriter.WriteString(std::wstring(L" prst=\"") + prstGeom + std::wstring(L"\">")); m_oWriter.WriteString(std::wstring(L"<a:avLst/>"));
if (!m_bWordArt)
{
m_oWriter.WriteString(std::wstring(L"<a:avLst/>"));
}
} }
m_oWriter.WriteString(std::wstring(L"</a:prstGeom>"));
}
else
{
m_oWriter.WriteString(m_pShapeElement->ConvertPPTShapeToPPTX());
} }
m_oWriter.WriteString(std::wstring(L"</a:prstGeom>"));
}
else if (prstTxWarp.empty())
{
m_oWriter.WriteString(m_pShapeElement->ConvertPPTShapeToPPTX());
} }
else else
{ {
...@@ -761,10 +837,13 @@ CString NSPresentationEditor::CShapeWriter::ConvertShape() ...@@ -761,10 +837,13 @@ CString NSPresentationEditor::CShapeWriter::ConvertShape()
m_oWriter.WriteString(std::wstring(L"<a:prstGeom prst=\"rect\"/>")); m_oWriter.WriteString(std::wstring(L"<a:prstGeom prst=\"rect\"/>"));
} }
m_oWriter.WriteString(ConvertBrush(m_oBrush)); m_oWriter.WriteString(ConvertBrush(m_pShapeElement->m_oBrush));
m_oWriter.WriteString(ConvertLine()); if (m_pShapeElement->m_bLine)
m_oWriter.WriteString(ConvertShadow()); {
m_oWriter.WriteString(ConvertLine(m_pShapeElement->m_oPen));
}
m_oWriter.WriteString(ConvertShadow(m_pShapeElement->m_oShadow));
m_oWriter.WriteString(std::wstring(L"</p:spPr>")); m_oWriter.WriteString(std::wstring(L"</p:spPr>"));
...@@ -862,7 +941,13 @@ CString NSPresentationEditor::CShapeWriter::ConvertImage() ...@@ -862,7 +941,13 @@ CString NSPresentationEditor::CShapeWriter::ConvertImage()
m_oWriter.WriteString(std::wstring(L"</a:xfrm>")); m_oWriter.WriteString(std::wstring(L"</a:xfrm>"));
} }
m_oWriter.WriteString(std::wstring(L"<a:prstGeom prst=\"rect\"><a:avLst/></a:prstGeom>")); m_oWriter.WriteString(std::wstring(L"<a:prstGeom prst=\"rect\"><a:avLst/></a:prstGeom>"));
m_oWriter.WriteString(std::wstring(L"<a:noFill/>"));
m_oWriter.WriteString(ConvertBrush(m_pImageElement->m_oBrush));
if (m_pImageElement->m_bLine)
{
m_oWriter.WriteString(ConvertLine(m_pImageElement->m_oPen));
}
m_oWriter.WriteString(std::wstring(L"</p:spPr>")); m_oWriter.WriteString(std::wstring(L"</p:spPr>"));
......
...@@ -110,10 +110,10 @@ namespace NSPresentationEditor ...@@ -110,10 +110,10 @@ namespace NSPresentationEditor
} }
CString ConvertShape (); CString ConvertShape ();
CString ConvertImage (); CString ConvertImage ();
CString ConvertLine (); CString ConvertLine (CPen & pen);
CString ConvertShadow (); CString ConvertShadow (CShadow & shadow);
CString ConvertBrush (CBrush & brush); CString ConvertBrush (CBrush & brush);
CString ConvertColor (CColor & color, long alpha); CString ConvertColor (CColor & color, long alpha);
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
virtual HRESULT get_Type(LONG* lType) ; virtual HRESULT get_Type(LONG* lType) ;
//-------- -------------------------------------------------- //-------- --------------------------------------------------
......
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