mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
Compare commits
111 Commits
v5.0.0.46
...
core-linux
| Author | SHA1 | Date | |
|---|---|---|---|
| f9e87624c0 | |||
| 3bdf44b8c7 | |||
| d586698025 | |||
| eb6fb03ca5 | |||
| ad40f51dee | |||
| 5e60456fc1 | |||
| 1f9e3f4fd8 | |||
| 334620cd5a | |||
| 4a5fca5ccf | |||
| 828df16fe5 | |||
| 66dae03919 | |||
| 114a01f364 | |||
| 2ddaf33156 | |||
| 1af37af850 | |||
| b58026ea66 | |||
| 09a8a6794a | |||
| 941cbe4f9b | |||
| 668d0c2abf | |||
| 66db5b09e6 | |||
| e7dae4b381 | |||
| 7dbbacf336 | |||
| f43a0bbfe2 | |||
| 746c228261 | |||
| d8c7d41462 | |||
| 4a9abce180 | |||
| a78711a19c | |||
| b69051a5b4 | |||
| 04e4f1adae | |||
| 6e15370af2 | |||
| 57465b60bf | |||
| 24d58fe189 | |||
| 56bb39f716 | |||
| 60bcca0090 | |||
| 92ce863bdf | |||
| 48d4b72d4b | |||
| 85de7ec7a6 | |||
| 9e6d4950c2 | |||
| cb4befa078 | |||
| ac1292a17a | |||
| 007a984c36 | |||
| d3d3180402 | |||
| fa9c096f3c | |||
| e1ec9d942e | |||
| 4acaa75b06 | |||
| 431115ef48 | |||
| 2d66d9902e | |||
| 206dd12a47 | |||
| e8d3059fe8 | |||
| f624f731de | |||
| ed373b7e2d | |||
| a67eb5644d | |||
| 5040220d82 | |||
| 4f0b889f04 | |||
| c94768902b | |||
| f575947c03 | |||
| 16bdbafa75 | |||
| 089871d3ae | |||
| 765677d952 | |||
| 6afc38c899 | |||
| a43639587f | |||
| 46d022388d | |||
| 31363e8f83 | |||
| e1286e4b73 | |||
| 0366bcb341 | |||
| 452f717e0e | |||
| ab3add9577 | |||
| 54939bca61 | |||
| 7ccde9c777 | |||
| 6bdfa26c7e | |||
| a5bae64959 | |||
| 4d04a0d649 | |||
| fb7af5b902 | |||
| 77172fb39c | |||
| 78ecdc676c | |||
| bbccdf009b | |||
| 4b26066377 | |||
| 8742163d51 | |||
| 212753f831 | |||
| 903236d890 | |||
| 15bd732b22 | |||
| 3e86bf7644 | |||
| d6cd7c30f5 | |||
| 89b384abfe | |||
| f54baf3aa8 | |||
| b2184f7167 | |||
| 3a10eabfe9 | |||
| f9e80f3602 | |||
| 80b1e5e886 | |||
| d1a7800f36 | |||
| e223ffd0db | |||
| b140f4b521 | |||
| 2d570818be | |||
| 1462f08825 | |||
| 92fb4ac40b | |||
| 2bf55b7c8b | |||
| cf2159cd54 | |||
| decfeec7a1 | |||
| 50f47caea9 | |||
| 89cd81ecfd | |||
| 8df6286e80 | |||
| e947c91a7b | |||
| ef53ac4c63 | |||
| f50dd716ad | |||
| 54d0260ea2 | |||
| 2577365e08 | |||
| 792a722063 | |||
| a7a78a09c1 | |||
| 0fc749f839 | |||
| c0a061f2cb | |||
| 65e7372cf7 | |||
| 1ea27ad7f8 |
3
.gitignore
vendored
3
.gitignore
vendored
@ -45,3 +45,6 @@ OfficeUtils/win32/OfficeUtilsLib/OfficeUtilsLib/ReadMe.txt
|
||||
*.tlb
|
||||
*.idb
|
||||
**/.hg
|
||||
*.zip
|
||||
*.tar.gz
|
||||
**/*.build/
|
||||
|
||||
@ -157,6 +157,7 @@ namespace OpenXmlRelationshipTypes
|
||||
static const wchar_t* OleObject = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject";
|
||||
static const wchar_t* GlossaryDocument = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/glossaryDocument";
|
||||
static const wchar_t* Package = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package";
|
||||
static const wchar_t* VbaProject = L"http://schemas.microsoft.com/office/2006/relationships/vbaProject";
|
||||
}
|
||||
|
||||
namespace MicrosoftWordRelationshipTypes
|
||||
|
||||
@ -65,7 +65,7 @@ namespace DocFileFormat
|
||||
{
|
||||
ConversionContext context( doc, docx );
|
||||
|
||||
//Write styles.xml
|
||||
//Write styles.xml
|
||||
if (doc->Styles)
|
||||
{
|
||||
StyleSheetMapping styleSheetMapping( &context );
|
||||
@ -88,9 +88,7 @@ namespace DocFileFormat
|
||||
return S_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Write numbering.xml
|
||||
//Write numbering.xml
|
||||
if (doc->listTable)
|
||||
{
|
||||
NumberingMapping numberingMapping( &context );
|
||||
@ -110,7 +108,7 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
|
||||
//Write fontTable.xml
|
||||
//Write fontTable.xml
|
||||
if (doc->FontTable)
|
||||
{
|
||||
FontTableMapping fontTableMapping( &context );
|
||||
@ -130,7 +128,7 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
|
||||
//write the footnotes
|
||||
//write the footnotes
|
||||
FootnotesMapping footnotesMapping( &context );
|
||||
doc->Convert( &footnotesMapping );
|
||||
|
||||
@ -147,7 +145,7 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
|
||||
//write the endnotes
|
||||
//write the endnotes
|
||||
EndnotesMapping endnotesMapping( &context );
|
||||
doc->Convert( &endnotesMapping );
|
||||
|
||||
@ -164,7 +162,7 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
|
||||
//write the comments
|
||||
//write the comments
|
||||
CommentsMapping commentsMapping( &context );
|
||||
doc->Convert( &commentsMapping );
|
||||
|
||||
@ -181,13 +179,13 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
|
||||
//write settings.xml at last because of the rsid list
|
||||
//write settings.xml at last because of the rsid list
|
||||
if (doc->DocProperties)
|
||||
{
|
||||
SettingsMapping settingsMapping( &context );
|
||||
doc->DocProperties->Convert( &settingsMapping );
|
||||
}
|
||||
|
||||
|
||||
if ( progress != NULL )
|
||||
{
|
||||
progress->OnProgress( progress->caller, DOC_ONPROGRESSEVENT_ID, 975000 );
|
||||
@ -204,7 +202,7 @@ namespace DocFileFormat
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
long Converter::LoadAndConvert(const std::wstring& strSrcFile, const std::wstring& strDstDirectory, const std::wstring& password, const ProgressCallback* progress)
|
||||
long Converter::LoadAndConvert(const std::wstring& strSrcFile, const std::wstring& strDstDirectory, const std::wstring& password, const ProgressCallback* progress, bool &bMacros)
|
||||
{
|
||||
long result = S_FALSE;
|
||||
|
||||
@ -219,7 +217,7 @@ namespace DocFileFormat
|
||||
|
||||
if (result == S_OK)
|
||||
{
|
||||
docx.SaveDocument();
|
||||
docx.SaveDocument(bMacros);
|
||||
|
||||
if (progress)progress->OnProgress(progress->caller, DOC_ONPROGRESSEVENT_ID, 1000000);
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ namespace DocFileFormat
|
||||
|
||||
std::wstring m_sTempFolder;
|
||||
|
||||
long LoadAndConvert(const std::wstring & strSrcFile, const std::wstring & strDstDirectory, const std::wstring & password, const ProgressCallback* progress);
|
||||
long LoadAndConvert(const std::wstring & strSrcFile, const std::wstring & strDstDirectory, const std::wstring & password, const ProgressCallback* progress, bool &bMacros);
|
||||
|
||||
private:
|
||||
long Convert(WordDocument* doc, WordprocessingDocument* docx, const ProgressCallback* progress);
|
||||
|
||||
@ -902,7 +902,7 @@ namespace DocFileFormat
|
||||
{
|
||||
int shape_type = oPicture.shapeContainer->getShapeType();
|
||||
|
||||
if (shape_type != msosptPictureFrame) picture = false;
|
||||
if (shape_type != msosptPictureFrame) picture = false;//шаблон 1.doc картинка в колонтитуле
|
||||
}
|
||||
|
||||
if (picture)
|
||||
|
||||
@ -50,8 +50,7 @@ namespace DocFileFormat
|
||||
void MainDocumentMapping::Apply(IVisitable* visited)
|
||||
{
|
||||
m_document = static_cast<WordDocument*>(visited);
|
||||
m_context->_docx->RegisterDocument();
|
||||
|
||||
|
||||
// Header
|
||||
m_pXmlWriter->WriteNodeBegin(L"?xml version=\"1.0\" encoding=\"UTF-8\"?");
|
||||
m_pXmlWriter->WriteNodeBegin(L"w:document", TRUE );
|
||||
|
||||
@ -149,7 +149,14 @@ namespace DocFileFormat
|
||||
point.y = guides[index].param3;
|
||||
}
|
||||
}
|
||||
|
||||
if ((size_t)point.y > 0xffff)
|
||||
{
|
||||
point.y &= 0xffff;
|
||||
}
|
||||
if ((size_t)point.x > 0xffff)
|
||||
{
|
||||
point.x &= 0xffff;
|
||||
}
|
||||
m_arPoints.push_back(point);
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,8 +63,25 @@ namespace DocFileFormat
|
||||
Shape* sh = dynamic_cast<Shape*>( *iter );
|
||||
if (sh)
|
||||
{
|
||||
if (sh->shapeType) return sh->shapeType->GetTypeCode();
|
||||
else return 0;
|
||||
if (sh->shapeType)
|
||||
{
|
||||
return sh->shapeType->GetTypeCode();
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( std::vector<Record*>::const_iterator iter1 = this->Children.begin(); iter1 != this->Children.end(); iter1++ )
|
||||
{
|
||||
ShapeOptions* sh_options = dynamic_cast<ShapeOptions*>( *iter1 );
|
||||
if (sh_options)
|
||||
{
|
||||
if (sh_options->OptionsByID.end() != sh_options->OptionsByID.find(Pib))
|
||||
{
|
||||
return msosptPictureFrame;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
@ -73,7 +73,6 @@ namespace DocFileFormat
|
||||
|
||||
NSDirectory::CreateDirectory( m_strOutputPath + FILE_SEPARATOR_STR + L"word" + FILE_SEPARATOR_STR + L"_rels" );
|
||||
|
||||
|
||||
WriteRelsFile( DocumentRelationshipsFile );
|
||||
|
||||
WriteRelsFile( FootnotesRelationshipsFile );
|
||||
@ -199,7 +198,14 @@ namespace DocFileFormat
|
||||
{
|
||||
return AddPart( L"word", L"document.xml", WordprocessingMLContentTypes::MainDocument, L"");
|
||||
}
|
||||
|
||||
int OpenXmlPackage::RegisterDocumentMacros()
|
||||
{
|
||||
return AddPart( L"word", L"document.xml", WordprocessingMLContentTypes::MainDocumentMacro, L"");
|
||||
}
|
||||
int OpenXmlPackage::RegisterVbaProject()
|
||||
{
|
||||
return AddPart( L"word", L"vbaProject.bin", MicrosoftWordContentTypes::VbaProject, OpenXmlRelationshipTypes::VbaProject );
|
||||
}
|
||||
int OpenXmlPackage::RegisterFontTable()
|
||||
{
|
||||
return AddPart( L"word", L"fontTable.xml", WordprocessingMLContentTypes::FontTable, OpenXmlRelationshipTypes::FontTable );
|
||||
|
||||
@ -118,6 +118,8 @@ namespace DocFileFormat
|
||||
|
||||
class OpenXmlPackage
|
||||
{
|
||||
public:
|
||||
const WordDocument* docFile;
|
||||
private:
|
||||
ContentTypesFile DocumentContentTypesFile;
|
||||
RelationshipsFile MainRelationshipsFile;
|
||||
@ -137,8 +139,6 @@ namespace DocFileFormat
|
||||
int _footerCounter;
|
||||
int _oleCounter;
|
||||
|
||||
const WordDocument* docFile;
|
||||
|
||||
int AddHeaderPart( const std::wstring& fileName, const std::wstring& relationshipType = L"", const std::wstring& targetMode = L"" );
|
||||
int AddFooterPart( const std::wstring& fileName, const std::wstring& relationshipType = L"", const std::wstring& targetMode = L"" );
|
||||
int AddFootnotesPart( const std::wstring& fileName, const std::wstring& relationshipType = L"", const std::wstring& targetMode = L"" );
|
||||
@ -166,6 +166,7 @@ namespace DocFileFormat
|
||||
HRESULT SaveEmbeddedObject ( const std::wstring& fileName, const std::string& data );
|
||||
|
||||
int RegisterDocument();
|
||||
int RegisterDocumentMacros();
|
||||
int RegisterFontTable();
|
||||
int RegisterNumbering();
|
||||
int RegisterSettings();
|
||||
@ -179,5 +180,6 @@ namespace DocFileFormat
|
||||
int RegisterOLEObject ( const IMapping* mapping, const std::wstring& objectType );
|
||||
int RegisterPackage ( const IMapping* mapping, const std::wstring& objectType);
|
||||
int RegisterExternalOLEObject( const IMapping* mapping, const std::wstring& objectType, const std::wstring& uri );
|
||||
int RegisterVbaProject();
|
||||
};
|
||||
}
|
||||
|
||||
@ -42,7 +42,6 @@ namespace DocFileFormat
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
~StructuredStorageReader()
|
||||
{
|
||||
if(m_pStorage)
|
||||
@ -62,6 +61,12 @@ namespace DocFileFormat
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool isDirectory( const std::string& name )
|
||||
{
|
||||
if (!m_pStorage) return false;
|
||||
|
||||
return m_pStorage->isDirectory(name);
|
||||
}
|
||||
|
||||
bool GetStream (const char *path, POLE::Stream** ppStream)
|
||||
{
|
||||
@ -79,8 +84,78 @@ namespace DocFileFormat
|
||||
{
|
||||
return m_pStorage;
|
||||
}
|
||||
|
||||
void copy( int indent, std::string path, POLE::Storage * storageOut, bool withRoot = true)
|
||||
{
|
||||
std::list<std::string> entries, entries_sort;
|
||||
entries = m_pStorage->entries( path );
|
||||
|
||||
for( std::list<std::string>::iterator it = entries.begin(); it != entries.end(); it++ )
|
||||
{
|
||||
std::string name = *it;
|
||||
std::string fullname = path + name;
|
||||
|
||||
if( m_pStorage->isDirectory( fullname ) )
|
||||
{
|
||||
entries_sort.push_back(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
entries_sort.push_front(name);
|
||||
}
|
||||
}
|
||||
//for( std::list<std::string>::iterator it = entries.begin(); it != entries.end(); it++ )
|
||||
for( std::list<std::string>::iterator it = entries_sort.begin(); it != entries_sort.end(); it++ )
|
||||
{
|
||||
std::string name = *it;
|
||||
std::string fullname = path + name;
|
||||
|
||||
if( m_pStorage->isDirectory( fullname ) )
|
||||
{
|
||||
copy( indent + 1, fullname + "/", storageOut, withRoot );
|
||||
}
|
||||
else
|
||||
{
|
||||
copy_stream(fullname, storageOut, withRoot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
void copy_stream(std::string streamName, POLE::Storage * storageOut, bool withRoot = true)
|
||||
{
|
||||
POLE::Stream *stream = new POLE::Stream(m_pStorage, streamName);
|
||||
if (!stream) return;
|
||||
|
||||
stream->seek(0);
|
||||
int size_stream = stream->size();
|
||||
|
||||
if (withRoot == false)
|
||||
{
|
||||
int pos = streamName.find("/");
|
||||
if (pos >= 0)
|
||||
streamName = streamName.substr(pos + 1);
|
||||
}
|
||||
|
||||
POLE::Stream *streamNew = new POLE::Stream(storageOut, streamName, true, size_stream);
|
||||
if (!streamNew) return;
|
||||
|
||||
unsigned char* data_stream = new unsigned char[size_stream];
|
||||
if (data_stream)
|
||||
{
|
||||
stream->read(data_stream, size_stream);
|
||||
|
||||
streamNew->write(data_stream, size_stream);
|
||||
|
||||
delete []data_stream;
|
||||
data_stream = NULL;
|
||||
}
|
||||
|
||||
streamNew->flush();
|
||||
|
||||
delete streamNew;
|
||||
delete stream;
|
||||
}
|
||||
|
||||
POLE::Storage* m_pStorage;
|
||||
};
|
||||
|
||||
@ -1905,13 +1905,13 @@ namespace DocFileFormat
|
||||
switch (pSpa->wr)
|
||||
{
|
||||
case 0:
|
||||
case 2: wrapType = L"square";
|
||||
case 1: wrapType = L"topAndBottom";
|
||||
case 3: wrapType = L"through";
|
||||
case 2: wrapType = L"square"; break;
|
||||
case 1: wrapType = L"topAndBottom"; break;
|
||||
case 3: wrapType = L"through"; break;
|
||||
case 4:
|
||||
case 5: wrapType = L"tight";
|
||||
case 5: wrapType = L"tight"; break;
|
||||
default:
|
||||
wrapType = L"none";
|
||||
wrapType = L"none"; break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -483,26 +483,27 @@ namespace DocFileFormat
|
||||
delete storageOut;
|
||||
return false;
|
||||
}
|
||||
DecryptStream( 0, "/", storageIn, storageOut, Decryptor);
|
||||
|
||||
std::list<std::string> listStream = storageIn->entries();
|
||||
//std::list<std::string> listStream = storageIn->entries();
|
||||
|
||||
for (std::list<std::string>::iterator it = listStream.begin(); it != listStream.end(); it++)
|
||||
{
|
||||
if (storageIn->isDirectory(*it))
|
||||
{
|
||||
std::list<std::string> list_entry = storageIn->GetAllStreams(*it);
|
||||
|
||||
for (std::list<std::string>::iterator it2 = list_entry.begin(); it2 != list_entry.end(); it2++)
|
||||
{
|
||||
DecryptStream(Decryptor, *it2, storageIn, storageOut);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DecryptStream(Decryptor, *it, storageIn, storageOut);
|
||||
}
|
||||
//for (std::list<std::string>::iterator it = listStream.begin(); it != listStream.end(); it++)
|
||||
//{
|
||||
// if (storageIn->isDirectory(*it))
|
||||
// {
|
||||
// std::list<std::string> list_entry = storageIn->GetAllStreams(*it);
|
||||
//
|
||||
// for (std::list<std::string>::iterator it2 = list_entry.begin(); it2 != list_entry.end(); it2++)
|
||||
// {
|
||||
// DecryptStream(Decryptor, *it2, storageIn, storageOut);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// DecryptStream(Decryptor, *it, storageIn, storageOut);
|
||||
// }
|
||||
|
||||
}
|
||||
//}
|
||||
|
||||
storageOut->close();
|
||||
delete storageOut;
|
||||
@ -525,34 +526,41 @@ namespace DocFileFormat
|
||||
}
|
||||
return true;
|
||||
}
|
||||
bool WordDocument::CopyStream (std::string streamName, POLE::Storage * storageIn, POLE::Storage * storageOut)
|
||||
void WordDocument::DecryptStream( int level, std::string path, POLE::Storage * storageIn, POLE::Storage * storageOut, CRYPT::Decryptor* Decryptor)
|
||||
{
|
||||
POLE::Stream *stream = new POLE::Stream(storageIn, streamName);
|
||||
if (!stream) return false;
|
||||
|
||||
stream->seek(0);
|
||||
int sz_stream = stream->size();
|
||||
std::list<std::string> entries, entries_sort;
|
||||
entries = storageIn->entries( path );
|
||||
|
||||
POLE::Stream *streamNew = new POLE::Stream(storageOut, streamName, true, sz_stream);
|
||||
if (!streamNew) return false;
|
||||
|
||||
unsigned char* data_stream = new unsigned char[sz_stream];
|
||||
stream->read(data_stream, sz_stream);
|
||||
|
||||
streamNew->write(data_stream, sz_stream);
|
||||
|
||||
RELEASEARRAYOBJECTS(data_stream);
|
||||
|
||||
streamNew->flush();
|
||||
|
||||
delete streamNew;
|
||||
delete stream;
|
||||
|
||||
return true;
|
||||
for( std::list<std::string>::iterator it = entries.begin(); it != entries.end(); it++ )
|
||||
{
|
||||
std::string name = *it;
|
||||
std::string fullname = path + name;
|
||||
|
||||
if( storageIn->isDirectory( fullname ) )
|
||||
{
|
||||
entries_sort.push_back(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
entries_sort.push_front(name);
|
||||
}
|
||||
}
|
||||
for( std::list<std::string>::iterator it = entries_sort.begin(); it != entries_sort.end(); ++it )
|
||||
{
|
||||
std::string name = *it;
|
||||
std::string fullname = path + name;
|
||||
|
||||
if( storageIn->isDirectory( fullname ) )
|
||||
{
|
||||
DecryptStream( level + 1, fullname + "/", storageIn, storageOut, Decryptor );
|
||||
}
|
||||
else
|
||||
{
|
||||
DecryptStream(fullname, storageIn, storageOut, Decryptor );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool WordDocument::DecryptStream(CRYPT::Decryptor* Decryptor, std::string streamName, POLE::Storage * storageIn, POLE::Storage * storageOut)
|
||||
bool WordDocument::DecryptStream(std::string streamName, POLE::Storage * storageIn, POLE::Storage * storageOut, CRYPT::Decryptor* Decryptor)
|
||||
{
|
||||
POLE::Stream *stream = new POLE::Stream(storageIn, streamName);
|
||||
if (!stream) return false;
|
||||
@ -567,9 +575,9 @@ namespace DocFileFormat
|
||||
stream->read(data_stream, size_stream);
|
||||
|
||||
unsigned char* data_store = NULL;
|
||||
int size_data_store = 0;
|
||||
int size_data_store = 0;
|
||||
|
||||
if ("WordDocument" == streamName)
|
||||
if ( std::wstring::npos != streamName.find("WordDocument") )
|
||||
{
|
||||
size_data_store = 68;
|
||||
data_store = new unsigned char[size_data_store];
|
||||
|
||||
@ -99,17 +99,17 @@ namespace DocFileFormat
|
||||
|
||||
bool bOlderVersion;
|
||||
int document_code_page;
|
||||
|
||||
private:
|
||||
bool DecryptOfficeFile (CRYPT::Decryptor* Decryptor);
|
||||
bool DecryptStream (CRYPT::Decryptor* Decryptor, std::string streamName, POLE::Storage * storageIn, POLE::Storage * storageOut);
|
||||
bool CopyStream (std::string streamName, POLE::Storage * storageIn, POLE::Storage * storageOut);
|
||||
|
||||
|
||||
inline StructuredStorageReader* GetStorage() const
|
||||
{
|
||||
return m_pStorage;
|
||||
}
|
||||
|
||||
private:
|
||||
bool DecryptOfficeFile (CRYPT::Decryptor* Decryptor);
|
||||
|
||||
bool DecryptStream (std::string streamName, POLE::Storage * storageIn, POLE::Storage * storageOut, CRYPT::Decryptor* Decryptor);
|
||||
void DecryptStream (int level, std::string streamName, POLE::Storage * storageIn, POLE::Storage * storageOut, CRYPT::Decryptor* Decryptor);
|
||||
|
||||
inline OfficeArtContent* GetOfficeArt ()
|
||||
{
|
||||
return officeArtContent;
|
||||
|
||||
@ -180,10 +180,37 @@ namespace DocFileFormat
|
||||
{
|
||||
}
|
||||
|
||||
void WordprocessingDocument::SaveDocument()
|
||||
void WordprocessingDocument::SaveDocument(bool &bMacros)
|
||||
{
|
||||
std::wstring pathWord = m_strOutputPath + FILE_SEPARATOR_STR + L"word" ;
|
||||
NSDirectory::CreateDirectory( pathWord );
|
||||
std::wstring pathWord = m_strOutputPath + FILE_SEPARATOR_STR + L"word" ;
|
||||
NSDirectory::CreateDirectory( pathWord );
|
||||
|
||||
if (bMacros && docFile->GetStorage()->isDirectory("Macros"))
|
||||
{
|
||||
std::wstring sVbaProjectFile = pathWord + FILE_SEPARATOR_STR + L"vbaProject.bin";
|
||||
|
||||
POLE::Storage *storageVbaProject = new POLE::Storage(sVbaProjectFile.c_str());
|
||||
|
||||
if ((storageVbaProject) && (storageVbaProject->open(true, true)))
|
||||
{
|
||||
docFile->GetStorage()->copy(0, "Macros/", storageVbaProject, false);
|
||||
|
||||
storageVbaProject->close();
|
||||
delete storageVbaProject;
|
||||
|
||||
RegisterDocumentMacros();
|
||||
RegisterVbaProject();
|
||||
//output_document->get_xl_files().add_vba_project();
|
||||
}
|
||||
else bMacros = false;
|
||||
}
|
||||
else
|
||||
bMacros = false;
|
||||
|
||||
if (!bMacros)
|
||||
{
|
||||
RegisterDocument();
|
||||
}
|
||||
|
||||
WritePackage();
|
||||
|
||||
|
||||
@ -76,6 +76,7 @@ namespace DocFileFormat
|
||||
public:
|
||||
WordprocessingDocument(const std::wstring & _docxDirectory, const WordDocument* _docFile);
|
||||
virtual ~WordprocessingDocument();
|
||||
void SaveDocument();
|
||||
|
||||
void SaveDocument(bool &bMacros);
|
||||
};
|
||||
}
|
||||
@ -34,14 +34,14 @@
|
||||
#include "../DocDocxConverter/Converter.h"
|
||||
#include "../../OfficeUtils/src/OfficeUtils.h"
|
||||
|
||||
HRESULT COfficeDocFile::LoadFromFile(const std::wstring & docFile, const std::wstring & docxDirectory, const std::wstring & password, ProgressCallback *ffCallBack )
|
||||
HRESULT COfficeDocFile::LoadFromFile(const std::wstring & docFile, const std::wstring & docxDirectory, const std::wstring & password, bool &bMacros, ProgressCallback *ffCallBack)
|
||||
{
|
||||
HRESULT hr = S_FALSE;
|
||||
|
||||
DocFileFormat::Converter docToDocx;
|
||||
docToDocx.m_sTempFolder = m_sTempFolder;
|
||||
|
||||
hr= docToDocx.LoadAndConvert(docFile, docxDirectory, password, ffCallBack);
|
||||
hr= docToDocx.LoadAndConvert(docFile, docxDirectory, password, ffCallBack, bMacros);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ public:
|
||||
|
||||
std::wstring m_sTempFolder;
|
||||
|
||||
HRESULT LoadFromFile(const std::wstring & sSrcFileName, const std::wstring & sDstFileName, const std::wstring & password, ProgressCallback *ffCallBack = NULL);
|
||||
HRESULT LoadFromFile(const std::wstring & sSrcFileName, const std::wstring & sDstFileName, const std::wstring & password, bool &bMacros, ProgressCallback *ffCallBack = NULL);
|
||||
HRESULT SaveToFile(const std::wstring & sDstFileName, const std::wstring & sSrcFileName, ProgressCallback *ffCallBack = NULL);
|
||||
|
||||
};
|
||||
|
||||
@ -54,17 +54,27 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||
if (argc < 2) return 1;
|
||||
|
||||
std::wstring sSrcDoc = argv[1];
|
||||
std::wstring sDstDocx = argc > 2 ? argv[2] : sSrcDoc + L"-my.docx";
|
||||
std::wstring sDstDocx;
|
||||
|
||||
std::wstring outputDir = NSDirectory::GetFolderPath(sDstDocx);
|
||||
std::wstring outputDir = NSDirectory::GetFolderPath(sSrcDoc);
|
||||
std::wstring dstTempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir);
|
||||
|
||||
COfficeDocFile docFile;
|
||||
|
||||
docFile.m_sTempFolder = outputDir;
|
||||
|
||||
HRESULT hRes = docFile.LoadFromFile( sSrcDoc, dstTempPath, L"password", NULL);
|
||||
bool bMacros = true;
|
||||
HRESULT hRes = docFile.LoadFromFile( sSrcDoc, dstTempPath, L"password", bMacros, NULL);
|
||||
|
||||
if (bMacros)
|
||||
{
|
||||
sDstDocx = sSrcDoc + L"-my.docm";
|
||||
}
|
||||
else
|
||||
{
|
||||
sDstDocx = sSrcDoc + L"-my.docx";
|
||||
|
||||
}
|
||||
if (hRes == S_OK)
|
||||
{
|
||||
COfficeUtils oCOfficeUtils(NULL);
|
||||
|
||||
@ -36,7 +36,7 @@ namespace BinDocxRW {
|
||||
|
||||
int Binary_VbaProjectTableReader::Read()
|
||||
{
|
||||
m_oFileWriter.m_pVbaProject = new OOX::VbaProject();
|
||||
m_oFileWriter.m_pVbaProject = new OOX::VbaProject();
|
||||
m_oFileWriter.m_pVbaProject->fromPPTY(&m_oBufferedStream);
|
||||
|
||||
return c_oSerConstants::ReadOk;
|
||||
@ -118,4 +118,4 @@ int Binary_HdrFtrTableReader::ReadHdrFtrItemContent(BYTE type, long length, void
|
||||
return pBinary_DocumentTableReader->ReadDocumentContent(type, length, NULL);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -285,7 +285,7 @@ public:
|
||||
}
|
||||
|
||||
int Read ();
|
||||
};
|
||||
};
|
||||
|
||||
class Binary_HdrFtrTableReader : public Binary_CommonReader<Binary_HdrFtrTableReader>
|
||||
{
|
||||
|
||||
@ -95,7 +95,7 @@ bool BinDocxRW::CDocxSerializer::saveToFile(const std::wstring& sSrcFileName, co
|
||||
oDrawingConverter.SetMainDocument(this);
|
||||
|
||||
oDrawingConverter.SetDstPath(pathMain.GetDirectory() + FILE_SEPARATOR_STR + L"word");
|
||||
oDrawingConverter.SetMediaDstPath(pathMedia.GetPath());
|
||||
oDrawingConverter.SetMediaDstPath(pathMedia.GetPath());
|
||||
|
||||
m_pParamsWriter = new ParamsWriter(&oBufferedStream, &fp, &oDrawingConverter, pEmbeddedFontsManager);
|
||||
|
||||
@ -265,10 +265,10 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const std::wstring& sSrcFileName,
|
||||
|
||||
if (NULL != pData)
|
||||
{
|
||||
oDrawingConverter.SetMainDocument(this);
|
||||
oDrawingConverter.SetMainDocument(this);
|
||||
oDrawingConverter.SetDstPath(sDstPath + FILE_SEPARATOR_STR + L"word");
|
||||
|
||||
oDrawingConverter.SetMediaDstPath(sMediaPath);
|
||||
oDrawingConverter.SetMediaDstPath(sMediaPath);
|
||||
oDrawingConverter.SetEmbedDstPath(sEmbedPath);
|
||||
|
||||
m_pCurFileWriter = new Writers::FileWriter(sDstPath, m_sFontDir, false, nVersion, m_bSaveChartAsImg, &oDrawingConverter, sThemePath);
|
||||
|
||||
@ -88,12 +88,12 @@ namespace BinXlsxRW{
|
||||
{
|
||||
std::wstring strFileInDir = NSSystemPath::GetDirectoryName(sSrcFileName);
|
||||
|
||||
NSBinPptxRW::CDrawingConverter oDrawingConverter;
|
||||
NSBinPptxRW::CDrawingConverter oDrawingConverter;
|
||||
|
||||
oDrawingConverter.SetDstPath(sDstPath + FILE_SEPARATOR_STR + L"xl");
|
||||
oDrawingConverter.SetSrcPath(strFileInDir, 2);
|
||||
|
||||
oDrawingConverter.SetMediaDstPath(sMediaDir);
|
||||
oDrawingConverter.SetMediaDstPath(sMediaDir);
|
||||
oDrawingConverter.SetEmbedDstPath(sEmbedDir);
|
||||
|
||||
BinXlsxRW::BinaryFileReader oBinaryFileReader;
|
||||
|
||||
@ -314,7 +314,7 @@
|
||||
17E17ED41AC453F800BEA2EA /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0710;
|
||||
LastUpgradeCheck = 0900;
|
||||
ORGANIZATIONNAME = "Ascensio System SIA";
|
||||
};
|
||||
buildConfigurationList = 17E17ED71AC453F800BEA2EA /* Build configuration list for PBXProject "ASCOfficeDocxFile2Lib" */;
|
||||
@ -402,6 +402,7 @@
|
||||
EXECUTABLE_PREFIX = lib;
|
||||
GCC_ENABLE_CPP_EXCEPTIONS = YES;
|
||||
GCC_ENABLE_CPP_RTTI = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
UNICODE,
|
||||
_UNICODE,
|
||||
@ -441,13 +442,21 @@
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
@ -455,6 +464,7 @@
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
@ -467,7 +477,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
@ -483,13 +493,21 @@
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
@ -497,13 +515,14 @@
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = macosx;
|
||||
|
||||
@ -34,9 +34,11 @@
|
||||
#include <stdio.h>
|
||||
#include <tchar.h>
|
||||
|
||||
#include "../../Common/OfficeFileFormatChecker.h"
|
||||
#include "../../OfficeUtils/src/OfficeUtils.h"
|
||||
#include "../../DesktopEditor/common/Directory.h"
|
||||
#include "../src/ConvertOO2OOX.h"
|
||||
#include "../include/logging.h"
|
||||
|
||||
|
||||
#if defined(_WIN64)
|
||||
@ -45,30 +47,55 @@
|
||||
#pragma comment(lib, "../../build/bin/icu/win_32/icuuc.lib")
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
int _tmain(int argc, _TCHAR* argv[])
|
||||
HRESULT convert_single(std::wstring srcFileName)
|
||||
{
|
||||
if (argc < 2) return 1;
|
||||
|
||||
HRESULT hr = S_OK;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
std::wstring srcFileName = argv[1];
|
||||
std::wstring dstPath = argc > 2 ? argv[2] : srcFileName + L"-my.docx"; //xlsx pptx docx
|
||||
|
||||
COfficeFileFormatChecker fileChecker(srcFileName);
|
||||
|
||||
std::wstring dstPath = srcFileName;// + ; //xlsx pptx docx
|
||||
switch(fileChecker.nFileType)
|
||||
{
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT:
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT_FLAT: dstPath += L"-my.docx"; break;
|
||||
|
||||
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS:
|
||||
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS_FLAT: dstPath += L"-my.xlsx"; break;
|
||||
|
||||
case AVS_OFFICESTUDIO_FILE_PRESENTATION_ODP:
|
||||
case AVS_OFFICESTUDIO_FILE_PRESENTATION_ODP_FLAT: dstPath += L"-my.pptx"; break;
|
||||
|
||||
default:
|
||||
return S_FALSE;
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
COfficeUtils oCOfficeUtils(NULL);
|
||||
|
||||
std::wstring outputDir = NSDirectory::GetFolderPath(dstPath);
|
||||
|
||||
std::wstring srcTempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir);
|
||||
std::wstring dstTempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir);
|
||||
std::wstring srcTempPath;
|
||||
|
||||
// распаковываем исходник во временную директорию
|
||||
COfficeUtils oCOfficeUtils(NULL);
|
||||
if (S_OK != oCOfficeUtils.ExtractToDirectory(srcFileName.c_str(), srcTempPath.c_str(), NULL, 0))
|
||||
return S_FALSE;
|
||||
if (fileChecker.nFileType == AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT ||
|
||||
fileChecker.nFileType == AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS ||
|
||||
fileChecker.nFileType == AVS_OFFICESTUDIO_FILE_PRESENTATION_ODP)
|
||||
{
|
||||
srcTempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir);
|
||||
|
||||
if (S_OK != oCOfficeUtils.ExtractToDirectory(srcFileName.c_str(), srcTempPath.c_str(), NULL, 0))
|
||||
return S_FALSE;
|
||||
}
|
||||
else // flat
|
||||
{
|
||||
srcTempPath = srcFileName;
|
||||
}
|
||||
_CP_LOG << L"[info] " << srcFileName << std::endl;
|
||||
|
||||
hr = ConvertOO2OOX(srcTempPath, dstTempPath, L"C:\\Windows\\Fonts", false, NULL);
|
||||
|
||||
NSDirectory::DeleteDirectory(srcTempPath);
|
||||
if (srcTempPath != srcFileName)
|
||||
{
|
||||
NSDirectory::DeleteDirectory(srcTempPath);
|
||||
}
|
||||
|
||||
if (hr != S_OK) return hr;
|
||||
|
||||
@ -77,6 +104,35 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||
|
||||
NSDirectory::DeleteDirectory(dstTempPath);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
return 0;
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT convert_directory(std::wstring pathName)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
std::vector<std::wstring> arFiles = NSDirectory::GetFiles(pathName, false);
|
||||
|
||||
for (size_t i = 0; i < arFiles.size(); i++)
|
||||
{
|
||||
convert_single(arFiles[i]);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
int _tmain(int argc, _TCHAR* argv[])
|
||||
{
|
||||
if (argc < 2) return 1;
|
||||
|
||||
HRESULT hr = -1;
|
||||
if (NSFile::CFileBinary::Exists(argv[1]))
|
||||
{
|
||||
hr = convert_single(argv[1]);
|
||||
}
|
||||
else if (NSDirectory::Exists(argv[1]))
|
||||
{
|
||||
hr = convert_directory(argv[1]);
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
@ -336,6 +336,14 @@
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\Common\OfficeFileFormatChecker.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Common\OfficeFileFormatChecker2.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Common\3dParty\pole\pole.cpp"
|
||||
>
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "../include/cpdoccore/CPScopedPtr.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
@ -58,6 +59,8 @@ public:
|
||||
|
||||
//Sheet2.C3:Sheet2.C19 -> Sheet2!C3:C19
|
||||
std::wstring convert_chart_distance(std::wstring const & expr);
|
||||
|
||||
void split_distance_by(const std::wstring& expr, const std::wstring& by, std::vector<std::wstring>& out);
|
||||
|
||||
std::wstring convert_ref(std::wstring const & expr);
|
||||
|
||||
|
||||
@ -32,7 +32,6 @@
|
||||
#include "formulasconvert.h"
|
||||
|
||||
#include <boost/regex.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#include"../../Common/DocxFormat/Source/XML/Utils.h"
|
||||
@ -46,6 +45,9 @@ namespace formulasconvert {
|
||||
|
||||
std::wstring convert(const std::wstring& expr);
|
||||
std::wstring convert_chart_distance(const std::wstring& expr);
|
||||
|
||||
void split_distance_by(const std::wstring& expr, const std::wstring& by, std::vector<std::wstring>& out);
|
||||
|
||||
void replace_cells_range(std::wstring& expr, bool withTableName);
|
||||
bool check_formula(std::wstring& expr);
|
||||
void replace_semicolons(std::wstring& expr);
|
||||
@ -189,7 +191,7 @@ namespace formulasconvert {
|
||||
|
||||
if (convert_with_TableName)
|
||||
{
|
||||
return (sheet1 + L"!") + c1 + (c2.empty() ? L"" : (L":" + c3) );
|
||||
return (sheet1 + L"!") + c1 + (c3.empty() ? L"" : (L":" + c3) );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -387,30 +389,37 @@ namespace formulasconvert {
|
||||
}
|
||||
|
||||
|
||||
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 forbidden_formulas[] =
|
||||
//{
|
||||
// L"NULLFORMULA"
|
||||
// //L"BETADIST",
|
||||
// //L"CEILING",
|
||||
// //L"FLOOR",
|
||||
// //L"RANK",
|
||||
// //L"ROUND",
|
||||
// //L"ROUNDDOWN",
|
||||
// //L"ROUNDUP",
|
||||
// //L"SUBTOTAL",
|
||||
// //L"FORMULA",
|
||||
// //L"ISREF"
|
||||
//};
|
||||
|
||||
bool is_forbidden(const std::wstring & formula)
|
||||
std::wstring is_forbidden(const std::wstring & formula)
|
||||
{
|
||||
BOOST_FOREACH(const std::wstring & s, forbidden_formulas)
|
||||
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, s))
|
||||
return true;
|
||||
if (boost::algorithm::contains(formula, it->first))
|
||||
{
|
||||
|
||||
XmlUtils::replace_all(result, it->first, it->second);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return result;
|
||||
}
|
||||
|
||||
// заменить вертикальную черту во всех вхождениях в фигурных скобках, но не внутри строк
|
||||
@ -436,10 +445,7 @@ namespace formulasconvert {
|
||||
|
||||
std::wstring odf2oox_converter::Impl::convert(const std::wstring& expr)
|
||||
{
|
||||
if (is_forbidden(expr))
|
||||
return L"NULLFORMULA()";
|
||||
|
||||
std::wstring workstr = 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,
|
||||
@ -448,7 +454,7 @@ namespace formulasconvert {
|
||||
// boost::match_default | boost::format_all);
|
||||
|
||||
bool isFormula = check_formula(workstr);
|
||||
|
||||
|
||||
boost::regex_replace(
|
||||
workstr,
|
||||
boost::wregex(L"('.*?')|(\".*?\")"),
|
||||
@ -471,6 +477,12 @@ namespace formulasconvert {
|
||||
}
|
||||
//todooo INDEX((A1:C6~A8:C11),2,2,2) - ???? - INDEX_emb.ods
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t sz_workstr = workstr.length();
|
||||
if (workstr.substr(0, std::min((size_t)3, sz_workstr)) == L"of:")//sample_02neu_crashes.ods
|
||||
workstr = workstr.substr(3);
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------
|
||||
@ -490,16 +502,34 @@ namespace formulasconvert {
|
||||
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(
|
||||
expr,
|
||||
complexRef,
|
||||
&replace_point_space,
|
||||
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".");
|
||||
}
|
||||
}
|
||||
|
||||
//Sheet2.C3:Sheet2.C19 Sheet2.L29:Sheet2.L36
|
||||
//в
|
||||
//Sheet2!C3:C19,Sheet2!L27:L34
|
||||
|
||||
std::wstring odf2oox_converter::Impl::convert_chart_distance(const std::wstring& expr)
|
||||
{
|
||||
if (is_forbidden(expr))
|
||||
return L"NULLFORMULA()";
|
||||
std::wstring workstr = is_forbidden(expr);
|
||||
|
||||
std::wstring workstr = expr;
|
||||
boost::wregex complexRef(L"('(?!\\s\\'){0,1}.*?')");// поиск того что в апострофах и замена там
|
||||
|
||||
workstr = boost::regex_replace(
|
||||
@ -515,25 +545,27 @@ namespace formulasconvert {
|
||||
|
||||
boost::algorithm::split(distance_inp, workstr, boost::algorithm::is_any_of(L" "), boost::algorithm::token_compress_on);
|
||||
|
||||
BOOST_FOREACH(std::wstring &d,distance_inp)
|
||||
for (size_t i = 0; i < distance_inp.size(); i++)
|
||||
{
|
||||
std::wstring sheet;
|
||||
std::vector<std::wstring> range;
|
||||
std::vector<std::wstring> cells;
|
||||
|
||||
boost::algorithm::split(range,d, boost::algorithm::is_any_of(L":"), boost::algorithm::token_compress_on);
|
||||
boost::algorithm::split(range, distance_inp[i], boost::algorithm::is_any_of(L":"), boost::algorithm::token_compress_on);
|
||||
|
||||
BOOST_FOREACH(std::wstring &c,range)
|
||||
for (size_t j = 0; j < range.size(); j++)
|
||||
{
|
||||
const std::string::size_type colon = c.find('.');
|
||||
cells.push_back(c.substr(colon+1));
|
||||
if (sheet.size()<1)
|
||||
sheet=c.substr(0, colon);
|
||||
const std::string::size_type colon = range[j].find('.');
|
||||
cells.push_back(range[j].substr(colon + 1));
|
||||
if (sheet.size() < 1)
|
||||
{
|
||||
sheet = range[j].substr(0, colon);
|
||||
}
|
||||
}
|
||||
std::wstring cells_out;
|
||||
BOOST_FOREACH(std::wstring &c,cells)
|
||||
for (size_t j = 0; j < cells.size(); j++)
|
||||
{
|
||||
cells_out.append(c);
|
||||
cells_out.append(cells[j]);
|
||||
cells_out.append(L":");
|
||||
}
|
||||
int res1 = sheet.find(L"-");
|
||||
@ -544,19 +576,19 @@ namespace formulasconvert {
|
||||
sheet = L"'" + sheet + L"'";
|
||||
}
|
||||
|
||||
distance_out.push_back(sheet+L"!" + cells_out.substr(0, cells_out.size()-1));
|
||||
distance_out.push_back(sheet + L"!" + cells_out.substr(0, cells_out.size()-1));
|
||||
}
|
||||
std::wstring result;
|
||||
|
||||
BOOST_FOREACH(std::wstring &d, distance_out)
|
||||
for (size_t i = 0; i < distance_out.size(); i++)
|
||||
{
|
||||
result.append(d);
|
||||
result.append(distance_out[i]);
|
||||
result.append(L",");
|
||||
}
|
||||
XmlUtils::replace_all( result, L"PROBEL" , L" ");
|
||||
XmlUtils::replace_all( result, L"TOCHKA" , L".");
|
||||
XmlUtils::replace_all( result, L"TOCHKA", L".");
|
||||
|
||||
return result.substr(0, result.size()-1);// минус последняя лишняя запятая
|
||||
return result.substr(0, result.size() - 1);// минус последняя лишняя запятая
|
||||
}
|
||||
odf2oox_converter::odf2oox_converter(): impl_(new odf2oox_converter::Impl)
|
||||
{
|
||||
@ -579,6 +611,10 @@ namespace formulasconvert {
|
||||
{
|
||||
return impl_->convert_chart_distance(expr);
|
||||
}
|
||||
void odf2oox_converter::split_distance_by(const std::wstring& expr, const std::wstring& by, std::vector<std::wstring>& out)
|
||||
{
|
||||
return impl_->split_distance_by(expr, by, out);
|
||||
}
|
||||
std::wstring odf2oox_converter::convert_named_ref(const std::wstring& expr, bool withTableName, std::wstring separator)
|
||||
{
|
||||
boost::wregex complexRef(L"('(?!\\s\\'){0,1}.*?')");// поиск того что в апострофах и замена там
|
||||
|
||||
@ -35,11 +35,15 @@
|
||||
#include "../CPSharedPtr.h"
|
||||
#include "../CPScopedPtr.h"
|
||||
|
||||
|
||||
struct ProgressCallback;
|
||||
|
||||
namespace cpdoccore {
|
||||
|
||||
namespace xml
|
||||
{
|
||||
class sax;
|
||||
}
|
||||
|
||||
namespace oox {
|
||||
class docx_conversion_context;
|
||||
class xlsx_conversion_context;
|
||||
@ -54,9 +58,10 @@ class odf_document
|
||||
{
|
||||
public:
|
||||
odf_document(const std::wstring & Folder, const ProgressCallback* CallBack);
|
||||
~odf_document();
|
||||
odf_document(xml::sax * Reader);
|
||||
|
||||
~odf_document();
|
||||
|
||||
public:
|
||||
odf_read_context & odf_context();
|
||||
|
||||
bool docx_convert(oox::docx_conversion_context & Context);
|
||||
@ -77,6 +82,7 @@ private:
|
||||
_CP_SCOPED_PTR(Impl) impl_;
|
||||
|
||||
};
|
||||
typedef shared_ptr<odf_document>::Type odf_document_ptr;
|
||||
|
||||
}
|
||||
}
|
||||
@ -217,6 +217,7 @@ SOURCES += \
|
||||
../src/odf/datatypes/tableorientation.cpp \
|
||||
../src/odf/datatypes/tablefunction.cpp \
|
||||
../src/odf/datatypes/tableorder.cpp \
|
||||
../src/odf/datatypes/dategroup.cpp \
|
||||
../src/docx/xlsx_conditionalFormatting.cpp \
|
||||
../src/docx/xlsx_dxfs.cpp \
|
||||
../src/docx/docx_content_type.cpp \
|
||||
|
||||
@ -126,3 +126,4 @@
|
||||
#include "../src/odf/datatypes/tableorientation.cpp"
|
||||
#include "../src/odf/datatypes/tablefunction.cpp"
|
||||
#include "../src/odf/datatypes/tableorder.cpp"
|
||||
#include "../src/odf/datatypes/dategroup.cpp"
|
||||
|
||||
@ -97,14 +97,6 @@ HRESULT ConvertOO2OOX(const std::wstring & srcPath, const std::wstring & dstPath
|
||||
|
||||
if (encrypted) return AVS_ERROR_DRM;
|
||||
|
||||
//if (type<1)
|
||||
//{
|
||||
// if (ext == L".odt")type = 1;
|
||||
// if (ext == L".ods")type = 2;
|
||||
// if (ext == L".odp")type = 3;
|
||||
|
||||
//}
|
||||
|
||||
if (bOnlyPresentation && type != 3)return AVS_ERROR_UNEXPECTED;
|
||||
|
||||
switch (type)
|
||||
|
||||
@ -96,7 +96,7 @@ void text_tracked_context::start_change (std::wstring id)
|
||||
{
|
||||
current_state_.clear();
|
||||
|
||||
current_state_.id = id;
|
||||
current_state_.id = id;
|
||||
}
|
||||
void text_tracked_context::end_change ()
|
||||
{
|
||||
@ -378,7 +378,8 @@ void docx_conversion_context::start_document()
|
||||
output_stream() << L"xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" ";
|
||||
output_stream() << L"xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" ";
|
||||
output_stream() << L"xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" ";
|
||||
output_stream() << L"xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" ";
|
||||
output_stream() << L"xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" ";
|
||||
output_stream() << L"xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" ";
|
||||
output_stream() << L"mc:Ignorable=\"w14 wp14\">";
|
||||
|
||||
|
||||
@ -406,14 +407,12 @@ void docx_conversion_context::end_document()
|
||||
|
||||
output_document_->get_word_files().set_notes(notes_context_);
|
||||
////////////////////////
|
||||
int count = 0;
|
||||
BOOST_FOREACH(const oox_chart_context_ptr& chart, charts_)
|
||||
for (size_t i = 0; i < charts_.size(); i++)
|
||||
{
|
||||
count++;
|
||||
package::chart_content_ptr content = package::chart_content::create();
|
||||
|
||||
chart->serialize(content->content());
|
||||
chart->dump_rels(content->get_rel_file()->get_rels());
|
||||
charts_[i]->serialize(content->content());
|
||||
charts_[i]->dump_rels(content->get_rel_file()->get_rels());
|
||||
|
||||
output_document_->get_word_files().add_charts(content);
|
||||
|
||||
@ -580,10 +579,10 @@ mc:Ignorable=\"w14 wp14\">";
|
||||
strm << L"</w:abstractNum>";
|
||||
}
|
||||
|
||||
BOOST_FOREACH(int numId, numIds)
|
||||
for (size_t i = 0; i < numIds.size(); i++)
|
||||
{
|
||||
strm << L"<w:num w:numId=\"" << numId << L"\" >";
|
||||
strm << L"<w:abstractNumId w:val=\"" << numId << "\" />";
|
||||
strm << L"<w:num w:numId=\"" << numIds[i] << L"\" >";
|
||||
strm << L"<w:abstractNumId w:val=\"" << numIds[i] << "\" />";
|
||||
strm << L"</w:num>";
|
||||
}
|
||||
|
||||
@ -801,7 +800,7 @@ bool docx_conversion_context::process_page_properties(std::wostream & strm)
|
||||
|
||||
if (page_layout_instance_)
|
||||
{
|
||||
page_layout_instance_->docx_convert_serialize(strm, *this);
|
||||
page_layout_instance_->docx_serialize(strm, *this);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1286,7 +1285,8 @@ void docx_conversion_context::start_text_changes (std::wstring id)
|
||||
L" w:author=\"" + state.author + L"\"" ;
|
||||
|
||||
finish_run();
|
||||
state.active = true;
|
||||
state.active = true;
|
||||
state.in_drawing = get_drawing_state_content();
|
||||
|
||||
if (state.type == 1)
|
||||
{
|
||||
@ -1420,6 +1420,9 @@ void docx_conversion_context::end_changes()
|
||||
if (state.type == 0) continue; //unknown change ... libra format change skip
|
||||
if (state.type == 3) continue;
|
||||
if (!state.active) continue;
|
||||
|
||||
if (state.in_drawing != get_drawing_state_content())
|
||||
continue;
|
||||
|
||||
if (state.type == 1) output_stream() << L"</w:ins>";
|
||||
if (state.type == 2) output_stream() << L"</w:del>";
|
||||
|
||||
@ -492,10 +492,11 @@ public:
|
||||
std::wstring id;
|
||||
std::wstring author;
|
||||
std::wstring date;
|
||||
int type;
|
||||
int type = 0;
|
||||
std::wstring style_name;
|
||||
std::vector<std::wstring> content; //delete elements
|
||||
bool active;
|
||||
bool active = false;
|
||||
bool in_drawing = false;
|
||||
|
||||
void clear()
|
||||
{
|
||||
@ -505,6 +506,7 @@ public:
|
||||
date.clear();
|
||||
content.clear();
|
||||
active = false;
|
||||
in_drawing = false;
|
||||
}
|
||||
};
|
||||
std::wstring dumpPPr_;
|
||||
|
||||
@ -392,8 +392,11 @@ void docx_serialize_wps(std::wostream & strm, _docx_drawing & val)
|
||||
{
|
||||
CP_XML_NODE(L"wp:extent")
|
||||
{
|
||||
CP_XML_ATTR(L"cx", val.cx);
|
||||
CP_XML_ATTR(L"cy", val.cy);
|
||||
if (val.cx > 0 || val.cy > 0)
|
||||
{
|
||||
CP_XML_ATTR(L"cx", val.cx);
|
||||
CP_XML_ATTR(L"cy", val.cy);
|
||||
}
|
||||
|
||||
serialize_null_extent(CP_XML_STREAM());
|
||||
}
|
||||
@ -463,10 +466,13 @@ void docx_serialize_wps(std::wostream & strm, _docx_drawing & val)
|
||||
}
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"wp:extent")
|
||||
if (val.cx > 0 || val.cy > 0)
|
||||
{
|
||||
CP_XML_ATTR(L"cx", val.cx);
|
||||
CP_XML_ATTR(L"cy", val.cy);
|
||||
CP_XML_NODE(L"wp:extent")
|
||||
{
|
||||
CP_XML_ATTR(L"cx", val.cx);
|
||||
CP_XML_ATTR(L"cy", val.cy);
|
||||
}
|
||||
}
|
||||
|
||||
serialize_wrap(CP_XML_STREAM(), val);
|
||||
|
||||
@ -319,6 +319,7 @@ namespace
|
||||
xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" \
|
||||
xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \
|
||||
xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" \
|
||||
xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" \
|
||||
xmlns:a14=\"http://schemas.microsoft.com/office/drawing/2010/main\" >";
|
||||
|
||||
//mc:Ignorable=\"w14 wp14\"
|
||||
|
||||
@ -181,7 +181,11 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
|
||||
sub_path = L"embeddings/";
|
||||
}
|
||||
else
|
||||
{
|
||||
isMediaInternal = is_internal(href, odf_packet_);
|
||||
if (href.empty() && type == typeImage)
|
||||
return L"";
|
||||
}
|
||||
|
||||
int number=0;
|
||||
|
||||
@ -205,9 +209,9 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
|
||||
if ( type == typeChart) outputPath = outputPath + L".xml";
|
||||
|
||||
std::wstring id;
|
||||
for (int i = 0 ; i < items_.size(); i++)
|
||||
for (size_t i = 0 ; i < items_.size(); i++)
|
||||
{
|
||||
if (items_[i].href == inputPath)
|
||||
if ((items_[i].href == inputPath && !inputPath.empty()) || (items_[i].type == type && inputPath.empty()))
|
||||
{
|
||||
id = items_[i].Id;
|
||||
outputPath = items_[i].outputName;
|
||||
|
||||
@ -127,6 +127,7 @@ public:
|
||||
if (sExt == L"m4v") return typeVideo;
|
||||
if (sExt == L"mp4") return typeVideo;
|
||||
if (sExt == L"mov") return typeVideo;
|
||||
if (sExt == L"mkv") return typeVideo;
|
||||
|
||||
return typeMedia;
|
||||
}
|
||||
|
||||
@ -118,6 +118,23 @@ void oox_chart_context::serialize(std::wostream & strm)
|
||||
{
|
||||
CP_XML_ATTR(L"val",L"en-US");
|
||||
}
|
||||
|
||||
if (pivot_source_.empty() == false)
|
||||
{
|
||||
set_cache_only(true);
|
||||
|
||||
CP_XML_NODE(L"c:pivotSource")
|
||||
{
|
||||
CP_XML_NODE(L"c:name")
|
||||
{
|
||||
CP_XML_STREAM() << pivot_source_;
|
||||
}
|
||||
CP_XML_NODE(L"c:fmtId")
|
||||
{
|
||||
CP_XML_ATTR(L"val", 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"c:chart")
|
||||
{
|
||||
if (plot_area_.current_chart_->is3D_)
|
||||
@ -148,10 +165,42 @@ void oox_chart_context::serialize(std::wostream & strm)
|
||||
shape.set(graphic_properties_, fill_);
|
||||
shape.oox_serialize(CP_XML_STREAM());
|
||||
|
||||
|
||||
if (pivot_source_.empty() == false)
|
||||
{
|
||||
CP_XML_NODE(L"c:extLst")
|
||||
{
|
||||
CP_XML_NODE(L"c:ext")
|
||||
{
|
||||
CP_XML_ATTR(L"uri", L"{781A3756-C4B2-4CAC-9D66-4F8BD8637D16}");
|
||||
CP_XML_ATTR(L"xmlns:c14", L"http://schemas.microsoft.com/office/drawing/2007/8/2/chart");
|
||||
CP_XML_NODE(L"c14:pivotOptions")
|
||||
{
|
||||
CP_XML_NODE(L"c14:dropZoneFilter")
|
||||
{
|
||||
CP_XML_ATTR(L"val", 1);
|
||||
}
|
||||
CP_XML_NODE(L"c14:dropZoneCategories")
|
||||
{
|
||||
CP_XML_ATTR(L"val", 1);
|
||||
}
|
||||
CP_XML_NODE(L"c14:dropZoneData")
|
||||
{
|
||||
CP_XML_ATTR(L"val", 1);
|
||||
}
|
||||
CP_XML_NODE(L"c14:dropZoneSeries")
|
||||
{
|
||||
CP_XML_ATTR(L"val", 1);
|
||||
}
|
||||
CP_XML_NODE(L"c14:dropZonesVisible")
|
||||
{
|
||||
CP_XML_ATTR(L"val", 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
oox_chart_context::~oox_chart_context()
|
||||
@ -160,7 +209,7 @@ oox_chart_context::~oox_chart_context()
|
||||
|
||||
void oox_chart_context::set_cache_only (bool val)
|
||||
{
|
||||
for (int i = 0 ; i < plot_area_.charts_.size(); i++)
|
||||
for (size_t i = 0 ; i < plot_area_.charts_.size(); i++)
|
||||
{
|
||||
plot_area_.charts_[i]->set_cache_only(val);
|
||||
}
|
||||
|
||||
@ -63,6 +63,10 @@ public:
|
||||
void serialize(std::wostream & strm);
|
||||
void dump_rels(rels & Rels);
|
||||
|
||||
void set_pivot_chart(const std::wstring &source)
|
||||
{
|
||||
pivot_source_ = source;
|
||||
}
|
||||
void set_title(odf_reader::chart::title & t)
|
||||
{
|
||||
title_.set_content(t);
|
||||
@ -130,6 +134,8 @@ private:
|
||||
cpdoccore::oox::oox_plot_area plot_area_;
|
||||
cpdoccore::oox::oox_chart_legend legend_;
|
||||
|
||||
std::wstring pivot_source_;
|
||||
|
||||
std::vector<odf_reader::_property> graphic_properties_;
|
||||
_oox_fill fill_;
|
||||
};
|
||||
|
||||
@ -37,6 +37,8 @@
|
||||
#include <cpdoccore/xml/simple_xml_writer.h>
|
||||
#include "../odf/style_text_properties.h"
|
||||
|
||||
#include "xlsx_utils.h"
|
||||
|
||||
#include "oox_chart_series.h"
|
||||
#include "../formulasconvert/formulasconvert.h"
|
||||
|
||||
@ -55,6 +57,7 @@ oox_chart_series::oox_chart_series()
|
||||
|
||||
iSymbolMarkerType_ = 0;
|
||||
bLocalTable_ = false;
|
||||
labelPosEnabled_ = true;
|
||||
}
|
||||
void oox_chart_series::setName(std::wstring &value)
|
||||
{
|
||||
@ -67,8 +70,7 @@ void oox_chart_series::setFormula(int ind, std::wstring &value, std::wstring & f
|
||||
|
||||
if (ind == 0)
|
||||
{
|
||||
long res = value.find(L"local-table");
|
||||
if (res >=0) return;
|
||||
if (std::wstring::npos != value.find(L"local-table")) return;
|
||||
|
||||
values_[ind].strRef_.formula = converter.convert_chart_distance(value);
|
||||
values_[ind].strRef_.present = true;
|
||||
@ -76,8 +78,8 @@ void oox_chart_series::setFormula(int ind, std::wstring &value, std::wstring & f
|
||||
}
|
||||
else
|
||||
{
|
||||
long res = value.find(L"local-table");
|
||||
if (res >=0 && !bLocalTable_ ) return; //в xlsx низя .... нужно сделать тогда отдельную table.xml
|
||||
if (std::wstring::npos != value.find(L"local-table") && !bLocalTable_ ) return;
|
||||
//в xlsx низя .... нужно сделать тогда отдельную table.xml
|
||||
|
||||
values_[ind].numRef_.formula = converter.convert_chart_distance(value);
|
||||
values_[ind].numRef_.present = true;
|
||||
@ -133,7 +135,7 @@ void oox_chart_series::parse_properties()
|
||||
if (*intVal == 2) data_labels_->set_showPercent(true);
|
||||
}
|
||||
odf_reader::GetProperty(content_.properties_, L"label-position", intVal);
|
||||
if (intVal)
|
||||
if (intVal && labelPosEnabled_)
|
||||
{
|
||||
if (!data_labels_) data_labels_ = oox_data_labels();
|
||||
|
||||
@ -218,12 +220,24 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
|
||||
shape.set(content_.graphic_properties_, content_.fill_);
|
||||
shape.oox_serialize(_Wostream);
|
||||
|
||||
for (int i=0; i < 5; i++)
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
if (values_[i].present)
|
||||
{
|
||||
if (bLocalTable_)
|
||||
{
|
||||
if (values_[i].numRef_.present && values_[i].numRef_.num_cache_count == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (values_[i].strRef_.present && values_[i].strRef_.str_cache_count == 0 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(values_[i].type)
|
||||
{
|
||||
|
||||
if (values_[i].numRef_.present && !bLocalTable_)
|
||||
{
|
||||
CP_XML_NODE(L"c:numRef")
|
||||
@ -258,8 +272,11 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
|
||||
CP_XML_ATTR(L"idx", j);
|
||||
double val = 0;
|
||||
|
||||
try { val = boost::lexical_cast<double>(v);}
|
||||
catch(...){}
|
||||
if (oox::IsNumber(v))
|
||||
{
|
||||
try { val = boost::lexical_cast<double>(v);}
|
||||
catch(...){}
|
||||
}
|
||||
CP_XML_NODE(L"c:v")
|
||||
{
|
||||
CP_XML_CONTENT(val);
|
||||
@ -293,8 +310,11 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
|
||||
CP_XML_ATTR(L"idx", j);
|
||||
double val = 0;
|
||||
|
||||
try { val = boost::lexical_cast<double>(v);}
|
||||
catch(...){}
|
||||
if (oox::IsNumber(v))
|
||||
{
|
||||
try { val = boost::lexical_cast<double>(v);}
|
||||
catch(...){}
|
||||
}
|
||||
CP_XML_NODE(L"c:v")
|
||||
{
|
||||
CP_XML_CONTENT(val);
|
||||
|
||||
@ -55,6 +55,7 @@ public:
|
||||
|
||||
virtual void oox_serialize(std::wostream & _Wostream) = 0;
|
||||
|
||||
bool labelPosEnabled_;
|
||||
_oox_chart_values values_[5]; //cat(labels), common, x, y, bubble,
|
||||
int id_;
|
||||
std::wstring name_; //tx (Series Text) §21.2.2.215
|
||||
|
||||
@ -117,15 +117,15 @@ void oox_data_labels::oox_serialize(std::wostream & _Wostream)
|
||||
case 1: CP_XML_ATTR(L"val", L"b"); break;
|
||||
case 2: CP_XML_ATTR(L"val", L"b"); break;
|
||||
case 3: CP_XML_ATTR(L"val", L"b"); break;
|
||||
case 4: CP_XML_ATTR(L"val", L"ctr"); break;
|
||||
case 5: CP_XML_ATTR(L"val", L"inEnd"); break;
|
||||
case 6: CP_XML_ATTR(L"val", L"l"); break;
|
||||
case 7: CP_XML_ATTR(L"val", L"inBase"); break;
|
||||
case 8: CP_XML_ATTR(L"val", L"outEnd"); break;
|
||||
case 9: CP_XML_ATTR(L"val", L"r"); break;
|
||||
case 10: CP_XML_ATTR(L"val", L"t"); break;
|
||||
case 11: CP_XML_ATTR(L"val", L"t"); break;
|
||||
case 12: CP_XML_ATTR(L"val", L"t"); break;
|
||||
case 5: //CP_XML_ATTR(L"val", L"inEnd"); break;
|
||||
case 8: //CP_XML_ATTR(L"val", L"outEnd"); break;
|
||||
case 4: CP_XML_ATTR(L"val", L"ctr"); break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -171,7 +171,7 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
|
||||
if ( color.empty() )
|
||||
{
|
||||
if (always_draw) color = L"000000";
|
||||
else color = L"ffffff";
|
||||
else color = L"FFFFFF";
|
||||
}
|
||||
|
||||
CP_XML_NODE(L"a:srgbClr")
|
||||
@ -210,16 +210,15 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
|
||||
}
|
||||
}
|
||||
}
|
||||
void oox_serialize_aLst(std::wostream & strm, const std::vector<odf_reader::_property> & prop)
|
||||
void oox_serialize_aLst(std::wostream & strm, const std::vector<odf_reader::_property> & prop, const std::wstring & shapeGeomPreset)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"a:avLst")
|
||||
{
|
||||
_CP_OPT(bool) bModifiers;
|
||||
_CP_OPT(std::wstring) strModifiers;
|
||||
odf_reader::GetProperty(prop, L"bModifiers", bModifiers);
|
||||
odf_reader::GetProperty(prop, L"oox-draw-modifiers", strModifiers);
|
||||
|
||||
if (strModifiers)
|
||||
{
|
||||
std::vector< std::wstring > values;
|
||||
@ -227,17 +226,61 @@ void oox_serialize_aLst(std::wostream & strm, const std::vector<odf_reader::_pro
|
||||
|
||||
if (!values.empty() && values.back().empty()) values.pop_back();
|
||||
|
||||
std::vector<std::wstring> names;
|
||||
|
||||
if (std::wstring::npos != shapeGeomPreset.find(L"math") ||
|
||||
std::wstring::npos != shapeGeomPreset.find(L"bentConnector") ||
|
||||
std::wstring::npos != shapeGeomPreset.find(L"curvedConnector")||
|
||||
std::wstring::npos != shapeGeomPreset.find(L"frame"))
|
||||
{
|
||||
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"))
|
||||
{
|
||||
names.push_back(L"hf");
|
||||
names.push_back(L"vf");
|
||||
}
|
||||
else if (std::wstring::npos != shapeGeomPreset.find(L"hexagon"))
|
||||
{
|
||||
names.push_back(L"adj");
|
||||
names.push_back(L"vf");
|
||||
}
|
||||
else if (std::wstring::npos != shapeGeomPreset.find(L"star5")||
|
||||
std::wstring::npos != shapeGeomPreset.find(L"star7"))
|
||||
{
|
||||
names.push_back(L"adj");
|
||||
names.push_back(L"hf");
|
||||
names.push_back(L"vf");
|
||||
}
|
||||
else if (std::wstring::npos != shapeGeomPreset.find(L"star6") ||
|
||||
std::wstring::npos != shapeGeomPreset.find(L"star10"))
|
||||
{
|
||||
names.push_back(L"adj");
|
||||
names.push_back(L"hf");
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < values.size(); i++)
|
||||
{
|
||||
if (values[i].empty()) continue;
|
||||
|
||||
CP_XML_NODE(L"a:gd")
|
||||
{
|
||||
if (values.size() > 1 || bModifiers)
|
||||
//весьма странное .. для некоторых модификаторов (напр math...) нужно указывать множественность их
|
||||
CP_XML_ATTR(L"name", L"adj" + std::to_wstring(i+1));
|
||||
if (names.size() > i)
|
||||
{
|
||||
CP_XML_ATTR(L"name", names[i]);
|
||||
}
|
||||
else
|
||||
CP_XML_ATTR(L"name", L"adj");
|
||||
|
||||
{
|
||||
if (values.size() > 1)
|
||||
CP_XML_ATTR(L"name", L"adj" + std::to_wstring(i + 1));
|
||||
else
|
||||
CP_XML_ATTR(L"name", L"adj");
|
||||
}
|
||||
CP_XML_ATTR(L"fmla", L"val " + values[i]);
|
||||
}
|
||||
}
|
||||
@ -263,8 +306,8 @@ void _oox_drawing::serialize_bodyPr(std::wostream & strm, const std::wstring & n
|
||||
odf_reader::GetProperty(prop,L"text-padding-bottom" , dPaddingBottom);
|
||||
|
||||
if (dPaddingLeft) CP_XML_ATTR(L"lIns", (int)(*dPaddingLeft));
|
||||
if (dPaddingRight) CP_XML_ATTR(L"rIns", (int)(*dPaddingRight));
|
||||
if (dPaddingTop) CP_XML_ATTR(L"tIns", (int)(*dPaddingTop));
|
||||
if (dPaddingRight) CP_XML_ATTR(L"rIns", (int)(*dPaddingRight));
|
||||
if (dPaddingBottom) CP_XML_ATTR(L"bIns", (int)(*dPaddingBottom));
|
||||
|
||||
if (inGroup == false)
|
||||
@ -321,7 +364,8 @@ void _oox_drawing::serialize_bodyPr(std::wostream & strm, const std::wstring & n
|
||||
CP_XML_NODE(L"a:prstTxWarp")
|
||||
{
|
||||
CP_XML_ATTR(L"prst", shapeType);
|
||||
oox_serialize_aLst(CP_XML_STREAM(), prop);
|
||||
|
||||
oox_serialize_aLst(CP_XML_STREAM(), prop, shapeType);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -370,7 +414,8 @@ void _oox_drawing::serialize_shape(std::wostream & strm)
|
||||
{
|
||||
CP_XML_NODE(L"a:custGeom")
|
||||
{
|
||||
oox_serialize_aLst(CP_XML_STREAM(), additional);
|
||||
std::vector<std::wstring> names;
|
||||
oox_serialize_aLst(CP_XML_STREAM(), additional, L"");
|
||||
|
||||
CP_XML_NODE(L"a:ahLst");
|
||||
CP_XML_NODE(L"a:gdLst");
|
||||
@ -391,8 +436,14 @@ void _oox_drawing::serialize_shape(std::wostream & strm)
|
||||
{
|
||||
CP_XML_NODE(L"a:path")
|
||||
{
|
||||
CP_XML_ATTR(L"w", w ? *w : cx);
|
||||
CP_XML_ATTR(L"h", h ? *h : cy);
|
||||
int path_w = w ? *w : cx;
|
||||
int path_h = h ? *h : cy;
|
||||
|
||||
if (path_w < 1) path_w = 1024;
|
||||
if (path_h < 1) path_h = 1024;
|
||||
|
||||
CP_XML_ATTR(L"w", path_w);
|
||||
CP_XML_ATTR(L"h", path_h);
|
||||
|
||||
if (sCustomPath)
|
||||
{
|
||||
@ -414,11 +465,7 @@ void _oox_drawing::serialize_shape(std::wostream & strm)
|
||||
CP_XML_ATTR(L"prst", shapeGeomPreset);
|
||||
if (!bWordArt)
|
||||
{
|
||||
if (std::wstring::npos != shapeGeomPreset.find(L"mathPlus"))
|
||||
{
|
||||
additional.push_back(odf_reader::_property(L"bModifiers", true));
|
||||
}
|
||||
oox_serialize_aLst(CP_XML_STREAM(), additional);
|
||||
oox_serialize_aLst(CP_XML_STREAM(), additional, shapeGeomPreset);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -508,10 +555,13 @@ void _oox_drawing::serialize_xfrm(std::wostream & strm, const std::wstring & nam
|
||||
CP_XML_ATTR(L"x", 0);
|
||||
CP_XML_ATTR(L"y", 0);
|
||||
}
|
||||
CP_XML_NODE(L"a:chExt")
|
||||
if (cx > 0 || cy > 0)
|
||||
{
|
||||
CP_XML_ATTR(L"cx", cx);
|
||||
CP_XML_ATTR(L"cy", cy);
|
||||
CP_XML_NODE(L"a:chExt")
|
||||
{
|
||||
CP_XML_ATTR(L"cx", cx);
|
||||
CP_XML_ATTR(L"cy", cy);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -525,9 +575,6 @@ void oox_serialize_action(std::wostream & strm, _action_desc const & val)
|
||||
{
|
||||
CP_XML_NODE(L"a:hlinkClick")
|
||||
{
|
||||
//CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
|
||||
//CP_XML_ATTR(L"xmlns:a", L"http://schemas.openxmlformats.org/drawingml/2006/main");
|
||||
|
||||
if (!val.action.empty())
|
||||
CP_XML_ATTR(L"action", val.action);
|
||||
|
||||
@ -544,6 +591,8 @@ void oox_serialize_action(std::wostream & strm, _action_desc const & val)
|
||||
CP_XML_ATTR(L"name", L"sound");
|
||||
}
|
||||
}
|
||||
//CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
|
||||
//CP_XML_ATTR(L"xmlns:a", L"http://schemas.openxmlformats.org/drawingml/2006/main");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ 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")
|
||||
_oox_drawing() : type(typeUnknown), id(0), x(0), y(0), cx(0), cy(0), sub_type(0), inGroup(false), name(L"object"), extExternal(false)
|
||||
{
|
||||
}
|
||||
RelsType type;
|
||||
@ -103,6 +103,7 @@ namespace oox {
|
||||
std::wstring objectProgId;
|
||||
|
||||
std::wstring extId;
|
||||
bool extExternal;
|
||||
|
||||
_action_desc action;
|
||||
std::vector<_hlink_desc> hlinks;
|
||||
@ -118,7 +119,7 @@ namespace oox {
|
||||
typedef _CP_PTR(_oox_drawing) oox_drawing_ptr;
|
||||
|
||||
void oox_serialize_ln (std::wostream & strm, const std::vector<odf_reader::_property> & val, bool always_draw = false);
|
||||
void oox_serialize_aLst (std::wostream & strm, const std::vector<odf_reader::_property> & val);
|
||||
void oox_serialize_aLst (std::wostream & strm, const std::vector<odf_reader::_property> & val, const std::wstring & shapeGeomPreset);
|
||||
void oox_serialize_action (std::wostream & strm, const _action_desc & val);
|
||||
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
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)
|
||||
{
|
||||
memset(cropRect,0,sizeof(double)*4);
|
||||
}
|
||||
@ -186,10 +186,10 @@ void oox_serialize_bitmap_fill(std::wostream & strm, const _oox_fill & val)
|
||||
{
|
||||
CP_XML_NODE(L"a:srcRect")
|
||||
{
|
||||
CP_XML_ATTR(L"l", static_cast<size_t>(val.bitmap->cropRect[0]*1000));
|
||||
CP_XML_ATTR(L"t", static_cast<size_t>(val.bitmap->cropRect[1]*1000));
|
||||
CP_XML_ATTR(L"r", static_cast<size_t>(val.bitmap->cropRect[2]*1000));
|
||||
CP_XML_ATTR(L"b", static_cast<size_t>(val.bitmap->cropRect[3]*1000));
|
||||
CP_XML_ATTR(L"l", static_cast<int>(val.bitmap->cropRect[0]*1000));
|
||||
CP_XML_ATTR(L"t", static_cast<int>(val.bitmap->cropRect[1]*1000));
|
||||
CP_XML_ATTR(L"r", static_cast<int>(val.bitmap->cropRect[2]*1000));
|
||||
CP_XML_ATTR(L"b", static_cast<int>(val.bitmap->cropRect[3]*1000));
|
||||
}
|
||||
}
|
||||
if (val.bitmap->bTile)
|
||||
|
||||
@ -147,6 +147,6 @@ namespace oox {
|
||||
void oox_serialize_fill (std::wostream & strm, const _oox_fill & val);
|
||||
void oox_serialize_srgb (std::wostream & strm,std::wstring color,_CP_OPT(double) opacity);
|
||||
void oox_serialize_srgb (std::wostream & strm,std::wstring color,_CP_OPT(odf_types::percent) opacity);
|
||||
|
||||
void oox_serialize_bitmap_fill (std::wostream & strm, const _oox_fill & val);
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,17 +70,19 @@ static std::wstring get_mime_type(const std::wstring & extension)
|
||||
else if (L"tif" == extension) return L"image/x-tiff";
|
||||
else if (L"tiff" == extension) return L"image/x-tiff";
|
||||
else if (L"pdf" == extension) return L"application/pdf";
|
||||
else if (L"bmp" == extension) return L"image/bmp";
|
||||
|
||||
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"avi" == extension) return L"video/avi";
|
||||
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"bin" == extension) return L"application/vnd.openxmlformats-officedocument.oleObject";
|
||||
else if (L"xlsx" == extension) return L"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
||||
|
||||
@ -102,6 +102,10 @@ void oox_chart::oox_serialize_common(std::wostream & _Wostream)
|
||||
}
|
||||
for (size_t i = 0; i < series_.size(); i++)
|
||||
{
|
||||
if (is3D_ || type_ == CHART_TYPE_AREA || type_ == CHART_TYPE_DOUGHNUT || type_ == CHART_TYPE_RADAR)
|
||||
{
|
||||
series_[i]->labelPosEnabled_ = false;
|
||||
}
|
||||
series_[i]->oox_serialize(_Wostream);
|
||||
}
|
||||
for (size_t i = 0; i < axisId_.size(); i++)
|
||||
@ -469,7 +473,7 @@ void oox_stock_chart::oox_serialize(std::wostream & _Wostream)
|
||||
//{
|
||||
// //shape.oox_serialize(CP_XML_STREAM());
|
||||
//}
|
||||
CP_XML_NODE(L"upDownBars")
|
||||
CP_XML_NODE(L"c:upDownBars")
|
||||
{
|
||||
CP_XML_NODE(L"c:gapWidth")
|
||||
{
|
||||
|
||||
@ -150,15 +150,30 @@ void pptx_serialize_media(std::wostream & strm, _pptx_drawing & val)
|
||||
CP_XML_NODE(L"p14:media")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns:p14", L"http://schemas.microsoft.com/office/powerpoint/2010/main");
|
||||
CP_XML_ATTR(L"r:embed", val.extId);
|
||||
if (val.extExternal)
|
||||
{
|
||||
CP_XML_ATTR(L"r:link", val.extId);
|
||||
}
|
||||
else
|
||||
{
|
||||
CP_XML_ATTR(L"r:embed", val.extId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (val.fill.bitmap)
|
||||
{
|
||||
val.fill.bitmap->name_space = L"p";
|
||||
oox_serialize_fill(CP_XML_STREAM(), val.fill);
|
||||
oox_serialize_bitmap_fill(strm, val.fill);
|
||||
|
||||
val.fill.bitmap.reset();
|
||||
}
|
||||
else
|
||||
{
|
||||
CP_XML_NODE(L"p:blipFill");
|
||||
}
|
||||
|
||||
CP_XML_NODE(L"p:spPr")
|
||||
{
|
||||
@ -169,7 +184,8 @@ void pptx_serialize_media(std::wostream & strm, _pptx_drawing & val)
|
||||
CP_XML_ATTR(L"prst", L"rect");
|
||||
CP_XML_NODE(L"a:avLst");
|
||||
}
|
||||
oox_serialize_ln(CP_XML_STREAM(), val.additional);
|
||||
oox_serialize_fill (CP_XML_STREAM(), val.fill);
|
||||
oox_serialize_ln (CP_XML_STREAM(), val.additional);
|
||||
}
|
||||
//_CP_OPT(std::wstring) strTextContent;
|
||||
//odf::GetProperty(properties,L"text-content",strTextContent);
|
||||
|
||||
@ -472,6 +472,13 @@ 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)
|
||||
{
|
||||
if (path.length() - (pos_replaicement + 18) < 2)
|
||||
return; //object without image
|
||||
}
|
||||
|
||||
if (impl_->object_description_.type_ == typeUnknown)
|
||||
{
|
||||
impl_->object_description_.type_ = typeImage;
|
||||
@ -547,8 +554,9 @@ void pptx_slide_context::Impl::process_image(drawing_object_description& obj, _p
|
||||
std::wstring ref;/// это ссылка на выходной внешний объект
|
||||
bool isMediaInternal = false;
|
||||
|
||||
drawing.fill.bitmap->rId = get_mediaitems().add_or_find(obj.xlink_href_, typeImage, isMediaInternal, ref);
|
||||
|
||||
drawing.fill.bitmap->rId = get_mediaitems().add_or_find(obj.xlink_href_, typeImage, isMediaInternal, ref);
|
||||
drawing.fill.bitmap->isInternal = isMediaInternal;
|
||||
|
||||
if (drawing.type == typeShape)
|
||||
{
|
||||
add_additional_rels(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage);//собственно это не объект, а доп рел и ref объекта
|
||||
@ -640,11 +648,12 @@ void pptx_slide_context::Impl::process_media(drawing_object_description& obj, _p
|
||||
|
||||
drawing.type = mediaitems::detectMediaType(obj.xlink_href_); //reset from Media to Audio, Video, ... QuickTime? AudioCD? ...
|
||||
|
||||
drawing.objectId = get_mediaitems().add_or_find(obj.xlink_href_, drawing.type, isMediaInternal, ref);
|
||||
drawing.extId = L"ext" + drawing.objectId;
|
||||
drawing.objectId = get_mediaitems().add_or_find(obj.xlink_href_, drawing.type, isMediaInternal, ref);
|
||||
drawing.extId = L"ext" + drawing.objectId;
|
||||
drawing.extExternal = !isMediaInternal;
|
||||
|
||||
add_drawing(drawing, false, drawing.objectId, L"NULL", drawing.type);
|
||||
add_additional_rels( true, drawing.extId, ref, typeMedia);
|
||||
add_additional_rels( isMediaInternal, drawing.extId, ref, typeMedia);
|
||||
|
||||
if (drawing.fill.bitmap)
|
||||
{
|
||||
|
||||
@ -332,21 +332,34 @@ void oox_serialize_tcPr(std::wostream & strm, std::vector<const odf_reader::styl
|
||||
}
|
||||
if (style_cell_attlist.common_padding_attlist_.fo_padding_)
|
||||
{
|
||||
CP_XML_ATTR(L"marT", *style_cell_attlist.common_padding_attlist_.fo_padding_);
|
||||
CP_XML_ATTR(L"marB", *style_cell_attlist.common_padding_attlist_.fo_padding_);
|
||||
CP_XML_ATTR(L"marL", *style_cell_attlist.common_padding_attlist_.fo_padding_);
|
||||
CP_XML_ATTR(L"marR", *style_cell_attlist.common_padding_attlist_.fo_padding_);
|
||||
double padding = style_cell_attlist.common_padding_attlist_.fo_padding_->get_value_unit(odf_types::length::emu);
|
||||
CP_XML_ATTR(L"marT", (long)padding);
|
||||
CP_XML_ATTR(L"marB", (long)padding);
|
||||
CP_XML_ATTR(L"marL", (long)padding);
|
||||
CP_XML_ATTR(L"marR", (long)padding);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (style_cell_attlist.common_padding_attlist_.fo_padding_top_)
|
||||
CP_XML_ATTR(L"marT", *style_cell_attlist.common_padding_attlist_.fo_padding_top_);
|
||||
{
|
||||
double padding = style_cell_attlist.common_padding_attlist_.fo_padding_top_->get_value_unit(odf_types::length::emu);
|
||||
CP_XML_ATTR(L"marT", (long)padding);
|
||||
}
|
||||
if (style_cell_attlist.common_padding_attlist_.fo_padding_bottom_)
|
||||
CP_XML_ATTR(L"marB", *style_cell_attlist.common_padding_attlist_.fo_padding_bottom_);
|
||||
{
|
||||
double padding = style_cell_attlist.common_padding_attlist_.fo_padding_bottom_->get_value_unit(odf_types::length::emu);
|
||||
CP_XML_ATTR(L"marB", (long)padding);
|
||||
}
|
||||
if (style_cell_attlist.common_padding_attlist_.fo_padding_left_)
|
||||
CP_XML_ATTR(L"marL", *style_cell_attlist.common_padding_attlist_.fo_padding_left_);
|
||||
{
|
||||
double padding = style_cell_attlist.common_padding_attlist_.fo_padding_left_->get_value_unit(odf_types::length::emu);
|
||||
CP_XML_ATTR(L"marL", (long)padding);
|
||||
}
|
||||
if (style_cell_attlist.common_padding_attlist_.fo_padding_right_)
|
||||
CP_XML_ATTR(L"marR", *style_cell_attlist.common_padding_attlist_.fo_padding_right_);
|
||||
{
|
||||
double padding = style_cell_attlist.common_padding_attlist_.fo_padding_right_->get_value_unit(odf_types::length::emu);
|
||||
CP_XML_ATTR(L"marR", (long)padding);
|
||||
}
|
||||
}
|
||||
//vert //
|
||||
//style_cell_attlist.pptx_serialize(Context, CP_XML_STREAM()); //nodes
|
||||
|
||||
@ -281,6 +281,11 @@ void xlsx_conditionalFormatting_context::set_formula(std::wstring f)
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"expression";
|
||||
impl_->conditionalFormattings_.back().rules.back().formula = converter.convert_named_expr(val);
|
||||
}
|
||||
else if (0 <= (pos = f.find(L"is-error")))
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"containsErrors";
|
||||
impl_->conditionalFormattings_.back().rules.back().formula = L"0";
|
||||
}
|
||||
else if (0 <= (pos = f.find(L"duplicate")))
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"duplicateValues";
|
||||
|
||||
@ -299,6 +299,13 @@ void xlsx_drawing_context::set_ms_object(const std::wstring & path, const std::w
|
||||
}
|
||||
void xlsx_drawing_context::set_image(const std::wstring & path)
|
||||
{
|
||||
int pos_replaicement = path.find(L"ObjectReplacements");
|
||||
if (pos_replaicement >= 0)
|
||||
{
|
||||
if (path.length() - (pos_replaicement + 18) < 2)
|
||||
return; //object without image
|
||||
}
|
||||
|
||||
if (impl_->object_description_.type_ == typeUnknown)
|
||||
{
|
||||
impl_->object_description_.type_ = typeImage;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -49,21 +49,37 @@ public:
|
||||
void start_table();
|
||||
int end_table();
|
||||
|
||||
void start_field();
|
||||
void set_field_name(std::wstring name);
|
||||
void set_field_type(int type);
|
||||
void set_field_function(int type);
|
||||
void set_field_user_function(std::wstring f);
|
||||
void add_field_subtotal(int function_type);
|
||||
void add_field_cache(int index, std::wstring value);
|
||||
void start_field ();
|
||||
void set_field_name (std::wstring name);
|
||||
void set_field_type (int type, int hierarchy);
|
||||
void set_field_function (int type);
|
||||
void set_field_user_function (std::wstring f);
|
||||
void add_field_subtotal (int function_type);
|
||||
void add_field_cache (int index, std::wstring value);
|
||||
void set_field_show_empty (bool val);
|
||||
void set_field_data_layout (bool val);
|
||||
void set_field_sort (int type);
|
||||
void set_field_groups (int type);
|
||||
void set_field_groups_source(std::wstring name);
|
||||
void set_repeat_item_labels(bool val);
|
||||
void end_field();
|
||||
|
||||
int get_count();
|
||||
|
||||
void set_view_name(std::wstring name);
|
||||
void set_view_target_range(std::wstring ref);
|
||||
void set_view_target_table_name(std::wstring name);
|
||||
|
||||
void add_button_header(std::wstring ref);
|
||||
|
||||
void set_identify_categories(bool val);
|
||||
void set_drill(bool val);
|
||||
|
||||
void set_source_range(std::wstring table_name, std::wstring ref);
|
||||
|
||||
void set_source_database(std::wstring database, std::wstring table_name);
|
||||
void set_source_database_query(std::wstring database, std::wstring query);
|
||||
void set_source_database_sql(std::wstring database, std::wstring sql);
|
||||
|
||||
void write_cache_definitions_to (int index, std::wostream & strm);
|
||||
void write_cache_records_to (int index, std::wostream & strm);
|
||||
@ -74,6 +90,8 @@ public:
|
||||
void dump_rels_cache(int index, rels & Rels);
|
||||
void dump_rels_view (int index, rels & Rels);
|
||||
|
||||
std::wstring get_chart_source(std::wstring name);
|
||||
|
||||
void add_connections(std::wstring connections);
|
||||
bool is_connections();
|
||||
|
||||
|
||||
@ -358,7 +358,18 @@ void xlsx_table_state::serialize_page_properties (std::wostream & strm)
|
||||
|
||||
page_layout->xlsx_serialize(strm, *context_);
|
||||
}
|
||||
void xlsx_table_state::serialize_background (std::wostream & strm)
|
||||
{
|
||||
if (tableBackground_.empty()) return;
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"picture")
|
||||
{
|
||||
CP_XML_ATTR(L"r:id", tableBackground_);
|
||||
}
|
||||
}
|
||||
}
|
||||
void xlsx_table_state::serialize_table_format (std::wostream & strm)
|
||||
{
|
||||
odf_reader::odf_read_context & odfContext = context_->root()->odf_context();
|
||||
@ -394,6 +405,7 @@ void xlsx_table_state::serialize_table_format (std::wostream & strm)
|
||||
{
|
||||
CP_XML_NODE(L"dimension")
|
||||
{
|
||||
if (current_table_column_ < 0) current_table_column_ = columns_count_;
|
||||
std::wstring ref2 = getCellAddress( current_table_column_, current_table_row_);
|
||||
CP_XML_ATTR(L"ref", L"A1:" + ref2);
|
||||
}
|
||||
@ -433,10 +445,10 @@ void xlsx_table_state::serialize_table_format (std::wostream & strm)
|
||||
{
|
||||
CP_XML_NODE(L"selection")
|
||||
{
|
||||
CP_XML_ATTR(L"sqref", getCellAddress(col, row));
|
||||
CP_XML_ATTR(L"activeCellId", 0);
|
||||
CP_XML_ATTR(L"activeCell", getCellAddress(col, row));
|
||||
CP_XML_ATTR(L"activeCellId", 0);
|
||||
CP_XML_ATTR(L"pane", L"topLeft");
|
||||
CP_XML_ATTR(L"sqref", getCellAddress(col, row));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -120,10 +120,12 @@ public:
|
||||
xlsx_conditionalFormatting_context & get_conditionalFormatting_context() {return xlsx_conditionalFormatting_context_;}
|
||||
|
||||
void table_column_last_width(double w) { table_column_last_width_ = w; }
|
||||
double table_column_last_width() const { return table_column_last_width_; };
|
||||
double table_column_last_width() const { return table_column_last_width_; };
|
||||
|
||||
void start_hyperlink ();
|
||||
std::wstring end_hyperlink (std::wstring const & ref, std::wstring const & href, std::wstring const & display);
|
||||
std::wstring end_hyperlink (std::wstring const & ref, std::wstring const & href, std::wstring const & display);
|
||||
|
||||
void set_background (std::wstring rId) { tableBackground_ = rId; }
|
||||
|
||||
void serialize_conditionalFormatting (std::wostream & _Wostream);
|
||||
void serialize_table_format (std::wostream & _Wostream);
|
||||
@ -131,6 +133,7 @@ public:
|
||||
void serialize_hyperlinks (std::wostream & _Wostream);
|
||||
void serialize_ole_objects (std::wostream & _Wostream);
|
||||
void serialize_page_properties (std::wostream & _Wostream);
|
||||
void serialize_background (std::wostream & _Wostream);
|
||||
|
||||
void dump_rels_hyperlinks (rels & Rels);
|
||||
void dump_rels_ole_objects (rels & Rels);
|
||||
@ -154,6 +157,7 @@ private:
|
||||
|
||||
std::wstring tableName_;
|
||||
int tableId_;
|
||||
std::wstring tableBackground_;
|
||||
|
||||
std::wstring table_style_;
|
||||
std::wstring table_row_style_;
|
||||
|
||||
@ -320,6 +320,10 @@ void xlsx_table_context::serialize_page_properties(std::wostream & _Wostream)
|
||||
{
|
||||
return state()->serialize_page_properties(_Wostream);
|
||||
}
|
||||
void xlsx_table_context::serialize_background(std::wostream & _Wostream)
|
||||
{
|
||||
return state()->serialize_background(_Wostream);
|
||||
}
|
||||
void xlsx_table_context::serialize_hyperlinks(std::wostream & _Wostream)
|
||||
{
|
||||
return state()->serialize_hyperlinks(_Wostream);
|
||||
|
||||
@ -90,6 +90,7 @@ public:
|
||||
void serialize_hyperlinks (std::wostream & _Wostream);
|
||||
void serialize_ole_objects (std::wostream & _Wostream);
|
||||
void serialize_page_properties (std::wostream & _Wostream);
|
||||
void serialize_background (std::wostream & _Wostream);
|
||||
|
||||
xlsx_table_metrics & get_table_metrics();
|
||||
|
||||
|
||||
@ -30,7 +30,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "xlsx_utils.h"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
@ -46,6 +45,14 @@ namespace cpdoccore {
|
||||
|
||||
namespace oox {
|
||||
|
||||
bool IsNumber(const std::wstring &value)
|
||||
{
|
||||
boost::wregex rule(L"^\\-{0,1}[0-9]*[.,]{0,1}[0-9]*$");
|
||||
boost::match_results<std::wstring::const_iterator> results;
|
||||
|
||||
return boost::regex_search(value/*.begin(), value.end(), results*/, rule);
|
||||
}
|
||||
|
||||
std::wstring getColAddress(size_t col)
|
||||
{
|
||||
static const size_t r = (L'Z' - L'A' + 1);
|
||||
@ -62,8 +69,6 @@ std::wstring getColAddress(size_t col)
|
||||
return std::wstring(1, (wchar_t)(L'A' + col));
|
||||
}
|
||||
|
||||
|
||||
|
||||
std::wstring getRowAddress(size_t row)
|
||||
{
|
||||
return std::to_wstring(row + 1);
|
||||
|
||||
@ -40,6 +40,8 @@ namespace cpdoccore {
|
||||
|
||||
namespace oox {
|
||||
|
||||
bool IsNumber(const std::wstring &value);
|
||||
|
||||
std::wstring getColAddress(size_t col);
|
||||
std::wstring getRowAddress(size_t row);
|
||||
|
||||
|
||||
@ -447,6 +447,18 @@ void xlsx_conversion_context::end_table()
|
||||
get_table_context().dump_rels_hyperlinks (current_sheet().sheet_rels());
|
||||
get_table_context().dump_rels_ole_objects (current_sheet().sheet_rels());
|
||||
|
||||
typedef std::multimap<std::wstring, int> _mapPivotsTableView;
|
||||
std::pair<_mapPivotsTableView::iterator, _mapPivotsTableView::iterator> range;
|
||||
|
||||
range = mapPivotsTableView_.equal_range(current_sheet().name());
|
||||
|
||||
for (_mapPivotsTableView::iterator it = range.first; it != range.second; ++it)
|
||||
{
|
||||
current_sheet().sheet_rels().add(oox::relationship(L"pvId" + std::to_wstring(it->second),
|
||||
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable",
|
||||
L"../pivotTables/pivotTable" + std::to_wstring(it->second) + L".xml"));
|
||||
}
|
||||
|
||||
if (!get_drawing_context().empty())
|
||||
{
|
||||
std::wstringstream strm;
|
||||
@ -463,9 +475,10 @@ void xlsx_conversion_context::end_table()
|
||||
{
|
||||
CP_XML_ATTR(L"r:id", drawingName.second);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
get_table_context().serialize_background (current_sheet().drawing());
|
||||
|
||||
}
|
||||
if (!get_comments_context().empty())
|
||||
{
|
||||
std::wstringstream strm;
|
||||
@ -483,7 +496,6 @@ void xlsx_conversion_context::end_table()
|
||||
current_sheet().set_comments_link(commentsName.first, commentsName.second);
|
||||
current_sheet().set_vml_drawing_link(vml_drawingName.first, vml_drawingName.second);
|
||||
}
|
||||
//background picture
|
||||
get_table_context().end_table();
|
||||
}
|
||||
|
||||
@ -535,7 +547,10 @@ int xlsx_conversion_context::current_table_row()
|
||||
|
||||
std::wstring xlsx_conversion_context::current_cell_address()
|
||||
{
|
||||
return oox::getCellAddress(current_table_column(), current_table_row());
|
||||
int col = current_table_column();
|
||||
int row = current_table_row();
|
||||
|
||||
return oox::getCellAddress(col < 0 ? 0 : col, row < 0 ? 0 : row); //under covered cell
|
||||
}
|
||||
|
||||
void xlsx_conversion_context::start_office_spreadsheet(const odf_reader::office_element * elm)
|
||||
@ -702,6 +717,10 @@ void xlsx_conversion_context::end_hyperlink(std::wstring const & href)
|
||||
xlsx_text_context_.end_span2();
|
||||
}
|
||||
}
|
||||
void xlsx_conversion_context::add_pivot_sheet_source (const std::wstring & sheet_name, int index_table_view)
|
||||
{//ващето в либре жесткая привязка что на одном листе тока одна сводная может быть ..
|
||||
mapPivotsTableView_.insert(std::make_pair(sheet_name, index_table_view));
|
||||
}
|
||||
|
||||
void xlsx_conversion_context::start_conditional_format(std::wstring ref)
|
||||
{
|
||||
|
||||
@ -137,6 +137,8 @@ public:
|
||||
void end_hyperlink (std::wstring const & href);
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
void add_pivot_sheet_source (const std::wstring & sheet_name, int index_table_view);
|
||||
|
||||
void start_conditional_format (std::wstring ref);
|
||||
void end_conditional_format (){}
|
||||
|
||||
@ -200,6 +202,7 @@ private:
|
||||
num_format_context num_format_context_;
|
||||
size_t default_style_;
|
||||
mediaitems mediaitems_;
|
||||
std::multimap<std::wstring, int> mapPivotsTableView_;
|
||||
|
||||
xlsx_style_manager xlsx_style_;
|
||||
xlsx_defined_names xlsx_defined_names_;
|
||||
|
||||
@ -77,6 +77,15 @@ typedef shared_ptr<const office_element>::Type office_element_ptr_const;
|
||||
|
||||
// Класс для конструирования чартов
|
||||
using namespace chart;
|
||||
|
||||
void object_odf_context::set_pivot_source(std::wstring const & val)
|
||||
{
|
||||
pivot_source_ = val;
|
||||
if (pivot_source_.empty() == false)
|
||||
{
|
||||
bPivotChart_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
void object_odf_context::set_width(double valPt)
|
||||
{
|
||||
@ -167,6 +176,11 @@ void object_odf_context::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
if (object_type_ == 1)
|
||||
{
|
||||
if (pivot_source_.empty() == false)
|
||||
{
|
||||
pivot_source_ = Context.get_pivots_context().get_chart_source(pivot_source_);
|
||||
|
||||
}
|
||||
Context.start_chart(L"");
|
||||
oox::oox_chart_context & chart = Context.current_chart();
|
||||
|
||||
@ -266,23 +280,60 @@ void object_odf_context::calc_cache_series(std::wstring adress, std::vector<std:
|
||||
{
|
||||
if (adress.empty()) return;
|
||||
|
||||
formulasconvert::odf2oox_converter converter;
|
||||
|
||||
std::wstring ref_1, ref_2, table;
|
||||
size_t col_1=0, row_1=0, col_2=0, row_2=0;
|
||||
|
||||
if (!converter.find_first_last_ref(adress, table, ref_1, ref_2))return;
|
||||
//if ((res = table.find(L"local-table"))<0)return;
|
||||
|
||||
oox::getCellAddressInv(ref_1, col_1,row_1);
|
||||
oox::getCellAddressInv(ref_2, col_2,row_2);
|
||||
|
||||
for (size_t i = 0; i < cash_values.size(); i++)
|
||||
if (bPivotChart_)
|
||||
{
|
||||
if (cash_values[i].col >= col_1 && cash_values[i].col <= col_2 &&
|
||||
cash_values[i].row >= row_1 && cash_values[i].row <= row_2)
|
||||
std::map<std::wstring, _cell>::iterator pFind = cash_pivot.find(adress);
|
||||
if (pFind != cash_pivot.end())
|
||||
{
|
||||
cash.push_back(cash_values[i].val);
|
||||
int col = pFind->second.col;
|
||||
int row = pFind->second.row;
|
||||
|
||||
if (col == 0 || row == 0)
|
||||
{
|
||||
for (size_t i = 0; i < cash_values.size(); i++)
|
||||
{
|
||||
if (col == 0)
|
||||
{
|
||||
if (cash_values[i].col == col)
|
||||
{
|
||||
cash.push_back(cash_values[i].val);
|
||||
}
|
||||
}
|
||||
if (row == 0)
|
||||
{
|
||||
if (cash_values[i].row == row)
|
||||
{
|
||||
cash.push_back(cash_values[i].val);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cash.push_back(pFind->second.val);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
formulasconvert::odf2oox_converter converter;
|
||||
|
||||
std::wstring ref_1, ref_2, table;
|
||||
size_t col_1 = 0, row_1 = 0, col_2 = 0, row_2 = 0;
|
||||
|
||||
if (!converter.find_first_last_ref(adress, table, ref_1, ref_2))return;
|
||||
//if ((res = table.find(L"local-table"))<0)return;
|
||||
|
||||
oox::getCellAddressInv(ref_1, col_1, row_1);
|
||||
oox::getCellAddressInv(ref_2, col_2, row_2);
|
||||
|
||||
for (size_t i = 0; i < cash_values.size(); i++)
|
||||
{
|
||||
if (cash_values[i].col >= col_1 && cash_values[i].col <= col_2 &&
|
||||
cash_values[i].row >= row_1 && cash_values[i].row <= row_2)
|
||||
{
|
||||
cash.push_back(cash_values[i].val);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -297,6 +348,8 @@ struct axises_sort
|
||||
|
||||
void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
|
||||
{
|
||||
chart_context.set_pivot_chart (pivot_source_);
|
||||
|
||||
chart_context.set_title (title_);
|
||||
chart_context.set_wall (wall_);
|
||||
chart_context.set_floor (floor_);
|
||||
@ -370,30 +423,36 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
|
||||
{
|
||||
if (last_set_type == chart_bubble)
|
||||
{ //bubble(x)
|
||||
current->set_formula_series(4, domain_cell_range_adress_, formatCode, boolVal.get_value_or(true));
|
||||
if (!bPivotChart_)
|
||||
current->set_formula_series(4, domain_cell_range_adress_, formatCode, boolVal.get_value_or(true));
|
||||
current->set_values_series (4, domain_cash);
|
||||
//y
|
||||
current->set_formula_series(3, series_[i].cell_range_address_, formatCode, boolVal.get_value_or(true));
|
||||
if (!bPivotChart_)
|
||||
current->set_formula_series(3, series_[i].cell_range_address_, formatCode, boolVal.get_value_or(true));
|
||||
current->set_values_series (3, cell_cash);
|
||||
}
|
||||
else
|
||||
{ //x
|
||||
current->set_formula_series(2, domain_cell_range_adress_, formatCode, boolVal.get_value_or(true));
|
||||
if (!bPivotChart_)
|
||||
current->set_formula_series(2, domain_cell_range_adress_, formatCode, boolVal.get_value_or(true));
|
||||
current->set_values_series (2, domain_cash);
|
||||
//y
|
||||
current->set_formula_series(3, series_[i].cell_range_address_, formatCode, boolVal.get_value_or(true));
|
||||
if (!bPivotChart_)
|
||||
current->set_formula_series(3, series_[i].cell_range_address_, formatCode, boolVal.get_value_or(true));
|
||||
current->set_values_series (3, cell_cash);
|
||||
}
|
||||
}
|
||||
else
|
||||
{ //common
|
||||
current->set_formula_series(1, series_[i].cell_range_address_, formatCode, boolVal.get_value_or(true));
|
||||
if (!bPivotChart_)
|
||||
current->set_formula_series(1, series_[i].cell_range_address_, formatCode, boolVal.get_value_or(true));
|
||||
current->set_values_series(1, cell_cash);
|
||||
}
|
||||
|
||||
if (categories_.empty() == false)//названия
|
||||
{
|
||||
current->set_formula_series(0, categories_[0], L"General", true);
|
||||
if (!bPivotChart_)
|
||||
current->set_formula_series(0, categories_[0], L"General", true);
|
||||
current->set_values_series(0, cat_cash);
|
||||
}
|
||||
current->set_name(series_[i].name_);
|
||||
@ -560,7 +619,13 @@ void process_build_object::on_not_impl(std::string const & message)
|
||||
_CP_LOG << L"[process_object visitor] : not impliment for \"" << utf8_to_utf16(message) << L"\"" << std::endl;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
//-----------------------------------------------------------------------------------
|
||||
void process_build_object::visit(office_document & val)
|
||||
{
|
||||
if (val.office_body_)
|
||||
val.office_body_->accept(*this);
|
||||
}
|
||||
|
||||
void process_build_object::visit(const office_document_content& val)
|
||||
{
|
||||
if (val.office_body_)
|
||||
@ -599,18 +664,21 @@ void process_build_object::visit(const chart_chart& val)
|
||||
{
|
||||
object_odf_context_.object_type_ = 1;
|
||||
|
||||
if (val.chart_chart_attlist_.common_draw_size_attlist_.svg_width_)
|
||||
if (val.attlist_.common_draw_size_attlist_.svg_width_)
|
||||
{
|
||||
object_odf_context_.set_width(val.chart_chart_attlist_.common_draw_size_attlist_.svg_width_->get_value_unit(length::pt));
|
||||
object_odf_context_.set_width(val.attlist_.common_draw_size_attlist_.svg_width_->get_value_unit(length::pt));
|
||||
}
|
||||
|
||||
if (val.chart_chart_attlist_.common_draw_size_attlist_.svg_height_)
|
||||
if (val.attlist_.common_draw_size_attlist_.svg_height_)
|
||||
{
|
||||
object_odf_context_.set_height(val.chart_chart_attlist_.common_draw_size_attlist_.svg_height_->get_value_unit(length::pt));
|
||||
object_odf_context_.set_height(val.attlist_.common_draw_size_attlist_.svg_height_->get_value_unit(length::pt));
|
||||
}
|
||||
ApplyGraphicProperties (val.chart_chart_attlist_.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.chart_graphic_properties_, object_odf_context_.chart_fill_);
|
||||
ApplyGraphicProperties (val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.chart_graphic_properties_, object_odf_context_.chart_fill_);
|
||||
|
||||
object_odf_context_.set_class(val.chart_chart_attlist_.chart_class_);
|
||||
object_odf_context_.set_class(val.attlist_.chart_class_);
|
||||
|
||||
if (val.attlist_.loext_data_pilot_source_)
|
||||
object_odf_context_.set_pivot_source(*val.attlist_.loext_data_pilot_source_);
|
||||
|
||||
ACCEPT_ALL_CONTENT_CONST(val.content_);
|
||||
|
||||
@ -626,13 +694,13 @@ void process_build_object::visit(const chart_title& val)
|
||||
val.text_p_->text_to_stream(v);
|
||||
t.content_ = v.str();
|
||||
}
|
||||
ApplyTextProperties(val.chart_title_attlist_.common_attlist_.chart_style_name_.get_value_or(L""), t.text_properties_);
|
||||
ApplyTextProperties(val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""), t.text_properties_);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
if (val.chart_title_attlist_.common_draw_position_attlist_.svg_x_)
|
||||
if (val.attlist_.common_draw_position_attlist_.svg_x_)
|
||||
{
|
||||
t.pos_x = val.chart_title_attlist_.common_draw_position_attlist_.svg_x_->get_value_unit(length::pt);
|
||||
t.pos_y = val.chart_title_attlist_.common_draw_position_attlist_.svg_y_->get_value_unit(length::pt);
|
||||
t.pos_x = val.attlist_.common_draw_position_attlist_.svg_x_->get_value_unit(length::pt);
|
||||
t.pos_y = val.attlist_.common_draw_position_attlist_.svg_y_->get_value_unit(length::pt);
|
||||
}
|
||||
t.bEnabled = true;
|
||||
|
||||
@ -650,10 +718,10 @@ void process_build_object::visit(const chart_subtitle & val)
|
||||
val.text_p_->text_to_stream(v);
|
||||
t.content_ = v.str();
|
||||
|
||||
if (val.chart_title_attlist_.common_draw_position_attlist_.svg_x_)
|
||||
if (val.attlist_.common_draw_position_attlist_.svg_x_)
|
||||
{
|
||||
t.pos_x = val.chart_title_attlist_.common_draw_position_attlist_.svg_x_->get_value_unit(length::pt);
|
||||
t.pos_y = val.chart_title_attlist_.common_draw_position_attlist_.svg_y_->get_value_unit(length::pt);
|
||||
t.pos_x = val.attlist_.common_draw_position_attlist_.svg_x_->get_value_unit(length::pt);
|
||||
t.pos_y = val.attlist_.common_draw_position_attlist_.svg_y_->get_value_unit(length::pt);
|
||||
}
|
||||
t.bEnabled = true;
|
||||
object_odf_context_.sub_title_ = t;
|
||||
@ -672,32 +740,32 @@ void process_build_object::visit(const chart_legend& val)
|
||||
{
|
||||
object_odf_context_.legend_.bEnabled = true;
|
||||
|
||||
ApplyChartProperties (val.chart_legend_attlist_.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.legend_.properties_);
|
||||
ApplyGraphicProperties (val.chart_legend_attlist_.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.legend_.graphic_properties_,object_odf_context_.legend_.fill_);
|
||||
ApplyTextProperties (val.chart_legend_attlist_.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.legend_.text_properties_);
|
||||
ApplyChartProperties (val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.legend_.properties_);
|
||||
ApplyGraphicProperties (val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.legend_.graphic_properties_,object_odf_context_.legend_.fill_);
|
||||
ApplyTextProperties (val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.legend_.text_properties_);
|
||||
}
|
||||
|
||||
void process_build_object::visit(const chart_plot_area& val)
|
||||
{
|
||||
ACCEPT_ALL_CONTENT_CONST(val.content_);
|
||||
|
||||
object_odf_context_.plot_area_.cell_range_address_ = val.chart_plot_area_attlist_.table_cell_range_address_.get_value_or(L"");
|
||||
object_odf_context_.plot_area_.cell_range_address_ = val.attlist_.table_cell_range_address_.get_value_or(L"");
|
||||
|
||||
ApplyChartProperties (val.chart_plot_area_attlist_.common_attlist_.chart_style_name_.get_value_or(L""),object_odf_context_.plot_area_.properties_);
|
||||
ApplyGraphicProperties (val.chart_plot_area_attlist_.common_attlist_.chart_style_name_.get_value_or(L""),object_odf_context_.plot_area_.graphic_properties_, object_odf_context_.plot_area_.fill_);
|
||||
ApplyTextProperties (val.chart_plot_area_attlist_.common_attlist_.chart_style_name_.get_value_or(L""),object_odf_context_.plot_area_.text_properties_);
|
||||
ApplyChartProperties (val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""),object_odf_context_.plot_area_.properties_);
|
||||
ApplyGraphicProperties (val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""),object_odf_context_.plot_area_.graphic_properties_, object_odf_context_.plot_area_.fill_);
|
||||
ApplyTextProperties (val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""),object_odf_context_.plot_area_.text_properties_);
|
||||
}
|
||||
|
||||
|
||||
void process_build_object::visit(const chart_axis& val)
|
||||
{
|
||||
object_odf_context_.start_axis(val.chart_axis_attlist_.chart_dimension_.get_value_or(L""),
|
||||
val.chart_axis_attlist_.chart_name_.get_value_or(L""),
|
||||
val.chart_axis_attlist_.common_attlist_.chart_style_name_.get_value_or(L""));
|
||||
object_odf_context_.start_axis(val.attlist_.chart_dimension_.get_value_or(L""),
|
||||
val.attlist_.chart_name_.get_value_or(L""),
|
||||
val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""));
|
||||
|
||||
ACCEPT_ALL_CONTENT_CONST(val.content_);
|
||||
|
||||
std::wstring style_name = val.chart_axis_attlist_.common_attlist_.chart_style_name_.get_value_or(L"");
|
||||
std::wstring style_name = val.attlist_.common_attlist_.chart_style_name_.get_value_or(L"");
|
||||
|
||||
ApplyChartProperties (style_name, object_odf_context_.axises_.back().properties_);
|
||||
ApplyGraphicProperties (style_name, object_odf_context_.axises_.back().graphic_properties_, object_odf_context_.axises_.back().fill_);
|
||||
@ -708,7 +776,7 @@ void process_build_object::visit(const chart_axis& val)
|
||||
|
||||
void process_build_object::visit(const chart_series& val)
|
||||
{
|
||||
const chart_series_attlist & att = val.chart_series_attlist_;
|
||||
const chart_series_attlist & att = val.attlist_;
|
||||
|
||||
chart::class_type chartClass = get_series_class_type(att.chart_class_.get_value_or(object_odf_context_.str_class_));
|
||||
|
||||
@ -737,21 +805,21 @@ void process_build_object::visit(const chart_domain& val)
|
||||
}
|
||||
void process_build_object::visit(const chart_grid& val)
|
||||
{
|
||||
object_odf_context_.add_grid(val.chart_grid_attlist_.chart_class_.get_value_or(L""),
|
||||
val.chart_grid_attlist_.common_attlist_.chart_style_name_.get_value_or(L"") );
|
||||
object_odf_context_.add_grid(val.attlist_.chart_class_.get_value_or(L""),
|
||||
val.attlist_.common_attlist_.chart_style_name_.get_value_or(L"") );
|
||||
|
||||
oox::_oox_fill fill;
|
||||
|
||||
ApplyGraphicProperties (val.chart_grid_attlist_.common_attlist_.chart_style_name_.get_value_or(L""), (object_odf_context_.axises_.back()).grids_.back().graphic_properties_, fill);
|
||||
ApplyGraphicProperties (val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""), (object_odf_context_.axises_.back()).grids_.back().graphic_properties_, fill);
|
||||
|
||||
}
|
||||
void process_build_object::visit(const chart_wall& val)
|
||||
{
|
||||
object_odf_context_.wall_.bEnabled = true;
|
||||
|
||||
ApplyChartProperties (val.chart_wall_attlist_.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.wall_.properties_);
|
||||
ApplyGraphicProperties (val.chart_wall_attlist_.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.wall_.graphic_properties_,object_odf_context_.wall_.fill_);
|
||||
ApplyTextProperties (val.chart_wall_attlist_.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.wall_.text_properties_);
|
||||
ApplyChartProperties (val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.wall_.properties_);
|
||||
ApplyGraphicProperties (val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.wall_.graphic_properties_,object_odf_context_.wall_.fill_);
|
||||
ApplyTextProperties (val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.wall_.text_properties_);
|
||||
}
|
||||
|
||||
void process_build_object::visit(const chart_floor& val)
|
||||
@ -765,12 +833,12 @@ void process_build_object::visit(const chart_floor& val)
|
||||
|
||||
void process_build_object::visit(const chart_data_point & val)
|
||||
{
|
||||
object_odf_context_.add_point( val.chart_data_point_attlist_.chart_repeated_.get_value_or(1));
|
||||
object_odf_context_.add_point( val.attlist_.chart_repeated_.get_value_or(1));
|
||||
|
||||
if (val.chart_data_point_attlist_.common_attlist_.chart_style_name_)
|
||||
if (val.attlist_.common_attlist_.chart_style_name_)
|
||||
{
|
||||
object_odf_context_.series_.back().points_.back().bEnabled = true;
|
||||
std::wstring style_name = val.chart_data_point_attlist_.common_attlist_.chart_style_name_.get_value_or(L"");
|
||||
std::wstring style_name = val.attlist_.common_attlist_.chart_style_name_.get_value_or(L"");
|
||||
|
||||
ApplyGraphicProperties (style_name, object_odf_context_.series_.back().points_.back().graphic_properties_,
|
||||
object_odf_context_.series_.back().points_.back().fill_);
|
||||
@ -895,12 +963,21 @@ void process_build_object::visit(const table_table_cell& val)
|
||||
|
||||
unsigned int repeated = val.attlist_.table_number_columns_repeated_;
|
||||
|
||||
std::wstringstream wstream_temp;
|
||||
|
||||
val.content_.text_to_stream(wstream_temp);
|
||||
std::wstring cell_cash = wstream_temp.str();
|
||||
|
||||
std::wstring cell_val;
|
||||
std::wstring cell_val, cell_cash, cell_desc;
|
||||
|
||||
for (size_t i = 0 ; i < val.content_.elements_.size(); i++)
|
||||
{
|
||||
std::wstringstream wstream_temp;
|
||||
val.content_.elements_[i]->text_to_stream(wstream_temp);
|
||||
if (val.content_.elements_[i]->get_type() == typeTextP)
|
||||
{
|
||||
cell_cash += wstream_temp.str();
|
||||
}
|
||||
else if (val.content_.elements_[i]->get_type() == typeDrawG)
|
||||
{
|
||||
cell_desc += wstream_temp.str();
|
||||
}
|
||||
}
|
||||
|
||||
if (attlist.common_value_and_type_attlist_.office_value_) cell_val = *attlist.common_value_and_type_attlist_.office_value_;
|
||||
else if (attlist.common_value_and_type_attlist_.office_currency_) cell_val = *attlist.common_value_and_type_attlist_.office_currency_;
|
||||
@ -912,11 +989,16 @@ void process_build_object::visit(const 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_= {object_odf_context_.current_table_column_, object_odf_context_.current_table_row_, cell_cash};
|
||||
|
||||
object_odf_context_.cash_values.push_back(cell_);
|
||||
|
||||
object_odf_context_.current_table_column_+=repeated;
|
||||
|
||||
if (object_odf_context_.bPivotChart_)
|
||||
{
|
||||
object_odf_context_.cash_pivot.insert(std::make_pair(cell_desc, cell_));
|
||||
}
|
||||
}
|
||||
void process_build_object::visit(const table_covered_table_cell& val)
|
||||
{
|
||||
|
||||
@ -111,6 +111,7 @@ public:
|
||||
width_pt_ (0),
|
||||
height_pt_ (0),
|
||||
in_axis_ (false),
|
||||
bPivotChart_ (false),
|
||||
current_table_column_ (0),
|
||||
current_table_row_ (0),
|
||||
columns_spanned_num_ (0),
|
||||
@ -124,6 +125,8 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
void set_pivot_source(std::wstring const & val);
|
||||
|
||||
void set_width(double valPt);
|
||||
|
||||
void set_height(double valPt);
|
||||
@ -170,6 +173,9 @@ public:
|
||||
std::wstring style_name_;
|
||||
std::wstring name_;
|
||||
|
||||
std::wstring pivot_source_;
|
||||
bool bPivotChart_;
|
||||
|
||||
bool in_axis_;
|
||||
std::vector<chart::axis> axises_;
|
||||
std::vector<chart::series> series_;
|
||||
@ -195,6 +201,7 @@ public:
|
||||
oox::_oox_fill chart_fill_;
|
||||
|
||||
std::vector<_cell> cash_values;
|
||||
std::map<std::wstring, _cell>cash_pivot;
|
||||
|
||||
//---------------------------------------
|
||||
std::wstring target_table_;
|
||||
@ -216,6 +223,8 @@ public:
|
||||
|
||||
class process_build_object
|
||||
: public base_visitor,
|
||||
public visitor<office_document>,
|
||||
|
||||
public const_visitor<office_document_content>,
|
||||
public visitor<office_document_content>,
|
||||
|
||||
@ -283,7 +292,8 @@ private:
|
||||
virtual void on_not_impl(std::string const & message);
|
||||
|
||||
public:
|
||||
|
||||
virtual void visit(office_document & val);
|
||||
|
||||
virtual void visit(const office_document_content& val);
|
||||
virtual void visit(office_document_content & val);
|
||||
|
||||
|
||||
@ -86,7 +86,8 @@ const std::wstring color::get_hex_value() const
|
||||
{
|
||||
boost::algorithm::trim(tmp);
|
||||
boost::algorithm::trim_left_if(tmp, boost::algorithm::is_any_of("#"));
|
||||
return tmp;
|
||||
|
||||
return XmlUtils::GetUpper(tmp);
|
||||
}
|
||||
else if (tmp.size() == 6)
|
||||
{
|
||||
@ -96,7 +97,7 @@ const std::wstring color::get_hex_value() const
|
||||
unsigned int t = 0;
|
||||
if ((s << tmp) && (s >> std::hex >> t) && (s >> std::ws).eof())
|
||||
{
|
||||
return tmp;
|
||||
return XmlUtils::GetUpper(tmp);
|
||||
}
|
||||
}
|
||||
catch(...)
|
||||
|
||||
94
ASCOfficeOdfFile/src/odf/datatypes/dategroup.cpp
Normal file
94
ASCOfficeOdfFile/src/odf/datatypes/dategroup.cpp
Normal file
@ -0,0 +1,94 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "dategroup.h"
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <ostream>
|
||||
|
||||
namespace cpdoccore { namespace odf_types {
|
||||
|
||||
std::wostream & operator << (std::wostream & _Wostream, const date_group & _Val)
|
||||
{
|
||||
switch(_Val.get_type())
|
||||
{
|
||||
case date_group::seconds:
|
||||
_Wostream << L"seconds";
|
||||
break;
|
||||
case date_group::minutes:
|
||||
_Wostream << L"minutes";
|
||||
break;
|
||||
case date_group::hours:
|
||||
_Wostream << L"hours";
|
||||
break;
|
||||
case date_group::days:
|
||||
_Wostream << L"days";
|
||||
break;
|
||||
case date_group::months:
|
||||
_Wostream << L"months";
|
||||
break;
|
||||
case date_group::quarters:
|
||||
_Wostream << L"quarters";
|
||||
break;
|
||||
case date_group::years:
|
||||
_Wostream << L"years";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return _Wostream;
|
||||
}
|
||||
date_group date_group::parse(const std::wstring & Str)
|
||||
{
|
||||
std::wstring tmp = Str;
|
||||
boost::algorithm::to_lower(tmp);
|
||||
|
||||
if (tmp == L"seconds")
|
||||
return date_group( seconds );
|
||||
else if (tmp == L"minutes")
|
||||
return date_group( minutes );
|
||||
else if (tmp == L"hours")
|
||||
return date_group( hours );
|
||||
else if (tmp == L"days")
|
||||
return date_group( days );
|
||||
else if (tmp == L"months")
|
||||
return date_group( months );
|
||||
else if (tmp == L"quarters")
|
||||
return date_group( quarters );
|
||||
else if (tmp == L"years")
|
||||
return date_group( years );
|
||||
else
|
||||
{
|
||||
return date_group( months );
|
||||
}
|
||||
}
|
||||
|
||||
} }
|
||||
@ -1,39 +1,78 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// FontMaps.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
// TODO: reference any additional headers you need in STDAFX.H
|
||||
// and not in this file
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <iosfwd>
|
||||
#include <string>
|
||||
#include "odfattributes.h"
|
||||
|
||||
|
||||
namespace cpdoccore { namespace odf_types {
|
||||
|
||||
class date_group
|
||||
{
|
||||
public:
|
||||
enum type
|
||||
{
|
||||
seconds,
|
||||
minutes,
|
||||
hours,
|
||||
days,
|
||||
months,
|
||||
quarters,
|
||||
years
|
||||
};
|
||||
|
||||
date_group() {}
|
||||
|
||||
date_group(type _Type) : type_(_Type)
|
||||
{}
|
||||
|
||||
type get_type() const
|
||||
{
|
||||
return type_;
|
||||
};
|
||||
|
||||
static date_group parse(const std::wstring & Str);
|
||||
|
||||
private:
|
||||
type type_;
|
||||
|
||||
};
|
||||
|
||||
std::wostream & operator << (std::wostream & _Wostream, const date_group & _Val);
|
||||
|
||||
}
|
||||
|
||||
APPLY_PARSE_XML_ATTRIBUTES(odf_types::date_group);
|
||||
|
||||
}
|
||||
@ -108,7 +108,6 @@ font_weight font_weight::parse(const std::wstring & Str)
|
||||
return font_weight( W900 );
|
||||
else
|
||||
{
|
||||
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
|
||||
return WNormal;
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,47 +91,47 @@ smil_transition_type smil_transition_type::parse(const std::wstring & Str)
|
||||
std::wstring tmp = Str;
|
||||
boost::algorithm::to_lower(tmp);
|
||||
|
||||
if(tmp == L"barWipe") return smil_transition_type( barWipe );
|
||||
else if(tmp == L"boxWipe") return smil_transition_type( boxWipe );
|
||||
else if(tmp == L"fourboxWipe") return smil_transition_type( fourBoxWipe );
|
||||
else if(tmp == L"barndoorWipe") return smil_transition_type( barnDoorWipe );
|
||||
else if(tmp == L"diagonalWipe") return smil_transition_type( diagonalWipe );
|
||||
else if(tmp == L"bowtieWipe") return smil_transition_type( bowTieWipe );
|
||||
else if(tmp == L"miscdiagonalWipe") return smil_transition_type( miscDiagonalWipe );
|
||||
else if(tmp == L"veeWipe") return smil_transition_type( veeWipe );
|
||||
else if(tmp == L"barnveeWipe") return smil_transition_type( barnVeeWipe );
|
||||
else if(tmp == L"zigzagWipe") return smil_transition_type( zigZagWipe );
|
||||
else if(tmp == L"barnzigzagWipe") return smil_transition_type( barnZigZagWipe );
|
||||
else if(tmp == L"irisWipe") return smil_transition_type( irisWipe);
|
||||
else if(tmp == L"triangleWipe") return smil_transition_type( triangleWipe);
|
||||
else if(tmp == L"arrowheadWipe") return smil_transition_type( arrowHeadWipe );
|
||||
else if(tmp == L"pentagonWipe") return smil_transition_type( pentagonWipe );
|
||||
else if(tmp == L"hexagonWipe") return smil_transition_type( hexagonWipe );
|
||||
else if(tmp == L"ellipseWipe") return smil_transition_type( ellipseWipe );
|
||||
else if(tmp == L"eyeWipe") return smil_transition_type( eyeWipe );
|
||||
else if(tmp == L"roundrectWipe") return smil_transition_type( roundRectWipe );
|
||||
else if(tmp == L"starWipe") return smil_transition_type( starWipe );
|
||||
else if(tmp == L"miscshapeWipe") return smil_transition_type( miscShapeWipe );
|
||||
else if(tmp == L"clockWipe") return smil_transition_type( clockWipe );
|
||||
else if(tmp == L"pinwheelWipe") return smil_transition_type( pinWheelWipe );
|
||||
else if(tmp == L"singlesweepWipe") return smil_transition_type( singleSweepWipe);
|
||||
else if(tmp == L"fanWipe") return smil_transition_type( fanWipe );
|
||||
else if(tmp == L"doublefanWipe") return smil_transition_type( doubleFanWipe );
|
||||
else if(tmp == L"doublesweepWipe") return smil_transition_type( doubleSweepWipe );
|
||||
else if(tmp == L"saloondoorWipe") return smil_transition_type( saloonDoorWipe );
|
||||
else if(tmp == L"windshieldWipe") return smil_transition_type( windshieldWipe );
|
||||
else if(tmp == L"snakeWipe") return smil_transition_type( snakeWipe );
|
||||
else if(tmp == L"spiralWipe") return smil_transition_type( spiralWipe );
|
||||
else if(tmp == L"parallelsnakesWipe")return smil_transition_type( parallelSnakesWipe );
|
||||
else if(tmp == L"boxsnakesWipe") return smil_transition_type( boxSnakesWipe );
|
||||
else if(tmp == L"waterfallWipe") return smil_transition_type( waterfallWipe );
|
||||
else if(tmp == L"pushWipe") return smil_transition_type( pushWipe );
|
||||
else if(tmp == L"slideWipe") return smil_transition_type( slideWipe );
|
||||
if(tmp == L"barwipe") return smil_transition_type( barWipe );
|
||||
else if(tmp == L"boxwipe") return smil_transition_type( boxWipe );
|
||||
else if(tmp == L"fourboxwipe") return smil_transition_type( fourBoxWipe );
|
||||
else if(tmp == L"barndoorwipe") return smil_transition_type( barnDoorWipe );
|
||||
else if(tmp == L"diagonalwipe") return smil_transition_type( diagonalWipe );
|
||||
else if(tmp == L"bowtiewipe") return smil_transition_type( bowTieWipe );
|
||||
else if(tmp == L"miscdiagonalwipe") return smil_transition_type( miscDiagonalWipe );
|
||||
else if(tmp == L"veewipe") return smil_transition_type( veeWipe );
|
||||
else if(tmp == L"barnveewipe") return smil_transition_type( barnVeeWipe );
|
||||
else if(tmp == L"zigzagwipe") return smil_transition_type( zigZagWipe );
|
||||
else if(tmp == L"barnzigzagwipe") return smil_transition_type( barnZigZagWipe );
|
||||
else if(tmp == L"iriswipe") return smil_transition_type( irisWipe);
|
||||
else if(tmp == L"trianglewipe") return smil_transition_type( triangleWipe);
|
||||
else if(tmp == L"arrowheadwipe") return smil_transition_type( arrowHeadWipe );
|
||||
else if(tmp == L"pentagonwipe") return smil_transition_type( pentagonWipe );
|
||||
else if(tmp == L"hexagonwipe") return smil_transition_type( hexagonWipe );
|
||||
else if(tmp == L"ellipsewipe") return smil_transition_type( ellipseWipe );
|
||||
else if(tmp == L"eyewipe") return smil_transition_type( eyeWipe );
|
||||
else if(tmp == L"roundrectwipe") return smil_transition_type( roundRectWipe );
|
||||
else if(tmp == L"starwipe") return smil_transition_type( starWipe );
|
||||
else if(tmp == L"miscshapewipe") return smil_transition_type( miscShapeWipe );
|
||||
else if(tmp == L"clockwipe") return smil_transition_type( clockWipe );
|
||||
else if(tmp == L"pinwheelwipe") return smil_transition_type( pinWheelWipe );
|
||||
else if(tmp == L"singlesweepwipe") return smil_transition_type( singleSweepWipe);
|
||||
else if(tmp == L"fanwipe") return smil_transition_type( fanWipe );
|
||||
else if(tmp == L"doublefanwipe") return smil_transition_type( doubleFanWipe );
|
||||
else if(tmp == L"doublesweepwipe") return smil_transition_type( doubleSweepWipe );
|
||||
else if(tmp == L"saloondoorwipe") return smil_transition_type( saloonDoorWipe );
|
||||
else if(tmp == L"windshieldwipe") return smil_transition_type( windshieldWipe );
|
||||
else if(tmp == L"snakewipe") return smil_transition_type( snakeWipe );
|
||||
else if(tmp == L"spiralwipe") return smil_transition_type( spiralWipe );
|
||||
else if(tmp == L"parallelsnakeswipe")return smil_transition_type( parallelSnakesWipe );
|
||||
else if(tmp == L"boxsnakeswipe") return smil_transition_type( boxSnakesWipe );
|
||||
else if(tmp == L"waterfallwipe") return smil_transition_type( waterfallWipe );
|
||||
else if(tmp == L"pushwipe") return smil_transition_type( pushWipe );
|
||||
else if(tmp == L"slidewipe") return smil_transition_type( slideWipe );
|
||||
else if(tmp == L"fade") return smil_transition_type( fade );
|
||||
else if(tmp == L"checkerboardWipe") return smil_transition_type( checkerBoardWipe);
|
||||
else if(tmp == L"blindsWipe") return smil_transition_type( blindsWipe);
|
||||
else if(tmp == L"checkerboardwipe") return smil_transition_type( checkerBoardWipe);
|
||||
else if(tmp == L"blindswipe") return smil_transition_type( blindsWipe);
|
||||
else if(tmp == L"dissolve") return smil_transition_type( dissolve);
|
||||
else if(tmp == L"randombarWipe") return smil_transition_type( randomBarWipe);
|
||||
else if(tmp == L"randombarwipe") return smil_transition_type( randomBarWipe);
|
||||
else
|
||||
{
|
||||
return smil_transition_type( barWipe );
|
||||
|
||||
@ -84,7 +84,6 @@ vertical_align vertical_align::parse(const std::wstring & Str)
|
||||
return vertical_align( Justify );
|
||||
else
|
||||
{
|
||||
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
|
||||
return vertical_align( Baseline );
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,7 +105,10 @@ void draw_image::add_child_element( xml::sax * Reader, const std::wstring & Ns,
|
||||
//CP_NOT_APPLICABLE_ELM();
|
||||
}
|
||||
}
|
||||
|
||||
std::wostream & draw_image::text_to_stream(std::wostream & _Wostream) const
|
||||
{
|
||||
return _Wostream;
|
||||
}
|
||||
// draw:chart
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * draw_chart::ns = L"draw";
|
||||
@ -151,6 +154,13 @@ void draw_g::add_child_element( xml::sax * Reader, const std::wstring & Ns, cons
|
||||
{
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
}
|
||||
|
||||
std::wostream & draw_g::text_to_stream(std::wostream & _Wostream) const
|
||||
{
|
||||
CP_SERIALIZE_TEXT(content_);
|
||||
return _Wostream;
|
||||
}
|
||||
|
||||
// draw:frame
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * draw_frame::ns = L"draw";
|
||||
@ -261,7 +271,11 @@ void draw_object::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
|
||||
void draw_object::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
CP_NOT_APPLICABLE_ELM(); // TODO
|
||||
if CP_CHECK_NAME(L"office", L"document")
|
||||
{
|
||||
//embedded
|
||||
odf_document_ = odf_document_ptr( new odf_document(Reader));
|
||||
}
|
||||
}
|
||||
|
||||
// draw:object
|
||||
@ -328,8 +342,10 @@ std::wstring draw_object_ole::detectObject(const std::wstring &fileName)
|
||||
}
|
||||
|
||||
|
||||
std::wstring draw_object::office_convert(odf_document * odfDocument, int type)
|
||||
std::wstring draw_object::office_convert(odf_document_ptr odfDocument, int type)
|
||||
{
|
||||
if (!odfDocument) return L"";
|
||||
|
||||
std::wstring href_result;
|
||||
std::wstring folderPath = odfDocument->get_folder();
|
||||
std::wstring objectOutPath = NSDirectory::CreateDirectoryWithUniqueName(folderPath);
|
||||
@ -337,7 +353,7 @@ std::wstring draw_object::office_convert(odf_document * odfDocument, int type)
|
||||
if (type == 1)
|
||||
{
|
||||
oox::package::docx_document outputDocx;
|
||||
oox::docx_conversion_context conversionDocxContext ( odfDocument);
|
||||
oox::docx_conversion_context conversionDocxContext ( odfDocument.get());
|
||||
|
||||
conversionDocxContext.set_output_document (&outputDocx);
|
||||
//conversionContext.set_font_directory (fontsPath);
|
||||
@ -356,7 +372,7 @@ std::wstring draw_object::office_convert(odf_document * odfDocument, int type)
|
||||
if (type == 2)
|
||||
{
|
||||
oox::package::xlsx_document outputXlsx;
|
||||
oox::xlsx_conversion_context conversionXlsxContext ( odfDocument);
|
||||
oox::xlsx_conversion_context conversionXlsxContext ( odfDocument.get());
|
||||
|
||||
conversionXlsxContext.set_output_document (&outputXlsx);
|
||||
//conversionContext.set_font_directory (fontsPath);
|
||||
|
||||
@ -49,13 +49,14 @@ namespace cpdoccore {
|
||||
|
||||
namespace odf_reader {
|
||||
|
||||
/// draw-image-attlist
|
||||
class odf_document;
|
||||
typedef shared_ptr<odf_document>::Type odf_document_ptr;
|
||||
|
||||
class draw_image_attlist
|
||||
{
|
||||
public:
|
||||
void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
|
||||
public:
|
||||
_CP_OPT(std::wstring) draw_filter_name_;
|
||||
|
||||
};
|
||||
@ -69,7 +70,9 @@ public:
|
||||
static const ElementType type = typeDrawImage;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context);
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
|
||||
|
||||
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);
|
||||
|
||||
@ -79,14 +82,15 @@ private:
|
||||
|
||||
draw_image_attlist draw_image_attlist_;
|
||||
odf_types::common_xlink_attlist common_xlink_attlist_;
|
||||
office_element_ptr office_binary_data_;
|
||||
|
||||
office_element_ptr office_binary_data_;
|
||||
|
||||
office_element_ptr_array content_;
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_image);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//draw-chart-attlist
|
||||
//------------------------------------------------------------------------------------------------------
|
||||
class draw_chart_attlist
|
||||
{
|
||||
public:
|
||||
@ -134,7 +138,6 @@ class draw_frame_attlist
|
||||
public:
|
||||
void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
|
||||
public:
|
||||
_CP_OPT(std::wstring) draw_copy_of_;
|
||||
_CP_OPT(odf_types::length_or_percent) fo_min_width_;
|
||||
_CP_OPT(odf_types::length_or_percent) fo_min_height_;
|
||||
@ -191,15 +194,12 @@ private:
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_frame);
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
//draw-frame-attlist
|
||||
class draw_g_attlist
|
||||
{
|
||||
public:
|
||||
void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
|
||||
};
|
||||
|
||||
|
||||
class draw_g : public office_element_impl<draw_g>
|
||||
{
|
||||
public:
|
||||
@ -209,7 +209,9 @@ public:
|
||||
static const ElementType type = typeDrawG;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context);
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
|
||||
|
||||
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);
|
||||
|
||||
@ -226,7 +228,6 @@ private:
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_g);
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
// draw-text-box-attlist
|
||||
class draw_text_box_attlist
|
||||
{
|
||||
public:
|
||||
@ -268,7 +269,6 @@ private:
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_text_box);
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
/// draw-object-attlist
|
||||
class draw_object_attlist
|
||||
{
|
||||
public:
|
||||
@ -280,7 +280,6 @@ public:
|
||||
|
||||
};
|
||||
|
||||
// draw:object
|
||||
class draw_object : public office_element_impl<draw_object>
|
||||
{
|
||||
public:
|
||||
@ -297,16 +296,17 @@ public:
|
||||
draw_object_attlist draw_object_attlist_;
|
||||
odf_types::common_xlink_attlist common_xlink_attlist_;
|
||||
|
||||
odf_document_ptr 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);
|
||||
|
||||
std::wstring office_convert(odf_document * odfDocument, int type);
|
||||
std::wstring office_convert(odf_document_ptr odfDocument, int type);
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_object);
|
||||
|
||||
// draw:object-ole
|
||||
class draw_object_ole : public office_element_impl<draw_object>
|
||||
{
|
||||
public:
|
||||
@ -332,7 +332,6 @@ private:
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_object_ole);
|
||||
|
||||
// draw:param
|
||||
class draw_param : public office_element_impl<draw_param>
|
||||
{
|
||||
public:
|
||||
@ -356,7 +355,6 @@ private:
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_param);
|
||||
|
||||
// draw:plugin
|
||||
class draw_plugin : public office_element_impl<draw_plugin>
|
||||
{
|
||||
public:
|
||||
|
||||
@ -754,7 +754,7 @@ int ComputeMarginY(const style_page_layout_properties_attlist & pageProperties,
|
||||
|
||||
}
|
||||
|
||||
void common_draw_docx_convert(oox::docx_conversion_context & Context, const union_common_draw_attlists & attlists_, oox::_docx_drawing *drawing)
|
||||
void common_draw_docx_convert(oox::docx_conversion_context & Context, union_common_draw_attlists & attlists_, oox::_docx_drawing *drawing)
|
||||
{
|
||||
const std::wstring styleName = attlists_.shape_with_text_and_styles_.
|
||||
common_shape_draw_attlist_.draw_style_name_.get_value_or(L"");
|
||||
@ -899,7 +899,16 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio
|
||||
}
|
||||
}
|
||||
///////////////////////////
|
||||
|
||||
if (attlists_.rel_size_.common_draw_size_attlist_.svg_width_)
|
||||
{
|
||||
double w_shape = attlists_.rel_size_.common_draw_size_attlist_.svg_width_->get_value_unit(length::pt);
|
||||
if (w_shape < 1) attlists_.rel_size_.common_draw_size_attlist_.svg_width_ = length(1, length::pt);
|
||||
}
|
||||
if (attlists_.rel_size_.common_draw_size_attlist_.svg_height_)
|
||||
{
|
||||
double h_shape = attlists_.rel_size_.common_draw_size_attlist_.svg_height_->get_value_unit(length::pt);
|
||||
if (h_shape < 1) attlists_.rel_size_.common_draw_size_attlist_.svg_height_ = length(1, length::pt);
|
||||
}
|
||||
drawing->x = get_value_emu(attlists_.position_.svg_x_);
|
||||
drawing->y = get_value_emu(attlists_.position_.svg_y_);
|
||||
|
||||
@ -1040,23 +1049,44 @@ void draw_shape::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
std::wostream & strm = Context.output_stream();
|
||||
|
||||
bool pState = Context.get_paragraph_state();
|
||||
Context.set_paragraph_state(false);
|
||||
bool runState = Context.get_run_state();
|
||||
bool paraState = Context.get_paragraph_state();
|
||||
bool keepState = Context.get_paragraph_keep();
|
||||
|
||||
//Context.set_run_state (false);
|
||||
Context.set_paragraph_state (false);
|
||||
|
||||
bool new_run = false;
|
||||
|
||||
bool new_run = true;
|
||||
|
||||
if ((pState == false && Context.get_drawing_context().get_current_level() == 1) || (Context.get_drawing_context().in_group()))
|
||||
if ((paraState == false && Context.get_drawing_context().get_current_level() == 1) || (Context.get_drawing_context().in_group()))
|
||||
{
|
||||
new_run = false;
|
||||
}
|
||||
else
|
||||
Context.add_new_run(_T(""));
|
||||
{
|
||||
if (!Context.get_drawing_context().in_group() && !runState)
|
||||
{
|
||||
if (!paraState)
|
||||
{
|
||||
Context.start_paragraph();
|
||||
}
|
||||
Context.add_new_run(L"");
|
||||
|
||||
new_run = true;
|
||||
}
|
||||
}
|
||||
|
||||
drawing.serialize(strm/*, Context.get_drawing_state_content()*/);
|
||||
|
||||
if (new_run) Context.finish_run();
|
||||
if (new_run)
|
||||
{
|
||||
Context.finish_run();
|
||||
if (!paraState)
|
||||
{
|
||||
Context.finish_paragraph();
|
||||
}
|
||||
}
|
||||
|
||||
Context.set_paragraph_state(pState);
|
||||
Context.set_paragraph_state(paraState);
|
||||
|
||||
Context.get_drawing_context().stop_shape();
|
||||
}
|
||||
@ -1067,7 +1097,7 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
|
||||
return;
|
||||
|
||||
std::wstring href = common_xlink_attlist_.href_.get_value_or(L"");
|
||||
int pos_replaicement= href.find(L"ObjectReplacements");
|
||||
int pos_replaicement = href.find(L"ObjectReplacements");
|
||||
|
||||
const draw_frame * frame = Context.get_drawing_context().get_current_frame();//owner
|
||||
if (!frame)
|
||||
@ -1076,9 +1106,12 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
|
||||
oox::_docx_drawing * drawing = dynamic_cast<oox::_docx_drawing *>(frame->oox_drawing_.get());
|
||||
if (!drawing) return;
|
||||
|
||||
if (pos_replaicement >= 0 && !Context.get_drawing_context().get_use_image_replace())
|
||||
if (pos_replaicement >= 0)
|
||||
{
|
||||
return; //skip replacement image (math, chart, ...) - возможно записать как альтернативный контент - todooo ???
|
||||
if (!Context.get_drawing_context().get_use_image_replace())
|
||||
return; //skip replacement image (math, chart, ...) - возможно записать как альтернативный контент - todooo ???
|
||||
if (href.length() - (pos_replaicement + 18) < 2)
|
||||
return; //href="./ObjectReplacements/"
|
||||
}
|
||||
|
||||
if (drawing->type == oox::typeUnknown)
|
||||
@ -1122,7 +1155,7 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
|
||||
drawing->fill.bitmap = oox::oox_bitmap_fill::create();
|
||||
drawing->fill.type = 2;
|
||||
drawing->fill.bitmap->isInternal = false;
|
||||
drawing->fill.bitmap->rId = Context.add_mediaitem(href, oox::typeImage, drawing->fill.bitmap->isInternal,href);
|
||||
drawing->fill.bitmap->rId = Context.add_mediaitem(href, oox::typeImage, drawing->fill.bitmap->isInternal, href);
|
||||
drawing->fill.bitmap->bStretch = true;
|
||||
|
||||
const std::wstring styleName = frame->common_draw_attlists_.shape_with_text_and_styles_.
|
||||
@ -1381,22 +1414,34 @@ void draw_frame::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
bool runState = Context.get_run_state();
|
||||
bool pState = Context.get_paragraph_state();
|
||||
bool paraState = Context.get_paragraph_state();
|
||||
bool keepState = Context.get_paragraph_keep();
|
||||
|
||||
Context.set_run_state (false);
|
||||
Context.set_paragraph_state (false);
|
||||
|
||||
if (!Context.get_drawing_context().in_group() && !runState)
|
||||
Context.add_new_run(_T(""));
|
||||
{
|
||||
if (!paraState)//0115GS3-KeyboardShortcuts.odt
|
||||
{
|
||||
Context.start_paragraph();
|
||||
}
|
||||
Context.add_new_run(L"");
|
||||
}
|
||||
|
||||
drawing->serialize(Context.output_stream()/*, Context.get_drawing_state_content()*/);
|
||||
|
||||
if (!Context.get_drawing_context().in_group() && !runState)
|
||||
{
|
||||
Context.finish_run();
|
||||
if (!paraState)//0115GS3-KeyboardShortcuts.odt
|
||||
{
|
||||
Context.finish_paragraph();
|
||||
}
|
||||
}
|
||||
|
||||
Context.set_run_state (runState);
|
||||
Context.set_paragraph_state (pState);
|
||||
Context.set_paragraph_state (paraState);
|
||||
Context.set_paragraph_keep (keepState);
|
||||
|
||||
Context.get_drawing_context().stop_frame();
|
||||
@ -1406,24 +1451,27 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
try
|
||||
{
|
||||
std::wstring href = common_xlink_attlist_.href_.get_value_or(L"");
|
||||
std::wstring href = common_xlink_attlist_.href_.get_value_or(L"");
|
||||
|
||||
std::wstring folderPath = Context.root()->get_folder();
|
||||
std::wstring objectPath = folderPath + FILE_SEPARATOR_STR + href;
|
||||
if (!odf_document_ && !href.empty())
|
||||
{
|
||||
std::wstring folderPath = Context.root()->get_folder();
|
||||
std::wstring objectPath = folderPath + FILE_SEPARATOR_STR + href;
|
||||
|
||||
//normalize path ??? todooo
|
||||
XmlUtils::replace_all( objectPath, FILE_SEPARATOR_STR + std::wstring(L"./"), FILE_SEPARATOR_STR);
|
||||
// normalize path ???? todooo
|
||||
XmlUtils::replace_all( objectPath, FILE_SEPARATOR_STR + std::wstring(L"./"), FILE_SEPARATOR_STR);
|
||||
|
||||
cpdoccore::odf_reader::odf_document objectSubDoc(objectPath ,NULL);
|
||||
odf_document_ = odf_document_ptr(new odf_document(objectPath, NULL));
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
draw_frame* frame = NULL;
|
||||
oox::_docx_drawing * drawing = NULL;
|
||||
office_element* contentSubDoc = objectSubDoc.get_impl()->get_content();
|
||||
office_element* contentSubDoc = odf_document_ ? odf_document_->get_impl()->get_content() : NULL;
|
||||
|
||||
object_odf_context objectBuild (href);
|
||||
if (contentSubDoc)
|
||||
{
|
||||
process_build_object process_build_object_(objectBuild, objectSubDoc.odf_context());
|
||||
process_build_object process_build_object_(objectBuild, odf_document_->odf_context());
|
||||
contentSubDoc->accept(process_build_object_);
|
||||
|
||||
objectBuild.docx_convert(Context);
|
||||
@ -1493,7 +1541,7 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
|
||||
bool & use_image_replace = Context.get_drawing_context().get_use_image_replace();
|
||||
use_image_replace = true;
|
||||
|
||||
std::wstring href_new = office_convert(&objectSubDoc, 2);
|
||||
std::wstring href_new = office_convert(odf_document_, 2);
|
||||
|
||||
if (!href_new.empty())
|
||||
{
|
||||
|
||||
@ -255,18 +255,22 @@ void draw_text_box::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
}
|
||||
void draw_object::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
try {
|
||||
std::wstring href = common_xlink_attlist_.href_.get_value_or(L"");
|
||||
try
|
||||
{
|
||||
std::wstring href = common_xlink_attlist_.href_.get_value_or(L"");
|
||||
|
||||
std::wstring folderPath = Context.root()->get_folder();
|
||||
std::wstring objectPath = folderPath + FILE_SEPARATOR_STR + href;
|
||||
if (!odf_document_ && !href.empty())
|
||||
{
|
||||
std::wstring folderPath = Context.root()->get_folder();
|
||||
std::wstring objectPath = folderPath + FILE_SEPARATOR_STR + href;
|
||||
|
||||
//normalize path ??? todooo
|
||||
XmlUtils::replace_all( objectPath, FILE_SEPARATOR_STR + std::wstring(L"./"), FILE_SEPARATOR_STR);
|
||||
// normalize path ???? todooo
|
||||
XmlUtils::replace_all( objectPath, FILE_SEPARATOR_STR + std::wstring(L"./"), FILE_SEPARATOR_STR);
|
||||
|
||||
cpdoccore::odf_reader::odf_document objectSubDoc(objectPath, NULL);
|
||||
odf_document_ = odf_document_ptr(new odf_document(objectPath, NULL));
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
office_element *contentSubDoc = objectSubDoc.get_impl()->get_content();
|
||||
office_element *contentSubDoc = odf_document_ ? odf_document_->get_impl()->get_content() : NULL;
|
||||
if (!contentSubDoc)
|
||||
{
|
||||
//здесь другой формат xml (не Open Office)
|
||||
@ -275,13 +279,13 @@ void draw_object::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
}
|
||||
object_odf_context objectBuild(href);
|
||||
|
||||
process_build_object process_build_object_(objectBuild, objectSubDoc.odf_context());
|
||||
contentSubDoc->accept(process_build_object_);
|
||||
process_build_object process_build_object_(objectBuild, odf_document_->odf_context() );
|
||||
contentSubDoc->accept(process_build_object_);
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
if (objectBuild.object_type_ == 1)//диаграмма
|
||||
{
|
||||
const std::wstring href_draw = common_xlink_attlist_.href_.get_value_or(L"");
|
||||
const std::wstring href_draw = common_xlink_attlist_.href_.get_value_or(L"Chart");
|
||||
objectBuild.pptx_convert(Context);
|
||||
|
||||
Context.get_slide_context().set_chart(href_draw); // в рисовательной части только место объекта, рамочки ... и релсы
|
||||
@ -290,7 +294,7 @@ void draw_object::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
Context.get_slide_context().set_use_image_replacement();
|
||||
|
||||
std::wstring href_new = office_convert( &objectSubDoc, 1);
|
||||
std::wstring href_new = office_convert( odf_document_, 1);
|
||||
|
||||
if (!href_new.empty())
|
||||
{
|
||||
@ -324,7 +328,7 @@ void draw_object::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
Context.get_slide_context().set_use_image_replacement();
|
||||
|
||||
std::wstring href_new = office_convert( &objectSubDoc, 2);
|
||||
std::wstring href_new = office_convert( odf_document_, 2);
|
||||
|
||||
if (!href_new.empty())
|
||||
{
|
||||
|
||||
@ -203,8 +203,19 @@ void draw_frame::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
|
||||
void draw_image::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
const std::wstring href = common_xlink_attlist_.href_.get_value_or(L"");
|
||||
Context.get_drawing_context().set_image(href);
|
||||
std::wstring href = common_xlink_attlist_.href_.get_value_or(L"");
|
||||
|
||||
if (href.empty() && office_binary_data_)
|
||||
{
|
||||
office_binary_data* binary_data = dynamic_cast<office_binary_data*>(office_binary_data_.get());
|
||||
|
||||
if (binary_data)
|
||||
{
|
||||
href = binary_data->write_to(Context.root()->get_folder());
|
||||
}
|
||||
}
|
||||
|
||||
Context.get_drawing_context().set_image(href);
|
||||
|
||||
////////////////////////////////////в принципе достаточно общая часть ...
|
||||
Context.get_text_context().start_drawing_content();//... если в объекте есть текст он привяжется к объекту - иначе к ячейке
|
||||
@ -246,34 +257,40 @@ void draw_text_box::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
|
||||
if (text_content_.length()>0)
|
||||
{
|
||||
Context.get_drawing_context().set_property(_property(L"text-content",text_content_));
|
||||
Context.get_drawing_context().set_property(_property(L"text-content", text_content_));
|
||||
}
|
||||
}
|
||||
void draw_object::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
try {
|
||||
std::wstring href = common_xlink_attlist_.href_.get_value_or(L"");
|
||||
try
|
||||
{
|
||||
std::wstring href = common_xlink_attlist_.href_.get_value_or(L"");
|
||||
|
||||
if (!odf_document_ && !href.empty())
|
||||
{
|
||||
std::wstring folderPath = Context.root()->get_folder();
|
||||
std::wstring objectPath = folderPath + FILE_SEPARATOR_STR + href;
|
||||
|
||||
std::wstring folderPath = Context.root()->get_folder();
|
||||
std::wstring objectPath = folderPath + FILE_SEPARATOR_STR + href;
|
||||
// normalize path ???? todooo
|
||||
XmlUtils::replace_all( objectPath, FILE_SEPARATOR_STR + std::wstring(L"./"), FILE_SEPARATOR_STR);
|
||||
|
||||
// normalize path ???? todooo
|
||||
XmlUtils::replace_all( objectPath, FILE_SEPARATOR_STR + std::wstring(L"./"), FILE_SEPARATOR_STR);
|
||||
|
||||
cpdoccore::odf_reader::odf_document objectSubDoc(objectPath,NULL);
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
office_element *contentSubDoc = objectSubDoc.get_impl()->get_content();
|
||||
odf_document_ = odf_document_ptr(new odf_document(objectPath, NULL));
|
||||
}
|
||||
office_element *contentSubDoc = odf_document_ ? odf_document_->get_impl()->get_content() : NULL;
|
||||
if (!contentSubDoc)
|
||||
{
|
||||
//здесь другой формат xml (не Open Office)
|
||||
//временно - замещающая картинка(если она конечно присутствует)
|
||||
return;
|
||||
}
|
||||
object_odf_context objectBuild(href);
|
||||
|
||||
if (contentSubDoc)
|
||||
{
|
||||
process_build_object process_build_object_(objectBuild, objectSubDoc.odf_context());
|
||||
contentSubDoc->accept(process_build_object_);
|
||||
}
|
||||
process_build_object process_build_object_(objectBuild, odf_document_->odf_context() );
|
||||
contentSubDoc->accept(process_build_object_);
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
if (objectBuild.object_type_ == 1) //диаграмма
|
||||
{
|
||||
const std::wstring href_draw = common_xlink_attlist_.href_.get_value_or(L"");
|
||||
const std::wstring href_draw = common_xlink_attlist_.href_.get_value_or(L"chart");
|
||||
objectBuild.xlsx_convert(Context);
|
||||
|
||||
Context.get_drawing_context().set_chart(href_draw); // в рисовательной части только место объекта, рамочки ... и релсы
|
||||
@ -282,7 +299,7 @@ void draw_object::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
Context.get_drawing_context().set_use_image_replacement();
|
||||
|
||||
std::wstring href_new = office_convert( &objectSubDoc, 1);
|
||||
std::wstring href_new = office_convert( odf_document_, 1);
|
||||
|
||||
if (!href_new.empty())
|
||||
{
|
||||
|
||||
@ -607,9 +607,8 @@ void draw_caption::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
void draw_connector_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"svg:d", svg_d_);
|
||||
CP_APPLY_ATTR(L"svg:viewBox", svg_viewbox_);
|
||||
CP_APPLY_ATTR(L"svg:viewBox", svg_viewbox_);
|
||||
CP_APPLY_ATTR(L"draw:type", draw_type_);
|
||||
|
||||
}
|
||||
// draw:connector
|
||||
const wchar_t * draw_connector::ns = L"draw";
|
||||
@ -669,5 +668,42 @@ void draw_connector::reset_svg_path()
|
||||
}
|
||||
///////////////////////////////////////
|
||||
|
||||
// dr3d:scene
|
||||
const wchar_t * dr3d_scene::ns = L"dr3d";
|
||||
const wchar_t * dr3d_scene::name = L"scene";
|
||||
|
||||
void dr3d_scene::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
draw_shape::add_attributes(Attributes);
|
||||
|
||||
sub_type_ = 10;
|
||||
|
||||
}
|
||||
// dr3d:extrude
|
||||
const wchar_t * dr3d_extrude::ns = L"dr3d";
|
||||
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_);
|
||||
}
|
||||
void dr3d_extrude::reset_svg_path()
|
||||
{
|
||||
if (!svg_d_) return;
|
||||
|
||||
}
|
||||
// dr3d:light
|
||||
const wchar_t * dr3d_light::ns = L"dr3d";
|
||||
const wchar_t * dr3d_light::name = L"light";
|
||||
|
||||
void dr3d_light::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"dr3d:diffuse_color", dr3d_diffuse_color_);
|
||||
CP_APPLY_ATTR(L"dr3d:direction", dr3d_direction_);
|
||||
CP_APPLY_ATTR(L"dr3d:specular", dr3d_specular_);
|
||||
CP_APPLY_ATTR(L"dr3d:enabled", dr3d_enabled_);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -543,8 +543,8 @@ public:
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context);
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context);
|
||||
|
||||
draw_connector_attlist draw_connector_attlist_;
|
||||
draw_line_attlist draw_line_attlist_;
|
||||
draw_connector_attlist draw_connector_attlist_;
|
||||
draw_line_attlist draw_line_attlist_;
|
||||
|
||||
void reset_svg_path();
|
||||
void reset_svg_attributes();
|
||||
@ -552,5 +552,75 @@ public:
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_connector);
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class dr3d_scene : public draw_shape
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
|
||||
static const ElementType type = typeDr3dScene;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
|
||||
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_scene);
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class dr3d_extrude : public office_element_impl<dr3d_extrude>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
|
||||
static const ElementType type = typeDr3dExtrude;
|
||||
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_OPT(std::wstring) svg_d_;
|
||||
_CP_OPT(std::wstring) svg_viewbox_;
|
||||
|
||||
void reset_svg_path();
|
||||
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(dr3d_extrude);
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class dr3d_light : public office_element_impl<dr3d_light>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
|
||||
static const ElementType type = typeDr3dLight;
|
||||
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_OPT(std::wstring) dr3d_diffuse_color_;
|
||||
_CP_OPT(std::wstring) dr3d_direction_;
|
||||
_CP_OPT(std::wstring) dr3d_specular_;
|
||||
_CP_OPT(odf_types::Bool)dr3d_enabled_;
|
||||
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(dr3d_light);
|
||||
|
||||
}
|
||||
}
|
||||
@ -298,6 +298,8 @@ void draw_enhanced_geometry::docx_convert(oox::docx_conversion_context & Context
|
||||
shape->additional_.push_back(odf_reader::_property(L"custom_path", output_.str()));
|
||||
|
||||
set_shape = true;
|
||||
int w = 0;
|
||||
int h = 0;
|
||||
|
||||
if (draw_enhanced_geometry_attlist_.drawooo_sub_view_size_)
|
||||
{
|
||||
@ -306,8 +308,8 @@ void draw_enhanced_geometry::docx_convert(oox::docx_conversion_context & Context
|
||||
|
||||
if (splitted.size() == 2)
|
||||
{
|
||||
int w = boost::lexical_cast<int>(splitted[0]);
|
||||
int h = boost::lexical_cast<int>(splitted[1]);
|
||||
w = boost::lexical_cast<int>(splitted[0]);
|
||||
h = boost::lexical_cast<int>(splitted[1]);
|
||||
|
||||
shape->additional_.push_back(odf_reader::_property(L"custom_path_w", w));
|
||||
shape->additional_.push_back(odf_reader::_property(L"custom_path_h", h));
|
||||
@ -320,6 +322,17 @@ void draw_enhanced_geometry::docx_convert(oox::docx_conversion_context & Context
|
||||
int b = boost::lexical_cast<int>(splitted[3]);
|
||||
|
||||
}
|
||||
|
||||
//if (shape->common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_width_)
|
||||
//{
|
||||
// int w_shape = shape->common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_width_->get_value();
|
||||
// if (w_shape < 1) shape->common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_width_ = length(1, length::pt);
|
||||
//}
|
||||
//if (shape->common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_height_)
|
||||
//{
|
||||
// int h_shape = shape->common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_height_->get_value();
|
||||
// if (h_shape < 1) shape->common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_height_ = length(1, length::pt);
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -338,5 +351,28 @@ void draw_enhanced_geometry::docx_convert(oox::docx_conversion_context & Context
|
||||
shape->bad_shape_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
void dr3d_scene::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
//if (Context.get_drawing_context().get_current_level() >0 )return;
|
||||
if (Context.get_drawing_context().get_current_level() > 0 && !Context.get_drawing_context().in_group() )
|
||||
{
|
||||
if(Context.delayed_converting_ == false)
|
||||
Context.add_delayed_element(this);
|
||||
return;
|
||||
}
|
||||
common_docx_convert(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)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -401,6 +401,24 @@ void draw_enhanced_geometry::pptx_convert(oox::pptx_conversion_context & Context
|
||||
{
|
||||
Context.get_slide_context().start_shape(1); //restart type shape
|
||||
}
|
||||
}
|
||||
void dr3d_scene::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
Context.get_slide_context().start_shape(sub_type_);
|
||||
|
||||
common_pptx_convert(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)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -334,6 +334,26 @@ void draw_enhanced_geometry::xlsx_convert(oox::xlsx_conversion_context & Context
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
void dr3d_scene::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
//const std::wstring style = common_shape_draw_attlist_.draw_text_style_name_.get_value_or(L"");
|
||||
|
||||
Context.get_drawing_context().start_shape(1);//rect с наваротами-атрибутами .. а-ля TextBox
|
||||
|
||||
common_xlsx_convert(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)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -41,9 +41,22 @@
|
||||
namespace cpdoccore {
|
||||
namespace odf_reader {
|
||||
|
||||
const wchar_t * svg_desc::ns = L"svg";
|
||||
const wchar_t * svg_desc::name = L"desc";
|
||||
|
||||
std::wostream & svg_desc::text_to_stream(std::wostream & _Wostream) const
|
||||
{
|
||||
_Wostream << text_ ;
|
||||
return _Wostream;
|
||||
}
|
||||
|
||||
void svg_desc::add_text(const std::wstring & Text)
|
||||
{
|
||||
text_ = Text;
|
||||
}
|
||||
|
||||
// svg:font-face-uri
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//---------------------------------------------------------------------------------------
|
||||
const wchar_t * svg_font_face_uri::ns = L"svg";
|
||||
const wchar_t * svg_font_face_uri::name = L"font-face-uri";
|
||||
|
||||
|
||||
@ -58,7 +58,6 @@ public:
|
||||
|
||||
odf_types::common_xlink_attlist common_xlink_attlist_;
|
||||
};
|
||||
|
||||
// svg:font-face-uri
|
||||
class svg_font_face_uri : public office_element_impl<svg_font_face_uri>
|
||||
{
|
||||
@ -80,7 +79,31 @@ private:
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(svg_font_face_uri);
|
||||
|
||||
// svg:desc
|
||||
class svg_desc : public office_element_impl<svg_desc>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeSvgDesc;
|
||||
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
|
||||
|
||||
std::wstring text_;
|
||||
|
||||
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){}
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(svg_desc);
|
||||
|
||||
// svg:font-face-format
|
||||
class svg_font_face_format : public office_element_impl<svg_font_face_format>
|
||||
{
|
||||
public:
|
||||
@ -100,7 +123,6 @@ private:
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(svg_font_face_format);
|
||||
|
||||
// svg:font-face-name
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
#include "math_layout_elements.h"
|
||||
#include "math_token_elements.h"
|
||||
#include "style_text_properties.h"
|
||||
#include "math_limit_elements.h"
|
||||
|
||||
#include <cpdoccore/xml/xmlchar.h>
|
||||
#include <cpdoccore/xml/attributes.h>
|
||||
@ -120,7 +121,7 @@ void math_mrow::oox_convert(oox::math_context & Context)
|
||||
for (int i = i_start; i < i_end ; i++)
|
||||
{
|
||||
office_math_element* math_element = dynamic_cast<office_math_element*>(content_[i].get());
|
||||
math_element->oox_convert(Context);
|
||||
math_element->oox_convert(Context);
|
||||
}
|
||||
|
||||
if (bDPr)
|
||||
@ -297,8 +298,21 @@ void math_mstyle::oox_convert(oox::math_context & Context)
|
||||
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
math_munder* munder_test = dynamic_cast<math_munder*>(content_[i].get());
|
||||
math_mfrac* frac_test = dynamic_cast<math_mfrac*>(content_[i].get());
|
||||
math_mrow* row_test = dynamic_cast<math_mrow*>(content_[i].get());
|
||||
|
||||
if (row_test || munder_test || frac_test)
|
||||
Context.output_stream() << L"<m:e>";
|
||||
|
||||
office_math_element* math_element = dynamic_cast<office_math_element*>(content_[i].get());
|
||||
math_element->oox_convert(Context);
|
||||
math_element->oox_convert(Context);
|
||||
|
||||
if (row_test || munder_test || frac_test)
|
||||
Context.output_stream() << L"</m:e>";
|
||||
|
||||
//office_math_element* math_element = dynamic_cast<office_math_element*>(content_[i].get());
|
||||
//math_element->oox_convert(Context);
|
||||
}
|
||||
//reset to default math text props
|
||||
Context.text_properties_ = odf_reader::style_text_properties_ptr(new odf_reader::style_text_properties());
|
||||
|
||||
@ -31,6 +31,8 @@
|
||||
*/
|
||||
|
||||
#include "math_table_elements.h"
|
||||
#include "math_layout_elements.h"
|
||||
#include "math_limit_elements.h"
|
||||
|
||||
#include <cpdoccore/xml/xmlchar.h>
|
||||
#include <cpdoccore/xml/attributes.h>
|
||||
@ -92,10 +94,19 @@ void math_mtr::oox_convert(oox::math_context & Context)
|
||||
strm << L"<m:mr>";
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
//strm << L"<m:e>"; // EqArray записался в числитель вместо знаменателя.docx - дублирование
|
||||
math_mrow* row_test = dynamic_cast<math_mrow*>(content_[i].get());
|
||||
math_munder* munder_test = dynamic_cast<math_munder*>(content_[i].get());
|
||||
math_mfrac* frac_test = dynamic_cast<math_mfrac*>(content_[i].get());
|
||||
|
||||
if (row_test || munder_test || frac_test)
|
||||
Context.output_stream() << L"<m:e>";// EqArray записался в числитель вместо знаменателя.docx - дублирование
|
||||
|
||||
|
||||
office_math_element* math_element = dynamic_cast<office_math_element*>(content_[i].get());
|
||||
math_element->oox_convert(Context);
|
||||
//strm << L"</m:e>";
|
||||
|
||||
if (row_test || munder_test || frac_test)
|
||||
strm << L"</m:e>";
|
||||
}
|
||||
strm << L"</m:mr>";
|
||||
}
|
||||
|
||||
@ -283,7 +283,12 @@ void math_mtext::add_text(const std::wstring & Text)
|
||||
|
||||
void math_mtext::oox_convert(oox::math_context & Context)
|
||||
{
|
||||
|
||||
if (text_)
|
||||
{
|
||||
Context.output_stream() << L"<m:r><m:rPr><m:nor/></m:rPr><m:t>";
|
||||
Context.output_stream() << *text_;
|
||||
Context.output_stream() << L"</m:t></m:r>";
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
const wchar_t * math_mglyph::ns = L"math";
|
||||
|
||||
@ -64,7 +64,11 @@ void content_xml_t::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
|
||||
void content_xml_t::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
if CP_CHECK_NAME(L"office", L"document-content")
|
||||
if CP_CHECK_NAME(L"office", L"document")
|
||||
{
|
||||
create_element_and_read(Reader, Ns, Name, xml_content_, getContext(), true);
|
||||
}
|
||||
else if CP_CHECK_NAME(L"office", L"document-content")
|
||||
{
|
||||
create_element_and_read(Reader, Ns, Name, xml_content_, getContext(), true);
|
||||
}
|
||||
@ -84,6 +88,10 @@ void content_xml_t::add_child_element( xml::sax * Reader, const std::wstring & N
|
||||
{
|
||||
create_element_and_read(Reader, Ns, Name, xml_content_, getContext(), true);
|
||||
}
|
||||
else if CP_CHECK_NAME(L"manifest", L"manifest")
|
||||
{
|
||||
create_element_and_read(Reader, Ns, Name, xml_content_, getContext(), true);
|
||||
}
|
||||
}
|
||||
|
||||
void content_xml_t::add_text(const std::wstring & Text)
|
||||
|
||||
@ -38,7 +38,9 @@
|
||||
namespace cpdoccore {
|
||||
namespace odf_reader {
|
||||
|
||||
odf_document::odf_document(const std::wstring & Folder, const ProgressCallback* CallBack) : impl_(new Impl(Folder,CallBack))
|
||||
odf_document::odf_document(const std::wstring & Folder, const ProgressCallback* CallBack) : impl_(new Impl(Folder, CallBack))
|
||||
{}
|
||||
odf_document::odf_document( xml::sax * Reader) : impl_(new Impl(Reader))
|
||||
{}
|
||||
|
||||
odf_document::~odf_document()
|
||||
|
||||
@ -106,47 +106,122 @@ content_xml_t_ptr read_file_content(const std::wstring & Path)
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
content_xml_t_ptr read_file_content(xml::sax * reader_owner)
|
||||
{
|
||||
if (!reader_owner) return content_xml_t_ptr();
|
||||
|
||||
odf_document::Impl::Impl(const std::wstring & folderPath, const ProgressCallback* CallBack) :
|
||||
context_(new odf_read_context()), base_folder_(folderPath), pCallBack(CallBack), bUserStopConvert (0)
|
||||
content_xml_t_ptr result( new content_xml_t() );
|
||||
|
||||
const std::wstring namespacePrefix = reader_owner->namespacePrefix();
|
||||
const std::wstring localName = reader_owner->nodeLocalName();
|
||||
|
||||
result->add_child_element(reader_owner, namespacePrefix, localName);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
odf_document::Impl::Impl(xml::sax * Reader):
|
||||
context_(new odf_read_context()), base_folder_(L""), pCallBack(NULL), bUserStopConvert (0)
|
||||
{
|
||||
office_mime_type_ = 0;
|
||||
encrypted = false;
|
||||
|
||||
std::wstring content_xml = folderPath + FILE_SEPARATOR_STR + L"content.xml";
|
||||
std::wstring styles_xml = folderPath + FILE_SEPARATOR_STR + L"styles.xml";
|
||||
std::wstring meta_xml = folderPath + FILE_SEPARATOR_STR + L"meta.xml";
|
||||
std::wstring settings_xml = folderPath + FILE_SEPARATOR_STR + L"settings.xml";
|
||||
std::wstring manifest_xml = folderPath + FILE_SEPARATOR_STR + L"META-INF" + FILE_SEPARATOR_STR + L"manifest.xml";
|
||||
content_xml_ = read_file_content(Reader);
|
||||
|
||||
if (content_xml_)
|
||||
{
|
||||
_CP_LOG << L"[info] parse fonts" << std::endl;
|
||||
parse_fonts(content_xml_->get_content());
|
||||
|
||||
_CP_LOG << L"[info] parse styles" << std::endl;
|
||||
parse_styles(content_xml_->get_content());
|
||||
|
||||
_CP_LOG << L"[info] read manifest.xml" << std::endl;
|
||||
manifest_xml_ = read_file_content(manifest_xml);
|
||||
_CP_LOG << L"[info] parse manifest" << std::endl;
|
||||
parse_manifests(content_xml_->get_content());
|
||||
|
||||
_CP_LOG << L"[info] read settings.xml" << std::endl;
|
||||
settings_xml_ = read_file_content(settings_xml);
|
||||
_CP_LOG << L"[info] parse settings" << std::endl;
|
||||
parse_settings(content_xml_->get_content());
|
||||
|
||||
tmp_folder_ = NSDirectory::CreateDirectoryWithUniqueName(NSDirectory::GetTempPath());
|
||||
}
|
||||
}
|
||||
|
||||
_CP_LOG << L"[info] read content.xml" << std::endl;
|
||||
content_xml_ = read_file_content(content_xml);
|
||||
odf_document::Impl::Impl(const std::wstring & srcPath, const ProgressCallback* CallBack) :
|
||||
context_(new odf_read_context()), pCallBack(CallBack), bUserStopConvert (0)
|
||||
{
|
||||
office_mime_type_ = 0;
|
||||
encrypted = false;
|
||||
|
||||
_CP_LOG << L"[info] read styles.xml" << std::endl;
|
||||
styles_xml_ = read_file_content(styles_xml);
|
||||
if (NSDirectory::Exists(srcPath))
|
||||
{
|
||||
base_folder_ = srcPath;
|
||||
|
||||
_CP_LOG << L"[info] parse fonts" << std::endl;
|
||||
parse_fonts();
|
||||
std::wstring content_xml = srcPath + FILE_SEPARATOR_STR + L"content.xml";
|
||||
std::wstring styles_xml = srcPath + FILE_SEPARATOR_STR + L"styles.xml";
|
||||
std::wstring meta_xml = srcPath + FILE_SEPARATOR_STR + L"meta.xml";
|
||||
std::wstring settings_xml = srcPath + FILE_SEPARATOR_STR + L"settings.xml";
|
||||
std::wstring manifest_xml = srcPath + FILE_SEPARATOR_STR + L"META-INF" + FILE_SEPARATOR_STR + L"manifest.xml";
|
||||
|
||||
_CP_LOG << L"[info] parse styles" << std::endl;
|
||||
parse_styles();
|
||||
_CP_LOG << L"[info] read manifest.xml" << std::endl;
|
||||
manifest_xml_ = read_file_content(manifest_xml);
|
||||
|
||||
_CP_LOG << L"[info] parse manifest" << std::endl;
|
||||
parse_manifests();
|
||||
_CP_LOG << L"[info] read settings.xml" << std::endl;
|
||||
settings_xml_ = read_file_content(settings_xml);
|
||||
|
||||
_CP_LOG << L"[info] parse settings" << std::endl;
|
||||
parse_settings();
|
||||
_CP_LOG << L"[info] read content.xml" << std::endl;
|
||||
content_xml_ = read_file_content(content_xml);
|
||||
|
||||
_CP_LOG << L"[info] read styles.xml" << std::endl;
|
||||
styles_xml_ = read_file_content(styles_xml);
|
||||
//----------------------------------------------------------------------------------------
|
||||
_CP_LOG << L"[info] parse fonts" << std::endl;
|
||||
parse_fonts(content_xml_ ? content_xml_->get_content() : NULL);
|
||||
|
||||
_CP_LOG << L"[info] parse styles" << std::endl;
|
||||
parse_styles(styles_xml_ ? styles_xml_->get_content() : NULL);
|
||||
|
||||
_CP_LOG << L"[info] parse manifest" << std::endl;
|
||||
parse_manifests(manifest_xml_ ? manifest_xml_->get_content() : NULL);
|
||||
|
||||
_CP_LOG << L"[info] parse settings" << std::endl;
|
||||
parse_settings(settings_xml_ ? settings_xml_->get_content() : NULL);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
_CP_LOG << L"[info] read flat document" << std::endl;
|
||||
content_xml_ = read_file_content(srcPath);
|
||||
|
||||
if (content_xml_)
|
||||
{
|
||||
_CP_LOG << L"[info] parse fonts" << std::endl;
|
||||
parse_fonts(content_xml_->get_content());
|
||||
|
||||
_CP_LOG << L"[info] parse styles" << std::endl;
|
||||
parse_styles(content_xml_->get_content());
|
||||
|
||||
_CP_LOG << L"[info] parse manifest" << std::endl;
|
||||
parse_manifests(content_xml_->get_content());
|
||||
|
||||
_CP_LOG << L"[info] parse settings" << std::endl;
|
||||
parse_settings(content_xml_->get_content());
|
||||
|
||||
tmp_folder_ = NSDirectory::CreateDirectoryWithUniqueName(NSDirectory::GetTempPath());
|
||||
}
|
||||
}
|
||||
|
||||
UpdateProgress(400000);
|
||||
}
|
||||
|
||||
odf_document::Impl::~Impl()
|
||||
{
|
||||
if (!tmp_folder_.empty())
|
||||
NSDirectory::DeleteDirectory(tmp_folder_);
|
||||
}
|
||||
const std::wstring & odf_document::Impl::get_folder() const
|
||||
{
|
||||
if (!base_folder_.empty()) return base_folder_;
|
||||
else return tmp_folder_;
|
||||
}
|
||||
bool odf_document::Impl::UpdateProgress(long nComplete)
|
||||
{
|
||||
if (pCallBack)
|
||||
@ -162,17 +237,11 @@ bool odf_document::Impl::UpdateProgress(long nComplete)
|
||||
return false;
|
||||
}
|
||||
|
||||
void odf_document::Impl::parse_fonts()
|
||||
void odf_document::Impl::parse_fonts(office_element *element)
|
||||
{
|
||||
do
|
||||
{
|
||||
if (!content_xml_)
|
||||
{
|
||||
_CP_LOG << L"[warning] empty content xml\n";
|
||||
break;
|
||||
}
|
||||
|
||||
office_document_base * document = dynamic_cast<office_document_base *>( content_xml_->get_content() );
|
||||
office_document_base * document = dynamic_cast<office_document_base *>( element );
|
||||
if (!document)
|
||||
{
|
||||
_CP_LOG << L"[warning] empty document\n";
|
||||
@ -236,15 +305,12 @@ void odf_document::Impl::parse_fonts()
|
||||
}
|
||||
while (0);
|
||||
}
|
||||
void odf_document::Impl::parse_manifests()
|
||||
void odf_document::Impl::parse_manifests(office_element *element)
|
||||
{
|
||||
if (!manifest_xml_)return;
|
||||
|
||||
office_document_base * document = dynamic_cast<office_document_base *>( manifest_xml_->get_content() );
|
||||
office_document_base * document = dynamic_cast<office_document_base *>( element );
|
||||
|
||||
if (!document)return;
|
||||
|
||||
int res =-1;
|
||||
for (size_t i = 0; i < document->manifests_.size(); i++)
|
||||
{
|
||||
office_element_ptr & elm = document->manifests_[i];
|
||||
@ -252,34 +318,44 @@ void odf_document::Impl::parse_manifests()
|
||||
manifest_entry * entry = dynamic_cast<manifest_entry *>(elm.get());
|
||||
if (!entry)continue;
|
||||
|
||||
if (entry->full_path_==L"content.xml" && entry->encryption_) encrypted = true;
|
||||
if (entry->full_path_ == L"content.xml" && entry->encryption_) encrypted = true;
|
||||
|
||||
if (entry->full_path_==L"/")
|
||||
if (entry->full_path_ == L"/")
|
||||
{
|
||||
res = entry->media_type_.find(L"application/vnd.oasis.opendocument.text");
|
||||
if (res>=0)
|
||||
if (std::wstring::npos != entry->media_type_.find(L"application/vnd.oasis.opendocument.text"))
|
||||
{
|
||||
office_mime_type_ = 1;
|
||||
}
|
||||
res = entry->media_type_.find(L"application/vnd.oasis.opendocument.spreadsheet");
|
||||
if (res>=0)
|
||||
else if (std::wstring::npos != entry->media_type_.find(L"application/vnd.oasis.opendocument.spreadsheet"))
|
||||
{
|
||||
office_mime_type_ = 2;
|
||||
}
|
||||
res = entry->media_type_.find(L"application/vnd.oasis.opendocument.presentation");
|
||||
if (res>=0)
|
||||
else if (std::wstring::npos != entry->media_type_.find(L"application/vnd.oasis.opendocument.presentation"))
|
||||
{
|
||||
office_mime_type_ = 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!office_mime_type_ && !document->office_mimetype_.empty())
|
||||
{
|
||||
if (std::wstring::npos != document->office_mimetype_.find(L"application/vnd.oasis.opendocument.text"))
|
||||
{
|
||||
office_mime_type_ = 1;
|
||||
}
|
||||
else if (std::wstring::npos != document->office_mimetype_.find(L"application/vnd.oasis.opendocument.spreadsheet"))
|
||||
{
|
||||
office_mime_type_ = 2;
|
||||
}
|
||||
else if (std::wstring::npos != document->office_mimetype_.find(L"application/vnd.oasis.opendocument.presentation"))
|
||||
{
|
||||
office_mime_type_ = 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void odf_document::Impl::parse_settings()
|
||||
void odf_document::Impl::parse_settings(office_element *element)
|
||||
{
|
||||
if (!settings_xml_)return;
|
||||
|
||||
office_document_base * document = dynamic_cast<office_document_base *>( settings_xml_->get_content() );
|
||||
office_document_base * document = dynamic_cast<office_document_base *>( element );
|
||||
if (!document) return;
|
||||
|
||||
office_settings * settings = dynamic_cast<office_settings*>(document->office_settings_.get());
|
||||
@ -358,20 +434,14 @@ void odf_document::Impl::parse_settings()
|
||||
}
|
||||
}
|
||||
|
||||
void odf_document::Impl::parse_styles()
|
||||
void odf_document::Impl::parse_styles(office_element *element)
|
||||
{
|
||||
do
|
||||
{
|
||||
if (!styles_xml_)
|
||||
{
|
||||
_CP_LOG << L"[warning] empty styles xml\n";
|
||||
break;
|
||||
}
|
||||
|
||||
office_document_base * document = dynamic_cast<office_document_base *>( styles_xml_->get_content() );
|
||||
office_document_base * document = dynamic_cast<office_document_base *>( element );
|
||||
if (!document)
|
||||
{
|
||||
_CP_LOG << L"[warning] empty document\n";
|
||||
_CP_LOG << L"[warning] empty styles\n";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -54,16 +54,19 @@ class odf_document::Impl
|
||||
{
|
||||
public:
|
||||
Impl(const std::wstring & Folder, const ProgressCallback* CallBack);
|
||||
Impl(xml::sax * Reader);
|
||||
virtual ~Impl();
|
||||
|
||||
odf_read_context & odf_context();
|
||||
|
||||
bool docx_convert(oox::docx_conversion_context & Context);
|
||||
bool xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
bool pptx_convert(oox::pptx_conversion_context & Context);
|
||||
|
||||
const std::wstring & get_folder() const { return base_folder_; }
|
||||
const std::wstring & get_folder() const;
|
||||
|
||||
const office_element * get_content() const;
|
||||
office_element * get_content();
|
||||
const office_element * get_content() const;
|
||||
office_element * get_content();
|
||||
|
||||
long get_office_mime_type() {return office_mime_type_;}
|
||||
|
||||
@ -77,20 +80,20 @@ private:
|
||||
|
||||
odf_read_context_ptr context_;
|
||||
|
||||
void parse_styles();
|
||||
void parse_fonts();
|
||||
void parse_manifests();
|
||||
void parse_settings();
|
||||
void parse_styles (office_element *element);
|
||||
void parse_fonts (office_element *elemen);
|
||||
void parse_manifests(office_element *element);
|
||||
void parse_settings (office_element *element);
|
||||
|
||||
private:
|
||||
content_xml_t_ptr content_xml_;
|
||||
content_xml_t_ptr styles_xml_;
|
||||
content_xml_t_ptr meta_xml_;
|
||||
content_xml_t_ptr settings_xml_;
|
||||
content_xml_t_ptr manifest_xml_;
|
||||
|
||||
private:
|
||||
std::wstring base_folder_;
|
||||
std::wstring tmp_folder_;
|
||||
|
||||
long office_mime_type_;
|
||||
bool encrypted;
|
||||
|
||||
|
||||
@ -331,7 +331,7 @@ void page_layout_instance::xlsx_serialize(std::wostream & strm, oox::xlsx_conver
|
||||
props->xlsx_serialize(strm, Context);
|
||||
}
|
||||
|
||||
void page_layout_instance::docx_convert_serialize(std::wostream & strm, oox::docx_conversion_context & Context)
|
||||
void page_layout_instance::docx_serialize(std::wostream & strm, oox::docx_conversion_context & Context)
|
||||
{
|
||||
const style_header_style * headerStyle = dynamic_cast<style_header_style *>(style_page_layout_->style_header_style_.get());
|
||||
const style_footer_style * footerStyle = dynamic_cast<style_footer_style *>(style_page_layout_->style_footer_style_.get());
|
||||
@ -357,7 +357,7 @@ void page_layout_instance::docx_convert_serialize(std::wostream & strm, oox::doc
|
||||
|
||||
style_page_layout_properties * props = properties();
|
||||
if (props)
|
||||
props->docx_convert_serialize(strm, Context);
|
||||
props->docx_serialize(strm, Context);
|
||||
}
|
||||
void page_layout_instance::pptx_serialize(std::wostream & strm, oox::pptx_conversion_context & Context)
|
||||
{
|
||||
|
||||
@ -193,9 +193,9 @@ public:
|
||||
const std::wstring & name() const;
|
||||
style_page_layout_properties * properties() const;
|
||||
|
||||
void docx_convert_serialize (std::wostream & strm, oox::docx_conversion_context & Context);
|
||||
void xlsx_serialize (std::wostream & strm, oox::xlsx_conversion_context & Context);
|
||||
void pptx_serialize (std::wostream & strm, oox::pptx_conversion_context & Context);
|
||||
void docx_serialize (std::wostream & strm, oox::docx_conversion_context & Context);
|
||||
void pptx_serialize (std::wostream & strm, oox::pptx_conversion_context & Context);
|
||||
void xlsx_serialize (std::wostream & strm, oox::xlsx_conversion_context & Context);
|
||||
|
||||
const style_page_layout * style_page_layout_;
|
||||
|
||||
|
||||
@ -40,9 +40,10 @@
|
||||
#include "serialize_elements.h"
|
||||
|
||||
#include <cpdoccore/odf/odf_document.h>
|
||||
#include "../odf/odfcontext.h"
|
||||
#include "odfcontext.h"
|
||||
|
||||
#include "../odf/calcs_styles.h"
|
||||
#include "calcs_styles.h"
|
||||
#include "../docx/xlsx_utils.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
|
||||
@ -215,8 +216,12 @@ void office_annotation::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
|
||||
const std::wstring textStyleName = office_annotation_attr_.draw_text_style_name_.get_value_or(L"");
|
||||
|
||||
std::wstring ref = Context.current_cell_address();
|
||||
Context.get_comments_context().end_comment(ref,Context.current_table_column(), Context.current_table_row());
|
||||
int col = Context.current_table_column(); if (col < 0) col = 0;
|
||||
int row = Context.current_table_row(); if (row < 0) row = 0;
|
||||
|
||||
std::wstring ref = oox::getCellAddress(col, row);
|
||||
|
||||
Context.get_comments_context().end_comment(ref, col, row);
|
||||
}
|
||||
// officeooo:annotation
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -61,7 +61,34 @@ void office_binary_data::add_child_element( xml::sax * Reader, const std::wstrin
|
||||
|
||||
void office_binary_data::add_text(const std::wstring & Text)
|
||||
{
|
||||
base64Binary_ = Text;
|
||||
base64Binary_ = std::string(Text.begin(), Text.end());
|
||||
}
|
||||
|
||||
std::wstring office_binary_data::write_to(const std::wstring & path)
|
||||
{
|
||||
std::wstring result;
|
||||
|
||||
NSFile::CBase64Converter base64;
|
||||
int nLength = 0;
|
||||
unsigned char *pData = NULL;
|
||||
|
||||
NSFile::CBase64Converter::Decode(base64Binary_.c_str(), base64Binary_.length(), pData, nLength);
|
||||
if (pData)
|
||||
{
|
||||
NSFile::CFileBinary file;
|
||||
|
||||
std::wstring bin_file = file.CreateTempFileWithUniqueName(path + FILE_SEPARATOR_STR, L"bin");
|
||||
if (file.CreateFileW(bin_file))
|
||||
{
|
||||
file.WriteFile(pData, nLength);
|
||||
file.CloseFile();
|
||||
|
||||
int pos = bin_file.rfind(FILE_SEPARATOR_STR);
|
||||
result = bin_file.substr(pos + 1);
|
||||
}
|
||||
delete []pData; pData = NULL;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -53,17 +53,15 @@ public:
|
||||
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
public:
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
|
||||
|
||||
std::wstring write_to(const std::wstring & path);
|
||||
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);
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
|
||||
private:
|
||||
std::wstring base64Binary_;
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
|
||||
std::string base64Binary_;
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(office_binary_data);
|
||||
|
||||
@ -152,7 +152,7 @@ void office_body::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
if (page_layout_instance * lastPageLayout = Context.root()->odf_context().pageLayoutContainer().page_layout_by_name(Context.get_page_properties()))
|
||||
{
|
||||
lastPageLayout->docx_convert_serialize(Context.output_stream(), Context);
|
||||
lastPageLayout->docx_serialize(Context.output_stream(), Context);
|
||||
//Context.remove_page_properties();
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,9 +63,10 @@ void chart_chart_attlist::add_attributes( const xml::attributes_wc_ptr & Attribu
|
||||
common_draw_size_attlist_.add_attributes(Attributes);
|
||||
common_attlist_.add_attributes(Attributes);
|
||||
|
||||
CP_APPLY_ATTR(L"chart:class", chart_class_, std::wstring(L""));
|
||||
CP_APPLY_ATTR(L"chart:column-mapping", chart_column_mapping_);
|
||||
CP_APPLY_ATTR(L"chart:row-mapping", chart_row_mapping_);
|
||||
CP_APPLY_ATTR(L"chart:class", chart_class_, std::wstring(L""));
|
||||
CP_APPLY_ATTR(L"chart:column-mapping", chart_column_mapping_);
|
||||
CP_APPLY_ATTR(L"chart:row-mapping", chart_row_mapping_);
|
||||
CP_APPLY_ATTR(L"loext:data-pilot-source", loext_data_pilot_source_);
|
||||
}
|
||||
|
||||
// chart:chart
|
||||
@ -75,7 +76,7 @@ const wchar_t * chart_chart::name = L"chart";
|
||||
|
||||
void chart_chart::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
chart_chart_attlist_.add_attributes(Attributes);
|
||||
attlist_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
void chart_chart::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
@ -97,7 +98,7 @@ const wchar_t * chart_title::name = L"title";
|
||||
|
||||
void chart_title::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
chart_title_attlist_.add_attributes(Attributes);
|
||||
attlist_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
void chart_title::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
@ -117,7 +118,7 @@ const wchar_t * chart_subtitle::name = L"subtitle";
|
||||
|
||||
void chart_subtitle::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
chart_title_attlist_.add_attributes(Attributes);
|
||||
attlist_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
void chart_subtitle::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
@ -157,7 +158,7 @@ const wchar_t * chart_legend::name = L"legend";
|
||||
|
||||
void chart_legend::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
chart_legend_attlist_.add_attributes(Attributes);
|
||||
attlist_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
void chart_legend::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
@ -194,7 +195,7 @@ const wchar_t * chart_plot_area::name = L"plot-area";
|
||||
|
||||
void chart_plot_area::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
chart_plot_area_attlist_.add_attributes(Attributes);
|
||||
attlist_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
void chart_plot_area::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
@ -217,7 +218,7 @@ const wchar_t * chart_wall::name = L"wall";
|
||||
|
||||
void chart_wall::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
chart_wall_attlist_.add_attributes(Attributes);
|
||||
attlist_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
void chart_wall::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
@ -256,7 +257,7 @@ const wchar_t * chart_axis::name = L"axis";
|
||||
|
||||
void chart_axis::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
chart_axis_attlist_.add_attributes(Attributes);
|
||||
attlist_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
void chart_axis::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
@ -279,7 +280,7 @@ const wchar_t * chart_grid::name = L"grid";
|
||||
|
||||
void chart_grid::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
chart_grid_attlist_.add_attributes(Attributes);
|
||||
attlist_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
void chart_grid::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
@ -306,11 +307,12 @@ void chart_categories::add_child_element( xml::sax * Reader, const std::wstring
|
||||
|
||||
void chart_series_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"chart:values-cell-range-address", chart_values_cell_range_address_);
|
||||
CP_APPLY_ATTR(L"chart:label-cell-", chart_label_cell_address_);
|
||||
CP_APPLY_ATTR(L"chart:class", chart_class_);
|
||||
CP_APPLY_ATTR(L"chart:attached-axis", chart_attached_axis_);
|
||||
common_attlist_.add_attributes(Attributes);
|
||||
CP_APPLY_ATTR(L"chart:values-cell-range-address", chart_values_cell_range_address_);
|
||||
CP_APPLY_ATTR(L"chart:label-cell-address", chart_label_cell_address_);
|
||||
CP_APPLY_ATTR(L"chart:class", chart_class_);
|
||||
CP_APPLY_ATTR(L"chart:attached-axis", chart_attached_axis_);
|
||||
|
||||
common_attlist_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
// chart:categories
|
||||
@ -320,7 +322,7 @@ const wchar_t * chart_series::name = L"series";
|
||||
|
||||
void chart_series::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
chart_series_attlist_.add_attributes(Attributes);
|
||||
attlist_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
void chart_series::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
@ -358,7 +360,7 @@ const wchar_t * chart_data_point::name = L"data-point";
|
||||
|
||||
void chart_data_point::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
chart_data_point_attlist_.add_attributes(Attributes);
|
||||
attlist_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
void chart_data_point::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
|
||||
@ -82,12 +82,12 @@ class chart_chart_attlist
|
||||
public:
|
||||
void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
|
||||
public:
|
||||
odf_types::common_draw_size_attlist common_draw_size_attlist_;
|
||||
common_chart_attlist common_attlist_;
|
||||
std::wstring chart_class_;
|
||||
_CP_OPT(std::wstring) chart_column_mapping_;
|
||||
_CP_OPT(std::wstring) chart_row_mapping_;
|
||||
_CP_OPT(std::wstring) loext_data_pilot_source_;
|
||||
};
|
||||
|
||||
// chart:chart
|
||||
@ -105,8 +105,8 @@ private:
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
public:
|
||||
chart_chart_attlist chart_chart_attlist_;
|
||||
office_element_ptr_array content_;
|
||||
chart_chart_attlist attlist_;
|
||||
office_element_ptr_array content_;
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(chart_chart);
|
||||
@ -139,7 +139,7 @@ private:
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
public:
|
||||
chart_title_attlist chart_title_attlist_;
|
||||
chart_title_attlist attlist_;
|
||||
office_element_ptr text_p_;
|
||||
};
|
||||
|
||||
@ -160,8 +160,8 @@ private:
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
public:
|
||||
chart_title_attlist chart_title_attlist_;
|
||||
office_element_ptr text_p_;
|
||||
chart_title_attlist attlist_;
|
||||
office_element_ptr text_p_;
|
||||
|
||||
};
|
||||
|
||||
@ -183,7 +183,7 @@ private:
|
||||
|
||||
public:
|
||||
common_chart_attlist common_attlist_;
|
||||
office_element_ptr text_p_;
|
||||
office_element_ptr text_p_;
|
||||
|
||||
};
|
||||
|
||||
@ -195,11 +195,11 @@ public:
|
||||
void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
|
||||
public:
|
||||
_CP_OPT(std::wstring) chart_legend_position_;
|
||||
_CP_OPT(std::wstring) chart_legend_align_;
|
||||
_CP_OPT(std::wstring) chart_legend_position_;
|
||||
_CP_OPT(std::wstring) chart_legend_align_;
|
||||
odf_types::common_draw_position_attlist common_draw_position_attlist_;
|
||||
_CP_OPT(std::wstring) style_legend_expansion_;
|
||||
_CP_OPT(double) style_legend_expansion_aspect_ratio_;
|
||||
_CP_OPT(std::wstring) style_legend_expansion_;
|
||||
_CP_OPT(double) style_legend_expansion_aspect_ratio_;
|
||||
common_chart_attlist common_attlist_;
|
||||
|
||||
};
|
||||
@ -219,7 +219,7 @@ private:
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
public:
|
||||
chart_legend_attlist chart_legend_attlist_;
|
||||
chart_legend_attlist attlist_;
|
||||
|
||||
};
|
||||
|
||||
@ -234,7 +234,7 @@ public:
|
||||
public:
|
||||
odf_types::common_draw_position_attlist common_draw_position_attlist_;
|
||||
odf_types::common_draw_size_attlist common_draw_size_attlist_;
|
||||
common_chart_attlist common_attlist_;
|
||||
common_chart_attlist common_attlist_;
|
||||
|
||||
_CP_OPT(std::wstring) table_cell_range_address_;
|
||||
_CP_OPT(std::wstring) chart_data_source_has_labels_;
|
||||
@ -257,9 +257,8 @@ private:
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
public:
|
||||
chart_plot_area_attlist chart_plot_area_attlist_;
|
||||
|
||||
office_element_ptr_array content_;
|
||||
chart_plot_area_attlist attlist_;
|
||||
office_element_ptr_array content_;
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(chart_plot_area);
|
||||
@ -270,7 +269,7 @@ public:
|
||||
void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
|
||||
public:
|
||||
_CP_OPT(odf_types::length) svg_width_;
|
||||
_CP_OPT(odf_types::length) svg_width_;
|
||||
common_chart_attlist common_attlist_;
|
||||
|
||||
};
|
||||
@ -289,7 +288,7 @@ private:
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
public:
|
||||
chart_wall_attlist chart_wall_attlist_;
|
||||
chart_wall_attlist attlist_;
|
||||
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(chart_wall);
|
||||
@ -310,7 +309,7 @@ private:
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
public:
|
||||
common_chart_attlist common_attlist_;
|
||||
common_chart_attlist common_attlist_;
|
||||
|
||||
};
|
||||
|
||||
@ -322,8 +321,8 @@ public:
|
||||
void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
|
||||
public:
|
||||
_CP_OPT(std::wstring) chart_dimension_;
|
||||
_CP_OPT(std::wstring) chart_name_;
|
||||
_CP_OPT(std::wstring) chart_dimension_;
|
||||
_CP_OPT(std::wstring) chart_name_;
|
||||
common_chart_attlist common_attlist_;
|
||||
};
|
||||
|
||||
@ -342,9 +341,8 @@ private:
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
public:
|
||||
chart_axis_attlist chart_axis_attlist_;
|
||||
|
||||
office_element_ptr_array content_;
|
||||
chart_axis_attlist attlist_;
|
||||
office_element_ptr_array content_;
|
||||
|
||||
};
|
||||
|
||||
@ -376,7 +374,7 @@ private:
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
public:
|
||||
chart_grid_attlist chart_grid_attlist_;
|
||||
chart_grid_attlist attlist_;
|
||||
|
||||
};
|
||||
|
||||
@ -432,9 +430,8 @@ private:
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
public:
|
||||
chart_series_attlist chart_series_attlist_;
|
||||
|
||||
office_element_ptr_array content_;
|
||||
chart_series_attlist attlist_;
|
||||
office_element_ptr_array content_;
|
||||
|
||||
};
|
||||
|
||||
@ -486,7 +483,7 @@ private:
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
public:
|
||||
chart_data_point_attlist chart_data_point_attlist_;
|
||||
chart_data_point_attlist attlist_;
|
||||
|
||||
};
|
||||
|
||||
@ -550,8 +547,8 @@ private:
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
public:
|
||||
common_chart_attlist common_attlist_;
|
||||
_CP_OPT(bool) display_r_square_;
|
||||
common_chart_attlist common_attlist_;
|
||||
_CP_OPT(bool) display_r_square_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -41,7 +41,6 @@
|
||||
namespace cpdoccore {
|
||||
namespace odf_reader {
|
||||
|
||||
// office_document_base
|
||||
class office_document_base : public office_element
|
||||
{
|
||||
public:
|
||||
@ -67,6 +66,8 @@ public:
|
||||
|
||||
// office-document-attrs
|
||||
// office-document-common-attrs
|
||||
office_element_ptr office_body_; // office-body
|
||||
|
||||
office_element_ptr office_meta_; // office-meta
|
||||
office_element_ptr office_settings_; // office-settings
|
||||
office_element_ptr office_scripts_;
|
||||
@ -75,14 +76,9 @@ public:
|
||||
office_element_ptr office_styles_; // office-styles
|
||||
office_element_ptr office_automatic_styles_; // office-automatic-styles
|
||||
office_element_ptr office_master_styles_; // office-master-styles
|
||||
office_element_ptr_array manifests_; // manifests
|
||||
|
||||
|
||||
public:
|
||||
office_element_ptr office_body_; // office-body
|
||||
office_element_ptr_array manifests_; // manifests
|
||||
|
||||
friend class odf_document;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user