for bug 53032

This commit is contained in:
Elena.Subbotina
2021-10-22 10:13:57 +03:00
parent 53f766271f
commit 8fe6e1ce23
7 changed files with 26 additions and 16 deletions

View File

@ -52,9 +52,9 @@ namespace DocFileFormat
m_bInternalXmlWriter = false;
_writeWebHidden = false;
_isSectionPageBreak = 0;
_isTextBoxContent = false;
m_context->_docx->_isSectionPageBreak = 0;
//--------------------------------------------
_embeddedObject = false;
}
@ -68,11 +68,12 @@ namespace DocFileFormat
m_bInternalXmlWriter = false;
_writeWebHidden = false;
_isSectionPageBreak = 0;
_isTextBoxContent = false;
_embeddedObject = false;
_cacheListNum = -1;
m_context->_docx->_isSectionPageBreak = 0;
}
DocumentMapping::~DocumentMapping()
@ -233,7 +234,7 @@ namespace DocFileFormat
}
//-----------------------------------------------------------
//_cacheListNum = getListNumCache(fc, fcEnd);
_isSectionPageBreak = 0;
m_context->_docx->_isSectionPageBreak = 0;
if (sectionEnd)
{
// this is the last paragraph of this section
@ -244,7 +245,7 @@ namespace DocFileFormat
ParagraphPropertiesMapping oMapping(m_pXmlWriter, m_context, m_document, paraEndChpx, isBidi, findValidSepx(cpEnd), _sectionNr);
papx->Convert(&oMapping);
_isSectionPageBreak = oMapping.get_section_page_break();
m_context->_docx->_isSectionPageBreak = oMapping.get_section_page_break();
}
++_sectionNr;
@ -360,6 +361,8 @@ namespace DocFileFormat
RELEASEOBJECT(chpxFcs);
RELEASEOBJECT(chpxs);
return cpEnd;
return (std::max)(cp, cpEnd); //ralph_scovile.doc
}
@ -823,9 +826,9 @@ namespace DocFileFormat
}
else if (TextMark::PageBreakOrSectionMark == code)
{
if (_isSectionPageBreak == 0 || _isSectionPageBreak == 2)
if (m_context->_docx->_isSectionPageBreak == 0 || m_context->_docx->_isSectionPageBreak == 2)
{
_isSectionPageBreak = -1;
m_context->_docx->_isSectionPageBreak = -1;
writeTextElement(text, textType);

View File

@ -154,7 +154,7 @@ namespace DocFileFormat
int _endnoteNr;
int _commentNr;
bool _isTextBoxContent;
int _isSectionPageBreak; //0 - not set, 1 -page break, 2 - continues, -1 - already
// int _isSectionPageBreak; //0 - not set, 1 -page break, 2 - continues, -1 - already
bool _writeWebHidden;
std::wstring _writeAfterRun;
std::wstring _lastOLEObject;

View File

@ -427,7 +427,8 @@ namespace DocFileFormat
}break;
case ODRAW::posrelh:
{
appendStyleProperty(strStyle, L"mso-position-horizontal-relative", VMLShapeMapping::mapHorizontalPositionRelative((PositionHorizontalRelative)iter->op));
if (false == m_inGroup)
appendStyleProperty(strStyle, L"mso-position-horizontal-relative", VMLShapeMapping::mapHorizontalPositionRelative((PositionHorizontalRelative)iter->op));
}break;
case ODRAW::posv:
{
@ -435,6 +436,7 @@ namespace DocFileFormat
}break;
case ODRAW::posrelv:
{
if (false == m_inGroup)
appendStyleProperty(strStyle, L"mso-position-vertical-relative", VMLShapeMapping::mapVerticalPositionRelative((PositionVerticalRelative)iter->op));
}break;
case ODRAW::groupShapeBooleanProperties:

View File

@ -1771,7 +1771,7 @@ namespace DocFileFormat
//за текстом (The shape is behind the text, so the z-index must be negative.)
m_isInlineShape = false;
if (false == bZIndex && false == m_inGroup)
if (false == bZIndex/* && false == m_inGroup*/) // Пример.doc
{
appendStyleProperty(oStyle, L"z-index", FormatUtils::IntToWideString(-zIndex - 0x7ffff));
bZIndex = true;
@ -1826,7 +1826,7 @@ namespace DocFileFormat
}
}
if (nRelH < 0 && m_pSpa)
if (nRelH < 0 && m_pSpa && false == m_inGroup)
{
//if (m_pSpa->bx == TEXT && bZIndex)
//{
@ -1839,7 +1839,7 @@ namespace DocFileFormat
else if (m_pSpa->bx == TEXT)
appendStyleProperty(oStyle, L"mso-position-horizontal-relative", mapHorizontalPositionRelative(msoprhText));
}
if (nRelV < 0 && m_pSpa)
if (nRelV < 0 && m_pSpa && false == m_inGroup)
{
//if (m_pSpa->by == TEXT && bZIndex)
//{

View File

@ -49,6 +49,7 @@ namespace DocFileFormat
WordprocessingDocument::~WordprocessingDocument()
{
_isSectionPageBreak = 0;
}
_UINT32 WordprocessingDocument::SaveDocument(bool &bMacros)

View File

@ -76,6 +76,8 @@ namespace DocFileFormat
std::list<std::wstring> FooterXMLList;
public:
int _isSectionPageBreak; //0 - not set, 1 -page break, 2 - continues, -1 - already
WordprocessingDocument(const std::wstring & _docxDirectory, const WordDocument* _docFile);
virtual ~WordprocessingDocument();

View File

@ -45,6 +45,8 @@
//CRYPT::_ecmaCryptData cryptDataGlobal; for Test
#define USE_MSSTORAGE
using namespace CRYPT;
#define GETBIT(from, num) ((from & (1 << num)) != 0)
@ -741,7 +743,7 @@ bool ECMACryptFile::EncryptOfficeFile(const std::wstring &file_name_inp, const s
//-------------------------------------------------------------------
#if defined(_WIN32) || defined(_WIN64)
#if (defined(_WIN32) || defined(_WIN64)) && defined(USE_MSSTORAGE)
IStorage *winStorage = NULL;
StgCreateDocfile(file_name_out.c_str(), STGM_CREATE|STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &winStorage);
@ -759,7 +761,7 @@ bool ECMACryptFile::EncryptOfficeFile(const std::wstring &file_name_inp, const s
POLE::Stream *pStream = NULL;
#endif
//-------------------------------------------------------------------
#if defined(_WIN32) || defined(_WIN64)
#if (defined(_WIN32) || defined(_WIN64)) && defined(USE_MSSTORAGE)
ULONG nWritten;
winStorage->CreateStream(L"EncryptedPackage", STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &winStream);
winStream->Write(data_out, lengthData, &nWritten);
@ -782,7 +784,7 @@ bool ECMACryptFile::EncryptOfficeFile(const std::wstring &file_name_inp, const s
cryptor.GetCryptData(cryptData);
#if defined(_WIN32) || defined(_WIN64)
#if (defined(_WIN32) || defined(_WIN64)) && defined(USE_MSSTORAGE)
winStorage->CreateStream(L"EncryptionInfo", STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &winStream);
if (cryptData.bAgile)
{
@ -876,7 +878,7 @@ bool ECMACryptFile::EncryptOfficeFile(const std::wstring &file_name_inp, const s
if (false == documentID.empty())
{
std::string utfDocumentID = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(documentID);
#if defined(_WIN32) || defined(_WIN64)
#if (defined(_WIN32) || defined(_WIN64)) && defined(USE_MSSTORAGE)
winStorage->CreateStream(L"DocumentID", STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &winStream);
winStream->Write((BYTE*)utfDocumentID.c_str(), utfDocumentID.length(), &nWritten);
winStream->Release();
@ -890,7 +892,7 @@ bool ECMACryptFile::EncryptOfficeFile(const std::wstring &file_name_inp, const s
#endif
}
//-------------------------------------------------------------------
#if defined(_WIN32) || defined(_WIN64)
#if (defined(_WIN32) || defined(_WIN64)) && defined(USE_MSSTORAGE)
if (winStorage)
winStorage->Release();
#else