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 ...@@ -16,6 +16,8 @@ namespace DocFileFormat
m_document = NULL; m_document = NULL;
m_context = context; m_context = context;
m_bInternalXmlWriter = false; m_bInternalXmlWriter = false;
_isSectionPageBreak = false;
} }
DocumentMapping::DocumentMapping(ConversionContext* context, XmlUtils::CXmlWriter* writer, IMapping* caller):_skipRuns(0), _lastValidPapx(NULL), _lastValidSepx(NULL), _writeInstrText(false), DocumentMapping::DocumentMapping(ConversionContext* context, XmlUtils::CXmlWriter* writer, IMapping* caller):_skipRuns(0), _lastValidPapx(NULL), _lastValidSepx(NULL), _writeInstrText(false),
...@@ -25,6 +27,8 @@ namespace DocFileFormat ...@@ -25,6 +27,8 @@ namespace DocFileFormat
m_document = NULL; m_document = NULL;
m_context = context; m_context = context;
m_bInternalXmlWriter = false; m_bInternalXmlWriter = false;
_isSectionPageBreak = false;
} }
DocumentMapping::~DocumentMapping() DocumentMapping::~DocumentMapping()
...@@ -166,6 +170,8 @@ namespace DocFileFormat ...@@ -166,6 +170,8 @@ namespace DocFileFormat
{ {
ParagraphPropertiesMapping oMapping(m_pXmlWriter, m_context, m_document, paraEndChpx, isBidi, findValidSepx(cpEnd), _sectionNr); ParagraphPropertiesMapping oMapping(m_pXmlWriter, m_context, m_document, paraEndChpx, isBidi, findValidSepx(cpEnd), _sectionNr);
papx->Convert(&oMapping); papx->Convert(&oMapping);
_isSectionPageBreak = oMapping.get_section_page_break();
} }
++_sectionNr; ++_sectionNr;
...@@ -268,6 +274,7 @@ namespace DocFileFormat ...@@ -268,6 +274,7 @@ namespace DocFileFormat
RELEASEOBJECT(chpxFcs); RELEASEOBJECT(chpxFcs);
RELEASEOBJECT(chpxs); RELEASEOBJECT(chpxs);
_isSectionPageBreak = false;
return cpEnd++; return cpEnd++;
} }
...@@ -464,7 +471,7 @@ namespace DocFileFormat ...@@ -464,7 +471,7 @@ namespace DocFileFormat
else if (TextMark::PageBreakOrSectionMark == c) else if (TextMark::PageBreakOrSectionMark == c)
{ {
//write page break, section breaks are written by writeParagraph() method //write page break, section breaks are written by writeParagraph() method
if (!isSectionEnd(c)) if (/*!isSectionEnd(c)*/_isSectionPageBreak == false)
{ {
writeTextElement(text, textType); writeTextElement(text, textType);
...@@ -475,6 +482,7 @@ namespace DocFileFormat ...@@ -475,6 +482,7 @@ namespace DocFileFormat
m_pXmlWriter->WriteString(elem.GetXMLString().c_str()); m_pXmlWriter->WriteString(elem.GetXMLString().c_str());
} }
_isSectionPageBreak = false;
} }
else if (TextMark::ColumnBreak == c) else if (TextMark::ColumnBreak == c)
{ {
......
...@@ -107,6 +107,7 @@ namespace DocFileFormat ...@@ -107,6 +107,7 @@ namespace DocFileFormat
int _footnoteNr; int _footnoteNr;
int _endnoteNr; int _endnoteNr;
int _commentNr; int _commentNr;
bool _isSectionPageBreak;
bool _writeInstrText; bool _writeInstrText;
unsigned int _fldCharCounter; unsigned int _fldCharCounter;
IMapping* _caller; IMapping* _caller;
......
...@@ -16,6 +16,7 @@ namespace DocFileFormat ...@@ -16,6 +16,7 @@ namespace DocFileFormat
_paraEndChpx = paraEndChpx; _paraEndChpx = paraEndChpx;
_isBidi = isBidi; _isBidi = isBidi;
_isSectionPageBreak = false;
} }
ParagraphPropertiesMapping::ParagraphPropertiesMapping( XmlUtils::CXmlWriter* writer, ConversionContext* context, WordDocument* document, CharacterPropertyExceptions* paraEndChpx, bool isBidi, SectionPropertyExceptions* sepx, int sectionNr, bool isParagraphStyleNeeded ) ParagraphPropertiesMapping::ParagraphPropertiesMapping( XmlUtils::CXmlWriter* writer, ConversionContext* context, WordDocument* document, CharacterPropertyExceptions* paraEndChpx, bool isBidi, SectionPropertyExceptions* sepx, int sectionNr, bool isParagraphStyleNeeded )
...@@ -30,6 +31,7 @@ namespace DocFileFormat ...@@ -30,6 +31,7 @@ namespace DocFileFormat
_paraEndChpx = paraEndChpx; _paraEndChpx = paraEndChpx;
_isBidi = isBidi; _isBidi = isBidi;
_isSectionPageBreak = false;
_sepx = sepx; _sepx = sepx;
_sectionNr = sectionNr; _sectionNr = sectionNr;
...@@ -44,14 +46,18 @@ namespace DocFileFormat ...@@ -44,14 +46,18 @@ namespace DocFileFormat
namespace DocFileFormat namespace DocFileFormat
{ {
bool ParagraphPropertiesMapping::get_section_page_break()
{
return _isSectionPageBreak;
}
void ParagraphPropertiesMapping::Apply( IVisitable* visited ) void ParagraphPropertiesMapping::Apply( IVisitable* visited )
{ {
ParagraphPropertyExceptions* papx = static_cast<ParagraphPropertyExceptions*>( visited ); ParagraphPropertyExceptions* papx = static_cast<ParagraphPropertyExceptions*>( visited );
XMLTools::XMLElement<wchar_t> ind( _T( "w:ind" ) ); XMLTools::XMLElement<wchar_t> ind ( _T( "w:ind" ) );
XMLTools::XMLElement<wchar_t> numPr( _T( "w:numPr" ) ); XMLTools::XMLElement<wchar_t> numPr ( _T( "w:numPr" ) );
XMLTools::XMLElement<wchar_t> pBdr( _T( "w:pBdr" ) ); XMLTools::XMLElement<wchar_t> pBdr ( _T( "w:pBdr" ) );
XMLTools::XMLElement<wchar_t> spacing( _T( "w:spacing" ) ); XMLTools::XMLElement<wchar_t> spacing ( _T( "w:spacing" ) );
XMLTools::XMLElement<wchar_t>* jc = NULL; XMLTools::XMLElement<wchar_t>* jc = NULL;
if ( this->_isParagraphStyleNeeded ) if ( this->_isParagraphStyleNeeded )
...@@ -551,6 +557,13 @@ namespace DocFileFormat ...@@ -551,6 +557,13 @@ namespace DocFileFormat
XMLTools::XMLElement<wchar_t> sectPr( _T( "w:sectPr" ) ); XMLTools::XMLElement<wchar_t> sectPr( _T( "w:sectPr" ) );
SectionPropertiesMapping* sectionPropertiesMapping = new SectionPropertiesMapping( &sectPr, this->m_context, this->_sectionNr ); SectionPropertiesMapping* sectionPropertiesMapping = new SectionPropertiesMapping( &sectPr, this->m_context, this->_sectionNr );
_sepx->Convert( sectionPropertiesMapping ); _sepx->Convert( sectionPropertiesMapping );
if (sectionPropertiesMapping->get_section_type() == L"nextPage")
{
// - br page
//Vinci_Customer_Case_Study.doc
_isSectionPageBreak = true;
}
RELEASEOBJECT( sectionPropertiesMapping ); RELEASEOBJECT( sectionPropertiesMapping );
_pPr->AppendChild( sectPr ); _pPr->AppendChild( sectPr );
} }
......
...@@ -20,6 +20,8 @@ namespace DocFileFormat ...@@ -20,6 +20,8 @@ namespace DocFileFormat
virtual ~ParagraphPropertiesMapping(); virtual ~ParagraphPropertiesMapping();
void Apply(IVisitable* visited); void Apply(IVisitable* visited);
bool get_section_page_break();
private: private:
WordDocument* m_document; WordDocument* m_document;
ConversionContext* m_context; ConversionContext* m_context;
...@@ -32,5 +34,7 @@ namespace DocFileFormat ...@@ -32,5 +34,7 @@ namespace DocFileFormat
bool _isParagraphStyleNeeded; bool _isParagraphStyleNeeded;
bool _isBidi; bool _isBidi;
bool _isSectionPageBreak;
}; };
} }
...@@ -491,6 +491,10 @@ namespace DocFileFormat ...@@ -491,6 +491,10 @@ namespace DocFileFormat
parent->AppendChild (headerRef); 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) bool SectionPropertiesMapping::WriteSectionStory (CharacterRange* pRange, const std::wstring& StoryType, const std::wstring& Story)
{ {
if ( pRange ) if ( pRange )
......
...@@ -133,14 +133,13 @@ namespace DocFileFormat ...@@ -133,14 +133,13 @@ namespace DocFileFormat
// Converts the given SectionPropertyExceptions // Converts the given SectionPropertyExceptions
virtual void Apply (IVisitable* visited); virtual void Apply (IVisitable* visited);
const std::wstring & get_section_type();
private: private:
void AppendRef (XMLTools::XMLElement<wchar_t>* pBaseNode, const wchar_t* element, const wchar_t* refType, const wchar_t* refId); 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); bool WriteSectionStory (CharacterRange* pRange, const std::wstring& StoryType, const std::wstring& Story);
private:
XMLTools::XMLElement<wchar_t>* m_pXmlNode; XMLTools::XMLElement<wchar_t>* m_pXmlNode;
bool m_bDeleteNode; 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