Commit 6f495161 authored by ElenaSubbotina's avatar ElenaSubbotina

RtfFormatReader - review, ...

parent b7842e18
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
typedef enum{ mu_none, mu_Auto, mu_Percent, mu_Twips } MetricUnits; enum _MetricUnits{ mu_none, mu_Auto, mu_Percent, mu_Twips };
class RenderParameter class RenderParameter
...@@ -252,7 +252,7 @@ public: ...@@ -252,7 +252,7 @@ public:
if( TYPE_RTF_PARAGRAPH == m_aArray[i]->GetType() && i != (int)m_aArray.size() - 1) if( TYPE_RTF_PARAGRAPH == m_aArray[i]->GetType() && i != (int)m_aArray.size() - 1)
{ {
sResult += _T("\\par") ; sResult += L"\\par";
} }
} }
return sResult; return sResult;
......
...@@ -1098,7 +1098,7 @@ class AllPictReader : public RtfAbstractReader ...@@ -1098,7 +1098,7 @@ class AllPictReader : public RtfAbstractReader
private: private:
RtfShape& m_oShape; RtfShape& m_oShape;
public: public:
AllPictReader( RtfShape& oShape ):m_oShape(oShape) AllPictReader( RtfShape& oShape ) : m_oShape(oShape)
{ {
} }
bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter) bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter)
...@@ -1128,7 +1128,12 @@ public: ...@@ -1128,7 +1128,12 @@ public:
StartSubReader( oPictureReader, oDocument, oReader ); StartSubReader( oPictureReader, oDocument, oReader );
} }
else else
{
bool res = RtfCharPropsCommand::ExecuteCommand( oDocument, oReader, sCommand, hasParameter, parameter, &m_oShape.m_oCharProperty );
if (res) return true;
return false; return false;
}
return true; return true;
} }
}; };
...@@ -1613,29 +1618,29 @@ public: ...@@ -1613,29 +1618,29 @@ public:
//public: //public:
// bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter) // bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter)
// { // {
// if( _T("lsdlockedexcept") == sCommand ) // if( L"lsdlockedexcept" == sCommand )
// return true; // return true;
// else if( _T("lsdpriority") == sCommand ) // else if( L"lsdpriority" == sCommand )
// { // {
// if( true == hasParameter ) // if( true == hasParameter )
// m_oCurException.m_nPriority = parameter; // m_oCurException.m_nPriority = parameter;
// } // }
// else if( _T("lsdunhideused") == sCommand ) // else if( L"lsdunhideused" == sCommand )
// { // {
// if( true == hasParameter ) // if( true == hasParameter )
// m_oCurException.m_nHiddenWhenUse = parameter; // m_oCurException.m_nHiddenWhenUse = parameter;
// } // }
// else if( _T("lsdqformat") == sCommand ) // else if( L"lsdqformat" == sCommand )
// { // {
// if( true == hasParameter ) // if( true == hasParameter )
// m_oCurException.m_nQFormat = parameter; // m_oCurException.m_nQFormat = parameter;
// } // }
// else if( _T("lsdlocked") == sCommand ) // else if( L"lsdlocked" == sCommand )
// { // {
// if( true == hasParameter ) // if( true == hasParameter )
// m_oCurException.m_nLocked = parameter; // m_oCurException.m_nLocked = parameter;
// } // }
// else if( _T("lsdsemihidden") == sCommand ) // else if( L"lsdsemihidden" == sCommand )
// { // {
// if( true == hasParameter ) // if( true == hasParameter )
// m_oCurException.m_nSemiHidden = parameter; // m_oCurException.m_nSemiHidden = parameter;
...@@ -1666,39 +1671,39 @@ public: ...@@ -1666,39 +1671,39 @@ public:
//{ //{
//public: bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter) //public: bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter)
// { // {
// if( _T("latentstyles") == sCommand ) // if( L"latentstyles" == sCommand )
// return true; // return true;
// else if( _T("lsdstimax") == sCommand ) // else if( L"lsdstimax" == sCommand )
// { // {
// if( true == hasParameter ) // if( true == hasParameter )
// oDocument.m_oLatentStyleTable.m_nCount = parameter; // oDocument.m_oLatentStyleTable.m_nCount = parameter;
// } // }
// else if( _T("lsdlockeddef") == sCommand ) // else if( L"lsdlockeddef" == sCommand )
// { // {
// if( true == hasParameter ) // if( true == hasParameter )
// oDocument.m_oLatentStyleTable.m_nLocked = parameter; // oDocument.m_oLatentStyleTable.m_nLocked = parameter;
// } // }
// else if( _T("lsdsemihiddendef") == sCommand ) // else if( L"lsdsemihiddendef" == sCommand )
// { // {
// if( true == hasParameter ) // if( true == hasParameter )
// oDocument.m_oLatentStyleTable.m_nSemiHidden = parameter; // oDocument.m_oLatentStyleTable.m_nSemiHidden = parameter;
// } // }
// else if( _T("lsdunhideuseddef") == sCommand ) // else if( L"lsdunhideuseddef" == sCommand )
// { // {
// if( true == hasParameter ) // if( true == hasParameter )
// oDocument.m_oLatentStyleTable.m_nUnHiddenWhenUse = parameter; // oDocument.m_oLatentStyleTable.m_nUnHiddenWhenUse = parameter;
// } // }
// else if( _T("lsdqformatdef") == sCommand ) // else if( L"lsdqformatdef" == sCommand )
// { // {
// if( true == hasParameter ) // if( true == hasParameter )
// oDocument.m_oLatentStyleTable.m_nQFormat = parameter; // oDocument.m_oLatentStyleTable.m_nQFormat = parameter;
// } // }
// else if( _T("lsdprioritydef") == sCommand ) // else if( L"lsdprioritydef" == sCommand )
// { // {
// if( true == hasParameter ) // if( true == hasParameter )
// oDocument.m_oLatentStyleTable.m_nPriority = parameter; // oDocument.m_oLatentStyleTable.m_nPriority = parameter;
// } // }
// else if( _T("lsdlockedexcept") == sCommand ) // else if( L"lsdlockedexcept" == sCommand )
// { // {
// LockedExeceptReader oExceptionReader; // LockedExeceptReader oExceptionReader;
// StartSubReader( oExceptionReader, oDocument, oReader ); // StartSubReader( oExceptionReader, oDocument, oReader );
...@@ -2188,11 +2193,11 @@ private: ...@@ -2188,11 +2193,11 @@ private:
} }
bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter) bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter)
{ {
if( _T("lfolevel") == sCommand) if( L"lfolevel" == sCommand)
return true; return true;
COMMAND_RTF_INT( _T("listoverrideformat"), m_oOverrideLevel.m_nLevelIndex, sCommand, hasParameter, parameter ) COMMAND_RTF_INT( L"listoverrideformat", m_oOverrideLevel.m_nLevelIndex, sCommand, hasParameter, parameter )
COMMAND_RTF_INT( _T("listoverridestartat"), m_oOverrideLevel.m_nStart, sCommand, hasParameter, parameter ) COMMAND_RTF_INT( L"listoverridestartat", m_oOverrideLevel.m_nStart, sCommand, hasParameter, parameter )
else if( _T("listlevel") == sCommand ) else if( L"listlevel" == sCommand )
{ {
m_oOverrideLevel.m_oLevel.m_nLevel = m_oOverrideLevel.m_nLevelIndex; m_oOverrideLevel.m_oLevel.m_nLevel = m_oOverrideLevel.m_nLevelIndex;
ListTableReader::ListReader::ListLevelReader oListLevelReader( m_oOverrideLevel.m_oLevel ); ListTableReader::ListReader::ListLevelReader oListLevelReader( m_oOverrideLevel.m_oLevel );
...@@ -2211,19 +2216,19 @@ private: ...@@ -2211,19 +2216,19 @@ private:
} }
bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter) bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter)
{ {
if( _T("listoverride") == sCommand) if( L"listoverride" == sCommand)
return true; return true;
else if( _T("listid") == sCommand ) else if( L"listid" == sCommand )
{ {
if( true == hasParameter ) if( true == hasParameter )
m_oProperty.m_nListID = parameter; m_oProperty.m_nListID = parameter;
} }
else if( _T("ls") == sCommand ) else if( L"ls" == sCommand )
{ {
if( true == hasParameter ) if( true == hasParameter )
m_oProperty.m_nIndex = parameter; m_oProperty.m_nIndex = parameter;
} }
else if( _T("lfolevel") == sCommand ) else if( L"lfolevel" == sCommand )
{ {
RtfListOverrideProperty::ListOverrideLevels::ListOverrideLevel oOverrideLevel; RtfListOverrideProperty::ListOverrideLevels::ListOverrideLevel oOverrideLevel;
lfolevelReader olfolevelReader( oOverrideLevel ); lfolevelReader olfolevelReader( oOverrideLevel );
...@@ -2241,9 +2246,9 @@ public: ...@@ -2241,9 +2246,9 @@ public:
} }
bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter) bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter)
{ {
if( _T("listoverridetable") == sCommand ) if( L"listoverridetable" == sCommand )
return true; return true;
else if( _T("listoverride") == sCommand) else if( L"listoverride" == sCommand)
{ {
RtfListOverrideProperty oProperty; RtfListOverrideProperty oProperty;
ListOverrideReader oListOverrideReader( oProperty ); ListOverrideReader oListOverrideReader( oProperty );
......
...@@ -79,14 +79,14 @@ public: ...@@ -79,14 +79,14 @@ public:
CString Generate_rId() CString Generate_rId()
{ {
CString sResult; CString sResult;
sResult.AppendFormat( _T("rId%d"), m_nrIdCount++ ); sResult.AppendFormat( L"rId%d", m_nrIdCount++ );
return sResult; return sResult;
} }
CString Generate_FitTextId() CString Generate_FitTextId()
{ {
CString sResult; CString sResult;
sResult.AppendFormat( _T("%d"), m_nFitTextIdCount++ ); sResult.AppendFormat( L"%d", m_nFitTextIdCount++ );
return sResult; return sResult;
} }
...@@ -134,8 +134,8 @@ public: ...@@ -134,8 +134,8 @@ public:
CString Generate_OleId() CString Generate_OleId()
{ {
CString sId; CString sId;
sId.AppendFormat( _T("%d"), m_nOleId++ ); sId.AppendFormat( L"%d", m_nOleId++ );
CString sResult = _T("_1330071130"); CString sResult = L"_1330071130";
sResult = sResult.Left( sResult.GetLength() - sId.GetLength() ); sResult = sResult.Left( sResult.GetLength() - sId.GetLength() );
sResult += sId; sResult += sId;
return sResult; return sResult;
......
...@@ -47,47 +47,47 @@ public: ...@@ -47,47 +47,47 @@ public:
//if( TRUE == oXmlReader.OpenFromXmlNode( oParam.oNode ) ) //if( TRUE == oXmlReader.OpenFromXmlNode( oParam.oNode ) )
//{ //{
// CString sThemeColor = oXmlReader.ReadNodeAttribute(sTheme, _T("") ); // CString sThemeColor = oXmlReader.ReadNodeAttribute(sTheme, L"" );
// CString themeShade = oXmlReader.ReadNodeAttribute(sThemeShade, _T("0") ); // CString themeShade = oXmlReader.ReadNodeAttribute(sThemeShade, L"0" );
// CString themeTint = oXmlReader.ReadNodeAttribute(sThemeTint, _T("255") ); // CString themeTint = oXmlReader.ReadNodeAttribute(sThemeTint, L"255" );
// CString val = oXmlReader.ReadNodeAttribute(sColor, _T("") ); // CString val = oXmlReader.ReadNodeAttribute(sColor, L"" );
// if( _T("") != sThemeColor ) // if( !sThemeColor.IsEmpty() )
// { // {
// //Todo tx1 - моджет приходить text1 // //Todo tx1 - моджет приходить text1
// RtfColor::ThemeColor oTheme = RtfColor::TC_NONE; // RtfColor::ThemeColor oTheme = RtfColor::TC_NONE;
// if( sThemeColor == _T("accent1") ) // if( sThemeColor == L"accent1" )
// oTheme = RtfColor::caccentone; // oTheme = RtfColor::caccentone;
// else if( sThemeColor == _T("accent2") ) // else if( sThemeColor == L"accent2" )
// oTheme = RtfColor::caccenttwo; // oTheme = RtfColor::caccenttwo;
// else if( sThemeColor == _T("accent3") ) // else if( sThemeColor == L"accent3" )
// oTheme = RtfColor::caccentthree; // oTheme = RtfColor::caccentthree;
// else if( sThemeColor == _T("accent4") ) // else if( sThemeColor == L"accent4" )
// oTheme = RtfColor::caccentfour; // oTheme = RtfColor::caccentfour;
// else if( sThemeColor == _T("accent5") ) // else if( sThemeColor == L"accent5" )
// oTheme = RtfColor::caccentfive; // oTheme = RtfColor::caccentfive;
// else if( sThemeColor == _T("accent6") ) // else if( sThemeColor == L"accent6" )
// oTheme = RtfColor::caccentsix; // oTheme = RtfColor::caccentsix;
// else if( sThemeColor == _T("bg1") ) // else if( sThemeColor == L"bg1" )
// oTheme = RtfColor::cbackgroundone; // oTheme = RtfColor::cbackgroundone;
// else if( sThemeColor == _T("bg2") ) // else if( sThemeColor == L"bg2" )
// oTheme = RtfColor::cbackgroundtwo; // oTheme = RtfColor::cbackgroundtwo;
// else if( sThemeColor == _T("dk1") ) // else if( sThemeColor == L"dk1" )
// oTheme = RtfColor::cmaindarkone; // oTheme = RtfColor::cmaindarkone;
// else if( sThemeColor == _T("dk2") ) // else if( sThemeColor == L"dk2" )
// oTheme = RtfColor::cmaindarktwo; // oTheme = RtfColor::cmaindarktwo;
// else if( sThemeColor == _T("folHlink") ) // else if( sThemeColor == L"folHlink" )
// oTheme = RtfColor::cfollowedhyperlink; // oTheme = RtfColor::cfollowedhyperlink;
// else if( sThemeColor == _T("hlink") ) // else if( sThemeColor == L"hlink" )
// oTheme = RtfColor::chyperlink; // oTheme = RtfColor::chyperlink;
// else if( sThemeColor == _T("lt1") ) // else if( sThemeColor == L"lt1" )
// oTheme = RtfColor::cmainlightone; // oTheme = RtfColor::cmainlightone;
// else if( sThemeColor == _T("lt2") ) // else if( sThemeColor == L"lt2" )
// oTheme = RtfColor::cmainlighttwo; // oTheme = RtfColor::cmainlighttwo;
// else if( sThemeColor == _T("phClr") ) // else if( sThemeColor == L"phClr" )
// oTheme = RtfColor::cmainlighttwo; // oTheme = RtfColor::cmainlighttwo;
// else if( sThemeColor == _T("tx1") ) // else if( sThemeColor == L"tx1" )
// oTheme = RtfColor::ctextone; // oTheme = RtfColor::ctextone;
// else if( sThemeColor = _T("tx2") ) // else if( sThemeColor = L"tx2" )
// oTheme = RtfColor::ctexttwo; // oTheme = RtfColor::ctexttwo;
// if( true == oParam.oRtf->m_oColorTable.GetColor( oTheme , oOutputColor ) ) // if( true == oParam.oRtf->m_oColorTable.GetColor( oTheme , oOutputColor ) )
...@@ -118,7 +118,7 @@ public: ...@@ -118,7 +118,7 @@ public:
// return false; // return false;
// } // }
// else if( _T("auto") != val ) // else if( L"auto" != val )
// { // {
// oOutputColor.SetHEXString( val ); // oOutputColor.SetHEXString( val );
// return true; // return true;
......
...@@ -98,15 +98,15 @@ public: ...@@ -98,15 +98,15 @@ public:
oNewColor.m_eTheme = RtfColor::cfollowedhyperlink; oNewColor.m_eTheme = RtfColor::cfollowedhyperlink;
oParam.oRtf->m_oColorTable.AddItem( oNewColor ); oParam.oRtf->m_oColorTable.AddItem( oNewColor );
//else if( _T("a:bg1") == sNodeName ) //else if( L"a:bg1" == sNodeName )
// oNewColor.m_eTheme = RtfColor::cbackgroundone; // oNewColor.m_eTheme = RtfColor::cbackgroundone;
//else if( _T("a:bg2") == sNodeName ) //else if( L"a:bg2" == sNodeName )
// oNewColor.m_eTheme = RtfColor::cbackgroundtwo; // oNewColor.m_eTheme = RtfColor::cbackgroundtwo;
//else if( _T("a:phClr") == sNodeName ) //else if( L"a:phClr" == sNodeName )
// oNewColor.m_eTheme = RtfColor::cmainlighttwo; // oNewColor.m_eTheme = RtfColor::cmainlighttwo;
//else if( _T("a:tx1") == sNodeName ) //else if( L"a:tx1" == sNodeName )
// oNewColor.m_eTheme = RtfColor::ctextone; // oNewColor.m_eTheme = RtfColor::ctextone;
//else if( _T("a:tx2") == sNodeName ) //else if( L"a:tx2" == sNodeName )
// oNewColor.m_eTheme = RtfColor::ctexttwo; // oNewColor.m_eTheme = RtfColor::ctexttwo;
......
...@@ -72,7 +72,7 @@ bool OOXPictureGraphicReader::Parse( ReaderParameter oParam , RtfShape& oOutput) ...@@ -72,7 +72,7 @@ bool OOXPictureGraphicReader::Parse( ReaderParameter oParam , RtfShape& oOutput)
OOX::Image* pImage = (OOX::Image*)oFile.operator->(); OOX::Image* pImage = (OOX::Image*)oFile.operator->();
CString sImagePath = pImage->filename().GetPath(); CString sImagePath = pImage->filename().GetPath();
bTryPicture = WriteDataToPicture( sImagePath, *oOutput.m_oPicture, _T("") ); bTryPicture = WriteDataToPicture( sImagePath, *oOutput.m_oPicture, L"" );
} }
} }
} }
......
...@@ -119,25 +119,26 @@ public: ...@@ -119,25 +119,26 @@ public:
CString sFont; CString sFont;
CString sTempFont; CString sTempFont;
if( _T("") != sAscii )
if( !sAscii.IsEmpty() )
sFont = sAscii; sFont = sAscii;
else if( _T("") != sAsciiTheme && _T("") != GetThemeFont(sAsciiTheme, *oParam.oReader) ) else if( !sAsciiTheme.IsEmpty() && !GetThemeFont(sAsciiTheme, *oParam.oReader).IsEmpty() )
sFont = GetThemeFont(sAsciiTheme, *oParam.oReader); sFont = GetThemeFont(sAsciiTheme, *oParam.oReader);
else if( _T("") != sHAnsi ) else if( !sHAnsi.IsEmpty() )
sFont = sHAnsi; sFont = sHAnsi;
else if( _T("") != sHAnsiTheme && _T("") != GetThemeFont(sHAnsiTheme, *oParam.oReader) ) else if( !sHAnsiTheme.IsEmpty() && !GetThemeFont(sHAnsiTheme, *oParam.oReader).IsEmpty() )
sFont = GetThemeFont(sHAnsiTheme, *oParam.oReader); sFont = GetThemeFont(sHAnsiTheme, *oParam.oReader);
else if( _T("") != sCs ) else if( !sCs.IsEmpty() )
sFont = sCs; sFont = sCs;
else if( _T("") != sCsTheme && _T("") != GetThemeFont(sCsTheme, *oParam.oReader) ) else if( !sCsTheme.IsEmpty() && !GetThemeFont(sCsTheme, *oParam.oReader).IsEmpty() )
sFont = GetThemeFont(sCsTheme, *oParam.oReader); sFont = GetThemeFont(sCsTheme, *oParam.oReader);
else if( _T("") != sEastAsia ) else if( !sEastAsia.IsEmpty() )
sFont = sEastAsia; sFont = sEastAsia;
else if( _T("") != sEastAsiaTheme && _T("") != GetThemeFont(sEastAsiaTheme, *oParam.oReader) ) else if( !sEastAsiaTheme.IsEmpty() && !GetThemeFont(sEastAsiaTheme, *oParam.oReader).IsEmpty() )
sFont = GetThemeFont(sEastAsiaTheme, *oParam.oReader); sFont = GetThemeFont(sEastAsiaTheme, *oParam.oReader);
if( _T("") != sFont ) if( !sFont.IsEmpty() )
{ {
RtfFont oCurFont; RtfFont oCurFont;
if( true == oParam.oRtf->m_oFontTable.GetFont( sFont, oCurFont ) ) if( true == oParam.oRtf->m_oFontTable.GetFont( sFont, oCurFont ) )
...@@ -156,22 +157,15 @@ private: ...@@ -156,22 +157,15 @@ private:
CString GetThemeFont( CString sTheme, OOXReader & oReader ) CString GetThemeFont( CString sTheme, OOXReader & oReader )
{ {
CString sFont; CString sFont;
if( _T("majorAscii") == sTheme ) if ( L"majorAscii" == sTheme ) sFont = oReader.m_smajorAscii;
sFont = oReader.m_smajorAscii; else if ( L"majorBidi" == sTheme ) sFont = oReader.m_smajorBidi;
else if( _T("majorBidi") == sTheme ) else if ( L"majorEastAsia" == sTheme ) sFont = oReader.m_smajorEastAsia;
sFont = oReader.m_smajorBidi; else if ( L"majorHAnsi" == sTheme ) sFont = oReader.m_smajorHAnsi;
else if( _T("majorEastAsia") == sTheme ) else if ( L"minorAscii" == sTheme ) sFont = oReader.m_sminorAscii;
sFont = oReader.m_smajorEastAsia; else if ( L"minorBidi" == sTheme ) sFont = oReader.m_sminorBidi;
else if( _T("majorHAnsi") == sTheme ) else if ( L"minorEastAsia" == sTheme ) sFont = oReader.m_sminorEastAsia;
sFont = oReader.m_smajorHAnsi; else if ( L"minorHAnsi" == sTheme ) sFont = oReader.m_sminorHAnsi;
else if( _T("minorAscii") == sTheme )
sFont = oReader.m_sminorAscii;
else if( _T("minorBidi") == sTheme )
sFont = oReader.m_sminorBidi;
else if( _T("minorEastAsia") == sTheme )
sFont = oReader.m_sminorEastAsia;
else if( _T("minorHAnsi") == sTheme )
sFont = oReader.m_sminorHAnsi;
return sFont; return sFont;
} }
}; };
...@@ -45,44 +45,45 @@ public: ...@@ -45,44 +45,45 @@ public:
XmlUtils::CXmlLiteReader oXmlReader; XmlUtils::CXmlLiteReader oXmlReader;
if( TRUE == oXmlReader.OpenFromXmlNode(oParam.oNode) ) if( TRUE == oXmlReader.OpenFromXmlNode(oParam.oNode) )
{ {
CString nCount = oXmlReader.ReadNodeAttribute( _T("w:count") ); CString nCount = oXmlReader.ReadNodeAttribute( L"w:count" );
if( _T("") != nCount ) if( !nCount.IsEmpty() )
oParam.oRtf->m_oLatentStyleTable.m_nCount = Strings::ToInteger( nCount ); oParam.oRtf->m_oLatentStyleTable.m_nCount = Strings::ToInteger( nCount );
CString nLocked = oXmlReader.ReadNodeAttribute( _T("w:defLockedState") ); CString nLocked = oXmlReader.ReadNodeAttribute( L"w:defLockedState" );
if( _T("") != nLocked ) if( !nLocked.IsEmpty() )
oParam.oRtf->m_oLatentStyleTable.m_nLocked= Strings::ToInteger( nLocked ); oParam.oRtf->m_oLatentStyleTable.m_nLocked= Strings::ToInteger( nLocked );
CString nSemiHid = oXmlReader.ReadNodeAttribute( _T("w:defSemiHidden") ); CString nSemiHid = oXmlReader.ReadNodeAttribute( L"w:defSemiHidden" );
if( _T("") != nSemiHid ) if( !nSemiHid.IsEmpty() )
oParam.oRtf->m_oLatentStyleTable.m_nSemiHidden= Strings::ToInteger( nSemiHid ); oParam.oRtf->m_oLatentStyleTable.m_nSemiHidden= Strings::ToInteger( nSemiHid );
CString nUNhidWU = oXmlReader.ReadNodeAttribute( _T("w:defUnhideWhenUsed") ); CString nUNhidWU = oXmlReader.ReadNodeAttribute( L"w:defUnhideWhenUsed" );
if( _T("") != nUNhidWU ) if( !nUNhidWU.IsEmpty() )
oParam.oRtf->m_oLatentStyleTable.m_nUnHiddenWhenUse= Strings::ToInteger( nUNhidWU ); oParam.oRtf->m_oLatentStyleTable.m_nUnHiddenWhenUse= Strings::ToInteger( nUNhidWU );
CString nQFormat = oXmlReader.ReadNodeAttribute( _T("w:defQFormat") ); CString nQFormat = oXmlReader.ReadNodeAttribute( L"w:defQFormat" );
if( _T("") != nQFormat ) if( !nQFormat.IsEmpty() )
oParam.oRtf->m_oLatentStyleTable.m_nQFormat= Strings::ToInteger( nQFormat ); oParam.oRtf->m_oLatentStyleTable.m_nQFormat= Strings::ToInteger( nQFormat );
CString nUIPriority = oXmlReader.ReadNodeAttribute( _T("w:defUIPriority") ); CString nUIPriority = oXmlReader.ReadNodeAttribute( L"w:defUIPriority" );
if( _T("") != nUIPriority ) if( !nUIPriority.IsEmpty() )
oParam.oRtf->m_oLatentStyleTable.m_nPriority= Strings::ToInteger( nUIPriority ); oParam.oRtf->m_oLatentStyleTable.m_nPriority= Strings::ToInteger( nUIPriority );
oXmlReader.ReadNodeList( _T("w:lsdException") ); oXmlReader.ReadNodeList( L"w:lsdException" );
for( int i = 0; i < oXmlReader.GetLengthList(); i++ ) for( int i = 0; i < oXmlReader.GetLengthList(); i++ )
{ {
RtfStyleException oNewException; RtfStyleException oNewException;
oNewException.m_sName = oXmlReader.ReadNodeAttribute( _T("w:name"), _T("") ); oNewException.m_sName = oXmlReader.ReadNodeAttribute( L"w:name", L"" );
CString nPriority = oXmlReader.ReadNodeAttribute( _T("w:uiPriority")); CString nPriority = oXmlReader.ReadNodeAttribute( L"w:uiPriority");
if( _T("") != nPriority )
if( !nPriority.IsEmpty() )
oNewException.m_nPriority = Strings::ToInteger( nPriority ); oNewException.m_nPriority = Strings::ToInteger( nPriority );
CString nHiddenWhenUse = oXmlReader.ReadNodeAttribute( _T("w:unhideWhenUsed") ); CString nHiddenWhenUse = oXmlReader.ReadNodeAttribute( L"w:unhideWhenUsed");
if( _T("") != nHiddenWhenUse ) if( !nHiddenWhenUse.IsEmpty() )
oNewException.m_nHiddenWhenUse = Strings::ToInteger( nHiddenWhenUse ); oNewException.m_nHiddenWhenUse = Strings::ToInteger( nHiddenWhenUse );
CString nQFormat = oXmlReader.ReadNodeAttribute( _T("w:qFormat") ); CString nQFormat = oXmlReader.ReadNodeAttribute( L"w:qFormat" );
if( _T("") != nQFormat ) if( !nQFormat.IsEmpty() )
oNewException.m_nQFormat = Strings::ToInteger( nQFormat ); oNewException.m_nQFormat = Strings::ToInteger( nQFormat );
CString nLocked = oXmlReader.ReadNodeAttribute( _T("w:locked") ); CString nLocked = oXmlReader.ReadNodeAttribute( L"w:locked" );
if( _T("") != nLocked ) if( !nLocked.IsEmpty() )
oNewException.m_nLocked = Strings::ToInteger( nLocked ); oNewException.m_nLocked = Strings::ToInteger( nLocked );
CString nSemiHidden = oXmlReader.ReadNodeAttribute( _T("w:semiHidden") ); CString nSemiHidden = oXmlReader.ReadNodeAttribute( L"w:semiHidden");
if( _T("") != nSemiHidden ) if( !nSemiHidden.IsEmpty() )
oNewException.m_nSemiHidden = Strings::ToInteger( nSemiHidden ); oNewException.m_nSemiHidden = Strings::ToInteger( nSemiHidden );
if( true == oNewException.IsValid() ) if( true == oNewException.IsValid() )
......
...@@ -413,7 +413,7 @@ bool OOXMathReader::ParseElement(ReaderParameter oParam , OOX::WritingElement * ...@@ -413,7 +413,7 @@ bool OOXMathReader::ParseElement(ReaderParameter oParam , OOX::WritingElement *
{ {
rtfMath->m_bIsVal = true; rtfMath->m_bIsVal = true;
RtfCharPtr oChar = RtfCharPtr(new RtfChar); RtfCharPtr oChar = RtfCharPtr(new RtfChar);
CString s; s.AppendFormat( _T("%d"), oFont.m_nID ); CString s; s.AppendFormat( L"%d", oFont.m_nID );
oChar->setText( s ); oChar->setText( s );
rtfMath->m_oVal.AddItem( oChar ); rtfMath->m_oVal.AddItem( oChar );
} }
......
...@@ -177,11 +177,11 @@ bool OOXParagraphReader::Parse2( ReaderParameter oParam , RtfParagraph& oOutputP ...@@ -177,11 +177,11 @@ bool OOXParagraphReader::Parse2( ReaderParameter oParam , RtfParagraph& oOutputP
sTarget = pH->Uri().GetPath(); sTarget = pH->Uri().GetPath();
} }
} }
if( _T("") != sTarget ) if( !sTarget.IsEmpty() )
{ {
//заменяем пробелы на %20 //заменяем пробелы на %20
sTarget.Replace( _T(" "), _T("%20") ); sTarget.Replace( L" ", L"%20" );
CString sFileUrl = _T("file:///"); CString sFileUrl = L"file:///";
if( 0 == sTarget.Find( sFileUrl ) ) if( 0 == sTarget.Find( sFileUrl ) )
{ {
int nFirstDDot = sTarget.Find( ':', sFileUrl.GetLength() ); int nFirstDDot = sTarget.Find( ':', sFileUrl.GetLength() );
...@@ -199,7 +199,7 @@ bool OOXParagraphReader::Parse2( ReaderParameter oParam , RtfParagraph& oOutputP ...@@ -199,7 +199,7 @@ bool OOXParagraphReader::Parse2( ReaderParameter oParam , RtfParagraph& oOutputP
RtfCharPtr oNewChar( new RtfChar() ); RtfCharPtr oNewChar( new RtfChar() );
oNewChar->m_bRtfEncode = true;// false; oNewChar->m_bRtfEncode = true;// false;
CString sFieldText; CString sFieldText;
sFieldText += _T("HYPERLINK \"") + sTarget + _T("\""); sFieldText += L"HYPERLINK \"" + sTarget + L"\"";
oNewChar->setText( sFieldText ); oNewChar->setText( sFieldText );
RtfParagraphPtr oNewInsertParagraph( new RtfParagraph() ); RtfParagraphPtr oNewInsertParagraph( new RtfParagraph() );
oNewInsertParagraph->AddItem( oNewChar ); oNewInsertParagraph->AddItem( oNewChar );
...@@ -207,10 +207,10 @@ bool OOXParagraphReader::Parse2( ReaderParameter oParam , RtfParagraph& oOutputP ...@@ -207,10 +207,10 @@ bool OOXParagraphReader::Parse2( ReaderParameter oParam , RtfParagraph& oOutputP
//добавляем свойства //добавляем свойства
//pHyperlink->m_arrItems todoooo //pHyperlink->m_arrItems todoooo
//BOOL bLock = Strings::ToBoolean(oXmlReader.ReadNodeAttribute(i,_T("w:fldLock"),_T("false"))); //BOOL bLock = Strings::ToBoolean(oXmlReader.ReadNodeAttribute(i, L"w:fldLock", L"false)));
//if( TRUE == bLock ) //if( TRUE == bLock )
// oCurField->m_eMode = RtfField::fm_fldlock; // oCurField->m_eMode = RtfField::fm_fldlock;
//BOOL bDirty = Strings::ToBoolean(oXmlReader.ReadNodeAttribute(i,_T("w:dirty"),_T("false"))); //BOOL bDirty = Strings::ToBoolean(oXmlReader.ReadNodeAttribute(i, L"w:dirty", L"false"));
//if( TRUE == bDirty ) //if( TRUE == bDirty )
// oCurField->m_eMode = RtfField::fm_flddirty; // oCurField->m_eMode = RtfField::fm_flddirty;
...@@ -238,17 +238,17 @@ bool OOXParagraphReader::Parse2( ReaderParameter oParam , RtfParagraph& oOutputP ...@@ -238,17 +238,17 @@ bool OOXParagraphReader::Parse2( ReaderParameter oParam , RtfParagraph& oOutputP
//добавляем insert //добавляем insert
RtfCharPtr oNewCharHYPER( new RtfChar() ); RtfCharPtr oNewCharHYPER( new RtfChar() );
oNewCharHYPER->m_bRtfEncode = false; oNewCharHYPER->m_bRtfEncode = false;
oNewCharHYPER->setText( _T("HYPERLINK \\l \"") + pHyperlink->m_sAnchor.get() +_T("\"") ); oNewCharHYPER->setText( L"HYPERLINK \\l \"" + pHyperlink->m_sAnchor.get() +L"\"");
RtfParagraphPtr oNewInsertParagraph( new RtfParagraph() ); RtfParagraphPtr oNewInsertParagraph( new RtfParagraph() );
oNewInsertParagraph->AddItem( oNewCharHYPER ); oNewInsertParagraph->AddItem( oNewCharHYPER );
oCurField->m_oInsert->AddItem( oNewInsertParagraph ); oCurField->m_oInsert->AddItem( oNewInsertParagraph );
////добаляем свойства ////добаляем свойства
//BOOL bLock = Strings::ToBoolean(oXmlReader.ReadNodeAttribute(i,_T("w:fldLock"),_T("false"))); //BOOL bLock = Strings::ToBoolean(oXmlReader.ReadNodeAttribute(i, L"w:fldLock" ,L"false"));
//if( TRUE == bLock ) //if( TRUE == bLock )
// oCurField->m_eMode = RtfField::fm_fldlock; // oCurField->m_eMode = RtfField::fm_fldlock;
//BOOL bDirty = Strings::ToBoolean(oXmlReader.ReadNodeAttribute(i,_T("w:dirty"),_T("false"))); //BOOL bDirty = Strings::ToBoolean(oXmlReader.ReadNodeAttribute(i, L"w:dirty", L"false"));
//if( TRUE == bDirty ) //if( TRUE == bDirty )
// oCurField->m_eMode = RtfField::fm_flddirty; // oCurField->m_eMode = RtfField::fm_flddirty;
...@@ -273,7 +273,7 @@ bool OOXParagraphReader::Parse2( ReaderParameter oParam , RtfParagraph& oOutputP ...@@ -273,7 +273,7 @@ bool OOXParagraphReader::Parse2( ReaderParameter oParam , RtfParagraph& oOutputP
OOX::Logic::CBookmarkStart * pBookmarkStart = dynamic_cast<OOX::Logic::CBookmarkStart*>(m_ooxElement->m_arrItems[i]); OOX::Logic::CBookmarkStart * pBookmarkStart = dynamic_cast<OOX::Logic::CBookmarkStart*>(m_ooxElement->m_arrItems[i]);
RtfBookmarkStartPtr oNewBookmark( new RtfBookmarkStart() ); RtfBookmarkStartPtr oNewBookmark( new RtfBookmarkStart() );
oNewBookmark->m_sName = pBookmarkStart->m_sName.IsInit() ? pBookmarkStart->m_sName.get2() : _T(""); oNewBookmark->m_sName = pBookmarkStart->m_sName.IsInit() ? pBookmarkStart->m_sName.get2() : L"";
if (pBookmarkStart->m_oColFirst.IsInit()) if (pBookmarkStart->m_oColFirst.IsInit())
oNewBookmark->nFirstColumn = pBookmarkStart->m_oColFirst->GetValue(); oNewBookmark->nFirstColumn = pBookmarkStart->m_oColFirst->GetValue();
...@@ -771,9 +771,10 @@ bool OOXRunReader::Parse( ReaderParameter oParam , RtfParagraph& oOutputParagrap ...@@ -771,9 +771,10 @@ bool OOXRunReader::Parse( ReaderParameter oParam , RtfParagraph& oOutputParagrap
if( PROP_DEF != oNewProperty.m_nFontSize ) if( PROP_DEF != oNewProperty.m_nFontSize )
nFontSize = oNewProperty.m_nFontSize / 2; nFontSize = oNewProperty.m_nFontSize / 2;
sFieldText.AppendFormat(_T("SYMBOL %d \\\\f \""), nChar); sFieldText = L"SYMBOL";
sFieldText += sFont; sFieldText.AppendFormat(L"%d", nChar);
sFieldText.AppendFormat(_T("\" \\\\s %d"), nFontSize ); sFieldText += L" \\\\f \"" + sFont + L"\" \\\\s ";
sFieldText.AppendFormat(L"%d", nFontSize );
oNewChar->setText( sFieldText ); oNewChar->setText( sFieldText );
RtfParagraphPtr oNewInsertParagraph( new RtfParagraph() ); RtfParagraphPtr oNewInsertParagraph( new RtfParagraph() );
......
...@@ -74,7 +74,7 @@ public: ...@@ -74,7 +74,7 @@ public:
oOutput.m_nWidthGoal = image.get_Width(); oOutput.m_nWidthGoal = image.get_Width();
oOutput.m_nHeightGoal = image.get_Height(); oOutput.m_nHeightGoal = image.get_Height();
CString sTargetFile = FileSystem::Directory::CreateTempFileWithUniqueName(ooxPath.GetDirectory(), _T("img")); CString sTargetFile = FileSystem::Directory::CreateTempFileWithUniqueName(ooxPath.GetDirectory(), L"img");
if (image.SaveFile(string2std_string(sTargetFile), 4 /*_CXIMAGE_FORMAT_PNG*/) ) if (image.SaveFile(string2std_string(sTargetFile), 4 /*_CXIMAGE_FORMAT_PNG*/) )
{ {
...@@ -92,7 +92,7 @@ public: ...@@ -92,7 +92,7 @@ public:
CFile file_inp; //mpa CFile file_inp; //mpa
CFile file_out;//wmf CFile file_out;//wmf
CString sTargetFile = FileSystem::Directory::CreateTempFileWithUniqueName(ooxPath.GetDirectory(), _T("img")); CString sTargetFile = FileSystem::Directory::CreateTempFileWithUniqueName(ooxPath.GetDirectory(), L"img");
int res = file_inp.OpenFile(sPath); int res = file_inp.OpenFile(sPath);
if (res != S_OK) return false; if (res != S_OK) return false;
......
...@@ -108,9 +108,9 @@ public: ...@@ -108,9 +108,9 @@ public:
{ {
// todooo - реализовать в DocxFormat // todooo - реализовать в DocxFormat
//if( _T("w:doNotUseHTMLParagraphAutoSpacing") == sNodeName ) //if( L"w:doNotUseHTMLParagraphAutoSpacing" == sNodeName )
// oParam.oRtf->m_oProperty.m_bHtmlAutoSpace = 0; // oParam.oRtf->m_oProperty.m_bHtmlAutoSpace = 0;
//else if( _T("w:forgetLastTabAlignment") == sNodeName ) //else if( L"w:forgetLastTabAlignment" == sNodeName )
// oParam.oRtf->m_oProperty.m_bUseTabAlignment = 0; // oParam.oRtf->m_oProperty.m_bUseTabAlignment = 0;
} }
if (m_ooxSettings->m_oFootnotePr.IsInit()) if (m_ooxSettings->m_oFootnotePr.IsInit())
......
...@@ -290,10 +290,10 @@ bool OOXShapeReader::Parse2( ReaderParameter oParam , RtfShapePtr& oOutput) ...@@ -290,10 +290,10 @@ bool OOXShapeReader::Parse2( ReaderParameter oParam , RtfShapePtr& oOutput)
OOX::Vml::CFill* fill = dynamic_cast<OOX::Vml::CFill*>(m_arrElement->m_arrItems[i]); OOX::Vml::CFill* fill = dynamic_cast<OOX::Vml::CFill*>(m_arrElement->m_arrItems[i]);
if (!fill) break; if (!fill) break;
CString srId = fill->m_sId.IsInit() ? fill->m_sId.get2() : _T("") ; CString srId = fill->m_sId.IsInit() ? fill->m_sId.get2() : L"" ;
if (srId.IsEmpty()) if (srId.IsEmpty())
srId = fill->m_rId.IsInit() ? fill->m_rId->GetValue() : _T("") ; srId = fill->m_rId.IsInit() ? fill->m_rId->GetValue() : L"" ;
if (!srId.IsEmpty() && oParam.oReader->m_currentContainer) if (!srId.IsEmpty() && oParam.oReader->m_currentContainer)
{ {
...@@ -361,10 +361,10 @@ bool OOXShapeReader::Parse2( ReaderParameter oParam , RtfShapePtr& oOutput) ...@@ -361,10 +361,10 @@ bool OOXShapeReader::Parse2( ReaderParameter oParam , RtfShapePtr& oOutput)
OOX::Vml::CImageData* image_data = dynamic_cast<OOX::Vml::CImageData*>(m_arrElement->m_arrItems[i]); OOX::Vml::CImageData* image_data = dynamic_cast<OOX::Vml::CImageData*>(m_arrElement->m_arrItems[i]);
if (!image_data) break; if (!image_data) break;
CString srId = image_data->m_oId.IsInit() ? image_data->m_oId.get2() : _T("") ; CString srId = image_data->m_oId.IsInit() ? image_data->m_oId.get2() : L"" ;
if (srId.IsEmpty()) if (srId.IsEmpty())
srId = image_data->m_rId.IsInit() ? image_data->m_rId->GetValue() : _T("") ; srId = image_data->m_rId.IsInit() ? image_data->m_rId->GetValue() : L"" ;
if (oParam.oReader->m_currentContainer) if (oParam.oReader->m_currentContainer)
{ {
...@@ -584,7 +584,7 @@ bool OOXShapeReader::Parse( ReaderParameter oParam , RtfShapePtr& oOutput) ...@@ -584,7 +584,7 @@ bool OOXShapeReader::Parse( ReaderParameter oParam , RtfShapePtr& oOutput)
} }
if (oOutput->m_nShapeType == PROP_DEF) if (oOutput->m_nShapeType == PROP_DEF)
{ {
int pos = shape->m_sType->Find(_T("#_x0000_t")); int pos = shape->m_sType->Find( L"#_x0000_t" );
if (pos >= 0) if (pos >= 0)
{ {
oOutput->m_nShapeType = _wtoi(shape->m_sType->Mid(pos + 9, shape->m_sType->GetLength() - pos - 9).GetString()); oOutput->m_nShapeType = _wtoi(shape->m_sType->Mid(pos + 9, shape->m_sType->GetLength() - pos - 9).GetString());
...@@ -676,7 +676,7 @@ bool OOXShapeReader::Parse( ReaderParameter oParam , RtfShapePtr& oOutput) ...@@ -676,7 +676,7 @@ bool OOXShapeReader::Parse( ReaderParameter oParam , RtfShapePtr& oOutput)
oOutput->m_nWrapType = 2; oOutput->m_nWrapType = 2;
int nPosition = 0; int nPosition = 0;
CString sPoint = _T("start"); CString sPoint = L"start";
for (long i =0 ;i < m_vmlElement->m_oWrapCoords->GetSize(); i++) for (long i =0 ;i < m_vmlElement->m_oWrapCoords->GetSize(); i++)
{ {
oOutput->m_aWrapPoints.push_back( std::pair<int,int>( m_vmlElement->m_oWrapCoords->GetX(i), oOutput->m_aWrapPoints.push_back( std::pair<int,int>( m_vmlElement->m_oWrapCoords->GetX(i),
...@@ -743,7 +743,7 @@ bool OOXShapeGroupReader::Parse( ReaderParameter oParam , RtfShapeGroupPtr& oOut ...@@ -743,7 +743,7 @@ bool OOXShapeGroupReader::Parse( ReaderParameter oParam , RtfShapeGroupPtr& oOut
{ {
if (oOutput->m_nWrapType == 3 && oOutput->m_nZOrderRelative == PROP_DEF) oOutput->m_nWrapType =2; if (oOutput->m_nWrapType == 3 && oOutput->m_nZOrderRelative == PROP_DEF) oOutput->m_nWrapType =2;
int nPosition = 0; int nPosition = 0;
CString sPoint = _T("start"); CString sPoint = L"start";
for (long i =0 ;i < m_vmlGroup->m_oWrapCoords->GetSize(); i++) for (long i =0 ;i < m_vmlGroup->m_oWrapCoords->GetSize(); i++)
{ {
oOutput->m_aWrapPoints.push_back( std::pair<int,int>( m_vmlGroup->m_oWrapCoords->GetX(i), oOutput->m_aWrapPoints.push_back( std::pair<int,int>( m_vmlGroup->m_oWrapCoords->GetX(i),
......
...@@ -67,11 +67,11 @@ public: ...@@ -67,11 +67,11 @@ public:
if (oNewStyle == NULL) return true; if (oNewStyle == NULL) return true;
RtfStyle::StyleType eStyleType = oNewStyle->m_eType; RtfStyle::_StyleType eStyleType = oNewStyle->m_eType;
oNewStyle->m_nID = oParam.oRtf->m_oStyleTable.GetCount() + 1; oNewStyle->m_nID = oParam.oRtf->m_oStyleTable.GetCount() + 1;
oNewStyle->m_sID = m_ooxStyle->m_sStyleId.IsInit() ? m_ooxStyle->m_sStyleId.get2() : _T(""); oNewStyle->m_sID = m_ooxStyle->m_sStyleId.IsInit() ? m_ooxStyle->m_sStyleId.get2() : L"";
if(m_ooxStyle->m_oName.IsInit() && m_ooxStyle->m_oName->m_sVal.IsInit()) if(m_ooxStyle->m_oName.IsInit() && m_ooxStyle->m_oName->m_sVal.IsInit())
oNewStyle->m_sName = m_ooxStyle->m_oName->m_sVal.get2(); oNewStyle->m_sName = m_ooxStyle->m_oName->m_sVal.get2();
...@@ -268,7 +268,7 @@ public: ...@@ -268,7 +268,7 @@ public:
oOutputStyle = RtfStylePtr( new RtfTableStyle() ); oOutputStyle = RtfStylePtr( new RtfTableStyle() );
oOutputStyle->m_nID = oParam.oRtf->m_oStyleTable.GetCount() + 1; oOutputStyle->m_nID = oParam.oRtf->m_oStyleTable.GetCount() + 1;
} }
RtfStyle::StyleType eStyleType = oOutputStyle->m_eType;//todooo проверить RtfStyle::_StyleType eStyleType = oOutputStyle->m_eType;//todooo проверить
if (oox_tableStyle->m_oRunPr.IsInit() && if (oox_tableStyle->m_oRunPr.IsInit() &&
( RtfStyle::stCharacter == eStyleType || RtfStyle::stParagraph == eStyleType || RtfStyle::stTable == eStyleType ))//todo с rtf стилями ( RtfStyle::stCharacter == eStyleType || RtfStyle::stParagraph == eStyleType || RtfStyle::stTable == eStyleType ))//todo с rtf стилями
......
...@@ -164,7 +164,7 @@ public: ...@@ -164,7 +164,7 @@ public:
} }
if( m_ooxTableProps->m_oTblCellMar.IsInit() ) if( m_ooxTableProps->m_oTblCellMar.IsInit() )
{ {
MetricUnits eMetric = mu_none; _MetricUnits eMetric = mu_none;
int nValue = PROP_DEF; int nValue = PROP_DEF;
//if( mu_Twips == eMetric && PROP_DEF != nValue ) //if( mu_Twips == eMetric && PROP_DEF != nValue )
//todooo сделать вариант с процентми //todooo сделать вариант с процентми
......
...@@ -95,12 +95,12 @@ public: ...@@ -95,12 +95,12 @@ public:
if( m_ooxTableRowProps->m_oWBefore.IsInit() && m_ooxTableRowProps->m_oWBefore->m_oW.IsInit()) if( m_ooxTableRowProps->m_oWBefore.IsInit() && m_ooxTableRowProps->m_oWBefore->m_oW.IsInit())
{ {
oOutputProperty.m_nWidthStartInvCell = m_ooxTableRowProps->m_oWBefore->m_oW->GetValue(); oOutputProperty.m_nWidthStartInvCell = m_ooxTableRowProps->m_oWBefore->m_oW->GetValue();
oOutputProperty.m_eMUStartInvCell = MetricUnits::mu_Twips; oOutputProperty.m_eMUStartInvCell = _MetricUnits::mu_Twips;
} }
if( m_ooxTableRowProps->m_oWAfter.IsInit() && m_ooxTableRowProps->m_oWAfter->m_oW.IsInit()) if( m_ooxTableRowProps->m_oWAfter.IsInit() && m_ooxTableRowProps->m_oWAfter->m_oW.IsInit())
{ {
oOutputProperty.m_nWidthEndInvCell = m_ooxTableRowProps->m_oWAfter->m_oW->GetValue(); oOutputProperty.m_nWidthEndInvCell = m_ooxTableRowProps->m_oWAfter->m_oW->GetValue();
oOutputProperty.m_eMUEndInvCell = MetricUnits::mu_Twips; oOutputProperty.m_eMUEndInvCell = _MetricUnits::mu_Twips;
} }
if( m_ooxTableRowProps->m_oGridBefore.IsInit() && m_ooxTableRowProps->m_oGridBefore->m_oVal.IsInit()) if( m_ooxTableRowProps->m_oGridBefore.IsInit() && m_ooxTableRowProps->m_oGridBefore->m_oVal.IsInit())
......
...@@ -32,8 +32,13 @@ ...@@ -32,8 +32,13 @@
#include "RtfChar.h" #include "RtfChar.h"
#include "RtfDocument.h" #include "RtfDocument.h"
#include "Writer/OOXWriter.h"
CString RtfChar::RenderToOOX(RenderParameter oRenderParameter) CString RtfChar::RenderToOOX(RenderParameter oRenderParameter)
{ {
RtfDocument* poRtfDocument = static_cast<RtfDocument*> (oRenderParameter.poDocument);
OOXWriter* poOOXWriter = static_cast<OOXWriter*> (oRenderParameter.poWriter);
CString sResult; CString sResult;
if(RENDER_TO_OOX_PARAM_RUN == oRenderParameter.nType) if(RENDER_TO_OOX_PARAM_RUN == oRenderParameter.nType)
{ {
...@@ -43,13 +48,21 @@ CString RtfChar::RenderToOOX(RenderParameter oRenderParameter) ...@@ -43,13 +48,21 @@ CString RtfChar::RenderToOOX(RenderParameter oRenderParameter)
if (m_oProperty.m_nDeleted != PROP_DEF) if (m_oProperty.m_nDeleted != PROP_DEF)
{ {
bDelete = true; bDelete = true;
sResult += L"<w:del>";
CString sAuthor = m_oProperty.m_nRevauthDel != PROP_DEF ? poRtfDocument->m_oRevisionTable[ m_oProperty.m_nRevauthDel ] : L"";
CString sDate(RtfUtility::convertDateTime(m_oProperty.m_nRevdttmDel).c_str());
sResult += L"<w:del w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\">";
m_oProperty.m_nDeleted = PROP_DEF; m_oProperty.m_nDeleted = PROP_DEF;
} }
if (m_oProperty.m_nRevised != PROP_DEF) else if (m_oProperty.m_nRevised != PROP_DEF)
{ {
bInsert = true; bInsert = true;
sResult += L"<w:ins>";
CString sAuthor = m_oProperty.m_nRevauth != PROP_DEF ? poRtfDocument->m_oRevisionTable[ m_oProperty.m_nRevauth] : L"";
CString sDate(RtfUtility::convertDateTime(m_oProperty.m_nRevdttm).c_str());
sResult += L"<w:ins w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\">";
m_oProperty.m_nRevised = PROP_DEF; m_oProperty.m_nRevised = PROP_DEF;
} }
...@@ -60,8 +73,8 @@ CString RtfChar::RenderToOOX(RenderParameter oRenderParameter) ...@@ -60,8 +73,8 @@ CString RtfChar::RenderToOOX(RenderParameter oRenderParameter)
sResult += renderTextToXML(L"Text", bDelete ); sResult += renderTextToXML(L"Text", bDelete );
sResult += L"</w:r>"; sResult += L"</w:r>";
if (bDelete)sResult += L"</w:del>";
if (bInsert)sResult += L"</w:ins>"; if (bInsert)sResult += L"</w:ins>";
if (bDelete)sResult += L"</w:del>";
} }
else if(RENDER_TO_OOX_PARAM_TEXT == oRenderParameter.nType) else if(RENDER_TO_OOX_PARAM_TEXT == oRenderParameter.nType)
{ {
...@@ -105,6 +118,7 @@ CString RtfChar::renderTextToXML( CString sParam, bool bDelete ) ...@@ -105,6 +118,7 @@ CString RtfChar::renderTextToXML( CString sParam, bool bDelete )
} }
return sResult; return sResult;
} }
CString RtfChar::renderRtfText( CString& sText, void* poDocument, RtfCharProperty* oCharProperty ) CString RtfChar::renderRtfText( CString& sText, void* poDocument, RtfCharProperty* oCharProperty )
{ {
RtfDocument* oDocument = static_cast<RtfDocument*>(poDocument); RtfDocument* oDocument = static_cast<RtfDocument*>(poDocument);
...@@ -179,18 +193,18 @@ CString RtfChar::renderRtfText( CString& sText, void* poDocument, RtfCharPropert ...@@ -179,18 +193,18 @@ CString RtfChar::renderRtfText( CString& sText, void* poDocument, RtfCharPropert
if (nCharCode == 0x5c || nCharCode == 0x7b || nCharCode == 0x7d) if (nCharCode == 0x5c || nCharCode == 0x7b || nCharCode == 0x7d)
{ {
sResult.AppendFormat( _T("\\'%x"), nCharCode ); sResult.AppendFormat( L"\\'%x", nCharCode );
} else if (0x00 <= nCharCode && nCharCode - 1 < 0x10) } else if (0x00 <= nCharCode && nCharCode - 1 < 0x10)
{ {
sResult.AppendFormat(_T("\\'0%x"), nCharCode - 1 ); sResult.AppendFormat( L"\\'0%x", nCharCode - 1 );
} else if (0x10 <= nCharCode - 1 && nCharCode < 0x20) } else if (0x10 <= nCharCode - 1 && nCharCode < 0x20)
{ {
sResult.AppendFormat(_T("\\'%x"), nCharCode - 1 ); sResult.AppendFormat( L"\\'%x", nCharCode - 1 );
} else if ( 0x20 <= nCharCode && nCharCode < 0x80 ) } else if ( 0x20 <= nCharCode && nCharCode < 0x80 )
{ {
sResult.AppendChar( nCharCode ); sResult.AppendChar( nCharCode );
} else { // 0x80 <= nUnicode <= 0xff } else { // 0x80 <= nUnicode <= 0xff
sResult.AppendFormat( _T("\\'%x"), nCharCode ); sResult.AppendFormat( L"\\'%x", nCharCode );
} }
} }
} }
...@@ -200,14 +214,50 @@ CString RtfChar::renderRtfText( CString& sText, void* poDocument, RtfCharPropert ...@@ -200,14 +214,50 @@ CString RtfChar::renderRtfText( CString& sText, void* poDocument, RtfCharPropert
if (0 < nUnicode && nUnicode <= 0x8000) if (0 < nUnicode && nUnicode <= 0x8000)
{ {
sResult.AppendFormat(_T("\\u%d*"),nUnicode); sResult.AppendFormat( L"\\u%d*",nUnicode);
} else if (0x8000 < nUnicode && nUnicode <= 0xffff) { } else if (0x8000 < nUnicode && nUnicode <= 0xffff) {
sResult.AppendFormat(_T("\\u%d*"), nUnicode - 0x10000); //??? font alt name china ALL FONTS NEW.docx (Mekanik LET) sResult.AppendFormat( L"\\u%d*", nUnicode - 0x10000); //??? font alt name china ALL FONTS NEW.docx (Mekanik LET)
} else { } else {
sResult += _T("\\u9633*"); sResult += L"\\u9633*";
} }
} }
} }
return sResult; return sResult;
} }
CString RtfChar::RenderToRtf(RenderParameter oRenderParameter)
{
CString result;
if( RENDER_TO_RTF_PARAM_CHAR == oRenderParameter.nType )
{
if( true == m_bRtfEncode )
result += renderRtfText( m_sChars, oRenderParameter.poDocument, &m_oProperty );
else
result += m_sChars;
}
else
{
CString sText;
if( true == m_bRtfEncode )
sText = renderRtfText( m_sChars, oRenderParameter.poDocument, &m_oProperty );
else
sText = m_sChars;
CString sTextProp = m_oProperty.RenderToRtf( oRenderParameter ) ;
if( !sText.IsEmpty() || !sTextProp.IsEmpty())
{
if (oRenderParameter.nType != RENDER_TO_RTF_PARAM_NESTED)
result += L"{";
result += sTextProp;
result += L" ";
result += sText;
if (oRenderParameter.nType != RENDER_TO_RTF_PARAM_NESTED)
result += L"}";
}
}
return result;
}
...@@ -317,41 +317,7 @@ public: ...@@ -317,41 +317,7 @@ public:
CString RenderToOOX(RenderParameter oRenderParameter); CString RenderToOOX(RenderParameter oRenderParameter);
static CString renderRtfText( CString& sText, void* poDocument, RtfCharProperty* oCharProperty = NULL ); static CString renderRtfText( CString& sText, void* poDocument, RtfCharProperty* oCharProperty = NULL );
CString RenderToRtf(RenderParameter oRenderParameter) CString RenderToRtf(RenderParameter oRenderParameter);
{
CString result;
if( RENDER_TO_RTF_PARAM_CHAR == oRenderParameter.nType )
{
if( true == m_bRtfEncode )
result += renderRtfText( m_sChars, oRenderParameter.poDocument, &m_oProperty );
else
result += m_sChars;
}
else
{
CString sText;
if( true == m_bRtfEncode )
sText = renderRtfText( m_sChars, oRenderParameter.poDocument, &m_oProperty );
else
sText = m_sChars;
CString sTextProp = m_oProperty.RenderToRtf( oRenderParameter ) ;
if( !sText.IsEmpty() || !sTextProp.IsEmpty())
{
if (oRenderParameter.nType != RENDER_TO_RTF_PARAM_NESTED)
result += L"{";
result += sTextProp;
result += L" ";
result += sText;
if (oRenderParameter.nType != RENDER_TO_RTF_PARAM_NESTED)
result += L"}";
}
}
return result;
}
private: private:
CString renderTextToXML( CString sParam, bool bDelete = false ); CString renderTextToXML( CString sParam, bool bDelete = false );
}; };
......
...@@ -57,9 +57,9 @@ int RtfDocument::GetType() ...@@ -57,9 +57,9 @@ int RtfDocument::GetType()
CString RtfDocument::RenderToRtf(RenderParameter oRenderParameter) CString RtfDocument::RenderToRtf(RenderParameter oRenderParameter)
{ {
return _T(""); return L"";
} }
CString RtfDocument::RenderToOOX(RenderParameter oRenderParameter) CString RtfDocument::RenderToOOX(RenderParameter oRenderParameter)
{ {
return _T(""); return L"";
} }
...@@ -187,7 +187,7 @@ public: ...@@ -187,7 +187,7 @@ public:
RtfStylePtr GetStyleResulting( RtfStylePtr oInputStyle ) RtfStylePtr GetStyleResulting( RtfStylePtr oInputStyle )
{ {
RtfStylePtr oResultStyle; RtfStylePtr oResultStyle;
RtfStyle::StyleType eStyleType = RtfStyle::st_none; RtfStyle::_StyleType eStyleType = RtfStyle::st_none;
int nStyleId = oInputStyle->m_nID; int nStyleId = oInputStyle->m_nID;
int nLinked = PROP_DEF; int nLinked = PROP_DEF;
......
...@@ -60,7 +60,7 @@ public: ...@@ -60,7 +60,7 @@ public:
void Clear() void Clear()
{ {
RELEASEARRAYOBJECTS( m_aBuffer ); RELEASEARRAYOBJECTS( m_aBuffer );
//m_sBuffer = _T("");
m_nSizeAbs = 0; m_nSizeAbs = 0;
m_nPosAbs = -1; m_nPosAbs = -1;
} }
......
...@@ -90,9 +90,9 @@ CString RtfMath::RenderToRtf(RenderParameter oRenderParameter) ...@@ -90,9 +90,9 @@ CString RtfMath::RenderToRtf(RenderParameter oRenderParameter)
CString sResult; CString sResult;
if( RENDER_TO_RTF_PARAM_NESTED != oRenderParameter.nType ) if( RENDER_TO_RTF_PARAM_NESTED != oRenderParameter.nType )
sResult += _T("{\\mmath"); sResult += L"{\\mmath";
sResult += _T("{\\") + m_sRtfName; sResult += L"{\\" + m_sRtfName;
RenderParameter oNewParameter = oRenderParameter; RenderParameter oNewParameter = oRenderParameter;
CString sVal; CString sVal;
...@@ -107,7 +107,7 @@ CString RtfMath::RenderToRtf(RenderParameter oRenderParameter) ...@@ -107,7 +107,7 @@ CString RtfMath::RenderToRtf(RenderParameter oRenderParameter)
oNewParameter.nType = RENDER_TO_RTF_PARAM_UNKNOWN; oNewParameter.nType = RENDER_TO_RTF_PARAM_UNKNOWN;
for( int i = 0; i < m_oVal.GetCount(); i++ ) for( int i = 0; i < m_oVal.GetCount(); i++ )
{ {
sVal += _T(" ") + m_oVal[i]->RenderToRtf( oNewParameter ); sVal += L" " + m_oVal[i]->RenderToRtf( oNewParameter );
} }
} }
if (!sVal.IsEmpty()) if (!sVal.IsEmpty())
...@@ -120,10 +120,10 @@ CString RtfMath::RenderToRtf(RenderParameter oRenderParameter) ...@@ -120,10 +120,10 @@ CString RtfMath::RenderToRtf(RenderParameter oRenderParameter)
for( int i = 0; i < (int)m_aArray.size(); i++ ) for( int i = 0; i < (int)m_aArray.size(); i++ )
sResult += m_aArray[i]->RenderToRtf( oNewParameter ); sResult += m_aArray[i]->RenderToRtf( oNewParameter );
} }
sResult += _T("}"); sResult += L"}";
if( RENDER_TO_RTF_PARAM_NESTED != oRenderParameter.nType ) if( RENDER_TO_RTF_PARAM_NESTED != oRenderParameter.nType )
sResult += _T("}");// m_sRtfName sResult += L"}";// m_sRtfName
return sResult; return sResult;
} }
CString RtfMath::RenderToOOX(RenderParameter oRenderParameter) CString RtfMath::RenderToOOX(RenderParameter oRenderParameter)
...@@ -160,7 +160,7 @@ CString RtfMath::RenderToOOX(RenderParameter oRenderParameter) ...@@ -160,7 +160,7 @@ CString RtfMath::RenderToOOX(RenderParameter oRenderParameter)
} }
} }
sResult += _T("<"); sResult += L"<";
sResult += m_sOOXName; sResult += m_sOOXName;
if( false == sVal.IsEmpty() ) if( false == sVal.IsEmpty() )
...@@ -170,19 +170,19 @@ CString RtfMath::RenderToOOX(RenderParameter oRenderParameter) ...@@ -170,19 +170,19 @@ CString RtfMath::RenderToOOX(RenderParameter oRenderParameter)
if (sVal == L"on") sVal = L"1"; if (sVal == L"on") sVal = L"1";
else sVal = L"0"; else sVal = L"0";
} }
sResult += _T(" m:val=\""); sResult += L" m:val=\"";
sResult += sVal; sResult += sVal;
sResult += _T("\""); sResult += L"\"";
} }
sResult += _T(">"); sResult += L">";
sResult += sProp; sResult += sProp;
sResult += sContent; sResult += sContent;
sResult += _T("</"); sResult += L"</";
sResult += m_sOOXName; sResult += m_sOOXName;
sResult += _T(">"); sResult += L">";
//альтернативная картинка //альтернативная картинка
// if( NULL != m_oPicture ) // if( NULL != m_oPicture )
......
...@@ -90,7 +90,7 @@ public: ...@@ -90,7 +90,7 @@ public:
m_sRtfName = sName; m_sRtfName = sName;
m_sOOXName = sName; m_sOOXName = sName;
m_sOOXName.Insert(1, _T(":")); m_sOOXName.Insert(1, L":");
} }
void SetOOXType (int type); void SetOOXType (int type);
......
...@@ -37,17 +37,57 @@ ...@@ -37,17 +37,57 @@
CString RtfOle::RenderToOOX(RenderParameter oRenderParameter) CString RtfOle::RenderToOOX(RenderParameter oRenderParameter)
{ {
if( false == IsValid() ) if( false == IsValid() ) return L"";
return _T("");
CString sResult; CString sResult;
RtfDocument* poRtfDocument = static_cast<RtfDocument*> (oRenderParameter.poDocument);
OOXWriter* poOOXWriter = static_cast<OOXWriter*> (oRenderParameter.poWriter);
if( RENDER_TO_OOX_PARAM_OLE_ONLY == oRenderParameter.nType ) if( RENDER_TO_OOX_PARAM_OLE_ONLY == oRenderParameter.nType )
{ {
sResult += RenderToOOXOnlyOle(oRenderParameter); sResult += RenderToOOXOnlyOle(oRenderParameter);
} }
else else
{ {
RtfCharProperty * pCharProps = m_oResultPic ? &m_oResultPic->m_oCharProperty : &m_oCharProperty;
//------------------------------------------
// todooo общая часть с RtfChar
bool bInsert = false;
bool bDelete = false;
if (pCharProps->m_nDeleted != PROP_DEF)
{
bDelete = true;
CString sAuthor = pCharProps->m_nRevauthDel != PROP_DEF ? poRtfDocument->m_oRevisionTable[ pCharProps->m_nRevauthDel ] : L"";
CString sDate(RtfUtility::convertDateTime(pCharProps->m_nRevdttmDel).c_str());
sResult += L"<w:del w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\">";
pCharProps->m_nDeleted = PROP_DEF;
}
else if (pCharProps->m_nRevised != PROP_DEF)
{
bInsert = true;
CString sAuthor = pCharProps->m_nRevauth != PROP_DEF ? poRtfDocument->m_oRevisionTable[ pCharProps->m_nRevauth] : L"";
CString sDate(RtfUtility::convertDateTime(pCharProps->m_nRevdttm).c_str());
sResult += L"<w:ins w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\">";
pCharProps->m_nRevised = PROP_DEF;
}
//----------
sResult += _T("<w:r>"); sResult += _T("<w:r>");
CString sCharProp = pCharProps->RenderToOOX(oRenderParameter);
if (!sCharProp .IsEmpty())
{
sResult += _T("<w:rPr>");
sResult += sCharProp;
sResult += _T("</w:rPr>");
}
sResult.AppendFormat( _T("<w:object w:dxaOrig=\"%d\" w:dyaOrig=\"%d\">"), m_nWidth, m_nHeight ); sResult.AppendFormat( _T("<w:object w:dxaOrig=\"%d\" w:dyaOrig=\"%d\">"), m_nWidth, m_nHeight );
RenderParameter oNewRenderParameter = oRenderParameter; RenderParameter oNewRenderParameter = oRenderParameter;
...@@ -60,6 +100,9 @@ CString RtfOle::RenderToOOX(RenderParameter oRenderParameter) ...@@ -60,6 +100,9 @@ CString RtfOle::RenderToOOX(RenderParameter oRenderParameter)
sResult += _T("</w:object>"); sResult += _T("</w:object>");
sResult += _T("</w:r>"); sResult += _T("</w:r>");
if (bInsert)sResult += L"</w:ins>";
if (bDelete)sResult += L"</w:del>";
} }
return sResult; return sResult;
} }
...@@ -67,9 +110,9 @@ CString RtfOle::RenderToOOXOnlyOle(RenderParameter oRenderParameter) ...@@ -67,9 +110,9 @@ CString RtfOle::RenderToOOXOnlyOle(RenderParameter oRenderParameter)
{ {
CString sResult; CString sResult;
OOXWriter* poOOXWriter = static_cast<OOXWriter*>(oRenderParameter.poWriter); OOXWriter * poOOXWriter = static_cast<OOXWriter*> (oRenderParameter.poWriter);
OOXRelsWriter* poRelsWriter = static_cast<OOXRelsWriter*>(oRenderParameter.poRels); OOXRelsWriter * poRelsWriter = static_cast<OOXRelsWriter*> (oRenderParameter.poRels);
RtfDocument* poDocument = static_cast<RtfDocument*>(oRenderParameter.poDocument); RtfDocument * poDocument = static_cast<RtfDocument*> (oRenderParameter.poDocument);
sResult += _T("<o:OLEObject"); sResult += _T("<o:OLEObject");
switch ( m_eOleType ) switch ( m_eOleType )
...@@ -105,6 +148,40 @@ CString RtfOle::RenderToOOXOnlyOle(RenderParameter oRenderParameter) ...@@ -105,6 +148,40 @@ CString RtfOle::RenderToOOXOnlyOle(RenderParameter oRenderParameter)
return sResult; return sResult;
} }
CString RtfOle::RenderToRtf(RenderParameter oRenderParameter)
{
if( !IsValid() ) return _T("");
CString sResult = _T("{\\object");
if( PROP_DEF != m_eOleType )
{
switch( m_eOleType )
{
case ot_emb: sResult += _T("\\objemb"); break;
case ot_link: sResult += _T("\\objlink"); break;
}
}
RENDER_RTF_INT( m_nWidth, sResult, _T("objw") );
RENDER_RTF_INT( m_nHeight, sResult, _T("objh") );
if( !m_sOleClass.IsEmpty() )
sResult += _T("{\\*\\objclass ") + m_sOleClass + _T("}");
if( !m_sOleFilename.IsEmpty() )
{
CString str = RtfUtility::RtfInternalEncoder::Encode( m_sOleFilename );
sResult += _T("{\\*\\objdata ") + str + _T("}");
}
if( NULL != m_oResultPic )
{
CString str = m_oResultPic->RenderToRtf( oRenderParameter );
sResult += _T("{\\result \\pard\\plain") + str + _T("}");
}
sResult += _T("}");
return sResult;
}
#if defined(_WIN32) || defined(_WIN64) #if defined(_WIN32) || defined(_WIN64)
DWORD CALLBACK OlePut1(LPOLESTREAM oStream, const void FAR* pTarget, DWORD dwRead) DWORD CALLBACK OlePut1(LPOLESTREAM oStream, const void FAR* pTarget, DWORD dwRead)
{ {
......
...@@ -36,15 +36,16 @@ ...@@ -36,15 +36,16 @@
class RtfOle : public IDocumentElement class RtfOle : public IDocumentElement
{ {
public: public:
typedef enum{ ot_none, ot_emb, ot_link } OleType; enum _OleType{ ot_none, ot_emb, ot_link };
OleType m_eOleType; _OleType m_eOleType;
int m_nShapeId; int m_nShapeId;
int m_nWidth; int m_nWidth;
int m_nHeight; int m_nHeight;
CString m_sOleClass; CString m_sOleClass;
RtfShapePtr m_oResultPic; RtfShapePtr m_oResultPic;
RtfCharProperty m_oCharProperty; // тут могут быть track changes ....
RtfOle() RtfOle()
{ {
m_piStorage = NULL; m_piStorage = NULL;
...@@ -63,40 +64,7 @@ public: ...@@ -63,40 +64,7 @@ public:
return PROP_DEF != m_nWidth && PROP_DEF != m_nHeight && _T("") != m_sOleFilename; return PROP_DEF != m_nWidth && PROP_DEF != m_nHeight && _T("") != m_sOleFilename;
/*&& ::GetFileAttributes( m_sOleFilename ) != DWORD( -1 )*/ /*&& ::GetFileAttributes( m_sOleFilename ) != DWORD( -1 )*/
} }
CString RenderToRtf(RenderParameter oRenderParameter) CString RenderToRtf(RenderParameter oRenderParameter);
{
if( !IsValid() ) return _T("");
CString sResult = _T("{\\object");
if( PROP_DEF != m_eOleType )
{
switch( m_eOleType )
{
case ot_emb: sResult += _T("\\objemb"); break;
case ot_link: sResult += _T("\\objlink"); break;
}
}
RENDER_RTF_INT( m_nWidth, sResult, _T("objw") );
RENDER_RTF_INT( m_nHeight, sResult, _T("objh") );
if( !m_sOleClass.IsEmpty() )
sResult += _T("{\\*\\objclass ") + m_sOleClass + _T("}");
if( !m_sOleFilename.IsEmpty() )
{
CString str = RtfUtility::RtfInternalEncoder::Encode( m_sOleFilename );
sResult += _T("{\\*\\objdata ") + str + _T("}");
}
if( NULL != m_oResultPic )
{
CString str = m_oResultPic->RenderToRtf( oRenderParameter );
sResult += _T("{\\result \\pard\\plain") + str + _T("}");
}
sResult += _T("}");
return sResult;
}
CString RenderToOOX(RenderParameter oRenderParameter); CString RenderToOOX(RenderParameter oRenderParameter);
void SetFilename( CString sFilename ) void SetFilename( CString sFilename )
...@@ -119,6 +87,8 @@ public: ...@@ -119,6 +87,8 @@ public:
RELEASEOBJECT( m_piStorage ); RELEASEOBJECT( m_piStorage );
Utils::RemoveDirOrFile( m_sOleFilename ); Utils::RemoveDirOrFile( m_sOleFilename );
m_sOleFilename = _T(""); m_sOleFilename = _T("");
m_oCharProperty.SetDefault();
} }
private: private:
POLE::Storage* m_piStorage; POLE::Storage* m_piStorage;
......
...@@ -41,28 +41,34 @@ typedef boost::shared_ptr<RtfParagraph> RtfParagraphPtr; ...@@ -41,28 +41,34 @@ typedef boost::shared_ptr<RtfParagraph> RtfParagraphPtr;
class RtfOldList : IRenderableProperty class RtfOldList : IRenderableProperty
{ {
public: public:
typedef enum{ lt_none, lt_blt, lt_level, lt_body, lt_cont }LevelType; enum _LevelType { lt_none, lt_blt, lt_level, lt_body, lt_cont };
typedef enum{ lj_none, lj_left, lj_center, lj_right }LevelJust; enum _LevelJust { lj_none, lj_left, lj_center, lj_right };
LevelType m_eLevelType; _LevelType m_eLevelType;
int m_nLevelType; int m_nLevelType;
LevelJust m_eLevelJust; _LevelJust m_eLevelJust;
RtfParagraphPtr m_oLevelText;//фомат текста списка
RtfParagraphPtr m_oLevelText; //фомат текста списка
int m_nLs; int m_nLs;
int m_nIlvl; int m_nIlvl;
RtfParagraphPtr m_oText;//замещающий текст RtfParagraphPtr m_oText; //замещающий текст
RtfOldList() RtfOldList()
{ {
SetDefault(); SetDefault();
} }
bool CanConvertToNumbering(); bool CanConvertToNumbering();
void SetDefault(); void SetDefault();
CString RenderToRtf(RenderParameter oRenderParameter); CString RenderToRtf(RenderParameter oRenderParameter);
CString RenderToOOX(RenderParameter oRenderParameter); CString RenderToOOX(RenderParameter oRenderParameter);
bool operator==( const RtfOldList& oOldList ); bool operator==( const RtfOldList& oOldList );
}; };
typedef boost::shared_ptr<RtfOldList> RtfOldListPtr; typedef boost::shared_ptr<RtfOldList> RtfOldListPtr;
class RtfParagraph : public ITextItem, public ItemContainer< IDocumentElementPtr > class RtfParagraph : public ITextItem, public ItemContainer< IDocumentElementPtr >
......
...@@ -36,24 +36,24 @@ ...@@ -36,24 +36,24 @@
CString RtfPicture::GenerateWMF(RenderParameter oRenderParameter) CString RtfPicture::GenerateWMF(RenderParameter oRenderParameter)
{ {
CString sResult; CString sResult;
sResult += _T("{\\pict"); sResult += L"{\\pict";
RENDER_RTF_INT( 100, sResult, _T("picscalex") ) RENDER_RTF_INT( 100, sResult, L"picscalex" )
RENDER_RTF_INT( 100, sResult, _T("picscaley") ) RENDER_RTF_INT( 100, sResult, L"picscaley" )
RENDER_RTF_INT( m_nCropL, sResult, _T("piccropl") ) RENDER_RTF_INT( m_nCropL, sResult, L"piccropl" )
RENDER_RTF_INT( m_nCropT, sResult, _T("piccropt") ) RENDER_RTF_INT( m_nCropT, sResult, L"piccropt" )
RENDER_RTF_INT( m_nCropR, sResult, _T("piccropr") ) RENDER_RTF_INT( m_nCropR, sResult, L"piccropr" )
RENDER_RTF_INT( m_nCropB, sResult, _T("piccropb") ) RENDER_RTF_INT( m_nCropB, sResult, L"piccropb" )
RENDER_RTF_INT( m_nWidth, sResult, _T("picw") ) RENDER_RTF_INT( m_nWidth, sResult, L"picw" )
RENDER_RTF_INT( m_nHeight, sResult, _T("pich") ) RENDER_RTF_INT( m_nHeight, sResult, L"pich" )
RENDER_RTF_INT( m_nWidthGoal, sResult, _T("picwgoal") ) RENDER_RTF_INT( m_nWidthGoal, sResult, L"picwgoal" )
RENDER_RTF_INT( m_nHeightGoal, sResult, _T("pichgoal") ) RENDER_RTF_INT( m_nHeightGoal, sResult, L"pichgoal" )
sResult += _T("\\wmetafile8"); sResult += L"\\wmetafile8";
sResult += _T(" "); sResult += L" ";
//сохраняем в темповую директорию и загружаем файл как текст //сохраняем в темповую директорию и загружаем файл как текст
RtfWriter * poWriter = static_cast<RtfWriter*>( oRenderParameter.poWriter ); RtfWriter * poWriter = static_cast<RtfWriter*>( oRenderParameter.poWriter );
...@@ -71,53 +71,52 @@ CString RtfPicture::GenerateWMF(RenderParameter oRenderParameter) ...@@ -71,53 +71,52 @@ CString RtfPicture::GenerateWMF(RenderParameter oRenderParameter)
//} //}
//RELEASEINTERFACE( piTempPict ); //RELEASEINTERFACE( piTempPict );
sResult += _T("}"); sResult += L"}";
return sResult; return sResult;
} }
CString RtfPicture::RenderToRtf(RenderParameter oRenderParameter) CString RtfPicture::RenderToRtf(RenderParameter oRenderParameter)
{ {
if( !IsValid() )return _T(""); if( !IsValid() )return L"";
CString sResult = _T("{\\pict"); CString sResult = L"{\\pict";
//if(-1 != m_nShapeId) //if(-1 != m_nShapeId)
//{ //{
// sResult.AppendFormat(_T("{\\*\\picprop\\shplid%d"), m_nShapeId); // sResult.AppendFormat(L"{\\*\\picprop\\shplid%d", m_nShapeId);
// sResult += m_oShapeProp.RenderToRtf( oRenderParameter ) + _T("}"); // sResult += m_oShapeProp.RenderToRtf( oRenderParameter ) + L"}";
//} //}
//else //else
// sResult.AppendFormat(_T("{\\*\\picprop") + m_oShapeProp.RenderToRtf( oRenderParameter ) + _T("}"); // sResult.AppendFormat(L"{\\*\\picprop" + m_oShapeProp.RenderToRtf( oRenderParameter ) + L"}";
RENDER_RTF_INT( (int)m_dScaleX, sResult, _T("picscalex") ) RENDER_RTF_INT( (int)m_dScaleX, sResult, L"picscalex" )
RENDER_RTF_INT( (int)m_dScaleY, sResult, _T("picscaley") ) RENDER_RTF_INT( (int)m_dScaleY, sResult, L"picscaley" )
RENDER_RTF_INT( m_nCropL, sResult, _T("piccropl") ) RENDER_RTF_INT( m_nCropL, sResult, L"piccropl" )
RENDER_RTF_INT( m_nCropT, sResult, _T("piccropt") ) RENDER_RTF_INT( m_nCropT, sResult, L"piccropt" )
RENDER_RTF_INT( m_nCropR, sResult, _T("piccropr") ) RENDER_RTF_INT( m_nCropR, sResult, L"piccropr" )
RENDER_RTF_INT( m_nCropB, sResult, _T("piccropb") ) RENDER_RTF_INT( m_nCropB, sResult, L"piccropb" )
RENDER_RTF_INT( m_nWidth, sResult, _T("picw") ) RENDER_RTF_INT( m_nWidth, sResult, L"picw" )
RENDER_RTF_INT( m_nHeight, sResult, _T("pich") ) RENDER_RTF_INT( m_nHeight, sResult, L"pich" )
RENDER_RTF_INT( m_nWidthGoal, sResult, _T("picwgoal") ) RENDER_RTF_INT( m_nWidthGoal, sResult, L"picwgoal" )
RENDER_RTF_INT( m_nHeightGoal, sResult, _T("pichgoal") ) RENDER_RTF_INT( m_nHeightGoal, sResult, L"pichgoal" )
switch( eDataType ) switch( eDataType )
{ {
case dt_emf: sResult += _T("\\emfblip"); break; case dt_emf: sResult += L"\\emfblip"; break;
case dt_wmf: sResult += _T("\\wmetafile8"); break; case dt_wmf: sResult += L"\\wmetafile8"; break;
case dt_png: sResult += _T("\\pngblip"); break; case dt_png: sResult += L"\\pngblip"; break;
case dt_jpg: sResult += _T("\\jpegblip"); break; case dt_jpg: sResult += L"\\jpegblip"; break;
//case dt_bmp: sResult += _T("wbitmap8"); break; //case dt_bmp: sResult += L"wbitmap8"; break;
} }
sResult += _T(" "); sResult += L" ";
sResult += RtfUtility::RtfInternalEncoder::Encode( m_sPicFilename ); sResult += RtfUtility::RtfInternalEncoder::Encode( m_sPicFilename );
sResult += _T("}"); sResult += L"}";
return sResult; return sResult;
} }
CString RtfPicture::RenderToOOX(RenderParameter oRenderParameter) CString RtfPicture::RenderToOOX(RenderParameter oRenderParameter)
{ {
if( false == IsValid() ) if( false == IsValid() ) return L"";
return _T("");
OOXWriter * poOOXWriter = static_cast<OOXWriter*> (oRenderParameter.poWriter); OOXWriter * poOOXWriter = static_cast<OOXWriter*> (oRenderParameter.poWriter);
OOXRelsWriter * poRelsWriter = static_cast<OOXRelsWriter*> (oRenderParameter.poRels); OOXRelsWriter * poRelsWriter = static_cast<OOXRelsWriter*> (oRenderParameter.poRels);
...@@ -127,23 +126,23 @@ CString RtfPicture::RenderToOOX(RenderParameter oRenderParameter) ...@@ -127,23 +126,23 @@ CString RtfPicture::RenderToOOX(RenderParameter oRenderParameter)
CString sMime; CString sMime;
switch( eDataType ) switch( eDataType )
{ {
case dt_png: sExtension = _T("png"); sMime = _T("image/png"); break; case dt_png: sExtension = L"png"; sMime = L"image/png"; break;
case dt_jpg: sExtension = _T("jpg"); sMime = _T("image/jpg"); break; case dt_jpg: sExtension = L"jpg"; sMime = L"image/jpg"; break;
case dt_wmf: sExtension = _T("wmf"); sMime = _T("image/x-wmf"); break; case dt_wmf: sExtension = L"wmf"; sMime = L"image/x-wmf"; break;
case dt_emf: sExtension = _T("emf"); sMime = _T("image/x-emf"); break; case dt_emf: sExtension = L"emf"; sMime = L"image/x-emf"; break;
case dt_macpict:sExtension = _T("pct"); sMime = _T("image/x-pict"); break; case dt_macpict:sExtension = L"pct"; sMime = L"image/x-pict"; break;
} }
CString sFilenameRels; CString sFilenameRels;
sFilenameRels.AppendFormat( _T("Image%d."), poRtfDocument->m_oIdGenerator.Generate_ImageIndex()); sFilenameRels.AppendFormat( L"Image%d.", poRtfDocument->m_oIdGenerator.Generate_ImageIndex());
sFilenameRels += sExtension; sFilenameRels += sExtension;
CString sFilenameFull = poOOXWriter->m_sTargetFolder + FILE_SEPARATOR_STR + _T("word") + FILE_SEPARATOR_STR +_T("media"); CString sFilenameFull = poOOXWriter->m_sTargetFolder + FILE_SEPARATOR_STR + L"word" + FILE_SEPARATOR_STR +L"media";
FileSystem::Directory::CreateDirectory( sFilenameFull ); FileSystem::Directory::CreateDirectory( sFilenameFull );
sFilenameFull += FILE_SEPARATOR_STR + sFilenameRels; sFilenameFull += FILE_SEPARATOR_STR + sFilenameRels;
sFilenameRels = _T("media/") + sFilenameRels; sFilenameRels = L"media/" + sFilenameRels;
if( m_sPicFilename != sFilenameFull ) if( m_sPicFilename != sFilenameFull )
Utils::CopyDirOrFile( m_sPicFilename, sFilenameFull ); Utils::CopyDirOrFile( m_sPicFilename, sFilenameFull );
...@@ -152,7 +151,7 @@ CString RtfPicture::RenderToOOX(RenderParameter oRenderParameter) ...@@ -152,7 +151,7 @@ CString RtfPicture::RenderToOOX(RenderParameter oRenderParameter)
poOOXWriter->m_oContentTypes.AddExtension( sMime, sExtension); poOOXWriter->m_oContentTypes.AddExtension( sMime, sExtension);
CString srId = poRelsWriter->AddRelationship( _T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"), sFilenameRels); CString srId = poRelsWriter->AddRelationship( L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", sFilenameRels);
return srId; return srId;
} }
\ No newline at end of file
...@@ -79,7 +79,7 @@ public: ...@@ -79,7 +79,7 @@ public:
} }
bool IsValid() bool IsValid()
{ {
return _T("") != m_sPicFilename && dt_none != eDataType; return !m_sPicFilename.IsEmpty() && dt_none != eDataType;
} }
void SetDefaultRtf() void SetDefaultRtf()
{ {
...@@ -105,9 +105,12 @@ public: ...@@ -105,9 +105,12 @@ public:
DEFAULT_PROPERTY( m_nCropT ) DEFAULT_PROPERTY( m_nCropT )
DEFAULT_PROPERTY( m_nCropR ) DEFAULT_PROPERTY( m_nCropR )
DEFAULT_PROPERTY( m_nCropB ) DEFAULT_PROPERTY( m_nCropB )
if( true == m_bIsCopy && _T("") != m_sPicFilename )
if( true == m_bIsCopy && !m_sPicFilename.IsEmpty() )
{
Utils::RemoveDirOrFile( m_sPicFilename ); Utils::RemoveDirOrFile( m_sPicFilename );
m_sPicFilename = _T(""); }
m_sPicFilename = L"";
} }
CString RenderToRtf(RenderParameter oRenderParameter); CString RenderToRtf(RenderParameter oRenderParameter);
CString RenderToOOX(RenderParameter oRenderParameter); CString RenderToOOX(RenderParameter oRenderParameter);
......
...@@ -34,30 +34,35 @@ ...@@ -34,30 +34,35 @@
class RtfShape: public IRenderableProperty class RtfShape: public IRenderableProperty
{ {
private:
bool m_bInsert;
bool m_bDelete;
public: public:
bool m_bIsOle; bool m_bIsOle;
bool m_bInGroup; //local anchor bool m_bInGroup; //local anchor
//----------------------------- //-----------------------------
typedef enum{ st_none, st_inline, st_anchor }AnchorTypeShape; enum _AnchorTypeShape { st_none, st_inline, st_anchor };
typedef enum enum _AnchorX
{ {
ax_none, ax_none,
//ax_ignore, //shpbxignore Ignore \shpbxpage, \shpbxmargin, and \shpbxcolumn, in favor of the posrelh property. The ignored properties will be written for backward compatibility with older readers that do not understand \posrelh. //ax_ignore, //shpbxignore Ignore \shpbxpage, \shpbxmargin, and \shpbxcolumn, in favor of the posrelh property. The ignored properties will be written for backward compatibility with older readers that do not understand \posrelh.
ax_page, //shpbxpage The shape is positioned relative to the page in the x (horizontal) direction. ax_page, //shpbxpage The shape is positioned relative to the page in the x (horizontal) direction.
ax_margin, //shpbxmargin The shape is positioned relative to the margin in the x (horizontal) direction. ax_margin, //shpbxmargin The shape is positioned relative to the margin in the x (horizontal) direction.
ax_column //shpbxcolumn The shape is positioned relative to the column in the x (horizontal) direction. ax_column //shpbxcolumn The shape is positioned relative to the column in the x (horizontal) direction.
}AnchorX; };
typedef enum
enum _AnchorY
{ {
ay_none, ay_none,
//ay_ignore, //shpbyignore Ignore \shpbypage, \shpbymargin, and \shpbxpara, in favor of the posrelh property. The ignored properties will be written for backward compatibility with older readers that do not understand the posrelh property. //ay_ignore, //shpbyignore Ignore \shpbypage, \shpbymargin, and \shpbxpara, in favor of the posrelh property. The ignored properties will be written for backward compatibility with older readers that do not understand the posrelh property.
ay_page, //shpbypage The shape is positioned relative to the page in the y (vertical) direction. ay_page, //shpbypage The shape is positioned relative to the page in the y (vertical) direction.
ay_margin, //shpbymargin The shape is positioned relative to the margin in the y (vertical) direction. ay_margin, //shpbymargin The shape is positioned relative to the margin in the y (vertical) direction.
ay_Para //shpbypara The shape is positioned relative to the paragraph in the y (vertical) direction. ay_Para //shpbypara The shape is positioned relative to the paragraph in the y (vertical) direction.
}AnchorY; };
AnchorTypeShape m_eAnchorTypeShape; _AnchorTypeShape m_eAnchorTypeShape;
CString m_sName; CString m_sName;
CString m_sDescription; CString m_sDescription;
...@@ -74,8 +79,8 @@ public: ...@@ -74,8 +79,8 @@ public:
int m_nZOrderRelative; //shpfblwtxtN Describes relative z-ordering: int m_nZOrderRelative; //shpfblwtxtN Describes relative z-ordering:
int m_bLockAnchor; //shplockanchor Lock anchor for a shape. int m_bLockAnchor; //shplockanchor Lock anchor for a shape.
AnchorX m_eXAnchor; _AnchorX m_eXAnchor;
AnchorY m_eYAnchor; _AnchorY m_eYAnchor;
//----------------ShapeProperty-------------------- //----------------ShapeProperty--------------------
//Position absolute //Position absolute
...@@ -185,6 +190,7 @@ public: ...@@ -185,6 +190,7 @@ public:
int m_bGtextFShrinkFit; int m_bGtextFShrinkFit;
int m_bGtextFBestFit; int m_bGtextFBestFit;
RtfCharProperty m_oCharProperty; // тут могут быть track changes ....
//pWrapPolygonVertices Points of the text wrap polygon. //pWrapPolygonVertices Points of the text wrap polygon.
std::vector< std::pair<int, int> > m_aWrapPoints; std::vector< std::pair<int, int> > m_aWrapPoints;
...@@ -210,6 +216,7 @@ public: ...@@ -210,6 +216,7 @@ public:
SetDefault(); SetDefault();
} }
void SetDefault(); void SetDefault();
CString RenderToRtf (RenderParameter oRenderParameter); CString RenderToRtf (RenderParameter oRenderParameter);
CString RenderToOOX (RenderParameter oRenderParameter); CString RenderToOOX (RenderParameter oRenderParameter);
......
...@@ -40,8 +40,9 @@ class OOXWriter ...@@ -40,8 +40,9 @@ class OOXWriter
{ {
public: public:
CString nCurFitId; CString m_nCurFitId;
int nCurFitWidth; int m_nCurFitWidth;
int m_nCurTrackChangesId;
OOXRelsWriter m_oDocRels; OOXRelsWriter m_oDocRels;
OOXRelsWriter m_oRels; OOXRelsWriter m_oRels;
...@@ -66,8 +67,8 @@ public: ...@@ -66,8 +67,8 @@ public:
std::map<CString, int> m_aBookmarksId; std::map<CString, int> m_aBookmarksId;
OOXWriter( RtfDocument& oDocument, std::wstring sPath ); OOXWriter ( RtfDocument& oDocument, std::wstring sPath );
~OOXWriter(); ~OOXWriter ();
bool Save(); bool Save();
bool SaveByItemStart(); bool SaveByItemStart();
......
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