Compare commits

..

46 Commits

Author SHA1 Message Date
50a1f3f5a7 x2t - refactoring qt projects 2016-12-23 19:54:30 +03:00
2710cabdc9 XlsFormatReader - delete unuseds, fix extended crypt, .. 2016-12-23 18:07:30 +03:00
1d55b1223c . 2016-12-23 18:06:18 +03:00
ac959e32af open/save ole object in a14 format xlsx 2016-12-23 16:00:57 +03:00
1c2524f5fb FontsGen - fix build 2016-12-23 14:38:15 +03:00
c0e4b02138 Merge tag 'v4.2.3' into develop
v4.2.3 v4.2.3
2016-12-23 14:22:08 +03:00
eb29cee9ad Merge branch 'hotfix/v4.2.3' 2016-12-23 14:22:04 +03:00
5720891452 macOS 10.11 2016-12-22 18:48:28 +03:00
96f7cd9017 . 2016-12-22 17:56:34 +03:00
c7ef8e9b1d . 2016-12-22 15:34:32 +03:00
1a2f9afac7 x2t linux build, version up 2016-12-22 15:12:06 +03:00
2c945b7166 x2t - refactoring (delete double conversions string) 2016-12-21 19:29:18 +03:00
e49deaaf64 Added dependency for HtmlFileInternal 2016-12-21 12:47:22 +03:00
3edb12499c Added UnicodeConverter dependency for AllFontGen 2016-12-20 19:46:31 +03:00
52c3f9bdb1 Added UnicodeConverter 2016-12-20 19:45:06 +03:00
1e53b26704 x2t -deleting atl relations 2016-12-20 17:55:49 +03:00
8ac5180992 DocxBin background documents ... 2016-12-20 14:24:55 +03:00
8cdf491178 DocxBin - add background document 2016-12-19 11:26:24 +03:00
c5c64cb6c2 XpsFile & DjVuFile - fix build 2016-12-16 17:26:20 +03:00
86000ee48f x2t 2.0.2.422 2016-12-16 12:33:28 +03:00
652fc292af DocFormatReader - same bugs fix 2016-12-16 12:28:17 +03:00
6e3b7b1146 thumbnail error with aspect 2016-12-16 12:17:10 +03:00
2ff5bd5910 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2016-12-16 10:57:41 +03:00
01528516dd HtmlRenderer -fix build 2016-12-16 10:56:49 +03:00
95dcf3661f Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2016-12-16 10:38:00 +03:00
717d91a192 . 2016-12-16 10:31:49 +03:00
3dd4dda2e3 DocFormatReader -ole ... 2016-12-15 18:12:41 +03:00
24dc35546f arguments to builder (JSON format) 2016-12-15 17:00:56 +03:00
fc2707f0b5 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2016-12-15 15:46:40 +03:00
ea5ebe720b DocFormatReader - another ole objects(pictureId) 2016-12-15 14:55:55 +03:00
cdead54f4a ios build converter 2016-12-15 13:36:00 +03:00
29ae0bdc38 . 2016-12-15 12:11:05 +03:00
502243103b Changed the build dependency 2016-12-15 11:41:45 +03:00
c668288308 . 2016-12-14 20:03:12 +03:00
39257334e4 x2t version up 2.0.2.401 2016-12-14 19:29:29 +03:00
48f95bd9f2 fix bug #33684 2016-12-14 19:22:00 +03:00
80d95d41c5 save to pdf (only first page support) 2016-12-14 16:56:56 +03:00
42fb658349 PdfReader/Writer linux build fix 2016-12-14 16:06:44 +03:00
d500cbc615 PdfReader/Writer windows build fix 2016-12-13 18:17:14 +03:00
470d57aec2 . 2016-12-13 17:25:02 +03:00
635a5d232a DocFormatReader - background page 2016-12-13 16:03:45 +03:00
6fa18eb20d add folders to search the system fonts 2016-12-13 10:48:48 +03:00
435bb02de3 Metfiles StarView - fix coding text (charsets) 2016-12-12 13:41:02 +03:00
a84425b49f x2t 2.0.2.420 2016-12-12 11:43:10 +03:00
250a6e5a06 OdfFormatReader - sheet/workbook views 2016-12-10 17:07:31 +03:00
82dc7ab444 OdfFormatReader - global settings for documents 2016-12-09 19:37:56 +03:00
1433 changed files with 9601 additions and 16501 deletions

View File

@ -766,18 +766,11 @@ namespace DocFormatUtils
static inline std::wstring IntToWideString(int value)
{
#if defined(_WIN32) || defined (_WIN64)
wchar_t buff[33] ={};
_itow(value, buff, 10);
return std::wstring(buff);
#else
return (std::to_wstring(value));
#endif
}
static inline std::wstring DoubleToWideString(double value)
{
std::wstringstream src;
std::wstringstream src;
src << value;
return std::wstring(src.str());
@ -785,8 +778,7 @@ namespace DocFormatUtils
static inline std::string DoubleToString(double value)
{
std::stringstream src;
std::stringstream src;
src << value;
return std::string(src.str());
@ -813,36 +805,16 @@ namespace DocFormatUtils
static inline std::wstring IntToFormattedWideString( int value, const wchar_t* format )
{
// const int size = 33;
// wchar_t strValue[size] = L"\0";
if ( format == NULL ) return L"";
// swprintf_s( strValue, size, format, value );
//// }
// CString format_str;
// format_str.Format(format , value);
std::wstringstream sstream;
sstream << boost::wformat(format) % value;
return sstream.str();
//return string2std_string( format_str );
}
static inline std::wstring DoubleToFormattedWideString( double value, wchar_t* format )
{
if ( format == NULL ) return L"";
//std::wstring wstr;
//if ( format != NULL )
//{
// CString strValue;
// strValue.Format(format, value);
// wstr = string2std_string( strValue );
//}
//return wstr;
std::wstringstream sstream;
sstream << boost::wformat(format) % value;
return sstream.str();

View File

@ -33,11 +33,9 @@
#if defined(_WIN32) || defined(_WIN64)
#include <tchar.h>
#else
#include "../../DesktopEditor/common/ASCVariant.h"
#include "../../Common/DocxFormat/Source/Base/ASCString.h"
#endif
#include <string>
#include "../../DesktopEditor/common/ASCVariant.h"
namespace OpenXmlContentTypes
{

View File

@ -72,6 +72,8 @@ namespace DocFileFormat
_isSectionPageBreak = 0;
_isTextBoxContent = false;
_embeddedObject = false;
_cacheListNum = -1;
}
DocumentMapping::~DocumentMapping()
@ -81,12 +83,8 @@ namespace DocFileFormat
RELEASEOBJECT(m_pXmlWriter);
}
}
}
namespace DocFileFormat
{
// Looks into the section table to find out if this CP is the end & current of a sections
int DocumentMapping::getCurrentSection(int cp)
{
//if cp is the last char of a section, the next section will start at cp +1
@ -105,6 +103,22 @@ namespace DocFileFormat
return m_document->SectionPlex->CharacterPositions[current + 1];
}
int DocumentMapping::getListNumCache(int fc, int fc_end)
{
if ( !m_document->ListPlex ) return -1;
for (int i = 1; i < m_document->ListPlex->CharacterPositions.size(); i++)
{
if ((fc >= m_document->ListPlex->CharacterPositions[i-1]) && (fc_end <= m_document->ListPlex->CharacterPositions[i]))
{
ListNumCache* listNum = dynamic_cast<ListNumCache*> (m_document->ListPlex->Elements[i-1]);
return listNum->value;
}
}
return -1;
}
bool DocumentMapping::isSectionEnd(int cp)
{
bool result = false;
@ -180,8 +194,8 @@ namespace DocFileFormat
// get all CHPX between these boundaries to determine the count of runs
std::list<CharacterPropertyExceptions*>* chpxs = m_document->GetCharacterPropertyExceptions(fc, fcEnd);
std::vector<int>* chpxFcs = m_document->GetFileCharacterPositions(fc, fcEnd);
std::list<CharacterPropertyExceptions*>* chpxs = m_document->GetCharacterPropertyExceptions(fc, fcEnd);
std::vector<int>* chpxFcs = m_document->GetFileCharacterPositions(fc, fcEnd);
CharacterPropertyExceptions* paraEndChpx = NULL;
@ -198,7 +212,7 @@ namespace DocFileFormat
// start paragraph
m_pXmlWriter->WriteNodeBegin(_T("w:p"), TRUE);
m_pXmlWriter->WriteNodeBegin(_T("w:p"), true);
writeParagraphRsid(papx);
// ----------- check for section properties
@ -208,8 +222,8 @@ namespace DocFileFormat
{
isBidi = currentSection->isBidi;
}
//-----------------------------------------------------------
//_cacheListNum = getListNumCache(fc, fcEnd);
_isSectionPageBreak = 0;
if (sectionEnd)
{
@ -339,7 +353,7 @@ namespace DocFileFormat
}
}
m_pXmlWriter->WriteNodeEnd(_T(""), TRUE, FALSE);
m_pXmlWriter->WriteNodeEnd(_T(""), true, false);
}
// Writes a run with the given characters and CHPX
@ -356,23 +370,23 @@ namespace DocFileFormat
if (Deleted == rev.Type)
{
//If it's a deleted run
m_pXmlWriter->WriteNodeBegin(_T("w:del"), TRUE);
m_pXmlWriter->WriteNodeBegin(_T("w:del"), true);
m_pXmlWriter->WriteAttribute(_T("w:author"), _T("[b2x: could not retrieve author]"));
m_pXmlWriter->WriteAttribute(_T("w:date"), _T("[b2x: could not retrieve date]"));
m_pXmlWriter->WriteNodeEnd(_T(""), TRUE, FALSE);
m_pXmlWriter->WriteNodeEnd(_T(""), true, false);
}
else if ( rev.Type == Inserted )
{
WideString* author = dynamic_cast<WideString*>(m_document->RevisionAuthorTable->operator[](rev.Isbt));
//if it's a inserted run
m_pXmlWriter->WriteNodeBegin(_T("w:ins"), TRUE);
m_pXmlWriter->WriteNodeBegin(_T("w:ins"), true);
m_pXmlWriter->WriteAttribute(_T("w:author"), FormatUtils::XmlEncode(*author).c_str());
m_pXmlWriter->WriteNodeEnd(_T(""), TRUE, FALSE);
m_pXmlWriter->WriteNodeEnd(_T(""), true, false);
//rev.Dttm.Convert(new DateMapping(m_pXmlWriter));
}
//start run
m_pXmlWriter->WriteNodeBegin(_T("w:r"), TRUE);
m_pXmlWriter->WriteNodeBegin(_T("w:r"), true);
//append rsids
if (0 != rev.Rsid)
@ -396,7 +410,7 @@ namespace DocFileFormat
m_context->AddRsid(rsidProp);
}
m_pXmlWriter->WriteNodeEnd(_T(""), TRUE, FALSE);
m_pXmlWriter->WriteNodeEnd(_T(""), true, false);
/// <w:rPr>
CharacterPropertiesMapping* rPr = new CharacterPropertiesMapping(m_pXmlWriter, m_document, &rev, _lastValidPapx, false);
@ -564,9 +578,9 @@ namespace DocFileFormat
if ( bFORM )
{
m_pXmlWriter->WriteNodeBegin( _T( "w:fldChar" ), TRUE );
m_pXmlWriter->WriteNodeBegin( _T( "w:fldChar" ), true );
m_pXmlWriter->WriteAttribute( _T( "w:fldCharType" ), _T( "begin" ) );
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE );
m_pXmlWriter->WriteNodeEnd( _T( "" ), true, false );
int cpPic = searchNextTextMark( m_document->Text, cpFieldStart, TextMark::Picture );
@ -589,9 +603,9 @@ namespace DocFileFormat
&&
( ( bEMBED || bLINK ) && bChart) )
{
m_pXmlWriter->WriteNodeBegin( _T( "w:fldChar" ), TRUE );
m_pXmlWriter->WriteNodeBegin( _T( "w:fldChar" ), true );
m_pXmlWriter->WriteAttribute( _T( "w:fldCharType" ), _T( "begin" ) );
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE );
m_pXmlWriter->WriteNodeEnd( _T( "" ), true, false );
int cpPic = searchNextTextMark( m_document->Text, cpFieldStart, TextMark::Picture );
@ -608,9 +622,9 @@ namespace DocFileFormat
if ((search( f.begin(), f.end(), TOC.begin(), TOC.end()) != f.end()) || bPAGE)
{
m_pXmlWriter->WriteNodeBegin( _T( "w:fldChar" ), TRUE );
m_pXmlWriter->WriteNodeBegin( _T( "w:fldChar" ), true );
m_pXmlWriter->WriteAttribute( _T( "w:fldCharType" ), _T( "begin" ) );
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE );
m_pXmlWriter->WriteNodeEnd( _T( "" ), true );
_writeInstrText = true;
_fldCharCounter++;
@ -638,9 +652,9 @@ namespace DocFileFormat
//if (_writeInstrText == true)
//{
// m_pXmlWriter->WriteNodeBegin( _T( "w:fldChar" ), TRUE );
// m_pXmlWriter->WriteNodeBegin( _T( "w:fldChar" ), true );
// m_pXmlWriter->WriteAttribute( _T( "w:fldCharType" ), _T( "separate" ) );
// m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE );
// m_pXmlWriter->WriteNodeEnd( _T( "" ), true );
//}
_writeInstrText = false;
@ -671,31 +685,38 @@ namespace DocFileFormat
chpxObj->Convert(rPr);
RELEASEOBJECT(rPr);
}
XMLTools::CStringXmlWriter OleWriter;
VMLPictureMapping oVmlMapper (m_context, &OleWriter, true, _caller);
XMLTools::CStringXmlWriter oleWriter;
XMLTools::CStringXmlWriter oleObjectWriter;
VMLPictureMapping oVmlMapper (m_context, &oleWriter, true, _caller);
if (!m_shapeIdOwner.empty()) //4571833.doc
oVmlMapper.m_shapeId = m_shapeIdOwner;
if (m_document->bOlderVersion)
{
OleObject ole ( chpxObj, m_document->GetStorage(), m_document->bOlderVersion);
OleWriter.WriteNodeBegin (_T( "w:object" ), TRUE);
OleWriter.WriteAttribute( _T( "w:dxaOrig" ), FormatUtils::IntToWideString( ( ole.pictureDesciptor.dxaGoal + ole.pictureDesciptor.dxaOrigin ) ).c_str() );
OleWriter.WriteAttribute( _T( "w:dyaOrig" ), FormatUtils::IntToWideString( ( ole.pictureDesciptor.dyaGoal + ole.pictureDesciptor.dyaOrigin ) ).c_str() );
OleWriter.WriteNodeEnd( _T( "" ), TRUE, FALSE );
oleWriter.WriteNodeBegin (_T( "w:object" ), true);
oleWriter.WriteAttribute( _T( "w:dxaOrig" ), FormatUtils::IntToWideString( ( ole.pictureDesciptor.dxaGoal + ole.pictureDesciptor.dxaOrigin ) ).c_str() );
oleWriter.WriteAttribute( _T( "w:dyaOrig" ), FormatUtils::IntToWideString( ( ole.pictureDesciptor.dyaGoal + ole.pictureDesciptor.dyaOrigin ) ).c_str() );
oleWriter.WriteNodeEnd( _T( "" ), true, false );
ole.pictureDesciptor.Convert(&oVmlMapper);
OleObjectMapping oleObjectMapping( &OleWriter, m_context, &ole.pictureDesciptor, _caller, oVmlMapper.GetShapeId() );
OleObjectMapping oleObjectMapping( &oleObjectWriter, m_context, &ole.pictureDesciptor, _caller, oVmlMapper.m_shapeId);
ole.Convert( &oleObjectMapping );
_lastOLEObject = oleObjectWriter.GetXmlString();
}
else
{
PictureDescriptor pic(chpxObj, m_document->DataStream, 0x7fffffff, m_document->bOlderVersion);
OleWriter.WriteNodeBegin (_T( "w:object" ), TRUE);
OleWriter.WriteAttribute( _T( "w:dxaOrig" ), FormatUtils::IntToWideString( ( pic.dxaGoal + pic.dxaOrigin ) ).c_str() );
OleWriter.WriteAttribute( _T( "w:dyaOrig" ), FormatUtils::IntToWideString( ( pic.dyaGoal + pic.dyaOrigin ) ).c_str() );
OleWriter.WriteNodeEnd( _T( "" ), TRUE, FALSE );
oleWriter.WriteNodeBegin (_T( "w:object" ), true);
oleWriter.WriteAttribute( _T( "w:dxaOrig" ), FormatUtils::IntToWideString( ( pic.dxaGoal + pic.dxaOrigin ) ).c_str() );
oleWriter.WriteAttribute( _T( "w:dyaOrig" ), FormatUtils::IntToWideString( ( pic.dyaGoal + pic.dyaOrigin ) ).c_str() );
oleWriter.WriteNodeEnd( _T( "" ), true, false );
pic.Convert(&oVmlMapper);
RELEASEOBJECT(chpxs);
@ -709,7 +730,7 @@ namespace DocFileFormat
CharacterPropertyExceptions* chpxSep = chpxs->front();
OleObject ole ( chpxSep, m_document->GetStorage(), m_document->bOlderVersion);
OleObjectMapping oleObjectMapping( &OleWriter, m_context, &pic, _caller, oVmlMapper.GetShapeId() );
OleObjectMapping oleObjectMapping( &oleObjectWriter, m_context, &pic, _caller, oVmlMapper.m_shapeId );
if (oVmlMapper.m_isEmbedded)
{
@ -718,11 +739,14 @@ namespace DocFileFormat
ole.emeddedData = oVmlMapper.m_embeddedData;
}
ole.Convert( &oleObjectMapping );
_lastOLEObject = oleObjectWriter.GetXmlString();
RELEASEOBJECT( chpxs );
}
}
OleWriter.WriteNodeEnd( _T( "w:object" ) );
oleWriter.WriteString( _lastOLEObject );
oleWriter.WriteNodeEnd( _T( "w:object" ) );
if (!oVmlMapper.m_isEmbedded && oVmlMapper.m_isEquation)
{
@ -732,7 +756,7 @@ namespace DocFileFormat
}
else
{
m_pXmlWriter->WriteString(OleWriter.GetXmlString());
m_pXmlWriter->WriteString(oleWriter.GetXmlString());
}
}
@ -741,9 +765,9 @@ namespace DocFileFormat
}
else
{
m_pXmlWriter->WriteNodeBegin( _T( "w:fldChar" ), TRUE );
m_pXmlWriter->WriteNodeBegin( _T( "w:fldChar" ), true );
m_pXmlWriter->WriteAttribute( _T( "w:fldCharType" ), _T( "begin" ) );
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE );
m_pXmlWriter->WriteNodeEnd( _T( "" ), true );
_writeInstrText = true;
_fldCharCounter++;
@ -787,10 +811,10 @@ namespace DocFileFormat
{
Symbol s = getSymbol( chpx );
m_pXmlWriter->WriteNodeBegin(_T("w:sym"), TRUE);
m_pXmlWriter->WriteNodeBegin(_T("w:sym"), true);
m_pXmlWriter->WriteAttribute(_T("w:font"), FormatUtils::XmlEncode(s.FontName).c_str());
m_pXmlWriter->WriteAttribute(_T("w:char"), FormatUtils::XmlEncode(s.HexValue).c_str());
m_pXmlWriter->WriteNodeEnd(_T(""), TRUE);
m_pXmlWriter->WriteNodeEnd(_T(""), true);
}
else if ((TextMark::DrawnObject == code) && fSpec)
{
@ -807,20 +831,23 @@ namespace DocFileFormat
if (pSpa)
{
PictureDescriptor pictDiscr(chpx, m_document->WordDocumentStream, 0x7fffffff, m_document->bOlderVersion);
ShapeContainer* pShape = m_document->GetOfficeArt()->GetShapeContainer(pSpa->GetShapeID());
if (pShape)
{
m_pXmlWriter->WriteNodeBegin (_T("w:pict"));
VMLShapeMapping oVmlWriter (m_context, m_pXmlWriter, pSpa, NULL, _caller);
VMLShapeMapping oVmlWriter (m_context, m_pXmlWriter, pSpa, &pictDiscr, _caller);
m_pXmlWriter->WriteNodeBegin (L"w:pict");
pShape->Convert(&oVmlWriter);
m_pXmlWriter->WriteNodeEnd (_T("w:pict"));
m_pXmlWriter->WriteNodeEnd (L"w:pict");
}
if (!pSpa->primitives.empty())
{
m_pXmlWriter->WriteNodeBegin (_T("w:pict"));
VMLShapeMapping oVmlWriter (m_context, m_pXmlWriter, pSpa, NULL, _caller);
VMLShapeMapping oVmlWriter (m_context, m_pXmlWriter, pSpa, &pictDiscr, _caller);
pSpa->primitives.Convert(&oVmlWriter);
m_pXmlWriter->WriteNodeEnd (_T("w:pict"));
}
@ -865,7 +892,7 @@ namespace DocFileFormat
if (oVmlMapper.m_isEmbedded)
{
OleObject ole ( chpx, m_document->GetStorage(), m_document->bOlderVersion);
OleObjectMapping oleObjectMapping( &pictWriter, m_context, &oPicture, _caller, oVmlMapper.GetShapeId() );
OleObjectMapping oleObjectMapping( &pictWriter, m_context, &oPicture, _caller, oVmlMapper.m_shapeId );
ole.isEquation = oVmlMapper.m_isEquation;
ole.isEmbedded = oVmlMapper.m_isEmbedded;
@ -897,40 +924,40 @@ namespace DocFileFormat
{
if ((m_document->FootnoteReferenceCharactersPlex != NULL) && (m_document->FootnoteReferenceCharactersPlex->IsCpExists(cp)))
{
m_pXmlWriter->WriteNodeBegin( _T( "w:footnoteReference" ), TRUE );
m_pXmlWriter->WriteNodeBegin( _T( "w:footnoteReference" ), true );
m_pXmlWriter->WriteAttribute( _T( "w:id" ), FormatUtils::IntToWideString(_footnoteNr++ ).c_str() );
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE );
m_pXmlWriter->WriteNodeEnd( _T( "" ), true );
}
else if ((m_document->IndividualFootnotesPlex != NULL) && (m_document->IndividualFootnotesPlex->IsCpExists(cp - m_document->FIB->m_RgLw97.ccpText)))
{
m_pXmlWriter->WriteNodeBegin( _T( "w:footnoteRef" ), TRUE );
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE );
m_pXmlWriter->WriteNodeBegin( _T( "w:footnoteRef" ), true );
m_pXmlWriter->WriteNodeEnd( _T( "" ), true );
}
else if ((m_document->EndnoteReferenceCharactersPlex != NULL) && (m_document->EndnoteReferenceCharactersPlex->IsCpExists(cp)))
{
m_pXmlWriter->WriteNodeBegin( _T( "w:endnoteReference" ), TRUE );
m_pXmlWriter->WriteNodeBegin( _T( "w:endnoteReference" ), true );
m_pXmlWriter->WriteAttribute( _T( "w:id" ), FormatUtils::IntToWideString(_endnoteNr++ ).c_str() );
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE );
m_pXmlWriter->WriteNodeEnd( _T( "" ), true );
}
else if ((m_document->IndividualEndnotesPlex != NULL) &&
(m_document->IndividualEndnotesPlex->IsCpExists(cp - m_document->FIB->m_RgLw97.ccpAtn - m_document->FIB->m_RgLw97.ccpHdr - m_document->FIB->m_RgLw97.ccpFtn - m_document->FIB->m_RgLw97.ccpText)))
{
m_pXmlWriter->WriteNodeBegin( _T( "w:endnoteRef" ), TRUE );
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE );
m_pXmlWriter->WriteNodeBegin( _T( "w:endnoteRef" ), true );
m_pXmlWriter->WriteNodeEnd( _T( "" ), true );
}
}
else if (TextMark::AnnotationReference == code)
{
if (typeid(*this) != typeid(CommentsMapping))
{
m_pXmlWriter->WriteNodeBegin( _T( "w:commentReference" ), TRUE );
m_pXmlWriter->WriteNodeBegin( _T( "w:commentReference" ), true );
m_pXmlWriter->WriteAttribute( _T( "w:id" ), FormatUtils::IntToWideString( _commentNr ).c_str() );
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE );
m_pXmlWriter->WriteNodeEnd( _T( "" ), true );
}
else
{
m_pXmlWriter->WriteNodeBegin( _T( "w:annotationRef" ), TRUE );
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE );
m_pXmlWriter->WriteNodeBegin( _T( "w:annotationRef" ), true );
m_pXmlWriter->WriteNodeEnd( _T( "" ), true );
}
_commentNr++;
@ -976,12 +1003,12 @@ namespace DocFileFormat
{
std::wstring str = ( std::wstring( _T( "w:" ) ) + textType );
m_pXmlWriter->WriteNodeBegin( str.c_str(), TRUE );
m_pXmlWriter->WriteNodeBegin( str.c_str(), true );
if (preserve_space)
{
m_pXmlWriter->WriteAttribute( _T( "xml:space" ), _T( "preserve" ) );
}
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE );
m_pXmlWriter->WriteNodeEnd( _T( "" ), true, false );
}
void DocumentMapping::writeTextEnd(const std::wstring& textType)

View File

@ -70,68 +70,70 @@ namespace DocFileFormat
public:
DocumentMapping(ConversionContext* context, IMapping* caller);
DocumentMapping(ConversionContext* context, XMLTools::CStringXmlWriter* writer, IMapping* caller);
virtual ~DocumentMapping();
virtual void Apply( IVisitable* visited ) = 0;
//--------------------------------- 4571833.doc
std::wstring m_shapeIdOwner;
std::wstring getOLEObject() { return _lastOLEObject; }
protected:
/// Looks into the section table to find out if this CP is the current of a section
int getCurrentSection(int cp);
/// Looks into the section table to find out if this CP is the end of a section
bool isSectionEnd( int cp );
/// Writes a Paragraph that starts at the given cp and
/// ends at the next paragraph end mark or section end mark
int getListNumCache (int fc, int fc_end);
int getCurrentSection (int cp);
//---------------------------------
bool isSectionEnd ( int cp );
// Writes a Paragraph that starts at the given cp and
// ends at the next paragraph end mark or section end mark
int writeParagraph( int cp );
/// Writes a Paragraph that starts at the given cpStart and
/// ends at the given cpEnd
// Writes a Paragraph that starts at the given cpStart and
// ends at the given cpEnd
int writeParagraph( int initialCp, int cpEnd, bool sectionEnd, bool lastBad = false );
/// Writes a Paragraph RSID
// Writes a Paragraph RSID
void writeParagraphRsid( const ParagraphPropertyExceptions* papx );
/// Writes a run with the given characters and CHPX
// Writes a run with the given characters and CHPX
int writeRun( std::vector<wchar_t>* chars, CharacterPropertyExceptions* chpx, int initialCp );
/// Writes the given text to the document
// Writes the given text to the document
int writeText ( std::vector<wchar_t>* chars, int initialCp, CharacterPropertyExceptions* chpx, bool writeDeletedText );
void writeTextElement ( const std::wstring& text, const std::wstring& textType );
void writeTextStart ( const std::wstring& textType, bool preserve_space);
void writeTextEnd ( const std::wstring& textType );
int writeText( std::vector<wchar_t>* chars, int initialCp, CharacterPropertyExceptions* chpx, bool writeDeletedText );
void writeTextElement( const std::wstring& text, const std::wstring& textType );
void writeTextStart( const std::wstring& textType, bool preserve_space);
void writeTextEnd( const std::wstring& textType );
/// Searches for bookmarks in the list of characters.
// Searches for bookmarks in the list of characters.
std::vector<int> searchBookmarks( std::vector<wchar_t>* chars, int initialCp );
ParagraphPropertyExceptions* findValidPapx( int fc );
/// Splits a list of characters into several lists
// Splits a list of characters into several lists
std::list<std::vector<wchar_t> >* splitCharList( std::vector<wchar_t>* chars, std::vector<int>* splitIndices );
/// Writes the table starts at the given cp value
int writeTable( int initialCp, unsigned int nestingLevel );
/// Builds a list that contains the width of the several columns of the table.
// Writes the table starts at the given cp value
int writeTable ( int initialCp, unsigned int nestingLevel );
// Builds a list that contains the width of the several columns of the table.
std::vector<short>* buildTableGrid( int initialCp, unsigned int nestingLevel );
/// Finds the FC of the next row end mark.
int findRowEndFc( int initialCp, int& rowEndCp, unsigned int nestingLevel );
/// Finds the FC of the next row end mark.
int findRowEndFc( int initialCp, unsigned int nestingLevel );
/// Writes the table row that starts at the given cp value and ends at the next row end mark
int writeTableRow( int initialCp, std::vector<short>* grid, unsigned int nestingLevel );
/// Writes the table cell that starts at the given cp value and ends at the next cell end mark
int writeTableCell( int initialCp, TablePropertyExceptions* tapx, std::vector<short>* grid, int& gridIndex, int cellIndex, unsigned int nestingLevel );
int findCellEndCp( int initialCp, unsigned int nestingLevel );
bool writeBookmarks( int cp );
bool writeBookmarkStart( short id );
bool writeBookmarkEnd( short id );
/// Checks if the CHPX is special
// Finds the FC of the next row end mark.
int findRowEndFc ( int initialCp, int& rowEndCp, unsigned int nestingLevel );
// Finds the FC of the next row end mark.
int findRowEndFc ( int initialCp, unsigned int nestingLevel );
// Writes the table row that starts at the given cp value and ends at the next row end mark
int writeTableRow ( int initialCp, std::vector<short>* grid, unsigned int nestingLevel );
// Writes the table cell that starts at the given cp value and ends at the next cell end mark
int writeTableCell ( int initialCp, TablePropertyExceptions* tapx, std::vector<short>* grid, int& gridIndex, int cellIndex, unsigned int nestingLevel );
int findCellEndCp ( int initialCp, unsigned int nestingLevel );
bool writeBookmarks ( int cp );
bool writeBookmarkStart ( short id );
bool writeBookmarkEnd ( short id );
// Checks if the CHPX is special
bool isSpecial( CharacterPropertyExceptions* chpx );
/// Finds the SEPX that is valid for the given CP.
// Finds the SEPX that is valid for the given CP.
SectionPropertyExceptions* findValidSepx( int cp );
/// Searches the given vector for the next FieldEnd character.
// Searches the given vector for the next FieldEnd character.
int searchNextTextMark( std::vector<wchar_t>* chars, int initialCp, wchar_t mark );
private:
Symbol getSymbol( const CharacterPropertyExceptions* chpx );
Symbol getSymbol ( const CharacterPropertyExceptions* chpx );
//----------------------------------------------------------------------------------------------------------------------
bool m_bInternalXmlWriter;
protected:
WordDocument* m_document;
ConversionContext* m_context;
IMapping* _caller;
ParagraphPropertyExceptions* _lastValidPapx;
@ -149,5 +151,7 @@ namespace DocFileFormat
bool _writeWebHidden;
unsigned int _fldCharCounter;
std::wstring _writeAfterRun;
std::wstring _lastOLEObject;
int _cacheListNum;
};
}

View File

@ -43,7 +43,8 @@ namespace DocFileFormat
/*========================================================================================================*/
WordDocumentProperties::WordDocumentProperties(FileInformationBlock* fib, POLE::Stream* tableStream) : doptypography(NULL), dogrid(NULL), asumyi(NULL)
WordDocumentProperties::WordDocumentProperties(FileInformationBlock* fib, POLE::Stream* tableStream) :
doptypography(NULL), dogrid(NULL), asumyi(NULL), bDisplayBackgroundShape(false)
{
Initialize();
@ -226,7 +227,7 @@ namespace DocFileFormat
dywDispPag = FormatUtils::BytesToInt16( bytes, 498, size );
//WORD 2000, 2002, 2003 PART
if ( size > 500 )
if ( size > 500/* && fib->m_FibNew.nFibNew > Fib1997*/)
{
ilvlLastBulletMain = bytes[500];
ilvlLastNumberMain = bytes[501];
@ -266,138 +267,158 @@ namespace DocFileFormat
fDntULTrlSpc = FormatUtils::GetBitFromBytes( ( bytes + 508 ), 4, 14 );
fDntBlnSbDbWid = FormatUtils::GetBitFromBytes( ( bytes + 508 ), 4, 15 );
fSuppressTopSpacingMac5 = FormatUtils::GetBitFromBytes( ( bytes + 508 ), 4, 16 );
fTruncDxaExpand = FormatUtils::GetBitFromBytes( ( bytes + 508 ), 4, 17 );
fPrintBodyBeforeHdr = FormatUtils::GetBitFromBytes( ( bytes + 508 ), 4, 18 );
fNoLeading = FormatUtils::GetBitFromBytes( ( bytes + 508 ), 4, 19 );
fMakeSpaceForUL = FormatUtils::GetBitFromBytes( ( bytes + 508 ), 4, 20 );
fMWSmallCaps = FormatUtils::GetBitFromBytes( ( bytes + 508 ), 4, 21 );
f2ptExtLeadingOnly = FormatUtils::GetBitFromBytes( ( bytes + 508 ), 4, 22 );
fTruncFontHeight = FormatUtils::GetBitFromBytes( ( bytes + 508 ), 4, 23 );
fSubOnSize = FormatUtils::GetBitFromBytes( ( bytes + 508 ), 4, 24 );
fLineWrapLikeWord6 = FormatUtils::GetBitFromBytes( ( bytes + 508 ), 4, 25 );
fWW6BorderRules = FormatUtils::GetBitFromBytes( ( bytes + 508 ), 4, 26 );
fExactOnTop = FormatUtils::GetBitFromBytes( ( bytes + 508 ), 4, 27 );
fExtraAfter = FormatUtils::GetBitFromBytes( ( bytes + 508 ), 4, 28 );
fWPSpace = FormatUtils::GetBitFromBytes( ( bytes + 508 ), 4, 29 );
fWPJust = FormatUtils::GetBitFromBytes( ( bytes + 508 ), 4, 30 );
fPrintMet = FormatUtils::GetBitFromBytes( ( bytes + 508 ), 4, 31 );
fTruncDxaExpand = FormatUtils::GetBitFromBytes( ( bytes + 508 ), 4, 17 );
fPrintBodyBeforeHdr = FormatUtils::GetBitFromBytes( ( bytes + 508 ), 4, 18 );
fNoLeading = FormatUtils::GetBitFromBytes( ( bytes + 508 ), 4, 19 );
fMakeSpaceForUL = FormatUtils::GetBitFromBytes( ( bytes + 508 ), 4, 20 );
fMWSmallCaps = FormatUtils::GetBitFromBytes( ( bytes + 508 ), 4, 21 );
f2ptExtLeadingOnly = FormatUtils::GetBitFromBytes( ( bytes + 508 ), 4, 22 );
fTruncFontHeight = FormatUtils::GetBitFromBytes( ( bytes + 508 ), 4, 23 );
fSubOnSize = FormatUtils::GetBitFromBytes( ( bytes + 508 ), 4, 24 );
fLineWrapLikeWord6 = FormatUtils::GetBitFromBytes( ( bytes + 508 ), 4, 25 );
fWW6BorderRules = FormatUtils::GetBitFromBytes( ( bytes + 508 ), 4, 26 );
fExactOnTop = FormatUtils::GetBitFromBytes( ( bytes + 508 ), 4, 27 );
fExtraAfter = FormatUtils::GetBitFromBytes( ( bytes + 508 ), 4, 28 );
fWPSpace = FormatUtils::GetBitFromBytes( ( bytes + 508 ), 4, 29 );
fWPJust = FormatUtils::GetBitFromBytes( ( bytes + 508 ), 4, 30 );
fPrintMet = FormatUtils::GetBitFromBytes( ( bytes + 508 ), 4, 31 );
//split bytes 512,513,514,515 into bits
fSpLayoutLikeWW8 = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 0 );
fFtnLayoutLikeWW8 = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 1 );
fDontUseHTMLParagraphAutoSpacing = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 2 );
fDontAdjustLineHeightInTable = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 3 );
fForgetLastTabAlign = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 4 );
fUseAutoSpaceForFullWidthAlpha = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 5 );
fAlignTablesRowByRow = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 6 );
fLayoutRawTableWidth = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 7 );
fLayoutTableRowsApart = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 8 );
fUserWord97LineBreakingRules = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 9 );
fDontBreakWrappedTables = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 10 );
fDontSnapToGridInCell = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 11 );
fDontAllowFieldEndSelect = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 12 );
fApplyBreakingRules = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 13 );
fDontWrapTextWithPunct = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 14 );
fDontUseAsianBreakRules = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 15 );
fUseWord2002TableStyleRules = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 16 );
fGrowAutofit = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 17 );
fUseNormalStyleForList = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 18 );
fDontUseIndentAsNumberingTabStop = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 19 );
fFELineBreak11 = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 20 );
fAllowSpaceOfSameStyleInTable = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 21 );
fWW11IndentRules = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 22 );
fDontAutofitConstrainedTables = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 23 );
fAutofitLikeWW11 = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 24 );
fUnderlineTabInNumList = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 25 );
fHangulWidthLikeWW11 = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 26 );
fSplitPgBreakAndParaMark = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 27 );
fDontVertAlignCellWithSp = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 28 );
fDontBreakConstrainedForcedTables = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 29 );
fDontVertAlignInTxbx = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 30 );
fWord11KerningPairs = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 31 );
fCachedColBalance = FormatUtils::GetBitFromBytes( ( bytes + 516 ), 4, 0 );
//split bytes 512,513,514,515 into bits
fSpLayoutLikeWW8 = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 0 );
fFtnLayoutLikeWW8 = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 1 );
fDontUseHTMLParagraphAutoSpacing = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 2 );
fDontAdjustLineHeightInTable = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 3 );
fForgetLastTabAlign = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 4 );
fUseAutoSpaceForFullWidthAlpha = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 5 );
fAlignTablesRowByRow = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 6 );
fLayoutRawTableWidth = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 7 );
fLayoutTableRowsApart = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 8 );
fUserWord97LineBreakingRules = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 9 );
fDontBreakWrappedTables = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 10 );
fDontSnapToGridInCell = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 11 );
fDontAllowFieldEndSelect = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 12 );
fApplyBreakingRules = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 13 );
fDontWrapTextWithPunct = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 14 );
fDontUseAsianBreakRules = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 15 );
fUseWord2002TableStyleRules = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 16 );
fGrowAutofit = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 17 );
fUseNormalStyleForList = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 18 );
fDontUseIndentAsNumberingTabStop = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 19 );
fFELineBreak11 = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 20 );
fAllowSpaceOfSameStyleInTable = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 21 );
fWW11IndentRules = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 22 );
fDontAutofitConstrainedTables = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 23 );
fAutofitLikeWW11 = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 24 );
fUnderlineTabInNumList = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 25 );
fHangulWidthLikeWW11 = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 26 );
fSplitPgBreakAndParaMark = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 27 );
fDontVertAlignCellWithSp = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 28 );
fDontBreakConstrainedForcedTables = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 29 );
fDontVertAlignInTxbx = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 30 );
fWord11KerningPairs = FormatUtils::GetBitFromBytes( ( bytes + 512 ), 4, 31 );
fCachedColBalance = FormatUtils::GetBitFromBytes( ( bytes + 516 ), 4, 0 );
//bytes 517-539 are unused
//bytes 517-539 are unused
verCompatPreW10 = (unsigned short)FormatUtils::GetUIntFromBytesBits( ( bytes + 540 ), 4, 0, 16 );
fNoMargPgvwSaved = FormatUtils::GetBitFromBytes( ( bytes + 540 ), 4, 16 );
fNoMargPgvWPag = FormatUtils::GetBitFromBytes( ( bytes + 540 ), 4, 17 );
fWebViewPag = FormatUtils::GetBitFromBytes( ( bytes + 540 ), 4, 18 );
fSeeDrawingsPag = FormatUtils::GetBitFromBytes( ( bytes + 540 ), 4, 19 );
fBulletProofed = FormatUtils::GetBitFromBytes( ( bytes + 540 ), 4, 20 );
fCorrupted = FormatUtils::GetBitFromBytes( ( bytes + 540 ), 4, 21 );
fSaveUim = FormatUtils::GetBitFromBytes( ( bytes + 540 ), 4, 22 );
fFilterPrivacy = FormatUtils::GetBitFromBytes( ( bytes + 540 ), 4, 23 );
fInFReplaceNoRM = FormatUtils::GetBitFromBytes( ( bytes + 540 ), 4, 24 );
fSeenRepairs = FormatUtils::GetBitFromBytes( ( bytes + 540 ), 4, 25 );
fHasXML = FormatUtils::GetBitFromBytes( ( bytes + 540 ), 4, 26 );
fSeeScriptAnchorsPag = FormatUtils::GetBitFromBytes( ( bytes + 540 ), 4, 27 );
fValidateXML = FormatUtils::GetBitFromBytes( ( bytes + 540 ), 4, 28 );
fSaveIfInvalidXML = FormatUtils::GetBitFromBytes( ( bytes + 540 ), 4, 29 );
fShowXMLErrors = FormatUtils::GetBitFromBytes( ( bytes + 540 ), 4, 30 );
fAlwaysMergeEmptyNamespace = FormatUtils::GetBitFromBytes( ( bytes + 540 ), 4, 31 );
verCompatPreW10 = (unsigned short)FormatUtils::GetUIntFromBytesBits( ( bytes + 540 ), 4, 0, 16 );
fNoMargPgvwSaved = FormatUtils::GetBitFromBytes( ( bytes + 540 ), 4, 16 );
fNoMargPgvWPag = FormatUtils::GetBitFromBytes( ( bytes + 540 ), 4, 17 );
fWebViewPag = FormatUtils::GetBitFromBytes( ( bytes + 540 ), 4, 18 );
fSeeDrawingsPag = FormatUtils::GetBitFromBytes( ( bytes + 540 ), 4, 19 );
fBulletProofed = FormatUtils::GetBitFromBytes( ( bytes + 540 ), 4, 20 );
fCorrupted = FormatUtils::GetBitFromBytes( ( bytes + 540 ), 4, 21 );
fSaveUim = FormatUtils::GetBitFromBytes( ( bytes + 540 ), 4, 22 );
fFilterPrivacy = FormatUtils::GetBitFromBytes( ( bytes + 540 ), 4, 23 );
fInFReplaceNoRM = FormatUtils::GetBitFromBytes( ( bytes + 540 ), 4, 24 );
fSeenRepairs = FormatUtils::GetBitFromBytes( ( bytes + 540 ), 4, 25 );
fHasXML = FormatUtils::GetBitFromBytes( ( bytes + 540 ), 4, 26 );
fSeeScriptAnchorsPag = FormatUtils::GetBitFromBytes( ( bytes + 540 ), 4, 27 );
fValidateXML = FormatUtils::GetBitFromBytes( ( bytes + 540 ), 4, 28 );
fSaveIfInvalidXML = FormatUtils::GetBitFromBytes( ( bytes + 540 ), 4, 29 );
fShowXMLErrors = FormatUtils::GetBitFromBytes( ( bytes + 540 ), 4, 30 );
fAlwaysMergeEmptyNamespace = FormatUtils::GetBitFromBytes( ( bytes + 540 ), 4, 31 );
if ( size > 544/* && fib->m_FibNew.nFibNew > Fib2000*/)
{
cpMaxListCacheMainDoc = FormatUtils::BytesToInt32( bytes, 544, size ); //unused
cpMaxListCacheMainDoc = FormatUtils::BytesToInt32( bytes, 544, size );
//split bytes 548,549 into bits
fDoNotEmbedSystemFont = FormatUtils::GetBitFromBytes( ( bytes + 548 ), 2, 0 );
fWordCompact = FormatUtils::GetBitFromBytes( ( bytes + 548 ), 2, 1 );
fLiveRecover = FormatUtils::GetBitFromBytes( ( bytes + 548 ), 2, 2 );
fEmbedFactoids = FormatUtils::GetBitFromBytes( ( bytes + 548 ), 2, 3 );
fFactoidXML = FormatUtils::GetBitFromBytes( ( bytes + 548 ), 2, 4 );
fFactoidAllDone = FormatUtils::GetBitFromBytes( ( bytes + 548 ), 2, 5 );
fFolioPrint = FormatUtils::GetBitFromBytes( ( bytes + 548 ), 2, 6 );
fReverseFolio = FormatUtils::GetBitFromBytes( ( bytes + 548 ), 2, 7 );
iTextLineEnding = (short)FormatUtils::GetUIntFromBytesBits( ( bytes + 548 ), 2, 8, 3 );
fHideFcc = FormatUtils::GetBitFromBytes( ( bytes + 548 ), 2, 11 );
fAcetateShowMarkup = FormatUtils::GetBitFromBytes( ( bytes + 548 ), 2, 12 );
fAcetateShowAtn = FormatUtils::GetBitFromBytes( ( bytes + 548 ), 2, 13 );
fAcetateShowInsDel = FormatUtils::GetBitFromBytes( ( bytes + 548 ), 2, 14 );
fAcetateShowProps = FormatUtils::GetBitFromBytes( ( bytes + 548 ), 2, 15 );
//split bytes 548,549 into bits
fDoNotEmbedSystemFont = FormatUtils::GetBitFromBytes( ( bytes + 548 ), 2, 0 );
fWordCompact = FormatUtils::GetBitFromBytes( ( bytes + 548 ), 2, 1 );
fLiveRecover = FormatUtils::GetBitFromBytes( ( bytes + 548 ), 2, 2 );
fEmbedFactoids = FormatUtils::GetBitFromBytes( ( bytes + 548 ), 2, 3 );
fFactoidXML = FormatUtils::GetBitFromBytes( ( bytes + 548 ), 2, 4 );
fFactoidAllDone = FormatUtils::GetBitFromBytes( ( bytes + 548 ), 2, 5 );
fFolioPrint = FormatUtils::GetBitFromBytes( ( bytes + 548 ), 2, 6 );
fReverseFolio = FormatUtils::GetBitFromBytes( ( bytes + 548 ), 2, 7 );
iTextLineEnding = (short)FormatUtils::GetUIntFromBytesBits( ( bytes + 548 ), 2, 8, 3 );
fHideFcc = FormatUtils::GetBitFromBytes( ( bytes + 548 ), 2, 11 );
fAcetateShowMarkup = FormatUtils::GetBitFromBytes( ( bytes + 548 ), 2, 12 );
fAcetateShowAtn = FormatUtils::GetBitFromBytes( ( bytes + 548 ), 2, 13 );
fAcetateShowInsDel = FormatUtils::GetBitFromBytes( ( bytes + 548 ), 2, 14 );
fAcetateShowProps = FormatUtils::GetBitFromBytes( ( bytes + 548 ), 2, 15 );
istdTableDflt = FormatUtils::BytesToUInt16( bytes, 550, size );
verCompat = FormatUtils::BytesToUInt16( bytes, 552, size );
grfFmtFilter = FormatUtils::BytesToUInt16( bytes, 554, size );
iFolioPages = FormatUtils::BytesToInt16 ( bytes, 556, size );
cpgText = FormatUtils::BytesToUInt16( bytes, 558, size );
cpMinRMText = FormatUtils::BytesToInt32 ( bytes, 560, size );
cpMinRMFtn = FormatUtils::BytesToInt32 ( bytes, 564, size );
cpMinRMHdd = FormatUtils::BytesToInt32 ( bytes, 568, size );
cpMinRMAtn = FormatUtils::BytesToInt32 ( bytes, 572, size );
cpMinRMEdn = FormatUtils::BytesToInt32 ( bytes, 576, size );
cpMinRMTxbx = FormatUtils::BytesToInt32 ( bytes, 580, size );
cpMinRMHdrTxbx = FormatUtils::BytesToInt32 ( bytes, 584, size );
rsidRoot = FormatUtils::BytesToInt32 ( bytes, 588, size );
//unused 2
istdTableDflt = FormatUtils::BytesToUInt16( bytes, 550, size );
verCompat = FormatUtils::BytesToUInt16( bytes, 552, size );
grfFmtFilter = FormatUtils::BytesToUInt16( bytes, 554, size );
iFolioPages = FormatUtils::BytesToInt16( bytes, 556, size );
cpgText = FormatUtils::BytesToUInt16( bytes, 558, size );
cpMinRMText = FormatUtils::BytesToInt32( bytes, 560, size );
cpMinRMFtn = FormatUtils::BytesToInt32( bytes, 564, size );
cpMinRMHdd = FormatUtils::BytesToInt32( bytes, 568, size );
cpMinRMAtn = FormatUtils::BytesToInt32( bytes, 572, size );
cpMinRMEdn = FormatUtils::BytesToInt32( bytes, 576, size );
cpMinRMTxbx = FormatUtils::BytesToInt32( bytes, 580, size );
cpMinRMHdrTxbx = FormatUtils::BytesToInt32( bytes, 584, size );
rsidRoot = FormatUtils::BytesToInt32( bytes, 588, size );
if ( size > 594/* && fib->m_FibNew.nFibNew > Fib2002*/)
{
//split bytes 592,593,594,595 into bits
fTreatLockAtnAsReadOnly = FormatUtils::GetBitFromBytes( ( bytes + 592 ), 4, 0 );
fStyleLock = FormatUtils::GetBitFromBytes( ( bytes + 592 ), 4, 1 );
fAutoFmtOverride = FormatUtils::GetBitFromBytes( ( bytes + 592 ), 4, 2 );
fRemoveWordML = FormatUtils::GetBitFromBytes( ( bytes + 592 ), 4, 3 );
fApplyCustomXForm = FormatUtils::GetBitFromBytes( ( bytes + 592 ), 4, 4 );
fStyeLockEnforced = FormatUtils::GetBitFromBytes( ( bytes + 592 ), 4, 5 );
fFakeLockAtn = FormatUtils::GetBitFromBytes( ( bytes + 592 ), 4, 6 );
fIgnoreMixedContent = FormatUtils::GetBitFromBytes( ( bytes + 592 ), 4, 7 );
fShowPlaceholderText = FormatUtils::GetBitFromBytes( ( bytes + 592 ), 4, 8 );
grf = FormatUtils::GetUIntFromBytesBits( ( bytes + 592 ), 4, 9, 23 );
if ( size == 610 )
{
//split bytes 592,593,594,595 into bits
fTreatLockAtnAsReadOnly = FormatUtils::GetBitFromBytes( ( bytes + 592 ), 4, 0 );
fStyleLock = FormatUtils::GetBitFromBytes( ( bytes + 592 ), 4, 1 );
fAutoFmtOverride = FormatUtils::GetBitFromBytes( ( bytes + 592 ), 4, 2 );
fRemoveWordML = FormatUtils::GetBitFromBytes( ( bytes + 592 ), 4, 3 );
fApplyCustomXForm = FormatUtils::GetBitFromBytes( ( bytes + 592 ), 4, 4 );
fStyeLockEnforced = FormatUtils::GetBitFromBytes( ( bytes + 592 ), 4, 5 );
fFakeLockAtn = FormatUtils::GetBitFromBytes( ( bytes + 592 ), 4, 6 );
fIgnoreMixedContent = FormatUtils::GetBitFromBytes( ( bytes + 592 ), 4, 7 );
fShowPlaceholderText = FormatUtils::GetBitFromBytes( ( bytes + 592 ), 4, 8 );
grf = FormatUtils::GetUIntFromBytesBits( ( bytes + 592 ), 4, 9, 23 );
//split bytes 596 and 597 into bits
fReadingModeInkLockDown = FormatUtils::GetBitFromBytes( ( bytes + 596 ), 2, 0 );
fAcetateShowInkAtn = FormatUtils::GetBitFromBytes( ( bytes + 596 ), 2, 1 );
fFilterDttm = FormatUtils::GetBitFromBytes( ( bytes + 596 ), 2, 2 );
fEnforceDocProt = FormatUtils::GetBitFromBytes( ( bytes + 596 ), 2, 3 );
iDocProtCur = (unsigned short)FormatUtils::GetUIntFromBytesBits( ( bytes + 596 ), 2, 4, 3 );
fDispBkSpSaved = FormatUtils::GetBitFromBytes( ( bytes + 596 ), 2, 7 );
//split bytes 596 and 597 into bits
fReadingModeInkLockDown = FormatUtils::GetBitFromBytes( ( bytes + 596 ), 2, 0 );
fAcetateShowInkAtn = FormatUtils::GetBitFromBytes( ( bytes + 596 ), 2, 1 );
fFilterDttm = FormatUtils::GetBitFromBytes( ( bytes + 596 ), 2, 2 );
fEnforceDocProt = FormatUtils::GetBitFromBytes( ( bytes + 596 ), 2, 3 );
iDocProtCur = (unsigned short)FormatUtils::GetUIntFromBytesBits( ( bytes + 596 ), 2, 4, 3 );
fDispBkSpSaved = FormatUtils::GetBitFromBytes( ( bytes + 596 ), 2, 7 );
dxaPageLock = FormatUtils::BytesToInt16( bytes, 598, size );
dyaPageLock = FormatUtils::BytesToInt16( bytes, 600, size );
pctFontLock = FormatUtils::BytesToInt32( bytes, 602, size );
grfitbid = bytes[606];
//unsigned char 607 is unused
ilfoMacAtCleanup = FormatUtils::BytesToUInt16( bytes, 608, size );
}
dxaPageLock = FormatUtils::BytesToInt16( bytes, 598, size );
dyaPageLock = FormatUtils::BytesToInt16( bytes, 600, size );
pctFontLock = FormatUtils::BytesToInt32( bytes, 602, size );
grfitbid = bytes[606];
//unsigned char 607 is unused
ilfoMacAtCleanup = FormatUtils::BytesToUInt16( bytes, 608, size );
if ( size > 616/* && fib->m_FibNew.nFibNew > Fib2003*/)
{
//4 bytes reserved
bool fRMTrackFormatting = FormatUtils::GetBitFromBytes( ( bytes + 620 ), 2, 0 );
bool fRMTrackMoves = FormatUtils::GetBitFromBytes( ( bytes + 620 ), 2, 1 );
//dopMth = 34 bytes from 624 = 658
if ( size > 674/* && fib->m_FibNew.nFibNew > Fib2007*/)
{
if ( size > 690/* && fib->m_FibNew.nFibNew > Fib2010*/)
{
}
}
}
}
}
}
}
}

View File

@ -54,6 +54,7 @@ namespace DocFileFormat
friend class SettingsMapping;
bool bDisplayBackgroundShape;
private:
// True when facing pages should be printed
bool fFacingPages;

View File

@ -49,39 +49,46 @@ namespace DocFileFormat
unsigned char fNested:1;
unsigned char fHasSep:1;
};
public:
static const int STRUCTURE_SIZE = 2;
FieldCharacter():
fldch(0), grffld(0)
{
}
virtual ~FieldCharacter()
{
}
FieldCharacter() : fldch(0), grffld(0) {}
virtual ~FieldCharacter() {}
virtual ByteStructure* ConstructObject (VirtualStreamReader* pReader, int length)
{
FieldCharacter* pFldChar = new FieldCharacter();
FieldCharacter* pFldChar = new FieldCharacter();
if (pFldChar)
{
pFldChar->fldch = pReader->ReadByte();
pFldChar->grffld = pReader->ReadByte();
#ifdef _DEBUG
grffldEnd* __grffldEnd = (grffldEnd*)(&pFldChar->grffld);
int dbg = 0;
#endif
pFldChar->fldch = pReader->ReadByte();
pFldChar->grffld = pReader->ReadByte();
}
return static_cast<ByteStructure*>(pFldChar);
}
private:
unsigned char fldch;
unsigned char grffld;
};
class ListNumCache: public ByteStructure
{
public:
static const int STRUCTURE_SIZE = 4;
ListNumCache() : value(-1) {}
virtual ~ListNumCache() {}
virtual ByteStructure* ConstructObject (VirtualStreamReader* pReader, int length)
{
ListNumCache* pList = new ListNumCache();
if (pList)
{
pList->value = pReader->ReadInt32();
}
return static_cast<ByteStructure*>(pList);
}
int value;
};
}

View File

@ -1162,6 +1162,8 @@ namespace DocFileFormat
{
//Read the FibRgCswNew
m_FibNew.nFibNew = (FibVersion)reader.ReadUInt16();
if (m_FibNew.nFibNew == 0) m_FibNew.nFibNew = Fib1997;
m_FibNew.cQuickSavesNew = reader.ReadUInt16();
}
}

View File

@ -53,33 +53,47 @@ namespace DocFileFormat
m_context->_docx->RegisterDocument();
// Header
m_pXmlWriter->WriteNodeBegin(_T("?xml version=\"1.0\" encoding=\"UTF-8\"?"));
m_pXmlWriter->WriteNodeBegin(_T("w:document"), TRUE );
m_pXmlWriter->WriteNodeBegin(L"?xml version=\"1.0\" encoding=\"UTF-8\"?");
m_pXmlWriter->WriteNodeBegin(L"w:document", TRUE );
// Namespaces
m_pXmlWriter->WriteAttribute(_T("xmlns:w"), OpenXmlNamespaces::WordprocessingML );
m_pXmlWriter->WriteAttribute(_T("xmlns:v"), OpenXmlNamespaces::VectorML );
m_pXmlWriter->WriteAttribute(_T("xmlns:o"), OpenXmlNamespaces::Office );
m_pXmlWriter->WriteAttribute(_T("xmlns:w10"), OpenXmlNamespaces::OfficeWord );
m_pXmlWriter->WriteAttribute(_T("xmlns:r"), OpenXmlNamespaces::Relationships );
m_pXmlWriter->WriteAttribute(_T("xmlns:m"), _T("http://schemas.openxmlformats.org/officeDocument/2006/math"));
m_pXmlWriter->WriteAttribute(L"xmlns:w", OpenXmlNamespaces::WordprocessingML );
m_pXmlWriter->WriteAttribute(L"xmlns:v", OpenXmlNamespaces::VectorML );
m_pXmlWriter->WriteAttribute(L"xmlns:o", OpenXmlNamespaces::Office );
m_pXmlWriter->WriteAttribute(L"xmlns:w10", OpenXmlNamespaces::OfficeWord );
m_pXmlWriter->WriteAttribute(L"xmlns:r", OpenXmlNamespaces::Relationships );
m_pXmlWriter->WriteAttribute(L"xmlns:m", L"http://schemas.openxmlformats.org/officeDocument/2006/math");
//m_pXmlWriter->WriteAttribute(_T("xmlns:wpc"), _T("http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas"));
//m_pXmlWriter->WriteAttribute(_T("xmlns:mc"), _T("http://schemas.openxmlformats.org/markup-compatibility/2006"));
//m_pXmlWriter->WriteAttribute(_T("xmlns:wp14"),_T("http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing"));
//m_pXmlWriter->WriteAttribute(_T("xmlns:wp"), _T("http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"));
//m_pXmlWriter->WriteAttribute(_T("xmlns:w14"), _T("http://schemas.microsoft.com/office/word/2010/wordml"));
//m_pXmlWriter->WriteAttribute(_T("xmlns:wpg"), _T("http://schemas.microsoft.com/office/word/2010/wordprocessingGroup"));
//m_pXmlWriter->WriteAttribute(_T("xmlns:wpi"), _T("http://schemas.microsoft.com/office/word/2010/wordprocessingInk"));
//m_pXmlWriter->WriteAttribute(_T("xmlns:wne"), _T("http://schemas.microsoft.com/office/word/2006/wordml"));
//m_pXmlWriter->WriteAttribute(_T("xmlns:wps"), _T("http://schemas.microsoft.com/office/word/2010/wordprocessingShape"));
//m_pXmlWriter->WriteAttribute(_T("mc:Ignorable"), _T("w14 wp14"));
//m_pXmlWriter->WriteAttribute(L"xmlns:wpc", L"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas");
//m_pXmlWriter->WriteAttribute(L"xmlns:mc", L"http://schemas.openxmlformats.org/markup-compatibility/2006");
//m_pXmlWriter->WriteAttribute(L"xmlns:wp14", L"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing");
//m_pXmlWriter->WriteAttribute(L"xmlns:wp", L"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
//m_pXmlWriter->WriteAttribute(L"xmlns:w14", L"http://schemas.microsoft.com/office/word/2010/wordml");
//m_pXmlWriter->WriteAttribute(L"xmlns:wpg", L"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup");
//m_pXmlWriter->WriteAttribute(L"xmlns:wpi", L"http://schemas.microsoft.com/office/word/2010/wordprocessingInk");
//m_pXmlWriter->WriteAttribute(L"xmlns:wne", L"http://schemas.microsoft.com/office/word/2006/wordml");
//m_pXmlWriter->WriteAttribute(L"xmlns:wps", L"http://schemas.microsoft.com/office/word/2010/wordprocessingShape");
//m_pXmlWriter->WriteAttribute(L"mc:Ignorable", L"w14 wp14");
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE );
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
m_pXmlWriter->WriteNodeBegin( _T("w:body"), FALSE );
if ((m_document->GetOfficeArt()) && (m_document->GetOfficeArt()->GetShapeBackgound()))
{
m_document->DocProperties->bDisplayBackgroundShape = true;
ShapeContainer* pShape = m_document->GetOfficeArt()->GetShapeBackgound();
// Convert the document
m_pXmlWriter->WriteNodeBegin ( L"w:background", TRUE);
m_pXmlWriter->WriteAttribute ( L"w:color", L"FFFFFF");
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
VMLShapeMapping oVmlWriter (m_context, m_pXmlWriter, NULL, NULL, _caller);
pShape->Convert(&oVmlWriter);
m_pXmlWriter->WriteNodeEnd (L"w:background");
}
m_pXmlWriter->WriteNodeBegin( L"w:body", FALSE );
// Convert the document
_lastValidPapx = NULL;
if (m_document->AllPapxFkps->empty() == false)
{
@ -175,8 +189,8 @@ namespace DocFileFormat
}
}
m_pXmlWriter->WriteNodeEnd( _T( "w:body" ) );
m_pXmlWriter->WriteNodeEnd( _T( "w:document" ) );
m_pXmlWriter->WriteNodeEnd( L"w:body" );
m_pXmlWriter->WriteNodeEnd( L"w:document" );
m_context->_docx->DocumentXML = std::wstring(m_pXmlWriter->GetXmlString());
}

View File

@ -34,6 +34,7 @@
#include "OfficeDrawing/RecordFactory.h"
#include "OfficeDrawing/DrawingContainer.h"
#include "OfficeDrawing/DrawingRecord.h"
#include "OfficeDrawing/DrawingGroup.h"
#include "OfficeDrawing/GroupContainer.h"
#include "OfficeDrawing/Shape.h"
@ -57,7 +58,7 @@ namespace DocFileFormat
public:
OfficeArtContent (const FileInformationBlock* pFIB, POLE::Stream* pStream): m_pDrawingGroupData(NULL)
OfficeArtContent (const FileInformationBlock* pFIB, POLE::Stream* pStream): m_pDrawingGroupData(NULL), m_pBackgroud(NULL)
{
VirtualStreamReader oStearmReader(pStream, 0 , pFIB->m_bOlderVersion);
@ -87,15 +88,23 @@ namespace DocFileFormat
{
// the child is a subgroup
GroupContainer* group = static_cast<GroupContainer*>(groupChild);
group->Index = i;
drawing.container->Children[i] = group;
if (group)
{
group->Index = i;
}
}
else if (ShapeContainer::TYPE_CODE_0xF004 == groupChild->TypeCode)
{
// the child is a shape
ShapeContainer* shape = static_cast<ShapeContainer*>(groupChild);
shape->Index = i;
drawing.container->Children[i] = shape;
if (shape)
{
shape->Index = i;
if (shape->isBackground())
{
m_pBackgroud = shape;
}
}
}
}
}
@ -112,7 +121,10 @@ namespace DocFileFormat
for ( std::list<OfficeArtWordDrawing>::iterator iter = m_arrDrawings.begin(); iter != m_arrDrawings.end(); ++iter)
RELEASEOBJECT(iter->container);
}
inline ShapeContainer* GetShapeBackgound()
{
return m_pBackgroud;
}
inline ShapeContainer* GetShapeContainer (int spid)
{
ShapeContainer* ret = NULL;
@ -138,7 +150,6 @@ namespace DocFileFormat
if (shape->GetShapeID() == spid)
{
ret = container;
break;
}
}
@ -150,7 +161,7 @@ namespace DocFileFormat
if (shape->GetShapeID() == spid)
{
ret = container;
ret = container;
break;
}
}
@ -174,7 +185,7 @@ namespace DocFileFormat
}
private:
ShapeContainer* m_pBackgroud;
DrawingGroup* m_pDrawingGroupData;
std::list<OfficeArtWordDrawing> m_arrDrawings;
};

View File

@ -39,11 +39,9 @@ namespace DocFileFormat
{
public:
static const unsigned short TYPE_CODE_0xF008 = 0xF008;
/// The number of shapes in this drawing
unsigned int csp;
/// The last MSOSPID given to an SP in this DG
int spidCur;
unsigned int csp; // The number of shapes in this drawing
int spidCur; // The last MSOSPID given to an SP in this DG
DrawingRecord():
Record(), csp(0), spidCur(0)
@ -53,8 +51,8 @@ namespace DocFileFormat
DrawingRecord( IBinaryReader* _reader, unsigned int size, unsigned int typeCode, unsigned int version, unsigned int instance ):
Record( _reader, size, typeCode, version, instance )
{
this->csp = this->Reader->ReadUInt32();
this->spidCur = this->Reader->ReadInt32();
csp = Reader->ReadUInt32();
spidCur = Reader->ReadInt32();
}
virtual ~DrawingRecord()

View File

@ -93,29 +93,23 @@ namespace DocFileFormat
{
case ShapeContainer::TYPE_CODE_0xF004:
return new ShapeContainer();
break;
case Shape::TYPE_CODE_0xF00A:
return new Shape();
break;
case ShapeOptions::TYPE_CODE_0xF00B:
case ShapeOptions::TYPE_CODE_0xF121:
case ShapeOptions::TYPE_CODE_0xF122:
return new ShapeOptions();
break;
case ClientAnchor::TYPE_CODE_0xF010:
return new ClientAnchor();
break;
case ChildAnchor::TYPE_CODE_0xF00F:
return new ChildAnchor();
break;
case BlipStoreEntry::TYPE_CODE_0xF007:
return new BlipStoreEntry();
break;
case BitmapBlip::TYPE_CODE_0xF01D: //OfficeArtBlipJPEG
case BitmapBlip::TYPE_CODE_0xF01E: //OfficeArtBlipPNG
@ -125,25 +119,25 @@ namespace DocFileFormat
case BitmapBlip::TYPE_CODE_0xF029: //OfficeArtBlipTIFF
case BitmapBlip::TYPE_CODE_0xF02A: //OfficeArtBlipJPEG
return new BitmapBlip();
break;
case MetafilePictBlip::TYPE_CODE_0xF01A: //OfficeArtBlipEMF
case MetafilePictBlip::TYPE_CODE_0xF01B: //OfficeArtBlipWMF
case MetafilePictBlip::TYPE_CODE_0xF01C : //OfficeArtBlipPICT
return new MetafilePictBlip(); break;
return new MetafilePictBlip();
case DrawingGroup::TYPE_CODE_0xF000 : return new DrawingGroup(); break;
case DrawingGroupRecord::TYPE_CODE_0xF006 : return new DrawingGroupRecord(); break;
case BlipStoreContainer::TYPE_CODE_0xF001 : return new BlipStoreContainer(); break;
case SplitMenuColorContainer::TYPE_CODE_0xF11E : return new SplitMenuColorContainer(); break;
case ClientData::TYPE_CODE_0xF011 : return new ClientData(); break;
case DrawingContainer::TYPE_CODE_0xF002 : return new DrawingContainer(); break;
case DrawingRecord::TYPE_CODE_0xF008 : return new DrawingRecord(); break;
case GroupContainer::TYPE_CODE_0xF003 : return new GroupContainer(); break;
case GroupShapeRecord::TYPE_CODE_0xF009 : return new GroupShapeRecord (); break;
case OfficeArtClientTextbox::TYPE_CODE_0xF00D : return new OfficeArtClientTextbox (); break;
case DrawingGroup::TYPE_CODE_0xF000 : return new DrawingGroup();
case DrawingGroupRecord::TYPE_CODE_0xF006 : return new DrawingGroupRecord();
case BlipStoreContainer::TYPE_CODE_0xF001 : return new BlipStoreContainer();
case SplitMenuColorContainer::TYPE_CODE_0xF11E : return new SplitMenuColorContainer();
case ClientData::TYPE_CODE_0xF011 : return new ClientData();
case DrawingContainer::TYPE_CODE_0xF002 : return new DrawingContainer();
case DrawingRecord::TYPE_CODE_0xF008 : return new DrawingRecord();
case GroupContainer::TYPE_CODE_0xF003 : return new GroupContainer();
case GroupShapeRecord::TYPE_CODE_0xF009 : return new GroupShapeRecord ();
case OfficeArtClientTextbox::TYPE_CODE_0xF00D : return new OfficeArtClientTextbox ();
default: return new UnknownRecord(); break;
default:
return new UnknownRecord();
}
}
}

View File

@ -39,33 +39,20 @@ namespace DocFileFormat
class Shape: public Record
{
public:
int spid;
/// This shape is a group shape
bool fGroup;
/// Not a top-level shape
bool fChild;
/// This is the topmost group shape.
/// Exactly one of these per drawing.
bool fPatriarch;
/// The shape has been deleted
bool fDeleted;
/// The shape is an OLE object
bool fOleShape;
/// Shape has a hspMaster property
bool fHaveMaster;
/// Shape is flipped horizontally
bool fFlipH;
/// Shape is flipped vertically
bool fFlipV;
/// Connector type of shape
bool fConnector;
/// Shape has an anchor of some kind
bool fHaveAnchor;
/// Background shape
bool fBackground;
/// Shape has a shape type property
bool fHaveSpt;
/// The shape type of the shape
int spid;
bool fGroup;
bool fChild;
bool fPatriarch; // This is the topmost group shape. Exactly one of these per drawing.
bool fDeleted; // The shape has been deleted
bool fOleShape; // The shape is an OLE object
bool fHaveMaster;
bool fFlipH;
bool fFlipV;
bool fConnector;
bool fHaveAnchor;
bool fBackground;
bool fHaveSpt;
ShapeType* shapeType;
public:
@ -80,7 +67,7 @@ namespace DocFileFormat
virtual ~Shape()
{
RELEASEOBJECT( this->shapeType );
RELEASEOBJECT( shapeType );
}
Shape( IBinaryReader* _reader, unsigned int size, unsigned int typeCode, unsigned int version, unsigned int instance ):
@ -120,12 +107,12 @@ namespace DocFileFormat
inline int GetShapeID() const
{
return this->spid;
return spid;
}
inline ShapeType* GetShapeType() const
{
return this->shapeType;
return shapeType;
}
template<class T> bool is() const

View File

@ -69,7 +69,34 @@ namespace DocFileFormat
}
return 0;
}
bool isBackground()
{
int ret = 0;
for ( std::vector<Record*>::const_iterator iter = this->Children.begin(); iter != this->Children.end(); iter++ )
{
Shape* sh = dynamic_cast<Shape*>( *iter );
if (sh)
{
return sh->fBackground;
}
}
return false;
}
bool isOLE()
{
int ret = 0;
for ( std::vector<Record*>::const_iterator iter = this->Children.begin(); iter != this->Children.end(); iter++ )
{
Shape* sh = dynamic_cast<Shape*>( *iter );
if (sh)
{
return sh->fOleShape;
}
}
return false;
}
virtual ~ShapeContainer()
{
}
@ -79,7 +106,6 @@ namespace DocFileFormat
return new ShapeContainer( _reader, bodySize, typeCode, version, instance );
}
/// Searches all OptionEntry in the ShapeContainer and puts them into a list.
std::list<OptionEntry> ExtractOptions() const
{
std::list<OptionEntry> ret;

View File

@ -0,0 +1,303 @@
/*
* (c) Copyright Ascensio System SIA 2010-2016
*
* 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 "OleObject.h"
namespace DocFileFormat
{
OleObject::OleObject( const CharacterPropertyExceptions* chpx, StructuredStorageReader* docStorage, bool bOlderVersion_ )
: bLinked(false), updateMode(NoLink), bOlderVersion(bOlderVersion_), isEquation(false), isEmbedded (false)
{
if (!docStorage) return;
if (!chpx) return;
oleStorage = docStorage->GetStorage();
if (!oleStorage) return;
HRESULT res = S_OK;
POLE::Stream* ObjectPoolStorage = new POLE::Stream(oleStorage, "ObjectPool");
if (ObjectPoolStorage)
{
ObjectId = getOleEntryName( chpx );
std::string sObjectId( ObjectId.begin(), ObjectId.end() );
{
std::string name = "ObjectPool/" + sObjectId + "/";
processOleStream( name + "Ole" );
if ( bLinked )
{
processLinkInfoStream( name + "LinkInfo" );
}
else
{
processCompObjStream( name + "CompObj" );
}
processPICStream( name + "PIC" );
processEquationNativeStream( name + "Equation Native" );
}
delete ObjectPoolStorage;
}
}
void OleObject::processLinkInfoStream( const std::string& linkStream )
{
try
{
POLE::Stream* pLinkStream = NULL;
HRESULT res = S_OK;
pLinkStream = //oleStorage->stream(linkStream);
new POLE::Stream(oleStorage, linkStream);
if ( pLinkStream )
{
VirtualStreamReader reader( pLinkStream, 0, false);
//there are two versions of the Link string, one contains ANSI characters, the other contains
//unicode characters.
//Both strings seem not to be standardized:
//The length prefix is a character count EXCLUDING the terminating zero
//Read the ANSI version
short cch = reader.ReadInt16();
unsigned char* str = reader.ReadBytes( cch, true );
FormatUtils::GetSTLCollectionFromBytes<std::wstring>( &this->Link, str, cch, ENCODING_WINDOWS_1250 );
RELEASEARRAYOBJECTS( str );
//skip the terminating zero of the ANSI string
//even if the characters are ANSI chars, the terminating zero has 2 bytes
reader.ReadBytes( 2, false );
//skip the next 4 bytes (flags?)
reader.ReadBytes( 4, false );
//Read the Unicode version
this->Link.clear();
cch = reader.ReadInt16();
str = reader.ReadBytes( ( cch * 2 ), true );
FormatUtils::GetSTLCollectionFromBytes<std::wstring>( &this->Link, str, ( cch * 2 ), ENCODING_UTF16 );
RELEASEARRAYOBJECTS( str );
//skip the terminating zero of the Unicode string
reader.ReadBytes( 2, false );
delete pLinkStream;
}
}
catch (...)
{
}
}
void OleObject::processEquationNativeStream( const std::string& eqStream )
{
try
{
POLE::Stream* pCompStream = NULL;
HRESULT res = S_OK;
pCompStream = new POLE::Stream(oleStorage, eqStream);
if ( pCompStream )
{
VirtualStreamReader reader( pCompStream, 0, false);
int sz = reader.GetSize();
unsigned char *Buffer = reader.ReadBytes( sz, true );
if (Buffer && sz > 0)
{
isEquation = true;
delete []Buffer;
}
delete pCompStream;
}
}
catch (...)
{
}
}
void OleObject::processPICStream( const std::string& picStream )
{
try
{
HRESULT res = S_OK;
POLE::Stream* pPICStream = new POLE::Stream(oleStorage, picStream);
if ( pPICStream )
{
VirtualStreamReader reader( pPICStream, 0, false);
int sz = reader.GetSize();
int cbHeader = reader.ReadUInt32();
reader.ReadBytes(4, false);
int x = reader.ReadUInt32();
int y = reader.ReadUInt32();
pictureDesciptor.dyaGoal = reader.ReadUInt32();
pictureDesciptor.dxaGoal = reader.ReadUInt32();
reader.ReadBytes(20, false);
pictureDesciptor.mx = reader.ReadUInt32();
pictureDesciptor.my = reader.ReadUInt32();
}
}
catch (...)
{
}
}
void OleObject::processCompObjStream( const std::string& compStream )
{
try
{
HRESULT res = S_OK;
POLE::Stream* pCompStream = new POLE::Stream(oleStorage, compStream);
if ( pCompStream )
{
VirtualStreamReader reader( pCompStream, 0, false);
//skip the CompObjHeader
reader.ReadBytes( 28, false );
int sz_obj = reader.GetSize() - reader.GetPosition();
if (sz_obj > 4)
{
UserType = reader.ReadLengthPrefixedAnsiString(sz_obj);
sz_obj = reader.GetSize() - reader.GetPosition();
if (sz_obj > 4)
ClipboardFormat = reader.ReadLengthPrefixedAnsiString(sz_obj);
sz_obj = reader.GetSize() - reader.GetPosition();
if (sz_obj > 4)
Program = reader.ReadLengthPrefixedAnsiString(sz_obj);
}
delete pCompStream;
}
}
catch (...)
{
}
}
void OleObject::processOleStream( const std::string& oleStreamName )
{
try
{
POLE::Stream* pOleStream;
HRESULT res = S_OK;
pOleStream = new POLE::Stream(oleStorage, oleStreamName);
if ( pOleStream )
{
VirtualStreamReader reader( pOleStream, 0, false );
//skip version
reader.ReadBytes( 4, false );
//read the embedded/linked flag
int flag = reader.ReadInt32();
bLinked = FormatUtils::BitmaskToBool( flag, 0x1 );
//Link update option
this->updateMode = (LinkUpdateOption)reader.ReadInt32();
switch ( this->updateMode )
{
case NoLink:
{
this->UpdateMode = L"NoLink";
}
break;
case Always:
{
this->UpdateMode = L"Always";
}
break;
case OnCall:
{
this->UpdateMode = L"OnCall";
}
break;
}
delete pOleStream;
}
}
catch (...)
{
}
}
std::wstring OleObject::getOleEntryName( const CharacterPropertyExceptions* chpx )
{
std::wstring ret;
if ( chpx != NULL )
{
for ( std::list<SinglePropertyModifier>::const_iterator iter = chpx->grpprl->begin(); iter != chpx->grpprl->end(); iter++ )
{
if ( iter->OpCode == sprmCPicLocation || iter->OpCode == sprmOldCPicLocation)
{
ret = ( L"_" + FormatUtils::IntToWideString( FormatUtils::BytesToUInt32( iter->Arguments, 0, iter->argumentsSize ) ) );
break;
}
}
}
return ret;
}
}

View File

@ -68,276 +68,18 @@ namespace DocFileFormat
PictureDescriptor pictureDesciptor;
OleObject( const CharacterPropertyExceptions* chpx, StructuredStorageReader* docStorage, bool bOlderVersion_ )
: bLinked(false), updateMode(NoLink), bOlderVersion(bOlderVersion_)
{
isEquation = isEmbedded = false;
oleStorage = docStorage->GetStorage();
if ( ( chpx != NULL ) && ( docStorage != NULL ) )
{
HRESULT res = S_OK;
POLE::Stream* ObjectPoolStorage = new POLE::Stream(oleStorage, "ObjectPool");
if (ObjectPoolStorage)
{
ObjectId = getOleEntryName( chpx );
std::string sObjectId( ObjectId.begin(), ObjectId.end() );
{
std::string name = "ObjectPool/" + sObjectId + "/";
processOleStream( name + "Ole" );
if ( bLinked )
{
processLinkInfoStream( name + "LinkInfo" );
}
else
{
processCompObjStream( name + "CompObj" );
}
processPICStream( name + "PIC" );
processEquationNativeStream( name + "Equation Native" );
}
delete ObjectPoolStorage;
}
}
}
virtual ~OleObject()
{
}
OleObject( const CharacterPropertyExceptions* chpx, StructuredStorageReader* docStorage, bool bOlderVersion_ );
virtual ~OleObject() {}
private:
POLE::Storage *oleStorage;
void processLinkInfoStream( const std::string& linkStream )
{
try
{
POLE::Stream* pLinkStream = NULL;
HRESULT res = S_OK;
void processLinkInfoStream ( const std::string& linkStream );
void processEquationNativeStream( const std::string& eqStream );
void processPICStream ( const std::string& picStream );
void processCompObjStream ( const std::string& compStream );
void processOleStream ( const std::string& oleStreamName );
pLinkStream = //oleStorage->stream(linkStream);
new POLE::Stream(oleStorage, linkStream);
if ( pLinkStream )
{
VirtualStreamReader reader( pLinkStream, 0, false);
//there are two versions of the Link string, one contains ANSI characters, the other contains
//unicode characters.
//Both strings seem not to be standardized:
//The length prefix is a character count EXCLUDING the terminating zero
//Read the ANSI version
short cch = reader.ReadInt16();
unsigned char* str = reader.ReadBytes( cch, true );
FormatUtils::GetSTLCollectionFromBytes<std::wstring>( &this->Link, str, cch, ENCODING_WINDOWS_1250 );
RELEASEARRAYOBJECTS( str );
//skip the terminating zero of the ANSI string
//even if the characters are ANSI chars, the terminating zero has 2 bytes
reader.ReadBytes( 2, false );
//skip the next 4 bytes (flags?)
reader.ReadBytes( 4, false );
//Read the Unicode version
this->Link.clear();
cch = reader.ReadInt16();
str = reader.ReadBytes( ( cch * 2 ), true );
FormatUtils::GetSTLCollectionFromBytes<std::wstring>( &this->Link, str, ( cch * 2 ), ENCODING_UTF16 );
RELEASEARRAYOBJECTS( str );
//skip the terminating zero of the Unicode string
reader.ReadBytes( 2, false );
delete pLinkStream;
}
}
catch (...)
{
}
}
void processEquationNativeStream( const std::string& eqStream )
{
try
{
POLE::Stream* pCompStream = NULL;
HRESULT res = S_OK;
pCompStream = new POLE::Stream(oleStorage, eqStream);
if ( pCompStream )
{
VirtualStreamReader reader( pCompStream, 0, false);
int sz = reader.GetSize();
unsigned char *Buffer = reader.ReadBytes( sz, true );
if (Buffer && sz > 0)
{
isEquation = true;
delete []Buffer;
}
delete pCompStream;
}
}
catch (...)
{
}
}
void processPICStream( const std::string& picStream )
{
try
{
HRESULT res = S_OK;
POLE::Stream* pPICStream = new POLE::Stream(oleStorage, picStream);
if ( pPICStream )
{
VirtualStreamReader reader( pPICStream, 0, false);
int sz = reader.GetSize();
int cbHeader = reader.ReadUInt32();
reader.ReadBytes(4, false);
int x = reader.ReadUInt32();
int y = reader.ReadUInt32();
pictureDesciptor.dyaGoal = reader.ReadUInt32();
pictureDesciptor.dxaGoal = reader.ReadUInt32();
reader.ReadBytes(20, false);
pictureDesciptor.mx = reader.ReadUInt32();
pictureDesciptor.my = reader.ReadUInt32();
}
}
catch (...)
{
}
}
void processCompObjStream( const std::string& compStream )
{
try
{
HRESULT res = S_OK;
POLE::Stream* pCompStream = new POLE::Stream(oleStorage, compStream);
if ( pCompStream )
{
VirtualStreamReader reader( pCompStream, 0, false);
//skip the CompObjHeader
reader.ReadBytes( 28, false );
int sz_obj = reader.GetSize() - reader.GetPosition();
if (sz_obj > 4)
{
UserType = reader.ReadLengthPrefixedAnsiString(sz_obj);
sz_obj = reader.GetSize() - reader.GetPosition();
if (sz_obj > 4)
ClipboardFormat = reader.ReadLengthPrefixedAnsiString(sz_obj);
sz_obj = reader.GetSize() - reader.GetPosition();
if (sz_obj > 4)
Program = reader.ReadLengthPrefixedAnsiString(sz_obj);
}
delete pCompStream;
}
}
catch (...)
{
}
}
void processOleStream( const std::string& oleStreamName )
{
try
{
POLE::Stream* pOleStream;
HRESULT res = S_OK;
pOleStream = new POLE::Stream(oleStorage, oleStreamName);
if ( pOleStream )
{
VirtualStreamReader reader( pOleStream, 0, false );
//skip version
reader.ReadBytes( 4, false );
//read the embedded/linked flag
int flag = reader.ReadInt32();
bLinked = FormatUtils::BitmaskToBool( flag, 0x1 );
//Link update option
this->updateMode = (LinkUpdateOption)reader.ReadInt32();
switch ( this->updateMode )
{
case NoLink:
{
this->UpdateMode = _T( "NoLink" );
}
break;
case Always:
{
this->UpdateMode = _T( "Always" );
}
break;
case OnCall:
{
this->UpdateMode = _T( "OnCall" );
}
break;
}
delete pOleStream;
}
}
catch (...)
{
}
}
std::wstring getOleEntryName( const CharacterPropertyExceptions* chpx )
{
std::wstring ret;
if ( chpx != NULL )
{
for ( std::list<SinglePropertyModifier>::const_iterator iter = chpx->grpprl->begin(); iter != chpx->grpprl->end(); iter++ )
{
if ( iter->OpCode == sprmCPicLocation || iter->OpCode == sprmOldCPicLocation)
{
ret = ( _T( "_" ) + FormatUtils::IntToWideString( FormatUtils::BytesToUInt32( iter->Arguments, 0, iter->argumentsSize ) ) );
break;
}
}
}
return ret;
}
};
std::wstring getOleEntryName ( const CharacterPropertyExceptions* chpx );
};
}

View File

@ -67,7 +67,6 @@ namespace DocFileFormat
}
m_pXmlWriter->WriteNodeBegin( _T( "o:OLEObject" ), TRUE );
//type
if ( ole->bLinked )
{
int relID = m_context->_docx->RegisterExternalOLEObject(_caller, ole->ClipboardFormat, ole->Link);
@ -88,22 +87,13 @@ namespace DocFileFormat
m_pXmlWriter->WriteAttribute( _T( "r:id" ), ( std::wstring( _T( "rId" ) ) + FormatUtils::IntToWideString( relID ) ).c_str() );
m_pXmlWriter->WriteAttribute( _T( "Type" ), _T( "Embed" ) );
//copy the object
copyEmbeddedObject( ole );
}
//ProgID
m_pXmlWriter->WriteAttribute( _T( "ProgID" ), ole->Program.c_str() );
//ShapeId
m_pXmlWriter->WriteAttribute( _T( "ShapeID" ), _shapeId.c_str() );
//DrawAspect
m_pXmlWriter->WriteAttribute( _T( "DrawAspect" ), _T( "Content" ) );
//ObjectID
m_pXmlWriter->WriteAttribute( _T( "ObjectID" ), ole->ObjectId.c_str() );
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE );
m_pXmlWriter->WriteNodeEnd( _T( "o:OLEObject" ) );
@ -165,20 +155,15 @@ namespace DocFileFormat
}
private:
// Writes the embedded OLE object from the ObjectPool of the binary file to the OpenXml Package.
inline void copyEmbeddedObject( const OleObject* ole )
{
if ( ole != NULL )
{
//!!!TODO: There is issue with some Office OLE Objects. Word can't open *.xls object (Excel.Chart) with set CLSID and
//some Power Point Presentations, and Word Documents. Open Office CAN start this objects!!!
std::wstring clsid;
std::wstring exelChart = _T( "Excel.Chart" );
if ( std::search( ole->Program.begin(), ole->Program.end(), exelChart.begin(), exelChart.end() ) == ole->Program.end() )
{//??
{
clsid = ole->ClassId;
}
OleObjectFileStructure object_descr(OleObjectMapping::GetTargetExt( ole->ClipboardFormat ), ole->ObjectId, clsid);

View File

@ -73,10 +73,7 @@ namespace DocFileFormat
RELEASEOBJECT(_pPr);
RELEASEOBJECT(_framePr);
}
}
namespace DocFileFormat
{
int ParagraphPropertiesMapping::get_section_page_break()
{
return _isSectionPageBreak;
@ -148,14 +145,12 @@ namespace DocFileFormat
case sprmPFAutoSpaceDE:
{
appendFlagElement(_pPr, *iter, _T( "autoSpaceDE" ), true);
}
break;
}break;
case sprmPFAutoSpaceDN:
{
appendFlagElement( _pPr, *iter, _T( "autoSpaceDN" ), true );
}
break;
}break;
case sprmPFBiDi:
{
@ -248,8 +243,7 @@ namespace DocFileFormat
}
appendValueAttribute( &ind, flName.c_str(), flValue );
}
break;
}break;
case sprmPDxcLeft1:
appendValueAttribute( &ind, _T( "w:firstLineChars" ), FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
@ -305,10 +299,9 @@ namespace DocFileFormat
//no line rule means auto
spacing.AppendAttribute( lineRule );
}
break;
}break;
//justification code
//justification code
case sprmOldPJc:
case sprmPJc:
case sprmPJc80:
@ -318,13 +311,14 @@ namespace DocFileFormat
iter->Arguments[0] = (iter->Arguments[0] == 0 ? 2 : 0);
}
RELEASEOBJECT( jc );
jc = new XMLTools::XMLElement<wchar_t>( _T( "w:jc" ) );
XMLTools::XMLAttribute<wchar_t> jcVal( _T( "w:val" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::JustificationCode[0][0], 10, 15 ).c_str() );
jc->AppendAttribute( jcVal );
}
break;
//borders
jc = new XMLTools::XMLElement<wchar_t>( L"w:jc" );
if ( jc )
{
XMLTools::XMLAttribute<wchar_t> jcVal( L"w:val", FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::JustificationCode[0][0], 10, 15 ).c_str() );
jc->AppendAttribute( jcVal );
}
}break;
//borders
//case 0x461C:
case sprmOldPBrcTop:
case sprmPBrcTop:
@ -338,8 +332,7 @@ namespace DocFileFormat
appendBorderAttributes( &bc, &topBorder );
addOrSetBorder( &pBdr, &topBorder );
}
break;
}break;
//case 0x461D:
case sprmOldPBrcLeft:
@ -354,8 +347,7 @@ namespace DocFileFormat
appendBorderAttributes( &bc, &leftBorder );
addOrSetBorder( &pBdr, &leftBorder );
}
break;
}break;
//case 0x461E:
case sprmOldPBrcBottom:
@ -370,9 +362,8 @@ namespace DocFileFormat
appendBorderAttributes( &bc, &bottomBorder );
addOrSetBorder( &pBdr, &bottomBorder );
}
break;
}break;
//case 0x461F:
case sprmOldPBrcRight:
case sprmPBrcRight:
@ -386,8 +377,7 @@ namespace DocFileFormat
appendBorderAttributes( &bc, &rightBorder );
addOrSetBorder( &pBdr, &rightBorder );
}
break;
}break;
//case 0x4620:
case sprmOldPBrcBetween:
@ -402,8 +392,7 @@ namespace DocFileFormat
appendBorderAttributes( &bc, &betweenBorder );
addOrSetBorder( &pBdr, &betweenBorder );
}
break;
}break;
//case 0x4621:
case sprmOldPBrcBar:
@ -418,18 +407,17 @@ namespace DocFileFormat
appendBorderAttributes( &bc, &barBorder );
addOrSetBorder( &pBdr, &barBorder );
}
break;
}break;
//shading
//shading
case sprmPShd80:
case sprmPShd:
{
ShadingDescriptor desc( iter->Arguments, iter->argumentsSize );
appendShading( _pPr, desc );
}
break;
}break;
//numbering
case sprmOldPAnld:
@ -467,8 +455,10 @@ namespace DocFileFormat
}break;
case sprmPIlfo:
{
{
//Если numbering.xml пустой, то не пищем свойство
//Todo разобраться с закоментированным кодом
if (NULL != m_document->listTable && false == m_document->listTable->listData.empty())
{
appendValueElement( &numPr, _T( "numId" ), FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize ), true );
}
@ -485,8 +475,8 @@ namespace DocFileFormat
// appendValueElement(numPr, "ilvl", "0", true);
// }
//}
}
break;
}
break;
case sprmOldPChgTabs: //tabs
@ -663,28 +653,24 @@ namespace DocFileFormat
//append indent
if ( ind.GetAttributeCount() > 0 )
{
_pPr->AppendChild( ind );
}
{
_pPr->AppendChild( ind );
}
if ( spacing.GetAttributeCount() > 0 )//append spacing
{
_pPr->AppendChild( spacing );
}
{
_pPr->AppendChild( spacing );
}
if ( jc ) //append justification
{
_pPr->AppendChild( *jc );
RELEASEOBJECT( jc );
}
_pPr->AppendChild( *jc );
RELEASEOBJECT( jc );
}
if ( numPr.GetChildCount() > 0 )//append numPr
{
_pPr->AppendChild( numPr );
}
{
_pPr->AppendChild( numPr );
}
if ( pBdr.GetChildCount() > 0 ) //append borders

View File

@ -46,26 +46,25 @@ namespace DocFileFormat
class ParagraphPropertiesMapping: public PropertiesMapping, public IMapping
{
public:
ParagraphPropertiesMapping( XMLTools::CStringXmlWriter* writer, ConversionContext* ctx, WordDocument* document, CharacterPropertyExceptions* paraEndChpx, bool isBidi, bool isParagraphStyleNeeded = true );
ParagraphPropertiesMapping( XMLTools::CStringXmlWriter* writer, ConversionContext* ctx, WordDocument* document, CharacterPropertyExceptions* paraEndChpx, bool isBidi, SectionPropertyExceptions* sepx, int sectionNr, bool isParagraphStyleNeeded = true );
ParagraphPropertiesMapping ( XMLTools::CStringXmlWriter* writer, ConversionContext* ctx, WordDocument* document, CharacterPropertyExceptions* paraEndChpx, bool isBidi, bool isParagraphStyleNeeded = true );
ParagraphPropertiesMapping ( XMLTools::CStringXmlWriter* writer, ConversionContext* ctx, WordDocument* document, CharacterPropertyExceptions* paraEndChpx, bool isBidi, SectionPropertyExceptions* sepx, int sectionNr, bool isParagraphStyleNeeded = true );
virtual ~ParagraphPropertiesMapping();
void Apply(IVisitable* visited);
int get_section_page_break();
private:
WordDocument* m_document;
ConversionContext* m_context;
WordDocument* m_document;
ConversionContext* m_context;
XMLTools::XMLElement<wchar_t>* _pPr;
XMLTools::XMLElement<wchar_t>* _framePr;
SectionPropertyExceptions* _sepx;
CharacterPropertyExceptions* _paraEndChpx;
int _sectionNr;
XMLTools::XMLElement<wchar_t>* _pPr;
XMLTools::XMLElement<wchar_t>* _framePr;
SectionPropertyExceptions* _sepx;
CharacterPropertyExceptions* _paraEndChpx;
int _sectionNr;
bool _isParagraphStyleNeeded;
bool _isBidi;
int _isSectionPageBreak;
bool _isParagraphStyleNeeded;
bool _isBidi;
int _isSectionPageBreak;
};
}

View File

@ -79,8 +79,8 @@ namespace DocFileFormat
//rgbColor6.Format( _T( "%02x%02x%02x" ), /*R*/this->Red, /*G*/this->Green, /*B*/this->Blue );
//rgbColor8.Format( _T( "%02x%02x%02x%02x" ), /*R*/this->Red, /*G*/this->Green, /*B*/this->Blue, /*A*/this->Alpha );
//SixDigitHexCode = string2std_string( rgbColor6 );
//EightDigitHexCode = string2std_string( rgbColor8 );
//SixDigitHexCode = rgbColor6;
//EightDigitHexCode = rgbColor8;
rgbColor6 << boost::wformat( L"%02x%02x%02x" ) % /*R*/this->Red % /*G*/this->Green % /*B*/this->Blue;
rgbColor8 << boost::wformat( L"%02x%02x%02x%02x" ) % /*R*/this->Red % /*G*/this->Green % /*B*/this->Blue % /*A*/this->Alpha;
@ -101,8 +101,8 @@ namespace DocFileFormat
//rgbColor6.Format( _T( "%02x%02x%02x" ), /*R*/this->Red, /*G*/this->Green, /*B*/this->Blue );
//rgbColor8.Format( _T( "%02x%02x%02x%02x" ), /*R*/this->Red, /*G*/this->Green, /*B*/this->Blue, /*A*/this->Alpha );
//SixDigitHexCode = string2std_string( rgbColor6 );
//EightDigitHexCode = string2std_string( rgbColor8 );
//SixDigitHexCode = rgbColor6;
//EightDigitHexCode = rgbColor8;
rgbColor6 << boost::wformat( L"%02x%02x%02x" ) % /*R*/this->Red % /*G*/this->Green % /*B*/this->Blue;
rgbColor8 << boost::wformat( L"%02x%02x%02x%02x" ) % /*R*/this->Red % /*G*/this->Green % /*B*/this->Blue % /*A*/this->Alpha;

View File

@ -35,7 +35,6 @@
namespace DocFileFormat
{
// Creates a new SectionPropertiesMapping which writes the properties to the given writer
SectionPropertiesMapping::SectionPropertiesMapping (XMLTools::CStringXmlWriter* pWriter, ConversionContext* pContext, int nSelectProperties) : PropertiesMapping (pWriter)
{
m_bDeleteNode = TRUE;
@ -54,7 +53,6 @@ namespace DocFileFormat
_type = std::wstring (_T("nextPage"));
}
// Creates a new SectionPropertiesMapping which appends the properties to a given node.
SectionPropertiesMapping::SectionPropertiesMapping (XMLTools::XMLElement<wchar_t>* pBaseNode, ConversionContext* pContext, int nSelectProperties) : PropertiesMapping(NULL)
{
m_bDeleteNode = FALSE;
@ -85,7 +83,6 @@ namespace DocFileFormat
namespace DocFileFormat
{
// Converts the given SectionPropertyExceptions
void SectionPropertiesMapping::Apply (IVisitable* visited)
{
SectionPropertyExceptions* sepx = static_cast<SectionPropertyExceptions*>(visited);
@ -156,60 +153,56 @@ namespace DocFileFormat
{
switch (iter->OpCode)
{
//page margins
case sprmOldSDxaLeft:
case sprmSDxaLeft:
{
//left margin
_marLeft = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize );
appendValueAttribute( &pgMar, _T( "w:left" ), FormatUtils::IntToWideString( _marLeft ).c_str() );
}
break;
{
_marLeft = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize );
appendValueAttribute( &pgMar, _T( "w:left" ), FormatUtils::IntToWideString( _marLeft ).c_str() );
}
break;
case sprmOldSDxaRight:
case sprmSDxaRight:
{
//right margin
_marRight = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize );
appendValueAttribute( &pgMar, _T( "w:right" ), FormatUtils::IntToWideString( _marRight ).c_str() );
}
break;
{
_marRight = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize );
appendValueAttribute( &pgMar, _T( "w:right" ), FormatUtils::IntToWideString( _marRight ).c_str() );
}
break;
case sprmOldSDyaTop:
case sprmSDyaTop:
//top margin
//top margin
appendValueAttribute( &pgMar, _T( "w:top" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str() );
break;
case sprmOldSDyaBottom:
case sprmSDyaBottom:
//bottom margin
//bottom margin
appendValueAttribute( &pgMar, _T( "w:bottom" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str() );
break;
case sprmOldSDzaGutter:
case sprmSDzaGutter:
//gutter margin
//gutter margin
appendValueAttribute( &pgMar, _T( "w:gutter" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str() );
break;
case sprmOldSDyaHdrTop:
case sprmSDyaHdrTop:
//header margin
//header margin
appendValueAttribute( &pgMar, _T( "w:header"), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str() );
break;
case sprmOldSDyaHdrBottom:
case sprmSDyaHdrBottom:
//footer margin
//footer margin
appendValueAttribute( &pgMar, _T( "w:footer" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str() );
break;
//page size and orientation
//page size and orientation
case sprmOldSXaPage:
case sprmSXaPage:
{
//width
_pgWidth = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize );
appendValueAttribute( &pgSz, _T( "w:w" ), FormatUtils::IntToWideString( _pgWidth ).c_str() );
}
@ -217,7 +210,6 @@ namespace DocFileFormat
case sprmOldSYaPage:
case sprmSYaPage:
//height
appendValueAttribute( &pgSz, _T( "w:h" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str() );
break;
@ -227,7 +219,7 @@ namespace DocFileFormat
appendValueAttribute( &pgSz, _T( "w:orient" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &PageOrientationMap[0][0], 3, 10 ).c_str() );
break;
//paper source
//paper source
case sprmOldSDmBinFirst:
case sprmSDmBinFirst:
appendValueAttribute( &paperSrc, _T( "w:first" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str() );
@ -238,91 +230,85 @@ namespace DocFileFormat
appendValueAttribute( &paperSrc, _T( "w:other" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str() );
break;
//page borders
//page borders
case sprmSBrcTop80:
case sprmSBrcTop:
{
//top
XMLTools::XMLElement<wchar_t> topBorder( _T( "w:top" ) );
BorderCode bc( iter->Arguments, iter->argumentsSize );
appendBorderAttributes( &bc, &topBorder );
addOrSetBorder( &pgBorders, &topBorder);
}
break;
{
//top
XMLTools::XMLElement<wchar_t> topBorder( _T( "w:top" ) );
BorderCode bc( iter->Arguments, iter->argumentsSize );
appendBorderAttributes( &bc, &topBorder );
addOrSetBorder( &pgBorders, &topBorder);
}
break;
case sprmSBrcLeft80:
case sprmSBrcLeft:
{
//left
XMLTools::XMLElement<wchar_t> leftBorder( _T( "w:left" ) );
BorderCode bc( iter->Arguments, iter->argumentsSize );
appendBorderAttributes( &bc, &leftBorder);
addOrSetBorder( &pgBorders, &leftBorder);
}
break;
{
XMLTools::XMLElement<wchar_t> leftBorder( _T( "w:left" ) );
BorderCode bc( iter->Arguments, iter->argumentsSize );
appendBorderAttributes( &bc, &leftBorder);
addOrSetBorder( &pgBorders, &leftBorder);
}
break;
case sprmSBrcBottom80:
case sprmSBrcBottom:
{
//left
XMLTools::XMLElement<wchar_t> bottomBorder( _T( "w:bottom" ) );
BorderCode bc( iter->Arguments, iter->argumentsSize );
appendBorderAttributes( &bc, &bottomBorder );
addOrSetBorder( &pgBorders, &bottomBorder);
}
break;
{
//left
XMLTools::XMLElement<wchar_t> bottomBorder( _T( "w:bottom" ) );
BorderCode bc( iter->Arguments, iter->argumentsSize );
appendBorderAttributes( &bc, &bottomBorder );
addOrSetBorder( &pgBorders, &bottomBorder);
}
break;
case sprmSBrcRight80:
case sprmSBrcRight:
{
//left
XMLTools::XMLElement<wchar_t> rightBorder( _T( "w:right" ) );
BorderCode bc( iter->Arguments, iter->argumentsSize );
appendBorderAttributes( &bc, &rightBorder);
addOrSetBorder( &pgBorders, &rightBorder);
}
break;
{
//left
XMLTools::XMLElement<wchar_t> rightBorder( _T( "w:right" ) );
BorderCode bc( iter->Arguments, iter->argumentsSize );
appendBorderAttributes( &bc, &rightBorder);
addOrSetBorder( &pgBorders, &rightBorder);
}
break;
//footnote properties
case sprmSRncFtn:
//restart code
appendValueElement( &footnotePr, _T( "numRestart" ), FormatUtils::MapValueToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ), &FootnoteRestartCodeMap[0][0], 3, 11 ).c_str(), true );
break;
//endnote properties
case sprmSRncEdn:
//restart code
appendValueElement( &endnotePr, _T( "numRestart" ), FormatUtils::MapValueToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ), &EndnoteRestartCodeMap[0][0], 3, 11 ).c_str(), true );
break;
case sprmSFpc:
{
//position code
short fpc = 0;
if ( iter->argumentsSize == 2 )
{
//position code
short fpc = 0;
if ( iter->argumentsSize == 2 )
{
fpc = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize );
}
else
{
fpc = (short)iter->Arguments[0];
}
if ( fpc == 2 )
{
appendValueElement( &footnotePr, _T( "pos" ), _T( "beneathText" ), true );
}
fpc = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize );
}
break;
else
{
fpc = (short)iter->Arguments[0];
}
if ( fpc == 2 )
{
appendValueElement( &footnotePr, _T( "pos" ), _T( "beneathText" ), true );
}
}break;
case sprmSNfcFtnRef:
//number format
appendValueElement( &footnotePr, _T( "numFmt" ), NumberingMapping::GetNumberFormatWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str(), true );
break;
case sprmSNfcEdnRef:
//number format
appendValueElement( &endnotePr, _T( "numFmt" ), NumberingMapping::GetNumberFormatWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str(), true );
break;
@ -334,7 +320,6 @@ namespace DocFileFormat
appendValueElement( &endnotePr, _T( "numStart" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str(), true );
break;
//doc grid
case sprmSDyaLinePitch:
appendValueAttribute( &docGrid, _T( "w:linePitch" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str() );
break;
@ -347,18 +332,17 @@ namespace DocFileFormat
appendValueAttribute( &docGrid, _T( "w:type" ), FormatUtils::MapValueToWideString( FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize ), &DocGridTypeMap[0][0], 4, 14 ).c_str() );
break;
// Columns
case sprmOldSCcolumns:
case sprmSCcolumns:
{
m_nColumns = static_cast<int> (FormatUtils::BytesToInt16 (iter->Arguments, 0, iter->argumentsSize) + 1);
{
m_nColumns = static_cast<int> (FormatUtils::BytesToInt16 (iter->Arguments, 0, iter->argumentsSize) + 1);
RELEASEARRAYOBJECTS (m_arrSpace);
m_arrSpace = new short [m_nColumns];
RELEASEARRAYOBJECTS (m_arrSpace);
m_arrSpace = new short [m_nColumns];
appendValueAttribute (&cols, _T( "w:num" ), FormatUtils::IntToWideString (m_nColumns).c_str());
}
break;
appendValueAttribute (&cols, _T( "w:num" ), FormatUtils::IntToWideString (m_nColumns).c_str());
}
break;
case sprmOldSDxaColumns:
case sprmSDxaColumns:
@ -368,65 +352,60 @@ namespace DocFileFormat
case sprmOldSDxaColWidth:
case sprmSDxaColWidth:
{
if (m_nColumns) // there is at least one width set, so create the array
{
// there is at least one width set, so create the array
if (m_nColumns)
{
if (NULL == m_arrWidth)
m_arrWidth = new short [m_nColumns];
if (NULL == m_arrWidth)
m_arrWidth = new short [m_nColumns];
unsigned char nInd = iter->Arguments[0];
m_arrWidth[nInd] = FormatUtils::BytesToInt16 (iter->Arguments, 1, iter->argumentsSize);
}
unsigned char nInd = iter->Arguments[0];
m_arrWidth[nInd] = FormatUtils::BytesToInt16 (iter->Arguments, 1, iter->argumentsSize);
}
break;
}
break;
case sprmOldSDxaColSpacing:
case sprmSDxaColSpacing:
{
// there is at least one space set, so create the array
if (m_nColumns)
{
// there is at least one space set, so create the array
if (m_nColumns)
{
if (NULL == m_arrSpace)
m_arrSpace = new short[m_nColumns];
if (NULL == m_arrSpace)
m_arrSpace = new short[m_nColumns];
unsigned char nInd = iter->Arguments[0];
m_arrSpace [nInd] = FormatUtils::BytesToInt16 (iter->Arguments, 1, iter->argumentsSize);
}
unsigned char nInd = iter->Arguments[0];
m_arrSpace [nInd] = FormatUtils::BytesToInt16 (iter->Arguments, 1, iter->argumentsSize);
}
break;
}break;
//bidi
case sprmSFBiDi:
appendFlagElement (m_pXmlNode, *iter, _T( "bidi" ), true );
break;
{
appendFlagElement (m_pXmlNode, *iter, _T( "bidi" ), iter->argumentsSize > 0 ? iter->Arguments[0] : true );
}break;
//title page
case sprmOldSFTitlePage:
case sprmSFTitlePage:
appendFlagElement (m_pXmlNode, *iter, _T( "titlePg" ), true );
break;
{
appendFlagElement (m_pXmlNode, *iter, _T( "titlePg" ), iter->argumentsSize > 0 ? iter->Arguments[0] : true );
}break;
//RTL gutter
case sprmSFRTLGutter:
appendFlagElement (m_pXmlNode, *iter, _T( "rtlGutter" ), true );
break;
//type
{
appendFlagElement (m_pXmlNode, *iter, _T( "rtlGutter" ), iter->argumentsSize > 0 ? iter->Arguments[0] : true );
}break;
case sprmOldSBkc:
case sprmSBkc:
{
_type = FormatUtils::MapValueToWideString( iter->Arguments[0], &SectionTypeMap[0][0], 5, 11 );
}
break;
{
_type = FormatUtils::MapValueToWideString( iter->Arguments[0], &SectionTypeMap[0][0], 5, 11 );
}
break;
//align
case sprmOldSVjc:
case sprmSVjc:
appendValueElement (m_pXmlNode, _T( "vAlign" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &TextVerticalAlignment[0][0], 4, 7 ).c_str(), true );
break;
//pgNumType
case sprmOldSNfcPgn:
case sprmSNfcPgn:
appendValueAttribute( &pgNumType, _T( "w:fmt" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &PageNumberFormatCodeMap[0][0], 42, 29 ).c_str() );
@ -442,7 +421,7 @@ namespace DocFileFormat
bWasSprmSFPgnRestart = true;
break;
// <w:lnNumType> - Line Numbering Settings
// <w:lnNumType> - Line Numbering Settings
case sprmOldSLnnMin :
case sprmSLnnMin :
@ -476,6 +455,7 @@ namespace DocFileFormat
default:
{
int sz = iter->argumentsSize;
}break;
}
}
@ -486,7 +466,6 @@ namespace DocFileFormat
// build the columns
if (m_arrWidth)
{
//set to unequal width
XMLTools::XMLAttribute<wchar_t> equalWidth( _T( "w:equalWidth" ), _T( "0" ) );
cols.AppendAttribute( equalWidth );
@ -505,7 +484,6 @@ namespace DocFileFormat
m_arrWidth [m_nColumns - 1] = lastColWidth;
}
// append the xml elements
for (int i = 0; i < m_nColumns; ++i)
{
XMLTools::XMLElement<wchar_t> col (_T( "w:col" ));
@ -518,46 +496,35 @@ namespace DocFileFormat
}
}
//append the section type
appendValueElement (m_pXmlNode, _T( "type" ), _type.c_str(), true );
// Document-Wide Footnote Properties
if (footnotePr.GetChildCount())
m_pXmlNode->AppendChild (footnotePr);
// Document-Wide Endnote Properties
if (endnotePr.GetChildCount())
m_pXmlNode->AppendChild (endnotePr);
// Page Size
if (pgSz.GetAttributeCount())
m_pXmlNode->AppendChild (pgSz);
// Page Borders
if (pgBorders.GetChildCount())
m_pXmlNode->AppendChild (pgBorders);
// Page Margins
if (pgMar.GetAttributeCount())
m_pXmlNode->AppendChild (pgMar);
// Line Numbering Settings
if (lnNumType.GetAttributeCount())
m_pXmlNode->AppendChild (lnNumType);
// Paper Source Information
if (paperSrc.GetAttributeCount())
m_pXmlNode->AppendChild (paperSrc);
// Single Column Definition)
if (cols.GetAttributeCount() || cols.GetChildCount())
m_pXmlNode->AppendChild (cols);
// Document Grid
if (docGrid.GetAttributeCount())
m_pXmlNode->AppendChild (docGrid);
// Page Numbering Settings
if (pgNumType.GetAttributeCount())
m_pXmlNode->AppendChild (pgNumType);

View File

@ -42,11 +42,11 @@ namespace DocFileFormat
SectionPropertyExceptions( unsigned char* bytes, int size, bool oldVersion ):
PropertyExceptions( bytes, size, oldVersion ), isBidi(false)
{
for ( std::list<SinglePropertyModifier>::iterator iter = this->grpprl->begin(); iter != this->grpprl->end(); iter++ )
for ( std::list<SinglePropertyModifier>::iterator iter = grpprl->begin(); iter != grpprl->end(); iter++ )
{
SinglePropertyModifier sprm( *iter );
if( sprm.OpCode == sprmSFBiDi )
if( sprm.OpCode == sprmSFBiDi && sprm.Arguments[0] != 0)
{
isBidi = true;
}

View File

@ -44,27 +44,31 @@ namespace DocFileFormat
{
WordDocumentProperties* dop = static_cast<WordDocumentProperties*>( visited );
this->_ctx->_docx->RegisterSettings();
_ctx->_docx->RegisterSettings();
//start w:settings
m_oXmlWriter.WriteNodeBegin( _T( "?xml version=\"1.0\" encoding=\"UTF-8\"?" ) );
m_oXmlWriter.WriteNodeBegin( _T( "w:settings" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"?xml version=\"1.0\" encoding=\"UTF-8\"?" );
m_oXmlWriter.WriteNodeBegin( L"w:settings", TRUE );
//write namespaces
m_oXmlWriter.WriteAttribute( _T( "xmlns:w" ), OpenXmlNamespaces::WordprocessingML );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE, FALSE );
m_oXmlWriter.WriteAttribute( L"xmlns:w", OpenXmlNamespaces::WordprocessingML );
m_oXmlWriter.WriteNodeEnd( L"", TRUE, FALSE );
//zoom
m_oXmlWriter.WriteNodeBegin( _T( "w:zoom" ), TRUE );
m_oXmlWriter.WriteAttribute( _T( "w:percent" ), FormatUtils::IntToWideString( dop->wScaleSaved ).c_str() );
m_oXmlWriter.WriteNodeBegin ( L"w:zoom", TRUE );
m_oXmlWriter.WriteAttribute ( L"w:percent", FormatUtils::IntToWideString( dop->wScaleSaved ).c_str() );
if ( dop->zkSaved != 0 )
{
m_oXmlWriter.WriteAttribute( _T( "w:val" ), FormatUtils::MapValueToWideString( dop->zkSaved, &ZoomTypeMap[0][0], 3, 9 ).c_str() );
m_oXmlWriter.WriteAttribute( L"w:val", FormatUtils::MapValueToWideString( dop->zkSaved, &ZoomTypeMap[0][0], 3, 9 ).c_str() );
}
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
if (dop->bDisplayBackgroundShape)
{
m_oXmlWriter.WriteNodeBegin ( L"w:displayBackgroundShape", TRUE );
m_oXmlWriter.WriteNodeEnd ( L"", TRUE );
}
//doc protection
//<w:documentProtection w:edit="forms" w:enforcement="1"/>
@ -72,30 +76,30 @@ namespace DocFileFormat
//embed system fonts
if( !dop->fDoNotEmbedSystemFont )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:embedSystemFonts" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:embedSystemFonts", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
//mirror margins
if ( dop->fMirrorMargins )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:mirrorMargins" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:mirrorMargins", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
//evenAndOddHeaders
if ( dop->fFacingPages )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:evenAndOddHeaders" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:evenAndOddHeaders", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
//proof state
XMLTools::XMLElement<wchar_t> proofState( _T( "w:proofState" ) );
XMLTools::XMLElement<wchar_t> proofState( L"w:proofState" );
if ( dop->fGramAllClean )
{
appendValueAttribute( &proofState, _T( "w:grammar" ), _T( "clean" ) );
appendValueAttribute( &proofState, L"w:grammar", L"clean" );
}
if ( proofState.GetAttributeCount() > 0 )
@ -106,31 +110,31 @@ namespace DocFileFormat
//stylePaneFormatFilter
if ( dop->grfFmtFilter != 0 )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:stylePaneFormatFilter" ), TRUE );
m_oXmlWriter.WriteAttribute( _T( "w:val" ), FormatUtils::IntToFormattedWideString( dop->grfFmtFilter, _T( "%04x" ) ).c_str() );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:stylePaneFormatFilter", TRUE );
m_oXmlWriter.WriteAttribute( L"w:val", FormatUtils::IntToFormattedWideString( dop->grfFmtFilter, L"%04x" ).c_str() );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
//default tab stop
m_oXmlWriter.WriteNodeBegin( _T( "w:defaultTabStop" ), TRUE );
m_oXmlWriter.WriteAttribute( _T( "w:val" ), FormatUtils::IntToWideString( dop->dxaTab ).c_str() );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:defaultTabStop", TRUE );
m_oXmlWriter.WriteAttribute( L"w:val", FormatUtils::IntToWideString( dop->dxaTab ).c_str() );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
//drawing grid
if( dop->dogrid != NULL )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:displayHorizontalDrawingGridEvery" ), TRUE );
m_oXmlWriter.WriteAttribute( _T( "w:val" ), FormatUtils::IntToWideString( dop->dogrid->dxGridDisplay ).c_str() );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:displayHorizontalDrawingGridEvery", TRUE );
m_oXmlWriter.WriteAttribute( L"w:val", FormatUtils::IntToWideString( dop->dogrid->dxGridDisplay ).c_str() );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
m_oXmlWriter.WriteNodeBegin( _T( "w:displayVerticalDrawingGridEvery" ), TRUE );
m_oXmlWriter.WriteAttribute( _T( "w:val" ), FormatUtils::IntToWideString( dop->dogrid->dyGridDisplay ).c_str() );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:displayVerticalDrawingGridEvery", TRUE );
m_oXmlWriter.WriteAttribute( L"w:val", FormatUtils::IntToWideString( dop->dogrid->dyGridDisplay ).c_str() );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
if ( dop->dogrid->fFollowMargins == false )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:doNotUseMarginsForDrawingGridOrigin" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:doNotUseMarginsForDrawingGridOrigin", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
}
@ -139,27 +143,27 @@ namespace DocFileFormat
{
if ( dop->doptypography->fKerningPunct == false )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:noPunctuationKerning" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:noPunctuationKerning", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
}
//footnote properties
XMLTools::XMLElement<wchar_t> footnotePr( _T( "w:footnotePr" ) );
XMLTools::XMLElement<wchar_t> footnotePr( L"w:footnotePr" );
if ( dop->nFtn != 0 )
{
appendValueAttribute( &footnotePr, _T( "w:numStart" ), FormatUtils::IntToWideString( dop->nFtn ).c_str() );
appendValueAttribute( &footnotePr, L"w:numStart", FormatUtils::IntToWideString( dop->nFtn ).c_str() );
}
if ( dop->rncFtn != 0 )
{
appendValueAttribute( &footnotePr, _T( "w:numRestart" ), FormatUtils::IntToWideString( dop->rncFtn ).c_str() );
appendValueAttribute( &footnotePr, L"w:numRestart", FormatUtils::IntToWideString( dop->rncFtn ).c_str() );
}
if ( dop->Fpc != 0 )
{
appendValueAttribute( &footnotePr, _T( "w:pos" ), FormatUtils::MapValueToWideString( dop->Fpc, &FootnotePositionMap[0][0], 4, 12 ).c_str() );
appendValueAttribute( &footnotePr, L"w:pos", FormatUtils::MapValueToWideString( dop->Fpc, &FootnotePositionMap[0][0], 4, 12 ).c_str() );
}
if ( footnotePr.GetAttributeCount() > 0 )
@ -173,7 +177,7 @@ namespace DocFileFormat
writeRsidList();
//close w:settings
m_oXmlWriter.WriteNodeEnd( _T( "w:settings" ) );
m_oXmlWriter.WriteNodeEnd( L"w:settings" );
this->_ctx->_docx->SettingsXML = std::wstring( m_oXmlWriter.GetXmlString() );
}
@ -181,368 +185,368 @@ namespace DocFileFormat
void SettingsMapping::writeRsidList()
{
//convert the rsid list
m_oXmlWriter.WriteNodeBegin( _T( "w:rsids" ) );
m_oXmlWriter.WriteNodeBegin( L"w:rsids" );
for ( std::set<std::wstring>::iterator iter = this->_ctx->AllRsids.begin(); iter != this->_ctx->AllRsids.end(); iter++ )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:rsid" ), TRUE );
m_oXmlWriter.WriteAttribute( _T( "w:val" ), iter->c_str() );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:rsid", TRUE );
m_oXmlWriter.WriteAttribute( L"w:val", iter->c_str() );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
m_oXmlWriter.WriteNodeEnd( _T( "w:rsids" ) );
m_oXmlWriter.WriteNodeEnd( L"w:rsids" );
}
void SettingsMapping::writeCompatibilitySettings(const WordDocumentProperties* dop)
{
//compatibility settings
m_oXmlWriter.WriteNodeBegin( _T( "w:compat" ) );
m_oXmlWriter.WriteNodeBegin( L"w:compat" );
//some settings must always be written
if ( dop->fUseNormalStyleForList )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:useNormalStyleForList" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:useNormalStyleForList", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fDontUseIndentAsNumberingTabStop )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:doNotUseIndentAsNumberingTabStop" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:doNotUseIndentAsNumberingTabStop", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fFELineBreak11 )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:useAltKinsokuLineBreakRules" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:useAltKinsokuLineBreakRules", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fAllowSpaceOfSameStyleInTable )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:allowSpaceOfSameStyleInTable" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:allowSpaceOfSameStyleInTable", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fWW11IndentRules )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:doNotSuppressIndentation" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:doNotSuppressIndentation", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fDontAutofitConstrainedTables )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:doNotAutofitConstrainedTables" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:doNotAutofitConstrainedTables", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fAutofitLikeWW11 )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:autofitToFirstFixedWidthCell" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:autofitToFirstFixedWidthCell", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fUnderlineTabInNumList )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:underlineTabInNumList" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:underlineTabInNumList", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fHangulWidthLikeWW11 )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:displayHangulFixedWidth" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:displayHangulFixedWidth", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fSplitPgBreakAndParaMark )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:splitPgBreakAndParaMark" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:splitPgBreakAndParaMark", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fDontVertAlignCellWithSp )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:doNotVertAlignCellWithSp" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:doNotVertAlignCellWithSp", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fDontBreakConstrainedForcedTables )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:doNotBreakConstrainedForcedTable" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:doNotBreakConstrainedForcedTable", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fDontVertAlignInTxbx )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:doNotVertAlignInTxbx" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:doNotVertAlignInTxbx", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fWord11KerningPairs )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:useAnsiKerningPairs" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:useAnsiKerningPairs", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fCachedColBalance )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:cachedColBalance" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:cachedColBalance", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
//others are saved in the file
if ( !dop->fDontAdjustLineHeightInTable )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:adjustLineHeightInTable" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:adjustLineHeightInTable", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fAlignTablesRowByRow )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:alignTablesRowByRow" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:alignTablesRowByRow", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fApplyBreakingRules )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:applyBreakingRules" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:applyBreakingRules", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fUseAutoSpaceForFullWidthAlpha )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:autoSpaceLikeWord95" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:autoSpaceLikeWord95", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( !dop->fDntBlnSbDbWid )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:balanceSingleByteDoubleByteWidth" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:balanceSingleByteDoubleByteWidth", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fConvMailMergeEsc )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:convMailMergeEsc" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:convMailMergeEsc", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fDontBreakWrappedTables )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:doNotBreakWrappedTables" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:doNotBreakWrappedTables", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( !dop->fExpShRtn )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:doNotExpandShiftReturn" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:doNotExpandShiftReturn", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( !dop->fLeaveBackslashAlone )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:doNotLeaveBackslashAlone" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:doNotLeaveBackslashAlone", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fDontSnapToGridInCell )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:doNotSnapToGridInCell" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:doNotSnapToGridInCell", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fDontUseAsianBreakRules )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:doNotUseEastAsianBreakRules" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:doNotUseEastAsianBreakRules", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fDontUseHTMLParagraphAutoSpacing )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:doNotUseHTMLParagraphAutoSpacing" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:doNotUseHTMLParagraphAutoSpacing", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fDontWrapTextWithPunct )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:doNotWrapTextWithPunct" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:doNotWrapTextWithPunct", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fFtnLayoutLikeWW8 )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:footnoteLayoutLikeWW8" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:footnoteLayoutLikeWW8", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fForgetLastTabAlign )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:forgetLastTabAlignment" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:forgetLastTabAlignment", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fGrowAutofit )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:growAutofit" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:growAutofit", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fLayoutRawTableWidth )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:layoutRawTableWidth" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:layoutRawTableWidth", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fLayoutTableRowsApart )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:layoutTableRowsApart" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:layoutTableRowsApart", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fLineWrapLikeWord6 )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:lineWrapLikeWord6" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:lineWrapLikeWord6", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fMWSmallCaps )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:mwSmallCaps" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:mwSmallCaps", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fNoColumnBalance )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:noColumnBalance" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:noColumnBalance", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fNoLeading )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:noLeading" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:noLeading", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fNoSpaceRaiseLower )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:noSpaceRaiseLower" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:noSpaceRaiseLower", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fNoTabForInd )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:noTabHangInd" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:noTabHangInd", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fPrintBodyBeforeHdr )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:printBodyTextBeforeHeader" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:printBodyTextBeforeHeader", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fMapPrintTextColor )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:printColBlack" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:printColBlack", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fDontAllowFieldEndSelect )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:selectFldWithFirstOrLastChar" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:selectFldWithFirstOrLastChar", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fSpLayoutLikeWW8 )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:shapeLayoutLikeWW8" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:shapeLayoutLikeWW8", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fShowBreaksInFrames )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:showBreaksInFrames" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:showBreaksInFrames", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fMakeSpaceForUL )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:spaceForUL" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:spaceForUL", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fTruncDxaExpand )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:spacingInWholePoints" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:spacingInWholePoints", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fSubOnSize )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:subFontBySize" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:subFontBySize", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fSuppressSpbfAfterPageBreak )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:suppressSpBfAfterPgBrk" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:suppressSpBfAfterPgBrk", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fSuppressTopSpacing )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:suppressTopSpacing" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:suppressTopSpacing", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fSwapBordersFacingPgs )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:swapBordersFacingPages" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:swapBordersFacingPages", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( !dop->fDntULTrlSpc )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:ulTrailSpace" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:ulTrailSpace", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fPrintMet )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:usePrinterMetrics" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:usePrinterMetrics", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fUseWord2002TableStyleRules )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:useWord2002TableStyleRules" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:useWord2002TableStyleRules", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fUserWord97LineBreakingRules )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:useWord97LineBreakRules" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:useWord97LineBreakRules", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fWPJust )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:wpJustification" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:wpJustification", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fWPSpace )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:wpSpaceWidth" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:wpSpaceWidth", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
if ( dop->fWrapTrailSpaces )
{
m_oXmlWriter.WriteNodeBegin( _T( "w:wrapTrailSpaces" ), TRUE );
m_oXmlWriter.WriteNodeEnd( _T( "" ), TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:wrapTrailSpaces", TRUE );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
}
m_oXmlWriter.WriteNodeEnd( _T( "w:compat" ) );
m_oXmlWriter.WriteNodeEnd( L"w:compat" );
}
}

View File

@ -112,23 +112,14 @@ namespace DocFileFormat
friend class PropertiesMapping;
private:
/// 24-bit foreground color
unsigned int cvFore;
bool cvForeAuto;
/// Foreground color.
/// Only used if cvFore is not set
int icoFore;
/// 24-bit background color
unsigned int cvBack;
bool cvBackAuto;
/// Background color.
/// Only used if cvBack is not set.
int icoBack;
/// Shading pattern
ShadingPattern ipat;
/// Shading type
ShadingType shadingType;
/// Shading special vale
unsigned int cvFore; // 24-bit foreground color
bool cvForeAuto;
int icoFore; // Foreground color.
unsigned int cvBack;
bool cvBackAuto;
int icoBack;
ShadingPattern ipat;
ShadingType shadingType;
ShadingSpecialValue shadingSpecialValue;
public:
@ -236,7 +227,7 @@ namespace DocFileFormat
else if (0x0F == icoBack) { cvBack = RGB2 (0x80, 0x80, 0x80); }
else if (0x10 == icoBack) { cvBack = RGB2 (0xC0, 0xC0, 0xC0); }
// TODO : если будут документы с такими цветовыми палитрами
// .... если будут документы с такими цветовыми палитрами
//if ((cvFore == 0) && (icoFore == 0x0) && (cvBack == 0) && (icoBack == 0x0) && (ipat == Automatic))
//{
@ -250,7 +241,6 @@ namespace DocFileFormat
}
else
{
//throw new ByteParseException("Cannot parse the struct SHD, the length of the struct doesn't match");
}
}
}

View File

@ -96,6 +96,8 @@ namespace DocFileFormat
{
friend class TextboxMapping;
public:
static const int STRUCTURE_SIZE = 22;
struct FTXBXSReusable
{
int iNextReuse;
@ -108,8 +110,6 @@ namespace DocFileFormat
int cTxbxEdit; // This value MUST be zero and MUST be ignored.
};
static const int STRUCTURE_SIZE = 22;
FTXBXS ()
{

View File

@ -50,9 +50,8 @@ namespace DocFileFormat
void SetTextboxStyle(const std::wstring & style);
private:
static int TextboxCount;
static int TextboxCount;
int m_nTBIndex;
double m_dxTextLeft;

View File

@ -189,7 +189,6 @@ namespace DocFileFormat
return res;
}
//---------------------------------------------------------------
static int count_vml_objects = 0;
void VMLPictureMapping::appendStyleProperty(std::wstring* b, const std::wstring& propName, const std::wstring& propValue) const
{
if ( b != NULL )
@ -215,8 +214,6 @@ namespace DocFileFormat
m_isEmbedded = false;
m_imageData = new XMLTools::XMLElement<wchar_t>( _T( "v:imagedata" ) );
m_ShapeId = std::wstring(L"_x0000_i") + FormatUtils::IntToWideString(1024 + (count_vml_objects++));
}
VMLPictureMapping::~VMLPictureMapping()
@ -263,7 +260,12 @@ namespace DocFileFormat
m_pXmlWriter->WriteAttribute( _T( "type" ), std::wstring( _T( "#" ) + VMLShapeTypeMapping::GenerateTypeId(&type)).c_str());
m_pXmlWriter->WriteAttribute( _T( "id" ), m_ShapeId.c_str() );
count_vml_objects++;
if (m_shapeId.empty())
m_shapeId = std::wstring(L"_x0000_s") + FormatUtils::IntToWideString(1024 + count_vml_objects);
m_pXmlWriter->WriteAttribute( _T( "id" ), m_shapeId.c_str() );
if (m_isOlePreview)
{
@ -426,11 +428,6 @@ namespace DocFileFormat
m_pXmlWriter->WriteNodeEnd( _T( "v:shape" ) );
}
std::wstring VMLPictureMapping::GetShapeId () const
{
return m_ShapeId;
}
void VMLPictureMapping::writePictureBorder( const std::wstring & name, const BorderCode* brc )
{
if (!brc || name.empty()) return;

View File

@ -54,8 +54,6 @@ namespace DocFileFormat
VMLPictureMapping( ConversionContext* ctx, XMLTools::CStringXmlWriter* writer, bool olePreview, IMapping* caller, bool isInlinePicture = false );
virtual ~VMLPictureMapping();
virtual void Apply( IVisitable* visited );
std::wstring GetShapeId() const;
private:
/// Writes a border element
void writePictureBorder (const std::wstring & name, const BorderCode* brc);
@ -75,12 +73,13 @@ namespace DocFileFormat
bool m_isEmbedded;
std::string m_embeddedData;
std::wstring m_equationXml;
std::wstring m_shapeId;
private:
ConversionContext* m_ctx;
IMapping* m_caller;
int m_nImageId;
std::wstring m_ShapeId;
bool m_isOlePreview;
bool m_isInlinePicture;

File diff suppressed because it is too large Load Diff

View File

@ -68,7 +68,8 @@ namespace DocFileFormat
static std::wstring mapHorizontalPosition (PositionHorizontal hPos );
static std::wstring mapHorizontalPositionRelative(int hRel );
bool m_isBullete;
bool m_isBullete;
std::wstring m_shapeId;
private:
void ApplyPrimitives (DrawingPrimitives * primitives );
@ -129,7 +130,7 @@ namespace DocFileFormat
BlipStoreContainer* m_pBlipStore;
int m_nImageId;
std::wstring m_textPathStyle;
ConversionContext* m_ctx;
ConversionContext* m_context;
PictureDescriptor* m_pict;
XMLTools::XMLElement<wchar_t> m_fill;

View File

@ -37,6 +37,8 @@
namespace DocFileFormat
{
static int count_vml_objects = 0;
class VMLShapeTypeMapping: public PropertiesMapping, public IMapping
{
private:

View File

@ -49,7 +49,7 @@ namespace DocFileFormat
EndnoteReferenceCharactersPlex(NULL), FieldsPlex(NULL), FootnoteDocumentFieldsPlex(NULL),
EndnoteDocumentFieldsPlex(NULL), HeadersAndFootersDocumentFieldsPlex(NULL), HeaderStoriesPlex(NULL),
AnnotationsReferencePlex(NULL), IndividualCommentsPlex(NULL), TextboxBreakPlex(NULL), TextboxBreakPlexHeader(NULL),
TextboxIndividualPlex(NULL),
TextboxIndividualPlex(NULL),AssocNames(NULL), BookmarkAnnotNames(NULL), Captions(NULL), AutoCaptions(NULL), ListPlex(NULL),
OfficeDrawingPlex(NULL), OfficeDrawingPlexHeader(NULL), SectionPlex(NULL), BookmarkStartPlex(NULL), BookmarkEndPlex(NULL),
AutoTextPlex(NULL), AllPapxFkps(NULL), AllChpxFkps(NULL), AllPapx(NULL), AllPapxVector(NULL), AllSepx(NULL), Styles(NULL), listTable(NULL),
AnnotationOwners(NULL), DocProperties(NULL), listFormatOverrideTable(NULL), headerAndFooterTable(NULL), encryptionHeader(NULL)
@ -218,10 +218,14 @@ namespace DocFileFormat
m_pStorage->GetStream ("WordDocument", &TableStream);
}
RevisionAuthorTable = new StringTable<WideString> (TableStream, FIB->m_FibWord97.fcSttbfRMark, FIB->m_FibWord97.lcbSttbfRMark, bOlderVersion);
FontTable = new StringTable<FontFamilyName> (TableStream, FIB->m_FibWord97.fcSttbfFfn, FIB->m_FibWord97.lcbSttbfFfn, bOlderVersion);
BookmarkNames = new StringTable<WideString> (TableStream, FIB->m_FibWord97.fcSttbfBkmk, FIB->m_FibWord97.lcbSttbfBkmk, bOlderVersion);
AutoTextNames = new StringTable<WideString> (TableStream, FIB->m_FibWord97.fcSttbfGlsy, FIB->m_FibWord97.lcbSttbfGlsy, bOlderVersion);
RevisionAuthorTable = new StringTable<WideString> (TableStream, FIB->m_FibWord97.fcSttbfRMark, FIB->m_FibWord97.lcbSttbfRMark, bOlderVersion);
FontTable = new StringTable<FontFamilyName> (TableStream, FIB->m_FibWord97.fcSttbfFfn, FIB->m_FibWord97.lcbSttbfFfn, bOlderVersion);
BookmarkNames = new StringTable<WideString> (TableStream, FIB->m_FibWord97.fcSttbfBkmk, FIB->m_FibWord97.lcbSttbfBkmk, bOlderVersion);
AutoTextNames = new StringTable<WideString> (TableStream, FIB->m_FibWord97.fcSttbfGlsy, FIB->m_FibWord97.lcbSttbfGlsy, bOlderVersion);
AssocNames = new StringTable<WideString> (TableStream, FIB->m_FibWord97.fcSttbfAssoc, FIB->m_FibWord97.lcbSttbfAssoc, bOlderVersion);
BookmarkAnnotNames = new StringTable<WideString> (TableStream, FIB->m_FibWord97.fcSttbfAtnBkmk, FIB->m_FibWord97.lcbSttbfAtnBkmk, bOlderVersion);
Captions = new StringTable<WideString> (TableStream, FIB->m_FibWord97.fcSttbfCaption, FIB->m_FibWord97.lcbSttbfCaption, bOlderVersion);
AutoCaptions = new StringTable<WideString> (TableStream, FIB->m_FibWord97.fcSttbfAutoCaption, FIB->m_FibWord97.lcbSttbfAutoCaption, bOlderVersion);
if (m_pCallFunc)
{
@ -268,7 +272,7 @@ namespace DocFileFormat
OfficeDrawingPlex = new Plex<Spa> (Spa::GetSize(bOlderVersion), TableStream, FIB->m_FibWord97.fcPlcSpaMom, FIB->m_FibWord97.lcbPlcSpaMom, bOlderVersion);
OfficeDrawingPlexHeader = new Plex<Spa> (Spa::GetSize(bOlderVersion), TableStream, FIB->m_FibWord97.fcPlcSpaHdr, FIB->m_FibWord97.lcbPlcSpaHdr, bOlderVersion);
TextboxIndividualPlex = new Plex<EmptyStructure> (EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcftxbxTxt, FIB->m_FibWord97.lcbPlcftxbxTxt, bOlderVersion);
TextboxIndividualPlex = new Plex<FTXBXS> (FTXBXS::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcftxbxTxt, FIB->m_FibWord97.lcbPlcftxbxTxt, bOlderVersion);
SectionPlex = new Plex<SectionDescriptor> (SectionDescriptor::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfSed, FIB->m_FibWord97.lcbPlcfSed, bOlderVersion);
BookmarkStartPlex = new Plex<BookmarkFirst> (BookmarkFirst::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfBkf, FIB->m_FibWord97.lcbPlcfBkf, bOlderVersion);
@ -286,12 +290,13 @@ namespace DocFileFormat
}
}
AutoTextPlex = new Plex<EmptyStructure> (EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfGlsy, FIB->m_FibWord97.lcbPlcfGlsy, bOlderVersion);
FieldsPlex = new Plex<FieldCharacter> (FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldMom, FIB->m_FibWord97.lcbPlcfFldMom, bOlderVersion);
FootnoteDocumentFieldsPlex = new Plex<FieldCharacter> (FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldFtn, FIB->m_FibWord97.lcbPlcfFldFtn, bOlderVersion);
EndnoteDocumentFieldsPlex = new Plex<FieldCharacter> (FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldEdn, FIB->m_FibWord97.lcbPlcfFldEdn, bOlderVersion);
HeadersAndFootersDocumentFieldsPlex = new Plex<FieldCharacter> (FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldHdr, FIB->m_FibWord97.lcbPlcfFldHdr, bOlderVersion);
AutoTextPlex = new Plex<EmptyStructure>(EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfGlsy, FIB->m_FibWord97.lcbPlcfGlsy, bOlderVersion);
FieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldMom, FIB->m_FibWord97.lcbPlcfFldMom, bOlderVersion);
FootnoteDocumentFieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldFtn, FIB->m_FibWord97.lcbPlcfFldFtn, bOlderVersion);
EndnoteDocumentFieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldEdn, FIB->m_FibWord97.lcbPlcfFldEdn, bOlderVersion);
HeadersAndFootersDocumentFieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldHdr, FIB->m_FibWord97.lcbPlcfFldHdr, bOlderVersion);
ListPlex = new Plex<ListNumCache> (ListNumCache::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfBteLvc, FIB->m_FibWord97.lcbPlcfBteLvc, bOlderVersion);
if (m_pCallFunc)
{
m_pCallFunc->OnProgress(m_pCallFunc->caller, DOC_ONPROGRESSEVENT_ID, 200000 );
@ -592,6 +597,11 @@ namespace DocFileFormat
RELEASEOBJECT(FontTable);
RELEASEOBJECT(BookmarkNames);
RELEASEOBJECT(AutoTextNames);
RELEASEOBJECT(AutoCaptions);
RELEASEOBJECT(Captions);
RELEASEOBJECT(BookmarkAnnotNames);
RELEASEOBJECT(AssocNames);
RELEASEOBJECT(IndividualFootnotesPlex);
RELEASEOBJECT(FootnoteReferenceCharactersPlex);
RELEASEOBJECT(IndividualEndnotesPlex);
@ -613,6 +623,7 @@ namespace DocFileFormat
RELEASEOBJECT(BookmarkStartPlex);
RELEASEOBJECT(BookmarkEndPlex);
RELEASEOBJECT(AutoTextPlex);
RELEASEOBJECT(ListPlex);
RELEASEOBJECT(Styles);
RELEASEOBJECT(listTable);
RELEASEOBJECT(AllPapx);
@ -699,8 +710,7 @@ namespace DocFileFormat
{
FormattedDiskPageCHPX *fkp = (*iter);
// get the CHPX
// get the CHPX
for (unsigned int j = 0; j < fkp->grpchpxSize; ++j)
{
if ( ( fkp->rgfc[j] < fcMin ) && ( fkp->rgfc[j + 1] > fcMin ) )

View File

@ -177,6 +177,10 @@ namespace DocFileFormat
StringTable<FontFamilyName> *FontTable; // A list of all font names, used in the doucument
StringTable<WideString> *BookmarkNames;
StringTable<WideString> *AutoTextNames;
StringTable<WideString> *AssocNames;
StringTable<WideString> *BookmarkAnnotNames;
StringTable<WideString> *Captions;
StringTable<WideString> *AutoCaptions;
Plex<EmptyStructure> *IndividualFootnotesPlex; //A plex of locations of individual footnotes
Plex<FootnoteDescriptor> *FootnoteReferenceCharactersPlex; //A plex of footnote reference characters
@ -187,7 +191,7 @@ namespace DocFileFormat
Plex<EmptyStructure> *HeaderStoriesPlex; //A plex of the header document
Plex<EmptyStructure> *IndividualCommentsPlex; // A plex with all ATRDPre10 structs
Plex<EmptyStructure> *TextboxIndividualPlex;
Plex<FTXBXS> *TextboxIndividualPlex;
Plex<Tbkd> *TextboxBreakPlex; // Describes the breaks inside the textbox subdocument
Plex<Tbkd> *TextboxBreakPlexHeader; // Describes the breaks inside the header textbox subdocument
@ -200,13 +204,14 @@ namespace DocFileFormat
Plex<BookmarkFirst> *BookmarkStartPlex;
Plex<EmptyStructure> *BookmarkEndPlex;
Plex<ListNumCache> *ListPlex;
Plex<FieldCharacter> *FieldsPlex;
Plex<FieldCharacter> *FootnoteDocumentFieldsPlex;
Plex<FieldCharacter> *EndnoteDocumentFieldsPlex;
Plex<FieldCharacter> *HeadersAndFootersDocumentFieldsPlex;
Plex<AnnotationReferenceDescriptor> *AnnotationsReferencePlex;
Plex<EmptyStructure> *AutoTextPlex; // Each character position specifies the beginning of\
a range of text that constitutes the contents of an AutoText item
Plex<EmptyStructure> *AutoTextPlex;
// Each character position specifies the beginning of a range of text that constitutes the contents of an AutoText item
};
}

View File

@ -32,14 +32,12 @@
#ifndef DOC_FORMAT_LIB
#define DOC_FORMAT_LIB
#include <string>
#if defined(_WIN32) || defined(_WIN64)
#include <windows.h>
#else
#include "../../DesktopEditor/common/ASCVariant.h"
#endif
#include "../../DesktopEditor/common/ASCVariant.h"
struct ProgressCallback;
class COfficeDocFile

View File

@ -32,7 +32,7 @@ INCLUDEPATH += \
../../../DesktopEditor/xml/libxml2/include
core_mac {
QMAKE_MAC_SDK = macosx10.11
#QMAKE_MAC_SDK = macosx10.11
}
SOURCES += \
@ -40,7 +40,8 @@ SOURCES += \
../../../Common/3dParty/pole/pole.cpp \
../../DocDocxConverter/EncryptionHeader.cpp \
../../DocDocxConverter/DrawingPrimitives.cpp \
../../DocDocxConverter/Spa.cpp
../../DocDocxConverter/Spa.cpp \
../../DocDocxConverter/OleObject.cpp
build_fast {
SOURCES += \

View File

@ -555,6 +555,10 @@
RelativePath="..\..\DocDocxConverter\OfficeArtContent.h"
>
</File>
<File
RelativePath="..\..\DocDocxConverter\OleObject.cpp"
>
</File>
<File
RelativePath="..\..\DocDocxConverter\OleObject.h"
>

View File

@ -50,8 +50,10 @@
int _tmain(int argc, _TCHAR* argv[])
{
if (argc < 2) return 1;
std::wstring sSrcDoc = argv[1];
std::wstring sDstDocx = argv[2];
std::wstring sDstDocx = argc > 2 ? argv[2] : sSrcDoc + L"-my.docx";
std::wstring outputDir = FileSystem::Directory::GetFolderPath(sDstDocx);
std::wstring dstTempPath = FileSystem::Directory::CreateDirectoryWithUniqueName(outputDir);

View File

@ -71,7 +71,7 @@ namespace Writers
if(false == IsEmpty())
{
OOX::CPath pathChartDir = m_sDir + FILE_SEPARATOR_STR + _T("word") + FILE_SEPARATOR_STR + _T("charts");
FileSystem::Directory::CreateDirectory(string2std_string(pathChartDir.GetPath()));
FileSystem::Directory::CreateDirectory(pathChartDir.GetPath());
for(int i = 0, length = m_aCharts.size(); i < length; ++i)
{
@ -80,7 +80,7 @@ namespace Writers
OOX::CPath filePath = pathChartDir + FILE_SEPARATOR_STR + elem->filename;
NSFile::CFileBinary oFile;
oFile.CreateFileW(string2std_string(filePath.GetPath()));
oFile.CreateFileW(filePath.GetPath());
oFile.WriteStringUTF8(L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n");
oFile.WriteStringUTF8(elem->content);
oFile.CloseFile();
@ -91,14 +91,15 @@ namespace Writers
}
}
}
void AddChart(std::wstring& content, CString& sRelsName, CString& sFileName, int& index)
void AddChart(std::wstring& content, std::wstring& sRelsName, std::wstring& sFileName, int& index)
{
ChartElem* pChartElem = new ChartElem();
pChartElem->content = content;
pChartElem->index = nChartCount + 1;
nChartCount++;
pChartElem->filename.Format(_T("chart%d.xml"), pChartElem->index);
sRelsName = _T("charts/") + pChartElem->filename;
pChartElem->filename.Format(L"chart%d.xml", pChartElem->index);
sRelsName = L"charts/" + pChartElem->filename;
sFileName = pChartElem->filename;
index = pChartElem->index;

View File

@ -53,13 +53,22 @@ namespace Writers
CFile oFile;
oFile.CreateFile(filePath.GetPath());
oFile.WriteStringUTF8(CString(_T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:document xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 wp14\"><w:body>")));
oFile.WriteStringUTF8(m_oContent.GetData());
oFile.WriteStringUTF8(CString(_T("<w:sectPr >")));
oFile.WriteStringUTF8(WriteSectPrHdrFtr());
oFile.WriteStringUTF8(m_oSecPr.GetData());
oFile.WriteStringUTF8(CString(_T("</w:sectPr>")));
oFile.WriteStringUTF8(CString(_T("</w:body></w:document>")));
oFile.WriteStringUTF8(CString(_T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>")));
oFile.WriteStringUTF8(CString(_T("<w:document xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 wp14\">")));
oFile.WriteStringUTF8(m_oBackground.GetData());
oFile.WriteStringUTF8(CString(_T("<w:body>")));
oFile.WriteStringUTF8(m_oContent.GetData());
oFile.WriteStringUTF8(CString(_T("<w:sectPr >")));
oFile.WriteStringUTF8(WriteSectPrHdrFtr());
oFile.WriteStringUTF8(m_oSecPr.GetData());
oFile.WriteStringUTF8(CString(_T("</w:sectPr>")));
oFile.WriteStringUTF8(CString(_T("</w:body>")));
oFile.WriteStringUTF8(CString(_T("</w:document>")));
oFile.CloseFile();
}
CString WriteSectPrHdrFtr()

View File

@ -39,7 +39,8 @@ namespace Writers
class ContentWriter
{
public:
XmlUtils::CStringWriter m_oContent;
XmlUtils::CStringWriter m_oBackground;
XmlUtils::CStringWriter m_oContent;
XmlUtils::CStringWriter m_oSecPr;
};
class HdrFtrItem

View File

@ -74,10 +74,10 @@ namespace Writers
{
CString sNewImagePath = AddImageGetNewPath();
NSFile::CFileBinary oFile;
oFile.CreateFileW(string2std_string(sNewImagePath));
oFile.CreateFileW(sNewImagePath);
oFile.WriteFile(pData, dwSizeRead);
oFile.CloseFile();
CString sFilename = NSSystemPath::GetFileName(string2std_string(sNewImagePath)).c_str();
CString sFilename = NSSystemPath::GetFileName(sNewImagePath);
m_aImageNames.push_back(sFilename);
}
RELEASEARRAYOBJECTS(pData);
@ -87,8 +87,8 @@ namespace Writers
{
OOX::CPath pathNewImg = AddImageGetNewPath();
NSFile::CFileBinary::Copy(string2std_string(sImg), string2std_string(pathNewImg.GetPath()));
CString sFilename = NSSystemPath::GetFileName(string2std_string(pathNewImg.GetPath())).c_str();
NSFile::CFileBinary::Copy(sImg, pathNewImg.GetPath());
CString sFilename = NSSystemPath::GetFileName(pathNewImg.GetPath()).c_str();
m_aImageNames.push_back(sFilename);
}
};

View File

@ -265,19 +265,64 @@ public:
bBeforeAuto = false;
}
};
class Background
{
public:
docRGB Color;
CThemeColor ThemeColor;
CString sObject;
bool bColor;
bool bThemeColor;
Background() : bColor (false), bThemeColor(false) {}
CString Write()
{
CString sBackground = L"<w:background";
if(bColor)
{
sBackground += L" w:color=\"" + Color.ToString() + L"\"";
}
if(bThemeColor && ThemeColor.IsNoEmpty())
{
if(ThemeColor.bColor)
sBackground += L" w:themeColor=\"" + ThemeColor.ToStringColor() + L"\"";
if(ThemeColor.bTint)
sBackground += L" w:themeColorTint=\"" + ThemeColor.ToStringTint() + L"\"";
if(ThemeColor.bShade)
sBackground += L" w:themeColorShade=\"" + ThemeColor.ToStringShade() + L"\"";
}
if (!bColor && !bThemeColor)
{
sBackground += L" w:color=\"ffffff\"";
}
sBackground += L">";
sBackground += sObject;
sBackground += L"</w:background>";
return sBackground;
}
};
class Shd
{
public:
BYTE Value;
docRGB Color;
BYTE Value;
docRGB Color;
CThemeColor ThemeColor;
bool bColor;
bool bThemeColor;
Shd()
{
Value = shd_Nil;
bColor = false;
Value = shd_Nil;
bColor = false;
bThemeColor = false;
}
CString ToString()
@ -1801,87 +1846,7 @@ public:
return sRes;
}
};
//class CComment
//{
//public:
// int Id;
// CString Initials;
// CString UserName;
// CString Date;
// CString Text;
// CAtlArray<CComment*> replies;
//
// bool bId;
//public:
// CComment()
// {
// bId = false;
// }
// ~CComment()
// {
// for(int i = 0, length = replies.GetCount(); i < length; ++i)
// {
// delete replies[i];
// }
// replies.RemoveAll();
// }
// CString Write()
// {
// CString sRes;
// if(bId)
// {
// sRes.AppendFormat(_T("<w:comment w:id=\"%d\""), Id);
// if(false == UserName.IsEmpty())
// {
// CString sUserName = XmlUtils::EncodeXmlString(UserName);
// sRes.AppendFormat(_T(" w:author=\"%ls\""), sUserName);
// }
// if(false == Date.IsEmpty())
// {
// CString sDate = XmlUtils::EncodeXmlString(Date);
// sRes.AppendFormat(_T(" w:date=\"%ls\""), sDate);
// }
// if(false == Initials.IsEmpty())
// {
// CString sInitials = XmlUtils::EncodeXmlString(Initials);
// sRes.AppendFormat(_T(" w:initials=\"%ls\""), sInitials);
// }
// sRes.Append(_T(">"));
//
// sRes.Append(WriteCommentContent(this, true));
//
// sRes.Append(_T("</w:comment>"));
// }
// return sRes;
// }
//private:
// CString WriteCommentContent(CComment* pComment, bool bCheckLast)
// {
// CString sRes;
// CString sFormat = _T("<w:p><w:pPr><w:spacing w:line=\"240\" w:after=\"0\" w:lineRule=\"auto\" w:before=\"0\"/><w:ind w:firstLine=\"0\" w:left=\"0\" w:right=\"0\"/><w:jc w:val=\"left\"/></w:pPr><w:r><w:rPr><w:rFonts w:eastAsia=\"Arial\" w:ascii=\"Arial\" w:hAnsi=\"Arial\" w:cs=\"Arial\"/><w:sz w:val=\"22\"/></w:rPr><w:t xml:space=\"preserve\">%ls</w:t></w:r></w:p>");
// CString sName = XmlUtils::EncodeXmlString(pComment->UserName + _T(":"));
// sRes.AppendFormat(sFormat, sName);
// if(false == pComment->Text.IsEmpty())
// {
// CString sText = XmlUtils::EncodeXmlString(pComment->Text);
// sRes.AppendFormat(sFormat, sText);
// }
// if(false == bCheckLast || pComment->replies.GetCount() > 0)
// sRes.Append(_T("<w:p><w:pPr><w:pBdr><w:top w:space=\"1\" w:sz=\"4\" w:color=\"auto\" w:val=\"single\"/></w:pBdr></w:pPr></w:p>"));
//
// if(pComment->replies.GetCount() > 0)
// {
// for(int i = 0, length = pComment->replies.GetCount(); i < length; ++i)
// {
// if(i != length - 1)
// sRes += WriteCommentContent(pComment->replies[i], false);
// else
// sRes += WriteCommentContent(pComment->replies[i], bCheckLast);
// }
// }
// return sRes;
// }
//};
class CDrawingPropertyWrapPoint
{
public:
@ -1924,41 +1889,42 @@ public:
class CDrawingProperty
{
public:
long DataPos;
long DataLength;
BYTE Type;
bool BehindDoc;
double DistL;
double DistT;
double DistR;
double DistB;
bool LayoutInCell;
long DataPos;
long DataLength;
BYTE Type;
bool BehindDoc;
double DistL;
double DistT;
double DistR;
double DistB;
bool LayoutInCell;
unsigned long RelativeHeight;
bool BSimplePos;
double EffectExtentL;
double EffectExtentT;
double EffectExtentR;
double EffectExtentB;
double Width;
double Height;
BYTE PositionHRelativeFrom;
BYTE PositionHAlign;
double PositionHPosOffset;
double PositionHPctOffset;
BYTE PositionVRelativeFrom;
BYTE PositionVAlign;
double PositionVPosOffset;
double PositionVPctOffset;
double SimplePosX;
double SimplePosY;
CDrawingPropertyWrap DrawingPropertyWrap;
CString sChartRels;
CString sSizeRelH;
CString sSizeRelV;
int m_nDocPr;
CString sGraphicFramePr;
bool BSimplePos;
double EffectExtentL;
double EffectExtentT;
double EffectExtentR;
double EffectExtentB;
double Width;
double Height;
BYTE PositionHRelativeFrom;
BYTE PositionHAlign;
double PositionHPosOffset;
double PositionHPctOffset;
BYTE PositionVRelativeFrom;
BYTE PositionVAlign;
double PositionVPosOffset;
double PositionVPctOffset;
double SimplePosX;
double SimplePosY;
CString sChartRels;
CString sSizeRelH;
CString sSizeRelV;
int m_nDocPr;
CString sGraphicFramePr;
bool bDataPos;
CDrawingPropertyWrap DrawingPropertyWrap;
bool bDataPos;
bool bDataLength;
bool bType;
bool bBehindDoc;
@ -1986,36 +1952,37 @@ public:
bool bSimplePosX;
bool bSimplePosY;
bool bDrawingPropertyWrap;
CDrawingProperty(int nDocPr)
CDrawingProperty(int nDocPr)
{
m_nDocPr = nDocPr;
bDataPos = false;
m_nDocPr = nDocPr;
bDataPos = false;
bDataLength = false;
bType = false;
bBehindDoc = false;
bDistL = false;
bDistT = false;
bDistR = false;
bDistB = false;
bLayoutInCell = false;
bType = false;
bBehindDoc = false;
bDistL = false;
bDistT = false;
bDistR = false;
bDistB = false;
bLayoutInCell = false;
bRelativeHeight = false;
bBSimplePos = false;
bEffectExtentL = false;
bEffectExtentT = false;
bEffectExtentR = false;
bEffectExtentB = false;
bWidth = false;
bHeight = false;
bBSimplePos = false;
bEffectExtentL = false;
bEffectExtentT = false;
bEffectExtentR = false;
bEffectExtentB = false;
bWidth = false;
bHeight = false;
bPositionHRelativeFrom = false;
bPositionHAlign = false;
bPositionHAlign = false;
bPositionHPosOffset = false;
bPositionHPctOffset = false;
bPositionVRelativeFrom = false;
bPositionVAlign = false;
bPositionVAlign = false;
bPositionVPosOffset = false;
bPositionVPctOffset = false;
bSimplePosX = false;
bSimplePosY = false;
bSimplePosX = false;
bSimplePosY = false;
bDrawingPropertyWrap = false;
}
bool IsChart()
@ -2024,284 +1991,284 @@ public:
}
CString Write()
{
CString sXml;
if(bType)
{
bool bChart = IsChart();
if(c_oAscWrapStyle::Inline == Type)
{
if(bWidth && bHeight)
{
__int64 emuWidth = (__int64)(g_dKoef_mm_to_emu * Width);
__int64 emuHeight = (__int64)(g_dKoef_mm_to_emu * Height);
if(false == bChart)
sXml.AppendFormat(_T("<wp:inline xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" distT=\"0\" distB=\"0\" distL=\"0\" distR=\"0\"><wp:extent cx=\"%lld\" cy=\"%lld\"/>"), emuWidth, emuHeight);
else
sXml.AppendFormat(_T("<w:drawing><wp:inline distT=\"0\" distB=\"0\" distL=\"0\" distR=\"0\"><wp:extent cx=\"%lld\" cy=\"%lld\"/>"), emuWidth, emuHeight);
if(bEffectExtentL && bEffectExtentT && bEffectExtentR && bEffectExtentB)
{
__int64 emuEffectExtentL = (__int64)(g_dKoef_mm_to_emu * EffectExtentL);
__int64 emuEffectExtentT = (__int64)(g_dKoef_mm_to_emu * EffectExtentT);
__int64 emuEffectExtentR = (__int64)(g_dKoef_mm_to_emu * EffectExtentR);
__int64 emuEffectExtentB = (__int64)(g_dKoef_mm_to_emu * EffectExtentB);
sXml.AppendFormat(_T("<wp:effectExtent l=\"%lld\" t=\"%lld\" r=\"%lld\" b=\"%lld\"/>"), emuEffectExtentL, emuEffectExtentT, emuEffectExtentR, emuEffectExtentB);
}
if(!bType) return L"";
if(bChart)
{
sXml.AppendFormat(_T("<wp:docPr id=\"%d\" name=\"Chart %d\"/>"), m_nDocPr, m_nDocPr);
}
else
{
sXml.AppendFormat(_T("<wp:docPr id=\"%d\" name=\"\"/>"), m_nDocPr);
}
if(!sGraphicFramePr.IsEmpty())
{
sXml.Append(sGraphicFramePr);
}
else
{
sXml.Append(_T("<wp:cNvGraphicFramePr/>"));
}
if(bChart)
{
sXml.AppendFormat(_T("<a:graphic xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\"><a:graphicData uri=\"http://schemas.openxmlformats.org/drawingml/2006/chart\"><c:chart xmlns:c=\"http://schemas.openxmlformats.org/drawingml/2006/chart\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" r:id=\"%ls\"/></a:graphicData></a:graphic></wp:inline></w:drawing>"), (const TCHAR *) sChartRels);
}
else
{
sXml.Append(_T("</wp:inline>"));
}
}
}
else
{
if(bWidth && bHeight && ((bPositionHRelativeFrom && (bPositionHAlign || bPositionHPosOffset || bPositionHPctOffset)
&& bPositionVRelativeFrom && (bPositionVAlign || bPositionVPosOffset || bPositionVPctOffset))
|| (bBSimplePos && bSimplePosX && bSimplePosY)))
{
__int64 emuDistL = 0;
__int64 emuDistT = 0;
__int64 emuDistR = 0;
__int64 emuDistB = 0;
CString sXml;
if(bDistL)
emuDistL = (__int64)(g_dKoef_mm_to_emu * DistL);
if(bDistT)
emuDistT = (__int64)(g_dKoef_mm_to_emu * DistT);
if(bDistR)
emuDistR = (__int64)(g_dKoef_mm_to_emu * DistR);
if(bDistB)
emuDistB = (__int64)(g_dKoef_mm_to_emu * DistB);
int nSimplePos = 0;
if(bBSimplePos && BSimplePos)
nSimplePos = 1;
int nRelativeHeight = 0;
if(bRelativeHeight)
nRelativeHeight = RelativeHeight;
int nBehindDoc = 0;
if(bBehindDoc && BehindDoc)
nBehindDoc = 1;
int nLayoutInCell = 1;
if(bLayoutInCell && false == LayoutInCell)
nLayoutInCell = 0;
bool bChart = IsChart();
if(c_oAscWrapStyle::Inline == Type)
{
if(bWidth && bHeight)
{
__int64 emuWidth = (__int64)(g_dKoef_mm_to_emu * Width);
__int64 emuHeight = (__int64)(g_dKoef_mm_to_emu * Height);
if(false == bChart)
sXml.AppendFormat(_T("<wp:inline xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" distT=\"0\" distB=\"0\" distL=\"0\" distR=\"0\"><wp:extent cx=\"%lld\" cy=\"%lld\"/>"), emuWidth, emuHeight);
else
sXml.AppendFormat(_T("<w:drawing><wp:inline distT=\"0\" distB=\"0\" distL=\"0\" distR=\"0\"><wp:extent cx=\"%lld\" cy=\"%lld\"/>"), emuWidth, emuHeight);
if(bEffectExtentL && bEffectExtentT && bEffectExtentR && bEffectExtentB)
{
__int64 emuEffectExtentL = (__int64)(g_dKoef_mm_to_emu * EffectExtentL);
__int64 emuEffectExtentT = (__int64)(g_dKoef_mm_to_emu * EffectExtentT);
__int64 emuEffectExtentR = (__int64)(g_dKoef_mm_to_emu * EffectExtentR);
__int64 emuEffectExtentB = (__int64)(g_dKoef_mm_to_emu * EffectExtentB);
sXml.AppendFormat(_T("<wp:effectExtent l=\"%lld\" t=\"%lld\" r=\"%lld\" b=\"%lld\"/>"), emuEffectExtentL, emuEffectExtentT, emuEffectExtentR, emuEffectExtentB);
}
if(bChart)
sXml.Append(_T("<w:drawing>"));
if(bChart)
{
sXml.AppendFormat(_T("<wp:docPr id=\"%d\" name=\"Chart %d\"/>"), m_nDocPr, m_nDocPr);
}
else
{
sXml.AppendFormat(_T("<wp:docPr id=\"%d\" name=\"\"/>"), m_nDocPr);
}
if(!sGraphicFramePr.IsEmpty())
{
sXml.Append(sGraphicFramePr);
}
else
{
sXml.Append(_T("<wp:cNvGraphicFramePr/>"));
}
if(bChart)
{
sXml.AppendFormat(_T("<a:graphic xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\"><a:graphicData uri=\"http://schemas.openxmlformats.org/drawingml/2006/chart\"><c:chart xmlns:c=\"http://schemas.openxmlformats.org/drawingml/2006/chart\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" r:id=\"%ls\"/></a:graphicData></a:graphic></wp:inline></w:drawing>"), (const TCHAR *) sChartRels);
}
else
{
sXml.Append(_T("</wp:inline>"));
}
}
}
else
{
if(bWidth && bHeight && ((bPositionHRelativeFrom && (bPositionHAlign || bPositionHPosOffset || bPositionHPctOffset)
&& bPositionVRelativeFrom && (bPositionVAlign || bPositionVPosOffset || bPositionVPctOffset))
|| (bBSimplePos && bSimplePosX && bSimplePosY)))
{
__int64 emuDistL = 0;
__int64 emuDistT = 0;
__int64 emuDistR = 0;
__int64 emuDistB = 0;
sXml.AppendFormat(_T("<wp:anchor xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" distT=\"%lld\" distB=\"%lld\" distL=\"%lld\" distR=\"%lld\" simplePos=\"%d\" relativeHeight=\"%u\" behindDoc=\"%d\" locked=\"0\" layoutInCell=\"%d\" allowOverlap=\"1\">"), emuDistT, emuDistB, emuDistL, emuDistR, nSimplePos, nRelativeHeight, nBehindDoc, nLayoutInCell);
__int64 emuX = 0;
if(bSimplePosX)
emuX = (__int64)(g_dKoef_mm_to_emu * SimplePosX);
__int64 emuY = 0;
if(bSimplePosY)
emuY = (__int64)(g_dKoef_mm_to_emu * SimplePosY);
sXml.AppendFormat(_T("<wp:simplePos x=\"%lld\" y=\"%lld\"/>"), emuX, emuY);
if(bDistL)
emuDistL = (__int64)(g_dKoef_mm_to_emu * DistL);
if(bDistT)
emuDistT = (__int64)(g_dKoef_mm_to_emu * DistT);
if(bDistR)
emuDistR = (__int64)(g_dKoef_mm_to_emu * DistR);
if(bDistB)
emuDistB = (__int64)(g_dKoef_mm_to_emu * DistB);
int nSimplePos = 0;
if(bBSimplePos && BSimplePos)
nSimplePos = 1;
int nRelativeHeight = 0;
if(bRelativeHeight)
nRelativeHeight = RelativeHeight;
int nBehindDoc = 0;
if(bBehindDoc && BehindDoc)
nBehindDoc = 1;
int nLayoutInCell = 1;
if(bLayoutInCell && false == LayoutInCell)
nLayoutInCell = 0;
if(bPositionHRelativeFrom && (bPositionHAlign || bPositionHPosOffset || bPositionHPctOffset))
{
CString sRelativeFrom;
switch(PositionHRelativeFrom)
{
case 0: sRelativeFrom = _T("character");break;
case 1: sRelativeFrom = _T("column");break;
case 2: sRelativeFrom = _T("insideMargin");break;
case 3: sRelativeFrom = _T("leftMargin");break;
case 4: sRelativeFrom = _T("margin");break;
case 5: sRelativeFrom = _T("outsideMargin");break;
case 6: sRelativeFrom = _T("page");break;
case 7: sRelativeFrom = _T("rightMargin");break;
}
CString sContent;
if(bPositionHAlign)
{
switch(PositionHAlign)
{
case 0: sContent = _T("<wp:align>center</wp:align>");break;
case 1: sContent = _T("<wp:align>inside</wp:align>");break;
case 2: sContent = _T("<wp:align>left</wp:align>");break;
case 3: sContent = _T("<wp:align>outside</wp:align>");break;
case 4: sContent = _T("<wp:align>right</wp:align>");break;
}
}
else if(bPositionHPosOffset)
{
__int64 emuPosOffset = (__int64)(g_dKoef_mm_to_emu * PositionHPosOffset);
sContent.Format(_T("<wp:posOffset>%lld</wp:posOffset>"), emuPosOffset);
}
else if(bPositionHPctOffset)
{
long pctOffset = (long)(1000 * PositionHPctOffset);
sContent.Format(_T("<wp14:pctPosHOffset>%d</wp14:pctPosHOffset>"), pctOffset);
}
sXml.AppendFormat(_T("<wp:positionH relativeFrom=\"%ls\">%ls</wp:positionH>"), (const TCHAR *) sRelativeFrom, (const TCHAR *) sContent);
}
if(bPositionVRelativeFrom && (bPositionVAlign || bPositionVPosOffset || bPositionVPctOffset))
{
CString sRelativeFrom;
switch(PositionVRelativeFrom)
{
case 0: sRelativeFrom = _T("bottomMargin");break;
case 1: sRelativeFrom = _T("insideMargin");break;
case 2: sRelativeFrom = _T("line");break;
case 3: sRelativeFrom = _T("margin");break;
case 4: sRelativeFrom = _T("outsideMargin");break;
case 5: sRelativeFrom = _T("page");break;
case 6: sRelativeFrom = _T("paragraph");break;
case 7: sRelativeFrom = _T("topMargin");break;
}
CString sContent;
if(bPositionVAlign)
{
switch(PositionVAlign)
{
case 0: sContent = _T("<wp:align>bottom</wp:align>");break;
case 1: sContent = _T("<wp:align>center</wp:align>");break;
case 2: sContent = _T("<wp:align>inside</wp:align>");break;
case 3: sContent = _T("<wp:align>outside</wp:align>");break;
case 4: sContent = _T("<wp:align>top</wp:align>");break;
}
}
else if(bPositionVPosOffset)
{
__int64 emuPosOffset = (__int64)(g_dKoef_mm_to_emu * PositionVPosOffset);
sContent.Format(_T("<wp:posOffset>%lld</wp:posOffset>"), emuPosOffset);
}
else if(bPositionVPctOffset)
{
long pctOffset = (long)(1000 * PositionVPctOffset);
sContent.Format(_T("<wp14:pctPosVOffset>%d</wp14:pctPosVOffset>"), pctOffset);
}
sXml.AppendFormat(_T("<wp:positionV relativeFrom=\"%ls\">%ls</wp:positionV>"), (const TCHAR *) sRelativeFrom, (const TCHAR *) sContent);
}
__int64 emuWidth = (__int64)(g_dKoef_mm_to_emu * Width);
__int64 emuHeight = (__int64)(g_dKoef_mm_to_emu * Height);
sXml.AppendFormat(_T("<wp:extent cx=\"%lld\" cy=\"%lld\"/>"), emuWidth, emuHeight);
if(bEffectExtentL && bEffectExtentT && bEffectExtentR && bEffectExtentB)
{
__int64 emuEffectExtentL = (__int64)(g_dKoef_mm_to_emu * EffectExtentL);
__int64 emuEffectExtentT = (__int64)(g_dKoef_mm_to_emu * EffectExtentT);
__int64 emuEffectExtentR = (__int64)(g_dKoef_mm_to_emu * EffectExtentR);
__int64 emuEffectExtentB = (__int64)(g_dKoef_mm_to_emu * EffectExtentB);
sXml.AppendFormat(_T("<wp:effectExtent l=\"%lld\" t=\"%lld\" r=\"%lld\" b=\"%lld\"/>"), emuEffectExtentL, emuEffectExtentT, emuEffectExtentR, emuEffectExtentB);
}
if(bDrawingPropertyWrap && DrawingPropertyWrap.bWrappingType)
{
CString sTagName;
switch(DrawingPropertyWrap.WrappingType)
{
case c_oSerImageType2::WrapNone:sTagName = _T("wrapNone");break;
case c_oSerImageType2::WrapSquare:sTagName = _T("wrapSquare");break;
case c_oSerImageType2::WrapThrough:sTagName = _T("wrapThrough");break;
case c_oSerImageType2::WrapTight:sTagName = _T("wrapTight");break;
case c_oSerImageType2::WrapTopAndBottom:sTagName = _T("wrapTopAndBottom");break;
}
if(DrawingPropertyWrap.bStart || DrawingPropertyWrap.Points.size() > 0)
{
if( c_oSerImageType2::WrapSquare == DrawingPropertyWrap.WrappingType ||
c_oSerImageType2::WrapThrough == DrawingPropertyWrap.WrappingType ||
c_oSerImageType2::WrapTight == DrawingPropertyWrap.WrappingType)
{
sXml.AppendFormat(_T("<wp:%ls wrapText=\"bothSides\">"), (const TCHAR *) sTagName);
}
else
sXml.AppendFormat(_T("<wp:%ls>"), (const TCHAR *) sTagName);
if(bChart)
sXml.Append(_T("<w:drawing>"));
int nEdited = 0;
if(DrawingPropertyWrap.bEdited && DrawingPropertyWrap.Edited)
nEdited = 1;
sXml.AppendFormat(_T("<wp:wrapPolygon edited=\"%d\">"), nEdited);
if(DrawingPropertyWrap.bStart && DrawingPropertyWrap.Start.bX && DrawingPropertyWrap.Start.bY)
{
__int64 emuX = (__int64)(g_dKoef_mm_to_emu * DrawingPropertyWrap.Start.X);
__int64 emuY = (__int64)(g_dKoef_mm_to_emu * DrawingPropertyWrap.Start.Y);
sXml.AppendFormat(_T("<wp:start x=\"%lld\" y=\"%lld\"/>"), emuX, emuY);
}
for(int i = 0, length = DrawingPropertyWrap.Points.size(); i < length; ++i)
{
CDrawingPropertyWrapPoint* pWrapPoint = DrawingPropertyWrap.Points[i];
if(pWrapPoint->bX && pWrapPoint->bY)
{
__int64 emuX = (__int64)(g_dKoef_mm_to_emu * pWrapPoint->X);
__int64 emuY = (__int64)(g_dKoef_mm_to_emu * pWrapPoint->Y);
sXml.AppendFormat(_T("<wp:lineTo x=\"%lld\" y=\"%lld\"/>"), emuX, emuY);
}
}
sXml.Append(_T("</wp:wrapPolygon>"));
sXml.AppendFormat(_T("</wp:%ls>"), (const TCHAR *) sTagName);
}
else
{
//для wrapThrough и wrapTight wrapPolygon обязательное поле, если его нет - меняем тип.
if( c_oSerImageType2::WrapSquare == DrawingPropertyWrap.WrappingType ||
c_oSerImageType2::WrapThrough == DrawingPropertyWrap.WrappingType ||
c_oSerImageType2::WrapTight == DrawingPropertyWrap.WrappingType)
{
sXml.Append(_T("<wp:wrapSquare wrapText=\"bothSides\"/>"));
}
else
sXml.AppendFormat(_T("<wp:%ls/>"), (const TCHAR *) sTagName);
}
}
else
sXml.Append(_T("<wp:wrapNone/>"));
sXml.AppendFormat(_T("<wp:anchor xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" distT=\"%lld\" distB=\"%lld\" distL=\"%lld\" distR=\"%lld\" simplePos=\"%d\" relativeHeight=\"%u\" behindDoc=\"%d\" locked=\"0\" layoutInCell=\"%d\" allowOverlap=\"1\">"), emuDistT, emuDistB, emuDistL, emuDistR, nSimplePos, nRelativeHeight, nBehindDoc, nLayoutInCell);
__int64 emuX = 0;
if(bSimplePosX)
emuX = (__int64)(g_dKoef_mm_to_emu * SimplePosX);
__int64 emuY = 0;
if(bSimplePosY)
emuY = (__int64)(g_dKoef_mm_to_emu * SimplePosY);
sXml.AppendFormat(_T("<wp:simplePos x=\"%lld\" y=\"%lld\"/>"), emuX, emuY);
if(bChart)
{
sXml.AppendFormat(_T("<wp:docPr id=\"%d\" name=\"Chart %d\"/>"), m_nDocPr, m_nDocPr);
}
else
{
sXml.AppendFormat(_T("<wp:docPr id=\"%d\" name=\"\"/>"), m_nDocPr);
}
if(!sGraphicFramePr.IsEmpty())
{
sXml.Append(sGraphicFramePr);
}
else
{
sXml.Append(_T("<wp:cNvGraphicFramePr/>"));
}
if(bChart)
{
sXml.AppendFormat(_T("<a:graphic xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\"><a:graphicData uri=\"http://schemas.openxmlformats.org/drawingml/2006/chart\"><c:chart xmlns:c=\"http://schemas.openxmlformats.org/drawingml/2006/chart\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" r:id=\"%ls\"/></a:graphicData></a:graphic>"), (const TCHAR *) sChartRels);
}
if(bPositionHRelativeFrom && (bPositionHAlign || bPositionHPosOffset || bPositionHPctOffset))
{
CString sRelativeFrom;
switch(PositionHRelativeFrom)
{
case 0: sRelativeFrom = _T("character");break;
case 1: sRelativeFrom = _T("column");break;
case 2: sRelativeFrom = _T("insideMargin");break;
case 3: sRelativeFrom = _T("leftMargin");break;
case 4: sRelativeFrom = _T("margin");break;
case 5: sRelativeFrom = _T("outsideMargin");break;
case 6: sRelativeFrom = _T("page");break;
case 7: sRelativeFrom = _T("rightMargin");break;
}
CString sContent;
if(bPositionHAlign)
{
switch(PositionHAlign)
{
case 0: sContent = _T("<wp:align>center</wp:align>");break;
case 1: sContent = _T("<wp:align>inside</wp:align>");break;
case 2: sContent = _T("<wp:align>left</wp:align>");break;
case 3: sContent = _T("<wp:align>outside</wp:align>");break;
case 4: sContent = _T("<wp:align>right</wp:align>");break;
}
}
else if(bPositionHPosOffset)
{
__int64 emuPosOffset = (__int64)(g_dKoef_mm_to_emu * PositionHPosOffset);
sContent.Format(_T("<wp:posOffset>%lld</wp:posOffset>"), emuPosOffset);
}
else if(bPositionHPctOffset)
{
long pctOffset = (long)(1000 * PositionHPctOffset);
sContent.Format(_T("<wp14:pctPosHOffset>%d</wp14:pctPosHOffset>"), pctOffset);
}
sXml.AppendFormat(_T("<wp:positionH relativeFrom=\"%ls\">%ls</wp:positionH>"), (const TCHAR *) sRelativeFrom, (const TCHAR *) sContent);
}
if(bPositionVRelativeFrom && (bPositionVAlign || bPositionVPosOffset || bPositionVPctOffset))
{
CString sRelativeFrom;
switch(PositionVRelativeFrom)
{
case 0: sRelativeFrom = _T("bottomMargin");break;
case 1: sRelativeFrom = _T("insideMargin");break;
case 2: sRelativeFrom = _T("line");break;
case 3: sRelativeFrom = _T("margin");break;
case 4: sRelativeFrom = _T("outsideMargin");break;
case 5: sRelativeFrom = _T("page");break;
case 6: sRelativeFrom = _T("paragraph");break;
case 7: sRelativeFrom = _T("topMargin");break;
}
CString sContent;
if(bPositionVAlign)
{
switch(PositionVAlign)
{
case 0: sContent = _T("<wp:align>bottom</wp:align>");break;
case 1: sContent = _T("<wp:align>center</wp:align>");break;
case 2: sContent = _T("<wp:align>inside</wp:align>");break;
case 3: sContent = _T("<wp:align>outside</wp:align>");break;
case 4: sContent = _T("<wp:align>top</wp:align>");break;
}
}
else if(bPositionVPosOffset)
{
__int64 emuPosOffset = (__int64)(g_dKoef_mm_to_emu * PositionVPosOffset);
sContent.Format(_T("<wp:posOffset>%lld</wp:posOffset>"), emuPosOffset);
}
else if(bPositionVPctOffset)
{
long pctOffset = (long)(1000 * PositionVPctOffset);
sContent.Format(_T("<wp14:pctPosVOffset>%d</wp14:pctPosVOffset>"), pctOffset);
}
sXml.AppendFormat(_T("<wp:positionV relativeFrom=\"%ls\">%ls</wp:positionV>"), (const TCHAR *) sRelativeFrom, (const TCHAR *) sContent);
}
__int64 emuWidth = (__int64)(g_dKoef_mm_to_emu * Width);
__int64 emuHeight = (__int64)(g_dKoef_mm_to_emu * Height);
sXml.AppendFormat(_T("<wp:extent cx=\"%lld\" cy=\"%lld\"/>"), emuWidth, emuHeight);
if(bEffectExtentL && bEffectExtentT && bEffectExtentR && bEffectExtentB)
{
__int64 emuEffectExtentL = (__int64)(g_dKoef_mm_to_emu * EffectExtentL);
__int64 emuEffectExtentT = (__int64)(g_dKoef_mm_to_emu * EffectExtentT);
__int64 emuEffectExtentR = (__int64)(g_dKoef_mm_to_emu * EffectExtentR);
__int64 emuEffectExtentB = (__int64)(g_dKoef_mm_to_emu * EffectExtentB);
sXml.AppendFormat(_T("<wp:effectExtent l=\"%lld\" t=\"%lld\" r=\"%lld\" b=\"%lld\"/>"), emuEffectExtentL, emuEffectExtentT, emuEffectExtentR, emuEffectExtentB);
}
if(bDrawingPropertyWrap && DrawingPropertyWrap.bWrappingType)
{
CString sTagName;
switch(DrawingPropertyWrap.WrappingType)
{
case c_oSerImageType2::WrapNone:sTagName = _T("wrapNone");break;
case c_oSerImageType2::WrapSquare:sTagName = _T("wrapSquare");break;
case c_oSerImageType2::WrapThrough:sTagName = _T("wrapThrough");break;
case c_oSerImageType2::WrapTight:sTagName = _T("wrapTight");break;
case c_oSerImageType2::WrapTopAndBottom:sTagName = _T("wrapTopAndBottom");break;
}
if(DrawingPropertyWrap.bStart || DrawingPropertyWrap.Points.size() > 0)
{
if( c_oSerImageType2::WrapSquare == DrawingPropertyWrap.WrappingType ||
c_oSerImageType2::WrapThrough == DrawingPropertyWrap.WrappingType ||
c_oSerImageType2::WrapTight == DrawingPropertyWrap.WrappingType)
{
sXml.AppendFormat(_T("<wp:%ls wrapText=\"bothSides\">"), (const TCHAR *) sTagName);
}
else
sXml.AppendFormat(_T("<wp:%ls>"), (const TCHAR *) sTagName);
if(!sSizeRelH.IsEmpty())
{
sXml.Append(sSizeRelH);
}
if(!sSizeRelV.IsEmpty())
{
sXml.Append(sSizeRelV);
}
int nEdited = 0;
if(DrawingPropertyWrap.bEdited && DrawingPropertyWrap.Edited)
nEdited = 1;
sXml.AppendFormat(_T("<wp:wrapPolygon edited=\"%d\">"), nEdited);
if(DrawingPropertyWrap.bStart && DrawingPropertyWrap.Start.bX && DrawingPropertyWrap.Start.bY)
{
__int64 emuX = (__int64)(g_dKoef_mm_to_emu * DrawingPropertyWrap.Start.X);
__int64 emuY = (__int64)(g_dKoef_mm_to_emu * DrawingPropertyWrap.Start.Y);
sXml.AppendFormat(_T("<wp:start x=\"%lld\" y=\"%lld\"/>"), emuX, emuY);
}
for(int i = 0, length = DrawingPropertyWrap.Points.size(); i < length; ++i)
{
CDrawingPropertyWrapPoint* pWrapPoint = DrawingPropertyWrap.Points[i];
if(pWrapPoint->bX && pWrapPoint->bY)
{
__int64 emuX = (__int64)(g_dKoef_mm_to_emu * pWrapPoint->X);
__int64 emuY = (__int64)(g_dKoef_mm_to_emu * pWrapPoint->Y);
sXml.AppendFormat(_T("<wp:lineTo x=\"%lld\" y=\"%lld\"/>"), emuX, emuY);
}
}
sXml.Append(_T("</wp:wrapPolygon>"));
sXml.AppendFormat(_T("</wp:%ls>"), (const TCHAR *) sTagName);
}
else
{
//для wrapThrough и wrapTight wrapPolygon обязательное поле, если его нет - меняем тип.
if( c_oSerImageType2::WrapSquare == DrawingPropertyWrap.WrappingType ||
c_oSerImageType2::WrapThrough == DrawingPropertyWrap.WrappingType ||
c_oSerImageType2::WrapTight == DrawingPropertyWrap.WrappingType)
{
sXml.Append(_T("<wp:wrapSquare wrapText=\"bothSides\"/>"));
}
else
sXml.AppendFormat(_T("<wp:%ls/>"), (const TCHAR *) sTagName);
}
}
else
sXml.Append(_T("<wp:wrapNone/>"));
sXml.Append(_T("</wp:anchor>"));
if(bChart)
{
sXml.AppendFormat(_T("<wp:docPr id=\"%d\" name=\"Chart %d\"/>"), m_nDocPr, m_nDocPr);
}
else
{
sXml.AppendFormat(_T("<wp:docPr id=\"%d\" name=\"\"/>"), m_nDocPr);
}
if(!sGraphicFramePr.IsEmpty())
{
sXml.Append(sGraphicFramePr);
}
else
{
sXml.Append(_T("<wp:cNvGraphicFramePr/>"));
}
if(bChart)
{
sXml.AppendFormat(_T("<a:graphic xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\"><a:graphicData uri=\"http://schemas.openxmlformats.org/drawingml/2006/chart\"><c:chart xmlns:c=\"http://schemas.openxmlformats.org/drawingml/2006/chart\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" r:id=\"%ls\"/></a:graphicData></a:graphic>"), (const TCHAR *) sChartRels);
}
if(bChart)
sXml.Append(_T("</w:drawing>"));
}
}
}
if(!sSizeRelH.IsEmpty())
{
sXml.Append(sSizeRelH);
}
if(!sSizeRelV.IsEmpty())
{
sXml.Append(sSizeRelV);
}
sXml.Append(_T("</wp:anchor>"));
if(bChart)
sXml.Append(_T("</w:drawing>"));
}
}
return sXml;
}
};

View File

@ -33,13 +33,14 @@
#define READERS
#include "FileWriter.h"
#include "../BinWriter/BinReaderWriterDefines.h"
#include "ReaderClasses.h"
#include "../BinWriter/BinReaderWriterDefines.h"
#include "../../XlsxSerializerCom/Writer/BinaryReader.h"
#include "../../DesktopEditor/common/ASCVariant.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Docx.h"
#include "../DocWrapper/XlsxSerializer.h"
#include "../../DesktopEditor/common/ASCVariant.h"
namespace BinDocxRW {
@ -613,9 +614,8 @@ public:
if(0 != contextualSpacing)
pCStringWriter->WriteString(CString(_T("<w:contextualSpacing w:val=\"true\"/>")));
else if(false == bDoNotWriteNullProp)
pCStringWriter->WriteString(CString(_T("<w:contextualSpacing w:val=\"false\"/>")));
break;
}
pCStringWriter->WriteString(CString(_T("<w:contextualSpacing w:val=\"false\"/>")));
}break;
case c_oSerProp_pPrType::Ind:
{
XmlUtils::CStringWriter oTempWriter;
@ -637,27 +637,24 @@ public:
case align_Left: pCStringWriter->WriteString(CString(_T("<w:jc w:val=\"left\" />")));break;
case align_Center: pCStringWriter->WriteString(CString(_T("<w:jc w:val=\"center\" />")));break;
case align_Justify: pCStringWriter->WriteString(CString(_T("<w:jc w:val=\"both\" />")));break;
}
break;
}
}
}break;
case c_oSerProp_pPrType::KeepLines:
{
BYTE KeepLines = m_oBufferedStream.GetUChar();
if(0 != KeepLines)
pCStringWriter->WriteString(CString(_T("<w:keepLines/>")));
else if(false == bDoNotWriteNullProp)
pCStringWriter->WriteString(CString(_T("<w:keepLines w:val=\"false\"/>")));
break;
}
pCStringWriter->WriteString(CString(_T("<w:keepLines w:val=\"false\"/>")));
}break;
case c_oSerProp_pPrType::KeepNext:
{
BYTE KeepNext = m_oBufferedStream.GetUChar();
if(0 != KeepNext)
pCStringWriter->WriteString(CString(_T("<w:keepNext/>")));
else if(false == bDoNotWriteNullProp)
pCStringWriter->WriteString(CString(_T("<w:keepNext w:val=\"false\"/>")));
break;
}
pCStringWriter->WriteString(CString(_T("<w:keepNext w:val=\"false\"/>")));
}break;
case c_oSerProp_pPrType::PageBreakBefore:
{
BYTE pageBreakBefore = m_oBufferedStream.GetUChar();
@ -788,9 +785,8 @@ public:
pCStringWriter->WriteString(sTab);
}
pCStringWriter->WriteString(CString(_T("</w:tabs>")));
}
break;
}
}
}break;
case c_oSerProp_pPrType::ParaStyle:
{
CString sStyleName(m_oBufferedStream.GetString3(length));
@ -799,23 +795,23 @@ public:
sStyle.Append(_T("<w:pStyle w:val=\""));
sStyle.Append(sStyleName);
sStyle.Append(_T("\" />"));
pCStringWriter->WriteString(sStyle);
break;
}
pCStringWriter->WriteString(sStyle);
}break;
case c_oSerProp_pPrType::numPr:
pCStringWriter->WriteString(CString(_T("<w:numPr>")));
res = Read2(length, &Binary_pPrReader::ReadNumPr, this, poResult);
pCStringWriter->WriteString(CString(_T("</w:numPr>")));
break;
{
pCStringWriter->WriteString(CString(_T("<w:numPr>")));
res = Read2(length, &Binary_pPrReader::ReadNumPr, this, poResult);
pCStringWriter->WriteString(CString(_T("</w:numPr>")));
}break;
case c_oSerProp_pPrType::pPr_rPr:
{
rPr orPr(m_oFontTableWriter.m_mapFonts);
res = oBinary_rPrReader.Read(length, &orPr);
//Read2(length, &Binary_pPrReader::ReadNumPr, this, &orPr);
if(orPr.IsNoEmpty())
orPr.Write(pCStringWriter);
break;
}
orPr.Write(pCStringWriter);
}break;
case c_oSerProp_pPrType::pBdr:
{
docBorders odocBorders;
@ -825,33 +821,29 @@ public:
pCStringWriter->WriteString(CString(_T("<w:pBdr>")));
odocBorders.Write(pCStringWriter, false);
pCStringWriter->WriteString(CString(_T("</w:pBdr>")));
}
break;
}
}
}break;
case c_oSerProp_pPrType::FramePr:
{
CFramePr oFramePr;
res = Read2(length, &Binary_pPrReader::ReadFramePr, this, &oFramePr);
if(false == oFramePr.IsEmpty())
oFramePr.Write(*pCStringWriter);
break;
}
oFramePr.Write(*pCStringWriter);
}break;
case c_oSerProp_pPrType::pPrChange:
{
TrackRevision oPPrChange;
res = Read1(length, &Binary_pPrReader::ReadPPrChange, this, &oPPrChange);
oPPrChange.Write(pCStringWriter, _T("w:pPrChange"));
break;
}
case c_oSerProp_pPrType::SectPr:
oPPrChange.Write(pCStringWriter, _T("w:pPrChange"));
}break;
case c_oSerProp_pPrType::SectPr:
{
SectPr oSectPr;
res = Read1(length, &Binary_pPrReader::Read_SecPr, this, &oSectPr);
pCStringWriter->WriteString(CString(_T("<w:sectPr>")));
pCStringWriter->WriteString(oSectPr.Write());
pCStringWriter->WriteString(CString(_T("</w:sectPr>")));
break;
}
pCStringWriter->WriteString(CString(_T("</w:sectPr>")));
}break;
default:
res = c_oSerConstants::ReadUnknown;
break;
@ -871,7 +863,7 @@ public:
else
res = c_oSerConstants::ReadUnknown;
return res;
};
}
int ReadInd(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
@ -913,7 +905,7 @@ public:
break;
}
return res;
};
}
int ReadSpacing(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
@ -949,7 +941,7 @@ public:
break;
}
return res;
};
}
int ReadTabs(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
@ -975,7 +967,7 @@ public:
else
res = c_oSerConstants::ReadUnknown;
return res;
};
}
int ReadNumPr(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
@ -1050,7 +1042,7 @@ public:
else
res = c_oSerConstants::ReadUnknown;
return res;
};
}
int ReadBorder(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
@ -1083,7 +1075,7 @@ public:
else
res = c_oSerConstants::ReadUnknown;
return res;
};
}
int ReadFramePr(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
@ -1161,9 +1153,9 @@ public:
else
res = c_oSerConstants::ReadUnknown;
return res;
};
int Read_SecPr(BYTE type, long length, void* poResult)
{
}
int Read_SecPr(BYTE type, long length, void* poResult)
{
SectPr* pSectPr = static_cast<SectPr*>(poResult);
int res = c_oSerConstants::ReadOk;
if( c_oSerProp_secPrType::pgSz == type )
@ -2945,11 +2937,11 @@ public:
{
m_oFileWriter.m_oMediaWriter.AddImage2(pFileNative);
}
else if(NSFile::CFileBinary::Exists(string2std_string(sFilePath)))
else if(NSFile::CFileBinary::Exists(sFilePath))
{
m_oFileWriter.m_oMediaWriter.AddImage(sFilePath);
if(bDeleteFile)
NSFile::CFileBinary::Remove(string2std_string(sFilePath));
NSFile::CFileBinary::Remove(sFilePath);
}
}
else
@ -3579,22 +3571,37 @@ public:
};
class Binary_DocumentTableReader : public Binary_CommonReader<Binary_DocumentTableReader>
{
Writers::FileWriter& m_oFileWriter;
Writers::FontTableWriter& m_oFontTableWriter;
Binary_pPrReader oBinary_pPrReader;
Binary_rPrReader oBinary_rPrReader;
Binary_tblPrReader oBinary_tblPrReader;
XmlUtils::CStringWriter* m_pCurWriter;
rPr m_oCur_rPr;
rPr m_oMath_rPr;
XmlUtils::CStringWriter m_oCur_pPr;
BYTE m_byteLastElemType;
CComments* m_pComments;
private:
Binary_CommonReader2 oBinary_CommonReader2;
Writers::FileWriter& m_oFileWriter;
Writers::FontTableWriter& m_oFontTableWriter;
Binary_pPrReader oBinary_pPrReader;
Binary_rPrReader oBinary_rPrReader;
Binary_tblPrReader oBinary_tblPrReader;
XmlUtils::CStringWriter* m_pCurWriter;
rPr m_oCur_rPr;
rPr m_oMath_rPr;
XmlUtils::CStringWriter m_oCur_pPr;
BYTE m_byteLastElemType;
CComments* m_pComments;
public:
Writers::ContentWriter& m_oDocumentWriter;
Writers::MediaWriter& m_oMediaWriter;
public:
Binary_DocumentTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter, Writers::ContentWriter& oDocumentWriter, CComments* pComments) :Binary_CommonReader(poBufferedStream), m_oDocumentWriter(oDocumentWriter), m_oFileWriter(oFileWriter), m_oMediaWriter(oFileWriter.m_oMediaWriter), m_oFontTableWriter(oFileWriter.m_oFontTableWriter), oBinary_pPrReader(poBufferedStream, oFileWriter), oBinary_rPrReader(poBufferedStream, oFileWriter), oBinary_tblPrReader(poBufferedStream, oFileWriter), m_oCur_rPr(m_oFontTableWriter.m_mapFonts), m_oMath_rPr(m_oFontTableWriter.m_mapFonts), m_pComments(pComments)
Writers::ContentWriter& m_oDocumentWriter;
Writers::MediaWriter& m_oMediaWriter;
Binary_DocumentTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter, Writers::ContentWriter& oDocumentWriter, CComments* pComments)
: Binary_CommonReader(poBufferedStream)
, m_oDocumentWriter(oDocumentWriter)
, m_oFileWriter(oFileWriter)
, m_oMediaWriter(oFileWriter.m_oMediaWriter)
, m_oFontTableWriter(oFileWriter.m_oFontTableWriter)
, oBinary_CommonReader2(poBufferedStream)
, oBinary_pPrReader(poBufferedStream, oFileWriter)
, oBinary_rPrReader(poBufferedStream, oFileWriter)
, oBinary_tblPrReader(poBufferedStream, oFileWriter)
, m_oCur_rPr(m_oFontTableWriter.m_mapFonts)
, m_oMath_rPr(m_oFontTableWriter.m_mapFonts)
, m_pComments(pComments)
{
m_byteLastElemType = c_oSerParType::Content;
m_pCurWriter = NULL;
@ -3605,7 +3612,7 @@ public:
int Read()
{
return ReadTable(&Binary_DocumentTableReader::ReadDocumentContent, this);
};
}
XmlUtils::CStringWriter& GetRunStringWriter()
{
if(NULL != m_pCurWriter)
@ -3628,12 +3635,12 @@ public:
else if(c_oSerParType::Table == type)
{
m_byteLastElemType = c_oSerParType::Table;
//сбрасываем Shd
//сбрасываем Shd
oBinary_tblPrReader.m_sCurTableShd.Empty();
m_oDocumentWriter.m_oContent.WriteString(CString(_T("<w:tbl>")));
res = Read1(length, &Binary_DocumentTableReader::ReadDocTable, this, &m_oDocumentWriter.m_oContent);
m_oDocumentWriter.m_oContent.WriteString(CString(_T("</w:tbl>")));
//сбрасываем Shd
//сбрасываем Shd
oBinary_tblPrReader.m_sCurTableShd.Empty();
}
else if ( c_oSerParType::sectPr == type )
@ -3644,10 +3651,16 @@ public:
if(oSectPr.bEvenAndOddHeaders && oSectPr.EvenAndOddHeaders)
m_oFileWriter.m_oSettingWriter.AddSetting(_T("<w:evenAndOddHeaders/>"));
}
else if ( c_oSerParType::Background == type )
{
Background oBackground;
res = Read2(length, &Binary_DocumentTableReader::Read_Background, this, &oBackground);
m_oDocumentWriter.m_oBackground.WriteString(oBackground.Write());
}
else
res = c_oSerConstants::ReadUnknown;
return res;
};
}
int ReadParagraph(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
@ -3668,7 +3681,7 @@ public:
else
res = c_oSerConstants::ReadUnknown;
return res;
};
}
int ReadParagraphContent(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
@ -6262,7 +6275,7 @@ public:
else
res = c_oSerConstants::ReadUnknown;
return res;
};
}
int ReadFootnoteRef(BYTE type, long length, void* poResult)
{
OOX::Logic::CFootnoteReference* pFootnoteRef = static_cast<OOX::Logic::CFootnoteReference*>(poResult);
@ -6304,20 +6317,14 @@ public:
CString sDrawingProperty = oCDrawingProperty.Write();
if(false == sDrawingProperty.IsEmpty())
{
VARIANT var;
var.vt = VT_I4;
var.lVal = m_oFileWriter.m_oChartWriter.getChartCount();
m_oFileWriter.m_pDrawingConverter->SetAdditionalParam(CString(_T("DocumentChartsCount")), var);
m_oFileWriter.m_pDrawingConverter->SetDocumentChartsCount(m_oFileWriter.m_oChartWriter.getChartCount());
long nCurPos = m_oBufferedStream.GetPos();
CString* bstrDrawingXml = NULL;
m_oFileWriter.m_pDrawingConverter->SaveObjectEx(oCDrawingProperty.DataPos, oCDrawingProperty.DataLength, sDrawingProperty, XMLWRITER_DOC_TYPE_DOCX, &bstrDrawingXml);
m_oBufferedStream.Seek(nCurPos);
VARIANT vt;
m_oFileWriter.m_pDrawingConverter->GetAdditionalParam(CString(_T("DocumentChartsCount")), &vt);
if(VT_I4 == vt.vt)
m_oFileWriter.m_oChartWriter.setChartCount(vt.lVal);
m_oFileWriter.m_oChartWriter.setChartCount(m_oFileWriter.m_pDrawingConverter->GetDocumentChartsCount());
if(NULL != bstrDrawingXml && false == bstrDrawingXml->IsEmpty())
{
@ -6339,8 +6346,11 @@ public:
{
CDrawingProperty oCDrawingProperty(m_oFileWriter.getNextDocPr());
res = Read2(length, &Binary_DocumentTableReader::ReadPptxDrawing, this, &oCDrawingProperty);
if(oCDrawingProperty.bDataPos && oCDrawingProperty.bDataLength)
if(oCDrawingProperty.bDataPos && oCDrawingProperty.bDataLength)
{
ReadDrawing(oCDrawingProperty);
}
}
else
res = c_oSerConstants::ReadUnknown;
@ -6380,7 +6390,7 @@ public:
else
res = c_oSerConstants::ReadUnknown;
return res;
};
};
int Read_tblGrid(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
@ -6545,6 +6555,53 @@ public:
res = c_oSerConstants::ReadUnknown;
return res;
}
int Read_Background(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
Background* pBackground = static_cast<Background*>(poResult);
if( c_oSerBackgroundType::Color == type )
{
pBackground->bColor = true;
pBackground->Color = oBinary_CommonReader2.ReadColor();
}
else if( c_oSerBackgroundType::ColorTheme == type )
{
pBackground->bThemeColor = true;
oBinary_CommonReader2.ReadThemeColor(length, pBackground->ThemeColor);
}
else if( c_oSerBackgroundType::pptxDrawing == type )
{
CDrawingProperty oCDrawingProperty(m_oFileWriter.getNextDocPr());
oCDrawingProperty.bType = oCDrawingProperty.bHeight = oCDrawingProperty.bWidth = true;
oCDrawingProperty.Type = c_oAscWrapStyle::Inline;
CString sDrawingProperty = oCDrawingProperty.Write();
BYTE type = m_oBufferedStream.GetUChar();
long lenType = m_oBufferedStream.GetUChar();
int nRealLen = m_oBufferedStream.GetLong();
CString* bstrDrawingXml = NULL;
long nCurPos = m_oBufferedStream.GetPos();
m_oFileWriter.m_pDrawingConverter->SaveObjectEx(nCurPos, nRealLen, sDrawingProperty, XMLWRITER_DOC_TYPE_DOCX, &bstrDrawingXml);
if(NULL != bstrDrawingXml && false == bstrDrawingXml->IsEmpty())
{
pBackground->sObject = *bstrDrawingXml;
}
RELEASEOBJECT(bstrDrawingXml);
m_oBufferedStream.Seek(nCurPos + nRealLen);
}
else
res = c_oSerConstants::ReadUnknown;
return res;
}
int ReadPptxDrawing(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
@ -6591,14 +6648,14 @@ public:
//save xlsx
std::wstring sXlsxFilename = L"Microsoft_Excel_Worksheet" + std::to_wstring(m_oFileWriter.m_oChartWriter.getChartCount() + 1) + L".xlsx";
std::wstring sXlsxPath = string2std_string(pathChartsWorksheetDir.GetPath() + FILE_SEPARATOR_STR) + sXlsxFilename;
std::wstring sXlsxPath = pathChartsWorksheetDir.GetPath() + FILE_SEPARATOR_STR + sXlsxFilename;
BinXlsxRW::CXlsxSerializer oXlsxSerializer;
oXlsxSerializer.writeChartXlsx(sXlsxPath, *pChartSpace);
std::wstring sChartsWorksheetRelsName = L"../embeddings/" + sXlsxFilename;
long rIdXlsx;
CString bstrChartsWorksheetRelType = OOX::Spreadsheet::FileTypes::ChartsWorksheet.RelationType();
m_oFileWriter.m_pDrawingConverter->WriteRels(bstrChartsWorksheetRelType, std_string2string(sChartsWorksheetRelsName), CString(), &rIdXlsx);
m_oFileWriter.m_pDrawingConverter->WriteRels(bstrChartsWorksheetRelType, sChartsWorksheetRelsName, CString(), &rIdXlsx);
pChartSpace->m_oChartSpace.m_externalData = new OOX::Spreadsheet::CT_ExternalData();
pChartSpace->m_oChartSpace.m_externalData->m_id = new std::wstring();
@ -6611,14 +6668,15 @@ public:
NSStringUtils::CStringBuilder sw;
pChartSpace->toXML(sw);
CString sFilename;
CString sRelsName;
std::wstring sFilename;
std::wstring sRelsName;
int nChartIndex;
std::wstring sContent = sw.GetData();
m_oFileWriter.m_oChartWriter.AddChart(sContent, sRelsName, sFilename, nChartIndex);
m_oFileWriter.m_oChartWriter.AddChart(sContent, sRelsName, sFilename, nChartIndex);
m_oFileWriter.m_oContentTypesWriter.AddOverrideRaw(oSaveParams.sAdditionalContentTypes);
OOX::CPath pathChartsRels = pathChartsRelsDir.GetPath() + FILE_SEPARATOR_STR + sFilename + _T(".rels");
OOX::CPath pathChartsRels = pathChartsRelsDir.GetPath() + FILE_SEPARATOR_STR + sFilename + L".rels";
m_oFileWriter.m_pDrawingConverter->SaveDstContentRels(pathChartsRels.GetPath());
long rIdChart;
@ -7035,7 +7093,7 @@ Binary_HdrFtrTableReader::Binary_HdrFtrTableReader(NSBinPptxRW::CBinaryFileReade
int Binary_HdrFtrTableReader::Read()
{
return ReadTable(&Binary_HdrFtrTableReader::ReadHdrFtrContent, this);
};
}
int Binary_HdrFtrTableReader::ReadHdrFtrContent(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;

View File

@ -57,7 +57,7 @@ namespace Writers
if(sFontDir.IsEmpty())
m_oApplicationFonts.Initialize();
else
m_oApplicationFonts.InitializeFromFolder(string2std_string(sFontDir));
m_oApplicationFonts.InitializeFromFolder(sFontDir);
CFontList* pFontList = m_oApplicationFonts.GetList();
if(NULL != pFontList)
{

View File

@ -152,7 +152,8 @@ extern int g_nCurFormatVersion;
Comments = 8,
Settings = 9,
Footnotes = 10,
Endnotes = 11
Endnotes = 11,
Background
};}
namespace c_oSerSigTypes{enum c_oSerSigTypes
{
@ -446,20 +447,21 @@ extern int g_nCurFormatVersion;
};}
namespace c_oSerParType{enum c_oSerParType
{
Par = 0,
pPr = 1,
Content = 2,
Table = 3,
sectPr = 4,
Run = 5,
CommentStart = 6,
CommentEnd = 7,
OMathPara = 8,
OMath = 9,
Hyperlink = 10,
FldSimple = 11,
Del = 12,
Ins = 13
Par = 0,
pPr = 1,
Content = 2,
Table = 3,
sectPr = 4,
Run = 5,
CommentStart = 6,
CommentEnd = 7,
OMathPara = 8,
OMath = 9,
Hyperlink = 10,
FldSimple = 11,
Del = 12,
Ins = 13,
Background = 14
};}
namespace c_oSerDocTableType{enum c_oSerDocTableType
{
@ -506,6 +508,12 @@ extern int g_nCurFormatVersion;
endnoteReference = 27,
arPr = 28
};}
namespace c_oSerBackgroundType{enum c_oSerBackgroundType
{
Color = 0,
ColorTheme = 1,
pptxDrawing = 2
};}
namespace c_oSerImageType{enum c_oSerImageType
{
MediaId = 0,

File diff suppressed because it is too large Load Diff

View File

@ -248,7 +248,7 @@ namespace BinXlsxRW{
pTable->m_oTable->m_oDisplayName.Init();
pTable->m_oTable->m_oDisplayName->append(L"Table1");
pTable->m_oTable->m_oRef.Init();
pTable->m_oTable->m_oRef->SetValue(std_string2string(OOX::Spreadsheet::CCell::combineRef(m_nRow1 - 1, m_nCol1 - 1) + L":" + OOX::Spreadsheet::CCell::combineRef(m_nRow2 - 1, m_nCol2 - 1)));
pTable->m_oTable->m_oRef->SetValue(OOX::Spreadsheet::CCell::combineRef(m_nRow1 - 1, m_nCol1 - 1) + L":" + OOX::Spreadsheet::CCell::combineRef(m_nRow2 - 1, m_nCol2 - 1));
pTable->m_oTable->m_oTotalsRowCount.Init();
pTable->m_oTable->m_oTotalsRowCount->SetValue(0);
pTable->m_oTable->m_oTableBorderDxfId.Init();

View File

@ -32,12 +32,7 @@
#ifndef CHART_WRITER
#define CHART_WRITER
#if defined(_WIN32) || defined (_WIN64)
#include <atlbase.h>
#include <atlstr.h>
#else
#include "../../Common/DocxFormat/Source/Base/ASCString.h"
#endif
#include "../../Common/DocxFormat/Source/Base/ASCString.h"
#include <string>
#include <map>

View File

@ -50,48 +50,45 @@ BinDocxRW::CDocxSerializer::CDocxSerializer()
}
bool BinDocxRW::CDocxSerializer::ConvertDocxToDoct(const CString& sSrcFileName, const CString& sDstFileName, const CString& sTmpDir, const CString& sXMLOptions)
{
std::wstring strDirSrc = NSSystemPath::Combine(string2std_string(sTmpDir), _T("from"));
std::wstring strDirDst = NSSystemPath::Combine(string2std_string(sTmpDir), _T("to"));
std::wstring strEditorBin = NSSystemPath::Combine(strDirDst, _T("Editor.bin"));
std::wstring strDirSrc = NSSystemPath::Combine(sTmpDir, L"from");
std::wstring strDirDst = NSSystemPath::Combine(sTmpDir, L"to");
std::wstring strEditorBin = NSSystemPath::Combine(strDirDst, L"Editor.bin");
NSDirectory::CreateDirectory(strDirSrc);
NSDirectory::CreateDirectory(strDirDst);
CString sDirSrc = std_string2string(strDirSrc);
CString sEditorBin = std_string2string(strEditorBin);
COfficeUtils oCOfficeUtils(NULL);
if(S_OK == oCOfficeUtils.ExtractToDirectory(string2std_string(sSrcFileName), strDirSrc, NULL, 0))
if(saveToFile(sEditorBin, sDirSrc, sXMLOptions))
if(S_OK == oCOfficeUtils.CompressFileOrDirectory(strDirDst, string2std_string(sDstFileName), -1))
if(S_OK == oCOfficeUtils.ExtractToDirectory(sSrcFileName, strDirSrc, NULL, 0))
if(saveToFile(strEditorBin, strDirSrc, sXMLOptions))
if(S_OK == oCOfficeUtils.CompressFileOrDirectory(strDirDst, sDstFileName, -1))
return true;
return false;
}
bool BinDocxRW::CDocxSerializer::ConvertDoctToDocx(const CString& sSrcFileName, const CString& sDstFileName, const CString& sTmpDir, const CString& sXMLOptions)
{
std::wstring strDirSrc = NSSystemPath::Combine(string2std_string(sTmpDir), _T("from"));
std::wstring strEditorBin = NSSystemPath::Combine(strDirSrc, _T("Editor.bin"));
std::wstring strDirDst = NSSystemPath::Combine(string2std_string(sTmpDir), _T("to"));
std::wstring strDirSrc = NSSystemPath::Combine(sTmpDir, L"from");
std::wstring strEditorBin = NSSystemPath::Combine(strDirSrc, L"Editor.bin");
std::wstring strDirDst = NSSystemPath::Combine(sTmpDir, L"to");
NSDirectory::CreateDirectory(strDirSrc);
NSDirectory::CreateDirectory(strDirDst);
CString sEditorBin = std_string2string(strEditorBin);
CString sEditorBin = strEditorBin;
COfficeUtils oCOfficeUtils(NULL);
if(S_OK == oCOfficeUtils.ExtractToDirectory(string2std_string(sSrcFileName), strDirSrc, NULL, 0))
if(S_OK == oCOfficeUtils.ExtractToDirectory(sSrcFileName, strDirSrc, NULL, 0))
{
CString sMediaPath;
CString sThemePath;
CString sEmbedPath;
CreateDocxFolders(std_string2string(strDirDst), sThemePath, sMediaPath, sEmbedPath);
CreateDocxFolders(strDirDst, sThemePath, sMediaPath, sEmbedPath);
if(loadFromFile(sEditorBin, std_string2string(strDirDst), sXMLOptions, sThemePath, sMediaPath, sEmbedPath))
if(loadFromFile(sEditorBin, strDirDst, sXMLOptions, sThemePath, sMediaPath, sEmbedPath))
{
if(S_OK == oCOfficeUtils.CompressFileOrDirectory(strDirDst, string2std_string(sDstFileName), -1))
if(S_OK == oCOfficeUtils.CompressFileOrDirectory(strDirDst, sDstFileName, -1))
return true;
}
}
@ -102,7 +99,7 @@ bool BinDocxRW::CDocxSerializer::saveToFile(const CString& sSrcFileName, const C
OOX::CPath pathMain(sSrcFileName);
OOX::CPath pathMedia = pathMain.GetDirectory() + FILE_SEPARATOR_STR + _T("media");
NSDirectory::CreateDirectory(string2std_string(pathMedia.GetPath()));
NSDirectory::CreateDirectory(pathMedia.GetPath());
COfficeFontPicker* pFontPicker = new COfficeFontPicker();
pFontPicker->Init(m_sFontDir);
@ -116,7 +113,7 @@ bool BinDocxRW::CDocxSerializer::saveToFile(const CString& sSrcFileName, const C
NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager = NULL;
if(false == m_sEmbeddedFontsDir.IsEmpty())
{
NSDirectory::CreateDirectory(string2std_string(m_sEmbeddedFontsDir));
NSDirectory::CreateDirectory(m_sEmbeddedFontsDir);
pFontPicker->SetEmbeddedFontsDirectory(m_sEmbeddedFontsDir);
@ -146,7 +143,7 @@ bool BinDocxRW::CDocxSerializer::saveToFile(const CString& sSrcFileName, const C
if (m_bIsNoBase64Save)
{
NSFile::CFileBinary oFile;
oFile.CreateFileW(string2std_string(sSrcFileName));
oFile.CreateFileW(sSrcFileName);
oFile.WriteFile(pbBinBuffer, nBinBufferLen);
oFile.CloseFile();
}
@ -158,8 +155,8 @@ bool BinDocxRW::CDocxSerializer::saveToFile(const CString& sSrcFileName, const C
if(true == Base64_1::Base64Encode(pbBinBuffer, nBinBufferLen, pbBase64Buffer, &nBase64BufferLen))
{
NSFile::CFileBinary oFile;
oFile.CreateFileW(string2std_string(sSrcFileName));
oFile.WriteStringUTF8(string2std_string(oBinaryFileWriter.WriteFileHeader(nBinBufferLen)));
oFile.CreateFileW(sSrcFileName);
oFile.WriteStringUTF8(oBinaryFileWriter.WriteFileHeader(nBinBufferLen));
oFile.WriteFile(pbBase64Buffer, nBase64BufferLen);
oFile.CloseFile();
}
@ -175,32 +172,32 @@ bool BinDocxRW::CDocxSerializer::CreateDocxFolders(CString strDirectory, CString
bool res = true;
// rels
OOX::CPath pathRels = strDirectory + FILE_SEPARATOR_STR + _T("_rels");
if (!NSDirectory::CreateDirectory(pathRels.GetPath().GetBuffer())) res = false;
if (!NSDirectory::CreateDirectory(pathRels.GetPath())) res = false;
// word
OOX::CPath pathWord = strDirectory + FILE_SEPARATOR_STR + _T("word");
if (!NSDirectory::CreateDirectory(pathWord.GetPath().GetBuffer())) res = false;
if (!NSDirectory::CreateDirectory(pathWord.GetPath())) res = false;
// documentRels
OOX::CPath pathWordRels = pathWord + FILE_SEPARATOR_STR + _T("_rels");
if (!NSDirectory::CreateDirectory(pathWordRels.GetPath().GetBuffer()))res = false;
if (!NSDirectory::CreateDirectory(pathWordRels.GetPath()))res = false;
//media
OOX::CPath pathMedia = pathWord + FILE_SEPARATOR_STR + _T("media");
if (!NSDirectory::CreateDirectory(pathMedia.GetPath().GetBuffer())) res = false;
if (!NSDirectory::CreateDirectory(pathMedia.GetPath())) res = false;
sMediaPath = pathMedia.GetPath();
//embeddings
OOX::CPath pathEmbeddings = pathWord + FILE_SEPARATOR_STR + _T("embeddings");
if (!NSDirectory::CreateDirectory(pathEmbeddings.GetPath().GetBuffer()))res = false;
if (!NSDirectory::CreateDirectory(pathEmbeddings.GetPath()))res = false;
sEmbedPath = pathEmbeddings.GetPath();
// theme
OOX::CPath pathTheme = pathWord + FILE_SEPARATOR_STR + _T("theme");
if (!NSDirectory::CreateDirectory(pathTheme.GetPath().GetBuffer())) res = false;
if (!NSDirectory::CreateDirectory(pathTheme.GetPath())) res = false;
OOX::CPath pathThemeRels = pathTheme + FILE_SEPARATOR_STR + _T("_rels");
if (!NSDirectory::CreateDirectory(pathThemeRels.GetPath().GetBuffer())) res = false;
if (!NSDirectory::CreateDirectory(pathThemeRels.GetPath())) res = false;
pathTheme = pathTheme + FILE_SEPARATOR_STR + _T("theme1.xml");
sThemePath = pathTheme.GetPath();
@ -212,7 +209,7 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const CString& sSrcFileName, const
bool bResultOk = false;
NSFile::CFileBinary oFile;
if(oFile.OpenFile(string2std_string(sSrcFileName)))
if(oFile.OpenFile(sSrcFileName))
{
DWORD nBase64DataSize = 0;
BYTE* pBase64Data = new BYTE[oFile.GetFileSize()];
@ -286,19 +283,10 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const CString& sSrcFileName, const
m_pCurFileWriter = new Writers::FileWriter(sDstPath, m_sFontDir, false, nVersion, m_bSaveChartAsImg, &oDrawingConverter, sThemePath);
//папка с картинками
std::wstring strFileInDir = NSSystemPath::GetDirectoryName(string2std_string(sSrcFileName));
std::wstring strFileInDir = NSSystemPath::GetDirectoryName(sSrcFileName);
CString sFileInDir = strFileInDir.c_str();
VARIANT var;
var.vt = VT_BSTR;
#if defined(_WIN32) || defined (_WIN64)
var.bstrVal = sFileInDir.AllocSysString();
oDrawingConverter.SetAdditionalParam(CString(L"SourceFileDir"), var);
RELEASESYSSTRING(var.bstrVal);
#else
var.bstrVal = sFileInDir.GetString();
oDrawingConverter.SetAdditionalParam(CString(L"SourceFileDir"), var);
#endif
oDrawingConverter.SetSourceFileDir(sFileInDir);
//default theme
m_pCurFileWriter->m_oDefaultTheme.Write(sThemePath);
@ -335,10 +323,7 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const CString& sSrcFileName, const
delete pCore;
}
/////////////////////////////////////////////////////////////////////////////////////
VARIANT vt;
oDrawingConverter.GetAdditionalParam(CString(_T("ContentTypes")), &vt);
if(VT_BSTR == vt.vt)
m_pCurFileWriter->m_oContentTypesWriter.AddOverrideRaw(CString(vt.bstrVal));
m_pCurFileWriter->m_oContentTypesWriter.AddOverrideRaw(oDrawingConverter.GetContentTypes());
m_pCurFileWriter->m_oCommentsWriter.Write();
m_pCurFileWriter->m_oChartWriter.Write();

View File

@ -32,12 +32,7 @@
#ifndef DOCX_SERIALIZER
#define DOCX_SERIALIZER
#if defined(_WIN32) || defined (_WIN64)
#include <atlbase.h>
#include <atlstr.h>
#else
#include "../../Common/DocxFormat/Source/Base/ASCString.h"
#endif
#include "../../Common/DocxFormat/Source/Base/ASCString.h"
#include "../../Common/DocxFormat/Source/DocxFormat/WritingElement.h"
namespace Writers

View File

@ -95,13 +95,14 @@ namespace DocWrapper {
sFontName = pTheme->GetMinorFont();
}
if(sFontName.IsEmpty() && oRFont.IsInit() && oRFont->m_sVal.IsInit())
sFontName = std_string2string(oRFont->ToString2());
sFontName = oRFont->ToString2();
if(sFontName.IsEmpty())
sFontName = CString(gc_sNoNameFont);
//подбор перенесен в js
return sFontName;
oFontSelectFormat.wsName = new std::wstring;
*oFontSelectFormat.wsName = string2std_string(sFontName);
oFontSelectFormat.wsName = new std::wstring(sFontName);
if(oCharset.IsInit() && oCharset->m_oCharset.IsInit())
{
SimpleTypes::Spreadsheet::EFontCharset eCharset = oCharset->m_oCharset->GetValue();
@ -121,7 +122,7 @@ namespace DocWrapper {
CString sRes;
CFontInfo* pFontInfo = m_pFontManager->GetFontInfoByParams(oFontSelectFormat);
if(NULL != pFontInfo)
sRes = std_string2string(pFontInfo->m_wsFontName);
sRes = pFontInfo->m_wsFontName;
else
sRes = gc_sDefaultFontName;
fontMap[sFontName] = sRes;
@ -135,12 +136,12 @@ namespace DocWrapper {
sFontName = CString(gc_sNoNameFont);
else
sFontName = font.m_sName;
oFontSelectFormat.wsName = new std::wstring;
*oFontSelectFormat.wsName = string2std_string(sFontName);
oFontSelectFormat.wsName = new std::wstring(sFontName);
if (font.m_oAltName.IsInit() && font.m_oAltName->GetLength() > 0)
{
oFontSelectFormat.wsAltName = new std::wstring;
*oFontSelectFormat.wsAltName = string2std_string(*font.m_oAltName);
oFontSelectFormat.wsAltName = new std::wstring(*font.m_oAltName);
}
if(font.m_oCharset.IsInit())
{
@ -216,7 +217,7 @@ namespace DocWrapper {
CFontInfo* pFontInfo = m_pFontManager->GetFontInfoByParams(oFontSelectFormat);
if(NULL != pFontInfo)
fontMap[sFontName] = std_string2string(pFontInfo->m_wsFontName);
fontMap[sFontName] = pFontInfo->m_wsFontName;
else
fontMap[sFontName] = gc_sDefaultFontName;
}

View File

@ -34,14 +34,9 @@
#include <map>
#if defined(_WIN32) || defined (_WIN64)
#include <atlbase.h>
#include <atlstr.h>
#else
#include "../../Common/DocxFormat/Source/Base/ASCString.h"
#endif
#include "../../Common/DocxFormat/Source/Base/ASCString.h"
#include "../../DesktopEditor/fontengine/ApplicationFonts.h"
//#include "DocWrapper/Base.h"
namespace NSCommon{
template<class Type> class nullable;

View File

@ -54,7 +54,7 @@ namespace BinXlsxRW{
{
}
void CXlsxSerializer::CreateXlsxFolders(CString& sXmlOptions, CString sDstPath, CString& sMediaPath, CString& sEmbedPath)
void CXlsxSerializer::CreateXlsxFolders(const std::wstring& sXmlOptions, const std::wstring& sDstPath, std::wstring& sMediaPath, std::wstring& sEmbedPath)
{
OOX::CPath pathMediaDir = sDstPath + FILE_SEPARATOR_STR + _T("xl") + FILE_SEPARATOR_STR + _T("media");
OOX::CPath pathEmbedDir = sDstPath + FILE_SEPARATOR_STR + _T("xl") + FILE_SEPARATOR_STR + _T("embeddings");
@ -68,11 +68,11 @@ namespace BinXlsxRW{
OOX::CPath pathThemeThemeRelsDir = pathThemeDir + FILE_SEPARATOR_STR + _T("_rels");
NSDirectory::CreateDirectory(string2std_string(pathXlDir.GetPath()));
NSDirectory::CreateDirectory(string2std_string(pathThemeDir.GetPath()));
NSDirectory::CreateDirectory(string2std_string(pathThemeThemeRelsDir.GetPath()));
NSDirectory::CreateDirectory(string2std_string(pathMediaDir.GetPath()));
NSDirectory::CreateDirectory(string2std_string(pathEmbedDir.GetPath()));
NSDirectory::CreateDirectory(pathXlDir.GetPath());
NSDirectory::CreateDirectory(pathThemeDir.GetPath());
NSDirectory::CreateDirectory(pathThemeThemeRelsDir.GetPath());
NSDirectory::CreateDirectory(pathMediaDir.GetPath());
NSDirectory::CreateDirectory(pathEmbedDir.GetPath());
//Create Default Theme
{
@ -83,32 +83,22 @@ namespace BinXlsxRW{
sMediaPath = pathMediaDir.GetPath();
sEmbedPath = pathEmbedDir.GetPath();
}
bool CXlsxSerializer::loadFromFile(const CString& sSrcFileName, const CString& sDstPath, const CString& sXMLOptions, const CString& sMediaDir, const CString& sEmbedDir)
bool CXlsxSerializer::loadFromFile(const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions, const std::wstring& sMediaDir, const std::wstring& sEmbedDir)
{
NSBinPptxRW::CDrawingConverter oOfficeDrawingConverter;
oOfficeDrawingConverter.SetMediaDstPath(sMediaDir);
oOfficeDrawingConverter.SetEmbedDstPath(sEmbedDir);
//папка с бинарников
std::wstring strFileInDir = NSSystemPath::GetDirectoryName(string2std_string(sSrcFileName));
CString sFileInDir = strFileInDir.c_str();
std::wstring strFileInDir = NSSystemPath::GetDirectoryName(sSrcFileName);
VARIANT var;
var.vt = VT_BSTR;
#if defined(_WIN32) || defined (_WIN64)
var.bstrVal = sFileInDir.AllocSysString();
oOfficeDrawingConverter.SetAdditionalParam(CString(L"SourceFileDir2"), var);
RELEASESYSSTRING(var.bstrVal);
#else
var.bstrVal = sFileInDir.GetString();
oOfficeDrawingConverter.SetAdditionalParam(CString(L"SourceFileDir2"), var);
#endif
oOfficeDrawingConverter.SetSourceFileDir(strFileInDir, 2);
BinXlsxRW::BinaryFileReader oBinaryFileReader;
oBinaryFileReader.ReadFile(sSrcFileName, sDstPath, &oOfficeDrawingConverter, sXMLOptions);
return true;
}
bool CXlsxSerializer::saveToFile(const CString& sDstFileName, const CString& sSrcPath, const CString& sXMLOptions)
bool CXlsxSerializer::saveToFile(const std::wstring& sDstFileName, const std::wstring& sSrcPath, const std::wstring& sXMLOptions)
{
COfficeFontPicker* pFontPicker = new COfficeFontPicker();
pFontPicker->Init(m_sFontDir);
@ -119,7 +109,7 @@ namespace BinXlsxRW{
NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager = NULL;
if(false == m_sEmbeddedFontsDir.IsEmpty())
{
NSDirectory::CreateDirectory(string2std_string(m_sEmbeddedFontsDir));
NSDirectory::CreateDirectory(m_sEmbeddedFontsDir);
pFontPicker->SetEmbeddedFontsDirectory(m_sEmbeddedFontsDir);
pEmbeddedFontsManager = pFontPicker->GetNativeCutter();
@ -149,7 +139,7 @@ namespace BinXlsxRW{
RELEASEOBJECT(pFontPicker);
return true;
}
bool CXlsxSerializer::loadChart(CString& sChartPath, NSBinPptxRW::CBinaryFileWriter& oBufferedStream, long& lDataSize)
bool CXlsxSerializer::loadChart(const std::wstring& sChartPath, NSBinPptxRW::CBinaryFileWriter& oBufferedStream, long& lDataSize)
{
bool bRes = false;
//todo передать нормальный oRootPath
@ -174,7 +164,7 @@ namespace BinXlsxRW{
}
return bRes;
}
bool CXlsxSerializer::saveChart(NSBinPptxRW::CBinaryFileReader& oBufferedStream, long lLength, CString& sFilepath, CString& sContentTypePath, CString** sContentTypeElement, const long& lChartNumber)
bool CXlsxSerializer::saveChart(NSBinPptxRW::CBinaryFileReader& oBufferedStream, long lLength, const std::wstring& sFilepath, const std::wstring& sContentTypePath, std::wstring** sContentTypeElement, const long& lChartNumber)
{
bool bRes = false;
*sContentTypeElement = NULL;
@ -182,40 +172,42 @@ namespace BinXlsxRW{
{
m_pExternalDrawingConverter->SetDstContentRels();
//получаем sThemePath из bsFilename предполагая что папка theme находится на уровень выше bsFilename
CString sThemePath;
CString sEmbedingPath;
CString sFilenameReverse = sFilepath;sFilenameReverse.MakeReverse();
//получаем sThemePath из bsFilename предполагая что папка theme находится на уровень выше bsFilename
std::wstring sThemePath;
std::wstring sEmbedingPath;
CString sFilenameReverse = sFilepath; sFilenameReverse.MakeReverse();
int nIndex = sFilenameReverse.Find(FILE_SEPARATOR_CHAR);
nIndex = sFilenameReverse.Find(FILE_SEPARATOR_CHAR, nIndex + 1);
if(-1 != nIndex)
{
CString sFilepathLeft = sFilepath.Left(sFilepath.GetLength() - nIndex);
sThemePath = sFilepathLeft + _T("theme");
sEmbedingPath = sFilepathLeft + _T("embeddings");
CString sFilepathLeft = sFilepath.substr(0, sFilepath.length() - nIndex);
sThemePath = sFilepathLeft + L"theme";
sEmbedingPath = sFilepathLeft + L"embeddings";
}
//todo theme path
BinXlsxRW::SaveParams oSaveParams(sThemePath);
OOX::Spreadsheet::CChartSpace oChartSpace;
BinXlsxRW::BinaryChartReader oBinaryChartReader(oBufferedStream, oSaveParams, m_pExternalDrawingConverter);
//todo theme path
BinXlsxRW::SaveParams oSaveParams(sThemePath);
OOX::Spreadsheet::CChartSpace oChartSpace;
BinXlsxRW::BinaryChartReader oBinaryChartReader(oBufferedStream, oSaveParams, m_pExternalDrawingConverter);
oBinaryChartReader.ReadCT_ChartSpace(lLength, &oChartSpace.m_oChartSpace);
if(oChartSpace.isValid())
{
//todo не делать embeddings, если пишем xlsx
//save xlsx
if(!sEmbedingPath.IsEmpty())
if(!sEmbedingPath.empty())
{
std::wstring sXlsxFilename = L"Microsoft_Excel_Worksheet" + std::to_wstring(lChartNumber) + L".xlsx";
std::wstring sXlsxPath = string2std_string(sEmbedingPath + FILE_SEPARATOR_STR) + sXlsxFilename;
std::wstring sXlsxPath = sEmbedingPath + FILE_SEPARATOR_STR + sXlsxFilename;
writeChartXlsx(sXlsxPath, oChartSpace);
std::wstring sChartsWorksheetRelsName = L"../embeddings/" + sXlsxFilename;
long rId;
CString bstrChartsWorksheetRelType = OOX::Spreadsheet::FileTypes::ChartsWorksheet.RelationType();
m_pExternalDrawingConverter->WriteRels(bstrChartsWorksheetRelType, std_string2string(sChartsWorksheetRelsName), CString(), &rId);
m_pExternalDrawingConverter->WriteRels(bstrChartsWorksheetRelType, sChartsWorksheetRelsName, CString(), &rId);
oChartSpace.m_oChartSpace.m_externalData = new OOX::Spreadsheet::CT_ExternalData();
oChartSpace.m_oChartSpace.m_externalData->m_id = new std::wstring();
@ -225,9 +217,9 @@ namespace BinXlsxRW{
oChartSpace.m_oChartSpace.m_externalData->m_autoUpdate->m_val = new bool(false);
}
std::wstring strFilepath = string2std_string(sFilepath);
CString strDir = std_string2string(NSSystemPath::GetDirectoryName(strFilepath));
CString strFilename = std_string2string(NSSystemPath::GetFileName(strFilepath));
std::wstring strFilepath = sFilepath;
CString strDir = NSSystemPath::GetDirectoryName(strFilepath);
CString strFilename = NSSystemPath::GetFileName(strFilepath);
OOX::CPath pathRelsDir = strDir + FILE_SEPARATOR_STR + _T("_rels");
@ -241,20 +233,21 @@ namespace BinXlsxRW{
CString sContentType(sContentTypePath);
sContentType.Append(strFilename);
(*sContentTypeElement) = new CString();
(*sContentTypeElement)->Format(_T("<Override PartName=\"%ls\" ContentType=\"application/vnd.openxmlformats-officedocument.drawingml.chart+xml\"/>"), sContentType);
(*sContentTypeElement)->Append(oSaveParams.sAdditionalContentTypes);
std::wstring sContent = L"<Override PartName=\"" + sContentType + L"\" ContentType=\"application/vnd.openxmlformats-officedocument.drawingml.chart+xml\"/>";
sContent += oSaveParams.sAdditionalContentTypes;
(*sContentTypeElement) = new std::wstring(sContent);
bRes = true;
}
}
return bRes;
}
void CXlsxSerializer::setFontDir(CString& sFontDir)
void CXlsxSerializer::setFontDir(const std::wstring& sFontDir)
{
m_sFontDir = sFontDir;
}
void CXlsxSerializer::setEmbeddedFontsDir(CString& sEmbeddedFontsDir)
void CXlsxSerializer::setEmbeddedFontsDir(const std::wstring& sEmbeddedFontsDir)
{
m_sEmbeddedFontsDir = sEmbeddedFontsDir;
}
@ -275,7 +268,7 @@ namespace BinXlsxRW{
CString sXmlOptions = _T("");
CString sMediaPath;// will be filled by 'CreateXlsxFolders' method
CString sEmbedPath; // will be filled by 'CreateXlsxFolders' method
CreateXlsxFolders (sXmlOptions, std_string2string(sTempDir), sMediaPath, sEmbedPath);
CreateXlsxFolders (sXmlOptions, sTempDir, sMediaPath, sEmbedPath);
//заполняем Xlsx
OOX::Spreadsheet::CXlsx oXlsx;
helper.toXlsx(oXlsx);

View File

@ -32,13 +32,7 @@
#ifndef XLSX_SERIALIZER
#define XLSX_SERIALIZER
#if defined(_WIN32) || defined (_WIN64)
#include <atlbase.h>
#include <atlstr.h>
#else
#include "../../Common/DocxFormat/Source/Base/ASCString.h"
#endif
#include "../../Common/DocxFormat/Source/Base/ASCString.h"
#include <string>
namespace OOX
@ -66,19 +60,19 @@ namespace BinXlsxRW {
CXlsxSerializer();
~CXlsxSerializer();
void CreateXlsxFolders(CString& sXmlOptions, CString sDstPath, CString& sMediaPath, CString& sEmbedPath);
void CreateXlsxFolders (const std::wstring& sXmlOptions, const std::wstring& sDstPath, std::wstring& sMediaPath, std::wstring& sEmbedPath);
bool loadFromFile(const CString& sSrcFileName, const CString& sDstPath, const CString& sXMLOptions, const CString& sMediaDir, const CString& sEmbedPath);
bool saveToFile(const CString& sSrcFileName, const CString& sDstPath, const CString& sXMLOptions);
bool loadFromFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions, const std::wstring& sMediaDir, const std::wstring& sEmbedPath);
bool saveToFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions);
bool loadChart(CString& sChartPath, NSBinPptxRW::CBinaryFileWriter& oBufferedStream, long& lDataSize);
bool saveChart(NSBinPptxRW::CBinaryFileReader& oBufferedStream, long lLength, CString& sFilename, CString& sContentTypePath, CString** sContentTypeElement, const long& lChartNumber);
bool loadChart (const std::wstring& sChartPath, NSBinPptxRW::CBinaryFileWriter& oBufferedStream, long& lDataSize);
bool saveChart (NSBinPptxRW::CBinaryFileReader& oBufferedStream, long lLength, const std::wstring& sFilename, const std::wstring& sContentTypePath, std::wstring** sContentTypeElement, const long& lChartNumber);
void setFontDir(CString& sFontDir);
void setEmbeddedFontsDir(CString& sEmbeddedFontsDir);
void setFontDir (const std::wstring& sFontDir);
void setEmbeddedFontsDir(const std::wstring& sEmbeddedFontsDir);
void setDrawingConverter(NSBinPptxRW::CDrawingConverter* pDrawingConverter);
void writeChartXlsx(const std::wstring& sDstFile ,const OOX::Spreadsheet::CChartSpace& oChart);
void writeChartXlsx (const std::wstring& sDstFile ,const OOX::Spreadsheet::CChartSpace& oChart);
};
}
#endif // #ifndef XLSX_SERIALIZER

View File

@ -37,12 +37,21 @@
#include "../../src/ConvertOO2OOX.h"
#if defined(_WIN64)
#pragma comment(lib, "../../../build/bin/icu/win_64/icuuc.lib")
#elif defined (_WIN32)
#pragma comment(lib, "../../../build/bin/icu/win_32/icuuc.lib")
#endif
int _tmain(int argc, _TCHAR* argv[])
{
if (argc < 2) return 1;
HRESULT hr = S_OK;
//////////////////////////////////////////////////////////////////////////
std::wstring srcFileName = argv[1];
std::wstring dstPath = argv[2];
std::wstring dstPath = argc > 2 ? argv[2] : sSrcDoc + L"-my.docx"; //xlsx pptx
std::wstring outputDir = FileSystem::Directory::GetFolderPath(dstPath);
std::wstring srcTempPath = FileSystem::Directory::CreateDirectoryWithUniqueName(outputDir);

View File

@ -357,6 +357,18 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\..\UnicodeConverter\UnicodeConverter.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
</File>
</Filter>
</Files>
<Globals>

View File

@ -34,21 +34,15 @@ CONFIG(debug, debug|release){
DEFINES += _DEBUG
}
build_fast {
core_release {
SOURCES += \
odffilereaderlib_odf_datatypes.cpp \
odffilereaderlib_odf.cpp \
odffilereaderlib_docx.cpp \
odffilereaderlib_pptx.cpp \
odffilereaderlib_xlsx.cpp \
odffilereaderlib_converter.cpp
} else {
odffilereaderlib_oox.cpp
}
core_debug {
SOURCES += \
../src/conversionelement.cpp \
../src/xml/attributes.cpp \
../src/xml/sax.cpp \
../src/xml/sax_xmllite.cpp \
../src/xml/utils.cpp \
../src/xml/xmlchar.cpp \
../src/odf/abstract_xml.cpp \
../src/odf/anim_elements.cpp \
../src/odf/calcs_styles.cpp \
@ -114,6 +108,15 @@ SOURCES += \
../src/odf/templates.cpp \
../src/odf/text_content.cpp \
../src/odf/text_elements.cpp \
../src/odf/math_elementaries.cpp \
../src/odf/math_layout_elements.cpp \
../src/odf/math_limit_elements.cpp \
../src/odf/math_table_elements.cpp \
../src/odf/math_token_elements.cpp \
../src/odf/datatypes/mathvariant.cpp \
../src/odf/calcext_elements.cpp \
../src/odf/table_database_ranges.cpp \
../src/odf/math_elements.cpp \
../src/odf/datatypes/anchortype.cpp \
../src/odf/datatypes/backgroundcolor.cpp \
../src/odf/datatypes/bool.cpp \
@ -204,6 +207,8 @@ SOURCES += \
../src/odf/datatypes/wrapoption.cpp \
../src/odf/datatypes/writingmode.cpp \
../src/odf/datatypes/xlink.cpp \
../src/docx/xlsx_conditionalFormatting.cpp \
../src/docx/xlsx_dxfs.cpp \
../src/docx/docx_content_type.cpp \
../src/docx/docx_conversion_context.cpp \
../src/docx/docx_drawing.cpp \
@ -272,27 +277,22 @@ SOURCES += \
../src/docx/xlsx_table_state.cpp \
../src/docx/xlsx_textcontext.cpp \
../src/docx/xlsx_utils.cpp \
../src/docx/xlsx_xf.cpp \
../src/common/CPColorUtils.cpp \
../src/common/CPString.cpp \
../src/common/readdocelement.cpp \
../src/ConvertOO2OOX.cpp \
../src/odf/math_elements.cpp
../src/docx/xlsx_xf.cpp
}
SOURCES += \
../formulasconvert/formulasconvert_oox.cpp \
../src/odf/math_elementaries.cpp \
../src/odf/math_layout_elements.cpp \
../src/odf/math_limit_elements.cpp \
../src/odf/math_table_elements.cpp \
../src/odf/math_token_elements.cpp \
../src/odf/datatypes/mathvariant.cpp \
../formulasconvert/formulasconvert_odf.cpp \
../src/odf/calcext_elements.cpp \
../src/odf/table_database_ranges.cpp \
../src/docx/xlsx_conditionalFormatting.cpp \
../src/docx/xlsx_dxfs.cpp
../src/conversionelement.cpp \
../src/xml/attributes.cpp \
../src/xml/sax.cpp \
../src/xml/sax_xmllite.cpp \
../src/xml/utils.cpp \
../src/xml/xmlchar.cpp \
../src/common/CPColorUtils.cpp \
../src/common/CPString.cpp \
../src/common/readdocelement.cpp \
../src/ConvertOO2OOX.cpp
HEADERS += \
../formulasconvert/formulasconvert.h \
@ -357,6 +357,16 @@ HEADERS += \
../src/odf/text_content.h \
../src/odf/text_elements.h \
../src/odf/visitor.h \
../src/ConvertOO2OOX.h \
../src/odf/math_elements.h \
../src/odf/math_elementaries.h \
../src/odf/math_layout_elements.h \
../src/odf/math_limit_elements.h \
../src/odf/math_table_elements.h \
../src/odf/math_token_elements.h \
../src/odf/datatypes/mathvariant.h \
../src/odf/calcext_elements.h \
../src/odf/table_database_ranges.h \
../src/odf/datatypes/anchortype.h \
../src/odf/datatypes/backgroundcolor.h \
../src/odf/datatypes/bool.h \
@ -456,6 +466,8 @@ HEADERS += \
../src/docx/docx_drawing.h \
../src/docx/docx_package.h \
../src/docx/docx_table_context.h \
../src/docx/xlsx_conditionalFormatting.h \
../src/docx/xlsx_dxfs.h \
../src/docx/drawing_object_description.h \
../src/docx/headers_footers.h \
../src/docx/hyperlinks.h \
@ -551,16 +563,5 @@ HEADERS += \
../include/cpdoccore/xml/simple_xml_writer.h \
../include/cpdoccore/xml/utils.h \
../include/cpdoccore/xml/xmlchar.h \
../include/cpdoccore/xml/xmlelement.h \
../src/ConvertOO2OOX.h \
../src/odf/math_elements.h \
../src/odf/math_elementaries.h \
../src/odf/math_layout_elements.h \
../src/odf/math_limit_elements.h \
../src/odf/math_table_elements.h \
../src/odf/math_token_elements.h \
../src/odf/datatypes/mathvariant.h \
../src/odf/calcext_elements.h \
../src/odf/table_database_ranges.h \
../src/docx/xlsx_conditionalFormatting.h \
../src/docx/xlsx_dxfs.h
../include/cpdoccore/xml/xmlelement.h

View File

@ -1,41 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2016
*
* 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 "../src/conversionelement.cpp"
#include "../src/xml/attributes.cpp"
#include "../src/xml/sax.cpp"
#include "../src/xml/sax_xmllite.cpp"
#include "../src/xml/utils.cpp"
#include "../src/xml/xmlchar.cpp"
#include "../src/common/CPColorUtils.cpp"
#include "../src/common/CPString.cpp"
#include "../src/common/readdocelement.cpp"
#include "../src/ConvertOO2OOX.cpp"

View File

@ -1,61 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2016
*
* 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 "../src/docx/docx_content_type.cpp"
#include "../src/docx/docx_conversion_context.cpp"
#include "../src/docx/docx_drawing.cpp"
#include "../src/docx/docx_package.cpp"
#include "../src/docx/docx_rels.cpp"
#include "../src/docx/docx_table_context.cpp"
#include "../src/docx/headers_footers.cpp"
#include "../src/docx/hyperlinks.cpp"
#include "../src/docx/measuredigits.cpp"
#include "../src/docx/mediaitems.cpp"
#include "../src/docx/mediaitems_utils.cpp"
#include "../src/docx/namespaces.cpp"
#include "../src/docx/oox_chart_axis.cpp"
#include "../src/docx/oox_chart_context.cpp"
#include "../src/docx/oox_chart_legend.cpp"
#include "../src/docx/oox_chart_series.cpp"
#include "../src/docx/oox_chart_shape.cpp"
#include "../src/docx/oox_conversion_context.cpp"
#include "../src/docx/oox_data_labels.cpp"
#include "../src/docx/oox_drawing.cpp"
#include "../src/docx/oox_drawing_fills.cpp"
#include "../src/docx/oox_layout.cpp"
#include "../src/docx/oox_package.cpp"
#include "../src/docx/oox_plot_area.cpp"
#include "../src/docx/oox_title.cpp"
#include "../src/docx/oox_types_chart.cpp"
#include "../src/odf/draw_frame_docx.cpp"
#include "../src/odf/draw_shapes_docx.cpp"
#include "../src/odf/style_paragraph_properties_docx.cpp"
#include "../src/odf/table_docx.cpp"

View File

@ -37,8 +37,14 @@
#include "../src/odf/documentcontext.cpp"
#include "../src/odf/draw_common.cpp"
#include "../src/odf/draw_frame.cpp"
#include "../src/odf/draw_frame_docx.cpp"
#include "../src/odf/draw_frame_pptx.cpp"
#include "../src/odf/draw_frame_xlsx.cpp"
#include "../src/odf/draw_page.cpp"
#include "../src/odf/draw_shapes.cpp"
#include "../src/odf/draw_shapes_docx.cpp"
#include "../src/odf/draw_shapes_pptx.cpp"
#include "../src/odf/draw_shapes_xlsx.cpp"
#include "../src/odf/font_face.cpp"
#include "../src/odf/header_footer.cpp"
#include "../src/odf/list.cpp"
@ -48,7 +54,6 @@
#include "../src/odf/odf_content_xml.cpp"
#include "../src/odf/odfcontext.cpp"
#include "../src/odf/odf_document.cpp"
#include "../src/odf/odf_document_impl.cpp"
#include "../src/odf/office_annotation.cpp"
#include "../src/odf/office_binary_data.cpp"
#include "../src/odf/office_body.cpp"
@ -69,6 +74,8 @@
#include "../src/odf/style_graphic_properties.cpp"
#include "../src/odf/style_map.cpp"
#include "../src/odf/style_paragraph_properties.cpp"
#include "../src/odf/style_paragraph_properties_docx.cpp"
#include "../src/odf/style_paragraph_properties_pptx.cpp"
#include "../src/odf/style_presentation.cpp"
#include "../src/odf/style_regions.cpp"
#include "../src/odf/styles.cpp"
@ -79,98 +86,20 @@
#include "../src/odf/svg_parser.cpp"
#include "../src/odf/table.cpp"
#include "../src/odf/table_calculation_settings.cpp"
#include "../src/odf/table_docx.cpp"
#include "../src/odf/table_named_expressions.cpp"
#include "../src/odf/table_pptx.cpp"
#include "../src/odf/table_xlsx.cpp"
#include "../src/odf/templates.cpp"
#include "../src/odf/text_content.cpp"
#include "../src/odf/text_elements.cpp"
#include "../src/odf/datatypes/anchortype.cpp"
#include "../src/odf/datatypes/backgroundcolor.cpp"
#include "../src/odf/datatypes/bool.cpp"
#include "../src/odf/datatypes/bordermodel.cpp"
#include "../src/odf/datatypes/borderstyle.cpp"
#include "../src/odf/datatypes/borderwidths.cpp"
#include "../src/odf/datatypes/calcext_type.cpp"
#include "../src/odf/datatypes/chartdatalabelnumber.cpp"
#include "../src/odf/datatypes/charterrorcategory.cpp"
#include "../src/odf/datatypes/chartinterpolation.cpp"
#include "../src/odf/datatypes/chartlabelarrangement.cpp"
#include "../src/odf/datatypes/chartregressiontype.cpp"
#include "../src/odf/datatypes/chartseriessource.cpp"
#include "../src/odf/datatypes/chartsolidtype.cpp"
#include "../src/odf/datatypes/chartsymbol.cpp"
#include "../src/odf/datatypes/clockvalue.cpp"
#include "../src/odf/datatypes/color.cpp"
#include "../src/odf/datatypes/common_attlists.cpp"
#include "../src/odf/datatypes/direction.cpp"
#include "../src/odf/datatypes/drawfill.cpp"
#include "../src/odf/datatypes/dropcaplength.cpp"
#include "../src/odf/datatypes/fillimagerefpoint.cpp"
#include "../src/odf/datatypes/fobreak.cpp"
#include "../src/odf/datatypes/fontfamilygeneric.cpp"
#include "../src/odf/datatypes/fontpitch.cpp"
#include "../src/odf/datatypes/fontrelief.cpp"
#include "../src/odf/datatypes/fontsize.cpp"
#include "../src/odf/datatypes/fontstretch.cpp"
#include "../src/odf/datatypes/fontstyle.cpp"
#include "../src/odf/datatypes/fontvariant.cpp"
#include "../src/odf/datatypes/fontweight.cpp"
#include "../src/odf/datatypes/gradientstyle.cpp"
#include "../src/odf/datatypes/hatchstyle.cpp"
#include "../src/odf/datatypes/hyphenationkeep.cpp"
#include "../src/odf/datatypes/hyphenationladdercount.cpp"
#include "../src/odf/datatypes/iconset_type.cpp"
#include "../src/odf/datatypes/keeptogether.cpp"
#include "../src/odf/datatypes/layoutgridmode.cpp"
#include "../src/odf/datatypes/length.cpp"
#include "../src/odf/datatypes/lengthorpercent.cpp"
#include "../src/odf/datatypes/letterspacing.cpp"
#include "../src/odf/datatypes/linebreak.cpp"
#include "../src/odf/datatypes/linemode.cpp"
#include "../src/odf/datatypes/linestyle.cpp"
#include "../src/odf/datatypes/linetype.cpp"
#include "../src/odf/datatypes/linewidth.cpp"
#include "../src/odf/datatypes/markerstyle.cpp"
#include "../src/odf/datatypes/noteclass.cpp"
#include "../src/odf/datatypes/officevaluetype.cpp"
#include "../src/odf/datatypes/pageusage.cpp"
#include "../src/odf/datatypes/percent.cpp"
#include "../src/odf/datatypes/percentorscale.cpp"
#include "../src/odf/datatypes/presentationclass.cpp"
#include "../src/odf/datatypes/punctuationwrap.cpp"
#include "../src/odf/datatypes/rotationalign.cpp"
#include "../src/odf/datatypes/runthrough.cpp"
#include "../src/odf/datatypes/scripttype.cpp"
#include "../src/odf/datatypes/shadowtype.cpp"
#include "../src/odf/datatypes/smil_transitiontype.cpp"
#include "../src/odf/datatypes/stylefamily.cpp"
#include "../src/odf/datatypes/stylehorizontalpos.cpp"
#include "../src/odf/datatypes/stylehorizontalrel.cpp"
#include "../src/odf/datatypes/styleleadercolor.cpp"
#include "../src/odf/datatypes/styleposition.cpp"
#include "../src/odf/datatypes/style_ref.cpp"
#include "../src/odf/datatypes/stylerepeat.cpp"
#include "../src/odf/datatypes/styletype.cpp"
#include "../src/odf/datatypes/styleverticalpos.cpp"
#include "../src/odf/datatypes/styleverticalrel.cpp"
#include "../src/odf/datatypes/stylewrap.cpp"
#include "../src/odf/datatypes/stylewrapcontourmode.cpp"
#include "../src/odf/datatypes/tablealign.cpp"
#include "../src/odf/datatypes/tablecentering.cpp"
#include "../src/odf/datatypes/tablemode.cpp"
#include "../src/odf/datatypes/tablevisibility.cpp"
#include "../src/odf/datatypes/targetframename.cpp"
#include "../src/odf/datatypes/textalign.cpp"
#include "../src/odf/datatypes/textalignsource.cpp"
#include "../src/odf/datatypes/textautospace.cpp"
#include "../src/odf/datatypes/textcombine.cpp"
#include "../src/odf/datatypes/textdisplay.cpp"
#include "../src/odf/datatypes/textemphasize.cpp"
#include "../src/odf/datatypes/textposition.cpp"
#include "../src/odf/datatypes/textrotationscale.cpp"
#include "../src/odf/datatypes/texttransform.cpp"
#include "../src/odf/datatypes/underlinecolor.cpp"
#include "../src/odf/datatypes/verticalalign.cpp"
#include "../src/odf/datatypes/wrapoption.cpp"
#include "../src/odf/datatypes/writingmode.cpp"
#include "../src/odf/datatypes/xlink.cpp"
#include "../src/odf/math_elementaries.cpp"
#include "../src/odf/math_layout_elements.cpp"
#include "../src/odf/math_limit_elements.cpp"
#include "../src/odf/math_table_elements.cpp"
#include "../src/odf/math_token_elements.cpp"
#include "../src/odf/datatypes/mathvariant.cpp"
#include "../src/odf/calcext_elements.cpp"
#include "../src/odf/table_database_ranges.cpp"
#include "../src/odf/math_elements.cpp"
#include "../src/odf/odf_document_impl.cpp"

View File

@ -0,0 +1,121 @@
/*
* (c) Copyright Ascensio System SIA 2010-2016
*
* 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 "../src/odf/datatypes/anchortype.cpp"
#include "../src/odf/datatypes/backgroundcolor.cpp"
#include "../src/odf/datatypes/bool.cpp"
#include "../src/odf/datatypes/bordermodel.cpp"
#include "../src/odf/datatypes/borderstyle.cpp"
#include "../src/odf/datatypes/borderwidths.cpp"
#include "../src/odf/datatypes/calcext_type.cpp"
#include "../src/odf/datatypes/chartdatalabelnumber.cpp"
#include "../src/odf/datatypes/charterrorcategory.cpp"
#include "../src/odf/datatypes/chartinterpolation.cpp"
#include "../src/odf/datatypes/chartlabelarrangement.cpp"
#include "../src/odf/datatypes/chartregressiontype.cpp"
#include "../src/odf/datatypes/chartseriessource.cpp"
#include "../src/odf/datatypes/chartsolidtype.cpp"
#include "../src/odf/datatypes/chartsymbol.cpp"
#include "../src/odf/datatypes/clockvalue.cpp"
#include "../src/odf/datatypes/color.cpp"
#include "../src/odf/datatypes/common_attlists.cpp"
#include "../src/odf/datatypes/direction.cpp"
#include "../src/odf/datatypes/drawfill.cpp"
#include "../src/odf/datatypes/dropcaplength.cpp"
#include "../src/odf/datatypes/fillimagerefpoint.cpp"
#include "../src/odf/datatypes/fobreak.cpp"
#include "../src/odf/datatypes/fontfamilygeneric.cpp"
#include "../src/odf/datatypes/fontpitch.cpp"
#include "../src/odf/datatypes/fontrelief.cpp"
#include "../src/odf/datatypes/fontsize.cpp"
#include "../src/odf/datatypes/fontstretch.cpp"
#include "../src/odf/datatypes/fontstyle.cpp"
#include "../src/odf/datatypes/fontvariant.cpp"
#include "../src/odf/datatypes/fontweight.cpp"
#include "../src/odf/datatypes/gradientstyle.cpp"
#include "../src/odf/datatypes/hatchstyle.cpp"
#include "../src/odf/datatypes/hyphenationkeep.cpp"
#include "../src/odf/datatypes/hyphenationladdercount.cpp"
#include "../src/odf/datatypes/iconset_type.cpp"
#include "../src/odf/datatypes/keeptogether.cpp"
#include "../src/odf/datatypes/layoutgridmode.cpp"
#include "../src/odf/datatypes/length.cpp"
#include "../src/odf/datatypes/lengthorpercent.cpp"
#include "../src/odf/datatypes/letterspacing.cpp"
#include "../src/odf/datatypes/linebreak.cpp"
#include "../src/odf/datatypes/linemode.cpp"
#include "../src/odf/datatypes/linestyle.cpp"
#include "../src/odf/datatypes/linetype.cpp"
#include "../src/odf/datatypes/linewidth.cpp"
#include "../src/odf/datatypes/markerstyle.cpp"
#include "../src/odf/datatypes/noteclass.cpp"
#include "../src/odf/datatypes/officevaluetype.cpp"
#include "../src/odf/datatypes/pageusage.cpp"
#include "../src/odf/datatypes/percent.cpp"
#include "../src/odf/datatypes/percentorscale.cpp"
#include "../src/odf/datatypes/presentationclass.cpp"
#include "../src/odf/datatypes/punctuationwrap.cpp"
#include "../src/odf/datatypes/rotationalign.cpp"
#include "../src/odf/datatypes/runthrough.cpp"
#include "../src/odf/datatypes/scripttype.cpp"
#include "../src/odf/datatypes/shadowtype.cpp"
#include "../src/odf/datatypes/smil_transitiontype.cpp"
#include "../src/odf/datatypes/stylefamily.cpp"
#include "../src/odf/datatypes/stylehorizontalpos.cpp"
#include "../src/odf/datatypes/stylehorizontalrel.cpp"
#include "../src/odf/datatypes/styleleadercolor.cpp"
#include "../src/odf/datatypes/styleposition.cpp"
#include "../src/odf/datatypes/style_ref.cpp"
#include "../src/odf/datatypes/stylerepeat.cpp"
#include "../src/odf/datatypes/styletype.cpp"
#include "../src/odf/datatypes/styleverticalpos.cpp"
#include "../src/odf/datatypes/styleverticalrel.cpp"
#include "../src/odf/datatypes/stylewrap.cpp"
#include "../src/odf/datatypes/stylewrapcontourmode.cpp"
#include "../src/odf/datatypes/tablealign.cpp"
#include "../src/odf/datatypes/tablecentering.cpp"
#include "../src/odf/datatypes/tablemode.cpp"
#include "../src/odf/datatypes/tablevisibility.cpp"
#include "../src/odf/datatypes/targetframename.cpp"
#include "../src/odf/datatypes/textalign.cpp"
#include "../src/odf/datatypes/textalignsource.cpp"
#include "../src/odf/datatypes/textautospace.cpp"
#include "../src/odf/datatypes/textcombine.cpp"
#include "../src/odf/datatypes/textdisplay.cpp"
#include "../src/odf/datatypes/textemphasize.cpp"
#include "../src/odf/datatypes/textposition.cpp"
#include "../src/odf/datatypes/textrotationscale.cpp"
#include "../src/odf/datatypes/texttransform.cpp"
#include "../src/odf/datatypes/underlinecolor.cpp"
#include "../src/odf/datatypes/verticalalign.cpp"
#include "../src/odf/datatypes/wrapoption.cpp"
#include "../src/odf/datatypes/writingmode.cpp"
#include "../src/odf/datatypes/xlink.cpp"

View File

@ -1,68 +1,102 @@
/*
* (c) Copyright Ascensio System SIA 2010-2016
*
* 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 "../src/docx/xlsx_utils.cpp"
#include "../src/odf/draw_frame_xlsx.cpp"
#include "../src/odf/draw_shapes_xlsx.cpp"
#include "../src/odf/table_xlsx.cpp"
#include "../src/docx/xlsx_alignment.cpp"
#include "../src/docx/xlsx_border.cpp"
#include "../src/docx/xlsx_borders.cpp"
#include "../src/docx/xlsx_cell_format.cpp"
#include "../src/docx/xlsx_cell_style.cpp"
#include "../src/docx/xlsx_cell_styles.cpp"
#include "../src/docx/xlsx_color.cpp"
#include "../src/docx/xlsx_comments.cpp"
#include "../src/docx/xlsx_comments_context.cpp"
#include "../src/docx/xlsx_complex_number_format.cpp"
#include "../src/docx/xlsxconversioncontext.cpp"
#include "../src/docx/xlsx_defined_names.cpp"
#include "../src/docx/xlsx_drawing.cpp"
#include "../src/docx/xlsx_drawing_context.cpp"
#include "../src/docx/xlsx_drawings.cpp"
#include "../src/docx/xlsx_fill.cpp"
#include "../src/docx/xlsx_fills.cpp"
#include "../src/docx/xlsx_font.cpp"
#include "../src/docx/xlsx_fonts.cpp"
#include "../src/docx/xlsx_hyperlinks.cpp"
#include "../src/docx/xlsx_merge_cells.cpp"
#include "../src/docx/xlsx_numFmts.cpp"
#include "../src/docx/xlsx_num_format_context.cpp"
#include "../src/docx/xlsx_output_xml.cpp"
#include "../src/docx/xlsx_package.cpp"
#include "../src/docx/xlsx_protection.cpp"
#include "../src/docx/xlsx_sharedstrings.cpp"
#include "../src/docx/xlsx_styles.cpp"
#include "../src/docx/xlsx_tablecontext.cpp"
#include "../src/docx/xlsx_table_metrics.cpp"
#include "../src/docx/xlsx_table_state.cpp"
#include "../src/docx/xlsx_textcontext.cpp"
#include "../src/docx/xlsx_xf.cpp"
/*
* (c) Copyright Ascensio System SIA 2010-2016
*
* 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 "../src/docx/xlsx_conditionalFormatting.cpp"
#include "../src/docx/xlsx_dxfs.cpp"
#include "../src/docx/docx_content_type.cpp"
#include "../src/docx/docx_conversion_context.cpp"
#include "../src/docx/docx_drawing.cpp"
#include "../src/docx/docx_package.cpp"
#include "../src/docx/docx_table_context.cpp"
#include "../src/docx/headers_footers.cpp"
#include "../src/docx/hyperlinks.cpp"
#include "../src/docx/measuredigits.cpp"
#include "../src/docx/mediaitems.cpp"
#include "../src/docx/namespaces.cpp"
#include "../src/docx/oox_chart_axis.cpp"
#include "../src/docx/oox_chart_context.cpp"
#include "../src/docx/oox_chart_legend.cpp"
#include "../src/docx/oox_chart_series.cpp"
#include "../src/docx/oox_chart_shape.cpp"
#include "../src/docx/oox_conversion_context.cpp"
#include "../src/docx/oox_data_labels.cpp"
#include "../src/docx/oox_drawing.cpp"
#include "../src/docx/oox_drawing_fills.cpp"
#include "../src/docx/oox_layout.cpp"
#include "../src/docx/oox_package.cpp"
#include "../src/docx/oox_plot_area.cpp"
#include "../src/docx/oox_title.cpp"
#include "../src/docx/oox_types_chart.cpp"
#include "../src/docx/oox_rels.cpp"
#include "../src/docx/pptx_comments.cpp"
#include "../src/docx/pptx_comments_context.cpp"
#include "../src/docx/pptx_conversion_context.cpp"
#include "../src/docx/pptx_drawing.cpp"
#include "../src/docx/pptx_drawings.cpp"
#include "../src/docx/pptx_output_xml.cpp"
#include "../src/docx/pptx_package.cpp"
#include "../src/docx/pptx_slide_context.cpp"
#include "../src/docx/pptx_table_context.cpp"
#include "../src/docx/pptx_text_context.cpp"
#include "../src/docx/xlsx_alignment.cpp"
#include "../src/docx/xlsx_border.cpp"
#include "../src/docx/xlsx_borders.cpp"
#include "../src/docx/xlsx_cell_format.cpp"
#include "../src/docx/xlsx_cell_style.cpp"
#include "../src/docx/xlsx_cell_styles.cpp"
#include "../src/docx/xlsx_color.cpp"
#include "../src/docx/xlsx_comments.cpp"
#include "../src/docx/xlsx_comments_context.cpp"
#include "../src/docx/xlsx_complex_number_format.cpp"
#include "../src/docx/xlsxconversioncontext.cpp"
#include "../src/docx/xlsx_defined_names.cpp"
#include "../src/docx/xlsx_drawing.cpp"
#include "../src/docx/xlsx_drawing_context.cpp"
#include "../src/docx/xlsx_drawings.cpp"
#include "../src/docx/xlsx_fill.cpp"
#include "../src/docx/xlsx_fills.cpp"
#include "../src/docx/xlsx_font.cpp"
#include "../src/docx/xlsx_fonts.cpp"
#include "../src/docx/xlsx_hyperlinks.cpp"
#include "../src/docx/xlsx_merge_cells.cpp"
#include "../src/docx/xlsx_numFmts.cpp"
#include "../src/docx/xlsx_num_format_context.cpp"
#include "../src/docx/xlsx_output_xml.cpp"
#include "../src/docx/xlsx_package.cpp"
#include "../src/docx/xlsx_protection.cpp"
#include "../src/docx/xlsx_sharedstrings.cpp"
#include "../src/docx/xlsx_styles.cpp"
#include "../src/docx/xlsx_tablecontext.cpp"
#include "../src/docx/xlsx_table_metrics.cpp"
#include "../src/docx/xlsx_table_state.cpp"
#include "../src/docx/xlsx_textcontext.cpp"
#include "../src/docx/xlsx_utils.cpp"
#include "../src/docx/xlsx_xf.cpp"

View File

@ -1,45 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2016
*
* 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 "../src/odf/draw_frame_pptx.cpp"
#include "../src/odf/draw_shapes_pptx.cpp"
#include "../src/odf/style_paragraph_properties_pptx.cpp"
#include "../src/odf/table_pptx.cpp"
#include "../src/docx/pptx_comments.cpp"
#include "../src/docx/pptx_comments_context.cpp"
#include "../src/docx/pptx_conversion_context.cpp"
#include "../src/docx/pptx_drawing.cpp"
#include "../src/docx/pptx_drawings.cpp"
#include "../src/docx/pptx_output_xml.cpp"
#include "../src/docx/pptx_package.cpp"
#include "../src/docx/pptx_slide_context.cpp"
#include "../src/docx/pptx_table_context.cpp"
#include "../src/docx/pptx_text_context.cpp"

View File

@ -38,24 +38,9 @@ namespace cpdoccore {
namespace oox {
static const int _odf_to_docx_ShapeType[]=
{ 4,4,4,34,};
static const std::wstring _docxShapeType[]=
{
L"rect",
L"rect",
L"rect",
L"ellipse",
L"ellipse",
L"line",
L"custGeom"
};
namespace {
}
void serialize_wrap_top_bottom(std::wostream & strm, _docx_drawing const & val)
{

View File

@ -148,7 +148,7 @@ std::wstring mediaitems::detectImageFileExtension(std::wstring &fileName)
CFile file;
std::wstring sExt;
if (file.OpenFile(std_string2string(fileName)) == S_OK)
if (file.OpenFile(fileName) == S_OK)
{
BYTE buffer[128];
int buffer_size = 128;

View File

@ -38,20 +38,6 @@ namespace cpdoccore {
namespace oox {
static const int _odf_to_docx_ShapeType[]=
{ 4,4,4,34,};
static const std::wstring _docxShapeType[]=
{
L"rect",
L"rect",
L"rect",
L"ellipse",
L"ellipse",
L"line",
L"custGeom"
};
void pptx_serialize_text(std::wostream & strm, _pptx_drawing & val)
{
_CP_OPT(std::wstring) strTextContent;

View File

@ -141,9 +141,9 @@ public:
if (c.rules[j].text) CP_XML_ATTR(L"text", *c.rules[j].text);
if (c.rules[j].rank) CP_XML_ATTR(L"rank", *c.rules[j].rank);
//CP_XML_ATTR(L"bottom" , 0);
//CP_XML_ATTR(L"equalAverage" , 0);
//CP_XML_ATTR(L"aboveAverage" , 0);
//CP_XML_ATTR(L"bottom" , 0);
//CP_XML_ATTR(L"equalAverage" , 0);
//CP_XML_ATTR(L"aboveAverage" , 0);
if (c.rules[j].type == 1)
{
CP_XML_ATTR(L"type", *c.rules[j].formula_type);

View File

@ -344,6 +344,7 @@ double charsToSize(unsigned int charsCount, double maxDigitSize)
void xlsx_table_state::serialize_table_format(std::wostream & _Wostream)
{
odf_reader::odf_read_context & odfContext = context_->root()->odf_context();
CP_XML_WRITER(_Wostream)
{
odf_reader::style_table_properties * table_prop = NULL;
@ -367,13 +368,64 @@ void xlsx_table_state::serialize_table_format(std::wostream & _Wostream)
//<pageSetUpPr fitToPage="true"/>
}
}
//<dimension ref="B1:T65536"/>
CP_XML_NODE(L"sheetView")
int columns = (std::max)(current_table_column_, (int)columns_count_);
int rows = (std::max)(current_table_row_, 1);
if (columns < 1024 && columns > 1 &&
rows < 1024 && rows > 1)
{
// -showGridLines
CP_XML_NODE(L"dimension")
{
std::wstring ref2 = getCellAddress( current_table_column_, current_table_row_);
CP_XML_ATTR(L"ref", L"A1:" + ref2);
}
}
if (odfContext.Settings().get_views_count() > 0)
{
CP_XML_NODE(L"sheetViews")
{
CP_XML_NODE(L"sheetView")
{
CP_XML_ATTR(L"workbookViewId", 0);
std::wstring s_col, s_row;
for (int i = 0; i < odfContext.Settings().get_table_view_count(0, tableName_); i++)
{
std::pair<std::wstring, std::wstring> value = odfContext.Settings().get_table_view(0, tableName_, i);
if (value.first == L"ZoomValue")
{
CP_XML_ATTR(L"zoomScale", value.second);
CP_XML_ATTR(L"zoomScaleNormal", value.second);
}
if (value.first == L"ShowGrid") CP_XML_ATTR(L"showGridLines", value.second);
if (value.first == L"CursorPositionX") s_col = value.second;
if (value.first == L"CursorPositionY") s_row = value.second;
}
int col = -1, row = -1;
try
{
col = boost::lexical_cast<int>(s_col);
row = boost::lexical_cast<int>(s_row);
}
catch(...){}
if (col >= 0 && row >= 0)
{
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"pane", L"topLeft");
}
}
}
}
// -showRowColHeaders
// -rightToLeft
// -zoomScale
}
double default_height = (2 * context_->getMaxDigitSize().second * 72. / 96. * 100.) /100.;//in point size.

View File

@ -53,8 +53,8 @@ std::wstring getColAddress(size_t col)
if (r0 > 0)
{
const std::wstring rest = getColAddress(col - r*r0);
const std::wstring res = getColAddress(r0-1) + rest;
const std::wstring rest = getColAddress(col - r * r0);
const std::wstring res = getColAddress(r0-1) + rest;
return res;
}
else
@ -65,12 +65,12 @@ std::wstring getColAddress(size_t col)
std::wstring getRowAddress(size_t row)
{
return boost::lexical_cast<std::wstring>(row+1);
return boost::lexical_cast<std::wstring>(row + 1);
}
std::wstring getCellAddress(size_t col, size_t row)
{
return getColAddress(col) + getRowAddress(row);
return getColAddress(col) + getRowAddress(row);
}
//_ASSERTE(getColAddressInv(L"A") == 0);
@ -148,11 +148,11 @@ void splitCellAddress(const std::wstring & a_, std::wstring & col, std::wstring
//_ASSERTE(rowS == 999);
void getCellAddressInv(const std::wstring & a_, size_t & col, size_t & row)
{
std::wstring colStr=L"", rowStr=L"";
std::wstring colStr = L"", rowStr = L"";
splitCellAddress(a_, colStr, rowStr);
col = getColAddressInv(colStr);
row = getRowAdderssInv(rowStr);
col = getColAddressInv( colStr );
row = getRowAdderssInv( rowStr );
}
bool parseBoolVal(const std::wstring & str)
@ -188,9 +188,7 @@ std::wstring cellType2Str(XlsxCellType::type type)
boost::int64_t convertDate(int Year, int Month, int Day)
{
using namespace boost::gregorian;
boost::int64_t daysFrom1900 = date_duration(date(Year, Month, Day) - date(1900, 1, 1)).days() + 1;
boost::int64_t daysFrom1900 = boost::gregorian::date_duration(boost::gregorian::date(Year, Month, Day) - boost::gregorian::date(1900, 1, 1)).days() + 1;
if (Year <= 1900 &&
Month <= 2 &&
@ -225,9 +223,9 @@ bool parseDate(const std::wstring & Date, int & Year, int & Month, int & Day)
boost::match_results<std::wstring::const_iterator> res;
if (boost::regex_match(Date, res, r))
{
Year = boost::lexical_cast<int>(res[1].str());
Month = boost::lexical_cast<int>(res[2].str());
Day = boost::lexical_cast<int>(res[3].str());
Year = boost::lexical_cast<int>(res[1].str());
Month = boost::lexical_cast<int>(res[2].str());
Day = boost::lexical_cast<int>(res[3].str());
int Hours, Minutes, Sec, FSec;
if (res[4].matched)
@ -259,7 +257,7 @@ bool parseTime(const std::wstring & Time, int & Hours, int & Minutes, double & s
boost::match_results<std::wstring::const_iterator> res;
if (boost::regex_match(Time, res, r))
{
Hours = boost::lexical_cast<int>(res[1].str());
Hours = boost::lexical_cast<int>(res[1].str());
Minutes = boost::lexical_cast<int>(res[2].str());
seconds = boost::lexical_cast<int>(res[3].str());

View File

@ -41,6 +41,8 @@
#include "xlsx_package.h"
#include "xlsx_utils.h"
#include "xlsx_cell_format.h"
#include "../odf/odfcontext.h"
#include "../odf/calcs_styles.h"
#include "../../DesktopEditor/fontengine/ApplicationFonts.h"
@ -136,7 +138,7 @@ void xlsx_conversion_context::end_document()
{
xlsx_xml_worksheet_ptr& sheet = sheets_[i];
const std::wstring id = std::wstring(L"sId") + std::to_wstring(i+1);
const std::wstring id = std::wstring(L"sId") + std::to_wstring(i + 1);
package::sheet_content_ptr content = package::sheet_content::create();
////////////////////////////////////////////////////////////////////////////////////////////
@ -222,6 +224,8 @@ void xlsx_conversion_context::end_document()
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
serialize_bookViews (CP_XML_STREAM());
CP_XML_NODE(L"sheets")
{
CP_XML_STREAM() << workbook_content.str();
@ -240,10 +244,59 @@ void xlsx_conversion_context::end_document()
output_document_->get_xl_files().set_drawings(drawings);
package::xl_comments_ptr comments = package::xl_comments::create(xlsx_comments_context_handle_.content());
output_document_->get_xl_files().set_comments(comments);
output_document_->get_xl_files().set_comments(comments);
}
}
void xlsx_conversion_context::serialize_bookViews(std::wostream & strm)
{
odf_reader::settings_container &settings = odf_document_->odf_context().Settings();
if (settings.get_views_count() < 1) return;
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"bookViews")
{
for (int i = 0; i < settings.get_views_count(); i++)
{
_CP_OPT(std::wstring) sActiveTable = settings.find_view_by_name(L"ActiveTable", i);
_CP_OPT(std::wstring) sAreaWidth = settings.find_view_by_name(L"VisibleAreaWidth", i);
_CP_OPT(std::wstring) sAreaHeight = settings.find_view_by_name(L"VisibleAreaHeight", i);
_CP_OPT(std::wstring) sAreaTop = settings.find_view_by_name(L"VisibleAreaTop", i);
_CP_OPT(std::wstring) sAreaLeft = settings.find_view_by_name(L"VisibleAreaLeft", i);
CP_XML_NODE(L"workbookView")
{
if (sActiveTable)
{
for (int i = 0; i < sheets_.size(); i++)
{
if (sheets_[i]->name() == *sActiveTable)
{
CP_XML_ATTR(L"activeTab", i);
}
}
}
if (sAreaWidth) CP_XML_ATTR(L"windowWidth", *sAreaWidth);
if (sAreaHeight) CP_XML_ATTR(L"windowHeight", *sAreaHeight);
if (sAreaTop) CP_XML_ATTR(L"yWindow", *sAreaTop);
if (sAreaLeft) CP_XML_ATTR(L"xWindow", *sAreaLeft);
CP_XML_ATTR(L"showSheetTabs", true);
CP_XML_ATTR(L"showVerticalScroll", true);
CP_XML_ATTR(L"showHorizontalScroll",true);
}
}
}
}
}
void xlsx_conversion_context::serialize_calcPr (std::wostream & strm)
{
}
void xlsx_conversion_context::start_body()

View File

@ -177,7 +177,10 @@ public:
mediaitems & get_mediaitems() { return mediaitems_; }
private:
void create_new_sheet(std::wstring const & name);
void create_new_sheet (std::wstring const & name);
void serialize_bookViews(std::wostream & strm);
void serialize_calcPr (std::wostream & strm);
package::xlsx_document *output_document_;
const odf_reader::office_element *spreadsheet_;
@ -201,7 +204,6 @@ private:
math_context math_context_;
xlsx_drawing_context_handle xlsx_drawing_context_handle_;
xlsx_comments_context_handle xlsx_comments_context_handle_;
};
}

View File

@ -40,8 +40,6 @@
#include "style_chart_properties.h"
#include "style_text_properties.h"
#include "office_settings.h"
#include "draw_common.h"
#include "number_style.h"
@ -137,11 +135,12 @@ void object_odf_context::add_grid(std::wstring const & className, std::wstring c
_CP_LOG << "[warning] unexpected chart:grid" << std::endl;
}
}
void object_odf_context::add_series(std::wstring const & cellRangeAddress,
std::wstring const & labelCell,
class_type classType,
std::wstring const & attachedAxis,
std::wstring const & styleName)
void object_odf_context::add_series(
std::wstring const & cellRangeAddress,
std::wstring const & labelCell,
class_type classType,
std::wstring const & attachedAxis,
std::wstring const & styleName)
{
if (class_ == chart_ring) classType = chart_ring;
//if (class_ == chart_stock) classType = chart_stock;
@ -459,13 +458,13 @@ process_build_object::process_build_object(object_odf_context & object_odf, odf_
,number_styles_ (context.numberStyles())
,num_format_context_(context)
{
office_element_ptr sett_elm = settings_.find_by_style_name(L"BaseFontHeight");
settings_config_item* sett = dynamic_cast<settings_config_item*>(sett_elm.get());
if (sett)
_CP_OPT(std::wstring) sFontHeight = settings_.find_by_name(L"BaseFontHeight");
if (sFontHeight)
{
try
{
object_odf_context_.baseFontHeight_ = boost::lexical_cast<int>(sett->content_);
object_odf_context_.baseFontHeight_ = boost::lexical_cast<int>(*sFontHeight);
}
catch(...)
{

View File

@ -340,7 +340,7 @@ private:
styles_container & styles_;
styles_lite_container & settings_;
settings_container & settings_;
styles_lite_container & draw_styles_;
styles_lite_container & number_styles_;

View File

@ -85,6 +85,7 @@
#include "documentcontext.h"
#include "../progressCallback.h"
#define PROGRESSEVENT_ID 0
namespace cpdoccore {
@ -146,6 +147,7 @@ odf_document::Impl::Impl(const std::wstring & folderPath, const ProgressCallback
UpdateProgress(400000);
}
bool odf_document::Impl::UpdateProgress(long nComplete)
{
if (pCallBack)
@ -160,6 +162,7 @@ bool odf_document::Impl::UpdateProgress(long nComplete)
return false;
}
void odf_document::Impl::parse_fonts()
{
do
@ -291,10 +294,60 @@ void odf_document::Impl::parse_settings()
settings_config_item * sett = dynamic_cast<settings_config_item *>(elm_sett.get());
if (!sett)continue;
context_->Settings().add(sett->config_name_, elm_sett);
context_->Settings().add(sett->config_name_, sett->content_);
}
}
}
else if (item_set->config_name_ == L"ooo:view-settings")
{
BOOST_FOREACH(office_element_ptr & elm_sett, item_set->content_)
{
settings_config_item * sett = dynamic_cast<settings_config_item *>(elm_sett.get());
if (sett)
context_->Settings().add_view(sett->config_name_, sett->content_);
else
{
settings_config_item_map_indexed *map_sett = dynamic_cast<settings_config_item_map_indexed *>(elm_sett.get());
if ((map_sett) && (map_sett->config_name_ == L"Views"))
{
for (int i = 0; i < map_sett->content_.size(); i++)
{
settings_config_item_map_entry *entry = dynamic_cast<settings_config_item_map_entry *>(map_sett->content_[i].get());
if (!entry) continue;
context_->Settings().start_view();
for (int j = 0; j < entry->content_.size(); j++)
{
settings_config_item * sett = dynamic_cast<settings_config_item *>(entry->content_[j].get());
if (sett)
context_->Settings().add_view(sett->config_name_, sett->content_);
settings_config_item_map_named *map_v = dynamic_cast<settings_config_item_map_named *>(entry->content_[j].get());
if (map_v)
{
for (int n = 0; n < map_v->content_.size(); n++)
{
settings_config_item_map_entry *entry_v = dynamic_cast<settings_config_item_map_entry *>(map_v->content_[n].get());
if (!entry_v) continue;
context_->Settings().start_table_view(entry_v->config_name_);
for (int k = 0; k < entry_v->content_.size(); k++)
{
sett = dynamic_cast<settings_config_item *>(entry_v->content_[k].get());
if (sett)
context_->Settings().add_view(sett->config_name_, sett->content_);
}
context_->Settings().end_table_view();
}
}
}
context_->Settings().end_view();
}
}
}
}
}
}
}
void odf_document::Impl::parse_styles()

View File

@ -280,8 +280,8 @@ class fonts_container
{
public:
typedef std::vector<font_instance_ptr> instances_array;
public:
font_instance * font_by_style_name(const std::wstring & StyleName);
font_instance * font_by_style_name(const std::wstring & StyleName);
font_instance * font_by_name(const std::wstring & Name);
instances_array & instances() { return instances_; }
void add_font( font_instance_ptr FontInstance );
@ -322,8 +322,7 @@ class list_style_container
public:
typedef std::vector<list_style_instance_ptr> instances_array;
public:
void add_list_style(text_list_style * textListStyle);
void add_list_style(text_list_style * textListStyle);
void add_list_style(text_list_style * textListStyle, const std::wstring & NewName);
/// получить экземпляр по имени стиля
@ -367,10 +366,10 @@ public:
notes_configuration & noteConfiguration() { return notes_configuration_; }
styles_lite_container & numberStyles() { return number_style_container_; }
styles_lite_container & drawStyles() { return draw_style_container_; }
styles_lite_container & Templates() { return template_container_; }
styles_lite_container & Settings() { return settings_container_; }
styles_lite_container& numberStyles() { return number_style_container_; }
styles_lite_container& drawStyles() { return draw_style_container_; }
styles_lite_container& Templates() { return template_container_; }
settings_container& Settings() { return settings_container_; }
private:
styles_container major_style_container_;
@ -383,7 +382,7 @@ private:
styles_lite_container draw_style_container_;
styles_lite_container template_container_;
styles_lite_container settings_container_;
settings_container settings_container_;
};

View File

@ -93,6 +93,7 @@ const wchar_t * settings_config_item_map_indexed::name = L"config-item-map-index
void settings_config_item_map_indexed::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"config:name", config_name_, std::wstring(L""));
}
void settings_config_item_map_indexed::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
@ -106,6 +107,7 @@ const wchar_t * settings_config_item_map_named::name = L"config-item-map-named";
void settings_config_item_map_named::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"config:name", config_name_, std::wstring(L""));
}
void settings_config_item_map_named::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
@ -119,6 +121,7 @@ const wchar_t * settings_config_item_map_entry::name = L"config-item-map-entry";
void settings_config_item_map_entry::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"config:name", config_name_, std::wstring(L""));
}
void settings_config_item_map_entry::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)

View File

@ -112,15 +112,13 @@ public:
static const ElementType type = typeOfficeSettingsConfigItemMapIndexed;
CPDOCCORE_DEFINE_VISITABLE();
std::wstring config_name_;
office_element_ptr_array content_;
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:
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(settings_config_item_map_indexed);
@ -134,15 +132,13 @@ public:
static const ElementType type = typeOfficeSettingsConfigItemMapNamed;
CPDOCCORE_DEFINE_VISITABLE();
std::wstring config_name_;
office_element_ptr_array content_;
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:
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(settings_config_item_map_named);
@ -156,15 +152,13 @@ public:
static const ElementType type = typeOfficeSettingsConfigItemMapEntry;
CPDOCCORE_DEFINE_VISITABLE();
std::wstring config_name_;
office_element_ptr_array content_;
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:
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(settings_config_item_map_entry);

View File

@ -96,14 +96,14 @@ public:
typedef boost::function< void (const office_element * elm, std::wstring defaultColumnStyle, std::wstring defaultRowStyle) > on_found_callback;
table_round(std::wstring const & targetTable, int targetColumn, int targetRow, on_found_callback on_found)
: target_table_(targetTable),
target_column_(targetColumn),
target_row_(targetRow),
on_found_(on_found),
current_table_column_(0),
current_table_row_(0),
columns_spanned_num_(0),
columns_count_(0),
: target_table_ (targetTable),
target_column_ (targetColumn),
target_row_ (targetRow),
on_found_ (on_found),
current_table_column_ (0),
current_table_row_ (0),
columns_spanned_num_ (0),
columns_count_ (0),
stop_(false)
{}

View File

@ -110,7 +110,7 @@ std::wstring process_border(const border_style & borderStyle,
return res;
}
std::wstring process_margin(const _CP_OPT(length_or_percent) & margin, double Mul)
std::wstring docx_process_margin(const _CP_OPT(length_or_percent) & margin, double Mul)
{
if (margin)
{
@ -288,8 +288,8 @@ void paragraph_format_properties::docx_convert(oox::docx_conversion_context & Co
std::wstring w_after, w_before;
std::wstring w_line, w_lineRule;
w_after = process_margin(fo_margin_bottom_, 20.0);
w_before = process_margin(fo_margin_top_, 20.0);
w_after = docx_process_margin(fo_margin_bottom_, 20.0);
w_before = docx_process_margin(fo_margin_top_, 20.0);
// TODO : здесь 240 берется из корневого стиля? надо не константу использовать а брать оттуда
// в xsl преобразованиях так же написано
@ -341,9 +341,9 @@ void paragraph_format_properties::docx_convert(oox::docx_conversion_context & Co
// TODO auto indent
std::wstring w_left, w_right, w_hanging, w_firstLine;
w_left = process_margin(fo_margin_left_, 20.0);
w_right = process_margin(fo_margin_right_, 20.0);
w_firstLine = process_margin(fo_text_indent_, 20.0);
w_left = docx_process_margin(fo_margin_left_, 20.0);
w_right = docx_process_margin(fo_margin_right_, 20.0);
w_firstLine = docx_process_margin(fo_text_indent_, 20.0);
if (w_left.empty()) w_left = L"0";
if (w_right.empty()) w_right = L"0";

View File

@ -106,7 +106,7 @@ std::wstring process_border(border_style & borderStyle,
return res;
}
std::wstring process_margin(const _CP_OPT(length_or_percent) & margin, length::unit unit, double Mul)
std::wstring pptx_process_margin(const _CP_OPT(length_or_percent) & margin, length::unit unit, double Mul)
{
if (margin)
{
@ -156,9 +156,9 @@ void paragraph_format_properties::xlsx_convert(std::wostream & strm, bool in_dra
// TODO auto indent
std::wstring w_left, w_right, w_firstLine;
w_left = process_margin(fo_margin_left_, length::emu, 1.);
w_right = process_margin(fo_margin_right_, length::emu, 1.);
w_firstLine = process_margin(fo_text_indent_,length::emu, 1.);
w_left = pptx_process_margin(fo_margin_left_, length::emu, 1.);
w_right = pptx_process_margin(fo_margin_right_, length::emu, 1.);
w_firstLine = pptx_process_margin(fo_text_indent_,length::emu, 1.);
//if (w_left.empty()) w_left = L"0";
//if (w_right.empty()) w_right = L"0";
@ -227,7 +227,7 @@ void paragraph_format_properties::xlsx_convert(std::wostream & strm, bool in_dra
{
if (fo_margin_bottom_->get_type() == length_or_percent::Length)
{
std::wstring w_before = process_margin(fo_margin_top_, length::pt, 100.0);
std::wstring w_before = pptx_process_margin(fo_margin_top_, length::pt, 100.0);
CP_XML_NODE(L"a:spcPts")
{
CP_XML_ATTR(L"val",w_before);
@ -250,7 +250,7 @@ void paragraph_format_properties::xlsx_convert(std::wostream & strm, bool in_dra
{
if (fo_margin_bottom_->get_type() == length_or_percent::Length)
{
std::wstring w_after = process_margin(fo_margin_bottom_, length::pt, 100.0);
std::wstring w_after = pptx_process_margin(fo_margin_bottom_, length::pt, 100.0);
CP_XML_NODE(L"a:spcPts")
{
CP_XML_ATTR(L"val",w_after);
@ -281,9 +281,9 @@ void paragraph_format_properties::pptx_convert(oox::pptx_conversion_context & Co
// TODO auto indent
std::wstring w_left, w_right, w_firstLine;
w_left = process_margin(fo_margin_left_, length::emu, 1.);
w_right = process_margin(fo_margin_right_, length::emu, 1.);
w_firstLine = process_margin(fo_text_indent_,length::emu, 1.);
w_left = pptx_process_margin(fo_margin_left_, length::emu, 1.);
w_right = pptx_process_margin(fo_margin_right_, length::emu, 1.);
w_firstLine = pptx_process_margin(fo_text_indent_,length::emu, 1.);
//if (w_left.empty()) w_left = L"0";
//if (w_right.empty()) w_right = L"0";
@ -460,7 +460,7 @@ void paragraph_format_properties::pptx_convert(oox::pptx_conversion_context & Co
{
if (fo_margin_bottom_->get_type() == length_or_percent::Length)
{
std::wstring w_before = process_margin(fo_margin_top_, length::pt, 100.0);
std::wstring w_before = pptx_process_margin(fo_margin_top_, length::pt, 100.0);
CP_XML_NODE(L"a:spcPts")
{
CP_XML_ATTR(L"val",w_before);
@ -483,7 +483,7 @@ void paragraph_format_properties::pptx_convert(oox::pptx_conversion_context & Co
{
if (fo_margin_bottom_->get_type() == length_or_percent::Length)
{
std::wstring w_after = process_margin(fo_margin_bottom_, length::pt, 100.0);
std::wstring w_after = pptx_process_margin(fo_margin_bottom_, length::pt, 100.0);
CP_XML_NODE(L"a:spcPts")
{
CP_XML_ATTR(L"val",w_after);

View File

@ -34,23 +34,23 @@
#include <boost/unordered_map.hpp>
#include "styles_lite_container.h"
#include "office_settings.h"
namespace cpdoccore {
namespace odf_reader {
struct style_ref_lite_container
struct container_element
{
std::wstring style_name;
office_element_ptr style;
std::wstring name;
office_element_ptr elm;
};
struct styles_lite_container::Impl
{
typedef std::vector<style_ref_lite_container> array_t;
array_t array_;
typedef boost::unordered_map<std::wstring, size_t> map_t;
map_t map_;
std::vector<container_element> array_;
boost::unordered_map<std::wstring, int> map_;
};
styles_lite_container::styles_lite_container(): impl_(new styles_lite_container::Impl() )
@ -61,25 +61,209 @@ styles_lite_container::~styles_lite_container()
{
}
void styles_lite_container::add(const std::wstring & style_name, office_element_ptr content)
void styles_lite_container::add(const std::wstring & name, office_element_ptr content)
{
style_ref_lite_container ref = {style_name, content};
impl_->array_.push_back(ref);
impl_->map_[style_name] = impl_->array_.size() - 1;
container_element ref = {name, content};
impl_->array_.push_back(ref);
impl_->map_[name] = impl_->array_.size() - 1;
}
office_element_ptr styles_lite_container::find_by_style_name(const std::wstring & style_name)
office_element_ptr styles_lite_container::find_by_style_name(const std::wstring & name)
{
styles_lite_container::Impl::map_t::const_iterator i = impl_->map_.find(style_name);
if (i != impl_->map_.end())
boost::unordered_map<std::wstring, int>::const_iterator i = impl_->map_.find(name);
if (i != impl_->map_.end())
{
return impl_->array_[i->second].style;
return impl_->array_[i->second].elm;
}
else
{
return office_element_ptr();
}
}
//----------------------------------------------------------------------------------
struct settings_value
{
std::wstring name;
std::wstring value;
};
struct settings_elm
{
std::vector<settings_value> array_;
boost::unordered_map<std::wstring, int> map_;
};
struct view_elm : settings_elm
{
boost::unordered_map<std::wstring, int> map_tables;
std::vector<settings_elm> tables;
};
class settings_container::Impl
{
public:
Impl() : inViewTable(false), inView(false) {}
settings_elm common;
settings_elm common_view;
std::vector<view_elm> views;
bool inViewTable;
bool inView;
};
settings_container::settings_container(): impl_(new settings_container::Impl() )
{
}
settings_container::~settings_container()
{
}
void settings_container::add(const std::wstring & name, const std::wstring & value)
{
settings_value ref = {name, value};
impl_->common.array_.push_back(ref);
impl_->common.map_[name] = impl_->common.array_.size() - 1;
}
void settings_container::start_view ()
{
impl_->inView = true;
view_elm elm;
impl_->views.push_back(elm);
}
void settings_container::end_view ()
{
impl_->inView = false;
}
void settings_container::start_table_view (const std::wstring & name)
{
if (name.empty()) return;
impl_->inViewTable = true;
settings_elm elm;
impl_->views.back().tables.push_back(elm);
impl_->views.back().map_tables[name] = impl_->views.back().tables.size() - 1;
}
void settings_container::end_table_view ()
{
impl_->inViewTable = false;
}
int settings_container::get_views_count()
{
return impl_->views.size();
}
int settings_container::get_table_view_count(int ind, std::wstring name)
{
if (ind < 0 || ind >= impl_->views.size()) return 0;
boost::unordered_map<std::wstring, int>::const_iterator i = impl_->views[ind].map_tables.find(name);
if (i != impl_->views[ind].map_tables.end())
{
return impl_->views[ind].tables[i->second].array_.size();
}
return 0;
}
void settings_container::add_view(const std::wstring & name, const std::wstring & value)
{
settings_value ref = {name, value};
if (impl_->inView)
{
if (impl_->inViewTable)
{
impl_->views.back().tables.back().array_.push_back(ref);
impl_->views.back().tables.back().map_[name] = impl_->views.back().tables.back().array_.size() - 1;
}
else
{
impl_->views.back().array_.push_back(ref);
impl_->views.back().map_[name] = impl_->views.back().array_.size() - 1;
}
}
else
{
impl_->common_view.array_.push_back(ref);
impl_->common_view.map_[name] = impl_->common_view.array_.size() - 1;
}
}
std::pair<std::wstring, std::wstring> settings_container::get_table_view(int index_view, const std::wstring & table_name, int index)
{
std::pair<std::wstring, std::wstring> value;
if (index < 0) return value;
if (index_view < 0 ||
index_view >= impl_->views.size()) return value;
boost::unordered_map<std::wstring, int>::const_iterator i = impl_->views[index_view].map_tables.find(table_name);
if (i == impl_->views[index_view].map_tables.end()) return value;
if (index < impl_->views[index_view].tables[i->second].array_.size())
{
value.first = impl_->views[index_view].tables[i->second].array_[index].name;
value.second = impl_->views[index_view].tables[i->second].array_[index].value;
}
return value;
}
_CP_OPT(std::wstring) settings_container::find_by_name(const std::wstring & name)
{
_CP_OPT(std::wstring) value;
boost::unordered_map<std::wstring, int>::const_iterator i = impl_->common.map_.find(name);
if (i != impl_->common.map_.end())
{
value = impl_->common.array_[i->second].value;
}
return value;
}
_CP_OPT(std::wstring) settings_container::find_view_by_name(const std::wstring & name, int ind)
{
_CP_OPT(std::wstring) value;
if (ind < 0 || ind >= impl_->views.size())
{
boost::unordered_map<std::wstring, int>::const_iterator i = impl_->common_view.map_.find(name);
if (i != impl_->common_view.map_.end())
{
value = impl_->common_view.array_[i->second].value;
}
}
else
{
boost::unordered_map<std::wstring, int>::const_iterator i = impl_->views[ind].map_.find(name);
if (i != impl_->views[ind].map_.end())
{
value = impl_->views[ind].array_[i->second].value;
}
else
{
return find_view_by_name(name);
}
}
return value;
}
}
}
}

View File

@ -33,6 +33,7 @@
#include <cpdoccore/CPSharedPtr.h>
#include <cpdoccore/CPScopedPtr.h>
#include <cpdoccore/CPOptional.h>
namespace cpdoccore {
namespace odf_reader {
@ -45,8 +46,8 @@ class styles_lite_container
public:
styles_lite_container();
~styles_lite_container();
public:
void add(const std::wstring & style_name, office_element_ptr content);
void add(const std::wstring & style_name, office_element_ptr content);
office_element_ptr find_by_style_name(const std::wstring & style_name);
private:
@ -55,5 +56,33 @@ private:
};
class settings_container
{
public:
settings_container();
~settings_container();
_CP_OPT(std::wstring) find_by_name (const std::wstring & name);
_CP_OPT(std::wstring) find_view_by_name (const std::wstring & name, int index = -1); //"-1" - common
std::pair<std::wstring, std::wstring> get_table_view (int index_view, const std::wstring & table_name, int index);
int get_views_count ();
int get_table_view_count(int ind, std::wstring name);
void add (const std::wstring & name, const std::wstring & value);
void start_view ();
void end_view ();
void start_table_view (const std::wstring & name);
void end_table_view ();
void add_view (const std::wstring & name, const std::wstring & value);
private:
class Impl;
_CP_SCOPED_PTR(Impl) impl_;
};
}
}

View File

@ -29,14 +29,16 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
typedef void (*OnProgressCallback)( void* lpParam, long nID, long nPercent );
typedef void (*OnProgressExCallback)( void* lpParam, long nID, long nPercent, short* Cancel );
typedef void (*OnProgressCallbackOdf) ( void* lpParam, long nID, long nPercent );
typedef void (*OnProgressExCallbackOdf)( void* lpParam, long nID, long nPercent, short* Cancel ) ;
struct ProgressCallback
{
OnProgressCallback OnProgress;
OnProgressExCallback OnProgressEx;
OnProgressCallbackOdf OnProgress;
OnProgressExCallbackOdf OnProgressEx;
void* caller;
};

View File

@ -1720,10 +1720,6 @@
RelativePath="..\..\Common\DocxFormat\Source\SystemUtility\FileSystem\Directory.cpp"
>
</File>
<File
RelativePath="..\..\Common\DocxFormat\Source\XML\stringcommon.cpp"
>
</File>
</Files>
<Globals>
</Globals>

View File

@ -47,6 +47,12 @@
#include "../source/Oox2OdfConverter/Oox2OdfConverter.h"
#if defined(_WIN64)
#pragma comment(lib, "../../build/bin/icu/win_64/icuuc.lib")
#elif defined (_WIN32)
#pragma comment(lib, "../../build/bin/icu/win_32/icuuc.lib")
#endif
std::wstring DetectTypeDocument(const std::wstring & pathOOX)
{
std::wstring sRes;

View File

@ -373,6 +373,18 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\UnicodeConverter\UnicodeConverter.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
</File>
</Filter>
</Files>
<Globals>

View File

@ -35,10 +35,12 @@ CONFIG(debug, debug|release){
DEFINES += _DEBUG
}
build_fast {
core_release {
SOURCES += \
odffilewriterlib_all.cpp
} else {
odffilewriterlib_odf.cpp
}
core_debug {
SOURCES += \
../source/OdfFormat/abstract_xml.cpp \
../source/OdfFormat/calcext_elements.cpp \
@ -48,7 +50,6 @@ SOURCES += \
../source/OdfFormat/header_footer.cpp \
../source/OdfFormat/list.cpp \
../source/OdfFormat/mediaitems.cpp \
../source/OdfFormat/mediaitems_utils.cpp \
../source/OdfFormat/number_style.cpp \
../source/OdfFormat/object_package.cpp \
../source/OdfFormat/odf_chart_context.cpp \
@ -94,14 +95,18 @@ SOURCES += \
../source/OdfFormat/table_database_ranges.cpp \
../source/OdfFormat/table_named_expressions.cpp \
../source/OdfFormat/text_elements.cpp \
../source/OdfFormat/odf_settings_context.cpp \
../source/OdfFormat/office_settings.cpp \
../source/OdfFormat/mediaitems_utils.cpp
}
SOURCES += \
../source/Oox2OdfConverter/ConvertDiagram.cpp \
../source/Oox2OdfConverter/Converter.cpp \
../source/Oox2OdfConverter/ConverterChart.cpp \
../source/Oox2OdfConverter/ConvertVml.cpp \
../source/Oox2OdfConverter/DocxConverter.cpp \
../source/Oox2OdfConverter/XlsxConverter.cpp
}
HEADERS += \
../source/OdfFormat/abstract_xml.h \
@ -112,7 +117,6 @@ HEADERS += \
../source/OdfFormat/header_footer.h \
../source/OdfFormat/list.h \
../source/OdfFormat/mediaitems.h \
../source/OdfFormat/mediaitems_utils.h \
../source/OdfFormat/number_style.h \
../source/OdfFormat/object_package.h \
../source/OdfFormat/odf_chart_context.h \
@ -185,7 +189,3 @@ HEADERS += \
../source/OdfFormat/Shapes/oox_shapeWordArt.h \
../source/OdfFormat/odf_settings_context.h \
../source/OdfFormat/office_settings.h
SOURCES += \
../source/OdfFormat/odf_settings_context.cpp \
../source/OdfFormat/office_settings.cpp

View File

@ -1,90 +1,86 @@
/*
* (c) Copyright Ascensio System SIA 2010-2016
*
* 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 "../source/OdfFormat/abstract_xml.cpp"
#include "../source/OdfFormat/calcext_elements.cpp"
#include "../source/OdfFormat/draw_base.cpp"
#include "../source/OdfFormat/draw_frame.cpp"
#include "../source/OdfFormat/draw_shapes.cpp"
#include "../source/OdfFormat/header_footer.cpp"
#include "../source/OdfFormat/list.cpp"
#include "../source/OdfFormat/mediaitems.cpp"
#include "../source/OdfFormat/mediaitems_utils.cpp"
#include "../source/OdfFormat/number_style.cpp"
#include "../source/OdfFormat/object_package.cpp"
#include "../source/OdfFormat/odf_chart_context.cpp"
#include "../source/OdfFormat/odf_comment_context.cpp"
#include "../source/OdfFormat/odf_conversion_context.cpp"
#include "../source/OdfFormat/odf_drawing_context.cpp"
#include "../source/OdfFormat/odf_lists_styles_context.cpp"
#include "../source/OdfFormat/odf_number_styles_context.cpp"
#include "../source/OdfFormat/odf_page_layout_context.cpp"
#include "../source/OdfFormat/odf_page_layout_state.cpp"
#include "../source/OdfFormat/odf_rels.cpp"
#include "../source/OdfFormat/odf_style_context.cpp"
#include "../source/OdfFormat/odf_style_state.cpp"
#include "../source/OdfFormat/odf_table_context.cpp"
#include "../source/OdfFormat/odf_table_styles_context.cpp"
#include "../source/OdfFormat/odf_text_context.cpp"
#include "../source/OdfFormat/ods_conversion_context.cpp"
#include "../source/OdfFormat/ods_table_context.cpp"
#include "../source/OdfFormat/ods_table_state.cpp"
#include "../source/OdfFormat/odt_conversion_context.cpp"
#include "../source/OdfFormat/office_annotation.cpp"
#include "../source/OdfFormat/office_body.cpp"
#include "../source/OdfFormat/office_chart.cpp"
#include "../source/OdfFormat/office_elements_create.cpp"
#include "../source/OdfFormat/office_spreadsheet.cpp"
#include "../source/OdfFormat/office_text.cpp"
#include "../source/OdfFormat/oox_shape_defines.cpp"
#include "../source/OdfFormat/paragraph_elements.cpp"
#include "../source/OdfFormat/style_chart_properties.cpp"
#include "../source/OdfFormat/style_graphic_properties.cpp"
#include "../source/OdfFormat/style_map.cpp"
#include "../source/OdfFormat/style_page_layout_properties.cpp"
#include "../source/OdfFormat/style_paragraph_properties.cpp"
#include "../source/OdfFormat/styles.cpp"
#include "../source/OdfFormat/style_section_properties.cpp"
#include "../source/OdfFormat/styles_list.cpp"
#include "../source/OdfFormat/styles_lite_container.cpp"
#include "../source/OdfFormat/style_table_properties.cpp"
#include "../source/OdfFormat/style_text_properties.cpp"
#include "../source/OdfFormat/svg_creator.cpp"
#include "../source/OdfFormat/table.cpp"
#include "../source/OdfFormat/table_database_ranges.cpp"
#include "../source/OdfFormat/table_named_expressions.cpp"
#include "../source/OdfFormat/text_elements.cpp"
#include "../source/Oox2OdfConverter/ConvertDiagram.cpp"
#include "../source/Oox2OdfConverter/Converter.cpp"
#include "../source/Oox2OdfConverter/ConverterChart.cpp"
#include "../source/Oox2OdfConverter/ConvertVml.cpp"
#include "../source/Oox2OdfConverter/DocxConverter.cpp"
#include "../source/Oox2OdfConverter/XlsxConverter.cpp"
/*
* (c) Copyright Ascensio System SIA 2010-2016
*
* 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 "../source/OdfFormat/calcext_elements.cpp"
#include "../source/OdfFormat/draw_base.cpp"
#include "../source/OdfFormat/draw_frame.cpp"
#include "../source/OdfFormat/draw_shapes.cpp"
#include "../source/OdfFormat/header_footer.cpp"
#include "../source/OdfFormat/list.cpp"
#include "../source/OdfFormat/mediaitems.cpp"
#include "../source/OdfFormat/number_style.cpp"
#include "../source/OdfFormat/object_package.cpp"
#include "../source/OdfFormat/odf_chart_context.cpp"
#include "../source/OdfFormat/odf_comment_context.cpp"
#include "../source/OdfFormat/odf_notes_context.cpp"
#include "../source/OdfFormat/odf_conversion_context.cpp"
#include "../source/OdfFormat/odf_drawing_context.cpp"
#include "../source/OdfFormat/odf_lists_styles_context.cpp"
#include "../source/OdfFormat/odf_number_styles_context.cpp"
#include "../source/OdfFormat/odf_page_layout_context.cpp"
#include "../source/OdfFormat/odf_page_layout_state.cpp"
#include "../source/OdfFormat/odf_rels.cpp"
#include "../source/OdfFormat/odf_style_context.cpp"
#include "../source/OdfFormat/odf_style_state.cpp"
#include "../source/OdfFormat/odf_table_context.cpp"
#include "../source/OdfFormat/odf_table_styles_context.cpp"
#include "../source/OdfFormat/odf_text_context.cpp"
#include "../source/OdfFormat/ods_conversion_context.cpp"
#include "../source/OdfFormat/ods_table_context.cpp"
#include "../source/OdfFormat/ods_table_state.cpp"
#include "../source/OdfFormat/odt_conversion_context.cpp"
#include "../source/OdfFormat/office_annotation.cpp"
#include "../source/OdfFormat/office_body.cpp"
#include "../source/OdfFormat/office_chart.cpp"
#include "../source/OdfFormat/office_elements_create.cpp"
#include "../source/OdfFormat/office_spreadsheet.cpp"
#include "../source/OdfFormat/office_text.cpp"
#include "../source/OdfFormat/oox_shape_defines.cpp"
#include "../source/OdfFormat/paragraph_elements.cpp"
#include "../source/OdfFormat/style_chart_properties.cpp"
#include "../source/OdfFormat/style_graphic_properties.cpp"
#include "../source/OdfFormat/style_map.cpp"
#include "../source/OdfFormat/style_page_layout_properties.cpp"
#include "../source/OdfFormat/style_paragraph_properties.cpp"
#include "../source/OdfFormat/styles.cpp"
#include "../source/OdfFormat/style_section_properties.cpp"
#include "../source/OdfFormat/styles_list.cpp"
#include "../source/OdfFormat/styles_lite_container.cpp"
#include "../source/OdfFormat/style_table_properties.cpp"
#include "../source/OdfFormat/style_text_properties.cpp"
#include "../source/OdfFormat/svg_creator.cpp"
#include "../source/OdfFormat/table.cpp"
#include "../source/OdfFormat/table_database_ranges.cpp"
#include "../source/OdfFormat/table_named_expressions.cpp"
#include "../source/OdfFormat/text_elements.cpp"
#include "../source/OdfFormat/odf_settings_context.cpp"
#include "../source/OdfFormat/office_settings.cpp"
#include "../source/OdfFormat/mediaitems_utils.cpp"

View File

@ -321,7 +321,7 @@ void OoxConverter::convert(OOX::Vml::CShape *vml_shape)
if (vml_shape->m_oPath.IsInit())
{
odf_context()->drawing_context()->set_path(string2std_string(vml_shape->m_oPath->GetValue()));
odf_context()->drawing_context()->set_path(vml_shape->m_oPath->GetValue());
}
OOX::Vml::CVmlCommonElements *vml_common = static_cast<OOX::Vml::CVmlCommonElements *>(vml_shape);
@ -352,7 +352,7 @@ void OoxConverter::convert(OOX::Vml::CImageData *vml_image_data)
odf_context()->drawing_context()->start_area_properties();
odf_context()->drawing_context()->start_bitmap_style();
odf_context()->drawing_context()->set_bitmap_link(string2std_string(pathImage));
odf_context()->drawing_context()->set_bitmap_link(pathImage);
odf_context()->drawing_context()->set_image_style_repeat(1);//stretch
double gain = vml_image_data->m_oGain.GetValue();
@ -405,7 +405,7 @@ void OoxConverter::convert(OOX::Vml::CFill *vml_fill)
if (pathImage.GetLength() > 0)
{
odf_context()->drawing_context()->set_bitmap_link(string2std_string(pathImage));
odf_context()->drawing_context()->set_bitmap_link(pathImage);
_graphics_utils_::GetResolution(pathImage, Width, Height);
}
odf_context()->drawing_context()->set_image_style_repeat(1);
@ -429,9 +429,9 @@ void OoxConverter::convert(OOX::Vml::CFill *vml_fill)
_CP_OPT(double) no_set;
if (vml_fill->m_oColor.IsInit())
odf_context()->drawing_context()->set_gradient_start(string2std_string(vml_fill->m_oColor->ToString()),no_set);
odf_context()->drawing_context()->set_gradient_start(vml_fill->m_oColor->ToString(), no_set);
if (vml_fill->m_oColor2.IsInit())
odf_context()->drawing_context()->set_gradient_end(string2std_string(vml_fill->m_oColor2->ToString()),no_set);
odf_context()->drawing_context()->set_gradient_end(vml_fill->m_oColor2->ToString(), no_set);
if (vml_fill->m_oFocusPosition.IsInit())
odf_context()->drawing_context()->set_gradient_center(vml_fill->m_oFocusPosition->GetX(), vml_fill->m_oFocusPosition->GetY());
@ -442,9 +442,9 @@ void OoxConverter::convert(OOX::Vml::CFill *vml_fill)
{
odf_context()->drawing_context()->start_hatch_style();
if (vml_fill->m_oColor2.IsInit())
odf_context()->drawing_context()->set_hatch_line_color(string2std_string(vml_fill->m_oColor2->ToString()));
odf_context()->drawing_context()->set_hatch_line_color(vml_fill->m_oColor2->ToString());
if (vml_fill->m_oColor.IsInit())
odf_context()->drawing_context()->set_hatch_area_color(string2std_string(vml_fill->m_oColor->ToString()));
odf_context()->drawing_context()->set_hatch_area_color(vml_fill->m_oColor->ToString());
else
odf_context()->drawing_context()->set_hatch_area_color(L"#ffffff");
@ -454,7 +454,7 @@ void OoxConverter::convert(OOX::Vml::CFill *vml_fill)
case SimpleTypes::filltypeSolid:
default:
if (vml_fill->m_oColor.IsInit())
odf_context()->drawing_context()->set_solid_fill(string2std_string(vml_fill->m_oColor->ToString()));
odf_context()->drawing_context()->set_solid_fill(vml_fill->m_oColor->ToString());
break;
}
}
@ -557,7 +557,7 @@ void OoxConverter::convert(OOX::Vml::CShadow *vml_shadow)
if (vml_shadow == NULL) return;
if (vml_shadow->m_oOn.GetValue() == false) return;
std::wstring hexColor = string2std_string(vml_shadow->m_oColor.ToString());
std::wstring hexColor = vml_shadow->m_oColor.ToString();
_CP_OPT(double) opacity;
if (vml_shadow->m_oOpacity.IsInit()) opacity = 100 - 100 * vml_shadow->m_oOpacity->GetValue();
@ -587,7 +587,7 @@ void OoxConverter::convert(OOX::Vml::CStroke *vml_stroke)
if (vml_stroke->m_oColor.IsInit())
{
std::wstring hexColor = string2std_string(vml_stroke->m_oColor->ToString());
std::wstring hexColor = vml_stroke->m_oColor->ToString();
if (hexColor.length() < 1)hexColor = L"000000";
odf_context()->drawing_context()->set_solid_fill(hexColor);
}
@ -675,7 +675,7 @@ void OoxConverter::convert(OOX::Vml::CTextPath *vml_textpath)
odf_context()->text_context()->start_paragraph(false);
odf_context()->text_context()->start_span(false);
odf_context()->text_context()->add_text_content(string2std_string(vml_textpath->m_sString.get()));
odf_context()->text_context()->add_text_content(vml_textpath->m_sString.get());
odf_context()->text_context()->end_span();
odf_context()->text_context()->end_paragraph();
@ -795,7 +795,7 @@ void OoxConverter::convert(OOX::Vml::CVmlCommonElements *vml_common)
SimpleTypes::CHexColor<> *oRgbColor = new SimpleTypes::CHexColor<>(ucR,ucG,ucB);
if (oRgbColor)
{
odf_context()->drawing_context()->set_solid_fill(string2std_string(oRgbColor->ToString().Right(6)));
odf_context()->drawing_context()->set_solid_fill(oRgbColor->ToString().Right(6));
delete oRgbColor;
}
}
@ -812,7 +812,7 @@ void OoxConverter::convert(OOX::Vml::CVmlCommonElements *vml_common)
if (oRgbColor)
{
odf_context()->drawing_context()->start_area_properties();
odf_context()->drawing_context()->set_solid_fill(string2std_string(oRgbColor->ToString().Right(6)));
odf_context()->drawing_context()->set_solid_fill(oRgbColor->ToString().Right(6));
odf_context()->drawing_context()->end_area_properties();
delete oRgbColor;
}

View File

@ -332,7 +332,7 @@ void OoxConverter::convert(OOX::Drawing::CLockedCanvas *oox_canvas)
if (oox_canvas->m_oNvGroupSpPr.IsInit() && oox_canvas->m_oNvGroupSpPr->m_oCNvPr.IsInit())
{
if (oox_canvas->m_oNvGroupSpPr->m_oCNvPr->m_sName.IsInit())
odf_context()->drawing_context()->set_group_name(string2std_string(*oox_canvas->m_oNvGroupSpPr->m_oCNvPr->m_sName));
odf_context()->drawing_context()->set_group_name(*oox_canvas->m_oNvGroupSpPr->m_oCNvPr->m_sName);
if (oox_canvas->m_oNvGroupSpPr->m_oCNvPr->m_oId.IsInit())
odf_context()->drawing_context()->set_group_z_order(oox_canvas->m_oNvGroupSpPr->m_oCNvPr->m_oId->GetValue());
}
@ -427,9 +427,9 @@ void OoxConverter::convert(OOX::Drawing::CFontCollection *style_font, CString *s
if (style_font == NULL) return;
_CP_OPT(std::wstring) font_latin, font_cs, font_ea;
if (style_font->m_oCs.m_oTypeFace.IsInit()) font_cs = string2std_string(style_font->m_oCs.m_oTypeFace->GetValue());
if (style_font->m_oEa.m_oTypeFace.IsInit()) font_ea = string2std_string(style_font->m_oEa.m_oTypeFace->GetValue());
if (style_font->m_oLatin.m_oTypeFace.IsInit()) font_latin = string2std_string(style_font->m_oLatin.m_oTypeFace->GetValue());
if (style_font->m_oCs.m_oTypeFace.IsInit()) font_cs = style_font->m_oCs.m_oTypeFace->GetValue();
if (style_font->m_oEa.m_oTypeFace.IsInit()) font_ea = style_font->m_oEa.m_oTypeFace->GetValue();
if (style_font->m_oLatin.m_oTypeFace.IsInit()) font_latin = style_font->m_oLatin.m_oTypeFace->GetValue();
odf_context()->drawing_context()->set_textarea_font(font_latin,font_ea,font_cs);
@ -595,7 +595,7 @@ void OoxConverter::convert(OOX::Drawing::CNonVisualDrawingProps * oox_cnvPr)
if (oox_cnvPr->m_sName.IsInit())
{
std::wstring name = string2std_string(oox_cnvPr->m_sName.get());
std::wstring name = oox_cnvPr->m_sName.get();
odf_context()->drawing_context()->set_name(name);
}
@ -684,7 +684,7 @@ void OoxConverter::convert(OOX::Drawing::CPresetGeometry2D *oox_prst_geom)
for (unsigned int i=0; i<oox_prst_geom->m_oAvLst->m_arrGd.size(); i++)
{
if (oox_prst_geom->m_oAvLst->m_arrGd[i] == NULL) continue;
odf_context()->drawing_context()->add_modifier(string2std_string(oox_prst_geom->m_oAvLst->m_arrGd[i]->m_oFmla.GetValue()));
odf_context()->drawing_context()->add_modifier(oox_prst_geom->m_oAvLst->m_arrGd[i]->m_oFmla.GetValue());
}
}
}
@ -798,7 +798,7 @@ void OoxConverter::convert(OOX::Drawing::CBlipFillProperties *oox_bitmap_fill, C
if (pathImage.GetLength() > 0)
{
odf_context()->drawing_context()->set_bitmap_link(string2std_string(pathImage));
odf_context()->drawing_context()->set_bitmap_link(pathImage);
_graphics_utils_::GetResolution(pathImage, Width, Height);
}
else
@ -1021,7 +1021,7 @@ void OoxConverter::convert(OOX::Drawing::Colors::CColorTransform *oox_Clr, s
SimpleTypes::CHexColor<SimpleTypes::hexcolorRGB> *oRgbColor = new SimpleTypes::CHexColor<SimpleTypes::hexcolorRGB>(ucR,ucG,ucB);
if (oRgbColor)
{
hexString = string2std_string(oRgbColor->ToString().Right(6));
hexString = oRgbColor->ToString().Right(6);
delete oRgbColor;
}
if (ucA !=255)opacity = (ucA/255.)* 100.;
@ -1076,7 +1076,7 @@ void OoxConverter::convert(OOX::Drawing::CSchemeColor *oox_ShemeClr, std::ws
SimpleTypes::CHexColor<SimpleTypes::hexcolorRGB> *oRgbColor = new SimpleTypes::CHexColor<SimpleTypes::hexcolorRGB>(ucR,ucG,ucB);
if (oRgbColor)
{
hexString = string2std_string(oRgbColor->ToString().Right(6));
hexString = oRgbColor->ToString().Right(6);
delete oRgbColor;
}
if (ucA !=255)opacity = (ucA/255.)* 100.;
@ -1170,7 +1170,7 @@ void OoxConverter::convert(OOX::Drawing::CTextBodyProperties *oox_bodyPr)
for (unsigned int i=0; i< oox_bodyPr->m_oPrstTxWrap->m_oAvLst->m_arrGd.size(); i++)
{
if (oox_bodyPr->m_oPrstTxWrap->m_oAvLst->m_arrGd[i] == NULL) continue;
odf_context()->drawing_context()->add_modifier(string2std_string(oox_bodyPr->m_oPrstTxWrap->m_oAvLst->m_arrGd[i]->m_oFmla.GetValue()));
odf_context()->drawing_context()->add_modifier(oox_bodyPr->m_oPrstTxWrap->m_oAvLst->m_arrGd[i]->m_oFmla.GetValue());
}
}
}
@ -1220,7 +1220,7 @@ void OoxConverter::convert(OOX::Drawing::CRunProperty * oox_run_pr, odf_writer::
if (oox_run_pr->m_oLatinFont.IsInit())
{
if (oox_run_pr->m_oLatinFont->m_oTypeFace.IsInit())
text_properties->content().fo_font_family_ = string2std_string(oox_run_pr->m_oLatinFont->m_oTypeFace->GetValue());
text_properties->content().fo_font_family_ = oox_run_pr->m_oLatinFont->m_oTypeFace->GetValue();
else
{
text_properties->content().fo_font_family_ = L"Calibri";//default_font; ????
@ -1229,7 +1229,7 @@ void OoxConverter::convert(OOX::Drawing::CRunProperty * oox_run_pr, odf_writer::
if (oox_run_pr->m_oAsianFont.IsInit())
{
if (oox_run_pr->m_oAsianFont->m_oTypeFace.IsInit())
text_properties->content().style_font_family_asian_ = string2std_string(oox_run_pr->m_oAsianFont->m_oTypeFace->GetValue());
text_properties->content().style_font_family_asian_ = oox_run_pr->m_oAsianFont->m_oTypeFace->GetValue();
else
{
}
@ -1237,7 +1237,7 @@ void OoxConverter::convert(OOX::Drawing::CRunProperty * oox_run_pr, odf_writer::
if (oox_run_pr->m_oComplexFont.IsInit())
{
if (oox_run_pr->m_oComplexFont->m_oTypeFace.IsInit())
text_properties->content().style_font_family_complex_ = string2std_string(oox_run_pr->m_oComplexFont->m_oTypeFace->GetValue());
text_properties->content().style_font_family_complex_ = oox_run_pr->m_oComplexFont->m_oTypeFace->GetValue();
else
{
}
@ -1252,9 +1252,9 @@ void OoxConverter::convert(OOX::Drawing::CRunProperty * oox_run_pr, odf_writer::
oox_language = oox_language.Left(res);
}
text_properties->content().fo_language_ = string2std_string(oox_language);
text_properties->content().fo_language_ = oox_language;
if (oox_country.GetLength() > 0)
text_properties->content().fo_country_ = string2std_string(oox_country);
text_properties->content().fo_country_ = oox_country;
}
if (oox_run_pr->m_oSpace.IsInit())
@ -1320,7 +1320,7 @@ void OoxConverter::convert(OOX::Drawing::CRun *oox_run)
odf_context()->text_context()->start_span(styled);
if (oox_run->m_oText.IsInit())
{
odf_context()->text_context()->add_text_content( string2std_string(oox_run->m_oText->m_sText));
odf_context()->text_context()->add_text_content( oox_run->m_oText->m_sText);
}
odf_context()->text_context()->end_span();
}

View File

@ -35,12 +35,7 @@
#include "../progressCallback.h"
#if defined(_WIN32) || defined (_WIN64)
#include <atlbase.h>
#include <atlstr.h>
#else
#include "../../../Common/DocxFormat/Source/Base/ASCString.h"
#endif
#include "../../../Common/DocxFormat/Source/Base/ASCString.h"
#include <vector>

View File

@ -455,7 +455,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_Bar3DChart *chart)
odf_context()->chart_context()->set_chart_bar_gap_width(*chart->m_gapWidth->m_val);
//if (chart->m_overlap && chart->m_overlap->m_val)
// odf_context()->chart_context()->set_chart_bar_overlap(string2std_string(*chart->m_overlap->m_val));
// odf_context()->chart_context()->set_chart_bar_overlap(*chart->m_overlap->m_val);
odf_context()->chart_context()->start_group_series();
convert(chart->m_dLbls);
@ -1043,7 +1043,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_SerTx* ser_tx)
convert(ser_tx->m_strRef->m_strCache, false, true);
}
//if (ser_tx->m_v)odf_context()->chart_context()->set_series_name(string2std_string(*ser_tx->m_v));
//if (ser_tx->m_v)odf_context()->chart_context()->set_series_name(*ser_tx->m_v);
}
void OoxConverter::convert(OOX::Spreadsheet::CT_AxDataSource* cat, int type)

View File

@ -472,7 +472,7 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
{
if (oox_paragraph->m_oParagraphProperty->m_oPStyle.IsInit() && oox_paragraph->m_oParagraphProperty->m_oPStyle->m_sVal.IsInit())
{
std::wstring style_name = string2std_string(*oox_paragraph->m_oParagraphProperty->m_oPStyle->m_sVal);
std::wstring style_name = *oox_paragraph->m_oParagraphProperty->m_oPStyle->m_sVal;
odf_writer::odf_style_state_ptr style_state;
if (odt_context->styles_context()->find_odf_style_state(style_name, odf_types::style_family::Paragraph, style_state) && style_state)
@ -786,10 +786,10 @@ void DocxConverter::convert(OOX::Logic::CSym *oox_sym)
if (oox_sym->m_oChar.IsInit() == false) return;
if (oox_sym->m_oFont.IsInit())
odt_context->text_context()->set_symbol_font(string2std_string(*oox_sym->m_oFont));
odt_context->text_context()->set_symbol_font(*oox_sym->m_oFont);
odt_context->text_context()->set_symbol_text(oox_sym->m_oChar->GetValue());
//odt_context->text_context()->add_text_content(std::wstring(L"/") + string2std_string(oox_sym->m_oChar->ToString()));
//odt_context->text_context()->add_text_content(std::wstring(L"/") + oox_sym->m_oChar->ToString());
}
void DocxConverter::convert(OOX::Logic::CFldChar *oox_fld)
{
@ -816,7 +816,7 @@ void DocxConverter::convert(OOX::Logic::CFldSimple *oox_fld)
odt_context->start_field(true);
{
if (oox_fld->m_sInstr.IsInit())
odt_context->set_field_instr(string2std_string(oox_fld->m_sInstr.get2()));
odt_context->set_field_instr(oox_fld->m_sInstr.get2());
for (unsigned int i=0; i< oox_fld->m_arrItems.size(); i++)
{
@ -829,7 +829,7 @@ void DocxConverter::convert(OOX::Logic::CInstrText *oox_instrText)
{
if (oox_instrText == NULL) return;
odt_context->set_field_instr(string2std_string(oox_instrText->m_sText));
odt_context->set_field_instr(oox_instrText->m_sText);
}
void DocxConverter::convert(OOX::Logic::CDelText *oox_delText)
@ -842,7 +842,7 @@ void DocxConverter::convert(OOX::Logic::CDelText *oox_delText)
{
}
}
odt_context->add_text_content(string2std_string(oox_delText->m_sText));
odt_context->add_text_content(oox_delText->m_sText);
}
void DocxConverter::convert(OOX::Logic::CIns *oox_ins)
{
@ -1034,7 +1034,7 @@ int DocxConverter::convert(OOX::Logic::CTblPrChange *oox_table_prop_change)
if (oox_table_prop_change->m_pTblPr->m_oTblStyle.IsInit() && oox_table_prop_change->m_pTblPr->m_oTblStyle->m_sVal.IsInit())
{//настройка предустановленного стиля
std::wstring base_style_name = string2std_string(*oox_table_prop_change->m_pTblPr->m_oTblStyle->m_sVal);
std::wstring base_style_name = *oox_table_prop_change->m_pTblPr->m_oTblStyle->m_sVal;
table_styled = odt_context->styles_context()->table_styles().start_table(base_style_name);
}
@ -1093,7 +1093,7 @@ void DocxConverter::convert(OOX::Logic::CParagraphProperty *oox_paragraph_pr, cp
if (oox_paragraph_pr->m_oPStyle.IsInit() && oox_paragraph_pr->m_oPStyle->m_sVal.IsInit())
{
std::wstring style_name = string2std_string(*oox_paragraph_pr->m_oPStyle->m_sVal);
std::wstring style_name = *oox_paragraph_pr->m_oPStyle->m_sVal;
odt_context->styles_context()->last_state()->set_parent_style_name(style_name);
/////////////////////////find parent properties
@ -2043,7 +2043,7 @@ void DocxConverter::convert(OOX::Logic::CRunProperty *oox_run_pr, odf_writer::st
if (oox_run_pr->m_oRStyle.IsInit() && oox_run_pr->m_oRStyle->m_sVal.IsInit())
{
odt_context->styles_context()->last_state()->set_parent_style_name(string2std_string(*oox_run_pr->m_oRStyle->m_sVal));
odt_context->styles_context()->last_state()->set_parent_style_name(*oox_run_pr->m_oRStyle->m_sVal);
}
if (oox_run_pr->m_oBold.IsInit())
{
@ -2157,15 +2157,15 @@ void DocxConverter::convert(OOX::Logic::CRunProperty *oox_run_pr, odf_writer::st
if (oox_run_pr->m_oRFonts.IsInit())
{
if (oox_run_pr->m_oRFonts->m_sAscii.IsInit())
text_properties->content().fo_font_family_ = string2std_string(oox_run_pr->m_oRFonts->m_sAscii.get());
text_properties->content().fo_font_family_ = oox_run_pr->m_oRFonts->m_sAscii.get();
else convert(oox_run_pr->m_oRFonts->m_oAsciiTheme.GetPointer(), text_properties->content().fo_font_family_);
if (oox_run_pr->m_oRFonts->m_sCs.IsInit())
text_properties->content().style_font_family_complex_ = string2std_string(oox_run_pr->m_oRFonts->m_sCs.get());
text_properties->content().style_font_family_complex_ = oox_run_pr->m_oRFonts->m_sCs.get();
else convert(oox_run_pr->m_oRFonts->m_oCsTheme.GetPointer(), text_properties->content().style_font_family_complex_);
if (oox_run_pr->m_oRFonts->m_sEastAsia.IsInit())
text_properties->content().style_font_family_asian_= string2std_string(oox_run_pr->m_oRFonts->m_sEastAsia.get());
text_properties->content().style_font_family_asian_= oox_run_pr->m_oRFonts->m_sEastAsia.get();
else convert(oox_run_pr->m_oRFonts->m_oEastAsiaTheme.GetPointer(), text_properties->content().style_font_family_asian_);
//nullable<CString > m_sHAnsi;
@ -2207,11 +2207,13 @@ void DocxConverter::convert(OOX::Logic::CRunProperty *oox_run_pr, odf_writer::st
BYTE ucG = oox_run_pr->m_oHighlight->m_oVal->Get_G();
SimpleTypes::CHexColor<> *oRgbColor = new SimpleTypes::CHexColor<>(ucR,ucG,ucB);
if (oRgbColor)
{
text_properties->content().fo_background_color_ = odf_types::color(std::wstring(L"#") + string2std_string(oRgbColor->ToString().Right(6)));
{
std::wstring strColor = L"#" + oRgbColor->ToString().Right(6);
text_properties->content().fo_background_color_ = odf_types::color(strColor);
delete oRgbColor;
}
}
if (oox_run_pr->m_oShd.IsInit())
{
_CP_OPT(odf_types::color) odf_color;
@ -2243,21 +2245,21 @@ void DocxConverter::convert(SimpleTypes::CTheme<>* oox_font_theme, _CP_OPT(std::
case SimpleTypes::themeMajorHAnsi :
if (docx_theme->m_oThemeElements.m_oFontScheme.m_oMajorFont.m_oLatin.m_oTypeFace.IsInit())
{
font = string2std_string(docx_theme->m_oThemeElements.m_oFontScheme.m_oMajorFont.m_oLatin.m_oTypeFace->GetValue());
font = docx_theme->m_oThemeElements.m_oFontScheme.m_oMajorFont.m_oLatin.m_oTypeFace->GetValue();
if (font.length() > 0) odf_font_name = font;
}
break;
case SimpleTypes::themeMajorBidi:
if (docx_theme->m_oThemeElements.m_oFontScheme.m_oMajorFont.m_oCs.m_oTypeFace.IsInit())
{
font = string2std_string(docx_theme->m_oThemeElements.m_oFontScheme.m_oMajorFont.m_oCs.m_oTypeFace->GetValue());
font = docx_theme->m_oThemeElements.m_oFontScheme.m_oMajorFont.m_oCs.m_oTypeFace->GetValue();
if (font.length() > 0) odf_font_name = font;
}
break;
case SimpleTypes::themeMajorEastAsia:
if (docx_theme->m_oThemeElements.m_oFontScheme.m_oMajorFont.m_oEa.m_oTypeFace.IsInit())
{
font = string2std_string(docx_theme->m_oThemeElements.m_oFontScheme.m_oMajorFont.m_oEa.m_oTypeFace->GetValue());
font = docx_theme->m_oThemeElements.m_oFontScheme.m_oMajorFont.m_oEa.m_oTypeFace->GetValue();
if (font.length() > 0) odf_font_name = font;
}
break;
@ -2265,21 +2267,21 @@ void DocxConverter::convert(SimpleTypes::CTheme<>* oox_font_theme, _CP_OPT(std::
case SimpleTypes::themeMinorHAnsi:
if (docx_theme->m_oThemeElements.m_oFontScheme.m_oMinorFont.m_oLatin.m_oTypeFace.IsInit())
{
font = string2std_string(docx_theme->m_oThemeElements.m_oFontScheme.m_oMinorFont.m_oLatin.m_oTypeFace->GetValue());
font = docx_theme->m_oThemeElements.m_oFontScheme.m_oMinorFont.m_oLatin.m_oTypeFace->GetValue();
if (font.length() > 0) odf_font_name = font;
}
break;
case SimpleTypes::themeMinorBidi:
if (docx_theme->m_oThemeElements.m_oFontScheme.m_oMinorFont.m_oCs.m_oTypeFace.IsInit())
{
font = string2std_string(docx_theme->m_oThemeElements.m_oFontScheme.m_oMinorFont.m_oCs.m_oTypeFace->GetValue());
font = docx_theme->m_oThemeElements.m_oFontScheme.m_oMinorFont.m_oCs.m_oTypeFace->GetValue();
if (font.length() > 0) odf_font_name = font;
}
break;
case SimpleTypes::themeMinorEastAsia:
if (docx_theme->m_oThemeElements.m_oFontScheme.m_oMinorFont.m_oEa.m_oTypeFace.IsInit())
{
font = string2std_string(docx_theme->m_oThemeElements.m_oFontScheme.m_oMinorFont.m_oEa.m_oTypeFace->GetValue());
font = docx_theme->m_oThemeElements.m_oFontScheme.m_oMinorFont.m_oEa.m_oTypeFace->GetValue();
if (font.length() > 0) odf_font_name = font;
}
break;
@ -2299,7 +2301,7 @@ void DocxConverter::convert(OOX::Logic::CText *oox_text)
}
//odt_context->text_context()->add_text_space(26);
}
odt_context->add_text_content(string2std_string(oox_text->m_sText));
odt_context->add_text_content(oox_text->m_sText);
}
void DocxConverter::convert(OOX::Logic::CAlternateContent *oox_alt_content)
{
@ -2778,7 +2780,7 @@ void DocxConverter::convert(OOX::Drawing::CPicture * oox_picture)
}
_graphics_utils_::GetResolution(pathImage, Width, Height);
}
odt_context->start_image(string2std_string(pathImage));
odt_context->start_image(pathImage);
{
if (oox_picture->m_oBlipFill.m_oTile.IsInit())
{
@ -2928,7 +2930,7 @@ void DocxConverter::convert(OOX::Logic::CGroupShape *oox_group_shape)
if (oox_group_shape->m_oCNvPr.IsInit())
{
if (oox_group_shape->m_oCNvPr->m_sName.IsInit())
odt_context->drawing_context()->set_group_name(string2std_string(*oox_group_shape->m_oCNvPr->m_sName));
odt_context->drawing_context()->set_group_name(*oox_group_shape->m_oCNvPr->m_sName);
if (oox_group_shape->m_oCNvPr->m_oId.IsInit())
odt_context->drawing_context()->set_group_z_order(oox_group_shape->m_oCNvPr->m_oId->GetValue());
}
@ -3104,8 +3106,10 @@ void DocxConverter::convert(SimpleTypes::CHexColor<> *color,
{
SimpleTypes::CHexColor<> *oRgbColor = new SimpleTypes::CHexColor<>(ucR,ucG,ucB);
if (oRgbColor)
{
odf_color = odf_types::color(std::wstring(L"#") + string2std_string(oRgbColor->ToString().Right(6)));
{
std::wstring strColor = L"#" + oRgbColor->ToString().Right(6);
odf_color = odf_types::color(strColor);
delete oRgbColor;
}
}
@ -3488,9 +3492,9 @@ void DocxConverter::convert(OOX::Numbering::CLvl* oox_num_lvl)
if (oox_num_lvl->m_oLvlText.IsInit() && oox_num_lvl->m_oLvlText->m_sVal.IsInit())
{
if (type_list == 2)
odt_context->styles_context()->lists_styles().set_bullet_char(string2std_string(oox_num_lvl->m_oLvlText->m_sVal.get()));
odt_context->styles_context()->lists_styles().set_bullet_char(oox_num_lvl->m_oLvlText->m_sVal.get());
else if (type_list == 1)
odt_context->styles_context()->lists_styles().set_numeric_format(string2std_string(oox_num_lvl->m_oLvlText->m_sVal.get()));
odt_context->styles_context()->lists_styles().set_numeric_format(oox_num_lvl->m_oLvlText->m_sVal.get());
}
if (oox_num_lvl->m_oLvlPicBulletId.IsInit() && oox_num_lvl->m_oLvlPicBulletId->m_oVal.IsInit())
{
@ -3532,7 +3536,7 @@ void DocxConverter::convert_table_style(OOX::CStyle *oox_style)
{
if (oox_style == NULL)return;
std::wstring oox_name = oox_style->m_sStyleId.IsInit() ? string2std_string(*oox_style->m_sStyleId) : L"";
std::wstring oox_name = oox_style->m_sStyleId.IsInit() ? *oox_style->m_sStyleId : L"";
odt_context->styles_context()->table_styles().start_style(oox_name);
//общие
@ -3648,13 +3652,13 @@ void DocxConverter::convert(OOX::CStyle *oox_style)
return;
}
std::wstring oox_name = oox_style->m_sStyleId.IsInit() ? string2std_string(*oox_style->m_sStyleId) : L"";
std::wstring oox_name = oox_style->m_sStyleId.IsInit() ? *oox_style->m_sStyleId : L"";
odt_context->styles_context()->create_style(oox_name,family, false, true, -1);
if (oox_style->m_oName.IsInit() && oox_style->m_oName->m_sVal.IsInit())
odt_context->styles_context()->last_state()->set_display_name(string2std_string(*oox_style->m_oName->m_sVal));
odt_context->styles_context()->last_state()->set_display_name(*oox_style->m_oName->m_sVal);
if (oox_style->m_oRunPr.IsInit())
{
@ -3708,7 +3712,7 @@ void DocxConverter::convert(OOX::CStyle *oox_style)
}
}
if (oox_style->m_oBasedOn.IsInit() && oox_style->m_oBasedOn->m_sVal.IsInit())
odt_context->styles_context()->last_state()->set_parent_style_name(string2std_string(*oox_style->m_oBasedOn->m_sVal));
odt_context->styles_context()->last_state()->set_parent_style_name(*oox_style->m_oBasedOn->m_sVal);
//nullable<ComplexTypes::Word::COnOff2<SimpleTypes::onoffTrue>> m_oQFormat;
//nullable<ComplexTypes::Word::CString_ > m_oAliases;
@ -3788,8 +3792,8 @@ void DocxConverter::convert_comment(int oox_comm_id)
{
odt_context->start_comment_content();
{
if (oox_comment->m_oAuthor.IsInit()) odt_context->comment_context()->set_author (string2std_string(*oox_comment->m_oAuthor));
if (oox_comment->m_oDate.IsInit()) odt_context->comment_context()->set_date (string2std_string(oox_comment->m_oDate->GetValue()));
if (oox_comment->m_oAuthor.IsInit()) odt_context->comment_context()->set_author (*oox_comment->m_oAuthor);
if (oox_comment->m_oDate.IsInit()) odt_context->comment_context()->set_date (oox_comment->m_oDate->GetValue());
if (oox_comment->m_oInitials.IsInit()) {}
for (unsigned int i = 0; i <oox_comment->m_arrItems.size(); i++)
@ -3895,7 +3899,7 @@ void DocxConverter::convert(OOX::Logic::CTbl *oox_table)
if (oox_table->m_oTableProperties && (oox_table->m_oTableProperties->m_oTblStyle.IsInit() && oox_table->m_oTableProperties->m_oTblStyle->m_sVal.IsInit()))
{//настройка предустановленного стиля
std::wstring base_style_name = string2std_string(*oox_table->m_oTableProperties->m_oTblStyle->m_sVal);
std::wstring base_style_name = *oox_table->m_oTableProperties->m_oTblStyle->m_sVal;
styled_table = odt_context->styles_context()->table_styles().start_table(base_style_name);
}

View File

@ -181,7 +181,7 @@ void XlsxConverter::convert_sheets()
if(pSheet->m_oRid.IsInit())
{
CString sSheetRId = pSheet->m_oRid.get2().ToString();
std::map<std::wstring, OOX::Spreadsheet::CWorksheet*>::iterator pItWorksheet = arrWorksheets.find(string2std_string(sSheetRId));
std::map<std::wstring, OOX::Spreadsheet::CWorksheet*>::iterator pItWorksheet = arrWorksheets.find(sSheetRId);
if (pItWorksheet->second)
{
@ -656,7 +656,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CRPr *oox_run_pr)
if (oox_run_pr->m_oRFont.IsInit())
{
//text_properties->content().style_font_name_ = string2std_string(oox_run_pr->m_oRFont->m_sVal.get());
//text_properties->content().style_font_name_ = oox_run_pr->m_oRFont->m_sVal.get();
text_properties->content().fo_font_family_ = oox_run_pr->m_oRFont->m_sVal.get();
}
@ -1795,7 +1795,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CGroupShape* oox_group_shape)
if (oox_group_shape->m_oNvGroupSpPr->m_oCNvPr.IsInit())
{
if (oox_group_shape->m_oNvGroupSpPr->m_oCNvPr->m_sName.IsInit())
ods_context->drawing_context()->set_group_name(string2std_string(*oox_group_shape->m_oNvGroupSpPr->m_oCNvPr->m_sName));
ods_context->drawing_context()->set_group_name(*oox_group_shape->m_oNvGroupSpPr->m_oCNvPr->m_sName);
if (oox_group_shape->m_oNvGroupSpPr->m_oCNvPr->m_oId.IsInit())
ods_context->drawing_context()->set_group_z_order(oox_group_shape->m_oNvGroupSpPr->m_oCNvPr->m_oId->GetValue());
}
@ -2024,7 +2024,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CPic* oox_picture)
}
_graphics_utils_::GetResolution(pathImage, Width, Height);
}
ods_context->start_image(string2std_string(pathImage));
ods_context->start_image(pathImage);
{
if (oox_picture->m_oBlipFill->m_oTile.IsInit())
{
@ -2077,7 +2077,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CConditionalFormatting *oox_cond_f
if (oox_cond_fmt->m_oSqRef.IsInit())
{
ods_context->current_table().start_conditional_format(string2std_string(oox_cond_fmt->m_oSqRef->GetValue()));
ods_context->current_table().start_conditional_format(oox_cond_fmt->m_oSqRef->GetValue());
for (unsigned int i=0; i< oox_cond_fmt->m_arrItems.size(); i++)
convert(oox_cond_fmt->m_arrItems[i]);//rule
@ -2190,12 +2190,12 @@ void XlsxConverter::convert(OOX::Spreadsheet::CAutofilter *oox_filter)
std::wstring ref, sort_ref;
bool sort = false, caseSensitive = false;
if (oox_filter->m_oRef.IsInit())
ref = string2std_string(oox_filter->m_oRef->GetValue());
ref = oox_filter->m_oRef->GetValue();
if (oox_filter->m_oSortState.IsInit())
{
sort = true;
if (oox_filter->m_oSortState->m_oRef.IsInit())
sort_ref = string2std_string(oox_filter->m_oSortState->m_oRef->GetValue());
sort_ref = oox_filter->m_oSortState->m_oRef->GetValue();
if (oox_filter->m_oSortState->m_oCaseSensitive.IsInit() && oox_filter->m_oSortState->m_oCaseSensitive->GetValue()==1)
caseSensitive = true;
}

View File

@ -35,7 +35,7 @@
#include <vector>
#if defined(_WIN32) || defined(_WIN64)
#include <atlbase.h>
#include <windows.h>
#include <gdiplus.h>
#pragma comment(lib, "gdiplus.lib")
#endif

View File

@ -60,7 +60,7 @@ bool COfficePPTFile::OpenFile(std::wstring sFileName)
pStgFrom->open(false,false);
m_pReader = new CPPTFileReader(pStgFrom, std_string2string(m_strTempDirectory));
m_pReader = new CPPTFileReader(pStgFrom, m_strTempDirectory);
((CPPTFileReader*)m_pReader)->m_oDocumentInfo.m_strFileDirectory = GetDirectory(sFileName.c_str());
if (!((CPPTFileReader*)m_pReader)->IsPowerPoint())
@ -85,6 +85,7 @@ bool COfficePPTFile::CloseFile()
m_pReader = NULL;
return S_OK;
}
HRESULT COfficePPTFile::LoadFromFile(std::wstring sSrcFileName, std::wstring sDstPath)
{
if (m_strTempDirectory.length() < 1)
@ -102,7 +103,7 @@ HRESULT COfficePPTFile::LoadFromFile(std::wstring sSrcFileName, std::wstring sDs
if (!((CPPTFileReader*)m_pReader)->m_oDocumentInfo.m_arUsers.empty())
{
NSPresentationEditor::CPPTXWriter oPPTXWriter;
oPPTXWriter.m_strTempDirectory = std_string2string(sDstPath);
oPPTXWriter.m_strTempDirectory = sDstPath;
oPPTXWriter.CreateFile(((CPPTFileReader*)m_pReader)->m_oDocumentInfo.m_arUsers[0]);
@ -112,13 +113,7 @@ HRESULT COfficePPTFile::LoadFromFile(std::wstring sSrcFileName, std::wstring sDs
return S_OK;
}
HRESULT COfficePPTFile::GetAdditionalParam (CString sParamName, VARIANT* ParamValue)
{
if (NULL == ParamValue)
return S_FALSE;
return S_OK;
}
CString COfficePPTFile::GetDirectory(CString strFileName)
{

View File

@ -31,13 +31,7 @@
*/
#pragma once
#if defined(_WIN32) || defined (_WIN64)
#include <atlbase.h>
#include <atlstr.h>
#else
#include "../../../DesktopEditor/common/ASCVariant.h"
#include "../../../Common/DocxFormat/Source/Base/ASCString.h"
#endif
#include "../../../DesktopEditor/common/ASCVariant.h"
#include <vector>
@ -79,8 +73,6 @@ public:
HRESULT LoadFromFile(std::wstring sSrcFileName, std::wstring sDstPath);
HRESULT GetAdditionalParam (CString sParamName, VARIANT* ParamValue);
private:
bool OpenFile(std::wstring sFileName);

View File

@ -66,7 +66,7 @@ namespace NSPresentationEditor
<cp:revision>1</cp:revision>\
</cp:coreProperties>");
}
};
}
NSPresentationEditor::CPPTXWriter::CPPTXWriter()
@ -77,7 +77,7 @@ NSPresentationEditor::CPPTXWriter::CPPTXWriter()
m_pDocument = NULL;
m_pUserInfo = NULL;
m_pShapeWriter = new CShapeWriter();
m_pShapeWriter = new CShapeWriter();
}
NSPresentationEditor::CPPTXWriter::~CPPTXWriter()
@ -571,9 +571,8 @@ void NSPresentationEditor::CPPTXWriter::WriteThemes()
for (int i = 0 ; i < pTheme->m_arExtraColorScheme.size(); i++)
{
CString str;
str.Format(_T(" %d"), i + 1);
WriteColorScheme(oStringWriter, pTheme->m_sThemeName + string2std_string(str), pTheme->m_arExtraColorScheme[i], true); //extra
std::wstring str = L" " + std::to_wstring(i + 1);
WriteColorScheme(oStringWriter, pTheme->m_sThemeName + str, pTheme->m_arExtraColorScheme[i], true); //extra
}
oStringWriter.WriteString(std::wstring(L"</a:extraClrSchemeLst>"));
@ -941,4 +940,4 @@ void NSPresentationEditor::CPPTXWriter::WriteSlides()
CRelsGenerator::StartNotes((int)nIndexS, m_strTempDirectory, m_pDocument->m_arSlides[nIndexS]->m_strComment);
WriteSlide((int)nIndexS);
}
}
}

View File

@ -42,7 +42,7 @@ namespace NSPresentationEditor
private:
std::map<std::wstring, std::wstring> m_mapImages;
LONG m_lIndexNextImage;
long m_lIndexNextImage;
std::wstring m_strDstMedia;
public:
@ -81,29 +81,28 @@ namespace NSPresentationEditor
if (strExts == _T(".tmp")) strExts = _T(".png");
CString strImage = _T("");
strImage.Format(_T("image%d"), m_lIndexNextImage++);
std::wstring strImage = L"image" + std::to_wstring(m_lIndexNextImage++);
std::wstring strOutput = m_strDstMedia + string2std_string(strImage) + strExts;
strImage = _T("../media/") + strImage + std_string2string(strExts);
std::wstring strOutput = m_strDstMedia + strImage + strExts;
strImage = _T("../media/") + strImage + strExts;
// теперь нужно скопировать картинку
if (strOutput != strInput)
{
if (CDirectory::CopyFile(std_string2string(strInput), std_string2string(strOutput), NULL, NULL) == false)
if (CDirectory::CopyFile(strInput, strOutput) == false)
{
return L"";
}
}
m_mapImages[strInput] = string2std_string(strImage);
m_mapImages[strInput] = strImage;
return strImage;
}
AVSINLINE bool IsNeedDownload(const std::wstring& strFile)
{
int n1 = strFile.find(_T("www"));
int n2 = strFile.find(_T("http"));
int n3 = strFile.find(_T("ftp"));
int n1 = strFile.find(L"www");
int n2 = strFile.find(L"http");
int n3 = strFile.find(L"ftp");
if (((n1 >= 0) && (n1 < 10)) || ((n2 >= 0) && (n2 < 10)) || ((n3 >= 0) && (n3 < 10)))
return true;
@ -280,13 +279,13 @@ namespace NSPresentationEditor
}
m_mapHyperlinks[strHyperlink] = m_lNextRelsID;
CString strRid = _T("");
strRid.Format(_T("rId%d"), m_lNextRelsID++);
CString strRid;
strRid.Format(L"rId%d", m_lNextRelsID++);
std::wstring strRels = _T("<Relationship Id=\"") ;
std::wstring strRels = L"<Relationship Id=\"";
strRels += string2std_string(strRid) + _T("\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink\" Target=\"");
strRels += strHyperlink + _T("\"/>");
strRels += strRid + L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink\" Target=\"";
strRels += strHyperlink + L"\"/>";
m_oWriter.WriteString(strRels);
}
@ -304,17 +303,15 @@ namespace NSPresentationEditor
m_mapImages[strImage] = m_lNextRelsID;
CString strRid = _T("");
strRid.Format(_T("rId%d"), m_lNextRelsID++);
std::wstring strRels = _T("<Relationship Id=\"") ;
strRels += string2std_string(strRid) + _T("\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\" Target=\"");
strRels += strImage + _T("\"");
std::wstring strRid = L"rId" + std::to_wstring(m_lNextRelsID++);
std::wstring strRels = L"<Relationship Id=\"" + strRid + L"\"";
strRels += L" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\"";
strRels += L" Target=\"" + strImage + L"\"";
if (bExternal)
strRels += std::wstring(L" TargetMode=\"External\"");
strRels += std::wstring(L"/>");
strRels += L" TargetMode=\"External\"";
strRels += L"/>";
m_oWriter.WriteString(strRels);

View File

@ -40,13 +40,15 @@
#endif
void CStylesWriter::ConvertStyleLevel(NSPresentationEditor::CTextStyleLevel& oLevel, NSPresentationEditor::CMetricInfo& oMetricInfo,
NSPresentationEditor::CStringWriter& oWriter, const int& nLevel)
NSPresentationEditor::CStringWriter& oWriter, const int& nLevel)
{//дублирование CTextPFRun и CTextCFRun с ShapeWriter - todooo - вынести отдельно
CString str1;
if (nLevel == 9)
str1 = _T("<a:defPPr");
else
str1.Format(_T("<a:lvl%dpPr"), nLevel + 1);
{
str1 = L"<a:lvl" + std::to_wstring(nLevel + 1) + L"pPr";
}
oWriter.WriteString(str1);
@ -54,57 +56,53 @@ void CStylesWriter::ConvertStyleLevel(NSPresentationEditor::CTextStyleLevel& oLe
if (pPF->textDirection.is_init())
{
if (pPF->textDirection.get() == 1) oWriter.WriteString(std::wstring(L" rtl=\"1\""));
else oWriter.WriteString(std::wstring(L" rtl=\"0\""));
if (pPF->textDirection.get() == 1) oWriter.WriteString(L" rtl=\"1\"");
else oWriter.WriteString(L" rtl=\"0\"");
}
if (pPF->fontAlign.is_init())
{
CString strProp = GetFontAlign(pPF->fontAlign.get());
oWriter.WriteString(std::wstring(L" fontAlgn=\"") + string2std_string(strProp) + _T("\""));
std::wstring strProp = GetFontAlign(pPF->fontAlign.get());
oWriter.WriteString(L" fontAlgn=\"" + strProp + L"\"");
}
if (pPF->leftMargin.is_init())
{
CString strProp;
strProp.Format(_T(" marL=\"%d\""), pPF->leftMargin.get());
oWriter.WriteString(strProp);
std::wstring strProp = std::to_wstring(pPF->leftMargin.get());
oWriter.WriteString(L" marL=\"" + strProp + L"\"");
if (pPF->indent.is_init() == false)
pPF->indent = (LONG)0;
pPF->indent = (LONG)0;
}
if (pPF->indent.is_init())
{
CString strProp;
strProp.Format(_T(" indent=\"%d\""), pPF->indent.get());
oWriter.WriteString(strProp);
std::wstring strProp = std::to_wstring(pPF->indent.get());
oWriter.WriteString(L" indent=\"" + strProp + L"\"");
}
if (pPF->textAlignment.is_init())
{
CString strProp = GetTextAlign(pPF->textAlignment.get());
oWriter.WriteString(std::wstring(L" algn=\"") + string2std_string(strProp) + _T("\""));
std::wstring strProp = GetTextAlign(pPF->textAlignment.get());
oWriter.WriteString(L" algn=\"" + strProp + L"\"");
}
if (pPF->defaultTabSize.is_init())
{
CString strProp;
strProp.Format(_T(" defTabSz=\"%d\""), pPF->defaultTabSize.get());
oWriter.WriteString(strProp);
std::wstring strProp = std::to_wstring(pPF->defaultTabSize.get());
oWriter.WriteString(L" defTabSz=\"" + strProp + L"\"");
}
CString str2 = _T(">");
oWriter.WriteString(str2);
oWriter.WriteString(L">");
if (pPF->tabStops.size() > 0)
{
oWriter.WriteString(std::wstring(L"<a:tabLst>"));
oWriter.WriteString(L"<a:tabLst>");
for (int t = 0 ; t < pPF->tabStops.size(); t++)
{
CString strTabPos; strTabPos.Format(L"%d", pPF->tabStops[t].first) ;
oWriter.WriteString(std::wstring(L"<a:tab pos=\"") + string2std_string(strTabPos) + _T("\""));
std::wstring strTabPos = std::to_wstring(pPF->tabStops[t].first);
oWriter.WriteString(L"<a:tab pos=\"" + strTabPos + L"\"");
if (pPF->tabStops[t].second == 1) oWriter.WriteString(std::wstring(L" algn=\"ctr\"/>"));
else if (pPF->tabStops[t].second == 2) oWriter.WriteString(std::wstring(L" algn=\"r\"/>"));
else if (pPF->tabStops[t].second == 3) oWriter.WriteString(std::wstring(L" algn=\"dec\"/>"));
else oWriter.WriteString(std::wstring(L" algn=\"l\"/>"));
if (pPF->tabStops[t].second == 1) oWriter.WriteString(L" algn=\"ctr\"/>");
else if (pPF->tabStops[t].second == 2) oWriter.WriteString(L" algn=\"r\"/>");
else if (pPF->tabStops[t].second == 3) oWriter.WriteString(L" algn=\"dec\"/>");
else oWriter.WriteString(L" algn=\"l\"/>");
}
oWriter.WriteString(std::wstring(L"</a:tabLst>"));
oWriter.WriteString(L"</a:tabLst>");
}
if (pPF->hasBullet.is_init())
@ -113,112 +111,101 @@ void CStylesWriter::ConvertStyleLevel(NSPresentationEditor::CTextStyleLevel& oLe
{
if (pPF->bulletColor.is_init())
{
oWriter.WriteString(std::wstring(L"<a:buClr>"));
oWriter.WriteString(L"<a:buClr>");
oWriter.WriteString(NSPresentationEditor::CShapeWriter::ConvertColor(pPF->bulletColor.get(), 255));
oWriter.WriteString(std::wstring(L"</a:buClr>"));
oWriter.WriteString(L"</a:buClr>");
}
if (pPF->bulletSize.is_init())
{
if (pPF->bulletSize.get() > 24 && pPF->bulletSize.get() < 401)
{
CString str;
str.Format(_T("<a:buSzPct val=\"%d\"/>"), pPF->bulletSize.get() * 1000 );
oWriter.WriteString(str);
std::wstring strProp = std::to_wstring(pPF->bulletSize.get() * 1000 );
oWriter.WriteString(L"<a:buSzPct val=\"" + strProp + L"\"/>");
}
if (pPF->bulletSize.get() < 0 && pPF->bulletSize.get() > -4001)
{
CString str;
str.Format(_T("<a:buSzPts val=\"%d\"/>"), - pPF->bulletSize.get() );
oWriter.WriteString(str);
std::wstring strProp = std::to_wstring(- pPF->bulletSize.get() );
oWriter.WriteString(L"<a:buSzPts val=\"" + strProp + L"\"/>");
}
}
if (pPF->bulletFontProperties.is_init())
{
oWriter.WriteString(std::wstring(L"<a:buFont typeface=\"") + pPF->bulletFontProperties->strFontName + _T("\"/>"));
oWriter.WriteString(L"<a:buFont typeface=\"" + pPF->bulletFontProperties->strFontName + L"\"/>");
}
if (pPF->bulletChar.is_init())
{
wchar_t bu = pPF->bulletChar.get();
oWriter.WriteString(std::wstring(L"<a:buChar char=\""));
oWriter.WriteString(L"<a:buChar char=\"");
oWriter.WriteStringXML(std::wstring(&bu, 1));
oWriter.WriteString(std::wstring(L"\"/>"));
oWriter.WriteString(L"\"/>");
}
}
else
{
CString strB = _T("<a:buNone/>");
oWriter.WriteString(strB);
oWriter.WriteString(L"<a:buNone/>");
}
}
double dKoef1 = 3.52777778;
if (pPF->lineSpacing.is_init())
{
LONG val = pPF->lineSpacing.get();
LONG val = pPF->lineSpacing.get();
if (val > 0)
{
CString str = _T("");
str.Format(_T("<a:lnSpc><a:spcPts val=\"%d\"/></a:lnSpc>"), (int)(val * 0.125 * 100/*/ dKoef1*/));
oWriter.WriteString(str);
std::wstring str = std::to_wstring( (int)(val * 0.125 * 100/*/ dKoef1*/));
oWriter.WriteString(L"<a:lnSpc><a:spcPts val=\"" + str + L"\"/></a:lnSpc>");
}
else if (val < 0 && val > -13200)
{
CString str = _T("");
str.Format(_T("<a:lnSpc><a:spcPct val=\"%d\"/></a:lnSpc>"), -val * 1000);
oWriter.WriteString(str);
std::wstring str = std::to_wstring(-val * 1000);
oWriter.WriteString(L"<a:lnSpc><a:spcPct val=\"" + str + L"\"/></a:lnSpc>");
}
}
if (pPF->spaceAfter.is_init())
{
LONG val = pPF->spaceAfter.get();
LONG val = pPF->spaceAfter.get();
if (val > 0)
{
CString str = _T("");
str.Format(_T("<a:spcAft><a:spcPts val=\"%d\"/></a:spcAft>"), (int)(val * 0.125 * 100/*/ dKoef1*/));
oWriter.WriteString(str);
std::wstring str = std::to_wstring((int)(val * 0.125 * 100/*/ dKoef1*/));
oWriter.WriteString(L"<a:spcAft><a:spcPts val=\"" + str + L"\"/></a:spcAft>");
}
else if (val < 0 && val > -13200)
{
CString str = _T("");
str.Format(_T("<a:spcAft><a:spcPct val=\"%d\"/></a:spcAft>"), -val * 1000);
oWriter.WriteString(str);
std::wstring str = std::to_wstring(-val * 1000);
oWriter.WriteString(L"<a:spcAft><a:spcPct val=\"" + str + L"\"/></a:spcAft>");
}
}
if (pPF->spaceBefore.is_init())
{
LONG val = pPF->spaceBefore.get();
LONG val = pPF->spaceBefore.get();
if (val > 0)
{
CString str = _T("");
str.Format(_T("<a:spcBef><a:spcPts val=\"%d\"/></a:spcBef>"), (int)(val * 0.125 * 100/*/ dKoef1*/));
oWriter.WriteString(str);
std::wstring str = std::to_wstring((int)(val * 0.125 * 100/*/ dKoef1*/));
oWriter.WriteString(L"<a:spcBef><a:spcPts val=\"" + str + L"\"/></a:spcBef>");
}
else if (val < 0 && val > -13200)
{
CString str = _T("");
str.Format(_T("<a:spcBef><a:spcPct val=\"%d\"/></a:spcBef>"), -val * 1000);
oWriter.WriteString(str);
std::wstring str = std::to_wstring(-val * 1000);
oWriter.WriteString(L"<a:spcBef><a:spcPct val=\"" + str + L"\"/></a:spcBef>");
}
}
CString strCF1 = _T("<a:defRPr");
oWriter.WriteString(strCF1);
oWriter.WriteString(L"<a:defRPr");
NSPresentationEditor::CTextCFRun* pCF = &oLevel.m_oCFRun;
if (pCF->Size.is_init())
{
CString strProp = _T("");
strProp.Format(_T(" sz=\"%d\""), (int)(100 * pCF->Size.get()));
oWriter.WriteString(strProp);
std::wstring str = std::to_wstring((int)(100 * pCF->Size.get()));
oWriter.WriteString(L" sz=\"" + str + L"\"");
}
if (pCF->FontBold.is_init())
{
if (pCF->FontBold.get())
oWriter.WriteString(std::wstring(L" b=\"1\""));
oWriter.WriteString(L" b=\"1\"");
else
oWriter.WriteString(std::wstring(L" b=\"0\""));
oWriter.WriteString(L" b=\"0\"");
}
if (pCF->FontItalic.is_init())
{
@ -240,51 +227,46 @@ void CStylesWriter::ConvertStyleLevel(NSPresentationEditor::CTextStyleLevel& oLe
{
if (pCF->Color->m_lSchemeIndex != -1)
{
CString strProp = _T("<a:solidFill><a:schemeClr val=\"") + GetColorInScheme(pCF->Color->m_lSchemeIndex) + _T("\"/></a:solidFill>");
oWriter.WriteString(strProp);
oWriter.WriteString(L"<a:solidFill><a:schemeClr val=\"" + GetColorInScheme(pCF->Color->m_lSchemeIndex) + L"\"/></a:solidFill>");
}
else
{
CString strColor = _T("");
CString strColor;
strColor.Format(_T("%06x"), pCF->Color->GetLONG_RGB());
CString strProp = _T("<a:solidFill><a:srgbClr val=\"") + strColor + _T("\"/></a:solidFill>");
oWriter.WriteString(strProp);
oWriter.WriteString(L"<a:solidFill><a:srgbClr val=\"" + strColor + L"\"/></a:solidFill>");
}
}
if (pCF->Typeface.is_init())
{
if (0 == pCF->Typeface.get())
{
CString strProp = _T("<a:latin typeface=\"+mj-lt\"/>");
oWriter.WriteString(strProp);
oWriter.WriteString(L"<a:latin typeface=\"+mj-lt\"/>");
}
else
{
CString strProp = _T("<a:latin typeface=\"+mn-lt\"/>");
oWriter.WriteString(strProp);
oWriter.WriteString(L"<a:latin typeface=\"+mn-lt\"/>");
}
}
else if ((pCF->FontProperties.is_init()) && (!pCF->FontProperties->strFontName.empty()))
{
oWriter.WriteString(std::wstring(L"<a:latin typeface=\"") + pCF->FontProperties->strFontName + _T("\"/>"));
oWriter.WriteString(L"<a:latin typeface=\"" + pCF->FontProperties->strFontName + L"\"/>");
}
if (pCF->FontPropertiesEA.is_init())
{
oWriter.WriteString(std::wstring(L"<a:ea typeface=\"") + pCF->FontPropertiesEA->strFontName + _T("\"/>"));
oWriter.WriteString(L"<a:ea typeface=\"" + pCF->FontPropertiesEA->strFontName + L"\"/>");
}
if (pCF->FontPropertiesSym.is_init())
{
oWriter.WriteString(std::wstring(L"<a:sym typeface=\"") + pCF->FontPropertiesSym->strFontName + _T("\"/>"));
oWriter.WriteString(L"<a:sym typeface=\"" + pCF->FontPropertiesSym->strFontName + L"\"/>");
}
CString strCF2 = _T("</a:defRPr>");
oWriter.WriteString(strCF2);
oWriter.WriteString(L"</a:defRPr>");
CString str3 = _T("");
CString str3;
if (nLevel == 9)
str3 = _T("</a:defPPr>");
str3 = L"</a:defPPr>";
else
str3.Format(_T("</a:lvl%dpPr>"), nLevel + 1);
str3 = L"</a:lvl" + std::to_wstring(nLevel + 1) + L"pPr>";
oWriter.WriteString(str3);
}
@ -319,15 +301,14 @@ CString NSPresentationEditor::CShapeWriter::ConvertLine(CPen & pen)
{
NSPresentationEditor::CStringWriter line_writer;
CString strLine = _T("");
strLine.Format(_T("<a:ln w=\"%d\">"), (int)(pen.Size * 36000));
line_writer.WriteString(strLine);
std::wstring str = std::to_wstring( (int)(pen.Size * 36000));
line_writer.WriteString(L"<a:ln w=\"" + str + L"\">");
line_writer.WriteString(std::wstring(L"<a:solidFill>"));
line_writer.WriteString(L"<a:solidFill>");
line_writer.WriteString(ConvertColor(pen.Color, pen.Alpha));
line_writer.WriteString(std::wstring(L"</a:solidFill>"));
line_writer.WriteString(L"</a:solidFill>");
line_writer.WriteString(std::wstring(L"<a:round/><a:headEnd/><a:tailEnd/></a:ln>"));
line_writer.WriteString(L"<a:round/><a:headEnd/><a:tailEnd/></a:ln>");
return line_writer.GetData();
}
@ -339,25 +320,25 @@ CString NSPresentationEditor::CShapeWriter::ConvertBrush(CBrush & brush)
{
if (m_pImageElement)//фон для картинки с празрачностью
{
brush_writer.WriteString(std::wstring(L"<a:noFill/>"));
brush_writer.WriteString(L"<a:noFill/>");
}
else
{
CString strRid = m_pRels->WriteImage(brush.TexturePath);
std::wstring strRid = m_pRels->WriteImage(brush.TexturePath);
brush_writer.WriteString(std::wstring(L"<a:blipFill dpi=\"0\" rotWithShape=\"1\"><a:blip r:embed=\"") + string2std_string(strRid) + _T("\"/><a:srcRect/>"));
brush_writer.WriteString(L"<a:blipFill dpi=\"0\" rotWithShape=\"1\"><a:blip r:embed=\"" + strRid + L"\"/><a:srcRect/>");
if ( brush.TextureMode == c_BrushTextureModeTile)
brush_writer.WriteString(std::wstring(L"<a:tile/>"));
brush_writer.WriteString(L"<a:tile/>");
else
brush_writer.WriteString(std::wstring(L"<a:stretch><a:fillRect/></a:stretch>"));
brush_writer.WriteString(L"<a:stretch><a:fillRect/></a:stretch>");
brush_writer.WriteString(std::wstring(L"</a:blipFill>"));
brush_writer.WriteString(L"</a:blipFill>");
}
}
else if ( brush.Type == c_BrushTypeNoFill)
{
brush_writer.WriteString(std::wstring(L"<a:noFill/>"));
brush_writer.WriteString(L"<a:noFill/>");
}
else if ( brush.Type == c_BrushTypePathGradient1 ||
brush.Type == c_BrushTypePathGradient2 ||
@ -365,30 +346,30 @@ CString NSPresentationEditor::CShapeWriter::ConvertBrush(CBrush & brush)
brush.Type == c_BrushTypeHorizontal ||
brush.Type == c_BrushTypeVertical )
{
brush_writer.WriteString(std::wstring(L"<a:gradFill><a:gsLst>"));
brush_writer.WriteString(L"<a:gradFill><a:gsLst>");
if (brush.ColorsPosition.empty() == false)
{
for (int i = 0; i < brush.ColorsPosition.size(); i++)
{
CString strPos; strPos.Format(L"%d", (int)(brush.ColorsPosition[i].second * 1000));
std::wstring str = std::to_wstring( (int)(brush.ColorsPosition[i].second * 1000));
brush_writer.WriteString(std::wstring(L"<a:gs pos=\"") + string2std_string(strPos)+ L"\">");
brush_writer.WriteString(L"<a:gs pos=\"" + str + L"\">");
brush_writer.WriteString(ConvertColor(brush.ColorsPosition[i].first, 255));
brush_writer.WriteString(std::wstring(L"</a:gs>"));
brush_writer.WriteString(L"</a:gs>");
}
}
else
{
brush_writer.WriteString(std::wstring(L"<a:gs pos=\"0\">"));
brush_writer.WriteString(L"<a:gs pos=\"0\">");
brush_writer.WriteString(ConvertColor(brush.Color1, brush.Alpha1));
brush_writer.WriteString(std::wstring(L"</a:gs>"));
brush_writer.WriteString(L"</a:gs>");
brush_writer.WriteString(std::wstring(L"<a:gs pos=\"100000\">"));
brush_writer.WriteString(L"<a:gs pos=\"100000\">");
brush_writer.WriteString(ConvertColor(brush.Color2, brush.Alpha2));
brush_writer.WriteString(std::wstring(L"</a:gs>"));
brush_writer.WriteString(L"</a:gs>");
}
brush_writer.WriteString(std::wstring(L"</a:gsLst>"));
brush_writer.WriteString(std::wstring(L"<a:lin ang=\""));
brush_writer.WriteString(L"</a:gsLst>");
brush_writer.WriteString(L"<a:lin ang=\"");
{
if (brush.LinearAngle < -180) brush.LinearAngle += 180;
if (brush.LinearAngle > 180) brush.LinearAngle -= 180;
@ -397,22 +378,22 @@ CString NSPresentationEditor::CShapeWriter::ConvertBrush(CBrush & brush)
if (val < 0) val = 0;
if (val > 360) val -= 360;
CString str; str.Format(_T("%d"), val * 60000);
std::wstring str = std::to_wstring(val * 60000);
brush_writer.WriteString(str);
}
brush_writer.WriteString(std::wstring(L"\" scaled=\"1\"/>"));
brush_writer.WriteString(std::wstring(L"</a:gradFill>"));
brush_writer.WriteString(L"\" scaled=\"1\"/>");
brush_writer.WriteString(L"</a:gradFill>");
}
else if(brush.Type == c_BrushTypePattern)
{//типов нету в ппт - вместо них шаблон-картинка
brush_writer.WriteString(std::wstring(L"<a:pattFill prst=\"pct80\">"));
brush_writer.WriteString(std::wstring(L"<a:fgClr>"));
brush_writer.WriteString(L"<a:pattFill prst=\"pct80\">");
brush_writer.WriteString(L"<a:fgClr>");
brush_writer.WriteString(ConvertColor(brush.Color1, brush.Alpha1));
brush_writer.WriteString(std::wstring(L"</a:fgClr>"));
brush_writer.WriteString(std::wstring(L"<a:bgClr>"));
brush_writer.WriteString(L"</a:fgClr>");
brush_writer.WriteString(L"<a:bgClr>");
brush_writer.WriteString(ConvertColor(brush.Color2, brush.Alpha2));
brush_writer.WriteString(std::wstring(L"</a:bgClr>"));
brush_writer.WriteString(std::wstring(L"</a:pattFill>"));
brush_writer.WriteString(L"</a:bgClr>");
brush_writer.WriteString(L"</a:pattFill>");
}
else
{
@ -463,81 +444,80 @@ CString NSPresentationEditor::CShapeWriter::ConvertShadow(CShadow & shadow)
}
}
CString strDir = _T("");
CString strDist = _T("");
std::wstring strDir;
std::wstring strDist;
if (shadow.DistanceY != 0 && shadow.DistanceX != 0)
{
if (shadow.DistanceY < 0 && shadow.DistanceX < 0) dir /=2;
strDir.Format(_T(" dir=\"%d\""), (int)(dir * 60000));
strDist.Format(_T(" dist=\"%d\""), (int)(dist * 36000));
strDir = L" dir=\"" + std::to_wstring((int)(dir * 60000)) + L"\"";
strDist = L" dist=\"" + std::to_wstring((int)(dist * 36000)) + L"\"";
}
CString strSY = _T("");
std::wstring strSY;
if (shadow.ScaleYToY < 1 || shadow.ScaleYToY > 1)
{
if (shadow.ScaleYToX < 1)shadow.ScaleYToY = -shadow.ScaleYToY;
strSY.Format(_T(" sy=\"%d\""), (int)(shadow.ScaleYToY * 100000));
strSY = L" sy=\"" + std::to_wstring((int)(shadow.ScaleYToY * 100000)) + L"\"";
}
CString strSX = _T("");
std::wstring strSX;
if (shadow.ScaleYToX < 1 || shadow.ScaleYToX > 1)
{
//strSX.Format(_T(" sx=\"%d\""), (int)(shadow.ScaleYToX * 100000));
strSX.Format(_T(" kx=\"%d\""), (int)((shadow.ScaleYToX + 0.5) * 360000));
strSX = L" kx=\"" + std::to_wstring((int)((shadow.ScaleYToX + 0.5) * 360000)) + L"\"";
}
NSPresentationEditor::CStringWriter shadow_writer;
shadow_writer.WriteString(std::wstring(L"<a:effectLst>"));
shadow_writer.WriteString(L"<a:effectLst>");
if (!Preset.empty())
{
shadow_writer.WriteString(std::wstring(L"<a:prstShdw"));
shadow_writer.WriteString(std::wstring(L" prst=\"") + Preset + std::wstring(L"\""));
shadow_writer.WriteString(L"<a:prstShdw");
shadow_writer.WriteString(L" prst=\"" + Preset + L"\"");
//shadow_writer.WriteString(std::wstring(L" rotWithShape=\"0\" algn=\"ctr\""));
shadow_writer.WriteString(strDir);
shadow_writer.WriteString(strDist);
shadow_writer.WriteString(std::wstring(L">"));
shadow_writer.WriteString(L">");
shadow_writer.WriteString(ConvertColor(shadow.Color,shadow.Alpha));
shadow_writer.WriteString(std::wstring(L"</a:prstShdw>"));
shadow_writer.WriteString(L"</a:prstShdw>");
}
else if (Inner)
{
shadow_writer.WriteString(std::wstring(L"<a:innerShdw"));
shadow_writer.WriteString(std::wstring(L" rotWithShape=\"0\""));
if (strSX.IsEmpty() && strSY.IsEmpty())
shadow_writer.WriteString(L"<a:innerShdw");
shadow_writer.WriteString(L" rotWithShape=\"0\"");
if (strSX.empty() && strSY.empty())
{
shadow_writer.WriteString(std::wstring(L" algn=\"ctr\""));
shadow_writer.WriteString(L" algn=\"ctr\"");
}
shadow_writer.WriteString(strSX);
shadow_writer.WriteString(strSY);
shadow_writer.WriteString(strDir);
shadow_writer.WriteString(strDist);
shadow_writer.WriteString(std::wstring(L">"));
shadow_writer.WriteString(L">");
shadow_writer.WriteString(ConvertColor(shadow.Color,shadow.Alpha));
shadow_writer.WriteString(std::wstring(L"</a:innerShdw>"));
shadow_writer.WriteString(L"</a:innerShdw>");
}
else
{
shadow_writer.WriteString(std::wstring(L"<a:outerShdw"));
shadow_writer.WriteString(std::wstring(L" rotWithShape=\"0\""));
if (strSX.IsEmpty() && strSY.IsEmpty())
shadow_writer.WriteString(L"<a:outerShdw");
shadow_writer.WriteString(L" rotWithShape=\"0\"");
if (strSX.empty() && strSY.empty())
{
shadow_writer.WriteString(std::wstring(L" algn=\"ctr\""));
shadow_writer.WriteString(L" algn=\"ctr\"");
}
shadow_writer.WriteString(strSX);
shadow_writer.WriteString(strSY);
shadow_writer.WriteString(strDir);
shadow_writer.WriteString(strDist);
shadow_writer.WriteString(std::wstring(L">"));
shadow_writer.WriteString(L">");
shadow_writer.WriteString(ConvertColor(shadow.Color,shadow.Alpha));
shadow_writer.WriteString(std::wstring(L"</a:outerShdw>"));
shadow_writer.WriteString(L"</a:outerShdw>");
}
shadow_writer.WriteString(std::wstring(L"</a:effectLst>"));
shadow_writer.WriteString(L"</a:effectLst>");
return shadow_writer.GetData();
}
@ -548,14 +528,14 @@ CString NSPresentationEditor::CShapeWriter::ConvertColor(CColor & color, long a
{
if (255 == alpha)
{
CString str = _T("");
str.Format(_T("<a:srgbClr val=\"%06X\"/>"), color.GetLONG_RGB());
CString str;
str.Format(L"<a:srgbClr val=\"%06X\"/>", color.GetLONG_RGB());
color_writer.WriteString(str);
}
else
{
CString str = _T("");
str.Format(_T("<a:srgbClr val=\"%06X\"><a:alpha val=\"%d\"/></a:srgbClr>"), color.GetLONG_RGB(), (int)(alpha * 100000 / 255));
CString str;
str.Format(L"<a:srgbClr val=\"%06X\"><a:alpha val=\"%d\"/></a:srgbClr>", color.GetLONG_RGB(), (int)(alpha * 100000 / 255));
color_writer.WriteString(str);
}
}
@ -563,16 +543,12 @@ CString NSPresentationEditor::CShapeWriter::ConvertColor(CColor & color, long a
{
if (255 == alpha)
{
CString str = _T("<a:schemeClr val=\"") + CStylesWriter::GetColorInScheme(color.m_lSchemeIndex) + _T("\"/>");
color_writer.WriteString(str);
color_writer.WriteString(L"<a:schemeClr val=\"" + CStylesWriter::GetColorInScheme(color.m_lSchemeIndex) + L"\"/>");
}
else
{
CString strAlpha; strAlpha.Format(_T("%d"), (int)(alpha * 100000 / 255));
CString str = _T("<a:schemeClr val=\"") + CStylesWriter::GetColorInScheme(color.m_lSchemeIndex) + _T("\"><a:alpha val=\"") + strAlpha + _T("\"/></a:schemeClr>");
color_writer.WriteString(str);
std::wstring strAlpha = std::to_wstring((int)(alpha * 100000 / 255));
color_writer.WriteString(L"<a:schemeClr val=\"" + CStylesWriter::GetColorInScheme(color.m_lSchemeIndex) + L"\"><a:alpha val=\"" + strAlpha + L"\"/></a:schemeClr>");
}
}
return color_writer.GetData();
@ -581,12 +557,12 @@ void NSPresentationEditor::CShapeWriter::WriteImageInfo()
{
m_oWriter.WriteString(std::wstring(L"<p:nvPicPr>"));
CString strShapeID;
strShapeID.Format(_T("%d"), m_lNextShapeID);
std::wstring strShapeID = std::to_wstring(m_lNextShapeID);
m_oWriter.WriteString(std::wstring(L"<p:cNvPr id=\"") +string2std_string(strShapeID) + L"\"" );
m_oWriter.WriteString(std::wstring(L"<p:cNvPr id=\"") + strShapeID + L"\"" );
if (m_pImageElement->m_sName.empty()) m_pImageElement->m_sName = std::wstring(L"Image ") + string2std_string(strShapeID);
if (m_pImageElement->m_sName.empty())
m_pImageElement->m_sName = std::wstring(L"Image ") + strShapeID;
if (m_pImageElement->m_bHidden) m_oWriter.WriteString(std::wstring(L" hidden=\"1\""));
@ -609,12 +585,12 @@ void NSPresentationEditor::CShapeWriter::WriteImageInfo()
{
m_oWriter.WriteString(std::wstring(L"<p:nvPr><p:ph"));
if (m_pImageElement->m_lPlaceholderType > 0)
m_oWriter.WriteString(std::wstring(L" type=\"") + GetPhType(m_pImageElement->m_lPlaceholderType) +_T("\""));
m_oWriter.WriteString(std::wstring(L" type=\"") + GetPhType(m_pImageElement->m_lPlaceholderType) + L"\"");
if (-1 != m_pImageElement->m_lPlaceholderID)
{
CString strIdx; strIdx.Format(_T("%d"), m_pImageElement->m_lPlaceholderID );
m_oWriter.WriteString(std::wstring(L" idx=\"") + string2std_string(strIdx) + _T("\""));
std::wstring strIdx = std::to_wstring(m_pImageElement->m_lPlaceholderID );
m_oWriter.WriteString(std::wstring(L" idx=\"") + strIdx + L"\"");
}
m_oWriter.WriteString(std::wstring(L"/></p:nvPr>"));
@ -632,16 +608,14 @@ void NSPresentationEditor::CShapeWriter::WriteShapeInfo()
{
m_oWriter.WriteString(std::wstring(L"<p:nvSpPr>"));
CString strShapeID = _T("");
if (m_pShapeElement->m_lID < 0)
m_pShapeElement->m_lID = m_lNextShapeID;
strShapeID.Format(L"%d", m_pShapeElement->m_lID);
std::wstring strShapeID = std::to_wstring(m_pShapeElement->m_lID);
m_oWriter.WriteString(std::wstring(L"<p:cNvPr id=\"") + string2std_string(strShapeID) + L"\"");
m_oWriter.WriteString(std::wstring(L"<p:cNvPr id=\"") + strShapeID + L"\"");
if (m_pShapeElement->m_sName.empty()) m_pShapeElement->m_sName = std::wstring(L"Shape ") + string2std_string(strShapeID);
if (m_pShapeElement->m_sName.empty()) m_pShapeElement->m_sName = std::wstring(L"Shape ") + strShapeID;
if (m_pShapeElement->m_bHidden) m_oWriter.WriteString(std::wstring(L" hidden=\"1\""));
@ -684,8 +658,8 @@ void NSPresentationEditor::CShapeWriter::WriteShapeInfo()
if ( m_pShapeElement->m_lPlaceholderID != -1)
{
CString strIdx; strIdx.Format(_T("%d"), m_pShapeElement->m_lPlaceholderID );
m_oWriter.WriteString(std::wstring(L" idx=\"") + string2std_string(strIdx) + _T("\""));
std::wstring strIdx = std::to_wstring( m_pShapeElement->m_lPlaceholderID );
m_oWriter.WriteString(std::wstring(L" idx=\"") + strIdx + L"\"");
}
if (m_pShapeElement->m_lPlaceholderSizePreset > 1 && !isTitlePlaceholder(m_pShapeElement->m_lPlaceholderType))
@ -732,25 +706,24 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
// m_oWriter.WriteString(std::wstring(L" lIns=\"0\" tIns=\"0\" rIns=\"0\" bIns=\"0\""));
if (m_pShapeElement->m_oShape.m_oText.m_oAttributes.m_nTextAlignVertical == 0 )
m_oWriter.WriteString(" anchor=\"t\"");
m_oWriter.WriteString(L" anchor=\"t\"");
else if (m_pShapeElement->m_oShape.m_oText.m_oAttributes.m_nTextAlignVertical == 2 )
m_oWriter.WriteString(" anchor=\"b\"");
m_oWriter.WriteString(L" anchor=\"b\"");
else if (m_pShapeElement->m_oShape.m_oText.m_oAttributes.m_nTextAlignVertical == 1 )
{
m_oWriter.WriteString(" anchor=\"ctr\"");
m_oWriter.WriteString(" anchorCtr=\"0\"");
m_oWriter.WriteString(L" anchor=\"ctr\"");
m_oWriter.WriteString(L" anchorCtr=\"0\"");
}
if (m_pShapeElement->m_oShape.m_oText.m_oAttributes.m_dTextRotate > 0)
{
CString strProp;
strProp.Format(_T(" rot=\"%d\""), (int)(m_pShapeElement->m_oShape.m_oText.m_oAttributes.m_dTextRotate * 60000));
m_oWriter.WriteString(strProp);
std::wstring strProp = std::to_wstring((int)(m_pShapeElement->m_oShape.m_oText.m_oAttributes.m_dTextRotate * 60000));
m_oWriter.WriteString(L" rot=\"" + strProp + L"\"");
}
if (m_pShapeElement->m_oShape.m_oText.m_bVertical)
{
m_oWriter.WriteString(" vert=\"eaVert\"");
m_oWriter.WriteString(L" vert=\"eaVert\"");
}
m_oWriter.WriteString(std::wstring(L">"));
m_oWriter.WriteString(L">");
if (m_bWordArt)
{
@ -769,29 +742,30 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
case oox::msosptTextFadeUp:
{
double kf = 4.63; //"волшебный"
strVal.Format(L"%d", (int)(kf * pPPTShape->m_arAdjustments[i]));
m_oWriter.WriteString(std::wstring(L"<a:gd name=\"adj\" fmla=\"val "));
m_oWriter.WriteString(strVal + _T("\"/>"));
std::wstring strVal = std::to_wstring((int)(kf * pPPTShape->m_arAdjustments[i]));
m_oWriter.WriteString(L"<a:gd name=\"adj\" fmla=\"val ");
m_oWriter.WriteString(strVal + L"\"/>");
}break;
}
}
m_oWriter.WriteString(std::wstring(L"</a:avLst>"));
m_oWriter.WriteString(std::wstring(L"</a:prstTxWarp>"));
m_oWriter.WriteString(L"</a:avLst>");
m_oWriter.WriteString(L"</a:prstTxWarp>");
}
if (m_pShapeElement->m_oShape.m_oText.m_bAutoFit)
{
m_oWriter.WriteString(std::wstring(L"<a:spAutoFit/>"));
m_oWriter.WriteString(L"<a:spAutoFit/>");
}
m_oWriter.WriteString(std::wstring(L"</a:bodyPr>"));
m_oWriter.WriteString(L"</a:bodyPr>");
if (0 == nCount)
{
m_oWriter.WriteString(std::wstring(L"<a:lstStyle/><a:p><a:endParaRPr dirty=\"0\"/></a:p></p:txBody>"));
m_oWriter.WriteString(L"<a:lstStyle/><a:p><a:endParaRPr dirty=\"0\"/></a:p></p:txBody>");
return;
}
m_oWriter.WriteString(std::wstring(L"<a:lstStyle>"));
m_oWriter.WriteString(L"<a:lstStyle>");
if (!m_bWordArt)
{
@ -810,9 +784,8 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
// if (pParagraph->m_arSpans.size() == 1 && pParagraph->m_arSpans[0].m_strText.empty()) break;
//}
CString _str1 = _T("");
_str1.Format(_T("<a:p><a:pPr lvl=\"%d\""), pParagraph->m_lTextLevel);
m_oWriter.WriteString(_str1);
std::wstring _str1 = std::to_wstring(pParagraph->m_lTextLevel);
m_oWriter.WriteString(L"<a:p><a:pPr lvl=\"" + _str1 + L"\"");
NSPresentationEditor::CTextPFRun* pPF = &pParagraph->m_oPFRun;
@ -823,38 +796,34 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
}
if (pPF->fontAlign.is_init())
{
CString strProp = CStylesWriter::GetFontAlign(pPF->fontAlign.get());
m_oWriter.WriteString(std::wstring(L" fontAlgn=\"") + string2std_string(strProp) + _T("\""));
std::wstring strProp = CStylesWriter::GetFontAlign(pPF->fontAlign.get());
m_oWriter.WriteString(std::wstring(L" fontAlgn=\"") + strProp + L"\"");
}
if (pPF->leftMargin.is_init())
{
CString strProp;
strProp.Format(_T(" marL=\"%d\""), pPF->leftMargin.get());
m_oWriter.WriteString(strProp);
CString strProp = std::to_wstring( pPF->leftMargin.get() );
m_oWriter.WriteString(L" marL=\"" + strProp + L"\"");
if (pPF->indent.is_init() == false)
pPF->indent = (LONG)0;
}
if (pPF->indent.is_init())
{
int ind = pPF->indent.get();
CString strProp = _T("");
strProp.Format(_T(" indent=\"%d\""), pPF->indent.get());
m_oWriter.WriteString(strProp);
std::wstring strProp = std::to_wstring(pPF->indent.get());
m_oWriter.WriteString(L" indent=\"" + strProp + L"\"");
}
if (pPF->textAlignment.is_init())
{
CString strProp = CStylesWriter::GetTextAlign(pPF->textAlignment.get());
m_oWriter.WriteString(std::wstring(L" algn=\"") + string2std_string(strProp) + _T("\""));
m_oWriter.WriteString(L" algn=\"" + strProp + L"\"");
}
if (pPF->defaultTabSize.is_init())
{
CString strProp = _T("");
strProp.Format(_T(" defTabSz=\"%d\""), pPF->defaultTabSize.get());
m_oWriter.WriteString(strProp);
std::wstring strProp= std::to_wstring( pPF->defaultTabSize.get());
m_oWriter.WriteString(L" defTabSz=\"" + strProp + L"\"");
}
CString _str2 = _T(">");
m_oWriter.WriteString(_str2);
m_oWriter.WriteString(L">");
double dKoef1 = 3.52777778; // :-) чё это не понятно ...
if (pPF->lineSpacing.is_init())
@ -864,16 +833,13 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
//1 inch = 576 master unit -> 1 master unit = 0.125 pt
if (val > 0)//The absolute value specifies spacing in master units.
{
CString str = _T("");
str.Format(_T("<a:lnSpc><a:spcPts val=\"%d\"/></a:lnSpc>"), (int)(val* 0.125 * 100/*/ dKoef1*/));
m_oWriter.WriteString(str);
std::wstring strProp = std::to_wstring( (int)(val* 0.125 * 100/*/ dKoef1*/));
m_oWriter.WriteString(L"<a:lnSpc><a:spcPts val=\"" + strProp + L"\"/></a:lnSpc>");
}
else if (val < 0 && val > -13200)
{//0 to 13200, inclusive - The value specifies spacing as a percentage of the text line height.
CString str = _T("");
str.Format(_T("<a:lnSpc><a:spcPct val=\"%d\"/></a:lnSpc>"), -val * 1000);
m_oWriter.WriteString(str);
std::wstring strProp = std::to_wstring( -val * 1000);
m_oWriter.WriteString(L"<a:lnSpc><a:spcPct val=\"" + strProp + L"\"/></a:lnSpc>");
}
}
if (pPF->spaceAfter.is_init())
@ -881,15 +847,13 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
LONG val = pPF->spaceAfter.get();
if (val > 0)
{
CString str = _T("");
str.Format(_T("<a:spcAft><a:spcPts val=\"%d\"/></a:spcAft>"), (int)(val * 0.125 * 100/*/ dKoef1*/));
m_oWriter.WriteString(str);
std::wstring strProp = std::to_wstring((int)(val * 0.125 * 100/*/ dKoef1*/));
m_oWriter.WriteString(L"<a:spcAft><a:spcPts val=\"" + strProp + L"\"/></a:spcAft>");
}
else if (val < 0 && val > -13200)
{
CString str;
str.Format(_T("<a:spcAft><a:spcPct val=\"%d\"/></a:spcAft>"), -val * 1000);
m_oWriter.WriteString(str);
std::wstring strProp = std::to_wstring(-val * 1000);
m_oWriter.WriteString(L"<a:spcAft><a:spcPct val=\"" + strProp + L"\"/></a:spcAft>");
}
}
if (pPF->spaceBefore.is_init())
@ -897,15 +861,13 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
LONG val = pPF->spaceBefore.get();
if (val > 0)
{
CString str = _T("");
str.Format(_T("<a:spcBef><a:spcPts val=\"%d\"/></a:spcBef>"), (int)(val * 0.125 * 100/*/ dKoef1*/));
m_oWriter.WriteString(str);
std::wstring strProp = std::to_wstring((int)(val * 0.125 * 100/*/ dKoef1*/));
m_oWriter.WriteString(L"<a:spcBef><a:spcPts val=\"" + strProp + L"\"/></a:spcBef>");
}
else if (val < 0 && val > -13200)
{
CString str;
str.Format(_T("<a:spcBef><a:spcPct val=\"%d\"/></a:spcBef>"), -val * 1000);
m_oWriter.WriteString(str);
std::wstring strProp = std::to_wstring(-val * 1000);
m_oWriter.WriteString(L"<a:spcBef><a:spcPct val=\"" + strProp + L"\"/></a:spcBef>");
}
}
@ -923,15 +885,13 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
{
if (pPF->bulletSize.get() > 24 && pPF->bulletSize.get() < 401)
{
CString str;
str.Format(_T("<a:buSzPct val=\"%d\"/>"), pPF->bulletSize.get() * 1000 );
m_oWriter.WriteString(str);
std::wstring strProp = std::to_wstring(pPF->bulletSize.get() * 1000 );
m_oWriter.WriteString(L"<a:buSzPct val=\"" + strProp + L"\"/>");
}
if (pPF->bulletSize.get() < 0 && pPF->bulletSize.get() > -4001)
{
CString str;
str.Format(_T("<a:buSzPts val=\"%d\"/>"), - pPF->bulletSize.get() );
m_oWriter.WriteString(str);
std::wstring strProp = std::to_wstring(- pPF->bulletSize.get() );
m_oWriter.WriteString(L"<a:buSzPts val=\"" + strProp + L"\"/>");
}
}
if (pPF->bulletFontProperties.is_init())
@ -1198,8 +1158,8 @@ CString NSPresentationEditor::CShapeWriter::ConvertShape()
oInfo.m_bFlipH = m_pShapeElement->m_bFlipH;
oInfo.m_bFlipV = m_pShapeElement->m_bFlipV;
oInfo.m_lOriginalWidth = (LONG)m_pShapeElement->m_rcBoundsOriginal.GetWidth();
oInfo.m_lOriginalHeight = (LONG)m_pShapeElement->m_rcBoundsOriginal.GetHeight();
oInfo.m_lOriginalWidth = (LONG)m_pShapeElement->m_rcBoundsOriginal.GetWidth();
oInfo.m_lOriginalHeight = (LONG)m_pShapeElement->m_rcBoundsOriginal.GetHeight();
m_oWriter.WriteString(std::wstring(L"<p:spPr>"));
@ -1320,8 +1280,8 @@ CString NSPresentationEditor::CShapeWriter::ConvertImage()
oInfo.m_bFlipH = m_pImageElement->m_bFlipH;
oInfo.m_bFlipV = m_pImageElement->m_bFlipV;
oInfo.m_lOriginalWidth = (LONG)m_pImageElement->m_rcBoundsOriginal.GetWidth();
oInfo.m_lOriginalHeight = (LONG)m_pImageElement->m_rcBoundsOriginal.GetHeight();
oInfo.m_lOriginalWidth = (LONG)m_pImageElement->m_rcBoundsOriginal.GetWidth();
oInfo.m_lOriginalHeight = (LONG)m_pImageElement->m_rcBoundsOriginal.GetHeight();
m_oWriter.WriteString(std::wstring(L"<p:blipFill>"));
@ -1472,7 +1432,7 @@ HRESULT NSPresentationEditor::CShapeWriter::get_DpiY(double* dDpiY)
return S_OK;
}
// pen --------------------------------------------------------------------------------------
HRESULT NSPresentationEditor::CShapeWriter::SetPen(BSTR bsXML)
HRESULT NSPresentationEditor::CShapeWriter::SetPen(std::wstring bsXML)
{
//m_oPen.FromXmlString((CString)bsXML);
return S_OK;
@ -1590,7 +1550,7 @@ HRESULT NSPresentationEditor::CShapeWriter::PenDashPattern(double* pPattern, LON
return S_OK;
}
// brush ------------------------------------------------------------------------------------
HRESULT NSPresentationEditor::CShapeWriter::SetBrush(BSTR bsXML)
HRESULT NSPresentationEditor::CShapeWriter::SetBrush(std::wstring bsXML)
{
//m_oBrush.FromXmlString((CString)bsXML);
return S_OK;
@ -1710,7 +1670,7 @@ HRESULT NSPresentationEditor::CShapeWriter::put_BrushGradientColors(LONG* lColor
return S_OK;
}
// font -------------------------------------------------------------------------------------
HRESULT NSPresentationEditor::CShapeWriter::SetFont(BSTR bsXML)
HRESULT NSPresentationEditor::CShapeWriter::SetFont(std::wstring bsXML)
{
//m_oFont.FromXmlString((CString)bsXML);
return S_OK;
@ -1734,7 +1694,7 @@ HRESULT NSPresentationEditor::CShapeWriter::get_FontPath(std::wstring* bsName)
}
HRESULT NSPresentationEditor::CShapeWriter::put_FontPath(const std::wstring& bsName)
{
m_oFont.Path = std_string2string(bsName);
m_oFont.Path = bsName;
return S_OK;
}
HRESULT NSPresentationEditor::CShapeWriter::get_FontSize(double* dSize)
@ -1787,7 +1747,7 @@ HRESULT NSPresentationEditor::CShapeWriter::put_FontFaceIndex(const int& lFaceIn
return S_OK;
}
// shadow -----------------------------------------------------------------------------------
HRESULT NSPresentationEditor::CShapeWriter::SetShadow(BSTR bsXML)
HRESULT NSPresentationEditor::CShapeWriter::SetShadow(std::wstring bsXML)
{
//m_oShadow.FromXmlString((CString)bsXML);
return S_OK;
@ -1853,7 +1813,7 @@ HRESULT NSPresentationEditor::CShapeWriter::put_ShadowVisible(bool val)
return S_OK;
}
// edge -------------------------------------------------------------------------------------
HRESULT NSPresentationEditor::CShapeWriter::SetEdgeText(BSTR bsXML)
HRESULT NSPresentationEditor::CShapeWriter::SetEdgeText(std::wstring bsXML)
{
//m_oEdge.FromXmlString((CString)bsXML);
return S_OK;
@ -2213,13 +2173,4 @@ HRESULT NSPresentationEditor::CShapeWriter::put_ClipMode(const LONG& lMode)
m_lClipMode = lMode;
return S_OK;
}
// additiaonal params ----------------------------------------------------------------------
HRESULT NSPresentationEditor::CShapeWriter::SetAdditionalParam(BSTR ParamName, VARIANT ParamValue)
{
return S_OK;
}
HRESULT NSPresentationEditor::CShapeWriter::GetAdditionalParam(BSTR ParamName, VARIANT* ParamValue)
{
return S_OK;
}
// --------------------------------------------------------------------------------------------

Some files were not shown because too many files have changed in this diff Show More