Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_SC_SOURCE_FILTER_INC_COMMENTSBUFFER_HXX
21 : #define INCLUDED_SC_SOURCE_FILTER_INC_COMMENTSBUFFER_HXX
22 :
23 : #include "richstring.hxx"
24 : #include "worksheethelper.hxx"
25 : #include <com/sun/star/awt/Rectangle.hpp>
26 :
27 : namespace oox {
28 : namespace xls {
29 :
30 4 : struct CommentModel
31 : {
32 : ::com::sun::star::table::CellRangeAddress
33 : maRange; /// Position of the comment in the worksheet.
34 : RichStringRef mxText; /// Formatted text of the comment (not used in BIFF8).
35 : OUString maAuthor; /// Comment author (BIFF8 only).
36 : sal_Int32 mnAuthorId; /// Identifier of the comment's author (OOXML and BIFF12 only).
37 : sal_uInt16 mnObjId; /// Drawing object identifier (BIFF8 only).
38 : bool mbAutoFill; /// Auto Selection of comment object's fill style
39 : bool mbAutoScale; /// Auto Scale comment text
40 : bool mbColHidden; /// Comment cell's Column is Hidden
41 : bool mbLocked; /// Comment changes Locked
42 : bool mbRowHidden; /// Comment cell's Row is Hidden
43 : sal_Int32 mnTHA; /// Horizontal Alignment
44 : sal_Int32 mnTVA; /// Vertical Alignment
45 : ::com::sun::star::awt::Rectangle
46 : maAnchor; /// Anchor parameters
47 : bool mbVisible; /// True = comment is always shown (BIFF2-BIFF8 only).
48 :
49 : explicit CommentModel();
50 : };
51 :
52 8 : class Comment : public WorksheetHelper
53 : {
54 : public:
55 : explicit Comment( const WorksheetHelper& rHelper );
56 :
57 : /** Imports a cell comment from the passed attributes of the comment element. */
58 : void importComment( const AttributeList& rAttribs );
59 : /** Imports a cell comment Properties from the passed attributes of the comment element. */
60 : void importCommentPr( const AttributeList& rAttribs );
61 : /** Imports a cell comment from the passed stream of a COMMENT record. */
62 : void importComment( SequenceInputStream& rStrm );
63 :
64 : /** Creates and returns a new rich-string object for the comment text. */
65 : RichStringRef createText();
66 :
67 : /** Finalizes the formatted string of the comment. */
68 : void finalizeImport();
69 :
70 : private:
71 : CommentModel maModel;
72 : };
73 :
74 : typedef ::boost::shared_ptr< Comment > CommentRef;
75 :
76 260 : class CommentsBuffer : public WorksheetHelper
77 : {
78 : public:
79 : explicit CommentsBuffer( const WorksheetHelper& rHelper );
80 :
81 : /** Appends a new author to the list of comment authors. */
82 : void appendAuthor( const OUString& rAuthor );
83 : /** Creates and returns a new comment. */
84 : CommentRef createComment();
85 :
86 : /** Finalizes the formatted string of all comments. */
87 : void finalizeImport();
88 :
89 : private:
90 : typedef ::std::vector< OUString > OUStringVector;
91 : typedef RefVector< Comment > CommentVector;
92 :
93 : OUStringVector maAuthors;
94 : CommentVector maComments;
95 : };
96 :
97 : } // namespace xls
98 : } // namespace oox
99 :
100 : #endif
101 :
102 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|