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_WRITERFILTER_SOURCE_DMAPPER_TABLEPROPERTIESHANDLER_HXX
21 : #define INCLUDED_WRITERFILTER_SOURCE_DMAPPER_TABLEPROPERTIESHANDLER_HXX
22 :
23 : #include "PropertyMap.hxx"
24 :
25 : #include <TableManager.hxx>
26 : #include <dmapper/resourcemodel.hxx>
27 :
28 : #include <memory>
29 :
30 : #include <vector>
31 :
32 : namespace writerfilter {
33 : namespace dmapper {
34 :
35 : class DomainMapper;
36 :
37 : class TablePropertiesHandler
38 : {
39 : private:
40 : std::vector< PropertyMapPtr > m_rPropertiesStack;
41 : PropertyMapPtr m_pCurrentProperties;
42 : std::vector<css::beans::PropertyValue>* m_pCurrentInteropGrabBag;
43 : TableManager* m_pTableManager;
44 :
45 : public:
46 : TablePropertiesHandler();
47 : virtual ~TablePropertiesHandler( );
48 :
49 : bool sprm(Sprm & sprm);
50 :
51 4834 : inline void SetTableManager( TableManager* pTableManager )
52 : {
53 4834 : m_pTableManager = pTableManager;
54 4834 : };
55 :
56 57836 : inline void SetProperties( PropertyMapPtr pProperties )
57 : {
58 57836 : m_pCurrentProperties = pProperties;
59 57836 : };
60 :
61 : void SetInteropGrabBag(std::vector<css::beans::PropertyValue>& rValue);
62 :
63 : private:
64 :
65 16478 : inline void cellProps( TablePropertyMapPtr pProps )
66 : {
67 16478 : if ( m_pTableManager )
68 12985 : m_pTableManager->cellProps( pProps );
69 : else
70 3493 : m_pCurrentProperties->InsertProps(pProps);
71 16478 : };
72 :
73 : inline void cellPropsByCell( unsigned int i, TablePropertyMapPtr pProps )
74 : {
75 : if ( m_pTableManager )
76 : m_pTableManager->cellPropsByCell( i, pProps );
77 : else
78 : m_pCurrentProperties->InsertProps(pProps);
79 : };
80 :
81 1593 : inline void insertRowProps( TablePropertyMapPtr pProps )
82 : {
83 1593 : if ( m_pTableManager )
84 1593 : m_pTableManager->insertRowProps( pProps );
85 : else
86 0 : m_pCurrentProperties->InsertProps(pProps);
87 1593 : };
88 :
89 11278 : inline void insertTableProps( TablePropertyMapPtr pProps )
90 : {
91 11278 : if ( m_pTableManager )
92 5314 : m_pTableManager->insertTableProps( pProps );
93 : else
94 5964 : m_pCurrentProperties->InsertProps(pProps);
95 11278 : };
96 : };
97 : typedef std::shared_ptr<TablePropertiesHandler> TablePropertiesHandlerPtr;
98 :
99 : } }
100 :
101 : #endif
102 :
103 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|