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 : #include "DlgOASISTContext.hxx"
21 : #include "MutableAttrList.hxx"
22 : #include "xmloff/xmlnmspe.hxx"
23 : #include "ActionMapTypesOASIS.hxx"
24 : #include "AttrTransformerAction.hxx"
25 : #include "TransformerActions.hxx"
26 : #include "TransformerBase.hxx"
27 :
28 :
29 : using namespace ::com::sun::star::uno;
30 : using namespace ::com::sun::star::xml::sax;
31 : using namespace ::xmloff::token;
32 :
33 : // -----------------------------------------------------------------------------
34 :
35 0 : TYPEINIT1( XMLDlgOASISTransformerContext, XMLTransformerContext);
36 :
37 0 : XMLDlgOASISTransformerContext::XMLDlgOASISTransformerContext(
38 : XMLTransformerBase& rImp,
39 : const OUString& rQName ) :
40 0 : XMLTransformerContext( rImp, rQName )
41 : {
42 0 : }
43 :
44 0 : XMLDlgOASISTransformerContext::~XMLDlgOASISTransformerContext()
45 : {
46 0 : }
47 :
48 0 : void XMLDlgOASISTransformerContext::StartElement(
49 : const Reference< XAttributeList >& rAttrList )
50 : {
51 : XMLTransformerActions *pActions =
52 0 : GetTransformer().GetUserDefinedActions( OASIS_DLG_ACTIONS );
53 : OSL_ENSURE( pActions, "go no actions" );
54 :
55 0 : Reference< XAttributeList > xAttrList( rAttrList );
56 0 : XMLMutableAttributeList *pMutableAttrList = 0;
57 0 : sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
58 :
59 0 : for( sal_Int16 i=0; i < nAttrCount; i++ )
60 : {
61 0 : const OUString& rAttrName = xAttrList->getNameByIndex( i );
62 0 : OUString aLocalName;
63 : sal_uInt16 nPrefix =
64 0 : GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName,
65 0 : &aLocalName );
66 :
67 0 : XMLTransformerActions::key_type aKey( nPrefix, aLocalName );
68 : XMLTransformerActions::const_iterator aIter =
69 0 : pActions->find( aKey );
70 :
71 0 : if( !(aIter == pActions->end() ) )
72 : {
73 0 : if( !pMutableAttrList )
74 : {
75 : pMutableAttrList =
76 0 : new XMLMutableAttributeList( xAttrList );
77 0 : xAttrList = pMutableAttrList;
78 : }
79 0 : const OUString& rAttrValue = xAttrList->getValueByIndex( i );
80 0 : switch( (*aIter).second.m_nActionType )
81 : {
82 : case XML_ATACTION_DLG_BORDER:
83 : {
84 0 : OUString aAttrValue( rAttrValue );
85 :
86 0 : if ( !aAttrValue.equals( GetXMLToken( XML_NONE ) ) &&
87 0 : !aAttrValue.equals( GetXMLToken( XML_SIMPLE ) ) &&
88 0 : !aAttrValue.equals( GetXMLToken( XML_3D ) ) )
89 : {
90 : pMutableAttrList->SetValueByIndex(
91 0 : i, GetXMLToken( XML_NONE ) );
92 0 : }
93 : }
94 0 : break;
95 : default:
96 : OSL_ENSURE( !this, "unknown action" );
97 0 : break;
98 0 : }
99 : }
100 0 : }
101 :
102 0 : XMLTransformerContext::StartElement( xAttrList );
103 0 : }
104 :
105 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|