Branch data 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 : : #ifndef INCLUDED_DOMAIN_MAPPER_TABLE_MANAGER_HXX
20 : : #define INCLUDED_DOMAIN_MAPPER_TABLE_MANAGER_HXX
21 : :
22 : : #include "TablePropertiesHandler.hxx"
23 : :
24 : : #include <resourcemodel/TableManager.hxx>
25 : : #include <PropertyMap.hxx>
26 : : #include <StyleSheetTable.hxx>
27 : : #include <com/sun/star/text/XTextRange.hpp>
28 : : #include <vector>
29 : :
30 : : namespace writerfilter {
31 : : namespace dmapper {
32 : :
33 : : class DomainMapperTableManager : public DomainMapperTableManager_Base_t
34 : : {
35 : : typedef boost::shared_ptr< std::vector<sal_Int32> > IntVectorPtr;
36 : :
37 : : sal_uInt32 m_nRow;
38 : : sal_uInt32 m_nCell;
39 : : sal_uInt32 m_nGridSpan;
40 : : sal_uInt32 m_nCellBorderIndex; //borders are provided for all cells and need counting
41 : : sal_Int32 m_nHeaderRepeat; //counter of repeated headers - if == -1 then the repeating stops
42 : : sal_Int32 m_nTableWidth; //might be set directly or has to be calculated from the column positions
43 : : bool m_bOOXML;
44 : : bool m_bImplicitMerges;
45 : : OUString m_sTableStyleName;
46 : : OUString m_sTableVertAnchor;
47 : : PropertyMapPtr m_pTableStyleTextProperies;
48 : :
49 : : ::std::vector< IntVectorPtr > m_aTableGrid;
50 : : ::std::vector< IntVectorPtr > m_aGridSpans;
51 : :
52 : : TablePropertiesHandler *m_pTablePropsHandler;
53 : : PropertyMapPtr m_pStyleProps;
54 : :
55 : : virtual void clearData();
56 : :
57 : : public:
58 : :
59 : : DomainMapperTableManager(bool bOOXML, bool bImplicitMerges);
60 : : virtual ~DomainMapperTableManager();
61 : :
62 : : // use this method to avoid adding the properties for the table
63 : : // but in the provided properties map.
64 : 0 : inline void SetStyleProperties( PropertyMapPtr pProperties ) { m_pStyleProps = pProperties; };
65 : :
66 : : virtual bool sprm(Sprm & rSprm);
67 : :
68 : : virtual void startLevel( );
69 : : virtual void endLevel( );
70 : :
71 : : virtual void endOfCellAction();
72 : : virtual void endOfRowAction();
73 : :
74 : : IntVectorPtr getCurrentGrid( );
75 : : IntVectorPtr getCurrentSpans( );
76 : :
77 : 14511 : const OUString& getTableStyleName() const { return m_sTableStyleName; }
78 : : const OUString& getTableVertAnchor() const;
79 : : /// copy the text properties of the table style and its parent into pContext
80 : : void CopyTextProperties(PropertyMapPtr pContext, StyleSheetTablePtr pStyleSheetTable);
81 : :
82 : 623 : inline virtual void cellProps(TablePropertyMapPtr pProps)
83 : : {
84 [ - + ]: 623 : if ( m_pStyleProps.get( ) )
85 [ # # ][ # # ]: 0 : m_pStyleProps->insert( pProps, true );
[ # # ]
86 : : else
87 [ + - ]: 623 : DomainMapperTableManager_Base_t::cellProps( pProps );
88 : 623 : };
89 : :
90 : 0 : inline virtual void cellPropsByCell(unsigned int i, TablePropertyMapPtr pProps)
91 : : {
92 [ # # ]: 0 : if ( m_pStyleProps.get( ) )
93 [ # # ][ # # ]: 0 : m_pStyleProps->insert( pProps, true );
[ # # ]
94 : : else
95 [ # # ]: 0 : DomainMapperTableManager_Base_t::cellPropsByCell( i, pProps );
96 : 0 : };
97 : :
98 : 119 : inline virtual void insertRowProps(TablePropertyMapPtr pProps)
99 : : {
100 [ - + ]: 119 : if ( m_pStyleProps.get( ) )
101 [ # # ][ # # ]: 0 : m_pStyleProps->insert( pProps, true );
[ # # ]
102 : : else
103 [ + - ]: 119 : DomainMapperTableManager_Base_t::insertRowProps( pProps );
104 : 119 : };
105 : :
106 : 197 : inline virtual void insertTableProps(TablePropertyMapPtr pProps)
107 : : {
108 [ - + ]: 197 : if ( m_pStyleProps.get( ) )
109 [ # # ][ # # ]: 0 : m_pStyleProps->insert( pProps, true );
[ # # ]
110 : : else
111 [ + - ]: 197 : DomainMapperTableManager_Base_t::insertTableProps( pProps );
112 : 197 : };
113 : :
114 : : };
115 : :
116 : : }}
117 : :
118 : : #endif // INCLUDED_DOMAIN_MAPPER_TABLE_MANAGER_HXX
119 : :
120 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|