diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-10-08 20:01:58 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-10-08 23:24:52 -0400 |
commit | ed0e3fdcc13e0925c16aa81f6aa461892f15d81a (patch) | |
tree | 1083627576987de7c9fc88cb6cbf254034da50c4 /sc/source/ui/docshell | |
parent | 281cd4c4a0d4ffb0a99ae8239b11a2ebbb872a8c (diff) |
Start sharing common code between DeleteContents of ScViewFunc/ScDocFunc.
The goal is to have ScViewFunc::DeleteContents() simply call
ScDocFunc::DeleteContents() while doing the view only stuff in the ScViewFunc
variant. This is just a step toward that goal.
Change-Id: I2e574f9eb2b2be5340dbfb6f10739dfc2406faae
Diffstat (limited to 'sc/source/ui/docshell')
-rw-r--r-- | sc/source/ui/docshell/docfunc.cxx | 15 | ||||
-rw-r--r-- | sc/source/ui/docshell/docfuncutil.cxx | 39 |
2 files changed, 42 insertions, 12 deletions
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index f3a6245ca7d4..fedbd20fbc85 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -86,6 +86,7 @@ #include <rowheightcontext.hxx> #include <cellvalues.hxx> #include <undoconvert.hxx> +#include <docfuncutil.hxx> #include <memory> #include <utility> @@ -595,17 +596,8 @@ bool ScDocFunc::DeleteContents( const ScMarkData& rMark, InsertDeleteFlags nFlag if ( rDoc.ExtendMerge( aExtendedRange, true ) ) bMulti = false; - // keine Objekte auf geschuetzten Tabellen - bool bObjects = false; - if ( nFlags & IDF_OBJECTS ) - { - bObjects = true; - SCTAB nTabCount = rDoc.GetTableCount(); - ScMarkData::const_iterator itr = rMark.begin(), itrEnd = rMark.end(); - for (; itr != itrEnd && *itr < nTabCount; ++itr) - if (rDoc.IsTabProtected(*itr)) - bObjects = false; - } + // no objects on protected tabs + bool bObjects = (nFlags & IDF_OBJECTS) && !sc::DocFuncUtil::hasProtectedTab(rDoc, rMark); sal_uInt16 nExtFlags = 0; // extra flags are needed only if attributes are deleted if ( nFlags & IDF_ATTRIB ) @@ -674,7 +666,6 @@ bool ScDocFunc::DeleteContents( const ScMarkData& rMark, InsertDeleteFlags nFlag } } -//! HideAllCursors(); // falls Zusammenfassung aufgehoben wird rDoc.DeleteSelection( nFlags, aMultiMark ); // add undo action after drawing undo is complete (objects and note captions) diff --git a/sc/source/ui/docshell/docfuncutil.cxx b/sc/source/ui/docshell/docfuncutil.cxx new file mode 100644 index 000000000000..570ed521f8c5 --- /dev/null +++ b/sc/source/ui/docshell/docfuncutil.cxx @@ -0,0 +1,39 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <docfuncutil.hxx> +#include <document.hxx> +#include <markdata.hxx> + +namespace sc { + +bool DocFuncUtil::hasProtectedTab( const ScDocument& rDoc, const ScMarkData& rMark ) +{ + SCTAB nTabCount = rDoc.GetTableCount(); + ScMarkData::const_iterator itr = rMark.begin(), itrEnd = rMark.end(); + for (; itr != itrEnd && *itr < nTabCount; ++itr) + if (rDoc.IsTabProtected(*itr)) + return true; + + return false; +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |