mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cb051ec67d | |||
| 3033c59eaa | |||
| c455f1b420 | |||
| 7fdb44a93f | |||
| e53ba81da3 | |||
| da1f604f09 | |||
| 68e791c2fd | |||
| 30cdf52611 | |||
| 83f1a9e068 | |||
| df3382c616 | |||
| 70c886cd9a | |||
| 8cb6415915 | |||
| 279eaed9c8 | |||
| 078aa9c5e7 | |||
| b76463f8d1 | |||
| a2110b9947 | |||
| de2c16ed7c | |||
| 5aa32a21f6 | |||
| bec0a59ac1 | |||
| 9024feaf5d | |||
| 078d3bc991 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,7 +3,6 @@ dictionaries/
|
||||
LicenceManager/
|
||||
Common/boost_1_58_0
|
||||
Common/3dParty/boost/boost_1_58_0
|
||||
Common/3dParty/boost/boost.data
|
||||
Common/3dParty/boost/ios
|
||||
Common/3dParty/boost/osx
|
||||
Common/3dParty/icu/icu
|
||||
|
||||
@ -1344,7 +1344,7 @@ namespace DocFileFormat
|
||||
{
|
||||
ParagraphPropertyExceptions* backup = _lastValidPapx;
|
||||
|
||||
std::map<short, short> mapBoundaries;
|
||||
std::map<short, short> boundaries;
|
||||
|
||||
int cp = initialCp;
|
||||
int fc = m_document->FindFileCharPos( cp );
|
||||
@ -1388,8 +1388,7 @@ namespace DocFileFormat
|
||||
}
|
||||
if (nestingLevel == iTap_current)
|
||||
{
|
||||
bool bPresent = false; //118854.doc
|
||||
for ( std::list<SinglePropertyModifier>::reverse_iterator iter = papx->grpprl->rbegin(); !bPresent && iter != papx->grpprl->rend(); iter++ )
|
||||
for ( std::list<SinglePropertyModifier>::iterator iter = papx->grpprl->begin(); iter != papx->grpprl->end(); iter++ )
|
||||
{
|
||||
//find the tDef SPRM
|
||||
DWORD code = iter->OpCode;
|
||||
@ -1407,27 +1406,19 @@ namespace DocFileFormat
|
||||
boundary1 = FormatUtils::BytesToInt16( iter->Arguments + 1, i * 2 , iter->argumentsSize );
|
||||
boundary2 = FormatUtils::BytesToInt16( iter->Arguments + 1, ( i + 1 ) * 2, iter->argumentsSize );
|
||||
|
||||
//if (boundary1 < 0) boundary1 = 0;
|
||||
//if (boundary2 < 0) boundary2 = 0;
|
||||
|
||||
mapBoundaries.insert(std::make_pair(boundary1, 0));
|
||||
mapBoundaries.insert(std::make_pair(boundary2, 0));
|
||||
//AddBoundary(boundary1, boundary2, mapBoundaries);
|
||||
AddBoundary(boundary1, boundary2, boundaries);
|
||||
}
|
||||
if (max_boundary < boundary2)
|
||||
max_boundary = boundary2;
|
||||
|
||||
mapBoundaries.insert(std::make_pair(boundary2, 0));
|
||||
mapBoundaries.insert(std::make_pair(max_boundary, 0));
|
||||
//AddBoundary(boundary2, max_boundary, mapBoundaries);
|
||||
bPresent = true;
|
||||
AddBoundary(boundary2, max_boundary, boundaries);
|
||||
}break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (nestingLevel != iTap_current && fEndNestingLevel && !mapBoundaries.empty())
|
||||
if (nestingLevel != iTap_current && fEndNestingLevel && !boundaries.empty())
|
||||
break;
|
||||
//get the next papx
|
||||
papx = findValidPapx( fcRowEnd );
|
||||
@ -1440,16 +1431,11 @@ namespace DocFileFormat
|
||||
|
||||
}
|
||||
|
||||
if ( !mapBoundaries.empty() )
|
||||
if ( !boundaries.empty() )
|
||||
{
|
||||
std::map<short, short>::iterator it = mapBoundaries.begin();
|
||||
std::map<short, short>::iterator it_next = it; it_next++;
|
||||
|
||||
for ( ; it_next != mapBoundaries.end(); ++it_next, ++it)
|
||||
for ( std::map<short, short>::iterator it = boundaries.begin(); it != boundaries.end(); ++it)
|
||||
{
|
||||
int sz = it_next->first - it->first;
|
||||
if (sz > 2)
|
||||
grid.push_back( it_next->first - it->first );
|
||||
grid.push_back( it->second );
|
||||
}
|
||||
}
|
||||
_lastValidPapx = backup;
|
||||
|
||||
@ -77,13 +77,13 @@ namespace DocFileFormat
|
||||
}
|
||||
|
||||
StringTable( VirtualStreamReader *reader, int code_page_ ):
|
||||
code_page(code_page_), fExtend(false), cbData(0), cbExtra(0)
|
||||
code_page(code_page_), fExtend(false), cbData(0), cbExtra(0), DataExtra(NULL)
|
||||
{
|
||||
parse( reader, (unsigned int)reader->GetPosition(), 0, false );
|
||||
}
|
||||
|
||||
StringTable( POLE::Stream* tableStream, unsigned int fc, unsigned int lcb, int nWordVersion, bool bReadExta = false) :
|
||||
code_page(1250), fExtend(false), cbData(0), cbExtra(0)
|
||||
code_page(1250), fExtend(false), cbData(0), cbExtra(0), DataExtra(NULL)
|
||||
{
|
||||
if ( lcb > 0 )
|
||||
{
|
||||
|
||||
@ -96,100 +96,94 @@ namespace DocFileFormat
|
||||
break;
|
||||
}
|
||||
}
|
||||
std::list<SinglePropertyModifier>::const_reverse_iterator rend = tapx->grpprl->rend();
|
||||
|
||||
|
||||
bool bPresentDefTable = false;
|
||||
for (std::list<SinglePropertyModifier>::reverse_iterator iter = tapx->grpprl->rbegin(); iter != tapx->grpprl->rend(); ++iter)
|
||||
for (std::list<SinglePropertyModifier>::const_reverse_iterator iter = tapx->grpprl->rbegin(); iter != rend; ++iter)
|
||||
{
|
||||
switch (iter->OpCode)
|
||||
{
|
||||
case sprmOldTDefTable:
|
||||
case sprmTDefTable:
|
||||
{
|
||||
if (!bPresentDefTable) //118854.doc
|
||||
SprmTDefTable tdef(iter->Arguments, iter->argumentsSize);
|
||||
int cc = tdef.numberOfColumns;
|
||||
|
||||
_tGrid = tdef.rgdxaCenter;
|
||||
_tcDef = tdef.rgTc80[(std::min)(_cellIndex, (int)tdef.rgTc80.size() - 1)];
|
||||
|
||||
appendValueElement( _tcPr, L"textDirection", FormatUtils::MapValueToWideString( _tcDef.textFlow, &Global::TextFlowMap[0][0], 6, 6 ), false );
|
||||
|
||||
if ( _tcDef.vertMerge == Global::fvmMerge )
|
||||
{
|
||||
bPresentDefTable = true;
|
||||
appendValueElement( _tcPr, L"vMerge", L"continue", false );
|
||||
}
|
||||
else if ( _tcDef.vertMerge == Global::fvmRestart )
|
||||
{
|
||||
appendValueElement( _tcPr, L"vMerge", L"restart", false );
|
||||
}
|
||||
|
||||
SprmTDefTable tdef(iter->Arguments, iter->argumentsSize);
|
||||
int cc = tdef.numberOfColumns;
|
||||
appendValueElement( _tcPr, L"vAlign", FormatUtils::MapValueToWideString( _tcDef.vertAlign, &Global::VerticalAlignMap[0][0], 3, 7 ), false );
|
||||
|
||||
_tGrid = tdef.rgdxaCenter;
|
||||
_tcDef = tdef.rgTc80[(std::min)(_cellIndex, (int)tdef.rgTc80.size() - 1)];
|
||||
if ( _tcDef.fFitText )
|
||||
{
|
||||
appendValueElement( _tcPr, L"tcFitText", L"", false );
|
||||
}
|
||||
|
||||
appendValueElement( _tcPr, L"textDirection", FormatUtils::MapValueToWideString( _tcDef.textFlow, &Global::TextFlowMap[0][0], 6, 6 ), false );
|
||||
if ( _tcDef.fNoWrap )
|
||||
{
|
||||
appendValueElement( _tcPr, L"noWrap", L"", true );
|
||||
}
|
||||
//int ind = (std::min)(_cellIndex, (int)tdef.rgTc80.size() - 1);
|
||||
//int ind1 = ind;
|
||||
//while (ind1 < tdef.rgdxaCenter.size() - 1)
|
||||
//{
|
||||
// int sz = tdef.rgdxaCenter[ ind1 + 1] - tdef.rgdxaCenter[ ind1 ] ;
|
||||
// if (sz > 1)
|
||||
// break;
|
||||
// ind1++;
|
||||
//}
|
||||
|
||||
if ( _tcDef.vertMerge == Global::fvmMerge )
|
||||
if (tdef.rgTc80[_cellIndex].horzMerge == 1)
|
||||
{
|
||||
for (size_t i = _cellIndex; i < tdef.rgTc80.size(); i++)
|
||||
{
|
||||
appendValueElement( _tcPr, L"vMerge", L"continue", false );
|
||||
}
|
||||
else if ( _tcDef.vertMerge == Global::fvmRestart )
|
||||
{
|
||||
appendValueElement( _tcPr, L"vMerge", L"restart", false );
|
||||
if (tdef.rgTc80[i].horzMerge < 1)
|
||||
break;
|
||||
|
||||
nComputedCellWidth += tdef.rgdxaCenter[ i + 1] - tdef.rgdxaCenter[ i ] ;
|
||||
_gridSpan++;
|
||||
}
|
||||
}
|
||||
else if (tdef.rgTc80[_cellIndex].horzMerge == 2)
|
||||
{//skip cover cell
|
||||
_gridSpan = 1;
|
||||
nComputedCellWidth = 0;
|
||||
_bCoverCell = true;
|
||||
|
||||
appendValueElement( _tcPr, L"vAlign", FormatUtils::MapValueToWideString( _tcDef.vertAlign, &Global::VerticalAlignMap[0][0], 3, 7 ), false );
|
||||
}
|
||||
else
|
||||
{
|
||||
_gridSpan = 1;
|
||||
|
||||
if ( _tcDef.fFitText )
|
||||
{
|
||||
appendValueElement( _tcPr, L"tcFitText", L"", false );
|
||||
}
|
||||
nComputedCellWidths += (tdef.rgdxaCenter[ _cellIndex + 1] - tdef.rgdxaCenter[ 0 ]);
|
||||
nComputedCellWidth += tdef.rgTc80[ _cellIndex].wWidth > 1 ? tdef.rgTc80[ _cellIndex].wWidth : (tdef.rgdxaCenter[ _cellIndex + 1] - tdef.rgdxaCenter[ _cellIndex ]);
|
||||
//Технические_Требования_1_287_ДИТ.DOC
|
||||
|
||||
if ( _tcDef.fNoWrap )
|
||||
{
|
||||
appendValueElement( _tcPr, L"noWrap", L"", true );
|
||||
}
|
||||
//int ind = (std::min)(_cellIndex, (int)tdef.rgTc80.size() - 1);
|
||||
//int ind1 = ind;
|
||||
//while (ind1 < tdef.rgdxaCenter.size() - 1)
|
||||
//{
|
||||
// int sz = tdef.rgdxaCenter[ ind1 + 1] - tdef.rgdxaCenter[ ind1 ] ;
|
||||
// if (sz > 1)
|
||||
// break;
|
||||
// ind1++;
|
||||
//}
|
||||
}
|
||||
|
||||
if (tdef.rgTc80[_cellIndex].horzMerge == 1)
|
||||
{
|
||||
for (size_t i = _cellIndex; i < tdef.rgTc80.size(); i++)
|
||||
{
|
||||
if (tdef.rgTc80[i].horzMerge < 1)
|
||||
break;
|
||||
|
||||
nComputedCellWidth += tdef.rgdxaCenter[ i + 1] - tdef.rgdxaCenter[ i ] ;
|
||||
_gridSpan++;
|
||||
}
|
||||
}
|
||||
else if (tdef.rgTc80[_cellIndex].horzMerge == 2)
|
||||
{//skip cover cell
|
||||
_gridSpan = 1;
|
||||
nComputedCellWidth = 0;
|
||||
_bCoverCell = true;
|
||||
if (!IsTableBordersDefined(tapx->grpprl))
|
||||
{
|
||||
RELEASEOBJECT(_brcTop);
|
||||
_brcTop = new BorderCode(*_tcDef.brcTop);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
_gridSpan = 1;
|
||||
RELEASEOBJECT(_brcLeft);
|
||||
_brcLeft = new BorderCode(*_tcDef.brcLeft);
|
||||
|
||||
nComputedCellWidths += (tdef.rgdxaCenter[ _cellIndex + 1] - tdef.rgdxaCenter[ 0 ]);
|
||||
nComputedCellWidth += tdef.rgTc80[ _cellIndex].wWidth > 1 ? tdef.rgTc80[ _cellIndex].wWidth : (tdef.rgdxaCenter[ _cellIndex + 1] - tdef.rgdxaCenter[ _cellIndex ]);
|
||||
//Технические_Требования_1_287_ДИТ.DOC
|
||||
RELEASEOBJECT(_brcRight);
|
||||
_brcRight = new BorderCode(*_tcDef.brcRight);
|
||||
|
||||
}
|
||||
|
||||
if (!IsTableBordersDefined(tapx->grpprl))
|
||||
{
|
||||
RELEASEOBJECT(_brcTop);
|
||||
_brcTop = new BorderCode(*_tcDef.brcTop);
|
||||
|
||||
RELEASEOBJECT(_brcLeft);
|
||||
_brcLeft = new BorderCode(*_tcDef.brcLeft);
|
||||
|
||||
RELEASEOBJECT(_brcRight);
|
||||
_brcRight = new BorderCode(*_tcDef.brcRight);
|
||||
|
||||
RELEASEOBJECT(_brcBottom);
|
||||
_brcBottom = new BorderCode(*_tcDef.brcBottom);
|
||||
}
|
||||
RELEASEOBJECT(_brcBottom);
|
||||
_brcBottom = new BorderCode(*_tcDef.brcBottom);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@ -225,11 +225,8 @@ namespace DocFileFormat
|
||||
documentMapping->m_document->nWordVersion);
|
||||
|
||||
std::list<CharacterPropertyExceptions*>* chpxs = documentMapping->m_document->GetCharacterPropertyExceptions( fcRowEnd, fcRowEnd + 1 );
|
||||
if (chpxs)
|
||||
{
|
||||
TableRowPropertiesMapping trpMapping( documentMapping->GetXMLWriter(), *(chpxs->begin()) );
|
||||
tapx.Convert( &trpMapping );
|
||||
}
|
||||
TableRowPropertiesMapping trpMapping( documentMapping->GetXMLWriter(), *(chpxs->begin()) );
|
||||
tapx.Convert( &trpMapping );
|
||||
|
||||
documentMapping->_lastValidPapx = papxBackup;
|
||||
documentMapping->_lastValidSepx = sepxBackup;
|
||||
|
||||
@ -1116,14 +1116,7 @@ namespace DocFileFormat
|
||||
|
||||
m_context->_doc->Convert(&textboxMapping);
|
||||
|
||||
std::wstring sOleXml = textboxMapping.getOLEObject();
|
||||
|
||||
if (false == sOleXml.empty())
|
||||
m_pXmlWriter->WriteString(sOleXml);
|
||||
else
|
||||
{
|
||||
m_pXmlWriter->WriteString(txtBoxWrapper.GetXmlString());
|
||||
}
|
||||
m_pXmlWriter->WriteString(textboxMapping.getOLEObject());
|
||||
}
|
||||
|
||||
//ShapeType
|
||||
@ -1799,9 +1792,6 @@ namespace DocFileFormat
|
||||
if (dAngle < -360.0)
|
||||
dAngle += 360.0;
|
||||
|
||||
if (dAngle > 360.0)
|
||||
dAngle -= 360.0;
|
||||
|
||||
if ((dAngle >= 45.0 && dAngle <= 135.0) || (dAngle >= 225.0 && dAngle <= 315.0) || (dAngle <= -45.0 && dAngle >= -135.0) || (dAngle <= -225.0 && dAngle >= -315.0))
|
||||
twistDimensions = true;
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="windows-1251"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Version="8,00"
|
||||
Name="DocFormatTest"
|
||||
ProjectGUID="{0F49D5D1-A8D3-4F97-8BC1-E2F65BB00C10}"
|
||||
RootNamespace="PptFormatTest"
|
||||
@ -397,10 +397,6 @@
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ASCOfficeDocxFile2\BinReader\FileWriter.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ASCOfficeDocxFile2\DocWrapper\FontProcessor.cpp"
|
||||
>
|
||||
|
||||
@ -29,9 +29,10 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef COMMENTS_WRITER
|
||||
#define COMMENTS_WRITER
|
||||
|
||||
#include "HeaderFooterWriter.h"
|
||||
#include "../../XlsxSerializerCom/Common/Common.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/FileTypes.h"
|
||||
|
||||
namespace Writers
|
||||
@ -48,9 +49,8 @@ namespace Writers
|
||||
class CommentsWriter
|
||||
{
|
||||
std::wstring m_sDir;
|
||||
std::wstring m_sFileName;
|
||||
public:
|
||||
std::wstring m_sComment;
|
||||
std::wstring m_sComment;
|
||||
std::wstring m_sCommentExt;
|
||||
std::wstring m_sCommentsIds;
|
||||
std::wstring m_sPeople;
|
||||
@ -73,10 +73,6 @@ namespace Writers
|
||||
m_sDocumentCommentsIds = sDocumentCommentsIds;
|
||||
m_sDocumentPeople = sDocumentPeople;
|
||||
}
|
||||
std::wstring getFilename()
|
||||
{
|
||||
return OOX::FileTypes::Comments.DefaultFileName().GetPath();
|
||||
}
|
||||
void Write()
|
||||
{
|
||||
std::wstring sDir = m_sDir + FILE_SEPARATOR_STR + _T("word") + FILE_SEPARATOR_STR;
|
||||
@ -160,4 +156,5 @@ namespace Writers
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
#endif // #ifndef COMMENTS_WRITER
|
||||
|
||||
@ -1,91 +0,0 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2019
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
|
||||
* street, Riga, Latvia, EU, LV-1050.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "FileWriter.h"
|
||||
|
||||
#include "ReaderClasses.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Core.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/App.h"
|
||||
|
||||
namespace Writers
|
||||
{
|
||||
|
||||
FileWriter::FileWriter(std::wstring sDirOutput,std::wstring sFontDir, bool bNoFontDir, int nVersion, bool bSaveChartAsImg, NSBinPptxRW::CDrawingConverter* pDrawingConverter, std::wstring sThemePath)
|
||||
:
|
||||
m_oFontTableWriter (sDirOutput, sFontDir, bNoFontDir),
|
||||
m_oDocumentWriter (sDirOutput, m_oHeaderFooterWriter),
|
||||
m_oMediaWriter (sDirOutput),
|
||||
m_oStylesWriter (sDirOutput, nVersion),
|
||||
m_oNumberingWriter (sDirOutput),
|
||||
m_oHeaderFooterWriter (sDirOutput),
|
||||
m_oFootnotesWriter (sDirOutput),
|
||||
m_oEndnotesWriter (sDirOutput),
|
||||
m_oSettingWriter (sDirOutput, m_oHeaderFooterWriter),
|
||||
m_oCommentsWriter (sDirOutput),
|
||||
m_oChartWriter (sDirOutput),
|
||||
m_oDocumentRelsWriter (sDirOutput),
|
||||
m_oWebSettingsWriter (sDirOutput),
|
||||
m_oCustomXmlWriter (sDirOutput, pDrawingConverter),
|
||||
m_pDrawingConverter (pDrawingConverter),
|
||||
m_bSaveChartAsImg (bSaveChartAsImg),
|
||||
m_sThemePath (sThemePath),
|
||||
m_nDocPrIndex (0),
|
||||
m_pComments (NULL),
|
||||
m_pApp (NULL),
|
||||
m_pCore (NULL)
|
||||
{
|
||||
}
|
||||
FileWriter::~FileWriter()
|
||||
{
|
||||
RELEASEOBJECT(m_pApp);
|
||||
RELEASEOBJECT(m_pCore);
|
||||
}
|
||||
void FileWriter::Write()
|
||||
{
|
||||
m_oCommentsWriter.Write();
|
||||
m_oChartWriter.Write();
|
||||
m_oStylesWriter.Write();
|
||||
m_oNumberingWriter.Write();
|
||||
m_oFontTableWriter.Write();
|
||||
m_oHeaderFooterWriter.Write();
|
||||
m_oFootnotesWriter.Write();
|
||||
m_oEndnotesWriter.Write();
|
||||
//Setting пишем после HeaderFooter, чтобы заполнить evenAndOddHeaders
|
||||
m_oSettingWriter.Write();
|
||||
m_oWebSettingsWriter.Write();
|
||||
//Document пишем после HeaderFooter, чтобы заполнить sectPr
|
||||
m_oDocumentWriter.Write();
|
||||
//Rels и ContentTypes пишем в конце
|
||||
m_oDocumentRelsWriter.Write();
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,7 +29,8 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef FILE_WRITER
|
||||
#define FILE_WRITER
|
||||
|
||||
#include "../../DesktopEditor/common/Path.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h"
|
||||
@ -94,15 +95,57 @@ namespace Writers
|
||||
OOX::CApp* m_pApp;
|
||||
OOX::CCore* m_pCore;
|
||||
|
||||
FileWriter (std::wstring sDirOutput,std::wstring sFontDir, bool bNoFontDir, int nVersion, bool bSaveChartAsImg, NSBinPptxRW::CDrawingConverter* pDrawingConverter, std::wstring sThemePath);
|
||||
|
||||
~FileWriter();
|
||||
FileWriter (std::wstring sDirOutput,std::wstring sFontDir, bool bNoFontDir, int nVersion, bool bSaveChartAsImg, NSBinPptxRW::CDrawingConverter* pDrawingConverter, std::wstring sThemePath)
|
||||
: m_pDrawingConverter(pDrawingConverter), m_sThemePath(sThemePath), m_bSaveChartAsImg(bSaveChartAsImg),
|
||||
m_oFontTableWriter (sDirOutput, sFontDir, bNoFontDir),
|
||||
m_oHeaderFooterWriter (sDirOutput),
|
||||
m_oFootnotesWriter (sDirOutput),
|
||||
m_oEndnotesWriter (sDirOutput),
|
||||
m_oMediaWriter (sDirOutput),
|
||||
m_oStylesWriter (sDirOutput, nVersion),
|
||||
m_oNumberingWriter (sDirOutput),
|
||||
m_oDocumentWriter (sDirOutput, m_oHeaderFooterWriter),
|
||||
m_oSettingWriter (sDirOutput, m_oHeaderFooterWriter),
|
||||
m_oCommentsWriter (sDirOutput),
|
||||
m_oChartWriter (sDirOutput),
|
||||
m_oDocumentRelsWriter (sDirOutput),
|
||||
m_oWebSettingsWriter (sDirOutput),
|
||||
m_nDocPrIndex(0),
|
||||
m_pComments(NULL),
|
||||
m_oCustomXmlWriter (sDirOutput, pDrawingConverter),
|
||||
m_pApp (NULL),
|
||||
m_pCore (NULL)
|
||||
{
|
||||
}
|
||||
~FileWriter()
|
||||
{
|
||||
RELEASEOBJECT(m_pApp);
|
||||
RELEASEOBJECT(m_pCore);
|
||||
}
|
||||
int getNextDocPr()
|
||||
{
|
||||
m_nDocPrIndex++;
|
||||
return m_nDocPrIndex;
|
||||
}
|
||||
|
||||
void Write();
|
||||
void Write()
|
||||
{
|
||||
m_oCommentsWriter.Write();
|
||||
m_oChartWriter.Write();
|
||||
m_oStylesWriter.Write();
|
||||
m_oNumberingWriter.Write();
|
||||
m_oFontTableWriter.Write();
|
||||
m_oHeaderFooterWriter.Write();
|
||||
m_oFootnotesWriter.Write();
|
||||
m_oEndnotesWriter.Write();
|
||||
//Setting пишем после HeaderFooter, чтобы заполнить evenAndOddHeaders
|
||||
m_oSettingWriter.Write();
|
||||
m_oWebSettingsWriter.Write();
|
||||
//Document пишем после HeaderFooter, чтобы заполнить sectPr
|
||||
m_oDocumentWriter.Write();
|
||||
//Rels и ContentTypes пишем в конце
|
||||
m_oDocumentRelsWriter.Write();
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif // #ifndef FILE_WRITER
|
||||
|
||||
@ -29,7 +29,8 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef HEADER_FOOTER_WRITER
|
||||
#define HEADER_FOOTER_WRITER
|
||||
|
||||
#include "../../XlsxSerializerCom/Common/Common.h"
|
||||
#include "../../Common/DocxFormat/Source/Common/SimpleTypes_Word.h"
|
||||
@ -59,8 +60,8 @@ namespace Writers
|
||||
std::wstring rId;
|
||||
SimpleTypes::EHdrFtr eType;
|
||||
};
|
||||
static std::wstring g_string_xml_start = L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>";
|
||||
static std::wstring g_string_xmlns = L"xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" \
|
||||
static std::wstring g_string_hdr_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\
|
||||
<w:hdr xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" \
|
||||
xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \
|
||||
xmlns:o=\"urn:schemas-microsoft-com:office:office\" \
|
||||
xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" \
|
||||
@ -77,19 +78,35 @@ xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" \
|
||||
xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" \
|
||||
xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" \
|
||||
xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" \
|
||||
mc:Ignorable=\"w14 w15 wp14\">";
|
||||
|
||||
static std::wstring g_string_hdr_Start = g_string_xml_start + L"<w:hdr " + g_string_xmlns;
|
||||
static std::wstring g_string_hdr_End = L"</w:hdr>";
|
||||
mc:Ignorable=\"w14 w15 wp14\">");
|
||||
static std::wstring g_string_hdr_End = _T("</w:hdr>");
|
||||
|
||||
static std::wstring g_string_ftr_Start = g_string_xml_start + L"<w:ftr " + g_string_xmlns;
|
||||
static std::wstring g_string_ftr_End = L"</w:ftr>";
|
||||
static std::wstring g_string_ftr_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\
|
||||
<w:ftr xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" \
|
||||
xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \
|
||||
xmlns:o=\"urn:schemas-microsoft-com:office:office\" \
|
||||
xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" \
|
||||
xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" \
|
||||
xmlns:v=\"urn:schemas-microsoft-com:vml\" \
|
||||
xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" \
|
||||
xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" \
|
||||
xmlns:w10=\"urn:schemas-microsoft-com:office:word\" \
|
||||
xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" \
|
||||
xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" \
|
||||
xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" \
|
||||
xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" \
|
||||
xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" \
|
||||
xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" \
|
||||
xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" \
|
||||
xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" \
|
||||
mc:Ignorable=\"w14 w15 wp14\">");
|
||||
static std::wstring g_string_ftr_End = _T("</w:ftr>");
|
||||
|
||||
static std::wstring g_string_footnotes_Start = g_string_xml_start + L"<w:footnotes " + g_string_xmlns;
|
||||
static std::wstring g_string_footnotes_End = L"</w:footnotes>";
|
||||
static std::wstring g_string_footnotes_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:footnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" mc:Ignorable=\"w14 w15 wp14\">");
|
||||
static std::wstring g_string_footnotes_End = _T("</w:footnotes>");
|
||||
|
||||
static std::wstring g_string_endnotes_Start = g_string_xml_start + L"<w:endnotes " + g_string_xmlns;
|
||||
static std::wstring g_string_endnotes_End = L"</w:endnotes>";
|
||||
static std::wstring g_string_endnotes_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:endnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" mc:Ignorable=\"w14 w15 wp14\">");
|
||||
static std::wstring g_string_endnotes_End = _T("</w:endnotes>");
|
||||
|
||||
class HeaderFooterWriter
|
||||
{
|
||||
@ -116,17 +133,17 @@ mc:Ignorable=\"w14 w15 wp14\">";
|
||||
for(size_t i = 0, length = m_aHeaders.size(); i < length; ++i)
|
||||
{
|
||||
HdrFtrItem* pHeader = m_aHeaders[i];
|
||||
WriteItem(L"header", pHeader->m_sFilename, pHeader->Header, true);
|
||||
WriteItem(_T("header"), pHeader->m_sFilename, pHeader->Header, true);
|
||||
}
|
||||
for(size_t i = 0, length = m_aFooters.size(); i < length; ++i)
|
||||
{
|
||||
HdrFtrItem* pFooter = m_aFooters[i];
|
||||
WriteItem(L"footer", pFooter->m_sFilename, pFooter->Header, false);
|
||||
WriteItem(_T("footer"), pFooter->m_sFilename, pFooter->Header, false);
|
||||
}
|
||||
}
|
||||
void WriteItem( std::wstring sHeader, std::wstring& sFilename, ContentWriter& m_oWriter, bool bHeader)
|
||||
{
|
||||
OOX::CPath filePath = m_sDir + FILE_SEPARATOR_STR + L"word" + FILE_SEPARATOR_STR + sFilename;
|
||||
OOX::CPath filePath = m_sDir + FILE_SEPARATOR_STR +_T("word") + FILE_SEPARATOR_STR + sFilename;
|
||||
|
||||
NSFile::CFileBinary oFile;
|
||||
oFile.CreateFileW(filePath.GetPath());
|
||||
@ -169,7 +186,7 @@ mc:Ignorable=\"w14 w15 wp14\">";
|
||||
}
|
||||
std::wstring getFilename()
|
||||
{
|
||||
return L"footnotes.xml";
|
||||
return _T("footnotes.xml");
|
||||
}
|
||||
bool IsEmpty()
|
||||
{
|
||||
@ -191,7 +208,7 @@ mc:Ignorable=\"w14 w15 wp14\">";
|
||||
|
||||
std::wstring sFilename = getFilename();
|
||||
|
||||
std::wstring filePath = m_sDir + FILE_SEPARATOR_STR + L"word" + FILE_SEPARATOR_STR + sFilename;
|
||||
std::wstring filePath = m_sDir + FILE_SEPARATOR_STR +_T("word") + FILE_SEPARATOR_STR + sFilename;
|
||||
|
||||
NSFile::CFileBinary oFile;
|
||||
oFile.CreateFileW(filePath);
|
||||
@ -202,7 +219,7 @@ mc:Ignorable=\"w14 w15 wp14\">";
|
||||
}
|
||||
std::wstring getFilename()
|
||||
{
|
||||
return L"endnotes.xml";
|
||||
return _T("endnotes.xml");
|
||||
}
|
||||
bool IsEmpty()
|
||||
{
|
||||
@ -210,3 +227,4 @@ mc:Ignorable=\"w14 w15 wp14\">";
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif // #ifndef HEADER_FOOTER_WRITER
|
||||
|
||||
@ -31,7 +31,8 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "HeaderFooterWriter.h"
|
||||
#ifndef READER_CLASSES
|
||||
#define READER_CLASSES
|
||||
|
||||
#include "../../Common/DocxFormat/Source/XML/Utils.h"
|
||||
#include "../../Common/DocxFormat/Source/Common/SimpleTypes_Word.h"
|
||||
@ -730,12 +731,12 @@ public:
|
||||
{
|
||||
pCStringWriter->WriteString(L"<w:sz w:val=\"" + std::to_wstring(FontSize) + L"\"/>");
|
||||
}
|
||||
if(bFontSizeCs)
|
||||
{
|
||||
if(false == bFontSize)
|
||||
pCStringWriter->WriteString(L"<w:sz w:val=\"" + std::to_wstring(FontSizeCs) + L"\"/>");
|
||||
pCStringWriter->WriteString(L"<w:szCs w:val=\"" + std::to_wstring(FontSizeCs) + L"\"/>");
|
||||
}
|
||||
if(bFontSizeCs)
|
||||
{
|
||||
if(false == bFontSize)
|
||||
pCStringWriter->WriteString(L"<w:sz w:val=\"" + std::to_wstring(FontSizeCs) + L"\"/>");
|
||||
pCStringWriter->WriteString(L"<w:szCs w:val=\"" + std::to_wstring(FontSizeCs) + L"\"/>");
|
||||
}
|
||||
if(bHighLight)
|
||||
{
|
||||
docRGB& H = HighLight;
|
||||
@ -1771,9 +1772,9 @@ public:
|
||||
if(bGridAfter && nGridAfter > 0)
|
||||
{
|
||||
writer.WriteString(L"<w:grid" + sName + L" w:val=\"" + std::to_wstring(nGridAfter) + L"\"/>");
|
||||
if(oAfterWidth.bW)
|
||||
oAfterWidth.Write(writer, _T("w:w") + sName);
|
||||
}
|
||||
if(oAfterWidth.bW)
|
||||
oAfterWidth.Write(writer, _T("w:w") + sName);
|
||||
}
|
||||
};
|
||||
class WriteHyperlink
|
||||
@ -1905,19 +1906,12 @@ public:
|
||||
m_nId += nCount;
|
||||
return nRes;
|
||||
}
|
||||
int getCurrentId()
|
||||
{
|
||||
return m_nId;
|
||||
}
|
||||
};
|
||||
class CComment
|
||||
{
|
||||
class CComment{
|
||||
private:
|
||||
IdCounter& m_oParaIdCounter;
|
||||
IdCounter& m_oFormatIdCounter;
|
||||
public:
|
||||
void *pBinary_DocumentTableReader;
|
||||
|
||||
int IdOpen;
|
||||
int IdFormat;
|
||||
std::wstring UserName;
|
||||
@ -1929,10 +1923,8 @@ public:
|
||||
bool Solved;
|
||||
unsigned int DurableId;
|
||||
std::wstring Text;
|
||||
std::wstring sContent;
|
||||
|
||||
std::wstring sParaId;
|
||||
std::wstring sParaIdParent;
|
||||
std::wstring m_sParaId;
|
||||
std::wstring m_sParaIdParent;
|
||||
std::vector<CComment*> replies;
|
||||
|
||||
bool bIdOpen;
|
||||
@ -2003,8 +1995,8 @@ public:
|
||||
|
||||
int nId = pComment->m_oParaIdCounter.getNextId();
|
||||
|
||||
pComment->sParaId = XmlUtils::IntToString(nId, L"%08X");
|
||||
sRes += L"<w:p w14:paraId=\"" + pComment->sParaId + L"\" w14:textId=\"" + pComment->sParaId + L"\">";
|
||||
pComment->m_sParaId = XmlUtils::IntToString(nId, L"%08X");
|
||||
sRes += L"<w:p w14:paraId=\"" + pComment->m_sParaId + L"\" w14:textId=\"" + pComment->m_sParaId + L"\">";
|
||||
sRes += L"<w:pPr><w:spacing w:line=\"240\" w:after=\"0\" w:lineRule=\"auto\" w:before=\"0\"/><w:ind w:firstLine=\"0\" w:left=\"0\" w:right=\"0\"/><w:jc w:val=\"left\"/></w:pPr><w:r><w:rPr><w:rFonts w:eastAsia=\"Arial\" w:ascii=\"Arial\" w:hAnsi=\"Arial\" w:cs=\"Arial\"/><w:sz w:val=\"22\"/></w:rPr><w:t xml:space=\"preserve\">";
|
||||
sRes += sPart;
|
||||
sRes += L"</w:t></w:r></w:p>";
|
||||
@ -2046,58 +2038,49 @@ public:
|
||||
sRes += L"\"";
|
||||
}
|
||||
sRes += L">";
|
||||
std::wstring sText = pComment->Text;
|
||||
|
||||
if (false == pComment->sContent.empty())
|
||||
XmlUtils::replace_all(sText, L"\r", L"");
|
||||
|
||||
int nPrevIndex = 0;
|
||||
for (int i = 0; i < (int)sText.length(); i++)
|
||||
{
|
||||
sRes += pComment->sContent;
|
||||
}
|
||||
else
|
||||
{
|
||||
//old comments
|
||||
std::wstring sText = pComment->Text;
|
||||
|
||||
XmlUtils::replace_all(sText, L"\r", L"");
|
||||
|
||||
int nPrevIndex = 0;
|
||||
for (int i = 0; i < (int)sText.length(); i++)
|
||||
wchar_t cToken = sText[i];
|
||||
if('\n' == cToken)
|
||||
{
|
||||
wchar_t cToken = sText[i];
|
||||
if('\n' == cToken)
|
||||
{
|
||||
writeContentWritePart(pComment, sText, nPrevIndex, i, sRes);
|
||||
nPrevIndex = i + 1;
|
||||
}
|
||||
writeContentWritePart(pComment, sText, nPrevIndex, i, sRes);
|
||||
nPrevIndex = i + 1;
|
||||
}
|
||||
writeContentWritePart(pComment, sText, nPrevIndex, (int)sText.length(), sRes);
|
||||
}
|
||||
sRes += L"</w:comment>";
|
||||
}
|
||||
writeContentWritePart(pComment, sText, nPrevIndex, (int)sText.length(), sRes);
|
||||
sRes += L"</w:comment>";
|
||||
return sRes;
|
||||
}
|
||||
static std::wstring writeContentExt(CComment* pComment)
|
||||
{
|
||||
std::wstring sRes;
|
||||
if(false == pComment->sParaId.empty())
|
||||
if(!pComment->m_sParaId.empty())
|
||||
{
|
||||
std::wstring sDone(L"0");
|
||||
if(pComment->bSolved && pComment->Solved)
|
||||
sDone = _T("1");
|
||||
if(!pComment->sParaIdParent.empty())
|
||||
sRes += L"<w15:commentEx w15:paraId=\"" + pComment->sParaId + L"\" \
|
||||
w15:paraIdParent=\"" + pComment->sParaIdParent + L"\" w15:done=\"" + sDone + L"\"/>";
|
||||
if(!pComment->m_sParaIdParent.empty())
|
||||
sRes += L"<w15:commentEx w15:paraId=\"" + pComment->m_sParaId + L"\" \
|
||||
w15:paraIdParent=\"" + pComment->m_sParaIdParent + L"\" w15:done=\"" + sDone + L"\"/>";
|
||||
else
|
||||
sRes += L"<w15:commentEx w15:paraId=\"" + pComment->sParaId + L"\" w15:done=\"" + sDone + L"\"/>";
|
||||
sRes += L"<w15:commentEx w15:paraId=\"" + pComment->m_sParaId + L"\" w15:done=\"" + sDone + L"\"/>";
|
||||
//расставляем paraIdParent
|
||||
for(size_t i = 0; i < pComment->replies.size(); i++)
|
||||
pComment->replies[i]->sParaIdParent = pComment->sParaId;
|
||||
pComment->replies[i]->m_sParaIdParent = pComment->m_sParaId;
|
||||
}
|
||||
return sRes;
|
||||
}
|
||||
static std::wstring writeContentsIds(CComment* pComment)
|
||||
{
|
||||
std::wstring sRes;
|
||||
if(!pComment->sParaId.empty() && pComment->bDurableId)
|
||||
if(!pComment->m_sParaId.empty() && pComment->bDurableId)
|
||||
{
|
||||
sRes += L"<w16cid:commentId w16cid:paraId=\"" + pComment->sParaId + L"\" w16cid:durableId=\"" + XmlUtils::IntToString(pComment->DurableId, L"%08X") + L"\"/>";
|
||||
sRes += L"<w16cid:commentId w16cid:paraId=\"" + pComment->m_sParaId + L"\" w16cid:durableId=\"" + XmlUtils::IntToString(pComment->DurableId, L"%08X") + L"\"/>";
|
||||
}
|
||||
return sRes;
|
||||
}
|
||||
@ -2129,8 +2112,8 @@ class CComments
|
||||
public:
|
||||
IdCounter m_oFormatIdCounter;
|
||||
IdCounter m_oParaIdCounter;
|
||||
|
||||
CComments() : m_oParaIdCounter(1)
|
||||
public:
|
||||
CComments():m_oParaIdCounter(1)
|
||||
{
|
||||
}
|
||||
~CComments()
|
||||
@ -3147,3 +3130,4 @@ public:
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif // #ifndef READER_CLASSES
|
||||
|
||||
@ -112,7 +112,9 @@ public:
|
||||
long read1defCurPos = 0;\
|
||||
while(read1defCurPos < (long)stLen)\
|
||||
{\
|
||||
BYTE read1defType = m_oBufferedStream.GetUChar();\
|
||||
BYTE read1defType = 0;\
|
||||
if (false == m_oBufferedStream.GetUCharWithResult(&read1defType))\
|
||||
break;\
|
||||
long read1defLength = m_oBufferedStream.GetLong();\
|
||||
res = fReadFunction(read1defType, read1defLength, arg);\
|
||||
if(res == c_oSerConstants::ReadUnknown)\
|
||||
@ -129,7 +131,9 @@ public:
|
||||
long read2defCurPos = 0;\
|
||||
while(read2defCurPos < (long)stLen)\
|
||||
{\
|
||||
BYTE read2defType = m_oBufferedStream.GetUChar();\
|
||||
BYTE read2defType = 0;\
|
||||
if (false == m_oBufferedStream.GetUCharWithResult(&read2defType))\
|
||||
break;\
|
||||
long read2defLenType = m_oBufferedStream.GetUChar();\
|
||||
int read2defCurPosShift = 2;\
|
||||
int read2defRealLen;\
|
||||
@ -1431,7 +1435,8 @@ int Binary_pPrReader::ReadFootnotePr(BYTE type, long length, void* poResult)
|
||||
else if( c_oSerNotes::PrStart == type )
|
||||
{
|
||||
pFtnProps->m_oNumStart.Init();
|
||||
pFtnProps->m_oNumStart->m_oVal = m_oBufferedStream.GetLong();
|
||||
pFtnProps->m_oNumStart->m_oVal.Init();
|
||||
pFtnProps->m_oNumStart->m_oVal->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else if( c_oSerNotes::PrFntPos == type )
|
||||
{
|
||||
@ -1461,7 +1466,8 @@ int Binary_pPrReader::ReadEndnotePr(BYTE type, long length, void* poResult)
|
||||
else if( c_oSerNotes::PrStart == type )
|
||||
{
|
||||
pEdnProps->m_oNumStart.Init();
|
||||
pEdnProps->m_oNumStart->m_oVal = m_oBufferedStream.GetLong();
|
||||
pEdnProps->m_oNumStart->m_oVal.Init();
|
||||
pEdnProps->m_oNumStart->m_oVal->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else if( c_oSerNotes::PrEndPos == type )
|
||||
{
|
||||
@ -3292,7 +3298,14 @@ int Binary_OtherTableReader::ReadOtherContent(BYTE type, long length, void* poRe
|
||||
else if(c_oSerOtherTableTypes::DocxTheme == type)
|
||||
{
|
||||
smart_ptr<PPTX::Theme> pTheme = new PPTX::Theme(NULL);
|
||||
pTheme->fromPPTY(&m_oBufferedStream);
|
||||
try
|
||||
{
|
||||
pTheme->fromPPTY(&m_oBufferedStream);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
//todooo в отдельный лог
|
||||
}
|
||||
NSBinPptxRW::CXmlWriter xmlWriter;
|
||||
pTheme->toXmlWriter(&xmlWriter);
|
||||
m_oFileWriter.m_oTheme.m_sContent = xmlWriter.GetXmlString();
|
||||
@ -3351,40 +3364,22 @@ int Binary_OtherTableReader::ReadImageMapContent(BYTE type, long length, void* p
|
||||
}
|
||||
|
||||
|
||||
Binary_CommentsTableReader::Binary_CommentsTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter)
|
||||
: Binary_CommonReader(poBufferedStream), m_oFileWriter(oFileWriter)
|
||||
Binary_CommentsTableReader::Binary_CommentsTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter):Binary_CommonReader(poBufferedStream)
|
||||
{
|
||||
}
|
||||
int Binary_CommentsTableReader::Read()
|
||||
{
|
||||
m_oFileWriter.m_pDrawingConverter->SetDstContentRels();
|
||||
|
||||
Writers::ContentWriter oContentWriter;
|
||||
Binary_DocumentTableReader oBinary_DocumentTableReader(m_oBufferedStream, m_oFileWriter, oContentWriter, &m_oComments);
|
||||
|
||||
oBinary_DocumentTableReader.m_bUsedParaIdCounter = true;
|
||||
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
READ_TABLE_DEF(res, this->ReadComments, &oBinary_DocumentTableReader);
|
||||
|
||||
OOX::CPath fileRelsPath = m_oFileWriter.m_oDocumentWriter.m_sDir + FILE_SEPARATOR_STR + L"word" +
|
||||
FILE_SEPARATOR_STR + L"_rels"+
|
||||
FILE_SEPARATOR_STR + m_oFileWriter.m_oCommentsWriter.getFilename() + L".rels";
|
||||
|
||||
m_oFileWriter.m_pDrawingConverter->SaveDstContentRels(fileRelsPath.GetPath());
|
||||
|
||||
READ_TABLE_DEF(res, this->ReadComments, NULL);
|
||||
return res;
|
||||
}
|
||||
};
|
||||
int Binary_CommentsTableReader::ReadComments(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
if ( c_oSer_CommentsType::Comment == type )
|
||||
{
|
||||
CComment* pComment = new CComment(m_oComments.m_oParaIdCounter, m_oComments.m_oFormatIdCounter);
|
||||
pComment->pBinary_DocumentTableReader = poResult;
|
||||
|
||||
READ1_DEF(length, res, this->ReadCommentContent, pComment);
|
||||
|
||||
if(pComment->bIdOpen && NULL == m_oComments.get(pComment->IdOpen))
|
||||
m_oComments.add(pComment);
|
||||
else
|
||||
@ -3393,12 +3388,11 @@ int Binary_CommentsTableReader::ReadComments(BYTE type, long length, void* poRes
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
};
|
||||
int Binary_CommentsTableReader::ReadCommentContent(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
CComment* pComment = static_cast<CComment*>(poResult);
|
||||
|
||||
if ( c_oSer_CommentsType::Id == type )
|
||||
{
|
||||
pComment->bIdOpen = true;
|
||||
@ -3448,55 +3442,28 @@ int Binary_CommentsTableReader::ReadCommentContent(BYTE type, long length, void*
|
||||
pComment->bDurableId = true;
|
||||
pComment->DurableId = m_oBufferedStream.GetULong();
|
||||
}
|
||||
else if ( c_oSer_CommentsType::CommentContent == type )
|
||||
{
|
||||
READ1_DEF(length, res, this->ReadCommentContentExt, pComment->pBinary_DocumentTableReader);
|
||||
|
||||
Binary_DocumentTableReader* doc_reader = (Binary_DocumentTableReader*)pComment->pBinary_DocumentTableReader;
|
||||
|
||||
pComment->sContent = doc_reader->m_oDocumentWriter.m_oContent.GetData();
|
||||
doc_reader->m_oDocumentWriter.m_oContent.Clear();
|
||||
|
||||
int nId = doc_reader->m_pComments->m_oParaIdCounter.getCurrentId();
|
||||
pComment->sParaId = XmlUtils::IntToString(nId, L"%08X");
|
||||
|
||||
}
|
||||
else if ( c_oSer_CommentsType::Replies == type )
|
||||
{
|
||||
READ1_DEF(length, res, this->ReadReplies, pComment);
|
||||
READ1_DEF(length, res, this->ReadReplies, &pComment->replies);
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int Binary_CommentsTableReader::ReadCommentContentExt(BYTE type, long length, void* poResult)
|
||||
{
|
||||
Binary_DocumentTableReader* pBinary_DocumentTableReader = static_cast<Binary_DocumentTableReader*>(poResult);
|
||||
|
||||
if (!pBinary_DocumentTableReader) return c_oSerConstants::ReadOk;
|
||||
|
||||
return pBinary_DocumentTableReader->ReadDocumentContent(type, length, NULL);
|
||||
}
|
||||
};
|
||||
int Binary_CommentsTableReader::ReadReplies(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
|
||||
CComment* pCommentParent = static_cast<CComment*>(poResult);
|
||||
|
||||
std::vector<CComment*>* paComments = static_cast<std::vector<CComment*>*>(poResult);
|
||||
if ( c_oSer_CommentsType::Comment == type )
|
||||
{
|
||||
CComment* pNewComment = new CComment(m_oComments.m_oParaIdCounter, m_oComments.m_oFormatIdCounter);
|
||||
pNewComment->pBinary_DocumentTableReader = pCommentParent->pBinary_DocumentTableReader;
|
||||
|
||||
READ1_DEF(length, res, this->ReadCommentContent, pNewComment);
|
||||
|
||||
pNewComment->sParaIdParent = pCommentParent->sParaId;
|
||||
pCommentParent->replies.push_back(pNewComment);
|
||||
paComments->push_back(pNewComment);
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Binary_SettingsTableReader::Binary_SettingsTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter, OOX::CSettingsCustom& oSettingsCustom):
|
||||
@ -3799,7 +3766,8 @@ int Binary_SettingsTableReader::ReadFootnotePr(BYTE type, long length, void* poR
|
||||
else if( c_oSerNotes::PrStart == type )
|
||||
{
|
||||
pFtnProps->m_oNumStart.Init();
|
||||
pFtnProps->m_oNumStart->m_oVal = m_oBufferedStream.GetLong();
|
||||
pFtnProps->m_oNumStart->m_oVal.Init();
|
||||
pFtnProps->m_oNumStart->m_oVal->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else if( c_oSerNotes::PrFntPos == type )
|
||||
{
|
||||
@ -3837,7 +3805,8 @@ int Binary_SettingsTableReader::ReadEndnotePr(BYTE type, long length, void* poRe
|
||||
else if( c_oSerNotes::PrStart == type )
|
||||
{
|
||||
pEdnProps->m_oNumStart.Init();
|
||||
pEdnProps->m_oNumStart->m_oVal = m_oBufferedStream.GetLong();
|
||||
pEdnProps->m_oNumStart->m_oVal.Init();
|
||||
pEdnProps->m_oNumStart->m_oVal->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else if( c_oSerNotes::PrEndPos == type )
|
||||
{
|
||||
@ -4246,7 +4215,6 @@ Binary_DocumentTableReader::Binary_DocumentTableReader(NSBinPptxRW::CBinaryFileR
|
||||
, m_oMath_rPr(m_oFontTableWriter.m_mapFonts)
|
||||
, m_pComments(pComments)
|
||||
{
|
||||
m_bUsedParaIdCounter = false;
|
||||
m_byteLastElemType = c_oSerParType::Content;
|
||||
m_pCurWriter = NULL;
|
||||
}
|
||||
@ -4280,19 +4248,9 @@ int Binary_DocumentTableReader::ReadDocumentContent(BYTE type, long length, void
|
||||
m_byteLastElemType = c_oSerParType::Par;
|
||||
m_oCur_pPr.ClearNoAttack();
|
||||
|
||||
if (m_bUsedParaIdCounter && m_pComments)
|
||||
{
|
||||
int nId = m_pComments->m_oParaIdCounter.getNextId();
|
||||
std::wstring sParaId = XmlUtils::IntToString(nId, L"%08X");
|
||||
|
||||
m_oDocumentWriter.m_oContent.WriteString(L"<w:p w14:paraId=\"" + sParaId + L"\" w14:textId=\"" + sParaId + L"\">");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_oDocumentWriter.m_oContent.WriteString(std::wstring(L"<w:p>"));
|
||||
}
|
||||
m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T("<w:p>")));
|
||||
READ1_DEF(length, res, this->ReadParagraph, NULL);
|
||||
m_oDocumentWriter.m_oContent.WriteString(std::wstring(L"</w:p>"));
|
||||
m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T("</w:p>")));
|
||||
}
|
||||
else if(c_oSerParType::Table == type)
|
||||
{
|
||||
@ -4766,7 +4724,8 @@ int Binary_DocumentTableReader::ReadFFData(BYTE type, long length, void* poResul
|
||||
else if ( c_oSerFFData::Label == type )
|
||||
{
|
||||
pFFData->m_oLabel.Init();
|
||||
pFFData->m_oLabel->m_oVal = m_oBufferedStream.GetLong();
|
||||
pFFData->m_oLabel->m_oVal.Init();
|
||||
pFFData->m_oLabel->m_oVal->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else if ( c_oSerFFData::Name == type )
|
||||
{
|
||||
@ -4831,18 +4790,20 @@ int Binary_DocumentTableReader::ReadDDList(BYTE type, long length, void* poResul
|
||||
if ( c_oSerFFData::DLDefault == type )
|
||||
{
|
||||
pDDList->m_oDefault.Init();
|
||||
pDDList->m_oDefault->m_oVal = m_oBufferedStream.GetLong();
|
||||
pDDList->m_oDefault->m_oVal.Init();
|
||||
pDDList->m_oDefault->m_oVal->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else if ( c_oSerFFData::DLResult == type )
|
||||
{
|
||||
pDDList->m_oResult.Init();
|
||||
pDDList->m_oResult->m_oVal = m_oBufferedStream.GetLong();
|
||||
pDDList->m_oResult->m_oVal.Init();
|
||||
pDDList->m_oResult->m_oVal->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else if ( c_oSerFFData::DLListEntry == type )
|
||||
{
|
||||
ComplexTypes::Word::String* pVal = new ComplexTypes::Word::String();
|
||||
pVal->m_sVal = m_oBufferedStream.GetString3(length);
|
||||
|
||||
pVal->m_sVal.Init();
|
||||
pVal->m_sVal->append(m_oBufferedStream.GetString3(length));
|
||||
pDDList->m_arrListEntry.push_back(pVal);
|
||||
}
|
||||
else
|
||||
@ -4894,17 +4855,20 @@ int Binary_DocumentTableReader::ReadTextInput(BYTE type, long length, void* poRe
|
||||
if ( c_oSerFFData::TIDefault == type )
|
||||
{
|
||||
pTextInput->m_oDefault.Init();
|
||||
pTextInput->m_oDefault->m_sVal = m_oBufferedStream.GetString3(length);
|
||||
pTextInput->m_oDefault->m_sVal.Init();
|
||||
pTextInput->m_oDefault->m_sVal->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if ( c_oSerFFData::TIFormat == type )
|
||||
{
|
||||
pTextInput->m_oFormat.Init();
|
||||
pTextInput->m_oFormat->m_sVal = m_oBufferedStream.GetString3(length);
|
||||
pTextInput->m_oFormat->m_sVal.Init();
|
||||
pTextInput->m_oFormat->m_sVal->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if ( c_oSerFFData::TIMaxLength == type )
|
||||
{
|
||||
pTextInput->m_oMaxLength.Init();
|
||||
pTextInput->m_oMaxLength->m_oVal = m_oBufferedStream.GetLong();
|
||||
pTextInput->m_oMaxLength->m_oVal.Init();
|
||||
pTextInput->m_oMaxLength->m_oVal->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else if ( c_oSerFFData::TIType == type )
|
||||
{
|
||||
@ -7414,27 +7378,17 @@ int Binary_DocumentTableReader::ReadRunContent(BYTE type, long length, void* poR
|
||||
else if(c_oSerRunType::table == type)
|
||||
{
|
||||
//todo
|
||||
m_oDocumentWriter.m_oContent.WriteString(std::wstring(L"</w:p>"));
|
||||
m_oDocumentWriter.m_oContent.WriteString(std::wstring(L"<w:tbl>"));
|
||||
m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T("</w:p>")));
|
||||
m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T("<w:tbl>")));
|
||||
READ1_DEF(length, res, this->ReadDocTable, &m_oDocumentWriter.m_oContent);
|
||||
m_oDocumentWriter.m_oContent.WriteString(std::wstring(L"</w:tbl>"));
|
||||
m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T("</w:tbl>")));
|
||||
m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T("<w:p>")));
|
||||
|
||||
if (m_bUsedParaIdCounter && m_pComments)
|
||||
{
|
||||
int nId = m_pComments->m_oParaIdCounter.getNextId();
|
||||
std::wstring sParaId = XmlUtils::IntToString(nId, L"%08X");
|
||||
|
||||
m_oDocumentWriter.m_oContent.WriteString(L"<w:p w14:paraId=\"" + sParaId + L"\" w14:textId=\"" + sParaId + L"\">");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_oDocumentWriter.m_oContent.WriteString(std::wstring(L"<w:p>"));
|
||||
}
|
||||
if(m_oCur_pPr.GetCurSize() > 0)
|
||||
{
|
||||
m_oDocumentWriter.m_oContent.WriteString(std::wstring(L"<w:pPr>"));
|
||||
m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T("<w:pPr>")));
|
||||
m_oDocumentWriter.m_oContent.Write(m_oCur_pPr);
|
||||
m_oDocumentWriter.m_oContent.WriteString(std::wstring(L"</w:pPr>"));
|
||||
m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T("</w:pPr>")));
|
||||
}
|
||||
}
|
||||
else if(c_oSerRunType::fldstart_deprecated == type)
|
||||
@ -7826,7 +7780,7 @@ int Binary_DocumentTableReader::ReadCell(BYTE type, long length, void* poResult)
|
||||
//Потому что если перед </tc> не идет <p>, то документ считается невалидным
|
||||
if(c_oSerParType::Par != oBinary_DocumentTableReader.m_byteLastElemType)
|
||||
{
|
||||
m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T("<w:p/>")));
|
||||
m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T("<w:p />")));
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -8671,7 +8625,8 @@ int Binary_DocumentTableReader::ReadSdtPr(BYTE type, long length, void* poResult
|
||||
else if (c_oSerSdt::Alias == type)
|
||||
{
|
||||
pSdtPr->m_oAlias.Init();
|
||||
pSdtPr->m_oAlias->m_sVal = m_oBufferedStream.GetString3(length);
|
||||
pSdtPr->m_oAlias->m_sVal.Init();
|
||||
pSdtPr->m_oAlias->m_sVal->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerSdt::Appearance == type)
|
||||
{
|
||||
@ -8719,12 +8674,14 @@ int Binary_DocumentTableReader::ReadSdtPr(BYTE type, long length, void* poResult
|
||||
else if (c_oSerSdt::Id == type)
|
||||
{
|
||||
pSdtPr->m_oId.Init();
|
||||
pSdtPr->m_oId->m_oVal = m_oBufferedStream.GetULong();
|
||||
pSdtPr->m_oId->m_oVal.Init();
|
||||
pSdtPr->m_oId->m_oVal->SetValue(m_oBufferedStream.GetULong());
|
||||
}
|
||||
else if (c_oSerSdt::Label == type)
|
||||
{
|
||||
pSdtPr->m_oLabel.Init();
|
||||
pSdtPr->m_oLabel->m_oVal = m_oBufferedStream.GetULong();
|
||||
pSdtPr->m_oLabel->m_oVal.Init();
|
||||
pSdtPr->m_oLabel->m_oVal->SetValue(m_oBufferedStream.GetULong());
|
||||
}
|
||||
else if (c_oSerSdt::Lock == type)
|
||||
{
|
||||
@ -8735,7 +8692,8 @@ int Binary_DocumentTableReader::ReadSdtPr(BYTE type, long length, void* poResult
|
||||
{
|
||||
pSdtPr->m_oPlaceHolder.Init();
|
||||
pSdtPr->m_oPlaceHolder->m_oDocPart.Init();
|
||||
pSdtPr->m_oPlaceHolder->m_oDocPart->m_sVal = m_oBufferedStream.GetString3(length);
|
||||
pSdtPr->m_oPlaceHolder->m_oDocPart->m_sVal.Init();
|
||||
pSdtPr->m_oPlaceHolder->m_oDocPart->m_sVal->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerSdt::RPr == type)
|
||||
{
|
||||
@ -8756,7 +8714,8 @@ int Binary_DocumentTableReader::ReadSdtPr(BYTE type, long length, void* poResult
|
||||
else if (c_oSerSdt::Tag == type)
|
||||
{
|
||||
pSdtPr->m_oTag.Init();
|
||||
pSdtPr->m_oTag->m_sVal = m_oBufferedStream.GetString3(length);
|
||||
pSdtPr->m_oTag->m_sVal.Init();
|
||||
pSdtPr->m_oTag->m_sVal->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerSdt::Temporary == type)
|
||||
{
|
||||
@ -8895,7 +8854,8 @@ int Binary_DocumentTableReader::ReadSdtPrDate(BYTE type, long length, void* poRe
|
||||
else if (c_oSerSdt::DateFormat == type)
|
||||
{
|
||||
pDate->m_oDateFormat.Init();
|
||||
pDate->m_oDateFormat->m_sVal = m_oBufferedStream.GetString3(length);
|
||||
pDate->m_oDateFormat->m_sVal.Init();
|
||||
pDate->m_oDateFormat->m_sVal->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerSdt::Lid == type)
|
||||
{
|
||||
@ -8920,12 +8880,14 @@ int Binary_DocumentTableReader::ReadDocPartList(BYTE type, long length, void* po
|
||||
if (c_oSerSdt::DocPartCategory == type)
|
||||
{
|
||||
pDocPart->m_oDocPartCategory.Init();
|
||||
pDocPart->m_oDocPartCategory->m_sVal = m_oBufferedStream.GetString3(length);
|
||||
pDocPart->m_oDocPartCategory->m_sVal.Init();
|
||||
pDocPart->m_oDocPartCategory->m_sVal->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerSdt::DocPartGallery == type)
|
||||
{
|
||||
pDocPart->m_oDocPartGallery.Init();
|
||||
pDocPart->m_oDocPartGallery->m_sVal = m_oBufferedStream.GetString3(length);
|
||||
pDocPart->m_oDocPartGallery->m_sVal.Init();
|
||||
pDocPart->m_oDocPartGallery->m_sVal->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if (c_oSerSdt::DocPartUnique == type)
|
||||
{
|
||||
@ -8956,15 +8918,14 @@ int Binary_DocumentTableReader::ReadDropDownList(BYTE type, long length, void* p
|
||||
}
|
||||
|
||||
|
||||
Binary_NotesTableReader::Binary_NotesTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter, CComments* pComments, bool bIsFootnote)
|
||||
: Binary_CommonReader(poBufferedStream), m_oFileWriter(oFileWriter), m_pComments(pComments), m_bIsFootnote(bIsFootnote)
|
||||
Binary_NotesTableReader::Binary_NotesTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter, CComments* pComments, bool bIsFootnote):
|
||||
Binary_CommonReader(poBufferedStream),m_oFileWriter(oFileWriter),m_pComments(pComments),m_bIsFootnote(bIsFootnote)
|
||||
{
|
||||
}
|
||||
int Binary_NotesTableReader::Read()
|
||||
{
|
||||
m_oFileWriter.m_pDrawingConverter->SetDstContentRels();
|
||||
|
||||
std::wstring sFilename;
|
||||
std::wstring sFilename;
|
||||
Writers::ContentWriter* pContentWriter = NULL;
|
||||
if(m_bIsFootnote)
|
||||
{
|
||||
|
||||
@ -226,14 +226,12 @@ public:
|
||||
class Binary_CommentsTableReader : public Binary_CommonReader
|
||||
{
|
||||
public:
|
||||
CComments m_oComments;
|
||||
Writers::FileWriter& m_oFileWriter;
|
||||
|
||||
CComments m_oComments;
|
||||
public:
|
||||
Binary_CommentsTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter);
|
||||
int Read();
|
||||
int ReadComments(BYTE type, long length, void* poResult);
|
||||
int ReadCommentContent(BYTE type, long length, void* poResult);
|
||||
int ReadCommentContentExt(BYTE type, long length, void* poResult);
|
||||
int ReadReplies(BYTE type, long length, void* poResult);
|
||||
};
|
||||
class Binary_SettingsTableReader : public Binary_CommonReader
|
||||
@ -281,21 +279,18 @@ private:
|
||||
Binary_pPrReader oBinary_pPrReader;
|
||||
Binary_rPrReader oBinary_rPrReader;
|
||||
Binary_tblPrReader oBinary_tblPrReader;
|
||||
NSStringUtils::CStringBuilder* m_pCurWriter;
|
||||
NSStringUtils::CStringBuilder* m_pCurWriter;
|
||||
rPr m_oCur_rPr;
|
||||
rPr m_oMath_rPr;
|
||||
NSStringUtils::CStringBuilder m_oCur_pPr;
|
||||
NSStringUtils::CStringBuilder m_oCur_pPr;
|
||||
BYTE m_byteLastElemType;
|
||||
public:
|
||||
CComments* m_pComments;
|
||||
public:
|
||||
Writers::ContentWriter& m_oDocumentWriter;
|
||||
Writers::MediaWriter& m_oMediaWriter;
|
||||
|
||||
bool m_bUsedParaIdCounter;
|
||||
|
||||
Binary_DocumentTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter, Writers::ContentWriter& oDocumentWriter, CComments* pComments);
|
||||
~Binary_DocumentTableReader();
|
||||
|
||||
int Read();
|
||||
NSStringUtils::CStringBuilder& GetRunStringWriter();
|
||||
int ReadDocumentContentOut(long length);
|
||||
|
||||
@ -805,8 +805,7 @@ extern int g_nCurFormatVersion;
|
||||
Replies = 9,
|
||||
OOData = 10,
|
||||
DurableId = 11,
|
||||
ProviderId = 12,
|
||||
CommentContent = 13
|
||||
ProviderId = 12
|
||||
};}
|
||||
namespace c_oSer_SettingsType{enum c_oSer_SettingsType
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -35,14 +35,16 @@
|
||||
|
||||
#include "BinReaderWriterDefines.h"
|
||||
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/DocxFlat.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Docx.h"
|
||||
#include "../../Common/DocxFormat/Source/MathEquation/MathEquation.h"
|
||||
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Document.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/FontTable.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Numbering.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Comments.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Styles.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Footnote.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Endnote.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Settings/Settings.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/External/HyperLink.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h"
|
||||
@ -74,42 +76,24 @@ namespace BinDocxRW
|
||||
NSBinPptxRW::CDrawingConverter* m_pOfficeDrawingConverter;
|
||||
NSFontCutter::CEmbeddedFontsManager* m_pEmbeddedFontsManager;
|
||||
|
||||
OOX::Document* m_pMain;
|
||||
OOX::CSettings* m_pSettings;
|
||||
PPTX::Theme* m_pTheme;
|
||||
|
||||
OOX::CStyles* m_pStyles;
|
||||
OOX::CNumbering* m_pNumbering;
|
||||
|
||||
bool m_bLocalStyles;
|
||||
bool m_bLocalNumbering;
|
||||
|
||||
OOX::CStyles* m_pEmbeddedStyles;
|
||||
OOX::CNumbering* m_pEmbeddedNumbering;
|
||||
OOX::CSettings* m_oSettings;
|
||||
PPTX::Theme* m_poTheme;
|
||||
|
||||
OOX::IFileContainer* m_pCurRels;
|
||||
std::map<int, bool> m_mapIgnoreComments;
|
||||
|
||||
ParamsWriter(NSBinPptxRW::CBinaryFileWriter* pCBufferedStream, DocWrapper::FontProcessor* pFontProcessor, NSBinPptxRW::CDrawingConverter* pOfficeDrawingConverter, NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager):
|
||||
m_pCBufferedStream(pCBufferedStream), m_pFontProcessor(pFontProcessor), m_pOfficeDrawingConverter(pOfficeDrawingConverter), m_pEmbeddedFontsManager(pEmbeddedFontsManager)
|
||||
m_pCBufferedStream(pCBufferedStream),m_pFontProcessor(pFontProcessor),m_pOfficeDrawingConverter(pOfficeDrawingConverter),m_pEmbeddedFontsManager(pEmbeddedFontsManager)
|
||||
{
|
||||
m_pMain = NULL;
|
||||
m_pSettings = NULL;
|
||||
m_pTheme = NULL;
|
||||
m_oSettings = NULL;
|
||||
m_poTheme = NULL;
|
||||
m_pCurRels = NULL;
|
||||
m_pStyles = NULL;
|
||||
m_pNumbering = NULL;
|
||||
|
||||
m_pEmbeddedStyles = NULL;
|
||||
m_pEmbeddedNumbering = NULL;
|
||||
|
||||
m_bLocalStyles = m_bLocalNumbering = false;
|
||||
}
|
||||
};
|
||||
class ParamsDocumentWriter
|
||||
{
|
||||
public:
|
||||
OOX::IFileContainer* m_pRels;
|
||||
OOX::IFileContainer* m_pRels;
|
||||
|
||||
ParamsDocumentWriter(OOX::IFileContainer* pRels) : m_pRels(pRels)
|
||||
{
|
||||
@ -145,20 +129,22 @@ namespace BinDocxRW
|
||||
class BinaryHeaderFooterTableWriter
|
||||
{
|
||||
BinaryCommonWriter m_oBcw;
|
||||
ParamsWriter& m_oParamsWriter;
|
||||
OOX::CSettings* m_oSettings;
|
||||
|
||||
PPTX::Theme* m_poTheme;
|
||||
DocWrapper::FontProcessor& m_oFontProcessor;
|
||||
NSBinPptxRW::CDrawingConverter* m_pOfficeDrawingConverter;
|
||||
std::map<int, bool>* m_mapIgnoreComments;
|
||||
public:
|
||||
ParamsWriter& m_oParamsWriter;
|
||||
OOX::IFileContainer* m_oDocumentRels;
|
||||
|
||||
std::vector<OOX::CHdrFtr*> m_aHeaders;
|
||||
std::vector<SimpleTypes::EHdrFtr> m_aHeaderTypes;
|
||||
std::vector<OOX::Logic::CSectionProperty*> m_aHeaderSectPrs;
|
||||
std::vector<OOX::CHdrFtr*> m_aFooters;
|
||||
std::vector<SimpleTypes::EHdrFtr> m_aFooterTypes;
|
||||
std::vector<OOX::Logic::CSectionProperty*> m_aFooterSectPrs;
|
||||
|
||||
OOX::IFileContainer* m_oDocumentRels;
|
||||
std::vector<OOX::CHdrFtr*> m_aHeaders;
|
||||
std::vector<SimpleTypes::EHdrFtr> m_aHeaderTypes;
|
||||
std::vector<OOX::Logic::CSectionProperty*> m_aHeaderSectPrs;
|
||||
std::vector<OOX::CHdrFtr*> m_aFooters;
|
||||
std::vector<SimpleTypes::EHdrFtr> m_aFooterTypes;
|
||||
std::vector<OOX::Logic::CSectionProperty*> m_aFooterSectPrs;
|
||||
public:
|
||||
BinaryHeaderFooterTableWriter(ParamsWriter& oParamsWriter, OOX::IFileContainer* oDocumentRel, std::map<int, bool>* mapIgnoreComments);
|
||||
void Write();
|
||||
void WriteHdrFtrContent(std::vector<OOX::CHdrFtr*>& aHdrFtrs, std::vector<SimpleTypes::EHdrFtr>& aHdrFtrTypes, std::vector<OOX::Logic::CSectionProperty*>& aHdrSectPrs, bool bHdr);
|
||||
@ -175,7 +161,7 @@ namespace BinDocxRW
|
||||
{
|
||||
BinaryCommonWriter m_oBcw;
|
||||
public:
|
||||
PPTX::Theme* m_pTheme;
|
||||
PPTX::Theme* m_poTheme;
|
||||
NSBinPptxRW::CDrawingConverter* m_pOfficeDrawingConverter;
|
||||
DocWrapper::FontProcessor& m_oFontProcessor;
|
||||
|
||||
@ -187,8 +173,7 @@ namespace BinDocxRW
|
||||
{
|
||||
BinaryCommonWriter m_oBcw;
|
||||
Binary_rPrWriter brPrs;
|
||||
|
||||
ParamsWriter& m_oParamsWriter;
|
||||
OOX::CSettings* m_oSettings;
|
||||
public:
|
||||
BinaryHeaderFooterTableWriter* m_oBinaryHeaderFooterTableWriter;
|
||||
|
||||
@ -216,9 +201,6 @@ namespace BinDocxRW
|
||||
const nullable<ComplexTypes::Word::CDecimalNumber>& numStart, nullable<ComplexTypes::Word::CFtnPos>* ftnPos,
|
||||
nullable<ComplexTypes::Word::CEdnPos>* endPos, std::vector<OOX::CFtnEdnSepRef*>* refs);
|
||||
void WriteNumFmt(const ComplexTypes::Word::CNumFmt& oNumFmt);
|
||||
|
||||
private:
|
||||
std::wstring AddEmbeddedStyle(const std::wstring & styleId);
|
||||
};
|
||||
class Binary_tblPrWriter
|
||||
{
|
||||
@ -309,19 +291,19 @@ namespace BinDocxRW
|
||||
{
|
||||
private:
|
||||
ParamsWriter& m_oParamsWriter;
|
||||
|
||||
ParamsDocumentWriter& m_oParamsDocumentWriter;
|
||||
BinaryCommonWriter m_oBcw;
|
||||
Binary_pPrWriter bpPrs;
|
||||
Binary_rPrWriter brPrs;
|
||||
std::wstring m_sCurParStyle;
|
||||
OOX::CSettings* m_oSettings;
|
||||
|
||||
NSBinPptxRW::CDrawingConverter* m_pOfficeDrawingConverter;
|
||||
std::map<int, bool>* m_mapIgnoreComments;
|
||||
public:
|
||||
Binary_tblPrWriter btblPrs;
|
||||
OOX::Logic::CSectionProperty* pSectPr;
|
||||
OOX::WritingElement* pBackground;
|
||||
OOX::Logic::CBackground * pBackground;
|
||||
OOX::CDocument* poDocument;
|
||||
OOX::JsaProject* pJsaProject;
|
||||
|
||||
@ -333,7 +315,7 @@ namespace BinDocxRW
|
||||
void WriteVbaProject(OOX::VbaProject& oVbaProject);
|
||||
void Write(std::vector<OOX::WritingElement*> & aElems);
|
||||
void WriteDocumentContent(const std::vector<OOX::WritingElement*> & aElems);
|
||||
void WriteBackground (OOX::WritingElement* pBackground);
|
||||
void WriteBackground (OOX::Logic::CBackground* pBackground);
|
||||
void WriteParapraph(OOX::Logic::CParagraph& par, OOX::Logic::CParagraphProperty* pPr);
|
||||
void WriteParagraphContent(const std::vector<OOX::WritingElement*> & content, bool bHyperlink = false);
|
||||
void WriteDel(const OOX::Logic::CDel& oDel);
|
||||
@ -457,7 +439,7 @@ namespace BinDocxRW
|
||||
void WriteRunContent(std::vector<OOX::WritingElement*>::iterator &start, std::vector<OOX::WritingElement*>::iterator &end, bool bHyperlink = false);
|
||||
void WriteNoteRef(const nullable<SimpleTypes::COnOff<>>& oCustomMarkFollows, const nullable<SimpleTypes::CDecimalNumber<>>& oId);
|
||||
void WriteText(const std::wstring& text, BYTE type);
|
||||
bool WriteDrawingPptx(OOX::WritingElement* item);
|
||||
void WriteDrawingPptx(OOX::WritingElement* item);
|
||||
void WriteDrawing(std::wstring* pXml, OOX::Logic::CDrawing* pDrawing, PPTX::Logic::GraphicFrame *pGraphic);
|
||||
void WriteNvGraphicFramePr(const PPTX::Logic::NvGraphicFramePr& oGraphicFramePr);
|
||||
void WriteDocPr(const PPTX::Logic::CNvPr& oDocPr);
|
||||
@ -507,14 +489,12 @@ namespace BinDocxRW
|
||||
std::vector<CCommentWriteTemp*> aReplies;
|
||||
};
|
||||
BinaryCommonWriter m_oBcw;
|
||||
ParamsWriter& m_oParamsWriter;
|
||||
NSBinPptxRW::CDrawingConverter* m_pOfficeDrawingConverter;
|
||||
public:
|
||||
BinaryCommentsTableWriter(ParamsWriter& oParamsWriter);
|
||||
void Write(OOX::CComments& oComments, OOX::CCommentsExt* pCommentsExt, OOX::CPeople* pPeople, OOX::CCommentsIds* pCommentsIds, std::map<int, bool>& mapIgnoreComments);
|
||||
void WriteCommentsContent(OOX::CComments& oComments, OOX::CCommentsExt* pCommentsExt, OOX::CPeople* pPeople, OOX::CCommentsIds* pCommentsIds, std::map<int, bool>& mapIgnoreComments, ParamsDocumentWriter& oParamsDocumentWriter);
|
||||
void WriteComment(CCommentWriteTemp& oComment, BinaryDocumentTableWriter & oBinaryDocumentTableWriter);
|
||||
void WriteReplies(std::vector<CCommentWriteTemp*>& aCommentWriteTemp, BinaryDocumentTableWriter & oBinaryDocumentTableWriter);
|
||||
void WriteCommentsContent(OOX::CComments& oComments, OOX::CCommentsExt* pCommentsExt, OOX::CPeople* pPeople, OOX::CCommentsIds* pCommentsIds, std::map<int, bool>& mapIgnoreComments);
|
||||
void WriteComment(CCommentWriteTemp& oComment);
|
||||
void WriteReplies(std::vector<CCommentWriteTemp*>& aCommentWriteTemp);
|
||||
};
|
||||
class BinarySettingsTableWriter
|
||||
{
|
||||
|
||||
@ -163,7 +163,8 @@ namespace BinXlsxRW{
|
||||
toXlsxSheetdata(pWorksheet, *it->second, aSharedStrings);
|
||||
|
||||
OOX::Spreadsheet::CSheet* pSheet = new OOX::Spreadsheet::CSheet();
|
||||
pSheet->m_oName = sSheetName;
|
||||
pSheet->m_oName.Init();
|
||||
pSheet->m_oName->append(sSheetName);
|
||||
pSheet->m_oSheetId.Init();
|
||||
pSheet->m_oSheetId->SetValue(nSheetId++);
|
||||
|
||||
@ -211,7 +212,8 @@ namespace BinXlsxRW{
|
||||
for (boost::unordered_map<std::wstring, int>::iterator it = m_mapFormats.begin(); it != m_mapFormats.end(); ++it)
|
||||
{
|
||||
OOX::Spreadsheet::CNumFmt* pNumFmt = new OOX::Spreadsheet::CNumFmt();
|
||||
pNumFmt->m_oFormatCode = (it->first);
|
||||
pNumFmt->m_oFormatCode.Init();
|
||||
pNumFmt->m_oFormatCode->append(it->first);
|
||||
pNumFmt->m_oNumFmtId.Init();
|
||||
pNumFmt->m_oNumFmtId->SetValue(NUMID_START + it->second);
|
||||
oXlsx.m_pStyles->m_oNumFmts->m_arrItems.push_back(pNumFmt);
|
||||
|
||||
@ -64,7 +64,7 @@ BinDocxRW::CDocxSerializer::~CDocxSerializer()
|
||||
RELEASEOBJECT(m_pParamsWriter);
|
||||
RELEASEOBJECT(m_pCurFileWriter);
|
||||
}
|
||||
bool BinDocxRW::CDocxSerializer::saveToFile(const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions, const std::wstring& sTempPath)
|
||||
bool BinDocxRW::CDocxSerializer::saveToFile(const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions)
|
||||
{
|
||||
OOX::CPath pathMain(sSrcFileName);
|
||||
|
||||
@ -105,7 +105,6 @@ bool BinDocxRW::CDocxSerializer::saveToFile(const std::wstring& sSrcFileName, co
|
||||
|
||||
oDrawingConverter.SetDstPath(pathMain.GetDirectory() + FILE_SEPARATOR_STR + L"word");
|
||||
oDrawingConverter.SetMediaDstPath(pathMedia.GetPath());
|
||||
oDrawingConverter.SetTempPath(sTempPath);
|
||||
|
||||
m_pParamsWriter = new ParamsWriter(&oBufferedStream, &fp, &oDrawingConverter, pEmbeddedFontsManager);
|
||||
|
||||
@ -217,7 +216,8 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const std::wstring& sSrcFileName,
|
||||
int nType = 0;
|
||||
std::string version = "";
|
||||
std::string dst_len = "";
|
||||
while (true)
|
||||
|
||||
while (nIndex < nBase64DataSize)
|
||||
{
|
||||
nIndex++;
|
||||
BYTE _c = pBase64Data[nIndex];
|
||||
|
||||
@ -63,7 +63,7 @@ namespace BinDocxRW
|
||||
virtual ~CDocxSerializer();
|
||||
|
||||
bool loadFromFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions, const std::wstring& sThemePath, const std::wstring& sMediaPath, const std::wstring& sEmbedPath);
|
||||
bool saveToFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions, const std::wstring& sTempPath);
|
||||
bool saveToFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions);
|
||||
|
||||
bool CreateDocxFolders(std::wstring strDirectory, std::wstring& sThemePath, std::wstring& sMediaPath, std::wstring& sEmbedPath);
|
||||
|
||||
|
||||
@ -38,8 +38,7 @@ SOURCES += \
|
||||
../../OfficeCryptReader/source/ECMACryptFile.cpp \
|
||||
../../OfficeCryptReader/source/CryptTransform.cpp \
|
||||
../BinReader/Readers.cpp \
|
||||
../BinReader/CustormXmlWriter.cpp \
|
||||
../BinReader/FileWriter.cpp
|
||||
../BinReader/CustormXmlWriter.cpp
|
||||
|
||||
HEADERS += ../DocWrapper/DocxSerializer.h \
|
||||
../DocWrapper/FontProcessor.h \
|
||||
|
||||
@ -148,7 +148,7 @@ public:
|
||||
{
|
||||
case 'M':
|
||||
{
|
||||
if ((pos + 5 <= size) && (expr.substr(pos, 5) == L"MINYS"))
|
||||
if ((pos + 5 < size) && (expr.substr(pos, 5) == L"MINYS"))
|
||||
{
|
||||
result += L"-"; pos += 5;
|
||||
}
|
||||
@ -159,7 +159,7 @@ public:
|
||||
}break;
|
||||
case 'T':
|
||||
{
|
||||
if ((pos + 6 <= size) && (expr.substr(pos, 6) == L"ТОСHKA"))
|
||||
if ((pos + 6 < size) && (expr.substr(pos, 6) == L"ТОСHKA"))
|
||||
{
|
||||
result += L"."; pos += 6;
|
||||
}
|
||||
@ -170,7 +170,7 @@ public:
|
||||
}break;
|
||||
case 'V':
|
||||
{
|
||||
if ((pos + 5 <= size) && (expr.substr(pos, 5) == L"VOSKL"))
|
||||
if ((pos + 5 < size) && (expr.substr(pos, 5) == L"VOSKL"))
|
||||
{
|
||||
result += L"!"; pos += 5;
|
||||
}
|
||||
@ -181,11 +181,11 @@ public:
|
||||
}break;
|
||||
case 'S':
|
||||
{
|
||||
if ((pos + 8 <= size) && (expr.substr(pos, 8) == L"SCOBCAIN"))
|
||||
if ((pos + 8 < size) && (expr.substr(pos, 8) == L"SCOBCAIN"))
|
||||
{
|
||||
result += L"("; pos += 8;
|
||||
}
|
||||
else if ((pos + 9 <= size) && (expr.substr(pos, 9) == L"SCOBCAOUT"))
|
||||
else if ((pos + 9 < size) && (expr.substr(pos, 9) == L"SCOBCAOUT"))
|
||||
{
|
||||
result += L")"; pos += 9;
|
||||
}
|
||||
@ -196,15 +196,15 @@ public:
|
||||
}break;
|
||||
case 'K':
|
||||
{
|
||||
if ((pos + 9 <= size) && (expr.substr(pos, 9) == L"KVADRATIN"))
|
||||
if ((pos + 9 < size) && (expr.substr(pos, 9) == L"KVADRATIN"))
|
||||
{
|
||||
result += L"["; pos += 9;
|
||||
}
|
||||
else if ((pos + 10 <= size) && (expr.substr(pos, 10) == L"KVADRATOUT"))
|
||||
else if ((pos + 10 < size) && (expr.substr(pos, 10) == L"KVADRATOUT"))
|
||||
{
|
||||
result += L"]"; pos += 10;
|
||||
}
|
||||
else if ((pos + 8 <= size) && (expr.substr(pos, 8) == L"KAVYCHKA"))
|
||||
else if ((pos + 8 < size) && (expr.substr(pos, 8) == L"KAVYCHKA"))
|
||||
{
|
||||
result += L"\""; pos += 8;
|
||||
}
|
||||
@ -215,7 +215,7 @@ public:
|
||||
}break;
|
||||
case 'P':
|
||||
{
|
||||
if ((pos + 6 <= size) && (expr.substr(pos, 6) == L"PROBEL"))
|
||||
if ((pos + 6 < size) && (expr.substr(pos, 6) == L"PROBEL"))
|
||||
{
|
||||
result += L" "; pos += 6;
|
||||
}
|
||||
@ -226,7 +226,7 @@ public:
|
||||
}break;
|
||||
case 'A':
|
||||
{
|
||||
if ((pos + 8 <= size) && (expr.substr(pos, 8) == L"APOSTROF"))
|
||||
if ((pos + 8 < size) && (expr.substr(pos, 8) == L"APOSTROF"))
|
||||
{
|
||||
result += L"'"; pos += 8;
|
||||
}
|
||||
|
||||
@ -260,9 +260,6 @@ enum ElementType
|
||||
typeStyleFooterLeft,
|
||||
typeStyleFootnoteSep,
|
||||
|
||||
typeLoextHeaderFirst,
|
||||
typeLoextFooterFirst,
|
||||
|
||||
typeStyleSectionProperties,
|
||||
typeStyleHeaderStyle,
|
||||
typeStyleFooterStyle,
|
||||
@ -601,7 +598,6 @@ enum ElementType
|
||||
typeChartStockRangeLine,
|
||||
typeChartRegressionCurve,
|
||||
typeChartEquation,
|
||||
typeChartDateScale,
|
||||
|
||||
typeStyleChartProperties,
|
||||
|
||||
|
||||
@ -217,7 +217,6 @@ SOURCES += \
|
||||
../src/odf/datatypes/bibliography.cpp \
|
||||
../src/odf/datatypes/commandtype.cpp \
|
||||
../src/odf/datatypes/styleprint.cpp \
|
||||
../src/odf/datatypes/charttimeunit.cpp \
|
||||
../src/docx/xlsx_conditionalFormatting.cpp \
|
||||
../src/docx/xlsx_dxfs.cpp \
|
||||
../src/docx/docx_content_type.cpp \
|
||||
@ -479,7 +478,6 @@ HEADERS += \
|
||||
../src/odf/datatypes/chartlabelposition.h \
|
||||
../src/odf/datatypes/grandtotal.h \
|
||||
../src/odf/datatypes/styleprint.h \
|
||||
../src/odf/datatypes/charttimeunit.h \
|
||||
../src/docx/docx_content_type.h \
|
||||
../src/docx/docx_conversion_context.h \
|
||||
../src/docx/docx_conversion_state.h \
|
||||
|
||||
@ -131,4 +131,3 @@
|
||||
#include "../src/odf/datatypes/stylenumformat.cpp"
|
||||
#include "../src/odf/datatypes/bibliography.cpp"
|
||||
#include "../src/odf/datatypes/styleprint.cpp"
|
||||
#include "../src/odf/datatypes/charttimeunit.cpp"
|
||||
|
||||
@ -646,30 +646,23 @@ void docx_conversion_context::add_new_run(std::wstring parentStyleId)
|
||||
|
||||
std::wstring docx_conversion_context::add_hyperlink(const std::wstring & href, bool draw)
|
||||
{
|
||||
oox::_rels_type_place type_place = get_type_place();
|
||||
|
||||
hyperlinks::_type_place type = hyperlinks::document_place;
|
||||
|
||||
if (current_process_comment_ == true) type = hyperlinks::comment_place;
|
||||
else if (current_process_note_ == footNote || current_process_note_ == footNoteRefSet) type = hyperlinks::footnote_place;
|
||||
else if (current_process_note_ == endNote || current_process_note_ == endNoteRefSet ) type = hyperlinks::endnote_place;
|
||||
|
||||
std::wstring href_correct = xml::utils::replace_text_to_xml(href);
|
||||
XmlUtils::replace_all( href_correct, L" .", L".");//1 (130).odt
|
||||
|
||||
return hyperlinks_.add(href_correct, type_place, draw);
|
||||
return hyperlinks_.add(href_correct, type, draw);
|
||||
}
|
||||
hyperlinks::_ref docx_conversion_context::last_hyperlink()
|
||||
{
|
||||
return hyperlinks_.last();
|
||||
}
|
||||
_rels_type_place docx_conversion_context::get_type_place()
|
||||
{
|
||||
if (current_process_comment_) return oox::comment_place;
|
||||
if (current_process_note_ == footNote ||
|
||||
current_process_note_ == footNoteRefSet) return oox::footnote_place;
|
||||
if (current_process_note_ == endNote ||
|
||||
current_process_note_ == endNoteRefSet ) return oox::endnote_place;
|
||||
|
||||
if (process_headers_footers_) return oox::header_footer_place;
|
||||
|
||||
return oox::document_place;
|
||||
}
|
||||
void docx_conversion_context::dump_hyperlinks(rels & Rels, _rels_type_place type)
|
||||
void docx_conversion_context::dump_hyperlinks(rels & Rels, hyperlinks::_type_place type)
|
||||
{
|
||||
hyperlinks_.dump_rels(Rels, type);
|
||||
}
|
||||
@ -735,12 +728,9 @@ void docx_conversion_context::end_document()
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
dump_bibliography();
|
||||
dump_hyperlinks (notes_context_.footnotesRels(), oox::footnote_place);
|
||||
dump_hyperlinks (notes_context_.endnotesRels(), oox::endnote_place);
|
||||
|
||||
get_mediaitems()->dump_rels(notes_context_.footnotesRels(), oox::footnote_place);
|
||||
get_mediaitems()->dump_rels(notes_context_.endnotesRels(), oox::endnote_place);
|
||||
|
||||
dump_hyperlinks (notes_context_.footnotesRels(), hyperlinks::footnote_place);
|
||||
dump_hyperlinks (notes_context_.endnotesRels(), hyperlinks::endnote_place);
|
||||
|
||||
output_document_->get_word_files().set_notes(notes_context_);
|
||||
////////////////////////
|
||||
for (size_t i = 0; i < charts_.size(); i++)
|
||||
@ -908,25 +898,21 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
std::wstring StyleDisplayName(const std::wstring & Name, const std::wstring & DisplayName, odf_types::style_family::type Type, bool &bDisplayed)
|
||||
std::wstring StyleDisplayName(const std::wstring & Name, const std::wstring & DisplayName, odf_types::style_family::type Type)
|
||||
{
|
||||
bDisplayed = true;
|
||||
if (false == DisplayName.empty())
|
||||
if (!DisplayName.empty())
|
||||
return DisplayName;
|
||||
|
||||
if (false == Name.empty())
|
||||
{
|
||||
bDisplayed = false;
|
||||
if (!Name.empty())
|
||||
return Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(Type)
|
||||
{
|
||||
case odf_types::style_family::Paragraph:
|
||||
return L"Normal";
|
||||
break;
|
||||
default:
|
||||
bDisplayed = false;
|
||||
return std::wstring(L"DStyle_") + boost::lexical_cast<std::wstring>(odf_types::style_family( Type) );
|
||||
}
|
||||
}
|
||||
@ -1127,9 +1113,11 @@ void docx_conversion_context::process_styles()
|
||||
|
||||
for (size_t i = 0; i < arStyles.size(); i++)
|
||||
{
|
||||
if (false == arStyles[i]->is_automatic() &&
|
||||
(arStyles[i]->type() == odf_types::style_family::Paragraph ||
|
||||
arStyles[i]->type() == odf_types::style_family::Text))
|
||||
if (!arStyles[i]->is_automatic() &&
|
||||
(
|
||||
arStyles[i]->type() == odf_types::style_family::Paragraph ||
|
||||
arStyles[i]->type() == odf_types::style_family::Text
|
||||
))
|
||||
{
|
||||
const std::wstring id = styles_map_.get(arStyles[i]->name(), arStyles[i]->type());
|
||||
_Wostream << L"<w:style w:styleId=\"" << id << L"\" w:type=\"" << StyleTypeOdf2Docx(arStyles[i]->type()) << L"\"";
|
||||
@ -1139,8 +1127,7 @@ void docx_conversion_context::process_styles()
|
||||
}
|
||||
_Wostream << L">";
|
||||
|
||||
bool bDisplayed = (arStyles[i]->type() == odf_types::style_family::Paragraph);
|
||||
const std::wstring displayName = StyleDisplayName(arStyles[i]->name(), arStyles[i]->display_name(), arStyles[i]->type(), bDisplayed);
|
||||
const std::wstring displayName = StyleDisplayName(arStyles[i]->name(), arStyles[i]->display_name(), arStyles[i]->type());
|
||||
|
||||
_Wostream << L"<w:name w:val=\"" << XmlUtils::EncodeXmlString(displayName) << L"\"/>";
|
||||
|
||||
@ -1149,13 +1136,12 @@ void docx_conversion_context::process_styles()
|
||||
const std::wstring basedOnId = styles_map_.get(baseOn->name(), baseOn->type());
|
||||
_Wostream << L"<w:basedOn w:val=\"" << basedOnId << "\"/>";
|
||||
}
|
||||
else if (false == arStyles[i]->is_default() && styles_map_.check(L"", arStyles[i]->type()))
|
||||
else if (!arStyles[i]->is_default() && styles_map_.check(L"", arStyles[i]->type()))
|
||||
{
|
||||
bDisplayed = false;
|
||||
const std::wstring basedOnId = styles_map_.get(L"", arStyles[i]->type());
|
||||
_Wostream << L"<w:basedOn w:val=\"" << basedOnId << "\"/>";
|
||||
}
|
||||
if (bDisplayed)
|
||||
else
|
||||
{
|
||||
_Wostream << L"<w:qFormat/>";
|
||||
}
|
||||
@ -2007,8 +1993,8 @@ namespace
|
||||
//слить если есть mediaitems, добавить релсы и обнулить их для основного документа.
|
||||
rels internal_rels;
|
||||
|
||||
Context.get_mediaitems()->dump_rels(internal_rels, oox::header_footer_place);
|
||||
Context.dump_hyperlinks(internal_rels, oox::header_footer_place);
|
||||
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);
|
||||
}
|
||||
|
||||
@ -798,12 +798,10 @@ public:
|
||||
|
||||
std::wstring add_hyperlink (const std::wstring & href, bool drawing);
|
||||
hyperlinks::_ref last_hyperlink ();
|
||||
void dump_hyperlinks (rels & Rels, _rels_type_place type);
|
||||
void dump_hyperlinks (rels & Rels, hyperlinks::_type_place type);
|
||||
|
||||
void dump_headers_footers (rels & Rels) const;
|
||||
void dump_notes (rels & Rels) const;
|
||||
|
||||
_rels_type_place get_type_place();
|
||||
|
||||
void dump_bibliography();
|
||||
std::wstring dump_settings_document();
|
||||
|
||||
@ -195,86 +195,6 @@ void _docx_drawing::serialize_text(std::wostream & strm)
|
||||
serialize_bodyPr(strm, L"wps");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void docx_serialize_media_child(std::wostream & strm, _docx_drawing & val)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"pic:pic")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns:pic",L"http://schemas.openxmlformats.org/drawingml/2006/picture");
|
||||
{
|
||||
CP_XML_NODE(L"pic:nvPicPr")
|
||||
{
|
||||
CP_XML_NODE(L"pic:cNvPr")
|
||||
{
|
||||
CP_XML_ATTR(L"id", val.id + 1);
|
||||
CP_XML_ATTR(L"name", val.name);
|
||||
|
||||
//oox_serialize_action(CP_XML_STREAM(), val.action);
|
||||
}
|
||||
CP_XML_NODE(L"pic:cNvPicPr")
|
||||
{
|
||||
CP_XML_NODE(L"a:picLocks") CP_XML_ATTR(L"noChangeAspect",1);
|
||||
}
|
||||
CP_XML_NODE(L"pic:nvPr")
|
||||
{
|
||||
std::wstring strNode;
|
||||
|
||||
if (val.type == typeVideo) strNode = L"a:videoFile";
|
||||
else if (val.type == typeAudio) strNode = L"a:audioFile";
|
||||
|
||||
if (false == strNode.empty())
|
||||
{
|
||||
CP_XML_NODE(strNode)
|
||||
{
|
||||
CP_XML_ATTR(L"r:link", val.objectId);
|
||||
}
|
||||
}
|
||||
if (false == val.extId.empty())
|
||||
{
|
||||
CP_XML_NODE(L"a:extLst")
|
||||
{
|
||||
CP_XML_NODE(L"a:ext")
|
||||
{
|
||||
CP_XML_ATTR(L"uri", L"{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}");
|
||||
CP_XML_NODE(L"wp15:media")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns:wp15", L"http://schemas.microsoft.com/office/word/2012/wordprocessingDrawing");
|
||||
if (val.extExternal)
|
||||
{
|
||||
CP_XML_ATTR(L"r:link", val.extId);
|
||||
}
|
||||
else
|
||||
{
|
||||
CP_XML_ATTR(L"r:embed", val.extId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
val.fill.bitmap->name_space = L"pic";
|
||||
oox_serialize_fill(CP_XML_STREAM(), val.fill);
|
||||
|
||||
CP_XML_NODE(L"pic:spPr")
|
||||
{
|
||||
val.serialize_xfrm(CP_XML_STREAM());
|
||||
|
||||
CP_XML_NODE(L"a:prstGeom")
|
||||
{
|
||||
CP_XML_ATTR(L"prst", L"rect");
|
||||
CP_XML_NODE(L"a:avLst");
|
||||
}
|
||||
|
||||
oox_serialize_ln(CP_XML_STREAM(), val.additional);
|
||||
oox_serialize_effects(CP_XML_STREAM(), val.additional);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------------------
|
||||
void docx_serialize_image_child(std::wostream & strm, _docx_drawing & val)
|
||||
{
|
||||
@ -291,8 +211,6 @@ void docx_serialize_image_child(std::wostream & strm, _docx_drawing & val)
|
||||
//CP_XML_ATTR(L"desc text",L"");
|
||||
CP_XML_ATTR(L"id", val.id + 1);
|
||||
CP_XML_ATTR(L"name", val.name);
|
||||
|
||||
//oox_serialize_action(CP_XML_STREAM(), val.action);
|
||||
}
|
||||
CP_XML_NODE(L"pic:cNvPicPr")
|
||||
{
|
||||
@ -428,11 +346,6 @@ void docx_serialize_common(std::wostream & strm, _docx_drawing & val)
|
||||
CP_XML_ATTR(L"uri", L"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup");
|
||||
docx_serialize_group_child(CP_XML_STREAM(), val);
|
||||
}
|
||||
else if (val.type == typeAudio || val.type == typeVideo || val.type == typeMedia)
|
||||
{
|
||||
CP_XML_ATTR(L"uri",L"http://schemas.openxmlformats.org/drawingml/2006/picture");
|
||||
docx_serialize_media_child(CP_XML_STREAM(), val);
|
||||
}
|
||||
else if (val.type == typeImage)
|
||||
{
|
||||
CP_XML_ATTR(L"uri",L"http://schemas.openxmlformats.org/drawingml/2006/picture");
|
||||
|
||||
@ -144,9 +144,9 @@ 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(), oox::document_place);
|
||||
Context.get_mediaitems()->dump_rels(rels_files_.get_rel_file()->get_rels());
|
||||
|
||||
Context.dump_hyperlinks (rels_files_.get_rel_file()->get_rels(), oox::document_place);
|
||||
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());
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ struct drawing_object_description
|
||||
{
|
||||
bool bNotes_;
|
||||
|
||||
oox::_rels_type type_;
|
||||
oox::RelsType type_;
|
||||
|
||||
std::wstring name_;
|
||||
std::wstring descriptor_;
|
||||
|
||||
@ -31,6 +31,7 @@
|
||||
*/
|
||||
|
||||
#include "hyperlinks.h"
|
||||
#include "oox_rels.h"
|
||||
|
||||
#include <xml/utils.h>
|
||||
|
||||
@ -47,7 +48,7 @@ hyperlinks::_ref hyperlinks::last()
|
||||
return r;
|
||||
}
|
||||
|
||||
std::wstring hyperlinks::add(const std::wstring & href, _rels_type_place type_place, bool drawing)
|
||||
std::wstring hyperlinks::add(const std::wstring & href, _type_place type_place, bool drawing)
|
||||
{
|
||||
std::wstring id = std::wstring(L"rHpId") + std::to_wstring(hrefs_.size() + 1);
|
||||
|
||||
@ -59,14 +60,14 @@ std::wstring hyperlinks::add(const std::wstring & href, _rels_type_place type_pl
|
||||
}
|
||||
|
||||
|
||||
void hyperlinks::dump_rels(rels & Rels, _rels_type_place type_place)
|
||||
void hyperlinks::dump_rels(rels & Rels, _type_place type)
|
||||
{
|
||||
size_t i = 0;
|
||||
for (size_t i = 0; i < hrefs_.size(); i++)
|
||||
{
|
||||
if (hrefs_[i].used_rels)continue; // уже использовали этот релс
|
||||
|
||||
if (hrefs_[i].type_place == type_place)
|
||||
if (hrefs_[i].type_place == type)
|
||||
{
|
||||
Rels.add( relationship(hrefs_[i].id, L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", hrefs_[i].href, L"External" ) );
|
||||
hrefs_[i].used_rels = true;
|
||||
|
||||
@ -31,29 +31,40 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "oox_rels.h"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
class rels;
|
||||
|
||||
class hyperlinks
|
||||
{
|
||||
public:
|
||||
enum _type_place
|
||||
{
|
||||
document_place,
|
||||
endnote_place,
|
||||
footnote_place,
|
||||
comment_place
|
||||
|
||||
};
|
||||
|
||||
struct _ref
|
||||
{
|
||||
std::wstring href;
|
||||
_rels_type_place type_place;
|
||||
bool drawing;
|
||||
std::wstring id;
|
||||
bool used_rels;
|
||||
std::wstring href;
|
||||
_type_place type_place;
|
||||
bool drawing;
|
||||
std::wstring id;
|
||||
bool used_rels;
|
||||
};
|
||||
|
||||
std::wstring add(const std::wstring & href, _rels_type_place type_place, bool drawing);
|
||||
std::wstring add(const std::wstring & href, _type_place type_place, bool drawing);
|
||||
|
||||
_ref last();
|
||||
|
||||
void dump_rels(rels & Rels, _rels_type_place type_place);
|
||||
void dump_rels(rels & Rels, _type_place type);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
@ -34,38 +34,47 @@
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <logging.h>
|
||||
|
||||
#include <float.h>
|
||||
|
||||
#include "../../../DesktopEditor/graphics/pro/Fonts.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace utils {
|
||||
|
||||
std::pair<double, double> GetMaxDigitSizePixelsImpl(const std::wstring & fontName, double fontSize, double dpi, long fontStyle, NSFonts::IFontManager *pFontManager)
|
||||
namespace
|
||||
{
|
||||
if (pFontManager == NULL) return std::pair<double, double>(7., 8.);
|
||||
class Error : public std::exception {};
|
||||
class LoadFontError : public Error {};
|
||||
class MeasureError : public Error {};
|
||||
}
|
||||
|
||||
int hr = FALSE;
|
||||
std::pair<float, float> GetMaxDigitSizePixelsImpl(const std::wstring & fontName, double fontSize, double dpi, long fontStyle, NSFonts::IFontManager *pFontManager)
|
||||
{
|
||||
if (pFontManager == NULL) return std::pair<float, float>(7,8);
|
||||
|
||||
int hr = FALSE;
|
||||
|
||||
if (FALSE == (hr = pFontManager->LoadFontByName(fontName, fontSize, fontStyle, dpi, dpi )))
|
||||
{
|
||||
if (FALSE == (hr = pFontManager->LoadFontByName(L"Arial", fontSize, fontStyle, dpi, dpi )))
|
||||
{
|
||||
return std::pair<double, double>(7, 8);
|
||||
return std::pair<float, float>(7, 8);
|
||||
}
|
||||
}
|
||||
|
||||
double maxWidth = 0;
|
||||
double maxHeight = 0;
|
||||
float maxWidth = 0;
|
||||
float maxHeight = 0;
|
||||
|
||||
double minWidth = 0xffffffff;
|
||||
double minHeight = 0xfffffff;
|
||||
float minWidth = 0xffff;
|
||||
float minHeight = 0xffff;
|
||||
|
||||
// for (int i = 0; i <= 9; ++i)
|
||||
{
|
||||
//if (FALSE == (hr = pFontManager->LoadString2( std::to_wstring(i), 0, 0)))
|
||||
// return std::pair<float, float>(7,8);
|
||||
|
||||
if (FALSE == (hr = pFontManager->LoadString2( L"0123456789abcdefghijklmnopqrstuvwxyz" , 0, 0)))//
|
||||
return std::pair<double, double>(7., 8.);
|
||||
if (FALSE == (hr = pFontManager->LoadString2( L"0123456789abcdefghijklmnopqrstuvwxyz" , 0, 0)))
|
||||
return std::pair<float, float>(7,8);
|
||||
|
||||
TBBox box;
|
||||
try
|
||||
@ -73,12 +82,12 @@ std::pair<double, double> GetMaxDigitSizePixelsImpl(const std::wstring & fontNam
|
||||
box = pFontManager->MeasureString();
|
||||
}catch(...)
|
||||
{
|
||||
return std::pair<double, double>(7.,8.);
|
||||
return std::pair<float, float>(7,8);
|
||||
}
|
||||
|
||||
if (box.fMaxX < -0xffff+1 || box.fMaxY < -0xffff+1 ||
|
||||
box.fMinX > 0xffff-1 || box.fMinY > 0xffff-1)
|
||||
return std::pair<double, double>(7., 8. );
|
||||
return std::pair<float, float>(7,8);
|
||||
|
||||
if (box.fMaxX - box.fMinX > maxWidth) maxWidth = box.fMaxX - box.fMinX;
|
||||
if (box.fMaxY - box.fMinY > maxHeight) maxHeight = box.fMaxY - box.fMinY;
|
||||
@ -87,13 +96,12 @@ std::pair<double, double> GetMaxDigitSizePixelsImpl(const std::wstring & fontNam
|
||||
if (box.fMaxY - box.fMinY < minHeight) minHeight = box.fMaxY - box.fMinY;
|
||||
}
|
||||
|
||||
double width = (minWidth + 2 * maxWidth) /36. /3.;
|
||||
//double width = (minWidth + 2 * maxWidth) / 5./*/36.*/ /3.;
|
||||
return std::pair<double, double>(width, maxHeight);
|
||||
double width = (minWidth + 2 * maxWidth) /36. /3.;
|
||||
return std::pair<float, float>(width, maxHeight);
|
||||
}
|
||||
|
||||
|
||||
std::pair<double, double> GetMaxDigitSizePixels(const std::wstring & fontName, double fontSize, double dpi, long fontStyle, NSFonts::IApplicationFonts *appFonts)
|
||||
std::pair<float, float> GetMaxDigitSizePixels(const std::wstring & fontName, double fontSize, double dpi, long fontStyle, NSFonts::IApplicationFonts *appFonts)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -103,7 +111,7 @@ std::pair<double, double> GetMaxDigitSizePixels(const std::wstring & fontName, d
|
||||
{
|
||||
NSFonts::IFontManager *pFontManager = appFonts->GenerateFontManager();
|
||||
|
||||
std::pair<double, double> val = GetMaxDigitSizePixelsImpl(fontName, fontSize, dpi, fontStyle, pFontManager);
|
||||
std::pair<float, float> val = GetMaxDigitSizePixelsImpl(fontName, fontSize, dpi, fontStyle, pFontManager);
|
||||
|
||||
if (pFontManager)
|
||||
{
|
||||
@ -118,7 +126,7 @@ std::pair<double, double> GetMaxDigitSizePixels(const std::wstring & fontName, d
|
||||
{
|
||||
// TODO: default value!
|
||||
}
|
||||
return std::pair<double, double>(7., 8.);
|
||||
return std::pair<float, float>(7, 8);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ namespace NSFonts
|
||||
namespace cpdoccore {
|
||||
namespace utils {
|
||||
|
||||
std::pair<double, double> GetMaxDigitSizePixels(const std::wstring & fontName, double fontSize, double dpi, long fontStyle, NSFonts::IApplicationFonts *appFonts);
|
||||
std::pair<float, float> GetMaxDigitSizePixels(const std::wstring & fontName, double fontSize, double dpi, long fontStyle, NSFonts::IApplicationFonts *appFonts);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,10 +59,18 @@ bool is_internal(const std::wstring & uri, const std::wstring & packetRoot)
|
||||
return NSFile::CFileBinary::Exists(resultPath) || NSDirectory::Exists(mediaPath);
|
||||
}
|
||||
|
||||
mediaitems::item::item(std::wstring const & _href,_rels_type _type, std::wstring const & _outputName,
|
||||
bool _mediaInternal, std::wstring const & _Id, _rels_type_place type_place_)
|
||||
: href(_href), type(_type), outputName(_outputName), mediaInternal(_mediaInternal), Id(_Id), valid(true), type_place(type_place_)
|
||||
//вообще говоря даже если файл покоцанный то мы все равно обязаны перенести "объект"
|
||||
mediaitems::item::item( std::wstring const & _href,
|
||||
RelsType _type,
|
||||
std::wstring const & _outputName,
|
||||
bool _mediaInternal,
|
||||
std::wstring const & _Id
|
||||
)
|
||||
: href(_href),
|
||||
type(_type),
|
||||
outputName(_outputName),
|
||||
mediaInternal(_mediaInternal),
|
||||
Id(_Id),
|
||||
valid(true) //вообще говоря даже если файл покоцанный то мы все равно обязаны перенести "объект"
|
||||
{
|
||||
count_add = 1;
|
||||
count_used = 0;
|
||||
@ -94,13 +102,13 @@ void mediaitems::set_font_directory(std::wstring pathFonts)
|
||||
applicationFonts_->InitializeFromFolder(pathFonts);
|
||||
}
|
||||
|
||||
std::wstring mediaitems::add_or_find(const std::wstring & href, _rels_type type, bool & isInternal, _rels_type_place type_place)
|
||||
std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, bool & isInternal)
|
||||
{
|
||||
std::wstring ref;
|
||||
return add_or_find(href, type, isInternal, ref, type_place);
|
||||
return add_or_find(href, type, isInternal, ref);
|
||||
}
|
||||
|
||||
std::wstring static get_default_file_name(_rels_type type)
|
||||
std::wstring static get_default_file_name(RelsType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@ -128,7 +136,7 @@ std::wstring static get_default_file_name(_rels_type type)
|
||||
return L"";
|
||||
}
|
||||
}
|
||||
std::wstring mediaitems::create_file_name(const std::wstring & uri, _rels_type type, bool & isInternal, size_t Num)
|
||||
std::wstring mediaitems::create_file_name(const std::wstring & uri, RelsType type, bool & isInternal, size_t Num)
|
||||
{
|
||||
if (uri.empty()) return L"";
|
||||
|
||||
@ -198,7 +206,7 @@ std::wstring mediaitems::detectImageFileExtension(const std::wstring &fileName)
|
||||
return XmlUtils::GetLower(sExt);
|
||||
}
|
||||
|
||||
std::wstring mediaitems::add_or_find(const std::wstring & href, _rels_type type, bool & isInternal, std::wstring & ref, _rels_type_place type_place)
|
||||
std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, bool & isInternal, std::wstring & ref)
|
||||
{
|
||||
bool isMediaInternal = true;
|
||||
std::wstring sub_path = L"media/";
|
||||
@ -246,8 +254,6 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, _rels_type type,
|
||||
std::wstring id;
|
||||
for (size_t i = 0 ; i < items_.size(); i++)
|
||||
{
|
||||
if (items_[i].type_place != type_place) continue;
|
||||
|
||||
if ((items_[i].href == inputPath && !inputPath.empty()) || (items_[i].type == type && inputPath.empty()))
|
||||
{
|
||||
id = items_[i].Id;
|
||||
@ -307,18 +313,13 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, _rels_type type,
|
||||
count_shape++;
|
||||
}
|
||||
|
||||
items_.push_back( item(inputPath, type, xml::utils::replace_text_to_xml(outputPath), isMediaInternal, id, type_place) );
|
||||
items_.push_back( item(inputPath, type, xml::utils::replace_text_to_xml(outputPath), isMediaInternal, id) );
|
||||
}
|
||||
|
||||
ref = outputPath;
|
||||
isInternal = isMediaInternal;
|
||||
return id;
|
||||
}
|
||||
void mediaitems::add_rels(bool isInternal, std::wstring const & rid, std::wstring const & ref, _rels_type type, _rels_type_place type_place)
|
||||
{
|
||||
items_.push_back( item(L"", type, ref, isInternal, rid, type_place) );
|
||||
}
|
||||
|
||||
std::wstring mediaitems::add_control_props(std::wstring & oox_target)
|
||||
{
|
||||
const bool isMediaInternal = true;
|
||||
@ -329,10 +330,10 @@ std::wstring mediaitems::add_control_props(std::wstring & oox_target)
|
||||
|
||||
oox_target = std::wstring(L"ctrlProp") + std::to_wstring(count_control) + L".xml";
|
||||
|
||||
items_.push_back( item(L"", typeControlProps, oox_target, isMediaInternal, rId, oox::document_place) );
|
||||
items_.push_back( item(L"", typeControlProps, oox_target, isMediaInternal, rId) );
|
||||
return rId;
|
||||
}
|
||||
void mediaitems::dump_rels(rels & Rels, _rels_type_place type_place)
|
||||
void mediaitems::dump_rels(rels & Rels)
|
||||
{
|
||||
for (size_t i = 0; i < items_.size(); i++)
|
||||
{
|
||||
@ -340,10 +341,8 @@ void mediaitems::dump_rels(rels & Rels, _rels_type_place type_place)
|
||||
if ( items_[i].type == typeShape ) continue;
|
||||
if ( items_[i].type == typeGroupShape ) continue;
|
||||
|
||||
if (items_[i].type_place != type_place) continue;
|
||||
|
||||
if (items_[i].count_used >= items_[i].count_add) continue; // уже использовали этот релс выше(колонтитул ....)
|
||||
|
||||
|
||||
Rels.add( relationship(
|
||||
items_[i].Id,
|
||||
get_rel_type (items_[i].type),
|
||||
|
||||
@ -46,28 +46,25 @@ namespace oox {
|
||||
class mediaitems
|
||||
{
|
||||
public:
|
||||
|
||||
mediaitems(const std::wstring & odfPacket);
|
||||
virtual ~mediaitems();
|
||||
|
||||
struct item
|
||||
{
|
||||
item( std::wstring const & href,
|
||||
_rels_type type,
|
||||
std::wstring const & outputName,
|
||||
bool mediaInternal,
|
||||
std::wstring const & Id,
|
||||
_rels_type_place type_place);
|
||||
item( std::wstring const & _href,
|
||||
RelsType _type,
|
||||
std::wstring const & _outputName,
|
||||
bool _mediaInternal,
|
||||
std::wstring const & _Id);
|
||||
|
||||
std::wstring href;
|
||||
_rels_type type;
|
||||
_rels_type_place type_place;
|
||||
std::wstring outputName;
|
||||
bool mediaInternal;
|
||||
bool valid;
|
||||
std::wstring Id;
|
||||
int count_used;
|
||||
int count_add;
|
||||
std::wstring href;
|
||||
RelsType type;
|
||||
std::wstring outputName;
|
||||
bool mediaInternal;
|
||||
bool valid;
|
||||
std::wstring Id;
|
||||
int count_used;
|
||||
int count_add;
|
||||
};
|
||||
typedef std::vector< item > items_array;
|
||||
|
||||
@ -86,17 +83,15 @@ public:
|
||||
void set_font_directory(std::wstring pathFonts);
|
||||
NSFonts::IApplicationFonts *applicationFonts() {return applicationFonts_;}
|
||||
|
||||
std::wstring add_or_find(const std::wstring & href, _rels_type type, bool & isInternal, _rels_type_place type_place);//возможны ссылки на один и тот же объект
|
||||
std::wstring add_or_find(const std::wstring & href, _rels_type type, bool & isInternal, std::wstring & ref, _rels_type_place type_place);
|
||||
std::wstring add_or_find(const std::wstring & href, RelsType type, bool & isInternal);//возможны ссылки на один и тот же объект
|
||||
std::wstring add_or_find(const std::wstring & href, RelsType type, bool & isInternal, std::wstring & ref);
|
||||
|
||||
void add_rels(bool isInternal, std::wstring const & rid, std::wstring const & ref, _rels_type type, _rels_type_place type_place);
|
||||
std::wstring add_control_props (std::wstring & oox_target);
|
||||
|
||||
void dump_rels(rels & Rels, _rels_type_place type);
|
||||
|
||||
items_array & items() { return items_; }
|
||||
void dump_rels(rels & Rels);
|
||||
items_array & items() { return items_; }
|
||||
|
||||
static std::wstring get_rel_type(_rels_type type)
|
||||
static std::wstring get_rel_type(RelsType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@ -116,7 +111,7 @@ public:
|
||||
return L"";
|
||||
}
|
||||
}
|
||||
static _rels_type detectMediaType(const std::wstring & fileName)
|
||||
static RelsType detectMediaType(const std::wstring & fileName)
|
||||
{
|
||||
size_t pos = fileName.rfind(L".");
|
||||
|
||||
@ -144,7 +139,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
std::wstring create_file_name (const std::wstring & uri, _rels_type type, bool & isInternal, size_t Num);
|
||||
std::wstring create_file_name (const std::wstring & uri, RelsType type, bool & isInternal, size_t Num);
|
||||
std::wstring detectImageFileExtension (const std::wstring &fileName);
|
||||
|
||||
items_array items_;
|
||||
|
||||
@ -137,7 +137,7 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
|
||||
{
|
||||
CP_XML_NODE(L"c:orientation")
|
||||
{
|
||||
odf_reader::GetProperty(content_.properties_, L"reverse-direction",boolVal);
|
||||
odf_reader::GetProperty(content_.properties_,L"reverse-direction",boolVal);
|
||||
if ((boolVal == true) && (boolVal.get()==true))
|
||||
{
|
||||
CP_XML_ATTR(L"val", "maxMin");
|
||||
@ -147,7 +147,7 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
|
||||
CP_XML_ATTR(L"val", "minMax");//default
|
||||
}
|
||||
}
|
||||
odf_reader::GetProperty(content_.properties_, L"maximum", doubleVal);
|
||||
odf_reader::GetProperty(content_.properties_,L"maximum", doubleVal);
|
||||
if (doubleVal)
|
||||
{
|
||||
CP_XML_NODE(L"c:max")
|
||||
@ -189,31 +189,16 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
|
||||
CP_XML_ATTR(L"val",L"l");// "b" | "l" | "r" | "t"// == bottom left right top
|
||||
}
|
||||
//oox_serialize_ln(_Wostream, content_.graphic_properties_);
|
||||
_CP_OPT(std::wstring) strNumFormat, strPercentFormat;
|
||||
_CP_OPT(bool) bLinkData;
|
||||
_CP_OPT(int) nTypeFormat;
|
||||
|
||||
odf_reader::GetProperty(content_.properties_, L"num_format", strNumFormat);
|
||||
odf_reader::GetProperty(content_.properties_, L"percentage_num_format", strPercentFormat);
|
||||
odf_reader::GetProperty(content_.properties_, L"data-label-number", nTypeFormat);
|
||||
odf_reader::GetProperty(content_.properties_, L"link-data-style-to-source", bLinkData);
|
||||
odf_reader::GetProperty(content_.properties_, L"num_format", strVal);
|
||||
odf_reader::GetProperty(content_.properties_, L"link-data-style-to-source", boolVal);
|
||||
|
||||
std::wstring formatCode;
|
||||
if ((nTypeFormat) && (*nTypeFormat == 2) && strPercentFormat)
|
||||
{
|
||||
formatCode = *strPercentFormat;
|
||||
}
|
||||
else if ((strNumFormat) && (strNumFormat->length() > 1))
|
||||
{
|
||||
formatCode = *strNumFormat;
|
||||
}
|
||||
|
||||
if (formatCode.length() > 1)
|
||||
if ((strVal) && (strVal->length() > 1))
|
||||
{
|
||||
CP_XML_NODE(L"c:numFmt")
|
||||
{
|
||||
CP_XML_ATTR(L"formatCode", formatCode);
|
||||
CP_XML_ATTR(L"sourceLinked", bLinkData.get_value_or(true));
|
||||
CP_XML_ATTR(L"formatCode", *strVal);
|
||||
CP_XML_ATTR(L"sourceLinked", boolVal.get_value_or(true));
|
||||
}
|
||||
}
|
||||
|
||||
@ -243,7 +228,7 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
|
||||
{
|
||||
shape.oox_serialize(CP_XML_STREAM());
|
||||
}
|
||||
odf_reader::GetProperty(content_.properties_, L"display_label",boolVal);
|
||||
odf_reader::GetProperty(content_.properties_,L"display_label",boolVal);
|
||||
if ((boolVal == true) && (boolVal.get()==true))
|
||||
{
|
||||
CP_XML_NODE(L"c:minorTickMark")
|
||||
@ -256,7 +241,7 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
|
||||
|
||||
title.oox_serialize(_Wostream);
|
||||
|
||||
odf_reader::GetProperty(content_.properties_, L"display_label", boolVal);
|
||||
odf_reader::GetProperty(content_.properties_,L"display_label", boolVal);
|
||||
if ((boolVal == true) && (boolVal.get()==true))
|
||||
{
|
||||
CP_XML_NODE(L"c:tickLblPos")
|
||||
@ -265,7 +250,7 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
|
||||
}
|
||||
}
|
||||
|
||||
shape.set(content_.graphic_properties_, content_.fill_) ;
|
||||
shape.set(content_.graphic_properties_,content_.fill_) ;
|
||||
shape.oox_serialize(_Wostream);
|
||||
|
||||
oox_serialize_default_text(_Wostream, content_.text_properties_);
|
||||
|
||||
@ -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, oox::chart_place);
|
||||
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,7 +75,7 @@ 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, oox::chart_place);
|
||||
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)
|
||||
|
||||
@ -45,6 +45,7 @@
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
|
||||
class oox_chart_context;
|
||||
typedef _CP_PTR(oox_chart_context) oox_chart_context_ptr;
|
||||
|
||||
@ -66,10 +67,9 @@ public:
|
||||
{
|
||||
pivot_source_ = source;
|
||||
}
|
||||
void set_title(odf_reader::chart::title & t, odf_reader::chart::title & sub)
|
||||
void set_title(odf_reader::chart::title & t)
|
||||
{
|
||||
title_.set_content(t);
|
||||
title_.set_sub_content(sub);
|
||||
}
|
||||
void add_axis(int type, odf_reader::chart::axis & content)
|
||||
{
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
class oox_chart_legend : boost::noncopyable
|
||||
class oox_chart_legend: boost::noncopyable
|
||||
{
|
||||
public:
|
||||
oox_chart_legend(){}
|
||||
|
||||
@ -127,32 +127,14 @@ void oox_chart_series::parse_properties()
|
||||
|
||||
data_labels_->set_showCatName(*boolVal);
|
||||
}
|
||||
_CP_OPT(std::wstring) strNumFormat, strPercentFormat;
|
||||
_CP_OPT(bool) bLinkData;
|
||||
_CP_OPT(int) nTypeFormat;
|
||||
odf_reader::GetProperty(content_.properties_, L"data-label-number", intVal);
|
||||
|
||||
odf_reader::GetProperty(content_.properties_, L"num_format", strNumFormat);
|
||||
odf_reader::GetProperty(content_.properties_, L"percentage_num_format", strPercentFormat);
|
||||
odf_reader::GetProperty(content_.properties_, L"data-label-number", nTypeFormat);
|
||||
odf_reader::GetProperty(content_.properties_, L"link-data-style-to-source", bLinkData);
|
||||
|
||||
std::wstring formatCode = strNumFormat.get_value_or(L"");
|
||||
if (nTypeFormat)
|
||||
if (intVal)
|
||||
{
|
||||
if (!data_labels_) data_labels_ = oox_data_labels();
|
||||
|
||||
if (*nTypeFormat == 1) data_labels_->set_showVal(true);
|
||||
if (*nTypeFormat == 2)
|
||||
{
|
||||
data_labels_->set_showPercent(true);
|
||||
if (strPercentFormat)
|
||||
formatCode = *strPercentFormat;
|
||||
}
|
||||
}
|
||||
if (false == formatCode.empty())
|
||||
{
|
||||
if (!data_labels_) data_labels_ = oox_data_labels();
|
||||
data_labels_->set_formatCode(formatCode, bLinkData.get_value_or(true));
|
||||
if (*intVal == 1) data_labels_->set_showVal(true);
|
||||
if (*intVal == 2) data_labels_->set_showPercent(true);
|
||||
}
|
||||
odf_reader::GetProperty(content_.properties_, L"label-position", intVal);
|
||||
if (intVal && labelPosEnabled_)
|
||||
@ -167,14 +149,8 @@ void oox_chart_series::setValues(int ind, std::vector<std::wstring> & values)
|
||||
{
|
||||
values_[ind].present = true;
|
||||
|
||||
if (ind == 0)
|
||||
{
|
||||
values_[ind].strRef_.present = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
values_[ind].numRef_.present = true;
|
||||
}
|
||||
if (ind == 0) values_[ind].strRef_.present = true;
|
||||
else values_[ind].numRef_.present = true;
|
||||
|
||||
for (size_t i = 0; i < values.size(); i++)
|
||||
{
|
||||
@ -490,7 +466,7 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
|
||||
|
||||
}
|
||||
}
|
||||
if (!content_.text_properties_)
|
||||
if (!content_.text_properties_.empty())
|
||||
{
|
||||
if (!data_labels_) data_labels_ = oox_data_labels();
|
||||
|
||||
@ -524,7 +500,7 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
|
||||
shape.oox_serialize(CP_XML_STREAM());
|
||||
}
|
||||
|
||||
if (!content_.points_[i].text_properties_)
|
||||
if (!content_.points_[i].text_properties_.empty())
|
||||
{
|
||||
if (!data_labels_) data_labels_ = oox_data_labels();
|
||||
|
||||
|
||||
@ -36,16 +36,11 @@
|
||||
#include "oox_chart_shape.h"
|
||||
#include "oox_drawing.h"
|
||||
|
||||
#include "../odf/odfcontext.h"
|
||||
#include "../odf/style_text_properties.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
void oox_chart_shape::oox_serialize(std::wostream & _Wostream)
|
||||
{
|
||||
if (!bEnabled) return;
|
||||
|
||||
CP_XML_WRITER(_Wostream)
|
||||
{
|
||||
CP_XML_NODE(L"c:spPr")
|
||||
@ -57,16 +52,15 @@ void oox_chart_shape::oox_serialize(std::wostream & _Wostream)
|
||||
|
||||
}
|
||||
|
||||
void oox_chart_shape::set(std::vector<odf_reader::_property> & prop, _oox_fill & fill)
|
||||
void oox_chart_shape::set(std::vector<odf_reader::_property> & prop,_oox_fill & fill)
|
||||
{
|
||||
bEnabled = true;
|
||||
content_ = prop;
|
||||
fill_ = fill;
|
||||
}
|
||||
|
||||
void oox_serialize_default_text(std::wostream & _Wostream, odf_reader::text_format_properties_content_ptr properties)
|
||||
void oox_serialize_default_text(std::wostream & _Wostream, std::vector<odf_reader::_property>& properties)
|
||||
{
|
||||
if (!properties) return;
|
||||
if (properties.size() < 1)return;
|
||||
|
||||
CP_XML_WRITER(_Wostream)
|
||||
{
|
||||
@ -78,8 +72,27 @@ void oox_serialize_default_text(std::wostream & _Wostream, odf_reader::text_form
|
||||
{
|
||||
CP_XML_NODE(L"a:pPr")
|
||||
{
|
||||
odf_reader::fonts_container fonts;
|
||||
properties->oox_serialize(CP_XML_STREAM(), true, fonts, true);
|
||||
CP_XML_NODE(L"a:defRPr")
|
||||
{
|
||||
_CP_OPT(double) dVal;
|
||||
_CP_OPT(int) iVal;
|
||||
_CP_OPT(std::wstring) sVal;
|
||||
|
||||
if (odf_reader::GetProperty(properties, L"font-size",dVal))
|
||||
CP_XML_ATTR(L"sz", (int)(dVal.get()*100));
|
||||
|
||||
if ((odf_reader::GetProperty(properties, L"font-style",iVal)) && (*iVal >0))
|
||||
CP_XML_ATTR(L"i", "true");
|
||||
|
||||
if ((odf_reader::GetProperty(properties, L"font-weight",iVal)) && (*iVal >0))
|
||||
CP_XML_ATTR(L"b", "true");
|
||||
|
||||
if (odf_reader::GetProperty(properties, L"font-color",sVal))
|
||||
CP_XML_NODE(L"a:solidFill")
|
||||
{
|
||||
CP_XML_NODE(L"a:srgbClr"){CP_XML_ATTR(L"val", sVal.get());}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,27 +39,19 @@
|
||||
#include "oox_drawing_fills.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
|
||||
namespace odf_reader {
|
||||
|
||||
class text_format_properties_content;
|
||||
typedef boost::shared_ptr<text_format_properties_content> text_format_properties_content_ptr;
|
||||
}
|
||||
|
||||
namespace oox {
|
||||
|
||||
void oox_serialize_default_text(std::wostream & _Wostream, odf_reader::text_format_properties_content_ptr properties);
|
||||
void oox_serialize_default_text(std::wostream & _Wostream, std::vector<odf_reader::_property>& properties);
|
||||
|
||||
class oox_chart_shape : boost::noncopyable
|
||||
{
|
||||
public:
|
||||
oox_chart_shape() : bEnabled ( false) {}
|
||||
oox_chart_shape(){}
|
||||
~oox_chart_shape(){}
|
||||
|
||||
void set(std::vector<odf_reader::_property> & prop,_oox_fill & fill);
|
||||
void oox_serialize(std::wostream & _Wostream);
|
||||
|
||||
bool bEnabled;
|
||||
private:
|
||||
std::vector<odf_reader::_property> content_;
|
||||
_oox_fill fill_;
|
||||
|
||||
@ -49,19 +49,18 @@ oox_data_labels::oox_data_labels()//подписи на значениях
|
||||
showPercent_ = false;
|
||||
showSerName_ = false;
|
||||
showVal_ = false;
|
||||
linkData_ = true;
|
||||
|
||||
position_ = -1; //not set
|
||||
}
|
||||
|
||||
void oox_data_labels::set_common_dLbl ( odf_reader::text_format_properties_content_ptr text_properties)
|
||||
void oox_data_labels::set_common_dLbl ( std::vector<odf_reader::_property> & text_properties)
|
||||
{
|
||||
textPr_ = text_properties;
|
||||
}
|
||||
|
||||
void oox_data_labels::add_dLbl(int ind, odf_reader::text_format_properties_content_ptr text_properties)
|
||||
void oox_data_labels::add_dLbl(int ind, std::vector<odf_reader::_property> & text_properties)
|
||||
{
|
||||
dLbls_.insert(std::make_pair(ind, text_properties));
|
||||
dLbls_.insert(std::pair<int, std::vector<odf_reader::_property>>(ind, text_properties));
|
||||
}
|
||||
|
||||
void oox_data_labels::oox_serialize(std::wostream & _Wostream)
|
||||
@ -70,17 +69,9 @@ void oox_data_labels::oox_serialize(std::wostream & _Wostream)
|
||||
{
|
||||
CP_XML_NODE(L"c:dLbls")
|
||||
{
|
||||
if (false == formatCode_.empty())
|
||||
{
|
||||
CP_XML_NODE(L"c:numFmt")
|
||||
{
|
||||
CP_XML_ATTR(L"formatCode", formatCode_);
|
||||
CP_XML_ATTR(L"sourceLinked", linkData_);
|
||||
}
|
||||
}
|
||||
oox_serialize_default_text(CP_XML_STREAM(), textPr_);
|
||||
|
||||
for (std::map<int, odf_reader::text_format_properties_content_ptr>::iterator it = dLbls_.begin(); it != dLbls_.end(); ++it)
|
||||
for (std::map<int, std::vector<odf_reader::_property>>::iterator it = dLbls_.begin(); it != dLbls_.end(); ++it)
|
||||
{
|
||||
CP_XML_NODE(L"c:dLbl")
|
||||
{
|
||||
|
||||
@ -41,13 +41,6 @@
|
||||
#include <xml/attributes.h>
|
||||
|
||||
namespace cpdoccore {
|
||||
|
||||
namespace odf_reader {
|
||||
|
||||
class text_format_properties_content;
|
||||
typedef boost::shared_ptr<text_format_properties_content> text_format_properties_content_ptr;
|
||||
}
|
||||
|
||||
namespace oox {
|
||||
|
||||
class oox_data_labels
|
||||
@ -65,22 +58,14 @@ public:
|
||||
void set_showPercent (bool Val){showPercent_ = Val;}
|
||||
void set_showSerName (bool Val){showSerName_ = Val;}
|
||||
void set_showVal (bool Val){showVal_ = Val;}
|
||||
|
||||
void set_formatCode (std::wstring & formatCode, bool linkData)
|
||||
{
|
||||
formatCode_ = formatCode;
|
||||
linkData_ = linkData;
|
||||
}
|
||||
|
||||
void set_position (int Val){position_ = Val;}
|
||||
|
||||
void add_dLbl (int ind, odf_reader::text_format_properties_content_ptr text_properties);
|
||||
void set_common_dLbl ( odf_reader::text_format_properties_content_ptr text_properties);
|
||||
void add_dLbl (int ind, std::vector<odf_reader::_property> & text_properties);
|
||||
void set_common_dLbl ( std::vector<odf_reader::_property> & text_properties);
|
||||
|
||||
private:
|
||||
|
||||
std::wstring formatCode_;
|
||||
bool linkData_;
|
||||
bool showBubbleSize_; // (Show Bubble Size) §21.2.2.178
|
||||
bool showCatName_; // (Show Category Name) §21.2.2.179
|
||||
bool showLeaderLines_; // (Show Leader Lines) §21.2.2.183
|
||||
@ -91,8 +76,8 @@ private:
|
||||
|
||||
int position_;
|
||||
|
||||
odf_reader::text_format_properties_content_ptr textPr_;
|
||||
std::map<int, odf_reader::text_format_properties_content_ptr> dLbls_;
|
||||
std::vector<odf_reader::_property> textPr_;
|
||||
std::map<int, std::vector<odf_reader::_property>> dLbls_;
|
||||
|
||||
|
||||
//delete (Delete) §21.2.2.40
|
||||
|
||||
@ -170,8 +170,7 @@ void oox_serialize_effects(std::wostream & strm, const std::vector<odf_reader::_
|
||||
double offsetY = dShadowOffsetY.get_value_or(0);
|
||||
|
||||
double dist = sqrt(offsetX * offsetX + offsetY * offsetY);
|
||||
double dir = atan(offsetY / offsetX) * 180. / 3.1415926;
|
||||
if (dir < 0) dir += 360;
|
||||
double dir = (offsetX > 0 ? atan(offsetY / offsetX) : 0) * 180. / 3.1415926;
|
||||
|
||||
CP_XML_ATTR(L"dist", (int)(dist));
|
||||
CP_XML_ATTR(L"dir", (int)(dir * 60000));
|
||||
|
||||
@ -77,7 +77,7 @@ namespace oox {
|
||||
std::wstring hId;
|
||||
std::wstring hRef;
|
||||
|
||||
_rels_type typeRels;
|
||||
RelsType typeRels;
|
||||
bool highlightClick;
|
||||
};
|
||||
class _oox_drawing
|
||||
@ -86,7 +86,7 @@ namespace oox {
|
||||
_oox_drawing() : type(typeUnknown), id(0), x(0), y(0), cx(0), cy(0), sub_type(0), hidden(false), inGroup(false), lined(false), connector(false), name(L"object"), extExternal(false)
|
||||
{
|
||||
}
|
||||
_rels_type type;
|
||||
RelsType type;
|
||||
|
||||
bool inGroup;
|
||||
size_t id;
|
||||
|
||||
@ -125,7 +125,7 @@ namespace oox {
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
struct _oox_fill
|
||||
{
|
||||
int type = -1;
|
||||
_oox_fill() : type(-1){}
|
||||
|
||||
oox_gradient_fill_ptr gradient;
|
||||
oox_hatch_fill_ptr hatch;
|
||||
@ -133,10 +133,11 @@ namespace oox {
|
||||
oox_solid_fill_ptr solid;
|
||||
|
||||
_CP_OPT(double) opacity;
|
||||
int type;
|
||||
|
||||
void clear()
|
||||
{
|
||||
type = -1;
|
||||
type=-1;
|
||||
opacity = boost::none;
|
||||
|
||||
gradient.reset();
|
||||
|
||||
@ -36,6 +36,13 @@
|
||||
#include <CPScopedPtr.h>
|
||||
|
||||
#include "../odf/chart_objects.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace odf_reader
|
||||
{
|
||||
//class style_table_cell_properties_attlist;
|
||||
}
|
||||
}
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
@ -51,6 +58,8 @@ public:
|
||||
//size_t borderId(const odf_reader::style_table_cell_properties_attlist * cellProp, bool & is_default);
|
||||
|
||||
void oox_serialize(std::wostream & _Wostream);/* const;*/
|
||||
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -389,18 +389,16 @@ void media::write(const std::wstring & RootPath)
|
||||
items[i].type == typeAudio ||
|
||||
items[i].type == typeVideo ))
|
||||
{
|
||||
std::wstring &file_name = items[i].href;
|
||||
std::wstring & file_name = items[i].href;
|
||||
std::wstring file_name_out = RootPath + FILE_SEPARATOR_STR + items[i].outputName;
|
||||
|
||||
if (file_name.empty()) continue;
|
||||
|
||||
CImageFileFormatChecker svmFileChecker;
|
||||
if (svmFileChecker.isSvmFile(file_name))
|
||||
{
|
||||
ConvertSvmToImage(file_name, file_name_out, appFonts_);
|
||||
}
|
||||
else
|
||||
NSFile::CFileBinary::Copy(file_name, file_name_out);
|
||||
NSFile::CFileBinary::Copy(items[i].href, file_name_out);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
enum _rels_type
|
||||
enum RelsType
|
||||
{
|
||||
typeUnknown = 0,
|
||||
typeDefault,
|
||||
@ -63,18 +63,10 @@ enum _rels_type
|
||||
typeControlProps,
|
||||
typeChartUserShapes
|
||||
};
|
||||
enum _rels_type_place
|
||||
{
|
||||
document_place,
|
||||
endnote_place,
|
||||
footnote_place,
|
||||
comment_place,
|
||||
header_footer_place,
|
||||
chart_place
|
||||
};
|
||||
|
||||
struct _rel
|
||||
{
|
||||
_rel(bool is_internal_, std::wstring const & rid_, std::wstring const & ref_, _rels_type const & type_) :
|
||||
_rel(bool is_internal_, std::wstring const & rid_, std::wstring const & ref_, RelsType const & type_) :
|
||||
is_internal(is_internal_),
|
||||
rid(rid_),
|
||||
ref(ref_),
|
||||
@ -84,7 +76,7 @@ struct _rel
|
||||
bool is_internal;
|
||||
std::wstring rid;
|
||||
std::wstring ref;
|
||||
_rels_type type;
|
||||
RelsType type;
|
||||
};
|
||||
|
||||
class relationship : public xml::element_impl<relationship>
|
||||
|
||||
@ -34,81 +34,63 @@
|
||||
#include <boost/functional.hpp>
|
||||
#include <CPOptional.h>
|
||||
#include <xml/simple_xml_writer.h>
|
||||
#include "../odf/odfcontext.h"
|
||||
#include "../odf/style_text_properties.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
void oox_title::oox_content_serialize(std::wostream & _Wostream, odf_reader::chart::title & content)
|
||||
{
|
||||
if (content_.content_.empty()) return;
|
||||
|
||||
CP_XML_WRITER(_Wostream)
|
||||
{
|
||||
CP_XML_NODE(L"a:p")
|
||||
{
|
||||
CP_XML_NODE(L"a:pPr")
|
||||
{
|
||||
CP_XML_NODE(L"a:defRPr"){}
|
||||
}
|
||||
CP_XML_NODE(L"a:r")
|
||||
{
|
||||
//odf_reader::fonts_container & fonts = context.fontContainer();
|
||||
odf_reader::fonts_container fonts;
|
||||
if (content.text_properties_)
|
||||
content.text_properties_->oox_serialize(CP_XML_STREAM(), true, fonts);
|
||||
|
||||
CP_XML_NODE(L"a:t")
|
||||
{
|
||||
CP_XML_CONTENT(content.content_);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void oox_title::oox_serialize(std::wostream & _Wostream)
|
||||
{
|
||||
if (!content_.bEnabled && !sub_.bEnabled) return;
|
||||
|
||||
if (content_.content_.length() < 1)
|
||||
{
|
||||
//возможен шаблон txPr
|
||||
return;
|
||||
}
|
||||
|
||||
CP_XML_WRITER(_Wostream)
|
||||
{
|
||||
CP_XML_NODE(L"c:title")
|
||||
{
|
||||
if (false == content_.content_.empty() || false == sub_.content_.empty())
|
||||
CP_XML_NODE(L"c:tx")
|
||||
{
|
||||
CP_XML_NODE(L"c:tx")
|
||||
{
|
||||
CP_XML_NODE(L"c:rich")
|
||||
{
|
||||
CP_XML_NODE(L"a:bodyPr"){}
|
||||
CP_XML_NODE(L"a:lstStyle"){}
|
||||
|
||||
oox_content_serialize(CP_XML_STREAM(), content_);
|
||||
oox_content_serialize(CP_XML_STREAM(), sub_);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (content_.text_properties_)
|
||||
{
|
||||
CP_XML_NODE(L"c:txPr")
|
||||
CP_XML_NODE(L"c:rich")
|
||||
{
|
||||
CP_XML_NODE(L"a:bodyPr"){}
|
||||
CP_XML_NODE(L"a:lstStyle"){}
|
||||
|
||||
CP_XML_NODE(L"a:p")
|
||||
{
|
||||
CP_XML_NODE(L"a:pPr")
|
||||
{
|
||||
CP_XML_NODE(L"a:defRPr")
|
||||
CP_XML_NODE(L"a:defRPr"){}
|
||||
}
|
||||
CP_XML_NODE(L"a:r")
|
||||
{
|
||||
CP_XML_NODE(L"a:rPr")
|
||||
{
|
||||
//odf_reader::fonts_container & fonts = context.fontContainer();
|
||||
odf_reader::fonts_container fonts;
|
||||
content_.text_properties_->oox_serialize(CP_XML_STREAM(), true, fonts);
|
||||
_CP_OPT(double) dVal;
|
||||
_CP_OPT(std::wstring) sVal;
|
||||
_CP_OPT(int) iVal;
|
||||
|
||||
if (odf_reader::GetProperty(content_.text_properties_,L"font-size",dVal))
|
||||
CP_XML_ATTR(L"sz", (int)(dVal.get()*100));
|
||||
|
||||
if ((odf_reader::GetProperty(content_.text_properties_,L"font-style",iVal)) && (*iVal >0))
|
||||
CP_XML_ATTR(L"i", "true");
|
||||
if ((odf_reader::GetProperty(content_.text_properties_,L"font-weight",iVal)) && (*iVal >0))
|
||||
CP_XML_ATTR(L"b", "true");
|
||||
if (odf_reader::GetProperty(content_.text_properties_,L"font-color",sVal))
|
||||
CP_XML_NODE(L"a:solidFill")
|
||||
{
|
||||
CP_XML_NODE(L"a:srgbClr"){CP_XML_ATTR(L"val", sVal.get());}
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"a:t")
|
||||
{
|
||||
CP_XML_CONTENT(content_.content_);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
layout_.oox_serialize(CP_XML_STREAM());
|
||||
@ -116,13 +98,8 @@ void oox_title::oox_serialize(std::wostream & _Wostream)
|
||||
{
|
||||
CP_XML_ATTR(L"val", 0);
|
||||
}
|
||||
|
||||
oox_chart_shape shape;
|
||||
shape.set(content_.graphic_properties_, content_.fill_);
|
||||
shape.oox_serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,17 +55,9 @@ public:
|
||||
{
|
||||
content_ = t;
|
||||
}
|
||||
void set_sub_content(odf_reader::chart::title & t)
|
||||
{
|
||||
sub_ = t;
|
||||
}
|
||||
private:
|
||||
void oox_content_serialize(std::wostream & _Wostream, odf_reader::chart::title & content);
|
||||
|
||||
cpdoccore::oox::oox_layout layout_;
|
||||
|
||||
odf_reader::chart::title content_;
|
||||
odf_reader::chart::title sub_;
|
||||
|
||||
//extLst (Chart Extensibility) §21.2.2.64
|
||||
//layout (Layout) §21.2.2.88
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
|
||||
#include <xml/simple_xml_writer.h>
|
||||
#include "oox_types_chart.h"
|
||||
#include "oox_chart_shape.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
@ -58,9 +59,8 @@ void oox_chart::set_name(const std::wstring& val)
|
||||
}
|
||||
void oox_chart::set_content_series(odf_reader::chart::series & content)
|
||||
{
|
||||
series_.back()->content_= content;
|
||||
series_.back()->content_=content;
|
||||
}
|
||||
|
||||
void oox_chart::set_values_series(int ind, std::vector<std::wstring> & val)
|
||||
{
|
||||
if (val.empty())return;
|
||||
@ -467,21 +467,7 @@ void oox_stock_chart::set_properties(std::vector<odf_reader::_property> g)
|
||||
|
||||
oox_chart::set_properties(g);
|
||||
|
||||
odf_reader::GetProperty(g, L"japanese-candle-stick", bCandleStick);
|
||||
}
|
||||
void oox_stock_chart::set_stock_gain_marke(odf_reader::chart::simple & obj)
|
||||
{
|
||||
if (!obj.bEnabled) return;
|
||||
}
|
||||
void oox_stock_chart::set_stock_loss_marker(odf_reader::chart::simple & obj)
|
||||
{
|
||||
if (!obj.bEnabled) return;
|
||||
}
|
||||
void oox_stock_chart::set_stock_range_line(odf_reader::chart::simple & obj)
|
||||
{
|
||||
if (!obj.bEnabled) return;
|
||||
|
||||
range_line.set(obj.graphic_properties_, obj.fill_);
|
||||
odf_reader::GetProperty(g, L"japanese-candle-stick",bCandleStick);
|
||||
}
|
||||
void oox_stock_chart::oox_serialize(std::wostream & _Wostream)
|
||||
{
|
||||
@ -494,13 +480,10 @@ void oox_stock_chart::oox_serialize(std::wostream & _Wostream)
|
||||
{
|
||||
oox_serialize_common(CP_XML_STREAM());
|
||||
|
||||
if (range_line.bEnabled)
|
||||
{
|
||||
CP_XML_NODE(L"c:hiLowLines")
|
||||
{
|
||||
range_line.oox_serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
//CP_XML_NODE(L"c:hiLowLines")//hiLowLines (High Low Lines) §21.2.2.80
|
||||
//{
|
||||
// //shape.oox_serialize(CP_XML_STREAM());
|
||||
//}
|
||||
CP_XML_NODE(L"c:upDownBars")
|
||||
{
|
||||
CP_XML_NODE(L"c:gapWidth")
|
||||
|
||||
@ -31,9 +31,11 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <iosfwd>
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include "oox_chart_shape.h"
|
||||
#include <CPScopedPtr.h>
|
||||
#include <CPSharedPtr.h>
|
||||
|
||||
#include "xlsx_color.h"
|
||||
#include "oox_chart_series.h"
|
||||
@ -82,9 +84,6 @@ public:
|
||||
void set_name (const std::wstring& val);
|
||||
void set_content_series (odf_reader::chart::series & content);
|
||||
|
||||
virtual void set_stock_gain_marke(odf_reader::chart::simple & obj){}
|
||||
virtual void set_stock_loss_marker(odf_reader::chart::simple & obj){}
|
||||
virtual void set_stock_range_line(odf_reader::chart::simple & obj){}
|
||||
//void set_showBubbleSize(bool Val){data_labels_.set_showBubbleSize(Val);}
|
||||
//void set_showCatName(bool Val){data_labels_.set_showCatName(Val);}
|
||||
//void set_showLeaderLines(bool Val){data_labels_.set_showLeaderLines(Val);}
|
||||
@ -350,9 +349,6 @@ class oox_stock_chart: public oox_chart
|
||||
|
||||
static _CP_PTR(oox_chart) create();
|
||||
|
||||
virtual void set_stock_gain_marke(odf_reader::chart::simple & obj);
|
||||
virtual void set_stock_loss_marker(odf_reader::chart::simple & obj);
|
||||
virtual void set_stock_range_line(odf_reader::chart::simple & obj);
|
||||
|
||||
_CP_OPT(bool) bCandleStick;
|
||||
|
||||
@ -361,7 +357,6 @@ class oox_stock_chart: public oox_chart
|
||||
|
||||
_oox_fill fill_;
|
||||
|
||||
oox_chart_shape range_line;
|
||||
//dropLines (Drop Lines) §21.2.2.53
|
||||
//hiLowLines (High Low Lines) §21.2.2.80
|
||||
//ser (Line Chart Series) §21.2.2.171
|
||||
|
||||
@ -208,7 +208,7 @@ void pptx_conversion_context::start_document()
|
||||
instances.push_back(odfContext.styleContainer().style_default_by_type(odf_types::style_family::Presentation));
|
||||
instances.push_back(odfContext.styleContainer().style_by_name(L"Default",odf_types::style_family::Presentation,false));
|
||||
|
||||
odf_reader::text_format_properties_content_ptr textFormatProperties = calc_text_properties_content(instances);
|
||||
odf_reader::text_format_properties_content textFormatProperties = calc_text_properties_content(instances);
|
||||
odf_reader::paragraph_format_properties parFormatProperties = calc_paragraph_properties_content(instances);
|
||||
|
||||
process_masters_ = false;
|
||||
|
||||
@ -50,7 +50,7 @@ public:
|
||||
bool isInternal,
|
||||
std::wstring const & rid,
|
||||
std::wstring const & ref,
|
||||
_rels_type type)
|
||||
RelsType type)
|
||||
{
|
||||
pptx_drawings_.push_back(d);
|
||||
|
||||
@ -79,7 +79,7 @@ public:
|
||||
bool isInternal,
|
||||
std::wstring const & rid,
|
||||
std::wstring const & ref,
|
||||
_rels_type type)
|
||||
RelsType type)
|
||||
{
|
||||
|
||||
bool present = false;
|
||||
@ -153,7 +153,7 @@ void pptx_drawings::add(_pptx_drawing const & d,
|
||||
bool isInternal,
|
||||
std::wstring const & rid,
|
||||
std::wstring const & ref,
|
||||
_rels_type type)
|
||||
RelsType type)
|
||||
{
|
||||
impl_->add(d, isInternal, rid, ref, type);
|
||||
}
|
||||
@ -161,7 +161,7 @@ void pptx_drawings::add(/**/
|
||||
bool isInternal,
|
||||
std::wstring const & rid,
|
||||
std::wstring const & ref,
|
||||
_rels_type type)
|
||||
RelsType type)
|
||||
{
|
||||
impl_->add(isInternal, rid, ref, type);
|
||||
}
|
||||
|
||||
@ -56,13 +56,13 @@ public:
|
||||
bool isInternal,
|
||||
std::wstring const & rid,
|
||||
std::wstring const & ref,
|
||||
_rels_type type
|
||||
RelsType type
|
||||
);
|
||||
void add(/**/
|
||||
bool isInternal,
|
||||
std::wstring const & rid,
|
||||
std::wstring const & ref,
|
||||
_rels_type type
|
||||
RelsType type
|
||||
);
|
||||
bool empty() const;
|
||||
|
||||
|
||||
@ -82,11 +82,11 @@ public:
|
||||
|
||||
bool header, footer, date_time, slideNum;
|
||||
|
||||
void add_drawing(_pptx_drawing const & d, bool isInternal, std::wstring const & rid, std::wstring const & ref, _rels_type type)
|
||||
void add_drawing(_pptx_drawing const & d, bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type)
|
||||
{
|
||||
pptx_drawings_->add(d, isInternal, rid, ref, type);
|
||||
}
|
||||
void add_additional_rels (bool isInternal, std::wstring const & rid, std::wstring const & ref, _rels_type type)
|
||||
void add_additional_rels (bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type)
|
||||
{
|
||||
pptx_drawings_->add(isInternal, rid, ref, type);
|
||||
}
|
||||
@ -359,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, oox::document_place);
|
||||
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;
|
||||
@ -413,7 +413,7 @@ void pptx_slide_context::start_action(std::wstring action)
|
||||
impl_->object_description_.action_.highlightClick = true;
|
||||
}
|
||||
}
|
||||
void pptx_slide_context::set_link(std::wstring link, _rels_type typeRels)
|
||||
void pptx_slide_context::set_link(std::wstring link, RelsType typeRels)
|
||||
{
|
||||
++hlinks_size_;
|
||||
|
||||
@ -423,7 +423,7 @@ void pptx_slide_context::set_link(std::wstring link, _rels_type typeRels)
|
||||
{
|
||||
bool isMediaInternal = true;
|
||||
|
||||
impl_->object_description_.action_.hSoundId = get_mediaitems()->add_or_find(link, typeAudio, isMediaInternal, impl_->object_description_.action_.hSoundRef, oox::document_place);
|
||||
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
|
||||
@ -578,7 +578,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, oox::document_place);
|
||||
drawing.fill.bitmap->rId = get_mediaitems()->add_or_find(obj.xlink_href_, typeImage, isMediaInternal, ref);
|
||||
drawing.fill.bitmap->isInternal = isMediaInternal;
|
||||
|
||||
if (drawing.type == typeShape)
|
||||
@ -586,7 +586,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, oox::document_place);
|
||||
std::wstring rId = get_mediaitems()->add_or_find(L"", typeShape, isMediaInternal, ref);
|
||||
|
||||
add_drawing(drawing, isMediaInternal, rId, ref, typeShape);//объект
|
||||
|
||||
@ -601,7 +601,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, oox::document_place);
|
||||
drawing.objectId = get_mediaitems()->add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
|
||||
|
||||
add_drawing(drawing, isMediaInternal, drawing.objectId, ref, drawing.type);
|
||||
}
|
||||
@ -610,7 +610,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, oox::document_place);
|
||||
std::wstring rId = get_mediaitems()->add_or_find(L"", obj.type_, isMediaInternal, ref);
|
||||
|
||||
add_drawing(drawing, isMediaInternal, rId, ref, drawing.type);
|
||||
|
||||
@ -625,12 +625,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, oox::document_place);
|
||||
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, oox::document_place);
|
||||
std::wstring rId = get_mediaitems()->add_or_find(L"", typeShape, isMediaInternal, ref);
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
_CP_OPT(std::wstring) sPlaceHolderType;
|
||||
@ -653,7 +653,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, oox::document_place);
|
||||
drawing.objectId = get_mediaitems()->add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
|
||||
drawing.objectProgId = obj.descriptor_;
|
||||
|
||||
if (!drawing.fill.bitmap)
|
||||
@ -664,7 +664,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, oox::document_place);
|
||||
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);
|
||||
@ -676,7 +676,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, oox::document_place);
|
||||
drawing.objectId = get_mediaitems()->add_or_find(obj.xlink_href_, drawing.type, isMediaInternal, ref);
|
||||
drawing.extId = L"ext" + drawing.objectId;
|
||||
drawing.extExternal = !isMediaInternal;
|
||||
|
||||
@ -687,7 +687,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, oox::document_place);
|
||||
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);
|
||||
@ -725,7 +725,7 @@ mediaitems_ptr & pptx_slide_context::get_mediaitems()
|
||||
return impl_->get_mediaitems();
|
||||
}
|
||||
|
||||
void pptx_slide_context::add_rels( bool isInternal, std::wstring const & rid, std::wstring const & ref, _rels_type type)
|
||||
void pptx_slide_context::add_rels( bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type)
|
||||
{
|
||||
impl_->add_additional_rels(isInternal, rid, ref, type);
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ public:
|
||||
void end_frame();
|
||||
|
||||
void start_action (std::wstring action);
|
||||
void set_link (std::wstring link, _rels_type typeRels = typeHyperlink);
|
||||
void set_link (std::wstring link, RelsType typeRels = typeHyperlink);
|
||||
void end_action ();
|
||||
|
||||
void start_table();
|
||||
@ -123,7 +123,7 @@ public:
|
||||
void add_rels( bool isInternal,
|
||||
std::wstring const & rid,
|
||||
std::wstring const & ref,
|
||||
_rels_type type);
|
||||
RelsType type);
|
||||
|
||||
void set_footer();
|
||||
void set_header();
|
||||
|
||||
@ -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, oox::document_place);
|
||||
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);
|
||||
|
||||
@ -42,9 +42,9 @@
|
||||
#include <xml/utils.h>
|
||||
|
||||
#include "../odf/odfcontext.h"
|
||||
#include "../odf/style_text_properties.h"
|
||||
#include "../odf/calcs_styles.h"
|
||||
|
||||
#include "../odf/style_text_properties.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
@ -269,11 +269,7 @@ void pptx_text_context::Impl::ApplyTextProperties(std::wstring style_name, std::
|
||||
else if (para_style) get_styles_context().start_process_style(para_style);
|
||||
else get_styles_context().start_process_style(baseStyle);
|
||||
|
||||
odf_reader::text_format_properties_content_ptr text_props = calc_text_properties_content(instances);
|
||||
if (text_props)
|
||||
{
|
||||
propertiesOut.apply_from(*text_props.get());
|
||||
}
|
||||
propertiesOut.apply_from(calc_text_properties_content(instances));
|
||||
}
|
||||
|
||||
void pptx_text_context::Impl::ApplyListProperties(odf_reader::paragraph_format_properties & propertiesOut, int Level)
|
||||
|
||||
@ -88,7 +88,7 @@ bool is_default(const xlsx_alignment & rVal)
|
||||
}
|
||||
|
||||
xlsx_alignment OdfProperties2XlsxAlignment( xlsx_conversion_context * context,
|
||||
const odf_reader::text_format_properties_content_ptr textProp,
|
||||
const odf_reader::text_format_properties_content * textProp,
|
||||
const odf_reader::paragraph_format_properties * parProp,
|
||||
const odf_reader::style_table_cell_properties_attlist * cellProp)
|
||||
{
|
||||
|
||||
@ -39,10 +39,9 @@ namespace cpdoccore {
|
||||
namespace odf_reader {
|
||||
|
||||
class text_format_properties_content;
|
||||
typedef boost::shared_ptr<text_format_properties_content> text_format_properties_content_ptr;
|
||||
|
||||
class paragraph_format_properties;
|
||||
class style_table_cell_properties_attlist;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,7 +71,7 @@ struct xlsx_alignment
|
||||
};
|
||||
|
||||
xlsx_alignment OdfProperties2XlsxAlignment( xlsx_conversion_context * context,
|
||||
const odf_reader::text_format_properties_content_ptr textProp,
|
||||
const odf_reader::text_format_properties_content * textProp,
|
||||
const odf_reader::paragraph_format_properties * parProp,
|
||||
const odf_reader::style_table_cell_properties_attlist * cellProp);
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@ namespace oox {
|
||||
|
||||
struct XlsxCellType
|
||||
{
|
||||
enum type { null, b, n, e, s, str, inlineStr, d };
|
||||
enum type { null, b, n, e, s, str, inlineStr };
|
||||
};
|
||||
|
||||
int odf_string_to_build_in(const int value_type);
|
||||
|
||||
@ -107,26 +107,22 @@ void xlsx_drawing_position::serialize(std::wostream & strm, const std::wstring &
|
||||
{
|
||||
CP_XML_NODE( ns_title + (ns_title.empty() ? L"" : L":") + (type == xlsx_drawing_position::from ? L"from" : L"to") )
|
||||
{
|
||||
//CP_XML_NODE(ns + (ns.empty() ? L"" : L":") + L"col")
|
||||
CP_XML_NODE(L"xdr:col")
|
||||
{
|
||||
CP_XML_NODE(ns + (ns.empty() ? L"" : L":") + L"col")
|
||||
{
|
||||
CP_XML_CONTENT(position.col);
|
||||
}
|
||||
|
||||
//CP_XML_NODE(ns + (ns.empty() ? L"" : L":") + L"colOff")
|
||||
CP_XML_NODE(L"xdr:colOff")
|
||||
CP_XML_NODE(ns + (ns.empty() ? L"" : L":") + L"colOff")
|
||||
{
|
||||
CP_XML_CONTENT(static_cast<size_t>(position.colOff));
|
||||
}
|
||||
|
||||
//CP_XML_NODE(ns + (ns.empty() ? L"" : L":") + L"row")
|
||||
CP_XML_NODE(L"xdr:row")
|
||||
CP_XML_NODE(ns + (ns.empty() ? L"" : L":") + L"row")
|
||||
{
|
||||
CP_XML_CONTENT(position.row);
|
||||
}
|
||||
|
||||
//CP_XML_NODE(ns + (ns.empty() ? L"" : L":") + L"rowOff")
|
||||
CP_XML_NODE(L"xdr:rowOff")
|
||||
CP_XML_NODE(ns + (ns.empty() ? L"" : L":") + L"rowOff")
|
||||
{
|
||||
CP_XML_CONTENT(static_cast<size_t>(position.rowOff));
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ public:
|
||||
return std::pair<std::wstring, std::wstring>(fileName, rId);
|
||||
}
|
||||
|
||||
std::pair<std::wstring, std::wstring> add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings, _rels_type const & type_)
|
||||
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";
|
||||
@ -108,7 +108,7 @@ 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, _rels_type const & type_)
|
||||
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, type_);
|
||||
}
|
||||
@ -626,14 +626,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, oox::document_place);
|
||||
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, false, false);//собственно это не объект, а доп рел и ref объекта
|
||||
|
||||
isMediaInternal=true;
|
||||
std::wstring rId = impl_->get_mediaitems()->add_or_find(L"", typeShape, isMediaInternal, ref, oox::document_place);
|
||||
std::wstring rId = impl_->get_mediaitems()->add_or_find(L"", typeShape, isMediaInternal, ref);
|
||||
|
||||
xlsx_drawings_->add(drawing, isMediaInternal, rId, ref, typeShape);//объект
|
||||
|
||||
@ -651,7 +651,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, oox::document_place);
|
||||
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)
|
||||
@ -691,7 +691,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, oox::document_place);
|
||||
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);
|
||||
@ -705,7 +705,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, oox::document_place);
|
||||
std::wstring rId = impl_->get_mediaitems()->add_or_find(L"", obj.type_, isMediaInternal, ref);
|
||||
xlsx_drawings_->add(drawing, isMediaInternal, rId, ref, obj.type_);
|
||||
}
|
||||
|
||||
@ -725,7 +725,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, oox::document_place);
|
||||
std::wstring rId = impl_->get_mediaitems()->add_or_find(L"", obj.type_, isMediaInternal, ref);
|
||||
xlsx_drawings_->add(drawing, isMediaInternal, rId, ref, obj.type_);
|
||||
|
||||
}
|
||||
@ -756,7 +756,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, oox::document_place);
|
||||
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, false);//собственно это не объект, а доп рел и ref объекта
|
||||
@ -798,7 +798,7 @@ void xlsx_drawing_context::start_action(std::wstring action)
|
||||
impl_->object_description_.action_.enabled = true;
|
||||
}
|
||||
|
||||
void xlsx_drawing_context::set_link(std::wstring link, _rels_type typeRels)
|
||||
void xlsx_drawing_context::set_link(std::wstring link, RelsType typeRels)
|
||||
{//hyprelinks only
|
||||
++hlinks_size_;
|
||||
std::wstring hId = L"hId" + std::to_wstring(hlinks_size_);
|
||||
|
||||
@ -62,7 +62,7 @@ public:
|
||||
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, _rels_type const & type_ = typeDefault);
|
||||
std::pair<std::wstring, std::wstring> add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings, RelsType const & type_ = typeDefault);
|
||||
std::pair<std::wstring, std::wstring> add_drawing_vml(std::wstring const & content, xlsx_drawings_ptr drawings);
|
||||
|
||||
const std::vector<drawing_elm> & content() const;
|
||||
@ -152,7 +152,7 @@ public:
|
||||
void process_objects(xlsx_table_metrics & table_metrics);
|
||||
|
||||
void start_action(std::wstring action);
|
||||
void set_link(std::wstring link, _rels_type typeRels = typeHyperlink);
|
||||
void set_link(std::wstring link, RelsType typeRels = typeHyperlink);
|
||||
void end_action();
|
||||
|
||||
private:
|
||||
|
||||
@ -44,7 +44,7 @@ namespace oox {
|
||||
class xlsx_drawings::Impl
|
||||
{
|
||||
public:
|
||||
void add(_xlsx_drawing & d, bool isInternal, std::wstring const & rid, std::wstring const & ref, _rels_type type, bool sheet_rel )//объект
|
||||
void add(_xlsx_drawing & d, bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel )//объект
|
||||
{
|
||||
if ( type == typeControlProps || type == typeComment)
|
||||
{
|
||||
@ -72,7 +72,7 @@ public:
|
||||
drawing_rels_.push_back(_rel(false, d.action.hId, d.action.hRef, d.action.typeRels));
|
||||
}
|
||||
}
|
||||
void add( bool isInternal, std::wstring const & rid, std::wstring const & ref, _rels_type type, bool sheet_rel, bool vml_rel) //не объект
|
||||
void add( bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel, bool vml_rel) //не объект
|
||||
{
|
||||
bool present = false;
|
||||
|
||||
@ -305,12 +305,12 @@ xlsx_drawings::~xlsx_drawings()
|
||||
}
|
||||
|
||||
void xlsx_drawings::add(_xlsx_drawing & d, bool isInternal, std::wstring const & rid,
|
||||
std::wstring const & ref, _rels_type type, bool sheet_rel)
|
||||
std::wstring const & ref, RelsType type, bool sheet_rel)
|
||||
{
|
||||
impl_->add(d, isInternal, rid, ref, type, sheet_rel);
|
||||
}
|
||||
|
||||
void xlsx_drawings::add( bool isInternal, std::wstring const & rid, std::wstring const & ref, _rels_type type, bool sheet_rel, bool vml_rel)
|
||||
void xlsx_drawings::add( bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel, bool vml_rel)
|
||||
{
|
||||
impl_->add(isInternal, rid, ref, type, sheet_rel, vml_rel);
|
||||
}
|
||||
|
||||
@ -46,14 +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, _rels_type const & _type)
|
||||
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;
|
||||
_rels_type type;
|
||||
RelsType type;
|
||||
};
|
||||
|
||||
class _xlsx_drawing;
|
||||
@ -65,8 +65,8 @@ public:
|
||||
~xlsx_drawings ();
|
||||
static xlsx_drawings_ptr create(bool inGroup);
|
||||
|
||||
void add ( _xlsx_drawing & d, bool isInternal, std::wstring const & rid, std::wstring const & ref, _rels_type type, bool sheet_rel = false );
|
||||
void add ( bool isInternal, std::wstring const & rid, std::wstring const & ref, _rels_type type, bool sheet_rel, bool vml_rel);
|
||||
void add ( _xlsx_drawing & d, bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel = false );
|
||||
void add ( bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel, bool vml_rel);
|
||||
|
||||
bool empty() const;
|
||||
bool vml_empty() const;
|
||||
|
||||
@ -65,7 +65,7 @@ xlsx_dxfs::~xlsx_dxfs()
|
||||
{
|
||||
}
|
||||
|
||||
size_t xlsx_dxfs::dxfId( const odf_reader::text_format_properties_content_ptr textProp,
|
||||
size_t xlsx_dxfs::dxfId( const odf_reader::text_format_properties_content * textProp,
|
||||
const odf_reader::graphic_format_properties * graphProp,
|
||||
const odf_reader::style_table_cell_properties_attlist * cellProp)
|
||||
{
|
||||
|
||||
@ -35,14 +35,11 @@
|
||||
#include <string>
|
||||
|
||||
#include <CPScopedPtr.h>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace odf_reader {
|
||||
|
||||
class text_format_properties_content;
|
||||
typedef boost::shared_ptr<text_format_properties_content> text_format_properties_content_ptr;
|
||||
|
||||
class graphic_format_properties;
|
||||
class paragraph_format_properties;
|
||||
class style_table_cell_properties_attlist;
|
||||
@ -56,7 +53,7 @@ namespace oox {
|
||||
xlsx_dxfs();
|
||||
~xlsx_dxfs();
|
||||
|
||||
size_t dxfId( const odf_reader::text_format_properties_content_ptr textProp,
|
||||
size_t dxfId( const odf_reader::text_format_properties_content * textProp,
|
||||
const odf_reader::graphic_format_properties * graphProp,
|
||||
const odf_reader::style_table_cell_properties_attlist * cellProp);
|
||||
|
||||
|
||||
@ -32,10 +32,6 @@
|
||||
#include "xlsx_fill.h"
|
||||
#include "xlsx_fills.h"
|
||||
|
||||
#include "../odf/style_text_properties.h"
|
||||
#include "../odf/style_table_properties.h"
|
||||
#include "../odf/style_paragraph_properties.h"
|
||||
|
||||
#include <xml/simple_xml_writer.h>
|
||||
|
||||
#include <boost/functional.hpp>
|
||||
@ -91,7 +87,7 @@ size_t xlsx_fills::size() const
|
||||
return impl_->fills_.size();
|
||||
}
|
||||
|
||||
size_t xlsx_fills::fillId( const odf_reader::text_format_properties_content_ptr textProp,
|
||||
size_t xlsx_fills::fillId( const odf_reader::text_format_properties_content * textProp,
|
||||
const odf_reader::paragraph_format_properties * parProp,
|
||||
const odf_reader::style_table_cell_properties_attlist * cellProp, bool default_set)
|
||||
{
|
||||
@ -99,7 +95,7 @@ size_t xlsx_fills::fillId( const odf_reader::text_format_properties_content_ptr
|
||||
return fillId(textProp, parProp, cellProp,default_set, is_default);
|
||||
}
|
||||
|
||||
size_t xlsx_fills::fillId( const odf_reader::text_format_properties_content_ptr textProp,
|
||||
size_t xlsx_fills::fillId( const odf_reader::text_format_properties_content * textProp,
|
||||
const odf_reader::paragraph_format_properties * parProp,
|
||||
const odf_reader::style_table_cell_properties_attlist * cellProp,
|
||||
bool default_set, bool & is_default)
|
||||
|
||||
@ -40,9 +40,7 @@
|
||||
namespace cpdoccore {
|
||||
namespace odf_reader {
|
||||
|
||||
class text_format_properties_content;
|
||||
typedef boost::shared_ptr<text_format_properties_content> text_format_properties_content_ptr;
|
||||
|
||||
class text_format_properties_content;
|
||||
class paragraph_format_properties;
|
||||
class style_table_cell_properties_attlist;
|
||||
}
|
||||
@ -59,11 +57,11 @@ namespace oox {
|
||||
public:
|
||||
size_t size() const;
|
||||
|
||||
size_t fillId( const odf_reader::text_format_properties_content_ptr textProp,
|
||||
size_t fillId( const odf_reader::text_format_properties_content * textProp,
|
||||
const odf_reader::paragraph_format_properties * parProp,
|
||||
const odf_reader::style_table_cell_properties_attlist * cellProp, bool default_set);
|
||||
|
||||
size_t fillId( const odf_reader::text_format_properties_content_ptr textProp,
|
||||
size_t fillId( const odf_reader::text_format_properties_content * textProp,
|
||||
const odf_reader::paragraph_format_properties * parProp,
|
||||
const odf_reader::style_table_cell_properties_attlist * cellProp, bool default_set,bool & is_default);
|
||||
|
||||
|
||||
@ -263,19 +263,19 @@ std::size_t hash_value(xlsx_font const & val)
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
XlsxFontCharset GetXlsxFontCharset(const odf_reader::text_format_properties_content_ptr textProp)
|
||||
XlsxFontCharset GetXlsxFontCharset(const odf_reader::text_format_properties_content * textProp)
|
||||
{
|
||||
// TODO
|
||||
return XCHARSET_EMPTY;
|
||||
}
|
||||
|
||||
XlsxFontFamily GetXlsxFontFamily(const odf_reader::text_format_properties_content_ptr textProp)
|
||||
XlsxFontFamily GetXlsxFontFamily(const odf_reader::text_format_properties_content * textProp)
|
||||
{
|
||||
// TODO
|
||||
return XFAMILY_EMPTY;
|
||||
}
|
||||
|
||||
xlsx_font::xlsx_font ( const odf_reader::text_format_properties_content_ptr textProp,
|
||||
xlsx_font::xlsx_font ( const odf_reader::text_format_properties_content * textProp,
|
||||
const odf_reader::paragraph_format_properties * parProp,
|
||||
const odf_reader::style_table_cell_properties_attlist * cellProp)
|
||||
{
|
||||
|
||||
@ -41,10 +41,8 @@
|
||||
namespace cpdoccore {
|
||||
namespace odf_reader {
|
||||
|
||||
class text_format_properties_content;
|
||||
typedef boost::shared_ptr<text_format_properties_content> text_format_properties_content_ptr;
|
||||
|
||||
class paragraph_format_properties;
|
||||
class text_format_properties_content;
|
||||
class paragraph_format_properties;
|
||||
class style_table_cell_properties_attlist;
|
||||
}
|
||||
}
|
||||
@ -106,7 +104,7 @@ namespace oox {
|
||||
struct xlsx_font
|
||||
{
|
||||
xlsx_font () {};
|
||||
xlsx_font ( const odf_reader::text_format_properties_content_ptr textProp,
|
||||
xlsx_font ( const odf_reader::text_format_properties_content * textProp,
|
||||
const odf_reader::paragraph_format_properties * parProp,
|
||||
const odf_reader::style_table_cell_properties_attlist * cellProp);
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ public:
|
||||
|
||||
|
||||
size_t size() const;
|
||||
size_t fontId( const odf_reader::text_format_properties_content_ptr textProp,
|
||||
size_t fontId( const odf_reader::text_format_properties_content * textProp,
|
||||
const odf_reader::paragraph_format_properties * parProp,
|
||||
const odf_reader::style_table_cell_properties_attlist * cellProp);
|
||||
|
||||
@ -99,7 +99,7 @@ void xlsx_fonts::Impl::serialize(std::wostream & _Wostream) const
|
||||
}
|
||||
}
|
||||
|
||||
size_t xlsx_fonts::Impl::fontId(const odf_reader::text_format_properties_content_ptr textProp,
|
||||
size_t xlsx_fonts::Impl::fontId(const odf_reader::text_format_properties_content * textProp,
|
||||
const odf_reader::paragraph_format_properties * parProp,
|
||||
const odf_reader::style_table_cell_properties_attlist * cellProp)
|
||||
{
|
||||
@ -123,7 +123,7 @@ size_t xlsx_fonts::Impl::fontId(const odf_reader::text_format_properties_content
|
||||
//}
|
||||
|
||||
/*
|
||||
int xlsx_fonts::Impl::getIndex(const odf_reader::text_format_properties_content_ptr textProp,
|
||||
int xlsx_fonts::Impl::getIndex(const odf_reader::text_format_properties_content * textProp,
|
||||
const odf_reader::paragraph_format_properties * parProp,
|
||||
const odf_reader::style_table_cell_properties_attlist * cellProp) const
|
||||
{
|
||||
@ -160,7 +160,7 @@ void xlsx_fonts::serialize(std::wostream & _Wostream) const
|
||||
return impl_->serialize(_Wostream);
|
||||
}
|
||||
|
||||
size_t xlsx_fonts::fontId(const odf_reader::text_format_properties_content_ptr textProp,
|
||||
size_t xlsx_fonts::fontId(const odf_reader::text_format_properties_content * textProp,
|
||||
const odf_reader::paragraph_format_properties * parProp,
|
||||
const odf_reader::style_table_cell_properties_attlist * cellProp)
|
||||
{
|
||||
|
||||
@ -33,15 +33,12 @@
|
||||
|
||||
#include <iosfwd>
|
||||
#include <CPScopedPtr.h>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace odf_reader {
|
||||
|
||||
class text_format_properties_content;
|
||||
typedef boost::shared_ptr<text_format_properties_content> text_format_properties_content_ptr;
|
||||
|
||||
class paragraph_format_properties;
|
||||
class paragraph_format_properties;
|
||||
class style_table_cell_properties_attlist;
|
||||
}
|
||||
}
|
||||
@ -60,7 +57,7 @@ namespace oox {
|
||||
public:
|
||||
size_t size() const;
|
||||
|
||||
size_t fontId( const odf_reader::text_format_properties_content_ptr textProp,
|
||||
size_t fontId( const odf_reader::text_format_properties_content * textProp,
|
||||
const odf_reader::paragraph_format_properties * parProp,
|
||||
const odf_reader::style_table_cell_properties_attlist * cellProp);
|
||||
const xlsx_font & getFont(size_t id) const;
|
||||
|
||||
@ -67,18 +67,12 @@ public:
|
||||
}
|
||||
|
||||
std::wstring last_format_;
|
||||
std::wstring last_date_format_ = L"yyyy.mmmm.dd";
|
||||
std::wstring last_time_format_ = L"hh:mm:ss";
|
||||
|
||||
bool in_convert_style_;
|
||||
};
|
||||
|
||||
num_format_context::num_format_context(odf_reader::odf_read_context & odfContext): odf_context_(odfContext), impl_(new Impl()), impl2_(new Impl2())
|
||||
{
|
||||
bDate = false;
|
||||
bTime = false;
|
||||
bPercent = false;
|
||||
bCurrency = false;
|
||||
}
|
||||
|
||||
num_format_context::~num_format_context()
|
||||
@ -87,12 +81,7 @@ num_format_context::~num_format_context()
|
||||
|
||||
void num_format_context::start_format(const std::wstring & style_name)
|
||||
{
|
||||
bDate = false;
|
||||
bTime = false;
|
||||
bPercent = false;
|
||||
bCurrency = false;
|
||||
|
||||
impl_->reset_current();
|
||||
impl_->reset_current();
|
||||
impl_->current_style_name_ = style_name;
|
||||
impl_->in_convert_style_ = true;
|
||||
}
|
||||
@ -106,26 +95,13 @@ void num_format_context::end_format()
|
||||
{
|
||||
impl_->last_format_ = impl_->stream_.str();
|
||||
impl_->reset_current();
|
||||
|
||||
if (bDate)
|
||||
impl_->last_date_format_ = impl_->last_format_;
|
||||
|
||||
if (bTime)
|
||||
impl_->last_time_format_ = impl_->last_format_;
|
||||
}
|
||||
|
||||
std::wstring num_format_context::get_last_format() const
|
||||
{
|
||||
return impl_->last_format_;
|
||||
}
|
||||
std::wstring num_format_context::get_last_date_format() const
|
||||
{
|
||||
return impl_->last_date_format_;
|
||||
}
|
||||
std::wstring num_format_context::get_last_time_format() const
|
||||
{
|
||||
return impl_->last_time_format_;
|
||||
}
|
||||
|
||||
void num_format_context::start_complex_format()
|
||||
{
|
||||
impl2_->complex_number_format_.reset();
|
||||
|
||||
@ -55,8 +55,6 @@ public:
|
||||
void end_format();
|
||||
|
||||
std::wstring get_last_format() const;
|
||||
std::wstring get_last_date_format() const;
|
||||
std::wstring get_last_time_format() const;
|
||||
|
||||
void start_complex_format();
|
||||
void add_format(std::wstring const & cond, std::wstring const & format);
|
||||
@ -64,11 +62,6 @@ public:
|
||||
|
||||
//std::wstring default_data_style(int type);
|
||||
odf_reader::odf_read_context & odf_context_;
|
||||
|
||||
bool bDate;
|
||||
bool bTime;
|
||||
bool bPercent;
|
||||
bool bCurrency;
|
||||
private:
|
||||
class Impl;
|
||||
_CP_SCOPED_PTR(Impl) impl_;
|
||||
|
||||
@ -227,8 +227,6 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
|
||||
|
||||
CP_XML_STREAM() << impl_->header_footer_.str();
|
||||
|
||||
CP_XML_STREAM() << impl_->breaks_.str();
|
||||
|
||||
if (false == impl_->drawingId_.empty())
|
||||
{
|
||||
CP_XML_NODE(L"drawing")
|
||||
@ -265,6 +263,10 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
|
||||
}
|
||||
}
|
||||
CP_XML_STREAM() << impl_->picture_background_.str();
|
||||
|
||||
//или тут ??? headerFooter
|
||||
|
||||
CP_XML_STREAM() << impl_->breaks_.str();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1513,15 +1513,12 @@ void xlsx_pivots_context::add_field_cache(int index, std::wstring value, bool sh
|
||||
//XmlUtils::replace_all(value, L" ", L"");
|
||||
//XmlUtils::replace_all(value, L"\x00A0", L"");
|
||||
}
|
||||
std::wstring strNumber = oox::GetNumberFromString(value);
|
||||
if (false == strNumber.empty())
|
||||
if (oox::IsNumber(value))
|
||||
{
|
||||
try
|
||||
{
|
||||
XmlUtils::replace_all(strNumber, L" ", L"");
|
||||
XmlUtils::replace_all(strNumber, L",", L".");
|
||||
|
||||
dVal = boost::lexical_cast<double>(strNumber);
|
||||
XmlUtils::replace_all(value, L",", L".");
|
||||
dVal = boost::lexical_cast<double>(value);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
|
||||
@ -29,6 +29,10 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../odf/style_text_properties.h"
|
||||
#include "../odf/style_paragraph_properties.h"
|
||||
|
||||
#include "xlsxconversioncontext.h"
|
||||
#include "xlsx_fonts.h"
|
||||
#include "xlsx_xf.h"
|
||||
@ -39,9 +43,6 @@
|
||||
#include "xlsx_cell_styles.h"
|
||||
#include "xlsx_numFmts.h"
|
||||
|
||||
#include "../odf/style_text_properties.h"
|
||||
#include "../odf/style_paragraph_properties.h"
|
||||
|
||||
#include <boost/unordered_set.hpp>
|
||||
#include <boost/functional.hpp>
|
||||
|
||||
@ -57,13 +58,13 @@ public:
|
||||
|
||||
size_t size() const;
|
||||
|
||||
size_t xfId( const odf_reader::text_format_properties_content_ptr textProp,
|
||||
size_t xfId( const odf_reader::text_format_properties_content * textProp,
|
||||
const odf_reader::paragraph_format_properties * parProp,
|
||||
const odf_reader::style_table_cell_properties_attlist * cellProp,
|
||||
const xlsx_cell_format * xlxsCellFormat,
|
||||
const std::wstring &num_format, bool default_set, bool & is_visible);
|
||||
|
||||
size_t dxfId( const odf_reader::text_format_properties_content_ptr textProp,
|
||||
size_t dxfId( const odf_reader::text_format_properties_content * textProp,
|
||||
const odf_reader::graphic_format_properties * graphProp,
|
||||
const odf_reader::style_table_cell_properties_attlist * cellProp);
|
||||
|
||||
@ -109,14 +110,14 @@ size_t xlsx_style_manager::Impl::size() const
|
||||
return cellXfs_.size();
|
||||
}
|
||||
|
||||
size_t xlsx_style_manager::Impl::dxfId( const odf_reader::text_format_properties_content_ptr textProp,
|
||||
const odf_reader::graphic_format_properties * graphProp,
|
||||
size_t xlsx_style_manager::Impl::dxfId( const odf_reader::text_format_properties_content * textProp,
|
||||
const odf_reader::graphic_format_properties * graphProp,
|
||||
const odf_reader::style_table_cell_properties_attlist * cellProp)
|
||||
{
|
||||
return dxfs_.dxfId(textProp, graphProp, cellProp);
|
||||
}
|
||||
|
||||
size_t xlsx_style_manager::Impl::xfId(const odf_reader::text_format_properties_content_ptr textProp,
|
||||
size_t xlsx_style_manager::Impl::xfId(const odf_reader::text_format_properties_content * textProp,
|
||||
const odf_reader::paragraph_format_properties * parProp,
|
||||
const odf_reader::style_table_cell_properties_attlist * cellProp,
|
||||
const xlsx_cell_format * xlxsCellFormat,
|
||||
@ -247,7 +248,7 @@ size_t xlsx_style_manager::size() const
|
||||
return impl_->size();
|
||||
}
|
||||
|
||||
size_t xlsx_style_manager::xfId(const odf_reader::text_format_properties_content_ptr textProp,
|
||||
size_t xlsx_style_manager::xfId(const odf_reader::text_format_properties_content * textProp,
|
||||
const odf_reader::paragraph_format_properties * parProp,
|
||||
const odf_reader::style_table_cell_properties_attlist * cellProp,
|
||||
const xlsx_cell_format * xlxsCellFormat,
|
||||
@ -257,7 +258,7 @@ size_t xlsx_style_manager::xfId(const odf_reader::text_format_properties_content
|
||||
return impl_->xfId(textProp, parProp, cellProp, xlxsCellFormat, num_format, default_set, is_visible);
|
||||
}
|
||||
|
||||
size_t xlsx_style_manager::xfId(const odf_reader::text_format_properties_content_ptr textProp,
|
||||
size_t xlsx_style_manager::xfId(const odf_reader::text_format_properties_content * textProp,
|
||||
const odf_reader::paragraph_format_properties * parProp,
|
||||
const odf_reader::style_table_cell_properties_attlist * cellProp,
|
||||
const xlsx_cell_format * xlxsCellFormat,
|
||||
@ -265,7 +266,7 @@ size_t xlsx_style_manager::xfId(const odf_reader::text_format_properties_content
|
||||
{
|
||||
return impl_->xfId(textProp, parProp, cellProp, xlxsCellFormat, num_format, default_set,is_visible);
|
||||
}
|
||||
size_t xlsx_style_manager::dxfId(const odf_reader::text_format_properties_content_ptr textProp,
|
||||
size_t xlsx_style_manager::dxfId(const odf_reader::text_format_properties_content * textProp,
|
||||
const odf_reader::graphic_format_properties * graphProp,
|
||||
const odf_reader::style_table_cell_properties_attlist * cellProp)
|
||||
{
|
||||
|
||||
@ -38,12 +38,10 @@
|
||||
namespace cpdoccore {
|
||||
namespace odf_reader {
|
||||
|
||||
class text_format_properties_content;
|
||||
class graphic_format_properties;
|
||||
class paragraph_format_properties;
|
||||
class style_table_cell_properties_attlist;
|
||||
|
||||
class text_format_properties_content;
|
||||
typedef boost::shared_ptr<text_format_properties_content> text_format_properties_content_ptr;
|
||||
}
|
||||
|
||||
namespace oox {
|
||||
@ -57,19 +55,19 @@ public:
|
||||
xlsx_style_manager(xlsx_conversion_context *context);
|
||||
size_t size() const;
|
||||
|
||||
size_t xfId(const odf_reader::text_format_properties_content_ptr textProp,
|
||||
size_t xfId(const odf_reader::text_format_properties_content * textProp,
|
||||
const odf_reader::paragraph_format_properties * parProp,
|
||||
const odf_reader::style_table_cell_properties_attlist * cellProp,
|
||||
const xlsx_cell_format * xlxsCellFormat,
|
||||
const std::wstring &num_format, bool default_set,bool & is_visible);
|
||||
|
||||
size_t xfId(const odf_reader::text_format_properties_content_ptr textProp,
|
||||
size_t xfId(const odf_reader::text_format_properties_content * textProp,
|
||||
const odf_reader::paragraph_format_properties * parProp,
|
||||
const odf_reader::style_table_cell_properties_attlist * cellProp,
|
||||
const xlsx_cell_format * xlxsCellFormat,
|
||||
const std::wstring &num_format, bool default_set);
|
||||
|
||||
size_t dxfId(const odf_reader::text_format_properties_content_ptr textProp,
|
||||
size_t dxfId(const odf_reader::text_format_properties_content * textProp,
|
||||
const odf_reader::graphic_format_properties * graphProp,
|
||||
const odf_reader::style_table_cell_properties_attlist * cellProp);
|
||||
|
||||
|
||||
@ -137,7 +137,7 @@ void xlsx_table_context::end_database_range()
|
||||
|
||||
void xlsx_table_context::set_database_range_value(int index, const std::wstring& value)
|
||||
{
|
||||
if (index < 0 || index > (int)xlsx_data_ranges_.size()) return;
|
||||
if (index < 0 || index > xlsx_data_ranges_.size()) return;
|
||||
|
||||
size_t col = state()->current_column();
|
||||
size_t row = state()->current_row();
|
||||
|
||||
@ -41,14 +41,15 @@
|
||||
#include <xml/utils.h>
|
||||
|
||||
#include "../odf/odfcontext.h"
|
||||
#include "../odf/style_text_properties.h"
|
||||
#include "../odf/style_paragraph_properties.h"
|
||||
#include "../odf/calcs_styles.h"
|
||||
|
||||
#include "../odf/style_paragraph_properties.h"
|
||||
#include "../odf/style_text_properties.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
|
||||
class xlsx_text_context::Impl: boost::noncopyable
|
||||
{
|
||||
public:
|
||||
@ -64,7 +65,7 @@ public:
|
||||
std::wstring end_span2();
|
||||
|
||||
void start_cell_content();
|
||||
void set_cell_text_properties( odf_reader::text_format_properties_content_ptr text_properties);
|
||||
void set_cell_text_properties( odf_reader::text_format_properties_content * text_properties);
|
||||
int end_cell_content();
|
||||
|
||||
void start_comment_content();
|
||||
@ -99,11 +100,10 @@ private:
|
||||
bool only_text;
|
||||
|
||||
odf_reader::styles_container & styles_;
|
||||
odf_reader::text_format_properties_content * text_properties_cell_;
|
||||
odf_reader::styles_container * local_styles_ptr_;
|
||||
|
||||
odf_reader::text_format_properties_content_ptr text_properties_cell_;
|
||||
|
||||
std::wstring dump_paragraph();
|
||||
std::wstring dump_paragraph();
|
||||
std::wstring dump_run();
|
||||
|
||||
void write_rPr(std::wostream & strm);
|
||||
@ -281,14 +281,10 @@ void xlsx_text_context::Impl::ApplyTextProperties(std::wstring style, std::wstri
|
||||
if (paraStyle) instances.push_back(paraStyle);
|
||||
if (textStyle) instances.push_back(textStyle);
|
||||
|
||||
odf_reader::text_format_properties_content_ptr text_props = calc_text_properties_content(instances);
|
||||
if (text_props)
|
||||
{
|
||||
propertiesOut.apply_from(*text_props.get());
|
||||
}
|
||||
propertiesOut.apply_from(calc_text_properties_content(instances));
|
||||
}
|
||||
|
||||
void xlsx_text_context::Impl::set_cell_text_properties(odf_reader::text_format_properties_content_ptr text_properties)
|
||||
void xlsx_text_context::Impl::set_cell_text_properties(odf_reader::text_format_properties_content * text_properties)
|
||||
{
|
||||
text_properties_cell_ = text_properties;
|
||||
}
|
||||
@ -328,24 +324,11 @@ void xlsx_text_context::Impl::write_rPr(std::wostream & strm)
|
||||
{
|
||||
CP_XML_NODE(L"rPr")
|
||||
{
|
||||
if (text_properties_.fo_font_weight_)
|
||||
if (text_properties_.fo_font_family_)
|
||||
{
|
||||
CP_XML_NODE(L"b")
|
||||
CP_XML_NODE(L"rFont")
|
||||
{
|
||||
if (text_properties_.fo_font_weight_->get_type() > 0)
|
||||
CP_XML_ATTR(L"val", "true");
|
||||
else
|
||||
CP_XML_ATTR(L"val", "false");
|
||||
}
|
||||
}
|
||||
if (text_properties_.fo_font_style_)
|
||||
{
|
||||
CP_XML_NODE(L"i")
|
||||
{
|
||||
if (text_properties_.fo_font_style_->get_type() > 0)
|
||||
CP_XML_ATTR(L"val", "true");
|
||||
else
|
||||
CP_XML_ATTR(L"val", "false");
|
||||
CP_XML_ATTR(L"val", text_properties_.fo_font_family_.get());
|
||||
}
|
||||
}
|
||||
if (text_properties_.fo_font_size_)
|
||||
@ -362,11 +345,24 @@ void xlsx_text_context::Impl::write_rPr(std::wostream & strm)
|
||||
CP_XML_ATTR(L"rgb", text_properties_.fo_color_->get_hex_value());
|
||||
}
|
||||
}
|
||||
if (text_properties_.fo_font_family_)
|
||||
if (text_properties_.fo_font_style_)
|
||||
{
|
||||
CP_XML_NODE(L"rFont")
|
||||
CP_XML_NODE(L"i")
|
||||
{
|
||||
CP_XML_ATTR(L"val", text_properties_.fo_font_family_.get());
|
||||
if (text_properties_.fo_font_style_->get_type() > 0)
|
||||
CP_XML_ATTR(L"val", "true");
|
||||
else
|
||||
CP_XML_ATTR(L"val", "false");
|
||||
}
|
||||
}
|
||||
if (text_properties_.fo_font_weight_)
|
||||
{
|
||||
CP_XML_NODE(L"b")
|
||||
{
|
||||
if (text_properties_.fo_font_weight_->get_type() > 0)
|
||||
CP_XML_ATTR(L"val", "true");
|
||||
else
|
||||
CP_XML_ATTR(L"val", "false");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -586,7 +582,7 @@ void xlsx_text_context::set_local_styles_container(odf_reader::styles_container*
|
||||
return impl_->set_local_styles_container(local_styles_);
|
||||
}
|
||||
|
||||
void xlsx_text_context::set_cell_text_properties(odf_reader::text_format_properties_content_ptr text_properties)
|
||||
void xlsx_text_context::set_cell_text_properties(odf_reader::text_format_properties_content *text_properties)
|
||||
{
|
||||
return impl_->set_cell_text_properties(text_properties);
|
||||
}
|
||||
|
||||
@ -46,7 +46,6 @@ namespace odf_reader
|
||||
typedef boost::shared_ptr<styles_container> styles_container_ptr;
|
||||
|
||||
class text_format_properties_content;
|
||||
typedef boost::shared_ptr<text_format_properties_content> text_format_properties_content_ptr;
|
||||
};
|
||||
namespace oox {
|
||||
|
||||
@ -59,7 +58,7 @@ public:
|
||||
~xlsx_text_context ();
|
||||
|
||||
void set_local_styles_container (odf_reader::styles_container *local_styles_);
|
||||
void set_cell_text_properties (odf_reader::text_format_properties_content_ptr text_properties);
|
||||
void set_cell_text_properties (odf_reader::text_format_properties_content *text_properties);
|
||||
|
||||
void start_paragraph(const std::wstring & styleName);
|
||||
void end_paragraph();
|
||||
|
||||
@ -51,18 +51,7 @@ bool IsNumber(const std::wstring &value)
|
||||
|
||||
return boost::regex_search(value/*.begin(), value.end(), results*/, rule);
|
||||
}
|
||||
std::wstring GetNumberFromString(const std::wstring &value)
|
||||
{
|
||||
boost::wregex rule(L"^\\s*\\-{0,1}[0-9]*[.,]{0,1}[0-9]*\\s*$");
|
||||
boost::match_results<std::wstring::const_iterator> results;
|
||||
|
||||
if (boost::regex_match(value, results, rule))
|
||||
{
|
||||
return (results[0].str());
|
||||
}
|
||||
else
|
||||
return L"";
|
||||
}
|
||||
std::wstring getColAddress(size_t col)
|
||||
{
|
||||
static const size_t r = (L'Z' - L'A' + 1);
|
||||
@ -176,20 +165,17 @@ bool parseBoolVal(const std::wstring & str)
|
||||
{
|
||||
std::wstring s = str;
|
||||
boost::algorithm::to_lower(s);
|
||||
|
||||
if (L"false" == str || L"0" == str)
|
||||
return false;
|
||||
else
|
||||
if (L"true" == str || L"1" == str)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
std::wstring cellType2Str(XlsxCellType::type type)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case XlsxCellType::d:
|
||||
return L"d";
|
||||
case XlsxCellType::b:
|
||||
case XlsxCellType::b:
|
||||
return L"b";
|
||||
case XlsxCellType::n:
|
||||
return L"n";
|
||||
|
||||
@ -41,7 +41,6 @@ namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
bool IsNumber(const std::wstring &value);
|
||||
std::wstring GetNumberFromString(const std::wstring &value);
|
||||
|
||||
std::wstring getColAddress(size_t col);
|
||||
std::wstring getRowAddress(size_t row);
|
||||
|
||||
@ -122,7 +122,7 @@ void xlsx_conversion_context::start_document()
|
||||
instances.push_back(odfContext.styleContainer().style_default_by_type(odf_types::style_family::TableCell));
|
||||
instances.push_back(odfContext.styleContainer().style_by_name(L"Default", odf_types::style_family::TableCell, false));
|
||||
|
||||
odf_reader::text_format_properties_content_ptr textFormatProperties = calc_text_properties_content(instances);
|
||||
odf_reader::text_format_properties_content textFormatProperties = calc_text_properties_content(instances);
|
||||
odf_reader::paragraph_format_properties parFormatProperties = calc_paragraph_properties_content(instances);
|
||||
odf_reader::style_table_cell_properties_attlist cellFormatProperties = calc_table_cell_properties(instances);
|
||||
|
||||
@ -131,7 +131,7 @@ void xlsx_conversion_context::start_document()
|
||||
cellFormat.set_cell_type(XlsxCellType::s);
|
||||
cellFormat.set_num_format(oox::odf_string_to_build_in(0));
|
||||
|
||||
default_style_ = get_style_manager().xfId(textFormatProperties, &parFormatProperties, &cellFormatProperties, &cellFormat, L"", true);
|
||||
default_style_ = get_style_manager().xfId(&textFormatProperties, &parFormatProperties, &cellFormatProperties, &cellFormat, L"", true);
|
||||
|
||||
}
|
||||
|
||||
@ -665,12 +665,12 @@ int xlsx_conversion_context::get_current_cell_style_id()
|
||||
return get_table_context().get_current_cell_style_id();
|
||||
}
|
||||
|
||||
std::pair<double, double> xlsx_conversion_context::getMaxDigitSize()
|
||||
std::pair<float,float> xlsx_conversion_context::getMaxDigitSize()
|
||||
{
|
||||
if (maxDigitSize_.first <= 0.1)
|
||||
{
|
||||
std::wstring font_name;
|
||||
int font_size = 10;
|
||||
int font_size;
|
||||
|
||||
std::vector<const odf_reader::style_instance *> instances;
|
||||
|
||||
@ -687,32 +687,31 @@ std::pair<double, double> xlsx_conversion_context::getMaxDigitSize()
|
||||
if (inst) instances.push_back(inst);
|
||||
}
|
||||
|
||||
odf_reader::text_format_properties_content_ptr textFormatProperties = calc_text_properties_content(instances);
|
||||
odf_reader::text_format_properties_content textFormatProperties = calc_text_properties_content(instances);
|
||||
|
||||
if (textFormatProperties)
|
||||
if (textFormatProperties.fo_font_family_)
|
||||
font_name = textFormatProperties.fo_font_family_.get();
|
||||
else
|
||||
{
|
||||
if (textFormatProperties->fo_font_family_)
|
||||
font_name = textFormatProperties->fo_font_family_.get();
|
||||
else
|
||||
std::wstring style_font_name;
|
||||
if (textFormatProperties.style_font_name_) style_font_name = textFormatProperties.style_font_name_.get();
|
||||
else if (textFormatProperties.style_font_name_complex_) style_font_name = textFormatProperties.style_font_name_complex_.get();
|
||||
else if (textFormatProperties.style_font_name_asian_) style_font_name = textFormatProperties.style_font_name_asian_.get();
|
||||
|
||||
odf_reader::fonts_container & fonts = odf_document_->odf_context().fontContainer();
|
||||
odf_reader::font_instance * font = fonts.font_by_style_name(style_font_name);
|
||||
if (font)
|
||||
{
|
||||
std::wstring style_font_name;
|
||||
|
||||
if (textFormatProperties->style_font_name_) style_font_name = textFormatProperties->style_font_name_.get();
|
||||
else if (textFormatProperties->style_font_name_complex_) style_font_name = textFormatProperties->style_font_name_complex_.get();
|
||||
else if (textFormatProperties->style_font_name_asian_) style_font_name = textFormatProperties->style_font_name_asian_.get();
|
||||
|
||||
odf_reader::fonts_container & fonts = odf_document_->odf_context().fontContainer();
|
||||
odf_reader::font_instance * font = fonts.font_by_style_name(style_font_name);
|
||||
if (font)
|
||||
{
|
||||
font_name = font->name();
|
||||
}
|
||||
font_name = font->name();
|
||||
}
|
||||
if ((textFormatProperties->fo_font_size_) && (textFormatProperties->fo_font_size_->get_type() == odf_types::font_size::Length))
|
||||
font_size = (int)(0.5 + textFormatProperties->fo_font_size_->get_length().get_value_unit(odf_types::length::pt));
|
||||
}
|
||||
if (font_name.empty()) font_name = L"Arial";
|
||||
|
||||
|
||||
if ((textFormatProperties.fo_font_size_) && (textFormatProperties.fo_font_size_->get_type() == odf_types::font_size::Length))
|
||||
font_size = (int)(0.5 + textFormatProperties.fo_font_size_->get_length().get_value_unit(odf_types::length::pt));
|
||||
else
|
||||
font_size =10;
|
||||
|
||||
maxDigitSize_ = utils::GetMaxDigitSizePixels(font_name.c_str(), font_size, 96., 0, mediaitems_->applicationFonts());
|
||||
}
|
||||
return maxDigitSize_;
|
||||
|
||||
@ -163,7 +163,7 @@ public:
|
||||
return odf_document_;
|
||||
}
|
||||
|
||||
std::pair<double, double> getMaxDigitSize();
|
||||
std::pair<float,float> getMaxDigitSize();
|
||||
|
||||
void process_styles();
|
||||
|
||||
@ -207,7 +207,7 @@ private:
|
||||
std::vector<std::wstring> table_parts_;
|
||||
|
||||
std::wstringstream defaultOutput_;
|
||||
std::pair<double, double> maxDigitSize_;
|
||||
std::pair<float,float> maxDigitSize_;
|
||||
num_format_context num_format_context_;
|
||||
size_t default_style_;
|
||||
mediaitems_ptr mediaitems_;
|
||||
|
||||
@ -276,11 +276,11 @@ void calcext_condition::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
instStyle = Context.root()->odf_context().styleContainer().style_by_display_name(style_name, style_family::TableCell, false);
|
||||
if (instStyle)
|
||||
{
|
||||
text_format_properties_content_ptr textFormats = calc_text_properties_content (instStyle);
|
||||
text_format_properties_content textFormats = calc_text_properties_content (instStyle);
|
||||
graphic_format_properties graphicFormats = calc_graphic_properties_content (instStyle);
|
||||
style_table_cell_properties_attlist cellFormats = calc_table_cell_properties (instStyle);
|
||||
|
||||
int dxfId = Context.get_style_manager().dxfId(textFormats, &graphicFormats, &cellFormats);
|
||||
int dxfId = Context.get_style_manager().dxfId(&textFormats, &graphicFormats, &cellFormats);
|
||||
Context.set_conditional_format_dxf(dxfId);
|
||||
}
|
||||
Context.end_conditional_format_rule();
|
||||
|
||||
@ -39,21 +39,18 @@ namespace cpdoccore {
|
||||
|
||||
namespace odf_reader {
|
||||
|
||||
text_format_properties_content_ptr calc_text_properties_content(const std::vector<const style_text_properties*> & textProps)
|
||||
text_format_properties_content calc_text_properties_content(const std::vector<const style_text_properties*> & textProps)
|
||||
{
|
||||
if (textProps.empty()) return text_format_properties_content_ptr();
|
||||
|
||||
text_format_properties_content_ptr result = boost::make_shared<text_format_properties_content>();
|
||||
|
||||
for (size_t i = 0; i < textProps.size(); i++)
|
||||
text_format_properties_content result;
|
||||
for (size_t i = 0; i < textProps.size(); i++)
|
||||
{
|
||||
if (textProps[i])
|
||||
result->apply_from(textProps[i]->content());
|
||||
result.apply_from(textProps[i]->content());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
text_format_properties_content_ptr calc_text_properties_content(const style_instance * styleInstance)
|
||||
text_format_properties_content calc_text_properties_content(const style_instance * styleInstance)
|
||||
{
|
||||
std::vector<const style_text_properties*> textProps;
|
||||
|
||||
@ -70,19 +67,12 @@ text_format_properties_content_ptr calc_text_properties_content(const style_inst
|
||||
return calc_text_properties_content(textProps);
|
||||
}
|
||||
|
||||
text_format_properties_content_ptr calc_text_properties_content(const std::vector<const style_instance *> & styleInstances)
|
||||
text_format_properties_content calc_text_properties_content(const std::vector<const style_instance *> & styleInstances)
|
||||
{
|
||||
if (styleInstances.empty()) return text_format_properties_content_ptr();
|
||||
|
||||
text_format_properties_content_ptr result = boost::make_shared<text_format_properties_content>();
|
||||
|
||||
text_format_properties_content result;
|
||||
for (size_t i = 0; i < styleInstances.size(); i++)
|
||||
{
|
||||
text_format_properties_content_ptr props = calc_text_properties_content(styleInstances[i]);
|
||||
if (props)
|
||||
{
|
||||
result->apply_from(*props.get());
|
||||
}
|
||||
result.apply_from(calc_text_properties_content(styleInstances[i]));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -51,8 +51,8 @@ namespace cpdoccore
|
||||
graphic_format_properties calc_graphic_properties_content(const style_instance * styleInstance);
|
||||
graphic_format_properties calc_graphic_properties_content(const std::vector<const style_instance *> & styleInstances);
|
||||
|
||||
text_format_properties_content_ptr calc_text_properties_content(const style_instance * styleInstance);
|
||||
text_format_properties_content_ptr calc_text_properties_content(const std::vector<const style_instance *> & styleInstances);
|
||||
text_format_properties_content calc_text_properties_content(const style_instance * styleInstance);
|
||||
text_format_properties_content calc_text_properties_content(const std::vector<const style_instance *> & styleInstances);
|
||||
|
||||
paragraph_format_properties calc_paragraph_properties_content(const style_instance * styleInstance);
|
||||
paragraph_format_properties calc_paragraph_properties_content(const std::vector<const style_instance *> & styleInstances);
|
||||
|
||||
@ -80,11 +80,11 @@ using namespace chart;
|
||||
|
||||
void object_odf_context::set_pivot_source(std::wstring const & val)
|
||||
{
|
||||
bPivotChart_ = true;
|
||||
|
||||
if (val.empty()) return;
|
||||
|
||||
pivot_source_ = val;
|
||||
if (pivot_source_.empty() == false)
|
||||
{
|
||||
bPivotChart_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
void object_odf_context::set_width(double valPt)
|
||||
@ -303,33 +303,31 @@ void object_odf_context::calc_cache_series(std::wstring adress, std::vector<std:
|
||||
{
|
||||
int col = pFind->second.col;
|
||||
int row = pFind->second.row;
|
||||
|
||||
//if (col == 0 || row == 0)
|
||||
|
||||
if (col == 0 || row == 0)
|
||||
{
|
||||
for (size_t i = 0; i < cash_values.size(); i++)
|
||||
{
|
||||
//if (col == 0)
|
||||
//{
|
||||
if (cash_values[i].col == col && cash_values[i].row != 0)
|
||||
if (col == 0)
|
||||
{
|
||||
if (cash_values[i].col == col)
|
||||
{
|
||||
if (cash_values[i].val == L"NaN")
|
||||
cash_values[i].val.clear();
|
||||
cash.push_back(cash_values[i].val);
|
||||
}
|
||||
//}
|
||||
//if (row == 0)
|
||||
//{
|
||||
// if (cash_values[i].row == row)
|
||||
// {
|
||||
// cash.push_back(cash_values[i].val);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
if (row == 0)
|
||||
{
|
||||
if (cash_values[i].row == row)
|
||||
{
|
||||
cash.push_back(cash_values[i].val);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// cash.push_back(pFind->second.val);
|
||||
//}
|
||||
else
|
||||
{
|
||||
cash.push_back(pFind->second.val);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -368,7 +366,7 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
|
||||
{
|
||||
chart_context.set_pivot_chart (pivot_source_);
|
||||
|
||||
chart_context.set_title (title_, sub_title_);
|
||||
chart_context.set_title (title_);
|
||||
chart_context.set_wall (wall_);
|
||||
chart_context.set_floor (floor_);
|
||||
chart_context.set_legend (legend_);
|
||||
@ -399,10 +397,6 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
|
||||
|
||||
if (!current) continue;
|
||||
|
||||
current->set_stock_gain_marke(stock_gain_marker_);
|
||||
current->set_stock_loss_marker(stock_loss_marker_);
|
||||
current->set_stock_range_line(stock_range_line_);
|
||||
|
||||
if (1 == series_.size())
|
||||
{
|
||||
current->varyColors_ = false;
|
||||
@ -437,22 +431,15 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
|
||||
calc_cache_series (categories_[0], cat_cash);
|
||||
|
||||
std::wstring formatCode = L"General";
|
||||
_CP_OPT(std::wstring) strNumFormat, strPercentFormat;
|
||||
_CP_OPT(int) nTypeFormat;
|
||||
_CP_OPT(bool) bLinkData;
|
||||
_CP_OPT(std::wstring) strVal;
|
||||
_CP_OPT(bool) boolVal;
|
||||
|
||||
odf_reader::GetProperty(series_[i].properties_, L"num_format", strNumFormat);
|
||||
odf_reader::GetProperty(series_[i].properties_, L"percentage_num_format", strPercentFormat);
|
||||
odf_reader::GetProperty(series_[i].properties_, L"link-data-style-to-source", bLinkData);
|
||||
odf_reader::GetProperty(series_[i].properties_, L"data-label-number", nTypeFormat);
|
||||
odf_reader::GetProperty(series_[i].properties_, L"num_format", strVal);
|
||||
odf_reader::GetProperty(series_[i].properties_, L"link-data-style-to-source", boolVal);
|
||||
|
||||
if ((nTypeFormat) && (*nTypeFormat == 2) && strPercentFormat)
|
||||
if ((strVal) && (strVal->length() > 1))
|
||||
{
|
||||
formatCode = *strPercentFormat;
|
||||
}
|
||||
else if ((strNumFormat) && (strNumFormat->length() > 1))
|
||||
{
|
||||
formatCode = *strNumFormat;
|
||||
formatCode = *strVal;
|
||||
}
|
||||
|
||||
if (false == series_[i].label_cell_address_.empty())
|
||||
@ -466,11 +453,11 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
|
||||
if (last_set_type == chart_bubble)
|
||||
{ //bubble(x)
|
||||
if (!bPivotChart_)
|
||||
current->set_formula_series(4, domain_cell_range_adress_, formatCode, bLinkData.get_value_or(true));
|
||||
current->set_formula_series(4, domain_cell_range_adress_, formatCode, boolVal.get_value_or(true));
|
||||
current->set_values_series (4, domain_cash);
|
||||
//y
|
||||
if (!bPivotChart_)
|
||||
current->set_formula_series(3, series_[i].cell_range_address_, formatCode, bLinkData.get_value_or(true));
|
||||
current->set_formula_series(3, series_[i].cell_range_address_, formatCode, boolVal.get_value_or(true));
|
||||
current->set_values_series (3, cell_cash);
|
||||
}
|
||||
else
|
||||
@ -478,14 +465,14 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
|
||||
if (false == domain_cash.empty() || false == cash_values.empty())
|
||||
{
|
||||
if (!bPivotChart_)
|
||||
current->set_formula_series(2, domain_cell_range_adress_, formatCode, bLinkData.get_value_or(true));
|
||||
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() || false == cash_values.empty())
|
||||
{
|
||||
if (!bPivotChart_)
|
||||
current->set_formula_series(3, series_[i].cell_range_address_, formatCode, bLinkData.get_value_or(true));
|
||||
current->set_formula_series(3, series_[i].cell_range_address_, formatCode, boolVal.get_value_or(true));
|
||||
current->set_values_series (3, cell_cash);
|
||||
}
|
||||
}
|
||||
@ -493,7 +480,7 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
|
||||
else
|
||||
{ //common
|
||||
if (!bPivotChart_)
|
||||
current->set_formula_series(1, series_[i].cell_range_address_, formatCode, bLinkData.get_value_or(true));
|
||||
current->set_formula_series(1, series_[i].cell_range_address_, formatCode, boolVal.get_value_or(true));
|
||||
current->set_values_series(1, cell_cash);
|
||||
}
|
||||
|
||||
@ -513,10 +500,15 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
|
||||
bool x_enabled = false;
|
||||
bool y_enabled = false;
|
||||
bool z_enabled = false;
|
||||
bool is3D = false;
|
||||
|
||||
_CP_OPT(bool) bIs3D;
|
||||
odf_reader::GetProperty(plot_area_.properties_, L"three-dimensional", bIs3D);
|
||||
_CP_OPT(bool) boolVal;
|
||||
odf_reader::GetProperty(plot_area_.properties_, L"three-dimensional", boolVal);
|
||||
|
||||
if ((boolVal) && (*boolVal))
|
||||
{
|
||||
is3D = true;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < axises_.size(); i++)
|
||||
{
|
||||
@ -534,10 +526,7 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
|
||||
if (class_ == chart_stock && a.type_ == 3 )
|
||||
a.type_ = 4; //шкала дат.
|
||||
|
||||
if (bIs3D.get_value_or(false))
|
||||
{
|
||||
a.type_ = 1; // шкала категорий
|
||||
}
|
||||
if (is3D) a.type_ = 1; // шкала категорий
|
||||
|
||||
x_enabled = true;
|
||||
}
|
||||
@ -556,7 +545,7 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
|
||||
}
|
||||
else if (a.dimension_ == L"z")
|
||||
{
|
||||
bIs3D = true;
|
||||
is3D = true;
|
||||
continue;
|
||||
a.type_ = 2;
|
||||
z_enabled = true;
|
||||
@ -565,7 +554,7 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
|
||||
chart_context.add_axis(a.type_, a);
|
||||
}
|
||||
|
||||
if (bIs3D.get_value_or(false))
|
||||
if (is3D)
|
||||
{
|
||||
if (!z_enabled)
|
||||
{
|
||||
@ -610,9 +599,8 @@ void process_build_object::ApplyChartProperties(std::wstring style, std::vector<
|
||||
const style_chart_properties *properties = Content->get_style_chart_properties();
|
||||
|
||||
std::wstring data_style_name = styleInst->data_style_name();
|
||||
std::wstring percentage_data_style_name = styleInst->percentage_data_style_name();
|
||||
|
||||
if (false == data_style_name.empty())
|
||||
|
||||
if (!data_style_name.empty())
|
||||
{
|
||||
office_element_ptr elm = number_styles_.find_by_style_name(data_style_name);
|
||||
number_style_base *number_style = dynamic_cast<number_style_base*>(elm.get());
|
||||
@ -629,23 +617,7 @@ void process_build_object::ApplyChartProperties(std::wstring style, std::vector<
|
||||
propertiesOut.push_back(p);
|
||||
}
|
||||
}
|
||||
if (false == percentage_data_style_name.empty())
|
||||
{
|
||||
office_element_ptr elm = number_styles_.find_by_style_name(percentage_data_style_name);
|
||||
number_style_base *number_style = dynamic_cast<number_style_base*>(elm.get());
|
||||
|
||||
if (number_style)
|
||||
{
|
||||
num_format_context_.start_complex_format();
|
||||
number_style->oox_convert(num_format_context_);
|
||||
num_format_context_.end_complex_format();
|
||||
|
||||
std::wstring num_format = num_format_context_.get_last_format();
|
||||
|
||||
_property p(L"percentage_num_format", num_format);
|
||||
propertiesOut.push_back(p);
|
||||
}
|
||||
}
|
||||
if (!properties)return;
|
||||
|
||||
for (size_t i = 0; i < properties->content_.size(); i++)
|
||||
@ -654,12 +626,13 @@ void process_build_object::ApplyChartProperties(std::wstring style, std::vector<
|
||||
}
|
||||
}
|
||||
}
|
||||
void process_build_object::ApplyTextProperties(std::wstring style, text_format_properties_content_ptr &propertiesOut)
|
||||
void process_build_object::ApplyTextProperties(std::wstring style, std::vector<_property> & propertiesOut)
|
||||
{
|
||||
style_instance* styleInst = styles_.style_by_name(style, odf_types::style_family::Chart, false/*Context.process_headers_footers_*/);
|
||||
if(styleInst)
|
||||
{
|
||||
propertiesOut = calc_text_properties_content(styleInst);
|
||||
text_format_properties_content properties = calc_text_properties_content(styleInst);
|
||||
properties.apply_to(propertiesOut);
|
||||
}
|
||||
}
|
||||
void process_build_object::ApplyGraphicProperties(std::wstring style, std::vector<_property> & propertiesOut, oox::_oox_fill & fill)
|
||||
@ -669,7 +642,7 @@ void process_build_object::ApplyGraphicProperties(std::wstring style, std::vecto
|
||||
{
|
||||
graphic_format_properties properties = calc_graphic_properties_content(styleInst);
|
||||
|
||||
Compute_GraphicFill(properties.common_draw_fill_attlist_, properties.style_background_image_ , draw_styles_ , fill, false, false);
|
||||
Compute_GraphicFill(properties.common_draw_fill_attlist_, properties.style_background_image_ , draw_styles_ , fill);
|
||||
|
||||
if (fill.bitmap)
|
||||
{
|
||||
@ -780,7 +753,6 @@ void process_build_object::visit(chart_title& val)
|
||||
t.content_ = v.str();
|
||||
}
|
||||
ApplyTextProperties(val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""), t.text_properties_);
|
||||
ApplyGraphicProperties(val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""), t.graphic_properties_, t.fill_);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
if (val.attlist_.common_draw_position_attlist_.svg_x_)
|
||||
@ -807,9 +779,6 @@ void process_build_object::visit(chart_subtitle & val)
|
||||
val.text_p_->text_to_stream(v, false);
|
||||
t.content_ = v.str();
|
||||
|
||||
ApplyTextProperties(val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""), t.text_properties_);
|
||||
ApplyGraphicProperties(val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""), t.graphic_properties_, t.fill_);
|
||||
|
||||
if (val.attlist_.common_draw_position_attlist_.svg_x_)
|
||||
{
|
||||
t.pos_x = val.attlist_.common_draw_position_attlist_.svg_x_->get_value_unit(length::pt);
|
||||
@ -876,6 +845,7 @@ void process_build_object::visit(chart_plot_area& val)
|
||||
ApplyTextProperties (val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.plot_area_.text_properties_);
|
||||
}
|
||||
|
||||
|
||||
void process_build_object::visit(chart_axis& val)
|
||||
{
|
||||
object_odf_context_.start_axis(val.attlist_.chart_dimension_.get_value_or(L""),
|
||||
@ -967,34 +937,13 @@ void process_build_object::visit(chart_data_point & val)
|
||||
}
|
||||
void process_build_object::visit(chart_mean_value & val)
|
||||
{
|
||||
object_odf_context_.series_.back().mean_value_.bEnabled = true;
|
||||
ApplyChartProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.series_.back().mean_value_.properties_);
|
||||
ApplyGraphicProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.series_.back().mean_value_.graphic_properties_, object_odf_context_.series_.back().mean_value_.fill_);
|
||||
}
|
||||
void process_build_object::visit(chart_date_scale & val)
|
||||
{
|
||||
object_odf_context_.axises_.back().type_ = 4;
|
||||
}
|
||||
void process_build_object::visit(chart_error_indicator & val)
|
||||
{
|
||||
object_odf_context_.series_.back().error_indicator_.bEnabled = true;
|
||||
ApplyGraphicProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.series_.back().error_indicator_.graphic_properties_, object_odf_context_.series_.back().error_indicator_.fill_ );
|
||||
}
|
||||
void process_build_object::visit(chart_stock_range_line & val)
|
||||
{
|
||||
object_odf_context_.stock_range_line_.bEnabled = true;
|
||||
ApplyGraphicProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.stock_range_line_.graphic_properties_, object_odf_context_.stock_range_line_.fill_ );
|
||||
}
|
||||
void process_build_object::visit(chart_stock_loss_marker & val)
|
||||
{
|
||||
object_odf_context_.stock_loss_marker_.bEnabled = true;
|
||||
ApplyGraphicProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.stock_loss_marker_.graphic_properties_, object_odf_context_.stock_loss_marker_.fill_ );
|
||||
}
|
||||
void process_build_object::visit(chart_stock_gain_marker & val)
|
||||
{
|
||||
object_odf_context_.stock_gain_marker_.bEnabled = true;
|
||||
ApplyGraphicProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.stock_gain_marker_.graphic_properties_, object_odf_context_.stock_gain_marker_.fill_ );
|
||||
}
|
||||
ApplyGraphicProperties (val.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.series_.back().error_indicator_.graphic_properties_,object_odf_context_.series_.back().error_indicator_.fill_ );
|
||||
}
|
||||
void process_build_object::visit(chart_regression_curve & val)
|
||||
{
|
||||
oox::_oox_fill fill;
|
||||
@ -1023,8 +972,7 @@ void process_build_object::visit(chart_categories& val)
|
||||
{
|
||||
if (object_odf_context_.in_axis_)
|
||||
{
|
||||
if (object_odf_context_.axises_.back().type_ != 4)
|
||||
object_odf_context_.axises_.back().type_ = 1;
|
||||
object_odf_context_.axises_.back().type_ = 1;
|
||||
object_odf_context_.axises_.back().bCategories_ = true;
|
||||
}
|
||||
|
||||
|
||||
@ -45,6 +45,8 @@
|
||||
|
||||
#include "visitor.h"
|
||||
|
||||
#include "chart_objects.h"
|
||||
|
||||
#include "office_document.h"
|
||||
#include "office_body.h"
|
||||
#include "office_chart.h"
|
||||
@ -54,9 +56,8 @@
|
||||
#include "table.h"
|
||||
#include "odfcontext.h"
|
||||
|
||||
#include "chart_objects.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
|
||||
namespace odf_reader {
|
||||
|
||||
namespace {
|
||||
@ -186,6 +187,7 @@ public:
|
||||
std::wstring domain_cell_range_adress2_;
|
||||
|
||||
chart::title title_;
|
||||
office_element_ptr_array title_odf_context_;
|
||||
|
||||
chart::title sub_title_;
|
||||
chart::legend legend_;
|
||||
@ -196,10 +198,6 @@ public:
|
||||
|
||||
chart::simple footer_;
|
||||
|
||||
chart::simple stock_gain_marker_;
|
||||
chart::simple stock_loss_marker_;
|
||||
chart::simple stock_range_line_;
|
||||
|
||||
std::vector<_property> chart_properties_;
|
||||
std::vector<_property> chart_graphic_properties_;
|
||||
oox::_oox_fill chart_fill_;
|
||||
@ -251,7 +249,6 @@ class process_build_object
|
||||
|
||||
public visitor<chart_axis>,
|
||||
public visitor<chart_categories>,
|
||||
public visitor<chart_date_scale>,
|
||||
public visitor<chart_grid>,
|
||||
|
||||
public visitor<chart_series>,
|
||||
@ -261,9 +258,6 @@ class process_build_object
|
||||
public visitor<chart_regression_curve>,
|
||||
public visitor<chart_equation>,
|
||||
public visitor<chart_error_indicator>,
|
||||
public visitor<chart_stock_range_line>,
|
||||
public visitor<chart_stock_loss_marker>,
|
||||
public visitor<chart_stock_gain_marker>,
|
||||
public visitor<chart_wall>,
|
||||
public visitor<chart_floor>,
|
||||
|
||||
@ -290,10 +284,9 @@ public:
|
||||
|
||||
private:
|
||||
void ApplyChartProperties(std::wstring style, std::vector<_property> & propertiesOut);
|
||||
void ApplyTextProperties(std::wstring style, std::vector<_property> & propertiesOut);
|
||||
void ApplyGraphicProperties(std::wstring style, std::vector<_property> & propertiesOut, oox::_oox_fill & fill);
|
||||
|
||||
void ApplyTextProperties(std::wstring style, text_format_properties_content_ptr & propertiesOut);
|
||||
|
||||
bool visit_table(std::wstring const & name);
|
||||
void visit_column(unsigned int repeated);
|
||||
bool visit_rows(unsigned int repeated);
|
||||
@ -316,7 +309,7 @@ public:
|
||||
virtual void visit(chart_subtitle & val);
|
||||
virtual void visit(chart_footer & val);
|
||||
virtual void visit(chart_legend & val);
|
||||
virtual void visit(chart_plot_area & val);
|
||||
virtual void visit(chart_plot_area& val);
|
||||
virtual void visit(chart_axis & val);
|
||||
virtual void visit(chart_series & val);
|
||||
virtual void visit(chart_domain & val);
|
||||
@ -324,16 +317,11 @@ public:
|
||||
virtual void visit(chart_mean_value & val);
|
||||
virtual void visit(chart_error_indicator & val);
|
||||
virtual void visit(chart_regression_curve & val);
|
||||
virtual void visit(chart_stock_range_line & val);
|
||||
virtual void visit(chart_stock_loss_marker & val);
|
||||
virtual void visit(chart_stock_gain_marker & val);
|
||||
virtual void visit(chart_equation & val);
|
||||
virtual void visit(chart_categories & val);
|
||||
virtual void visit(chart_grid & val);
|
||||
virtual void visit(chart_wall & val);
|
||||
virtual void visit(chart_floor & val);
|
||||
virtual void visit(chart_date_scale & val);
|
||||
|
||||
virtual void visit(table_table & val);
|
||||
|
||||
virtual void visit(table_table_rows & val);
|
||||
|
||||
@ -31,18 +31,18 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../docx/oox_drawing_fills.h"
|
||||
#include <xml/attributes.h>
|
||||
#include "../docx/oox_drawing_fills.h"
|
||||
//описание всяких графических объектов ( вложенная мелочевка) которые используются в xlsx & odf_reader -
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace odf_reader {
|
||||
|
||||
class text_format_properties_content;
|
||||
typedef boost::shared_ptr<text_format_properties_content> text_format_properties_content_ptr;
|
||||
class text_format_properties_content;
|
||||
|
||||
namespace chart {
|
||||
|
||||
enum oox_typeconvert {docx, xlsx, pptx};
|
||||
enum oox_typeconvert {docx,xlsx,pptx};
|
||||
|
||||
enum class_type
|
||||
{
|
||||
@ -61,29 +61,37 @@ namespace chart {
|
||||
chart_filled_radar
|
||||
};
|
||||
|
||||
struct title
|
||||
{
|
||||
title() : bEnabled(false), pos_x(0), pos_y(0) {}
|
||||
bool bEnabled;
|
||||
|
||||
std::wstring content_;
|
||||
std::vector<_property> text_properties_;
|
||||
|
||||
double pos_x;
|
||||
double pos_y;
|
||||
|
||||
} ;
|
||||
struct simple
|
||||
{
|
||||
bool bEnabled = false;
|
||||
std::vector<_property> properties_;
|
||||
|
||||
text_format_properties_content_ptr text_properties_;
|
||||
std::vector<_property> graphic_properties_;
|
||||
oox::_oox_fill fill_;
|
||||
};
|
||||
struct title : public simple
|
||||
{
|
||||
std::wstring content_;
|
||||
simple() : bEnabled(false) {}
|
||||
|
||||
double pos_x = 0;
|
||||
double pos_y = 0;
|
||||
};
|
||||
|
||||
bool bEnabled;
|
||||
std::vector<_property> properties_;
|
||||
std::vector<_property> text_properties_;
|
||||
std::vector<_property> graphic_properties_;
|
||||
oox::_oox_fill fill_;
|
||||
};
|
||||
struct treadline
|
||||
{
|
||||
bool bEquation = false;
|
||||
bool bREquation = false;
|
||||
bool bEquation;
|
||||
bool bREquation;
|
||||
std::vector<_property> line_properties_;
|
||||
simple equation_properties_;
|
||||
|
||||
treadline(){bEquation = false; bREquation = false;}
|
||||
|
||||
};
|
||||
struct legend : public simple
|
||||
{
|
||||
@ -99,16 +107,17 @@ namespace chart {
|
||||
};
|
||||
struct axis: public simple
|
||||
{
|
||||
axis() : bCategories_(false), type_(3) {}
|
||||
struct grid
|
||||
{
|
||||
enum grid_type {major, minor};
|
||||
|
||||
grid_type type_ = major;
|
||||
grid_type type_;
|
||||
std::wstring style_name_;
|
||||
|
||||
std::vector<_property> graphic_properties_;
|
||||
};
|
||||
bool bCategories_ = false;
|
||||
bool bCategories_;
|
||||
|
||||
title title_;
|
||||
|
||||
@ -116,7 +125,7 @@ namespace chart {
|
||||
std::wstring chart_name_;
|
||||
std::wstring style_name_;
|
||||
std::vector<grid> grids_;
|
||||
int type_ = 3;
|
||||
int type_;
|
||||
};
|
||||
struct series : public simple
|
||||
{
|
||||
|
||||
@ -78,6 +78,7 @@ anchor_type anchor_type::parse(const std::wstring & Str)
|
||||
return anchor_type( AsChar );
|
||||
else
|
||||
{
|
||||
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
|
||||
return anchor_type( Page );
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,6 +64,7 @@ border_model border_model::parse(const std::wstring & Str)
|
||||
return border_model( Separating );
|
||||
else
|
||||
{
|
||||
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
|
||||
return border_model( Collapsing );
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,6 +69,7 @@ chart_error_category chart_error_category::parse(const std::wstring & Str)
|
||||
return chart_error_category( constant );
|
||||
else
|
||||
{
|
||||
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
|
||||
return chart_error_category( none );
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user