]> git.lyx.org Git - lyx.git/blobdiff - src/mover.h
Fix bug 3101 and 3108
[lyx.git] / src / mover.h
index 153a20ba89f8871407340f862913524c1758e7ea..1e4666ec5329ae9abcbe1b38c92c963967490031 100644 (file)
 #include <map>
 #include <string>
 
+
+namespace lyx {
+
+namespace support { class FileName; }
+
 /**
  *  Utility to copy a file of a specified format from one place to another.
  *  This base class simply invokes the command support::copy().
@@ -31,10 +36,8 @@ public:
         *  \returns true if successful.
         */
        bool
-       copy(std::string const & from, std::string const & to) const
-       {
-               return do_copy(from, to, to);
-       }
+       copy(support::FileName const & from, support::FileName const & to,
+            unsigned long int mode = (unsigned long int)-1) const;
 
        /** Copy file @c from to @c to.
         *  \see SpecialisedMover::SpecialisedMover() for an explanation of
@@ -45,10 +48,11 @@ public:
         *  \returns true if successful.
         */
        bool
-       copy(std::string const & from, std::string const & to,
-            std::string const & latex) const
+       copy(support::FileName const & from, support::FileName const & to,
+            std::string const & latex,
+            unsigned long int mode = (unsigned long int)-1) const
        {
-               return do_copy(from, to, latex);
+               return do_copy(from, to, latex, mode);
        }
 
        /** Rename file @c from as @c to.
@@ -58,10 +62,7 @@ public:
         *  \returns true if successful.
         */
        bool
-       rename(std::string const & from, std::string const & to) const
-       {
-               return do_rename(from, to, to);
-       }
+       rename(support::FileName const & from, support::FileName const & to) const;
 
        /** Rename file @c from as @c to.
         *  \see SpecialisedMover::SpecialisedMover() for an explanation of
@@ -72,7 +73,7 @@ public:
         *  \returns true if successful.
         */
        bool
-       rename(std::string const & from, std::string const & to,
+       rename(support::FileName const & from, support::FileName const & to,
               std::string const & latex) const
        {
                return do_rename(from, to, latex);
@@ -80,12 +81,12 @@ public:
 
 protected:
        virtual bool
-       do_copy(std::string const & from, std::string const & to,
-               std::string const &) const;
+       do_copy(support::FileName const & from, support::FileName const & to,
+               std::string const &, unsigned long int mode) const;
 
        virtual bool
-       do_rename(std::string const & from, std::string const & to,
-                 std::string const &) const;
+       do_rename(support::FileName const & from, support::FileName const & to,
+                 std::string const &) const;
 };
 
 
@@ -98,15 +99,16 @@ protected:
  *  copied .fig file will require a transformation of the picture file
  *  reference if it is to be found by XFig.
  */
-struct SpecialisedMover : public Mover
+class SpecialisedMover : public Mover
 {
+public:
        SpecialisedMover() {}
 
        /** @c command should be of the form
         *  <code>
-        *      sh $$s/copy_fig.sh $$i $$o $$l
+        *      python $$s/scripts/fig_copy.py $$i $$o $$l
         *  </code>
-        *  where $$s is a placeholder for the lyx script directory,
+        *  where $$s is a placeholder for the lyx support directory,
         *        $$i is a placeholder for the name of the file to be moved,
         *        $$o is a placeholder for the name of the file after moving,
         *        $$l is a placeholder for the name of the file after moving,
@@ -126,12 +128,12 @@ struct SpecialisedMover : public Mover
 
 private:
        virtual bool
-       do_copy(std::string const & from, std::string const & to,
-               std::string const & latex) const;
+       do_copy(support::FileName const & from, support::FileName const & to,
+               std::string const & latex, unsigned long int mode) const;
 
        virtual bool
-       do_rename(std::string const & from, std::string const & to,
-                 std::string const & latex) const;
+       do_rename(support::FileName const & from, support::FileName const & to,
+                 std::string const & latex) const;
 
        std::string command_;
 };
@@ -173,4 +175,7 @@ private:
 extern Movers movers;
 extern Movers system_movers;
 
+
+} // namespace lyx
+
 #endif // MOVER_H