| 1 | /** |
| 2 | * SPDX-FileCopyrightText: (C) 2009 Dominik Seichter <[email protected]> |
| 3 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 4 | */ |
| 5 | |
| 6 | #include "MoveOperation.h" |
| 7 | |
| 8 | #include <sstream> |
| 9 | |
| 10 | using namespace std; |
| 11 | using namespace PoDoFo; |
| 12 | |
| 13 | MoveOperation::MoveOperation(int nFrom, int nTo) |
| 14 | : m_fromIndex(nFrom), m_toIndex(nTo) |
| 15 | { |
| 16 | } |
| 17 | |
| 18 | void MoveOperation::Perform(PdfDocument& doc) |
| 19 | { |
| 20 | auto& pages = doc.GetPages(); |
| 21 | auto& page = pages.GetPageAt(m_fromIndex); |
| 22 | page.MoveTo(m_toIndex); |
| 23 | } |
| 24 | |
| 25 | string MoveOperation::ToString() const |
| 26 | { |
| 27 | ostringstream oss; |
| 28 | oss << "Moving page " << m_fromIndex << " to " << m_toIndex << "." << std::endl; |
| 29 | return oss.str(); |
| 30 | } |
| 31 |