Commit 5e9d676e authored by ElenaSubbotina's avatar ElenaSubbotina

DocFormatReader - fix bugs

parent 6c01725f
...@@ -52,6 +52,7 @@ namespace DocFileFormat ...@@ -52,6 +52,7 @@ namespace DocFileFormat
_writeWebHidden = false; _writeWebHidden = false;
_writeInstrText = false; _writeInstrText = false;
_isSectionPageBreak = 0; _isSectionPageBreak = 0;
_isTextBoxContent = false;
} }
DocumentMapping::DocumentMapping(ConversionContext* context, XmlUtils::CXmlWriter* writer, IMapping* caller):_skipRuns(0), _lastValidPapx(NULL), _lastValidSepx(NULL), _writeInstrText(false), DocumentMapping::DocumentMapping(ConversionContext* context, XmlUtils::CXmlWriter* writer, IMapping* caller):_skipRuns(0), _lastValidPapx(NULL), _lastValidSepx(NULL), _writeInstrText(false),
...@@ -65,6 +66,7 @@ namespace DocFileFormat ...@@ -65,6 +66,7 @@ namespace DocFileFormat
_writeWebHidden = false; _writeWebHidden = false;
_writeInstrText = false; _writeInstrText = false;
_isSectionPageBreak = 0; _isSectionPageBreak = 0;
_isTextBoxContent = false;
} }
DocumentMapping::~DocumentMapping() DocumentMapping::~DocumentMapping()
...@@ -813,11 +815,13 @@ namespace DocFileFormat ...@@ -813,11 +815,13 @@ namespace DocFileFormat
{ {
PictureDescriptor oPicture (chpx, m_document->bOlderVersion ? m_document->WordDocumentStream : m_document->DataStream, 0x7fffffff, m_document->bOlderVersion); PictureDescriptor oPicture (chpx, m_document->bOlderVersion ? m_document->WordDocumentStream : m_document->DataStream, 0x7fffffff, m_document->bOlderVersion);
bool isInline = _isTextBoxContent;
if (oPicture.embeddedData && oPicture.embeddedDataSize > 0) if (oPicture.embeddedData && oPicture.embeddedDataSize > 0)
{ {
m_pXmlWriter->WriteNodeBegin (_T("w:pict")); m_pXmlWriter->WriteNodeBegin (_T("w:pict"));
VMLPictureMapping oVmlMapper(m_context, m_pXmlWriter, false, _caller); VMLPictureMapping oVmlMapper(m_context, m_pXmlWriter, false, _caller, isInline);
oPicture.Convert (&oVmlMapper); oPicture.Convert (&oVmlMapper);
m_pXmlWriter->WriteNodeEnd (_T("w:pict")); m_pXmlWriter->WriteNodeEnd (_T("w:pict"));
...@@ -837,7 +841,7 @@ namespace DocFileFormat ...@@ -837,7 +841,7 @@ namespace DocFileFormat
if (picture) if (picture)
{ {
VMLPictureMapping oVmlMapper(m_context, m_pXmlWriter, false, _caller); VMLPictureMapping oVmlMapper(m_context, m_pXmlWriter, false, _caller, isInline);
oPicture.Convert (&oVmlMapper); oPicture.Convert (&oVmlMapper);
if (oVmlMapper.m_isEmbedded) if (oVmlMapper.m_isEmbedded)
...@@ -853,7 +857,7 @@ namespace DocFileFormat ...@@ -853,7 +857,7 @@ namespace DocFileFormat
} }
}else }else
{ {
VMLShapeMapping oVmlMapper(m_context, m_pXmlWriter, NULL, &oPicture, _caller); VMLShapeMapping oVmlMapper(m_context, m_pXmlWriter, NULL, &oPicture, _caller, isInline);
oPicture.shapeContainer->Convert(&oVmlMapper); oPicture.shapeContainer->Convert(&oVmlMapper);
} }
......
...@@ -142,6 +142,7 @@ namespace DocFileFormat ...@@ -142,6 +142,7 @@ namespace DocFileFormat
int _footnoteNr; int _footnoteNr;
int _endnoteNr; int _endnoteNr;
int _commentNr; int _commentNr;
bool _isTextBoxContent;
int _isSectionPageBreak; //0 - not set, 1 -page break, 2 - continues int _isSectionPageBreak; //0 - not set, 1 -page break, 2 - continues
bool _writeInstrText; bool _writeInstrText;
bool _writeWebHidden; bool _writeWebHidden;
......
...@@ -642,14 +642,18 @@ namespace DocFileFormat ...@@ -642,14 +642,18 @@ namespace DocFileFormat
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE );
m_pXmlWriter->WriteNodeBegin( _T( "w:pict" ) ); m_pXmlWriter->WriteNodeBegin( _T( "w:pict" ) );
//inline picture + bullete props
if (pict.blipStoreEntry != NULL) if (pict.blipStoreEntry != NULL)
{ {
VMLPictureMapping oPicture(m_context, m_pXmlWriter, false, this, true); VMLPictureMapping oPicture(m_context, m_pXmlWriter, false, this, true);
oPicture.m_isBullete = true;
pict.Convert(&oPicture); pict.Convert(&oPicture);
} }
else else
{ {
VMLShapeMapping oShape (m_context, m_pXmlWriter, NULL, &pict, this,true); VMLShapeMapping oShape (m_context, m_pXmlWriter, NULL, &pict, this, true);
oShape.m_isBullete = true;
pict.shapeContainer->Convert(&oShape); pict.shapeContainer->Convert(&oShape);
} }
......
...@@ -134,10 +134,8 @@ namespace DocFileFormat ...@@ -134,10 +134,8 @@ namespace DocFileFormat
unsigned short flag = reader->ReadUInt16(); unsigned short flag = reader->ReadUInt16();
pSpa->fHdr = FormatUtils::BitmaskToBool(flag, 0x0001); pSpa->fHdr = FormatUtils::BitmaskToBool(flag, 0x0001);
int bx = FormatUtils::BitmaskToInt(flag, 0x0006); pSpa->bx = (AnchorType)FormatUtils::BitmaskToInt(flag, 0x0006);
int by = FormatUtils::BitmaskToInt(flag, 0x0018); pSpa->by = (AnchorType)FormatUtils::BitmaskToInt(flag, 0x0018);
pSpa->bx = (AnchorType)bx;
pSpa->by = (AnchorType)by;
pSpa->wr = (unsigned short)FormatUtils::BitmaskToInt(flag, 0x01E0); pSpa->wr = (unsigned short)FormatUtils::BitmaskToInt(flag, 0x01E0);
pSpa->wrk = (unsigned short)FormatUtils::BitmaskToInt(flag, 0x1E00); pSpa->wrk = (unsigned short)FormatUtils::BitmaskToInt(flag, 0x1E00);
pSpa->fRcaSimple = FormatUtils::BitmaskToBool(flag, 0x2000); pSpa->fRcaSimple = FormatUtils::BitmaskToBool(flag, 0x2000);
......
...@@ -145,6 +145,8 @@ namespace DocFileFormat ...@@ -145,6 +145,8 @@ namespace DocFileFormat
cpEnd = txtbxSubdocStart + m_document->TextboxBreakPlexHeader->CharacterPositions[m_nTBIndex + 1]; cpEnd = txtbxSubdocStart + m_document->TextboxBreakPlexHeader->CharacterPositions[m_nTBIndex + 1];
} }
_isTextBoxContent = true;
//convert the textbox text //convert the textbox text
_lastValidPapx = (*(m_document->AllPapxFkps->begin()))->grppapx[0]; _lastValidPapx = (*(m_document->AllPapxFkps->begin()))->grppapx[0];
...@@ -175,6 +177,7 @@ namespace DocFileFormat ...@@ -175,6 +177,7 @@ namespace DocFileFormat
cp = writeParagraph( cp ); cp = writeParagraph( cp );
} }
} }
_isTextBoxContent = false;
m_pXmlWriter->WriteNodeEnd( _T( "w:txbxContent" ) ); m_pXmlWriter->WriteNodeEnd( _T( "w:txbxContent" ) );
m_pXmlWriter->WriteNodeEnd( _T( "v:textbox" ) ); m_pXmlWriter->WriteNodeEnd( _T( "v:textbox" ) );
......
...@@ -31,9 +31,11 @@ ...@@ -31,9 +31,11 @@
*/ */
#include "VMLPictureMapping.h" #include "VMLPictureMapping.h"
#include "VMLShapeMapping.h"
#include "OfficeDrawing/GeometryBooleanProperties.h" #include "OfficeDrawing/GeometryBooleanProperties.h"
#include "OfficeDrawing/GeometryTextBooleanProperties.h" #include "OfficeDrawing/GeometryTextBooleanProperties.h"
#include "OfficeDrawing/GroupShapeBooleanProperties.h"
#include "OfficeDrawing/MetafilePictBlip.h" #include "OfficeDrawing/MetafilePictBlip.h"
#include "../../DesktopEditor/common/String.h" #include "../../DesktopEditor/common/String.h"
...@@ -199,15 +201,16 @@ namespace DocFileFormat ...@@ -199,15 +201,16 @@ namespace DocFileFormat
} }
} }
VMLPictureMapping::VMLPictureMapping(ConversionContext* ctx, XmlUtils::CXmlWriter* writer, bool olePreview, IMapping* caller, bool isBulletPicture) : PropertiesMapping(writer) VMLPictureMapping::VMLPictureMapping(ConversionContext* ctx, XmlUtils::CXmlWriter* writer, bool olePreview, IMapping* caller, bool isInlinePicture) : PropertiesMapping(writer)
{ {
m_ctx = ctx; m_ctx = ctx;
m_isOlePreview = olePreview; m_isOlePreview = olePreview;
m_imageData = NULL; m_imageData = NULL;
m_nImageId = 0; m_nImageId = 0;
m_caller = caller; m_caller = caller;
m_isBulletPicture = isBulletPicture; m_isInlinePicture = isInlinePicture;
m_isBullete = false;
m_isEquation = false; m_isEquation = false;
m_isEmbedded = false; m_isEmbedded = false;
...@@ -232,8 +235,9 @@ namespace DocFileFormat ...@@ -232,8 +235,9 @@ namespace DocFileFormat
TwipsValue width( ( pict->dxaGoal - ( pict->dxaCropLeft + pict->dxaCropRight ) ) * xScaling ); TwipsValue width( ( pict->dxaGoal - ( pict->dxaCropLeft + pict->dxaCropRight ) ) * xScaling );
TwipsValue height( ( pict->dyaGoal - ( pict->dyaCropTop + pict->dyaCropBottom ) ) * yScaling ); TwipsValue height( ( pict->dyaGoal - ( pict->dyaCropTop + pict->dyaCropBottom ) ) * yScaling );
std::wstring widthString = FormatUtils::DoubleToWideString( width.ToPoints() ); std::wstring strWidth = FormatUtils::DoubleToWideString( width.ToPoints() );
std::wstring heightString = FormatUtils::DoubleToWideString( height.ToPoints() ); std::wstring strHeight = FormatUtils::DoubleToWideString( height.ToPoints() );
std::wstring strStyle;
std::list<OptionEntry> options; std::list<OptionEntry> options;
...@@ -246,7 +250,8 @@ namespace DocFileFormat ...@@ -246,7 +250,8 @@ namespace DocFileFormat
//v:shapetype //v:shapetype
type.SetType(shape->Instance); type.SetType(shape->Instance);
VMLShapeTypeMapping* vmlShapeTypeMapping = new VMLShapeTypeMapping( m_pXmlWriter, m_isBulletPicture ); VMLShapeTypeMapping* vmlShapeTypeMapping = new VMLShapeTypeMapping( m_pXmlWriter, m_isInlinePicture );
type.Convert( vmlShapeTypeMapping ); type.Convert( vmlShapeTypeMapping );
RELEASEOBJECT( vmlShapeTypeMapping ); RELEASEOBJECT( vmlShapeTypeMapping );
} }
...@@ -258,21 +263,18 @@ namespace DocFileFormat ...@@ -258,21 +263,18 @@ namespace DocFileFormat
m_pXmlWriter->WriteAttribute( _T( "type" ), std::wstring( _T( "#" ) + VMLShapeTypeMapping::GenerateTypeId(&type)).c_str()); m_pXmlWriter->WriteAttribute( _T( "type" ), std::wstring( _T( "#" ) + VMLShapeTypeMapping::GenerateTypeId(&type)).c_str());
std::wstring style = std::wstring( _T( "width:" ) ) + widthString + std::wstring( _T( "pt;" ) ) + std::wstring( _T( "height:" ) ) + heightString + std::wstring( _T( "pt;" ) );
m_pXmlWriter->WriteAttribute( _T( "style" ), style.c_str() );
m_pXmlWriter->WriteAttribute( _T( "id" ), m_ShapeId.c_str() ); m_pXmlWriter->WriteAttribute( _T( "id" ), m_ShapeId.c_str() );
if (m_isOlePreview) if (m_isOlePreview)
{ {
m_pXmlWriter->WriteAttribute( _T( "o:ole" ), _T( "" ) ); m_pXmlWriter->WriteAttribute( _T( "o:ole" ), _T( "" ) );
} }
else if (m_isBulletPicture) else if (m_isBullete)
{ {
m_pXmlWriter->WriteAttribute( _T( "o:bullet" ), _T( "1" ) ); m_pXmlWriter->WriteAttribute( _T( "o:bullet" ), _T( "1" ) );
} }
//todooo oбъединить с shape_mapping
std::list<OptionEntry>::iterator end = options.end(); std::list<OptionEntry>::iterator end = options.end();
for (std::list<OptionEntry>::iterator iter = options.begin(); iter != end; ++iter) for (std::list<OptionEntry>::iterator iter = options.begin(); iter != end; ++iter)
{ {
...@@ -350,9 +352,57 @@ namespace DocFileFormat ...@@ -350,9 +352,57 @@ namespace DocFileFormat
appendValueAttribute(m_imageData, _T( "croptop" ), ( FormatUtils::IntToWideString( cropTop ) + std::wstring( _T( "f" ) ) ).c_str()); appendValueAttribute(m_imageData, _T( "croptop" ), ( FormatUtils::IntToWideString( cropTop ) + std::wstring( _T( "f" ) ) ).c_str());
} }
break; break;
//------------------------------------------------------------
case PropertyId_rotation:
{
double dAngle = (double)((int)iter->op) / 65535.0;
if (dAngle < -360.0)
dAngle += 360.0;
std::wstring v = strHeight;
strHeight = strWidth; strWidth = v;
appendStyleProperty(&strStyle, _T( "rotation" ), FormatUtils::DoubleToWideString(dAngle));
}break;
case posh:
{
appendStyleProperty(&strStyle, _T("mso-position-horizontal"), VMLShapeMapping::mapHorizontalPosition((PositionHorizontal)iter->op));
}break;
case posrelh:
{
appendStyleProperty(&strStyle, _T("mso-position-horizontal-relative"), VMLShapeMapping::mapHorizontalPositionRelative((PositionHorizontalRelative)iter->op));
}break;
case posv:
{
appendStyleProperty(&strStyle, _T("mso-position-vertical"), VMLShapeMapping::mapVerticalPosition((PositionVertical)iter->op));
}break;
case posrelv:
{
appendStyleProperty(&strStyle, _T("mso-position-vertical-relative"), VMLShapeMapping::mapVerticalPositionRelative((PositionVerticalRelative)iter->op));
}break;
case groupShapeBooleans:
{
GroupShapeBooleanProperties groupShapeBooleans(iter->op);
if (groupShapeBooleans.fUsefBehindDocument && groupShapeBooleans.fBehindDocument)
{//m_isInlineShape ???
//The shape is behind the text, so the z-index must be negative.
appendStyleProperty(&strStyle, _T( "z-index" ), _T( "-1" ) );
}
if (groupShapeBooleans.fHidden && groupShapeBooleans.fUsefHidden)
{
appendStyleProperty(&strStyle, _T( "visibility" ), _T( "hidden" ));
}
}
break;
} }
} }
strStyle += _T( "width:" ) + strWidth + _T( "pt;" ) + _T( "height:" ) + strHeight + _T( "pt;" );
m_pXmlWriter->WriteAttribute( _T( "style" ), strStyle.c_str() );
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE );
if (CopyPicture(pict)) if (CopyPicture(pict))
......
...@@ -51,7 +51,7 @@ namespace DocFileFormat ...@@ -51,7 +51,7 @@ namespace DocFileFormat
class VMLPictureMapping: public PropertiesMapping, public IMapping class VMLPictureMapping: public PropertiesMapping, public IMapping
{ {
public: public:
VMLPictureMapping( ConversionContext* ctx, XmlUtils::CXmlWriter* writer, bool olePreview, IMapping* caller, bool isBulletPicture = false ); VMLPictureMapping( ConversionContext* ctx, XmlUtils::CXmlWriter* writer, bool olePreview, IMapping* caller, bool isInlinePicture = false );
virtual ~VMLPictureMapping(); virtual ~VMLPictureMapping();
virtual void Apply( IVisitable* visited ); virtual void Apply( IVisitable* visited );
std::wstring GetShapeId() const; std::wstring GetShapeId() const;
...@@ -70,6 +70,7 @@ namespace DocFileFormat ...@@ -70,6 +70,7 @@ namespace DocFileFormat
static std::wstring GetTargetExt (Global::BlipType nType); static std::wstring GetTargetExt (Global::BlipType nType);
static std::wstring GetContentType (Global::BlipType nType); static std::wstring GetContentType (Global::BlipType nType);
bool m_isBullete;
bool m_isEquation; bool m_isEquation;
bool m_isEmbedded; bool m_isEmbedded;
std::string m_embeddedData; std::string m_embeddedData;
...@@ -81,9 +82,9 @@ namespace DocFileFormat ...@@ -81,9 +82,9 @@ namespace DocFileFormat
int m_nImageId; int m_nImageId;
std::wstring m_ShapeId; std::wstring m_ShapeId;
bool m_isOlePreview; bool m_isOlePreview;
bool m_isInlinePicture;
bool m_isBulletPicture;
XMLTools::XMLElement<wchar_t>* m_imageData; XMLTools::XMLElement<wchar_t>* m_imageData;
}; };
......
...@@ -58,9 +58,10 @@ ...@@ -58,9 +58,10 @@
namespace DocFileFormat namespace DocFileFormat
{ {
VMLShapeMapping::VMLShapeMapping (ConversionContext* pConv, XmlUtils::CXmlWriter* pWriter, Spa* pSpa, PictureDescriptor* pPicture, IMapping* pCaller, bool bullet) : PropertiesMapping(pWriter) VMLShapeMapping::VMLShapeMapping (ConversionContext* pConv, XmlUtils::CXmlWriter* pWriter, Spa* pSpa, PictureDescriptor* pPicture, IMapping* pCaller, bool isInlineShape) : PropertiesMapping(pWriter)
{ {
m_bBullet = bullet; m_isInlineShape = isInlineShape;
m_isBullete = false;
m_pSpa = pSpa; m_pSpa = pSpa;
m_pCaller = pCaller; m_pCaller = pCaller;
...@@ -242,7 +243,7 @@ namespace DocFileFormat ...@@ -242,7 +243,7 @@ namespace DocFileFormat
m_pXmlWriter->WriteAttribute(_T("to"), GetLineTo(pAnchor).c_str()); m_pXmlWriter->WriteAttribute(_T("to"), GetLineTo(pAnchor).c_str());
} }
if (m_bBullet) if (m_isBullete)
{ {
m_pXmlWriter->WriteAttribute(_T("o:bullet"), _T("t")); m_pXmlWriter->WriteAttribute(_T("o:bullet"), _T("t"));
} }
...@@ -1086,7 +1087,7 @@ namespace DocFileFormat ...@@ -1086,7 +1087,7 @@ namespace DocFileFormat
WriteEndShapeNode(pShape); WriteEndShapeNode(pShape);
//ShapeType //ShapeType
if (NULL != pShape->GetShapeType() && !m_bBullet) if (NULL != pShape->GetShapeType() && !m_isInlineShape) //bullete only???
{ {
VMLShapeTypeMapping oXmlMapper(m_pXmlWriter); VMLShapeTypeMapping oXmlMapper(m_pXmlWriter);
pShape->GetShapeType()->Convert(&oXmlMapper); pShape->GetShapeType()->Convert(&oXmlMapper);
...@@ -1482,7 +1483,7 @@ namespace DocFileFormat ...@@ -1482,7 +1483,7 @@ namespace DocFileFormat
} }
} }
std::wstring VMLShapeMapping::mapVerticalPosition(PositionVertical vPos) const std::wstring VMLShapeMapping::mapVerticalPosition(static const PositionVertical &vPos)
{ {
switch ( vPos ) switch ( vPos )
{ {
...@@ -1497,7 +1498,7 @@ namespace DocFileFormat ...@@ -1497,7 +1498,7 @@ namespace DocFileFormat
} }
} }
std::wstring VMLShapeMapping::mapVerticalPositionRelative(int vRel_) const std::wstring VMLShapeMapping::mapVerticalPositionRelative(const int &vRel_)
{ {
PositionVerticalRelative vRel = (PositionVerticalRelative)vRel_; PositionVerticalRelative vRel = (PositionVerticalRelative)vRel_;
switch ( vRel ) switch ( vRel )
...@@ -1511,7 +1512,7 @@ namespace DocFileFormat ...@@ -1511,7 +1512,7 @@ namespace DocFileFormat
} }
} }
std::wstring VMLShapeMapping::mapHorizontalPosition(PositionHorizontal hPos) const std::wstring VMLShapeMapping::mapHorizontalPosition(const PositionHorizontal &hPos)
{ {
switch ( hPos ) switch ( hPos )
{ {
...@@ -1526,7 +1527,7 @@ namespace DocFileFormat ...@@ -1526,7 +1527,7 @@ namespace DocFileFormat
} }
} }
std::wstring VMLShapeMapping::mapHorizontalPositionRelative( int hRel_ ) const std::wstring VMLShapeMapping::mapHorizontalPositionRelative( const int &hRel_ )
{ {
PositionHorizontalRelative hRel = (PositionHorizontalRelative )hRel_; PositionHorizontalRelative hRel = (PositionHorizontalRelative )hRel_;
switch ( hRel ) switch ( hRel )
...@@ -1553,37 +1554,28 @@ namespace DocFileFormat ...@@ -1553,37 +1554,28 @@ namespace DocFileFormat
{ {
switch (iter->pid) switch (iter->pid)
{ {
// POSITIONING // POSITIONING
case posh: case posh:
{ {
appendStyleProperty(oStyle, _T("mso-position-horizontal"), mapHorizontalPosition((PositionHorizontal)iter->op)); appendStyleProperty(oStyle, _T("mso-position-horizontal"), mapHorizontalPosition((PositionHorizontal)iter->op));
bPosH = true; bPosH = true;
} }break;
break;
case posrelh: case posrelh:
{ {
appendStyleProperty(oStyle, _T("mso-position-horizontal-relative"), mapHorizontalPositionRelative((PositionHorizontalRelative)iter->op)); appendStyleProperty(oStyle, _T("mso-position-horizontal-relative"), mapHorizontalPositionRelative((PositionHorizontalRelative)iter->op));
bRelH = true; bRelH = true;
} }break;
break;
case posv: case posv:
{ {
appendStyleProperty(oStyle, _T("mso-position-vertical"), mapVerticalPosition((PositionVertical)iter->op)); appendStyleProperty(oStyle, _T("mso-position-vertical"), mapVerticalPosition((PositionVertical)iter->op));
bPosV = true; bPosV = true;
} }break;
break;
case posrelv: case posrelv:
{ {
appendStyleProperty(oStyle, _T("mso-position-vertical-relative"), mapVerticalPositionRelative((PositionVerticalRelative)iter->op)); appendStyleProperty(oStyle, _T("mso-position-vertical-relative"), mapVerticalPositionRelative((PositionVerticalRelative)iter->op));
bRelV = true; bRelV = true;
} }break;
break; // BOOLEANS
// BOOLEANS
case groupShapeBooleans: case groupShapeBooleans:
{ {
GroupShapeBooleanProperties groupShapeBooleans(iter->op); GroupShapeBooleanProperties groupShapeBooleans(iter->op);
...@@ -1598,11 +1590,8 @@ namespace DocFileFormat ...@@ -1598,11 +1590,8 @@ namespace DocFileFormat
{ {
appendStyleProperty(oStyle, _T( "visibility" ), _T( "hidden" )); appendStyleProperty(oStyle, _T( "visibility" ), _T( "hidden" ));
} }
} }break;
break; // GEOMETRY
// GEOMETRY
case PropertyId_rotation: case PropertyId_rotation:
{ {
double dAngle = (double)((int)iter->op) / 65535.0; double dAngle = (double)((int)iter->op) / 65535.0;
...@@ -1610,45 +1599,30 @@ namespace DocFileFormat ...@@ -1610,45 +1599,30 @@ namespace DocFileFormat
if (dAngle < -360.0) if (dAngle < -360.0)
dAngle += 360.0; dAngle += 360.0;
// //ATLTRACE (L"angle : %f\n", dAngle);
appendStyleProperty(oStyle, _T( "rotation" ), FormatUtils::DoubleToWideString(dAngle)); appendStyleProperty(oStyle, _T( "rotation" ), FormatUtils::DoubleToWideString(dAngle));
} }break;
break; // TEXTBOX
// TEXTBOX
case anchorText: case anchorText:
{ {
appendStyleProperty(oStyle, _T("v-text-anchor"), getTextboxAnchor(iter->op)); appendStyleProperty(oStyle, _T("v-text-anchor"), getTextboxAnchor(iter->op));
} }break;
break; // WRAP DISTANCE
// WRAP DISTANCE
case dxWrapDistLeft: case dxWrapDistLeft:
{ {
appendStyleProperty(oStyle, _T("mso-wrap-distance-left"), (FormatUtils::DoubleToWideString(EmuValue((int)iter->op).ToPoints()) + std::wstring(_T("pt")))); appendStyleProperty(oStyle, _T("mso-wrap-distance-left"), (FormatUtils::DoubleToWideString(EmuValue((int)iter->op).ToPoints()) + std::wstring(_T("pt"))));
} }break;
break;
case dxWrapDistRight: case dxWrapDistRight:
{ {
appendStyleProperty(oStyle, _T("mso-wrap-distance-right"), (FormatUtils::DoubleToWideString(EmuValue((int)iter->op).ToPoints()) + std::wstring(_T("pt")))); appendStyleProperty(oStyle, _T("mso-wrap-distance-right"), (FormatUtils::DoubleToWideString(EmuValue((int)iter->op).ToPoints()) + std::wstring(_T("pt"))));
} }break;
break;
case dyWrapDistBottom: case dyWrapDistBottom:
{ {
appendStyleProperty(oStyle, _T("mso-wrap-distance-bottom"), (FormatUtils::DoubleToWideString(EmuValue((int)iter->op).ToPoints()) + std::wstring(_T("pt")))); appendStyleProperty(oStyle, _T("mso-wrap-distance-bottom"), (FormatUtils::DoubleToWideString(EmuValue((int)iter->op).ToPoints()) + std::wstring(_T("pt"))));
} }break;
break;
case dyWrapDistTop: case dyWrapDistTop:
{ {
appendStyleProperty(oStyle, _T("mso-wrap-distance-top"), (FormatUtils::DoubleToWideString(EmuValue((int)iter->op).ToPoints()) + std::wstring(_T("pt")))); appendStyleProperty(oStyle, _T("mso-wrap-distance-top"), (FormatUtils::DoubleToWideString(EmuValue((int)iter->op).ToPoints()) + std::wstring(_T("pt"))));
} }break;
break;
} }
} }
...@@ -1661,14 +1635,14 @@ namespace DocFileFormat ...@@ -1661,14 +1635,14 @@ namespace DocFileFormat
appendStyleProperty(oStyle, _T("mso-position-vertical-relative"), mapVerticalPositionRelative(m_pSpa->bx)); appendStyleProperty(oStyle, _T("mso-position-vertical-relative"), mapVerticalPositionRelative(m_pSpa->bx));
} }
if (!bPosH) //if (!bPosH)
{ //{
appendStyleProperty(oStyle, _T("mso-position-horizontal"), _T( "absolute" )); // appendStyleProperty(oStyle, _T("mso-position-horizontal"), _T( "absolute" ));
} //}
if (!bPosV) //if (!bPosV)
{ //{
appendStyleProperty(oStyle, _T("mso-position-vertical"), _T( "absolute" )); // appendStyleProperty(oStyle, _T("mso-position-vertical"), _T( "absolute" ));
} //}
} }
// //
...@@ -1762,7 +1736,10 @@ namespace DocFileFormat ...@@ -1762,7 +1736,10 @@ namespace DocFileFormat
AppendOptionsToStyle( &style, options ); AppendOptionsToStyle( &style, options );
if (!this->m_bBullet)appendStyleProperty( &style, _T( "z-index" ), FormatUtils::IntToWideString(zIndex + 0x7ffff)); if (!m_isInlineShape)
{
appendStyleProperty( &style, _T( "z-index" ), FormatUtils::IntToWideString(zIndex + 0x7ffff));
}
return style; return style;
} }
......
...@@ -63,6 +63,12 @@ namespace DocFileFormat ...@@ -63,6 +63,12 @@ namespace DocFileFormat
virtual ~VMLShapeMapping(); virtual ~VMLShapeMapping();
virtual void Apply(IVisitable* visited); virtual void Apply(IVisitable* visited);
static std::wstring mapVerticalPosition (static const PositionVertical & vPos );
static std::wstring mapVerticalPositionRelative (static const int &vRel );
static std::wstring mapHorizontalPosition (static const PositionHorizontal &hPos );
static std::wstring mapHorizontalPositionRelative(static const int &hRel );
bool m_isBullete;
private: private:
void ApplyPrimitives (DrawingPrimitives * primitives ); void ApplyPrimitives (DrawingPrimitives * primitives );
...@@ -90,12 +96,7 @@ namespace DocFileFormat ...@@ -90,12 +96,7 @@ namespace DocFileFormat
void appendStyleProperty ( std::wstring* b, const std::wstring& propName, const std::wstring& propValue ) const; void appendStyleProperty ( std::wstring* b, const std::wstring& propName, const std::wstring& propValue ) const;
std::wstring getTextboxAnchor( unsigned int anchor ) const; std::wstring getTextboxAnchor( unsigned int anchor ) const;
std::wstring mapVerticalPosition ( PositionVertical vPos ) const;
std::wstring mapVerticalPositionRelative( int vRel ) const;
std::wstring mapHorizontalPosition ( PositionHorizontal hPos ) const;
std::wstring mapHorizontalPositionRelative( int hRel ) const;
void AppendOptionsToStyle( std::wstring* style, const std::list<OptionEntry>& options ) const; void AppendOptionsToStyle( std::wstring* style, const std::list<OptionEntry>& options ) const;
std::wstring buildStyle ( const Shape* shape, const ChildAnchor* anchor, const std::list<OptionEntry>& options, int zIndex ) const; std::wstring buildStyle ( const Shape* shape, const ChildAnchor* anchor, const std::list<OptionEntry>& options, int zIndex ) const;
...@@ -122,7 +123,7 @@ namespace DocFileFormat ...@@ -122,7 +123,7 @@ namespace DocFileFormat
std::vector<CString> GetTextRectangles(const OptionEntry& inscribe) const; std::vector<CString> GetTextRectangles(const OptionEntry& inscribe) const;
private: private:
bool m_bBullet; bool m_isInlineShape;
Spa* m_pSpa; Spa* m_pSpa;
IMapping* m_pCaller; IMapping* m_pCaller;
BlipStoreContainer* m_pBlipStore; BlipStoreContainer* m_pBlipStore;
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
namespace DocFileFormat namespace DocFileFormat
{ {
VMLShapeTypeMapping::VMLShapeTypeMapping (XmlUtils::CXmlWriter* pWriter, bool isBulletPicture) : PropertiesMapping(pWriter), _lock(NULL), _isBulletPicture(isBulletPicture) VMLShapeTypeMapping::VMLShapeTypeMapping (XmlUtils::CXmlWriter* pWriter, bool isInlineShape) : PropertiesMapping(pWriter), _lock(NULL), _isInlineShape(isInlineShape)
{ {
this->_lock = new XMLTools::XMLElement<wchar_t>( _T( "o:lock" ) ); this->_lock = new XMLTools::XMLElement<wchar_t>( _T( "o:lock" ) );
appendValueAttribute( this->_lock, _T( "v:ext" ), _T( "edit" ) ); appendValueAttribute( this->_lock, _T( "v:ext" ), _T( "edit" ) );
...@@ -72,7 +72,7 @@ namespace DocFileFormat ...@@ -72,7 +72,7 @@ namespace DocFileFormat
// Path // Path
if (!pShape->Path.empty()) if (!pShape->Path.empty())
m_pXmlWriter->WriteAttribute( _T("path"), pShape->Path.c_str() ); m_pXmlWriter->WriteAttribute( _T("path"), pShape->Path.c_str() );
else if (_isBulletPicture) else if (_isInlineShape)
m_pXmlWriter->WriteAttribute( _T("path"), _T("m@4@5l@4@11@9@11@9@5xe")); m_pXmlWriter->WriteAttribute( _T("path"), _T("m@4@5l@4@11@9@11@9@5xe"));
...@@ -87,7 +87,7 @@ namespace DocFileFormat ...@@ -87,7 +87,7 @@ namespace DocFileFormat
m_pXmlWriter->WriteAttribute( _T( "stroked" ), _T( "f" ) ); m_pXmlWriter->WriteAttribute( _T( "stroked" ), _T( "f" ) );
} }
if ( _isBulletPicture ) if ( _isInlineShape )
{ {
m_pXmlWriter->WriteAttribute( _T( "o:preferrelative" ), _T( "t" ) ); m_pXmlWriter->WriteAttribute( _T( "o:preferrelative" ), _T( "t" ) );
} }
...@@ -120,7 +120,7 @@ namespace DocFileFormat ...@@ -120,7 +120,7 @@ namespace DocFileFormat
m_pXmlWriter->WriteNodeEnd( _T( "v:formulas" ) ); m_pXmlWriter->WriteNodeEnd( _T( "v:formulas" ) );
} }
else if (_isBulletPicture) else if (_isInlineShape)
{ {
m_pXmlWriter->WriteString(_T("<v:formulas><v:f eqn=\"if lineDrawn pixelLineWidth 0\"/>\ m_pXmlWriter->WriteString(_T("<v:formulas><v:f eqn=\"if lineDrawn pixelLineWidth 0\"/>\
<v:f eqn=\"sum @0 1 0\"/><v:f eqn=\"sum 0 0 @1\"/>\ <v:f eqn=\"sum @0 1 0\"/><v:f eqn=\"sum 0 0 @1\"/>\
...@@ -134,7 +134,7 @@ namespace DocFileFormat ...@@ -134,7 +134,7 @@ namespace DocFileFormat
// Path // Path
m_pXmlWriter->WriteNodeBegin( _T( "v:path" ), true ); m_pXmlWriter->WriteNodeBegin( _T( "v:path" ), true );
if (_isBulletPicture) if (_isInlineShape)
{ {
m_pXmlWriter->WriteAttribute( _T( "o:extrusionok" ), _T( "f" ) ); m_pXmlWriter->WriteAttribute( _T( "o:extrusionok" ), _T( "f" ) );
m_pXmlWriter->WriteAttribute( _T( "gradientshapeok" ), _T( "t" ) ); m_pXmlWriter->WriteAttribute( _T( "gradientshapeok" ), _T( "t" ) );
......
...@@ -41,10 +41,10 @@ namespace DocFileFormat ...@@ -41,10 +41,10 @@ namespace DocFileFormat
{ {
private: private:
XMLTools::XMLElement<wchar_t> *_lock; XMLTools::XMLElement<wchar_t> *_lock;
bool _isBulletPicture; bool _isInlineShape;
public: public:
VMLShapeTypeMapping(XmlUtils::CXmlWriter* writer, bool isBulletPicture = false ); VMLShapeTypeMapping(XmlUtils::CXmlWriter* writer, bool isInlineShape = false );
virtual ~VMLShapeTypeMapping(); virtual ~VMLShapeTypeMapping();
virtual void Apply( IVisitable* visited ); virtual void Apply( IVisitable* visited );
/// Returns the id of the referenced type /// Returns the id of the referenced type
......
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