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 : std::vector<beans::PropertyValue>* m_pCurrentInteropGrabBag;
46 : DomainMapperTableManager_Base_t *m_pTableManager;
47 : bool m_bOOXML;
48 :
49 : public:
50 : TablePropertiesHandler( bool bOOXML );
51 : virtual ~TablePropertiesHandler( );
52 :
53 : bool sprm(Sprm & sprm);
54 :
55 3009 : inline void SetTableManager( DomainMapperTableManager_Base_t *pTableManager )
56 : {
57 3009 : m_pTableManager = pTableManager;
58 3009 : };
59 :
60 25600 : inline void SetProperties( PropertyMapPtr pProperties )
61 : {
62 25600 : m_pCurrentProperties = pProperties;
63 25600 : };
64 :
65 : void SetInteropGrabBag(std::vector<beans::PropertyValue>& rValue);
66 :
67 : private:
68 :
69 10072 : inline void cellProps( TablePropertyMapPtr pProps )
70 : {
71 10072 : if ( m_pTableManager )
72 8892 : m_pTableManager->cellProps( pProps );
73 : else
74 1180 : m_pCurrentProperties->InsertProps(pProps);
75 10072 : };
76 :
77 : inline void cellPropsByCell( unsigned int i, TablePropertyMapPtr pProps )
78 : {
79 : if ( m_pTableManager )
80 : m_pTableManager->cellPropsByCell( i, pProps );
81 : else
82 : m_pCurrentProperties->InsertProps(pProps);
83 : };
84 :
85 1372 : inline void insertRowProps( TablePropertyMapPtr pProps )
86 : {
87 1372 : if ( m_pTableManager )
88 1372 : m_pTableManager->insertRowProps( pProps );
89 : else
90 0 : m_pCurrentProperties->InsertProps(pProps);
91 1372 : };
92 :
93 6002 : inline void insertTableProps( TablePropertyMapPtr pProps )
94 : {
95 6002 : if ( m_pTableManager )
96 3212 : m_pTableManager->insertTableProps( pProps );
97 : else
98 2790 : m_pCurrentProperties->InsertProps(pProps);
99 6002 : };
100 : };
101 : typedef boost::shared_ptr<TablePropertiesHandler> TablePropertiesHandlerPtr;
102 :
103 : } }
104 :
105 : #endif
106 :
107 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|