Commit 988aa4b5 authored by ElenaSubbotina's avatar ElenaSubbotina

DocFormatReader - уточнение позиционирования графики в graphics.doc

parent 58df15f5
...@@ -246,6 +246,10 @@ namespace DocFileFormat ...@@ -246,6 +246,10 @@ namespace DocFileFormat
std::list<OptionEntry>::const_iterator end = options.end(); std::list<OptionEntry>::const_iterator end = options.end();
for (std::list<OptionEntry>::const_iterator iter = options.begin(); iter != end; ++iter) for (std::list<OptionEntry>::const_iterator iter = options.begin(); iter != end; ++iter)
{ {
//mso-position-horizontal:absolute
//mso-position-horizontal-relative:margin
//mso-position-vertical:absolute
//mso-position-vertical-relative:margin
switch (iter->pid) switch (iter->pid)
{ {
//BOOLEANS //BOOLEANS
...@@ -1357,9 +1361,9 @@ namespace DocFileFormat ...@@ -1357,9 +1361,9 @@ namespace DocFileFormat
// appendStyleProperty( style, _T( "position" ), _T( "static" ) ); // appendStyleProperty( style, _T( "position" ), _T( "static" ) );
//} //}
//else //else
{ //{
appendStyleProperty( style, _T( "position" ), _T( "absolute" ) ); appendStyleProperty( style, _T( "position" ), _T( "absolute" ) );
} //}
TwipsValue left (pSpa->xaLeft); TwipsValue left (pSpa->xaLeft);
TwipsValue top (pSpa->yaTop); TwipsValue top (pSpa->yaTop);
...@@ -1428,254 +1432,84 @@ namespace DocFileFormat ...@@ -1428,254 +1432,84 @@ namespace DocFileFormat
{ {
switch ( anchor ) switch ( anchor )
{ {
case 0: case 0: return _T("top");
{ case 1: return _T("middle");
//msoanchorTop case 2: return _T("bottom");
return _T("top"); case 3: return _T("top-center");
} case 4: return _T("middle-center");
break; case 5: return _T("bottom-center");
case 6: return _T("top-baseline");
case 1: case 7: return _T("bottom-baseline");
{ case 8: return _T("top-center-baseline");
//msoanchorMiddle case 9: return _T("bottom-center-baseline");
return _T("middle");
}
break;
case 2:
{
//msoanchorBottom
return _T("bottom");
}
break;
case 3:
{
//msoanchorTopCentered
return _T("top-center");
}
break;
case 4:
{
//msoanchorMiddleCentered
return _T("middle-center");
}
break;
case 5:
{
//msoanchorBottomCentered
return _T("bottom-center");
}
break;
case 6:
{
//msoanchorTopBaseline
return _T("top-baseline");
}
break;
case 7:
{
//msoanchorBottomBaseline
return _T("bottom-baseline");
}
break;
case 8:
{
//msoanchorTopCenteredBaseline
return _T("top-center-baseline");
}
break;
case 9:
{
//msoanchorBottomCenteredBaseline
return _T("bottom-center-baseline");
}
break;
default: default:
{
return _T("top"); return _T("top");
} }
break;
}
} }
std::wstring VMLShapeMapping::mapVerticalPosition(PositionVertical vPos) const std::wstring VMLShapeMapping::mapVerticalPosition(PositionVertical vPos) const
{ {
switch ( vPos ) switch ( vPos )
{ {
/*case msopvAbs: /*case msopvAbs: return _T( "absolute" );*/
{ case msopvTop: return _T( "top" );
return _T( "absolute" ); case msopvCenter: return _T( "center" );
} case msopvBottom: return _T( "bottom" );
break;*/ case msopvInside: return _T( "inside" );
case msopvOutside: return _T( "outside" );
case msopvTop:
{
return _T( "top" );
}
break;
case msopvCenter:
{
return _T( "center" );
}
break;
case msopvBottom:
{
return _T( "bottom" );
}
break;
case msopvInside:
{
return _T( "inside" );
}
break;
case msopvOutside:
{
return _T( "outside" );
}
break;
default: default:
{
return _T( "absolute" ); return _T( "absolute" );
} }
break;
}
} }
std::wstring VMLShapeMapping::mapVerticalPositionRelative(PositionVerticalRelative vRel) const std::wstring VMLShapeMapping::mapVerticalPositionRelative(int vRel_) const
{ {
PositionVerticalRelative vRel = (PositionVerticalRelative)vRel_;
switch ( vRel ) switch ( vRel )
{ {
case msoprvMargin: case msoprvMargin: return _T( "margin" );
{ case msoprvPage: return _T( "page" );
return _T( "margin" ); case msoprvText: return _T( "text" );
} case msoprvLine: return _T( "line" );
break;
case msoprvPage:
{
return _T( "page" );
}
break;
case msoprvText:
{
return _T( "text" );
}
break;
case msoprvLine:
{
return _T( "line" );
}
break;
default: default:
{
return _T( "margin" ); return _T( "margin" );
} }
break;
}
} }
std::wstring VMLShapeMapping::mapHorizontalPosition(PositionHorizontal hPos) const std::wstring VMLShapeMapping::mapHorizontalPosition(PositionHorizontal hPos) const
{ {
switch ( hPos ) switch ( hPos )
{ {
/*case msophAbs: /*case msophAbs: return _T( "absolute" );*/
{ case msophLeft: return _T( "left" );
return _T( "absolute" ); case msophCenter: return _T( "center" );
} case msophRight: return _T( "right" );
break;*/ case msophInside: return _T( "inside" );
case msophOutside: return _T( "outside" );
case msophLeft:
{
return _T( "left" );
}
break;
case msophCenter:
{
return _T( "center" );
}
break;
case msophRight:
{
return _T( "right" );
}
break;
case msophInside:
{
return _T( "inside" );
}
break;
case msophOutside:
{
return _T( "outside" );
}
break;
default: default:
{
return _T( "absolute" ); return _T( "absolute" );
} }
break;
}
} }
std::wstring VMLShapeMapping::mapHorizontalPositionRelative( PositionHorizontalRelative hRel ) const std::wstring VMLShapeMapping::mapHorizontalPositionRelative( int hRel_ ) const
{ {
PositionHorizontalRelative hRel = (PositionHorizontalRelative )hRel_;
switch ( hRel ) switch ( hRel )
{ {
case msoprhMargin: case msoprhMargin: return _T( "margin" );
{ case msoprhPage: return _T( "page" );
return _T( "margin" ); case msoprhText: return _T( "text" );
} case msoprhChar: return _T( "char" );
break;
case msoprhPage:
{
return _T( "page" );
}
break;
case msoprhText:
{
return _T( "text" );
}
break;
case msoprhChar:
{
return _T( "char" );
}
break;
default: default:
{
return _T( "margin" ); return _T( "margin" );
} }
break;
}
} }
void VMLShapeMapping::AppendOptionsToStyle (std::wstring* oStyle, const std::list<OptionEntry>& options) const void VMLShapeMapping::AppendOptionsToStyle (std::wstring* oStyle, const std::list<OptionEntry>& options) const
{ {
bool bRelH = false;
bool bRelV = false;
std::list<OptionEntry>::const_iterator end = options.end(); std::list<OptionEntry>::const_iterator end = options.end();
for (std::list<OptionEntry>::const_iterator iter = options.begin(); iter != end; ++iter) for (std::list<OptionEntry>::const_iterator iter = options.begin(); iter != end; ++iter)
{ {
...@@ -1691,6 +1525,7 @@ namespace DocFileFormat ...@@ -1691,6 +1525,7 @@ namespace DocFileFormat
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;
} }
break; break;
...@@ -1703,6 +1538,7 @@ namespace DocFileFormat ...@@ -1703,6 +1538,7 @@ namespace DocFileFormat
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;
} }
break; break;
...@@ -1775,6 +1611,15 @@ namespace DocFileFormat ...@@ -1775,6 +1611,15 @@ namespace DocFileFormat
break; break;
} }
} }
if (!bRelH && m_pSpa)
{
appendStyleProperty(oStyle, _T("mso-position-horizontal-relative"), mapHorizontalPositionRelative(m_pSpa->bx));
}
if (!bRelV && m_pSpa)
{
appendStyleProperty(oStyle, _T("mso-position-vertical-relative"), mapVerticalPositionRelative(m_pSpa->bx));
}
} }
// //
...@@ -1877,41 +1722,12 @@ namespace DocFileFormat ...@@ -1877,41 +1722,12 @@ namespace DocFileFormat
{ {
switch (p) switch (p)
{ {
case 0: case 0: return _T( "single" );
{ case 1: return _T( "thinThin" );
return _T( "single" ); case 2: return _T( "thinThick" );
} case 3: return _T( "thickThin" );
break; case 4: return _T( "thickBetweenThin" );
default: return _T( "single" );
case 1:
{
return _T( "thinThin" );
}
break;
case 2:
{
return _T( "thinThick" );
}
break;
case 3:
{
return _T( "thickThin" );
}
break;
case 4:
{
return _T( "thickBetweenThin" );
}
break;
default:
{
return _T( "single" );
}
break;
} }
} }
...@@ -1919,47 +1735,12 @@ namespace DocFileFormat ...@@ -1919,47 +1735,12 @@ namespace DocFileFormat
{ {
switch ( op ) switch ( op )
{ {
default: default: return _T( "none" );
{ case 1: return _T( "block" );
//msolineNoEnd case 2: return _T( "classic" );
return _T( "none" ); case 3: return _T( "diamond" );
} case 4: return _T( "oval" );
break; case 5: return _T( "open" );
case 1:
{
//msolineArrowEnd
return _T( "block" );
}
break;
case 2:
{
//msolineArrowStealthEnd
return _T( "classic" );
}
break;
case 3:
{
//msolineArrowDiamondEnd
return _T( "diamond" );
}
break;
case 4:
{
//msolineArrowOvalEnd
return _T( "oval" );
}
break;
case 5:
{
//msolineArrowOpenEnd
return _T( "open" );
}
break;
} }
} }
...@@ -1967,26 +1748,9 @@ namespace DocFileFormat ...@@ -1967,26 +1748,9 @@ namespace DocFileFormat
{ {
switch ( op ) switch ( op )
{ {
default: default: return _T( "short" );
{ case 1: return _T( "medium" );
//msolineShortArrow case 2: return _T( "long" );
return _T( "short" );
}
break;
case 1:
{
//msolineMediumLengthArrow
return _T( "medium" );
}
break;
case 2:
{
//msolineLongArrow
return _T( "long" );
}
break;
} }
} }
...@@ -1994,26 +1758,9 @@ namespace DocFileFormat ...@@ -1994,26 +1758,9 @@ namespace DocFileFormat
{ {
switch ( op ) switch ( op )
{ {
default: default: return _T( "narrow" );
{ case 1: return _T( "medium" );
//msolineNarrowArrow case 2: return _T( "wide" );
return _T( "narrow" );
}
break;
case 1:
{
//msolineMediumWidthArrow
return _T( "medium" );
}
break;
case 2:
{
//msolineWideArrow
return _T( "wide" );
}
break;
} }
} }
......
...@@ -39,35 +39,42 @@ namespace DocFileFormat ...@@ -39,35 +39,42 @@ namespace DocFileFormat
// Converts a single shape // Converts a single shape
void WriteShape (const ShapeContainer* pContainer); void WriteShape (const ShapeContainer* pContainer);
/// Generates a string id for the given shape // Generates a string id for the given shape
std::wstring GenShapeId(const Shape* pShape) const; std::wstring GenShapeId(const Shape* pShape) const;
/// Build the VML wrapcoords string for a given pWrapPolygonVertices // Build the VML wrapcoords string for a given pWrapPolygonVertices
std::wstring getWrapCoords( const OptionEntry& pWrapPolygonVertices ) const; std::wstring getWrapCoords( const OptionEntry& pWrapPolygonVertices ) const;
/// Copies the picture from the binary stream to the zip archive // Copies the picture from the binary stream to the zip archive
/// and creates the relationships for the image. // and creates the relationships for the image.
bool copyPicture( const BlipStoreEntry* bse ); bool copyPicture( const BlipStoreEntry* bse );
std::wstring GetTargetExt( Global::BlipType _type ) const; std::wstring GetTargetExt( Global::BlipType _type ) const;
void AppendDimensionToStyle( wstring* style, const PictureDescriptor* pict, bool twistDimensions ) const; void AppendDimensionToStyle( wstring* style, const PictureDescriptor* pict, bool twistDimensions ) const;
void AppendDimensionToStyle( wstring* style, const Spa* pSpa, bool twistDimensions ) const; void AppendDimensionToStyle( wstring* style, const Spa* pSpa, bool twistDimensions ) const;
void AppendDimensionToStyle( wstring* style, const ChildAnchor* anchor, bool twistDimensions ) const; void AppendDimensionToStyle( wstring* style, const ChildAnchor* anchor, bool twistDimensions ) const;
void appendStyleProperty( wstring* b, const wstring& propName, const wstring& propValue ) const; void appendStyleProperty( wstring* b, const wstring& propName, const wstring& propValue ) const;
std::wstring getTextboxAnchor( unsigned int anchor ) const;
std::wstring mapVerticalPosition( PositionVertical vPos ) const; std::wstring getTextboxAnchor ( unsigned int anchor ) const;
std::wstring mapVerticalPositionRelative( PositionVerticalRelative vRel ) const; std::wstring mapVerticalPosition ( PositionVertical vPos ) const;
std::wstring mapHorizontalPosition( PositionHorizontal hPos ) const; std::wstring mapVerticalPositionRelative ( int vRel ) const;
std::wstring mapHorizontalPositionRelative( PositionHorizontalRelative hRel ) const; std::wstring mapHorizontalPosition ( PositionHorizontal hPos ) const;
void AppendOptionsToStyle( wstring* style, const list<OptionEntry>& options ) const; std::wstring mapHorizontalPositionRelative ( int hRel ) const;
std::wstring buildStyle( const Shape* shape, const ChildAnchor* anchor, const list<OptionEntry>& options, int zIndex ) const;
std::wstring getLineStyle( unsigned int p ) const; void AppendOptionsToStyle ( wstring* style, const list<OptionEntry>& options) const;
std::wstring getArrowStyle( unsigned int op ) const;
std::wstring getArrowLength( unsigned int op ) const; std::wstring buildStyle ( const Shape* shape, const ChildAnchor* anchor, const list<OptionEntry>& options, int zIndex ) const;
std::wstring getArrowWidth( unsigned int op ) const;
std::wstring getFillMethod( unsigned int p ) const; std::wstring getLineStyle ( unsigned int p ) const;
std::wstring getFillColorString( const unsigned char* p, unsigned int size ) const; std::wstring getArrowStyle ( unsigned int op ) const;
/// Returns the OpenXML fill type of a fill effect std::wstring getArrowLength ( unsigned int op ) const;
std::wstring getArrowWidth ( unsigned int op ) const;
std::wstring getFillMethod ( unsigned int p ) const;
std::wstring getFillColorString ( const unsigned char* p, unsigned int size ) const;
// Returns the OpenXML fill type of a fill effect
std::wstring getFillType( unsigned int p ) const; std::wstring getFillType( unsigned int p ) const;
std::wstring getShadowType( unsigned int p ) const; std::wstring getShadowType( unsigned int p ) const;
/// Returns the OpenXML wrap type of the shape // Returns the OpenXML wrap type of the shape
std::wstring getWrapType(const Spa* pSpa) const; std::wstring getWrapType(const Spa* pSpa) const;
std::wstring ParsePath (const list<OptionEntry>& options) const; std::wstring ParsePath (const list<OptionEntry>& options) const;
......
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