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 <resourcemodel/WW8ResourceModel.hxx>
27 :
28 : #include <boost/shared_ptr.hpp>
29 :
30 : #include <vector>
31 :
32 : namespace writerfilter {
33 : namespace dmapper {
34 :
35 :
36 : typedef ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > Handle_t;
37 : typedef TableManager<Handle_t , TablePropertyMapPtr > DomainMapperTableManager_Base_t;
38 :
39 : class TablePropertiesHandler
40 : {
41 : private:
42 : vector< PropertyMapPtr > m_rPropertiesStack;
43 : PropertyMapPtr m_pCurrentProperties;
44 : std::vector<beans::PropertyValue>* m_pCurrentInteropGrabBag;
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 0 : inline void SetTableManager( DomainMapperTableManager_Base_t *pTableManager )
55 : {
56 0 : m_pTableManager = pTableManager;
57 0 : };
58 :
59 0 : inline void SetProperties( PropertyMapPtr pProperties )
60 : {
61 0 : m_pCurrentProperties = pProperties;
62 0 : };
63 :
64 : void SetInteropGrabBag(std::vector<beans::PropertyValue>& rValue);
65 :
66 : private:
67 :
68 0 : inline void cellProps( TablePropertyMapPtr pProps )
69 : {
70 0 : if ( m_pTableManager )
71 0 : m_pTableManager->cellProps( pProps );
72 : else
73 0 : m_pCurrentProperties->InsertProps(pProps);
74 0 : };
75 :
76 : inline void cellPropsByCell( unsigned int i, TablePropertyMapPtr pProps )
77 : {
78 : if ( m_pTableManager )
79 : m_pTableManager->cellPropsByCell( i, pProps );
80 : else
81 : m_pCurrentProperties->InsertProps(pProps);
82 : };
83 :
84 0 : inline void insertRowProps( TablePropertyMapPtr pProps )
85 : {
86 0 : if ( m_pTableManager )
87 0 : m_pTableManager->insertRowProps( pProps );
88 : else
89 0 : m_pCurrentProperties->InsertProps(pProps);
90 0 : };
91 :
92 0 : inline void insertTableProps( TablePropertyMapPtr pProps )
93 : {
94 0 : if ( m_pTableManager )
95 0 : m_pTableManager->insertTableProps( pProps );
96 : else
97 0 : m_pCurrentProperties->InsertProps(pProps);
98 0 : };
99 : };
100 : typedef boost::shared_ptr<TablePropertiesHandler> TablePropertiesHandlerPtr;
101 :
102 : } }
103 :
104 : #endif
105 :
106 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|