# HG changeset patch
# User insilmaril
# Date 1143117534 0
# Node ID d3080e02b13a47f4ae0660c0cd3161f23747051c
# Parent  174dd40bf06ac8cd606757ab2aa352eef7b9cd59
Version 1.7.12

diff -r 174dd40bf06a -r d3080e02b13a branchobj.cpp
--- a/branchobj.cpp	Wed Mar 15 15:54:32 2006 +0000
+++ b/branchobj.cpp	Thu Mar 23 12:38:54 2006 +0000
@@ -359,6 +359,7 @@
 		standardFlags->setVisibility(v);
 		LinkableMapObj::setVisibility (v);
 		
+		// Only change childs, if I am not scrolled
 		if (!scrolled && (depth < toDepth))
 		{
 			// Now go recursivly through all childs
@@ -696,8 +697,41 @@
 	requestReposition();
 }
 
+void BranchObj::setHideTmp (HideTmpMode mode)
+{
+	if (mode==HideExport && hasHiddenExportParent(this))
+	{
+		setVisibility (false);
+		hidden=true;
+	}else
+	{
+		setVisibility (true);
+		hidden=false;
+	}	
+
+    BranchObj *bo;
+    for (bo=branch.first(); bo; bo=branch.next() )
+		bo->setHideTmp (mode);
+}
+
+bool BranchObj::hasHiddenExportParent(BranchObj *start)
+{
+	// Calls parents recursivly to
+	// find out, if we are temp. hidden
+
+	if (hideExport) return true;
+
+	BranchObj* bo=(BranchObj*)(parObj);
+	if (bo) 
+		return bo->hasHiddenExportParent(start);
+	else
+		return false;
+}
+
 QString BranchObj::saveToDir (const QString &tmpdir,const QString &prefix, const QPoint& offset)
 {
+	if (hidden) return "";
+
     QString s,a;
 	QString scrolledAttr;
 	if (scrolled) 
@@ -1163,9 +1197,10 @@
 	cout << "BO::alignRelTo "<<getHeading()<<endl;
 	cout << "  d="<<depth<<
 		"  ref="<<ref<<
-		"  bbTot="<<bboxTotal.topLeft()<<
+//		"  bbox.topLeft="<<bboxTotal.topLeft()<<
 		"  absPos="<<absPos<<
-		"  pad="<<topPad<<","<<botPad<<","<<leftPad<<","<<rightPad<<
+//		"  pad="<<topPad<<","<<botPad<<","<<leftPad<<","<<rightPad<<
+		"  hidden="<<hidden<<
 		"  th="<<th<<endl;
 */
 
@@ -1218,8 +1253,11 @@
     BranchObj *b;
     for (b=branch.first(); b; b=branch.next() )
     {	
-		b->alignRelativeTo (ref2);
-		ref2.setY(ref2.y() + b->getBBoxSizeWithChilds().height() );
+		if (!b->isHidden())
+		{
+			b->alignRelativeTo (ref2);
+			ref2.setY(ref2.y() + b->getBBoxSizeWithChilds().height() );
+		}
     }
 }
 
@@ -1265,11 +1303,13 @@
 
 	BranchObj* b;
 	for (b=branch.first();b ;b=branch.next() )
-		r=addBBox(b->getTotalBBox(),r);
+		if (!b->isHidden())
+			r=addBBox(b->getTotalBBox(),r);
 
 	FloatImageObj* fio;
 	for (fio=floatimage.first();fio ;fio=floatimage.next() )
-		r=addBBox(fio->getTotalBBox(),r);
+		if (!fio->isHidden())
+			r=addBBox(fio->getTotalBBox(),r);
 		
 	return r;
 }
@@ -1299,6 +1339,22 @@
 		return;
 	}
 	
+	if (hidden)
+	{
+		bboxTotal.setWidth (0);
+		bboxTotal.setHeight(0);
+		if (parObj)
+		{
+			bboxTotal.setX (parObj->x());
+			bboxTotal.setY (parObj->y());
+		} else
+		{
+			bboxTotal.setX (bbox.x());
+			bboxTotal.setY (bbox.y());
+		}
+		return;
+	}
+	
 	QRect r(0,0,0,0);
 	QRect br;
 	// Now calculate recursivly
@@ -1308,11 +1364,14 @@
 	BranchObj* b;
 	for (b=branch.first();b ;b=branch.next() )
 	{
-		b->calcBBoxSizeWithChilds();
-		br=b->getBBoxSizeWithChilds();
-		r.setWidth( max (br.width(), r.width() ));
-		r.setHeight(br.height() + r.height() );
-		if (br.y()<bboxTotal.y()) bboxTotal.setY(br.y());
+		if (!b->isHidden())
+		{
+			b->calcBBoxSizeWithChilds();
+			br=b->getBBoxSizeWithChilds();
+			r.setWidth( max (br.width(), r.width() ));
+			r.setHeight(br.height() + r.height() );
+			if (br.y()<bboxTotal.y()) bboxTotal.setY(br.y());
+		}
 	}
 	// Add myself and also
 	// add width of link to sum if necessary
@@ -1322,8 +1381,6 @@
 		bboxTotal.setWidth (bbox.width() + r.width() + linkwidth);
 	
 	bboxTotal.setHeight(max (r.height(),  bbox.height()));
-//	frame->setRect(QRect(bbox.x(),bbox.y(),bbox.width(),bbox.height() ) );
-
 }
 
 void BranchObj::select()
@@ -1355,12 +1412,6 @@
 	// Update Toolbar
 	standardFlags->updateToolbar();
 
-	// Update Browserbutton
-	if (!url.isEmpty())
-		actionEditOpenURL->setEnabled (true);
-	else	
-		actionEditOpenURL->setEnabled (false);
-
 	// Update actions in mapeditor
 	mapEditor->updateActions();
 }
diff -r 174dd40bf06a -r d3080e02b13a branchobj.h
--- a/branchobj.h	Wed Mar 15 15:54:32 2006 +0000
+++ b/branchobj.h	Thu Mar 23 12:38:54 2006 +0000
@@ -12,6 +12,7 @@
 };
 
 enum BranchModification {NewBranch, MovedBranch};
+enum HideTmpMode {HideNone, HideExport};
 
 /////////////////////////////////////////////////////////////////////////////
 class BranchObj:public OrnamentedObj {
@@ -60,6 +61,10 @@
 	virtual void setDockPos();
     virtual LinkableMapObj* findMapObj(QPoint,LinkableMapObj*);	// find MapObj 
     virtual void setHeading (QString);
+
+	virtual void setHideTmp (HideTmpMode);
+	virtual bool hasHiddenExportParent (BranchObj*);
+
 	virtual QString saveToDir (const QString&,const QString&, const QPoint&);// Save data recursivly to tempdir
 	virtual void addXLink (XLinkObj*);
 	virtual void removeXLinkRef (XLinkObj*);// Remove ref in list
diff -r 174dd40bf06a -r d3080e02b13a demos/todo.vym
Binary file demos/todo.vym has changed
diff -r 174dd40bf06a -r d3080e02b13a exports.cpp
--- a/exports.cpp	Wed Mar 15 15:54:32 2006 +0000
+++ b/exports.cpp	Thu Mar 23 12:38:54 2006 +0000
@@ -131,30 +131,27 @@
 	bo=mapCenter->first();
 	while (bo) 
 	{
-		if (!bo->hideInExport())
+		// Make indentstring
+		for (i=0;i<bo->getDepth();i++) actIndent+= indentPerDepth;
+
+		if (bo->getDepth()==0)
 		{
-			// Make indentstring
-			for (i=0;i<bo->getDepth();i++) actIndent+= indentPerDepth;
-
-			if (bo->getDepth()==0)
-			{
-				ts << (bo->getHeading()+ "\n");
-				for (j=0;j<bo->getHeading().length();j++) ts<<"=";
-				ts << "\n";
-			} else 	if (bo->getDepth()==1)
-				ts << ("\n"+getSectionString(bo) + bo->getHeading()+ "\n");
-			else	if (bo->getDepth()==2)
-				ts << (actIndent + " o " + bo->getHeading()+ "\n");
-			else	
-				ts << (actIndent + " - " + bo->getHeading()+ "\n");
-			
-			// If necessary, write note
-			if (!bo->getNote().isEmpty())
-			{
-				s =bo->getNoteASCII();
-				s=s.replace ("\n","\n"+actIndent);
-				ts << (s+"\n\n");
-			}
+			ts << (bo->getHeading()+ "\n");
+			for (j=0;j<bo->getHeading().length();j++) ts<<"=";
+			ts << "\n";
+		} else 	if (bo->getDepth()==1)
+			ts << ("\n"+getSectionString(bo) + bo->getHeading()+ "\n");
+		else	if (bo->getDepth()==2)
+			ts << (actIndent + " o " + bo->getHeading()+ "\n");
+		else	
+			ts << (actIndent + " - " + bo->getHeading()+ "\n");
+		
+		// If necessary, write note
+		if (!bo->getNote().isEmpty())
+		{
+			s =bo->getNoteASCII();
+			s=s.replace ("\n","\n"+actIndent);
+			ts << (s+"\n\n");
 		}
 		bo=bo->next();
 		actIndent="";
@@ -226,31 +223,28 @@
   BranchObj *bo;
   bo=mapCenter->first();
   while (bo) {
-	if (!bo->hideInExport())
-	{
-		if (bo->getDepth()==0);
-		else if (bo->getDepth()==1) {
-		  ts << ("\\chapter{" + bo->getHeading()+ "}\n");
-		}
-		else if (bo->getDepth()==2) {
-		  ts << ("\\section{" + bo->getHeading()+ "}\n");
-		}
-		else if (bo->getDepth()==3) {
-		  ts << ("\\subsection{" + bo->getHeading()+ "}\n");
-		}
-		else if (bo->getDepth()==4) {
-		  ts << ("\\subsubsection{" + bo->getHeading()+ "}\n");
-		}
-		else {
-		  ts << ("\\paragraph*{" + bo->getHeading()+ "}\n");
-		}
-		
-		// If necessary, write note
-		if (!bo->getNote().isEmpty()) {
-		  ts << (bo->getNoteASCII());
-		  ts << ("\n");
-		}
-    }
+	if (bo->getDepth()==0);
+	else if (bo->getDepth()==1) {
+	  ts << ("\\chapter{" + bo->getHeading()+ "}\n");
+	}
+	else if (bo->getDepth()==2) {
+	  ts << ("\\section{" + bo->getHeading()+ "}\n");
+	}
+	else if (bo->getDepth()==3) {
+	  ts << ("\\subsection{" + bo->getHeading()+ "}\n");
+	}
+	else if (bo->getDepth()==4) {
+	  ts << ("\\subsubsection{" + bo->getHeading()+ "}\n");
+	}
+	else {
+	  ts << ("\\paragraph*{" + bo->getHeading()+ "}\n");
+	}
+	
+	// If necessary, write note
+	if (!bo->getNote().isEmpty()) {
+	  ts << (bo->getNoteASCII());
+	  ts << ("\n");
+	}
     bo=bo->next();
    }
   file.close();
@@ -279,17 +273,14 @@
         r+="<text:list text:style-name=\"vym-list\">\n";
         while (bo)
         {
-			if (!bo->hideInExport())
-			{
-				r+="<text:list-item><text:p >";
-				r+=quotemeta(bo->getHeading());
-				// If necessary, write note
-				if (!bo->getNote().isEmpty())
-					r+=bo->getNoteOpenDoc();
-				r+="</text:p>";
-				r+=buildList (bo);	// recursivly add deeper branches
-				r+="</text:list-item>\n";
-			}
+			r+="<text:list-item><text:p >";
+			r+=quotemeta(bo->getHeading());
+			// If necessary, write note
+			if (!bo->getNote().isEmpty())
+				r+=bo->getNoteOpenDoc();
+			r+="</text:p>";
+			r+=buildList (bo);	// recursivly add deeper branches
+			r+="</text:list-item>\n";
 			i++;
 			bo=current->getBranchNum(i);
         }
@@ -337,14 +328,11 @@
 		while (pagesBO)
 		{
 			// Add page with list of items
-			if (!pagesBO->hideInExport())
-			{
-				onePage=pageTemplate;
-				onePage.replace ("<!-- INSERT PAGE HEADING -->", quotemeta (pagesBO->getHeading() ) );
-				list=buildList (pagesBO);
-				onePage.replace ("<!-- INSERT LIST -->", list);
-				allPages+=onePage;
-			}
+			onePage=pageTemplate;
+			onePage.replace ("<!-- INSERT PAGE HEADING -->", quotemeta (pagesBO->getHeading() ) );
+			list=buildList (pagesBO);
+			onePage.replace ("<!-- INSERT LIST -->", list);
+			allPages+=onePage;
 			j++;
 			pagesBO=sectionBO->getBranchNum(j);
 		}
diff -r 174dd40bf06a -r d3080e02b13a exportxhtmldialog.ui.h
--- a/exportxhtmldialog.ui.h	Wed Mar 15 15:54:32 2006 +0000
+++ b/exportxhtmldialog.ui.h	Thu Mar 23 12:38:54 2006 +0000
@@ -22,7 +22,7 @@
 void ExportXHTMLDialog::readSettings()
 {
 
-	dir=settings.readLocalEntry (filepath,"/vym/export/xhtml/exportDir","./" );
+	dir=settings.readLocalEntry (filepath,"/vym/export/xhtml/exportDir",vymBaseDir.current().path() );
 	lineEditDir->setText(dir);
 	
     if ( settings.readLocalEntry (filepath,"/vym/export/xhtml/useImage","yes")=="yes")
@@ -331,6 +331,8 @@
 	
 	p.setOutputFile (dir+mapname+".html");
 	p.setInputFile (dir+mapname+".xml");
+	p.setXSLFile (xsl);
+	cout << "bdp="<<vymBaseDir.path()<<"   xsl="<<xsl<<endl;
 	p.process();
 
 	if (!postscript.isEmpty()) runScript (postscript,dir+mapname+".html");