1b8a377c6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3b8a377c6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4b8a377c6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5b8a377c6SAndrew Rist  * distributed with this work for additional information
6b8a377c6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7b8a377c6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8b8a377c6SAndrew Rist  * "License"); you may not use this file except in compliance
9b8a377c6SAndrew Rist  * with the License.  You may obtain a copy of the License at
10b8a377c6SAndrew Rist  *
11b8a377c6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12b8a377c6SAndrew Rist  *
13b8a377c6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14b8a377c6SAndrew Rist  * software distributed under the License is distributed on an
15b8a377c6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16b8a377c6SAndrew Rist  * KIND, either express or implied.  See the License for the
17b8a377c6SAndrew Rist  * specific language governing permissions and limitations
18b8a377c6SAndrew Rist  * under the License.
19b8a377c6SAndrew Rist  *
20b8a377c6SAndrew Rist  *************************************************************/
21b8a377c6SAndrew Rist 
22b8a377c6SAndrew Rist 
23cdf0e10cSrcweir #ifndef INCLUDED_DOMAIN_MAPPER_TABLE_HANDLER_HXX
24cdf0e10cSrcweir #define INCLUDED_DOMAIN_MAPPER_TABLE_HANDLER_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <resourcemodel/TableManager.hxx>
27cdf0e10cSrcweir #include <PropertyMap.hxx>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <com/sun/star/text/XTextAppendAndConvert.hpp>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir namespace writerfilter {
32cdf0e10cSrcweir namespace dmapper {
33cdf0e10cSrcweir 
34*b63233d8Sdamjan using namespace ::com::sun::star;
35*b63233d8Sdamjan 
36*b63233d8Sdamjan typedef text::XTextRange TextRange_t;
37*b63233d8Sdamjan typedef uno::Reference< TextRange_t > Handle_t;
38*b63233d8Sdamjan typedef uno::Sequence< Handle_t> CellSequence_t;
39cdf0e10cSrcweir typedef boost::shared_ptr<CellSequence_t> CellSequencePointer_t;
40*b63233d8Sdamjan typedef uno::Sequence< CellSequence_t > RowSequence_t;
41cdf0e10cSrcweir typedef boost::shared_ptr<RowSequence_t> RowSequencePointer_t;
42*b63233d8Sdamjan typedef uno::Sequence< RowSequence_t> TableSequence_t;
43cdf0e10cSrcweir typedef boost::shared_ptr<TableSequence_t> TableSequencePointer_t;
44*b63233d8Sdamjan typedef text::XTextAppendAndConvert Text_t;
45*b63233d8Sdamjan typedef uno::Reference<Text_t> TextReference_t;
46cdf0e10cSrcweir 
47*b63233d8Sdamjan typedef beans::PropertyValues                     TablePropertyValues_t;
48*b63233d8Sdamjan typedef uno::Sequence< TablePropertyValues_t >    RowPropertyValuesSeq_t;
49*b63233d8Sdamjan typedef uno::Sequence< RowPropertyValuesSeq_t>    CellPropertyValuesSeq_t;
50cdf0e10cSrcweir 
51cdf0e10cSrcweir typedef std::vector<PropertyMapPtr>     PropertyMapVector1;
52cdf0e10cSrcweir typedef std::vector<PropertyMapVector1> PropertyMapVector2;
53cdf0e10cSrcweir 
54*b63233d8Sdamjan #ifdef DEBUG_DMAPPER_TABLE_HANDLER
55*b63233d8Sdamjan XMLTag::Pointer_t handleToTag(Handle_t & rHandle);
56*b63233d8Sdamjan void cellSequenceToTag(XMLTag::Pointer_t pTag, CellSequence_t & pCellSequence);
57*b63233d8Sdamjan void rowSequenceToTag(XMLTag::Pointer_t pTag, RowSequence_t & pRowSequence);
58*b63233d8Sdamjan XMLTag::Pointer_t tableSequenceToTag(TableSequence_t & rTableSequence);
59*b63233d8Sdamjan #endif
60*b63233d8Sdamjan 
61cdf0e10cSrcweir class DomainMapper_Impl;
62cdf0e10cSrcweir class TableStyleSheetEntry;
63cdf0e10cSrcweir struct TableInfo;
64cdf0e10cSrcweir class DomainMapperTableHandler : public TableDataHandler<Handle_t , TablePropertyMapPtr >
65cdf0e10cSrcweir {
6614ac695dSOliver-Rainer Wittmann public:
6714ac695dSOliver-Rainer Wittmann     typedef boost::shared_ptr<DomainMapperTableHandler> Pointer_t;
6814ac695dSOliver-Rainer Wittmann 
6914ac695dSOliver-Rainer Wittmann     DomainMapperTableHandler(TextReference_t xText, DomainMapper_Impl& rDMapper_Impl);
7014ac695dSOliver-Rainer Wittmann     virtual ~DomainMapperTableHandler();
7114ac695dSOliver-Rainer Wittmann 
7214ac695dSOliver-Rainer Wittmann     virtual void startTable(
7314ac695dSOliver-Rainer Wittmann         unsigned int nRows,
7414ac695dSOliver-Rainer Wittmann         unsigned int nDepth,
7514ac695dSOliver-Rainer Wittmann         TablePropertyMapPtr pProps );
7614ac695dSOliver-Rainer Wittmann 
7714ac695dSOliver-Rainer Wittmann     virtual void endTable(
7814ac695dSOliver-Rainer Wittmann         const unsigned int nDepth );
7914ac695dSOliver-Rainer Wittmann 
8014ac695dSOliver-Rainer Wittmann     virtual void startRow(
8114ac695dSOliver-Rainer Wittmann         unsigned int nCells,
8214ac695dSOliver-Rainer Wittmann         TablePropertyMapPtr pProps );
8314ac695dSOliver-Rainer Wittmann 
8414ac695dSOliver-Rainer Wittmann     virtual void endRow();
8514ac695dSOliver-Rainer Wittmann 
8614ac695dSOliver-Rainer Wittmann     virtual void startCell(
8714ac695dSOliver-Rainer Wittmann         const Handle_t & start,
8814ac695dSOliver-Rainer Wittmann         TablePropertyMapPtr pProps );
8914ac695dSOliver-Rainer Wittmann 
9014ac695dSOliver-Rainer Wittmann     virtual void endCell( const Handle_t & end );
9114ac695dSOliver-Rainer Wittmann 
getTable()9214ac695dSOliver-Rainer Wittmann     virtual Handle_t* getTable( )
9314ac695dSOliver-Rainer Wittmann     {
9414ac695dSOliver-Rainer Wittmann         return &m_xTableRange;
9514ac695dSOliver-Rainer Wittmann     };
9614ac695dSOliver-Rainer Wittmann 
9714ac695dSOliver-Rainer Wittmann private:
98cdf0e10cSrcweir     TextReference_t         m_xText;
99cdf0e10cSrcweir     DomainMapper_Impl&      m_rDMapper_Impl;
100cdf0e10cSrcweir     CellSequencePointer_t   m_pCellSeq;
101cdf0e10cSrcweir     RowSequencePointer_t    m_pRowSeq;
102cdf0e10cSrcweir     TableSequencePointer_t  m_pTableSeq;
103cdf0e10cSrcweir 
104cdf0e10cSrcweir     Handle_t               m_xTableRange;
105cdf0e10cSrcweir 
106cdf0e10cSrcweir     // properties
107cdf0e10cSrcweir     PropertyMapVector2      m_aCellProperties;
108cdf0e10cSrcweir     PropertyMapVector1      m_aRowProperties;
109cdf0e10cSrcweir     TablePropertyMapPtr     m_aTableProperties;
110cdf0e10cSrcweir 
111cdf0e10cSrcweir     sal_Int32 m_nCellIndex;
112cdf0e10cSrcweir     sal_Int32 m_nRowIndex;
113cdf0e10cSrcweir 
11414ac695dSOliver-Rainer Wittmann     TableStyleSheetEntry * endTableGetTableStyle(
11514ac695dSOliver-Rainer Wittmann         TableInfo & rInfo,
11614ac695dSOliver-Rainer Wittmann         const bool bAdjustLeftMarginByDefaultValue );
117cdf0e10cSrcweir 
11814ac695dSOliver-Rainer Wittmann     CellPropertyValuesSeq_t endTableGetCellProperties(TableInfo & rInfo);
119cdf0e10cSrcweir 
12014ac695dSOliver-Rainer Wittmann     RowPropertyValuesSeq_t endTableGetRowProperties();
121cdf0e10cSrcweir };
122cdf0e10cSrcweir 
123cdf0e10cSrcweir }}
124cdf0e10cSrcweir 
125cdf0e10cSrcweir #endif // INCLUDED_DOMAIN_MAPPER_TABLE_HANDLER_HXX
126