1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: DlgOASISTContext.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_xmloff.hxx"
33 #include "DlgOASISTContext.hxx"
34 #include "MutableAttrList.hxx"
35 #include "xmlnmspe.hxx"
36 #include "ActionMapTypesOASIS.hxx"
37 #include "AttrTransformerAction.hxx"
38 #include "TransformerActions.hxx"
39 #ifndef _XMLOFF_TRANSFORMERBASE_HXX
40 #include "TransformerBase.hxx"
43 using ::rtl::OUString
;
45 using namespace ::com::sun::star::uno
;
46 using namespace ::com::sun::star::xml::sax
;
47 using namespace ::xmloff::token
;
49 // -----------------------------------------------------------------------------
51 TYPEINIT1( XMLDlgOASISTransformerContext
, XMLTransformerContext
);
53 XMLDlgOASISTransformerContext::XMLDlgOASISTransformerContext(
54 XMLTransformerBase
& rImp
,
55 const OUString
& rQName
) :
56 XMLTransformerContext( rImp
, rQName
)
60 XMLDlgOASISTransformerContext::~XMLDlgOASISTransformerContext()
64 void XMLDlgOASISTransformerContext::StartElement(
65 const Reference
< XAttributeList
>& rAttrList
)
67 XMLTransformerActions
*pActions
=
68 GetTransformer().GetUserDefinedActions( OASIS_DLG_ACTIONS
);
69 OSL_ENSURE( pActions
, "go no actions" );
71 Reference
< XAttributeList
> xAttrList( rAttrList
);
72 XMLMutableAttributeList
*pMutableAttrList
= 0;
73 sal_Int16 nAttrCount
= xAttrList
.is() ? xAttrList
->getLength() : 0;
75 for( sal_Int16 i
=0; i
< nAttrCount
; i
++ )
77 const OUString
& rAttrName
= xAttrList
->getNameByIndex( i
);
80 GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName
,
83 XMLTransformerActions::key_type
aKey( nPrefix
, aLocalName
);
84 XMLTransformerActions::const_iterator aIter
=
85 pActions
->find( aKey
);
87 if( !(aIter
== pActions
->end() ) )
89 if( !pMutableAttrList
)
92 new XMLMutableAttributeList( xAttrList
);
93 xAttrList
= pMutableAttrList
;
95 const OUString
& rAttrValue
= xAttrList
->getValueByIndex( i
);
96 switch( (*aIter
).second
.m_nActionType
)
98 case XML_ATACTION_DLG_BORDER
:
100 OUString
aAttrValue( rAttrValue
);
102 if ( !aAttrValue
.equals( GetXMLToken( XML_NONE
) ) &&
103 !aAttrValue
.equals( GetXMLToken( XML_SIMPLE
) ) &&
104 !aAttrValue
.equals( GetXMLToken( XML_3D
) ) )
106 pMutableAttrList
->SetValueByIndex(
107 i
, GetXMLToken( XML_NONE
) );
112 OSL_ENSURE( !this, "unknown action" );
118 XMLTransformerContext::StartElement( xAttrList
);