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_OOX_DRAWINGML_TEXTPARAGRAPH_HXX
21 #define INCLUDED_OOX_DRAWINGML_TEXTPARAGRAPH_HXX
22 
23 #include <memory>
24 #include <com/sun/star/text/XTextCursor.hpp>
25 #include <com/sun/star/text/XText.hpp>
26 
27 #include <oox/core/xmlfilterbase.hxx>
28 #include <drawingml/textrun.hxx>
29 #include <drawingml/textliststyle.hxx>
30 #include <drawingml/textparagraphproperties.hxx>
31 
32 // The height the bullet is relative to is different in OOXML
33 #define OOX_BULLET_LIST_SCALE_FACTOR 0.7f
34 
35 namespace oox { namespace formulaimport {
36     class XmlStreamBuilder;
37 } }
38 
39 namespace oox { namespace drawingml {
40 
41 typedef RefVector< TextRun > TextRunVector;
42 
43 class TextParagraph
44 {
45 public:
46     TextParagraph();
47     ~TextParagraph();
48 
getRuns()49     TextRunVector&       getRuns() { return maRuns; }
getRuns() const50     const TextRunVector& getRuns() const { return maRuns; }
addRun(const TextRunPtr & pRun)51     void                 addRun( const TextRunPtr & pRun ) { maRuns.push_back( pRun ); }
52 
getProperties()53     TextParagraphProperties&         getProperties() { return maProperties; }
getProperties() const54     const TextParagraphProperties&   getProperties() const { return maProperties; }
55 
getEndProperties()56     TextCharacterProperties&         getEndProperties() { return maEndProperties; }
getEndProperties() const57     const TextCharacterProperties&   getEndProperties() const { return maEndProperties; }
58 
59     TextCharacterProperties          getCharacterStyle(
60         const TextCharacterProperties& rTextStyleProperties,
61         const TextListStyle& rTextListStyle) const;
62 
63     TextParagraphPropertiesPtr      getParagraphStyle(
64         const TextListStyle& rTextListStyle) const;
65 
66     void                        insertAt(
67                                     const ::oox::core::XmlFilterBase& rFilterBase,
68                                     const css::uno::Reference < css::text::XText > & xText,
69                                     const css::uno::Reference < css::text::XTextCursor > &xAt,
70                                     const TextCharacterProperties& rTextStyleProperties,
71                                     const TextListStyle& rTextListStyle,
72                                     bool bFirst,
73                                     float nDefaultCharHeight) const;
74 
HasMathXml() const75     bool HasMathXml() const
76     {
77         return m_pMathXml != nullptr;
78     }
79     formulaimport::XmlStreamBuilder & GetMathXml();
80 
81 private:
82     TextParagraphProperties     maProperties;
83     TextCharacterProperties     maEndProperties;
84     TextRunVector               maRuns;
85     // temporarily store this here
86     std::unique_ptr<formulaimport::XmlStreamBuilder> m_pMathXml;
87 };
88 
89 } }
90 
91 #endif // INCLUDED_OOX_DRAWINGML_TEXTPARAGRAPH_HXX
92 
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
94