r22425 by jghali -

scribus-commit scribus-commit at lists.scribus.net
Thu Mar 8 17:51:55 UTC 2018


Author: jghali
Date: Thu Mar  8 17:51:55 2018
New Revision: 22425

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22425
Log:
#15185: Nested Bookmarks fail to export properly to PDF

Modified:
    trunk/Scribus/scribus/pdflib_core.cpp
    trunk/Scribus/scribus/pdfwriter.h

Modified: trunk/Scribus/scribus/pdflib_core.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22425&path=/trunk/Scribus/scribus/pdflib_core.cpp
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.cpp	(original)
+++ trunk/Scribus/scribus/pdflib_core.cpp	Thu Mar  8 17:51:55 2018
@@ -10922,23 +10922,22 @@
 {
 	if (writer.OutlinesObj == 0)
 		return;
-
-	BookMItem* ip;
-	QByteArray Inhal = "";
-	QMap<int,QByteArray> Inha;
+	
+	QByteArray Inhal;
+	QMap<int, QByteArray> Inha;
 	if ((Bvie->topLevelItemCount() != 0) && (Options.Bookmarks) && (BookMinUse))
 	{
+		BookMItem* ip = (BookMItem*) Bvie->topLevelItem(0);
+		PdfId Basis = writer.objectCounter() - 1;
 		Outlines.Count = Bvie->topLevelItemCount();
-		PdfId Basis = writer.reserveObjects(Outlines.Count) - 1;
-		ip = (BookMItem*)Bvie->topLevelItem(0);
-		Outlines.First = ip->ItemNr+Basis;
-		Outlines.Last  = ((BookMItem*) Bvie->topLevelItem(Outlines.Count - 1))->ItemNr+Basis;
+		Outlines.First = ip->ItemNr + Basis;
+		Outlines.Last  = ((BookMItem*) Bvie->topLevelItem(Outlines.Count - 1))->ItemNr + Basis;
 		QTreeWidgetItemIterator it(Bvie);
 		while (*it)
 		{
 			ip = (BookMItem*)(*it);
 			QString encText = ip->text(0);
-			Inhal  = ""; //Pdf::toPdf(ip->ItemNr+Basis)+ " 0 obj\n";
+			Inhal.clear();
 			Inhal += "<<\n/Title " + EncStringUTF16(encText, ip->ItemNr+Basis) + "\n";
 			if (ip->Pare == 0)
 				Inhal += "/Parent 3 0 R\n";
@@ -10970,6 +10969,7 @@
 			++it;
 		}
 		QMap<int,QByteArray> ::ConstIterator contentIt;
+		writer.reserveObjects(Inha.count());
 		for (contentIt = Inha.begin(); contentIt != Inha.end(); ++contentIt)
 		{
 			int itemNr = contentIt.key();

Modified: trunk/Scribus/scribus/pdfwriter.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22425&path=/trunk/Scribus/scribus/pdfwriter.h
==============================================================================
--- trunk/Scribus/scribus/pdfwriter.h	(original)
+++ trunk/Scribus/scribus/pdfwriter.h	Thu Mar  8 17:51:55 2018
@@ -184,6 +184,7 @@
 	void write(const PdfFont font);
 
 	// objects
+	PdfId objectCounter() const { return m_ObjCounter; }
 	PdfId reserveObjects(unsigned int n);
 	
 	PdfId newObject() { return reserveObjects(1); }




More information about the scribus-commit mailing list