mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
DocFormat - fix bugs content
This commit is contained in:
@ -535,6 +535,7 @@ namespace DocFileFormat
|
||||
std::wstring TOC ( _T( " TOC" ) );
|
||||
std::wstring HYPERLINK ( _T( " HYPERLINK" ) );
|
||||
std::wstring PAGEREF ( _T( " PAGEREF" ) );
|
||||
std::wstring PAGE ( _T( "PAGE" ) );
|
||||
|
||||
bool bChart = search( f.begin(), f.end(), chart.begin(), chart.end()) != f.end();
|
||||
bool bEMBED = search( f.begin(), f.end(), EMBED.begin(), EMBED.end()) != f.end();
|
||||
@ -548,6 +549,7 @@ namespace DocFileFormat
|
||||
bool bPAGEREF = search( f.begin(), f.end(), PAGEREF.begin(), PAGEREF.end()) != f.end();
|
||||
bool bQUOTE = search( f.begin(), f.end(), QUOTE.begin(), QUOTE.end()) != f.end();
|
||||
bool bEquation = search( f.begin(), f.end(), Equation.begin(), Equation.end()) != f.end();
|
||||
bool bPAGE = !bPAGEREF && search( f.begin(), f.end(), PAGE.begin(), PAGE.end()) != f.end();
|
||||
|
||||
if ( bFORM )
|
||||
{
|
||||
@ -588,12 +590,12 @@ namespace DocFileFormat
|
||||
|
||||
_fldCharCounter++;
|
||||
}
|
||||
else if ( bHYPERLINK && bPAGEREF )
|
||||
else if ( (bHYPERLINK && bPAGEREF) || bPAGE)
|
||||
{
|
||||
int cpFieldSep2 = cpFieldStart, cpFieldSep1 = cpFieldStart;
|
||||
std::vector<std::wstring> toc;
|
||||
|
||||
if (search( f.begin(), f.end(), TOC.begin(), TOC.end()) != f.end())
|
||||
if ((search( f.begin(), f.end(), TOC.begin(), TOC.end()) != f.end()) || bPAGE)
|
||||
{
|
||||
m_pXmlWriter->WriteNodeBegin( _T( "w:fldChar" ), TRUE );
|
||||
m_pXmlWriter->WriteAttribute( _T( "w:fldCharType" ), _T( "begin" ) );
|
||||
|
||||
@ -112,8 +112,27 @@ namespace DocFileFormat
|
||||
{
|
||||
case sprmOldSGprfIhdt:
|
||||
case sprmSGprfIhdt:
|
||||
{
|
||||
fHF = FormatUtils::BytesToUChar( iter->Arguments, 0, iter->argumentsSize );
|
||||
break;
|
||||
}break;
|
||||
case sprmSPgbProp:
|
||||
{
|
||||
int val = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
int pgbApplyTo = FormatUtils::GetIntFromBits(val, 0 , 3);
|
||||
int pgbPageDepth = FormatUtils::GetIntFromBits(val, 3 , 2);
|
||||
int pgbOffsetFrom = FormatUtils::GetIntFromBits(val, 5 , 3);
|
||||
|
||||
if (pgbOffsetFrom == 0x1) //else default from text
|
||||
appendValueAttribute( &pgBorders, L"w:offsetFrom", L"page" );
|
||||
|
||||
if (pgbApplyTo == 0x0)
|
||||
appendValueAttribute( &pgBorders, L"w:display", L"allPages" );
|
||||
else if (pgbApplyTo == 0x1)
|
||||
appendValueAttribute( &pgBorders, L"w:display", L"firstPage" );
|
||||
else
|
||||
appendValueAttribute( &pgBorders, L"w:display", L"notFirstPage" );
|
||||
|
||||
}break;
|
||||
}
|
||||
}
|
||||
// Header
|
||||
@ -142,8 +161,8 @@ namespace DocFileFormat
|
||||
case sprmSDxaLeft:
|
||||
{
|
||||
//left margin
|
||||
this->_marLeft = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
appendValueAttribute( &pgMar, _T( "w:left" ), FormatUtils::IntToWideString( this->_marLeft ).c_str() );
|
||||
_marLeft = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
appendValueAttribute( &pgMar, _T( "w:left" ), FormatUtils::IntToWideString( _marLeft ).c_str() );
|
||||
}
|
||||
break;
|
||||
|
||||
@ -151,8 +170,8 @@ namespace DocFileFormat
|
||||
case sprmSDxaRight:
|
||||
{
|
||||
//right margin
|
||||
this->_marRight = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
appendValueAttribute( &pgMar, _T( "w:right" ), FormatUtils::IntToWideString( this->_marRight ).c_str() );
|
||||
_marRight = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
appendValueAttribute( &pgMar, _T( "w:right" ), FormatUtils::IntToWideString( _marRight ).c_str() );
|
||||
}
|
||||
break;
|
||||
|
||||
@ -191,8 +210,8 @@ namespace DocFileFormat
|
||||
case sprmSXaPage:
|
||||
{
|
||||
//width
|
||||
this->_pgWidth = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
appendValueAttribute( &pgSz, _T( "w:w" ), FormatUtils::IntToWideString( this->_pgWidth ).c_str() );
|
||||
_pgWidth = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
appendValueAttribute( &pgSz, _T( "w:w" ), FormatUtils::IntToWideString( _pgWidth ).c_str() );
|
||||
}
|
||||
break;
|
||||
|
||||
@ -397,7 +416,7 @@ namespace DocFileFormat
|
||||
case sprmOldSBkc:
|
||||
case sprmSBkc:
|
||||
{
|
||||
this->_type = FormatUtils::MapValueToWideString( iter->Arguments[0], &SectionTypeMap[0][0], 5, 11 );
|
||||
_type = FormatUtils::MapValueToWideString( iter->Arguments[0], &SectionTypeMap[0][0], 5, 11 );
|
||||
}
|
||||
break;
|
||||
|
||||
@ -456,7 +475,8 @@ namespace DocFileFormat
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
{
|
||||
}break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -474,7 +494,7 @@ namespace DocFileFormat
|
||||
//the last column width is not written to the document because it can be calculated.
|
||||
if (0 == m_arrWidth [m_nColumns - 1])
|
||||
{
|
||||
short lastColWidth = (short)( this->_pgWidth - this->_marLeft - this->_marRight );
|
||||
short lastColWidth = (short)( _pgWidth - _marLeft - _marRight );
|
||||
|
||||
for (int i = 0; i < m_nColumns - 1; ++i)
|
||||
{
|
||||
@ -488,13 +508,13 @@ namespace DocFileFormat
|
||||
// append the xml elements
|
||||
for (int i = 0; i < m_nColumns; ++i)
|
||||
{
|
||||
XMLTools::XMLElement<wchar_t> col (_T( "w:col" ));
|
||||
XMLTools::XMLElement<wchar_t> col (_T( "w:col" ));
|
||||
XMLTools::XMLAttribute<wchar_t> w (_T( "w:w" ), FormatUtils::IntToWideString (m_arrWidth[i]).c_str());
|
||||
XMLTools::XMLAttribute<wchar_t> space (_T( "w:space" ), FormatUtils::IntToWideString (m_arrSpace[i]).c_str());
|
||||
|
||||
col.AppendAttribute (w);
|
||||
col.AppendAttribute (space);
|
||||
cols.AppendChild (col);
|
||||
cols.AppendChild (col);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -268,7 +268,7 @@ namespace DocFileFormat
|
||||
bool stroked = true;
|
||||
bool filled = true;
|
||||
bool hasTextbox = false;
|
||||
bool layoutInCell = false;
|
||||
bool layoutInCell = true; //anmeldebogenfos.doc
|
||||
|
||||
int ndxTextLeft = -1;
|
||||
int ndyTextTop = -1;
|
||||
|
||||
Reference in New Issue
Block a user