Commit 5b48a7a3 authored by ElenaSubbotina's avatar ElenaSubbotina

DocFormat - fix users file, add data form field

parent 1496aece
...@@ -88,7 +88,7 @@ namespace DocFileFormat ...@@ -88,7 +88,7 @@ namespace DocFileFormat
int DocumentMapping::getCurrentSection(int cp) int DocumentMapping::getCurrentSection(int cp)
{ {
//if cp is the last char of a section, the next section will start at cp +1 //if cp is the last char of a section, the next section will start at cp +1
size_t current = 0; int current = 0;
for (std::vector<int>::iterator iter = m_document->SectionPlex->CharacterPositions.begin() + 1; iter != m_document->SectionPlex->CharacterPositions.end(); ++iter) for (std::vector<int>::iterator iter = m_document->SectionPlex->CharacterPositions.begin() + 1; iter != m_document->SectionPlex->CharacterPositions.end(); ++iter)
{ {
...@@ -107,7 +107,7 @@ namespace DocFileFormat ...@@ -107,7 +107,7 @@ namespace DocFileFormat
{ {
if ( !m_document->ListPlex ) return -1; if ( !m_document->ListPlex ) return -1;
for (size_t i = 1; i < m_document->ListPlex->CharacterPositions.size(); i++) 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])) if ((fc >= m_document->ListPlex->CharacterPositions[i-1]) && (fc_end <= m_document->ListPlex->CharacterPositions[i]))
{ {
...@@ -382,7 +382,7 @@ namespace DocFileFormat ...@@ -382,7 +382,7 @@ namespace DocFileFormat
int DocumentMapping::writeRun (std::vector<wchar_t>* chars, CharacterPropertyExceptions* chpx, int initialCp) int DocumentMapping::writeRun (std::vector<wchar_t>* chars, CharacterPropertyExceptions* chpx, int initialCp)
{ {
int cp = initialCp; int cp = initialCp;
int result_cp = cp + (int)chars->size(); int result_cp = cp + chars->size();
if ((_skipRuns <= 0) && (chars->size() > 0)) if ((_skipRuns <= 0) && (chars->size() > 0))
{ {
...@@ -559,12 +559,12 @@ namespace DocFileFormat ...@@ -559,12 +559,12 @@ namespace DocFileFormat
m_pXmlWriter->WriteString(elem.GetXMLString()); m_pXmlWriter->WriteString(elem.GetXMLString());
} }
else if (TextMark::FieldBeginMark == code) else if (TextMark::FieldBeginMark == code)
{ {//todooo в отдельный mapping
int cpFieldStart = initialCp + i; int cpFieldStart = initialCp + i;
int cpFieldEnd = searchNextTextMark( m_document->Text, cpFieldStart, TextMark::FieldEndMark ); int cpFieldEnd = searchNextTextMark( m_document->Text, cpFieldStart, TextMark::FieldEndMark );
std::wstring f; std::wstring f;
if (cpFieldEnd < (int)m_document->Text->size()) if (cpFieldEnd < m_document->Text->size())
f = std::wstring( ( m_document->Text->begin() + cpFieldStart ), ( m_document->Text->begin() + cpFieldEnd + 1 ) ); f = std::wstring( ( m_document->Text->begin() + cpFieldStart ), ( m_document->Text->begin() + cpFieldEnd + 1 ) );
std::wstring EMBED ( L" EMBED" ); std::wstring EMBED ( L" EMBED" );
...@@ -599,20 +599,38 @@ namespace DocFileFormat ...@@ -599,20 +599,38 @@ namespace DocFileFormat
if ( bFORM ) if ( bFORM )
{ {
m_pXmlWriter->WriteNodeBegin( L"w:fldChar" , true ); std::wstring FORMTEXT ( L" FORMTEXT" );
std::wstring FORMCHECKBOX ( L" FORMCHECKBOX" );
std::wstring FORMDROPDOWN ( L" FORMDROPDOWN" );
m_pXmlWriter->WriteNodeBegin( L"w:fldChar" , true );
m_pXmlWriter->WriteAttribute( L"w:fldCharType" , L"begin" ); m_pXmlWriter->WriteAttribute( L"w:fldCharType" , L"begin" );
m_pXmlWriter->WriteNodeEnd( L"", true, false ); m_pXmlWriter->WriteNodeEnd( L"", true, false );
int cpPic = searchNextTextMark( m_document->Text, cpFieldStart, TextMark::Picture ); bool bFORMTEXT = search( f.begin(), f.end(), FORMTEXT.begin(), FORMTEXT.end()) != f.end();
bool bFORMCHECKBOX = search( f.begin(), f.end(), FORMCHECKBOX.begin(), FORMCHECKBOX.end()) != f.end();
bool bFORMDROPDOWN = search( f.begin(), f.end(), FORMDROPDOWN.begin(), FORMDROPDOWN.end()) != f.end();
/*if (cpPic < cpFieldEnd) if (bFORMTEXT || bFORMCHECKBOX || bFORMDROPDOWN)
{ {
int fcPic = _doc.PieceTable.FileCharacterPositions[cpPic]; int cpPic = searchNextTextMark( m_document->Text, cpFieldStart, TextMark::Picture );
CharacterPropertyExceptions chpxPic = _doc.GetCharacterPropertyExceptions(fcPic, fcPic + 1)[0]; if (cpPic < cpFieldEnd)
NilPicfAndBinData npbd = new NilPicfAndBinData(chpxPic, _doc.DataStream); {
FormFieldData ffdata = new FormFieldData(npbd.binData); int fcPic = m_document->FindFileCharPos( cpPic );
ffdata.Convert(new FormFieldDataMapping(m_pXmlWriter)); std::list<CharacterPropertyExceptions*>* chpxs = m_document->GetCharacterPropertyExceptions(fcPic, fcPic + 1);
}*/
if (chpxs)
{
CharacterPropertyExceptions* chpxSep = chpxs->front();
FormFieldData ffdata (2, chpxSep, m_document->DataStream, false);
FormFieldDataMapping data_mapping(m_pXmlWriter, m_context, _caller);
ffdata.Convert(&data_mapping);
RELEASEOBJECT( chpxs );
}
}
}
m_pXmlWriter->WriteNodeEnd( L"w:fldChar" ); m_pXmlWriter->WriteNodeEnd( L"w:fldChar" );
...@@ -660,11 +678,11 @@ namespace DocFileFormat ...@@ -660,11 +678,11 @@ namespace DocFileFormat
if (search( f1.begin(), f1.end(), PAGEREF.begin(), PAGEREF.end()) != f1.end()) if (search( f1.begin(), f1.end(), PAGEREF.begin(), PAGEREF.end()) != f1.end())
{ {
int d = (int)f1.find(PAGEREF); int d = f1.find(PAGEREF);
_writeWebHidden = true; _writeWebHidden = true;
std::wstring _writeTocLink =f1.substr(d + 9); std::wstring _writeTocLink =f1.substr(d + 9);
d = (int)_writeTocLink.find(L" "); d = _writeTocLink.find(L" ");
_writeTocLink = _writeTocLink.substr(0, d); _writeTocLink = _writeTocLink.substr(0, d);
_writeAfterRun = std::wstring (L"<w:hyperlink w:anchor = \""); _writeAfterRun = std::wstring (L"<w:hyperlink w:anchor = \"");
...@@ -1176,8 +1194,7 @@ namespace DocFileFormat ...@@ -1176,8 +1194,7 @@ namespace DocFileFormat
TableInfo tai( papx ); TableInfo tai( papx );
//build the table grid //build the table grid
std::vector<short> grid, grid_write; std::vector<short>* grid = buildTableGrid( cp, nestingLevel );
buildTableGrid( cp, nestingLevel, grid, grid_write );
//find first row end //find first row end
int fcRowEnd = findRowEndFc( cp, nestingLevel ); int fcRowEnd = findRowEndFc( cp, nestingLevel );
...@@ -1188,7 +1205,7 @@ namespace DocFileFormat ...@@ -1188,7 +1205,7 @@ namespace DocFileFormat
m_pXmlWriter->WriteNodeBegin( L"w:tbl" ); m_pXmlWriter->WriteNodeBegin( L"w:tbl" );
//Convert it //Convert it
TablePropertiesMapping *tpMapping = new TablePropertiesMapping( m_pXmlWriter, m_document->Styles, &grid, &grid_write ); TablePropertiesMapping *tpMapping = new TablePropertiesMapping( m_pXmlWriter, m_document->Styles, grid );
row1Tapx.Convert( tpMapping ); row1Tapx.Convert( tpMapping );
...@@ -1201,7 +1218,7 @@ namespace DocFileFormat ...@@ -1201,7 +1218,7 @@ namespace DocFileFormat
//only convert the cells with the given nesting level //only convert the cells with the given nesting level
while ( tai.iTap == nestingLevel ) while ( tai.iTap == nestingLevel )
{ {
cp = writeTableRow( cp, &grid, &grid_write, nestingLevel ); cp = writeTableRow( cp, grid, nestingLevel );
//?fc = m_document->FindFileCharPos(cp ); //?fc = m_document->FindFileCharPos(cp );
fc = m_document->m_PieceTable->FileCharacterPositions->operator []( cp ); fc = m_document->m_PieceTable->FileCharacterPositions->operator []( cp );
papx = findValidPapx( fc ); papx = findValidPapx( fc );
...@@ -1214,7 +1231,7 @@ namespace DocFileFormat ...@@ -1214,7 +1231,7 @@ namespace DocFileFormat
//convert until the end of table is reached //convert until the end of table is reached
while ( tai.fInTable ) while ( tai.fInTable )
{ {
cp = writeTableRow( cp, &grid, &grid_write, nestingLevel ); cp = writeTableRow( cp, grid, nestingLevel );
fc = m_document->FindFileCharPos( cp ); fc = m_document->FindFileCharPos( cp );
papx = findValidPapx( fc ); papx = findValidPapx( fc );
...@@ -1225,16 +1242,18 @@ namespace DocFileFormat ...@@ -1225,16 +1242,18 @@ namespace DocFileFormat
//close w:tbl //close w:tbl
m_pXmlWriter->WriteNodeEnd( L"w:tbl" ); m_pXmlWriter->WriteNodeEnd( L"w:tbl" );
RELEASEOBJECT( grid );
return cp; return cp;
} }
// Builds a list that contains the width of the several columns of the table. // Builds a list that contains the width of the several columns of the table.
bool DocumentMapping::buildTableGrid(int initialCp, unsigned int nestingLevel, std::vector<short>& grid, std::vector<short>& grid_write) std::vector<short>* DocumentMapping::buildTableGrid(int initialCp, unsigned int nestingLevel)
{ {
ParagraphPropertyExceptions* backup = _lastValidPapx; ParagraphPropertyExceptions* backup = _lastValidPapx;
std::vector<short> boundaries; std::vector<short> boundaries;
std::vector<short> boundaries_all; std::vector<short>* grid = new std::vector<short>();
int cp = initialCp; int cp = initialCp;
int fc = m_document->FindFileCharPos( cp ); int fc = m_document->FindFileCharPos( cp );
...@@ -1251,43 +1270,25 @@ namespace DocFileFormat ...@@ -1251,43 +1270,25 @@ namespace DocFileFormat
for ( std::list<SinglePropertyModifier>::iterator iter = papx->grpprl->begin(); iter != papx->grpprl->end(); iter++ ) for ( std::list<SinglePropertyModifier>::iterator iter = papx->grpprl->begin(); iter != papx->grpprl->end(); iter++ )
{ {
//find the tDef SPRM //find the tDef SPRM
DWORD code = iter->OpCode; if ( iter->OpCode == sprmTDefTable || iter->OpCode == sprmOldTDefTable)
switch(iter->OpCode)
{ {
case sprmTDefTable: unsigned char itcMac = iter->Arguments[0];
case sprmOldTDefTable:
{
unsigned char itcMac = iter->Arguments[0];
while(boundaries.size() < itcMac + 1) for (int i = 0; i < itcMac; i++)
boundaries.push_back(-0x7fff); {
short boundary1 = FormatUtils::BytesToInt16( iter->Arguments, 1 + ( i * 2 ), iter->argumentsSize );
short boundary0 = -0x7fff; if ( find( boundaries.begin(), boundaries.end(), boundary1 ) == boundaries.end() )
for (unsigned char i = 0; i < itcMac; i++)
{ {
short boundary1 = FormatUtils::BytesToInt16( iter->Arguments, 1 + ( i * 2 ), iter->argumentsSize ); boundaries.push_back( boundary1 );
short boundary2 = FormatUtils::BytesToInt16( iter->Arguments, 1 + ( ( i + 1 ) * 2 ), iter->argumentsSize ); }
if (boundary2 - boundary1 > 1 && boundary1 - boundary0 > 1) short boundary2 = FormatUtils::BytesToInt16( iter->Arguments, 1 + ( ( i + 1 ) * 2 ), iter->argumentsSize );
{
if ( boundaries[i] == -0x7fff || boundaries[i+1] == -0x7fff)
{
boundaries[i] = boundary1;
boundaries[i+1] = boundary2;
}
}
if ( find( boundaries_all.begin(), boundaries_all.end(), boundary1 ) == boundaries_all.end() )
{
boundaries_all.push_back( boundary1 );
}
if ( find( boundaries_all.begin(), boundaries_all.end(), boundary2 ) == boundaries_all.end() ) if ( find( boundaries.begin(), boundaries.end(), boundary2 ) == boundaries.end() )
{ {
boundaries_all.push_back( boundary2 ); boundaries.push_back( boundary2 );
} }
boundary0 = boundary1;
}break;
} }
} }
} }
...@@ -1303,25 +1304,19 @@ namespace DocFileFormat ...@@ -1303,25 +1304,19 @@ namespace DocFileFormat
} }
//build the grid based on the boundaries //build the grid based on the boundaries
sort( boundaries_all.begin(), boundaries_all.end() ); sort( boundaries.begin(), boundaries.end() );
if ( !boundaries.empty() ) if ( !boundaries.empty() )
{ {
for ( size_t i = 0; i < ( boundaries.size() - 1 ); i++ ) for ( unsigned int i = 0; i < ( boundaries.size() - 1 ); i++ )
{ {
grid_write.push_back( boundaries[i + 1] - boundaries[i] ); grid->push_back( boundaries[i + 1] - boundaries[i] );
}
}
if ( !boundaries_all.empty() )
{
for ( size_t i = 0; i < ( boundaries_all.size() - 1 ); i++ )
{
grid.push_back( boundaries_all[i + 1] - boundaries_all[i] );
} }
} }
_lastValidPapx = backup; _lastValidPapx = backup;
return true; return grid;
} }
// Finds the FC of the next row end mark. // Finds the FC of the next row end mark.
...@@ -1441,7 +1436,7 @@ namespace DocFileFormat ...@@ -1441,7 +1436,7 @@ namespace DocFileFormat
} }
/// Writes the table row that starts at the given cp value and ends at the next row end mark /// Writes the table row that starts at the given cp value and ends at the next row end mark
int DocumentMapping::writeTableRow(int initialCp, std::vector<short>* grid, std::vector<short>* grid_write, unsigned int nestingLevel) int DocumentMapping::writeTableRow(int initialCp, std::vector<short>* grid, unsigned int nestingLevel)
{ {
int cp = initialCp; int cp = initialCp;
int fc = m_document->FindFileCharPos( cp ); int fc = m_document->FindFileCharPos( cp );
...@@ -1471,7 +1466,7 @@ namespace DocFileFormat ...@@ -1471,7 +1466,7 @@ namespace DocFileFormat
//Write until the first "inner trailer paragraph" is reached //Write until the first "inner trailer paragraph" is reached
while ( !( ( m_document->Text->at( cp ) == TextMark::ParagraphEnd ) && ( tai.fInnerTtp ) ) && tai.fInTable ) while ( !( ( m_document->Text->at( cp ) == TextMark::ParagraphEnd ) && ( tai.fInnerTtp ) ) && tai.fInTable )
{ {
cp = writeTableCell( cp, &tapx, grid, grid_write, gridIndex, cellIndex, nestingLevel ); cp = writeTableCell( cp, &tapx, grid, gridIndex, cellIndex, nestingLevel );
cellIndex++; cellIndex++;
//each cell has it's own PAPX //each cell has it's own PAPX
...@@ -1488,7 +1483,7 @@ namespace DocFileFormat ...@@ -1488,7 +1483,7 @@ namespace DocFileFormat
while ( !( ( m_document->Text->at( cp ) == TextMark::CellOrRowMark ) && ( tai.fTtp ) ) while ( !( ( m_document->Text->at( cp ) == TextMark::CellOrRowMark ) && ( tai.fTtp ) )
&& tai.fInTable ) && tai.fInTable )
{ {
cp = writeTableCell( cp, &tapx, grid, grid_write, gridIndex, cellIndex, nestingLevel ); cp = writeTableCell( cp, &tapx, grid, gridIndex, cellIndex, nestingLevel );
cellIndex++; cellIndex++;
//each cell has it's own PAPX //each cell has it's own PAPX
...@@ -1511,15 +1506,18 @@ namespace DocFileFormat ...@@ -1511,15 +1506,18 @@ namespace DocFileFormat
} }
/// Writes the table cell that starts at the given cp value and ends at the next cell end mark /// Writes the table cell that starts at the given cp value and ends at the next cell end mark
int DocumentMapping::writeTableCell(int initialCp, TablePropertyExceptions* tapx, std::vector<short>* grid, std::vector<short>* grid_write, int& gridIndex, int cellIndex, unsigned int nestingLevel ) int DocumentMapping::writeTableCell(int initialCp, TablePropertyExceptions* tapx, std::vector<short>* grid, int& gridIndex, int cellIndex, unsigned int nestingLevel )
{ {
int cp = initialCp; int cp = initialCp;
int cpCellEnd = findCellEndCp( initialCp, nestingLevel );
//start w:tc //start w:tc
m_pXmlWriter->WriteNodeBegin( L"w:tc" ); m_pXmlWriter->WriteNodeBegin( L"w:tc" );
TableCellPropertiesMapping* tcpMapping = new TableCellPropertiesMapping( m_pXmlWriter, grid, grid_write, gridIndex, cellIndex ); //find cell end
int cpCellEnd = findCellEndCp( initialCp, nestingLevel );
//convert the properties
TableCellPropertiesMapping* tcpMapping = new TableCellPropertiesMapping( m_pXmlWriter, grid, gridIndex, cellIndex );
if ( tapx != NULL ) if ( tapx != NULL )
{ {
...@@ -1530,7 +1528,7 @@ namespace DocFileFormat ...@@ -1530,7 +1528,7 @@ namespace DocFileFormat
RELEASEOBJECT( tcpMapping ); RELEASEOBJECT( tcpMapping );
//write the paragraphs of the cell //write the paragraphs of the cell
while ( cp < cpCellEnd ) while ( cp < cpCellEnd )
{ {
//cp = writeParagraph(cp); //cp = writeParagraph(cp);
...@@ -1561,7 +1559,7 @@ namespace DocFileFormat ...@@ -1561,7 +1559,7 @@ namespace DocFileFormat
} }
} }
//end w:tc //end w:tc
m_pXmlWriter->WriteNodeEnd( L"w:tc" ); m_pXmlWriter->WriteNodeEnd( L"w:tc" );
return cp; return cp;
......
...@@ -48,6 +48,8 @@ ...@@ -48,6 +48,8 @@
#include "OleObjectMapping.h" #include "OleObjectMapping.h"
#include "ConversionContext.h" #include "ConversionContext.h"
#include "IMapping.h" #include "IMapping.h"
#include "FormFieldData.h"
#include "FormFieldDataMapping.h"
namespace DocFileFormat namespace DocFileFormat
{ {
...@@ -108,15 +110,15 @@ namespace DocFileFormat ...@@ -108,15 +110,15 @@ namespace DocFileFormat
// Writes the table starts at the given cp value // Writes the table starts at the given cp value
int writeTable ( int initialCp, unsigned int nestingLevel ); int writeTable ( int initialCp, unsigned int nestingLevel );
// Builds a list that contains the width of the several columns of the table. // Builds a list that contains the width of the several columns of the table.
bool buildTableGrid( int initialCp, unsigned int nestingLevel, std::vector<short>& grid, std::vector<short>& grid_write ); std::vector<short>* buildTableGrid( int initialCp, unsigned int nestingLevel );
// Finds the FC of the next row end mark. // Finds the FC of the next row end mark.
int findRowEndFc ( int initialCp, int& rowEndCp, unsigned int nestingLevel ); int findRowEndFc ( int initialCp, int& rowEndCp, unsigned int nestingLevel );
// Finds the FC of the next row end mark. // Finds the FC of the next row end mark.
int findRowEndFc ( int initialCp, unsigned int nestingLevel ); 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 // 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, std::vector<short>* grid_write, unsigned int nestingLevel ); 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 // 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, std::vector<short>* grid_write, int& gridIndex, int cellIndex, unsigned int nestingLevel ); int writeTableCell ( int initialCp, TablePropertyExceptions* tapx, std::vector<short>* grid, int& gridIndex, int cellIndex, unsigned int nestingLevel );
int findCellEndCp ( int initialCp, unsigned int nestingLevel ); int findCellEndCp ( int initialCp, unsigned int nestingLevel );
bool writeBookmarks ( int cp ); bool writeBookmarks ( int cp );
......
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include "FormFieldData.h"
#include "../../Common/DocxFormat/Source/Base/unicode_util.h"
static std::wstring convertUtf16ToWString(const UTF16 * Data, int nLength)
{
UTF32 *pStrUtf32 = new UTF32 [nLength + 1];
memset ((void *) pStrUtf32, 0, sizeof (UTF32) * (nLength + 1));
// this values will be modificated
const UTF16 *pStrUtf16_Conv = Data;
UTF32 *pStrUtf32_Conv = pStrUtf32;
ConversionResult eUnicodeConversionResult =
ConvertUTF16toUTF32 (&pStrUtf16_Conv,
&Data[nLength]
, &pStrUtf32_Conv
, &pStrUtf32 [nLength]
, strictConversion);
if (conversionOK != eUnicodeConversionResult)
{
delete [] pStrUtf32;
return std::wstring();
}
std::wstring wstr ((wchar_t *) pStrUtf32);
delete [] pStrUtf32;
return wstr;
}
namespace DocFileFormat
{
std::wstring readXstz(VirtualStreamReader *reader)
{
if (!reader) return L"";
unsigned short flags, cch, chTerm;
cch = reader->ReadUInt16();
std::wstring ret;
if (cch > 0)
{
std::shared_ptr<unsigned char>data = std::shared_ptr<unsigned char>(reader->ReadBytes(cch * 2, true));
#if defined(_WIN32) || defined(_WIN64)
ret = std::wstring((wchar_t*)data.get(), cch );
#else
ret = convertUtf16ToWString((UTF16*)data.get(), cch );
#endif
}
chTerm = reader->ReadUInt16();
return ret;
};
void FormFieldData::_HFD::read(VirtualStreamReader *reader)
{
if (!reader) return;
}
void FormFieldData::_FFData::read(VirtualStreamReader *reader)
{
if (!reader) return;
bExist = true;
unsigned short flags;
version = reader->ReadUInt32();
flags = reader->ReadUInt16();
iType = GETBITS(flags, 0, 1);
iRes = GETBITS(flags, 2, 6);
fOwnHelp = GETBIT(flags, 7);
fOwnStat = GETBIT(flags, 8);
fProt = GETBIT(flags, 9);
iSize = GETBIT(flags, 10);
iTypeTxt = GETBITS(flags, 11, 13);
fRecalc = GETBIT(flags, 14);
fHasListBox = GETBIT(flags, 15);
cch_field = reader->ReadUInt16();
hps = reader->ReadUInt16();
xstzName = readXstz(reader);
xstzTextDef = readXstz(reader);
wDef = reader->ReadUInt16();
xstzTextFormat = readXstz(reader);
xstzHelpText = readXstz(reader);
xstzStatText = readXstz(reader);
xstzEntryMcr = readXstz(reader);
xstzExitMcr = readXstz(reader);
}
FormFieldData::FormFieldData( int type, const CharacterPropertyExceptions* chpx, POLE::Stream* stream, bool bOlderVersion_ )
{
binary_data_size = 0;
if (!chpx) return;
int fc = -1;
bool bNilPICFAndBinData = false;
for ( std::list<SinglePropertyModifier>::iterator iter = chpx->grpprl->begin(); iter != chpx->grpprl->end(); iter++ )
{
switch ( iter->OpCode)
{
case sprmCFSpec:
{
}
break;
case sprmCFFldVanish:
{
}
break;
case sprmCPicLocation:
{
fc = FormatUtils::BytesToInt32( iter->Arguments, 0, iter->argumentsSize );
}
break;
case sprmCRsidText:
{
rsid = FormatUtils::IntToFormattedWideString(FormatUtils::BytesToInt32(iter->Arguments, 0, iter->argumentsSize), L"%08x");
}
break;
case sprmCFData:
{
bNilPICFAndBinData = true; // or bPICFAndOfficeArtData - shape, pic, ole
}
break;
}
}
if (fc >= 0 && bNilPICFAndBinData)
{
VirtualStreamReader reader(stream, fc, bOlderVersion_);
int sz_stream = reader.GetSize();
int lcb = reader.ReadUInt32();
int cbHeader = reader.ReadUInt16();
if (cbHeader != 0x44) return;
//ignored
reader.ReadBytes(62, false);
switch(type)
{
case 1:
HFD.read(&reader);
case 2:
FFData.read(&reader);
break;
default:
binary_data_size = lcb - cbHeader;
binary_data = std::shared_ptr<unsigned char>(reader.ReadBytes(binary_data_size, true));
break;
}
}
}
}
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include "IVisitable.h"
#include "CharacterPropertyExceptions.h"
#include "StructuredStorageReader.h"
#include "VirtualStreamReader.h"
namespace DocFileFormat
{
class FormFieldData : public IVisitable
{
public:
struct _HFD
{
bool bExist = false;
bool fNew = false;
bool fNoHist = false;
bool fImageMap = false;
bool fLocation = false;
bool fTooltip = false;
std::wstring clsid;
_UINT32 streamVersion = 0;
bool hlstmfHasMoniker = false;
bool hlstmfIsAbsolute = false;
bool hlstmfSiteGaveDisplayName = false;
bool hlstmfHasLocationStr = false;
bool hlstmfHasDisplayName = false;
bool hlstmfHasGUID = false;
bool hlstmfHasCreationTime = false;
bool hlstmfHasFrameName = false;
bool hlstmfMonikerSavedAsStr = false;
bool hlstmfAbsFromGetdataRel = false;
std::wstring displayName;
std::wstring targetFrameName;
std::wstring moniker;
std::wstring oleMoniker_clsid;
std::wstring oleMoniker_data;
std::wstring location;
std::wstring guid;
_UINT64 fileTime = 0;
void read(VirtualStreamReader* reader);
};
struct _FFData
{
bool bExist = false;
_UINT32 version = 0;
unsigned char iType = 0;
unsigned char iRes = 0;
bool fOwnHelp = false;
bool fOwnStat = false;
bool fProt = false;
bool iSize = false;
unsigned char iTypeTxt = 0;
bool fRecalc = false;
bool fHasListBox = false;
unsigned short cch_field = 0;
unsigned short hps = 0;
std::wstring xstzName;
std::wstring xstzTextDef;
unsigned short wDef = 0;
std::wstring xstzTextFormat;
std::wstring xstzHelpText;
std::wstring xstzStatText;
std::wstring xstzEntryMcr;
std::wstring xstzExitMcr;
//STTB hsttbDropList;
void read(VirtualStreamReader* reader);
};
FormFieldData( int type, const CharacterPropertyExceptions* chpx, POLE::Stream* stream, bool bOlderVersion );
virtual ~FormFieldData() {}
private:
friend class FormFieldDataMapping;
std::wstring name;
std::wstring rsid;
_FFData FFData;
_HFD HFD;
std::shared_ptr<unsigned char> binary_data;
int binary_data_size;
};
}
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include "ConversionContext.h"
#include "FormFieldData.h"
#include "AbstractOpenXmlMapping.h"
#include "IMapping.h"
namespace DocFileFormat
{
class FormFieldDataMapping: public AbstractOpenXmlMapping, public IMapping
{
public:
FormFieldDataMapping(XMLTools::CStringXmlWriter* writer, ConversionContext* context, IMapping* caller)
: AbstractOpenXmlMapping(writer), m_context(NULL),_caller(NULL)
{
m_context = context;
_caller = caller;
}
virtual void Apply(IVisitable* visited)
{
FormFieldData* ffData = static_cast<FormFieldData*>(visited);
if ( ffData == NULL ) return;
if (ffData->FFData.bExist)
{
m_pXmlWriter->WriteNodeBegin( L"w:ffData");
m_pXmlWriter->WriteNodeBegin( L"w:name", true);
m_pXmlWriter->WriteAttribute(L"w:val", ffData->FFData.xstzName);
m_pXmlWriter->WriteNodeEnd(L"w:name", true, true );
m_pXmlWriter->WriteNodeBegin( L"w:calcOnExit", true);
m_pXmlWriter->WriteAttribute(L"w:val", ffData->FFData.fRecalc);
m_pXmlWriter->WriteNodeEnd(L"w:calcOnExit", true, true );
m_pXmlWriter->WriteNodeBegin( L"w:textInput");
m_pXmlWriter->WriteNodeBegin( L"w:maxLength", true);
m_pXmlWriter->WriteAttribute(L"w:val", ffData->FFData.cch_field);
m_pXmlWriter->WriteNodeEnd(L"w:maxLength", true, true );
m_pXmlWriter->WriteNodeEnd( L"w:textInput" );
m_pXmlWriter->WriteNodeEnd( L"w:ffData" );
}
}
private:
ConversionContext* m_context;
IMapping* _caller;
};
}
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "IMapping.h" #include "IMapping.h"
#define GETBITS(from, numL, numH) ((from & (((1 << (numH - numL + 1)) - 1) << numL)) >> numL) #define GETBITS(from, numL, numH) ((from & (((1 << (numH - numL + 1)) - 1) << numL)) >> numL)
#define GETBIT(from, num) ((from & (1 << num)) != 0)
namespace DocFileFormat namespace DocFileFormat
{ {
......
...@@ -53,62 +53,31 @@ namespace DocFileFormat ...@@ -53,62 +53,31 @@ namespace DocFileFormat
PathParser (const unsigned char* pSegmentInfo, unsigned int pSegmentInfoSize, const unsigned char* pVertices, unsigned int pVerticesSize, std::vector<_guides> & guides) PathParser (const unsigned char* pSegmentInfo, unsigned int pSegmentInfoSize, const unsigned char* pVertices, unsigned int pVerticesSize, std::vector<_guides> & guides)
{ {
int offset = 6;
if ((pSegmentInfo != NULL) && (pSegmentInfoSize > 0)) if ((pSegmentInfo != NULL) && (pSegmentInfoSize > 0))
{ {
int offset = 6;
unsigned short nElems = FormatUtils::BytesToUInt16(pSegmentInfo, 0, pSegmentInfoSize); unsigned short nElems = FormatUtils::BytesToUInt16(pSegmentInfo, 0, pSegmentInfoSize);
unsigned short nElemsAlloc = FormatUtils::BytesToUInt16(pSegmentInfo, 2, pSegmentInfoSize); unsigned short nElemsAlloc = FormatUtils::BytesToUInt16(pSegmentInfo, 2, pSegmentInfoSize);
unsigned short cb = FormatUtils::BytesToUInt16(pSegmentInfo, 4, pSegmentInfoSize); unsigned short cb = FormatUtils::BytesToUInt16(pSegmentInfo, 4, pSegmentInfoSize);
// видимо без шапки сразу пишутся все элементы unsigned short cbElement = 4;
bool headerIs = ((0xfff0 != cb) && (cb > 8) || nElems > nElemsAlloc);
if (headerIs)
{
cb = 2;
offset = 0;
nElems = pSegmentInfoSize / 2;
for (unsigned short i = 0; i < nElems; ++i) if (cb == 0xfff0)
{ cbElement = 2;
PathSegment oSegment = PathSegment(FormatUtils::BytesToUInt16(pSegmentInfo + offset, (i * cb), pSegmentInfoSize));
m_arSegments.push_back (oSegment); if (nElems == 0)
} {
nElems = (pSegmentInfoSize - offset) / cbElement;
} }
else for (unsigned short i = 0; i < nElems; ++i)
{ {
if ((0xfff0 != cb) && (8 != cb) && (4 != cb) && (2 != cb)) PathSegment oSegment = PathSegment(FormatUtils::BytesToInt32(pSegmentInfo + offset, (i * cbElement), pSegmentInfoSize - offset));
{ m_arSegments.push_back (oSegment);
cb = 0xfff0;
offset = 0;
nElems = pSegmentInfoSize / 2;
}
if (0xfff0 == cb)
{
cb = 4;
for (unsigned short i = 0; i < nElems; ++i)
{
PathSegment oSegment = PathSegment(FormatUtils::BytesToUInt16(pSegmentInfo + offset, (i * cb), pSegmentInfoSize));
m_arSegments.push_back (oSegment);
}
}
else
{
if ((2 != cb) && (1 != cb))
cb = 8;
for (unsigned short i = 0; i < nElems; ++i)
{
PathSegment oSegment = PathSegment(FormatUtils::BytesToInt32(pSegmentInfo + offset, (i * cb), pSegmentInfoSize));
m_arSegments.push_back (oSegment);
}
if ((long)pSegmentInfoSize < (long)(cb*nElems)) // Есть несколько файлов с мусором вместо данных
m_arSegments.clear();
}
} }
if ((long)pSegmentInfoSize < (long)(cb * nElems)) // Есть несколько файлов с мусором вместо данных
m_arSegments.clear();
} }
if ((NULL != pVertices) && (pVerticesSize > 0)) if ((NULL != pVertices) && (pVerticesSize > 0))
...@@ -117,26 +86,30 @@ namespace DocFileFormat ...@@ -117,26 +86,30 @@ namespace DocFileFormat
unsigned short nElemsAlloc = FormatUtils::BytesToUInt16(pVertices, 2, pVerticesSize); unsigned short nElemsAlloc = FormatUtils::BytesToUInt16(pVertices, 2, pVerticesSize);
unsigned short cb = FormatUtils::BytesToUInt16(pVertices, 4, pVerticesSize); unsigned short cb = FormatUtils::BytesToUInt16(pVertices, 4, pVerticesSize);
unsigned short cbElement = cb;
if (cb == 0xfff0)
cbElement = 4;
for (unsigned short i = 0; i < nElems; ++i) for (unsigned short i = 0; i < nElems; ++i)
{ {
POINT point; POINT point;
if (0xfff0 == cb) if (cbElement == 4)
{ {
cb = 4; point.x = FormatUtils::BytesToInt16(pVertices + offset, (i * cbElement), pVerticesSize - offset);
point.x = FormatUtils::BytesToInt16(pVertices + 6, (i * cb), pVerticesSize); point.y = FormatUtils::BytesToInt16(pVertices + offset, (i * cbElement) + (cbElement / 2), pVerticesSize - offset);
point.y = FormatUtils::BytesToInt16(pVertices + 6, (i * cb) + (cb / 2), pVerticesSize);
} }
else else
{ {
point.x = FormatUtils::BytesToInt32(pVertices + 6, (i * cb), pVerticesSize); point.x = FormatUtils::BytesToInt32(pVertices + offset, (i * cbElement), pVerticesSize - offset);
point.y = FormatUtils::BytesToInt32(pVertices + 6, (i * cb) + (cb / 2), pVerticesSize); point.y = FormatUtils::BytesToInt32(pVertices + offset, (i * cbElement) + (cbElement / 2), pVerticesSize - offset);
} }
LONG lMinF = (LONG)0x80000000; LONG lMinF = (LONG)0x80000000;
if (lMinF <= point.x) if (lMinF <= point.x)
{ {
int index = (DWORD)point.x - 0x80000000; int index = (DWORD)point.x - 0x80000000;
if (index >= 0 && index < (int)guides.size()) if (index >= 0 && index < guides.size())
{ {
point.x = guides[index].param3; point.x = guides[index].param3;
} }
...@@ -144,7 +117,7 @@ namespace DocFileFormat ...@@ -144,7 +117,7 @@ namespace DocFileFormat
if (lMinF <= point.y) if (lMinF <= point.y)
{ {
int index = (DWORD)point.y - 0x80000000; int index = (DWORD)point.y - 0x80000000;
if (index >= 0 && index < (int)guides.size()) if (index >= 0 && index < guides.size())
{ {
point.y = guides[index].param3; point.y = guides[index].param3;
} }
......
...@@ -597,16 +597,12 @@ namespace DocFileFormat ...@@ -597,16 +597,12 @@ namespace DocFileFormat
virtual ~ShapeOptions() virtual ~ShapeOptions()
{ {
//for (std::vector<OptionEntry>::iterator iter = Options.begin(); iter != Options.end(); ++iter)
// RELEASEARRAYOBJECTS( iter->opComplex );
} }
ShapeOptions (IBinaryReader* _reader, unsigned int size, unsigned int typeCode, unsigned int version, unsigned int instance) : Record (_reader, size, typeCode, version, instance) ShapeOptions (IBinaryReader* _reader, unsigned int size, unsigned int typeCode, unsigned int version, unsigned int instance) : Record (_reader, size, typeCode, version, instance)
{ {
long pos = Reader->GetPosition(); long pos = Reader->GetPosition();
//instance is the count of properties stored in this record
//parse the flags and the simple values //parse the flags and the simple values
for (unsigned int i = 0; i < instance; ++i) for (unsigned int i = 0; i < instance; ++i)
{ {
...@@ -621,9 +617,7 @@ namespace DocFileFormat ...@@ -621,9 +617,7 @@ namespace DocFileFormat
Options.push_back( entry ); Options.push_back( entry );
} }
//parse the complex values //parse the complex values & sorted by pid
//these values are stored directly at the end
//of the OptionEntry arry, sorted by pid
for (unsigned int i = 0; i < instance; ++i) for (unsigned int i = 0; i < instance; ++i)
{ {
if (Options[i]->fComplex && Options[i]->op > 0) if (Options[i]->fComplex && Options[i]->op > 0)
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include "MainDocumentMapping.h" #include "MainDocumentMapping.h"
#include "OleObjectMapping.h" #include "OleObjectMapping.h"
#include "VMLPictureMapping.h" #include "VMLPictureMapping.h"
#include "FormFieldDataMapping.h"
#include "../../DesktopEditor/common/File.h" #include "../../DesktopEditor/common/File.h"
#include "../../DesktopEditor/common/Directory.h" #include "../../DesktopEditor/common/Directory.h"
...@@ -144,9 +145,9 @@ namespace DocFileFormat ...@@ -144,9 +145,9 @@ namespace DocFileFormat
{ {
if (docFile == NULL) return S_FALSE; if (docFile == NULL) return S_FALSE;
POLE::Storage *storageOut = new POLE::Storage(fileName.c_str()); POLE::Storage *storageOut = new POLE::Storage(fileName.c_str());
if (storageOut == NULL) return S_FALSE; if (storageOut == NULL) return S_FALSE;
if (storageOut->open(true, true)==false) if (storageOut->open(true, true)==false)
{ {
delete storageOut; delete storageOut;
......
...@@ -40,19 +40,13 @@ namespace DocFileFormat ...@@ -40,19 +40,13 @@ namespace DocFileFormat
RELEASEOBJECT( Changes ); RELEASEOBJECT( Changes );
} }
/*========================================================================================================*/
RevisionData::RevisionData(): RevisionData::RevisionData():
Dttm(), Isbt(0), Type(NoRevision), Changes(NULL), RsidDel(0), RsidProp(0), Rsid(0) Dttm(), Isbt(0), Type(NoRevision), Changes(NULL), RsidDel(0), RsidProp(0), Rsid(0)
{ {
this->Changes = new std::list<SinglePropertyModifier>(); this->Changes = new std::list<SinglePropertyModifier>();
} }
/*========================================================================================================*/ RevisionData::RevisionData( CharacterPropertyExceptions* chpx ) : Dttm(), Isbt(0), Type(NoRevision), Changes(NULL), RsidDel(0), RsidProp(0), Rsid(0)
/// Collects the revision data of a CHPX
RevisionData::RevisionData( CharacterPropertyExceptions* chpx ):
Dttm(), Isbt(0), Type(NoRevision), Changes(NULL), RsidDel(0), RsidProp(0), Rsid(0)
{ {
bool collectRevisionData = true; bool collectRevisionData = true;
this->Changes = new std::list<SinglePropertyModifier>(); this->Changes = new std::list<SinglePropertyModifier>();
......
...@@ -288,6 +288,7 @@ namespace DocFileFormat ...@@ -288,6 +288,7 @@ namespace DocFileFormat
int ndyTextBottom = -1; int ndyTextBottom = -1;
bool bHavePath = false; bool bHavePath = false;
int nShapePath = -1;
int nAdjValues = 0; int nAdjValues = 0;
int nLTxID = -1; int nLTxID = -1;
...@@ -361,6 +362,7 @@ namespace DocFileFormat ...@@ -361,6 +362,7 @@ namespace DocFileFormat
case shapePath : case shapePath :
{ {
bHavePath = true; bHavePath = true;
nShapePath = iter->op;
}break; }break;
case pVertices: case pVertices:
{ {
...@@ -1653,7 +1655,7 @@ namespace DocFileFormat ...@@ -1653,7 +1655,7 @@ namespace DocFileFormat
} }
if (!bRelV && m_pSpa) if (!bRelV && m_pSpa)
{ {
appendStyleProperty(oStyle, L"mso-position-vertical-relative", mapVerticalPositionRelative(m_pSpa->bx)); appendStyleProperty(oStyle, L"mso-position-vertical-relative", mapVerticalPositionRelative(m_pSpa->by));
} }
if (!m_isInlineShape && !bZIndex) if (!m_isInlineShape && !bZIndex)
{ {
...@@ -2165,7 +2167,7 @@ namespace DocFileFormat ...@@ -2165,7 +2167,7 @@ namespace DocFileFormat
//todooo нарисовать кастомный шейп //todooo нарисовать кастомный шейп
} }
else else
WritePrimitiveProps(primitive, (index==0 ? true : false)); WritePrimitiveProps(primitive, (index==0?true:false));
if (primitive->type == 0x0000) if (primitive->type == 0x0000)
......
...@@ -94,6 +94,7 @@ SOURCES += \ ...@@ -94,6 +94,7 @@ SOURCES += \
../../DocDocxConverter/VMLShapeTypeMapping.cpp \ ../../DocDocxConverter/VMLShapeTypeMapping.cpp \
../../DocDocxConverter/WordDocument.cpp \ ../../DocDocxConverter/WordDocument.cpp \
../../DocDocxConverter/WordprocessingDocument.cpp \ ../../DocDocxConverter/WordprocessingDocument.cpp \
../../DocDocxConverter/FormFieldData.cpp \
../../DocDocxConverter/OfficeDrawing/Record.cpp \ ../../DocDocxConverter/OfficeDrawing/Record.cpp \
../../DocDocxConverter/OfficeDrawing/RecordFactory.cpp \ ../../DocDocxConverter/OfficeDrawing/RecordFactory.cpp \
../../DocDocxConverter/OfficeDrawing/ShapeTypeFactory.cpp ../../DocDocxConverter/OfficeDrawing/ShapeTypeFactory.cpp
......
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
#include "../../DocDocxConverter/VMLShapeTypeMapping.cpp" #include "../../DocDocxConverter/VMLShapeTypeMapping.cpp"
#include "../../DocDocxConverter/WordDocument.cpp" #include "../../DocDocxConverter/WordDocument.cpp"
#include "../../DocDocxConverter/WordprocessingDocument.cpp" #include "../../DocDocxConverter/WordprocessingDocument.cpp"
#include "../../DocDocxConverter/FormFieldData.cpp"
#include "../../DocDocxConverter/OfficeDrawing/Record.cpp" #include "../../DocDocxConverter/OfficeDrawing/Record.cpp"
#include "../../DocDocxConverter/OfficeDrawing/RecordFactory.cpp" #include "../../DocDocxConverter/OfficeDrawing/RecordFactory.cpp"
#include "../../DocDocxConverter/OfficeDrawing/ShapeTypeFactory.cpp" #include "../../DocDocxConverter/OfficeDrawing/ShapeTypeFactory.cpp"
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="" AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;AVS_USE_CONVERT_PPTX_TOCUSTOM_VML;DONT_WRITE_EMBEDDED_FONTS" PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;PPTX_DEF;PPT_DEF;ENABLE_PPT_TO_PPTX_CONVERT;AVS_USE_CONVERT_PPTX_TOCUSTOM_VML;DONT_WRITE_EMBEDDED_FONTS"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
...@@ -479,6 +479,14 @@ ...@@ -479,6 +479,14 @@
RelativePath="..\..\DocDocxConverter\FormattedDiskPagePAPX.h" RelativePath="..\..\DocDocxConverter\FormattedDiskPagePAPX.h"
> >
</File> </File>
<File
RelativePath="..\..\DocDocxConverter\FormFieldData.cpp"
>
</File>
<File
RelativePath="..\..\DocDocxConverter\FormFieldData.h"
>
</File>
<File <File
RelativePath="..\..\DocDocxConverter\Global.h" RelativePath="..\..\DocDocxConverter\Global.h"
> >
...@@ -1090,6 +1098,10 @@ ...@@ -1090,6 +1098,10 @@
RelativePath="..\..\DocDocxConverter\FootnotesMapping.h" RelativePath="..\..\DocDocxConverter\FootnotesMapping.h"
> >
</File> </File>
<File
RelativePath="..\..\DocDocxConverter\FormFieldDataMapping.h"
>
</File>
<File <File
RelativePath="..\..\DocDocxConverter\HeaderMapping.cpp" RelativePath="..\..\DocDocxConverter\HeaderMapping.cpp"
> >
......
...@@ -29,19 +29,17 @@ ...@@ -29,19 +29,17 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
* *
*/ */
// DocFormatTest.cpp : Defines the entry point for the console application. #include <iostream>
//
#include "../DocFormatLib/DocFormatLib.h"
#include "../../OfficeUtils/src/ASCOfficeCriticalSection.h"
#include "../../Common/DocxFormat/Source/Base/Base.h"
#include "../../DesktopEditor/common/Directory.h"
#include "../../OfficeUtils/src/OfficeUtils.h" #include "../../OfficeUtils/src/OfficeUtils.h"
#include "../../DesktopEditor/common/Directory.h" #include "../DocFormatLib/DocFormatLib.h"
#include <string> #pragma comment(lib,"Shell32.lib")
#include <windows.h> #pragma comment(lib,"Advapi32.lib")
#include <tchar.h> #pragma comment(lib,"Rpcrt4.lib")
#if defined(_WIN64) #if defined(_WIN64)
#pragma comment(lib, "../../build/bin/icu/win_64/icuuc.lib") #pragma comment(lib, "../../build/bin/icu/win_64/icuuc.lib")
...@@ -49,36 +47,34 @@ ...@@ -49,36 +47,34 @@
#pragma comment(lib, "../../build/bin/icu/win_32/icuuc.lib") #pragma comment(lib, "../../build/bin/icu/win_32/icuuc.lib")
#endif #endif
#pragma comment(lib, "Rpcrt4.lib") HRESULT convert_single(std::wstring srcFileName)
HRESULT convert_single(std::wstring sSrcDoc)
{ {
HRESULT hr = S_OK; HRESULT hr = S_OK;
std::wstring outputDir = NSDirectory::GetFolderPath(sSrcDoc); std::wstring outputDir = NSDirectory::GetFolderPath(srcFileName);
std::wstring dstTempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir); std::wstring dstTempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir);
std::wstring dstPath;
COfficeDocFile docFile; COfficeDocFile docFile;
docFile.m_sTempFolder = outputDir; docFile.m_sTempFolder = outputDir;
bool bMacros = true; bool bMacros = true;
HRESULT hRes = docFile.LoadFromFile( sSrcDoc, dstTempPath, L"password", bMacros, NULL); HRESULT hRes = docFile.LoadFromFile( srcFileName, dstTempPath, L"password", bMacros, NULL);
std::wstring sDstDocx;
if (bMacros) if (bMacros)
{ {
sDstDocx = sSrcDoc + L"-my.docm"; dstPath = srcFileName + L"-my.docm";
} }
else else
{ {
sDstDocx = sSrcDoc + L"-my.docx"; dstPath = srcFileName + L"-my.docx";
} }
if (hRes == S_OK) if (hRes == S_OK)
{ {
COfficeUtils oCOfficeUtils(NULL); COfficeUtils oCOfficeUtils(NULL);
hRes = oCOfficeUtils.CompressFileOrDirectory(dstTempPath.c_str(), sDstDocx, -1); hRes = oCOfficeUtils.CompressFileOrDirectory(dstTempPath.c_str(), dstPath, -1);
} }
NSDirectory::DeleteDirectory(dstTempPath); NSDirectory::DeleteDirectory(dstTempPath);
......
...@@ -442,6 +442,10 @@ ...@@ -442,6 +442,10 @@
RelativePath="..\..\Common\OfficeFileFormatChecker2.cpp" RelativePath="..\..\Common\OfficeFileFormatChecker2.cpp"
> >
</File> </File>
<File
RelativePath="..\..\Common\3dParty\pole\pole.cpp"
>
</File>
<File <File
RelativePath="..\..\UnicodeConverter\UnicodeConverter.cpp" RelativePath="..\..\UnicodeConverter\UnicodeConverter.cpp"
> >
......
...@@ -36,8 +36,6 @@ ...@@ -36,8 +36,6 @@
namespace XLS namespace XLS
{ {
// Logical representation of AxisLine record in BIFF8
class AxisLine: public BiffRecord class AxisLine: public BiffRecord
{ {
BIFF_RECORD_DEFINE_TYPE_INFO(AxisLine) BIFF_RECORD_DEFINE_TYPE_INFO(AxisLine)
......
...@@ -31,8 +31,8 @@ ...@@ -31,8 +31,8 @@
*/ */
#include "ExternSheet.h" #include "ExternSheet.h"
#include <Logic/Biff_structures/XTI.h> #include "../Biff_structures/XTI.h"
#include <Logic/Biff_structures/BiffString.h> #include "../Biff_structures/BiffString.h"
namespace XLS namespace XLS
{ {
......
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
namespace XLS namespace XLS
{ {
// Logical representation of InterfaceEnd record in BIFF8
class InterfaceEnd: public BiffRecord class InterfaceEnd: public BiffRecord
{ {
BIFF_RECORD_DEFINE_TYPE_INFO(InterfaceEnd) BIFF_RECORD_DEFINE_TYPE_INFO(InterfaceEnd)
...@@ -47,6 +46,7 @@ public: ...@@ -47,6 +46,7 @@ public:
BaseObjectPtr clone(); BaseObjectPtr clone();
static const ElementType type = typeInterfaceEnd;
void readFields(CFRecord& record); void readFields(CFRecord& record);
......
...@@ -625,9 +625,7 @@ void GlobalsSubstream::UpdateXti() ...@@ -625,9 +625,7 @@ void GlobalsSubstream::UpdateXti()
ExternSheet* extern_sheet = dynamic_cast<ExternSheet*>(SUPP->m_ExternSheet.get()); ExternSheet* extern_sheet = dynamic_cast<ExternSheet*>(SUPP->m_ExternSheet.get());
if (!extern_sheet) continue; for (size_t i = 0; extern_sheet && i < extern_sheet->rgXTI.size(); i++)
for (size_t i = 0; i < extern_sheet->rgXTI.size(); i++)
{ {
XTI* xti = dynamic_cast<XTI*>(extern_sheet->rgXTI[i].get()); XTI* xti = dynamic_cast<XTI*>(extern_sheet->rgXTI[i].get());
if (!xti) continue; if (!xti) continue;
...@@ -671,9 +669,17 @@ void GlobalsSubstream::UpdateXti() ...@@ -671,9 +669,17 @@ void GlobalsSubstream::UpdateXti()
val.link = XMLSTUFF::xti_indexes2sheet_name(xti->itabFirst, xti->itabLast, info->rgst, val.link); val.link = XMLSTUFF::xti_indexes2sheet_name(xti->itabFirst, xti->itabLast, info->rgst, val.link);
} }
} }
global_info_->arXti.push_back(val);
}
if (!extern_sheet && !SUPP->m_arExternName.empty())
{
GlobalWorkbookInfo::_xti val;
val.iSup = s;
val.pNames = &SUPP->arNames;
global_info_->arXti.push_back(val); global_info_->arXti.push_back(val);
} }
} }
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
QT -= core QT -= core
QT -= gui QT -= gui
VERSION = 2.4.490.0 VERSION = 2.4.492.0
DEFINES += INTVER=$$VERSION DEFINES += INTVER=$$VERSION
TARGET = x2t TARGET = x2t
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment