mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-15 04:15:53 +08:00
Compare commits
144 Commits
core-linux
...
core-linux
| Author | SHA1 | Date | |
|---|---|---|---|
| 3953fd1add | |||
| d0661e871d | |||
| ec173776ea | |||
| 0a3b9fb8e9 | |||
| 097559c25e | |||
| 6a571ba1c9 | |||
| c4a46114a2 | |||
| 724335bdda | |||
| 7e85df3cc5 | |||
| 326cfbde93 | |||
| 5df8901b59 | |||
| 9c24fa2ff1 | |||
| 82dca18ebc | |||
| 86d97d050d | |||
| a6ab10d585 | |||
| 2b8efdd9b1 | |||
| 1022754391 | |||
| 2c10457a63 | |||
| e0630979c5 | |||
| 8bc8b7cf58 | |||
| 14f4364962 | |||
| 9de3cb016f | |||
| f12cd8ff8f | |||
| 436015b5d2 | |||
| c078df93c9 | |||
| e5e8e01490 | |||
| 4fcc3b4f41 | |||
| ce44e50d0e | |||
| 143590f17b | |||
| abb7a85337 | |||
| f0fe00aa3e | |||
| 98a568177d | |||
| e58f1929e1 | |||
| 2143869e69 | |||
| ac6a1a19da | |||
| fb574f1994 | |||
| f9af786d5a | |||
| 3cde3a4444 | |||
| eb2221f006 | |||
| 394d1e7b38 | |||
| d9d1473fd0 | |||
| 45ba99b9bf | |||
| 9576ce5f28 | |||
| 7092922d1b | |||
| e112c63f12 | |||
| ae9ec197f1 | |||
| af7640e736 | |||
| f467912988 | |||
| 292781e6fb | |||
| 9cd97d48b8 | |||
| 579b441edc | |||
| 63b71d256b | |||
| 90f1aa055c | |||
| d75352f1f2 | |||
| 51cbcfa9f2 | |||
| eef66b3498 | |||
| 945d43997a | |||
| b41170a233 | |||
| b64541e6bd | |||
| 5626963bdf | |||
| 5b7d637c78 | |||
| 643f117a92 | |||
| f6d38c1f1b | |||
| dd24ca837f | |||
| f555e3f821 | |||
| 503e87077b | |||
| 07a07a1abd | |||
| 30473ee9b7 | |||
| 73ef4140a2 | |||
| 8b6e5f17c8 | |||
| fcede43d99 | |||
| c37f011d6d | |||
| 52ec27a679 | |||
| a687e49a6a | |||
| 4d0e44c8b6 | |||
| 4dddc6d9bc | |||
| b6b79576a1 | |||
| 1c1223b148 | |||
| 9947f058a9 | |||
| 54f55ad2ac | |||
| e4edb9cca4 | |||
| 8bb23e9ce1 | |||
| aacea2f015 | |||
| 1475b2fef9 | |||
| 8e58975095 | |||
| 04550f06ad | |||
| d2b6444730 | |||
| 08738092c6 | |||
| 8e220427eb | |||
| 962c31dc2a | |||
| d12cc81745 | |||
| 988423f6e0 | |||
| 2b096f0977 | |||
| 7c0962f834 | |||
| 17423cdcdb | |||
| 5dc512dc3b | |||
| 1393073694 | |||
| 7da761a009 | |||
| e21e0afb45 | |||
| 626eb87203 | |||
| 5b0dad3d99 | |||
| 9d3b7b91af | |||
| f40d82a097 | |||
| 9112c87b1f | |||
| 01691950b9 | |||
| 78bbaecefe | |||
| 9e085c5ae8 | |||
| f55cafa2af | |||
| 17bc27199c | |||
| ee4167ec8c | |||
| e436c13fcc | |||
| 8e2c980152 | |||
| 658bfbc348 | |||
| ff9ef8f941 | |||
| 0a2401471e | |||
| 5ca5597c58 | |||
| e55dc5ea75 | |||
| e2db849b03 | |||
| fef30772fd | |||
| 23ba8a23a4 | |||
| 866af012eb | |||
| 4df09fd25a | |||
| 8bae2e3255 | |||
| 6180fedb0b | |||
| 35113a76ca | |||
| 5895bc9641 | |||
| a5a6686501 | |||
| f776bb6c4e | |||
| 4c930e716b | |||
| 595ecae254 | |||
| 8d3e50f8c0 | |||
| 2439106397 | |||
| 8953b74579 | |||
| bd7978e474 | |||
| 95238af0f5 | |||
| e83daf6c91 | |||
| a4cade5a58 | |||
| 4fb284ebee | |||
| 900ed115c7 | |||
| cc31becec1 | |||
| 9b5f052c97 | |||
| 2017a8c692 | |||
| 558c669fb6 | |||
| 6268e8c3f3 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -47,6 +47,8 @@ ASCOfficeXlsFile2/win32/_ASCOfficeXlsFile2_p.c
|
||||
ASCOfficeXlsFile2/win32/dlldata.c
|
||||
OfficeUtils/win32/OfficeUtilsLib/OfficeUtilsLib/ReadMe.txt
|
||||
X2tConverter/**/Makefile.*
|
||||
X2tConverter/ASCOfficePPTXFile/PPTXLib/Linux/PPTXFormatLib/Makefile
|
||||
X2tConverter/Common/DocxFormat/DocxFormatLib/Makefile
|
||||
*.7z
|
||||
*.obj
|
||||
*.pdb
|
||||
|
||||
@ -992,6 +992,11 @@ namespace DocFileFormat
|
||||
_writeAfterRun = oVmlMapper.m_equationXml;
|
||||
bFormula = true;
|
||||
}
|
||||
else if (oVmlMapper.m_isBlob)
|
||||
{
|
||||
_writeAfterRun = oVmlMapper.m_blobXml;
|
||||
bFormula = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1071,7 +1076,9 @@ namespace DocFileFormat
|
||||
int cpPic = searchNextTextMark(m_document->Text, cpFieldStart, TextMark::Picture);
|
||||
int cpFieldEnd = searchNextTextMark( m_document->Text, cpFieldStart, TextMark::FieldEndMark );
|
||||
|
||||
if (cpFieldStart < cpPic && cpPic < cpFieldEnd)
|
||||
bool bStartField = _fieldLevels.empty() ? false : (_fieldLevels.back().bBegin && !_fieldLevels.back().bSeparate);
|
||||
|
||||
if (cpFieldStart < cpPic && cpPic < cpFieldEnd && !bStartField)
|
||||
{
|
||||
writeField(text, cpFieldStart, cpFieldEnd);
|
||||
text.clear();
|
||||
|
||||
@ -31,6 +31,7 @@
|
||||
*/
|
||||
|
||||
#include "MainDocumentMapping.h"
|
||||
#include "OfficeDrawing/FillStyleBooleanProperties.h"
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
@ -83,16 +84,27 @@ namespace DocFileFormat
|
||||
|
||||
if ((m_document->GetOfficeArt()) && (m_document->GetOfficeArt()->GetShapeBackgound()))
|
||||
{
|
||||
bool bFilled = true;
|
||||
m_document->DocProperties->bDisplayBackgroundShape = true;
|
||||
ShapeContainer* pShape = m_document->GetOfficeArt()->GetShapeBackgound();
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin ( L"w:background", TRUE);
|
||||
m_pXmlWriter->WriteAttribute ( L"w:color", L"FFFFFF");
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
VMLShapeMapping oVmlWriter (m_context, m_pXmlWriter, NULL, NULL, _caller);
|
||||
pShape->Convert(&oVmlWriter);
|
||||
m_pXmlWriter->WriteNodeEnd (L"w:background");
|
||||
OptionEntryPtr boolFill = pShape->ExtractOption(fillStyleBooleanProperties);
|
||||
|
||||
FillStyleBooleanProperties booleans(boolFill ? boolFill->op : 0);
|
||||
if (booleans.fUsefFilled && !booleans.fFilled)
|
||||
{
|
||||
bFilled = false;
|
||||
}
|
||||
if (bFilled)
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin ( L"w:background", TRUE);
|
||||
m_pXmlWriter->WriteAttribute ( L"w:color", L"FFFFFF");
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
VMLShapeMapping oVmlWriter (m_context, m_pXmlWriter, NULL, NULL, _caller);
|
||||
pShape->Convert(&oVmlWriter);
|
||||
m_pXmlWriter->WriteNodeEnd (L"w:background");
|
||||
}
|
||||
}
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:body", FALSE );
|
||||
|
||||
@ -101,6 +101,24 @@ namespace DocFileFormat
|
||||
return new ShapeContainer( _reader, bodySize, typeCode, version, instance );
|
||||
}
|
||||
|
||||
OptionEntryPtr ExtractOption(const PropertyId & prop) const
|
||||
{
|
||||
OptionEntryPtr ret;
|
||||
for ( size_t i = 0; i < this->Children.size(); ++i )
|
||||
{
|
||||
ShapeOptions* opt = dynamic_cast<ShapeOptions*>( this->Children[i] );
|
||||
|
||||
if ( opt == NULL ) continue;
|
||||
|
||||
std::map<PropertyId, OptionEntryPtr>::iterator pFind = opt->OptionsByID.find(prop);
|
||||
if (pFind != opt->OptionsByID.end())
|
||||
{
|
||||
ret = pFind->second;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::vector<OptionEntryPtr> ExtractOptions() const
|
||||
{
|
||||
std::vector<OptionEntryPtr> ret;
|
||||
|
||||
@ -32,9 +32,38 @@
|
||||
|
||||
|
||||
#include "SettingsMapping.h"
|
||||
#include "../../OfficeCryptReader/source/CryptTransform.h"
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
std::string DecodeBase64(const std::string & value)
|
||||
{
|
||||
int nLength = 0;
|
||||
unsigned char *pData = NULL;
|
||||
std::string result;
|
||||
|
||||
NSFile::CBase64Converter::Decode(value.c_str(), value.length(), pData, nLength);
|
||||
if (pData)
|
||||
{
|
||||
result = std::string((char*)pData, nLength);
|
||||
delete []pData; pData = NULL;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
std::wstring EncodeBase64(const std::string & value)
|
||||
{
|
||||
int nLength = 0;
|
||||
char *pData = NULL;
|
||||
std::string result;
|
||||
|
||||
NSFile::CBase64Converter::Encode((BYTE*)value.c_str(), value.length(), pData, nLength, NSBase64::B64_BASE64_FLAG_NOCRLF);
|
||||
if (pData)
|
||||
{
|
||||
result = std::string(pData, nLength);
|
||||
delete []pData; pData = NULL;
|
||||
}
|
||||
return std::wstring(result.begin(), result.end());
|
||||
}
|
||||
SettingsMapping::SettingsMapping (ConversionContext* ctx): PropertiesMapping(&m_oXmlWriter)
|
||||
{
|
||||
_ctx = ctx;
|
||||
@ -49,11 +78,39 @@ namespace DocFileFormat
|
||||
//start w:settings
|
||||
m_oXmlWriter.WriteNodeBegin( L"?xml version=\"1.0\" encoding=\"UTF-8\"?" );
|
||||
m_oXmlWriter.WriteNodeBegin( L"w:settings", TRUE );
|
||||
|
||||
//write namespaces
|
||||
m_oXmlWriter.WriteAttribute( L"xmlns:w", OpenXmlNamespaces::WordprocessingML );
|
||||
m_oXmlWriter.WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
if (_ctx->_doc->FIB->m_FibBase.fWriteReservation)
|
||||
{
|
||||
m_oXmlWriter.WriteNodeBegin( L"w:writeProtection", TRUE );
|
||||
WideString* passw = static_cast<WideString*>(_ctx->_doc->AssocNames->operator[]( 17 ));
|
||||
if (passw && false == passw->empty())
|
||||
{
|
||||
CRYPT::_ecmaWriteProtectData data;
|
||||
|
||||
CRYPT::ECMAWriteProtect protect;
|
||||
protect.SetCryptData(data);
|
||||
protect.SetPassword(*passw);
|
||||
|
||||
protect.Generate();
|
||||
protect.GetCryptData(data);
|
||||
|
||||
//m_oXmlWriter.WriteAttribute ( L"w:cryptProviderType", L"rsaAES");
|
||||
//m_oXmlWriter.WriteAttribute ( L"w:cryptAlgorithmSid", 14); //sha-512
|
||||
//m_oXmlWriter.WriteAttribute ( L"w:cryptAlgorithmType", L"typeAny");
|
||||
//m_oXmlWriter.WriteAttribute ( L"w:cryptAlgorithmClass", L"hash");
|
||||
//m_oXmlWriter.WriteAttribute ( L"w:cryptSpinCount", data.spinCount);
|
||||
//m_oXmlWriter.WriteAttribute ( L"w:hash", EncodeBase64(data.hashValue));
|
||||
//m_oXmlWriter.WriteAttribute ( L"w:salt", EncodeBase64(data.saltValue));
|
||||
m_oXmlWriter.WriteAttribute ( L"w:algorithmName", L"SHA-512");
|
||||
m_oXmlWriter.WriteAttribute ( L"w:spinCount", data.spinCount);
|
||||
m_oXmlWriter.WriteAttribute ( L"w:hashValue", EncodeBase64(data.hashValue));
|
||||
m_oXmlWriter.WriteAttribute ( L"w:saltValue", EncodeBase64(data.saltValue));
|
||||
}
|
||||
m_oXmlWriter.WriteNodeEnd( L"", TRUE, TRUE );
|
||||
}
|
||||
//zoom
|
||||
m_oXmlWriter.WriteNodeBegin ( L"w:zoom", TRUE );
|
||||
m_oXmlWriter.WriteAttribute ( L"w:percent", FormatUtils::IntToWideString( dop->wScaleSaved > 0 ? dop->wScaleSaved : 100 ) );
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
#include "OfficeDrawing/GroupShapeBooleanProperties.h"
|
||||
#include "OfficeDrawing/MetafilePictBlip.h"
|
||||
|
||||
#include "../../DesktopEditor/common/String.h"
|
||||
#include "../../DesktopEditor/common/StringExt.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Document.h"
|
||||
|
||||
#include "../../DesktopEditor/common/File.h"
|
||||
@ -138,6 +138,51 @@ namespace DocFileFormat
|
||||
}
|
||||
return btWin32;
|
||||
}
|
||||
bool VMLPictureMapping::ParseEmbeddedBlob( const std::string & xmlString, std::wstring & newXmlString)
|
||||
{
|
||||
newXmlString.clear();
|
||||
|
||||
std::wstring sTempFolder = m_context->_doc->m_sTempFolder;
|
||||
if (sTempFolder.empty())
|
||||
{
|
||||
sTempFolder = NSFile::CFileBinary::GetTempPath();
|
||||
}
|
||||
|
||||
std::wstring sTempXmlFile = NSDirectory::CreateTempFileWithUniqueName(sTempFolder, L"emb");
|
||||
|
||||
NSFile::CFileBinary file;
|
||||
file.CreateFileW(sTempXmlFile);
|
||||
file.WriteFile((BYTE*)xmlString.c_str(), xmlString.size());
|
||||
file.CloseFile();
|
||||
|
||||
COfficeUtils officeUtils(NULL);
|
||||
|
||||
BYTE *utf8Data = NULL;
|
||||
ULONG utf8DataSize = 0;
|
||||
if (S_OK != officeUtils.LoadFileFromArchive(sTempXmlFile, L"drs/shapexml.xml", &utf8Data, utf8DataSize))
|
||||
{
|
||||
if (S_OK == officeUtils.IsFileExistInArchive(sTempXmlFile, L"drs/diagrams"))
|
||||
{
|
||||
officeUtils.LoadFileFromArchive(sTempXmlFile, L"drs/diagrams/drawing1.xml", &utf8Data, utf8DataSize);
|
||||
}
|
||||
else if (S_OK != officeUtils.LoadFileFromArchive(sTempXmlFile, L"drs/e2oDoc.xml", &utf8Data, utf8DataSize))
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (utf8Data && utf8DataSize > 0)
|
||||
{
|
||||
newXmlString = NSFile::CUtf8Converter::GetUnicodeStringFromUTF8(utf8Data, utf8DataSize);
|
||||
|
||||
delete []utf8Data;
|
||||
}
|
||||
NSFile::CFileBinary::Remove(sTempXmlFile);
|
||||
|
||||
if (newXmlString.empty()) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
bool VMLPictureMapping::ParseEmbeddedEquation( const std::string & xmlString, std::wstring & newXmlString)
|
||||
{
|
||||
newXmlString.clear();
|
||||
@ -221,6 +266,7 @@ namespace DocFileFormat
|
||||
m_isBullete = false;
|
||||
m_isEquation = false;
|
||||
m_isEmbedded = false;
|
||||
m_isBlob = false;
|
||||
|
||||
m_imageData = new XMLTools::XMLElement( L"v:imagedata" );
|
||||
}
|
||||
@ -314,7 +360,9 @@ namespace DocFileFormat
|
||||
case metroBlob:
|
||||
{
|
||||
//встроенная неведомая хуйня
|
||||
m_isBlob = true;
|
||||
m_isEmbedded = true;
|
||||
|
||||
m_embeddedData = std::string((char*)iter->opComplex.get(), iter->op);
|
||||
|
||||
//if (ParseEmbeddedBlob( m_embeddedData, m_blobXml)) // todoooo
|
||||
|
||||
@ -58,6 +58,7 @@ namespace DocFileFormat
|
||||
void writePictureBorder (const std::wstring & name, const BorderCode* brc);
|
||||
void appendStyleProperty( std::wstring* b, const std::wstring& propName, const std::wstring& propValue ) const;
|
||||
bool ParseEmbeddedEquation( const std::string & xmlString, std::wstring & newXmlString );
|
||||
bool ParseEmbeddedBlob(const std::string & xmlString, std::wstring & newXmlString);
|
||||
std::wstring GetShapeID(const Shape* pShape) const;
|
||||
protected:
|
||||
/// Copies the picture from the binary stream to the zip archive
|
||||
@ -69,11 +70,13 @@ namespace DocFileFormat
|
||||
static std::wstring GetTargetExt (Global::BlipType nType);
|
||||
static std::wstring GetContentType (Global::BlipType nType);
|
||||
|
||||
bool m_isBlob;
|
||||
bool m_isBullete;
|
||||
bool m_isEquation;
|
||||
bool m_isEmbedded;
|
||||
std::string m_embeddedData;
|
||||
std::wstring m_equationXml;
|
||||
std::wstring m_blobXml;
|
||||
|
||||
std::wstring m_shapeId;
|
||||
private:
|
||||
|
||||
@ -55,7 +55,7 @@
|
||||
|
||||
#include "DrawingPrimitives.h"
|
||||
|
||||
#include "../../DesktopEditor/common/String.h"
|
||||
#include "../../DesktopEditor/common/StringExt.h"
|
||||
|
||||
#include "../Common/FormatUtils.h"
|
||||
|
||||
|
||||
@ -88,6 +88,7 @@ namespace DocFileFormat
|
||||
friend class VMLPictureMapping;
|
||||
friend class OpenXmlPackage;
|
||||
friend class TextboxMapping;
|
||||
friend class SettingsMapping;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@ -145,7 +145,8 @@ extern int g_nCurFormatVersion;
|
||||
Endnotes = 11,
|
||||
Background = 12,
|
||||
VbaProject = 13,
|
||||
App = 14
|
||||
App = 15,
|
||||
Core = 16
|
||||
};}
|
||||
namespace c_oSerSigTypes{enum c_oSerSigTypes
|
||||
{
|
||||
|
||||
@ -36,6 +36,8 @@
|
||||
#include "../DocWrapper/FontProcessor.h"
|
||||
#include "../../Common/Base64.h"
|
||||
#include "../../ASCOfficePPTXFile/Editor/FontCutter.h"
|
||||
#include "../../ASCOfficePPTXFile/PPTXFormat/App.h"
|
||||
#include "../../ASCOfficePPTXFile/PPTXFormat/Core.h"
|
||||
#include "../../XlsxSerializerCom/Reader/BinaryWriter.h"
|
||||
#include "BinEquationWriter.h"
|
||||
|
||||
@ -7961,38 +7963,6 @@ namespace BinDocxRW
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
};
|
||||
class BinaryAppTableWriter
|
||||
{
|
||||
BinaryCommonWriter m_oBcw;
|
||||
ParamsWriter& m_oParamsWriter;
|
||||
public:
|
||||
BinaryAppTableWriter(ParamsWriter& oParamsWriter):
|
||||
m_oBcw(oParamsWriter),m_oParamsWriter(oParamsWriter)
|
||||
{
|
||||
}
|
||||
void Write(OOX::CApp& oApp)
|
||||
{
|
||||
int nStart = m_oBcw.WriteItemWithLengthStart();
|
||||
WriteProperties(oApp);
|
||||
m_oBcw.WriteItemWithLengthEnd(nStart);
|
||||
}
|
||||
void WriteProperties(OOX::CApp& oApp)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if (oApp.m_sApplication.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerApp::Application);
|
||||
m_oBcw.m_oStream.WriteStringW3(oApp.m_sApplication.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if (oApp.m_sAppVersion.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerApp::AppVersion);
|
||||
m_oBcw.m_oStream.WriteStringW3(oApp.m_sAppVersion.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
};
|
||||
class BinaryFileWriter
|
||||
{
|
||||
BinaryCommonWriter m_oBcw;
|
||||
@ -8148,9 +8118,15 @@ namespace BinDocxRW
|
||||
//Write App
|
||||
if(NULL != oDocx.m_pApp)
|
||||
{
|
||||
BinDocxRW::BinaryAppTableWriter oBinaryAppWriter(m_oParamsWriter);
|
||||
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::App);
|
||||
oBinaryAppWriter.Write(*oDocx.m_pApp);
|
||||
oDocx.m_pApp->ToPptxApp()->toPPTY(&oBufferedStream);
|
||||
this->WriteTableEnd(nCurPos);
|
||||
}
|
||||
|
||||
if(NULL != oDocx.m_pCore)
|
||||
{
|
||||
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Core);
|
||||
oDocx.m_pCore->ToPptxCore()->toPPTY(&oBufferedStream);
|
||||
this->WriteTableEnd(nCurPos);
|
||||
}
|
||||
|
||||
|
||||
@ -265,4 +265,11 @@ namespace BinXlsxRW{
|
||||
NSDirectory::DeleteDirectory(sTempDir);
|
||||
return res;
|
||||
}
|
||||
bool CXlsxSerializer::hasPivot(const std::wstring& sSrcPath)
|
||||
{
|
||||
//todo CXlsx
|
||||
std::wstring sData;
|
||||
NSFile::CFileBinary::ReadAllTextUtf8(sSrcPath + FILE_SEPARATOR_STR + L"[Content_Types].xml", sData);
|
||||
return std::wstring::npos != sData.find(OOX::Spreadsheet::FileTypes::PivotTable.OverrideType());
|
||||
}
|
||||
};
|
||||
|
||||
@ -74,6 +74,7 @@ namespace BinXlsxRW {
|
||||
void setIsNoBase64 (bool bIsNoBase64);
|
||||
|
||||
bool writeChartXlsx (const std::wstring& sDstFile ,const OOX::Spreadsheet::CChartSpace& oChart);
|
||||
bool hasPivot (const std::wstring& sSrcPath);
|
||||
};
|
||||
}
|
||||
#endif // #ifndef XLSX_SERIALIZER
|
||||
|
||||
@ -36,6 +36,7 @@
|
||||
#include "../include/CPScopedPtr.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
|
||||
namespace formulasconvert {
|
||||
|
||||
|
||||
@ -44,7 +45,7 @@ namespace formulasconvert {
|
||||
class odf2oox_converter
|
||||
{
|
||||
public:
|
||||
odf2oox_converter();
|
||||
odf2oox_converter();
|
||||
~odf2oox_converter();
|
||||
|
||||
// of:=SUM([.DDA1:.BA3]) -> SUM(DDA1:BA3)
|
||||
|
||||
@ -35,6 +35,7 @@
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#include"../../Common/DocxFormat/Source/XML/Utils.h"
|
||||
#include "../src/docx/xlsxconversioncontext.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace formulasconvert {
|
||||
@ -42,6 +43,9 @@ namespace formulasconvert {
|
||||
class odf2oox_converter::Impl
|
||||
{
|
||||
public:
|
||||
Impl() {}
|
||||
|
||||
static std::unordered_map<std::wstring, int> & mapExternalLink_;
|
||||
|
||||
std::wstring convert(const std::wstring& expr);
|
||||
std::wstring convert_chart_distance(const std::wstring& expr);
|
||||
@ -54,21 +58,155 @@ namespace formulasconvert {
|
||||
void replace_tilda(std::wstring& expr);
|
||||
void replace_vertical(std::wstring& expr);
|
||||
void replace_space(std::wstring& expr);
|
||||
|
||||
|
||||
std::wstring convert_named_ref(const std::wstring& expr, bool withTableName, std::wstring separator);
|
||||
std::wstring convert_named_expr(const std::wstring& expr, bool withTableName);
|
||||
|
||||
static std::wstring replace_named_ref_formater(boost::wsmatch const & what);
|
||||
static std::wstring replace_named_ref_formater1(boost::wsmatch const & what);
|
||||
static std::wstring replace_cell_range_formater(boost::wsmatch const & what);
|
||||
//static std::wstring replace_cell_range_formater(boost::wsmatch const & what);
|
||||
|
||||
void replace_named_formula(std::wstring & expr, bool w = true);
|
||||
void replace_named_ref(std::wstring & expr, bool w = true);
|
||||
|
||||
bool find_first_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref);
|
||||
bool find_first_last_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref_first,std::wstring & ref_last);
|
||||
|
||||
static bool convert_with_TableName;
|
||||
static std::wstring table_name_;
|
||||
static bool convert_with_TableName;
|
||||
static std::wstring table_name_;
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
static std::wstring replace_semicolons_formater(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
return L",";
|
||||
else if (what[2].matched)
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
else
|
||||
return L"";
|
||||
}
|
||||
static std::wstring replace_tilda_formater(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
return L";";
|
||||
else if (what[2].matched)
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
else
|
||||
return L"";
|
||||
}
|
||||
static std::wstring replace_vertical_formater(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
{
|
||||
std::wstring inner = what[1].str();
|
||||
XmlUtils::replace_all( inner, L"|", L";");
|
||||
return L"{" + inner + L"}";
|
||||
}
|
||||
else if (what[2].matched)
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
|
||||
return L"";
|
||||
}
|
||||
|
||||
static void replace_tmp_back(std::wstring &expr)
|
||||
{
|
||||
XmlUtils::replace_all( expr, L"ТОСHKA", L".");
|
||||
XmlUtils::replace_all( expr, L"VOSKL", L"!");
|
||||
|
||||
XmlUtils::replace_all( expr, L"SCOBCAIN", L"(");
|
||||
XmlUtils::replace_all( expr, L"SCOBCAOUT", L")");
|
||||
|
||||
XmlUtils::replace_all( expr, L"KVADRATIN", L"[");
|
||||
XmlUtils::replace_all( expr, L"KVADRATOUT", L"]");
|
||||
|
||||
XmlUtils::replace_all( expr, L"PROBEL", L" ");
|
||||
XmlUtils::replace_all( expr, L"APOSTROF", L"'");
|
||||
XmlUtils::replace_all( expr, L"KAVYCHKA", L"\"");
|
||||
}
|
||||
static void replace_tmp(std::wstring &expr)
|
||||
{
|
||||
XmlUtils::replace_all( expr, L".", L"ТОСHKA");
|
||||
XmlUtils::replace_all( expr, L"!", L"VOSKL");
|
||||
|
||||
XmlUtils::replace_all( expr, L"(", L"SCOBCAIN");
|
||||
XmlUtils::replace_all( expr, L")", L"SCOBCAOUT");
|
||||
|
||||
//XmlUtils::replace_all( expr, L"[", L"KVADRATIN");
|
||||
//XmlUtils::replace_all( expr, L"]", L"KVADRATOUT");
|
||||
|
||||
XmlUtils::replace_all( expr, L" ", L"PROBEL");
|
||||
// XmlUtils::replace_all( expr, L"'", L"APOSTROF");
|
||||
// XmlUtils::replace_all( expr, L"\"", L"KAVYCHKA");
|
||||
}
|
||||
static std::wstring convert_scobci(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
{
|
||||
std::wstring inner = what[1].str();
|
||||
|
||||
replace_tmp(inner);
|
||||
|
||||
return inner;
|
||||
}
|
||||
else if (what[2].matched)
|
||||
{
|
||||
std::wstring inner = what[2].str();
|
||||
|
||||
replace_tmp(inner);
|
||||
|
||||
return inner;
|
||||
}
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
|
||||
return L"";
|
||||
}
|
||||
static std::wstring replace_space_formater(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
{
|
||||
std::wstring inner = what[1].str();
|
||||
XmlUtils::replace_all( inner, L" ", L",");
|
||||
return inner;
|
||||
}
|
||||
else if (what[2].matched)
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
|
||||
return L"";
|
||||
}
|
||||
|
||||
static std::wstring is_forbidden(const std::wstring & formula)
|
||||
{
|
||||
std::wstring result = formula;
|
||||
std::map<std::wstring, std::wstring> forbidden_formulas;
|
||||
|
||||
forbidden_formulas.insert(std::make_pair(L"FORMULA", L"_xlfn.FORMULATEXT"));
|
||||
|
||||
for (std::map<std::wstring, std::wstring>::iterator it = forbidden_formulas.begin(); it != forbidden_formulas.end(); ++it)
|
||||
{
|
||||
if (boost::algorithm::contains(formula, it->first))
|
||||
{
|
||||
|
||||
XmlUtils::replace_all(result, it->first, it->second);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
bool odf2oox_converter::Impl::convert_with_TableName = true;
|
||||
std::wstring odf2oox_converter::Impl::table_name_ = L"";
|
||||
|
||||
std::unordered_map<std::wstring, int> &odf2oox_converter::Impl::mapExternalLink_ = oox::xlsx_conversion_context::mapExternalLink_;
|
||||
|
||||
bool odf2oox_converter::Impl::find_first_last_ref(std::wstring const & expr, std::wstring & table,std::wstring & ref_first,std::wstring & ref_last)
|
||||
{
|
||||
@ -76,14 +214,14 @@ namespace formulasconvert {
|
||||
|
||||
boost::algorithm::split(splitted, expr, boost::algorithm::is_any_of(L".:"), boost::algorithm::token_compress_on);
|
||||
|
||||
if (splitted.size()==3)
|
||||
if (splitted.size() == 3)
|
||||
{
|
||||
table = splitted[0];
|
||||
ref_first = splitted[1];
|
||||
ref_last = splitted[2];
|
||||
return true;
|
||||
}
|
||||
if (splitted.size()==4)
|
||||
if (splitted.size() == 4)
|
||||
{
|
||||
table = splitted[0];
|
||||
ref_first = splitted[1];
|
||||
@ -95,7 +233,7 @@ namespace formulasconvert {
|
||||
|
||||
bool odf2oox_converter::Impl::find_first_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref)
|
||||
{
|
||||
boost::wregex re(L"\\[(?:\\$)?([^\\.]+?){0,1}\\.([a-zA-Z\\$]+\\d+)(?::\\.([a-zA-Z]+\\d+)){0,1}\\]");
|
||||
boost::wregex re(L"\\[(?:\\$)?([^\\.]+?){0,1}\\.([\\w^0-9\\$]+\\d+)(?::\\.([\\w^0-9]+\\d+)){0,1}\\]");
|
||||
boost::wsmatch result;
|
||||
bool b = boost::regex_search(expr, result, re);
|
||||
|
||||
@ -118,101 +256,92 @@ namespace formulasconvert {
|
||||
}
|
||||
|
||||
|
||||
std::wstring odf2oox_converter::Impl::replace_cell_range_formater(boost::wsmatch const & what)
|
||||
{
|
||||
const size_t sz = what.size();
|
||||
if (sz == 4 && !what[1].matched)
|
||||
{
|
||||
const std::wstring c1 = what[2].str();
|
||||
const std::wstring c2 = what[3].str();
|
||||
const std::wstring s = c1 + (c2.empty() ? L"" : (L":" + c2) );
|
||||
return s;
|
||||
}
|
||||
else if (sz == 4 && what[1].matched)
|
||||
{
|
||||
std::wstring sheet1 = what[1].str();
|
||||
XmlUtils::replace_all( sheet1, L"$", L"");
|
||||
//std::wstring odf2oox_converter::Impl::replace_cell_range_formater(boost::wsmatch const & what)
|
||||
//{
|
||||
// const size_t sz = what.size();
|
||||
// if (sz == 4 && !what[1].matched)
|
||||
// {
|
||||
// const std::wstring c1 = what[2].str();
|
||||
// const std::wstring c2 = what[3].str();
|
||||
// const std::wstring s = c1 + (c2.empty() ? L"" : (L":" + c2) );
|
||||
// return s;
|
||||
// }
|
||||
// else if (sz == 4 && what[1].matched)
|
||||
// {
|
||||
// std::wstring sheet1 = what[1].str();
|
||||
// XmlUtils::replace_all( sheet1, L"$", L"");
|
||||
|
||||
const std::wstring c1 = what[2].str();
|
||||
std::wstring c2 = what[3].str();
|
||||
if (c2.empty()) c2 = what[4].str();
|
||||
const std::wstring s = sheet1 + L"!" + c1 + (c2.empty() ? L"" : (L":" + c2) );
|
||||
return s;
|
||||
}
|
||||
return L"";
|
||||
}
|
||||
// const std::wstring c1 = what[2].str();
|
||||
// std::wstring c2 = what[3].str();
|
||||
// if (c2.empty()) c2 = what[4].str();
|
||||
// const std::wstring s = sheet1 + L"!" + c1 + (c2.empty() ? L"" : (L":" + c2) );
|
||||
// return s;
|
||||
// }
|
||||
// return L"";
|
||||
//}
|
||||
|
||||
std::wstring odf2oox_converter::Impl::replace_named_ref_formater(boost::wsmatch const & what)
|
||||
{
|
||||
const size_t sz = what.size();
|
||||
|
||||
if (sz == 4 && !what[1].matched)
|
||||
if (sz < 6) return what[0].str();
|
||||
|
||||
std::wstring c0 = what[0].str();
|
||||
std::wstring external = sz == 7 ? what[1].matched ? what[1].str() : what[2].str() : what[1].str();
|
||||
std::wstring sheet1 = sz == 7 ? what[3].str() : what[2].str();
|
||||
std::wstring ref1 = sz == 7 ? what[4].str() : what[3].str();
|
||||
std::wstring sheet2 = sz == 7 ? what[5].str() : what[4].str();
|
||||
std::wstring ref2 = sz == 7 ? what[6].str() : what[5].str();
|
||||
|
||||
XmlUtils::replace_all( sheet1, L"$", L"");
|
||||
//XmlUtils::replace_all( sheet2, L"$", L"");
|
||||
|
||||
std::wstring result;
|
||||
|
||||
if (false == external.empty())
|
||||
{
|
||||
const std::wstring c1 = what[2].str();
|
||||
const std::wstring c2 = what[3].str();
|
||||
const std::wstring s = c1 + (c2.empty() ? L"" : (L":" + c2) );
|
||||
return s;
|
||||
}
|
||||
else if (sz == 4 && what[1].matched)
|
||||
{
|
||||
std::wstring sheet1 = what[1].str();
|
||||
XmlUtils::replace_all( sheet1, L"$", L"");
|
||||
replace_tmp_back(external);
|
||||
|
||||
table_name_ = sheet1;
|
||||
|
||||
const std::wstring c1 = what[2].str();
|
||||
const std::wstring c2 = what[3].str();
|
||||
|
||||
if (convert_with_TableName)
|
||||
int id = -1;//add_external_link(external);
|
||||
std::unordered_map<std::wstring, int>::iterator pFind = mapExternalLink_.find(external);
|
||||
if ( pFind == mapExternalLink_.end())
|
||||
{
|
||||
if (std::wstring::npos != sheet1.find(L" "))
|
||||
{
|
||||
if (sheet1[0] != L'\'')
|
||||
{
|
||||
sheet1 = L"'" + sheet1 + L"'";
|
||||
}
|
||||
}
|
||||
return (sheet1 + L"!") + c1 + (c2.empty() ? L"" : (L":" + c2) );
|
||||
id = (int)mapExternalLink_.size() + 1;
|
||||
mapExternalLink_.insert(std::make_pair(external, id));
|
||||
}
|
||||
else
|
||||
{
|
||||
return c1 + (c2.empty() ? L"" : (L":" + c2) );
|
||||
id = pFind->second;
|
||||
}
|
||||
}
|
||||
else if (sz == 5 && what[1].matched)
|
||||
{
|
||||
std::wstring sheet1 = what[1].str();
|
||||
XmlUtils::replace_all( sheet1, L"$", L"");
|
||||
|
||||
const std::wstring c1 = what[2].str();
|
||||
const std::wstring c2 = what[3].str(); //sheet name 2
|
||||
const std::wstring c3 = what[4].str();
|
||||
|
||||
table_name_ = sheet1;
|
||||
|
||||
if (convert_with_TableName)
|
||||
if (sheet1[0] == L'\'')
|
||||
{
|
||||
return (sheet1 + L"!") + c1 + (c3.empty() ? L"" : (L":" + c3) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return c1 + (c3.empty() ? L"" : (L":" + c3) );
|
||||
sheet1 = sheet1.substr(1, sheet1.length() - 2);
|
||||
}
|
||||
sheet1 = L"'[" + std::to_wstring(id) + L"]" + sheet1 + L"'";
|
||||
}
|
||||
else if (sz == 5 && !what[1].matched)
|
||||
else if (std::wstring::npos != sheet1.find(L" "))
|
||||
{
|
||||
const std::wstring c1 = what[2].str();
|
||||
const std::wstring c2 = what[3].str(); //sheet name 2
|
||||
const std::wstring c3 = what[4].str();
|
||||
|
||||
return c1 + (c3.empty() ? L"" : (L":" + c3) );
|
||||
if (sheet1[0] != L'\'')
|
||||
{
|
||||
sheet1 = L"'" + sheet1 + L"'";
|
||||
}
|
||||
}
|
||||
|
||||
table_name_ = sheet1;
|
||||
|
||||
if (convert_with_TableName)
|
||||
{
|
||||
return (sheet1.empty() ? L"" : (sheet1 + L"!")) + ref1 + (ref2.empty() ? L"" : (L":" + ref2) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return ref1 + (ref2.empty() ? L"" : (L":" + ref2) );
|
||||
}
|
||||
return L"";
|
||||
}
|
||||
std::wstring odf2oox_converter::Impl::replace_named_ref_formater1(boost::wsmatch const & what)
|
||||
{
|
||||
boost::wregex complexRef(L"\\${0,1}([^\\.]+?){0,1}\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)(?::\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)){0,1}");
|
||||
|
||||
boost::wregex complexRef(L"(?:\'([^\']*)\'#){0,1}\\${0,1}([^\\.]+?){0,1}\\.(\\${0,1}[\\w^0-9]+\\${0,1}\\d+)(?::\\.(\\${0,1}[\\w^0-9]+\\${0,1}\\d+)){0,1}");
|
||||
// 'external'# $ Sheet2 . A1 : ( $ Sheet2)? . B5
|
||||
std::wstring expr = what[1].str();
|
||||
const std::wstring res = boost::regex_replace(
|
||||
expr,
|
||||
@ -233,26 +362,34 @@ namespace formulasconvert {
|
||||
// [$'Sheet2 A'.$B2] -> 'Sheet2 A'!$B2
|
||||
void odf2oox_converter::Impl::replace_cells_range(std::wstring& expr, bool withTableName)
|
||||
{
|
||||
XmlUtils::replace_all( expr, L"#REF !", L"#REF!");
|
||||
XmlUtils::replace_all( expr, L"#REF!#REF!", L"#REF!");
|
||||
XmlUtils::replace_all( expr, L"$#REF!$#REF!", L"#REF!");
|
||||
|
||||
convert_with_TableName = withTableName;
|
||||
|
||||
boost::wregex complexRef(L"\\[(?:\$)?([^\\.]+?){0,1}\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)(?::(\\${0,1}[^\\.]+?){0,1}\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)){0,1}\\]");
|
||||
/*
|
||||
[ $ Sheet2 . A1 : ( $ Sheet2)? . B5 ]
|
||||
*/
|
||||
//boost::wregex complexRef(L"\\[(?:\'([^\']*)\'#){0,1}\\[{0,1}(?:\\$){0,1}([^\\.]+?){0,1}\\.(\\${0,1}[\\w^0-9]*\\${0,1}\\d*)(?::(\\${0,1}[^\\.]+?){0,1}\\.(\\${0,1}[\\w^0-9]*\\${0,1}\\d*)){0,1}\\]{0,1}");
|
||||
boost::wregex complexRef(L"(?:(?:(?:(?:\\[\'([^\']*)\'#)|(?:\'([^\']*)\'#\\[)))|(?:\\[))\
|
||||
(?:\\$){0,1}([^\\.]+?){0,1}\\.(\\${0,1}[\\w^0-9]*\\${0,1}\\d*)(?::(\\${0,1}[^\\.]+?){0,1}\\.(\\${0,1}[\\w^0-9]*\\${0,1}\\d*)){0,1}\\]");
|
||||
// [ 'external'# [ $ Sheet2 . A1 : ( $ Sheet2)? . B5 ]
|
||||
|
||||
const std::wstring res = boost::regex_replace(
|
||||
expr,
|
||||
expr = boost::regex_replace(
|
||||
expr,
|
||||
complexRef,
|
||||
&replace_named_ref_formater,
|
||||
boost::match_default | boost::format_all);
|
||||
expr = res;
|
||||
}
|
||||
void odf2oox_converter::Impl::replace_named_ref(std::wstring & expr, bool withTableName)
|
||||
{
|
||||
XmlUtils::replace_all( expr, L"#REF !", L"#REF!");
|
||||
XmlUtils::replace_all( expr, L"#REF!#REF!", L"#REF!");
|
||||
XmlUtils::replace_all( expr, L"$#REF!$#REF!", L"#REF!");
|
||||
|
||||
convert_with_TableName = withTableName;
|
||||
|
||||
//boost::wregex complexRef(L"\\${0,1}([^\\.]+?){0,1}\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)(?::\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)){0,1}");
|
||||
boost::wregex complexRef(L"\\${0,1}([^\\.\\s]+?){0,1}\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)(?::\\${0,1}([^\\.\\s]+?){0,1}\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)){0,1}");
|
||||
boost::wregex complexRef(L"\\[{0,1}(?:\'([^\']*)\'#){0,1}\\${0,1}([^\\.\\s]+?){0,1}\\.(\\${0,1}[\\w^0-9]*\\${0,1}\\d*)(?::\\${0,1}([^\\.\\s]+?){0,1}\\.(\\${0,1}[\\w^0-9]*\\${0,1}\\d*)){0,1}\\]{0,1}");
|
||||
// 'external'# $ Sheet2 . A1 : ( $ Sheet2)? . B5
|
||||
|
||||
const std::wstring res = boost::regex_replace(
|
||||
expr,
|
||||
@ -281,29 +418,7 @@ namespace formulasconvert {
|
||||
}
|
||||
|
||||
|
||||
std::wstring replace_semicolons_formater(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
return L",";
|
||||
else if (what[2].matched)
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
else
|
||||
return L"";
|
||||
}
|
||||
std::wstring replace_tilda_formater(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
return L";";
|
||||
else if (what[2].matched)
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
else
|
||||
return L"";
|
||||
}
|
||||
// TODO
|
||||
|
||||
// заменить точки с запятой во всех вхождениях кроме находящихся в кавычках --*и в фигурных скобках*--
|
||||
void odf2oox_converter::Impl::replace_semicolons(std::wstring& expr)
|
||||
{
|
||||
@ -327,123 +442,6 @@ namespace formulasconvert {
|
||||
|
||||
expr = res;
|
||||
}
|
||||
std::wstring replace_vertical_formater(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
{
|
||||
std::wstring inner = what[1].str();
|
||||
XmlUtils::replace_all( inner, L"|", L";");
|
||||
return L"{" + inner + L"}";
|
||||
}
|
||||
else if (what[2].matched)
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
|
||||
return L"";
|
||||
}
|
||||
|
||||
std::wstring replace_point_space(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
{
|
||||
std::wstring inner = what[1].str();
|
||||
XmlUtils::replace_all( inner, L" ", L"PROBEL");
|
||||
return inner;
|
||||
}
|
||||
else if (what[2].matched)
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
|
||||
return L"";
|
||||
}
|
||||
std::wstring convert_scobci(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
{
|
||||
std::wstring inner = what[1].str();
|
||||
XmlUtils::replace_all( inner, L".", L"ТОСHKA");
|
||||
XmlUtils::replace_all( inner, L"(", L"SCOBCAIN");
|
||||
XmlUtils::replace_all( inner, L")", L"SCOBCAOUT");
|
||||
|
||||
XmlUtils::replace_all( inner, L"[", L"KVADRATIN");
|
||||
XmlUtils::replace_all( inner, L"]", L"KVADRATOUT");
|
||||
|
||||
XmlUtils::replace_all( inner, L" ", L"PROBEL");
|
||||
XmlUtils::replace_all( inner, L"'", L"APOSTROF");
|
||||
return inner;
|
||||
}
|
||||
else if (what[2].matched)
|
||||
{
|
||||
std::wstring inner = what[2].str();
|
||||
XmlUtils::replace_all( inner, L".", L"ТОСHKA");
|
||||
|
||||
XmlUtils::replace_all( inner, L"(", L"SCOBCAIN");
|
||||
XmlUtils::replace_all( inner, L")", L"SCOBCAOUT");
|
||||
|
||||
XmlUtils::replace_all( inner, L"[", L"KVADRATIN");
|
||||
XmlUtils::replace_all( inner, L"]", L"KVADRATOUT");
|
||||
|
||||
XmlUtils::replace_all( inner, L" ", L"PROBEL");
|
||||
XmlUtils::replace_all( inner, L"\"", L"KAVYCHKA");
|
||||
return inner;
|
||||
}
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
|
||||
return L"";
|
||||
}
|
||||
std::wstring replace_space_formater(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
{
|
||||
std::wstring inner = what[1].str();
|
||||
XmlUtils::replace_all( inner, L" ", L",");
|
||||
return inner;
|
||||
}
|
||||
else if (what[2].matched)
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
|
||||
return L"";
|
||||
}
|
||||
|
||||
|
||||
//std::wstring forbidden_formulas[] =
|
||||
//{
|
||||
// L"NULLFORMULA"
|
||||
// //L"BETADIST",
|
||||
// //L"CEILING",
|
||||
// //L"FLOOR",
|
||||
// //L"RANK",
|
||||
// //L"ROUND",
|
||||
// //L"ROUNDDOWN",
|
||||
// //L"ROUNDUP",
|
||||
// //L"SUBTOTAL",
|
||||
// //L"FORMULA",
|
||||
// //L"ISREF"
|
||||
//};
|
||||
|
||||
std::wstring is_forbidden(const std::wstring & formula)
|
||||
{
|
||||
std::wstring result = formula;
|
||||
std::map<std::wstring, std::wstring> forbidden_formulas;
|
||||
|
||||
forbidden_formulas.insert(std::make_pair(L"FORMULA", L"_xlfn.FORMULATEXT"));
|
||||
|
||||
for (std::map<std::wstring, std::wstring>::iterator it = forbidden_formulas.begin(); it != forbidden_formulas.end(); ++it)
|
||||
{
|
||||
if (boost::algorithm::contains(formula, it->first))
|
||||
{
|
||||
|
||||
XmlUtils::replace_all(result, it->first, it->second);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// заменить вертикальную черту во всех вхождениях в фигурных скобках, но не внутри строк
|
||||
void odf2oox_converter::Impl::replace_vertical(std::wstring& expr)
|
||||
{
|
||||
@ -468,17 +466,11 @@ namespace formulasconvert {
|
||||
std::wstring odf2oox_converter::Impl::convert(const std::wstring& expr)
|
||||
{
|
||||
std::wstring workstr = is_forbidden(expr);
|
||||
//boost::wregex complexRef(L"('(?!\\s\\'){0,1}.*?')");// Better_Donut.ods- cell(c27)
|
||||
//std::wstring workstr = boost::regex_replace(
|
||||
// expr,
|
||||
// complexRef,
|
||||
// &replace_point_space,
|
||||
// boost::match_default | boost::format_all);
|
||||
|
||||
bool isFormula = check_formula(workstr);
|
||||
|
||||
boost::regex_replace(
|
||||
workstr,
|
||||
//экранирование
|
||||
workstr = boost::regex_replace(workstr,
|
||||
boost::wregex(L"('.*?')|(\".*?\")"),
|
||||
&convert_scobci, boost::match_default | boost::format_all);
|
||||
|
||||
@ -492,9 +484,9 @@ namespace formulasconvert {
|
||||
XmlUtils::replace_all( workstr, L"FDIST(", L"_xlfn.F.DIST(");
|
||||
// ROUNDUP( - тут в oox 2 параметра - разрядность нужно - ,0) - EV Requirements v2.2.3.ods
|
||||
|
||||
int res_find=0;
|
||||
if ((res_find = workstr.find(L"CONCATINATE")) > 0)
|
||||
if (std::wstring::npos != workstr.find(L"CONCATINATE"))
|
||||
{
|
||||
bool l = true;
|
||||
//могут быть частично заданы диапазоны
|
||||
//todooo
|
||||
}
|
||||
@ -509,39 +501,23 @@ namespace formulasconvert {
|
||||
|
||||
|
||||
//-----------------------------------------------------------
|
||||
XmlUtils::replace_all( workstr, L"PROBEL" , L" ");
|
||||
XmlUtils::replace_all( workstr, L"APOSTROF" , L"'");
|
||||
XmlUtils::replace_all( workstr, L"ТОСHKA" , L".");
|
||||
|
||||
XmlUtils::replace_all( workstr, L"SCOBCAIN" , L"(");
|
||||
XmlUtils::replace_all( workstr, L"SCOBCAOUT" , L")");
|
||||
|
||||
XmlUtils::replace_all( workstr, L"KVADRATIN" , L"[");
|
||||
XmlUtils::replace_all( workstr, L"KVADRATOUT", L"]");
|
||||
|
||||
XmlUtils::replace_all( workstr, L"PROBEL" , L" ");
|
||||
XmlUtils::replace_all( workstr, L"KAVYCHKA" , L"\"");
|
||||
replace_tmp_back(workstr);
|
||||
|
||||
return workstr;
|
||||
}
|
||||
|
||||
void odf2oox_converter::Impl::split_distance_by(const std::wstring& expr, const std::wstring& by, std::vector<std::wstring>& out)
|
||||
{
|
||||
std::wstring workstr = expr;
|
||||
boost::wregex complexRef(L"('(?!\\s\\'){0,1}.*?')");// поиск того что в апострофах и замена там
|
||||
|
||||
workstr = boost::regex_replace(
|
||||
std::wstring workstr = boost::regex_replace(
|
||||
expr,
|
||||
complexRef,
|
||||
&replace_point_space,
|
||||
boost::match_default | boost::format_all);
|
||||
boost::wregex(L"('.*?')|(\".*?\")"),
|
||||
&convert_scobci, boost::match_default | boost::format_all);
|
||||
|
||||
boost::algorithm::split(out, workstr, boost::algorithm::is_any_of(by), boost::algorithm::token_compress_on);
|
||||
|
||||
for (size_t i = 0; i < out.size(); i++)
|
||||
{
|
||||
XmlUtils::replace_all( out[i], L"PROBEL", L" ");
|
||||
XmlUtils::replace_all( out[i], L"TOCHKA", L".");
|
||||
replace_tmp_back(out[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -551,15 +527,10 @@ namespace formulasconvert {
|
||||
|
||||
std::wstring odf2oox_converter::Impl::convert_chart_distance(const std::wstring& expr)
|
||||
{
|
||||
std::wstring workstr = is_forbidden(expr);
|
||||
|
||||
boost::wregex complexRef(L"('(?!\\s\\'){0,1}.*?')");// поиск того что в апострофах и замена там
|
||||
|
||||
workstr = boost::regex_replace(
|
||||
expr,
|
||||
complexRef,
|
||||
&replace_point_space,
|
||||
boost::match_default | boost::format_all);
|
||||
std::wstring workstr = boost::regex_replace(
|
||||
is_forbidden(expr),
|
||||
boost::wregex(L"('.*?')|(\".*?\")"),
|
||||
&convert_scobci, boost::match_default | boost::format_all);
|
||||
|
||||
//распарсить по диапазонам - одф-пробел, ик-эль-запятая
|
||||
|
||||
@ -591,10 +562,10 @@ namespace formulasconvert {
|
||||
cells_out.append(cells[j]);
|
||||
cells_out.append(L":");
|
||||
}
|
||||
int res1 = sheet.find(L"-");
|
||||
int res2 = sheet.find(L"'");
|
||||
size_t res1 = sheet.find(L"-");
|
||||
size_t res2 = sheet.find(L"'");
|
||||
|
||||
if (res1 >= 0 && !(res2 == 0))
|
||||
if (res1 != std::wstring::npos && res2 != std::wstring::npos && !(res2 == 0))
|
||||
{
|
||||
sheet = L"'" + sheet + L"'";
|
||||
}
|
||||
@ -608,12 +579,78 @@ namespace formulasconvert {
|
||||
result.append(distance_out[i]);
|
||||
result.append(L",");
|
||||
}
|
||||
XmlUtils::replace_all( result, L"PROBEL" , L" ");
|
||||
XmlUtils::replace_all( result, L"TOCHKA", L".");
|
||||
replace_tmp_back( result );
|
||||
|
||||
return result.substr(0, result.size() - 1);// минус последняя лишняя запятая
|
||||
}
|
||||
odf2oox_converter::odf2oox_converter(): impl_(new odf2oox_converter::Impl)
|
||||
std::wstring odf2oox_converter::Impl::convert_named_ref(const std::wstring& expr, bool withTableName, std::wstring separator)
|
||||
{
|
||||
boost::wregex complexRef(L"('(?!\\s\\'){0,1}.*?')");// поиск того что в апострофах и замена там
|
||||
|
||||
std::wstring workstr = expr;
|
||||
|
||||
workstr = boost::regex_replace(
|
||||
workstr,
|
||||
boost::wregex(L"('.*?')|(\".*?\")"),
|
||||
&convert_scobci, boost::match_default | boost::format_all);
|
||||
|
||||
replace_named_ref(workstr, withTableName);
|
||||
|
||||
if (separator != L" ")
|
||||
{
|
||||
XmlUtils::replace_all( workstr, L" ", separator);
|
||||
}
|
||||
|
||||
replace_tmp_back( workstr );
|
||||
|
||||
if (table_name_.empty() == false)
|
||||
{
|
||||
replace_tmp_back( table_name_ );
|
||||
}
|
||||
return workstr;
|
||||
}
|
||||
std::wstring odf2oox_converter::Impl::convert_named_expr(const std::wstring& expr, bool withTableName)
|
||||
{
|
||||
std::wstring workstr = expr;
|
||||
|
||||
bool isFormula = check_formula(workstr);
|
||||
|
||||
if (isFormula)
|
||||
{
|
||||
workstr = convert(expr);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
workstr = boost::regex_replace(
|
||||
workstr,
|
||||
boost::wregex(L"('.*?')|(\".*?\")"),
|
||||
&convert_scobci, boost::match_default | boost::format_all);
|
||||
|
||||
|
||||
replace_cells_range(workstr, withTableName);
|
||||
replace_semicolons(workstr);
|
||||
replace_vertical(workstr);
|
||||
|
||||
size_t res_find = 0;
|
||||
if ((res_find = workstr.find(L"CONCATINATE")) != std::wstring::npos)
|
||||
{
|
||||
//могут быть частично заданы диапазоны
|
||||
//todooo
|
||||
|
||||
}
|
||||
replace_tmp_back(workstr);
|
||||
|
||||
if (table_name_.empty() == false)
|
||||
{
|
||||
replace_tmp_back(table_name_);
|
||||
}
|
||||
}
|
||||
return workstr;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------
|
||||
odf2oox_converter::odf2oox_converter() : impl_(new odf2oox_converter::Impl())
|
||||
{
|
||||
}
|
||||
|
||||
@ -640,82 +677,11 @@ namespace formulasconvert {
|
||||
}
|
||||
std::wstring odf2oox_converter::convert_named_ref(const std::wstring& expr, bool withTableName, std::wstring separator)
|
||||
{
|
||||
boost::wregex complexRef(L"('(?!\\s\\'){0,1}.*?')");// поиск того что в апострофах и замена там
|
||||
|
||||
std::wstring workstr = boost::regex_replace(
|
||||
expr,
|
||||
complexRef,
|
||||
&replace_point_space,
|
||||
boost::match_default | boost::format_all);
|
||||
|
||||
XmlUtils::replace_all( workstr, L"'", L"APOSTROF");
|
||||
//XmlUtils::replace_all( workstr, L"", L"APOSTROF");
|
||||
|
||||
impl_->replace_named_ref(workstr, withTableName);
|
||||
|
||||
if (separator != L" ")
|
||||
{
|
||||
XmlUtils::replace_all( workstr, L" " , separator);
|
||||
}
|
||||
|
||||
XmlUtils::replace_all( workstr, L"PROBEL" , L" ");
|
||||
XmlUtils::replace_all( workstr, L"APOSTROF" , L"'");
|
||||
XmlUtils::replace_all( workstr, L"TOCHKA" , L".");
|
||||
|
||||
if (impl_->table_name_.empty() == false)
|
||||
{
|
||||
XmlUtils::replace_all( impl_->table_name_, L"PROBEL" , L" ");
|
||||
XmlUtils::replace_all( impl_->table_name_, L"APOSTROF" , L"'");
|
||||
XmlUtils::replace_all( impl_->table_name_, L"TOCHKA" , L".");
|
||||
}
|
||||
return workstr;
|
||||
return impl_->convert_named_ref(expr, withTableName, separator);
|
||||
}
|
||||
std::wstring odf2oox_converter::convert_named_expr(const std::wstring& expr, bool withTableName)
|
||||
{
|
||||
std::wstring workstr = expr;
|
||||
|
||||
bool isFormula = impl_->check_formula(workstr);
|
||||
|
||||
if (isFormula)
|
||||
{
|
||||
workstr = impl_->convert(expr);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
boost::wregex complexRef(L"('(?!\\s\\'){0,1}.*?')");// поиск того что в апострофах и замена там
|
||||
|
||||
workstr = boost::regex_replace(
|
||||
workstr,
|
||||
complexRef,
|
||||
&replace_point_space,
|
||||
boost::match_default | boost::format_all);
|
||||
|
||||
XmlUtils::replace_all( workstr, L"'", L"APOSTROF");
|
||||
|
||||
impl_->replace_cells_range(workstr, withTableName);
|
||||
impl_->replace_semicolons(workstr);
|
||||
impl_->replace_vertical(workstr);
|
||||
|
||||
int res_find=0;
|
||||
if ((res_find = workstr.find(L"CONCATINATE")) > 0)
|
||||
{
|
||||
//могут быть частично заданы диапазоны
|
||||
//todooo
|
||||
|
||||
}
|
||||
XmlUtils::replace_all( workstr, L"PROBEL" , L" ");
|
||||
XmlUtils::replace_all( workstr, L"APOSTROF" , L"'");
|
||||
XmlUtils::replace_all( workstr, L"TOCHKA" , L".");
|
||||
|
||||
if (impl_->table_name_.empty() == false)
|
||||
{
|
||||
XmlUtils::replace_all( impl_->table_name_, L"PROBEL" , L" ");
|
||||
XmlUtils::replace_all( impl_->table_name_, L"APOSTROF" , L"'");
|
||||
XmlUtils::replace_all( impl_->table_name_, L"TOCHKA" , L".");
|
||||
}
|
||||
}
|
||||
return workstr;
|
||||
return impl_->convert_named_expr(expr, withTableName);
|
||||
}
|
||||
|
||||
std::wstring odf2oox_converter::convert_ref(std::wstring const & expr)
|
||||
@ -728,8 +694,8 @@ namespace formulasconvert {
|
||||
{
|
||||
while(true)
|
||||
{
|
||||
int pos = expr.find(L"%20");
|
||||
if (pos <0)break;
|
||||
size_t pos = expr.find(L"%20");
|
||||
if (pos == std::wstring::npos)break;
|
||||
|
||||
expr.replace(pos,3,L" ");
|
||||
}
|
||||
|
||||
@ -39,6 +39,22 @@
|
||||
namespace cpdoccore {
|
||||
namespace formulasconvert {
|
||||
|
||||
static std::wstring forbidden_formulas1[] =
|
||||
{
|
||||
L"NULLFORMULA()"
|
||||
/*
|
||||
L"BETADIST",
|
||||
L"CEILING",
|
||||
L"FLOOR",
|
||||
L"RANK",
|
||||
L"ROUND",
|
||||
L"ROUNDDOWN",
|
||||
L"ROUNDUP",
|
||||
L"SUBTOTAL",
|
||||
L"FORMULA",
|
||||
L"ISREF"*/
|
||||
};
|
||||
|
||||
class oox2odf_converter::Impl
|
||||
{
|
||||
public:
|
||||
@ -48,7 +64,7 @@ public:
|
||||
std::wstring convert_conditional_formula(const std::wstring& expr);
|
||||
|
||||
std::wstring convert_chart_distance(const std::wstring& expr);
|
||||
static void replace_cells_range(std::wstring& expr);
|
||||
static void replace_cells_range(std::wstring& expr, bool bSelect = true);
|
||||
|
||||
static void replace_semicolons(std::wstring& expr);
|
||||
static void replace_vertical(std::wstring& expr);
|
||||
@ -59,7 +75,104 @@ public:
|
||||
static std::wstring replace_arguments(boost::wsmatch const & what);
|
||||
static std::wstring convert_scobci(boost::wsmatch const & what);
|
||||
|
||||
void replace_named_ref(std::wstring & expr);
|
||||
static std::wstring replace_tilda_formater(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
return L";";
|
||||
else if (what[2].matched)
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
//else if (what[4].matched)
|
||||
// return what[4].str();
|
||||
else
|
||||
return L"";
|
||||
}
|
||||
static std::wstring replace_semicolons_formater(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
return L";";
|
||||
else if (what[2].matched)
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
//else if (what[4].matched)
|
||||
// return what[4].str();
|
||||
else
|
||||
return L"";
|
||||
}
|
||||
static std::wstring replace_vertical_formater(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
{
|
||||
std::wstring inner = what[1].str();
|
||||
XmlUtils::replace_all( inner, L";", L"|");
|
||||
return L"{" + inner + L"}";
|
||||
}
|
||||
else if (what[2].matched)
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
|
||||
return L"";
|
||||
}
|
||||
static std::wstring replace_space_formater(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
{
|
||||
std::wstring inner = what[1].str();
|
||||
XmlUtils::replace_all( inner, L",", L" ");
|
||||
return inner;
|
||||
}
|
||||
else if (what[2].matched)
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
|
||||
return L"";
|
||||
}
|
||||
static void oox_replace_tmp_back(std::wstring &expr)
|
||||
{
|
||||
XmlUtils::replace_all( expr, L"ТОСHKA", L".");
|
||||
XmlUtils::replace_all( expr, L"VOSKL", L"!");
|
||||
|
||||
XmlUtils::replace_all( expr, L"SCOBCAIN", L"(");
|
||||
XmlUtils::replace_all( expr, L"SCOBCAOUT", L")");
|
||||
|
||||
XmlUtils::replace_all( expr, L"KVADRATIN", L"[");
|
||||
XmlUtils::replace_all( expr, L"KVADRATOUT", L"]");
|
||||
|
||||
XmlUtils::replace_all( expr, L"PROBEL", L" ");
|
||||
XmlUtils::replace_all( expr, L"APOSTROF", L"'");
|
||||
XmlUtils::replace_all( expr, L"KAVYCHKA", L"\"");
|
||||
}
|
||||
|
||||
static void oox_replace_tmp(std::wstring &expr)
|
||||
{
|
||||
XmlUtils::replace_all( expr, L".", L"ТОСHKA");
|
||||
XmlUtils::replace_all( expr, L"!", L"VOSKL");
|
||||
|
||||
XmlUtils::replace_all( expr, L"(", L"SCOBCAIN");
|
||||
XmlUtils::replace_all( expr, L")", L"SCOBCAOUT");
|
||||
|
||||
XmlUtils::replace_all( expr, L"[", L"KVADRATIN");
|
||||
XmlUtils::replace_all( expr, L"]", L"KVADRATOUT");
|
||||
|
||||
XmlUtils::replace_all( expr, L" ", L"PROBEL");
|
||||
XmlUtils::replace_all( expr, L"'", L"APOSTROF");
|
||||
XmlUtils::replace_all( expr, L"\"", L"KAVYCHKA");
|
||||
}
|
||||
|
||||
static bool is_forbidden1(const std::wstring & formula)
|
||||
{
|
||||
for (size_t i = 0; i < 1; i++)
|
||||
{
|
||||
if (boost::algorithm::contains(formula, forbidden_formulas1[i]))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
void replace_named_ref(std::wstring & expr);
|
||||
void replace_named_formula(std::wstring & expr);
|
||||
|
||||
static bool isFindBaseCell_;
|
||||
@ -70,8 +183,11 @@ public:
|
||||
bool oox2odf_converter::Impl::isFindBaseCell_ = false;
|
||||
std::wstring oox2odf_converter::Impl::table_name_ = L"";
|
||||
|
||||
void oox2odf_converter::Impl::replace_cells_range(std::wstring& expr)
|
||||
void oox2odf_converter::Impl::replace_cells_range(std::wstring& expr, bool bSelect)
|
||||
{
|
||||
if ((0 == expr.find(L"KAVYCHKA")) && (expr.length() - 8 == expr.rfind(L"KAVYCHKA") ))
|
||||
return;
|
||||
|
||||
boost::wregex re(L"([:$!])+");
|
||||
|
||||
boost::wsmatch result;
|
||||
@ -79,7 +195,7 @@ void oox2odf_converter::Impl::replace_cells_range(std::wstring& expr)
|
||||
|
||||
if (b)
|
||||
{
|
||||
boost::wregex re1(L"(\\$?\\w+\\!)?([a-zA-Z$]*\\d*)\\:?([a-zA-Z$]*\\d*)?");
|
||||
boost::wregex re1(L"(\\$?[^\']+\\!)?([\\w^0-9$]*\\d*)\\:?([\\w^0-9$]*\\d*)?");
|
||||
// $ Sheet2 ! $ A1 : $ B5
|
||||
// $ Sheet2 ! $ A : $ A
|
||||
// $ Sheet2 ! $ 1 : $ 1
|
||||
@ -88,7 +204,7 @@ void oox2odf_converter::Impl::replace_cells_range(std::wstring& expr)
|
||||
std::wstring res = boost::regex_replace(
|
||||
workstr,
|
||||
re1,
|
||||
&replace_cells_range_formater1,
|
||||
bSelect ? &replace_cells_range_formater1 : &replace_cells_range_formater2,
|
||||
boost::match_default | boost::format_all);
|
||||
|
||||
expr = res;
|
||||
@ -111,8 +227,12 @@ std::wstring oox2odf_converter::Impl::replace_cells_range_formater1(boost::wsmat
|
||||
|
||||
std::wstring c1 = what[2].str();
|
||||
std::wstring c2 = what[3].str();
|
||||
|
||||
if (!c1.empty() || !c2.empty() || !sheet.empty())
|
||||
|
||||
if ((0 == c1.find(L"KAVYCHKA")) && (c1.length() - 8 == c1.rfind(L"KAVYCHKA") ))
|
||||
{
|
||||
return c1;
|
||||
}
|
||||
else if (!c1.empty() || !c2.empty() || !sheet.empty())
|
||||
{
|
||||
XmlUtils::replace_all( sheet, L"!", L"");
|
||||
|
||||
@ -122,9 +242,8 @@ std::wstring oox2odf_converter::Impl::replace_cells_range_formater1(boost::wsmat
|
||||
}
|
||||
if (!sheet.empty() && (std::wstring::npos != c1.find(L"$"))) sheet = L"$" + sheet;
|
||||
|
||||
s = std::wstring(L"[") + sheet + L"." +
|
||||
c1 +
|
||||
(c2.empty() ? L"" : (L":" + sheet + L"." + c2) ) + std::wstring(L"]");
|
||||
|
||||
s = L"[" + sheet + L"." + c1 + (c2.empty() ? L"" : (L":" + sheet + L"." + c2)) + std::wstring(L"]");
|
||||
}
|
||||
return s;
|
||||
}
|
||||
@ -144,18 +263,43 @@ std::wstring oox2odf_converter::Impl::replace_cells_range_formater2(boost::wsmat
|
||||
{
|
||||
const size_t sz = what.size();
|
||||
|
||||
if (sz > 2)
|
||||
if (sz > 3)
|
||||
{
|
||||
std::wstring s;
|
||||
std::wstring sheet = what[1].matched ? what[1].str() : L"";
|
||||
|
||||
std::wstring c1 = what[2].str();
|
||||
std::wstring c2 = what[3].str();
|
||||
|
||||
if ((0 == c1.find(L"KAVYCHKA")) && (c1.length() - 8 == c1.rfind(L"KAVYCHKA") ))
|
||||
{
|
||||
return c1;
|
||||
}
|
||||
else if (!c1.empty() || !c2.empty() || !sheet.empty())
|
||||
{
|
||||
XmlUtils::replace_all( sheet, L"!", L"");
|
||||
|
||||
if (isFindBaseCell_ && table_name_.empty() && !sheet.empty())
|
||||
{
|
||||
table_name_ = sheet + L".$A$1";
|
||||
}
|
||||
if (!sheet.empty() && (std::wstring::npos != c1.find(L"$"))) sheet = L"$" + sheet;
|
||||
|
||||
|
||||
s = sheet + L"." + c1 + (c2.empty() ? L"" : (L":" + sheet + L"." + c2)) + std::wstring(L"");
|
||||
}
|
||||
return s;
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::wstring c1 = what[1].str();
|
||||
const std::wstring c2 = what[2].str();
|
||||
|
||||
const std::wstring s = std::wstring(L"[.") + c1 + (c2.empty() ? L"" : (L":." + c2) ) + std::wstring(L"]");
|
||||
const std::wstring s = std::wstring(L".") + c1 + (c2.empty() ? L"" : (L":." + c2) );
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
return L"";
|
||||
|
||||
return L"";
|
||||
}
|
||||
|
||||
void oox2odf_converter::Impl::replace_named_formula(std::wstring & expr)
|
||||
@ -167,7 +311,6 @@ void oox2odf_converter::Impl::replace_named_formula(std::wstring & expr)
|
||||
isFindBaseCell_ = false;
|
||||
}
|
||||
|
||||
// Лист1!$A$1 -> $Лист1.$A$1
|
||||
void oox2odf_converter::Impl::replace_named_ref(std::wstring & expr)
|
||||
{
|
||||
table_name_.clear();
|
||||
@ -178,27 +321,22 @@ void oox2odf_converter::Impl::replace_named_ref(std::wstring & expr)
|
||||
replace_vertical(workstr);
|
||||
replace_semicolons(workstr);
|
||||
|
||||
std::wstring res1 = boost::regex_replace(
|
||||
workstr,
|
||||
boost::wregex(L"('.*?')|(\".*?\")"),
|
||||
&oox2odf_converter::Impl::convert_scobci, boost::match_default | boost::format_all);
|
||||
|
||||
std::vector<std::wstring> distance;
|
||||
|
||||
boost::algorithm::split(distance,workstr, boost::algorithm::is_any_of(L";"), boost::algorithm::token_compress_on);
|
||||
boost::algorithm::split(distance, res1, boost::algorithm::is_any_of(L";"), boost::algorithm::token_compress_on);
|
||||
|
||||
for (size_t i = 0; i < distance.size(); i++)
|
||||
{
|
||||
std::wstring &d = distance[i];
|
||||
|
||||
XmlUtils::replace_all( d, L"(", L"SCOBCAIN");
|
||||
XmlUtils::replace_all( d, L")", L"SCOBCAOUT");
|
||||
XmlUtils::replace_all( d, L" ", L"PROBEL");
|
||||
XmlUtils::replace_all( d, L"'", L"APOSTROF");
|
||||
XmlUtils::replace_all( d, L"\"", L"KAVYCHKA");
|
||||
|
||||
replace_cells_range(d);
|
||||
replace_cells_range(d, false);
|
||||
|
||||
XmlUtils::replace_all( d, L"SCOBCAIN", L"(");
|
||||
XmlUtils::replace_all( d, L"SCOBCAOUT", L")");
|
||||
XmlUtils::replace_all( d, L"PROBEL", L" ");
|
||||
XmlUtils::replace_all( d, L"APOSTROF", L"'");
|
||||
XmlUtils::replace_all( d, L"KAVYCHKA", L"\"");
|
||||
oox_replace_tmp_back(d);
|
||||
|
||||
out = out + d + std::wstring(L";");
|
||||
}
|
||||
@ -209,47 +347,11 @@ void oox2odf_converter::Impl::replace_named_ref(std::wstring & expr)
|
||||
|
||||
if (table_name_.empty() == false)
|
||||
{
|
||||
XmlUtils::replace_all( table_name_, L"SCOBCAIN", L"(");
|
||||
XmlUtils::replace_all( table_name_, L"SCOBCAOUT", L")");
|
||||
XmlUtils::replace_all( table_name_, L"PROBEL", L" ");
|
||||
XmlUtils::replace_all( table_name_, L"APOSTROF", L"'");
|
||||
XmlUtils::replace_all( table_name_, L"KAVYCHKA", L"\"");
|
||||
oox_replace_tmp_back(table_name_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
std::wstring replace_tilda_formater(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
return L";";
|
||||
else if (what[2].matched)
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
//else if (what[4].matched)
|
||||
// return what[4].str();
|
||||
else
|
||||
return L"";
|
||||
}
|
||||
|
||||
|
||||
std::wstring replace_semicolons_formater(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
return L";";
|
||||
else if (what[2].matched)
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
//else if (what[4].matched)
|
||||
// return what[4].str();
|
||||
else
|
||||
return L"";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TODO
|
||||
// заменить запятые на точки с запятой во всех вхождениях кроме находящихся в кавычках --*и в фигурных скобках*--
|
||||
@ -264,67 +366,8 @@ void oox2odf_converter::Impl::replace_semicolons(std::wstring& expr)
|
||||
boost::match_default | boost::format_all);
|
||||
expr = res;
|
||||
}
|
||||
namespace
|
||||
{
|
||||
|
||||
std::wstring replace_vertical_formater(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
{
|
||||
std::wstring inner = what[1].str();
|
||||
XmlUtils::replace_all( inner, L";", L"|");
|
||||
return L"{" + inner + L"}";
|
||||
}
|
||||
else if (what[2].matched)
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
|
||||
return L"";
|
||||
}
|
||||
std::wstring replace_space_formater(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
{
|
||||
std::wstring inner = what[1].str();
|
||||
XmlUtils::replace_all( inner, L",", L" ");
|
||||
return inner;
|
||||
}
|
||||
else if (what[2].matched)
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
|
||||
return L"";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
std::wstring forbidden_formulas1[] =
|
||||
{
|
||||
L"NULLFORMULA()"
|
||||
/*
|
||||
L"BETADIST",
|
||||
L"CEILING",
|
||||
L"FLOOR",
|
||||
L"RANK",
|
||||
L"ROUND",
|
||||
L"ROUNDDOWN",
|
||||
L"ROUNDUP",
|
||||
L"SUBTOTAL",
|
||||
L"FORMULA",
|
||||
L"ISREF"*/
|
||||
};
|
||||
|
||||
bool is_forbidden1(const std::wstring & formula)
|
||||
{
|
||||
for (size_t i = 0; i < 1; i++)
|
||||
{
|
||||
if (boost::algorithm::contains(formula, forbidden_formulas1[i]))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//void oox2odf_converter::Impl::split_(std::wstring& expr)
|
||||
//{
|
||||
// const std::wstring res = boost::regex_split(
|
||||
@ -355,47 +398,18 @@ void oox2odf_converter::Impl::replace_space(std::wstring& expr)
|
||||
expr = res;
|
||||
}
|
||||
|
||||
std::wstring replace_(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
{
|
||||
std::wstring inner = what[1].str();
|
||||
XmlUtils::replace_all( inner, L",", L" ");
|
||||
return inner;
|
||||
}
|
||||
else if (what[2].matched)
|
||||
return what[2].str();
|
||||
else if (what[3].matched)
|
||||
return what[3].str();
|
||||
|
||||
return L"";
|
||||
}
|
||||
std::wstring oox2odf_converter::Impl::convert_scobci(boost::wsmatch const & what)
|
||||
{
|
||||
if (what[1].matched)
|
||||
{
|
||||
std::wstring inner = what[1].str();
|
||||
XmlUtils::replace_all( inner, L"(", L"SCOBCAIN");
|
||||
XmlUtils::replace_all( inner, L")", L"SCOBCAOUT");
|
||||
|
||||
XmlUtils::replace_all( inner, L"[", L"KVADRATIN");
|
||||
XmlUtils::replace_all( inner, L"]", L"KVADRATOUT");
|
||||
|
||||
XmlUtils::replace_all( inner, L" ", L"PROBEL");
|
||||
XmlUtils::replace_all( inner, L"'", L"APOSTROF");
|
||||
oox_replace_tmp(inner);
|
||||
return inner;
|
||||
}
|
||||
else if (what[2].matched)
|
||||
{
|
||||
std::wstring inner = what[2].str();
|
||||
XmlUtils::replace_all( inner, L"(", L"SCOBCAIN");
|
||||
XmlUtils::replace_all( inner, L")", L"SCOBCAOUT");
|
||||
|
||||
XmlUtils::replace_all( inner, L"[", L"KVADRATIN");
|
||||
XmlUtils::replace_all( inner, L"]", L"KVADRATOUT");
|
||||
|
||||
XmlUtils::replace_all( inner, L" ", L"PROBEL");
|
||||
XmlUtils::replace_all( inner, L"\"", L"KAVYCHKA");
|
||||
oox_replace_tmp(inner);
|
||||
return inner;
|
||||
}
|
||||
else if (what[3].matched)
|
||||
@ -444,13 +458,13 @@ std::wstring oox2odf_converter::Impl::convert(const std::wstring& expr)
|
||||
if (is_forbidden1(expr))
|
||||
return L"NULLFORMULA";
|
||||
|
||||
std::wstring workstr = expr;
|
||||
std::wstring workstr = expr;
|
||||
replace_cells_range(workstr);
|
||||
replace_vertical(workstr);
|
||||
replace_semicolons(workstr);
|
||||
return workstr;
|
||||
}
|
||||
// of:=(Formula) -> (Formula)
|
||||
// (Formula) -> of:=(Formula)
|
||||
std::wstring oox2odf_converter::Impl::convert_formula(const std::wstring & expr)
|
||||
{
|
||||
std::wstring workstr = expr;
|
||||
@ -462,9 +476,13 @@ std::wstring oox2odf_converter::Impl::convert_formula(const std::wstring & expr)
|
||||
|
||||
std::wstring res = boost::regex_replace(
|
||||
res1,
|
||||
boost::wregex(L"(?!([a-zA-Z]+\\d*\\())(([a-zA-Z]+\\!)?\\$?[a-zA-Z]*\\$?\\d*(\\:\\$?[a-zA-Z]*\\$?\\d*){0,1})"),
|
||||
boost::wregex(L"(?!([\\w^0-9]+\\d*\\())(([\\w^0-9]+\\!)?\\$?[\\w^0-9]*\\$?\\d*(\\:\\$?[\\w^0-9]*\\$?\\d*){0,1})"),
|
||||
&oox2odf_converter::Impl::replace_arguments, boost::match_default | boost::format_all);
|
||||
|
||||
//SUBTOTAL(109,Expense31[Amount])
|
||||
XmlUtils::replace_all( res, L"[", L"KVADRATIN");
|
||||
XmlUtils::replace_all( res, L"]", L"KVADRATOUT");
|
||||
|
||||
if (res1 == res)
|
||||
{
|
||||
XmlUtils::replace_all( res1, L"KAVYCHKA", L"\""); //IMCONJUGATE_emb.xlsx
|
||||
@ -476,16 +494,7 @@ std::wstring oox2odf_converter::Impl::convert_formula(const std::wstring & expr)
|
||||
boost::match_default | boost::format_all);
|
||||
}
|
||||
|
||||
XmlUtils::replace_all( res, L"SCOBCAIN", L"(");
|
||||
XmlUtils::replace_all( res, L"SCOBCAOUT", L")");
|
||||
|
||||
XmlUtils::replace_all( res, L"KVADRATIN", L"[");
|
||||
XmlUtils::replace_all( res, L"KVADRATOUT", L"]");
|
||||
|
||||
|
||||
XmlUtils::replace_all( res, L"APOSTROF", L"'");
|
||||
|
||||
XmlUtils::replace_all( res, L"KAVYCHKA", L"\"");
|
||||
oox_replace_tmp_back(res);
|
||||
|
||||
replace_vertical(res);
|
||||
replace_semicolons(res);
|
||||
@ -494,17 +503,7 @@ std::wstring oox2odf_converter::Impl::convert_formula(const std::wstring & expr)
|
||||
|
||||
if (table_name_.empty() == false)
|
||||
{
|
||||
XmlUtils::replace_all( table_name_, L"SCOBCAIN", L"(");
|
||||
XmlUtils::replace_all( table_name_, L"SCOBCAOUT", L")");
|
||||
|
||||
XmlUtils::replace_all( table_name_, L"KVADRATIN", L"[");
|
||||
XmlUtils::replace_all( table_name_, L"KVADRATOUT", L"]");
|
||||
|
||||
|
||||
XmlUtils::replace_all( table_name_, L"APOSTROF", L"'");
|
||||
|
||||
XmlUtils::replace_all( table_name_, L"KAVYCHKA", L"\"");
|
||||
XmlUtils::replace_all( table_name_, L"PROBEL", L" ");
|
||||
oox_replace_tmp_back(table_name_);
|
||||
}
|
||||
|
||||
return std::wstring(L"of:=") + res;
|
||||
@ -533,12 +532,7 @@ std::wstring oox2odf_converter::Impl::convert_conditional_formula(const std::wst
|
||||
|
||||
}
|
||||
|
||||
XmlUtils::replace_all( res, L"SCOBCAIN", L"(");
|
||||
XmlUtils::replace_all( res, L"SCOBCAOUT", L")");
|
||||
|
||||
XmlUtils::replace_all( res, L"APOSTROF", L"'");
|
||||
|
||||
XmlUtils::replace_all( res, L"KAVYCHKA", L"\"");
|
||||
oox_replace_tmp_back( res);
|
||||
|
||||
replace_vertical(res);
|
||||
replace_semicolons(res);
|
||||
@ -654,8 +648,6 @@ std::wstring oox2odf_converter::get_table_name()
|
||||
{
|
||||
return impl_->table_name_;
|
||||
}
|
||||
|
||||
|
||||
std::wstring oox2odf_converter::convert_ref(std::wstring const & expr)
|
||||
{
|
||||
std::wstring workstr = expr;
|
||||
|
||||
@ -332,6 +332,7 @@ enum ElementType
|
||||
typeTableTableRowGroup,
|
||||
typeTableTableRowNoGroup,
|
||||
typeTableTableSource,
|
||||
typeTableTableProtection,
|
||||
|
||||
typeTableDataPilotTables,
|
||||
typeTableDataPilotTable,
|
||||
@ -454,6 +455,7 @@ enum ElementType
|
||||
typeDrawPolyline,
|
||||
typeDrawRegularPolyline,
|
||||
typeDrawPath,
|
||||
typeDrawContourPath,
|
||||
typeDrawCircle,
|
||||
typeDrawg,
|
||||
typeDrawPageThumbnail,
|
||||
|
||||
@ -43,7 +43,7 @@
|
||||
#include <boost/variant.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include "../../../../Common/DocxFormat/Source/XML/Utils.h"
|
||||
#include "../../../Common/DocxFormat/Source/XML/Utils.h"
|
||||
|
||||
namespace cpdoccore
|
||||
{
|
||||
|
||||
@ -155,12 +155,9 @@ docx_conversion_context::docx_conversion_context(odf_reader::odf_document * OdfD
|
||||
odf_document_ (OdfDocument)
|
||||
{
|
||||
streams_man_ = streams_man::create(temp_stream_);
|
||||
applicationFonts_ = NSFonts::NSApplication::Create();
|
||||
}
|
||||
docx_conversion_context::~docx_conversion_context()
|
||||
{
|
||||
if (applicationFonts_)
|
||||
delete applicationFonts_;
|
||||
}
|
||||
void docx_conversion_context::set_output_document(package::docx_document * document)
|
||||
{
|
||||
@ -168,8 +165,7 @@ void docx_conversion_context::set_output_document(package::docx_document * docum
|
||||
}
|
||||
void docx_conversion_context::set_font_directory(std::wstring pathFonts)
|
||||
{
|
||||
if (applicationFonts_)
|
||||
applicationFonts_->InitializeFromFolder(pathFonts);
|
||||
mediaitems_.set_font_directory(pathFonts);
|
||||
}
|
||||
std::wstring styles_map::get(const std::wstring & Name, odf_types::style_family::type Type)
|
||||
{
|
||||
@ -686,7 +682,7 @@ void docx_conversion_context::end_document()
|
||||
|
||||
output_document_->get_word_files().set_document ( package::simple_element::create(L"document.xml", document_xml_.str()) );
|
||||
output_document_->get_word_files().set_settings ( package::simple_element::create(L"settings.xml", dump_settings_document()));
|
||||
output_document_->get_word_files().set_media ( mediaitems_, applicationFonts_);
|
||||
output_document_->get_word_files().set_media ( mediaitems_);
|
||||
output_document_->get_word_files().set_comments ( comments_context_);
|
||||
output_document_->get_word_files().set_headers_footers( headers_footers_);
|
||||
|
||||
|
||||
@ -47,8 +47,6 @@
|
||||
#include "hyperlinks.h"
|
||||
#include "mediaitems.h"
|
||||
|
||||
#include "../../../DesktopEditor/graphics/pro/Fonts.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
|
||||
namespace odf_types
|
||||
@ -796,11 +794,10 @@ public:
|
||||
bool next_dump_page_properties_;
|
||||
bool next_dump_section_;
|
||||
|
||||
odf_reader::odf_document * root()
|
||||
odf_reader::odf_document *root()
|
||||
{
|
||||
return odf_document_;
|
||||
}
|
||||
|
||||
void start_document ();
|
||||
void end_document ();
|
||||
|
||||
@ -1000,7 +997,6 @@ private:
|
||||
|
||||
package::docx_document * output_document_;
|
||||
odf_reader::odf_document * odf_document_;
|
||||
NSFonts::IApplicationFonts * applicationFonts_;
|
||||
|
||||
std::vector<odf_reader::_property> settings_properties_;
|
||||
|
||||
|
||||
@ -147,11 +147,11 @@ void word_files::update_rels(docx_conversion_context & Context)
|
||||
Context.dump_notes (rels_files_.get_rel_file()->get_rels());
|
||||
}
|
||||
|
||||
void word_files::set_media(mediaitems & _Mediaitems, NSFonts::IApplicationFonts *pAppFonts)
|
||||
void word_files::set_media(mediaitems & _Mediaitems)
|
||||
{
|
||||
if (_Mediaitems.count_image + _Mediaitems.count_media > 0)
|
||||
{
|
||||
media_ = element_ptr( new media(_Mediaitems, pAppFonts) );
|
||||
media_ = element_ptr( new media(_Mediaitems, _Mediaitems.applicationFonts()) );
|
||||
}
|
||||
if (_Mediaitems.count_object > 0)
|
||||
{
|
||||
|
||||
@ -40,8 +40,6 @@
|
||||
#include "docx_content_type.h"
|
||||
#include "oox_package.h"
|
||||
|
||||
#include "../../../DesktopEditor/graphics/pro/Fonts.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
@ -139,7 +137,7 @@ public:
|
||||
void set_numbering (element_ptr Element);
|
||||
void set_settings (element_ptr Element);
|
||||
bool has_numbering ();
|
||||
void set_media (mediaitems & _Mediaitems, NSFonts::IApplicationFonts *pAppFonts);
|
||||
void set_media (mediaitems & mediaitems_);
|
||||
void set_headers_footers(headers_footers & HeadersFooters);
|
||||
void set_notes (notes_context & notesContext);
|
||||
void set_comments (comments_context & commentsContext);
|
||||
|
||||
@ -73,7 +73,8 @@ struct drawing_object_description
|
||||
_oox_fill fill_;
|
||||
|
||||
bool in_group_;
|
||||
|
||||
bool lined_;
|
||||
bool connector_;
|
||||
int shape_type_; //default - frame
|
||||
|
||||
std::vector<drawing_object_description> child_objects_;
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
|
||||
#include <float.h>
|
||||
|
||||
#include "../../DesktopEditor/graphics/pro/Fonts.h"
|
||||
#include "../../../DesktopEditor/graphics/pro/Fonts.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace utils {
|
||||
|
||||
@ -41,6 +41,7 @@
|
||||
|
||||
#include "../../DesktopEditor/common/Directory.h"
|
||||
#include "../../DesktopEditor/raster/ImageFileFormatChecker.h"
|
||||
#include "../../DesktopEditor/graphics/pro/Fonts.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
@ -74,7 +75,32 @@ mediaitems::item::item( std::wstring const & _href,
|
||||
count_add = 1;
|
||||
count_used = 0;
|
||||
}
|
||||
mediaitems::mediaitems(const std::wstring & odfPacket) : odf_packet_(odfPacket)
|
||||
{
|
||||
count_charts = 0;
|
||||
count_shape = 0;
|
||||
count_image = 0;
|
||||
count_tables = 0;
|
||||
count_media = 0;
|
||||
count_object = 0;
|
||||
count_audio = 0;
|
||||
count_video = 0;
|
||||
count_slide = 0;
|
||||
count_activeX = 0;
|
||||
count_control = 0;
|
||||
|
||||
applicationFonts_ = NSFonts::NSApplication::Create();
|
||||
}
|
||||
mediaitems::~mediaitems()
|
||||
{
|
||||
if (applicationFonts_)
|
||||
delete applicationFonts_;
|
||||
}
|
||||
void mediaitems::set_font_directory(std::wstring pathFonts)
|
||||
{
|
||||
if (applicationFonts_)
|
||||
applicationFonts_->InitializeFromFolder(pathFonts);
|
||||
}
|
||||
std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, bool & isInternal)
|
||||
{
|
||||
std::wstring ref;
|
||||
|
||||
@ -33,7 +33,12 @@
|
||||
|
||||
#include "oox_rels.h"
|
||||
|
||||
#include "../../../../Common/DocxFormat/Source/XML/Utils.h"
|
||||
#include "../../../Common/DocxFormat/Source/XML/Utils.h"
|
||||
|
||||
namespace NSFonts
|
||||
{
|
||||
class IApplicationFonts;
|
||||
}
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
@ -41,20 +46,8 @@ namespace oox {
|
||||
class mediaitems
|
||||
{
|
||||
public:
|
||||
mediaitems(const std::wstring & odfPacket) : odf_packet_(odfPacket)
|
||||
{
|
||||
count_charts = 0;
|
||||
count_shape = 0;
|
||||
count_image = 0;
|
||||
count_tables = 0;
|
||||
count_media = 0;
|
||||
count_object = 0;
|
||||
count_audio = 0;
|
||||
count_video = 0;
|
||||
count_slide = 0;
|
||||
count_activeX = 0;
|
||||
count_control = 0;
|
||||
}
|
||||
mediaitems(const std::wstring & odfPacket);
|
||||
virtual ~mediaitems();
|
||||
|
||||
struct item
|
||||
{
|
||||
@ -87,6 +80,9 @@ public:
|
||||
size_t count_activeX;
|
||||
size_t count_control;
|
||||
|
||||
void set_font_directory(std::wstring pathFonts);
|
||||
NSFonts::IApplicationFonts *applicationFonts() {return applicationFonts_;}
|
||||
|
||||
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);
|
||||
|
||||
@ -117,9 +113,9 @@ public:
|
||||
}
|
||||
static RelsType detectMediaType(const std::wstring & fileName)
|
||||
{
|
||||
int pos = fileName.rfind(L".");
|
||||
size_t pos = fileName.rfind(L".");
|
||||
|
||||
std::wstring sExt = (pos >=0 ? fileName.substr(pos + 1) : L"");
|
||||
std::wstring sExt = (pos != std::wstring::npos ? fileName.substr(pos + 1) : L"");
|
||||
|
||||
if (sExt.empty()) return typeMedia;
|
||||
|
||||
@ -147,6 +143,7 @@ private:
|
||||
items_array items_;
|
||||
std::wstring odf_packet_;
|
||||
|
||||
NSFonts::IApplicationFonts *applicationFonts_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -108,6 +108,11 @@ static const std::wstring _ooxShapeType[]=
|
||||
L"custGeom",//uses sub-sub type,
|
||||
L"polygon",
|
||||
L"roundRect",
|
||||
L"bentConnector3",
|
||||
L"curvedConnector3",
|
||||
L"",//3-D shape
|
||||
L"",
|
||||
L"polyline"
|
||||
};
|
||||
|
||||
|
||||
@ -243,16 +248,20 @@ void oox_serialize_aLst(std::wostream & strm, const std::vector<odf_reader::_pro
|
||||
{
|
||||
names.push_back(L"adj1");
|
||||
}
|
||||
else if (std::wstring::npos != shapeGeomPreset.find(L"decagon"))
|
||||
{
|
||||
names.push_back(L"vf");
|
||||
}
|
||||
else if (std::wstring::npos != shapeGeomPreset.find(L"heptagon") ||
|
||||
std::wstring::npos != shapeGeomPreset.find(L"pentagon"))
|
||||
std::wstring::npos != shapeGeomPreset.find(L"decagon"))
|
||||
{
|
||||
names.push_back(L"hf");
|
||||
names.push_back(L"vf");
|
||||
values.clear();
|
||||
}
|
||||
//else if (std::wstring::npos != shapeGeomPreset.find(L"decagon"))
|
||||
//{
|
||||
// names.push_back(L"vf");
|
||||
//}
|
||||
//else if (std::wstring::npos != shapeGeomPreset.find(L"pentagon"))
|
||||
//{
|
||||
// names.push_back(L"hf");
|
||||
// names.push_back(L"vf");
|
||||
//}
|
||||
else if (std::wstring::npos != shapeGeomPreset.find(L"hexagon"))
|
||||
{
|
||||
names.push_back(L"adj");
|
||||
@ -418,7 +427,7 @@ void _oox_drawing::serialize_shape(std::wostream & strm)
|
||||
shapeGeomPreset = L"rect";
|
||||
}
|
||||
}
|
||||
else if (sub_type < 10 && sub_type >= 0)
|
||||
else if (sub_type <= 14 && sub_type >= 0)
|
||||
{
|
||||
shapeGeomPreset = _ooxShapeType[sub_type]; //odf -> oox
|
||||
}
|
||||
@ -428,7 +437,7 @@ void _oox_drawing::serialize_shape(std::wostream & strm)
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
if (sub_type == 6 || sub_type == 8)
|
||||
if (sub_type == 6 || sub_type == 8 || sub_type == 14)
|
||||
{
|
||||
CP_XML_NODE(L"a:custGeom")
|
||||
{
|
||||
@ -487,7 +496,7 @@ void _oox_drawing::serialize_shape(std::wostream & strm)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bWordArt)
|
||||
if (bWordArt || lined)
|
||||
{
|
||||
_oox_fill no_fill;
|
||||
oox_serialize_fill(strm, no_fill);
|
||||
|
||||
@ -83,13 +83,15 @@ namespace oox {
|
||||
class _oox_drawing
|
||||
{
|
||||
public:
|
||||
_oox_drawing() : type(typeUnknown), id(0), x(0), y(0), cx(0), cy(0), sub_type(0), inGroup(false), name(L"object"), extExternal(false)
|
||||
_oox_drawing() : type(typeUnknown), id(0), x(0), y(0), cx(0), cy(0), sub_type(0), inGroup(false), lined(false), connector(false), name(L"object"), extExternal(false)
|
||||
{
|
||||
}
|
||||
RelsType type;
|
||||
|
||||
bool inGroup;
|
||||
size_t id;
|
||||
bool lined;
|
||||
bool connector;
|
||||
|
||||
std::wstring name;
|
||||
int sub_type; //odf
|
||||
|
||||
@ -37,9 +37,9 @@
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
oox_bitmap_fill::oox_bitmap_fill() : name_space(L"a"), bStretch(false), bCrop(false), bTile(false), isInternal(true)
|
||||
oox_bitmap_fill::oox_bitmap_fill() : name_space(L"a"), bStretch(false), bCrop(false), bTile(false), isInternal(true), bGrayscale(false)
|
||||
{
|
||||
memset(cropRect,0,sizeof(double)*4);
|
||||
memset(cropRect, 0, sizeof(double)*4);
|
||||
}
|
||||
|
||||
oox_bitmap_fill_ptr oox_bitmap_fill::create(){return boost::make_shared<oox_bitmap_fill>();}
|
||||
@ -189,7 +189,19 @@ void oox_serialize_bitmap_fill(std::wostream & strm, const _oox_fill & val, cons
|
||||
{
|
||||
CP_XML_ATTR2(ns_att + L"amt", (int)(*val.opacity * 1000));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (val.bitmap->bGrayscale)
|
||||
{
|
||||
CP_XML_NODE(ns + L":grayscl");
|
||||
}
|
||||
if (val.bitmap->luminance || val.bitmap->contrast)
|
||||
{
|
||||
CP_XML_NODE(ns + L":lum")
|
||||
{
|
||||
if (val.bitmap->luminance) CP_XML_ATTR2(L"bright", (int)(*val.bitmap->luminance * 1000));
|
||||
if (val.bitmap->contrast) CP_XML_ATTR2(L"contrast", (int)(*val.bitmap->contrast * 1000));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (val.bitmap->bCrop)
|
||||
{
|
||||
|
||||
@ -75,6 +75,10 @@ namespace oox {
|
||||
|
||||
_CP_OPT(int) dpi;
|
||||
_CP_OPT(bool) rotate;
|
||||
|
||||
bool bGrayscale;
|
||||
_CP_OPT(double) luminance;
|
||||
_CP_OPT(double) contrast;
|
||||
};
|
||||
/////////////////////////////////////////////////////////
|
||||
class oox_hatch_fill;
|
||||
|
||||
@ -79,14 +79,15 @@ static std::wstring get_mime_type(const std::wstring & extension)
|
||||
else if (L"wav" == extension) return L"audio/wav";
|
||||
else if (L"mp3" == extension) return L"audio/mpeg";
|
||||
else if (L"wma" == extension) return L"audio/x-ms-wma";
|
||||
else if (L"m4a" == extension) return L"audio/unknown";
|
||||
else if (L"m4a" == extension) return L"audio/m4a";
|
||||
|
||||
else if (L"avi" == extension) return L"video/x-msvideo";
|
||||
else if (L"wmv" == extension) return L"video/x-ms-wmv";
|
||||
else if (L"mov" == extension) return L"video/unknown";
|
||||
else if (L"mp4" == extension) return L"video/unknown";
|
||||
else if (L"m4v" == extension) return L"video/unknown";
|
||||
else if (L"mkv" == extension) return L"video/unknown";
|
||||
else if (L"mov" == extension) return L"video/mov";
|
||||
else if (L"mp4" == extension) return L"video/mp4";
|
||||
else if (L"m4v" == extension) return L"video/m4v";
|
||||
else if (L"mkv" == extension) return L"video/mkv";
|
||||
else if (L"webm" == extension) return L"video/webm";
|
||||
|
||||
else if (L"bin" == extension) return L"application/vnd.openxmlformats-officedocument.oleObject";
|
||||
else if (L"xlsx" == extension) return L"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
||||
|
||||
@ -45,8 +45,6 @@
|
||||
|
||||
#include "pptx_default_serializes.h"
|
||||
|
||||
#include "../../DesktopEditor/graphics/pro/Fonts.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
|
||||
namespace odf_reader
|
||||
@ -72,13 +70,10 @@ pptx_conversion_context::pptx_conversion_context( odf_reader::odf_document * odf
|
||||
,last_idx_placeHolder (1)
|
||||
,last_uniq_big_id (1)
|
||||
{
|
||||
applicationFonts_ = NSFonts::NSApplication::Create();
|
||||
}
|
||||
|
||||
pptx_conversion_context::~pptx_conversion_context()
|
||||
{
|
||||
if (applicationFonts_)
|
||||
delete applicationFonts_;
|
||||
}
|
||||
|
||||
void pptx_conversion_context::set_output_document(package::pptx_document * document)
|
||||
@ -88,8 +83,7 @@ void pptx_conversion_context::set_output_document(package::pptx_document * docum
|
||||
|
||||
void pptx_conversion_context::set_font_directory(std::wstring pathFonts)
|
||||
{
|
||||
if (applicationFonts_ )
|
||||
applicationFonts_->InitializeFromFolder(pathFonts);
|
||||
pptx_slide_context_.get_mediaitems().set_font_directory(pathFonts);
|
||||
}
|
||||
|
||||
void pptx_conversion_context::process_layouts()
|
||||
@ -333,7 +327,7 @@ void pptx_conversion_context::end_document()
|
||||
output_document_->get_ppt_files().set_presentation (presentation_);
|
||||
output_document_->get_ppt_files().set_comments (comments);
|
||||
output_document_->get_ppt_files().set_authors_comments (authors_comments_);
|
||||
output_document_->get_ppt_files().set_media (get_mediaitems(), applicationFonts_);
|
||||
output_document_->get_ppt_files().set_media (get_mediaitems());
|
||||
|
||||
output_document_->get_content_types_file().set_media(get_mediaitems());
|
||||
}
|
||||
|
||||
@ -157,7 +157,6 @@ private:
|
||||
|
||||
package::pptx_document * output_document_;
|
||||
odf_reader::odf_document * odf_document_;
|
||||
NSFonts::IApplicationFonts * applicationFonts_;
|
||||
|
||||
pptx_slide_context pptx_slide_context_;
|
||||
pptx_text_context pptx_text_context_;
|
||||
|
||||
@ -212,7 +212,7 @@ void pptx_serialize_shape(std::wostream & strm, _pptx_drawing & val)
|
||||
}
|
||||
CP_XML_NODE(L"p:cNvSpPr")//non visual properies (собственно тока 1 там)
|
||||
{
|
||||
if (val.sub_type==1 || val.sub_type==2)CP_XML_ATTR(L"txBox", 1);
|
||||
if (val.sub_type == 1 || val.sub_type == 2)CP_XML_ATTR(L"txBox", 1);
|
||||
CP_XML_NODE(L"a:spLocks")
|
||||
{
|
||||
CP_XML_ATTR(L"noGrp", 1);
|
||||
@ -254,7 +254,65 @@ void pptx_serialize_shape(std::wostream & strm, _pptx_drawing & val)
|
||||
}
|
||||
} // CP_XML_WRITER
|
||||
}
|
||||
void pptx_serialize_connector(std::wostream & strm, _pptx_drawing & val)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"p:cxnSp")
|
||||
{
|
||||
CP_XML_NODE(L"p:nvCxnSpPr")
|
||||
{
|
||||
CP_XML_NODE(L"p:cNvPr")
|
||||
{
|
||||
CP_XML_ATTR(L"id", val.id);//числовое значение val.rId
|
||||
CP_XML_ATTR(L"name", val.name);
|
||||
|
||||
oox_serialize_action(CP_XML_STREAM(), val.action);
|
||||
}
|
||||
CP_XML_NODE(L"p:cNvCxnSpPr")//non visual properies (собственно тока 1 там)
|
||||
{
|
||||
if (val.sub_type == 1 || val.sub_type == 2)CP_XML_ATTR(L"txBox", 1);
|
||||
CP_XML_NODE(L"a:spLocks")
|
||||
{
|
||||
CP_XML_ATTR(L"noGrp", 1);
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"p:nvPr")
|
||||
{
|
||||
if (val.place_holder_type_.length()>0)
|
||||
{
|
||||
CP_XML_NODE(L"p:ph")
|
||||
{
|
||||
CP_XML_ATTR(L"type",val.place_holder_type_);
|
||||
if (val.place_holder_idx_ > 0) CP_XML_ATTR(L"idx", val.place_holder_idx_);
|
||||
|
||||
if (val.place_holder_type_ == L"dt") { CP_XML_ATTR(L"sz", L"half"); }
|
||||
if (val.place_holder_type_ == L"ftr") { CP_XML_ATTR(L"sz", L"quarter"); }
|
||||
if (val.place_holder_type_ == L"sldNum"){ CP_XML_ATTR(L"sz", L"quarter"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"p:spPr")
|
||||
{
|
||||
_CP_OPT(bool) bNoRect;
|
||||
odf_reader::GetProperty(val.additional,L"no_rect",bNoRect);
|
||||
|
||||
if (!bNoRect)
|
||||
{
|
||||
if (val.cx != 0 || val.cy != 0) //layout
|
||||
{
|
||||
val.serialize_xfrm(CP_XML_STREAM(), L"a", true);
|
||||
}
|
||||
val.serialize_shape(CP_XML_STREAM());
|
||||
|
||||
oox_serialize_ln(CP_XML_STREAM(), val.additional);
|
||||
}
|
||||
}
|
||||
pptx_serialize_text(CP_XML_STREAM(), val);
|
||||
}
|
||||
} // CP_XML_WRITER
|
||||
}
|
||||
void pptx_serialize_chart(std::wostream & strm, _pptx_drawing & val)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
@ -381,7 +439,10 @@ void _pptx_drawing::serialize(std::wostream & strm)
|
||||
{
|
||||
if (type == typeShape)
|
||||
{
|
||||
pptx_serialize_shape(strm, *this);
|
||||
//if (connector) only for ms prst connectors, but not custom!!
|
||||
// pptx_serialize_connector(strm, *this);
|
||||
//else
|
||||
pptx_serialize_shape(strm, *this);
|
||||
}
|
||||
else if (type == typeImage)
|
||||
{
|
||||
|
||||
@ -509,11 +509,11 @@ void ppt_files::add_notesMaster(slide_content_ptr slide)
|
||||
{
|
||||
notesMaster_files_.add_slide(slide);
|
||||
}
|
||||
void ppt_files::set_media(mediaitems & _Mediaitems, NSFonts::IApplicationFonts *pAppFonts)
|
||||
void ppt_files::set_media(mediaitems & _Mediaitems)
|
||||
{
|
||||
if (_Mediaitems.count_image + _Mediaitems.count_media > 0)
|
||||
{
|
||||
media_ = element_ptr( new media(_Mediaitems, pAppFonts) );
|
||||
media_ = element_ptr( new media(_Mediaitems, _Mediaitems.applicationFonts()) );
|
||||
}
|
||||
if (_Mediaitems.count_object > 0)
|
||||
{
|
||||
|
||||
@ -217,7 +217,7 @@ public:
|
||||
void add_notes (slide_content_ptr sheet);
|
||||
void add_notesMaster(slide_content_ptr sheet);
|
||||
|
||||
void set_media(mediaitems & _Mediaitems, NSFonts::IApplicationFonts *pAppFonts);
|
||||
void set_media(mediaitems & _Mediaitems);
|
||||
void add_charts(chart_content_ptr chart);
|
||||
void add_theme (pptx_xml_theme_ptr theme);
|
||||
|
||||
|
||||
@ -147,11 +147,13 @@ void pptx_slide_context::Impl::process_drawings()
|
||||
{
|
||||
for (size_t i = 0; i < objects_.size(); i++)
|
||||
{
|
||||
_pptx_drawing drawing =_pptx_drawing();
|
||||
_pptx_drawing drawing = _pptx_drawing();
|
||||
|
||||
drawing.type = objects_[i].type_;
|
||||
drawing.name = objects_[i].name_;
|
||||
drawing.id = next_rId();
|
||||
drawing.type = objects_[i].type_;
|
||||
drawing.name = objects_[i].name_;
|
||||
drawing.id = next_rId();
|
||||
drawing.lined = objects_[i].lined_;
|
||||
drawing.connector = objects_[i].connector_;
|
||||
|
||||
process_common_properties(objects_[i], drawing);
|
||||
|
||||
@ -228,6 +230,8 @@ void pptx_slide_context::default_set()
|
||||
|
||||
impl_->object_description_.clipping_string_= L"";
|
||||
impl_->object_description_.svg_rect_ = boost::none;
|
||||
impl_->object_description_.connector_ = false;
|
||||
impl_->object_description_.lined_ = false;
|
||||
|
||||
impl_->object_description_.hlinks_.clear();
|
||||
impl_->object_description_.action_.clear();
|
||||
@ -288,7 +292,16 @@ void pptx_slide_context::set_translate(double x_pt, double y_pt)
|
||||
r.y += y_pt;
|
||||
}
|
||||
}
|
||||
|
||||
void pptx_slide_context::set_translate_rotate()
|
||||
{
|
||||
if (impl_->object_description_.svg_rect_)
|
||||
{
|
||||
_rect & r = impl_->object_description_.svg_rect_.get();
|
||||
|
||||
r.x -= r.cx / 2;
|
||||
r.y += r.cy / 2;
|
||||
}
|
||||
}
|
||||
void pptx_slide_context::set_scale(double cx_pt, double cy_pt)
|
||||
{
|
||||
if (impl_->object_description_.svg_rect_)
|
||||
@ -321,12 +334,18 @@ void pptx_slide_context::set_clipping(const std::wstring & str)
|
||||
{
|
||||
impl_->object_description_.clipping_string_= str;
|
||||
}
|
||||
|
||||
void pptx_slide_context::set_fill(_oox_fill & fill)
|
||||
{
|
||||
impl_->object_description_.fill_= fill;
|
||||
}
|
||||
|
||||
void pptx_slide_context::set_is_line_shape(bool val)
|
||||
{
|
||||
impl_->object_description_.lined_ = val;
|
||||
}
|
||||
void pptx_slide_context::set_is_connector_shape(bool val)
|
||||
{
|
||||
impl_->object_description_.connector_ = val;
|
||||
}
|
||||
std::wstring pptx_slide_context::add_hyperlink(std::wstring const & href)
|
||||
{
|
||||
++hlinks_size_;
|
||||
@ -472,8 +491,8 @@ void pptx_slide_context::set_media_param(std::wstring name, std::wstring value)
|
||||
|
||||
void pptx_slide_context::set_image(const std::wstring & path)
|
||||
{
|
||||
int pos_replaicement = path.find(L"ObjectReplacements");
|
||||
if (pos_replaicement >= 0)
|
||||
size_t pos_replaicement = path.find(L"ObjectReplacements");
|
||||
if (pos_replaicement != std::wstring::npos)
|
||||
{
|
||||
if (path.length() - (pos_replaicement + 18) < 2)
|
||||
return; //object without image
|
||||
@ -486,7 +505,7 @@ void pptx_slide_context::set_image(const std::wstring & path)
|
||||
}
|
||||
else if (impl_->use_image_replacement_)
|
||||
{
|
||||
impl_->object_description_.fill_.type = 2;
|
||||
impl_->object_description_.fill_.type = 2;
|
||||
impl_->object_description_.fill_.bitmap = oox::oox_bitmap_fill::create();
|
||||
impl_->object_description_.fill_.bitmap->xlink_href_ = path;
|
||||
impl_->object_description_.fill_.bitmap->bStretch = true;
|
||||
@ -538,8 +557,14 @@ void pptx_slide_context::Impl::process_image(drawing_object_description& obj, _p
|
||||
drawing.fill.bitmap = oox_bitmap_fill::create();
|
||||
drawing.fill.type = 2;
|
||||
|
||||
_CP_OPT(std::wstring) sTextContent;
|
||||
_CP_OPT(std::wstring) sTextContent, sColorMode;
|
||||
_CP_OPT(double) dLuminance, dContrast;
|
||||
|
||||
GetProperty(obj.additional_, L"text-content", sTextContent);
|
||||
GetProperty(obj.additional_, L"color-mode", sColorMode);
|
||||
GetProperty(obj.additional_, L"luminance", drawing.fill.bitmap->luminance);
|
||||
GetProperty(obj.additional_, L"contrast", drawing.fill.bitmap->contrast);
|
||||
|
||||
if (sTextContent)//в ms office на картинке нельзя сделать надпись - меняем тип на рект с заливкой картинкой
|
||||
{
|
||||
drawing.type = typeShape;
|
||||
@ -547,8 +572,11 @@ void pptx_slide_context::Impl::process_image(drawing_object_description& obj, _p
|
||||
}
|
||||
|
||||
std::wstring fileName = odfPacket_ + FILE_SEPARATOR_STR + obj.xlink_href_;
|
||||
drawing.fill.bitmap->bCrop = odf_reader::parse_clipping(obj.clipping_string_, fileName, drawing.fill.bitmap->cropRect, NULL);
|
||||
drawing.fill.bitmap->bCrop = odf_reader::parse_clipping(obj.clipping_string_, fileName, drawing.fill.bitmap->cropRect, get_mediaitems().applicationFonts());
|
||||
drawing.fill.bitmap->bStretch = true;
|
||||
|
||||
if ((sColorMode) && (*sColorMode == L"greyscale"))
|
||||
drawing.fill.bitmap->luminance = true;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
std::wstring ref;/// это ссылка на выходной внешний объект
|
||||
@ -626,25 +654,29 @@ void pptx_slide_context::Impl::process_shape(drawing_object_description & obj, _
|
||||
}
|
||||
void pptx_slide_context::Impl::process_object(drawing_object_description& obj, _pptx_drawing & drawing)
|
||||
{
|
||||
std::wstring ref;
|
||||
bool isMediaInternal = true;
|
||||
std::wstring ref, ref_image;
|
||||
bool isMediaInternal = true, isMediaInternal_image = true;
|
||||
|
||||
drawing.objectId = get_mediaitems().add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
|
||||
drawing.objectProgId = obj.descriptor_;
|
||||
|
||||
add_drawing(drawing, isMediaInternal, drawing.objectId, ref, drawing.type);
|
||||
|
||||
if (drawing.fill.bitmap)
|
||||
if (!drawing.fill.bitmap)
|
||||
{
|
||||
drawing.fill.bitmap->rId = get_mediaitems().add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
|
||||
drawing.fill.bitmap = oox::oox_bitmap_fill::create();
|
||||
drawing.fill.bitmap->xlink_href_ = L"zero.png";
|
||||
|
||||
add_additional_rels(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage);
|
||||
_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);
|
||||
add_additional_rels(isMediaInternal_image, drawing.fill.bitmap->rId, ref_image, typeImage);
|
||||
|
||||
add_drawing(drawing, isMediaInternal, drawing.objectId, ref, drawing.type);
|
||||
}
|
||||
void pptx_slide_context::Impl::process_media(drawing_object_description& obj, _pptx_drawing & drawing)
|
||||
{
|
||||
std::wstring ref;
|
||||
bool isMediaInternal = true;
|
||||
std::wstring ref, ref_image;
|
||||
bool isMediaInternal = true, isMediaInternal_image = true;
|
||||
|
||||
drawing.type = mediaitems::detectMediaType(obj.xlink_href_); //reset from Media to Audio, Video, ... QuickTime? AudioCD? ...
|
||||
|
||||
@ -652,15 +684,18 @@ void pptx_slide_context::Impl::process_media(drawing_object_description& obj, _p
|
||||
drawing.extId = L"ext" + drawing.objectId;
|
||||
drawing.extExternal = !isMediaInternal;
|
||||
|
||||
if (!drawing.fill.bitmap)
|
||||
{
|
||||
drawing.fill.bitmap = oox::oox_bitmap_fill::create();
|
||||
drawing.fill.bitmap->xlink_href_ = L"zero.png";
|
||||
|
||||
_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);
|
||||
add_additional_rels(isMediaInternal_image, drawing.fill.bitmap->rId, ref_image, typeImage);
|
||||
|
||||
add_drawing(drawing, false, drawing.objectId, L"NULL", drawing.type);
|
||||
add_additional_rels( isMediaInternal, drawing.extId, ref, typeMedia);
|
||||
|
||||
if (drawing.fill.bitmap)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
void pptx_slide_context::Impl::process_common_properties(drawing_object_description & pic, _pptx_drawing & drawing)
|
||||
{
|
||||
|
||||
@ -61,6 +61,7 @@ public:
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
void set_rect (double width_pt, double height_pt, double x_pt, double y_pt);
|
||||
|
||||
void set_translate_rotate();
|
||||
void set_translate (double x_pt, double y_pt);
|
||||
void set_scale (double cx_pt, double cy_pt);
|
||||
void set_rotate (double angle);
|
||||
@ -72,6 +73,9 @@ public:
|
||||
void set_clipping (const std::wstring & str );
|
||||
void set_fill (_oox_fill & fill);
|
||||
|
||||
void set_is_line_shape(bool val);
|
||||
void set_is_connector_shape(bool val);
|
||||
|
||||
void set_placeHolder_type (std::wstring typeHolder);
|
||||
void set_placeHolder_idx (int idx);
|
||||
|
||||
|
||||
@ -99,7 +99,6 @@ private:
|
||||
|
||||
odf_reader::odf_read_context & odf_context_ ;
|
||||
std::wstring hyperlink_hId;
|
||||
|
||||
|
||||
bool in_span;
|
||||
bool in_paragraph;
|
||||
@ -275,7 +274,7 @@ void pptx_text_context::Impl::ApplyTextProperties(std::wstring style_name, std::
|
||||
|
||||
void pptx_text_context::Impl::ApplyListProperties(odf_reader::paragraph_format_properties & propertiesOut, int Level)
|
||||
{
|
||||
if (Level <0)return;
|
||||
if (Level < 0)return;
|
||||
if (list_style_stack_.empty())return;
|
||||
|
||||
odf_reader::style_list_level_properties *list_properties= NULL;
|
||||
@ -362,7 +361,7 @@ void pptx_text_context::Impl::write_pPr(std::wostream & strm)
|
||||
{
|
||||
get_styles_context().start();
|
||||
|
||||
int level = list_style_stack_.size()-1;
|
||||
int level = list_style_stack_.size() - 1;
|
||||
|
||||
odf_reader::paragraph_format_properties paragraph_properties_;
|
||||
|
||||
@ -643,7 +642,7 @@ void pptx_text_context::Impl::start_list_item(bool restart)
|
||||
|
||||
void pptx_text_context::Impl::start_list(const std::wstring & StyleName, bool Continue)
|
||||
{
|
||||
if (paragraphs_cout_ > 0 && in_paragraph)
|
||||
if (paragraphs_cout_ > 0 && ( in_paragraph || list_style_stack_.empty()))
|
||||
{
|
||||
dump_paragraph();
|
||||
}
|
||||
|
||||
@ -36,8 +36,10 @@
|
||||
#include <vector>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <xml/simple_xml_writer.h>
|
||||
#include "../../../Common/DocxFormat/Source/XML/Utils.h"
|
||||
|
||||
#include "../formulasconvert/formulasconvert.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
@ -148,7 +150,10 @@ public:
|
||||
//CP_XML_ATTR(L"aboveAverage" , 0);
|
||||
if (c.rules[j].type == 1)
|
||||
{
|
||||
CP_XML_ATTR(L"type", *c.rules[j].formula_type);
|
||||
if (c.rules[j].formula_type)
|
||||
CP_XML_ATTR(L"type", *c.rules[j].formula_type);
|
||||
else
|
||||
CP_XML_ATTR(L"type", L"cellIs");
|
||||
if ((c.rules[j].formula) && (!c.rules[j].formula->empty()))
|
||||
{
|
||||
CP_XML_NODE(L"formula")
|
||||
@ -177,13 +182,11 @@ public:
|
||||
{
|
||||
c.rules[j].cfvo[k].serialize(CP_XML_STREAM());
|
||||
}
|
||||
if (c.rules[j].color.size() > 0)
|
||||
|
||||
CP_XML_NODE(L"color")
|
||||
{
|
||||
CP_XML_NODE(L"color")
|
||||
{
|
||||
CP_XML_ATTR(L"rgb", c.rules[j].color[0]);
|
||||
}
|
||||
}
|
||||
CP_XML_ATTR(L"rgb", !c.rules[j].color.empty() ? c.rules[j].color[0] : L"FF000000");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (c.rules[j].type == 3)
|
||||
@ -245,7 +248,7 @@ void xlsx_conditionalFormatting_context::add(std::wstring ref)
|
||||
formulasconvert::odf2oox_converter converter;
|
||||
impl_->conditionalFormattings_.push_back(conditionalFormatting());
|
||||
|
||||
impl_->conditionalFormattings_.back().ref = converter.convert_named_ref(ref, false, L";");
|
||||
impl_->conditionalFormattings_.back().ref = converter.convert_named_ref(ref, false, L" ");
|
||||
}
|
||||
|
||||
void xlsx_conditionalFormatting_context::add_rule(int type)
|
||||
@ -260,7 +263,21 @@ void xlsx_conditionalFormatting_context::set_formula(std::wstring f)
|
||||
int pos = -1;
|
||||
std::wstring val;
|
||||
|
||||
if ( 0 <= (pos = f.find(L"formula-is(")))
|
||||
if ( f == L"unique")
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"uniqueValues";
|
||||
impl_->conditionalFormattings_.back().rules.back().formula = L"0";
|
||||
}
|
||||
else if ( f == L"duplicate")
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"duplicateValues";
|
||||
impl_->conditionalFormattings_.back().rules.back().formula = L"0";
|
||||
}
|
||||
else if ( f == L"above-average")
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"aboveAverage";
|
||||
}
|
||||
else if ( 0 <= (pos = f.find(L"formula-is(")))
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"expression";
|
||||
val = f.substr(11, f.size() - 12);
|
||||
@ -292,6 +309,45 @@ void xlsx_conditionalFormatting_context::set_formula(std::wstring f)
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"duplicateValues";
|
||||
}
|
||||
else if (0 <= (pos = f.find(L"contains-text")))
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"containsText";
|
||||
|
||||
std::wstring text = f.substr(14, f.length() - 15);
|
||||
|
||||
if (std::wstring::npos != text.find(L"IF(") ||
|
||||
std::wstring::npos != text.find(L"AND(") ||
|
||||
std::wstring::npos != text.find(L"NOT(") ||
|
||||
std::wstring::npos != text.find(L"ISERROR(") ||
|
||||
std::wstring::npos != text.find(L"SEARCH("))
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().text = L"";
|
||||
impl_->conditionalFormattings_.back().rules.back().formula = converter.convert(text);
|
||||
}
|
||||
else if (std::wstring::npos != text.find(L"LEN(TRIM(") &&
|
||||
std::wstring::npos != text.find(L"=0"))
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().text = L"";
|
||||
impl_->conditionalFormattings_.back().rules.back().formula = L"0";
|
||||
}
|
||||
else
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().operator_ = L"containsText";
|
||||
if ( 0 == text.find(L"\"") && text.length() - 1 == text.rfind(L"\""))
|
||||
{
|
||||
text = text.substr(1, text.length() - 2);
|
||||
}
|
||||
std::wstring ref = impl_->conditionalFormattings_.back().ref;
|
||||
|
||||
size_t pos;
|
||||
if ((pos = ref.find(L":")) != std::wstring::npos)
|
||||
{
|
||||
ref = ref.substr(0, pos);
|
||||
}
|
||||
impl_->conditionalFormattings_.back().rules.back().text = text;
|
||||
impl_->conditionalFormattings_.back().rules.back().formula = L"NOT(ISERROR(SEARCH(\"" + text + L"\"," + ref + L")))";
|
||||
}
|
||||
}
|
||||
else if (0 <= (pos = f.find(L"top")))
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"top10";
|
||||
@ -302,14 +358,10 @@ void xlsx_conditionalFormatting_context::set_formula(std::wstring f)
|
||||
if (0 <= (pos = f.find(L"(")))
|
||||
{
|
||||
val = f.substr(pos + 1, f.length() - pos - 2);
|
||||
impl_->conditionalFormattings_.back().rules.back().rank = boost::lexical_cast<int>(val);
|
||||
if (!val.empty())
|
||||
impl_->conditionalFormattings_.back().rules.back().rank = boost::lexical_cast<int>(val);
|
||||
}
|
||||
}
|
||||
else if (0 <= (pos = f.find(L"contains-text")))
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"containsText";
|
||||
impl_->conditionalFormattings_.back().rules.back().text = f.substr(15, f.length() - 17);
|
||||
}
|
||||
else
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"cellIs";
|
||||
@ -361,6 +413,8 @@ void xlsx_conditionalFormatting_context::set_formula(std::wstring f)
|
||||
impl_->conditionalFormattings_.back().rules.back().operator_ = L"between";
|
||||
val = f.substr(8, f.length() - 9);
|
||||
|
||||
XmlUtils::replace_all(val, L"(", L"");
|
||||
XmlUtils::replace_all(val, L")", L"");
|
||||
if (0 <= (pos = val.find(L",")))
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula2 = converter.convert_named_expr( val.substr(pos + 1) );
|
||||
@ -398,7 +452,11 @@ void xlsx_conditionalFormatting_context::add_sfv(int type, std::wstring value)
|
||||
|
||||
impl_->conditionalFormattings_.back().rules.back().formula.reset();
|
||||
}
|
||||
else if (!value.empty()) cfvo.val = value;
|
||||
else
|
||||
{
|
||||
if (!value.empty()) cfvo.val = value;
|
||||
else cfvo.val = L"0";
|
||||
}
|
||||
|
||||
impl_->conditionalFormattings_.back().rules.back().cfvo.push_back(cfvo);
|
||||
}
|
||||
|
||||
@ -45,13 +45,6 @@ class xlsx_defined_names::Impl
|
||||
public:
|
||||
void add(std::wstring const & name, std::wstring const & ref, bool formula, int tableId)
|
||||
{
|
||||
int is_file_link = 0;
|
||||
|
||||
if (!formula)
|
||||
{
|
||||
if ((is_file_link = ref.find(L"\\")) >=0) return;
|
||||
if ((is_file_link = ref.find(L"/")) >=0) return;
|
||||
}
|
||||
formulasconvert::odf2oox_converter converter;
|
||||
std::wstring oox_ref;
|
||||
|
||||
@ -72,34 +65,31 @@ public:
|
||||
|
||||
void xlsx_serialize(std::wostream & _Wostream)
|
||||
{
|
||||
if (content_.size() > 0)
|
||||
if (content_.empty()) return;
|
||||
|
||||
CP_XML_WRITER(_Wostream)
|
||||
{
|
||||
CP_XML_WRITER(_Wostream)
|
||||
CP_XML_NODE(L"definedNames")
|
||||
{
|
||||
CP_XML_NODE(L"definedNames")
|
||||
for (size_t i = 0 ; i < content_.size(); i++)
|
||||
{
|
||||
for (size_t i = 0 ; i < content_.size(); i++)
|
||||
CP_XML_NODE(L"definedName")
|
||||
{
|
||||
CP_XML_NODE(L"definedName")
|
||||
{
|
||||
CP_XML_ATTR(L"name", content_[i].name);
|
||||
|
||||
if (content_[i].tableId >= 0)
|
||||
{
|
||||
CP_XML_ATTR(L"localSheetId", content_[i].tableId);
|
||||
}
|
||||
|
||||
int pos;
|
||||
if ( (pos = content_[i].ref.find(L"#REF!")) >= 0 )
|
||||
{
|
||||
CP_XML_ATTR(L"comment", content_[i].ref);
|
||||
CP_XML_CONTENT(L"#REF!");
|
||||
}
|
||||
else
|
||||
CP_XML_CONTENT(content_[i].ref);
|
||||
CP_XML_ATTR(L"name", content_[i].name);
|
||||
|
||||
if (content_[i].tableId >= 0)
|
||||
{
|
||||
CP_XML_ATTR(L"localSheetId", content_[i].tableId);
|
||||
}
|
||||
|
||||
if ( content_[i].ref.find(L"#REF!") != std::wstring::npos )
|
||||
{
|
||||
CP_XML_ATTR(L"comment", content_[i].ref);
|
||||
CP_XML_CONTENT(L"#REF!");
|
||||
}
|
||||
else
|
||||
CP_XML_CONTENT(content_[i].ref);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,7 +46,6 @@ namespace oox {
|
||||
xlsx_defined_names();
|
||||
~xlsx_defined_names();
|
||||
|
||||
public:
|
||||
void add(std::wstring const & name, std::wstring const & ref, bool formula, int tableId);
|
||||
void xlsx_serialize(std::wostream & _Wostream);
|
||||
|
||||
|
||||
@ -162,7 +162,7 @@ void xlsx_serialize_shape(std::wostream & strm, _xlsx_drawing & val)
|
||||
}
|
||||
CP_XML_NODE(L"xdr:cNvSpPr")//non visual properies (собственно тока 1 там)
|
||||
{
|
||||
if (val.sub_type==1)CP_XML_ATTR(L"txBox", 1);
|
||||
if (val.sub_type == 1)CP_XML_ATTR(L"txBox", 1);
|
||||
}
|
||||
} // xdr:nv_Pr
|
||||
CP_XML_NODE(L"xdr:spPr")
|
||||
@ -171,11 +171,7 @@ void xlsx_serialize_shape(std::wostream & strm, _xlsx_drawing & val)
|
||||
|
||||
val.serialize_shape(CP_XML_STREAM());
|
||||
|
||||
bool draw_always = false;
|
||||
if (val.sub_type == 5 || val.sub_type == 6)//line собственно ) - если ее нет - в свойствах будет
|
||||
draw_always = true;
|
||||
|
||||
oox_serialize_ln(CP_XML_STREAM(),val.additional, draw_always);
|
||||
oox_serialize_ln(CP_XML_STREAM(),val.additional, val.lined);
|
||||
} // xdr:spPr
|
||||
|
||||
xlsx_serialize_text(CP_XML_STREAM(), val);
|
||||
|
||||
@ -53,8 +53,7 @@ namespace oox {
|
||||
class xlsx_drawing_context_handle::Impl
|
||||
{
|
||||
public:
|
||||
Impl(mediaitems & items)
|
||||
: items_(items), next_rId_(1), next_drawing_id_(1)
|
||||
Impl(mediaitems & items) : items_(items), next_rId_(1), next_drawing_id_(1)
|
||||
{
|
||||
}
|
||||
|
||||
@ -162,6 +161,8 @@ void xlsx_drawing_context::clear()
|
||||
{
|
||||
impl_->object_description_.type_ = typeUnknown;
|
||||
impl_->object_description_.in_group_ = false;
|
||||
impl_->object_description_.lined_ = false;
|
||||
impl_->object_description_.connector_ = false;
|
||||
impl_->object_description_.xlink_href_ = L"";
|
||||
impl_->object_description_.name_ = L"";
|
||||
impl_->object_description_.anchor_ = L"";
|
||||
@ -202,20 +203,25 @@ void xlsx_drawing_context::end_group()
|
||||
{
|
||||
if (impl_->groups_.size() < 1) return;
|
||||
|
||||
_rect & group_rect = impl_->groups_.back()->svg_rect_.get();
|
||||
|
||||
group_rect.cy -= group_rect.y;
|
||||
group_rect.cx -= group_rect.x;
|
||||
|
||||
for (size_t i = 0; i < impl_->groups_.back()->child_objects_.size(); i++)
|
||||
if (impl_->groups_.back()->svg_rect_)
|
||||
{
|
||||
_rect & r = impl_->groups_.back()->child_objects_[i].svg_rect_.get();
|
||||
|
||||
r.y -= group_rect.y;
|
||||
r.x -= group_rect.x;
|
||||
_rect & group_rect = impl_->groups_.back()->svg_rect_.get();
|
||||
|
||||
group_rect.cy -= group_rect.y;
|
||||
group_rect.cx -= group_rect.x;
|
||||
|
||||
for (size_t i = 0; i < impl_->groups_.back()->child_objects_.size(); i++)
|
||||
{
|
||||
if (!impl_->groups_.back()->child_objects_[i].svg_rect_) continue;
|
||||
|
||||
_rect & r = impl_->groups_.back()->child_objects_[i].svg_rect_.get();
|
||||
|
||||
r.y -= group_rect.y;
|
||||
r.x -= group_rect.x;
|
||||
}
|
||||
}
|
||||
|
||||
if (impl_->groups_.back()->in_group_)
|
||||
if (impl_->groups_.back()->in_group_ && impl_->groups_.back()->svg_rect_)
|
||||
{
|
||||
_rect & objct_rect = impl_->groups_.back()->svg_rect_.get();
|
||||
|
||||
@ -251,7 +257,8 @@ void xlsx_drawing_context::start_drawing(std::wstring const & name)
|
||||
|
||||
void xlsx_drawing_context::end_drawing()
|
||||
{
|
||||
if (impl_->object_description_.in_group_)
|
||||
if (impl_->object_description_.in_group_ &&
|
||||
impl_->object_description_.svg_rect_)
|
||||
{
|
||||
_rect & objct_rect = impl_->object_description_.svg_rect_.get();
|
||||
_rect & group_rect = impl_->groups_.back()->svg_rect_.get();
|
||||
@ -533,8 +540,12 @@ void xlsx_drawing_context::process_image(drawing_object_description & obj, _xlsx
|
||||
drawing.fill.bitmap = oox_bitmap_fill::create();
|
||||
drawing.fill.type = 2;
|
||||
}
|
||||
_CP_OPT(std::wstring) sTextContent;
|
||||
GetProperty(obj.additional_,L"text-content",sTextContent);
|
||||
_CP_OPT(std::wstring) sTextContent, sColorMode;
|
||||
|
||||
GetProperty(obj.additional_, L"text-content", sTextContent);
|
||||
GetProperty(obj.additional_, L"color-mode", sColorMode);
|
||||
GetProperty(obj.additional_, L"luminance", drawing.fill.bitmap->luminance);
|
||||
GetProperty(obj.additional_, L"contrast", drawing.fill.bitmap->contrast);
|
||||
|
||||
if (sTextContent)//в ms office на картинке нельзя сделать надпись - меняем тип на рект с заливкой картинкой
|
||||
{
|
||||
@ -543,9 +554,12 @@ void xlsx_drawing_context::process_image(drawing_object_description & obj, _xlsx
|
||||
}
|
||||
std::wstring fileName = odf_packet_path_ + FILE_SEPARATOR_STR + obj.xlink_href_;
|
||||
|
||||
drawing.fill.bitmap->bCrop = odf_reader::parse_clipping(obj.clipping_string_, fileName, drawing.fill.bitmap->cropRect, NULL/*applicationFonts_*/);
|
||||
drawing.fill.bitmap->bCrop = odf_reader::parse_clipping(obj.clipping_string_, fileName, drawing.fill.bitmap->cropRect, impl_->get_mediaitems().applicationFonts());
|
||||
drawing.fill.bitmap->bStretch = true;
|
||||
|
||||
if ((sColorMode) && (*sColorMode == L"greyscale"))
|
||||
drawing.fill.bitmap->bGrayscale = true;
|
||||
|
||||
std::wstring ref;/// это ссылка на выходной внешний объект
|
||||
bool isMediaInternal = false;
|
||||
|
||||
@ -662,11 +676,13 @@ void xlsx_drawing_context::process_group_objects(std::vector<drawing_object_desc
|
||||
|
||||
_xlsx_drawing drawing =_xlsx_drawing();
|
||||
|
||||
drawing.type = obj.type_;
|
||||
drawing.name = obj.name_;
|
||||
drawing.fill = obj.fill_;
|
||||
drawing.inGroup = obj.in_group_;
|
||||
drawing.id = impl_->next_rId();
|
||||
drawing.type = obj.type_;
|
||||
drawing.name = obj.name_;
|
||||
drawing.fill = obj.fill_;
|
||||
drawing.inGroup = obj.in_group_;
|
||||
drawing.id = impl_->next_rId();
|
||||
drawing.lined = obj.lined_;
|
||||
drawing.connector = obj.connector_;
|
||||
|
||||
drawing.sub_type = obj.shape_type_;
|
||||
|
||||
@ -730,6 +746,14 @@ void xlsx_drawing_context::set_link(std::wstring link, RelsType typeRels)
|
||||
void xlsx_drawing_context::end_action()
|
||||
{
|
||||
}
|
||||
void xlsx_drawing_context::set_is_line_shape(bool val)
|
||||
{
|
||||
impl_->object_description_.lined_ = val;
|
||||
}
|
||||
void xlsx_drawing_context::set_is_connector_shape(bool val)
|
||||
{
|
||||
impl_->object_description_.connector_ = val;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -110,6 +110,9 @@ public:
|
||||
void set_clipping (const std::wstring & str );
|
||||
void set_fill (_oox_fill & fill);
|
||||
|
||||
void set_is_line_shape(bool val);
|
||||
void set_is_connector_shape(bool val);
|
||||
|
||||
std::vector<odf_reader::_property> & get_properties();
|
||||
|
||||
std::wstring add_hyperlink(std::wstring const & ref);
|
||||
|
||||
@ -41,8 +41,9 @@ namespace oox {
|
||||
class xlsx_xml_worksheet::Impl
|
||||
{
|
||||
public:
|
||||
Impl(std::wstring const & name) : name_(name){}
|
||||
Impl(std::wstring const & name, bool hidden) : name_(name), hidden_(hidden) {}
|
||||
std::wstring name_;
|
||||
bool hidden_;
|
||||
|
||||
std::wstringstream cols_;
|
||||
std::wstringstream sheetFormat_;
|
||||
@ -52,6 +53,7 @@ public:
|
||||
std::wstringstream hyperlinks_;
|
||||
std::wstringstream comments_;
|
||||
std::wstringstream sort_;
|
||||
std::wstringstream tableParts_;
|
||||
std::wstringstream autofilter_;
|
||||
std::wstringstream conditionalFormatting_;
|
||||
std::wstringstream picture_background_;
|
||||
@ -59,6 +61,7 @@ public:
|
||||
std::wstringstream ole_objects_;
|
||||
std::wstringstream page_props_;
|
||||
std::wstringstream controls_;
|
||||
std::wstringstream protection_;
|
||||
|
||||
rels sheet_rels_;
|
||||
|
||||
@ -76,14 +79,18 @@ std::wstring xlsx_xml_worksheet::name() const
|
||||
{
|
||||
return impl_->name_;
|
||||
}
|
||||
|
||||
xlsx_xml_worksheet_ptr xlsx_xml_worksheet::create(std::wstring const & name)
|
||||
bool xlsx_xml_worksheet::hidden() const
|
||||
{
|
||||
return boost::make_shared<xlsx_xml_worksheet>(name);
|
||||
return impl_->hidden_;
|
||||
}
|
||||
|
||||
xlsx_xml_worksheet::xlsx_xml_worksheet(std::wstring const & name)
|
||||
: impl_(new xlsx_xml_worksheet::Impl(name))
|
||||
xlsx_xml_worksheet_ptr xlsx_xml_worksheet::create(std::wstring const & name, bool hidden)
|
||||
{
|
||||
return boost::make_shared<xlsx_xml_worksheet>(name, hidden);
|
||||
}
|
||||
|
||||
xlsx_xml_worksheet::xlsx_xml_worksheet(std::wstring const & name, bool hidden)
|
||||
: impl_(new xlsx_xml_worksheet::Impl(name, hidden))
|
||||
{
|
||||
}
|
||||
|
||||
@ -99,16 +106,18 @@ std::wostream & xlsx_xml_worksheet::sheetFormat()
|
||||
{
|
||||
return impl_->sheetFormat_;
|
||||
}
|
||||
|
||||
std::wostream & xlsx_xml_worksheet::sheetData()
|
||||
{
|
||||
return impl_->sheetData_;
|
||||
}
|
||||
|
||||
std::wostream & xlsx_xml_worksheet::mergeCells()
|
||||
{
|
||||
return impl_->mergeCells_;
|
||||
}
|
||||
std::wostream & xlsx_xml_worksheet::tableParts()
|
||||
{
|
||||
return impl_->tableParts_;
|
||||
}
|
||||
std::wostream & xlsx_xml_worksheet::conditionalFormatting()
|
||||
{
|
||||
return impl_->conditionalFormatting_;
|
||||
@ -153,6 +162,10 @@ std::wostream & xlsx_xml_worksheet::dataValidations()
|
||||
{
|
||||
return impl_->dataValidations_;
|
||||
}
|
||||
std::wostream & xlsx_xml_worksheet::protection()
|
||||
{
|
||||
return impl_->protection_;
|
||||
}
|
||||
//---------------------------------------------------------------------------------------
|
||||
rels & xlsx_xml_worksheet::sheet_rels()
|
||||
{
|
||||
@ -181,6 +194,10 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
|
||||
{
|
||||
CP_XML_STREAM() << impl_->sheetData_.str();
|
||||
}
|
||||
if (!impl_->protection_.str().empty())
|
||||
{
|
||||
CP_XML_STREAM() << impl_->protection_.str();
|
||||
}
|
||||
//оказывается порядок нахождения элементов важен !!! (для office 2010)
|
||||
//объединенные ячейки раньше чем гиперлинки !!!
|
||||
|
||||
@ -200,7 +217,6 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
|
||||
CP_XML_STREAM() << impl_->hyperlinks_.str();
|
||||
}
|
||||
}
|
||||
|
||||
if (!impl_->page_props_.str().empty())
|
||||
{
|
||||
CP_XML_STREAM() << impl_->page_props_.str();
|
||||
@ -229,6 +245,13 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
|
||||
CP_XML_STREAM() << impl_->controls_.str();
|
||||
}
|
||||
}
|
||||
if (!impl_->tableParts_.str().empty())
|
||||
{
|
||||
CP_XML_NODE(L"tableParts")
|
||||
{
|
||||
CP_XML_STREAM() << impl_->tableParts_.str();
|
||||
}
|
||||
}
|
||||
CP_XML_STREAM() << impl_->picture_background_.str();
|
||||
|
||||
//CP_XML_NODE(L"headerFooter){}
|
||||
|
||||
@ -47,10 +47,11 @@ typedef _CP_PTR(xlsx_xml_worksheet) xlsx_xml_worksheet_ptr;
|
||||
class xlsx_xml_worksheet: noncopyable
|
||||
{
|
||||
public:
|
||||
xlsx_xml_worksheet(std::wstring const & name);
|
||||
xlsx_xml_worksheet(std::wstring const & name, bool hidden);
|
||||
~xlsx_xml_worksheet();
|
||||
|
||||
std::wstring name() const;
|
||||
bool hidden() const;
|
||||
|
||||
std::wostream & cols();
|
||||
std::wostream & sheetFormat();
|
||||
@ -60,6 +61,7 @@ public:
|
||||
std::wostream & drawing();
|
||||
std::wostream & comments();
|
||||
std::wostream & autofilter();
|
||||
std::wostream & tableParts();
|
||||
std::wostream & conditionalFormatting();
|
||||
std::wostream & picture_background();
|
||||
std::wostream & dataValidations();
|
||||
@ -67,6 +69,7 @@ public:
|
||||
std::wostream & ole_objects();
|
||||
std::wostream & page_properties();
|
||||
std::wostream & controls();
|
||||
std::wostream & protection();
|
||||
|
||||
rels & sheet_rels(); //hyperlink, background image, external, media ...
|
||||
|
||||
@ -80,7 +83,7 @@ public:
|
||||
std::pair<std::wstring, std::wstring> get_vml_drawing_link() const;
|
||||
std::pair<std::wstring, std::wstring> get_comments_link() const;
|
||||
|
||||
static xlsx_xml_worksheet_ptr create(std::wstring const & name);
|
||||
static xlsx_xml_worksheet_ptr create(std::wstring const & name, bool hidden);
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
|
||||
@ -88,7 +88,6 @@ void xlsx_document::write(const std::wstring & RootPath)
|
||||
pivot_cache_content::pivot_cache_content() : definitions_rels_file_(rels_file::create(L""))
|
||||
{
|
||||
}
|
||||
|
||||
_CP_PTR(pivot_cache_content) pivot_cache_content::create()
|
||||
{
|
||||
return boost::make_shared<pivot_cache_content>();
|
||||
@ -97,17 +96,23 @@ _CP_PTR(pivot_cache_content) pivot_cache_content::create()
|
||||
pivot_table_content::pivot_table_content() : rels_file_(rels_file::create(L""))
|
||||
{
|
||||
}
|
||||
|
||||
_CP_PTR(pivot_table_content) pivot_table_content::create()
|
||||
{
|
||||
return boost::make_shared<pivot_table_content>();
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------
|
||||
external_links_content::external_links_content() : rels_file_(rels_file::create(L""))
|
||||
{
|
||||
}
|
||||
_CP_PTR(external_links_content) external_links_content::create()
|
||||
{
|
||||
return boost::make_shared<external_links_content>();
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------
|
||||
sheet_content::sheet_content() : rels_(rels_file::create(L""))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
_CP_PTR(sheet_content) sheet_content::create()
|
||||
{
|
||||
return boost::make_shared<sheet_content>();
|
||||
@ -198,8 +203,11 @@ void xl_files::write(const std::wstring & RootPath)
|
||||
control_props_files_.set_main_document( this->get_main_document() );
|
||||
control_props_files_.write(path);
|
||||
}
|
||||
int index = 1;
|
||||
if (true)
|
||||
{
|
||||
external_links_files_.set_rels(&rels_files_);
|
||||
external_links_files_.set_main_document(get_main_document());
|
||||
external_links_files_.write(path);
|
||||
}
|
||||
{
|
||||
//workbook_->hyperlinks->write(path);
|
||||
rels_files_.add( relationship( L"hId1", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument", L"xl/workbook.xml" ) );
|
||||
@ -217,7 +225,6 @@ void xl_files::write(const std::wstring & RootPath)
|
||||
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
contentTypes->add_override(L"/xl/connections.xml", L"application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml");
|
||||
}
|
||||
|
||||
if (styles_)
|
||||
{
|
||||
styles_->write(path);
|
||||
@ -245,6 +252,11 @@ void xl_files::write(const std::wstring & RootPath)
|
||||
charts_files_.set_main_document(get_main_document());
|
||||
charts_files_.write(path);
|
||||
}
|
||||
{
|
||||
table_part_files_.set_main_document(get_main_document());
|
||||
table_part_files_.write(path);
|
||||
}
|
||||
|
||||
if (drawings_)
|
||||
{
|
||||
drawings_->set_main_document(get_main_document());
|
||||
@ -286,11 +298,11 @@ void xl_files::add_sheet(sheet_content_ptr sheet)
|
||||
sheets_files_.add_sheet(sheet);
|
||||
}
|
||||
|
||||
void xl_files::set_media(mediaitems & _Mediaitems, NSFonts::IApplicationFonts *pAppFonts)
|
||||
void xl_files::set_media(mediaitems & _Mediaitems)
|
||||
{
|
||||
if (_Mediaitems.count_image + _Mediaitems.count_media > 0)
|
||||
{
|
||||
media_ = element_ptr( new media(_Mediaitems, pAppFonts) );
|
||||
media_ = element_ptr( new media(_Mediaitems, _Mediaitems.applicationFonts()) );
|
||||
}
|
||||
|
||||
if (_Mediaitems.count_object > 0)
|
||||
@ -322,6 +334,10 @@ void xl_files::add_pivot_table(pivot_table_content_ptr pivot_table)
|
||||
{
|
||||
pivot_table_files_.add_pivot_table(pivot_table);
|
||||
}
|
||||
void xl_files::add_table_part(const std::wstring &content)
|
||||
{
|
||||
table_part_files_.add_table_part(content);
|
||||
}
|
||||
void xl_files::add_jsaProject(const std::string &content)
|
||||
{
|
||||
jsaProject_ = package::simple_element::create(L"jsaProject.bin", content);
|
||||
@ -330,6 +346,10 @@ void xl_files::add_control_props (simple_element_ptr element)
|
||||
{
|
||||
control_props_files_.add_control_props(element);
|
||||
}
|
||||
void xl_files::add_external_links(external_links_content_ptr content)
|
||||
{
|
||||
external_links_files_.add_external_links(content);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
void xl_pivot_cache_files::add_pivot_cache(pivot_cache_content_ptr pivot_cache)
|
||||
{
|
||||
@ -418,20 +438,80 @@ void xl_pivot_table_files::write(const std::wstring & RootPath)
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------
|
||||
void xl_external_links_files::add_external_links(external_links_content_ptr content)
|
||||
{
|
||||
external_links_.push_back(content);
|
||||
}
|
||||
void xl_external_links_files::write(const std::wstring & RootPath)
|
||||
{
|
||||
if (external_links_.empty()) return;
|
||||
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"externalLinks";
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
for (size_t i = 0; i < external_links_.size(); i++)
|
||||
{
|
||||
const std::wstring fileName = std::wstring(L"externalLink") + std::to_wstring(i + 1) + L".xml";
|
||||
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
|
||||
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml";
|
||||
contentTypes->add_override(std::wstring(L"/xl/externalLinks/") + fileName, kWSConType);
|
||||
|
||||
package::simple_element(fileName, external_links_[i]->content_.str()).write(path);
|
||||
|
||||
{
|
||||
rels_files relFiles;
|
||||
external_links_[i]->rels_file_->set_file_name(fileName + L".rels");
|
||||
|
||||
relFiles.add_rel_file(external_links_[i]->rels_file_);
|
||||
relFiles.write(path);
|
||||
}
|
||||
if (rels_)
|
||||
{
|
||||
static const std::wstring kWSRel = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink";
|
||||
const std::wstring fileRef = std::wstring(L"externalLinks/") + fileName;
|
||||
rels_->add(external_links_[i]->rId_, kWSRel, fileRef);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------
|
||||
void xl_table_part_files::add_table_part(const std::wstring & table_part)
|
||||
{
|
||||
table_parts_.push_back(table_part);
|
||||
}
|
||||
void xl_table_part_files::write(const std::wstring & RootPath)
|
||||
{
|
||||
if (table_parts_.empty()) return;
|
||||
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"tables";
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
for (size_t i = 0; i < table_parts_.size(); i++)
|
||||
{
|
||||
const std::wstring fileName = std::wstring(L"table") + std::to_wstring(i + 1) + L".xml";
|
||||
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
|
||||
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml";
|
||||
contentTypes->add_override(std::wstring(L"/xl/tables/") + fileName, kWSConType);
|
||||
|
||||
package::simple_element(fileName, table_parts_[i]).write(path);
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------
|
||||
void xl_charts_files::add_chart(chart_content_ptr chart)
|
||||
{
|
||||
charts_.push_back(chart);
|
||||
}
|
||||
void xl_charts_files::write(const std::wstring & RootPath)
|
||||
{
|
||||
if (charts_.empty()) return;
|
||||
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"charts";
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
size_t count = 0;
|
||||
|
||||
for (size_t i = 0; i < charts_.size(); i++)
|
||||
{
|
||||
count++;
|
||||
const std::wstring fileName = std::wstring(L"chart") + std::to_wstring(i + 1) + L".xml";
|
||||
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
|
||||
|
||||
|
||||
@ -72,6 +72,7 @@ typedef _CP_PTR(sheet_content) sheet_content_ptr;
|
||||
//------------------------------------------------------------------------
|
||||
class pivot_cache_content;
|
||||
typedef _CP_PTR(pivot_cache_content) pivot_cache_content_ptr;
|
||||
|
||||
class pivot_cache_content : boost::noncopyable
|
||||
{
|
||||
public:
|
||||
@ -94,6 +95,7 @@ private:
|
||||
//------------------------------------------------------------------------
|
||||
class pivot_table_content;
|
||||
typedef _CP_PTR(pivot_table_content) pivot_table_content_ptr;
|
||||
|
||||
class pivot_table_content : boost::noncopyable
|
||||
{
|
||||
public:
|
||||
@ -111,6 +113,28 @@ private:
|
||||
rels_file_ptr rels_file_;
|
||||
};
|
||||
//------------------------------------------------------------------------
|
||||
class external_links_content;
|
||||
typedef _CP_PTR(external_links_content) external_links_content_ptr;
|
||||
|
||||
class external_links_content : boost::noncopyable
|
||||
{
|
||||
public:
|
||||
external_links_content();
|
||||
static external_links_content_ptr create();
|
||||
|
||||
std::wstring & rId() { return rId_;}
|
||||
std::wostream & content() { return content_; }
|
||||
rels & get_rels() { return rels_file_->get_rels(); }
|
||||
|
||||
std::wstring str() { return content_.str(); }
|
||||
|
||||
friend class xl_external_links_files;
|
||||
private:
|
||||
std::wstringstream content_;
|
||||
rels_file_ptr rels_file_;
|
||||
std::wstring rId_;
|
||||
};
|
||||
//------------------------------------------------------------------------
|
||||
class sheets_files : public element
|
||||
{
|
||||
public:
|
||||
@ -131,7 +155,17 @@ public:
|
||||
|
||||
};
|
||||
|
||||
class xl_table_part_files : public element
|
||||
{
|
||||
public:
|
||||
xl_table_part_files(){}
|
||||
|
||||
void add_table_part(const std::wstring & table_part);
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
|
||||
std::vector<std::wstring> table_parts_;
|
||||
|
||||
};
|
||||
class xl_charts_files : public element
|
||||
{
|
||||
public:
|
||||
@ -143,7 +177,22 @@ public:
|
||||
std::vector<chart_content_ptr> charts_;
|
||||
|
||||
};
|
||||
|
||||
class xl_external_links_files : public element
|
||||
{
|
||||
public:
|
||||
xl_external_links_files(){}
|
||||
|
||||
void add_external_links(external_links_content_ptr content);
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
|
||||
void set_rels(rels_files * rels)
|
||||
{
|
||||
rels_ = rels;
|
||||
}
|
||||
private:
|
||||
std::vector<external_links_content_ptr> external_links_;
|
||||
rels_files * rels_;
|
||||
};
|
||||
class xl_pivot_table_files : public element
|
||||
{
|
||||
public:
|
||||
@ -235,7 +284,7 @@ public:
|
||||
void set_sharedStrings (element_ptr Element);
|
||||
void set_connections (element_ptr Element);
|
||||
void add_sheet (sheet_content_ptr sheet);
|
||||
void set_media (mediaitems & _Mediaitems, NSFonts::IApplicationFonts *pAppFonts);
|
||||
void set_media (mediaitems & _Mediaitems);
|
||||
void set_drawings (element_ptr Element);
|
||||
void set_vml_drawings (element_ptr Element);
|
||||
void set_comments (element_ptr Element);
|
||||
@ -244,6 +293,8 @@ public:
|
||||
void add_pivot_table (pivot_table_content_ptr table);
|
||||
void add_jsaProject (const std::string &content);
|
||||
void add_control_props (simple_element_ptr Element);
|
||||
void add_table_part (const std::wstring &content);
|
||||
void add_external_links (external_links_content_ptr content);
|
||||
|
||||
private:
|
||||
rels_files rels_files_;
|
||||
@ -252,7 +303,9 @@ private:
|
||||
xl_pivot_cache_files pivot_cache_files_;
|
||||
xl_pivot_table_files pivot_table_files_;
|
||||
xl_control_props_files control_props_files_;
|
||||
|
||||
xl_table_part_files table_part_files_;
|
||||
xl_external_links_files external_links_files_;
|
||||
|
||||
element_ptr theme_;
|
||||
element_ptr workbook_;
|
||||
|
||||
@ -277,7 +330,7 @@ public:
|
||||
|
||||
virtual content_types_file & get_content_types_file() { return content_type_file_; }
|
||||
xl_files & get_xl_files() { return xl_files_; }
|
||||
|
||||
rels_files & get_rels_files() { return rels_files_; }
|
||||
private:
|
||||
xlsx_content_types_file content_type_file_;
|
||||
xl_files xl_files_;
|
||||
|
||||
@ -302,12 +302,24 @@ void xlsx_pivots_context::Impl::calc_headers()
|
||||
|
||||
std::map<size_t, size_t>::iterator pFind;
|
||||
|
||||
//current_.bAxisCol = false;
|
||||
//current_.bAxisRow = false;
|
||||
|
||||
size_t min_col = 0xffffff, min_row = 0xffffff;
|
||||
size_t prev_col, prev_row;
|
||||
for (size_t i = 0; i < current_.headers.size(); i++)//("F18","F19","F23","G21","H21")
|
||||
{
|
||||
size_t row = 0, col = 0;
|
||||
oox::getCellAddressInv(current_.headers[i], col, row);
|
||||
|
||||
//if (i > 0)
|
||||
//{
|
||||
// if (col != prev_col)current_.bAxisCol = true;
|
||||
// if (row != prev_row)current_.bAxisRow = true;
|
||||
//}
|
||||
prev_col = col;
|
||||
prev_row = row;
|
||||
|
||||
if (col < min_col) min_col = col;
|
||||
if (row < min_row) min_row = row;
|
||||
|
||||
@ -578,11 +590,17 @@ void xlsx_pivots_context::Impl::sort_fields()
|
||||
i--;
|
||||
}
|
||||
}
|
||||
if ((bAddRepeateCol || (count_items_col == 0 && current_.bAxisCol))/* && bShowEmptyCol*/) ///* || (bEmptyColCache && current_.grand_total < 0)*/?? Financial Execution (template).ods
|
||||
bool data_col_repeate = false;
|
||||
if ((bAddRepeateRow || (count_items_row == 0 && current_.bAxisRow)) && (current_.grand_total == 1 || current_.grand_total == 3 || current_.data_on_row))/* && bShowEmptyRow*/
|
||||
{
|
||||
current_.row_fields.push_back(-2);
|
||||
data_col_repeate = true;
|
||||
}
|
||||
|
||||
if (!data_col_repeate && (bAddRepeateCol || (count_items_col == 0 && current_.bAxisCol)) && (current_.grand_total == 1 || current_.grand_total == 2 || current_.data_fields.size() > 1 ))/* && bShowEmptyCol*/ ///* || (bEmptyColCache && current_.grand_total < 0)*/?? Financial Execution (template).ods
|
||||
current_.col_fields.push_back(-2);
|
||||
|
||||
if ((bAddRepeateRow || (count_items_row == 0 && current_.bAxisRow))/* && bShowEmptyRow*/)
|
||||
current_.row_fields.push_back(-2);
|
||||
|
||||
}
|
||||
void xlsx_pivots_context::Impl::serialize_view(std::wostream & strm)
|
||||
{
|
||||
|
||||
@ -44,6 +44,7 @@
|
||||
|
||||
#include "../formulasconvert/formulasconvert.h"
|
||||
|
||||
#include "../../../OfficeCryptReader/source/CryptTransform.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
@ -81,8 +82,8 @@ void xlsx_data_range::serialize_sort (std::wostream & _Wostream)
|
||||
std::wstring ref1, ref2;
|
||||
size_t col_1, row_1, col_2, row_2;
|
||||
|
||||
int pos = ref.find(L":");
|
||||
if (pos >= 0)
|
||||
size_t pos = ref.find(L":");
|
||||
if (pos != std::wstring::npos)
|
||||
{
|
||||
ref1 = ref.substr(0, pos );
|
||||
ref2 = ref.substr(pos + 1);
|
||||
@ -134,10 +135,28 @@ xlsx_table_state::xlsx_table_state(xlsx_conversion_context * Context, std::wstri
|
||||
xlsx_comments_context_ (Context->get_comments_context_handle()),
|
||||
table_column_last_width_(0.0),
|
||||
in_cell(false),
|
||||
bEndTable(false)
|
||||
|
||||
bEndTable(false),
|
||||
bRTL(false),
|
||||
bHidden(false)
|
||||
{
|
||||
memset(&group_row_,0,sizeof(_group_row));
|
||||
odf_reader::style_table_properties * table_prop = NULL;
|
||||
odf_reader::style_instance * tableStyle = context_->root()->odf_context().styleContainer().style_by_name(table_style_, odf_types::style_family::Table, false);
|
||||
|
||||
if ((tableStyle) && (tableStyle->content()))
|
||||
table_prop = tableStyle->content()->get_style_table_properties();
|
||||
|
||||
if (table_prop)
|
||||
{
|
||||
if (table_prop->content().common_writing_mode_attlist_.style_writing_mode_)
|
||||
{
|
||||
if (table_prop->content().common_writing_mode_attlist_.style_writing_mode_->get_type() == odf_types::writing_mode::RlTb)
|
||||
bRTL = true;
|
||||
}
|
||||
if ((table_prop->content().table_display_) && (false == table_prop->content().table_display_))
|
||||
{
|
||||
bHidden = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void xlsx_table_state::start_column(unsigned int repeated, const std::wstring & defaultCellStyleName)
|
||||
@ -149,6 +168,31 @@ void xlsx_table_state::start_column(unsigned int repeated, const std::wstring &
|
||||
columns_.push_back(repeated);
|
||||
}
|
||||
|
||||
void xlsx_table_state::set_rtl(bool val)
|
||||
{
|
||||
bRTL = val;
|
||||
}
|
||||
|
||||
void xlsx_table_state::set_protection(bool val, const std::wstring &key, const std::wstring &algorithm)
|
||||
{
|
||||
bProtected = val;
|
||||
protect_key = key;
|
||||
|
||||
size_t pos = algorithm.find(L"#");
|
||||
if (pos != std::wstring::npos)
|
||||
{
|
||||
protect_key_algorithm = algorithm.substr(pos + 1);
|
||||
}
|
||||
|
||||
//test
|
||||
//CRYPT::odfWriteProtect protect;
|
||||
//protect.SetProtectKey(DecodeBase64(protect_key));
|
||||
//protect.SetPassword(L"123");
|
||||
|
||||
//bool res = protect.Verify();
|
||||
|
||||
}
|
||||
|
||||
unsigned int xlsx_table_state::columns_count() const
|
||||
{
|
||||
return columns_count_;
|
||||
@ -224,10 +268,10 @@ void xlsx_table_state::start_cell(size_t columnsSpanned, size_t rowsSpanned)
|
||||
xlsx_merge_cells_.add_merge(current_table_column_, current_table_row_, columnsSpanned, rowsSpanned);
|
||||
}
|
||||
|
||||
if ( current_columns_spaned() > 0 )
|
||||
{
|
||||
_CP_LOG << L"[warning] current columns spanned > 0\n";
|
||||
}
|
||||
//if ( current_columns_spaned() > 0 )
|
||||
//{
|
||||
// _CP_LOG << L"[warning] current columns spanned > 0\n";
|
||||
//}
|
||||
|
||||
columns_spanned_num_ = static_cast<int>(columnsSpanned);
|
||||
|
||||
@ -247,10 +291,10 @@ void xlsx_table_state::start_cell(size_t columnsSpanned, size_t rowsSpanned)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rows_spanned_[current_table_column_].num() > 0)
|
||||
{
|
||||
_CP_LOG << L"[warning] current rows spanned > 0\n";
|
||||
}
|
||||
//if (rows_spanned_[current_table_column_].num() > 0)
|
||||
//{
|
||||
// _CP_LOG << L"[warning] current rows spanned > 0\n";
|
||||
//}
|
||||
rows_spanned_[current_table_column_].num(static_cast<unsigned int>(rowsSpanned));
|
||||
rows_spanned_[current_table_column_].column_spanned(static_cast<unsigned int>(columnsSpanned));
|
||||
for (size_t i = 0; i <= columns_spanned_num_; ++i)
|
||||
@ -373,6 +417,21 @@ void xlsx_table_state::serialize_background (std::wostream & strm)
|
||||
}
|
||||
}
|
||||
}
|
||||
void xlsx_table_state::serialize_protection (std::wostream & strm)
|
||||
{
|
||||
if (!bProtected) return;
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"sheetProtection")
|
||||
{
|
||||
CP_XML_ATTR(L"sheet", 1);
|
||||
CP_XML_ATTR(L"objects", 1);
|
||||
CP_XML_ATTR(L"scenarios", 1);
|
||||
//convert protection odf->ooxml impossible without password !!!
|
||||
}
|
||||
}
|
||||
}
|
||||
void xlsx_table_state::serialize_table_format (std::wostream & strm)
|
||||
{
|
||||
odf_reader::odf_read_context & odfContext = context_->root()->odf_context();
|
||||
@ -421,6 +480,9 @@ void xlsx_table_state::serialize_table_format (std::wostream & strm)
|
||||
{
|
||||
CP_XML_ATTR(L"workbookViewId", 0);
|
||||
|
||||
if (bRTL)
|
||||
CP_XML_ATTR(L"rightToLeft", 1);
|
||||
|
||||
std::wstring s_col, s_row;
|
||||
for (int i = 0; i < odfContext.Settings().get_table_view_count(0, tableName_); i++)
|
||||
{
|
||||
@ -458,7 +520,6 @@ void xlsx_table_state::serialize_table_format (std::wostream & strm)
|
||||
}
|
||||
}
|
||||
// -showRowColHeaders
|
||||
// -rightToLeft
|
||||
}
|
||||
|
||||
double default_height = (2 * context_->getMaxDigitSize().second * 72. / 96. * 100.) /100.;//in point size.
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include "xlsx_row_spanned.h"
|
||||
#include "xlsx_merge_cells.h"
|
||||
@ -53,19 +54,20 @@ typedef _CP_PTR(xlsx_table_state) xlsx_table_state_ptr;
|
||||
class xlsx_data_range;
|
||||
typedef _CP_PTR(xlsx_data_range) xlsx_data_range_ptr;
|
||||
|
||||
|
||||
class xlsx_data_range
|
||||
{
|
||||
public:
|
||||
xlsx_data_range() : byRow(true), filter(false), withHeader(false), cell_start(0,0), cell_end(0,0) {}
|
||||
xlsx_data_range() : byRow(true), filter(false), bTablePart(true), withHeader(false), cell_start(0,0), cell_end(0,0) {}
|
||||
|
||||
std::wstring table_name;
|
||||
std::wstring name;
|
||||
|
||||
std::wstring ref;
|
||||
|
||||
std::pair<int, int> cell_start;
|
||||
std::pair<int, int> cell_end;
|
||||
|
||||
bool bTablePart;
|
||||
bool byRow;
|
||||
bool filter;
|
||||
bool withHeader;
|
||||
@ -74,6 +76,46 @@ public:
|
||||
|
||||
void serialize_sort (std::wostream & _Wostream);
|
||||
void serialize_autofilter (std::wostream & _Wostream);
|
||||
|
||||
std::vector<std::wstring> header_values;
|
||||
|
||||
void set_header(size_t row, size_t col1, size_t col2)
|
||||
{
|
||||
row_header = row;
|
||||
start_column_header = col1;
|
||||
end_column_header = col2;
|
||||
|
||||
for (size_t i = start_column_header; i <= end_column_header; i++)
|
||||
header_values.push_back(L"");
|
||||
}
|
||||
void set_header_value(size_t col, size_t row, const std::wstring& value)
|
||||
{
|
||||
while (col - start_column_header + 1 >= header_values.size())
|
||||
header_values.push_back(L"");
|
||||
|
||||
std::map<std::wstring, int>::iterator pFind = map_unique_header_values.find(value);
|
||||
if (pFind == map_unique_header_values.end())
|
||||
{
|
||||
map_unique_header_values.insert(std::make_pair(value, 1));
|
||||
header_values[col - start_column_header] = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
pFind->second++;
|
||||
header_values[col - start_column_header] = value + std::to_wstring(pFind->second);
|
||||
}
|
||||
}
|
||||
bool in_header(size_t col, size_t row)
|
||||
{
|
||||
return (row_header == row && (col >= start_column_header && col <= end_column_header));
|
||||
}
|
||||
|
||||
private:
|
||||
size_t row_header;
|
||||
size_t start_column_header;
|
||||
size_t end_column_header;
|
||||
|
||||
std::map<std::wstring, int> map_unique_header_values;
|
||||
};
|
||||
|
||||
class xlsx_table_state
|
||||
@ -82,7 +124,10 @@ public:
|
||||
xlsx_table_state(xlsx_conversion_context * Context, std::wstring styleName, std::wstring tableName, int tableId);
|
||||
|
||||
std::wstring current_style() const { return table_style_; }
|
||||
|
||||
|
||||
void set_rtl(bool val);
|
||||
void set_protection(bool val, const std::wstring &key, const std::wstring &algorithm);
|
||||
|
||||
void start_column (unsigned int repeated, const std::wstring & defaultCellStyleName);
|
||||
void start_row (const std::wstring & StyleName, const std::wstring & defaultCellStyleName);
|
||||
|
||||
@ -138,28 +183,36 @@ public:
|
||||
void serialize_ole_objects (std::wostream & _Wostream);
|
||||
void serialize_page_properties (std::wostream & _Wostream);
|
||||
void serialize_background (std::wostream & _Wostream);
|
||||
void serialize_protection (std::wostream & _Wostream);
|
||||
|
||||
void dump_rels_hyperlinks (rels & Rels);
|
||||
void dump_rels_ole_objects (rels & Rels);
|
||||
|
||||
std::wstring get_table_name() const { return tableName_; }
|
||||
int get_table_id() const { return tableId_; }
|
||||
bool get_table_hidden() const { return bHidden; }
|
||||
|
||||
struct _group_row
|
||||
{
|
||||
bool enabled;
|
||||
int count;
|
||||
int level;
|
||||
bool collapsed;
|
||||
bool enabled = false;
|
||||
int count = 0;
|
||||
int level = 0;
|
||||
bool collapsed = false;
|
||||
}group_row_;
|
||||
|
||||
friend class xlsx_conversion_context;
|
||||
friend class xlsx_table_context;
|
||||
|
||||
private:
|
||||
bool bEndTable;
|
||||
xlsx_conversion_context * context_;
|
||||
|
||||
bool bProtected;
|
||||
std::wstring protect_key;
|
||||
std::wstring protect_key_algorithm;
|
||||
bool bRTL;
|
||||
bool bEndTable;
|
||||
bool bHidden;
|
||||
|
||||
std::wstring tableName_;
|
||||
int tableId_;
|
||||
std::wstring tableBackground_;
|
||||
|
||||
@ -60,23 +60,20 @@ xlsx_table_state_ptr xlsx_table_context::state()
|
||||
return xlsx_table_state_ptr();
|
||||
}
|
||||
|
||||
void xlsx_table_context::start_database_range(std::wstring tableName, std::wstring ref)
|
||||
bool xlsx_table_context::start_database_range(const std::wstring & name, const std::wstring & ref)
|
||||
{
|
||||
formulasconvert::odf2oox_converter convert;
|
||||
ref = convert.convert_named_ref(ref);
|
||||
std::wstring oox_ref = convert.convert_named_ref(ref);
|
||||
|
||||
std::wstring ref1, ref2;
|
||||
int pos = ref.find(L":");
|
||||
size_t pos = oox_ref.find(L":");
|
||||
|
||||
std::wstring xlsx_table_name;
|
||||
|
||||
if (pos >= 0)
|
||||
if (pos != std::wstring::npos)
|
||||
{
|
||||
xlsx_data_ranges_.push_back(xlsx_data_range_ptr(new xlsx_data_range()));
|
||||
xlsx_data_ranges_.back()->table_name = tableName;
|
||||
|
||||
ref1 = ref.substr(0, pos );
|
||||
ref2 = ref.substr(pos + 1);
|
||||
ref1 = oox_ref.substr(0, pos );
|
||||
ref2 = oox_ref.substr(pos + 1);
|
||||
|
||||
pos = ref1.find(L"!");
|
||||
if (pos > 0)
|
||||
@ -88,23 +85,33 @@ void xlsx_table_context::start_database_range(std::wstring tableName, std::wstri
|
||||
pos = ref2.find(L"!");
|
||||
if (pos > 0) ref2 = ref2.substr(pos + 1);
|
||||
|
||||
xlsx_data_ranges_.back()->ref = ref1 + L":" + ref2;
|
||||
|
||||
size_t col, row;
|
||||
size_t col1, col2, row1, row2;
|
||||
|
||||
getCellAddressInv(ref1, col, row);
|
||||
xlsx_data_ranges_.back()->cell_start = std::pair<int, int>(col,row);
|
||||
XmlUtils::replace_all( xlsx_table_name, L"'", L"");
|
||||
|
||||
getCellAddressInv(ref2, col, row);
|
||||
xlsx_data_ranges_.back()->cell_end = std::pair<int, int>(col,row);
|
||||
getCellAddressInv(ref1, col1, row1);
|
||||
getCellAddressInv(ref2, col2, row2);
|
||||
|
||||
xlsx_data_ranges_.push_back(xlsx_data_range_ptr(new xlsx_data_range()));
|
||||
|
||||
if (/*name.find(L"__Anonymous_Sheet_DB__") != std::wstring::npos ||*/ col1 == col2)
|
||||
{//check range in pivots
|
||||
xlsx_data_ranges_.back()->bTablePart = false;
|
||||
}
|
||||
xlsx_data_ranges_.back()->name = name;
|
||||
xlsx_data_ranges_.back()->table_name = xlsx_table_name;
|
||||
xlsx_data_ranges_.back()->ref = ref1 + L":" + ref2;
|
||||
xlsx_data_ranges_.back()->cell_start = std::pair<int, int>(col1, row1);
|
||||
xlsx_data_ranges_.back()->cell_end = std::pair<int, int>(col2, row2);
|
||||
|
||||
xlsx_data_ranges_.back()->set_header(row1, col1, col2);
|
||||
}
|
||||
|
||||
if (!xlsx_table_name.empty())
|
||||
{
|
||||
XmlUtils::replace_all( xlsx_table_name, L"'", L"");
|
||||
xlsx_data_ranges_map_.insert(std::pair<std::wstring, int> (xlsx_table_name, xlsx_data_ranges_.size() - 1));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
void xlsx_table_context::set_database_orientation (bool val)
|
||||
{
|
||||
@ -128,6 +135,63 @@ 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 > xlsx_data_ranges_.size()) return;
|
||||
|
||||
size_t col = state()->current_column();
|
||||
size_t row = state()->current_row();
|
||||
|
||||
xlsx_data_ranges_[index]->set_header_value(col, row, value);
|
||||
}
|
||||
void xlsx_table_context::check_database_range_intersection(const std::wstring& table_name, const std::wstring& ref)
|
||||
{
|
||||
std::wstring ref1, ref2;
|
||||
size_t col_1, row_1, col_2, row_2;
|
||||
|
||||
size_t pos = ref.find(L":");
|
||||
if (pos != std::wstring::npos)
|
||||
{
|
||||
ref1 = ref.substr(0, pos );
|
||||
ref2 = ref.substr(pos + 1);
|
||||
}
|
||||
getCellAddressInv(ref1, col_1, row_1);
|
||||
getCellAddressInv(ref2, col_2, row_2);
|
||||
|
||||
for (size_t i = 0; i < xlsx_data_ranges_.size(); i++)
|
||||
{
|
||||
if (xlsx_data_ranges_[i]->table_name != table_name) continue;
|
||||
|
||||
//if ( xlsx_data_ranges_[i]->cell_start.second < row_2 || xlsx_data_ranges_[i]->cell_end.second > row_1
|
||||
// || xlsx_data_ranges_[i]->cell_end.first < col_1 || xlsx_data_ranges_[i]->cell_start.first > col_2 )
|
||||
|
||||
if (((col_1 <= xlsx_data_ranges_[i]->cell_start.first && xlsx_data_ranges_[i]->cell_start.first <= col_2) ||
|
||||
(xlsx_data_ranges_[i]->cell_start.first <= col_1 && col_1 <= xlsx_data_ranges_[i]->cell_end.first))
|
||||
&&
|
||||
(( row_1 <= xlsx_data_ranges_[i]->cell_start.second && xlsx_data_ranges_[i]->cell_start.second <= row_2) ||
|
||||
(xlsx_data_ranges_[i]->cell_start.second <= row_1 && row_1 <= xlsx_data_ranges_[i]->cell_end.second )))
|
||||
{
|
||||
xlsx_data_ranges_[i]->bTablePart = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
int xlsx_table_context::in_database_range()
|
||||
{
|
||||
int col = state()->current_column();
|
||||
int row = state()->current_row();
|
||||
|
||||
for (size_t i = 0; i < xlsx_data_ranges_.size(); i++)
|
||||
{
|
||||
if (xlsx_data_ranges_[i]->table_name != state()->get_table_name()) continue;
|
||||
|
||||
if (/*(xlsx_data_ranges_values_[i]->withHeader || xlsx_data_ranges_values_[i]->filter)&& */
|
||||
xlsx_data_ranges_[i]->in_header(col, row))
|
||||
{
|
||||
return (int)i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
void xlsx_table_context::add_database_sort(int field_number, int order)
|
||||
{
|
||||
xlsx_data_ranges_.back()->bySort.push_back(std::pair<int, bool>(field_number, order == 1 ? false : true ));
|
||||
@ -140,17 +204,19 @@ xlsx_text_context_(textContext)
|
||||
{
|
||||
}
|
||||
|
||||
void xlsx_table_context::start_table(std::wstring tableName, std::wstring tableStyleName, int id)
|
||||
void xlsx_table_context::start_table(const std::wstring & tableName, const std::wstring & tableStyleName, int id)
|
||||
{
|
||||
xlsx_table_state_ptr state = boost::make_shared<xlsx_table_state>(xlsx_conversion_context_, tableStyleName, tableName, id);
|
||||
xlsx_table_states_.push_back( state);
|
||||
}
|
||||
|
||||
void xlsx_table_context::set_protection(bool val, const std::wstring &key, const std::wstring &algorithm)
|
||||
{
|
||||
xlsx_table_states_.back()->set_protection(val, key, algorithm);
|
||||
}
|
||||
void xlsx_table_context::end_table()
|
||||
{
|
||||
//xlsx_table_states_.pop_back();
|
||||
}
|
||||
|
||||
}
|
||||
void xlsx_table_context::start_cell(const std::wstring & formula, size_t columnsSpanned, size_t rowsSpanned)
|
||||
{
|
||||
state()->start_cell(columnsSpanned, rowsSpanned);
|
||||
@ -255,9 +321,90 @@ void xlsx_table_context::serialize_sort(std::wostream & _Wostream)
|
||||
|
||||
for (std::multimap<std::wstring, int>::iterator it = range.first; it != range.second; ++it)
|
||||
{
|
||||
if (xlsx_data_ranges_[it->second]->bTablePart) continue;
|
||||
|
||||
xlsx_data_ranges_[it->second]->serialize_sort(_Wostream);
|
||||
}
|
||||
}
|
||||
void xlsx_table_context::serialize_tableParts(std::wostream & _Wostream, rels & Rels)
|
||||
{
|
||||
if (xlsx_data_ranges_.empty()) return;
|
||||
|
||||
std::pair<std::multimap<std::wstring, int>::iterator, std::multimap<std::wstring, int>::iterator> range;
|
||||
|
||||
range = xlsx_data_ranges_map_.equal_range(state()->get_table_name());
|
||||
|
||||
for (std::multimap<std::wstring, int>::iterator it = range.first; it != range.second; ++it)
|
||||
{
|
||||
if (false == xlsx_data_ranges_[it->second]->bTablePart) continue;
|
||||
|
||||
size_t id = xlsx_conversion_context_->get_table_parts_size() + 1;
|
||||
|
||||
std::wstring rId = L"tprtId" + std::to_wstring(id);
|
||||
std::wstring ref = L"../tables/table" + std::to_wstring(id) + L".xml";
|
||||
|
||||
CP_XML_WRITER(_Wostream)
|
||||
{
|
||||
CP_XML_NODE(L"tablePart")
|
||||
{
|
||||
CP_XML_ATTR(L"r:id", rId);
|
||||
}
|
||||
}
|
||||
Rels.add( relationship(rId, L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/table", ref));
|
||||
|
||||
std::wstringstream strm;
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"table")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
||||
|
||||
CP_XML_ATTR(L"id", id);
|
||||
CP_XML_ATTR(L"name", xlsx_data_ranges_[it->second]->name);
|
||||
CP_XML_ATTR(L"displayName", xlsx_data_ranges_[it->second]->name);
|
||||
CP_XML_ATTR(L"ref", xlsx_data_ranges_[it->second]->ref);
|
||||
|
||||
if (xlsx_data_ranges_[it->second]->withHeader == false &&
|
||||
xlsx_data_ranges_[it->second]->filter == false)
|
||||
CP_XML_ATTR(L"headerRowCount", 0);
|
||||
|
||||
//CP_XML_ATTR(L"totalsRowCount", 0);
|
||||
CP_XML_ATTR(L"totalsRowShown", 0);
|
||||
|
||||
xlsx_data_ranges_[it->second]->serialize_autofilter(CP_XML_STREAM());
|
||||
xlsx_data_ranges_[it->second]->serialize_sort(CP_XML_STREAM());
|
||||
|
||||
CP_XML_NODE(L"tableColumns")
|
||||
{
|
||||
CP_XML_ATTR(L"count", xlsx_data_ranges_[it->second]->cell_end.first -
|
||||
xlsx_data_ranges_[it->second]->cell_start.first + 1);
|
||||
|
||||
for (int id = 0, i = xlsx_data_ranges_[it->second]->cell_start.first; i <= xlsx_data_ranges_[it->second]->cell_end.first; i++, id++)
|
||||
{
|
||||
CP_XML_NODE(L"tableColumn")
|
||||
{
|
||||
std::wstring column_name = xlsx_data_ranges_[it->second]->header_values[id];
|
||||
if (column_name.empty())
|
||||
{
|
||||
column_name = L"Column_" + std::to_wstring(id + 1);
|
||||
}
|
||||
CP_XML_ATTR(L"id", id + 1);
|
||||
CP_XML_ATTR(L"name", column_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"tableStyleInfo")
|
||||
{
|
||||
CP_XML_ATTR(L"showFirstColumn", 0);
|
||||
CP_XML_ATTR(L"showLastColumn", 0);
|
||||
CP_XML_ATTR(L"showRowStripes", 1);
|
||||
CP_XML_ATTR(L"showColumnStripes", 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
xlsx_conversion_context_->add_table_part(strm.str());
|
||||
}
|
||||
}
|
||||
void xlsx_table_context::serialize_autofilter(std::wostream & _Wostream)
|
||||
{
|
||||
if (xlsx_data_ranges_.empty()) return;
|
||||
@ -273,6 +420,8 @@ void xlsx_table_context::serialize_autofilter(std::wostream & _Wostream)
|
||||
|
||||
for (std::multimap<std::wstring, int>::iterator it = range.first; it != range.second; ++it)
|
||||
{
|
||||
if (xlsx_data_ranges_[it->second]->bTablePart) continue;
|
||||
|
||||
if (xlsx_data_ranges_[it->second]->filter)
|
||||
{
|
||||
if (cell_start.first < 0 || xlsx_data_ranges_[it->second]->cell_start.first < cell_start.first )
|
||||
@ -298,12 +447,16 @@ void xlsx_table_context::serialize_autofilter(std::wostream & _Wostream)
|
||||
{
|
||||
CP_XML_NODE(L"autoFilter")
|
||||
{
|
||||
//в автофильтре тока простые диапазоны .. для сложных нужно выделять tablePart - todooo
|
||||
//в автофильтре тока простые диапазоны .. для сложных - tablePart
|
||||
CP_XML_ATTR(L"ref", getCellAddress(cell_start.first, cell_start.second) + L":" + getCellAddress(cell_end.first, cell_end.second));
|
||||
//CP_XML_ATTR(L"ref", ref);
|
||||
}
|
||||
}
|
||||
}
|
||||
void xlsx_table_context::serialize_protection(std::wostream & _Wostream)
|
||||
{
|
||||
return state()->serialize_protection(_Wostream);
|
||||
}
|
||||
void xlsx_table_context::serialize_conditionalFormatting(std::wostream & _Wostream)
|
||||
{
|
||||
return state()->serialize_conditionalFormatting(_Wostream);
|
||||
|
||||
@ -48,7 +48,8 @@ class xlsx_table_context
|
||||
public:
|
||||
xlsx_table_context(xlsx_conversion_context * Context, xlsx_text_context & textCotnext);
|
||||
|
||||
void start_table(std::wstring tableName, std::wstring tableStyleName, int id);
|
||||
void start_table(const std::wstring &tableName, const std::wstring & tableStyleName, int id);
|
||||
void set_protection(bool val, const std::wstring &key, const std::wstring &algorithm);
|
||||
void end_table();
|
||||
|
||||
void start_cell(const std::wstring & formula,
|
||||
@ -82,6 +83,7 @@ public:
|
||||
|
||||
unsigned int columns_count();
|
||||
|
||||
void serialize_tableParts (std::wostream & _Wostream, rels & Rels);
|
||||
void serialize_sort (std::wostream & _Wostream);
|
||||
void serialize_autofilter (std::wostream & _Wostream);
|
||||
void serialize_merge_cells (std::wostream & _Wostream);
|
||||
@ -93,6 +95,7 @@ public:
|
||||
void serialize_page_properties (std::wostream & _Wostream);
|
||||
void serialize_background (std::wostream & _Wostream);
|
||||
void serialize_data_validation (std::wostream & _Wostream);
|
||||
void serialize_protection (std::wostream & _Wostream);
|
||||
|
||||
xlsx_table_metrics & get_table_metrics();
|
||||
|
||||
@ -111,23 +114,25 @@ public:
|
||||
void dump_rels_hyperlinks (rels & Rels);
|
||||
void dump_rels_ole_objects (rels & Rels);
|
||||
|
||||
void start_database_range(std::wstring table_name, std::wstring ref);
|
||||
bool start_database_range(const std::wstring &table_name, const std::wstring &ref);
|
||||
void set_database_orientation (bool val);
|
||||
void set_database_header (bool val);
|
||||
void set_database_filter (bool val);
|
||||
|
||||
void add_database_sort (int field_number, int order);
|
||||
void add_database_sort (int field_number, int order);
|
||||
void end_database_range();
|
||||
|
||||
|
||||
int in_database_range();
|
||||
void set_database_range_value(int index, const std::wstring& value);
|
||||
void check_database_range_intersection(const std::wstring& table_name, const std::wstring& ref);
|
||||
|
||||
private:
|
||||
xlsx_conversion_context *xlsx_conversion_context_;
|
||||
xlsx_text_context &xlsx_text_context_;
|
||||
|
||||
std::vector<xlsx_table_state_ptr> xlsx_table_states_;
|
||||
std::vector<xlsx_data_range_ptr> xlsx_data_ranges_;
|
||||
std::vector<xlsx_table_state_ptr> xlsx_table_states_;
|
||||
std::vector<xlsx_data_range_ptr> xlsx_data_ranges_;
|
||||
|
||||
std::multimap<std::wstring, int> xlsx_data_ranges_map_;
|
||||
std::multimap<std::wstring, int> xlsx_data_ranges_map_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -45,7 +45,6 @@
|
||||
#include "../odf/odfcontext.h"
|
||||
#include "../odf/calcs_styles.h"
|
||||
|
||||
#include "../../DesktopEditor/graphics/pro/Fonts.h"
|
||||
|
||||
|
||||
namespace cpdoccore {
|
||||
@ -71,14 +70,15 @@ xlsx_conversion_context::xlsx_conversion_context(odf_reader::odf_document * odfD
|
||||
math_context_ (odf_document_->odf_context().fontContainer(), true),
|
||||
xlsx_style_ (this),
|
||||
|
||||
maxDigitSize_ (std::pair<float,float>(-1.0, -1.0) ),
|
||||
maxDigitSize_ (std::make_pair(-1.f, -1.f) ),
|
||||
default_style_ ( (std::numeric_limits<size_t>::max)() ),
|
||||
mediaitems_ (odf_document_->get_folder()),
|
||||
xlsx_drawing_context_handle_(mediaitems_)
|
||||
{
|
||||
applicationFonts_ = NSFonts::NSApplication::Create();
|
||||
}
|
||||
|
||||
std::unordered_map<std::wstring, int> xlsx_conversion_context::mapExternalLink_;
|
||||
|
||||
void xlsx_conversion_context::set_output_document (package::xlsx_document * document)
|
||||
{
|
||||
output_document_ = document;
|
||||
@ -86,15 +86,11 @@ void xlsx_conversion_context::set_output_document (package::xlsx_document * docu
|
||||
|
||||
xlsx_conversion_context::~xlsx_conversion_context()
|
||||
{
|
||||
if (applicationFonts_)
|
||||
delete applicationFonts_;
|
||||
}
|
||||
|
||||
void xlsx_conversion_context::set_font_directory(std::wstring pathFonts)
|
||||
{
|
||||
if (applicationFonts_ == NULL) return;
|
||||
|
||||
applicationFonts_->InitializeFromFolder(pathFonts);
|
||||
mediaitems_.set_font_directory(pathFonts);
|
||||
}
|
||||
|
||||
void xlsx_conversion_context::start_chart(std::wstring name)
|
||||
@ -182,7 +178,7 @@ void xlsx_conversion_context::end_document()
|
||||
{
|
||||
CP_XML_ATTR(L"name", sheet->name()); // office 2010 ! ограничение на длину имени !!!
|
||||
CP_XML_ATTR(L"sheetId", i + 1);
|
||||
CP_XML_ATTR(L"state", L"visible");
|
||||
CP_XML_ATTR(L"state", sheet->hidden() ? L"hidden" : L"visible");
|
||||
CP_XML_ATTR(L"r:id", id);
|
||||
}
|
||||
}
|
||||
@ -201,6 +197,10 @@ void xlsx_conversion_context::end_document()
|
||||
|
||||
output_document_->get_xl_files().add_charts(content);
|
||||
}
|
||||
for (size_t i = 0; i < table_parts_.size(); i++)
|
||||
{
|
||||
output_document_->get_xl_files().add_table_part(table_parts_[i]);
|
||||
}
|
||||
//workbook_content << L"<calcPr iterateCount=\"100\" refMode=\"A1\" iterate=\"false\" iterateDelta=\"0.0001\" />";
|
||||
|
||||
{
|
||||
@ -231,7 +231,41 @@ void xlsx_conversion_context::end_document()
|
||||
{
|
||||
CP_XML_STREAM() << workbook_content.str();
|
||||
}
|
||||
if (false == mapExternalLink_.empty())
|
||||
{
|
||||
CP_XML_NODE(L"externalReferences")
|
||||
{
|
||||
for (std::unordered_map<std::wstring, int>::iterator it = mapExternalLink_.begin();
|
||||
it != mapExternalLink_.end(); ++it)
|
||||
{
|
||||
package::external_links_content_ptr content = package::external_links_content::create();
|
||||
content->rId() = L"extRef" + std::to_wstring(it->second);
|
||||
{
|
||||
CP_XML_WRITER(content->content())
|
||||
{
|
||||
CP_XML_NODE(L"externalLink")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
||||
CP_XML_NODE(L"externalBook")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
|
||||
CP_XML_ATTR(L"r:id", L"rId1");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
content->get_rels().add(relationship(L"rId1", mediaitems::get_rel_type(typeExternalLink), it->first, L"External"));
|
||||
|
||||
output_document_->get_xl_files().add_external_links(content);
|
||||
|
||||
CP_XML_NODE(L"externalReference")
|
||||
{
|
||||
CP_XML_ATTR(L"r:id", content->rId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
get_xlsx_defined_names().xlsx_serialize(CP_XML_STREAM());
|
||||
|
||||
int pivot_cache_count = xlsx_pivots_context_.get_count();
|
||||
@ -287,7 +321,7 @@ void xlsx_conversion_context::end_document()
|
||||
output_document_->get_xl_files().set_workbook( package::simple_element::create(L"workbook.xml", strm_workbook.str()) );
|
||||
|
||||
output_document_->get_content_types_file().set_media(get_mediaitems());
|
||||
output_document_->get_xl_files().set_media(get_mediaitems(), applicationFonts_);
|
||||
output_document_->get_xl_files().set_media(get_mediaitems());
|
||||
|
||||
package::xl_drawings_ptr drawings = package::xl_drawings::create(xlsx_drawing_context_handle_.content());
|
||||
output_document_->get_xl_files().set_drawings(drawings);
|
||||
@ -392,15 +426,12 @@ int xlsx_conversion_context::find_sheet_by_name(std::wstring tableName)
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
void xlsx_conversion_context::create_new_sheet(std::wstring const & name)
|
||||
{
|
||||
sheets_.push_back(xlsx_xml_worksheet::create(name));
|
||||
}
|
||||
|
||||
bool xlsx_conversion_context::start_table(std::wstring tableName, std::wstring tableStyleName)
|
||||
{
|
||||
create_new_sheet(tableName);
|
||||
get_table_context().start_table(tableName, tableStyleName, sheets_.size() - 1);
|
||||
|
||||
sheets_.push_back(xlsx_xml_worksheet::create(tableName, get_table_context().state()->get_table_hidden()));
|
||||
current_sheet().cols() << L"<cols>";
|
||||
return true;
|
||||
}
|
||||
@ -436,11 +467,13 @@ void xlsx_conversion_context::end_table()
|
||||
get_table_context().serialize_table_format (current_sheet().sheetFormat());
|
||||
get_table_context().serialize_page_properties (current_sheet().page_properties());
|
||||
get_table_context().serialize_conditionalFormatting (current_sheet().conditionalFormatting());
|
||||
get_table_context().serialize_tableParts (current_sheet().tableParts(), current_sheet().sheet_rels());
|
||||
get_table_context().serialize_autofilter (current_sheet().autofilter());
|
||||
get_table_context().serialize_sort (current_sheet().sort());
|
||||
get_table_context().serialize_merge_cells (current_sheet().mergeCells());
|
||||
get_table_context().serialize_data_validation (current_sheet().dataValidations());
|
||||
|
||||
get_table_context().serialize_protection (current_sheet().protection());
|
||||
|
||||
get_drawing_context().set_odf_packet_path (root()->get_folder());
|
||||
get_drawing_context().process_objects (get_table_metrics());
|
||||
|
||||
@ -502,6 +535,20 @@ void xlsx_conversion_context::end_table()
|
||||
}
|
||||
get_table_context().end_table();
|
||||
}
|
||||
//int xlsx_conversion_context::add_external_link(const std::wstring & external)
|
||||
//{
|
||||
// std::unordered_map<std::wstring, int>::iterator pFind = mapExternalLink_.find(external);
|
||||
// if ( pFind == mapExternalLink_.end())
|
||||
// {
|
||||
// int id = (int)mapExternalLink_.size() + 1;
|
||||
// mapExternalLink_.insert(std::make_pair(external, id));
|
||||
// return id;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return pFind->second;
|
||||
// }
|
||||
//}
|
||||
void xlsx_conversion_context::add_control_props(const std::wstring & rid, const std::wstring & target, const std::wstring & props)
|
||||
{
|
||||
if (rid.empty()) return;
|
||||
@ -647,26 +694,43 @@ std::pair<float,float> xlsx_conversion_context::getMaxDigitSize()
|
||||
|
||||
odf_reader::odf_read_context & odfContext = root()->odf_context();
|
||||
|
||||
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 textFormatProperties = calc_text_properties_content(instances);
|
||||
|
||||
if (textFormatProperties.style_font_name_)
|
||||
font_name = textFormatProperties.style_font_name_.get();
|
||||
else if (textFormatProperties.style_font_name_complex_)
|
||||
font_name = textFormatProperties.style_font_name_complex_.get();
|
||||
else if (textFormatProperties.style_font_name_asian_)
|
||||
font_name = textFormatProperties.style_font_name_asian_.get();
|
||||
odf_reader::style_instance *inst = odfContext.styleContainer().style_default_by_type(odf_types::style_family::TableCell);
|
||||
if (inst) instances.push_back(inst);
|
||||
|
||||
inst = odfContext.styleContainer().style_by_name(L"Default", odf_types::style_family::TableCell, false);
|
||||
if (inst) instances.push_back(inst);
|
||||
else
|
||||
font_name = L"Arial";
|
||||
{
|
||||
inst = odfContext.styleContainer().style_by_name(L"Normal", odf_types::style_family::TableCell, false);
|
||||
if (inst) instances.push_back(inst);
|
||||
}
|
||||
|
||||
odf_reader::text_format_properties_content textFormatProperties = calc_text_properties_content(instances);
|
||||
|
||||
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)
|
||||
{
|
||||
font_name = font->name();
|
||||
}
|
||||
}
|
||||
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, applicationFonts_);
|
||||
maxDigitSize_ = utils::GetMaxDigitSizePixels(font_name.c_str(), font_size, 96., 0, mediaitems_.applicationFonts());
|
||||
}
|
||||
return maxDigitSize_;
|
||||
}
|
||||
|
||||
@ -34,6 +34,8 @@
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/regex.hpp>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "oox_conversion_context.h"
|
||||
|
||||
@ -54,11 +56,6 @@
|
||||
|
||||
#include "mediaitems.h"
|
||||
|
||||
namespace NSFonts
|
||||
{
|
||||
class IApplicationFonts;
|
||||
}
|
||||
|
||||
namespace cpdoccore {
|
||||
|
||||
namespace odf_reader
|
||||
@ -160,6 +157,12 @@ public:
|
||||
void add_jsaProject (const std::string &content);
|
||||
|
||||
void add_control_props(const std::wstring & rid, const std::wstring & target, const std::wstring & props);
|
||||
|
||||
//int add_external_link(const std::wstring & external);
|
||||
|
||||
void add_table_part(const std::wstring & table) {table_parts_.push_back(table);}
|
||||
size_t get_table_parts_size() {return table_parts_.size();}
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
|
||||
odf_reader::odf_document * root()
|
||||
@ -192,9 +195,9 @@ public:
|
||||
|
||||
mediaitems & get_mediaitems() { return mediaitems_; }
|
||||
|
||||
static std::unordered_map<std::wstring, int> mapExternalLink_;
|
||||
std::map<std::wstring, int> mapUsedNames_;
|
||||
private:
|
||||
void create_new_sheet (std::wstring const & name);
|
||||
|
||||
void serialize_bookViews(std::wostream & strm);
|
||||
void serialize_calcPr (std::wostream & strm);
|
||||
|
||||
@ -202,19 +205,18 @@ private:
|
||||
const odf_reader::office_element *spreadsheet_;
|
||||
odf_reader::odf_document *odf_document_;
|
||||
|
||||
NSFonts::IApplicationFonts *applicationFonts_;
|
||||
|
||||
std::vector<xlsx_xml_worksheet_ptr> sheets_;
|
||||
std::vector<oox_chart_context_ptr> charts_;
|
||||
|
||||
std::vector<std::wstring> table_parts_;
|
||||
|
||||
std::wstringstream defaultOutput_;
|
||||
std::pair<float,float> maxDigitSize_;
|
||||
num_format_context num_format_context_;
|
||||
size_t default_style_;
|
||||
mediaitems mediaitems_;
|
||||
std::multimap<std::wstring, int> mapPivotsTableView_;
|
||||
|
||||
std::map<std::wstring, std::wstring>control_props_;
|
||||
|
||||
std::map<std::wstring, std::wstring> control_props_;
|
||||
|
||||
xlsx_style_manager xlsx_style_;
|
||||
xlsx_defined_names xlsx_defined_names_;
|
||||
@ -227,6 +229,8 @@ private:
|
||||
|
||||
math_context math_context_;
|
||||
forms_context forms_context_;
|
||||
|
||||
static std::wstring change_external(boost::wsmatch const & what);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -744,6 +744,9 @@ void process_build_object::visit(chart_title& val)
|
||||
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);
|
||||
}
|
||||
if (val.attlist_.common_draw_position_attlist_.svg_y_)
|
||||
{
|
||||
t.pos_y = val.attlist_.common_draw_position_attlist_.svg_y_->get_value_unit(length::pt);
|
||||
}
|
||||
t.bEnabled = true;
|
||||
@ -1054,7 +1057,7 @@ void process_build_object::visit(table_table_cell& val)
|
||||
if (cell_cash.empty())
|
||||
cell_cash = cell_val;
|
||||
|
||||
object_odf_context::_cell cell_= {object_odf_context_.current_table_column_, object_odf_context_.current_table_row_, cell_cash};
|
||||
object_odf_context::_cell cell_= {(size_t)object_odf_context_.current_table_column_, (size_t)object_odf_context_.current_table_row_, cell_cash};
|
||||
|
||||
object_odf_context_.cash_values.push_back(cell_);
|
||||
|
||||
|
||||
@ -106,6 +106,13 @@ void common_draw_fill_attlist::add_attributes( const xml::attributes_wc_ptr & At
|
||||
CP_APPLY_ATTR(L"draw:fill-image-width", draw_fill_image_width_);
|
||||
CP_APPLY_ATTR(L"draw:fill-image-height", draw_fill_image_height_);
|
||||
|
||||
CP_APPLY_ATTR(L"draw:color-mode", draw_color_mode_);
|
||||
CP_APPLY_ATTR(L"draw:contrast", draw_contrast_);
|
||||
CP_APPLY_ATTR(L"draw:luminance", draw_luminance_);
|
||||
CP_APPLY_ATTR(L"draw:gamma", draw_gamma_);
|
||||
CP_APPLY_ATTR(L"draw:red", draw_red_);
|
||||
CP_APPLY_ATTR(L"draw:green", draw_green_);
|
||||
CP_APPLY_ATTR(L"draw:blue", draw_blue_);
|
||||
}
|
||||
void common_draw_fill_attlist::serialize(CP_ATTR_NODE)
|
||||
{
|
||||
@ -130,6 +137,13 @@ void common_draw_fill_attlist::serialize(CP_ATTR_NODE)
|
||||
CP_XML_ATTR_OPT(L"draw:fill-image-width", draw_fill_image_width_);
|
||||
CP_XML_ATTR_OPT(L"draw:fill-image-height", draw_fill_image_height_);
|
||||
|
||||
CP_XML_ATTR_OPT(L"draw:color-mode", draw_color_mode_);
|
||||
CP_XML_ATTR_OPT(L"draw:contrast", draw_contrast_);
|
||||
CP_XML_ATTR_OPT(L"draw:luminance", draw_luminance_);
|
||||
CP_XML_ATTR_OPT(L"draw:gamma", draw_gamma_);
|
||||
CP_XML_ATTR_OPT(L"draw:red", draw_red_);
|
||||
CP_XML_ATTR_OPT(L"draw:green", draw_green_);
|
||||
CP_XML_ATTR_OPT(L"draw:blue", draw_blue_);
|
||||
}
|
||||
|
||||
void common_draw_fill_attlist::apply_from(const common_draw_fill_attlist & Other)
|
||||
@ -150,6 +164,14 @@ void common_draw_fill_attlist::apply_from(const common_draw_fill_attlist & Other
|
||||
|
||||
_CP_APPLY_PROP2(draw_fill_image_width_);
|
||||
_CP_APPLY_PROP2(draw_fill_image_height_);
|
||||
|
||||
_CP_APPLY_PROP2(draw_color_mode_);
|
||||
_CP_APPLY_PROP2(draw_contrast_);
|
||||
_CP_APPLY_PROP2(draw_luminance_);
|
||||
_CP_APPLY_PROP2(draw_gamma_);
|
||||
_CP_APPLY_PROP2(draw_red_);
|
||||
_CP_APPLY_PROP2(draw_green_);
|
||||
_CP_APPLY_PROP2(draw_blue_);
|
||||
}
|
||||
|
||||
void common_horizontal_margin_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
|
||||
@ -111,6 +111,14 @@ public:
|
||||
|
||||
_CP_OPT(length_or_percent) draw_fill_image_width_;
|
||||
_CP_OPT(length_or_percent) draw_fill_image_height_;
|
||||
|
||||
_CP_OPT(std::wstring) draw_color_mode_;
|
||||
_CP_OPT(odf_types::percent) draw_contrast_;
|
||||
_CP_OPT(odf_types::percent) draw_luminance_;
|
||||
_CP_OPT(odf_types::percent) draw_gamma_;
|
||||
_CP_OPT(odf_types::percent) draw_red_;
|
||||
_CP_OPT(odf_types::percent) draw_green_;
|
||||
_CP_OPT(odf_types::percent) draw_blue_;
|
||||
};
|
||||
|
||||
// common-horizontal-margin-attlist
|
||||
|
||||
@ -79,8 +79,8 @@ static const _shape_converter _OO_OOX_custom_shapes[]=
|
||||
{L"up-down-arrow-callout" ,L"upDownArrowCallout" ,0 ,0 ,0 },
|
||||
{L"quad-arrow-callout" ,L"quadArrowCallout" ,0 ,0 ,0 },
|
||||
{L"circular-arrow" ,L"circularArrow" ,0 ,0 ,0 },
|
||||
{L"can" ,L"lightningBolt" ,0 ,0 ,0 },
|
||||
{L"lightning" ,L"can" ,0 ,0 ,0 },
|
||||
{L"can" ,L"can" ,0 ,0 ,0 },
|
||||
{L"lightning" ,L"lightningBolt" ,0 ,0 ,0 },
|
||||
{L"heart" ,L"heart" ,0 ,0 ,0 },
|
||||
{L"sun" ,L"sun" ,1 ,46875 ,12500 },
|
||||
{L"moon" ,L"moon" ,0 ,0 ,0 },
|
||||
@ -139,13 +139,6 @@ static const _shape_converter _OO_OOX_custom_shapes[]=
|
||||
{L"mso-spt18" ,L"irregularSeal1" ,0 ,0 ,0 },
|
||||
{L"mso-spt19" ,L"rect" ,0 ,0 ,0 },
|
||||
{L"mso-spt24" ,L"textBox" ,0 ,0 ,0 },
|
||||
{L"mso-spt25" ,L"" ,0 ,0 ,0 },
|
||||
{L"mso-spt26" ,L"" ,0 ,0 ,0 },
|
||||
{L"mso-spt27" ,L"" ,0 ,0 ,0 },
|
||||
{L"mso-spt28" ,L"" ,0 ,0 ,0 },
|
||||
{L"mso-spt29" ,L"" ,0 ,0 ,0 },
|
||||
{L"mso-spt30" ,L"" ,0 ,0 ,0 },
|
||||
{L"mso-spt31" ,L"" ,0 ,0 ,0 },
|
||||
{L"mso-spt32" ,L"straightConnector1" ,0 ,0 ,0 },
|
||||
{L"mso-spt33" ,L"bentConnector2" ,0 ,0 ,0 },
|
||||
{L"mso-spt34" ,L"bentConnector3" ,0 ,0 ,0 },
|
||||
@ -181,10 +174,10 @@ static const _shape_converter _OO_OOX_custom_shapes[]=
|
||||
{L"mso-spt107" ,L"ellipseRibbon" ,0 ,0 ,0 },
|
||||
{L"mso-spt108" ,L"ellipseRibbon2" ,0 ,0 ,0 },
|
||||
{L"mso-spt129" ,L"flowChartMagneticDrum" ,0 ,0 ,0 },
|
||||
{L"mso-spt167" ,L"rect" ,0 ,0 ,0 },
|
||||
{L"mso-spt178" ,L"" ,0 ,0 ,0 },
|
||||
{L"mso-spt179" ,L"" ,0 ,0 ,0 },
|
||||
{L"mso-spt180" ,L"" ,0 ,0 ,0 },
|
||||
|
||||
{L"mso-spt178" ,L"callout1" ,0 ,0 ,0 },
|
||||
{L"mso-spt179" ,L"callout2" ,0 ,0 ,0 },
|
||||
{L"mso-spt180" ,L"callout3" ,0 ,0 ,0 },
|
||||
{L"mso-spt182" ,L"leftRightUpArrow" ,0 ,0 ,0 },
|
||||
{L"mso-spt188" ,L"flowChartPunchedTape",0 ,0 ,0 },
|
||||
{L"mso-spt189" ,L"actionButtonBlank" ,0 ,0 ,0 },
|
||||
@ -222,7 +215,6 @@ static const _shape_converter _OO_OOX_custom_shapes[]=
|
||||
{L"concave-star6" ,L"" ,0 ,0 ,0 },
|
||||
{L"signet" ,L"" ,0 ,0 ,0 },
|
||||
{L"doorplate" ,L"" ,0 ,0 ,0 },
|
||||
|
||||
{L"" ,L"round1Rect" ,0 ,0 ,0 },
|
||||
{L"" ,L"round2DiagRect" ,0 ,0 ,0 },
|
||||
{L"" ,L"snip2DiagRect" ,0 ,0 ,0 },
|
||||
@ -300,6 +292,13 @@ static const _shape_converter _OO_OOX_wordart[]=
|
||||
{L"fontwork-slant-up" ,L"textSlantUp" ,0 ,0 ,0 },
|
||||
{L"fontwork-slant-down" ,L"textSlantDown" ,0 ,0 ,0 },
|
||||
|
||||
{L"mso-spt25" ,L"textPlain" ,0 ,0 ,0 },//
|
||||
{L"mso-spt26" ,L"textPlain" ,0 ,0 ,0 },
|
||||
{L"mso-spt27" ,L"textCurveDown" ,0 ,0 ,0 },
|
||||
{L"mso-spt28" ,L"textWave1" ,0 ,0 ,0 },
|
||||
{L"mso-spt29" ,L"textRingInside" ,0 ,0 ,0 },
|
||||
{L"mso-spt30" ,L"textPlain" ,0 ,0 ,0 },
|
||||
{L"mso-spt31" ,L"textRingOutside" ,0 ,0 ,0 },
|
||||
{L"mso-spt142" ,L"textRingInside" ,0 ,0 ,0 },
|
||||
{L"mso-spt143" ,L"textRingOutside" ,0 ,0 ,0 },
|
||||
{L"mso-spt157" ,L"textWave2" ,0 ,0 ,0 },
|
||||
@ -311,7 +310,8 @@ static const _shape_converter _OO_OOX_wordart[]=
|
||||
{L"mso-spt163" ,L"textDeflateBottom" ,0 ,0 ,0 },
|
||||
{L"mso-spt164" ,L"textInflateTop" ,0 ,0 ,0 },
|
||||
{L"mso-spt165" ,L"textDeflateTop" ,0 ,0 ,0 },
|
||||
{L"mso-spt166" ,L"textDeflateInflateDeflate" ,0 ,0 ,0 },
|
||||
{L"mso-spt166" ,L"textDeflateInflate" ,0 ,0 ,0 },
|
||||
{L"mso-spt167" ,L"textDeflateInflateDeflate" ,0 ,0 ,0 },
|
||||
{L"mso-spt174" ,L"textCanUp" ,0 ,0 ,0 },
|
||||
{L"mso-spt175" ,L"textCanDown" ,0 ,0 ,0 },
|
||||
{L"mso-spt188" ,L"textDoubleWave1" ,0 ,0 ,0 },
|
||||
|
||||
@ -60,6 +60,10 @@ std::wostream & operator << (std::wostream & _Wostream, const marker_style & _Va
|
||||
|
||||
std::wstring marker_style::parse(const std::wstring & Str)
|
||||
{
|
||||
if (Str.empty())
|
||||
{
|
||||
return L"none";
|
||||
}
|
||||
std::wstring tmp = Str;
|
||||
boost::algorithm::to_lower(tmp);
|
||||
|
||||
|
||||
@ -58,13 +58,11 @@ namespace _image_file_
|
||||
{
|
||||
bool GetResolution(const wchar_t* fileName, int & Width, int &Height, NSFonts::IApplicationFonts* appFonts)
|
||||
{
|
||||
if (!appFonts) return false;
|
||||
|
||||
CBgraFrame image;
|
||||
MetaFile::IMetaFile* meta_file = MetaFile::Create(appFonts);
|
||||
|
||||
bool bRet = false;
|
||||
if ( meta_file->LoadFromFile(fileName))
|
||||
if ( appFonts && meta_file->LoadFromFile(fileName))
|
||||
{
|
||||
double dX = 0, dY = 0, dW = 0, dH = 0;
|
||||
meta_file->GetBounds(&dX, &dY, &dW, &dH);
|
||||
@ -83,6 +81,18 @@ namespace _image_file_
|
||||
RELEASEOBJECT(meta_file);
|
||||
return bRet;
|
||||
}
|
||||
|
||||
void GenerateZeroImage(const std::wstring & fileName)
|
||||
{
|
||||
NSFile::CFileBinary file;
|
||||
if (file.CreateFileW(fileName))
|
||||
{
|
||||
BYTE pData[149] = {0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x08, 0x03, 0x00, 0x00, 0x01, 0x5f, 0xcc, 0x04, 0x2d, 0x00, 0x00, 0x00, 0x01, 0x73, 0x52, 0x47, 0x42, 0x00, 0xae, 0xce, 0x1c, 0xe9, 0x00, 0x00, 0x00, 0x04, 0x67, 0x41, 0x4d, 0x41, 0x00, 0x00, 0xb1, 0x8f, 0x0b, 0xfc, 0x61, 0x05, 0x00, 0x00, 0x00, 0x06, 0x50, 0x4c, 0x54, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa5, 0x67, 0xb9, 0xcf, 0x00, 0x00, 0x00, 0x02, 0x74, 0x52, 0x4e, 0x53, 0xff, 0x00, 0xe5, 0xb7, 0x30, 0x4a, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x12, 0x74, 0x00, 0x00, 0x12, 0x74, 0x01, 0xde, 0x66, 0x1f, 0x78, 0x00, 0x00, 0x00, 0x0a, 0x49, 0x44, 0x41, 0x54, 0x18, 0x57, 0x63, 0x60, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0xa3, 0xda, 0x3d, 0x94, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82};
|
||||
|
||||
file.WriteFile(pData, 149);
|
||||
file.CloseFile();
|
||||
}
|
||||
}
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
namespace cpdoccore {
|
||||
@ -101,11 +111,11 @@ int get_value_emu(double pt)
|
||||
{
|
||||
return static_cast<int>((pt* 360000 * 2.54) / 72);
|
||||
}
|
||||
bool parse_clipping(std::wstring strClipping,std::wstring fileName, double_4 & clip_rect, NSFonts::IApplicationFonts * appFonts)
|
||||
bool parse_clipping(std::wstring strClipping,std::wstring fileName, double_4 & clip_rect, NSFonts::IApplicationFonts *appFonts)
|
||||
{
|
||||
memset(clip_rect, 0, 4*sizeof(double));
|
||||
|
||||
if (strClipping.length() <1 || fileName.length()<1)return false;
|
||||
if (strClipping.empty() || fileName.empty()) return false;
|
||||
|
||||
//<top>, <right>, <bottom>, <left> - http://www.w3.org/TR/2001/REC-xsl-20011015/xslspec.html#clip
|
||||
|
||||
@ -114,7 +124,7 @@ bool parse_clipping(std::wstring strClipping,std::wstring fileName, double_4 & c
|
||||
std::vector<std::wstring> Points;
|
||||
std::vector<length> Points_pt;
|
||||
|
||||
boost::algorithm::split(Points,strClipping, boost::algorithm::is_any_of(L" ,"), boost::algorithm::token_compress_on);
|
||||
boost::algorithm::split(Points, strClipping, boost::algorithm::is_any_of(L" ,"), boost::algorithm::token_compress_on);
|
||||
|
||||
for (size_t i = 0; i < Points.size(); i++)
|
||||
{
|
||||
@ -125,9 +135,9 @@ bool parse_clipping(std::wstring strClipping,std::wstring fileName, double_4 & c
|
||||
|
||||
if (!bEnableCrop) return false;
|
||||
|
||||
int fileWidth=0,fileHeight=0;
|
||||
int fileWidth = 0,fileHeight = 0;
|
||||
|
||||
if (!_image_file_::GetResolution(fileName.data(), fileWidth, fileHeight, appFonts) || fileWidth<1 || fileHeight<1) return false;
|
||||
if (!_image_file_::GetResolution(fileName.data(), fileWidth, fileHeight, appFonts) || fileWidth < 1 || fileHeight < 1) return false;
|
||||
|
||||
if (Points_pt.size() > 3)//если другое количество точек .. попозже
|
||||
{
|
||||
@ -143,7 +153,7 @@ bool parse_clipping(std::wstring strClipping,std::wstring fileName, double_4 & c
|
||||
clip_rect[1] = clip_rect[1]*100/fileHeight;
|
||||
clip_rect[3] = clip_rect[3]*100/fileHeight;
|
||||
|
||||
if (clip_rect[0]<0.01 && clip_rect[1]<0.01 && clip_rect[2]<0.01 && clip_rect[3]<0.01)
|
||||
if (clip_rect[0] < 0.01 && clip_rect[1] < 0.01 && clip_rect[2] < 0.01 && clip_rect[3] < 0.01)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@ -475,6 +485,8 @@ void Compute_GraphicFill(const common_draw_fill_attlist & props, const office_el
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((props.draw_color_mode_) && (*props.draw_color_mode_ == L"greyscale"))
|
||||
fill.bitmap->bGrayscale = true;
|
||||
}
|
||||
if (props.draw_fill_gradient_name_)
|
||||
{
|
||||
@ -738,47 +750,49 @@ void pptx_convert_transforms(std::wstring transformStr, oox::pptx_conversion_con
|
||||
|
||||
if (transform.size()>1)//тока с аргументами
|
||||
{
|
||||
int res=0;
|
||||
if ((res = transform[0].find(L"translate"))>=0)//перемещение
|
||||
size_t res = 0;
|
||||
if ((res = transform[0].find(L"translate")) != std::wstring::npos)//перемещение
|
||||
{
|
||||
std::vector<length> Points ;
|
||||
parse_string_to_points(transform[1], Points);
|
||||
|
||||
if (Points.size()>0)
|
||||
if (false == Points.empty())
|
||||
{
|
||||
double x_pt = Points[0].get_value_unit(length::pt);
|
||||
double y_pt = 0;
|
||||
if (Points.size()>1)y_pt = Points[1].get_value_unit(length::pt);//ее может не быть
|
||||
|
||||
Context.get_slide_context().set_translate(x_pt,y_pt);
|
||||
Context.get_slide_context().set_translate(x_pt, y_pt);
|
||||
}
|
||||
}
|
||||
else if ((res = transform[0].find(L"scale"))>=0)//масштабирование
|
||||
else if ((res = transform[0].find(L"scale")) != std::wstring::npos)//масштабирование
|
||||
{
|
||||
std::vector<length> Points ;
|
||||
parse_string_to_points(transform[1], Points);
|
||||
if (Points.size()>0)
|
||||
|
||||
if (false == Points.empty())
|
||||
{
|
||||
double x_pt = Points[0].get_value_unit(length::pt);
|
||||
double y_pt = x_pt;
|
||||
if (Points.size()>1)y_pt = Points[1].get_value_unit(length::pt);//ее может не быть
|
||||
|
||||
Context.get_slide_context().set_scale(x_pt,y_pt);
|
||||
Context.get_slide_context().set_scale(x_pt, y_pt);
|
||||
}
|
||||
}
|
||||
else if ((res = transform[0].find(L"rotate"))>=0)//вращение
|
||||
else if ((res = transform[0].find(L"rotate")) != std::wstring::npos)//вращение
|
||||
{
|
||||
Context.get_slide_context().set_rotate( boost::lexical_cast<double>(transform[1]));
|
||||
Context.get_slide_context().set_translate_rotate();
|
||||
}
|
||||
else if ((res = transform[0].find(L"skewX"))>=0)//вращение
|
||||
else if ((res = transform[0].find(L"skewX")) != std::wstring::npos)//вращение
|
||||
{
|
||||
double angle = boost::lexical_cast<double>(transform[1]);
|
||||
Context.get_slide_context().set_property(_property(L"svg:skewX",angle));
|
||||
Context.get_slide_context().set_property(_property(L"svg:skewX", angle));
|
||||
}
|
||||
else if ((res = transform[0].find(L"skewY"))>=0)//вращение
|
||||
else if ((res = transform[0].find(L"skewY")) != std::wstring::npos)//вращение
|
||||
{
|
||||
double angle = boost::lexical_cast<double>(transform[1]);
|
||||
Context.get_slide_context().set_property(_property(L"svg:skewY",angle));
|
||||
Context.get_slide_context().set_property(_property(L"svg:skewY", angle));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,7 +52,8 @@
|
||||
|
||||
namespace _image_file_
|
||||
{
|
||||
bool GetResolution(const wchar_t* fileName, int & Width, int &Height, NSFonts::IApplicationFonts * appFonts);
|
||||
bool GetResolution(const wchar_t* fileName, int & Width, int &Height, NSFonts::IApplicationFonts *appFonts);
|
||||
void GenerateZeroImage(const std::wstring & fileName);
|
||||
}
|
||||
|
||||
namespace cpdoccore {
|
||||
@ -74,7 +75,7 @@ void Compute_GraphicFill(const odf_types::common_draw_fill_attlist & props,
|
||||
const office_element_ptr & style_image, styles_lite_container &styles, oox::_oox_fill & fill, bool txbx = false);
|
||||
|
||||
typedef double double_4[4];
|
||||
bool parse_clipping(std::wstring strClipping,std::wstring fileName,double_4 & clip_rect, NSFonts::IApplicationFonts * appFonts);
|
||||
bool parse_clipping(std::wstring strClipping, std::wstring fileName, double_4 & clip_rect, NSFonts::IApplicationFonts *appFonts);
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class draw_a : public office_element_impl<draw_a>
|
||||
{
|
||||
|
||||
@ -30,8 +30,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "draw_frame.h"
|
||||
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
@ -42,6 +40,8 @@
|
||||
#include <xml/attributes.h>
|
||||
#include <odf/odf_document.h>
|
||||
|
||||
#include "draw_common.h"
|
||||
|
||||
#include "serialize_elements.h"
|
||||
#include "style_graphic_properties.h"
|
||||
#include "odfcontext.h"
|
||||
@ -54,6 +54,7 @@
|
||||
#include "datatypes/borderstyle.h"
|
||||
|
||||
#include "../../../OfficeUtils/src/OfficeUtils.h"
|
||||
#include "../../../Common/OfficeFileFormatChecker.h"
|
||||
#include "../../../Common/3dParty/pole/pole.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
@ -153,6 +154,58 @@ void draw_g::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
void draw_g::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
|
||||
if (content_.empty()) return;
|
||||
|
||||
draw_g *group = dynamic_cast<draw_g*> (content_.back().get());
|
||||
draw_frame *frame = dynamic_cast<draw_frame*> (content_.back().get());
|
||||
draw_shape *shape = dynamic_cast<draw_shape*> (content_.back().get());
|
||||
|
||||
if (group)
|
||||
{
|
||||
int x=0, y=0, cx=0, cy=0;
|
||||
x = get_value_emu(group->common_draw_attlists_.position_.svg_x_);
|
||||
y = get_value_emu(group->common_draw_attlists_.position_.svg_y_);
|
||||
|
||||
cx = get_value_emu(group->common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_width_);
|
||||
cy = get_value_emu(group->common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_height_);
|
||||
|
||||
if (position_child_x1 > x || position_child_x1 < 0) position_child_x1 = x;
|
||||
if (position_child_y1 > y || position_child_y1 < 0) position_child_y1 = y;
|
||||
|
||||
if (position_child_x2 < x + cx || position_child_x2 < 0) position_child_x2 = x + cx;
|
||||
if (position_child_y2 < y + cy || position_child_y2 < 0) position_child_y2 = y + cy;
|
||||
}
|
||||
else if (frame)
|
||||
{
|
||||
int x=0, y=0, cx=0, cy=0;
|
||||
x = get_value_emu(frame->common_draw_attlists_.position_.svg_x_);
|
||||
y = get_value_emu(frame->common_draw_attlists_.position_.svg_y_);
|
||||
|
||||
cx = get_value_emu(frame->common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_width_);
|
||||
cy = get_value_emu(frame->common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_height_);
|
||||
|
||||
if (position_child_x1 > x || position_child_x1 < 0) position_child_x1 = x;
|
||||
if (position_child_y1 > y || position_child_y1 < 0) position_child_y1 = y;
|
||||
|
||||
if (position_child_x2 < x + cx || position_child_x2 < 0) position_child_x2 = x + cx;
|
||||
if (position_child_y2 < y + cy || position_child_y2 < 0) position_child_y2 = y + cy;
|
||||
}
|
||||
else if (shape)
|
||||
{
|
||||
int x=0, y=0, cx=0, cy=0;
|
||||
x = get_value_emu(shape->common_draw_attlists_.position_.svg_x_);
|
||||
y = get_value_emu(shape->common_draw_attlists_.position_.svg_y_);
|
||||
|
||||
cx = get_value_emu(shape->common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_width_);
|
||||
cy = get_value_emu(shape->common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_height_);
|
||||
|
||||
if (position_child_x1 > x || position_child_x1 < 0) position_child_x1 = x;
|
||||
if (position_child_y1 > y || position_child_y1 < 0) position_child_y1 = y;
|
||||
|
||||
if (position_child_x2 < x + cx || position_child_x2 < 0) position_child_x2 = x + cx;
|
||||
if (position_child_y2 < y + cy || position_child_y2 < 0) position_child_y2 = y + cy;
|
||||
}
|
||||
}
|
||||
|
||||
std::wostream & draw_g::text_to_stream(std::wostream & _Wostream) const
|
||||
@ -295,50 +348,63 @@ void draw_object_ole::add_child_element( xml::sax * Reader, const std::wstring &
|
||||
CP_NOT_APPLICABLE_ELM();
|
||||
}
|
||||
|
||||
std::wstring draw_object_ole::detectObject(const std::wstring &fileName)
|
||||
void draw_object_ole::detectObject(const std::wstring &fileName, std::wstring &prog, std::wstring &extension, oox::RelsType &rels)
|
||||
{
|
||||
extension = L".bin";
|
||||
|
||||
POLE::Storage *storage = new POLE::Storage(fileName.c_str());
|
||||
if (storage == NULL) return L"";
|
||||
|
||||
if (storage->open(false, false) == false)
|
||||
if ((storage) && (storage->open(false, false) == true))
|
||||
{
|
||||
delete storage;
|
||||
return L"";
|
||||
}
|
||||
std::wstring prog;
|
||||
POLE::Stream* pStream = new POLE::Stream(storage, L"CompObj");
|
||||
if ((pStream) && (pStream->size() > 28))
|
||||
{
|
||||
//skip the CompObjHeader
|
||||
pStream->seek(28);
|
||||
|
||||
int sz_obj = (int)pStream->size() - 28;
|
||||
|
||||
std::vector<std::string> str;
|
||||
|
||||
while (sz_obj > 0)
|
||||
std::wstring prog;
|
||||
POLE::Stream* pStream = new POLE::Stream(storage, L"CompObj");
|
||||
if ((pStream) && (pStream->size() > 28))
|
||||
{
|
||||
_UINT32 sz = 0;
|
||||
pStream->read((unsigned char*)&sz, 4); sz_obj-= 4;
|
||||
//skip the CompObjHeader
|
||||
pStream->seek(28);
|
||||
|
||||
int sz_obj = (int)pStream->size() - 28;
|
||||
|
||||
std::vector<std::string> str;
|
||||
|
||||
if (sz > sz_obj)
|
||||
break;
|
||||
unsigned char *data = new unsigned char[sz];
|
||||
pStream->read(data, sz);
|
||||
while (sz_obj > 0)
|
||||
{
|
||||
_UINT32 sz = 0;
|
||||
pStream->read((unsigned char*)&sz, 4); sz_obj-= 4;
|
||||
|
||||
if (sz > sz_obj)
|
||||
break;
|
||||
unsigned char *data = new unsigned char[sz];
|
||||
pStream->read(data, sz);
|
||||
|
||||
str.push_back(std::string((char*)data, sz));
|
||||
delete []data;
|
||||
str.push_back(std::string((char*)data, sz));
|
||||
delete []data;
|
||||
|
||||
sz_obj-= sz;
|
||||
}
|
||||
if (!str.empty())
|
||||
{
|
||||
prog = std::wstring (str.back().begin(), str.back().end());
|
||||
}
|
||||
delete pStream;
|
||||
}
|
||||
delete storage;
|
||||
}
|
||||
else
|
||||
{
|
||||
COfficeFileFormatChecker checker(fileName);
|
||||
switch(checker.nFileType)
|
||||
{
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC: extension = L".doc"; prog = L"Word"; rels = oox::typeOleObject; break;
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX: extension = L".docx"; prog = L"Word"; rels = oox::typeMsObject; break;
|
||||
|
||||
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS: extension = L".xls"; prog = L"Excel"; rels = oox::typeOleObject; break;
|
||||
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX: extension = L".xlsx"; prog = L"Excel"; rels = oox::typeMsObject; break;
|
||||
|
||||
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPT: extension = L".ppt"; prog = L"PowerPoint"; rels = oox::typeOleObject; break;
|
||||
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX: extension = L".pptx"; prog = L"PowerPoint"; rels = oox::typeMsObject; break;
|
||||
|
||||
sz_obj-= sz;
|
||||
}
|
||||
if (!str.empty())
|
||||
{
|
||||
prog = std::wstring (str.back().begin(), str.back().end());
|
||||
}
|
||||
delete pStream;
|
||||
}
|
||||
delete storage;
|
||||
return prog;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -209,6 +209,8 @@ public:
|
||||
static const ElementType type = typeDrawG;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
draw_g() : position_child_x1(-1), position_child_y1(-1), position_child_x2(-1), position_child_y2(-1) {}
|
||||
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
|
||||
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context);
|
||||
@ -220,6 +222,12 @@ public:
|
||||
|
||||
office_element_ptr_array content_;
|
||||
|
||||
int position_child_x1;
|
||||
int position_child_y1;
|
||||
|
||||
int position_child_x2;
|
||||
int position_child_y2;
|
||||
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
@ -327,7 +335,7 @@ private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
std::wstring detectObject(const std::wstring &fileName);
|
||||
void detectObject(const std::wstring &fileName, std::wstring &prog, std::wstring &extension, oox::RelsType &rels);
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_object_ole);
|
||||
|
||||
@ -838,12 +838,20 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, union_comm
|
||||
}
|
||||
if (!drawing->isInline)
|
||||
{
|
||||
drawing->relativeHeight = L"2";
|
||||
drawing->behindDoc = L"0";
|
||||
|
||||
if (((drawing->styleWrap && drawing->styleWrap->get_type() == style_wrap::RunThrough) ||
|
||||
!drawing->styleWrap) && styleRunThrough && styleRunThrough->get_type() == run_through::Background)
|
||||
{
|
||||
drawing->behindDoc = L"1";
|
||||
if (!drawing->styleWrap)
|
||||
drawing->styleWrap = style_wrap(style_wrap::RunThrough);
|
||||
|
||||
}
|
||||
if (!drawing->styleWrap)
|
||||
drawing->styleWrap = style_wrap(style_wrap::Parallel);//у опен офис и мс разные дефолты
|
||||
|
||||
drawing->relativeHeight = L"2";
|
||||
drawing->behindDoc = L"0";
|
||||
|
||||
_CP_OPT(int) zIndex = attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_z_index_;
|
||||
|
||||
if (zIndex)//порядок отрисовки объектов
|
||||
@ -853,13 +861,6 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, union_comm
|
||||
else
|
||||
drawing->relativeHeight = std::to_wstring( 2 + *zIndex );
|
||||
}
|
||||
|
||||
if (drawing->styleWrap && drawing->styleWrap->get_type() == style_wrap::RunThrough
|
||||
&& styleRunThrough && styleRunThrough->get_type() == run_through::Background)
|
||||
{
|
||||
drawing-> behindDoc = L"1";
|
||||
}
|
||||
|
||||
drawing->margin_rect[0] = GetMargin(graphicProperties, sideLeft);
|
||||
drawing->margin_rect[1] = GetMargin(graphicProperties, sideTop);
|
||||
drawing->margin_rect[2] = GetMargin(graphicProperties, sideRight);
|
||||
@ -873,14 +874,14 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, union_comm
|
||||
int type = attlists_.rel_size_.style_rel_width_->get_type();
|
||||
|
||||
if (type == odf_types::percent_or_scale::Percent)
|
||||
drawing->pctWidth = attlists_.rel_size_.style_rel_width_->get_percent().get_value();
|
||||
drawing->pctWidth = (int)attlists_.rel_size_.style_rel_width_->get_percent().get_value();
|
||||
}
|
||||
if (attlists_.rel_size_.style_rel_height_ )
|
||||
{
|
||||
int type = attlists_.rel_size_.style_rel_height_->get_type();
|
||||
|
||||
if (type == odf_types::percent_or_scale::Percent)
|
||||
drawing->pctHeight = attlists_.rel_size_.style_rel_height_->get_percent().get_value();
|
||||
drawing->pctHeight = (int)attlists_.rel_size_.style_rel_height_->get_percent().get_value();
|
||||
}
|
||||
|
||||
}
|
||||
@ -1002,7 +1003,7 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, union_comm
|
||||
drawing->x = val >= 0 ? val : 0; //??? todooo отрицательные величины ...
|
||||
}
|
||||
|
||||
GetProperty(drawing->additional,L"svg:translate_y", dVal);
|
||||
GetProperty(drawing->additional, L"svg:translate_y", dVal);
|
||||
if (dVal)
|
||||
{
|
||||
int val = get_value_emu(dVal.get());
|
||||
@ -1011,16 +1012,11 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, union_comm
|
||||
|
||||
if (drawing->inGroup && drawing->type != oox::typeGroupShape)
|
||||
{
|
||||
Context.get_drawing_context().set_position_child_group (drawing->x, drawing->y);
|
||||
Context.get_drawing_context().set_size_child_group (drawing->cx + drawing->x, drawing->cy + drawing->y);
|
||||
|
||||
// ваще то тут "несовсем" всерно ... нужно сначала все стартовые позиции добавить ..
|
||||
_INT32 x_group_offset, y_group_offset;
|
||||
Context.get_drawing_context().get_position_group(x_group_offset, y_group_offset);
|
||||
|
||||
drawing->x -= x_group_offset;
|
||||
drawing->y -= y_group_offset;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -1029,15 +1025,17 @@ void draw_shape::docx_convert(oox::docx_conversion_context & Context)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
oox::_docx_drawing drawing = oox::_docx_drawing();
|
||||
|
||||
drawing.type = oox::typeShape;
|
||||
drawing.id = Context.get_drawing_context().get_current_shape_id();
|
||||
drawing.name = Context.get_drawing_context().get_current_object_name();
|
||||
drawing.inGroup = Context.get_drawing_context().in_group();
|
||||
drawing.type = oox::typeShape;
|
||||
drawing.id = Context.get_drawing_context().get_current_shape_id();
|
||||
drawing.name = Context.get_drawing_context().get_current_object_name();
|
||||
drawing.inGroup = Context.get_drawing_context().in_group();
|
||||
drawing.lined = lined_shape_;
|
||||
drawing.connector = connector_;
|
||||
|
||||
drawing.sub_type = sub_type_;
|
||||
drawing.additional = additional_;//сюда могут добавиться свойства ...
|
||||
|
||||
if (drawing.sub_type !=5 )//line
|
||||
if (drawing.lined == false)
|
||||
{
|
||||
drawing.additional.push_back(_property(L"text-content", Context.get_drawing_context().get_text_stream_shape()));
|
||||
}
|
||||
@ -1189,10 +1187,18 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
|
||||
std::wstring strRectClip = properties->fo_clip_.get();
|
||||
strRectClip = strRectClip.substr(5, strRectClip.length() - 6);
|
||||
|
||||
std::wstring fileName = Context.root()->get_folder() + FILE_SEPARATOR_STR + href;
|
||||
std::wstring fileName = Context.root()->get_folder() + FILE_SEPARATOR_STR + xlink_attlist_.href_.get_value_or(L"");
|
||||
|
||||
drawing->fill.bitmap->bCrop = parse_clipping(strRectClip, fileName, drawing->fill.bitmap->cropRect, NULL/*Context.applicationFonts_*/);
|
||||
}
|
||||
drawing->fill.bitmap->bCrop = parse_clipping(strRectClip, fileName, drawing->fill.bitmap->cropRect, Context.get_mediaitems().applicationFonts());
|
||||
}
|
||||
if (properties->common_draw_fill_attlist_.draw_luminance_)
|
||||
{
|
||||
drawing->fill.bitmap->luminance = properties->common_draw_fill_attlist_.draw_luminance_->get_value();
|
||||
}
|
||||
if (properties->common_draw_fill_attlist_.draw_contrast_)
|
||||
{
|
||||
drawing->fill.bitmap->contrast = properties->common_draw_fill_attlist_.draw_contrast_->get_value();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1346,9 +1352,14 @@ void draw_g::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
Context.reset_context_state();
|
||||
|
||||
if (position_child_x1 >= 0 && position_child_y1 >= 0 )
|
||||
Context.get_drawing_context().set_position_child_group (position_child_x1, position_child_y1);
|
||||
|
||||
if (position_child_x2 >= 0 && position_child_y2 >= 0 )
|
||||
Context.get_drawing_context().set_size_child_group (position_child_x2, position_child_y2);
|
||||
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
ElementType type = content_[i]->get_type();
|
||||
content_[i]->docx_convert(Context);
|
||||
}
|
||||
drawing.content_group_ = temp_stream.str();
|
||||
@ -1367,10 +1378,6 @@ void draw_g::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
if (drawing.inGroup)
|
||||
{
|
||||
Context.get_drawing_context().set_position_child_group (drawing.x, drawing.y);
|
||||
Context.get_drawing_context().set_size_child_group (drawing.cx + drawing.x, drawing.cy + drawing.y);
|
||||
|
||||
// ваще то тут "несовсем" верно ... нужно сначала все стартовые позиции добавить ..
|
||||
_INT32 x_group_offset, y_group_offset;
|
||||
Context.get_drawing_context().get_position_group(x_group_offset, y_group_offset);
|
||||
|
||||
@ -1635,18 +1642,20 @@ void draw_object_ole::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
if (href.empty()) return;
|
||||
|
||||
draw_frame* frame = Context.get_drawing_context().get_current_frame(); //owner
|
||||
draw_frame* frame = Context.get_drawing_context().get_current_frame(); //owner
|
||||
if (!frame) return;
|
||||
|
||||
oox::_docx_drawing * drawing = dynamic_cast<oox::_docx_drawing *>(frame->oox_drawing_.get());
|
||||
oox::_docx_drawing * drawing = dynamic_cast<oox::_docx_drawing *>(frame->oox_drawing_.get());
|
||||
if (!drawing) return;
|
||||
|
||||
drawing->type = oox::typeOleObject;
|
||||
|
||||
bool isMediaInternal = true;
|
||||
drawing->objectId = Context.get_mediaitems().add_or_find(href, drawing->type, isMediaInternal, href);
|
||||
std::wstring extension;
|
||||
detectObject(href, drawing->objectProgId, extension, drawing->type);
|
||||
|
||||
NSFile::CFileBinary::Copy(objectPath, objectPath + extension);
|
||||
|
||||
bool isMediaInternal = true;
|
||||
drawing->objectId = Context.get_mediaitems().add_or_find(href + extension, drawing->type, isMediaInternal, href);
|
||||
|
||||
drawing->objectProgId = detectObject(objectPath);
|
||||
}
|
||||
void draw_control::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
|
||||
@ -162,7 +162,13 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
|
||||
oox::_oox_fill fill;
|
||||
Compute_GraphicFill(properties.common_draw_fill_attlist_, properties.style_background_image_,
|
||||
Context.root()->odf_context().drawStyles() ,fill);
|
||||
Context.root()->odf_context().drawStyles(), fill);
|
||||
if (properties.fo_clip_)
|
||||
{
|
||||
std::wstring strRectClip = properties.fo_clip_.get();
|
||||
Context.get_slide_context().set_clipping(strRectClip.substr(5, strRectClip.length() - 6));
|
||||
}
|
||||
|
||||
Context.get_slide_context().set_fill(fill);
|
||||
|
||||
Context.get_slide_context().set_property(odf_reader::_property(L"border_width_left", Compute_BorderWidth(properties, sideLeft)));
|
||||
@ -170,11 +176,6 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
Context.get_slide_context().set_property(odf_reader::_property(L"border_width_right", Compute_BorderWidth(properties, sideRight)));
|
||||
Context.get_slide_context().set_property(odf_reader::_property(L"border_width_bottom", Compute_BorderWidth(properties, sideBottom)));
|
||||
|
||||
if (properties.fo_clip_)
|
||||
{
|
||||
std::wstring strRectClip = properties.fo_clip_.get();
|
||||
Context.get_slide_context().set_clipping(strRectClip.substr(5,strRectClip.length()-6));
|
||||
}
|
||||
if (common_presentation_attlist_.presentation_class_)
|
||||
{
|
||||
Context.get_slide_context().set_placeHolder_type(common_presentation_attlist_.presentation_class_->get_type_ms());
|
||||
@ -221,7 +222,7 @@ void draw_image::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
}
|
||||
std::wstring text_content_ = Context.get_text_context().end_object();
|
||||
|
||||
if (text_content_.length()>0)
|
||||
if (!text_content_.empty())
|
||||
{
|
||||
Context.get_slide_context().set_property(_property(L"text-content", text_content_));
|
||||
}
|
||||
@ -384,7 +385,18 @@ void draw_object_ole::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
std::wstring objectPath = folderPath + FILE_SEPARATOR_STR + href;
|
||||
|
||||
if (!href.empty())
|
||||
Context.get_slide_context().set_ole_object(href, detectObject(objectPath));
|
||||
{
|
||||
std::wstring prog, extension;
|
||||
oox::RelsType relsType;
|
||||
detectObject(objectPath, prog, extension, relsType);
|
||||
|
||||
NSFile::CFileBinary::Copy(objectPath, objectPath + extension);
|
||||
|
||||
if (relsType == oox::typeMsObject)
|
||||
Context.get_slide_context().set_ms_object(href + extension, prog);
|
||||
else
|
||||
Context.get_slide_context().set_ole_object(href + extension, prog);
|
||||
}
|
||||
}
|
||||
|
||||
void draw_param::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
|
||||
@ -179,14 +179,14 @@ void draw_frame::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
Context.get_drawing_context().set_property(odf_reader::_property(L"border_width_right", Compute_BorderWidth(properties, sideRight)));
|
||||
Context.get_drawing_context().set_property(odf_reader::_property(L"border_width_bottom", Compute_BorderWidth(properties, sideBottom)));
|
||||
|
||||
oox::_oox_fill fill;
|
||||
Compute_GraphicFill(properties.common_draw_fill_attlist_, properties.style_background_image_,
|
||||
Context.root()->odf_context().drawStyles(), fill);
|
||||
if (properties.fo_clip_)
|
||||
{
|
||||
std::wstring strRectClip = properties.fo_clip_.get();
|
||||
Context.get_drawing_context().set_clipping(strRectClip.substr(5,strRectClip.length()-6));
|
||||
Context.get_drawing_context().set_clipping(strRectClip.substr(5, strRectClip.length() - 6));
|
||||
}
|
||||
oox::_oox_fill fill;
|
||||
Compute_GraphicFill(properties.common_draw_fill_attlist_, properties.style_background_image_,
|
||||
Context.root()->odf_context().drawStyles() ,fill);
|
||||
Context.get_drawing_context().set_fill(fill);
|
||||
|
||||
oox_drawing_ = oox_drawing_ptr(new oox::_xlsx_drawing());
|
||||
@ -228,7 +228,7 @@ void draw_image::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
}
|
||||
std::wstring text_content_ = Context.get_text_context().end_drawing_content();
|
||||
|
||||
if (text_content_.length()>0)
|
||||
if (!text_content_.empty())
|
||||
{
|
||||
Context.get_drawing_context().set_property(_property(L"text-content", text_content_));
|
||||
}
|
||||
@ -359,8 +359,18 @@ void draw_object_ole::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
std::wstring objectPath = folderPath + FILE_SEPARATOR_STR + href;
|
||||
|
||||
if (!href.empty())
|
||||
Context.get_drawing_context().set_ole_object(href, detectObject(objectPath));
|
||||
|
||||
{
|
||||
std::wstring prog, extension;
|
||||
oox::RelsType relsType;
|
||||
detectObject(objectPath, prog, extension, relsType);
|
||||
|
||||
NSFile::CFileBinary::Copy(objectPath, objectPath + extension);
|
||||
|
||||
if (relsType == oox::typeMsObject)
|
||||
Context.get_drawing_context().set_ms_object(href + extension, prog);
|
||||
else
|
||||
Context.get_drawing_context().set_ole_object(href + extension, prog);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -174,6 +174,7 @@ void draw_line::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
draw_shape::add_attributes(Attributes);
|
||||
|
||||
sub_type_ = 5;
|
||||
lined_shape_ = true;
|
||||
}
|
||||
void draw_line::reset_svg_attributes()
|
||||
{
|
||||
@ -256,8 +257,11 @@ void draw_path::reset_svg_path()
|
||||
std::vector<::svg_path::_polyline> o_Polyline_pt;
|
||||
std::vector<::svg_path::_polyline> o_Polyline_cm;
|
||||
|
||||
bool res = ::svg_path::parseSvgD(o_Polyline_cm, draw_path_attlist_.svg_d_.get(), false);
|
||||
bool bClosed = false;
|
||||
bool res = ::svg_path::parseSvgD(o_Polyline_cm, draw_path_attlist_.svg_d_.get(), false, bClosed);
|
||||
|
||||
if (!bClosed) lined_shape_ = true;
|
||||
|
||||
for (size_t i = 0; i < o_Polyline_cm.size(); i++)
|
||||
{
|
||||
::svg_path::_polyline & poly = o_Polyline_cm[i];
|
||||
@ -275,7 +279,7 @@ void draw_path::reset_svg_path()
|
||||
}
|
||||
o_Polyline_pt.push_back(poly);
|
||||
}
|
||||
if (o_Polyline_pt.size()>0)
|
||||
if (false == o_Polyline_pt.empty())
|
||||
{
|
||||
//сформируем xml-oox сдесь ... а то придется плодить массивы в drawing .. хоть и не красиво..
|
||||
std::wstringstream output_;
|
||||
@ -291,18 +295,24 @@ void draw_polygon_attlist::add_attributes( const xml::attributes_wc_ptr & Attrib
|
||||
CP_APPLY_ATTR(L"svg:viewBox", svg_viewbox_);
|
||||
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// draw:polygon
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * draw_polygon::ns = L"draw";
|
||||
const wchar_t * draw_polygon::name = L"polygon";
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// draw:contour-polygon
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * draw_contour_polygon::ns = L"draw";
|
||||
const wchar_t * draw_contour_polygon::name = L"contour-polygon";
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// draw:contour-path
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * draw_contour_path::ns = L"draw";
|
||||
const wchar_t * draw_contour_path::name = L"contour-path";
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// draw:polygon
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * draw_polygon::ns = L"draw";
|
||||
const wchar_t * draw_polygon::name = L"polygon";
|
||||
|
||||
void draw_polygon::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
draw_polygon_attlist_.add_attributes(Attributes);
|
||||
@ -322,7 +332,7 @@ void draw_polygon::reset_polygon_path()
|
||||
std::vector<::svg_path::_polyline> o_Polyline_pt;
|
||||
std::vector<::svg_path::_polyline> o_Polyline_cm;
|
||||
|
||||
bool res = ::svg_path::parsePolygon(o_Polyline_cm, draw_polygon_attlist_.draw_points_.get(),false, true);
|
||||
bool res = ::svg_path::parsePolygon(o_Polyline_cm, draw_polygon_attlist_.draw_points_.get(), false, true);
|
||||
|
||||
for (size_t ind = 0 ; ind < o_Polyline_cm.size(); ind++)
|
||||
{
|
||||
@ -341,12 +351,12 @@ void draw_polygon::reset_polygon_path()
|
||||
}
|
||||
o_Polyline_pt.push_back(poly);
|
||||
}
|
||||
if (o_Polyline_pt.size()>0)
|
||||
if (false == o_Polyline_pt.empty())
|
||||
{
|
||||
//сформируем xml-oox сдесь ... а то придется плодить массивы в drawing .. хоть и не красиво..
|
||||
std::wstringstream output_;
|
||||
::svg_path::oox_serialize(output_, o_Polyline_pt);
|
||||
additional_.push_back(odf_reader::_property(L"custom_path",output_.str()));
|
||||
additional_.push_back(odf_reader::_property(L"custom_path", output_.str()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -368,7 +378,8 @@ void draw_polyline::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
draw_polyline_attlist_.add_attributes(Attributes);
|
||||
draw_shape::add_attributes(Attributes);
|
||||
|
||||
sub_type_ = 8;
|
||||
sub_type_ = 14;
|
||||
lined_shape_ = true;
|
||||
|
||||
}
|
||||
void draw_polyline::reset_polyline_path()
|
||||
@ -382,7 +393,7 @@ void draw_polyline::reset_polyline_path()
|
||||
std::vector<::svg_path::_polyline> o_Polyline_pt;
|
||||
std::vector<::svg_path::_polyline> o_Polyline_cm;
|
||||
|
||||
bool res = ::svg_path::parsePolygon(o_Polyline_cm, draw_polyline_attlist_.draw_points_.get(), false, true);
|
||||
bool res = ::svg_path::parsePolygon(o_Polyline_cm, draw_polyline_attlist_.draw_points_.get(), false, false);
|
||||
|
||||
_CP_OPT(double) start_x, start_y;
|
||||
|
||||
@ -407,7 +418,7 @@ void draw_polyline::reset_polyline_path()
|
||||
}
|
||||
o_Polyline_pt.push_back(poly);
|
||||
}
|
||||
if (o_Polyline_pt.size()>0)
|
||||
if (false == o_Polyline_pt.empty())
|
||||
{
|
||||
//сформируем xml-oox сдесь ... а то придется плодить массивы в drawing .. хоть и не красиво..
|
||||
std::wstringstream output_;
|
||||
@ -546,9 +557,9 @@ void draw_enhanced_geometry::find_draw_type_oox()
|
||||
if (!draw_type_oox_index_)
|
||||
{
|
||||
int count = sizeof(_OO_OOX_custom_shapes) / sizeof(_shape_converter);
|
||||
int pos = odf_type.find(L"ooxml-");
|
||||
size_t pos = odf_type.find(L"ooxml-");
|
||||
|
||||
if (pos < 0)
|
||||
if (pos == std::wstring::npos)
|
||||
{
|
||||
for (long i = 0; i< count; i++)
|
||||
{
|
||||
@ -562,7 +573,7 @@ void draw_enhanced_geometry::find_draw_type_oox()
|
||||
else
|
||||
{
|
||||
std::wstring oox_type = odf_type.substr(pos + 6);
|
||||
for (long i = 0; i< count; i++)
|
||||
for (long i = 0; i < count; i++)
|
||||
{
|
||||
if (_OO_OOX_custom_shapes[i].oox == oox_type)
|
||||
{
|
||||
@ -572,7 +583,7 @@ void draw_enhanced_geometry::find_draw_type_oox()
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((draw_type_oox_index_) && (*draw_type_oox_index_== 179))//L"textBox"
|
||||
if ((draw_type_oox_index_) && (*draw_type_oox_index_== 96))//L"textBox" "mso-spt24"
|
||||
{
|
||||
sub_type_ = 1;//textBox
|
||||
}
|
||||
@ -649,21 +660,23 @@ void draw_connector::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
draw_line_attlist_.add_attributes(Attributes);
|
||||
draw_shape::add_attributes(Attributes);
|
||||
|
||||
sub_type_ = 5; //коннектор - линия, если ломаная (ниже определяется) - то путь
|
||||
|
||||
sub_type_ = 10; //коннектор - линия, если ломаная (ниже определяется) - то путь
|
||||
lined_shape_ = true;
|
||||
connector_ = true;
|
||||
}
|
||||
void draw_connector::reset_svg_path()
|
||||
{
|
||||
if (!draw_connector_attlist_.svg_d_)
|
||||
{
|
||||
bad_shape_ = true;
|
||||
}
|
||||
else
|
||||
if (draw_connector_attlist_.svg_d_)
|
||||
{
|
||||
sub_type_ = 8;
|
||||
|
||||
std::vector<::svg_path::_polyline> o_Polyline_pt;
|
||||
std::vector<::svg_path::_polyline> o_Polyline_cm;
|
||||
|
||||
bool res = ::svg_path::parseSvgD(o_Polyline_cm, draw_connector_attlist_.svg_d_.get(), false);
|
||||
bool bClosed = false;
|
||||
bool res = ::svg_path::parseSvgD(o_Polyline_cm, draw_connector_attlist_.svg_d_.get(), false, bClosed);
|
||||
|
||||
if (!bClosed) lined_shape_ = true;
|
||||
|
||||
double x1=common_draw_attlists_.position_.svg_x_.get_value_or(length(0)).get_value_unit(length::emu);
|
||||
double y1=common_draw_attlists_.position_.svg_y_.get_value_or(length(0)).get_value_unit(length::emu);
|
||||
@ -707,7 +720,7 @@ void dr3d_scene::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
draw_shape::add_attributes(Attributes);
|
||||
|
||||
sub_type_ = 10;
|
||||
sub_type_ = 12;
|
||||
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
@ -718,13 +731,22 @@ const wchar_t * dr3d_extrude::name = L"extrude";
|
||||
|
||||
void dr3d_extrude::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"svg:d", svg_d_);
|
||||
CP_APPLY_ATTR(L"svg:viewBox", svg_viewbox_);
|
||||
draw_path::add_attributes(Attributes);
|
||||
|
||||
//sub_type_ = ??
|
||||
}
|
||||
void dr3d_extrude::reset_svg_path()
|
||||
{
|
||||
if (!svg_d_) return;
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// dr3d:rotate
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * dr3d_rotate::ns = L"dr3d";
|
||||
const wchar_t * dr3d_rotate::name = L"rotate";
|
||||
|
||||
void dr3d_rotate::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
draw_path::add_attributes(Attributes);
|
||||
|
||||
//sub_type_ = ??
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// dr3d:light
|
||||
|
||||
@ -63,7 +63,7 @@ public:
|
||||
static const ElementType type = typeDrawShape;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
|
||||
draw_shape() : bad_shape_(false), word_art_(false), idx_in_owner(-1) {}
|
||||
draw_shape() : bad_shape_(false), word_art_(false), idx_in_owner(-1), lined_shape_(false), connector_(false){}
|
||||
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
friend class odf_document;
|
||||
@ -93,6 +93,8 @@ public:
|
||||
int sub_type_;
|
||||
std::vector<odf_reader::_property> additional_;
|
||||
int idx_in_owner;
|
||||
bool lined_shape_;
|
||||
bool connector_;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -285,7 +287,7 @@ public:
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_polygon);
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
//draw:contour-polygon
|
||||
class draw_contour_polygon : public draw_polygon
|
||||
{
|
||||
@ -297,9 +299,21 @@ public:
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_contour_polygon);
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
//draw:contour-path
|
||||
class draw_contour_path : public draw_path
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
|
||||
static const ElementType type = typeDrawContourPath;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_contour_path);
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
class draw_polyline_attlist
|
||||
{
|
||||
public:
|
||||
@ -572,9 +586,9 @@ public:
|
||||
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(dr3d_scene);
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//------------------------------------------------------------------------------------------------------------
|
||||
|
||||
class dr3d_extrude : public office_element_impl<dr3d_extrude>
|
||||
class dr3d_extrude : public draw_path
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -586,19 +600,31 @@ public:
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context);
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context);
|
||||
|
||||
_CP_OPT(std::wstring) svg_d_;
|
||||
_CP_OPT(std::wstring) svg_viewbox_;
|
||||
|
||||
void reset_svg_path();
|
||||
|
||||
//virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
//virtual void docx_convert(oox::docx_conversion_context & Context);
|
||||
//virtual void pptx_convert(oox::pptx_conversion_context & Context);
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(dr3d_extrude);
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//------------------------------------------------------------------------------------------------------------
|
||||
|
||||
class dr3d_rotate : public draw_path
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
|
||||
static const ElementType type = typeDr3dRotate;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
|
||||
//virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
//virtual void docx_convert(oox::docx_conversion_context & Context);
|
||||
//virtual void pptx_convert(oox::pptx_conversion_context & Context);
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(dr3d_rotate);
|
||||
//------------------------------------------------------------------------------------------------------------
|
||||
class dr3d_light : public office_element_impl<dr3d_light>
|
||||
{
|
||||
public:
|
||||
|
||||
@ -103,6 +103,7 @@ void draw_shape::common_docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
std::wstring href = fill.bitmap->xlink_href_;
|
||||
fill.bitmap->rId = Context.get_mediaitems().add_or_find(href, oox::typeImage, fill.bitmap->isInternal, href);
|
||||
fill.bitmap->name_space = L"w14";
|
||||
}
|
||||
|
||||
std::wstringstream strm_fill, strm_ln;
|
||||
@ -214,10 +215,18 @@ void draw_path::docx_convert(oox::docx_conversion_context & Context)
|
||||
void draw_connector::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
//if (Context.get_drawing_context().get_current_level() >0 )return;
|
||||
|
||||
if (draw_connector_attlist_.draw_type_)
|
||||
{
|
||||
if (*draw_connector_attlist_.draw_type_ == L"curve")
|
||||
{
|
||||
sub_type_ = 11;
|
||||
}
|
||||
}
|
||||
reset_svg_attributes();
|
||||
common_docx_convert(Context);
|
||||
//...
|
||||
reset_svg_path();
|
||||
|
||||
draw_shape::docx_convert(Context);
|
||||
}
|
||||
void draw_polygon::docx_convert(oox::docx_conversion_context & Context)
|
||||
@ -306,15 +315,17 @@ void draw_enhanced_geometry::docx_convert(oox::docx_conversion_context & Context
|
||||
std::vector<::svg_path::_polyline> o_Polyline;
|
||||
|
||||
bool res = false;
|
||||
bool bClosed = false;
|
||||
|
||||
try
|
||||
{
|
||||
res = ::svg_path::parseSvgD(o_Polyline, odf_path, true);
|
||||
res = ::svg_path::parseSvgD(o_Polyline, odf_path, true, bClosed);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
res = false;
|
||||
}
|
||||
//if (!bClosed) lined_shape_ = true;
|
||||
|
||||
if (!o_Polyline.empty() && res )
|
||||
{
|
||||
@ -392,11 +403,6 @@ void dr3d_scene::docx_convert(oox::docx_conversion_context & Context)
|
||||
//...
|
||||
draw_shape::docx_convert(Context);
|
||||
}
|
||||
void dr3d_extrude::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
reset_svg_path();
|
||||
|
||||
}
|
||||
void dr3d_light::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
|
||||
|
||||
@ -148,6 +148,9 @@ void draw_shape::common_pptx_convert(oox::pptx_conversion_context & Context)
|
||||
paragraph_format_properties paragraph_properties = calc_paragraph_properties_content(textStyleInst);
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
Context.get_slide_context().set_is_line_shape(lined_shape_);
|
||||
Context.get_slide_context().set_is_connector_shape(connector_);
|
||||
|
||||
oox::_oox_fill fill;
|
||||
Compute_GraphicFill(properties.common_draw_fill_attlist_, properties.style_background_image_,
|
||||
Context.root()->odf_context().drawStyles() ,fill);
|
||||
@ -230,6 +233,7 @@ void draw_path::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
}
|
||||
void draw_polygon::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
//closed shape
|
||||
reset_polygon_path();
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
Context.get_slide_context().start_shape(sub_type_);
|
||||
@ -238,9 +242,9 @@ void draw_polygon::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
|
||||
Context.get_slide_context().end_shape();
|
||||
}
|
||||
|
||||
void draw_polyline::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
//line
|
||||
reset_polyline_path();
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
Context.get_slide_context().start_shape(sub_type_);
|
||||
@ -249,6 +253,17 @@ void draw_polyline::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
|
||||
Context.get_slide_context().end_shape();
|
||||
}
|
||||
//void dr3d_rotate::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
//{
|
||||
// //closed shape
|
||||
// reset_polygon_path();
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// Context.get_slide_context().start_shape(sub_type_);
|
||||
//
|
||||
// common_pptx_convert(Context);
|
||||
//
|
||||
// Context.get_slide_context().end_shape();
|
||||
//}
|
||||
void draw_custom_shape::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
Context.get_slide_context().start_shape(sub_type_);
|
||||
@ -298,6 +313,13 @@ void draw_connector::reset_svg_attributes()
|
||||
}
|
||||
void draw_connector::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
if (draw_connector_attlist_.draw_type_)
|
||||
{
|
||||
if (*draw_connector_attlist_.draw_type_ == L"curve")
|
||||
{
|
||||
sub_type_ = 11;
|
||||
}
|
||||
}
|
||||
reset_svg_attributes();
|
||||
reset_svg_path();
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
@ -346,15 +368,17 @@ void draw_enhanced_geometry::pptx_convert(oox::pptx_conversion_context & Context
|
||||
std::vector<::svg_path::_polyline> o_Polyline;
|
||||
|
||||
bool res = false;
|
||||
bool bClosed =false;
|
||||
|
||||
try
|
||||
{
|
||||
res = ::svg_path::parseSvgD(o_Polyline, odf_path, true);
|
||||
res = ::svg_path::parseSvgD(o_Polyline, odf_path, true, bClosed);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
res = false;
|
||||
}
|
||||
//if (!bClosed) lined_shape_ = true;
|
||||
|
||||
if (o_Polyline.size() > 1 && res )
|
||||
{
|
||||
@ -419,11 +443,6 @@ void dr3d_scene::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
|
||||
Context.get_slide_context().end_shape();
|
||||
|
||||
}
|
||||
void dr3d_extrude::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
reset_svg_path();
|
||||
|
||||
}
|
||||
void dr3d_light::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
|
||||
@ -130,6 +130,8 @@ void draw_shape::common_xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
Context.get_drawing_context().set_property(additional_[i]);
|
||||
}
|
||||
Context.get_drawing_context().set_is_line_shape(lined_shape_);
|
||||
Context.get_drawing_context().set_is_connector_shape(connector_);
|
||||
|
||||
oox::_oox_fill fill;
|
||||
Compute_GraphicFill(properties.common_draw_fill_attlist_, properties.style_background_image_,
|
||||
@ -211,6 +213,15 @@ void draw_path::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
|
||||
void draw_connector::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
if (draw_connector_attlist_.draw_type_)
|
||||
{
|
||||
if (*draw_connector_attlist_.draw_type_ == L"curve")
|
||||
{
|
||||
sub_type_ = 11;
|
||||
}
|
||||
}
|
||||
reset_svg_attributes();
|
||||
|
||||
reset_svg_path();
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
Context.get_drawing_context().start_shape(6);
|
||||
@ -291,15 +302,17 @@ void draw_enhanced_geometry::xlsx_convert(oox::xlsx_conversion_context & Context
|
||||
std::vector<::svg_path::_polyline> o_Polyline;
|
||||
|
||||
bool res = false;
|
||||
bool bClosed = false;
|
||||
|
||||
try
|
||||
{
|
||||
res = ::svg_path::parseSvgD(o_Polyline, odf_path, true);
|
||||
res = ::svg_path::parseSvgD(o_Polyline, odf_path, true, bClosed);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
res = false;
|
||||
}
|
||||
//if (!bClosed) lined_shape_ = true;
|
||||
|
||||
if (o_Polyline.size() > 1 && res )
|
||||
{
|
||||
@ -356,11 +369,6 @@ void dr3d_scene::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
Context.get_drawing_context().end_shape();
|
||||
Context.get_drawing_context().clear();
|
||||
}
|
||||
void dr3d_extrude::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
reset_svg_path();
|
||||
|
||||
}
|
||||
void dr3d_light::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
|
||||
|
||||
@ -332,22 +332,6 @@ bool odf_document::Impl::decrypt_folder (const std::wstring &password, const std
|
||||
}
|
||||
return result;
|
||||
}
|
||||
std::string DecodeBase64(const std::wstring & value1)
|
||||
{
|
||||
int nLength = 0;
|
||||
unsigned char *pData = NULL;
|
||||
std::string result;
|
||||
|
||||
std::string value(value1.begin(), value1.end());
|
||||
|
||||
NSFile::CBase64Converter::Decode(value.c_str(), value.length(), pData, nLength);
|
||||
if (pData)
|
||||
{
|
||||
result = std::string((char*)pData, nLength);
|
||||
delete []pData; pData = NULL;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
bool odf_document::Impl::decrypt_file (const std::wstring &password, const std::wstring & srcPath, const std::wstring & dstPath, office_element_ptr element, int file_size )
|
||||
{
|
||||
manifest_encryption_data* encryption_data = dynamic_cast<manifest_encryption_data*>(element.get());
|
||||
@ -988,6 +972,28 @@ void odf_document::Impl::parse_styles(office_element *element)
|
||||
continue;
|
||||
|
||||
context_->Templates().add(L"table:" + style->get_text_style_name(), elm);
|
||||
}
|
||||
for (size_t i = 0; i < docStyles->draw_styles_.draw_marker_.size(); i++)
|
||||
{
|
||||
office_element_ptr & elm = docStyles->draw_styles_.draw_marker_[i];
|
||||
|
||||
draw_marker * style = dynamic_cast<draw_marker *>(elm.get());
|
||||
|
||||
if (!style)
|
||||
continue;
|
||||
|
||||
context_->drawStyles().add(L"marker:" + style->get_style_name(), elm);
|
||||
}
|
||||
for (size_t i = 0; i < docStyles->draw_styles_.draw_stroke_dash_.size(); i++)
|
||||
{
|
||||
office_element_ptr & elm = docStyles->draw_styles_.draw_stroke_dash_[i];
|
||||
|
||||
draw_stroke_dash * style = dynamic_cast<draw_stroke_dash *>(elm.get());
|
||||
|
||||
if (!style)
|
||||
continue;
|
||||
|
||||
context_->drawStyles().add(L"stroke_dash:" + style->get_style_name(), elm);
|
||||
}
|
||||
}
|
||||
while(0); // end parse styles
|
||||
|
||||
@ -35,7 +35,23 @@
|
||||
namespace cpdoccore {
|
||||
|
||||
using namespace odf_types;
|
||||
|
||||
std::string DecodeBase64(const std::wstring & value1)
|
||||
{
|
||||
int nLength = 0;
|
||||
unsigned char *pData = NULL;
|
||||
std::string result;
|
||||
|
||||
std::string value(value1.begin(), value1.end());
|
||||
|
||||
NSFile::CBase64Converter::Decode(value.c_str(), value.length(), pData, nLength);
|
||||
if (pData)
|
||||
{
|
||||
result = std::string((char*)pData, nLength);
|
||||
delete []pData; pData = NULL;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
namespace odf_reader {
|
||||
|
||||
style_instance::style_instance(
|
||||
|
||||
@ -44,6 +44,9 @@
|
||||
#include <iosfwd>
|
||||
|
||||
namespace cpdoccore {
|
||||
|
||||
std::string DecodeBase64(const std::wstring & value);
|
||||
|
||||
namespace odf_reader {
|
||||
|
||||
class styles_container;
|
||||
|
||||
@ -284,6 +284,7 @@ void form_button::docx_convert(oox::docx_conversion_context & Context)
|
||||
void form_button::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
Context.get_forms_context().start_element(1);
|
||||
Context.get_forms_context().set_element(dynamic_cast<form_element*>(this));
|
||||
|
||||
form_element::xlsx_convert(Context);
|
||||
}
|
||||
|
||||
@ -169,7 +169,7 @@ public:
|
||||
|
||||
virtual void visit(const table_table& val)
|
||||
{
|
||||
if (visit_table(val.table_table_attlist_.table_name_.get_value_or(L"")))
|
||||
if (visit_table(val.attlist_.table_name_.get_value_or(L"")))
|
||||
{
|
||||
ACCEPT_ALL_CONTENT_CONST(val.table_columns_and_groups_.content_, stop_);
|
||||
ACCEPT_ALL_CONTENT_CONST(val.table_rows_and_groups_.content_, stop_);
|
||||
|
||||
@ -108,11 +108,26 @@ void graphic_format_properties::apply_to(std::vector<_property> & properties)
|
||||
|
||||
if (draw_stroke_) properties.push_back(_property(L"stroke", draw_stroke_->get_type() ));
|
||||
if (svg_stroke_color_) properties.push_back(_property(L"stroke-color", svg_stroke_color_->get_hex_value() ));
|
||||
if (draw_stroke_dash_) properties.push_back(_property(L"stroke-dash", draw_stroke_dash_.get()));
|
||||
if (draw_stroke_dash_)
|
||||
{
|
||||
if (!draw_stroke_dash_->empty())
|
||||
properties.push_back(_property(L"stroke-dash", draw_stroke_dash_.get()));
|
||||
}
|
||||
if (svg_stroke_width_) properties.push_back(_property(L"stroke-width", svg_stroke_width_->get_length().get_value_unit(odf_types::length::pt) ));
|
||||
if (svg_stroke_opacity_)properties.push_back(_property(L"stroke-opacity",svg_stroke_opacity_->get_percent().get_value()));
|
||||
if (draw_marker_start_) properties.push_back(_property(L"marker-start", draw_marker_start_->get() ));
|
||||
if (draw_marker_end_) properties.push_back(_property(L"marker-end", draw_marker_end_->get() ));
|
||||
if (draw_marker_start_)
|
||||
{
|
||||
properties.push_back(_property(L"marker-start", draw_marker_start_->get() ));
|
||||
}
|
||||
if (draw_marker_end_)
|
||||
{
|
||||
//const std::wstring style_name = draw_marker_end_->get();
|
||||
//if (!style_name.empty())
|
||||
////if (office_element_ptr style = styles.find_by_style_name(style_name))
|
||||
//{
|
||||
properties.push_back(_property(L"marker-end", draw_marker_end_->get() ));
|
||||
//}
|
||||
}
|
||||
|
||||
if (draw_textarea_horizontal_align_)properties.push_back(_property(L"textarea-horizontal_align",draw_textarea_horizontal_align_->get_type() ));
|
||||
if (draw_textarea_vertical_align_) properties.push_back(_property(L"textarea-vertical_align", draw_textarea_vertical_align_->get_type() ));
|
||||
@ -122,6 +137,18 @@ void graphic_format_properties::apply_to(std::vector<_property> & properties)
|
||||
if (draw_fit_to_size_) properties.push_back(_property(L"fit-to-size", *draw_fit_to_size_));
|
||||
if (draw_fit_to_contour_) properties.push_back(_property(L"fit-to-contour", *draw_fit_to_contour_));
|
||||
|
||||
if (common_draw_fill_attlist_.draw_color_mode_)
|
||||
{
|
||||
properties.push_back(_property(L"color-mode", *common_draw_fill_attlist_.draw_color_mode_));
|
||||
}
|
||||
if (common_draw_fill_attlist_.draw_luminance_)
|
||||
{
|
||||
properties.push_back(_property(L"luminance", common_draw_fill_attlist_.draw_luminance_->get_value()));
|
||||
}
|
||||
if (common_draw_fill_attlist_.draw_contrast_)
|
||||
{
|
||||
properties.push_back(_property(L"contrast", common_draw_fill_attlist_.draw_contrast_->get_value()));
|
||||
}
|
||||
if (common_padding_attlist_.fo_padding_)
|
||||
{
|
||||
properties.push_back(_property(L"text-padding-left", common_padding_attlist_.fo_padding_->get_value_unit(length::emu)));
|
||||
|
||||
@ -529,7 +529,18 @@ void text_format_properties_content::drawing_serialize(std::wostream & strm, std
|
||||
CP_XML_NODE(L"a:cs"){CP_XML_ATTR(L"typeface", delete_apostroph_in_name(w_cs));}
|
||||
}
|
||||
}
|
||||
if ((fo_background_color_) && (fo_background_color_->get_type() == odf_types::background_color::Enabled ))
|
||||
{
|
||||
std::wstring strRGB = fo_background_color_->get_color().get_hex_value(); //auto ... не нужно
|
||||
if (!strRGB.empty())
|
||||
{
|
||||
CP_XML_NODE(L"a:highlight")
|
||||
{
|
||||
CP_XML_NODE(L"a:srgbClr") {CP_XML_ATTR(L"val", strRGB);}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (!hlink.empty())
|
||||
{
|
||||
CP_XML_NODE(L"a:hlinkClick")
|
||||
|
||||
@ -329,7 +329,44 @@ void draw_fill_image::add_child_element( xml::sax * Reader, const std::wstring &
|
||||
{
|
||||
CP_NOT_APPLICABLE_ELM();
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//----------------------------------------------------------------------------------------
|
||||
const wchar_t * draw_marker::ns = L"draw";
|
||||
const wchar_t * draw_marker::name = L"marker";
|
||||
|
||||
void draw_marker::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"draw:name" , draw_name_);
|
||||
CP_APPLY_ATTR(L"draw:display-name" , draw_display_name_);
|
||||
|
||||
CP_APPLY_ATTR(L"svg:d" , svg_d_);
|
||||
CP_APPLY_ATTR(L"svg:viewBox" , svg_viewBox_);
|
||||
}
|
||||
void draw_marker::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
CP_NOT_APPLICABLE_ELM();
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
const wchar_t * draw_stroke_dash::ns = L"draw";
|
||||
const wchar_t * draw_stroke_dash::name = L"stroke-dash";
|
||||
|
||||
void draw_stroke_dash::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"draw:name" , draw_name_);
|
||||
CP_APPLY_ATTR(L"draw:display-name" , draw_display_name_);
|
||||
|
||||
CP_APPLY_ATTR(L"draw:distance" , draw_distance_);
|
||||
CP_APPLY_ATTR(L"draw:dots1-length" , draw_dots1_length_);
|
||||
CP_APPLY_ATTR(L"draw:dots2-length" , draw_dots2_length_);
|
||||
CP_APPLY_ATTR(L"draw:dots1" , draw_dots1_);
|
||||
CP_APPLY_ATTR(L"draw:dots2" , draw_dots2_);
|
||||
CP_APPLY_ATTR(L"draw:style" , draw_style_);//"square"
|
||||
|
||||
}
|
||||
void draw_stroke_dash::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
CP_NOT_APPLICABLE_ELM();
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
const wchar_t * draw_gradient::ns = L"draw";
|
||||
const wchar_t * draw_gradient::name = L"gradient";
|
||||
|
||||
|
||||
@ -119,8 +119,7 @@ private:
|
||||
|
||||
};
|
||||
|
||||
// default_style
|
||||
/// style:default-style
|
||||
// style:default-style
|
||||
class default_style : public office_element_impl<default_style>
|
||||
{
|
||||
public:
|
||||
@ -147,10 +146,69 @@ private:
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(default_style);
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// draw:marker
|
||||
class draw_marker : public office_element_impl<draw_marker>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeStyleDrawMarker;
|
||||
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// style_draw_gradient
|
||||
std::wstring get_style_name(){return draw_name_.get_value_or(L"");}
|
||||
|
||||
_CP_OPT(std::wstring) svg_d_;
|
||||
_CP_OPT(std::wstring) svg_viewBox_;
|
||||
_CP_OPT(std::wstring) draw_name_;
|
||||
_CP_OPT(std::wstring) draw_display_name_;
|
||||
|
||||
friend class odf_document;
|
||||
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_marker);
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// draw:stroke-dash
|
||||
class draw_stroke_dash : public office_element_impl<draw_stroke_dash>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeStyleDrawStrokeDash;
|
||||
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
std::wstring get_style_name(){return draw_name_.get_value_or(L"");}
|
||||
|
||||
_CP_OPT(odf_types::length_or_percent) draw_distance_;
|
||||
_CP_OPT(odf_types::length_or_percent) draw_dots1_length_;
|
||||
_CP_OPT(odf_types::length_or_percent) draw_dots2_length_;
|
||||
|
||||
_CP_OPT(int) draw_dots1_;
|
||||
_CP_OPT(int) draw_dots2_;
|
||||
|
||||
_CP_OPT(std::wstring) draw_style_; //rect or round:
|
||||
_CP_OPT(std::wstring) draw_name_;
|
||||
_CP_OPT(std::wstring) draw_display_name_;
|
||||
|
||||
friend class odf_document;
|
||||
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_stroke_dash);
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// draw:gradient
|
||||
class draw_gradient : public office_element_impl<draw_gradient>
|
||||
{
|
||||
public:
|
||||
@ -189,7 +247,7 @@ private:
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_gradient);
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// style_draw_hatch
|
||||
// draw:hatch
|
||||
class draw_hatch : public office_element_impl<draw_hatch>
|
||||
{
|
||||
public:
|
||||
@ -355,8 +413,8 @@ public:
|
||||
office_element_ptr_array draw_opacity_;
|
||||
office_element_ptr_array draw_hatch_;
|
||||
|
||||
office_element_ptr_array draw_marker_; // < TODO
|
||||
office_element_ptr_array draw_stroke_dash_; // < TODO
|
||||
office_element_ptr_array draw_marker_;
|
||||
office_element_ptr_array draw_stroke_dash_;
|
||||
|
||||
office_element_ptr_array svg_linearGradient_; // < TODO
|
||||
office_element_ptr_array svg_radialGradient_; // < TODO
|
||||
|
||||
@ -185,12 +185,11 @@ namespace svg_path
|
||||
return bUseRelativeCoordinates ? cLowerCaseCommand : cUpperCaseCommand;
|
||||
}
|
||||
|
||||
bool parseSvgD(std::vector<_polyline> & Polyline, const std::wstring & rSvgDStatement, bool bWrongPositionAfterZ)
|
||||
bool parseSvgD(std::vector<_polyline> & Polyline, const std::wstring & rSvgDStatement, bool bWrongPositionAfterZ, bool & bIsClosed)
|
||||
{
|
||||
Polyline.clear();
|
||||
const int nLen(rSvgDStatement.length());
|
||||
int nPos(0);
|
||||
bool bIsClosed(false);
|
||||
|
||||
double nLastX( 0.0 );
|
||||
double nLastY( 0.0 );
|
||||
@ -200,6 +199,8 @@ namespace svg_path
|
||||
|
||||
_polyline aCurrPoly;
|
||||
|
||||
bIsClosed = false;
|
||||
|
||||
// skip initial whitespace
|
||||
skipSpaces(nPos, rSvgDStatement, nLen);
|
||||
|
||||
|
||||
@ -58,7 +58,7 @@ namespace svg_path
|
||||
};
|
||||
|
||||
bool parseVml(std::vector<_polyline> & Polyline, const std::wstring & path);
|
||||
bool parseSvgD(std::vector<_polyline> & Polyline, const std::wstring & path, bool bWrongPositionAfterZ);
|
||||
bool parseSvgD(std::vector<_polyline> & Polyline, const std::wstring & path, bool bWrongPositionAfterZ, bool & bIsClosed);
|
||||
bool parsePolygon(std::vector<_polyline> & Polyline, const std::wstring & path, bool bWrongPositionAfterZ, bool closed);
|
||||
}
|
||||
|
||||
|
||||
@ -57,6 +57,8 @@ void table_table_attlist::add_attributes( const xml::attributes_wc_ptr & Attribu
|
||||
|
||||
CP_APPLY_ATTR(L"table:protected", table_protected_, false);
|
||||
CP_APPLY_ATTR(L"table:protection-key", table_protection_key_);
|
||||
CP_APPLY_ATTR(L"table:protection-key-digest-algorithm", table_protection_key_digest_algorithm_);
|
||||
|
||||
CP_APPLY_ATTR(L"table:print", table_print_, true);
|
||||
CP_APPLY_ATTR(L"table:print-ranges", table_print_ranges_);
|
||||
|
||||
@ -134,7 +136,23 @@ void table_table_source::add_child_element( xml::sax * Reader, const std::wstrin
|
||||
{
|
||||
CP_NOT_APPLICABLE_ELM();
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// table:table-protection
|
||||
const wchar_t * table_table_protection::ns = L"loext"; //?? table odf 1.3
|
||||
const wchar_t * table_table_protection::name = L"table-protection";
|
||||
|
||||
void table_table_protection::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"loext:select-protected-cells", select_protected_cells);
|
||||
CP_APPLY_ATTR(L"loext:select-unprotected-cells",select_unprotected_cells);
|
||||
CP_APPLY_ATTR(L"loext:insert-columns", insert_columns);
|
||||
CP_APPLY_ATTR(L"loext:insert-rows", insert_rows);
|
||||
CP_APPLY_ATTR(L"loext:delete-columns", delete_columns);
|
||||
CP_APPLY_ATTR(L"loext:delete-rows", delete_rows);
|
||||
//CP_APPLY_ATTR(L"loext:format-columns", format_columns);
|
||||
//CP_APPLY_ATTR(L"loext:format-rows", format_rows);
|
||||
//CP_APPLY_ATTR(L"loext:format-cells", format_cells);
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// table:table
|
||||
const wchar_t * table_table::ns = L"table";
|
||||
@ -144,7 +162,7 @@ void table_table::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"table:style-name", element_style_name);
|
||||
|
||||
table_table_attlist_.add_attributes(Attributes);
|
||||
attlist_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
void table_table::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
@ -172,9 +190,13 @@ void table_table::add_child_element( xml::sax * Reader, const std::wstring & Ns,
|
||||
else if CP_CHECK_NAME(L"table", L"shapes")
|
||||
{
|
||||
CP_CREATE_ELEMENT(table_shapes_);
|
||||
}
|
||||
else if ( L"table-protection" == Name) //ns = loext or table
|
||||
{
|
||||
CP_CREATE_ELEMENT(table_protection_);
|
||||
}
|
||||
else if ( CP_CHECK_NAME(L"table", L"named-expressions") ||
|
||||
CP_CHECK_NAME(L"table", L"named-range") ) //???
|
||||
CP_CHECK_NAME(L"table", L"named-range") )
|
||||
{
|
||||
CP_CREATE_ELEMENT(table_named_);
|
||||
}
|
||||
|
||||
@ -61,15 +61,17 @@ public:
|
||||
_CP_OPT(std::wstring) table_style_name_;
|
||||
_CP_OPT(std::wstring) table_template_name_;
|
||||
|
||||
bool table_protected_; // default false
|
||||
bool table_protected_; // default false
|
||||
_CP_OPT(std::wstring) table_protection_key_;
|
||||
bool table_print_; // default true
|
||||
_CP_OPT(std::wstring) table_protection_key_digest_algorithm_;
|
||||
|
||||
bool table_print_; // default true
|
||||
_CP_OPT(std::wstring) table_print_ranges_;
|
||||
|
||||
bool table_use_first_row_styles_; // default false;
|
||||
bool table_use_banding_rows_styles_; //defualt false;
|
||||
bool table_use_first_column_styles_; //defualt false;
|
||||
bool table_use_banding_columns_styles_; //defualt false;
|
||||
bool table_use_banding_rows_styles_; // defualt false;
|
||||
bool table_use_first_column_styles_; // defualt false;
|
||||
bool table_use_banding_columns_styles_; // defualt false;
|
||||
|
||||
friend class table_table;
|
||||
};
|
||||
@ -617,6 +619,38 @@ public:
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(table_table_row_group);
|
||||
|
||||
class table_table_protection : public office_element_impl<table_table_protection>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeTableTableProtection;
|
||||
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context) {}
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context) {}
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context) {}
|
||||
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
|
||||
|
||||
public:
|
||||
_CP_OPT(bool) select_protected_cells;
|
||||
_CP_OPT(bool) select_unprotected_cells;
|
||||
_CP_OPT(bool) insert_columns;
|
||||
_CP_OPT(bool) insert_rows;
|
||||
|
||||
_CP_OPT(bool) delete_columns;
|
||||
_CP_OPT(bool) delete_rows;
|
||||
//_CP_OPT(bool) format_columns; //???
|
||||
//_CP_OPT(bool) format_rows;
|
||||
//_CP_OPT(bool) format_cells;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(table_table_protection);
|
||||
|
||||
class table_table : public office_element_impl<table_table>
|
||||
{
|
||||
public:
|
||||
@ -636,7 +670,9 @@ private:
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
public:
|
||||
table_table_attlist table_table_attlist_;
|
||||
table_table_attlist attlist_;
|
||||
|
||||
office_element_ptr table_protection_;
|
||||
|
||||
table_columns_and_groups table_columns_and_groups_;
|
||||
table_rows_and_groups table_rows_and_groups_;
|
||||
|
||||
@ -87,6 +87,7 @@ void table_data_pilot_table::add_child_element( xml::sax * Reader, const std::ws
|
||||
CP_CREATE_ELEMENT (source_);
|
||||
|
||||
}
|
||||
|
||||
void table_data_pilot_table::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
if (!source_) return;
|
||||
@ -105,6 +106,8 @@ void table_data_pilot_table::xlsx_convert(oox::xlsx_conversion_context & Context
|
||||
std::wstring ref = formulas_converter.convert_named_ref(*table_target_range_address_, false);
|
||||
sheet_name = formulas_converter.get_table_name();
|
||||
|
||||
Context.get_table_context().check_database_range_intersection(sheet_name, ref);
|
||||
|
||||
Context.get_pivots_context().set_view_target_range(ref);
|
||||
Context.get_pivots_context().set_view_target_table_name(sheet_name);
|
||||
}
|
||||
@ -195,10 +198,12 @@ void table_data_pilot_field::xlsx_convert(oox::xlsx_conversion_context & Context
|
||||
|
||||
if (type == table_function::String)
|
||||
{
|
||||
formulasconvert::odf2oox_converter formulas_converter;
|
||||
std::wstring formula = table_function_->get_string();
|
||||
|
||||
std::wstring user_funtion = formulas_converter.convert(table_function_->get_string());
|
||||
Context.get_pivots_context().set_field_user_function(user_funtion);
|
||||
formulasconvert::odf2oox_converter formulas_converter;
|
||||
std::wstring oox_formula = formulas_converter.convert(formula);
|
||||
|
||||
Context.get_pivots_context().set_field_user_function(oox_formula);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -88,24 +88,43 @@ void table_database_range::add_child_element( xml::sax * Reader, const std::wstr
|
||||
void table_database_range::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
if (!table_target_range_address_) return;
|
||||
if (!table_name_) return;
|
||||
|
||||
Context.get_table_context().start_database_range(table_name_.get_value_or(L""), *table_target_range_address_);
|
||||
|
||||
if (table_display_filter_buttons_)
|
||||
Context.get_table_context().set_database_filter(table_display_filter_buttons_->get());
|
||||
std::wstring name = table_name_.get();
|
||||
|
||||
if (table_orientation_)
|
||||
Context.get_table_context().set_database_orientation(table_orientation_->get_type() == table_orientation::row ? true : false);
|
||||
|
||||
if (table_contains_header_)
|
||||
Context.get_table_context().set_database_header(table_contains_header_->get());
|
||||
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
std::map<std::wstring, int>::iterator pFind = Context.mapUsedNames_.find(name);
|
||||
if (pFind == Context.mapUsedNames_.end())
|
||||
{
|
||||
content_[i]->xlsx_convert(Context);
|
||||
Context.mapUsedNames_.insert(std::make_pair(name, 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
name += L"_" + std::to_wstring(pFind->second);
|
||||
pFind->second++;
|
||||
}
|
||||
|
||||
if (Context.get_table_context().start_database_range(name, *table_target_range_address_))
|
||||
{
|
||||
if (table_display_filter_buttons_)
|
||||
Context.get_table_context().set_database_filter(table_display_filter_buttons_->get());
|
||||
|
||||
Context.get_table_context().end_database_range();
|
||||
if (table_orientation_)
|
||||
Context.get_table_context().set_database_orientation(table_orientation_->get_type() == table_orientation::row ? true : false);
|
||||
|
||||
if (table_contains_header_)
|
||||
Context.get_table_context().set_database_header(table_contains_header_->get());
|
||||
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->xlsx_convert(Context);
|
||||
}
|
||||
|
||||
Context.get_table_context().end_database_range();
|
||||
}
|
||||
else
|
||||
{
|
||||
Context.get_xlsx_defined_names().add(name, table_target_range_address_.get(), false, -1);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@ -171,10 +171,10 @@ void table_table::docx_convert(oox::docx_conversion_context & Context)
|
||||
}
|
||||
}
|
||||
|
||||
bool sub_table = table_table_attlist_.table_is_sub_table_.get_value_or(false);
|
||||
bool sub_table = attlist_.table_is_sub_table_.get_value_or(false);
|
||||
//todooo придумать как сделать внешние границы sub-таблицы границами внешней ячейки (чтоб слияние произошло)
|
||||
|
||||
std::wstring tableStyleName = table_table_attlist_.table_style_name_.get_value_or(L"");
|
||||
std::wstring tableStyleName = attlist_.table_style_name_.get_value_or(L"");
|
||||
|
||||
_Wostream << L"<w:tbl>";
|
||||
|
||||
|
||||
@ -94,8 +94,19 @@ void table_named_range::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
tableId = Context.get_table_context().state()->get_table_id();
|
||||
}
|
||||
oox::xlsx_defined_names & ctx = Context.get_xlsx_defined_names();
|
||||
ctx.add(table_name_.get(), table_cell_range_address_.get(), false, tableId);
|
||||
std::wstring name = table_name_.get();
|
||||
std::map<std::wstring, int>::iterator pFind = Context.mapUsedNames_.find(name);
|
||||
if (pFind == Context.mapUsedNames_.end())
|
||||
{
|
||||
Context.mapUsedNames_.insert(std::make_pair(name, 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
name += L"_" + std::to_wstring(pFind->second);
|
||||
pFind->second++;
|
||||
}
|
||||
|
||||
Context.get_xlsx_defined_names().add(name, table_cell_range_address_.get(), false, tableId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -130,8 +141,18 @@ void table_named_expression::xlsx_convert(oox::xlsx_conversion_context & Context
|
||||
{
|
||||
tableId = Context.get_table_context().state()->get_table_id();
|
||||
}
|
||||
oox::xlsx_defined_names & ctx = Context.get_xlsx_defined_names();
|
||||
ctx.add(table_name_.get(), table_expression_.get(), true, tableId);
|
||||
std::wstring name = table_name_.get();
|
||||
std::map<std::wstring, int>::iterator pFind = Context.mapUsedNames_.find(name);
|
||||
if (pFind == Context.mapUsedNames_.end())
|
||||
{
|
||||
Context.mapUsedNames_.insert(std::make_pair(name, 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
name += L"_" + std::to_wstring(pFind->second);
|
||||
pFind->second++;
|
||||
}
|
||||
Context.get_xlsx_defined_names().add(name, table_expression_.get(), true, tableId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -159,13 +159,13 @@ void table_table::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
Context.get_slide_context().start_table();
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
std::wstring tableStyleName = table_table_attlist_.table_style_name_.get_value_or(L"");
|
||||
std::wstring tableStyleName = attlist_.table_style_name_.get_value_or(L"");
|
||||
|
||||
Context.get_table_context().start_table(tableStyleName);
|
||||
|
||||
if (table_table_attlist_.table_template_name_)
|
||||
if (attlist_.table_template_name_)
|
||||
{
|
||||
std::wstring name = L"table:" + table_table_attlist_.table_template_name_.get() ;
|
||||
std::wstring name = L"table:" + attlist_.table_template_name_.get() ;
|
||||
if (office_element_ptr style = Context.root()->odf_context().Templates().find_by_style_name(name))
|
||||
{
|
||||
if (table_table_template* template_ = dynamic_cast<table_table_template *>(style.get()))
|
||||
@ -184,13 +184,13 @@ void table_table::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
_Wostream << L"<a:tbl>";
|
||||
|
||||
_Wostream << L"<a:tblPr";
|
||||
if (table_table_attlist_.table_use_banding_rows_styles_)
|
||||
if (attlist_.table_use_banding_rows_styles_)
|
||||
_Wostream << L" bandRow=\"1\"";
|
||||
if (table_table_attlist_.table_use_first_row_styles_)
|
||||
if (attlist_.table_use_first_row_styles_)
|
||||
_Wostream << L" firstRow=\"1\"";
|
||||
if (table_table_attlist_.table_use_banding_columns_styles_)
|
||||
if (attlist_.table_use_banding_columns_styles_)
|
||||
_Wostream << L" bandCol=\"1\"";
|
||||
if (table_table_attlist_.table_use_first_column_styles_)
|
||||
if (attlist_.table_use_first_column_styles_)
|
||||
_Wostream << L" firstCol=\"1\"";
|
||||
_Wostream << ">";
|
||||
|
||||
|
||||
@ -69,9 +69,10 @@ int table_table_cell_content::xlsx_convert(oox::xlsx_conversion_context & Contex
|
||||
for (size_t i = 0 ; i < elements_.size(); i++)
|
||||
{
|
||||
elements_[i]->xlsx_convert(Context);
|
||||
}
|
||||
}
|
||||
|
||||
const int sharedStrId = Context.get_table_context().end_cell_content();
|
||||
|
||||
return sharedStrId;
|
||||
}
|
||||
|
||||
@ -318,8 +319,8 @@ void table_table_row_group::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
|
||||
void table_table::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
const std::wstring tableStyleName = table_table_attlist_.table_style_name_.get_value_or(L"");
|
||||
const std::wstring tableName = table_table_attlist_.table_name_.get_value_or(L"");
|
||||
const std::wstring tableStyleName = attlist_.table_style_name_.get_value_or(L"");
|
||||
const std::wstring tableName = attlist_.table_name_.get_value_or(L"");
|
||||
|
||||
_CP_LOG << L"[info][xlsx] process table \"" << tableName << L"\"\n" << std::endl;
|
||||
|
||||
@ -339,6 +340,16 @@ void table_table::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
}
|
||||
Context.start_table(tableName, tableStyleName);
|
||||
|
||||
if (attlist_.table_protected_)
|
||||
{
|
||||
Context.get_table_context().set_protection(true, attlist_.table_protection_key_.get_value_or(L""),
|
||||
attlist_.table_protection_key_digest_algorithm_.get_value_or(L""));
|
||||
table_table_protection* prot = dynamic_cast<table_table_protection*>( table_protection_.get() );
|
||||
if (prot)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
table_columns_and_groups_.xlsx_convert(Context);
|
||||
|
||||
// check last rows for equal style and empties - collapsed
|
||||
@ -431,8 +442,8 @@ namespace {
|
||||
// see ECMA-376 page 1768
|
||||
|
||||
double pixToSize(double pixels, double maxDigitSize)
|
||||
{
|
||||
return (int(( pixels - 5)/ maxDigitSize * 100. + 0.5)) /100. * 0.9;
|
||||
{
|
||||
return (int(( pixels /*/ 0.75*/ - 5)/ maxDigitSize * 100. + 0.5)) /100. * 0.9; // * 9525. * 72.0 / (360000.0 * 2.54);
|
||||
}
|
||||
double cmToChars (double cm)
|
||||
{
|
||||
@ -840,9 +851,31 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
|
||||
const int sharedStringId = content_.xlsx_convert(Context, &textFormatProperties);
|
||||
|
||||
if (t_val == oox::XlsxCellType::str && sharedStringId >= 0)
|
||||
t_val = oox::XlsxCellType::s;//в случае текста, если он есть берем кэшированное значение
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
if (t_val == oox::XlsxCellType::str || t_val == oox::XlsxCellType::inlineStr)
|
||||
{
|
||||
int index = Context.get_table_context().in_database_range();
|
||||
|
||||
if (index >= 0)
|
||||
{
|
||||
if (sharedStringId >= 0)
|
||||
{
|
||||
std::wstringstream strm;
|
||||
content_.text_to_stream(strm);
|
||||
|
||||
Context.get_table_context().set_database_range_value(index, strm.str());
|
||||
}
|
||||
else if (str_val)
|
||||
{
|
||||
Context.get_table_context().set_database_range_value(index, str_val.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (t_val == oox::XlsxCellType::str && sharedStringId >= 0)
|
||||
{
|
||||
t_val = oox::XlsxCellType::s;//в случае текста, если он есть берем кэшированное значение
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
if (skip_next_cell)break;
|
||||
|
||||
// пустые ячейки пропускаем.
|
||||
@ -1125,7 +1158,7 @@ void table_covered_table_cell::xlsx_convert(oox::xlsx_conversion_context & Conte
|
||||
|
||||
const int sharedStringId = content_.xlsx_convert(Context, &textFormatProperties);
|
||||
|
||||
if (t_val == oox::XlsxCellType::str && sharedStringId >=0)
|
||||
if (t_val == oox::XlsxCellType::str && sharedStringId >= 0)
|
||||
t_val = oox::XlsxCellType::s;//в случае текста, если он есть берем кэшированное значение
|
||||
|
||||
if (skip_next_cell)break;
|
||||
@ -1143,7 +1176,7 @@ void table_covered_table_cell::xlsx_convert(oox::xlsx_conversion_context & Conte
|
||||
|
||||
if (!formula.empty())
|
||||
{
|
||||
const std::wstring xlsxFormula = formulas_converter.convert(formula);
|
||||
const std::wstring xlsxFormula = formulas_converter.convert(formula);
|
||||
if (!xlsxFormula.empty())
|
||||
{
|
||||
CP_XML_NODE(L"f")
|
||||
|
||||
@ -125,7 +125,7 @@ void process_paragraph_index(const paragraph_attrs & Attr, oox::docx_conversion_
|
||||
std::wostream & paragraph::text_to_stream(std::wostream & _Wostream) const
|
||||
{
|
||||
CP_SERIALIZE_TEXT(content_);
|
||||
_Wostream << L"\n";
|
||||
//_Wostream << L"\n";
|
||||
return _Wostream;
|
||||
}
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
AdditionalIncludeDirectories="..\include"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
|
||||
@ -96,7 +96,7 @@ HRESULT convert_single(std::wstring srcFileName)
|
||||
|
||||
Oox2Odf::Converter converter(srcTempPath, type, L"C:\\Windows\\Fonts", NULL);
|
||||
|
||||
std::wstring sPassword = L"password";
|
||||
std::wstring sPassword;// = L"password";
|
||||
|
||||
converter.convert();
|
||||
converter.write(dstTempPath, srcTempPath, sPassword, L"hiuh56f56tfy7g");
|
||||
|
||||
@ -42,9 +42,9 @@ static const _sh_typ Shape_Types_Mapping[] = // index === OOX::Drawing::EShapeTy
|
||||
{ L"" , 7}, // shapetypeAccentBorderCallout1 = 0,
|
||||
{ L"" , 7}, // shapetypeAccentBorderCallout2,
|
||||
{ L"" , 7}, // shapetypeAccentBorderCallout3,
|
||||
{ L"mso-spt44" , 7}, // shapetypeAccentCallout1,
|
||||
{ L"mso-spt45" , 7}, // shapetypeAccentCallout2,
|
||||
{ L"mso-spt46" , 7}, // shapetypeAccentCallout3,
|
||||
{ L"" , 7}, // shapetypeAccentCallout1,
|
||||
{ L"" , 7}, // shapetypeAccentCallout2,
|
||||
{ L"" , 7}, // shapetypeAccentCallout3,
|
||||
{ L"actionButtonBackPrevious" , 7}, // shapetypeActionButtonBackPrevious, //mso-spt194
|
||||
{ L"mso-spt196" , 7}, // shapetypeActionButtonBeginning,
|
||||
{ L"mso-spt189" , 7}, // shapetypeActionButtonBlank,
|
||||
@ -58,23 +58,23 @@ static const _sh_typ Shape_Types_Mapping[] = // index === OOX::Drawing::EShapeTy
|
||||
{ L"mso-spt197" , 7}, // shapetypeActionButtonReturn,
|
||||
{ L"mso-spt199" , 7}, // shapetypeActionButtonSound,
|
||||
{ L"" , 7}, // shapetypeArc,
|
||||
{ L"mso-spt91" , 7}, // shapetypeBentArrow,
|
||||
{ L"mso-spt33" , 7}, // shapetypeBentConnector2,
|
||||
{ L"mso-spt34" , 7}, // shapetypeBentConnector3,
|
||||
{ L"mso-spt35" , 7}, // shapetypeBentConnector4,
|
||||
{ L"mso-spt36" , 7}, // shapetypeBentConnector5,
|
||||
{ L"" , 7}, // shapetypeBentArrow,
|
||||
{ L"" , 9}, // shapetypeBentConnector2,
|
||||
{ L"" , 9}, // shapetypeBentConnector3,
|
||||
{ L"" , 9}, // shapetypeBentConnector4,
|
||||
{ L"" , 9}, // shapetypeBentConnector5,
|
||||
{ L"" , 7}, // shapetypeBentUpArrow,
|
||||
{ L"quad-bevel" , 7}, // shapetypeBevel,
|
||||
{ L"" , 7}, // shapetypeBevel,
|
||||
{ L"" , 7}, // shapetypeBlockArc,
|
||||
{ L"mso-spt49" , 7}, // shapetypeBorderCallout1,
|
||||
{ L"mso-spt50" , 7}, // shapetypeBorderCallout2,
|
||||
{ L"mso-spt51" , 7}, // shapetypeBorderCallout3,
|
||||
{ L"brace-pair" , 7}, // shapetypeBracePair,
|
||||
{ L"" , 7}, // shapetypeBorderCallout1,
|
||||
{ L"" , 7}, // shapetypeBorderCallout2,
|
||||
{ L"" , 7}, // shapetypeBorderCallout3,
|
||||
{ L"" , 7}, // shapetypeBracePair,
|
||||
{ L"" , 7}, // shapetypeBracketPair,
|
||||
{ L"mso-spt41" , 7}, // shapetypeCallout1,
|
||||
{ L"mso-spt42" , 7}, // shapetypeCallout2,
|
||||
{ L"mso-spt43" , 7}, // shapetypeCallout3,
|
||||
{ L"can" , 7}, // shapetypeCan,
|
||||
{ L"" , 7}, // shapetypeCallout1,
|
||||
{ L"" , 7}, // shapetypeCallout2,
|
||||
{ L"" , 7}, // shapetypeCallout3,
|
||||
{ L"" , 7}, // shapetypeCan,
|
||||
{ L"" , 7}, // shapetypeChartPlus,
|
||||
{ L"" , 7}, // shapetypeChartStar,
|
||||
{ L"" , 7}, // shapetypeChartX,
|
||||
@ -82,18 +82,18 @@ static const _sh_typ Shape_Types_Mapping[] = // index === OOX::Drawing::EShapeTy
|
||||
{ L"" , 7}, // shapetypeChord,
|
||||
{ L"" , 7}, // shapetypeCircularArrow,
|
||||
{ L"cloud" , 7}, // shapetypeCloud,
|
||||
{ L"cloud-callout" , 7}, // shapetypeCloudCallout,
|
||||
{ L"" , 7}, // shapetypeCloudCallout,
|
||||
{ L"" , 7}, // shapetypeCorner,
|
||||
{ L"" , 7}, // shapetypeCornerTabs,
|
||||
{ L"cube" , 7}, // shapetypeCube,
|
||||
{ L"mso-spt37" , 7}, // shapetypeCurvedConnector2,
|
||||
{ L"mso-spt38" , 7}, // shapetypeCurvedConnector3,
|
||||
{ L"mso-spt39" , 7}, // shapetypeCurvedConnector4,
|
||||
{ L"mso-spt40" , 7}, // shapetypeCurvedConnector5,
|
||||
{ L"" , 7}, // shapetypeCube,
|
||||
{ L"" , 10}, // shapetypeCurvedConnector2,
|
||||
{ L"" , 10}, // shapetypeCurvedConnector3,
|
||||
{ L"" , 10}, // shapetypeCurvedConnector4,
|
||||
{ L"" , 10}, // shapetypeCurvedConnector5,
|
||||
{ L"" , 7}, // shapetypeCurvedDownArrow,
|
||||
{ L"" , 7}, // shapetypeCurvedLeftArrow,
|
||||
{ L"" , 7}, // shapetypeCurvedRightArrow,
|
||||
{ L"mso-spt104" , 7}, // shapetypeCurvedUpArrow,
|
||||
{ L"" , 7}, // shapetypeCurvedUpArrow,
|
||||
{ L"" , 7}, // shapetypeDecagon,
|
||||
{ L"" , 7}, // shapetypeDiagStripe,
|
||||
{ L"" , 7}, // shapetypeDiamond,
|
||||
@ -103,8 +103,8 @@ static const _sh_typ Shape_Types_Mapping[] = // index === OOX::Drawing::EShapeTy
|
||||
{ L"" , 7}, // shapetypeDownArrow,
|
||||
{ L"" , 7}, // shapetypeDownArrowCallout,
|
||||
{ L"ellipse" , 3}, // shapetypeEllipse,
|
||||
{ L"mso-spt107" , 7}, // shapetypeEllipseRibbon,
|
||||
{ L"mso-spt108" , 7}, // shapetypeEllipseRibbon2,
|
||||
{ L"" , 7}, // shapetypeEllipseRibbon,
|
||||
{ L"" , 7}, // shapetypeEllipseRibbon2,
|
||||
{ L"flowchart-alternate-process" , 7}, // shapetypeFlowChartAlternateProcess,
|
||||
{ L"flowchart-collate" , 7}, // shapetypeFlowChartCollate,
|
||||
{ L"flowchart-connector" , 7}, // shapetypeFlowChartConnector,
|
||||
@ -134,23 +134,23 @@ static const _sh_typ Shape_Types_Mapping[] = // index === OOX::Drawing::EShapeTy
|
||||
{ L"flowchart-sort" , 7}, // shapetypeFlowChartSort,
|
||||
{ L"flowchart-summing-junction" , 7}, // shapetypeFlowChartSummingJunction,
|
||||
{ L"flowchart-terminator" , 7}, // shapetypeFlowChartTerminator,
|
||||
{ L"paper" , 7}, // shapetypeFoldedCorner,
|
||||
{ L"" , 7}, // shapetypeFoldedCorner,
|
||||
{ L"" , 7}, // shapetypeFrame,
|
||||
{ L"" , 7}, // shapetypeFunnel,
|
||||
{ L"" , 7}, // shapetypeGear6,
|
||||
{ L"" , 7}, // shapetypeGear9,
|
||||
{ L"" , 7}, // shapetypeHalfFrame,
|
||||
{ L"heart" , 7}, // shapetypeHeart,
|
||||
{ L"" , 7}, // shapetypeHeart,
|
||||
{ L"" , 7}, // shapetypeHeptagon,
|
||||
{ L"hexagon" , 7}, // shapetypeHexagon,
|
||||
{ L"" , 7}, // shapetypeHexagon,
|
||||
{ L"" , 7}, // shapetypeHomePlate,
|
||||
{ L"horizontal-scroll" , 7}, // shapetypeHorizontalScroll,
|
||||
{ L"" , 7}, // shapetypeIrregularSeal1,
|
||||
{ L"" , 7}, // shapetypeIrregularSeal2,
|
||||
{ L"" , 7}, // shapetypeLeftArrow,
|
||||
{ L"" , 7}, // shapetypeLeftArrowCallout,
|
||||
{ L"left-brace" , 7}, // shapetypeLeftBrace,
|
||||
{ L"left-bracket" , 7}, // shapetypeLeftBracket,
|
||||
{ L"" , 7}, // shapetypeLeftBrace,
|
||||
{ L"" , 7}, // shapetypeLeftBracket,
|
||||
{ L"" , 7}, // shapetypeLeftCircularArrow,
|
||||
{ L"" , 7}, // shapetypeLeftRightArrow,
|
||||
{ L"left-right-arrow-callout" , 7}, // shapetypeLeftRightArrowCallout,
|
||||
@ -158,7 +158,7 @@ static const _sh_typ Shape_Types_Mapping[] = // index === OOX::Drawing::EShapeTy
|
||||
{ L"" , 7}, // shapetypeLeftRightRibbon,
|
||||
{ L"" , 7}, // shapetypeLeftRightUpArrow,
|
||||
{ L"" , 7}, // shapetypeLeftUpArrow,
|
||||
{ L"lightning" , 7}, // shapetypeLightningBolt,
|
||||
{ L"" , 7}, // shapetypeLightningBolt,
|
||||
{ L"" , 5}, // shapetypeLine,
|
||||
{ L"" , 7}, // shapetypeLineInv,
|
||||
{ L"" , 7}, // shapetypeMathDivide,
|
||||
@ -167,27 +167,27 @@ static const _sh_typ Shape_Types_Mapping[] = // index === OOX::Drawing::EShapeTy
|
||||
{ L"" , 7}, // shapetypeMathMultiply,
|
||||
{ L"" , 7}, // shapetypeMathNotEqual,
|
||||
{ L"" , 7}, // shapetypeMathPlus,
|
||||
{ L"moon" , 7}, // shapetypeMoon,
|
||||
{ L"" , 7}, // shapetypeMoon,
|
||||
{ L"" , 7}, // shapetypeNonIsoscelesTrapezoid,
|
||||
{ L"forbidden" , 7}, // shapetypeNoSmoking,
|
||||
{ L"" , 7}, // shapetypeNotchedRightArrow,
|
||||
{ L"octagon" , 7}, // shapetypeOctagon,
|
||||
{ L"" , 7}, // shapetypeOctagon,
|
||||
{ L"" , 7}, // shapetypeParallelogram,
|
||||
{ L"pentagon" , 7}, // shapetypePentagon,
|
||||
{ L"" , 7}, // shapetypePentagon,
|
||||
{ L"" , 7}, // shapetypePie,
|
||||
{ L"" , 7}, // shapetypePieWedge,
|
||||
{ L"" , 7}, // shapetypePlaque,
|
||||
{ L"" , 7}, // shapetypePlaqueTabs,
|
||||
{ L"" , 7}, // shapetypePlus,
|
||||
{ L"quad-arrow" , 7}, // shapetypeQuadArrow,
|
||||
{ L"quad-arrow-callout" , 7}, // shapetypeQuadArrowCallout,
|
||||
{ L"" , 7}, // shapetypeQuadArrowCallout,
|
||||
{ L"rectangle" , 2}, // shapetypeRect,
|
||||
{ L"mso-spt53" , 7}, // shapetypeRibbon,
|
||||
{ L"mso-spt54" , 7}, // shapetypeRibbon2,
|
||||
{ L"" , 7}, // shapetypeRibbon,
|
||||
{ L"" , 7}, // shapetypeRibbon2,
|
||||
{ L"" , 7}, // shapetypeRightArrow,
|
||||
{ L"" , 7}, // shapetypeRightArrowCallout,
|
||||
{ L"right-brace" , 7}, // shapetypeRightBrace,
|
||||
{ L"right-bracket" , 7}, // shapetypeRightBracket,
|
||||
{ L"" , 7}, // shapetypeRightBrace,
|
||||
{ L"" , 7}, // shapetypeRightBracket,
|
||||
{ L"" , 7}, // shapetypeRound1Rect,
|
||||
{ L"" , 7}, // shapetypeRound2DiagRect,
|
||||
{ L"" , 7}, // shapetypeRound2SameRect,
|
||||
@ -209,7 +209,7 @@ static const _sh_typ Shape_Types_Mapping[] = // index === OOX::Drawing::EShapeTy
|
||||
{ L"" , 7}, // shapetypeStar6,
|
||||
{ L"" , 7}, // shapetypeStar7,
|
||||
{ L"star8" , 7}, // shapetypeStar8,
|
||||
{ L"mso-spt32" , 9}, // shapetypeStraightConnector1,
|
||||
{ L"" , 5}, // shapetypeStraightConnector1,
|
||||
{ L"striped-right-arrow" , 7}, // shapetypeStripedRightArrow,
|
||||
{ L"" , 7}, // shapetypeSun,
|
||||
{ L"" , 7}, // shapetypeSwooshArrow,
|
||||
@ -223,9 +223,9 @@ static const _sh_typ Shape_Types_Mapping[] = // index === OOX::Drawing::EShapeTy
|
||||
{ L"mso-spt101" , 7}, // shapetypeUturnArrow,
|
||||
{ L"vertical-scroll" , 7}, // shapetypeVerticalScroll,
|
||||
{ L"" , 7}, // shapetypeWave,
|
||||
{ L"round-callout" , 7}, // shapetypeWedgeEllipseCallout,
|
||||
{ L"rectangular-callout" , 7}, // shapetypeWedgeRectCallout,
|
||||
{ L"round-rectangular-callout" , 7}, // shapetypeWedgeRoundRectCallout,
|
||||
{ L"" , 7}, // shapetypeWedgeEllipseCallout,
|
||||
{ L"" , 7}, // shapetypeWedgeRectCallout,
|
||||
{ L"" , 7}, // shapetypeWedgeRoundRectCallout,
|
||||
{ L"mso-spt17" , 7}, // shapetypeBallon,
|
||||
{ L"up-right-arrow" , 7}, // shapetypeRightUpArrow,
|
||||
{ L"fontwork-arch-down-pour" , 7}, // shapetypeTextArchDownPour,
|
||||
|
||||
@ -31,11 +31,336 @@
|
||||
*/
|
||||
#include "../oox_shape_defines.h"
|
||||
|
||||
// shapetypeAccentBorderCallout1,
|
||||
// shapetypeAccentBorderCallout2,
|
||||
// shapetypeAccentBorderCallout3,
|
||||
//+ shapetypeAccentBorderCallout1,
|
||||
//+ shapetypeAccentBorderCallout2,
|
||||
//+ shapetypeAccentBorderCallout3,
|
||||
//+ shapetypeAccentCallout1
|
||||
//+ shapetypeAccentCallout2
|
||||
//+ shapetypeAccentCallout3
|
||||
//+ shapetypeBorderCallout1
|
||||
//+ shapetypeBorderCallout2
|
||||
//+ shapetypeBorderCallout3
|
||||
|
||||
namespace cpdoccore
|
||||
{
|
||||
class oox_shape_AccentCallout1 : public oox_shape
|
||||
{
|
||||
public:
|
||||
oox_shape_AccentCallout1()
|
||||
{
|
||||
odf_type_name =L"ooxml-accentCallout1";
|
||||
|
||||
enhanced_path = L"S M ?f0 ?f2 L ?f1 ?f2 ?f1 ?f3 ?f0 ?f3 Z N F M ?f9 ?f2 L ?f9 ?f3 Z N F M ?f9 ?f8 L ?f11 ?f10 N";
|
||||
text_areas = L"?f0 ?f2 ?f1 ?f3";
|
||||
view_box = L"0 0 21600 21600";
|
||||
modifiers = L"18750 -8333 112500 -38333";
|
||||
|
||||
add(L"f0", L"left");
|
||||
add(L"f1", L"right");
|
||||
add(L"f2", L"top");
|
||||
add(L"f3", L"bottom");
|
||||
add(L"f4", L"?f3 - ?f2");
|
||||
add(L"f5", L"?f1 - ?f0");
|
||||
add(L"f6", L"min(?f5, ?f4)");
|
||||
add(L"f7", L"?f6 / 21600");
|
||||
add(L"f8", L"?f4 * ?f13 / 100000");
|
||||
add(L"f9", L"?f5 * ?f12 / 100000");
|
||||
add(L"f10", L"?f4 * ?f15 / 100000");
|
||||
add(L"f11", L"?f5 * ?f14 / 100000");
|
||||
add(L"f12", L"$1 / ?f7");
|
||||
add(L"f13", L"$0 / ?f7");
|
||||
add(L"f14", L"$3 / ?f7");
|
||||
add(L"f15", L"$2 / ?f7");
|
||||
/////////////////////////////////////////////////////////
|
||||
}
|
||||
};
|
||||
class oox_shape_AccentCallout2 : public oox_shape
|
||||
{
|
||||
public:
|
||||
oox_shape_AccentCallout2()
|
||||
{
|
||||
odf_type_name =L"ooxml-accentCallout2";
|
||||
|
||||
enhanced_path = L"S M ?f0 ?f2 L ?f1 ?f2 ?f1 ?f3 ?f0 ?f3 Z N F M ?f9 ?f2 L ?f9 ?f3 Z N F M ?f9 ?f8 L ?f11 ?f10 ?f13 ?f12 N";
|
||||
text_areas = L"?f0 ?f2 ?f1 ?f3";
|
||||
view_box = L"0 0 21600 21600";
|
||||
modifiers = L"18750 -8333 18750 -16667 112500 -46667";
|
||||
|
||||
add(L"f0", L"left");
|
||||
add(L"f1", L"right");
|
||||
add(L"f2", L"top");
|
||||
add(L"f3", L"bottom");
|
||||
add(L"f4", L"?f3 - ?f2");
|
||||
add(L"f5", L"?f1 - ?f0");
|
||||
add(L"f6", L"min(?f5, ?f4)");
|
||||
add(L"f7", L"?f6 / 21600");
|
||||
add(L"f8", L"?f4 * ?f15 / 100000");
|
||||
add(L"f9", L"?f5 * ?f14 / 100000");
|
||||
add(L"f10", L"?f4 * ?f17 / 100000");
|
||||
add(L"f11", L"?f5 * ?f16 / 100000");
|
||||
add(L"f12", L"?f4 * ?f19 / 100000");
|
||||
add(L"f13", L"?f5 * ?f18 / 100000");
|
||||
add(L"f14", L"$1 / ?f7");
|
||||
add(L"f15", L"$0 / ?f7");
|
||||
add(L"f16", L"$3 / ?f7");
|
||||
add(L"f17", L"$2 / ?f7");
|
||||
add(L"f18", L"$5 / ?f7");
|
||||
add(L"f19", L"$4 / ?f7");
|
||||
/////////////////////////////////////////////////////////
|
||||
}
|
||||
};
|
||||
class oox_shape_AccentCallout3 : public oox_shape
|
||||
{
|
||||
public:
|
||||
oox_shape_AccentCallout3()
|
||||
{
|
||||
odf_type_name =L"ooxml-accentCallout3";
|
||||
|
||||
enhanced_path = L"S M ?f0 ?f2 L ?f1 ?f2 ?f1 ?f3 ?f0 ?f3 Z N F M ?f9 ?f2 L ?f9 ?f3 Z N F M ?f9 ?f8 L ?f11 ?f10 ?f13 ?f12 ?f15 ?f14 N";
|
||||
text_areas = L"?f0 ?f2 ?f1 ?f3";
|
||||
view_box = L"0 0 21600 21600";
|
||||
modifiers = L"18750 -8333 18750 -16667 100000 -16667 112963 -8333";
|
||||
|
||||
add(L"f0", L"left");
|
||||
add(L"f1", L"right");
|
||||
add(L"f2", L"top");
|
||||
add(L"f3", L"bottom");
|
||||
add(L"f4", L"?f3 - ?f2");
|
||||
add(L"f5", L"?f1 - ?f0");
|
||||
add(L"f6", L"min(?f5, ?f4)");
|
||||
add(L"f7", L"?f6 / 21600");
|
||||
add(L"f8", L"?f4 * ?f17 / 100000");
|
||||
add(L"f9", L"?f5 * ?f16 / 100000");
|
||||
add(L"f10", L"?f4 * ?f19 / 100000");
|
||||
add(L"f11", L"?f5 * ?f18 / 100000");
|
||||
add(L"f12", L"?f4 * ?f21 / 100000");
|
||||
add(L"f13", L"?f5 * ?f20 / 100000");
|
||||
add(L"f14", L"?f4 * ?f23 / 100000");
|
||||
add(L"f15", L"?f5 * ?f22 / 100000");
|
||||
add(L"f16", L"$1 / ?f7");
|
||||
add(L"f17", L"$0 / ?f7");
|
||||
add(L"f18", L"$3 / ?f7");
|
||||
add(L"f19", L"$2 / ?f7");
|
||||
add(L"f20", L"$5 / ?f7");
|
||||
add(L"f21", L"$4 / ?f7");
|
||||
add(L"f22", L"$7 / ?f7");
|
||||
add(L"f23", L"$6 / ?f7");
|
||||
/////////////////////////////////////////////////////////
|
||||
}
|
||||
};
|
||||
|
||||
class oox_shape_BorderCallout1 : public oox_shape
|
||||
{
|
||||
public:
|
||||
oox_shape_BorderCallout1()
|
||||
{
|
||||
odf_type_name =L"ooxml-borderCallout1";
|
||||
|
||||
enhanced_path = L"M ?f0 ?f2 L ?f1 ?f2 ?f1 ?f3 ?f0 ?f3 Z N F M ?f9 ?f8 L ?f11 ?f10 N";
|
||||
text_areas = L"?f0 ?f2 ?f1 ?f3";
|
||||
view_box = L"0 0 21600 21600";
|
||||
modifiers = L"18750 -8333 112500 -38333";
|
||||
|
||||
add(L"f0", L"left");
|
||||
add(L"f1", L"right");
|
||||
add(L"f2", L"top");
|
||||
add(L"f3", L"bottom");
|
||||
add(L"f4", L"?f3 - ?f2");
|
||||
add(L"f5", L"?f1 - ?f0");
|
||||
add(L"f6", L"min(?f5, ?f4)");
|
||||
add(L"f7", L"?f6 / 21600");
|
||||
add(L"f8", L"?f4 * ?f13 / 100000");
|
||||
add(L"f9", L"?f5 * ?f12 / 100000");
|
||||
add(L"f10", L"?f4 * ?f15 / 100000");
|
||||
add(L"f11", L"?f5 * ?f14 / 100000");
|
||||
add(L"f12", L"$1 / ?f7");
|
||||
add(L"f13", L"$0 / ?f7");
|
||||
add(L"f14", L"$3 / ?f7");
|
||||
add(L"f15", L"$2 / ?f7");
|
||||
/////////////////////////////////////////////////////////
|
||||
}
|
||||
};
|
||||
|
||||
class oox_shape_BorderCallout2 : public oox_shape
|
||||
{
|
||||
public:
|
||||
oox_shape_BorderCallout2()
|
||||
{
|
||||
odf_type_name =L"ooxml-borderCallout2";
|
||||
|
||||
enhanced_path = L"M ?f0 ?f2 L ?f1 ?f2 ?f1 ?f3 ?f0 ?f3 Z N F M ?f9 ?f8 L ?f11 ?f10 ?f13 ?f12 N";
|
||||
text_areas = L"?f0 ?f2 ?f1 ?f3";
|
||||
view_box = L"0 0 21600 21600";
|
||||
modifiers = L"18750 -8333 18750 -16667 112500 -46667";
|
||||
|
||||
add(L"f0", L"left");
|
||||
add(L"f1", L"right");
|
||||
add(L"f2", L"top");
|
||||
add(L"f3", L"bottom");
|
||||
add(L"f4", L"?f3 - ?f2");
|
||||
add(L"f5", L"?f1 - ?f0");
|
||||
add(L"f6", L"min(?f5, ?f4)");
|
||||
add(L"f7", L"?f6 / 21600");
|
||||
add(L"f8", L"?f4 * ?f15 / 100000");
|
||||
add(L"f9", L"?f5 * ?f14 / 100000");
|
||||
add(L"f10", L"?f4 * ?f17 / 100000");
|
||||
add(L"f11", L"?f5 * ?f16 / 100000");
|
||||
add(L"f12", L"?f4 * ?f19 / 100000");
|
||||
add(L"f13", L"?f5 * ?f18 / 100000");
|
||||
add(L"f14", L"$1 / ?f7");
|
||||
add(L"f15", L"$0 / ?f7");
|
||||
add(L"f16", L"$3 / ?f7");
|
||||
add(L"f17", L"$2 / ?f7");
|
||||
add(L"f18", L"$5 / ?f7");
|
||||
add(L"f19", L"$4 / ?f7");
|
||||
/////////////////////////////////////////////////////////
|
||||
}
|
||||
};
|
||||
|
||||
class oox_shape_BorderCallout3 : public oox_shape
|
||||
{
|
||||
public:
|
||||
oox_shape_BorderCallout3()
|
||||
{
|
||||
odf_type_name =L"ooxml-borderCallout3";
|
||||
|
||||
enhanced_path = L"M ?f0 ?f2 L ?f1 ?f2 ?f1 ?f3 ?f0 ?f3 Z N F M ?f9 ?f8 L ?f11 ?f10 ?f13 ?f12 ?f15 ?f14 N";
|
||||
text_areas = L"?f0 ?f2 ?f1 ?f3";
|
||||
view_box = L"0 0 21600 21600";
|
||||
modifiers = L"18750 -8333 18750 -16667 100000 -16667 112963 -8333";
|
||||
|
||||
add(L"f0", L"left");
|
||||
add(L"f1", L"right");
|
||||
add(L"f2", L"top");
|
||||
add(L"f3", L"bottom");
|
||||
add(L"f4", L"?f3 - ?f2");
|
||||
add(L"f5", L"?f1 - ?f0");
|
||||
add(L"f6", L"min(?f5, ?f4)");
|
||||
add(L"f7", L"?f6 / 21600");
|
||||
add(L"f8", L"?f4 * ?f17 / 100000");
|
||||
add(L"f9", L"?f5 * ?f16 / 100000");
|
||||
add(L"f10", L"?f4 * ?f19 / 100000");
|
||||
add(L"f11", L"?f5 * ?f18 / 100000");
|
||||
add(L"f12", L"?f4 * ?f21 / 100000");
|
||||
add(L"f13", L"?f5 * ?f20 / 100000");
|
||||
add(L"f14", L"?f4 * ?f23 / 100000");
|
||||
add(L"f15", L"?f5 * ?f22 / 100000");
|
||||
add(L"f16", L"$1 / ?f7");
|
||||
add(L"f17", L"$0 / ?f7");
|
||||
add(L"f18", L"$3 / ?f7");
|
||||
add(L"f19", L"$2 / ?f7");
|
||||
add(L"f20", L"$5 / ?f7");
|
||||
add(L"f21", L"$4 / ?f7");
|
||||
add(L"f22", L"$7 / ?f7");
|
||||
add(L"f23", L"$6 / ?f7");
|
||||
/////////////////////////////////////////////////////////
|
||||
}
|
||||
};
|
||||
|
||||
class oox_shape_AccentBorderCallout1 : public oox_shape
|
||||
{
|
||||
public:
|
||||
oox_shape_AccentBorderCallout1()
|
||||
{
|
||||
odf_type_name =L"ooxml-accentBorderCallout1";
|
||||
|
||||
enhanced_path = L"M ?f0 ?f2 L ?f1 ?f2 ?f1 ?f3 ?f0 ?f3 Z N F M ?f9 ?f2 L ?f9 ?f3 Z N F M ?f9 ?f8 L ?f11 ?f10 N";
|
||||
text_areas = L"?f0 ?f2 ?f1 ?f3";
|
||||
view_box = L"0 0 21600 21600";
|
||||
modifiers = L"18750 -8333 112500 -38333";
|
||||
|
||||
add(L"f0", L"left");
|
||||
add(L"f1", L"right");
|
||||
add(L"f2", L"top");
|
||||
add(L"f3", L"bottom");
|
||||
add(L"f4", L"?f3 - ?f2");
|
||||
add(L"f5", L"?f1 - ?f0");
|
||||
add(L"f6", L"min(?f5, ?f4)");
|
||||
add(L"f7", L"?f6 / 21600");
|
||||
add(L"f8", L"?f4 * ?f13 / 100000");
|
||||
add(L"f9", L"?f5 * ?f12 / 100000");
|
||||
add(L"f10", L"?f4 * ?f15 / 100000");
|
||||
add(L"f11", L"?f5 * ?f14 / 100000");
|
||||
add(L"f12", L"$1 / ?f7");
|
||||
add(L"f13", L"$0 / ?f7");
|
||||
add(L"f14", L"$3 / ?f7");
|
||||
add(L"f15", L"$2 / ?f7");
|
||||
/////////////////////////////////////////////////////////
|
||||
}
|
||||
};
|
||||
class oox_shape_AccentBorderCallout2 : public oox_shape
|
||||
{
|
||||
public:
|
||||
oox_shape_AccentBorderCallout2()
|
||||
{
|
||||
odf_type_name =L"ooxml-accentBorderCallout2";
|
||||
|
||||
enhanced_path = L"M ?f0 ?f2 L ?f1 ?f2 ?f1 ?f3 ?f0 ?f3 Z N F M ?f9 ?f2 L ?f9 ?f3 Z N F M ?f9 ?f8 L ?f11 ?f10 ?f13 ?f12 N";
|
||||
text_areas = L"?f0 ?f2 ?f1 ?f3";
|
||||
view_box = L"0 0 21600 21600";
|
||||
modifiers = L"18750 -8333 18750 -16667 112500 -46667";
|
||||
|
||||
add(L"f0", L"left");
|
||||
add(L"f1", L"right");
|
||||
add(L"f2", L"top");
|
||||
add(L"f3", L"bottom");
|
||||
add(L"f4", L"?f3 - ?f2");
|
||||
add(L"f5", L"?f1 - ?f0");
|
||||
add(L"f6", L"min(?f5, ?f4)");
|
||||
add(L"f7", L"?f6 / 21600");
|
||||
add(L"f8", L"?f4 * ?f15 / 100000");
|
||||
add(L"f9", L"?f5 * ?f14 / 100000");
|
||||
add(L"f10", L"?f4 * ?f17 / 100000");
|
||||
add(L"f11", L"?f5 * ?f16 / 100000");
|
||||
add(L"f12", L"?f4 * ?f19 / 100000");
|
||||
add(L"f13", L"?f5 * ?f18 / 100000");
|
||||
add(L"f14", L"$1 / ?f7");
|
||||
add(L"f15", L"$0 / ?f7");
|
||||
add(L"f16", L"$3 / ?f7");
|
||||
add(L"f17", L"$2 / ?f7");
|
||||
add(L"f18", L"$5 / ?f7");
|
||||
add(L"f19", L"$4 / ?f7");
|
||||
/////////////////////////////////////////////////////////
|
||||
}
|
||||
};
|
||||
class oox_shape_AccentBorderCallout3 : public oox_shape
|
||||
{
|
||||
public:
|
||||
oox_shape_AccentBorderCallout3()
|
||||
{
|
||||
odf_type_name =L"ooxml-accentBorderCallout3";
|
||||
|
||||
enhanced_path = L"M ?f0 ?f2 L ?f1 ?f2 ?f1 ?f3 ?f0 ?f3 Z N F M ?f9 ?f2 L ?f9 ?f3 Z N F M ?f9 ?f8 L ?f11 ?f10 ?f13 ?f12 ?f15 ?f14 N";
|
||||
text_areas = L"?f0 ?f2 ?f1 ?f3";
|
||||
view_box = L"0 0 21600 21600";
|
||||
modifiers = L"18750 -8333 18750 -16667 100000 -16667 112963 -8333";
|
||||
|
||||
add(L"f0", L"left");
|
||||
add(L"f1", L"right");
|
||||
add(L"f2", L"top");
|
||||
add(L"f3", L"bottom");
|
||||
add(L"f4", L"?f3 - ?f2");
|
||||
add(L"f5", L"?f1 - ?f0");
|
||||
add(L"f6", L"min(?f5, ?f4)");
|
||||
add(L"f7", L"?f6 / 21600");
|
||||
add(L"f8", L"?f4 * ?f17 / 100000");
|
||||
add(L"f9", L"?f5 * ?f16 / 100000");
|
||||
add(L"f10", L"?f4 * ?f19 / 100000");
|
||||
add(L"f11", L"?f5 * ?f18 / 100000");
|
||||
add(L"f12", L"?f4 * ?f21 / 100000");
|
||||
add(L"f13", L"?f5 * ?f20 / 100000");
|
||||
add(L"f14", L"?f4 * ?f23 / 100000");
|
||||
add(L"f15", L"?f5 * ?f22 / 100000");
|
||||
add(L"f16", L"$1 / ?f7");
|
||||
add(L"f17", L"$0 / ?f7");
|
||||
add(L"f18", L"$3 / ?f7");
|
||||
add(L"f19", L"$2 / ?f7");
|
||||
add(L"f20", L"$5 / ?f7");
|
||||
add(L"f21", L"$4 / ?f7");
|
||||
add(L"f22", L"$7 / ?f7");
|
||||
add(L"f23", L"$6 / ?f7");
|
||||
/////////////////////////////////////////////////////////
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
@ -203,14 +203,14 @@ public:
|
||||
_handle h1, h2;
|
||||
|
||||
h1.position = L"?f8 ?f13";
|
||||
h1.y_minimum = L"0";
|
||||
h1.y_maximum = L"100000";
|
||||
h1.x_minimum = L"0";
|
||||
h1.x_maximum = L"100000";
|
||||
|
||||
handles.push_back(h1);
|
||||
|
||||
h2.position = L"0 ?f5";
|
||||
h2.x_minimum = L"0";
|
||||
h2.x_maximum = L"?f1";
|
||||
h2.y_minimum = L"0";
|
||||
h2.y_maximum = L"?f1";
|
||||
handles.push_back(h2);
|
||||
}
|
||||
};
|
||||
@ -608,230 +608,157 @@ public:
|
||||
{
|
||||
odf_type_name = L"ooxml-circularArrow";
|
||||
|
||||
enhanced_path = L"M ?f60 ?f61 G ?f10 ?f12 ?f197 ?f198 L ?f172 ?f173 ?f54 ?f55 ?f174 ?f175 ?f159 ?f160 G ?f13 ?f14 ?f199 ?f200 Z N";
|
||||
text_areas = L"?f193 ?f195 ?f194 ?f196";
|
||||
modifiers = L"12500 515062 20457681 17744048 18489";
|
||||
view_box = L"0 0 0 0";
|
||||
enhanced_path = L"M 534468 1430865 A ?f91 ?f92 ?f93 ?f94 534468 1430865 ?f88 ?f90 W ?f95 ?f96 ?f97 ?f98 534468 1430865 ?f88 ?f90 L 853493 790375 695381 939240 547047 613089 643004 668602 A ?f138 ?f139 ?f140 ?f141 643004 668602 ?f135 ?f137 W ?f142 ?f143 ?f144 ?f145 643004 668602 ?f135 ?f137 Z N";
|
||||
text_areas = L"?f48 ?f50 ?f49 ?f51";
|
||||
view_box = L"0 0 880110 1583055";
|
||||
glue_points = L"?f40 ?f41 ?f42 ?f43 ?f44 ?f45 ?f46 ?f47";
|
||||
|
||||
add(L"f0", L"if(0-$4 ,0,if(25000-$4 ,$4 ,25000))");
|
||||
add(L"f1", L"?f0 *2/1");
|
||||
add(L"f2", L"if(0-$0 ,0,if(?f1 -$0 ,$0 ,?f1 ))");
|
||||
add(L"f3", L"if(1-$2 ,1,if(21599999-$2 ,$2 ,21599999))");
|
||||
add(L"f4", L"if(0-$3 ,0,if(21599999-$3 ,$3 ,21599999))");
|
||||
add(L"f5", L"min(logwidth,logheight)");
|
||||
add(L"f6", L"?f5 *?f2 /100000");
|
||||
add(L"f7", L"?f5 *?f0 /100000");
|
||||
add(L"f8", L"?f6 *1/2");
|
||||
add(L"f9", L"logwidth/2");
|
||||
add(L"f10", L"?f9 +?f8 -?f7 ");
|
||||
add(L"f11", L"logheight/2");
|
||||
add(L"f12", L"?f11 +?f8 -?f7 ");
|
||||
add(L"f13", L"?f10 +0-?f6 ");
|
||||
add(L"f14", L"?f12 +0-?f6 ");
|
||||
add(L"f15", L"?f13 +?f8 -0");
|
||||
add(L"f16", L"?f14 +?f8 -0");
|
||||
add(L"f17", L"?f15 *sin(pi*(?f3 )/10800000)");
|
||||
add(L"f18", L"?f16 *cos(pi*(?f3 )/10800000)");
|
||||
add(L"f19", L"?f15 *(cos(atan2(?f17 ,?f18 )))");
|
||||
add(L"f20", L"?f16 *(sin(atan2(?f17 ,?f18 )))");
|
||||
add(L"f21", L"logwidth/2");
|
||||
add(L"f22", L"?f21 +?f19 -0");
|
||||
add(L"f23", L"logheight/2");
|
||||
add(L"f24", L"?f23 +?f20 -0");
|
||||
add(L"f25", L"min(?f13 ,?f14 )");
|
||||
add(L"f26", L"?f19 *?f19 /1");
|
||||
add(L"f27", L"?f20 *?f20 /1");
|
||||
add(L"f28", L"?f25 *?f25 /1");
|
||||
add(L"f29", L"?f26 +0-?f28 ");
|
||||
add(L"f30", L"?f27 +0-?f28 ");
|
||||
add(L"f31", L"?f29 *?f30 /?f26 ");
|
||||
add(L"f32", L"?f31 *1/?f27 ");
|
||||
add(L"f33", L"1+0-?f32 ");
|
||||
add(L"f34", L"sqrt(?f33 )");
|
||||
add(L"f35", L"?f29 *1/?f19 ");
|
||||
add(L"f36", L"?f35 *1/?f20 ");
|
||||
add(L"f37", L"(1+?f34 )/?f36 ");
|
||||
add(L"f38", L"(10800000*atan2(?f37 ,1))/pi");
|
||||
add(L"f39", L"?f38 +21600000-0");
|
||||
add(L"f40", L"if(?f38 ,?f38 ,?f39 )");
|
||||
add(L"f41", L"?f40 +0-?f3 ");
|
||||
add(L"f42", L"?f41 +21600000-0");
|
||||
add(L"f43", L"if(?f41 ,?f41 ,?f42 )");
|
||||
add(L"f44", L"?f43 +0-10800000");
|
||||
add(L"f45", L"?f43 +0-21600000");
|
||||
add(L"f46", L"if(?f44 ,?f45 ,?f43 )");
|
||||
add(L"f47", L"abs(?f46 )");
|
||||
add(L"f48", L"if(0-$1 ,0,if(?f47 -$1 ,$1 ,?f47 ))");
|
||||
add(L"f49", L"?f3 +?f48 -0");
|
||||
add(L"f50", L"?f15 *sin(pi*(?f49 )/10800000)");
|
||||
add(L"f51", L"?f16 *cos(pi*(?f49 )/10800000)");
|
||||
add(L"f52", L"?f15 *(cos(atan2(?f50 ,?f51 )))");
|
||||
add(L"f53", L"?f16 *(sin(atan2(?f50 ,?f51 )))");
|
||||
add(L"f54", L"?f21 +?f52 -0");
|
||||
add(L"f55", L"?f23 +?f53 -0");
|
||||
add(L"f56", L"?f10 *sin(pi*(?f4 )/10800000)");
|
||||
add(L"f57", L"?f12 *cos(pi*(?f4 )/10800000)");
|
||||
add(L"f58", L"?f10 *(cos(atan2(?f56 ,?f57 )))");
|
||||
add(L"f59", L"?f12 *(sin(atan2(?f56 ,?f57 )))");
|
||||
add(L"f60", L"?f21 +?f58 -0");
|
||||
add(L"f61", L"?f23 +?f59 -0");
|
||||
add(L"f62", L"?f7 *cos(pi*(?f49 )/10800000)");
|
||||
add(L"f63", L"?f7 *sin(pi*(?f49 )/10800000)");
|
||||
add(L"f64", L"?f22 +?f62 -0");
|
||||
add(L"f65", L"?f24 +?f63 -0");
|
||||
add(L"f66", L"?f7 *cos(pi*(?f49 )/10800000)");
|
||||
add(L"f67", L"?f7 *sin(pi*(?f49 )/10800000)");
|
||||
add(L"f68", L"?f22 +0-?f66 ");
|
||||
add(L"f69", L"?f24 +0-?f67 ");
|
||||
add(L"f70", L"?f68 +0-?f21 ");
|
||||
add(L"f71", L"?f69 +0-?f23 ");
|
||||
add(L"f72", L"?f64 +0-?f21 ");
|
||||
add(L"f73", L"?f65 +0-?f23 ");
|
||||
add(L"f74", L"min(?f10 ,?f12 )");
|
||||
add(L"f75", L"?f70 *?f74 /?f10 ");
|
||||
add(L"f76", L"?f71 *?f74 /?f12 ");
|
||||
add(L"f77", L"?f72 *?f74 /?f10 ");
|
||||
add(L"f78", L"?f73 *?f74 /?f12 ");
|
||||
add(L"f79", L"?f77 +0-?f75 ");
|
||||
add(L"f80", L"?f78 +0-?f76 ");
|
||||
add(L"f81", L"sqrt(?f79 *?f79 +?f80 *?f80 +0*0)");
|
||||
add(L"f82", L"?f75 *?f78 /1");
|
||||
add(L"f83", L"?f77 *?f76 /1");
|
||||
add(L"f84", L"?f82 +0-?f83 ");
|
||||
add(L"f85", L"?f74 *?f74 /1");
|
||||
add(L"f86", L"?f81 *?f81 /1");
|
||||
add(L"f87", L"?f85 *?f86 /1");
|
||||
add(L"f88", L"?f84 *?f84 /1");
|
||||
add(L"f89", L"?f87 +0-?f88 ");
|
||||
add(L"f90", L"max(?f89 ,0)");
|
||||
add(L"f91", L"sqrt(?f90 )");
|
||||
add(L"f92", L"?f80 *-1/1");
|
||||
add(L"f93", L"if(?f92 ,-1,1)");
|
||||
add(L"f94", L"?f93 *?f79 /1");
|
||||
add(L"f95", L"?f94 *?f91 /1");
|
||||
add(L"f96", L"?f84 *?f80 /1");
|
||||
add(L"f97", L"(?f96 +?f95 )/?f86 ");
|
||||
add(L"f98", L"?f96 +0-?f95 ");
|
||||
add(L"f99", L"?f98 *1/?f86 ");
|
||||
add(L"f100", L"abs(?f80 )");
|
||||
add(L"f101", L"?f100 *?f91 /1");
|
||||
add(L"f102", L"?f84 *?f79 /-1");
|
||||
add(L"f103", L"(?f102 +?f101 )/?f86 ");
|
||||
add(L"f104", L"?f102 +0-?f101 ");
|
||||
add(L"f105", L"?f104 *1/?f86 ");
|
||||
add(L"f106", L"?f77 +0-?f97 ");
|
||||
add(L"f107", L"?f77 +0-?f99 ");
|
||||
add(L"f108", L"?f78 +0-?f103 ");
|
||||
add(L"f109", L"?f78 +0-?f105 ");
|
||||
add(L"f110", L"sqrt(?f106 *?f106 +?f108 *?f108 +0*0)");
|
||||
add(L"f111", L"sqrt(?f107 *?f107 +?f109 *?f109 +0*0)");
|
||||
add(L"f112", L"?f111 +0-?f110 ");
|
||||
add(L"f113", L"if(?f112 ,?f97 ,?f99 )");
|
||||
add(L"f114", L"if(?f112 ,?f103 ,?f105 )");
|
||||
add(L"f115", L"?f113 *?f10 /?f74 ");
|
||||
add(L"f116", L"?f114 *?f12 /?f74 ");
|
||||
add(L"f117", L"?f21 +?f115 -0");
|
||||
add(L"f118", L"?f23 +?f116 -0");
|
||||
add(L"f119", L"?f70 *?f25 /?f13 ");
|
||||
add(L"f120", L"?f71 *?f25 /?f14 ");
|
||||
add(L"f121", L"?f72 *?f25 /?f13 ");
|
||||
add(L"f122", L"?f73 *?f25 /?f14 ");
|
||||
add(L"f123", L"?f121 +0-?f119 ");
|
||||
add(L"f124", L"?f122 +0-?f120 ");
|
||||
add(L"f125", L"sqrt(?f123 *?f123 +?f124 *?f124 +0*0)");
|
||||
add(L"f126", L"?f119 *?f122 /1");
|
||||
add(L"f127", L"?f121 *?f120 /1");
|
||||
add(L"f128", L"?f126 +0-?f127 ");
|
||||
add(L"f129", L"?f25 *?f25 /1");
|
||||
add(L"f130", L"?f125 *?f125 /1");
|
||||
add(L"f131", L"?f129 *?f130 /1");
|
||||
add(L"f132", L"?f128 *?f128 /1");
|
||||
add(L"f133", L"?f131 +0-?f132 ");
|
||||
add(L"f134", L"max(?f133 ,0)");
|
||||
add(L"f135", L"sqrt(?f134 )");
|
||||
add(L"f136", L"?f93 *?f123 /1");
|
||||
add(L"f137", L"?f136 *?f135 /1");
|
||||
add(L"f138", L"?f128 *?f124 /1");
|
||||
add(L"f139", L"(?f138 +?f137 )/?f130 ");
|
||||
add(L"f140", L"?f138 +0-?f137 ");
|
||||
add(L"f141", L"?f140 *1/?f130 ");
|
||||
add(L"f142", L"abs(?f124 )");
|
||||
add(L"f143", L"?f142 *?f135 /1");
|
||||
add(L"f144", L"?f128 *?f123 /-1");
|
||||
add(L"f145", L"(?f144 +?f143 )/?f130 ");
|
||||
add(L"f146", L"?f144 +0-?f143 ");
|
||||
add(L"f147", L"?f146 *1/?f130 ");
|
||||
add(L"f148", L"?f119 +0-?f139 ");
|
||||
add(L"f149", L"?f119 +0-?f141 ");
|
||||
add(L"f150", L"?f120 +0-?f145 ");
|
||||
add(L"f151", L"?f120 +0-?f147 ");
|
||||
add(L"f152", L"sqrt(?f148 *?f148 +?f150 *?f150 +0*0)");
|
||||
add(L"f153", L"sqrt(?f149 *?f149 +?f151 *?f151 +0*0)");
|
||||
add(L"f154", L"?f153 +0-?f152 ");
|
||||
add(L"f155", L"if(?f154 ,?f139 ,?f141 )");
|
||||
add(L"f156", L"if(?f154 ,?f145 ,?f147 )");
|
||||
add(L"f157", L"?f155 *?f13 /?f25 ");
|
||||
add(L"f158", L"?f156 *?f14 /?f25 ");
|
||||
add(L"f159", L"?f21 +?f157 -0");
|
||||
add(L"f160", L"?f23 +?f158 -0");
|
||||
add(L"f161", L"(10800000*atan2(?f158 ,?f157 ))/pi");
|
||||
add(L"f162", L"?f161 +21600000-0");
|
||||
add(L"f163", L"if(?f161 ,?f161 ,?f162 )");
|
||||
add(L"f164", L"?f4 +0-?f163 ");
|
||||
add(L"f165", L"?f164 +0-21600000");
|
||||
add(L"f166", L"if(?f164 ,?f165 ,?f164 )");
|
||||
add(L"f167", L"?f117 +0-?f159 ");
|
||||
add(L"f168", L"?f118 +0-?f160 ");
|
||||
add(L"f169", L"sqrt(?f167 *?f167 +?f168 *?f168 +0*0)");
|
||||
add(L"f170", L"?f169 *1/2");
|
||||
add(L"f171", L"?f170 +0-?f7 ");
|
||||
add(L"f172", L"if(?f171 ,?f117 ,?f64 )");
|
||||
add(L"f173", L"if(?f171 ,?f118 ,?f65 )");
|
||||
add(L"f174", L"if(?f171 ,?f159 ,?f68 )");
|
||||
add(L"f175", L"if(?f171 ,?f160 ,?f69 )");
|
||||
add(L"f176", L"(10800000*atan2(?f116 ,?f115 ))/pi");
|
||||
add(L"f177", L"?f176 +21600000-0");
|
||||
add(L"f178", L"if(?f176 ,?f176 ,?f177 )");
|
||||
add(L"f179", L"?f178 +0-?f4 ");
|
||||
add(L"f180", L"?f179 +21600000-0");
|
||||
add(L"f181", L"if(?f179 ,?f179 ,?f180 )");
|
||||
add(L"f182", L"?f15 *sin(pi*(?f4 )/10800000)");
|
||||
add(L"f183", L"?f16 *cos(pi*(?f4 )/10800000)");
|
||||
add(L"f184", L"?f15 *(cos(atan2(?f182 ,?f183 )))");
|
||||
add(L"f185", L"?f16 *(sin(atan2(?f182 ,?f183 )))");
|
||||
add(L"f186", L"?f21 +?f184 -0");
|
||||
add(L"f187", L"?f23 +?f185 -0");
|
||||
add(L"f188", L"?f4 +0-5400000");
|
||||
add(L"f189", L"?f49 +5400000-0");
|
||||
add(L"f190", L"?f49 +10800000-0");
|
||||
add(L"f191", L"?f10 *cos(pi*(2700000)/10800000)");
|
||||
add(L"f192", L"?f12 *sin(pi*(2700000)/10800000)");
|
||||
add(L"f193", L"?f21 +0-?f191 ");
|
||||
add(L"f194", L"?f21 +?f191 -0");
|
||||
add(L"f195", L"?f23 +0-?f192 ");
|
||||
add(L"f196", L"?f23 +?f192 -0");
|
||||
add(L"f197", L"(?f4 )/60000.0");
|
||||
add(L"f198", L"(?f181 )/60000.0");
|
||||
add(L"f199", L"(?f163 )/60000.0");
|
||||
add(L"f200", L"(?f166 )/60000.0");
|
||||
/////////////////////////////////////////////////////////
|
||||
_handle h;
|
||||
|
||||
h.position = L"?f54 ?f55";
|
||||
handles.push_back(h);
|
||||
|
||||
h.position = L"?f60 ?f61";
|
||||
handles.push_back(h);
|
||||
|
||||
h.position = L"?f117 ?f118";
|
||||
h.r_minimum = L"0";
|
||||
h.r_maximum = L"?f1";
|
||||
handles.push_back(h);
|
||||
|
||||
h.position = L"?f68 ?f69";
|
||||
h.r_minimum = L"0";
|
||||
h.r_maximum = L"25000";
|
||||
handles.push_back(h);
|
||||
add(L"f0", L"10800000");
|
||||
add(L"f1", L"5400000");
|
||||
add(L"f2", L"left");
|
||||
add(L"f3", L"right");
|
||||
add(L"f4", L"top");
|
||||
add(L"f5", L"bottom");
|
||||
add(L"f6", L"?f5 - ?f4");
|
||||
add(L"f7", L"?f3 - ?f2");
|
||||
add(L"f8", L"5419351 / 1725033");
|
||||
add(L"f9", L"180");
|
||||
add(L"f10", L"?f7 / 880110");
|
||||
add(L"f11", L"?f6 / 1583055");
|
||||
add(L"f12", L"695381 - 440055");
|
||||
add(L"f13", L"939240 - 791527");
|
||||
add(L"f14", L"sqrt(?f12 * ?f12 + ?f13 * ?f13 + 0 * 0)");
|
||||
add(L"f15", L"atan2(?f12, ?f13)");
|
||||
add(L"f16", L"?f15 + ?f1");
|
||||
add(L"f17", L"?f16 * ?f9 / ?f0");
|
||||
add(L"f18", L"0 - ?f17");
|
||||
add(L"f19", L"534468 - 440055");
|
||||
add(L"f20", L"1430865 - 791527");
|
||||
add(L"f21", L"sqrt(?f19 * ?f19 + ?f20 * ?f20 + 0 * 0)");
|
||||
add(L"f22", L"atan2(?f19, ?f20)");
|
||||
add(L"f23", L"?f22 + ?f1");
|
||||
add(L"f24", L"?f23 * ?f9 / ?f0");
|
||||
add(L"f25", L"0 - ?f24");
|
||||
add(L"f26", L"756945 - 440055");
|
||||
add(L"f27", L"734520 - 791527");
|
||||
add(L"f28", L"sqrt(?f26 * ?f26 + ?f27 * ?f27 + 0 * 0)");
|
||||
add(L"f29", L"atan2(?f26, ?f27)");
|
||||
add(L"f30", L"?f29 + ?f1");
|
||||
add(L"f31", L"?f30 * ?f9 / ?f0");
|
||||
add(L"f32", L"0 - ?f31");
|
||||
add(L"f33", L"547047 - 440055");
|
||||
add(L"f34", L"613089 - 791527");
|
||||
add(L"f35", L"sqrt(?f33 * ?f33 + ?f34 * ?f34 + 0 * 0)");
|
||||
add(L"f36", L"atan2(?f33, ?f34)");
|
||||
add(L"f37", L"?f36 + ?f1");
|
||||
add(L"f38", L"?f37 * ?f9 / ?f0");
|
||||
add(L"f39", L"0 - ?f38");
|
||||
add(L"f40", L"525840 / ?f10");
|
||||
add(L"f41", L"1372440 / ?f11");
|
||||
add(L"f42", L"853493 / ?f10");
|
||||
add(L"f43", L"790375 / ?f11");
|
||||
add(L"f44", L"695381 / ?f10");
|
||||
add(L"f45", L"939240 / ?f11");
|
||||
add(L"f46", L"547047 / ?f10");
|
||||
add(L"f47", L"613089 / ?f11");
|
||||
add(L"f48", L"215163 / ?f10");
|
||||
add(L"f49", L"664947 / ?f10");
|
||||
add(L"f50", L"318107 / ?f11");
|
||||
add(L"f51", L"1264948 / ?f11");
|
||||
add(L"f52", L"21550000 - 16092125");
|
||||
add(L"f53", L"if(?f52, 16092125, 21550000)");
|
||||
add(L"f54", L"-21550000 - ?f53");
|
||||
add(L"f55", L"if(?f54, -21550000, ?f53)");
|
||||
add(L"f56", L"4895979 + ?f55");
|
||||
add(L"f57", L"4895979 + ?f1");
|
||||
add(L"f58", L"?f57 * ?f8 / ?f0");
|
||||
add(L"f59", L"0 - ?f58");
|
||||
add(L"f60", L"cos(?f59)");
|
||||
add(L"f61", L"0 - ?f60");
|
||||
add(L"f62", L"?f61 * 318045");
|
||||
add(L"f63", L"sin(?f59)");
|
||||
add(L"f64", L"0 - ?f63");
|
||||
add(L"f65", L"?f64 * 669518");
|
||||
add(L"f66", L"sqrt(?f62 * ?f62 + ?f65 * ?f65 + 0 * 0)");
|
||||
add(L"f67", L"318045 * 669518 / ?f66");
|
||||
add(L"f68", L"?f64 * ?f67");
|
||||
add(L"f69", L"534468 - ?f68");
|
||||
add(L"f70", L"?f61 * ?f67");
|
||||
add(L"f71", L"1430865 - ?f70");
|
||||
add(L"f72", L"?f69 - 318045");
|
||||
add(L"f73", L"?f71 - 669518");
|
||||
add(L"f74", L"?f69 + 318045");
|
||||
add(L"f75", L"?f71 + 669518");
|
||||
add(L"f76", L"?f56 + ?f1");
|
||||
add(L"f77", L"?f76 * ?f8 / ?f0");
|
||||
add(L"f78", L"0 - ?f77");
|
||||
add(L"f79", L"cos(?f78)");
|
||||
add(L"f80", L"0 - ?f79");
|
||||
add(L"f81", L"?f80 * 318045");
|
||||
add(L"f82", L"sin(?f78)");
|
||||
add(L"f83", L"0 - ?f82");
|
||||
add(L"f84", L"?f83 * 669518");
|
||||
add(L"f85", L"sqrt(?f81 * ?f81 + ?f84 * ?f84 + 0 * 0)");
|
||||
add(L"f86", L"318045 * 669518 / ?f85");
|
||||
add(L"f87", L"?f83 * ?f86");
|
||||
add(L"f88", L"?f69 + ?f87");
|
||||
add(L"f89", L"?f80 * ?f86");
|
||||
add(L"f90", L"?f71 + ?f89");
|
||||
add(L"f91", L"if(?f55, 534468, ?f72)");
|
||||
add(L"f92", L"if(?f55, 1430865, ?f73)");
|
||||
add(L"f93", L"if(?f55, 534468, ?f74)");
|
||||
add(L"f94", L"if(?f55, 1430865, ?f75)");
|
||||
add(L"f95", L"if(?f55, ?f72, ?f88)");
|
||||
add(L"f96", L"if(?f55, ?f73, ?f90)");
|
||||
add(L"f97", L"if(?f55, ?f74, ?f88)");
|
||||
add(L"f98", L"if(?f55, ?f75, ?f90)");
|
||||
add(L"f99", L"21550000 - -14831828");
|
||||
add(L"f100", L"if(?f99, -14831828, 21550000)");
|
||||
add(L"f101", L"-21550000 - ?f100");
|
||||
add(L"f102", L"if(?f101, -21550000, ?f100)");
|
||||
add(L"f103", L"19727807 + ?f102");
|
||||
add(L"f104", L"19727807 + ?f1");
|
||||
add(L"f105", L"?f104 * ?f8 / ?f0");
|
||||
add(L"f106", L"0 - ?f105");
|
||||
add(L"f107", L"cos(?f106)");
|
||||
add(L"f108", L"0 - ?f107");
|
||||
add(L"f109", L"?f108 * 208032");
|
||||
add(L"f110", L"sin(?f106)");
|
||||
add(L"f111", L"0 - ?f110");
|
||||
add(L"f112", L"?f111 * 559504");
|
||||
add(L"f113", L"sqrt(?f109 * ?f109 + ?f112 * ?f112 + 0 * 0)");
|
||||
add(L"f114", L"208032 * 559504 / ?f113");
|
||||
add(L"f115", L"?f111 * ?f114");
|
||||
add(L"f116", L"643004 - ?f115");
|
||||
add(L"f117", L"?f108 * ?f114");
|
||||
add(L"f118", L"668602 - ?f117");
|
||||
add(L"f119", L"?f116 - 208032");
|
||||
add(L"f120", L"?f118 - 559504");
|
||||
add(L"f121", L"?f116 + 208032");
|
||||
add(L"f122", L"?f118 + 559504");
|
||||
add(L"f123", L"?f103 + ?f1");
|
||||
add(L"f124", L"?f123 * ?f8 / ?f0");
|
||||
add(L"f125", L"0 - ?f124");
|
||||
add(L"f126", L"cos(?f125)");
|
||||
add(L"f127", L"0 - ?f126");
|
||||
add(L"f128", L"?f127 * 208032");
|
||||
add(L"f129", L"sin(?f125)");
|
||||
add(L"f130", L"0 - ?f129");
|
||||
add(L"f131", L"?f130 * 559504");
|
||||
add(L"f132", L"sqrt(?f128 * ?f128 + ?f131 * ?f131 + 0 * 0)");
|
||||
add(L"f133", L"208032 * 559504 / ?f132");
|
||||
add(L"f134", L"?f130 * ?f133");
|
||||
add(L"f135", L"?f116 + ?f134");
|
||||
add(L"f136", L"?f127 * ?f133");
|
||||
add(L"f137", L"?f118 + ?f136");
|
||||
add(L"f138", L"if(?f102, 643004, ?f119)");
|
||||
add(L"f139", L"if(?f102, 668602, ?f120)");
|
||||
add(L"f140", L"if(?f102, 643004, ?f121)");
|
||||
add(L"f141", L"if(?f102, 668602, ?f122)");
|
||||
add(L"f142", L"if(?f102, ?f119, ?f135)");
|
||||
add(L"f143", L"if(?f102, ?f120, ?f137)");
|
||||
add(L"f144", L"if(?f102, ?f121, ?f135)");
|
||||
add(L"f145", L"if(?f102, ?f122, ?f137)");
|
||||
}
|
||||
};
|
||||
class oox_shape_SwooshArrow : public oox_shape
|
||||
@ -990,4 +917,5 @@ public:
|
||||
handles.push_back(h2);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
@ -35,6 +35,14 @@
|
||||
//+ shapetypeRightArrowCallout
|
||||
//+ shapetypeUpArrowCallout
|
||||
//+ shapetypeDownArrowCallout
|
||||
//+ shapetypeCallout1
|
||||
//+ shapetypeCallout2
|
||||
//- shapetypeCallout3
|
||||
//+ shapetypeWedgeRectCallout
|
||||
//+ shapetypeWedgeRoundRectCallout
|
||||
//+ shapetypeCloudCallout
|
||||
//+ shapetypeWedgeEllipseCallout
|
||||
//+ shapetypeQuadArrowCallout
|
||||
|
||||
namespace cpdoccore
|
||||
{
|
||||
@ -277,5 +285,329 @@ public:
|
||||
handles.push_back(h2);
|
||||
}
|
||||
};
|
||||
class oox_shape_Callout1 : public oox_shape
|
||||
{
|
||||
public:
|
||||
oox_shape_Callout1()
|
||||
{
|
||||
odf_type_name =L"ooxml-callout1";
|
||||
|
||||
enhanced_path = L"S M ?f0 ?f2 L ?f1 ?f2 ?f1 ?f3 ?f0 ?f3 Z N F M ?f9 ?f8 L ?f11 ?f10 N";
|
||||
text_areas = L"?f0 ?f2 ?f1 ?f3";
|
||||
view_box = L"0 0 21600 21600";
|
||||
modifiers = L"18750 -8333 112500 -38333";
|
||||
|
||||
add(L"f0", L"left");
|
||||
add(L"f1", L"right");
|
||||
add(L"f2", L"top");
|
||||
add(L"f3", L"bottom");
|
||||
add(L"f4", L"?f3 - ?f2");
|
||||
add(L"f5", L"?f1 - ?f0");
|
||||
add(L"f6", L"min(?f5, ?f4)");
|
||||
add(L"f7", L"?f6 / 21600");
|
||||
add(L"f8", L"?f4 * ?f13 / 100000");
|
||||
add(L"f9", L"?f5 * ?f12 / 100000");
|
||||
add(L"f10", L"?f4 * ?f15 / 100000");
|
||||
add(L"f11", L"?f5 * ?f14 / 100000");
|
||||
add(L"f12", L"$1 / ?f7");
|
||||
add(L"f13", L"$0 / ?f7");
|
||||
add(L"f14", L"$3 / ?f7");
|
||||
add(L"f15", L"$2 / ?f7");
|
||||
/////////////////////////////////////////////////////////
|
||||
}
|
||||
};
|
||||
class oox_shape_Callout2 : public oox_shape
|
||||
{
|
||||
public:
|
||||
oox_shape_Callout2()
|
||||
{
|
||||
odf_type_name =L"ooxml-callout2";
|
||||
|
||||
enhanced_path = L"S M ?f0 ?f2 L ?f1 ?f2 ?f1 ?f3 ?f0 ?f3 Z N F M ?f9 ?f8 L ?f11 ?f10 ?f13 ?f12 N";
|
||||
text_areas = L"?f0 ?f2 ?f1 ?f3";
|
||||
view_box = L"0 0 21600 21600";
|
||||
modifiers = L"18750 -8333 18750 -16667 112500 -46667";
|
||||
|
||||
add(L"f0", L"left");
|
||||
add(L"f1", L"right");
|
||||
add(L"f2", L"top");
|
||||
add(L"f3", L"bottom");
|
||||
add(L"f4", L"?f3 - ?f2");
|
||||
add(L"f5", L"?f1 - ?f0");
|
||||
add(L"f6", L"min(?f5, ?f4)");
|
||||
add(L"f7", L"?f6 / 21600");
|
||||
add(L"f8", L"?f4 * ?f15 / 100000");
|
||||
add(L"f9", L"?f5 * ?f14 / 100000");
|
||||
add(L"f10", L"?f4 * ?f17 / 100000");
|
||||
add(L"f11", L"?f5 * ?f16 / 100000");
|
||||
add(L"f12", L"?f4 * ?f19 / 100000");
|
||||
add(L"f13", L"?f5 * ?f18 / 100000");
|
||||
add(L"f14", L"$1 / ?f7");
|
||||
add(L"f15", L"$0 / ?f7");
|
||||
add(L"f16", L"$3 / ?f7");
|
||||
add(L"f17", L"$2 / ?f7");
|
||||
add(L"f18", L"$5 / ?f7");
|
||||
add(L"f19", L"$4 / ?f7");
|
||||
/////////////////////////////////////////////////////////
|
||||
}
|
||||
};
|
||||
class oox_shape_CloudCallout : public oox_shape
|
||||
{
|
||||
public:
|
||||
oox_shape_CloudCallout()
|
||||
{
|
||||
odf_type_name =L"ooxml-cloudCallout";
|
||||
|
||||
enhanced_path = L"M 1930 7160 C 1530 4490 3400 1970 5270 1970 5860 1950 6470 2210 6970 2600 7450 1390 8340 650 9340 650 10004 690 10710 1050 11210 1700 11570 630 12330 0 13150 0 13840 0 14470 460 14870 1160 15330 440 16020 0 16740 0 17910 0 18900 1130 19110 2710 20240 3150 21060 4580 21060 6220 21060 6720 21000 7200 20830 7660 21310 8460 21600 9450 21600 10460 21600 12750 20310 14680 18650 15010 18650 17200 17370 18920 15770 18920 15220 18920 14700 18710 14240 18310 13820 20240 12490 21600 11000 21600 9890 21600 8840 20790 8210 19510 7620 20000 7930 20290 6240 20290 4850 20290 3570 19280 2900 17640 1300 17600 480 16300 480 14660 480 13900 690 13210 1070 12640 380 12160 0 11210 0 10120 0 8590 840 7330 1930 7160 Z N M 1930 7160 C 1950 7410 2040 7690 2090 7920 F N M 6970 2600 C 7200 2790 7480 3050 7670 3310 F N M 11210 1700 C 11130 1910 11080 2160 11030 2400 F N M 14870 1160 C 14720 1400 14640 1720 14540 2010 F N M 19110 2710 C 19130 2890 19230 3290 19190 3380 F N M 20830 7660 C 20660 8170 20430 8620 20110 8990 F N M 18660 15010 C 18740 14200 18280 12200 17000 11450 F N M 14240 18310 C 14320 17980 14350 17680 14370 17360 F N M 8220 19510 C 8060 19250 7960 18950 7860 18640 F N M 2900 17640 C 3090 17600 3280 17540 3460 17450 F N M 1070 12640 C 1400 12900 1780 13130 2330 13040 F N U ?f17 ?f18 1800 1800 0 23592960 Z N U ?f19 ?f20 1200 1200 0 23592960 Z N U ?f13 ?f14 700 700 0 23592960 Z N";
|
||||
text_areas = L"3000 3320 17110 17330";
|
||||
view_box = L"0 0 21600 21600";
|
||||
modifiers = L"6300 24300";
|
||||
glue_points = L"0 10800 10800 21600 21600 10800 10800 0 ?f13 ?f14";
|
||||
|
||||
add(L"f0", L"$0 -10800");
|
||||
add(L"f1", L"$1 -10800");
|
||||
add(L"f2", L"atan2(?f1 ,?f0 )/(pi/180)");
|
||||
add(L"f3", L"10800*cos(?f2 *(pi/180))");
|
||||
add(L"f4", L"10800*sin(?f2 *(pi/180))");
|
||||
add(L"f5", L"?f3 +10800");
|
||||
add(L"f6", L"?f4 +10800");
|
||||
add(L"f7", L"$0 -?f5 ");
|
||||
add(L"f8", L"$1 -?f6 ");
|
||||
add(L"f9", L"?f7 /3");
|
||||
add(L"f10", L"?f8 /3");
|
||||
add(L"f11", L"?f7 *2/3");
|
||||
add(L"f12", L"?f8 *2/3");
|
||||
add(L"f13", L"$0 ");
|
||||
add(L"f14", L"$1 ");
|
||||
add(L"f15", L"?f3 /12");
|
||||
add(L"f16", L"?f4 /12");
|
||||
add(L"f17", L"?f9 +?f5 -?f15 ");
|
||||
add(L"f18", L"?f10 +?f6 -?f16 ");
|
||||
add(L"f19", L"?f11 +?f5 ");
|
||||
add(L"f20", L"?f12 +?f6 ");
|
||||
/////////////////////////////////////////////////////////
|
||||
_handle h1;
|
||||
|
||||
h1.position = L"$0 $1";
|
||||
handles.push_back(h1);
|
||||
}
|
||||
};
|
||||
class oox_shape_WedgeRectCallout : public oox_shape
|
||||
{
|
||||
public:
|
||||
oox_shape_WedgeRectCallout()
|
||||
{
|
||||
odf_type_name =L"ooxml-wedgeRectCallout";
|
||||
|
||||
enhanced_path = L"M 0 0 L 0 3590 ?f2 ?f3 0 8970 0 12630 ?f4 ?f5 0 18010 0 21600 3590 21600 ?f6 ?f7 8970 21600 12630 21600 ?f8 ?f9 18010 21600 21600 21600 21600 18010 ?f10 ?f11 21600 12630 21600 8970 ?f12 ?f13 21600 3590 21600 0 18010 0 ?f14 ?f15 12630 0 8970 0 ?f16 ?f17 3590 0 0 0 Z N";
|
||||
text_areas = L"0 0 21600 21600";
|
||||
view_box = L"0 0 21600 21600";
|
||||
modifiers = L"6300 24300";
|
||||
glue_points = L"?f40 ?f41";
|
||||
|
||||
add(L"f0", L"$0 -10800");
|
||||
add(L"f1", L"$1 -10800");
|
||||
add(L"f2", L"if(?f18 ,$0 ,0)");
|
||||
add(L"f3", L"if(?f18 ,$1 ,6280)");
|
||||
add(L"f4", L"if(?f23 ,$0 ,0)");
|
||||
add(L"f5", L"if(?f23 ,$1 ,15320)");
|
||||
add(L"f6", L"if(?f26 ,$0 ,6280)");
|
||||
add(L"f7", L"if(?f26 ,$1 ,21600)");
|
||||
add(L"f8", L"if(?f29 ,$0 ,15320)");
|
||||
add(L"f9", L"if(?f29 ,$1 ,21600)");
|
||||
add(L"f10", L"if(?f32 ,$0 ,21600)");
|
||||
add(L"f11", L"if(?f32 ,$1 ,15320)");
|
||||
add(L"f12", L"if(?f34 ,$0 ,21600)");
|
||||
add(L"f13", L"if(?f34 ,$1 ,6280)");
|
||||
add(L"f14", L"if(?f36 ,$0 ,15320)");
|
||||
add(L"f15", L"if(?f36 ,$1 ,0)");
|
||||
add(L"f16", L"if(?f38 ,$0 ,6280)");
|
||||
add(L"f17", L"if(?f38 ,$1 ,0)");
|
||||
add(L"f18", L"if($0 ,-1,?f19 )");
|
||||
add(L"f19", L"if(?f1 ,-1,?f22 )");
|
||||
add(L"f20", L"abs(?f0 )");
|
||||
add(L"f21", L"abs(?f1 )");
|
||||
add(L"f22", L"?f20 -?f21 ");
|
||||
add(L"f23", L"if($0 ,-1,?f24 )");
|
||||
add(L"f24", L"if(?f1 ,?f22 ,-1)");
|
||||
add(L"f25", L"$1 -21600");
|
||||
add(L"f26", L"if(?f25 ,?f27 ,-1)");
|
||||
add(L"f27", L"if(?f0 ,-1,?f28 )");
|
||||
add(L"f28", L"?f21 -?f20 ");
|
||||
add(L"f29", L"if(?f25 ,?f30 ,-1)");
|
||||
add(L"f30", L"if(?f0 ,?f28 ,-1)");
|
||||
add(L"f31", L"$0 -21600");
|
||||
add(L"f32", L"if(?f31 ,?f33 ,-1)");
|
||||
add(L"f33", L"if(?f1 ,?f22 ,-1)");
|
||||
add(L"f34", L"if(?f31 ,?f35 ,-1)");
|
||||
add(L"f35", L"if(?f1 ,-1,?f22 )");
|
||||
add(L"f36", L"if($1 ,-1,?f37 )");
|
||||
add(L"f37", L"if(?f0 ,?f28 ,-1)");
|
||||
add(L"f38", L"if($1 ,-1,?f39 )");
|
||||
add(L"f39", L"if(?f0 ,-1,?f28 )");
|
||||
add(L"f40", L"$0 ");
|
||||
add(L"f41", L"$1 ");
|
||||
/////////////////////////////////////////////////////////
|
||||
_handle h1;
|
||||
|
||||
h1.position = L"$0 $1";
|
||||
handles.push_back(h1);
|
||||
}
|
||||
};
|
||||
|
||||
class oox_shape_WedgeRoundRectCallout : public oox_shape
|
||||
{
|
||||
public:
|
||||
oox_shape_WedgeRoundRectCallout()
|
||||
{
|
||||
odf_type_name =L"ooxml-wedgeRoundRectCallout";
|
||||
|
||||
enhanced_path = L"M 3590 0 X 0 3590 L ?f2 ?f3 0 8970 0 12630 ?f4 ?f5 0 18010 Y 3590 21600 L ?f6 ?f7 8970 21600 12630 21600 ?f8 ?f9 18010 21600 X 21600 18010 L ?f10 ?f11 21600 12630 21600 8970 ?f12 ?f13 21600 3590 Y 18010 0 L ?f14 ?f15 12630 0 8970 0 ?f16 ?f17 Z N";
|
||||
text_areas = L"800 800 20800 20800";
|
||||
view_box = L"0 0 21600 21600";
|
||||
modifiers = L"6300 24300";
|
||||
glue_points = L"?f40 ?f41";
|
||||
|
||||
add(L"f0", L"$0 -10800");
|
||||
add(L"f1", L"$1 -10800");
|
||||
add(L"f2", L"if(?f18 ,$0 ,0)");
|
||||
add(L"f3", L"if(?f18 ,$1 ,6280)");
|
||||
add(L"f4", L"if(?f23 ,$0 ,0)");
|
||||
add(L"f5", L"if(?f23 ,$1 ,15320)");
|
||||
add(L"f6", L"if(?f26 ,$0 ,6280)");
|
||||
add(L"f7", L"if(?f26 ,$1 ,21600)");
|
||||
add(L"f8", L"if(?f29 ,$0 ,15320)");
|
||||
add(L"f9", L"if(?f29 ,$1 ,21600)");
|
||||
add(L"f10", L"if(?f32 ,$0 ,21600)");
|
||||
add(L"f11", L"if(?f32 ,$1 ,15320)");
|
||||
add(L"f12", L"if(?f34 ,$0 ,21600)");
|
||||
add(L"f13", L"if(?f34 ,$1 ,6280)");
|
||||
add(L"f14", L"if(?f36 ,$0 ,15320)");
|
||||
add(L"f15", L"if(?f36 ,$1 ,0)");
|
||||
add(L"f16", L"if(?f38 ,$0 ,6280)");
|
||||
add(L"f17", L"if(?f38 ,$1 ,0)");
|
||||
add(L"f18", L"if($0 ,-1,?f19 )");
|
||||
add(L"f19", L"if(?f1 ,-1,?f22 )");
|
||||
add(L"f20", L"abs(?f0 )");
|
||||
add(L"f21", L"abs(?f1 )");
|
||||
add(L"f22", L"?f20 -?f21 ");
|
||||
add(L"f23", L"if($0 ,-1,?f24 )");
|
||||
add(L"f24", L"if(?f1 ,?f22 ,-1)");
|
||||
add(L"f25", L"$1 -21600");
|
||||
add(L"f26", L"if(?f25 ,?f27 ,-1)");
|
||||
add(L"f27", L"if(?f0 ,-1,?f28 )");
|
||||
add(L"f28", L"?f21 -?f20 ");
|
||||
add(L"f29", L"if(?f25 ,?f30 ,-1)");
|
||||
add(L"f30", L"if(?f0 ,?f28 ,-1)");
|
||||
add(L"f31", L"$0 -21600");
|
||||
add(L"f32", L"if(?f31 ,?f33 ,-1)");
|
||||
add(L"f33", L"if(?f1 ,?f22 ,-1)");
|
||||
add(L"f34", L"if(?f31 ,?f35 ,-1)");
|
||||
add(L"f35", L"if(?f1 ,-1,?f22 )");
|
||||
add(L"f36", L"if($1 ,-1,?f37 )");
|
||||
add(L"f37", L"if(?f0 ,?f28 ,-1)");
|
||||
add(L"f38", L"if($1 ,-1,?f39 )");
|
||||
add(L"f39", L"if(?f0 ,-1,?f28 )");
|
||||
add(L"f40", L"$0 ");
|
||||
add(L"f41", L"$1 ");
|
||||
/////////////////////////////////////////////////////////
|
||||
_handle h1;
|
||||
|
||||
h1.position = L"$0 $1";
|
||||
handles.push_back(h1);
|
||||
}
|
||||
};
|
||||
class oox_shape_WedgeEllipseCallout : public oox_shape
|
||||
{
|
||||
public:
|
||||
oox_shape_WedgeEllipseCallout()
|
||||
{
|
||||
odf_type_name =L"ooxml-wedgeEllipseCallout";
|
||||
|
||||
enhanced_path = L"W 0 0 21600 21600 ?f22 ?f23 ?f18 ?f19 L ?f14 ?f15 Z N";
|
||||
text_areas = L"3200 3200 18400 18400";
|
||||
view_box = L"0 0 21600 21600";
|
||||
modifiers = L"6300 24300";
|
||||
glue_points = L"3160 3160 3160 18440 18440 18440 18440 3160 ?f14 ?f15";
|
||||
|
||||
add(L"f0", L"$0 -10800");
|
||||
add(L"f1", L"$1 -10800");
|
||||
add(L"f2", L"?f0 *?f0 ");
|
||||
add(L"f3", L"?f1 *?f1 ");
|
||||
add(L"f4", L"?f2 +?f3 ");
|
||||
add(L"f5", L"sqrt(?f4 )");
|
||||
add(L"f6", L"?f5 -10800");
|
||||
add(L"f7", L"atan2(?f1 ,?f0 )/(pi/180)");
|
||||
add(L"f8", L"?f7 -10");
|
||||
add(L"f9", L"?f7 +10");
|
||||
add(L"f10", L"10800*cos(?f7 *(pi/180))");
|
||||
add(L"f11", L"10800*sin(?f7 *(pi/180))");
|
||||
add(L"f12", L"?f10 +10800");
|
||||
add(L"f13", L"?f11 +10800");
|
||||
add(L"f14", L"if(?f6 ,$0 ,?f12 )");
|
||||
add(L"f15", L"if(?f6 ,$1 ,?f13 )");
|
||||
add(L"f16", L"10800*cos(?f8 *(pi/180))");
|
||||
add(L"f17", L"10800*sin(?f8 *(pi/180))");
|
||||
add(L"f18", L"?f16 +10800");
|
||||
add(L"f19", L"?f17 +10800");
|
||||
add(L"f20", L"10800*cos(?f9 *(pi/180))");
|
||||
add(L"f21", L"10800*sin(?f9 *(pi/180))");
|
||||
add(L"f22", L"?f20 +10800");
|
||||
add(L"f23", L"?f21 +10800");
|
||||
/////////////////////////////////////////////////////////
|
||||
_handle h1;
|
||||
|
||||
h1.position = L"$0 $1";
|
||||
handles.push_back(h1);
|
||||
}
|
||||
};
|
||||
class oox_shape_QuadArrowCallout : public oox_shape
|
||||
{
|
||||
public:
|
||||
oox_shape_QuadArrowCallout()
|
||||
{
|
||||
odf_type_name =L"ooxml-quadArrowCallout";
|
||||
|
||||
enhanced_path = L"M ?f0 ?f6 L ?f17 ?f30 ?f17 ?f32 ?f21 ?f32 ?f21 ?f28 ?f25 ?f28 ?f25 ?f17 ?f23 ?f17 ?f9 ?f2 ?f24 ?f17 ?f26 ?f17 ?f26 ?f28 ?f22 ?f28 ?f22 ?f32 ?f20 ?f32 ?f20 ?f30 ?f1 ?f6 ?f20 ?f31 ?f20 ?f33 ?f22 ?f33 ?f22 ?f29 ?f26 ?f29 ?f26 ?f27 ?f24 ?f27 ?f9 ?f3 ?f23 ?f27 ?f25 ?f27 ?f25 ?f29 ?f21 ?f29 ?f21 ?f33 ?f17 ?f33 ?f17 ?f31 Z N";
|
||||
text_areas = L"?f21 ?f28 ?f22 ?f29";
|
||||
view_box = L"0 0 21600 21600";
|
||||
modifiers = L"18515 18515 18515 48123";
|
||||
|
||||
add(L"f0", L"left");
|
||||
add(L"f1", L"right");
|
||||
add(L"f2", L"top");
|
||||
add(L"f3", L"bottom");
|
||||
add(L"f4", L"?f3 - ?f2");
|
||||
add(L"f5", L"?f4 / 2");
|
||||
add(L"f6", L"?f2 + ?f5");
|
||||
add(L"f7", L"?f1 - ?f0");
|
||||
add(L"f8", L"?f7 / 2");
|
||||
add(L"f9", L"?f0 + ?f8");
|
||||
add(L"f10", L"min(?f7, ?f4)");
|
||||
add(L"f11", L"$1");
|
||||
add(L"f12", L"$0");
|
||||
add(L"f13", L"$2");
|
||||
add(L"f14", L"$3");
|
||||
add(L"f15", L"?f10 * ?f11 / 100000");
|
||||
add(L"f16", L"?f10 * ?f12 / 200000");
|
||||
add(L"f17", L"?f10 * ?f13 / 100000");
|
||||
add(L"f18", L"?f7 * ?f14 / 200000");
|
||||
add(L"f19", L"?f4 * ?f14 / 200000");
|
||||
add(L"f20", L"?f1 - ?f17");
|
||||
add(L"f21", L"?f9 - ?f18");
|
||||
add(L"f22", L"?f9 + ?f18");
|
||||
add(L"f23", L"?f9 - ?f15");
|
||||
add(L"f24", L"?f9 + ?f15");
|
||||
add(L"f25", L"?f9 - ?f16");
|
||||
add(L"f26", L"?f9 + ?f16");
|
||||
add(L"f27", L"?f3 - ?f17");
|
||||
add(L"f28", L"?f6 - ?f19");
|
||||
add(L"f29", L"?f6 + ?f19");
|
||||
add(L"f30", L"?f6 - ?f15");
|
||||
add(L"f31", L"?f6 + ?f15");
|
||||
add(L"f32", L"?f6 - ?f16");
|
||||
add(L"f33", L"?f6 + ?f16");
|
||||
/////////////////////////////////////////////////////////
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -33,5 +33,16 @@
|
||||
|
||||
namespace cpdoccore
|
||||
{
|
||||
class oox_shape_StraightConnector1 : public oox_shape
|
||||
{
|
||||
public:
|
||||
oox_shape_StraightConnector1()
|
||||
{
|
||||
odf_type_name =L"ooxml-straightConnector1";
|
||||
|
||||
enhanced_path = L"M 0 0 L 21600 21600 N";
|
||||
view_box = L"0 0 21600 21600";
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user