Commit 59c16015 authored by Elen.Subbotina's avatar Elen.Subbotina Committed by Alexander Trofimov

RtfFormat - документы скаченные с hh + изображения в колонтитулах

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@67828 954022d7-b5bf-4e40-9824-e11837661b57
parent f118b76b
......@@ -3278,6 +3278,8 @@ public: RtfSectionCommand()
ParagraphReader oParagraphReader(sCommand, oReader);
oAbstrReader.StartSubReader( oParagraphReader, oDocument, oReader );
oParagraphReader.m_oParPropDest.Finalize(oReader);
TextItemContainerPtr oNewFooterHeader = oParagraphReader.m_oParPropDest.m_oTextItems;
if( _T("header") == sCommand )
......@@ -3294,7 +3296,7 @@ public: RtfSectionCommand()
oReader.m_oCurSectionProp.m_oFooterLeft = oNewFooterHeader;
else if( _T("footerr") == sCommand )
oReader.m_oCurSectionProp.m_oFooterRight = oNewFooterHeader;
else if( _T("footerr") == sCommand )
else if( _T("footerf") == sCommand )
oReader.m_oCurSectionProp.m_oFooterFirst = oNewFooterHeader;
}
else
......
......@@ -10,6 +10,8 @@ bool OOXHeaderReader::Parse( ReaderParameter oParam, CString sRID, TextItemConta
OOX::CHdrFtr *pHdrFtr = oParam.oDocx->GetHeaderOrFooter(m_ref->m_oId->GetValue());
if (pHdrFtr == NULL) return false;
oParam.oReader->m_currentContainer = dynamic_cast<OOX::IFileContainer*>(pHdrFtr);
OOXTextItemReader oOOXTextItemReader;
oOutput = TextItemContainerPtr( new TextItemContainer() );
oOOXTextItemReader.m_oTextItems = oOutput;
......@@ -19,5 +21,7 @@ bool OOXHeaderReader::Parse( ReaderParameter oParam, CString sRID, TextItemConta
oOOXTextItemReader.Parse(pHdrFtr->m_arrItems[i], oParam );
}
oParam.oReader->m_currentContainer = dynamic_cast<OOX::IFileContainer*>(oParam.oDocx->GetDocument());
return true;
}
......@@ -136,12 +136,16 @@ bool OOXParagraphReader::Parse2( ReaderParameter oParam , RtfParagraph& oOutputP
if( pHyperlink->m_oId.IsInit() )
{
CString sTarget;
smart_ptr<OOX::File> oFile = oParam.oDocx->GetDocument()->Find(pHyperlink->m_oId->GetValue());
if (oParam.oReader->m_currentContainer)
{
smart_ptr<OOX::File> oFile = oParam.oReader->m_currentContainer->Find(pHyperlink->m_oId->GetValue());
if ((oFile.IsInit()) && (OOX::FileTypes::HyperLink == oFile->type()))
{
OOX::HyperLink* pH = (OOX::HyperLink*)oFile.operator->();
sTarget = pH->Uri().GetPath();
}
}
if( _T("") != sTarget )
{
//заменяем пробелы на %20
......@@ -489,13 +493,17 @@ bool OOXRunReader::Parse( ReaderParameter oParam , RtfParagraph& oOutputParagrap
if(ooxObject->m_oOleObject->m_oId.IsInit())
{
CString sRelativePath;
smart_ptr<OOX::File> oFile = oParam.oDocx->GetDocument()->Find(ooxObject->m_oOleObject->m_oId->GetValue());
if (oParam.oReader->m_currentContainer)
{
smart_ptr<OOX::File> oFile = oParam.oReader->m_currentContainer->Find(ooxObject->m_oOleObject->m_oId->GetValue());
if ((oFile.IsInit() && (OOX::FileTypes::OleObject == oFile->type())))
{
OOX::OleObject* pO = (OOX::OleObject*)oFile.operator->();
sRelativePath = pO->m_sFilename;
}
}
//todooo проверить что тут за путь ..
CString sOlePath = oParam.oReader->m_sPath + FILE_SEPARATOR_STR + sRelativePath;
......
......@@ -49,8 +49,10 @@ public:
{
CString sImageId = picture->m_oBlipFill.m_oBlip->m_oEmbed.GetValue();
//todooo ... вынести отдельно (для встроенных документов)
smart_ptr<OOX::File> oFile = oParam.oDocx->GetDocument()->Find(sImageId);
if (oParam.oReader->m_currentContainer)
{
smart_ptr<OOX::File> oFile = oParam.oReader->m_currentContainer->Find(sImageId);
if ( oFile.IsInit() && (OOX::FileTypes::Image == oFile->type()))
{
OOX::Image* pImage = (OOX::Image*)oFile.operator->();
......@@ -61,6 +63,7 @@ public:
}
}
}
}
return true;
}
......
......@@ -15,6 +15,7 @@ OOXReader::OOXReader( RtfDocument& oDocument, std::wstring path ): m_oDocument(
m_nCurItap = 0;
m_convertationManager = NULL;
m_currentContainer = NULL;
}
bool OOXReader::Parse()
{
......@@ -93,10 +94,13 @@ bool OOXReader::Parse()
OOX::CDocument* document = inputDocxFile.GetDocument();
if (document)
{
m_currentContainer = dynamic_cast<OOX::IFileContainer*>(document);
OOXDocumentReader oDocReader( document );
oDocReader.Parse( oReaderParameter );
}
return true;
}
CString OOXReader::GetFolder( CString sDocPath )
......
......@@ -43,6 +43,8 @@ public:
OOXReader( RtfDocument& oDocument, std::wstring path );
bool Parse();
OOX::IFileContainer *m_currentContainer;
private:
void ParseColorTable( RtfDocument& oDocument );
CString GetFolder ( CString sDocPath );
......
......@@ -50,7 +50,9 @@ bool OOXShapeReader::Parse2( ReaderParameter oParam , RtfShapePtr& oOutput)
if (srId.GetLength() < 1)
srId = image_data->m_rId.IsInit() ? image_data->m_rId->GetValue() : _T("") ;
smart_ptr<OOX::File> oFile = oParam.oDocx->GetDocument()->Find(srId);
if (oParam.oReader->m_currentContainer)
{
smart_ptr<OOX::File> oFile = oParam.oReader->m_currentContainer->Find(srId);
if ( oFile.IsInit() && (OOX::FileTypes::Image == oFile->type()))
{
......@@ -61,6 +63,7 @@ bool OOXShapeReader::Parse2( ReaderParameter oParam , RtfShapePtr& oOutput)
//todooo проверить что за путь тут выставляется
OOXPictureGraphicReader::WriteDataToPicture( sImagePath, *oOutput->m_oPicture, oParam.oReader->m_sPath );
}
}
int nCropedWidthGoal = oOutput->m_oPicture->m_nWidthGoal;
if( PROP_DEF != nCropedWidthGoal )
{
......
......@@ -42,7 +42,8 @@ public:
{
RtfStylePtr oResultStyle = oParam.oRtf->m_oStyleTable.GetStyleResulting( oStyle );
RtfTableStylePtr oTableStyle = boost::static_pointer_cast<RtfTableStyle, RtfStyle>( oResultStyle );
oOutputProperty = oTableStyle->m_oTableProp;
oOutputProperty.Merge( oTableStyle->m_oTableProp );
oOutputProperty.m_nStyle = oTableStyle->m_nID;
}
}
......@@ -190,14 +191,20 @@ public:
if( m_ooxTableProps->m_oTblW.IsInit() && m_ooxTableProps->m_oTblW->m_oW.IsInit())
{
oOutputProperty.m_nWidth = m_ooxTableProps->m_oTblW->m_oW->GetValue();
if( m_ooxTableProps->m_oTblW->m_oType.IsInit())
{
switch(m_ooxTableProps->m_oTblW->m_oType->GetValue())
{
case SimpleTypes::tblwidthDxa: oOutputProperty.m_eMUWidth = mu_Twips; break;
case SimpleTypes::tblwidthPct: oOutputProperty.m_eMUWidth = mu_Percent; break;
case SimpleTypes::tblwidthDxa:
{
oOutputProperty.m_nWidth = m_ooxTableProps->m_oTblW->m_oW->GetValue();
oOutputProperty.m_eMUWidth = mu_Twips;
}break;
case SimpleTypes::tblwidthPct:
{
oOutputProperty.m_nWidth = m_ooxTableProps->m_oTblW->m_oW->GetValue();
oOutputProperty.m_eMUWidth = mu_Percent;
}break;
}
}
}
......
......@@ -75,10 +75,10 @@ public:
{
//в проекте используется ungetcб только после getc
//поэтому проблем с выходом в 0 нет
if( m_nPosAbs + 1 < m_nSizeAbs )
//if( m_nPosAbs + 2 < m_nSizeAbs )
{
m_nPosAbs--;
}//взять любой txt переименовать в rtf - зацикливание
m_nPosAbs--; //взять любой txt переименовать в rtf - зацикливание
}
}
void putString( CStringA sText )
{
......
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