diff options
Diffstat (limited to 'xmloff/source/transform')
88 files changed, 19010 insertions, 0 deletions
diff --git a/xmloff/source/transform/ActionMapTypesOASIS.hxx b/xmloff/source/transform/ActionMapTypesOASIS.hxx new file mode 100644 index 000000000000..2eeebf15c885 --- /dev/null +++ b/xmloff/source/transform/ActionMapTypesOASIS.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_ACTIONMAPTYPESOASIS_HXX +#define _XMLOFF_ACTIONMAPTYPESOASIS_HXX + +enum ActionMapTypesOOo +{ + PROP_OASIS_GRAPHIC_ATTR_ACTIONS, + PROP_OASIS_DRAWING_PAGE_ATTR_ACTIONS, + PROP_OASIS_PAGE_LAYOUT_ATTR_ACTIONS, + PROP_OASIS_HEADER_FOOTER_ATTR_ACTIONS, + PROP_OASIS_TEXT_ATTR_ACTIONS, + PROP_OASIS_PARAGRAPH_ATTR_ACTIONS, + PROP_OASIS_SECTION_ATTR_ACTIONS, + PROP_OASIS_TABLE_ATTR_ACTIONS, + PROP_OASIS_TABLE_COLUMN_ATTR_ACTIONS, + PROP_OASIS_TABLE_ROW_ATTR_ACTIONS, + PROP_OASIS_TABLE_CELL_ATTR_ACTIONS, + PROP_OASIS_LIST_LEVEL_ATTR_ACTIONS, + PROP_OASIS_CHART_ATTR_ACTIONS, + MAX_OASIS_PROP_ACTIONS, + OASIS_STYLE_ACTIONS = MAX_OASIS_PROP_ACTIONS, + OASIS_FONT_FACE_ACTIONS, + OASIS_SHAPE_ACTIONS, + OASIS_CONNECTOR_ACTIONS, + OASIS_INDEX_ENTRY_TAB_STOP_ACTIONS, + OASIS_TAB_STOP_ACTIONS, + OASIS_LINENUMBERING_ACTIONS, + OASIS_FOOTNOTE_SEP_ACTIONS, + OASIS_DROP_CAP_ACTIONS, + OASIS_COLUMNS_ACTIONS, + OASIS_TEXT_VALUE_TYPE_ACTIONS, + OASIS_TABLE_VALUE_TYPE_ACTIONS, + OASIS_PARA_ACTIONS, + OASIS_LIST_STYLE_REF_ACTIONS, + OASIS_TEXT_STYLE_REF_ACTIONS, + OASIS_PARA_STYLE_REF_ACTIONS, + OASIS_MASTER_PAGE_REF_ACTIONS, + OASIS_MAP_STYLE_REF_ACTIONS, + OASIS_MASTER_PAGE_ACTIONS, + OASIS_NOTES_ACTIONS, + OASIS_ANNOTATION_ACTIONS, + OASIS_CHANGE_INFO_ACTIONS, + OASIS_FRAME_ELEM_ACTIONS, + OASIS_BACKGROUND_IMAGE_ACTIONS, + OASIS_DDE_CONNECTION_DECL_ACTIONS, + OASIS_EVENT_ACTIONS, + OASIS_DLG_ACTIONS, + OASIS_FORM_CONTROL_ACTIONS, + OASIS_FORM_COLUMN_ACTIONS, + OASIS_FORM_PROP_ACTIONS, + OASIS_XLINK_ACTIONS, + OASIS_CONFIG_ITEM_SET_ACTIONS, + OASIS_FORMULA_ACTIONS, + OASIS_CHART_ACTIONS, + OASIS_FORM_ACTIONS, + OASIS_ALPHABETICAL_INDEX_MARK_ACTIONS, + OASIS_CONTENT_VALIDATION_ACTIONS, + OASIS_DDE_CONV_MODE_ACTIONS, + OASIS_DATAPILOT_MEMBER_ACTIONS, + OASIS_DATAPILOT_LEVEL_ACTIONS, + OASIS_SOURCE_SERVICE_ACTIONS, + OASIS_DRAW_AREA_POLYGON_ACTIONS, + OASIS_SCRIPT_ACTIONS, + OASIS_DATETIME_ACTIONS, + OASIS_TABLE_STYLE_REF_ACTIONS, + OASIS_ANIMATION_ACTIONS, + MAX_OASIS_ACTIONS +}; + +#endif // _XMLOFF_ACTIONMAPTYPESOASIS_HXX diff --git a/xmloff/source/transform/ActionMapTypesOOo.hxx b/xmloff/source/transform/ActionMapTypesOOo.hxx new file mode 100644 index 000000000000..ff8081b025cf --- /dev/null +++ b/xmloff/source/transform/ActionMapTypesOOo.hxx @@ -0,0 +1,92 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_ACTIONMAPTYPESOOO_HXX +#define _XMLOFF_ACTIONMAPTYPESOOO_HXX + +enum ActionMapTypesOOo +{ + PROP_OOO_GRAPHIC_ATTR_ACTIONS, + PROP_OOO_GRAPHIC_ELEM_ACTIONS, + PROP_OOO_DRAWING_PAGE_ATTR_ACTIONS, + PROP_OOO_PAGE_LAYOUT_ATTR_ACTIONS, + PROP_OOO_HEADER_FOOTER_ATTR_ACTIONS, + PROP_OOO_TEXT_ATTR_ACTIONS, + PROP_OOO_TEXT_ELEM_ACTIONS, + PROP_OOO_PARAGRAPH_ATTR_ACTIONS, + PROP_OOO_PARAGRAPH_ELEM_ACTIONS, + PROP_OOO_SECTION_ATTR_ACTIONS, + PROP_OOO_TABLE_ATTR_ACTIONS, + PROP_OOO_TABLE_COLUMN_ATTR_ACTIONS, + PROP_OOO_TABLE_ROW_ATTR_ACTIONS, + PROP_OOO_TABLE_CELL_ATTR_ACTIONS, + PROP_OOO_TABLE_CELL_ELEM_ACTIONS, + PROP_OOO_LIST_LEVEL_ATTR_ACTIONS, + PROP_OOO_CHART_ATTR_ACTIONS, + PROP_OOO_CHART_ELEM_ACTIONS, + MAX_OOO_PROP_ACTIONS, + OOO_STYLE_ACTIONS = MAX_OOO_PROP_ACTIONS, + OOO_FONT_DECL_ACTIONS, + OOO_SHAPE_ACTIONS, + OOO_CONNECTOR_ACTIONS, + OOO_INDEX_ENTRY_TAB_STOP_ACTIONS, + OOO_TAB_STOP_ACTIONS, + OOO_LINENUMBERING_ACTIONS, + OOO_FOOTNOTE_SEP_ACTIONS, + OOO_DROP_CAP_ACTIONS, + OOO_COLUMNS_ACTIONS, + OOO_TEXT_VALUE_TYPE_ACTIONS, + OOO_TABLE_VALUE_TYPE_ACTIONS, + OOO_PARA_ACTIONS, + OOO_STYLE_REF_ACTIONS, + OOO_MASTER_PAGE_ACTIONS, + OOO_ANNOTATION_ACTIONS, + OOO_CHANGE_INFO_ACTIONS, + OOO_FRAME_ELEM_ACTIONS, + OOO_FRAME_ATTR_ACTIONS, + OOO_BACKGROUND_IMAGE_ACTIONS, + OOO_DDE_CONNECTION_DECL_ACTIONS, + OOO_EVENT_ACTIONS, + OOO_FORM_CONTROL_ACTIONS, + OOO_FORM_COLUMN_ACTIONS, + OOO_FORM_PROP_ACTIONS, + OOO_XLINK_ACTIONS, + OOO_CONFIG_ITEM_SET_ACTIONS, + OOO_FORMULA_ACTIONS, + OOO_CHART_ACTIONS, + OOO_ERROR_MACRO_ACTIONS, + OOO_DDE_CONV_MODE_ACTIONS, + OOO_ALPHABETICAL_INDEX_MARK_ACTIONS, + OOO_DATAPILOT_MEMBER_ACTIONS, + OOO_DATAPILOT_LEVEL_ACTIONS, + OOO_SOURCE_SERVICE_ACTIONS, + OOO_DRAW_AREA_POLYGON_ACTIONS, + OOO_SCRIPT_ACTIONS, + MAX_OOO_ACTIONS +}; + +#endif // _XMLOFF_ACTIONMAPTYPESOOO_HXX diff --git a/xmloff/source/transform/AttrTransformerAction.hxx b/xmloff/source/transform/AttrTransformerAction.hxx new file mode 100644 index 000000000000..ffcd8b43ada0 --- /dev/null +++ b/xmloff/source/transform/AttrTransformerAction.hxx @@ -0,0 +1,142 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_ATTRTRANSFORMERACTION_HXX +#define _XMLOFF_ATTRTRANSFORMERACTION_HXX + +#include "TransformerAction.hxx" + +enum XMLAttrTransformerAction +{ + XML_ATACTION_EOT=XML_TACTION_EOT, // uses for initialization only + XML_ATACTION_COPY, // copy attr + XML_ATACTION_RENAME, // rename attr: + // - param1: namespace + + // token of local name + XML_ATACTION_REMOVE, // remove attr + XML_ATACTION_IN2INCH, // replace "in" with "inch" + XML_ATACTION_INS2INCHS, // replace "in" with "inch" + // multiple times + XML_ATACTION_IN2TWIPS, // replace "in" with "inch" and + // convert value from inch to twips + // but only for writer documents + XML_ATACTION_RENAME_IN2INCH, // replace "in" with "inch" and rename + // attr: + // - param1: namespace + + // token of local name + XML_ATACTION_INCH2IN, // replace "inch" with "in" + XML_ATACTION_INCHS2INS, // replace "inch" with "in" + // multiple times + XML_ATACTION_TWIPS2IN, // replace "inch" with "in" and for writer + // documents convert measure value from twips + // to inch + XML_ATACTION_RENAME_INCH2IN, // replace "inch" with "in" and rename + // attr: + // - param1: namespace + + // token of local name + XML_ATACTION_STYLE_FAMILY, // NOP, used for style:family + XML_ATACTION_DECODE_STYLE_NAME, // NOP, used for style:name + // - param1: style family + XML_ATACTION_STYLE_DISPLAY_NAME, // NOP, used for style:display_name + // - param1: style family + XML_ATACTION_DECODE_STYLE_NAME_REF, // NOP, used for style:name reference + // - param1: style family + XML_ATACTION_RENAME_DECODE_STYLE_NAME_REF, // NOP, used for style:name + // - param1: namespace + + // token of local name + XML_ATACTION_ENCODE_STYLE_NAME, // NOP, used for style:name + XML_ATACTION_ENCODE_STYLE_NAME_REF, // NOP, used for style:name + XML_ATACTION_RENAME_ENCODE_STYLE_NAME_REF, // NOP, used for style:name + // - param1: namespace + + // token of local name + // - param2: style family + XML_ATACTION_MOVE_TO_ELEM, // turn attr into an elem + // - param1: namespace + + // token of local name + XML_ATACTION_MOVE_FROM_ELEM, // turn elem into an attr: + // - param1: namespace + + // token of local name + XML_ATACTION_NEG_PERCENT, // replace % val with 100-% + XML_ATACTION_RENAME_NEG_PERCENT, // replace % val with 100-%, rename attr + // - param1: namespace + + // token of local name + XML_ATACTION_HREF, // xmlink:href + XML_ATACTION_ADD_NAMESPACE_PREFIX, // add a namespace prefix + // - param1: prefix + XML_ATACTION_ADD_APP_NAMESPACE_PREFIX, // add a namespace prefix + // - param1: default prefix + XML_ATACTION_RENAME_ADD_NAMESPACE_PREFIX, // add a namespace prefix + // - param1: namespace + + // token of local name + // - param2: prefix + XML_ATACTION_REMOVE_NAMESPACE_PREFIX,// remove a namespace prefix + // - param1: prefix + XML_ATACTION_REMOVE_ANY_NAMESPACE_PREFIX,// remove any namespace prefix + XML_ATACTION_RENAME_REMOVE_NAMESPACE_PREFIX,// remove a namespace prefix + // - param1: namespace + + // token of local name + // - param2: prefix + XML_ATACTION_EVENT_NAME, + XML_ATACTION_MACRO_NAME, + XML_ATACTION_MACRO_LOCATION, + XML_ATACTION_DLG_BORDER, + XML_ATACTION_URI_OOO, // an URI in OOo notation + // - param1: pacakage URI are supported + XML_ATACTION_URI_OASIS, // an URI in OASIS notation + // - param1: pacakage URI are supported + XML_ATACTION_RENAME_ATTRIBUTE, // rename up to 3 different possible values of an attrbiute + // - param1: token of old attribute value (lower 16 bit) + // + token of new attribute value (upper 16 bit) + // - param2: token of old attribute value + // + token of new attribute value + // - param3: token of old attribute value + // + token of new attribute value + // if param2 or param3 are unused they must contain + // XML_TOKEN_INVALID + XML_ATACTION_RNG2ISO_DATETIME, // converts . into , in datetimes + XML_ATACTION_RENAME_RNG2ISO_DATETIME,// converts . into , in datetimes and renames the attribute + // - param1: namespace + + // token of local name + XML_ATACTION_MOVE_FROM_ELEM_RNG2ISO_DATETIME, // turn elem into an attr and convert . to , in datetimes + // - param1: namespace + + // token of local name + XML_ATACTION_SVG_WIDTH_HEIGHT_OOO, // replace "inch" with "in" and subtracts 1/100th mm + XML_ATACTION_SVG_WIDTH_HEIGHT_OASIS, // replace "in" with "inch" and adds 1/100th mm + XML_ATACTION_DRAW_MIRROR_OOO, // renames draw:mirror to style:mirror and adapts values + // --> OD 2005-05-12 #i49139# + XML_ATACTION_STYLE_MIRROR_OOO, // adapts style:mirror values + // <-- + XML_ATACTION_DRAW_MIRROR_OASIS, // renames style:mirror to draw:mirror and adapts values + XML_ATACTION_GAMMA_OASIS, // converts percentage to double value + XML_ATACTION_GAMMA_OOO, // converts double value to percentage + XML_ATACTION_DECODE_ID, // converts strings with non numeric characters to only numeric character ids + XML_ATACTION_OPACITY_FIX, // converts transparency to opacity and back + XML_ATACTION_USER_DEFINED=0x40000000,// user defined actions start here + XML_ATACTION_END=XML_TACTION_END +}; + +#endif // _XMLOFF_ATTRTRANSFORMERACTION_HXX diff --git a/xmloff/source/transform/ChartOASISTContext.cxx b/xmloff/source/transform/ChartOASISTContext.cxx new file mode 100644 index 000000000000..26a07e1920d4 --- /dev/null +++ b/xmloff/source/transform/ChartOASISTContext.cxx @@ -0,0 +1,145 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" +#include "ChartOASISTContext.hxx" +#include "MutableAttrList.hxx" +#include "xmloff/xmlnmspe.hxx" +#include "ActionMapTypesOASIS.hxx" +#include "AttrTransformerAction.hxx" +#include "TransformerActions.hxx" +#ifndef _XMLOFF_TRANSFORMERBASE_HXX +#include "TransformerBase.hxx" +#endif + +using ::rtl::OUString; + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; +using namespace ::xmloff::token; + +// ----------------------------------------------------------------------------- + +TYPEINIT1( XMLChartOASISTransformerContext, XMLTransformerContext ); + +XMLChartOASISTransformerContext::XMLChartOASISTransformerContext( + XMLTransformerBase& rImp, + const OUString& rQName ) : + XMLTransformerContext( rImp, rQName ) +{ +} + +XMLChartOASISTransformerContext::~XMLChartOASISTransformerContext() +{ +} + +void XMLChartOASISTransformerContext::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + XMLTransformerActions *pActions = + GetTransformer().GetUserDefinedActions( OASIS_CHART_ACTIONS ); + OSL_ENSURE( pActions, "go no actions" ); + + OUString aAddInName; + Reference< XAttributeList > xAttrList( rAttrList ); + XMLMutableAttributeList *pMutableAttrList = 0; + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + for( sal_Int16 i=0; i < nAttrCount; i++ ) + { + const OUString& rAttrName = xAttrList->getNameByIndex( i ); + OUString aLocalName; + sal_uInt16 nPrefix = + GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName, + &aLocalName ); + XMLTransformerActions::key_type aKey( nPrefix, aLocalName ); + XMLTransformerActions::const_iterator aIter = + pActions->find( aKey ); + if( !(aIter == pActions->end() ) ) + { + if( !pMutableAttrList ) + { + pMutableAttrList = + new XMLMutableAttributeList( xAttrList ); + xAttrList = pMutableAttrList; + } + const OUString& rAttrValue = xAttrList->getValueByIndex( i ); + switch( (*aIter).second.m_nActionType ) + { + case XML_ATACTION_IN2INCH: + { + OUString aAttrValue( rAttrValue ); + if( XMLTransformerBase::ReplaceSingleInWithInch( + aAttrValue ) ) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_DECODE_STYLE_NAME_REF: + { + OUString aAttrValue( rAttrValue ); + if( GetTransformer().DecodeStyleName(aAttrValue) ) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_REMOVE_ANY_NAMESPACE_PREFIX: + OSL_ENSURE( IsXMLToken( aLocalName, XML_CLASS ), + "unexpected class token" ); + { + OUString aChartClass; + sal_uInt16 nValuePrefix = + GetTransformer().GetNamespaceMap().GetKeyByAttrName( + rAttrValue, + &aChartClass ); + if( XML_NAMESPACE_CHART == nValuePrefix ) + { + pMutableAttrList->SetValueByIndex( i, aChartClass ); + } + else if ( XML_NAMESPACE_OOO == nValuePrefix ) + { + pMutableAttrList->SetValueByIndex( i, + GetXMLToken(XML_ADD_IN ) ); + aAddInName = aChartClass; + } + } + break; + default: + OSL_ENSURE( !this, "unknown action" ); + break; + } + } + } + + if( aAddInName.getLength() > 0 ) + { + OUString aAttrQName( GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_CHART, + GetXMLToken( XML_ADD_IN_NAME ) ) ); + pMutableAttrList->AddAttribute( aAttrQName, aAddInName ); + } + + XMLTransformerContext::StartElement( xAttrList ); +} diff --git a/xmloff/source/transform/ChartOASISTContext.hxx b/xmloff/source/transform/ChartOASISTContext.hxx new file mode 100644 index 000000000000..5956b3d34dc2 --- /dev/null +++ b/xmloff/source/transform/ChartOASISTContext.hxx @@ -0,0 +1,46 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_CHARTOASISTCONTEXT_HXX +#define _XMLOFF_CHARTOASISTCONTEXT_HXX + +#include "TransformerContext.hxx" + +class XMLChartOASISTransformerContext : public XMLTransformerContext +{ +public: + TYPEINFO(); + + XMLChartOASISTransformerContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName ); + virtual ~XMLChartOASISTransformerContext(); + + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); +}; + +#endif // _XMLOFF_CHARTOASISTCONTEXT_HXX + diff --git a/xmloff/source/transform/ChartOOoTContext.cxx b/xmloff/source/transform/ChartOOoTContext.cxx new file mode 100644 index 000000000000..5e5420002d7d --- /dev/null +++ b/xmloff/source/transform/ChartOOoTContext.cxx @@ -0,0 +1,150 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" +#include "ChartOOoTContext.hxx" +#include "MutableAttrList.hxx" +#include "xmloff/xmlnmspe.hxx" +#ifndef _XMLOFF_ACTIONMAPTYPESOOo_HXX +#include "ActionMapTypesOOo.hxx" +#endif +#include "AttrTransformerAction.hxx" +#include "TransformerActions.hxx" +#ifndef _XMLOFF_TRANSFORMERBASE_HXX +#include "TransformerBase.hxx" +#endif + +using ::rtl::OUString; + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; +using namespace ::xmloff::token; + +// ----------------------------------------------------------------------------- + +TYPEINIT1( XMLChartOOoTransformerContext, XMLTransformerContext ); + +XMLChartOOoTransformerContext::XMLChartOOoTransformerContext( + XMLTransformerBase& rImp, + const OUString& rQName ) : + XMLTransformerContext( rImp, rQName ) +{ +} + +XMLChartOOoTransformerContext::~XMLChartOOoTransformerContext() +{ +} + +void XMLChartOOoTransformerContext::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + XMLTransformerActions *pActions = + GetTransformer().GetUserDefinedActions( OOO_CHART_ACTIONS ); + OSL_ENSURE( pActions, "go no actions" ); + + sal_Int16 nClassName = -1; + OUString aAddInName; + Reference< XAttributeList > xAttrList( rAttrList ); + XMLMutableAttributeList *pMutableAttrList = 0; + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + for( sal_Int16 i=0; i < nAttrCount; i++ ) + { + const OUString& rAttrName = xAttrList->getNameByIndex( i ); + OUString aLocalName; + sal_uInt16 nPrefix = + GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName, + &aLocalName ); + XMLTransformerActions::key_type aKey( nPrefix, aLocalName ); + XMLTransformerActions::const_iterator aIter = + pActions->find( aKey ); + if( !(aIter == pActions->end() ) ) + { + if( !pMutableAttrList ) + { + pMutableAttrList = + new XMLMutableAttributeList( xAttrList ); + xAttrList = pMutableAttrList; + } + const OUString& rAttrValue = xAttrList->getValueByIndex( i ); + switch( (*aIter).second.m_nActionType ) + { + case XML_ATACTION_INCH2IN: + { + OUString aAttrValue( rAttrValue ); + if( XMLTransformerBase::ReplaceSingleInchWithIn( + aAttrValue ) ) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_ENCODE_STYLE_NAME_REF: + { + OUString aAttrValue( rAttrValue ); + if( GetTransformer().EncodeStyleName(aAttrValue) ) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_ADD_NAMESPACE_PREFIX: + OSL_ENSURE( ::xmloff::token::IsXMLToken( aLocalName, XML_CLASS ), + "unexpected class token" ); + if( ::xmloff::token::IsXMLToken( rAttrValue, XML_ADD_IN ) ) + { + nClassName = i; + } + else + { + OUString aAttrValue( rAttrValue ); + sal_uInt16 nValPrefix = + static_cast<sal_uInt16>((*aIter).second.m_nParam1); + if( GetTransformer().AddNamespacePrefix( aAttrValue, + nValPrefix ) ) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_REMOVE: + OSL_ENSURE( ::xmloff::token::IsXMLToken( aLocalName, XML_ADD_IN_NAME ), + "unexpected class token" ); + aAddInName = rAttrValue; + pMutableAttrList->RemoveAttributeByIndex( i ); + --i; + --nAttrCount; + break; + default: + OSL_ENSURE( !this, "unknown action" ); + break; + } + } + } + + if( nClassName != -1 && aAddInName.getLength() > 0 ) + { + GetTransformer().AddNamespacePrefix( aAddInName, XML_NAMESPACE_OOO ); + pMutableAttrList->SetValueByIndex( nClassName, aAddInName ); + } + + XMLTransformerContext::StartElement( xAttrList ); +} diff --git a/xmloff/source/transform/ChartOOoTContext.hxx b/xmloff/source/transform/ChartOOoTContext.hxx new file mode 100644 index 000000000000..77a332d95606 --- /dev/null +++ b/xmloff/source/transform/ChartOOoTContext.hxx @@ -0,0 +1,46 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_CHARTOOOTCONTEXT_HXX +#define _XMLOFF_CHARTOOOTCONTEXT_HXX + +#include "TransformerContext.hxx" + +class XMLChartOOoTransformerContext : public XMLTransformerContext +{ +public: + TYPEINFO(); + + XMLChartOOoTransformerContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName ); + virtual ~XMLChartOOoTransformerContext(); + + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); +}; + +#endif // _XMLOFF_CHARTOOOTCONTEXT_HXX + diff --git a/xmloff/source/transform/ChartPlotAreaOASISTContext.cxx b/xmloff/source/transform/ChartPlotAreaOASISTContext.cxx new file mode 100644 index 000000000000..d1fea38db7f8 --- /dev/null +++ b/xmloff/source/transform/ChartPlotAreaOASISTContext.cxx @@ -0,0 +1,256 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" +#include "ChartPlotAreaOASISTContext.hxx" +#include "TransformerBase.hxx" +#include <xmloff/nmspmap.hxx> +#include "xmloff/xmlnmspe.hxx" +#include <xmloff/xmltoken.hxx> +#include "DeepTContext.hxx" +#include "ActionMapTypesOASIS.hxx" +#include "MutableAttrList.hxx" + +using namespace ::com::sun::star; +using namespace ::xmloff::token; + +using ::com::sun::star::uno::Reference; +using ::rtl::OUString; + +class XMLAxisOASISContext : public XMLPersElemContentTContext +{ +public: + TYPEINFO(); + + XMLAxisOASISContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName, + ::rtl::Reference< XMLPersAttrListTContext > & rOutCategoriesContext ); + ~XMLAxisOASISContext(); + + virtual XMLTransformerContext *CreateChildContext( + sal_uInt16 nPrefix, + const ::rtl::OUString& rLocalName, + const ::rtl::OUString& rQName, + const Reference< xml::sax::XAttributeList >& xAttrList ); + + virtual void StartElement( const Reference< xml::sax::XAttributeList >& rAttrList ); + virtual void EndElement(); + + bool IsCategoryAxis() const; + +private: + ::rtl::Reference< XMLPersAttrListTContext > & m_rCategoriesContext; + bool m_bHasCategories; +}; + +TYPEINIT1( XMLAxisOASISContext, XMLPersElemContentTContext ); + +XMLAxisOASISContext::XMLAxisOASISContext( + XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName, + ::rtl::Reference< XMLPersAttrListTContext > & rOutCategoriesContext ) : + XMLPersElemContentTContext( rTransformer, rQName ), + m_rCategoriesContext( rOutCategoriesContext ), + m_bHasCategories( false ) +{} + +XMLAxisOASISContext::~XMLAxisOASISContext() +{} + +XMLTransformerContext * XMLAxisOASISContext::CreateChildContext( + sal_uInt16 nPrefix, + const ::rtl::OUString& rLocalName, + const ::rtl::OUString& rQName, + const Reference< xml::sax::XAttributeList >& xAttrList ) +{ + XMLTransformerContext * pContext = 0; + + if( XML_NAMESPACE_CHART == nPrefix && + IsXMLToken( rLocalName, XML_CATEGORIES ) ) + { + // store categories element at parent + m_rCategoriesContext.set( new XMLPersAttrListTContext( GetTransformer(), rQName )); + m_bHasCategories = true; + pContext = m_rCategoriesContext.get(); + } + else + { + pContext = XMLPersElemContentTContext::CreateChildContext( + nPrefix, rLocalName, rQName, xAttrList ); + } + + return pContext; +} + +void XMLAxisOASISContext::StartElement( + const Reference< xml::sax::XAttributeList >& rAttrList ) +{ + OUString aLocation, aMacroName; + Reference< xml::sax::XAttributeList > xAttrList( rAttrList ); + XMLMutableAttributeList *pMutableAttrList = 0; + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + for( sal_Int16 i=0; i < nAttrCount; i++ ) + { + const OUString& rAttrName = xAttrList->getNameByIndex( i ); + OUString aLocalName; + sal_uInt16 nPrefix = + GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName ); + + if( nPrefix == XML_NAMESPACE_CHART && + IsXMLToken( aLocalName, XML_DIMENSION ) ) + { + if( !pMutableAttrList ) + { + pMutableAttrList = new XMLMutableAttributeList( xAttrList ); + xAttrList = pMutableAttrList; + } + + const OUString& rAttrValue = xAttrList->getValueByIndex( i ); + XMLTokenEnum eToken = XML_TOKEN_INVALID; + if( IsXMLToken( rAttrValue, XML_X )) + { + eToken = XML_DOMAIN; + // has to be XML_CATEGORY for axes with a categories + // sub-element. The attribute is changed later (when it is + // known that there is a categories sub-element) in this case. + } + else if( IsXMLToken( rAttrValue, XML_Y )) + { + eToken = XML_VALUE; + } + else if( IsXMLToken( rAttrValue, XML_Z )) + { + eToken = XML_SERIES; + } + else + { + OSL_ENSURE( false, "ChartAxis: Invalid attribute value" ); + } + + if( eToken != XML_TOKEN_INVALID ) + { + OUString aNewAttrQName( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_CHART, GetXMLToken( XML_CLASS ))); + pMutableAttrList->RenameAttributeByIndex( i, aNewAttrQName ); + + pMutableAttrList->SetValueByIndex( i, GetXMLToken( eToken )); + } + } + } + + XMLPersElemContentTContext::StartElement( xAttrList ); +} + +void XMLAxisOASISContext::EndElement() +{ + // if we have categories, change the "class" attribute + if( IsCategoryAxis() && + m_rCategoriesContext.is() ) + { + OSL_ENSURE( GetAttrList().is(), "Invalid attribute list" ); + XMLMutableAttributeList * pMutableAttrList = + new XMLMutableAttributeList( GetAttrList()); + OUString aAttrQName( GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_CHART, GetXMLToken( XML_CLASS ))); + sal_Int16 nIndex = pMutableAttrList->GetIndexByName( aAttrQName ); + if( nIndex != -1 ) + { + OSL_ENSURE( IsXMLToken( pMutableAttrList->getValueByIndex( nIndex ), + XML_DOMAIN ), "Axis Dimension: invalid former value" ); + pMutableAttrList->SetValueByIndex( nIndex, GetXMLToken( XML_CATEGORY )); + OSL_ENSURE( IsXMLToken( pMutableAttrList->getValueByIndex( nIndex ), + XML_CATEGORY ), "Axis Dimension: invalid new value" ); + } + + GetTransformer().GetDocHandler()->startElement( + GetExportQName(), + Reference< xml::sax::XAttributeList >( pMutableAttrList )); + ExportContent(); + GetTransformer().GetDocHandler()->endElement( GetExportQName()); + } + else + Export(); +} + +bool XMLAxisOASISContext::IsCategoryAxis() const +{ + return m_bHasCategories; +} + + +TYPEINIT1( XMLChartPlotAreaOASISTContext, XMLProcAttrTransformerContext ); + +XMLChartPlotAreaOASISTContext::XMLChartPlotAreaOASISTContext( + XMLTransformerBase & rTransformer, const ::rtl::OUString & rQName ) : + XMLProcAttrTransformerContext( rTransformer, rQName, OASIS_SHAPE_ACTIONS ) +{ +} + +XMLChartPlotAreaOASISTContext::~XMLChartPlotAreaOASISTContext() +{} + +XMLTransformerContext * XMLChartPlotAreaOASISTContext::CreateChildContext( + sal_uInt16 nPrefix, + const ::rtl::OUString& rLocalName, + const ::rtl::OUString& rQName, + const uno::Reference< xml::sax::XAttributeList >& xAttrList ) +{ + XMLTransformerContext *pContext = 0; + + if( XML_NAMESPACE_CHART == nPrefix && + IsXMLToken( rLocalName, XML_AXIS ) ) + { + pContext = new XMLAxisOASISContext( GetTransformer(), rQName, m_rCategoriesContext ); + } + else + { + // export (and forget) categories if found in an axis-element + // otherwise export regularly + ExportCategories(); + pContext = XMLProcAttrTransformerContext::CreateChildContext( + nPrefix, rLocalName, rQName, xAttrList ); + } + + return pContext; +} + +void XMLChartPlotAreaOASISTContext::EndElement() +{ + ExportCategories(); + XMLProcAttrTransformerContext::EndElement(); +} + +void XMLChartPlotAreaOASISTContext::ExportCategories() +{ + if( m_rCategoriesContext.is()) + { + m_rCategoriesContext->Export(); + m_rCategoriesContext.clear(); + } +} diff --git a/xmloff/source/transform/ChartPlotAreaOASISTContext.hxx b/xmloff/source/transform/ChartPlotAreaOASISTContext.hxx new file mode 100644 index 000000000000..b16eb0e2355e --- /dev/null +++ b/xmloff/source/transform/ChartPlotAreaOASISTContext.hxx @@ -0,0 +1,56 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef XMLOFF_XMLCHARTPLOTAREAOASISTCONTEXT_HXX +#define XMLOFF_XMLCHARTPLOTAREAOASISTCONTEXT_HXX + +#include "ProcAttrTContext.hxx" +#include "PersAttrListTContext.hxx" +#include <rtl/ref.hxx> + +class XMLChartPlotAreaOASISTContext : public XMLProcAttrTransformerContext +{ +public: + TYPEINFO(); + + explicit XMLChartPlotAreaOASISTContext( + XMLTransformerBase & rTransformer, const ::rtl::OUString & rQName ); + virtual ~XMLChartPlotAreaOASISTContext(); + + virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix, + const ::rtl::OUString& rLocalName, + const ::rtl::OUString& rQName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + virtual void EndElement(); + + void ExportCategories(); + +private: + ::rtl::Reference< XMLPersAttrListTContext > m_rCategoriesContext; +}; + +// XMLOFF_XMLCHARTPLOTAREAOASISTCONTEXT_HXX +#endif diff --git a/xmloff/source/transform/ChartPlotAreaOOoTContext.cxx b/xmloff/source/transform/ChartPlotAreaOOoTContext.cxx new file mode 100644 index 000000000000..19c4fa580e3a --- /dev/null +++ b/xmloff/source/transform/ChartPlotAreaOOoTContext.cxx @@ -0,0 +1,240 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" +#include "ChartPlotAreaOOoTContext.hxx" +#include "TransformerBase.hxx" +#include <xmloff/nmspmap.hxx> +#include "xmloff/xmlnmspe.hxx" +#include <xmloff/xmltoken.hxx> +#include "DeepTContext.hxx" +#include "ActionMapTypesOOo.hxx" +#include "MutableAttrList.hxx" + +using namespace ::com::sun::star; +using namespace ::xmloff::token; + +using ::com::sun::star::uno::Reference; +using ::rtl::OUString; + +class XMLAxisOOoContext : public XMLPersElemContentTContext +{ +public: + TYPEINFO(); + + XMLAxisOOoContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName ); + ~XMLAxisOOoContext(); + + virtual void StartElement( const Reference< xml::sax::XAttributeList >& rAttrList ); + + bool IsCategoryAxis() const; + +private: + bool m_bIsCategoryAxis; +}; + +TYPEINIT1( XMLAxisOOoContext, XMLPersElemContentTContext ); + +XMLAxisOOoContext::XMLAxisOOoContext( + XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName ) : + XMLPersElemContentTContext( rTransformer, rQName ), + m_bIsCategoryAxis( false ) +{} + +XMLAxisOOoContext::~XMLAxisOOoContext() +{} + +void XMLAxisOOoContext::StartElement( + const Reference< xml::sax::XAttributeList >& rAttrList ) +{ + OUString aLocation, aMacroName; + Reference< xml::sax::XAttributeList > xAttrList( rAttrList ); + XMLMutableAttributeList *pMutableAttrList = 0; + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + for( sal_Int16 i=0; i < nAttrCount; i++ ) + { + const OUString& rAttrName = xAttrList->getNameByIndex( i ); + OUString aLocalName; + sal_uInt16 nPrefix = + GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName ); + + if( nPrefix == XML_NAMESPACE_CHART && + IsXMLToken( aLocalName, XML_CLASS ) ) + { + if( !pMutableAttrList ) + { + pMutableAttrList = new XMLMutableAttributeList( xAttrList ); + xAttrList = pMutableAttrList; + } + + const OUString& rAttrValue = xAttrList->getValueByIndex( i ); + XMLTokenEnum eToken = XML_TOKEN_INVALID; + if( IsXMLToken( rAttrValue, XML_DOMAIN ) || + IsXMLToken( rAttrValue, XML_CATEGORY )) + { + eToken = XML_X; + if( IsXMLToken( rAttrValue, XML_CATEGORY ) ) + m_bIsCategoryAxis = true; + } + else if( IsXMLToken( rAttrValue, XML_VALUE )) + { + eToken = XML_Y; + } + else if( IsXMLToken( rAttrValue, XML_SERIES )) + { + eToken = XML_Z; + } + else + { + OSL_ENSURE( false, "ChartAxis: Invalid attribute value" ); + } + + if( eToken != XML_TOKEN_INVALID ) + { + OUString aNewAttrQName( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_CHART, GetXMLToken( XML_DIMENSION ))); + pMutableAttrList->RenameAttributeByIndex( i, aNewAttrQName ); + pMutableAttrList->SetValueByIndex( i, GetXMLToken( eToken )); + } + } + } + + XMLPersElemContentTContext::StartElement( xAttrList ); +} + +bool XMLAxisOOoContext::IsCategoryAxis() const +{ + return m_bIsCategoryAxis; +} + + +TYPEINIT1( XMLChartPlotAreaOOoTContext, XMLProcAttrTransformerContext ) + +XMLChartPlotAreaOOoTContext::XMLChartPlotAreaOOoTContext( + XMLTransformerBase & rTransformer, const ::rtl::OUString & rQName ) : + XMLProcAttrTransformerContext( rTransformer, rQName, OOO_SHAPE_ACTIONS ) +{ +} + +XMLChartPlotAreaOOoTContext::~XMLChartPlotAreaOOoTContext() +{} + +XMLTransformerContext * XMLChartPlotAreaOOoTContext::CreateChildContext( + sal_uInt16 nPrefix, + const ::rtl::OUString& rLocalName, + const ::rtl::OUString& rQName, + const uno::Reference< xml::sax::XAttributeList >& xAttrList ) +{ + XMLTransformerContext *pContext = 0; + + if( XML_NAMESPACE_CHART == nPrefix && + IsXMLToken( rLocalName, XML_AXIS ) ) + { + XMLAxisOOoContext * pAxisContext( new XMLAxisOOoContext( GetTransformer(), rQName )); + AddContent( pAxisContext ); + pContext = pAxisContext; + } + else if( XML_NAMESPACE_CHART == nPrefix && + IsXMLToken( rLocalName, XML_CATEGORIES ) ) + { + pContext = new XMLPersAttrListTContext( GetTransformer(), rQName ); + + // put categories at correct axis + XMLAxisContextVector::iterator aIter = m_aChildContexts.begin(); + bool bFound =false; + + // iterate over axis elements + for( ; ! bFound && aIter != m_aChildContexts.end(); ++aIter ) + { + XMLAxisOOoContext * pAxisContext = (*aIter).get(); + if( pAxisContext != 0 ) + { + // iterate over attributes to find category axis + Reference< xml::sax::XAttributeList > xNewAttrList( pAxisContext->GetAttrList()); + sal_Int16 nAttrCount = xNewAttrList.is() ? xNewAttrList->getLength() : 0; + + for( sal_Int16 i=0; i < nAttrCount; i++ ) + { + const OUString & rAttrName = xNewAttrList->getNameByIndex( i ); + OUString aLocalName; + sal_uInt16 nNewPrefix = + GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName, + &aLocalName ); + if( nNewPrefix == XML_NAMESPACE_CHART && + pAxisContext->IsCategoryAxis() && + IsXMLToken( aLocalName, XML_DIMENSION ) ) + { + // category axis found + pAxisContext->AddContent( pContext ); + bFound = true; + break; + } + } + } + } + OSL_ENSURE( bFound, "No suitable axis for categories found." ); + } + else + { + ExportContent(); + pContext = XMLProcAttrTransformerContext::CreateChildContext( + nPrefix, rLocalName, rQName, xAttrList ); + } + + return pContext; +} + +void XMLChartPlotAreaOOoTContext::EndElement() +{ + ExportContent(); + XMLProcAttrTransformerContext::EndElement(); +} + +void XMLChartPlotAreaOOoTContext::AddContent( XMLAxisOOoContext *pContext ) +{ + OSL_ENSURE( pContext && pContext->IsPersistent(), + "non-persistent context" ); + XMLAxisContextVector::value_type aVal( pContext ); + m_aChildContexts.push_back( aVal ); +} + + +void XMLChartPlotAreaOOoTContext::ExportContent() +{ + XMLAxisContextVector::iterator aIter = m_aChildContexts.begin(); + + for( ; aIter != m_aChildContexts.end(); ++aIter ) + { + (*aIter)->Export(); + } + + m_aChildContexts.clear(); +} diff --git a/xmloff/source/transform/ChartPlotAreaOOoTContext.hxx b/xmloff/source/transform/ChartPlotAreaOOoTContext.hxx new file mode 100644 index 000000000000..d6213bdad1c8 --- /dev/null +++ b/xmloff/source/transform/ChartPlotAreaOOoTContext.hxx @@ -0,0 +1,64 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef XMLOFF_XMLCHARTPLOTAREAOOOTCONTEXT_HXX +#define XMLOFF_XMLCHARTPLOTAREAOOOTCONTEXT_HXX + +#include "ProcAttrTContext.hxx" +#include "TContextVector.hxx" + +class XMLAxisOOoContext; + +class XMLAxisContextVector : + public ::std::vector< ::rtl::Reference< XMLAxisOOoContext > > +{ +}; + +class XMLChartPlotAreaOOoTContext : public XMLProcAttrTransformerContext +{ +public: + TYPEINFO(); + + explicit XMLChartPlotAreaOOoTContext( + XMLTransformerBase & rTransformer, const ::rtl::OUString & rQName ); + virtual ~XMLChartPlotAreaOOoTContext(); + + virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix, + const ::rtl::OUString& rLocalName, + const ::rtl::OUString& rQName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + virtual void EndElement(); + virtual void ExportContent(); + +protected: + void AddContent( XMLAxisOOoContext *pContent ); + +private: + XMLAxisContextVector m_aChildContexts; +}; + +// XMLOFF_XMLCHARTPLOTAREAOOOTCONTEXT_HXX +#endif diff --git a/xmloff/source/transform/ControlOASISTContext.cxx b/xmloff/source/transform/ControlOASISTContext.cxx new file mode 100644 index 000000000000..4b87cb4fe80b --- /dev/null +++ b/xmloff/source/transform/ControlOASISTContext.cxx @@ -0,0 +1,165 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" +#include "MutableAttrList.hxx" +#include "xmloff/xmlnmspe.hxx" +#include <xmloff/nmspmap.hxx> +#include "ActionMapTypesOASIS.hxx" +#include "AttrTransformerAction.hxx" +#include "TransformerActions.hxx" +#ifndef _XMLOFF_TRANSFORMERBASE_HXX +#include "TransformerBase.hxx" +#endif +#include "ControlOASISTContext.hxx" + +using ::rtl::OUString; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; +using namespace ::xmloff::token; + +TYPEINIT1( XMLControlOASISTransformerContext, XMLTransformerContext ); + +XMLControlOASISTransformerContext::XMLControlOASISTransformerContext( + XMLTransformerBase& rImp, + const OUString& rQName, + sal_Bool bCreateControl ) : + XMLTransformerContext( rImp, rQName ), + m_aElemQName( rImp.GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_FORM, + ::xmloff::token::GetXMLToken( XML_CONTROL ) ) ), + m_bCreateControl( bCreateControl ) +{ +} + +XMLControlOASISTransformerContext::~XMLControlOASISTransformerContext() +{ +} + +void XMLControlOASISTransformerContext::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + + XMLTransformerActions *pActions = + GetTransformer().GetUserDefinedActions( OASIS_FORM_CONTROL_ACTIONS ); + OSL_ENSURE( pActions, "go no actions" ); + + Reference< XAttributeList > xAttrList( rAttrList ); + XMLMutableAttributeList *pMutableAttrList = 0; +// GetTransformer().ProcessAttrList( xAttrList, OOO_SHAPE_ACTIONS, +// sal_True ); + + XMLMutableAttributeList *pControlMutableAttrList = + m_bCreateControl ? new XMLMutableAttributeList : 0; + Reference< XAttributeList > xControlAttrList( pControlMutableAttrList ); + + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + for( sal_Int16 i=0; i < nAttrCount; i++ ) + { + const OUString& rAttrName = xAttrList->getNameByIndex( i ); + OUString aLocalName; + sal_uInt16 nPrefix = + GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName, + &aLocalName ); + XMLTransformerActions::key_type aKey( nPrefix, aLocalName ); + XMLTransformerActions::const_iterator aIter = + pActions->find( aKey ); + if( !(aIter == pActions->end() ) ) + { + if( !pMutableAttrList ) + { + pMutableAttrList = + new XMLMutableAttributeList( rAttrList ); + xAttrList = pMutableAttrList; + } + const OUString& rAttrValue = xAttrList->getValueByIndex( i ); + switch( (*aIter).second.m_nActionType ) + { + case XML_ATACTION_MOVE_TO_ELEM: + if( m_bCreateControl ) + { + pControlMutableAttrList->AddAttribute( rAttrName, + rAttrValue ); + pMutableAttrList->RemoveAttributeByIndex( i ); + --i; + --nAttrCount; + } + break; + case XML_ATACTION_RENAME_REMOVE_NAMESPACE_PREFIX: + { + OUString aAttrValue( rAttrValue ); + sal_uInt16 nValPrefix = + static_cast<sal_uInt16>( (*aIter).second.m_nParam2 ); + GetTransformer().RemoveNamespacePrefix( aAttrValue, + nValPrefix ); + OUString aNewAttrQName( + GetTransformer().GetNamespaceMap().GetQNameByKey( + (*aIter).second.GetQNamePrefixFromParam1(), + ::xmloff::token::GetXMLToken( + (*aIter).second.GetQNameTokenFromParam1()) ) ); + if( m_bCreateControl ) + { + pControlMutableAttrList->AddAttribute( aNewAttrQName, + aAttrValue ); + pMutableAttrList->RemoveAttributeByIndex( i ); + --i; + --nAttrCount; + } + else + { + pMutableAttrList->RenameAttributeByIndex( i, + aNewAttrQName ); + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + } + case XML_ATACTION_URI_OASIS: + { + OUString aAttrValue( rAttrValue ); + if( GetTransformer().ConvertURIToOOo( aAttrValue, + static_cast< sal_Bool >((*aIter).second.m_nParam1)) ) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + default: + OSL_ENSURE( !this, "unknown action" ); + break; + } + } + } + + if( m_bCreateControl ) + GetTransformer().GetDocHandler()->startElement( m_aElemQName, + xControlAttrList ); + XMLTransformerContext::StartElement( xAttrList ); +} + +void XMLControlOASISTransformerContext::EndElement() +{ + XMLTransformerContext::EndElement(); + if( m_bCreateControl ) + GetTransformer().GetDocHandler()->endElement( m_aElemQName ); +} diff --git a/xmloff/source/transform/ControlOASISTContext.hxx b/xmloff/source/transform/ControlOASISTContext.hxx new file mode 100644 index 000000000000..b123134cf424 --- /dev/null +++ b/xmloff/source/transform/ControlOASISTContext.hxx @@ -0,0 +1,53 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_CONTROLASISTCONTEXT_HXX +#define _XMLOFF_CONTROLASISTCONTEXT_HXX + +#include "TransformerContext.hxx" + +class XMLControlOASISTransformerContext : public XMLTransformerContext +{ + ::rtl::OUString m_aElemQName; + sal_Bool m_bCreateControl; + +public: + TYPEINFO(); + + XMLControlOASISTransformerContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName, + sal_Bool bCreateControl ); + + virtual ~XMLControlOASISTransformerContext(); + + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + virtual void EndElement(); +}; + +#endif // _XMLOFF_CONTROLASISTCONTEXT_HXX + diff --git a/xmloff/source/transform/ControlOOoTContext.cxx b/xmloff/source/transform/ControlOOoTContext.cxx new file mode 100644 index 000000000000..2317cf52cf50 --- /dev/null +++ b/xmloff/source/transform/ControlOOoTContext.cxx @@ -0,0 +1,107 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" +#include "ControlOOoTContext.hxx" +#include "IgnoreTContext.hxx" +#include "MutableAttrList.hxx" +#include "xmloff/xmlnmspe.hxx" +#include "ActionMapTypesOOo.hxx" +#include "ElemTransformerAction.hxx" +#include "TransformerActions.hxx" +#ifndef _XMLOFF_TRANSFORMERBASE_HXX +#include "TransformerBase.hxx" +#endif + +using ::rtl::OUString; + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; +using namespace ::xmloff::token; + +TYPEINIT1( XMLControlOOoTransformerContext, XMLTransformerContext ); + +XMLControlOOoTransformerContext::XMLControlOOoTransformerContext( + XMLTransformerBase& rImp, + const OUString& rQName ) : + XMLTransformerContext( rImp, rQName ) +{ +} + +XMLControlOOoTransformerContext::~XMLControlOOoTransformerContext() +{ +} + +void XMLControlOOoTransformerContext::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + m_xAttrList = new XMLMutableAttributeList( rAttrList, sal_True ); +} + +XMLTransformerContext *XMLControlOOoTransformerContext::CreateChildContext( + sal_uInt16 /*nPrefix*/, + const OUString& /*rLocalName*/, + const OUString& rQName, + const Reference< XAttributeList >& rAttrList ) +{ + XMLTransformerContext *pContext = 0; + + if( !m_aElemQName.getLength() ) + { + pContext = new XMLIgnoreTransformerContext( GetTransformer(), + rQName, + sal_False, sal_False ); + m_aElemQName = rQName; + static_cast< XMLMutableAttributeList * >( m_xAttrList.get() ) + ->AppendAttributeList( rAttrList ); + GetTransformer().ProcessAttrList( m_xAttrList, + OOO_FORM_CONTROL_ACTIONS, + sal_False ); + GetTransformer().GetDocHandler()->startElement( m_aElemQName, + m_xAttrList ); + } + else + { + pContext = new XMLIgnoreTransformerContext( GetTransformer(), + rQName, + sal_True, sal_True ); + } + return pContext; +} + +void XMLControlOOoTransformerContext::EndElement() +{ + GetTransformer().GetDocHandler()->endElement( m_aElemQName ); +} + +void XMLControlOOoTransformerContext::Characters( const OUString& rChars ) +{ + // ignore + if( m_aElemQName.getLength() ) + XMLTransformerContext::Characters( rChars ); +} diff --git a/xmloff/source/transform/ControlOOoTContext.hxx b/xmloff/source/transform/ControlOOoTContext.hxx new file mode 100644 index 000000000000..93e997a59cf8 --- /dev/null +++ b/xmloff/source/transform/ControlOOoTContext.hxx @@ -0,0 +1,61 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_CONTROLOOOTCONTEXT_HXX +#define _XMLOFF_CONTROLOOOTCONTEXT_HXX + +#include "TransformerContext.hxx" + +class XMLControlOOoTransformerContext : public XMLTransformerContext +{ + ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > m_xAttrList; + + ::rtl::OUString m_aElemQName; + +public: + TYPEINFO(); + + XMLControlOOoTransformerContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName ); + + virtual ~XMLControlOOoTransformerContext(); + + virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix, + const ::rtl::OUString& rLocalName, + const ::rtl::OUString& rQName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + virtual void EndElement(); + + virtual void Characters( const ::rtl::OUString& rChars ); +}; + +#endif // _XMLOFF_CONTROLOOOTCONTEXT_HXX + diff --git a/xmloff/source/transform/CreateElemTContext.cxx b/xmloff/source/transform/CreateElemTContext.cxx new file mode 100644 index 000000000000..732a14f6f7c9 --- /dev/null +++ b/xmloff/source/transform/CreateElemTContext.cxx @@ -0,0 +1,131 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" +#include "CreateElemTContext.hxx" +#include "MutableAttrList.hxx" +#ifndef _XMLOFF_TRANSFORMERBASE_HXX +#include "TransformerBase.hxx" +#endif +#include "TransformerActions.hxx" +#include "TContextVector.hxx" +#include "FlatTContext.hxx" +#include "AttrTransformerAction.hxx" +#include <xmloff/nmspmap.hxx> + +using ::rtl::OUString; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; +using namespace ::xmloff::token; + +TYPEINIT1( XMLCreateElemTransformerContext, XMLTransformerContext ); + +XMLCreateElemTransformerContext::XMLCreateElemTransformerContext( + XMLTransformerBase& rImp, + const OUString& rQName, + sal_uInt16 nActionMap ) : + XMLTransformerContext( rImp, rQName ), + m_nActionMap( nActionMap ) +{ +} + +XMLCreateElemTransformerContext::~XMLCreateElemTransformerContext() +{ +} + +void XMLCreateElemTransformerContext::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + Reference< XAttributeList > xAttrList( rAttrList ); + + XMLTransformerContextVector aChildContexts; + + XMLMutableAttributeList *pMutableAttrList = 0; + XMLTransformerActions *pActions = + GetTransformer().GetUserDefinedActions( m_nActionMap ); + OSL_ENSURE( pActions, "go no actions" ); + if( pActions ) + { + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + for( sal_Int16 i=0; i < nAttrCount; ++i ) + { + const OUString& rAttrName = xAttrList->getNameByIndex( i ); + const OUString& rAttrValue = xAttrList->getValueByIndex( i ); + OUString aLocalName; + sal_uInt16 nPrefix = + GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName, + &aLocalName ); + + XMLTransformerActions::key_type aKey( nPrefix, aLocalName ); + XMLTransformerActions::const_iterator aIter = + pActions->find( aKey ); + if( !(aIter == pActions->end() ) ) + { + if( !pMutableAttrList ) + { + pMutableAttrList = new XMLMutableAttributeList( xAttrList ); + xAttrList = pMutableAttrList; + } + sal_uInt32 nAction = (*aIter).second.m_nActionType; + switch( nAction ) + { + case XML_ATACTION_MOVE_TO_ELEM: + { + OUString aElemQName( + GetTransformer().GetNamespaceMap().GetQNameByKey( + (*aIter).second.GetQNamePrefixFromParam1(), + ::xmloff::token::GetXMLToken( + (*aIter).second.GetQNameTokenFromParam1()) ) ); + XMLTransformerContext *pContext = + new XMLPersTextContentTContext( GetTransformer(), + aElemQName ); + pContext->Characters( rAttrValue ); + XMLTransformerContextVector::value_type aVal( + pContext ); + aChildContexts.push_back( aVal ); + pMutableAttrList->RemoveAttributeByIndex( i ); + --i; + --nAttrCount; + } + break; + default: + OSL_ENSURE( !this, "unknown action" ); + break; + } + } + } + } + XMLTransformerContext::StartElement( xAttrList ); + + XMLTransformerContextVector::iterator aIter = aChildContexts.begin(); + + for( ; aIter != aChildContexts.end(); ++aIter ) + { + (*aIter)->Export(); + } +} diff --git a/xmloff/source/transform/CreateElemTContext.hxx b/xmloff/source/transform/CreateElemTContext.hxx new file mode 100644 index 000000000000..17ff0785ab26 --- /dev/null +++ b/xmloff/source/transform/CreateElemTContext.hxx @@ -0,0 +1,57 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_CREATEELEMTCONTEXT_HXX +#define _XMLOFF_CREATEELEMTCONTEXT_HXX + +#include <xmloff/xmltoken.hxx> +#include "TransformerContext.hxx" + +class XMLMutableAttributeList; +class XMLTransformerActions; +class XMLCreateElemTransformerContext : public XMLTransformerContext +{ + sal_uInt16 m_nActionMap; + +protected: + + sal_uInt16 GetActionMap() const { return m_nActionMap; } + +public: + TYPEINFO(); + + XMLCreateElemTransformerContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName, + sal_uInt16 nActionMap ); + + virtual ~XMLCreateElemTransformerContext(); + + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); +}; + +#endif // _XMLOFF_CREATEELEMCONTEXT_HXX + diff --git a/xmloff/source/transform/DeepTContext.cxx b/xmloff/source/transform/DeepTContext.cxx new file mode 100644 index 000000000000..b37776cb6790 --- /dev/null +++ b/xmloff/source/transform/DeepTContext.cxx @@ -0,0 +1,181 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" +#include "DeepTContext.hxx" +#ifndef _XMLOFF_FLATTTCONTEXT_HXX +#include "FlatTContext.hxx" +#endif +#include "EventOOoTContext.hxx" +#include "TransformerActions.hxx" +#include "ElemTransformerAction.hxx" +#include "PersMixedContentTContext.hxx" +#ifndef _XMLOFF_TRANSFORMERBASE_HXX +#include "TransformerBase.hxx" +#endif + +using ::rtl::OUString; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; + +TYPEINIT1( XMLPersElemContentTContext, XMLPersAttrListTContext ); + +void XMLPersElemContentTContext::AddContent( XMLTransformerContext *pContext ) +{ + OSL_ENSURE( pContext && pContext->IsPersistent(), + "non-persistent context" ); + XMLTransformerContextVector::value_type aVal( pContext ); + m_aChildContexts.push_back( aVal ); +} + +XMLPersElemContentTContext::XMLPersElemContentTContext( + XMLTransformerBase& rImp, + const OUString& rQName ) : + XMLPersAttrListTContext( rImp, rQName ) +{ +} + +XMLPersElemContentTContext::XMLPersElemContentTContext( + XMLTransformerBase& rImp, + const OUString& rQName, + sal_uInt16 nActionMap ) : + XMLPersAttrListTContext( rImp, rQName, nActionMap ) +{ +} + +XMLPersElemContentTContext::XMLPersElemContentTContext( + XMLTransformerBase& rImp, + const OUString& rQName, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken ) : + XMLPersAttrListTContext( rImp, rQName, nPrefix, eToken ) +{ +} + +XMLPersElemContentTContext::XMLPersElemContentTContext( + XMLTransformerBase& rImp, + const OUString& rQName, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken, + sal_uInt16 nActionMap ) : + XMLPersAttrListTContext( rImp, rQName, nPrefix, eToken, nActionMap ) +{ +} + +XMLPersElemContentTContext::~XMLPersElemContentTContext() +{ +} + +XMLTransformerContext *XMLPersElemContentTContext::CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const Reference< XAttributeList >& ) +{ + XMLTransformerContext *pContext = 0; + + XMLTransformerActions::key_type aKey( nPrefix, rLocalName ); + XMLTransformerActions::const_iterator aIter = + GetTransformer().GetElemActions().find( aKey ); + + if( !(aIter == GetTransformer().GetElemActions().end()) ) + { + switch( (*aIter).second.m_nActionType ) + { + case XML_ETACTION_COPY: + pContext = new XMLPersMixedContentTContext( GetTransformer(), + rQName ); + break; + case XML_ETACTION_COPY_TEXT: + pContext = new XMLPersMixedContentTContext( GetTransformer(), + rQName ); + break; + case XML_ETACTION_RENAME_ELEM: + pContext = new XMLPersMixedContentTContext( GetTransformer(), rQName, + (*aIter).second.GetQNamePrefixFromParam1(), + (*aIter).second.GetQNameTokenFromParam1() ); + break; + case XML_ETACTION_RENAME_ELEM_PROC_ATTRS: + pContext = new XMLPersMixedContentTContext( GetTransformer(), rQName, + (*aIter).second.GetQNamePrefixFromParam1(), + (*aIter).second.GetQNameTokenFromParam1(), + static_cast< sal_uInt16 >( (*aIter).second.m_nParam2 ) ); + break; + case XML_ETACTION_RENAME_ELEM_ADD_PROC_ATTR: + { + XMLPersMixedContentTContext *pMC = + new XMLPersMixedContentTContext( GetTransformer(), rQName, + (*aIter).second.GetQNamePrefixFromParam1(), + (*aIter).second.GetQNameTokenFromParam1(), + static_cast< sal_uInt16 >( + (*aIter).second.m_nParam3 >> 16 ) ); + pMC->AddAttribute( + (*aIter).second.GetQNamePrefixFromParam2(), + (*aIter).second.GetQNameTokenFromParam2(), + static_cast< ::xmloff::token::XMLTokenEnum >( + (*aIter).second.m_nParam3 & 0xffff ) ); + pContext = pMC; + } + break; + case XML_ETACTION_PROC_ATTRS: + pContext = new XMLPersMixedContentTContext( GetTransformer(), rQName, + static_cast< sal_uInt16 >( (*aIter).second.m_nParam1 ) ); + break; + default: + pContext = GetTransformer().CreateUserDefinedContext( + (*aIter).second, rQName, sal_True ); + OSL_ENSURE( pContext && pContext->IsPersistent(), + "unknown or not persistent action" ); + if( pContext && !pContext->IsPersistent() ) + { + delete pContext; + pContext = 0; + } + break; + } + } + + // default is copying + if( !pContext ) + pContext = new XMLPersMixedContentTContext( GetTransformer(), rQName ); + XMLTransformerContextVector::value_type aVal( pContext ); + m_aChildContexts.push_back( aVal ); + + return pContext; +} + +void XMLPersElemContentTContext::ExportContent() +{ + XMLTransformerContextVector::iterator aIter = m_aChildContexts.begin(); + + for( ; aIter != m_aChildContexts.end(); ++aIter ) + { + (*aIter)->Export(); + } +} + diff --git a/xmloff/source/transform/DeepTContext.hxx b/xmloff/source/transform/DeepTContext.hxx new file mode 100644 index 000000000000..5bc19d01cf7a --- /dev/null +++ b/xmloff/source/transform/DeepTContext.hxx @@ -0,0 +1,84 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_DEEPTCONTEXT_HXX +#define _XMLOFF_DEEPTCONTEXT_HXX + +#include <rtl/ref.hxx> + +#include <vector> +#include "PersAttrListTContext.hxx" +#include "TContextVector.hxx" + +class XMLPersElemContentTContext : public XMLPersAttrListTContext +{ + XMLTransformerContextVector m_aChildContexts; + +public: + TYPEINFO(); + + // element content persistence only + XMLPersElemContentTContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName ); + + // element content persistence + attribute processing + XMLPersElemContentTContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName, + sal_uInt16 nActionMap ); + + // element content persistence + renaming + XMLPersElemContentTContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken ); + + // element content persistence + renaming + attribute processing + XMLPersElemContentTContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken, + sal_uInt16 nActionMap ); + + virtual ~XMLPersElemContentTContext(); + + virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix, + const ::rtl::OUString& rLocalName, + const ::rtl::OUString& rQName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + void AddContent( XMLTransformerContext *pContent ); + + sal_Bool HasElementContent() const + { + return static_cast<sal_Bool>( !m_aChildContexts.empty() ); + } + + virtual void ExportContent(); +}; + +#endif // _XMLOFF_DEEPTCONTEXT_HXX + diff --git a/xmloff/source/transform/DlgOASISTContext.cxx b/xmloff/source/transform/DlgOASISTContext.cxx new file mode 100644 index 000000000000..bfe62162847a --- /dev/null +++ b/xmloff/source/transform/DlgOASISTContext.cxx @@ -0,0 +1,116 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" +#include "DlgOASISTContext.hxx" +#include "MutableAttrList.hxx" +#include "xmloff/xmlnmspe.hxx" +#include "ActionMapTypesOASIS.hxx" +#include "AttrTransformerAction.hxx" +#include "TransformerActions.hxx" +#ifndef _XMLOFF_TRANSFORMERBASE_HXX +#include "TransformerBase.hxx" +#endif + +using ::rtl::OUString; + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; +using namespace ::xmloff::token; + +// ----------------------------------------------------------------------------- + +TYPEINIT1( XMLDlgOASISTransformerContext, XMLTransformerContext); + +XMLDlgOASISTransformerContext::XMLDlgOASISTransformerContext( + XMLTransformerBase& rImp, + const OUString& rQName ) : + XMLTransformerContext( rImp, rQName ) +{ +} + +XMLDlgOASISTransformerContext::~XMLDlgOASISTransformerContext() +{ +} + +void XMLDlgOASISTransformerContext::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + XMLTransformerActions *pActions = + GetTransformer().GetUserDefinedActions( OASIS_DLG_ACTIONS ); + OSL_ENSURE( pActions, "go no actions" ); + + Reference< XAttributeList > xAttrList( rAttrList ); + XMLMutableAttributeList *pMutableAttrList = 0; + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + + for( sal_Int16 i=0; i < nAttrCount; i++ ) + { + const OUString& rAttrName = xAttrList->getNameByIndex( i ); + OUString aLocalName; + sal_uInt16 nPrefix = + GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName, + &aLocalName ); + + XMLTransformerActions::key_type aKey( nPrefix, aLocalName ); + XMLTransformerActions::const_iterator aIter = + pActions->find( aKey ); + + if( !(aIter == pActions->end() ) ) + { + if( !pMutableAttrList ) + { + pMutableAttrList = + new XMLMutableAttributeList( xAttrList ); + xAttrList = pMutableAttrList; + } + const OUString& rAttrValue = xAttrList->getValueByIndex( i ); + switch( (*aIter).second.m_nActionType ) + { + case XML_ATACTION_DLG_BORDER: + { + OUString aAttrValue( rAttrValue ); + + if ( !aAttrValue.equals( GetXMLToken( XML_NONE ) ) && + !aAttrValue.equals( GetXMLToken( XML_SIMPLE ) ) && + !aAttrValue.equals( GetXMLToken( XML_3D ) ) ) + { + pMutableAttrList->SetValueByIndex( + i, GetXMLToken( XML_NONE ) ); + } + } + break; + default: + OSL_ENSURE( !this, "unknown action" ); + break; + } + } + } + + XMLTransformerContext::StartElement( xAttrList ); +} diff --git a/xmloff/source/transform/DlgOASISTContext.hxx b/xmloff/source/transform/DlgOASISTContext.hxx new file mode 100644 index 000000000000..72c73d2977ae --- /dev/null +++ b/xmloff/source/transform/DlgOASISTContext.hxx @@ -0,0 +1,46 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_DLGOASISTCONTEXT_HXX +#define _XMLOFF_DLGOASISTCONTEXT_HXX + +#include "TransformerContext.hxx" + +class XMLDlgOASISTransformerContext : public XMLTransformerContext +{ +public: + TYPEINFO(); + + XMLDlgOASISTransformerContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName ); + virtual ~XMLDlgOASISTransformerContext(); + + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); +}; + +#endif // _XMLOFF_DLGOASISTCONTEXT_HXX + diff --git a/xmloff/source/transform/DocumentTContext.cxx b/xmloff/source/transform/DocumentTContext.cxx new file mode 100644 index 000000000000..5e4d749826ac --- /dev/null +++ b/xmloff/source/transform/DocumentTContext.cxx @@ -0,0 +1,149 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" +#include <com/sun/star/xml/sax/SAXParseException.hpp> +#include <com/sun/star/xml/sax/SAXException.hpp> +#include <com/sun/star/xml/sax/XDocumentHandler.hpp> +#include <com/sun/star/xml/sax/XAttributeList.hpp> +#include <com/sun/star/beans/XPropertySetInfo.hpp> +#include <xmloff/nmspmap.hxx> +#include <xmloff/xmltoken.hxx> +#include "xmloff/xmlnmspe.hxx" + +#ifndef _XMLOFF_TRANSFOERMERBASE_HXX +#include "TransformerBase.hxx" +#endif +#include "MutableAttrList.hxx" + +#ifndef _XMLOFF_METATCONTEXT_HXX +#include "DocumentTContext.hxx" +#endif + +using ::rtl::OUString; + +using namespace ::xmloff::token; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; +using namespace ::com::sun::star::beans; + +TYPEINIT1( XMLDocumentTransformerContext, XMLTransformerContext ); + +XMLDocumentTransformerContext::XMLDocumentTransformerContext( XMLTransformerBase& rImp, + const OUString& rQName ) : + XMLTransformerContext( rImp, rQName ) +{ +} + +XMLDocumentTransformerContext::~XMLDocumentTransformerContext() +{ +} + +void XMLDocumentTransformerContext::StartElement( const Reference< XAttributeList >& rAttrList ) +{ + Reference< XAttributeList > xAttrList( rAttrList ); + + sal_Bool bMimeFound = sal_False; + OUString aClass; + OUString aClassQName( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_OFFICE, GetXMLToken(XML_CLASS ) ) ); + + XMLMutableAttributeList *pMutableAttrList = 0; + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + for( sal_Int16 i=0; i < nAttrCount; i++ ) + { + const OUString& rAttrName = xAttrList->getNameByIndex( i ); + OUString aLocalName; + sal_uInt16 nPrefix = + GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName, + &aLocalName ); + if( XML_NAMESPACE_OFFICE == nPrefix && + IsXMLToken( aLocalName, XML_MIMETYPE ) ) + { + const OUString& rValue = xAttrList->getValueByIndex( i ); + static const char * aTmp[] = + { + "application/vnd.oasis.openoffice.", + "application/x-vnd.oasis.openoffice.", + "application/vnd.oasis.opendocument.", + "application/x-vnd.oasis.document.", + NULL + }; + for (int k=0; aTmp[k]; k++) + { + ::rtl::OUString sTmpString = ::rtl::OUString::createFromAscii(aTmp[k]); + if( rValue.matchAsciiL( aTmp[k], sTmpString.getLength() ) ) + { + aClass = rValue.copy( sTmpString.getLength() ); + break; + } + } + + if( !pMutableAttrList ) + { + pMutableAttrList = new XMLMutableAttributeList( xAttrList ); + xAttrList = pMutableAttrList; + } + pMutableAttrList->SetValueByIndex( i, aClass ); + pMutableAttrList->RenameAttributeByIndex(i, aClassQName ); + bMimeFound = sal_True; + break; + } + } + + if( !bMimeFound ) + { + const Reference< XPropertySet > rPropSet = + GetTransformer().GetPropertySet(); + + if( rPropSet.is() ) + { + Reference< XPropertySetInfo > xPropSetInfo( + rPropSet->getPropertySetInfo() ); + OUString aPropName(RTL_CONSTASCII_USTRINGPARAM("Class")); + if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName( aPropName ) ) + { + Any aAny = rPropSet->getPropertyValue( aPropName ); + aAny >>= aClass; + } + } + + if( aClass.getLength() ) + { + if( !pMutableAttrList ) + { + pMutableAttrList = new XMLMutableAttributeList( xAttrList ); + xAttrList = pMutableAttrList; + } + + pMutableAttrList->AddAttribute( aClassQName, aClass ); + } + } + XMLTransformerContext::StartElement( xAttrList ); +} diff --git a/xmloff/source/transform/DocumentTContext.hxx b/xmloff/source/transform/DocumentTContext.hxx new file mode 100644 index 000000000000..b1e8800bd279 --- /dev/null +++ b/xmloff/source/transform/DocumentTContext.hxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_DOCUMENTTCONTEXT_HXX +#define _XMLOFF_DOCUMENTTCONTEXT_HXX + +#include "TransformerContext.hxx" + +class XMLDocumentTransformerContext : public XMLTransformerContext +{ +public: + TYPEINFO(); + + // A contexts constructor does anything that is required if an element + // starts. Namespace processing has been done already. + // Note that virtual methods cannot be used inside constructors. Use + // StartElement instead if this is required. + XMLDocumentTransformerContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName ); + + // A contexts destructor does anything that is required if an element + // ends. By default, nothing is done. + // Note that virtual methods cannot be used inside destructors. Use + // EndElement instead if this is required. + virtual ~XMLDocumentTransformerContext(); + + // StartElement is called after a context has been constructed and + // before a elements context is parsed. It may be used for actions that + // require virtual methods. The default is to do nothing. + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); +}; + +#endif // _XMLOFF_DOCUMENTTCONTEXT_HXX + diff --git a/xmloff/source/transform/ElemTransformerAction.hxx b/xmloff/source/transform/ElemTransformerAction.hxx new file mode 100644 index 000000000000..647967d772d3 --- /dev/null +++ b/xmloff/source/transform/ElemTransformerAction.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_ELEMTRANSFORMERACTION_HXX +#define _XMLOFF_ELEMTRANSFORMERACTION_HXX + +#include "TransformerAction.hxx" + +enum XMLElemTransformerAction +{ + XML_ETACTION_EOT=XML_TACTION_EOT, // uses for initialization only + XML_ETACTION_COPY, // copy all (default) + // for persistent elements: keep + // elem content + XML_ETACTION_COPY_TEXT, // copy all + // for persistent elements: keep + // text content + XML_ETACTION_COPY_CONTENT, // ignore elem, process content + XML_ETACTION_RENAME_ELEM, // rename element: + // - param1: namespace + + // token of local name + XML_ETACTION_RENAME_ELEM_PROC_ATTRS,// rename element and proc attr: + // - param1: elem namespace + + // token of local name + // - param2: attr acation map + XML_ETACTION_RENAME_ELEM_ADD_ATTR, // rename element and add attr: + // - param1: elem namespace + + // token of local name + // - param2: attr namespace + + // token of local name + // - param3: attr value + XML_ETACTION_RENAME_ELEM_ADD_PROC_ATTR, // rename element and add attr: + // - param1: elem namespace + + // token of local name + // - param2: attr namespace + + // token of local name + // - param3: attr value (low) + // attr action map (high) + XML_ETACTION_RENAME_ELEM_COND, // rename element if child of another: + // - param1: namespace + + // token of new local name + // - param2: namespace + + // token of parent element + XML_ETACTION_RENAME_ELEM_PROC_ATTRS_COND,// rename element and proc attr + // if child of another: + // - param1: elem namespace + + // token of new local name + // - param2: attr acation map + // - param3: namespace + + // token of parent element + XML_ETACTION_PROC_ATTRS, // proc attr: + // - param1: attr acation map + XML_ETACTION_MOVE_ATTRS_TO_ELEMS, // turn some attributes into elems + // - param1: action map specifying + // the attrs that shall be moved + XML_ETACTION_MOVE_ELEMS_TO_ATTRS, // turn some elems into attrs + // - param1: action map specifying + // the elems that shall be moved + XML_ETACTION_PROC_ATTRS_COND, // proc attr if child of another: + // - param1: namespace + + // token of parent element + // - param2: attr acation map + XML_ETACTION_EXTRACT_CHARACTERS, // takes the characters of the current + // element and all child elements + // and put them together into the + // current element + // the child elements are removed + XML_ETACTION_USER_DEFINED=0x40000000,// user defined actions start here + XML_ETACTION_END=XML_TACTION_END +}; + +#endif // _XMLOFF_ELEMTRANSFORMERACTION_HXX diff --git a/xmloff/source/transform/EventMap.cxx b/xmloff/source/transform/EventMap.cxx new file mode 100644 index 000000000000..6c18e8e559ba --- /dev/null +++ b/xmloff/source/transform/EventMap.cxx @@ -0,0 +1,111 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" +#include "EventMap.hxx" +#include "xmloff/xmlnmspe.hxx" + + +XMLTransformerEventMapEntry aTransformerEventMap[] = +{ + { XML_NAMESPACE_DOM, "select", "on-select" }, + { XML_NAMESPACE_OFFICE, "insert-start", "on-insert-start" }, + { XML_NAMESPACE_OFFICE, "insert-done", "on-insert-done" }, + { XML_NAMESPACE_OFFICE, "mail-merge", "on-mail-merge" }, + { XML_NAMESPACE_OFFICE, "alpha-char-input", "on-alpha-char-input" }, + { XML_NAMESPACE_OFFICE, "non-alpha-char-input", "on-non-alpha-char-input" }, + { XML_NAMESPACE_DOM, "resize", "on-resize" }, + { XML_NAMESPACE_OFFICE, "move", "on-move" }, + { XML_NAMESPACE_OFFICE, "page-count-change", "on-page-count-change" }, + { XML_NAMESPACE_DOM, "mouseover", "on-mouse-over" }, + { XML_NAMESPACE_DOM, "click", "on-click" }, + { XML_NAMESPACE_DOM, "mouseout", "on-mouse-out" }, + { XML_NAMESPACE_OFFICE, "load-error", "on-load-error" }, + { XML_NAMESPACE_OFFICE, "load-cancel", "on-load-cancel" }, + { XML_NAMESPACE_OFFICE, "load-done", "on-load-done" }, + { XML_NAMESPACE_DOM, "load", "on-load" }, + { XML_NAMESPACE_DOM, "unload", "on-unload" }, + { XML_NAMESPACE_OFFICE, "start-app", "on-start-app" }, + { XML_NAMESPACE_OFFICE, "close-app", "on-close-app" }, + { XML_NAMESPACE_OFFICE, "new", "on-new" }, + { XML_NAMESPACE_OFFICE, "save", "on-save" }, + { XML_NAMESPACE_OFFICE, "save-as", "on-save-as" }, + { XML_NAMESPACE_DOM, "DOMFocusIn", "on-focus" }, + { XML_NAMESPACE_DOM, "DOMFocusOut", "on-unfocus" }, + { XML_NAMESPACE_OFFICE, "print", "on-print" }, + { XML_NAMESPACE_DOM, "error", "on-error" }, + { XML_NAMESPACE_OFFICE, "load-finished", "on-load-finished" }, + { XML_NAMESPACE_OFFICE, "save-finished", "on-save-finished" }, + { XML_NAMESPACE_OFFICE, "modify-changed", "on-modify-changed" }, + { XML_NAMESPACE_OFFICE, "prepare-unload", "on-prepare-unload" }, + { XML_NAMESPACE_OFFICE, "new-mail", "on-new-mail" }, + { XML_NAMESPACE_OFFICE, "toggle-fullscreen", "on-toggle-fullscreen" }, + { XML_NAMESPACE_OFFICE, "save-done", "on-save-done" }, + { XML_NAMESPACE_OFFICE, "save-as-done", "on-save-as-done" }, + { XML_NAMESPACE_OFFICE, "create", "on-create" }, + { XML_NAMESPACE_OFFICE, "save-as-failed", "on-save-as-failed" }, + { XML_NAMESPACE_OFFICE, "save-failed", "on-save-failed" }, + { XML_NAMESPACE_OFFICE, "copy-to-failed", "on-copy-to-failed" }, + { XML_NAMESPACE_OFFICE, "title-changed", "on-title-changed" }, + + { XML_NAMESPACE_FORM, "approveaction", "on-approveaction" }, + { XML_NAMESPACE_FORM, "performaction", "on-performaction" }, + { XML_NAMESPACE_DOM, "change", "on-change" }, + { XML_NAMESPACE_FORM, "textchange", "on-textchange" }, + { XML_NAMESPACE_FORM, "itemstatechange", "on-itemstatechange" }, + { XML_NAMESPACE_DOM, "keydown", "on-keydown" }, + { XML_NAMESPACE_DOM, "keyup", "on-keyup" }, + { XML_NAMESPACE_FORM, "mousedrag", "on-mousedrag" }, + { XML_NAMESPACE_DOM, "mousemove", "on-mousemove" }, + { XML_NAMESPACE_DOM, "mousedown", "on-mousedown" }, + { XML_NAMESPACE_DOM, "mouseup", "on-mouseup" }, + { XML_NAMESPACE_FORM, "approvereset", "on-approvereset" }, + { XML_NAMESPACE_DOM, "reset", "on-reset" }, + { XML_NAMESPACE_DOM, "submit", "on-submit" }, + { XML_NAMESPACE_FORM, "approveupdate", "on-approveupdate" }, + { XML_NAMESPACE_FORM, "update", "on-update" }, + { XML_NAMESPACE_FORM, "startreload", "on-startreload" }, + { XML_NAMESPACE_FORM, "reload", "on-reload" }, + { XML_NAMESPACE_FORM, "startunload", "on-startunload" }, + { XML_NAMESPACE_FORM, "confirmdelete", "on-confirmdelete" }, + { XML_NAMESPACE_FORM, "approverowchange", "on-approverowchange" }, + { XML_NAMESPACE_FORM, "rowchange", "on-rowchange" }, + { XML_NAMESPACE_FORM, "approvecursormove", "on-approvecursormove" }, + { XML_NAMESPACE_FORM, "cursormove", "on-cursormove" }, + { XML_NAMESPACE_FORM, "supplyparameter", "on-supplyparameter" }, + { XML_NAMESPACE_FORM, "adjust", "on-adjust" }, + { 0, 0, 0 } +}; + +XMLTransformerEventMapEntry aFormTransformerEventMap[] = +{ + { XML_NAMESPACE_DOM, "mouseover", "on-mouseover" }, + { XML_NAMESPACE_DOM, "mouseout", "on-mouseout" }, + { XML_NAMESPACE_DOM, "DOMFocusOut", "on-blur" }, + { 0, 0, 0 } +}; diff --git a/xmloff/source/transform/EventMap.hxx b/xmloff/source/transform/EventMap.hxx new file mode 100644 index 000000000000..d394090b40f9 --- /dev/null +++ b/xmloff/source/transform/EventMap.hxx @@ -0,0 +1,44 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_EVENTMAP_HXX +#define _XMLOFF_EVENTMAP_HXX + +#include "TransformerContext.hxx" + +struct XMLTransformerEventMapEntry +{ + sal_uInt16 m_nOASISPrefix; + const sal_Char *m_pOASISName; + const sal_Char *m_pOOoName; +}; + +extern XMLTransformerEventMapEntry aTransformerEventMap[]; +extern XMLTransformerEventMapEntry aFormTransformerEventMap[]; + +#endif // _XMLOFF_EVENTMAP_HXX + diff --git a/xmloff/source/transform/EventOASISTContext.cxx b/xmloff/source/transform/EventOASISTContext.cxx new file mode 100644 index 000000000000..24488b7694be --- /dev/null +++ b/xmloff/source/transform/EventOASISTContext.cxx @@ -0,0 +1,420 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" +#include "EventOASISTContext.hxx" +#include "EventMap.hxx" +#include "MutableAttrList.hxx" +#include "xmloff/xmlnmspe.hxx" +#include "ActionMapTypesOASIS.hxx" +#include "AttrTransformerAction.hxx" +#include "TransformerActions.hxx" +#ifndef _XMLOFF_TRANSFORMERBASE_HXX +#include "TransformerBase.hxx" +#endif + +#ifndef OASIS_FILTER_OOO_1X +// Used to parse Scripting Framework URLs +#include <com/sun/star/uri/XUriReferenceFactory.hpp> +#include <com/sun/star/uri/XVndSunStarScriptUrl.hpp> +#include <comphelper/processfactory.hxx> +#endif + +#include <hash_map> + +using ::rtl::OUString; + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; +using namespace ::xmloff::token; + +class XMLTransformerOASISEventMap_Impl: + public ::std::hash_map< NameKey_Impl, ::rtl::OUString, + NameHash_Impl, NameHash_Impl > +{ +public: + XMLTransformerOASISEventMap_Impl( XMLTransformerEventMapEntry *pInit ); + ~XMLTransformerOASISEventMap_Impl(); +}; + +XMLTransformerOASISEventMap_Impl::XMLTransformerOASISEventMap_Impl( XMLTransformerEventMapEntry *pInit ) +{ + if( pInit ) + { + XMLTransformerOASISEventMap_Impl::key_type aKey; + XMLTransformerOASISEventMap_Impl::data_type aData; + while( pInit->m_pOASISName ) + { + aKey.m_nPrefix = pInit->m_nOASISPrefix; + aKey.m_aLocalName = OUString::createFromAscii(pInit->m_pOASISName); + + OSL_ENSURE( find( aKey ) == end(), "duplicate event map entry" ); + + aData = OUString::createFromAscii(pInit->m_pOOoName); + + XMLTransformerOASISEventMap_Impl::value_type aVal( aKey, aData ); + + insert( aVal ); + ++pInit; + } + } +} + +XMLTransformerOASISEventMap_Impl::~XMLTransformerOASISEventMap_Impl() +{ +} + +// ----------------------------------------------------------------------------- + +TYPEINIT1( XMLEventOASISTransformerContext, XMLRenameElemTransformerContext); + +XMLEventOASISTransformerContext::XMLEventOASISTransformerContext( + XMLTransformerBase& rImp, + const OUString& rQName ) : + XMLRenameElemTransformerContext( rImp, rQName, + rImp.GetNamespaceMap().GetKeyByAttrName( rQName ), XML_EVENT ) +{ +} + +XMLEventOASISTransformerContext::~XMLEventOASISTransformerContext() +{ +} + +XMLTransformerOASISEventMap_Impl + *XMLEventOASISTransformerContext::CreateEventMap() +{ + return new XMLTransformerOASISEventMap_Impl( aTransformerEventMap ); +} + +XMLTransformerOASISEventMap_Impl + *XMLEventOASISTransformerContext::CreateFormEventMap() +{ + return new XMLTransformerOASISEventMap_Impl( aFormTransformerEventMap ); +} + +void XMLEventOASISTransformerContext::FlushEventMap( + XMLTransformerOASISEventMap_Impl *p ) +{ + delete p; +} + +OUString XMLEventOASISTransformerContext::GetEventName( + sal_uInt16 nPrefix, + const OUString& rName, + XMLTransformerOASISEventMap_Impl& rMap, + XMLTransformerOASISEventMap_Impl *pMap2) +{ + XMLTransformerOASISEventMap_Impl::key_type aKey( nPrefix, rName ); + if( pMap2 ) + { + XMLTransformerOASISEventMap_Impl::const_iterator aIter = + pMap2->find( aKey ); + if( !(aIter == pMap2->end()) ) + return (*aIter).second; + } + + XMLTransformerOASISEventMap_Impl::const_iterator aIter = rMap.find( aKey ); + if( aIter == rMap.end() ) + return rName; + else + return (*aIter).second; +} + +bool ParseURLAsString( + const OUString& rAttrValue, + OUString* pName, OUString* pLocation ) +{ + OUString SCHEME( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.script:" ) ); + + sal_Int32 params = rAttrValue.indexOf( '?' ); + if ( rAttrValue.indexOf( SCHEME ) != 0 || params < 0 ) + { + return sal_False; + } + + sal_Int32 start = SCHEME.getLength(); + *pName = rAttrValue.copy( start, params - start ); + + OUString aToken; + OUString aLanguage; + params++; + do + { + aToken = rAttrValue.getToken( 0, '&', params ); + sal_Int32 dummy = 0; + + if ( aToken.match( GetXMLToken( XML_LANGUAGE ) ) ) + { + aLanguage = aToken.getToken( 1, '=', dummy ); + } + else if ( aToken.match( GetXMLToken( XML_LOCATION ) ) ) + { + OUString tmp = aToken.getToken( 1, '=', dummy ); + if ( tmp.equalsIgnoreAsciiCase( GetXMLToken( XML_DOCUMENT ) ) ) + { + *pLocation = GetXMLToken( XML_DOCUMENT ); + } + else + { + *pLocation = GetXMLToken( XML_APPLICATION ); + } + } + } while ( params >= 0 ); + + if ( aLanguage.equalsIgnoreAsciiCaseAscii( "basic" ) ) + { + return sal_True; + } + return sal_False; +} + +bool ParseURL( + const OUString& rAttrValue, + OUString* pName, OUString* pLocation ) +{ +#ifdef OASIS_FILTER_OOO_1X + return ParseURLAsString( rAttrValue, pName, pLocation ); +#else + Reference< com::sun::star::lang::XMultiServiceFactory > + xSMgr = ::comphelper::getProcessServiceFactory(); + + Reference< com::sun::star::uri::XUriReferenceFactory > + xFactory( xSMgr->createInstance( OUString::createFromAscii( + "com.sun.star.uri.UriReferenceFactory" ) ), UNO_QUERY ); + + if ( xFactory.is() ) + { + Reference< com::sun::star::uri::XVndSunStarScriptUrl > xUrl ( + xFactory->parse( rAttrValue ), UNO_QUERY ); + + if ( xUrl.is() ) + { + OUString aLanguageKey = GetXMLToken( XML_LANGUAGE ); + if ( xUrl.is() && xUrl->hasParameter( aLanguageKey ) ) + { + OUString aLanguage = xUrl->getParameter( aLanguageKey ); + + if ( aLanguage.equalsIgnoreAsciiCaseAscii( "basic" ) ) + { + *pName = xUrl->getName(); + + OUString tmp = + xUrl->getParameter( GetXMLToken( XML_LOCATION ) ); + + OUString doc = GetXMLToken( XML_DOCUMENT ); + + if ( tmp.equalsIgnoreAsciiCase( doc ) ) + { + *pLocation = doc; + } + else + { + *pLocation = GetXMLToken( XML_APPLICATION ); + } + return sal_True; + } + } + } + return sal_False; + } + else + { + return ParseURLAsString( rAttrValue, pName, pLocation ); + } +#endif +} + +void XMLEventOASISTransformerContext::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + OSL_TRACE("XMLEventOASISTransformerContext::StartElement"); + + XMLTransformerActions *pActions = + GetTransformer().GetUserDefinedActions( OASIS_EVENT_ACTIONS ); + OSL_ENSURE( pActions, "go no actions" ); + + Reference< XAttributeList > xAttrList( rAttrList ); + XMLMutableAttributeList *pMutableAttrList = 0; + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + for( sal_Int16 i=0; i < nAttrCount; i++ ) + { + const OUString& rAttrName = xAttrList->getNameByIndex( i ); + OUString aLocalName; + sal_uInt16 nPrefix = + GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName, + &aLocalName ); + XMLTransformerActions::key_type aKey( nPrefix, aLocalName ); + XMLTransformerActions::const_iterator aIter = + pActions->find( aKey ); + if( !(aIter == pActions->end() ) ) + { + if( !pMutableAttrList ) + { + pMutableAttrList = + new XMLMutableAttributeList( xAttrList ); + xAttrList = pMutableAttrList; + } + const OUString& rAttrValue = xAttrList->getValueByIndex( i ); + switch( (*aIter).second.m_nActionType ) + { + case XML_ATACTION_HREF: + { + OUString aAttrValue( rAttrValue ); + OUString aName, aLocation; + + bool bNeedsTransform = + ParseURL( rAttrValue, &aName, &aLocation ); + + if ( bNeedsTransform ) + { + pMutableAttrList->RemoveAttributeByIndex( i ); + + OUString aAttrQName( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_SCRIPT, + ::xmloff::token::GetXMLToken( XML_MACRO_NAME ) ) ); + + pMutableAttrList->AddAttribute( aAttrQName, aName ); + + sal_Int16 idx = pMutableAttrList->GetIndexByName( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_SCRIPT, + GetXMLToken( XML_LANGUAGE ) ) ); + + pMutableAttrList->SetValueByIndex( idx, + OUString::createFromAscii("StarBasic") ); + + OUString aLocQName( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_SCRIPT, + GetXMLToken( XML_LOCATION ) ) ); + + pMutableAttrList->AddAttribute( aLocQName, aLocation ); + } + } + break; + case XML_ATACTION_EVENT_NAME: + { + // Check if the event belongs to a form or control by + // cehcking the 2nd ancestor element, f.i.: + // <form:button><form:event-listeners><form:event-listener> + const XMLTransformerContext *pObjContext = + GetTransformer().GetAncestorContext( 1 ); + sal_Bool bForm = pObjContext && + + pObjContext->HasNamespace(XML_NAMESPACE_FORM ); + pMutableAttrList->SetValueByIndex( i, + GetTransformer().GetEventName( rAttrValue, + bForm ) ); + } + break; + case XML_ATACTION_REMOVE_NAMESPACE_PREFIX: + { + OUString aAttrValue( rAttrValue ); + sal_uInt16 nValPrefix = + static_cast<sal_uInt16>((*aIter).second.m_nParam1); + if( GetTransformer().RemoveNamespacePrefix( + aAttrValue, nValPrefix ) ) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_MACRO_NAME: + { + OUString aName, aLocation; + bool bNeedsTransform = + ParseURL( rAttrValue, &aName, &aLocation ); + + if ( bNeedsTransform ) + { + pMutableAttrList->SetValueByIndex( i, aName ); + + sal_Int16 idx = pMutableAttrList->GetIndexByName( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_SCRIPT, + GetXMLToken( XML_LANGUAGE ) ) ); + + pMutableAttrList->SetValueByIndex( idx, + OUString::createFromAscii("StarBasic") ); + + OUString aLocQName( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_SCRIPT, + GetXMLToken( XML_LOCATION ) ) ); + + pMutableAttrList->AddAttribute( aLocQName, aLocation ); + } + else + { + const OUString& rApp = GetXMLToken( XML_APPLICATION ); + const OUString& rDoc = GetXMLToken( XML_DOCUMENT ); + OUString aAttrValue; + if( rAttrValue.getLength() > rApp.getLength()+1 && + rAttrValue.copy(0,rApp.getLength()). + equalsIgnoreAsciiCase( rApp ) && + ':' == rAttrValue[rApp.getLength()] ) + { + aLocation = rApp; + aAttrValue = rAttrValue.copy( rApp.getLength()+1 ); + } + else if( rAttrValue.getLength() > rDoc.getLength()+1 && + rAttrValue.copy(0,rDoc.getLength()). + equalsIgnoreAsciiCase( rDoc ) && + ':' == rAttrValue[rDoc.getLength()] ) + { + aLocation= rDoc; + aAttrValue = rAttrValue.copy( rDoc.getLength()+1 ); + } + if( aAttrValue.getLength() ) + pMutableAttrList->SetValueByIndex( i, + aAttrValue ); + if( aLocation.getLength() ) + { + OUString aAttrQName( GetTransformer().GetNamespaceMap(). + GetQNameByKey( XML_NAMESPACE_SCRIPT, + ::xmloff::token::GetXMLToken( XML_LOCATION ) ) ); + pMutableAttrList->AddAttribute( aAttrQName, aLocation ); + // draw bug + aAttrQName = GetTransformer().GetNamespaceMap(). + GetQNameByKey( XML_NAMESPACE_SCRIPT, + ::xmloff::token::GetXMLToken( XML_LIBRARY ) ); + pMutableAttrList->AddAttribute( aAttrQName, aLocation ); + } + } + } + break; + case XML_ATACTION_COPY: + break; + default: + OSL_ENSURE( !this, "unknown action" ); + break; + } + } + } + + XMLRenameElemTransformerContext::StartElement( xAttrList ); +} diff --git a/xmloff/source/transform/EventOASISTContext.hxx b/xmloff/source/transform/EventOASISTContext.hxx new file mode 100644 index 000000000000..75212327e6b1 --- /dev/null +++ b/xmloff/source/transform/EventOASISTContext.hxx @@ -0,0 +1,56 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_EVENTOASISTCONTEXT_HXX +#define _XMLOFF_EVENTOASISTCONTEXT_HXX + +#include "RenameElemTContext.hxx" + +class XMLTransformerOASISEventMap_Impl; + +class XMLEventOASISTransformerContext : public XMLRenameElemTransformerContext +{ +public: + TYPEINFO(); + + XMLEventOASISTransformerContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName ); + virtual ~XMLEventOASISTransformerContext(); + + static XMLTransformerOASISEventMap_Impl *CreateFormEventMap(); + static XMLTransformerOASISEventMap_Impl *CreateEventMap(); + static void FlushEventMap( XMLTransformerOASISEventMap_Impl *p ); + static ::rtl::OUString GetEventName( sal_uInt16 nPrefix, + const ::rtl::OUString& rName, + XMLTransformerOASISEventMap_Impl& rMap, + XMLTransformerOASISEventMap_Impl* pMap2 ); + + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); +}; + +#endif // _XMLOFF_EVENTOASISTCONTEXT_HXX + diff --git a/xmloff/source/transform/EventOOoTContext.cxx b/xmloff/source/transform/EventOOoTContext.cxx new file mode 100644 index 000000000000..3b63935817c8 --- /dev/null +++ b/xmloff/source/transform/EventOOoTContext.cxx @@ -0,0 +1,266 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" +#include "EventOOoTContext.hxx" +#include "EventMap.hxx" +#include "MutableAttrList.hxx" +#include "xmloff/xmlnmspe.hxx" +#ifndef _XMLOFF_ACTIONMAPTYPESOOo_HXX +#include "ActionMapTypesOOo.hxx" +#endif +#include "AttrTransformerAction.hxx" +#include "TransformerActions.hxx" +#ifndef _XMLOFF_TRANSFORMERBASE_HXX +#include "TransformerBase.hxx" +#endif +#include <comphelper/stl_types.hxx> +#include <rtl/ustrbuf.hxx> + +#include <hash_map> + +using ::rtl::OUString; +using ::rtl::OUStringBuffer; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; +using namespace ::xmloff::token; + +class XMLTransformerOOoEventMap_Impl: + public ::std::hash_map< ::rtl::OUString, NameKey_Impl, + ::rtl::OUStringHash, ::comphelper::UStringEqual > +{ +public: + + void AddMap( XMLTransformerEventMapEntry *pInit ); + + XMLTransformerOOoEventMap_Impl( XMLTransformerEventMapEntry *pInit, + XMLTransformerEventMapEntry *pInit2 ); + ~XMLTransformerOOoEventMap_Impl(); +}; + +void XMLTransformerOOoEventMap_Impl::AddMap( XMLTransformerEventMapEntry *pInit ) +{ + XMLTransformerOOoEventMap_Impl::key_type aKey; + XMLTransformerOOoEventMap_Impl::data_type aData; + while( pInit->m_pOOoName ) + { + aKey = OUString::createFromAscii(pInit->m_pOOoName); + + OSL_ENSURE( find( aKey ) == end(), "duplicate event map entry" ); + + aData.m_nPrefix = pInit->m_nOASISPrefix; + aData.m_aLocalName = OUString::createFromAscii(pInit->m_pOASISName); + + XMLTransformerOOoEventMap_Impl::value_type aVal( aKey, aData ); + + if( !insert( aVal ).second ) + { + OSL_ENSURE( false, "duplicate OOo event name extry" ); + } + + ++pInit; + } +} + +XMLTransformerOOoEventMap_Impl::XMLTransformerOOoEventMap_Impl( + XMLTransformerEventMapEntry *pInit, + XMLTransformerEventMapEntry *pInit2 ) +{ + if( pInit ) + AddMap( pInit ); + if( pInit ) + AddMap( pInit2 ); +} + +XMLTransformerOOoEventMap_Impl::~XMLTransformerOOoEventMap_Impl() +{ +} + +// ----------------------------------------------------------------------------- + +TYPEINIT1( XMLEventOOoTransformerContext, XMLPersElemContentTContext ); + +XMLEventOOoTransformerContext::XMLEventOOoTransformerContext( + XMLTransformerBase& rImp, + const OUString& rQName, + sal_Bool bPersistent ) : + XMLPersElemContentTContext( rImp, rQName, + rImp.GetNamespaceMap().GetKeyByAttrName( rQName ), XML_EVENT_LISTENER ), + m_bPersistent( bPersistent ) +{ +} + +XMLEventOOoTransformerContext::~XMLEventOOoTransformerContext() +{ +} + +XMLTransformerOOoEventMap_Impl + *XMLEventOOoTransformerContext::CreateEventMap() +{ + return new XMLTransformerOOoEventMap_Impl( aTransformerEventMap, + aFormTransformerEventMap ); +} + +void XMLEventOOoTransformerContext::FlushEventMap( + XMLTransformerOOoEventMap_Impl *p ) +{ + delete p; +} + +sal_uInt16 XMLEventOOoTransformerContext::GetEventName( + const OUString& rName, + OUString& rNewName, + XMLTransformerOOoEventMap_Impl& rMap ) +{ + XMLTransformerOOoEventMap_Impl::key_type aKey( rName ); + XMLTransformerOOoEventMap_Impl::const_iterator aIter = rMap.find( aKey ); + if( aIter == rMap.end() ) + { + rNewName = rName; + return XML_NAMESPACE_UNKNOWN; + } + else + { + rNewName = (*aIter).second.m_aLocalName; + return (*aIter).second.m_nPrefix; + } +} + + +void XMLEventOOoTransformerContext::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + XMLTransformerActions *pActions = + GetTransformer().GetUserDefinedActions( OOO_EVENT_ACTIONS ); + OSL_ENSURE( pActions, "go no actions" ); + + OUString aLocation, aMacroName; + sal_Int16 nMacroName = -1; + Reference< XAttributeList > xAttrList( rAttrList ); + XMLMutableAttributeList *pMutableAttrList = 0; + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + for( sal_Int16 i=0; i < nAttrCount; i++ ) + { + const OUString& rAttrName = xAttrList->getNameByIndex( i ); + OUString aLocalName; + sal_uInt16 nPrefix = + GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName, + &aLocalName ); + XMLTransformerActions::key_type aKey( nPrefix, aLocalName ); + XMLTransformerActions::const_iterator aIter = + pActions->find( aKey ); + if( !(aIter == pActions->end() ) ) + { + if( !pMutableAttrList ) + { + pMutableAttrList = + new XMLMutableAttributeList( xAttrList ); + xAttrList = pMutableAttrList; + } + const OUString& rAttrValue = xAttrList->getValueByIndex( i ); + switch( (*aIter).second.m_nActionType ) + { + case XML_ATACTION_HREF: + // TODO + break; + case XML_ATACTION_EVENT_NAME: + pMutableAttrList->SetValueByIndex( i, + GetTransformer().GetEventName( rAttrValue ) ); + break; + case XML_ATACTION_ADD_NAMESPACE_PREFIX: + { + OUString aAttrValue( rAttrValue ); + sal_uInt16 nValPrefix = + static_cast<sal_uInt16>((*aIter).second.m_nParam1); + if( GetTransformer().AddNamespacePrefix( aAttrValue, + nValPrefix ) ) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_MACRO_LOCATION: + aLocation = rAttrValue; + pMutableAttrList->RemoveAttributeByIndex( i ); + --i; + --nAttrCount; + break; + case XML_ATACTION_MACRO_NAME: + aMacroName = rAttrValue; + nMacroName = i; + break; + case XML_ATACTION_COPY: + break; + default: + OSL_ENSURE( !this, "unknown action" ); + break; + } + } + } + + if( nMacroName != -1 && aLocation.getLength() > 0 ) + { + if( !IsXMLToken( aLocation, XML_APPLICATION ) ) + aLocation = GetXMLToken( XML_DOCUMENT ); + OUStringBuffer sTmp( aLocation.getLength() + aMacroName.getLength() + 1 ); + sTmp = aLocation; + sTmp.append( sal_Unicode( ':' ) ); + sTmp.append( aMacroName ); + pMutableAttrList->SetValueByIndex( nMacroName, + sTmp.makeStringAndClear() ); + } + + if( m_bPersistent ) + XMLPersElemContentTContext::StartElement( xAttrList ); + else + GetTransformer().GetDocHandler()->startElement( GetExportQName(), + xAttrList ); +} + +void XMLEventOOoTransformerContext::EndElement() +{ + if( m_bPersistent ) + XMLPersElemContentTContext::EndElement(); + else + GetTransformer().GetDocHandler()->endElement( GetExportQName() ); +} + +XMLTransformerContext * XMLEventOOoTransformerContext::CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const Reference< XAttributeList >& xAttrList ) +{ + if( m_bPersistent ) + return XMLPersElemContentTContext::CreateChildContext(nPrefix, rLocalName, rQName, xAttrList); + else + return XMLTransformerContext::CreateChildContext(nPrefix, rLocalName, rQName, xAttrList); +} + +sal_Bool XMLEventOOoTransformerContext::IsPersistent() const +{ + return m_bPersistent; +} diff --git a/xmloff/source/transform/EventOOoTContext.hxx b/xmloff/source/transform/EventOOoTContext.hxx new file mode 100644 index 000000000000..4d2e603f27e7 --- /dev/null +++ b/xmloff/source/transform/EventOOoTContext.hxx @@ -0,0 +1,64 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_EVENTOOOTCONTEXT_HXX +#define _XMLOFF_EVENTOOOTCONTEXT_HXX + +#include "DeepTContext.hxx" + +class XMLTransformerOOoEventMap_Impl; + +class XMLEventOOoTransformerContext : public XMLPersElemContentTContext +{ + sal_Bool m_bPersistent; + +public: + TYPEINFO(); + + XMLEventOOoTransformerContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName, + sal_Bool bPersistent = sal_False ); + virtual ~XMLEventOOoTransformerContext(); + + static XMLTransformerOOoEventMap_Impl *CreateEventMap(); + static void FlushEventMap( XMLTransformerOOoEventMap_Impl *p ); + static sal_uInt16 GetEventName( const ::rtl::OUString& rName, + ::rtl::OUString& rNewName, + XMLTransformerOOoEventMap_Impl& rMap ); + + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + virtual void EndElement(); + virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix, + const ::rtl::OUString& rLocalName, + const ::rtl::OUString& rQName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + virtual sal_Bool IsPersistent() const; +}; + +#endif // _XMLOFF_EVENTOOOTCONTEXT_HXX + diff --git a/xmloff/source/transform/FamilyType.hxx b/xmloff/source/transform/FamilyType.hxx new file mode 100644 index 000000000000..b94b2d7ff437 --- /dev/null +++ b/xmloff/source/transform/FamilyType.hxx @@ -0,0 +1,60 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_FAMILYTYPE_HXX +#define _XMLOFF_FAMILYTYPE_HXX + +enum XMLFamilyType +{ + XML_FAMILY_TYPE_GRAPHIC, + XML_FAMILY_TYPE_PRESENTATION, + XML_FAMILY_TYPE_DRAWING_PAGE, + XML_FAMILY_TYPE_MASTER_PAGE, + XML_FAMILY_TYPE_PAGE_LAYOUT, + XML_FAMILY_TYPE_HEADER_FOOTER, + XML_FAMILY_TYPE_TEXT, + XML_FAMILY_TYPE_PARAGRAPH, + XML_FAMILY_TYPE_RUBY, + XML_FAMILY_TYPE_SECTION, + XML_FAMILY_TYPE_TABLE, + XML_FAMILY_TYPE_TABLE_COLUMN, + XML_FAMILY_TYPE_TABLE_ROW, + XML_FAMILY_TYPE_TABLE_CELL, + XML_FAMILY_TYPE_LIST, + XML_FAMILY_TYPE_CHART, + XML_FAMILY_TYPE_DATA, + XML_FAMILY_TYPE_GRADIENT, + XML_FAMILY_TYPE_HATCH, + XML_FAMILY_TYPE_FILL_IMAGE, + XML_FAMILY_TYPE_STROKE_DASH, + XML_FAMILY_TYPE_MARKER, + XML_FAMILY_TYPE_PRESENTATION_PAGE_LAYOUT, + XML_FAMILY_TYPE_END +}; + +#endif // _XMLOFF_FAMILYTYPE_HXX + diff --git a/xmloff/source/transform/FlatTContext.cxx b/xmloff/source/transform/FlatTContext.cxx new file mode 100644 index 000000000000..93e277670f08 --- /dev/null +++ b/xmloff/source/transform/FlatTContext.cxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" +#include "FlatTContext.hxx" +#ifndef _XMLOFF_TRANSFORMERBASE_HXX +#include "TransformerBase.hxx" +#endif + +using ::rtl::OUString; + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; + +TYPEINIT1( XMLPersTextContentTContext, XMLPersAttrListTContext ); + +XMLPersTextContentTContext::XMLPersTextContentTContext( + XMLTransformerBase& rImp, + const OUString& rQName ) : + XMLPersAttrListTContext( rImp, rQName ) +{ +} + +XMLPersTextContentTContext::XMLPersTextContentTContext( + XMLTransformerBase& rImp, + const OUString& rQName, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken ) : + XMLPersAttrListTContext( rImp, rQName, nPrefix, eToken ) +{ +} + +XMLPersTextContentTContext::~XMLPersTextContentTContext() +{ +} + +void XMLPersTextContentTContext::Characters( const OUString& rChars ) +{ + m_aCharacters += rChars; +} + +void XMLPersTextContentTContext::ExportContent() +{ + GetTransformer().GetDocHandler()->characters( m_aCharacters ); +} diff --git a/xmloff/source/transform/FlatTContext.hxx b/xmloff/source/transform/FlatTContext.hxx new file mode 100644 index 000000000000..543c5bc48db6 --- /dev/null +++ b/xmloff/source/transform/FlatTContext.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_FLATTCONTEXT_HXX +#define _XMLOFF_FLATTCONTEXT_HXX + +#include "PersAttrListTContext.hxx" + + +class XMLPersTextContentTContext : public XMLPersAttrListTContext +{ + ::rtl::OUString m_aCharacters; + +public: + TYPEINFO(); + + // A contexts constructor does anything that is required if an element + // starts. Namespace processing has been done already. + // Note that virtual methods cannot be used inside constructors. Use + // StartElement instead if this is required. + XMLPersTextContentTContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName ); + + // attr list/text content persistence + renaming + XMLPersTextContentTContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken ); + + // A contexts destructor does anything that is required if an element + // ends. By default, nothing is done. + // Note that virtual methods cannot be used inside destructors. Use + // EndElement instead if this is required. + virtual ~XMLPersTextContentTContext(); + + // This method is called for all characters that are contained in the + // current element. + virtual void Characters( const ::rtl::OUString& rChars ); + + virtual void ExportContent(); + + const ::rtl::OUString& GetTextContent() const { return m_aCharacters; } +}; + +#endif // _XMLOFF_FLATTCONTEXT_HXX + diff --git a/xmloff/source/transform/FormPropOASISTContext.cxx b/xmloff/source/transform/FormPropOASISTContext.cxx new file mode 100644 index 000000000000..518618f4059d --- /dev/null +++ b/xmloff/source/transform/FormPropOASISTContext.cxx @@ -0,0 +1,225 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" +#include "MutableAttrList.hxx" +#include "xmloff/xmlnmspe.hxx" +#include <xmloff/nmspmap.hxx> +#include "ActionMapTypesOASIS.hxx" +#include "AttrTransformerAction.hxx" +#include "TransformerActions.hxx" +#ifndef _XMLOFF_TRANSFORMERBASE_HXX +#include "TransformerBase.hxx" +#endif +#include "FormPropOASISTContext.hxx" + +using ::rtl::OUString; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; +using namespace ::xmloff::token; + +TYPEINIT1( XMLFormPropOASISTransformerContext, + XMLRenameElemTransformerContext ); + +XMLTokenEnum XMLFormPropOASISTransformerContext::GetValueType( + const OUString& rValue ) +{ + XMLTokenEnum eRet = XML_DOUBLE; + sal_Bool bNeg = sal_False; + sal_uInt32 nVal = 0; + + sal_Int32 nPos = 0; + sal_Int32 nLen = rValue.getLength(); + + // skip white space + while( nPos < nLen && sal_Unicode(' ') == rValue[nPos] ) + nPos++; + + if( nPos < nLen && sal_Unicode('-') == rValue[nPos] ) + { + bNeg = sal_True; + nPos++; + } + + // get number + sal_Bool bOverflow = sal_False; + while( nPos < nLen && + sal_Unicode('0') <= rValue[nPos] && + sal_Unicode('9') >= rValue[nPos] ) + { + nVal *= 10; + nVal += (rValue[nPos] - sal_Unicode('0')); + bOverflow |= (nVal > (bNeg ? 2147483648UL : 2147483647UL)); + nPos++; + } + + // skip white space + while( nPos < nLen && sal_Unicode(' ') == rValue[nPos] ) + nPos++; + + if( nPos == nLen ) + { + // It's a integer number + if( bOverflow ) + eRet = XML_LONG; + else if( nVal > (bNeg ? 32768UL : 32767UL) ) + eRet = XML_INT; + else + eRet = XML_SHORT; + } + + return eRet; +} + +XMLFormPropOASISTransformerContext::XMLFormPropOASISTransformerContext( + XMLTransformerBase& rImp, + const OUString& rQName, + XMLTokenEnum eLocalName ) : + XMLRenameElemTransformerContext( rImp, rQName, XML_NAMESPACE_FORM, + XML_PROPERTY ), + m_bIsList( XML_LIST_PROPERTY == eLocalName), + m_bIsListValue( XML_LIST_VALUE == eLocalName) +{ +} + +XMLFormPropOASISTransformerContext::~XMLFormPropOASISTransformerContext() +{ +} + +void XMLFormPropOASISTransformerContext::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + + XMLTransformerActions *pActions = + GetTransformer().GetUserDefinedActions( OASIS_FORM_PROP_ACTIONS ); + OSL_ENSURE( pActions, "go no actions" ); + + XMLMutableAttributeList *pMutableAttrList = + new XMLMutableAttributeList( rAttrList ); + Reference< XAttributeList > xAttrList( pMutableAttrList ); + + sal_Int16 nValueTypeAttr = -1; + OUString aValue; + sal_Bool bIsVoid = sal_False; + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + for( sal_Int16 i=0; i < nAttrCount; i++ ) + { + const OUString& rAttrName = xAttrList->getNameByIndex( i ); + OUString aLocalName; + sal_uInt16 nPrefix = + GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName, + &aLocalName ); + XMLTransformerActions::key_type aKey( nPrefix, aLocalName ); + XMLTransformerActions::const_iterator aIter = + pActions->find( aKey ); + if( !(aIter == pActions->end() ) ) + { + const OUString& rAttrValue = xAttrList->getValueByIndex( i ); + switch( (*aIter).second.m_nActionType ) + { + case XML_ATACTION_RENAME: + if( IsXMLToken( aLocalName, XML_VALUE_TYPE ) ) + { + if( IsXMLToken( rAttrValue, XML_FLOAT ) ) + { + nValueTypeAttr = i; + } + else if( IsXMLToken( rAttrValue, XML_VOID ) ) + { + pMutableAttrList->SetValueByIndex( i, + GetXMLToken( XML_SHORT ) ); + bIsVoid = sal_True; + } + } + { + OUString aNewAttrQName( + GetTransformer().GetNamespaceMap().GetQNameByKey( + (*aIter).second.GetQNamePrefixFromParam1(), + ::xmloff::token::GetXMLToken( + (*aIter).second.GetQNameTokenFromParam1()) ) ); + pMutableAttrList->RenameAttributeByIndex( i, aNewAttrQName ); + } + break; + case XML_ATACTION_REMOVE: + if( !IsXMLToken( aLocalName, XML_CURRENCY ) ) + aValue = rAttrValue; + pMutableAttrList->RemoveAttributeByIndex( i ); + --i; + --nAttrCount; + break; + default: + OSL_ENSURE( !this, "unknown action" ); + break; + } + } + } + if( m_bIsList ) + { + OUString aNewAttrQName( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_FORM, + GetXMLToken( XML_PROPERTY_IS_LIST ) ) ); + pMutableAttrList->AddAttribute( aNewAttrQName, + GetXMLToken( XML_TRUE ) ); + } + + if( nValueTypeAttr != -1 ) + pMutableAttrList->SetValueByIndex( nValueTypeAttr, + GetXMLToken( GetValueType( aValue ) ) ); + + if( !m_bIsListValue ) + XMLRenameElemTransformerContext::StartElement( xAttrList ); + if( !m_bIsList ) + { + pMutableAttrList = + new XMLMutableAttributeList; + xAttrList = pMutableAttrList; + if( bIsVoid ) + { + OUString aNewAttrQName( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_FORM, GetXMLToken( XML_PROPERTY_IS_VOID ) ) ); + pMutableAttrList->AddAttribute( aNewAttrQName, + GetXMLToken( XML_TRUE ) ); + } + + OUString aValueElemQName( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_FORM, GetXMLToken( XML_PROPERTY_VALUE ) ) ); + GetTransformer().GetDocHandler()->startElement( aValueElemQName, + xAttrList ); + GetTransformer().GetDocHandler()->characters( aValue ); + GetTransformer().GetDocHandler()->endElement( aValueElemQName ); + } +} + +void XMLFormPropOASISTransformerContext::EndElement() +{ + if( !m_bIsListValue ) + XMLRenameElemTransformerContext::EndElement(); +} diff --git a/xmloff/source/transform/FormPropOASISTContext.hxx b/xmloff/source/transform/FormPropOASISTContext.hxx new file mode 100644 index 000000000000..b6f1423afb66 --- /dev/null +++ b/xmloff/source/transform/FormPropOASISTContext.hxx @@ -0,0 +1,55 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_FORMPROPOASISTCONTEXT_HXX +#define _XMLOFF_FORMPROPOASISTCONTEXT_HXX + +#include "RenameElemTContext.hxx" + +class XMLFormPropOASISTransformerContext : + public XMLRenameElemTransformerContext +{ + sal_Bool m_bIsList; + sal_Bool m_bIsListValue; + + ::xmloff::token::XMLTokenEnum GetValueType( const ::rtl::OUString& rValue ); + +public: + TYPEINFO(); + + XMLFormPropOASISTransformerContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName, + ::xmloff::token::XMLTokenEnum eLocalName ); + + virtual ~XMLFormPropOASISTransformerContext(); + + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + virtual void EndElement(); +}; + +#endif // _XMLOFF_FORMPROPOASISTCONTEXT_HXX + diff --git a/xmloff/source/transform/FormPropOOoTContext.cxx b/xmloff/source/transform/FormPropOOoTContext.cxx new file mode 100644 index 000000000000..54682b3e0c03 --- /dev/null +++ b/xmloff/source/transform/FormPropOOoTContext.cxx @@ -0,0 +1,314 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" +#include "MutableAttrList.hxx" +#include "xmloff/xmlnmspe.hxx" +#include <xmloff/nmspmap.hxx> +#include "IgnoreTContext.hxx" +#ifndef _XMLOFF_ACTIONMAPTYPESOOo_HXX +#include "ActionMapTypesOOo.hxx" +#endif +#include "AttrTransformerAction.hxx" +#include "TransformerActions.hxx" +#ifndef _XMLOFF_TRANSFORMERBASE_HXX +#include "TransformerBase.hxx" +#endif +#include "FormPropOOoTContext.hxx" + +using ::rtl::OUString; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; +using namespace ::xmloff::token; + +class XMLFormPropValueTContext_Impl : public XMLTransformerContext +{ + OUString m_aAttrQName; + ::rtl::OUString m_aCharacters; + sal_Bool m_bPersistent; + sal_Bool m_bIsVoid; + +public: + TYPEINFO(); + + // element content persistence only + XMLFormPropValueTContext_Impl( XMLTransformerBase& rTransformer, + const OUString& rQName ); + XMLFormPropValueTContext_Impl( XMLTransformerBase& rTransformer, + const OUString& rQName, + sal_uInt16 nAttrPrefix, + XMLTokenEnum eAttrToken ); + + virtual ~XMLFormPropValueTContext_Impl(); + + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + virtual void EndElement(); + + virtual void Characters( const ::rtl::OUString& rChars ); + + virtual sal_Bool IsPersistent() const; + + sal_Bool IsVoid() const { return m_bIsVoid; } + const ::rtl::OUString& GetTextContent() const { return m_aCharacters; } +}; + +TYPEINIT1( XMLFormPropValueTContext_Impl, XMLTransformerContext ); + +XMLFormPropValueTContext_Impl::XMLFormPropValueTContext_Impl( + XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName ) : + XMLTransformerContext( rTransformer, rQName ), + m_bPersistent( sal_True ), + m_bIsVoid( sal_False ) +{ +} + +XMLFormPropValueTContext_Impl::XMLFormPropValueTContext_Impl( + XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName, + sal_uInt16 nAttrPrefix, + XMLTokenEnum eAttrToken ) : + XMLTransformerContext( rTransformer, rQName ), + m_aAttrQName( rTransformer.GetNamespaceMap().GetQNameByKey( + nAttrPrefix, GetXMLToken(eAttrToken) ) ), + m_bPersistent( sal_True ), + m_bIsVoid( sal_False ) +{ +} + +XMLFormPropValueTContext_Impl::~XMLFormPropValueTContext_Impl() +{ +} + +void XMLFormPropValueTContext_Impl::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + sal_Int16 nAttrCount = rAttrList.is() ? rAttrList->getLength() : 0; + for( sal_Int16 i=0; i < nAttrCount; i++ ) + { + const OUString& rAttrName = rAttrList->getNameByIndex( i ); + OUString aLocalName; + sal_uInt16 nPrefix = + GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName, + &aLocalName ); + if( XML_NAMESPACE_FORM == nPrefix && + IsXMLToken( aLocalName, XML_PROPERTY_IS_VOID ) && + IsXMLToken( rAttrList->getValueByIndex( i ), XML_TRUE ) ) + m_bIsVoid = sal_True; + } +} + +void XMLFormPropValueTContext_Impl::EndElement() +{ + if( !m_bPersistent ) + { + XMLMutableAttributeList *pMutableAttrList = + new XMLMutableAttributeList; + Reference< XAttributeList > xAttrList( pMutableAttrList ); + pMutableAttrList->AddAttribute( m_aAttrQName, + m_aCharacters ); + + OUString aElemQName( GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_FORM, GetXMLToken(XML_LIST_VALUE) ) ); + GetTransformer().GetDocHandler()->startElement( aElemQName, + xAttrList ); + GetTransformer().GetDocHandler()->endElement( aElemQName ); + } +} + +void XMLFormPropValueTContext_Impl::Characters( const OUString& rChars ) +{ + m_aCharacters += rChars; +} + + +sal_Bool XMLFormPropValueTContext_Impl::IsPersistent() const +{ + return m_bPersistent; +} + +//------------------------------------------------------------------------------ + +TYPEINIT1( XMLFormPropOOoTransformerContext, XMLTransformerContext ); + +XMLFormPropOOoTransformerContext::XMLFormPropOOoTransformerContext( + XMLTransformerBase& rImp, + const OUString& rQName ) : + XMLTransformerContext( rImp, rQName ), + m_aElemQName( rQName ), + m_nValueTypeAttr( -1 ), + m_eValueToken( XML_VALUE ), + m_eValueTypeToken( XML_TOKEN_END ), + m_bIsList( sal_False ) +{ +} + +XMLFormPropOOoTransformerContext::~XMLFormPropOOoTransformerContext() +{ +} + +XMLTransformerContext *XMLFormPropOOoTransformerContext::CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const Reference< XAttributeList >& ) +{ + XMLTransformerContext *pContext = 0; + + if( XML_NAMESPACE_FORM == nPrefix && + IsXMLToken( rLocalName, XML_PROPERTY_VALUE ) ) + { + if( m_bIsList ) + { + pContext = new XMLFormPropValueTContext_Impl( GetTransformer(), + rQName, + XML_NAMESPACE_OFFICE, + m_eValueToken ); + } + else if( !m_xValueContext.is() ) + { + m_xValueContext= + new XMLFormPropValueTContext_Impl( GetTransformer(), rQName ); + pContext = m_xValueContext.get(); + } + } + + // default is ignore + if( !pContext ) + pContext = new XMLIgnoreTransformerContext( GetTransformer(), rQName, + sal_True, sal_True ); + return pContext; +} + +void XMLFormPropOOoTransformerContext::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + + XMLTransformerActions *pActions = + GetTransformer().GetUserDefinedActions( OOO_FORM_PROP_ACTIONS ); + OSL_ENSURE( pActions, "go no actions" ); + + XMLMutableAttributeList *pMutableAttrList = + new XMLMutableAttributeList( rAttrList, sal_True ); + m_xAttrList = pMutableAttrList; + + OUString aValueType; + sal_Int16 nAttrCount = rAttrList.is() ? rAttrList->getLength() : 0; + for( sal_Int16 i=0; i < nAttrCount; i++ ) + { + const OUString& rAttrName = rAttrList->getNameByIndex( i ); + OUString aLocalName; + sal_uInt16 nPrefix = + GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName, + &aLocalName ); + XMLTransformerActions::key_type aKey( nPrefix, aLocalName ); + XMLTransformerActions::const_iterator aIter = + pActions->find( aKey ); + if( !(aIter == pActions->end() ) ) + { + const OUString& rAttrValue = rAttrList->getValueByIndex( i ); + switch( (*aIter).second.m_nActionType ) + { + case XML_ATACTION_RENAME: + if( IsXMLToken( aLocalName, XML_PROPERTY_TYPE ) ) + { + aValueType = rAttrValue; + m_nValueTypeAttr = i; + } + { + OUString aNewAttrQName( + GetTransformer().GetNamespaceMap().GetQNameByKey( + (*aIter).second.GetQNamePrefixFromParam1(), + ::xmloff::token::GetXMLToken( + (*aIter).second.GetQNameTokenFromParam1()) ) ); + pMutableAttrList->RenameAttributeByIndex( i, aNewAttrQName ); + } + break; + case XML_ATACTION_REMOVE: + if( IsXMLToken( aLocalName, XML_PROPERTY_IS_LIST ) ) + { + m_aElemQName = + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_FORM, GetXMLToken( XML_LIST_PROPERTY ) ); + m_bIsList = sal_True; + } + pMutableAttrList->RemoveAttributeByIndex( i ); + --i; + --nAttrCount; + break; + default: + OSL_ENSURE( !this, "unknown action" ); + break; + } + } + } + + if( aValueType.getLength() ) + { + if( IsXMLToken( aValueType, XML_STRING ) ) + m_eValueToken = XML_STRING_VALUE; + else if( IsXMLToken( aValueType, XML_BOOLEAN ) ) + m_eValueToken = XML_BOOLEAN_VALUE; + else if( IsXMLToken( aValueType, XML_SHORT ) || + IsXMLToken( aValueType, XML_INT ) || + IsXMLToken( aValueType, XML_LONG ) || + IsXMLToken( aValueType, XML_DOUBLE ) ) + m_eValueTypeToken = XML_FLOAT; + } +} + +void XMLFormPropOOoTransformerContext::EndElement() +{ + if( m_xValueContext.is() ) + { + if( m_xValueContext->IsVoid() ) + { + m_eValueTypeToken = XML_VOID; + } + else + { + OUString aAttrQName( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_OFFICE, GetXMLToken(m_eValueToken) ) ); + static_cast< XMLMutableAttributeList * >( m_xAttrList.get() ) + ->AddAttribute( aAttrQName, m_xValueContext->GetTextContent() ); + } + } + + if( m_nValueTypeAttr != -1 && m_eValueTypeToken != XML_TOKEN_END ) + { + static_cast< XMLMutableAttributeList * >( m_xAttrList.get() ) + ->SetValueByIndex( m_nValueTypeAttr , + GetXMLToken( m_eValueTypeToken ) ); + } + + GetTransformer().GetDocHandler()->startElement( m_aElemQName, + m_xAttrList ); + GetTransformer().GetDocHandler()->endElement( m_aElemQName ); +} diff --git a/xmloff/source/transform/FormPropOOoTContext.hxx b/xmloff/source/transform/FormPropOOoTContext.hxx new file mode 100644 index 000000000000..b1f678859c84 --- /dev/null +++ b/xmloff/source/transform/FormPropOOoTContext.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_FORMPROPOOOTCONTEXT_HXX +#define _XMLOFF_FORMPROPOOOTCONTEXT_HXX + +#include <rtl/ref.hxx> +#include "TransformerContext.hxx" + +class XMLFormPropValueTContext_Impl; + +class XMLFormPropOOoTransformerContext : public XMLTransformerContext +{ + ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > m_xAttrList; + + ::rtl::Reference< XMLFormPropValueTContext_Impl > m_xValueContext; + + ::rtl::OUString m_aElemQName; + + sal_Int16 m_nValueTypeAttr; + + ::xmloff::token::XMLTokenEnum m_eValueToken; + ::xmloff::token::XMLTokenEnum m_eValueTypeToken; + + sal_Bool m_bIsList; + +public: + TYPEINFO(); + + XMLFormPropOOoTransformerContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName ); + + virtual ~XMLFormPropOOoTransformerContext(); + + virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix, + const ::rtl::OUString& rLocalName, + const ::rtl::OUString& rQName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + virtual void EndElement(); +}; + +#endif // _XMLOFF_FORMPROPOOOTCONTEXT_HXX + diff --git a/xmloff/source/transform/FrameOASISTContext.cxx b/xmloff/source/transform/FrameOASISTContext.cxx new file mode 100644 index 000000000000..3c9439111aec --- /dev/null +++ b/xmloff/source/transform/FrameOASISTContext.cxx @@ -0,0 +1,200 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" +#include "FrameOASISTContext.hxx" +#include "IgnoreTContext.hxx" +#include "MutableAttrList.hxx" +#include "xmloff/xmlnmspe.hxx" +#include "ActionMapTypesOASIS.hxx" +#include "ElemTransformerAction.hxx" +#include "TransformerActions.hxx" +#ifndef _XMLOFF_TRANSFORMERBASE_HXX +#include "TransformerBase.hxx" +#endif + +using ::rtl::OUString; + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; +using namespace ::xmloff::token; + +TYPEINIT1( XMLFrameOASISTransformerContext, XMLTransformerContext ); + +sal_Bool XMLFrameOASISTransformerContext::IsLinkedEmbeddedObject( + const OUString& rLocalName, + const Reference< XAttributeList >& rAttrList ) +{ + if( !(IsXMLToken( rLocalName, XML_OBJECT ) || + IsXMLToken( rLocalName, XML_OBJECT_OLE) ) ) + return sal_False; + + sal_Int16 nAttrCount = rAttrList.is() ? rAttrList->getLength() : 0; + for( sal_Int16 i=0; i < nAttrCount; i++ ) + { + OUString aAttrName( rAttrList->getNameByIndex( i ) ); + OUString aLocalName; + sal_uInt16 nPrefix = + GetTransformer().GetNamespaceMap().GetKeyByAttrName( aAttrName, + &aLocalName ); + if( XML_NAMESPACE_XLINK == nPrefix && + IsXMLToken( aLocalName, XML_HREF ) ) + { + OUString sHRef( rAttrList->getValueByIndex( i ) ); + if (sHRef.getLength() == 0) + { + // When the href is empty then the object is not linked but + // a placeholder. + return sal_False; + } + GetTransformer().ConvertURIToOOo( sHRef, sal_True ); + return !(sHRef.getLength() && '#'==sHRef[0]); + } + } + + return sal_False; +} + + +XMLFrameOASISTransformerContext::XMLFrameOASISTransformerContext( + XMLTransformerBase& rImp, + const OUString& rQName ) : + XMLTransformerContext( rImp, rQName ), + m_bIgnoreElement( false ) +{ +} + +XMLFrameOASISTransformerContext::~XMLFrameOASISTransformerContext() +{ +} + +void XMLFrameOASISTransformerContext::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + m_xAttrList = new XMLMutableAttributeList( rAttrList, sal_True ); + + sal_Int16 nAttrCount = rAttrList.is() ? rAttrList->getLength() : 0; + for( sal_Int16 i=0; i < nAttrCount; i++ ) + { + const OUString& rAttrName = rAttrList->getNameByIndex( i ); + OUString aLocalName; + sal_uInt16 nPrefix = + GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName ); + + if( (nPrefix == XML_NAMESPACE_PRESENTATION) && IsXMLToken( aLocalName, XML_CLASS ) ) + { + const OUString& rAttrValue = rAttrList->getValueByIndex( i ); + if( IsXMLToken( rAttrValue, XML_HEADER ) || IsXMLToken( rAttrValue, XML_FOOTER ) || + IsXMLToken( rAttrValue, XML_PAGE_NUMBER ) || IsXMLToken( rAttrValue, XML_DATE_TIME ) ) + { + m_bIgnoreElement = true; + break; + } + } + } +} + +XMLTransformerContext *XMLFrameOASISTransformerContext::CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const Reference< XAttributeList >& rAttrList ) +{ + XMLTransformerContext *pContext = 0; + + if( m_bIgnoreElement ) + { + // do not export the frame element and all of its children + pContext = new XMLIgnoreTransformerContext( GetTransformer(), + rQName, + sal_True, sal_True ); + } + else + { + XMLTransformerActions *pActions = + GetTransformer().GetUserDefinedActions( OASIS_FRAME_ELEM_ACTIONS ); + OSL_ENSURE( pActions, "go no actions" ); + XMLTransformerActions::key_type aKey( nPrefix, rLocalName ); + XMLTransformerActions::const_iterator aIter = pActions->find( aKey ); + + if( !(aIter == pActions->end()) ) + { + switch( (*aIter).second.m_nActionType ) + { + case XML_ETACTION_COPY: + if( !m_aElemQName.getLength() && + !IsLinkedEmbeddedObject( rLocalName, rAttrList ) ) + { + pContext = new XMLIgnoreTransformerContext( GetTransformer(), + rQName, + sal_False, sal_False ); + m_aElemQName = rQName; + static_cast< XMLMutableAttributeList * >( m_xAttrList.get() ) + ->AppendAttributeList( rAttrList ); + GetTransformer().ProcessAttrList( m_xAttrList, + OASIS_SHAPE_ACTIONS, + sal_False ); + GetTransformer().GetDocHandler()->startElement( m_aElemQName, + m_xAttrList ); + } + else + { + pContext = new XMLIgnoreTransformerContext( GetTransformer(), + rQName, + sal_True, sal_True ); + } + break; + default: + OSL_ENSURE( !this, "unknown action" ); + break; + } + } + } + + // default is copying + if( !pContext ) + pContext = XMLTransformerContext::CreateChildContext( nPrefix, + rLocalName, + rQName, + rAttrList ); + + return pContext; +} + +void XMLFrameOASISTransformerContext::EndElement() +{ + if( !m_bIgnoreElement ) + GetTransformer().GetDocHandler()->endElement( m_aElemQName ); +} + +void XMLFrameOASISTransformerContext::Characters( const OUString& rChars ) +{ + // ignore + if( m_aElemQName.getLength() && !m_bIgnoreElement ) + XMLTransformerContext::Characters( rChars ); +} diff --git a/xmloff/source/transform/FrameOASISTContext.hxx b/xmloff/source/transform/FrameOASISTContext.hxx new file mode 100644 index 000000000000..9a7824da7026 --- /dev/null +++ b/xmloff/source/transform/FrameOASISTContext.hxx @@ -0,0 +1,68 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_FRAMEOASISTCONTEXT_HXX +#define _XMLOFF_FRAMEOASISTCONTEXT_HXX + +#include "TransformerContext.hxx" + +class XMLFrameOASISTransformerContext : public XMLTransformerContext +{ + ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > m_xAttrList; + + ::rtl::OUString m_aElemQName; + + bool m_bIgnoreElement; + + sal_Bool IsLinkedEmbeddedObject( + const ::rtl::OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList >& rAttrList ); + +public: + TYPEINFO(); + + XMLFrameOASISTransformerContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName ); + + virtual ~XMLFrameOASISTransformerContext(); + + virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix, + const ::rtl::OUString& rLocalName, + const ::rtl::OUString& rQName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + virtual void EndElement(); + + virtual void Characters( const ::rtl::OUString& rChars ); +}; + +#endif // _XMLOFF_FRAMEOASISTCONTEXT_HXX + diff --git a/xmloff/source/transform/FrameOOoTContext.cxx b/xmloff/source/transform/FrameOOoTContext.cxx new file mode 100644 index 000000000000..b36d0c29f258 --- /dev/null +++ b/xmloff/source/transform/FrameOOoTContext.cxx @@ -0,0 +1,174 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" +#include "FrameOOoTContext.hxx" +#include "IgnoreTContext.hxx" +#include "MutableAttrList.hxx" +#include "xmloff/xmlnmspe.hxx" +#include <xmloff/nmspmap.hxx> +#include "ActionMapTypesOOo.hxx" +#include "AttrTransformerAction.hxx" +#include "ElemTransformerAction.hxx" +#include "TransformerActions.hxx" +#ifndef _XMLOFF_TRANSFORMERBASE_HXX +#include "TransformerBase.hxx" +#endif + +using ::rtl::OUString; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; +using namespace ::xmloff::token; + +TYPEINIT1( XMLFrameOOoTransformerContext, XMLPersElemContentTContext ); + +XMLFrameOOoTransformerContext::XMLFrameOOoTransformerContext( + XMLTransformerBase& rImp, + const OUString& rQName ) : + XMLPersElemContentTContext( rImp, rQName ), + m_aElemQName( rImp.GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_DRAW, + ::xmloff::token::GetXMLToken( XML_FRAME ) ) ) +{ +} + +XMLFrameOOoTransformerContext::~XMLFrameOOoTransformerContext() +{ +} + +void XMLFrameOOoTransformerContext::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + + XMLTransformerActions *pActions = + GetTransformer().GetUserDefinedActions( OOO_FRAME_ATTR_ACTIONS ); + OSL_ENSURE( pActions, "go no actions" ); + + Reference< XAttributeList > xAttrList( rAttrList ); + XMLMutableAttributeList *pMutableAttrList = + GetTransformer().ProcessAttrList( xAttrList, OOO_SHAPE_ACTIONS, + sal_True ); + if( !pMutableAttrList ) + pMutableAttrList = new XMLMutableAttributeList( rAttrList ); + xAttrList = pMutableAttrList; + + XMLMutableAttributeList *pFrameMutableAttrList = + new XMLMutableAttributeList; + Reference< XAttributeList > xFrameAttrList( pFrameMutableAttrList ); + + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + for( sal_Int16 i=0; i < nAttrCount; i++ ) + { + const OUString& rAttrName = xAttrList->getNameByIndex( i ); + OUString aLocalName; + sal_uInt16 nPrefix = + GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName, + &aLocalName ); + XMLTransformerActions::key_type aKey( nPrefix, aLocalName ); + XMLTransformerActions::const_iterator aIter = + pActions->find( aKey ); + if( !(aIter == pActions->end() ) ) + { + const OUString& rAttrValue = xAttrList->getValueByIndex( i ); + switch( (*aIter).second.m_nActionType ) + { + case XML_ATACTION_MOVE_TO_ELEM: + pFrameMutableAttrList->AddAttribute( rAttrName, rAttrValue ); + pMutableAttrList->RemoveAttributeByIndex( i ); + --i; + --nAttrCount; + break; + default: + OSL_ENSURE( !this, "unknown action" ); + break; + } + } + } + + GetTransformer().GetDocHandler()->startElement( m_aElemQName, + xFrameAttrList ); + XMLTransformerContext::StartElement( xAttrList ); +} + +XMLTransformerContext *XMLFrameOOoTransformerContext::CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const Reference< XAttributeList >& rAttrList ) +{ + XMLTransformerContext *pContext = 0; + + XMLTransformerActions *pActions = + GetTransformer().GetUserDefinedActions( OOO_FRAME_ELEM_ACTIONS ); + OSL_ENSURE( pActions, "go no actions" ); + XMLTransformerActions::key_type aKey( nPrefix, rLocalName ); + XMLTransformerActions::const_iterator aIter = pActions->find( aKey ); + + if( !(aIter == pActions->end()) ) + { + switch( (*aIter).second.m_nActionType ) + { + case XML_ETACTION_COPY: + case XML_ETACTION_COPY_TEXT: + case XML_ETACTION_RENAME_ELEM: + // the ones in the list have to be persistent + + pContext = XMLPersElemContentTContext::CreateChildContext( + nPrefix, rLocalName, rQName, rAttrList ); + break; + default: + OSL_ENSURE( !this, "unknown action" ); + break; + } + } + + // default is copying + if( !pContext ) + pContext = XMLTransformerContext::CreateChildContext( + nPrefix, rLocalName, rQName, rAttrList ); + + return pContext; +} + +void XMLFrameOOoTransformerContext::EndElement() +{ + XMLTransformerContext::EndElement(); + ExportContent(); + GetTransformer().GetDocHandler()->endElement( m_aElemQName ); +} + +void XMLFrameOOoTransformerContext::Characters( const OUString& rChars ) +{ + XMLTransformerContext::Characters( rChars ); +} + +sal_Bool XMLFrameOOoTransformerContext::IsPersistent() const +{ + // this context stores some of its child elements, but is not persistent + // itself. + return sal_False; +} diff --git a/xmloff/source/transform/FrameOOoTContext.hxx b/xmloff/source/transform/FrameOOoTContext.hxx new file mode 100644 index 000000000000..97ccdcd78812 --- /dev/null +++ b/xmloff/source/transform/FrameOOoTContext.hxx @@ -0,0 +1,60 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_FRAMEOOOTCONTEXT_HXX +#define _XMLOFF_FRAMEOOOTCONTEXT_HXX + +#include "DeepTContext.hxx" + +class XMLFrameOOoTransformerContext : public XMLPersElemContentTContext +{ + ::rtl::OUString m_aElemQName; + +public: + TYPEINFO(); + + XMLFrameOOoTransformerContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName ); + + virtual ~XMLFrameOOoTransformerContext(); + + virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix, + const ::rtl::OUString& rLocalName, + const ::rtl::OUString& rQName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + virtual void EndElement(); + + virtual void Characters( const ::rtl::OUString& rChars ); + + virtual sal_Bool IsPersistent() const; +}; + +#endif // _XMLOFF_FRAMEOOOTCONTEXT_HXX + diff --git a/xmloff/source/transform/IgnoreTContext.cxx b/xmloff/source/transform/IgnoreTContext.cxx new file mode 100644 index 000000000000..7583338891f5 --- /dev/null +++ b/xmloff/source/transform/IgnoreTContext.cxx @@ -0,0 +1,109 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" +#include "IgnoreTContext.hxx" +#ifndef _XMLOFF_TRANSFORMERBASE_HXX +#include "TransformerBase.hxx" +#endif + +using ::rtl::OUString; + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; + +TYPEINIT1( XMLIgnoreTransformerContext, XMLTransformerContext ); + +XMLIgnoreTransformerContext::XMLIgnoreTransformerContext( + XMLTransformerBase& rImp, + const OUString& rQName, + sal_Bool bIgnoreChars, + sal_Bool bIgnoreElems ) : + XMLTransformerContext( rImp, rQName ), + m_bIgnoreCharacters( bIgnoreChars ), + m_bIgnoreElements( bIgnoreElems ), + m_bRecursiveUse( sal_False ) +{ +} + +XMLIgnoreTransformerContext::XMLIgnoreTransformerContext( + XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName, + sal_Bool bAllowCharactersRecursive ) : + XMLTransformerContext( rTransformer, rQName ), + m_bIgnoreCharacters( sal_False ), + m_bIgnoreElements( sal_False ), + m_bAllowCharactersRecursive( bAllowCharactersRecursive ), + m_bRecursiveUse( sal_True ) +{ +} + +XMLIgnoreTransformerContext::~XMLIgnoreTransformerContext() +{ +} + +XMLTransformerContext *XMLIgnoreTransformerContext::CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const Reference< XAttributeList >& xAttrList ) +{ + XMLTransformerContext *pContext = 0; + if( m_bIgnoreElements ) + pContext = new XMLIgnoreTransformerContext( GetTransformer(), + rQName, sal_True, + sal_True ); + else if (m_bRecursiveUse) + pContext = new XMLIgnoreTransformerContext( GetTransformer(), + rQName, m_bAllowCharactersRecursive ); + else + pContext = XMLTransformerContext::CreateChildContext( + nPrefix, rLocalName, rQName, xAttrList ); + + return pContext; +} + +void XMLIgnoreTransformerContext::StartElement( const Reference< XAttributeList >& ) +{ + // ignore +} + +void XMLIgnoreTransformerContext::EndElement() +{ + // ignore +} + +void XMLIgnoreTransformerContext::Characters( const OUString& rChars ) +{ + if( !m_bIgnoreCharacters ) + GetTransformer().GetDocHandler()->characters( rChars ); + else if ( m_bRecursiveUse && m_bAllowCharactersRecursive ) + GetTransformer().GetDocHandler()->characters( rChars ); +} + + diff --git a/xmloff/source/transform/IgnoreTContext.hxx b/xmloff/source/transform/IgnoreTContext.hxx new file mode 100644 index 000000000000..71651b8b8747 --- /dev/null +++ b/xmloff/source/transform/IgnoreTContext.hxx @@ -0,0 +1,89 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_IGNORETCONTEXT_HXX +#define _XMLOFF_IGNORETCONTEXT_HXX + +#include "TransformerContext.hxx" + + +class XMLIgnoreTransformerContext : public XMLTransformerContext +{ + sal_Bool m_bIgnoreCharacters; + sal_Bool m_bIgnoreElements; + sal_Bool m_bAllowCharactersRecursive; + sal_Bool m_bRecursiveUse; + +public: + TYPEINFO(); + + // A contexts constructor does anything that is required if an element + // starts. Namespace processing has been done already. + // Note that virtual methods cannot be used inside constructors. Use + // StartElement instead if this is required. + XMLIgnoreTransformerContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName, + sal_Bool bIgnoreCharacters, + sal_Bool bIgnoreElements ); + // A contexts constructor does anything that is required if an element + // starts. Namespace processing has been done already. + // Note that virtual methods cannot be used inside constructors. Use + // StartElement instead if this is required. + XMLIgnoreTransformerContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName, + sal_Bool bAllowCharactersRecursive ); + + // A contexts destructor does anything that is required if an element + // ends. By default, nothing is done. + // Note that virtual methods cannot be used inside destructors. Use + // EndElement instead if this is required. + virtual ~XMLIgnoreTransformerContext(); + + // Create a childs element context. By default, the import's + // CreateContext method is called to create a new default context. + virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix, + const ::rtl::OUString& rLocalName, + const ::rtl::OUString& rQName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + // StartElement is called after a context has been constructed and + // before a elements context is parsed. It may be used for actions that + // require virtual methods. The default is to do nothing. + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + // EndElement is called before a context will be destructed, but + // after a elements context has been parsed. It may be used for actions + // that require virtual methods. The default is to do nothing. + virtual void EndElement(); + + // This method is called for all characters that are contained in the + // current element. The default is to ignore them. + virtual void Characters( const ::rtl::OUString& rChars ); +}; + +#endif // _XMLOFF_IGNORETCONTEXT_HXX + diff --git a/xmloff/source/transform/MergeElemTContext.cxx b/xmloff/source/transform/MergeElemTContext.cxx new file mode 100644 index 000000000000..a88194952499 --- /dev/null +++ b/xmloff/source/transform/MergeElemTContext.cxx @@ -0,0 +1,346 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" +#include "MergeElemTContext.hxx" +#include "MutableAttrList.hxx" +#ifndef _XMLOFF_TRANSFORMERBASE_HXX +#include "TransformerBase.hxx" +#endif +#include "TransformerActions.hxx" +#include "AttrTransformerAction.hxx" +#include "ElemTransformerAction.hxx" +#include "IgnoreTContext.hxx" +#include "xmloff/xmlnmspe.hxx" + +using ::rtl::OUString; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; +using namespace ::xmloff::token; + +class XMLParagraphTransformerContext : public XMLTransformerContext +{ +public: + TYPEINFO(); + + XMLParagraphTransformerContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName ); + + virtual ~XMLParagraphTransformerContext(); + + // Create a childs element context. By default, the import's + // CreateContext method is called to create a new default context. + virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix, + const ::rtl::OUString& rLocalName, + const ::rtl::OUString& rQName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + // StartElement is called after a context has been constructed and + // before a elements context is parsed. It may be used for actions that + // require virtual methods. The default is to do nothing. + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + // EndElement is called before a context will be destructed, but + // after a elements context has been parsed. It may be used for actions + // that require virtual methods. The default is to do nothing. + virtual void EndElement(); + + // This method is called for all characters that are contained in the + // current element. The default is to ignore them. + virtual void Characters( const ::rtl::OUString& rChars ); +}; + +TYPEINIT1( XMLParagraphTransformerContext, XMLTransformerContext ); + +XMLParagraphTransformerContext::XMLParagraphTransformerContext( + XMLTransformerBase& rImp, + const OUString& rQName ) : + XMLTransformerContext( rImp, rQName ) +{ +} + +XMLParagraphTransformerContext::~XMLParagraphTransformerContext() +{ +} + +XMLTransformerContext *XMLParagraphTransformerContext::CreateChildContext( + sal_uInt16 /*nPrefix*/, + const OUString& /*rLocalName*/, + const OUString& rQName, + const Reference< XAttributeList >& ) +{ + XMLTransformerContext *pContext = 0; + + pContext = new XMLIgnoreTransformerContext( GetTransformer(), + rQName, sal_True ); + + return pContext; +} + +void XMLParagraphTransformerContext::StartElement( const Reference< XAttributeList >& rAttrList ) +{ + XMLTransformerContext::StartElement( rAttrList ); +} + +void XMLParagraphTransformerContext::EndElement() +{ + XMLTransformerContext::EndElement(); +} + +void XMLParagraphTransformerContext::Characters( const OUString& rChars ) +{ + XMLTransformerContext::Characters( rChars ); +} + +class XMLPersTextContentRNGTransformTContext : public XMLPersTextContentTContext +{ +public: + TYPEINFO(); + + XMLPersTextContentRNGTransformTContext( + XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken ); + virtual ~XMLPersTextContentRNGTransformTContext(); + + virtual void Characters( const ::rtl::OUString& rChars ); +}; + +TYPEINIT1( XMLPersTextContentRNGTransformTContext, XMLPersAttrListTContext ); + +XMLPersTextContentRNGTransformTContext::XMLPersTextContentRNGTransformTContext( + XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken ) : + XMLPersTextContentTContext( + rTransformer, rQName, nPrefix, eToken ) +{} + +XMLPersTextContentRNGTransformTContext::~XMLPersTextContentRNGTransformTContext() +{} + +void XMLPersTextContentRNGTransformTContext::Characters( const ::rtl::OUString& rChars ) +{ + OUString aConvChars( rChars ); + GetTransformer().ConvertRNGDateTimeToISO( aConvChars ); + XMLPersTextContentTContext::Characters( aConvChars ); +} + + +TYPEINIT1( XMLMergeElemTransformerContext, XMLTransformerContext ); + +void XMLMergeElemTransformerContext::ExportStartElement() +{ + XMLPersTextContentTContextVector::iterator aIter = m_aChildContexts.begin(); + + for( ; aIter != m_aChildContexts.end(); ++aIter ) + { + XMLPersTextContentTContext *pContext = (*aIter).get(); + static_cast< XMLMutableAttributeList * >( m_xAttrList.get() ) + ->AddAttribute( pContext->GetExportQName(), + pContext->GetTextContent() ); + } + XMLTransformerContext::StartElement( m_xAttrList ); + + m_bStartElementExported = sal_True; +} + +XMLMergeElemTransformerContext::XMLMergeElemTransformerContext( + XMLTransformerBase& rImp, + const OUString& rQName, + sal_uInt16 nActionMap ) : + XMLTransformerContext( rImp, rQName ), + m_nActionMap( nActionMap ), + m_bStartElementExported( sal_False ) +{ +} + +XMLMergeElemTransformerContext::~XMLMergeElemTransformerContext() +{ +} + +void XMLMergeElemTransformerContext::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + XMLMutableAttributeList *pMutableAttrList = + new XMLMutableAttributeList( rAttrList, sal_True ); + m_xAttrList = pMutableAttrList; + + sal_Int16 nAttrCount = m_xAttrList.is() ? m_xAttrList->getLength() : 0; + for( sal_Int16 i=0; i < nAttrCount; i++ ) + { + const OUString& rAttrName = m_xAttrList->getNameByIndex( i ); + OUString aLocalName; + sal_uInt16 nPrefix = + GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName, + &aLocalName ); + sal_Bool bRemove = sal_True; + if( XML_NAMESPACE_OFFICE == nPrefix) + { + if (IsXMLToken( aLocalName, XML_DISPLAY ) ) + bRemove = sal_False; + else if (IsXMLToken( aLocalName, XML_AUTHOR ) ) + bRemove = sal_False; + else if (IsXMLToken( aLocalName, XML_CREATE_DATE ) ) + bRemove = sal_False; + else if (IsXMLToken( aLocalName, XML_CREATE_DATE_STRING ) ) + bRemove = sal_False; + } + if (bRemove) + { + pMutableAttrList->RemoveAttributeByIndex( i ); + --i; + --nAttrCount; + } + } +} + +XMLTransformerContext *XMLMergeElemTransformerContext::CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const Reference< XAttributeList >& rAttrList ) +{ + XMLTransformerContext *pContext = 0; + + if( !m_bStartElementExported ) + { + XMLTransformerActions *pActions = + GetTransformer().GetUserDefinedActions( m_nActionMap ); + OSL_ENSURE( pActions, "go no actions" ); + if( pActions ) + { + XMLTransformerActions::key_type aKey( nPrefix, rLocalName ); + XMLTransformerActions::const_iterator aIter = + pActions->find( aKey ); + + if( !(aIter == pActions->end()) ) + { + switch( (*aIter).second.m_nActionType ) + { + case XML_ATACTION_MOVE_FROM_ELEM_RNG2ISO_DATETIME: + { + XMLPersTextContentTContext *pTC = + new XMLPersTextContentRNGTransformTContext( + GetTransformer(), rQName, + (*aIter).second.GetQNamePrefixFromParam1(), + (*aIter).second.GetQNameTokenFromParam1() ); + XMLPersTextContentTContextVector::value_type aVal(pTC); + m_aChildContexts.push_back( aVal ); + pContext = pTC; + } + break; + case XML_ATACTION_MOVE_FROM_ELEM: + { + XMLPersTextContentTContext *pTC = + new XMLPersTextContentTContext( + GetTransformer(), rQName, + (*aIter).second.GetQNamePrefixFromParam1(), + (*aIter).second.GetQNameTokenFromParam1() ); + XMLPersTextContentTContextVector::value_type aVal(pTC); + m_aChildContexts.push_back( aVal ); + pContext = pTC; + } + break; + case XML_ETACTION_EXTRACT_CHARACTERS: + { + if( !m_bStartElementExported ) + ExportStartElement(); + XMLParagraphTransformerContext* pPTC = + new XMLParagraphTransformerContext( GetTransformer(), + rQName); + pContext = pPTC; + } + break; + default: + OSL_ENSURE( !this, "unknown action" ); + break; + } + } + } + } + else + { + XMLTransformerActions *pActions = + GetTransformer().GetUserDefinedActions( m_nActionMap ); + OSL_ENSURE( pActions, "go no actions" ); + if( pActions ) + { + XMLTransformerActions::key_type aKey( nPrefix, rLocalName ); + XMLTransformerActions::const_iterator aIter = + pActions->find( aKey ); + + if( !(aIter == pActions->end()) ) + { + switch( (*aIter).second.m_nActionType ) + { + case XML_ETACTION_EXTRACT_CHARACTERS: + { + if( !m_bStartElementExported ) + ExportStartElement(); + XMLParagraphTransformerContext* pPTC = + new XMLParagraphTransformerContext( GetTransformer(), + rQName); + pContext = pPTC; + } + break; + default: + OSL_ENSURE( !this, "unknown action" ); + break; + } + } + } + } + + // default is copying + if( !pContext ) + { + if( !m_bStartElementExported ) + ExportStartElement(); + pContext = XMLTransformerContext::CreateChildContext( nPrefix, + rLocalName, + rQName, + rAttrList ); + } + + return pContext; +} + +void XMLMergeElemTransformerContext::EndElement() +{ + if( !m_bStartElementExported ) + ExportStartElement(); + XMLTransformerContext::EndElement(); +} + +void XMLMergeElemTransformerContext::Characters( const OUString& ) +{ + // ignore +} diff --git a/xmloff/source/transform/MergeElemTContext.hxx b/xmloff/source/transform/MergeElemTContext.hxx new file mode 100644 index 000000000000..6911591a5c90 --- /dev/null +++ b/xmloff/source/transform/MergeElemTContext.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_MERGEELEMTCONTEXT_HXX +#define _XMLOFF_MERGEELEMTCONTEXT_HXX + +#include <rtl/ref.hxx> +#include "FlatTContext.hxx" +#include <vector> + +typedef ::std::vector< ::rtl::Reference< XMLPersTextContentTContext> > + XMLPersTextContentTContextVector; + +class XMLMergeElemTransformerContext : public XMLTransformerContext +{ + ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > m_xAttrList; + XMLPersTextContentTContextVector m_aChildContexts; + sal_uInt16 m_nActionMap; + sal_Bool m_bStartElementExported; + + void ExportStartElement(); + +public: + TYPEINFO(); + + XMLMergeElemTransformerContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName, + sal_uInt16 nActionMap ); + + virtual ~XMLMergeElemTransformerContext(); + + virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix, + const ::rtl::OUString& rLocalName, + const ::rtl::OUString& rQName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + virtual void EndElement(); + + virtual void Characters( const ::rtl::OUString& rChars ); +}; + +#endif // _XMLOFF_MERGEELEMCONTEXT_HXX + diff --git a/xmloff/source/transform/MetaTContext.cxx b/xmloff/source/transform/MetaTContext.cxx new file mode 100644 index 000000000000..e05312cb3413 --- /dev/null +++ b/xmloff/source/transform/MetaTContext.cxx @@ -0,0 +1,146 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" +#include <com/sun/star/xml/sax/SAXParseException.hpp> +#include <com/sun/star/xml/sax/SAXException.hpp> +#include <com/sun/star/xml/sax/XDocumentHandler.hpp> +#include <com/sun/star/xml/sax/XAttributeList.hpp> +#include <xmloff/nmspmap.hxx> +#include <xmloff/xmltoken.hxx> +#include "xmloff/xmlnmspe.hxx" + +#ifndef _XMLOFF_TRANSFOERMERBASE_HXX +#include "TransformerBase.hxx" +#endif +#include "MutableAttrList.hxx" +#include "MetaTContext.hxx" + +using ::rtl::OUString; +using namespace ::xmloff::token; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; + +XMLTokenEnum aMetaTokens[] = +{ + XML_GENERATOR, + XML_TITLE, + XML_DESCRIPTION, + XML_SUBJECT, + XML_INITIAL_CREATOR, + XML_CREATION_DATE, + XML_CREATOR, + XML_DATE, + XML_PRINTED_BY, + XML_PRINT_DATE, + XML_KEYWORD, + XML_LANGUAGE, + XML_EDITING_CYCLES, + XML_EDITING_DURATION, + XML_HYPERLINK_BEHAVIOUR, + XML_AUTO_RELOAD, + XML_TEMPLATE, + XML_USER_DEFINED, + XML_DOCUMENT_STATISTIC, + XML_TOKEN_END +}; + +TYPEINIT1( XMLMetaTransformerContext, XMLTransformerContext ); + +XMLMetaTransformerContext::XMLMetaTransformerContext( XMLTransformerBase& rImp, + const OUString& rQName ) : + XMLTransformerContext( rImp, rQName ) +{ +} + +XMLMetaTransformerContext::~XMLMetaTransformerContext() +{ +} + +XMLTransformerContext *XMLMetaTransformerContext::CreateChildContext( + sal_uInt16 /*nPrefix*/, + const OUString& rLocalName, + const OUString& rQName, + const Reference< XAttributeList >& ) +{ + XMLPersTextContentTContext *pContext = + new XMLPersTextContentTContext( GetTransformer(), rQName ); + XMLMetaContexts_Impl::value_type aVal( rLocalName, pContext ); + m_aContexts.insert( aVal ); + + return pContext; +} + +void XMLMetaTransformerContext::EndElement() +{ + // export everything in the correct order + OUString aKeywordsQName; + XMLTokenEnum *pToken = aMetaTokens; + while( *pToken != XML_TOKEN_END ) + { + const OUString& rToken = GetXMLToken( *pToken ); + XMLMetaContexts_Impl::const_iterator aIter = + m_aContexts.find( rToken ); + if( aIter != m_aContexts.end() ) + { + if( XML_KEYWORD == *pToken ) + { + aKeywordsQName = + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_META, GetXMLToken(XML_KEYWORDS ) ); + + Reference< XAttributeList > xAttrList = + new XMLMutableAttributeList; + GetTransformer().GetDocHandler()->startElement( aKeywordsQName, + xAttrList ); + } + + // All elements may occur multiple times + XMLMetaContexts_Impl::const_iterator aEndIter = + m_aContexts.upper_bound( rToken ); + while( aIter != aEndIter ) + { + (*aIter).second->Export(); + ++aIter; + } + + if( XML_KEYWORD == *pToken ) + GetTransformer().GetDocHandler()->endElement( aKeywordsQName ); + } + pToken++; + } + + GetTransformer().GetDocHandler()->endElement( GetQName() ); +} + +void XMLMetaTransformerContext::Characters( const OUString& ) +{ + // ignore them +} + + diff --git a/xmloff/source/transform/MetaTContext.hxx b/xmloff/source/transform/MetaTContext.hxx new file mode 100644 index 000000000000..5af650cb50b7 --- /dev/null +++ b/xmloff/source/transform/MetaTContext.hxx @@ -0,0 +1,83 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_METATCONTEXT_HXX +#define _XMLOFF_METATCONTEXT_HXX + +#include <rtl/ref.hxx> +#include "xmloff/functional.hxx" + +#include <map> + +#ifndef _XMLOFF_FLATTRCONTEXT_HXX +#include "FlatTContext.hxx" +#endif + +typedef ::std::multimap< ::rtl::OUString, + ::rtl::Reference< XMLPersTextContentTContext >, + less_functor > XMLMetaContexts_Impl; + + +class XMLMetaTransformerContext : public XMLTransformerContext +{ + XMLMetaContexts_Impl m_aContexts; + +public: + TYPEINFO(); + + // A contexts constructor does anything that is required if an element + // starts. Namespace processing has been done already. + // Note that virtual methods cannot be used inside constructors. Use + // StartElement instead if this is required. + XMLMetaTransformerContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName ); + + // A contexts destructor does anything that is required if an element + // ends. By default, nothing is done. + // Note that virtual methods cannot be used inside destructors. Use + // EndElement instead if this is required. + virtual ~XMLMetaTransformerContext(); + + // Create a childs element context. By default, the import's + // CreateContext method is called to create a new default context. + virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix, + const ::rtl::OUString& rLocalName, + const ::rtl::OUString& rQName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + // EndElement is called before a context will be destructed, but + // after a elements context has been parsed. It may be used for actions + // that require virtual methods. The default is to do nothing. + virtual void EndElement(); + + // This method is called for all characters that are contained in the + // current element. The default is to ignore them. + virtual void Characters( const ::rtl::OUString& rChars ); +}; + +#endif // _XMLOFF_METATCONTEXT_HXX + diff --git a/xmloff/source/transform/MutableAttrList.cxx b/xmloff/source/transform/MutableAttrList.cxx new file mode 100644 index 000000000000..b9f607a7c443 --- /dev/null +++ b/xmloff/source/transform/MutableAttrList.cxx @@ -0,0 +1,203 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" +#include <osl/mutex.hxx> +#include <xmloff/xmltoken.hxx> +#include <rtl/uuid.h> +#include <rtl/memory.h> +#include <xmloff/attrlist.hxx> +#include "MutableAttrList.hxx" + +using ::rtl::OUString; + +using namespace ::osl; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::util; + +SvXMLAttributeList *XMLMutableAttributeList::GetMutableAttrList() +{ + if( !m_pMutableAttrList ) + { + m_pMutableAttrList = new SvXMLAttributeList( m_xAttrList ); + m_xAttrList = m_pMutableAttrList; + } + + return m_pMutableAttrList; +} + +XMLMutableAttributeList::XMLMutableAttributeList() : + m_pMutableAttrList( new SvXMLAttributeList ) +{ + m_xAttrList = m_pMutableAttrList; +} + +XMLMutableAttributeList::XMLMutableAttributeList( const Reference< + XAttributeList> & rAttrList, sal_Bool bClone ) : + m_xAttrList( rAttrList.is() ? rAttrList : new SvXMLAttributeList ), + m_pMutableAttrList( 0 ) +{ + if( bClone ) + GetMutableAttrList(); +} + + +XMLMutableAttributeList::~XMLMutableAttributeList() +{ + m_xAttrList = 0; +} + + +// XUnoTunnel & co +const Sequence< sal_Int8 > & XMLMutableAttributeList::getUnoTunnelId() throw() +{ + static Sequence< sal_Int8 > * pSeq = 0; + if( !pSeq ) + { + Guard< Mutex > aGuard( Mutex::getGlobalMutex() ); + if( !pSeq ) + { + static Sequence< sal_Int8 > aSeq( 16 ); + rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); + pSeq = &aSeq; + } + } + return *pSeq; +} + +// XUnoTunnel +sal_Int64 SAL_CALL XMLMutableAttributeList::getSomething( + const Sequence< sal_Int8 >& rId ) + throw( RuntimeException ) +{ + if( rId.getLength() == 16 && + 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), + rId.getConstArray(), 16 ) ) + { + return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this)); + } + return 0; +} + +sal_Int16 SAL_CALL XMLMutableAttributeList::getLength(void) + throw( RuntimeException ) +{ + return m_xAttrList->getLength(); +} + + +OUString SAL_CALL XMLMutableAttributeList::getNameByIndex(sal_Int16 i) + throw( RuntimeException ) +{ + return m_xAttrList->getNameByIndex( i ); +} + + +OUString SAL_CALL XMLMutableAttributeList::getTypeByIndex(sal_Int16 i) + throw( RuntimeException ) +{ + return m_xAttrList->getTypeByIndex( i ); +} + +OUString SAL_CALL XMLMutableAttributeList::getValueByIndex(sal_Int16 i) + throw( RuntimeException ) +{ + return m_xAttrList->getValueByIndex( i ); +} + +OUString SAL_CALL XMLMutableAttributeList::getTypeByName( + const OUString& rName ) + throw( RuntimeException ) +{ + return m_xAttrList->getTypeByName( rName ); +} + +OUString SAL_CALL XMLMutableAttributeList::getValueByName( + const OUString& rName) + throw( RuntimeException ) +{ + return m_xAttrList->getValueByName( rName ); +} + + +Reference< XCloneable > XMLMutableAttributeList::createClone() + throw( RuntimeException ) +{ + // A cloned list will be a read only list! + Reference< XCloneable > r = new SvXMLAttributeList( m_xAttrList ); + return r; +} + +void XMLMutableAttributeList::SetValueByIndex( sal_Int16 i, + const ::rtl::OUString& rValue ) +{ + GetMutableAttrList()->SetValueByIndex( i, rValue ); +} + +void XMLMutableAttributeList::AddAttribute( const OUString &rName , + const OUString &rValue ) +{ + GetMutableAttrList()->AddAttribute( rName, rValue ); +} + +void XMLMutableAttributeList::RemoveAttributeByIndex( sal_Int16 i ) +{ + GetMutableAttrList()->RemoveAttributeByIndex( i ); +} + +void XMLMutableAttributeList::RenameAttributeByIndex( sal_Int16 i, + const OUString& rNewName ) +{ + GetMutableAttrList()->RenameAttributeByIndex( i, rNewName ); +} + +void XMLMutableAttributeList::AppendAttributeList( + const Reference< ::com::sun::star::xml::sax::XAttributeList >& r ) +{ + GetMutableAttrList()->AppendAttributeList( r ); +} + +sal_Int16 XMLMutableAttributeList::GetIndexByName( const OUString& rName ) const +{ + sal_Int16 nIndex = -1; + if( m_pMutableAttrList ) + { + nIndex = m_pMutableAttrList->GetIndexByName( rName ); + } + else + { + sal_Int16 nCount = m_xAttrList->getLength(); + for( sal_Int16 i=0; nIndex==-1 && i<nCount ; ++i ) + { + if( m_xAttrList->getNameByIndex(i) == rName ) + nIndex = i; + } + } + return nIndex; +} diff --git a/xmloff/source/transform/MutableAttrList.hxx b/xmloff/source/transform/MutableAttrList.hxx new file mode 100644 index 000000000000..7dc734f18ef7 --- /dev/null +++ b/xmloff/source/transform/MutableAttrList.hxx @@ -0,0 +1,87 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_MUTABLEATTRLIST_HXX +#define _XMLOFF_MUTABLEATTRLIST_HXX + +#include <com/sun/star/util/XCloneable.hpp> +#include <com/sun/star/xml/sax/XAttributeList.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> + +#include <cppuhelper/implbase3.hxx> + +class SvXMLAttributeList; + +class XMLMutableAttributeList : public ::cppu::WeakImplHelper3< + ::com::sun::star::xml::sax::XAttributeList, + ::com::sun::star::util::XCloneable, + ::com::sun::star::lang::XUnoTunnel> +{ + ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList> m_xAttrList; + + SvXMLAttributeList *m_pMutableAttrList; + + SvXMLAttributeList *GetMutableAttrList(); + +public: + XMLMutableAttributeList(); + XMLMutableAttributeList( const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList> & rAttrList, + sal_Bool bClone=sal_False ); + ~XMLMutableAttributeList(); + + static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw(); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::xml::sax::XAttributeList + virtual sal_Int16 SAL_CALL getLength(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual ::rtl::OUString SAL_CALL getNameByIndex(sal_Int16 i) throw( ::com::sun::star::uno::RuntimeException ); + virtual ::rtl::OUString SAL_CALL getTypeByIndex(sal_Int16 i) throw( ::com::sun::star::uno::RuntimeException ); + virtual ::rtl::OUString SAL_CALL getTypeByName(const ::rtl::OUString& aName) throw( ::com::sun::star::uno::RuntimeException ); + virtual ::rtl::OUString SAL_CALL getValueByIndex(sal_Int16 i) throw( ::com::sun::star::uno::RuntimeException ); + virtual ::rtl::OUString SAL_CALL getValueByName(const ::rtl::OUString& aName) throw( ::com::sun::star::uno::RuntimeException ); + + // ::com::sun::star::util::XCloneable + virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone() throw( ::com::sun::star::uno::RuntimeException ); + + // methods that are not contained in any interface + void SetValueByIndex( sal_Int16 i, const ::rtl::OUString& rValue ); + void AddAttribute( const ::rtl::OUString &sName , const ::rtl::OUString &sValue ); +// void Clear(); + void RemoveAttributeByIndex( sal_Int16 i ); + void RenameAttributeByIndex( sal_Int16 i, const ::rtl::OUString& rNewName ); +// void SetAttributeList( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & ); + void AppendAttributeList( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & ); + + sal_Int16 GetIndexByName( const ::rtl::OUString& rName ) const; +}; + + +#endif // _XMLOFF_MUTABLEATTRLIST_HXX diff --git a/xmloff/source/transform/NotesTContext.cxx b/xmloff/source/transform/NotesTContext.cxx new file mode 100644 index 000000000000..31ccbdf48c5b --- /dev/null +++ b/xmloff/source/transform/NotesTContext.cxx @@ -0,0 +1,232 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" +#include <com/sun/star/xml/sax/SAXParseException.hpp> +#include <com/sun/star/xml/sax/SAXException.hpp> +#include <com/sun/star/xml/sax/XDocumentHandler.hpp> +#include <com/sun/star/xml/sax/XAttributeList.hpp> +#include <xmloff/nmspmap.hxx> +#include <xmloff/xmltoken.hxx> +#include "xmloff/xmlnmspe.hxx" + +#ifndef _XMLOFF_TRANSFOERMERBASE_HXX +#include "TransformerBase.hxx" +#endif +#include "TransformerActions.hxx" +#include "AttrTransformerAction.hxx" +#include "ActionMapTypesOASIS.hxx" +#include "MutableAttrList.hxx" +#include "RenameElemTContext.hxx" +#include "FlatTContext.hxx" + +#ifndef _XMLOFF_NOTESCONTEXT_HXX +#include "NotesTContext.hxx" +#endif + +using ::rtl::OUString; +using namespace ::xmloff::token; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; + +TYPEINIT1( XMLNotesTransformerContext, XMLPersElemContentTContext ); + +XMLNotesTransformerContext::XMLNotesTransformerContext( + XMLTransformerBase& rImp, + const OUString& rQName, + XMLTokenEnum eToken, sal_Bool bPersistent ) : + XMLPersElemContentTContext( rImp, rQName ), + m_bEndNote( sal_False ), + m_bPersistent( bPersistent ), + m_eTypeToken( eToken ) +{ +} + +XMLNotesTransformerContext::~XMLNotesTransformerContext() +{ +} + +void XMLNotesTransformerContext::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + XMLTransformerActions *pActions = + GetTransformer().GetUserDefinedActions( OASIS_NOTES_ACTIONS ); + OSL_ENSURE( pActions, "go no actions" ); + + Reference< XAttributeList > xAttrList( rAttrList ); + XMLMutableAttributeList *pMutableAttrList = 0; + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + for( sal_Int16 i=0; i < nAttrCount; i++ ) + { + const OUString& rAttrName = xAttrList->getNameByIndex( i ); + OUString aLocalName; + sal_uInt16 nPrefix = + GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName, + &aLocalName ); + XMLTransformerActions::key_type aKey( nPrefix, aLocalName ); + XMLTransformerActions::const_iterator aIter = + pActions->find( aKey ); + if( !(aIter == pActions->end() ) ) + { + const OUString& rAttrValue = xAttrList->getValueByIndex( i ); + + if( !pMutableAttrList ) + { + pMutableAttrList = + new XMLMutableAttributeList( xAttrList ); + xAttrList = pMutableAttrList; + } + switch( (*aIter).second.m_nActionType ) + { + case XML_ATACTION_STYLE_FAMILY: + { + if( IsXMLToken( rAttrValue, XML_FOOTNOTE ) ) + { + } + else if( IsXMLToken( rAttrValue, XML_ENDNOTE ) ) + { + m_bEndNote = sal_True; + } + pMutableAttrList->RemoveAttributeByIndex( i ); + --i; + --nAttrCount; + } + break; + case XML_ATACTION_DECODE_STYLE_NAME: + case XML_ATACTION_DECODE_STYLE_NAME_REF: + { + OUString aAttrValue( rAttrValue ); + if( GetTransformer().DecodeStyleName(aAttrValue) ) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + } + } + } + + XMLTokenEnum eToken = XML_FOOTNOTE; + switch( m_eTypeToken ) + { + case XML_NOTE: + eToken = (m_bEndNote ? XML_ENDNOTE : XML_FOOTNOTE); + break; + case XML_NOTES_CONFIGURATION: + eToken = (m_bEndNote ? XML_ENDNOTES_CONFIGURATION + : XML_FOOTNOTES_CONFIGURATION); + break; + case XML_NOTE_REF: + eToken = (m_bEndNote ? XML_ENDNOTE_REF : XML_FOOTNOTE_REF); + break; + default: + OSL_ENSURE( XML_NOTE==m_eTypeToken, "invalid note type" ); + break; + } + + SetExportQName( GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_TEXT, + ::xmloff::token::GetXMLToken( eToken ) ) ); + if( m_bPersistent ) + XMLPersElemContentTContext::StartElement( xAttrList ); + else + GetTransformer().GetDocHandler()->startElement( GetExportQName(), + xAttrList ); +} + +void XMLNotesTransformerContext::EndElement() +{ + if( m_bPersistent ) + { + XMLPersElemContentTContext::EndElement(); + } + else + { + GetTransformer().GetDocHandler()->endElement( GetExportQName() ); + } +} + +XMLTransformerContext *XMLNotesTransformerContext::CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const Reference< XAttributeList >& rAttrList ) +{ + XMLTransformerContext *pContext = 0; + if( XML_NOTE == m_eTypeToken ) + { + if( XML_NAMESPACE_TEXT == nPrefix ) + { + XMLTokenEnum eToken ( XML_TOKEN_INVALID ); + if( IsXMLToken( rLocalName, XML_NOTE_CITATION ) ) + { + eToken = m_bEndNote ? XML_ENDNOTE_CITATION + : XML_FOOTNOTE_CITATION; + } + else if( IsXMLToken( rLocalName, XML_NOTE_BODY ) ) + { + eToken = m_bEndNote ? XML_ENDNOTE_BODY + : XML_FOOTNOTE_BODY; + } + + if( XML_TOKEN_INVALID != eToken ) + { + if( m_bPersistent ) + { + pContext = new XMLPersTextContentTContext( + GetTransformer(), rQName, + XML_NAMESPACE_TEXT, + eToken ); + AddContent( pContext ); + + } + else + { + pContext = new XMLRenameElemTransformerContext( + GetTransformer(), rQName, + XML_NAMESPACE_TEXT, + eToken ); + } + } + } + } + + if( !pContext ) + { + pContext = m_bPersistent + ? XMLPersElemContentTContext::CreateChildContext( + nPrefix, rLocalName, rQName, rAttrList ) + : XMLTransformerContext::CreateChildContext( + nPrefix, rLocalName, rQName, rAttrList ); + } + + return pContext; +} + +sal_Bool XMLNotesTransformerContext::IsPersistent() const +{ + return m_bPersistent; +} diff --git a/xmloff/source/transform/NotesTContext.hxx b/xmloff/source/transform/NotesTContext.hxx new file mode 100644 index 000000000000..5e2832d8bb2f --- /dev/null +++ b/xmloff/source/transform/NotesTContext.hxx @@ -0,0 +1,61 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_NOTESTCONTEXT_HXX +#define _XMLOFF_NOTESTCONTEXT_HXX + +#include "DeepTContext.hxx" + +class XMLNotesTransformerContext : public XMLPersElemContentTContext +{ + sal_Bool m_bEndNote; + sal_Bool m_bPersistent; + ::xmloff::token::XMLTokenEnum m_eTypeToken; + +public: + TYPEINFO(); + + XMLNotesTransformerContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName, + ::xmloff::token::XMLTokenEnum m_eToken, + sal_Bool bPersistent ); + + virtual ~XMLNotesTransformerContext(); + + virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix, + const ::rtl::OUString& rLocalName, + const ::rtl::OUString& rQName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + virtual void EndElement(); + + virtual sal_Bool IsPersistent() const; +}; + +#endif // _XMLOFF_NOTESTCONTEXT_HXX + diff --git a/xmloff/source/transform/OOo2Oasis.cxx b/xmloff/source/transform/OOo2Oasis.cxx new file mode 100644 index 000000000000..103202c48866 --- /dev/null +++ b/xmloff/source/transform/OOo2Oasis.cxx @@ -0,0 +1,2206 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" +#include <rtl/uuid.h> +#include <rtl/ustrbuf.hxx> +#include <comphelper/processfactory.hxx> +#include <xmloff/nmspmap.hxx> +#include "xmloff/xmlnmspe.hxx" +#include <xmloff/xmltoken.hxx> +#include "MutableAttrList.hxx" +#include "DeepTContext.hxx" +#include "StyleOOoTContext.hxx" +#include "FrameOOoTContext.hxx" +#include "EventOOoTContext.hxx" +#include "ControlOOoTContext.hxx" +#include "FormPropOOoTContext.hxx" +#include "ChartOOoTContext.hxx" +#include "ChartPlotAreaOOoTContext.hxx" +#include "ElemTransformerAction.hxx" +#include "AttrTransformerAction.hxx" +#include "PropertyActionsOOo.hxx" +#include "TransformerActions.hxx" +#include <xmloff/xmluconv.hxx> +#ifndef _XMLOFF_OOO2OOO_HXX +#include "OOo2Oasis.hxx" +#endif + +using ::rtl::OUString; +using namespace ::xmloff::token; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::xml::sax; +using namespace ::com::sun::star::beans; + +OUString SAL_CALL OOo2OasisTransformer_getImplementationName() throw(); + +enum XMLUserDefinedTransformerAction +{ + XML_ETACTION_DOCUMENT=XML_ETACTION_USER_DEFINED, + XML_ETACTION_BODY, + XML_ETACTION_STYLE, + XML_ETACTION_STYLE_RENAME, + XML_ETACTION_FRAME, + XML_ETACTION_EVENT, + XML_ETACTION_TAB_STOP, + XML_ETACTION_FORM_CONTROL, + XML_ETACTION_FORM_PROPERTY, + XML_ETACTION_CHART, + XML_ETACTION_TRACKED_CHANGES, + XML_ETACTION_CHART_PLOT_AREA, + XML_ETACTION_DOCUMENT_RENAME, + XML_ETACTION_TABLE +}; + +#define ENTRY3( n, l, a, p1, p2, p3 ) \ + { XML_NAMESPACE_##n, XML_##l, a, p1, p2, p3 } +#define ENTRY3QQN( n, l, a, n1, l1, n2, l2, p3 ) \ + ENTRY3( n, l, a, XMLTransformerActionInit::QNameParam( n1, l1 ), \ + XMLTransformerActionInit::QNameParam( n2, l2 ), p3 ) + +#define ENTRY2( n, l, a, p1, p2 ) \ + ENTRY3( n, l, a, p1, p2, 0 ) +#define ENTRY2QQ( n, l, a, n1, l1, n2, l2 ) \ + ENTRY2( n, l, a, XMLTransformerActionInit::QNameParam( n1, l1 ), \ + XMLTransformerActionInit::QNameParam( n2, l2 ) ) +#define ENTRY2QN( n, l, a, n1, l1, p2 ) \ + ENTRY2( n, l, a, XMLTransformerActionInit::QNameParam( n1, l1 ), p2 ) + +#define ENTRY1( n, l, a, p1 ) \ + ENTRY3( n, l, a, p1, 0, 0 ) +#define ENTRY1Q( n, l, a, n1, l1 ) \ + ENTRY1( n, l, a, XMLTransformerActionInit::QNameParam( n1, l1 ) ) + +#define ENTRY0( n, l, a ) \ + ENTRY3( n, l, a, 0, 0, 0 ) + +// BM: a macro to put two tokens into one sal_Int32 for the action +// XML_ATACTION_RENAME_ATTRIBUTE +#define RENAME_ENTRY( f, s ) \ + (static_cast< sal_Int32 >(f) | (static_cast< sal_Int32 >(s) << 16)) + +static XMLTransformerActionInit aActionTable[] = +{ + // remove office:class from <office:document> and <office:document-content> + ENTRY0( OFFICE, DOCUMENT, XML_ETACTION_DOCUMENT ), + ENTRY0( OFFICE, DOCUMENT_CONTENT, XML_ETACTION_DOCUMENT ), + ENTRY0( OFFICE, DOCUMENT_STYLES, XML_ETACTION_DOCUMENT ), + ENTRY0( OFFICE, DOCUMENT_SETTINGS, XML_ETACTION_DOCUMENT ), + ENTRY1Q( OFFICE, AUTO_TEXT_EVENTS, XML_ETACTION_DOCUMENT_RENAME, + XML_NAMESPACE_OOO, XML_AUTO_TEXT_EVENTS), + + // remove <meta:keywords> + ENTRY0( META, KEYWORDS, XML_ETACTION_COPY_CONTENT ), + + // rename <office:script> to <office:scripts> + ENTRY1Q( OFFICE, SCRIPT, XML_ETACTION_RENAME_ELEM, + XML_NAMESPACE_OFFICE, XML_SCRIPTS ), + + // rename <office:script-data> to <office:script> and process attributes + ENTRY2QN( OFFICE, SCRIPT_DATA, XML_ETACTION_RENAME_ELEM_PROC_ATTRS, + XML_NAMESPACE_OFFICE, XML_SCRIPT, + OOO_SCRIPT_ACTIONS ), + + // rename <script:libraries> to <ooo:libraries> + ENTRY1Q( SCRIPT, LIBRARIES, XML_ETACTION_RENAME_ELEM, + XML_NAMESPACE_OOO, XML_LIBRARIES ), + + // rename <script:library-linked> to <ooo:library-linked> and process attributes + ENTRY2QN( SCRIPT, LIBRARY_LINKED, XML_ETACTION_RENAME_ELEM_PROC_ATTRS, + XML_NAMESPACE_OOO, XML_LIBRARY_LINKED, + OOO_SCRIPT_ACTIONS ), + + // rename <script:library-embedded> to <ooo:library-embedded> and process attributes + ENTRY2QN( SCRIPT, LIBRARY_EMBEDDED, XML_ETACTION_RENAME_ELEM_PROC_ATTRS, + XML_NAMESPACE_OOO, XML_LIBRARY_EMBEDDED, + OOO_SCRIPT_ACTIONS ), + + // rename <script:module> to <ooo:module> and process attributes + ENTRY2QN( SCRIPT, MODULE, XML_ETACTION_RENAME_ELEM_PROC_ATTRS, + XML_NAMESPACE_OOO, XML_MODULE, + OOO_SCRIPT_ACTIONS ), + + // rename <script:source-code> to <ooo:source-code> + ENTRY1Q( SCRIPT, SOURCE_CODE, XML_ETACTION_RENAME_ELEM, + XML_NAMESPACE_OOO, XML_SOURCE_CODE ), + + // rename <office:font-decls> to <office:font-face-decl>, + // rename <style:font-decl> to <style:font-face>, process attrs + ENTRY1Q( OFFICE, FONT_DECLS, XML_ETACTION_RENAME_ELEM, + XML_NAMESPACE_OFFICE, XML_FONT_FACE_DECLS ), + ENTRY2QN( STYLE, FONT_DECL, XML_ETACTION_RENAME_ELEM_PROC_ATTRS, + XML_NAMESPACE_STYLE, XML_FONT_FACE, + OOO_FONT_DECL_ACTIONS ), + + // add genre element + ENTRY0( OFFICE, BODY, XML_ETACTION_BODY ), + + // rename <style:page-master> to <style:page-layout> + ENTRY2QN( STYLE, PAGE_MASTER, XML_ETACTION_STYLE_RENAME, + XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT, + XML_FAMILY_TYPE_PAGE_LAYOUT ), + ENTRY1( STYLE, MASTER_PAGE, XML_ETACTION_PROC_ATTRS, + OOO_MASTER_PAGE_ACTIONS ), + + // split <style:properties> into <style:*-properties> and do other + // styles processing + ENTRY1( STYLE, STYLE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_END ), + ENTRY1( STYLE, DEFAULT_STYLE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_END ), + ENTRY1( NUMBER, NUMBER_STYLE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_DATA ), + ENTRY1( NUMBER, CURRENCY_STYLE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_DATA ), + ENTRY1( NUMBER, PERCENTAGE_STYLE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_DATA ), + ENTRY1( NUMBER, DATE_STYLE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_DATA ), + ENTRY1( NUMBER, TIME_STYLE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_DATA ), + ENTRY1( NUMBER, BOOLEAN_STYLE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_DATA ), + ENTRY1( NUMBER, TEXT_STYLE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_DATA ), + ENTRY1( TEXT, LIST_STYLE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_LIST ), +// ENTRY0( TEXT, OUTLINE_STYLE, STYLE ), + ENTRY1( STYLE, HEADER_STYLE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_HEADER_FOOTER ), + ENTRY1( STYLE, FOOTER_STYLE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_HEADER_FOOTER ), + ENTRY1( TEXT, LIST_LEVEL_STYLE_NUMBER, XML_ETACTION_STYLE, XML_FAMILY_TYPE_LIST ), + ENTRY1( TEXT, LIST_LEVEL_STYLE_BULLET, XML_ETACTION_STYLE, XML_FAMILY_TYPE_LIST ), + ENTRY1( TEXT, LIST_LEVEL_STYLE_IMAGE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_LIST ), + ENTRY1( TEXT, OUTLINE_LEVEL_STYLE, XML_ETACTION_STYLE, XML_FAMILY_TYPE_LIST ), + ENTRY1( DRAW, GRADIENT, XML_ETACTION_STYLE, + XML_FAMILY_TYPE_GRADIENT ), + ENTRY1( DRAW, FILL_IMAGE, XML_ETACTION_STYLE, + XML_FAMILY_TYPE_FILL_IMAGE ), + ENTRY2QN( DRAW, TRANSPARENCY, XML_ETACTION_STYLE_RENAME, + XML_NAMESPACE_DRAW, XML_OPACITY, + XML_FAMILY_TYPE_GRADIENT ), + ENTRY1( DRAW, MARKER, XML_ETACTION_STYLE, + XML_FAMILY_TYPE_MARKER ), + ENTRY1( DRAW, HATCH, XML_ETACTION_STYLE, + XML_FAMILY_TYPE_HATCH ), + ENTRY1( DRAW, STROKE_DASH, XML_ETACTION_STYLE, + XML_FAMILY_TYPE_STROKE_DASH ), + + // rename <text:h>'s text:level to text:outline-level + // process <text:h/p>: process style-name attributes, + ENTRY1( TEXT, H, XML_ETACTION_PROC_ATTRS, OOO_PARA_ACTIONS ), + ENTRY1( TEXT, P, XML_ETACTION_PROC_ATTRS, OOO_PARA_ACTIONS ), + + // rename <text:ordered-list> and <text:unordered-list> to <text:list> + ENTRY2QN( TEXT, UNORDERED_LIST, XML_ETACTION_RENAME_ELEM_PROC_ATTRS, + XML_NAMESPACE_TEXT, XML_LIST, + OOO_STYLE_REF_ACTIONS ), + ENTRY2QN( TEXT, ORDERED_LIST, XML_ETACTION_RENAME_ELEM_PROC_ATTRS, + XML_NAMESPACE_TEXT, XML_LIST, + OOO_STYLE_REF_ACTIONS ), + + // rename <text:footnote*> to <text:note*> + ENTRY3QQN( TEXT, FOOTNOTE, XML_ETACTION_RENAME_ELEM_ADD_ATTR, + XML_NAMESPACE_TEXT, XML_NOTE, + XML_NAMESPACE_TEXT, XML_NOTE_CLASS, XML_FOOTNOTE ), + ENTRY1Q( TEXT, FOOTNOTE_BODY, XML_ETACTION_RENAME_ELEM, + XML_NAMESPACE_TEXT, XML_NOTE_BODY ), + ENTRY1Q( TEXT, FOOTNOTE_CITATION, XML_ETACTION_RENAME_ELEM, + XML_NAMESPACE_TEXT, XML_NOTE_CITATION ), + ENTRY3QQN( TEXT, FOOTNOTES_CONFIGURATION, + XML_ETACTION_RENAME_ELEM_ADD_PROC_ATTR, + XML_NAMESPACE_TEXT, XML_NOTES_CONFIGURATION, + XML_NAMESPACE_TEXT, XML_NOTE_CLASS, + XML_FOOTNOTE | (OOO_STYLE_REF_ACTIONS << 16) ), + + // rename <text:endnote*> to <text:endnote*> + ENTRY3QQN( TEXT, ENDNOTE, XML_ETACTION_RENAME_ELEM_ADD_ATTR, + XML_NAMESPACE_TEXT, XML_NOTE, + XML_NAMESPACE_TEXT, XML_NOTE_CLASS, XML_ENDNOTE ), + ENTRY1Q( TEXT, ENDNOTE_BODY, XML_ETACTION_RENAME_ELEM, + XML_NAMESPACE_TEXT, XML_NOTE_BODY ), + ENTRY1Q( TEXT, ENDNOTE_CITATION, XML_ETACTION_RENAME_ELEM, + XML_NAMESPACE_TEXT, XML_NOTE_CITATION ), + ENTRY3QQN( TEXT, ENDNOTES_CONFIGURATION, + XML_ETACTION_RENAME_ELEM_ADD_PROC_ATTR, + XML_NAMESPACE_TEXT, XML_NOTES_CONFIGURATION, + XML_NAMESPACE_TEXT, XML_NOTE_CLASS, + XML_ENDNOTE | (OOO_STYLE_REF_ACTIONS << 16) ), + + // rename <text:footnote> and <text:endnote> to <text:note> + ENTRY3QQN( TEXT, ENDNOTE_REF, XML_ETACTION_RENAME_ELEM_ADD_ATTR, + XML_NAMESPACE_TEXT, XML_NOTE_REF, + XML_NAMESPACE_TEXT, XML_NOTE_CLASS, XML_ENDNOTE ), + ENTRY3QQN( TEXT, FOOTNOTE_REF, XML_ETACTION_RENAME_ELEM_ADD_ATTR, + XML_NAMESPACE_TEXT, XML_NOTE_REF, + XML_NAMESPACE_TEXT, XML_NOTE_CLASS, XML_FOOTNOTE ), + + // rename <text:tab-stop> to <text:tab> + ENTRY1Q( TEXT, TAB_STOP, XML_ETACTION_RENAME_ELEM, + XML_NAMESPACE_TEXT, XML_TAB ), + + // replace <table:sub-table> with <table:table table:is-sub-table> + ENTRY3QQN( TABLE, SUB_TABLE, XML_ETACTION_RENAME_ELEM_ADD_ATTR, + XML_NAMESPACE_TABLE, XML_TABLE, + XML_NAMESPACE_TABLE, XML_IS_SUB_TABLE, XML_TRUE ), + + // process *:style-name attributes + ENTRY1( TEXT, SECTION, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, SPAN, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, A, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, RUBY, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, RUBY_TEXT, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, DATE, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, TIME, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, VARIABLE_GET, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, USER_FIELD_GET, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, USER_FIELD_INPUT, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, CREATION_DATE, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, CREATION_TIME, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, PRINT_TIME, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, PRINT_DATE, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, EDITING_DURATION, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, MODIFICATION_TIME, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, MODIFICATION_DATE, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, DATABASE_DISPLAY, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, TABLE_FORMULA, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, INDEX_TITLE, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, TABLE_OF_CONTENT, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, TABLE_OF_CONTENT_ENTRY_TEMPLATE, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, ILLUSTRATION_INDEX, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, ILLUSTRATION_INDEX_ENTRY_TEMPLATE, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, TABLE_INDEX, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, TABLE_INDEX_ENTRY_TEMPLATE, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, OBJECT_INDEX, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, OBJECT_INDEX_ENTRY_TEMPLATE, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, USER_INDEX, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, USER_INDEX_ENTRY_TEMPLATE, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, ALPHABETICAL_INDEX, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, ALPHABETICAL_INDEX_ENTRY_TEMPLATE, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, BIBLIOGRAPHY, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, BIBLIOGRAPHY_ENTRY_TEMPLATE, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, INDEX_SOURCE_STYLE, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, INDEX_TITLE_TEMPLATE, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, INDEX_ENTRY_CHAPTER, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY2QN( TEXT, INDEX_ENTRY_CHAPTER_NUMBER, + XML_ETACTION_RENAME_ELEM_PROC_ATTRS, + XML_NAMESPACE_TEXT, XML_INDEX_ENTRY_CHAPTER, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, INDEX_ENTRY_TEXT, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, INDEX_ENTRY_PAGE_NUMBER, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, INDEX_ENTRY_SPAN, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, INDEX_ENTRY_BIBLIOGRAPHY, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, INDEX_ENTRY_LINK_START, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, INDEX_ENTRY_LINK_END, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( STYLE, HANDOUT_MASTER, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( DRAW, PAGE, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( STYLE, MAP, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( PRESENTATION, NOTES, XML_ETACTION_PROC_ATTRS, + OOO_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( STYLE, PRESENTATION_PAGE_LAYOUT, XML_ETACTION_PROC_ATTRS, + OOO_MASTER_PAGE_ACTIONS ), + // --> OD 2005-01-10 #i40011#, #i40015# + // - consider also attribute table:style-name for <table:table>, + // <table:table-row> and <table:table-column>. +// ENTRY1( TABLE, TABLE, XML_ETACTION_PROC_ATTRS, OOO_STYLE_REF_ACTIONS ), + ENTRY0( TABLE, TABLE, XML_ETACTION_TABLE ), + + ENTRY1( TABLE, TABLE_ROW, XML_ETACTION_PROC_ATTRS, OOO_STYLE_REF_ACTIONS ), + ENTRY1( TABLE, TABLE_COLUMN, XML_ETACTION_PROC_ATTRS, OOO_STYLE_REF_ACTIONS ), + // <-- + + // split frame elements + ENTRY0( DRAW, TEXT_BOX, XML_ETACTION_FRAME ), + ENTRY0( DRAW, IMAGE, XML_ETACTION_FRAME ), + ENTRY0( DRAW, OBJECT, XML_ETACTION_FRAME ), + ENTRY0( DRAW, OBJECT_OLE, XML_ETACTION_FRAME ), + ENTRY0( DRAW, APPLET, XML_ETACTION_FRAME ), + ENTRY0( DRAW, PLUGIN, XML_ETACTION_FRAME ), + ENTRY0( DRAW, FLOATING_FRAME, XML_ETACTION_FRAME ), + ENTRY0( SVG, DESC, XML_ETACTION_COPY_TEXT ), + + // process events + ENTRY1Q( OFFICE, EVENTS, XML_ETACTION_RENAME_ELEM, + XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS ), + ENTRY0( SCRIPT, EVENT, XML_ETACTION_EVENT ), + ENTRY0( PRESENTATION, EVENT, XML_ETACTION_EVENT ), + + // process length attributes + ENTRY1( DRAW, RECT, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), + ENTRY1( DRAW, LINE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), + ENTRY1( DRAW, POLYLINE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), + ENTRY1( DRAW, POLYGON, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), + ENTRY1( DRAW, PATH, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), + ENTRY1( DRAW, CIRCLE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), + ENTRY1( DRAW, ELLIPSE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), + ENTRY1( DRAW, CONNECTOR, XML_ETACTION_PROC_ATTRS, OOO_CONNECTOR_ACTIONS ), + ENTRY1( DRAW, CAPTION, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), + ENTRY1( DRAW, CONTROL, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), + ENTRY1( DRAW, PAGE_THUMBNAIL, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), + ENTRY1( DRAW, MEASURE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), + ENTRY1( DRAW, G, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), +// ENTRY1( DRAW, TEXT_BOX, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), + ENTRY1( PRESENTATION, PLACEHOLDER, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), + ENTRY1( DRAW, CONTOUR_POLYGON, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), + ENTRY1( DRAW, CONTOUR_PATH, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), + ENTRY1( DRAW, AREA_RECTANGLE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), + ENTRY1( DRAW, AREA_CIRCLE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), + ENTRY1( DRAW, AREA_POLYGON, XML_ETACTION_PROC_ATTRS, OOO_DRAW_AREA_POLYGON_ACTIONS ), + ENTRY1( DRAW, GLUE_POINT, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), + ENTRY1( DR3D, SCENE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), + ENTRY1( DR3D, CUBE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), + ENTRY1( DR3D, SPHERE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), + ENTRY1( DR3D, EXTRUDE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), + ENTRY1( DR3D, ROTATE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), + ENTRY1( CHART, TITLE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), + ENTRY1( CHART, SUBTITLE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), + ENTRY1( CHART, FOOTER, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), + ENTRY1( CHART, LEGEND, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), + ENTRY1( CHART, WALL, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), + ENTRY1( CHART, FLOOR, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), + ENTRY1( CHART, AXIS, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), + ENTRY1( CHART, GRID, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), + ENTRY1( CHART, SERIES, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), + ENTRY1( CHART, DATA_POINT, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), + ENTRY1( CHART, MEAN_VALUE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), + ENTRY1( CHART, ERROR_INDICATOR, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), + ENTRY1( CHART, REGRESSION_CURVE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), + ENTRY1( CHART, STOCK_GAIN_MARKER, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), + ENTRY1( CHART, STOCK_LOSS_MARKER, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), + ENTRY1( CHART, STOCK_RANGE_LINE, XML_ETACTION_PROC_ATTRS, OOO_SHAPE_ACTIONS ), + + ENTRY0( CHART, CHART, XML_ETACTION_CHART ), + ENTRY0( CHART, PLOT_AREA, XML_ETACTION_CHART_PLOT_AREA ), + + ENTRY1Q( TEXT, TRACKED_CHANGES, XML_ETACTION_TRACKED_CHANGES, + XML_NAMESPACE_TEXT, XML_PROTECTION_KEY ), + ENTRY1Q( TABLE, TRACKED_CHANGES, XML_ETACTION_TRACKED_CHANGES, + XML_NAMESPACE_TABLE, XML_PROTECTION_KEY ), + + ENTRY1( TEXT, INDEX_ENTRY_TAB_STOP, XML_ETACTION_PROC_ATTRS, + OOO_INDEX_ENTRY_TAB_STOP_ACTIONS ), + ENTRY0( STYLE, TAB_STOP, XML_ETACTION_TAB_STOP ), + ENTRY1( STYLE, BACKGROUND_IMAGE, XML_ETACTION_PROC_ATTRS, + OOO_BACKGROUND_IMAGE_ACTIONS ), + ENTRY1( TEXT, LINENUMBERING_CONFIGURATION, XML_ETACTION_PROC_ATTRS, + OOO_LINENUMBERING_ACTIONS ), + ENTRY1( STYLE, FOOTNOTE_SEP, XML_ETACTION_PROC_ATTRS, + OOO_FOOTNOTE_SEP_ACTIONS ), + ENTRY1( STYLE, DROP_CAP, XML_ETACTION_PROC_ATTRS, OOO_DROP_CAP_ACTIONS ), + ENTRY1( STYLE, COLUMNS, XML_ETACTION_PROC_ATTRS, OOO_COLUMNS_ACTIONS ), + ENTRY1( STYLE, COLUMN, XML_ETACTION_PROC_ATTRS, OOO_COLUMNS_ACTIONS ), + + // rename office:value-* to *:value-* + ENTRY1( TEXT, VARIABLE_DECL, XML_ETACTION_PROC_ATTRS, + OOO_TEXT_VALUE_TYPE_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, VARIABLE_SET, XML_ETACTION_PROC_ATTRS, + OOO_TEXT_VALUE_TYPE_ACTIONS), /* generated entry */ + ENTRY1( TEXT, VARIABLE_INPUT, XML_ETACTION_PROC_ATTRS, + OOO_TEXT_VALUE_TYPE_ACTIONS), /* generated entry */ + ENTRY1( TEXT, USER_FIELD_DECL, XML_ETACTION_PROC_ATTRS, + OOO_TEXT_VALUE_TYPE_ACTIONS), /* generated entry */ + ENTRY1( TEXT, EXPRESSION, XML_ETACTION_PROC_ATTRS, + OOO_TEXT_VALUE_TYPE_ACTIONS), /* generated entry */ +// ENTRY1( TEXT, USER_DEFINED, XML_ETACTION_PROC_ATTRS, +// OOO_TEXT_VALUE_TYPE_ACTIONS), /* text:user-defined has no attrs so far */ + ENTRY1( TABLE, TABLE_CELL, XML_ETACTION_PROC_ATTRS, + OOO_TABLE_VALUE_TYPE_ACTIONS), /* generated entry */ + ENTRY1( TABLE, COVERED_TABLE_CELL, XML_ETACTION_PROC_ATTRS, + OOO_TABLE_VALUE_TYPE_ACTIONS), /* generated entry */ + ENTRY1( TABLE, CHANGE_TRACK_TABLE_CELL, XML_ETACTION_PROC_ATTRS, + OOO_TABLE_VALUE_TYPE_ACTIONS), /* generated entry */ +// ENTRY1( FORM, PROPERTY, XML_ETACTION_PROC_ATTRS, +// OOO_VALUE_TYPE_ACTIONS), /* TODO: generated entry */ +// ENTRY1( FORM, LIST_PROPERTY, XML_ETACTION_PROC_ATTRS, +// OOO_VALUE_TYPE_ACTIONS), /* generated entry */ + + ENTRY1( OFFICE, ANNOTATION, XML_ETACTION_MOVE_ATTRS_TO_ELEMS, + OOO_ANNOTATION_ACTIONS ), /* generated entry */ + ENTRY1( OFFICE, CHANGE_INFO, XML_ETACTION_MOVE_ATTRS_TO_ELEMS, + OOO_CHANGE_INFO_ACTIONS ), /* generated entry */ + + ENTRY1( TEXT, DDE_CONNECTION_DECL, XML_ETACTION_PROC_ATTRS, + OOO_DDE_CONNECTION_DECL_ACTIONS ), + + ENTRY0( FORM, CONTROL, XML_ETACTION_FORM_CONTROL ), + ENTRY1( FORM, COLUMN, XML_ETACTION_PROC_ATTRS, + OOO_FORM_COLUMN_ACTIONS ), + ENTRY0( FORM, PROPERTY, XML_ETACTION_FORM_PROPERTY ), + + // process xlink:href + ENTRY1( META, TEMPLATE, XML_ETACTION_PROC_ATTRS, + OOO_XLINK_ACTIONS ), /* generated entry */ + ENTRY1( META, AUTO_RELOAD, XML_ETACTION_PROC_ATTRS, + OOO_XLINK_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, SECTION_SOURCE, XML_ETACTION_PROC_ATTRS, + OOO_XLINK_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, SCRIPT, XML_ETACTION_PROC_ATTRS, + OOO_XLINK_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, ALPHABETICAL_INDEX_AUTO_MARK_FILE, XML_ETACTION_PROC_ATTRS, + OOO_XLINK_ACTIONS ), /* generated entry */ + ENTRY1( TABLE, TABLE_SOURCE, XML_ETACTION_PROC_ATTRS, + OOO_XLINK_ACTIONS ), /* generated entry */ + ENTRY1( TABLE, CELL_RANGE_SOURCE, XML_ETACTION_PROC_ATTRS, + OOO_XLINK_ACTIONS ), /* generated entry */ + ENTRY1( DRAW, A, XML_ETACTION_PROC_ATTRS, + OOO_XLINK_ACTIONS ), /* generated entry */ + ENTRY1( PRESENTATION, SOUND, XML_ETACTION_PROC_ATTRS, + OOO_XLINK_ACTIONS ), /* generated entry */ + ENTRY1( FORM, FORM, XML_ETACTION_PROC_ATTRS, + OOO_FORM_CONTROL_ACTIONS ), + ENTRY2QN( STYLE, SYMBOL_IMAGE, XML_ETACTION_RENAME_ELEM_PROC_ATTRS, + XML_NAMESPACE_CHART, XML_SYMBOL_IMAGE, + OOO_BACKGROUND_IMAGE_ACTIONS ), + + ENTRY2QN( CONFIG, CONFIG_ITEM_SET, XML_ETACTION_PROC_ATTRS_COND, + XML_NAMESPACE_OFFICE, XML_SETTINGS, + OOO_CONFIG_ITEM_SET_ACTIONS ), + + // add namespace prefix + // text:formula + ENTRY1( TEXT, SEQUENCE, XML_ETACTION_PROC_ATTRS, + OOO_FORMULA_ACTIONS ), /* generated entry */ + // text:condition + ENTRY1( TEXT, DATABASE_NEXT, XML_ETACTION_PROC_ATTRS, + OOO_FORMULA_ACTIONS ), /* generated entry */ + // text:condition + ENTRY2QN( TEXT, DATABASE_SELECT, XML_ETACTION_RENAME_ELEM_PROC_ATTRS, + XML_NAMESPACE_TEXT, XML_DATABASE_ROW_SELECT, + OOO_FORMULA_ACTIONS ), + // text:condition + ENTRY1( TEXT, CONDITIONAL_TEXT, XML_ETACTION_PROC_ATTRS, + OOO_FORMULA_ACTIONS ), /* generated entry */ + // text:condition + ENTRY1( TEXT, HIDDEN_TEXT, XML_ETACTION_PROC_ATTRS, + OOO_FORMULA_ACTIONS ), /* generated entry */ + // text:condition + ENTRY1( TEXT, HIDDEN_PARAGRAPH, XML_ETACTION_PROC_ATTRS, + OOO_FORMULA_ACTIONS ), /* generated entry */ + // table:condition + ENTRY1( TABLE, CONTENT_VALIDATION, XML_ETACTION_PROC_ATTRS, + OOO_FORMULA_ACTIONS ), /* generated entry */ + + // rename <table:dependences> to <table:dependencies> + ENTRY1Q( TABLE, DEPENDENCES, XML_ETACTION_RENAME_ELEM, + XML_NAMESPACE_TABLE, XML_DEPENDENCIES ), + ENTRY1Q( TABLE, DEPENDENCE, XML_ETACTION_RENAME_ELEM, + XML_NAMESPACE_TABLE, XML_DEPENDENCY ), + + // process table::error-macro + ENTRY1( TABLE, ERROR_MACRO, XML_ETACTION_PROC_ATTRS, + OOO_ERROR_MACRO_ACTIONS ), + + // process table::conversion-mode + ENTRY1( TABLE, CONVERSION_MODE, XML_ETACTION_PROC_ATTRS, + OOO_DDE_CONV_MODE_ACTIONS ), + + // fix <text:alphabatical-index-mark text:main-etry> + ENTRY1( TEXT, ALPHABETICAL_INDEX_MARK, XML_ETACTION_PROC_ATTRS, + OOO_ALPHABETICAL_INDEX_MARK_ACTIONS ), + ENTRY1( TEXT, ALPHABETICAL_INDEX_MARK_START, XML_ETACTION_PROC_ATTRS, + OOO_ALPHABETICAL_INDEX_MARK_ACTIONS ), + + // process table::data-pilot-member + ENTRY1( TABLE, DATA_PILOT_MEMBER, XML_ETACTION_PROC_ATTRS, + OOO_DATAPILOT_MEMBER_ACTIONS ), + + // process table::data-pilot-level + ENTRY1( TABLE, DATA_PILOT_LEVEL, XML_ETACTION_PROC_ATTRS, + OOO_DATAPILOT_LEVEL_ACTIONS ), + + // process table::source-service + ENTRY1( TABLE, SOURCE_SERVICE, XML_ETACTION_PROC_ATTRS, + OOO_SOURCE_SERVICE_ACTIONS ), + + ENTRY0( OFFICE, TOKEN_INVALID, XML_ETACTION_EOT ) +}; + +// XML_ETACTION_STYLE +static XMLTransformerActionInit aStyleActionTable[] = +{ + ENTRY0( STYLE, FAMILY, XML_ATACTION_STYLE_FAMILY ), + ENTRY0( STYLE, NAME, XML_ATACTION_ENCODE_STYLE_NAME ), + ENTRY0( STYLE, PARENT_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ), + ENTRY0( STYLE, NEXT_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ), + ENTRY0( STYLE, LIST_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ), + ENTRY0( STYLE, MASTER_PAGE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ), + ENTRY0( STYLE, DATA_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ), + ENTRY0( DRAW, NAME, XML_ATACTION_ENCODE_STYLE_NAME ), + ENTRY0( DRAW, DISTANCE, XML_ATACTION_INCH2IN ), + ENTRY0( DRAW, DOTS1_LENGTH, XML_ATACTION_INCH2IN ), + ENTRY0( DRAW, DOTS2_LENGTH, XML_ATACTION_INCH2IN ), + ENTRY0( SVG, WIDTH, XML_ATACTION_SVG_WIDTH_HEIGHT_OOO ), + ENTRY0( SVG, HEIGHT, XML_ATACTION_SVG_WIDTH_HEIGHT_OOO ), + ENTRY0( DRAW, START, XML_ATACTION_NEG_PERCENT ), + ENTRY0( DRAW, END, XML_ATACTION_NEG_PERCENT ), + ENTRY1( XLINK, HREF, XML_ATACTION_URI_OOO, sal_True ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OOO_FRAME_ELEM_ACTIONS +static XMLTransformerActionInit aFrameElemActionTable[] = +{ + ENTRY1Q( OFFICE, EVENTS, XML_ETACTION_RENAME_ELEM, + XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS ), + ENTRY0( DRAW, GLUE_POINT, XML_ETACTION_COPY ), + ENTRY0( DRAW, IMAGE_MAP, XML_ETACTION_COPY ), + ENTRY0( SVG, DESC, XML_ETACTION_COPY_TEXT ), + ENTRY0( DRAW, CONTOUR_POLYGON, XML_ETACTION_COPY ), + ENTRY0( DRAW, CONTOUR_PATH, XML_ETACTION_COPY ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ETACTION_EOT ) +}; + +// OOO_FRAME_ATTR_ACTIONS +static XMLTransformerActionInit aFrameAttrActionTable[] = +{ + ENTRY0( DRAW, ZINDEX, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */ + ENTRY0( DRAW, ID, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */ + ENTRY0( DRAW, LAYER, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */ + ENTRY0( DRAW, STYLE_NAME, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */ + ENTRY0( PRESENTATION, STYLE_NAME, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */ + ENTRY0( DRAW, TRANSFORM, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */ + ENTRY0( DRAW, NAME, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */ + ENTRY0( TABLE, END_CELL_ADDRESS, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */ + ENTRY0( TABLE, END_X, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */ + ENTRY0( TABLE, END_Y, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */ + ENTRY0( TABLE, TABLE_BACKGROUND, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */ + ENTRY0( TEXT, ANCHOR_TYPE, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */ + ENTRY0( TEXT, ANCHOR_PAGE_NUMBER, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */ + ENTRY0( DRAW, TEXT_STYLE_NAME, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */ + ENTRY0( SVG, X, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */ + ENTRY0( SVG, Y, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */ + ENTRY0( SVG, WIDTH, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */ + ENTRY0( SVG, HEIGHT, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */ + ENTRY0( STYLE, REL_WIDTH, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */ + ENTRY0( STYLE, REL_HEIGHT, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */ + ENTRY0( PRESENTATION, CLASS, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */ + ENTRY0( PRESENTATION, PLACEHOLDER, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */ + ENTRY0( PRESENTATION, USER_TRANSFORMED, XML_ATACTION_MOVE_TO_ELEM ), /* generated entry */ + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OOO_EVENT_ELEM_ACTIONS +static XMLTransformerActionInit aEventActionTable[] = +{ + ENTRY0( XLINK, HREF, XML_ATACTION_HREF ), + ENTRY1( SCRIPT, LANGUAGE, XML_ATACTION_ADD_NAMESPACE_PREFIX, + XML_NAMESPACE_OOO ), + ENTRY0( SCRIPT, EVENT_NAME, XML_ATACTION_EVENT_NAME ), + ENTRY0( SCRIPT, MACRO_NAME, XML_ATACTION_MACRO_NAME ), + ENTRY0( SCRIPT, LOCATION, XML_ATACTION_MACRO_LOCATION ), + ENTRY0( SCRIPT, LIBRARY, XML_ATACTION_MACRO_LOCATION ), // bug in draw + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + + +// action table for OOO_MASTER_PAGE_ACTIONS +static XMLTransformerActionInit aMasterPageActionTable[] = +{ + ENTRY0( STYLE, NAME, XML_ATACTION_ENCODE_STYLE_NAME ), + ENTRY0( STYLE, NEXT_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ), + ENTRY1Q( STYLE, PAGE_MASTER_NAME, XML_ATACTION_RENAME_ENCODE_STYLE_NAME_REF, + XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_NAME ), + ENTRY0( DRAW, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +static XMLTransformerActionInit aFontDeclActionTable[] = +{ + ENTRY1Q( FO, FONT_FAMILY, XML_ATACTION_RENAME, + XML_NAMESPACE_SVG, XML_FONT_FAMILY ), + ENTRY1Q( STYLE, FONT_STYLE_NAME, XML_ATACTION_RENAME, + XML_NAMESPACE_STYLE, XML_FONT_ADORNMENTS ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// action table for OOO_PARA_ACTIONS +static XMLTransformerActionInit aParaActionTable[] = +{ + ENTRY0( TEXT, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ), + ENTRY0( TEXT, COND_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ), +// ENTRY0( TEXT, CLASS_NAMES, XML_ATACTION_REMOVE ), + ENTRY1Q( TEXT, LEVEL, XML_ATACTION_RENAME, + XML_NAMESPACE_TEXT, XML_OUTLINE_LEVEL ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// action table for OOO_STYLE_REF_ACTIONS +static XMLTransformerActionInit aStyleRefActionTable[] = +{ + ENTRY0( TEXT, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ), + ENTRY0( TEXT, VISITED_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ), + ENTRY0( TEXT, MAIN_ENTRY_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ), + ENTRY0( TEXT, CITATION_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ), + ENTRY0( TEXT, CITATION_BODY_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ), + ENTRY0( TEXT, DEFAULT_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ), + ENTRY0( TEXT, MASTER_PAGE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ), + ENTRY0( STYLE, DATA_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ), + ENTRY0( STYLE, APPLY_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ), + ENTRY0( STYLE, PAGE_LAYOUT_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ), + ENTRY0( TABLE, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ), + ENTRY0( TABLE, DEFAULT_CELL_STYLE_NAME, + XML_ATACTION_ENCODE_STYLE_NAME_REF ), + ENTRY0( DRAW, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ), + ENTRY0( DRAW, MASTER_PAGE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ), + ENTRY0( PRESENTATION, PRESENTATION_PAGE_LAYOUT_NAME, + XML_ATACTION_ENCODE_STYLE_NAME_REF ), + ENTRY1( XLINK, HREF, XML_ATACTION_URI_OOO, sal_False ), + ENTRY1( TEXT, CONDITION, XML_ATACTION_ADD_NAMESPACE_PREFIX, + XML_NAMESPACE_OOOW ), + ENTRY1( TEXT, FORMULA, XML_ATACTION_ADD_NAMESPACE_PREFIX, + XML_NAMESPACE_OOOW ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OOO_SHAPE_ACTIONS +// !!ATTENTION!! If you change something here, please also change +// aConnectorActionTable if apropriate +static XMLTransformerActionInit aShapeActionTable[] = +{ + ENTRY0( SVG, X, XML_ATACTION_INCH2IN ), + ENTRY0( SVG, Y, XML_ATACTION_INCH2IN ), + ENTRY0( SVG, X1, XML_ATACTION_INCH2IN ), + ENTRY0( SVG, Y1, XML_ATACTION_INCH2IN ), + ENTRY0( SVG, X2, XML_ATACTION_INCH2IN ), + ENTRY0( SVG, Y2, XML_ATACTION_INCH2IN ), + ENTRY0( SVG, CX, XML_ATACTION_INCH2IN ), + ENTRY0( SVG, CY, XML_ATACTION_INCH2IN ), + ENTRY0( SVG, R, XML_ATACTION_INCH2IN ), + ENTRY0( SVG, RX, XML_ATACTION_INCH2IN ), + ENTRY0( SVG, RY, XML_ATACTION_INCH2IN ), + ENTRY0( SVG, WIDTH, XML_ATACTION_SVG_WIDTH_HEIGHT_OOO ), + ENTRY0( SVG, HEIGHT, XML_ATACTION_SVG_WIDTH_HEIGHT_OOO ), + ENTRY0( FO, MIN_WIDTH, XML_ATACTION_INCH2IN ), + ENTRY0( FO, MIN_HEIGHT, XML_ATACTION_INCH2IN ), + ENTRY0( FO, MAX_WIDTH, XML_ATACTION_INCH2IN ), + ENTRY0( FO, MAX_HEIGHT, XML_ATACTION_INCH2IN ), + ENTRY0( DRAW, CORNER_RADIUS, XML_ATACTION_INCH2IN ), + ENTRY0( DRAW, LINE_SKEW, XML_ATACTION_INCHS2INS ), + ENTRY0( DRAW, CAPTION_POINT_X, XML_ATACTION_INCH2IN ), + ENTRY0( DRAW, CAPTION_POINT_Y, XML_ATACTION_INCH2IN ), + ENTRY0( DRAW, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ), + ENTRY0( DRAW, TEXT_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ), + ENTRY0( DRAW, END_X, XML_ATACTION_INCH2IN ), + ENTRY0( DRAW, END_Y, XML_ATACTION_INCH2IN ), + ENTRY0( PRESENTATION, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ), + ENTRY0( DR3D, DISTANCE, XML_ATACTION_INCH2IN ), + ENTRY0( DR3D, FOCAL_LENGTH, XML_ATACTION_INCH2IN ), + ENTRY1Q( FORM, ID, XML_ATACTION_RENAME, + XML_NAMESPACE_DRAW, XML_CONTROL ), + ENTRY1( XLINK, HREF, XML_ATACTION_URI_OOO, sal_True ), + + // BM: needed by chart:legend. The legend needs also the draw actions. As + // there is no merge mechanism, all actions have to be in the same table + ENTRY2( CHART, LEGEND_POSITION, XML_ATACTION_RENAME_ATTRIBUTE, + RENAME_ENTRY( XML_LEFT, XML_START ), + RENAME_ENTRY( XML_RIGHT, XML_END )), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +static XMLTransformerActionInit aConnectorActionTable[] = +{ + ENTRY0( SVG, X1, XML_ATACTION_TWIPS2IN ), + ENTRY0( SVG, Y1, XML_ATACTION_TWIPS2IN ), + ENTRY0( SVG, X2, XML_ATACTION_TWIPS2IN ), + ENTRY0( SVG, Y2, XML_ATACTION_TWIPS2IN ), + ENTRY0( SVG, WIDTH, XML_ATACTION_SVG_WIDTH_HEIGHT_OOO ), + ENTRY0( SVG, HEIGHT, XML_ATACTION_SVG_WIDTH_HEIGHT_OOO ), + ENTRY0( FO, MIN_WIDTH, XML_ATACTION_INCH2IN ), + ENTRY0( FO, MIN_HEIGHT, XML_ATACTION_INCH2IN ), + ENTRY0( FO, MAX_WIDTH, XML_ATACTION_INCH2IN ), + ENTRY0( FO, MAX_HEIGHT, XML_ATACTION_INCH2IN ), + ENTRY0( DRAW, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ), + ENTRY0( DRAW, TEXT_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ), + ENTRY0( DRAW, END_X, XML_ATACTION_INCH2IN ), + ENTRY0( DRAW, END_Y, XML_ATACTION_INCH2IN ), + ENTRY0( PRESENTATION, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ), + ENTRY1Q( FORM, ID, XML_ATACTION_RENAME, + XML_NAMESPACE_DRAW, XML_CONTROL ), + ENTRY1( XLINK, HREF, XML_ATACTION_URI_OOO, sal_True ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OOO_INDEX_ENTRY_TAB_STOP_ACTIONS +static XMLTransformerActionInit aIndexEntryTabStopActionTable[] = +{ + ENTRY0( STYLE, POSITION, XML_ATACTION_INCH2IN ), + ENTRY0( TEXT, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OOO_TAB_STOP_ACTIONS +static XMLTransformerActionInit aTabStopActionTable[] = +{ + ENTRY0( STYLE, POSITION, XML_ATACTION_INCH2IN ), + ENTRY1Q( STYLE, LEADER_CHAR, XML_ATACTION_RENAME, + XML_NAMESPACE_STYLE, XML_LEADER_TEXT ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OOO_LINENUMBERING_ACTIONS +static XMLTransformerActionInit aLineNumberingActionTable[] = +{ + ENTRY0( TEXT, OFFSET, XML_ATACTION_INCH2IN ), + ENTRY0( TEXT, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ), + ENTRY1Q( TEXT, COUNT_IN_FLOATING_FRAMES, XML_ATACTION_RENAME, + XML_NAMESPACE_TEXT, XML_COUNT_IN_TEXT_BOXES ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +static XMLTransformerActionInit aFootnoteSepActionTable[] = +{ + ENTRY0( STYLE, WIDTH, XML_ATACTION_INCH2IN ), + ENTRY0( STYLE, DISTANCE_BEFORE_SEP, XML_ATACTION_INCH2IN ), + ENTRY0( STYLE, DISTANCE_AFTER_SEP, XML_ATACTION_INCH2IN ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OOO_DROP_CAP_ACTIONS +static XMLTransformerActionInit aDropCapActionTable[] = +{ + ENTRY0( STYLE, DISTANCE, XML_ATACTION_INCH2IN ), + ENTRY0( STYLE, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +static XMLTransformerActionInit aColumnsActionTable[] = +{ + ENTRY0( STYLE, COLUMN_GAP, XML_ATACTION_INCH2IN ), +// ENTRY0( STYLE, SPACE_BEFORE, XML_ATACTION_INCH2IN ), +// ENTRY0( STYLE, SPACE_AFTER, XML_ATACTION_INCH2IN ), + ENTRY1Q( FO, MARGIN_LEFT, XML_ATACTION_RENAME_INCH2IN, + XML_NAMESPACE_FO, XML_START_INDENT ), + ENTRY1Q( FO, MARGIN_RIGHT, XML_ATACTION_RENAME_INCH2IN, + XML_NAMESPACE_FO, XML_END_INDENT ), + ENTRY0( STYLE, WIDTH, XML_ATACTION_INCH2IN ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OOO_TEXT_VALUE_TYPE_ACTIONS +static XMLTransformerActionInit aTextValueTypeActionTable[] = +{ + ENTRY1Q( TEXT, VALUE_TYPE, XML_ATACTION_RENAME, + XML_NAMESPACE_OFFICE, XML_VALUE_TYPE ), + ENTRY1Q( TEXT, VALUE, XML_ATACTION_RENAME, + XML_NAMESPACE_OFFICE, XML_VALUE ), + ENTRY1Q( TEXT, CURRENCY, XML_ATACTION_RENAME, + XML_NAMESPACE_OFFICE, XML_CURRENCY ), + ENTRY1Q( TEXT, DATE_VALUE, XML_ATACTION_RENAME, + XML_NAMESPACE_OFFICE, XML_DATE_VALUE ), + ENTRY1Q( TEXT, TIME_VALUE, XML_ATACTION_RENAME, + XML_NAMESPACE_OFFICE, XML_TIME_VALUE ), + ENTRY1Q( TEXT, BOOLEAN_VALUE, XML_ATACTION_RENAME, + XML_NAMESPACE_OFFICE, XML_BOOLEAN_VALUE ), + ENTRY1Q( TEXT, STRING_VALUE, XML_ATACTION_RENAME, + XML_NAMESPACE_OFFICE, XML_STRING_VALUE ), + ENTRY0( STYLE, DATA_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ), + ENTRY1( TEXT, FORMULA, XML_ATACTION_ADD_NAMESPACE_PREFIX, + XML_NAMESPACE_OOOW ), + ENTRY0( TEXT, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OOO_TABLE_VALUE_TYPE_ACTIONS +static XMLTransformerActionInit aTableValueTypeActionTable[] = +{ + ENTRY1Q( TABLE, VALUE_TYPE, XML_ATACTION_RENAME, + XML_NAMESPACE_OFFICE, XML_VALUE_TYPE ), + ENTRY1Q( TABLE, VALUE, XML_ATACTION_RENAME, + XML_NAMESPACE_OFFICE, XML_VALUE ), + ENTRY1Q( TABLE, CURRENCY, XML_ATACTION_RENAME, + XML_NAMESPACE_OFFICE, XML_CURRENCY ), + ENTRY1Q( TABLE, DATE_VALUE, XML_ATACTION_RENAME, + XML_NAMESPACE_OFFICE, XML_DATE_VALUE ), + ENTRY1Q( TABLE, TIME_VALUE, XML_ATACTION_RENAME, + XML_NAMESPACE_OFFICE, XML_TIME_VALUE ), + ENTRY1Q( TABLE, BOOLEAN_VALUE, XML_ATACTION_RENAME, + XML_NAMESPACE_OFFICE, XML_BOOLEAN_VALUE ), + ENTRY1Q( TABLE, STRING_VALUE, XML_ATACTION_RENAME, + XML_NAMESPACE_OFFICE, XML_STRING_VALUE ), + ENTRY0( TABLE, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ), + ENTRY1( TABLE, FORMULA, XML_ATACTION_ADD_APP_NAMESPACE_PREFIX, + XML_NAMESPACE_OOOW ), + ENTRY1Q( TABLE, VALIDATION_NAME, XML_ATACTION_RENAME, + XML_NAMESPACE_TABLE, XML_CONTENT_VALIDATION_NAME ), + ENTRY0( TABLE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// action table for OOO_ANNOTATION_ACTIONS +static XMLTransformerActionInit aAnnotationActionTable[] = +{ + ENTRY1Q( OFFICE, AUTHOR, XML_ATACTION_MOVE_TO_ELEM, + XML_NAMESPACE_DC, XML_CREATOR ), + ENTRY1Q( OFFICE, CREATE_DATE, XML_ATACTION_MOVE_TO_ELEM, + XML_NAMESPACE_DC, XML_DATE ), + ENTRY1Q( OFFICE, CREATE_DATE_STRING, XML_ATACTION_MOVE_TO_ELEM, + XML_NAMESPACE_META, XML_DATE_STRING ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// action table for OOO_CHANGE_INFO_ACTIONS +static XMLTransformerActionInit aChangeInfoActionTable[] = +{ + ENTRY1Q( OFFICE, CHG_AUTHOR, XML_ATACTION_MOVE_TO_ELEM, + XML_NAMESPACE_DC, XML_CREATOR ), + ENTRY1Q( OFFICE, CHG_DATE_TIME, XML_ATACTION_MOVE_TO_ELEM, + XML_NAMESPACE_DC, XML_DATE ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OOO_BACKGROUND_IMAGE_ACTIONS +static XMLTransformerActionInit aBackgroundImageActionTable[] = +{ + ENTRY1Q( DRAW, TRANSPARENCY, XML_ATACTION_RENAME_NEG_PERCENT, + XML_NAMESPACE_DRAW, XML_OPACITY ), + ENTRY1( XLINK, HREF, XML_ATACTION_URI_OOO, sal_True ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// --> OD 2005-06-10 #i50322# +// OOO_BACKGROUND_IMAGE_ACTIONS for OpenOffice.org text documents +// OpenOffice.org text documents, written by OpenOffice.org, contain +// wrong value for the transparency of the background graphic +static XMLTransformerActionInit aWriterBackgroundImageActionTable[] = +{ + ENTRY1Q( DRAW, TRANSPARENCY, XML_ATACTION_WRITER_BACK_GRAPHIC_TRANSPARENCY, XML_NAMESPACE_DRAW, XML_OPACITY ), + ENTRY1( XLINK, HREF, XML_ATACTION_URI_OOO, sal_True ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; +// <-- + +// OOO_DDE_CONNECTION_DECL +static XMLTransformerActionInit aDDEConnectionDeclActionTable[] = +{ + ENTRY1Q( TEXT, NAME, XML_ATACTION_RENAME, + XML_NAMESPACE_OFFICE, XML_NAME ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OOO_FORM_CONTROL_ACTIONS +static XMLTransformerActionInit aFormControlActionTable[] = +{ + ENTRY2QN( FORM, SERVICE_NAME, + XML_ATACTION_RENAME_ADD_NAMESPACE_PREFIX, + XML_NAMESPACE_FORM, XML_CONTROL_IMPLEMENTATION, + XML_NAMESPACE_OOO ), + ENTRY1( XLINK, HREF, XML_ATACTION_URI_OOO, sal_False ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OOO_FORM_COLUMN_ACTIONS +static XMLTransformerActionInit aFormColumnActionTable[] = +{ + ENTRY1Q( FORM, COLUMN_STYLE_NAME, XML_ATACTION_RENAME_ENCODE_STYLE_NAME_REF, + XML_NAMESPACE_FORM, XML_TEXT_STYLE_NAME ), + ENTRY2QN( FORM, SERVICE_NAME, + XML_ATACTION_RENAME_ADD_NAMESPACE_PREFIX, + XML_NAMESPACE_FORM, XML_CONTROL_IMPLEMENTATION, + XML_NAMESPACE_OOO ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OOO_FORM_PROP_ACTIONS +static XMLTransformerActionInit aFormPropActionTable[] = +{ + ENTRY1Q( FORM, PROPERTY_TYPE, XML_ATACTION_RENAME, + XML_NAMESPACE_OFFICE, XML_VALUE_TYPE ), + ENTRY0( FORM, PROPERTY_IS_LIST, XML_ATACTION_REMOVE ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OOO_XLINK_ACTIONS +static XMLTransformerActionInit aXLinkActionTable[] = +{ + ENTRY1( XLINK, HREF, XML_ATACTION_URI_OOO, sal_False ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OOO_CONFIG_ITEM_SET_ACTIONS +static XMLTransformerActionInit aConfigItemSetActionTable[] = +{ + ENTRY1( CONFIG, NAME, XML_ATACTION_ADD_NAMESPACE_PREFIX, + XML_NAMESPACE_OOO ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_FORMULA_ACTIONS +static XMLTransformerActionInit aFormulaActionTable[] = +{ + ENTRY1( TEXT, CONDITION, XML_ATACTION_ADD_NAMESPACE_PREFIX, + XML_NAMESPACE_OOOW ), + ENTRY1( TEXT, FORMULA, XML_ATACTION_ADD_NAMESPACE_PREFIX, + XML_NAMESPACE_OOOW ), + ENTRY1( TABLE, CONDITION, XML_ATACTION_ADD_APP_NAMESPACE_PREFIX, + XML_NAMESPACE_OOOW ), + ENTRY1( TABLE, FORMULA, XML_ATACTION_ADD_APP_NAMESPACE_PREFIX, + XML_NAMESPACE_OOOW ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OOO_ERROR_MACRO_ACTIONS +static XMLTransformerActionInit aErrorMacroActionTable[] = +{ + ENTRY0( TABLE, NAME, XML_ATACTION_REMOVE ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OOO_DDE_CONV_MODE_ACTIONS +static XMLTransformerActionInit aDDEConvModeActionTable[] = +{ + ENTRY1Q( TABLE, LET_TEXT, XML_ATACTION_RENAME, + XML_NAMESPACE_TABLE, XML_KEEP_TEXT ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OOO_DATAPILOT_MEMBER_ACTIONS +static XMLTransformerActionInit aDataPilotMemberActionTable[] = +{ + ENTRY1Q( TABLE, DISPLAY_DETAILS, XML_ATACTION_RENAME, + XML_NAMESPACE_TABLE, XML_SHOW_DETAILS ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OOO_DATAPILOT_LEVEL_ACTIONS +static XMLTransformerActionInit aDataPilotLevelActionTable[] = +{ + ENTRY1Q( TABLE, DISPLAY_EMPTY, XML_ATACTION_RENAME, + XML_NAMESPACE_TABLE, XML_SHOW_EMPTY ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OOO_SOURCE_SERVICE_ACTIONS +static XMLTransformerActionInit aSourceServiceActionTable[] = +{ + ENTRY1Q( TABLE, USERNAME, XML_ATACTION_RENAME, + XML_NAMESPACE_TABLE, XML_USER_NAME ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OOO_DRAW_AREA_POLYGON_ACTIONS (to be added to OOO_SHAPE_ACTIONS) +static XMLTransformerActionInit aDrawAreaPolygonActionTable[] = +{ + ENTRY1Q( SVG, POINTS, XML_ATACTION_RENAME, + XML_NAMESPACE_DRAW, XML_POINTS ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OOO_CHART_ACTIONS +static XMLTransformerActionInit aChartActionTable[] = +{ + ENTRY1( CHART, CLASS, XML_ATACTION_ADD_NAMESPACE_PREFIX, + XML_NAMESPACE_CHART ), + ENTRY0( CHART, ADD_IN_NAME, XML_ATACTION_REMOVE ), + ENTRY0( SVG, WIDTH, XML_ATACTION_INCH2IN ), + ENTRY0( SVG, HEIGHT, XML_ATACTION_INCH2IN ), + ENTRY0( CHART, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OOO_ALPHABETICAL_INDEX_MARK_ACTIONS +static XMLTransformerActionInit aAlphabeticalIndexMarkActionTable[] = +{ + ENTRY1Q( TEXT, MAIN_ETRY, XML_ATACTION_RENAME, + XML_NAMESPACE_TEXT, XML_MAIN_ENTRY ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OOO_SCRIPT_ACTIONS +static XMLTransformerActionInit aScriptActionTable[] = +{ + ENTRY1( SCRIPT, LANGUAGE, XML_ATACTION_ADD_NAMESPACE_PREFIX, XML_NAMESPACE_OOO ), + ENTRY1Q( SCRIPT, NAME, XML_ATACTION_RENAME, XML_NAMESPACE_OOO, XML_NAME ), + ENTRY1Q( SCRIPT, READONLY, XML_ATACTION_RENAME, XML_NAMESPACE_OOO, XML_READONLY ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +static XMLTokenEnum aTokenMap[] = +{ + XML_NONE, XML_SINGLE, XML_DOUBLE, XML_BOLD, XML_BOLD_DOTTED, + XML_BOLD_DASH, XML_BOLD_LONG_DASH, XML_BOLD_DOT_DASH, + XML_BOLD_DOT_DOT_DASH, XML_BOLD_WAVE, XML_DOUBLE_WAVE, + XML_SINGLE_LINE, XML_DOUBLE_LINE, XML_THICK_LINE, XML_SLASH, XML_uX, + XML_TOKEN_END +}; + +//----------------------------------------------------------------------------- + +class XMLDocumentTransformerContext_Impl : public XMLTransformerContext +{ + ::rtl::OUString m_aElemQName; + ::rtl::OUString m_aOldClass; + +public: + TYPEINFO(); + + XMLDocumentTransformerContext_Impl( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName ); + XMLDocumentTransformerContext_Impl( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken ); + + virtual ~XMLDocumentTransformerContext_Impl(); + + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + virtual void EndElement(); +}; + +TYPEINIT1( XMLDocumentTransformerContext_Impl, XMLTransformerContext ); + +XMLDocumentTransformerContext_Impl::XMLDocumentTransformerContext_Impl( + XMLTransformerBase& rImp, + const OUString& rQName ) : + XMLTransformerContext( rImp, rQName ), + m_aElemQName( rQName ) +{ +} +XMLDocumentTransformerContext_Impl::XMLDocumentTransformerContext_Impl( + XMLTransformerBase& rImp, + const OUString& rQName , + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken) : + XMLTransformerContext( rImp, rQName ), + m_aElemQName( rImp.GetNamespaceMap().GetQNameByKey( nPrefix, + ::xmloff::token::GetXMLToken( eToken ) ) ) +{ +} + +XMLDocumentTransformerContext_Impl::~XMLDocumentTransformerContext_Impl() +{ +} + +void XMLDocumentTransformerContext_Impl::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + Reference< XAttributeList > xAttrList( rAttrList ); + + m_aOldClass = GetTransformer().GetClass(); + + XMLMutableAttributeList *pMutableAttrList = 0; + sal_Bool bOOo = sal_False, bOOoW = sal_False, bOOoC = sal_False, + bDOM=sal_False, bDC = sal_False, bSVG = sal_False; + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + for( sal_Int16 i=0; i < nAttrCount; i++ ) + { + const OUString& rAttrName = xAttrList->getNameByIndex( i ); + OUString aLocalName; + sal_uInt16 nPrefix = + GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName, + &aLocalName ); + if( XML_NAMESPACE_OFFICE == nPrefix && + IsXMLToken( aLocalName, XML_CLASS ) ) + { + const OUString& rValue = xAttrList->getValueByIndex( i ); + GetTransformer().SetClass( rValue ); + + pMutableAttrList = new XMLMutableAttributeList( xAttrList ); + xAttrList = pMutableAttrList; + OUString sMime(RTL_CONSTASCII_USTRINGPARAM("application/vnd.oasis.opendocument.") ); + sMime += rValue; + pMutableAttrList->SetValueByIndex( i, sMime ); + OUString aNewAttrQName( GetTransformer().GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_OFFICE, ::xmloff::token::GetXMLToken( XML_MIMETYPE ) ) ); + pMutableAttrList->RenameAttributeByIndex(i, aNewAttrQName ); + break; + } + else if( XML_NAMESPACE_XMLNS == nPrefix ) + { + const OUString& rAttrValue = xAttrList->getValueByIndex( i ); + if( IsXMLToken( rAttrValue, XML_N_OOO ) ) + bOOo = sal_True; + else if( IsXMLToken( rAttrValue, XML_N_OOOW ) ) + bOOoW = sal_True; + else if( IsXMLToken( rAttrValue, XML_N_OOOC ) ) + bOOoC = sal_True; + else if( IsXMLToken( rAttrValue, XML_N_DOM ) ) + bDOM = sal_True; + else if( IsXMLToken( rAttrValue, XML_N_DC ) ) + bDC = sal_True; + else if( IsXMLToken( rAttrValue, XML_N_SVG ) ) + bSVG = sal_True; + } + } + if( !(bOOo && bOOoW && bOOoC && bDOM && bDC && bSVG) ) + { + if( !pMutableAttrList ) + { + pMutableAttrList = new XMLMutableAttributeList( xAttrList ); + xAttrList = pMutableAttrList; + } + if( !bOOo ) + pMutableAttrList->AddAttribute( + GetTransformer().GetNamespaceMap().GetAttrNameByKey( + XML_NAMESPACE_OOO ), + GetTransformer().GetNamespaceMap().GetNameByKey( + XML_NAMESPACE_OOO ) ); + if( !bOOoW ) + pMutableAttrList->AddAttribute( + GetTransformer().GetNamespaceMap().GetAttrNameByKey( + XML_NAMESPACE_OOOW ), + GetTransformer().GetNamespaceMap().GetNameByKey( + XML_NAMESPACE_OOOW ) ); + if( !bOOoC ) + pMutableAttrList->AddAttribute( + GetTransformer().GetNamespaceMap().GetAttrNameByKey( + XML_NAMESPACE_OOOC ), + GetTransformer().GetNamespaceMap().GetNameByKey( + XML_NAMESPACE_OOOC ) ); + if( !bDOM ) + pMutableAttrList->AddAttribute( + GetTransformer().GetNamespaceMap().GetAttrNameByKey( + XML_NAMESPACE_DOM ), + GetTransformer().GetNamespaceMap().GetNameByKey( + XML_NAMESPACE_DOM ) ); + if( !bDC ) + pMutableAttrList->AddAttribute( + GetTransformer().GetNamespaceMap().GetAttrNameByKey( + XML_NAMESPACE_DC ), + GetTransformer().GetNamespaceMap().GetNameByKey( + XML_NAMESPACE_DC ) ); + if( !bSVG ) + pMutableAttrList->AddAttribute( + GetTransformer().GetNamespaceMap().GetAttrNameByKey( + XML_NAMESPACE_SVG ), + GetTransformer().GetNamespaceMap().GetNameByKey( + XML_NAMESPACE_SVG ) ); + } + + GetTransformer().GetDocHandler()->startElement( m_aElemQName, xAttrList ); +} + +void XMLDocumentTransformerContext_Impl::EndElement() +{ + GetTransformer().GetDocHandler()->endElement( m_aElemQName ); + + GetTransformer().SetClass( m_aOldClass ); +} + +//----------------------------------------------------------------------------- + +class XMLBodyTransformerContext_Impl : public XMLTransformerContext +{ + OUString m_aClassQName; + +public: + TYPEINFO(); + + XMLBodyTransformerContext_Impl( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName ); + + virtual ~XMLBodyTransformerContext_Impl(); + + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + virtual void EndElement(); +}; + +TYPEINIT1( XMLBodyTransformerContext_Impl, XMLTransformerContext ); + +XMLBodyTransformerContext_Impl::XMLBodyTransformerContext_Impl( + XMLTransformerBase& rImp, + const OUString& rQName ) : + XMLTransformerContext( rImp, rQName ) +{ +} + +XMLBodyTransformerContext_Impl::~XMLBodyTransformerContext_Impl() +{ +} + +void XMLBodyTransformerContext_Impl::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + XMLTransformerContext::StartElement( rAttrList ); + + XMLMutableAttributeList *pMutableAttrList = + new XMLMutableAttributeList( rAttrList ); + Reference< XAttributeList > xAttrList = pMutableAttrList; + OUString aClass( GetTransformer().GetClass() ); + if( !aClass.getLength() ) + { + aClass = GetXMLToken( XML_TEXT ); + } + else if( IsXMLToken( aClass, XML_TEXT_GLOBAL ) ) + { + OUString aGlobalQName( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_TEXT, GetXMLToken(XML_GLOBAL ) ) ); + pMutableAttrList->AddAttribute( aGlobalQName, GetXMLToken(XML_TRUE) ); + + aClass = GetXMLToken( XML_TEXT ); + } + + m_aClassQName = GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_OFFICE, aClass ); + GetTransformer().GetDocHandler()->startElement( m_aClassQName, + xAttrList ); +} + +void XMLBodyTransformerContext_Impl::EndElement() +{ + GetTransformer().GetDocHandler()->endElement( m_aClassQName ); + XMLTransformerContext::EndElement(); +} + +//----------------------------------------------------------------------------- + +class XMLTabStopOOoTContext_Impl : public XMLPersElemContentTContext +{ +public: + TYPEINFO(); + + XMLTabStopOOoTContext_Impl( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName ); + + virtual ~XMLTabStopOOoTContext_Impl(); + + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); +}; + +TYPEINIT1( XMLTabStopOOoTContext_Impl, XMLPersElemContentTContext ); + +XMLTabStopOOoTContext_Impl::XMLTabStopOOoTContext_Impl( + XMLTransformerBase& rImp, + const OUString& rQName ) : + XMLPersElemContentTContext( rImp, rQName ) +{ +} + +XMLTabStopOOoTContext_Impl::~XMLTabStopOOoTContext_Impl() +{ +} + +void XMLTabStopOOoTContext_Impl::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + XMLTransformerActions *pActions = + GetTransformer().GetUserDefinedActions( OOO_TAB_STOP_ACTIONS ); + OSL_ENSURE( pActions, "go no actions" ); + + Reference< XAttributeList > xAttrList( rAttrList ); + XMLMutableAttributeList *pMutableAttrList = 0; + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + for( sal_Int16 i=0; i < nAttrCount; i++ ) + { + const OUString& rAttrName = xAttrList->getNameByIndex( i ); + OUString aLocalName; + sal_uInt16 nPrefix = + GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName, + &aLocalName ); + XMLTransformerActions::key_type aKey( nPrefix, aLocalName ); + XMLTransformerActions::const_iterator aIter = + pActions->find( aKey ); + if( !(aIter == pActions->end() ) ) + { + if( !pMutableAttrList ) + { + pMutableAttrList = + new XMLMutableAttributeList( xAttrList ); + xAttrList = pMutableAttrList; + } + const OUString& rAttrValue = xAttrList->getValueByIndex( i ); + switch( (*aIter).second.m_nActionType ) + { + case XML_ATACTION_RENAME: + { + OUString aNewAttrQName( + GetTransformer().GetNamespaceMap().GetQNameByKey( + (*aIter).second.GetQNamePrefixFromParam1(), + ::xmloff::token::GetXMLToken( + (*aIter).second.GetQNameTokenFromParam1()) ) ); + pMutableAttrList->RenameAttributeByIndex( i, + aNewAttrQName ); + } + if( IsXMLToken( aLocalName, XML_LEADER_CHAR ) && + rAttrValue.getLength() > 0 && + rAttrValue[0] != ' ' ) + { + OUString aNewAttrQName( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_STYLE, + ::xmloff::token::GetXMLToken(XML_LEADER_STYLE) ) ); + pMutableAttrList->AddAttribute( aNewAttrQName, + GetXMLToken( XML_SOLID ) ); + } + break; + case XML_ATACTION_INCH2IN: + { + OUString aAttrValue( rAttrValue ); + if( XMLTransformerBase::ReplaceSingleInchWithIn( + aAttrValue ) ) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + default: + OSL_ENSURE( !this, "unknown action" ); + break; + } + } + } + + XMLPersElemContentTContext::StartElement( xAttrList ); +} + +// ----------------------------------------------------------------------------- + +class XMLTrackedChangesOOoTContext_Impl : public XMLTransformerContext +{ + sal_uInt16 m_nPrefix; + XMLTokenEnum m_eToken; + +public: + + TYPEINFO(); + + XMLTrackedChangesOOoTContext_Impl( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName, + sal_uInt16 nPrefix, + XMLTokenEnum eToken ); + + virtual ~XMLTrackedChangesOOoTContext_Impl(); + + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); +}; + +TYPEINIT1( XMLTrackedChangesOOoTContext_Impl, XMLTransformerContext ); + +XMLTrackedChangesOOoTContext_Impl::XMLTrackedChangesOOoTContext_Impl( + XMLTransformerBase& rImp, + const OUString& rQName, + sal_uInt16 nPrefix, + XMLTokenEnum eToken ) : + XMLTransformerContext( rImp, rQName ), + m_nPrefix( nPrefix ), + m_eToken( eToken ) +{ +} + +XMLTrackedChangesOOoTContext_Impl::~XMLTrackedChangesOOoTContext_Impl() +{ +} + +void XMLTrackedChangesOOoTContext_Impl::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + Reference< XAttributeList > xAttrList( rAttrList ); + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + for( sal_Int16 i=0; i < nAttrCount; i++ ) + { + const OUString& rAttrName = xAttrList->getNameByIndex( i ); + OUString aLocalName; + sal_uInt16 nPrefix = + GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName, + &aLocalName ); + if( m_nPrefix == nPrefix && IsXMLToken( aLocalName, m_eToken ) ) + { + const Reference< XPropertySet > rPropSet = + GetTransformer().GetPropertySet(); + OSL_ENSURE( rPropSet.is(), "no info property set" ); + if( rPropSet.is() ) + { + const sal_Char sRedlineProtectionKey[] = "RedlineProtectionKey"; + OUString aPropName(RTL_CONSTASCII_USTRINGPARAM(sRedlineProtectionKey)); + Reference< XPropertySetInfo > xPropSetInfo( + rPropSet->getPropertySetInfo() ); + if( xPropSetInfo.is() && + xPropSetInfo->hasPropertyByName( aPropName ) ) + { + Sequence < sal_Int8 > aKey; + SvXMLUnitConverter::decodeBase64( aKey, + xAttrList->getValueByIndex( i ) ); + rPropSet->setPropertyValue( aPropName, makeAny( aKey ) ); + } + else + { + OSL_ENSURE( !this, "RedineProtectionKey is missing" ); + } + } + break; + } + } + XMLTransformerContext::StartElement( xAttrList ); +} + +// ----------------------------------------------------------------------------- + +class XMLTableOOoTransformerContext_Impl : public XMLTransformerContext +{ + ::rtl::OUString m_aElemQName; + +public: + TYPEINFO(); + + XMLTableOOoTransformerContext_Impl( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName ); + + virtual ~XMLTableOOoTransformerContext_Impl(); + + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + virtual void EndElement(); +}; + +TYPEINIT1( XMLTableOOoTransformerContext_Impl, XMLTransformerContext ); + +XMLTableOOoTransformerContext_Impl::XMLTableOOoTransformerContext_Impl( + XMLTransformerBase& rImp, + const OUString& rQName ) : + XMLTransformerContext( rImp, rQName ), + m_aElemQName( rQName ) +{ +} + +XMLTableOOoTransformerContext_Impl::~XMLTableOOoTransformerContext_Impl() +{ +} + +void XMLTableOOoTransformerContext_Impl::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + // --> OD 2005-07-05 #i50521# - perform OOO_STYLE_REF_ACTIONS for all applications + Reference< XAttributeList > xAttrList( rAttrList ); + XMLMutableAttributeList* pMutableAttrList = + GetTransformer().ProcessAttrList( xAttrList, OOO_STYLE_REF_ACTIONS, sal_False ); + // <-- + if( rAttrList->getLength() && IsXMLToken( GetTransformer().GetClass(), XML_SPREADSHEET ) ) + { + sal_Bool bPrintRanges(sal_False); + + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + for( sal_Int16 i=0; i < nAttrCount; i++ ) + { + const OUString& rAttrName = xAttrList->getNameByIndex( i ); + OUString aLocalName; + sal_uInt16 nPrefix = + GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName, + &aLocalName ); + if( XML_NAMESPACE_TABLE == nPrefix && + IsXMLToken( aLocalName, XML_PRINT_RANGES ) ) + { + bPrintRanges = sal_True; + } + } + if (!bPrintRanges && pMutableAttrList) + { + xAttrList = pMutableAttrList; + pMutableAttrList->AddAttribute(GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_TABLE, + GetXMLToken( XML_PRINT ) ), GetXMLToken ( XML_FALSE )); + } + } + + GetTransformer().GetDocHandler()->startElement( m_aElemQName, xAttrList ); +} + +void XMLTableOOoTransformerContext_Impl::EndElement() +{ + GetTransformer().GetDocHandler()->endElement( m_aElemQName ); +} + + +//----------------------------------------------------------------------------- + +XMLTransformerContext *OOo2OasisTransformer::CreateUserDefinedContext( + const TransformerAction_Impl& rAction, + const OUString& rQName, + sal_Bool bPersistent ) +{ + switch( rAction.m_nActionType ) + { + case XML_ETACTION_DOCUMENT: + return new XMLDocumentTransformerContext_Impl( *this, rQName ); + case XML_ETACTION_DOCUMENT_RENAME: + return new XMLDocumentTransformerContext_Impl( *this, rQName, + rAction.GetQNamePrefixFromParam1(), + rAction.GetQNameTokenFromParam1() ); + case XML_ETACTION_BODY: + return new XMLBodyTransformerContext_Impl( *this, rQName ); + case XML_ETACTION_STYLE: + return new XMLStyleOOoTContext( *this, rQName, + static_cast< XMLFamilyType >( rAction.m_nParam1 ), + bPersistent ); + case XML_ETACTION_STYLE_RENAME: + return new XMLStyleOOoTContext( *this, rQName, + static_cast< XMLFamilyType >( rAction.m_nParam2 ), + rAction.GetQNamePrefixFromParam1(), + rAction.GetQNameTokenFromParam1(), + bPersistent ); + case XML_ETACTION_FRAME: + return new XMLFrameOOoTransformerContext( *this, rQName ); + case XML_ETACTION_EVENT: + return new XMLEventOOoTransformerContext( *this, rQName, bPersistent ); + case XML_ETACTION_TAB_STOP: + return new XMLTabStopOOoTContext_Impl( *this, rQName ); + case XML_ETACTION_FORM_CONTROL: + return new XMLControlOOoTransformerContext( *this, rQName ); + case XML_ETACTION_FORM_PROPERTY: + return new XMLFormPropOOoTransformerContext( *this, rQName ); + case XML_ETACTION_CHART: + return new XMLChartOOoTransformerContext( *this, rQName ); + case XML_ETACTION_TRACKED_CHANGES: + return new XMLTrackedChangesOOoTContext_Impl( *this, rQName, + rAction.GetQNamePrefixFromParam1(), + rAction.GetQNameTokenFromParam1() ); + case XML_ETACTION_CHART_PLOT_AREA: + return new XMLChartPlotAreaOOoTContext( *this, rQName ); + case XML_ETACTION_TABLE: + return new XMLTableOOoTransformerContext_Impl( *this, rQName ); + default: + OSL_ENSURE( !this, "no user defined context found!" ); + } + + // default is copying + return new XMLTransformerContext( *this, rQName ); +} + +XMLTransformerActions *OOo2OasisTransformer::GetUserDefinedActions( + sal_uInt16 n ) +{ + XMLTransformerActions *pActions = 0; + if( n < MAX_OOO_ACTIONS ) + { + if( !m_aActions[n] ) + { + if( n<MAX_OOO_PROP_ACTIONS ) + { + m_aActions[n] = + XMLStyleOOoTContext::CreateTransformerActions( n ); + } + else switch( n ) + { + case OOO_STYLE_ACTIONS: + m_aActions[OOO_STYLE_ACTIONS] = + new XMLTransformerActions( aStyleActionTable ); + break; + case OOO_FONT_DECL_ACTIONS: + m_aActions[OOO_FONT_DECL_ACTIONS] = + new XMLTransformerActions( aFontDeclActionTable ); + break; + case OOO_SHAPE_ACTIONS: + m_aActions[OOO_SHAPE_ACTIONS] = + new XMLTransformerActions( aShapeActionTable ); + break; + case OOO_CONNECTOR_ACTIONS: + m_aActions[OOO_CONNECTOR_ACTIONS] = + new XMLTransformerActions( aConnectorActionTable ); + break; + case OOO_TAB_STOP_ACTIONS: + m_aActions[OOO_TAB_STOP_ACTIONS] = + new XMLTransformerActions( aTabStopActionTable ); + break; + case OOO_INDEX_ENTRY_TAB_STOP_ACTIONS: + m_aActions[OOO_INDEX_ENTRY_TAB_STOP_ACTIONS] = + new XMLTransformerActions( aIndexEntryTabStopActionTable ); + break; + case OOO_LINENUMBERING_ACTIONS: + m_aActions[OOO_LINENUMBERING_ACTIONS] = + new XMLTransformerActions( aLineNumberingActionTable ); + break; + case OOO_FOOTNOTE_SEP_ACTIONS: + m_aActions[OOO_FOOTNOTE_SEP_ACTIONS] = + new XMLTransformerActions( aFootnoteSepActionTable ); + break; + case OOO_DROP_CAP_ACTIONS: + m_aActions[OOO_DROP_CAP_ACTIONS] = + new XMLTransformerActions( aDropCapActionTable ); + break; + case OOO_COLUMNS_ACTIONS: + m_aActions[OOO_COLUMNS_ACTIONS] = + new XMLTransformerActions( aColumnsActionTable ); + break; + case OOO_TEXT_VALUE_TYPE_ACTIONS: + m_aActions[OOO_TEXT_VALUE_TYPE_ACTIONS] = + new XMLTransformerActions( aTextValueTypeActionTable ); + break; + case OOO_TABLE_VALUE_TYPE_ACTIONS: + m_aActions[OOO_TABLE_VALUE_TYPE_ACTIONS] = + new XMLTransformerActions( aTableValueTypeActionTable ); + break; + case OOO_PARA_ACTIONS: + m_aActions[OOO_PARA_ACTIONS] = + new XMLTransformerActions( aParaActionTable ); + break; + case OOO_STYLE_REF_ACTIONS: + m_aActions[OOO_STYLE_REF_ACTIONS] = + new XMLTransformerActions( aStyleRefActionTable ); + break; + case OOO_MASTER_PAGE_ACTIONS: + m_aActions[OOO_MASTER_PAGE_ACTIONS] = + new XMLTransformerActions( aMasterPageActionTable ); + break; + case OOO_ANNOTATION_ACTIONS: + m_aActions[OOO_ANNOTATION_ACTIONS] = + new XMLTransformerActions( aAnnotationActionTable ); + break; + case OOO_CHANGE_INFO_ACTIONS: + m_aActions[OOO_CHANGE_INFO_ACTIONS] = + new XMLTransformerActions( aChangeInfoActionTable ); + break; + case OOO_FRAME_ELEM_ACTIONS: + m_aActions[OOO_FRAME_ELEM_ACTIONS] = + new XMLTransformerActions( aFrameElemActionTable ); + break; + case OOO_FRAME_ATTR_ACTIONS: + m_aActions[OOO_FRAME_ATTR_ACTIONS] = + new XMLTransformerActions( aFrameAttrActionTable ); + break; + case OOO_BACKGROUND_IMAGE_ACTIONS: + // --> OD 2005-06-10 #i50322# + // use special actions for Writer documents. + m_aActions[OOO_BACKGROUND_IMAGE_ACTIONS] = + isWriter() + ? new XMLTransformerActions( aWriterBackgroundImageActionTable ) + : new XMLTransformerActions( aBackgroundImageActionTable ); + // <-- + break; + case OOO_DDE_CONNECTION_DECL_ACTIONS: + m_aActions[OOO_DDE_CONNECTION_DECL_ACTIONS] = + new XMLTransformerActions( aDDEConnectionDeclActionTable ); + break; + case OOO_EVENT_ACTIONS: + m_aActions[OOO_EVENT_ACTIONS] = + new XMLTransformerActions( aEventActionTable ); + break; + case OOO_FORM_CONTROL_ACTIONS: + m_aActions[OOO_FORM_CONTROL_ACTIONS] = + new XMLTransformerActions( aFormControlActionTable ); + break; + case OOO_FORM_COLUMN_ACTIONS: + m_aActions[OOO_FORM_COLUMN_ACTIONS] = + new XMLTransformerActions( aFormColumnActionTable ); + break; + case OOO_FORM_PROP_ACTIONS: + m_aActions[OOO_FORM_PROP_ACTIONS] = + new XMLTransformerActions( aFormPropActionTable ); + break; + case OOO_XLINK_ACTIONS: + m_aActions[OOO_XLINK_ACTIONS] = + new XMLTransformerActions( aXLinkActionTable ); + break; + case OOO_CONFIG_ITEM_SET_ACTIONS: + m_aActions[OOO_CONFIG_ITEM_SET_ACTIONS] = + new XMLTransformerActions( aConfigItemSetActionTable ); + break; + case OOO_FORMULA_ACTIONS: + m_aActions[OOO_FORMULA_ACTIONS] = + new XMLTransformerActions( aFormulaActionTable ); + break; + case OOO_CHART_ACTIONS: + m_aActions[OOO_CHART_ACTIONS] = + new XMLTransformerActions( aChartActionTable ); + break; + case OOO_ERROR_MACRO_ACTIONS: + m_aActions[OOO_ERROR_MACRO_ACTIONS] = + new XMLTransformerActions( aErrorMacroActionTable ); + break; + case OOO_DDE_CONV_MODE_ACTIONS: + m_aActions[OOO_DDE_CONV_MODE_ACTIONS] = + new XMLTransformerActions( aDDEConvModeActionTable ); + break; + case OOO_ALPHABETICAL_INDEX_MARK_ACTIONS: + m_aActions[OOO_ALPHABETICAL_INDEX_MARK_ACTIONS] = + new XMLTransformerActions( aAlphabeticalIndexMarkActionTable ); + break; + case OOO_DATAPILOT_MEMBER_ACTIONS: + m_aActions[OOO_DATAPILOT_MEMBER_ACTIONS] = + new XMLTransformerActions( aDataPilotMemberActionTable ); + case OOO_DATAPILOT_LEVEL_ACTIONS: + m_aActions[OOO_DATAPILOT_LEVEL_ACTIONS] = + new XMLTransformerActions( aDataPilotLevelActionTable ); + case OOO_SOURCE_SERVICE_ACTIONS: + m_aActions[OOO_SOURCE_SERVICE_ACTIONS] = + new XMLTransformerActions( aSourceServiceActionTable ); + case OOO_DRAW_AREA_POLYGON_ACTIONS: + m_aActions[OOO_DRAW_AREA_POLYGON_ACTIONS] = + new XMLTransformerActions( aShapeActionTable ); + m_aActions[OOO_DRAW_AREA_POLYGON_ACTIONS] + ->Add( aDrawAreaPolygonActionTable ); + break; + case OOO_SCRIPT_ACTIONS: + m_aActions[OOO_SCRIPT_ACTIONS] = + new XMLTransformerActions( aScriptActionTable ); + break; + } + } + pActions = m_aActions[n]; + } + + return pActions; +} + +OUString OOo2OasisTransformer::GetEventName( const OUString& rName, sal_Bool ) +{ + if( !m_pEventMap ) + m_pEventMap = XMLEventOOoTransformerContext::CreateEventMap(); + + OUString aNewName; + sal_uInt16 nPrefix = XMLEventOOoTransformerContext::GetEventName( rName, + aNewName, *m_pEventMap ); + if( XML_NAMESPACE_UNKNOWN != nPrefix ) + aNewName = GetNamespaceMap().GetQNameByKey( nPrefix, aNewName ); + else + aNewName = rName; + + return aNewName; +} + + +OOo2OasisTransformer::OOo2OasisTransformer( const sal_Char *pImplName, + const sal_Char *pSubServiceName ) + throw() : + XMLTransformerBase( aActionTable, aTokenMap ), + m_pEventMap( 0 ) +{ + if( pImplName ) + m_aImplName = OUString::createFromAscii( pImplName ); + else + m_aImplName = OOo2OasisTransformer_getImplementationName(); + if( pSubServiceName ) + m_aSubServiceName = OUString::createFromAscii( pSubServiceName ); + + GetNamespaceMap().Add( GetXMLToken(XML_NP_OFFICE), GetXMLToken(XML_N_OFFICE_OOO), XML_NAMESPACE_OFFICE ); + GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_OFFICE), GetXMLToken(XML_N_OFFICE), XML_NAMESPACE_OFFICE ); + + GetNamespaceMap().Add( GetXMLToken(XML_NP_META), GetXMLToken(XML_N_META_OOO), XML_NAMESPACE_META ); + GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_META), GetXMLToken(XML_N_META), XML_NAMESPACE_META ); + + GetNamespaceMap().Add( GetXMLToken(XML_NP_STYLE), GetXMLToken(XML_N_STYLE_OOO), XML_NAMESPACE_STYLE ); + GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_STYLE), GetXMLToken(XML_N_STYLE), XML_NAMESPACE_STYLE ); + + GetNamespaceMap().Add( GetXMLToken(XML_NP_NUMBER), GetXMLToken(XML_N_NUMBER_OOO), XML_NAMESPACE_NUMBER ); + GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_NUMBER), GetXMLToken(XML_N_NUMBER), XML_NAMESPACE_NUMBER ); + + GetNamespaceMap().Add( GetXMLToken(XML_NP_CONFIG), GetXMLToken(XML_N_CONFIG_OOO), XML_NAMESPACE_CONFIG ); + GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_CONFIG), GetXMLToken(XML_N_CONFIG), XML_NAMESPACE_CONFIG ); + + GetNamespaceMap().Add( GetXMLToken(XML_NP_TEXT), GetXMLToken(XML_N_TEXT_OOO), XML_NAMESPACE_TEXT ); + GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_TEXT), GetXMLToken(XML_N_TEXT), XML_NAMESPACE_TEXT ); + + GetNamespaceMap().Add( GetXMLToken(XML_NP_TABLE), GetXMLToken(XML_N_TABLE_OOO), XML_NAMESPACE_TABLE ); + GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_TABLE), GetXMLToken(XML_N_TABLE), XML_NAMESPACE_TABLE ); + + GetNamespaceMap().Add( GetXMLToken(XML_NP_DRAW), GetXMLToken(XML_N_DRAW_OOO), XML_NAMESPACE_DRAW ); + GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_DRAW), GetXMLToken(XML_N_DRAW), XML_NAMESPACE_DRAW ); + + GetNamespaceMap().Add( GetXMLToken(XML_NP_DR3D), GetXMLToken(XML_N_DR3D_OOO), XML_NAMESPACE_DR3D ); + GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_DR3D), GetXMLToken(XML_N_DR3D), XML_NAMESPACE_DR3D ); + + GetNamespaceMap().Add( GetXMLToken(XML_NP_PRESENTATION), GetXMLToken(XML_N_PRESENTATION_OOO), XML_NAMESPACE_PRESENTATION ); + GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_PRESENTATION), GetXMLToken(XML_N_PRESENTATION), XML_NAMESPACE_PRESENTATION ); + + GetNamespaceMap().Add( GetXMLToken(XML_NP_CHART), GetXMLToken(XML_N_CHART_OOO), XML_NAMESPACE_CHART ); + GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_CHART), GetXMLToken(XML_N_CHART), XML_NAMESPACE_CHART ); + + GetNamespaceMap().Add( GetXMLToken(XML_NP_FORM), GetXMLToken(XML_N_FORM_OOO), XML_NAMESPACE_FORM ); + GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_FORM), GetXMLToken(XML_N_FORM), XML_NAMESPACE_FORM ); + + GetNamespaceMap().Add( GetXMLToken(XML_NP_SCRIPT), GetXMLToken(XML_N_SCRIPT_OOO), XML_NAMESPACE_SCRIPT ); + GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_SCRIPT), GetXMLToken(XML_N_SCRIPT), XML_NAMESPACE_SCRIPT ); + + GetNamespaceMap().Add( GetXMLToken(XML_NP_FO), GetXMLToken(XML_N_FO), XML_NAMESPACE_FO ); + GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_FO), GetXMLToken(XML_N_FO_COMPAT), XML_NAMESPACE_FO ); + + GetNamespaceMap().Add( GetXMLToken(XML_NP_SVG), GetXMLToken(XML_N_SVG), XML_NAMESPACE_SVG ); + GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_SVG), GetXMLToken(XML_N_SVG_COMPAT), XML_NAMESPACE_SVG ); + + for( sal_uInt16 i=0; i<MAX_OOO_ACTIONS; ++i ) + m_aActions[i] = 0; +} + +OOo2OasisTransformer::~OOo2OasisTransformer() throw() +{ + for( sal_uInt16 i=0; i<MAX_OOO_ACTIONS; ++i ) + delete m_aActions[i]; + XMLEventOOoTransformerContext::FlushEventMap( m_pEventMap ); +} + +Any OOo2OasisTransformer::queryInterface( const Type& rType ) + throw (RuntimeException) +{ + Any aRet; + if ( rType == ::getCppuType((Reference<XImporter> *)0) ) + { + Reference<XImporter> xThis( this ); + aRet <<= xThis; + } + else if ( rType == ::getCppuType((Reference<XFilter> *)0) ) + { + Reference<XFilter> xThis( this ); + aRet <<= xThis; + } + else + { + aRet = XMLTransformerBase::queryInterface(rType); + } + + return aRet; +} + +// XImporter +void SAL_CALL OOo2OasisTransformer::setTargetDocument( + const Reference< XComponent >& xDoc ) + throw( IllegalArgumentException, RuntimeException) +{ + if( !GetDocHandler().is() ) + { + // if initialize hasn't been called, then we have to call it now + // to get the sub component initialized. + Sequence<Any> aArgs( 0 ); + Initialize( aArgs ); + } + + mxModel.set( xDoc, UNO_QUERY ); + + Reference< XImporter > xImp( GetDocHandler(), UNO_QUERY ); + OSL_ENSURE( xImp.is(), "doc handler is not an importer" ); + if( xImp.is() ) + xImp->setTargetDocument( xDoc ); +} + +// XFilter +sal_Bool SAL_CALL OOo2OasisTransformer::filter( + const Sequence< PropertyValue >& aDescriptor ) + throw ( RuntimeException) +{ + Reference< XFilter> xFilter( GetDocHandler(), UNO_QUERY ); + OSL_ENSURE( xFilter.is(), "doc handler is not a filter" ); + if( xFilter.is() ) + return xFilter->filter( aDescriptor ); + + return sal_False; +} + +void SAL_CALL OOo2OasisTransformer::cancel( ) + throw ( RuntimeException) +{ + Reference< XFilter> xFilter( GetDocHandler(), UNO_QUERY ); + OSL_ENSURE( xFilter.is(), "doc handler is not a filter" ); + if( xFilter.is() ) + xFilter->cancel(); +} + +// XInitialize +void SAL_CALL OOo2OasisTransformer::initialize( + const Sequence< Any >& rArguments ) + throw( Exception, RuntimeException ) +{ + Initialize( rArguments ); +} + +void SAL_CALL OOo2OasisTransformer::startDocument( void ) + throw( SAXException, RuntimeException ) +{ + if( !GetDocHandler().is() ) + { + // if initialize hasn't been called, then we have to call it now + // to get the sub component initialized. + Sequence<Any> aArgs( 0 ); + Initialize( aArgs ); + } + + XMLTransformerBase::startDocument(); +} + + +void SAL_CALL OOo2OasisTransformer::Initialize( + const Sequence< Any >& rArguments ) + throw( Exception, RuntimeException ) +{ + OSL_ENSURE( !GetDocHandler().is(), "duplication initialization" ); + + Reference< XDocumentHandler > xDocHandler; + if( m_aSubServiceName.getLength() ) + { + Reference< XMultiServiceFactory > xFactory = + comphelper::getProcessServiceFactory(); + if( xFactory.is() ) + { + try + { + // get filter component + xDocHandler = Reference< XDocumentHandler >( + xFactory->createInstanceWithArguments( m_aSubServiceName, + rArguments ), + UNO_QUERY); + } + catch( Exception& ) + { + } + } + } + + OSL_ENSURE( xDocHandler.is(), "can't instantiate filter component" ); + if( xDocHandler.is() ) + { + Sequence<Any> aArgs( 1 + rArguments.getLength() ); + aArgs[0] <<= xDocHandler; + for(sal_Int32 i = 0; i < rArguments.getLength(); i++) + aArgs[i+1] = rArguments[i]; + XMLTransformerBase::initialize( aArgs ); + + OSL_ENSURE( GetDocHandler() == xDocHandler, + "duplicate doc handler" ); + } + else + { + XMLTransformerBase::initialize( rArguments ); + } +} + + +Sequence< sal_Int8 > static CreateUnoTunnelId() +{ + static osl::Mutex aCreateMutex; + ::osl::Guard<osl::Mutex> aGuard( aCreateMutex ); + Sequence< sal_Int8 > aSeq( 16 ); + rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); + return aSeq; +} + +const Sequence< sal_Int8 > & OOo2OasisTransformer::getUnoTunnelId() throw() +{ + static Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId(); + return aSeq; +} + +// XUnoTunnel +sal_Int64 SAL_CALL OOo2OasisTransformer::getSomething( const Sequence< sal_Int8 >& rId ) + throw(RuntimeException) +{ + if( rId.getLength() == 16 + && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), + rId.getConstArray(), 16 ) ) + { + return reinterpret_cast< sal_Int64 >( this ); + } + else + { + return (sal_Int64)0; + } +} + +// XServiceInfo +OUString SAL_CALL OOo2OasisTransformer::getImplementationName() + throw(RuntimeException) +{ + return m_aImplName; +} + +sal_Bool SAL_CALL OOo2OasisTransformer::supportsService( const OUString& ) + throw(RuntimeException) +{ + return sal_False; +} + +Sequence< OUString > SAL_CALL OOo2OasisTransformer::getSupportedServiceNames( ) + throw(RuntimeException) +{ + Sequence<OUString> aSeq(0); + return aSeq; +} + +// XTypeProvider +Sequence< ::com::sun::star::uno::Type > SAL_CALL + OOo2OasisTransformer::getTypes() throw(RuntimeException) +{ + Sequence< ::com::sun::star::uno::Type > aTypes( + XMLTransformerBase::getTypes() ); + + sal_Int32 nIndex = aTypes.getLength(); + aTypes.realloc( nIndex + 2 ); + + ::com::sun::star::uno::Type* pTypes = aTypes.getArray(); + pTypes[nIndex++] = ::getCppuType( static_cast< Reference< XImporter > * >( 0 ) ); + pTypes[nIndex++] = ::getCppuType( static_cast< Reference< XFilter > * >( 0 ) ); + + return aTypes; +} + +// Service registration + +OUString SAL_CALL OOo2OasisTransformer_getImplementationName() throw() +{ + return OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.comp.OOo2OasisTransformer" ) ); +} + +Sequence< OUString > SAL_CALL OOo2OasisTransformer_getSupportedServiceNames() throw() +{ + const OUString aServiceName( OOo2OasisTransformer_getImplementationName() ); + const Sequence< OUString > aSeq( &aServiceName, 1 ); + return aSeq; +} + +Reference< XInterface > SAL_CALL OOo2OasisTransformer_createInstance( + const Reference< XMultiServiceFactory > & ) + throw( Exception ) +{ + return (cppu::OWeakObject*)new OOo2OasisTransformer(); +} + +#define OOO_IMPORTER( className, implName, subServiceName ) \ +OUString SAL_CALL className##_getImplementationName() throw() \ +{ \ + return OUString( RTL_CONSTASCII_USTRINGPARAM( implName ) ); \ +} \ + \ +Sequence< OUString > SAL_CALL className##_getSupportedServiceNames() throw()\ +{ \ + const OUString aServiceName( className##_getImplementationName() ); \ + const Sequence< OUString > aSeq( &aServiceName, 1 ); \ + return aSeq; \ +} \ + \ +Reference< XInterface > SAL_CALL className##_createInstance( \ + const Reference< XMultiServiceFactory > & ) \ + throw( Exception ) \ +{ \ + return (cppu::OWeakObject*)new OOo2OasisTransformer( implName, \ + subServiceName ); \ +} + +OOO_IMPORTER( XMLWriterImportOOO, + "com.sun.star.comp.Writer.XMLImporter", + "com.sun.star.comp.Writer.XMLOasisImporter" ) +OOO_IMPORTER( XMLWriterStylesImportOOO, + "com.sun.star.comp.Writer.XMLStylesImporter", + "com.sun.star.comp.Writer.XMLOasisStylesImporter" ) +OOO_IMPORTER( XMLWriterContentImportOOO, + "com.sun.star.comp.Writer.XMLContentImporter", + "com.sun.star.comp.Writer.XMLOasisContentImporter" ) +OOO_IMPORTER( XMLWriterMetaImportOOO, + "com.sun.star.comp.Writer.XMLMetaImporter", + "com.sun.star.comp.Writer.XMLOasisMetaImporter" ) +OOO_IMPORTER( XMLWriterSettingsImportOOO, + "com.sun.star.comp.Writer.XMLSettingsImporter", + "com.sun.star.comp.Writer.XMLOasisSettingsImporter" ) + +OOO_IMPORTER( XMLImpressImportOOO, + "com.sun.star.comp.Impress.XMLImporter", + "com.sun.star.comp.Impress.XMLOasisImporter" ) +OOO_IMPORTER( XMLImpressStylesImportOOO, + "com.sun.star.comp.Impress.XMLStylesImporter", + "com.sun.star.comp.Impress.XMLOasisStylesImporter" ) +OOO_IMPORTER( XMLImpressContentImportOOO, + "com.sun.star.comp.Impress.XMLContentImporter", + "com.sun.star.comp.Impress.XMLOasisContentImporter" ) +OOO_IMPORTER( XMLImpressMetaImportOOO, + "com.sun.star.comp.Impress.XMLMetaImporter", + "com.sun.star.comp.Impress.XMLOasisMetaImporter" ) +OOO_IMPORTER( XMLImpressSettingsImportOOO, + "com.sun.star.comp.Impress.XMLSettingsImporter", + "com.sun.star.comp.Impress.XMLOasisSettingsImporter" ) + +OOO_IMPORTER( XMLDrawImportOOO, + "com.sun.star.comp.Draw.XMLImporter", + "com.sun.star.comp.Draw.XMLOasisImporter" ) +OOO_IMPORTER( XMLDrawStylesImportOOO, + "com.sun.star.comp.Draw.XMLStylesImporter", + "com.sun.star.comp.Draw.XMLOasisStylesImporter" ) +OOO_IMPORTER( XMLDrawContentImportOOO, + "com.sun.star.comp.Draw.XMLContentImporter", + "com.sun.star.comp.Draw.XMLOasisContentImporter" ) +OOO_IMPORTER( XMLDrawMetaImportOOO, + "com.sun.star.comp.Draw.XMLMetaImporter", + "com.sun.star.comp.Draw.XMLOasisMetaImporter" ) +OOO_IMPORTER( XMLDrawSettingsImportOOO, + "com.sun.star.comp.Draw.XMLSettingsImporter", + "com.sun.star.comp.Draw.XMLOasisSettingsImporter" ) + +OOO_IMPORTER( XMLCalcImportOOO, + "com.sun.star.comp.Calc.XMLImporter", + "com.sun.star.comp.Calc.XMLOasisImporter" ) +OOO_IMPORTER( XMLCalcStylesImportOOO, + "com.sun.star.comp.Calc.XMLStylesImporter", + "com.sun.star.comp.Calc.XMLOasisStylesImporter" ) +OOO_IMPORTER( XMLCalcContentImportOOO, + "com.sun.star.comp.Calc.XMLContentImporter", + "com.sun.star.comp.Calc.XMLOasisContentImporter" ) +OOO_IMPORTER( XMLCalcMetaImportOOO, + "com.sun.star.comp.Calc.XMLMetaImporter", + "com.sun.star.comp.Calc.XMLOasisMetaImporter" ) +OOO_IMPORTER( XMLCalcSettingsImportOOO, + "com.sun.star.comp.Calc.XMLSettingsImporter", + "com.sun.star.comp.Calc.XMLOasisSettingsImporter" ) + +OOO_IMPORTER( XMLChartImportOOO, + "com.sun.star.comp.Chart.XMLImporter", + "com.sun.star.comp.Chart.XMLOasisImporter" ) +OOO_IMPORTER( XMLChartStylesImportOOO, + "com.sun.star.comp.Chart.XMLStylesImporter", + "com.sun.star.comp.Chart.XMLOasisStylesImporter" ) +OOO_IMPORTER( XMLChartContentImportOOO, + "com.sun.star.comp.Chart.XMLContentImporter", + "com.sun.star.comp.Chart.XMLOasisContentImporter" ) + +OOO_IMPORTER( XMLMathMetaImportOOO, + "com.sun.star.comp.Math.XMLMetaImporter", + "com.sun.star.comp.Math.XMLOasisMetaImporter" ) +OOO_IMPORTER( XMLMathSettingsImportOOO, + "com.sun.star.comp.Math.XMLSettingsImporter", + "com.sun.star.comp.Math.XMLOasisSettingsImporter" ) + +OOO_IMPORTER( XMLMetaImportOOO, + "com.sun.star.document.XMLMetaImporter", + "com.sun.star.document.XMLOasisMetaImporter" ) + +OOO_IMPORTER( XMLAutoTextEventImportOOO, + "com.sun.star.comp.Writer.XMLAutotextEventsImporter", + "com.sun.star.comp.Writer.XMLOasisAutotextEventsImporter" ) diff --git a/xmloff/source/transform/OOo2Oasis.hxx b/xmloff/source/transform/OOo2Oasis.hxx new file mode 100644 index 000000000000..863f45ca48a5 --- /dev/null +++ b/xmloff/source/transform/OOo2Oasis.hxx @@ -0,0 +1,114 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_OOO2OASIS_HXX +#define _XMLOFF_OOO2OASIS_HXX + +#include <com/sun/star/document/XImporter.hpp> +#include <com/sun/star/document/XFilter.hpp> +#include "ActionMapTypesOOo.hxx" +#ifndef _XMLOFF_TRANSFORMERBASE_HXX_ +#include "TransformerBase.hxx" +#endif + +class XMLTransformerOOoEventMap_Impl; + +class OOo2OasisTransformer : + public XMLTransformerBase, + public ::com::sun::star::document::XImporter, + public ::com::sun::star::document::XFilter +{ + ::rtl::OUString m_aImplName; + ::rtl::OUString m_aSubServiceName; + + XMLTransformerActions *m_aActions[MAX_OOO_ACTIONS]; + XMLTransformerOOoEventMap_Impl *m_pEventMap; +protected: + + virtual XMLTransformerContext *CreateUserDefinedContext( + const TransformerAction_Impl& rAction, + const ::rtl::OUString& rQName, + sal_Bool bPersistent=sal_False ); + + virtual XMLTransformerActions *GetUserDefinedActions( sal_uInt16 n ); + +public: + OOo2OasisTransformer( const sal_Char *pImplName=0, + const sal_Char *pSubServiceName=0 ) throw(); + virtual ~OOo2OasisTransformer() throw(); + + static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw(); + + // XInterface + + // (XInterface methods need to be implemented to disambigouate + // between those inherited through XMLTransformerBase and + // the new interfaces). + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( + const ::com::sun::star::uno::Type& aType ) + throw (::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL acquire( ) throw () + { XMLTransformerBase::acquire(); }; + + virtual void SAL_CALL release( ) throw () + { XMLTransformerBase::release(); }; + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); + + // XImporter + virtual void SAL_CALL setTargetDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + + // XFilter + virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL cancel( ) throw (::com::sun::star::uno::RuntimeException); + + void SAL_CALL Initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::xml::sax::XDocumentHandler + virtual void SAL_CALL startDocument(void) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + + virtual ::rtl::OUString GetEventName( const ::rtl::OUString& rName, + sal_Bool bForm = sal_False ); +}; + +#endif // _XMLOFF_TRANSFORMER_BASE_HXX diff --git a/xmloff/source/transform/Oasis2OOo.cxx b/xmloff/source/transform/Oasis2OOo.cxx new file mode 100644 index 000000000000..4f0bd1303afb --- /dev/null +++ b/xmloff/source/transform/Oasis2OOo.cxx @@ -0,0 +1,2092 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" +#include <com/sun/star/beans/XPropertySetInfo.hpp> +#include <rtl/uuid.h> +#include <rtl/ustrbuf.hxx> +#include <xmloff/nmspmap.hxx> +#include "xmloff/xmlnmspe.hxx" +#include <xmloff/xmltoken.hxx> +#include "DeepTContext.hxx" +#include "MetaTContext.hxx" +#include "DocumentTContext.hxx" +#ifndef _XMLOFF_NOTESCONTEXT_HXX +#include "NotesTContext.hxx" +#endif +#include "StyleOASISTContext.hxx" +#include "FrameOASISTContext.hxx" +#include "EventOASISTContext.hxx" +#include "DlgOASISTContext.hxx" +#ifndef _XMLOFF_CONTROLOASISTCONTEXT_HXX +#include "ControlOASISTContext.hxx" +#endif +#include "FormPropOASISTContext.hxx" +#include "ChartOASISTContext.hxx" +#include "ChartPlotAreaOASISTContext.hxx" +#include "MutableAttrList.hxx" +#include "ElemTransformerAction.hxx" +#include "AttrTransformerAction.hxx" +#include "TransformerActions.hxx" +#include "FamilyType.hxx" +#include <xmloff/xmluconv.hxx> +#include "Oasis2OOo.hxx" + +using ::rtl::OUString; +using ::rtl::OUStringBuffer; +using namespace ::osl; +using namespace ::xmloff::token; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::xml::sax; +using namespace ::com::sun::star::beans; + +OUString SAL_CALL Oasis2OOoTransformer_getImplementationName() throw(); + +enum XMLUserDefinedTransformerAction +{ + XML_ETACTION_META=XML_ETACTION_USER_DEFINED, + XML_ETACTION_DOCUMENT, + XML_ETACTION_BODY, + XML_ETACTION_NOTES, + XML_ETACTION_TABLE, + XML_ETACTION_STYLE, + XML_ETACTION_STYLE_RENAME, + XML_ETACTION_FRAME, + XML_ETACTION_EVENT, + XML_ETACTION_DLG, + XML_ETACTION_TAB_STOP, + XML_ETACTION_FORM_CONTROL, + XML_ETACTION_FORM_PROPERTY, + XML_ETACTION_CONFIG_ITEM, + XML_ETACTION_TRACKED_CHANGES, + XML_ETACTION_CHART, + XML_ETACTION_CHART_PLOT_AREA +}; + +#define ENTRY3( n, l, a, p1, p2, p3 ) \ + { XML_NAMESPACE_##n, XML_##l, a, p1, p2, p3 } +#define ENTRY3QNQ( n, l, a, n1, l1, p2, n3, l3 ) \ + ENTRY3( n, l, a, XMLTransformerActionInit::QNameParam( n1, l1 ), \ + p2, XMLTransformerActionInit::QNameParam( n3, l3 ) ) + +#define ENTRY2( n, l, a, p1, p2 ) \ + ENTRY3( n, l, a, p1, p2, 0 ) +#define ENTRY2QQ( n, l, a, n1, l1, n2, l2 ) \ + ENTRY2( n, l, a, XMLTransformerActionInit::QNameParam( n1, l1 ), \ + XMLTransformerActionInit::QNameParam( n2, l2 ) ) +#define ENTRY2QN( n, l, a, n1, l1, p2 ) \ + ENTRY2( n, l, a, XMLTransformerActionInit::QNameParam( n1, l1 ), p2 ) + +#define ENTRY1( n, l, a, p1 ) \ + ENTRY3( n, l, a, p1, 0, 0 ) +#define ENTRY1Q( n, l, a, p1, t1 ) \ + ENTRY1( n, l, a, XMLTransformerActionInit::QNameParam( p1, t1 ) ) + +#define ENTRY0( n, l, a ) \ + ENTRY3( n, l, a, 0, 0, 0 ) + +// BM: a macro to put two tokens into one sal_Int32 for the action +// XML_ATACTION_RENAME_ATTRIBUTE +#define RENAME_ENTRY( f, s ) \ + (static_cast< sal_Int32 >(f) | (static_cast< sal_Int32 >(s) << 16)) + +static XMLTransformerActionInit aActionTable[] = +{ + // add office:class from <office:document> and <office:document-content> + ENTRY0( OFFICE, DOCUMENT, XML_ETACTION_DOCUMENT ), + ENTRY0( OFFICE, DOCUMENT_CONTENT, XML_ETACTION_DOCUMENT ), + ENTRY1Q( OOO, AUTO_TEXT_EVENTS, XML_ETACTION_RENAME_ELEM, + XML_NAMESPACE_OFFICE, XML_AUTO_TEXT_EVENTS), + + // add <meta:keywords> + ENTRY0( OFFICE, META, XML_ETACTION_META ), + + // rename <office:scripts> to <office:script> + ENTRY1Q( OFFICE, SCRIPTS, XML_ETACTION_RENAME_ELEM, + XML_NAMESPACE_OFFICE, XML_SCRIPT ), + + // rename <office:script> to <office:script-data> and process attributes + ENTRY2QN( OFFICE, SCRIPT, XML_ETACTION_RENAME_ELEM_PROC_ATTRS, + XML_NAMESPACE_OFFICE, XML_SCRIPT_DATA, + OASIS_SCRIPT_ACTIONS ), + + // rename <ooo:libraries> to <script:libraries> + ENTRY1Q( OOO, LIBRARIES, XML_ETACTION_RENAME_ELEM, + XML_NAMESPACE_SCRIPT, XML_LIBRARIES ), + + // rename <ooo:library-linked> to <script:library-linked> and process attributes + ENTRY2QN( OOO, LIBRARY_LINKED, XML_ETACTION_RENAME_ELEM_PROC_ATTRS, + XML_NAMESPACE_SCRIPT, XML_LIBRARY_LINKED, + OASIS_SCRIPT_ACTIONS ), + + // rename <ooo:library-embedded> to <script:library-embedded> and process attributes + ENTRY2QN( OOO, LIBRARY_EMBEDDED, XML_ETACTION_RENAME_ELEM_PROC_ATTRS, + XML_NAMESPACE_SCRIPT, XML_LIBRARY_EMBEDDED, + OASIS_SCRIPT_ACTIONS ), + + // rename <ooo:module> to <script:module> and process attributes + ENTRY2QN( OOO, MODULE, XML_ETACTION_RENAME_ELEM_PROC_ATTRS, + XML_NAMESPACE_SCRIPT, XML_MODULE, + OASIS_SCRIPT_ACTIONS ), + + // rename <ooo:source-code> to <script:source-code> + ENTRY1Q( OOO, SOURCE_CODE, XML_ETACTION_RENAME_ELEM, + XML_NAMESPACE_SCRIPT, XML_SOURCE_CODE ), + + ENTRY0( OFFICE, BODY, XML_ETACTION_BODY ), + + // rename <office:font-face-decls> to <office:font-decl>, + // rename <style:font-face> to <style:font-decl>, process attrs + ENTRY1Q( OFFICE, FONT_FACE_DECLS, XML_ETACTION_RENAME_ELEM, + XML_NAMESPACE_OFFICE, XML_FONT_DECLS ), + ENTRY2QN( STYLE, FONT_FACE, XML_ETACTION_RENAME_ELEM_PROC_ATTRS, + XML_NAMESPACE_STYLE, XML_FONT_DECL, + OASIS_FONT_FACE_ACTIONS ), + + // remove genre element + ENTRY0( OFFICE, TEXT, XML_ETACTION_COPY_CONTENT ), + ENTRY0( OFFICE, DRAWING, XML_ETACTION_COPY_CONTENT ), + ENTRY0( OFFICE, PRESENTATION, XML_ETACTION_COPY_CONTENT ), + ENTRY0( OFFICE, SPREADSHEET, XML_ETACTION_COPY_CONTENT ), + ENTRY0( OFFICE, CHART, XML_ETACTION_COPY_CONTENT ), + ENTRY0( OFFICE, IMAGE, XML_ETACTION_COPY_CONTENT ), + + // rename <style:page-layout> to <style:page-master> + // ENTRY1Q( STYLE, PAGE_LAYOUT, RENAME_ELEM, + // XML_NAMESPACE_STYLE, XML_PAGE_MASTER ), + ENTRY1( STYLE, MASTER_PAGE, XML_ETACTION_PROC_ATTRS, + OASIS_MASTER_PAGE_ACTIONS ), + + // merge <style:*-properties> into <style:properties> and do other + // styles processing + ENTRY1( STYLE, STYLE, XML_ETACTION_STYLE, + XML_FAMILY_TYPE_END ), + ENTRY1( STYLE, DEFAULT_STYLE, XML_ETACTION_STYLE, + XML_FAMILY_TYPE_END ), + ENTRY2QN( STYLE, PAGE_LAYOUT, XML_ETACTION_STYLE_RENAME, + XML_NAMESPACE_STYLE, XML_PAGE_MASTER, + XML_FAMILY_TYPE_PAGE_LAYOUT ), + ENTRY1( NUMBER, NUMBER_STYLE, XML_ETACTION_STYLE, + XML_FAMILY_TYPE_DATA ), + ENTRY1( NUMBER, CURRENCY_STYLE, XML_ETACTION_STYLE, + XML_FAMILY_TYPE_DATA ), + ENTRY1( NUMBER, PERCENTAGE_STYLE, XML_ETACTION_STYLE, + XML_FAMILY_TYPE_DATA ), + ENTRY1( NUMBER, DATE_STYLE, XML_ETACTION_STYLE, + XML_FAMILY_TYPE_DATA ), + ENTRY1( NUMBER, TIME_STYLE, XML_ETACTION_STYLE, + XML_FAMILY_TYPE_DATA ), + ENTRY1( NUMBER, BOOLEAN_STYLE, XML_ETACTION_STYLE, + XML_FAMILY_TYPE_DATA ), + ENTRY1( NUMBER, TEXT_STYLE, XML_ETACTION_STYLE, + XML_FAMILY_TYPE_DATA ), + ENTRY1( TEXT, LIST_STYLE, XML_ETACTION_STYLE, + XML_FAMILY_TYPE_LIST ), +// ENTRY0( TEXT, OUTLINE_STYLE, STYLE ), + + ENTRY1( STYLE, HEADER_STYLE, XML_ETACTION_STYLE, + XML_FAMILY_TYPE_HEADER_FOOTER ), + ENTRY1( STYLE, FOOTER_STYLE, XML_ETACTION_STYLE, + XML_FAMILY_TYPE_HEADER_FOOTER ), + ENTRY1( TEXT, LIST_LEVEL_STYLE_NUMBER, XML_ETACTION_STYLE, + XML_FAMILY_TYPE_LIST ), + ENTRY1( TEXT, LIST_LEVEL_STYLE_BULLET, XML_ETACTION_STYLE, + XML_FAMILY_TYPE_LIST ), + ENTRY1( TEXT, LIST_LEVEL_STYLE_IMAGE, XML_ETACTION_STYLE, + XML_FAMILY_TYPE_LIST ), + ENTRY1( TEXT, OUTLINE_LEVEL_STYLE, XML_ETACTION_STYLE, + XML_FAMILY_TYPE_LIST ), + ENTRY1( DRAW, GRADIENT, XML_ETACTION_STYLE, + XML_FAMILY_TYPE_GRADIENT ), + ENTRY1( DRAW, FILL_IMAGE, XML_ETACTION_STYLE, + XML_FAMILY_TYPE_FILL_IMAGE ), + ENTRY2QN( DRAW, OPACITY, XML_ETACTION_STYLE_RENAME, + XML_NAMESPACE_DRAW, XML_TRANSPARENCY, + XML_FAMILY_TYPE_GRADIENT ), + ENTRY1( DRAW, MARKER, XML_ETACTION_STYLE, + XML_FAMILY_TYPE_MARKER ), + ENTRY1( DRAW, HATCH, XML_ETACTION_STYLE, + XML_FAMILY_TYPE_HATCH ), + ENTRY1( DRAW, STROKE_DASH, XML_ETACTION_STYLE, + XML_FAMILY_TYPE_STROKE_DASH ), + + // process <text:h/p>: process style-name attributes, + // rename <text:h>'s text:outline-level to text:level, + ENTRY1( TEXT, H, XML_ETACTION_PROC_ATTRS, OASIS_PARA_ACTIONS ), + ENTRY1( TEXT, P, XML_ETACTION_PROC_ATTRS, OASIS_PARA_ACTIONS ), + + // process <test:list>'s text:style-name attributes + // rename <text:list> to <text:ordered-list> or <text:unordered-list> + // TODO: All list currenty are renamed to <text:ordered-list> + ENTRY2QN( TEXT, LIST, XML_ETACTION_RENAME_ELEM_PROC_ATTRS, + XML_NAMESPACE_TEXT, XML_ORDERED_LIST, + OASIS_LIST_STYLE_REF_ACTIONS ), + + // rename <text:note*> to <text:footnote*> or <text:endnote*> + ENTRY1( TEXT, NOTES_CONFIGURATION, XML_ETACTION_NOTES, + XML_NOTES_CONFIGURATION), + ENTRY1( TEXT, NOTE, XML_ETACTION_NOTES, XML_NOTE ), + + // rename <text:footnote> and <text:endnote> to <text:note> + ENTRY1( TEXT, NOTE_REF, XML_ETACTION_NOTES, XML_NOTE_REF ), + + // rename <text:tab> to <text:tab-stop> + ENTRY1Q( TEXT, TAB, XML_ETACTION_RENAME_ELEM, + XML_NAMESPACE_TEXT, XML_TAB_STOP ), + + + // replace <table:table tabke:is-sub-table> with <table:sub-table> + ENTRY0( TABLE, TABLE, XML_ETACTION_TABLE ), + + // merge frame element + ENTRY0( DRAW, FRAME, XML_ETACTION_FRAME ), + + // process events + ENTRY1Q( OFFICE, EVENT_LISTENERS, XML_ETACTION_RENAME_ELEM, + XML_NAMESPACE_OFFICE, XML_EVENTS ), + ENTRY0( SCRIPT, EVENT_LISTENER, XML_ETACTION_EVENT ), + ENTRY0( SCRIPT, EVENT, XML_ETACTION_EVENT ), + ENTRY0( PRESENTATION, EVENT_LISTENER, XML_ETACTION_EVENT ), + + // process Basic dialogs + ENTRY0( DLG, STYLE, XML_ETACTION_DLG ), + + // process length attributes + ENTRY1( DRAW, RECT, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + ENTRY1( DRAW, LINE, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + ENTRY1( DRAW, POLYLINE, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + ENTRY1( DRAW, POLYGON, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + ENTRY1( DRAW, PATH, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + ENTRY1( DRAW, CIRCLE, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + ENTRY1( DRAW, ELLIPSE, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + ENTRY1( DRAW, CONNECTOR, XML_ETACTION_PROC_ATTRS, OASIS_CONNECTOR_ACTIONS ), + ENTRY1( DRAW, CAPTION, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + ENTRY1( DRAW, MEASURE, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + ENTRY1( DRAW, CONTROL, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + ENTRY1( DRAW, PAGE_THUMBNAIL, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + ENTRY1( DRAW, G, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), +// ENTRY1( DRAW, FRAME, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + ENTRY1( DRAW, TEXT_BOX, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + ENTRY1( PRESENTATION, PLACEHOLDER, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + ENTRY1( DRAW, CONTOUR_POLYGON, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + ENTRY1( DRAW, CONTOUR_PATH, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + ENTRY1( DRAW, AREA_RECTANGLE, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + ENTRY1( DRAW, AREA_CIRCLE, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + ENTRY1( DRAW, AREA_POLYGON, XML_ETACTION_PROC_ATTRS, OASIS_DRAW_AREA_POLYGON_ACTIONS ), + ENTRY1( DRAW, GLUE_POINT, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + ENTRY1( DR3D, SCENE, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + ENTRY1( DR3D, CUBE, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + ENTRY1( DR3D, SPHERE, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + ENTRY1( DR3D, EXTRUDE, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + ENTRY1( DR3D, ROTATE, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + ENTRY1( CHART, TITLE, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + ENTRY1( CHART, SUBTITLE, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + ENTRY1( CHART, FOOTER, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + ENTRY1( CHART, LEGEND, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + ENTRY1( CHART, WALL, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + ENTRY1( CHART, FLOOR, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + ENTRY1( CHART, AXIS, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + ENTRY1( CHART, GRID, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + ENTRY1( CHART, SERIES, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + ENTRY1( CHART, DATA_POINT, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + ENTRY1( CHART, MEAN_VALUE, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + ENTRY1( CHART, ERROR_INDICATOR, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + ENTRY1( CHART, REGRESSION_CURVE, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + ENTRY1( CHART, STOCK_GAIN_MARKER, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + ENTRY1( CHART, STOCK_LOSS_MARKER, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + ENTRY1( CHART, STOCK_RANGE_LINE, XML_ETACTION_PROC_ATTRS, OASIS_SHAPE_ACTIONS ), + + ENTRY0( CHART, CHART, XML_ETACTION_CHART ), + ENTRY0( CHART, PLOT_AREA, XML_ETACTION_CHART_PLOT_AREA ), + + ENTRY0( CONFIG, CONFIG_ITEM, XML_ETACTION_CONFIG_ITEM ), + ENTRY1Q( TEXT, TRACKED_CHANGES, XML_ETACTION_TRACKED_CHANGES, + XML_NAMESPACE_TEXT, XML_PROTECTION_KEY ), + ENTRY1Q( TABLE, TRACKED_CHANGES, XML_ETACTION_TRACKED_CHANGES, + XML_NAMESPACE_TABLE, XML_PROTECTION_KEY ), + + ENTRY1( TEXT, INDEX_ENTRY_TAB_STOP, XML_ETACTION_PROC_ATTRS, + OASIS_INDEX_ENTRY_TAB_STOP_ACTIONS ), + ENTRY0( STYLE, TAB_STOP, XML_ETACTION_TAB_STOP ), + ENTRY1( STYLE, BACKGROUND_IMAGE, XML_ETACTION_PROC_ATTRS, + OASIS_BACKGROUND_IMAGE_ACTIONS ), + ENTRY1( TEXT, LINENUMBERING_CONFIGURATION, XML_ETACTION_PROC_ATTRS, + OASIS_LINENUMBERING_ACTIONS ), + ENTRY1( STYLE, FOOTNOTE_SEP, XML_ETACTION_PROC_ATTRS, + OASIS_FOOTNOTE_SEP_ACTIONS ), + ENTRY1( STYLE, DROP_CAP, XML_ETACTION_PROC_ATTRS, OASIS_DROP_CAP_ACTIONS ), + ENTRY1( STYLE, COLUMNS, XML_ETACTION_PROC_ATTRS, OASIS_COLUMNS_ACTIONS ), + ENTRY1( STYLE, COLUMN, XML_ETACTION_PROC_ATTRS, OASIS_COLUMNS_ACTIONS ), + + // process *:style-name attributes + ENTRY1( STYLE, MAP, XML_ETACTION_PROC_ATTRS, OASIS_MAP_STYLE_REF_ACTIONS ), + ENTRY1( TEXT, SPAN, XML_ETACTION_PROC_ATTRS, OASIS_TEXT_STYLE_REF_ACTIONS ), + ENTRY1( TEXT, A, XML_ETACTION_PROC_ATTRS, OASIS_TEXT_STYLE_REF_ACTIONS ), + ENTRY1( TEXT, RUBY_TEXT, XML_ETACTION_PROC_ATTRS, + OASIS_TEXT_STYLE_REF_ACTIONS ), + ENTRY1( TEXT, TABLE_OF_CONTENT_ENTRY_TEMPLATE, XML_ETACTION_PROC_ATTRS, + OASIS_PARA_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, ILLUSTRATION_INDEX_ENTRY_TEMPLATE, XML_ETACTION_PROC_ATTRS, + OASIS_PARA_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, TABLE_INDEX_ENTRY_TEMPLATE, XML_ETACTION_PROC_ATTRS, + OASIS_PARA_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, OBJECT_INDEX_ENTRY_TEMPLATE, XML_ETACTION_PROC_ATTRS, + OASIS_PARA_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, USER_INDEX_ENTRY_TEMPLATE, XML_ETACTION_PROC_ATTRS, + OASIS_PARA_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, ALPHABETICAL_INDEX_ENTRY_TEMPLATE, XML_ETACTION_PROC_ATTRS, + OASIS_PARA_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, BIBLIOGRAPHY_ENTRY_TEMPLATE, XML_ETACTION_PROC_ATTRS, + OASIS_PARA_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, INDEX_SOURCE_STYLE, XML_ETACTION_PROC_ATTRS, + OASIS_PARA_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, INDEX_TITLE_TEMPLATE, XML_ETACTION_PROC_ATTRS, + OASIS_PARA_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY3QNQ( TEXT, INDEX_ENTRY_CHAPTER, + XML_ETACTION_RENAME_ELEM_PROC_ATTRS_COND, + XML_NAMESPACE_TEXT, XML_INDEX_ENTRY_CHAPTER_NUMBER, + OASIS_TEXT_STYLE_REF_ACTIONS , + XML_NAMESPACE_TEXT, XML_TABLE_OF_CONTENT_ENTRY_TEMPLATE), + ENTRY1( TEXT, INDEX_ENTRY_TEXT, XML_ETACTION_PROC_ATTRS, + OASIS_TEXT_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, INDEX_ENTRY_PAGE_NUMBER, XML_ETACTION_PROC_ATTRS, + OASIS_TEXT_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, INDEX_ENTRY_SPAN, XML_ETACTION_PROC_ATTRS, + OASIS_TEXT_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, INDEX_ENTRY_BIBLIOGRAPHY, XML_ETACTION_PROC_ATTRS, + OASIS_TEXT_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, INDEX_ENTRY_LINK_START, XML_ETACTION_PROC_ATTRS, + OASIS_TEXT_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, INDEX_ENTRY_LINK_END, XML_ETACTION_PROC_ATTRS, + OASIS_TEXT_STYLE_REF_ACTIONS ), /* generated entry */ + ENTRY1( DRAW, PAGE, XML_ETACTION_PROC_ATTRS, + OASIS_MASTER_PAGE_REF_ACTIONS ), /* generated entry */ + // --> OD 2005-01-10 #i40011#, #i40015# + // - conversion of attribute <table:style-name> for <table:table-row> and + // <table:table-column> + ENTRY1( TABLE, TABLE_ROW, XML_ETACTION_PROC_ATTRS, + OASIS_TABLE_STYLE_REF_ACTIONS ), + ENTRY1( TABLE, TABLE_COLUMN, XML_ETACTION_PROC_ATTRS, + OASIS_TABLE_STYLE_REF_ACTIONS ), + // <-- + + // rename office:value-* to *:value-* + ENTRY1( TEXT, VARIABLE_DECL, XML_ETACTION_PROC_ATTRS, + OASIS_TEXT_VALUE_TYPE_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, VARIABLE_SET, XML_ETACTION_PROC_ATTRS, + OASIS_TEXT_VALUE_TYPE_ACTIONS), /* generated entry */ + ENTRY1( TEXT, VARIABLE_INPUT, XML_ETACTION_PROC_ATTRS, + OASIS_TEXT_VALUE_TYPE_ACTIONS), /* generated entry */ + ENTRY1( TEXT, USER_FIELD_DECL, XML_ETACTION_PROC_ATTRS, + OASIS_TEXT_VALUE_TYPE_ACTIONS), /* generated entry */ + ENTRY1( TEXT, EXPRESSION, XML_ETACTION_PROC_ATTRS, + OASIS_TEXT_VALUE_TYPE_ACTIONS), /* generated entry */ + ENTRY1( TEXT, USER_DEFINED, XML_ETACTION_PROC_ATTRS, + OASIS_DATETIME_ACTIONS ), // Add OASIS_TEXT_VALUE_TYPE_ACTIONS if attrs are added to text:user-defined + ENTRY1( TABLE, TABLE_CELL, XML_ETACTION_PROC_ATTRS, + OASIS_TABLE_VALUE_TYPE_ACTIONS), /* generated entry */ + ENTRY1( TABLE, COVERED_TABLE_CELL, XML_ETACTION_PROC_ATTRS, + OASIS_TABLE_VALUE_TYPE_ACTIONS), /* generated entry */ + ENTRY1( TABLE, CHANGE_TRACK_TABLE_CELL, XML_ETACTION_PROC_ATTRS, + OASIS_TABLE_VALUE_TYPE_ACTIONS), /* generated entry */ +// ENTRY1( FORM, PROPERTY, XML_ETACTION_PROC_ATTRS, +// OASIS_VALUE_TYPE_ACTIONS), /* TODO: generated entry */ +// ENTRY1( FORM, LIST_PROPERTY, XML_ETACTION_PROC_ATTRS, +// OASIS_VALUE_TYPE_ACTIONS), /* generated entry */ + + ENTRY1( OFFICE, ANNOTATION, XML_ETACTION_MOVE_ELEMS_TO_ATTRS, + OASIS_ANNOTATION_ACTIONS ), /* generated entry */ + ENTRY1( OFFICE, CHANGE_INFO, XML_ETACTION_MOVE_ELEMS_TO_ATTRS, + OASIS_CHANGE_INFO_ACTIONS ), /* generated entry */ + + ENTRY1( TEXT, DDE_CONNECTION_DECL, XML_ETACTION_PROC_ATTRS, + OASIS_DDE_CONNECTION_DECL_ACTIONS ), + + ENTRY0( FORM, TEXT, XML_ETACTION_FORM_CONTROL ), + ENTRY0( FORM, TEXTAREA, XML_ETACTION_FORM_CONTROL ), + ENTRY0( FORM, FIXED_TEXT, XML_ETACTION_FORM_CONTROL ), + ENTRY0( FORM, FILE, XML_ETACTION_FORM_CONTROL ), + ENTRY0( FORM, PASSWORD, XML_ETACTION_FORM_CONTROL ), + ENTRY0( FORM, FORMATTED_TEXT, XML_ETACTION_FORM_CONTROL ), + ENTRY0( FORM, BUTTON, XML_ETACTION_FORM_CONTROL ), + ENTRY0( FORM, IMAGE, XML_ETACTION_FORM_CONTROL ), + ENTRY0( FORM, CHECKBOX, XML_ETACTION_FORM_CONTROL ), + ENTRY0( FORM, RADIO, XML_ETACTION_FORM_CONTROL ), + ENTRY0( FORM, LISTBOX, XML_ETACTION_FORM_CONTROL ), + ENTRY0( FORM, COMBOBOX, XML_ETACTION_FORM_CONTROL ), + ENTRY0( FORM, FRAME, XML_ETACTION_FORM_CONTROL ), + ENTRY0( FORM, HIDDEN, XML_ETACTION_FORM_CONTROL ), + ENTRY0( FORM, IMAGE_FRAME, XML_ETACTION_FORM_CONTROL ), + ENTRY0( FORM, GRID, XML_ETACTION_FORM_CONTROL ), + ENTRY0( FORM, VALUE_RANGE, XML_ETACTION_FORM_CONTROL ), + ENTRY0( FORM, GENERIC_CONTROL, XML_ETACTION_FORM_CONTROL ), + ENTRY1( FORM, COLUMN, XML_ETACTION_PROC_ATTRS, + OASIS_FORM_COLUMN_ACTIONS ), + ENTRY1( FORM, PROPERTY, XML_ETACTION_FORM_PROPERTY, XML_PROPERTY ), + ENTRY1( FORM, LIST_PROPERTY, XML_ETACTION_FORM_PROPERTY, + XML_LIST_PROPERTY ), + ENTRY1( FORM, LIST_VALUE, XML_ETACTION_FORM_PROPERTY, XML_LIST_VALUE ), + + // process xlink:href + ENTRY1( META, TEMPLATE, XML_ETACTION_PROC_ATTRS, + OASIS_XLINK_ACTIONS ), /* generated entry */ + ENTRY1( META, AUTO_RELOAD, XML_ETACTION_PROC_ATTRS, + OASIS_XLINK_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, SECTION_SOURCE, XML_ETACTION_PROC_ATTRS, + OASIS_XLINK_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, SCRIPT, XML_ETACTION_PROC_ATTRS, + OASIS_XLINK_ACTIONS ), /* generated entry */ + ENTRY1( TEXT, ALPHABETICAL_INDEX_AUTO_MARK_FILE, XML_ETACTION_PROC_ATTRS, + OASIS_XLINK_ACTIONS ), /* generated entry */ + ENTRY1( TABLE, TABLE_SOURCE, XML_ETACTION_PROC_ATTRS, + OASIS_XLINK_ACTIONS ), /* generated entry */ + ENTRY1( TABLE, CELL_RANGE_SOURCE, XML_ETACTION_PROC_ATTRS, + OASIS_XLINK_ACTIONS ), /* generated entry */ + ENTRY1( DRAW, A, XML_ETACTION_PROC_ATTRS, + OASIS_XLINK_ACTIONS ), /* generated entry */ + ENTRY1( PRESENTATION, SOUND, XML_ETACTION_PROC_ATTRS, + OASIS_XLINK_ACTIONS ), /* generated entry */ + ENTRY1( FORM, FORM, XML_ETACTION_PROC_ATTRS, + OASIS_FORM_ACTIONS ), /* generated entry */ +// ENTRY1( SVG, FONT_FACE_URI, XML_ETACTION_PROC_ATTRS, +// OASIS_XLINK_ACTIONS ), /* generated entry */ +// ENTRY1( SVG, DEFINITION_SRC, XML_ETACTION_PROC_ATTRS, +// OASIS_XLINK_ACTIONS ), /* generated entry */ + ENTRY2QN( CHART, SYMBOL_IMAGE, XML_ETACTION_RENAME_ELEM_PROC_ATTRS, + XML_NAMESPACE_STYLE, XML_SYMBOL_IMAGE, + OASIS_BACKGROUND_IMAGE_ACTIONS ), +// OASIS_XLINK_ACTIONS ), /* generated entry */ +// events don't have real URIs +// ENTRY1( PRESENTATION, EVENT_LISTENER, XML_ETACTION_PROC_ATTRS, +// OASIS_XLINK_ACTIONS ), /* generated entry */ +// ENTRY1( SCRIPT, EVENT_LISTENER, XML_ETACTION_PROC_ATTRS, +// OASIS_XLINK_ACTIONS ), /* generated entry */ + + // add namespace prefix to name + ENTRY1( CONFIG, CONFIG_ITEM_SET, XML_ETACTION_PROC_ATTRS, + OASIS_CONFIG_ITEM_SET_ACTIONS ), + + // add namespace prefix to formula and condition + // text:condition + ENTRY1( TEXT, SECTION, XML_ETACTION_PROC_ATTRS, + OASIS_FORMULA_ACTIONS ), /* generated entry */ + // text:formula + ENTRY1( TEXT, SEQUENCE, XML_ETACTION_PROC_ATTRS, + OASIS_FORMULA_ACTIONS ), /* generated entry */ + // text:condition + ENTRY1( TEXT, DATABASE_NEXT, XML_ETACTION_PROC_ATTRS, + OASIS_FORMULA_ACTIONS ), /* generated entry */ + // text:condition + ENTRY2QN( TEXT, DATABASE_ROW_SELECT, XML_ETACTION_RENAME_ELEM_PROC_ATTRS, + XML_NAMESPACE_TEXT, XML_DATABASE_SELECT, + OASIS_FORMULA_ACTIONS ), /* generated entry */ + // text:condition + ENTRY1( TEXT, CONDITIONAL_TEXT, XML_ETACTION_PROC_ATTRS, + OASIS_FORMULA_ACTIONS ), /* generated entry */ + // text:condition + ENTRY1( TEXT, HIDDEN_TEXT, XML_ETACTION_PROC_ATTRS, + OASIS_FORMULA_ACTIONS ), /* generated entry */ + // text:condition + ENTRY1( TEXT, HIDDEN_PARAGRAPH, XML_ETACTION_PROC_ATTRS, + OASIS_FORMULA_ACTIONS ), /* generated entry */ + // text:formula + ENTRY1( TEXT, TABLE_FORMULA, XML_ETACTION_PROC_ATTRS, + OASIS_FORMULA_ACTIONS ), /* generated entry */ + + // process table::content-validation + ENTRY1( TABLE, CONTENT_VALIDATION, XML_ETACTION_PROC_ATTRS, + OASIS_CONTENT_VALIDATION_ACTIONS ), + + // rename <table:dependencies> to <table:dependences> + ENTRY1Q( TABLE, DEPENDENCIES, XML_ETACTION_RENAME_ELEM, + XML_NAMESPACE_TABLE, XML_DEPENDENCES ), + ENTRY1Q( TABLE, DEPENDENCY, XML_ETACTION_RENAME_ELEM, + XML_NAMESPACE_TABLE, XML_DEPENDENCE ), + + // process table::conversion-mode + ENTRY1( TABLE, CONVERSION_MODE, XML_ETACTION_PROC_ATTRS, + OASIS_DDE_CONV_MODE_ACTIONS ), + + // process table::data-pilot-member + ENTRY1( TABLE, DATA_PILOT_MEMBER, XML_ETACTION_PROC_ATTRS, + OASIS_DATAPILOT_MEMBER_ACTIONS ), + + // process table::data-pilot-level + ENTRY1( TABLE, DATA_PILOT_LEVEL, XML_ETACTION_PROC_ATTRS, + OASIS_DATAPILOT_LEVEL_ACTIONS ), + + // process table::source-service + ENTRY1( TABLE, SOURCE_SERVICE, XML_ETACTION_PROC_ATTRS, + OASIS_SOURCE_SERVICE_ACTIONS ), + + // entries for date time change (#i36576#) + ENTRY1( TEXT, DATE, XML_ETACTION_PROC_ATTRS, OASIS_DATETIME_ACTIONS ), + ENTRY1( TEXT, CREATION_DATE, XML_ETACTION_PROC_ATTRS, + OASIS_DATETIME_ACTIONS ), + ENTRY1( TEXT, TIME, XML_ETACTION_PROC_ATTRS, OASIS_DATETIME_ACTIONS ), + ENTRY1( TEXT, CREATION_TIME, XML_ETACTION_PROC_ATTRS, + OASIS_DATETIME_ACTIONS ), + ENTRY1( TEXT, PRINT_TIME, XML_ETACTION_PROC_ATTRS, OASIS_DATETIME_ACTIONS ), + ENTRY1( TEXT, MODIFICATION_TIME, XML_ETACTION_PROC_ATTRS, + OASIS_DATETIME_ACTIONS ), + ENTRY1( TEXT, EDITING_DURATION, XML_ETACTION_PROC_ATTRS, + OASIS_DATETIME_ACTIONS ), + ENTRY1( FORM, TIME, XML_ETACTION_PROC_ATTRS, OASIS_DATETIME_ACTIONS ), + ENTRY1( PRESENTATION, SETTINGS, XML_ETACTION_PROC_ATTRS, + OASIS_DATETIME_ACTIONS ), + + // fix <text:alphabatical-index-mark text:main-etry> + ENTRY1( TEXT, ALPHABETICAL_INDEX_MARK, XML_ETACTION_PROC_ATTRS, + OASIS_ALPHABETICAL_INDEX_MARK_ACTIONS ), + ENTRY1( TEXT, ALPHABETICAL_INDEX_MARK_START, XML_ETACTION_PROC_ATTRS, + OASIS_ALPHABETICAL_INDEX_MARK_ACTIONS ), + + // fix id strings in old animation elements + ENTRY1( PRESENTATION, DIM, XML_ETACTION_PROC_ATTRS, OASIS_ANIMATION_ACTIONS ), + ENTRY1( PRESENTATION, PLAY, XML_ETACTION_PROC_ATTRS, OASIS_ANIMATION_ACTIONS ), + ENTRY1( PRESENTATION, SHOW_TEXT, XML_ETACTION_PROC_ATTRS, OASIS_ANIMATION_ACTIONS ), + ENTRY1( PRESENTATION, SHOW_SHAPE, XML_ETACTION_PROC_ATTRS, OASIS_ANIMATION_ACTIONS ), + ENTRY1( PRESENTATION, HIDE_TEXT, XML_ETACTION_PROC_ATTRS, OASIS_ANIMATION_ACTIONS ), + ENTRY1( PRESENTATION, HIDE_SHAPE, XML_ETACTION_PROC_ATTRS, OASIS_ANIMATION_ACTIONS ), + + ENTRY0( OFFICE, TOKEN_INVALID, XML_ETACTION_EOT ) +}; + +// XML_ETACTION_STYLE +static XMLTransformerActionInit aStyleActionTable[] = +{ + ENTRY0( STYLE, FAMILY, XML_ATACTION_STYLE_FAMILY ), + ENTRY1( STYLE, NAME, XML_ATACTION_DECODE_STYLE_NAME, + XML_FAMILY_TYPE_END ), + ENTRY1( STYLE, DISPLAY_NAME, XML_ATACTION_STYLE_DISPLAY_NAME, + XML_FAMILY_TYPE_END ), + ENTRY1( STYLE, PARENT_STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, + XML_FAMILY_TYPE_END ), + ENTRY1( STYLE, NEXT_STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, + XML_FAMILY_TYPE_END ), + ENTRY1( STYLE, LIST_STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, + XML_FAMILY_TYPE_LIST ), + ENTRY1( STYLE, MASTER_PAGE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, + XML_FAMILY_TYPE_MASTER_PAGE ), + ENTRY0( STYLE, DEFAULT_OUTLINE_LEVEL, XML_ATACTION_REMOVE ), + ENTRY1( TEXT, STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, + XML_FAMILY_TYPE_TEXT ), // list level styles + ENTRY1( DRAW, NAME, XML_ATACTION_DECODE_STYLE_NAME, + XML_FAMILY_TYPE_END ), + ENTRY1( DRAW, DISPLAY_NAME, XML_ATACTION_STYLE_DISPLAY_NAME, + XML_FAMILY_TYPE_END ), + ENTRY0( DRAW, DISTANCE, XML_ATACTION_IN2INCH ), + ENTRY0( DRAW, DOTS1_LENGTH, XML_ATACTION_IN2INCH ), + ENTRY0( DRAW, DOTS2_LENGTH, XML_ATACTION_IN2INCH ), + ENTRY0( SVG, WIDTH, XML_ATACTION_IN2INCH ), + ENTRY0( SVG, HEIGHT, XML_ATACTION_IN2INCH ), + ENTRY0( DRAW, START, XML_ATACTION_NEG_PERCENT ), + ENTRY0( DRAW, END, XML_ATACTION_NEG_PERCENT ), + ENTRY1( XLINK, HREF, XML_ATACTION_URI_OASIS, sal_True ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_FRAME_ELEM_ACTIONS +static XMLTransformerActionInit aFrameActionTable[] = +{ + ENTRY0( DRAW, TEXT_BOX, XML_ETACTION_COPY ), + ENTRY0( DRAW, IMAGE, XML_ETACTION_COPY ), + ENTRY0( DRAW, OBJECT, XML_ETACTION_COPY ), + ENTRY0( DRAW, OBJECT_OLE, XML_ETACTION_COPY ), + ENTRY0( DRAW, APPLET, XML_ETACTION_COPY ), + ENTRY0( DRAW, PLUGIN, XML_ETACTION_COPY ), + ENTRY0( DRAW, FLOATING_FRAME, XML_ETACTION_COPY ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_EVENT_ELEM_ACTIONS +static XMLTransformerActionInit aEventActionTable[] = +{ + ENTRY0( XLINK, HREF, XML_ATACTION_HREF ), + ENTRY1( SCRIPT, LANGUAGE, XML_ATACTION_REMOVE_NAMESPACE_PREFIX, + XML_NAMESPACE_OOO ), + ENTRY0( SCRIPT, EVENT_NAME, XML_ATACTION_EVENT_NAME ), + ENTRY0( SCRIPT, MACRO_NAME, XML_ATACTION_MACRO_NAME ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_EVENT_ELEM_ACTIONS +static XMLTransformerActionInit aDlgActionTable[] = +{ + ENTRY0( DLG, BORDER, XML_ATACTION_DLG_BORDER ) +}; + +// action table for OASIS_MASTER_PAGE_ACTIONS +static XMLTransformerActionInit aMasterPageActionTable[] = +{ + ENTRY1( STYLE, NAME, XML_ATACTION_DECODE_STYLE_NAME, + XML_FAMILY_TYPE_MASTER_PAGE ), + ENTRY1( STYLE, DISPLAY_NAME, XML_ATACTION_STYLE_DISPLAY_NAME, + XML_FAMILY_TYPE_MASTER_PAGE ), + ENTRY1( STYLE, NEXT_STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, + XML_FAMILY_TYPE_MASTER_PAGE ), + ENTRY1Q( STYLE, PAGE_LAYOUT_NAME, XML_ATACTION_RENAME, + XML_NAMESPACE_STYLE, XML_PAGE_MASTER_NAME ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// action table for OASIS_TEXT_STYLE_REF_ACTIONS +static XMLTransformerActionInit aTextStyleRefActionTable[] = +{ + ENTRY1( TEXT, STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, + XML_FAMILY_TYPE_TEXT ), + ENTRY1( TEXT, VISITED_STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, + XML_FAMILY_TYPE_TEXT ), + ENTRY1( XLINK, HREF, XML_ATACTION_URI_OASIS, sal_False ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// action table for OASIS_PARA_STYLE_REF_ACTIONS +static XMLTransformerActionInit aParaStyleRefActionTable[] = +{ + ENTRY1( TEXT, STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, + XML_FAMILY_TYPE_PARAGRAPH ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + + +// action table for OASIS_LIST_STYLE_REF_ACTIONS +static XMLTransformerActionInit aListStyleRefActionTable[] = +{ + ENTRY1( TEXT, STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, + XML_FAMILY_TYPE_LIST ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// action table for OASIS_MASTER_PAGE_REF_ACTIONS +static XMLTransformerActionInit aMasterPageRefActionTable[] = +{ + ENTRY1( DRAW, MASTER_PAGE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, + XML_FAMILY_TYPE_MASTER_PAGE ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// action table for OASIS_MAP_STYLE_REF_ACTIONS +static XMLTransformerActionInit aMapStyleRefActionTable[] = +{ + ENTRY1( STYLE, APPLY_STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, + XML_FAMILY_TYPE_END ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// --> OD 2005-01-10 #i40011#, #i40015# +// action table for OASIS_TABLE_STYLE_REF_ACTIONS +static XMLTransformerActionInit aTableStyleRefActionTable[] = +{ + ENTRY1( TABLE, STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, + XML_FAMILY_TYPE_END ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; +// <-- + + +static XMLTransformerActionInit aFontFaceActionTable[] = +{ + ENTRY1Q( SVG, FONT_FAMILY, XML_ATACTION_RENAME, + XML_NAMESPACE_FO, XML_FONT_FAMILY ), + ENTRY1Q( STYLE, FONT_ADORNMENTS, XML_ATACTION_RENAME, + XML_NAMESPACE_STYLE, XML_FONT_STYLE_NAME ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// action table for OASIS_PARA_ACTIONS +static XMLTransformerActionInit aParaActionTable[] = +{ + ENTRY1( TEXT, STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, + XML_FAMILY_TYPE_PARAGRAPH ), + ENTRY1( TEXT, COND_STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, + XML_FAMILY_TYPE_PARAGRAPH ), + ENTRY1Q( TEXT, OUTLINE_LEVEL, XML_ATACTION_RENAME, + XML_NAMESPACE_TEXT, XML_LEVEL ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// !!ATTENTION!! If you change something here, please also change +// aConnectorActionTable if apropriate +static XMLTransformerActionInit aShapeActionTable[] = +{ + ENTRY1( DRAW, STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, + XML_FAMILY_TYPE_GRAPHIC ), + ENTRY1( DRAW, TEXT_STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, + XML_FAMILY_TYPE_PARAGRAPH ), + ENTRY1( PRESENTATION, STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, + XML_FAMILY_TYPE_PRESENTATION ), + ENTRY0( SVG, X, XML_ATACTION_IN2INCH ), + ENTRY0( SVG, Y, XML_ATACTION_IN2INCH ), + ENTRY0( SVG, X1, XML_ATACTION_IN2INCH ), + ENTRY0( SVG, Y1, XML_ATACTION_IN2INCH ), + ENTRY0( SVG, X2, XML_ATACTION_IN2INCH ), + ENTRY0( SVG, Y2, XML_ATACTION_IN2INCH ), + ENTRY0( SVG, CX, XML_ATACTION_IN2INCH ), + ENTRY0( SVG, CY, XML_ATACTION_IN2INCH ), + ENTRY0( DRAW, END_X, XML_ATACTION_IN2INCH ), + ENTRY0( DRAW, END_Y, XML_ATACTION_IN2INCH ), + ENTRY0( SVG, R, XML_ATACTION_IN2INCH ), + ENTRY0( SVG, RX, XML_ATACTION_IN2INCH ), + ENTRY0( SVG, RY, XML_ATACTION_IN2INCH ), + ENTRY0( SVG, WIDTH, XML_ATACTION_SVG_WIDTH_HEIGHT_OASIS ), + ENTRY0( SVG, HEIGHT, XML_ATACTION_SVG_WIDTH_HEIGHT_OASIS ), + ENTRY0( FO, MIN_WIDTH, XML_ATACTION_IN2INCH ), + ENTRY0( FO, MIN_HEIGHT, XML_ATACTION_IN2INCH ), + ENTRY0( FO, MAX_WIDTH, XML_ATACTION_IN2INCH ), + ENTRY0( FO, MAX_HEIGHT, XML_ATACTION_IN2INCH ), + ENTRY0( DRAW, CORNER_RADIUS, XML_ATACTION_IN2INCH ), + ENTRY0( DRAW, LINE_SKEW, XML_ATACTION_INS2INCHS ), + ENTRY0( DRAW, CAPTION_POINT_X, XML_ATACTION_IN2INCH ), + ENTRY0( DRAW, CAPTION_POINT_Y, XML_ATACTION_IN2INCH ), + ENTRY0( DR3D, DISTANCE, XML_ATACTION_IN2INCH ), + ENTRY0( DR3D, FOCAL_LENGTH, XML_ATACTION_IN2INCH ), + ENTRY1Q( DRAW, CONTROL, XML_ATACTION_RENAME, + XML_NAMESPACE_FORM, XML_ID ), + ENTRY1( XLINK, HREF, XML_ATACTION_URI_OASIS, sal_True ), + + // BM: needed by chart:legend. The legend needs also the draw actions. As + // there is no merge mechanism, all actions have to be in the same table + ENTRY2( CHART, LEGEND_POSITION, XML_ATACTION_RENAME_ATTRIBUTE, + RENAME_ENTRY( XML_START, XML_LEFT ), + RENAME_ENTRY( XML_END, XML_RIGHT )), + + ENTRY0( DRAW, ID, XML_ATACTION_DECODE_ID ), + + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_ANIMATION_ACTIONS +static XMLTransformerActionInit aAnimationActionTable[] = +{ + ENTRY0( DRAW, SHAPE_ID, XML_ATACTION_DECODE_ID ), + ENTRY0( PRESENTATION, DELAY, XML_ATACTION_RNG2ISO_DATETIME ), + ENTRY0( PRESENTATION, PAUSE, XML_ATACTION_RNG2ISO_DATETIME ), + + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OOO_CONNECTOR_ACTIONS +static XMLTransformerActionInit aConnectorActionTable[] = +{ + ENTRY1( DRAW, STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, + XML_FAMILY_TYPE_GRAPHIC ), + ENTRY1( DRAW, TEXT_STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, + XML_FAMILY_TYPE_PARAGRAPH ), + ENTRY1( PRESENTATION, STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, + XML_FAMILY_TYPE_PRESENTATION ), + ENTRY0( SVG, X1, XML_ATACTION_IN2TWIPS ), + ENTRY0( SVG, Y1, XML_ATACTION_IN2TWIPS ), + ENTRY0( SVG, X2, XML_ATACTION_IN2TWIPS ), + ENTRY0( SVG, Y2, XML_ATACTION_IN2TWIPS ), + ENTRY0( DRAW, END_X, XML_ATACTION_IN2INCH ), + ENTRY0( DRAW, END_Y, XML_ATACTION_IN2INCH ), + ENTRY0( SVG, WIDTH, XML_ATACTION_SVG_WIDTH_HEIGHT_OASIS ), + ENTRY0( SVG, HEIGHT, XML_ATACTION_SVG_WIDTH_HEIGHT_OASIS ), + ENTRY0( FO, MIN_WIDTH, XML_ATACTION_IN2INCH ), + ENTRY0( FO, MIN_HEIGHT, XML_ATACTION_IN2INCH ), + ENTRY0( FO, MAX_WIDTH, XML_ATACTION_IN2INCH ), + ENTRY0( FO, MAX_HEIGHT, XML_ATACTION_IN2INCH ), + ENTRY0( DRAW, LINE_SKEW, XML_ATACTION_INS2INCHS ), + ENTRY1Q( DRAW, CONTROL, XML_ATACTION_RENAME, + XML_NAMESPACE_FORM, XML_ID ), + ENTRY1( XLINK, HREF, XML_ATACTION_URI_OASIS, sal_True ), + ENTRY0( DRAW, START_SHAPE, XML_ATACTION_DECODE_ID ), + ENTRY0( DRAW, END_SHAPE, XML_ATACTION_DECODE_ID ), + + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_INDEX_ENTRY_TAB_STOP_ACTIONS +static XMLTransformerActionInit aIndexEntryTabStopActionTable[] = +{ + ENTRY0( STYLE, POSITION, XML_ATACTION_IN2INCH ), + ENTRY1( TEXT, STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, + XML_FAMILY_TYPE_TEXT ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_TAB_STOP_ACTIONS +static XMLTransformerActionInit aTabStopActionTable[] = +{ + ENTRY0( STYLE, POSITION, XML_ATACTION_IN2INCH ), + ENTRY1Q( STYLE, LEADER_TEXT, XML_ATACTION_RENAME, + XML_NAMESPACE_STYLE, XML_LEADER_CHAR ), + ENTRY0( STYLE, LEADER_STYLE, XML_ATACTION_REMOVE ), + ENTRY0( STYLE, LEADER_TYPE, XML_ATACTION_REMOVE ), + ENTRY0( STYLE, LEADER_WIDTH, XML_ATACTION_REMOVE ), + ENTRY0( STYLE, LEADER_COLOR, XML_ATACTION_REMOVE ), + ENTRY0( STYLE, LEADER_TEXT_STYLE, XML_ATACTION_REMOVE ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_LINENUMBERING_ACTIONS +static XMLTransformerActionInit aLineNumberingActionTable[] = +{ + ENTRY0( TEXT, OFFSET, XML_ATACTION_IN2INCH ), + ENTRY1( TEXT, STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, + XML_FAMILY_TYPE_TEXT ), + ENTRY1Q( TEXT, COUNT_IN_TEXT_BOXES , XML_ATACTION_RENAME, + XML_NAMESPACE_TEXT, XML_COUNT_IN_FLOATING_FRAMES), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +static XMLTransformerActionInit aFootnoteSepActionTable[] = +{ + ENTRY0( STYLE, WIDTH, XML_ATACTION_IN2INCH ), + ENTRY0( STYLE, DISTANCE_BEFORE_SEP, XML_ATACTION_IN2INCH ), + ENTRY0( STYLE, DISTANCE_AFTER_SEP, XML_ATACTION_IN2INCH ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_NOTES_ACTIONS (processed by special context) +static XMLTransformerActionInit aNotesActionTable[] = +{ + ENTRY0( TEXT, NOTE_CLASS, XML_ATACTION_STYLE_FAMILY ), + ENTRY1( TEXT, CITATION_STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, + XML_FAMILY_TYPE_TEXT ), + ENTRY1( TEXT, CITATION_BODY_STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, + XML_FAMILY_TYPE_TEXT ), + ENTRY1( TEXT, DEFAULT_STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, + XML_FAMILY_TYPE_PARAGRAPH ), + ENTRY1( TEXT, MASTER_PAGE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, + XML_FAMILY_TYPE_MASTER_PAGE ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_DROP_CAP_ACTIONS +static XMLTransformerActionInit aDropCapActionTable[] = +{ + ENTRY0( STYLE, DISTANCE, XML_ATACTION_IN2INCH ), + ENTRY1( STYLE, STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, + XML_FAMILY_TYPE_TEXT ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +static XMLTransformerActionInit aColumnsActionTable[] = +{ + ENTRY0( STYLE, COLUMN_GAP, XML_ATACTION_IN2INCH ), + ENTRY0( STYLE, SPACE_BEFORE, XML_ATACTION_REMOVE ), + ENTRY0( STYLE, SPACE_AFTER, XML_ATACTION_REMOVE ), + ENTRY1Q( FO, START_INDENT, XML_ATACTION_RENAME_IN2INCH, + XML_NAMESPACE_FO, XML_MARGIN_LEFT ), + ENTRY1Q( FO, END_INDENT, XML_ATACTION_RENAME_IN2INCH, + XML_NAMESPACE_FO, XML_MARGIN_RIGHT ), + ENTRY0( STYLE, WIDTH, XML_ATACTION_IN2INCH ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_TEXT_VALUE_TYPE_ACTIONS +static XMLTransformerActionInit aTextValueTypeActionTable[] = +{ + ENTRY1Q( OFFICE, VALUE_TYPE, XML_ATACTION_RENAME, + XML_NAMESPACE_TEXT, XML_VALUE_TYPE ), + ENTRY1Q( OFFICE, VALUE, XML_ATACTION_RENAME, + XML_NAMESPACE_TEXT, XML_VALUE ), + ENTRY1Q( OFFICE, CURRENCY, XML_ATACTION_RENAME, + XML_NAMESPACE_TEXT, XML_CURRENCY ), + ENTRY1Q( OFFICE, DATE_VALUE, XML_ATACTION_RENAME_RNG2ISO_DATETIME, + XML_NAMESPACE_TEXT, XML_DATE_VALUE ), + ENTRY1Q( OFFICE, TIME_VALUE, XML_ATACTION_RENAME_RNG2ISO_DATETIME, + XML_NAMESPACE_TEXT, XML_TIME_VALUE ), + ENTRY1Q( OFFICE, BOOLEAN_VALUE, XML_ATACTION_RENAME, + XML_NAMESPACE_TEXT, XML_BOOLEAN_VALUE ), + ENTRY1Q( OFFICE, STRING_VALUE, XML_ATACTION_RENAME, + XML_NAMESPACE_TEXT, XML_STRING_VALUE ), + ENTRY0( TEXT, FORMULA, XML_ATACTION_REMOVE_ANY_NAMESPACE_PREFIX ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_TABLE_VALUE_TYPE_ACTIONS +static XMLTransformerActionInit aTableValueTypeActionTable[] = +{ + ENTRY1Q( OFFICE, VALUE_TYPE, XML_ATACTION_RENAME, + XML_NAMESPACE_TABLE, XML_VALUE_TYPE ), + ENTRY1Q( OFFICE, VALUE, XML_ATACTION_RENAME, + XML_NAMESPACE_TABLE, XML_VALUE ), + ENTRY1Q( OFFICE, CURRENCY, XML_ATACTION_RENAME, + XML_NAMESPACE_TABLE, XML_CURRENCY ), + ENTRY1Q( OFFICE, DATE_VALUE, XML_ATACTION_RENAME_RNG2ISO_DATETIME, + XML_NAMESPACE_TABLE, XML_DATE_VALUE ), + ENTRY1Q( OFFICE, TIME_VALUE, XML_ATACTION_RENAME_RNG2ISO_DATETIME, + XML_NAMESPACE_TABLE, XML_TIME_VALUE ), + ENTRY1Q( OFFICE, BOOLEAN_VALUE, XML_ATACTION_RENAME, + XML_NAMESPACE_TABLE, XML_BOOLEAN_VALUE ), + ENTRY1Q( OFFICE, STRING_VALUE, XML_ATACTION_RENAME, + XML_NAMESPACE_TABLE, XML_STRING_VALUE ), + ENTRY1( TABLE, STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, + XML_FAMILY_TYPE_TABLE_CELL ), + ENTRY0( TABLE, FORMULA, XML_ATACTION_REMOVE_ANY_NAMESPACE_PREFIX ), + ENTRY1Q( TABLE, CONTENT_VALIDATION_NAME, XML_ATACTION_RENAME, + XML_NAMESPACE_TABLE, XML_VALIDATION_NAME ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// action table for OASIS_ANNOTATION_ACTIONS +static XMLTransformerActionInit aAnnotationActionTable[] = +{ + ENTRY1Q( DC, CREATOR, XML_ATACTION_MOVE_FROM_ELEM, + XML_NAMESPACE_OFFICE, XML_AUTHOR ), + ENTRY1Q( DC, DATE, XML_ATACTION_MOVE_FROM_ELEM_RNG2ISO_DATETIME, + XML_NAMESPACE_OFFICE, XML_CREATE_DATE ), + ENTRY1Q( META, DATE_STRING, XML_ATACTION_MOVE_FROM_ELEM, + XML_NAMESPACE_OFFICE, XML_CREATE_DATE_STRING ), + ENTRY0( TEXT, P, XML_ETACTION_EXTRACT_CHARACTERS ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// action table for OASIS_CHANGE_INFO_ACTIONS +static XMLTransformerActionInit aChangeInfoActionTable[] = +{ + ENTRY1Q( DC, CREATOR, XML_ATACTION_MOVE_FROM_ELEM, + XML_NAMESPACE_OFFICE, XML_CHG_AUTHOR ), + ENTRY1Q( DC, DATE, XML_ATACTION_MOVE_FROM_ELEM_RNG2ISO_DATETIME, + XML_NAMESPACE_OFFICE, XML_CHG_DATE_TIME ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_BACKGROUND_IMAGE_ACTIONS +static XMLTransformerActionInit aBackgroundImageActionTable[] = +{ + ENTRY1Q( DRAW, OPACITY, XML_ATACTION_RENAME_NEG_PERCENT, + XML_NAMESPACE_DRAW, XML_TRANSPARENCY ), + ENTRY1( XLINK, HREF, XML_ATACTION_URI_OASIS, sal_True ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_DDE_CONNECTION_DECL +static XMLTransformerActionInit aDDEConnectionDeclActionTable[] = +{ + ENTRY1Q( OFFICE, NAME, XML_ATACTION_RENAME, + XML_NAMESPACE_TEXT, XML_NAME ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + + +// OASIS_FORM_CONTROL_ACTIONS +static XMLTransformerActionInit aFormControlActionTable[] = +{ + ENTRY0( FORM, NAME, XML_ATACTION_MOVE_TO_ELEM ), + ENTRY2QN( FORM, CONTROL_IMPLEMENTATION, + XML_ATACTION_RENAME_REMOVE_NAMESPACE_PREFIX, + XML_NAMESPACE_FORM, XML_SERVICE_NAME, + XML_NAMESPACE_OOO ), + ENTRY0( FORM, ID, XML_ATACTION_MOVE_TO_ELEM ), + ENTRY1( XLINK, HREF, XML_ATACTION_URI_OASIS, sal_False ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_FORM_COLUMN_ACTIONS +static XMLTransformerActionInit aFormColumnActionTable[] = +{ + ENTRY1Q( FORM, TEXT_STYLE_NAME, XML_ATACTION_RENAME_DECODE_STYLE_NAME_REF, + XML_NAMESPACE_FORM, XML_COLUMN_STYLE_NAME ), + ENTRY2QN( FORM, CONTROL_IMPLEMENTATION, + XML_ATACTION_RENAME_REMOVE_NAMESPACE_PREFIX, + XML_NAMESPACE_FORM, XML_SERVICE_NAME, + XML_NAMESPACE_OOO ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_FORM_PROP_ACTIONS +static XMLTransformerActionInit aFormPropActionTable[] = +{ + ENTRY1Q( OFFICE, VALUE_TYPE, XML_ATACTION_RENAME, + XML_NAMESPACE_FORM, XML_PROPERTY_TYPE ), + ENTRY0( OFFICE, VALUE, XML_ATACTION_REMOVE ), + ENTRY0( OFFICE, STRING_VALUE, XML_ATACTION_REMOVE ), + ENTRY0( OFFICE, BOOLEAN_VALUE, XML_ATACTION_REMOVE ), + ENTRY0( OFFICE, DATE_VALUE, XML_ATACTION_REMOVE ), + ENTRY0( OFFICE, TIME_VALUE, XML_ATACTION_REMOVE ), + ENTRY0( OFFICE, CURRENCY, XML_ATACTION_REMOVE ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_XLINK_ACTIONS +static XMLTransformerActionInit aXLinkActionTable[] = +{ + ENTRY1( XLINK, HREF, XML_ATACTION_URI_OASIS, sal_False ), + ENTRY0( TABLE, REFRESH_DELAY, XML_ATACTION_RNG2ISO_DATETIME ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_CONFIG_ITEM_SET_ACTIONS +static XMLTransformerActionInit aConfigItemSetActionTable[] = +{ + ENTRY1( CONFIG, NAME, XML_ATACTION_REMOVE_NAMESPACE_PREFIX, + XML_NAMESPACE_OOO ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_FORMULA_ACTIONS +static XMLTransformerActionInit aFormulaActionTable[] = +{ + ENTRY0( TEXT, CONDITION, XML_ATACTION_REMOVE_ANY_NAMESPACE_PREFIX ), + ENTRY0( TEXT, FORMULA, XML_ATACTION_REMOVE_ANY_NAMESPACE_PREFIX ), + ENTRY0( TABLE, CONDITION, XML_ATACTION_REMOVE_ANY_NAMESPACE_PREFIX ), + ENTRY0( TABLE, FORMULA, XML_ATACTION_REMOVE_ANY_NAMESPACE_PREFIX ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_CONTENT_VALIDATION_ACTIONS +static XMLTransformerActionInit aContentValidationActionTable[] = +{ + ENTRY0( TABLE, CONDITION, XML_ATACTION_REMOVE_ANY_NAMESPACE_PREFIX ), + ENTRY0( TABLE, DISPLAY_LIST, XML_ATACTION_REMOVE ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_DDE_CONV_MODE_ACTIONS +static XMLTransformerActionInit aDDEConvModeActionTable[] = +{ + ENTRY1Q( TABLE, KEEP_TEXT, XML_ATACTION_RENAME, + XML_NAMESPACE_TABLE, XML_LET_TEXT ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_DATAPILOT_MEMBER_ACTIONS +static XMLTransformerActionInit aDataPilotMemberActionTable[] = +{ + ENTRY1Q( TABLE, SHOW_DETAILS, XML_ATACTION_RENAME, + XML_NAMESPACE_TABLE, XML_DISPLAY_DETAILS ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_DATAPILOT_LEVEL_ACTIONS +static XMLTransformerActionInit aDataPilotLevelActionTable[] = +{ + ENTRY1Q( TABLE, SHOW_EMPTY, XML_ATACTION_RENAME, + XML_NAMESPACE_TABLE, XML_DISPLAY_EMPTY ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_SOURCE_SERVICE_ACTIONS +static XMLTransformerActionInit aSourceServiceActionTable[] = +{ + ENTRY1Q( TABLE, USER_NAME, XML_ATACTION_RENAME, + XML_NAMESPACE_TABLE, XML_USERNAME ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_CHART_ACTIONS +static XMLTransformerActionInit aChartActionTable[] = +{ + ENTRY0( CHART, CLASS, XML_ATACTION_REMOVE_ANY_NAMESPACE_PREFIX ), + ENTRY1( DRAW, STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, + XML_FAMILY_TYPE_GRAPHIC ), + ENTRY0( SVG, WIDTH, XML_ATACTION_IN2INCH ), + ENTRY0( SVG, HEIGHT, XML_ATACTION_IN2INCH ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_FORM_ACTIONS +static XMLTransformerActionInit aFormActionTable[] = +{ + ENTRY2QN( FORM, CONTROL_IMPLEMENTATION, + XML_ATACTION_RENAME_REMOVE_NAMESPACE_PREFIX, + XML_NAMESPACE_FORM, XML_SERVICE_NAME, + XML_NAMESPACE_OOO ), + ENTRY1( XLINK, HREF, XML_ATACTION_URI_OASIS, sal_False ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_ALPHABETICAL_INDEX_MARK_ACTIONS +static XMLTransformerActionInit aAlphabeticalIndexMarkActionTable[] = +{ + ENTRY1Q( TEXT, MAIN_ENTRY, XML_ATACTION_RENAME, + XML_NAMESPACE_TEXT, XML_MAIN_ETRY ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_DRAW_AREA_POLYGON_ACTIONS (to be added to OASIS_SHAPE_ACTIONS) +static XMLTransformerActionInit aDrawAreaPolygonActionTable[] = +{ + ENTRY1Q( DRAW, POINTS, XML_ATACTION_RENAME, + XML_NAMESPACE_SVG, XML_POINTS ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_SCRIPT_ACTIONS +static XMLTransformerActionInit aScriptActionTable[] = +{ + ENTRY1( SCRIPT, LANGUAGE, XML_ATACTION_REMOVE_NAMESPACE_PREFIX, XML_NAMESPACE_OOO ), + ENTRY1Q( OOO, NAME, XML_ATACTION_RENAME, XML_NAMESPACE_SCRIPT, XML_NAME ), + ENTRY1Q( OOO, READONLY, XML_ATACTION_RENAME, XML_NAMESPACE_SCRIPT, XML_READONLY ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_DATETIME_ACTIONS +static XMLTransformerActionInit aDateTimeActionTable[] = +{ + ENTRY0( TEXT, DATE_VALUE, XML_ATACTION_RNG2ISO_DATETIME ), + ENTRY0( TEXT, TIME_VALUE, XML_ATACTION_RNG2ISO_DATETIME ), + ENTRY0( TEXT, DATE_ADJUST, XML_ATACTION_RNG2ISO_DATETIME ), + ENTRY0( TEXT, TIME_ADJUST, XML_ATACTION_RNG2ISO_DATETIME ), + ENTRY0( TEXT, DURATION, XML_ATACTION_RNG2ISO_DATETIME ), + ENTRY0( OFFICE, DATE_VALUE, XML_ATACTION_RNG2ISO_DATETIME ), + ENTRY0( OFFICE, TIME_VALUE, XML_ATACTION_RNG2ISO_DATETIME ), + ENTRY0( FORM, VALUE, XML_ATACTION_RNG2ISO_DATETIME ), + ENTRY0( FORM, CURRENT_VALUE, XML_ATACTION_RNG2ISO_DATETIME ), + ENTRY0( TABLE, DATE_START, XML_ATACTION_RNG2ISO_DATETIME ), + ENTRY0( TABLE, DATE_END, XML_ATACTION_RNG2ISO_DATETIME ), + ENTRY0( TABLE, REFRESH_DELAY, XML_ATACTION_RNG2ISO_DATETIME ), + ENTRY0( PRESENTATION, DELAY, XML_ATACTION_RNG2ISO_DATETIME ), + ENTRY0( PRESENTATION, PAUSE, XML_ATACTION_RNG2ISO_DATETIME ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +static XMLTokenEnum aTokenMap[] = +{ + XML_NONE, XML_SOLID, XML_DOTTED, XML_DASH, XML_LONG_DASH, XML_DOT_DASH, + XML_DOT_DOT_DASH, XML_WAVE, XML_SMALL_WAVE, XML_TOKEN_END +}; + +// ----------------------------------------------------------------------------- + +class XMLTableTransformerContext_Impl : public XMLTransformerContext +{ + ::rtl::OUString m_aElemQName; + +public: + TYPEINFO(); + + XMLTableTransformerContext_Impl( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName ); + + virtual ~XMLTableTransformerContext_Impl(); + + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + virtual void EndElement(); +}; + +TYPEINIT1( XMLTableTransformerContext_Impl, XMLTransformerContext ); + +XMLTableTransformerContext_Impl::XMLTableTransformerContext_Impl( + XMLTransformerBase& rImp, + const OUString& rQName ) : + XMLTransformerContext( rImp, rQName ), + m_aElemQName( rQName ) +{ +} + +XMLTableTransformerContext_Impl::~XMLTableTransformerContext_Impl() +{ +} + +void XMLTableTransformerContext_Impl::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + Reference< XAttributeList > xAttrList( rAttrList ); + + XMLMutableAttributeList *pMutableAttrList = 0; + // <-- + + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + for( sal_Int16 i=0; i < nAttrCount; i++ ) + { + const OUString& rAttrName = xAttrList->getNameByIndex( i ); + OUString aLocalName; + sal_uInt16 nPrefix = + GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName, + &aLocalName ); + if( XML_NAMESPACE_TABLE == nPrefix ) + { + if ( IsXMLToken( aLocalName, XML_IS_SUB_TABLE ) ) + { + const OUString& rValue = xAttrList->getValueByIndex( i ); + if( IsXMLToken( rValue, XML_TRUE ) ) + { + m_aElemQName = GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_TABLE, + ::xmloff::token::GetXMLToken( XML_SUB_TABLE ) ); + if ( !pMutableAttrList ) + { + pMutableAttrList = + new XMLMutableAttributeList( xAttrList ); + xAttrList = pMutableAttrList; + } + pMutableAttrList->RemoveAttributeByIndex( i ); + } + // OD 2005-07-05 #i50521# - no break here for savety reason. + } + // --> OD 2005-01-10 #i40011#, #i40015# + // - convert attribute table:style-name for <table:table> + else if ( IsXMLToken( aLocalName, XML_STYLE_NAME ) ) + { + const OUString& rValue = xAttrList->getValueByIndex( i ); + OUString aAttrValue( rValue ); + if( GetTransformer().DecodeStyleName(aAttrValue) ) + { + if ( !pMutableAttrList ) + { + pMutableAttrList = + new XMLMutableAttributeList( xAttrList ); + xAttrList = pMutableAttrList; + } + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + } + // <-- + else if( IsXMLToken( aLocalName, XML_PRINT ) ) + { + if ( !pMutableAttrList ) + { + pMutableAttrList = + new XMLMutableAttributeList( xAttrList ); + xAttrList = pMutableAttrList; + } + pMutableAttrList->RemoveAttributeByIndex( i ); + } + } + } + + GetTransformer().GetDocHandler()->startElement( m_aElemQName, xAttrList ); +} + +void XMLTableTransformerContext_Impl::EndElement() +{ + GetTransformer().GetDocHandler()->endElement( m_aElemQName ); +} + +// ----------------------------------------------------------------------------- + +class XMLBodyOASISTransformerContext_Impl : public XMLTransformerContext +{ + sal_Bool m_bFirstChild; + +public: + TYPEINFO(); + + XMLBodyOASISTransformerContext_Impl( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName ); + + virtual ~XMLBodyOASISTransformerContext_Impl(); + + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix, + const ::rtl::OUString& rLocalName, + const ::rtl::OUString& rQName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + virtual void EndElement(); +}; + +TYPEINIT1( XMLBodyOASISTransformerContext_Impl, XMLTransformerContext ); + +XMLBodyOASISTransformerContext_Impl::XMLBodyOASISTransformerContext_Impl( + XMLTransformerBase& rImp, + const OUString& rQName ) : + XMLTransformerContext( rImp, rQName ), + m_bFirstChild( sal_False ) +{ +} + +XMLBodyOASISTransformerContext_Impl::~XMLBodyOASISTransformerContext_Impl() +{ +} + +void XMLBodyOASISTransformerContext_Impl::StartElement( + const Reference< XAttributeList >& ) +{ +} + +XMLTransformerContext* XMLBodyOASISTransformerContext_Impl::CreateChildContext( sal_uInt16 nPrefix, + const ::rtl::OUString& rLocalName, + const ::rtl::OUString& rQName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ) +{ + if (!m_bFirstChild) + { + m_bFirstChild = sal_True; + XMLTransformerContext::StartElement(xAttrList); + } + + return XMLTransformerContext::CreateChildContext(nPrefix, rLocalName, rQName, xAttrList); +} + +void XMLBodyOASISTransformerContext_Impl::EndElement() +{ + if (!m_bFirstChild) + XMLTransformerContext::StartElement(Reference< XAttributeList >()); + + XMLTransformerContext::EndElement(); +} + +//----------------------------------------------------------------------------- + +class XMLTabStopOASISTContext_Impl : public XMLPersElemContentTContext +{ +public: + TYPEINFO(); + + XMLTabStopOASISTContext_Impl( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName ); + + virtual ~XMLTabStopOASISTContext_Impl(); + + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); +}; + +TYPEINIT1( XMLTabStopOASISTContext_Impl, XMLPersElemContentTContext ); + +XMLTabStopOASISTContext_Impl::XMLTabStopOASISTContext_Impl( + XMLTransformerBase& rImp, + const OUString& rQName ) : + XMLPersElemContentTContext( rImp, rQName ) +{ +} + +XMLTabStopOASISTContext_Impl::~XMLTabStopOASISTContext_Impl() +{ +} + +void XMLTabStopOASISTContext_Impl::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + XMLTransformerActions *pActions = + GetTransformer().GetUserDefinedActions( OASIS_TAB_STOP_ACTIONS ); + OSL_ENSURE( pActions, "go no actions" ); + + sal_Unicode cStyleLeaderChar = 0; + sal_Int16 nLeaderText = -1; + Reference< XAttributeList > xAttrList( rAttrList ); + XMLMutableAttributeList *pMutableAttrList = 0; + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + for( sal_Int16 i=0; i < nAttrCount; i++ ) + { + const OUString& rAttrName = xAttrList->getNameByIndex( i ); + OUString aLocalName; + sal_uInt16 nPrefix = + GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName, + &aLocalName ); + XMLTransformerActions::key_type aKey( nPrefix, aLocalName ); + XMLTransformerActions::const_iterator aIter = + pActions->find( aKey ); + if( !(aIter == pActions->end() ) ) + { + if( !pMutableAttrList ) + { + pMutableAttrList = + new XMLMutableAttributeList( xAttrList ); + xAttrList = pMutableAttrList; + } + const OUString& rAttrValue = xAttrList->getValueByIndex( i ); + switch( (*aIter).second.m_nActionType ) + { + case XML_ATACTION_REMOVE: + if( IsXMLToken( aLocalName, XML_LEADER_STYLE ) ) + { + if( IsXMLToken( rAttrValue, XML_NONE ) ) + cStyleLeaderChar = ' '; + else if( IsXMLToken( rAttrValue, XML_DOTTED ) ) + cStyleLeaderChar = '.'; + else + cStyleLeaderChar = 0; + pMutableAttrList->RemoveAttributeByIndex( i ); + --i; + --nAttrCount; + } + break; + case XML_ATACTION_RENAME: + { + OUString aNewAttrQName( + GetTransformer().GetNamespaceMap().GetQNameByKey( + (*aIter).second.GetQNamePrefixFromParam1(), + ::xmloff::token::GetXMLToken( + (*aIter).second.GetQNameTokenFromParam1()) ) ); + pMutableAttrList->RenameAttributeByIndex( i, + aNewAttrQName ); + } + if( IsXMLToken( aLocalName, XML_LEADER_TEXT ) ) + { + if( rAttrValue.getLength() > 1 ) + { + OUString aAttrValue( rAttrValue.copy( 0, 1 ) ); + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + nLeaderText = i; + } + } + break; + case XML_ATACTION_IN2INCH: + { + OUString aAttrValue( rAttrValue ); + if( XMLTransformerBase::ReplaceSingleInWithInch( + aAttrValue ) ) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + default: + OSL_ENSURE( !this, "unknown action" ); + break; + } + } + } + + if( cStyleLeaderChar && ' ' != cStyleLeaderChar ) + { + if( nLeaderText != -1 ) + { + OUString aNewAttrQName( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_STYLE, + ::xmloff::token::GetXMLToken( XML_LEADER_CHAR ) ) ); + pMutableAttrList->AddAttribute( aNewAttrQName, + OUString::valueOf( cStyleLeaderChar ) ); + } + } + else + { + if( nLeaderText != -1 ) + pMutableAttrList->RemoveAttributeByIndex( nLeaderText ); + } + + XMLPersElemContentTContext::StartElement( xAttrList ); +} + +// ----------------------------------------------------------------------------- + +class XMLConfigItemTContext_Impl : public XMLTransformerContext +{ + ::rtl::OUString m_aContent; + sal_Bool m_bIsRedlineProtectionKey; + sal_Bool m_bIsCursorX; + sal_Bool m_bIsCursorY; + +public: + + TYPEINFO(); + + XMLConfigItemTContext_Impl( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName ); + + virtual ~XMLConfigItemTContext_Impl(); + + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + virtual void EndElement(); + + virtual void Characters( const ::rtl::OUString& rChars ); +}; + +TYPEINIT1( XMLConfigItemTContext_Impl, XMLTransformerContext ); + +XMLConfigItemTContext_Impl::XMLConfigItemTContext_Impl( + XMLTransformerBase& rImp, + const OUString& rQName ) : + XMLTransformerContext( rImp, rQName ), + m_bIsRedlineProtectionKey( sal_False ), + m_bIsCursorX( sal_False ), + m_bIsCursorY( sal_False ) +{ +} + +XMLConfigItemTContext_Impl::~XMLConfigItemTContext_Impl() +{ +} + +void XMLConfigItemTContext_Impl::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + Reference< XAttributeList > xAttrList( rAttrList ); + + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + for( sal_Int16 i=0; i < nAttrCount; i++ ) + { + const OUString& rAttrName = xAttrList->getNameByIndex( i ); + OUString aLocalName; + sal_uInt16 nPrefix = + GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName, + &aLocalName ); + if( XML_NAMESPACE_CONFIG == nPrefix ) + { + if ( IsXMLToken( aLocalName, XML_NAME ) ) + { + const OUString& rValue = xAttrList->getValueByIndex( i ); + const sal_Char sRedlineProtectionKey[] = "RedlineProtectionKey"; + const sal_Char sCursorX[] = "CursorPositionX"; + const sal_Char sCursorY[] = "CursorPositionY"; + if( rValue.equalsAsciiL( sRedlineProtectionKey, sizeof(sRedlineProtectionKey)-1 ) ) + m_bIsRedlineProtectionKey = sal_True; + else if( rValue.equalsAsciiL( sCursorX, sizeof(sCursorX)-1 ) ) + m_bIsCursorX = sal_True; + else if( rValue.equalsAsciiL( sCursorY, sizeof(sCursorY)-1 ) ) + m_bIsCursorY = sal_True; + + break; + } + } + } + + XMLTransformerContext::StartElement( xAttrList ); +} + +void XMLConfigItemTContext_Impl::Characters( const ::rtl::OUString& rChars ) +{ + rtl::OUString sChars(rChars); + if (m_bIsRedlineProtectionKey) + m_aContent += rChars; + else if (m_bIsCursorX || m_bIsCursorY) + { + sal_Int32 nPos = rChars.toInt32(); + if (m_bIsCursorX && nPos > 255) + nPos = 255; + else if (m_bIsCursorY && nPos > 31999) + nPos = 31999; + + sChars = ::rtl::OUString::valueOf(nPos); + } + + XMLTransformerContext::Characters( sChars ); +} + +void XMLConfigItemTContext_Impl::EndElement() +{ + + if( m_bIsRedlineProtectionKey ) + { + const Reference< XPropertySet > rPropSet = + GetTransformer().GetPropertySet(); + if( rPropSet.is() ) + { + const sal_Char sRedlineProtectionKey[] = "RedlineProtectionKey"; + OUString aPropName(RTL_CONSTASCII_USTRINGPARAM(sRedlineProtectionKey)); + Reference< XPropertySetInfo > xPropSetInfo( + rPropSet->getPropertySetInfo() ); + if( xPropSetInfo.is() && + xPropSetInfo->hasPropertyByName( aPropName ) ) + { + Sequence < sal_Int8 > aKey; + SvXMLUnitConverter::decodeBase64( aKey, m_aContent ); + rPropSet->setPropertyValue( aPropName, makeAny( aKey ) ); + } + } + } + XMLTransformerContext::EndElement(); +} + +// ----------------------------------------------------------------------------- + +class XMLTrackedChangesOASISTContext_Impl : public XMLTransformerContext +{ + ::rtl::OUString m_aAttrQName; + +public: + + TYPEINFO(); + + XMLTrackedChangesOASISTContext_Impl( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName, + sal_uInt16 nPrefix, + XMLTokenEnum eToken ); + + virtual ~XMLTrackedChangesOASISTContext_Impl(); + + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); +}; + +TYPEINIT1( XMLTrackedChangesOASISTContext_Impl, XMLTransformerContext ); + +XMLTrackedChangesOASISTContext_Impl::XMLTrackedChangesOASISTContext_Impl( + XMLTransformerBase& rImp, + const OUString& rQName, + sal_uInt16 nPrefix, + XMLTokenEnum eToken ) : + XMLTransformerContext( rImp, rQName ), + m_aAttrQName( rImp.GetNamespaceMap().GetQNameByKey( nPrefix, + GetXMLToken(eToken)) ) +{ +} + +XMLTrackedChangesOASISTContext_Impl::~XMLTrackedChangesOASISTContext_Impl() +{ +} + +void XMLTrackedChangesOASISTContext_Impl::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + Reference< XAttributeList > xAttrList( rAttrList ); + const Reference< XPropertySet > rPropSet = + GetTransformer().GetPropertySet(); + if( rPropSet.is() ) + { + const sal_Char sRedlineProtectionKey[] = "RedlineProtectionKey"; + OUString aPropName(RTL_CONSTASCII_USTRINGPARAM(sRedlineProtectionKey)); + Reference< XPropertySetInfo > xPropSetInfo( + rPropSet->getPropertySetInfo() ); + if( xPropSetInfo.is() && + xPropSetInfo->hasPropertyByName( aPropName ) ) + { + Any aAny = rPropSet->getPropertyValue( aPropName); + Sequence < sal_Int8 > aKey; + aAny >>= aKey; + if( aKey.getLength() ) + { + OUStringBuffer aBuffer; + SvXMLUnitConverter::encodeBase64( aBuffer, aKey ); + XMLMutableAttributeList *pMutableAttrList = + new XMLMutableAttributeList( xAttrList ); + xAttrList = pMutableAttrList; + pMutableAttrList->AddAttribute( m_aAttrQName, + aBuffer.makeStringAndClear() ); + } + } + } + XMLTransformerContext::StartElement( xAttrList ); +} + +// ----------------------------------------------------------------------------- + +XMLTransformerContext *Oasis2OOoTransformer::CreateUserDefinedContext( + const TransformerAction_Impl& rAction, + const OUString& rQName, + sal_Bool bPersistent ) +{ + switch( rAction.m_nActionType ) + { + case XML_ETACTION_META: + return new XMLMetaTransformerContext( *this, rQName ); + case XML_ETACTION_DOCUMENT: + return new XMLDocumentTransformerContext( *this, rQName ); + case XML_ETACTION_BODY: + return new XMLBodyOASISTransformerContext_Impl( *this, rQName ); + case XML_ETACTION_NOTES: + return new XMLNotesTransformerContext( *this, rQName, + static_cast< XMLTokenEnum>( rAction.m_nParam1 ), bPersistent ); + case XML_ETACTION_TABLE: + return new XMLTableTransformerContext_Impl( *this, rQName ); + case XML_ETACTION_STYLE: + return new XMLStyleOASISTContext( *this, rQName, bPersistent ); + case XML_ETACTION_STYLE_RENAME: + return new XMLStyleOASISTContext( *this, rQName, + rAction.GetQNamePrefixFromParam1(), + rAction.GetQNameTokenFromParam1(), bPersistent ); + case XML_ETACTION_FRAME: + return new XMLFrameOASISTransformerContext( *this, rQName ); + case XML_ETACTION_EVENT: + return new XMLEventOASISTransformerContext( *this, rQName ); + case XML_ETACTION_DLG: + return new XMLDlgOASISTransformerContext( *this, rQName ); + case XML_ETACTION_TAB_STOP: + return new XMLTabStopOASISTContext_Impl( *this, rQName ); + case XML_ETACTION_FORM_CONTROL: + { + const XMLTransformerContext *pCurrent = GetCurrentContext(); + return new XMLControlOASISTransformerContext( *this, rQName, + pCurrent ? pCurrent->HasQName( XML_NAMESPACE_FORM, + XML_FORM ) : sal_False ); + } + case XML_ETACTION_FORM_PROPERTY: + return new XMLFormPropOASISTransformerContext( *this, rQName, + static_cast< XMLTokenEnum >( rAction.m_nParam1 ) ); + case XML_ETACTION_CHART: + return new XMLChartOASISTransformerContext( *this, rQName ); + case XML_ETACTION_CONFIG_ITEM: + return new XMLConfigItemTContext_Impl( *this, rQName ); + case XML_ETACTION_TRACKED_CHANGES: + return new XMLTrackedChangesOASISTContext_Impl( *this, rQName, + rAction.GetQNamePrefixFromParam1(), + rAction.GetQNameTokenFromParam1() ); + case XML_ETACTION_CHART_PLOT_AREA: + return new XMLChartPlotAreaOASISTContext( *this, rQName ); + default: + OSL_ENSURE( !this, "no user defined context found!" ); + break; + } + + // default is copying + return new XMLTransformerContext( *this, rQName ); +} + +XMLTransformerActions *Oasis2OOoTransformer::GetUserDefinedActions( + sal_uInt16 n ) +{ + XMLTransformerActions *pActions = 0; + if( n < MAX_OASIS_ACTIONS ) + { + if( !m_aActions[n] ) + { + if( n<MAX_OASIS_PROP_ACTIONS ) + { + m_aActions[n] = + XMLStyleOASISTContext::CreateTransformerActions( n ); + } + else switch( n ) + { + case OASIS_STYLE_ACTIONS: + m_aActions[OASIS_STYLE_ACTIONS] = + new XMLTransformerActions( aStyleActionTable ); + break; + case OASIS_FONT_FACE_ACTIONS: + m_aActions[OASIS_FONT_FACE_ACTIONS] = + new XMLTransformerActions( aFontFaceActionTable ); + break; + case OASIS_SHAPE_ACTIONS: + m_aActions[OASIS_SHAPE_ACTIONS] = + new XMLTransformerActions( aShapeActionTable ); + break; + case OASIS_CONNECTOR_ACTIONS: + m_aActions[OASIS_CONNECTOR_ACTIONS] = + new XMLTransformerActions( aConnectorActionTable ); + break; + case OASIS_INDEX_ENTRY_TAB_STOP_ACTIONS: + m_aActions[OASIS_INDEX_ENTRY_TAB_STOP_ACTIONS] = + new XMLTransformerActions( aIndexEntryTabStopActionTable ); + break; + case OASIS_TAB_STOP_ACTIONS: + m_aActions[OASIS_TAB_STOP_ACTIONS] = + new XMLTransformerActions( aTabStopActionTable ); + break; + case OASIS_LINENUMBERING_ACTIONS: + m_aActions[OASIS_LINENUMBERING_ACTIONS] = + new XMLTransformerActions( aLineNumberingActionTable ); + break; + case OASIS_FOOTNOTE_SEP_ACTIONS: + m_aActions[OASIS_FOOTNOTE_SEP_ACTIONS] = + new XMLTransformerActions( aFootnoteSepActionTable ); + break; + case OASIS_DROP_CAP_ACTIONS: + m_aActions[OASIS_DROP_CAP_ACTIONS] = + new XMLTransformerActions( aDropCapActionTable ); + break; + case OASIS_COLUMNS_ACTIONS: + m_aActions[OASIS_COLUMNS_ACTIONS] = + new XMLTransformerActions( aColumnsActionTable ); + break; + case OASIS_TEXT_VALUE_TYPE_ACTIONS: + m_aActions[OASIS_TEXT_VALUE_TYPE_ACTIONS] = + new XMLTransformerActions( aTextValueTypeActionTable ); + break; + case OASIS_TABLE_VALUE_TYPE_ACTIONS: + m_aActions[OASIS_TABLE_VALUE_TYPE_ACTIONS] = + new XMLTransformerActions( aTableValueTypeActionTable ); + break; + case OASIS_PARA_ACTIONS: + m_aActions[OASIS_PARA_ACTIONS] = + new XMLTransformerActions( aParaActionTable ); + break; + case OASIS_LIST_STYLE_REF_ACTIONS: + m_aActions[OASIS_LIST_STYLE_REF_ACTIONS] = + new XMLTransformerActions( aListStyleRefActionTable ); + break; + case OASIS_TEXT_STYLE_REF_ACTIONS: + m_aActions[OASIS_TEXT_STYLE_REF_ACTIONS] = + new XMLTransformerActions( aTextStyleRefActionTable ); + break; + case OASIS_PARA_STYLE_REF_ACTIONS: + m_aActions[OASIS_PARA_STYLE_REF_ACTIONS] = + new XMLTransformerActions( aParaStyleRefActionTable ); + break; + case OASIS_MASTER_PAGE_REF_ACTIONS: + m_aActions[OASIS_MASTER_PAGE_REF_ACTIONS] = + new XMLTransformerActions( aMasterPageRefActionTable ); + break; + case OASIS_MAP_STYLE_REF_ACTIONS: + m_aActions[OASIS_MAP_STYLE_REF_ACTIONS] = + new XMLTransformerActions( aMapStyleRefActionTable ); + break; + case OASIS_MASTER_PAGE_ACTIONS: + m_aActions[OASIS_MASTER_PAGE_ACTIONS] = + new XMLTransformerActions( aMasterPageActionTable ); + break; + case OASIS_NOTES_ACTIONS: + m_aActions[OASIS_NOTES_ACTIONS] = + new XMLTransformerActions( aNotesActionTable ); + break; + case OASIS_ANNOTATION_ACTIONS: + m_aActions[OASIS_ANNOTATION_ACTIONS] = + new XMLTransformerActions( aAnnotationActionTable ); + break; + case OASIS_CHANGE_INFO_ACTIONS: + m_aActions[OASIS_CHANGE_INFO_ACTIONS] = + new XMLTransformerActions( aChangeInfoActionTable ); + break; + case OASIS_FRAME_ELEM_ACTIONS: + m_aActions[OASIS_FRAME_ELEM_ACTIONS] = + new XMLTransformerActions( aFrameActionTable ); + break; + case OASIS_BACKGROUND_IMAGE_ACTIONS: + m_aActions[OASIS_BACKGROUND_IMAGE_ACTIONS] = + new XMLTransformerActions( aBackgroundImageActionTable ); + break; + case OASIS_DDE_CONNECTION_DECL_ACTIONS: + m_aActions[OASIS_DDE_CONNECTION_DECL_ACTIONS] = + new XMLTransformerActions( aDDEConnectionDeclActionTable ); + break; + case OASIS_EVENT_ACTIONS: + m_aActions[OASIS_EVENT_ACTIONS] = + new XMLTransformerActions( aEventActionTable ); + break; + case OASIS_DLG_ACTIONS: + m_aActions[OASIS_DLG_ACTIONS] = + new XMLTransformerActions( aDlgActionTable ); + break; + case OASIS_FORM_CONTROL_ACTIONS: + m_aActions[OASIS_FORM_CONTROL_ACTIONS] = + new XMLTransformerActions( aFormControlActionTable ); + break; + case OASIS_FORM_COLUMN_ACTIONS: + m_aActions[OASIS_FORM_COLUMN_ACTIONS] = + new XMLTransformerActions( aFormColumnActionTable ); + break; + case OASIS_FORM_PROP_ACTIONS: + m_aActions[OASIS_FORM_PROP_ACTIONS] = + new XMLTransformerActions( aFormPropActionTable ); + break; + case OASIS_XLINK_ACTIONS: + m_aActions[OASIS_XLINK_ACTIONS] = + new XMLTransformerActions( aXLinkActionTable ); + break; + case OASIS_CONFIG_ITEM_SET_ACTIONS: + m_aActions[OASIS_CONFIG_ITEM_SET_ACTIONS] = + new XMLTransformerActions( aConfigItemSetActionTable ); + break; + case OASIS_FORMULA_ACTIONS: + m_aActions[OASIS_FORMULA_ACTIONS] = + new XMLTransformerActions( aFormulaActionTable ); + break; + case OASIS_CHART_ACTIONS: + m_aActions[OASIS_CHART_ACTIONS] = + new XMLTransformerActions( aChartActionTable ); + break; + case OASIS_FORM_ACTIONS: + m_aActions[OASIS_FORM_ACTIONS] = + new XMLTransformerActions( aFormActionTable ); + break; + case OASIS_ALPHABETICAL_INDEX_MARK_ACTIONS: + m_aActions[OASIS_ALPHABETICAL_INDEX_MARK_ACTIONS] = + new XMLTransformerActions( + aAlphabeticalIndexMarkActionTable ); + break; + case OASIS_CONTENT_VALIDATION_ACTIONS: + m_aActions[OASIS_CONTENT_VALIDATION_ACTIONS] = + new XMLTransformerActions( aContentValidationActionTable ); + case OASIS_DDE_CONV_MODE_ACTIONS: + m_aActions[OASIS_DDE_CONV_MODE_ACTIONS] = + new XMLTransformerActions( aDDEConvModeActionTable ); + break; + case OASIS_DATAPILOT_MEMBER_ACTIONS: + m_aActions[OASIS_DATAPILOT_MEMBER_ACTIONS] = + new XMLTransformerActions( aDataPilotMemberActionTable ); + break; + case OASIS_DATAPILOT_LEVEL_ACTIONS: + m_aActions[OASIS_DATAPILOT_LEVEL_ACTIONS] = + new XMLTransformerActions( aDataPilotLevelActionTable ); + break; + case OASIS_SOURCE_SERVICE_ACTIONS: + m_aActions[OASIS_SOURCE_SERVICE_ACTIONS] = + new XMLTransformerActions( aSourceServiceActionTable ); + break; + case OASIS_DRAW_AREA_POLYGON_ACTIONS: + m_aActions[OASIS_DRAW_AREA_POLYGON_ACTIONS] = + new XMLTransformerActions( aShapeActionTable ); + m_aActions[OASIS_DRAW_AREA_POLYGON_ACTIONS] + ->Add( aDrawAreaPolygonActionTable ); + break; + case OASIS_SCRIPT_ACTIONS: + m_aActions[OASIS_SCRIPT_ACTIONS] = + new XMLTransformerActions( aScriptActionTable ); + break; + case OASIS_DATETIME_ACTIONS: + m_aActions[OASIS_DATETIME_ACTIONS] = + new XMLTransformerActions( aDateTimeActionTable ); + break; + // --> OD 2005-01-10 #i40011#, #i40015# + case OASIS_TABLE_STYLE_REF_ACTIONS: + m_aActions[OASIS_TABLE_STYLE_REF_ACTIONS] = + new XMLTransformerActions( aTableStyleRefActionTable ); + break; + // <-- + case OASIS_ANIMATION_ACTIONS: + m_aActions[OASIS_ANIMATION_ACTIONS] = + new XMLTransformerActions( aAnimationActionTable ); + break; + } + } + pActions = m_aActions[n]; + } + + return pActions; +} + +OUString Oasis2OOoTransformer::GetEventName( const OUString& rName, + sal_Bool bForm ) +{ + if( bForm && !m_pFormEventMap ) + m_pFormEventMap = + XMLEventOASISTransformerContext::CreateFormEventMap(); + if( !m_pEventMap ) + m_pEventMap = XMLEventOASISTransformerContext::CreateEventMap(); + + OUString aMacroName; + sal_uInt16 nPrefix = + GetNamespaceMap().GetKeyByAttrName( rName, &aMacroName ); + return XMLEventOASISTransformerContext::GetEventName( + nPrefix, aMacroName, *m_pEventMap, + bForm ? m_pFormEventMap : 0 ); +} + +Oasis2OOoTransformer::Oasis2OOoTransformer() throw() : + XMLTransformerBase( aActionTable, aTokenMap ), + m_pEventMap( 0 ), + m_pFormEventMap( 0 ) +{ + GetNamespaceMap().Add( GetXMLToken(XML_NP_OFFICE), GetXMLToken(XML_N_OFFICE), XML_NAMESPACE_OFFICE ); + GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_OFFICE), GetXMLToken(XML_N_OFFICE_OOO), XML_NAMESPACE_OFFICE ); + + GetNamespaceMap().Add( GetXMLToken(XML_NP_META), GetXMLToken(XML_N_META), XML_NAMESPACE_META ); + GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_META), GetXMLToken(XML_N_META_OOO), XML_NAMESPACE_META ); + + GetNamespaceMap().Add( GetXMLToken(XML_NP_STYLE), GetXMLToken(XML_N_STYLE), XML_NAMESPACE_STYLE ); + GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_STYLE), GetXMLToken(XML_N_STYLE_OOO), XML_NAMESPACE_STYLE ); + + GetNamespaceMap().Add( GetXMLToken(XML_NP_NUMBER), GetXMLToken(XML_N_NUMBER), XML_NAMESPACE_NUMBER ); + GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_NUMBER), GetXMLToken(XML_N_NUMBER_OOO), XML_NAMESPACE_NUMBER ); + + GetNamespaceMap().Add( GetXMLToken(XML_NP_CONFIG), GetXMLToken(XML_N_CONFIG), XML_NAMESPACE_CONFIG ); + GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_CONFIG), GetXMLToken(XML_N_CONFIG_OOO), XML_NAMESPACE_CONFIG ); + + GetNamespaceMap().Add( GetXMLToken(XML_NP_TEXT), GetXMLToken(XML_N_TEXT), XML_NAMESPACE_TEXT ); + GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_TEXT), GetXMLToken(XML_N_TEXT_OOO), XML_NAMESPACE_TEXT ); + + GetNamespaceMap().Add( GetXMLToken(XML_NP_TABLE), GetXMLToken(XML_N_TABLE), XML_NAMESPACE_TABLE ); + GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_TABLE), GetXMLToken(XML_N_TABLE_OOO), XML_NAMESPACE_TABLE ); + + GetNamespaceMap().Add( GetXMLToken(XML_NP_DRAW), GetXMLToken(XML_N_DRAW), XML_NAMESPACE_DRAW ); + GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_DRAW), GetXMLToken(XML_N_DRAW_OOO), XML_NAMESPACE_DRAW ); + + GetNamespaceMap().Add( GetXMLToken(XML_NP_DR3D), GetXMLToken(XML_N_DR3D), XML_NAMESPACE_DR3D ); + GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_DR3D), GetXMLToken(XML_N_DR3D_OOO), XML_NAMESPACE_DR3D ); + + GetNamespaceMap().Add( GetXMLToken(XML_NP_PRESENTATION), GetXMLToken(XML_N_PRESENTATION), XML_NAMESPACE_PRESENTATION ); + GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_PRESENTATION), GetXMLToken(XML_N_PRESENTATION_OOO), XML_NAMESPACE_PRESENTATION ); + + GetNamespaceMap().Add( GetXMLToken(XML_NP_CHART), GetXMLToken(XML_N_CHART), XML_NAMESPACE_CHART ); + GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_CHART), GetXMLToken(XML_N_CHART_OOO), XML_NAMESPACE_CHART ); + + GetNamespaceMap().Add( GetXMLToken(XML_NP_FORM), GetXMLToken(XML_N_FORM), XML_NAMESPACE_FORM ); + GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_FORM), GetXMLToken(XML_N_FORM_OOO), XML_NAMESPACE_FORM ); + + GetNamespaceMap().Add( GetXMLToken(XML_NP_SCRIPT), GetXMLToken(XML_N_SCRIPT), XML_NAMESPACE_SCRIPT ); + GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_SCRIPT), GetXMLToken(XML_N_SCRIPT_OOO), XML_NAMESPACE_SCRIPT ); + + GetNamespaceMap().Add( GetXMLToken(XML_NP_DLG), GetXMLToken(XML_N_DLG), XML_NAMESPACE_DLG ); + GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_DLG), GetXMLToken(XML_N_DLG), XML_NAMESPACE_DLG ); + + GetNamespaceMap().Add( GetXMLToken(XML_NP_FO), GetXMLToken(XML_N_FO_COMPAT), XML_NAMESPACE_FO ); + GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_FO), GetXMLToken(XML_N_FO), XML_NAMESPACE_FO ); + + GetNamespaceMap().Add( GetXMLToken(XML_NP_SVG), GetXMLToken(XML_N_SVG_COMPAT), XML_NAMESPACE_SVG ); + GetReplaceNamespaceMap().Add( GetXMLToken(XML_NP_SVG), GetXMLToken(XML_N_SVG), XML_NAMESPACE_SVG ); + + + for( sal_uInt16 i=0; i<MAX_OASIS_ACTIONS; ++i ) + m_aActions[i] = 0; +} + +Oasis2OOoTransformer::~Oasis2OOoTransformer() throw() +{ + for( sal_uInt16 i=0; i<MAX_OASIS_ACTIONS; ++i ) + delete m_aActions[i]; + XMLEventOASISTransformerContext::FlushEventMap( m_pEventMap ); + XMLEventOASISTransformerContext::FlushEventMap( m_pFormEventMap ); +} + +::com::sun::star::uno::Sequence< sal_Int8 > static CreateUnoTunnelId() +{ + static osl::Mutex aCreateMutex; + Guard<osl::Mutex> aGuard( aCreateMutex ); + Sequence< sal_Int8 > aSeq( 16 ); + rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); + return aSeq; +} + +const Sequence< sal_Int8 > & Oasis2OOoTransformer::getUnoTunnelId() throw() +{ + static Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId(); + return aSeq; +} + +// XUnoTunnel +sal_Int64 SAL_CALL Oasis2OOoTransformer::getSomething( const Sequence< sal_Int8 >& rId ) + throw(RuntimeException) +{ + if( rId.getLength() == 16 + && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), + rId.getConstArray(), 16 ) ) + { + return reinterpret_cast< sal_Int64 >( this ); + } + else + { + return (sal_Int64)0; + } +} + +// XServiceInfo +OUString SAL_CALL Oasis2OOoTransformer::getImplementationName() + throw(RuntimeException) +{ + return Oasis2OOoTransformer_getImplementationName(); +} + +sal_Bool SAL_CALL Oasis2OOoTransformer::supportsService( const OUString& ) + throw(RuntimeException) +{ + return sal_False; +} + +Sequence< OUString > SAL_CALL Oasis2OOoTransformer::getSupportedServiceNames( ) + throw(RuntimeException) +{ + Sequence<OUString> aSeq(0); + return aSeq; +} + +// Service registration + +OUString SAL_CALL Oasis2OOoTransformer_getImplementationName() throw() +{ + return OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.comp.Oasis2OOoTransformer" ) ); +} + +Sequence< OUString > SAL_CALL Oasis2OOoTransformer_getSupportedServiceNames() + throw() +{ + const OUString aServiceName( Oasis2OOoTransformer_getImplementationName() ); + const Sequence< OUString > aSeq( &aServiceName, 1 ); + return aSeq; +} + +Reference< XInterface > SAL_CALL Oasis2OOoTransformer_createInstance( + const Reference< XMultiServiceFactory > &) + throw( Exception ) +{ + OSL_TRACE("Creating Oasis2OOoTransformer"); + return (cppu::OWeakObject*)new Oasis2OOoTransformer; +} diff --git a/xmloff/source/transform/Oasis2OOo.hxx b/xmloff/source/transform/Oasis2OOo.hxx new file mode 100644 index 000000000000..e6230b0bfcc1 --- /dev/null +++ b/xmloff/source/transform/Oasis2OOo.hxx @@ -0,0 +1,71 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_OASIS2OOO_HXX +#define _XMLOFF_OASIS2OOO_HXX + +#include "ActionMapTypesOASIS.hxx" +#ifndef _XMLOFF_TRANSFORMERBASE_HXX_ +#include "TransformerBase.hxx" +#endif + +class XMLTransformerOASISEventMap_Impl; + +class Oasis2OOoTransformer : public XMLTransformerBase +{ + XMLTransformerActions *m_aActions[MAX_OASIS_ACTIONS]; + XMLTransformerOASISEventMap_Impl *m_pEventMap; + XMLTransformerOASISEventMap_Impl *m_pFormEventMap; + +protected: + + virtual XMLTransformerContext *CreateUserDefinedContext( + const TransformerAction_Impl& rAction, + const ::rtl::OUString& rQName, + sal_Bool bPersistent=sal_False ); + + virtual XMLTransformerActions *GetUserDefinedActions( sal_uInt16 n ); + +public: + Oasis2OOoTransformer () throw(); + virtual ~Oasis2OOoTransformer() throw(); + + static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw(); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); + + virtual ::rtl::OUString GetEventName( const ::rtl::OUString& rName, + sal_Bool bForm ); +}; + +#endif // _XMLOFF_OASIS2OOO_HXX diff --git a/xmloff/source/transform/PersAttrListTContext.cxx b/xmloff/source/transform/PersAttrListTContext.cxx new file mode 100644 index 000000000000..b9998d5465e5 --- /dev/null +++ b/xmloff/source/transform/PersAttrListTContext.cxx @@ -0,0 +1,196 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" +#include <com/sun/star/util/XCloneable.hpp> +#include "IgnoreTContext.hxx" +#ifndef _XMLOFF_TRANSFORMERBASE_HXX +#include "TransformerBase.hxx" +#endif +#include "MutableAttrList.hxx" +#include <xmloff/nmspmap.hxx> +#include "PersAttrListTContext.hxx" + +using ::rtl::OUString; + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::util; +using namespace ::com::sun::star::xml::sax; + +TYPEINIT1( XMLPersAttrListTContext, XMLTransformerContext ); + +void XMLPersAttrListTContext::AddAttribute( + sal_uInt16 nAPrefix, + ::xmloff::token::XMLTokenEnum eAToken, + ::xmloff::token::XMLTokenEnum eVToken ) +{ + OUString aAttrValue( ::xmloff::token::GetXMLToken( eVToken ) ); + AddAttribute( nAPrefix, eAToken, aAttrValue ); +} + +void XMLPersAttrListTContext::AddAttribute( + sal_uInt16 nAPrefix, + ::xmloff::token::XMLTokenEnum eAToken, + const ::rtl::OUString & rValue ) +{ + OUString aAttrQName( GetTransformer().GetNamespaceMap().GetQNameByKey( + nAPrefix, ::xmloff::token::GetXMLToken( eAToken ) ) ); + OUString aAttrValue( rValue ); + + XMLMutableAttributeList *pMutableAttrList; + if( m_xAttrList.is() ) + { + pMutableAttrList = + static_cast< XMLMutableAttributeList * >( m_xAttrList.get() ); + } + else + { + pMutableAttrList = new XMLMutableAttributeList ; + m_xAttrList = pMutableAttrList; + } + + pMutableAttrList->AddAttribute( aAttrQName, aAttrValue ); +} + +XMLPersAttrListTContext::XMLPersAttrListTContext( + XMLTransformerBase& rImp, + const OUString& rQName ) : + XMLTransformerContext( rImp, rQName ), + m_aElemQName( rQName ), + m_nActionMap( INVALID_ACTIONS ) +{ +} + +XMLPersAttrListTContext::XMLPersAttrListTContext( + XMLTransformerBase& rImp, + const OUString& rQName, + sal_uInt16 nActionMap ) : + XMLTransformerContext( rImp, rQName ), + m_aElemQName( rQName ), + m_nActionMap( nActionMap ) +{ +} + +XMLPersAttrListTContext::XMLPersAttrListTContext( + XMLTransformerBase& rImp, + const OUString& rQName, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken ) : + XMLTransformerContext( rImp, rQName ), + m_aElemQName( rImp.GetNamespaceMap().GetQNameByKey( nPrefix, + ::xmloff::token::GetXMLToken( eToken ) ) ), + m_nActionMap( INVALID_ACTIONS ) +{ +} + +XMLPersAttrListTContext::XMLPersAttrListTContext( + XMLTransformerBase& rImp, + const OUString& rQName, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken, + sal_uInt16 nActionMap ) : + XMLTransformerContext( rImp, rQName ), + m_aElemQName( rImp.GetNamespaceMap().GetQNameByKey( nPrefix, + ::xmloff::token::GetXMLToken( eToken ) ) ), + m_nActionMap( nActionMap ) +{ +} + +XMLPersAttrListTContext::~XMLPersAttrListTContext() +{ +} + +XMLTransformerContext *XMLPersAttrListTContext::CreateChildContext( + sal_uInt16 /*nPrefix*/, + const OUString& /*rLocalName*/, + const OUString& rQName, + const Reference< XAttributeList >& ) +{ + // ignore all child elements + return new XMLIgnoreTransformerContext( GetTransformer(), + rQName, sal_True, sal_True ); +} + +void XMLPersAttrListTContext::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + XMLMutableAttributeList *pMutableAttrList = 0; + + Reference< XAttributeList > xAttrList( rAttrList ); + if( m_nActionMap != INVALID_ACTIONS ) + { + pMutableAttrList = + GetTransformer().ProcessAttrList( xAttrList, m_nActionMap, + sal_True ); + } + + if( m_xAttrList.is() ) + { + static_cast< XMLMutableAttributeList * >( m_xAttrList.get() ) + ->AppendAttributeList( xAttrList ); + } + else if( pMutableAttrList ) + { + m_xAttrList = xAttrList; + } + else + { + m_xAttrList = new XMLMutableAttributeList( rAttrList, sal_True ); + } +} + +void XMLPersAttrListTContext::EndElement() +{ + // ignore for now +} + +void XMLPersAttrListTContext::Characters( const OUString& ) +{ +} + +sal_Bool XMLPersAttrListTContext::IsPersistent() const +{ + return sal_True; +} + +void XMLPersAttrListTContext::Export() +{ + GetTransformer().GetDocHandler()->startElement( m_aElemQName, m_xAttrList ); + ExportContent(); + GetTransformer().GetDocHandler()->endElement( m_aElemQName ); +} + +void XMLPersAttrListTContext::ExportContent() +{ + // nothing to export +} + +Reference< XAttributeList > XMLPersAttrListTContext::GetAttrList() const +{ + return m_xAttrList; +} diff --git a/xmloff/source/transform/PersAttrListTContext.hxx b/xmloff/source/transform/PersAttrListTContext.hxx new file mode 100644 index 000000000000..b766fa1796f3 --- /dev/null +++ b/xmloff/source/transform/PersAttrListTContext.hxx @@ -0,0 +1,122 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_PERSATTRLISTTCONTEXT_HXX +#define _XMLOFF_PERSATTRLISTTCONTEXT_HXX + +#include <xmloff/xmltoken.hxx> +#include "TransformerContext.hxx" + + +class XMLPersAttrListTContext : public XMLTransformerContext +{ + + ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > m_xAttrList; + ::rtl::OUString m_aElemQName; + sal_uInt16 m_nActionMap; + +protected: + + void SetExportQName( const ::rtl::OUString& r ) { m_aElemQName = r; } + +public: + TYPEINFO(); + + // A contexts constructor does anything that is required if an element + // starts. Namespace processing has been done already. + // Note that virtual methods cannot be used inside constructors. Use + // StartElement instead if this is required. + XMLPersAttrListTContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName ); + + // attr list persistence + attribute processing + XMLPersAttrListTContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName, + sal_uInt16 nActionMap ); + + // attr list persistence + renaming + XMLPersAttrListTContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken ); + + // attr list persistence + renaming + attribute processing + XMLPersAttrListTContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken, + sal_uInt16 nActionMap ); + + // A contexts destructor does anything that is required if an element + // ends. By default, nothing is done. + // Note that virtual methods cannot be used inside destructors. Use + // EndElement instead if this is required. + virtual ~XMLPersAttrListTContext(); + + // Create a childs element context. By default, the import's + // CreateContext method is called to create a new default context. + virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix, + const ::rtl::OUString& rLocalName, + const ::rtl::OUString& rQName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + // StartElement is called after a context has been constructed and + // before a elements context is parsed. It may be used for actions that + // require virtual methods. The default is to do nothing. + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + // EndElement is called before a context will be destructed, but + // after a elements context has been parsed. It may be used for actions + // that require virtual methods. The default is to do nothing. + virtual void EndElement(); + + // This method is called for all characters that are contained in the + // current element. + virtual void Characters( const ::rtl::OUString& rChars ); + + virtual sal_Bool IsPersistent() const; + virtual void Export(); + virtual void ExportContent(); + + const ::rtl::OUString& GetExportQName() const { return m_aElemQName; } + + void AddAttribute( sal_uInt16 nAPrefix, + ::xmloff::token::XMLTokenEnum eAToken, + ::xmloff::token::XMLTokenEnum eVToken ); + + void AddAttribute( sal_uInt16 nAPrefix, + ::xmloff::token::XMLTokenEnum eAToken, + const ::rtl::OUString & rValue ); + + ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > + GetAttrList() const; +}; + +#endif // _XMLOFF_PERSATTRLISTTCONTEXT_HXX + diff --git a/xmloff/source/transform/PersMixedContentTContext.cxx b/xmloff/source/transform/PersMixedContentTContext.cxx new file mode 100644 index 000000000000..72fcb6c69248 --- /dev/null +++ b/xmloff/source/transform/PersMixedContentTContext.cxx @@ -0,0 +1,160 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" + +#ifndef _XMLOFF_TRANSFORMERBASE_HXX +#include "TransformerBase.hxx" +#endif +#include "PersMixedContentTContext.hxx" + +using ::rtl::OUString; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; + +//------------------------------------------------------------------------------ +class XMLPersTextTContext_Impl : public XMLTransformerContext +{ + ::rtl::OUString m_aCharacters; + +public: + TYPEINFO(); + + XMLPersTextTContext_Impl( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rChars ); + virtual ~XMLPersTextTContext_Impl(); + + virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix, + const ::rtl::OUString& rLocalName, + const ::rtl::OUString& rQName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + virtual void EndElement(); + virtual void Characters( const ::rtl::OUString& rChars ); + + virtual sal_Bool IsPersistent() const; + virtual void Export(); + const ::rtl::OUString& GetText() const { return m_aCharacters; } +}; + +TYPEINIT1( XMLPersTextTContext_Impl, XMLTransformerContext ); + +XMLPersTextTContext_Impl::XMLPersTextTContext_Impl( + XMLTransformerBase& rImp, + const OUString& rChars ) : + XMLTransformerContext( rImp, OUString() ), + m_aCharacters( rChars ) +{ +} + +XMLPersTextTContext_Impl::~XMLPersTextTContext_Impl() +{ +} + +XMLTransformerContext *XMLPersTextTContext_Impl::CreateChildContext( + sal_uInt16, + const OUString&, + const OUString&, + const Reference< XAttributeList >& ) +{ + OSL_ENSURE( !this, "illegal call to CreateChildContext" ); + return 0; +} + +void XMLPersTextTContext_Impl::StartElement( + const Reference< XAttributeList >& ) +{ + OSL_ENSURE( !this, "illegal call to StartElement" ); +} + +void XMLPersTextTContext_Impl::EndElement() +{ + OSL_ENSURE( !this, "illegal call to EndElement" ); +} + +sal_Bool XMLPersTextTContext_Impl::IsPersistent() const +{ + return sal_True; +} + +void XMLPersTextTContext_Impl::Characters( const OUString& rChars ) +{ + m_aCharacters += rChars; +} + +void XMLPersTextTContext_Impl::Export() +{ + GetTransformer().GetDocHandler()->characters( m_aCharacters ); +} + +//------------------------------------------------------------------------------ + +TYPEINIT1( XMLPersMixedContentTContext, XMLPersElemContentTContext ); + +XMLPersMixedContentTContext::XMLPersMixedContentTContext( + XMLTransformerBase& rImp, + const OUString& rQName ) : + XMLPersElemContentTContext( rImp, rQName ) +{ +} + +XMLPersMixedContentTContext::XMLPersMixedContentTContext( + XMLTransformerBase& rImp, + const OUString& rQName, + sal_uInt16 nActionMap ) : + XMLPersElemContentTContext( rImp, rQName, nActionMap ) +{ +} + +XMLPersMixedContentTContext::XMLPersMixedContentTContext( + XMLTransformerBase& rImp, + const OUString& rQName, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken ) : + XMLPersElemContentTContext( rImp, rQName, nPrefix, eToken ) +{ +} + +XMLPersMixedContentTContext::XMLPersMixedContentTContext( + XMLTransformerBase& rImp, + const OUString& rQName, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken, + sal_uInt16 nActionMap ) : + XMLPersElemContentTContext( rImp, rQName, nPrefix, eToken, nActionMap ) +{ +} + +XMLPersMixedContentTContext::~XMLPersMixedContentTContext() +{ +} + +void XMLPersMixedContentTContext::Characters( const OUString& rChars ) +{ + AddContent( new XMLPersTextTContext_Impl( GetTransformer(), rChars ) ); +} diff --git a/xmloff/source/transform/PersMixedContentTContext.hxx b/xmloff/source/transform/PersMixedContentTContext.hxx new file mode 100644 index 000000000000..a598a08aeaec --- /dev/null +++ b/xmloff/source/transform/PersMixedContentTContext.hxx @@ -0,0 +1,69 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_PERSMIXEDCONTENTTCONTEXT_HXX +#define _XMLOFF_PERSMIXEDCONTENTTCONTEXT_HXX + +#include <rtl/ref.hxx> + +#include <vector> +#include "DeepTContext.hxx" + +class XMLPersMixedContentTContext : public XMLPersElemContentTContext +{ +public: + TYPEINFO(); + + // mixed content persistence only + XMLPersMixedContentTContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName ); + + // mixed content persistence + attribute processing + XMLPersMixedContentTContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName, + sal_uInt16 nActionMap ); + + // mixed content persistence + renaming + XMLPersMixedContentTContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken ); + + // mixed content persistence + renaming + attribute processing + XMLPersMixedContentTContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken, + sal_uInt16 nActionMap ); + + virtual void Characters( const ::rtl::OUString& rChars ); + + virtual ~XMLPersMixedContentTContext(); +}; + +#endif // _XMLOFF_PERSMIXEDCONTENTTCONTEXT_HXX + diff --git a/xmloff/source/transform/ProcAddAttrTContext.cxx b/xmloff/source/transform/ProcAddAttrTContext.cxx new file mode 100644 index 000000000000..02874fd9dc1f --- /dev/null +++ b/xmloff/source/transform/ProcAddAttrTContext.cxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" +#include "ProcAddAttrTContext.hxx" +#include "MutableAttrList.hxx" +#ifndef _XMLOFF_TRANSFORMERBASE_HXX +#include "TransformerBase.hxx" +#endif +#include <xmloff/nmspmap.hxx> + +using ::rtl::OUString; + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; +using namespace ::xmloff::token; + +TYPEINIT1( XMLProcAddAttrTransformerContext, XMLProcAttrTransformerContext); + +XMLProcAddAttrTransformerContext::XMLProcAddAttrTransformerContext( + XMLTransformerBase& rImp, + const OUString& rQName, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken, + sal_uInt16 nActionMap, + sal_uInt16 nAPrefix, + ::xmloff::token::XMLTokenEnum eAToken, + ::xmloff::token::XMLTokenEnum eVToken ) : + XMLProcAttrTransformerContext( rImp, rQName, nPrefix, eToken, nActionMap ), + m_aAttrQName( rImp.GetNamespaceMap().GetQNameByKey( nAPrefix, + ::xmloff::token::GetXMLToken( eAToken ) ) ), + m_aAttrValue( ::xmloff::token::GetXMLToken( eVToken ) ) +{ +} + +XMLProcAddAttrTransformerContext::~XMLProcAddAttrTransformerContext() +{ +} + +void XMLProcAddAttrTransformerContext::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + Reference< XAttributeList > xAttrList( rAttrList ); + XMLMutableAttributeList *pMutableAttrList = + GetTransformer().ProcessAttrList( xAttrList, GetActionMap(), + sal_False ); + if( !pMutableAttrList ) + { + pMutableAttrList = new XMLMutableAttributeList; + xAttrList = pMutableAttrList; + } + pMutableAttrList->AddAttribute( m_aAttrQName, m_aAttrValue ); + GetTransformer().GetDocHandler()->startElement( GetElemQName(), xAttrList ); +} + diff --git a/xmloff/source/transform/ProcAddAttrTContext.hxx b/xmloff/source/transform/ProcAddAttrTContext.hxx new file mode 100644 index 000000000000..0068c9278ec8 --- /dev/null +++ b/xmloff/source/transform/ProcAddAttrTContext.hxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_PROCADDATTRTCONTEXT_HXX +#define _XMLOFF_PROCADDATTRTCONTEXT_HXX + +#include "ProcAttrTContext.hxx" + +class XMLMutableAttributeList; +class XMLTransformerActions; +class XMLProcAddAttrTransformerContext : public XMLProcAttrTransformerContext +{ + ::rtl::OUString m_aAttrQName; + ::rtl::OUString m_aAttrValue; + +public: + TYPEINFO(); + + XMLProcAddAttrTransformerContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken, + sal_uInt16 nActionMap, + sal_uInt16 nAPrefix, + ::xmloff::token::XMLTokenEnum eAToken, + ::xmloff::token::XMLTokenEnum eVToken ); + + virtual ~XMLProcAddAttrTransformerContext(); + + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); +}; + +#endif // _XMLOFF_PROCADDATTRCONTEXT_HXX + diff --git a/xmloff/source/transform/ProcAttrTContext.cxx b/xmloff/source/transform/ProcAttrTContext.cxx new file mode 100644 index 000000000000..b068ba03e558 --- /dev/null +++ b/xmloff/source/transform/ProcAttrTContext.cxx @@ -0,0 +1,84 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" +#include "ProcAttrTContext.hxx" +#include "MutableAttrList.hxx" +#ifndef _XMLOFF_TRANSFORMERBASE_HXX +#include "TransformerBase.hxx" +#endif +#include "TransformerActions.hxx" +#include <xmloff/nmspmap.hxx> + +using ::rtl::OUString; + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; +using namespace ::xmloff::token; + +TYPEINIT1( XMLProcAttrTransformerContext, XMLTransformerContext ); + +XMLProcAttrTransformerContext::XMLProcAttrTransformerContext( + XMLTransformerBase& rImp, + const OUString& rQName, + sal_uInt16 nActionMap ) : + XMLTransformerContext( rImp, rQName ), + m_aElemQName( rQName ), + m_nActionMap( nActionMap ) +{ +} + +XMLProcAttrTransformerContext::XMLProcAttrTransformerContext( + XMLTransformerBase& rImp, + const OUString& rQName, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken, + sal_uInt16 nActionMap ) : + XMLTransformerContext( rImp, rQName ), + m_aElemQName( rImp.GetNamespaceMap().GetQNameByKey( nPrefix, + ::xmloff::token::GetXMLToken( eToken ) ) ), + m_nActionMap( nActionMap ) +{ +} + +XMLProcAttrTransformerContext::~XMLProcAttrTransformerContext() +{ +} + +void XMLProcAttrTransformerContext::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + Reference< XAttributeList > xAttrList( rAttrList ); + GetTransformer().ProcessAttrList( xAttrList, m_nActionMap, sal_False ); + GetTransformer().GetDocHandler()->startElement( m_aElemQName, xAttrList ); +} + +void XMLProcAttrTransformerContext::EndElement() +{ + GetTransformer().GetDocHandler()->endElement( m_aElemQName ); +} diff --git a/xmloff/source/transform/ProcAttrTContext.hxx b/xmloff/source/transform/ProcAttrTContext.hxx new file mode 100644 index 000000000000..6c82058d529b --- /dev/null +++ b/xmloff/source/transform/ProcAttrTContext.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_PROCATTRTCONTEXT_HXX +#define _XMLOFF_PROCATTRTCONTEXT_HXX + +#include <xmloff/xmltoken.hxx> +#include "TransformerContext.hxx" + +class XMLMutableAttributeList; +class XMLTransformerActions; +class XMLProcAttrTransformerContext : public XMLTransformerContext +{ + ::rtl::OUString m_aElemQName; + sal_uInt16 m_nActionMap; + +protected: + + const ::rtl::OUString& GetElemQName() const { return m_aElemQName; } + sal_uInt16 GetActionMap() const { return m_nActionMap; } + +public: + TYPEINFO(); + + XMLProcAttrTransformerContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName, + sal_uInt16 nActionMap ); + + XMLProcAttrTransformerContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken, + sal_uInt16 nActionMap ); + + virtual ~XMLProcAttrTransformerContext(); + + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + virtual void EndElement(); +}; + +#endif // _XMLOFF_PROCATTRCONTEXT_HXX + diff --git a/xmloff/source/transform/PropType.hxx b/xmloff/source/transform/PropType.hxx new file mode 100644 index 000000000000..d62cb47e84ba --- /dev/null +++ b/xmloff/source/transform/PropType.hxx @@ -0,0 +1,50 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_PROPTYPE_HXX +#define _XMLOFF_PROPTYPE_HXX + +enum XMLPropType +{ + XML_PROP_TYPE_GRAPHIC, + XML_PROP_TYPE_DRAWING_PAGE, + XML_PROP_TYPE_PAGE_LAYOUT, + XML_PROP_TYPE_HEADER_FOOTER, + XML_PROP_TYPE_TEXT, + XML_PROP_TYPE_PARAGRAPH, + XML_PROP_TYPE_RUBY, + XML_PROP_TYPE_SECTION, + XML_PROP_TYPE_TABLE, + XML_PROP_TYPE_TABLE_COLUMN, + XML_PROP_TYPE_TABLE_ROW, + XML_PROP_TYPE_TABLE_CELL, + XML_PROP_TYPE_LIST_LEVEL, + XML_PROP_TYPE_CHART, + XML_PROP_TYPE_END +}; + +#endif // _XMLOFF_PROPTYPE_HXX diff --git a/xmloff/source/transform/PropertyActionsOASIS.cxx b/xmloff/source/transform/PropertyActionsOASIS.cxx new file mode 100644 index 000000000000..3abafaa5a13e --- /dev/null +++ b/xmloff/source/transform/PropertyActionsOASIS.cxx @@ -0,0 +1,554 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" +#include "xmloff/xmlnmspe.hxx" +#include "PropType.hxx" +#include "FamilyType.hxx" +#include "PropertyActionsOASIS.hxx" + +using namespace ::xmloff::token; + +#define NO_PARAMS 0, 0, 0 + +XMLTransformerActionInit aGraphicPropertyOASISAttrActionTable[] = +{ + { XML_NAMESPACE_SVG, XML_STROKE_WIDTH, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_MARKER_START_WIDTH, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_MARKER_END_WIDTH, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_SHADOW_OFFSET_X, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_SHADOW_OFFSET_Y, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_SHADOW_OPACITY, + XML_ATACTION_RENAME_NEG_PERCENT, + XMLTransformerActionInit::QNameParam( XML_NAMESPACE_DRAW, + XML_SHADOW_TRANSPARENCY), 0, 0 }, + { XML_NAMESPACE_DRAW, XML_GUIDE_OVERHANG, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_START_GUIDE, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_END_GUIDE, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_CAPTION_ESCAPE, XML_ATACTION_CAPTION_ESCAPE_OASIS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_CAPTION_LINE_LENGTH, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DR3D, XML_DEPTH, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_SVG, XML_WIDTH, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_SVG, XML_HEIGHT, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MAX_HEIGHT, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MAX_WIDTH, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER_TOP, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER_LEFT, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER_RIGHT, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_TOP, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_BOTTOM, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_LEFT, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_RIGHT, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_TOP, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_BOTTOM, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_LEFT, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_RIGHT, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_SHADOW, XML_ATACTION_INS2INCHS, + NO_PARAMS }, + { XML_NAMESPACE_FO, XML_CLIP, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ +// { XML_NAMESPACE_STYLE, XML_WRAP_DYNAMIC_TRESHOLD, XML_ATACTION_REMOVE, +// NO_PARAMS }, /* generated entry */ // TODO + { XML_NAMESPACE_DRAW, XML_VISIBLE_AREA_LEFT, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_VISIBLE_AREA_TOP, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_VISIBLE_AREA_WIDTH, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_VISIBLE_AREA_HEIGHT, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_START_LINE_SPACING_HORIZONTAL, XML_ATACTION_IN2INCH, NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_START_LINE_SPACING_VERTICAL, XML_ATACTION_IN2INCH, NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_END_LINE_SPACING_HORIZONTAL, XML_ATACTION_IN2INCH, NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_END_LINE_SPACING_VERTICAL, XML_ATACTION_IN2INCH, NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_LINE_DISTANCE, XML_ATACTION_IN2INCH, NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_GUIDE_DISTANCE, XML_ATACTION_IN2INCH, NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_CAPTION_GAP, XML_ATACTION_IN2INCH, NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_SVG, XML_X, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_SVG, XML_Y, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_STROKE_DASH, XML_ATACTION_DECODE_STYLE_NAME_REF, + XML_FAMILY_TYPE_STROKE_DASH, 0, 0 }, + { XML_NAMESPACE_DRAW, XML_MARKER_START, XML_ATACTION_DECODE_STYLE_NAME_REF, + XML_FAMILY_TYPE_MARKER, 0, 0 }, + { XML_NAMESPACE_DRAW, XML_MARKER_END, XML_ATACTION_DECODE_STYLE_NAME_REF, + XML_FAMILY_TYPE_MARKER, 0, 0 }, + { XML_NAMESPACE_DRAW, XML_FILL_GRADIENT_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, + XML_FAMILY_TYPE_GRADIENT, 0, 0 }, + + // #i25616# + { XML_NAMESPACE_DRAW, XML_OPACITY, XML_OPTACTION_OPACITY, NO_PARAMS }, + { XML_NAMESPACE_DRAW, XML_IMAGE_OPACITY, XML_OPTACTION_IMAGE_OPACITY, NO_PARAMS }, + + { XML_NAMESPACE_DRAW, XML_STROKE_LINEJOIN, XML_ATACTION_RENAME, + XMLTransformerActionInit::QNameParam( XML_NAMESPACE_SVG, + XML_STROKE_LINEJOIN), 0, 0 }, + { XML_NAMESPACE_DRAW, XML_OPACITY_NAME, + XML_ATACTION_RENAME_DECODE_STYLE_NAME_REF, + XMLTransformerActionInit::QNameParam( XML_NAMESPACE_DRAW, + XML_TRANSPARENCY_NAME), + XML_FAMILY_TYPE_GRADIENT, 0 }, + { XML_NAMESPACE_DRAW, XML_FILL_HATCH_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, + XML_FAMILY_TYPE_HATCH, 0, 0 }, + { XML_NAMESPACE_DRAW, XML_FILL_IMAGE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, + XML_FAMILY_TYPE_FILL_IMAGE, 0, 0 }, + + // Font work properties + { XML_NAMESPACE_DRAW, XML_FONTWORK_DISTANCE, XML_ATACTION_IN2INCH, NO_PARAMS }, + { XML_NAMESPACE_DRAW, XML_FONTWORK_START, XML_ATACTION_IN2INCH, NO_PARAMS }, + { XML_NAMESPACE_DRAW, XML_FONTWORK_SHADOW_OFFSET_X, XML_ATACTION_IN2INCH, NO_PARAMS }, + { XML_NAMESPACE_DRAW, XML_FONTWORK_SHADOW_OFFSET_Y, XML_ATACTION_IN2INCH, NO_PARAMS }, + + { XML_NAMESPACE_DRAW, XML_AUTO_GROW_WIDTH, XML_ATACTION_RENAME, + XMLTransformerActionInit::QNameParam( XML_NAMESPACE_DRAW, + XML_AUTO_GROW_HEIGHT ), 0, 0 }, + { XML_NAMESPACE_DRAW, XML_AUTO_GROW_HEIGHT, XML_ATACTION_RENAME, + XMLTransformerActionInit::QNameParam( XML_NAMESPACE_DRAW, + XML_AUTO_GROW_WIDTH ), 0, 0 }, + { XML_NAMESPACE_PRESENTATION, XML_DURATION, XML_ATACTION_RNG2ISO_DATETIME, NO_PARAMS }, + { XML_NAMESPACE_TEXT, XML_ANIMATION_DELAY, XML_ATACTION_RNG2ISO_DATETIME, NO_PARAMS }, + + { XML_NAMESPACE_STYLE, XML_PROTECT, XML_ATACTION_DECODE_PROTECT, NO_PARAMS }, + { XML_NAMESPACE_STYLE, XML_MIRROR, XML_ATACTION_DRAW_MIRROR_OASIS, NO_PARAMS }, + { XML_NAMESPACE_DRAW, XML_GAMMA, XML_ATACTION_GAMMA_OASIS, NO_PARAMS }, + { XML_NAMESPACE_SVG, XML_STROKE_OPACITY, XML_ATACTION_OPACITY_FIX, NO_PARAMS }, + + { XML_NAMESPACE_STYLE, XML_FLOW_WITH_TEXT, XML_ATACTION_REMOVE, + NO_PARAMS }, + { XML_NAMESPACE_DRAW, XML_WRAP_INFLUENCE_ON_POSITION, XML_ATACTION_REMOVE, + NO_PARAMS }, + + { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS } +}; + +XMLTransformerActionInit aDrawingPagePropertyOASISAttrActionTable[] = +{ + // style-graphic-fill-properties-attlist + { XML_NAMESPACE_DRAW, XML_FILL_GRADIENT_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, + NO_PARAMS }, + { XML_NAMESPACE_DRAW, XML_FILL_HATCH_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_FILL_IMAGE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, + NO_PARAMS }, + { XML_NAMESPACE_DRAW, XML_FILL_IMAGE_WIDTH, XML_ATACTION_IN2INCH, NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_FILL_IMAGE_HEIGHT, XML_ATACTION_IN2INCH, NO_PARAMS }, /* generated entry */ + + { XML_NAMESPACE_PRESENTATION, XML_DISPLAY_HEADER, XML_ATACTION_REMOVE, NO_PARAMS }, + { XML_NAMESPACE_PRESENTATION, XML_DISPLAY_FOOTER, XML_ATACTION_REMOVE, NO_PARAMS }, + { XML_NAMESPACE_PRESENTATION, XML_DISPLAY_PAGE_NUMBER, XML_ATACTION_REMOVE, NO_PARAMS }, + { XML_NAMESPACE_PRESENTATION, XML_DISPLAY_DATE_TIME, XML_ATACTION_REMOVE, NO_PARAMS }, + + { XML_NAMESPACE_SMIL, XML_TYPE, XML_ATACTION_REMOVE, NO_PARAMS }, + { XML_NAMESPACE_SMIL, XML_SUBTYPE, XML_ATACTION_REMOVE, NO_PARAMS }, + { XML_NAMESPACE_SMIL, XML_DIRECTION, XML_ATACTION_REMOVE, NO_PARAMS }, + { XML_NAMESPACE_SMIL, XML_FADECOLOR, XML_ATACTION_REMOVE, NO_PARAMS }, + + { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS } +}; + +XMLTransformerActionInit aPageLayoutPropertyOASISAttrActionTable[] = +{ + { XML_NAMESPACE_FO, XML_PAGE_WIDTH, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PAGE_HEIGHT, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER_TOP, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER_LEFT, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER_RIGHT, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_TOP, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_BOTTOM, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_LEFT, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_RIGHT, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_TOP, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_BOTTOM, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_LEFT, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_RIGHT, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_SHADOW, XML_ATACTION_INS2INCHS, + NO_PARAMS }, + { XML_NAMESPACE_STYLE, XML_FOOTNOTE_MAX_HEIGHT, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_BASE_HEIGHT, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_RUBY_HEIGHT, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_REGISTER_TRUTH_REF_STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, XML_FAMILY_TYPE_PARAGRAPH, 0, 0 }, + { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS } +}; + +XMLTransformerActionInit aHeaderFooterPropertyOASISAttrActionTable[] = +{ + { XML_NAMESPACE_SVG, XML_HEIGHT, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MIN_HEIGHT, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER_TOP, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER_LEFT, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER_RIGHT, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_TOP, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_BOTTOM, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_LEFT, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_RIGHT, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_TOP, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_BOTTOM, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_LEFT, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_RIGHT, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_SHADOW, XML_ATACTION_INS2INCHS, + NO_PARAMS }, + { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS } +}; + +XMLTransformerActionInit aTextPropertyOASISAttrActionTable[] = +{ + { XML_NAMESPACE_FO, XML_FONT_SIZE, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_FONT_SIZE_ASIAN, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_FONT_SIZE_COMPLEX, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_FONT_SIZE_REL, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_FONT_SIZE_REL_ASIAN, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_FONT_SIZE_REL_COMPLEX, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_LETTER_SPACING, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_TEXT_SHADOW, XML_ATACTION_INS2INCHS, + NO_PARAMS }, + { XML_NAMESPACE_STYLE, XML_TEXT_UNDERLINE_TYPE, + XML_OPTACTION_UNDERLINE_TYPE, NO_PARAMS }, /* new attribute */ + { XML_NAMESPACE_STYLE, XML_TEXT_UNDERLINE_STYLE, + XML_OPTACTION_UNDERLINE_STYLE, NO_PARAMS }, /* new attribute */ + { XML_NAMESPACE_STYLE, XML_TEXT_UNDERLINE_WIDTH, + XML_OPTACTION_UNDERLINE_WIDTH, NO_PARAMS }, /* new attribute */ + { XML_NAMESPACE_STYLE, XML_TEXT_UNDERLINE_MODE, + XML_OPTACTION_LINE_MODE, NO_PARAMS }, + { XML_NAMESPACE_STYLE, XML_TEXT_LINE_THROUGH_TYPE, + XML_OPTACTION_LINETHROUGH_TYPE, NO_PARAMS }, /* new entry*/ + { XML_NAMESPACE_STYLE, XML_TEXT_LINE_THROUGH_STYLE, + XML_OPTACTION_LINETHROUGH_STYLE, NO_PARAMS }, /* new entry*/ + { XML_NAMESPACE_STYLE, XML_TEXT_LINE_THROUGH_WIDTH, + XML_OPTACTION_LINETHROUGH_WIDTH, NO_PARAMS }, /* new entry*/ + { XML_NAMESPACE_STYLE, XML_TEXT_LINE_THROUGH_COLOR, + XML_ATACTION_REMOVE, NO_PARAMS }, /* new entry*/ + { XML_NAMESPACE_STYLE, XML_TEXT_LINE_THROUGH_TEXT, + XML_OPTACTION_LINETHROUGH_TEXT, NO_PARAMS }, /* new entry*/ + { XML_NAMESPACE_STYLE, XML_TEXT_LINE_THROUGH_TEXT_STYLE, + XML_ATACTION_REMOVE, NO_PARAMS }, /* new entry*/ + { XML_NAMESPACE_STYLE, XML_TEXT_LINE_THROUGH_MODE, + XML_OPTACTION_LINE_MODE, NO_PARAMS }, + { XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_ATACTION_RENAME, + XMLTransformerActionInit::QNameParam( XML_NAMESPACE_STYLE, + XML_TEXT_BACKGROUND_COLOR ), 0, 0 }, + { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS } +}; + +XMLTransformerActionInit aParagraphPropertyOASISAttrActionTable[] = +{ + { XML_NAMESPACE_FO, XML_TEXT_ALIGN, XML_OPTACTION_CONTROL_TEXT_ALIGN, + NO_PARAMS }, + { XML_NAMESPACE_FO, XML_LINE_HEIGHT, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_LINE_HEIGHT_AT_LEAST, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_LINE_SPACING, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_TAB_STOP_DISTANCE, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_TEXT_INDENT, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_TOP, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_BOTTOM, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_LEFT, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_RIGHT, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_TOP, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_BOTTOM, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_LEFT, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_RIGHT, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_SHADOW, XML_ATACTION_INS2INCHS, + NO_PARAMS }, + { XML_NAMESPACE_FO, XML_KEEP_WITH_NEXT, XML_OPTACTION_KEEP_WITH_NEXT, + NO_PARAMS }, + { XML_NAMESPACE_FO, XML_KEEP_TOGETHER, XML_OPTACTION_KEEP_TOGETHER, + NO_PARAMS }, +// { XML_NAMESPACE_STYLE, XML_WRITING_MODE, XML_OPTACTION_DRAW_WRITING_MODE, 0 }, + { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS } +}; + +XMLTransformerActionInit aSectionPropertyOASISAttrActionTable[] = +{ + { XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS } +}; + +XMLTransformerActionInit aTablePropertyOASISAttrActionTable[] = +{ + { XML_NAMESPACE_STYLE, XML_WIDTH, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_KEEP_WITH_NEXT, XML_OPTACTION_KEEP_WITH_NEXT, + NO_PARAMS }, + { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS } +}; + +XMLTransformerActionInit aTableColumnPropertyOASISAttrActionTable[] = +{ + { XML_NAMESPACE_STYLE, XML_COLUMN_WIDTH, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS } +}; + +XMLTransformerActionInit aTableRowPropertyOASISAttrActionTable[] = +{ + { XML_NAMESPACE_STYLE, XML_ROW_HEIGHT, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_MIN_ROW_HEIGHT, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS } +}; + +XMLTransformerActionInit aTableCellPropertyOASISAttrActionTable[] = +{ + { XML_NAMESPACE_STYLE, XML_VERTICAL_ALIGN, XML_ATACTION_RENAME, + XMLTransformerActionInit::QNameParam( XML_NAMESPACE_FO, + XML_VERTICAL_ALIGN ), 0, 0 }, + { XML_NAMESPACE_FO, XML_BORDER, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER_TOP, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER_LEFT, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER_RIGHT, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_TOP, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_BOTTOM, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_LEFT, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_RIGHT, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_DIAGONAL_BL_TR, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_DIAGONAL_BL_TR_WIDTH, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_DIAGONAL_TL_BR, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_DIAGONAL_TL_BR_WIDTH, XML_ATACTION_INS2INCHS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_TOP, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_BOTTOM, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_LEFT, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_RIGHT, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_DIRECTION, XML_ATACTION_RENAME, + XMLTransformerActionInit::QNameParam( XML_NAMESPACE_FO, + XML_DIRECTION), 0, 0 }, + { XML_NAMESPACE_STYLE, XML_SHADOW, XML_ATACTION_INS2INCHS, + NO_PARAMS }, + { XML_NAMESPACE_STYLE, XML_REPEAT_CONTENT, XML_ATACTION_REMOVE, + NO_PARAMS }, /* new entry*/ + { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS } +}; + +XMLTransformerActionInit aListLevelPropertyOASISAttrActionTable[] = +{ + { XML_NAMESPACE_TEXT, XML_SPACE_BEFORE, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_TEXT, XML_MIN_LABEL_WIDTH, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_TEXT, XML_MIN_LABEL_DISTANCE, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_WIDTH, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_HEIGHT, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS } +}; + +XMLTransformerActionInit aChartPropertyOASISAttrActionTable[] = +{ + { XML_NAMESPACE_CHART, XML_SYMBOL_WIDTH, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_SYMBOL_HEIGHT, XML_ATACTION_IN2INCH, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_DIRECTION, XML_ATACTION_RENAME, + XMLTransformerActionInit::QNameParam( XML_NAMESPACE_FO, + XML_DIRECTION ), 0, 0 }, + { XML_NAMESPACE_CHART, XML_INTERPOLATION, XML_OPTACTION_INTERPOLATION, NO_PARAMS }, + { XML_NAMESPACE_STYLE, XML_ROTATION_ANGLE, XML_ATACTION_RENAME, + XMLTransformerActionInit::QNameParam( XML_NAMESPACE_TEXT, + XML_ROTATION_ANGLE ), 0, 0 }, + { XML_NAMESPACE_CHART, XML_INTERVAL_MAJOR, XML_OPTACTION_INTERVAL_MAJOR, NO_PARAMS }, + { XML_NAMESPACE_CHART, XML_INTERVAL_MINOR_DIVISOR, XML_OPTACTION_INTERVAL_MINOR_DIVISOR, + NO_PARAMS }, + { XML_NAMESPACE_CHART, XML_JAPANESE_CANDLE_STICK, XML_ATACTION_RENAME, + XMLTransformerActionInit::QNameParam( XML_NAMESPACE_CHART, + XML_STOCK_UPDOWN_BARS ), 0, 0 }, + { XML_NAMESPACE_CHART, XML_SYMBOL_TYPE, XML_OPTACTION_SYMBOL_TYPE, NO_PARAMS }, + { XML_NAMESPACE_CHART, XML_SYMBOL_NAME, XML_OPTACTION_SYMBOL_NAME, NO_PARAMS }, + + { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS } +}; diff --git a/xmloff/source/transform/PropertyActionsOASIS.hxx b/xmloff/source/transform/PropertyActionsOASIS.hxx new file mode 100644 index 000000000000..9d5e33c6194b --- /dev/null +++ b/xmloff/source/transform/PropertyActionsOASIS.hxx @@ -0,0 +1,75 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_PROPERTYACTIONSOASIS_HXX +#define _XMLOFF_PROPERTYACTIONSOASIS_HXX + +#include "TransformerAction.hxx" +#include "TransformerActionInit.hxx" +#include "AttrTransformerAction.hxx" + +enum XMLPropOASISTransformerAction +{ + XML_OPTACTION_LINE_MODE=XML_ATACTION_USER_DEFINED, + XML_OPTACTION_UNDERLINE_TYPE, + XML_OPTACTION_UNDERLINE_STYLE, + XML_OPTACTION_UNDERLINE_WIDTH, + XML_OPTACTION_LINETHROUGH_TYPE, + XML_OPTACTION_LINETHROUGH_STYLE, + XML_OPTACTION_LINETHROUGH_WIDTH, + XML_OPTACTION_LINETHROUGH_TEXT, + XML_OPTACTION_KEEP_WITH_NEXT, + XML_OPTACTION_INTERPOLATION, + XML_OPTACTION_INTERVAL_MAJOR, + XML_OPTACTION_INTERVAL_MINOR_DIVISOR, + XML_OPTACTION_SYMBOL_TYPE, + XML_OPTACTION_SYMBOL_NAME, + XML_OPTACTION_OPACITY, + XML_OPTACTION_IMAGE_OPACITY, + XML_OPTACTION_KEEP_TOGETHER, + XML_OPTACTION_CONTROL_TEXT_ALIGN, + XML_OPTACTION_DRAW_WRITING_MODE, + XML_ATACTION_CAPTION_ESCAPE_OASIS, + XML_ATACTION_DECODE_PROTECT, + XML_OPTACTION_END=XML_ATACTION_END +}; + +extern XMLTransformerActionInit aGraphicPropertyOASISAttrActionTable[]; +extern XMLTransformerActionInit aDrawingPagePropertyOASISAttrActionTable[]; +extern XMLTransformerActionInit aPageLayoutPropertyOASISAttrActionTable[]; +extern XMLTransformerActionInit aHeaderFooterPropertyOASISAttrActionTable[]; +extern XMLTransformerActionInit aTextPropertyOASISAttrActionTable[]; +extern XMLTransformerActionInit aParagraphPropertyOASISAttrActionTable[]; +extern XMLTransformerActionInit aSectionPropertyOASISAttrActionTable[]; +extern XMLTransformerActionInit aTablePropertyOASISAttrActionTable[]; +extern XMLTransformerActionInit aTableColumnPropertyOASISAttrActionTable[]; +extern XMLTransformerActionInit aTableRowPropertyOASISAttrActionTable[]; +extern XMLTransformerActionInit aTableCellPropertyOASISAttrActionTable[]; +extern XMLTransformerActionInit aListLevelPropertyOASISAttrActionTable[]; +extern XMLTransformerActionInit aChartPropertyOASISAttrActionTable[]; + +#endif // _XMLOFF_PROPERTYACTIONSOASIS_HXX diff --git a/xmloff/source/transform/PropertyActionsOOo.cxx b/xmloff/source/transform/PropertyActionsOOo.cxx new file mode 100644 index 000000000000..bc91561de206 --- /dev/null +++ b/xmloff/source/transform/PropertyActionsOOo.cxx @@ -0,0 +1,1068 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" +#include "xmloff/xmlnmspe.hxx" +#include "PropType.hxx" +#include "PropertyActionsOOo.hxx" + +using namespace ::xmloff::token; + +#define NO_PARAMS 0, 0, 0 + +XMLTransformerActionInit aGraphicPropertyOOoAttrActionTable[] = +{ + { XML_NAMESPACE_DRAW, XML_STROKE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_SVG, XML_STROKE_WIDTH, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_SVG, XML_STROKE_COLOR, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_MARKER_START_WIDTH, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_MARKER_END_WIDTH, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_MARKER_START_CENTER, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_MARKER_END_CENTER, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_SVG, XML_STROKE_OPACITY, XML_ATACTION_OPACITY_FIX, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_SVG, XML_STROKE_LINEJOIN, XML_ATACTION_RENAME, + XMLTransformerActionInit::QNameParam( XML_NAMESPACE_DRAW, + XML_STROKE_LINEJOIN), 0, 0 }, + { XML_NAMESPACE_TEXT, XML_ANIMATION, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_TEXT, XML_ANIMATION_DIRECTION, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_TEXT, XML_ANIMATION_START_INSIDE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_TEXT, XML_ANIMATION_STOP_INSIDE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_TEXT, XML_ANIMATION_REPEAT, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_TEXT, XML_ANIMATION_DELAY, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_TEXT, XML_ANIMATION_STEPS, XML_ATACTION_COPY, + NO_PARAMS }, /* TODO: missing in OASIS spec */ + { XML_NAMESPACE_DRAW, XML_AUTO_GROW_WIDTH, XML_ATACTION_RENAME, + XMLTransformerActionInit::QNameParam( XML_NAMESPACE_DRAW, + XML_AUTO_GROW_HEIGHT ), 0, 0 }, + { XML_NAMESPACE_DRAW, XML_AUTO_GROW_HEIGHT, XML_ATACTION_RENAME, + XMLTransformerActionInit::QNameParam( XML_NAMESPACE_DRAW, + XML_AUTO_GROW_WIDTH ), 0, 0 }, + { XML_NAMESPACE_DRAW, XML_FIT_TO_SIZE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_TEXTAREA_VERTICAL_ALIGN, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_TEXTAREA_HORIZONTAL_ALIGN, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_COLOR_MODE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_COLOR_INVERSION, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_LUMINANCE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_CONTRAST, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_GAMMA, XML_ATACTION_GAMMA_OOO, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_RED, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_GREEN, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_BLUE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_SHADOW, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_SHADOW_OFFSET_X, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_SHADOW_OFFSET_Y, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_SHADOW_COLOR, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_SHADOW_TRANSPARENCY, + XML_ATACTION_RENAME_NEG_PERCENT, + XMLTransformerActionInit::QNameParam( XML_NAMESPACE_DRAW, + XML_SHADOW_OPACITY), 0, 0 }, + { XML_NAMESPACE_DRAW, XML_START_LINE_SPACING_HORIZONTAL, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_START_LINE_SPACING_VERTICAL, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_END_LINE_SPACING_HORIZONTAL, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_END_LINE_SPACING_VERTICAL, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_LINE_DISTANCE, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_GUIDE_OVERHANG, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_GUIDE_DISTANCE, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_START_GUIDE, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_END_GUIDE, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_PLACING, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_PARALLEL, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_MEASURE_ALIGN, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_MEASURE_VERTICAL_ALIGN, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_UNIT, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_SHOW_UNIT, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_DECIMAL_PLACES, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_CAPTION_TYPE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_CAPTION_ANGLE_TYPE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_CAPTION_ANGLE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_CAPTION_GAP, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_CAPTION_ESCAPE_DIRECTION, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_CAPTION_ESCAPE, XML_ATACTION_CAPTION_ESCAPE_OOO, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_CAPTION_LINE_LENGTH, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_CAPTION_FIT_LINE_LENGTH, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DR3D, XML_HORIZONTAL_SEGMENTS, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DR3D, XML_VERTICAL_SEGMENTS, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DR3D, XML_EDGE_ROUNDING, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ +// { XML_NAMESPACE_DR3D, XML_EDGE_ROUNDING_MODE, XML_ATACTION_COPY, +// NO_PARAMS }, /* TODO: does not exist! */ + { XML_NAMESPACE_DR3D, XML_BACK_SCALE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DR3D, XML_DEPTH, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DR3D, XML_BACKFACE_CULLING, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DR3D, XML_LIGHTING_MODE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DR3D, XML_NORMALS_KIND, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DR3D, XML_NORMALS_DIRECTION, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DR3D, XML_TEX_GENERATION_MODE_X, XML_ATACTION_COPY, + NO_PARAMS }, + { XML_NAMESPACE_DR3D, XML_TEX_GENERATION_MODE_Y, XML_ATACTION_COPY, + NO_PARAMS }, + { XML_NAMESPACE_DR3D, XML_END_ANGLE, XML_ATACTION_COPY, + NO_PARAMS }, + { XML_NAMESPACE_DR3D, XML_TEX_KIND, XML_ATACTION_COPY, + NO_PARAMS }, + { XML_NAMESPACE_DR3D, XML_TEX_FILTER, XML_ATACTION_COPY, + NO_PARAMS }, + { XML_NAMESPACE_DR3D, XML_TEX_MODE, XML_ATACTION_COPY, + NO_PARAMS }, + { XML_NAMESPACE_DR3D, XML_AMBIENT_COLOR, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DR3D, XML_EMISSIVE_COLOR, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DR3D, XML_SPECULAR_COLOR, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DR3D, XML_DIFFUSE_COLOR, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DR3D, XML_SHININESS, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DR3D, XML_SHADOW, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_SVG, XML_WIDTH, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_SVG, XML_HEIGHT, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_REL_WIDTH, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_REL_HEIGHT, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MIN_HEIGHT, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MIN_WIDTH, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MAX_HEIGHT, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MAX_WIDTH, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_ATACTION_INCH2IN_DUPLICATE, + XML_PROP_TYPE_PARAGRAPH, 0, 0 }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_ATACTION_INCH2IN_DUPLICATE, + XML_PROP_TYPE_PARAGRAPH, 0, 0 }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_ATACTION_INCH2IN_DUPLICATE, + XML_PROP_TYPE_PARAGRAPH, 0, 0 }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_ATACTION_INCH2IN_DUPLICATE, + XML_PROP_TYPE_PARAGRAPH, 0, 0 }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BACKGROUND_TRANSPARENCY, XML_ATACTION_COPY, + NO_PARAMS }, + { XML_NAMESPACE_FO, XML_BORDER, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER_TOP, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER_LEFT, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER_RIGHT, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_TOP, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_BOTTOM, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_LEFT, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_RIGHT, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_TOP, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_BOTTOM, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_LEFT, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_RIGHT, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_SHADOW, XML_ATACTION_INCHS2INS, + NO_PARAMS }, + { XML_NAMESPACE_STYLE, XML_PRINT_CONTENT, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_PROTECT, XML_ATACTION_PROTECT, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_HORIZONTAL_POS, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_SVG, XML_X, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_HORIZONTAL_REL, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_VERTICAL_POS, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_SVG, XML_Y, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_VERTICAL_REL, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_TEXT, XML_ANCHOR_TYPE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_TEXT, XML_ANCHOR_PAGE_NUMBER, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_EDITABLE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_WRAP, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ +// { XML_NAMESPACE_STYLE, XML_WRAP_DYNAMIC_TRESHOLD, XML_ATACTION_COPY, +// NO_PARAMS }, /* new attribute */ + { XML_NAMESPACE_STYLE, XML_NUMBER_WRAPPED_PARAGRAPHS, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_WRAP_CONTOUR, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_WRAP_CONTOUR_MODE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_RUN_THROUGH, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_FLOW_WITH_TEXT, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ +// { XML_NAMESPACE_STYLE, XML_OVERFLOW_BEHAVIOR, XML_ATACTION_COPY, +// NO_PARAMS }, /* new attribute */ + // --> OD 2005-05-12 #i49139# - rename attribute values of <style:mirror>: + // horizontal-on-left-pages --> horizontal-on-even + // horizontal-on-right-pages --> horizontal-on-odd +// { XML_NAMESPACE_STYLE, XML_MIRROR, XML_ATACTION_COPY, +// NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_MIRROR, XML_ATACTION_STYLE_MIRROR_OOO, + NO_PARAMS }, /* generated entry */ + // <-- + { XML_NAMESPACE_FO, XML_CLIP, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_FRAME_DISPLAY_SCROLLBAR, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_FRAME_DISPLAY_BORDER, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_FRAME_MARGIN_HORIZONTAL, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_FRAME_MARGIN_VERTICAL, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_VISIBLE_AREA_LEFT, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_VISIBLE_AREA_TOP, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_VISIBLE_AREA_WIDTH, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_VISIBLE_AREA_HEIGHT, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_STROKE_DASH, XML_ATACTION_ENCODE_STYLE_NAME_REF, + NO_PARAMS }, + { XML_NAMESPACE_DRAW, XML_MARKER_START, XML_ATACTION_ENCODE_STYLE_NAME_REF, + NO_PARAMS }, + { XML_NAMESPACE_DRAW, XML_MARKER_END, XML_ATACTION_ENCODE_STYLE_NAME_REF, + NO_PARAMS }, + // style-graphic-fill-properties-attlist + { XML_NAMESPACE_DRAW, XML_FILL, XML_ATACTION_COPY, NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_FILL_COLOR, XML_ATACTION_COPY, NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_FILL_GRADIENT_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF, + NO_PARAMS }, + { XML_NAMESPACE_DRAW, XML_GRADIENT_STEP_COUNT, XML_ATACTION_COPY, NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_FILL_HATCH_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF, NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_FILL_HATCH_SOLID, XML_ATACTION_COPY, NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_FILL_IMAGE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF, + NO_PARAMS }, + { XML_NAMESPACE_STYLE, XML_REPEAT, XML_ATACTION_COPY, NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_FILL_IMAGE_WIDTH, XML_ATACTION_INCH2IN, NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_FILL_IMAGE_HEIGHT, XML_ATACTION_INCH2IN, NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT_X, XML_ATACTION_COPY, NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT_Y, XML_ATACTION_COPY, NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT, XML_ATACTION_COPY, NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET, XML_ATACTION_COPY, NO_PARAMS }, /* generated entry */ + + // #i25616# + { XML_NAMESPACE_DRAW, XML_TRANSPARENCY, XML_PTACTION_TRANSPARENCY, NO_PARAMS }, + + { XML_NAMESPACE_DRAW, XML_TRANSPARENCY_NAME, + XML_ATACTION_RENAME_ENCODE_STYLE_NAME_REF, + XMLTransformerActionInit::QNameParam( XML_NAMESPACE_DRAW, + XML_OPACITY_NAME), 0, 0 }, + + { XML_NAMESPACE_DRAW, XML_MOVE_PROTECT, XML_ATACTION_MOVE_PROTECT, NO_PARAMS }, + { XML_NAMESPACE_DRAW, XML_SIZE_PROTECT, XML_ATACTION_SIZE_PROTECT, NO_PARAMS }, + { XML_NAMESPACE_DRAW, XML_FIT_TO_CONTOUR, XML_ATACTION_COPY, NO_PARAMS }, + + // Font work properties + { XML_NAMESPACE_DRAW, XML_FONTWORK_STYLE, XML_ATACTION_COPY, NO_PARAMS }, + { XML_NAMESPACE_DRAW, XML_FONTWORK_ADJUST, XML_ATACTION_COPY, NO_PARAMS }, + { XML_NAMESPACE_DRAW, XML_FONTWORK_DISTANCE, XML_ATACTION_INCH2IN, NO_PARAMS }, + { XML_NAMESPACE_DRAW, XML_FONTWORK_START, XML_ATACTION_INCH2IN, NO_PARAMS }, + { XML_NAMESPACE_DRAW, XML_FONTWORK_MIRROR, XML_ATACTION_COPY, NO_PARAMS }, + { XML_NAMESPACE_DRAW, XML_FONTWORK_OUTLINE, XML_ATACTION_COPY, NO_PARAMS }, + { XML_NAMESPACE_DRAW, XML_FONTWORK_SHADOW, XML_ATACTION_COPY, NO_PARAMS }, + { XML_NAMESPACE_DRAW, XML_FONTWORK_SHADOW_COLOR, XML_ATACTION_COPY, NO_PARAMS }, + { XML_NAMESPACE_DRAW, XML_FONTWORK_SHADOW_OFFSET_X, XML_ATACTION_INCH2IN, NO_PARAMS }, + { XML_NAMESPACE_DRAW, XML_FONTWORK_SHADOW_OFFSET_Y, XML_ATACTION_INCH2IN, NO_PARAMS }, + { XML_NAMESPACE_DRAW, XML_FONTWORK_FORM, XML_ATACTION_COPY, NO_PARAMS }, + { XML_NAMESPACE_DRAW, XML_FONTWORK_HIDE_FORM, XML_ATACTION_COPY, NO_PARAMS }, + { XML_NAMESPACE_DRAW, XML_FONTWORK_SHADOW_TRANSPARENCE, XML_ATACTION_COPY, NO_PARAMS }, + + { XML_NAMESPACE_DRAW, XML_WRAP_INFLUENCE_ON_POSITION, XML_ATACTION_COPY, NO_PARAMS }, // new in OOo 2.0 + + { XML_NAMESPACE_DRAW, XML_MIRROR, XML_ATACTION_DRAW_MIRROR_OOO, + NO_PARAMS }, /* generated entry */ + + // b6242385: read writing-mode for text frames + { XML_NAMESPACE_STYLE, XML_WRITING_MODE, XML_ATACTION_COPY, NO_PARAMS }, + + { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS } +}; + +XMLTransformerActionInit aGraphicPropertyOOoElemActionTable[] = +{ + { XML_NAMESPACE_STYLE, XML_BACKGROUND_IMAGE, XML_ATACTION_COPY, NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_COLUMNS, XML_ATACTION_COPY, NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_TEXT, XML_LIST_STYLE, XML_ATACTION_COPY, NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS } +}; + +XMLTransformerActionInit aDrawingPagePropertyOOoAttrActionTable[] = +{ + // style-graphic-fill-properties-attlist + { XML_NAMESPACE_DRAW, XML_FILL_GRADIENT_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF, + NO_PARAMS }, + { XML_NAMESPACE_DRAW, XML_FILL_HATCH_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF, NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_FILL_HATCH_SOLID, XML_ATACTION_COPY, NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_FILL_IMAGE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF, + NO_PARAMS }, + { XML_NAMESPACE_DRAW, XML_FILL_IMAGE_WIDTH, XML_ATACTION_INCH2IN, NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_FILL_IMAGE_HEIGHT, XML_ATACTION_INCH2IN, NO_PARAMS }, /* generated entry */ +// { XML_NAMESPACE_DRAW, XML_OPACITY_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF, +// NO_PARAMS }, + + { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS } +}; + +XMLTransformerActionInit aPageLayoutPropertyOOoAttrActionTable[] = +{ + { XML_NAMESPACE_FO, XML_PAGE_WIDTH, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PAGE_HEIGHT, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER_TOP, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER_LEFT, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER_RIGHT, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_TOP, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_BOTTOM, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_LEFT, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_RIGHT, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_TOP, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_BOTTOM, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_LEFT, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_RIGHT, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_SHADOW, XML_ATACTION_INCHS2INS, + NO_PARAMS }, + { XML_NAMESPACE_STYLE, XML_FOOTNOTE_MAX_HEIGHT, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_BASE_HEIGHT, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_RUBY_HEIGHT, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_REGISTER_TRUTH_REF_STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF, NO_PARAMS }, + { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS } +}; + +XMLTransformerActionInit aHeaderFooterPropertyOOoAttrActionTable[] = +{ + { XML_NAMESPACE_SVG, XML_HEIGHT, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MIN_HEIGHT, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER_TOP, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER_LEFT, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER_RIGHT, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_TOP, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_BOTTOM, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_LEFT, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_RIGHT, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_TOP, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_BOTTOM, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_LEFT, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_RIGHT, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_SHADOW, XML_ATACTION_INCHS2INS, + NO_PARAMS }, + { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS } +}; + +XMLTransformerActionInit aTextPropertyOOoAttrActionTable[] = +{ + { XML_NAMESPACE_FO, XML_FONT_VARIANT, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_TEXT_TRANSFORM, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_COLOR, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_USE_WINDOW_FONT_COLOR, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_TEXT_OUTLINE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_TEXT_CROSSING_OUT, XML_PTACTION_LINETHROUGH, + NO_PARAMS }, /* TODO: rename */ + { XML_NAMESPACE_STYLE, XML_TEXT_POSITION, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_FONT_NAME, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_FONT_NAME_ASIAN, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_FONT_NAME_COMPLEX, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_FONT_FAMILY, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_FONT_FAMILY_ASIAN, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_FONT_FAMILY_COMPLEX, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_FONT_FAMILY_GENERIC, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_FONT_FAMILY_GENERIC_ASIAN, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_FONT_FAMILY_GENERIC_COMPLEX, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_FONT_STYLE_NAME, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_FONT_STYLE_NAME_ASIAN, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_FONT_STYLE_NAME_COMPLEX, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_FONT_PITCH, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_FONT_PITCH_ASIAN, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_FONT_PITCH_COMPLEX, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_FONT_CHARSET, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_FONT_SIZE, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_FONT_SIZE_ASIAN, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_FONT_SIZE_COMPLEX, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_FONT_SIZE_REL, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_FONT_SIZE_REL_ASIAN, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_FONT_SIZE_REL_COMPLEX, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ +// { XML_NAMESPACE_STYLE, XML_SCRIPT_TYPE, XML_ATACTION_COPY, +// NO_PARAMS }, /* new attribute*/ + { XML_NAMESPACE_FO, XML_LETTER_SPACING, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_LANGUAGE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_LANGUAGE_ASIAN, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_LANGUAGE_COMPLEX, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_COUNTRY, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_COUNTRY_ASIAN, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_COUNTRY_COMPLEX, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_FONT_STYLE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_FONT_STYLE_ASIAN, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_FONT_STYLE_COMPLEX, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_FONT_RELIEF, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_TEXT_SHADOW, XML_ATACTION_INCHS2INS, + NO_PARAMS }, + { XML_NAMESPACE_STYLE, XML_TEXT_UNDERLINE, XML_PTACTION_UNDERLINE, + NO_PARAMS }, /* TODO: rename */ + { XML_NAMESPACE_STYLE, XML_TEXT_UNDERLINE_COLOR, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_FONT_WEIGHT, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_FONT_WEIGHT_ASIAN, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_FONT_WEIGHT_COMPLEX, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_SCORE_SPACES, + XML_PTACTION_LINE_MODE, NO_PARAMS }, + { XML_NAMESPACE_STYLE, XML_LETTER_KERNING, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_TEXT_BLINKING, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_TEXT_BACKGROUND_COLOR, XML_ATACTION_RENAME, + XMLTransformerActionInit::QNameParam( XML_NAMESPACE_FO, + XML_BACKGROUND_COLOR ), 0, 0 }, + { XML_NAMESPACE_STYLE, XML_TEXT_COMBINE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_TEXT_COMBINE_START_CHAR, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_TEXT_COMBINE_END_CHAR, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_TEXT_EMPHASIZE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_TEXT_SCALE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_TEXT_ROTATION_ANGLE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_TEXT_ROTATION_SCALE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_TEXT, XML_DISPLAY, XML_ATACTION_COPY, + NO_PARAMS }, /* new in OOo 2.0 */ + { XML_NAMESPACE_FO, XML_HYPHENATE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_HYPHENATION_REMAIN_CHAR_COUNT, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_HYPHENATION_PUSH_CHAR_COUNT, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_TEXT_OVERLINE_STYLE, XML_ATACTION_REMOVE, + NO_PARAMS }, /* #i113645# */ + { XML_NAMESPACE_STYLE, XML_TEXT_OVERLINE_COLOR, XML_ATACTION_REMOVE, + NO_PARAMS }, /* #i113645# */ + + { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS } +}; + +XMLTransformerActionInit aTextPropertyOOoElemActionTable[] = +{ + { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS } +}; + + + +XMLTransformerActionInit aParagraphPropertyOOoAttrActionTable[] = +{ + { XML_NAMESPACE_FO, XML_LINE_HEIGHT, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_LINE_HEIGHT_AT_LEAST, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_LINE_SPACING, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_TEXT_ALIGN, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_TEXT_ALIGN_LAST, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_TEXT_ALIGN, XML_ATACTION_RENAME, + XMLTransformerActionInit::QNameParam( XML_NAMESPACE_FO, XML_TEXT_ALIGN ), 0, 0 }, + { XML_NAMESPACE_STYLE, XML_JUSTIFY_SINGLE_WORD, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BREAK_INSIDE, XML_PTACTION_BREAK_INSIDE, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_WIDOWS, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_ORPHANS, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_TAB_STOP_DISTANCE, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_HYPHENATION_KEEP, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_HYPHENATION_LADDER_COUNT, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_REGISTER_TRUE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_TEXT_INDENT, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_AUTO_TEXT_INDENT, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BREAK_BEFORE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BREAK_AFTER, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER_TOP, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER_LEFT, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER_RIGHT, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_TOP, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_BOTTOM, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_LEFT, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_RIGHT, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_TOP, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_BOTTOM, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_LEFT, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_RIGHT, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_SHADOW, XML_ATACTION_INCHS2INS, + NO_PARAMS }, + { XML_NAMESPACE_FO, XML_KEEP_WITH_NEXT, XML_PTACTION_KEEP_WITH_NEXT, + NO_PARAMS }, + { XML_NAMESPACE_TEXT, XML_NUMBER_LINES, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_TEXT, XML_LINE_NUMBER, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_VERTICAL_ALIGN, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_WRITING_MODE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_DRAW, XML_WRITING_MODE, XML_ATACTION_RENAME, + XMLTransformerActionInit::QNameParam( XML_NAMESPACE_STYLE, + XML_WRITING_MODE ), 0, 0 }, +// { XML_NAMESPACE_STYLE, XML_WRITING_MODE_AUTOMATIC, XML_ATACTION_COPY, +// NO_PARAMS }, /* new attribute */ + { XML_NAMESPACE_STYLE, XML_SNAP_TO_LAYOUT_GRID, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_PAGE_NUMBER, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BACKGROUND_TRANSPARENCY, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_TEXT_AUTOSPACE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_PUNCTUATION_WRAP, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_LINE_BREAK, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_TEXT, XML_ENABLE_NUMBERING, XML_ATACTION_COPY, + NO_PARAMS }, /* TODO: undocumented*/ + { XML_NAMESPACE_STYLE, XML_FONT_INDEPENDENT_LINE_SPACING, XML_ATACTION_COPY, + NO_PARAMS }, + { XML_NAMESPACE_STYLE, XML_DEFAULT_OUTLINE_LEVEL, XML_ATACTION_REMOVE, + NO_PARAMS }, /* i41811: style-default-outline was exported as propery */ + { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS } +}; + +XMLTransformerActionInit aParagraphPropertyOOoElemActionTable[] = +{ + { XML_NAMESPACE_STYLE, XML_TAB_STOPS, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_DROP_CAP, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BACKGROUND_IMAGE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS } +}; + +XMLTransformerActionInit aSectionPropertyOOoAttrActionTable[] = +{ + { XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS } +}; + +XMLTransformerActionInit aTablePropertyOOoAttrActionTable[] = +{ + { XML_NAMESPACE_STYLE, XML_WIDTH, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_KEEP_WITH_NEXT, XML_PTACTION_KEEP_WITH_NEXT, + NO_PARAMS }, + { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS } +}; + +XMLTransformerActionInit aTableColumnPropertyOOoAttrActionTable[] = +{ + { XML_NAMESPACE_STYLE, XML_COLUMN_WIDTH, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS } +}; + +XMLTransformerActionInit aTableRowPropertyOOoAttrActionTable[] = +{ + { XML_NAMESPACE_STYLE, XML_ROW_HEIGHT, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_MIN_ROW_HEIGHT, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS } +}; + +XMLTransformerActionInit aTableCellPropertyOOoAttrActionTable[] = +{ + { XML_NAMESPACE_FO, XML_VERTICAL_ALIGN, XML_ATACTION_RENAME, + XMLTransformerActionInit::QNameParam( XML_NAMESPACE_STYLE, + XML_VERTICAL_ALIGN ), 0, 0 }, + { XML_NAMESPACE_FO, XML_TEXT_ALIGN, XML_ATACTION_COPY_DUPLICATE, + XML_PROP_TYPE_PARAGRAPH, 0, 0 }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_TEXT_ALIGN_SOURCE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_DIRECTION, XML_ATACTION_RENAME, + XMLTransformerActionInit::QNameParam( XML_NAMESPACE_STYLE, + XML_DIRECTION), 0, 0 }, + { XML_NAMESPACE_STYLE, XML_GLYPH_ORIENTATION_VERTICAL, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_SHADOW, XML_ATACTION_INCHS2INS, + NO_PARAMS }, + { XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER_TOP, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER_LEFT, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_BORDER_RIGHT, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_TOP, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_BOTTOM, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_LEFT, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_RIGHT, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_DIAGONAL_BL_TR, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_DIAGONAL_BL_TR_WIDTH, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_DIAGONAL_TL_BR, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_DIAGONAL_TL_BR_WIDTH, XML_ATACTION_INCHS2INS, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_TOP, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_BOTTOM, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_LEFT, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_PADDING_RIGHT, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_WRAP_OPTION, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_REPEAT_CONTENT, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_ROTATION_ANGLE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_ROTATION_ALIGN, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_CELL_PROTECT, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_PRINT_CONTENT, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_DECIMAL_PLACES, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS } +}; + +XMLTransformerActionInit aTableCellPropertyOOoElemActionTable[] = +{ + { XML_NAMESPACE_STYLE, XML_BACKGROUND_IMAGE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS } +}; + +XMLTransformerActionInit aListLevelPropertyOOoAttrActionTable[] = +{ + { XML_NAMESPACE_TEXT, XML_SPACE_BEFORE, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_TEXT, XML_MIN_LABEL_WIDTH, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_TEXT, XML_MIN_LABEL_DISTANCE, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_WIDTH, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_HEIGHT, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS } +}; + +XMLTransformerActionInit aChartPropertyOOoAttrActionTable[] = +{ + { XML_NAMESPACE_CHART, XML_SCALE_TEXT, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_THREE_DIMENSIONAL, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_DEEP, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ +// { XML_NAMESPACE_CHART, XML_SYMBOL_TYPE, XML_ATACTION_COPY, +// NO_PARAMS }, /* new attribute */ +// { XML_NAMESPACE_CHART, XML_SYMBOL_TYPE, XML_ATACTION_COPY, +// NO_PARAMS }, /* new attribute */ +// { XML_NAMESPACE_CHART, XML_SYMBOL_TYPE, XML_ATACTION_COPY, +// NO_PARAMS }, /* new attribute */ +// { XML_NAMESPACE_CHART, XML_SYMBOL_NAME, XML_ATACTION_COPY, +// NO_PARAMS }, /* new attribute */ +// { XML_NAMESPACE_CHART, XML_SYMBOL_TYPE, XML_ATACTION_COPY, +// NO_PARAMS }, /* new attribute */ + { XML_NAMESPACE_XLINK, XML_HREF, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_SYMBOL_WIDTH, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_SYMBOL_HEIGHT, XML_ATACTION_INCH2IN, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_VERTICAL, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_CONNECT_BARS, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_GAP_WIDTH, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_OVERLAP, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ +// { XML_NAMESPACE_CHART, XML_JAPANESE_CANDLE_STICK, XML_ATACTION_COPY, +// NO_PARAMS }, /* TODO: renamed? */ +// { XML_NAMESPACE_CHART, XML_INTERPOLATION, XML_ATACTION_COPY, +// NO_PARAMS }, /* TODO: renamed? */ + { XML_NAMESPACE_CHART, XML_SPLINE_ORDER, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_SPLINE_RESOLUTION, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_PIE_OFFSET, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_LINES, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_SOLID_TYPE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_STACKED, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_PERCENTAGE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_LINK_DATA_STYLE_TO_SOURCE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_VISIBLE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_LOGARITHMIC, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_MAXIMUM, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_MINIMUM, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_ORIGIN, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_TICK_MARKS_MAJOR_INNER, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_TICK_MARKS_MAJOR_OUTER, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_TICK_MARKS_MINOR_INNER, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_TICK_MARKS_MINOR_OUTER, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_DISPLAY_LABEL, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_TEXT_OVERLAP, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_TEXT, XML_LINE_BREAK, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_LABEL_ARRANGEMENT, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_DIRECTION, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_STYLE, XML_ROTATION_ANGLE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_DATA_LABEL_NUMBER, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_DATA_LABEL_TEXT, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_DATA_LABEL_SYMBOL, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_MEAN_VALUE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_ERROR_CATEGORY, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_ERROR_PERCENTAGE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_ERROR_MARGIN, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_ERROR_LOWER_LIMIT, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_ERROR_UPPER_LIMIT, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_ERROR_UPPER_INDICATOR, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_ERROR_LOWER_INDICATOR, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_SERIES_SOURCE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_CHART, XML_REGRESSION_TYPE, XML_ATACTION_COPY, + NO_PARAMS }, /* generated entry */ + { XML_NAMESPACE_FO, XML_DIRECTION, XML_ATACTION_RENAME, + XMLTransformerActionInit::QNameParam( XML_NAMESPACE_STYLE, + XML_DIRECTION ), 0, 0 }, + { XML_NAMESPACE_CHART, XML_SPLINES, XML_PTACTION_SPLINES, NO_PARAMS }, + { XML_NAMESPACE_TEXT, XML_ROTATION_ANGLE, XML_ATACTION_RENAME, + XMLTransformerActionInit::QNameParam( XML_NAMESPACE_STYLE, + XML_ROTATION_ANGLE ), 0, 0 }, + { XML_NAMESPACE_CHART, XML_INTERVAL_MAJOR, XML_PTACTION_INTERVAL_MAJOR, NO_PARAMS }, + { XML_NAMESPACE_CHART, XML_INTERVAL_MINOR, XML_PTACTION_INTERVAL_MINOR, NO_PARAMS }, + + { XML_NAMESPACE_CHART, XML_STOCK_UPDOWN_BARS, XML_ATACTION_RENAME, + XMLTransformerActionInit::QNameParam( XML_NAMESPACE_CHART, + XML_JAPANESE_CANDLE_STICK ), 0, 0 }, + { XML_NAMESPACE_CHART, XML_SYMBOL, XML_PTACTION_SYMBOL, NO_PARAMS }, + + // note: chart:symbol-image-name was only used before 6.0 beta + { XML_NAMESPACE_CHART, XML_SYMBOL_IMAGE_NAME, XML_PTACTION_SYMBOL_IMAGE_NAME, NO_PARAMS }, + + // #i32368# property should no longer be used as XML-property (in OASIS + // format), but is still ex-/imported for compatibility with the OOo file format + { XML_NAMESPACE_CHART, XML_LINES_USED, XML_ATACTION_COPY, NO_PARAMS }, + // #i32366# property should no longer be used as XML-property (in OASIS + // format), but is still ex-/imported for compatibility with the OOo file format + { XML_NAMESPACE_CHART, XML_STOCK_WITH_VOLUME, XML_ATACTION_COPY, NO_PARAMS }, + + { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS } +}; + +XMLTransformerActionInit aChartPropertyOOoElemActionTable[] = +{ + { XML_NAMESPACE_STYLE, XML_SYMBOL_IMAGE, XML_ATACTION_COPY, NO_PARAMS }, + { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS } +}; + diff --git a/xmloff/source/transform/PropertyActionsOOo.hxx b/xmloff/source/transform/PropertyActionsOOo.hxx new file mode 100644 index 000000000000..59e3314279ad --- /dev/null +++ b/xmloff/source/transform/PropertyActionsOOo.hxx @@ -0,0 +1,79 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_PROPERTYACTIONSOOO_HXX +#define _XMLOFF_PROPERTYACTIONSOOO_HXX + +#include "TransformerAction.hxx" +#include "TransformerActionInit.hxx" +#include "AttrTransformerAction.hxx" + +enum XMLPropOOOTransformerAction +{ + XML_PTACTION_LINE_MODE=XML_ATACTION_USER_DEFINED, + XML_PTACTION_UNDERLINE, + XML_PTACTION_LINETHROUGH, + XML_PTACTION_KEEP_WITH_NEXT, + XML_PTACTION_SPLINES, + XML_ATACTION_INCH2IN_DUPLICATE, + XML_PTACTION_INTERVAL_MAJOR, + XML_PTACTION_INTERVAL_MINOR, + XML_ATACTION_COPY_DUPLICATE, + XML_PTACTION_SYMBOL, + XML_PTACTION_SYMBOL_IMAGE_NAME, + XML_PTACTION_TRANSPARENCY, + XML_PTACTION_BREAK_INSIDE, + XML_ATACTION_CAPTION_ESCAPE_OOO, + XML_ATACTION_MOVE_PROTECT, + XML_ATACTION_SIZE_PROTECT, + XML_ATACTION_PROTECT, + // --> OD 2005-06-10 #i50322# + XML_ATACTION_WRITER_BACK_GRAPHIC_TRANSPARENCY, + // <-- + XML_PTACTION_END=XML_TACTION_END +}; + +extern XMLTransformerActionInit aGraphicPropertyOOoAttrActionTable[]; +extern XMLTransformerActionInit aGraphicPropertyOOoElemActionTable[]; +extern XMLTransformerActionInit aDrawingPagePropertyOOoAttrActionTable[]; +extern XMLTransformerActionInit aPageLayoutPropertyOOoAttrActionTable[]; +extern XMLTransformerActionInit aHeaderFooterPropertyOOoAttrActionTable[]; +extern XMLTransformerActionInit aTextPropertyOOoAttrActionTable[]; +extern XMLTransformerActionInit aTextPropertyOOoElemActionTable[]; +extern XMLTransformerActionInit aParagraphPropertyOOoAttrActionTable[]; +extern XMLTransformerActionInit aParagraphPropertyOOoElemActionTable[]; +extern XMLTransformerActionInit aSectionPropertyOOoAttrActionTable[]; +extern XMLTransformerActionInit aTablePropertyOOoAttrActionTable[]; +extern XMLTransformerActionInit aTableColumnPropertyOOoAttrActionTable[]; +extern XMLTransformerActionInit aTableRowPropertyOOoAttrActionTable[]; +extern XMLTransformerActionInit aTableCellPropertyOOoAttrActionTable[]; +extern XMLTransformerActionInit aTableCellPropertyOOoElemActionTable[]; +extern XMLTransformerActionInit aListLevelPropertyOOoAttrActionTable[]; +extern XMLTransformerActionInit aChartPropertyOOoAttrActionTable[]; +extern XMLTransformerActionInit aChartPropertyOOoElemActionTable[]; + +#endif // _XMLOFF_PROPERTYACTIONSOOO_HXX diff --git a/xmloff/source/transform/RenameElemTContext.cxx b/xmloff/source/transform/RenameElemTContext.cxx new file mode 100644 index 000000000000..026f6add68bc --- /dev/null +++ b/xmloff/source/transform/RenameElemTContext.cxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" +#include "RenameElemTContext.hxx" +#include "MutableAttrList.hxx" +#ifndef _XMLOFF_TRANSFORMERBASE_HXX +#include "TransformerBase.hxx" +#endif +#include <xmloff/nmspmap.hxx> + +using ::rtl::OUString; + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; + +TYPEINIT1( XMLRenameElemTransformerContext, XMLTransformerContext ); + +XMLRenameElemTransformerContext::XMLRenameElemTransformerContext( + XMLTransformerBase& rImp, + const OUString& rQName, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken ) : + XMLTransformerContext( rImp, rQName ), + m_aElemQName( rImp.GetNamespaceMap().GetQNameByKey( nPrefix, + ::xmloff::token::GetXMLToken( eToken ) ) ) +{ +} + +XMLRenameElemTransformerContext::XMLRenameElemTransformerContext( + XMLTransformerBase& rImp, + const OUString& rQName, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken, + sal_uInt16 nAPrefix, + ::xmloff::token::XMLTokenEnum eAToken, + ::xmloff::token::XMLTokenEnum eVToken ) : + XMLTransformerContext( rImp, rQName ), + m_aElemQName( rImp.GetNamespaceMap().GetQNameByKey( nPrefix, + ::xmloff::token::GetXMLToken( eToken ) ) ), + m_aAttrQName( rImp.GetNamespaceMap().GetQNameByKey( nAPrefix, + ::xmloff::token::GetXMLToken( eAToken ) ) ), + m_aAttrValue( ::xmloff::token::GetXMLToken( eVToken ) ) +{ +} + +XMLRenameElemTransformerContext::~XMLRenameElemTransformerContext() +{ +} + +void XMLRenameElemTransformerContext::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + Reference< XAttributeList > xAttrList( rAttrList ); + if( m_aAttrQName.getLength() ) + { + XMLMutableAttributeList *pMutableAttrList = + new XMLMutableAttributeList( xAttrList ); + xAttrList = pMutableAttrList; + pMutableAttrList->AddAttribute( m_aAttrQName, m_aAttrValue ); + } + GetTransformer().GetDocHandler()->startElement( m_aElemQName, xAttrList ); +} + +void XMLRenameElemTransformerContext::EndElement() +{ + GetTransformer().GetDocHandler()->endElement( m_aElemQName ); +} diff --git a/xmloff/source/transform/RenameElemTContext.hxx b/xmloff/source/transform/RenameElemTContext.hxx new file mode 100644 index 000000000000..398a8faa58bf --- /dev/null +++ b/xmloff/source/transform/RenameElemTContext.hxx @@ -0,0 +1,73 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_RENAMEELEMTCONTEXT_HXX +#define _XMLOFF_RENAMEELEMTCONTEXT_HXX + +#include <xmloff/xmltoken.hxx> +#include "TransformerContext.hxx" + + +class XMLRenameElemTransformerContext : public XMLTransformerContext +{ + ::rtl::OUString m_aElemQName; + ::rtl::OUString m_aAttrQName; + ::rtl::OUString m_aAttrValue; + +public: + TYPEINFO(); + + // The following consutructor renames the element names "rQName" + // to bPrefix/eToken + XMLRenameElemTransformerContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken ); + + // The following consutructor renames the element names "rQName" + // to bPrefix/eToken and adds an attribute nAPrefix/eAToken that has + // the value eVToken. + XMLRenameElemTransformerContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken, + sal_uInt16 nAPrefix, + ::xmloff::token::XMLTokenEnum eAToken, + ::xmloff::token::XMLTokenEnum eVToken ); + + // A contexts destructor does anything that is required if an element + // ends. By default, nothing is done. + // Note that virtual methods cannot be used inside destructors. Use + // EndElement instead if this is required. + virtual ~XMLRenameElemTransformerContext(); + + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + virtual void EndElement(); +}; + +#endif // _XMLOFF_RENAMEELEMCONTEXT_HXX + diff --git a/xmloff/source/transform/StyleOASISTContext.cxx b/xmloff/source/transform/StyleOASISTContext.cxx new file mode 100644 index 000000000000..ca444e176a0b --- /dev/null +++ b/xmloff/source/transform/StyleOASISTContext.cxx @@ -0,0 +1,1013 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" +#include <com/sun/star/xml/sax/SAXParseException.hpp> +#include <com/sun/star/xml/sax/SAXException.hpp> +#include <com/sun/star/xml/sax/XDocumentHandler.hpp> +#include <com/sun/star/xml/sax/XAttributeList.hpp> +#include <rtl/ustrbuf.hxx> +#include <xmloff/nmspmap.hxx> +#include <xmloff/xmltoken.hxx> +#include "xmloff/xmlnmspe.hxx" +#include "PropType.hxx" +#include "DeepTContext.hxx" +#include "ProcAttrTContext.hxx" +#ifndef _XMLOFF_TRANSFOERMERBASE_HXX +#include "TransformerBase.hxx" +#endif +#include "TransformerActions.hxx" +#include "ActionMapTypesOASIS.hxx" +#include "MutableAttrList.hxx" +#include "PropertyActionsOASIS.hxx" +#include "StyleOASISTContext.hxx" +#include <xmloff/xmluconv.hxx> +#include <rtl/ustrbuf.hxx> + +using ::rtl::OUString; +using namespace ::xmloff::token; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; +//------------------------------------------------------------------------------ + +static sal_uInt16 aAttrActionMaps[XML_PROP_TYPE_END] = +{ + PROP_OASIS_GRAPHIC_ATTR_ACTIONS, + PROP_OASIS_DRAWING_PAGE_ATTR_ACTIONS, // DRAWING_PAGE + PROP_OASIS_PAGE_LAYOUT_ATTR_ACTIONS, + PROP_OASIS_HEADER_FOOTER_ATTR_ACTIONS, + PROP_OASIS_TEXT_ATTR_ACTIONS, + PROP_OASIS_PARAGRAPH_ATTR_ACTIONS, + MAX_OASIS_PROP_ACTIONS, // RUBY + PROP_OASIS_SECTION_ATTR_ACTIONS, + PROP_OASIS_TABLE_ATTR_ACTIONS, + PROP_OASIS_TABLE_COLUMN_ATTR_ACTIONS, + PROP_OASIS_TABLE_ROW_ATTR_ACTIONS, + PROP_OASIS_TABLE_CELL_ATTR_ACTIONS, + PROP_OASIS_LIST_LEVEL_ATTR_ACTIONS, + PROP_OASIS_CHART_ATTR_ACTIONS +}; + +//------------------------------------------------------------------------------ + +class XMLPropertiesTContext_Impl : public XMLPersElemContentTContext +{ + ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > m_xAttrList; + + XMLPropType m_ePropType; + sal_Bool m_bControlStyle; + ::rtl::OUString m_aStyleFamily; + +public: + + void SetQNameAndPropType( const ::rtl::OUString& rQName, + XMLPropType ePropType ) + { + m_ePropType = ePropType; + XMLTransformerContext::SetQName( rQName ); + }; + + TYPEINFO(); + + XMLPropertiesTContext_Impl( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName, + XMLPropType eP, + const ::rtl::OUString& rStyleFamily, + sal_Bool _bControlStyle = sal_False ); + + virtual ~XMLPropertiesTContext_Impl(); + + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + virtual void Export(); + + static XMLPropType GetPropType( const OUString& rLocalName ); + + static OUString MergeUnderline( XMLTokenEnum eUnderline, + sal_Bool bBold, sal_Bool bDouble ); + static OUString MergeLineThrough( XMLTokenEnum eLineThrough, + sal_Bool bBold, sal_Bool bDouble, + sal_Unicode c ); +}; + +TYPEINIT1( XMLPropertiesTContext_Impl, XMLPersElemContentTContext ); + +XMLPropertiesTContext_Impl::XMLPropertiesTContext_Impl( + XMLTransformerBase& rImp, const OUString& rQName, XMLPropType eP, + const ::rtl::OUString& rStyleFamily, sal_Bool _bControlStyle ) : + XMLPersElemContentTContext( rImp, rQName, XML_NAMESPACE_STYLE, + XML_PROPERTIES), + m_ePropType( eP ), + m_bControlStyle( _bControlStyle ), + m_aStyleFamily( rStyleFamily ) +{ +} + +XMLPropertiesTContext_Impl::~XMLPropertiesTContext_Impl() +{ +} + +void XMLPropertiesTContext_Impl::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + XMLTransformerActions *pActions = 0; + sal_uInt16 nActionMap = aAttrActionMaps[m_ePropType]; + if( nActionMap < MAX_OASIS_PROP_ACTIONS ) + { + pActions = GetTransformer().GetUserDefinedActions( nActionMap ); + OSL_ENSURE( pActions, "go no actions" ); + } + + if( pActions ) + { + XMLMutableAttributeList *pAttrList = 0; + if( !m_xAttrList.is() ) + { + pAttrList = new XMLMutableAttributeList(); + m_xAttrList = pAttrList; + } + else + { + pAttrList = + static_cast< XMLMutableAttributeList * >( m_xAttrList.get() ); + } + + XMLTokenEnum eUnderline = XML_TOKEN_END; + sal_Bool bBoldUnderline = sal_False, bDoubleUnderline = sal_False; + XMLTokenEnum eLineThrough = XML_TOKEN_END; + sal_Bool bBoldLineThrough = sal_False, bDoubleLineThrough = sal_False; + sal_Unicode cLineThroughChar = 0; + + bool bIntervalMinorFound = false; + double fIntervalMajor = 0.0; + sal_Int32 nIntervalMinorDivisor = 0; + + // #i25616# + OUString aOpacityValueRemember; + OUString aImageOpacityValueRemember; + + sal_Int16 nAttrCount = rAttrList.is() ? rAttrList->getLength() : 0; + for( sal_Int16 i=0; i < nAttrCount; i++ ) + { + const OUString& rAttrName = rAttrList->getNameByIndex( i ); + const OUString& rAttrValue = rAttrList->getValueByIndex( i ); + OUString aLocalName; + sal_uInt16 nPrefix = + GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName, + &aLocalName ); + + XMLTransformerActions::key_type aKey( nPrefix, aLocalName ); + XMLTransformerActions::const_iterator aIter = + pActions->find( aKey ); + if( !(aIter == pActions->end() ) ) + { + switch( (*aIter).second.m_nActionType ) + { + case XML_ATACTION_REMOVE: + break; + case XML_ATACTION_COPY: + pAttrList->AddAttribute( rAttrName, rAttrValue ); + break; + case XML_ATACTION_RENAME: + { + OUString aNewAttrQName( + GetTransformer().GetNamespaceMap().GetQNameByKey( + (*aIter).second.GetQNamePrefixFromParam1(), + ::xmloff::token::GetXMLToken( + (*aIter).second.GetQNameTokenFromParam1()) ) ); + pAttrList->AddAttribute( aNewAttrQName, rAttrValue ); + } + break; + case XML_ATACTION_IN2INCH: + { + OUString aAttrValue( rAttrValue ); + XMLTransformerBase::ReplaceSingleInWithInch( + aAttrValue ); + pAttrList->AddAttribute( rAttrName, aAttrValue ); + } + break; + case XML_ATACTION_INS2INCHS: + { + OUString aAttrValue( rAttrValue ); + XMLTransformerBase::ReplaceInWithInch( + aAttrValue ); + pAttrList->AddAttribute( rAttrName, aAttrValue ); + } + break; + case XML_ATACTION_DECODE_STYLE_NAME_REF: + { + OUString aAttrValue( rAttrValue ); + GetTransformer().DecodeStyleName(aAttrValue); + pAttrList->AddAttribute( rAttrName, aAttrValue ); + } + break; + case XML_ATACTION_RENAME_DECODE_STYLE_NAME_REF: + { + OUString aNewAttrQName( + GetTransformer().GetNamespaceMap().GetQNameByKey( + (*aIter).second.GetQNamePrefixFromParam1(), + ::xmloff::token::GetXMLToken( + (*aIter).second.GetQNameTokenFromParam1()) ) ); + OUString aAttrValue( rAttrValue ); + GetTransformer().DecodeStyleName(aAttrValue); + pAttrList->AddAttribute( aNewAttrQName, aAttrValue ); + } + break; + case XML_ATACTION_NEG_PERCENT: + { + OUString aAttrValue( rAttrValue ); + GetTransformer().NegPercent(aAttrValue); + pAttrList->AddAttribute( rAttrName, aAttrValue ); + } + break; + case XML_ATACTION_RENAME_NEG_PERCENT: + { + OUString aNewAttrQName( + GetTransformer().GetNamespaceMap().GetQNameByKey( + (*aIter).second.GetQNamePrefixFromParam1(), + ::xmloff::token::GetXMLToken( + (*aIter).second.GetQNameTokenFromParam1()) ) ); + OUString aAttrValue( rAttrValue ); + GetTransformer().NegPercent(aAttrValue); + pAttrList->AddAttribute( aNewAttrQName, aAttrValue ); + } + break; + case XML_OPTACTION_LINE_MODE: + { + sal_Bool bWordMode = + IsXMLToken( rAttrValue, XML_SKIP_WHITE_SPACE ); + OUString aAttrQName( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_FO, + GetXMLToken( XML_SCORE_SPACES ) ) ); + sal_Int16 nIndex = + pAttrList->GetIndexByName( aAttrQName ); + if( -1 != nIndex ) + { + if( bWordMode ) + { + const OUString& rOldValue = + pAttrList->getValueByIndex( nIndex ); + if( !IsXMLToken( rOldValue, XML_TRUE ) ) + { + pAttrList->SetValueByIndex( nIndex, + GetXMLToken( XML_TRUE ) ); + } + } + } + else + { + OUString aAttrValue( GetXMLToken( bWordMode + ? XML_FALSE + : XML_TRUE ) ); + pAttrList->AddAttribute( aAttrQName, aAttrValue ); + } + } + break; + case XML_OPTACTION_KEEP_WITH_NEXT: + { + OUString aAttrValue( GetXMLToken( + IsXMLToken( rAttrValue, XML_ALWAYS ) + ? XML_TRUE + : XML_FALSE) ); + pAttrList->AddAttribute( rAttrName, aAttrValue ); + } + break; + case XML_OPTACTION_UNDERLINE_WIDTH: + if( IsXMLToken( rAttrValue, XML_BOLD ) ) + bBoldUnderline = sal_True; + break; + case XML_OPTACTION_UNDERLINE_TYPE: + if( IsXMLToken( rAttrValue, XML_DOUBLE ) ) + bDoubleUnderline = sal_True; + break; + case XML_OPTACTION_UNDERLINE_STYLE: + eUnderline = GetTransformer().GetToken( rAttrValue ); + break; + case XML_OPTACTION_LINETHROUGH_WIDTH: + if( IsXMLToken( rAttrValue, XML_BOLD ) ) + bBoldLineThrough = sal_True; + break; + case XML_OPTACTION_LINETHROUGH_TYPE: + if( IsXMLToken( rAttrValue, XML_DOUBLE ) ) + bDoubleLineThrough = sal_True; + break; + case XML_OPTACTION_LINETHROUGH_STYLE: + eLineThrough = GetTransformer().GetToken( rAttrValue ); + break; + case XML_OPTACTION_LINETHROUGH_TEXT: + if( rAttrValue.getLength() ) + cLineThroughChar = rAttrValue[0]; + break; + case XML_OPTACTION_INTERPOLATION: + { + // 0: none + sal_Int32 nSplineType = 0; + if( IsXMLToken( rAttrValue, XML_CUBIC_SPLINE )) + nSplineType = 1; + else if( IsXMLToken( rAttrValue, XML_B_SPLINE )) + nSplineType = 2; + + pAttrList->AddAttribute( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_CHART, + GetXMLToken( XML_SPLINES )), + OUString::valueOf( nSplineType )); + } + break; + case XML_OPTACTION_INTERVAL_MAJOR: + pAttrList->AddAttribute( rAttrName, rAttrValue ); + SvXMLUnitConverter::convertDouble( fIntervalMajor, rAttrValue ); + break; + case XML_OPTACTION_INTERVAL_MINOR_DIVISOR: + SvXMLUnitConverter::convertNumber( nIntervalMinorDivisor, rAttrValue ); + bIntervalMinorFound = true; + break; + case XML_OPTACTION_SYMBOL_TYPE: + { + // if symbol_type is "named-symbol" the "symbol" + // property is set in the action XML_OPTACTION_SYMBOL_NAME + sal_Int32 nSymbolType = 0; + if( IsXMLToken( rAttrValue, XML_NONE )) + nSymbolType = -3; + else if( IsXMLToken( rAttrValue, XML_AUTOMATIC )) + nSymbolType = -2; + else if( IsXMLToken( rAttrValue, XML_IMAGE )) + nSymbolType = -1; + + if( nSymbolType < 0 ) + pAttrList->AddAttribute( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_CHART, + GetXMLToken( XML_SYMBOL )), + OUString::valueOf( nSymbolType )); + } + break; + case XML_OPTACTION_SYMBOL_NAME: + { + // assume "symbol-type" == "named-symbol" + sal_Int32 nSymbolType = -3; // NONE + // "square" just has an awkward token-name + if( IsXMLToken( rAttrValue, XML_GRADIENTSTYLE_SQUARE )) + nSymbolType = 0; + else if( IsXMLToken( rAttrValue, XML_DIAMOND )) + nSymbolType = 1; + else if( IsXMLToken( rAttrValue, XML_ARROW_DOWN )) + nSymbolType = 2; + else if( IsXMLToken( rAttrValue, XML_ARROW_UP )) + nSymbolType = 3; + else if( IsXMLToken( rAttrValue, XML_ARROW_RIGHT )) + nSymbolType = 4; + else if( IsXMLToken( rAttrValue, XML_ARROW_LEFT )) + nSymbolType = 5; + else if( IsXMLToken( rAttrValue, XML_BOW_TIE )) + nSymbolType = 6; + else if( IsXMLToken( rAttrValue, XML_HOURGLASS )) + nSymbolType = 7; + + if( nSymbolType >= 0 ) + pAttrList->AddAttribute( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_CHART, + GetXMLToken( XML_SYMBOL )), + OUString::valueOf( nSymbolType )); + } + break; + // #i25616# + case XML_OPTACTION_OPACITY: + aOpacityValueRemember = rAttrValue; + GetTransformer().NegPercent(aOpacityValueRemember); + break; + + // #i25616# + case XML_OPTACTION_IMAGE_OPACITY: + aImageOpacityValueRemember = rAttrValue; + GetTransformer().NegPercent(aImageOpacityValueRemember); + break; + + case XML_OPTACTION_KEEP_TOGETHER: + pAttrList->AddAttribute( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_STYLE,GetXMLToken(XML_BREAK_INSIDE)), + GetXMLToken( + IsXMLToken( rAttrValue, XML_ALWAYS ) + ? XML_COLUMNSPLIT_AVOID + : XML_COLUMNSPLIT_AUTO ) ); + break; + + case XML_OPTACTION_CONTROL_TEXT_ALIGN: + if ( m_bControlStyle ) + { + OUString aNewAttrQName( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_STYLE, + ::xmloff::token::GetXMLToken( + XML_TEXT_ALIGN ) ) ); + pAttrList->AddAttribute( aNewAttrQName, rAttrValue ); + } + else + { + OUString aNewAttrQName( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_FO, + ::xmloff::token::GetXMLToken( + XML_TEXT_ALIGN ) ) ); + pAttrList->AddAttribute( aNewAttrQName, rAttrValue ); + } + break; + + case XML_OPTACTION_DRAW_WRITING_MODE: + if( IsXMLToken( m_aStyleFamily, XML_GRAPHICS ) ) + { + pAttrList->AddAttribute( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_DRAW, + GetXMLToken( XML_WRITING_MODE ) ), rAttrValue ); + } + pAttrList->AddAttribute( rAttrName, rAttrValue ); + break; + + case XML_ATACTION_CAPTION_ESCAPE_OASIS: + { + OUString aAttrValue( rAttrValue ); + if( aAttrValue.indexOf( sal_Unicode('%') ) != -1 ) + { + sal_Int32 nValue = 0; + SvXMLUnitConverter::convertPercent( nValue, rAttrValue ); + if( nValue ) + { + nValue *= 100; + rtl::OUStringBuffer aOut; + SvXMLUnitConverter::convertPercent( aOut, nValue ); + aAttrValue = aOut.makeStringAndClear(); + } + } + else + { + XMLTransformerBase::ReplaceSingleInWithInch( aAttrValue ); + } + + pAttrList->AddAttribute( rAttrName, aAttrValue ); + } + break; + + case XML_ATACTION_DECODE_PROTECT: + { + pAttrList->AddAttribute( rAttrName, rAttrValue ); + + if( rAttrValue.indexOf( GetXMLToken( XML_SIZE ) ) != -1 ) + pAttrList->AddAttribute( GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_DRAW, + GetXMLToken( XML_SIZE_PROTECT )), GetXMLToken( XML_TRUE ) ); + + if( rAttrValue.indexOf( GetXMLToken( XML_POSITION ) ) != -1 ) + pAttrList->AddAttribute( GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_DRAW, + GetXMLToken( XML_MOVE_PROTECT )), GetXMLToken( XML_TRUE ) ); + } + break; + + case XML_ATACTION_DRAW_MIRROR_OASIS: // renames style:mirror to draw:mirror and adapts values + { + // keep original for writer graphic objects + // --> OD 2005-05-12 #i49139# - adapts attribute values, + OUString aNewAttrValue; + SvXMLTokenEnumerator aTokenEnum( rAttrValue ); + OUString aToken; + while( aTokenEnum.getNextToken( aToken ) ) + { + if ( aNewAttrValue.getLength() > 0 ) + { + aNewAttrValue += rtl::OUString::createFromAscii( " " ); + } + + if ( IsXMLToken( aToken, XML_HORIZONTAL_ON_EVEN ) ) + { + aNewAttrValue += GetXMLToken( XML_HORIZONTAL_ON_LEFT_PAGES ); + } + else if ( IsXMLToken( aToken, XML_HORIZONTAL_ON_ODD ) ) + { + aNewAttrValue += GetXMLToken( XML_HORIZONTAL_ON_RIGHT_PAGES ); + } + else + { + aNewAttrValue += aToken; + } + } + pAttrList->AddAttribute( rAttrName, aNewAttrValue ); + // <-- + + // create old draw:mirror for drawing graphic objects + OUString aAttrValue( GetXMLToken( IsXMLToken( rAttrValue, XML_HORIZONTAL ) ? XML_TRUE : XML_FALSE ) ); + pAttrList->AddAttribute( GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_DRAW, + GetXMLToken( XML_MIRROR )), aAttrValue ); + } + break; + case XML_ATACTION_GAMMA_OASIS: // converts percentage value to double + { + sal_Int32 nValue; + SvXMLUnitConverter::convertPercent( nValue, rAttrValue ); + const double fValue = ((double)nValue) / 100.0; + pAttrList->AddAttribute( rAttrName, OUString::valueOf( fValue ) ); + } + break; + case XML_ATACTION_OPACITY_FIX: + { + sal_Int32 nValue; + if( rAttrValue.indexOf( sal_Unicode('%') ) != -1 ) + { + SvXMLUnitConverter::convertPercent( nValue, rAttrValue ); + } + else + { + nValue = sal_Int32( rAttrValue.toDouble() * 100.0 ); + } + nValue = 100 - nValue; + + rtl::OUStringBuffer aOut; + SvXMLUnitConverter::convertPercent( aOut, nValue ); + pAttrList->AddAttribute( rAttrName, aOut.makeStringAndClear() ); + } + break; + default: + OSL_ENSURE( !this, "unknown action" ); + break; + } + } + else + { + pAttrList->AddAttribute( rAttrName, rAttrValue ); + } + } + if( XML_TOKEN_END != eUnderline ) + pAttrList->AddAttribute( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_STYLE, + GetXMLToken( XML_TEXT_UNDERLINE ) ), + MergeUnderline( eUnderline, bBoldUnderline, + bDoubleUnderline ) ); + if( XML_TOKEN_END != eLineThrough ) + pAttrList->AddAttribute( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_STYLE, + GetXMLToken( XML_TEXT_CROSSING_OUT ) ), + MergeLineThrough( eLineThrough, bBoldLineThrough, + bDoubleLineThrough, cLineThroughChar ) ); + if( bIntervalMinorFound ) + { + double fIntervalMinor = 0.0; + if( nIntervalMinorDivisor != 0) + fIntervalMinor = fIntervalMajor / static_cast< double >( nIntervalMinorDivisor ); + + ::rtl::OUStringBuffer aBuf; + SvXMLUnitConverter::convertDouble( aBuf, fIntervalMinor ); + pAttrList->AddAttribute( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_CHART, + GetXMLToken( XML_INTERVAL_MINOR )), + aBuf.makeStringAndClear()); + } + + // #i25616# + if(aOpacityValueRemember.getLength() || aImageOpacityValueRemember.getLength()) + { + pAttrList->AddAttribute( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_DRAW, + GetXMLToken( XML_TRANSPARENCY ) ), + aImageOpacityValueRemember.getLength() + ? aImageOpacityValueRemember : aOpacityValueRemember ); + } + } + else + { + if( !m_xAttrList.is() ) + { + m_xAttrList = new XMLMutableAttributeList( rAttrList, sal_True ); + } + else + { + static_cast< XMLMutableAttributeList * >( m_xAttrList.get() ) + ->AppendAttributeList( rAttrList ); + } + } +} + +void XMLPropertiesTContext_Impl::Export() +{ + OUString aNewQName( GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_STYLE, + ::xmloff::token::GetXMLToken( XML_PROPERTIES ) ) ); + GetTransformer().GetDocHandler()->startElement( GetExportQName(), + m_xAttrList ); + ExportContent(); + GetTransformer().GetDocHandler()->endElement( GetExportQName() ); +} + +XMLPropType XMLPropertiesTContext_Impl::GetPropType( const OUString& rLocalName ) +{ + XMLPropType eProp = XML_PROP_TYPE_END; + if( IsXMLToken( rLocalName, XML_GRAPHIC_PROPERTIES ) ) + eProp = XML_PROP_TYPE_GRAPHIC; + else if( IsXMLToken( rLocalName, XML_DRAWING_PAGE_PROPERTIES ) ) + eProp = XML_PROP_TYPE_DRAWING_PAGE; + else if( IsXMLToken( rLocalName, XML_PAGE_LAYOUT_PROPERTIES ) ) + eProp = XML_PROP_TYPE_PAGE_LAYOUT; + else if( IsXMLToken( rLocalName, XML_HEADER_FOOTER_PROPERTIES ) ) + eProp = XML_PROP_TYPE_HEADER_FOOTER; + else if( IsXMLToken( rLocalName, XML_TEXT_PROPERTIES ) ) + eProp = XML_PROP_TYPE_TEXT; + else if( IsXMLToken( rLocalName, XML_PARAGRAPH_PROPERTIES ) ) + eProp = XML_PROP_TYPE_PARAGRAPH; + else if( IsXMLToken( rLocalName, XML_RUBY_PROPERTIES ) ) + eProp = XML_PROP_TYPE_RUBY; + else if( IsXMLToken( rLocalName, XML_SECTION_PROPERTIES ) ) + eProp = XML_PROP_TYPE_SECTION; + else if( IsXMLToken( rLocalName, XML_TABLE_PROPERTIES ) ) + eProp = XML_PROP_TYPE_TABLE; + else if( IsXMLToken( rLocalName, XML_TABLE_COLUMN_PROPERTIES ) ) + eProp = XML_PROP_TYPE_TABLE_COLUMN; + else if( IsXMLToken( rLocalName, XML_TABLE_ROW_PROPERTIES ) ) + eProp = XML_PROP_TYPE_TABLE_ROW; + else if( IsXMLToken( rLocalName, XML_TABLE_CELL_PROPERTIES ) ) + eProp = XML_PROP_TYPE_TABLE_CELL; + else if( IsXMLToken( rLocalName, XML_LIST_LEVEL_PROPERTIES ) ) + eProp = XML_PROP_TYPE_LIST_LEVEL; + else if( IsXMLToken( rLocalName, XML_CHART_PROPERTIES ) ) + eProp = XML_PROP_TYPE_CHART; + + return eProp; +} + +OUString XMLPropertiesTContext_Impl::MergeUnderline( + XMLTokenEnum eUnderline, sal_Bool bBold, sal_Bool bDouble ) +{ + if( bDouble ) + { + switch( eUnderline ) + { + case XML_WAVE: + eUnderline = XML_DOUBLE_WAVE; + break; + default: + eUnderline = XML_DOUBLE; + break; + } + } + else if( bBold ) + { + switch( eUnderline ) + { + case XML_NONE: + case XML_SOLID: + eUnderline = XML_BOLD; + break; + case XML_DOTTED: + eUnderline = XML_BOLD_DOTTED; + break; + case XML_DASH: + eUnderline = XML_BOLD_DASH; + break; + case XML_LONG_DASH: + eUnderline = XML_BOLD_LONG_DASH; + break; + case XML_DOT_DASH: + eUnderline = XML_BOLD_DOT_DASH; + break; + case XML_DOT_DOT_DASH: + eUnderline = XML_BOLD_DOT_DOT_DASH; + break; + case XML_WAVE: + eUnderline = XML_BOLD_WAVE; + break; + default: + OSL_ENSURE( false, "xmloff::XMLPropertiesTContext_Impl::MergeUnderline(), missing underline case!" ); + break; + } + } + else + { + switch( eUnderline ) + { + case XML_SOLID: + eUnderline = XML_SINGLE; + break; + case XML_NONE: + eUnderline = XML_NONE; + break; + default: + OSL_ENSURE( false, "xmloff::XMLPropertiesTContext_Impl::MergeUnderline(), missing underline case!" ); + break; + } + } + + return GetXMLToken( eUnderline ); +} + +OUString XMLPropertiesTContext_Impl::MergeLineThrough( + XMLTokenEnum eLineThrough, sal_Bool bBold, sal_Bool bDouble, + sal_Unicode c ) +{ + if( c ) + eLineThrough = c=='/' ? XML_SLASH : XML_uX; + else if( bDouble ) + eLineThrough = XML_DOUBLE_LINE; + else if( bBold ) + eLineThrough = XML_THICK_LINE; + else if( XML_NONE != eLineThrough ) + eLineThrough = XML_SINGLE_LINE; + + return GetXMLToken( eLineThrough ); +} + +//------------------------------------------------------------------------------ + +TYPEINIT1( XMLStyleOASISTContext, XMLPersElemContentTContext ); + +XMLStyleOASISTContext::XMLStyleOASISTContext( XMLTransformerBase& rImp, + const OUString& rQName, + sal_Bool bPersistent ) : + XMLPersElemContentTContext ( rImp, rQName ), + m_bPersistent( bPersistent ), + m_bControlStyle( false ) +{ +} + +XMLStyleOASISTContext::XMLStyleOASISTContext( + XMLTransformerBase& rImp, + const OUString& rQName, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken, + sal_Bool bPersistent ) : + XMLPersElemContentTContext( rImp, rQName, nPrefix, eToken ), + m_bPersistent( bPersistent ) +{ +} + +XMLStyleOASISTContext::~XMLStyleOASISTContext() +{ +} + +XMLTransformerContext *XMLStyleOASISTContext::CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const Reference< XAttributeList >& rAttrList ) +{ + XMLTransformerContext *pContext = 0; + + if( XML_NAMESPACE_STYLE == nPrefix ) + { + XMLPropType ePropType = + XMLPropertiesTContext_Impl::GetPropType( rLocalName ); + if( XML_PROP_TYPE_END != ePropType ) + { + // if no properties context exist start a new one. + if( !m_xPropContext.is() ) + m_xPropContext = new XMLPropertiesTContext_Impl( + GetTransformer(), rQName, ePropType, m_aStyleFamily, m_bControlStyle ); + else + m_xPropContext->SetQNameAndPropType( rQName, ePropType ); + pContext = m_xPropContext.get(); + } + } + if( !pContext ) + { + // if a properties context exist close it + if( m_xPropContext.is() && !m_bPersistent ) + { + m_xPropContext->Export(); + m_xPropContext = 0; + } + + pContext = m_bPersistent + ? XMLPersElemContentTContext::CreateChildContext( + nPrefix, rLocalName, rQName, rAttrList ) + : XMLTransformerContext::CreateChildContext( + nPrefix, rLocalName, rQName, rAttrList ); + } + + return pContext; +} + +void XMLStyleOASISTContext::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + XMLTransformerActions *pActions = + GetTransformer().GetUserDefinedActions( OASIS_STYLE_ACTIONS ); + OSL_ENSURE( pActions, "go no actions" ); + + Reference< XAttributeList > xAttrList( rAttrList ); + XMLMutableAttributeList *pMutableAttrList = 0; + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + sal_Int16 nFamilyAttr = -1; + m_bControlStyle = sal_False; + + for( sal_Int16 i=0; i < nAttrCount; i++ ) + { + const OUString& rAttrName = xAttrList->getNameByIndex( i ); + OUString aLocalName; + sal_uInt16 nPrefix = + GetTransformer().GetNamespaceMap().GetKeyByAttrName( rAttrName, + &aLocalName ); + XMLTransformerActions::key_type aKey( nPrefix, aLocalName ); + XMLTransformerActions::const_iterator aIter = + pActions->find( aKey ); + if( !(aIter == pActions->end() ) ) + { + if( !pMutableAttrList ) + { + pMutableAttrList = + new XMLMutableAttributeList( xAttrList ); + xAttrList = pMutableAttrList; + } + const OUString& rAttrValue = xAttrList->getValueByIndex( i ); + switch( (*aIter).second.m_nActionType ) + { + case XML_ATACTION_STYLE_FAMILY: + if( IsXMLToken( rAttrValue, XML_GRAPHIC ) ) + { + m_aStyleFamily = GetXMLToken( XML_GRAPHICS ) ; + pMutableAttrList->SetValueByIndex( i, m_aStyleFamily ); + } + else + { + m_aStyleFamily = rAttrValue; + + if( IsXMLToken( rAttrValue, XML_PARAGRAPH ) ) + nFamilyAttr = i; + } + + break; + case XML_ATACTION_STYLE_DISPLAY_NAME: + case XML_ATACTION_REMOVE: + pMutableAttrList->RemoveAttributeByIndex( i ); + --i; + --nAttrCount; + break; + case XML_ATACTION_DECODE_STYLE_NAME: + m_bControlStyle = 0 == rAttrValue.compareToAscii( "ctrl", 4 ); + case XML_ATACTION_DECODE_STYLE_NAME_REF: + { + OUString aAttrValue( rAttrValue ); + if( GetTransformer().DecodeStyleName(aAttrValue) ) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_IN2INCH: + { + OUString aAttrValue( rAttrValue ); + if( XMLTransformerBase::ReplaceSingleInWithInch( + aAttrValue ) ) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_NEG_PERCENT: + { + OUString aAttrValue( rAttrValue ); + if( GetTransformer().NegPercent(aAttrValue) ) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_URI_OASIS: + { + OUString aAttrValue( rAttrValue ); + if( GetTransformer().ConvertURIToOOo( aAttrValue, + static_cast< sal_Bool >((*aIter).second.m_nParam1))) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + default: + OSL_ENSURE( !this, "unknown action" ); + break; + } + } + } + + if( m_bControlStyle && nFamilyAttr != -1 ) + pMutableAttrList->SetValueByIndex( nFamilyAttr, GetXMLToken( XML_CONTROL ) ); + + + if( m_bPersistent ) + XMLPersElemContentTContext::StartElement( xAttrList ); + else + GetTransformer().GetDocHandler()->startElement( GetExportQName(), + xAttrList ); +} + +void XMLStyleOASISTContext::EndElement() +{ + if( m_bPersistent ) + { + XMLPersElemContentTContext::EndElement(); + } + else + { + // if a properties context exist close it + if( m_xPropContext.is() ) + { + m_xPropContext->Export(); + m_xPropContext = 0; + } + GetTransformer().GetDocHandler()->endElement( GetExportQName() ); + } +} + +void XMLStyleOASISTContext::Characters( const OUString& ) +{ + // element content only: +} + +void XMLStyleOASISTContext::ExportContent() +{ + if( m_xPropContext.is() ) + m_xPropContext->Export(); + XMLPersElemContentTContext::ExportContent(); +} + +sal_Bool XMLStyleOASISTContext::IsPersistent() const +{ + return m_bPersistent; +} + +XMLTransformerActions *XMLStyleOASISTContext::CreateTransformerActions( + sal_uInt16 nType ) +{ + XMLTransformerActionInit *pInit = 0; + + switch( nType ) + { + case PROP_OASIS_GRAPHIC_ATTR_ACTIONS: + pInit = aGraphicPropertyOASISAttrActionTable; + break; + case PROP_OASIS_DRAWING_PAGE_ATTR_ACTIONS: + pInit = aDrawingPagePropertyOASISAttrActionTable; + break; + case PROP_OASIS_PAGE_LAYOUT_ATTR_ACTIONS: + pInit = aPageLayoutPropertyOASISAttrActionTable; + break; + case PROP_OASIS_HEADER_FOOTER_ATTR_ACTIONS: + pInit = aHeaderFooterPropertyOASISAttrActionTable; + break; + case PROP_OASIS_TEXT_ATTR_ACTIONS: + pInit = aTextPropertyOASISAttrActionTable; + break; + case PROP_OASIS_PARAGRAPH_ATTR_ACTIONS: + pInit = aParagraphPropertyOASISAttrActionTable; + break; + case PROP_OASIS_SECTION_ATTR_ACTIONS: + pInit = aSectionPropertyOASISAttrActionTable; + break; + case PROP_OASIS_TABLE_ATTR_ACTIONS: + pInit = aTablePropertyOASISAttrActionTable; + break; + case PROP_OASIS_TABLE_COLUMN_ATTR_ACTIONS: + pInit = aTableColumnPropertyOASISAttrActionTable; + break; + case PROP_OASIS_TABLE_ROW_ATTR_ACTIONS: + pInit = aTableRowPropertyOASISAttrActionTable; + break; + case PROP_OASIS_TABLE_CELL_ATTR_ACTIONS: + pInit = aTableCellPropertyOASISAttrActionTable; + break; + case PROP_OASIS_LIST_LEVEL_ATTR_ACTIONS: + pInit = aListLevelPropertyOASISAttrActionTable; + break; + case PROP_OASIS_CHART_ATTR_ACTIONS: + pInit = aChartPropertyOASISAttrActionTable; + break; + } + + XMLTransformerActions *pActions = 0; + if( pInit ) + pActions = new XMLTransformerActions( pInit ); + + return pActions; +} diff --git a/xmloff/source/transform/StyleOASISTContext.hxx b/xmloff/source/transform/StyleOASISTContext.hxx new file mode 100644 index 000000000000..67ddfaa7480a --- /dev/null +++ b/xmloff/source/transform/StyleOASISTContext.hxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_STYLEOASISTCONTEXT_HXX +#define _XMLOFF_STYLEOASISTCONTEXT_HXX + +#include <rtl/ref.hxx> +#include "DeepTContext.hxx" + + +class XMLTransformerActions; +class XMLPropertiesTContext_Impl; +class XMLStyleOASISTContext : public XMLPersElemContentTContext +{ + ::rtl::Reference< XMLPropertiesTContext_Impl > m_xPropContext; + + sal_Bool m_bPersistent; + sal_Bool m_bControlStyle; + + ::rtl::OUString m_aStyleFamily; +public: + TYPEINFO(); + + XMLStyleOASISTContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName, + sal_Bool bPersistent=sal_False ); + XMLStyleOASISTContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken, + sal_Bool bPersistent=sal_False ); + + virtual ~XMLStyleOASISTContext(); + + virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix, + const ::rtl::OUString& rLocalName, + const ::rtl::OUString& rQName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + virtual void EndElement(); + virtual void Characters( const ::rtl::OUString& rChars ); + + virtual void ExportContent(); + + virtual sal_Bool IsPersistent() const; + + static XMLTransformerActions *CreateTransformerActions( sal_uInt16 nType ); +}; + +#endif // _XMLOFF_STYLEOASISTCONTEXT_HXX + diff --git a/xmloff/source/transform/StyleOOoTContext.cxx b/xmloff/source/transform/StyleOOoTContext.cxx new file mode 100644 index 000000000000..dc0cfb75a100 --- /dev/null +++ b/xmloff/source/transform/StyleOOoTContext.cxx @@ -0,0 +1,1377 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" +#include <com/sun/star/xml/sax/SAXParseException.hpp> +#include <com/sun/star/xml/sax/SAXException.hpp> +#include <com/sun/star/xml/sax/XDocumentHandler.hpp> +#include <com/sun/star/xml/sax/XAttributeList.hpp> +#include <xmloff/nmspmap.hxx> +#include <xmloff/xmltoken.hxx> +#include "xmloff/xmlnmspe.hxx" +#include "PropType.hxx" +#include "DeepTContext.hxx" +#include "RenameElemTContext.hxx" +#include "ProcAttrTContext.hxx" +#include "ActionMapTypesOOo.hxx" +#include "MutableAttrList.hxx" +#include "TransformerActions.hxx" +#include "PropertyActionsOOo.hxx" +#ifndef _XMLOFF_TRANSFORMERBASE_HXX +#include "TransformerBase.hxx" +#endif + +#ifndef _XMLOFF_STYLEOASISTCONTEXT_HXX +#include "StyleOOoTContext.hxx" +#endif +#include <xmloff/xmluconv.hxx> +#include <rtl/ustrbuf.hxx> +#include <rtl/math.hxx> + +using ::rtl::OUString; +using namespace ::xmloff::token; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; + +const sal_uInt16 MAX_PROP_TYPES = 4; +#define ENTRY4(a,b,c,d) \ + { XML_PROP_TYPE_##a, XML_PROP_TYPE_##b, \ + XML_PROP_TYPE_##c, XML_PROP_TYPE_##d } +#define ENTRY3(a,b,c) \ + { XML_PROP_TYPE_##a, XML_PROP_TYPE_##b, \ + XML_PROP_TYPE_##c, XML_PROP_TYPE_END } +#define ENTRY2(a,b) \ + { XML_PROP_TYPE_##a, XML_PROP_TYPE_##b, \ + XML_PROP_TYPE_END, XML_PROP_TYPE_END } +#define ENTRY1(a) \ + { XML_PROP_TYPE_##a, XML_PROP_TYPE_##END, \ + XML_PROP_TYPE_END, XML_PROP_TYPE_END } + +static XMLPropType aPropTypes[XML_FAMILY_TYPE_END][MAX_PROP_TYPES] = +{ + ENTRY3( GRAPHIC, PARAGRAPH, TEXT ), // XML_FAMILY_TYPE_GRAPHIC, + ENTRY3( GRAPHIC, PARAGRAPH, TEXT ), // XML_FAMILY_TYPE_PRESENTATION, + ENTRY1( DRAWING_PAGE ), // XML_FAMILY_TYPE_DRAWING_PAGE, + ENTRY1( END ), // XML_FAMILY_TYPE_MASTER_PAGE + ENTRY1( PAGE_LAYOUT ), // XML_FAMILY_TYPE_PAGE_LAYOUT, + ENTRY1( HEADER_FOOTER ), // XML_FAMILY_TYPE_HEADER_FOOTER + ENTRY1( TEXT ), // XML_FAMILY_TYPE_TEXT, + ENTRY2( PARAGRAPH, TEXT ), // XML_FAMILY_TYPE_PARAGRAPH, + ENTRY1( RUBY ), //XML_FAMILY_TYPE_RUBY, + ENTRY1( SECTION ), // XML_FAMILY_TYPE_SECTION, + ENTRY1( TABLE ), // XML_FAMILY_TYPE_TABLE, + ENTRY1( TABLE_COLUMN ), // XML_FAMILY_TYPE_TABLE_COLUMN, + ENTRY1( TABLE_ROW ), // XML_FAMILY_TYPE_TABLE_ROW, + ENTRY3( TABLE_CELL, PARAGRAPH, TEXT ), // XML_FAMILY_TYPE_TABLE_CELL, + ENTRY1( LIST_LEVEL ), // XML_FAMILY_TYPE_LIST, + ENTRY4( CHART, GRAPHIC, PARAGRAPH, TEXT ), // XML_FAMILY_TYPE_CHART, + ENTRY1( TEXT ), // XML_FAMILY_TYPE_DATA, + ENTRY1( END ), // XML_FAMILY_TYPE_GRADIENT, + ENTRY1( END ), // XML_FAMILY_TYPE_HATCH, + ENTRY1( END ), // XML_FAMILY_TYPE_FILL_IMAGE, + ENTRY1( END ), // XML_FAMILY_TYPE_STROKE_DASH, + ENTRY1( END ), // XML_FAMILY_TYPE_MARKER, + ENTRY1( END ) // XML_FAMILY_TYPE_PRESENTATION_PAGE_LAYOUT, +}; + +static XMLTokenEnum aPropTokens[XML_PROP_TYPE_END] = +{ + XML_GRAPHIC_PROPERTIES, + XML_DRAWING_PAGE_PROPERTIES, + XML_PAGE_LAYOUT_PROPERTIES, + XML_HEADER_FOOTER_PROPERTIES, + XML_TEXT_PROPERTIES, + XML_PARAGRAPH_PROPERTIES, + XML_RUBY_PROPERTIES, + XML_SECTION_PROPERTIES, + XML_TABLE_PROPERTIES, + XML_TABLE_COLUMN_PROPERTIES, + XML_TABLE_ROW_PROPERTIES, + XML_TABLE_CELL_PROPERTIES, + XML_LIST_LEVEL_PROPERTIES, + XML_CHART_PROPERTIES +}; + +static sal_uInt16 aAttrActionMaps[XML_PROP_TYPE_END] = +{ + PROP_OOO_GRAPHIC_ATTR_ACTIONS, + PROP_OOO_DRAWING_PAGE_ATTR_ACTIONS, // DRAWING_PAGE + PROP_OOO_PAGE_LAYOUT_ATTR_ACTIONS, + PROP_OOO_HEADER_FOOTER_ATTR_ACTIONS, + PROP_OOO_TEXT_ATTR_ACTIONS, + PROP_OOO_PARAGRAPH_ATTR_ACTIONS, + MAX_OOO_PROP_ACTIONS, // RUBY + PROP_OOO_SECTION_ATTR_ACTIONS, + PROP_OOO_TABLE_ATTR_ACTIONS, + PROP_OOO_TABLE_COLUMN_ATTR_ACTIONS, + PROP_OOO_TABLE_ROW_ATTR_ACTIONS, + PROP_OOO_TABLE_CELL_ATTR_ACTIONS, + PROP_OOO_LIST_LEVEL_ATTR_ACTIONS, + PROP_OOO_CHART_ATTR_ACTIONS +}; + +static sal_uInt16 aElemActionMaps[XML_PROP_TYPE_END] = +{ + PROP_OOO_GRAPHIC_ELEM_ACTIONS, + MAX_OOO_PROP_ACTIONS, + MAX_OOO_PROP_ACTIONS, + MAX_OOO_PROP_ACTIONS, + PROP_OOO_TEXT_ELEM_ACTIONS, + PROP_OOO_PARAGRAPH_ELEM_ACTIONS, + MAX_OOO_PROP_ACTIONS, + MAX_OOO_PROP_ACTIONS, + MAX_OOO_PROP_ACTIONS, + MAX_OOO_PROP_ACTIONS, + MAX_OOO_PROP_ACTIONS, + PROP_OOO_TABLE_CELL_ELEM_ACTIONS, + MAX_OOO_PROP_ACTIONS, + PROP_OOO_CHART_ELEM_ACTIONS +}; + + +//------------------------------------------------------------------------------ + +class XMLTypedPropertiesOOoTContext_Impl : public XMLPersElemContentTContext +{ + ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > m_xAttrList; + +public: + + TYPEINFO(); + + XMLTypedPropertiesOOoTContext_Impl( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName ); + + virtual ~XMLTypedPropertiesOOoTContext_Impl(); + + using XMLPersAttrListTContext::AddAttribute; + void AddAttribute( const ::rtl::OUString &sName , + const ::rtl::OUString &sValue ); + void AddAttribute( sal_uInt16 nPrefix, XMLTokenEnum eToken, + const ::rtl::OUString &sValue ); + + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& rAttrList ); + + virtual void Export(); +}; + +TYPEINIT1( XMLTypedPropertiesOOoTContext_Impl, XMLPersElemContentTContext ); + +XMLTypedPropertiesOOoTContext_Impl::XMLTypedPropertiesOOoTContext_Impl( + XMLTransformerBase& rImp, + const OUString& rQName ) : + XMLPersElemContentTContext( rImp, rQName ), + m_xAttrList( new XMLMutableAttributeList() ) +{ +} + +XMLTypedPropertiesOOoTContext_Impl::~XMLTypedPropertiesOOoTContext_Impl() +{ +} + +void XMLTypedPropertiesOOoTContext_Impl::AddAttribute( + const ::rtl::OUString &sName , + const ::rtl::OUString &sValue ) +{ + static_cast< XMLMutableAttributeList * >( m_xAttrList.get() ) + ->AddAttribute( sName, sValue ); +} + +void XMLTypedPropertiesOOoTContext_Impl::AddAttribute( + sal_uInt16 nPrefix, XMLTokenEnum eToken, + const ::rtl::OUString &sValue ) +{ + OUString sName( + GetTransformer().GetNamespaceMap().GetQNameByKey( + nPrefix, ::xmloff::token::GetXMLToken( eToken ) ) ); + static_cast< XMLMutableAttributeList * >( m_xAttrList.get() ) + ->AddAttribute( sName, sValue ); +} + +void XMLTypedPropertiesOOoTContext_Impl::StartElement( + const Reference< XAttributeList >& ) +{ + // empty, ignore even the attribute list +} + +void XMLTypedPropertiesOOoTContext_Impl::Export() +{ + if( m_xAttrList->getLength() || HasElementContent() ) + { + GetTransformer().GetDocHandler()->startElement( GetQName(), m_xAttrList ); + ExportContent(); + GetTransformer().GetDocHandler()->endElement( GetQName() ); + } +} + +//------------------------------------------------------------------------------ + +class XMLPropertiesOOoTContext_Impl : public XMLTransformerContext +{ + ::rtl::Reference < XMLTypedPropertiesOOoTContext_Impl > + m_aPropContexts[MAX_PROP_TYPES]; + + typedef XMLPropType XMLPropTypes[MAX_PROP_TYPES]; + + XMLPropTypes m_aPropTypes; + + sal_Bool m_bPersistent; + + XMLTypedPropertiesOOoTContext_Impl *GetPropContextAndAction( + TransformerAction_Impl& rAction, + sal_uInt16 nPrefix, const OUString& rLocalName, + sal_Bool bElem ); + + XMLTypedPropertiesOOoTContext_Impl *GetPropContext( + XMLPropType eType ); + + +public: + + TYPEINFO(); + + XMLPropertiesOOoTContext_Impl( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName, + XMLPropTypes& rTypes, + sal_Bool bPersistent ); + + virtual ~XMLPropertiesOOoTContext_Impl(); + + XMLTransformerContext *CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const Reference< XAttributeList >& rAttrList ); + + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& rAttrList ); + + virtual void EndElement(); + + virtual void Characters( const ::rtl::OUString& rChars ); + + virtual void Export(); + + virtual sal_Bool IsPersistent() const; +}; + +TYPEINIT1( XMLPropertiesOOoTContext_Impl, XMLTransformerContext ); + +XMLTypedPropertiesOOoTContext_Impl + *XMLPropertiesOOoTContext_Impl::GetPropContext( + XMLPropType eType ) +{ + sal_uInt16 nIndex = MAX_PROP_TYPES; + for( sal_uInt16 i=0; i< MAX_PROP_TYPES; i++ ) + { + if( m_aPropTypes[i] == eType ) + { + nIndex = i; + break; + } + } + if( MAX_PROP_TYPES == nIndex ) + return 0; + + if( !m_aPropContexts[nIndex].is() ) + { + m_aPropContexts[nIndex] = + new XMLTypedPropertiesOOoTContext_Impl( + GetTransformer(), + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_STYLE, + ::xmloff::token::GetXMLToken( + aPropTokens[m_aPropTypes[nIndex]] ) )); + } + + return m_aPropContexts[nIndex].get(); +} + + +XMLTypedPropertiesOOoTContext_Impl + *XMLPropertiesOOoTContext_Impl::GetPropContextAndAction( + TransformerAction_Impl& rAction, + sal_uInt16 nPrefix, const OUString& rLocalName, + sal_Bool bElem ) +{ + rAction.m_nActionType = XML_ATACTION_COPY; + sal_uInt16 nIndex = 0; + + XMLTransformerActions::key_type aKey( nPrefix, rLocalName ); + sal_uInt16 i=0; + while( i < MAX_PROP_TYPES && XML_PROP_TYPE_END!=m_aPropTypes[i]) + { + sal_uInt16 nActionMap = + (bElem ? aElemActionMaps : aAttrActionMaps)[m_aPropTypes[i]]; + if( nActionMap < MAX_OOO_PROP_ACTIONS ) + { + XMLTransformerActions *pActions = + GetTransformer().GetUserDefinedActions( nActionMap ); + OSL_ENSURE( pActions, "go no actions" ); + if( pActions ) + { + XMLTransformerActions::const_iterator aIter = + pActions->find( aKey ); + + if( !(aIter == pActions->end()) ) + { + rAction = (*aIter).second; + nIndex = i; + break; + } + } + } + ++i; + } + +#ifdef DBG_UTIL + if( !( XML_NAMESPACE_NONE == nPrefix || + (XML_NAMESPACE_UNKNOWN_FLAG & nPrefix) || + XML_PROP_TYPE_END==m_aPropTypes[1] || + (i<MAX_PROP_TYPES && XML_PROP_TYPE_END!=m_aPropTypes[i]) ) ) + { + ::rtl::OString aTmp("Didnt't find property: "); + const ::rtl::OUString& rPrefix = + GetTransformer().GetNamespaceMap().GetPrefixByKey( nPrefix ); + aTmp += ::rtl::OString( rPrefix.getStr(), rPrefix.getLength(), + RTL_TEXTENCODING_ASCII_US ); + aTmp += ::rtl::OString::valueOf( ':' ); + aTmp += ::rtl::OString( rLocalName.getStr(), rLocalName.getLength(), + RTL_TEXTENCODING_ASCII_US ); + aTmp += ::rtl::OString(", assuming <style:"); + const ::rtl::OUString& rName = + ::xmloff::token::GetXMLToken( aPropTokens[m_aPropTypes[0]] ); + aTmp += ::rtl::OString( rName.getStr(), rName.getLength(), + RTL_TEXTENCODING_ASCII_US ); + aTmp += ::rtl::OString::valueOf( '>' ); + + OSL_ENSURE( !this, aTmp ); + } +#endif + + if( !m_aPropContexts[nIndex].is() ) + { + m_aPropContexts[nIndex] = + new XMLTypedPropertiesOOoTContext_Impl( + GetTransformer(), + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_STYLE, + ::xmloff::token::GetXMLToken( + aPropTokens[m_aPropTypes[nIndex]] ) )); + } + + return m_aPropContexts[nIndex].get(); +} + +XMLPropertiesOOoTContext_Impl::XMLPropertiesOOoTContext_Impl( + XMLTransformerBase& rImp, + const OUString& rQName, + XMLPropTypes& rTypes, + sal_Bool bPersistent ) : + XMLTransformerContext( rImp, rQName ), + m_bPersistent( bPersistent ) +{ + for( sal_uInt16 i=0; i < MAX_PROP_TYPES; ++i ) + { + // remember the types that belong to the attribute and element lists + m_aPropTypes[i] = rTypes[i]; + } +} + +XMLPropertiesOOoTContext_Impl::~XMLPropertiesOOoTContext_Impl() +{ +} + +XMLTransformerContext *XMLPropertiesOOoTContext_Impl::CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const Reference< XAttributeList >& rAttrList ) +{ + TransformerAction_Impl aAction; + return GetPropContextAndAction( aAction, nPrefix, rLocalName, sal_True ) + ->CreateChildContext( nPrefix, rLocalName, rQName, rAttrList ); +} + + +void XMLPropertiesOOoTContext_Impl::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + Reference< XAttributeList > xAttrList( rAttrList ); + + XMLTypedPropertiesOOoTContext_Impl * pIntervalMinorDivisorContext = 0; + double fIntervalMajor = 0.0; + double fIntervalMinor = 0.0; + sal_Bool bMoveProtect = sal_False; + sal_Bool bSizeProtect = sal_False; + OUString aProtectAttrValue; + XMLTypedPropertiesOOoTContext_Impl * pProtectContext = 0; + + // --> OD 2005-05-13 #i49139# - attribute <style:mirror> has to be priority + // over attribute <style:draw>. The filter from OpenDocument file format + // to OpenOffice.org file format produces styles with both attributes. + sal_Bool bExistStyleMirror( sal_False ); + OUString aStyleMirrorAttrValue; + sal_Bool bExistDrawMirror( sal_False ); + OUString aDrawMirrorAttrValue; + XMLTypedPropertiesOOoTContext_Impl* pMirrorContext( 0L ); + // <-- + + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + for( sal_Int16 i=0; i < nAttrCount; i++ ) + { + const OUString sAttrName = xAttrList->getNameByIndex( i ); + const OUString sAttrValue = xAttrList->getValueByIndex( i ); + OUString aLocalName; + sal_uInt16 nPrefix = + GetTransformer().GetNamespaceMap().GetKeyByAttrName( sAttrName, + &aLocalName ); + TransformerAction_Impl aAction; + XMLTypedPropertiesOOoTContext_Impl *pContext = + GetPropContextAndAction( aAction, nPrefix, aLocalName, sal_False ); + switch( aAction.m_nActionType ) + { + case XML_ATACTION_REMOVE: + break; + case XML_ATACTION_COPY: + pContext->AddAttribute( sAttrName, sAttrValue ); + break; + case XML_ATACTION_COPY_DUPLICATE: + { + pContext->AddAttribute( sAttrName, sAttrValue ); + XMLTypedPropertiesOOoTContext_Impl *pContext2 = + GetPropContext( (XMLPropType)aAction.m_nParam1 ); + if( pContext2 ) + pContext2->AddAttribute( sAttrName, sAttrValue ); + } + break; + case XML_ATACTION_RENAME: + { + pContext->AddAttribute( aAction.GetQNamePrefixFromParam1(), + aAction.GetQNameTokenFromParam1(), + sAttrValue ); + } + break; + case XML_ATACTION_ENCODE_STYLE_NAME_REF: + { + OUString aAttrValue( sAttrValue ); + GetTransformer().EncodeStyleName(aAttrValue); + pContext->AddAttribute( sAttrName, aAttrValue ); + } + break; + case XML_ATACTION_RENAME_ENCODE_STYLE_NAME_REF: + { + OUString aAttrValue( sAttrValue ); + GetTransformer().EncodeStyleName(aAttrValue); + pContext->AddAttribute( aAction.GetQNamePrefixFromParam1(), + aAction.GetQNameTokenFromParam1(), + aAttrValue ); + } + break; + case XML_ATACTION_NEG_PERCENT: + { + OUString aAttrValue( sAttrValue ); + GetTransformer().NegPercent(aAttrValue); + pContext->AddAttribute( sAttrName, aAttrValue ); + } + break; + case XML_ATACTION_RENAME_NEG_PERCENT: + { + OUString aAttrValue( sAttrValue ); + GetTransformer().NegPercent(aAttrValue); + pContext->AddAttribute( aAction.GetQNamePrefixFromParam1(), + aAction.GetQNameTokenFromParam1(), + aAttrValue ); + } + break; + case XML_ATACTION_INCH2IN: + { + OUString aAttrValue( sAttrValue ); + XMLTransformerBase::ReplaceSingleInchWithIn( aAttrValue ); + pContext->AddAttribute( sAttrName, aAttrValue ); + } + break; + case XML_ATACTION_INCH2IN_DUPLICATE: + { + OUString aAttrValue( sAttrValue ); + XMLTransformerBase::ReplaceSingleInchWithIn( aAttrValue ); + pContext->AddAttribute( sAttrName, aAttrValue ); + XMLTypedPropertiesOOoTContext_Impl *pContext2 = + GetPropContext( (XMLPropType)aAction.m_nParam1 ); + if( pContext2 ) + pContext2->AddAttribute( sAttrName, aAttrValue ); + } + break; + case XML_ATACTION_INCHS2INS: + { + OUString aAttrValue( sAttrValue ); + XMLTransformerBase::ReplaceInchWithIn( aAttrValue ); + pContext->AddAttribute( sAttrName, aAttrValue ); + } + break; + case XML_PTACTION_LINE_MODE: + { + OUString aAttrValue( GetXMLToken( + IsXMLToken( sAttrValue, XML_TRUE ) + ? XML_CONTINUOUS + : XML_SKIP_WHITE_SPACE) ); + OUString aAttrQName( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_STYLE, + GetXMLToken( XML_TEXT_UNDERLINE_MODE ) ) ); + pContext->AddAttribute( aAttrQName, aAttrValue ); + + aAttrQName = + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_STYLE, + GetXMLToken( XML_TEXT_LINE_THROUGH_MODE ) ); + pContext->AddAttribute( aAttrQName, aAttrValue ); + } + break; + case XML_PTACTION_KEEP_WITH_NEXT: + { + OUString aAttrValue( GetXMLToken( + IsXMLToken( sAttrValue, XML_TRUE ) + ? XML_ALWAYS + : XML_AUTO) ); + pContext->AddAttribute( sAttrName, aAttrValue ); + } + break; + case XML_PTACTION_UNDERLINE: + { + XMLTokenEnum eToken = GetTransformer().GetToken( sAttrValue ); + sal_Bool bBold = sal_False, bDouble = sal_False; + switch( eToken ) + { + case XML_SINGLE: + eToken = XML_SOLID; + break; + case XML_DOUBLE: + eToken = XML_SOLID; + bDouble = sal_True; + break; + case XML_BOLD: + eToken = XML_SOLID; + bBold = sal_True; + break; + case XML_BOLD_DOTTED: + eToken = XML_DOTTED; + bBold = sal_True; + break; + case XML_BOLD_DASH: + eToken = XML_DASH; + bBold = sal_True; + break; + case XML_BOLD_LONG_DASH: + eToken = XML_LONG_DASH; + bBold = sal_True; + break; + case XML_BOLD_DOT_DASH: + eToken = XML_DOT_DASH; + bBold = sal_True; + break; + case XML_BOLD_DOT_DOT_DASH: + eToken = XML_DOT_DOT_DASH; + bBold = sal_True; + break; + case XML_BOLD_WAVE: + eToken = XML_WAVE; + bBold = sal_True; + break; + case XML_DOUBLE_WAVE: + eToken = XML_WAVE; + bDouble = sal_True; + break; + case XML_NONE: + eToken = XML_NONE; + bDouble = sal_False; + break; + default: + OSL_ENSURE( false, "xmloff::XMLPropertiesOOoTContext_Impl::StartElement(), unknown underline token!" ); + break; + } + pContext->AddAttribute( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_STYLE, + GetXMLToken( XML_TEXT_UNDERLINE_STYLE ) ), + eToken != XML_TOKEN_END ? GetXMLToken( eToken ) + : sAttrValue ); + if( bDouble ) + pContext->AddAttribute( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_STYLE, + GetXMLToken( XML_TEXT_UNDERLINE_TYPE ) ), + GetXMLToken( XML_DOUBLE ) ); + if( bBold ) + pContext->AddAttribute( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_STYLE, + GetXMLToken( XML_TEXT_UNDERLINE_WIDTH ) ), + GetXMLToken( XML_BOLD ) ); + } + break; + case XML_PTACTION_LINETHROUGH: + { + XMLTokenEnum eToken = GetTransformer().GetToken( sAttrValue ); + sal_Bool bBold = sal_False, bDouble = sal_False; + sal_Unicode c = 0; + switch( eToken ) + { + case XML_SINGLE_LINE: + eToken = XML_SOLID; + break; + case XML_DOUBLE_LINE: + eToken = XML_SOLID; + bDouble = sal_True; + break; + case XML_THICK_LINE: + eToken = XML_SOLID; + bBold = sal_True; + break; + case XML_SLASH: + eToken = XML_SOLID; + c = '/'; + break; + case XML_uX: + eToken = XML_SOLID; + c = 'X'; + break; + default: + break; + } + pContext->AddAttribute( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_STYLE, + GetXMLToken( XML_TEXT_LINE_THROUGH_STYLE ) ), + eToken != XML_TOKEN_END ? GetXMLToken( eToken ) + : sAttrValue ); + if( bDouble ) + pContext->AddAttribute( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_STYLE, + GetXMLToken( XML_TEXT_LINE_THROUGH_TYPE ) ), + GetXMLToken( XML_DOUBLE ) ); + if( bBold ) + pContext->AddAttribute( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_STYLE, + GetXMLToken( XML_TEXT_LINE_THROUGH_WIDTH ) ), + GetXMLToken( XML_BOLD ) ); + if( c ) + pContext->AddAttribute( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_STYLE, + GetXMLToken( XML_TEXT_LINE_THROUGH_TEXT ) ), + OUString::valueOf( c ) ); + } + break; + case XML_PTACTION_SPLINES: + { + sal_Int32 nSplineType = sAttrValue.toInt32(); + OUString aNewAttrName = GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_CHART, GetXMLToken( XML_INTERPOLATION ) ); + + switch( nSplineType ) + { + // straight lines + case 0: + pContext->AddAttribute( + aNewAttrName, GetXMLToken( XML_NONE )); + break; + // cubic spline + case 1: + pContext->AddAttribute( + aNewAttrName, GetXMLToken( XML_CUBIC_SPLINE )); + break; + // B-spline + case 2: + pContext->AddAttribute( + aNewAttrName, GetXMLToken( XML_B_SPLINE )); + break; + + default: + OSL_ENSURE( false, "invalid spline type" ); + pContext->AddAttribute( + aNewAttrName, GetXMLToken( XML_NONE )); + break; + } + } + break; + case XML_PTACTION_INTERVAL_MAJOR: + pContext->AddAttribute( sAttrName, sAttrValue ); + SvXMLUnitConverter::convertDouble( fIntervalMajor, sAttrValue ); + break; + case XML_PTACTION_INTERVAL_MINOR: + SvXMLUnitConverter::convertDouble( fIntervalMinor, sAttrValue ); + pIntervalMinorDivisorContext = pContext; + break; + case XML_PTACTION_SYMBOL: + { + sal_Int32 nSymbolType = sAttrValue.toInt32(); + OUString aNewAttrName = GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_CHART, GetXMLToken( XML_SYMBOL_TYPE ) ); + + if( nSymbolType >= 0 ) + { + pContext->AddAttribute( aNewAttrName, GetXMLToken( XML_NAMED_SYMBOL )); + enum XMLTokenEnum eToken = XML_TOKEN_INVALID; + switch( nSymbolType ) + { + // SYMBOL0 + case 0: + // "square" has an awkward token name + eToken = XML_GRADIENTSTYLE_SQUARE; + break; + // SYMBOL1 + case 1: + eToken = XML_DIAMOND; + break; + // SYMBOL2 + case 2: + eToken = XML_ARROW_DOWN; + break; + // SYMBOL3 + case 3: + eToken = XML_ARROW_UP; + break; + // SYMBOL4 + case 4: + eToken = XML_ARROW_RIGHT; + break; + // SYMBOL5 + case 5: + eToken = XML_ARROW_LEFT; + break; + // SYMBOL6 + case 6: + eToken = XML_BOW_TIE; + break; + // SYMBOL7 + case 7: + eToken = XML_HOURGLASS; + break; + default: + OSL_ENSURE( false, "invalid named symbol" ); + break; + } + + if( eToken != XML_TOKEN_INVALID ) + { + pContext->AddAttribute( GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_CHART, GetXMLToken( XML_SYMBOL_NAME )), + GetXMLToken( eToken )); + } + } + else + { + switch( nSymbolType ) + { + // NONE + case -3: + pContext->AddAttribute( + aNewAttrName, GetXMLToken( XML_NONE )); + break; + // AUTO + case -2: + pContext->AddAttribute( + aNewAttrName, GetXMLToken( XML_AUTOMATIC )); + break; + // BITMAPURL + case -1: + pContext->AddAttribute( + aNewAttrName, GetXMLToken( XML_IMAGE )); + break; + default: + OSL_ENSURE( false, "invalid symbol type" ); + pContext->AddAttribute( + aNewAttrName, GetXMLToken( XML_NONE )); + break; + } + } + } + break; + case XML_PTACTION_SYMBOL_IMAGE_NAME: + { + // create an xlink:href element for URI attribute + XMLPersAttrListTContext *pSymbolImageContext = new XMLPersAttrListTContext( + GetTransformer(), GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_CHART, GetXMLToken( XML_SYMBOL_IMAGE ))); + + OUString aAttrValue( sAttrValue ); + if( GetTransformer().ConvertURIToOASIS( aAttrValue, sal_True )) + { + pSymbolImageContext->AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, aAttrValue ); + pContext->AddContent( pSymbolImageContext ); + } + } + break; + + // #i25616# + case XML_PTACTION_TRANSPARENCY : + { + OUString aAttrValue( sAttrValue ); + GetTransformer().NegPercent(aAttrValue); + pContext->AddAttribute( XML_NAMESPACE_DRAW, + XML_OPACITY, + aAttrValue ); + pContext->AddAttribute( XML_NAMESPACE_DRAW, + XML_IMAGE_OPACITY, + aAttrValue ); + } + break; + + case XML_PTACTION_BREAK_INSIDE: + { + pContext->AddAttribute( + XML_NAMESPACE_FO, XML_KEEP_TOGETHER, + GetXMLToken( + IsXMLToken( sAttrValue, XML_COLUMNSPLIT_AVOID ) + ? XML_ALWAYS + : XML_AUTO ) ); + } + break; + case XML_ATACTION_CAPTION_ESCAPE_OOO: + { + OUString aAttrValue( sAttrValue ); + if( aAttrValue.indexOf( sal_Unicode('%') ) != -1 ) + { + sal_Int32 nValue = 0; + SvXMLUnitConverter::convertPercent( nValue, sAttrValue ); + if( nValue ) + { + nValue /= 100; + rtl::OUStringBuffer aOut; + SvXMLUnitConverter::convertPercent( aOut, nValue ); + aAttrValue = aOut.makeStringAndClear(); + } + } + else + { + XMLTransformerBase::ReplaceSingleInchWithIn( aAttrValue ); + } + + pContext->AddAttribute( sAttrName, aAttrValue ); + } + break; + case XML_ATACTION_MOVE_PROTECT: + bMoveProtect = IsXMLToken( sAttrValue, XML_TRUE ); + pProtectContext = pContext; + break; + case XML_ATACTION_SIZE_PROTECT: + bSizeProtect = IsXMLToken( sAttrValue, XML_TRUE ); + pProtectContext = pContext; + break; + case XML_ATACTION_PROTECT: + aProtectAttrValue = sAttrValue; + pProtectContext = pContext; + break; + case XML_ATACTION_DRAW_MIRROR_OOO: // renames draw:mirror to style:mirror and adapts values + { + // --> OD 2005-05-13 #i49139# + aDrawMirrorAttrValue = + GetXMLToken( IsXMLToken( sAttrValue, XML_TRUE ) + ? XML_HORIZONTAL : XML_NONE ); + bExistDrawMirror = sal_True; + pMirrorContext = pContext; + // <-- + } + break; + // --> OD 2005-05-12 #i49139# + case XML_ATACTION_STYLE_MIRROR_OOO: // adapts style:mirror values + { + SvXMLTokenEnumerator aTokenEnum( sAttrValue ); + OUString aToken; + while( aTokenEnum.getNextToken( aToken ) ) + { + if ( aStyleMirrorAttrValue.getLength() > 0 ) + { + aStyleMirrorAttrValue += rtl::OUString::createFromAscii( " " ); + } + + if ( IsXMLToken( aToken, XML_HORIZONTAL_ON_LEFT_PAGES ) ) + { + aStyleMirrorAttrValue += GetXMLToken( XML_HORIZONTAL_ON_EVEN ); + } + else if ( IsXMLToken( aToken, XML_HORIZONTAL_ON_RIGHT_PAGES ) ) + { + aStyleMirrorAttrValue += GetXMLToken( XML_HORIZONTAL_ON_ODD ); + } + else + { + aStyleMirrorAttrValue += aToken; + } + } + bExistStyleMirror = sal_True; + pMirrorContext = pContext; + } + break; + // <-- + case XML_ATACTION_GAMMA_OOO: // converts double value to percentage + { + double fValue = sAttrValue.toDouble(); + sal_Int32 nValue = (sal_Int32)((fValue * 100.0) + ( fValue > 0 ? 0.5 : - 0.5 ) ); + + rtl::OUStringBuffer aOut; + SvXMLUnitConverter::convertPercent( aOut, nValue ); + OUString aAttrValue( aOut.makeStringAndClear() ); + pContext->AddAttribute( sAttrName, aAttrValue ); + } + break; + case XML_ATACTION_OPACITY_FIX: + { + sal_Int32 nValue; + if( sAttrValue.indexOf( sal_Unicode('%') ) != -1 ) + { + SvXMLUnitConverter::convertPercent( nValue, sAttrValue ); + } + else + { + nValue = sal_Int32( sAttrValue.toDouble() * 100.0 ); + } + nValue = 100 - nValue; + + rtl::OUStringBuffer aOut; + SvXMLUnitConverter::convertPercent( aOut, nValue ); + pContext->AddAttribute( sAttrName, aOut.makeStringAndClear() ); + } + break; + default: + OSL_ENSURE( !this, "unknown action" ); + break; + } + } + + // --> OD 2005-05-13 #i49139# + if ( bExistStyleMirror ) + { + pMirrorContext->AddAttribute( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_STYLE, GetXMLToken( XML_MIRROR ) ), + aStyleMirrorAttrValue); + } + else if ( bExistDrawMirror ) + { + pMirrorContext->AddAttribute( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_STYLE, GetXMLToken( XML_MIRROR ) ), + aDrawMirrorAttrValue); + } + // <-- + + if( bMoveProtect || bSizeProtect || aProtectAttrValue.getLength() ) + { + if( (bMoveProtect ||bSizeProtect) && IsXMLToken( aProtectAttrValue, XML_NONE ) ) + aProtectAttrValue = OUString(); + + const OUString& rPosition = GetXMLToken( XML_POSITION ); + if( bMoveProtect && -1 == aProtectAttrValue.indexOf( rPosition ) ) + { + if( aProtectAttrValue.getLength() ) + aProtectAttrValue += OUString::valueOf( sal_Unicode( ' ' ) ); + aProtectAttrValue += rPosition; + } + + const OUString& rSize = GetXMLToken( XML_SIZE ); + if( bSizeProtect && -1 == aProtectAttrValue.indexOf( rSize ) ) + { + if( aProtectAttrValue.getLength() ) + aProtectAttrValue += OUString::valueOf( sal_Unicode( ' ' ) ); + aProtectAttrValue += rSize; + } + + pProtectContext->AddAttribute( GetTransformer().GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_STYLE, GetXMLToken( XML_PROTECT ) ), aProtectAttrValue ); + } + + if( pIntervalMinorDivisorContext ) + { + if( fIntervalMinor != 0.0 ) + { + sal_Int32 nIntervalMinorDivisor = static_cast< sal_Int32 >( + ::rtl::math::round( fIntervalMajor / fIntervalMinor )); + + ::rtl::OUStringBuffer aBuf; + SvXMLUnitConverter::convertNumber( aBuf, nIntervalMinorDivisor ); + pIntervalMinorDivisorContext->AddAttribute( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_CHART, + GetXMLToken( XML_INTERVAL_MINOR_DIVISOR )), + aBuf.makeStringAndClear()); + } + } +} + +void XMLPropertiesOOoTContext_Impl::EndElement() +{ + if( !m_bPersistent ) + Export(); +} + +void XMLPropertiesOOoTContext_Impl::Characters( const OUString& ) +{ + // ignore them +} + +void XMLPropertiesOOoTContext_Impl::Export() +{ + + for( sal_uInt16 i=0; i < MAX_PROP_TYPES; i++ ) + { + if( m_aPropContexts[i].is() ) + m_aPropContexts[i]->Export(); + } +} + +sal_Bool XMLPropertiesOOoTContext_Impl::IsPersistent() const +{ + return m_bPersistent; +} + + +//------------------------------------------------------------------------------ + +TYPEINIT1( XMLStyleOOoTContext, XMLPersElemContentTContext ); + +XMLStyleOOoTContext::XMLStyleOOoTContext( XMLTransformerBase& rImp, + const OUString& rQName, + XMLFamilyType eT, + sal_Bool bPersistent ) : + XMLPersElemContentTContext( rImp, rQName ), + m_eFamily( eT ), + m_bPersistent( bPersistent ) +{ +} + +XMLStyleOOoTContext::XMLStyleOOoTContext( + XMLTransformerBase& rImp, + const OUString& rQName, + XMLFamilyType eT, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken, + sal_Bool bPersistent ) : + XMLPersElemContentTContext( rImp, rQName, nPrefix, eToken ), + m_eFamily( eT ), + m_bPersistent( bPersistent ) +{ +} + +XMLStyleOOoTContext::~XMLStyleOOoTContext() +{ +} + +XMLTransformerContext *XMLStyleOOoTContext::CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const Reference< XAttributeList >& rAttrList ) +{ + XMLTransformerContext *pContext = 0; + + if( XML_NAMESPACE_STYLE == nPrefix && + IsXMLToken( rLocalName, XML_PROPERTIES ) ) + { + if( aPropTypes[m_eFamily][0] == XML_PROP_TYPE_END ) + { + OSL_ENSURE( !this, "unexpected properties element" ); + pContext = m_bPersistent + ? XMLPersElemContentTContext::CreateChildContext( + nPrefix, rLocalName, rQName, rAttrList ) + : XMLTransformerContext::CreateChildContext( + nPrefix, rLocalName, rQName, rAttrList ); + } + else if( aPropTypes[m_eFamily][1] == XML_PROP_TYPE_END ) + { + sal_uInt16 nActionMap = + aAttrActionMaps[aPropTypes[m_eFamily][0]]; + if( nActionMap < MAX_OOO_PROP_ACTIONS ) + { + pContext = new XMLPropertiesOOoTContext_Impl( + GetTransformer(), rQName, + aPropTypes[m_eFamily], m_bPersistent ); + } + else + { + if( m_bPersistent ) + pContext = new XMLPersElemContentTContext( + GetTransformer(), rQName, + XML_NAMESPACE_STYLE, + aPropTokens[aPropTypes[m_eFamily][0]] ); + else + pContext = new XMLRenameElemTransformerContext( + GetTransformer(), rQName, + XML_NAMESPACE_STYLE, + aPropTokens[aPropTypes[m_eFamily][0]] ); + } + } + else + { + pContext = new XMLPropertiesOOoTContext_Impl( + GetTransformer(), rQName, + aPropTypes[m_eFamily], m_bPersistent); + } + + if( m_bPersistent ) + AddContent( pContext ); + } + else + { + pContext = m_bPersistent + ? XMLPersElemContentTContext::CreateChildContext( + nPrefix, rLocalName, rQName, rAttrList ) + : XMLTransformerContext::CreateChildContext( + nPrefix, rLocalName, rQName, rAttrList ); + } + + return pContext; +} + +void XMLStyleOOoTContext::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + XMLTransformerActions *pActions = + GetTransformer().GetUserDefinedActions( OOO_STYLE_ACTIONS ); + OSL_ENSURE( pActions, "go no actions" ); + + Reference< XAttributeList > xAttrList( rAttrList ); + XMLMutableAttributeList *pMutableAttrList = 0; + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + for( sal_Int16 i=0; i < nAttrCount; i++ ) + { + const OUString sAttrName = xAttrList->getNameByIndex( i ); + OUString aLocalName; + sal_uInt16 nPrefix = + GetTransformer().GetNamespaceMap().GetKeyByAttrName( sAttrName, + &aLocalName ); + XMLTransformerActions::key_type aKey( nPrefix, aLocalName ); + XMLTransformerActions::const_iterator aIter = + pActions->find( aKey ); + if( !(aIter == pActions->end() ) ) + { + if( !pMutableAttrList ) + { + pMutableAttrList = + new XMLMutableAttributeList( xAttrList ); + xAttrList = pMutableAttrList; + } + const OUString sAttrValue = xAttrList->getValueByIndex( i ); + switch( (*aIter).second.m_nActionType ) + { + case XML_ATACTION_STYLE_FAMILY: + { + sal_Bool bControl = sal_False; + if( XML_FAMILY_TYPE_END == m_eFamily ) + { + if( IsXMLToken( sAttrValue, XML_GRAPHICS ) ) + m_eFamily = XML_FAMILY_TYPE_GRAPHIC; + else if( IsXMLToken( sAttrValue, XML_PRESENTATION ) ) + m_eFamily = XML_FAMILY_TYPE_PRESENTATION; + else if( IsXMLToken( sAttrValue, XML_DRAWING_PAGE ) ) + m_eFamily = XML_FAMILY_TYPE_DRAWING_PAGE; + else if( IsXMLToken( sAttrValue, XML_TEXT) ) + m_eFamily = XML_FAMILY_TYPE_TEXT; + else if( IsXMLToken( sAttrValue, XML_PARAGRAPH) ) + m_eFamily = XML_FAMILY_TYPE_PARAGRAPH; + else if( IsXMLToken( sAttrValue, XML_RUBY) ) + m_eFamily = XML_FAMILY_TYPE_RUBY; + else if( IsXMLToken( sAttrValue, XML_SECTION) ) + m_eFamily = XML_FAMILY_TYPE_SECTION; + else if( IsXMLToken( sAttrValue, XML_TABLE) ) + m_eFamily = XML_FAMILY_TYPE_TABLE; + else if( IsXMLToken( sAttrValue, XML_TABLE_COLUMN) ) + m_eFamily = XML_FAMILY_TYPE_TABLE_COLUMN; + else if( IsXMLToken( sAttrValue, XML_TABLE_ROW) ) + m_eFamily = XML_FAMILY_TYPE_TABLE_ROW; + else if( IsXMLToken( sAttrValue, XML_TABLE_CELL) ) + m_eFamily = XML_FAMILY_TYPE_TABLE_CELL; + else if( IsXMLToken( sAttrValue, XML_CHART) ) + m_eFamily = XML_FAMILY_TYPE_CHART; + else if( IsXMLToken( sAttrValue, XML_CONTROL) ) + { + m_eFamily = XML_FAMILY_TYPE_PARAGRAPH; + bControl = sal_True; + } + } + if( XML_FAMILY_TYPE_GRAPHIC == m_eFamily ) + { + pMutableAttrList->SetValueByIndex( i, + GetXMLToken( XML_GRAPHIC ) ); + } + else if( bControl ) + { + pMutableAttrList->SetValueByIndex( i, + GetXMLToken( XML_PARAGRAPH ) ); + } + } + break; + case XML_ATACTION_INCH2IN: + { + OUString aAttrValue( sAttrValue ); + if( XMLTransformerBase::ReplaceSingleInchWithIn( + aAttrValue ) ) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_ENCODE_STYLE_NAME: + { + OUString aAttrValue( sAttrValue ); + if( GetTransformer().EncodeStyleName(aAttrValue) ) + { + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + OUString aNewAttrQName( + GetTransformer().GetNamespaceMap(). + GetQNameByKey( + nPrefix, ::xmloff::token::GetXMLToken( + XML_DISPLAY_NAME ) ) ); + pMutableAttrList->AddAttribute( aNewAttrQName, + sAttrValue ); + } + } + break; + case XML_ATACTION_ENCODE_STYLE_NAME_REF: + { + OUString aAttrValue( sAttrValue ); + if( GetTransformer().EncodeStyleName(aAttrValue) ) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_NEG_PERCENT: + { + OUString aAttrValue( sAttrValue ); + if( GetTransformer().NegPercent(aAttrValue) ) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_URI_OOO: + { + OUString aAttrValue( sAttrValue ); + if( GetTransformer().ConvertURIToOASIS( aAttrValue, + static_cast< sal_Bool >((*aIter).second.m_nParam1))) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + default: + OSL_ENSURE( !this, "unknown action" ); + break; + } + } + } + if( XML_FAMILY_TYPE_END == m_eFamily ) + m_eFamily = XML_FAMILY_TYPE_TEXT; + if( m_bPersistent ) + XMLPersElemContentTContext::StartElement( xAttrList ); + else + GetTransformer().GetDocHandler()->startElement( GetExportQName(), + xAttrList ); +} + +void XMLStyleOOoTContext::EndElement() +{ + if( m_bPersistent ) + XMLPersElemContentTContext::EndElement(); + else + GetTransformer().GetDocHandler()->endElement( GetExportQName() ); +} + +void XMLStyleOOoTContext::Characters( const OUString& ) +{ + // element content only: +} + +sal_Bool XMLStyleOOoTContext::IsPersistent() const +{ + return m_bPersistent; +} + +XMLTransformerActions *XMLStyleOOoTContext::CreateTransformerActions( + sal_uInt16 nType ) +{ + XMLTransformerActionInit *pInit = 0; + + switch( nType ) + { + case PROP_OOO_GRAPHIC_ATTR_ACTIONS: + pInit = aGraphicPropertyOOoAttrActionTable; + break; + case PROP_OOO_GRAPHIC_ELEM_ACTIONS: + pInit = aGraphicPropertyOOoElemActionTable; + break; + case PROP_OOO_DRAWING_PAGE_ATTR_ACTIONS: + pInit = aDrawingPagePropertyOOoAttrActionTable; + break; + case PROP_OOO_PAGE_LAYOUT_ATTR_ACTIONS: + pInit = aPageLayoutPropertyOOoAttrActionTable; + break; + case PROP_OOO_HEADER_FOOTER_ATTR_ACTIONS: + pInit = aHeaderFooterPropertyOOoAttrActionTable; + break; + case PROP_OOO_TEXT_ATTR_ACTIONS: + pInit = aTextPropertyOOoAttrActionTable; + break; + case PROP_OOO_TEXT_ELEM_ACTIONS: + pInit = aTextPropertyOOoElemActionTable; + break; + case PROP_OOO_PARAGRAPH_ATTR_ACTIONS: + pInit = aParagraphPropertyOOoAttrActionTable; + break; + case PROP_OOO_PARAGRAPH_ELEM_ACTIONS: + pInit = aParagraphPropertyOOoElemActionTable; + break; + case PROP_OOO_SECTION_ATTR_ACTIONS: + pInit = aSectionPropertyOOoAttrActionTable; + break; + case PROP_OOO_TABLE_ATTR_ACTIONS: + pInit = aTablePropertyOOoAttrActionTable; + break; + case PROP_OOO_TABLE_COLUMN_ATTR_ACTIONS: + pInit = aTableColumnPropertyOOoAttrActionTable; + break; + case PROP_OOO_TABLE_ROW_ATTR_ACTIONS: + pInit = aTableRowPropertyOOoAttrActionTable; + break; + case PROP_OOO_TABLE_CELL_ATTR_ACTIONS: + pInit = aTableCellPropertyOOoAttrActionTable; + break; + case PROP_OOO_TABLE_CELL_ELEM_ACTIONS: + pInit = aTableCellPropertyOOoElemActionTable; + break; + case PROP_OOO_LIST_LEVEL_ATTR_ACTIONS: + pInit = aListLevelPropertyOOoAttrActionTable; + break; + case PROP_OOO_CHART_ATTR_ACTIONS: + pInit = aChartPropertyOOoAttrActionTable; + break; + case PROP_OOO_CHART_ELEM_ACTIONS: + pInit = aChartPropertyOOoElemActionTable; + break; + } + + XMLTransformerActions *pActions = 0; + if( pInit ) + pActions = new XMLTransformerActions( pInit ); + + return pActions; +} diff --git a/xmloff/source/transform/StyleOOoTContext.hxx b/xmloff/source/transform/StyleOOoTContext.hxx new file mode 100644 index 000000000000..d28af6c5fe8e --- /dev/null +++ b/xmloff/source/transform/StyleOOoTContext.hxx @@ -0,0 +1,75 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_STYLEOOOTCONTEXT_HXX +#define _XMLOFF_STYLEOOOTCONTEXT_HXX + +#include <rtl/ref.hxx> +#include "FamilyType.hxx" +#include "DeepTContext.hxx" + + +class XMLTransformerActions; + +class XMLStyleOOoTContext : public XMLPersElemContentTContext +{ + XMLFamilyType m_eFamily; + + sal_Bool m_bPersistent; + +public: + TYPEINFO(); + + XMLStyleOOoTContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName, + XMLFamilyType eType, + sal_Bool bPersistent ); + XMLStyleOOoTContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName, + XMLFamilyType eType, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken, + sal_Bool bPersistent ); + + virtual ~XMLStyleOOoTContext(); + + virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix, + const ::rtl::OUString& rLocalName, + const ::rtl::OUString& rQName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + virtual void EndElement(); + virtual void Characters( const ::rtl::OUString& rChars ); + virtual sal_Bool IsPersistent() const; + + static XMLTransformerActions *CreateTransformerActions( sal_uInt16 nType ); + +}; + +#endif // _XMLOFF_STYLEOOOTCONTEXT_HXX + diff --git a/xmloff/source/transform/TContextVector.hxx b/xmloff/source/transform/TContextVector.hxx new file mode 100644 index 000000000000..f78dd9ce9265 --- /dev/null +++ b/xmloff/source/transform/TContextVector.hxx @@ -0,0 +1,42 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_TCONTEXTVECTOR_HXX +#define _XMLOFF_TCONTEXTVECTOR_HXX + +#include <rtl/ref.hxx> + +#include <vector> +#include "TransformerContext.hxx" + +class XMLTransformerContextVector : + public ::std::vector< ::rtl::Reference< XMLTransformerContext > > +{ +}; + +#endif // _XMLOFF_TCONTEXTVECTOR_HXX + diff --git a/xmloff/source/transform/Transformer.hxx b/xmloff/source/transform/Transformer.hxx new file mode 100644 index 000000000000..6d7524813074 --- /dev/null +++ b/xmloff/source/transform/Transformer.hxx @@ -0,0 +1,45 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_TRANSFORMER_HXX +#define _XMLOFF_TRANSFORMER_HXX + +#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/implbase4.hxx> + +class XMLTransformer : public ::cppu::WeakImplHelper4< + ::com::sun::star::xml::sax::XExtendedDocumentHandler, + ::com::sun::star::lang::XServiceInfo, + ::com::sun::star::lang::XInitialization, + ::com::sun::star::lang::XUnoTunnel> +{ +}; + +#endif // _XMLOFF_TRANSFORMER_HXX diff --git a/xmloff/source/transform/TransformerAction.hxx b/xmloff/source/transform/TransformerAction.hxx new file mode 100644 index 000000000000..d8e1411e8420 --- /dev/null +++ b/xmloff/source/transform/TransformerAction.hxx @@ -0,0 +1,35 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_TRANSFORMERACTION_HXX +#define _XMLOFF_TRANSFORMERACTION_HXX + +#define XML_TACTION_EOT 0x0000 +#define XML_TACTION_END 0xffff + + +#endif // _XMLOFF_TRANSFORMERACTION_HXX diff --git a/xmloff/source/transform/TransformerActionInit.hxx b/xmloff/source/transform/TransformerActionInit.hxx new file mode 100644 index 000000000000..6c551521b382 --- /dev/null +++ b/xmloff/source/transform/TransformerActionInit.hxx @@ -0,0 +1,51 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_TRANSFORMERACTIONINIT_HXX +#define _XMLOFF_TRANSFORMERACTIONINIT_HXX + +#include <xmloff/xmltoken.hxx> + + +struct XMLTransformerActionInit +{ + sal_uInt16 m_nPrefix; + ::xmloff::token::XMLTokenEnum m_eLocalName; + sal_uInt32 m_nActionType; + sal_uInt32 m_nParam1; + sal_uInt32 m_nParam2; + sal_uInt32 m_nParam3; + + static sal_Int32 QNameParam( sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eLocalName ) + { + return (static_cast< sal_uInt32 >( nPrefix ) << 16) + + static_cast< sal_uInt32 >( eLocalName ); + } +}; + +#endif // _XMLOFF_TRANSFORMERACTIONINIT_HXX diff --git a/xmloff/source/transform/TransformerActions.cxx b/xmloff/source/transform/TransformerActions.cxx new file mode 100644 index 000000000000..c14e6a33038b --- /dev/null +++ b/xmloff/source/transform/TransformerActions.cxx @@ -0,0 +1,92 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" +#include "TransformerActions.hxx" + + +using ::rtl::OUString; + +using namespace ::osl; +using namespace ::xmloff::token; +using namespace ::com::sun::star::uno; + +XMLTransformerActions::XMLTransformerActions( XMLTransformerActionInit *pInit ) +{ + if( pInit ) + { + XMLTransformerActions::key_type aKey; + XMLTransformerActions::data_type aData; + while( pInit->m_nActionType != XML_TACTION_EOT ) + { + aKey.m_nPrefix = pInit->m_nPrefix; + aKey.SetLocalName( pInit->m_eLocalName ); + + OSL_ENSURE( find( aKey ) == end(), "duplicate action map entry" ); + + aData.m_nActionType = pInit->m_nActionType; + aData.m_nParam1 = pInit->m_nParam1; + aData.m_nParam2 = pInit->m_nParam2; + aData.m_nParam3 = pInit->m_nParam3; + XMLTransformerActions::value_type aVal( aKey, aData ); + + insert( aVal ); + ++pInit; + } + } +} + +XMLTransformerActions::~XMLTransformerActions() +{ +} + +void XMLTransformerActions::Add( XMLTransformerActionInit *pInit ) +{ + if( pInit ) + { + XMLTransformerActions::key_type aKey; + XMLTransformerActions::data_type aData; + while( pInit->m_nActionType != XML_TACTION_EOT ) + { + aKey.m_nPrefix = pInit->m_nPrefix; + aKey.SetLocalName( pInit->m_eLocalName ); + XMLTransformerActions::iterator aIter = find( aKey ); + if( aIter == end() ) + { + aData.m_nActionType = pInit->m_nActionType; + aData.m_nParam1 = pInit->m_nParam1; + aData.m_nParam2 = pInit->m_nParam2; + aData.m_nParam3 = pInit->m_nParam3; + XMLTransformerActions::value_type aVal( aKey, aData ); + insert( aVal ); + } + + ++pInit; + } + } +} diff --git a/xmloff/source/transform/TransformerActions.hxx b/xmloff/source/transform/TransformerActions.hxx new file mode 100644 index 000000000000..e542d8222cfe --- /dev/null +++ b/xmloff/source/transform/TransformerActions.hxx @@ -0,0 +1,161 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_TRANSFORMERACTIONS_HXX +#define _XMLOFF_TRANSFORMERACTIONS_HXX + +#include <rtl/ustring.hxx> +#include <xmloff/nmspmap.hxx> + +#include <hash_map> +#include "TransformerActionInit.hxx" +#include "TransformerAction.hxx" + +struct NameKey_Impl +{ + sal_uInt16 m_nPrefix; + ::rtl::OUString m_aLocalName; + + inline NameKey_Impl( sal_uInt16 nPrfx, + ::xmloff::token::XMLTokenEnum eLclNm ) : + m_nPrefix( nPrfx ), + m_aLocalName( ::xmloff::token::GetXMLToken( eLclNm ) ) + { + } + + inline NameKey_Impl( sal_uInt16 nPrfx, const ::rtl::OUString& rLclNm ) : + m_nPrefix( nPrfx ), + m_aLocalName( rLclNm ) + { + } + + inline NameKey_Impl() : + m_nPrefix( XML_NAMESPACE_UNKNOWN ) + { + } + + inline void SetLocalName( ::xmloff::token::XMLTokenEnum eLclNm ) + { + m_aLocalName = ::xmloff::token::GetXMLToken( eLclNm ); + } +}; + +// ----------------------------------------------------------------------------- + +struct NameHash_Impl +{ + inline size_t operator()( const NameKey_Impl& r ) const; + inline bool operator()( const NameKey_Impl& r1, + const NameKey_Impl& r2 ) const; +}; + +inline size_t NameHash_Impl::operator()( const NameKey_Impl& r ) const +{ + return static_cast< size_t >( r.m_nPrefix ) + + static_cast< size_t >( r.m_aLocalName.hashCode() ); +} + +inline bool NameHash_Impl::operator()( + const NameKey_Impl& r1, + const NameKey_Impl& r2 ) const +{ + return r1.m_nPrefix == r2.m_nPrefix && r1.m_aLocalName == r2.m_aLocalName; +} + +// ----------------------------------------------------------------------------- + +struct TransformerAction_Impl +{ + sal_uInt32 m_nActionType; + sal_uInt32 m_nParam1; + sal_uInt32 m_nParam2; + sal_uInt32 m_nParam3; + + inline TransformerAction_Impl( sal_uInt32 nActnTp, sal_uInt32 nPrm1, + sal_uInt32 nPrm2, sal_uInt32 nPrm3 ) : + m_nActionType( nActnTp ), + m_nParam1( nPrm1 ), + m_nParam2( nPrm2 ), + m_nParam3( nPrm3 ) + { + + } + inline TransformerAction_Impl() : + m_nActionType( XML_TACTION_EOT ), + m_nParam1( 0 ), + m_nParam2( 0 ), + m_nParam3( 0 ) + { + } + + sal_uInt16 GetQNamePrefixFromParam1() const + { + return static_cast< sal_uInt16 >( m_nParam1 >> 16 ); + } + + sal_uInt16 GetQNamePrefixFromParam2() const + { + return static_cast< sal_uInt16 >( m_nParam2 >> 16 ); + } + + sal_uInt16 GetQNamePrefixFromParam3() const + { + return static_cast< sal_uInt16 >( m_nParam3 >> 16 ); + } + + ::xmloff::token::XMLTokenEnum GetQNameTokenFromParam1() const + { + return static_cast< ::xmloff::token::XMLTokenEnum>( m_nParam1 & 0xffff ); + } + + ::xmloff::token::XMLTokenEnum GetQNameTokenFromParam2() const + { + return static_cast< ::xmloff::token::XMLTokenEnum>( m_nParam2 & 0xffff ); + } + + ::xmloff::token::XMLTokenEnum GetQNameTokenFromParam3() const + { + return static_cast< ::xmloff::token::XMLTokenEnum>( m_nParam3 & 0xffff ); + } + +}; + + +// ----------------------------------------------------------------------------- + +class XMLTransformerActions : + public ::std::hash_map< NameKey_Impl, TransformerAction_Impl, + NameHash_Impl, NameHash_Impl > +{ +public: + XMLTransformerActions( XMLTransformerActionInit *pInit ); + ~XMLTransformerActions(); + + void Add( XMLTransformerActionInit *pInit ); +}; + +#endif // _XMLOFF_TRANSFORMERACTIONS_HXX diff --git a/xmloff/source/transform/TransformerBase.cxx b/xmloff/source/transform/TransformerBase.cxx new file mode 100644 index 000000000000..61bb73120da6 --- /dev/null +++ b/xmloff/source/transform/TransformerBase.cxx @@ -0,0 +1,1489 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" +#include <rtl/ref.hxx> +#include <rtl/ustrbuf.hxx> +#include <com/sun/star/i18n/XCharacterClassification.hpp> +#include <com/sun/star/i18n/UnicodeType.hpp> +#include <comphelper/processfactory.hxx> +#include <xmloff/nmspmap.hxx> +#include "xmloff/xmlnmspe.hxx" +#include "IgnoreTContext.hxx" +#include "RenameElemTContext.hxx" +#include "ProcAttrTContext.hxx" +#include "ProcAddAttrTContext.hxx" +#include "MergeElemTContext.hxx" +#include "CreateElemTContext.hxx" +#include "MutableAttrList.hxx" +#include "TransformerActions.hxx" +#include "ElemTransformerAction.hxx" +// --> OD 2005-06-29 #i50322# +#include "PropertyActionsOOo.hxx" +// <-- +#ifndef _XMLOFF_TRANSFORMERTOKENMAP_HXX +#include "TransformerTokenMap.hxx" +#endif +#include <xmloff/xmluconv.hxx> + +#ifndef _XMLOFF_TRANSFORMERBASE_HXX +#include "TransformerBase.hxx" +#endif +#include "TContextVector.hxx" + +using ::rtl::OUString; +using ::rtl::OUStringBuffer; +using namespace ::osl; +using namespace ::xmloff::token; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::i18n; +using namespace ::com::sun::star::xml::sax; + +// ----------------------------------------------------------------------------- + +namespace +{ +bool lcl_ConvertAttr( OUString & rOutAttribute, sal_Int32 nParam ) +{ + bool bResult = false; + enum XMLTokenEnum eTokenToRename = + static_cast< enum XMLTokenEnum >( nParam & 0xffff ); + if( eTokenToRename != XML_TOKEN_INVALID && + IsXMLToken( rOutAttribute, eTokenToRename )) + { + enum XMLTokenEnum eReplacementToken = + static_cast< enum XMLTokenEnum >( nParam >> 16 ); + rOutAttribute = GetXMLToken( eReplacementToken ); + bResult = true; + } + return bResult; +} +} // anonymous namespace + +// ----------------------------------------------------------------------------- + +XMLTransformerContext *XMLTransformerBase::CreateContext( sal_uInt16 nPrefix, + const OUString& rLocalName, const OUString& rQName ) +{ + XMLTransformerActions::key_type aKey( nPrefix, rLocalName ); + XMLTransformerActions::const_iterator aIter = + GetElemActions().find( aKey ); + + if( !(aIter == GetElemActions().end()) ) + { + sal_uInt32 nActionType = (*aIter).second.m_nActionType; + if( (nActionType & XML_ETACTION_USER_DEFINED) != 0 ) + { + XMLTransformerContext *pContext = + CreateUserDefinedContext( (*aIter).second, + rQName ); + OSL_ENSURE( pContext && !pContext->IsPersistent(), + "unknown or not persistent action" ); + return pContext; + } + + switch( nActionType ) + { + case XML_ETACTION_COPY_CONTENT: + return new XMLIgnoreTransformerContext( *this, rQName, sal_False, + sal_False ); + case XML_ETACTION_COPY: + return new XMLTransformerContext( *this, rQName ); + case XML_ETACTION_RENAME_ELEM: + return new XMLRenameElemTransformerContext( *this, rQName, + (*aIter).second.GetQNamePrefixFromParam1(), + (*aIter).second.GetQNameTokenFromParam1() ); + case XML_ETACTION_RENAME_ELEM_ADD_ATTR: + return new XMLRenameElemTransformerContext( *this, rQName, + (*aIter).second.GetQNamePrefixFromParam1(), + (*aIter).second.GetQNameTokenFromParam1(), + (*aIter).second.GetQNamePrefixFromParam2(), + (*aIter).second.GetQNameTokenFromParam2(), + static_cast< XMLTokenEnum >( (*aIter).second.m_nParam3 ) ); + case XML_ETACTION_RENAME_ELEM_PROC_ATTRS: + return new XMLProcAttrTransformerContext( *this, rQName, + (*aIter).second.GetQNamePrefixFromParam1(), + (*aIter).second.GetQNameTokenFromParam1(), + static_cast< sal_uInt16 >( (*aIter).second.m_nParam2 ) ); + case XML_ETACTION_RENAME_ELEM_ADD_PROC_ATTR: + return new XMLProcAddAttrTransformerContext( *this, rQName, + (*aIter).second.GetQNamePrefixFromParam1(), + (*aIter).second.GetQNameTokenFromParam1(), + static_cast< sal_uInt16 >( + (*aIter).second.m_nParam3 >> 16 ), + (*aIter).second.GetQNamePrefixFromParam2(), + (*aIter).second.GetQNameTokenFromParam2(), + static_cast< XMLTokenEnum >( + (*aIter).second.m_nParam3 & 0xffff ) ); + case XML_ETACTION_RENAME_ELEM_COND: + { + const XMLTransformerContext *pCurrent = GetCurrentContext(); + if( pCurrent->HasQName( + (*aIter).second.GetQNamePrefixFromParam2(), + (*aIter).second.GetQNameTokenFromParam2() ) ) + return new XMLRenameElemTransformerContext( *this, rQName, + (*aIter).second.GetQNamePrefixFromParam1(), + (*aIter).second.GetQNameTokenFromParam1() ); + } + break; + case XML_ETACTION_RENAME_ELEM_PROC_ATTRS_COND: + { + const XMLTransformerContext *pCurrent = GetCurrentContext(); + if( pCurrent->HasQName( + (*aIter).second.GetQNamePrefixFromParam3(), + (*aIter).second.GetQNameTokenFromParam3() ) ) + return new XMLProcAttrTransformerContext( *this, rQName, + (*aIter).second.GetQNamePrefixFromParam1(), + (*aIter).second.GetQNameTokenFromParam1(), + static_cast< sal_uInt16 >( (*aIter).second.m_nParam2 ) ); + else + return new XMLProcAttrTransformerContext( *this, rQName, + static_cast< sal_uInt16 >( (*aIter).second.m_nParam2 ) ); + } + case XML_ETACTION_PROC_ATTRS: + return new XMLProcAttrTransformerContext( *this, rQName, + static_cast< sal_uInt16 >( (*aIter).second.m_nParam1 ) ); + case XML_ETACTION_PROC_ATTRS_COND: + { + const XMLTransformerContext *pCurrent = GetCurrentContext(); + if( pCurrent->HasQName( + (*aIter).second.GetQNamePrefixFromParam1(), + (*aIter).second.GetQNameTokenFromParam1() ) ) + return new XMLProcAttrTransformerContext( *this, rQName, + static_cast< sal_uInt16 >( (*aIter).second.m_nParam2 ) ); + } + break; + case XML_ETACTION_MOVE_ATTRS_TO_ELEMS: + return new XMLCreateElemTransformerContext( *this, rQName, + static_cast< sal_uInt16 >( (*aIter).second.m_nParam1 ) ); + case XML_ETACTION_MOVE_ELEMS_TO_ATTRS: + return new XMLMergeElemTransformerContext( *this, rQName, + static_cast< sal_uInt16 >( (*aIter).second.m_nParam1 ) ); + default: + OSL_ENSURE( !this, "unknown action" ); + break; + } + } + + // default is copying + return new XMLTransformerContext( *this, rQName ); +} + +XMLTransformerActions *XMLTransformerBase::GetUserDefinedActions( sal_uInt16 ) +{ + return 0; +} + +XMLTransformerBase::XMLTransformerBase( XMLTransformerActionInit *pInit, + ::xmloff::token::XMLTokenEnum *pTKMapInit ) + throw () : + m_pNamespaceMap( new SvXMLNamespaceMap ), + m_pReplaceNamespaceMap( new SvXMLNamespaceMap ), + m_pContexts( new XMLTransformerContextVector ), + m_pElemActions( new XMLTransformerActions( pInit ) ), + m_pTokenMap( new XMLTransformerTokenMap( pTKMapInit ) ) +{ + GetNamespaceMap().Add( GetXMLToken(XML_NP_XLINK), GetXMLToken(XML_N_XLINK), XML_NAMESPACE_XLINK ); + GetNamespaceMap().Add( GetXMLToken(XML_NP_DC), GetXMLToken(XML_N_DC), XML_NAMESPACE_DC ); + GetNamespaceMap().Add( GetXMLToken(XML_NP_MATH), GetXMLToken(XML_N_MATH), XML_NAMESPACE_MATH ); + GetNamespaceMap().Add( GetXMLToken(XML_NP_OOO), GetXMLToken(XML_N_OOO), XML_NAMESPACE_OOO ); + GetNamespaceMap().Add( GetXMLToken(XML_NP_DOM), GetXMLToken(XML_N_DOM), XML_NAMESPACE_DOM ); + GetNamespaceMap().Add( GetXMLToken(XML_NP_OOOW), GetXMLToken(XML_N_OOOW), XML_NAMESPACE_OOOW ); + GetNamespaceMap().Add( GetXMLToken(XML_NP_OOOC), GetXMLToken(XML_N_OOOC), XML_NAMESPACE_OOOC ); +} + +XMLTransformerBase::~XMLTransformerBase() throw () +{ + ResetTokens(); + + delete m_pNamespaceMap; + delete m_pReplaceNamespaceMap; + delete m_pContexts; + delete m_pElemActions; + delete m_pTokenMap; +} + +void SAL_CALL XMLTransformerBase::startDocument( void ) + throw( SAXException, RuntimeException ) +{ + m_xHandler->startDocument(); +} + +void SAL_CALL XMLTransformerBase::endDocument( void ) + throw( SAXException, RuntimeException) +{ + m_xHandler->endDocument(); +} + +void SAL_CALL XMLTransformerBase::startElement( const OUString& rName, + const Reference< XAttributeList >& rAttrList ) + throw(SAXException, RuntimeException) +{ + SvXMLNamespaceMap *pRewindMap = 0; + + // Process namespace attributes. This must happen before creating the + // context, because namespace decaration apply to the element name itself. + XMLMutableAttributeList *pMutableAttrList = 0; + Reference< XAttributeList > xAttrList( rAttrList ); + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + for( sal_Int16 i=0; i < nAttrCount; i++ ) + { + const OUString& rAttrName = xAttrList->getNameByIndex( i ); + if( ( rAttrName.getLength() >= 5 ) && + ( rAttrName.compareTo( GetXMLToken(XML_XMLNS), 5 ) == 0 ) && + ( rAttrName.getLength() == 5 || ':' == rAttrName[5] ) ) + { + if( !pRewindMap ) + { + pRewindMap = m_pNamespaceMap; + m_pNamespaceMap = new SvXMLNamespaceMap( *m_pNamespaceMap ); + } + const OUString& rAttrValue = xAttrList->getValueByIndex( i ); + + OUString aPrefix( ( rAttrName.getLength() == 5 ) + ? OUString() + : rAttrName.copy( 6 ) ); + // Add namespace, but only if it is known. + sal_uInt16 nKey = m_pNamespaceMap->AddIfKnown( aPrefix, rAttrValue ); + // If namespace is unknwon, try to match a name with similar + // TC Id an version + if( XML_NAMESPACE_UNKNOWN == nKey ) + { + OUString aTestName( rAttrValue ); + if( SvXMLNamespaceMap::NormalizeOasisURN( aTestName ) ) + nKey = m_pNamespaceMap->AddIfKnown( aPrefix, aTestName ); + } + // If that namespace is not known, too, add it as unknown + if( XML_NAMESPACE_UNKNOWN == nKey ) + nKey = m_pNamespaceMap->Add( aPrefix, rAttrValue ); + + const OUString& rRepName = m_pReplaceNamespaceMap->GetNameByKey( nKey ); + if( rRepName.getLength() ) + { + if( !pMutableAttrList ) + { + pMutableAttrList = new XMLMutableAttributeList( xAttrList ); + xAttrList = pMutableAttrList; + } + + pMutableAttrList->SetValueByIndex( i, rRepName ); + } + } + } + + // Get element's namespace and local name. + OUString aLocalName; + sal_uInt16 nPrefix = + m_pNamespaceMap->GetKeyByAttrName( rName, &aLocalName ); + + // If there are contexts already, call a CreateChildContext at the topmost + // context. Otherwise, create a default context. + ::rtl::Reference < XMLTransformerContext > xContext; + if( !m_pContexts->empty() ) + { + xContext = m_pContexts->back()->CreateChildContext( nPrefix, + aLocalName, + rName, + xAttrList ); + } + else + { + xContext = CreateContext( nPrefix, aLocalName, rName ); + } + + OSL_ENSURE( xContext.is(), "XMLTransformerBase::startElement: missing context" ); + if( !xContext.is() ) + xContext = new XMLTransformerContext( *this, rName ); + + // Remeber old namespace map. + if( pRewindMap ) + xContext->SetRewindMap( pRewindMap ); + + // Push context on stack. + m_pContexts->push_back( xContext ); + + // Call a startElement at the new context. + xContext->StartElement( xAttrList ); +} + +void SAL_CALL XMLTransformerBase::endElement( const OUString& +#ifdef DBG_UTIL +rName +#endif +) + throw(SAXException, RuntimeException) +{ + if( !m_pContexts->empty() ) + { + // Get topmost context + ::rtl::Reference< XMLTransformerContext > xContext = m_pContexts->back(); + +#ifdef DBG_UTIL + OSL_ENSURE( xContext->GetQName() == rName, + "XMLTransformerBase::endElement: popped context has wrong lname" ); +#endif + + // Call a EndElement at the current context. + xContext->EndElement(); + + // and remove it from the stack. + m_pContexts->pop_back(); + + // Get a namespace map to rewind. + SvXMLNamespaceMap *pRewindMap = xContext->GetRewindMap(); + + // Delete the current context. + xContext = 0; + + // Rewind a namespace map. + if( pRewindMap ) + { + delete m_pNamespaceMap; + m_pNamespaceMap = pRewindMap; + } + } +} + +void SAL_CALL XMLTransformerBase::characters( const OUString& rChars ) + throw(SAXException, RuntimeException) +{ + if( !m_pContexts->empty() ) + { + m_pContexts->back()->Characters( rChars ); + } +} + +void SAL_CALL XMLTransformerBase::ignorableWhitespace( const OUString& rWhitespaces ) + throw(SAXException, RuntimeException) +{ + m_xHandler->ignorableWhitespace( rWhitespaces ); +} + +void SAL_CALL XMLTransformerBase::processingInstruction( const OUString& rTarget, + const OUString& rData ) + throw(SAXException, RuntimeException) +{ + m_xHandler->processingInstruction( rTarget, rData ); +} + +void SAL_CALL XMLTransformerBase::setDocumentLocator( const Reference< XLocator >& rLocator ) + throw(SAXException, RuntimeException) +{ + m_xLocator = rLocator; +} + +// XExtendedDocumentHandler +void SAL_CALL XMLTransformerBase::startCDATA( void ) throw(SAXException, RuntimeException) +{ + if( m_xExtHandler.is() ) + m_xExtHandler->startCDATA(); +} + +void SAL_CALL XMLTransformerBase::endCDATA( void ) throw(RuntimeException) +{ + if( m_xExtHandler.is() ) + m_xExtHandler->endCDATA(); +} + +void SAL_CALL XMLTransformerBase::comment( const OUString& rComment ) + throw(SAXException, RuntimeException) +{ + if( m_xExtHandler.is() ) + m_xExtHandler->comment( rComment ); +} + +void SAL_CALL XMLTransformerBase::allowLineBreak( void ) + throw(SAXException, RuntimeException) +{ + if( m_xExtHandler.is() ) + m_xExtHandler->allowLineBreak(); +} + +void SAL_CALL XMLTransformerBase::unknown( const OUString& rString ) + throw(SAXException, RuntimeException) +{ + if( m_xExtHandler.is() ) + m_xExtHandler->unknown( rString ); +} + +// XInitialize +void SAL_CALL XMLTransformerBase::initialize( const Sequence< Any >& aArguments ) + throw(Exception, RuntimeException) +{ + const sal_Int32 nAnyCount = aArguments.getLength(); + const Any* pAny = aArguments.getConstArray(); + + for( sal_Int32 nIndex = 0; nIndex < nAnyCount; nIndex++, pAny++ ) + { + // #b6236750# use isAssignableFrom instead of comparing the types to + // allow XExtendedDocumentHandler instead of XDocumentHandler (used in + // writeOasis2OOoLibraryElement in sfx2). + // The Any shift operator can't be used to query the type because it + // uses queryInterface, and the model also has a XPropertySet interface. + + // document handler + if( ::getCppuType( (const Reference< XDocumentHandler >*) 0 ).isAssignableFrom( pAny->getValueType() ) ) + m_xHandler.set( *pAny, UNO_QUERY ); + + // property set to transport data across + if( ::getCppuType( (const Reference< XPropertySet >*) 0 ).isAssignableFrom( pAny->getValueType() ) ) + m_xPropSet.set( *pAny, UNO_QUERY ); + + // xmodel + if( ::getCppuType( (const Reference< ::com::sun::star::frame::XModel >*) 0 ).isAssignableFrom( pAny->getValueType() ) ) + mxModel.set( *pAny, UNO_QUERY ); + } + + if( m_xPropSet.is() ) + { + Any aAny; + OUString sRelPath, sName; + Reference< XPropertySetInfo > xPropSetInfo = + m_xPropSet->getPropertySetInfo(); + OUString sPropName( RTL_CONSTASCII_USTRINGPARAM("StreamRelPath" ) ); + if( xPropSetInfo->hasPropertyByName(sPropName) ) + { + aAny = m_xPropSet->getPropertyValue(sPropName); + aAny >>= sRelPath; + } + sPropName = OUString( RTL_CONSTASCII_USTRINGPARAM("StreamName" ) ); + if( xPropSetInfo->hasPropertyByName(sPropName) ) + { + aAny = m_xPropSet->getPropertyValue(sPropName); + aAny >>= sName; + } + if( sName.getLength() ) + { + m_aExtPathPrefix = OUString( RTL_CONSTASCII_USTRINGPARAM("../" ) ); + + // If there is a rel path within a package, then append + // additional '../'. If the rel path contains an ':', then it is + // an absolute URI (or invalid URI, because zip files don't + // permit ':'), and it will be ignored. + if( sRelPath.getLength() ) + { + sal_Int32 nColPos = sRelPath.indexOf( ':' ); + OSL_ENSURE( -1 == nColPos, + "StreamRelPath contains ':', absolute URI?" ); + + if( -1 == nColPos ) + { + OUString sTmp = m_aExtPathPrefix; + sal_Int32 nPos = 0; + do + { + m_aExtPathPrefix += sTmp; + nPos = sRelPath.indexOf( '/', nPos + 1 ); + } + while( -1 != nPos ); + } + } + + } + } +} + +static MapUnit lcl_getUnit( const OUString& rValue ) +{ + MapUnit nDestUnit; + if( rValue.endsWithIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "cm" ) ) ) + nDestUnit = MAP_CM; + else if ( rValue.endsWithIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "mm" ) ) ) + nDestUnit = MAP_MM; + else + nDestUnit = MAP_INCH; + return nDestUnit; +} + +XMLMutableAttributeList *XMLTransformerBase::ProcessAttrList( + Reference< XAttributeList >& rAttrList, sal_uInt16 nActionMap, + sal_Bool bClone ) +{ + XMLMutableAttributeList *pMutableAttrList = 0; + XMLTransformerActions *pActions = GetUserDefinedActions( nActionMap ); + OSL_ENSURE( pActions, "go no actions" ); + if( pActions ) + { + sal_Int16 nAttrCount = rAttrList.is() ? rAttrList->getLength() : 0; + for( sal_Int16 i=0; i < nAttrCount; ++i ) + { + const OUString& rAttrName = rAttrList->getNameByIndex( i ); + const OUString& rAttrValue = rAttrList->getValueByIndex( i ); + OUString aLocalName; + sal_uInt16 nPrefix = GetNamespaceMap().GetKeyByAttrName( rAttrName, + &aLocalName ); + + XMLTransformerActions::key_type aKey( nPrefix, aLocalName ); + XMLTransformerActions::const_iterator aIter = + pActions->find( aKey ); + if( !(aIter == pActions->end() ) ) + { + if( !pMutableAttrList ) + { + pMutableAttrList = new XMLMutableAttributeList( rAttrList, + bClone ); + rAttrList = pMutableAttrList; + } + + sal_uInt32 nAction = (*aIter).second.m_nActionType; + sal_Bool bRename = sal_False; + switch( nAction ) + { + case XML_ATACTION_RENAME: + bRename = sal_True; + break; + case XML_ATACTION_COPY: + break; + case XML_ATACTION_REMOVE: + case XML_ATACTION_STYLE_DISPLAY_NAME: + pMutableAttrList->RemoveAttributeByIndex( i ); + --i; + --nAttrCount; + break; + case XML_ATACTION_RENAME_IN2INCH: + bRename = sal_True; + case XML_ATACTION_IN2INCH: + { + OUString aAttrValue( rAttrValue ); + if( ReplaceSingleInWithInch( aAttrValue ) ) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_INS2INCHS: + { + OUString aAttrValue( rAttrValue ); + if( ReplaceInWithInch( aAttrValue ) ) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_RENAME_INCH2IN: + bRename = sal_True; + case XML_ATACTION_INCH2IN: + { + OUString aAttrValue( rAttrValue ); + if( ReplaceSingleInchWithIn( aAttrValue ) ) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_INCHS2INS: + { + OUString aAttrValue( rAttrValue ); + if( ReplaceInchWithIn( aAttrValue ) ) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_TWIPS2IN: + { + OUString aAttrValue( rAttrValue ); + + XMLTransformerBase::ReplaceSingleInchWithIn( aAttrValue ); + if( isWriter() ) + { + MapUnit nDestUnit = lcl_getUnit( aAttrValue ); + + // convert twips value to inch + sal_Int32 nMeasure; + if( SvXMLUnitConverter::convertMeasure(nMeasure, aAttrValue, MAP_100TH_MM ) ) + { + + // --> OD 2004-10-29 #i13778#,#i36248# + // apply correct twip-to-1/100mm + nMeasure = (sal_Int32)( nMeasure >= 0 + ? ((nMeasure*127+36)/72) + : ((nMeasure*127-36)/72) ); + // <-- + + rtl::OUStringBuffer aBuffer; + SvXMLUnitConverter::convertMeasure( aBuffer, nMeasure, MAP_100TH_MM, nDestUnit ); + aAttrValue = aBuffer.makeStringAndClear(); + } + } + + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_RENAME_DECODE_STYLE_NAME_REF: + bRename = sal_True; + case XML_ATACTION_DECODE_STYLE_NAME: + case XML_ATACTION_DECODE_STYLE_NAME_REF: + { + OUString aAttrValue( rAttrValue ); + if( DecodeStyleName(aAttrValue) ) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_ENCODE_STYLE_NAME: + { + OUString aAttrValue( rAttrValue ); + if( EncodeStyleName(aAttrValue) ) + { + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + OUString aNewAttrQName( + GetNamespaceMap().GetQNameByKey( + nPrefix, + ::xmloff::token::GetXMLToken( + XML_DISPLAY_NAME ) ) ); + pMutableAttrList->AddAttribute( aNewAttrQName, + rAttrValue ); + } + } + break; + case XML_ATACTION_RENAME_ENCODE_STYLE_NAME_REF: + bRename = sal_True; + case XML_ATACTION_ENCODE_STYLE_NAME_REF: + { + OUString aAttrValue( rAttrValue ); + if( EncodeStyleName(aAttrValue) ) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_RENAME_NEG_PERCENT: + bRename = sal_True; + case XML_ATACTION_NEG_PERCENT: + { + OUString aAttrValue( rAttrValue ); + if( NegPercent( aAttrValue ) ) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_RENAME_ADD_NAMESPACE_PREFIX: + bRename = sal_True; + case XML_ATACTION_ADD_NAMESPACE_PREFIX: + { + OUString aAttrValue( rAttrValue ); + sal_uInt16 nValPrefix = + static_cast<sal_uInt16>( + bRename ? (*aIter).second.m_nParam2 + : (*aIter).second.m_nParam1); + if( AddNamespacePrefix( aAttrValue, nValPrefix ) ) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_ADD_APP_NAMESPACE_PREFIX: + { + OUString aAttrValue( rAttrValue ); + sal_uInt16 nValPrefix = + static_cast<sal_uInt16>((*aIter).second.m_nParam1); + if( IsXMLToken( GetClass(), XML_SPREADSHEET ) ) + nValPrefix = XML_NAMESPACE_OOOC; + else if( IsXMLToken( GetClass(), XML_TEXT ) ) + nValPrefix = XML_NAMESPACE_OOOW; + if( AddNamespacePrefix( aAttrValue, nValPrefix ) ) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_RENAME_REMOVE_NAMESPACE_PREFIX: + bRename = sal_True; + case XML_ATACTION_REMOVE_NAMESPACE_PREFIX: + { + OUString aAttrValue( rAttrValue ); + sal_uInt16 nValPrefix = + static_cast<sal_uInt16>( + bRename ? (*aIter).second.m_nParam2 + : (*aIter).second.m_nParam1); + if( RemoveNamespacePrefix( aAttrValue, nValPrefix ) ) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_REMOVE_ANY_NAMESPACE_PREFIX: + { + OUString aAttrValue( rAttrValue ); + if( RemoveNamespacePrefix( aAttrValue ) ) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_URI_OOO: + { + OUString aAttrValue( rAttrValue ); + if( ConvertURIToOASIS( aAttrValue, + static_cast< sal_Bool >((*aIter).second.m_nParam1))) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_URI_OASIS: + { + OUString aAttrValue( rAttrValue ); + if( ConvertURIToOOo( aAttrValue, + static_cast< sal_Bool >((*aIter).second.m_nParam1))) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_RENAME_ATTRIBUTE: + { + OUString aAttrValue( rAttrValue ); + RenameAttributeValue( + aAttrValue, + (*aIter).second.m_nParam1, + (*aIter).second.m_nParam2, + (*aIter).second.m_nParam3 ); + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_RNG2ISO_DATETIME: + { + OUString aAttrValue( rAttrValue ); + if( ConvertRNGDateTimeToISO( aAttrValue )) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_RENAME_RNG2ISO_DATETIME: + { + OUString aAttrValue( rAttrValue ); + if( ConvertRNGDateTimeToISO( aAttrValue )) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + bRename = sal_True; + } + break; + case XML_ATACTION_IN2TWIPS: + { + OUString aAttrValue( rAttrValue ); + XMLTransformerBase::ReplaceSingleInWithInch( aAttrValue ); + + if( isWriter() ) + { + MapUnit nDestUnit = lcl_getUnit( aAttrValue ); + + // convert inch value to twips and export as faked inch + sal_Int32 nMeasure; + if( SvXMLUnitConverter::convertMeasure(nMeasure, aAttrValue, MAP_100TH_MM ) ) + { + + // --> OD 2004-10-29 #i13778#,#i36248# + // apply correct 1/100mm-to-twip conversion + nMeasure = (sal_Int32)( nMeasure >= 0 + ? ((nMeasure*72+63)/127) + : ((nMeasure*72-63)/127) ); + // <-- + + OUStringBuffer aBuffer; + SvXMLUnitConverter::convertMeasure( aBuffer, nMeasure, MAP_100TH_MM, nDestUnit ); + aAttrValue = aBuffer.makeStringAndClear(); + } + } + + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_SVG_WIDTH_HEIGHT_OOO: + { + OUString aAttrValue( rAttrValue ); + ReplaceSingleInchWithIn( aAttrValue ); + + MapUnit nDestUnit = lcl_getUnit( aAttrValue ); + + sal_Int32 nMeasure; + if( SvXMLUnitConverter::convertMeasure(nMeasure, aAttrValue, MAP_100TH_MM ) ) + { + + if( nMeasure > 0 ) + nMeasure -= 1; + else if( nMeasure < 0 ) + nMeasure += 1; + + + OUStringBuffer aBuffer; + SvXMLUnitConverter::convertMeasure( aBuffer, nMeasure, MAP_100TH_MM, nDestUnit ); + aAttrValue = aBuffer.makeStringAndClear(); + } + + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_SVG_WIDTH_HEIGHT_OASIS: + { + OUString aAttrValue( rAttrValue ); + ReplaceSingleInWithInch( aAttrValue ); + + MapUnit nDestUnit = lcl_getUnit( aAttrValue ); + + sal_Int32 nMeasure; + if( SvXMLUnitConverter::convertMeasure(nMeasure, aAttrValue, MAP_100TH_MM ) ) + { + + if( nMeasure > 0 ) + nMeasure += 1; + else if( nMeasure < 0 ) + nMeasure -= 1; + + + OUStringBuffer aBuffer; + SvXMLUnitConverter::convertMeasure( aBuffer, nMeasure, MAP_100TH_MM, nDestUnit ); + aAttrValue = aBuffer.makeStringAndClear(); + } + + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_DECODE_ID: + { + OUString aAttrValue; + + const sal_Int32 nLen = rAttrValue.getLength(); + OUStringBuffer aBuffer; + + sal_Int32 pos; + for( pos = 0; pos < nLen; pos++ ) + { + sal_Unicode c = rAttrValue[pos]; + if( (c >= '0') && (c <= '9') ) + aBuffer.append( c ); + else + aBuffer.append( (sal_Int32)c ); + } + + pMutableAttrList->SetValueByIndex( i, aBuffer.makeStringAndClear() ); + } + break; + // --> OD 2005-06-10 #i50322# - special handling for the + // transparency of writer background graphics. + case XML_ATACTION_WRITER_BACK_GRAPHIC_TRANSPARENCY: + { + // determine, if it's the transparency of a document style + XMLTransformerContext* pFirstContext = (*m_pContexts)[0].get(); + OUString aFirstContextLocalName; + /* sal_uInt16 nFirstContextPrefix = */ + GetNamespaceMap().GetKeyByAttrName( pFirstContext->GetQName(), + &aFirstContextLocalName ); + bool bIsDocumentStyle( + ::xmloff::token::IsXMLToken( aFirstContextLocalName, + XML_DOCUMENT_STYLES ) ); + // no conversion of transparency value for document + // styles, because former OpenOffice.org version writes + // writes always a transparency value of 100% and doesn't + // read the value. Thus, it's intepreted as 0% + if ( !bIsDocumentStyle ) + { + OUString aAttrValue( rAttrValue ); + NegPercent(aAttrValue); + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + bRename = sal_True; + } + break; + // <-- + default: + OSL_ENSURE( !this, "unknown action" ); + break; + } + + if( bRename ) + { + OUString aNewAttrQName( + GetNamespaceMap().GetQNameByKey( + (*aIter).second.GetQNamePrefixFromParam1(), + ::xmloff::token::GetXMLToken( + (*aIter).second.GetQNameTokenFromParam1()) ) ); + pMutableAttrList->RenameAttributeByIndex( i, + aNewAttrQName ); + } + } + } + } + + return pMutableAttrList; +} + +sal_Bool XMLTransformerBase::ReplaceSingleInchWithIn( OUString& rValue ) +{ + sal_Bool bRet = sal_False; + sal_Int32 nPos = rValue.getLength(); + while( nPos && rValue[nPos-1] <= ' ' ) + --nPos; + if( nPos > 2 && + ('c'==rValue[nPos-2] || 'C'==rValue[nPos-2]) && + ('h'==rValue[nPos-1] || 'H'==rValue[nPos-1]) ) + { + rValue =rValue.copy( 0, nPos-2 ); + bRet = sal_True; + } + + return bRet; +} + +sal_Bool XMLTransformerBase::ReplaceInchWithIn( OUString& rValue ) +{ + sal_Bool bRet = sal_False; + sal_Int32 nPos = 1; + while( nPos < rValue.getLength()-3 ) + { + sal_Unicode c = rValue[nPos]; + if( 'i'==c || 'I'==c ) + { + c = rValue[nPos-1]; + if( (c >= '0' && c <= '9') || '.' == c ) + { + c = rValue[nPos+1]; + if( 'n'==c || 'N'==c ) + { + c = rValue[nPos+2]; + if( 'c'==c || 'C'==c ) + { + c = rValue[nPos+3]; + if( 'h'==c || 'H'==c ) + { + rValue = rValue.replaceAt( nPos, + 4, GetXMLToken(XML_UNIT_INCH) ); + nPos += 2; + bRet = sal_True; + continue; + } + } + } + } + } + ++nPos; + } + + return bRet; +} + +sal_Bool XMLTransformerBase::ReplaceSingleInWithInch( OUString& rValue ) +{ + sal_Bool bRet = sal_False; + + sal_Int32 nPos = rValue.getLength(); + while( nPos && rValue[nPos-1] <= ' ' ) + --nPos; + if( nPos > 2 && + ('i'==rValue[nPos-2] || + 'I'==rValue[nPos-2]) && + ('n'==rValue[nPos-1] || + 'N'==rValue[nPos-1]) ) + { + nPos -= 2; + rValue = rValue.replaceAt( nPos, rValue.getLength() - nPos, + GetXMLToken(XML_INCH) ); + bRet = sal_True; + } + + return bRet; +} + +sal_Bool XMLTransformerBase::ReplaceInWithInch( OUString& rValue ) +{ + sal_Bool bRet = sal_False; + sal_Int32 nPos = 1; + while( nPos < rValue.getLength()-1 ) + { + sal_Unicode c = rValue[nPos]; + if( 'i'==c || 'I'==c ) + { + c = rValue[nPos-1]; + if( (c >= '0' && c <= '9') || '.' == c ) + { + c = rValue[nPos+1]; + if( 'n'==c || 'N'==c ) + { + rValue = rValue.replaceAt( nPos, + 2, GetXMLToken(XML_INCH) ); + nPos += 4; + bRet = sal_True; + continue; + } + } + } + ++nPos; + } + + return bRet; +} + +sal_Bool XMLTransformerBase::EncodeStyleName( OUString& rName ) const +{ + static sal_Char aHexTab[] = "0123456789abcdef"; + + sal_Bool bEncoded = sal_False; + + sal_Int32 nLen = rName.getLength(); + OUStringBuffer aBuffer( nLen ); + + for( sal_Int32 i = 0; i < nLen; i++ ) + { + sal_Unicode c = rName[i]; + sal_Bool bValidChar = sal_False; + if( c < 0x00ffU ) + { + bValidChar = + (c >= 0x0041 && c <= 0x005a) || + (c >= 0x0061 && c <= 0x007a) || + (c >= 0x00c0 && c <= 0x00d6) || + (c >= 0x00d8 && c <= 0x00f6) || + (c >= 0x00f8 && c <= 0x00ff) || + ( i > 0 && ( (c >= 0x0030 && c <= 0x0039) || + c == 0x00b7 || c == '-' || c == '.') ); + } + else + { + if( (c >= 0xf900U && c <= 0xfffeU) || + (c >= 0x20ddU && c <= 0x20e0U)) + { + bValidChar = sal_False; + } + else if( (c >= 0x02bbU && c <= 0x02c1U) || c == 0x0559 || + c == 0x06e5 || c == 0x06e6 ) + { + bValidChar = sal_True; + } + else if( c == 0x0387 ) + { + bValidChar = i > 0; + } + else + { + if( !xCharClass.is() ) + { + Reference< XMultiServiceFactory > xFactory = + comphelper::getProcessServiceFactory(); + if( xFactory.is() ) + { + try + { + const_cast < XMLTransformerBase * >(this) + ->xCharClass = + Reference < XCharacterClassification >( + xFactory->createInstance( + OUString::createFromAscii( + "com.sun.star.i18n.CharacterClassification_Unicode") ), + UNO_QUERY ); + + OSL_ENSURE( xCharClass.is(), + "can't instantiate character clossification component" ); + } + catch( com::sun::star::uno::Exception& ) + { + } + } + } + if( xCharClass.is() ) + { + sal_Int16 nType = xCharClass->getType( rName, i ); + + switch( nType ) + { + case UnicodeType::UPPERCASE_LETTER: // Lu + case UnicodeType::LOWERCASE_LETTER: // Ll + case UnicodeType::TITLECASE_LETTER: // Lt + case UnicodeType::OTHER_LETTER: // Lo + case UnicodeType::LETTER_NUMBER: // Nl + bValidChar = sal_True; + break; + case UnicodeType::NON_SPACING_MARK: // Ms + case UnicodeType::ENCLOSING_MARK: // Me + case UnicodeType::COMBINING_SPACING_MARK: //Mc + case UnicodeType::MODIFIER_LETTER: // Lm + case UnicodeType::DECIMAL_DIGIT_NUMBER: // Nd + bValidChar = i > 0; + break; + } + } + } + } + if( bValidChar ) + { + aBuffer.append( c ); + } + else + { + aBuffer.append( static_cast< sal_Unicode >( '_' ) ); + if( c > 0x0fff ) + aBuffer.append( static_cast< sal_Unicode >( + aHexTab[ (c >> 12) & 0x0f ] ) ); + if( c > 0x00ff ) + aBuffer.append( static_cast< sal_Unicode >( + aHexTab[ (c >> 8) & 0x0f ] ) ); + if( c > 0x000f ) + aBuffer.append( static_cast< sal_Unicode >( + aHexTab[ (c >> 4) & 0x0f ] ) ); + aBuffer.append( static_cast< sal_Unicode >( + aHexTab[ c & 0x0f ] ) ); + aBuffer.append( static_cast< sal_Unicode >( '_' ) ); + bEncoded = sal_True; + } + } + + if( aBuffer.getLength() > (1<<15)-1 ) + bEncoded = sal_False; + + if( bEncoded ) + rName = aBuffer.makeStringAndClear(); + return bEncoded; +} + +sal_Bool XMLTransformerBase::DecodeStyleName( OUString& rName ) +{ + sal_Bool bEncoded = sal_False; + + sal_Int32 nLen = rName.getLength(); + OUStringBuffer aBuffer( nLen ); + + sal_Bool bWithinHex = sal_False; + sal_Unicode cEnc = 0; + for( sal_Int32 i = 0; i < nLen; i++ ) + { + sal_Unicode c = rName[i]; + if( '_' == c ) + { + if( bWithinHex ) + { + aBuffer.append( cEnc ); + cEnc = 0; + } + else + { + bEncoded = sal_True; + } + bWithinHex = !bWithinHex; + } + else if( bWithinHex ) + { + sal_Unicode cDigit; + if( c >= '0' && c <= '9' ) + { + cDigit = c - '0'; + } + else if( c >= 'a' && c <= 'f' ) + { + cDigit = c - 'a' + 10; + } + else if( c >= 'A' && c <= 'F' ) + { + cDigit = c - 'A' + 10; + } + else + { + // error + bEncoded = sal_False; + break; + } + cEnc = (cEnc << 4) + cDigit; + } + else + { + aBuffer.append( c ); + } + } + + if( bEncoded ) + rName = aBuffer.makeStringAndClear(); + return bEncoded; +} + +sal_Bool XMLTransformerBase::NegPercent( OUString& rValue ) +{ + sal_Bool bRet = sal_False; + sal_Bool bNeg = sal_False; + double nVal = 0; + + sal_Int32 nPos = 0; + sal_Int32 nLen = rValue.getLength(); + + // skip white space + while( nPos < nLen && sal_Unicode(' ') == rValue[nPos] ) + nPos++; + + if( nPos < nLen && sal_Unicode('-') == rValue[nPos] ) + { + bNeg = sal_True; + nPos++; + } + + // get number + while( nPos < nLen && + sal_Unicode('0') <= rValue[nPos] && + sal_Unicode('9') >= rValue[nPos] ) + { + // TODO: check overflow! + nVal *= 10; + nVal += (rValue[nPos] - sal_Unicode('0')); + nPos++; + } + double nDiv = 1.; + if( nPos < nLen && sal_Unicode('.') == rValue[nPos] ) + { + nPos++; + + while( nPos < nLen && + sal_Unicode('0') <= rValue[nPos] && + sal_Unicode('9') >= rValue[nPos] ) + { + // TODO: check overflow! + nDiv *= 10; + nVal += ( static_cast<double>(rValue[nPos] - sal_Unicode('0')) / nDiv ); + nPos++; + } + } + + // skip white space + while( nPos < nLen && sal_Unicode(' ') == rValue[nPos] ) + nPos++; + + if( nPos < nLen && sal_Unicode('%') == rValue[nPos] ) + { + if( bNeg ) + nVal = -nVal; + nVal += .5; + + sal_Int32 nIntVal = 100 - static_cast<sal_Int32>( nVal ); + + OUStringBuffer aNewValBuffer; + aNewValBuffer.append( nIntVal ); + aNewValBuffer.append( sal_Unicode('%' ) ); + + rValue = aNewValBuffer.makeStringAndClear(); + bRet = sal_True; + } + + return bRet; +} + +sal_Bool XMLTransformerBase::AddNamespacePrefix( ::rtl::OUString& rName, + sal_uInt16 nPrefix ) const +{ + rName = GetNamespaceMap().GetQNameByKey( nPrefix, rName, sal_False ); + return sal_True; +} + +sal_Bool XMLTransformerBase::RemoveNamespacePrefix( ::rtl::OUString& rName, + sal_uInt16 nPrefixOnly ) const +{ + OUString aLocalName; + sal_uInt16 nPrefix = + GetNamespaceMap()._GetKeyByAttrName( rName, &aLocalName, sal_False ); + sal_Bool bRet = XML_NAMESPACE_UNKNOWN != nPrefix && + (USHRT_MAX == nPrefixOnly || nPrefix == nPrefixOnly); + if( bRet ) + rName = aLocalName; + + return bRet; +} + +sal_Bool XMLTransformerBase::ConvertURIToOASIS( ::rtl::OUString& rURI, + sal_Bool bSupportPackage ) const +{ + sal_Bool bRet = sal_False; + if( m_aExtPathPrefix.getLength() && rURI.getLength() ) + { + sal_Bool bRel = sal_False; + switch( rURI[0] ) + { + case '#': + // no rel path, but + // for package URIs, the '#' has to be removed + if( bSupportPackage ) + { + rURI = rURI.copy( 1 ); + bRet = sal_True; + } + break; + case '/': + // no rel path; nothing to do + break; + case '.': + // a rel path; to keep URI simple, remove './', if there + bRel = sal_True; + if( rURI.getLength() > 1 && '/' == rURI[1] ) + { + rURI = rURI.copy( 2 ); + bRet = sal_True; + } + break; + default: + // check for a RFC2396 schema + { + bRel = sal_True; + sal_Int32 nPos = 1; + sal_Int32 nLen = rURI.getLength(); + while( nPos < nLen ) + { + switch( rURI[nPos] ) + { + case '/': + // a relative path segement + nPos = nLen; // leave loop + break; + case ':': + // a schema + bRel = sal_False; + nPos = nLen; // leave loop + break; + default: + // we don't care about any other characters + break; + } + ++nPos; + } + } + } + + if( bRel ) + { + OUString sTmp( m_aExtPathPrefix ); + sTmp += rURI; + rURI = sTmp; + bRet = sal_True; + } + } + + return bRet; +} + +sal_Bool XMLTransformerBase::ConvertURIToOOo( ::rtl::OUString& rURI, + sal_Bool bSupportPackage ) const +{ + sal_Bool bRet = sal_False; + if( rURI.getLength() ) + { + sal_Bool bPackage = sal_False; + switch( rURI[0] ) + { + case '/': + // no rel path; nothing to to + break; + case '.': + // a rel path + if( 0 == rURI.compareTo( m_aExtPathPrefix, + m_aExtPathPrefix.getLength() ) ) + { + // an external URI; remove '../' + rURI = rURI.copy( m_aExtPathPrefix.getLength() ); + bRet = sal_True; + } + else + { + bPackage = sal_True; + } + break; + default: + // check for a RFC2396 schema + { + bPackage = sal_True; + sal_Int32 nPos = 1; + sal_Int32 nLen = rURI.getLength(); + while( nPos < nLen ) + { + switch( rURI[nPos] ) + { + case '/': + // a relative path segement within the package + nPos = nLen; // leave loop + break; + case ':': + // a schema + bPackage = sal_False; + nPos = nLen; // leave loop + break; + default: + // we don't care about any other characters + break; + } + ++nPos; + } + } + } + + if( bPackage && bSupportPackage ) + { + OUString sTmp( OUString::valueOf( sal_Unicode( '#' ) ) ); + if( 0 == rURI.compareToAscii( "./", 2 ) ) + rURI = rURI.copy( 2 ); + sTmp += rURI; + rURI = sTmp; + bRet = sal_True; + } + } + + return bRet; +} + +sal_Bool XMLTransformerBase::RenameAttributeValue( + OUString& rOutAttributeValue, + sal_Int32 nParam1, + sal_Int32 nParam2, + sal_Int32 nParam3 ) +{ + return ( lcl_ConvertAttr( rOutAttributeValue, nParam1) || + lcl_ConvertAttr( rOutAttributeValue, nParam2) || + lcl_ConvertAttr( rOutAttributeValue, nParam3) ); +} + +// static +bool XMLTransformerBase::ConvertRNGDateTimeToISO( ::rtl::OUString& rDateTime ) +{ + if( rDateTime.getLength() > 0 && + rDateTime.indexOf( sal_Unicode('.')) != -1 ) + { + rDateTime = rDateTime.replace( sal_Unicode('.'), sal_Unicode(',')); + return true; + } + + return false; +} + +XMLTokenEnum XMLTransformerBase::GetToken( const OUString& rStr ) const +{ + XMLTransformerTokenMap::const_iterator aIter = + m_pTokenMap->find( rStr ); + if( aIter == m_pTokenMap->end() ) + return XML_TOKEN_END; + else + return (*aIter).second; +} + + + +const XMLTransformerContext *XMLTransformerBase::GetCurrentContext() const +{ + OSL_ENSURE( !m_pContexts->empty(), "empty stack" ); + + + return m_pContexts->empty() ? 0 : m_pContexts->back().get(); +} + +const XMLTransformerContext *XMLTransformerBase::GetAncestorContext( + sal_uInt32 n ) const +{ + XMLTransformerContextVector::size_type nSize = + m_pContexts->size(); + XMLTransformerContextVector::size_type nPos = + static_cast<XMLTransformerContextVector::size_type>( n ); + + OSL_ENSURE( nSize >nPos+2 , "invalid context" ); + + return nSize > nPos+2 ? (*m_pContexts)[nSize-(nPos+2)].get() : 0; +} + +bool XMLTransformerBase::isWriter() const +{ + Reference< XServiceInfo > xSI( mxModel, UNO_QUERY ); + return xSI.is() && + ( xSI->supportsService( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ) ) || + xSI->supportsService( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.WebDocument" ) ) ) || + xSI->supportsService( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.GlobalDocument" ) ) ) ); +} diff --git a/xmloff/source/transform/TransformerBase.hxx b/xmloff/source/transform/TransformerBase.hxx new file mode 100644 index 000000000000..1f5f8c51123f --- /dev/null +++ b/xmloff/source/transform/TransformerBase.hxx @@ -0,0 +1,208 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_TRANSFORMER_BASE_HXX +#define _XMLOFF_TRANSFORMER_BASE_HXX + +#include <com/sun/star/xml/sax/SAXParseException.hpp> +#include <com/sun/star/xml/sax/SAXException.hpp> +#include <com/sun/star/xml/sax/XAttributeList.hpp> +#include <com/sun/star/xml/sax/XLocator.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <xmloff/xmltoken.hxx> + +#ifndef _XMLOFF_TRANSFORMER_HXX_ +#include "Transformer.hxx" +#endif + +namespace rtl { class OUString; } +namespace com { namespace sun { namespace star { + namespace i18n { class XCharacterClassification; } +}}} + +class SvXMLNamespaceMap; +class XMLTransformerContext; +class XMLTransformerContextVector; +class XMLTransformerActions; +struct XMLTransformerActionInit; +struct TransformerAction_Impl; +class XMLMutableAttributeList; +class XMLTransformerTokenMap; + +const sal_uInt16 INVALID_ACTIONS = 0xffff; + +class XMLTransformerBase : public XMLTransformer +{ + friend class XMLTransformerContext; + + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > + m_xLocator; + + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > m_xHandler; // the handlers + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XExtendedDocumentHandler > m_xExtHandler; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xPropSet; + ::com::sun::star::uno::Reference< + ::com::sun::star::i18n::XCharacterClassification > xCharClass; + + ::rtl::OUString m_aExtPathPrefix; + ::rtl::OUString m_aClass; + + SvXMLNamespaceMap *m_pNamespaceMap; + SvXMLNamespaceMap *m_pReplaceNamespaceMap; + XMLTransformerContextVector *m_pContexts; + XMLTransformerActions *m_pElemActions; + XMLTransformerTokenMap *m_pTokenMap; + +protected: + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxModel; + + // This method is called after the namespace map has been updated, but + // before a context for the current element has been pushed. + XMLTransformerContext *CreateContext( sal_uInt16 nPrefix, + const ::rtl::OUString& rLocalName, + const ::rtl::OUString& rQName ); + + // this method may return an empty reference when the transformer service + // was created outside the xmloff environment. + // It is strictly forbiden to use this as a write access to the model! + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& getModel() const { return mxModel; } + +public: + XMLTransformerBase( XMLTransformerActionInit *pInit=0, + ::xmloff::token::XMLTokenEnum *pTKMapInit=0 ) throw(); + virtual ~XMLTransformerBase() throw(); + + // ::com::sun::star::xml::sax::XDocumentHandler + virtual void SAL_CALL startDocument(void) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL endDocument(void) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL startElement(const ::rtl::OUString& aName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttribs) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL endElement(const ::rtl::OUString& aName) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL characters(const ::rtl::OUString& aChars) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL ignorableWhitespace(const ::rtl::OUString& aWhitespaces) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL processingInstruction(const ::rtl::OUString& aTarget, + const ::rtl::OUString& aData) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL setDocumentLocator(const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > & xLocator) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + + // ::com::sun::star::xml::sax::XExtendedDocumentHandler + virtual void SAL_CALL startCDATA(void) throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL endCDATA(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL comment(const ::rtl::OUString& sComment) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL allowLineBreak(void) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL unknown(const ::rtl::OUString& sString) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // C++ + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & GetDocHandler() { return m_xHandler; } + + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & GetPropertySet() { return m_xPropSet; } + + + SvXMLNamespaceMap& GetNamespaceMap() { return *m_pNamespaceMap; } + const SvXMLNamespaceMap& GetNamespaceMap() const { return *m_pNamespaceMap; } + SvXMLNamespaceMap& GetReplaceNamespaceMap() { return *m_pReplaceNamespaceMap; } + + XMLTransformerActions& GetElemActions() { return *m_pElemActions; } + virtual XMLTransformerActions *GetUserDefinedActions( sal_uInt16 n ); + virtual XMLTransformerContext *CreateUserDefinedContext( + const TransformerAction_Impl& rAction, + const ::rtl::OUString& rQName, + sal_Bool bPersistent=sal_False ) = 0; + virtual ::rtl::OUString GetEventName( const ::rtl::OUString& rName, + sal_Bool bForm = sal_False ) = 0; + + + XMLMutableAttributeList *ProcessAttrList( ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList >& rAttrList, + sal_uInt16 nActionMap, sal_Bool bClone ); + + static sal_Bool ReplaceSingleInchWithIn( ::rtl::OUString& rValue ); + static sal_Bool ReplaceSingleInWithInch( ::rtl::OUString& rValue ); + static sal_Bool ReplaceInchWithIn( ::rtl::OUString& rValue ); + static sal_Bool ReplaceInWithInch( ::rtl::OUString& rValue ); + + sal_Bool EncodeStyleName( ::rtl::OUString& rName ) const; + static sal_Bool DecodeStyleName( ::rtl::OUString& rName ); + static sal_Bool NegPercent( ::rtl::OUString& rValue ); + + sal_Bool AddNamespacePrefix( ::rtl::OUString& rName, + sal_uInt16 nPrefix ) const; + sal_Bool RemoveNamespacePrefix( ::rtl::OUString& rName, + sal_uInt16 nPrefixOnly=0xffffU ) const; + + sal_Bool ConvertURIToOASIS( ::rtl::OUString& rURI, + sal_Bool bSupportPackage=sal_False ) const; + sal_Bool ConvertURIToOOo( ::rtl::OUString& rURI, + sal_Bool bSupportPackage=sal_False ) const; + + /** renames the given rOutAttributeValue if one of the parameters contains a + matching token in its lower 16 bits. The value is converted to the + token that is given in the upper 16 bits of the matching parameter. + */ + sal_Bool RenameAttributeValue( ::rtl::OUString& rOutAttributeValue, + sal_Int32 nParam1, + sal_Int32 nParam2, + sal_Int32 nParam3 ); + + /** converts the '.' that separates fractions of seconds in a dateTime + string into a ',' that was used in the OOo format + + @param rDateTime + A dateTime string that will be parsed and changed in case a match + was found. + @return <TRUE/> if the given string was changed + */ + static bool ConvertRNGDateTimeToISO( ::rtl::OUString& rDateTime ); + + ::xmloff::token::XMLTokenEnum GetToken( const ::rtl::OUString& rStr ) const; + + const XMLTransformerContext *GetCurrentContext() const; + const XMLTransformerContext *GetAncestorContext( sal_uInt32 i ) const; + + // C++ + inline void SetClass( const ::rtl::OUString& r ) { m_aClass = r; } + inline const ::rtl::OUString& GetClass() const { return m_aClass; } + + bool isWriter() const; + +}; + +#endif // _XMLOFF_TRANSFORMER_BASE_HXX diff --git a/xmloff/source/transform/TransformerContext.cxx b/xmloff/source/transform/TransformerContext.cxx new file mode 100644 index 000000000000..09635ad560b3 --- /dev/null +++ b/xmloff/source/transform/TransformerContext.cxx @@ -0,0 +1,113 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" +#include <com/sun/star/xml/sax/SAXParseException.hpp> +#include <com/sun/star/xml/sax/SAXException.hpp> +#include <com/sun/star/xml/sax/XDocumentHandler.hpp> +#include <com/sun/star/xml/sax/XAttributeList.hpp> +#include <xmloff/nmspmap.hxx> + +#ifndef _XMLOFF_TRANSFOERMERBASE_HXX +#include "TransformerBase.hxx" +#endif + +#ifndef _XMLOFF_TRANSFOERMERCONTEXT_HXX +#include "TransformerContext.hxx" +#endif + +using ::rtl::OUString; + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; + +TYPEINIT0( XMLTransformerContext ); + +sal_Bool XMLTransformerContext::HasQName( sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken ) const +{ + OUString aLocalName; + return GetTransformer().GetNamespaceMap().GetKeyByAttrName( m_aQName, + &aLocalName ) == nPrefix && + ::xmloff::token::IsXMLToken( aLocalName, eToken ); +} + +sal_Bool XMLTransformerContext::HasNamespace( sal_uInt16 nPrefix ) const +{ + return GetTransformer().GetNamespaceMap().GetKeyByAttrName( m_aQName ) == nPrefix; +} + +XMLTransformerContext::XMLTransformerContext( XMLTransformerBase& rImp, + const OUString& rQName ) : + m_rTransformer( rImp ), + m_aQName( rQName ), + m_pRewindMap( 0 ) +{ +} + +XMLTransformerContext::~XMLTransformerContext() +{ +} + +XMLTransformerContext *XMLTransformerContext::CreateChildContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const Reference< XAttributeList >& ) +{ + return m_rTransformer.CreateContext( nPrefix, rLocalName, rQName ); +} + +void XMLTransformerContext::StartElement( const Reference< XAttributeList >& rAttrList ) +{ + m_rTransformer.GetDocHandler()->startElement( m_aQName, rAttrList ); +} + +void XMLTransformerContext::EndElement() +{ + m_rTransformer.GetDocHandler()->endElement( m_aQName ); +} + +void XMLTransformerContext::Characters( const OUString& rChars ) +{ + m_rTransformer.GetDocHandler()->characters( rChars ); +} + +sal_Bool XMLTransformerContext::IsPersistent() const +{ + return sal_False; +} + +void XMLTransformerContext::Export() +{ + OSL_ENSURE( !this, "context is not persistent" ); +} + +void XMLTransformerContext::ExportContent() +{ + OSL_ENSURE( !this, "context is not persistent" ); +} diff --git a/xmloff/source/transform/TransformerContext.hxx b/xmloff/source/transform/TransformerContext.hxx new file mode 100644 index 000000000000..e6bba90bae5e --- /dev/null +++ b/xmloff/source/transform/TransformerContext.hxx @@ -0,0 +1,116 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_TRANSFORMERCONTEXT_HXX +#define _XMLOFF_TRANSFORMERCONTEXT_HXX + +#include <com/sun/star/xml/sax/XAttributeList.hpp> +#include <tools/solar.h> +#include <salhelper/simplereferenceobject.hxx> +#include <rtl/ustring.hxx> +#include <tools/rtti.hxx> +#include <xmloff/xmltoken.hxx> + +class SvXMLNamespaceMap; +class XMLTransformerBase; + +class XMLTransformerContext : public ::salhelper::SimpleReferenceObject +{ + friend class XMLTransformerBase; + + XMLTransformerBase& m_rTransformer; + + ::rtl::OUString m_aQName; + + SvXMLNamespaceMap *m_pRewindMap; + + SvXMLNamespaceMap *GetRewindMap() const { return m_pRewindMap; } + void SetRewindMap( SvXMLNamespaceMap *p ) { m_pRewindMap = p; } + +protected: + + XMLTransformerBase& GetTransformer() { return m_rTransformer; } + const XMLTransformerBase& GetTransformer() const { return m_rTransformer; } + + void SetQName( const ::rtl::OUString& rQName ) { m_aQName = rQName; } + +public: + TYPEINFO(); + + const ::rtl::OUString& GetQName() const { return m_aQName; } + sal_Bool HasQName( sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken ) const; + sal_Bool HasNamespace( sal_uInt16 nPrefix ) const; + + // A contexts constructor does anything that is required if an element + // starts. Namespace processing has been done already. + // Note that virtual methods cannot be used inside constructors. Use + // StartElement instead if this is required. + XMLTransformerContext( XMLTransformerBase& rTransformer, + const ::rtl::OUString& rQName ); + + // A contexts destructor does anything that is required if an element + // ends. By default, nothing is done. + // Note that virtual methods cannot be used inside destructors. Use + // EndElement instead if this is required. + virtual ~XMLTransformerContext(); + + // Create a childs element context. By default, the import's + // CreateContext method is called to create a new default context. + virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix, + const ::rtl::OUString& rLocalName, + const ::rtl::OUString& rQName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + // StartElement is called after a context has been constructed and + // before a elements context is parsed. It may be used for actions that + // require virtual methods. The default is to do nothing. + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + // EndElement is called before a context will be destructed, but + // after a elements context has been parsed. It may be used for actions + // that require virtual methods. The default is to do nothing. + virtual void EndElement(); + + // This method is called for all characters that are contained in the + // current element. The default is to ignore them. + virtual void Characters( const ::rtl::OUString& rChars ); + + // Is the current context a persistent one (i.e. one that saves is content + // rather than exporting it directly? + virtual sal_Bool IsPersistent() const; + + // Export the whole element. By default, nothing is done here + virtual void Export(); + + // Export the element content. By default, nothing is done here + virtual void ExportContent(); +}; + + +#endif // _XMLOFF_TRANSFORMERCONTEXT_HXX + diff --git a/xmloff/source/transform/TransformerTokenMap.cxx b/xmloff/source/transform/TransformerTokenMap.cxx new file mode 100644 index 000000000000..a3020cf2fa3b --- /dev/null +++ b/xmloff/source/transform/TransformerTokenMap.cxx @@ -0,0 +1,54 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" + +#ifndef _XMLOFF_TRANSFORMERTOKENMAP_HXX +#include "TransformerTokenMap.hxx" +#endif + + +using namespace ::xmloff::token; + +XMLTransformerTokenMap::XMLTransformerTokenMap( XMLTokenEnum *pInit ) +{ + if( pInit ) + { + while( *pInit != XML_TOKEN_END ) + { + XMLTransformerTokenMap::value_type aVal( GetXMLToken( *pInit ), + *pInit ); + insert( aVal ); + ++pInit; + } + } +} + +XMLTransformerTokenMap::~XMLTransformerTokenMap() +{ +} diff --git a/xmloff/source/transform/TransformerTokenMap.hxx b/xmloff/source/transform/TransformerTokenMap.hxx new file mode 100644 index 000000000000..971ee3b96971 --- /dev/null +++ b/xmloff/source/transform/TransformerTokenMap.hxx @@ -0,0 +1,50 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XMLOFF_TRANSFORMERTOKENMAPS_HXX +#define _XMLOFF_TRANSFORMERTOKENMAPS_HXX + +#include <rtl/ustring.hxx> +#include <comphelper/stl_types.hxx> +#include <hash_map> +#include <xmloff/xmltoken.hxx> +#ifndef _XMLOFF_TRANSFORMERTOKENMAP_HXX +#include "TransformerTokenMap.hxx" +#endif + + + +class XMLTransformerTokenMap : + public ::std::hash_map< ::rtl::OUString, ::xmloff::token::XMLTokenEnum, + ::rtl::OUStringHash, ::comphelper::UStringEqual > +{ +public: + XMLTransformerTokenMap( ::xmloff::token::XMLTokenEnum *pInit ); + ~XMLTransformerTokenMap(); +}; + +#endif // _XMLOFF_TRANSFORMERTOKENMAPS_HXX diff --git a/xmloff/source/transform/XMLFilterRegistration.cxx b/xmloff/source/transform/XMLFilterRegistration.cxx new file mode 100644 index 000000000000..f201474015fc --- /dev/null +++ b/xmloff/source/transform/XMLFilterRegistration.cxx @@ -0,0 +1,195 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" + +#include <string.h> +#include <com/sun/star/registry/XRegistryKey.hpp> +#include <cppuhelper/factory.hxx> + +using namespace ::com::sun::star; + +#define DECLARE_SERVICE( classname ) \ + extern ::rtl::OUString SAL_CALL classname##_getImplementationName() throw(); \ + extern uno::Sequence< ::rtl::OUString > SAL_CALL classname##_getSupportedServiceNames() throw(); \ + extern uno::Reference< uno::XInterface > SAL_CALL classname##_createInstance( \ + const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception ); + +#define ENUMERATE_SERVICE( classname ) \ + { classname##_getImplementationName, classname##_getSupportedServiceNames, classname##_createInstance } + +// ============================================================================ +DECLARE_SERVICE( OOo2OasisTransformer ) +DECLARE_SERVICE( Oasis2OOoTransformer ) + +DECLARE_SERVICE( XMLAutoTextEventImportOOO ) +DECLARE_SERVICE( XMLMetaImportOOO ) +DECLARE_SERVICE( XMLMathSettingsImportOOO ) +DECLARE_SERVICE( XMLMathMetaImportOOO ) +DECLARE_SERVICE( XMLCalcSettingsImportOOO ) +DECLARE_SERVICE( XMLCalcMetaImportOOO ) +DECLARE_SERVICE( XMLCalcContentImportOOO ) +DECLARE_SERVICE( XMLCalcStylesImportOOO ) +DECLARE_SERVICE( XMLCalcImportOOO ) +DECLARE_SERVICE( XMLWriterSettingsImportOOO ) +DECLARE_SERVICE( XMLWriterMetaImportOOO ) +DECLARE_SERVICE( XMLWriterContentImportOOO ) +DECLARE_SERVICE( XMLWriterStylesImportOOO ) +DECLARE_SERVICE( XMLWriterImportOOO ) +DECLARE_SERVICE( XMLChartContentImportOOO ) +DECLARE_SERVICE( XMLChartStylesImportOOO ) +DECLARE_SERVICE( XMLChartImportOOO ) +DECLARE_SERVICE( XMLDrawSettingsImportOOO ) +DECLARE_SERVICE( XMLDrawMetaImportOOO ) +DECLARE_SERVICE( XMLDrawContentImportOOO ) +DECLARE_SERVICE( XMLDrawStylesImportOOO ) +DECLARE_SERVICE( XMLDrawImportOOO ) +DECLARE_SERVICE( XMLImpressSettingsImportOOO ) +DECLARE_SERVICE( XMLImpressMetaImportOOO ) +DECLARE_SERVICE( XMLImpressContentImportOOO ) +DECLARE_SERVICE( XMLImpressStylesImportOOO ) +DECLARE_SERVICE( XMLImpressImportOOO ) + +// ============================================================================ + +// ---------------------------------------------------------------------------- +namespace +{ + typedef ::rtl::OUString (SAL_CALL * GetImplementationName)(); + typedef uno::Sequence< ::rtl::OUString > (SAL_CALL * GetSupportedServiceNames)(); + typedef uno::Reference< ::uno::XInterface > (SAL_CALL * CreateInstance)( + const uno::Reference< lang::XMultiServiceFactory >& ); + + struct ServiceDescriptor + { + GetImplementationName getImplementationName; + GetSupportedServiceNames getSupportedServiceNames; + CreateInstance createInstance; + }; + + // ------------------------------------------------------------------------ + static const ServiceDescriptor* getServiceDescriptors() + { + static const ServiceDescriptor aDescriptors[] = + { + // ================================================================ + ENUMERATE_SERVICE( OOo2OasisTransformer ), + ENUMERATE_SERVICE( Oasis2OOoTransformer ), + + ENUMERATE_SERVICE( XMLAutoTextEventImportOOO ), + ENUMERATE_SERVICE( XMLMetaImportOOO ), + ENUMERATE_SERVICE( XMLMathSettingsImportOOO ), + ENUMERATE_SERVICE( XMLMathMetaImportOOO ), + ENUMERATE_SERVICE( XMLCalcSettingsImportOOO ), + ENUMERATE_SERVICE( XMLCalcMetaImportOOO ), + ENUMERATE_SERVICE( XMLCalcContentImportOOO ), + ENUMERATE_SERVICE( XMLCalcStylesImportOOO ), + ENUMERATE_SERVICE( XMLCalcImportOOO ), + ENUMERATE_SERVICE( XMLWriterSettingsImportOOO ), + ENUMERATE_SERVICE( XMLWriterMetaImportOOO ), + ENUMERATE_SERVICE( XMLWriterContentImportOOO ), + ENUMERATE_SERVICE( XMLWriterStylesImportOOO ), + ENUMERATE_SERVICE( XMLWriterImportOOO ), + ENUMERATE_SERVICE( XMLChartContentImportOOO ), + ENUMERATE_SERVICE( XMLChartStylesImportOOO ), + ENUMERATE_SERVICE( XMLChartImportOOO ), + ENUMERATE_SERVICE( XMLDrawSettingsImportOOO ), + ENUMERATE_SERVICE( XMLDrawMetaImportOOO ), + ENUMERATE_SERVICE( XMLDrawContentImportOOO ), + ENUMERATE_SERVICE( XMLDrawStylesImportOOO ), + ENUMERATE_SERVICE( XMLDrawImportOOO ), + ENUMERATE_SERVICE( XMLImpressSettingsImportOOO ), + ENUMERATE_SERVICE( XMLImpressMetaImportOOO ), + ENUMERATE_SERVICE( XMLImpressContentImportOOO ), + ENUMERATE_SERVICE( XMLImpressStylesImportOOO ), + ENUMERATE_SERVICE( XMLImpressImportOOO ), + // ================================================================ + { NULL, NULL, NULL } + }; + return aDescriptors; + }; +} +// ---------------------------------------------------------------------------- + +#ifdef __cplusplus +extern "C" +{ +#endif + +SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** ) +{ + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} + +SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) +{ + void * pRet = NULL; + if( pServiceManager ) + { + try + { + uno::Reference< lang::XMultiServiceFactory > xMSF( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ) ); + + const sal_Int32 nImplNameLen = strlen( pImplName ); + + const ServiceDescriptor* pDescriptor = getServiceDescriptors(); + while ( pDescriptor->getImplementationName ) + { + if ( pDescriptor->getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) ) + { + uno::Reference< lang::XSingleServiceFactory > xFactory = + ::cppu::createSingleFactory( xMSF, + pDescriptor->getImplementationName(), + pDescriptor->createInstance, + pDescriptor->getSupportedServiceNames() + ); + + if ( xFactory.is() ) + { + xFactory->acquire(); + pRet = xFactory.get(); + break; + } + } + + ++pDescriptor; + } + } + catch( uno::Exception& ) + { + OSL_ENSURE( sal_False, "xof::component_getFactory: Exception!" ); + } + } + + return pRet; +} + +#ifdef __cplusplus +} +#endif + diff --git a/xmloff/source/transform/xof.component b/xmloff/source/transform/xof.component new file mode 100644 index 000000000000..8f9c88f7fa0d --- /dev/null +++ b/xmloff/source/transform/xof.component @@ -0,0 +1,118 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.Calc.XMLContentImporter"> + <service name="com.sun.star.comp.Calc.XMLContentImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Calc.XMLImporter"> + <service name="com.sun.star.comp.Calc.XMLImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Calc.XMLMetaImporter"> + <service name="com.sun.star.comp.Calc.XMLMetaImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Calc.XMLSettingsImporter"> + <service name="com.sun.star.comp.Calc.XMLSettingsImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Calc.XMLStylesImporter"> + <service name="com.sun.star.comp.Calc.XMLStylesImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Chart.XMLContentImporter"> + <service name="com.sun.star.comp.Chart.XMLContentImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Chart.XMLImporter"> + <service name="com.sun.star.comp.Chart.XMLImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Chart.XMLStylesImporter"> + <service name="com.sun.star.comp.Chart.XMLStylesImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Draw.XMLContentImporter"> + <service name="com.sun.star.comp.Draw.XMLContentImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Draw.XMLImporter"> + <service name="com.sun.star.comp.Draw.XMLImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Draw.XMLMetaImporter"> + <service name="com.sun.star.comp.Draw.XMLMetaImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Draw.XMLSettingsImporter"> + <service name="com.sun.star.comp.Draw.XMLSettingsImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Draw.XMLStylesImporter"> + <service name="com.sun.star.comp.Draw.XMLStylesImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Impress.XMLContentImporter"> + <service name="com.sun.star.comp.Impress.XMLContentImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Impress.XMLImporter"> + <service name="com.sun.star.comp.Impress.XMLImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Impress.XMLMetaImporter"> + <service name="com.sun.star.comp.Impress.XMLMetaImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Impress.XMLSettingsImporter"> + <service name="com.sun.star.comp.Impress.XMLSettingsImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Impress.XMLStylesImporter"> + <service name="com.sun.star.comp.Impress.XMLStylesImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Math.XMLMetaImporter"> + <service name="com.sun.star.comp.Math.XMLMetaImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Math.XMLSettingsImporter"> + <service name="com.sun.star.comp.Math.XMLSettingsImporter"/> + </implementation> + <implementation name="com.sun.star.comp.OOo2OasisTransformer"> + <service name="com.sun.star.comp.OOo2OasisTransformer"/> + </implementation> + <implementation name="com.sun.star.comp.Oasis2OOoTransformer"> + <service name="com.sun.star.comp.Oasis2OOoTransformer"/> + </implementation> + <implementation name="com.sun.star.comp.Writer.XMLAutotextEventsImporter"> + <service name="com.sun.star.comp.Writer.XMLAutotextEventsImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Writer.XMLContentImporter"> + <service name="com.sun.star.comp.Writer.XMLContentImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Writer.XMLImporter"> + <service name="com.sun.star.comp.Writer.XMLImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Writer.XMLMetaImporter"> + <service name="com.sun.star.comp.Writer.XMLMetaImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Writer.XMLSettingsImporter"> + <service name="com.sun.star.comp.Writer.XMLSettingsImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Writer.XMLStylesImporter"> + <service name="com.sun.star.comp.Writer.XMLStylesImporter"/> + </implementation> + <implementation name="com.sun.star.document.XMLMetaImporter"> + <service name="com.sun.star.document.XMLMetaImporter"/> + </implementation> +</component> |