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

PPTFormat расширеные настройки текста, языки, rtl

унифицированный lcid2string
CString на std

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@65436 954022d7-b5bf-4e40-9824-e11837661b57
parent 66fefdad
......@@ -46,17 +46,16 @@ public:
class CCurrentUser
{
public:
bool m_bIsEncrypt;
DWORD m_nOffsetToCurrentEdit;
bool m_bIsEncrypt;
DWORD m_nOffsetToCurrentEdit;
CStringW m_strName;
std::wstring m_strName;
public:
CCurrentUser()
{
m_bIsEncrypt = false;
m_nOffsetToCurrentEdit = 0;
m_strName = _T("");
m_bIsEncrypt = false;
m_nOffsetToCurrentEdit = 0;
}
~CCurrentUser()
{
......@@ -72,15 +71,14 @@ public:
void FromAtom(CRecordCurrentUserAtom* pAtom)
{
m_bIsEncrypt = (NO_ENCRYPT == pAtom->m_nToken);
m_nOffsetToCurrentEdit = pAtom->m_nOffsetToCurEdit;
m_strName = pAtom->m_strUNICODEUserName;
m_bIsEncrypt = (NO_ENCRYPT == pAtom->m_nToken);
m_nOffsetToCurrentEdit = pAtom->m_nOffsetToCurEdit;
m_strName = pAtom->m_strUNICODEUserName;
}
CString ToString()
{
CString str = _T("<CurrentUser Name='") + (CString)m_strName + _T("' />");
return str;
return L"";
}
};
......
......@@ -288,6 +288,20 @@ void CPPTUserInfo::FromDocument()
if (0 != oStyles.size())
m_oDefaultTextStyle.SetStyles((NSPresentationEditor::CTextStyles*)oStyles[0]);
std::vector<CRecordTextSIExceptionAtom*> oSI;
oArrayInfo[0]->GetRecordsByType(&oSI, false, false);
if (0 != oSI.size())
{
if (oSI[0]->m_oSIRun.bLang)
m_wLanguage = oSI[0]->m_oSIRun.Lang;
if (oSI[0]->m_oSIRun.bBidi)
m_bBidi = oSI[0]->m_oSIRun.Bidi;
m_oDefaultTextStyle.SetLanguage(m_wLanguage);
}
}
LONG lOriginWidth = oArrayDoc[0]->m_oSlideSize.X;
......@@ -861,9 +875,9 @@ void CPPTUserInfo::LoadNoMainMaster(DWORD dwMasterID, const LONG& lOriginWidth,
if (0 == oArraySlideAtoms.size())
return;
bool bMasterColorScheme = false;//oArraySlideAtoms[0]->m_bMasterScheme;
bool bMasterBackGround = false;//oArraySlideAtoms[0]->m_bMasterBackground;
bool bMasterObjects = false;//oArraySlideAtoms[0]->m_bMasterObjects;
bool bMasterColorScheme = oArraySlideAtoms[0]->m_bMasterScheme;
bool bMasterBackGround = oArraySlideAtoms[0]->m_bMasterBackground;
bool bMasterObjects = oArraySlideAtoms[0]->m_bMasterObjects;
DWORD dwID = (DWORD)oArraySlideAtoms[0]->m_nMasterIDRef;
......@@ -1345,31 +1359,18 @@ void CPPTUserInfo::CreateDefaultStyle(NSPresentationEditor::CTextStyles& pStyle,
NSPresentationEditor::CTextPFRun* pPF = &pStyle.m_pLevels[i]->m_oPFRun;
NSPresentationEditor::CTextCFRun* pCF = &pStyle.m_pLevels[i]->m_oCFRun;
//pPF->textAlignment = (WORD)0;
//pPF->leftMargin = (LONG)0;
//pPF->indent = (LONG)0;
//pPF->fontAlign = (WORD)0;
pPF->wrapFlags = (WORD)0x02;
pPF->textDirection = (WORD)0;
//pPF->defaultTabSize = (LONG)0;
//pPF->lineSpacing = (LONG)100;
//pPF->spaceBefore = (LONG)0;
//pPF->spaceAfter = (LONG)0;
pCF->Language = m_wLanguage;
//---------------------------------------- ?????????
pCF->FontBold = false;
pCF->FontItalic = false;
pCF->FontUnderline = false;
pCF->FontStrikeout = false;
pCF->Size = 18;
pCF->BaseLineOffset = (double)0;
pCF->Cap = (WORD)0;
pCF->BaseLineOffset = 0.;
//-------------------------------------------
pCF->FontProperties = new NSPresentationEditor::CFontProperties();
pCF->FontProperties->SetFont(pTheme->m_arFonts[0]);
//pCF->Color = new NSPresentationEditor::CColor();
}
}
......@@ -65,6 +65,9 @@ public:
std::vector<CColor> m_oSchemeColors;
nullable<WORD> m_wLanguage; // ()
nullable<bool> m_bBidi; // bi-direction
public:
CPPTUserInfo();
......
......@@ -804,7 +804,7 @@ public:
namespace NSPresentationEditor
{
static void ConvertPPTTextToEditorStructure(std::vector<CTextPFRun_ppt>& oArrayPF, std::vector<CTextCFRun_ppt>& oArrayCF,
CString& strText, NSPresentationEditor::CTextAttributesEx& oAttributes)
std::wstring& strText, NSPresentationEditor::CTextAttributesEx& oAttributes)
{
int nCountPFs = (int)oArrayPF.size();
int nCountCFs = (int)oArrayCF.size();
......@@ -814,7 +814,7 @@ namespace NSPresentationEditor
int nCurrentCF = 0;
int nOffsetCF = 0;
int nIndexLast = strText.GetLength();
int nIndexLast = strText.length();
int nIndexText = 0;
for (int nIndexPF = 0; nIndexPF < nCountPFs; ++nIndexPF)
......@@ -841,7 +841,7 @@ namespace NSPresentationEditor
NSPresentationEditor::CSpan oSpan;
oSpan.m_oRun = oArrayCF[nCurrentCF].m_oRun;
oSpan.m_strText = strText.Mid(nIndexText, nCountInPF);
oSpan.m_strText = strText.substr(nIndexText, nCountInPF);
pPar->m_arSpans.push_back(oSpan);
......@@ -854,7 +854,7 @@ namespace NSPresentationEditor
NSPresentationEditor::CSpan oSpan;
oSpan.m_oRun = oArrayCF[nCurrentCF].m_oRun;
oSpan.m_strText = strText.Mid(nIndexText, nCountAdd);
oSpan.m_strText = strText.substr(nIndexText, nCountAdd);
pPar->m_arSpans.push_back(oSpan);
......@@ -868,7 +868,7 @@ namespace NSPresentationEditor
NSPresentationEditor::CSpan oSpan;
oSpan.m_oRun = oArrayCF[nCurrentCF].m_oRun;
oSpan.m_strText = strText.Mid(nIndexText, nCountAdd);
oSpan.m_strText = strText.substr(nIndexText, nCountAdd);
pPar->m_arSpans.push_back(oSpan);
......
......@@ -19,7 +19,7 @@ public:
virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
{
m_oHeader = oHeader;
m_strText = StreamUtils::ReadCStringW(pStream, m_oHeader.RecLen / 2);
m_strText = StreamUtils::ReadStringW(pStream, m_oHeader.RecLen / 2);
}
virtual CString ToString()
{
......
......@@ -18,8 +18,8 @@ public:
BYTE m_nMajorVersion; // must be 0x03
BYTE m_nMinorVersion; // must be 0x00
CStringA m_strANSIUserName;
CStringW m_strUNICODEUserName;
std::string m_strANSIUserName;
std::wstring m_strUNICODEUserName;
DWORD m_nRelVersion; // 0x00000008 or 0x00000009
......@@ -64,41 +64,16 @@ public:
StreamUtils::StreamSkip(2, pStream);
m_strANSIUserName = StreamUtils::ReadCStringA(pStream, m_nLenUserName);
m_strANSIUserName = StreamUtils::ReadStringA(pStream, m_nLenUserName);
m_nRelVersion = StreamUtils::ReadDWORD(pStream);
m_strUNICODEUserName = StreamUtils::ReadCStringW(pStream, m_nLenUserName );
m_strUNICODEUserName = StreamUtils::ReadStringW(pStream, m_nLenUserName );
}
virtual CString ToString()
{
XmlUtils::CXmlWriter oWriter;
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.WriteNodeEnd(strName, TRUE, FALSE);
CDirectory::WriteValueToNode(_T("Size"), m_nSize, &oWriter);
CDirectory::WriteValueToNode(_T("Token"), m_nToken, &oWriter);
CDirectory::WriteValueToNode(_T("OffsetToCurEdit"), m_nOffsetToCurEdit, &oWriter);
CString UserName = m_strANSIUserName;
if (UserName.GetLength() < 1)
UserName = m_strUNICODEUserName;
CDirectory::WriteValueToNode(_T("Name"), UserName, &oWriter);
CDirectory::WriteValueToNode(_T("RelVersion"), m_nRelVersion, &oWriter);
oWriter.WriteNodeEnd(strName);
return oWriter.GetXmlString();
return L"";
}
bool IsSupported()
......
......@@ -58,34 +58,6 @@ public:
}
virtual CString ToString()
{
XmlUtils::CXmlWriter oWriter;
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.WriteNodeEnd(strName, TRUE, FALSE);
oWriter.WriteString(m_oSlideSize.ToString());
oWriter.WriteString(m_oNotesSize.ToString());
oWriter.WriteString(m_oServerZoom.ToString());
CDirectory::WriteValueToNode(_T("NotesMasterPersistIDRef"), (DWORD)m_nNotesMasterPersistIDRef, &oWriter);
CDirectory::WriteValueToNode(_T("HandoutMasterPersistIDRef"), (DWORD)m_nHandoutMasterPersistIDRef, &oWriter);
CDirectory::WriteValueToNode(_T("FirstSlideNum"), (DWORD)m_nFirstSlideNum, &oWriter);
CDirectory::WriteValueToNode(_T("SlideSizeType"), (DWORD)m_nSlideSizeType, &oWriter);
CDirectory::WriteValueToNode(_T("SaveWithFonts"), (DWORD)m_bSaveWithFonts, &oWriter);
CDirectory::WriteValueToNode(_T("OmitTitlePlace"), (DWORD)m_bOmitTitlePlace, &oWriter);
CDirectory::WriteValueToNode(_T("RightToLeft"), (DWORD)m_bRightToLeft, &oWriter);
CDirectory::WriteValueToNode(_T("ShowComments"), (DWORD)m_bShowComments, &oWriter);
oWriter.WriteNodeEnd(strName);
return oWriter.GetXmlString();
return L"";
}
};
\ No newline at end of file
......@@ -97,12 +97,12 @@ public:
if (NULL != pChars)
{
m_arTextPlaceHolders[nCurrentSlide][nCurrentTextHeader].m_strText = pChars->m_strText;
lSymbolCount = (DWORD)pChars->m_strText.GetLength();
lSymbolCount = (DWORD)pChars->m_strText.length();
}
else if (NULL != pBytes)
{
m_arTextPlaceHolders[nCurrentSlide][nCurrentTextHeader].m_strText = (CStringW)pBytes->m_strText;
lSymbolCount = (DWORD)pBytes->m_strText.GetLength();
m_arTextPlaceHolders[nCurrentSlide][nCurrentTextHeader].m_strText = pBytes->m_strText;
lSymbolCount = (DWORD)pBytes->m_strText.length();
}
if (RECORD_TYPE_STYLE_TEXTPROP_ATOM == oRec.RecType)
......
......@@ -4,7 +4,7 @@
class CRecordTextBytesAtom : public CUnknownRecord
{
public:
CString m_strText;
std::wstring m_strText;
public:
......@@ -19,26 +19,35 @@ public:
virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
{
m_oHeader = oHeader;
//UTF-16 Unicode character whose high byte is 0x00.
unsigned short *pUTF16 = new unsigned short[m_oHeader.RecLen];
unsigned char *pUTF16_low = new unsigned char [m_oHeader.RecLen];
if (pUTF16 && pUTF16_low)
{
pStream->read(pUTF16_low, m_oHeader.RecLen);
for (int i = 0 ; i < m_oHeader.RecLen; i++)
{
pUTF16[i] = pUTF16_low[i];
}
m_strText = NSFile::CUtf8Converter::GetWStringFromUTF16(pUTF16, m_oHeader.RecLen);
}
std::string tmpStrTextA = string2std_string(StreamUtils::ReadCStringA(pStream, m_oHeader.RecLen));
RELEASEARRAYOBJECTS(pUTF16_low);
RELEASEARRAYOBJECTS(pUTF16);
std::wstring tmpStrTextW (tmpStrTextA.begin(), tmpStrTextA.end());
//std::string tmpStrTextA = string2std_string(StreamUtils::ReadCStringA(pStream, m_oHeader.RecLen));
m_strText = std_string2string(tmpStrTextW);
//std::wstring tmpStrTextW (tmpStrTextA.begin(), tmpStrTextA.end());
//m_strText = std_string2string(tmpStrTextW);
}
virtual CString ToString()
{
XmlUtils::CXmlWriter oWriter;
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("text"), m_strText);
oWriter.WriteNodeEnd(strName, TRUE);
return oWriter.GetXmlString();
return L"";
}
};
......@@ -4,7 +4,7 @@
class CRecordTextCharsAtom : public CUnknownRecord
{
public:
CStringW m_strText;
std::wstring m_strText;
public:
......@@ -19,21 +19,10 @@ public:
virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
{
m_oHeader = oHeader;
m_strText = StreamUtils::ReadCStringW(pStream, m_oHeader.RecLen / 2);
m_strText = StreamUtils::ReadStringW(pStream, m_oHeader.RecLen / 2);
}
virtual CString ToString()
{
XmlUtils::CXmlWriter oWriter;
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("text"), (CString)m_strText);
oWriter.WriteNodeEnd(strName, TRUE);
return oWriter.GetXmlString();
return L"";
}
};
\ No newline at end of file
......@@ -17,8 +17,8 @@ public:
std::vector<NSPresentationEditor::CTextRange> m_arRanges;
CStringW m_strText;
DWORD m_nTextType;
std::wstring m_strText;
DWORD m_nTextType;
public:
CTextFullSettings() : m_arRanges()
......@@ -28,7 +28,7 @@ public:
m_pTextRuler = NULL;
m_nTextType = 0xFFFFFFFF;
m_strText.Empty();
m_strText.clear();
}
CTextFullSettings(const CTextFullSettings& oSrc)
{
......@@ -53,7 +53,7 @@ public:
m_pTextRuler = NULL;
}
CString ApplyProperties(CTextAttributesEx* pTextAttributes)
std::wstring ApplyProperties(CTextAttributesEx* pTextAttributes)
{
if (NULL == pTextAttributes)
return m_strText;
......
......@@ -6,13 +6,11 @@ class CRecordTextSpecInfoAtom : public CUnknownRecord
public:
// ,
//
LONG m_lOffsetInStream;
DWORD m_lCount;
LONG m_lOffsetInStream;
DWORD m_lCount;
private:
std::vector<NSPresentationEditor::CTextSIRun> m_arrSIs;
std::vector<NSPresentationEditor::CTextSIRun> m_arrSIs;
public:
CRecordTextSpecInfoAtom()
{
......@@ -27,8 +25,6 @@ public:
void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
{
//return CUnknownRecord::ReadFromStream(oHeader, pStream);
m_oHeader = oHeader;
StreamUtils::StreamPosition(m_lOffsetInStream, pStream);
......@@ -58,8 +54,30 @@ public:
StreamUtils::StreamSeek(m_lOffsetInStream + m_oHeader.RecLen, pStream);
}
void ApplyProperties(CTextAttributesEx* pTextAttributes)
void ApplyProperties(CTextAttributesEx* pText)
{
if (m_arrSIs.size() < 1) return;
int pos_text = 0, pos_si = 0;
int ind = 0;
for (int i = 0; i < pText->m_arParagraphs.size(); i++)
{
if (ind > m_arrSIs.size()) break;
for (int j = 0 ; j < pText->m_arParagraphs[i].m_arSpans.size(); j++)
{
if (pos_text + pText->m_arParagraphs[i].m_arSpans[j].m_strText.length() > pos_si + m_arrSIs[ind].lCount )
{
pos_si += m_arrSIs[ind].lCount;
ind++;
}
if (ind > m_arrSIs.size()) break;
if (m_arrSIs[ind].bLang)
pText->m_arParagraphs[i].m_arSpans[j].m_oRun.Language = m_arrSIs[ind].Lang;
pos_text += pText->m_arParagraphs[i].m_arSpans[j].m_strText.length() ;
}
}
}
virtual CString ToString()
......
......@@ -9,34 +9,45 @@ 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
{C739151F-5384-41DF-A1A6-F089E2C1AD56} = {C739151F-5384-41DF-A1A6-F089E2C1AD56}
{21663823-DE45-479B-91D0-B4FEF4916EF0} = {21663823-DE45-479B-91D0-B4FEF4916EF0}
{DC24710E-8DF2-4A7A-B7C3-2313E294143C} = {DC24710E-8DF2-4A7A-B7C3-2313E294143C}
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2} = {37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}
{A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0}
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B} = {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASCHTMLRenderer", "..\..\ASCHTMLRenderer\ASCHTMLRendererLib.vcproj", "{DC24710E-8DF2-4A7A-B7C3-2313E294143C}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "graphics", "..\..\DesktopEditor\graphics\graphics_vs2005.vcproj", "{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}"
ProjectSection(ProjectDependencies) = postProject
{43A0E60E-5C4A-4C09-A29B-7683F503BBD7} = {43A0E60E-5C4A-4C09-A29B-7683F503BBD7}
{C739151F-5384-41DF-A1A6-F089E2C1AD56} = {C739151F-5384-41DF-A1A6-F089E2C1AD56}
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2} = {37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}
{764C3A2D-FB0F-428E-B1C7-62D1DD2CE239} = {764C3A2D-FB0F-428E-B1C7-62D1DD2CE239}
{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}
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1} = {EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}
{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}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "graphics", "..\..\DesktopEditor\graphics\graphics_vs2005.vcproj", "{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "agg2d", "..\..\DesktopEditor\agg-2.4\agg_vs2005.vcproj", "{617F9069-5E37-4B80-9A3A-E77AFC4CC7AD}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cximage", "..\..\DesktopEditor\cximage\CxImage\cximage_vs2005.vcproj", "{BC52A07C-A797-423D-8C4F-8678805BBB36}"
ProjectSection(ProjectDependencies) = postProject
{818753F2-DBB9-4D3B-898A-A604309BE470} = {818753F2-DBB9-4D3B-898A-A604309BE470}
{FFDA5DA1-BB65-4695-B678-BE59B4A1355D} = {FFDA5DA1-BB65-4695-B678-BE59B4A1355D}
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1} = {EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}
{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}
{764C3A2D-FB0F-428E-B1C7-62D1DD2CE239} = {764C3A2D-FB0F-428E-B1C7-62D1DD2CE239}
{43A0E60E-5C4A-4C09-A29B-7683F503BBD7} = {43A0E60E-5C4A-4C09-A29B-7683F503BBD7}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jpeg", "..\..\DesktopEditor\cximage\jpeg\Jpeg_vs2005.vcproj", "{818753F2-DBB9-4D3B-898A-A604309BE470}"
EndProject
......@@ -65,12 +76,14 @@ 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
{21663823-DE45-479B-91D0-B4FEF4916EF0} = {21663823-DE45-479B-91D0-B4FEF4916EF0}
{A0E976CE-133D-466C-AF0E-9DD62715121F} = {A0E976CE-133D-466C-AF0E-9DD62715121F}
{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}
{C739151F-5384-41DF-A1A6-F089E2C1AD56} = {C739151F-5384-41DF-A1A6-F089E2C1AD56}
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2} = {37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540} = {9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}
{21663823-DE45-479B-91D0-B4FEF4916EF0} = {21663823-DE45-479B-91D0-B4FEF4916EF0}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PptFormatTest", "..\..\Test\Applications\DocxFormatTests\PptFormatTest\win32\PptFormatTest.vcproj", "{0F49D5D1-A8D3-4F97-8BC1-E2F65BB00C10}"
......@@ -146,22 +159,6 @@ Global
{36636678-AE25-4BE6-9A34-2561D1BCF302}.Unicode Release|Win32.Build.0 = Release|Win32
{36636678-AE25-4BE6-9A34-2561D1BCF302}.Unicode Release|x64.ActiveCfg = Release|x64
{36636678-AE25-4BE6-9A34-2561D1BCF302}.Unicode Release|x64.Build.0 = Release|x64
{DC24710E-8DF2-4A7A-B7C3-2313E294143C}.Debug|Win32.ActiveCfg = Debug|Win32
{DC24710E-8DF2-4A7A-B7C3-2313E294143C}.Debug|Win32.Build.0 = Debug|Win32
{DC24710E-8DF2-4A7A-B7C3-2313E294143C}.Debug|x64.ActiveCfg = Debug|x64
{DC24710E-8DF2-4A7A-B7C3-2313E294143C}.Debug|x64.Build.0 = Debug|x64
{DC24710E-8DF2-4A7A-B7C3-2313E294143C}.Release|Win32.ActiveCfg = Release|Win32
{DC24710E-8DF2-4A7A-B7C3-2313E294143C}.Release|Win32.Build.0 = Release|Win32
{DC24710E-8DF2-4A7A-B7C3-2313E294143C}.Release|x64.ActiveCfg = Release|x64
{DC24710E-8DF2-4A7A-B7C3-2313E294143C}.Release|x64.Build.0 = Release|x64
{DC24710E-8DF2-4A7A-B7C3-2313E294143C}.Unicode Debug|Win32.ActiveCfg = Debug|Win32
{DC24710E-8DF2-4A7A-B7C3-2313E294143C}.Unicode Debug|Win32.Build.0 = Debug|Win32
{DC24710E-8DF2-4A7A-B7C3-2313E294143C}.Unicode Debug|x64.ActiveCfg = Debug|x64
{DC24710E-8DF2-4A7A-B7C3-2313E294143C}.Unicode Debug|x64.Build.0 = Debug|x64
{DC24710E-8DF2-4A7A-B7C3-2313E294143C}.Unicode Release|Win32.ActiveCfg = Release|Win32
{DC24710E-8DF2-4A7A-B7C3-2313E294143C}.Unicode Release|Win32.Build.0 = Release|Win32
{DC24710E-8DF2-4A7A-B7C3-2313E294143C}.Unicode Release|x64.ActiveCfg = Release|x64
{DC24710E-8DF2-4A7A-B7C3-2313E294143C}.Unicode Release|x64.Build.0 = Release|x64
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}.Debug|Win32.ActiveCfg = Debug|Win32
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}.Debug|Win32.Build.0 = Debug|Win32
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}.Debug|x64.ActiveCfg = Debug|x64
......
......@@ -3446,6 +3446,10 @@
<Filter
Name="Editor"
>
<File
RelativePath="..\..\HtmlRenderer\src\ASCSVGWriter.cpp"
>
</File>
<File
RelativePath="..\Editor\BinaryFileReaderWriter.h"
>
......
......@@ -13,13 +13,22 @@
#include "../../Common/ASCUtils.h"
#include "./XmlWriter.h"
#include "../../DesktopEditor/graphics/IRenderer.h"
#include "../../DesktopEditor/graphics/structures.h"
namespace NSPresentationEditor
{
static void ReplaceAll(std::wstring & str, const std::wstring& from, const std::wstring& to)
{
size_t start_pos = 0;
while((start_pos = str.find(from, start_pos)) != std::wstring::npos)
{
str.replace(start_pos, from.length(), to);
start_pos += to.length();
}
}
class CExFilesInfo
{
public:
......@@ -212,7 +221,16 @@ namespace NSPresentationEditor
}
};
static void CorrectXmlString(CString& strText)
#if defined(_WIN32) || defined(_WIN64)
static void CorrectXmlString2(CString & strText)
{
strText.Replace(L"&apos;", L"'");
strText.Replace(L"&lt;", L"<");
strText.Replace(L"&gt;", L">");
strText.Replace(L"&quot;", L"\"");
strText.Replace(L"&amp;", L"&");
}
static void CorrectXmlString(CString & strText)
{
strText.Replace(L"&", L"&amp;");
strText.Replace(L"'", L"&apos;");
......@@ -220,14 +238,22 @@ namespace NSPresentationEditor
strText.Replace(L">", L"&gt;");
strText.Replace(L"\"", L"&quot;");
}
static void CorrectXmlString2(CString& strText)
#endif
static void CorrectXmlString2(std::wstring & strText)
{
strText.Replace(L"&apos;", L"'");
strText.Replace(L"&lt;", L"<");
strText.Replace(L"&gt;", L">");
strText.Replace(L"&quot;", L"\"");
strText.Replace(L"&amp;", L"&");
ReplaceAll(strText, L"&apos;", L"'");
ReplaceAll(strText, L"&lt;", L"<");
ReplaceAll(strText, L"&gt;", L">");
ReplaceAll(strText, L"&quot;", L"\"");
ReplaceAll(strText, L"&amp;", L"&");
}
static void CorrectXmlString(std::wstring & strText)
{
ReplaceAll(strText, L"&", L"&amp;");
ReplaceAll(strText, L"'", L"&apos;");
ReplaceAll(strText, L"<", L"&lt;");
ReplaceAll(strText, L">", L"&gt;");
ReplaceAll(strText, L"\"", L"&quot;");
}
static inline CString BoolToString(bool bValue)
{
......
......@@ -610,23 +610,24 @@ namespace NSPresentationEditor
if (pThemeStyles->m_pLevels[nIndexLevel]->m_oCFRun.Color->m_lSchemeIndex == -1)
continue;
LONG lIndexSchemeT = pThemeStyles->m_pLevels[nIndexLevel]->m_oCFRun.Color->m_lSchemeIndex;
if (!pShape->m_oShape.m_oText.m_oStyles.m_pLevels[0].is_init())
pShape->m_oShape.m_oText.m_oStyles.m_pLevels[0] = new CTextStyleLevel();
if (!pShape->m_oShape.m_oText.m_oStyles.m_pLevels[0]->m_oCFRun.Color.is_init())
pShape->m_oShape.m_oText.m_oStyles.m_pLevels[0]->m_oCFRun.Color = new CColor();
if (pShape->m_oShape.m_oText.m_oStyles.m_pLevels[0]->m_oCFRun.Color->m_lSchemeIndex != -1)
continue;
pShape->m_oShape.m_oText.m_oStyles.m_pLevels[0]->m_oCFRun.Color->m_lSchemeIndex = lIndexSchemeT;
pShape->m_oShape.m_oText.m_oStyles.m_pLevels[0]->m_oCFRun.Color->R = pLayout->m_arColorScheme[lIndexSchemeT].R;
pShape->m_oShape.m_oText.m_oStyles.m_pLevels[0]->m_oCFRun.Color->G = pLayout->m_arColorScheme[lIndexSchemeT].G;
pShape->m_oShape.m_oText.m_oStyles.m_pLevels[0]->m_oCFRun.Color->B = pLayout->m_arColorScheme[lIndexSchemeT].B;
bIsPlaceholderSetUp = true;
if (pShape->m_oShape.m_oText.m_oStyles.m_pLevels[0].is_init())
{
if (pShape->m_oShape.m_oText.m_oStyles.m_pLevels[0]->m_oCFRun.Color.is_init())
{
if (pShape->m_oShape.m_oText.m_oStyles.m_pLevels[0]->m_oCFRun.Color->m_lSchemeIndex != -1)
continue;
LONG lIndexSchemeT = pThemeStyles->m_pLevels[nIndexLevel]->m_oCFRun.Color->m_lSchemeIndex;
pShape->m_oShape.m_oText.m_oStyles.m_pLevels[0]->m_oCFRun.Color->m_lSchemeIndex = -1;
pShape->m_oShape.m_oText.m_oStyles.m_pLevels[0]->m_oCFRun.Color->R = pLayout->m_arColorScheme[lIndexSchemeT].R;
pShape->m_oShape.m_oText.m_oStyles.m_pLevels[0]->m_oCFRun.Color->G = pLayout->m_arColorScheme[lIndexSchemeT].G;
pShape->m_oShape.m_oText.m_oStyles.m_pLevels[0]->m_oCFRun.Color->B = pLayout->m_arColorScheme[lIndexSchemeT].B;
bIsPlaceholderSetUp = true;
}
}
}
}
......@@ -665,7 +666,6 @@ namespace NSPresentationEditor
pElement->m_pLayout = pLayout;
pElement->m_oMetric = m_oInfo;
//pElement->NormalizeCoords(dScaleX, dScaleY);
pElement->SetupProperties(pSlide, pTheme, pLayout);
}
......
......@@ -7,6 +7,7 @@
//#include "../../ASCOfficePPTXFile/PPTXFormat/Logic/rectdef.h"
#include "../../DesktopEditor/graphics/aggplustypes.h"
#endif
namespace NSPresentationEditor
{
class CTheme;
......@@ -30,7 +31,6 @@ namespace NSPresentationEditor
// ( )
bool m_bVertical;
bool m_bRightToLeft;
int m_lWrapMode; // 0 - square, default; 1 - none wrap
......@@ -43,7 +43,7 @@ namespace NSPresentationEditor
//
bool m_bIsSlideFontRef;
int m_lFontRef;
public:
CTextAttributesEx() :
m_oAttributes(),
......@@ -65,7 +65,6 @@ namespace NSPresentationEditor
m_oBounds.bottom = 50;
m_bVertical = false;
m_bRightToLeft = false;
m_lWrapMode = 0;
m_lTextMasterType = -1;
......@@ -83,7 +82,6 @@ namespace NSPresentationEditor
m_oAttributes = oSrc.m_oAttributes;
m_bVertical = oSrc.m_bVertical;
m_bRightToLeft = oSrc.m_bRightToLeft;
m_lWrapMode = oSrc.m_lWrapMode;
m_arParagraphs.insert(m_arParagraphs.end(), oSrc.m_arParagraphs.begin(), oSrc.m_arParagraphs.end());
......@@ -123,70 +121,7 @@ namespace NSPresentationEditor
void RecalcParagraphsPPT(CTheme* pTheme = NULL);
void ApplyRuler (CTheme* pTheme);
void ApplyRuler (CTextPFRun* pPar, WORD lIndentLevel)
{
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;
};
}
void ApplyRuler (CTextPFRun* pPar, WORD lIndentLevel);
bool IsEmptyText()
{
return (0 == m_arParagraphs.size()) ? true : false;
......
......@@ -132,6 +132,7 @@ namespace NSPresentationEditor
NSCommon::nullable_base<WORD> Cap; // 0 - none, 1 - TEXT, 2 - text
NSCommon::nullable_base<CFontProperties> FontProperties;
NSCommon::nullable_base<WORD> Language;
public:
......@@ -166,6 +167,8 @@ namespace NSPresentationEditor
Cap = oSrc.Cap;
Language = oSrc.Language;
return *this;
}
~CTextCFRun()
......@@ -194,6 +197,8 @@ namespace NSPresentationEditor
if (!Cap.is_init()) Cap = oSrc.Cap;
if (!FontProperties.is_init()) FontProperties = oSrc.FontProperties;
if (!Language.is_init()) Language = oSrc.Language;
}
AVSINLINE void ApplyAfter(const CTextCFRun& oSrc)
{
......@@ -227,6 +232,8 @@ namespace NSPresentationEditor
if (!bTypefaceSetUp)
Typeface.reset();
}
if (oSrc.Language.is_init())
Language = oSrc.Language;
}
CString ToString(LONG lCount)
......@@ -452,76 +459,7 @@ namespace NSPresentationEditor
CString ToString(LONG lCount)
{
XmlUtils::CXmlWriter oWriter;
oWriter.WriteNodeBegin(_T("Paragraph"), true);
//oWriter.WriteAttribute(_T("type"), CDirectory::ToString(TextType));
//oWriter.WriteAttribute(_T("level"), CDirectory::ToString(Level));
oWriter.WriteAttribute(_T("count"), CDirectory::ToString(lCount));
oWriter.WriteAttribute(_T("oneline"), bIsOneLine ? _T("1") : _T("0"));
oWriter.WriteNodeEnd(_T("Paragraph"), true, false);
CString strXml = _T("");
if (hasBullet.is_init() && (true == hasBullet.get()))
{
strXml += (_T("<bulletflag>255</bulletflag>"));
if (!bulletChar.is_init())
{
CString temp = _T("<bulletchar>");
temp += _T('\x2022');
temp += _T("</bulletchar>");
strXml += temp;
}
}
if (bulletChar.is_init())
{
CString temp = _T("<bulletchar>");
temp += _T('\x2022');
temp += _T("</bulletchar>");
strXml += temp;
}
strXml += ToNode(bulletFontRef, _T("bulletfontref"));
strXml += ToNode(bulletSize, _T("bulletsize"));
strXml += ToNode(bulletColor, _T("bulletcolor"));
strXml += ToNode(textAlignment, _T("textalignment"));
strXml += ToNode(lineSpacing, _T("linespacing"));
strXml += ToNode(spaceBefore, _T("spacebefore"));
strXml += ToNode(spaceAfter, _T("spaceafter"));
strXml += ToNode(leftMargin, _T("leftmargin"));
strXml += ToNode(indent, _T("indent"));
strXml += ToNode(defaultTabSize, _T("defaulttabsize"));
strXml += ToNode(textDirection, _T("textdirectional"));
strXml += ToNode(fontAlign, _T("fontalign"));
if (wrapFlags.is_init())
{
int lIsWord = 1; // characters
if (0x02 == (0x02 & wrapFlags.get()))
{
lIsWord = 0; // words
}
strXml += (_T("<wrapflags>") + XmlUtils::IntToString(lIsWord) + _T("</wrapflags>"));
}
size_t nCount = tabStops.size();
if (0 < nCount)
{
strXml += _T("<tabstops>");
for (size_t i = 0; i < nCount; ++i)
{
strXml += (_T("<tabstop>") + XmlUtils::UIntToString((size_t)tabStops[i]) + _T("</tabstop>"));
}
strXml += _T("</tabstops>");
}
oWriter.WriteString(strXml);
oWriter.WriteNodeEnd(_T("Paragraph"));
return oWriter.GetXmlString();
return L"";
}
};
......@@ -608,71 +546,7 @@ namespace NSPresentationEditor
CString ToString()
{
NSPresentationEditor::CXmlWriter oWriter;
oWriter.WriteNodeBegin(_T("TextRuler"));
if (CLevels.is_init())
{
oWriter.WriteNodeValueDWORD(_T("CLevels"), (DWORD)CLevels.get());
}
if (DefaultTabSize.is_init())
{
oWriter.WriteNodeValueLONG(_T("DefaultTabSize"), (LONG)DefaultTabSize.get());
}
if (LeftMargin1.is_init())
{
oWriter.WriteNodeValueLONG(_T("LeftMargin1"), (LONG)LeftMargin1.get());
}
if (Indent1.is_init())
{
oWriter.WriteNodeValueLONG(_T("Indent1"), (LONG)Indent1.get());
}
if (LeftMargin2.is_init())
{
oWriter.WriteNodeValueLONG(_T("LeftMargin2"), (LONG)LeftMargin2.get());
}
if (Indent2.is_init())
{
oWriter.WriteNodeValueLONG(_T("Indent2"), (LONG)Indent2.get());
}
if (LeftMargin3.is_init())
{
oWriter.WriteNodeValueLONG(_T("LeftMargin3"), (LONG)LeftMargin3.get());
}
if (Indent3.is_init())
{
oWriter.WriteNodeValueLONG(_T("Indent3"), (LONG)Indent3.get());
}
if (LeftMargin4.is_init())
{
oWriter.WriteNodeValueLONG(_T("LeftMargin4"), (LONG)LeftMargin4.get());
}
if (Indent4.is_init())
{
oWriter.WriteNodeValueLONG(_T("Indent4"), (LONG)Indent4.get());
}
if (LeftMargin5.is_init())
{
oWriter.WriteNodeValueLONG(_T("LeftMargin5"), (LONG)LeftMargin5.get());
}
if (Indent5.is_init())
{
oWriter.WriteNodeValueLONG(_T("Indent5"), (LONG)Indent5.get());
}
size_t tabssize = tabsStops.size();
if (0 != tabssize)
{
oWriter.WriteNodeBegin(_T("TabStops"));
for (size_t i = 0; i < tabssize; ++i)
{
oWriter.WriteNodeValueDWORD(_T("tabStop"), tabsStops[i]);
}
oWriter.WriteNodeEnd(_T("TabStops"));
}
oWriter.WriteNodeEnd(_T("TextRuler"));
return oWriter.GetXmlString();
return L"";
}
};
......@@ -804,43 +678,7 @@ namespace NSPresentationEditor
CString ToString()
{
NSPresentationEditor::CXmlWriter oWriter;
oWriter.WriteNodeBegin(_T("SIRun"));
if (bSpell)
{
oWriter.WriteNodeValueDWORD(_T("Spell"), (DWORD)Spell);
}
if (bLang)
{
oWriter.WriteNodeValueDWORD(_T("Lang"), (DWORD)Lang);
}
if (bAltLang)
{
oWriter.WriteNodeValueDWORD(_T("AltLang"), (DWORD)AltLang);
}
if (bBidi)
{
oWriter.WriteNodeValueDWORD(_T("Bidi"), (DWORD)Bidi);
}
if (bPp10ext)
{
oWriter.WriteNodeValueDWORD(_T("pp10runid"), (DWORD)pp10runid);
oWriter.WriteNodeValueBool(_T("bGramma"), bGramma);
}
if (bSmartTag)
{
oWriter.WriteNodeBegin(_T("SmartTags"));
for (size_t i = 0; i < arSmartTags.size(); ++i)
{
oWriter.WriteNodeValueDWORD(_T("tag"), arSmartTags[i]);
}
oWriter.WriteNodeEnd(_T("SmartTags"));
}
oWriter.WriteNodeEnd(_T("SIRun"));
return oWriter.GetXmlString();
return L"";
}
};
......@@ -848,8 +686,8 @@ namespace NSPresentationEditor
class CSpan
{
public:
CTextCFRun m_oRun;
CString m_strText;
CTextCFRun m_oRun;
std::wstring m_strText;
public:
CSpan() : m_oRun(), m_strText(_T(""))
......@@ -905,33 +743,34 @@ namespace NSPresentationEditor
}
};
class CTextFullInfo
{
public:
CTextPFRun m_oPF;
CTextCFRun m_oCF;
CTextRuler m_oRuler;
CTextSIRun m_oSI;
public:
CTextFullInfo() : m_oPF(), m_oCF(), m_oRuler(), m_oSI()
{
}
CTextFullInfo(const CTextFullInfo& oSrc)
{
*this = oSrc;
}
CTextFullInfo& operator=(const CTextFullInfo& oSrc)
{
m_oPF = oSrc.m_oPF;
m_oCF = oSrc.m_oCF;
m_oRuler = oSrc.m_oRuler;
m_oSI = oSrc.m_oSI;
return *this;
}
};
// ???
//class CTextFullInfo
//{
//public:
// CTextPFRun m_oPF;
// CTextCFRun m_oCF;
// CTextRuler m_oRuler;
// CTextSIRun m_oSI;
//public:
// CTextFullInfo() : m_oPF(), m_oCF(), m_oRuler(), m_oSI()
// {
// }
// CTextFullInfo(const CTextFullInfo& oSrc)
// {
// *this = oSrc;
// }
// CTextFullInfo& operator=(const CTextFullInfo& oSrc)
// {
// m_oPF = oSrc.m_oPF;
// m_oCF = oSrc.m_oCF;
// m_oRuler = oSrc.m_oRuler;
// m_oSI = oSrc.m_oSI;
// return *this;
// }
//};
class CTextStyles
{
......@@ -965,6 +804,18 @@ namespace NSPresentationEditor
m_pLevels[i] = pStyles->m_pLevels[i];
}
}
void SetLanguage(nullable<WORD> & language)
{
if (!language.is_init()) return;
for (int i = 0; i < 10; ++i)
{
if (m_pLevels[i].is_init())
{
m_pLevels[i]->m_oCFRun.Language = language;
}
}
}
void ApplyAfter(const CTextStyles& oSrc)
{
for (int i = 0; i < 10; ++i)
......@@ -1040,7 +891,7 @@ namespace NSPresentationEditor
size_t nCountS = m_arSpans.size();
for (size_t i = 0; i < nCountS; ++i)
{
m_arSpans[i].m_strText.Replace((TCHAR)(11), (TCHAR)(13));
std::replace( m_arSpans[i].m_strText.begin(), m_arSpans[i].m_strText.end(), (TCHAR)(11), (TCHAR)(13));
}
}
AVSINLINE bool IsEmpty()
......@@ -1048,7 +899,7 @@ namespace NSPresentationEditor
size_t nCountSpans = m_arSpans.size();
for (size_t i = 0; i < nCountSpans; ++i)
{
int nLen = m_arSpans[i].m_strText.GetLength();
int nLen = m_arSpans[i].m_strText.length();
if (nLen > 1)
return false;
......
......@@ -909,7 +909,7 @@ public:
oSpan.m_oRun = oRun;
oSpan.m_strText = oNode.GetText();
if (oSpan.m_strText.GetLength() > 0)
if (!oSpan.m_strText.empty())
{
CorrectXmlString2(oSpan.m_strText);
......
......@@ -108,12 +108,13 @@ namespace NSPresentationEditor
{
m_bIsWriteGeom = bIsWrite;
}
CString ConvertShape ();
CString ConvertImage ();
CString ConvertLine (CPen & pen);
CString ConvertShadow (CShadow & shadow);
CString ConvertBrush (CBrush & brush);
CString ConvertColor (CColor & color, long alpha);
//--------------------------------------------------------------------
CString ConvertShape ();
CString ConvertImage ();
CString ConvertLine (CPen & pen);
CString ConvertShadow (CShadow & shadow);
CString ConvertBrush (CBrush & brush);
static CString ConvertColor (CColor & color, long alpha);
// -----------------------------------------------------------------------------
virtual HRESULT get_Type(LONG* lType) ;
//-------- --------------------------------------------------
......
......@@ -113,206 +113,5 @@ public:
}
static void ConvertStyleLevel(NSPresentationEditor::CTextStyleLevel& oLevel, NSPresentationEditor::CMetricInfo& oMetricInfo,
NSPresentationEditor::CStringWriter& oWriter, const int& nLevel)
{
CString str1;
if (nLevel == 9)
str1 = _T("<a:defPPr");
else
str1.Format(_T("<a:lvl%dpPr"), nLevel + 1);
oWriter.WriteString(str1);
NSPresentationEditor::CTextPFRun* pPF = &oLevel.m_oPFRun;
if (pPF->fontAlign.is_init())
{
CString strProp = GetFontAlign(pPF->fontAlign.get());
oWriter.WriteString(std::wstring(L" fontAlgn=\"") + string2std_string(strProp) + _T("\""));
}
if (pPF->leftMargin.is_init())
{
CString strProp;
strProp.Format(_T(" marL=\"%d\""), pPF->leftMargin.get());
oWriter.WriteString(strProp);
if (pPF->indent.is_init() == false)
pPF->indent = (LONG)0;
}
if (pPF->indent.is_init())
{
CString strProp;
strProp.Format(_T(" indent=\"%d\""), pPF->indent.get());
oWriter.WriteString(strProp);
}
//if (pPF->textAlignment.is_init())
//{
// CString strProp = GetTextAlign(pPF->textAlignment.get());
// oWriter.WriteString(std::wstring(L" algn=\"") + string2std_string(strProp) + _T("\""));
//}
if (pPF->defaultTabSize.is_init())
{
CString strProp;
strProp.Format(_T(" defTabSz=\"%d\""), pPF->defaultTabSize.get());
oWriter.WriteString(strProp);
}
CString str2 = _T(">");
oWriter.WriteString(str2);
if (pPF->tabStops.size() > 0)
{
oWriter.WriteString(std::wstring(L"<a:tabLst>"));
for (int t = 0 ; t < pPF->tabStops.size(); t++)
{
CString strTab;
strTab.Format(L"<a:tab pos=\"%d\" algn=\"l\"/>", pPF->tabStops[t]) ;
oWriter.WriteString(strTab);
}
oWriter.WriteString(std::wstring(L"</a:tabLst>"));
}
if (pPF->hasBullet.is_init())
{
if (pPF->hasBullet.get())
{
wchar_t bu = 0x2022;
if (pPF->bulletChar.is_init())
{
bu = pPF->bulletChar.get();
}
oWriter.WriteString(std::wstring(L"<a:buChar char=\""));
oWriter.WriteStringXML(std::wstring(&bu, 1));
oWriter.WriteString(std::wstring(L"\"/>"));
}
else
{
CString strB = _T("<a:buNone/>");
oWriter.WriteString(strB);
}
}
double dKoef1 = 3.52777778;
if (pPF->lineSpacing.is_init())
{
LONG val = pPF->lineSpacing.get();
if (val > 0)
{
CString str = _T("");
str.Format(_T("<a:lnSpc><a:spcPts val=\"%d\"/></a:lnSpc>"), (int)(val * 0.125 * 100/*/ dKoef1*/));
oWriter.WriteString(str);
}
else if (val < 0 && val > -13200)
{
CString str = _T("");
str.Format(_T("<a:lnSpc><a:spcPct val=\"%d\"/></a:lnSpc>"), -val * 1000);
oWriter.WriteString(str);
}
}
if (pPF->spaceAfter.is_init())
{
LONG val = pPF->spaceAfter.get();
if (val > 0)
{
CString str = _T("");
str.Format(_T("<a:spcAft><a:spcPts val=\"%d\"/></a:spcAft>"), (int)(val * 0.125 * 100/*/ dKoef1*/));
oWriter.WriteString(str);
}
else if (val < 0 && val > -13200)
{
CString str = _T("");
str.Format(_T("<a:spcAft><a:spcPct val=\"%d\"/></a:spcAft>"), -val * 1000);
oWriter.WriteString(str);
}
}
if (pPF->spaceBefore.is_init())
{
LONG val = pPF->spaceBefore.get();
if (val > 0)
{
CString str = _T("");
str.Format(_T("<a:spcBef><a:spcPts val=\"%d\"/></a:spcBef>"), (int)(val * 0.125 * 100/*/ dKoef1*/));
oWriter.WriteString(str);
}
else if (val < 0 && val > -13200)
{
CString str = _T("");
str.Format(_T("<a:spcBef><a:spcPct val=\"%d\"/></a:spcBef>"), -val * 1000);
oWriter.WriteString(str);
}
}
CString strCF1 = _T("<a:defRPr");
oWriter.WriteString(strCF1);
NSPresentationEditor::CTextCFRun* pCF = &oLevel.m_oCFRun;
if (pCF->Size.is_init())
{
CString strProp = _T("");
strProp.Format(_T(" sz=\"%d\""), (int)(100 * pCF->Size.get()));
oWriter.WriteString(strProp);
}
if (pCF->FontBold.is_init())
{
if (pCF->FontBold.get())
oWriter.WriteString(std::wstring(L" b=\"1\""));
else
oWriter.WriteString(std::wstring(L" b=\"0\""));
}
if (pCF->FontItalic.is_init())
{
if (pCF->FontItalic.get())
oWriter.WriteString(std::wstring(L" i=\"1\""));
else
oWriter.WriteString(std::wstring(L" i=\"0\""));
}
oWriter.WriteString(std::wstring(L">"));
if (pCF->Color.is_init())
{
if (pCF->Color->m_lSchemeIndex != -1)
{
CString strProp = _T("<a:solidFill><a:schemeClr val=\"") + GetColorInScheme(pCF->Color->m_lSchemeIndex) + _T("\"/></a:solidFill>");
oWriter.WriteString(strProp);
}
else
{
CString strColor = _T("");
strColor.Format(_T("%06x"), pCF->Color->GetLONG_RGB());
CString strProp = _T("<a:solidFill><a:srgbClr val=\"") + strColor + _T("\"/></a:solidFill>");
oWriter.WriteString(strProp);
}
}
if ((pCF->FontProperties.is_init()) && (!pCF->FontProperties->strFontName.empty()))
{
oWriter.WriteString(std::wstring(L"<a:latin typeface=\"") + pCF->FontProperties->strFontName + _T("\"/>"));
}
else if (pCF->Typeface.is_init())
{
if (0 == pCF->Typeface.get())
{
CString strProp = _T("<a:latin typeface=\"+mj-lt\"/>");
oWriter.WriteString(strProp);
}
else
{
CString strProp = _T("<a:latin typeface=\"+mn-lt\"/>");
oWriter.WriteString(strProp);
}
}
CString strCF2 = _T("</a:defRPr>");
oWriter.WriteString(strCF2);
CString str3 = _T("");
if (nLevel == 9)
str3 = _T("</a:defPPr>");
else
str3.Format(_T("</a:lvl%dpPr>"), nLevel + 1);
oWriter.WriteString(str3);
}
NSPresentationEditor::CStringWriter& oWriter, const int& nLevel);
};
......@@ -355,7 +355,7 @@ namespace StreamUtils
return Value;
}
static CStringA ReadCStringA(POLE::Stream* pStream, LONG lLen)
static std::string ReadStringA(POLE::Stream* pStream, LONG lLen)
{
if (pStream == NULL) return ("");
......@@ -366,12 +366,12 @@ namespace StreamUtils
pData[lLen] = 0;
CStringA str(pData);
std::string str(pData);
delete[] pData;
return str;
}
static CStringW ReadCStringW(POLE::Stream* pStream, LONG lLen)
static std::wstring ReadStringW(POLE::Stream* pStream, LONG lLen)
{
if (pStream == NULL) return _T("");
......@@ -401,13 +401,13 @@ namespace StreamUtils
delete [] pStrUtf32;
return _T("");
}
CString res((wchar_t*)pStrUtf32, lLen);
std::wstring res((wchar_t*)pStrUtf32, lLen);
if (pStrUtf32) delete [] pStrUtf32;
return res;
}
else
{
CStringW str((wchar_t*)pData);
std::wstring str((wchar_t*)pData);
delete[] pData;
return str;
}
......
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