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_TABLEPROPERTIESHANDLER_HXX
21 : #define INCLUDED_TABLEPROPERTIESHANDLER_HXX
22 :
23 : #include <PropertyMap.hxx>
24 :
25 : #include <resourcemodel/TableManager.hxx>
26 : #include <WriterFilterDllApi.hxx>
27 : #include <resourcemodel/WW8ResourceModel.hxx>
28 :
29 : #include <boost/shared_ptr.hpp>
30 :
31 : #include <vector>
32 :
33 : namespace writerfilter {
34 : namespace dmapper {
35 :
36 :
37 : typedef ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > Handle_t;
38 : typedef TableManager<Handle_t , TablePropertyMapPtr > DomainMapperTableManager_Base_t;
39 :
40 : class TablePropertiesHandler
41 : {
42 : private:
43 : vector< PropertyMapPtr > m_rPropertiesStack;
44 : PropertyMapPtr m_pCurrentProperties;
45 : DomainMapperTableManager_Base_t *m_pTableManager;
46 : bool m_bOOXML;
47 :
48 : public:
49 : TablePropertiesHandler( bool bOOXML );
50 : virtual ~TablePropertiesHandler( );
51 :
52 : bool sprm(Sprm & sprm);
53 :
54 301 : inline void SetTableManager( DomainMapperTableManager_Base_t *pTableManager )
55 : {
56 301 : m_pTableManager = pTableManager;
57 301 : };
58 :
59 2208 : inline void SetProperties( PropertyMapPtr pProperties )
60 : {
61 2208 : m_pCurrentProperties = pProperties;
62 2208 : };
63 :
64 : private:
65 :
66 317 : inline void cellProps( TablePropertyMapPtr pProps )
67 : {
68 317 : if ( m_pTableManager )
69 309 : m_pTableManager->cellProps( pProps );
70 : else
71 8 : m_pCurrentProperties->InsertProps(pProps);
72 317 : };
73 :
74 : inline void cellPropsByCell( unsigned int i, TablePropertyMapPtr pProps )
75 : {
76 : if ( m_pTableManager )
77 : m_pTableManager->cellPropsByCell( i, pProps );
78 : else
79 : m_pCurrentProperties->InsertProps(pProps);
80 : };
81 :
82 24 : inline void insertRowProps( TablePropertyMapPtr pProps )
83 : {
84 24 : if ( m_pTableManager )
85 24 : m_pTableManager->insertRowProps( pProps );
86 : else
87 0 : m_pCurrentProperties->InsertProps(pProps);
88 24 : };
89 :
90 223 : inline void insertTableProps( TablePropertyMapPtr pProps )
91 : {
92 223 : if ( m_pTableManager )
93 95 : m_pTableManager->insertTableProps( pProps );
94 : else
95 128 : m_pCurrentProperties->InsertProps(pProps);
96 223 : };
97 : };
98 : typedef boost::shared_ptr<TablePropertiesHandler> TablePropertiesHandlerPtr;
99 :
100 : } }
101 :
102 : #endif
103 :
104 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|