"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/Plugins/Pdf/PDFWriter/PDFDocumentHandler.cpp" between
TeXmacs-1.99.4-src.tar.gz and TeXmacs-1.99.5-src.tar.gz

About: GNU TeXmacs is a what-you-see-is-what-you-get scientific text editor, which was both inspired by TeX and GNU Emacs.

PDFDocumentHandler.cpp  (TeXmacs-1.99.4-src):PDFDocumentHandler.cpp  (TeXmacs-1.99.5-src)
skipping to change at line 954 skipping to change at line 954
return result; return result;
} }
EStatusCodeAndObjectIDType PDFDocumentHandler::CreatePDFPageForPage(unsigned lon g inPageIndex) EStatusCodeAndObjectIDType PDFDocumentHandler::CreatePDFPageForPage(unsigned lon g inPageIndex)
{ {
RefCountPtr<PDFDictionary> pageObject = mParser->ParsePage(inPageIndex); RefCountPtr<PDFDictionary> pageObject = mParser->ParsePage(inPageIndex);
EStatusCodeAndObjectIDType result; EStatusCodeAndObjectIDType result;
result.first = PDFHummus::eFailure; result.first = PDFHummus::eFailure;
result.second = 0; result.second = 0;
PDFPage* newPage = NULL;
if(!pageObject) if(!pageObject)
{ {
TRACE_LOG1("PDFDocumentHandler::CreatePDFPageForPage, unhexpected exception, page index does not denote a page object. page index = %ld",inPageIn dex); TRACE_LOG1("PDFDocumentHandler::CreatePDFPageForPage, unhexpected exception, page index does not denote a page object. page index = %ld",inPageIn dex);
return result; return result;
} }
EStatusCode status = PDFHummus::eSuccess; EStatusCode status = PDFHummus::eSuccess;
IDocumentContextExtenderSet::iterator it = mExtenders.begin(); IDocumentContextExtenderSet::iterator it = mExtenders.begin();
for(; it != mExtenders.end() && PDFHummus::eSuccess == status; ++it) for(; it != mExtenders.end() && PDFHummus::eSuccess == status; ++it)
{ {
status = (*it)->OnBeforeCreatePageFromPage(pageObject.GetPtr(),mO bjectsContext,mDocumentContext,this); status = (*it)->OnBeforeCreatePageFromPage(pageObject.GetPtr(),mO bjectsContext,mDocumentContext,this);
if(status != PDFHummus::eSuccess) if(status != PDFHummus::eSuccess)
TRACE_LOG("DocumentContext::CreatePDFPageForPage, unexpec ted failure. extender declared failure before writing page."); TRACE_LOG("DocumentContext::CreatePDFPageForPage, unexpec ted failure. extender declared failure before writing page.");
} }
if(status != PDFHummus::eSuccess) if(status != PDFHummus::eSuccess)
return result; return result;
// Create a new form XObject
PDFPage newPage;
do do
{ {
if(CopyResourcesIndirectObjects(pageObject.GetPtr()) != PDFHummus ::eSuccess) if(CopyResourcesIndirectObjects(pageObject.GetPtr()) != PDFHummus ::eSuccess)
break; break;
// Create a new form XObject PDFPageInput pageInput(mParser,pageObject);
newPage = new PDFPage(); newPage.SetMediaBox(pageInput.GetMediaBox());
newPage.SetRotate(pageInput.GetRotate());
newPage->SetMediaBox(PDFPageInput(mParser,pageObject).GetMediaBox
());
// copy the page content to the target page content // copy the page content to the target page content
if(CopyPageContentToTargetPage(newPage,pageObject.GetPtr()) != PD if(CopyPageContentToTargetPage(&newPage,pageObject.GetPtr()) != P
FHummus::eSuccess) DFHummus::eSuccess)
{
delete newPage;
newPage = NULL;
break; break;
}
// resources dictionary is gonna be empty at this point...so we c an use our own code to write the dictionary, by extending. // resources dictionary is gonna be empty at this point...so we c an use our own code to write the dictionary, by extending.
// which will be a simple loop. note that at this point all indir ect objects should have been copied, and have mapping // which will be a simple loop. note that at this point all indir ect objects should have been copied, and have mapping
mDocumentContext->AddDocumentContextExtender(this); mDocumentContext->AddDocumentContextExtender(this);
mWrittenPage = pageObject.GetPtr(); mWrittenPage = pageObject.GetPtr();
result = mDocumentContext->WritePage(newPage); result = mDocumentContext->WritePage(&newPage);
if(result.first != PDFHummus::eSuccess) if(result.first != PDFHummus::eSuccess)
{
delete newPage;
newPage = NULL;
break; break;
}
}while(false); }while(false);
mWrittenPage = NULL; mWrittenPage = NULL;
mDocumentContext->RemoveDocumentContextExtender(this); mDocumentContext->RemoveDocumentContextExtender(this);
if(result.first == PDFHummus::eSuccess) if(result.first == PDFHummus::eSuccess)
{ {
it = mExtenders.begin(); it = mExtenders.begin();
for(; it != mExtenders.end() && PDFHummus::eSuccess == result.fir st; ++it) for(; it != mExtenders.end() && PDFHummus::eSuccess == result.fir st; ++it)
{ {
result.first = (*it)->OnAfterCreatePageFromPage(newPage,p ageObject.GetPtr(),mObjectsContext,mDocumentContext,this); result.first = (*it)->OnAfterCreatePageFromPage(&newPage, pageObject.GetPtr(),mObjectsContext,mDocumentContext,this);
if(result.first != PDFHummus::eSuccess) if(result.first != PDFHummus::eSuccess)
TRACE_LOG("DocumentContext::CreatePDFFormXObjectF orPage, unexpected failure. extender declared failure after writing page."); TRACE_LOG("DocumentContext::CreatePDFFormXObjectF orPage, unexpected failure. extender declared failure after writing page.");
} }
} }
delete newPage;
return result; return result;
} }
EStatusCode PDFDocumentHandler::CopyPageContentToTargetPage(PDFPage* inPage,PDFD ictionary* inPageObject) EStatusCode PDFDocumentHandler::CopyPageContentToTargetPage(PDFPage* inPage,PDFD ictionary* inPageObject)
{ {
EStatusCode status = PDFHummus::eSuccess; EStatusCode status = PDFHummus::eSuccess;
RefCountPtr<PDFObject> pageContent(mParser->QueryDictionaryObject(inPageO bject,"Contents")); RefCountPtr<PDFObject> pageContent(mParser->QueryDictionaryObject(inPageO bject,"Contents"));
// for empty page, do nothing // for empty page, do nothing
skipping to change at line 1317 skipping to change at line 1308
// clearing the source to target mapping here. note that copying enjoyed sharing of objects between them // clearing the source to target mapping here. note that copying enjoyed sharing of objects between them
mSourceToTarget.clear(); mSourceToTarget.clear();
if(mParserOwned) if(mParserOwned)
{ {
if(mParser) if(mParser)
{ {
mParser->ResetParser(); mParser->ResetParser();
delete mParser; delete mParser;
} }
mParser = NULL; mParser = NULL;
mParserOwned = NULL; mParserOwned = false;
} }
} }
void PDFDocumentHandler::AddDocumentContextExtender(IDocumentContextExtender* in Extender) void PDFDocumentHandler::AddDocumentContextExtender(IDocumentContextExtender* in Extender)
{ {
mExtenders.insert(inExtender); mExtenders.insert(inExtender);
} }
void PDFDocumentHandler::RemoveDocumentContextExtender(IDocumentContextExtender* inExtender) void PDFDocumentHandler::RemoveDocumentContextExtender(IDocumentContextExtender* inExtender)
 End of changes. 11 change blocks. 
21 lines changed or deleted 11 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS