Commit 8e17291c authored by ElenaSubbotina's avatar ElenaSubbotina

RtfFormatWriter

parent b7fb3d89
......@@ -72,100 +72,70 @@
#include "math.h"
class RtfBorderCommand
{
public:static bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter,RtfBorder& oOutput)
{
if( _T("brdrs") == sCommand )
oOutput.m_eType = RtfBorder::bt_brdrs;
else if( _T("brdrth") == sCommand )
oOutput.m_eType = RtfBorder::bt_brdrth;
else if( _T("brdrsh") == sCommand )
oOutput.m_eType = RtfBorder::bt_brdrsh;
else if( _T("brdrdb") == sCommand )
oOutput.m_eType = RtfBorder::bt_brdrdb;
else if( _T("brdrdot") == sCommand )
oOutput.m_eType = RtfBorder::bt_brdrdot;
else if( _T("brdrdash") == sCommand )
oOutput.m_eType = RtfBorder::bt_brdrdash;
else if( _T("brdrhair") == sCommand )
oOutput.m_eType = RtfBorder::bt_brdrhair;
else if( _T("brdrdashsm") == sCommand )
oOutput.m_eType = RtfBorder::bt_brdrdashsm;
else if( _T("brdrdashd") == sCommand )
oOutput.m_eType = RtfBorder::bt_brdrdashd;
else if( _T("brdrdashdd") == sCommand )
oOutput.m_eType = RtfBorder::bt_brdrdashdd;
else if( _T("brdrdashdot") == sCommand )
oOutput.m_eType = RtfBorder::bt_brdrdashdot;
else if( _T("brdrdashdotdot") == sCommand )
oOutput.m_eType = RtfBorder::bt_brdrdashdot;
else if( _T("brdrtriple") == sCommand )
oOutput.m_eType = RtfBorder::bt_brdrtriple;
else if( _T("brdrtnthsg") == sCommand )
oOutput.m_eType = RtfBorder::bt_brdrtnthsg;
else if( _T("brdrthtnsg") == sCommand )
oOutput.m_eType = RtfBorder::bt_brdrthtnsg;
else if( _T("brdrtnthtnsg") == sCommand )
oOutput.m_eType = RtfBorder::bt_brdrtnthtnsg;
else if( _T("brdrtnthmg") == sCommand )
oOutput.m_eType = RtfBorder::bt_brdrtnthmg;
else if( _T("brdrthtnmg") == sCommand )
oOutput.m_eType = RtfBorder::bt_brdrthtnmg;
else if( _T("brdrtnthtnmg") == sCommand )
oOutput.m_eType = RtfBorder::bt_brdrtnthtnmg;
else if( _T("brdrtnthlg") == sCommand )
oOutput.m_eType = RtfBorder::bt_brdrtnthlg;
else if( _T("brdrthtnlg") == sCommand )
oOutput.m_eType = RtfBorder::bt_brdrthtnlg;
else if( _T("brdrtnthtnlg") == sCommand )
oOutput.m_eType = RtfBorder::bt_brdrtnthtnlg;
else if( _T("brdrwavy") == sCommand )
oOutput.m_eType = RtfBorder::bt_brdrwavy;
else if( _T("brdrwavydb") == sCommand )
oOutput.m_eType = RtfBorder::bt_brdrwavydb;
else if( _T("brdrdashdotstr") == sCommand )
oOutput.m_eType = RtfBorder::bt_brdrdashdotstr;
else if( _T("brdremboss") == sCommand )
oOutput.m_eType = RtfBorder::bt_brdremboss;
else if( _T("brdrengrave") == sCommand )
oOutput.m_eType = RtfBorder::bt_brdrengrave;
else if( _T("brdroutset") == sCommand )
oOutput.m_eType = RtfBorder::bt_brdroutset;
else if( _T("brdrinset") == sCommand )
oOutput.m_eType = RtfBorder::bt_brdrinset;
else if( _T("brdrnone") == sCommand )
oOutput.m_eType = RtfBorder::bt_brdrnone;
else if( _T("brdrw") == sCommand )
public:
static bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter,RtfBorder& oOutput)
{
if( _T("brdrs") == sCommand ) oOutput.m_eType = RtfBorder::bt_brdrs;
else if( _T("brdrth") == sCommand ) oOutput.m_eType = RtfBorder::bt_brdrth;
else if( _T("brdrsh") == sCommand ) oOutput.m_eType = RtfBorder::bt_brdrsh;
else if( _T("brdrdb") == sCommand ) oOutput.m_eType = RtfBorder::bt_brdrdb;
else if( _T("brdrdot") == sCommand ) oOutput.m_eType = RtfBorder::bt_brdrdot;
else if( _T("brdrdash") == sCommand ) oOutput.m_eType = RtfBorder::bt_brdrdash;
else if( _T("brdrhair") == sCommand ) oOutput.m_eType = RtfBorder::bt_brdrhair;
else if( _T("brdrdashsm") == sCommand ) oOutput.m_eType = RtfBorder::bt_brdrdashsm;
else if( _T("brdrdashd") == sCommand ) oOutput.m_eType = RtfBorder::bt_brdrdashd;
else if( _T("brdrdashdd") == sCommand ) oOutput.m_eType = RtfBorder::bt_brdrdashdd;
else if( _T("brdrdashdot") == sCommand ) oOutput.m_eType = RtfBorder::bt_brdrdashdot;
else if( _T("brdrdashdotdot") == sCommand ) oOutput.m_eType = RtfBorder::bt_brdrdashdot;
else if( _T("brdrtriple") == sCommand ) oOutput.m_eType = RtfBorder::bt_brdrtriple;
else if( _T("brdrtnthsg") == sCommand ) oOutput.m_eType = RtfBorder::bt_brdrtnthsg;
else if( _T("brdrthtnsg") == sCommand ) oOutput.m_eType = RtfBorder::bt_brdrthtnsg;
else if( _T("brdrtnthtnsg") == sCommand ) oOutput.m_eType = RtfBorder::bt_brdrtnthtnsg;
else if( _T("brdrtnthmg") == sCommand ) oOutput.m_eType = RtfBorder::bt_brdrtnthmg;
else if( _T("brdrthtnmg") == sCommand ) oOutput.m_eType = RtfBorder::bt_brdrthtnmg;
else if( _T("brdrtnthtnmg") == sCommand ) oOutput.m_eType = RtfBorder::bt_brdrtnthtnmg;
else if( _T("brdrtnthlg") == sCommand ) oOutput.m_eType = RtfBorder::bt_brdrtnthlg;
else if( _T("brdrthtnlg") == sCommand ) oOutput.m_eType = RtfBorder::bt_brdrthtnlg;
else if( _T("brdrtnthtnlg") == sCommand ) oOutput.m_eType = RtfBorder::bt_brdrtnthtnlg;
else if( _T("brdrwavy") == sCommand ) oOutput.m_eType = RtfBorder::bt_brdrwavy;
else if( _T("brdrwavydb") == sCommand ) oOutput.m_eType = RtfBorder::bt_brdrwavydb;
else if( _T("brdrdashdotstr") == sCommand ) oOutput.m_eType = RtfBorder::bt_brdrdashdotstr;
else if( _T("brdremboss") == sCommand ) oOutput.m_eType = RtfBorder::bt_brdremboss;
else if( _T("brdrengrave") == sCommand ) oOutput.m_eType = RtfBorder::bt_brdrengrave;
else if( _T("brdroutset") == sCommand ) oOutput.m_eType = RtfBorder::bt_brdroutset;
else if( _T("brdrinset") == sCommand ) oOutput.m_eType = RtfBorder::bt_brdrinset;
else if( _T("brdrnone") == sCommand ) oOutput.m_eType = RtfBorder::bt_brdrnone;
else if( _T("brdrw") == sCommand )
{
if( true == hasParameter )
{
if( true == hasParameter )
{
oOutput.m_nWidth = parameter;
if( RtfBorder::bt_none == oOutput.m_eType )
oOutput.m_eType = RtfBorder::bt_brdrs;
}
oOutput.m_nWidth = parameter;
if( RtfBorder::bt_none == oOutput.m_eType )
oOutput.m_eType = RtfBorder::bt_brdrs;
}
else if( _T("brsp") == sCommand )
}
else if( _T("brsp") == sCommand )
{
if( true == hasParameter )
{
if( true == hasParameter )
{
oOutput.m_nSpace = parameter;
if( RtfBorder::bt_none == oOutput.m_eType )
oOutput.m_eType = RtfBorder::bt_brdrs;
}
oOutput.m_nSpace = parameter;
if( RtfBorder::bt_none == oOutput.m_eType )
oOutput.m_eType = RtfBorder::bt_brdrs;
}
else if( _T("brdrcf") == sCommand )
}
else if( _T("brdrcf") == sCommand )
{
if( true == hasParameter )
{
if( true == hasParameter )
{
oOutput.m_nColor = parameter;
if( RtfBorder::bt_none == oOutput.m_eType )
oOutput.m_eType = RtfBorder::bt_brdrs;
}
oOutput.m_nColor = parameter;
if( RtfBorder::bt_none == oOutput.m_eType )
oOutput.m_eType = RtfBorder::bt_brdrs;
}
else
return false;
return true;
}
else
return false;
return true;
}
};
class RtfShadingCommand
{
......
......@@ -282,7 +282,7 @@ public:
}
}
if (oOutputBorder.m_eType != RtfBorder::bt_brdrnone)
if (oOutputBorder.m_eType != RtfBorder::bt_none)
{
if ((m_ooxBorder->m_oColor.IsInit()) && (m_ooxBorder->m_oColor->GetValue() == SimpleTypes::hexcolorRGB))
{
......
......@@ -370,11 +370,11 @@ bool OOXRunReader::Parse( ReaderParameter oParam , RtfParagraph& oOutputParagrap
if (ooxText)
{
CString sValue;
if ((ooxText->m_oSpace.IsInit()) && (ooxText->m_oSpace->GetValue() == SimpleTypes::xmlspacePreserve))
{
sValue = RtfUtility::Preserve(ooxText->m_sText);
}
else
//if ((ooxText->m_oSpace.IsInit()) && (ooxText->m_oSpace->GetValue() == SimpleTypes::xmlspacePreserve))
//{
// sValue = RtfUtility::Preserve(ooxText->m_sText);
//}
//else
sValue = ooxText->m_sText;
RtfCharPtr oNewChar = RtfCharPtr( new RtfChar() );
......
......@@ -51,11 +51,11 @@ public:
oOutput.m_eAnchorTypeShape = RtfShape::st_anchor;
oOutput.m_nShapeType = 75;//NSOfficeDrawing::sptPictureFrame;
oOutput.m_bAllowOverlap = m_ooxAnchor->m_oAllowOverlap.IsInit() ? m_ooxAnchor->m_oAllowOverlap->ToBool() : false;
oOutput.m_nZOrderRelative = m_ooxAnchor->m_oBehindDoc.IsInit() ? m_ooxAnchor->m_oBehindDoc->ToBool() : false;
oOutput.m_bHidden = m_ooxAnchor->m_oHidden.IsInit() ? m_ooxAnchor->m_oHidden->ToBool() : false;
oOutput.m_bLayoutInCell = m_ooxAnchor->m_oLayoutInCell.IsInit() ? m_ooxAnchor->m_oLayoutInCell->ToBool() : false;
oOutput.m_bLockAnchor = m_ooxAnchor->m_oLocked.IsInit() ? m_ooxAnchor->m_oLocked->ToBool() : false;
oOutput.m_bAllowOverlap = m_ooxAnchor->m_oAllowOverlap.IsInit() ? m_ooxAnchor->m_oAllowOverlap->ToBool() : false;
oOutput.m_nZOrderRelative = m_ooxAnchor->m_oBehindDoc.IsInit() ? m_ooxAnchor->m_oBehindDoc->ToBool() : false;
oOutput.m_bHidden = m_ooxAnchor->m_oHidden.IsInit() ? m_ooxAnchor->m_oHidden->ToBool() : false;
oOutput.m_bLayoutInCell = m_ooxAnchor->m_oLayoutInCell.IsInit() ? m_ooxAnchor->m_oLayoutInCell->ToBool() : false;
oOutput.m_bLockAnchor = m_ooxAnchor->m_oLocked.IsInit() ? m_ooxAnchor->m_oLocked->ToBool() : false;
oOutput.m_nZOrder = m_ooxAnchor->m_oRelativeHeight.IsInit() ? true : false;
int nDistLeft = m_ooxAnchor->m_oDistL.IsInit() ? m_ooxAnchor->m_oDistL->ToTwips() : PROP_DEF;
......@@ -94,46 +94,46 @@ public:
{
switch(m_ooxAnchor->m_oPositionH->m_oRelativeFrom->GetValue())
{
case SimpleTypes::relfromhCharacter :
{
oOutput.m_nPositionHRelative = 3;
oOutput.m_eXAnchor = RtfShape::ax_margin;
}break;
case SimpleTypes::relfromhColumn :
{
oOutput.m_nPositionHRelative = 2;
oOutput.m_eXAnchor = RtfShape::ax_column;
}break;
case SimpleTypes::relfromhInsideMargin :
{
oOutput.m_nPositionHRelative = 6;
oOutput.m_eXAnchor = RtfShape::ax_margin;
}break;
case SimpleTypes::relfromhLeftMargin :
{
oOutput.m_nPositionHRelative = 4;
oOutput.m_eXAnchor = RtfShape::ax_margin;
}break;
case SimpleTypes::relfromhMargin :
{
oOutput.m_nPositionHRelative = 0;
oOutput.m_eXAnchor = RtfShape::ax_margin;
}break;
case SimpleTypes::relfromhOutsideMargin :
{
oOutput.m_nPositionHRelative = 7;
oOutput.m_eXAnchor = RtfShape::ax_margin;
}break;
case SimpleTypes::relfromhCharacter:
{
oOutput.m_nPositionHRelative = 3;
oOutput.m_eXAnchor = RtfShape::ax_margin;
}break;
case SimpleTypes::relfromhColumn:
{
oOutput.m_nPositionHRelative = 2;
oOutput.m_eXAnchor = RtfShape::ax_column;
}break;
case SimpleTypes::relfromhInsideMargin:
{
oOutput.m_nPositionHRelative = 6;
oOutput.m_eXAnchor = RtfShape::ax_margin;
}break;
case SimpleTypes::relfromhLeftMargin:
{
oOutput.m_nPositionHRelative = 4;
oOutput.m_eXAnchor = RtfShape::ax_margin;
}break;
case SimpleTypes::relfromhMargin:
{
oOutput.m_nPositionHRelative = 0;
oOutput.m_eXAnchor = RtfShape::ax_margin;
}break;
case SimpleTypes::relfromhOutsideMargin:
{
oOutput.m_nPositionHRelative = 7;
oOutput.m_eXAnchor = RtfShape::ax_margin;
}break;
case SimpleTypes::relfromhPage :
{
oOutput.m_nPositionHRelative = 1;
oOutput.m_eXAnchor = RtfShape::ax_page;
}break;
{
oOutput.m_nPositionHRelative = 1;
oOutput.m_eXAnchor = RtfShape::ax_page;
}break;
case SimpleTypes::relfromhRightMargin :
{
oOutput.m_nPositionHRelative = 5;
oOutput.m_eXAnchor = RtfShape::ax_margin;
}break;
{
oOutput.m_nPositionHRelative = 5;
oOutput.m_eXAnchor = RtfShape::ax_margin;
}break;
}
}
if (m_ooxAnchor->m_oPositionH->m_oAlign.IsInit())
......
......@@ -170,7 +170,10 @@ bool ParseStyle(RtfShape* pShape, SimpleTypes::Vml::CCssProperty* prop)
case SimpleTypes::Vml::cssptRotation:
{
pShape->m_nRotation = 65536 * prop->get_Value().dValue;
if( PROP_DEF != pShape->m_nRelRight || PROP_DEF != pShape->m_nRelLeft || PROP_DEF != pShape->m_nRelTop || PROP_DEF != pShape->m_nRelBottom )
if( PROP_DEF != pShape->m_nRelRight
|| PROP_DEF != pShape->m_nRelLeft
|| PROP_DEF != pShape->m_nRelTop
|| PROP_DEF != pShape->m_nRelBottom )
pShape->m_nRelRotation = pShape->m_nRotation;
}break;
case SimpleTypes::Vml::cssptVisibility :
......@@ -207,11 +210,19 @@ bool ParseStyle(RtfShape* pShape, SimpleTypes::Vml::CCssProperty* prop)
}break;
case SimpleTypes::Vml::csspctMsoWidthPercent:
{
pShape->m_nPctWidth = prop->get_Value().oValue.dValue;
pShape->m_nPctWidth = prop->get_Value().dValue;
}break;
case SimpleTypes::Vml::csspctMsoHeightPercent:
{
pShape->m_nPctHeight = prop->get_Value().oValue.dValue;
pShape->m_nPctHeight = prop->get_Value().dValue;
}break;
case SimpleTypes::Vml::cssptVRotateLetters:
{
pShape->m_bGtextFVertical = prop->get_Value().bValue;
}break;
case SimpleTypes::Vml::cssptVTextKern:
{
pShape->m_bGtextFKern = prop->get_Value().bValue;
}break;
case SimpleTypes::Vml::cssptDirection : break;
case SimpleTypes::Vml::cssptLayoutFlow : break;
......@@ -228,10 +239,8 @@ bool ParseStyle(RtfShape* pShape, SimpleTypes::Vml::CCssProperty* prop)
case SimpleTypes::Vml::cssptFontWeight : break;
case SimpleTypes::Vml::cssptMsoTextShadow : break;
case SimpleTypes::Vml::cssptTextDecoration : break;
case SimpleTypes::Vml::cssptVRotateLetters : break;
case SimpleTypes::Vml::cssptVSameLetterHeights : break;
case SimpleTypes::Vml::cssptVTextAlign : break;
case SimpleTypes::Vml::cssptVTextKern : break;
case SimpleTypes::Vml::cssptVTextReverse : break;
case SimpleTypes::Vml::cssptVTextSpacingMode : break;
case SimpleTypes::Vml::cssptVTextSpacing : break;
......@@ -298,13 +307,17 @@ bool OOXShapeReader::Parse2( ReaderParameter oParam , RtfShapePtr& oOutput)
oOutput->m_oPicture = RtfPicturePtr( new RtfPicture() );
//todooo проверить что за путь тут выставляется
OOXPictureGraphicReader::WriteDataToPicture( sImagePath, *oOutput->m_oPicture, oParam.oReader->m_sPath );
oOutput->m_nFillType = 2;
}
}
if (fill->m_oColor.IsInit())
oOutput->m_nFillColor = (fill->m_oColor->Get_B() << 16) + (fill->m_oColor->Get_G() << 8) + fill->m_oColor->Get_R();
if (fill->m_oColor2.IsInit())
oOutput->m_nFillColor2 = (fill->m_oColor2->Get_B() << 16) + (fill->m_oColor2->Get_G() << 8) + fill->m_oColor2->Get_R();
{
oOutput->m_nFillColor2 = (fill->m_oColor2->Get_B() << 16) + (fill->m_oColor2->Get_G() << 8) + fill->m_oColor2->Get_R();
}
if (fill->m_oOpacity.IsInit())
oOutput->m_nFillOpacity = fill->m_oOpacity->GetValue() * 100;
......@@ -479,6 +492,15 @@ bool OOXShapeReader::Parse2( ReaderParameter oParam , RtfShapePtr& oOutput)
{
oOutput->m_sGtextUNICODE = text_path->m_sString.get();
}
if ((text_path->m_oFitPath.IsInit()) && (text_path->m_oFitPath->GetValue()))
{
oOutput->m_bGtextFStretch = 1;
oOutput->m_bGtextFBestFit = 1;
oOutput->m_bGtextFShrinkFit = 1;
}
if (text_path->m_oTrim.IsInit())
{
}
if (text_path->m_oStyle.IsInit())
{
ParseStyles( oOutput, text_path->m_oStyle->m_arrProperties );
......@@ -706,6 +728,8 @@ bool OOXShapeGroupReader::Parse( ReaderParameter oParam , RtfShapeGroupPtr& oOut
oOutput->m_bLayoutInCell = m_vmlGroup->m_oAllowInCell.GetValue();
oOutput->m_bAllowOverlap = m_vmlGroup->m_oAllowOverlap.GetValue();
oOutput->m_nZOrderRelative = 0;
oOutput->m_nWrapType = 3; //def
......
......@@ -2320,20 +2320,22 @@ CString RtfTableProperty::RenderToRtf(RenderParameter oRenderParameter)
CString sResult;
RENDER_RTF_BOOL( m_bBidi, sResult, _T("taprtl") )
if( PROP_DEF == m_nAutoFit || 1 == m_nAutoFit )
if( PROP_DEF == m_nAutoFit || 1 == m_nAutoFit )
sResult += _T("\\trautofit1");
else if( 0 == m_nAutoFit )
sResult += _T("\\trautofit0");
RENDER_RTF_INT( m_nAutoFit, sResult, _T("trautofit") )
RENDER_RTF_INT( m_nGraph, sResult, _T("trgaph") )
RENDER_RTF_INT( nTableIndent, sResult, _T("tblind") )
RENDER_RTF_INT( nTableIndentUnits, sResult, _T("tblindtype") )
RENDER_RTF_INT( m_nAutoFit, sResult, _T("trautofit") )
RENDER_RTF_INT( m_nGraph, sResult, _T("trgaph") )
RENDER_RTF_INT( nTableIndent, sResult, _T("tblind") )
RENDER_RTF_INT( nTableIndentUnits, sResult, _T("tblindtype") )
RENDER_RTF_INT( m_nWrapLeft, sResult, _T("tdfrmtxtLeft") )
RENDER_RTF_INT( m_nWrapRight, sResult, _T("tdfrmtxtRight") )
RENDER_RTF_INT( m_nWrapTop, sResult, _T("tdfrmtxtTop") )
RENDER_RTF_INT( m_nWrapBottom, sResult, _T("tdfrmtxtBottom") )
RENDER_RTF_BOOL( m_bOverlap, sResult, _T("tabsnoovrlp") )
RENDER_RTF_INT( m_nWrapLeft, sResult, _T("tdfrmtxtLeft") )
RENDER_RTF_INT( m_nWrapRight, sResult, _T("tdfrmtxtRight") )
RENDER_RTF_INT( m_nWrapTop, sResult, _T("tdfrmtxtTop") )
RENDER_RTF_INT( m_nWrapBottom, sResult, _T("tdfrmtxtBottom") )
RENDER_RTF_BOOL( m_bOverlap, sResult, _T("tabsnoovrlp") )
switch ( m_eHRef )
{
......@@ -2381,22 +2383,22 @@ CString RtfTableProperty::RenderToRtf(RenderParameter oRenderParameter)
}
RENDER_RTF_INT( m_nLeft, sResult, _T("trleft") )
RENDER_RTF_INT( m_nDefCellMarLeft, sResult, _T("trpaddl") );
RENDER_RTF_INT( m_nDefCellMarRight, sResult, _T("trpaddr") );
RENDER_RTF_INT( m_nDefCellMarTop, sResult, _T("trpaddt") );
RENDER_RTF_INT( m_nDefCellMarBottom, sResult, _T("trpaddb") );
RENDER_RTF_INT( m_nDefCellMarLeftUnits, sResult, _T("trpaddfl") );
RENDER_RTF_INT( m_nDefCellMarRightUnits, sResult, _T("trpaddfr") );
RENDER_RTF_INT( m_nDefCellMarTopUnits, sResult, _T("trpaddft") );
RENDER_RTF_INT( m_nDefCellMarBottomUnits, sResult, _T("trpaddfb") );
RENDER_RTF_INT( m_nDefCellSpBottom, sResult, _T("trspdb") );
RENDER_RTF_INT( m_nDefCellSpLeft, sResult, _T("trspdl") );
RENDER_RTF_INT( m_nDefCellSpRight, sResult, _T("trspdr") );
RENDER_RTF_INT( m_nDefCellSpTop, sResult, _T("trspdt") );
RENDER_RTF_INT( m_nDefCellSpBottomUnits, sResult, _T("trspdfb") );
RENDER_RTF_INT( m_nDefCellSpLeftUnits, sResult, _T("trspdfl") );
RENDER_RTF_INT( m_nDefCellSpRightUnits, sResult, _T("trspdfr") );
RENDER_RTF_INT( m_nDefCellSpTopUnits, sResult, _T("trspdft") );
RENDER_RTF_INT( m_nDefCellMarLeft, sResult, _T("trpaddl") );
RENDER_RTF_INT( m_nDefCellMarRight, sResult, _T("trpaddr") );
RENDER_RTF_INT( m_nDefCellMarTop, sResult, _T("trpaddt") );
RENDER_RTF_INT( m_nDefCellMarBottom, sResult, _T("trpaddb") );
RENDER_RTF_INT( m_nDefCellMarLeftUnits, sResult, _T("trpaddfl") );
RENDER_RTF_INT( m_nDefCellMarRightUnits, sResult, _T("trpaddfr") );
RENDER_RTF_INT( m_nDefCellMarTopUnits, sResult, _T("trpaddft") );
RENDER_RTF_INT( m_nDefCellMarBottomUnits, sResult, _T("trpaddfb") );
RENDER_RTF_INT( m_nDefCellSpBottom, sResult, _T("trspdb") );
RENDER_RTF_INT( m_nDefCellSpLeft, sResult, _T("trspdl") );
RENDER_RTF_INT( m_nDefCellSpRight, sResult, _T("trspdr") );
RENDER_RTF_INT( m_nDefCellSpTop, sResult, _T("trspdt") );
RENDER_RTF_INT( m_nDefCellSpBottomUnits, sResult, _T("trspdfb") );
RENDER_RTF_INT( m_nDefCellSpLeftUnits, sResult, _T("trspdfl") );
RENDER_RTF_INT( m_nDefCellSpRightUnits, sResult, _T("trspdfr") );
RENDER_RTF_INT( m_nDefCellSpTopUnits, sResult, _T("trspdft") );
if( m_oBorderLeft.IsValid() == true )
{
......@@ -2433,15 +2435,15 @@ CString RtfTableProperty::RenderToRtf(RenderParameter oRenderParameter)
//RENDER_RTF_INT( m_nStyle, sResult, _T("ts") )
RENDER_RTF_BOOL( m_bAutoFirstRow, sResult, _T("tbllkhdrrows") )
RENDER_RTF_BOOL( m_bAutoLastRow, sResult, _T("tbllklastrow") )
RENDER_RTF_BOOL( m_bAutoFirstCol, sResult, _T("tbllkhdrcols") )
RENDER_RTF_BOOL( m_bAutoLastCol, sResult, _T("tbllklastcol") )
RENDER_RTF_BOOL( m_bAutoNoRowBand, sResult, _T("tbllknorowband") )
RENDER_RTF_BOOL( m_bAutoNoColBand, sResult, _T("tbllknocolband") )
RENDER_RTF_BOOL( m_bAutoFirstRow, sResult, _T("tbllkhdrrows") )
RENDER_RTF_BOOL( m_bAutoLastRow, sResult, _T("tbllklastrow") )
RENDER_RTF_BOOL( m_bAutoFirstCol, sResult, _T("tbllkhdrcols") )
RENDER_RTF_BOOL( m_bAutoLastCol, sResult, _T("tbllklastcol") )
RENDER_RTF_BOOL( m_bAutoNoRowBand, sResult, _T("tbllknorowband") )
RENDER_RTF_BOOL( m_bAutoNoColBand, sResult, _T("tbllknocolband") )
RENDER_RTF_INT( m_nRowBandSize, sResult, _T("tscbandsh") )
RENDER_RTF_INT( m_nColBandSize, sResult, _T("tscbandsv") )
RENDER_RTF_INT( m_nRowBandSize, sResult, _T("tscbandsh") )
RENDER_RTF_INT( m_nColBandSize, sResult, _T("tscbandsv") )
return sResult;
}
......
......@@ -915,26 +915,26 @@ public:
void SetDefault( )
{
DEFAULT_PROPERTY_DEF( m_eType, bt_none )
DEFAULT_PROPERTY( m_nWidth )
DEFAULT_PROPERTY( m_nSpace )
DEFAULT_PROPERTY( m_nColor )
DEFAULT_PROPERTY ( m_nWidth )
DEFAULT_PROPERTY ( m_nSpace )
DEFAULT_PROPERTY ( m_nColor )
}
void SetEmpty( )
{
m_eType = bt_brdrnone;
m_nWidth = 0;
m_nSpace = 0;
m_nColor = PROP_DEF;
m_eType = bt_brdrnone;
m_nWidth = 0;
m_nSpace = 0;
m_nColor = PROP_DEF;
}
void Merge( RtfBorder& oBorPr )
{
//свойство должно быть как единое целое, поэтому если oBorPr задано, то переписыватся целиком
if( bt_none != oBorPr.m_eType || PROP_DEF != oBorPr.m_nWidth || PROP_DEF != oBorPr.m_nSpace || PROP_DEF != oBorPr.m_nColor )
{
m_eType = oBorPr.m_eType;
m_nWidth = oBorPr.m_nWidth;
m_nSpace = oBorPr.m_nSpace;
m_nColor = oBorPr.m_nColor;
m_eType = oBorPr.m_eType;
m_nWidth = oBorPr.m_nWidth;
m_nSpace = oBorPr.m_nSpace;
m_nColor = oBorPr.m_nColor;
}
}
CString RenderToRtf(RenderParameter oRenderParameter);
......@@ -2016,56 +2016,56 @@ public:
}
void Merge( RtfTableProperty& oTablePr )
{
MERGE_PROPERTY( m_bBidi, oTablePr )
MERGE_PROPERTY( m_nAutoFit, oTablePr )
MERGE_PROPERTY( m_nGraph, oTablePr )
MERGE_PROPERTY( nTableIndent, oTablePr )
MERGE_PROPERTY( nTableIndentUnits, oTablePr )
MERGE_PROPERTY_DEF( m_eJust, oTablePr, rj_none )
MERGE_PROPERTY( m_nWrapLeft, oTablePr )
MERGE_PROPERTY( m_nWrapRight, oTablePr )
MERGE_PROPERTY( m_nWrapTop, oTablePr )
MERGE_PROPERTY( m_nWrapBottom, oTablePr )
MERGE_PROPERTY( m_bOverlap, oTablePr )
MERGE_PROPERTY_DEF( m_eHRef, oTablePr, hr_none )
MERGE_PROPERTY_DEF( m_eVRef, oTablePr, vr_none )
MERGE_PROPERTY_DEF( m_eHPos, oTablePr, hp_none )
MERGE_PROPERTY_DEF( m_eVPos, oTablePr, vp_none )
MERGE_PROPERTY( m_nHPos, oTablePr )
MERGE_PROPERTY( m_nVPos, oTablePr )
MERGE_PROPERTY( m_nLeft, oTablePr )
MERGE_PROPERTY( m_nWidth, oTablePr )
MERGE_PROPERTY_DEF( m_eMUWidth, oTablePr, mu_none )
MERGE_PROPERTY( m_nDefCellMarBottom, oTablePr )
MERGE_PROPERTY( m_nDefCellMarRight, oTablePr )
MERGE_PROPERTY( m_nDefCellMarLeft, oTablePr )
MERGE_PROPERTY( m_nDefCellMarTop, oTablePr )
MERGE_PROPERTY( m_nDefCellMarBottomUnits, oTablePr )
MERGE_PROPERTY( m_nDefCellMarRightUnits, oTablePr )
MERGE_PROPERTY( m_nDefCellMarLeftUnits, oTablePr )
MERGE_PROPERTY( m_nDefCellMarTopUnits, oTablePr )
MERGE_PROPERTY( m_nDefCellSpBottom, oTablePr )
MERGE_PROPERTY( m_nDefCellSpLeft, oTablePr )
MERGE_PROPERTY( m_nDefCellSpRight, oTablePr )
MERGE_PROPERTY( m_nDefCellSpTop, oTablePr )
MERGE_PROPERTY( m_nDefCellSpBottomUnits, oTablePr )
MERGE_PROPERTY( m_nDefCellSpLeftUnits, oTablePr )
MERGE_PROPERTY( m_nDefCellSpRightUnits, oTablePr )
MERGE_PROPERTY( m_nDefCellSpTopUnits, oTablePr )
m_oBorderLeft.Merge( oTablePr.m_oBorderLeft );
MERGE_PROPERTY( m_bBidi, oTablePr )
MERGE_PROPERTY( m_nAutoFit, oTablePr )
MERGE_PROPERTY( m_nGraph, oTablePr )
MERGE_PROPERTY( nTableIndent, oTablePr )
MERGE_PROPERTY( nTableIndentUnits, oTablePr )
MERGE_PROPERTY_DEF( m_eJust, oTablePr, rj_none )
MERGE_PROPERTY( m_nWrapLeft, oTablePr )
MERGE_PROPERTY( m_nWrapRight, oTablePr )
MERGE_PROPERTY( m_nWrapTop, oTablePr )
MERGE_PROPERTY( m_nWrapBottom, oTablePr )
MERGE_PROPERTY( m_bOverlap, oTablePr )
MERGE_PROPERTY_DEF( m_eHRef, oTablePr, hr_none )
MERGE_PROPERTY_DEF( m_eVRef, oTablePr, vr_none )
MERGE_PROPERTY_DEF( m_eHPos, oTablePr, hp_none )
MERGE_PROPERTY_DEF( m_eVPos, oTablePr, vp_none )
MERGE_PROPERTY( m_nHPos, oTablePr )
MERGE_PROPERTY( m_nVPos, oTablePr )
MERGE_PROPERTY( m_nLeft, oTablePr )
MERGE_PROPERTY( m_nWidth, oTablePr )
MERGE_PROPERTY_DEF( m_eMUWidth, oTablePr, mu_none )
MERGE_PROPERTY( m_nDefCellMarBottom, oTablePr )
MERGE_PROPERTY( m_nDefCellMarRight, oTablePr )
MERGE_PROPERTY( m_nDefCellMarLeft, oTablePr )
MERGE_PROPERTY( m_nDefCellMarTop, oTablePr )
MERGE_PROPERTY( m_nDefCellMarBottomUnits, oTablePr )
MERGE_PROPERTY( m_nDefCellMarRightUnits, oTablePr )
MERGE_PROPERTY( m_nDefCellMarLeftUnits, oTablePr )
MERGE_PROPERTY( m_nDefCellMarTopUnits, oTablePr )
MERGE_PROPERTY( m_nDefCellSpBottom, oTablePr )
MERGE_PROPERTY( m_nDefCellSpLeft, oTablePr )
MERGE_PROPERTY( m_nDefCellSpRight, oTablePr )
MERGE_PROPERTY( m_nDefCellSpTop, oTablePr )
MERGE_PROPERTY( m_nDefCellSpBottomUnits, oTablePr )
MERGE_PROPERTY( m_nDefCellSpLeftUnits, oTablePr )
MERGE_PROPERTY( m_nDefCellSpRightUnits, oTablePr )
MERGE_PROPERTY( m_nDefCellSpTopUnits, oTablePr )
m_oBorderLeft.Merge ( oTablePr.m_oBorderLeft );
m_oBorderRight.Merge( oTablePr.m_oBorderRight );
m_oBorderTop.Merge( oTablePr.m_oBorderTop );
m_oBorderTop.Merge ( oTablePr.m_oBorderTop );
m_oBorderBottom.Merge( oTablePr.m_oBorderBottom );
m_oBorderVert.Merge( oTablePr.m_oBorderVert );
m_oBorderHor.Merge( oTablePr.m_oBorderHor );
m_oShading.Merge( oTablePr.m_oShading );
m_oBorderVert.Merge ( oTablePr.m_oBorderVert );
m_oBorderHor.Merge ( oTablePr.m_oBorderHor );
m_oShading.Merge ( oTablePr.m_oShading );
MERGE_PROPERTY( m_nStyle, oTablePr )
......@@ -2507,6 +2507,13 @@ public:
void SetDefault()
{
RtfTableProperty::SetDefault();
//не SetEmpty() !!!
m_oBorderLeft.SetDefault();
m_oBorderRight.SetDefault();
m_oBorderTop.SetDefault();
m_oBorderBottom.SetDefault();
m_oBorderVert.SetDefault();
m_oBorderHor.SetDefault();
DEFAULT_PROPERTY( m_nIndex )
DEFAULT_PROPERTY( m_nBandIndex )
......
......@@ -179,6 +179,12 @@ public:
CString m_sGtextFont;
int m_nGtextSize;
int m_bGtext;
int m_bGtextFVertical;
int m_bGtextFKern;
int m_bGtextFStretch;
int m_bGtextFShrinkFit;
int m_bGtextFBestFit;
//pWrapPolygonVertices Points of the text wrap polygon.
std::vector< std::pair<int, int> > m_aWrapPoints;
......@@ -212,24 +218,26 @@ public:
void ToRtfRotation( int nAngel , int &nLeft, int &nTop, int& nRight, int& nBottom )
{
nAngel = nAngel/ 65536;
//поворачиваем на 45 градусов
nAngel -= 45;
//делаем угол от 0 до 360
nAngel = nAngel % 360;
if( nAngel < 0 )
nAngel += 360;
if( nAngel < 0 ) nAngel += 360;
int nQuater = nAngel / 90; // определяем четверть
if( 0 == nQuater || 2 == nQuater )
{
//поворачиваем относительно центра на 90 градусов обратно
int nCenterX = ( nLeft + nRight ) / 2;
int nCenterY = ( nTop + nBottom ) / 2;
int nWidth = nRight - nLeft;
int nHeight = nBottom - nTop;
nLeft = nCenterX - nHeight / 2;
nRight = nCenterX + nHeight / 2;
nTop = nCenterY - nWidth / 2;
int nCenterX = ( nLeft + nRight ) / 2;
int nCenterY = ( nTop + nBottom ) / 2;
int nWidth = nRight - nLeft;
int nHeight = nBottom - nTop;
nLeft = nCenterX - nHeight / 2;
nRight = nCenterX + nHeight / 2;
nTop = nCenterY - nWidth / 2;
nBottom = nCenterY + nWidth / 2;
}
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -2635,19 +2635,19 @@ namespace OOX
ComplexTypes_WriteAttribute2( _T("id=\""), m_oId );
ComplexTypes_WriteAttribute ( _T("style=\""), m_oStyle );
if ( SimpleTypes::booleanFalse != m_oOn.GetValue() )
if ( (m_oOn.IsInit()) && (SimpleTypes::booleanFalse != m_oOn->GetValue()) )
sResult += _T("on=\"true\" ");
if ( SimpleTypes::booleanFalse != m_oFitShape.GetValue() )
if ( (m_oFitShape.IsInit()) && ( SimpleTypes::booleanFalse != m_oFitShape->GetValue()) )
sResult += _T("fitshape=\"true\" ");
if ( SimpleTypes::booleanFalse != m_oFitPath.GetValue() )
if ( (m_oFitPath.IsInit()) && ( SimpleTypes::booleanFalse != m_oFitPath->GetValue()) )
sResult += _T("fitpath=\"true\" ");
if ( SimpleTypes::booleanFalse != m_oTrim.GetValue() )
if ( (m_oTrim.IsInit()) && ( SimpleTypes::booleanFalse != m_oTrim->GetValue()) )
sResult += _T("trim=\"true\" ");
if ( SimpleTypes::booleanFalse != m_oXScale.GetValue() )
if ( (m_oXScale.IsInit()) && ( SimpleTypes::booleanFalse != m_oXScale->GetValue()) )
sResult += _T("xscale=\"true\" ");
ComplexTypes_WriteAttribute2( _T("string=\""), m_sString );
......@@ -2710,14 +2710,14 @@ namespace OOX
public:
// Attributes
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oFitPath;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oFitShape;
nullable<CString> m_oId;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oOn;
nullable<CString> m_sString;
nullable<SimpleTypes::Vml::CCssStyle> m_oStyle;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oTrim;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oXScale;
nullable<SimpleTypes::CTrueFalse<>> m_oFitPath;
nullable<SimpleTypes::CTrueFalse<>> m_oFitShape;
nullable<CString> m_oId;
nullable<SimpleTypes::CTrueFalse<>> m_oOn;
nullable<CString> m_sString;
nullable<SimpleTypes::Vml::CCssStyle> m_oStyle;
nullable<SimpleTypes::CTrueFalse<>> m_oTrim;
nullable<SimpleTypes::CTrueFalse<>> m_oXScale;
nullable<CString> m_sStringOriginal;
};
......
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