- pair<string, string> dir1(_("Documents|#o#O"), string(lyxrc.document_path));
- return browseRelFile(&lv_, in_name, lv_.buffer()->filePath(),
- title, pattern, dir1);
+ // the different bibtex packages have (and need) their
+ // own "plain" stylefiles
+ biblio::CiteEngine const engine =
+ kernel().buffer().params().getEngine();
+ docstring defaultstyle;
+ switch (engine) {
+ case biblio::ENGINE_BASIC:
+ defaultstyle = lyx::from_ascii("plain");
+ break;
+ case biblio::ENGINE_NATBIB_AUTHORYEAR:
+ defaultstyle = lyx::from_ascii("plainnat");
+ break;
+ case biblio::ENGINE_NATBIB_NUMERICAL:
+ defaultstyle = lyx::from_ascii("plainnat");
+ break;
+ case biblio::ENGINE_JURABIB:
+ defaultstyle = lyx::from_ascii("jurabib");
+ break;
+ }
+
+ docstring bst = params()["options"];
+ if (bibtotoc()){
+ // bibstyle exists?
+ if (contains(bst, ',')) {
+ docstring bibtotoc = lyx::from_ascii("bibtotoc");
+ bst = split(bst, bibtotoc, ',');
+ } else
+ bst.erase();
+ }
+
+ // propose default style file for new insets
+ // existing insets might have (legally) no bst files
+ // (if the class already provides a style)
+ if (bst.empty() && params()["bibfiles"].empty())
+ bst = defaultstyle;
+
+ // FIXME UNICODE
+ return lyx::to_utf8(bst);