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
#include "LanguageIdMapping.h"
#include "../../Common/MS-LCID.h"
namespace DocFileFormat
{
......@@ -26,9 +26,7 @@ namespace DocFileFormat
{
if ( dynamic_cast<LanguageId*>( lid )->Code != Nothing )
{
wstring langcode = _T( "en-US" );
langcode = getLanguageCode( dynamic_cast<LanguageId*>( lid ) );
wstring langcode = getLanguageCode( dynamic_cast<LanguageId*>( lid ) );
XMLTools::XMLAttribute<wchar_t>* att = NULL;
......@@ -75,449 +73,11 @@ namespace DocFileFormat
wstring LanguageIdMapping::getLanguageCode( LanguageId* lid )
{
switch ( lid->Code )
{
case Afrikaans:
return wstring( _T( "af-ZA" ) );
case Albanian:
return wstring( _T( "sq-AL" ) );
case Amharic:
return wstring( _T( "am-ET" ) );
case ArabicAlgeria:
return wstring( _T( "ar-DZ" ) );
case ArabicBahrain:
return wstring( _T( "ar-BH" ) );
case ArabicEgypt:
return wstring( _T( "ar-EG" ) );
case ArabicIraq:
return wstring( _T( "ar-IQ" ) );
case ArabicJordan:
return wstring( _T( "ar-JO" ) );
case ArabicKuwait:
return wstring( _T( "ar-KW" ) );
case ArabicLebanon:
return wstring( _T( "ar-LB" ) );
case ArabicLibya:
return wstring( _T( "ar-LY" ) );
case ArabicMorocco:
return wstring( _T( "ar-MA" ) );
case ArabicOman:
return wstring( _T( "ar-OM" ) );
case ArabicQatar:
return wstring( _T( "ar-QA" ) );
case ArabicSaudiArabia:
return wstring( _T( "ar-SA" ) );
case ArabicSyria:
return wstring( _T( "ar-SY" ) );
case ArabicTunisia:
return wstring( _T( "ar-TN" ) );
case ArabicUAE:
return wstring( _T( "ar-AE" ) );
case ArabicYemen:
return wstring( _T( "ar-YE" ) );
case Armenian:
return wstring( _T( "hy-AM" ) );
case Assamese:
return wstring( _T( "as-IN" ) );
case AzeriCyrillic:
return wstring( _T( "az-AZ-cyrl" ) );
case AzeriLatin:
return wstring( _T( "az-AZ-latn" ) );
case Basque:
return wstring( _T( "eu-ES" ) );
case Belarusian:
return wstring( _T( "be-BY" ) );
case Bengali:
return wstring( _T( "bn-IN" ) );
case BengaliBangladesh:
return wstring( _T( "bn-BD" ) );
case Bulgarian:
return wstring( _T( "bg-BG" ) );
case Burmese:
return wstring( _T( "my-MM" ) );
case Catalan:
return wstring( _T( "ca-ES" ) );
case Cherokee:
//there is no iso code fpr cherokee
case ChineseHongKong:
return wstring( _T( "zh-HK" ) );
case ChineseMacao:
return wstring( _T( "zh-MO" ) );
case ChinesePRC:
return wstring( _T( "zh-CN" ) );
case ChineseSingapore:
return wstring( _T( "zh-SG" ) );
case ChineseTaiwan:
return wstring( _T( "zh-TW" ) );
case Croatian:
return wstring( _T( "hr-HR" ) );
case Czech:
return wstring( _T( "cs-CZ" ) );
case Danish:
return wstring( _T( "da-DK" ) );
case Divehi:
return wstring( _T( "dv-MV" ) );
case DutchBelgium:
return wstring( _T( "nl-BE" ) );
case DutchNetherlands:
return wstring( _T( "nl-NL" ) );
case Edo:
//there is no iso 639-1 code for edo
case EnglishAustralia:
return wstring( _T( "en-AU" ) );
case EnglishBelize:
return wstring( _T( "en-BZ" ) );
case EnglishCanada:
return wstring( _T( "en-CA" ) );
case EnglishCaribbean:
//the caribbean sea has many english speaking countires.
//we use the Dominican Republic
return wstring( _T( "en-DO" ) );
case EnglishHongKong:
return wstring( _T( "en-HK" ) );
case EnglishIndia:
return wstring( _T( "en-IN" ) );
case EnglishIndonesia:
return wstring( _T( "en-ID" ) );
case EnglishIreland:
return wstring( _T( "en-IE" ) );
case EnglishJamaica:
return wstring( _T( "en-JM" ) );
case EnglishMalaysia:
return wstring( _T( "en-MY" ) );
case EnglishNewZealand:
return wstring( _T( "en-NZ" ) );
case EnglishPhilippines:
return wstring( _T( "en-PH" ) );
case EnglishSingapore:
return wstring( _T( "en-SG" ) );
case EnglishSouthAfrica:
return wstring( _T( "en-ZA" ) );
case EnglishTrinidadAndTobago:
return wstring( _T( "en-TT" ) );
case EnglishUK:
return wstring( _T( "en-UK" ) );
case EnglishUS:
return wstring( _T( "en-US" ) );
case EnglishZimbabwe:
return wstring( _T( "en-ZW" ) );
case Estonian:
return wstring( _T( "et-EE" ) );
case Faeroese:
return wstring( _T( "fo-FO" ) );
case Farsi:
//there is no iso 639-1 code for farsi
case Filipino:
//there is no iso 639-1 code for filipino
case Finnish:
return wstring( _T( "fi-FI" ) );
case FrenchBelgium:
return wstring( _T( "fr-BE" ) );
case FrenchCameroon:
return wstring( _T( "fr-CM" ) );
case FrenchCanada:
return wstring( _T( "fr-CA" ) );
case FrenchCongoDRC:
return wstring( _T( "fr-CD" ) );
case FrenchCotedIvoire:
return wstring( _T( "fr-CI" ) );
case FrenchFrance:
return wstring( _T( "fr-FR" ) );
case FrenchHaiti:
return wstring( _T( "fr-HT" ) );
case FrenchLuxembourg:
return wstring( _T( "fr-LU" ) );
case FrenchMali:
return wstring( _T( "fr-ML" ) );
case FrenchMonaco:
return wstring( _T( "fr-MC" ) );
case FrenchMorocco:
return wstring( _T( "fr-MA" ) );
case FrenchReunion:
return wstring( _T( "fr-RE" ) );
case FrenchSenegal:
return wstring( _T( "fr-SN" ) );
case FrenchSwitzerland:
return wstring( _T( "fr-CH" ) );
case FrenchWestIndies:
//the western caribbean sea has many french speaking countires.
//we use the Dominican Republic
return wstring( _T( "fr-DO" ) );
case FrisianNetherlands:
return wstring( _T( "fy-NL" ) );
case Fulfulde:
//there is no iso 639-1 code for fulfulde
case FYROMacedonian:
return wstring( _T( "mk-MK" ) );
case GaelicIreland:
return wstring( _T( "ga-IE" ) );
case GaelicScotland:
return wstring( _T( "gd-UK" ) );
case Galician:
return wstring( _T( "gl-ES" ) );
case Georgian:
return wstring( _T( "ka-GE" ) );
case GermanAustria:
return wstring( _T( "de-AT" ) );
case GermanGermany:
return wstring( _T( "de-DE" ) );
case GermanLiechtenstein:
return wstring( _T( "de-LI" ) );
case GermanLuxembourg:
return wstring( _T( "de-LU" ) );
case GermanSwitzerland:
return wstring( _T( "de-CH" ) );
case Greek:
return wstring( _T( "el-GR" ) );
case Guarani:
return wstring( _T( "gn-BR" ) );
case Gujarati:
return wstring( _T( "gu-IN" ) );
case Hausa:
return wstring( _T( "ha-NG" ) );
case Hawaiian:
//there is no iso 639-1 language code for hawaiian
case Hebrew:
return wstring( _T( "he-IL" ) );
case Hindi:
return wstring( _T( "hi-IN" ) );
case Hungarian:
return wstring( _T( "hu-HU" ) );
case Ibibio:
//there is no iso 639-1 language code for ibibio
case Icelandic:
return wstring( _T( "is-IS" ) );
case Igbo:
//there is no iso 639-1 language code for ibibio
case Indonesian:
return wstring( _T( "id-ID" ) );
case Inuktitut:
return wstring( _T( "iu-CA" ) );
case ItalianItaly:
return wstring( _T( "it-IT" ) );
case ItalianSwitzerland:
return wstring( _T( "it-CH" ) );
case Japanese:
return wstring( _T( "ja-JP" ) );
case Kannada:
return wstring( _T( "kn-ID" ) );
case Kanuri:
//there is no iso 639-1 language code for kanuri
case Kashmiri:
return wstring( _T( "ks-ID" ) );
case KashmiriArabic:
return wstring( _T( "ks-PK" ) );
case Kazakh:
return wstring( _T( "kk-KZ" ) );
case Khmer:
//there is no iso 639-1 language code for khmer
case Konkani:
//there is no iso 639-1 language code for konkani
case Korean:
return wstring( _T( "ko-KR" ) );
case Kyrgyz:
return wstring( _T( "ky-KG" ) );
case Lao:
return wstring( _T( "lo-LA" ) );
case Latin:
return wstring( _T( "la" ) );
case Latvian:
return wstring( _T( "lv-LV" ) );
case Lithuanian:
return wstring( _T( "lt-LT" ) );
case Malay:
return wstring( _T( "ms-MY" ) );
case MalayBruneiDarussalam:
return wstring( _T( "ms-BN" ) );
case Malayalam:
return wstring( _T( "ml-ID" ) );
case Maltese:
return wstring( _T( "mt-MT" ) );
case Manipuri:
//there is no iso 639-1 language code for manipuri
case Maori:
return wstring( _T( "mi-NZ" ) );
case Marathi:
return wstring( _T( "mr-ID" ) );
case Mongolian:
return wstring( _T( "mn-MN" ) );
case MongolianMongolian:
return wstring( _T( "mn-MN" ) );
case Nepali:
return wstring( _T( "ne-NP" ) );
case NepaliIndia:
return wstring( _T( "ne-ID" ) );
case NorwegianBokmal:
return wstring( _T( "nb-NO" ) );
//also possible: no-NO
case NorwegianNynorsk:
return wstring( _T( "nn-NO" ) );
//also possible: no-NO
case Oriya:
return wstring( _T( "or-ID" ) );
case Oromo:
//there is no iso 639-1 language code for oromo
case Papiamentu:
//there is no iso 639-1 language code for papiamentu
case Pashto:
return wstring( _T( "ps-PK" ) );
case Polish:
return wstring( _T( "pl-PL" ) );
case PortugueseBrazil:
return wstring( _T( "pt-BR" ) );
case PortuguesePortugal:
return wstring( _T( "pt-PT" ) );
case Punjabi:
return wstring( _T( "pa-ID" ) );
case PunjabiPakistan:
return wstring( _T( "pa-PK" ) );
case QuechuaBolivia:
return wstring( _T( "qu-BO" ) );
case QuechuaEcuador:
return wstring( _T( "qu-EC" ) );
case QuechuaPeru:
return wstring( _T( "qu-PE" ) );
case RhaetoRomanic:
return wstring( _T( "rm-CH" ) );
case RomanianMoldova:
return wstring( _T( "ro-MD" ) );
case RomanianRomania:
return wstring( _T( "ro-RO" ) );
case RussianMoldova:
return wstring( _T( "ru-MD" ) );
case RussianRussia:
return wstring( _T( "ru-RU" ) );
case SamiLappish:
return wstring( _T( "se-FI" ) );
case Sanskrit:
return wstring( _T( "sa-ID" ) );
case Sepedi:
//there is no iso 639-1 language code for sepedi
case SerbianCyrillic:
return wstring( _T( "sr-YU-cyrl" ) );
case SerbianLatin:
return wstring( _T( "sr-YU-latn" ) );
case SindhiArabic:
return wstring( _T( "sd-PK" ) );
case SindhiDevanagari:
return wstring( _T( "sd-ID" ) );
case Sinhalese:
return wstring( _T( "si-ID" ) );
case Slovak:
return wstring( _T( "sk-SK" ) );
case Slovenian:
return wstring( _T( "sl-SI" ) );
case Somali:
return wstring( _T( "so-SO" ) );
case Sorbian:
//there is no iso 639-1 language code for sorbian
case SpanishArgentina:
return wstring( _T( "es-AR" ) );
case SpanishBolivia:
return wstring( _T( "es-BO" ) );
case SpanishChile:
return wstring( _T( "es-CL" ) );
case SpanishColombia:
return wstring( _T( "es-CO" ) );
case SpanishCostaRica:
return wstring( _T( "es-CR" ) );
case SpanishDominicanRepublic:
return wstring( _T( "es-DO" ) );
case SpanishEcuador:
return wstring( _T( "es-EC" ) );
case SpanishElSalvador:
return wstring( _T( "es-SV" ) );
case SpanishGuatemala:
return wstring( _T( "es-GT" ) );
case SpanishHonduras:
return wstring( _T( "es-HN" ) );
case SpanishMexico:
return wstring( _T( "es-MX" ) );
case SpanishNicaragua:
return wstring( _T( "es-NI" ) );
case SpanishPanama:
return wstring( _T( "es-PA" ) );
case SpanishParaguay:
return wstring( _T( "es-PY" ) );
case SpanishPeru:
return wstring( _T( "es-PE" ) );
case SpanishPuertoRico:
return wstring( _T( "es-PR" ) );
case SpanishSpainModernSort:
return wstring( _T( "es-ES" ) );
case SpanishSpainTraditionalSort:
return wstring( _T( "es-ES" ) );
case SpanishUruguay:
return wstring( _T( "es-UY" ) );
case SpanishVenezuela:
return wstring( _T( "es-VE" ) );
case Sutu:
//there is no iso 639-1 language code for sutu
case Swahili:
//Swahili is spoken in many east african countries, so we use tansania
return wstring( _T( "sw-TZ" ) );
case SwedishFinland:
return wstring( _T( "sv-FI" ) );
case SwedishSweden:
return wstring( _T( "sv-SE" ) );
case Syriac:
//there is no iso 639-1 language code for syriac
case Tajik:
return wstring( _T( "tg-TJ" ) );
case Tamazight:
//there is no iso 639-1 language code for tamazight
case TamazightLatin:
//there is no iso 639-1 language code for tamazight
case Tamil:
return wstring( _T( "ta-ID" ) );
case Tatar:
return wstring( _T( "tt-RU" ) );
case Telugu:
return wstring( _T( "te-ID" ) );
//case Thai:
//case TibetanBhutan:
//case TibetanPRC:
//case TigrignaEritrea:
//case TigrignaEthiopia:
//case Tsonga:
//case Tswana:
//case Turkish:
//case Turkmen:
//case Ukrainian:
int intLCID = lid->Code;
std::wstring strLCID = msLCID2wstring(intLCID);
//case Urdu:
if (strLCID.empty()) strLCID = L"en-US";
//case UzbekCyrillic:
//case UzbekLatin:
//case Venda:
//case Vietnamese:
//case Welsh:
//case Xhosa:
//case Yi:
//case Yiddish:
//case Yoruba:
//case Zulu:
default:
return wstring( _T( "en-US" ) );
}
return strLCID;
}
}
\ No newline at end of file
......@@ -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
......@@ -354,35 +354,6 @@ public:
if (bUseFlipV)
pElement->m_bFlipV = bFlipV;
}break;
case fNoLineDrawDash: //Line Style Boolean Properties
{
bool bNoLineDrawDash = GETBIT(pProperty->m_lValue, 0);
bool bLineFillShape = GETBIT(pProperty->m_lValue, 1);
bool bHitTestLine = GETBIT(pProperty->m_lValue, 2);
bool bLine = GETBIT(pProperty->m_lValue, 3);
bool bArrowheadsOK = GETBIT(pProperty->m_lValue, 4);
bool bInsetPenOK = GETBIT(pProperty->m_lValue, 5);
bool bInsetPen = GETBIT(pProperty->m_lValue, 6);
bool bLineOpaqueBackColor = GETBIT(pProperty->m_lValue, 9);
bool bUsefNoLineDrawDash = GETBIT(pProperty->m_lValue, 16);
bool bUsefLineFillShape = GETBIT(pProperty->m_lValue, 17);
bool bUsefHitTestLine = GETBIT(pProperty->m_lValue, 18);
bool bUsefLine = GETBIT(pProperty->m_lValue, 19);
bool bUsefArrowheadsOK = GETBIT(pProperty->m_lValue, 20);
bool bUsefInsetPenOK = GETBIT(pProperty->m_lValue, 21);
bool bUsefInsetPen = GETBIT(pProperty->m_lValue, 22);
bool bUsefLineOpaqueBackColor = GETBIT(pProperty->m_lValue, 25);
if (bUsefLine)
pElement->m_bLine = bLine;
}break;
case lineStyle:
case lineDashStyle://from Complex
{
pElement->m_bLine = true;
}break;
case fillType:
{
DWORD dwType = pProperty->m_lValue;
......@@ -635,6 +606,34 @@ public:
break;
}
// line --------------------------------------------------------
case fNoLineDrawDash: //Line Style Boolean Properties
{
bool bNoLineDrawDash = GETBIT(pProperty->m_lValue, 0);
bool bLineFillShape = GETBIT(pProperty->m_lValue, 1);
bool bHitTestLine = GETBIT(pProperty->m_lValue, 2);
bool bLine = GETBIT(pProperty->m_lValue, 3);
bool bArrowheadsOK = GETBIT(pProperty->m_lValue, 4);
bool bInsetPenOK = GETBIT(pProperty->m_lValue, 5);
bool bInsetPen = GETBIT(pProperty->m_lValue, 6);
bool bLineOpaqueBackColor = GETBIT(pProperty->m_lValue, 9);
bool bUsefNoLineDrawDash = GETBIT(pProperty->m_lValue, 16);
bool bUsefLineFillShape = GETBIT(pProperty->m_lValue, 17);
bool bUsefHitTestLine = GETBIT(pProperty->m_lValue, 18);
bool bUsefLine = GETBIT(pProperty->m_lValue, 19);
bool bUsefArrowheadsOK = GETBIT(pProperty->m_lValue, 20);
bool bUsefInsetPenOK = GETBIT(pProperty->m_lValue, 21);
bool bUsefInsetPen = GETBIT(pProperty->m_lValue, 22);
bool bUsefLineOpaqueBackColor = GETBIT(pProperty->m_lValue, 25);
if (bUsefLine)
pElement->m_bLine = bLine;
}break;
case lineStyle:
case lineDashStyle://from Complex
{
pElement->m_bLine = true;
}break;
case lineColor:
{
SColorAtom oAtom;
......@@ -1000,36 +999,6 @@ public:
}
break;
}
case NSOfficeDrawing::dxTextLeft:
{
pParentShape->m_dTextMarginX = (double)pProperty->m_lValue / EMU_MM;
//pElemProps->SetAt(CElementProperty::epTextMarginLeft, pProperty->m_lValue);
break;
}
case NSOfficeDrawing::dxTextRight:
{
pParentShape->m_dTextMarginRight = (double)pProperty->m_lValue / EMU_MM;
//pElemProps->SetAt(CElementProperty::epTextMarginRight, pProperty->m_lValue);
break;
}
case NSOfficeDrawing::dyTextTop:
{
pParentShape->m_dTextMarginY = (double)pProperty->m_lValue / EMU_MM;
//pElemProps->SetAt(CElementProperty::epTextMarginTop, pProperty->m_lValue);
break;
}
case NSOfficeDrawing::dyTextBottom:
{
pParentShape->m_dTextMarginBottom = (double)pProperty->m_lValue / EMU_MM;
//pElemProps->SetAt(CElementProperty::epTextMarginBottom, pProperty->m_lValue);
break;
}
case NSOfficeDrawing::WrapText:
{
pParentShape->m_oText.m_lWrapMode = (LONG)pProperty->m_lValue;
//pElemProps->SetAt(CElementProperty::epTextWrap, pProperty->m_lValue);
break;
}
case NSOfficeDrawing::adjustValue:
case NSOfficeDrawing::adjust2Value:
case NSOfficeDrawing::adjust3Value:
......@@ -1044,7 +1013,6 @@ public:
LONG lIndexAdj = pProperty->m_ePID - NSOfficeDrawing::adjustValue;
if (lIndexAdj >= 0 && lIndexAdj < pShape->m_arAdjustments.size())
{
//SetAdjustment(lIndexAdj, (LONG)pProperty->m_lValue);
pShape->m_oCustomVML.LoadAdjusts(lIndexAdj, (LONG)pProperty->m_lValue);
}
else
......@@ -1053,7 +1021,32 @@ public:
}
break;
}
// text --------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------
case lTxid:
{
}break;
case NSOfficeDrawing::dxTextLeft:
{
pParentShape->m_dTextMarginX = (double)pProperty->m_lValue / EMU_MM;
}break;
case NSOfficeDrawing::dxTextRight:
{
pParentShape->m_dTextMarginRight = (double)pProperty->m_lValue / EMU_MM;
}break;
case NSOfficeDrawing::dyTextTop:
{
pParentShape->m_dTextMarginY = (double)pProperty->m_lValue / EMU_MM;
}break;
case NSOfficeDrawing::dyTextBottom:
{
pParentShape->m_dTextMarginBottom = (double)pProperty->m_lValue / EMU_MM;
}break;
case NSOfficeDrawing::WrapText:
{
pParentShape->m_oText.m_lWrapMode = (LONG)pProperty->m_lValue;
}break;
case NSOfficeDrawing::gtextUNICODE://word art text
{
if (pProperty->m_bComplex && 0 < pProperty->m_lValue)
......@@ -1068,24 +1061,20 @@ public:
p.m_arSpans.push_back(s);
pParentShape->m_oText.m_arParagraphs.push_back(p);
}
}
break;
}
// font --------------------------------------------------------
}
}break;
case NSOfficeDrawing::gtextFont:
{
if (pProperty->m_bComplex && 0 < pProperty->m_lValue)
{
std::wstring str = NSFile::CUtf8Converter::GetWStringFromUTF16((unsigned short*)pProperty->m_pOptions, pProperty->m_lValue/2-1);
pParentShape->m_oText.m_oAttributes.m_oFont.Name = std_string2string(str);
//pElemProps->SetAt(CElementProperty::epFontName, (CString)str);
}
break;
}
case NSOfficeDrawing::gtextSize:
{
pParentShape->m_oText.m_oAttributes.m_oFont.Size = (INT)((pProperty->m_lValue >> 16) & 0x0000FFFF);
//pElemProps->SetAt(CElementProperty::epFontSize, (DWORD)((pProperty->m_lValue >> 16) & 0x0000FFFF));
break;
}
case NSOfficeDrawing::anchorText:
......@@ -1095,16 +1084,12 @@ public:
case NSOfficeDrawing::anchorTop:
case NSOfficeDrawing::anchorTopBaseline:
{
//m_oText.m_nTextAlignHorizontal = 0;
pParentShape->m_oText.m_oAttributes.m_nTextAlignVertical = 0;
//pElemProps->SetAt(CElementProperty::epFontVertAlign, (DWORD)0);
break;
}
case NSOfficeDrawing::anchorMiddle:
{
//m_oText.m_nTextAlignHorizontal = 0;
pParentShape->m_oText.m_oAttributes.m_nTextAlignVertical = 1;
//pElemProps->SetAt(CElementProperty::epFontVertAlign, (DWORD)1);
break;
}
case NSOfficeDrawing::anchorBottom:
......@@ -1112,8 +1097,6 @@ public:
{
pParentShape->m_oText.m_oAttributes.m_nTextAlignHorizontal = 0;
pParentShape->m_oText.m_oAttributes.m_nTextAlignVertical = 2;
//pElemProps->SetAt(CElementProperty::epFontHorAlign, (DWORD)0);
//pElemProps->SetAt(CElementProperty::epFontVertAlign, (DWORD)2);
break;
}
case NSOfficeDrawing::anchorTopCentered:
......@@ -1121,16 +1104,12 @@ public:
{
pParentShape->m_oText.m_oAttributes.m_nTextAlignHorizontal = 1;
pParentShape->m_oText.m_oAttributes.m_nTextAlignVertical = 0;
//pElemProps->SetAt(CElementProperty::epFontHorAlign, (DWORD)1);
//pElemProps->SetAt(CElementProperty::epFontVertAlign, (DWORD)0);
break;
}
case NSOfficeDrawing::anchorMiddleCentered:
{
pParentShape->m_oText.m_oAttributes.m_nTextAlignHorizontal = 1;
pParentShape->m_oText.m_oAttributes.m_nTextAlignVertical = 1;
//pElemProps->SetAt(CElementProperty::epFontHorAlign, (DWORD)1);
//pElemProps->SetAt(CElementProperty::epFontVertAlign, (DWORD)1);
break;
}
case NSOfficeDrawing::anchorBottomCentered:
......@@ -1138,16 +1117,12 @@ public:
{
pParentShape->m_oText.m_oAttributes.m_nTextAlignHorizontal = 1;
pParentShape->m_oText.m_oAttributes.m_nTextAlignVertical = 2;
//pElemProps->SetAt(CElementProperty::epFontHorAlign, (DWORD)1);
//pElemProps->SetAt(CElementProperty::epFontVertAlign, (DWORD)2);
break;
}
default:
{
pParentShape->m_oText.m_oAttributes.m_nTextAlignHorizontal = 1;
pParentShape->m_oText.m_oAttributes.m_nTextAlignVertical = -1; // not set
//pElemProps->SetAt(CElementProperty::epFontHorAlign, (DWORD)1);
//pElemProps->SetAt(CElementProperty::epFontVertAlign, (DWORD)0);
break;
}
};
......@@ -1160,25 +1135,21 @@ public:
case NSOfficeDrawing::alignTextLeft:
{
pParentShape->m_oText.m_oAttributes.m_nTextAlignHorizontal = 0;
//pElemProps->SetAt(CElementProperty::epFontHorAlign, (DWORD)0);
break;
}
case NSOfficeDrawing::alignTextCenter:
{
pParentShape->m_oText.m_oAttributes.m_nTextAlignHorizontal = 1;
//pElemProps->SetAt(CElementProperty::epFontHorAlign, (DWORD)1);
break;
}
case NSOfficeDrawing::alignTextRight:
{
pParentShape->m_oText.m_oAttributes.m_nTextAlignHorizontal = 2;
//pElemProps->SetAt(CElementProperty::epFontHorAlign, (DWORD)2);
break;
}
default:
{
pParentShape->m_oText.m_oAttributes.m_nTextAlignHorizontal = 1;
//pElemProps->SetAt(CElementProperty::epFontHorAlign, (DWORD)1);
}
};
break;
......@@ -1211,7 +1182,6 @@ public:
if (bUseStrikethrought)
{
pParentShape->m_oText.m_oAttributes.m_oFont.Strikeout = (BYTE)bStrikethrought;
//pElemProps->SetAt(CElementProperty::epFontStrikeout, bStrikethrought);
}
if (bUseShadow)
{
......@@ -1220,25 +1190,36 @@ public:
if (bUseUnderline)
{
pParentShape->m_oText.m_oAttributes.m_oFont.Underline = (BYTE)bUnderline;
//pElemProps->SetAt(CElementProperty::epFontUnderline, bUnderline);
}
if (bUseItalic)
{
pParentShape->m_oText.m_oAttributes.m_oFont.Italic = bItalic;
//pElemProps->SetAt(CElementProperty::epFontItalic, bItalic);
}
if (bUseBold)
{
pParentShape->m_oText.m_oAttributes.m_oFont.Bold = bBold;
//pElemProps->SetAt(CElementProperty::epFontBold, bBold);
}
if (bUseVertical)
{
pParentShape->m_oText.m_bVertical = (true == bVertical) ? true : false;
}
}break;
case NSOfficeDrawing::cdirFont:
{
switch (pProperty->m_lValue)
{
case 1:
pParentShape->m_oText.m_bVertical = true;
break;
case 2:
pParentShape->m_oText.m_oAttributes.m_dTextRotate = 180;
break;
case 3:
pParentShape->m_oText.m_bVertical = true;
pParentShape->m_oText.m_oAttributes.m_dTextRotate = 180;
break;
}
break;
}
}break;
case NSOfficeDrawing::fFitTextToShape:
{
BYTE flag1 = (BYTE)(pProperty->m_lValue);
......@@ -1263,10 +1244,8 @@ public:
pParentShape->m_dTextMarginY = 2.54;
pParentShape->m_dTextMarginBottom = 1.27;
}
}
break;
}
// geometry shape
}
}break;
default:
break;
......@@ -1642,7 +1621,7 @@ public:
oElementInfo.m_lPersistIndex = oArrayTextRefs[0]->m_nIndex;
}
CString strText = _T("");
std::wstring strText;
// ...
std::vector<CRecordTextBytesAtom*> oArrayTextBytes;
GetRecordsByType(&oArrayTextBytes, true, true);
......@@ -1834,7 +1813,7 @@ public:
protected:
void SetUpTextStyle(CString& strText, CTheme* pTheme, CLayout* pLayout, IElement* pElem, CSlideInfo* pThemeWrapper, CSlideInfo* pSlideWrapper, CSlide* pSlide = NULL)
void SetUpTextStyle(std::wstring& strText, CTheme* pTheme, CLayout* pLayout, IElement* pElem, CSlideInfo* pThemeWrapper, CSlideInfo* pSlideWrapper, CSlide* pSlide = NULL)
{
// shape
// -
......@@ -1931,55 +1910,32 @@ protected:
}
// ------------------------------------------------------------------------------
// own properties ---------------------------------------------------------------
if (NULL != oElemInfo.m_pStream)
if (NULL != oElemInfo.m_pStream && -1 != oElemInfo.m_lOffsetTextStyle)
{
// .
// .
LONG lPosition = 0; StreamUtils::StreamPosition(lPosition, oElemInfo.m_pStream);
if (-1 != oElemInfo.m_lOffsetTextStyle)
{
StreamUtils::StreamSeek(oElemInfo.m_lOffsetTextStyle - 8, oElemInfo.m_pStream);
SRecordHeader oHeader;
oHeader.ReadFromStream(oElemInfo.m_pStream) ;
if (RECORD_TYPE_STYLE_TEXTPROP_ATOM == oHeader.RecType)
{
CRecordStyleTextPropAtom* pStyle = new CRecordStyleTextPropAtom();
pStyle->m_lCount = strText.GetLength();
pStyle->ReadFromStream(oHeader, oElemInfo.m_pStream);
NSPresentationEditor::ConvertPPTTextToEditorStructure(pStyle->m_arrPFs, pStyle->m_arrCFs, strText, pShape->m_oShape.m_oText);
StreamUtils::StreamSeek(oElemInfo.m_lOffsetTextStyle - 8, oElemInfo.m_pStream);
bIsOwnPresentSettings = (0 < pStyle->m_lCount);
SRecordHeader oHeader;
oHeader.ReadFromStream(oElemInfo.m_pStream) ;
RELEASEOBJECT(pStyle);
}
}
if (-1 != oElemInfo.m_lOffsetTextProp)
{
StreamUtils::StreamSeek(oElemInfo.m_lOffsetTextProp - 8, oElemInfo.m_pStream);
if (RECORD_TYPE_STYLE_TEXTPROP_ATOM == oHeader.RecType)
{
CRecordStyleTextPropAtom* pStyle = new CRecordStyleTextPropAtom();
pStyle->m_lCount = strText.length();
SRecordHeader oHeader;
oHeader.ReadFromStream(oElemInfo.m_pStream) ;
pStyle->ReadFromStream(oHeader, oElemInfo.m_pStream);
if (RECORD_TYPE_TEXTSPECINFO_ATOM == oHeader.RecType)
{
CRecordTextSpecInfoAtom* pSpecInfo = new CRecordTextSpecInfoAtom();
pSpecInfo->m_lCount = strText.GetLength();
NSPresentationEditor::ConvertPPTTextToEditorStructure(pStyle->m_arrPFs, pStyle->m_arrCFs, strText, pShape->m_oShape.m_oText);
pSpecInfo->ReadFromStream(oHeader, oElemInfo.m_pStream);
pSpecInfo->ApplyProperties(&(pShape->m_oShape.m_oText));
bIsOwnPresentSettings = (0 < pStyle->m_lCount);
RELEASEOBJECT(pSpecInfo);
}
RELEASEOBJECT(pStyle);
}
StreamUtils::StreamSeek(lPosition, oElemInfo.m_pStream);
}
// ------------------------------------------------------------------------------
// ()
......@@ -2172,7 +2128,7 @@ protected:
CTextPFRun_ppt elm;
elm.m_lCount = strText.GetLength();
elm.m_lCount = strText.length();
elm.m_lLevel = 0;
oArrayPF.push_back(elm);
......@@ -2186,6 +2142,29 @@ protected:
NSPresentationEditor::ConvertPPTTextToEditorStructure(oArrayPF, oArrayCF, strText, *pTextSettings);
}
if (NULL != oElemInfo.m_pStream && -1 != oElemInfo.m_lOffsetTextProp)
{
//
LONG lPosition = 0; StreamUtils::StreamPosition(lPosition, oElemInfo.m_pStream);
StreamUtils::StreamSeek(oElemInfo.m_lOffsetTextProp - 8, oElemInfo.m_pStream);
SRecordHeader oHeader;
oHeader.ReadFromStream(oElemInfo.m_pStream) ;
if (RECORD_TYPE_TEXTSPECINFO_ATOM == oHeader.RecType)
{
CRecordTextSpecInfoAtom* pSpecInfo = new CRecordTextSpecInfoAtom();
pSpecInfo->m_lCount = strText.length();
pSpecInfo->ReadFromStream(oHeader, oElemInfo.m_pStream);
pSpecInfo->ApplyProperties(&(pShape->m_oShape.m_oText));
RELEASEOBJECT(pSpecInfo);
}
StreamUtils::StreamSeek(lPosition, oElemInfo.m_pStream);
}
pShape->m_oShape.m_oText.RecalcParagraphsPPT(pTheme);
if (pShape->m_oActions.m_bPresent)
......@@ -2284,7 +2263,7 @@ protected:
for (size_t nIndexSpan = 0; nIndexSpan < pParagraph->m_arSpans.size(); ++nIndexSpan)
{
int lCurrentEnd = lCurrentStart + pParagraph->m_arSpans[nIndexSpan].m_strText.GetLength() - 1;
int lCurrentEnd = lCurrentStart + pParagraph->m_arSpans[nIndexSpan].m_strText.length() - 1;
if (lCurrentStart > lEnd || lCurrentEnd < lStart)
{
......@@ -2297,23 +2276,23 @@ protected:
CSpan oRunProp = pParagraph->m_arSpans[nIndexSpan];
CString strText = pParagraph->m_arSpans[nIndexSpan].m_strText;
std::wstring strText = pParagraph->m_arSpans[nIndexSpan].m_strText;
if (lStart_ > lCurrentStart)
{
pParagraph->m_arSpans.insert(pParagraph->m_arSpans.begin() + nIndexSpan, oRunProp);
pParagraph->m_arSpans[nIndexSpan].m_strText = strText.Mid(0, lStart_ - lCurrentStart);
pParagraph->m_arSpans[nIndexSpan].m_strText = strText.substr(0, lStart_ - lCurrentStart);
++nIndexSpan;
}
pParagraph->m_arSpans[nIndexSpan].m_oRun.Color = oColor;
pParagraph->m_arSpans[nIndexSpan].m_oRun.FontUnderline = (bool)true;
pParagraph->m_arSpans[nIndexSpan].m_strText = strText.Mid(lStart_ - lCurrentStart, lEnd_ - lStart_ + 1);
pParagraph->m_arSpans[nIndexSpan].m_strText = strText.substr(lStart_ - lCurrentStart, lEnd_ - lStart_ + 1);
if (lEnd_ < lCurrentEnd)
{
pParagraph->m_arSpans.insert(pParagraph->m_arSpans.begin() + nIndexSpan + 1, oRunProp);
++nIndexSpan;
pParagraph->m_arSpans[nIndexSpan].m_strText = strText.Mid(lEnd_ - lCurrentStart + 1, lCurrentEnd - lEnd_);
pParagraph->m_arSpans[nIndexSpan].m_strText = strText.substr(lEnd_ - lCurrentStart + 1, lCurrentEnd - lEnd_);
}
lCurrentStart = lCurrentEnd + 1;
......
......@@ -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);
}
......
......@@ -5,175 +5,7 @@ namespace NSPresentationEditor
{
CString CTextAttributesEx::ToString(CGeomShapeInfo& oInfo, CMetricInfo& pMetricInfo, double dStartTime, double dEndTime, CTheme* pTheme, CLayout* pLayout)
{
m_oBounds.left = (LONG)oInfo.m_dLeft;
m_oBounds.top = (LONG)oInfo.m_dTop;
m_oBounds.right = (LONG)(oInfo.m_dLeft + oInfo.m_dWidth);
m_oBounds.bottom = (LONG)(oInfo.m_dTop + oInfo.m_dHeight);
double dRight = oInfo.m_dLeft + oInfo.m_dWidth;
double dLeft = oInfo.m_dLeft;
if (2 == m_lWrapMode)
{
LONG lAlign = 0;
if (m_arParagraphs.size() > 0 && m_arParagraphs[0].m_oPFRun.textAlignment.is_init())
lAlign = m_arParagraphs[0].m_oPFRun.textAlignment.get();
else
lAlign = m_oAttributes.m_nTextAlignHorizontal;
switch (lAlign)
{
case 1:
{
// center
dLeft -= pMetricInfo.m_lMillimetresHor;
dRight += pMetricInfo.m_lMillimetresHor;
break;
}
default:
{
dRight = pMetricInfo.m_lMillimetresHor;
break;
}
};
}
CString strText = _T("");
// add Text Param
strText.Format(_T("<ImagePaint-DrawTextEx left='%lf' top='%lf' right='%lf' bottom='%lf' angle='%lf' flags='%d' "),
dLeft, oInfo.m_dTop, dRight, oInfo.m_dTop + oInfo.m_dHeight, oInfo.m_dRotate, oInfo.GetFlags());
RecalcParagraphs();
CString strInfoPars = _T("");
CString strInfoCFs = _T("");
CString sText = _T("");
size_t nCountPars = m_arParagraphs.size();
for (size_t nIndexPF = 0; nIndexPF < nCountPars; ++nIndexPF)
{
LONG lLevel = m_arParagraphs[nIndexPF].m_lTextLevel;
CTextPFRun oPFRun;
if (-1 != m_lTextType && pTheme->m_pStyles[m_lTextType].m_pLevels[lLevel].is_init())
{
oPFRun.ApplyAfter(pTheme->m_pStyles[m_lTextType].m_pLevels[lLevel]->m_oPFRun);
}
if (m_oLayoutStyles.m_pLevels[lLevel].is_init())
{
oPFRun.ApplyAfter(m_oLayoutStyles.m_pLevels[lLevel]->m_oPFRun);
}
if (m_oStyles.m_pLevels[lLevel].is_init())
{
oPFRun.ApplyAfter(m_oStyles.m_pLevels[lLevel]->m_oPFRun);
}
oPFRun.ApplyAfter(m_arParagraphs[nIndexPF].m_oPFRun);
if (0 == nIndexPF)
{
if (oPFRun.spaceBefore.is_init())
oPFRun.spaceBefore = (LONG)0;
}
#ifdef PPT_DEF
#ifndef PPTX_DEF
ApplyRuler(&oPFRun, (WORD)lLevel);
#endif
#endif
oPFRun.bIsOneLine = m_arParagraphs[nIndexPF].m_oPFRun.bIsOneLine;
LONG lCountParMem = 0;
size_t nCountCFs = m_arParagraphs[nIndexPF].m_arSpans.size();
if (0 == nCountCFs)
{
CTextCFRun oCFRun;
if (-1 != m_lTextType && pTheme->m_pStyles[m_lTextType].m_pLevels[lLevel].is_init())
{
oCFRun.ApplyAfter(pTheme->m_pStyles[m_lTextType].m_pLevels[lLevel]->m_oCFRun);
}
if (-1 != m_lFontRef)
{
oCFRun.Typeface = (WORD)m_lFontRef;
if (!oCFRun.FontProperties.is_init())
oCFRun.FontProperties = new CFontProperties();
oCFRun.FontProperties->SetFont(pTheme->m_arFonts[m_lFontRef]);
}
if (m_oLayoutStyles.m_pLevels[lLevel].is_init())
{
oCFRun.ApplyAfter(m_oLayoutStyles.m_pLevels[lLevel]->m_oCFRun);
}
if (m_oStyles.m_pLevels[lLevel].is_init())
{
oCFRun.ApplyAfter(m_oStyles.m_pLevels[lLevel]->m_oCFRun);
}
sText += _T("\n");
strInfoCFs += oCFRun.ToString(1);
lCountParMem += 1;
}
for (size_t nIndexCF = 0; nIndexCF < nCountCFs; ++nIndexCF)
{
LONG lCountCFMem = m_arParagraphs[nIndexPF].m_arSpans[nIndexCF].m_strText.GetLength();
sText += m_arParagraphs[nIndexPF].m_arSpans[nIndexCF].m_strText;
CTextCFRun oCFRun;
if (-1 != m_lTextType && pTheme->m_pStyles[m_lTextType].m_pLevels[lLevel].is_init())
{
oCFRun.ApplyAfter(pTheme->m_pStyles[m_lTextType].m_pLevels[lLevel]->m_oCFRun);
}
if (-1 != m_lFontRef)
{
oCFRun.Typeface = (WORD)m_lFontRef;
if (!oCFRun.FontProperties.is_init())
oCFRun.FontProperties = new CFontProperties();
oCFRun.FontProperties->SetFont(pTheme->m_arFonts[m_lFontRef]);
}
if (m_oLayoutStyles.m_pLevels[lLevel].is_init())
{
oCFRun.ApplyAfter(m_oLayoutStyles.m_pLevels[lLevel]->m_oCFRun);
}
if (m_oStyles.m_pLevels[lLevel].is_init())
{
oCFRun.ApplyAfter(m_oStyles.m_pLevels[lLevel]->m_oCFRun);
}
oCFRun.ApplyAfter(m_arParagraphs[nIndexPF].m_arSpans[nIndexCF].m_oRun);
strInfoCFs += oCFRun.ToString(lCountCFMem);
lCountParMem += lCountCFMem;
}
strInfoPars += oPFRun.ToString(lCountParMem);
}
//
NormalizeString(sText);
strText += (_T("text='") + sText + _T("' "));
strText += (_T("vertical='") + NSPresentationEditor::BoolToString(m_bVertical == true) + _T("' "));
strText += (_T("righttoleft='") + NSPresentationEditor::BoolToString(m_bRightToLeft == true) + _T("' "));
strText += (_T("widthmm='") + NSPresentationEditor::ToString(pMetricInfo.m_lMillimetresHor) + _T("' "));
strText += (_T("heightmm='") + NSPresentationEditor::ToString(pMetricInfo.m_lMillimetresVer) + _T("' "));
strText += (_T("widthl='") + NSPresentationEditor::ToString(pMetricInfo.m_lUnitsHor) + _T("' "));
strText += (_T("heightl='") + NSPresentationEditor::ToString(pMetricInfo.m_lUnitsVer) + _T("' "));
strText += _T(">");
strText += m_oAttributes.ToString();
strText += strInfoPars;
strText += strInfoCFs;
CString strTimeLine = _T("");
strTimeLine.Format(_T("<timeline type='1' begin='%lf' end='%lf' fadein='0' fadeout='0' completeness='1.0'/>"),
dStartTime, dEndTime);
return strText + strTimeLine + _T("</ImagePaint-DrawTextEx>");
return L"";
}
void CTextAttributesEx::RecalcParagraphsPPT(CTheme* pTheme)
......@@ -184,10 +16,11 @@ namespace NSPresentationEditor
int lCountCFs = m_arParagraphs[i].m_arSpans.size();
for (int j = 0; j < lCountCFs; ++j)
{
CString s = m_arParagraphs[i].m_arSpans[j].m_strText;
int s_size = s.GetLength();
int lFound1 = m_arParagraphs[i].m_arSpans[j].m_strText.Find((TCHAR)13);
int lFound2 = m_arParagraphs[i].m_arSpans[j].m_strText.Find((TCHAR)11);
std::wstring s = m_arParagraphs[i].m_arSpans[j].m_strText;
int s_size = s.length();
int lFound1 = m_arParagraphs[i].m_arSpans[j].m_strText.find((TCHAR)13);
int lFound2 = m_arParagraphs[i].m_arSpans[j].m_strText.find((TCHAR)11);
int lFoundEnter = (lFound1>=0 && lFound2>=0) ? (std::min)(lFound1, lFound2) : (lFound1>=0 ? lFound1 : (lFound2>=0 ? lFound2 : -1));
......@@ -201,8 +34,8 @@ namespace NSPresentationEditor
m_arParagraphs[i].m_arSpans.erase(m_arParagraphs[i].m_arSpans.begin() + (j + 1), m_arParagraphs[i].m_arSpans.begin() + lCountCFs );
}
LONG lCountTx = m_arParagraphs[i].m_arSpans[j].m_strText.GetLength();
m_arParagraphs[i].m_arSpans[j].m_strText.Delete(lFoundEnter, lCountTx - lFoundEnter);
LONG lCountTx = m_arParagraphs[i].m_arSpans[j].m_strText.length();
m_arParagraphs[i].m_arSpans[j].m_strText.erase(lFoundEnter, lCountTx - lFoundEnter);
if (j > 0)
oNewPar.m_arSpans.erase(oNewPar.m_arSpans.begin(), oNewPar.m_arSpans.begin() + j);
......@@ -210,7 +43,7 @@ namespace NSPresentationEditor
if (lFoundEnter == (lCountTx - 1))
oNewPar.m_arSpans.erase(oNewPar.m_arSpans.begin(), oNewPar.m_arSpans.begin() + 1);
else
oNewPar.m_arSpans[0].m_strText.Delete(0, lFoundEnter + 1);
oNewPar.m_arSpans[0].m_strText.erase(0, lFoundEnter + 1);
if (0 != oNewPar.m_arSpans.size())
m_arParagraphs.insert(m_arParagraphs.begin() +i + 1, oNewPar);
......@@ -242,7 +75,7 @@ namespace NSPresentationEditor
nullable_base<LONG> indent;
nullable_base<LONG> margin;
if (-1 != m_lTextType && pTheme->m_pStyles[m_lTextType].m_pLevels[lLevel].is_init())
if (-1 != m_lTextType && m_lTextType < 4 && pTheme->m_pStyles[m_lTextType].m_pLevels[lLevel].is_init())
{
if (pTheme->m_pStyles[m_lTextType].m_pLevels[lLevel]->m_oPFRun.hasBullet.is_init())
hasBullet = pTheme->m_pStyles[m_lTextType].m_pLevels[lLevel]->m_oPFRun.hasBullet;
......@@ -471,4 +304,69 @@ namespace NSPresentationEditor
}
}
void CTextAttributesEx::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;
};
}
}
......@@ -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);
......
#include "ShapeWriter.h"
#include "StylesWriter.h"
#include "../../ASCOfficeXlsFile2/source/XlsXlsxConverter/ShapeType.h"
#include "../../Common/MS-LCID.h"
const double EMU_MM = 36000;
void CStylesWriter::ConvertStyleLevel(NSPresentationEditor::CTextStyleLevel& oLevel, NSPresentationEditor::CMetricInfo& oMetricInfo,
NSPresentationEditor::CStringWriter& oWriter, const int& nLevel)
{// CTextPFRun CTextCFRun ShapeWriter - todooo -
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->textDirection.is_init())
{
if (pPF->textDirection.get() == 1) oWriter.WriteString(std::wstring(L" rtl=\"1\""));
else oWriter.WriteString(std::wstring(L" rtl=\"0\""));
}
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())
{
if (pPF->bulletColor.is_init())
{
oWriter.WriteString(std::wstring(L"<a:buClr>"));
oWriter.WriteString(NSPresentationEditor::CShapeWriter::ConvertColor(pPF->bulletColor.get(), 255));
oWriter.WriteString(std::wstring(L"</a:buClr>"));
}
if (pPF->bulletSize.is_init())
{
if (pPF->bulletSize.get() > 24 && pPF->bulletSize.get() < 401)
{
CString str;
str.Format(_T("<a:buSzPct val=\"%d\"/>"), pPF->bulletSize.get() * 1000 );
oWriter.WriteString(str);
}
if (pPF->bulletSize.get() < 0 && pPF->bulletSize.get() > -4001)
{
CString str;
str.Format(_T("<a:buSzPts val=\"%d\"/>"), - pPF->bulletSize.get() );
oWriter.WriteString(str);
}
}
if (pPF->bulletFontProperties.is_init())
{
oWriter.WriteString(std::wstring(L"<a:buFont typeface=\"") + pPF->bulletFontProperties->strFontName + _T("\"/>"));
}
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\""));
}
if (pCF->Language.is_init())
{
std::wstring str_lang = msLCID2wstring(pCF->Language.get());
if (str_lang.length() > 0)
oWriter.WriteString(std::wstring(L" lang=\"") + str_lang + _T("\""));
}
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::CShapeWriter::CShapeWriter()
{
m_pRels = NULL;
......@@ -431,8 +673,21 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
m_oWriter.WriteString(" anchor=\"t\"");
else if (m_pShapeElement->m_oShape.m_oText.m_oAttributes.m_nTextAlignVertical == 2 )
m_oWriter.WriteString(" anchor=\"b\"");
else if (m_pShapeElement->m_oShape.m_oText.m_oAttributes.m_nTextAlignVertical == 1 )
else if (m_pShapeElement->m_oShape.m_oText.m_oAttributes.m_nTextAlignVertical == 1 )
{
m_oWriter.WriteString(" anchor=\"ctr\"");
m_oWriter.WriteString(" anchorCtr=\"0\"");
}
if (m_pShapeElement->m_oShape.m_oText.m_oAttributes.m_dTextRotate > 0)
{
CString strProp;
strProp.Format(_T(" rot=\"%d\""), (int)(m_pShapeElement->m_oShape.m_oText.m_oAttributes.m_dTextRotate * 60000));
m_oWriter.WriteString(strProp);
}
if (m_pShapeElement->m_oShape.m_oText.m_bVertical)
{
m_oWriter.WriteString(" vert=\"eaVert\"");
}
m_oWriter.WriteString(std::wstring(L">"));
if (m_bWordArt)
......@@ -466,6 +721,11 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
NSPresentationEditor::CTextPFRun* pPF = &pParagraph->m_oPFRun;
if (pPF->textDirection.is_init())
{
if (pPF->textDirection.get() == 1) m_oWriter.WriteString(std::wstring(L" rtl=\"1\""));
else m_oWriter.WriteString(std::wstring(L" rtl=\"0\""));
}
if (pPF->fontAlign.is_init())
{
CString strProp = CStylesWriter::GetFontAlign(pPF->fontAlign.get());
......@@ -473,7 +733,7 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
}
if (pPF->leftMargin.is_init())
{
CString strProp = _T("");
CString strProp;
strProp.Format(_T(" marL=\"%d\""), pPF->leftMargin.get());
m_oWriter.WriteString(strProp);
if (pPF->indent.is_init() == false)
......@@ -501,7 +761,7 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
CString _str2 = _T(">");
m_oWriter.WriteString(_str2);
double dKoef1 = 3.52777778;
double dKoef1 = 3.52777778; // :-) ...
if (pPF->lineSpacing.is_init())
{
LONG val = pPF->lineSpacing.get();
......@@ -615,12 +875,12 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
{
if (TRUE)
{
if ((nSpan == (nCountSpans - 1)) && (_T("\n") == pParagraph->m_arSpans[nSpan].m_strText || pParagraph->m_arSpans[nSpan].m_strText.IsEmpty()) )
if ((nSpan == (nCountSpans - 1)) && (_T("\n") == pParagraph->m_arSpans[nSpan].m_strText || pParagraph->m_arSpans[nSpan].m_strText.empty()) )
{
NSPresentationEditor::CTextCFRun* pCF = &pParagraph->m_arSpans[nSpan].m_oRun;
if (pCF->Size.is_init())
if ((pCF->Size.is_init()) && (pCF->Size.get() > 0) && (pCF->Size.get() < 4001))
{
CString strProp = _T("");
CString strProp;
strProp.Format(_T("<a:endParaRPr lang=\"en-US\" sz=\"%d\"/>"), (int)(100 * pCF->Size.get()));
m_oWriter.WriteString(strProp);
}
......@@ -632,12 +892,12 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
}
}
if (pParagraph->m_arSpans[nSpan].m_strText.IsEmpty()) continue;
if (pParagraph->m_arSpans[nSpan].m_strText.empty()) continue;
NSPresentationEditor::CTextCFRun* pCF = &pParagraph->m_arSpans[nSpan].m_oRun;
bool bIsBr = false;
int span_sz = pParagraph->m_arSpans[nSpan].m_strText.GetLength() ;
int span_sz = pParagraph->m_arSpans[nSpan].m_strText.length() ;
if ((span_sz==1 && ( pParagraph->m_arSpans[nSpan].m_strText[0] == (TCHAR)13 )) ||
((span_sz==2 && ( pParagraph->m_arSpans[nSpan].m_strText[0] == (TCHAR)13 ) && ( pParagraph->m_arSpans[nSpan].m_strText[1] == (TCHAR)13 ))))
{
......@@ -664,7 +924,7 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
}
}
if (pCF->Size.is_init())
if ((pCF->Size.is_init()) && (pCF->Size.get() > 0) && (pCF->Size.get() < 4001))
{
CString strProp = _T("");
strProp.Format(_T(" sz=\"%d\""), (int)(100 * pCF->Size.get()));
......@@ -692,6 +952,37 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
else
m_oWriter.WriteString(std::wstring(L" u=\"none\""));
}
if (pCF->Language.is_init())
{
std::wstring str_lang = msLCID2wstring(pCF->Language.get());
//#if defined(_WIN32) || defined(_WIN64)
// wchar_t buf[29] = {};
//
// int ccBuf = GetLocaleInfo(pCF->Language.get(), LOCALE_SISO639LANGNAME, buf, 29);
//
// if (ccBuf > 0)
// {
// str_lang.append(buf);
// str_lang.append(_T("-"));
// }
//
// ccBuf = GetLocaleInfo(pCF->Language.get(), LOCALE_SISO3166CTRYNAME, buf, 29);
//
// if (ccBuf > 0) str_lang.append(buf);
//#else
// for (int i = 0; i < 136; i++)
// {
// if (LCID_ms_convert[i].LCID_int == pCF->Language.get())
// {
// str_lang = LCID_ms_convert[i].LCID_string;
// break;
// }
// }
//#endif
if (str_lang.length() > 0)
m_oWriter.WriteString(std::wstring(L" lang=\"") + str_lang + _T("\""));
}
m_oWriter.WriteString(std::wstring(L">"));
if (m_bWordArt)
......@@ -743,7 +1034,7 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
CString strT1 = _T("<a:t>");
m_oWriter.WriteString(strT1);
CString strT = pParagraph->m_arSpans[nSpan].m_strText;
std::wstring strT = pParagraph->m_arSpans[nSpan].m_strText;
NSPresentationEditor::CorrectXmlString(strT);
m_oWriter.WriteString(strT);
......@@ -776,7 +1067,8 @@ CString NSPresentationEditor::CShapeWriter::ConvertShape()
if (m_pShapeElement == NULL) return _T("");
std::wstring prstTxWarp;
std::wstring prstGeom = oox::Spt2ShapeType((oox::MSOSPT)m_pShapeElement->m_lShapeType);
std::wstring prstGeom = oox::Spt2ShapeType_mini((oox::MSOSPT)m_pShapeElement->m_lShapeType);
//rect, ellipse, line
if (prstGeom.empty())
{
......@@ -793,6 +1085,8 @@ CString NSPresentationEditor::CShapeWriter::ConvertShape()
{
if (oox::msosptTextBox == (oox::MSOSPT)m_pShapeElement->m_lShapeType)
m_bTextBox = true;
if (oox::msosptLine == (oox::MSOSPT)m_pShapeElement->m_lShapeType)
m_pShapeElement->m_bLine = true;
}
m_oWriter.WriteString(std::wstring(L"<p:sp>"));
......@@ -849,7 +1143,7 @@ CString NSPresentationEditor::CShapeWriter::ConvertShape()
m_pShapeElement->m_oShape.ToRenderer(dynamic_cast<IRenderer*>(this), oInfo, m_oMetricInfo, 0.0, 1.0);
}
if ((/*prstGeom.empty() == false || */m_pShapeElement->m_bShapePreset) && prstTxWarp.empty())
if ((prstGeom.empty() == false || m_pShapeElement->m_bShapePreset) && prstTxWarp.empty())
{
if (prstGeom.empty()) prstGeom = L"rect";
m_oWriter.WriteString(std::wstring(L"<a:prstGeom"));
......
......@@ -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