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