diff options
author | Kohei Yoshida <kohei.yoshida@suse.com> | 2011-09-12 11:36:44 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@suse.com> | 2011-09-12 13:22:07 -0400 |
commit | 458fd23a540465ad308300de250e118a4a7ef50f (patch) | |
tree | db70fc6996e4635240fec1454229fb06898b942a /sc/source/ui/view/viewfun3.cxx | |
parent | abccf9b8e5f331a27f188ec5246a9e0f64f287dd (diff) |
Moved the code that checks destination ranges to ScClipUtil.
Diffstat (limited to 'sc/source/ui/view/viewfun3.cxx')
-rw-r--r-- | sc/source/ui/view/viewfun3.cxx | 31 |
1 files changed, 4 insertions, 27 deletions
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index aaa07f94577a..028b68cdb97d 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -182,6 +182,7 @@ #include "clipparam.hxx" #include "undodat.hxx" #include "drawview.hxx" +#include "cliputil.hxx" using namespace com::sun::star; @@ -1736,34 +1737,10 @@ bool ScViewFunc::PasteFromClipToMultiRanges( ScRangeList aRanges; aMark.MarkToSimple(); aMark.FillRangeListWithMarks(&aRanges, false); - for (size_t i = 0, n = aRanges.size(); i < n; ++i) + if (!ScClipUtil::CheckDestRanges(pDoc, nColSize, nRowSize, aMark, aRanges)) { - ScRange aTest = *aRanges[i]; - // Check for filtered rows in all selected sheets. - ScMarkData::const_iterator itrTab = aMark.begin(), itrTabEnd = aMark.end(); - for (; itrTab != itrTabEnd; ++itrTab) - { - aTest.aStart.SetTab(*itrTab); - aTest.aEnd.SetTab(*itrTab); - if (ScViewUtil::HasFiltered(aTest, pDoc)) - { - // I don't know how to handle pasting into filtered rows yet. - ErrorMessage(STR_MSSG_PASTEFROMCLIP_0); - return false; - } - } - - // Destination range must be an exact multiple of the source range. - SCROW nRows = aTest.aEnd.Row() - aTest.aStart.Row() + 1; - SCCOL nCols = aTest.aEnd.Col() - aTest.aStart.Col() + 1; - SCROW nRowTest = (nRows / nRowSize) * nRowSize; - SCCOL nColTest = (nCols / nColSize) * nColSize; - if (nRows != nRowTest || nCols != nColTest) - { - // Destination range is not a multiple of the source range. Bail out. - ErrorMessage(STR_MSSG_PASTEFROMCLIP_0); - return false; - } + ErrorMessage(STR_MSSG_PASTEFROMCLIP_0); + return false; } ScDocShell* pDocSh = rViewData.GetDocShell(); |