]> git.lyx.org Git - lyx.git/blobdiff - src/graphics/epstools.cpp
Reimplement RowPainter::paintSelection() using row elements
[lyx.git] / src / graphics / epstools.cpp
index 44d577c14f9ae2feacd9adfe04a6e4bf6a85a955..2fd67dcf8a8b095a7374c56338ea3e6513bd7301 100644 (file)
@@ -26,6 +26,7 @@
 #include "Format.h"
 
 #include "support/debug.h"
+#include "support/docstream.h"
 #include "support/filetools.h"
 #include "support/FileName.h"
 #include "support/regex.h"
@@ -46,19 +47,19 @@ string const readBB_from_PSFile(FileName const & file)
        // end of the file. Than we have in the header:
        // %%BoundingBox: (atend)
        // In this case we must check the end.
-       bool zipped = file.isZippedFile();
+       bool const zipped = formats.isZippedFile(file);
        FileName const file_ = zipped ? unzipFile(file) : file;
-       string const format = file_.guessFormatFromContents();
+       string const format = formats.getFormatFromFile(file_);
 
-       if (format != "eps" && format != "ps") {
+       if (!Formats::isPostScriptFileFormat(format)) {
                LYXERR(Debug::GRAPHICS, "[readBB_from_PSFile] no(e)ps-format");
                if (zipped)
                        file_.removeFile();
                return string();
        }
 
-       static lyx::regex bbox_re(
-               "^%%BoundingBox:\\s*([[:digit:]]+)\\s+([[:digit:]]+)\\s+([[:digit:]]+)\\s+([[:digit:]]+)");
+       static lyx::regex bbox_re("^%%BoundingBox:\\s*([-]*[[:digit:]]+)"
+               "\\s+([-]*[[:digit:]]+)\\s+([-]*[[:digit:]]+)\\s+([-]*[[:digit:]]+)");
        ifstream is(file_.toFilesystemEncoding().c_str());
        while (is) {
                string s;