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;
......
...@@ -24,6 +24,9 @@ ...@@ -24,6 +24,9 @@
const double EMU_MM = 36000; const double EMU_MM = 36000;
#define FIXED_POINT(val) (double)((short)(val >> 16) + ((short)(val) / 65536.0));
using namespace NSOfficeDrawing; using namespace NSOfficeDrawing;
using namespace NSPresentationEditor; using namespace NSPresentationEditor;
...@@ -69,11 +72,10 @@ public: ...@@ -69,11 +72,10 @@ public:
} }
return false; return false;
} }
CColor CorrectSysColor(int nColorCode, CShapeElement* pElement, CTheme* pTheme) CColor CorrectSysColor(int nColorCode, IElement* pElement, CTheme* pTheme)
{ {
if (pElement == NULL) return CColor(); if (pElement == NULL) return CColor();
CShape* pShape = &pElement->m_oShape;
CColor color; CColor color;
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
...@@ -84,20 +86,20 @@ public: ...@@ -84,20 +86,20 @@ public:
switch (nColorIndex) switch (nColorIndex)
{ {
case 0xF0: color = pShape->m_oBrush.Color1; break; case 0xF0: color = pElement->m_oBrush.Color1; break;
case 0xF1: case 0xF1:
{ {
if (pElement->m_bLine) color = pShape->m_oPen.Color; if (pElement->m_bLine) color = pElement->m_oPen.Color;
else color = pShape->m_oBrush.Color1; else color = pElement->m_oBrush.Color1;
}break; }break;
case 0xF2: color = pShape->m_oPen.Color; break; case 0xF2: color = pElement->m_oPen.Color; break;
case 0xF3: color = pShape->m_oShadow.Color; break; case 0xF3: color = pElement->m_oShadow.Color; break;
case 0xF4: break; ///this case 0xF4: break; ///this
case 0xF5: color = pShape->m_oBrush.Color2; break; case 0xF5: color = pElement->m_oBrush.Color2; break;
case 0xF6: break; //lineBackColor case 0xF6: break; //lineBackColor
case 0xF7: //FillThenLine case 0xF7: //FillThenLine
case 0xF8: //colorIndexMask case 0xF8: //colorIndexMask
color = pShape->m_oBrush.Color1; break; color = pElement->m_oBrush.Color1; break;
default: default:
//from table //from table
break; break;
...@@ -111,7 +113,7 @@ public: ...@@ -111,7 +113,7 @@ public:
} }
//if ( nCProp && ( nPropColor & 0x10000000 ) == 0 ) // beware of looping recursive //if ( nCProp && ( nPropColor & 0x10000000 ) == 0 ) // beware of looping recursive
// color = CorrectSysColor( nPropColor, pShape); // color = CorrectSysColor( nPropColor, pElement);
if( nAdditionalFlags & 0x80 ) // make color gray if( nAdditionalFlags & 0x80 ) // make color gray
{ {
...@@ -275,7 +277,6 @@ public: ...@@ -275,7 +277,6 @@ public:
for (long i = 0; i < lCount; ++i) for (long i = 0; i < lCount; ++i)
{ {
SetUpPropertyImage((CImageElement*)pElement, pTheme, pWrapper, pSlide, &pProperties->m_arProperties[i]); SetUpPropertyImage((CImageElement*)pElement, pTheme, pWrapper, pSlide, &pProperties->m_arProperties[i]);
//SetUpPropertyShape((CImageElement*)pElement, pTheme, pWrapper, pSlide, &pProperties->m_arProperties[i]);
} }
break; break;
} }
...@@ -314,33 +315,28 @@ public: ...@@ -314,33 +315,28 @@ public:
} }
} }
inline bool SetUpProperty(IElement* pElement, CTheme* pTheme, CSlideInfo* pInfo, CSlide* pSlide, CProperty* pProperty) inline void SetUpProperty(IElement* pElement, CTheme* pTheme, CSlideInfo* pInfo, CSlide* pSlide, CProperty* pProperty)
{ {
bool bIsFilled = true;
switch (pProperty->m_ePID) switch (pProperty->m_ePID)
{ {
case wzName: case wzName:
{ {
pElement->m_sName = NSFile::CUtf8Converter::GetWStringFromUTF16((unsigned short*)pProperty->m_pOptions, pProperty->m_lValue /2 - 1); pElement->m_sName = NSFile::CUtf8Converter::GetWStringFromUTF16((unsigned short*)pProperty->m_pOptions, pProperty->m_lValue /2 - 1);
return true; }break;
}
case wzDescription: case wzDescription:
{ {
pElement->m_sDescription = NSFile::CUtf8Converter::GetWStringFromUTF16((unsigned short*)pProperty->m_pOptions, pProperty->m_lValue /2 - 1); pElement->m_sDescription = NSFile::CUtf8Converter::GetWStringFromUTF16((unsigned short*)pProperty->m_pOptions, pProperty->m_lValue /2 - 1);
return true; }break;
}
case hspMaster: case hspMaster:
{ {
pElement->m_lLayoutID = (LONG)pProperty->m_lValue; pElement->m_lLayoutID = (LONG)pProperty->m_lValue;
return true; }break;
}
case rotation: case rotation:
{ {
short Integral = (short)(pProperty->m_lValue >> 16); pElement->m_dRotate = FIXED_POINT(pProperty->m_lValue);
short Fractional= (short)(pProperty->m_lValue); }break;
pElement->m_dRotate = (double)(Integral + (Fractional / 65536.0));
return true;
}
case fFlipH: case fFlipH:
{ {
BYTE flag1 = (BYTE)pProperty->m_lValue; BYTE flag1 = (BYTE)pProperty->m_lValue;
...@@ -357,9 +353,7 @@ public: ...@@ -357,9 +353,7 @@ public:
if (bUseFlipV) if (bUseFlipV)
pElement->m_bFlipV = bFlipV; pElement->m_bFlipV = bFlipV;
}break;
return true;
}
case fNoLineDrawDash: //Line Style Boolean Properties case fNoLineDrawDash: //Line Style Boolean Properties
{ {
bool bNoLineDrawDash = GETBIT(pProperty->m_lValue, 0); bool bNoLineDrawDash = GETBIT(pProperty->m_lValue, 0);
...@@ -382,239 +376,47 @@ public: ...@@ -382,239 +376,47 @@ public:
if (bUsefLine) if (bUsefLine)
pElement->m_bLine = bLine; pElement->m_bLine = bLine;
}break;
return true;
}
case lineStyle: case lineStyle:
case lineDashStyle://from Complex case lineDashStyle://from Complex
{ {
pElement->m_bLine = true; pElement->m_bLine = true;
return true;
}
default:
break;
}
return false;
}
inline void SetUpPropertyVideo(CVideoElement* pElement, CTheme* pTheme, CSlideInfo* pInfo, CSlide* pSlide, CProperty* pProperty)
{
SetUpPropertyImage((CImageElement*)pElement, pTheme, pInfo, pSlide, pProperty);
}
inline void SetUpPropertyAudio(CAudioElement* pElement, CTheme* pTheme, CSlideInfo* pInfo, CSlide* pSlide, CProperty* pProperty)
{
SetUpProperty((IElement*)pElement, pTheme, pInfo, pSlide, pProperty);
}
inline void SetUpPropertyImage(CImageElement* pElement, CTheme* pTheme, CSlideInfo* pInfo, CSlide* pSlide, CProperty* pProperty)
{
SetUpProperty((IElement*)pElement, pTheme, pInfo, pSlide, pProperty);
switch(pProperty->m_ePID)
{
case Pib:
{
int dwOffset = pInfo->GetIndexPicture(pProperty->m_lValue);
if (dwOffset >=0)
{
pElement->m_strImageFileName += pInfo->GetFileNamePicture(dwOffset);
pElement->m_bImagePresent = true;
}
}break;
case pictureId://OLE identifier of the picture.
{
pElement->m_bOLE = true;
}break;
case pibName:
{
pElement->m_sName = NSFile::CUtf8Converter::GetWStringFromUTF16((unsigned short*)pProperty->m_pOptions, pProperty->m_lValue /2-1);
}break;
case cropFromTop:
{
pElement->m_lcropFromTop = pProperty->m_lValue;
pElement->m_bCropEnabled = true;
}break;
case cropFromBottom:
{
pElement->m_lcropFromBottom = pProperty->m_lValue;
pElement->m_bCropEnabled = true;
}break;
case cropFromLeft:
{
pElement->m_lcropFromLeft = pProperty->m_lValue;
pElement->m_bCropEnabled = true;
}break;
case cropFromRight:
{
pElement->m_lcropFromRight = pProperty->m_lValue;
pElement->m_bCropEnabled = true;
}break;
case pibFlags:
{
}break; }break;
} case fillType:
}
inline void SetUpPropertyShape(CShapeElement* pElement, CTheme* pTheme, CSlideInfo* pInfo, CSlide* pSlide, CProperty* pProperty)
{
if (SetUpProperty((IElement*)pElement, pTheme, pInfo, pSlide, pProperty))
return;
CShape* pParentShape = &pElement->m_oShape;
CPPTShape* pShape = dynamic_cast<CPPTShape*>(pParentShape->m_pShape);
CElementProperties* pElemProps = &pElement->m_oProperties;
if (NULL == pShape)
return;
bool bIsFilled = true;
bool bIsDraw = true;
switch (pProperty->m_ePID)
{
// ...
// geometry ----------------------------------------------------
// top, left, right, bottom logic
case NSOfficeDrawing::geoRight:
{
if (0 < pProperty->m_lValue)
pParentShape->m_dWidthLogic = (double)(pProperty->m_lValue);
break;
}
case NSOfficeDrawing::geoBottom:
{
if (0 < pProperty->m_lValue)
pParentShape->m_dHeightLogic = (double)(pProperty->m_lValue);
break;
}
// shapePath
case NSOfficeDrawing::shapePath:
{
pShape->m_oCustomVML.SetPath((RulesType)pProperty->m_lValue);
break;
}
// segmentsInfo
case NSOfficeDrawing::pSegmentInfo:
{
if (pProperty->m_bComplex)
{
pShape->m_oCustomVML.LoadSegments(pProperty);
}
break;
}
// verticesInfo
case NSOfficeDrawing::pVertices:
{
if (pProperty->m_bComplex)
{
pShape->m_oCustomVML.LoadVertices(pProperty);
}
break;
}
case NSOfficeDrawing::pGuides:
{
if (pProperty->m_bComplex)
{
pShape->m_oCustomVML.LoadGuides(pProperty);
}
break;
}
case NSOfficeDrawing::pAdjustHandles:
{
if (pProperty->m_bComplex)
{
pShape->m_oCustomVML.LoadAHs(pProperty);
}
break;
}
case NSOfficeDrawing::dxTextLeft:
{
pParentShape->m_dTextMarginX = (double)pProperty->m_lValue / EMU_MM;
//pElemProps->SetAt(CElementProperty::epTextMarginLeft, pProperty->m_lValue);
break;
}
case NSOfficeDrawing::dxTextRight:
{
pParentShape->m_dTextMarginRight = (double)pProperty->m_lValue / EMU_MM;
//pElemProps->SetAt(CElementProperty::epTextMarginRight, pProperty->m_lValue);
break;
}
case NSOfficeDrawing::dyTextTop:
{
pParentShape->m_dTextMarginY = (double)pProperty->m_lValue / EMU_MM;
//pElemProps->SetAt(CElementProperty::epTextMarginTop, pProperty->m_lValue);
break;
}
case NSOfficeDrawing::dyTextBottom:
{
pParentShape->m_dTextMarginBottom = (double)pProperty->m_lValue / EMU_MM;
//pElemProps->SetAt(CElementProperty::epTextMarginBottom, pProperty->m_lValue);
break;
}
case NSOfficeDrawing::WrapText:
{
pParentShape->m_oText.m_lWrapMode = (LONG)pProperty->m_lValue;
//pElemProps->SetAt(CElementProperty::epTextWrap, pProperty->m_lValue);
break;
}
case NSOfficeDrawing::adjustValue:
case NSOfficeDrawing::adjust2Value:
case NSOfficeDrawing::adjust3Value:
case NSOfficeDrawing::adjust4Value:
case NSOfficeDrawing::adjust5Value:
case NSOfficeDrawing::adjust6Value:
case NSOfficeDrawing::adjust7Value:
case NSOfficeDrawing::adjust8Value:
case NSOfficeDrawing::adjust9Value:
case NSOfficeDrawing::adjust10Value:
{
LONG lIndexAdj = pProperty->m_ePID - NSOfficeDrawing::adjustValue;
if (lIndexAdj >= 0 && lIndexAdj < pShape->m_arAdjustments.size())
{
//SetAdjustment(lIndexAdj, (LONG)pProperty->m_lValue);
pShape->m_oCustomVML.LoadAdjusts(lIndexAdj, (LONG)pProperty->m_lValue);
}
else
{
pShape->m_oCustomVML.LoadAdjusts(lIndexAdj, (LONG)pProperty->m_lValue);
}
break;
}
case NSOfficeDrawing::fillType:
{ {
DWORD dwType = pProperty->m_lValue; DWORD dwType = pProperty->m_lValue;
switch(dwType) switch(dwType)
{ {
case NSOfficeDrawing::fillPattern: case NSOfficeDrawing::fillPattern:
{ {
pParentShape->m_oBrush.Type = c_BrushTypePattern; pElement->m_oBrush.Type = c_BrushTypePattern;
//texture + change black to color2, white to color1 //texture + change black to color2, white to color1
}break; }break;
case NSOfficeDrawing::fillTexture : case NSOfficeDrawing::fillTexture :
case NSOfficeDrawing::fillPicture : case NSOfficeDrawing::fillPicture :
{ {
pParentShape->m_oBrush.Type = c_BrushTypeTexture; pElement->m_oBrush.Type = c_BrushTypeTexture;
pParentShape->m_oBrush.TextureMode = (NSOfficeDrawing::fillPicture == dwType) ? c_BrushTextureModeStretch : c_BrushTextureModeTile; pElement->m_oBrush.TextureMode = (NSOfficeDrawing::fillPicture == dwType) ? c_BrushTextureModeStretch : c_BrushTextureModeTile;
}break; }break;
case NSOfficeDrawing::fillShadeCenter://1 color case NSOfficeDrawing::fillShadeCenter://1 color
case NSOfficeDrawing::fillShadeShape: case NSOfficeDrawing::fillShadeShape:
{ {
pParentShape->m_oBrush.Type = c_BrushTypeCenter; pElement->m_oBrush.Type = c_BrushTypeCenter;
}break;// }break;//
case NSOfficeDrawing::fillShadeTitle://2 colors and more case NSOfficeDrawing::fillShadeTitle://2 colors and more
case NSOfficeDrawing::fillShade : case NSOfficeDrawing::fillShade :
case NSOfficeDrawing::fillShadeScale: case NSOfficeDrawing::fillShadeScale:
{ {
pParentShape->m_oBrush.Type = c_BrushTypePathGradient1; pElement->m_oBrush.Type = c_BrushTypePathGradient1;
}break; }break;
case NSOfficeDrawing::fillBackground: case NSOfficeDrawing::fillBackground:
{ {
pParentShape->m_oBrush.Type = c_BrushTypeNoFill; pElement->m_oBrush.Type = c_BrushTypeNoFill;
}break; }break;
} }
}break; }break;
case NSOfficeDrawing::fillBlip: case fillBlip:
{ {
int dwOffset = 0 ; int dwOffset = 0 ;
...@@ -627,117 +429,117 @@ public: ...@@ -627,117 +429,117 @@ public:
{ {
dwOffset = pInfo->GetIndexPicture(pProperty->m_lValue); dwOffset = pInfo->GetIndexPicture(pProperty->m_lValue);
} }
int nLen = pParentShape->m_oBrush.TexturePath.length() - 1; int nLen = pElement->m_oBrush.TexturePath.length() - 1;
int nIndex = pParentShape->m_oBrush.TexturePath.rfind(FILE_SEPARATOR_CHAR); int nIndex = pElement->m_oBrush.TexturePath.rfind(FILE_SEPARATOR_CHAR);
if (nLen != nIndex) if (nLen != nIndex)
{ {
pParentShape->m_oBrush.TexturePath.erase(nIndex + 1, nLen - nIndex); pElement->m_oBrush.TexturePath.erase(nIndex + 1, nLen - nIndex);
} }
pParentShape->m_oBrush.TexturePath = pParentShape->m_oBrush.TexturePath + pInfo->GetFileNamePicture(dwOffset); pElement->m_oBrush.TexturePath = pElement->m_oBrush.TexturePath + pInfo->GetFileNamePicture(dwOffset);
if (pParentShape->m_oBrush.Type == c_BrushTypePattern) if (pElement->m_oBrush.Type == c_BrushTypePattern)
{ {
int rgbColor1 = 0; int rgbColor1 = 0;
int rgbColor2 = 0xFFFFFF; int rgbColor2 = 0xFFFFFF;
if (pParentShape->m_oBrush.Color1.m_lSchemeIndex == -1) if (pElement->m_oBrush.Color1.m_lSchemeIndex == -1)
{ {
rgbColor1 = pParentShape->m_oBrush.Color1.GetLONG_RGB(); rgbColor1 = pElement->m_oBrush.Color1.GetLONG_RGB();
} }
else else
{ {
if ((pSlide) && (pSlide->m_arColorScheme.size() > 0)) if ((pSlide) && (pSlide->m_arColorScheme.size() > 0))
{ {
rgbColor1 = pSlide->m_arColorScheme[pParentShape->m_oBrush.Color1.m_lSchemeIndex].GetLONG_RGB(); rgbColor1 = pSlide->m_arColorScheme[pElement->m_oBrush.Color1.m_lSchemeIndex].GetLONG_RGB();
} }
else if ((pTheme) && (pTheme->m_arColorScheme.size() > 0)) else if ((pTheme) && (pTheme->m_arColorScheme.size() > 0))
{ {
rgbColor1 = pTheme->m_arColorScheme[pParentShape->m_oBrush.Color1.m_lSchemeIndex].GetLONG_RGB(); rgbColor1 = pTheme->m_arColorScheme[pElement->m_oBrush.Color1.m_lSchemeIndex].GetLONG_RGB();
} }
} }
if (pParentShape->m_oBrush.Color2.m_lSchemeIndex == -1) if (pElement->m_oBrush.Color2.m_lSchemeIndex == -1)
{ {
rgbColor2 = pParentShape->m_oBrush.Color2.GetLONG_RGB(); rgbColor2 = pElement->m_oBrush.Color2.GetLONG_RGB();
} }
else else
{ {
if ((pSlide) && (pSlide->m_arColorScheme.size() > 0)) if ((pSlide) && (pSlide->m_arColorScheme.size() > 0))
{ {
rgbColor2 = pSlide->m_arColorScheme[pParentShape->m_oBrush.Color2.m_lSchemeIndex].GetLONG_RGB(); rgbColor2 = pSlide->m_arColorScheme[pElement->m_oBrush.Color2.m_lSchemeIndex].GetLONG_RGB();
} }
else if ((pTheme) && (pTheme->m_arColorScheme.size() > 0)) else if ((pTheme) && (pTheme->m_arColorScheme.size() > 0))
{ {
rgbColor2 = pTheme->m_arColorScheme[pParentShape->m_oBrush.Color2.m_lSchemeIndex].GetLONG_RGB(); rgbColor2 = pTheme->m_arColorScheme[pElement->m_oBrush.Color2.m_lSchemeIndex].GetLONG_RGB();
} }
} }
ChangeBlack2ColorImage(pParentShape->m_oBrush.TexturePath, rgbColor1, rgbColor2); ChangeBlack2ColorImage(pElement->m_oBrush.TexturePath, rgbColor1, rgbColor2);
pParentShape->m_oBrush.Type = c_BrushTypeTexture; pElement->m_oBrush.Type = c_BrushTypeTexture;
pParentShape->m_oBrush.TextureMode = c_BrushTextureModeTile; pElement->m_oBrush.TextureMode = c_BrushTextureModeTile;
} }
break; break;
} }
case NSOfficeDrawing::fillColor: case fillColor:
{ {
SColorAtom oAtom; SColorAtom oAtom;
oAtom.FromValue(pProperty->m_lValue); oAtom.FromValue(pProperty->m_lValue);
if(oAtom.bSysIndex) if(oAtom.bSysIndex)
pParentShape->m_oBrush.Color1 = CorrectSysColor(pProperty->m_lValue, pElement, pTheme); pElement->m_oBrush.Color1 = CorrectSysColor(pProperty->m_lValue, pElement, pTheme);
else else
oAtom.ToColor(&pParentShape->m_oBrush.Color1); oAtom.ToColor(&pElement->m_oBrush.Color1);
if (pParentShape->m_oBrush.Type == c_BrushTypeNoFill ) if (pElement->m_oBrush.Type == c_BrushTypeNoFill )
pParentShape->m_oBrush.Type = c_BrushTypeSolid; pElement->m_oBrush.Type = c_BrushTypeSolid;
break; break;
} }
case NSOfficeDrawing::fillBackColor: case fillBackColor:
{ {
SColorAtom oAtom; SColorAtom oAtom;
oAtom.FromValue(pProperty->m_lValue); oAtom.FromValue(pProperty->m_lValue);
if(oAtom.bSysIndex) if(oAtom.bSysIndex)
pParentShape->m_oBrush.Color2 = CorrectSysColor(pProperty->m_lValue, pElement, pTheme); pElement->m_oBrush.Color2 = CorrectSysColor(pProperty->m_lValue, pElement, pTheme);
else else
oAtom.ToColor(&pParentShape->m_oBrush.Color2); oAtom.ToColor(&pElement->m_oBrush.Color2);
}break; }break;
case NSOfficeDrawing::fillOpacity: case fillOpacity:
{ {
pParentShape->m_oBrush.Alpha1 = (BYTE)(std::min)(255, (int)CDirectory::NormFixedPoint(pProperty->m_lValue, 255)); pElement->m_oBrush.Alpha1 = (BYTE)(std::min)(255, (int)CDirectory::NormFixedPoint(pProperty->m_lValue, 255));
break; break;
} }
case NSOfficeDrawing::fillBackOpacity: case fillBackOpacity:
{ {
pParentShape->m_oBrush.Alpha2 = (BYTE)(std::min)(255, (int)CDirectory::NormFixedPoint(pProperty->m_lValue, 255)); pElement->m_oBrush.Alpha2 = (BYTE)(std::min)(255, (int)CDirectory::NormFixedPoint(pProperty->m_lValue, 255));
break; break;
} }
case NSOfficeDrawing::fillRectLeft: case fillRectLeft:
{ {
pParentShape->m_oBrush.Rect.X = pProperty->m_lValue; pElement->m_oBrush.Rect.X = pProperty->m_lValue;
pParentShape->m_oBrush.Rectable = true; pElement->m_oBrush.Rectable = true;
}break; }break;
case NSOfficeDrawing::fillRectRight: case fillRectRight:
{ {
pParentShape->m_oBrush.Rect.Width = pProperty->m_lValue - pParentShape->m_oBrush.Rect.X; pElement->m_oBrush.Rect.Width = pProperty->m_lValue - pElement->m_oBrush.Rect.X;
pParentShape->m_oBrush.Rectable = true; pElement->m_oBrush.Rectable = true;
}break; }break;
case NSOfficeDrawing::fillRectTop: case fillRectTop:
{ {
pParentShape->m_oBrush.Rect.Y = pProperty->m_lValue; pElement->m_oBrush.Rect.Y = pProperty->m_lValue;
pParentShape->m_oBrush.Rectable = true; pElement->m_oBrush.Rectable = true;
}break; }break;
case NSOfficeDrawing::fillRectBottom: case fillRectBottom:
{ {
pParentShape->m_oBrush.Rect.Height = pProperty->m_lValue - pParentShape->m_oBrush.Rect.Y; pElement->m_oBrush.Rect.Height = pProperty->m_lValue - pElement->m_oBrush.Rect.Y;
pParentShape->m_oBrush.Rectable = true; pElement->m_oBrush.Rectable = true;
}break; }break;
case NSOfficeDrawing::fillBackground: case fillBackground:
{ {
//bIsFilled = false; //bIsFilled = false;
break; break;
} }
case NSOfficeDrawing::fillShadeType: case fillShadeType:
{ {
bool bShadeNone = GETBIT(pProperty->m_lValue, 31); bool bShadeNone = GETBIT(pProperty->m_lValue, 31);
bool bShadeGamma = GETBIT(pProperty->m_lValue, 30); bool bShadeGamma = GETBIT(pProperty->m_lValue, 30);
...@@ -746,16 +548,16 @@ public: ...@@ -746,16 +548,16 @@ public:
bool bShadeOneColor = GETBIT(pProperty->m_lValue, 27); bool bShadeOneColor = GETBIT(pProperty->m_lValue, 27);
}break; }break;
case NSOfficeDrawing::fillAngle: case fillAngle:
{ {
}break; }break;
case NSOfficeDrawing::fillFocus://relative position of the last color in the shaded fill case fillFocus://relative position of the last color in the shaded fill
{ {
}break; }break;
case NSOfficeDrawing::fillShadePreset: case fillShadePreset:
{//value (int) from 0x00000088 through 0x0000009F or complex {//value (int) from 0x00000088 through 0x0000009F or complex
}break; }break;
case NSOfficeDrawing::fillShadeColors: case fillShadeColors:
{//array of colors {//array of colors
struct _a struct _a
{ {
...@@ -777,7 +579,7 @@ public: ...@@ -777,7 +579,7 @@ public:
} }
}break; }break;
case NSOfficeDrawing::fNoFillHitTest: case fNoFillHitTest:
{ {
BYTE flag1 = (BYTE)(pProperty->m_lValue); BYTE flag1 = (BYTE)(pProperty->m_lValue);
BYTE flag2 = (BYTE)(pProperty->m_lValue >> 16); BYTE flag2 = (BYTE)(pProperty->m_lValue >> 16);
...@@ -803,118 +605,132 @@ public: ...@@ -803,118 +605,132 @@ public:
break; break;
} }
// line -------------------------------------------------------- case NSOfficeDrawing::fFillOK:
case NSOfficeDrawing::lineColor: {
BYTE flag1 = (BYTE)(pProperty->m_lValue);
BYTE flag2 = (BYTE)(pProperty->m_lValue >> 8);
BYTE flag3 = (BYTE)(pProperty->m_lValue >> 16);
BYTE flag4 = (BYTE)(pProperty->m_lValue >> 24);
bool bFillOk = (0x01 == (0x01 & flag1));
bool bFillShadeShapeOk = (0x02 == (0x02 & flag1));
bool bGTextOk = (0x04 == (0x04 & flag1));
bool bLineOk = (0x08 == (0x08 & flag1));
bool b3DOk = (0x10 == (0x10 & flag1));
bool bShadowOk = (0x20 == (0x20 & flag1));
bool bUseFillOk = (0x01 == (0x01 & flag3));
bool bUseFillShadeShapeOk = (0x02 == (0x02 & flag3));
bool bUseGTextOk = (0x04 == (0x04 & flag3));
bool bUseLineOk = (0x08 == (0x08 & flag3));
bool bUse3DOk = (0x10 == (0x10 & flag3));
bool bUseShadowOk = (0x20 == (0x20 & flag3));
if (bUseLineOk)
pElement->m_bLine = bLineOk;//?? todooo
if (bUseFillOk)
bIsFilled = bFillOk;
break;
}
// line --------------------------------------------------------
case lineColor:
{ {
SColorAtom oAtom; SColorAtom oAtom;
oAtom.FromValue(pProperty->m_lValue); oAtom.FromValue(pProperty->m_lValue);
if (oAtom.bSysIndex) if (oAtom.bSysIndex)
pParentShape->m_oPen.Color = CorrectSysColor(pProperty->m_lValue, pElement, pTheme); pElement->m_oPen.Color = CorrectSysColor(pProperty->m_lValue, pElement, pTheme);
else else
oAtom.ToColor(&pParentShape->m_oPen.Color); oAtom.ToColor(&pElement->m_oPen.Color);
break; break;
} }
case NSOfficeDrawing::lineOpacity: case lineOpacity:
{ {
pParentShape->m_oPen.Alpha = (BYTE)(std::min)(255, (int)CDirectory::NormFixedPoint(pProperty->m_lValue, 255)); pElement->m_oPen.Alpha = (BYTE)(std::min)(255, (int)CDirectory::NormFixedPoint(pProperty->m_lValue, 255));
break; break;
} }
case NSOfficeDrawing::lineBackColor: case lineBackColor:
{ {
SColorAtom oAtom; SColorAtom oAtom;
oAtom.FromValue(pProperty->m_lValue); oAtom.FromValue(pProperty->m_lValue);
if (oAtom.bSysIndex) if (oAtom.bSysIndex)
pParentShape->m_oPen.Color2 = CorrectSysColor(pProperty->m_lValue, pElement, pTheme); pElement->m_oPen.Color2 = CorrectSysColor(pProperty->m_lValue, pElement, pTheme);
else else
oAtom.ToColor(&pParentShape->m_oPen.Color2); oAtom.ToColor(&pElement->m_oPen.Color2);
}break; }break;
case NSOfficeDrawing::lineWidth: case lineWidth:
{ {
pParentShape->m_oPen.Size = (double)pProperty->m_lValue / EMU_MM; pElement->m_oPen.Size = (double)pProperty->m_lValue / EMU_MM;
pElement->m_bLine = true; pElement->m_bLine = true;
//pElemProps->SetAt(CElementProperty::epPenWidth, pProperty->m_lValue);
break; break;
} }
case NSOfficeDrawing::lineDashing: case lineDashing:
{ {
BYTE nDashStyle = 0; BYTE nDashStyle = 0;
switch (pProperty->m_lValue) switch (pProperty->m_lValue)
{ {
case 0: case 0:
{ {
nDashStyle = 0; nDashStyle = 0; // solid
break; }break;
} // solid
case 1: case 1:
case 6: case 6:
case 7: case 7:
{ {
nDashStyle = 1; nDashStyle = 1; // dash
break; }break;
} // dash
case 2: case 2:
case 5: case 5:
{ {
nDashStyle = 2; nDashStyle = 2; // dot
break; }break;
} // dot
case 3: case 3:
case 8: case 8:
case 9: case 9:
{ {
nDashStyle = 3; nDashStyle = 3; // dashdot
break; }break;
} // dashdot
case 4: case 4:
case 10: case 10:
{ {
nDashStyle = 4; nDashStyle = 4;// dashdotdot
break; }break;
} // dashdotdot
default: default:
{
break; break;
}
}; };
//pElemProps->SetAt(CElementProperty::epLineDash, nDashStyle);
pElement->m_bLine = true; pElement->m_bLine = true;
pParentShape->m_oPen.DashStyle = nDashStyle; pElement->m_oPen.DashStyle = nDashStyle;
break; break;
} }
case NSOfficeDrawing::lineJoinStyle: case lineJoinStyle:
{ {
BYTE nLineJoin = 2; BYTE nLineJoin = 2;
switch (pProperty->m_lValue) switch (pProperty->m_lValue)
{ {
case 0: case 0:
{ {
nLineJoin = 1; nLineJoin = 1; // bevel
break; }break;
} // bevel
case 1: case 1:
{ {
nLineJoin = 1; nLineJoin = 1; // Miter
break; }break;
} // Miter
case 2: case 2:
{ {
nLineJoin = 2; nLineJoin = 2; // round
break; }break;
} // round
default: default:
{
break; break;
}
}; };
pParentShape->m_oPen.LineJoin = nLineJoin; pElement->m_oPen.LineJoin = nLineJoin;
//pElemProps->SetAt(CElementProperty::epPenJoin, nLineJoin);
break; break;
} }
case NSOfficeDrawing::lineStartArrowhead: case lineStartArrowhead:
{ {
BYTE nStartCap = 0; BYTE nStartCap = 0;
switch (pProperty->m_lValue) switch (pProperty->m_lValue)
...@@ -924,27 +740,22 @@ public: ...@@ -924,27 +740,22 @@ public:
case 5: case 5:
{ {
nStartCap = 0x14; nStartCap = 0x14;
break; }break;
}
case 3: case 3:
case 4: case 4:
{ {
nStartCap = 2; nStartCap = 2;
break; }break;
}
default: default:
{
break; break;
}
}; };
pParentShape->m_oPen.LineStartCap = nStartCap; pElement->m_oPen.LineStartCap = nStartCap;
//pElemProps->SetAt(CElementProperty::epLineStartCap, nStartCap);
break; break;
} }
case NSOfficeDrawing::lineEndArrowhead: case lineEndArrowhead:
{ {
BYTE nEndCap = 0; BYTE nEndCap = 0;
switch (pProperty->m_lValue) switch (pProperty->m_lValue)
...@@ -953,56 +764,293 @@ public: ...@@ -953,56 +764,293 @@ public:
case 2: case 2:
case 5: case 5:
{ {
nEndCap = 0x14; nEndCap = 0x14;
break; }break;
}
case 3: case 3:
case 4: case 4:
{ {
nEndCap = 2; nEndCap = 2;
break; }break;
}
default: default:
{ break;
break;
}
}; };
pParentShape->m_oPen.LineEndCap = nEndCap; pElement->m_oPen.LineEndCap = nEndCap;
//pElemProps->SetAt(CElementProperty::epLineEndCap, nEndCap);
break; break;
} }
case NSOfficeDrawing::fNoLineDrawDash: case shadowType:
{ {
BYTE flag1 = (BYTE)(pProperty->m_lValue); pElement->m_oShadow.Type = pProperty->m_lValue;
BYTE flag2 = (BYTE)(pProperty->m_lValue >> 8);
BYTE flag3 = (BYTE)(pProperty->m_lValue >> 16); }break;
BYTE flag4 = (BYTE)(pProperty->m_lValue >> 24); case shadowOriginX://in emu, relative from center shape
{
pElement->m_oShadow.OriginX = FIXED_POINT(pProperty->m_lValue);
}break;
case shadowOriginY:
{
pElement->m_oShadow.OriginY = FIXED_POINT(pProperty->m_lValue);
}break;
case shadowColor:
{
SColorAtom oAtom;
oAtom.FromValue(pProperty->m_lValue);
if (oAtom.bSysIndex)
pElement->m_oShadow.Color = CorrectSysColor(pProperty->m_lValue, pElement, pTheme);
else
oAtom.ToColor(&pElement->m_oShadow.Color);
}break;
case shadowWeight:
{
}break;
case shadowOpacity:
{
pElement->m_oShadow.Alpha = (BYTE)(std::min)(255, (int)CDirectory::NormFixedPoint(pProperty->m_lValue, 255));
}break;
case shadowHighlight:
{
//
}break;
case shadowOffsetX:
{
pElement->m_oShadow.DistanceX = ((int)pProperty->m_lValue) / EMU_MM;
}break;
case shadowOffsetY:
{
pElement->m_oShadow.DistanceY = ((int)pProperty->m_lValue) / EMU_MM;
}break;
case shadowScaleXToX:
{
pElement->m_oShadow.ScaleXToX = FIXED_POINT(pProperty->m_lValue);
}break;
case shadowScaleYToX:
{
pElement->m_oShadow.ScaleYToX = FIXED_POINT(pProperty->m_lValue);
}break;
case shadowScaleXToY:
{
pElement->m_oShadow.ScaleXToY = FIXED_POINT(pProperty->m_lValue);
}break;
case shadowScaleYToY:
{
pElement->m_oShadow.ScaleYToY = FIXED_POINT(pProperty->m_lValue);
}break;
case shadowPerspectiveX:
{
pElement->m_oShadow.PerspectiveX = ((int)pProperty->m_lValue);// / EMU_MM;//FIXED_POINT(pProperty->m_lValue);
}break;
case shadowPerspectiveY:
{
pElement->m_oShadow.PerspectiveY = ((int)pProperty->m_lValue) ;// EMU_MM;//FIXED_POINT(pProperty->m_lValue);
}break;
case fshadowObscured:
{
bool fshadowObscured = GETBIT(pProperty->m_lValue, 0);
bool fShadow = GETBIT(pProperty->m_lValue, 1);
bool fUsefshadowObscured = GETBIT(pProperty->m_lValue, 16);
bool fUsefShadow = GETBIT(pProperty->m_lValue, 17);
if (fUsefShadow)
pElement->m_oShadow.Visible = fShadow;
if (!fUsefShadow && fUsefshadowObscured)
{
//
pElement->m_oShadow.Visible = fshadowObscured;
}
}break;
default:
break;
}
if (!bIsFilled)
{
pElement->m_oBrush.Type = c_BrushTypeNoFill;
}
}
inline void SetUpPropertyVideo(CVideoElement* pElement, CTheme* pTheme, CSlideInfo* pInfo, CSlide* pSlide, CProperty* pProperty)
{
SetUpPropertyImage((CImageElement*)pElement, pTheme, pInfo, pSlide, pProperty);
}
inline void SetUpPropertyAudio(CAudioElement* pElement, CTheme* pTheme, CSlideInfo* pInfo, CSlide* pSlide, CProperty* pProperty)
{
SetUpProperty((IElement*)pElement, pTheme, pInfo, pSlide, pProperty);
}
inline void SetUpPropertyImage(CImageElement* pElement, CTheme* pTheme, CSlideInfo* pInfo, CSlide* pSlide, CProperty* pProperty)
{
SetUpProperty((IElement*)pElement, pTheme, pInfo, pSlide, pProperty);
bool bNoLineDrawDash = (0x01 == (0x01 & flag1)); switch(pProperty->m_ePID)
bool bLineFillShape = (0x02 == (0x02 & flag1)); {
bool bHitTestLine = (0x04 == (0x04 & flag1)); case Pib:
bool bLine = (0x08 == (0x08 & flag1)); {
bool bArrowheadsOK = (0x10 == (0x10 & flag1)); int dwOffset = pInfo->GetIndexPicture(pProperty->m_lValue);
bool bInsertPenOK = (0x20 == (0x20 & flag1)); if (dwOffset >=0)
bool bInsertPen = (0x40 == (0x40 & flag1)); {
pElement->m_strImageFileName += pInfo->GetFileNamePicture(dwOffset);
pElement->m_bImagePresent = true;
}
}break;
case pictureId://OLE identifier of the picture.
{
pElement->m_bOLE = true;
}break;
case pibName:
{
std::wstring image_name = NSFile::CUtf8Converter::GetWStringFromUTF16((unsigned short*)pProperty->m_pOptions, pProperty->m_lValue /2-1);
bool bLineOpaqueBackColor = (0x02 == (0x02 & flag2)); // TextMining05.ppt, 20 - ( - todooo
//pElement->m_sName = image_name;
}break;
case cropFromTop:
{
pElement->m_lcropFromTop = pProperty->m_lValue;
pElement->m_bCropEnabled = true;
}break;
case cropFromBottom:
{
pElement->m_lcropFromBottom = pProperty->m_lValue;
pElement->m_bCropEnabled = true;
}break;
case cropFromLeft:
{
pElement->m_lcropFromLeft = pProperty->m_lValue;
pElement->m_bCropEnabled = true;
}break;
case cropFromRight:
{
pElement->m_lcropFromRight = pProperty->m_lValue;
pElement->m_bCropEnabled = true;
}break;
case pibFlags:
{
}break;
}
}
inline void SetUpPropertyShape(CShapeElement* pElement, CTheme* pTheme, CSlideInfo* pInfo, CSlide* pSlide, CProperty* pProperty)
{
SetUpProperty((IElement*)pElement, pTheme, pInfo, pSlide, pProperty);
bool bUsebNoLineDrawDash = (0x01 == (0x01 & flag3)); CShape* pParentShape = &pElement->m_oShape;
bool bUsebLineFillShape = (0x02 == (0x02 & flag3)); CPPTShape* pShape = dynamic_cast<CPPTShape*>(pParentShape->m_pShape);
bool bUsebHitTestLine = (0x04 == (0x04 & flag3));
bool bUsebLine = (0x08 == (0x08 & flag3));
bool bUsebArrowheadsOK = (0x10 == (0x10 & flag3));
bool bUsebInsertPenOK = (0x20 == (0x20 & flag3));
bool bUsebInsertPen = (0x40 == (0x40 & flag3));
bool bUsebLineOpaqueBackColor = (0x02 == (0x02 & flag4)); CElementProperties* pElemProps = &pElement->m_oProperties;
if (bUsebLine) if (NULL == pShape)
bIsDraw = bLine; return;
switch (pProperty->m_ePID)
{
// ...
// geometry ----------------------------------------------------
// top, left, right, bottom logic
case NSOfficeDrawing::geoRight:
{
if (0 < pProperty->m_lValue)
pParentShape->m_dWidthLogic = (double)(pProperty->m_lValue);
break;
}
case NSOfficeDrawing::geoBottom:
{
if (0 < pProperty->m_lValue)
pParentShape->m_dHeightLogic = (double)(pProperty->m_lValue);
break;
}
// shapePath
case NSOfficeDrawing::shapePath:
{
pShape->m_oCustomVML.SetPath((RulesType)pProperty->m_lValue);
break;
}
// segmentsInfo
case NSOfficeDrawing::pSegmentInfo:
{
if (pProperty->m_bComplex)
{
pShape->m_oCustomVML.LoadSegments(pProperty);
}
break;
}
// verticesInfo
case NSOfficeDrawing::pVertices:
{
if (pProperty->m_bComplex)
{
pShape->m_oCustomVML.LoadVertices(pProperty);
}
break;
}
case NSOfficeDrawing::pGuides:
{
if (pProperty->m_bComplex)
{
pShape->m_oCustomVML.LoadGuides(pProperty);
}
break;
}
case NSOfficeDrawing::pAdjustHandles:
{
if (pProperty->m_bComplex)
{
pShape->m_oCustomVML.LoadAHs(pProperty);
}
break;
}
case NSOfficeDrawing::dxTextLeft:
{
pParentShape->m_dTextMarginX = (double)pProperty->m_lValue / EMU_MM;
//pElemProps->SetAt(CElementProperty::epTextMarginLeft, pProperty->m_lValue);
break;
}
case NSOfficeDrawing::dxTextRight:
{
pParentShape->m_dTextMarginRight = (double)pProperty->m_lValue / EMU_MM;
//pElemProps->SetAt(CElementProperty::epTextMarginRight, pProperty->m_lValue);
break;
}
case NSOfficeDrawing::dyTextTop:
{
pParentShape->m_dTextMarginY = (double)pProperty->m_lValue / EMU_MM;
//pElemProps->SetAt(CElementProperty::epTextMarginTop, pProperty->m_lValue);
break;
}
case NSOfficeDrawing::dyTextBottom:
{
pParentShape->m_dTextMarginBottom = (double)pProperty->m_lValue / EMU_MM;
//pElemProps->SetAt(CElementProperty::epTextMarginBottom, pProperty->m_lValue);
break;
}
case NSOfficeDrawing::WrapText:
{
pParentShape->m_oText.m_lWrapMode = (LONG)pProperty->m_lValue;
//pElemProps->SetAt(CElementProperty::epTextWrap, pProperty->m_lValue);
break;
}
case NSOfficeDrawing::adjustValue:
case NSOfficeDrawing::adjust2Value:
case NSOfficeDrawing::adjust3Value:
case NSOfficeDrawing::adjust4Value:
case NSOfficeDrawing::adjust5Value:
case NSOfficeDrawing::adjust6Value:
case NSOfficeDrawing::adjust7Value:
case NSOfficeDrawing::adjust8Value:
case NSOfficeDrawing::adjust9Value:
case NSOfficeDrawing::adjust10Value:
{
LONG lIndexAdj = pProperty->m_ePID - NSOfficeDrawing::adjustValue;
if (lIndexAdj >= 0 && lIndexAdj < pShape->m_arAdjustments.size())
{
//SetAdjustment(lIndexAdj, (LONG)pProperty->m_lValue);
pShape->m_oCustomVML.LoadAdjusts(lIndexAdj, (LONG)pProperty->m_lValue);
}
else
{
pShape->m_oCustomVML.LoadAdjusts(lIndexAdj, (LONG)pProperty->m_lValue);
}
break; break;
} }
// text -------------------------------------------------------- // text --------------------------------------------------------
...@@ -1219,98 +1267,10 @@ public: ...@@ -1219,98 +1267,10 @@ public:
break; break;
} }
// geometry shape // geometry shape
case NSOfficeDrawing::fFillOK:
{
BYTE flag1 = (BYTE)(pProperty->m_lValue);
BYTE flag2 = (BYTE)(pProperty->m_lValue >> 8);
BYTE flag3 = (BYTE)(pProperty->m_lValue >> 16);
BYTE flag4 = (BYTE)(pProperty->m_lValue >> 24);
bool bFillOk = (0x01 == (0x01 & flag1));
bool bFillShadeShapeOk = (0x02 == (0x02 & flag1));
bool bGTextOk = (0x04 == (0x04 & flag1));
bool bLineOk = (0x08 == (0x08 & flag1));
bool b3DOk = (0x10 == (0x10 & flag1));
bool bShadowOk = (0x20 == (0x20 & flag1));
bool bUseFillOk = (0x01 == (0x01 & flag3));
bool bUseFillShadeShapeOk = (0x02 == (0x02 & flag3));
bool bUseGTextOk = (0x04 == (0x04 & flag3));
bool bUseLineOk = (0x08 == (0x08 & flag3));
bool bUse3DOk = (0x10 == (0x10 & flag3));
bool bUseShadowOk = (0x20 == (0x20 & flag3));
if (bUseLineOk)
bIsDraw = bLineOk;
if (bUseFillOk)
bIsFilled = bFillOk;
break;
}
case NSOfficeDrawing::shadowType:
{
//pParentShape->m_oShadow.Visible = true;
}break;
case NSOfficeDrawing::shadowColor:
{
//pParentShape->m_oShadow.Visible = true;
SColorAtom oAtom;
oAtom.FromValue(pProperty->m_lValue);
if (oAtom.bSysIndex)
pParentShape->m_oShadow.Color = CorrectSysColor(pProperty->m_lValue, pElement, pTheme);
else
oAtom.ToColor(&pParentShape->m_oShadow.Color);
pParentShape->m_oShadow.Visible = true;
}break;
case NSOfficeDrawing::shadowOpacity:
{
pParentShape->m_oShadow.Alpha = (BYTE)(std::min)(255, (int)CDirectory::NormFixedPoint(pProperty->m_lValue, 255));
}break;
case NSOfficeDrawing::shadowHighlight:
{
//
}break;
case shadowOffsetX:
{
pParentShape->m_oShadow.DistanceX = ((int)pProperty->m_lValue) / EMU_MM;
}break;
case shadowOffsetY:
{
pParentShape->m_oShadow.DistanceY = ((int)pProperty->m_lValue) / EMU_MM;
}break;
case fshadowObscured:
{
bool fshadowObscured = GETBIT(pProperty->m_lValue, 0);
bool fShadow = GETBIT(pProperty->m_lValue, 1);
bool fUsefshadowObscured = GETBIT(pProperty->m_lValue, 16);
bool fUsefShadow = GETBIT(pProperty->m_lValue, 17);
if (fUsefShadow)
pParentShape->m_oShadow.Visible = fShadow;
if (fUsefShadow && fUsefshadowObscured)
pParentShape->m_oShadow.Visible = fshadowObscured;
}break;
default: default:
break; break;
} }
if (!bIsDraw)
{
pParentShape->m_oPen.Alpha = 0;
//pElemProps->SetAt(CElementProperty::epStroked, (DWORD)0);
}
if (!bIsFilled)
{
pParentShape->m_oBrush.Type = c_BrushTypeNoFill;//(int)c_BrushTypeSolid;
/*pParentShape->m_oBrush.Alpha1 = 0;
pParentShape->m_oBrush.Alpha2 = 0;*/
//pElemProps->SetAt(CElementProperty::epFilled, (DWORD)0);
}
} }
}; };
...@@ -1522,7 +1482,7 @@ public: ...@@ -1522,7 +1482,7 @@ public:
if (NULL != pTextureInfo) if (NULL != pTextureInfo)
{ {
pShape->m_oShape.m_oBrush.TexturePath = pTextureInfo->m_strFilePath + FILE_SEPARATOR_STR; pShape->m_oBrush.TexturePath = pTextureInfo->m_strFilePath + FILE_SEPARATOR_STR;
} }
pElem = (IElement*)pShape; pElem = (IElement*)pShape;
...@@ -2281,7 +2241,7 @@ protected: ...@@ -2281,7 +2241,7 @@ protected:
case sptTextCanUp: case sptTextCanUp:
case sptTextCanDown: case sptTextCanDown:
{ {
pShape->m_oShape.m_oText.m_oAttributes.m_oTextBrush = pShape->m_oShape.m_oBrush; pShape->m_oShape.m_oText.m_oAttributes.m_oTextBrush = pShape->m_oBrush;
pShape->m_oShape.m_oText.m_oAttributes.m_nTextAlignHorizontal = 1; pShape->m_oShape.m_oText.m_oAttributes.m_nTextAlignHorizontal = 1;
pShape->m_oShape.m_oText.m_oAttributes.m_nTextAlignVertical = 1; pShape->m_oShape.m_oText.m_oAttributes.m_nTextAlignVertical = 1;
......
...@@ -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