mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-03-03 00:11:47 +08:00
Compare commits
13 Commits
core-linux
...
core-linux
| Author | SHA1 | Date | |
|---|---|---|---|
| 6d6cbd51c3 | |||
| 9e0ff699aa | |||
| 9c1b107998 | |||
| c0d38c97f8 | |||
| f2e003b12c | |||
| ee43592691 | |||
| a1b2979f0f | |||
| 00328e88b2 | |||
| ed2878a8cc | |||
| bc18304827 | |||
| 8d59eeabd5 | |||
| df894c0193 | |||
| 655c393a1b |
@ -716,7 +716,7 @@ namespace DocFileFormat
|
||||
RELEASEOBJECT( chpxs );
|
||||
}
|
||||
}
|
||||
oleWriter.WriteString( _lastOLEObject );
|
||||
oleWriter.WriteString( _lastOLEObject ); _lastOLEObject.clear();
|
||||
oleWriter.WriteNodeEnd( L"w:object" );
|
||||
|
||||
if (!oVmlMapper.m_isEmbedded && oVmlMapper.m_isEquation)
|
||||
@ -912,6 +912,7 @@ namespace DocFileFormat
|
||||
pSpa = static_cast<Spa*>(m_document->OfficeDrawingPlexHeader->GetStruct(headerCp));
|
||||
}
|
||||
|
||||
bool bPicture = false;
|
||||
if (pSpa)
|
||||
{
|
||||
PictureDescriptor pictDiscr(chpx, m_document->WordDocumentStream, 0x7fffffff, m_document->nWordVersion);
|
||||
@ -925,6 +926,8 @@ namespace DocFileFormat
|
||||
|
||||
pShape->Convert(&oVmlWriter);
|
||||
m_pXmlWriter->WriteNodeEnd (L"w:pict");
|
||||
|
||||
bPicture = true;
|
||||
}
|
||||
|
||||
if (!pSpa->primitives.empty())
|
||||
@ -933,8 +936,13 @@ namespace DocFileFormat
|
||||
VMLShapeMapping oVmlWriter (m_context, m_pXmlWriter, pSpa, &pictDiscr, _caller);
|
||||
pSpa->primitives.Convert(&oVmlWriter);
|
||||
m_pXmlWriter->WriteNodeEnd (L"w:pict");
|
||||
|
||||
bPicture = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ((false == _fieldLevels.empty()) && (_fieldLevels.back().bSeparate))
|
||||
_fieldLevels.back().bResult = bPicture;
|
||||
}
|
||||
else if (TextMark::Picture == code && fSpec)
|
||||
{
|
||||
@ -1004,10 +1012,23 @@ namespace DocFileFormat
|
||||
oPicture.shapeContainer->Convert(&oVmlMapper);
|
||||
}
|
||||
|
||||
pictWriter.WriteNodeEnd (L"w:pict");
|
||||
pictWriter.WriteNodeEnd (L"w:pict");
|
||||
|
||||
if (!bFormula)
|
||||
m_pXmlWriter->WriteString(pictWriter.GetXmlString());
|
||||
{
|
||||
if (false == _fieldLevels.empty())
|
||||
{
|
||||
if (_fieldLevels.back().bSeparate && !_fieldLevels.back().bResult) //ege15.doc
|
||||
{
|
||||
m_pXmlWriter->WriteString(pictWriter.GetXmlString());
|
||||
_fieldLevels.back().bResult = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pXmlWriter->WriteString(pictWriter.GetXmlString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -161,6 +161,7 @@ namespace DocFileFormat
|
||||
{
|
||||
bool bBegin = false;
|
||||
bool bSeparate = false;
|
||||
bool bResult = false;
|
||||
//bool bInstrText = false;
|
||||
bool bEnd = false;
|
||||
};
|
||||
|
||||
@ -220,15 +220,12 @@ namespace DocFileFormat
|
||||
return res;
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
void VMLPictureMapping::appendStyleProperty(std::wstring* b, const std::wstring& propName, const std::wstring& propValue) const
|
||||
void VMLPictureMapping::appendStyleProperty(std::wstring& style, const std::wstring& propName, const std::wstring& propValue) const
|
||||
{
|
||||
if ( b != NULL )
|
||||
{
|
||||
b->operator += ( propName );
|
||||
b->operator += ( L":" );
|
||||
b->operator += ( propValue );
|
||||
b->operator +=( L";" );
|
||||
}
|
||||
style += ( propName );
|
||||
style += ( L":" );
|
||||
style += ( propValue );
|
||||
style +=( L";" );
|
||||
}
|
||||
|
||||
VMLPictureMapping::VMLPictureMapping(ConversionContext* ctx, XMLTools::CStringXmlWriter* writer, bool olePreview, IMapping* caller, bool isInlinePicture) : PropertiesMapping(writer)
|
||||
@ -295,6 +292,7 @@ namespace DocFileFormat
|
||||
|
||||
type.Convert( vmlShapeTypeMapping );
|
||||
RELEASEOBJECT( vmlShapeTypeMapping );
|
||||
|
||||
}
|
||||
else if (pict->embeddedData)
|
||||
{
|
||||
@ -420,23 +418,23 @@ namespace DocFileFormat
|
||||
std::wstring v = strHeight;
|
||||
strHeight = strWidth; strWidth = v;
|
||||
|
||||
appendStyleProperty(&strStyle, L"rotation", FormatUtils::DoubleToWideString(dAngle));
|
||||
appendStyleProperty(strStyle, L"rotation", FormatUtils::DoubleToWideString(dAngle));
|
||||
}break;
|
||||
case posh:
|
||||
{
|
||||
appendStyleProperty(&strStyle, L"mso-position-horizontal", VMLShapeMapping::mapHorizontalPosition((PositionHorizontal)iter->op));
|
||||
appendStyleProperty(strStyle, L"mso-position-horizontal", VMLShapeMapping::mapHorizontalPosition((PositionHorizontal)iter->op));
|
||||
}break;
|
||||
case posrelh:
|
||||
{
|
||||
appendStyleProperty(&strStyle, L"mso-position-horizontal-relative", VMLShapeMapping::mapHorizontalPositionRelative((PositionHorizontalRelative)iter->op));
|
||||
appendStyleProperty(strStyle, L"mso-position-horizontal-relative", VMLShapeMapping::mapHorizontalPositionRelative((PositionHorizontalRelative)iter->op));
|
||||
}break;
|
||||
case posv:
|
||||
{
|
||||
appendStyleProperty(&strStyle, L"mso-position-vertical", VMLShapeMapping::mapVerticalPosition((PositionVertical)iter->op));
|
||||
appendStyleProperty(strStyle, L"mso-position-vertical", VMLShapeMapping::mapVerticalPosition((PositionVertical)iter->op));
|
||||
}break;
|
||||
case posrelv:
|
||||
{
|
||||
appendStyleProperty(&strStyle, L"mso-position-vertical-relative", VMLShapeMapping::mapVerticalPositionRelative((PositionVerticalRelative)iter->op));
|
||||
appendStyleProperty(strStyle, L"mso-position-vertical-relative", VMLShapeMapping::mapVerticalPositionRelative((PositionVerticalRelative)iter->op));
|
||||
}break;
|
||||
case groupShapeBooleans:
|
||||
{
|
||||
@ -445,7 +443,7 @@ namespace DocFileFormat
|
||||
if (booleans->fUsefBehindDocument && booleans->fBehindDocument)
|
||||
{
|
||||
//The shape is behind the text, so the z-index must be negative.
|
||||
appendStyleProperty(&strStyle, L"z-index", L"-1" );
|
||||
appendStyleProperty(strStyle, L"z-index", L"-1" );
|
||||
}
|
||||
//else if (!m_isInlinePicture)
|
||||
//{
|
||||
@ -454,7 +452,7 @@ namespace DocFileFormat
|
||||
|
||||
if (booleans->fHidden && booleans->fUsefHidden)
|
||||
{
|
||||
appendStyleProperty(&strStyle, L"visibility", L"hidden");
|
||||
appendStyleProperty(strStyle, L"visibility", L"hidden");
|
||||
}
|
||||
}break;
|
||||
default:
|
||||
@ -499,7 +497,8 @@ namespace DocFileFormat
|
||||
appendValueAttribute(m_imageData, L"o:title", L"" );
|
||||
m_pXmlWriter->WriteString(m_imageData->GetXMLString());
|
||||
}
|
||||
|
||||
else
|
||||
m_isPictureBroken = true;
|
||||
|
||||
{//borders
|
||||
writePictureBorder( L"bordertop", pict->brcTop );
|
||||
|
||||
@ -56,7 +56,7 @@ namespace DocFileFormat
|
||||
private:
|
||||
/// Writes a border element
|
||||
void writePictureBorder (const std::wstring & name, const BorderCode* brc);
|
||||
void appendStyleProperty( std::wstring* b, const std::wstring& propName, const std::wstring& propValue ) const;
|
||||
void appendStyleProperty( std::wstring& style, const std::wstring& propName, const std::wstring& propValue ) const;
|
||||
bool ParseEmbeddedEquation( const std::string & xmlString, std::wstring & newXmlString );
|
||||
bool ParseEmbeddedBlob(const std::string & xmlString, std::wstring & newXmlString);
|
||||
std::wstring GetShapeID(const Shape* pShape) const;
|
||||
@ -74,6 +74,7 @@ namespace DocFileFormat
|
||||
bool m_isBullete;
|
||||
bool m_isEquation;
|
||||
bool m_isEmbedded;
|
||||
bool m_isPictureBroken;
|
||||
std::string m_embeddedData;
|
||||
std::wstring m_equationXml;
|
||||
std::wstring m_blobXml;
|
||||
|
||||
@ -52,6 +52,7 @@ namespace DocFileFormat
|
||||
{
|
||||
m_isInlineShape = isInlineShape;
|
||||
m_isBullete = false;
|
||||
m_isPictureBroken = false;
|
||||
|
||||
m_pSpa = pSpa;
|
||||
m_pCaller = pCaller;
|
||||
@ -277,6 +278,7 @@ namespace DocFileFormat
|
||||
bool layoutInCell = true; //anmeldebogenfos.doc
|
||||
bool b3D = false;
|
||||
bool bShadow = false;
|
||||
bool bPicturePresent = false;
|
||||
|
||||
int ndxTextLeft = -1;
|
||||
int ndyTextTop = -1;
|
||||
@ -565,6 +567,8 @@ namespace DocFileFormat
|
||||
{
|
||||
appendValueAttribute(&m_fill, L"r:id", std::wstring(( L"rId" ) + FormatUtils::IntToWideString(m_nImageId) ));
|
||||
}
|
||||
|
||||
bPicturePresent = true;
|
||||
}break;
|
||||
case fillBlipName:
|
||||
{
|
||||
@ -647,6 +651,7 @@ namespace DocFileFormat
|
||||
appendValueAttribute(&m_imagedata, L"r:id", ( std::wstring( L"rId" ) + FormatUtils::IntToWideString(m_nImageId) ));
|
||||
}
|
||||
}
|
||||
bPicturePresent = true;
|
||||
}break;
|
||||
case pibName:
|
||||
{
|
||||
@ -751,11 +756,11 @@ namespace DocFileFormat
|
||||
break;
|
||||
case 1:
|
||||
case 5://верт (склони голову направо)
|
||||
appendStyleProperty(&sTextboxStyle, L"layout-flow", L"vertical");
|
||||
appendStyleProperty(sTextboxStyle, L"layout-flow", L"vertical");
|
||||
break;
|
||||
case 2://верт (склони голову налево)
|
||||
appendStyleProperty(&sTextboxStyle, L"layout-flow", L"vertical");
|
||||
appendStyleProperty(&sTextboxStyle, L"mso-layout-flow-alt", L"bottom-to-top");
|
||||
appendStyleProperty(sTextboxStyle, L"layout-flow", L"vertical");
|
||||
appendStyleProperty(sTextboxStyle, L"mso-layout-flow-alt", L"bottom-to-top");
|
||||
break;
|
||||
}
|
||||
}break;
|
||||
@ -789,18 +794,18 @@ namespace DocFileFormat
|
||||
if (i < font.size()) font.erase(font.begin() + i, font.end());
|
||||
|
||||
font = std::wstring(L"\"") + font + std::wstring(L"\"");
|
||||
appendStyleProperty(&m_textPathStyle, L"font-family", font);
|
||||
appendStyleProperty(m_textPathStyle, L"font-family", font);
|
||||
}
|
||||
}break;
|
||||
case gtextSize:
|
||||
{
|
||||
std::wstring fontSize = FormatUtils::IntToWideString(iter->op/65535);
|
||||
appendStyleProperty(&m_textPathStyle, L"font-size", fontSize + L"pt");
|
||||
appendStyleProperty(m_textPathStyle, L"font-size", fontSize + L"pt");
|
||||
}break;
|
||||
case gtextSpacing:
|
||||
{
|
||||
std::wstring spacing = FormatUtils::IntToWideString(iter->op);
|
||||
appendStyleProperty(&m_textPathStyle, L"v-text-spacing", spacing + L"f");
|
||||
appendStyleProperty(m_textPathStyle, L"v-text-spacing", spacing + L"f");
|
||||
}break;
|
||||
case geometryTextBooleanProperties:
|
||||
{
|
||||
@ -815,20 +820,20 @@ namespace DocFileFormat
|
||||
}
|
||||
if (props->fUsegFVertical && props->fVertical)
|
||||
{
|
||||
appendStyleProperty(&m_textPathStyle, L"v-rotate-letters", L"t");
|
||||
appendStyleProperty(m_textPathStyle, L"v-rotate-letters", L"t");
|
||||
//_twistDimension = true;
|
||||
}
|
||||
if (props->fUsegFKern && props->fKern)
|
||||
{
|
||||
appendStyleProperty(&m_textPathStyle, L"v-text-kern", L"t");
|
||||
appendStyleProperty(m_textPathStyle, L"v-text-kern", L"t");
|
||||
}
|
||||
if (props->fUsegFItalic && props->fItalic)
|
||||
{
|
||||
appendStyleProperty(&m_textPathStyle, L"font-style", L"italic");
|
||||
appendStyleProperty(m_textPathStyle, L"font-style", L"italic");
|
||||
}
|
||||
if (props->fUsegFBold && props->fBold)
|
||||
{
|
||||
appendStyleProperty(&m_textPathStyle, L"font-weight", L"bold");
|
||||
appendStyleProperty(m_textPathStyle, L"font-weight", L"bold");
|
||||
}
|
||||
}break;
|
||||
default:
|
||||
@ -873,10 +878,10 @@ namespace DocFileFormat
|
||||
m_pXmlWriter->WriteAttribute( L"coordsize", ( FormatUtils::IntToWideString( *xCoord ) + L"," + FormatUtils::IntToWideString( *yCoord ) ));
|
||||
}
|
||||
|
||||
int nCode = 0;
|
||||
int nCode = 0;
|
||||
if (pShape->GetShapeType())
|
||||
{
|
||||
nCode = pShape->GetShapeType()->GetTypeCode();
|
||||
nCode = pShape->GetShapeType()->GetTypeCode();
|
||||
}
|
||||
|
||||
if (DocFileFormat::msosptRoundRectangle == nCode)
|
||||
@ -886,6 +891,11 @@ namespace DocFileFormat
|
||||
m_pXmlWriter->WriteAttribute(L"arcsize", m_nAdjValues[0]);
|
||||
}
|
||||
}
|
||||
else if (DocFileFormat::msosptPictureFrame == nCode)
|
||||
{
|
||||
if (bPicturePresent == false)
|
||||
m_isPictureBroken = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (nAdjValues > 0)
|
||||
@ -1391,9 +1401,9 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
|
||||
void VMLShapeMapping::AppendDimensionToStyle(std::wstring* style, const PictureDescriptor* pict, bool twistDimensions) const
|
||||
void VMLShapeMapping::AppendDimensionToStyle(std::wstring& style, const PictureDescriptor* pict, bool twistDimensions) const
|
||||
{
|
||||
if ( ( style != NULL ) && ( pict != NULL ) )
|
||||
if ( pict != NULL )
|
||||
{
|
||||
double xScaling = pict->mx / 1000.0;
|
||||
double yScaling = pict->my / 1000.0;
|
||||
@ -1410,26 +1420,24 @@ namespace DocFileFormat
|
||||
std::wstring widthString = FormatUtils::DoubleToWideString( width.ToPoints() );
|
||||
std::wstring heightString = FormatUtils::DoubleToWideString( height.ToPoints() );
|
||||
|
||||
style->operator += ( std::wstring( L"width:" ) + widthString + std::wstring( L"pt;" ) );
|
||||
style->operator += ( std::wstring( L"height:" ) + heightString + std::wstring( L"pt;" ) );
|
||||
style += L"width:" + widthString + L"pt;" ;
|
||||
style += L"height:" + heightString + L"pt;";
|
||||
}
|
||||
}
|
||||
|
||||
void VMLShapeMapping::AppendDimensionToStyle(std::wstring* style, const Spa* pSpa, bool twistDimensions) const
|
||||
void VMLShapeMapping::AppendDimensionToStyle(std::wstring& style, const Spa* pSpa, bool twistDimensions) const
|
||||
{
|
||||
if ( ( style != NULL ) && (pSpa != NULL ) )
|
||||
if (pSpa != NULL )
|
||||
{
|
||||
//append size and position ...
|
||||
|
||||
//if (pSpa->fAnchorLock )
|
||||
//if (pSpa->bx == TEXT && pSpa->by == TEXT)
|
||||
//{
|
||||
if (pSpa->bx == TEXT && pSpa->by == TEXT)
|
||||
{
|
||||
// appendStyleProperty( style, L"position", L"static" );
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
appendStyleProperty( style, L"position", L"absolute" );
|
||||
//}
|
||||
}
|
||||
else
|
||||
appendStylePropertyFirst( style, L"position", L"absolute" );
|
||||
|
||||
TwipsValue left (pSpa->xaLeft);
|
||||
TwipsValue top (pSpa->yaTop);
|
||||
@ -1452,9 +1460,9 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
|
||||
void VMLShapeMapping::AppendDimensionToStyle(std::wstring* style, const ChildAnchor* anchor, bool twistDimensions) const
|
||||
void VMLShapeMapping::AppendDimensionToStyle(std::wstring& style, const ChildAnchor* anchor, bool twistDimensions) const
|
||||
{
|
||||
if ((style != NULL) && (anchor != NULL))
|
||||
if (anchor != NULL)
|
||||
{
|
||||
DocFileFormat::Rectangle bounds = anchor->rcgBounds;
|
||||
|
||||
@ -1464,34 +1472,40 @@ namespace DocFileFormat
|
||||
bounds.topLeftAngle.y = static_cast<LONG>(((anchor->Bottom + anchor->Top) * 0.5 - (anchor->Right - anchor->Left) * 0.5));
|
||||
}
|
||||
|
||||
appendStyleProperty(style, L"position", L"absolute");
|
||||
appendStyleProperty(style, L"left", FormatUtils::IntToWideString(bounds.topLeftAngle.x));
|
||||
appendStyleProperty(style, L"top", FormatUtils::IntToWideString(bounds.topLeftAngle.y));
|
||||
appendStylePropertyFirst(style, L"top", FormatUtils::IntToWideString(bounds.topLeftAngle.y));
|
||||
appendStylePropertyFirst(style, L"left", FormatUtils::IntToWideString(bounds.topLeftAngle.x));
|
||||
appendStylePropertyFirst(style, L"position", L"absolute");
|
||||
|
||||
if (twistDimensions)
|
||||
{
|
||||
appendStyleProperty(style, L"width", FormatUtils::IntToWideString(bounds.size.cy));
|
||||
appendStyleProperty(style, L"height", FormatUtils::IntToWideString(bounds.size.cx));
|
||||
appendStylePropertyFirst(style, L"width", FormatUtils::IntToWideString(bounds.size.cy));
|
||||
appendStylePropertyFirst(style, L"height", FormatUtils::IntToWideString(bounds.size.cx));
|
||||
}
|
||||
else
|
||||
{
|
||||
appendStyleProperty(style, L"width", FormatUtils::IntToWideString(bounds.size.cx));
|
||||
appendStyleProperty(style, L"height", FormatUtils::IntToWideString(bounds.size.cy));
|
||||
appendStylePropertyFirst(style, L"width", FormatUtils::IntToWideString(bounds.size.cx));
|
||||
appendStylePropertyFirst(style, L"height", FormatUtils::IntToWideString(bounds.size.cy));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VMLShapeMapping::appendStyleProperty(std::wstring* b, const std::wstring& propName, const std::wstring& propValue) const
|
||||
void VMLShapeMapping::appendStyleProperty(std::wstring& style, const std::wstring& propName, const std::wstring& propValue) const
|
||||
{
|
||||
if ( b != NULL )
|
||||
{
|
||||
b->operator += ( propName );
|
||||
b->operator += ( L":" );
|
||||
b->operator += ( propValue );
|
||||
b->operator +=( L";" );
|
||||
}
|
||||
style += ( propName );
|
||||
style += ( L":" );
|
||||
style += ( propValue );
|
||||
style +=( L";" );
|
||||
}
|
||||
void VMLShapeMapping::appendStylePropertyFirst(std::wstring& style, const std::wstring& propName, const std::wstring& propValue) const
|
||||
{
|
||||
std::wstring s;
|
||||
s += ( propName );
|
||||
s += ( L":" );
|
||||
s += ( propValue );
|
||||
s +=( L";" );
|
||||
|
||||
style = s + style;
|
||||
}
|
||||
|
||||
std::wstring VMLShapeMapping::getTextboxAnchor(unsigned int anchor) const
|
||||
{
|
||||
switch ( anchor )
|
||||
@ -1560,22 +1574,22 @@ namespace DocFileFormat
|
||||
PositionHorizontalRelative hRel = (PositionHorizontalRelative )hRel_;
|
||||
switch ( hRel )
|
||||
{
|
||||
case msoprhMargin: return L"margin";
|
||||
case msoprhPage: return L"page";
|
||||
case msoprhText: return L"text";
|
||||
case msoprhChar: return L"char";
|
||||
case msoprhMargin: return L"margin"; //0 //MARGIN = anchor
|
||||
case msoprhPage: return L"page"; //1 //PAGE
|
||||
case msoprhText: return L"text"; //2 //TEXT
|
||||
case msoprhChar: return L"char"; //3
|
||||
default:
|
||||
return L"margin";
|
||||
}
|
||||
}
|
||||
|
||||
void VMLShapeMapping::AppendOptionsToStyle (std::wstring* oStyle, const std::vector<ODRAW::OfficeArtFOPTEPtr>& options, int zIndex) const
|
||||
void VMLShapeMapping::AppendOptionsToStyle (std::wstring& oStyle, const std::vector<ODRAW::OfficeArtFOPTEPtr>& options, int zIndex) const
|
||||
{
|
||||
bool bRelH = false;
|
||||
bool bRelV = false;
|
||||
int nRelH = -1;
|
||||
int nRelV = -1;
|
||||
|
||||
bool bPosH = false;
|
||||
bool bPosV = false;
|
||||
int nPosH = -1;
|
||||
int nPosV = -1;
|
||||
|
||||
bool bZIndex = false;
|
||||
|
||||
@ -1587,36 +1601,40 @@ namespace DocFileFormat
|
||||
// POSITIONING
|
||||
case posh:
|
||||
{
|
||||
appendStyleProperty(oStyle, L"mso-position-horizontal", mapHorizontalPosition((PositionHorizontal)iter->op));
|
||||
bPosH = true;
|
||||
nPosH = iter->op;
|
||||
}break;
|
||||
case posrelh:
|
||||
{
|
||||
nRelH = iter->op;
|
||||
appendStyleProperty(oStyle, L"mso-position-horizontal-relative", mapHorizontalPositionRelative((PositionHorizontalRelative)iter->op));
|
||||
bRelH = true;
|
||||
}break;
|
||||
case posv:
|
||||
{
|
||||
appendStyleProperty(oStyle, L"mso-position-vertical", mapVerticalPosition((PositionVertical)iter->op));
|
||||
bPosV = true;
|
||||
nPosV = iter->op;
|
||||
}break;
|
||||
case posrelv:
|
||||
{
|
||||
nRelV = iter->op;
|
||||
appendStyleProperty(oStyle, L"mso-position-vertical-relative", mapVerticalPositionRelative((PositionVerticalRelative)iter->op));
|
||||
bRelV = true;
|
||||
}break;
|
||||
// BOOLEANS
|
||||
case groupShapeBooleans:
|
||||
{
|
||||
ODRAW::GroupShapeBooleanProperties* booleans = dynamic_cast<ODRAW::GroupShapeBooleanProperties*>(iter.get());
|
||||
|
||||
if (booleans->fUsefBehindDocument && booleans->fBehindDocument && !bZIndex)
|
||||
if (booleans->fUsefBehindDocument && booleans->fBehindDocument)
|
||||
{
|
||||
//The shape is behind the text, so the z-index must be negative.
|
||||
appendStyleProperty(oStyle, L"z-index", L"-1" );
|
||||
bZIndex = true;
|
||||
//за текстом (The shape is behind the text, so the z-index must be negative.)
|
||||
m_isInlineShape = false;
|
||||
|
||||
if (!bZIndex)
|
||||
{
|
||||
appendStyleProperty(oStyle, L"z-index", FormatUtils::IntToWideString(-zIndex - 0x7ffff));
|
||||
bZIndex = true;
|
||||
}
|
||||
}
|
||||
else if (!m_isInlineShape && !bZIndex)
|
||||
|
||||
if (!m_isInlineShape && !bZIndex)
|
||||
{
|
||||
appendStyleProperty( oStyle, L"z-index", FormatUtils::IntToWideString(zIndex + 0x7ffff));
|
||||
bZIndex = true;
|
||||
@ -1664,13 +1682,29 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
|
||||
if (!bRelH && m_pSpa)
|
||||
if (nRelH < 0 && m_pSpa)
|
||||
{
|
||||
appendStyleProperty(oStyle, L"mso-position-horizontal-relative", mapHorizontalPositionRelative(m_pSpa->bx));
|
||||
if (m_pSpa->bx == TEXT && bZIndex)
|
||||
{
|
||||
m_pSpa->bx = PAGE;
|
||||
}
|
||||
else
|
||||
{
|
||||
nRelH = m_pSpa->bx;
|
||||
appendStyleProperty(oStyle, L"mso-position-horizontal-relative", mapHorizontalPositionRelative(m_pSpa->bx));
|
||||
}
|
||||
}
|
||||
if (!bRelV && m_pSpa)
|
||||
if (nRelV < 0 && m_pSpa)
|
||||
{
|
||||
appendStyleProperty(oStyle, L"mso-position-vertical-relative", mapVerticalPositionRelative(m_pSpa->by));
|
||||
if (m_pSpa->by == TEXT && bZIndex)
|
||||
{
|
||||
m_pSpa->by = PAGE;
|
||||
}
|
||||
else
|
||||
{
|
||||
nRelV = m_pSpa->by;
|
||||
appendStyleProperty(oStyle, L"mso-position-vertical-relative", mapVerticalPositionRelative(m_pSpa->by));
|
||||
}
|
||||
}
|
||||
if (!m_isInlineShape && !bZIndex)
|
||||
{
|
||||
@ -1678,6 +1712,19 @@ namespace DocFileFormat
|
||||
bZIndex = true;
|
||||
}
|
||||
|
||||
if (nRelH == 3 && nRelV == 3)
|
||||
{
|
||||
m_isInlineShape = true;
|
||||
}
|
||||
|
||||
if (nPosH >= 0 && !m_isInlineShape)
|
||||
{
|
||||
appendStyleProperty(oStyle, L"mso-position-horizontal", mapHorizontalPosition((PositionHorizontal)nPosH));
|
||||
}
|
||||
if (nPosV >= 0 && !m_isInlineShape)
|
||||
{
|
||||
appendStyleProperty(oStyle, L"mso-position-vertical", mapVerticalPosition((PositionVertical)nPosV));
|
||||
}
|
||||
//if (!bPosH)
|
||||
//{
|
||||
// appendStyleProperty(oStyle, L"mso-position-horizontal", L"absolute" );
|
||||
@ -1721,26 +1768,38 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
|
||||
if ( shape->fFlipH )
|
||||
{
|
||||
appendStyleProperty( style, L"flip", L"x" );
|
||||
}
|
||||
|
||||
if ( shape->fFlipV )
|
||||
{
|
||||
appendStyleProperty( style, L"flip", L"y" );
|
||||
}
|
||||
|
||||
AppendOptionsToStyle( style, options, zIndex );
|
||||
|
||||
//don't append the dimension info to lines,
|
||||
// because they have "from" and "to" attributes to decline the dimension
|
||||
if(!shape->is<LineType>())
|
||||
if(false == shape->is<LineType>())
|
||||
{
|
||||
if ( (m_pSpa != NULL) && ( anchor == NULL ) )
|
||||
{
|
||||
//this shape is placed directly in the document,
|
||||
//so use the FSPA to build the style
|
||||
AppendDimensionToStyle(&style, m_pSpa, twistDimensions);
|
||||
AppendDimensionToStyle( style, m_pSpa, twistDimensions);
|
||||
}
|
||||
else if (anchor)
|
||||
{
|
||||
//the style is part of a group,
|
||||
//so use the anchor
|
||||
AppendDimensionToStyle(&style, anchor, twistDimensions);
|
||||
AppendDimensionToStyle( style, anchor, twistDimensions);
|
||||
}
|
||||
else if (m_pict)
|
||||
{
|
||||
// it is some kind of PICT shape (e.g. WordArt)
|
||||
AppendDimensionToStyle(&style, m_pict, twistDimensions);
|
||||
AppendDimensionToStyle( style, m_pict, twistDimensions);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1748,36 +1807,23 @@ namespace DocFileFormat
|
||||
//если не написать тип позиции, то будет inline
|
||||
if ( anchor != NULL )
|
||||
{
|
||||
appendStyleProperty( &style, L"position", L"absolute" );
|
||||
appendStylePropertyFirst( style, L"position", L"absolute" );
|
||||
}
|
||||
else if (m_pSpa)
|
||||
{
|
||||
//append size and position ...
|
||||
//if (m_pSpa->fAnchorLock)//это возможность смены привязки , а не ее тип
|
||||
|
||||
//if (m_pSpa->bx == TEXT && m_pSpa->by == TEXT)
|
||||
//{
|
||||
// appendStyleProperty( &style, L"position", L"static" );
|
||||
//}
|
||||
//else
|
||||
if (m_pSpa->bx == TEXT && m_pSpa->by == TEXT)
|
||||
{
|
||||
appendStyleProperty( &style, L"position", L"absolute" );
|
||||
// appendStyleProperty( style, L"position", L"static" );
|
||||
}
|
||||
else
|
||||
{
|
||||
appendStylePropertyFirst( style, L"position", L"absolute" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( shape->fFlipH )
|
||||
{
|
||||
appendStyleProperty( &style, L"flip", L"x" );
|
||||
}
|
||||
|
||||
if ( shape->fFlipV )
|
||||
{
|
||||
appendStyleProperty( &style, L"flip", L"y" );
|
||||
}
|
||||
|
||||
AppendOptionsToStyle( &style, options, zIndex );
|
||||
|
||||
return style;
|
||||
}
|
||||
|
||||
|
||||
@ -67,6 +67,7 @@ namespace DocFileFormat
|
||||
static std::wstring mapHorizontalPositionRelative(int hRel );
|
||||
|
||||
bool m_isBullete;
|
||||
bool m_isPictureBroken;
|
||||
std::wstring m_shapeId;
|
||||
private:
|
||||
|
||||
@ -82,15 +83,16 @@ namespace DocFileFormat
|
||||
bool copyPicture( const BlipStoreEntry* bse );
|
||||
std::wstring GetTargetExt( Global::BlipType _type ) const;
|
||||
|
||||
void AppendDimensionToStyle ( std::wstring* style, const PictureDescriptor* pict, bool twistDimensions ) const;
|
||||
void AppendDimensionToStyle ( std::wstring* style, const Spa* pSpa, bool twistDimensions ) const;
|
||||
void AppendDimensionToStyle ( std::wstring* style, const ChildAnchor* anchor, bool twistDimensions ) const;
|
||||
void appendStyleProperty ( std::wstring* b, const std::wstring& propName, const std::wstring& propValue ) const;
|
||||
void AppendDimensionToStyle ( std::wstring& style, const PictureDescriptor* pict, bool twistDimensions ) const;
|
||||
void AppendDimensionToStyle ( std::wstring& style, const Spa* pSpa, bool twistDimensions ) const;
|
||||
void AppendDimensionToStyle ( std::wstring& style, const ChildAnchor* anchor, bool twistDimensions ) const;
|
||||
void appendStyleProperty ( std::wstring& style, const std::wstring& propName, const std::wstring& propValue ) const;
|
||||
void appendStylePropertyFirst( std::wstring& style, const std::wstring& propName, const std::wstring& propValue ) const;
|
||||
|
||||
std::wstring getTextboxAnchor( unsigned int anchor ) const;
|
||||
|
||||
std::wstring buildStyle ( const Shape* shape, const ChildAnchor* anchor, const std::vector<ODRAW::OfficeArtFOPTEPtr>& options, int zIndex ) const;
|
||||
void AppendOptionsToStyle ( std::wstring* style, const std::vector<ODRAW::OfficeArtFOPTEPtr>& options, int zIndex ) const;
|
||||
void AppendOptionsToStyle ( std::wstring& style, const std::vector<ODRAW::OfficeArtFOPTEPtr>& options, int zIndex ) const;
|
||||
|
||||
int UpdateFromGuides(const int val) const;
|
||||
|
||||
@ -122,7 +124,7 @@ namespace DocFileFormat
|
||||
int m_nAdjValues[8];
|
||||
std::vector<ODRAW::MSOSG> m_arrGuides;
|
||||
|
||||
bool m_isInlineShape;
|
||||
mutable bool m_isInlineShape;
|
||||
Spa* m_pSpa;
|
||||
IMapping* m_pCaller;
|
||||
BlipStoreContainer* m_pBlipStore;
|
||||
|
||||
@ -173,12 +173,16 @@ namespace DocFileFormat
|
||||
|
||||
//Lock ???
|
||||
ODRAW::ProtectionBooleanProperties *prot = dynamic_cast<ODRAW::ProtectionBooleanProperties*>(pShape->Lock.get());
|
||||
if ((prot) && (prot->fUsefLockAspectRatio && prot->fLockAspectRatio))
|
||||
if ((prot) && (prot->fUsefLockAspectRatio))
|
||||
{
|
||||
appendValueAttribute( _lock, L"aspectratio", L"t" );
|
||||
appendValueAttribute( _lock, L"aspectratio", prot->fLockAspectRatio ? L"t" : L"f" );
|
||||
}
|
||||
else
|
||||
{
|
||||
appendValueAttribute( _lock, L"aspectratio", L"t");
|
||||
}
|
||||
|
||||
if ( _lock->GetAttributeCount() > 1 )
|
||||
if ( _lock->GetAttributeCount() > 0 )
|
||||
{
|
||||
m_pXmlWriter->WriteString( _lock->GetXMLString() );
|
||||
}
|
||||
|
||||
@ -345,6 +345,14 @@
|
||||
RelativePath="..\..\DesktopEditor\common\Base64.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\XlsxSerializerCom\Writer\BinaryReader.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\XlsxSerializerCom\Reader\BinaryWriter.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ASCOfficeDocxFile2\BinWriter\BinWriters.cpp"
|
||||
>
|
||||
|
||||
@ -47,6 +47,7 @@
|
||||
#include "../odf/style_graphic_properties.h"
|
||||
|
||||
#include "docx_package.h"
|
||||
#include "xlsx_package.h"
|
||||
#include "oox_rels.h"
|
||||
#include "logging.h"
|
||||
|
||||
@ -130,7 +131,7 @@ text_tracked_context::_state & text_tracked_context::get_tracked_change(std::wst
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------
|
||||
docx_conversion_context::docx_conversion_context(odf_reader::odf_document * OdfDocument) :
|
||||
docx_conversion_context::docx_conversion_context(odf_reader::odf_document * _odf_document) :
|
||||
last_dump_page_properties_ (true),
|
||||
next_dump_page_properties_ (false),
|
||||
page_break_ (false),
|
||||
@ -152,11 +153,13 @@ docx_conversion_context::docx_conversion_context(odf_reader::odf_document * OdfD
|
||||
delayed_converting_ (false),
|
||||
process_headers_footers_ (false),
|
||||
process_comment_ (false),
|
||||
mediaitems_ (OdfDocument->get_folder() ),
|
||||
math_context_ (OdfDocument->odf_context().fontContainer(), false),
|
||||
odf_document_ (OdfDocument)
|
||||
odf_document_ (_odf_document),
|
||||
math_context_ (_odf_document->odf_context().fontContainer(), false)
|
||||
{
|
||||
streams_man_ = streams_man::create(temp_stream_);
|
||||
mediaitems_ = boost::make_shared<mediaitems>(odf_document_->get_folder());
|
||||
chart_drawing_handle_ = boost::make_shared<xlsx_drawing_context_handle>(mediaitems_);
|
||||
|
||||
streams_man_ = streams_man::create(temp_stream_);
|
||||
}
|
||||
docx_conversion_context::~docx_conversion_context()
|
||||
{
|
||||
@ -167,7 +170,7 @@ void docx_conversion_context::set_output_document(package::docx_document * docum
|
||||
}
|
||||
void docx_conversion_context::set_font_directory(std::wstring pathFonts)
|
||||
{
|
||||
mediaitems_.set_font_directory(pathFonts);
|
||||
mediaitems_->set_font_directory(pathFonts);
|
||||
}
|
||||
std::wstring styles_map::get(const std::wstring & Name, odf_types::style_family::type Type)
|
||||
{
|
||||
@ -685,11 +688,14 @@ void docx_conversion_context::end_document()
|
||||
{
|
||||
output_stream() << L"</w:document>";
|
||||
|
||||
output_document_->get_word_files().set_document ( package::simple_element::create(L"document.xml", document_xml_.str()) );
|
||||
output_document_->get_word_files().set_document ( package::simple_element::create(L"document.xml", document_xml_.str()) );
|
||||
output_document_->get_word_files().set_settings ( package::simple_element::create(L"settings.xml", dump_settings_document()));
|
||||
output_document_->get_word_files().set_media ( mediaitems_);
|
||||
output_document_->get_word_files().set_comments ( comments_context_);
|
||||
output_document_->get_word_files().set_headers_footers( headers_footers_);
|
||||
output_document_->get_word_files().set_headers_footers( headers_footers_);
|
||||
|
||||
package::xl_drawings_ptr drawings = package::xl_drawings::create(chart_drawing_handle_->content());
|
||||
output_document_->get_word_files().set_drawings(drawings);
|
||||
|
||||
package::content_types_file & content_file_ = output_document_->get_content_types_file();
|
||||
content_file_.set_media( mediaitems_);
|
||||
@ -1828,7 +1834,7 @@ namespace
|
||||
//слить если есть mediaitems, добавить релсы и обнулить их для основного документа.
|
||||
rels internal_rels;
|
||||
|
||||
Context.get_mediaitems().dump_rels(internal_rels);
|
||||
Context.get_mediaitems()->dump_rels(internal_rels);
|
||||
Context.dump_hyperlinks(internal_rels, hyperlinks::document_place);
|
||||
|
||||
Context.get_headers_footers().add(styleName, dbgStr, type, internal_rels);
|
||||
|
||||
@ -42,6 +42,7 @@
|
||||
#include "docx_table_context.h"
|
||||
#include "oox_conversion_context.h"
|
||||
#include "oox_chart_context.h"
|
||||
#include "xlsx_drawing_context.h"
|
||||
|
||||
#include "headers_footers.h"
|
||||
#include "hyperlinks.h"
|
||||
@ -734,7 +735,7 @@ class docx_conversion_context : boost::noncopyable
|
||||
public:
|
||||
enum NoteType { noNote, footNote, footNoteRefSet, endNote, endNoteRefSet };
|
||||
|
||||
docx_conversion_context(odf_reader::odf_document * OdfDocument);
|
||||
docx_conversion_context(odf_reader::odf_document * _odf_document);
|
||||
~docx_conversion_context();
|
||||
|
||||
void set_output_document (package::docx_document * document);
|
||||
@ -887,7 +888,7 @@ public:
|
||||
|
||||
styles_map * get_style_map() { return &styles_map_; }
|
||||
|
||||
mediaitems & get_mediaitems() {return mediaitems_;}
|
||||
mediaitems_ptr & get_mediaitems() {return mediaitems_;}
|
||||
styles_context & get_styles_context() { return styles_context_; }
|
||||
drawing_context & get_drawing_context() { return drawing_context_; }
|
||||
comments_context & get_comments_context() { return comments_context_; }
|
||||
@ -897,8 +898,9 @@ public:
|
||||
text_tracked_context& get_text_tracked_context(){ return text_tracked_context_; }
|
||||
forms_context & get_forms_context() { return forms_context_; }
|
||||
tabs_context & get_tabs_context() { return tabs_context_;}
|
||||
table_content_context & get_table_content_context() { return table_content_context_;}
|
||||
|
||||
table_content_context & get_table_content_context() { return table_content_context_;}
|
||||
xlsx_drawing_context_handle_ptr & get_chart_drawing_handle() { return chart_drawing_handle_;}
|
||||
|
||||
void set_drawing_text_props (const std::wstring &props);
|
||||
|
||||
@ -985,6 +987,8 @@ private:
|
||||
std::wstringstream settings_xml_;
|
||||
std::wstringstream meta_xml_;
|
||||
|
||||
xlsx_drawing_context_handle_ptr chart_drawing_handle_;
|
||||
|
||||
styles_context styles_context_;
|
||||
math_context math_context_;
|
||||
drawing_context drawing_context_;
|
||||
@ -1007,7 +1011,7 @@ private:
|
||||
std::vector<odf_reader::_property> settings_properties_;
|
||||
|
||||
hyperlinks hyperlinks_;
|
||||
mediaitems mediaitems_;
|
||||
mediaitems_ptr mediaitems_;
|
||||
std::vector<oox_chart_context_ptr> charts_;
|
||||
headers_footers headers_footers_;
|
||||
|
||||
|
||||
@ -102,7 +102,11 @@ void word_files::write(const std::wstring & RootPath)
|
||||
{
|
||||
embeddings_->write( path );
|
||||
}
|
||||
|
||||
if (drawings_)
|
||||
{
|
||||
drawings_->set_main_document(get_main_document());
|
||||
drawings_->write( path );
|
||||
}
|
||||
if (headers_footers_)
|
||||
{
|
||||
headers_footers_->write( path );
|
||||
@ -140,22 +144,22 @@ void word_files::write(const std::wstring & RootPath)
|
||||
|
||||
void word_files::update_rels(docx_conversion_context & Context)
|
||||
{
|
||||
Context.get_mediaitems().dump_rels(rels_files_.get_rel_file()->get_rels());
|
||||
Context.get_mediaitems()->dump_rels(rels_files_.get_rel_file()->get_rels());
|
||||
|
||||
Context.dump_hyperlinks (rels_files_.get_rel_file()->get_rels(), hyperlinks::document_place);
|
||||
Context.dump_headers_footers(rels_files_.get_rel_file()->get_rels());
|
||||
Context.dump_notes (rels_files_.get_rel_file()->get_rels());
|
||||
}
|
||||
|
||||
void word_files::set_media(mediaitems & _Mediaitems)
|
||||
void word_files::set_media(mediaitems_ptr & _mediaitems)
|
||||
{
|
||||
if (_Mediaitems.count_image + _Mediaitems.count_media > 0)
|
||||
if (_mediaitems->count_image + _mediaitems->count_media > 0)
|
||||
{
|
||||
media_ = element_ptr( new media(_Mediaitems, _Mediaitems.applicationFonts()) );
|
||||
media_ = element_ptr( new media(_mediaitems, _mediaitems->applicationFonts()) );
|
||||
}
|
||||
if (_Mediaitems.count_object > 0)
|
||||
if (_mediaitems->count_object > 0)
|
||||
{
|
||||
embeddings_ = element_ptr( new embeddings(_Mediaitems) );
|
||||
embeddings_ = element_ptr( new embeddings(_mediaitems) );
|
||||
embeddings_->set_main_document( get_main_document() );
|
||||
}
|
||||
}
|
||||
@ -195,6 +199,10 @@ void word_files::add_jsaProject(const std::string &content)
|
||||
{
|
||||
jsaProject_ = package::simple_element::create(L"jsaProject.bin", content);
|
||||
}
|
||||
void word_files::set_drawings(element_ptr Element)
|
||||
{
|
||||
drawings_ = Element;
|
||||
}
|
||||
void word_files::set_headers_footers(headers_footers & HeadersFooters)
|
||||
{
|
||||
headers_footers_elements * elm = new headers_footers_elements(HeadersFooters);
|
||||
|
||||
@ -137,10 +137,11 @@ public:
|
||||
void set_numbering (element_ptr Element);
|
||||
void set_settings (element_ptr Element);
|
||||
bool has_numbering ();
|
||||
void set_media (mediaitems & mediaitems_);
|
||||
void set_media (mediaitems_ptr & mediaitems_);
|
||||
void set_headers_footers(headers_footers & HeadersFooters);
|
||||
void set_notes (notes_context & notesContext);
|
||||
void set_comments (comments_context & commentsContext);
|
||||
void set_drawings (element_ptr Element);
|
||||
|
||||
void add_charts(chart_content_ptr chart);
|
||||
void add_jsaProject(const std::string &content);
|
||||
@ -163,6 +164,7 @@ private:
|
||||
element_ptr settings_;
|
||||
element_ptr comments_;
|
||||
element_ptr jsaProject_;
|
||||
element_ptr drawings_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -62,6 +62,9 @@ struct drawing_object_description
|
||||
double anchor_x_;
|
||||
double anchor_y_;
|
||||
|
||||
_CP_OPT(_INT32) owner_cx_;
|
||||
_CP_OPT(_INT32) owner_cy_;
|
||||
|
||||
_action_desc action_;
|
||||
std::vector<_hlink_desc> hlinks_;
|
||||
|
||||
|
||||
@ -101,6 +101,7 @@ void mediaitems::set_font_directory(std::wstring pathFonts)
|
||||
if (applicationFonts_)
|
||||
applicationFonts_->InitializeFromFolder(pathFonts);
|
||||
}
|
||||
|
||||
std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, bool & isInternal)
|
||||
{
|
||||
std::wstring ref;
|
||||
@ -329,6 +330,10 @@ void mediaitems::dump_rels(rels & Rels)
|
||||
{
|
||||
for (size_t i = 0; i < items_.size(); i++)
|
||||
{
|
||||
if ( items_[i].type == typeUnknown ) continue;
|
||||
if ( items_[i].type == typeShape ) continue;
|
||||
if ( items_[i].type == typeGroupShape ) continue;
|
||||
|
||||
if (items_[i].count_used >= items_[i].count_add) continue; // уже использовали этот релс выше(колонтитул ....)
|
||||
|
||||
Rels.add( relationship(
|
||||
@ -338,7 +343,7 @@ void mediaitems::dump_rels(rels & Rels)
|
||||
items_[i].mediaInternal ? L"" : L"External" )
|
||||
);
|
||||
items_[i].count_used++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -137,6 +137,7 @@ public:
|
||||
|
||||
return typeMedia;
|
||||
}
|
||||
|
||||
private:
|
||||
std::wstring create_file_name (const std::wstring & uri, RelsType type, bool & isInternal, size_t Num);
|
||||
std::wstring detectImageFileExtension (const std::wstring &fileName);
|
||||
@ -147,6 +148,7 @@ private:
|
||||
NSFonts::IApplicationFonts *applicationFonts_;
|
||||
};
|
||||
|
||||
typedef _CP_PTR(mediaitems) mediaitems_ptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -122,6 +122,7 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
|
||||
oox_chart_shape shape;
|
||||
_CP_OPT(bool) boolVal;
|
||||
_CP_OPT(std::wstring) strVal;
|
||||
_CP_OPT(double) doubleVal;
|
||||
|
||||
oox_title title;
|
||||
title.set_content(content_.title_);//todo нужно задать понармальному layout
|
||||
@ -146,7 +147,17 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
|
||||
CP_XML_ATTR(L"val", "minMax");//default
|
||||
}
|
||||
}
|
||||
odf_reader::GetProperty(content_.properties_,L"logarithmic",boolVal);
|
||||
odf_reader::GetProperty(content_.properties_,L"maximum", doubleVal);
|
||||
if (doubleVal)
|
||||
{
|
||||
CP_XML_ATTR(L"c:max", *doubleVal);
|
||||
}
|
||||
odf_reader::GetProperty(content_.properties_,L"minimum", doubleVal);
|
||||
if (doubleVal)
|
||||
{
|
||||
CP_XML_ATTR(L"c:min", *doubleVal);
|
||||
}
|
||||
odf_reader::GetProperty(content_.properties_,L"logarithmic", boolVal);
|
||||
if ((boolVal == true) && (boolVal.get()==true))
|
||||
{
|
||||
CP_XML_NODE(L"c:logBase")
|
||||
|
||||
@ -53,7 +53,7 @@ public:
|
||||
std::wstring drawingId_;
|
||||
};
|
||||
|
||||
oox_chart_context::oox_chart_context(mediaitems & m, std::wstring name) :
|
||||
oox_chart_context::oox_chart_context(mediaitems_ptr & m, std::wstring name) :
|
||||
impl_(new oox_chart_context::Impl( name)), mediaitems_(m)
|
||||
{
|
||||
|
||||
@ -65,7 +65,7 @@ void oox_chart_context::reset_fill(oox::_oox_fill &f)
|
||||
{
|
||||
bool isInternal = true;
|
||||
std::wstring ref;
|
||||
f.bitmap->rId = mediaitems_.add_or_find(f.bitmap->xlink_href_, typeImage, isInternal, ref);
|
||||
f.bitmap->rId = mediaitems_->add_or_find(f.bitmap->xlink_href_, typeImage, isInternal, ref);
|
||||
|
||||
rels_.push_back(_rel(isInternal, f.bitmap->rId, ref, typeImage));
|
||||
}
|
||||
@ -75,9 +75,15 @@ void oox_chart_context::set_externalData(const std::wstring & href)
|
||||
bool isInternal = true;
|
||||
std::wstring href_out;
|
||||
|
||||
externalDataId_ = mediaitems_.add_or_find(href, typeMsObject, isInternal, href_out);
|
||||
externalDataId_ = mediaitems_->add_or_find(href, typeMsObject, isInternal, href_out);
|
||||
rels_.push_back(_rel(isInternal, externalDataId_, href_out, typeMsObject));
|
||||
}
|
||||
void oox_chart_context::set_userShapes(std::pair<std::wstring, std::wstring> &link)
|
||||
{
|
||||
bool isInternal = true;
|
||||
userShapesId_ = link.second;
|
||||
rels_.push_back(_rel(isInternal, userShapesId_, link.first, typeChartUserShapes));
|
||||
}
|
||||
std::wostream & oox_chart_context::chartData()
|
||||
{
|
||||
return impl_->chartData_;
|
||||
@ -116,6 +122,15 @@ void oox_chart_context::dump_rels(rels & Rels)
|
||||
(r.is_internal ? L"" : L"External"))
|
||||
);
|
||||
}
|
||||
else if (r.type == typeChartUserShapes)
|
||||
{
|
||||
Rels.add(relationship(
|
||||
r.rid,
|
||||
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartUserShapes",
|
||||
r.is_internal ? std::wstring(L"../drawings/") + r.ref : r.ref,
|
||||
(r.is_internal ? L"" : L"External"))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -226,6 +241,13 @@ void oox_chart_context::serialize(std::wostream & strm)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (userShapesId_.empty() == false)
|
||||
{
|
||||
CP_XML_NODE(L"c:userShapes")
|
||||
{
|
||||
CP_XML_ATTR(L"r:id", userShapesId_);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ typedef _CP_PTR(oox_chart_context) oox_chart_context_ptr;
|
||||
class oox_chart_context
|
||||
{
|
||||
public:
|
||||
oox_chart_context(mediaitems & mediaitems_, std::wstring name);
|
||||
oox_chart_context(mediaitems_ptr & mediaitems_, std::wstring name);
|
||||
~oox_chart_context();
|
||||
|
||||
std::wostream & chartData();
|
||||
@ -83,6 +83,8 @@ public:
|
||||
}
|
||||
}
|
||||
void set_externalData(const std::wstring & href);
|
||||
void set_userShapes(std::pair<std::wstring, std::wstring> &link);
|
||||
|
||||
void add_chart(int type)
|
||||
{
|
||||
plot_area_.add_chart(type);
|
||||
@ -128,7 +130,7 @@ private:
|
||||
class Impl;
|
||||
_CP_SCOPED_PTR(Impl) impl_;
|
||||
|
||||
mediaitems &mediaitems_;
|
||||
mediaitems_ptr mediaitems_;
|
||||
std::vector<_rel> rels_;
|
||||
|
||||
cpdoccore::oox::oox_title title_;
|
||||
@ -137,6 +139,7 @@ private:
|
||||
|
||||
std::wstring pivot_source_;
|
||||
std::wstring externalDataId_;
|
||||
std::wstring userShapesId_;
|
||||
|
||||
std::vector<odf_reader::_property> graphic_properties_;
|
||||
_oox_fill fill_;
|
||||
|
||||
@ -375,7 +375,7 @@ void _oox_drawing::serialize_bodyPr(std::wostream & strm, const std::wstring & n
|
||||
{
|
||||
CP_XML_NODE(L"a:spAutoFit");
|
||||
}
|
||||
if ((bFitToSize) && (*bFitToSize))
|
||||
else if ((bFitToSize) && (*bFitToSize))
|
||||
{
|
||||
CP_XML_NODE(L"a:normAutofit");
|
||||
//{
|
||||
|
||||
@ -173,6 +173,26 @@ bool content_types_file::add_or_find_override(const std::wstring & fileName)
|
||||
|
||||
return true;
|
||||
}
|
||||
void content_types_file::set_media(mediaitems_ptr & _Mediaitems)
|
||||
{
|
||||
std::vector<mediaitems::item> & items_ = _Mediaitems->items();
|
||||
for (size_t i = 0; i < items_.size(); i++)
|
||||
{
|
||||
if ((items_[i].type == typeImage ||
|
||||
items_[i].type == typeMedia ||
|
||||
items_[i].type == typeVideo ||
|
||||
items_[i].type == typeAudio) && items_[i].mediaInternal)
|
||||
{
|
||||
int n = items_[i].outputName.rfind(L".");
|
||||
if (n > 0)
|
||||
{
|
||||
add_or_find_default(items_[i].outputName.substr(n + 1, items_[i].outputName.length() - n));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void content_types_file::set_media(mediaitems & _Mediaitems)
|
||||
{
|
||||
@ -349,7 +369,7 @@ void docProps_files::write(const std::wstring & RootPath)
|
||||
////////////
|
||||
|
||||
|
||||
media::media(mediaitems & _Mediaitems, NSFonts::IApplicationFonts *pAppFonts) : mediaitems_(_Mediaitems), appFonts_(pAppFonts)
|
||||
media::media(mediaitems_ptr & _mediaitems, NSFonts::IApplicationFonts *pAppFonts) : mediaItems_(_mediaitems), appFonts_(pAppFonts)
|
||||
{
|
||||
}
|
||||
|
||||
@ -358,7 +378,8 @@ void media::write(const std::wstring & RootPath)
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"media";
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
mediaitems::items_array & items = mediaitems_.items();
|
||||
mediaitems::items_array & items = mediaItems_->items();
|
||||
|
||||
for (size_t i = 0; i < items.size(); i++ )
|
||||
{
|
||||
if (items[i].mediaInternal && items[i].valid && ( items[i].type == typeImage ||
|
||||
@ -381,7 +402,7 @@ void media::write(const std::wstring & RootPath)
|
||||
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------
|
||||
charts::charts(mediaitems & _ChartsItems) : chartsitems_(_ChartsItems)
|
||||
charts::charts(mediaitems_ptr & _chartsItems) : chartsItems_(_chartsItems)
|
||||
{
|
||||
}
|
||||
|
||||
@ -390,7 +411,7 @@ void charts::write(const std::wstring & RootPath)
|
||||
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------------------------
|
||||
embeddings::embeddings(mediaitems & _EmbeddingsItems) : embeddingsitems_(_EmbeddingsItems)
|
||||
embeddings::embeddings(mediaitems_ptr & _EmbeddingsItems) : embeddingsItems_(_EmbeddingsItems)
|
||||
{
|
||||
}
|
||||
void embeddings::write(const std::wstring & RootPath)
|
||||
@ -400,7 +421,8 @@ void embeddings::write(const std::wstring & RootPath)
|
||||
|
||||
content_types_file & content_types = get_main_document()->get_content_types_file();
|
||||
|
||||
mediaitems::items_array & items = embeddingsitems_.items();
|
||||
mediaitems::items_array & items = embeddingsItems_->items();
|
||||
|
||||
for (size_t i = 0; i < items.size(); i++ )
|
||||
{
|
||||
if ( items[i].mediaInternal && items[i].valid &&
|
||||
|
||||
@ -51,6 +51,7 @@ namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
class mediaitems;
|
||||
typedef _CP_PTR(mediaitems) mediaitems_ptr;
|
||||
|
||||
namespace package {
|
||||
|
||||
@ -81,16 +82,17 @@ inline element::~element()
|
||||
class content_types_file : public element
|
||||
{
|
||||
public:
|
||||
content_types_file ();
|
||||
void write (const std::wstring & RootPath);
|
||||
bool add_or_find_default (const std::wstring & extension);
|
||||
bool add_or_find_override(const std::wstring & fileName);
|
||||
void set_media (mediaitems & _Mediaitems);
|
||||
content_type * content ();
|
||||
content_types_file ();
|
||||
void write (const std::wstring & RootPath);
|
||||
bool add_or_find_default (const std::wstring & extension);
|
||||
bool add_or_find_override(const std::wstring & fileName);
|
||||
void set_media (mediaitems & _Mediaitems);
|
||||
void set_media (mediaitems_ptr & _Mediaitems);
|
||||
content_type* content ();
|
||||
|
||||
private:
|
||||
content_type content_type_content_;
|
||||
std::wstring filename_;
|
||||
std::wstring filename_;
|
||||
};
|
||||
|
||||
class simple_element;
|
||||
@ -189,8 +191,8 @@ public:
|
||||
std::wstring str() { return content_.str(); }
|
||||
static _CP_PTR(chart_content) create();
|
||||
private:
|
||||
std::wstringstream content_;
|
||||
rels_file_ptr rels_;
|
||||
std::wstringstream content_;
|
||||
rels_file_ptr rels_;
|
||||
};
|
||||
//------------------------------------------------------------------------
|
||||
class document : public element
|
||||
@ -228,39 +230,39 @@ private:
|
||||
class media : public element
|
||||
{
|
||||
public:
|
||||
media(mediaitems & _Mediaitems, NSFonts::IApplicationFonts *pAppFonts);
|
||||
media(mediaitems_ptr & _mediaItems, NSFonts::IApplicationFonts *pAppFonts);
|
||||
|
||||
public:
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
|
||||
private:
|
||||
mediaitems & mediaitems_;
|
||||
NSFonts::IApplicationFonts * appFonts_;
|
||||
mediaitems_ptr mediaItems_;
|
||||
NSFonts::IApplicationFonts* appFonts_;
|
||||
|
||||
};
|
||||
|
||||
class charts : public element
|
||||
{
|
||||
public:
|
||||
charts(mediaitems & _ChartsItems);
|
||||
charts(mediaitems_ptr & _chartsItems);
|
||||
|
||||
public:
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
|
||||
private:
|
||||
mediaitems & chartsitems_;
|
||||
mediaitems_ptr chartsItems_;
|
||||
|
||||
};
|
||||
class embeddings : public element
|
||||
{
|
||||
public:
|
||||
embeddings(mediaitems & _EmbeddingsItems);
|
||||
embeddings(mediaitems_ptr & _embeddingsItems);
|
||||
|
||||
public:
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
|
||||
private:
|
||||
mediaitems & embeddingsitems_;
|
||||
mediaitems_ptr embeddingsItems_;
|
||||
|
||||
};
|
||||
} // namespace package
|
||||
|
||||
@ -43,6 +43,7 @@ namespace oox {
|
||||
enum RelsType
|
||||
{
|
||||
typeUnknown = 0,
|
||||
typeDefault,
|
||||
typeImage,
|
||||
typeChart,
|
||||
typeShape,
|
||||
@ -59,7 +60,8 @@ enum RelsType
|
||||
typeExternalLink,
|
||||
typeActiveX,
|
||||
typeControl,
|
||||
typeControlProps
|
||||
typeControlProps,
|
||||
typeChartUserShapes
|
||||
};
|
||||
|
||||
struct _rel
|
||||
@ -71,10 +73,10 @@ struct _rel
|
||||
type(type_)
|
||||
{}
|
||||
|
||||
bool is_internal;
|
||||
std::wstring rid;
|
||||
std::wstring ref;
|
||||
RelsType type;
|
||||
bool is_internal;
|
||||
std::wstring rid;
|
||||
std::wstring ref;
|
||||
RelsType type;
|
||||
};
|
||||
|
||||
class relationship : public xml::element_impl<relationship>
|
||||
|
||||
@ -83,7 +83,7 @@ void pptx_conversion_context::set_output_document(package::pptx_document * docum
|
||||
|
||||
void pptx_conversion_context::set_font_directory(std::wstring pathFonts)
|
||||
{
|
||||
pptx_slide_context_.get_mediaitems().set_font_directory(pathFonts);
|
||||
pptx_slide_context_.get_mediaitems()->set_font_directory(pathFonts);
|
||||
}
|
||||
|
||||
void pptx_conversion_context::process_layouts()
|
||||
|
||||
@ -133,7 +133,7 @@ public:
|
||||
|
||||
pptx_table_context & get_table_context() { return pptx_table_context_; }
|
||||
|
||||
mediaitems & get_mediaitems() { return pptx_slide_context_.get_mediaitems(); }
|
||||
mediaitems_ptr & get_mediaitems() { return pptx_slide_context_.get_mediaitems(); }
|
||||
|
||||
//void start_hyperlink(const std::wstring & styleName);
|
||||
//void end_hyperlink(std::wstring const & href);
|
||||
|
||||
@ -509,15 +509,15 @@ void ppt_files::add_notesMaster(slide_content_ptr slide)
|
||||
{
|
||||
notesMaster_files_.add_slide(slide);
|
||||
}
|
||||
void ppt_files::set_media(mediaitems & _Mediaitems)
|
||||
void ppt_files::set_media(mediaitems_ptr & _mediaitems)
|
||||
{
|
||||
if (_Mediaitems.count_image + _Mediaitems.count_media > 0)
|
||||
if (_mediaitems->count_image + _mediaitems->count_media > 0)
|
||||
{
|
||||
media_ = element_ptr( new media(_Mediaitems, _Mediaitems.applicationFonts()) );
|
||||
media_ = element_ptr( new media(_mediaitems, _mediaitems->applicationFonts()) );
|
||||
}
|
||||
if (_Mediaitems.count_object > 0)
|
||||
if (_mediaitems->count_object > 0)
|
||||
{
|
||||
embeddings_ = element_ptr( new embeddings(_Mediaitems) );
|
||||
embeddings_ = element_ptr( new embeddings(_mediaitems) );
|
||||
}
|
||||
}
|
||||
void ppt_files::set_authors_comments(pptx_xml_authors_comments_ptr & authors_comments)
|
||||
|
||||
@ -217,7 +217,7 @@ public:
|
||||
void add_notes (slide_content_ptr sheet);
|
||||
void add_notesMaster(slide_content_ptr sheet);
|
||||
|
||||
void set_media(mediaitems & _Mediaitems);
|
||||
void set_media(mediaitems_ptr & _mediaitems);
|
||||
void add_charts(chart_content_ptr chart);
|
||||
void add_theme (pptx_xml_theme_ptr theme);
|
||||
|
||||
|
||||
@ -65,8 +65,10 @@ public:
|
||||
bool onClick;
|
||||
};
|
||||
|
||||
Impl(const std::wstring & odfPacket) : mediaitems_(odfPacket), odfPacket_(odfPacket)
|
||||
Impl(const std::wstring & _odfPacket) : odfPacket_(_odfPacket)
|
||||
{
|
||||
mediaitems_ = boost::make_shared<mediaitems>(odfPacket_);
|
||||
|
||||
clear();
|
||||
}
|
||||
|
||||
@ -88,7 +90,7 @@ public:
|
||||
{
|
||||
pptx_drawings_->add(isInternal, rid, ref, type);
|
||||
}
|
||||
mediaitems & get_mediaitems() { return mediaitems_; }
|
||||
mediaitems_ptr & get_mediaitems() { return mediaitems_; }
|
||||
|
||||
bool empty() const
|
||||
{
|
||||
@ -138,7 +140,7 @@ private:
|
||||
void process_media (drawing_object_description& obj, _pptx_drawing & drawing);
|
||||
|
||||
size_t rId_;
|
||||
mediaitems mediaitems_;
|
||||
mediaitems_ptr mediaitems_;
|
||||
pptx_drawings_ptr pptx_drawings_;
|
||||
pptx_drawings_ptr pptx_notes_drawings_;
|
||||
};
|
||||
@ -357,7 +359,7 @@ void pptx_slide_context::add_background(_oox_fill & fill)
|
||||
bool isMediaInternal = false;
|
||||
std::wstring ref;
|
||||
|
||||
fill.bitmap->rId = get_mediaitems().add_or_find(fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
|
||||
fill.bitmap->rId = get_mediaitems()->add_or_find(fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
|
||||
add_rels(isMediaInternal, fill.bitmap->rId, ref, typeImage);
|
||||
}
|
||||
impl_->background_fill_ = fill;
|
||||
@ -421,7 +423,7 @@ void pptx_slide_context::set_link(std::wstring link, RelsType typeRels)
|
||||
{
|
||||
bool isMediaInternal = true;
|
||||
|
||||
impl_->object_description_.action_.hSoundId = get_mediaitems().add_or_find(link, typeAudio, isMediaInternal, impl_->object_description_.action_.hSoundRef);
|
||||
impl_->object_description_.action_.hSoundId = get_mediaitems()->add_or_find(link, typeAudio, isMediaInternal, impl_->object_description_.action_.hSoundRef);
|
||||
impl_->add_additional_rels(isMediaInternal, impl_->object_description_.action_.hSoundId, impl_->object_description_.action_.hSoundRef, typeAudio);
|
||||
}
|
||||
else
|
||||
@ -562,7 +564,7 @@ void pptx_slide_context::Impl::process_image(drawing_object_description& obj, _p
|
||||
}
|
||||
|
||||
std::wstring fileName = odfPacket_ + FILE_SEPARATOR_STR + obj.xlink_href_;
|
||||
drawing.fill.bitmap->bCrop = odf_reader::parse_clipping(obj.clipping_string_, fileName, drawing.fill.bitmap->cropRect, get_mediaitems().applicationFonts());
|
||||
drawing.fill.bitmap->bCrop = odf_reader::parse_clipping(obj.clipping_string_, fileName, drawing.fill.bitmap->cropRect, get_mediaitems()->applicationFonts());
|
||||
drawing.fill.bitmap->bStretch = true;
|
||||
|
||||
if ((sColorMode) && (*sColorMode == L"greyscale"))
|
||||
@ -572,7 +574,7 @@ void pptx_slide_context::Impl::process_image(drawing_object_description& obj, _p
|
||||
std::wstring ref;/// это ссылка на выходной внешний объект
|
||||
bool isMediaInternal = false;
|
||||
|
||||
drawing.fill.bitmap->rId = get_mediaitems().add_or_find(obj.xlink_href_, typeImage, isMediaInternal, ref);
|
||||
drawing.fill.bitmap->rId = get_mediaitems()->add_or_find(obj.xlink_href_, typeImage, isMediaInternal, ref);
|
||||
drawing.fill.bitmap->isInternal = isMediaInternal;
|
||||
|
||||
if (drawing.type == typeShape)
|
||||
@ -580,7 +582,7 @@ void pptx_slide_context::Impl::process_image(drawing_object_description& obj, _p
|
||||
add_additional_rels(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage);//собственно это не объект, а доп рел и ref объекта
|
||||
|
||||
isMediaInternal = true;
|
||||
std::wstring rId = get_mediaitems().add_or_find(L"", typeShape, isMediaInternal, ref);
|
||||
std::wstring rId = get_mediaitems()->add_or_find(L"", typeShape, isMediaInternal, ref);
|
||||
|
||||
add_drawing(drawing, isMediaInternal, rId, ref, typeShape);//объект
|
||||
|
||||
@ -595,7 +597,7 @@ void pptx_slide_context::Impl::process_chart(drawing_object_description & obj, _
|
||||
std::wstring ref;
|
||||
bool isMediaInternal = true;
|
||||
|
||||
drawing.objectId = get_mediaitems().add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
|
||||
drawing.objectId = get_mediaitems()->add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
|
||||
|
||||
add_drawing(drawing, isMediaInternal, drawing.objectId, ref, drawing.type);
|
||||
}
|
||||
@ -604,7 +606,7 @@ void pptx_slide_context::Impl::process_table(drawing_object_description & obj, _
|
||||
{
|
||||
std::wstring ref;
|
||||
bool isMediaInternal = true;
|
||||
std::wstring rId = get_mediaitems().add_or_find(L"", obj.type_, isMediaInternal, ref);
|
||||
std::wstring rId = get_mediaitems()->add_or_find(L"", obj.type_, isMediaInternal, ref);
|
||||
|
||||
add_drawing(drawing, isMediaInternal, rId, ref, drawing.type);
|
||||
|
||||
@ -619,12 +621,12 @@ void pptx_slide_context::Impl::process_shape(drawing_object_description & obj, _
|
||||
|
||||
if (drawing.fill.bitmap)
|
||||
{
|
||||
drawing.fill.bitmap->rId = get_mediaitems().add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
|
||||
drawing.fill.bitmap->rId = get_mediaitems()->add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
|
||||
|
||||
add_additional_rels(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage);
|
||||
}
|
||||
|
||||
std::wstring rId = get_mediaitems().add_or_find(L"", typeShape, isMediaInternal, ref);
|
||||
std::wstring rId = get_mediaitems()->add_or_find(L"", typeShape, isMediaInternal, ref);
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
_CP_OPT(std::wstring) sPlaceHolderType;
|
||||
@ -647,7 +649,7 @@ void pptx_slide_context::Impl::process_object(drawing_object_description& obj, _
|
||||
std::wstring ref, ref_image;
|
||||
bool isMediaInternal = true, isMediaInternal_image = true;
|
||||
|
||||
drawing.objectId = get_mediaitems().add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
|
||||
drawing.objectId = get_mediaitems()->add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
|
||||
drawing.objectProgId = obj.descriptor_;
|
||||
|
||||
if (!drawing.fill.bitmap)
|
||||
@ -658,7 +660,7 @@ void pptx_slide_context::Impl::process_object(drawing_object_description& obj, _
|
||||
_image_file_::GenerateZeroImage(odfPacket_ + FILE_SEPARATOR_STR + L"zero.png");
|
||||
}
|
||||
|
||||
drawing.fill.bitmap->rId = get_mediaitems().add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal_image, ref_image);
|
||||
drawing.fill.bitmap->rId = get_mediaitems()->add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal_image, ref_image);
|
||||
add_additional_rels(isMediaInternal_image, drawing.fill.bitmap->rId, ref_image, typeImage);
|
||||
|
||||
add_drawing(drawing, isMediaInternal, drawing.objectId, ref, drawing.type);
|
||||
@ -670,7 +672,7 @@ void pptx_slide_context::Impl::process_media(drawing_object_description& obj, _p
|
||||
|
||||
drawing.type = mediaitems::detectMediaType(obj.xlink_href_); //reset from Media to Audio, Video, ... QuickTime? AudioCD? ...
|
||||
|
||||
drawing.objectId = get_mediaitems().add_or_find(obj.xlink_href_, drawing.type, isMediaInternal, ref);
|
||||
drawing.objectId = get_mediaitems()->add_or_find(obj.xlink_href_, drawing.type, isMediaInternal, ref);
|
||||
drawing.extId = L"ext" + drawing.objectId;
|
||||
drawing.extExternal = !isMediaInternal;
|
||||
|
||||
@ -681,7 +683,7 @@ void pptx_slide_context::Impl::process_media(drawing_object_description& obj, _p
|
||||
|
||||
_image_file_::GenerateZeroImage(odfPacket_ + FILE_SEPARATOR_STR + L"zero.png");
|
||||
}
|
||||
drawing.fill.bitmap->rId = get_mediaitems().add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal_image, ref_image);
|
||||
drawing.fill.bitmap->rId = get_mediaitems()->add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal_image, ref_image);
|
||||
add_additional_rels(isMediaInternal_image, drawing.fill.bitmap->rId, ref_image, typeImage);
|
||||
|
||||
add_drawing(drawing, false, drawing.objectId, L"NULL", drawing.type);
|
||||
@ -714,7 +716,7 @@ void pptx_slide_context::dump_rels(rels & Rels)
|
||||
impl_->get_drawings()->dump_rels(Rels);
|
||||
}
|
||||
|
||||
mediaitems & pptx_slide_context::get_mediaitems()
|
||||
mediaitems_ptr & pptx_slide_context::get_mediaitems()
|
||||
{
|
||||
return impl_->get_mediaitems();
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ public:
|
||||
|
||||
void process_drawings();
|
||||
|
||||
mediaitems & get_mediaitems();
|
||||
mediaitems_ptr & get_mediaitems();
|
||||
|
||||
void add_background (_oox_fill & fill);
|
||||
|
||||
|
||||
@ -390,7 +390,7 @@ void oox_serialize_tcPr(std::wostream & strm, std::vector<const odf_reader::styl
|
||||
{
|
||||
bool isMediaInternal = true;
|
||||
std::wstring ref;
|
||||
fill.bitmap->rId = Context.get_slide_context().get_mediaitems().add_or_find(fill.bitmap->xlink_href_, oox::typeImage, isMediaInternal, ref);
|
||||
fill.bitmap->rId = Context.get_slide_context().get_mediaitems()->add_or_find(fill.bitmap->xlink_href_, oox::typeImage, isMediaInternal, ref);
|
||||
Context.get_slide_context().add_rels(isMediaInternal, fill.bitmap->rId, ref, oox::typeImage);
|
||||
}
|
||||
oox::oox_serialize_fill(CP_XML_STREAM(), fill);
|
||||
|
||||
@ -48,17 +48,17 @@ std::wostream & operator << (std::wostream & strm, xlsx_drawing_position::type_t
|
||||
}
|
||||
|
||||
}
|
||||
void xlsx_serialize_text(std::wostream & strm, _xlsx_drawing & val)
|
||||
void xlsx_serialize_text(std::wostream & strm, _xlsx_drawing & val, const std::wstring & ns)
|
||||
{
|
||||
_CP_OPT(std::wstring) strTextContent;
|
||||
odf_reader::GetProperty ( val.additional ,L"text-content", strTextContent);
|
||||
odf_reader::GetProperty ( val.additional, L"text-content", strTextContent);
|
||||
|
||||
if (!strTextContent)return;
|
||||
if (strTextContent->empty())return;
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"xdr:txBody")
|
||||
CP_XML_NODE(ns + L":txBody")
|
||||
{
|
||||
val.serialize_bodyPr(CP_XML_STREAM());
|
||||
|
||||
@ -71,28 +71,28 @@ void xlsx_serialize_text(std::wostream & strm, _xlsx_drawing & val)
|
||||
}
|
||||
}
|
||||
|
||||
void xlsx_drawing_position::serialize(std::wostream & strm, std::wstring ns)
|
||||
void xlsx_drawing_position::serialize(std::wostream & strm, const std::wstring & ns)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE( ns + (type == xlsx_drawing_position::from ? L"from" : L"to") )
|
||||
CP_XML_NODE( ns + (ns.empty() ? L"" : L":") + (type == xlsx_drawing_position::from ? L"from" : L"to") )
|
||||
{
|
||||
CP_XML_NODE(L"xdr:col")
|
||||
CP_XML_NODE(ns + L":col")
|
||||
{
|
||||
CP_XML_CONTENT(position.col);
|
||||
}
|
||||
|
||||
CP_XML_NODE(L"xdr:colOff")
|
||||
CP_XML_NODE(ns + L":colOff")
|
||||
{
|
||||
CP_XML_CONTENT(static_cast<size_t>(position.colOff));
|
||||
}
|
||||
|
||||
CP_XML_NODE(L"xdr:row")
|
||||
CP_XML_NODE(ns + L":row")
|
||||
{
|
||||
CP_XML_CONTENT(position.row);
|
||||
}
|
||||
|
||||
CP_XML_NODE(L"xdr:rowOff")
|
||||
CP_XML_NODE(ns + L":rowOff")
|
||||
{
|
||||
CP_XML_CONTENT(static_cast<size_t>(position.rowOff));
|
||||
}
|
||||
@ -100,15 +100,15 @@ void xlsx_drawing_position::serialize(std::wostream & strm, std::wstring ns)
|
||||
}
|
||||
}
|
||||
|
||||
void xlsx_serialize_image(std::wostream & strm, _xlsx_drawing & val)
|
||||
void xlsx_serialize_image(std::wostream & strm, _xlsx_drawing & val, const std::wstring & ns)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"xdr:pic")
|
||||
CP_XML_NODE(ns + L":pic")
|
||||
{
|
||||
CP_XML_NODE(L"xdr:nvPicPr")
|
||||
CP_XML_NODE(ns + L":nvPicPr")
|
||||
{
|
||||
CP_XML_NODE(L"xdr:cNvPr")
|
||||
CP_XML_NODE(ns + L":cNvPr")
|
||||
{
|
||||
CP_XML_ATTR(L"id", val.id);
|
||||
CP_XML_ATTR(L"name", val.name);
|
||||
@ -116,7 +116,7 @@ void xlsx_serialize_image(std::wostream & strm, _xlsx_drawing & val)
|
||||
oox_serialize_action(CP_XML_STREAM(), val.action);
|
||||
|
||||
}
|
||||
CP_XML_NODE(L"xdr:cNvPicPr")
|
||||
CP_XML_NODE(ns + L":cNvPicPr")
|
||||
{
|
||||
if (val.fill.bitmap->bCrop)
|
||||
{
|
||||
@ -128,7 +128,7 @@ void xlsx_serialize_image(std::wostream & strm, _xlsx_drawing & val)
|
||||
val.fill.bitmap->name_space = L"xdr";
|
||||
oox_serialize_fill(CP_XML_STREAM(), val.fill);
|
||||
|
||||
CP_XML_NODE(L"xdr:spPr")
|
||||
CP_XML_NODE(ns + L":spPr")
|
||||
{
|
||||
val.serialize_xfrm(CP_XML_STREAM());
|
||||
|
||||
@ -139,20 +139,20 @@ void xlsx_serialize_image(std::wostream & strm, _xlsx_drawing & val)
|
||||
}
|
||||
oox_serialize_ln(CP_XML_STREAM(), val.additional);
|
||||
}
|
||||
xlsx_serialize_text(CP_XML_STREAM(), val);
|
||||
xlsx_serialize_text(CP_XML_STREAM(), val, ns);
|
||||
}
|
||||
} // CP_XML_WRITER
|
||||
}
|
||||
|
||||
void xlsx_serialize_shape(std::wostream & strm, _xlsx_drawing & val)
|
||||
void xlsx_serialize_shape(std::wostream & strm, _xlsx_drawing & val, const std::wstring & ns)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"xdr:sp")
|
||||
CP_XML_NODE(ns + L":sp")
|
||||
{
|
||||
CP_XML_NODE(L"xdr:nvSpPr")
|
||||
CP_XML_NODE(ns + L":nvSpPr")
|
||||
{
|
||||
CP_XML_NODE(L"xdr:cNvPr")
|
||||
CP_XML_NODE(ns + L":cNvPr")
|
||||
{
|
||||
CP_XML_ATTR(L"id", val.id);//числовое значение val.rId
|
||||
|
||||
@ -160,12 +160,12 @@ void xlsx_serialize_shape(std::wostream & strm, _xlsx_drawing & val)
|
||||
|
||||
oox_serialize_action(CP_XML_STREAM(), val.action);
|
||||
}
|
||||
CP_XML_NODE(L"xdr:cNvSpPr")//non visual properies (собственно тока 1 там)
|
||||
CP_XML_NODE(ns + L":cNvSpPr")//non visual properies (собственно тока 1 там)
|
||||
{
|
||||
if (val.sub_type == 1)CP_XML_ATTR(L"txBox", 1);
|
||||
}
|
||||
} // xdr:nv_Pr
|
||||
CP_XML_NODE(L"xdr:spPr")
|
||||
CP_XML_NODE(ns + L":spPr")
|
||||
{
|
||||
val.serialize_xfrm(CP_XML_STREAM());
|
||||
|
||||
@ -174,7 +174,7 @@ void xlsx_serialize_shape(std::wostream & strm, _xlsx_drawing & val)
|
||||
oox_serialize_ln(CP_XML_STREAM(),val.additional, val.lined);
|
||||
} // xdr:spPr
|
||||
|
||||
xlsx_serialize_text(CP_XML_STREAM(), val);
|
||||
xlsx_serialize_text(CP_XML_STREAM(), val, ns);
|
||||
}
|
||||
} // CP_XML_WRITER
|
||||
}
|
||||
@ -206,22 +206,22 @@ void xlsx_serialize_object(std::wostream & strm, _xlsx_drawing & val)
|
||||
}
|
||||
}
|
||||
}
|
||||
void xlsx_serialize_group(std::wostream & strm, _xlsx_drawing & val)
|
||||
void xlsx_serialize_group(std::wostream & strm, _xlsx_drawing & val, const std::wstring & ns)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"xdr:grpSp")
|
||||
CP_XML_NODE(ns + L":grpSp")
|
||||
{
|
||||
CP_XML_NODE(L"xdr:nvGrpSpPr")
|
||||
CP_XML_NODE(ns + L":nvGrpSpPr")
|
||||
{
|
||||
CP_XML_NODE(L"xdr:cNvPr")
|
||||
CP_XML_NODE(ns + L":cNvPr")
|
||||
{
|
||||
CP_XML_ATTR(L"id", val.id);
|
||||
CP_XML_ATTR(L"name", val.name);
|
||||
}
|
||||
CP_XML_NODE(L"xdr:cNvGrpSpPr");
|
||||
CP_XML_NODE(ns + L":cNvGrpSpPr");
|
||||
}
|
||||
CP_XML_NODE(L"xdr:grpSpPr")
|
||||
CP_XML_NODE(ns + L":grpSpPr")
|
||||
{
|
||||
val.serialize_xfrm(CP_XML_STREAM());
|
||||
|
||||
@ -266,15 +266,15 @@ void xlsx_serialize_chart(std::wostream & strm, _xlsx_drawing & val)
|
||||
}
|
||||
}
|
||||
}
|
||||
void xlsx_serialize(std::wostream & strm, _xlsx_drawing & val)
|
||||
void xlsx_serialize(std::wostream & strm, _xlsx_drawing & val, const std::wstring & ns)
|
||||
{
|
||||
if (val.type == typeShape)
|
||||
{
|
||||
xlsx_serialize_shape(strm, val);
|
||||
xlsx_serialize_shape(strm, val, ns);
|
||||
}
|
||||
else if (val.type == typeImage)
|
||||
{
|
||||
xlsx_serialize_image(strm, val);
|
||||
xlsx_serialize_image(strm, val, ns);
|
||||
}
|
||||
else if (val.type == typeChart)
|
||||
{
|
||||
@ -282,7 +282,7 @@ void xlsx_serialize(std::wostream & strm, _xlsx_drawing & val)
|
||||
}
|
||||
else if (val.type == typeGroupShape)
|
||||
{
|
||||
xlsx_serialize_group(strm, val);
|
||||
xlsx_serialize_group(strm, val, ns);
|
||||
}
|
||||
else if (val.type == typeOleObject ||
|
||||
val.type == typeMsObject ||
|
||||
@ -292,44 +292,76 @@ void xlsx_serialize(std::wostream & strm, _xlsx_drawing & val)
|
||||
}
|
||||
}
|
||||
|
||||
void _xlsx_drawing::serialize(std::wostream & strm)
|
||||
void _xlsx_drawing::serialize(std::wostream & strm, const std::wstring & ns)
|
||||
{
|
||||
if (inGroup)
|
||||
return xlsx_serialize(strm, *this);
|
||||
return xlsx_serialize(strm, *this, ns);
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
if (type_anchor == 1)
|
||||
{
|
||||
CP_XML_NODE(L"xdr:twoCellAnchor")
|
||||
CP_XML_NODE(ns + L":twoCellAnchor")
|
||||
{
|
||||
CP_XML_ATTR(L"editAs", L"oneCell");//"absolute");oneCell
|
||||
|
||||
from_.serialize (CP_XML_STREAM());
|
||||
to_.serialize (CP_XML_STREAM());
|
||||
|
||||
xlsx_serialize (CP_XML_STREAM(), *this);
|
||||
CP_XML_NODE(L"xdr:clientData");
|
||||
xlsx_serialize (CP_XML_STREAM(), *this, ns);
|
||||
CP_XML_NODE(ns + L":clientData");
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (type_anchor == 2)
|
||||
{
|
||||
CP_XML_NODE(L"xdr:absoluteAnchor")
|
||||
CP_XML_NODE(ns + L":absoluteAnchor")
|
||||
{
|
||||
CP_XML_NODE(L"xdr:pos")
|
||||
CP_XML_NODE(ns + L":pos")
|
||||
{
|
||||
CP_XML_ATTR(L"x", x);
|
||||
CP_XML_ATTR(L"y", y);
|
||||
}
|
||||
CP_XML_NODE(L"xdr:ext")
|
||||
CP_XML_NODE(ns + L":ext")
|
||||
{
|
||||
CP_XML_ATTR(L"cx", cx);
|
||||
CP_XML_ATTR(L"cy", cy);
|
||||
}
|
||||
xlsx_serialize(CP_XML_STREAM(), *this);
|
||||
CP_XML_NODE(L"xdr:clientData");
|
||||
xlsx_serialize(CP_XML_STREAM(), *this, ns);
|
||||
CP_XML_NODE(ns + L":clientData");
|
||||
}
|
||||
}
|
||||
else if (type_anchor == 3)
|
||||
{
|
||||
CP_XML_NODE(ns + L":relSizeAnchor")
|
||||
{
|
||||
CP_XML_NODE(ns + L":from")
|
||||
{
|
||||
CP_XML_NODE(ns + L":x")
|
||||
{
|
||||
CP_XML_STREAM() << ((double)x / *owner_cx_);
|
||||
}
|
||||
CP_XML_NODE(ns + L":y")
|
||||
{
|
||||
CP_XML_STREAM() << ((double)y / *owner_cy_);
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(ns + L":to")
|
||||
{
|
||||
_INT32 x1 = x + cx;
|
||||
_INT32 y1 = y + cy;
|
||||
|
||||
CP_XML_NODE(ns + L":x")
|
||||
{
|
||||
CP_XML_STREAM() << ((double)x1 / *owner_cx_);
|
||||
}
|
||||
CP_XML_NODE(ns + L":y")
|
||||
{
|
||||
CP_XML_STREAM() << ((double)y1 / *owner_cy_);
|
||||
}
|
||||
}
|
||||
xlsx_serialize(CP_XML_STREAM(), *this, ns);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ struct xlsx_drawing_position
|
||||
enum type_t {from, to} type;
|
||||
xlsx_table_position position;
|
||||
|
||||
void serialize(std::wostream & _Wostream, std::wstring ns = L"xdr:");
|
||||
void serialize(std::wostream & _Wostream, const std::wstring & ns = L"xdr");
|
||||
};
|
||||
|
||||
|
||||
@ -63,9 +63,14 @@ public:
|
||||
xlsx_drawing_position from_;
|
||||
xlsx_drawing_position to_;
|
||||
|
||||
_CP_OPT(_INT32) owner_cx_;
|
||||
_CP_OPT(_INT32) owner_cy_;
|
||||
|
||||
std::wstring content_group_;
|
||||
|
||||
void serialize (std::wostream & strm);
|
||||
virtual void serialize (std::wostream & strm) {return serialize(strm, L"xdr");}
|
||||
|
||||
void serialize (std::wostream & strm, const std::wstring & ns);
|
||||
void serialize_object (std::wostream & strm);
|
||||
void serialize_control (std::wostream & strm);
|
||||
};
|
||||
|
||||
@ -53,41 +53,42 @@ namespace oox {
|
||||
class xlsx_drawing_context_handle::Impl
|
||||
{
|
||||
public:
|
||||
Impl(mediaitems & items) : items_(items), next_rId_(1), next_drawing_id_(1)
|
||||
Impl(mediaitems_ptr & items) : items_(items), next_rId_(1), next_drawing_id_(1)
|
||||
{
|
||||
}
|
||||
|
||||
mediaitems & get_mediaitems() { return items_; }
|
||||
mediaitems_ptr & get_mediaitems() { return items_; }
|
||||
|
||||
size_t next_rId()
|
||||
{
|
||||
return next_rId_++;
|
||||
}
|
||||
|
||||
std::pair<std::wstring, std::wstring> add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings)
|
||||
std::pair<std::wstring, std::wstring> add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings, RelsType const & type_)
|
||||
{
|
||||
const std::wstring id = std::to_wstring(next_drawing_id_++);
|
||||
const std::wstring fileName = std::wstring(L"drawing") + id + L".xml";
|
||||
drawings_.push_back(drawing_elm(fileName, content, drawings));
|
||||
const std::wstring rId = std::wstring(L"rId") + id;//rDrId
|
||||
return std::pair<std::wstring, std::wstring>(fileName, rId);
|
||||
|
||||
drawings_.push_back(drawing_elm(fileName, content, drawings, type_));
|
||||
const std::wstring rId = std::wstring(L"rDrId") + id;
|
||||
|
||||
return std::pair<std::wstring, std::wstring>(fileName, rId);
|
||||
}
|
||||
|
||||
const std::vector<drawing_elm> & content() const
|
||||
{
|
||||
return drawings_;
|
||||
}
|
||||
|
||||
private:
|
||||
mediaitems & items_;
|
||||
mediaitems_ptr items_;
|
||||
std::vector<drawing_elm> drawings_;
|
||||
|
||||
size_t next_rId_;
|
||||
size_t next_drawing_id_;
|
||||
};
|
||||
|
||||
xlsx_drawing_context_handle::xlsx_drawing_context_handle(mediaitems & items)
|
||||
: impl_(new xlsx_drawing_context_handle::Impl(items))
|
||||
xlsx_drawing_context_handle::xlsx_drawing_context_handle(mediaitems_ptr & items) :
|
||||
impl_(new xlsx_drawing_context_handle::Impl(items))
|
||||
{
|
||||
}
|
||||
|
||||
@ -95,9 +96,9 @@ xlsx_drawing_context_handle::~xlsx_drawing_context_handle()
|
||||
{
|
||||
}
|
||||
|
||||
std::pair<std::wstring, std::wstring> xlsx_drawing_context_handle::add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings)
|
||||
std::pair<std::wstring, std::wstring> xlsx_drawing_context_handle::add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings, RelsType const & type_)
|
||||
{
|
||||
return impl_->add_drawing_xml(content, drawings);
|
||||
return impl_->add_drawing_xml(content, drawings, type_);
|
||||
}
|
||||
|
||||
const std::vector<drawing_elm> & xlsx_drawing_context_handle::content() const
|
||||
@ -108,13 +109,13 @@ const std::vector<drawing_elm> & xlsx_drawing_context_handle::content() const
|
||||
class xlsx_drawing_context::Impl
|
||||
{
|
||||
public:
|
||||
Impl(xlsx_drawing_context_handle & handle) : xlsx_drawings_(xlsx_drawings::create(false)), handle_(handle)
|
||||
Impl(xlsx_drawing_context_handle_ptr & handle) : xlsx_drawings_(xlsx_drawings::create(false)), handle_(handle)
|
||||
{
|
||||
current_level_ = &objects_;
|
||||
use_image_replacement_ = false;
|
||||
}
|
||||
|
||||
xlsx_drawing_context_handle& handle_;
|
||||
xlsx_drawing_context_handle_ptr handle_;
|
||||
drawing_object_description object_description_;
|
||||
|
||||
std::vector<drawing_object_description> objects_;
|
||||
@ -124,11 +125,11 @@ public:
|
||||
bool use_image_replacement_;
|
||||
//-----------------------------------------------------------------------------------
|
||||
|
||||
mediaitems & get_mediaitems() { return handle_.impl_->get_mediaitems(); }
|
||||
mediaitems_ptr & get_mediaitems() { return handle_->impl_->get_mediaitems(); }
|
||||
|
||||
void serialize(std::wostream & strm)
|
||||
void serialize(std::wostream & strm, const std::wstring & ns = L"xdr")
|
||||
{
|
||||
xlsx_drawings_->serialize(strm);
|
||||
xlsx_drawings_->serialize(strm, ns);
|
||||
}
|
||||
|
||||
bool empty() const
|
||||
@ -138,7 +139,7 @@ public:
|
||||
|
||||
size_t next_rId()
|
||||
{
|
||||
return handle_.impl_->next_rId();
|
||||
return handle_->impl_->next_rId();
|
||||
}
|
||||
|
||||
xlsx_drawings_ptr get_drawings()
|
||||
@ -150,7 +151,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
xlsx_drawing_context::xlsx_drawing_context(xlsx_drawing_context_handle & h)
|
||||
xlsx_drawing_context::xlsx_drawing_context(xlsx_drawing_context_handle_ptr & h)
|
||||
: impl_(new xlsx_drawing_context::Impl(h))
|
||||
{
|
||||
hlinks_size_ = 0;
|
||||
@ -386,6 +387,12 @@ void xlsx_drawing_context::set_scale(double cx_pt, double cy_pt)
|
||||
|
||||
}
|
||||
}
|
||||
void xlsx_drawing_context::set_rel_anchor(_INT32 owner_cx, _INT32 owner_cy)
|
||||
{
|
||||
impl_->object_description_.owner_cx_ = owner_cx;
|
||||
impl_->object_description_.owner_cy_ = owner_cy;
|
||||
}
|
||||
|
||||
void xlsx_drawing_context::set_anchor(std::wstring anchor, double x_pt, double y_pt, bool group)
|
||||
{
|
||||
if (group)
|
||||
@ -444,9 +451,17 @@ void xlsx_drawing_context::process_common_properties(drawing_object_description
|
||||
{
|
||||
if (obj.anchor_.empty())
|
||||
{
|
||||
drawing.type_anchor = 2; // absolute
|
||||
if (obj.owner_cx_ && obj.owner_cy_)
|
||||
{
|
||||
drawing.type_anchor = 3; // relative
|
||||
drawing.owner_cx_ = obj.owner_cx_;
|
||||
drawing.owner_cy_ = obj.owner_cy_;
|
||||
}
|
||||
else
|
||||
drawing.type_anchor = 2; // absolute
|
||||
}
|
||||
else
|
||||
|
||||
if (drawing.type_anchor == 1)
|
||||
{
|
||||
xlsx_table_position from, to;
|
||||
|
||||
@ -470,17 +485,19 @@ void xlsx_drawing_context::process_common_properties(drawing_object_description
|
||||
_rect & r = obj.svg_rect_.get();
|
||||
|
||||
//todooo непонятно что делать с отрицательными значениями
|
||||
int val = 0.5 + odf_types::length(obj.svg_rect_->x, odf_types::length::pt).get_value_unit(odf_types::length::emu);
|
||||
if (val >=0) drawing.x = val;
|
||||
_INT32 val = 0;
|
||||
|
||||
val = (_INT32) (0.5 + odf_types::length(obj.svg_rect_->x, odf_types::length::pt).get_value_unit(odf_types::length::emu));
|
||||
if (val >= 0) drawing.x = val;
|
||||
|
||||
val = 0.5 + odf_types::length(obj.svg_rect_->y, odf_types::length::pt).get_value_unit(odf_types::length::emu);
|
||||
if (val >=0) drawing.y = val;
|
||||
val = (_INT32) (0.5 + odf_types::length(obj.svg_rect_->y, odf_types::length::pt).get_value_unit(odf_types::length::emu));
|
||||
if (val >= 0) drawing.y = val;
|
||||
|
||||
val = 0.5 + odf_types::length(obj.svg_rect_->cx, odf_types::length::pt).get_value_unit(odf_types::length::emu);
|
||||
if (val >=0) drawing.cx = val;
|
||||
val = (_INT32) (0.5 + odf_types::length(obj.svg_rect_->cx, odf_types::length::pt).get_value_unit(odf_types::length::emu));
|
||||
if (val >= 0) drawing.cx = val;
|
||||
|
||||
val = .5 + odf_types::length(obj.svg_rect_->cy, odf_types::length::pt).get_value_unit(odf_types::length::emu);
|
||||
if (val >=0) drawing.cy = val;
|
||||
val = (_INT32) (0.5 + odf_types::length(obj.svg_rect_->cy, odf_types::length::pt).get_value_unit(odf_types::length::emu));
|
||||
if (val >= 0) drawing.cy = val;
|
||||
}
|
||||
|
||||
drawing.additional = obj.additional_;
|
||||
@ -555,7 +572,7 @@ void xlsx_drawing_context::process_image(drawing_object_description & obj, _xlsx
|
||||
}
|
||||
std::wstring fileName = odf_packet_path_ + FILE_SEPARATOR_STR + obj.xlink_href_;
|
||||
|
||||
drawing.fill.bitmap->bCrop = odf_reader::parse_clipping(obj.clipping_string_, fileName, drawing.fill.bitmap->cropRect, impl_->get_mediaitems().applicationFonts());
|
||||
drawing.fill.bitmap->bCrop = odf_reader::parse_clipping(obj.clipping_string_, fileName, drawing.fill.bitmap->cropRect, impl_->get_mediaitems()->applicationFonts());
|
||||
drawing.fill.bitmap->bStretch = true;
|
||||
|
||||
if ((sColorMode) && (*sColorMode == L"greyscale"))
|
||||
@ -564,14 +581,14 @@ void xlsx_drawing_context::process_image(drawing_object_description & obj, _xlsx
|
||||
std::wstring ref;/// это ссылка на выходной внешний объект
|
||||
bool isMediaInternal = false;
|
||||
|
||||
drawing.fill.bitmap->rId = impl_->get_mediaitems().add_or_find(obj.xlink_href_, typeImage, isMediaInternal, ref);
|
||||
drawing.fill.bitmap->rId = impl_->get_mediaitems()->add_or_find(obj.xlink_href_, typeImage, isMediaInternal, ref);
|
||||
|
||||
if (drawing.type == typeShape)
|
||||
{
|
||||
impl_->get_drawings()->add(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage);//собственно это не объект, а доп рел и ref объекта
|
||||
|
||||
isMediaInternal=true;
|
||||
std::wstring rId = impl_->get_mediaitems().add_or_find(L"", typeShape, isMediaInternal, ref);
|
||||
std::wstring rId = impl_->get_mediaitems()->add_or_find(L"", typeShape, isMediaInternal, ref);
|
||||
|
||||
xlsx_drawings_->add(drawing, isMediaInternal, rId, ref, typeShape);//объект
|
||||
|
||||
@ -589,7 +606,7 @@ void xlsx_drawing_context::process_chart(drawing_object_description & obj,_xlsx_
|
||||
std::wstring ref;
|
||||
bool isMediaInternal = true;
|
||||
|
||||
drawing.objectId = impl_->get_mediaitems().add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
|
||||
drawing.objectId = impl_->get_mediaitems()->add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
|
||||
xlsx_drawings_->add(drawing, isMediaInternal, drawing.objectId, ref, obj.type_);
|
||||
|
||||
if (drawing.inGroup)
|
||||
@ -627,7 +644,7 @@ void xlsx_drawing_context::process_object(drawing_object_description & obj, xlsx
|
||||
}
|
||||
else
|
||||
{
|
||||
drawing.objectId = impl_->get_mediaitems().add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
|
||||
drawing.objectId = impl_->get_mediaitems()->add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
|
||||
drawing.objectProgId = obj.descriptor_;
|
||||
|
||||
xlsx_drawings_->add(drawing, isMediaInternal, drawing.objectId, ref, obj.type_, true);
|
||||
@ -641,7 +658,7 @@ void xlsx_drawing_context::process_shape(drawing_object_description & obj,_xlsx_
|
||||
std::wstring ref;
|
||||
bool isMediaInternal = true;
|
||||
|
||||
std::wstring rId = impl_->get_mediaitems().add_or_find(L"", obj.type_, isMediaInternal, ref);
|
||||
std::wstring rId = impl_->get_mediaitems()->add_or_find(L"", obj.type_, isMediaInternal, ref);
|
||||
xlsx_drawings_->add(drawing, isMediaInternal, rId, ref, obj.type_);
|
||||
}
|
||||
|
||||
@ -653,7 +670,7 @@ void xlsx_drawing_context::process_group(drawing_object_description & obj, xlsx_
|
||||
|
||||
std::wstringstream strm;
|
||||
|
||||
xlsx_drawings_child->serialize(strm);
|
||||
xlsx_drawings_child->serialize(strm, L"xdr");
|
||||
|
||||
drawing.content_group_ = strm.str();
|
||||
|
||||
@ -661,7 +678,7 @@ void xlsx_drawing_context::process_group(drawing_object_description & obj, xlsx_
|
||||
std::wstring ref;
|
||||
bool isMediaInternal = true;
|
||||
|
||||
std::wstring rId = impl_->get_mediaitems().add_or_find(L"", obj.type_, isMediaInternal, ref);
|
||||
std::wstring rId = impl_->get_mediaitems()->add_or_find(L"", obj.type_, isMediaInternal, ref);
|
||||
xlsx_drawings_->add(drawing, isMediaInternal, rId, ref, obj.type_);
|
||||
|
||||
}
|
||||
@ -692,7 +709,7 @@ void xlsx_drawing_context::process_group_objects(std::vector<drawing_object_desc
|
||||
std::wstring ref;
|
||||
bool isMediaInternal = true;
|
||||
|
||||
drawing.fill.bitmap->rId = impl_->get_mediaitems().add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
|
||||
drawing.fill.bitmap->rId = impl_->get_mediaitems()->add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
|
||||
|
||||
bool in_sheet = (obj.type_== typeOleObject || obj.type_== typeMsObject) ? true : false;
|
||||
impl_->get_drawings()->add(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage, in_sheet);//собственно это не объект, а доп рел и ref объекта
|
||||
@ -716,9 +733,9 @@ void xlsx_drawing_context::process_group_objects(std::vector<drawing_object_desc
|
||||
}
|
||||
}
|
||||
|
||||
void xlsx_drawing_context::serialize(std::wostream & strm)
|
||||
void xlsx_drawing_context::serialize(std::wostream & strm, const std::wstring& ns)
|
||||
{
|
||||
impl_->serialize(strm);
|
||||
impl_->serialize(strm, ns);
|
||||
}
|
||||
|
||||
xlsx_drawings_ptr xlsx_drawing_context::get_drawings()
|
||||
@ -756,6 +773,5 @@ void xlsx_drawing_context::set_is_connector_shape(bool val)
|
||||
impl_->object_description_.connector_ = val;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,15 +53,16 @@ namespace oox {
|
||||
class xlsx_drawings;
|
||||
struct _oox_fill;
|
||||
|
||||
typedef _CP_PTR(xlsx_drawings) xlsx_drawings_ptr;
|
||||
typedef _CP_PTR(mediaitems) mediaitems_ptr;
|
||||
typedef _CP_PTR(xlsx_drawings) xlsx_drawings_ptr;
|
||||
|
||||
class xlsx_drawing_context_handle
|
||||
{
|
||||
public:
|
||||
xlsx_drawing_context_handle(mediaitems & items);
|
||||
xlsx_drawing_context_handle(mediaitems_ptr & items);
|
||||
~xlsx_drawing_context_handle();
|
||||
|
||||
std::pair<std::wstring, std::wstring> add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings);
|
||||
std::pair<std::wstring, std::wstring> add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings, RelsType const & type_ = typeDefault);
|
||||
const std::vector<drawing_elm> & content() const;
|
||||
|
||||
friend class xlsx_drawing_context;
|
||||
@ -72,10 +73,12 @@ public:
|
||||
|
||||
|
||||
|
||||
typedef _CP_PTR(xlsx_drawing_context_handle) xlsx_drawing_context_handle_ptr;
|
||||
|
||||
class xlsx_drawing_context
|
||||
{
|
||||
public:
|
||||
xlsx_drawing_context(xlsx_drawing_context_handle & h);
|
||||
xlsx_drawing_context(xlsx_drawing_context_handle_ptr & h);
|
||||
~xlsx_drawing_context();
|
||||
|
||||
void set_odf_packet_path(std::wstring path){odf_packet_path_ = path;}//для анализа картинок
|
||||
@ -105,6 +108,7 @@ public:
|
||||
void set_scale (double cx_pt, double cy_pt);
|
||||
void set_rotate (double angle, bool translate = false);
|
||||
|
||||
void set_rel_anchor (_INT32 owner_cx, _INT32 owner_cy);
|
||||
void set_anchor (std::wstring anchor, double x_pt, double y_pt, bool group = false);
|
||||
void set_property (odf_reader::_property p);
|
||||
void set_clipping (const std::wstring & str );
|
||||
@ -122,7 +126,8 @@ public:
|
||||
bool empty() const;
|
||||
void clear();
|
||||
|
||||
void serialize(std::wostream & strm);
|
||||
void serialize(std::wostream & strm, const std::wstring& ns = L"xdr");
|
||||
|
||||
std::wstring dump_path(std::vector<svg_path::_polyline> & path, double w,double h);
|
||||
|
||||
xlsx_drawings_ptr get_drawings();
|
||||
|
||||
@ -85,28 +85,35 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void serialize(std::wostream & strm)
|
||||
void serialize(std::wostream & strm, const std::wstring & ns)
|
||||
{
|
||||
if (inGroup)
|
||||
{
|
||||
for (size_t i = 0 ; i < xlsx_drawings_.size(); i++)
|
||||
{
|
||||
xlsx_drawings_[i].serialize(strm);
|
||||
xlsx_drawings_[i].serialize(strm, ns);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"xdr:wsDr")
|
||||
CP_XML_NODE(ns + L":wsDr")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns:xdr", L"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing");
|
||||
if (ns == L"xdr")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns:xdr", L"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing");
|
||||
}
|
||||
if (ns == L"cdr")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns:cdr", L"http://schemas.openxmlformats.org/drawingml/2006/chartDrawing");
|
||||
}
|
||||
CP_XML_ATTR(L"xmlns:a" , L"http://schemas.openxmlformats.org/drawingml/2006/main");
|
||||
CP_XML_ATTR(L"xmlns:r" , L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
|
||||
|
||||
for (size_t i = 0 ; i < xlsx_drawings_.size(); i++)
|
||||
{
|
||||
xlsx_drawings_[i].serialize(CP_XML_STREAM());
|
||||
xlsx_drawings_[i].serialize(CP_XML_STREAM(), ns);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -192,9 +199,9 @@ void xlsx_drawings::add( bool isInternal, std::wstring const & rid, std::wstring
|
||||
impl_->add(isInternal, rid, ref, type, sheet_rel);
|
||||
}
|
||||
|
||||
void xlsx_drawings::serialize(std::wostream & strm)
|
||||
void xlsx_drawings::serialize(std::wostream & strm, const std::wstring & ns)
|
||||
{
|
||||
impl_->serialize(strm);
|
||||
impl_->serialize(strm, ns);
|
||||
}
|
||||
|
||||
void xlsx_drawings::serialize_objects(std::wostream & strm)
|
||||
|
||||
@ -46,13 +46,14 @@ typedef _CP_PTR(xlsx_drawings) xlsx_drawings_ptr;
|
||||
|
||||
struct drawing_elm
|
||||
{
|
||||
drawing_elm(std::wstring const & _filename, std::wstring const & _content, xlsx_drawings_ptr _drawings)
|
||||
: filename(_filename), content(_content), drawings(_drawings)
|
||||
drawing_elm(std::wstring const & _filename, std::wstring const & _content, xlsx_drawings_ptr _drawings, RelsType const & _type)
|
||||
: filename(_filename), content(_content), drawings(_drawings), type(_type)
|
||||
{}
|
||||
|
||||
std::wstring filename;
|
||||
std::wstring content;
|
||||
xlsx_drawings_ptr drawings;
|
||||
RelsType type;
|
||||
};
|
||||
|
||||
class _xlsx_drawing;
|
||||
@ -71,7 +72,7 @@ public:
|
||||
void dump_rels_sheet (rels & Rels);
|
||||
void dump_rels_drawing (rels & Rels);
|
||||
|
||||
void serialize (std::wostream & _Wostream);
|
||||
void serialize (std::wostream & _Wostream, const std::wstring & ns);
|
||||
void serialize_objects (std::wostream & _Wostream);
|
||||
void serialize_controls (std::wostream & _Wostream);
|
||||
private:
|
||||
|
||||
@ -31,6 +31,8 @@
|
||||
*/
|
||||
|
||||
#include "xlsx_package.h"
|
||||
#include "docx_package.h"
|
||||
#include "pptx_package.h"
|
||||
|
||||
#include <boost/ref.hpp>
|
||||
|
||||
@ -298,16 +300,16 @@ void xl_files::add_sheet(sheet_content_ptr sheet)
|
||||
sheets_files_.add_sheet(sheet);
|
||||
}
|
||||
|
||||
void xl_files::set_media(mediaitems & _Mediaitems)
|
||||
void xl_files::set_media(mediaitems_ptr & _mediaitems)
|
||||
{
|
||||
if (_Mediaitems.count_image + _Mediaitems.count_media > 0)
|
||||
if (_mediaitems->count_image + _mediaitems->count_media > 0)
|
||||
{
|
||||
media_ = element_ptr( new media(_Mediaitems, _Mediaitems.applicationFonts()) );
|
||||
media_ = element_ptr( new media(_mediaitems, _mediaitems->applicationFonts()) );
|
||||
}
|
||||
|
||||
if (_Mediaitems.count_object > 0)
|
||||
if (_mediaitems->count_object > 0)
|
||||
{
|
||||
embeddings_ = element_ptr( new embeddings(_Mediaitems) );
|
||||
embeddings_ = element_ptr( new embeddings(_mediaitems) );
|
||||
}
|
||||
}
|
||||
void xl_files::set_comments(element_ptr Element)
|
||||
@ -563,10 +565,18 @@ xl_drawings_ptr xl_drawings::create(const std::vector<drawing_elm> & elms)
|
||||
|
||||
void xl_drawings::write(const std::wstring & RootPath)
|
||||
{
|
||||
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"drawings";
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
for (size_t i = 0; i < drawings_.size(); i++)
|
||||
pptx_document *pptx = dynamic_cast<pptx_document*>(this->get_main_document());
|
||||
xlsx_document *xlsx = dynamic_cast<xlsx_document*>(this->get_main_document());
|
||||
docx_document *docx = dynamic_cast<docx_document*>(this->get_main_document());
|
||||
|
||||
const std::wstring override_str = docx ? L"/word/drawings/" : (pptx ? L"/ppt/drawings/" : L"/xl/drawings/");
|
||||
|
||||
for (size_t i = 0; i < drawings_.size(); i++)
|
||||
{
|
||||
package::simple_element(drawings_[i].filename, drawings_[i].content).write(path);
|
||||
|
||||
@ -578,10 +588,11 @@ void xl_drawings::write(const std::wstring & RootPath)
|
||||
relFiles.add_rel_file(r);
|
||||
relFiles.write(path);
|
||||
|
||||
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
|
||||
const std::wstring kDrawingCT = L"application/vnd.openxmlformats-officedocument.drawing+xml";
|
||||
contentTypes->add_override(L"/xl/drawings/" + drawings_[i].filename, kDrawingCT);
|
||||
const std::wstring kDrawingCT = drawings_[i].type == typeChartUserShapes ?
|
||||
L"application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml" :
|
||||
L"application/vnd.openxmlformats-officedocument.drawing+xml";
|
||||
|
||||
contentTypes->add_override(override_str + drawings_[i].filename, kDrawingCT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -284,7 +284,7 @@ public:
|
||||
void set_sharedStrings (element_ptr Element);
|
||||
void set_connections (element_ptr Element);
|
||||
void add_sheet (sheet_content_ptr sheet);
|
||||
void set_media (mediaitems & _Mediaitems);
|
||||
void set_media (mediaitems_ptr & _Mediaitems);
|
||||
void set_drawings (element_ptr Element);
|
||||
void set_vml_drawings (element_ptr Element);
|
||||
void set_comments (element_ptr Element);
|
||||
|
||||
@ -69,12 +69,12 @@ xlsx_conversion_context::xlsx_conversion_context(odf_reader::odf_document * odfD
|
||||
xlsx_table_context_ (this, xlsx_text_context_),
|
||||
math_context_ (odf_document_->odf_context().fontContainer(), true),
|
||||
xlsx_style_ (this),
|
||||
|
||||
|
||||
maxDigitSize_ (std::make_pair(-1.f, -1.f) ),
|
||||
default_style_ ( (std::numeric_limits<size_t>::max)() ),
|
||||
mediaitems_ (odf_document_->get_folder()),
|
||||
xlsx_drawing_context_handle_(mediaitems_)
|
||||
default_style_ ( (std::numeric_limits<size_t>::max)() )
|
||||
{
|
||||
mediaitems_ = boost::make_shared<mediaitems>(odf_document_->get_folder());
|
||||
drawing_context_handle_ = boost::make_shared<xlsx_drawing_context_handle>(mediaitems_);
|
||||
}
|
||||
|
||||
std::unordered_map<std::wstring, int> xlsx_conversion_context::mapExternalLink_;
|
||||
@ -90,7 +90,16 @@ xlsx_conversion_context::~xlsx_conversion_context()
|
||||
|
||||
void xlsx_conversion_context::set_font_directory(std::wstring pathFonts)
|
||||
{
|
||||
mediaitems_.set_font_directory(pathFonts);
|
||||
mediaitems_->set_font_directory(pathFonts);
|
||||
}
|
||||
void xlsx_conversion_context::set_drawing_context_handle(xlsx_drawing_context_handle_ptr &handle)
|
||||
{
|
||||
drawing_context_handle_ = handle;
|
||||
}
|
||||
|
||||
void xlsx_conversion_context::set_mediaitems(mediaitems_ptr &items)
|
||||
{
|
||||
mediaitems_ = items;
|
||||
}
|
||||
|
||||
void xlsx_conversion_context::start_chart(std::wstring name)
|
||||
@ -323,7 +332,7 @@ void xlsx_conversion_context::end_document()
|
||||
output_document_->get_content_types_file().set_media(get_mediaitems());
|
||||
output_document_->get_xl_files().set_media(get_mediaitems());
|
||||
|
||||
package::xl_drawings_ptr drawings = package::xl_drawings::create(xlsx_drawing_context_handle_.content());
|
||||
package::xl_drawings_ptr drawings = package::xl_drawings::create(drawing_context_handle_->content());
|
||||
output_document_->get_xl_files().set_drawings(drawings);
|
||||
|
||||
package::xl_comments_ptr comments = package::xl_comments::create(xlsx_comments_context_handle_.content());
|
||||
@ -496,13 +505,13 @@ void xlsx_conversion_context::end_table()
|
||||
L"../pivotTables/pivotTable" + std::to_wstring(it->second) + L".xml"));
|
||||
}
|
||||
|
||||
if (!get_drawing_context().empty())
|
||||
if (false == get_drawing_context().empty())
|
||||
{
|
||||
std::wstringstream strm;
|
||||
get_drawing_context().serialize(strm);
|
||||
|
||||
const std::pair<std::wstring, std::wstring> drawingName
|
||||
= xlsx_drawing_context_handle_.add_drawing_xml(strm.str(), get_drawing_context().get_drawings() );
|
||||
= drawing_context_handle_->add_drawing_xml(strm.str(), get_drawing_context().get_drawings() );
|
||||
|
||||
current_sheet().set_drawing_link(drawingName.first, drawingName.second);
|
||||
|
||||
@ -730,7 +739,7 @@ std::pair<float,float> xlsx_conversion_context::getMaxDigitSize()
|
||||
else
|
||||
font_size =10;
|
||||
|
||||
maxDigitSize_ = utils::GetMaxDigitSizePixels(font_name.c_str(), font_size, 96., 0, mediaitems_.applicationFonts());
|
||||
maxDigitSize_ = utils::GetMaxDigitSizePixels(font_name.c_str(), font_size, 96., 0, mediaitems_->applicationFonts());
|
||||
}
|
||||
return maxDigitSize_;
|
||||
}
|
||||
@ -749,9 +758,9 @@ xlsx_drawing_context & xlsx_conversion_context::get_drawing_context()
|
||||
return get_table_context().get_drawing_context();
|
||||
}
|
||||
|
||||
xlsx_drawing_context_handle & xlsx_conversion_context::get_drawing_context_handle()
|
||||
xlsx_drawing_context_handle_ptr & xlsx_conversion_context::get_drawing_context_handle()
|
||||
{
|
||||
return xlsx_drawing_context_handle_;
|
||||
return drawing_context_handle_;
|
||||
}
|
||||
xlsx_comments_context & xlsx_conversion_context::get_comments_context()
|
||||
{
|
||||
|
||||
@ -188,12 +188,16 @@ public:
|
||||
xlsx_pivots_context & get_pivots_context() { return xlsx_pivots_context_;}
|
||||
xlsx_table_metrics & get_table_metrics();
|
||||
xlsx_drawing_context & get_drawing_context();
|
||||
xlsx_drawing_context_handle & get_drawing_context_handle();
|
||||
xlsx_comments_context & get_comments_context();
|
||||
xlsx_comments_context_handle & get_comments_context_handle();
|
||||
xlsx_dataValidations_context& get_dataValidations_context() { return xlsx_dataValidations_context_;}
|
||||
|
||||
mediaitems & get_mediaitems() { return mediaitems_; }
|
||||
|
||||
xlsx_drawing_context_handle_ptr & get_drawing_context_handle();
|
||||
void set_drawing_context_handle(xlsx_drawing_context_handle_ptr &handle);
|
||||
|
||||
mediaitems_ptr & get_mediaitems() { return mediaitems_; }
|
||||
void set_mediaitems(mediaitems_ptr &items);
|
||||
|
||||
static std::unordered_map<std::wstring, int> mapExternalLink_;
|
||||
std::map<std::wstring, int> mapUsedNames_;
|
||||
@ -213,7 +217,7 @@ private:
|
||||
std::pair<float,float> maxDigitSize_;
|
||||
num_format_context num_format_context_;
|
||||
size_t default_style_;
|
||||
mediaitems mediaitems_;
|
||||
mediaitems_ptr mediaitems_;
|
||||
std::multimap<std::wstring, int> mapPivotsTableView_;
|
||||
|
||||
std::map<std::wstring, std::wstring> control_props_;
|
||||
@ -223,9 +227,9 @@ private:
|
||||
xlsx_table_context xlsx_table_context_;
|
||||
xlsx_text_context xlsx_text_context_;
|
||||
xlsx_pivots_context xlsx_pivots_context_;
|
||||
xlsx_drawing_context_handle xlsx_drawing_context_handle_;
|
||||
xlsx_comments_context_handle xlsx_comments_context_handle_;
|
||||
xlsx_dataValidations_context xlsx_dataValidations_context_;
|
||||
xlsx_drawing_context_handle_ptr drawing_context_handle_;
|
||||
|
||||
math_context math_context_;
|
||||
forms_context forms_context_;
|
||||
|
||||
@ -212,13 +212,18 @@ void object_odf_context::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
oox_convert(chart_context);
|
||||
|
||||
if (embeddedData.empty())
|
||||
if (false == embeddedData.empty())
|
||||
{
|
||||
chart_context.set_cache_only(true);
|
||||
chart_context.set_externalData(embeddedData);
|
||||
}
|
||||
else
|
||||
{
|
||||
chart_context.set_externalData(embeddedData);
|
||||
chart_context.set_cache_only(true);
|
||||
}
|
||||
|
||||
if (false == userShapes.first.empty())
|
||||
{
|
||||
chart_context.set_userShapes(userShapes);
|
||||
}
|
||||
|
||||
Context.end_chart();
|
||||
@ -450,14 +455,14 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
|
||||
}
|
||||
else
|
||||
{ //x
|
||||
if (false == domain_cash.empty())
|
||||
if (false == domain_cash.empty() || cash_values.empty())
|
||||
{
|
||||
if (!bPivotChart_)
|
||||
current->set_formula_series(2, domain_cell_range_adress_, formatCode, boolVal.get_value_or(true));
|
||||
current->set_values_series (2, domain_cash);
|
||||
}
|
||||
//y
|
||||
if (false == cell_cash.empty())
|
||||
if (false == cell_cash.empty() || cash_values.empty())
|
||||
{
|
||||
if (!bPivotChart_)
|
||||
current->set_formula_series(3, series_[i].cell_range_address_, formatCode, boolVal.get_value_or(true));
|
||||
|
||||
@ -206,6 +206,7 @@ public:
|
||||
std::map<std::wstring, _cell>cash_pivot;
|
||||
|
||||
std::wstring embeddedData;
|
||||
std::pair<std::wstring, std::wstring> userShapes;
|
||||
//---------------------------------------
|
||||
std::wstring target_table_;
|
||||
std::wstring table_name_;
|
||||
|
||||
@ -124,9 +124,8 @@ namespace chart {
|
||||
std::wstring chart_name_;
|
||||
std::wstring style_name_;
|
||||
std::vector<grid> grids_;
|
||||
int type_;
|
||||
|
||||
};
|
||||
int type_;
|
||||
};
|
||||
struct series : public simple
|
||||
{
|
||||
struct point : public simple
|
||||
|
||||
@ -499,6 +499,15 @@ void Compute_GraphicFill(const common_draw_fill_attlist & props, const office_el
|
||||
fill.gradient = oox::oox_gradient_fill::create();
|
||||
|
||||
Compute_GradientFill(image_style, fill.gradient);
|
||||
|
||||
if (fill.opacity)
|
||||
{
|
||||
for (size_t i = 0; i < fill.gradient->colors.size(); i++)
|
||||
{
|
||||
if (!fill.gradient->colors[i].opacity)
|
||||
fill.gradient->colors[i].opacity = fill.opacity;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -207,6 +207,11 @@ void draw_g::add_child_element( xml::sax * Reader, const std::wstring & Ns, cons
|
||||
|
||||
if (position_child_x2 < x + cx || position_child_x2 == 0x7fffffff) position_child_x2 = x + cx;
|
||||
if (position_child_y2 < y + cy || position_child_y2 == 0x7fffffff) position_child_y2 = y + cy;
|
||||
|
||||
if (frame->is_object_)
|
||||
{
|
||||
object_index = content_.size() - 1;
|
||||
}
|
||||
}
|
||||
else if (shape)
|
||||
{
|
||||
@ -256,16 +261,20 @@ void draw_frame::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
void draw_frame::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
if (CP_CHECK_NAME(L"draw", L"text-box") ||
|
||||
CP_CHECK_NAME(L"draw", L"image") ||//копия объекта в виде картинки ну.. или просто картинка
|
||||
CP_CHECK_NAME(L"draw", L"object") ||//месторасположение embedded объекта
|
||||
CP_CHECK_NAME(L"draw", L"object-ole") ||
|
||||
CP_CHECK_NAME(L"draw", L"applet") ||
|
||||
CP_CHECK_NAME(L"draw", L"floating-frame") ||
|
||||
CP_CHECK_NAME(L"draw", L"plugin") ||
|
||||
CP_CHECK_NAME(L"table", L"table")
|
||||
)
|
||||
CP_CHECK_NAME(L"draw", L"image") ||//копия объекта в виде картинки ну.. или просто картинка
|
||||
CP_CHECK_NAME(L"table", L"table") ||
|
||||
CP_CHECK_NAME(L"draw", L"object-ole")||
|
||||
CP_CHECK_NAME(L"draw", L"applet") ||
|
||||
CP_CHECK_NAME(L"draw", L"floating-frame")||
|
||||
CP_CHECK_NAME(L"draw", L"plugin")
|
||||
)
|
||||
{
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
}
|
||||
else if CP_CHECK_NAME(L"draw", L"object") //embedded объект
|
||||
{
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
is_object_ = true;
|
||||
}
|
||||
else if CP_CHECK_NAME(L"office", L"event-listeners")
|
||||
{
|
||||
|
||||
@ -153,7 +153,7 @@ public:
|
||||
static const ElementType type = typeDrawFrame;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
draw_frame() : oox_drawing_(), idx_in_owner(-1) {}
|
||||
draw_frame() : oox_drawing_(), idx_in_owner(-1), is_object_(false) {}
|
||||
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context);
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
@ -185,10 +185,10 @@ public:
|
||||
|
||||
oox_drawing_ptr oox_drawing_;
|
||||
|
||||
bool is_object_;
|
||||
private:
|
||||
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_frame);
|
||||
@ -209,7 +209,7 @@ public:
|
||||
static const ElementType type = typeDrawG;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
draw_g() : position_child_x1(0x7fffffff), position_child_y1(0x7fffffff), position_child_x2(0x7fffffff), position_child_y2(0x7fffffff) {}
|
||||
draw_g() : object_index(-1), position_child_x1(0x7fffffff), position_child_y1(0x7fffffff), position_child_x2(0x7fffffff), position_child_y2(0x7fffffff) {}
|
||||
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream, bool bXmlEncode = true) const;
|
||||
|
||||
@ -228,6 +228,8 @@ public:
|
||||
int position_child_x2;
|
||||
int position_child_y2;
|
||||
|
||||
int object_index ;
|
||||
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
@ -306,6 +308,7 @@ public:
|
||||
|
||||
odf_document_ptr odf_document_;
|
||||
|
||||
office_element_ptr_array content_; //for case group with object
|
||||
private:
|
||||
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
@ -923,7 +923,7 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, union_comm
|
||||
if ((drawing->fill.bitmap) && (drawing->fill.bitmap->rId.empty()))
|
||||
{
|
||||
std::wstring href = drawing->fill.bitmap->xlink_href_;
|
||||
drawing->fill.bitmap->rId = Context.get_mediaitems().add_or_find(href, oox::typeImage, drawing->fill.bitmap->isInternal, href);
|
||||
drawing->fill.bitmap->rId = Context.get_mediaitems()->add_or_find(href, oox::typeImage, drawing->fill.bitmap->isInternal, href);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
@ -1196,7 +1196,7 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
|
||||
drawing->fill.bitmap = oox::oox_bitmap_fill::create();
|
||||
drawing->fill.type = 2;
|
||||
drawing->fill.bitmap->isInternal = false;
|
||||
drawing->fill.bitmap->rId = Context.get_mediaitems().add_or_find(href, oox::typeImage, drawing->fill.bitmap->isInternal, href);
|
||||
drawing->fill.bitmap->rId = Context.get_mediaitems()->add_or_find(href, oox::typeImage, drawing->fill.bitmap->isInternal, href);
|
||||
drawing->fill.bitmap->bStretch = true;
|
||||
|
||||
const std::wstring styleName = frame->common_draw_attlists_.shape_with_text_and_styles_.
|
||||
@ -1216,7 +1216,7 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
std::wstring fileName = Context.root()->get_folder() + FILE_SEPARATOR_STR + xlink_attlist_.href_.get_value_or(L"");
|
||||
|
||||
drawing->fill.bitmap->bCrop = parse_clipping(strRectClip, fileName, drawing->fill.bitmap->cropRect, Context.get_mediaitems().applicationFonts());
|
||||
drawing->fill.bitmap->bCrop = parse_clipping(strRectClip, fileName, drawing->fill.bitmap->cropRect, Context.get_mediaitems()->applicationFonts());
|
||||
}
|
||||
if (properties->common_draw_fill_attlist_.draw_luminance_)
|
||||
{
|
||||
@ -1352,6 +1352,32 @@ void draw_g::docx_convert(oox::docx_conversion_context & Context)
|
||||
Context.add_delayed_element(this);
|
||||
return;
|
||||
}
|
||||
|
||||
if (object_index >= 0) //только в документах нельзя объект объединять с шейпами в группы (
|
||||
{
|
||||
draw_frame *frame = dynamic_cast<draw_frame*>(content_[object_index].get());
|
||||
|
||||
frame->common_draw_attlists_.shape_with_text_and_styles_.common_text_anchor_attlist_.type_ =
|
||||
common_draw_attlists_.shape_with_text_and_styles_.common_text_anchor_attlist_.type_;
|
||||
|
||||
for (size_t i = 0; i < frame->content_.size(); i++)
|
||||
{
|
||||
draw_object *object = dynamic_cast<draw_object*>(frame->content_[i].get());
|
||||
if (!object)continue;
|
||||
|
||||
for (size_t j = 0; j < content_.size(); j++)
|
||||
{
|
||||
if (j == object_index) continue;
|
||||
|
||||
object->content_.push_back(content_[j]);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
frame->docx_convert(Context);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
oox::_docx_drawing drawing = oox::_docx_drawing();
|
||||
|
||||
@ -1541,6 +1567,10 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
|
||||
process_build_object process_build_object_(objectBuild, odf_document_->odf_context());
|
||||
contentSubDoc->accept(process_build_object_);
|
||||
|
||||
frame = Context.get_drawing_context().get_current_frame(); //owner
|
||||
if (frame)
|
||||
drawing = dynamic_cast<oox::_docx_drawing *>(frame->oox_drawing_.get());
|
||||
|
||||
if (objectBuild.table_table_)
|
||||
{
|
||||
oox::xlsx_conversion_context xlsx_context(odf_document_.get());
|
||||
@ -1556,7 +1586,7 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
|
||||
NSDirectory::CreateDirectory(href_folder);
|
||||
outputXlsx.write(href_folder);
|
||||
|
||||
std::wstring href = L"Microsoft_Excel_Worksheet_" + std::to_wstring(Context.get_mediaitems().count_object + 1) + L".xlsx";
|
||||
std::wstring href = L"Microsoft_Excel_Worksheet_" + std::to_wstring(Context.get_mediaitems()->count_object + 1) + L".xlsx";
|
||||
|
||||
COfficeUtils oCOfficeUtils(NULL);
|
||||
if (S_OK == oCOfficeUtils.CompressFileOrDirectory(href_folder, odfPath + FILE_SEPARATOR_STR + href, true))
|
||||
@ -1565,11 +1595,34 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
|
||||
}
|
||||
}
|
||||
|
||||
if (false == content_.empty())
|
||||
{
|
||||
oox::xlsx_conversion_context xlsx_context(Context.root());
|
||||
|
||||
xlsx_context.set_drawing_context_handle(Context.get_chart_drawing_handle());
|
||||
xlsx_context.set_mediaitems(Context.get_mediaitems());
|
||||
|
||||
xlsx_context.get_table_context().start_table(L"", L"", 0);
|
||||
|
||||
for (size_t i = 0; i < content_.size(); ++i)
|
||||
{
|
||||
xlsx_context.get_drawing_context().set_rel_anchor(drawing->cx, drawing->cy);
|
||||
content_[i]->xlsx_convert(xlsx_context);
|
||||
}
|
||||
xlsx_context.get_table_context().end_table();
|
||||
|
||||
xlsx_context.get_drawing_context().process_objects(xlsx_context.get_table_metrics());
|
||||
|
||||
std::wstringstream strm;
|
||||
xlsx_context.get_drawing_context().serialize(strm, L"cdr");
|
||||
|
||||
const std::pair<std::wstring, std::wstring> drawingName =
|
||||
xlsx_context.get_drawing_context_handle()->add_drawing_xml(strm.str(), xlsx_context.get_drawing_context().get_drawings(), oox::typeChartUserShapes );
|
||||
|
||||
objectBuild.userShapes = drawingName;
|
||||
}
|
||||
|
||||
objectBuild.docx_convert(Context);
|
||||
|
||||
frame = Context.get_drawing_context().get_current_frame(); //owner
|
||||
if (frame)
|
||||
drawing = dynamic_cast<oox::_docx_drawing *>(frame->oox_drawing_.get());
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------
|
||||
if (!frame || !drawing)
|
||||
@ -1582,7 +1635,7 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
|
||||
drawing->type = oox::typeChart;
|
||||
|
||||
bool isMediaInternal = true;
|
||||
drawing->objectId = Context.get_mediaitems().add_or_find(href, drawing->type, isMediaInternal, href);
|
||||
drawing->objectId = Context.get_mediaitems()->add_or_find(href, drawing->type, isMediaInternal, href);
|
||||
}
|
||||
else if (objectBuild.object_type_ == 2 ) //embedded text
|
||||
{
|
||||
@ -1641,7 +1694,7 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
|
||||
bool isMediaInternal = true;
|
||||
|
||||
href += FILE_SEPARATOR_STR + href_new;
|
||||
drawing->objectId = Context.get_mediaitems().add_or_find(href, drawing->type, isMediaInternal, href);
|
||||
drawing->objectId = Context.get_mediaitems()->add_or_find(href, drawing->type, isMediaInternal, href);
|
||||
drawing->objectProgId = L"Excel.Sheet.12";
|
||||
}
|
||||
}
|
||||
@ -1682,7 +1735,7 @@ void draw_object_ole::docx_convert(oox::docx_conversion_context & Context)
|
||||
NSFile::CFileBinary::Copy(objectPath, objectPath + extension);
|
||||
|
||||
bool isMediaInternal = true;
|
||||
drawing->objectId = Context.get_mediaitems().add_or_find(href + extension, drawing->type, isMediaInternal, href);
|
||||
drawing->objectId = Context.get_mediaitems()->add_or_find(href + extension, drawing->type, isMediaInternal, href);
|
||||
|
||||
}
|
||||
void draw_control::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
@ -303,7 +303,7 @@ void draw_object::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
NSDirectory::CreateDirectory(href_folder);
|
||||
outputXlsx.write(href_folder);
|
||||
|
||||
std::wstring href = L"Microsoft_Excel_Worksheet_" + std::to_wstring(Context.get_mediaitems().count_object + 1) + L".xlsx";
|
||||
std::wstring href = L"Microsoft_Excel_Worksheet_" + std::to_wstring(Context.get_mediaitems()->count_object + 1) + L".xlsx";
|
||||
|
||||
COfficeUtils oCOfficeUtils(NULL);
|
||||
if (S_OK == oCOfficeUtils.CompressFileOrDirectory(href_folder, odfPath + FILE_SEPARATOR_STR + href, true))
|
||||
|
||||
@ -102,7 +102,7 @@ void draw_shape::common_docx_convert(oox::docx_conversion_context & Context)
|
||||
if ((fill.bitmap) && (fill.bitmap->rId.empty()))
|
||||
{
|
||||
std::wstring href = fill.bitmap->xlink_href_;
|
||||
fill.bitmap->rId = Context.get_mediaitems().add_or_find(href, oox::typeImage, fill.bitmap->isInternal, href);
|
||||
fill.bitmap->rId = Context.get_mediaitems()->add_or_find(href, oox::typeImage, fill.bitmap->isInternal, href);
|
||||
fill.bitmap->name_space = L"w14";
|
||||
}
|
||||
|
||||
|
||||
@ -399,7 +399,7 @@ void draw_control::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
if (state.ctrlPropId.empty())
|
||||
{
|
||||
std::wstring target;
|
||||
state.ctrlPropId = Context.get_mediaitems().add_control_props(target);
|
||||
state.ctrlPropId = Context.get_mediaitems()->add_control_props(target);
|
||||
|
||||
std::wstringstream strm;
|
||||
|
||||
|
||||
@ -523,11 +523,7 @@ const std::wstring & font_instance::style_name() const
|
||||
|
||||
const std::wstring & font_instance::name() const
|
||||
{
|
||||
static const std::wstring Symbol = L"Symbol";
|
||||
if (name_ == L"StarSymbol")
|
||||
return Symbol;
|
||||
else
|
||||
return name_;
|
||||
return name_;
|
||||
}
|
||||
|
||||
const std::wstring & font_instance::charset() const
|
||||
|
||||
@ -126,7 +126,7 @@ void office_body::docx_convert(oox::docx_conversion_context & Context)
|
||||
if ((fill.bitmap) && (fill.bitmap->rId.empty()))
|
||||
{
|
||||
std::wstring href = fill.bitmap->xlink_href_;
|
||||
fill.bitmap->rId = Context.get_mediaitems().add_or_find(href, oox::typeImage, fill.bitmap->isInternal, href);
|
||||
fill.bitmap->rId = Context.get_mediaitems()->add_or_find(href, oox::typeImage, fill.bitmap->isInternal, href);
|
||||
}
|
||||
int id = Context.get_drawing_context().get_current_shape_id();
|
||||
if (layout_properties->docx_background_serialize(Context.output_stream(), Context, fill, id))
|
||||
|
||||
@ -1386,7 +1386,7 @@ void style_page_layout_properties::xlsx_serialize(std::wostream & strm, oox::xls
|
||||
if ( fill.bitmap->rId.empty())
|
||||
{
|
||||
std::wstring href = fill.bitmap->xlink_href_;
|
||||
fill.bitmap->rId = Context.get_mediaitems().add_or_find(href, oox::typeImage, fill.bitmap->isInternal, href);
|
||||
fill.bitmap->rId = Context.get_mediaitems()->add_or_find(href, oox::typeImage, fill.bitmap->isInternal, href);
|
||||
|
||||
Context.get_drawing_context().get_drawings()->add(fill.bitmap->isInternal, fill.bitmap->rId, href, oox::typeImage, true);
|
||||
}
|
||||
|
||||
@ -537,7 +537,7 @@ wchar_t convert_bullet_char(wchar_t c)
|
||||
case L'\x25CF': res = L'\xF0B7'; break;
|
||||
case L'\x27A2': res = L'\xF0D8'; break;
|
||||
case L'\x2714': res = L'\xF0FC'; break;
|
||||
case L'\x25A0': res = L'\xF0A7'; break;
|
||||
/*case L'\x25A0': res = L'\xF0A7'; break; */
|
||||
case L'\x25CB': res = L'\x006F'; break;
|
||||
case L'\x2794': res = L'\xF0DA'; break;
|
||||
case L'\x2717': res = L'\xF04F'; break;
|
||||
|
||||
@ -211,7 +211,7 @@ void table_table::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
bool isMediaInternal = false;
|
||||
std::wstring ref;
|
||||
fill.bitmap->rId = Context.get_slide_context().get_mediaitems().add_or_find(fill.bitmap->xlink_href_, oox::typeImage, isMediaInternal, ref);
|
||||
fill.bitmap->rId = Context.get_slide_context().get_mediaitems()->add_or_find(fill.bitmap->xlink_href_, oox::typeImage, isMediaInternal, ref);
|
||||
Context.get_slide_context().add_rels(isMediaInternal, fill.bitmap->rId, ref, oox::typeImage);
|
||||
}
|
||||
oox::oox_serialize_fill(_Wostream, fill);
|
||||
|
||||
@ -24,10 +24,7 @@ include($$PWD/../../3dParty/boost/boost.pri)
|
||||
|
||||
core_release {
|
||||
SOURCES += \
|
||||
docxformatlib_logic.cpp \
|
||||
common_formatlib.cpp \
|
||||
xlsxformatlib_logic.cpp
|
||||
|
||||
docxformatlib_logic.cpp
|
||||
}
|
||||
|
||||
core_debug {
|
||||
|
||||
@ -29,6 +29,8 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#include "common_formatlib.cpp"
|
||||
#include "xlsxformatlib_logic.cpp"
|
||||
|
||||
#include "../Source/DocxFormat/Logic/AlternateContent.cpp"
|
||||
#include "../Source/DocxFormat/Logic/Annotations.cpp"
|
||||
|
||||
@ -788,4 +788,7 @@
|
||||
|
||||
#define ASC_MENU_EVENT_TYPE_ON_EDIT_TEXT 22003
|
||||
|
||||
#define ASC_EVENT_TYPE_SPELLCHECK_MESSAGE 22004
|
||||
#define ASC_EVENT_TYPE_SPELLCHECK_TURN_ON 22005
|
||||
|
||||
#endif //_BUILD_EDITOR_DEFINES_CROSSPLATFORM_H_
|
||||
|
||||
10
Makefile
10
Makefile
@ -78,6 +78,7 @@ OOXMLSIGNATURE := $(LIBDIR)/$(LIB_PREFIX)ooxmlsignature$(LIB_EXT)
|
||||
HUNSPELL := $(LIBDIR)/$(LIB_PREFIX)hunspell$(SHARED_EXT)
|
||||
KERNEL := $(LIBDIR)/$(LIB_PREFIX)kernel$(SHARED_EXT)
|
||||
CRYPTOPP := $(LIBDIR)/$(LIB_PREFIX)CryptoPPLib$(LIB_EXT)
|
||||
VIDEOPLAYERLIB := $(LIBDIR)/$(LIB_PREFIX)videoplayer$(SHARED_EXT)
|
||||
|
||||
TARGETS += $(ALLFONTSGEN)
|
||||
TARGETS += $(X2T)
|
||||
@ -98,6 +99,7 @@ TARGETS += $(OOXMLSIGNATURE)
|
||||
TARGETS += $(HUNSPELL)
|
||||
TARGETS += $(KERNEL)
|
||||
TARGETS += $(CRYPTOPP)
|
||||
TARGETS += $(VIDEOPLAYERLIB)
|
||||
|
||||
X2T_PRO := $(abspath X2tConverter/build/Qt/X2tSLN.pro)
|
||||
HTMLFILEINTERNAL_PRO := $(abspath ../desktop-sdk/HtmlFile/Internal/Internal.pro)
|
||||
@ -118,6 +120,7 @@ OOXMLSIGNATURE_PRO := $(abspath DesktopEditor/xmlsec/src/ooxmlsignature.pro)
|
||||
HUNSPELL_PRO := $(abspath DesktopEditor/hunspell-1.3.3/src/qt/hunspell.pro)
|
||||
KERNEL_PRO := $(abspath Common/kernel.pro)
|
||||
CRYPTOPP_PRO := $(abspath Common/3dParty/cryptopp/project/cryptopp.pro)
|
||||
VIDEOPLAYERLIB_PRO := $(abspath ../core-ext/multimedia/videoplayer/lib/VideoPlayerLib.pro)
|
||||
|
||||
# PROS += $(basename $(X2T_PRO)).build
|
||||
# PROS += ALLFONTSGEN_PRO
|
||||
@ -150,6 +153,7 @@ QT_PROJ += OOXMLSIGNATURE
|
||||
QT_PROJ += HUNSPELL
|
||||
QT_PROJ += KERNEL
|
||||
QT_PROJ += CRYPTOPP
|
||||
QT_PROJ += VIDEOPLAYERLIB
|
||||
|
||||
X2T_DEP += $(PDFWRITER)
|
||||
X2T_DEP += $(GRAPHICS)
|
||||
@ -215,6 +219,8 @@ PDFWRITER_DEP += $(KERNEL)
|
||||
PDFWRITER_DEP += $(GRAPHICS)
|
||||
PDFWRITER_DEP += $(CRYPTOPP)
|
||||
|
||||
VIDEOPLAYERLIB_DEP += $(KERNEL)
|
||||
|
||||
ARCHIVE := ./$(PACKAGE_NAME)$(ARCH_EXT)
|
||||
|
||||
ARTIFACTS += build/*
|
||||
@ -266,6 +272,8 @@ ext: $(EXT_TARGET)
|
||||
|
||||
desktop: $(ASCDOCUMENTSCORE)
|
||||
|
||||
video: $(VIDEOPLAYERLIB)
|
||||
|
||||
$(foreach proj, $(QT_PROJ), $(eval $(call build_proj_tmpl, $(proj))))
|
||||
|
||||
$(X2T): $(X2T_DEP)
|
||||
@ -294,6 +302,8 @@ $(PDFREADER): $(PDFREADER_DEP)
|
||||
|
||||
$(PDFWRITER): $(PDFWRITER_DEP)
|
||||
|
||||
$(VIDEOPLAYERLIB): $(VIDEOPLAYERLIB_DEP)
|
||||
|
||||
%.build/Makefile: %.pro
|
||||
mkdir -p $(dir $@) && \
|
||||
cd $(dir $@) && \
|
||||
|
||||
Reference in New Issue
Block a user