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)
pShape->SetupProperties(pSlide, pTheme, pLayout);
pSlide->m_bIsBackground = true;
pSlide->m_oBackground = pShape->m_oShape.m_oBrush;
pSlide->m_oBackground = pShape->m_oBrush;
}
RELEASEOBJECT(pElem);
continue;
......@@ -812,7 +812,7 @@ void CPPTUserInfo::LoadMainMaster(DWORD dwMasterID, const LONG& lOriginWidth, co
pShape->SetupProperties(NULL, pTheme, pLayout);
pTheme->m_bIsBackground = true;
pTheme->m_oBackground = pShape->m_oShape.m_oBrush;
pTheme->m_oBackground = pShape->m_oBrush;
}
RELEASEINTERFACE(pElem);
......@@ -985,7 +985,7 @@ void CPPTUserInfo::LoadNoMainMaster(DWORD dwMasterID, const LONG& lOriginWidth,
pShape->SetupProperties(NULL, pTheme, pLayout);
pLayout->m_bIsBackground = true;
pLayout->m_oBackground = pShape->m_oShape.m_oBrush;
pLayout->m_oBackground = pShape->m_oBrush;
}
RELEASEINTERFACE(pElem);
continue;
......
......@@ -24,6 +24,9 @@
const double EMU_MM = 36000;
#define FIXED_POINT(val) (double)((short)(val >> 16) + ((short)(val) / 65536.0));
using namespace NSOfficeDrawing;
using namespace NSPresentationEditor;
......@@ -69,11 +72,10 @@ public:
}
return false;
}
CColor CorrectSysColor(int nColorCode, CShapeElement* pElement, CTheme* pTheme)
CColor CorrectSysColor(int nColorCode, IElement* pElement, CTheme* pTheme)
{
if (pElement == NULL) return CColor();
CShape* pShape = &pElement->m_oShape;
CColor color;
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:
switch (nColorIndex)
{
case 0xF0: color = pShape->m_oBrush.Color1; break;
case 0xF0: color = pElement->m_oBrush.Color1; break;
case 0xF1:
{
if (pElement->m_bLine) color = pShape->m_oPen.Color;
else color = pShape->m_oBrush.Color1;
if (pElement->m_bLine) color = pElement->m_oPen.Color;
else color = pElement->m_oBrush.Color1;
}break;
case 0xF2: color = pShape->m_oPen.Color; break;
case 0xF3: color = pShape->m_oShadow.Color; break;
case 0xF2: color = pElement->m_oPen.Color; break;
case 0xF3: color = pElement->m_oShadow.Color; break;
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 0xF7: //FillThenLine
case 0xF8: //colorIndexMask
color = pShape->m_oBrush.Color1; break;
color = pElement->m_oBrush.Color1; break;
default:
//from table
break;
......@@ -111,7 +113,7 @@ public:
}
//if ( nCProp && ( nPropColor & 0x10000000 ) == 0 ) // beware of looping recursive
// color = CorrectSysColor( nPropColor, pShape);
// color = CorrectSysColor( nPropColor, pElement);
if( nAdditionalFlags & 0x80 ) // make color gray
{
......@@ -275,7 +277,6 @@ public:
for (long i = 0; i < lCount; ++i)
{
SetUpPropertyImage((CImageElement*)pElement, pTheme, pWrapper, pSlide, &pProperties->m_arProperties[i]);
//SetUpPropertyShape((CImageElement*)pElement, pTheme, pWrapper, pSlide, &pProperties->m_arProperties[i]);
}
break;
}
......@@ -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)
{
case wzName:
{
pElement->m_sName = NSFile::CUtf8Converter::GetWStringFromUTF16((unsigned short*)pProperty->m_pOptions, pProperty->m_lValue /2 - 1);
return true;
}
}break;
case wzDescription:
{
pElement->m_sDescription = NSFile::CUtf8Converter::GetWStringFromUTF16((unsigned short*)pProperty->m_pOptions, pProperty->m_lValue /2 - 1);
return true;
}
}break;
case hspMaster:
{
pElement->m_lLayoutID = (LONG)pProperty->m_lValue;
return true;
}
}break;
case rotation:
{
short Integral = (short)(pProperty->m_lValue >> 16);
short Fractional= (short)(pProperty->m_lValue);
pElement->m_dRotate = (double)(Integral + (Fractional / 65536.0));
return true;
}
pElement->m_dRotate = FIXED_POINT(pProperty->m_lValue);
}break;
case fFlipH:
{
BYTE flag1 = (BYTE)pProperty->m_lValue;
......@@ -357,9 +353,7 @@ public:
if (bUseFlipV)
pElement->m_bFlipV = bFlipV;
return true;
}
}break;
case fNoLineDrawDash: //Line Style Boolean Properties
{
bool bNoLineDrawDash = GETBIT(pProperty->m_lValue, 0);
......@@ -382,239 +376,47 @@ public:
if (bUsefLine)
pElement->m_bLine = bLine;
return true;
}
}break;
case lineStyle:
case lineDashStyle://from Complex
{
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;
}
}
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:
case fillType:
{
DWORD dwType = pProperty->m_lValue;
switch(dwType)
{
case NSOfficeDrawing::fillPattern:
{
pParentShape->m_oBrush.Type = c_BrushTypePattern;
pElement->m_oBrush.Type = c_BrushTypePattern;
//texture + change black to color2, white to color1
}break;
case NSOfficeDrawing::fillTexture :
case NSOfficeDrawing::fillPicture :
{
pParentShape->m_oBrush.Type = c_BrushTypeTexture;
pParentShape->m_oBrush.TextureMode = (NSOfficeDrawing::fillPicture == dwType) ? c_BrushTextureModeStretch : c_BrushTextureModeTile;
pElement->m_oBrush.Type = c_BrushTypeTexture;
pElement->m_oBrush.TextureMode = (NSOfficeDrawing::fillPicture == dwType) ? c_BrushTextureModeStretch : c_BrushTextureModeTile;
}break;
case NSOfficeDrawing::fillShadeCenter://1 color
case NSOfficeDrawing::fillShadeShape:
{
pParentShape->m_oBrush.Type = c_BrushTypeCenter;
pElement->m_oBrush.Type = c_BrushTypeCenter;
}break;//
case NSOfficeDrawing::fillShadeTitle://2 colors and more
case NSOfficeDrawing::fillShade :
case NSOfficeDrawing::fillShadeScale:
{
pParentShape->m_oBrush.Type = c_BrushTypePathGradient1;
pElement->m_oBrush.Type = c_BrushTypePathGradient1;
}break;
case NSOfficeDrawing::fillBackground:
{
pParentShape->m_oBrush.Type = c_BrushTypeNoFill;
pElement->m_oBrush.Type = c_BrushTypeNoFill;
}break;
}
}break;
case NSOfficeDrawing::fillBlip:
case fillBlip:
{
int dwOffset = 0 ;
......@@ -627,117 +429,117 @@ public:
{
dwOffset = pInfo->GetIndexPicture(pProperty->m_lValue);
}
int nLen = pParentShape->m_oBrush.TexturePath.length() - 1;
int nIndex = pParentShape->m_oBrush.TexturePath.rfind(FILE_SEPARATOR_CHAR);
int nLen = pElement->m_oBrush.TexturePath.length() - 1;
int nIndex = pElement->m_oBrush.TexturePath.rfind(FILE_SEPARATOR_CHAR);
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);
if (pParentShape->m_oBrush.Type == c_BrushTypePattern)
pElement->m_oBrush.TexturePath = pElement->m_oBrush.TexturePath + pInfo->GetFileNamePicture(dwOffset);
if (pElement->m_oBrush.Type == c_BrushTypePattern)
{
int rgbColor1 = 0;
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
{
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))
{
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
{
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))
{
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;
pParentShape->m_oBrush.TextureMode = c_BrushTextureModeTile;
pElement->m_oBrush.Type = c_BrushTypeTexture;
pElement->m_oBrush.TextureMode = c_BrushTextureModeTile;
}
break;
}
case NSOfficeDrawing::fillColor:
case fillColor:
{
SColorAtom oAtom;
oAtom.FromValue(pProperty->m_lValue);
if(oAtom.bSysIndex)
pParentShape->m_oBrush.Color1 = CorrectSysColor(pProperty->m_lValue, pElement, pTheme);
pElement->m_oBrush.Color1 = CorrectSysColor(pProperty->m_lValue, pElement, pTheme);
else
oAtom.ToColor(&pParentShape->m_oBrush.Color1);
oAtom.ToColor(&pElement->m_oBrush.Color1);
if (pParentShape->m_oBrush.Type == c_BrushTypeNoFill )
pParentShape->m_oBrush.Type = c_BrushTypeSolid;
if (pElement->m_oBrush.Type == c_BrushTypeNoFill )
pElement->m_oBrush.Type = c_BrushTypeSolid;
break;
}
case NSOfficeDrawing::fillBackColor:
case fillBackColor:
{
SColorAtom oAtom;
oAtom.FromValue(pProperty->m_lValue);
if(oAtom.bSysIndex)
pParentShape->m_oBrush.Color2 = CorrectSysColor(pProperty->m_lValue, pElement, pTheme);
pElement->m_oBrush.Color2 = CorrectSysColor(pProperty->m_lValue, pElement, pTheme);
else
oAtom.ToColor(&pParentShape->m_oBrush.Color2);
oAtom.ToColor(&pElement->m_oBrush.Color2);
}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;
}
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;
}
case NSOfficeDrawing::fillRectLeft:
case fillRectLeft:
{
pParentShape->m_oBrush.Rect.X = pProperty->m_lValue;
pParentShape->m_oBrush.Rectable = true;
pElement->m_oBrush.Rect.X = pProperty->m_lValue;
pElement->m_oBrush.Rectable = true;
}break;
case NSOfficeDrawing::fillRectRight:
case fillRectRight:
{
pParentShape->m_oBrush.Rect.Width = pProperty->m_lValue - pParentShape->m_oBrush.Rect.X;
pParentShape->m_oBrush.Rectable = true;
pElement->m_oBrush.Rect.Width = pProperty->m_lValue - pElement->m_oBrush.Rect.X;
pElement->m_oBrush.Rectable = true;
}break;
case NSOfficeDrawing::fillRectTop:
case fillRectTop:
{
pParentShape->m_oBrush.Rect.Y = pProperty->m_lValue;
pParentShape->m_oBrush.Rectable = true;
pElement->m_oBrush.Rect.Y = pProperty->m_lValue;
pElement->m_oBrush.Rectable = true;
}break;
case NSOfficeDrawing::fillRectBottom:
case fillRectBottom:
{
pParentShape->m_oBrush.Rect.Height = pProperty->m_lValue - pParentShape->m_oBrush.Rect.Y;
pParentShape->m_oBrush.Rectable = true;
pElement->m_oBrush.Rect.Height = pProperty->m_lValue - pElement->m_oBrush.Rect.Y;
pElement->m_oBrush.Rectable = true;
}break;
case NSOfficeDrawing::fillBackground:
case fillBackground:
{
//bIsFilled = false;
break;
}
case NSOfficeDrawing::fillShadeType:
case fillShadeType:
{
bool bShadeNone = GETBIT(pProperty->m_lValue, 31);
bool bShadeGamma = GETBIT(pProperty->m_lValue, 30);
......@@ -746,16 +548,16 @@ public:
bool bShadeOneColor = GETBIT(pProperty->m_lValue, 27);
}break;
case NSOfficeDrawing::fillAngle:
case fillAngle:
{
}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;
case NSOfficeDrawing::fillShadePreset:
case fillShadePreset:
{//value (int) from 0x00000088 through 0x0000009F or complex
}break;
case NSOfficeDrawing::fillShadeColors:
case fillShadeColors:
{//array of colors
struct _a
{
......@@ -777,7 +579,7 @@ public:
}
}break;
case NSOfficeDrawing::fNoFillHitTest:
case fNoFillHitTest:
{
BYTE flag1 = (BYTE)(pProperty->m_lValue);
BYTE flag2 = (BYTE)(pProperty->m_lValue >> 16);
......@@ -803,118 +605,132 @@ public:
break;
}
// line --------------------------------------------------------
case NSOfficeDrawing::lineColor:
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)
pElement->m_bLine = bLineOk;//?? todooo
if (bUseFillOk)
bIsFilled = bFillOk;
break;
}
// line --------------------------------------------------------
case lineColor:
{
SColorAtom oAtom;
oAtom.FromValue(pProperty->m_lValue);
if (oAtom.bSysIndex)
pParentShape->m_oPen.Color = CorrectSysColor(pProperty->m_lValue, pElement, pTheme);
pElement->m_oPen.Color = CorrectSysColor(pProperty->m_lValue, pElement, pTheme);
else
oAtom.ToColor(&pParentShape->m_oPen.Color);
oAtom.ToColor(&pElement->m_oPen.Color);
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;
}
case NSOfficeDrawing::lineBackColor:
case lineBackColor:
{
SColorAtom oAtom;
oAtom.FromValue(pProperty->m_lValue);
if (oAtom.bSysIndex)
pParentShape->m_oPen.Color2 = CorrectSysColor(pProperty->m_lValue, pElement, pTheme);
pElement->m_oPen.Color2 = CorrectSysColor(pProperty->m_lValue, pElement, pTheme);
else
oAtom.ToColor(&pParentShape->m_oPen.Color2);
oAtom.ToColor(&pElement->m_oPen.Color2);
}break;
case NSOfficeDrawing::lineWidth:
case lineWidth:
{
pParentShape->m_oPen.Size = (double)pProperty->m_lValue / EMU_MM;
pElement->m_bLine = true;
//pElemProps->SetAt(CElementProperty::epPenWidth, pProperty->m_lValue);
pElement->m_oPen.Size = (double)pProperty->m_lValue / EMU_MM;
pElement->m_bLine = true;
break;
}
case NSOfficeDrawing::lineDashing:
case lineDashing:
{
BYTE nDashStyle = 0;
switch (pProperty->m_lValue)
{
case 0:
{
nDashStyle = 0;
break;
} // solid
nDashStyle = 0; // solid
}break;
case 1:
case 6:
case 7:
{
nDashStyle = 1;
break;
} // dash
nDashStyle = 1; // dash
}break;
case 2:
case 5:
{
nDashStyle = 2;
break;
} // dot
nDashStyle = 2; // dot
}break;
case 3:
case 8:
case 9:
{
nDashStyle = 3;
break;
} // dashdot
nDashStyle = 3; // dashdot
}break;
case 4:
case 10:
{
nDashStyle = 4;
break;
} // dashdotdot
nDashStyle = 4;// dashdotdot
}break;
default:
{
break;
}
};
//pElemProps->SetAt(CElementProperty::epLineDash, nDashStyle);
pElement->m_bLine = true;
pParentShape->m_oPen.DashStyle = nDashStyle;
pElement->m_oPen.DashStyle = nDashStyle;
break;
}
case NSOfficeDrawing::lineJoinStyle:
case lineJoinStyle:
{
BYTE nLineJoin = 2;
switch (pProperty->m_lValue)
{
case 0:
{
nLineJoin = 1;
break;
} // bevel
nLineJoin = 1; // bevel
}break;
case 1:
{
nLineJoin = 1;
break;
} // Miter
nLineJoin = 1; // Miter
}break;
case 2:
{
nLineJoin = 2;
break;
} // round
nLineJoin = 2; // round
}break;
default:
{
break;
}
};
pParentShape->m_oPen.LineJoin = nLineJoin;
//pElemProps->SetAt(CElementProperty::epPenJoin, nLineJoin);
pElement->m_oPen.LineJoin = nLineJoin;
break;
}
case NSOfficeDrawing::lineStartArrowhead:
case lineStartArrowhead:
{
BYTE nStartCap = 0;
switch (pProperty->m_lValue)
......@@ -924,27 +740,22 @@ public:
case 5:
{
nStartCap = 0x14;
break;
}
}break;
case 3:
case 4:
{
nStartCap = 2;
break;
}
}break;
default:
{
break;
}
};
pParentShape->m_oPen.LineStartCap = nStartCap;
//pElemProps->SetAt(CElementProperty::epLineStartCap, nStartCap);
pElement->m_oPen.LineStartCap = nStartCap;
break;
}
case NSOfficeDrawing::lineEndArrowhead:
case lineEndArrowhead:
{
BYTE nEndCap = 0;
switch (pProperty->m_lValue)
......@@ -953,56 +764,293 @@ public:
case 2:
case 5:
{
nEndCap = 0x14;
break;
}
nEndCap = 0x14;
}break;
case 3:
case 4:
{
nEndCap = 2;
break;
}
}break;
default:
{
break;
}
break;
};
pParentShape->m_oPen.LineEndCap = nEndCap;
//pElemProps->SetAt(CElementProperty::epLineEndCap, nEndCap);
pElement->m_oPen.LineEndCap = nEndCap;
break;
}
case NSOfficeDrawing::fNoLineDrawDash:
case shadowType:
{
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);
pElement->m_oShadow.Type = pProperty->m_lValue;
}break;
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));
bool bLineFillShape = (0x02 == (0x02 & flag1));
bool bHitTestLine = (0x04 == (0x04 & flag1));
bool bLine = (0x08 == (0x08 & flag1));
bool bArrowheadsOK = (0x10 == (0x10 & flag1));
bool bInsertPenOK = (0x20 == (0x20 & flag1));
bool bInsertPen = (0x40 == (0x40 & flag1));
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:
{
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));
bool bUsebLineFillShape = (0x02 == (0x02 & flag3));
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));
CShape* pParentShape = &pElement->m_oShape;
CPPTShape* pShape = dynamic_cast<CPPTShape*>(pParentShape->m_pShape);
bool bUsebLineOpaqueBackColor = (0x02 == (0x02 & flag4));
CElementProperties* pElemProps = &pElement->m_oProperties;
if (bUsebLine)
bIsDraw = bLine;
if (NULL == pShape)
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;
}
// text --------------------------------------------------------
......@@ -1219,98 +1267,10 @@ public:
break;
}
// 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:
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:
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;
......@@ -2281,7 +2241,7 @@ protected:
case sptTextCanUp:
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_nTextAlignVertical = 1;
......
......@@ -1052,23 +1052,52 @@ namespace NSPresentationEditor
{
public:
bool Visible;
double DistanceX;
double DistanceY;
double BlurSize;
CColor Color;
long Alpha;
bool Visible;
double DistanceX;
double DistanceY;
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:
void SetDefaultParams()
{
Visible = false;
DistanceX = 0.1;
DistanceY = 0.1;
BlurSize = 0;
Color = 0;
Alpha = 255;
Visible = false;
DistanceX = 0.1;
DistanceY = 0.1;
BlurSize = 0;
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:
......@@ -1079,23 +1108,45 @@ namespace NSPresentationEditor
}
CShadow( const CShadow& other )
{
Visible = other.Visible;
DistanceX = other.DistanceX;
DistanceY = other.DistanceY;
BlurSize = other.BlurSize;
Color = other.Color;
Alpha = other.Alpha;
Visible = other.Visible;
DistanceX = other.DistanceX;
DistanceY = other.DistanceY;
OriginX = other.OriginX;
OriginY = other.OriginY;
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)
{
Visible = other.Visible;
DistanceX = other.DistanceX;
DistanceY = other.DistanceY;
BlurSize = other.BlurSize;
Color = other.Color;
Alpha = other.Alpha;
Visible = other.Visible;
DistanceX = other.DistanceX;
DistanceY = other.DistanceY;
OriginX = other.OriginX;
OriginY = other.OriginY;
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;
}
virtual ~CShadow()
......
......@@ -33,6 +33,10 @@ namespace NSPresentationEditor
CAnimationInfo m_oAnimations;
CEffects m_oEffects;
CPen m_oPen;
CBrush m_oBrush;
CShadow m_oShadow;
int m_lID;
int m_lLayoutID;
......@@ -191,6 +195,10 @@ namespace NSPresentationEditor
pDublicate->m_pTheme = m_pTheme;
pDublicate->m_pLayout = m_pLayout;
pDublicate->m_oPen = m_oPen;
pDublicate->m_oBrush = m_oBrush;
pDublicate->m_oShadow = m_oShadow;
}
public:
......
......@@ -603,9 +603,9 @@ namespace NSPresentationEditor
SetupTextProperties(pSlide, pTheme, pLayout);
CalculateColor(m_oShape.m_oPen.Color , pSlide, pTheme, pLayout);
CalculateColor(m_oShape.m_oBrush.Color1 , pSlide, pTheme, pLayout);
CalculateColor(m_oShape.m_oBrush.Color2 , pSlide, pTheme, pLayout);
CalculateColor(m_oPen.Color , pSlide, pTheme, pLayout);
CalculateColor(m_oBrush.Color1 , pSlide, pTheme, pLayout);
CalculateColor(m_oBrush.Color2 , pSlide, pTheme, pLayout);
}
virtual void SetupTextProperties(CSlide* pSlide, CTheme* pTheme, CLayout* pLayout);
......@@ -649,89 +649,89 @@ namespace NSPresentationEditor
}
case CElementProperty::epBrushType:
{
m_oShape.m_oBrush.Type = (LONG)pProperty->m_dwValue;
m_oBrush.Type = (LONG)pProperty->m_dwValue;
break;
}
case CElementProperty::epBrushColor1:
{
m_oShape.m_oBrush.Color1.SetSBGR(pProperty->m_dwValue);
CalculateColor(m_oShape.m_oBrush.Color1, pSlide, pTheme, pLayout);
m_oBrush.Color1.SetSBGR(pProperty->m_dwValue);
CalculateColor(m_oBrush.Color1, pSlide, pTheme, pLayout);
break;
}
case CElementProperty::epBrushColor2:
{
m_oShape.m_oBrush.Color2.SetSBGR(pProperty->m_dwValue);
CalculateColor(m_oShape.m_oBrush.Color2, pSlide, pTheme, pLayout);
m_oBrush.Color2.SetSBGR(pProperty->m_dwValue);
CalculateColor(m_oBrush.Color2, pSlide, pTheme, pLayout);
break;
}
case CElementProperty::epBrushAlpha1:
{
m_oShape.m_oBrush.Alpha1 = (BYTE)pProperty->m_dwValue;
m_oBrush.Alpha1 = (BYTE)pProperty->m_dwValue;
break;
}
case CElementProperty::epBrushAlpha2:
{
m_oShape.m_oBrush.Alpha2 = (BYTE)pProperty->m_dwValue;
m_oBrush.Alpha2 = (BYTE)pProperty->m_dwValue;
break;
}
case CElementProperty::epBrushTxPath:
{
m_oShape.m_oBrush.TexturePath = pProperty->m_strAdvanced;
m_oBrush.TexturePath = pProperty->m_strAdvanced;
break;
}
case CElementProperty::epBrushTxMode:
{
m_oShape.m_oBrush.TextureMode = (LONG)pProperty->m_dwValue;
m_oBrush.TextureMode = (LONG)pProperty->m_dwValue;
break;
}
case CElementProperty::epFilled:
{
if (0 == pProperty->m_dwValue)
{
m_oShape.m_oBrush.Alpha1 = 0;
m_oBrush.Alpha1 = 0;
}
break;
}
case CElementProperty::epPenColor:
{
m_oShape.m_oPen.Color.SetSBGR(pProperty->m_dwValue);
CalculateColor(m_oShape.m_oPen.Color, pSlide, pTheme, pLayout);
m_oPen.Color.SetSBGR(pProperty->m_dwValue);
CalculateColor(m_oPen.Color, pSlide, pTheme, pLayout);
break;
}
case CElementProperty::epPenAlpha:
{
m_oShape.m_oPen.Alpha = (BYTE)pProperty->m_dwValue;
m_oPen.Alpha = (BYTE)pProperty->m_dwValue;
break;
}
case CElementProperty::epPenWidth:
{
m_oShape.m_oPen.Size = (double)pProperty->m_dwValue / 0xFFFF;
m_oPen.Size = (double)pProperty->m_dwValue / 0xFFFF;
break;
}
case CElementProperty::epPenJoin:
{
m_oShape.m_oPen.LineJoin = (BYTE)pProperty->m_dwValue;
m_oPen.LineJoin = (BYTE)pProperty->m_dwValue;
break;
}
case CElementProperty::epLineDash:
{
m_oShape.m_oPen.DashStyle = (BYTE)pProperty->m_dwValue;
m_oPen.DashStyle = (BYTE)pProperty->m_dwValue;
break;
}
case CElementProperty::epLineStartCap:
{
m_oShape.m_oPen.LineStartCap = (BYTE)pProperty->m_dwValue;
m_oPen.LineStartCap = (BYTE)pProperty->m_dwValue;
break;
}
case CElementProperty::epLineEndCap:
{
m_oShape.m_oPen.LineEndCap = (BYTE)pProperty->m_dwValue;
m_oPen.LineEndCap = (BYTE)pProperty->m_dwValue;
break;
}
case CElementProperty::epStroked:
{
if (0 == pProperty->m_dwValue)
m_oShape.m_oPen.Alpha = 0;
m_oPen.Alpha = 0;
break;
}
......
......@@ -615,8 +615,8 @@ namespace NSCustomVML
bool bBreak = false;
LONG lMinF = (LONG)0x80000000;
LONG lMaxF = (LONG)0x8000007F;
long lMinF = (_INT32)0x80000000;
long lMaxF = (_INT32)0x8000007F;
int nGuideIndex_x , nGuideIndex_y;
......@@ -628,13 +628,12 @@ namespace NSCustomVML
{
nGuideIndex_x = nGuideIndex_y = -1;
if (lMinF <= (DWORD)m_arVertices[nIndex].x) nGuideIndex_x = (DWORD)m_arVertices[nIndex].x - 0x80000000;
if (lMinF <= (DWORD)m_arVertices[nIndex].y) nGuideIndex_y = (DWORD)m_arVertices[nIndex].y - 0x80000000;
if (lMaxF > m_arVertices[nIndex].x ) nGuideIndex_x = (DWORD)m_arVertices[nIndex].x - (DWORD)lMinF;
if (lMaxF > m_arVertices[nIndex].y ) nGuideIndex_y = (DWORD)m_arVertices[nIndex].y - (DWORD)lMinF;
CString str = _T("");
if (nGuideIndex_x >= 0 )
{
//str.Format(_T("gd%d,"), nGuideIndex_x);
str.Format(_T("%d,"), m_arGuides[nGuideIndex_x].m_param_value1);
strPath += str;
}
......@@ -645,7 +644,6 @@ namespace NSCustomVML
}
if (nGuideIndex_y >= 0)
{
//str.Format(_T("gd%d,"), nGuideIndex_y);
str.Format(_T("%d,"), m_arGuides[nGuideIndex_y].m_param_value1);
strPath += str;
}
......@@ -711,13 +709,12 @@ namespace NSCustomVML
{
nGuideIndex_x = nGuideIndex_y = -1;
if (lMinF <= (DWORD)m_arVertices[nV].x) nGuideIndex_x = (DWORD)m_arVertices[nV].x - 0x80000000;
if (lMinF <= (DWORD)m_arVertices[nV].y) nGuideIndex_y = (DWORD)m_arVertices[nV].y - 0x80000000;
if (lMaxF > m_arVertices[nV].x ) nGuideIndex_x = (DWORD)m_arVertices[nV].x - (DWORD)lMinF;
if (lMaxF > m_arVertices[nV].y ) nGuideIndex_y = (DWORD)m_arVertices[nV].y - (DWORD)lMinF;
CString str = _T("");
if (nGuideIndex_x >= 0 )
{
//str.Format(_T("gd%d,"), nGuideIndex_x);
str.Format(_T("%d,"), m_arGuides[nGuideIndex_x].m_param_value1);
strPath += str;
}
......@@ -728,7 +725,6 @@ namespace NSCustomVML
}
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);
strPath += str;
}
......
......@@ -34,11 +34,8 @@ public:
long m_lLimoX;
long m_lLimoY;
CPen m_oPen;
CBrush m_oBrush;
CTextAttributesEx m_oText;
CShadow m_oShadow;
double m_dWidthLogic;
double m_dHeightLogic;
......@@ -128,17 +125,17 @@ public:
}
virtual CString GetBrushXml()
{
if (!m_pShape->m_bConcentricFill)
return _T("");
return m_oBrush.ToString();
}
//virtual CString GetBrushXml()
//{
// if (!m_pShape->m_bConcentricFill)
// return _T("");
// return m_oBrush.ToString();
//}
virtual CString GetPenXml()
{
return m_oPen.ToString();
}
//virtual CString GetPenXml()
//{
// return m_oPen.ToString();
//}
virtual void GetTextRect(CGeomShapeInfo& oInfo)
{
......@@ -297,7 +294,9 @@ public:
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)
{
strImageTransform += strDrawing;
......@@ -321,11 +320,13 @@ public:
if (m_lDrawType & c_ShapeDrawType_Graphic)
{
m_oPen.SetToRenderer(pRenderer);
m_oBrush.SetToRenderer(pRenderer);
//m_oPen.SetToRenderer(pRenderer);
//m_oBrush.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:
if(Shape == NULL)
return false;
Shape->m_dStartTime = m_dStartTime;
Shape->m_dEndTime = m_dEndTime;
Shape->m_dStartTime = m_dStartTime;
Shape->m_dEndTime = m_dEndTime;
Shape->m_rcBounds = m_rcBounds;
Shape->m_rcBounds = m_rcBounds;
Shape->m_lLimoX = m_lLimoX;
Shape->m_lLimoY = m_lLimoY;
Shape->m_lLimoX = m_lLimoX;
Shape->m_lLimoY = m_lLimoY;
Shape->m_oPen = m_oPen;
Shape->m_oBrush = m_oBrush;
Shape->m_oText = m_oText;
Shape->m_oShadow = m_oShadow;
Shape->m_oText = m_oText;
Shape->m_dWidthLogic = m_dWidthLogic;
Shape->m_dHeightLogic = m_dHeightLogic;
Shape->m_dWidthLogic = m_dWidthLogic;
Shape->m_dHeightLogic = m_dHeightLogic;
Shape->m_lDrawType = m_lDrawType;
Shape->m_lDrawType = m_lDrawType;
Shape->m_dTextMarginX = m_dTextMarginX;
Shape->m_dTextMarginY = m_dTextMarginY;
......@@ -412,21 +410,21 @@ public:
if (oNodePict.GetNode(_T("stroke"), oNodeTemplate))
{
CString strColor = oNodeTemplate.GetAttributeOrValue(_T("strokecolor"));
if (strColor != _T(""))
m_oPen.Color.FromString(strColor);
CString strSize = oNodeTemplate.GetAttributeOrValue(_T("strokeweight"));
if (strSize != _T(""))
m_oPen.Size = XmlUtils::GetDouble(strSize);
CString strStroke = oNodeTemplate.GetAttributeOrValue(_T("stroked"));
if (strStroke != _T(""))
m_oPen.Alpha = 0;
//if (strColor != _T(""))
// m_oPen.Color.FromString(strColor);
//CString strSize = oNodeTemplate.GetAttributeOrValue(_T("strokeweight"));
//if (strSize != _T(""))
// m_oPen.Size = XmlUtils::GetDouble(strSize);
//CString strStroke = oNodeTemplate.GetAttributeOrValue(_T("stroked"));
//if (strStroke != _T(""))
// m_oPen.Alpha = 0;
}
if (oNodePict.GetNode(_T("v:stroke"), oNodeTemplate))
{
CString strColor = oNodeTemplate.GetAttributeOrValue(_T("dashstyle"));
if (strColor != _T(""))
m_oPen.DashStyle = XmlUtils::GetInteger(strColor);
//if (strColor != _T(""))
// m_oPen.DashStyle = XmlUtils::GetInteger(strColor);
}
}
......@@ -436,8 +434,8 @@ public:
if (oNodePict.GetNode(_T("fillcolor"), oNodeTemplate))
{
CString strColor = oNodeTemplate.GetAttributeOrValue(_T("val"));
if (strColor != _T(""))
m_oBrush.Color1.FromString(strColor);
//if (strColor != _T(""))
// m_oBrush.Color1.FromString(strColor);
}
}
......
......@@ -32,16 +32,12 @@ NSPresentationEditor::CShapeWriter::CShapeWriter()
m_pImageElement = 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;
CPen* pPen = &m_pShapeElement->m_oShape.m_oPen;
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);
if (m_bWordArt)
......@@ -51,7 +47,7 @@ CString NSPresentationEditor::CShapeWriter::ConvertLine()
else
{
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>"));
}
......@@ -114,36 +110,120 @@ CString NSPresentationEditor::CShapeWriter::ConvertBrush(CBrush & brush)
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("");
if (abs(m_pShapeElement->m_oShape.m_oShadow.DistanceY) < 0.001) return _T("");
std::wstring Preset;
bool Inner = false;
double dist = sqrt(m_pShapeElement->m_oShape.m_oShadow.DistanceY * m_pShapeElement->m_oShape.m_oShadow.DistanceY +
m_pShapeElement->m_oShape.m_oShadow.DistanceX * m_pShapeElement->m_oShape.m_oShadow.DistanceX);
if (shadow.Visible == false) return _T("");
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("");
strDir.Format(_T(" dir=\"%d\""), (int)(dir * 60000));
if (shadow.Type == 1) Preset = L"shdw13";
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("");
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;
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\""));
shadow_writer.WriteString(strDir);
shadow_writer.WriteString(strDist);
shadow_writer.WriteString(std::wstring(L">"));
shadow_writer.WriteString(ConvertColor(m_pShapeElement->m_oShape.m_oShadow.Color,m_pShapeElement->m_oShape.m_oShadow.Alpha));
shadow_writer.WriteString(std::wstring(L"</a:outerShdw>"));
shadow_writer.WriteString(std::wstring(L"<a:effectLst>"));
if (!Preset.empty())
{
shadow_writer.WriteString(std::wstring(L"<a:prstShdw"));
shadow_writer.WriteString(std::wstring(L" prst=\"") + Preset + std::wstring(L"\""));
//shadow_writer.WriteString(std::wstring(L" rotWithShape=\"0\" algn=\"ctr\""));
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: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>"));
return shadow_writer.GetData();
}
......@@ -581,7 +661,7 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
if (m_bWordArt)
{
m_oWriter.WriteString(ConvertBrush(m_pShapeElement->m_oShape.m_oBrush));
m_oWriter.WriteString(ConvertBrush(m_pShapeElement->m_oBrush));
}
else
{
......@@ -734,26 +814,22 @@ CString NSPresentationEditor::CShapeWriter::ConvertShape()
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"<a:prstGeom"));
m_oWriter.WriteString(std::wstring(L" prst=\"") + prstGeom + std::wstring(L"\">"));
if (!m_bWordArt)
{
m_oWriter.WriteString(std::wstring(L" prst=\"") + prstGeom + std::wstring(L"\">"));
if (!m_bWordArt)
{
m_oWriter.WriteString(std::wstring(L"<a:avLst/>"));
}
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
{
......@@ -761,10 +837,13 @@ CString NSPresentationEditor::CShapeWriter::ConvertShape()
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());
m_oWriter.WriteString(ConvertShadow());
if (m_pShapeElement->m_bLine)
{
m_oWriter.WriteString(ConvertLine(m_pShapeElement->m_oPen));
}
m_oWriter.WriteString(ConvertShadow(m_pShapeElement->m_oShadow));
m_oWriter.WriteString(std::wstring(L"</p:spPr>"));
......@@ -862,7 +941,13 @@ CString NSPresentationEditor::CShapeWriter::ConvertImage()
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: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>"));
......
......@@ -110,10 +110,10 @@ namespace NSPresentationEditor
}
CString ConvertShape ();
CString ConvertImage ();
CString ConvertLine ();
CString ConvertShadow ();
CString ConvertBrush (CBrush & brush);
CString ConvertColor (CColor & color, long alpha);
CString ConvertLine (CPen & pen);
CString ConvertShadow (CShadow & shadow);
CString ConvertBrush (CBrush & brush);
CString ConvertColor (CColor & color, long alpha);
// -----------------------------------------------------------------------------
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