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 OOX_XLS_COMMENTSBUFFER_HXX
21 : #define OOX_XLS_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 : // ============================================================================
31 :
32 1 : struct CommentModel
33 : {
34 : ::com::sun::star::table::CellRangeAddress
35 : maRange; /// Position of the comment in the worksheet.
36 : RichStringRef mxText; /// Formatted text of the comment (not used in BIFF8).
37 : ::rtl::OUString maAuthor; /// Comment author (BIFF8 only).
38 : sal_Int32 mnAuthorId; /// Identifier of the comment's author (OOXML and BIFF12 only).
39 : sal_uInt16 mnObjId; /// Drawing object identifier (BIFF8 only).
40 : sal_Bool mbAutoFill; /// Auto Selection of comment object's fill style
41 : sal_Bool mbAutoScale; /// Auto Scale comment text
42 : sal_Bool mbColHidden; /// Comment cell's Column is Hidden
43 : sal_Bool mbLocked; /// Comment changes Locked
44 : sal_Bool mbRowHidden; /// Comment cell's Row is Hidden
45 : sal_Int32 mnTHA; /// Horizontal Alignment
46 : sal_Int32 mnTVA; /// Vertical Alignment
47 : ::com::sun::star::awt::Rectangle
48 : maAnchor; /// Anchor parameters
49 : bool mbVisible; /// True = comment is always shown (BIFF2-BIFF8 only).
50 :
51 : explicit CommentModel();
52 : };
53 :
54 : // ----------------------------------------------------------------------------
55 :
56 2 : class Comment : public WorksheetHelper
57 : {
58 : public:
59 : explicit Comment( const WorksheetHelper& rHelper );
60 :
61 : /** Imports a cell comment from the passed attributes of the comment element. */
62 : void importComment( const AttributeList& rAttribs );
63 : /** Imports a cell comment Properties from the passed attributes of the comment element. */
64 : void importCommentPr( const AttributeList& rAttribs );
65 : /** Imports a cell comment from the passed stream of a COMMENT record. */
66 : void importComment( SequenceInputStream& rStrm );
67 :
68 : /** Creates and returns a new rich-string object for the comment text. */
69 : RichStringRef createText();
70 :
71 : /** Finalizes the formatted string of the comment. */
72 : void finalizeImport();
73 :
74 : private:
75 : CommentModel maModel;
76 : };
77 :
78 : typedef ::boost::shared_ptr< Comment > CommentRef;
79 :
80 : // ============================================================================
81 :
82 25 : class CommentsBuffer : public WorksheetHelper
83 : {
84 : public:
85 : explicit CommentsBuffer( const WorksheetHelper& rHelper );
86 :
87 : /** Appends a new author to the list of comment authors. */
88 : void appendAuthor( const ::rtl::OUString& rAuthor );
89 : /** Creates and returns a new comment. */
90 : CommentRef createComment();
91 :
92 : /** Finalizes the formatted string of all comments. */
93 : void finalizeImport();
94 :
95 : private:
96 : typedef ::std::vector< ::rtl::OUString > OUStringVector;
97 : typedef RefVector< Comment > CommentVector;
98 :
99 : OUStringVector maAuthors;
100 : CommentVector maComments;
101 : };
102 :
103 : // ============================================================================
104 :
105 : } // namespace xls
106 : } // namespace oox
107 :
108 : #endif
109 :
110 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|