void rels(char *path){ DIR *dir; struct dirent *dirslot; struct stat info; chdir(path); dir=opendir("."); printf("%s:\n",dirpath); while (1) { dirslot=readdir(dir); if (dirslot==NULL) break; stat(dirslot->d_name, &info); show_file_info(dirslot->d_name,&info); } rewinddir(dir); while (1) { dirslot=readdir(dir); if (dirslot==NULL) return; if (strcmp(dirslot->d_name, ".")==0) continue; if (strcmp(dirslot->d_name, "..")==0) continue; stat(dirslot->d_name, &info); if (S_ISDIR(info.st_mode)) { printf("\n\n"); strcpy(temp, next); strcpy(dirpath,temp); strcat(dirpath,"/"); strcat(next,dirslot->d_name); strcat(dirpath, dirslot->d_name); chdir(dirslot->d_name); rels(dirslot->d_name); chdir(".."); strcpy(next,temp); } } }
void main(int ac, char* av[]) { if(ac == 1) do_ls("."); else if(ac == 2) { if(((strcmp("-R", av[1])) == 0)){ rels("."); } } else while( --ac){ printf("%s:\n", * ++av); do_ls(*av); } }
void Document::read(const OOX::CPath& path, IPPTXEvent* Event) { OOX::CRels rels(path); PPTX::FileMap map; long files = CountFiles(path); if(files == 0) return; m_lPercent = (long)floor(1000000. / files); FileContainer::read(rels, path, map, Event); long percent = Event ? Event->GetPercent() : 0; if(m_bCancelled && percent < 1000000) return; smart_ptr<PPTX::Presentation> _presentation = FileContainer::Get(OOX::Presentation::FileTypes::Presentation).smart_dynamic_cast<PPTX::Presentation>(); if (_presentation.is_init()) { _presentation->commentAuthors = _presentation->Get(OOX::Presentation::FileTypes::CommentAuthors).smart_dynamic_cast<PPTX::Authors>(); if (_presentation->IsExist(OOX::FileTypes::VbaProject)) { _presentation->m_bMacroEnabled = true; _presentation->m_pVbaProject = _presentation->Get(OOX::FileTypes::VbaProject).smart_dynamic_cast<OOX::VbaProject>(); } if (_presentation->IsExist(OOX::FileTypes::JsaProject)) { _presentation->m_pJsaProject = _presentation->Get(OOX::FileTypes::JsaProject).smart_dynamic_cast<OOX::JsaProject>(); } _presentation->comments = _presentation->Get(OOX::Presentation::FileTypes::SlideComments).smart_dynamic_cast<PPTX::Comments>(); } for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = map.m_map.begin(); pPair != map.m_map.end(); ++pPair) { const OOX::FileType& curType = pPair->second->type(); if (OOX::FileTypes::Theme == curType) { smart_ptr<PPTX::Theme> pTheme = pPair->second.smart_dynamic_cast<PPTX::Theme>(); if (pTheme.IsInit()) pTheme->presentation = _presentation; } } for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = map.m_map.begin(); pPair != map.m_map.end(); ++pPair) { const OOX::FileType& curType = pPair->second->type(); if (OOX::Presentation::FileTypes::SlideMaster == curType) { smart_ptr<PPTX::SlideMaster> pointer = pPair->second.smart_dynamic_cast<PPTX::SlideMaster>(); if (pointer.is_init()) pointer->ApplyRels(); } } for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = map.m_map.begin(); pPair != map.m_map.end(); ++pPair) { const OOX::FileType& curType = pPair->second->type(); if (OOX::Presentation::FileTypes::SlideLayout == curType) { smart_ptr<PPTX::SlideLayout> pointer = pPair->second.smart_dynamic_cast<PPTX::SlideLayout>(); if (pointer.is_init()) pointer->ApplyRels(); } } for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = map.m_map.begin(); pPair != map.m_map.end(); ++pPair) { const OOX::FileType& curType = pPair->second->type(); if (OOX::Presentation::FileTypes::Slide == curType) { smart_ptr<PPTX::Slide> pointer = pPair->second.smart_dynamic_cast<PPTX::Slide>(); if (pointer.is_init()) pointer->ApplyRels(); } } for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = map.m_map.begin(); pPair != map.m_map.end(); ++pPair) { const OOX::FileType& curType = pPair->second->type(); if (OOX::Presentation::FileTypes::NotesMaster == curType) { smart_ptr<PPTX::NotesMaster> pointer = pPair->second.smart_dynamic_cast<PPTX::NotesMaster>(); if (pointer.is_init()) pointer->ApplyRels(); } } for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = map.m_map.begin(); pPair != map.m_map.end(); ++pPair) { const OOX::FileType& curType = pPair->second->type(); if (OOX::Presentation::FileTypes::NotesSlide == curType) { smart_ptr<PPTX::NotesSlide> pointer = pPair->second.smart_dynamic_cast<PPTX::NotesSlide>(); if (pointer.is_init()) pointer->ApplyRels(); } } if (Event) Event->Progress(0, 1000000); }
void IFileContainer::read(const CPath& filename) { OOX::Rels::File rels(filename); read(rels, filename.GetDirectory()); }