1
/* This file is part of the KDE project
2
Copyright 2009 Stefan Nikolaus <stefan.nikolaus@kdemail.net>
4
This library is free software; you can redistribute it and/or
5
modify it under the terms of the GNU Library General Public
6
License as published by the Free Software Foundation; either
7
version 2 of the License, or (at your option) any later version.
9
This library is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
Library General Public License for more details.
14
You should have received a copy of the GNU Library General Public License
15
along with this library; see the file COPYING.LIB. If not, write to
16
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
Boston, MA 02110-1301, USA.
20
#ifndef KSPREAD_PASTE_COMMAND
21
#define KSPREAD_PASTE_COMMAND
23
#include "AbstractRegionCommand.h"
25
#include <KoXmlReader.h>
37
* \brief Command to paste cell data.
39
class PasteCommand : public AbstractRegionCommand
42
PasteCommand(QUndoCommand *parent = 0);
43
virtual ~PasteCommand();
46
* Modes used for paste with insertion.
49
NoInsertion, ///< No cell insertion.
50
ShiftCells, ///< Shift cells; determine the direction from the data.
51
ShiftCellsRight, ///< Shift cells to the right.
52
ShiftCellsDown ///< Shift cells to the bottom.
55
bool setMimeData(const QMimeData *mimeData);
56
void setInsertionMode(InsertionMode mode);
57
void setMode(Paste::Mode mode);
58
void setOperation(Paste::Operation operation);
59
void setPasteFC(bool force);
61
virtual bool isApproved() const;
64
* \param mimeData the MIME data to check
65
* \return \c true , if the MIME type is supported.
67
static bool supports(const QMimeData *mimeData);
70
* Checks wether the clipboard data contains columns or rows.
71
* Used to decide wether the paste with insertion dialog, where
72
* you can choose between shifting cells down or to the right,
74
* \param mimeData the MIME data to check
75
* \return \c true if the shifting direction is not defined
76
* \return \c false if the clipboard data contains a column or a row
78
static bool unknownShiftDirection(const QMimeData *mimeData);
81
virtual bool preProcessing();
82
virtual bool mainProcessing();
83
virtual bool postProcessing();
86
* Creates sub-commands for the region \p element by parsing XML \p data.
88
bool processXmlData(Element *element, KoXmlDocument *data);
91
* Creates sub-commands for the region \p element by parsing plain text.
93
bool processTextPlain(Element *element);
96
const QMimeData * m_mimeData;
97
KoXmlDocument * m_xmlDocument;
98
InsertionMode m_insertMode;
99
Paste::Mode m_pasteMode;
100
Paste::Operation m_operation;
104
} // namespace KSpread
106
#endif // KSPREAD_PASTE_COMMAND