diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/index.cpp | 13 | ||||
-rw-r--r-- | src/index.h | 1 | ||||
-rw-r--r-- | src/latexgen.cpp | 22 | ||||
-rw-r--r-- | src/pagedef.cpp | 96 | ||||
-rw-r--r-- | src/pagedef.h | 15 | ||||
-rw-r--r-- | src/rtfgen.cpp | 21 |
6 files changed, 135 insertions, 33 deletions
diff --git a/src/index.cpp b/src/index.cpp index 711e760..e2b7750 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -2937,7 +2937,7 @@ void writeIndex(OutputList &ol) ol.startIndexSection(isMainPage); if (mainPageHasTitle()) { - ol.parseDoc(defFileName,defLine,Doxygen::mainPage,0,Doxygen::mainPage->title(),FALSE,FALSE); + ol.parseText(Doxygen::mainPage->title()); } else { @@ -2954,13 +2954,22 @@ void writeIndex(OutputList &ol) bool first=Doxygen::mainPage==0; for (pdi.toFirst();(pd=pdi.current());++pdi) { - if (!pd->getGroupDef() && !pd->isReference()) + if (!pd->getGroupDef() && !pd->isReference() && + !pd->hasParentPage() + ) { QCString title = pd->title(); if (title.isEmpty()) title=pd->name(); ol.startIndexSection(isPageDocumentation); ol.parseText(title); ol.endIndexSection(isPageDocumentation); + ol.pushGeneratorState(); // write TOC title (RTF only) + ol.disableAllBut(OutputGenerator::RTF); + ol.startIndexSection(isPageDocumentation2); + ol.parseText(title); + ol.endIndexSection(isPageDocumentation2); + ol.popGeneratorState(); + ol.writeAnchor(0,pd->name()); ol.writePageLink(pd->getOutputFileBase(),first); first=FALSE; diff --git a/src/index.h b/src/index.h index fe31d0f..ef8b543 100644 --- a/src/index.h +++ b/src/index.h @@ -115,6 +115,7 @@ enum IndexSections isFileDocumentation, isExampleDocumentation, isPageDocumentation, + isPageDocumentation2, isEndIndex }; diff --git a/src/latexgen.cpp b/src/latexgen.cpp index 4dd4e06..7dd48f9 100644 --- a/src/latexgen.cpp +++ b/src/latexgen.cpp @@ -236,7 +236,7 @@ static void writeDefaultHeaderPart1(QTextStream &t) s=extraPackages.next(); } t << "\\makeindex\n" - "\\setcounter{tocdepth}{1}\n" + "\\setcounter{tocdepth}{3}\n" "\\renewcommand{\\footrulewidth}{0.4pt}\n" "\\begin{document}\n"; if (theTranslator->idLanguage()=="greek") t << "\\selectlanguage{greek}\n"; @@ -585,6 +585,8 @@ void LatexGenerator::startIndexSection(IndexSections is) t << "{"; //Page Documentation}\n"; } break; + case isPageDocumentation2: + break; case isEndIndex: break; } @@ -793,6 +795,8 @@ void LatexGenerator::endIndexSection(IndexSections is) #endif } break; + case isPageDocumentation2: + break; case isEndIndex: t << "\\printindex\n"; t << "\\end{document}\n"; @@ -1104,7 +1108,7 @@ void LatexGenerator::endMemberHeader() void LatexGenerator::startMemberDoc(const char *clname, const char *memname, const char *, - const char *) + const char *title) { if (memname && memname[0]!='@') { @@ -1141,6 +1145,9 @@ void LatexGenerator::startMemberDoc(const char *clname, // escapeMakeIndexChars(this,t,memname); // t << "]"; //} + t << "["; + escapeMakeIndexChars(title); + t << "]"; t << "{\\setlength{\\rightskip}{0pt plus 5cm}"; disableLinks=TRUE; } @@ -1181,9 +1188,16 @@ void LatexGenerator::writeAnchor(const char *fName,const char *name) { //printf("LatexGenerator::writeAnchor(%s,%s)\n",fName,name); t << "\\label{" << name << "}" << endl; - if (fName && Config_getBool("PDF_HYPERLINKS")) + if (Config_getBool("PDF_HYPERLINKS")) { - t << "\\hypertarget{" << stripPath(fName) << "_" << name << "}{}" << endl; + if (fName) + { + t << "\\hypertarget{" << stripPath(fName) << "_" << name << "}{}" << endl; + } + else + { + t << "\\hypertarget{" << name << "}{}" << endl; + } } } diff --git a/src/pagedef.cpp b/src/pagedef.cpp index c159283..9168d82 100644 --- a/src/pagedef.cpp +++ b/src/pagedef.cpp @@ -13,13 +13,14 @@ PageDef::PageDef(const char *f,int l,const char *n, : Definition(f,l,n), m_title(t) { setDocumentation(d,f,l); - subPageDict = new PageSDict(7); - pageScope = 0; + m_subPageDict = new PageSDict(7); + m_pageScope = 0; + m_nestingLevel = 0; } PageDef::~PageDef() { - delete subPageDict; + delete m_subPageDict; } void PageDef::findSectionsInDocumentation() @@ -46,11 +47,18 @@ void PageDef::addInnerCompound(Definition *def) if (def->definitionType()==Definition::TypePage) { PageDef *pd = (PageDef*)def; - subPageDict->append(pd->name(),pd); + m_subPageDict->append(pd->name(),pd); def->setOuterScope(this); + pd->setNestingLevel(m_nestingLevel+1); } } +bool PageDef::hasParentPage() const +{ + return getOuterScope() && + getOuterScope()->definitionType()==Definition::TypePage; +} + void PageDef::writeDocumentation(OutputList &ol) { //outputList->disable(OutputGenerator::Man); @@ -62,6 +70,17 @@ void PageDef::writeDocumentation(OutputList &ol) startFile(ol,pageName,pageName,title(),HLI_None,TRUE); + ol.pushGeneratorState(); + + if (m_nestingLevel>0) // a sub page + { + // do not generate sub page output for RTF and LaTeX, as these are + // part of their parent page + ol.disableAll(); + ol.enable(OutputGenerator::Man); + ol.enable(OutputGenerator::Html); + } + if (getOuterScope()!=Doxygen::globalScope && !Config_getBool("DISABLE_INDEX")) { getOuterScope()->writeNavigationPath(ol); @@ -80,6 +99,7 @@ void PageDef::writeDocumentation(OutputList &ol) // for Latex the section is already generated as a chapter in the index! ol.pushGeneratorState(); ol.disable(OutputGenerator::Latex); + ol.disable(OutputGenerator::RTF); SectionInfo *si=0; if (!title().isEmpty() && !name().isEmpty() && (si=Doxygen::sectionDict.find(pageName))!=0) @@ -93,18 +113,11 @@ void PageDef::writeDocumentation(OutputList &ol) } ol.popGeneratorState(); - ol.startTextBlock(); - ol.parseDoc(docFile(), // fileName - docLine(), // startLine - this, // context - 0, // memberdef - documentation(), // docStr - TRUE, // index words - FALSE // not an example - ); - ol.endTextBlock(); + writePageDocumentation(ol); + + ol.popGeneratorState(); + endFile(ol); - //outputList->enable(OutputGenerator::Man); if (!Config_getString("GENERATE_TAGFILE").isEmpty()) { @@ -131,6 +144,53 @@ void PageDef::writeDocumentation(OutputList &ol) } } +void PageDef::writePageDocumentation(OutputList &ol) +{ + ol.startTextBlock(); + ol.parseDoc(docFile(), // fileName + docLine(), // startLine + this, // context + 0, // memberdef + documentation(), // docStr + TRUE, // index words + FALSE // not an example + ); + ol.endTextBlock(); + + if (hasSubPages()) + { + // for printed documentation we write subpages as section's of the + // parent page. + ol.pushGeneratorState(); + ol.disableAll(); + ol.enable(OutputGenerator::Latex); + ol.enable(OutputGenerator::RTF); + + PageSDict::Iterator pdi(*m_subPageDict); + PageDef *subPage=pdi.toFirst(); + for (pdi.toFirst();(subPage=pdi.current());++pdi) + { + SectionInfo::SectionType sectionType = SectionInfo::Paragraph; + switch (m_nestingLevel) + { + case 0: sectionType = SectionInfo::Page; break; + case 1: sectionType = SectionInfo::Section; break; + case 2: sectionType = SectionInfo::Subsection; break; + case 3: sectionType = SectionInfo::Subsubsection; break; + default: sectionType = SectionInfo::Paragraph; break; + } + QCString title = subPage->title(); + if (title.isEmpty()) title = subPage->name(); + ol.startSection(subPage->name(),title,sectionType); + ol.parseText(title); + ol.endSection(subPage->name(),sectionType); + subPage->writePageDocumentation(ol); + } + + ol.popGeneratorState(); + } +} + bool PageDef::visibleInIndex() const { return // not part of a group @@ -153,7 +213,11 @@ bool PageDef::documentedPage() const bool PageDef::hasSubPages() const { - return subPageDict->count()>0; + return m_subPageDict->count()>0; } +void PageDef::setNestingLevel(int l) +{ + m_nestingLevel = l; +} diff --git a/src/pagedef.h b/src/pagedef.h index 98ed31b..2087d24 100644 --- a/src/pagedef.h +++ b/src/pagedef.h @@ -35,7 +35,6 @@ class PageDef : public Definition { return isLinkableInProject() || isReference(); } - void addSubPage(PageDef *def); void writeDocumentation(OutputList &ol); // functions to get a uniform interface with Definitions @@ -43,21 +42,25 @@ class PageDef : public Definition void findSectionsInDocumentation(); QCString title() const { return m_title; } GroupDef * getGroupDef() const; - PageSDict * getSubPages() const { return subPageDict; } + PageSDict * getSubPages() const { return m_subPageDict; } void setFileName(const char *name) { m_fileName = name; } void addInnerCompound(Definition *d); bool visibleInIndex() const; bool documentedPage() const; bool hasSubPages() const; - void setPageScope(Definition *d){ pageScope = d; } - Definition *getPageScope() const { return pageScope; } + bool hasParentPage() const; + void setPageScope(Definition *d){ m_pageScope = d; } + Definition *getPageScope() const { return m_pageScope; } private: + void setNestingLevel(int l); + void writePageDocumentation(OutputList &ol); QCString m_fileName; QCString m_title; GroupDef *m_inGroup; - PageSDict *subPageDict; // list of pages in the group - Definition *pageScope; + PageSDict *m_subPageDict; // list of pages in the group + Definition *m_pageScope; + int m_nestingLevel; }; class PageSDict : public SDict<PageDef> diff --git a/src/rtfgen.cpp b/src/rtfgen.cpp index 79e2fec..9634acc 100644 --- a/src/rtfgen.cpp +++ b/src/rtfgen.cpp @@ -39,8 +39,8 @@ #include "dirdef.h" #include "vhdldocgen.h" -//#define DBG_RTF(x) x; -#define DBG_RTF(x) +#define DBG_RTF(x) x; +//#define DBG_RTF(x) static QCString dateToRTFDateString() { @@ -515,6 +515,10 @@ void RTFGenerator::startIndexSection(IndexSections is) { //Page Documentation beginRTFChapter(); + } + break; + case isPageDocumentation2: + { t << "{\\tc \\v "; } break; @@ -833,7 +837,7 @@ void RTFGenerator::endIndexSection(IndexSections is) { //#error "fix me in the same way as the latex index..." //t << "{\\tc \\v " << theTranslator->trPageDocumentation() << "}"<< endl; - t << "}"<< endl; + //t << "}"<< endl; //PageSDict::Iterator pdi(*Doxygen::pageSDict); //PageDef *pd=pdi.toFirst(); //bool first=TRUE; @@ -850,6 +854,12 @@ void RTFGenerator::endIndexSection(IndexSections is) //} } break; + case isPageDocumentation2: + { + t << "}"; + t << "\\par " << rtf_Style_Reset << endl; + } + break; case isEndIndex: beginRTFChapter(); t << rtf_Style["Heading1"]->reference; @@ -1607,8 +1617,9 @@ void RTFGenerator::startSection(const char *,const char *title,SectionInfo::Sect void RTFGenerator::endSection(const char *lab,SectionInfo::SectionType) { DBG_RTF(t << "{\\comment (endSection)}" << endl) - newParagraph(); // make bookmark + m_omitParagraph=FALSE; + newParagraph(); writeAnchor(0,lab); t << "}"; } @@ -1813,7 +1824,7 @@ void RTFGenerator::writeAnchor(const char *fileName,const char *name) anchor+=name; } - DBG_RTF(t <<"{\\comment writeAncheor (" << anchor << ")}" << endl) + DBG_RTF(t <<"{\\comment writeAnchor (" << anchor << ")}" << endl) t << "{\\bkmkstart " << rtfFormatBmkStr(anchor) << "}" << endl; t << "{\\bkmkend " << rtfFormatBmkStr(anchor) << "}" << endl; } |