LibreOffice Module xmloff (master) 1
DlgOASISTContext.cxx
Go to the documentation of this file.
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"
25#include "TransformerBase.hxx"
26#include <osl/diagnose.h>
27
28using namespace ::com::sun::star::uno;
29using namespace ::com::sun::star::xml::sax;
30using namespace ::xmloff::token;
31
34 const OUString& rQName ) :
35 XMLTransformerContext( rImp, rQName )
36{
37}
38
40{
41}
42
44 const Reference< XAttributeList >& rAttrList )
45{
46 XMLTransformerActions *pActions =
48 OSL_ENSURE( pActions, "go no actions" );
49
50 Reference< XAttributeList > xAttrList( rAttrList );
52 sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
53
54 for( sal_Int16 i=0; i < nAttrCount; i++ )
55 {
56 const OUString& rAttrName = xAttrList->getNameByIndex( i );
57 OUString aLocalName;
58 sal_uInt16 nPrefix =
60 &aLocalName );
61
62 XMLTransformerActions::key_type aKey( nPrefix, aLocalName );
63 XMLTransformerActions::const_iterator aIter =
64 pActions->find( aKey );
65
66 if( aIter != pActions->end() )
67 {
68 if( !pMutableAttrList )
69 {
70 pMutableAttrList =
71 new XMLMutableAttributeList( xAttrList );
72 xAttrList = pMutableAttrList;
73 }
74 const OUString& rAttrValue = xAttrList->getValueByIndex( i );
75 switch( (*aIter).second.m_nActionType )
76 {
78 {
79 if ( rAttrValue != GetXMLToken( XML_NONE ) &&
80 rAttrValue != GetXMLToken( XML_SIMPLE ) &&
81 rAttrValue != GetXMLToken( XML_3D ) )
82 {
83 pMutableAttrList->SetValueByIndex(
85 }
86 }
87 break;
88 default:
89 OSL_ENSURE( false, "unknown action" );
90 break;
91 }
92 }
93 }
94
96}
97
98/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@ OASIS_DLG_ACTIONS
@ XML_ATACTION_DLG_BORDER
sal_uInt16 GetKeyByAttrName(const OUString &rAttrName, OUString *pPrefix, OUString *pLocalName, OUString *pNamespace) const
XMLDlgOASISTransformerContext(XMLTransformerBase &rTransformer, const OUString &rQName)
virtual ~XMLDlgOASISTransformerContext() override
virtual void StartElement(const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList) override
virtual XMLTransformerActions * GetUserDefinedActions(sal_uInt16 n)
SvXMLNamespaceMap & GetNamespaceMap()
XMLTransformerBase & GetTransformer()
virtual void StartElement(const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList)
int i
Handling of tokens in XML:
const OUString & GetXMLToken(enum XMLTokenEnum eToken)
return the OUString representation for eToken
Definition: xmltoken.cxx:3541