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

codepage utf8

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@62097 954022d7-b5bf-4e40-9824-e11837661b57
parent bfffc1cb
#pragma once
#pragma once
#include <vector>
......
#pragma once
#pragma once
#include "RtfReader.h"
#include "RtfDocument.h"
#include "RtfWriter.h"
......@@ -43,8 +43,8 @@ public:
bool succes = oReader.Load( );
// OnCompleteItemRtf
//
//сохранение будет поэлементое в обработчике OnCompleteItemRtf
//надо только завершить
if( true == m_bParseFirstItem )
{
m_bParseFirstItem = false;
......

#include "DestinationCommand.h"
#include "RtfOle.h"
......@@ -178,10 +178,10 @@ bool PictureReader::ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CS
{
if( true == hasParameter )
{
// parameter
//читаем картинку как бинарник длиной parameter
m_bBin = true;
m_nBinLength = parameter;
oReader.m_oLex.ReadBytes( parameter, &m_pbBin );// , , RtfLex::parseKeyword
oReader.m_oLex.ReadBytes( parameter, &m_pbBin );//читаем сразу байты, потому что если между ними и был пробел, то он пропустится в RtfLex::parseKeyword
}
}
else
......@@ -216,7 +216,7 @@ bool FieldReader::ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CStr
ParagraphReader oParagraphReader( _T("fldrslt"), oReader );
StartSubReader( oParagraphReader, oDocument, oReader );
m_oField.m_oResult = oParagraphReader.m_oParPropDest.m_oTextItems;
oReader.m_oLex.putString( "}{" );// fldrslt
oReader.m_oLex.putString( "}{" );//чтобы не терять после fldrslt
//{\field{\*\fldinst...}{\*\fldrslt...} ??? }
//{\field{\*\fldinst...}{\*\fldrslt...}}{ ??? }
}
......@@ -249,9 +249,9 @@ bool OleReader::ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CStrin
if( 0 != nSize && pData)
{
HRESULT hRes = S_FALSE;
// Ole1 Ole2
//обекь для конвертации Ole1 в Ole2
//RtfOle1ToOle2Stream oStream;
//todooo - !!!
//todooo тут был чисто микрософтовский вариант - переделать !!!
//oStream.lpstbl = new OLESTREAMVTBL();
//oStream.lpstbl->Get = &OleGet1;
//oStream.lpstbl->Put = &OlePut1;
......@@ -348,7 +348,7 @@ bool ParagraphPropDestination::ExecuteCommand(RtfDocument& oDocument, RtfReader&
}
else if( _T("pntext") == sCommand )
{
// office 95, office 2007
//пропускаем списки office 95, если есть списки office 2007
if( oDocument.m_oListTabel.GetCount() > 0 )
oAbstrReader.Skip( oDocument, oReader );
else
......@@ -889,7 +889,7 @@ bool ParagraphPropDestination::ExecuteCommand(RtfDocument& oDocument, RtfReader&
else if( _T("trbrdrh") == sCommand )
m_eInternalState = is_borderRowHor;
//table Style
else if( _T("tsbrdrh") == sCommand ) // cell
else if( _T("tsbrdrh") == sCommand ) //диагональные из свойств cell
m_eInternalState = is_borderRowHor;
else if( _T("tsbrdrv") == sCommand )
m_eInternalState = is_borderRowVer;
......@@ -1180,11 +1180,11 @@ bool ParagraphPropDestination::ExecuteCommand(RtfDocument& oDocument, RtfReader&
void ParagraphPropDestination::AddItem( RtfParagraphPtr oItem, RtfReader& oReader, bool bEndCell, bool bEndRow )
{
// 1 != oItem->m_oProperty.m_bInTable -
// PROP_DEF != nTargetItap && oItem->m_oProperty.m_nItap <= nTargetItap - , - nTargetItap - ( )
// 1 != oItem->m_oProperty.m_bInTable - параграф не в таблице
// PROP_DEF != nTargetItap && oItem->m_oProperty.m_nItap <= nTargetItap - выставлено свойство,что вложенность - nTargetItap - это не таблица( Нужно для чтения параграфов в таблицах )
if( 1 != oItem->m_oProperty.m_bInTable || ( PROP_DEF != nTargetItap && oItem->m_oProperty.m_nItap <= nTargetItap ) )
{
if( nCurItap > 0 ) // -
if( nCurItap > 0 ) //Если до этого были только параграфы в таблицах - завершаем таблицу
{
RtfTablePtr oNewTable( new RtfTable() );
oNewTable->m_oProperty = oCurRowProperty;
......@@ -1201,9 +1201,9 @@ void ParagraphPropDestination::AddItem( RtfParagraphPtr oItem, RtfReader& oReade
else
break;
}
// OOX
//вычисляем свойства для OOX
oNewTable->CalculateGridProp();
//
//удаляем временные единицы
aCellRenderables.clear();
aItaps.clear();
aCells.clear();
......@@ -1211,7 +1211,7 @@ void ParagraphPropDestination::AddItem( RtfParagraphPtr oItem, RtfReader& oReade
aRows.clear();
aRowItaps.clear();
//
//добавляем таблицу
m_oTextItems->AddItem( oNewTable );
if (oReader.m_convertationManager)
......@@ -1219,18 +1219,18 @@ void ParagraphPropDestination::AddItem( RtfParagraphPtr oItem, RtfReader& oReade
oReader.m_convertationManager->OnCompleteItemRtf();
}
}
//
//добавляем параграф
m_oTextItems->AddItem( oItem );
if (oReader.m_convertationManager)
{
oReader.m_convertationManager->OnCompleteItemRtf();
}
// nCurItap
//запоминаем nCurItap
nCurItap = oItem->m_oProperty.m_nItap;
}
else
{
// -
//если вложенность текущего параграфа меньше - завершаем внутреннюю таблицу
if( nCurItap > oItem->m_oProperty.m_nItap )
{
RtfTablePtr oNewTable( new RtfTable() );
......@@ -1248,14 +1248,14 @@ void ParagraphPropDestination::AddItem( RtfParagraphPtr oItem, RtfReader& oReade
else
break;
}
// OOX
//вычисляем свойства для OOX
oNewTable->CalculateGridProp();
//
//добавляем таблицу
aCellRenderables.push_back( oNewTable );
aItaps.push_back( oItem->m_oProperty.m_nItap );
}
nCurItap = oItem->m_oProperty.m_nItap;
//
//закончилась строка
if( true == bEndRow )
{
RtfTableRowPtr oNewTableRow( new RtfTableRow() );
......@@ -1273,18 +1273,18 @@ void ParagraphPropDestination::AddItem( RtfParagraphPtr oItem, RtfReader& oReade
else
break;
}
// cell row
//для каждого cell в row добавляем их свойства
for( int i = 0; i < (int)oNewTableRow->GetCount() && i < oNewTableRow->m_oProperty.GetCount() ; i++ )
oNewTableRow->operator [](i)->m_oProperty = oNewTableRow->m_oProperty[i];
// row
//Добавляем временный row
aRows.push_back( oNewTableRow );
aRowItaps.push_back( nCurItap );
}
else
{
// cell
aCellRenderables.push_back( oItem ); // , cell
aItaps.push_back( nCurItap ); //
//добавляем параграф во временные cell
aCellRenderables.push_back( oItem ); //содержит все параграфы, не разложенные по cell
aItaps.push_back( nCurItap ); //содержит все номера вложенности параграфов
if( true == bEndCell )
{
......
#pragma once
#pragma once
#include <map>
......
#pragma once
#pragma once
#include "../RtfProperty.h"
struct OOXColorTableItem
......
#pragma once
#pragma once
#include "OOXLevelReader.h"
......
#pragma once
#pragma once
#include "../RtfDocument.h"
#include "OOXReader.h"
......
#pragma once
#pragma once
#include "../RtfDocument.h"
#include "../RtfProperty.h"
......
#pragma once
#pragma once
#include "../RtfProperty.h"
#include "OOXReader.h"
#include "OOXReaderBasic.h"
......

#pragma once
#include "RtfDocument.h"
#include "RtfProperty.h"
......@@ -22,7 +22,7 @@ public:
// CString val = oXmlReader.ReadNodeAttribute(sColor, _T("") );
// if( _T("") != sThemeColor )
// {
// //Todo tx1 - text1
// //Todo tx1 - моджет приходить text1
// RtfColor::ThemeColor oTheme = RtfColor::TC_NONE;
// if( sThemeColor == _T("accent1") )
// oTheme = RtfColor::caccentone;
......@@ -61,7 +61,7 @@ public:
// if( true == oParam.oRtf->m_oColorTable.GetColor( oTheme , oOutputColor ) )
// {
// // themeColor
// //из themeColor
// int nShade = Strings::ToInteger( themeShade );
// if( nShade < 0 )
// nShade = 0;
......
#pragma once
#pragma once
#include "OOXColorReader.h"
#include "../RtfProperty.h"
......
#pragma once
#pragma once
#include "RtfDocument.h"
#include "XmlUtils.h"
......
#pragma once
#pragma once
#include "../RtfDocument.h"
#include "OOXReader.h"
......
#pragma once
#pragma once
#include "OOXrPrReader.h"
#include "OOXpPrReader.h"
......
#pragma once
#pragma once
#include "OOXTextItemReader.h"
#include "../../../../Common/DocxFormat/Source/DocxFormat/Document.h"
......@@ -33,7 +33,7 @@ public:
if( true == oParam.oRtf->GetItem( oCurSection ) )
{
oCurSection->m_oProperty.SetDefaultOOX();
// ..
//сначала считаем количесво секций и заполняем их свойства ..
for (long i = 0; i < m_ooxDocument->m_arrItems.size(); i++)
{
......@@ -50,7 +50,7 @@ public:
OOXSectionPropertyReader oSectReader(para->m_oParagraphProperty->m_oSectPr.GetPointer());
if( true == oSectReader.Parse( oParam, oCurSection->m_oProperty ) )
{
//
//создаем новую секцию
oCurSection = RtfSectionPtr( new RtfSection() );
oCurSection->m_oProperty.SetDefaultOOX();
oParam.oRtf->AddItem( oCurSection );
......@@ -59,7 +59,7 @@ public:
}
}
}
if (m_ooxDocument->m_oSectPr.IsInit())//
if (m_ooxDocument->m_oSectPr.IsInit())// свойства последней секции
{
OOXSectionPropertyReader oSectReader(m_ooxDocument->m_oSectPr.GetPointer());
oSectReader.Parse( oParam, oCurSection->m_oProperty );
......
#pragma once
#pragma once
#include "OOXReader.h"
#include "OOXReaderBasic.h"
......
#pragma once
#pragma once
#include "OOXFontReader.h"
#include "../RtfProperty.h"
......
#pragma once
#pragma once
#include "OOXFontReader.h"
class OOXFontTableReader
......
#pragma once
#pragma once
#include "OOXReader.h"
#include "../RtfDocument.h"
#include <limits.h>
......
#include "OOXHeaderReader.h"
#include "OOXHeaderReader.h"
#include "OOXTextItemReader.h"
#include "OOXRelsReader.h"
......
#pragma once
#pragma once
#include "../RtfDocument.h"
#include "OOXReader.h"
......
#pragma once
#pragma once
#include "../RtfDocument.h"
#include "../RtfProperty.h"
......
#pragma once
#pragma once
#include "../RtfDocument.h"
#include "../RtfProperty.h"
......@@ -38,7 +38,7 @@ public:
int nVal = m_ooxLvlNum->m_oLvlRestart->m_oVal->GetValue();
if( 0 == nVal )
oLevelProperty.m_nNoRestart = 0;
//todooo "0"
//todooo непонятка что будет если рестарт списка с не "0"
}
if (m_ooxLvlNum->m_oIsLgl.IsInit() )
oLevelProperty.m_nLegal = m_ooxLvlNum->m_oIsLgl->m_oVal.ToBool();
......
#pragma once
#pragma once
#include "../RtfDocument.h"
#include "../../../../Common/DocxFormat/Source/DocxFormat/Math/oMathContent.h"
......
#pragma once
#pragma once
#include "../RtfDocument.h"
#include "../RtfMath.h"
......
#pragma once
#pragma once
#include "../RtfDocument.h"
#include "OOXLevelReader.h"
......
#pragma once
#pragma once
#include "OOXAbstractNumReader.h"
#include "OOXNumberingMapReader.h"
#include "OOXShapeReader.h"
......
#pragma once
#pragma once
#include "OOXRunReader.h"
#include "OOXpPrReader.h"
#include "OOXMathReader.h"
......
#pragma once
#pragma once
#include "OOXPictureGraphicReader.h"
#include "OOXReaderBasic.h"
......@@ -49,7 +49,7 @@ public:
nWidth = m_ooxAnchor->m_oExtent->m_oCx.ToTwips();
nHeight = m_ooxAnchor->m_oExtent->m_oCy.ToTwips();
if( PROP_DEF != oOutput.m_nLeft && PROP_DEF != oOutput.m_nTop )// !!
if( PROP_DEF != oOutput.m_nLeft && PROP_DEF != oOutput.m_nTop )//всегда !!
{
oOutput.m_nRight = oOutput.m_nLeft + nWidth;
oOutput.m_nBottom = oOutput.m_nTop + nHeight;
......@@ -273,7 +273,7 @@ public:
OOXPictureGraphicReader oGraphicReader(m_ooxAnchor->m_oGraphic.GetPointer());
oGraphicReader.Parse( oParam, *oOutput.m_oPicture );
}
// scale
//изменяем scale в соответсявии с выходным размером
if( PROP_DEF != nWidth && PROP_DEF != oOutput.m_oPicture->m_nWidthGoal )
{
int nNewScale = (int)(100 * ( 1.0 * nWidth / oOutput.m_oPicture->m_nWidthGoal ));
......
#pragma once
#pragma once
#include "OOXReaderBasic.h"
......@@ -27,14 +27,14 @@ public:
switch(m_ooxGraphic->m_eGraphicType)
{
case OOX::Drawing::graphictypePicture:
// (
//собственно тока этот объект пока и есть (
break;
case OOX::Drawing::graphictypeLockedCanvas:
case OOX::Drawing::graphictypeChart:
case OOX::Drawing::graphictypeDiagram:
case OOX::Drawing::graphictypeShape:
case OOX::Drawing::graphictypeGroupShape:
///todooo pptx->ppt->vml !!!
///todooo воткнуть конвертацию pptx->ppt->vml !!!
break;
}
......@@ -49,7 +49,7 @@ public:
{
CString sImageId = picture->m_oBlipFill.m_oBlip->m_oEmbed.GetValue();
//todooo ... ( )
//todooo ... вынести отдельно (для встроенных документов)
smart_ptr<OOX::File> oFile = oParam.oDocx->GetDocument()->Find(sImageId);
if ( oFile.IsInit() && (OOX::FileTypes::Image == oFile->type()))
{
......@@ -67,7 +67,7 @@ public:
static bool WriteDataToPicture( CString sPath, RtfPicture& oOutput, CString sTempPath )
{
OOX::CPath ooxPath = sPath; // target
OOX::CPath ooxPath = sPath; //для target
if (sTempPath.GetLength() > 0)
ooxPath = sTempPath;
......@@ -75,16 +75,16 @@ public:
oOutput.m_dScaleX = 100;
oOutput.m_dScaleY = 100;
//
//Выставляем тип картинки
oOutput.eDataType = RtfPicture::GetPictureType( sPath );
//ec rtf png
//ecли тип не поддерживается rtf конвертируем в png
if( RtfPicture::dt_none == oOutput.eDataType )
{
//
//в туже папку что и исходная картинка
CBgraFrame image;
if (image.OpenFile(string2std_string(sPath)) == FALSE ) return false;
//
//правильно выставляем размеры
oOutput.m_nWidthGoal = image.get_Width();
oOutput.m_nHeightGoal = image.get_Height();
......@@ -93,16 +93,16 @@ public:
if (image.SaveFile(string2std_string(sTargetFile), 4 /*_CXIMAGE_FORMAT_PNG*/) )
{
oOutput.eDataType = RtfPicture::dt_png;
//
//Запоминаем имя
oOutput.m_sPicFilename = sTargetFile;
oOutput.m_bIsCopy = true;//
oOutput.m_bIsCopy = true;//выставляем флаг чтобы потом удалить файл
}
}
else
{
if( RtfPicture::dt_apm == oOutput.eDataType )
{
// apm (22 byte)
//убираем заголовок apm (22 byte)
CFile file_inp; //mpa
CFile file_out;//wmf
......@@ -146,7 +146,7 @@ public:
file_out.CloseFile();
oOutput.eDataType = RtfPicture::dt_wmf;
//
//Запоминаем имя
oOutput.m_sPicFilename = sTargetFile;
oOutput.m_bIsCopy = true;
}
......@@ -157,13 +157,13 @@ public:
CBgraFrame image;
if (image.OpenFile(string2std_string(sPath), cxFormats[oOutput.eDataType]) == FALSE ) return false;
//
//правильно выставляем размеры
oOutput.m_nWidthGoal = image.get_Width();
oOutput.m_nHeightGoal = image.get_Height();
//
//Запоминаем только имя
oOutput.m_sPicFilename = sPath;
oOutput.m_bIsCopy = false; //
oOutput.m_bIsCopy = false; //не удалять
}
}
......
#pragma once
#pragma once
#include "OOXPictureGraphicReader.h"
class OOXPictureInlineReader
......@@ -54,7 +54,7 @@ public:
OOXPictureGraphicReader oGraphicReader(m_ooxInline->m_oGraphic.GetPointer());
oGraphicReader.Parse( oParam, *oOutput.m_oPicture );
}
// scale
//изменяем scale в соответсявии с выходным размером
if( PROP_DEF != nWidth && PROP_DEF != oOutput.m_oPicture->m_nWidthGoal )
{
double dNewScale = 100 * ( 1.0 * nWidth / oOutput.m_oPicture->m_nWidthGoal );
......
#pragma once
#pragma once
#include "../RtfPicture.h"
#include "OOXPictureAnchorReader.h"
#include "OOXPictureInlineReader.h"
......
#include "OOXReader.h"
#include "OOXReader.h"
#include "OOXSettingsReader.h"
#include "OOXFontTableReader.h"
#include "OOXStyleTableReader.h"
......@@ -29,7 +29,7 @@ bool OOXReader::Parse()
OOX::CSettings* settings = inputDocxFile.GetSettings();
if (settings)
{ // settings ( footnote)
{ //важно чтобы первыми читались именно settings (например для footnote)
OOXSettingsReader oSettingsReader( settings );
oSettingsReader.Parse( oReaderParameter );
}
......
#pragma once
#pragma once
#include "../RtfDocument.h"
#include "../RtfField.h"
#include "../../../../Common/DocxFormat/Source/DocxFormat/Docx.h"
......@@ -12,7 +12,7 @@ public:
ConvertationManager * m_convertationManager;
CString m_sPath;
int m_nCurItap; //
int m_nCurItap; //для определение вложенности таблицы
int m_nCurFittextId;
std::map<int, CString> m_aBookmarks;
......
#pragma once
#pragma once
#include "../RtfDocument.h"
#include "../RtfReader.h"
......
#pragma once
#pragma once
//class OOXRelsReader
//{
......
#pragma once
#pragma once
#include "OOXrPrReader.h"
#include "OOXShapeReader.h"
......
#pragma once
#pragma once
#include "OOXReaderBasic.h"
#include "OOXHeaderReader.h"
......
#pragma once
#pragma once
#include "OOXFontReader.h"
#include "OOXMathPropReader.h"
#include "../Utils.h"
......@@ -27,7 +27,7 @@ public:
}
if (m_ooxSettings->m_oDoNotHyphenateCaps.IsInit())
{//todooo 1 0
{//todooo проверить чтоб 1 и 0 было
oParam.oRtf->m_oProperty.m_bHypCaps = !m_ooxSettings->m_oDoNotHyphenateCaps->m_oVal.ToBool();
}
if (m_ooxSettings->m_oAutoHyphenation.IsInit() )
......@@ -40,18 +40,18 @@ public:
}
if (m_ooxSettings->m_oHyphenationZone.IsInit() && m_ooxSettings->m_oHyphenationZone->m_oVal.IsInit())
{
oParam.oRtf->m_oProperty.m_nHyphenationRight = m_ooxSettings->m_oHyphenationZone->m_oVal->ToTwips(); //todooo
oParam.oRtf->m_oProperty.m_nHyphenationRight = m_ooxSettings->m_oHyphenationZone->m_oVal->ToTwips(); //todooo проверить размерность
}
if (m_ooxSettings->m_oDefaultTabStop.IsInit() && m_ooxSettings->m_oDefaultTabStop->m_oVal.IsInit())
{
oParam.oRtf->m_oProperty.m_nTabWidth = m_ooxSettings->m_oDefaultTabStop->m_oVal->ToTwips();//todooo
}
if (m_ooxSettings->m_oBordersDoNotSurroundHeader.IsInit())
{//todooo 1 0
{//todooo проверить чтоб 1 и 0 было
oParam.oRtf->m_oProperty.m_bDorderSurroundHeader = !m_ooxSettings->m_oBordersDoNotSurroundHeader->m_oVal.ToBool();
}
if (m_ooxSettings->m_oBordersDoNotSurroundFooter.IsInit())
{//todooo 1 0
{//todooo проверить чтоб 1 и 0 было
oParam.oRtf->m_oProperty.m_bDorderSurroundFotter = !m_ooxSettings->m_oBordersDoNotSurroundFooter->m_oVal.ToBool();
}
if (m_ooxSettings->m_oAlignBordersAndEdges.IsInit())
......@@ -76,7 +76,7 @@ public:
}
if (m_ooxSettings->m_oCompat.IsInit())
{
// todooo - DocxFormat
// todooo - реализовать в DocxFormat
//if( _T("w:doNotUseHTMLParagraphAutoSpacing") == sNodeName )
// oParam.oRtf->m_oProperty.m_bHtmlAutoSpace = 0;
......
#pragma once
#pragma once
#include "../../../../Common/DocxFormat/Source/Common/ComplexTypes.h"
......
#include "OOXShapeReader.h"
#include "OOXShapeReader.h"
#include "OOXTextItemReader.h"
bool OOXShapeReader::Parse2( ReaderParameter oParam , RtfShapePtr& oOutput)
......@@ -28,13 +28,13 @@ bool OOXShapeReader::Parse2( ReaderParameter oParam , RtfShapePtr& oOutput)
CString sImagePath = pImage->filename().GetPath();
//todooo
//todooo проверить что за путь тут выставляется
OOXPictureGraphicReader::WriteDataToPicture( sImagePath, *oOutput->m_oPicture, oParam.oReader->m_sPath );
}
int nCropedWidthGoal = oOutput->m_oPicture->m_nWidthGoal;
if( PROP_DEF != nCropedWidthGoal )
{
// crop
//делаем crop
if( image_data->m_oCropLeft.IsInit() )
{
float nCropLeft = image_data->m_oCropLeft->GetValue();
......@@ -72,7 +72,7 @@ bool OOXShapeReader::Parse2( ReaderParameter oParam , RtfShapePtr& oOutput)
nCropedHeightGoal -= oOutput->m_oPicture->m_nCropB;
}
}
// scale
//устанавливаем scale
if( PROP_DEF != oOutput->m_nLeft && PROP_DEF != oOutput->m_nRight && PROP_DEF != nCropedWidthGoal && 0 != nCropedWidthGoal )
{
int nWidth = oOutput->m_nRight - oOutput->m_nLeft;
......@@ -87,7 +87,7 @@ bool OOXShapeReader::Parse2( ReaderParameter oParam , RtfShapePtr& oOutput)
}
// inline
//проверяем на inline
if( (PROP_DEF == oOutput->m_nLeft || 0 == oOutput->m_nLeft ) && ( PROP_DEF == oOutput->m_nTop || 0 == oOutput->m_nTop ) && PROP_DEF == oOutput->m_nPositionH && PROP_DEF == oOutput->m_nPositionV )
oOutput->m_eShapeType = RtfShape::st_inline;
}break;
......@@ -137,7 +137,7 @@ bool OOXShapeReader::Parse2( ReaderParameter oParam , RtfShapePtr& oOutput)
}break;
}
}
// inline
//если ничего не задали делаем inline
if( (PROP_DEF == oOutput->m_nLeft || 0 == oOutput->m_nLeft ) && ( PROP_DEF == oOutput->m_nTop || 0 == oOutput->m_nTop ) && PROP_DEF == oOutput->m_nPositionH && PROP_DEF == oOutput->m_nPositionV )
{
oOutput->m_nLeft = 0;
......@@ -160,7 +160,7 @@ bool OOXShapeReader::Parse( ReaderParameter oParam , RtfShapePtr& oOutput)
if( m_vmlElement->m_sId.IsInit())
oOutput->m_nID = oParam.oReader->m_oOOXIdGenerator.GetId( m_vmlElement->m_sId.get());
oOutput->m_nLeft = 0; // widht height ( Numbering)
oOutput->m_nLeft = 0; //стили только с widht height (например в Numbering)
oOutput->m_nTop = 0;
if ( m_vmlElement->m_oStyle.IsInit())
......@@ -245,9 +245,9 @@ bool OOXShapeReader::ParseStyle(RtfShape& oShape, SimpleTypes::Vml::CCssProperty
case SimpleTypes::Vml::cssptHeight :
{
int nHeight = (int)(20 * prop->get_Value().dValue);
if( PROP_DEF != oShape.m_nTop )//todooo !!!
if( PROP_DEF != oShape.m_nTop )//todooo переделать !!!
oShape.m_nBottom = oShape.m_nTop + nHeight;
if( PROP_DEF != oShape.m_nRelTop)//todooo !!!
if( PROP_DEF != oShape.m_nRelTop)//todooo переделать !!!
oShape.m_nRelBottom = oShape.m_nRelTop + nHeight;
}break;
case SimpleTypes::Vml::cssptLeft :
......
#pragma once
#pragma once
#include "OOXPictureGraphicReader.h"
#include "OOXReaderBasic.h"
......@@ -102,7 +102,7 @@ public:
//
//OOXShapeReader oShapeReader(m_vmlGroup);
//oShapeReader.Parse( oParam, oBaseShape );
//todooo
//todooo притащить сюда атрибуты группы
for( int i = 0; i < m_vmlGroup->m_arrItems.size() ; i++ )
{
......@@ -135,7 +135,7 @@ public:
else
{
//??? todooo
//shapetype !!!
//shapetype как минимум нужен !!!
}
}
return true;
......
#pragma once
#pragma once
#include "OOXpPrReader.h"
#include "OOXrPrReader.h"
#include "OOXtblPrReader.h"
......@@ -70,7 +70,7 @@ public:
if (m_ooxStyle->m_oUiPriority.IsInit())
oNewStyle->m_bCompose = m_ooxStyle->m_oUiPriority->m_oVal->GetValue();
if (m_ooxStyle->m_oRunPr.IsInit() && ( RtfStyle::stCharacter == eStyleType || RtfStyle::stParagraph == eStyleType || RtfStyle::stTable == eStyleType ))//todo rtf
if (m_ooxStyle->m_oRunPr.IsInit() && ( RtfStyle::stCharacter == eStyleType || RtfStyle::stParagraph == eStyleType || RtfStyle::stTable == eStyleType ))//todo с rtf стилями
{
RtfCharStylePtr oNewCharStyle = boost::shared_static_cast<RtfCharStyle, RtfStyle>( oNewStyle );
......@@ -89,7 +89,7 @@ public:
bool bStartNewSection;
opPrReader.Parse( oParam, oNewParStyle->m_oParProp, CcnfStyle(), bStartNewSection );
oNewParStyle->m_oParProp.m_nListId = PROP_DEF; // numbering
oNewParStyle->m_oParProp.m_nListId = PROP_DEF; //экспериментально вроде нельзя иметь numbering в параграф стиле
oNewParStyle->m_oParProp.m_nListLevel = PROP_DEF;
}
......@@ -147,7 +147,7 @@ public:
case SimpleTypes::tblstyleoverridetypeBand1Vert :
{
oTableStyle->m_oBandVerOdd = boost::shared_static_cast<RtfTableStyle, RtfStyle>( oNewSubStyle );
oTableStyle->m_oBandVerOdd->m_oParProp.m_bStyleOddColBand = 1; // Rtf
oTableStyle->m_oBandVerOdd->m_oParProp.m_bStyleOddColBand = 1; //для конвертации в Rtf
}break;
case SimpleTypes::tblstyleoverridetypeBand2Horz :
{
......@@ -228,10 +228,10 @@ public:
{
if (oox_tableStyle == NULL) return false;
RtfStyle::StyleType eStyleType = oOutputStyle->m_eType;//todooo
RtfStyle::StyleType eStyleType = oOutputStyle->m_eType;//todooo проверить
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 стилями
{
RtfCharStylePtr oNewCharStyle = boost::shared_static_cast<RtfCharStyle, RtfStyle>( oOutputStyle );
......@@ -250,7 +250,7 @@ public:
bool bStartNewSection;
opPrReader.Parse( oParam, oNewParStyle->m_oParProp, CcnfStyle(), bStartNewSection );
oNewParStyle->m_oParProp.m_nListId = PROP_DEF; // numbering
oNewParStyle->m_oParProp.m_nListId = PROP_DEF; //экспериментально вроде нельзя иметь numbering в параграф стиле
oNewParStyle->m_oParProp.m_nListLevel = PROP_DEF;
}
......
#pragma once
#pragma once
#include "OOXStyleReader.h"
#include "OOXDocDefaultsReader.h"
......@@ -35,7 +35,7 @@ public:
if( NULL != oNewStyle )
oParam.oRtf->m_oStyleTable.AddItem( oNewStyle );
}
//
//только чтобы добавить связи между стилями
for (long i=0; i< m_ooxStyles->m_arrStyle.size(); i++)
{
......
#pragma once
#pragma once
#include "OOXTableReader.h"
#include "OOXParagraphReader.h"
......@@ -23,7 +23,7 @@ public:
if( m_ooxTableCell->m_oTableCellProperties )
{
OOXtcPrReader oCellPropReader(m_ooxTableCell->m_oTableCellProperties);
oCellPropReader.Parse( oParam, oOutputCell.m_oProperty, oConditionalTableStyle, nCurCell, nCellCount, nCurRow, nRowCount );// condition (firstRow)
oCellPropReader.Parse( oParam, oOutputCell.m_oProperty, oConditionalTableStyle, nCurCell, nCellCount, nCurRow, nRowCount );//может поменяться на любой condition (firstRow)
}
else
{
......@@ -42,7 +42,7 @@ public:
OOX::Logic::CParagraph * pParagraph = static_cast<OOX::Logic::CParagraph*>(m_ooxTableCell->m_arrItems[i]);
RtfParagraphPtr oNewParagraph( new RtfParagraph() );
// default property
//применяем к новому параграфу default property
oNewParagraph->m_oProperty = oParam.oRtf->m_oDefaultParagraphProp;
oNewParagraph->m_oProperty.m_oCharProperty = oParam.oRtf->m_oDefaultCharProp;
......@@ -50,7 +50,7 @@ public:
bool bStartNewSection;
oParagraphReader.Parse( oParam, (*oNewParagraph), oConditionalTableStyle, bStartNewSection );
//
//ставим стиль таблицы
if( NULL != oParam.poTableStyle )
oNewParagraph->m_oProperty.m_nTableStyle = oParam.poTableStyle->m_nID;
oNewParagraph->m_oProperty.m_nItap = oParam.oReader->m_nCurItap;
......@@ -71,7 +71,7 @@ public:
}break;
default:
{
//todooo -
//todooo - универсальный риадер
//OOXElementReader oElementReader(m_ooxTableCell->m_arrItems[i]);
//ITextItemPtr *rtfElement = oElementReader.Parse( oParam);
//oOutputCell.AddItem( rtfElement );
......
#include "OOXtblPrReader.h"
#include "OOXtblPrReader.h"
#include "OOXTableRowReader.h"
#include "OOXTableReader.h"
......@@ -7,7 +7,7 @@ bool OOXTableReader::Parse( ReaderParameter oParam, RtfTable& oOutputTable )
if (m_ooxTable == NULL) return false;
bool bExistTablPr = false;
//
//сначала читаем свойства
if(m_ooxTable->m_oTableProperties )
{
OOXtblPrReader otblPrReader(m_ooxTable->m_oTableProperties);
......@@ -15,7 +15,7 @@ bool OOXTableReader::Parse( ReaderParameter oParam, RtfTable& oOutputTable )
bExistTablPr = true;
}
//
//формируем внешний стиль для вложенных элементов
RtfTableStylePtr poTableStyle;
if( PROP_DEF != oOutputTable.m_oProperty.m_nStyle )
{
......@@ -26,8 +26,8 @@ bool OOXTableReader::Parse( ReaderParameter oParam, RtfTable& oOutputTable )
if( RtfStyle::stTable == oResultStyle->m_eType )
{
poTableStyle = boost::shared_static_cast<RtfTableStyle, RtfStyle>( oResultStyle );
poTableStyle->m_oTableProp = oOutputTable.m_oProperty; //TableProperty
// , numbering,
poTableStyle->m_oTableProp = oOutputTable.m_oProperty; //TableProperty ставим как уже прочитали чтобы не терять порядок применения свойст
//например индент последовательно затирает друг друга в стилях, numbering, просто в свойствах
}
}
}
......@@ -54,8 +54,8 @@ bool OOXTableReader::Parse( ReaderParameter oParam, RtfTable& oOutputTable )
if (m_ooxTable->m_arrItems[i]->getType() != OOX::et_w_tr) continue;
RtfTableRowPtr oNewRow( new RtfTableRow() );
// row
//.. RTF row
//применяем свойства таблицы к каждому row
//т.к. в RTF нет свойств таблиц и все свойства записываются в свойства row
(*((RtfTableProperty*)&oNewRow->m_oProperty)).Merge( oOutputTable.m_oProperty );
OOX::Logic::CTr *ooxRow = dynamic_cast<OOX::Logic::CTr *>(m_ooxTable->m_arrItems[i]);
......@@ -68,7 +68,7 @@ bool OOXTableReader::Parse( ReaderParameter oParam, RtfTable& oOutputTable )
ApplyParagraphProperty( oOutputTable );
return true;
}
//
//применяет свойства параграфа связанные с положением
void OOXTableReader::ApplyParagraphProperty( RtfTable& oOutputTable )
{
for( int i = 0; i < oOutputTable.GetCount(); i++ )
......
#pragma once
#pragma once
#include "../../../../Common/DocxFormat/Source/DocxFormat/Logic/Table.h"
#include "../RtfTable.h"
......
#pragma once
#pragma once
#include "OOXTableCellReader.h"
#include "OOXtrPrReader.h"
......@@ -21,11 +21,11 @@ public:
if (m_ooxRowTable == NULL) return false;
CcnfStyle oConditionStyle;
//
//с начала применяем свойства
if( m_ooxRowTable->m_oTableRowProperties )
{
OOXtrPrReader otrPrReader(m_ooxRowTable->m_oTableRowProperties);
otrPrReader.Parse( oParam, oOutputRow.m_oProperty, oConditionStyle);// condition(first row)
otrPrReader.Parse( oParam, oOutputRow.m_oProperty, oConditionStyle);// может поменяться на любой condition(first row)
}
int nCellCount = m_ooxRowTable->m_nCountCell;
......@@ -40,9 +40,9 @@ public:
{
OOXTableCellReader oCellReader(ooxCell);
oCellReader.Parse( oParam, *oNewCell, oConditionStyle, nCurCell, nCurRow, nCellCount, nRowCount );
// cell
//добавляем cell
oOutputRow.AddItem(oNewCell);
// cell row
//свойства cell в row
oOutputRow.m_oProperty.AddItem( oNewCell->m_oProperty );
}
}
......
#pragma once
#pragma once
#include "../RtfDocument.h"
#include "../RtfTable.h"
......@@ -28,7 +28,7 @@ public:
bool bStartNewSection = false;
OOXParagraphReader m_oParagraphReader(pParagraph);
RtfParagraphPtr oNewParagraph( new RtfParagraph() );
// default property
//применяем к новому параграфу default property
oNewParagraph->m_oProperty = oParam.oRtf->m_oDefaultParagraphProp;
oNewParagraph->m_oProperty.m_oCharProperty = oParam.oRtf->m_oDefaultCharProp;
oNewParagraph->m_oProperty.m_nItap = 0;
......@@ -39,7 +39,7 @@ public:
if( true == bStartNewSection )
{
RtfSectionPtr oCurSection;
//1 - ..
//1 - т.к. секции удаляются когда полностью запишутся
if( true == oParam.oRtf->GetItem( oCurSection, 1 ) )
{
m_oTextItems = oCurSection;
......
#pragma once
#pragma once
#include "OOXColorSchemeReader.h"
#include "OOXFontSchemeReader.h"
#include "../Utils.h"
......
#pragma once
#pragma once
#include "../RtfProperty.h"
#include "../RtfTableCell.h"
......@@ -162,7 +162,7 @@ public:
if( PROP_DEF != oInputStyle->m_oTableProp.m_nColBandSize )
nColsInBand = oInputStyle->m_oTableProp.m_nColBandSize;
//
//обнуляем
oOutputProperty.m_oBorderDiagonalLR = RtfBorder();
oOutputProperty.m_oBorderDiagonalRL = RtfBorder();
oOutputProperty.m_oBorderLeft = RtfBorder();
......@@ -171,10 +171,10 @@ public:
oOutputProperty.m_oBorderBottom = RtfBorder();
oOutputProperty.m_oBorderInsideH = RtfBorder();
oOutputProperty.m_oBorderInsideV = RtfBorder();
//
//От всей таблицы
ApplyTableStyleToCellBorder( oInputStyle, oOutputProperty, nCurX, nCurY, 0, nWidth - 1, 0, nHeight - 1 );
// OddVBand
//От OddVBand
if( 1 != oInputStyle->m_oTableProp.m_bAutoNoColBand && nColsInBand > 0 )
{
int nBoundLeft = 0;
......@@ -185,9 +185,9 @@ public:
nBoundRight --;
if( nBoundLeft <= nBoundRight && nBoundLeft <= nCurX && nCurX <= nBoundRight )
{
int nDelta = nCurX - nBoundLeft;//
int nPlace = nDelta % nColsInBand;// band
//
int nDelta = nCurX - nBoundLeft;//получаем количество столбцов между
int nPlace = nDelta % nColsInBand;//получаем номер внутри band
//будем считать что флаги расставлены правильно
if( true == bOddVBand && NULL != oInputStyle->m_oBandVerOdd )
ApplyOneStyleToCellBorder( oInputStyle->m_oBandVerOdd, oOutputProperty, nCurX, nCurY, nCurX - nPlace, nCurX - nPlace + nColsInBand - 1, 0, nHeight - 1 );
if( true == bEvenVBand && NULL != oInputStyle->m_oBandVerEven )
......@@ -205,9 +205,9 @@ public:
nBoundBottom --;
if( nBoundTop <= nBoundBottom && nBoundTop <= nCurY && nCurY <= nBoundBottom )
{
int nDelta = nCurY - nBoundTop;//
int nPlace = nDelta % nRowsInBand;// band
//
int nDelta = nCurY - nBoundTop;//получаем количество столбцов между
int nPlace = nDelta % nRowsInBand;//получаем номер внутри band
//будем считать что флаги расставлены правильно
if( true == bOddHBand && NULL != oInputStyle->m_oBandHorOdd )
ApplyOneStyleToCellBorder( oInputStyle->m_oBandHorOdd, oOutputProperty, nCurX, nCurY, 0, nWidth - 1, nCurY - nPlace, nCurY - nPlace + nRowsInBand - 1 );
if( true == bEvenHBand && NULL != oInputStyle->m_oBandHorEven )
......@@ -286,7 +286,7 @@ private:
return;
if( !(nBoundLeft <= nCurX && nCurX <= nBoundRight && nBoundTop <= nCurY && nCurY <= nBoundBottom) )
return;
//
//на них ни что не влияет
oOutputProperty.m_oBorderDiagonalLR.Merge( oInputStyle->m_oCellProp.m_oBorderDiagonalLR );
oOutputProperty.m_oBorderDiagonalRL.Merge( oInputStyle->m_oCellProp.m_oBorderDiagonalRL );
......@@ -354,7 +354,7 @@ public:
oOutput.bEvenVBand = m_ooxCnfStyle->m_oVal->IsBand2Vertical();
oOutput.bOddHBand = m_ooxCnfStyle->m_oVal->IsBand1Horizontal();
oOutput.bEvenHBand = m_ooxCnfStyle->m_oVal->IsBand2Horizontal();
oOutput.bFirstRowLastCol = m_ooxCnfStyle->m_oVal->IsNeCell(); //
oOutput.bFirstRowLastCol = m_ooxCnfStyle->m_oVal->IsNeCell(); //северо восток
oOutput.bFirstRowFirstCol = m_ooxCnfStyle->m_oVal->IsNwCell();
oOutput.bLastRowLastCol = m_ooxCnfStyle->m_oVal->IsSeCell();
oOutput.bLastRowFirstCol = m_ooxCnfStyle->m_oVal->IsSwCell();
......
#pragma once
#pragma once
#include "OOXReaderBasic.h"
#include "../RtfProperty.h"
......
#pragma once
#pragma once
#include "OOXShadingReader.h"
#include "OOXBorderReader.h"
......
#pragma once
#pragma once
#include "OOXReaderBasic.h"
#include "../RtfProperty.h"
......
#pragma once
#pragma once
#include "OOXFontReader.h"
#include "OOXReaderBasic.h"
......
#pragma once
#pragma once
#include "../RtfProperty.h"
#include "OOXReaderBasic.h"
......
#pragma once
#pragma once
#include "OOXReader.h"
#include "OOXBorderReader.h"
......@@ -25,9 +25,9 @@ public:
{
if (m_ooxTableProps == NULL) return false;
//
//сначала применяем стили
// -,
//применяем стиль по-умолчанию,если не определен свой
if( m_ooxTableProps->m_oTblStyle.IsInit() == false && true == m_bDefStyle && NULL != oParam.oReader->m_oDefTableStyle )
{
oOutputProperty.Merge( oParam.oReader->m_oDefTableStyle->m_oTableProp );
......@@ -53,7 +53,7 @@ public:
switch(eType)
{
case SimpleTypes::tblwidthDxa:// , !!!
case SimpleTypes::tblwidthDxa://сделаем не по документации, а как все остальные юниты !!!
{
oOutputProperty.nTableIndentUnits = 3;
oOutputProperty.nTableIndent = dValue;
......@@ -124,7 +124,7 @@ public:
MetricUnits eMetric = mu_none;
int nValue = PROP_DEF;
//if( mu_Twips == eMetric && PROP_DEF != nValue )
//todooo
//todooo сделать вариант с процентми
if( m_ooxTableProps->m_oTblCellMar->m_oBottom.IsInit() && m_ooxTableProps->m_oTblCellMar->m_oBottom->m_oW.IsInit())
{
oOutputProperty.m_nDefCellMarBottomUnits = 3;
......@@ -148,7 +148,7 @@ public:
}
if( m_ooxTableProps->m_oTblCellSpacing.IsInit() && m_ooxTableProps->m_oTblCellSpacing->m_oW.IsInit())
{
//todooo
//todooo тут тоже не было изначально варианта с процентами
//mu_Twips == eMetric && PROP_DEF != nValue )
{
double nValue = m_ooxTableProps->m_oTblCellSpacing->m_oW->GetValue();
......
#pragma once
#pragma once
#include "OOXReader.h"
#include "../RtfDocument.h"
......
#pragma once
#pragma once
#include "../RtfDocument.h"
#include "OOXBorderReader.h"
......@@ -16,7 +16,7 @@ public:
{
if (m_ooxTableCellProps == NULL) return false;
// cnfStyle
//ищем cnfStyle и применяем внешний стиль
if( NULL != oParam.poTableStyle )
{
if( m_ooxTableCellProps->m_oCnfStyle.IsInit() )
......@@ -56,7 +56,7 @@ public:
if( m_ooxTableCellProps->m_oTcMar.IsInit() )
{
//todooo
//todooo сделать реализацию с процентами
if( m_ooxTableCellProps->m_oTcMar->m_oBottom.IsInit() && m_ooxTableCellProps->m_oTcMar->m_oBottom->m_oW.IsInit())
{
oOutputProperty.m_nPaddingBottom = m_ooxTableCellProps->m_oTcMar->m_oBottom->m_oW->GetValue();
......
#pragma once
#pragma once
#include "OOXReader.h"
#include "OOXReaderBasic.h"
#include "OOXcnfStyleReader.h"
......@@ -19,7 +19,7 @@ public:
{
if (m_ooxTableRowProps == NULL) return false;
// cnfStyle
//ищем cnfStyle и применяем внешний стиль
if( NULL != oParam.poTableStyle )
{
if( m_ooxTableRowProps->m_oCnfStyle.IsInit() )
......

#include "RtfBookmark.h"
#include "Writer/OOXWriter.h"
......
#pragma once
#pragma once
#include "RtfChar.h"
class RtfBookmarkStart : public IDocumentElement
......
#include "RtfChar.h"
#include "RtfChar.h"
#include "RtfDocument.h"
CString RtfChar::renderRtfText( CString& sText, void* poDocument, RtfCharProperty* oCharProperty )
......@@ -7,7 +7,7 @@ CString RtfChar::renderRtfText( CString& sText, void* poDocument, RtfCharPropert
CString sResult;
int nCodePage = -1;
// codepage todo associated fonts.
//применяем параметры codepage от текущего шрифта todo associated fonts.
RtfFont oFont;
if( NULL != oCharProperty && true == oDocument->m_oFontTable.GetFont( oCharProperty->m_nFont, oFont ) )
{
......@@ -17,7 +17,7 @@ CString RtfChar::renderRtfText( CString& sText, void* poDocument, RtfCharPropert
nCodePage = oFont.m_nCodePage;
}
//
//от настроек документа
if( -1 == nCodePage && RtfDocumentProperty::cp_none != oDocument->m_oProperty.m_eCodePage )
{
switch ( oDocument->m_oProperty.m_eCodePage )
......@@ -35,17 +35,17 @@ CString RtfChar::renderRtfText( CString& sText, void* poDocument, RtfCharPropert
case RtfDocumentProperty::cp_pca: nCodePage = 850;break;
}
}
// ANSI
//если ничего нет ставим ANSI
if( -1 == nCodePage )
nCodePage = CP_ACP;
// Ansi
//делаем Ansi строку
int nBufSize = ::WideCharToMultiByte(nCodePage, 0, sText, -1, NULL, 0, NULL, NULL);
CStringA sTempResultAnsi;
LPSTR pcBuffer = sTempResultAnsi.GetBuffer(nBufSize);
::WideCharToMultiByte(nCodePage, 0, sText, -1, pcBuffer, nBufSize, NULL, NULL);
sTempResultAnsi.ReleaseBuffer();
//
//делаем обратное преобразование чтобы понять какие символы свонвертировались неправильно
nBufSize = ::MultiByteToWideChar(nCodePage, 0, sTempResultAnsi, -1, NULL, 0);
CStringW sTempResultUni;
LPWSTR pwBuffer = sTempResultUni.GetBuffer(nBufSize);
......@@ -59,7 +59,7 @@ CString RtfChar::renderRtfText( CString& sText, void* poDocument, RtfCharPropert
{
CString sUniChar; sUniChar.AppendChar( sText[i] );
// Ansi
//делаем Ansi строку
int nBufSize = ::WideCharToMultiByte(nCodePage, 0, sUniChar, -1, NULL, 0, NULL, NULL);
CStringA sTempAnsiChars;
LPSTR pcBuffer = sTempAnsiChars.GetBuffer(nBufSize);
......
#pragma once
#pragma once
#include "Basic.h"
#include "Utils.h"
......@@ -11,7 +11,7 @@ public: typedef enum {l_none,
l_ptabldot, //\ptabldot Absolute position tab with a leading that uses period symbols (.....).
l_ptablminus, //\ptablminus Absolute position tab with a leading that uses minus symbols (-----).
l_ptabluscore, //\ptabluscore Absolute position tab with a leading that uses underscore symbols (_____).
l_ptablmdot, //\ptablmdot Absolute position tab with a leading that uses middle dot symbols ().
l_ptablmdot, //\ptablmdot Absolute position tab with a leading that uses middle dot symbols (•••••).
} Leader;
public: Leader m_eLeader;
public: typedef enum { a_none,
......@@ -108,8 +108,8 @@ public: typedef enum {
rsc_softcol,//\softcol Nonrequired column break. Emitted as it appears in galley view.
rsc_softline,//\softline Nonrequired line break. Emitted as it appears in galley view.
rsc_tab,//\tab Tab character.
rsc_emspace,//\emspace Non-breaking space equal to width of character m in current font. Some old RTF writers use the construct '{' \emspace ' }' (with two spaces before the closing brace) to trick readers unaware of \emspace into parsing a regular space. A reader should interpret this as an \emspace and a regular space.
rsc_enspace,//\enspace Nonbreaking space equal to width of character n in current font. Some old RTF writers use the construct '{' \enspace ' }' (with two spaces before the closing brace) to trick readers unaware of \enspace into parsing a regular space. A reader should interpret this as an \enspace and a regular space.
rsc_emspace,//\emspace Non-breaking space equal to width of character “m” in current font. Some old RTF writers use the construct '{' \emspace ' }' (with two spaces before the closing brace) to trick readers unaware of \emspace into parsing a regular space. A reader should interpret this as an \emspace and a regular space.
rsc_enspace,//\enspace Nonbreaking space equal to width of character “n” in current font. Some old RTF writers use the construct '{' \enspace ' }' (with two spaces before the closing brace) to trick readers unaware of \enspace into parsing a regular space. A reader should interpret this as an \enspace and a regular space.
rsc_qmspace,//\qmspace One-quarter em space.
rsc_Formula,//\| Formula character. (Used by Word 5.1 for the Macintosh as the beginning delimiter for a string of formula typesetting commands.)
rsc_OptHyphen,//\- Optional hyphen.
......@@ -168,7 +168,7 @@ public: CString RenderToRtf(RenderParameter oRenderParameter)
}
if( PROP_DEF != m_nTextWrapBreak )
sResult.Append( _T("\\par") );
//switch ( m_nTextWrapBreak ) // word
//switch ( m_nTextWrapBreak ) //не воспринимается word
//{
// case 0: sResult.Append( _T("\\lbr0") );break;
// case 1: sResult.Append( _T("\\lbr1") );break;
......
#pragma once
#pragma once
const long g_cdMaxPercent = 1000000;
......

#include "RtfDocument.h"
#include "RtfReader.h"
......
#pragma once
#pragma once
#include "Basic.h"
#include "RtfGlobalTables.h"
......@@ -25,7 +25,7 @@ public:
TextItemContainerPtr m_oEndnoteSep;
TextItemContainerPtr m_oEndnoteCon;
// List Numbering
//для того чтобы конвертировать старый формат List в Numbering
std::vector<RtfOldListPtr> m_aOldLists;
private:
......
#pragma once
#pragma once
// RTF parser error codes
......
#pragma once
#pragma once
#include "RtfParagraph.h"
#include "Writer/OOXRelsWriter.h"
......@@ -197,25 +197,25 @@ public: CString RenderToOOX(RenderParameter oRenderParameter)
}
else
{
//
//поверяем на наличие гиперссылки
RenderParameter oNewParam = oRenderParameter;
oNewParam.nType = RENDER_TO_OOX_PARAM_PLAIN;
CString sInsertText = m_oInsert->RenderToOOX( oNewParam );
int nIndex = sInsertText.Find( _T("HYPERLINK") );
if( -1 != nIndex )
{
//
//оставляем только одну ссылку
CString sHyperlink = sInsertText;
sHyperlink.Delete( nIndex, (int)_tcslen( _T("HYPERLINK") ) );
sHyperlink.Remove( '\"' );
sHyperlink.Trim();
// %20
//заменяем пробелы на %20
sHyperlink.Replace( _T(" "), _T("%20") );
// rels
//добавляем в rels
OOXRelsWriter* poRelsWriter = static_cast<OOXRelsWriter*>( oRenderParameter.poRels );
CString sId = poRelsWriter->AddRelationship( _T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink"), Utils::PrepareToXML( sHyperlink ), false );
//
//добавляем гиперссылку в документ
sResult.AppendFormat( _T("<w:hyperlink r:id=\"%ls\" >"), sId );
oNewParam.nType = RENDER_TO_OOX_PARAM_RUN;
sResult.Append(m_oResult->RenderToOOX(oNewParam));
......@@ -237,22 +237,22 @@ public: CString RenderToOOX(RenderParameter oRenderParameter)
}
else
{
//
//так добавляются лишние параграфы
RenderParameter oNewParametr = oRenderParameter;
oNewParametr.nType = RENDER_TO_OOX_PARAM_PLAIN;
sResult.Append(_T("<w:r><w:fldChar w:fldCharType=\"begin\"/></w:r>"));
sResult.AppendFormat(_T("<w:r><w:instrText xml:space=\"preserve\">%ls</w:instrText></w:r>"), Utils::PrepareToXML( m_oInsert->RenderToOOX(oNewParametr) ));
sResult.Append(_T("<w:r><w:fldChar w:fldCharType=\"separate\"/></w:r>"));
//
//заканчиваем этот параграф
sResult.Append(_T("</w:p>"));
//
//пишем параграфы содержания
oNewParametr.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
sResult.Append(m_oResult->RenderToOOX(oNewParametr));
// Field
//заканчиваем Field
sResult.Append(_T("<w:p>"));
sResult.Append(_T("<w:r><w:fldChar w:fldCharType=\"end\"/></w:r>"));
////
////пишем параграфы содержания
//RenderParameter oNewParametr = oRenderParameter;
//oNewParametr.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
//sResult.Append(m_oResult->RenderToOOX(oNewParametr));
......@@ -261,12 +261,12 @@ public: CString RenderToOOX(RenderParameter oRenderParameter)
//sFieldBegin.Append(_T("<w:r><w:fldChar w:fldCharType=\"begin\"/></w:r>"));
//sFieldBegin.AppendFormat(_T("<w:r><w:instrText xml:space=\"preserve\">%ls</w:instrText></w:r>"), Utils::PrepareToXML( m_oInsert->RenderToOOX(oNewParametr) ));
//sFieldBegin.Append(_T("<w:r><w:fldChar w:fldCharType=\"separate\"/></w:r>"));
//// w:pPr
////пишем после первого w:pPr
//CString sFindStr = _T("</w:pPr>");
//int nIndex = sResult.Find( sFindStr );
//if( nIndex >= 0 && nIndex < sResult.GetLength() )
// sResult.Inset( sFieldBegin, nIndex + sFindStr.GetLength() );
//else// w:p
//else//пишем после первого w:p
//{
// sFindStr = _T("<w:p>");
// nIndex = sResult.Find( sFindStr );
......@@ -277,7 +277,7 @@ public: CString RenderToOOX(RenderParameter oRenderParameter)
//sFieldEnd.Append(_T("<w:r><w:fldChar w:fldCharType=\"begin\"/></w:r>"));
//sFieldEnd.AppendFormat(_T("<w:r><w:instrText xml:space=\"preserve\">%ls</w:instrText></w:r>"), Utils::PrepareToXML( m_oInsert->RenderToOOX(oNewParametr) ));
//sFieldEnd.Append(_T("<w:r><w:fldChar w:fldCharType=\"separate\"/></w:r>"));
//// w:pPr
////пишем после последнего w:pPr
}
}
}
......
#include "RtfGlobalTables.h"
#include "RtfGlobalTables.h"
#include "RtfDocument.h"
CString RtfFontTable::RenderToRtf(RenderParameter oRenderParameter)
{
//// default charset codepage
////записывает default charset и codepage
//RtfDocument* poDocument = static_cast<RtfDocument*>( oRenderParameter.poDocument );
//if( PROP_DEF != poDocument->m_oProperty.m_nAnsiCodePage )
//{
......
#pragma once
#pragma once
#include "RtfProperty.h"
#include "RtfShape.h"
......@@ -61,7 +61,7 @@ public:
}
bool GetColor( int nId, RtfColor& oColor)
{
//0 - ID
//0 - ID автоцвет
nId--;
if( nId >= 0 && nId < (int)m_aArray.size() )
{
......@@ -163,7 +163,7 @@ public:
{
eStyleType = RtfStyle::stParagraph;
oResultStyle = RtfParagraphStylePtr( new RtfParagraphStyle() );
nLinked = oInputStyle->m_nLink;//linked ,
nLinked = oInputStyle->m_nLink;//linked будем смотреть только у стилей параграфа, чтобы избежать рекурсии
}
else if( RtfStyle::stTable == oInputStyle->m_eType )
{
......@@ -192,7 +192,7 @@ public:
return oInputStyle;
else
{
// - Base Link
//Опытным путем установлено - Base старше Link
if( NULL != oLinkedStyle )
{
oResultStyle->Merge( oLinkedStyle );
......
#pragma once
#pragma once
//#include <stdio.h>
//#include <stdlib.h>
......@@ -11,8 +11,8 @@
class StringStream
{
private:
LONGLONG m_nSizeAbs;//
LONGLONG m_nPosAbs;//
LONGLONG m_nSizeAbs;//размер файла
LONGLONG m_nPosAbs;//позиция в файле
//CStringA m_sBuffer;
unsigned char* m_aBuffer;
......@@ -73,20 +73,20 @@ public:
}
void ungetc()
{
// ungetc getc
// 0
//в проекте используется ungetcб только после getc
//поэтому проблем с выходом в 0 нет
m_nPosAbs--;
}
void putString( CStringA sText )
{
int nExtBufSize = sText.GetLength();
//
//копируем буфер в темповый буфер
unsigned char* aTempBuf = new unsigned char[ m_nSizeAbs ];
memcpy( aTempBuf, m_aBuffer, m_nSizeAbs );
//
//создаем новый буфер большего размера
RELEASEARRAYOBJECTS( m_aBuffer );
m_aBuffer = new unsigned char[ m_nSizeAbs + nExtBufSize ];
//
//копируем все в новый буфер
unsigned long nDelimiter = m_nPosAbs + 1;
memcpy( m_aBuffer, aTempBuf, nDelimiter );
char* bf = sText.GetBuffer();
......@@ -120,7 +120,7 @@ public:
RtfLex()
{
m_oFileWriter = NULL;
m_nReadBufSize = 1024 * 1024 * 5; // 5
m_nReadBufSize = 1024 * 1024 * 5; // 5мб
m_caReadBuffer = (char*)::HeapAlloc(GetProcessHeap(), 0, m_nReadBufSize);
}
~RtfLex()
......@@ -244,7 +244,7 @@ private:
token.HasParameter = true;
int nCharCode = RtfUtility::ToByte( m_oStream.getc() ) << 4;
nCharCode |= RtfUtility::ToByte( m_oStream.getc() );
if( nCharCode >= 0 && nCharCode <=30 )// 1 \'00 ( 0 0x20 )
if( nCharCode >= 0 && nCharCode <=30 )//искуственно сидвигаем на 1 чтобы не потерять \'00 ( символов от 0 до 0x20 служебные)
nCharCode++;
token.Parameter = nCharCode;
}
......@@ -273,12 +273,12 @@ private:
token.Type = RtfToken::Keyword;
token.Key = palabraClave;
//Se comprueba si la palabra clave tiene parmetro
//Se comprueba si la palabra clave tiene parбmetro
if (RtfUtility::IsDigit(c) || c == '-')
{
token.HasParameter = true;
//Se comprubea si el parmetro es negativo
//Se comprubea si el parбmetro es negativo
if (c == '-')
{
negativo = true;
......@@ -301,7 +301,7 @@ private:
if (negativo)
parametroInt = -parametroInt;
//Se asigna el parmetro de la palabra clave
//Se asigna el parбmetro de la palabra clave
token.Parameter = parametroInt;
}
......@@ -312,10 +312,10 @@ private:
}
void parseText(int car, RtfToken& token)
{
int nTempBufPos = 0; //1
int nTempBufPos = 0; //1 мб
int c = car;
//while ((isalnum(c) || c == '"'|| c == ':'|| c == '/' || c == '.') &&c != '\\' && c != '}' && c != '{' && c != Eof) // EED EE
//while ((isalnum(c) || c == '"'|| c == ':'|| c == '/' || c == '.') &&c != '\\' && c != '}' && c != '{' && c != Eof) // иправиЃEЃEрвьD усЃEвиЃE
//while (c != '\\' && c != '}' && c != '{' && c != Eof)
//while (c != ';' &&c ! = '\\' && c != '}' && c != '{' && c != EOF)
while (c != '\\' && c != '}' && c != '{' && c != EOF)
......
#pragma once
#pragma once
#include "Basic.h"
#include "RtfProperty.h"
......@@ -47,7 +47,7 @@ public:
const TCHAR* mc_aRtfControlWords[] = {_T("macc"),_T("maccPr"),_T("maln"),_T("malnScr"),_T("margPr"),_T("margSz"),_T("mbar"),_T("mbarPr"),_T("mbaseJc"),_T("mbegChr"),_T("mborderBox"),_T("mborderBoxPr"),_T("mbox"),_T("mboxPr"),_T("mbrkN"),_T("mbrkBinN"),_T("mbrkBinSubN"),_T("mcGpN"),_T("mcGpRuleN"),_T("mchr"),_T("mcount"),_T("mcSpN"),_T("mctrlPr"),_T("md"),_T("mdefJcN"),_T("mdeg"),_T("mdegHide"),_T("mden"),_T("mdiff"),_T("mdiffStyN"),_T("mdispDefN"),_T("mdPr"),_T("me"),_T("mendChr"),_T("meqArr"),_T("meqArrPr"),_T("mf"),_T("mfName"),_T("mfPr"),_T("mfunc"),_T("mfuncPr"),_T("mgroupChr"),_T("mgroupChrPr"),_T("mgrow"),_T("mhideBot"),_T("mhideLeft"),_T("mhideRight"),_T("mhideTop"),_T("minterSpN"),_T("mintLimN"),_T("mintraSpN"),_T("mjcN"),_T("mlim"),_T("mlimLoc"),_T("mlimLow"),_T("mlimLowPr"),_T("mlimUpp"),_T("mlimUppPr"),_T("mlit"),_T("mlMarginN"),_T("mm"),_T("mmath"),_T("mmathFontN"),_T("mmathPict"),_T("mmathPr"),_T("mmaxDist"),_T("mmc"),_T("mmcJc"),_T("mmcPr"),_T("mmcs"),_T("mmPr"),_T("mmr"),_T("mnary"),_T("mnaryLimN"),_T("mnaryPr"),_T("mnoBreak"),_T("mnor"),_T("mnum"),_T("mobjDist"),_T("moMath"),_T("moMathPara"),_T("moMathParaPr"),_T("mopEmu"),_T("mphant"),_T("mphantPr"),_T("mplcHide"),_T("mpos"),_T("mpostSpN"),_T("mpreSpN"),_T("mr"),_T("mrad"),_T("mradPr"),_T("mrMarginN"),_T("mrPr"),_T("mrSpN"),_T("mrSpRuleN"),_T("mscrN"),_T("msepChr"),_T("mshow"),_T("mshp"),_T("msmallFracN"),_T("msPre"),_T("msPrePr"),_T("msSub"),_T("msSubPr"),_T("msSubSup"),_T("msSubSupPr"),_T("msSup"),_T("msSupPr"),_T("mstrikeBLTR"),_T("mstrikeH"),_T("mstrikeTLBR"),_T("mstrikeV"),_T("mstyN"),_T("msub"),_T("msubHide"),_T("msup"),_T("msupHide"),_T("mtransp"),_T("mtype"),_T("mvertJc"),_T("mwrapIndentN"),_T("mwrapRightN"),_T("mzeroAsc"),_T("mzeroDesc"),_T("mzeroWid")};
int mc_nRtfControlWordsSize = sizeof( mc_aRtfControlWords ) / sizeof( TCHAR* );
//
//можно бинарный поиск вставить
for( int i = 0; i < mc_nRtfControlWordsSize; i++ )
if( mc_aRtfControlWords[ i ] == sControlW )
return true;
......@@ -58,7 +58,7 @@ public:
const TCHAR* mc_aOOXControlWords[] = {_T("m:acc"),_T("m:accPr"),_T("m:aln"),_T("m:alnScr"),_T("m:argPr"),_T("m:argSz"),_T("m:bar"),_T("m:barPr"),_T("m:baseJc"),_T("m:begChr"),_T("m:borderBox"),_T("m:borderBoxPr"),_T("m:box"),_T("m:boxPr"),_T("m:brkN"),_T("m:brkBinN"),_T("m:brkBinSubN"),_T("m:cGpN"),_T("m:cGpRuleN"),_T("m:chr"),_T("m:count"),_T("m:cSpN"),_T("m:ctrlPr"),_T("m:d"),_T("m:defJcN"),_T("m:deg"),_T("m:degHide"),_T("m:den"),_T("m:diff"),_T("m:diffStyN"),_T("m:dispDefN"),_T("m:dPr"),_T("m:e"),_T("m:endChr"),_T("m:eqArr"),_T("m:eqArrPr"),_T("m:f"),_T("m:fName"),_T("m:fPr"),_T("m:func"),_T("m:funcPr"),_T("m:groupChr"),_T("m:groupChrPr"),_T("m:grow"),_T("m:hideBot"),_T("m:hideLeft"),_T("m:hideRight"),_T("m:hideTop"),_T("m:interSpN"),_T("m:intLimN"),_T("m:intraSpN"),_T("m:jcN"),_T("m:lim"),_T("m:limLoc"),_T("m:limLow"),_T("m:limLowPr"),_T("m:limUpp"),_T("m:limUppPr"),_T("m:lit"),_T("m:lMarginN"),_T("m:m"),_T("m:math"),_T("m:mathFontN"),_T("m:mathPict"),_T("m:mathPr"),_T("m:maxDist"),_T("m:mc"),_T("m:mcJc"),_T("m:mcPr"),_T("m:mcs"),_T("m:mPr"),_T("m:mr"),_T("m:nary"),_T("m:naryLimN"),_T("m:naryPr"),_T("m:noBreak"),_T("m:nor"),_T("m:num"),_T("m:objDist"),_T("m:oMath"),_T("m:oMathPara"),_T("m:oMathParaPr"),_T("m:opEmu"),_T("m:phant"),_T("m:phantPr"),_T("m:plcHide"),_T("m:pos"),_T("m:postSpN"),_T("m:preSpN"),_T("m:r"),_T("m:rad"),_T("m:radPr"),_T("m:rMarginN"),_T("m:rPr"),_T("m:rSpN"),_T("m:rSpRuleN"),_T("m:scrN"),_T("m:sepChr"),_T("m:show"),_T("m:shp"),_T("m:smallFracN"),_T("m:sPre"),_T("m:sPrePr"),_T("m:sSub"),_T("m:sSubPr"),_T("m:sSubSup"),_T("m:sSubSupPr"),_T("m:sSup"),_T("m:sSupPr"),_T("m:strikeBLTR"),_T("m:strikeH"),_T("m:strikeTLBR"),_T("m:strikeV"),_T("m:styN"),_T("m:sub"),_T("m:subHide"),_T("m:sup"),_T("m:supHide"),_T("m:transp"),_T("m:type"),_T("m:vertJc"),_T("m:wrapIndentN"),_T("m:wrapRightN"),_T("m:zeroAsc"),_T("m:zeroDesc"),_T("m:zeroWid")};
int mc_nOOXControlWordsSize = sizeof( mc_aOOXControlWords ) / sizeof( TCHAR* );
//
//можно бинарный поиск вставить
for( int i = 0; i < mc_nOOXControlWordsSize; i++ )
if( mc_aOOXControlWords[ i ] == sControlW )
return true;
......
#include "RtfParagraph.h"
#include "RtfParagraph.h"
#include "Writer/OOXWriter.h"
CString RtfOldList::RenderToRtf(RenderParameter oRenderParameter)
......@@ -12,7 +12,7 @@ CString RtfOldList::RenderToOOX(RenderParameter oRenderParameter)
{
CString sResult;
if( true == CanConvertToNumbering() )
{//
{//сохраняем как список
if( RENDER_TO_OOX_PARAM_OLDLIST_ABS == oRenderParameter.nType )
{
CString sCharProp = m_oLevelText->m_oProperty.m_oCharProperty.RenderToOOX( oRenderParameter );
......
#include "RtfOle.h"
#include "RtfOle.h"
#include "Writer/OOXWriter.h"
#include "Writer/OOXRelsWriter.h"
#include "RtfDocument.h"
......
#pragma once
#pragma once
#include "RtfParagraph.h"
#include "RtfShape.h"
......
#pragma once
#pragma once
#include "Basic.h"
#include "RtfChar.h"
#include "RtfWriter.h"
......@@ -16,12 +16,12 @@ public:
LevelType m_eLevelType;
int m_nLevelType;
LevelJust m_eLevelJust;
RtfParagraphPtr m_oLevelText;//
RtfParagraphPtr m_oLevelText;//фомат текста списка
int m_nLs;
int m_nIlvl;
RtfParagraphPtr m_oText;//
RtfParagraphPtr m_oText;//замещающий текст
RtfOldList()
{
SetDefault();
......@@ -50,7 +50,7 @@ public:
{
if( TYPE_RTF_CHAR == piRend->GetType() )
{
if( m_aArray.size() > 0 && TYPE_RTF_CHAR == m_aArray[ m_aArray.size() - 1 ]->GetType() )//
if( m_aArray.size() > 0 && TYPE_RTF_CHAR == m_aArray[ m_aArray.size() - 1 ]->GetType() )//соединяем два текста с одинаковыми свойствами
{
RtfCharPtr oCurChar = boost::shared_static_cast<RtfChar,IDocumentElement>( piRend );
RtfCharPtr oPrevChar = boost::shared_static_cast<RtfChar,IDocumentElement>( m_aArray[ m_aArray.size() - 1 ] );
......@@ -114,7 +114,7 @@ public:
if( NULL != m_oOldList )
{
// OldList
//для OldList
if( true == bCanConvertToNumbering )
sResult.Append( m_oOldList->RenderToOOX( oRenderParameter ) );
}
......@@ -122,7 +122,7 @@ public:
if( NULL != m_oOldList )
{
// OldList
//для OldList
if( false == bCanConvertToNumbering && NULL != m_oOldList->m_oText)
{
RtfCharProperty oCharProp = m_oProperty.m_oCharProperty;
......
#include "RtfPicture.h"
#include "RtfPicture.h"
#include "Writer/OOXWriter.h"
#include "Utils.h"
......@@ -10,7 +10,7 @@ CString RtfPicture::GenerateWMF(RenderParameter oRenderParameter)
// sResult.AppendFormat(_T("{\\*\\picprop\\shplid%d%ls}"), m_nShapeId, m_oShapeProp.RenderToRtf( oRenderParameter ) );
//else
// sResult.AppendFormat(_T("{\\*\\picprop%ls}"), m_oShapeProp.RenderToRtf( oRenderParameter ) );
////"" wmf
////"наши" wmf не растягиваются
RENDER_RTF_INT( 100, sResult, _T("picscalex") )
RENDER_RTF_INT( 100, sResult, _T("picscaley") )
......@@ -30,11 +30,11 @@ CString RtfPicture::GenerateWMF(RenderParameter oRenderParameter)
sResult.Append( _T(" "));
//
//сохраняем в темповую директорию и загружаем файл как текст
RtfWriter * poWriter = static_cast<RtfWriter*>( oRenderParameter.poWriter );
IUnknown* piTempPict = NULL;
//todooo ???
//todooo ??? переписать
//if( true == LoadPicture( &piTempPict, m_sPicFilename ) )
//{
// CString sTempFile = Utils::CreateTempFile( poWriter->m_sTempFolder );
......
#pragma once
#pragma once
#include "RtfProperty.h"
#include "Utils.h"
//#include "../Common/MediaFormatDefine.h"
......@@ -26,8 +26,8 @@ public:
int m_nCropR;
int m_nCropB;
bool m_bIsCopy; // true - m_sPicFilename, false -
CString m_sPicFilename; // , rtf
bool m_bIsCopy; // true - надо удалять m_sPicFilename, false - не надо удалять
CString m_sPicFilename; //всегда содержит имя картинки, тип которой поддерживает rtf
std::vector<CString> m_aTempFiles;
......
#include "RtfDocument.h"
#include "RtfDocument.h"
#include "RtfWriter.h"
#include "Writer/OOXWriter.h"
#include "RtfProperty.h"
......@@ -49,7 +49,7 @@ CString RtfFont::RenderToRtf(RenderParameter oRenderParameter)
sResult.AppendFormat(_T(" %ls"), RtfChar::renderRtfText( m_sName, oRenderParameter.poDocument, &oFontNameCharProp ));
if( _T("") != m_sAltName )
sResult.AppendFormat(_T("{\\*\\falt %ls}"), RtfChar::renderRtfText( m_sAltName, oRenderParameter.poDocument ) );
//
//важно
sResult.AppendFormat(_T(";"));
sResult.AppendFormat(_T("}"));
}
......@@ -140,7 +140,7 @@ CString RtfFont::RenderToOOX(RenderParameter oRenderParameter)
sResult.AppendFormat(_T("<w:pitch w:val=\"%ls\" />"),sPitch);
}
//
//важно
sResult.AppendFormat(_T("</w:font>"));
}
else
......@@ -187,7 +187,7 @@ CString RtfColor::RenderToRtf(RenderParameter oRenderParameter )
// sResult.AppendFormat(_T("\\ctint%d\\cshade%d"), m_byteTint, m_byteShade);
//}
sResult.AppendFormat(_T("\\red%d\\green%d\\blue%d"), m_byteRed, m_byteGreen, m_byteBlue);
//
//важно
sResult.Append(_T(";"));
}
else
......@@ -757,7 +757,7 @@ CString RtfListLevelProperty::RenderToRtf(RenderParameter oRenderParameter)
RENDER_RTF_INT( m_nStart, sResult, _T("levelstartat") )
RENDER_RTF_INT( m_nNoRestart, sResult, _T("levelnorestart") )
RENDER_RTF_INT( m_nPictureIndex, sResult, _T("levelpicture") )
// rtf
//чтобы при последующем чтении из rtf не потерялась информация о шрифте
sResult.Append( m_oCharProp.RenderToRtf( oRenderParameter ) );
sResult.AppendFormat( _T("{\\leveltext %ls;}"), RtfChar::renderRtfText( m_sText, oRenderParameter.poDocument, &m_oCharProp ) );
......@@ -1619,27 +1619,27 @@ CString RtfParagraphProperty::RenderToRtf(RenderParameter oRenderParameter)
//RENDER_RTF_BOOL( m_bStyleSECell, sResult, _T("tscsecell") );
// ( reader wordPad)
//дописываем текст списка (для старых reader например wordPad)
if( PROP_DEF != m_nListId && PROP_DEF != m_nListLevel )
{
RtfListProperty oListProperty;
RtfDocument* poRtfDocument = static_cast<RtfDocument*>( oRenderParameter.poDocument );
RtfListOverrideProperty oListOverrideProperty;
// override table
//ищем по override table
if( true == poRtfDocument->m_oListOverrideTabel.GetList( m_nListId, oListOverrideProperty ) )
{
// List Table
//Ищем по List Table
if( true == poRtfDocument->m_oListTabel.GetList( oListOverrideProperty.m_nListID, oListProperty) )
{
// firstIndent Indent
//дописываем свойства параграфа firstIndent Indent
RtfListLevelProperty poLevelProp ;
if( true == oListProperty.GetItem( poLevelProp , m_nListLevel ) )
{
sResult.Append(_T("{\\listtext\\pard\\plain"));
sResult.Append( poLevelProp.m_oCharProp.RenderToRtf( oRenderParameter ) );
//
//пишем текст
sResult.Append( RtfChar::renderRtfText( poLevelProp.GenerateListText(), oRenderParameter.poDocument, NULL ) );
//
//или картинку
if( PROP_DEF != poLevelProp.m_nPictureIndex )
{
int nIndex = poLevelProp.m_nPictureIndex;
......@@ -1647,7 +1647,7 @@ CString RtfParagraphProperty::RenderToRtf(RenderParameter oRenderParameter)
if( 0 < nIndex && nIndex < poRtfDocument->m_oListTabel.m_aPictureList.GetCount() )
sResult.Append( poRtfDocument->m_oListTabel.m_aPictureList[nIndex]->RenderToRtf( oRenderParameter ) );
}
// tab
//ставим tab
if( PROP_DEF != poLevelProp.m_nFollow )
{
switch( poLevelProp.m_nFollow )
......@@ -1749,7 +1749,7 @@ CString RtfParagraphProperty::RenderToOOX(RenderParameter oRenderParameter)
}
}
//else
// sSpacing.AppendFormat(_T(" w:line=\"240\"")); // -
// sSpacing.AppendFormat(_T(" w:line=\"240\"")); //по умолчанию - единичный
if( false == sSpacing.IsEmpty() )
sResult.AppendFormat(_T("<w:spacing %ls/>"), sSpacing);
......@@ -2212,7 +2212,7 @@ CString RtfTableProperty::RenderToOOX(RenderParameter oRenderParameter)
else if( 1 == m_nAutoFit )
sResult.Append( _T("<w:tblLayout w:type=\"autofit\"/>") );
// , !!!
//сделаем не по документации, а как все остальные юниты !!!
if( PROP_DEF != nTableIndent && 1 != nTableIndentUnits )
{
switch(nTableIndentUnits)
......
#include "RtfReader.h"
#include "RtfReader.h"
#include "Writer/OOXWriter.h"
#include "DestinationCommand.h"
......
#pragma once
#pragma once
#include "RtfLex.h"
#include "RtfProperty.h"
#include "RtfDocument.h"
......@@ -16,7 +16,7 @@ public:
class ReaderState
{
public:
int m_nUD; //
int m_nUD; // количество символов игнорируемых за юникодом
RtfCharProperty m_oCharProp;
RtfParagraphProperty m_oParagraphProp;
RtfRowProperty m_oRowProperty;
......@@ -42,7 +42,7 @@ public:
ReaderStatePtr m_oState;
RtfSectionProperty m_oCurSectionProp;
RtfLex m_oLex;
int m_nFootnote; // chftn. footnote
int m_nFootnote; //толко для симовола chftn. основано на том что вложенных footnote быть не может
int m_nDefFont;
CString m_sTempFolder;
......@@ -243,7 +243,7 @@ public:
}
static void ExecuteTextInternalSkipChars(CString & sResult, RtfReader& oReader, CStringA& sKey, int& nSkipChars)
{
//
//удаляем символы вслед за юникодом
if( nSkipChars > 0 )
{
int nLength = sResult.GetLength();
......@@ -260,7 +260,7 @@ public:
}
if( _T("u") == sKey )
{
// m_nSkipChars \ucN
//надо правильно установить m_nSkipChars по значению \ucN
nSkipChars = oReader.m_oState->m_nUD;
}
}
......@@ -270,7 +270,7 @@ public:
if( false == sCharString.IsEmpty() )
{
int nCodepage = -1;
// codepage todo associated fonts.
//применяем параметры codepage от текущего шрифта todo associated fonts.
RtfFont oFont;
if( true == oDocument.m_oFontTable.GetFont( oReader.m_oState->m_oCharProp.m_nFont, oFont ) )
{
......@@ -279,7 +279,7 @@ public:
else if( PROP_DEF != oFont.m_nCodePage )
nCodepage = oFont.m_nCodePage;
}
//
//от настроек документа
if( -1 == nCodepage && RtfDocumentProperty::cp_none != oDocument.m_oProperty.m_eCodePage )
{
switch ( oDocument.m_oProperty.m_eCodePage )
......@@ -297,7 +297,7 @@ public:
case RtfDocumentProperty::cp_pca: nCodepage = 850;break;
}
}
// ANSI
//если ничего нет ставим ANSI
if( -1 == nCodepage )
nCodepage = CP_ACP;
......
#include "Writer/OOXWriter.h"
#include "Writer/OOXWriter.h"
#include "IdGenerator.h"
CString RtfDocumentProperty::RenderToRtf(RenderParameter oRenderParameter)
......@@ -32,7 +32,7 @@ CString RtfDocumentProperty::RenderToRtf(RenderParameter oRenderParameter)
RENDER_RTF_BOOL( m_bAlignBordersAndEdges, sResult, _T("pgbrdrsnap") )
//Page Information
//
//эти свойства пишутся в первой секции
//public: int m_nPaperWidth; //\paperwN Paper width in twips (default is 12,240).
//public: int m_nPaperHeight; //\paperhN Paper height in twips (default is 15,840).
//public: int m_nMarginLeft; //\marglN Left margin in twips (default is 1800).
......@@ -97,7 +97,7 @@ CString RtfDocumentProperty::RenderToRtf(RenderParameter oRenderParameter)
}
}
// RTF
//для схоранения в RTF
RENDER_RTF_INT( m_bSplitPageBrake, sResult, _T("spltpgpar") )
if( 0 != m_bHtmlAutoSpace )
......@@ -216,7 +216,7 @@ CString RtfSectionProperty::RenderToRtf(RenderParameter oRenderParameter)
{
CString sResult;
if( RENDER_TO_OOX_PARAM_FIRST_SECTION == oRenderParameter.nType ) //
if( RENDER_TO_OOX_PARAM_FIRST_SECTION == oRenderParameter.nType ) //Пишем как свойства документа
{
//Page Information
RENDER_RTF_INT( m_nPageWidth, sResult, _T("paperw") )
......@@ -340,7 +340,7 @@ CString RtfSectionProperty::RenderToRtf(RenderParameter oRenderParameter)
case lnr_linecont: sResult.Append( _T("\\linecont") );break;
}
if( RENDER_TO_OOX_PARAM_FIRST_SECTION != oRenderParameter.nType )//
if( RENDER_TO_OOX_PARAM_FIRST_SECTION != oRenderParameter.nType )//Пишем как свойства секции
{
//Page Information
RENDER_RTF_INT( m_nPageWidth, sResult, _T("pgwsxn") )
......
#pragma once
#pragma once
#include "Basic.h"
#include "RtfParagraph.h"
......@@ -84,7 +84,7 @@ public:
}EndnotePlacement;
EndnotePlacement m_eEndnotePlacement;
// RTF
//для схоранения в RTF
int m_bSplitPageBrake; //\spltpgpar
......@@ -123,7 +123,7 @@ public:
m_nHyphenationRight = PROP_DEF;
m_nZoom = 100;
// default ansi codepage
//вычисляем стандартный default ansi codepage для системы
TCHAR codepage[7];
int nRes = GetLocaleInfo( LOCALE_SYSTEM_DEFAULT, LOCALE_IDEFAULTANSICODEPAGE, codepage, 6 );
if( nRes != 0 )
......@@ -316,12 +316,12 @@ public:
FootnotesRestart m_eFootnotesRestart;
typedef enum {
ff_none,
ff_sftnnar, //\sftnnar Footnote numberingArabic numbering (1, 2, 3, ).
ff_sftnnalc, //\sftnnalc Footnote numberingAlphabetical lowercase (a, b, c, ).
ff_sftnnauc, //\sftnnauc Footnote numberingAlphabetical uppercase (A, B, C, ).
ff_sftnnrlc, //\sftnnrlc Footnote numberingRoman lowercase (i, ii, iii, ).
ff_sftnnruc, //\sftnnruc Footnote numberingRoman uppercase (I, II, III, ).
ff_sftnnchi, //\sftnnchi Footnote numberingChicago Manual of Style (*, , , ).
ff_sftnnar, //\sftnnar Footnote numbering—Arabic numbering (1, 2, 3, …).
ff_sftnnalc, //\sftnnalc Footnote numbering—Alphabetical lowercase (a, b, c, …).
ff_sftnnauc, //\sftnnauc Footnote numbering—Alphabetical uppercase (A, B, C, …).
ff_sftnnrlc, //\sftnnrlc Footnote numbering—Roman lowercase (i, ii, iii, …).
ff_sftnnruc, //\sftnnruc Footnote numbering—Roman uppercase (I, II, III, …).
ff_sftnnchi, //\sftnnchi Footnote numbering—Chicago Manual of Style (*, †, ‡, §).
ff_sftnnchosung, //\sftnnchosung Footnote Korean numbering 1 (CHOSUNG).
ff_sftnncnum, //\sftnncnum Footnote Circle numbering (CIRCLENUM).
ff_sftnndbnum, //\sftnndbnum Footnote kanji numbering without the digit character (DBNUM1).
......@@ -334,9 +334,9 @@ public:
ff_sftnngbnumd, //\sftnngbnumd Footnote Chinese numbering 2 (GB2).
ff_sftnngbnuml, //\sftnngbnuml Footnote Chinese numbering 3 (GB3).
ff_sftnngbnumk, //\sftnngbnumk Footnote Chinese numbering 4 (GB4).
ff_sftnnzodiac, //\sftnnzodiac Footnote numberingChinese Zodiac numbering 1 (ZODIAC1).
ff_sftnnzodiacd, //\sftnnzodiacd Footnote numberingChinese Zodiac numbering 2 (ZODIAC2).
ff_sftnnzodiacl, //\sftnnzodiacl Footnote numberingChinese Zodiac numbering 3 (ZODIAC3).
ff_sftnnzodiac, //\sftnnzodiac Footnote numberingChinese Zodiac numbering 1 (ZODIAC1).
ff_sftnnzodiacd, //\sftnnzodiacd Footnote numberingChinese Zodiac numbering 2 (ZODIAC2).
ff_sftnnzodiacl, //\sftnnzodiacl Footnote numberingChinese Zodiac numbering 3 (ZODIAC3).
}FootnotesFormat;
FootnotesFormat m_eFootnotesFormat;
......@@ -349,12 +349,12 @@ public:
EndnotesRestart m_eEndnotesRestart;
typedef enum {
ef_none,
ef_saftnnar, //\saftnnar Endnote numberingArabic numbering (1, 2, 3, ).
ef_saftnnalc, //\saftnnalc Endnote numberingAlphabetical lowercase (a, b, c, ).
ef_saftnnauc, //\saftnnauc Endnote numberingAlphabetical uppercase (A, B, C, ).
ef_saftnnrlc, //\saftnnrlc Endnote numberingRoman lowercase (i, ii, iii, ).
ef_saftnnruc, //\saftnnruc Endnote numberingRoman uppercase (I, II, III, ).
ef_saftnnchi, //\saftnnchi Endnote numberingChicago Manual of Style (*, , , ).
ef_saftnnar, //\saftnnar Endnote numbering—Arabic numbering (1, 2, 3, …).
ef_saftnnalc, //\saftnnalc Endnote numbering—Alphabetical lowercase (a, b, c, …).
ef_saftnnauc, //\saftnnauc Endnote numbering—Alphabetical uppercase (A, B, C, …).
ef_saftnnrlc, //\saftnnrlc Endnote numbering—Roman lowercase (i, ii, iii, …).
ef_saftnnruc, //\saftnnruc Endnote numbering—Roman uppercase (I, II, III, …).
ef_saftnnchi, //\saftnnchi Endnote numbering—Chicago Manual of Style (*, †, ‡, §).
ef_saftnnchosung, //\saftnnchosung Endnote Korean numbering 1 (CHOSUNG).
ef_saftnncnum, //\saftnncnum Endnote Circle numbering (CIRCLENUM).
ef_saftnndbnum, //\saftnndbnum Endnote kanji numbering without the digit character (DBNUM1).
......@@ -367,9 +367,9 @@ public:
ef_saftnngbnumd, //\saftnngbnumd Endnote Chinese numbering 2 (GB2).
ef_saftnngbnuml, //\saftnngbnuml Endnote Chinese numbering 3 (GB3).
ef_saftnngbnumk, //\saftnngbnumk Endnote Chinese numbering 4 (GB4).
ef_saftnnzodiac, //\saftnnzodiac Endnote numberingChinese Zodiac numbering 1 (ZODIAC1).
ef_saftnnzodiacd, //\saftnnzodiacd Endnote numberingChinese Zodiac numbering 2 (ZODIAC2).
ef_saftnnzodiacl, //\saftnnzodiacl Endnote numberingChinese Zodiac numbering 3 (ZODIAC3).
ef_saftnnzodiac, //\saftnnzodiac Endnote numberingChinese Zodiac numbering 1 (ZODIAC1).
ef_saftnnzodiacd, //\saftnnzodiacd Endnote numberingChinese Zodiac numbering 2 (ZODIAC2).
ef_saftnnzodiacl, //\saftnnzodiacl Endnote numberingChinese Zodiac numbering 3 (ZODIAC3).
}EndnotesFormat;
EndnotesFormat m_eEndnotesFormat;
......@@ -444,7 +444,7 @@ public:
TextItemContainerPtr m_oFooterFirst;
TextItemContainerPtr m_oFooterRight;
CString m_sIDHeaderLeft; // OOX
CString m_sIDHeaderLeft; //для OOX
CString m_sIDHeaderFirst;
CString m_sIDHeaderRight;
CString m_sIDFooterLeft;
......@@ -559,7 +559,7 @@ public:
DEFAULT_PROPERTY( m_nBorderMeasure )
DEFAULT_PROPERTY( m_nBorderAlign )
//footer - header
//footer - header надо обнулять вручную
//m_oHeaderLeft = TextItemContainerPtr();
//m_oHeaderFirst = TextItemContainerPtr();
//m_oHeaderRight = TextItemContainerPtr();
......
#include "RtfShape.h"
#include "RtfShape.h"
#include "Writer/OOXWriter.h"
#include "RtfOle.h"
......@@ -7,7 +7,7 @@ CString RtfShape::RenderToRtf(RenderParameter oRenderParameter)
CString sResult;
if( PROP_DEF != m_nShapeType && 0 != m_nShapeType )
{
//
//запоминаем координаты и если нужно поворачиваем
int nLeft = m_nLeft;
int nTop = m_nTop;
int nRight = m_nRight;
......@@ -104,7 +104,7 @@ CString RtfShape::RenderToRtf(RenderParameter oRenderParameter)
}
sResult.Append(_T("}"));
}
//
//восстанавливаем координаты и если нужно поворачиваем
m_nLeft = nLeft;
m_nTop = nTop;
m_nRight = nRight;
......@@ -273,7 +273,7 @@ CString RtfShape::RenderToOOX(RenderParameter oRenderParameter)
RtfDocument* poDocument = static_cast<RtfDocument*>(oRenderParameter.poDocument);
if( PROP_DEF != m_nShapeType && 0 != m_nShapeType )
{
if( false && RENDER_TO_OOX_PARAM_SHAPE_WSHAPE != oRenderParameter.nType && NULL != m_oPicture ) // drawing
if( false && RENDER_TO_OOX_PARAM_SHAPE_WSHAPE != oRenderParameter.nType && NULL != m_oPicture ) //картинки пишем как drawing
{
if( st_inline == m_eShapeType )
{
......@@ -338,7 +338,7 @@ CString RtfShape::RenderToOOX(RenderParameter oRenderParameter)
sResult.AppendFormat( _T("<pic:blipFill><a:blip r:embed=\"%ls\"/>"), m_oPicture->RenderToOOX(oRenderParameter) );
CString sCrop;
if( PROP_DEF != nCropLeft )
sCrop.AppendFormat( _T(" l=\"%d\""), nCropLeft ); //
sCrop.AppendFormat( _T(" l=\"%d\""), nCropLeft ); //тысячный доли процента
if( PROP_DEF != nCropTop )
sCrop.AppendFormat( _T(" t=\"%d\""), nCropTop );
if( PROP_DEF != nCropRight )
......@@ -360,7 +360,7 @@ CString RtfShape::RenderToOOX(RenderParameter oRenderParameter)
nRotation = m_nRelRotation;
if( PROP_DEF != nRotation )
{
int nOOXRotation = (int)( 60000.0 * nRotation / 0x10000 );// 1 == 60000
int nOOXRotation = (int)( 60000.0 * nRotation / 0x10000 );//Опытным путем 1 градус == 60000
sResult.AppendFormat( _T(" rot=\"%d\""), nOOXRotation );
}
sResult.Append( _T(">") );
......@@ -379,7 +379,7 @@ CString RtfShape::RenderToOOX(RenderParameter oRenderParameter)
if( PROP_DEF != m_oPicture->m_nWidthGoal && PROP_DEF != m_oPicture->m_nHeightGoal )
{
sResult.Append( _T("<w:r><w:drawing><wp:anchor") );
int nDistLeft = 0;//
int nDistLeft = 0;//аттрибуты обязательные
int nDistTop = 0;
int nDistRight = 0;
int nDistBottom = 0;
......@@ -602,7 +602,7 @@ CString RtfShape::RenderToOOX(RenderParameter oRenderParameter)
sResult.AppendFormat( _T("<pic:blipFill><a:blip r:embed=\"%ls\"/>"), m_oPicture->RenderToOOX(oRenderParameter) );
CString sCrop;
if( PROP_DEF != nCropLeft )
sCrop.AppendFormat( _T(" l=\"%d\""), nCropLeft ); //
sCrop.AppendFormat( _T(" l=\"%d\""), nCropLeft ); //тысячный доли процента
if( PROP_DEF != nCropTop )
sCrop.AppendFormat( _T(" t=\"%d\""), nCropTop );
if( PROP_DEF != nCropRight )
......@@ -625,7 +625,7 @@ CString RtfShape::RenderToOOX(RenderParameter oRenderParameter)
nRotation = m_nRelRotation;
if( PROP_DEF != nRotation )
{
int nOOXRotation = (int)( 60000.0 * nRotation / 65536 );// 1 == 60000
int nOOXRotation = (int)( 60000.0 * nRotation / 65536 );//Опытным путем 1 градус == 60000
sResult.AppendFormat( _T(" rot=\"%d\""), nOOXRotation );
}
sResult.Append( _T(">") );
......@@ -644,7 +644,7 @@ CString RtfShape::RenderToOOX(RenderParameter oRenderParameter)
{
TextItemContainerPtr aTempTextItems;
if( 75 == m_nShapeType && 0 != m_aTextItems )
{// Ole anchor, TextBox -
{//Значит это Ole обьект с anchor, для него все также только TextBox надо делать по-другому
aTempTextItems = m_aTextItems;
m_aTextItems = TextItemContainerPtr();
m_bIsOle = true;
......@@ -656,8 +656,8 @@ CString RtfShape::RenderToOOX(RenderParameter oRenderParameter)
CString sOle;
if( 0 != aTempTextItems )
{// Ole
// ole
{//пишем только Ole обьект
//ищем первый ole обьект
RtfOlePtr poFirstOle;
int nTempTextItemsCount = aTempTextItems->GetCount();
for( int i = 0; i < nTempTextItemsCount; i++ )
......@@ -676,7 +676,7 @@ CString RtfShape::RenderToOOX(RenderParameter oRenderParameter)
poCurParagraph->GetItem( piCurIDocumentElement, j );
if( NULL != piCurIDocumentElement && TYPE_RTF_OLE == piCurIDocumentElement->GetType() )
{
// Ole
//рендерим только Ole часть
RenderParameter oNewParam = oRenderParameter;
oNewParam.nType = RENDER_TO_OOX_PARAM_OLE_ONLY;
oNewParam.nValue = m_nID;
......@@ -695,7 +695,7 @@ CString RtfShape::RenderToOOX(RenderParameter oRenderParameter)
}
}
}
// text box
//возвращаем text box на место
m_aTextItems = aTempTextItems;
}
if( false == sOle.IsEmpty() )
......@@ -716,7 +716,7 @@ CString RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
else if( RENDER_TO_OOX_PARAM_SHAPE_WSHAPE == oRenderParameter.nType )
sResult.Append(_T("<w:pict>"));
else
sResult.Append(_T("<w:r><w:pict>"));//
sResult.Append(_T("<w:r><w:pict>"));//работает по умолчанию
if( _T("") == oRenderParameter.sValue )
sResult.Append( _T("<v:shape") );
else
......@@ -747,7 +747,7 @@ CString RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
CString sStyle ;
if( PROP_DEF != m_nLeft && PROP_DEF != m_nRight && PROP_DEF != m_nTop && PROP_DEF != m_nBottom )
{
// inline
//не пишем если inline
if( 3 != m_nPositionHRelative || 3 != m_nPositionVRelative )
{
sStyle .Append( _T("position:absolute;") );
......@@ -898,10 +898,10 @@ CString RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
else if( PROP_DEF != m_nZOrder )
nZIndex = m_nZOrder;
else
nZIndex = 100; // 100
nZIndex = 100; //на свое усмотрение ставлю 100
if( PROP_DEF != m_nZOrderRelative )
{
//
//берем большое значение чтобы сделать строго выше или ниже текста
if( 0 == m_nZOrderRelative )
sStyle.AppendFormat( _T("z-index:%d;"), 10000 + nZIndex );//Text is below shape
else
......@@ -1136,7 +1136,7 @@ CString RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
nCropBottom = (int)( 65536 * ( 1.0 * m_oPicture->m_nCropB / m_oPicture->m_nHeightGoal) );
CString sPicture = m_oPicture->RenderToOOX(oRenderParameter);
if( _T("") == sPicture )// , shape
if( _T("") == sPicture )//если не сохранилась картинка, то весь shape будет бесполезным
return _T("");
sResult.AppendFormat( _T("<v:imagedata r:id=\"%ls\""), sPicture );
if( PROP_DEF != nCropLeft )
......@@ -1163,7 +1163,7 @@ CString RtfShape::RenderToOOXEnd(RenderParameter oRenderParameter)
else if( RENDER_TO_OOX_PARAM_SHAPE_WSHAPE == oRenderParameter.nType )
sResult.Append(_T("</w:pict>"));
else
sResult.Append(_T("</w:pict></w:r>"));//
sResult.Append(_T("</w:pict></w:r>"));//работает по умолчанию
return sResult;
}
CString RtfShapeGroup::RenderToRtf(RenderParameter oRenderParameter)
......
#pragma once
#pragma once
#include "RtfPicture.h"
class RtfShape: public IRenderableProperty
......@@ -93,7 +93,7 @@ public:
int m_nConnectorStyle; //cxstyle Connector style
//WordArt Effects
int m_nCropFromTop; //cropFromTop Top cropping percentage. Èçìåðÿåòñÿ â fraction 1 /65536
int m_nCropFromTop; //cropFromTop Top cropping percentage. Измеряется в fraction 1 /65536
int m_nCropFromBottom; //cropFromBottom Bottom cropping percentage.
int m_nCropFromLeft; //cropFromLeft Left cropping percentage.
int m_nCropFromRight; //cropFromRight Right cropping percentage.
......@@ -161,8 +161,8 @@ public:
DEFAULT_PROPERTY( m_nWrapSideType )
DEFAULT_PROPERTY( m_nZOrderRelative )
DEFAULT_PROPERTY( m_bLockAnchor )
DEFAULT_PROPERTY_DEF( m_eXAnchor, ax_column ) //ïî óìîë÷àíèþ - ïðèâÿçêà ê òåêñòó
DEFAULT_PROPERTY_DEF( m_eYAnchor, ay_Para )//ïî óìîë÷àíèþ - ïðèâÿçêà ê òåêñòó
DEFAULT_PROPERTY_DEF( m_eXAnchor, ax_column ) //по умолчанию - привязка к тексту
DEFAULT_PROPERTY_DEF( m_eYAnchor, ay_Para )//по умолчанию - привязка к тексту
//Position absolute
DEFAULT_PROPERTY( m_nPositionH )
......@@ -263,16 +263,16 @@ public: CString RenderToOOX(RenderParameter oRenderParameter);
CString RenderToOOXEnd(RenderParameter oRenderParameter);
void ToRtfRotation( int nAngel , int &nLeft, int &nTop, int& nRight, int& nBottom )
{
//ïîâîðà÷èâàåì íà 45 ãðàäóñîâ
//поворачиваем на 45 градусов
nAngel -= 45;
//äåëàåì óãîë îò 0 äî 360
//делаем угол от 0 до 360
nAngel = nAngel % 360;
if( nAngel < 0 )
nAngel += 360;
int nQuater = nAngel / 90; // îïðåäåëÿåì ÷åòâåðòü
int nQuater = nAngel / 90; // определяем четверть
if( 0 == nQuater || 2 == nQuater )
{
//ïîâîðà÷èâàåì îòíîñèòåëüíî öåíòðà íà 90 ãðàäóñîâ îáðàòíî
//поворачиваем относительно центра на 90 градусов обратно
int nCenterX = ( nLeft + nRight ) / 2;
int nCenterY = ( nTop + nBottom ) / 2;
int nWidth = nRight - nLeft;
......
#pragma once
#pragma once
#include "Basic.h"
#include "RtfTableRow.h"
//TODO
//TODO не работает если сделать вертикальный мерж и убрать разделение на пераграфы
class RtfTable : public ITextItem, public ItemContainer< RtfTableRowPtr >
{
public:
......@@ -56,12 +56,12 @@ public:
void CalculateGridProp()
{
// cellx
std::vector<int> aCellx; //
//массив всевозможных cellx
std::vector<int> aCellx; // упорядочен по возрастанию
int nLastCellx = 0;
//m_aArray -
//m_aArray - строки
for( int nCurRow = 0; nCurRow < (int)m_aArray.size(); nCurRow++ )
{
nLastCellx = 0;
......@@ -74,8 +74,8 @@ public:
if( PROP_DEF != oCurRow->m_oProperty.m_nWidthEndInvCell && mu_Twips == oCurRow->m_oProperty.m_eMUEndInvCell)
nWidthAfter = oCurRow->m_oProperty.m_nWidthEndInvCell;
int nDelta = 0;// margin indent spacing
if( PROP_DEF != oCurRow->m_oProperty.m_nLeft ) // row
int nDelta = 0;// поправка на margin и indent и spacing
if( PROP_DEF != oCurRow->m_oProperty.m_nLeft ) //для каждого row свой
nDelta = -oCurRow->m_oProperty.m_nLeft;
else
{
......@@ -89,7 +89,7 @@ public:
nDelta -= oCurRow->m_oProperty.m_nWidthStartInvCell;
}
// widthBefore
//добавляем widthBefore
if( 0 != nWidthBefore )
{
AddToArray( aCellx, nWidthBefore );
......@@ -103,18 +103,18 @@ public:
int nCellx = nWidthBefore + nDelta + oCurCell->m_oProperty.m_nCellx;
AddToArray( aCellx, nCellx );
// , row - oox
//те свойства, что остались в row не трогаем - они не важны для конвертации в oox
nLastCellx = nCellx;
}
// widthAfter
//добавляем widthAfter
if( 0 != nWidthAfter)
AddToArray( aCellx, nLastCellx + nWidthAfter );
}
// Span
//вычисляем Span
for(int i = 0; i < (int)m_aArray.size();i++)
{
RtfTableRowPtr oCurRow= m_aArray[ i ];
//
//индекс последнего минимального элемента
int nLastIndex = 0;
int nLastCellx = 0;
......@@ -125,8 +125,8 @@ public:
if( PROP_DEF != oCurRow->m_oProperty.m_nWidthEndInvCell && mu_Twips == oCurRow->m_oProperty.m_eMUEndInvCell)
nWidthAfter = oCurRow->m_oProperty.m_nWidthEndInvCell;
int nDelta = 0;// margin indent spacing border
if( PROP_DEF != oCurRow->m_oProperty.m_nLeft ) // row
int nDelta = 0;// поправка на margin и indent и spacing и border
if( PROP_DEF != oCurRow->m_oProperty.m_nLeft ) //для каждого row свой
nDelta = -oCurRow->m_oProperty.m_nLeft;
else
{
......@@ -140,7 +140,7 @@ public:
nDelta -= oCurRow->m_oProperty.m_nWidthStartInvCell;
}
// gridBefore
//добавляем gridBefore
if( 0 != nWidthBefore )
for( int k = nLastIndex; k < (int)aCellx.size(); k++ )
{
......@@ -174,7 +174,7 @@ public:
nLastCellx = nCellx;
}
// gridAfter
//добавляем gridAfter
if( 0 != nWidthAfter )
for(int k = nLastIndex; k < (int)aCellx.size(); k++)
{
......@@ -186,7 +186,7 @@ public:
}
}
}
// gridTable
//вычисляем gridTable
for( int i = 0; i < (int)aCellx.size(); i++ )
{
if( i == 0 )
......@@ -196,18 +196,18 @@ public:
}
}
void CalculateCellx( RtfDocument& oDocument )//todo margin indent
void CalculateCellx( RtfDocument& oDocument )//todo учитывать margin indent
{
if( m_aTableGrid.size() == 0 && m_aArray.size() > 0 )
{
// <w:tblGrid/>
//если отсутствует <w:tblGrid/> делаем пропорционально
m_oProperty.m_nAutoFit = 1;
if( ( PROP_DEF == m_oProperty.m_nWidth || m_oProperty.m_nWidth <= 0 ) )
{
// , 100%
//если не задана ширина таблицы, считаем ее 100%
// Width = PageWidth - MarginLeft - MarginRight - Gutter
int nGutter = oDocument.m_oProperty.m_nGutterWidth;
if( 1 == oDocument.m_oProperty.m_bGutterAtTop )// Top gutter
if( 1 == oDocument.m_oProperty.m_bGutterAtTop )//не учитываем если это Top gutter
nGutter = 0;
m_oProperty.m_nWidth = oDocument.m_oProperty.m_nPaperWidth - oDocument.m_oProperty.m_nMarginLeft - oDocument.m_oProperty.m_nMarginRight - nGutter;
m_oProperty.m_eMUWidth = mu_Twips;
......@@ -246,7 +246,7 @@ public:
nLeft -= m_oProperty.m_nDefCellMarLeft;
if( PROP_DEF != m_oProperty.m_nDefCellSpLeft && 3 == m_oProperty.m_nDefCellSpLeftUnits )
nLeft += 2 * m_oProperty.m_nDefCellSpLeft;
int nDelta = nLeft;// left GrindBefore
int nDelta = nLeft;//в left учитывается GrindBefore
if( PROP_DEF != oCurRow->m_oProperty.m_nGridBefore )
{
......@@ -307,7 +307,7 @@ public:
}
private:
void AddToArray( std::vector<int>& aArray, int nValue )//todo
void AddToArray( std::vector<int>& aArray, int nValue )//todo можно применить то что он упорядоченный
{
bool bNeedAdd = true;
for(int k = 0; k < (int)aArray.size(); k++)
......
#pragma once
#pragma once
#include "Basic.h"
#include "RtfProperty.h"
......@@ -40,7 +40,7 @@ public:
if( RENDER_TO_RTF_PARAM_NESTED != oRenderParameter.nType )
result.Append( _T("\\cell"));
else
result.Append( _T("\\nestcell{\\nonesttables }")); //todo
result.Append( _T("\\nestcell{\\nonesttables }")); //todo как бы вернуть
return result;
}
CString RenderToOOX(RenderParameter oRenderParameter)
......
#pragma once
#pragma once
#include "Basic.h"
#include "RtfTableCell.h"
......
#pragma once
#pragma once
#ifdef _WIN32
#include <atlbase.h>
......

#include "RtfWriter.h"
#include "RtfDocument.h"
......@@ -20,7 +20,7 @@ bool RtfWriter::SaveByItemStart()
// BSTR bstrFileName = m_sTempFileResult.AllocSysString();
// m_oFileWriter = new NFileWriter::CBufferedFileWriter( bstrFileName );
// SysFreeString( bstrFileName );
// // ( )
// //создаем темповый файл куда пишем параграфы( потом копируем свойства секции и содержимое файла )
// m_sTempFile = Utils::CreateTempFile( m_sTempFolder );
// BSTR bstrTempFileName = m_sTempFile.AllocSysString();
// m_oTempFileWriter = new NFileWriter::CBufferedFileWriter( bstrTempFileName );
......@@ -68,10 +68,10 @@ bool RtfWriter::SaveByItem()
if( m_oDocument.GetCount() > 1 && m_oDocument[0]->GetCount() == 0 )
{
//
//пишем конец секции
CStringA sRtfExt = "\\sect";
m_oCurTempFileWriter->Write( (BYTE*)(LPCSTR)sRtfExt, sRtfExt.GetLength() );
//
//окончательно дописываем темповый файл
RELEASEOBJECT( m_oCurTempFileWriter )
try
{
......@@ -86,19 +86,19 @@ bool RtfWriter::SaveByItem()
}
if( NULL != m_oCurTempFileSectWriter )
{
//
//пишем свойства секции
CString sRtf;
if( true == m_bFirst )
{
//
//первый свойства секции пишем как свойства документа
m_bFirst = false;
oNewParam.nType = RENDER_TO_OOX_PARAM_FIRST_SECTION;
}
sRtf = m_oDocument[0]->m_oProperty.RenderToRtf(oNewParam);
RtfInternalEncoder::Decode( sRtf, *m_oCurTempFileSectWriter );
//
//дописываем в файл
RELEASEOBJECT( m_oCurTempFileSectWriter );
//
//создаем новый
CString sNewTempFileSect = Utils::CreateTempFile( m_sTempFolder );
m_aTempFilesSectPr.push_back( sNewTempFileSect );
......@@ -108,15 +108,15 @@ bool RtfWriter::SaveByItem()
//RtfInternalEncoder::Decode( sRtf, *m_oFileWriter );
//m_oFileWriter->Write( (BYTE*)(LPCSTR)sRtf, sRtf.GetLength() );
}
//
//удаляем секцию
m_oDocument.RemoveItem( 0 );
}
//
//пишем параграф
if( m_oDocument.GetCount() > 0 && m_oDocument[0]->GetCount() > 0 )
{
CString sRtf;
sRtf = m_oDocument[0]->operator[](0)->RenderToRtf(oNewParam);
if( TYPE_RTF_PARAGRAPH == m_oDocument[0]->operator[](0)->GetType() && !(m_oDocument[0]->GetCount() == 0 && m_oDocument.GetCount() > 1) )// \par
if( TYPE_RTF_PARAGRAPH == m_oDocument[0]->operator[](0)->GetType() && !(m_oDocument[0]->GetCount() == 0 && m_oDocument.GetCount() > 1) )//для последнего параграфа секции не пишем \par
{
sRtf.Append( _T("\\par") );
//oNewParam.nValue = RENDER_TO_RTF_PARAM_NO_PAR;
......@@ -124,14 +124,14 @@ bool RtfWriter::SaveByItem()
RtfInternalEncoder::Decode( sRtf, *m_oCurTempFileWriter );
//m_oTempFileWriter->Write( (BYTE*)(LPCSTR)sRtf, sRtf.GetLength() );
//
//удаляем элемент который только что написали
m_oDocument[0]->RemoveItem( 0 );
}
return true;
}
bool RtfWriter::SaveByItemEnd()
{
//
//окончательно дописываем темповый файл
RELEASEOBJECT( m_oCurTempFileWriter );
CString sRtf;
......@@ -144,40 +144,40 @@ bool RtfWriter::SaveByItemEnd()
if( NULL != m_oCurTempFileSectWriter )
{
//
//пишем последнюю секцию
if( true == m_bFirst )
{
//
//первый свойства секции пишем как свойства документа
m_bFirst = false;
oNewParam.nType = RENDER_TO_OOX_PARAM_FIRST_SECTION;
}
sRtf = m_oDocument[0]->m_oProperty.RenderToRtf(oNewParam);
RtfInternalEncoder::Decode( sRtf, *m_oCurTempFileSectWriter );
//
//дописываем в файл
RELEASEOBJECT( m_oCurTempFileSectWriter );
}
//RtfInternalEncoder::Decode( sRtf, *m_oCurTempFileWriter );
//m_oFileWriter->Write( (BYTE*)(LPCSTR)sRtf, sRtf.GetLength() );
//
//удаляем секцию
m_oDocument.RemoveItem( 0 );
}
//
//формируем выходной файл
try
{
NFileWriter::CBufferedFileWriter oTargetFileWriter( m_sFilename );
//
//пишем заголовок потом все содежимое
sRtf = CreateRtfStart();
DWORD dwBytesWrite = 0;
RtfInternalEncoder::Decode( sRtf, oTargetFileWriter );
//WriteFile ( hTargetFile, sRtf, ( DWORD ) sRtf.GetLength(), &dwBytesWrite, NULL );
//
//копируем заголовки из массива и параграфы из темповых файлов
for( int i = 0 ; i < (int)m_aTempFiles.size() && i < (int)m_aTempFilesSectPr.size(); i++ )
{
//
//свойства секции
CFile file;
if (file.OpenFile(m_aTempFilesSectPr[i]) == S_OK)
......@@ -195,7 +195,7 @@ bool RtfWriter::SaveByItemEnd()
}
file.CloseFile();
}
//
//параграфы
if (file.OpenFile(m_aTempFiles[i]) == S_OK)
{
DWORD dwBytesRead = 1;
......@@ -213,7 +213,7 @@ bool RtfWriter::SaveByItemEnd()
}
}
//
//завершаем документ
sRtf = CreateRtfEnd();
RtfInternalEncoder::Decode( sRtf, oTargetFileWriter );
byte nEndFile = 0;
......
#pragma once
#pragma once
#define BUFSIZE 2048
#include <time.h>
......@@ -10,16 +10,16 @@ class Utils
public:
static int CopyDirOrFile(CString sSource, CString sDestination)
{
// sDestination, .
//удаляем sDestination, чтобы там не было.
if( 0 != RemoveDirOrFile( sDestination ) )
return 1;
//
//копируем
CDirectory::CopyFile(sSource, sDestination, NULL, NULL);
return 0;
}
// return ""
// return "" если не удалось создать
static int RemoveDirOrFile(CString sPath)
{
......@@ -39,8 +39,8 @@ public:
else
return CreateTempFile();
}
// return ""
static CString CreateTempDir( CString sDir )// sDir
// return "" если не удалось создать
static CString CreateTempDir( CString sDir )//создаем файл в папке sDir
{
if( _T("") != sDir )
{
......@@ -56,7 +56,7 @@ public:
static CString PrepareToXML( CString sInput)
{
CString sResult = sInput;
//&amp; (&), &lt; (<), &gt; (>), &apos; ('), &quot; (")
//&amp; («&»), &lt; («<»), &gt; («>»), &apos; («'»), и &quot; («"»)
sResult.Replace(_T("&"), _T("&amp;"));
sResult.Replace(_T("<"), _T("&lt;"));
sResult.Replace(_T(">"), _T("&gt;"));
......
#pragma once
#pragma once
#include "../../../Common/FileWriter.h"
......@@ -138,7 +138,7 @@ public:
}
static bool MultybyteToUnicode(CStringA sInputStr, CStringW& sOutputStr, int nCodepage)
{
//todooo
//todooo ПЕРЕПИСАТЬ
sOutputStr = _T("");
int nBufSize = MultiByteToWideChar(nCodepage, 0, sInputStr, -1, NULL, NULL);
LPWSTR p = new WCHAR[ nBufSize + 1 ];
......@@ -155,7 +155,7 @@ public:
}
static CStringW Utf8ToUnicode(CStringA sInputStr)//todo
{
//todooo
//todooo ПЕРЕПИСАТЬ
CStringW sResult;
int nBufSize = MultiByteToWideChar(CP_UTF8, 0, sInputStr, -1, NULL, NULL);
LPWSTR p = new WCHAR[ nBufSize + 1 ];
......@@ -167,7 +167,7 @@ public:
}
static CStringA UnicodeToUtf8(CStringW sInputStr)//todo
{
//todooo
//todooo ПЕРЕПИСАТЬ
CStringA sResult;
int nBufSize = WideCharToMultiByte(CP_UTF8, 0, sInputStr, -1, NULL, NULL, NULL, NULL);
LPSTR p = new CHAR[ nBufSize + 1 ];
......@@ -244,7 +244,7 @@ public:
}
static int px2Twip(int px)
{
return 15 * px; // word
return 15 * px; //из наблюдений за word
}
static int pc2Twip(double pc)
{
......@@ -374,9 +374,9 @@ public:
static CString Preserve( CString sText )
{
CString sResult = sText;
//
//обрезавем лишние пробелы
sResult.Trim();
//
//удаляем дублирующие пробелы
while( sResult.Replace( _T(" "), _T(" ") ) > 0 )
;
return sResult;
......@@ -464,7 +464,7 @@ public:
{
return _T("{\\*filename ") + sFilename + _T("\\*end}");
}
static void Decode( CString& sText, NFileWriter::CBufferedFileWriter& oFileWriter ) //
static void Decode( CString& sText, NFileWriter::CBufferedFileWriter& oFileWriter ) //сразу записывает в файл
{
CStringA sAnsiText; sAnsiText = sText;
int nStart = 0;
......
#pragma once
#pragma once
class OOXContentTypesWriter
......
#include "OOXDocumentWriter.h"
#include "OOXDocumentWriter.h"
//#include "OOXContentTypesWriter.h"
#include "OOXRelsWriter.h"
#include "OOXDocumentWriter.h"
......@@ -13,7 +13,7 @@
CString OOXDocumentWriter::CreateXmlStart()
{
// Footnotes
//пишем Footnotes
RenderParameter oNewParam;
oNewParam.poDocument = &m_oDocument;
oNewParam.poWriter = &m_oWriter;
......@@ -22,7 +22,7 @@ CString OOXDocumentWriter::CreateXmlStart()
// document.xml
//пишем document.xml
CString sResult = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>\n");
sResult.Append( _T("<w:document") );
sResult.Append( _T(" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\"") );
......@@ -42,7 +42,7 @@ CString OOXDocumentWriter::CreateXmlEnd( )
{
CString sResult ;
// document.xml
//пишем все кроме document.xml
RenderParameter oNewParam;
oNewParam.poDocument = &m_oDocument;
oNewParam.poWriter = &m_oWriter;
......@@ -110,7 +110,7 @@ CString OOXDocumentWriter::CreateXmlEnd( )
m_oDocument.m_oInformation.RenderToOOX(oNewParam);
//
//пишем финальные свойства секции
oNewParam.poDocument = &m_oDocument;
oNewParam.poWriter = &m_oWriter;
oNewParam.poRels = &m_oWriter.m_oDocRels;
......
#pragma once
#pragma once
#include "../RtfDocument.h"
#include "OOXWriter.h"
......@@ -10,7 +10,7 @@ private:
OOXWriter& m_oWriter;
RtfDocument& m_oDocument;
NFileWriter::CBufferedFileWriter* m_oFileWriter;
bool m_bFirst; //
bool m_bFirst; //один параграф пишем другой храним в памяти
public:
OOXDocumentWriter( OOXWriter& oWriter,RtfDocument& oDocument ): m_oWriter(oWriter), m_oDocument(oDocument)
{
......@@ -59,12 +59,12 @@ public:
oNewParam.poRels = &m_oWriter.m_oDocRels;
oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
if( m_oDocument.GetCount() > 1 && m_oDocument[1]->GetCount() > 0 )// -
if( m_oDocument.GetCount() > 1 && m_oDocument[1]->GetCount() > 0 )//если что-то есть в следующей секции значит предудущая закончилась
{
if( m_oDocument[0]->GetCount() > 0 )
{
CString sXml = m_oDocument[0]->operator[](0)->RenderToOOX(oNewParam);
//
//пишем вставляем свойства секции
CString sSectPr = m_oDocument[0]->m_oProperty.RenderToOOX(oNewParam);
CString sFindStr = _T("</w:pPr>");
int nIndexpPr = sXml.Find( sFindStr );
......@@ -79,18 +79,18 @@ public:
if( -1 != nIndexP )
sXml.Insert( nIndexP + sFindStr.GetLength(), _T("<w:pPr>") + sSectPr + _T("</w:pPr>") );
}
//
//удаляем первый параграф
m_oDocument[0]->RemoveItem( 0 );
CStringA sXmlUTF = Convert::UnicodeToUtf8( sXml );
m_oFileWriter->Write( (BYTE*)(LPCSTR)sXmlUTF, sXmlUTF.GetLength() );
}
//
//удаляем секцию
m_oDocument.RemoveItem( 0 );
}
else if( m_oDocument.GetCount() > 0 && m_oDocument[0]->GetCount() > 0 )//
else if( m_oDocument.GetCount() > 0 && m_oDocument[0]->GetCount() > 0 )//пишем параграф
{
CString sXml = m_oDocument[0]->operator[](0)->RenderToOOX(oNewParam);
//
//удаляем первый параграф
m_oDocument[0]->RemoveItem( 0 );
CStringA sXmlUTF = Convert::UnicodeToUtf8( sXml );
m_oFileWriter->Write( (BYTE*)(LPCSTR)sXmlUTF, sXmlUTF.GetLength() );
......@@ -106,10 +106,10 @@ public:
oNewParam.poRels = &m_oWriter.m_oDocRels;
oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
if( m_oDocument.GetCount() > 0 && m_oDocument[0]->GetCount() > 0 )//
if( m_oDocument.GetCount() > 0 && m_oDocument[0]->GetCount() > 0 )//дописываем последний параграф
{
CString sXml = m_oDocument[0]->operator[](0)->RenderToOOX(oNewParam);
//
//удаляем первый параграф
m_oDocument[0]->RemoveItem( 0 );
CStringA sXmlUTF = Convert::UnicodeToUtf8( sXml );
m_oFileWriter->Write( (BYTE*)(LPCSTR)sXmlUTF, sXmlUTF.GetLength() );
......
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