Version 7.5.1.1, tag libreoffice-7.5.1.1
[LibreOffice.git] / sc / source / filter / inc / commentsbuffer.hxx
blobc30d6765d6f60591d11947051c6545168cf4fd14
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/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #pragma once
22 #include "richstring.hxx"
23 #include "worksheethelper.hxx"
24 #include <com/sun/star/awt/Rectangle.hpp>
26 namespace oox::xls {
28 struct CommentModel
30 ScRange maRange; /// Position of the comment in the worksheet.
31 RichStringRef mxText; /// Formatted text of the comment (not used in BIFF8).
32 sal_Int32 mnAuthorId; /// Identifier of the comment's author (OOXML and BIFF12 only).
33 bool mbAutoFill; /// Auto Selection of comment object's fill style
34 bool mbAutoScale; /// Auto Scale comment text
35 bool mbColHidden; /// Comment cell's Column is Hidden
36 bool mbLocked; /// Comment changes Locked
37 bool mbRowHidden; /// Comment cell's Row is Hidden
38 sal_Int32 mnTHA; /// Horizontal Alignment
39 sal_Int32 mnTVA; /// Vertical Alignment
40 css::awt::Rectangle maAnchor; /// Anchor parameters
42 explicit CommentModel();
45 class Comment final : public WorksheetHelper
47 public:
48 explicit Comment( const WorksheetHelper& rHelper );
50 /** Imports a cell comment from the passed attributes of the comment element. */
51 void importComment( const AttributeList& rAttribs );
52 /** Imports a cell comment Properties from the passed attributes of the comment element. */
53 void importCommentPr( const AttributeList& rAttribs );
54 /** Imports a cell comment from the passed stream of a COMMENT record. */
55 void importComment( SequenceInputStream& rStrm );
57 /** Creates and returns a new rich-string object for the comment text. */
58 RichStringRef const & createText();
60 /** Finalizes the formatted string of the comment. */
61 void finalizeImport();
63 private:
64 CommentModel maModel;
67 typedef std::shared_ptr< Comment > CommentRef;
69 class CommentsBuffer final : public WorksheetHelper
71 public:
72 explicit CommentsBuffer( const WorksheetHelper& rHelper );
74 /** Appends a new author to the list of comment authors. */
75 void appendAuthor( const OUString& rAuthor );
76 /** Creates and returns a new comment. */
77 CommentRef createComment();
79 /** Finalizes the formatted string of all comments. */
80 void finalizeImport();
82 private:
83 typedef RefVector< Comment > CommentVector;
85 std::vector< OUString > maAuthors;
86 CommentVector maComments;
89 } // namespace oox::xls
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */