Commit 7555f9f4 authored by ElenaSubbotina's avatar ElenaSubbotina

DocFormat - fix bugs content

parent 6b6abbd2
...@@ -535,6 +535,7 @@ namespace DocFileFormat ...@@ -535,6 +535,7 @@ namespace DocFileFormat
std::wstring TOC ( _T( " TOC" ) ); std::wstring TOC ( _T( " TOC" ) );
std::wstring HYPERLINK ( _T( " HYPERLINK" ) ); std::wstring HYPERLINK ( _T( " HYPERLINK" ) );
std::wstring PAGEREF ( _T( " PAGEREF" ) ); std::wstring PAGEREF ( _T( " PAGEREF" ) );
std::wstring PAGE ( _T( "PAGE" ) );
bool bChart = search( f.begin(), f.end(), chart.begin(), chart.end()) != f.end(); 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(); bool bEMBED = search( f.begin(), f.end(), EMBED.begin(), EMBED.end()) != f.end();
...@@ -548,6 +549,7 @@ namespace DocFileFormat ...@@ -548,6 +549,7 @@ namespace DocFileFormat
bool bPAGEREF = search( f.begin(), f.end(), PAGEREF.begin(), PAGEREF.end()) != f.end(); 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 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 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 ) if ( bFORM )
{ {
...@@ -588,12 +590,12 @@ namespace DocFileFormat ...@@ -588,12 +590,12 @@ namespace DocFileFormat
_fldCharCounter++; _fldCharCounter++;
} }
else if ( bHYPERLINK && bPAGEREF ) else if ( (bHYPERLINK && bPAGEREF) || bPAGE)
{ {
int cpFieldSep2 = cpFieldStart, cpFieldSep1 = cpFieldStart; int cpFieldSep2 = cpFieldStart, cpFieldSep1 = cpFieldStart;
std::vector<std::wstring> toc; 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->WriteNodeBegin( _T( "w:fldChar" ), TRUE );
m_pXmlWriter->WriteAttribute( _T( "w:fldCharType" ), _T( "begin" ) ); m_pXmlWriter->WriteAttribute( _T( "w:fldCharType" ), _T( "begin" ) );
......
...@@ -112,8 +112,27 @@ namespace DocFileFormat ...@@ -112,8 +112,27 @@ namespace DocFileFormat
{ {
case sprmOldSGprfIhdt: case sprmOldSGprfIhdt:
case sprmSGprfIhdt: case sprmSGprfIhdt:
{
fHF = FormatUtils::BytesToUChar( iter->Arguments, 0, iter->argumentsSize ); 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 // Header
...@@ -142,8 +161,8 @@ namespace DocFileFormat ...@@ -142,8 +161,8 @@ namespace DocFileFormat
case sprmSDxaLeft: case sprmSDxaLeft:
{ {
//left margin //left margin
this->_marLeft = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ); _marLeft = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize );
appendValueAttribute( &pgMar, _T( "w:left" ), FormatUtils::IntToWideString( this->_marLeft ).c_str() ); appendValueAttribute( &pgMar, _T( "w:left" ), FormatUtils::IntToWideString( _marLeft ).c_str() );
} }
break; break;
...@@ -151,8 +170,8 @@ namespace DocFileFormat ...@@ -151,8 +170,8 @@ namespace DocFileFormat
case sprmSDxaRight: case sprmSDxaRight:
{ {
//right margin //right margin
this->_marRight = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ); _marRight = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize );
appendValueAttribute( &pgMar, _T( "w:right" ), FormatUtils::IntToWideString( this->_marRight ).c_str() ); appendValueAttribute( &pgMar, _T( "w:right" ), FormatUtils::IntToWideString( _marRight ).c_str() );
} }
break; break;
...@@ -191,8 +210,8 @@ namespace DocFileFormat ...@@ -191,8 +210,8 @@ namespace DocFileFormat
case sprmSXaPage: case sprmSXaPage:
{ {
//width //width
this->_pgWidth = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ); _pgWidth = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize );
appendValueAttribute( &pgSz, _T( "w:w" ), FormatUtils::IntToWideString( this->_pgWidth ).c_str() ); appendValueAttribute( &pgSz, _T( "w:w" ), FormatUtils::IntToWideString( _pgWidth ).c_str() );
} }
break; break;
...@@ -397,7 +416,7 @@ namespace DocFileFormat ...@@ -397,7 +416,7 @@ namespace DocFileFormat
case sprmOldSBkc: case sprmOldSBkc:
case sprmSBkc: 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; break;
...@@ -456,7 +475,8 @@ namespace DocFileFormat ...@@ -456,7 +475,8 @@ namespace DocFileFormat
break; break;
default: default:
break; {
}break;
} }
} }
...@@ -474,7 +494,7 @@ namespace DocFileFormat ...@@ -474,7 +494,7 @@ namespace DocFileFormat
//the last column width is not written to the document because it can be calculated. //the last column width is not written to the document because it can be calculated.
if (0 == m_arrWidth [m_nColumns - 1]) 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) for (int i = 0; i < m_nColumns - 1; ++i)
{ {
...@@ -488,13 +508,13 @@ namespace DocFileFormat ...@@ -488,13 +508,13 @@ namespace DocFileFormat
// append the xml elements // append the xml elements
for (int i = 0; i < m_nColumns; ++i) 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> 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()); XMLTools::XMLAttribute<wchar_t> space (_T( "w:space" ), FormatUtils::IntToWideString (m_arrSpace[i]).c_str());
col.AppendAttribute (w); col.AppendAttribute (w);
col.AppendAttribute (space); col.AppendAttribute (space);
cols.AppendChild (col); cols.AppendChild (col);
} }
} }
......
...@@ -268,7 +268,7 @@ namespace DocFileFormat ...@@ -268,7 +268,7 @@ namespace DocFileFormat
bool stroked = true; bool stroked = true;
bool filled = true; bool filled = true;
bool hasTextbox = false; bool hasTextbox = false;
bool layoutInCell = false; bool layoutInCell = true; //anmeldebogenfos.doc
int ndxTextLeft = -1; int ndxTextLeft = -1;
int ndyTextTop = -1; int ndyTextTop = -1;
......
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