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

Конвертация ppt -> pptx . Убрана промежуточная конвертация в xml, + crop...

Конвертация ppt -> pptx . Убрана промежуточная конвертация в xml, + crop image, + text anchor, .... Также частично заменен CString на std. Bug 30205.

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@64814 954022d7-b5bf-4e40-9824-e11837661b57
parent 1349fbf8
......@@ -72,30 +72,14 @@ HRESULT COfficePPTFile::LoadFromFile(std::wstring sSrcFileName, std::wstring sDs
if (0 < ((CPPTFileReader*)m_pReader)->m_oDocumentInfo.m_arUsers.size())
{
m_strEditorXml = ((CPPTFileReader*)m_pReader)->m_oDocumentInfo.m_arUsers[0]->ToXmlEditor2();
}
//////////////////////////////////////
if (m_strEditorXml.GetLength() <1) return S_FALSE;
if (sDstPath.length() > 0)
{
NSPresentationEditor::CDocument oPresentationEditor;
NSPresentationEditor::CPPTXWriter oPPTXWriter;
oPresentationEditor.LoadFromXML(m_strEditorXml);
oPPTXWriter.m_strTempDirectory = std_string2string(sDstPath);
oPPTXWriter.CreateFile(&oPresentationEditor);
oPPTXWriter.CreateFile(((CPPTFileReader*)m_pReader)->m_oDocumentInfo.m_arUsers[0]);
oPPTXWriter.CloseFile();
}
//CloseFile(); нельзя тута- поскольку в Win32 используется PresentationEditor для конвертации xml -> pptx
}
return S_OK;
}
......@@ -107,6 +91,11 @@ HRESULT COfficePPTFile::GetAdditionalParam (CString sParamName, VARIANT* ParamVa
if (_T("EditorXml") == sParamName)
{
#if defined(_WIN32) || defined (_WIN64)
if (m_strEditorXml.IsEmpty())
{
m_strEditorXml = ((CPPTFileReader*)m_pReader)->m_oDocumentInfo.m_arUsers[0]->ToXmlEditor2();
}
ParamValue->bstrVal = m_strEditorXml.AllocSysString();
#else
ParamValue->bstrVal = m_strEditorXml;
......
......@@ -137,20 +137,22 @@ public:
void CorrectColorScheme(std::vector<CColor>& oScheme)
{
if (oScheme.size() < 1) return;
std::vector<CColor> oArrayMem;
oArrayMem.push_back(oScheme[0]);//0
oArrayMem.push_back(oScheme[1]);//1
oArrayMem.push_back(oScheme[2]);//2
oArrayMem.push_back(oScheme[3]);//3
oArrayMem.push_back(oScheme[0]);//4
oArrayMem.push_back(oScheme[5]);//5 //accent1
oArrayMem.push_back(oScheme[6]);//6 //accent2
oArrayMem.push_back(oScheme[7]);//7 //accent3
oArrayMem.push_back(oScheme[4]);//5 //accent1
oArrayMem.push_back(oScheme[5]);//6 //accent2
oArrayMem.push_back(oScheme[0]);//7 //accent3
oArrayMem.push_back(oScheme[5]);//8 //accent4
oArrayMem.push_back(oScheme[6]);//9 //accent5
oArrayMem.push_back(oScheme[4]);//9 //accent5
oArrayMem.push_back(oScheme[7]);//10 //accent6
oArrayMem.push_back(oScheme[5]);//11 //hlink
oArrayMem.push_back(oScheme[6]);//12 //folHlink
oArrayMem.push_back(oScheme[6]);//11 //hlink
oArrayMem.push_back(oScheme[7]);//12 //folHlink
oArrayMem.push_back(oScheme[0]);//13 //lt1
oArrayMem.push_back(oScheme[1]);//14 //dk1
oArrayMem.push_back(oScheme[2]);//15 //lt2
......@@ -279,6 +281,6 @@ public:
return _T("obj");
}
void AddAnimation (DWORD dwSlideID, double Width, double Height, IElement* pElement);
void AddAudioTransition (DWORD dwSlideID, CTransition* pTransition, const CString& strFilePath);
void AddAnimation (DWORD dwSlideID, double Width, double Height, IElement* pElement);
void AddAudioTransition (DWORD dwSlideID, CTransition* pTransition, const std::wstring& strFilePath);
};
......@@ -599,7 +599,19 @@ public:
}
if (bulletChar_)
m_oRun.bulletChar = (WCHAR)StreamUtils::ReadWORD(pStream);
{
if (sizeof(wchar_t) == 2)
{
m_oRun.bulletChar = (WCHAR)StreamUtils::ReadWORD(pStream);
}
else
{
unsigned short utf16 = (unsigned short)StreamUtils::ReadWORD(pStream);
std::wstring utf32 = NSFile::CUtf8Converter::GetWStringFromUTF16(&utf16, 1);
if (!utf32.empty())
m_oRun.bulletChar = utf32.c_str()[0];
}
}
if (bulletFontRef_)
m_oRun.bulletFontRef = StreamUtils::ReadWORD(pStream);
if (bulletSize_)
......@@ -788,11 +800,14 @@ public:
oColor.A = 255;
oColor.m_lSchemeIndex = -1;
if (oColorAtom.Index < 10)
if (oColorAtom.Index < 10/* && oColorAtom.bSchemeIndex*/)
{
oColor.m_lSchemeIndex = oColorAtom.Index;
NSPresentationEditor::CorrectColorPPT(oColor.m_lSchemeIndex);
}
else
{
}
m_oRun.Color = oColor;
}
......
......@@ -98,9 +98,9 @@ public:
size_t nCount = m_parEmptyPictures->size();
if (lIndex > nCount)
return 0;
return lIndex;
for (size_t nIndex = 0; nIndex < lIndex; ++nIndex)
for (size_t nIndex = 0; nIndex < min(lIndex, nCount); ++nIndex)
{
if ((*m_parEmptyPictures)[nIndex])
++lResult;
......
......@@ -4,7 +4,7 @@
class CRecordCString : public CUnknownRecord
{
public:
CStringW m_strText;
std::wstring m_strText;
public:
......@@ -32,7 +32,7 @@ public:
oWriter.WriteAttribute(_T("instance"), CDirectory::ToString(m_oHeader.RecInstance));
oWriter.WriteNodeEnd(strName, TRUE, FALSE);
CDirectory::WriteValueToNode(_T("String"), (CString)m_strText, &oWriter);
CDirectory::WriteValueToNode(_T("String"), std_string2string(m_strText), &oWriter);
oWriter.WriteNodeEnd(strName);
......
......@@ -28,47 +28,64 @@ public:
{
switch (lType)
{
case 0x01:
case 0x0D:
case 0x11:
return 15; // title
case 0x02:
case 0x0E:
case 0x06:
case 0x12:
case 0x0C:
return 0; // body
case 0x03:
case 0x0F:
return 15; // centerTitle
case 0x04:
case 0x10:
return 0; // subtitle
case 0x13:
case 0x19:
return 9; // object
case 0x05:
case 0x14:
case 0x0B:
return 11; // slideImg
case 0x15:
return 14; // table
case 0x16:
return 2; // clipArt
case 0x17:
return 1; // chart
case 0x18:
return 8; // media
case 0x1A:
return 10; // picture
case 0x07:
return 5; // date
case 0x08:
return 12; // sldNum
case 0x09:
return 6; // footer
case 0x0A:
return 7; // header
case 0x00: //PT_None
break;
case 0x01: //PT_MasterTitle
case 0x0D: //PT_Title
case 0x11: //PT_VerticalTitle
return 15; // title
case 0x02: //PT_MasterBody
case 0x0E: //PT_Body
case 0x06: //PT_MasterNotesBody
case 0x12: //PT_VerticalBody
case 0x0C: //PT_NotesBody
return 0; // body
case 0x03: //PT_MasterCenterTitle
case 0x0F: //PT_CenterTitle
return 3; // ctrTitle
case 0x04: //PT_MasterSubTitle
case 0x10: //PT_SubTitle
return 13; // subtitle
case 0x13: //PT_Object
case 0x19: //PT_VerticalObject
return 9; // object
case 0x05: //PT_MasterNotesSlideImage
case 0x14: //PT_Graph //????
case 0x0B: //PT_NotesSlideImage
return 11; // slideImg
case 0x15: //PT_Table
return 14; // table
case 0x16: //PT_ClipArt
return 2; // clipArt
case 0x17: //PT_OrgChart
return 1; // chart
case 0x18: //PT_Media
return 8; // media
case 0x1A: //PT_Picture
return 10; // picture
case 0x07: //PT_MasterDate
return 5; // date
case 0x08: //PT_MasterSlideNumber
return 12; // sldNum
case 0x09: //PT_MasterFooter
return 6; // footer
case 0x0A: //PT_MasterHeader
return 7; // header
default:
break;
}
......@@ -136,6 +153,16 @@ public:
{
switch (pProperty->m_ePID)
{
case wzName:
{
pElement->m_sName = NSFile::CUtf8Converter::GetWStringFromUTF16((unsigned short*)pProperty->m_pOptions, pProperty->m_lValue /2 - 1);
return true;
}
case wzDescription:
{
pElement->m_sDescription = NSFile::CUtf8Converter::GetWStringFromUTF16((unsigned short*)pProperty->m_pOptions, pProperty->m_lValue /2 - 1);
return true;
}
case hspMaster:
{
pElement->m_lLayoutID = (LONG)pProperty->m_lValue;
......@@ -181,15 +208,44 @@ public:
}
inline void SetUpPropertyImage(CImageElement* pElement, CTheme* pTheme, CSlideInfo* pInfo, CSlide* pSlide, CProperty* pProperty)
{
if (SetUpProperty((IElement*)pElement, pTheme, pInfo, pSlide, pProperty))
return;
SetUpProperty((IElement*)pElement, pTheme, pInfo, pSlide, pProperty);
if (Pib == pProperty->m_ePID)
switch(pProperty->m_ePID)
{
DWORD dwIndex = pInfo->GetIndexPicture(pProperty->m_lValue);
case Pib:
{
DWORD dwIndex = pInfo->GetIndexPicture(pProperty->m_lValue);
CString strVal = CDirectory::ToString(dwIndex);
pElement->m_strFileName = pElement->m_strFileName + strVal + L".jpg";
CString strVal = CDirectory::ToString(dwIndex);
pElement->m_strFileName = pElement->m_strFileName + strVal.GetBuffer() + L".jpg";
}break;
case pibName:
{
pElement->m_sName = NSFile::CUtf8Converter::GetWStringFromUTF16((unsigned short*)pProperty->m_pOptions, pProperty->m_lValue /2);
}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)
......@@ -279,8 +335,8 @@ public:
}
case NSOfficeDrawing::dyTextTop:
{
//pParentShape->m_dTextMarginY = (double)pProperty->m_lValue / EMU_MM;
pElemProps->SetAt(CElementProperty::epTextMarginTop, pProperty->m_lValue);
pParentShape->m_dTextMarginY = (double)pProperty->m_lValue / EMU_MM;
//pElemProps->SetAt(CElementProperty::epTextMarginTop, pProperty->m_lValue);
break;
}
case NSOfficeDrawing::dyTextBottom:
......@@ -358,15 +414,15 @@ public:
CString strVal = CDirectory::ToString(dwIndex);
int nIndex = pParentShape->m_oBrush.TexturePath.ReverseFind(FILE_SEPARATOR_CHAR);
int nLen = pParentShape->m_oBrush.TexturePath.GetLength() - 1;
int nIndex = pParentShape->m_oBrush.TexturePath.rfind(FILE_SEPARATOR_CHAR);
int nLen = pParentShape->m_oBrush.TexturePath.length() - 1;
if (nLen != nIndex)
{
pParentShape->m_oBrush.TexturePath.Delete(nIndex + 1, nLen - nIndex);
pParentShape->m_oBrush.TexturePath.erase(nIndex + 1, nLen - nIndex);
}
//pElemProps->SetAt(CElementProperty::epBrushTxPath, pParentShape->m_oBrush.TexturePath + strVal + L".jpg");
pParentShape->m_oBrush.TexturePath = pParentShape->m_oBrush.TexturePath + strVal + L".jpg";
pParentShape->m_oBrush.TexturePath = pParentShape->m_oBrush.TexturePath + strVal.GetBuffer() + L".jpg";
break;
}
case NSOfficeDrawing::fillColor:
......@@ -621,7 +677,7 @@ public:
{
if (pProperty->m_bComplex && 0 < pProperty->m_lValue)
{
CStringW str = CDirectory::BYTEArrayToStringW(pProperty->m_pOptions, pProperty->m_lValue);
std::wstring str = NSFile::CUtf8Converter::GetWStringFromUTF16((unsigned short*)pProperty->m_pOptions, pProperty->m_lValue/2);
//pParentShape->m_oText.m_sText = str;
}
break;
......@@ -631,8 +687,8 @@ public:
{
if (pProperty->m_bComplex && 0 < pProperty->m_lValue)
{
CStringW str = CDirectory::BYTEArrayToStringW(pProperty->m_pOptions, pProperty->m_lValue);
pParentShape->m_oText.m_oAttributes.m_oFont.Name = (CString)str;
std::wstring str = NSFile::CUtf8Converter::GetWStringFromUTF16((unsigned short*)pProperty->m_pOptions, pProperty->m_lValue/2);
pParentShape->m_oText.m_oAttributes.m_oFont.Name = std_string2string(str);
//pElemProps->SetAt(CElementProperty::epFontName, (CString)str);
}
break;
......@@ -994,7 +1050,7 @@ public:
CExFilesInfo oInfo;
CString strPathPicture = _T("");
std::wstring strPathPicture = _T("");
// ( )
CExFilesInfo::ExFilesType exType = CExFilesInfo::eftNone;
......
......@@ -53,13 +53,13 @@ public:
, &pStrUtf32_Conv, &pStrUtf32 [lLen]
, strictConversion))
{
m_strFaceName = CString((wchar_t*)pStrUtf32, lLen);
m_strFaceName = CString((wchar_t*)pStrUtf32/*, lLen*/);
}
delete [] pStrUtf32;
}
else
{
m_strFaceName = CString((wchar_t*)utf16FaceName, lReadByte/2);
m_strFaceName = CString((wchar_t*)utf16FaceName/*, lReadByte/2*/); // по факту .. нули нам не нужны
}
m_lfCharSet = StreamUtils::ReadBYTE(pStream);
......
......@@ -28,10 +28,9 @@ public:
CString strName = GetRecordName((DWORD)m_oHeader.RecType);
oWriter.WriteNodeBegin(strName, TRUE);
oWriter.WriteAttribute(_T("length"), CDirectory::ToString(m_oHeader.RecLen));
oWriter.WriteAttribute(_T("type"), CDirectory::ToString(m_oHeader.RecType));
oWriter.WriteAttribute(_T("instance"), CDirectory::ToString(m_oHeader.RecInstance));
oWriter.WriteAttribute(_T("length"), CDirectory::ToString(m_oHeader.RecLen));
oWriter.WriteAttribute(_T("type"), CDirectory::ToString(m_oHeader.RecType));
oWriter.WriteAttribute(_T("instance"), CDirectory::ToString(m_oHeader.RecInstance));
oWriter.WriteNodeEnd(strName, TRUE, FALSE);
CDirectory::WriteValueToNode(_T("ID"), m_dwID, &oWriter);
......@@ -40,4 +39,4 @@ public:
return oWriter.GetXmlString();
}
};
\ No newline at end of file
};
......@@ -36,8 +36,9 @@ public:
m_nNotesIDRef = (UINT)StreamUtils::ReadDWORD(pStream);
USHORT nFlag = StreamUtils::ReadWORD(pStream);
m_bMasterObjects = ((nFlag & 0x01) == 0x01);
m_bMasterScheme = ((nFlag & 0x02) == 0x02);
m_bMasterObjects = ((nFlag & 0x01) == 0x01);
m_bMasterScheme = ((nFlag & 0x02) == 0x02);
m_bMasterBackground = ((nFlag & 0x04) == 0x04);
StreamUtils::StreamSkip(2, pStream);
......
......@@ -40,15 +40,15 @@ public:
RELEASEARRAYOBJECTS(m_pData);
}
void SaveToFile(CString strFile)
void SaveToFile(std::wstring strFile)
{
if ((NULL == m_pData) || (0 >= m_lSize))
return;
CFile oFile;
oFile.CreateFile(strFile);
NSFile::CFileBinary oFile;
oFile.CreateFileW(strFile);
oFile.WriteFile((void*)m_pData, (DWORD)m_lSize);
oFile.WriteFile((BYTE*)m_pData, (DWORD)m_lSize);
oFile.CloseFile();
ReleaseData();
......
......@@ -59,7 +59,7 @@
PreprocessorDefinitions="_DEBUG;_LIB;_USE_MATH_DEFINES;PPTX_DEF;PPT_DEF;ENABLE_PPT_TO_PPTX_CONVERT;PPT_FORMAT;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;_PRESENTATION_WRITER_;_SVG_CONVERT_TO_IMAGE_"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
......@@ -215,8 +215,8 @@
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories="&quot;../../../../DesktopEditor/freetype-2.5.2/include&quot;"
PreprocessorDefinitions="NDEBUG;_LIB;_USE_MATH_DEFINES;PPTX_DEF;PPT_DEF;ENABLE_PPT_TO_PPTX_CONVERT;PPT_FORMAT;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;BUILD_CONFIG_FULL_VERSION;_PRESENTATION_WRITER_;_SVG_CONVERT_TO_IMAGE_"
AdditionalIncludeDirectories="&quot;../../../DesktopEditor/freetype-2.5.2/include&quot;;&quot;C:\_WORK\trunk\ServerComponents\DesktopEditor\freetype-2.5.2\include&quot;"
PreprocessorDefinitions="NDEBUG;_LIB;_USE_MATH_DEFINES;PPTX_DEF;PPT_DEF;ENABLE_PPT_TO_PPTX_CONVERT;PPT_FORMAT;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;BUILD_CONFIG_FULL_VERSION;_PRESENTATION_WRITER_;_SVG_CONVERT_TO_IMAGE_;DONT_WRITE_EMBEDDED_FONTS"
StringPooling="true"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
......
......@@ -9,27 +9,27 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASCOfficeUtilsLib", "..\..\
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PPTXFormat", "..\..\ASCOfficePPTXFile\PPTXLib\PPTXFormat.vcproj", "{36636678-AE25-4BE6-9A34-2561D1BCF302}"
ProjectSection(ProjectDependencies) = postProject
{21663823-DE45-479B-91D0-B4FEF4916EF0} = {21663823-DE45-479B-91D0-B4FEF4916EF0}
{DC24710E-8DF2-4A7A-B7C3-2313E294143C} = {DC24710E-8DF2-4A7A-B7C3-2313E294143C}
{21663823-DE45-479B-91D0-B4FEF4916EF0} = {21663823-DE45-479B-91D0-B4FEF4916EF0}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASCHTMLRenderer", "..\..\ASCHTMLRenderer\ASCHTMLRendererLib.vcproj", "{DC24710E-8DF2-4A7A-B7C3-2313E294143C}"
ProjectSection(ProjectDependencies) = postProject
{C739151F-5384-41DF-A1A6-F089E2C1AD56} = {C739151F-5384-41DF-A1A6-F089E2C1AD56}
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2} = {37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}
{DF861D33-9BC1-418C-82B1-581F590FE169} = {DF861D33-9BC1-418C-82B1-581F590FE169}
{0588563C-F05C-428C-B21A-DD74756628B3} = {0588563C-F05C-428C-B21A-DD74756628B3}
{40A69F40-063E-43FD-8543-455495D8733E} = {40A69F40-063E-43FD-8543-455495D8733E}
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540} = {9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}
{9A037A69-D1DF-4505-AB2A-6CB3641C476E} = {9A037A69-D1DF-4505-AB2A-6CB3641C476E}
{617F9069-5E37-4B80-9A3A-E77AFC4CC7AD} = {617F9069-5E37-4B80-9A3A-E77AFC4CC7AD}
{BC52A07C-A797-423D-8C4F-8678805BBB36} = {BC52A07C-A797-423D-8C4F-8678805BBB36}
{FFDA5DA1-BB65-4695-B678-BE59B4A1355D} = {FFDA5DA1-BB65-4695-B678-BE59B4A1355D}
{3F3CB5A1-BB01-49C1-9342-4A69E30F9EF6} = {3F3CB5A1-BB01-49C1-9342-4A69E30F9EF6}
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B} = {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}
{818753F2-DBB9-4D3B-898A-A604309BE470} = {818753F2-DBB9-4D3B-898A-A604309BE470}
{764C3A2D-FB0F-428E-B1C7-62D1DD2CE239} = {764C3A2D-FB0F-428E-B1C7-62D1DD2CE239}
{43A0E60E-5C4A-4C09-A29B-7683F503BBD7} = {43A0E60E-5C4A-4C09-A29B-7683F503BBD7}
{764C3A2D-FB0F-428E-B1C7-62D1DD2CE239} = {764C3A2D-FB0F-428E-B1C7-62D1DD2CE239}
{818753F2-DBB9-4D3B-898A-A604309BE470} = {818753F2-DBB9-4D3B-898A-A604309BE470}
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B} = {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}
{3F3CB5A1-BB01-49C1-9342-4A69E30F9EF6} = {3F3CB5A1-BB01-49C1-9342-4A69E30F9EF6}
{FFDA5DA1-BB65-4695-B678-BE59B4A1355D} = {FFDA5DA1-BB65-4695-B678-BE59B4A1355D}
{BC52A07C-A797-423D-8C4F-8678805BBB36} = {BC52A07C-A797-423D-8C4F-8678805BBB36}
{617F9069-5E37-4B80-9A3A-E77AFC4CC7AD} = {617F9069-5E37-4B80-9A3A-E77AFC4CC7AD}
{9A037A69-D1DF-4505-AB2A-6CB3641C476E} = {9A037A69-D1DF-4505-AB2A-6CB3641C476E}
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540} = {9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}
{40A69F40-063E-43FD-8543-455495D8733E} = {40A69F40-063E-43FD-8543-455495D8733E}
{0588563C-F05C-428C-B21A-DD74756628B3} = {0588563C-F05C-428C-B21A-DD74756628B3}
{DF861D33-9BC1-418C-82B1-581F590FE169} = {DF861D33-9BC1-418C-82B1-581F590FE169}
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2} = {37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}
{C739151F-5384-41DF-A1A6-F089E2C1AD56} = {C739151F-5384-41DF-A1A6-F089E2C1AD56}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "graphics", "..\..\DesktopEditor\graphics\graphics_vs2005.vcproj", "{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}"
......@@ -47,6 +47,9 @@ EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "freetype", "..\..\DesktopEditor\freetype-2.5.2\builds\windows\vc2005\freetype.vcproj", "{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "raster", "..\..\DesktopEditor\raster\raster_vs2005.vcproj", "{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}"
ProjectSection(ProjectDependencies) = postProject
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1} = {EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jasper", "..\..\DesktopEditor\cximage\jasper\jasper_vs2005.vcproj", "{FFDA5DA1-BB65-4695-B678-BE59B4A1355D}"
EndProject
......@@ -62,11 +65,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpsd", "..\..\DesktopEdit
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PPTFormatLib", "..\PPTFormatLib\Win32\PPTFormatLib.vcproj", "{7B27E40E-F70A-4A74-A77C-0944D7931D15}"
ProjectSection(ProjectDependencies) = postProject
{3F3CB5A1-BB01-49C1-9342-4A69E30F9EF6} = {3F3CB5A1-BB01-49C1-9342-4A69E30F9EF6}
{36636678-AE25-4BE6-9A34-2561D1BCF302} = {36636678-AE25-4BE6-9A34-2561D1BCF302}
{A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0}
{DC24710E-8DF2-4A7A-B7C3-2313E294143C} = {DC24710E-8DF2-4A7A-B7C3-2313E294143C}
{21663823-DE45-479B-91D0-B4FEF4916EF0} = {21663823-DE45-479B-91D0-B4FEF4916EF0}
{DC24710E-8DF2-4A7A-B7C3-2313E294143C} = {DC24710E-8DF2-4A7A-B7C3-2313E294143C}
{A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0}
{36636678-AE25-4BE6-9A34-2561D1BCF302} = {36636678-AE25-4BE6-9A34-2561D1BCF302}
{3F3CB5A1-BB01-49C1-9342-4A69E30F9EF6} = {3F3CB5A1-BB01-49C1-9342-4A69E30F9EF6}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PptFormatTest", "..\..\Test\Applications\DocxFormatTests\PptFormatTest\win32\PptFormatTest.vcproj", "{0F49D5D1-A8D3-4F97-8BC1-E2F65BB00C10}"
......@@ -78,6 +81,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libxml2", "..\..\Common\Doc
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jbig", "..\..\DesktopEditor\cximage\jbig\jbig_vs2005.vcproj", "{764C3A2D-FB0F-428E-B1C7-62D1DD2CE239}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jbig2", "..\..\DesktopEditor\raster\JBig2\win32\jbig2.vcproj", "{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
......@@ -442,6 +447,22 @@ Global
{764C3A2D-FB0F-428E-B1C7-62D1DD2CE239}.Unicode Release|Win32.Build.0 = Unicode Release|Win32
{764C3A2D-FB0F-428E-B1C7-62D1DD2CE239}.Unicode Release|x64.ActiveCfg = Unicode Release|x64
{764C3A2D-FB0F-428E-B1C7-62D1DD2CE239}.Unicode Release|x64.Build.0 = Unicode Release|x64
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}.Debug|Win32.ActiveCfg = Debug|Win32
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}.Debug|Win32.Build.0 = Debug|Win32
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}.Debug|x64.ActiveCfg = Debug|x64
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}.Debug|x64.Build.0 = Debug|x64
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}.Release|Win32.ActiveCfg = Release|Win32
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}.Release|Win32.Build.0 = Release|Win32
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}.Release|x64.ActiveCfg = Release|x64
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}.Release|x64.Build.0 = Release|x64
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}.Unicode Debug|Win32.ActiveCfg = Debug|Win32
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}.Unicode Debug|Win32.Build.0 = Debug|Win32
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}.Unicode Debug|x64.ActiveCfg = Debug|x64
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}.Unicode Debug|x64.Build.0 = Debug|x64
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}.Unicode Release|Win32.ActiveCfg = Release|Win32
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}.Unicode Release|Win32.Build.0 = Release|Win32
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}.Unicode Release|x64.ActiveCfg = Release|x64
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}.Unicode Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
......@@ -59,7 +59,7 @@
PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_USRDLL;_ATL_ATTRIBUTES;_USE_MATH_DEFINES;PPTX_DEF;PPT_DEF;ENABLE_PPT_TO_PPTX_CONVERT;PPT_FORMAT;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;USE_AVSOFFICESTUDIO_XMLUTILS;_PRESENTATION_WRITER_;_SVG_CONVERT_TO_IMAGE_"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
......@@ -84,7 +84,7 @@
AdditionalDependencies="Urlmon.lib"
LinkIncremental="2"
IgnoreAllDefaultLibraries="false"
IgnoreDefaultLibraryNames=""
IgnoreDefaultLibraryNames="LIBCMTD.lib"
MergedIDLBaseFileName="_ASCOfficePPTFile.idl"
GenerateDebugInformation="true"
SubSystem="2"
......@@ -253,7 +253,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
AdditionalIncludeDirectories="&quot;../DesktopEditor/freetype-2.5.2/include&quot;"
PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_USRDLL;_ATL_ATTRIBUTES;_USE_MATH_DEFINES;PPTX_DEF;PPT_DEF;ENABLE_PPT_TO_PPTX_CONVERT;PPT_FORMAT;_USE_XMLLITE_READER_;USE_LITE_READER;USE_AVSOFFICESTUDIO_XMLUTILS;LIBXML_READER_ENABLED;_PRESENTATION_WRITER_;_SVG_CONVERT_TO_IMAGE_"
StringPooling="true"
RuntimeLibrary="2"
......
......@@ -2,6 +2,6 @@
//1
//0
//1
//269
#define INTVER 1,0,1,269
#define STRVER "1,0,1,269\0"
//272
#define INTVER 1,0,1,272
#define STRVER "1,0,1,272\0"
......@@ -6057,47 +6057,11 @@
>
</File>
<File
RelativePath="..\XlsFormat\Logic\SummaryInformationStream\Structures\Property.cpp"
RelativePath="..\XlsFormat\Logic\SummaryInformationStream\Structures\Property.h"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\XlsFormat\Logic\SummaryInformationStream\Structures\Property.h"
RelativePath="..\XlsFormat\Logic\SummaryInformationStream\Structures\Property_Structures.cpp"
>
</File>
<File
......@@ -6130,14 +6094,6 @@
<Filter
Name="Auxiliary"
>
<File
RelativePath="..\XlsFormat\Auxiliary\BetterVariantT.cpp"
>
</File>
<File
RelativePath="..\XlsFormat\Auxiliary\BetterVariantT.h"
>
</File>
<File
RelativePath="..\XlsFormat\Auxiliary\HelpersTagsGenerator.cpp"
>
......
......@@ -6,22 +6,22 @@ namespace NSPresentationEditor
class CAudioPart
{
public:
CString m_strFile;
std::wstring m_strFile;
double m_dStartTime;
double m_dEndTime;
double m_dStartTime;
double m_dEndTime;
double m_dClipStartTime;
double m_dClipEndTime;
double m_dClipStartTime;
double m_dClipEndTime;
double m_dAudioDuration;
double m_dAudioDuration;
bool m_bLoop;
bool m_bStop;
bool m_bLoop;
bool m_bStop;
bool m_bIsTransition;
bool m_bIsTransition;
double m_dAmplify;
double m_dAmplify;
public:
CAudioPart()
......@@ -244,15 +244,15 @@ namespace NSPresentationEditor
strOverlay1.Format(_T("<AudioSource StartTime='%lf' Duration='%lf' Amplify='%lf'>"),
pPart->m_dStartTime, pPart->m_dEndTime - pPart->m_dStartTime, pPart->m_dAmplify);
int lIndex = pPart->m_strFile.Find(L"file:///");
int lIndex = pPart->m_strFile.find(L"file:///");
if (0 == lIndex)
{
pPart->m_strFile = pPart->m_strFile.Mid(8);
pPart->m_strFile.Replace('/', '\\');
pPart->m_strFile.Replace(L"%20", L" ");
pPart->m_strFile = pPart->m_strFile.substr(8);
//pPart->m_strFile.Replace('/', '\\');
//pPart->m_strFile.Replace(L"%20", L" ");
}
CString strFile_ = pPart->m_strFile;
CString strFile_ = std_string2string(pPart->m_strFile);
CorrectXmlString(strFile_);
strOverlay2.Format(_T("<Source StartTime='%lf' EndTime='%lf' FilePath='%s'/></AudioSource>"),
......
......@@ -102,7 +102,7 @@ namespace NSPresentationEditor
}
else
{
pLayout->m_arElements[nElem]->SetupProperties(NULL, &m_arThemes[i], NULL);
//pLayout->m_arElements[nElem]->SetupProperties(NULL, &m_arThemes[i], NULL);
}
}
}
......@@ -934,17 +934,18 @@ namespace NSPresentationEditor
strMetric.Format(_T(" hor_mm=\"%d\" ver_mm=\"%d\" hor_uni=\"%d\" ver_uni=\"%d\">"),
m_oInfo.m_lMillimetresHor, m_oInfo.m_lMillimetresVer, m_oInfo.m_lUnitsHor, m_oInfo.m_lUnitsVer);
oWriter.WriteString(_T("<Presentation xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"") + strMetric);
oWriter.WriteString(std::wstring(L"<Presentation xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\""));
oWriter.WriteString(strMetric);
oWriter.WriteString(_T("<Themes>"));
oWriter.WriteString(std::wstring(L"<Themes>"));
size_t nCount = m_arThemes.size();
for (size_t i = 0; i < nCount; ++i)
{
oWriter.WriteString(m_arThemes[i].ToXmlEditor(m_oInfo));
}
oWriter.WriteString(_T("</Themes>"));
oWriter.WriteString(std::wstring(L"</Themes>"));
oWriter.WriteString(_T("<Slides>"));
oWriter.WriteString(std::wstring(L"<Slides>"));
nCount = m_arSlides.size();
for (size_t i = 0; i < nCount; ++i)
{
......@@ -964,9 +965,9 @@ namespace NSPresentationEditor
oWriter.WriteString(m_arSlides[i].ToXmlEditor(pThemeSlide, pLayoutSlide, m_oInfo));
}
oWriter.WriteString(_T("</Slides>"));
oWriter.WriteString(std::wstring(L"</Slides>"));
oWriter.WriteString(_T("</Presentation>"));
oWriter.WriteString(std::wstring(L"</Presentation>"));
oWriter.CorrectUnicodeString();
return oWriter.GetData();
......
......@@ -56,6 +56,9 @@ namespace NSPresentationEditor
CTheme* m_pTheme;
CLayout* m_pLayout;
std::wstring m_sName;
std::wstring m_sDescription;
protected:
ULONG m_lCountRef;
......@@ -129,8 +132,9 @@ namespace NSPresentationEditor
}
virtual void NormalizeCoordsByMetric()
{
double dScaleX = m_oMetric.m_lUnitsHor / m_oMetric.m_lMillimetresHor;
double dScaleY = m_oMetric.m_lUnitsVer / m_oMetric.m_lMillimetresVer;
double dScaleX = (double)m_oMetric.m_lUnitsHor / m_oMetric.m_lMillimetresHor;
double dScaleY = (double)m_oMetric.m_lUnitsVer / m_oMetric.m_lMillimetresVer;
m_rcBoundsOriginal.left = dScaleX * m_rcBounds.left;
m_rcBoundsOriginal.right = dScaleX * m_rcBounds.right;
m_rcBoundsOriginal.top = dScaleY * m_rcBounds.top;
......
......@@ -81,7 +81,6 @@ namespace NSPresentationEditor
{
m_ID = type;
m_dwValue = 0;
m_strAdvanced = NULL;
}
CElementProperty(const CElementProperty& oSrc)
{
......@@ -91,26 +90,16 @@ namespace NSPresentationEditor
{
m_ID = oSrc.m_ID;
m_dwValue = oSrc.m_dwValue;
m_strAdvanced = NULL;
m_strAdvanced = oSrc.m_strAdvanced;
if (NULL != oSrc.m_strAdvanced)
{
m_strAdvanced = new WCHAR[m_dwValue];
memcpy(m_strAdvanced, oSrc.m_strAdvanced, m_dwValue * sizeof(WCHAR));
}
return *this;
}
inline bool IsAdvanced()
{
return (NULL != m_strAdvanced);
}
public:
Type m_ID;
DWORD m_dwValue;
Type m_ID;
DWORD m_dwValue;
LPWSTR m_strAdvanced;
std::wstring m_strAdvanced;
};
class CElementProperties
......@@ -173,15 +162,12 @@ namespace NSPresentationEditor
m_arProperties[eType] = oProp;
}
inline void SetAt(const CElementProperty::Type& eType, CString strValue)
inline void SetAt(const CElementProperty::Type& eType, std::wstring strValue)
{
CElementProperty oProp(eType);
oProp.m_dwValue = strValue.GetLength() + 1;
oProp.m_strAdvanced = new WCHAR[oProp.m_dwValue];
memcpy(oProp.m_strAdvanced, strValue.GetBuffer(), strValue.GetLength() * sizeof(WCHAR));
oProp.m_dwValue = strValue.length() + 1;
oProp.m_strAdvanced[oProp.m_dwValue - 1] = 0;
oProp.m_strAdvanced = strValue;
m_arProperties[eType] = oProp;
}
......
......@@ -15,7 +15,7 @@ namespace NSPresentationEditor
if (!m_bUseThemeColorScheme)
{
// colors ----
oWriter.WriteString(_T("<Colors>"));
oWriter.WriteString(std::wstring(L"<Colors>"));
size_t nCountColors = m_arColorScheme.size();
for (size_t i = 0; i < nCountColors; ++i)
......@@ -27,7 +27,7 @@ namespace NSPresentationEditor
oWriter.WriteString(strFormat);
}
oWriter.WriteString(_T("</Colors>"));
oWriter.WriteString(std::wstring(L"</Colors>"));
// -----------
}
......@@ -59,14 +59,14 @@ namespace NSPresentationEditor
oElem.m_bIsBackground = true;
oElem.m_bIsChangeable = false;
oWriter.WriteString(_T("<Background>"));
oWriter.WriteString(std::wstring(L"<Background>"));
oElem.SetupProperties(NULL, pTheme, this);
oWriter.WriteString(oElem.ToXmlEditor());
oWriter.WriteString(_T("</Background>"));
oWriter.WriteString(std::wstring(L"</Background>"));
}
// -----------
// elements (no placeholders)
oWriter.WriteString(_T("<Elements>"));
oWriter.WriteString(std::wstring(L"<Elements>"));
size_t nCountElems = m_arElements.size();
for (size_t i = 0; i < nCountElems; ++i)
......@@ -80,13 +80,13 @@ namespace NSPresentationEditor
}
}
oWriter.WriteString(_T("</Elements>"));
oWriter.WriteString(std::wstring(L"</Elements>"));
// ----------------
// placeholders
oWriter.WriteString(_T("<Placeholders>"));
oWriter.WriteString(std::wstring(L"<Placeholders>"));
CString strStylesPh = _T("");
CString strFontRefs = _T("");
std::wstring strStylesPh = _T("");
std::wstring strFontRefs = _T("");
for (size_t i = 0; i < nCountElems; ++i)
{
......@@ -133,12 +133,12 @@ namespace NSPresentationEditor
}
}
oWriter.WriteString(_T("</Placeholders>"));
oWriter.WriteString(std::wstring(L"</Placeholders>"));
oWriter.WriteString(_T("<Styles>") + strStylesPh + _T("</Styles>"));
oWriter.WriteString(_T("<StylesFontRef>") + strFontRefs + _T("</StylesFontRef>"));
oWriter.WriteString(std::wstring(L"<Styles>") + strStylesPh + _T("</Styles>"));
oWriter.WriteString(std::wstring(L"<StylesFontRef>") + strFontRefs + _T("</StylesFontRef>"));
oWriter.WriteString(_T("</Layout>"));
oWriter.WriteString(std::wstring(L"</Layout>"));
return oWriter.GetData();
}
......
......@@ -33,16 +33,12 @@ void NSPresentationEditor::CSVGConverter::_SetFont()
if (_T("") == m_oFont.Path)
{
std::wstring bsName = string2std_string(m_oFont.Name);
m_pFontManager->LoadFontByName(bsName, (float)m_oFont.Size, m_oFont.GetStyle(), m_dDpiX, m_dDpiY);
m_pFontManager->LoadFontByName(m_oFont.Name, (float)m_oFont.Size, m_oFont.GetStyle(), m_dDpiX, m_dDpiY);
}
else
{
std::wstring bsName = string2std_string(m_oFont.Path);
m_pFontManager->LoadFontFromFile(bsName, (float)m_oFont.Size, m_dDpiX, m_dDpiY, 0);
m_pFontManager->LoadFontFromFile(m_oFont.Path, (float)m_oFont.Size, m_dDpiX, m_dDpiY, 0);
}
m_oInstalledFont = m_oFont;
......@@ -292,12 +288,12 @@ HRESULT NSPresentationEditor::CSVGConverter::put_BrushAlpha2(const LONG& lAlpha)
HRESULT NSPresentationEditor::CSVGConverter::get_BrushTexturePath(std::wstring* bsPath)
{
if (bsPath == NULL) return S_FALSE;
*bsPath = string2std_string(m_oBrush.TexturePath);
*bsPath = m_oBrush.TexturePath;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_BrushTexturePath(const std::wstring& bsPath)
{
m_oBrush.TexturePath = std_string2string(bsPath);
m_oBrush.TexturePath = bsPath;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::get_BrushTextureMode(LONG* lMode)
......@@ -344,22 +340,22 @@ HRESULT NSPresentationEditor::CSVGConverter::BrushRect(const INT& val, const dou
HRESULT NSPresentationEditor::CSVGConverter::get_FontName(std::wstring* bsName)
{
*bsName = string2std_string(m_oFont.Name);
*bsName = m_oFont.Name;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_FontName(const std::wstring& bsName)
{
m_oFont.Name = std_string2string(bsName);
m_oFont.Name = bsName;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::get_FontPath(std::wstring* bsName)
{
*bsName = string2std_string(m_oFont.Path);
*bsName = m_oFont.Path;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_FontPath(const std::wstring& bsName)
{
m_oFont.Path = std_string2string(bsName);
m_oFont.Path = bsName;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::get_FontSize(double* dSize)
......
......@@ -17,7 +17,7 @@ namespace NSPresentationEditor
{
//#if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
//#error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms."
//#endif
//#endiflo
//// ISVGConverter
//[ object, uuid("4EE9D2C3-7317-4540-A205-DB78DBEB9BD0"), dual, pointer_default(unique) ]
......
......@@ -1745,7 +1745,7 @@ namespace SVG
if ((strClassName.GetLength () > 1) && (-1 == lLongAttribute ) && (alpha > 0.0))
{
m_render->put_BrushColor1 (0);
m_render->put_BrushColor1 (0xffffff);
m_render->put_BrushAlpha1 ((LONG)( dAlplaFill * 255.0 * alpha));
return true;
......
......@@ -53,6 +53,7 @@ namespace NSPresentationEditor
IElement* pElem = m_arElements[nIndex];
RELEASEINTERFACE(pElem);
}
m_arColorScheme.clear();
m_arElements.clear();
m_lThemeID = -1;
......@@ -83,6 +84,8 @@ namespace NSPresentationEditor
m_arElements.push_back(oSrc.m_arElements[nIndex]->CreateDublicate());
}
m_arColorScheme = oSrc.m_arColorScheme;
m_oSlideShow = oSrc.m_oSlideShow;
m_lThemeID = oSrc.m_lThemeID;
......@@ -117,6 +120,8 @@ namespace NSPresentationEditor
m_arElements.push_back(oSrc.m_arElements[nIndex]->CreateDublicate());
}
m_arColorScheme = oSrc.m_arColorScheme;
m_oSlideShow = oSrc.m_oSlideShow;
m_lThemeID = oSrc.m_lThemeID;
......@@ -391,13 +396,13 @@ namespace NSPresentationEditor
oElem.m_bIsBackground = true;
oElem.m_bIsChangeable = false;
oWriter.WriteString(_T("<Background>"));
oWriter.WriteString(std::wstring(L"<Background>"));
oElem.SetupProperties(this, pTheme, pLayout);
oWriter.WriteString(oElem.ToXmlEditor());
oWriter.WriteString(_T("</Background>"));
oWriter.WriteString(std::wstring(L"</Background>"));
}
CString strFontRefs = _T("");
std::wstring strFontRefs = _T("");
// elements
size_t nCount = m_arElements.size();
......@@ -415,7 +420,7 @@ namespace NSPresentationEditor
oWriter.WriteString(strElement);
oWriter.WriteString(pElement->ToXmlEditor());
oWriter.WriteString(_T("</Element>"));
oWriter.WriteString(std::wstring(L"</Element>"));
if (etShape == pElement->m_etType)
{
......@@ -428,15 +433,15 @@ namespace NSPresentationEditor
CString strRef = _T("");
strRef.Format(_T("s_font%d { font-index:%d;font-family:%ls; }\n"),
pTextElement->m_lID, lFontRef, pTheme->m_arFonts[lFontRef].Name);
strFontRefs += strRef;
strFontRefs += string2std_string(strRef);
}
}
}
}
oWriter.WriteString(_T("<StylesFontRef>") + strFontRefs + _T("</StylesFontRef>"));
oWriter.WriteString(std::wstring(L"<StylesFontRef>") + strFontRefs + _T("</StylesFontRef>"));
oWriter.WriteString(_T("</Slide>"));
oWriter.WriteString(std::wstring(L"</Slide>"));
return oWriter.GetData();
}
......
......@@ -13,6 +13,25 @@ namespace NSPresentationEditor
//0x05 //Accent 1 color
//0x06 //Accent 2 color
//0x07 //Accent 3 color
// [0]);//0
// [1]);//1
// [2]);//2
// [3]);//3
// [0]);//4
// [4]);//5 //accent1
// [5]);//6 //accent2
// [0]);//7 //accent3
// [5]);//8 //accent4
// [4]);//9 //accent5
// [7]);//10 //accent6
// [6]);//11 //hlink
// [7]);//12 //folHlink
// [0]);//13 //lt1
// [1]);//14 //dk1
// [2]);//15 //lt2
// [3]);//16 //dk2
switch (lSchemeIndex)
{
case 0:
......@@ -22,22 +41,22 @@ namespace NSPresentationEditor
lSchemeIndex = 14;
break;
case 2:
lSchemeIndex = 16;
lSchemeIndex = 15;
break;
case 3:
lSchemeIndex = 15;
lSchemeIndex = 16;
break;
case 4:
lSchemeIndex = 5;
break;
case 5:
lSchemeIndex = 5;//6
lSchemeIndex = 6;
break;
case 6:
lSchemeIndex = 6;//11
lSchemeIndex = 11;
break;
case 7:
lSchemeIndex = 7;//12
lSchemeIndex = 12;
break;
default:
lSchemeIndex = -1;
......
......@@ -126,6 +126,93 @@ namespace NSPresentationEditor
void RecalcParagraphs(CTheme* pTheme = NULL);
void NormalizeCoordsByMetric(const CMetricInfo & oMetric)
{
double dScaleX = (double)oMetric.m_lUnitsHor / oMetric.m_lMillimetresHor / 24.;
double dScaleY = (double)oMetric.m_lUnitsVer / oMetric.m_lMillimetresVer / 24.;
size_t lCount = m_arParagraphs.size();
for (size_t i = 0; i < lCount; ++i)
{
CTextPFRun* pPar = &m_arParagraphs[i].m_oPFRun;
WORD lIndentLevel = (WORD)m_arParagraphs[i].m_lTextLevel;
switch (lIndentLevel)
{
case 0:
{
if (m_oRuler.LeftMargin1.is_init())
pPar->leftMargin = (LONG)m_oRuler.LeftMargin1.get();
if (m_oRuler.Indent1.is_init())
pPar->indent = (LONG)m_oRuler.Indent1.get();
if (pPar->indent.is_init() && pPar->leftMargin.get())
pPar->indent.get() -= pPar->leftMargin.get();
break;
}
case 1:
{
if (m_oRuler.LeftMargin2.is_init())
pPar->leftMargin = (LONG)m_oRuler.LeftMargin2.get();
if (m_oRuler.Indent2.is_init())
pPar->indent = (LONG)m_oRuler.Indent2.get();
if (pPar->indent.is_init() && pPar->leftMargin.get())
pPar->indent.get() -= pPar->leftMargin.get();
break;
}
case 2:
{
if (m_oRuler.LeftMargin3.is_init())
pPar->leftMargin = (LONG)m_oRuler.LeftMargin3.get();
if (m_oRuler.Indent3.is_init())
pPar->indent = (LONG)m_oRuler.Indent3.get();
if (pPar->indent.is_init() && pPar->leftMargin.get())
pPar->indent.get() -= pPar->leftMargin.get();
break;
}
case 3:
{
if (m_oRuler.LeftMargin4.is_init())
pPar->leftMargin = (LONG)m_oRuler.LeftMargin4.get();
if (m_oRuler.Indent4.is_init())
pPar->indent = (LONG)m_oRuler.Indent4.get();
if (pPar->indent.is_init() && pPar->leftMargin.get())
pPar->indent.get() -= pPar->leftMargin.get();
break;
}
case 4:
{
if (m_oRuler.LeftMargin5.is_init())
pPar->leftMargin = (LONG)m_oRuler.LeftMargin5.get();
if (m_oRuler.Indent5.is_init())
pPar->indent = (LONG)m_oRuler.Indent5.get();
if (pPar->indent.is_init() && pPar->leftMargin.get())
pPar->indent.get() -= pPar->leftMargin.get();
break;
}
default:
break;
}
if (pPar->leftMargin.is_init())
pPar->leftMargin = pPar->leftMargin.get() * dScaleX;
if (pPar->indent.is_init())
pPar->indent = pPar->indent.get() * dScaleX;
if (pPar->lineSpacing.is_init())
pPar->lineSpacing =- pPar->lineSpacing.get();// * dScaleY;
if (pPar->spaceAfter.is_init())
pPar->spaceAfter = -pPar->spaceAfter.get() ;//* dScaleY;
if (pPar->spaceBefore.is_init())
pPar->spaceBefore = -pPar->spaceBefore.get() ;//* dScaleY;
if (pPar->defaultTabSize.is_init())
pPar->defaultTabSize = pPar->defaultTabSize.get()* dScaleX;
}
}
void CorrectRuler()
{
size_t lCount = m_arParagraphs.size();
......@@ -193,7 +280,7 @@ namespace NSPresentationEditor
}
default:
break;
};
}
}
}
......
......@@ -65,12 +65,12 @@ namespace NSPresentationEditor
class CFontProperties
{
public:
BYTE FontNameProp;
CString strFontName;
CString strPanose;
CString strPitchFamily;
LONG lFontFixed;
std::vector<BYTE> arFontCharsets;
BYTE FontNameProp;
std::wstring strFontName;
std::wstring strPanose;
std::wstring strPitchFamily;
LONG lFontFixed;
std::vector<BYTE> arFontCharsets;
public:
CFontProperties() : FontNameProp(0), strFontName(_T("")), strPanose(_T("")), strPitchFamily(_T("")), lFontFixed(0), arFontCharsets()
......@@ -112,11 +112,11 @@ namespace NSPresentationEditor
{
public:
NSCommon::nullable_base<bool> FontBold;
NSCommon::nullable_base<bool> FontItalic;
NSCommon::nullable_base<bool> FontUnderline;
NSCommon::nullable_base<bool> FontStrikeout;
NSCommon::nullable_base<bool> FontShadow;
NSCommon::nullable_base<bool> FontBold;
NSCommon::nullable_base<bool> FontItalic;
NSCommon::nullable_base<bool> FontUnderline;
NSCommon::nullable_base<bool> FontStrikeout;
NSCommon::nullable_base<bool> FontShadow;
NSCommon::nullable_base<WORD> Typeface; // fontRef
NSCommon::nullable_base<WORD> EAFontRef; // eaFontRef
......@@ -313,26 +313,26 @@ namespace NSPresentationEditor
if (FontProperties.is_init())
{
strXml += (_T("<font-name>") + FontProperties->strFontName + _T("</font-name>"));
strXml += (_T("<font-name>") + std_string2string(FontProperties->strFontName) + _T("</font-name>"));
oWriter.WriteString(strXml);
oWriter.WriteNodeEnd(_T("Attributes"));
// font properties
strXml = _T("<FontProperties>");
strXml += (_T("<Name value='") + FontProperties->strFontName + _T("' />"));
strXml += (_T("<Name value='") + std_string2string(FontProperties->strFontName) + _T("' />"));
if (0 < FontProperties->arFontCharsets.size())
strXml += (_T("<Charset value='") + XmlUtils::IntToString((int)FontProperties->arFontCharsets[0]) + _T("' />"));
if (_T("unknown") != FontProperties->strPitchFamily)
strXml += (_T("<FamilyClass name='") + FontProperties->strPitchFamily + _T("' />"));
strXml += (_T("<FamilyClass name='") + std_string2string(FontProperties->strPitchFamily) + _T("' />"));
if (-1 != FontProperties->lFontFixed)
strXml += (_T("<FixedWidth value='") + XmlUtils::IntToString(FontProperties->lFontFixed) + _T("' />"));
if (_T("") != FontProperties->strPanose)
strXml += (_T("<Panose value='") + FontProperties->strPanose + _T("' />"));
strXml += (_T("<Panose value='") + std_string2string(FontProperties->strPanose) + _T("' />"));
strXml += (_T("<Style bold='") + XmlUtils::IntToString(nBold) + _T("' italic='") + XmlUtils::IntToString(nItalic) + _T("' />"));
......@@ -456,7 +456,7 @@ namespace NSPresentationEditor
else if (bIsFontNamPres)
{
strStyle += _T("font-family: ");
strStyle += FontProperties->strFontName;
strStyle += std_string2string(FontProperties->strFontName);
strStyle += _T(";");
}
......@@ -1236,13 +1236,13 @@ namespace NSPresentationEditor
int nAlign = (int)m_oPFRun.textAlignment.get();
if (0 == nAlign)
oWriter.WriteString(_T("text-align:left;"));
oWriter.WriteString(std::wstring(L"text-align:left;"));
else if (2 == nAlign)
oWriter.WriteString(_T("text-align:right;"));
oWriter.WriteString(std::wstring(L"text-align:right;"));
else if (3 == nAlign)
oWriter.WriteString(_T("text-align:justify;"));
oWriter.WriteString(std::wstring(L"text-align:justify;"));
else
oWriter.WriteString(_T("text-align:center;"));
oWriter.WriteString(std::wstring(L"text-align:center;"));
}
int nMargin = 0;
......@@ -1352,55 +1352,55 @@ namespace NSPresentationEditor
{
if (m_oCFRun.FontBold.get())
{
oWriter.WriteString(_T("font-weight: bold;"));
oWriter.WriteString(std::wstring(L"font-weight: bold;"));
}
else
{
oWriter.WriteString(_T("font-weight: normal;"));
oWriter.WriteString(std::wstring(L"font-weight: normal;"));
}
}
if (m_oCFRun.FontItalic.is_init())
{
if (m_oCFRun.FontItalic.get())
{
oWriter.WriteString(_T("font-style: italic;"));
oWriter.WriteString(std::wstring(L"font-style: italic;"));
}
else
{
oWriter.WriteString(_T("font-style: normal;"));
oWriter.WriteString(std::wstring(L"font-style: normal;"));
}
}
if (m_oCFRun.FontUnderline.is_init())
{
if (m_oCFRun.FontUnderline.get())
{
oWriter.WriteString(_T("text-decoration: underline;"));
oWriter.WriteString(std::wstring(L"text-decoration: underline;"));
}
else
{
oWriter.WriteString(_T("text-decoration: none;"));
oWriter.WriteString(std::wstring(L"text-decoration: none;"));
}
}
/*if (m_oCFRun.FontStrikeout.is_init())
{
if (m_oCFRun.FontStrikeout.get())
{
oWriter.WriteString(_T("text-decoration: line-through;"));
oWriter.WriteString(std::wstring(L"text-decoration: line-through;"));
}
else
{
oWriter.WriteString(_T("text-decoration: normal;"));
oWriter.WriteString(std::wstring(L"text-decoration: normal;"));
}
}*/
if (m_oCFRun.FontShadow.is_init())
{
if (m_oCFRun.FontShadow.get())
{
oWriter.WriteString(_T("text-shadow: black 1px 1px 2px;"));
oWriter.WriteString(std::wstring(L"text-shadow: black 1px 1px 2px;"));
}
else
{
oWriter.WriteString(_T("text-shadow: none;"));
oWriter.WriteString(std::wstring(L"text-shadow: none;"));
}
}
......@@ -1433,13 +1433,13 @@ namespace NSPresentationEditor
if (m_oCFRun.FontProperties.is_init())
{
oWriter.WriteString(_T("font-family: "));
oWriter.WriteString(std::wstring(L"font-family: "));
oWriter.WriteString(m_oCFRun.FontProperties->strFontName);
oWriter.WriteString(_T("; }\n"));
oWriter.WriteString(std::wstring(L"; }\n"));
}
else
{
oWriter.WriteString(_T(" }\n"));
oWriter.WriteString(std::wstring(L" }\n"));
}
return oWriter.GetData();
}
......@@ -1541,7 +1541,7 @@ namespace NSPresentationEditor
oWriter.WriteString(m_pLevels[i]->ToXmlEditor(oInfo, bIsLayout, lTextOrPlaceholderType, lID, (LONG)i));
}
oWriter.WriteString(_T("</Style>"));
oWriter.WriteString(std::wstring(L"</Style>"));
return oWriter.GetData();
}
};
......
......@@ -6,10 +6,12 @@ namespace NSPresentationEditor
{
NSPresentationEditor::CStringWriter oWriter;
oWriter.WriteString(_T("<Theme>"));
oWriter.WriteString(std::wstring(L"<Theme name=\""));
oWriter.WriteString(m_sThemeName);
oWriter.WriteString(std::wstring(L"\">"));
// colors ----
oWriter.WriteString(_T("<Colors>"));
oWriter.WriteString(std::wstring(L"<Colors>"));
size_t nCountColors = m_arColorScheme.size();
for (size_t i = 0; i < nCountColors; ++i)
......@@ -21,11 +23,11 @@ namespace NSPresentationEditor
oWriter.WriteString(strFormat);
}
oWriter.WriteString(_T("</Colors>"));
oWriter.WriteString(std::wstring(L"</Colors>"));
// -----------
// fonts -----
oWriter.WriteString(_T("<Fonts>"));
oWriter.WriteString(std::wstring(L"<Fonts>"));
size_t nCountFonts = m_arFonts.size();
//if (nCountFonts > 1)
......@@ -40,12 +42,12 @@ namespace NSPresentationEditor
oWriter.WriteString(strFormat);
}
oWriter.WriteString(_T("</Fonts>"));
oWriter.WriteString(std::wstring(L"</Fonts>"));
// -----------
// fonts dublicate
oWriter.WriteString(_T("<FontsDublicate>"));
oWriter.WriteString(std::wstring(L"<FontsDublicate>"));
for (size_t i = 0; i < nCountFonts; ++i)
{
CString strFormat = _T("");
......@@ -54,18 +56,18 @@ namespace NSPresentationEditor
oWriter.WriteString(strFormat);
}
oWriter.WriteString(_T("</FontsDublicate>"));
oWriter.WriteString(std::wstring(L"</FontsDublicate>"));
// -----------
// textstyles ------
oWriter.WriteString(_T("<TextStyles>"));
oWriter.WriteString(std::wstring(L"<TextStyles>"));
for (long i = 0; i < g_ThemeTextStylesCount; ++i)
{
oWriter.WriteString(m_pStyles[i].ToXmlEditor(oInfo, false, i, -1));
}
oWriter.WriteString(_T("</TextStyles>"));
oWriter.WriteString(std::wstring(L"</TextStyles>"));
// -----------------
// background
......@@ -94,13 +96,13 @@ namespace NSPresentationEditor
oElem.NormalizeCoords(dScaleX, dScaleY);
oElem.m_oShape.m_oBrush = m_oBackground;
oWriter.WriteString(_T("<Background>"));
oWriter.WriteString(std::wstring(L"<Background>"));
oElem.SetupProperties(NULL, this, NULL);
oWriter.WriteString(oElem.ToXmlEditor());
oWriter.WriteString(_T("</Background>"));
oWriter.WriteString(std::wstring(L"</Background>"));
// -----------
// elements
oWriter.WriteString(_T("<Elements>"));
oWriter.WriteString(std::wstring(L"<Elements>"));
size_t nCountElems = m_arElements.size();
for (size_t i = 0; i < nCountElems; ++i)
......@@ -111,10 +113,10 @@ namespace NSPresentationEditor
oWriter.WriteString(m_arElements[i]->ToXmlEditor());
}
oWriter.WriteString(_T("</Elements>"));
oWriter.WriteString(std::wstring(L"</Elements>"));
// ----------------
// layouts
oWriter.WriteString(_T("<Layouts>"));
oWriter.WriteString(std::wstring(L"<Layouts>"));
size_t nCountLayouts = m_arLayouts.size();
for (size_t i = 0; i < nCountLayouts; ++i)
......@@ -122,9 +124,9 @@ namespace NSPresentationEditor
oWriter.WriteString(m_arLayouts[i].ToXmlEditor(this, oInfo));
}
oWriter.WriteString(_T("</Layouts>"));
oWriter.WriteString(std::wstring(L"</Layouts>"));
oWriter.WriteString(_T("</Theme>"));
oWriter.WriteString(std::wstring(L"</Theme>"));
return oWriter.GetData();
}
......@@ -133,6 +135,8 @@ namespace NSPresentationEditor
{
#ifdef _PRESENTATION_WRITER_
//colors
m_sThemeName = oNode.GetAttribute(L"name", L"default");
m_arColorScheme.clear();
XmlUtils::CXmlNode oNodeColors;
if (oNode.GetNode(_T("Colors"), oNodeColors))
......
......@@ -26,10 +26,15 @@ namespace NSPresentationEditor
CMetricInfo m_oInfo;
public:
std::wstring m_sThemeName;
std::vector<std::vector<CColor>>m_arExtraColorScheme;
//------------------------------------------------------------------------------------
CTheme() : m_arColorScheme(), m_arFonts(), m_arBrushes(),
m_arPens(), m_arEffects(), m_arLayouts()
{
m_sThemeName = L"Default";
}
CTheme(const CTheme& oSrc)
......@@ -44,6 +49,8 @@ namespace NSPresentationEditor
m_arBrushes = oSrc.m_arBrushes;
m_arPens = oSrc.m_arPens;
m_arEffects = oSrc.m_arEffects;
m_sThemeName = oSrc.m_sThemeName;
for (int i = 0; i < g_ThemeTextStylesCount; ++i)
m_pStyles[i] = oSrc.m_pStyles[i];
......
......@@ -106,12 +106,12 @@ namespace NSPresentationEditor
WriteString(bsString.GetBSTR(), nLen);
}
#endif // #if defined(_WIN32) || defined(_WIN64)
AVSINLINE void WriteString(std::wstring& wString)
AVSINLINE void WriteString(const std::wstring & wString)
{
size_t nLen = wString.length();
WriteString(wString.c_str(), nLen);
}
AVSINLINE void WriteString(const CString& sString)
AVSINLINE void WriteString(const CString & sString)
{
size_t nLen = (size_t)sString.GetLength();
......
......@@ -4,6 +4,7 @@
class CStylesWriter;
class CPPTUserInfo;
namespace NSPresentationEditor
{
......@@ -16,16 +17,19 @@ namespace NSPresentationEditor
CString m_strTempDirectory;
CString m_strDstFileName;
CDocument* m_pDocument;
CDocument * m_pDocument;
CPPTUserInfo* m_pUserInfo;
CImageManager m_oManager;
CShapeWriter* m_pShapeWriter;
public:
CPPTXWriter();
~CPPTXWriter();
void CreateFile(CDocument* pDocument);
void CreateFile(CDocument * pDocument);
void CreateFile(CPPTUserInfo* pUserInfo);
void CloseFile();
......@@ -34,14 +38,19 @@ namespace NSPresentationEditor
}
protected:
void WriteContentTypes();
void WriteApp(CFile& oFile);
void WritePresInfo();
void WriteAll();
void WriteBackground(CStringWriter& oWriter, CRelsGenerator& oRels, CBrush& oBackground);
void WriteElement(CStringWriter& oWriter, CRelsGenerator& oRels, IElement* pElement, CLayout* pLayout = NULL);
void WriteLayout(CLayout& oLayout, int nIndexLayout, int nStartLayout, int nIndexTheme);
void WriteSlide(int nIndexSlide);
void WriteApp (CFile& oFile);
void WriteContentTypes ();
void WritePresInfo ();
void WriteAll ();
void WriteThemes ();
void WriteSlides ();
void WriteLayout (CLayout& oLayout, int nIndexLayout, int nStartLayout, int nIndexTheme);
void WriteSlide (int nIndexSlide);
void WriteColorScheme (CStringWriter& oWriter, const std::wstring & name, const std::vector<CColor> & colors, bool extra = false);
void WriteBackground (CStringWriter& oWriter, CRelsGenerator& oRels, CBrush& oBackground);
void WriteElement (CStringWriter& oWriter, CRelsGenerator& oRels, IElement* pElement, CLayout* pLayout = NULL);
};
}
\ No newline at end of file
......@@ -9,9 +9,9 @@ namespace NSPresentationEditor
class CImageManager
{
private:
std::map<CString, CString> m_mapImages;
LONG m_lIndexNextImage;
CString m_strDstMedia;
std::map<std::wstring, std::wstring> m_mapImages;
LONG m_lIndexNextImage;
std::wstring m_strDstMedia;
public:
CImageManager() : m_mapImages(), m_lIndexNextImage(0)
......@@ -31,19 +31,21 @@ namespace NSPresentationEditor
}
public:
AVSINLINE CString GenerateImage(const CString& strInput)
AVSINLINE std::wstring GenerateImage(const std::wstring& strInput)
{
std::map<CString, CString>::iterator pPair = m_mapImages.find(strInput);
std::map<std::wstring, std::wstring>::iterator pPair = m_mapImages.find(strInput);
if (m_mapImages.end() != pPair)
{
return pPair->second;
}
if (IsNeedDownload(strInput))
return DownloadImage(strInput);
CString strExts = _T(".jpg");
int nIndexExt = strInput.ReverseFind(TCHAR('.'));
std::wstring strExts = _T(".jpg");
int nIndexExt = strInput.rfind(TCHAR('.'));
if (-1 != nIndexExt)
strExts = strInput.Mid(nIndexExt);
strExts = strInput.substr(nIndexExt);
if (strExts == _T(".tmp"))
strExts = _T(".png");
......@@ -51,27 +53,27 @@ namespace NSPresentationEditor
CString strImage = _T("");
strImage.Format(_T("image%d"), m_lIndexNextImage++);
CString strOutput = m_strDstMedia + strImage + strExts;
strImage = _T("../media/") + strImage + strExts;
m_mapImages[strInput] = strImage;
std::wstring strOutput = m_strDstMedia + string2std_string(strImage) + strExts;
strImage = _T("../media/") + strImage + std_string2string(strExts);
m_mapImages[strInput] = string2std_string(strImage);
//
if (strOutput != strInput)
CDirectory::CopyFile(strInput, strOutput, NULL, NULL);
CDirectory::CopyFile(std_string2string(strInput), std_string2string(strOutput), NULL, NULL);
return strImage;
}
AVSINLINE bool IsNeedDownload(const CString& strFile)
AVSINLINE bool IsNeedDownload(const std::wstring& strFile)
{
int n1 = strFile.Find(_T("www"));
int n2 = strFile.Find(_T("http"));
int n3 = strFile.Find(_T("ftp"));
int n1 = strFile.find(_T("www"));
int n2 = strFile.find(_T("http"));
int n3 = strFile.find(_T("ftp"));
if (((n1 >= 0) && (n1 < 10)) || ((n2 >= 0) && (n2 < 10)) || ((n3 >= 0) && (n3 < 10)))
return true;
return false;
}
AVSINLINE CString DownloadImage(const CString& strFile)
AVSINLINE std::wstring DownloadImage(const std::wstring& strFile)
{
#ifndef DISABLE_FILE_DOWNLOADER
CFileDownloader oDownloader(strFile, TRUE);
......@@ -95,7 +97,7 @@ namespace NSPresentationEditor
private:
NSPresentationEditor::CStringWriter m_oWriter;
int m_lNextRelsID;
std::map<CString, int> m_mapImages;
std::map<std::wstring, int> m_mapImages;
CImageManager* m_pManager;
public:
......@@ -218,10 +220,10 @@ namespace NSPresentationEditor
oFile.CloseFile();
}
AVSINLINE CString WriteImage(const CString& strImagePath)
AVSINLINE CString WriteImage(const std::wstring& strImagePath)
{
CString strImage = m_pManager->GenerateImage(strImagePath);
std::map<CString, int>::iterator pPair = m_mapImages.find(strImage);
std::wstring strImage = m_pManager->GenerateImage(strImagePath);
std::map<std::wstring, int>::iterator pPair = m_mapImages.find(strImage);
if (m_mapImages.end() != pPair)
{
......@@ -235,9 +237,9 @@ namespace NSPresentationEditor
CString strRid = _T("");
strRid.Format(_T("rId%d"), m_lNextRelsID++);
CString strRels = _T("<Relationship Id=\"") ;
std::wstring strRels = _T("<Relationship Id=\"") ;
strRels += strRid + _T("\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\" Target=\"");
strRels += string2std_string(strRid) + _T("\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\" Target=\"");
strRels += strImage + _T("\"/>");
m_oWriter.WriteString(strRels);
......
......@@ -34,7 +34,23 @@ public:
return _T("justLow");
return _T("l");
}
//oArrayMem.push_back(oScheme[0]);//0
//oArrayMem.push_back(oScheme[1]);//1
//oArrayMem.push_back(oScheme[2]);//2
//oArrayMem.push_back(oScheme[3]);//3
//oArrayMem.push_back(oScheme[0]);//4
//oArrayMem.push_back(oScheme[4]);//5 //accent1
//oArrayMem.push_back(oScheme[5]);//6 //accent2
//oArrayMem.push_back(oScheme[0]);//7 //accent3
//oArrayMem.push_back(oScheme[5]);//8 //accent4
//oArrayMem.push_back(oScheme[4]);//9 //accent5
//oArrayMem.push_back(oScheme[7]);//10 //accent6
//oArrayMem.push_back(oScheme[6]);//11 //hlink
//oArrayMem.push_back(oScheme[7]);//12 //folHlink
//oArrayMem.push_back(oScheme[0]);//13 //lt1
//oArrayMem.push_back(oScheme[1]);//14 //dk1
//oArrayMem.push_back(oScheme[2]);//15 //lt2
//oArrayMem.push_back(oScheme[3]);//16 //dk2
AVSINLINE static CString GetColorInScheme(const LONG& lIndex)
{
switch (lIndex)
......@@ -112,7 +128,7 @@ public:
if (pPF->fontAlign.is_init())
{
CString strProp = GetFontAlign(pPF->fontAlign.get());
oWriter.WriteString(_T(" fontAlgn=\"") + strProp + _T("\""));
oWriter.WriteString(std::wstring(L" fontAlgn=\"") + string2std_string(strProp) + _T("\""));
}
if (pPF->leftMargin.is_init())
{
......@@ -129,7 +145,7 @@ public:
if (pPF->textAlignment.is_init())
{
CString strProp = GetTextAlign(pPF->textAlignment.get());
oWriter.WriteString(_T(" algn=\"") + strProp + _T("\""));
oWriter.WriteString(std::wstring(L" algn=\"") + string2std_string(strProp) + _T("\""));
}
if (pPF->defaultTabSize.is_init())
{
......@@ -144,8 +160,14 @@ public:
{
if (pPF->hasBullet.get())
{
CString strB = _T("<a:buChar char=\"AAAAA\"/>"); //todooo
oWriter.WriteString(strB);
wchar_t bu = 0x2022;
if (pPF->bulletChar.is_init())
{
bu = pPF->bulletChar.get();
}
oWriter.WriteString(std::wstring(L"<a:buChar char=\""));
oWriter.WriteString(std::wstring(&bu, 1));
oWriter.WriteString(std::wstring(L"\"/>"));
}
else
{
......@@ -218,18 +240,18 @@ public:
if (pCF->FontBold.is_init())
{
if (pCF->FontBold.get())
oWriter.WriteString(_T(" b=\"1\""));
oWriter.WriteString(std::wstring(L" b=\"1\""));
else
oWriter.WriteString(_T(" b=\"0\""));
oWriter.WriteString(std::wstring(L" b=\"0\""));
}
if (pCF->FontItalic.is_init())
{
if (pCF->FontItalic.get())
oWriter.WriteString(_T(" i=\"1\""));
oWriter.WriteString(std::wstring(L" i=\"1\""));
else
oWriter.WriteString(_T(" i=\"0\""));
oWriter.WriteString(std::wstring(L" i=\"0\""));
}
oWriter.WriteString(_T(">"));
oWriter.WriteString(std::wstring(L">"));
if (pCF->Color.is_init())
{
......@@ -263,7 +285,7 @@ public:
}
else if (pCF->FontProperties.is_init())
{
oWriter.WriteString(_T("<a:latin typeface=\"") + pCF->FontProperties->strFontName + _T("\"/>"));
oWriter.WriteString(std::wstring(L"<a:latin typeface=\"") + pCF->FontProperties->strFontName + _T("\"/>"));
}
CString strCF2 = _T("</a:defRPr>");
......
......@@ -269,7 +269,17 @@ public:
RELEASEARRAYOBJECTS(pData);
}
void WriteStringUTF8(const std::wstring& strXml)
{
BYTE* pData = NULL;
LONG lLen = 0;
NSFile::CUtf8Converter::GetUtf8StringFromUnicode(strXml.c_str(), strXml.length(), pData, lLen, false);
WriteFile(pData, lLen);
RELEASEARRAYOBJECTS(pData);
}
protected:
FILE* m_pFile;
......
......@@ -29,7 +29,7 @@ class CFileDownloader : public CBaseThread
{
public :
CFileDownloader (CString sFileUrl, bool bDelete = true) : CBaseThread(0)
CFileDownloader (std::wstring sFileUrl, bool bDelete = true) : CBaseThread(0)
{
m_pFile = NULL;
m_sFilePath = _T("");
......@@ -44,16 +44,16 @@ public :
::fclose( m_pFile );
m_pFile = NULL;
}
if ( m_sFilePath.GetLength() > 0 && m_bDelete )
if ( m_sFilePath.length() > 0 && m_bDelete )
{
DeleteFileW( m_sFilePath.GetBuffer() );
DeleteFileW( m_sFilePath.c_str() );
m_sFilePath = _T("");
}
}
CString GetFilePath()
std::wstring GetFilePath()
{
return m_sFilePath;
}
......@@ -63,7 +63,7 @@ public :
}
protected :
unsigned int DownloadFile(CString sFileUrl)
unsigned int DownloadFile(std::wstring sFileUrl)
{
// Проверяем состояние соединения
if ( FALSE == InternetGetConnectedState ( 0, 0 ) )
......@@ -90,7 +90,7 @@ protected :
// Заголовок запроса ( пока содержит 0 байт ( необходимо для проверки ) )
CString sHTTPHdr = _T ("Range: bytes=0-0");
// Открываем ссылку для проверки на ее существование, а также на возможность чтения частями
HINTERNET hInternetOpenURL = InternetOpenUrl ( hInternetSession, sFileUrl, sHTTPHdr, -1, INTERNET_FLAG_RESYNCHRONIZE, 0 );
HINTERNET hInternetOpenURL = InternetOpenUrl ( hInternetSession, sFileUrl.c_str(), sHTTPHdr, -1, INTERNET_FLAG_RESYNCHRONIZE, 0 );
if ( NULL != hInternetOpenURL )
{
// Открытие произошло, проверяем ответ
......@@ -173,7 +173,7 @@ protected :
return S_OK;
}
DWORD DownloadFilePath ( HINTERNET hInternet, LPBYTE pBuffer, LONGLONG nStartByte, LONGLONG nEndByte, CString sFileURL )
DWORD DownloadFilePath ( HINTERNET hInternet, LPBYTE pBuffer, LONGLONG nStartByte, LONGLONG nEndByte, std::wstring sFileURL )
{
// Неоткрытая сессия
if ( NULL == hInternet )
......@@ -186,7 +186,7 @@ protected :
// Заголовок запроса ( содержит nEndByte - nStartByte байт )
CString sHTTPHdr = _T (""); sHTTPHdr.Format ( _T ("Range: bytes=%lld-%lld"), nStartByte, nEndByte );
// Открываем ссылку для закачки
HINTERNET hInternetOpenURL = InternetOpenUrl ( hInternet, sFileURL, sHTTPHdr, -1, INTERNET_FLAG_RESYNCHRONIZE, 0 );
HINTERNET hInternetOpenURL = InternetOpenUrl ( hInternet, sFileURL.c_str(), sHTTPHdr, -1, INTERNET_FLAG_RESYNCHRONIZE, 0 );
if ( NULL == hInternetOpenURL )
return -1;
// Открытие произошло, проверяем ответ
......@@ -329,7 +329,7 @@ protected :
return nFileSize;
}
HRESULT DownloadFileAll(CString sFileURL, CString strFileOutput)
HRESULT DownloadFileAll(std::wstring sFileURL, std::wstring strFileOutput)
{
if ( m_pFile )
{
......@@ -337,7 +337,7 @@ protected :
m_pFile = NULL;
}
// Скачиваем файл
return URLDownloadToFile (NULL, sFileURL, strFileOutput, NULL, NULL);
return URLDownloadToFile (NULL, sFileURL.c_str(), strFileOutput.c_str(), NULL, NULL);
}
public:
......@@ -357,12 +357,12 @@ public:
protected :
FILE *m_pFile; // Хэндл на временный файл
CString m_sFilePath; // Путь к сохраненному файлу на диске
CString m_sFileUrl; // Ссылка на скачивание файла
FILE *m_pFile; // Хэндл на временный файл
std::wstring m_sFilePath; // Путь к сохраненному файлу на диске
std::wstring m_sFileUrl; // Ссылка на скачивание файла
bool m_bComplete; // Закачался файл или нет
bool m_bDelete; // Удалять ли файл в деструкторе
bool m_bComplete; // Закачался файл или нет
bool m_bDelete; // Удалять ли файл в деструкторе
};
#else
......
......@@ -18,7 +18,7 @@ namespace SerializeCommon
CString DownloadImage(const CString& strFile)
{
#ifndef DISABLE_FILE_DOWNLOADER
CFileDownloader oDownloader(strFile, false);
CFileDownloader oDownloader(string2std_string(strFile), false);
oDownloader.Start( 1 );
while ( oDownloader.IsRunned() )
{
......@@ -27,7 +27,7 @@ namespace SerializeCommon
CString strFileName;
if ( oDownloader.IsFileDownloaded() )
{
strFileName = oDownloader.GetFilePath();
strFileName = std_string2string(oDownloader.GetFilePath());
}
return strFileName;
#else
......
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