1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <TblStylePrHandler.hxx>
21 #include <PropertyMap.hxx>
22 #include <ooxml/resourceids.hxx>
23 #include <dmapperLoggers.hxx>
24 #include <resourcemodel/QNameToString.hxx>
26 #include "dmapperLoggers.hxx"
28 namespace writerfilter
{
31 TblStylePrHandler::TblStylePrHandler( DomainMapper
& rDMapper
) :
32 LoggedProperties(dmapper_logger
, "TblStylePrHandler"),
33 m_rDMapper( rDMapper
),
34 m_pTablePropsHandler( new TablePropertiesHandler( true ) ),
35 m_nType( TBL_STYLE_UNKNOWN
),
36 m_pProperties( new PropertyMap
)
40 TblStylePrHandler::~TblStylePrHandler( )
42 delete m_pTablePropsHandler
, m_pTablePropsHandler
= NULL
;
45 void TblStylePrHandler::lcl_attribute(Id rName
, Value
& rVal
)
47 #ifdef DEBUG_DOMAINMAPPER
48 dmapper_logger
->startElement("TblStylePrHandler.attribute");
49 dmapper_logger
->attribute("name", (*QNameToString::Instance())(rName
));
50 dmapper_logger
->chars(rVal
.toString());
51 dmapper_logger
->endElement();
56 case NS_ooxml::LN_CT_TblStyleOverrideType
:
58 // The tokenid should be the same in the model.xml than
59 // in the TblStyleType enum
60 m_nType
= TblStyleType( rVal
.getInt( ) );
66 void TblStylePrHandler::lcl_sprm(Sprm
& rSprm
)
68 #ifdef DEBUG_DOMAINMAPPER
69 dmapper_logger
->startElement("TblStylePrHandler.sprm");
70 dmapper_logger
->attribute("sprm", rSprm
.toString());
73 Value::Pointer_t pValue
= rSprm
.getValue();
74 switch ( rSprm
.getId( ) )
76 case NS_ooxml::LN_CT_PPrBase
:
77 case NS_ooxml::LN_EG_RPrBase
:
78 case NS_ooxml::LN_CT_TblPrBase
:
79 case NS_ooxml::LN_CT_TrPrBase
:
80 case NS_ooxml::LN_CT_TcPrBase
:
81 resolveSprmProps( rSprm
);
84 // Tables specific properties have to handled here
85 m_pTablePropsHandler
->SetProperties( m_pProperties
);
86 bool bRet
= m_pTablePropsHandler
->sprm( rSprm
);
90 // The DomainMapper can handle some of the properties
91 m_rDMapper
.PushStyleSheetProperties( m_pProperties
, true );
92 m_rDMapper
.sprm( rSprm
);
93 m_rDMapper
.PopStyleSheetProperties( true );
97 #ifdef DEBUG_DOMAINMAPPER
98 dmapper_logger
->endElement();
102 void TblStylePrHandler::resolveSprmProps(Sprm
& rSprm
)
104 writerfilter::Reference
<Properties
>::Pointer_t pProperties
= rSprm
.getProps();
105 if( pProperties
.get())
106 pProperties
->resolve(*this);
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */