]> git.lyx.org Git - lyx.git/blobdiff - src/insets/ExternalTransforms.cpp
Fix bug #12795
[lyx.git] / src / insets / ExternalTransforms.cpp
index 76404738c10081e60a8557278aa3fbbce4c10e66..76578b2ea0814edc6fbc25ef6459fa213483c7c7 100644 (file)
 
 #include "ExternalTransforms.h"
 
+#include "support/convert.h"
 #include "support/debug.h"
 #include "support/lstrings.h"
 #include "support/lyxlib.h" // float_equal
-#include "support/convert.h"
 #include "support/Translator.h"
 
-#include <boost/regex.hpp>
-
 #include <cmath> // abs
+#include <regex>
 #include <sstream>
 
 using namespace std;
@@ -78,7 +77,7 @@ namespace {
 typedef Translator<RotationData::OriginType, string> OriginTranslator;
 OriginTranslator const & originTranslator();
 
-} // namespace anon
+} // namespace
 
 
 void RotationData::origin(string const & o)
@@ -183,7 +182,7 @@ ostream & operator<<(ostream & os, RotationData::OriginType type)
        return os;
 }
 
-} // namespace anon
+} // namespace
 
 
 string const RotationLatexCommand::front_impl() const
@@ -218,7 +217,10 @@ string const  ClipLatexOption::option_impl() const
 
        ostringstream os;
        if (!data.bbox.empty())
-               os << "bb=" << data.bbox << ',';
+               os << "bb=" << data.bbox.xl.asLatexString() << ' '
+                  << data.bbox.yb.asLatexString() << ' '
+                  << data.bbox.xr.asLatexString() << ' '
+                  << data.bbox.yt.asLatexString() << ',';
        if (data.clip)
                os << "clip,";
        return os.str();
@@ -279,11 +281,10 @@ string const sanitizeLatexOption(string const & input)
        // Strip any leading commas
        // "[,,,,foo..." -> "foo..." ("foo..." may be empty)
        string output;
-       boost::smatch what;
-       static boost::regex const front("^( *[[],*)(.*)$");
+       smatch what;
+       static regex const front("^( *\\[,*)(.*)$");
 
-       regex_match(it, end, what, front, boost::match_partial);
-       if (!what[0].matched) {
+       if (!regex_match(it, end, what, front)) {
                lyxerr << "Unable to sanitize LaTeX \"Option\": "
                       << input << '\n';
                return string();
@@ -293,10 +294,9 @@ string const sanitizeLatexOption(string const & input)
        // Replace any consecutive commas with a single one
        // "foo,,,,bar" -> "foo,bar"
        // with iterator now pointing to 'b'
-       static boost::regex const commas("([^,]*)(,,*)(.*)$");
+       static regex const commas("([^,]*)(,,*)(.*)$");
        for (; it != end;) {
-               regex_match(it, end, what, commas, boost::match_partial);
-               if (!what[0].matched) {
+               if (!regex_match(it, end, what, commas)) {
                        output += string(it, end);
                        break;
                }
@@ -306,9 +306,8 @@ string const sanitizeLatexOption(string const & input)
 
        // Strip any trailing commas
        // "...foo,,,]" -> "...foo" ("...foo,,," may be empty)
-       static boost::regex const back("^(.*[^,])?,*[]] *$");
-       regex_match(output, what, back);
-       if (!what[0].matched) {
+       static regex const back("^(.*[^,])?,*\\] *$");
+       if (!regex_match(output, what, back)) {
                lyxerr << "Unable to sanitize LaTeX \"Option\": "
                       << output << '\n';
                return string();
@@ -326,18 +325,18 @@ string const sanitizeLatexOption(string const & input)
 namespace {
 
 template <typename Factory, typename Data, typename Transformer>
-void extractIt(boost::any const & any_factory,
+void extractIt(any const & any_factory,
               Data const & data, Transformer & transformer)
 {
        if (any_factory.type() != typeid(Factory))
                return;
 
-       Factory factory = boost::any_cast<Factory>(any_factory);
-       if (!factory.empty())
+       Factory factory = any_cast<Factory>(any_factory);
+       if (factory)
                transformer = factory(data);
 }
 
-} // namespace anon
+} // namespace
 
 
 TransformCommand::ptr_type
@@ -426,7 +425,7 @@ OriginTranslator const & originTranslator()
        return translator;
 }
 
-} // namespace anon
+} // namespace
 
 } // namespace external
 } // namespace lyx