Avoid potential negative array index access to cached text.
[LibreOffice.git] / sc / inc / documentstreamaccess.hxx
blobd34ea15ac8bcbfff57ae4d9d65215b71ecf770d8
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #pragma once
12 #include <rtl/ustring.hxx>
13 #include <memory>
15 class ScDocument;
16 class ScAddress;
17 class ScRange;
19 namespace sc
21 struct DocumentStreamAccessImpl;
23 /**
24 * Provides methods to allow direct shifting of document content without
25 * broadcasting or shifting of broadcaster positions.
27 class DocumentStreamAccess
29 std::unique_ptr<DocumentStreamAccessImpl> mpImpl;
31 public:
32 DocumentStreamAccess(ScDocument& rDoc);
33 ~DocumentStreamAccess();
35 void setNumericCell(const ScAddress& rPos, double fVal);
36 void setStringCell(const ScAddress& rPos, const OUString& rStr);
38 /**
39 * Clear its internal state, and more importantly all the block position
40 * hints currently held.
42 void reset();
44 /**
45 * Pop the top row inside specified range, shift all the other rows up by
46 * one, then set the bottom row empty.
48 void shiftRangeUp(const ScRange& rRange);
50 /**
51 * Top the bottom row inside specified range, shift all the other rows
52 * above downward by one by inserting an empty row at the top.
54 void shiftRangeDown(const ScRange& rRange);
58 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */