Commit e6f9466b authored by Elen.Subbotina's avatar Elen.Subbotina Committed by Alexander Trofimov

DocFormat - убран двойной разрыв страницы при завершении секции - Vinci_Customer_Case_Study.doc

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@67921 954022d7-b5bf-4e40-9824-e11837661b57
parent f3acde01
......@@ -16,6 +16,8 @@ namespace DocFileFormat
m_document = NULL;
m_context = context;
m_bInternalXmlWriter = false;
_isSectionPageBreak = false;
}
DocumentMapping::DocumentMapping(ConversionContext* context, XmlUtils::CXmlWriter* writer, IMapping* caller):_skipRuns(0), _lastValidPapx(NULL), _lastValidSepx(NULL), _writeInstrText(false),
......@@ -25,6 +27,8 @@ namespace DocFileFormat
m_document = NULL;
m_context = context;
m_bInternalXmlWriter = false;
_isSectionPageBreak = false;
}
DocumentMapping::~DocumentMapping()
......@@ -119,11 +123,11 @@ namespace DocFileFormat
int DocumentMapping::writeParagraph (int initialCp, int cpEnd, bool sectionEnd)
{
int cp = initialCp;
int fc = m_document->FindFileCharPos(cp);
int fcEnd = m_document->FindFileCharPos(cpEnd);
ParagraphPropertyExceptions* papx = findValidPapx(fc);
int cp = initialCp;
int fc = m_document->FindFileCharPos(cp);
int fcEnd = m_document->FindFileCharPos(cpEnd);
ParagraphPropertyExceptions* papx = findValidPapx(fc);
// get all CHPX between these boundaries to determine the count of runs
......@@ -166,6 +170,8 @@ namespace DocFileFormat
{
ParagraphPropertiesMapping oMapping(m_pXmlWriter, m_context, m_document, paraEndChpx, isBidi, findValidSepx(cpEnd), _sectionNr);
papx->Convert(&oMapping);
_isSectionPageBreak = oMapping.get_section_page_break();
}
++_sectionNr;
......@@ -268,6 +274,7 @@ namespace DocFileFormat
RELEASEOBJECT(chpxFcs);
RELEASEOBJECT(chpxs);
_isSectionPageBreak = false;
return cpEnd++;
}
......@@ -464,7 +471,7 @@ namespace DocFileFormat
else if (TextMark::PageBreakOrSectionMark == c)
{
//write page break, section breaks are written by writeParagraph() method
if (!isSectionEnd(c))
if (/*!isSectionEnd(c)*/_isSectionPageBreak == false)
{
writeTextElement(text, textType);
......@@ -475,6 +482,7 @@ namespace DocFileFormat
m_pXmlWriter->WriteString(elem.GetXMLString().c_str());
}
_isSectionPageBreak = false;
}
else if (TextMark::ColumnBreak == c)
{
......
......@@ -107,6 +107,7 @@ namespace DocFileFormat
int _footnoteNr;
int _endnoteNr;
int _commentNr;
bool _isSectionPageBreak;
bool _writeInstrText;
unsigned int _fldCharCounter;
IMapping* _caller;
......
......@@ -14,8 +14,9 @@ namespace DocFileFormat
_pPr = new XMLTools::XMLElement<wchar_t>( _T( "w:pPr" ) );
_framePr = new XMLTools::XMLElement<wchar_t>( _T( "w:framePr" ) );
_paraEndChpx = paraEndChpx;
_isBidi = isBidi;
_paraEndChpx = paraEndChpx;
_isBidi = isBidi;
_isSectionPageBreak = false;
}
ParagraphPropertiesMapping::ParagraphPropertiesMapping( XmlUtils::CXmlWriter* writer, ConversionContext* context, WordDocument* document, CharacterPropertyExceptions* paraEndChpx, bool isBidi, SectionPropertyExceptions* sepx, int sectionNr, bool isParagraphStyleNeeded )
......@@ -28,11 +29,12 @@ namespace DocFileFormat
_pPr = new XMLTools::XMLElement<wchar_t>( _T( "w:pPr" ) );
_framePr = new XMLTools::XMLElement<wchar_t>( _T( "w:framePr" ) );
_paraEndChpx = paraEndChpx;
_isBidi = isBidi;
_paraEndChpx = paraEndChpx;
_isBidi = isBidi;
_isSectionPageBreak = false;
_sepx = sepx;
_sectionNr = sectionNr;
_sepx = sepx;
_sectionNr = sectionNr;
}
ParagraphPropertiesMapping::~ParagraphPropertiesMapping()
......@@ -44,14 +46,18 @@ namespace DocFileFormat
namespace DocFileFormat
{
bool ParagraphPropertiesMapping::get_section_page_break()
{
return _isSectionPageBreak;
}
void ParagraphPropertiesMapping::Apply( IVisitable* visited )
{
ParagraphPropertyExceptions* papx = static_cast<ParagraphPropertyExceptions*>( visited );
XMLTools::XMLElement<wchar_t> ind( _T( "w:ind" ) );
XMLTools::XMLElement<wchar_t> numPr( _T( "w:numPr" ) );
XMLTools::XMLElement<wchar_t> pBdr( _T( "w:pBdr" ) );
XMLTools::XMLElement<wchar_t> spacing( _T( "w:spacing" ) );
XMLTools::XMLElement<wchar_t> ind ( _T( "w:ind" ) );
XMLTools::XMLElement<wchar_t> numPr ( _T( "w:numPr" ) );
XMLTools::XMLElement<wchar_t> pBdr ( _T( "w:pBdr" ) );
XMLTools::XMLElement<wchar_t> spacing ( _T( "w:spacing" ) );
XMLTools::XMLElement<wchar_t>* jc = NULL;
if ( this->_isParagraphStyleNeeded )
......@@ -551,6 +557,13 @@ namespace DocFileFormat
XMLTools::XMLElement<wchar_t> sectPr( _T( "w:sectPr" ) );
SectionPropertiesMapping* sectionPropertiesMapping = new SectionPropertiesMapping( &sectPr, this->m_context, this->_sectionNr );
_sepx->Convert( sectionPropertiesMapping );
if (sectionPropertiesMapping->get_section_type() == L"nextPage")
{
// - br page
//Vinci_Customer_Case_Study.doc
_isSectionPageBreak = true;
}
RELEASEOBJECT( sectionPropertiesMapping );
_pPr->AppendChild( sectPr );
}
......
......@@ -20,6 +20,8 @@ namespace DocFileFormat
virtual ~ParagraphPropertiesMapping();
void Apply(IVisitable* visited);
bool get_section_page_break();
private:
WordDocument* m_document;
ConversionContext* m_context;
......@@ -32,5 +34,7 @@ namespace DocFileFormat
bool _isParagraphStyleNeeded;
bool _isBidi;
bool _isSectionPageBreak;
};
}
......@@ -491,6 +491,10 @@ namespace DocFileFormat
parent->AppendChild (headerRef);
}
const std::wstring & SectionPropertiesMapping::get_section_type()
{
return _type;
}
bool SectionPropertiesMapping::WriteSectionStory (CharacterRange* pRange, const std::wstring& StoryType, const std::wstring& Story)
{
if ( pRange )
......
......@@ -133,14 +133,13 @@ namespace DocFileFormat
// Converts the given SectionPropertyExceptions
virtual void Apply (IVisitable* visited);
const std::wstring & get_section_type();
private:
void AppendRef (XMLTools::XMLElement<wchar_t>* pBaseNode, const wchar_t* element, const wchar_t* refType, const wchar_t* refId);
bool WriteSectionStory (CharacterRange* pRange, const std::wstring& StoryType, const std::wstring& Story);
private:
XMLTools::XMLElement<wchar_t>* m_pXmlNode;
bool m_bDeleteNode;
......
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