Get the style color and number just once
[LibreOffice.git] / sc / source / filter / inc / commentsbuffer.hxx
blob74e4d7cb123d6d91624c1bd8659983c509f1ea4d
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 OUString getAuthorName();
65 private:
66 CommentModel maModel;
69 typedef std::shared_ptr< Comment > CommentRef;
71 class CommentsBuffer final : public WorksheetHelper
73 public:
74 explicit CommentsBuffer( const WorksheetHelper& rHelper );
76 /** Appends a new author to the list of comment authors. */
77 void appendAuthor( const OUString& rAuthor );
78 /** Creates and returns a new comment. */
79 CommentRef createComment();
81 /** Finalizes the formatted string of all comments. */
82 void finalizeImport();
84 const std::vector<OUString> & getAuthors() const;
86 private:
87 typedef RefVector< Comment > CommentVector;
89 std::vector< OUString > maAuthors;
90 CommentVector maComments;
93 } // namespace oox::xls
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */