Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef OOX_XLS_COMMENTSBUFFER_HXX
30 : : #define OOX_XLS_COMMENTSBUFFER_HXX
31 : :
32 : : #include "richstring.hxx"
33 : : #include "worksheethelper.hxx"
34 : : #include <com/sun/star/awt/Rectangle.hpp>
35 : :
36 : : namespace oox {
37 : : namespace xls {
38 : :
39 : : // ============================================================================
40 : :
41 : 3 : struct CommentModel
42 : : {
43 : : ::com::sun::star::table::CellRangeAddress
44 : : maRange; /// Position of the comment in the worksheet.
45 : : RichStringRef mxText; /// Formatted text of the comment.
46 : : ::rtl::OUString maAuthor; /// Comment author (BIFF8 only).
47 : : sal_Int32 mnAuthorId; /// Identifier of the comment's author.
48 : : sal_uInt16 mnObjId; /// Drawing object identifier (BIFF8 only).
49 : : sal_Bool mbAutoFill; /// Auto Selection of comment object's fill style
50 : : sal_Bool mbAutoScale; /// Auto Scale comment text
51 : : sal_Bool mbColHidden; /// Comment cell's Column is Hidden
52 : : sal_Bool mbLocked; /// Comment changes Locked
53 : : sal_Bool mbRowHidden; /// Comment cell's Row is Hidden
54 : : sal_Int32 mnTHA; /// Horizontal Alignment
55 : : sal_Int32 mnTVA; /// Vertical Alignment
56 : : ::com::sun::star::awt::Rectangle
57 : : maAnchor; /// Anchor parameters
58 : : bool mbVisible; /// True = comment is always shown (BIFF2-BIFF8 only).
59 : :
60 : : explicit CommentModel();
61 : : };
62 : :
63 : : // ----------------------------------------------------------------------------
64 : :
65 [ + - ][ - + ]: 6 : class Comment : public WorksheetHelper
66 : : {
67 : : public:
68 : : explicit Comment( const WorksheetHelper& rHelper );
69 : :
70 : : /** Imports a cell comment from the passed attributes of the comment element. */
71 : : void importComment( const AttributeList& rAttribs );
72 : : /** Imports a cell comment Properties from the passed attributes of the comment element. */
73 : : void importCommentPr( const AttributeList& rAttribs );
74 : : /** Imports a cell comment from the passed stream of a COMMENT record. */
75 : : void importComment( SequenceInputStream& rStrm );
76 : :
77 : : /** Creates and returns a new rich-string object for the comment text. */
78 : : RichStringRef createText();
79 : :
80 : : /** Finalizes the formatted string of the comment. */
81 : : void finalizeImport();
82 : :
83 : : private:
84 : : CommentModel maModel;
85 : : };
86 : :
87 : : typedef ::boost::shared_ptr< Comment > CommentRef;
88 : :
89 : : // ============================================================================
90 : :
91 [ - + ]: 60 : class CommentsBuffer : public WorksheetHelper
92 : : {
93 : : public:
94 : : explicit CommentsBuffer( const WorksheetHelper& rHelper );
95 : :
96 : : /** Appends a new author to the list of comment authors. */
97 : : void appendAuthor( const ::rtl::OUString& rAuthor );
98 : : /** Creates and returns a new comment. */
99 : : CommentRef createComment();
100 : :
101 : : /** Finalizes the formatted string of all comments. */
102 : : void finalizeImport();
103 : :
104 : : private:
105 : : typedef ::std::vector< ::rtl::OUString > OUStringVector;
106 : : typedef RefVector< Comment > CommentVector;
107 : :
108 : : OUStringVector maAuthors;
109 : : CommentVector maComments;
110 : : };
111 : :
112 : : // ============================================================================
113 : :
114 : : } // namespace xls
115 : : } // namespace oox
116 : :
117 : : #endif
118 : :
119 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|