diff options
Diffstat (limited to 'xmloff/source/transform')
87 files changed, 17050 insertions, 0 deletions
diff --git a/xmloff/source/transform/ActionMapTypesOASIS.hxx b/xmloff/source/transform/ActionMapTypesOASIS.hxx new file mode 100644 index 000000000..eb9753ab4 --- /dev/null +++ b/xmloff/source/transform/ActionMapTypesOASIS.hxx @@ -0,0 +1,87 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +enum ActionMapTypesOasis +{ + 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 +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/ActionMapTypesOOo.hxx b/xmloff/source/transform/ActionMapTypesOOo.hxx new file mode 100644 index 000000000..53e5e31c4 --- /dev/null +++ b/xmloff/source/transform/ActionMapTypesOOo.hxx @@ -0,0 +1,84 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +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, + OOO_ANIMATION_ACTIONS, + MAX_OOO_ACTIONS +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/AttrTransformerAction.hxx b/xmloff/source/transform/AttrTransformerAction.hxx new file mode 100644 index 000000000..e302a9852 --- /dev/null +++ b/xmloff/source/transform/AttrTransformerAction.hxx @@ -0,0 +1,126 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#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_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, // a URI in OOo notation + // - param1: pacakage URI are supported + XML_ATACTION_URI_OASIS, // a URI in OASIS notation + // - param1: pacakage URI are supported + XML_ATACTION_RENAME_ATTRIBUTE, // rename up to 3 different possible values of an attribute + // - 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_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 + // OpenDocument file format: attribute value of <style:mirror> wrong (#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_SHAPEID, // convert shape id + XML_ATACTION_USER_DEFINED=0x40000000,// user defined actions start here +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/ChartOASISTContext.cxx b/xmloff/source/transform/ChartOASISTContext.cxx new file mode 100644 index 000000000..314de4031 --- /dev/null +++ b/xmloff/source/transform/ChartOASISTContext.cxx @@ -0,0 +1,131 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "ChartOASISTContext.hxx" +#include "MutableAttrList.hxx" +#include <xmloff/xmlnamespace.hxx> +#include "ActionMapTypesOASIS.hxx" +#include "AttrTransformerAction.hxx" +#include "TransformerActions.hxx" +#include "TransformerBase.hxx" +#include <osl/diagnose.h> + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; +using namespace ::xmloff::token; + +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 ); + rtl::Reference<XMLMutableAttributeList> pMutableAttrList; + 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( XMLTransformerBase::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( false, "unknown action" ); + break; + } + } + } + + if( !aAddInName.isEmpty() ) + { + OUString aAttrQName( GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_CHART, + GetXMLToken( XML_ADD_IN_NAME ) ) ); + assert(pMutableAttrList && "coverity[var_deref_model] - pMutableAttrList should be assigned in a superset of the enclosing if condition entry logic"); + pMutableAttrList->AddAttribute( aAttrQName, aAddInName ); + } + + XMLTransformerContext::StartElement( xAttrList ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/ChartOASISTContext.hxx b/xmloff/source/transform/ChartOASISTContext.hxx new file mode 100644 index 000000000..08178f3f1 --- /dev/null +++ b/xmloff/source/transform/ChartOASISTContext.hxx @@ -0,0 +1,34 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include "TransformerContext.hxx" + +class XMLChartOASISTransformerContext : public XMLTransformerContext +{ +public: + XMLChartOASISTransformerContext( XMLTransformerBase& rTransformer, + const OUString& rQName ); + virtual ~XMLChartOASISTransformerContext() override; + + virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/ChartOOoTContext.cxx b/xmloff/source/transform/ChartOOoTContext.cxx new file mode 100644 index 000000000..781cb3764 --- /dev/null +++ b/xmloff/source/transform/ChartOOoTContext.cxx @@ -0,0 +1,133 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "ChartOOoTContext.hxx" +#include "MutableAttrList.hxx" +#include <xmloff/xmlnamespace.hxx> +#include "ActionMapTypesOOo.hxx" +#include "AttrTransformerAction.hxx" +#include "TransformerActions.hxx" +#include "TransformerBase.hxx" +#include <osl/diagnose.h> + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; +using namespace ::xmloff::token; + +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 ); + rtl::Reference<XMLMutableAttributeList> pMutableAttrList; + 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); + 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( false, "unknown action" ); + break; + } + } + } + + if( nClassName != -1 && !aAddInName.isEmpty() ) + { + GetTransformer().AddNamespacePrefix( aAddInName, XML_NAMESPACE_OOO ); + pMutableAttrList->SetValueByIndex( nClassName, aAddInName ); + } + + XMLTransformerContext::StartElement( xAttrList ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/ChartOOoTContext.hxx b/xmloff/source/transform/ChartOOoTContext.hxx new file mode 100644 index 000000000..aad4856ec --- /dev/null +++ b/xmloff/source/transform/ChartOOoTContext.hxx @@ -0,0 +1,34 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include "TransformerContext.hxx" + +class XMLChartOOoTransformerContext : public XMLTransformerContext +{ +public: + XMLChartOOoTransformerContext( XMLTransformerBase& rTransformer, + const OUString& rQName ); + virtual ~XMLChartOOoTransformerContext() override; + + virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/ChartPlotAreaOASISTContext.cxx b/xmloff/source/transform/ChartPlotAreaOASISTContext.cxx new file mode 100644 index 000000000..b8603f62f --- /dev/null +++ b/xmloff/source/transform/ChartPlotAreaOASISTContext.cxx @@ -0,0 +1,234 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "ChartPlotAreaOASISTContext.hxx" +#include "TransformerBase.hxx" +#include <xmloff/namespacemap.hxx> +#include <xmloff/xmlnamespace.hxx> +#include <xmloff/xmltoken.hxx> +#include "DeepTContext.hxx" +#include "ActionMapTypesOASIS.hxx" +#include "MutableAttrList.hxx" +#include <osl/diagnose.h> + +using namespace ::com::sun::star; +using namespace ::xmloff::token; + +using ::com::sun::star::uno::Reference; + +namespace { + +class XMLAxisOASISContext : public XMLPersElemContentTContext +{ +public: + XMLAxisOASISContext( XMLTransformerBase& rTransformer, + const OUString& rQName, + ::rtl::Reference< XMLPersAttrListTContext > & rOutCategoriesContext ); + + virtual rtl::Reference<XMLTransformerContext> CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const Reference< xml::sax::XAttributeList >& xAttrList ) override; + + virtual void StartElement( const Reference< xml::sax::XAttributeList >& rAttrList ) override; + virtual void EndElement() override; + +private: + ::rtl::Reference< XMLPersAttrListTContext > & m_rCategoriesContext; + bool m_bHasCategories; +}; + +} + +XMLAxisOASISContext::XMLAxisOASISContext( + XMLTransformerBase& rTransformer, + const OUString& rQName, + ::rtl::Reference< XMLPersAttrListTContext > & rOutCategoriesContext ) : + XMLPersElemContentTContext( rTransformer, rQName ), + m_rCategoriesContext( rOutCategoriesContext ), + m_bHasCategories( false ) +{} + +rtl::Reference<XMLTransformerContext> XMLAxisOASISContext::CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const Reference< xml::sax::XAttributeList >& xAttrList ) +{ + rtl::Reference<XMLTransformerContext> pContext; + + 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 ) +{ + Reference< xml::sax::XAttributeList > xAttrList( rAttrList ); + rtl::Reference<XMLMutableAttributeList> pMutableAttrList; + 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_FAIL( "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( m_bHasCategories && + m_rCategoriesContext.is() ) + { + OSL_ENSURE( GetAttrList().is(), "Invalid attribute list" ); + rtl::Reference<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(); +} + + +XMLChartPlotAreaOASISTContext::XMLChartPlotAreaOASISTContext( + XMLTransformerBase & rTransformer, const OUString & rQName ) : + XMLProcAttrTransformerContext( rTransformer, rQName, OASIS_SHAPE_ACTIONS ) +{ +} + +XMLChartPlotAreaOASISTContext::~XMLChartPlotAreaOASISTContext() +{} + +rtl::Reference<XMLTransformerContext> XMLChartPlotAreaOASISTContext::CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const uno::Reference< xml::sax::XAttributeList >& xAttrList ) +{ + rtl::Reference<XMLTransformerContext> pContext; + + if( XML_NAMESPACE_CHART == nPrefix && + IsXMLToken( rLocalName, XML_AXIS ) ) + { + pContext.set(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(); + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/ChartPlotAreaOASISTContext.hxx b/xmloff/source/transform/ChartPlotAreaOASISTContext.hxx new file mode 100644 index 000000000..fb6cae053 --- /dev/null +++ b/xmloff/source/transform/ChartPlotAreaOASISTContext.hxx @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#pragma once + +#include "ProcAttrTContext.hxx" +#include "PersAttrListTContext.hxx" +#include <rtl/ref.hxx> + +class XMLChartPlotAreaOASISTContext : public XMLProcAttrTransformerContext +{ +public: + explicit XMLChartPlotAreaOASISTContext( + XMLTransformerBase & rTransformer, const OUString & rQName ); + virtual ~XMLChartPlotAreaOASISTContext() override; + + virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + virtual void EndElement() override; + + void ExportCategories(); + +private: + ::rtl::Reference< XMLPersAttrListTContext > m_rCategoriesContext; +}; + +// INCLUDED_XMLOFF_SOURCE_TRANSFORM_CHARTPLOTAREAOASISTCONTEXT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/ChartPlotAreaOOoTContext.cxx b/xmloff/source/transform/ChartPlotAreaOOoTContext.cxx new file mode 100644 index 000000000..f2781a25a --- /dev/null +++ b/xmloff/source/transform/ChartPlotAreaOOoTContext.cxx @@ -0,0 +1,211 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "ChartPlotAreaOOoTContext.hxx" +#include "TransformerBase.hxx" +#include <xmloff/namespacemap.hxx> +#include <xmloff/xmlnamespace.hxx> +#include <xmloff/xmltoken.hxx> +#include "DeepTContext.hxx" +#include "ActionMapTypesOOo.hxx" +#include "MutableAttrList.hxx" +#include <osl/diagnose.h> + +using namespace ::com::sun::star; +using namespace ::xmloff::token; + +using ::com::sun::star::uno::Reference; + +class XMLAxisOOoContext : public XMLPersElemContentTContext +{ +public: + XMLAxisOOoContext( XMLTransformerBase& rTransformer, + const OUString& rQName ); + + virtual void StartElement( const Reference< xml::sax::XAttributeList >& rAttrList ) override; + + bool IsCategoryAxis() const { return m_bIsCategoryAxis;} + +private: + bool m_bIsCategoryAxis; +}; + +XMLAxisOOoContext::XMLAxisOOoContext( + XMLTransformerBase& rTransformer, + const OUString& rQName ) : + XMLPersElemContentTContext( rTransformer, rQName ), + m_bIsCategoryAxis( false ) +{} + +void XMLAxisOOoContext::StartElement( + const Reference< xml::sax::XAttributeList >& rAttrList ) +{ + Reference< xml::sax::XAttributeList > xAttrList( rAttrList ); + rtl::Reference<XMLMutableAttributeList> pMutableAttrList; + 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_FAIL( "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 ); +} + +XMLChartPlotAreaOOoTContext::XMLChartPlotAreaOOoTContext( + XMLTransformerBase & rTransformer, const OUString & rQName ) : + XMLProcAttrTransformerContext( rTransformer, rQName, OOO_SHAPE_ACTIONS ) +{ +} + +rtl::Reference<XMLTransformerContext> XMLChartPlotAreaOOoTContext::CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const uno::Reference< xml::sax::XAttributeList >& xAttrList ) +{ + rtl::Reference<XMLTransformerContext> pContext; + + if( XML_NAMESPACE_CHART == nPrefix && + IsXMLToken( rLocalName, XML_AXIS ) ) + { + rtl::Reference<XMLAxisOOoContext> pAxisContext( new XMLAxisOOoContext( GetTransformer(), rQName )); + AddContent( pAxisContext ); + pContext = pAxisContext; + } + else if( XML_NAMESPACE_CHART == nPrefix && + IsXMLToken( rLocalName, XML_CATEGORIES ) ) + { + pContext.set(new XMLPersAttrListTContext( GetTransformer(), rQName )); + + // put categories at correct axis + bool bFound =false; + + // iterate over axis elements + for( const auto& rChildContext : m_aChildContexts ) + { + XMLAxisOOoContext * pAxisContext = rChildContext.get(); + if( pAxisContext != nullptr ) + { + // 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; + } + } + } + + if (bFound) + 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(rtl::Reference<XMLAxisOOoContext> const & pContext) +{ + OSL_ENSURE( pContext.is() && pContext->IsPersistent(), + "non-persistent context" ); + m_aChildContexts.push_back(pContext); +} + + +void XMLChartPlotAreaOOoTContext::ExportContent() +{ + for( auto& rChildContext : m_aChildContexts ) + { + rChildContext->Export(); + } + + m_aChildContexts.clear(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/ChartPlotAreaOOoTContext.hxx b/xmloff/source/transform/ChartPlotAreaOOoTContext.hxx new file mode 100644 index 000000000..9a2eb8fe8 --- /dev/null +++ b/xmloff/source/transform/ChartPlotAreaOOoTContext.hxx @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#pragma once + +#include <sal/config.h> + +#include <vector> + +#include "ProcAttrTContext.hxx" + +class XMLAxisOOoContext; + +class XMLAxisContextVector : + public ::std::vector< ::rtl::Reference< XMLAxisOOoContext > > +{ +}; + +class XMLChartPlotAreaOOoTContext : public XMLProcAttrTransformerContext +{ +public: + explicit XMLChartPlotAreaOOoTContext( + XMLTransformerBase & rTransformer, const OUString & rQName ); + + virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + virtual void EndElement() override; + virtual void ExportContent() override; + +private: + void AddContent( rtl::Reference<XMLAxisOOoContext> const & pContent ); + + XMLAxisContextVector m_aChildContexts; +}; + +// INCLUDED_XMLOFF_SOURCE_TRANSFORM_CHARTPLOTAREAOOOTCONTEXT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/ControlOASISTContext.cxx b/xmloff/source/transform/ControlOASISTContext.cxx new file mode 100644 index 000000000..5dd2067c7 --- /dev/null +++ b/xmloff/source/transform/ControlOASISTContext.cxx @@ -0,0 +1,150 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "MutableAttrList.hxx" +#include <xmloff/xmlnamespace.hxx> +#include <xmloff/namespacemap.hxx> +#include "ActionMapTypesOASIS.hxx" +#include "AttrTransformerAction.hxx" +#include "TransformerActions.hxx" +#include "TransformerBase.hxx" +#include "ControlOASISTContext.hxx" +#include <osl/diagnose.h> + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; +using namespace ::xmloff::token; + +XMLControlOASISTransformerContext::XMLControlOASISTransformerContext( + XMLTransformerBase& rImp, + const OUString& rQName, + bool bCreateControl ) : + XMLTransformerContext( rImp, rQName ), + m_aElemQName( rImp.GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_FORM, + ::xmloff::token::GetXMLToken( XML_CONTROL ) ) ), + m_bCreateControl( bCreateControl ) +{ +} + +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 ); + rtl::Reference<XMLMutableAttributeList> pMutableAttrList; +// GetTransformer().ProcessAttrList( xAttrList, OOO_SHAPE_ACTIONS, +// sal_True ); + + XMLMutableAttributeList *pControlMutableAttrList = + m_bCreateControl ? new XMLMutableAttributeList : nullptr; + 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 ); + } + } + break; + case XML_ATACTION_URI_OASIS: + { + OUString aAttrValue( rAttrValue ); + if( GetTransformer().ConvertURIToOOo( aAttrValue, + static_cast< bool >((*aIter).second.m_nParam1)) ) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + default: + OSL_ENSURE( false, "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 ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/ControlOASISTContext.hxx b/xmloff/source/transform/ControlOASISTContext.hxx new file mode 100644 index 000000000..26b5baeb0 --- /dev/null +++ b/xmloff/source/transform/ControlOASISTContext.hxx @@ -0,0 +1,39 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include "TransformerContext.hxx" + +class XMLControlOASISTransformerContext : public XMLTransformerContext +{ + OUString const m_aElemQName; + bool const m_bCreateControl; + +public: + XMLControlOASISTransformerContext( XMLTransformerBase& rTransformer, + const OUString& rQName, + bool bCreateControl ); + + virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + + virtual void EndElement() override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/ControlOOoTContext.cxx b/xmloff/source/transform/ControlOOoTContext.cxx new file mode 100644 index 000000000..1391b7225 --- /dev/null +++ b/xmloff/source/transform/ControlOOoTContext.cxx @@ -0,0 +1,87 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "ControlOOoTContext.hxx" +#include "IgnoreTContext.hxx" +#include "MutableAttrList.hxx" +#include "ActionMapTypesOOo.hxx" +#include "TransformerBase.hxx" + + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; +using namespace ::xmloff::token; + +XMLControlOOoTransformerContext::XMLControlOOoTransformerContext( + XMLTransformerBase& rImp, + const OUString& rQName ) : + XMLTransformerContext( rImp, rQName ) +{ +} + +void XMLControlOOoTransformerContext::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + m_xAttrList = new XMLMutableAttributeList( rAttrList, true ); +} + +rtl::Reference<XMLTransformerContext> XMLControlOOoTransformerContext::CreateChildContext( + sal_uInt16 /*nPrefix*/, + const OUString& /*rLocalName*/, + const OUString& rQName, + const Reference< XAttributeList >& rAttrList ) +{ + rtl::Reference<XMLTransformerContext> pContext; + + if( m_aElemQName.isEmpty() ) + { + pContext.set(new XMLIgnoreTransformerContext( GetTransformer(), + rQName, + false, false )); + m_aElemQName = rQName; + static_cast< XMLMutableAttributeList * >( m_xAttrList.get() ) + ->AppendAttributeList( rAttrList ); + GetTransformer().ProcessAttrList( m_xAttrList, + OOO_FORM_CONTROL_ACTIONS, + false ); + GetTransformer().GetDocHandler()->startElement( m_aElemQName, + m_xAttrList ); + } + else + { + pContext.set(new XMLIgnoreTransformerContext( GetTransformer(), + rQName, + true, true )); + } + return pContext; +} + +void XMLControlOOoTransformerContext::EndElement() +{ + GetTransformer().GetDocHandler()->endElement( m_aElemQName ); +} + +void XMLControlOOoTransformerContext::Characters( const OUString& rChars ) +{ + // ignore + if( !m_aElemQName.isEmpty() ) + XMLTransformerContext::Characters( rChars ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/ControlOOoTContext.hxx b/xmloff/source/transform/ControlOOoTContext.hxx new file mode 100644 index 000000000..34cb4e31d --- /dev/null +++ b/xmloff/source/transform/ControlOOoTContext.hxx @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include "TransformerContext.hxx" + +class XMLControlOOoTransformerContext : public XMLTransformerContext +{ + css::uno::Reference< css::xml::sax::XAttributeList > m_xAttrList; + + OUString m_aElemQName; + +public: + XMLControlOOoTransformerContext( XMLTransformerBase& rTransformer, + const OUString& rQName ); + + virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + + virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + + virtual void EndElement() override; + + virtual void Characters( const OUString& rChars ) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/CreateElemTContext.cxx b/xmloff/source/transform/CreateElemTContext.cxx new file mode 100644 index 000000000..218852972 --- /dev/null +++ b/xmloff/source/transform/CreateElemTContext.cxx @@ -0,0 +1,114 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <sal/config.h> + +#include <vector> + +#include "CreateElemTContext.hxx" +#include "MutableAttrList.hxx" +#include "TransformerBase.hxx" +#include "TransformerActions.hxx" +#include "FlatTContext.hxx" +#include "AttrTransformerAction.hxx" +#include <xmloff/namespacemap.hxx> +#include <osl/diagnose.h> + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; +using namespace ::xmloff::token; + +XMLCreateElemTransformerContext::XMLCreateElemTransformerContext( + XMLTransformerBase& rImp, + const OUString& rQName, + sal_uInt16 nActionMap ) : + XMLTransformerContext( rImp, rQName ), + m_nActionMap( nActionMap ) +{ +} + +void XMLCreateElemTransformerContext::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + Reference< XAttributeList > xAttrList( rAttrList ); + + std::vector<rtl::Reference<XMLTransformerContext>> aChildContexts; + + rtl::Reference<XMLMutableAttributeList> pMutableAttrList; + 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()) ) ); + rtl::Reference<XMLTransformerContext> pContext( + new XMLPersTextContentTContext( GetTransformer(), + aElemQName )); + pContext->Characters( rAttrValue ); + aChildContexts.push_back(pContext); + pMutableAttrList->RemoveAttributeByIndex( i ); + --i; + --nAttrCount; + } + break; + default: + OSL_ENSURE( false, "unknown action" ); + break; + } + } + } + } + XMLTransformerContext::StartElement( xAttrList ); + + for (auto const & i: aChildContexts) + { + i->Export(); + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/CreateElemTContext.hxx b/xmloff/source/transform/CreateElemTContext.hxx new file mode 100644 index 000000000..6d70e88ee --- /dev/null +++ b/xmloff/source/transform/CreateElemTContext.hxx @@ -0,0 +1,36 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include "TransformerContext.hxx" + +class XMLCreateElemTransformerContext : public XMLTransformerContext +{ + sal_uInt16 const m_nActionMap; + +public: + XMLCreateElemTransformerContext( XMLTransformerBase& rTransformer, + const OUString& rQName, + sal_uInt16 nActionMap ); + + virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/DeepTContext.cxx b/xmloff/source/transform/DeepTContext.cxx new file mode 100644 index 000000000..05a4c9900 --- /dev/null +++ b/xmloff/source/transform/DeepTContext.cxx @@ -0,0 +1,159 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "DeepTContext.hxx" +#include "TransformerActions.hxx" +#include "ElemTransformerAction.hxx" +#include "PersMixedContentTContext.hxx" +#include "TransformerBase.hxx" +#include <osl/diagnose.h> + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; + +void XMLPersElemContentTContext::AddContent( rtl::Reference<XMLTransformerContext> const & pContext ) +{ + OSL_ENSURE( pContext.is() && pContext->IsPersistent(), + "non-persistent context" ); + m_aChildContexts.push_back(pContext); +} + +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() +{ +} + +rtl::Reference<XMLTransformerContext> XMLPersElemContentTContext::CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const Reference< XAttributeList >& ) +{ + rtl::Reference<XMLTransformerContext> pContext; + + 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.set(new XMLPersMixedContentTContext( GetTransformer(), + rQName )); + break; + case XML_ETACTION_COPY_TEXT: + pContext.set(new XMLPersMixedContentTContext( GetTransformer(), + rQName )); + break; + case XML_ETACTION_RENAME_ELEM: + pContext.set(new XMLPersMixedContentTContext( GetTransformer(), rQName, + (*aIter).second.GetQNamePrefixFromParam1(), + (*aIter).second.GetQNameTokenFromParam1() )); + break; + case XML_ETACTION_RENAME_ELEM_PROC_ATTRS: + pContext.set(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: + { + rtl::Reference<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.set(new XMLPersMixedContentTContext( GetTransformer(), rQName, + static_cast< sal_uInt16 >( (*aIter).second.m_nParam1 ) )); + break; + default: + pContext = GetTransformer().CreateUserDefinedContext( + (*aIter).second, rQName, true ); + OSL_ENSURE( pContext.is() && pContext->IsPersistent(), + "unknown or not persistent action" ); + if( pContext.is() && !pContext->IsPersistent() ) + { + pContext.clear(); + } + break; + } + } + + // default is copying + if( !pContext.is() ) + pContext.set(new XMLPersMixedContentTContext( GetTransformer(), rQName )); + m_aChildContexts.push_back(pContext); + + return pContext; +} + +void XMLPersElemContentTContext::ExportContent() +{ + for (auto const & i: m_aChildContexts) + { + i->Export(); + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/DeepTContext.hxx b/xmloff/source/transform/DeepTContext.hxx new file mode 100644 index 000000000..af6d41255 --- /dev/null +++ b/xmloff/source/transform/DeepTContext.hxx @@ -0,0 +1,71 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <rtl/ref.hxx> + +#include <vector> +#include "PersAttrListTContext.hxx" + +class XMLPersElemContentTContext : public XMLPersAttrListTContext +{ + std::vector<rtl::Reference<XMLTransformerContext>> m_aChildContexts; + +public: + // element content persistence only + XMLPersElemContentTContext( XMLTransformerBase& rTransformer, + const OUString& rQName ); + + // element content persistence + attribute processing + XMLPersElemContentTContext( XMLTransformerBase& rTransformer, + const OUString& rQName, + sal_uInt16 nActionMap ); + + // element content persistence + renaming + XMLPersElemContentTContext( XMLTransformerBase& rTransformer, + const OUString& rQName, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken ); + + // element content persistence + renaming + attribute processing + XMLPersElemContentTContext( XMLTransformerBase& rTransformer, + const OUString& rQName, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken, + sal_uInt16 nActionMap ); + + virtual ~XMLPersElemContentTContext() override; + + virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + + void AddContent( rtl::Reference<XMLTransformerContext> const & pContent ); + + bool HasElementContent() const + { + return !m_aChildContexts.empty(); + } + + virtual void ExportContent() override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/DlgOASISTContext.cxx b/xmloff/source/transform/DlgOASISTContext.cxx new file mode 100644 index 000000000..24b8a868e --- /dev/null +++ b/xmloff/source/transform/DlgOASISTContext.cxx @@ -0,0 +1,98 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "DlgOASISTContext.hxx" +#include "MutableAttrList.hxx" +#include "ActionMapTypesOASIS.hxx" +#include "AttrTransformerAction.hxx" +#include "TransformerActions.hxx" +#include "TransformerBase.hxx" +#include <osl/diagnose.h> + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; +using namespace ::xmloff::token; + +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 ); + rtl::Reference<XMLMutableAttributeList> pMutableAttrList; + 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: + { + if ( rAttrValue != GetXMLToken( XML_NONE ) && + rAttrValue != GetXMLToken( XML_SIMPLE ) && + rAttrValue != GetXMLToken( XML_3D ) ) + { + pMutableAttrList->SetValueByIndex( + i, GetXMLToken( XML_NONE ) ); + } + } + break; + default: + OSL_ENSURE( false, "unknown action" ); + break; + } + } + } + + XMLTransformerContext::StartElement( xAttrList ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/DlgOASISTContext.hxx b/xmloff/source/transform/DlgOASISTContext.hxx new file mode 100644 index 000000000..338ea97b6 --- /dev/null +++ b/xmloff/source/transform/DlgOASISTContext.hxx @@ -0,0 +1,34 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include "TransformerContext.hxx" + +class XMLDlgOASISTransformerContext : public XMLTransformerContext +{ +public: + XMLDlgOASISTransformerContext( XMLTransformerBase& rTransformer, + const OUString& rQName ); + virtual ~XMLDlgOASISTransformerContext() override; + + virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/DocumentTContext.cxx b/xmloff/source/transform/DocumentTContext.cxx new file mode 100644 index 000000000..894146897 --- /dev/null +++ b/xmloff/source/transform/DocumentTContext.cxx @@ -0,0 +1,128 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <com/sun/star/xml/sax/SAXException.hpp> +#include <com/sun/star/xml/sax/XAttributeList.hpp> +#include <com/sun/star/beans/XPropertySetInfo.hpp> +#include <xmloff/namespacemap.hxx> +#include <xmloff/xmltoken.hxx> +#include <xmloff/xmlnamespace.hxx> + +#include "TransformerBase.hxx" +#include "MutableAttrList.hxx" + +#include "DocumentTContext.hxx" + + +using namespace ::xmloff::token; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; +using namespace ::com::sun::star::beans; + +XMLDocumentTransformerContext::XMLDocumentTransformerContext( XMLTransformerBase& rImp, + const OUString& rQName ) : + XMLTransformerContext( rImp, rQName ) +{ +} + +void XMLDocumentTransformerContext::StartElement( const Reference< XAttributeList >& rAttrList ) +{ + Reference< XAttributeList > xAttrList( rAttrList ); + + bool bMimeFound = false; + OUString aClass; + OUString aClassQName( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_OFFICE, GetXMLToken(XML_CLASS ) ) ); + + rtl::Reference<XMLMutableAttributeList> pMutableAttrList; + 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.", + nullptr + }; + for (int k=0; aTmp[k]; k++) + { + OUString sTmpString = 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 = true; + break; + } + } + + if( !bMimeFound ) + { + const Reference< XPropertySet > rPropSet = + GetTransformer().GetPropertySet(); + + if( rPropSet.is() ) + { + Reference< XPropertySetInfo > xPropSetInfo( + rPropSet->getPropertySetInfo() ); + OUString aPropName("Class"); + if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName( aPropName ) ) + { + Any aAny = rPropSet->getPropertyValue( aPropName ); + aAny >>= aClass; + } + } + + if( !aClass.isEmpty() ) + { + if( !pMutableAttrList ) + { + pMutableAttrList = new XMLMutableAttributeList( xAttrList ); + xAttrList = pMutableAttrList; + } + + pMutableAttrList->AddAttribute( aClassQName, aClass ); + } + } + XMLTransformerContext::StartElement( xAttrList ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/DocumentTContext.hxx b/xmloff/source/transform/DocumentTContext.hxx new file mode 100644 index 000000000..50434cb3e --- /dev/null +++ b/xmloff/source/transform/DocumentTContext.hxx @@ -0,0 +1,40 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include "TransformerContext.hxx" + +class XMLDocumentTransformerContext : public XMLTransformerContext +{ +public: + // 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 OUString& rQName); + + // StartElement is called after a context has been constructed and + // before an elements context is parsed. It may be used for actions that + // require virtual methods. The default is to do nothing. + virtual void + StartElement(const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/ElemTransformerAction.hxx b/xmloff/source/transform/ElemTransformerAction.hxx new file mode 100644 index 000000000..abd29f2fb --- /dev/null +++ b/xmloff/source/transform/ElemTransformerAction.hxx @@ -0,0 +1,87 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#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_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_MOVE_TO_ATTR, // turn elem into an attr: + // - param1: namespace + + // token of local name + XML_ETACTION_MOVE_TO_ATTR_RNG2ISO_DATETIME, // turn elem into an attr and convert . to , in datetimes + // - param1: namespace + + // token of local name + XML_ETACTION_USER_DEFINED=0x40000000// user defined actions start here +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/EventMap.cxx b/xmloff/source/transform/EventMap.cxx new file mode 100644 index 000000000..3cfa08a15 --- /dev/null +++ b/xmloff/source/transform/EventMap.cxx @@ -0,0 +1,103 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "EventMap.hxx" +#include <xmloff/xmlnamespace.hxx> + + +XMLTransformerEventMapEntry const 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, nullptr, nullptr } +}; + +XMLTransformerEventMapEntry const aFormTransformerEventMap[] = +{ + { XML_NAMESPACE_DOM, "mouseover", "on-mouseover" }, + { XML_NAMESPACE_DOM, "mouseout", "on-mouseout" }, + { XML_NAMESPACE_DOM, "DOMFocusOut", "on-blur" }, + { 0, nullptr, nullptr } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/EventMap.hxx b/xmloff/source/transform/EventMap.hxx new file mode 100644 index 000000000..11d20e185 --- /dev/null +++ b/xmloff/source/transform/EventMap.hxx @@ -0,0 +1,34 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <sal/types.h> + +struct XMLTransformerEventMapEntry +{ + sal_uInt16 const m_nOASISPrefix; + const char* m_pOASISName; + const char* m_pOOoName; +}; + +extern XMLTransformerEventMapEntry const aTransformerEventMap[]; +extern XMLTransformerEventMapEntry const aFormTransformerEventMap[]; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/EventOASISTContext.cxx b/xmloff/source/transform/EventOASISTContext.cxx new file mode 100644 index 000000000..ea922b7ff --- /dev/null +++ b/xmloff/source/transform/EventOASISTContext.cxx @@ -0,0 +1,334 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "EventOASISTContext.hxx" +#include "EventMap.hxx" +#include "MutableAttrList.hxx" +#include <xmloff/xmlnamespace.hxx> +#include "ActionMapTypesOASIS.hxx" +#include "AttrTransformerAction.hxx" +#include "TransformerActions.hxx" +#include "TransformerBase.hxx" +#include <osl/diagnose.h> +#include <sal/log.hxx> +#include <o3tl/string_view.hxx> + +// Used to parse Scripting Framework URLs +#include <com/sun/star/uri/UriReferenceFactory.hpp> +#include <com/sun/star/uri/XVndSunStarScriptUrl.hpp> +#include <comphelper/processfactory.hxx> + +#include <unordered_map> + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; +using namespace ::xmloff::token; + +class XMLTransformerOASISEventMap_Impl: + public std::unordered_map< NameKey_Impl, OUString, + NameHash_Impl, NameHash_Impl > +{ +public: + explicit XMLTransformerOASISEventMap_Impl( XMLTransformerEventMapEntry const *pInit ); +}; + +XMLTransformerOASISEventMap_Impl::XMLTransformerOASISEventMap_Impl( XMLTransformerEventMapEntry const *pInit ) +{ + if( !pInit ) + return; + + XMLTransformerOASISEventMap_Impl::key_type aKey; + XMLTransformerOASISEventMap_Impl::mapped_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; + } +} + +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; +} + +static bool ParseURL( + const OUString& rAttrValue, + OUString* pName, OUString* pLocation ) +{ + Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + + Reference< css::uri::XUriReferenceFactory > xFactory = css::uri::UriReferenceFactory::create(xContext); + + Reference< css::uri::XVndSunStarScriptUrl > xUrl ( xFactory->parse( rAttrValue ), UNO_QUERY ); + + if ( xUrl.is() ) + { + const OUString& aLanguageKey = GetXMLToken( XML_LANGUAGE ); + if ( xUrl.is() && xUrl->hasParameter( aLanguageKey ) ) + { + OUString aLanguage = xUrl->getParameter( aLanguageKey ); + + if ( aLanguage.equalsIgnoreAsciiCase("basic") ) + { + *pName = xUrl->getName(); + + OUString tmp = + xUrl->getParameter( GetXMLToken( XML_LOCATION ) ); + + const OUString& doc = GetXMLToken( XML_DOCUMENT ); + + if ( tmp.equalsIgnoreAsciiCase( doc ) ) + { + *pLocation = doc; + } + else + { + *pLocation = GetXMLToken( XML_APPLICATION ); + } + return true; + } + } + } + return false; +} + +void XMLEventOASISTransformerContext::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + SAL_INFO("xmloff.transform", "XMLEventOASISTransformerContext::StartElement"); + + XMLTransformerActions *pActions = + GetTransformer().GetUserDefinedActions( OASIS_EVENT_ACTIONS ); + SAL_WARN_IF( pActions == nullptr, "xmloff.transform", "got no actions" ); + + Reference< XAttributeList > xAttrList( rAttrList ); + rtl::Reference<XMLMutableAttributeList> pMutableAttrList; + 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 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, + "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 + // checking the 2nd ancestor element, f.i.: + // <form:button><form:event-listeners><form:event-listener> + const XMLTransformerContext *pObjContext = + GetTransformer().GetAncestorContext( 1 ); + 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, + "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 && + o3tl::equalsIgnoreAsciiCase(rAttrValue.subView(0,rApp.getLength()), rApp) && + ':' == rAttrValue[rApp.getLength()] ) + { + aLocation = rApp; + aAttrValue = rAttrValue.copy( rApp.getLength()+1 ); + } + else if( rAttrValue.getLength() > rDoc.getLength()+1 && + o3tl::equalsIgnoreAsciiCase(rAttrValue.subView(0,rDoc.getLength()), rDoc) && + ':' == rAttrValue[rDoc.getLength()] ) + { + aLocation= rDoc; + aAttrValue = rAttrValue.copy( rDoc.getLength()+1 ); + } + if( !aAttrValue.isEmpty() ) + pMutableAttrList->SetValueByIndex( i, + aAttrValue ); + if( !aLocation.isEmpty() ) + { + 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: + SAL_WARN( "xmloff.transform", "unknown action" ); + break; + } + } + } + + XMLRenameElemTransformerContext::StartElement( xAttrList ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/EventOASISTContext.hxx b/xmloff/source/transform/EventOASISTContext.hxx new file mode 100644 index 000000000..53cf0dbf2 --- /dev/null +++ b/xmloff/source/transform/EventOASISTContext.hxx @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include "RenameElemTContext.hxx" + +class XMLTransformerOASISEventMap_Impl; + +class XMLEventOASISTransformerContext : public XMLRenameElemTransformerContext +{ +public: + XMLEventOASISTransformerContext( XMLTransformerBase& rTransformer, + const OUString& rQName ); + virtual ~XMLEventOASISTransformerContext() override; + + static XMLTransformerOASISEventMap_Impl *CreateFormEventMap(); + static XMLTransformerOASISEventMap_Impl *CreateEventMap(); + static void FlushEventMap( XMLTransformerOASISEventMap_Impl *p ); + static OUString GetEventName( sal_uInt16 nPrefix, + const OUString& rName, + XMLTransformerOASISEventMap_Impl& rMap, + XMLTransformerOASISEventMap_Impl* pMap2 ); + + virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/EventOOoTContext.cxx b/xmloff/source/transform/EventOOoTContext.cxx new file mode 100644 index 000000000..1611e6b7a --- /dev/null +++ b/xmloff/source/transform/EventOOoTContext.cxx @@ -0,0 +1,235 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "EventOOoTContext.hxx" +#include "EventMap.hxx" +#include "MutableAttrList.hxx" +#include "ActionMapTypesOOo.hxx" +#include "AttrTransformerAction.hxx" +#include "TransformerActions.hxx" +#include "TransformerBase.hxx" +#include <osl/diagnose.h> + +#include <unordered_map> + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; +using namespace ::xmloff::token; + +class XMLTransformerOOoEventMap_Impl: + public std::unordered_map< OUString, NameKey_Impl > +{ +public: + + void AddMap( XMLTransformerEventMapEntry const *pInit ); + + XMLTransformerOOoEventMap_Impl( XMLTransformerEventMapEntry const *pInit, + XMLTransformerEventMapEntry const *pInit2 ); +}; + +void XMLTransformerOOoEventMap_Impl::AddMap( XMLTransformerEventMapEntry const *pInit ) +{ + XMLTransformerOOoEventMap_Impl::key_type aKey; + XMLTransformerOOoEventMap_Impl::mapped_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_FAIL( "duplicate OOo event name entry" ); + } + + ++pInit; + } +} + +XMLTransformerOOoEventMap_Impl::XMLTransformerOOoEventMap_Impl( + XMLTransformerEventMapEntry const *pInit, + XMLTransformerEventMapEntry const *pInit2 ) +{ + if( pInit ) + AddMap( pInit ); + if( pInit2 ) + AddMap( pInit2 ); +} + +XMLEventOOoTransformerContext::XMLEventOOoTransformerContext( + XMLTransformerBase& rImp, + const OUString& rQName, + bool bPersistent ) : + XMLPersElemContentTContext( rImp, rQName, + rImp.GetNamespaceMap().GetKeyByAttrValueQName(rQName, nullptr), + 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 ) +{ + const 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 ); + rtl::Reference<XMLMutableAttributeList> pMutableAttrList; + 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); + 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( false, "unknown action" ); + break; + } + } + } + + if( nMacroName != -1 && !aLocation.isEmpty() ) + { + if( !IsXMLToken( aLocation, XML_APPLICATION ) ) + aLocation = GetXMLToken( XML_DOCUMENT ); + OUString sTmp = aLocation + ":" + aMacroName; + pMutableAttrList->SetValueByIndex( nMacroName, sTmp ); + } + + 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() ); +} + +rtl::Reference<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); +} + +bool XMLEventOOoTransformerContext::IsPersistent() const +{ + return m_bPersistent; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/EventOOoTContext.hxx b/xmloff/source/transform/EventOOoTContext.hxx new file mode 100644 index 000000000..19461d310 --- /dev/null +++ b/xmloff/source/transform/EventOOoTContext.hxx @@ -0,0 +1,52 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include "DeepTContext.hxx" + +class XMLTransformerOOoEventMap_Impl; + +class XMLEventOOoTransformerContext : public XMLPersElemContentTContext +{ + bool const m_bPersistent; + +public: + XMLEventOOoTransformerContext( XMLTransformerBase& rTransformer, + const OUString& rQName, + bool bPersistent ); + virtual ~XMLEventOOoTransformerContext() override; + + static XMLTransformerOOoEventMap_Impl *CreateEventMap(); + static void FlushEventMap( XMLTransformerOOoEventMap_Impl *p ); + static sal_uInt16 GetEventName( const OUString& rName, + OUString& rNewName, + XMLTransformerOOoEventMap_Impl& rMap ); + + virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + virtual void EndElement() override; + virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + + virtual bool IsPersistent() const override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/FamilyType.hxx b/xmloff/source/transform/FamilyType.hxx new file mode 100644 index 000000000..15c0e9e24 --- /dev/null +++ b/xmloff/source/transform/FamilyType.hxx @@ -0,0 +1,49 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +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_END +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/FlatTContext.cxx b/xmloff/source/transform/FlatTContext.cxx new file mode 100644 index 000000000..0b00a0314 --- /dev/null +++ b/xmloff/source/transform/FlatTContext.cxx @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "FlatTContext.hxx" +#include "TransformerBase.hxx" + + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; + +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 ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/FlatTContext.hxx b/xmloff/source/transform/FlatTContext.hxx new file mode 100644 index 000000000..8a6787c26 --- /dev/null +++ b/xmloff/source/transform/FlatTContext.hxx @@ -0,0 +1,58 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include "PersAttrListTContext.hxx" + + +class XMLPersTextContentTContext : public XMLPersAttrListTContext +{ + OUString m_aCharacters; + +public: + // 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 OUString& rQName ); + + // attr list/text content persistence + renaming + XMLPersTextContentTContext( XMLTransformerBase& rTransformer, + const 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() override; + + // This method is called for all characters that are contained in the + // current element. + virtual void Characters( const OUString& rChars ) override; + + virtual void ExportContent() override; + + const OUString& GetTextContent() const { return m_aCharacters; } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/FormPropOASISTContext.cxx b/xmloff/source/transform/FormPropOASISTContext.cxx new file mode 100644 index 000000000..6b29f0da9 --- /dev/null +++ b/xmloff/source/transform/FormPropOASISTContext.cxx @@ -0,0 +1,211 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "MutableAttrList.hxx" +#include <xmloff/xmlnamespace.hxx> +#include <xmloff/namespacemap.hxx> +#include "ActionMapTypesOASIS.hxx" +#include "AttrTransformerAction.hxx" +#include "TransformerActions.hxx" +#include "TransformerBase.hxx" +#include "FormPropOASISTContext.hxx" +#include <osl/diagnose.h> + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; +using namespace ::xmloff::token; + +XMLTokenEnum XMLFormPropOASISTransformerContext::GetValueType( + const OUString& rValue ) +{ + XMLTokenEnum eRet = XML_DOUBLE; + bool bNeg = false; + sal_uInt32 nVal = 0; + + sal_Int32 nPos = 0; + sal_Int32 nLen = rValue.getLength(); + + // skip white space + while( nPos < nLen && ' ' == rValue[nPos] ) + nPos++; + + if( nPos < nLen && '-' == rValue[nPos] ) + { + bNeg = true; + nPos++; + } + + // get number + bool bOverflow = false; + while( nPos < nLen && + '0' <= rValue[nPos] && + '9' >= rValue[nPos] ) + { + nVal *= 10; + nVal += (rValue[nPos] - '0'); + bOverflow |= (nVal > (bNeg ? 2147483648UL : 2147483647UL)); + nPos++; + } + + // skip white space + while( nPos < nLen && ' ' == rValue[nPos] ) + nPos++; + + if( nPos == nLen ) + { + // It's an 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" ); + + rtl::Reference<XMLMutableAttributeList> pMutableAttrList = + new XMLMutableAttributeList( rAttrList ); + Reference< XAttributeList > xAttrList( pMutableAttrList ); + + sal_Int16 nValueTypeAttr = -1; + OUString aValue; + bool bIsVoid = 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 = 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( false, "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 ) + return; + + 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(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/FormPropOASISTContext.hxx b/xmloff/source/transform/FormPropOASISTContext.hxx new file mode 100644 index 000000000..5a656a629 --- /dev/null +++ b/xmloff/source/transform/FormPropOASISTContext.hxx @@ -0,0 +1,43 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include "RenameElemTContext.hxx" + +class XMLFormPropOASISTransformerContext : + public XMLRenameElemTransformerContext +{ + bool const m_bIsList; + bool const m_bIsListValue; + + static ::xmloff::token::XMLTokenEnum GetValueType( const OUString& rValue ); + +public: + XMLFormPropOASISTransformerContext( XMLTransformerBase& rTransformer, + const OUString& rQName, + ::xmloff::token::XMLTokenEnum eLocalName ); + + virtual ~XMLFormPropOASISTransformerContext() override; + + virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + virtual void EndElement() override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/FormPropOOoTContext.cxx b/xmloff/source/transform/FormPropOOoTContext.cxx new file mode 100644 index 000000000..1f5c6086d --- /dev/null +++ b/xmloff/source/transform/FormPropOOoTContext.cxx @@ -0,0 +1,250 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "MutableAttrList.hxx" +#include <xmloff/xmlnamespace.hxx> +#include <xmloff/namespacemap.hxx> +#include "IgnoreTContext.hxx" +#include "ActionMapTypesOOo.hxx" +#include "AttrTransformerAction.hxx" +#include "TransformerActions.hxx" +#include "TransformerBase.hxx" +#include "FormPropOOoTContext.hxx" +#include <osl/diagnose.h> + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; +using namespace ::xmloff::token; + +class XMLFormPropValueTContext_Impl : public XMLTransformerContext +{ + OUString m_aCharacters; + bool m_bIsVoid; + +public: + // element content persistence only + XMLFormPropValueTContext_Impl( XMLTransformerBase& rTransformer, + const OUString& rQName ); + + virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + + virtual void EndElement() override; + + virtual void Characters( const OUString& rChars ) override; + + virtual bool IsPersistent() const override; + + bool IsVoid() const { return m_bIsVoid; } + const OUString& GetTextContent() const { return m_aCharacters; } +}; + +XMLFormPropValueTContext_Impl::XMLFormPropValueTContext_Impl( + XMLTransformerBase& rTransformer, + const OUString& rQName ) : + XMLTransformerContext( rTransformer, rQName ), + m_bIsVoid( false ) +{ +} + +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 = true; + } +} + +void XMLFormPropValueTContext_Impl::EndElement() +{ +} + +void XMLFormPropValueTContext_Impl::Characters( const OUString& rChars ) +{ + m_aCharacters += rChars; +} + +bool XMLFormPropValueTContext_Impl::IsPersistent() const +{ + return true; +} + +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( false ) +{ +} + +XMLFormPropOOoTransformerContext::~XMLFormPropOOoTransformerContext() +{ +} + +rtl::Reference<XMLTransformerContext> XMLFormPropOOoTransformerContext::CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const Reference< XAttributeList >& ) +{ + rtl::Reference<XMLTransformerContext> pContext; + + if( XML_NAMESPACE_FORM == nPrefix && + IsXMLToken( rLocalName, XML_PROPERTY_VALUE ) ) + { + if( m_bIsList ) + { + pContext.set(new XMLFormPropValueTContext_Impl( GetTransformer(), + rQName )); + } + else if( !m_xValueContext.is() ) + { + m_xValueContext= + new XMLFormPropValueTContext_Impl( GetTransformer(), rQName ); + pContext = m_xValueContext; + } + } + + // default is ignore + if( !pContext.is() ) + pContext.set(new XMLIgnoreTransformerContext( GetTransformer(), rQName, + true, true )); + return pContext; +} + +void XMLFormPropOOoTransformerContext::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + + XMLTransformerActions *pActions = + GetTransformer().GetUserDefinedActions( OOO_FORM_PROP_ACTIONS ); + OSL_ENSURE( pActions, "go no actions" ); + + rtl::Reference<XMLMutableAttributeList> pMutableAttrList = + new XMLMutableAttributeList( rAttrList, 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 = true; + } + pMutableAttrList->RemoveAttributeByIndex( i ); + --i; + --nAttrCount; + break; + default: + OSL_ENSURE( false, "unknown action" ); + break; + } + } + } + + if( !aValueType.isEmpty() ) + { + 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 ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/FormPropOOoTContext.hxx b/xmloff/source/transform/FormPropOOoTContext.hxx new file mode 100644 index 000000000..ca0df6bdc --- /dev/null +++ b/xmloff/source/transform/FormPropOOoTContext.hxx @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <rtl/ref.hxx> +#include "TransformerContext.hxx" + +class XMLFormPropValueTContext_Impl; + +class XMLFormPropOOoTransformerContext : public XMLTransformerContext +{ + css::uno::Reference< css::xml::sax::XAttributeList > m_xAttrList; + + ::rtl::Reference< XMLFormPropValueTContext_Impl > m_xValueContext; + + OUString m_aElemQName; + + sal_Int16 m_nValueTypeAttr; + + ::xmloff::token::XMLTokenEnum m_eValueToken; + ::xmloff::token::XMLTokenEnum m_eValueTypeToken; + + bool m_bIsList; + +public: + XMLFormPropOOoTransformerContext( XMLTransformerBase& rTransformer, + const OUString& rQName ); + + virtual ~XMLFormPropOOoTransformerContext() override; + + virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + + virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + virtual void EndElement() override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/FrameOASISTContext.cxx b/xmloff/source/transform/FrameOASISTContext.cxx new file mode 100644 index 000000000..e2c2295c8 --- /dev/null +++ b/xmloff/source/transform/FrameOASISTContext.cxx @@ -0,0 +1,187 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "FrameOASISTContext.hxx" +#include "IgnoreTContext.hxx" +#include "MutableAttrList.hxx" +#include <xmloff/xmlnamespace.hxx> +#include "ActionMapTypesOASIS.hxx" +#include "ElemTransformerAction.hxx" +#include "TransformerActions.hxx" +#include "TransformerBase.hxx" +#include <osl/diagnose.h> + + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; +using namespace ::xmloff::token; + +bool XMLFrameOASISTransformerContext::IsLinkedEmbeddedObject( + std::u16string_view rLocalName, + const Reference< XAttributeList >& rAttrList ) +{ + if( !(IsXMLToken( rLocalName, XML_OBJECT ) || + IsXMLToken( rLocalName, XML_OBJECT_OLE) ) ) + return 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.isEmpty()) + { + // When the href is empty then the object is not linked but + // a placeholder. + return false; + } + GetTransformer().ConvertURIToOOo( sHRef, true ); + return sHRef.isEmpty() || '#' != sHRef[0]; + } + } + + return 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, 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; + } + } + } +} + +rtl::Reference<XMLTransformerContext> XMLFrameOASISTransformerContext::CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const Reference< XAttributeList >& rAttrList ) +{ + rtl::Reference<XMLTransformerContext> pContext; + + if( m_bIgnoreElement ) + { + // do not export the frame element and all of its children + pContext.set(new XMLIgnoreTransformerContext( GetTransformer(), + rQName, + true, 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.isEmpty() && + !IsLinkedEmbeddedObject( rLocalName, rAttrList ) ) + { + pContext.set(new XMLIgnoreTransformerContext( GetTransformer(), + rQName, + false, false )); + m_aElemQName = rQName; + static_cast< XMLMutableAttributeList * >( m_xAttrList.get() ) + ->AppendAttributeList( rAttrList ); + GetTransformer().ProcessAttrList( m_xAttrList, + OASIS_SHAPE_ACTIONS, + false ); + GetTransformer().GetDocHandler()->startElement( m_aElemQName, m_xAttrList ); + } + else + { + pContext.set(new XMLIgnoreTransformerContext( GetTransformer(), + rQName, + true, true )); + } + break; + default: + OSL_ENSURE( false, "unknown action" ); + break; + } + } + } + + // default is copying + if( !pContext.is() ) + 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.isEmpty() && !m_bIgnoreElement ) + XMLTransformerContext::Characters( rChars ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/FrameOASISTContext.hxx b/xmloff/source/transform/FrameOASISTContext.hxx new file mode 100644 index 000000000..d7ffaedb3 --- /dev/null +++ b/xmloff/source/transform/FrameOASISTContext.hxx @@ -0,0 +1,54 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include "TransformerContext.hxx" + +class XMLFrameOASISTransformerContext : public XMLTransformerContext +{ + css::uno::Reference< css::xml::sax::XAttributeList > m_xAttrList; + + OUString m_aElemQName; + + bool m_bIgnoreElement; + + bool IsLinkedEmbeddedObject( + std::u16string_view rLocalName, + const css::uno::Reference< css::xml::sax::XAttributeList >& rAttrList ); + +public: + XMLFrameOASISTransformerContext( XMLTransformerBase& rTransformer, + const OUString& rQName ); + + virtual ~XMLFrameOASISTransformerContext() override; + + virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + + virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + + virtual void EndElement() override; + + virtual void Characters( const OUString& rChars ) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/FrameOOoTContext.cxx b/xmloff/source/transform/FrameOOoTContext.cxx new file mode 100644 index 000000000..a8cbd5a8f --- /dev/null +++ b/xmloff/source/transform/FrameOOoTContext.cxx @@ -0,0 +1,157 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "FrameOOoTContext.hxx" +#include "MutableAttrList.hxx" +#include <xmloff/xmlnamespace.hxx> +#include <xmloff/namespacemap.hxx> +#include "ActionMapTypesOOo.hxx" +#include "AttrTransformerAction.hxx" +#include "ElemTransformerAction.hxx" +#include "TransformerActions.hxx" +#include "TransformerBase.hxx" +#include <osl/diagnose.h> + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; +using namespace ::xmloff::token; + +XMLFrameOOoTransformerContext::XMLFrameOOoTransformerContext( + XMLTransformerBase& rImp, + const OUString& rQName ) : + XMLPersElemContentTContext( rImp, rQName ), + m_aElemQName( rImp.GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_DRAW, + ::xmloff::token::GetXMLToken( XML_FRAME ) ) ) +{ +} + +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 ); + rtl::Reference<XMLMutableAttributeList> pMutableAttrList = + GetTransformer().ProcessAttrList( xAttrList, OOO_SHAPE_ACTIONS, + true ); + if( !pMutableAttrList ) + pMutableAttrList = new XMLMutableAttributeList( rAttrList ); + xAttrList = pMutableAttrList; + + rtl::Reference<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( false, "unknown action" ); + break; + } + } + } + + GetTransformer().GetDocHandler()->startElement( m_aElemQName, + xFrameAttrList ); + XMLTransformerContext::StartElement( xAttrList ); +} + +rtl::Reference<XMLTransformerContext> XMLFrameOOoTransformerContext::CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const Reference< XAttributeList >& rAttrList ) +{ + rtl::Reference<XMLTransformerContext> pContext; + + 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( false, "unknown action" ); + break; + } + } + + // default is copying + if( !pContext.is() ) + 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 ); +} + +bool XMLFrameOOoTransformerContext::IsPersistent() const +{ + // this context stores some of its child elements, but is not persistent + // itself. + return false; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/FrameOOoTContext.hxx b/xmloff/source/transform/FrameOOoTContext.hxx new file mode 100644 index 000000000..44d360699 --- /dev/null +++ b/xmloff/source/transform/FrameOOoTContext.hxx @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include "DeepTContext.hxx" + +class XMLFrameOOoTransformerContext : public XMLPersElemContentTContext +{ + OUString const m_aElemQName; + +public: + XMLFrameOOoTransformerContext( XMLTransformerBase& rTransformer, + const OUString& rQName ); + + virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + + virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + + virtual void EndElement() override; + + virtual void Characters( const OUString& rChars ) override; + + virtual bool IsPersistent() const override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/IgnoreTContext.cxx b/xmloff/source/transform/IgnoreTContext.cxx new file mode 100644 index 000000000..db4e212ea --- /dev/null +++ b/xmloff/source/transform/IgnoreTContext.cxx @@ -0,0 +1,92 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "IgnoreTContext.hxx" +#include "TransformerBase.hxx" + + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; + +XMLIgnoreTransformerContext::XMLIgnoreTransformerContext( + XMLTransformerBase& rImp, + const OUString& rQName, + bool bIgnoreChars, + bool bIgnoreElems ) : + XMLTransformerContext( rImp, rQName ), + m_bIgnoreCharacters( bIgnoreChars ), + m_bIgnoreElements( bIgnoreElems ), + m_bAllowCharactersRecursive( false ), + m_bRecursiveUse( false ) +{ +} + +XMLIgnoreTransformerContext::XMLIgnoreTransformerContext( + XMLTransformerBase& rTransformer, + const OUString& rQName, + bool bAllowCharactersRecursive ) : + XMLTransformerContext( rTransformer, rQName ), + m_bIgnoreCharacters( false ), + m_bIgnoreElements( false ), + m_bAllowCharactersRecursive( bAllowCharactersRecursive ), + m_bRecursiveUse( true ) +{ +} + +rtl::Reference<XMLTransformerContext> XMLIgnoreTransformerContext::CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const Reference< XAttributeList >& xAttrList ) +{ + rtl::Reference<XMLTransformerContext> pContext; + if( m_bIgnoreElements ) + pContext.set(new XMLIgnoreTransformerContext( GetTransformer(), + rQName, true, + true )); + else if (m_bRecursiveUse) + pContext.set(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 ); +} + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/IgnoreTContext.hxx b/xmloff/source/transform/IgnoreTContext.hxx new file mode 100644 index 000000000..2f349cfb3 --- /dev/null +++ b/xmloff/source/transform/IgnoreTContext.hxx @@ -0,0 +1,71 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include "TransformerContext.hxx" + + +class XMLIgnoreTransformerContext : public XMLTransformerContext +{ + bool const m_bIgnoreCharacters; + bool const m_bIgnoreElements; + bool const m_bAllowCharactersRecursive; + bool const m_bRecursiveUse; + +public: + // 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 OUString& rQName, + bool bIgnoreCharacters, + 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 OUString& rQName, + bool bAllowCharactersRecursive ); + + // Create a children element context. By default, the import's + // CreateContext method is called to create a new default context. + virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + + // StartElement is called after a context has been constructed and + // before an elements context is parsed. It may be used for actions that + // require virtual methods. The default is to do nothing. + virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + + // EndElement is called before a context will be destructed, but + // after an elements context has been parsed. It may be used for actions + // that require virtual methods. The default is to do nothing. + virtual void EndElement() override; + + // This method is called for all characters that are contained in the + // current element. The default is to ignore them. + virtual void Characters( const OUString& rChars ) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/MergeElemTContext.cxx b/xmloff/source/transform/MergeElemTContext.cxx new file mode 100644 index 000000000..e853240f9 --- /dev/null +++ b/xmloff/source/transform/MergeElemTContext.cxx @@ -0,0 +1,280 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "MergeElemTContext.hxx" +#include "MutableAttrList.hxx" +#include "TransformerBase.hxx" +#include "TransformerActions.hxx" +#include "ElemTransformerAction.hxx" +#include "IgnoreTContext.hxx" +#include <xmloff/xmlnamespace.hxx> +#include <osl/diagnose.h> + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; +using namespace ::xmloff::token; + +namespace { + +class XMLParagraphTransformerContext : public XMLTransformerContext +{ +public: + XMLParagraphTransformerContext( XMLTransformerBase& rTransformer, + const OUString& rQName ); + + // Create a children element context. By default, the import's + // CreateContext method is called to create a new default context. + virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; +}; + +} + +XMLParagraphTransformerContext::XMLParagraphTransformerContext( + XMLTransformerBase& rImp, + const OUString& rQName ) : + XMLTransformerContext( rImp, rQName ) +{ +} + +rtl::Reference<XMLTransformerContext> XMLParagraphTransformerContext::CreateChildContext( + sal_uInt16 /*nPrefix*/, + const OUString& /*rLocalName*/, + const OUString& rQName, + const Reference< XAttributeList >& ) +{ + return new XMLIgnoreTransformerContext( GetTransformer(), + rQName, true ); +} + +namespace { + +class XMLPersTextContentRNGTransformTContext : public XMLPersTextContentTContext +{ +public: + XMLPersTextContentRNGTransformTContext( + XMLTransformerBase& rTransformer, + const OUString& rQName, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken ); + + virtual void Characters( const OUString& rChars ) override; +}; + +} + +XMLPersTextContentRNGTransformTContext::XMLPersTextContentRNGTransformTContext( + XMLTransformerBase& rTransformer, + const OUString& rQName, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken ) : + XMLPersTextContentTContext( + rTransformer, rQName, nPrefix, eToken ) +{} + +void XMLPersTextContentRNGTransformTContext::Characters( const OUString& rChars ) +{ + OUString aConvChars( rChars ); + XMLTransformerBase::ConvertRNGDateTimeToISO( aConvChars ); + XMLPersTextContentTContext::Characters( aConvChars ); +} + + +void XMLMergeElemTransformerContext::ExportStartElement() +{ + for( const auto& rChildContext : m_aChildContexts ) + { + XMLPersTextContentTContext *pContext = rChildContext.get(); + static_cast< XMLMutableAttributeList * >( m_xAttrList.get() ) + ->AddAttribute( pContext->GetExportQName(), + pContext->GetTextContent() ); + } + XMLTransformerContext::StartElement( m_xAttrList ); + + m_bStartElementExported = true; +} + +XMLMergeElemTransformerContext::XMLMergeElemTransformerContext( + XMLTransformerBase& rImp, + const OUString& rQName, + sal_uInt16 nActionMap ) : + XMLTransformerContext( rImp, rQName ), + m_nActionMap( nActionMap ), + m_bStartElementExported( false ) +{ +} + +void XMLMergeElemTransformerContext::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + rtl::Reference<XMLMutableAttributeList> pMutableAttrList = + new XMLMutableAttributeList( rAttrList, 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 ); + bool bRemove = true; + if( XML_NAMESPACE_OFFICE == nPrefix) + { + if (IsXMLToken( aLocalName, XML_DISPLAY ) ) + bRemove = false; + else if (IsXMLToken( aLocalName, XML_AUTHOR ) ) + bRemove = false; + else if (IsXMLToken( aLocalName, XML_CREATE_DATE ) ) + bRemove = false; + else if (IsXMLToken( aLocalName, XML_CREATE_DATE_STRING ) ) + bRemove = false; + } + if (bRemove) + { + pMutableAttrList->RemoveAttributeByIndex( i ); + --i; + --nAttrCount; + } + } +} + +rtl::Reference<XMLTransformerContext> XMLMergeElemTransformerContext::CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const Reference< XAttributeList >& rAttrList ) +{ + rtl::Reference<XMLTransformerContext> pContext; + + 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_ETACTION_MOVE_TO_ATTR_RNG2ISO_DATETIME: + { + rtl::Reference<XMLPersTextContentTContext> pTC( + new XMLPersTextContentRNGTransformTContext( + GetTransformer(), rQName, + (*aIter).second.GetQNamePrefixFromParam1(), + (*aIter).second.GetQNameTokenFromParam1() )); + m_aChildContexts.push_back(pTC); + pContext = pTC; + } + break; + case XML_ETACTION_MOVE_TO_ATTR: + { + rtl::Reference<XMLPersTextContentTContext> pTC( + new XMLPersTextContentTContext( + GetTransformer(), rQName, + (*aIter).second.GetQNamePrefixFromParam1(), + (*aIter).second.GetQNameTokenFromParam1() )); + m_aChildContexts.push_back(pTC); + pContext = pTC; + } + break; + case XML_ETACTION_EXTRACT_CHARACTERS: + { + if( !m_bStartElementExported ) + ExportStartElement(); + pContext.set( + new XMLParagraphTransformerContext( GetTransformer(), + rQName)); + } + break; + default: + OSL_ENSURE( false, "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(); + pContext.set( + new XMLParagraphTransformerContext( GetTransformer(), + rQName)); + } + break; + default: + OSL_ENSURE( false, "unknown action" ); + break; + } + } + } + } + + // default is copying + if( !pContext.is() ) + { + 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 +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/MergeElemTContext.hxx b/xmloff/source/transform/MergeElemTContext.hxx new file mode 100644 index 000000000..9e6cc6f97 --- /dev/null +++ b/xmloff/source/transform/MergeElemTContext.hxx @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <rtl/ref.hxx> +#include "FlatTContext.hxx" +#include <vector> + +typedef ::std::vector< ::rtl::Reference< XMLPersTextContentTContext> > + XMLPersTextContentTContextVector; + +class XMLMergeElemTransformerContext : public XMLTransformerContext +{ + css::uno::Reference< css::xml::sax::XAttributeList > m_xAttrList; + XMLPersTextContentTContextVector m_aChildContexts; + sal_uInt16 const m_nActionMap; + bool m_bStartElementExported; + + void ExportStartElement(); + +public: + XMLMergeElemTransformerContext( XMLTransformerBase& rTransformer, + const OUString& rQName, + sal_uInt16 nActionMap ); + + virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + + virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + + virtual void EndElement() override; + + virtual void Characters( const OUString& rChars ) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/MetaTContext.cxx b/xmloff/source/transform/MetaTContext.cxx new file mode 100644 index 000000000..1e2ca46e5 --- /dev/null +++ b/xmloff/source/transform/MetaTContext.cxx @@ -0,0 +1,131 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#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/namespacemap.hxx> +#include <xmloff/xmltoken.hxx> +#include <xmloff/xmlnamespace.hxx> + +#include "TransformerBase.hxx" +#include "MutableAttrList.hxx" +#include "MetaTContext.hxx" + +using namespace ::xmloff::token; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; + +XMLTokenEnum const 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 +}; + +XMLMetaTransformerContext::XMLMetaTransformerContext( XMLTransformerBase& rImp, + const OUString& rQName ) : + XMLTransformerContext( rImp, rQName ) +{ +} + +XMLMetaTransformerContext::~XMLMetaTransformerContext() +{ +} + +rtl::Reference<XMLTransformerContext> XMLMetaTransformerContext::CreateChildContext( + sal_uInt16 /*nPrefix*/, + const OUString& rLocalName, + const OUString& rQName, + const Reference< XAttributeList >& ) +{ + rtl::Reference<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 const *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 +} + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/MetaTContext.hxx b/xmloff/source/transform/MetaTContext.hxx new file mode 100644 index 000000000..23b5dc29f --- /dev/null +++ b/xmloff/source/transform/MetaTContext.hxx @@ -0,0 +1,66 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <rtl/ref.hxx> +#include <map> + +#include "FlatTContext.hxx" + +typedef ::std::multimap< OUString, + ::rtl::Reference< XMLPersTextContentTContext > > XMLMetaContexts_Impl; + + +class XMLMetaTransformerContext : public XMLTransformerContext +{ + XMLMetaContexts_Impl m_aContexts; + +public: + // 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 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() override; + + // Create a children element context. By default, the import's + // CreateContext method is called to create a new default context. + virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + + // EndElement is called before a context will be destructed, but + // after an elements context has been parsed. It may be used for actions + // that require virtual methods. The default is to do nothing. + virtual void EndElement() override; + + // This method is called for all characters that are contained in the + // current element. The default is to ignore them. + virtual void Characters( const OUString& rChars ) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/MutableAttrList.cxx b/xmloff/source/transform/MutableAttrList.cxx new file mode 100644 index 000000000..f6fc026ae --- /dev/null +++ b/xmloff/source/transform/MutableAttrList.cxx @@ -0,0 +1,163 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <xmloff/attrlist.hxx> +#include <comphelper/servicehelper.hxx> +#include "MutableAttrList.hxx" + + +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.get(); +} + +XMLMutableAttributeList::XMLMutableAttributeList() : + m_pMutableAttrList( new SvXMLAttributeList ) +{ + m_xAttrList = m_pMutableAttrList; +} + +XMLMutableAttributeList::XMLMutableAttributeList( const Reference< + XAttributeList> & rAttrList, bool bClone ) : + m_xAttrList( rAttrList.is() ? rAttrList : new SvXMLAttributeList ) +{ + if( bClone ) + GetMutableAttrList(); +} + + +XMLMutableAttributeList::~XMLMutableAttributeList() +{ + m_xAttrList = nullptr; +} + +const css::uno::Sequence<sal_Int8>& XMLMutableAttributeList::getUnoTunnelId() noexcept +{ + static const comphelper::UnoIdInit theXMLMutableAttributeListUnoTunnelId; + return theXMLMutableAttributeListUnoTunnelId.getSeq(); +} + +// XUnoTunnel +sal_Int64 SAL_CALL XMLMutableAttributeList::getSomething( + const Sequence< sal_Int8 >& rId ) +{ + return comphelper::getSomethingImpl(rId, this); +} + +sal_Int16 SAL_CALL XMLMutableAttributeList::getLength() +{ + return m_xAttrList->getLength(); +} + + +OUString SAL_CALL XMLMutableAttributeList::getNameByIndex(sal_Int16 i) +{ + return m_xAttrList->getNameByIndex( i ); +} + + +OUString SAL_CALL XMLMutableAttributeList::getTypeByIndex(sal_Int16 i) +{ + return m_xAttrList->getTypeByIndex( i ); +} + +OUString SAL_CALL XMLMutableAttributeList::getValueByIndex(sal_Int16 i) +{ + return m_xAttrList->getValueByIndex( i ); +} + +OUString SAL_CALL XMLMutableAttributeList::getTypeByName( + const OUString& rName ) +{ + return m_xAttrList->getTypeByName( rName ); +} + +OUString SAL_CALL XMLMutableAttributeList::getValueByName( + const OUString& rName) +{ + return m_xAttrList->getValueByName( rName ); +} + + +Reference< XCloneable > XMLMutableAttributeList::createClone() +{ + // 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 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< css::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; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/MutableAttrList.hxx b/xmloff/source/transform/MutableAttrList.hxx new file mode 100644 index 000000000..c025ffc5c --- /dev/null +++ b/xmloff/source/transform/MutableAttrList.hxx @@ -0,0 +1,76 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <com/sun/star/util/XCloneable.hpp> +#include <com/sun/star/xml/sax/XAttributeList.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> + +#include <cppuhelper/implbase.hxx> +#include <rtl/ref.hxx> + +class SvXMLAttributeList; + +class XMLMutableAttributeList : public ::cppu::WeakImplHelper< + css::xml::sax::XAttributeList, + css::util::XCloneable, + css::lang::XUnoTunnel> +{ + css::uno::Reference< css::xml::sax::XAttributeList> m_xAttrList; + + rtl::Reference<SvXMLAttributeList> m_pMutableAttrList; + + SvXMLAttributeList *GetMutableAttrList(); + +public: + XMLMutableAttributeList(); + XMLMutableAttributeList( const css::uno::Reference< + css::xml::sax::XAttributeList> & rAttrList, + bool bClone=false ); + virtual ~XMLMutableAttributeList() override; + + // XUnoTunnel + static const css::uno::Sequence<sal_Int8>& getUnoTunnelId() noexcept; + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + + // css::xml::sax::XAttributeList + virtual sal_Int16 SAL_CALL getLength() override; + virtual OUString SAL_CALL getNameByIndex(sal_Int16 i) override; + virtual OUString SAL_CALL getTypeByIndex(sal_Int16 i) override; + virtual OUString SAL_CALL getTypeByName(const OUString& aName) override; + virtual OUString SAL_CALL getValueByIndex(sal_Int16 i) override; + virtual OUString SAL_CALL getValueByName(const OUString& aName) override; + + // css::util::XCloneable + virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override; + + // methods that are not contained in any interface + void SetValueByIndex( sal_Int16 i, const OUString& rValue ); + void AddAttribute( const OUString &sName , const OUString &sValue ); +// void Clear(); + void RemoveAttributeByIndex( sal_Int16 i ); + void RenameAttributeByIndex( sal_Int16 i, const OUString& rNewName ); + void AppendAttributeList( const css::uno::Reference< css::xml::sax::XAttributeList > & ); + + sal_Int16 GetIndexByName( const OUString& rName ) const; +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/NotesTContext.cxx b/xmloff/source/transform/NotesTContext.cxx new file mode 100644 index 000000000..9cd3b2e57 --- /dev/null +++ b/xmloff/source/transform/NotesTContext.cxx @@ -0,0 +1,217 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#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 <osl/diagnose.h> +#include <xmloff/namespacemap.hxx> +#include <xmloff/xmltoken.hxx> +#include <xmloff/xmlnamespace.hxx> + +#include "TransformerBase.hxx" +#include "TransformerActions.hxx" +#include "AttrTransformerAction.hxx" +#include "ActionMapTypesOASIS.hxx" +#include "MutableAttrList.hxx" +#include "RenameElemTContext.hxx" +#include "FlatTContext.hxx" + +#include "NotesTContext.hxx" + +using namespace ::xmloff::token; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; + +XMLNotesTransformerContext::XMLNotesTransformerContext( + XMLTransformerBase& rImp, + const OUString& rQName, + XMLTokenEnum eToken, bool bPersistent ) : + XMLPersElemContentTContext( rImp, rQName ), + m_bEndNote( 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 ); + rtl::Reference<XMLMutableAttributeList> pMutableAttrList; + 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 = true; + } + pMutableAttrList->RemoveAttributeByIndex( i ); + --i; + --nAttrCount; + } + break; + case XML_ATACTION_DECODE_STYLE_NAME: + case XML_ATACTION_DECODE_STYLE_NAME_REF: + { + OUString aAttrValue( rAttrValue ); + if( XMLTransformerBase::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() ); + } +} + +rtl::Reference<XMLTransformerContext> XMLNotesTransformerContext::CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const Reference< XAttributeList >& rAttrList ) +{ + rtl::Reference<XMLTransformerContext> pContext; + 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.set(new XMLPersTextContentTContext( + GetTransformer(), rQName, + XML_NAMESPACE_TEXT, + eToken )); + AddContent( pContext ); + + } + else + { + pContext.set(new XMLRenameElemTransformerContext( + GetTransformer(), rQName, + XML_NAMESPACE_TEXT, + eToken )); + } + } + } + } + + if( !pContext.is() ) + { + pContext = m_bPersistent + ? XMLPersElemContentTContext::CreateChildContext( + nPrefix, rLocalName, rQName, rAttrList ) + : XMLTransformerContext::CreateChildContext( + nPrefix, rLocalName, rQName, rAttrList ); + } + + return pContext; +} + +bool XMLNotesTransformerContext::IsPersistent() const +{ + return m_bPersistent; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/NotesTContext.hxx b/xmloff/source/transform/NotesTContext.hxx new file mode 100644 index 000000000..b6bfbf880 --- /dev/null +++ b/xmloff/source/transform/NotesTContext.hxx @@ -0,0 +1,49 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include "DeepTContext.hxx" + +class XMLNotesTransformerContext : public XMLPersElemContentTContext +{ + bool m_bEndNote; + bool const m_bPersistent; + ::xmloff::token::XMLTokenEnum m_eTypeToken; + +public: + XMLNotesTransformerContext( XMLTransformerBase& rTransformer, + const OUString& rQName, + ::xmloff::token::XMLTokenEnum m_eToken, + bool bPersistent ); + + virtual ~XMLNotesTransformerContext() override; + + virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + + virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + virtual void EndElement() override; + + virtual bool IsPersistent() const override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/OOo2Oasis.cxx b/xmloff/source/transform/OOo2Oasis.cxx new file mode 100644 index 000000000..12fe384a5 --- /dev/null +++ b/xmloff/source/transform/OOo2Oasis.cxx @@ -0,0 +1,2098 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <config_wasm_strip.h> + +#include <osl/diagnose.h> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <comphelper/base64.hxx> +#include <comphelper/processfactory.hxx> +#include <comphelper/servicehelper.hxx> +#include <xmloff/namespacemap.hxx> +#include <xmloff/xmlnamespace.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 "OOo2Oasis.hxx" +#include <cppuhelper/supportsservice.hxx> +#include <cppuhelper/typeprovider.hxx> +#include <tools/diagnose_ex.h> + +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; + +namespace { + +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 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 +static constexpr sal_Int32 RENAME_ENTRY( XMLTokenEnum f, XMLTokenEnum s ) +{ + return static_cast< sal_Int32 >(f) | (static_cast< sal_Int32 >(s) << 16); +} + +XMLTransformerActionInit const 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 ), + /* Consider also attribute table:style-name for <table:table>, + <table:table-row> and <table:table-column>. (#i40011#, #i40015#) + */ + 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 ), + + // fix id strings in old animation elements + ENTRY1( PRESENTATION, DIM, XML_ETACTION_PROC_ATTRS, OOO_ANIMATION_ACTIONS ), + ENTRY1( PRESENTATION, PLAY, XML_ETACTION_PROC_ATTRS, OOO_ANIMATION_ACTIONS ), + ENTRY1( PRESENTATION, SHOW_TEXT, XML_ETACTION_PROC_ATTRS, OOO_ANIMATION_ACTIONS ), + ENTRY1( PRESENTATION, SHOW_SHAPE, XML_ETACTION_PROC_ATTRS, OOO_ANIMATION_ACTIONS ), + ENTRY1( PRESENTATION, HIDE_TEXT, XML_ETACTION_PROC_ATTRS, OOO_ANIMATION_ACTIONS ), + ENTRY1( PRESENTATION, HIDE_SHAPE, XML_ETACTION_PROC_ATTRS, OOO_ANIMATION_ACTIONS ), + + ENTRY0( OFFICE, TOKEN_INVALID, XML_ETACTION_EOT ) +}; + +// XML_ETACTION_STYLE +XMLTransformerActionInit const 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_uInt32(true) ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OOO_FRAME_ELEM_ACTIONS +XMLTransformerActionInit const 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 +XMLTransformerActionInit const 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 +XMLTransformerActionInit const 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 +XMLTransformerActionInit const 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 ) +}; + +XMLTransformerActionInit const 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 +XMLTransformerActionInit const 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 +XMLTransformerActionInit const 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_uInt32(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 appropriate +XMLTransformerActionInit const 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_uInt32(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( DRAW, ID, XML_ATACTION_SHAPEID ), + ENTRY0( DRAW, START_SHAPE, XML_ATACTION_SHAPEID ), + ENTRY0( DRAW, END_SHAPE, XML_ATACTION_SHAPEID ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +XMLTransformerActionInit const 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_uInt32(true) ), + ENTRY0( DRAW, ID, XML_ATACTION_SHAPEID ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OOO_INDEX_ENTRY_TAB_STOP_ACTIONS +XMLTransformerActionInit const 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 +XMLTransformerActionInit const 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 +XMLTransformerActionInit const 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 ) +}; + +XMLTransformerActionInit const 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 +XMLTransformerActionInit const aDropCapActionTable[] = +{ + ENTRY0( STYLE, DISTANCE, XML_ATACTION_INCH2IN ), + ENTRY0( STYLE, STYLE_NAME, XML_ATACTION_ENCODE_STYLE_NAME_REF ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +XMLTransformerActionInit const 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 +XMLTransformerActionInit const 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 +XMLTransformerActionInit const 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 +XMLTransformerActionInit const 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 +XMLTransformerActionInit const 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 +XMLTransformerActionInit const aBackgroundImageActionTable[] = +{ + ENTRY1Q( DRAW, TRANSPARENCY, XML_ATACTION_RENAME_NEG_PERCENT, + XML_NAMESPACE_DRAW, XML_OPACITY ), + ENTRY1( XLINK, HREF, XML_ATACTION_URI_OOO, sal_uInt32(true) ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +/* 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 (#i50322#) +*/ +XMLTransformerActionInit const aWriterBackgroundImageActionTable[] = +{ + ENTRY1Q( DRAW, TRANSPARENCY, XML_ATACTION_WRITER_BACK_GRAPHIC_TRANSPARENCY, XML_NAMESPACE_DRAW, XML_OPACITY ), + ENTRY1( XLINK, HREF, XML_ATACTION_URI_OOO, sal_uInt32(true) ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OOO_DDE_CONNECTION_DECL +XMLTransformerActionInit const aDDEConnectionDeclActionTable[] = +{ + ENTRY1Q( TEXT, NAME, XML_ATACTION_RENAME, + XML_NAMESPACE_OFFICE, XML_NAME ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OOO_FORM_CONTROL_ACTIONS +XMLTransformerActionInit const 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_uInt32(false) ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OOO_FORM_COLUMN_ACTIONS +XMLTransformerActionInit const 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 +XMLTransformerActionInit const 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 +XMLTransformerActionInit const aXLinkActionTable[] = +{ + ENTRY1( XLINK, HREF, XML_ATACTION_URI_OOO, sal_uInt32(false) ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OOO_CONFIG_ITEM_SET_ACTIONS +XMLTransformerActionInit const aConfigItemSetActionTable[] = +{ + ENTRY1( CONFIG, NAME, XML_ATACTION_ADD_NAMESPACE_PREFIX, + XML_NAMESPACE_OOO ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_FORMULA_ACTIONS +XMLTransformerActionInit const 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 +XMLTransformerActionInit const aErrorMacroActionTable[] = +{ + ENTRY0( TABLE, NAME, XML_ATACTION_REMOVE ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OOO_DDE_CONV_MODE_ACTIONS +XMLTransformerActionInit const 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 +XMLTransformerActionInit const 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 +XMLTransformerActionInit const 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 +XMLTransformerActionInit const aSourceServiceActionTable[] = +{ + ENTRY1Q( TABLE, USERNAME, XML_ATACTION_RENAME, + XML_NAMESPACE_TABLE, XML_USER_NAME ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OOO_ANIMATION_ACTIONS +XMLTransformerActionInit const aAnimationsActionTable[] = +{ + ENTRY0( DRAW, SHAPE_ID, XML_ATACTION_SHAPEID ), + ENTRY0( PRESENTATION, PATH_ID, XML_ATACTION_SHAPEID ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OOO_DRAW_AREA_POLYGON_ACTIONS (to be added to OOO_SHAPE_ACTIONS) +XMLTransformerActionInit const aDrawAreaPolygonActionTable[] = +{ + ENTRY1Q( SVG, POINTS, XML_ATACTION_RENAME, + XML_NAMESPACE_DRAW, XML_POINTS ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OOO_CHART_ACTIONS +XMLTransformerActionInit const 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 +XMLTransformerActionInit const aAlphabeticalIndexMarkActionTable[] = +{ + ENTRY1Q( TEXT, MAIN_ETRY, XML_ATACTION_RENAME, + XML_NAMESPACE_TEXT, XML_MAIN_ENTRY ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OOO_SCRIPT_ACTIONS +XMLTransformerActionInit const 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 ) +}; + +XMLTokenEnum const 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 +}; + +namespace { + +class XMLDocumentTransformerContext_Impl : public XMLTransformerContext +{ + OUString const m_aElemQName; + OUString m_aOldClass; + +public: + XMLDocumentTransformerContext_Impl( XMLTransformerBase& rTransformer, + const OUString& rQName ); + XMLDocumentTransformerContext_Impl( XMLTransformerBase& rTransformer, + const OUString& rQName, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken ); + + virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + virtual void EndElement() override; +}; + +} + +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 ) ) ) +{ +} + +void XMLDocumentTransformerContext_Impl::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + Reference< XAttributeList > xAttrList( rAttrList ); + + m_aOldClass = GetTransformer().GetClass(); + + rtl::Reference<XMLMutableAttributeList> pMutableAttrList; + bool bOOo = false, bOOoW = false, bOOoC = false, + bDOM=false, bDC = false, bSVG = 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 = "application/vnd.oasis.opendocument." + 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 = true; + else if( IsXMLToken( rAttrValue, XML_N_OOOW ) ) + bOOoW = true; + else if( IsXMLToken( rAttrValue, XML_N_OOOC ) ) + bOOoC = true; + else if( IsXMLToken( rAttrValue, XML_N_DOM ) ) + bDOM = true; + else if( IsXMLToken( rAttrValue, XML_N_DC ) ) + bDC = true; + else if( IsXMLToken( rAttrValue, XML_N_SVG ) ) + bSVG = 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 ); +} + +namespace { + +class XMLBodyTransformerContext_Impl : public XMLTransformerContext +{ + OUString m_aClassQName; + +public: + XMLBodyTransformerContext_Impl( XMLTransformerBase& rTransformer, + const OUString& rQName ); + + virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + virtual void EndElement() override; +}; + +} + +XMLBodyTransformerContext_Impl::XMLBodyTransformerContext_Impl( + XMLTransformerBase& rImp, + const OUString& rQName ) : + XMLTransformerContext( rImp, rQName ) +{ +} + +void XMLBodyTransformerContext_Impl::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + XMLTransformerContext::StartElement( rAttrList ); + + rtl::Reference<XMLMutableAttributeList> pMutableAttrList = + new XMLMutableAttributeList( rAttrList ); + Reference< XAttributeList > xAttrList = pMutableAttrList; + OUString aClass( GetTransformer().GetClass() ); + if( aClass.isEmpty() ) + { + 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(); +} + +namespace { + +class XMLTabStopOOoTContext_Impl : public XMLPersElemContentTContext +{ +public: + XMLTabStopOOoTContext_Impl( XMLTransformerBase& rTransformer, + const OUString& rQName ); + + virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; +}; + +} + +XMLTabStopOOoTContext_Impl::XMLTabStopOOoTContext_Impl( + XMLTransformerBase& rImp, + const OUString& rQName ) : + XMLPersElemContentTContext( rImp, rQName ) +{ +} + +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 ); + rtl::Reference<XMLMutableAttributeList> pMutableAttrList; + 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.isEmpty() && + 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( false, "unknown action" ); + break; + } + } + } + + XMLPersElemContentTContext::StartElement( xAttrList ); +} + +namespace { + +class XMLTrackedChangesOOoTContext_Impl : public XMLTransformerContext +{ + sal_uInt16 const m_nPrefix; + XMLTokenEnum const m_eToken; + +public: + XMLTrackedChangesOOoTContext_Impl( XMLTransformerBase& rTransformer, + const OUString& rQName, + sal_uInt16 nPrefix, + XMLTokenEnum eToken ); + + virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; +}; + +} + +XMLTrackedChangesOOoTContext_Impl::XMLTrackedChangesOOoTContext_Impl( + XMLTransformerBase& rImp, + const OUString& rQName, + sal_uInt16 nPrefix, + XMLTokenEnum eToken ) : + XMLTransformerContext( rImp, rQName ), + m_nPrefix( nPrefix ), + m_eToken( eToken ) +{ +} + +void XMLTrackedChangesOOoTContext_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( m_nPrefix == nPrefix && IsXMLToken( aLocalName, m_eToken ) ) + { + const Reference< XPropertySet > rPropSet = + GetTransformer().GetPropertySet(); + OSL_ENSURE( rPropSet.is(), "no info property set" ); + if( rPropSet.is() ) + { + OUString aPropName("RedlineProtectionKey"); + Reference< XPropertySetInfo > xPropSetInfo( + rPropSet->getPropertySetInfo() ); + if( xPropSetInfo.is() && + xPropSetInfo->hasPropertyByName( aPropName ) ) + { + Sequence < sal_Int8 > aKey; + ::comphelper::Base64::decode( aKey, + rAttrList->getValueByIndex( i ) ); + rPropSet->setPropertyValue( aPropName, Any( aKey ) ); + } + else + { + OSL_ENSURE( false, "RedineProtectionKey is missing" ); + } + } + break; + } + } + XMLTransformerContext::StartElement( rAttrList ); +} + +namespace { + +class XMLTableOOoTransformerContext_Impl : public XMLTransformerContext +{ + OUString const m_aElemQName; + +public: + XMLTableOOoTransformerContext_Impl( XMLTransformerBase& rTransformer, + const OUString& rQName ); + + virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + virtual void EndElement() override; +}; + +} + +XMLTableOOoTransformerContext_Impl::XMLTableOOoTransformerContext_Impl( + XMLTransformerBase& rImp, + const OUString& rQName ) : + XMLTransformerContext( rImp, rQName ), + m_aElemQName( rQName ) +{ +} + +void XMLTableOOoTransformerContext_Impl::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + // Perform OOO_STYLE_REF_ACTIONS for all applications (#i50521#) + Reference< XAttributeList > xAttrList( rAttrList ); + XMLMutableAttributeList* pMutableAttrList = + GetTransformer().ProcessAttrList( xAttrList, OOO_STYLE_REF_ACTIONS, false ); + if( rAttrList->getLength() && IsXMLToken( GetTransformer().GetClass(), XML_SPREADSHEET ) ) + { + bool bPrintRanges(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 = 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, + 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 ); +#if !ENABLE_WASM_STRIP_CHART + case XML_ETACTION_CHART: + return new XMLChartOOoTransformerContext( *this, rQName ); + case XML_ETACTION_CHART_PLOT_AREA: + return new XMLChartPlotAreaOOoTContext( *this, rQName ); +#endif + case XML_ETACTION_TRACKED_CHANGES: + return new XMLTrackedChangesOOoTContext_Impl( *this, rQName, + rAction.GetQNamePrefixFromParam1(), + rAction.GetQNameTokenFromParam1() ); + case XML_ETACTION_TABLE: + return new XMLTableOOoTransformerContext_Impl( *this, rQName ); + default: + OSL_ENSURE( false, "no user defined context found!" ); + } + + // default is copying + return new XMLTransformerContext( *this, rQName ); +} + +XMLTransformerActions *OOo2OasisTransformer::GetUserDefinedActions( + sal_uInt16 n ) +{ + XMLTransformerActions *pActions = nullptr; + if( n < MAX_OOO_ACTIONS ) + { + if( !m_aActions[n] ) + { + if( n<MAX_OOO_PROP_ACTIONS ) + { + m_aActions[n].reset( + XMLStyleOOoTContext::CreateTransformerActions( n ) ); + } + else switch( n ) + { + case OOO_STYLE_ACTIONS: + m_aActions[OOO_STYLE_ACTIONS].reset( + new XMLTransformerActions( aStyleActionTable ) ); + break; + case OOO_FONT_DECL_ACTIONS: + m_aActions[OOO_FONT_DECL_ACTIONS].reset( + new XMLTransformerActions( aFontDeclActionTable ) ); + break; + case OOO_SHAPE_ACTIONS: + m_aActions[OOO_SHAPE_ACTIONS].reset( + new XMLTransformerActions( aShapeActionTable ) ); + break; + case OOO_CONNECTOR_ACTIONS: + m_aActions[OOO_CONNECTOR_ACTIONS].reset( + new XMLTransformerActions( aConnectorActionTable ) ); + break; + case OOO_TAB_STOP_ACTIONS: + m_aActions[OOO_TAB_STOP_ACTIONS].reset( + new XMLTransformerActions( aTabStopActionTable ) ); + break; + case OOO_INDEX_ENTRY_TAB_STOP_ACTIONS: + m_aActions[OOO_INDEX_ENTRY_TAB_STOP_ACTIONS].reset( + new XMLTransformerActions( aIndexEntryTabStopActionTable ) ); + break; + case OOO_LINENUMBERING_ACTIONS: + m_aActions[OOO_LINENUMBERING_ACTIONS].reset( + new XMLTransformerActions( aLineNumberingActionTable ) ); + break; + case OOO_FOOTNOTE_SEP_ACTIONS: + m_aActions[OOO_FOOTNOTE_SEP_ACTIONS].reset( + new XMLTransformerActions( aFootnoteSepActionTable ) ); + break; + case OOO_DROP_CAP_ACTIONS: + m_aActions[OOO_DROP_CAP_ACTIONS].reset( + new XMLTransformerActions( aDropCapActionTable ) ); + break; + case OOO_COLUMNS_ACTIONS: + m_aActions[OOO_COLUMNS_ACTIONS].reset( + new XMLTransformerActions( aColumnsActionTable ) ); + break; + case OOO_TEXT_VALUE_TYPE_ACTIONS: + m_aActions[OOO_TEXT_VALUE_TYPE_ACTIONS].reset( + new XMLTransformerActions( aTextValueTypeActionTable ) ); + break; + case OOO_TABLE_VALUE_TYPE_ACTIONS: + m_aActions[OOO_TABLE_VALUE_TYPE_ACTIONS].reset( + new XMLTransformerActions( aTableValueTypeActionTable ) ); + break; + case OOO_PARA_ACTIONS: + m_aActions[OOO_PARA_ACTIONS].reset( + new XMLTransformerActions( aParaActionTable ) ); + break; + case OOO_STYLE_REF_ACTIONS: + m_aActions[OOO_STYLE_REF_ACTIONS].reset( + new XMLTransformerActions( aStyleRefActionTable ) ); + break; + case OOO_MASTER_PAGE_ACTIONS: + m_aActions[OOO_MASTER_PAGE_ACTIONS].reset( + new XMLTransformerActions( aMasterPageActionTable ) ); + break; + case OOO_ANNOTATION_ACTIONS: + m_aActions[OOO_ANNOTATION_ACTIONS].reset( + new XMLTransformerActions( aAnnotationActionTable ) ); + break; + case OOO_CHANGE_INFO_ACTIONS: + m_aActions[OOO_CHANGE_INFO_ACTIONS].reset( + new XMLTransformerActions( aChangeInfoActionTable ) ); + break; + case OOO_FRAME_ELEM_ACTIONS: + m_aActions[OOO_FRAME_ELEM_ACTIONS].reset( + new XMLTransformerActions( aFrameElemActionTable ) ); + break; + case OOO_FRAME_ATTR_ACTIONS: + m_aActions[OOO_FRAME_ATTR_ACTIONS].reset( + new XMLTransformerActions( aFrameAttrActionTable ) ); + break; + case OOO_BACKGROUND_IMAGE_ACTIONS: + // Use special actions for Writer documents. (#i50322#) + m_aActions[OOO_BACKGROUND_IMAGE_ACTIONS].reset( + isWriter() + ? new XMLTransformerActions( aWriterBackgroundImageActionTable ) + : new XMLTransformerActions( aBackgroundImageActionTable ) ); + break; + case OOO_DDE_CONNECTION_DECL_ACTIONS: + m_aActions[OOO_DDE_CONNECTION_DECL_ACTIONS].reset( + new XMLTransformerActions( aDDEConnectionDeclActionTable ) ); + break; + case OOO_EVENT_ACTIONS: + m_aActions[OOO_EVENT_ACTIONS].reset( + new XMLTransformerActions( aEventActionTable ) ); + break; + case OOO_FORM_CONTROL_ACTIONS: + m_aActions[OOO_FORM_CONTROL_ACTIONS].reset( + new XMLTransformerActions( aFormControlActionTable ) ); + break; + case OOO_FORM_COLUMN_ACTIONS: + m_aActions[OOO_FORM_COLUMN_ACTIONS].reset( + new XMLTransformerActions( aFormColumnActionTable ) ); + break; + case OOO_FORM_PROP_ACTIONS: + m_aActions[OOO_FORM_PROP_ACTIONS].reset( + new XMLTransformerActions( aFormPropActionTable ) ); + break; + case OOO_XLINK_ACTIONS: + m_aActions[OOO_XLINK_ACTIONS].reset( + new XMLTransformerActions( aXLinkActionTable ) ); + break; + case OOO_CONFIG_ITEM_SET_ACTIONS: + m_aActions[OOO_CONFIG_ITEM_SET_ACTIONS].reset( + new XMLTransformerActions( aConfigItemSetActionTable ) ); + break; + case OOO_FORMULA_ACTIONS: + m_aActions[OOO_FORMULA_ACTIONS].reset( + new XMLTransformerActions( aFormulaActionTable ) ); + break; + case OOO_CHART_ACTIONS: + m_aActions[OOO_CHART_ACTIONS].reset( + new XMLTransformerActions( aChartActionTable ) ); + break; + case OOO_ERROR_MACRO_ACTIONS: + m_aActions[OOO_ERROR_MACRO_ACTIONS].reset( + new XMLTransformerActions( aErrorMacroActionTable ) ); + break; + case OOO_DDE_CONV_MODE_ACTIONS: + m_aActions[OOO_DDE_CONV_MODE_ACTIONS].reset( + new XMLTransformerActions( aDDEConvModeActionTable ) ); + break; + case OOO_ALPHABETICAL_INDEX_MARK_ACTIONS: + m_aActions[OOO_ALPHABETICAL_INDEX_MARK_ACTIONS].reset( + new XMLTransformerActions( aAlphabeticalIndexMarkActionTable ) ); + break; + case OOO_DATAPILOT_MEMBER_ACTIONS: + m_aActions[OOO_DATAPILOT_MEMBER_ACTIONS].reset( + new XMLTransformerActions( aDataPilotMemberActionTable ) ); + break; + case OOO_DATAPILOT_LEVEL_ACTIONS: + m_aActions[OOO_DATAPILOT_LEVEL_ACTIONS].reset( + new XMLTransformerActions( aDataPilotLevelActionTable ) ); + break; + case OOO_SOURCE_SERVICE_ACTIONS: + m_aActions[OOO_SOURCE_SERVICE_ACTIONS].reset( + new XMLTransformerActions( aSourceServiceActionTable ) ); + break; + case OOO_DRAW_AREA_POLYGON_ACTIONS: + m_aActions[OOO_DRAW_AREA_POLYGON_ACTIONS].reset( + new XMLTransformerActions( aShapeActionTable ) ); + m_aActions[OOO_DRAW_AREA_POLYGON_ACTIONS] + ->Add( aDrawAreaPolygonActionTable ); + break; + case OOO_SCRIPT_ACTIONS: + m_aActions[OOO_SCRIPT_ACTIONS].reset( + new XMLTransformerActions( aScriptActionTable ) ); + break; + case OOO_ANIMATION_ACTIONS: + m_aActions[OOO_ANIMATION_ACTIONS].reset( + new XMLTransformerActions( aAnimationsActionTable ) ); + break; + } + } + pActions = m_aActions[n].get(); + } + + return pActions; +} + +OUString OOo2OasisTransformer::GetEventName( const OUString& rName, 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( OUString const & rImplName, + OUString const & rSubServiceName ) + noexcept : + XMLTransformerBase( aActionTable, aTokenMap ), + m_aImplName(rImplName), + m_aSubServiceName(rSubServiceName), + m_pEventMap( nullptr ) +{ + 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(auto & rp : m_aActions) + rp.reset(); +} + +OOo2OasisTransformer::~OOo2OasisTransformer() noexcept +{ + for(auto & rp : m_aActions) + rp.reset(); + XMLEventOOoTransformerContext::FlushEventMap( m_pEventMap ); +} + +Any OOo2OasisTransformer::queryInterface( const Type& rType ) +{ + Any aRet; + if ( rType == cppu::UnoType<XImporter>::get()) + { + Reference<XImporter> xThis( this ); + aRet <<= xThis; + } + else if ( rType == cppu::UnoType<XFilter>::get()) + { + Reference<XFilter> xThis( this ); + aRet <<= xThis; + } + else + { + aRet = XMLTransformerBase::queryInterface(rType); + } + + return aRet; +} + +// XImporter +void SAL_CALL OOo2OasisTransformer::setTargetDocument( + const Reference< XComponent >& xDoc ) +{ + 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 ) +{ + Reference< XFilter> xFilter( GetDocHandler(), UNO_QUERY ); + OSL_ENSURE( xFilter.is(), "doc handler is not a filter" ); + if( xFilter.is() ) + return xFilter->filter( aDescriptor ); + + return false; +} + +void SAL_CALL OOo2OasisTransformer::cancel( ) +{ + 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 ) +{ + Initialize( rArguments ); +} + +void SAL_CALL OOo2OasisTransformer::startDocument() +{ + 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 OOo2OasisTransformer::Initialize( + const Sequence< Any >& rArguments ) +{ + OSL_ENSURE( !GetDocHandler().is(), "duplication initialization" ); + + Reference< XInterface > xFilter; + if( !m_aSubServiceName.isEmpty() ) + { + Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); + // get filter component + xFilter = + xContext->getServiceManager()->createInstanceWithArgumentsAndContext(m_aSubServiceName, rArguments, xContext); + SAL_WARN_IF(!xFilter, "xmloff", "could not instantiate " << m_aSubServiceName); + } + else + SAL_WARN("xmloff", "no subservice name"); + + if (xFilter.is()) + { + Sequence<Any> aArgs( 1 + rArguments.getLength() ); + auto pArgs = aArgs.getArray(); + pArgs[0] <<= xFilter; + std::copy(rArguments.begin(), rArguments.end(), std::next(pArgs)); + XMLTransformerBase::initialize( aArgs ); + + OSL_ENSURE( GetDocHandler() == xFilter, + "duplicate doc handler" ); + } + else + { + XMLTransformerBase::initialize( rArguments ); + } +} + +const css::uno::Sequence<sal_Int8>& OOo2OasisTransformer::getUnoTunnelId() noexcept +{ + static const comphelper::UnoIdInit theOOo2OasisTransformerUnoTunnelId; + return theOOo2OasisTransformerUnoTunnelId.getSeq(); +} + +// XUnoTunnel +sal_Int64 SAL_CALL OOo2OasisTransformer::getSomething( const Sequence< sal_Int8 >& rId ) +{ + return comphelper::getSomethingImpl(rId, this); +} + +// XServiceInfo +OUString SAL_CALL OOo2OasisTransformer::getImplementationName() +{ + return m_aImplName; +} + +sal_Bool SAL_CALL OOo2OasisTransformer::supportsService( const OUString& ServiceName ) +{ + return cppu::supportsService(this, ServiceName); +} + +Sequence< OUString > SAL_CALL OOo2OasisTransformer::getSupportedServiceNames( ) +{ + return { }; +} + +// XTypeProvider +Sequence< css::uno::Type > SAL_CALL OOo2OasisTransformer::getTypes() +{ + return cppu::OTypeCollection( + cppu::UnoType<XImporter>::get(), + cppu::UnoType<XFilter>::get(), + XMLTransformerBase::getTypes() + ).getTypes(); +} + +// Service registration + +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +xmloff_OOo2OasisTransformer_get_implementation( + css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&) +{ + return cppu::acquire(new OOo2OasisTransformer("com.sun.star.comp.OOo2OasisTransformer", OUString())); +} + +#define OOO_IMPORTER( className, implName, subServiceName ) \ +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* \ +xmloff_##className##_get_implementation( \ + css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&) \ +{ \ + return cppu::acquire(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" ) + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/OOo2Oasis.hxx b/xmloff/source/transform/OOo2Oasis.hxx new file mode 100644 index 000000000..43d69853f --- /dev/null +++ b/xmloff/source/transform/OOo2Oasis.hxx @@ -0,0 +1,102 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <com/sun/star/document/XImporter.hpp> +#include <com/sun/star/document/XFilter.hpp> +#include "ActionMapTypesOOo.hxx" +#include "TransformerBase.hxx" + +class XMLTransformerOOoEventMap_Impl; + +class OOo2OasisTransformer : + public XMLTransformerBase, + public css::document::XImporter, + public css::document::XFilter +{ + OUString const m_aImplName; + OUString const m_aSubServiceName; + + std::unique_ptr<XMLTransformerActions> m_aActions[MAX_OOO_ACTIONS]; + XMLTransformerOOoEventMap_Impl *m_pEventMap; +protected: + + virtual XMLTransformerContext *CreateUserDefinedContext( + const TransformerAction_Impl& rAction, + const OUString& rQName, + bool bPersistent=false ) override; + + virtual XMLTransformerActions *GetUserDefinedActions( sal_uInt16 n ) override; + +public: + OOo2OasisTransformer( OUString const & rImplName, + OUString const & rSubServiceName ) noexcept; + virtual ~OOo2OasisTransformer() noexcept override; + + // XInterface + + // (XInterface methods need to be implemented to disambiguate + // between those inherited through XMLTransformerBase and + // the new interfaces). + + virtual css::uno::Any SAL_CALL queryInterface( + const css::uno::Type& aType ) override; + + virtual void SAL_CALL acquire( ) noexcept override + { XMLTransformerBase::acquire(); }; + + virtual void SAL_CALL release( ) noexcept override + { XMLTransformerBase::release(); }; + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override; + + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + + // XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + + // XUnoTunnel + static const css::uno::Sequence<sal_Int8>& getUnoTunnelId() noexcept; + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + + // XImporter + virtual void SAL_CALL setTargetDocument( const css::uno::Reference< css::lang::XComponent >& xDoc ) override; + + // XFilter + virtual sal_Bool SAL_CALL filter( const css::uno::Sequence< css::beans::PropertyValue >& aDescriptor ) override; + virtual void SAL_CALL cancel( ) override; + + /// @throws css::uno::Exception + /// @throws css::uno::RuntimeException + void Initialize( const css::uno::Sequence< css::uno::Any >& aArguments ); + + // css::xml::sax::XDocumentHandler + virtual void SAL_CALL startDocument() override; + + virtual OUString GetEventName( const OUString& rName, + bool bForm = false ) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/Oasis2OOo.cxx b/xmloff/source/transform/Oasis2OOo.cxx new file mode 100644 index 000000000..7a74d2ab4 --- /dev/null +++ b/xmloff/source/transform/Oasis2OOo.cxx @@ -0,0 +1,1984 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <comphelper/base64.hxx> +#include <com/sun/star/beans/XPropertySetInfo.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <rtl/ustrbuf.hxx> +#include <sal/log.hxx> +#include <xmloff/namespacemap.hxx> +#include <xmloff/xmlnamespace.hxx> +#include <xmloff/xmltoken.hxx> +#include "DeepTContext.hxx" +#include "MetaTContext.hxx" +#include "DocumentTContext.hxx" +#include "NotesTContext.hxx" +#include "StyleOASISTContext.hxx" +#include "FrameOASISTContext.hxx" +#include "EventOASISTContext.hxx" +#include "DlgOASISTContext.hxx" +#include "ControlOASISTContext.hxx" +#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 <comphelper/servicehelper.hxx> +#include "Oasis2OOo.hxx" +#include <cppuhelper/supportsservice.hxx> + +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; + +namespace { + +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 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 ) + +// a macro to put two tokens into one sal_Int32 for the action +// XML_ATACTION_RENAME_ATTRIBUTE +static constexpr sal_Int32 RENAME_ENTRY( XMLTokenEnum f, XMLTokenEnum s ) +{ + return static_cast< sal_Int32 >(f) | (static_cast< sal_Int32 >(s) << 16); +} + +XMLTransformerActionInit const 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 currently 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 table: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 */ + // Conversion of attribute <table:style-name> for <table:table-row> and + // <table:table-column> (#i40011#, #i40015#) + 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 +XMLTransformerActionInit const 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_uInt32(true) ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_FRAME_ELEM_ACTIONS +XMLTransformerActionInit const 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 +XMLTransformerActionInit const 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 +XMLTransformerActionInit const aDlgActionTable[] = +{ + ENTRY0( DLG, BORDER, XML_ATACTION_DLG_BORDER ) +}; + +// action table for OASIS_MASTER_PAGE_ACTIONS +XMLTransformerActionInit const 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 +XMLTransformerActionInit const 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_uInt32(false) ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// action table for OASIS_PARA_STYLE_REF_ACTIONS +XMLTransformerActionInit const 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 +XMLTransformerActionInit const 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 +XMLTransformerActionInit const 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 +XMLTransformerActionInit const aMapStyleRefActionTable[] = +{ + ENTRY1( STYLE, APPLY_STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, + XML_FAMILY_TYPE_END ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// action table for OASIS_TABLE_STYLE_REF_ACTIONS (#i40011#, #i40015#) +XMLTransformerActionInit const aTableStyleRefActionTable[] = +{ + ENTRY1( TABLE, STYLE_NAME, XML_ATACTION_DECODE_STYLE_NAME_REF, + XML_FAMILY_TYPE_END ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +XMLTransformerActionInit const 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 +XMLTransformerActionInit const 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 appropriate +XMLTransformerActionInit const 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_uInt32(true) ), + + // 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 +XMLTransformerActionInit const 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 +XMLTransformerActionInit const 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_uInt32(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 +XMLTransformerActionInit const 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 +XMLTransformerActionInit const 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 +XMLTransformerActionInit const 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 ) +}; + +XMLTransformerActionInit const 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) +XMLTransformerActionInit const 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 +XMLTransformerActionInit const 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 ) +}; + +XMLTransformerActionInit const 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 +XMLTransformerActionInit const 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 +XMLTransformerActionInit const 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 +XMLTransformerActionInit const aAnnotationActionTable[] = +{ + ENTRY1Q( DC, CREATOR, XML_ETACTION_MOVE_TO_ATTR, + XML_NAMESPACE_OFFICE, XML_AUTHOR ), + ENTRY1Q( DC, DATE, XML_ETACTION_MOVE_TO_ATTR_RNG2ISO_DATETIME, + XML_NAMESPACE_OFFICE, XML_CREATE_DATE ), + ENTRY1Q( META, DATE_STRING, XML_ETACTION_MOVE_TO_ATTR, + XML_NAMESPACE_OFFICE, XML_CREATE_DATE_STRING ), + ENTRY0( TEXT, P, XML_ETACTION_EXTRACT_CHARACTERS ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ETACTION_EOT ) +}; + +// action table for OASIS_CHANGE_INFO_ACTIONS +XMLTransformerActionInit const aChangeInfoActionTable[] = +{ + ENTRY1Q( DC, CREATOR, XML_ETACTION_MOVE_TO_ATTR, + XML_NAMESPACE_OFFICE, XML_CHG_AUTHOR ), + ENTRY1Q( DC, DATE, XML_ETACTION_MOVE_TO_ATTR_RNG2ISO_DATETIME, + XML_NAMESPACE_OFFICE, XML_CHG_DATE_TIME ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ETACTION_EOT ) +}; + +// OASIS_BACKGROUND_IMAGE_ACTIONS +XMLTransformerActionInit const aBackgroundImageActionTable[] = +{ + ENTRY1Q( DRAW, OPACITY, XML_ATACTION_RENAME_NEG_PERCENT, + XML_NAMESPACE_DRAW, XML_TRANSPARENCY ), + ENTRY1( XLINK, HREF, XML_ATACTION_URI_OASIS, sal_uInt32(true) ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_DDE_CONNECTION_DECL +XMLTransformerActionInit const aDDEConnectionDeclActionTable[] = +{ + ENTRY1Q( OFFICE, NAME, XML_ATACTION_RENAME, + XML_NAMESPACE_TEXT, XML_NAME ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_FORM_CONTROL_ACTIONS +XMLTransformerActionInit const 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_uInt32(false) ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_FORM_COLUMN_ACTIONS +XMLTransformerActionInit const 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 +XMLTransformerActionInit const 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 +XMLTransformerActionInit const aXLinkActionTable[] = +{ + ENTRY1( XLINK, HREF, XML_ATACTION_URI_OASIS, sal_uInt32(false) ), + ENTRY0( TABLE, REFRESH_DELAY, XML_ATACTION_RNG2ISO_DATETIME ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_CONFIG_ITEM_SET_ACTIONS +XMLTransformerActionInit const aConfigItemSetActionTable[] = +{ + ENTRY1( CONFIG, NAME, XML_ATACTION_REMOVE_NAMESPACE_PREFIX, + XML_NAMESPACE_OOO ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_FORMULA_ACTIONS +XMLTransformerActionInit const 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 +XMLTransformerActionInit const 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 +XMLTransformerActionInit const 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 +XMLTransformerActionInit const 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 +XMLTransformerActionInit const 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 +XMLTransformerActionInit const aSourceServiceActionTable[] = +{ + ENTRY1Q( TABLE, USER_NAME, XML_ATACTION_RENAME, + XML_NAMESPACE_TABLE, XML_USERNAME ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_CHART_ACTIONS +XMLTransformerActionInit const 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 +XMLTransformerActionInit const 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_uInt32(false) ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_ALPHABETICAL_INDEX_MARK_ACTIONS +XMLTransformerActionInit const 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) +XMLTransformerActionInit const aDrawAreaPolygonActionTable[] = +{ + ENTRY1Q( DRAW, POINTS, XML_ATACTION_RENAME, + XML_NAMESPACE_SVG, XML_POINTS ), + ENTRY0( OFFICE, TOKEN_INVALID, XML_ATACTION_EOT ) +}; + +// OASIS_SCRIPT_ACTIONS +XMLTransformerActionInit const 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 +XMLTransformerActionInit const 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 ) +}; + +XMLTokenEnum const 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 +}; + +namespace { + +class XMLTableTransformerContext_Impl : public XMLTransformerContext +{ + OUString m_aElemQName; + +public: + XMLTableTransformerContext_Impl( XMLTransformerBase& rTransformer, + const OUString& rQName ); + + virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + virtual void EndElement() override; +}; + +} + +XMLTableTransformerContext_Impl::XMLTableTransformerContext_Impl( + XMLTransformerBase& rImp, + const OUString& rQName ) : + XMLTransformerContext( rImp, rQName ), + m_aElemQName( rQName ) +{ +} + +void XMLTableTransformerContext_Impl::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + Reference< XAttributeList > xAttrList( rAttrList ); + + rtl::Reference<XMLMutableAttributeList> pMutableAttrList; + + 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 ); + } + // #i50521# - no break here for safety reason. + } + // Convert attribute table:style-name for <table:table> (#i40011#, #i40015#) + else if ( IsXMLToken( aLocalName, XML_STYLE_NAME ) ) + { + const OUString& rValue = xAttrList->getValueByIndex( i ); + OUString aAttrValue( rValue ); + if( XMLTransformerBase::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 ); +} + +namespace { + +class XMLBodyOASISTransformerContext_Impl : public XMLTransformerContext +{ + bool m_bFirstChild; + +public: + XMLBodyOASISTransformerContext_Impl( XMLTransformerBase& rTransformer, + const OUString& rQName ); + + virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + + virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + virtual void EndElement() override; +}; + +} + +XMLBodyOASISTransformerContext_Impl::XMLBodyOASISTransformerContext_Impl( + XMLTransformerBase& rImp, + const OUString& rQName ) : + XMLTransformerContext( rImp, rQName ), + m_bFirstChild( false ) +{ +} + +void XMLBodyOASISTransformerContext_Impl::StartElement( + const Reference< XAttributeList >& ) +{ +} + +rtl::Reference<XMLTransformerContext> XMLBodyOASISTransformerContext_Impl::CreateChildContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) +{ + if (!m_bFirstChild) + { + m_bFirstChild = true; + XMLTransformerContext::StartElement(xAttrList); + } + + return XMLTransformerContext::CreateChildContext(nPrefix, rLocalName, rQName, xAttrList); +} + +void XMLBodyOASISTransformerContext_Impl::EndElement() +{ + if (!m_bFirstChild) + XMLTransformerContext::StartElement(Reference< XAttributeList >()); + + XMLTransformerContext::EndElement(); +} + +namespace { + +class XMLTabStopOASISTContext_Impl : public XMLPersElemContentTContext +{ +public: + XMLTabStopOASISTContext_Impl( XMLTransformerBase& rTransformer, + const OUString& rQName ); + + virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; +}; + +} + +XMLTabStopOASISTContext_Impl::XMLTabStopOASISTContext_Impl( + XMLTransformerBase& rImp, + const OUString& rQName ) : + XMLPersElemContentTContext( rImp, rQName ) +{ +} + +void XMLTabStopOASISTContext_Impl::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + XMLTransformerActions *pActions = + GetTransformer().GetUserDefinedActions( OASIS_TAB_STOP_ACTIONS ); + SAL_WARN_IF( nullptr == pActions, "xmloff.transform", "got no actions" ); + + sal_Unicode cStyleLeaderChar = 0; + sal_Int16 nLeaderText = -1; + Reference< XAttributeList > xAttrList( rAttrList ); + rtl::Reference<XMLMutableAttributeList> pMutableAttrList; + 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: + SAL_WARN( "xmloff.transform", "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( cStyleLeaderChar ) ); + } + } + else + { + if( nLeaderText != -1 ) + pMutableAttrList->RemoveAttributeByIndex( nLeaderText ); + } + + XMLPersElemContentTContext::StartElement( xAttrList ); +} + +namespace { + +class XMLConfigItemTContext_Impl : public XMLTransformerContext +{ + OUString m_aContent; + bool m_bIsRedlineProtectionKey; + bool m_bIsCursorX; + bool m_bIsCursorY; + +public: + XMLConfigItemTContext_Impl( XMLTransformerBase& rTransformer, + const OUString& rQName ); + + virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + virtual void EndElement() override; + + virtual void Characters( const OUString& rChars ) override; +}; + +} + +XMLConfigItemTContext_Impl::XMLConfigItemTContext_Impl( + XMLTransformerBase& rImp, + const OUString& rQName ) : + XMLTransformerContext( rImp, rQName ), + m_bIsRedlineProtectionKey( false ), + m_bIsCursorX( false ), + m_bIsCursorY( false ) +{ +} + +void XMLConfigItemTContext_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_CONFIG == nPrefix ) + { + if ( IsXMLToken( aLocalName, XML_NAME ) ) + { + const OUString& rValue = rAttrList->getValueByIndex( i ); + if( rValue == "RedlineProtectionKey" ) + m_bIsRedlineProtectionKey = true; + else if( rValue == "CursorPositionX" ) + m_bIsCursorX = true; + else if( rValue == "CursorPositionY" ) + m_bIsCursorY = true; + + break; + } + } + } + + XMLTransformerContext::StartElement( rAttrList ); +} + +void XMLConfigItemTContext_Impl::Characters( const OUString& rChars ) +{ + 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 = OUString::number(nPos); + } + + XMLTransformerContext::Characters( sChars ); +} + +void XMLConfigItemTContext_Impl::EndElement() +{ + + if( m_bIsRedlineProtectionKey ) + { + const Reference< XPropertySet > rPropSet = + GetTransformer().GetPropertySet(); + if( rPropSet.is() ) + { + OUString aPropName("RedlineProtectionKey"); + Reference< XPropertySetInfo > xPropSetInfo( + rPropSet->getPropertySetInfo() ); + if( xPropSetInfo.is() && + xPropSetInfo->hasPropertyByName( aPropName ) ) + { + Sequence < sal_Int8 > aKey; + ::comphelper::Base64::decode( aKey, m_aContent ); + rPropSet->setPropertyValue( aPropName, Any( aKey ) ); + } + } + } + XMLTransformerContext::EndElement(); +} + +namespace { + +class XMLTrackedChangesOASISTContext_Impl : public XMLTransformerContext +{ + OUString const m_aAttrQName; + +public: + + XMLTrackedChangesOASISTContext_Impl( XMLTransformerBase& rTransformer, + const OUString& rQName, + sal_uInt16 nPrefix, + XMLTokenEnum eToken ); + + virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; +}; + +} + +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)) ) +{ +} + +void XMLTrackedChangesOASISTContext_Impl::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + Reference< XAttributeList > xAttrList( rAttrList ); + const Reference< XPropertySet > rPropSet = + GetTransformer().GetPropertySet(); + if( rPropSet.is() ) + { + OUString aPropName("RedlineProtectionKey"); + Reference< XPropertySetInfo > xPropSetInfo( + rPropSet->getPropertySetInfo() ); + if( xPropSetInfo.is() && + xPropSetInfo->hasPropertyByName( aPropName ) ) + { + Any aAny = rPropSet->getPropertyValue( aPropName); + Sequence < sal_Int8 > aKey; + aAny >>= aKey; + if( aKey.hasElements() ) + { + OUStringBuffer aBuffer; + ::comphelper::Base64::encode( aBuffer, aKey ); + rtl::Reference<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, + 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 ) ); + } + 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: + SAL_WARN( "xmloff.transform", "no user defined context found!" ); + break; + } + + // default is copying + return new XMLTransformerContext( *this, rQName ); +} + +XMLTransformerActions *Oasis2OOoTransformer::GetUserDefinedActions( + sal_uInt16 n ) +{ + XMLTransformerActions *pActions = nullptr; + if( n < MAX_OASIS_ACTIONS ) + { + if( !m_aActions[n] ) + { + if( n<MAX_OASIS_PROP_ACTIONS ) + { + m_aActions[n].reset( + XMLStyleOASISTContext::CreateTransformerActions( n ) ); + } + else switch( n ) + { + case OASIS_STYLE_ACTIONS: + m_aActions[OASIS_STYLE_ACTIONS].reset( + new XMLTransformerActions( aStyleActionTable ) ); + break; + case OASIS_FONT_FACE_ACTIONS: + m_aActions[OASIS_FONT_FACE_ACTIONS].reset( + new XMLTransformerActions( aFontFaceActionTable ) ); + break; + case OASIS_SHAPE_ACTIONS: + m_aActions[OASIS_SHAPE_ACTIONS].reset( + new XMLTransformerActions( aShapeActionTable ) ); + break; + case OASIS_CONNECTOR_ACTIONS: + m_aActions[OASIS_CONNECTOR_ACTIONS].reset( + new XMLTransformerActions( aConnectorActionTable ) ); + break; + case OASIS_INDEX_ENTRY_TAB_STOP_ACTIONS: + m_aActions[OASIS_INDEX_ENTRY_TAB_STOP_ACTIONS].reset( + new XMLTransformerActions( aIndexEntryTabStopActionTable ) ); + break; + case OASIS_TAB_STOP_ACTIONS: + m_aActions[OASIS_TAB_STOP_ACTIONS].reset( + new XMLTransformerActions( aTabStopActionTable ) ); + break; + case OASIS_LINENUMBERING_ACTIONS: + m_aActions[OASIS_LINENUMBERING_ACTIONS].reset( + new XMLTransformerActions( aLineNumberingActionTable ) ); + break; + case OASIS_FOOTNOTE_SEP_ACTIONS: + m_aActions[OASIS_FOOTNOTE_SEP_ACTIONS].reset( + new XMLTransformerActions( aFootnoteSepActionTable ) ); + break; + case OASIS_DROP_CAP_ACTIONS: + m_aActions[OASIS_DROP_CAP_ACTIONS].reset( + new XMLTransformerActions( aDropCapActionTable ) ); + break; + case OASIS_COLUMNS_ACTIONS: + m_aActions[OASIS_COLUMNS_ACTIONS].reset( + new XMLTransformerActions( aColumnsActionTable ) ); + break; + case OASIS_TEXT_VALUE_TYPE_ACTIONS: + m_aActions[OASIS_TEXT_VALUE_TYPE_ACTIONS].reset( + new XMLTransformerActions( aTextValueTypeActionTable ) ); + break; + case OASIS_TABLE_VALUE_TYPE_ACTIONS: + m_aActions[OASIS_TABLE_VALUE_TYPE_ACTIONS].reset( + new XMLTransformerActions( aTableValueTypeActionTable ) ); + break; + case OASIS_PARA_ACTIONS: + m_aActions[OASIS_PARA_ACTIONS].reset( + new XMLTransformerActions( aParaActionTable ) ); + break; + case OASIS_LIST_STYLE_REF_ACTIONS: + m_aActions[OASIS_LIST_STYLE_REF_ACTIONS].reset( + new XMLTransformerActions( aListStyleRefActionTable ) ); + break; + case OASIS_TEXT_STYLE_REF_ACTIONS: + m_aActions[OASIS_TEXT_STYLE_REF_ACTIONS].reset( + new XMLTransformerActions( aTextStyleRefActionTable ) ); + break; + case OASIS_PARA_STYLE_REF_ACTIONS: + m_aActions[OASIS_PARA_STYLE_REF_ACTIONS].reset( + new XMLTransformerActions( aParaStyleRefActionTable ) ); + break; + case OASIS_MASTER_PAGE_REF_ACTIONS: + m_aActions[OASIS_MASTER_PAGE_REF_ACTIONS].reset( + new XMLTransformerActions( aMasterPageRefActionTable ) ); + break; + case OASIS_MAP_STYLE_REF_ACTIONS: + m_aActions[OASIS_MAP_STYLE_REF_ACTIONS].reset( + new XMLTransformerActions( aMapStyleRefActionTable ) ); + break; + case OASIS_MASTER_PAGE_ACTIONS: + m_aActions[OASIS_MASTER_PAGE_ACTIONS].reset( + new XMLTransformerActions( aMasterPageActionTable ) ); + break; + case OASIS_NOTES_ACTIONS: + m_aActions[OASIS_NOTES_ACTIONS].reset( + new XMLTransformerActions( aNotesActionTable ) ); + break; + case OASIS_ANNOTATION_ACTIONS: + m_aActions[OASIS_ANNOTATION_ACTIONS].reset( + new XMLTransformerActions( aAnnotationActionTable ) ); + break; + case OASIS_CHANGE_INFO_ACTIONS: + m_aActions[OASIS_CHANGE_INFO_ACTIONS].reset( + new XMLTransformerActions( aChangeInfoActionTable ) ); + break; + case OASIS_FRAME_ELEM_ACTIONS: + m_aActions[OASIS_FRAME_ELEM_ACTIONS].reset( + new XMLTransformerActions( aFrameActionTable ) ); + break; + case OASIS_BACKGROUND_IMAGE_ACTIONS: + m_aActions[OASIS_BACKGROUND_IMAGE_ACTIONS].reset( + new XMLTransformerActions( aBackgroundImageActionTable ) ); + break; + case OASIS_DDE_CONNECTION_DECL_ACTIONS: + m_aActions[OASIS_DDE_CONNECTION_DECL_ACTIONS].reset( + new XMLTransformerActions( aDDEConnectionDeclActionTable ) ); + break; + case OASIS_EVENT_ACTIONS: + m_aActions[OASIS_EVENT_ACTIONS].reset( + new XMLTransformerActions( aEventActionTable ) ); + break; + case OASIS_DLG_ACTIONS: + m_aActions[OASIS_DLG_ACTIONS].reset( + new XMLTransformerActions( aDlgActionTable ) ); + break; + case OASIS_FORM_CONTROL_ACTIONS: + m_aActions[OASIS_FORM_CONTROL_ACTIONS].reset( + new XMLTransformerActions( aFormControlActionTable ) ); + break; + case OASIS_FORM_COLUMN_ACTIONS: + m_aActions[OASIS_FORM_COLUMN_ACTIONS].reset( + new XMLTransformerActions( aFormColumnActionTable ) ); + break; + case OASIS_FORM_PROP_ACTIONS: + m_aActions[OASIS_FORM_PROP_ACTIONS].reset( + new XMLTransformerActions( aFormPropActionTable ) ); + break; + case OASIS_XLINK_ACTIONS: + m_aActions[OASIS_XLINK_ACTIONS].reset( + new XMLTransformerActions( aXLinkActionTable ) ); + break; + case OASIS_CONFIG_ITEM_SET_ACTIONS: + m_aActions[OASIS_CONFIG_ITEM_SET_ACTIONS].reset( + new XMLTransformerActions( aConfigItemSetActionTable ) ); + break; + case OASIS_FORMULA_ACTIONS: + m_aActions[OASIS_FORMULA_ACTIONS].reset( + new XMLTransformerActions( aFormulaActionTable ) ); + break; + case OASIS_CHART_ACTIONS: + m_aActions[OASIS_CHART_ACTIONS].reset( + new XMLTransformerActions( aChartActionTable ) ); + break; + case OASIS_FORM_ACTIONS: + m_aActions[OASIS_FORM_ACTIONS].reset( + new XMLTransformerActions( aFormActionTable ) ); + break; + case OASIS_ALPHABETICAL_INDEX_MARK_ACTIONS: + m_aActions[OASIS_ALPHABETICAL_INDEX_MARK_ACTIONS].reset( + new XMLTransformerActions( + aAlphabeticalIndexMarkActionTable ) ); + break; + case OASIS_CONTENT_VALIDATION_ACTIONS: + m_aActions[OASIS_CONTENT_VALIDATION_ACTIONS].reset( + new XMLTransformerActions( aContentValidationActionTable ) ); + break; + case OASIS_DDE_CONV_MODE_ACTIONS: + m_aActions[OASIS_DDE_CONV_MODE_ACTIONS].reset( + new XMLTransformerActions( aDDEConvModeActionTable ) ); + break; + case OASIS_DATAPILOT_MEMBER_ACTIONS: + m_aActions[OASIS_DATAPILOT_MEMBER_ACTIONS].reset( + new XMLTransformerActions( aDataPilotMemberActionTable ) ); + break; + case OASIS_DATAPILOT_LEVEL_ACTIONS: + m_aActions[OASIS_DATAPILOT_LEVEL_ACTIONS].reset( + new XMLTransformerActions( aDataPilotLevelActionTable ) ); + break; + case OASIS_SOURCE_SERVICE_ACTIONS: + m_aActions[OASIS_SOURCE_SERVICE_ACTIONS].reset( + new XMLTransformerActions( aSourceServiceActionTable ) ); + break; + case OASIS_DRAW_AREA_POLYGON_ACTIONS: + m_aActions[OASIS_DRAW_AREA_POLYGON_ACTIONS].reset( + new XMLTransformerActions( aShapeActionTable ) ); + m_aActions[OASIS_DRAW_AREA_POLYGON_ACTIONS] + ->Add( aDrawAreaPolygonActionTable ); + break; + case OASIS_SCRIPT_ACTIONS: + m_aActions[OASIS_SCRIPT_ACTIONS].reset( + new XMLTransformerActions( aScriptActionTable ) ); + break; + case OASIS_DATETIME_ACTIONS: + m_aActions[OASIS_DATETIME_ACTIONS].reset( + new XMLTransformerActions( aDateTimeActionTable ) ); + break; + // Bugdoc with table won't load correctly (#i40011#, #i40015#) + case OASIS_TABLE_STYLE_REF_ACTIONS: + m_aActions[OASIS_TABLE_STYLE_REF_ACTIONS].reset( + new XMLTransformerActions( aTableStyleRefActionTable ) ); + break; + case OASIS_ANIMATION_ACTIONS: + m_aActions[OASIS_ANIMATION_ACTIONS].reset( + new XMLTransformerActions( aAnimationActionTable ) ); + break; + } + } + pActions = m_aActions[n].get(); + } + + return pActions; +} + +OUString Oasis2OOoTransformer::GetEventName( const OUString& rName, + 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 : nullptr ); +} + +Oasis2OOoTransformer::Oasis2OOoTransformer() noexcept : + XMLTransformerBase( aActionTable, aTokenMap ), + m_pEventMap( nullptr ), + m_pFormEventMap( nullptr ) +{ + 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(auto & rp : m_aActions) + rp.reset(); +} + +Oasis2OOoTransformer::~Oasis2OOoTransformer() noexcept +{ + for(auto & rp : m_aActions) + rp.reset(); + XMLEventOASISTransformerContext::FlushEventMap( m_pEventMap ); + XMLEventOASISTransformerContext::FlushEventMap( m_pFormEventMap ); +} + +const css::uno::Sequence<sal_Int8>& Oasis2OOoTransformer::getUnoTunnelId() noexcept +{ + static const class comphelper::UnoIdInit theOasis2OOoTransformerUnoTunnelId; + return theOasis2OOoTransformerUnoTunnelId.getSeq(); +} + +// XUnoTunnel +sal_Int64 SAL_CALL Oasis2OOoTransformer::getSomething( const Sequence< sal_Int8 >& rId ) +{ + return comphelper::getSomethingImpl(rId, this); +} + +// XServiceInfo +OUString SAL_CALL Oasis2OOoTransformer::getImplementationName() +{ + return "com.sun.star.comp.Oasis2OOoTransformer"; +} + +sal_Bool SAL_CALL Oasis2OOoTransformer::supportsService( const OUString& ServiceName ) +{ + return cppu::supportsService(this, ServiceName); +} + +Sequence< OUString > SAL_CALL Oasis2OOoTransformer::getSupportedServiceNames( ) +{ + return { }; +} + +// Service registration + +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +xmloff_Oasis2OOoTransformer_get_implementation( + css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&) +{ + SAL_INFO("xmloff.transform", "Creating Oasis2OOoTransformer"); + return cppu::acquire(new Oasis2OOoTransformer); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/Oasis2OOo.hxx b/xmloff/source/transform/Oasis2OOo.hxx new file mode 100644 index 000000000..fe3db7cea --- /dev/null +++ b/xmloff/source/transform/Oasis2OOo.hxx @@ -0,0 +1,59 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include "ActionMapTypesOASIS.hxx" +#include "TransformerBase.hxx" + +class XMLTransformerOASISEventMap_Impl; + +class Oasis2OOoTransformer : public XMLTransformerBase +{ + std::unique_ptr<XMLTransformerActions> m_aActions[MAX_OASIS_ACTIONS]; + XMLTransformerOASISEventMap_Impl *m_pEventMap; + XMLTransformerOASISEventMap_Impl *m_pFormEventMap; + +protected: + + virtual XMLTransformerContext *CreateUserDefinedContext( + const TransformerAction_Impl& rAction, + const OUString& rQName, + bool bPersistent=false ) override; + + virtual XMLTransformerActions *GetUserDefinedActions( sal_uInt16 n ) override; + +public: + Oasis2OOoTransformer () noexcept; + virtual ~Oasis2OOoTransformer() noexcept override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + + // XUnoTunnel + static const css::uno::Sequence<sal_Int8>& getUnoTunnelId() noexcept; + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + + virtual OUString GetEventName( const OUString& rName, + bool bForm = false ) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/PersAttrListTContext.cxx b/xmloff/source/transform/PersAttrListTContext.cxx new file mode 100644 index 000000000..53e20b0a3 --- /dev/null +++ b/xmloff/source/transform/PersAttrListTContext.cxx @@ -0,0 +1,174 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <com/sun/star/util/XCloneable.hpp> +#include "IgnoreTContext.hxx" +#include "TransformerBase.hxx" +#include "MutableAttrList.hxx" +#include <xmloff/namespacemap.hxx> +#include "PersAttrListTContext.hxx" + + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::util; +using namespace ::com::sun::star::xml::sax; + +void XMLPersAttrListTContext::AddAttribute( + sal_uInt16 nAPrefix, + ::xmloff::token::XMLTokenEnum eAToken, + ::xmloff::token::XMLTokenEnum eVToken ) +{ + const OUString& aAttrValue( ::xmloff::token::GetXMLToken( eVToken ) ); + AddAttribute( nAPrefix, eAToken, aAttrValue ); +} + +void XMLPersAttrListTContext::AddAttribute( + sal_uInt16 nAPrefix, + ::xmloff::token::XMLTokenEnum eAToken, + const OUString & rValue ) +{ + OUString aAttrQName( GetTransformer().GetNamespaceMap().GetQNameByKey( + nAPrefix, ::xmloff::token::GetXMLToken( eAToken ) ) ); + const OUString& aAttrValue( rValue ); + + rtl::Reference<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 ) +{ +} + +rtl::Reference<XMLTransformerContext> XMLPersAttrListTContext::CreateChildContext( + sal_uInt16 /*nPrefix*/, + const OUString& /*rLocalName*/, + const OUString& rQName, + const Reference< XAttributeList >& ) +{ + // ignore all child elements + return new XMLIgnoreTransformerContext( GetTransformer(), + rQName, true, true ); +} + +void XMLPersAttrListTContext::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + XMLMutableAttributeList *pMutableAttrList = nullptr; + + Reference< XAttributeList > xAttrList( rAttrList ); + if( m_nActionMap != INVALID_ACTIONS ) + { + pMutableAttrList = + GetTransformer().ProcessAttrList( xAttrList, m_nActionMap, + 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, true ); + } +} + +void XMLPersAttrListTContext::EndElement() +{ + // ignore for now +} + +void XMLPersAttrListTContext::Characters( const OUString& ) +{ +} + +bool XMLPersAttrListTContext::IsPersistent() const +{ + return true; +} + +void XMLPersAttrListTContext::Export() +{ + GetTransformer().GetDocHandler()->startElement( m_aElemQName, m_xAttrList ); + ExportContent(); + GetTransformer().GetDocHandler()->endElement( m_aElemQName ); +} + +void XMLPersAttrListTContext::ExportContent() +{ + // nothing to export +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/PersAttrListTContext.hxx b/xmloff/source/transform/PersAttrListTContext.hxx new file mode 100644 index 000000000..41ac5a113 --- /dev/null +++ b/xmloff/source/transform/PersAttrListTContext.hxx @@ -0,0 +1,103 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <xmloff/xmltoken.hxx> +#include "TransformerContext.hxx" + + +class XMLPersAttrListTContext : public XMLTransformerContext +{ + + css::uno::Reference< css::xml::sax::XAttributeList > m_xAttrList; + OUString m_aElemQName; + sal_uInt16 const m_nActionMap; + +protected: + + void SetExportQName( const OUString& r ) { m_aElemQName = r; } + +public: + // 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 OUString& rQName ); + + // attr list persistence + attribute processing + XMLPersAttrListTContext( XMLTransformerBase& rTransformer, + const OUString& rQName, + sal_uInt16 nActionMap ); + + // attr list persistence + renaming + XMLPersAttrListTContext( XMLTransformerBase& rTransformer, + const OUString& rQName, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken ); + + // attr list persistence + renaming + attribute processing + XMLPersAttrListTContext( XMLTransformerBase& rTransformer, + const OUString& rQName, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken, + sal_uInt16 nActionMap ); + + // Create a children element context. By default, the import's + // CreateContext method is called to create a new default context. + virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + + // StartElement is called after a context has been constructed and + // before an elements context is parsed. It may be used for actions that + // require virtual methods. The default is to do nothing. + virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + + // EndElement is called before a context will be destructed, but + // after an elements context has been parsed. It may be used for actions + // that require virtual methods. The default is to do nothing. + virtual void EndElement() override; + + // This method is called for all characters that are contained in the + // current element. + virtual void Characters( const OUString& rChars ) override; + + virtual bool IsPersistent() const override; + virtual void Export() override; + virtual void ExportContent() override; + + const 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 OUString & rValue ); + + const css::uno::Reference< css::xml::sax::XAttributeList >& + GetAttrList() const { return m_xAttrList; } + +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/PersMixedContentTContext.cxx b/xmloff/source/transform/PersMixedContentTContext.cxx new file mode 100644 index 000000000..f892530ac --- /dev/null +++ b/xmloff/source/transform/PersMixedContentTContext.cxx @@ -0,0 +1,139 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "TransformerBase.hxx" +#include "PersMixedContentTContext.hxx" + +#include <osl/diagnose.h> + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; + +namespace { + +class XMLPersTextTContext_Impl : public XMLTransformerContext +{ + OUString m_aCharacters; + +public: + XMLPersTextTContext_Impl( XMLTransformerBase& rTransformer, + const OUString& rChars ); + + virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + virtual void EndElement() override; + virtual void Characters( const OUString& rChars ) override; + + virtual bool IsPersistent() const override; + virtual void Export() override; +}; + +} + +XMLPersTextTContext_Impl::XMLPersTextTContext_Impl( + XMLTransformerBase& rImp, + const OUString& rChars ) : + XMLTransformerContext( rImp, OUString() ), + m_aCharacters( rChars ) +{ +} + +rtl::Reference<XMLTransformerContext> XMLPersTextTContext_Impl::CreateChildContext( + sal_uInt16, + const OUString&, + const OUString&, + const Reference< XAttributeList >& ) +{ + OSL_ENSURE( false, "illegal call to CreateChildContext" ); + return {}; +} + +void XMLPersTextTContext_Impl::StartElement( + const Reference< XAttributeList >& ) +{ + OSL_ENSURE( false, "illegal call to StartElement" ); +} + +void XMLPersTextTContext_Impl::EndElement() +{ + OSL_ENSURE( false, "illegal call to EndElement" ); +} + +bool XMLPersTextTContext_Impl::IsPersistent() const +{ + return true; +} + +void XMLPersTextTContext_Impl::Characters( const OUString& rChars ) +{ + m_aCharacters += rChars; +} + +void XMLPersTextTContext_Impl::Export() +{ + GetTransformer().GetDocHandler()->characters( m_aCharacters ); +} + +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 ) ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/PersMixedContentTContext.hxx b/xmloff/source/transform/PersMixedContentTContext.hxx new file mode 100644 index 000000000..b8f6016cf --- /dev/null +++ b/xmloff/source/transform/PersMixedContentTContext.hxx @@ -0,0 +1,54 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include "DeepTContext.hxx" + +class XMLPersMixedContentTContext : public XMLPersElemContentTContext +{ +public: + // mixed content persistence only + XMLPersMixedContentTContext( XMLTransformerBase& rTransformer, + const OUString& rQName ); + + // mixed content persistence + attribute processing + XMLPersMixedContentTContext( XMLTransformerBase& rTransformer, + const OUString& rQName, + sal_uInt16 nActionMap ); + + // mixed content persistence + renaming + XMLPersMixedContentTContext( XMLTransformerBase& rTransformer, + const OUString& rQName, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken ); + + // mixed content persistence + renaming + attribute processing + XMLPersMixedContentTContext( XMLTransformerBase& rTransformer, + const OUString& rQName, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken, + sal_uInt16 nActionMap ); + + virtual void Characters( const OUString& rChars ) override; + + virtual ~XMLPersMixedContentTContext() override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/ProcAddAttrTContext.cxx b/xmloff/source/transform/ProcAddAttrTContext.cxx new file mode 100644 index 000000000..d15002ad2 --- /dev/null +++ b/xmloff/source/transform/ProcAddAttrTContext.cxx @@ -0,0 +1,66 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "ProcAddAttrTContext.hxx" +#include "MutableAttrList.hxx" +#include "TransformerBase.hxx" +#include <xmloff/namespacemap.hxx> + + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; +using namespace ::xmloff::token; + +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 ); + rtl::Reference<XMLMutableAttributeList> pMutableAttrList = + GetTransformer().ProcessAttrList( xAttrList, GetActionMap(), + false ); + if( !pMutableAttrList ) + { + pMutableAttrList = new XMLMutableAttributeList; + xAttrList = pMutableAttrList; + } + pMutableAttrList->AddAttribute( m_aAttrQName, m_aAttrValue ); + GetTransformer().GetDocHandler()->startElement( GetElemQName(), xAttrList ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/ProcAddAttrTContext.hxx b/xmloff/source/transform/ProcAddAttrTContext.hxx new file mode 100644 index 000000000..8088aec26 --- /dev/null +++ b/xmloff/source/transform/ProcAddAttrTContext.hxx @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include "ProcAttrTContext.hxx" + +class XMLProcAddAttrTransformerContext : public XMLProcAttrTransformerContext +{ + OUString const m_aAttrQName; + OUString const m_aAttrValue; + +public: + XMLProcAddAttrTransformerContext( XMLTransformerBase& rTransformer, + const 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() override; + + virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/ProcAttrTContext.cxx b/xmloff/source/transform/ProcAttrTContext.cxx new file mode 100644 index 000000000..6dbab0048 --- /dev/null +++ b/xmloff/source/transform/ProcAttrTContext.cxx @@ -0,0 +1,65 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "ProcAttrTContext.hxx" +#include "TransformerBase.hxx" +#include <xmloff/namespacemap.hxx> + + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; +using namespace ::xmloff::token; + +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 ) +{ +} + +void XMLProcAttrTransformerContext::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + Reference< XAttributeList > xAttrList( rAttrList ); + GetTransformer().ProcessAttrList( xAttrList, m_nActionMap, false ); + GetTransformer().GetDocHandler()->startElement( m_aElemQName, xAttrList ); +} + +void XMLProcAttrTransformerContext::EndElement() +{ + GetTransformer().GetDocHandler()->endElement( m_aElemQName ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/ProcAttrTContext.hxx b/xmloff/source/transform/ProcAttrTContext.hxx new file mode 100644 index 000000000..e298d1095 --- /dev/null +++ b/xmloff/source/transform/ProcAttrTContext.hxx @@ -0,0 +1,50 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <xmloff/xmltoken.hxx> +#include "TransformerContext.hxx" + +class XMLProcAttrTransformerContext : public XMLTransformerContext +{ + OUString const m_aElemQName; + sal_uInt16 const m_nActionMap; + +protected: + + const OUString& GetElemQName() const { return m_aElemQName; } + sal_uInt16 GetActionMap() const { return m_nActionMap; } + +public: + XMLProcAttrTransformerContext( XMLTransformerBase& rTransformer, + const OUString& rQName, + sal_uInt16 nActionMap ); + + XMLProcAttrTransformerContext( XMLTransformerBase& rTransformer, + const OUString& rQName, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken, + sal_uInt16 nActionMap ); + + virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + virtual void EndElement() override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/PropType.hxx b/xmloff/source/transform/PropType.hxx new file mode 100644 index 000000000..e02a5eed5 --- /dev/null +++ b/xmloff/source/transform/PropType.hxx @@ -0,0 +1,41 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +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 +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/PropertyActionsOASIS.cxx b/xmloff/source/transform/PropertyActionsOASIS.cxx new file mode 100644 index 000000000..8860f3d22 --- /dev/null +++ b/xmloff/source/transform/PropertyActionsOASIS.cxx @@ -0,0 +1,545 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <xmloff/xmlnamespace.hxx> +#include "FamilyType.hxx" +#include "PropertyActionsOASIS.hxx" + +using namespace ::xmloff::token; + +#define NO_PARAMS 0, 0, 0 + +XMLTransformerActionInit const 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_THRESHOLD, 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/PropertyActionsOASIS.hxx b/xmloff/source/transform/PropertyActionsOASIS.hxx new file mode 100644 index 000000000..6fb80d57b --- /dev/null +++ b/xmloff/source/transform/PropertyActionsOASIS.hxx @@ -0,0 +1,63 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#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_ATACTION_CAPTION_ESCAPE_OASIS, + XML_ATACTION_DECODE_PROTECT +}; + +extern XMLTransformerActionInit const aGraphicPropertyOASISAttrActionTable[]; +extern XMLTransformerActionInit const aDrawingPagePropertyOASISAttrActionTable[]; +extern XMLTransformerActionInit const aPageLayoutPropertyOASISAttrActionTable[]; +extern XMLTransformerActionInit const aHeaderFooterPropertyOASISAttrActionTable[]; +extern XMLTransformerActionInit const aTextPropertyOASISAttrActionTable[]; +extern XMLTransformerActionInit const aParagraphPropertyOASISAttrActionTable[]; +extern XMLTransformerActionInit const aSectionPropertyOASISAttrActionTable[]; +extern XMLTransformerActionInit const aTablePropertyOASISAttrActionTable[]; +extern XMLTransformerActionInit const aTableColumnPropertyOASISAttrActionTable[]; +extern XMLTransformerActionInit const aTableRowPropertyOASISAttrActionTable[]; +extern XMLTransformerActionInit const aTableCellPropertyOASISAttrActionTable[]; +extern XMLTransformerActionInit const aListLevelPropertyOASISAttrActionTable[]; +extern XMLTransformerActionInit const aChartPropertyOASISAttrActionTable[]; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/PropertyActionsOOo.cxx b/xmloff/source/transform/PropertyActionsOOo.cxx new file mode 100644 index 000000000..cc6fc0e6b --- /dev/null +++ b/xmloff/source/transform/PropertyActionsOOo.cxx @@ -0,0 +1,1058 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <xmloff/xmlnamespace.hxx> +#include "PropType.hxx" +#include "PropertyActionsOOo.hxx" + +using namespace ::xmloff::token; + +#define NO_PARAMS 0, 0, 0 + +XMLTransformerActionInit const 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_THRESHOLD, 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 */ + /* Rename attribute values of <style:mirror>: (#i49139#) + horizontal-on-left-pages --> horizontal-on-even + horizontal-on-right-pages --> horizontal-on-odd + */ + { 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 const 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 const 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 const 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 const 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 const 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_FO, XML_WRAP_OPTION, XML_ATACTION_REMOVE, + NO_PARAMS }, /* #i116555# */ + + { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS } +}; + +XMLTransformerActionInit const aTextPropertyOOoElemActionTable[] = +{ + { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS } +}; + + +XMLTransformerActionInit const 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 property */ + { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS } +}; + +XMLTransformerActionInit const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const aChartPropertyOOoElemActionTable[] = +{ + { XML_NAMESPACE_STYLE, XML_SYMBOL_IMAGE, XML_ATACTION_COPY, NO_PARAMS }, + { XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/PropertyActionsOOo.hxx b/xmloff/source/transform/PropertyActionsOOo.hxx new file mode 100644 index 000000000..e88bb1096 --- /dev/null +++ b/xmloff/source/transform/PropertyActionsOOo.hxx @@ -0,0 +1,67 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#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, + // No image transparency info in label document (#i50322#) + XML_ATACTION_WRITER_BACK_GRAPHIC_TRANSPARENCY +}; + +extern XMLTransformerActionInit const aGraphicPropertyOOoAttrActionTable[]; +extern XMLTransformerActionInit const aGraphicPropertyOOoElemActionTable[]; +extern XMLTransformerActionInit const aDrawingPagePropertyOOoAttrActionTable[]; +extern XMLTransformerActionInit const aPageLayoutPropertyOOoAttrActionTable[]; +extern XMLTransformerActionInit const aHeaderFooterPropertyOOoAttrActionTable[]; +extern XMLTransformerActionInit const aTextPropertyOOoAttrActionTable[]; +extern XMLTransformerActionInit const aTextPropertyOOoElemActionTable[]; +extern XMLTransformerActionInit const aParagraphPropertyOOoAttrActionTable[]; +extern XMLTransformerActionInit const aParagraphPropertyOOoElemActionTable[]; +extern XMLTransformerActionInit const aSectionPropertyOOoAttrActionTable[]; +extern XMLTransformerActionInit const aTablePropertyOOoAttrActionTable[]; +extern XMLTransformerActionInit const aTableColumnPropertyOOoAttrActionTable[]; +extern XMLTransformerActionInit const aTableRowPropertyOOoAttrActionTable[]; +extern XMLTransformerActionInit const aTableCellPropertyOOoAttrActionTable[]; +extern XMLTransformerActionInit const aTableCellPropertyOOoElemActionTable[]; +extern XMLTransformerActionInit const aListLevelPropertyOOoAttrActionTable[]; +extern XMLTransformerActionInit const aChartPropertyOOoAttrActionTable[]; +extern XMLTransformerActionInit const aChartPropertyOOoElemActionTable[]; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/RenameElemTContext.cxx b/xmloff/source/transform/RenameElemTContext.cxx new file mode 100644 index 000000000..5800d9346 --- /dev/null +++ b/xmloff/source/transform/RenameElemTContext.cxx @@ -0,0 +1,80 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "RenameElemTContext.hxx" +#include "MutableAttrList.hxx" +#include "TransformerBase.hxx" +#include <xmloff/namespacemap.hxx> + + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; + +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.isEmpty() ) + { + rtl::Reference<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 ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/RenameElemTContext.hxx b/xmloff/source/transform/RenameElemTContext.hxx new file mode 100644 index 000000000..70fe9d682 --- /dev/null +++ b/xmloff/source/transform/RenameElemTContext.hxx @@ -0,0 +1,61 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <xmloff/xmltoken.hxx> +#include "TransformerContext.hxx" + + +class XMLRenameElemTransformerContext : public XMLTransformerContext +{ + OUString const m_aElemQName; + OUString const m_aAttrQName; + OUString const m_aAttrValue; + +public: + // The following constructor renames the element names "rQName" + // to bPrefix/eToken + XMLRenameElemTransformerContext( XMLTransformerBase& rTransformer, + const OUString& rQName, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken ); + + // The following constructor renames the element names "rQName" + // to bPrefix/eToken and adds an attribute nAPrefix/eAToken that has + // the value eVToken. + XMLRenameElemTransformerContext( XMLTransformerBase& rTransformer, + const 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() override; + + virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + virtual void EndElement() override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/StyleOASISTContext.cxx b/xmloff/source/transform/StyleOASISTContext.cxx new file mode 100644 index 000000000..75dd62db6 --- /dev/null +++ b/xmloff/source/transform/StyleOASISTContext.cxx @@ -0,0 +1,973 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#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 <osl/diagnose.h> +#include <sax/tools/converter.hxx> +#include <xmloff/namespacemap.hxx> +#include <xmloff/xmltoken.hxx> +#include <xmloff/xmlnamespace.hxx> +#include "PropType.hxx" +#include "DeepTContext.hxx" +#include "TransformerBase.hxx" +#include "TransformerActions.hxx" +#include "ActionMapTypesOASIS.hxx" +#include "MutableAttrList.hxx" +#include "PropertyActionsOASIS.hxx" +#include "StyleOASISTContext.hxx" +#include <xmloff/xmluconv.hxx> + +using namespace ::xmloff::token; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; + +const 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 +{ + css::uno::Reference< css::xml::sax::XAttributeList > m_xAttrList; + + XMLPropType m_ePropType; + bool const m_bControlStyle; + +public: + + void SetQNameAndPropType( const OUString& rQName, + XMLPropType ePropType ) + { + m_ePropType = ePropType; + XMLTransformerContext::SetQName( rQName ); + }; + + XMLPropertiesTContext_Impl( XMLTransformerBase& rTransformer, + const OUString& rQName, + XMLPropType eP, + bool _bControlStyle ); + + virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + + virtual void Export() override; + + static XMLPropType GetPropType( std::u16string_view rLocalName ); + + static OUString const & MergeUnderline( XMLTokenEnum eUnderline, + bool bBold, bool bDouble ); + static OUString const & MergeLineThrough( XMLTokenEnum eLineThrough, + bool bBold, bool bDouble, + sal_Unicode c ); +}; + +XMLPropertiesTContext_Impl::XMLPropertiesTContext_Impl( + XMLTransformerBase& rImp, const OUString& rQName, XMLPropType eP, + bool _bControlStyle ) : + XMLPersElemContentTContext( rImp, rQName, XML_NAMESPACE_STYLE, + XML_PROPERTIES), + m_ePropType( eP ), + m_bControlStyle( _bControlStyle ) +{ +} + +void XMLPropertiesTContext_Impl::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + XMLTransformerActions *pActions = nullptr; + sal_uInt16 nActionMap = aAttrActionMaps[m_ePropType]; + if( nActionMap < MAX_OASIS_PROP_ACTIONS ) + { + pActions = GetTransformer().GetUserDefinedActions( nActionMap ); + OSL_ENSURE( pActions, "go no actions" ); + } + + if( pActions ) + { + rtl::Reference<XMLMutableAttributeList> pAttrList; + if( !m_xAttrList.is() ) + { + pAttrList = new XMLMutableAttributeList(); + m_xAttrList = pAttrList; + } + else + { + pAttrList = + static_cast< XMLMutableAttributeList * >( m_xAttrList.get() ); + } + + XMLTokenEnum eUnderline = XML_TOKEN_END; + bool bBoldUnderline = false, bDoubleUnderline = false; + XMLTokenEnum eLineThrough = XML_TOKEN_END; + bool bBoldLineThrough = false, bDoubleLineThrough = 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 ); + XMLTransformerBase::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 ); + XMLTransformerBase::DecodeStyleName(aAttrValue); + pAttrList->AddAttribute( aNewAttrQName, aAttrValue ); + } + break; + case XML_ATACTION_NEG_PERCENT: + { + OUString aAttrValue( rAttrValue ); + XMLTransformerBase::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 ); + XMLTransformerBase::NegPercent(aAttrValue); + pAttrList->AddAttribute( aNewAttrQName, aAttrValue ); + } + break; + case XML_OPTACTION_LINE_MODE: + { + 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 + { + const OUString& aAttrValue( GetXMLToken( bWordMode + ? XML_FALSE + : XML_TRUE ) ); + pAttrList->AddAttribute( aAttrQName, aAttrValue ); + } + } + break; + case XML_OPTACTION_KEEP_WITH_NEXT: + { + const 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 = true; + break; + case XML_OPTACTION_UNDERLINE_TYPE: + if( IsXMLToken( rAttrValue, XML_DOUBLE ) ) + bDoubleUnderline = true; + break; + case XML_OPTACTION_UNDERLINE_STYLE: + eUnderline = GetTransformer().GetToken( rAttrValue ); + break; + case XML_OPTACTION_LINETHROUGH_WIDTH: + if( IsXMLToken( rAttrValue, XML_BOLD ) ) + bBoldLineThrough = true; + break; + case XML_OPTACTION_LINETHROUGH_TYPE: + if( IsXMLToken( rAttrValue, XML_DOUBLE ) ) + bDoubleLineThrough = true; + break; + case XML_OPTACTION_LINETHROUGH_STYLE: + eLineThrough = GetTransformer().GetToken( rAttrValue ); + break; + case XML_OPTACTION_LINETHROUGH_TEXT: + if( !rAttrValue.isEmpty() ) + cLineThroughChar = rAttrValue[0]; + break; + case XML_OPTACTION_INTERPOLATION: + { + // 0: none (default) + 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::number( nSplineType )); + } + break; + case XML_OPTACTION_INTERVAL_MAJOR: + pAttrList->AddAttribute( rAttrName, rAttrValue ); + ::sax::Converter::convertDouble(fIntervalMajor, rAttrValue); + break; + case XML_OPTACTION_INTERVAL_MINOR_DIVISOR: + ::sax::Converter::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::number( 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; + else if( IsXMLToken( rAttrValue, XML_CIRCLE )) + nSymbolType = 8; + else if( IsXMLToken( rAttrValue, XML_STAR )) + nSymbolType = 9; + else if( IsXMLToken( rAttrValue, XML_X )) + nSymbolType = 10; + else if( IsXMLToken( rAttrValue, XML_PLUS )) + nSymbolType = 11; + else if( IsXMLToken( rAttrValue, XML_ASTERISK )) + nSymbolType = 12; + else if( IsXMLToken( rAttrValue, XML_HORIZONTAL_BAR )) + nSymbolType = 13; + else if( IsXMLToken( rAttrValue, XML_VERTICAL_BAR )) + nSymbolType = 14; + + if( nSymbolType >= 0 ) + pAttrList->AddAttribute( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_CHART, + GetXMLToken( XML_SYMBOL )), + OUString::number( nSymbolType )); + } + break; + // #i25616# + case XML_OPTACTION_OPACITY: + aOpacityValueRemember = rAttrValue; + XMLTransformerBase::NegPercent(aOpacityValueRemember); + break; + + // #i25616# + case XML_OPTACTION_IMAGE_OPACITY: + aImageOpacityValueRemember = rAttrValue; + XMLTransformerBase::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_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_ATACTION_CAPTION_ESCAPE_OASIS: + { + OUString aAttrValue( rAttrValue ); + if( aAttrValue.indexOf( '%' ) != -1 ) + { + sal_Int32 nValue = 0; + ::sax::Converter::convertPercent(nValue, rAttrValue); + if( nValue ) + { + nValue *= 100; + OUStringBuffer aOut; + ::sax::Converter::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 + // Adapts attribute values (#i49139#) + OUStringBuffer aNewAttrValue; + SvXMLTokenEnumerator aTokenEnum( rAttrValue ); + std::u16string_view aToken; + while( aTokenEnum.getNextToken( aToken ) ) + { + if ( !aNewAttrValue.isEmpty() ) + { + aNewAttrValue.append(" "); + } + + if ( IsXMLToken( aToken, XML_HORIZONTAL_ON_EVEN ) ) + { + aNewAttrValue.append(GetXMLToken( XML_HORIZONTAL_ON_LEFT_PAGES )); + } + else if ( IsXMLToken( aToken, XML_HORIZONTAL_ON_ODD ) ) + { + aNewAttrValue.append(GetXMLToken( XML_HORIZONTAL_ON_RIGHT_PAGES )); + } + else + { + aNewAttrValue.append(aToken); + } + } + pAttrList->AddAttribute( rAttrName, aNewAttrValue.makeStringAndClear() ); + + // create old draw:mirror for drawing graphic objects + const 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; + ::sax::Converter::convertPercent( nValue, rAttrValue ); + const double fValue = static_cast<double>(nValue) / 100.0; + pAttrList->AddAttribute( rAttrName, OUString::number( fValue ) ); + } + break; + case XML_ATACTION_OPACITY_FIX: + { + sal_Int32 nValue; + if( rAttrValue.indexOf( '%' ) != -1 ) + { + ::sax::Converter::convertPercent(nValue, rAttrValue); + } + else + { + nValue = sal_Int32( rAttrValue.toDouble() * 100.0 ); + } + nValue = 100 - nValue; + + OUStringBuffer aOut; + ::sax::Converter::convertPercent(aOut, nValue); + pAttrList->AddAttribute( rAttrName, aOut.makeStringAndClear() ); + } + break; + default: + OSL_ENSURE( false, "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 ); + + OUStringBuffer aBuf; + ::sax::Converter::convertDouble( aBuf, fIntervalMinor ); + pAttrList->AddAttribute( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_CHART, + GetXMLToken( XML_INTERVAL_MINOR )), + aBuf.makeStringAndClear()); + } + + // #i25616# + if(!aOpacityValueRemember.isEmpty() || !aImageOpacityValueRemember.isEmpty()) + { + pAttrList->AddAttribute( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_DRAW, + GetXMLToken( XML_TRANSPARENCY ) ), + !aImageOpacityValueRemember.isEmpty() + ? aImageOpacityValueRemember : aOpacityValueRemember ); + } + } + else + { + if( !m_xAttrList.is() ) + { + m_xAttrList = new XMLMutableAttributeList( rAttrList, true ); + } + else + { + static_cast< XMLMutableAttributeList * >( m_xAttrList.get() ) + ->AppendAttributeList( rAttrList ); + } + } +} + +void XMLPropertiesTContext_Impl::Export() +{ + GetTransformer().GetDocHandler()->startElement( GetExportQName(), m_xAttrList ); + ExportContent(); + GetTransformer().GetDocHandler()->endElement( GetExportQName() ); +} + +XMLPropType XMLPropertiesTContext_Impl::GetPropType( std::u16string_view 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 const & XMLPropertiesTContext_Impl::MergeUnderline( + XMLTokenEnum eUnderline, bool bBold, 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_FAIL( "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_FAIL( "xmloff::XMLPropertiesTContext_Impl::MergeUnderline(), missing underline case!" ); + break; + } + } + + return GetXMLToken( eUnderline ); +} + +OUString const & XMLPropertiesTContext_Impl::MergeLineThrough( + XMLTokenEnum eLineThrough, bool bBold, 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 ); +} + +XMLStyleOASISTContext::XMLStyleOASISTContext(XMLTransformerBase& rImp, + const OUString& rQName, 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, + bool bPersistent) + : XMLPersElemContentTContext(rImp, rQName, nPrefix, eToken) + , m_bPersistent(bPersistent) + , m_bControlStyle(false) +{ +} + +XMLStyleOASISTContext::~XMLStyleOASISTContext() +{ +} + +rtl::Reference<XMLTransformerContext> XMLStyleOASISTContext::CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const Reference< XAttributeList >& rAttrList ) +{ + rtl::Reference<XMLTransformerContext> pContext; + + if( XML_NAMESPACE_STYLE == nPrefix || XML_NAMESPACE_LO_EXT == 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_bControlStyle ); + else + m_xPropContext->SetQNameAndPropType( rQName, ePropType ); + pContext = m_xPropContext; + } + } + if( !pContext.is() ) + { + // if a properties context exist close it + if( m_xPropContext.is() && !m_bPersistent ) + { + m_xPropContext->Export(); + m_xPropContext = nullptr; + } + + 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 ); + rtl::Reference<XMLMutableAttributeList> pMutableAttrList; + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + sal_Int16 nFamilyAttr = -1; + m_bControlStyle = 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 ) ) + { + pMutableAttrList->SetValueByIndex( + i, GetXMLToken(XML_GRAPHICS) ); + } + else + { + 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 = rAttrValue.startsWith( "ctrl" ); + [[fallthrough]]; + case XML_ATACTION_DECODE_STYLE_NAME_REF: + { + OUString aAttrValue( rAttrValue ); + if( XMLTransformerBase::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( XMLTransformerBase::NegPercent(aAttrValue) ) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_URI_OASIS: + { + OUString aAttrValue( rAttrValue ); + if( GetTransformer().ConvertURIToOOo( aAttrValue, + static_cast< bool >((*aIter).second.m_nParam1))) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + default: + OSL_ENSURE( false, "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 = nullptr; + } + GetTransformer().GetDocHandler()->endElement( GetExportQName() ); + } +} + +void XMLStyleOASISTContext::Characters( const OUString& ) +{ + // element content only: +} + +void XMLStyleOASISTContext::ExportContent() +{ + if( m_xPropContext.is() ) + m_xPropContext->Export(); + XMLPersElemContentTContext::ExportContent(); +} + +bool XMLStyleOASISTContext::IsPersistent() const +{ + return m_bPersistent; +} + +XMLTransformerActions *XMLStyleOASISTContext::CreateTransformerActions( + sal_uInt16 nType ) +{ + XMLTransformerActionInit const *pInit = nullptr; + + 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 = nullptr; + if( pInit ) + pActions = new XMLTransformerActions( pInit ); + + return pActions; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/StyleOASISTContext.hxx b/xmloff/source/transform/StyleOASISTContext.hxx new file mode 100644 index 000000000..0cc3cf2fd --- /dev/null +++ b/xmloff/source/transform/StyleOASISTContext.hxx @@ -0,0 +1,63 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <rtl/ref.hxx> +#include "DeepTContext.hxx" + + +class XMLTransformerActions; +class XMLPropertiesTContext_Impl; +class XMLStyleOASISTContext : public XMLPersElemContentTContext +{ + ::rtl::Reference< XMLPropertiesTContext_Impl > m_xPropContext; + + bool const m_bPersistent; + bool m_bControlStyle; + +public: + XMLStyleOASISTContext( XMLTransformerBase& rTransformer, + const OUString& rQName, + bool bPersistent ); + XMLStyleOASISTContext( XMLTransformerBase& rTransformer, + const OUString& rQName, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken, + bool bPersistent ); + + virtual ~XMLStyleOASISTContext() override; + + virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + + virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + virtual void EndElement() override; + virtual void Characters( const OUString& rChars ) override; + + virtual void ExportContent() override; + + virtual bool IsPersistent() const override; + + static XMLTransformerActions *CreateTransformerActions( sal_uInt16 nType ); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/StyleOOoTContext.cxx b/xmloff/source/transform/StyleOOoTContext.cxx new file mode 100644 index 000000000..c9c9220ad --- /dev/null +++ b/xmloff/source/transform/StyleOOoTContext.cxx @@ -0,0 +1,1342 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#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 <sax/tools/converter.hxx> + +#include <xmloff/namespacemap.hxx> +#include <xmloff/xmltoken.hxx> +#include <xmloff/xmlnamespace.hxx> +#include "PropType.hxx" +#include "DeepTContext.hxx" +#include "RenameElemTContext.hxx" +#include "ActionMapTypesOOo.hxx" +#include "MutableAttrList.hxx" +#include "TransformerActions.hxx" +#include "PropertyActionsOOo.hxx" +#include "TransformerBase.hxx" + +#include "StyleOOoTContext.hxx" +#include <xmloff/xmluconv.hxx> +#include <rtl/math.hxx> +#include <rtl/ustrbuf.hxx> +#include <osl/diagnose.h> +#include <sal/log.hxx> +#include <array> + +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 } + +const std::array<XMLPropType,MAX_PROP_TYPES> aPropTypes[XML_FAMILY_TYPE_END] = +{ + 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, +}; + +const 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 +}; + +const 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 +}; + +const 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 +}; + +namespace { + +class XMLTypedPropertiesOOoTContext_Impl : public XMLPersElemContentTContext +{ + css::uno::Reference< css::xml::sax::XAttributeList > m_xAttrList; + +public: + XMLTypedPropertiesOOoTContext_Impl( XMLTransformerBase& rTransformer, + const OUString& rQName ); + + using XMLPersAttrListTContext::AddAttribute; + void AddAttribute( const OUString &sName , + const OUString &sValue ); + void AddAttribute( sal_uInt16 nPrefix, XMLTokenEnum eToken, + const OUString &sValue ); + + virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& rAttrList ) override; + + virtual void Export() override; +}; + +} + +XMLTypedPropertiesOOoTContext_Impl::XMLTypedPropertiesOOoTContext_Impl( + XMLTransformerBase& rImp, + const OUString& rQName ) : + XMLPersElemContentTContext( rImp, rQName ), + m_xAttrList( new XMLMutableAttributeList() ) +{ +} + +void XMLTypedPropertiesOOoTContext_Impl::AddAttribute( + const OUString &sName , + const OUString &sValue ) +{ + static_cast< XMLMutableAttributeList * >( m_xAttrList.get() ) + ->AddAttribute( sName, sValue ); +} + +void XMLTypedPropertiesOOoTContext_Impl::AddAttribute( + sal_uInt16 nPrefix, XMLTokenEnum eToken, + const 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() ); + } +} + +namespace { + +class XMLPropertiesOOoTContext_Impl : public XMLTransformerContext +{ + ::rtl::Reference < XMLTypedPropertiesOOoTContext_Impl > + m_aPropContexts[MAX_PROP_TYPES]; + + using XMLPropTypes = std::array<XMLPropType, MAX_PROP_TYPES>; + + XMLPropTypes const & m_rPropTypes; + + bool const m_bPersistent; + + XMLTypedPropertiesOOoTContext_Impl *GetPropContextAndAction( + TransformerAction_Impl& rAction, + sal_uInt16 nPrefix, const OUString& rLocalName, + bool bElem ); + + XMLTypedPropertiesOOoTContext_Impl *GetPropContext( + XMLPropType eType ); + +public: + XMLPropertiesOOoTContext_Impl( XMLTransformerBase& rTransformer, + const OUString& rQName, + const XMLPropTypes& rTypes, + bool bPersistent ); + + rtl::Reference<XMLTransformerContext> CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const Reference< XAttributeList >& rAttrList ) override; + + virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& rAttrList ) override; + + virtual void EndElement() override; + + virtual void Characters( const OUString& rChars ) override; + + virtual void Export() override; + + virtual bool IsPersistent() const override; +}; + +} + +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_rPropTypes[i] == eType ) + { + nIndex = i; + break; + } + } + if( MAX_PROP_TYPES == nIndex ) + return nullptr; + + if( !m_aPropContexts[nIndex].is() ) + { + m_aPropContexts[nIndex] = + new XMLTypedPropertiesOOoTContext_Impl( + GetTransformer(), + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_STYLE, + ::xmloff::token::GetXMLToken( + aPropTokens[m_rPropTypes[nIndex]] ) )); + } + + return m_aPropContexts[nIndex].get(); +} + +XMLTypedPropertiesOOoTContext_Impl + *XMLPropertiesOOoTContext_Impl::GetPropContextAndAction( + TransformerAction_Impl& rAction, + sal_uInt16 nPrefix, const OUString& rLocalName, + 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_rPropTypes[i]) + { + sal_uInt16 nActionMap = + (bElem ? aElemActionMaps : aAttrActionMaps)[m_rPropTypes[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_rPropTypes[1] || + (i<MAX_PROP_TYPES && XML_PROP_TYPE_END!=m_rPropTypes[i]) ) ) + { + SAL_WARN("xmloff", "Didn't find property: " + << GetTransformer().GetNamespaceMap().GetPrefixByKey( nPrefix ) + << ":" + << rLocalName + << ", assuming <style:" + << ::xmloff::token::GetXMLToken( aPropTokens[m_rPropTypes[0]] ) + << ">" ); + } +#endif + + if( !m_aPropContexts[nIndex].is() ) + { + m_aPropContexts[nIndex] = + new XMLTypedPropertiesOOoTContext_Impl( + GetTransformer(), + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_STYLE, + ::xmloff::token::GetXMLToken( + aPropTokens[m_rPropTypes[nIndex]] ) )); + } + + return m_aPropContexts[nIndex].get(); +} + +XMLPropertiesOOoTContext_Impl::XMLPropertiesOOoTContext_Impl( + XMLTransformerBase& rImp, + const OUString& rQName, + const XMLPropTypes& rTypes, + bool bPersistent ) : + XMLTransformerContext( rImp, rQName ), + // remember the types that belong to the attribute and element lists + m_rPropTypes(rTypes), + m_bPersistent( bPersistent ) +{ +} + +rtl::Reference<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, true ) + ->CreateChildContext( nPrefix, rLocalName, rQName, rAttrList ); +} + +void XMLPropertiesOOoTContext_Impl::StartElement( + const Reference< XAttributeList >& rAttrList ) +{ + XMLTypedPropertiesOOoTContext_Impl * pIntervalMinorDivisorContext = nullptr; + double fIntervalMajor = 0.0; + double fIntervalMinor = 0.0; + bool bMoveProtect = false; + bool bSizeProtect = false; + OUString aProtectAttrValue; + XMLTypedPropertiesOOoTContext_Impl * pProtectContext = nullptr; + + /* 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. (#i49139#) + */ + bool bExistStyleMirror( false ); + OUStringBuffer aStyleMirrorAttrValue; + bool bExistDrawMirror( false ); + OUString aDrawMirrorAttrValue; + XMLTypedPropertiesOOoTContext_Impl* pMirrorContext( nullptr ); + + sal_Int16 nAttrCount = rAttrList.is() ? rAttrList->getLength() : 0; + for( sal_Int16 i=0; i < nAttrCount; i++ ) + { + const OUString sAttrName = rAttrList->getNameByIndex( i ); + const OUString sAttrValue = rAttrList->getValueByIndex( i ); + OUString aLocalName; + sal_uInt16 nPrefix = + GetTransformer().GetNamespaceMap().GetKeyByAttrName( sAttrName, + &aLocalName ); + TransformerAction_Impl aAction; + XMLTypedPropertiesOOoTContext_Impl *pContext = + GetPropContextAndAction( aAction, nPrefix, aLocalName, 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( static_cast<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 ); + XMLTransformerBase::NegPercent(aAttrValue); + pContext->AddAttribute( sAttrName, aAttrValue ); + } + break; + case XML_ATACTION_RENAME_NEG_PERCENT: + { + OUString aAttrValue( sAttrValue ); + XMLTransformerBase::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( static_cast<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: + { + const 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: + { + const 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 ); + bool bBold = false, bDouble = false; + switch( eToken ) + { + case XML_SINGLE: + eToken = XML_SOLID; + break; + case XML_DOUBLE: + eToken = XML_SOLID; + bDouble = true; + break; + case XML_BOLD: + eToken = XML_SOLID; + bBold = true; + break; + case XML_BOLD_DOTTED: + eToken = XML_DOTTED; + bBold = true; + break; + case XML_BOLD_DASH: + eToken = XML_DASH; + bBold = true; + break; + case XML_BOLD_LONG_DASH: + eToken = XML_LONG_DASH; + bBold = true; + break; + case XML_BOLD_DOT_DASH: + eToken = XML_DOT_DASH; + bBold = true; + break; + case XML_BOLD_DOT_DOT_DASH: + eToken = XML_DOT_DOT_DASH; + bBold = true; + break; + case XML_BOLD_WAVE: + eToken = XML_WAVE; + bBold = true; + break; + case XML_DOUBLE_WAVE: + eToken = XML_WAVE; + bDouble = true; + break; + case XML_NONE: + eToken = XML_NONE; + bDouble = false; + break; + default: + OSL_FAIL( "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 ); + bool bBold = false, bDouble = false; + sal_Unicode c = 0; + switch( eToken ) + { + case XML_SINGLE_LINE: + eToken = XML_SOLID; + break; + case XML_DOUBLE_LINE: + eToken = XML_SOLID; + bDouble = true; + break; + case XML_THICK_LINE: + eToken = XML_SOLID; + bBold = 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( 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_FAIL( "invalid spline type" ); + pContext->AddAttribute( + aNewAttrName, GetXMLToken( XML_NONE )); + break; + } + } + break; + case XML_PTACTION_INTERVAL_MAJOR: + pContext->AddAttribute( sAttrName, sAttrValue ); + ::sax::Converter::convertDouble( fIntervalMajor, sAttrValue ); + break; + case XML_PTACTION_INTERVAL_MINOR: + ::sax::Converter::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; + case 8: + eToken = XML_CIRCLE; + break; + case 9: + eToken = XML_STAR; + break; + case 10: + eToken = XML_X; + break; + case 11: + eToken = XML_PLUS; + break; + case 12: + eToken = XML_ASTERISK; + break; + case 13: + eToken = XML_HORIZONTAL_BAR; + break; + case 14: + eToken = XML_VERTICAL_BAR; + break; + default: + OSL_FAIL( "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_FAIL( "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 ))); + rtl::Reference<XMLTransformerContext> xSymbolImageContext(pSymbolImageContext); + + OUString aAttrValue( sAttrValue ); + if( GetTransformer().ConvertURIToOASIS( aAttrValue, true )) + { + pSymbolImageContext->AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, aAttrValue ); + pContext->AddContent(xSymbolImageContext); + } + } + break; + + // #i25616# + case XML_PTACTION_TRANSPARENCY : + { + OUString aAttrValue( sAttrValue ); + XMLTransformerBase::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( '%' ) != -1 ) + { + sal_Int32 nValue = 0; + ::sax::Converter::convertPercent( nValue, sAttrValue ); + if( nValue ) + { + nValue /= 100; + OUStringBuffer aOut; + ::sax::Converter::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 + { + // OpenDocument file format: attribute value of <style:mirror> wrong (#i49139#) + aDrawMirrorAttrValue = + GetXMLToken( IsXMLToken( sAttrValue, XML_TRUE ) + ? XML_HORIZONTAL : XML_NONE ); + bExistDrawMirror = true; + pMirrorContext = pContext; + } + break; + // OpenDocument file format: attribute value of <style:mirror> wrong (#i49139#) + case XML_ATACTION_STYLE_MIRROR_OOO: // adapts style:mirror values + { + SvXMLTokenEnumerator aTokenEnum( sAttrValue ); + std::u16string_view aToken; + while( aTokenEnum.getNextToken( aToken ) ) + { + if ( !aStyleMirrorAttrValue.isEmpty() ) + { + aStyleMirrorAttrValue.append(" "); + } + + if ( IsXMLToken( aToken, XML_HORIZONTAL_ON_LEFT_PAGES ) ) + { + aStyleMirrorAttrValue.append(GetXMLToken( XML_HORIZONTAL_ON_EVEN )); + } + else if ( IsXMLToken( aToken, XML_HORIZONTAL_ON_RIGHT_PAGES ) ) + { + aStyleMirrorAttrValue.append(GetXMLToken( XML_HORIZONTAL_ON_ODD )); + } + else + { + aStyleMirrorAttrValue.append(aToken); + } + } + bExistStyleMirror = true; + pMirrorContext = pContext; + } + break; + case XML_ATACTION_GAMMA_OOO: // converts double value to percentage + { + double fValue = sAttrValue.toDouble(); + sal_Int32 nValue = static_cast<sal_Int32>((fValue * 100.0) + ( fValue > 0 ? 0.5 : - 0.5 ) ); + + OUStringBuffer aOut; + ::sax::Converter::convertPercent( aOut, nValue ); + OUString aAttrValue( aOut.makeStringAndClear() ); + pContext->AddAttribute( sAttrName, aAttrValue ); + } + break; + case XML_ATACTION_OPACITY_FIX: + { + sal_Int32 nValue; + if( sAttrValue.indexOf( '%' ) != -1 ) + { + ::sax::Converter::convertPercent( nValue, sAttrValue ); + } + else + { + nValue = sal_Int32( sAttrValue.toDouble() * 100.0 ); + } + nValue = 100 - nValue; + + OUStringBuffer aOut; + ::sax::Converter::convertPercent( aOut, nValue ); + pContext->AddAttribute( sAttrName, aOut.makeStringAndClear() ); + } + break; + default: + OSL_ENSURE( false, "unknown action" ); + break; + } + } + + // OpenDocument file format: attribute value of <style:mirror> wrong (#i49139#) + if ( bExistStyleMirror ) + { + pMirrorContext->AddAttribute( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_STYLE, GetXMLToken( XML_MIRROR ) ), + aStyleMirrorAttrValue.makeStringAndClear()); + } + else if ( bExistDrawMirror ) + { + pMirrorContext->AddAttribute( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_STYLE, GetXMLToken( XML_MIRROR ) ), + aDrawMirrorAttrValue); + } + + if (bMoveProtect || bSizeProtect || !aProtectAttrValue.isEmpty()) + { + if( (bMoveProtect ||bSizeProtect) && IsXMLToken( aProtectAttrValue, XML_NONE ) ) + aProtectAttrValue.clear(); + + const OUString& rPosition = GetXMLToken( XML_POSITION ); + if( bMoveProtect && -1 == aProtectAttrValue.indexOf( rPosition ) ) + { + if( !aProtectAttrValue.isEmpty() ) + aProtectAttrValue += " "; + aProtectAttrValue += rPosition; + } + + const OUString& rSize = GetXMLToken( XML_SIZE ); + if( bSizeProtect && -1 == aProtectAttrValue.indexOf( rSize ) ) + { + if( !aProtectAttrValue.isEmpty() ) + aProtectAttrValue += " "; + aProtectAttrValue += rSize; + } + + assert(pProtectContext && "coverity[var_deref_model] - pProtectContext should be assigned in a superset of the enclosing if condition entry logic"); + pProtectContext->AddAttribute( GetTransformer().GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_STYLE, GetXMLToken( XML_PROTECT ) ), aProtectAttrValue ); + } + + if( !pIntervalMinorDivisorContext ) + return; + + if( fIntervalMinor != 0.0 ) + { + sal_Int32 nIntervalMinorDivisor = static_cast< sal_Int32 >( + ::rtl::math::round( fIntervalMajor / fIntervalMinor )); + + pIntervalMinorDivisorContext->AddAttribute( + GetTransformer().GetNamespaceMap().GetQNameByKey( + XML_NAMESPACE_CHART, + GetXMLToken( XML_INTERVAL_MINOR_DIVISOR )), + OUString::number( nIntervalMinorDivisor )); + } +} + +void XMLPropertiesOOoTContext_Impl::EndElement() +{ + if( !m_bPersistent ) + Export(); +} + +void XMLPropertiesOOoTContext_Impl::Characters( const OUString& ) +{ + // ignore them +} + +void XMLPropertiesOOoTContext_Impl::Export() +{ + + for(rtl::Reference<XMLTypedPropertiesOOoTContext_Impl> & rPropContext : m_aPropContexts) + { + if( rPropContext.is() ) + rPropContext->Export(); + } +} + +bool XMLPropertiesOOoTContext_Impl::IsPersistent() const +{ + return m_bPersistent; +} + +XMLStyleOOoTContext::XMLStyleOOoTContext( XMLTransformerBase& rImp, + const OUString& rQName, + XMLFamilyType eT, + 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, + bool bPersistent ) : + XMLPersElemContentTContext( rImp, rQName, nPrefix, eToken ), + m_eFamily( eT ), + m_bPersistent( bPersistent ) +{ +} + +XMLStyleOOoTContext::~XMLStyleOOoTContext() +{ +} + +rtl::Reference<XMLTransformerContext> XMLStyleOOoTContext::CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const Reference< XAttributeList >& rAttrList ) +{ + rtl::Reference<XMLTransformerContext> pContext; + + if( XML_NAMESPACE_STYLE == nPrefix && + IsXMLToken( rLocalName, XML_PROPERTIES ) ) + { + if( aPropTypes[m_eFamily][0] == XML_PROP_TYPE_END ) + { + OSL_ENSURE( false, "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.set(new XMLPropertiesOOoTContext_Impl( + GetTransformer(), rQName, + aPropTypes[m_eFamily], m_bPersistent )); + } + else + { + if( m_bPersistent ) + pContext.set(new XMLPersElemContentTContext( + GetTransformer(), rQName, + XML_NAMESPACE_STYLE, + aPropTokens[aPropTypes[m_eFamily][0]] )); + else + pContext.set(new XMLRenameElemTransformerContext( + GetTransformer(), rQName, + XML_NAMESPACE_STYLE, + aPropTokens[aPropTypes[m_eFamily][0]] )); + } + } + else + { + pContext.set(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 ); + rtl::Reference<XMLMutableAttributeList> pMutableAttrList; + 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: + { + bool bControl = 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 = 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( XMLTransformerBase::NegPercent(aAttrValue) ) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_URI_OOO: + { + OUString aAttrValue( sAttrValue ); + if( GetTransformer().ConvertURIToOASIS( aAttrValue, + static_cast< bool >((*aIter).second.m_nParam1))) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + default: + OSL_ENSURE( false, "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: +} + +bool XMLStyleOOoTContext::IsPersistent() const +{ + return m_bPersistent; +} + +XMLTransformerActions *XMLStyleOOoTContext::CreateTransformerActions( + sal_uInt16 nType ) +{ + XMLTransformerActionInit const *pInit = nullptr; + + 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 = nullptr; + if( pInit ) + pActions = new XMLTransformerActions( pInit ); + + return pActions; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/StyleOOoTContext.hxx b/xmloff/source/transform/StyleOOoTContext.hxx new file mode 100644 index 000000000..f242d66c0 --- /dev/null +++ b/xmloff/source/transform/StyleOOoTContext.hxx @@ -0,0 +1,63 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <rtl/ref.hxx> +#include "FamilyType.hxx" +#include "DeepTContext.hxx" + + +class XMLTransformerActions; + +class XMLStyleOOoTContext : public XMLPersElemContentTContext +{ + XMLFamilyType m_eFamily; + + bool const m_bPersistent; + +public: + XMLStyleOOoTContext( XMLTransformerBase& rTransformer, + const OUString& rQName, + XMLFamilyType eType, + bool bPersistent ); + XMLStyleOOoTContext( XMLTransformerBase& rTransformer, + const OUString& rQName, + XMLFamilyType eType, + sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken, + bool bPersistent ); + + virtual ~XMLStyleOOoTContext() override; + + virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + + virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; + virtual void EndElement() override; + virtual void Characters( const OUString& rChars ) override; + virtual bool IsPersistent() const override; + + static XMLTransformerActions *CreateTransformerActions( sal_uInt16 nType ); + +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/Transformer.hxx b/xmloff/source/transform/Transformer.hxx new file mode 100644 index 000000000..84647a5b4 --- /dev/null +++ b/xmloff/source/transform/Transformer.hxx @@ -0,0 +1,36 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#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/implbase.hxx> + +class XMLTransformer : public ::cppu::WeakImplHelper< + css::xml::sax::XExtendedDocumentHandler, + css::lang::XServiceInfo, + css::lang::XInitialization, + css::lang::XUnoTunnel> +{ +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/TransformerAction.hxx b/xmloff/source/transform/TransformerAction.hxx new file mode 100644 index 000000000..373e32a90 --- /dev/null +++ b/xmloff/source/transform/TransformerAction.hxx @@ -0,0 +1,25 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#define XML_TACTION_EOT 0x0000 +#define XML_TACTION_END 0xffff + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/TransformerActionInit.hxx b/xmloff/source/transform/TransformerActionInit.hxx new file mode 100644 index 000000000..41ed6e771 --- /dev/null +++ b/xmloff/source/transform/TransformerActionInit.hxx @@ -0,0 +1,42 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <xmloff/xmltoken.hxx> + + +struct XMLTransformerActionInit +{ + sal_uInt16 const m_nPrefix; + ::xmloff::token::XMLTokenEnum const m_eLocalName; + sal_uInt32 const m_nActionType; + sal_uInt32 const m_nParam1; + sal_uInt32 const m_nParam2; + sal_uInt32 const m_nParam3; + + static sal_uInt32 QNameParam( sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eLocalName ) + { + return (static_cast< sal_uInt32 >( nPrefix ) << 16) + + static_cast< sal_uInt32 >( eLocalName ); + } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/TransformerActions.cxx b/xmloff/source/transform/TransformerActions.cxx new file mode 100644 index 000000000..870822f40 --- /dev/null +++ b/xmloff/source/transform/TransformerActions.cxx @@ -0,0 +1,84 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "TransformerActions.hxx" + +#include <osl/diagnose.h> + + +using namespace ::osl; +using namespace ::xmloff::token; +using namespace ::com::sun::star::uno; + +XMLTransformerActions::XMLTransformerActions( XMLTransformerActionInit const *pInit ) +{ + if( !pInit ) + return; + + XMLTransformerActions::key_type aKey; + XMLTransformerActions::mapped_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 const *pInit ) +{ + if( !pInit ) + return; + + XMLTransformerActions::key_type aKey; + XMLTransformerActions::mapped_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; + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/TransformerActions.hxx b/xmloff/source/transform/TransformerActions.hxx new file mode 100644 index 000000000..a8bfb7722 --- /dev/null +++ b/xmloff/source/transform/TransformerActions.hxx @@ -0,0 +1,131 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <rtl/ustring.hxx> +#include <xmloff/namespacemap.hxx> +#include "TransformerActionInit.hxx" +#include "TransformerAction.hxx" +#include <o3tl/hash_combine.hxx> +#include <unordered_map> + +struct NameKey_Impl +{ + sal_uInt16 m_nPrefix; + OUString m_aLocalName; + + NameKey_Impl( sal_uInt16 nPrfx, const OUString& rLclNm ) : + m_nPrefix( nPrfx ), + m_aLocalName( rLclNm ) + { + } + + NameKey_Impl() : + m_nPrefix( XML_NAMESPACE_UNKNOWN ) + { + } + + 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 +{ + std::size_t seed = 0; + o3tl::hash_combine(seed, r.m_nPrefix); + o3tl::hash_combine(seed, r.m_aLocalName.hashCode()); + return seed; +} + +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; + + 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::unordered_map< NameKey_Impl, TransformerAction_Impl, + NameHash_Impl, NameHash_Impl > +{ +public: + explicit XMLTransformerActions( XMLTransformerActionInit const *pInit ); + ~XMLTransformerActions(); + + void Add( XMLTransformerActionInit const *pInit ); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/TransformerBase.cxx b/xmloff/source/transform/TransformerBase.cxx new file mode 100644 index 000000000..90f8b1988 --- /dev/null +++ b/xmloff/source/transform/TransformerBase.cxx @@ -0,0 +1,1409 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <rtl/ref.hxx> +#include <rtl/ustrbuf.hxx> +#include <sal/log.hxx> +#include <tools/UnitConversion.hxx> +#include <osl/diagnose.h> +#include <com/sun/star/i18n/CharacterClassification.hpp> +#include <com/sun/star/i18n/UnicodeType.hpp> +#include <com/sun/star/util/MeasureUnit.hpp> +#include <sax/tools/converter.hxx> +#include <comphelper/processfactory.hxx> +#include <xmloff/namespacemap.hxx> +#include <xmloff/xmlnamespace.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" +#include "PropertyActionsOOo.hxx" +#include "TransformerTokenMap.hxx" + +#include "TransformerBase.hxx" +#include <xmloff/xmlimp.hxx> + +using namespace ::osl; +using namespace ::xmloff::token; +using namespace ::com::sun::star; +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, false, + 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_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( false, "unknown action" ); + break; + } + } + + // default is copying + return new XMLTransformerContext( *this, rQName ); +} + +XMLTransformerActions *XMLTransformerBase::GetUserDefinedActions( sal_uInt16 ) +{ + return nullptr; +} + +XMLTransformerBase::XMLTransformerBase( XMLTransformerActionInit const *pInit, + ::xmloff::token::XMLTokenEnum const *pTKMapInit ) + noexcept : + m_pNamespaceMap( new SvXMLNamespaceMap ), + m_ElemActions( pInit ), + m_TokenMap( 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() noexcept +{ +} + +void SAL_CALL XMLTransformerBase::startDocument() +{ + m_xHandler->startDocument(); +} + +void SAL_CALL XMLTransformerBase::endDocument() +{ + m_xHandler->endDocument(); +} + +void SAL_CALL XMLTransformerBase::startElement( const OUString& rName, + const Reference< XAttributeList >& rAttrList ) +{ + std::unique_ptr<SvXMLNamespaceMap> pRewindMap; + + // Process namespace attributes. This must happen before creating the + // context, because namespace declaration apply to the element name itself. + rtl::Reference<XMLMutableAttributeList> pMutableAttrList; + 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.startsWith( GetXMLToken(XML_XMLNS) ) ) && + ( rAttrName.getLength() == 5 || ':' == rAttrName[5] ) ) + { + if( !pRewindMap ) + { + pRewindMap = std::move(m_pNamespaceMap); + m_pNamespaceMap.reset( new SvXMLNamespaceMap( *pRewindMap ) ); + } + 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 unknown, try to match a name with similar + // TC Id and 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_vReplaceNamespaceMap.GetNameByKey( nKey ); + if( !rRepName.isEmpty() ) + { + 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_vContexts.empty() ) + { + xContext = m_vContexts.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 ); + + // Remember old namespace map. + if( pRewindMap ) + xContext->PutRewindMap( std::move(pRewindMap) ); + + // Push context on stack. + m_vContexts.push_back( xContext ); + + // Call a startElement at the new context. + xContext->StartElement( xAttrList ); +} + +void SAL_CALL XMLTransformerBase::endElement( const OUString& +#if OSL_DEBUG_LEVEL > 0 +rName +#endif +) +{ + if( m_vContexts.empty() ) + return; + + // Get topmost context + ::rtl::Reference< XMLTransformerContext > xContext = m_vContexts.back(); + +#if OSL_DEBUG_LEVEL > 0 + 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_vContexts.pop_back(); + + // Get a namespace map to rewind. + std::unique_ptr<SvXMLNamespaceMap> pRewindMap = xContext->TakeRewindMap(); + + // Delete the current context. + xContext = nullptr; + + // Rewind a namespace map. + if( pRewindMap ) + { + m_pNamespaceMap = std::move( pRewindMap ); + } +} + +void SAL_CALL XMLTransformerBase::characters( const OUString& rChars ) +{ + if( !m_vContexts.empty() ) + { + m_vContexts.back()->Characters( rChars ); + } +} + +void SAL_CALL XMLTransformerBase::ignorableWhitespace( const OUString& rWhitespaces ) +{ + m_xHandler->ignorableWhitespace( rWhitespaces ); +} + +void SAL_CALL XMLTransformerBase::processingInstruction( const OUString& rTarget, + const OUString& rData ) +{ + m_xHandler->processingInstruction( rTarget, rData ); +} + +void SAL_CALL XMLTransformerBase::setDocumentLocator( const Reference< XLocator >& ) +{ +} + +// XExtendedDocumentHandler +void SAL_CALL XMLTransformerBase::startCDATA() +{ +} + +void SAL_CALL XMLTransformerBase::endCDATA() +{ +} + +void SAL_CALL XMLTransformerBase::comment( const OUString& /*rComment*/ ) +{ +} + +void SAL_CALL XMLTransformerBase::allowLineBreak() +{ +} + +void SAL_CALL XMLTransformerBase::unknown( const OUString& /*rString*/ ) +{ +} + +// XInitialize +void SAL_CALL XMLTransformerBase::initialize( const Sequence< Any >& aArguments ) +{ + for( const auto& rArgument : aArguments ) + { + // 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. + + css::uno::Reference< XFastDocumentHandler > xFastHandler; + if( (rArgument >>= xFastHandler) && xFastHandler ) + { + SvXMLImport *pFastHandler = static_cast<SvXMLImport*>( xFastHandler.get() ); + m_xHandler.set( new SvXMLLegacyToFastDocHandler( pFastHandler ) ); + } + // document handler + else if( cppu::UnoType<XDocumentHandler>::get().isAssignableFrom( rArgument.getValueType() ) ) + { + m_xHandler.set( rArgument, UNO_QUERY ); + } + // property set to transport data across + else if( cppu::UnoType<XPropertySet>::get().isAssignableFrom( rArgument.getValueType() ) ) + m_xPropSet.set( rArgument, UNO_QUERY ); + // xmodel + else if( cppu::UnoType<css::frame::XModel>::get().isAssignableFrom( rArgument.getValueType() ) ) + mxModel.set( rArgument, UNO_QUERY ); + } + + if( m_xPropSet.is() ) + { + Any aAny; + OUString sRelPath, sName; + Reference< XPropertySetInfo > xPropSetInfo = + m_xPropSet->getPropertySetInfo(); + OUString sPropName( "StreamRelPath" ); + if( xPropSetInfo->hasPropertyByName(sPropName) ) + { + aAny = m_xPropSet->getPropertyValue(sPropName); + aAny >>= sRelPath; + } + sPropName = "StreamName"; + if( xPropSetInfo->hasPropertyByName(sPropName) ) + { + aAny = m_xPropSet->getPropertyValue(sPropName); + aAny >>= sName; + } + if( !sName.isEmpty() ) + { + m_aExtPathPrefix = "../"; + + // 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.isEmpty() ) + { + 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 ); + } + } + + } + } + + assert(m_xHandler.is()); // can't do anything without that +} + +static sal_Int16 lcl_getUnit( const OUString& rValue ) +{ + if( rValue.endsWithIgnoreAsciiCase( "cm" ) ) + return util::MeasureUnit::CM; + else if ( rValue.endsWithIgnoreAsciiCase( "mm" ) ) + return util::MeasureUnit::MM; + else + return util::MeasureUnit::INCH; +} + +XMLMutableAttributeList *XMLTransformerBase::ProcessAttrList( + Reference< XAttributeList >& rAttrList, sal_uInt16 nActionMap, + bool bClone ) +{ + rtl::Reference<XMLMutableAttributeList> pMutableAttrList; + 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; + bool bRename = false; + switch( nAction ) + { + case XML_ATACTION_RENAME: + bRename = 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 = true; + [[fallthrough]]; + 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 = true; + [[fallthrough]]; + 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() ) + { + sal_Int16 const nDestUnit = lcl_getUnit(aAttrValue); + + // convert twips value to inch + sal_Int32 nMeasure; + if (::sax::Converter::convertMeasure(nMeasure, + aAttrValue)) + { + nMeasure = static_cast<sal_Int32>(convertTwipToMm100(nMeasure)); + + OUStringBuffer aBuffer; + ::sax::Converter::convertMeasure(aBuffer, + nMeasure, util::MeasureUnit::MM_100TH, + nDestUnit ); + aAttrValue = aBuffer.makeStringAndClear(); + } + } + + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_RENAME_DECODE_STYLE_NAME_REF: + bRename = true; + [[fallthrough]]; + 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 = true; + [[fallthrough]]; + 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 = true; + [[fallthrough]]; + case XML_ATACTION_NEG_PERCENT: + { + OUString aAttrValue( rAttrValue ); + if( NegPercent( aAttrValue ) ) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_RENAME_ADD_NAMESPACE_PREFIX: + bRename = true; + [[fallthrough]]; + 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); + 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; + AddNamespacePrefix( aAttrValue, nValPrefix ); + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_RENAME_REMOVE_NAMESPACE_PREFIX: + bRename = true; + [[fallthrough]]; + 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< bool >((*aIter).second.m_nParam1))) + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_URI_OASIS: + { + OUString aAttrValue( rAttrValue ); + if( ConvertURIToOOo( aAttrValue, + static_cast< 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 = true; + } + break; + case XML_ATACTION_IN2TWIPS: + { + OUString aAttrValue( rAttrValue ); + XMLTransformerBase::ReplaceSingleInWithInch( aAttrValue ); + + if( isWriter() ) + { + sal_Int16 const nDestUnit = lcl_getUnit(aAttrValue); + + // convert inch value to twips and export as faked inch + sal_Int32 nMeasure; + if (::sax::Converter::convertMeasure(nMeasure, + aAttrValue)) + { + nMeasure = o3tl::toTwips(nMeasure, o3tl::Length::mm100); + + OUStringBuffer aBuffer; + ::sax::Converter::convertMeasure( aBuffer, + nMeasure, util::MeasureUnit::MM_100TH, + nDestUnit ); + aAttrValue = aBuffer.makeStringAndClear(); + } + } + + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_SVG_WIDTH_HEIGHT_OOO: + { + OUString aAttrValue( rAttrValue ); + ReplaceSingleInchWithIn( aAttrValue ); + + sal_Int16 const nDestUnit = lcl_getUnit( aAttrValue ); + + sal_Int32 nMeasure; + if (::sax::Converter::convertMeasure(nMeasure, + aAttrValue)) + { + + if( nMeasure > 0 ) + nMeasure -= 1; + else if( nMeasure < 0 ) + nMeasure += 1; + + + OUStringBuffer aBuffer; + ::sax::Converter::convertMeasure(aBuffer, nMeasure, + util::MeasureUnit::MM_100TH, nDestUnit); + aAttrValue = aBuffer.makeStringAndClear(); + } + + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_SVG_WIDTH_HEIGHT_OASIS: + { + OUString aAttrValue( rAttrValue ); + ReplaceSingleInWithInch( aAttrValue ); + + sal_Int16 const nDestUnit = lcl_getUnit( aAttrValue ); + + sal_Int32 nMeasure; + if (::sax::Converter::convertMeasure(nMeasure, + aAttrValue)) + { + + if( nMeasure > 0 ) + nMeasure += 1; + else if( nMeasure < 0 ) + nMeasure -= 1; + + + OUStringBuffer aBuffer; + ::sax::Converter::convertMeasure(aBuffer, nMeasure, + util::MeasureUnit::MM_100TH, nDestUnit ); + aAttrValue = aBuffer.makeStringAndClear(); + } + + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + break; + case XML_ATACTION_DECODE_ID: + { + 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( static_cast<sal_Int32>(c) ); + } + + pMutableAttrList->SetValueByIndex( i, aBuffer.makeStringAndClear() ); + } + break; + // #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_vContexts[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 interpreted as 0% + if ( !bIsDocumentStyle ) + { + OUString aAttrValue( rAttrValue ); + NegPercent(aAttrValue); + pMutableAttrList->SetValueByIndex( i, aAttrValue ); + } + bRename = true; + } + break; + case XML_ATACTION_SHAPEID: + { + OUString sNewValue = "shape" + rAttrValue; + pMutableAttrList->SetValueByIndex( i, sNewValue ); + break; + } + + default: + OSL_ENSURE( false, "unknown action" ); + break; + } + + if( bRename ) + { + OUString aNewAttrQName( + GetNamespaceMap().GetQNameByKey( + (*aIter).second.GetQNamePrefixFromParam1(), + ::xmloff::token::GetXMLToken( + (*aIter).second.GetQNameTokenFromParam1()) ) ); + pMutableAttrList->RenameAttributeByIndex( i, + aNewAttrQName ); + } + } + } + } + + return pMutableAttrList.get(); +} + +bool XMLTransformerBase::ReplaceSingleInchWithIn( OUString& rValue ) +{ + bool bRet = 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 = true; + } + + return bRet; +} + +bool XMLTransformerBase::ReplaceInchWithIn( OUString& rValue ) +{ + bool bRet = 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_IN) ); + nPos += 2; + bRet = true; + continue; + } + } + } + } + } + ++nPos; + } + + return bRet; +} + +bool XMLTransformerBase::ReplaceSingleInWithInch( OUString& rValue ) +{ + bool bRet = 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 = true; + } + + return bRet; +} + +bool XMLTransformerBase::ReplaceInWithInch( OUString& rValue ) +{ + bool bRet = 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 = true; + continue; + } + } + } + ++nPos; + } + + return bRet; +} + +bool XMLTransformerBase::EncodeStyleName( OUString& rName ) const +{ + static const char aHexTab[] = "0123456789abcdef"; + + bool bEncoded = false; + + sal_Int32 nLen = rName.getLength(); + OUStringBuffer aBuffer( nLen ); + + for( sal_Int32 i = 0; i < nLen; i++ ) + { + sal_Unicode c = rName[i]; + bool bValidChar = 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 = false; + } + else if( (c >= 0x02bbU && c <= 0x02c1U) || c == 0x0559 || + c == 0x06e5 || c == 0x06e6 ) + { + bValidChar = true; + } + else if( c == 0x0387 ) + { + bValidChar = i > 0; + } + else + { + if( !xCharClass.is() ) + { + const_cast < XMLTransformerBase * >(this) + ->xCharClass = CharacterClassification::create( comphelper::getProcessComponentContext() ); + } + 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 = 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( '_' ); + 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( '_' ); + bEncoded = true; + } + } + + if( aBuffer.getLength() > (1<<15)-1 ) + bEncoded = false; + + if( bEncoded ) + rName = aBuffer.makeStringAndClear(); + return bEncoded; +} + +bool XMLTransformerBase::DecodeStyleName( OUString& rName ) +{ + bool bEncoded = false; + + sal_Int32 nLen = rName.getLength(); + OUStringBuffer aBuffer( nLen ); + + bool bWithinHex = 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 = 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 = false; + break; + } + cEnc = (cEnc << 4) + cDigit; + } + else + { + aBuffer.append( c ); + } + } + + if( bEncoded ) + rName = aBuffer.makeStringAndClear(); + return bEncoded; +} + +bool XMLTransformerBase::NegPercent( OUString& rValue ) +{ + bool bRet = false; + bool bNeg = false; + double nVal = 0; + + sal_Int32 nPos = 0; + sal_Int32 nLen = rValue.getLength(); + + // skip white space + while( nPos < nLen && ' ' == rValue[nPos] ) + nPos++; + + if( nPos < nLen && '-' == rValue[nPos] ) + { + bNeg = true; + nPos++; + } + + // get number + while( nPos < nLen && + '0' <= rValue[nPos] && + '9' >= rValue[nPos] ) + { + // TODO: check overflow! + nVal *= 10; + nVal += (rValue[nPos] - '0'); + nPos++; + } + if( nPos < nLen && '.' == rValue[nPos] ) + { + nPos++; + double nDiv = 1.; + + while( nPos < nLen && + '0' <= rValue[nPos] && + '9' >= rValue[nPos] ) + { + // TODO: check overflow! + nDiv *= 10; + nVal += ( static_cast<double>(rValue[nPos] - '0') / nDiv ); + nPos++; + } + } + + // skip white space + while( nPos < nLen && ' ' == rValue[nPos] ) + nPos++; + + if( nPos < nLen && '%' == rValue[nPos] ) + { + if( bNeg ) + nVal = -nVal; + nVal += .5; + + sal_Int32 nIntVal = 100 - static_cast<sal_Int32>( nVal ); + + rValue = OUString::number(nIntVal) + "%"; + + bRet = true; + } + + return bRet; +} + +void XMLTransformerBase::AddNamespacePrefix( OUString& rName, + sal_uInt16 nPrefix ) const +{ + rName = GetNamespaceMap().GetQNameByKey( nPrefix, rName, false ); +} + +bool XMLTransformerBase::RemoveNamespacePrefix( OUString& rName, + sal_uInt16 nPrefixOnly ) const +{ + OUString aLocalName; + sal_uInt16 nPrefix = + GetNamespaceMap().GetKeyByAttrValueQName(rName, &aLocalName); + bool bRet = XML_NAMESPACE_UNKNOWN != nPrefix && + (USHRT_MAX == nPrefixOnly || nPrefix == nPrefixOnly); + if( bRet ) + rName = aLocalName; + + return bRet; +} + +bool XMLTransformerBase::ConvertURIToOASIS( OUString& rURI, + bool bSupportPackage ) const +{ + bool bRet = false; + if( !m_aExtPathPrefix.isEmpty() && !rURI.isEmpty() ) + { + bool bRel = false; + switch( rURI[0] ) + { + case '#': + // no rel path, but + // for package URIs, the '#' has to be removed + if( bSupportPackage ) + { + rURI = rURI.copy( 1 ); + bRet = true; + } + break; + case '/': + // no rel path; nothing to do + break; + case '.': + // a rel path; to keep URI simple, remove './', if there + bRel = true; + if( rURI.getLength() > 1 && '/' == rURI[1] ) + { + rURI = rURI.copy( 2 ); + bRet = true; + } + break; + default: + // check for a RFC2396 schema + { + bRel = true; + sal_Int32 nPos = 1; + sal_Int32 nLen = rURI.getLength(); + while( nPos < nLen ) + { + switch( rURI[nPos] ) + { + case '/': + // a relative path segment + nPos = nLen; // leave loop + break; + case ':': + // a schema + bRel = false; + nPos = nLen; // leave loop + break; + default: + // we don't care about any other characters + break; + } + ++nPos; + } + } + } + + if( bRel ) + { + rURI = m_aExtPathPrefix + rURI; + bRet = true; + } + } + + return bRet; +} + +bool XMLTransformerBase::ConvertURIToOOo( OUString& rURI, + bool bSupportPackage ) const +{ + bool bRet = false; + if( !rURI.isEmpty() ) + { + bool bPackage = false; + switch( rURI[0] ) + { + case '/': + // no rel path; nothing to do + break; + case '.': + // a rel path + if( rURI.startsWith( m_aExtPathPrefix ) ) + { + // an external URI; remove '../' + rURI = rURI.copy( m_aExtPathPrefix.getLength() ); + bRet = true; + } + else + { + bPackage = true; + } + break; + default: + // check for a RFC2396 schema + { + bPackage = true; + sal_Int32 nPos = 1; + sal_Int32 nLen = rURI.getLength(); + while( nPos < nLen ) + { + switch( rURI[nPos] ) + { + case '/': + // a relative path segment within the package + nPos = nLen - 1; // leave loop + break; + case ':': + // a schema + bPackage = false; + nPos = nLen - 1; // leave loop + break; + default: + // we don't care about any other characters + break; + } + ++nPos; + } + } + } + + if( bPackage && bSupportPackage ) + { + OUString sTmp( '#' ); + if( rURI.startsWith( "./" ) ) + rURI = rURI.copy( 2 ); + sTmp += rURI; + rURI = sTmp; + bRet = true; + } + } + + return bRet; +} + +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( OUString& rDateTime ) +{ + if( !rDateTime.isEmpty() && + rDateTime.indexOf( '.' ) != -1 ) + { + rDateTime = rDateTime.replace( '.', ','); + return true; + } + + return false; +} + +XMLTokenEnum XMLTransformerBase::GetToken( const OUString& rStr ) const +{ + XMLTransformerTokenMap::const_iterator aIter = + m_TokenMap.find( rStr ); + if( aIter == m_TokenMap.end() ) + return XML_TOKEN_END; + else + return (*aIter).second; +} + + +const XMLTransformerContext *XMLTransformerBase::GetCurrentContext() const +{ + OSL_ENSURE( !m_vContexts.empty(), "empty stack" ); + + + return m_vContexts.empty() ? nullptr : m_vContexts.back().get(); +} + +const XMLTransformerContext *XMLTransformerBase::GetAncestorContext( + sal_uInt32 n ) const +{ + auto nSize = m_vContexts.size(); + + OSL_ENSURE( nSize > n + 2 , "invalid context" ); + + return nSize > n + 2 ? m_vContexts[nSize - (n + 2)].get() : nullptr; +} + +bool XMLTransformerBase::isWriter() const +{ + Reference< XServiceInfo > xSI( mxModel, UNO_QUERY ); + return xSI.is() && + ( xSI->supportsService("com.sun.star.text.TextDocument") || + xSI->supportsService("com.sun.star.text.WebDocument") || + xSI->supportsService("com.sun.star.text.GlobalDocument") ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/TransformerBase.hxx b/xmloff/source/transform/TransformerBase.hxx new file mode 100644 index 000000000..8fb4e6adf --- /dev/null +++ b/xmloff/source/transform/TransformerBase.hxx @@ -0,0 +1,179 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <sal/config.h> + +#include <vector> +#include <memory> + +#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 <rtl/ref.hxx> +#include <xmloff/xmltoken.hxx> +#include <xmloff/namespacemap.hxx> + +#include "Transformer.hxx" +#include "TransformerActions.hxx" +#include "TransformerTokenMap.hxx" + +namespace com::sun::star { + namespace i18n { class XCharacterClassification; } +} + +class SvXMLNamespaceMap; +class XMLTransformerContext; +class XMLTransformerActions; +struct XMLTransformerActionInit; +struct TransformerAction_Impl; +class XMLMutableAttributeList; + +const sal_uInt16 INVALID_ACTIONS = 0xffff; + +class XMLTransformerBase : public XMLTransformer +{ + friend class XMLTransformerContext; + + css::uno::Reference< css::xml::sax::XDocumentHandler > m_xHandler; // the handlers + css::uno::Reference< css::beans::XPropertySet > m_xPropSet; + css::uno::Reference< css::i18n::XCharacterClassification > xCharClass; + + OUString m_aExtPathPrefix; + OUString m_aClass; + + std::unique_ptr<SvXMLNamespaceMap> m_pNamespaceMap; + SvXMLNamespaceMap m_vReplaceNamespaceMap; + std::vector<rtl::Reference<XMLTransformerContext>> m_vContexts; + XMLTransformerActions m_ElemActions; + XMLTransformerTokenMap const m_TokenMap; + +protected: + css::uno::Reference< css::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 OUString& rLocalName, + const OUString& rQName ); + +public: + XMLTransformerBase( XMLTransformerActionInit const *pInit, + ::xmloff::token::XMLTokenEnum const *pTKMapInit ) noexcept; + virtual ~XMLTransformerBase() noexcept override; + + // css::xml::sax::XDocumentHandler + virtual void SAL_CALL startDocument() override; + virtual void SAL_CALL endDocument() override; + virtual void SAL_CALL startElement(const OUString& aName, + const css::uno::Reference< css::xml::sax::XAttributeList > & xAttribs) override; + virtual void SAL_CALL endElement(const OUString& aName) override; + virtual void SAL_CALL characters(const OUString& aChars) override; + virtual void SAL_CALL ignorableWhitespace(const OUString& aWhitespaces) override; + virtual void SAL_CALL processingInstruction(const OUString& aTarget, + const OUString& aData) override; + virtual void SAL_CALL setDocumentLocator(const css::uno::Reference< css::xml::sax::XLocator > & xLocator) override; + + // css::xml::sax::XExtendedDocumentHandler + virtual void SAL_CALL startCDATA() override; + virtual void SAL_CALL endCDATA() override; + virtual void SAL_CALL comment(const OUString& sComment) override; + virtual void SAL_CALL allowLineBreak() override; + virtual void SAL_CALL unknown(const OUString& sString) override; + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override; + + // C++ + const css::uno::Reference< css::xml::sax::XDocumentHandler > & GetDocHandler() const { return m_xHandler; } + + const css::uno::Reference< css::beans::XPropertySet > & GetPropertySet() const { return m_xPropSet; } + + + SvXMLNamespaceMap& GetNamespaceMap() { return *m_pNamespaceMap; } + const SvXMLNamespaceMap& GetNamespaceMap() const { return *m_pNamespaceMap; } + SvXMLNamespaceMap& GetReplaceNamespaceMap() { return m_vReplaceNamespaceMap; } + + XMLTransformerActions& GetElemActions() { return m_ElemActions; } + virtual XMLTransformerActions *GetUserDefinedActions( sal_uInt16 n ); + virtual XMLTransformerContext *CreateUserDefinedContext( + const TransformerAction_Impl& rAction, + const OUString& rQName, + bool bPersistent=false ) = 0; + virtual OUString GetEventName( const OUString& rName, + bool bForm = false ) = 0; + + + XMLMutableAttributeList *ProcessAttrList( css::uno::Reference< css::xml::sax::XAttributeList >& rAttrList, + sal_uInt16 nActionMap, bool bClone ); + + static bool ReplaceSingleInchWithIn( OUString& rValue ); + static bool ReplaceSingleInWithInch( OUString& rValue ); + static bool ReplaceInchWithIn( OUString& rValue ); + static bool ReplaceInWithInch( OUString& rValue ); + + bool EncodeStyleName( OUString& rName ) const; + static bool DecodeStyleName( OUString& rName ); + static bool NegPercent( OUString& rValue ); + + void AddNamespacePrefix( OUString& rName, + sal_uInt16 nPrefix ) const; + bool RemoveNamespacePrefix( OUString& rName, + sal_uInt16 nPrefixOnly=0xffffU ) const; + + bool ConvertURIToOASIS( OUString& rURI, + bool bSupportPackage ) const; + bool ConvertURIToOOo( OUString& rURI, + bool bSupportPackage ) 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. + */ + static bool RenameAttributeValue( 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( OUString& rDateTime ); + + ::xmloff::token::XMLTokenEnum GetToken( const OUString& rStr ) const; + + const XMLTransformerContext *GetCurrentContext() const; + const XMLTransformerContext *GetAncestorContext( sal_uInt32 i ) const; + + // C++ + void SetClass( const OUString& r ) { m_aClass = r; } + const OUString& GetClass() const { return m_aClass; } + + bool isWriter() const; + +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/TransformerContext.cxx b/xmloff/source/transform/TransformerContext.cxx new file mode 100644 index 000000000..f4669aac4 --- /dev/null +++ b/xmloff/source/transform/TransformerContext.cxx @@ -0,0 +1,92 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#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 <osl/diagnose.h> + +#include "TransformerBase.hxx" + +#include "TransformerContext.hxx" + + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::xml::sax; + +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 ); +} + +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) +{ +} + +rtl::Reference<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() +{ + GetTransformer().GetDocHandler()->endElement( m_aQName ); +} + +void XMLTransformerContext::Characters( const OUString& rChars ) +{ + m_rTransformer.GetDocHandler()->characters( rChars ); +} + +bool XMLTransformerContext::IsPersistent() const +{ + return false; +} + +void XMLTransformerContext::Export() +{ + OSL_ENSURE( false, "context is not persistent" ); +} + +void XMLTransformerContext::ExportContent() +{ + OSL_ENSURE( false, "context is not persistent" ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/TransformerContext.hxx b/xmloff/source/transform/TransformerContext.hxx new file mode 100644 index 000000000..97df7498a --- /dev/null +++ b/xmloff/source/transform/TransformerContext.hxx @@ -0,0 +1,99 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <com/sun/star/xml/sax/XAttributeList.hpp> +#include <salhelper/simplereferenceobject.hxx> +#include <rtl/ref.hxx> +#include <rtl/ustring.hxx> +#include <xmloff/namespacemap.hxx> +#include <xmloff/xmltoken.hxx> +#include <memory> + +class SvXMLNamespaceMap; +class XMLTransformerBase; + +class XMLTransformerContext : public ::salhelper::SimpleReferenceObject +{ + friend class XMLTransformerBase; + + XMLTransformerBase& m_rTransformer; + + OUString m_aQName; + + std::unique_ptr<SvXMLNamespaceMap> m_xRewindMap; + + std::unique_ptr<SvXMLNamespaceMap> TakeRewindMap() { return std::move(m_xRewindMap); } + void PutRewindMap( std::unique_ptr<SvXMLNamespaceMap> p ) { m_xRewindMap = std::move(p); } + +protected: + + XMLTransformerBase& GetTransformer() { return m_rTransformer; } + const XMLTransformerBase& GetTransformer() const { return m_rTransformer; } + + void SetQName( const OUString& rQName ) { m_aQName = rQName; } + +public: + const OUString& GetQName() const { return m_aQName; } + bool HasQName( sal_uInt16 nPrefix, + ::xmloff::token::XMLTokenEnum eToken ) const; + 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 OUString& rQName ); + + // Create a children element context. By default, the import's + // CreateContext method is called to create a new default context. + virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const OUString& rQName, + const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ); + + // StartElement is called after a context has been constructed and + // before an elements context is parsed. It may be used for actions that + // require virtual methods. The default is to do nothing. + virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ); + + // EndElement is called before a context will be destructed, but + // after an 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 OUString& rChars ); + + // Is the current context a persistent one (i.e. one that saves is content + // rather than exporting it directly? + virtual 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(); +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/TransformerTokenMap.cxx b/xmloff/source/transform/TransformerTokenMap.cxx new file mode 100644 index 000000000..fc1147114 --- /dev/null +++ b/xmloff/source/transform/TransformerTokenMap.cxx @@ -0,0 +1,38 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "TransformerTokenMap.hxx" + +using namespace ::xmloff::token; + +XMLTransformerTokenMap::XMLTransformerTokenMap( XMLTokenEnum const *pInit ) +{ + if( pInit ) + { + while( *pInit != XML_TOKEN_END ) + { + XMLTransformerTokenMap::value_type aVal( GetXMLToken( *pInit ), + *pInit ); + insert( aVal ); + ++pInit; + } + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/TransformerTokenMap.hxx b/xmloff/source/transform/TransformerTokenMap.hxx new file mode 100644 index 000000000..ae810dc66 --- /dev/null +++ b/xmloff/source/transform/TransformerTokenMap.hxx @@ -0,0 +1,32 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <rtl/ustring.hxx> +#include <xmloff/xmltoken.hxx> +#include <unordered_map> + +class XMLTransformerTokenMap : public std::unordered_map<OUString, ::xmloff::token::XMLTokenEnum> +{ +public: + explicit XMLTransformerTokenMap(::xmloff::token::XMLTokenEnum const* pInit); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/xof.component b/xmloff/source/transform/xof.component new file mode 100644 index 000000000..5039731f5 --- /dev/null +++ b/xmloff/source/transform/xof.component @@ -0,0 +1,143 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + --> + +<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.Calc.XMLContentImporter" + constructor="xmloff_XMLCalcContentImportOOO_get_implementation"> + <service name="com.sun.star.comp.Calc.XMLContentImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Calc.XMLImporter" + constructor="xmloff_XMLCalcImportOOO_get_implementation"> + <service name="com.sun.star.comp.Calc.XMLImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Calc.XMLMetaImporter" + constructor="xmloff_XMLCalcMetaImportOOO_get_implementation"> + <service name="com.sun.star.comp.Calc.XMLMetaImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Calc.XMLSettingsImporter" + constructor="xmloff_XMLCalcSettingsImportOOO_get_implementation"> + <service name="com.sun.star.comp.Calc.XMLSettingsImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Calc.XMLStylesImporter" + constructor="xmloff_XMLCalcStylesImportOOO_get_implementation"> + <service name="com.sun.star.comp.Calc.XMLStylesImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Chart.XMLContentImporter" + constructor="xmloff_XMLChartContentImportOOO_get_implementation"> + <service name="com.sun.star.comp.Chart.XMLContentImporter"/> + <optional/> + </implementation> + <implementation name="com.sun.star.comp.Chart.XMLImporter" + constructor="xmloff_XMLChartImportOOO_get_implementation"> + <service name="com.sun.star.comp.Chart.XMLImporter"/> + <optional/> + </implementation> + <implementation name="com.sun.star.comp.Chart.XMLStylesImporter" + constructor="xmloff_XMLChartStylesImportOOO_get_implementation"> + <service name="com.sun.star.comp.Chart.XMLStylesImporter"/> + <optional/> + </implementation> + <implementation name="com.sun.star.comp.Draw.XMLContentImporter" + constructor="xmloff_XMLDrawContentImportOOO_get_implementation"> + <service name="com.sun.star.comp.Draw.XMLContentImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Draw.XMLImporter" + constructor="xmloff_XMLDrawImportOOO_get_implementation"> + <service name="com.sun.star.comp.Draw.XMLImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Draw.XMLMetaImporter" + constructor="xmloff_XMLDrawMetaImportOOO_get_implementation"> + <service name="com.sun.star.comp.Draw.XMLMetaImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Draw.XMLSettingsImporter" + constructor="xmloff_XMLDrawSettingsImportOOO_get_implementation"> + <service name="com.sun.star.comp.Draw.XMLSettingsImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Draw.XMLStylesImporter" + constructor="xmloff_XMLDrawStylesImportOOO_get_implementation"> + <service name="com.sun.star.comp.Draw.XMLStylesImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Impress.XMLContentImporter" + constructor="xmloff_XMLImpressContentImportOOO_get_implementation"> + <service name="com.sun.star.comp.Impress.XMLContentImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Impress.XMLImporter" + constructor="xmloff_XMLImpressImportOOO_get_implementation"> + <service name="com.sun.star.comp.Impress.XMLImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Impress.XMLMetaImporter" + constructor="xmloff_XMLImpressMetaImportOOO_get_implementation"> + <service name="com.sun.star.comp.Impress.XMLMetaImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Impress.XMLSettingsImporter" + constructor="xmloff_XMLImpressSettingsImportOOO_get_implementation"> + <service name="com.sun.star.comp.Impress.XMLSettingsImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Impress.XMLStylesImporter" + constructor="xmloff_XMLImpressStylesImportOOO_get_implementation"> + <service name="com.sun.star.comp.Impress.XMLStylesImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Math.XMLMetaImporter" + constructor="xmloff_XMLMathMetaImportOOO_get_implementation"> + <service name="com.sun.star.comp.Math.XMLMetaImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Math.XMLSettingsImporter" + constructor="xmloff_XMLMathSettingsImportOOO_get_implementation"> + <service name="com.sun.star.comp.Math.XMLSettingsImporter"/> + </implementation> + <implementation name="com.sun.star.comp.OOo2OasisTransformer" + constructor="xmloff_OOo2OasisTransformer_get_implementation"> + <service name="com.sun.star.comp.OOo2OasisTransformer"/> + <optional/> + </implementation> + <implementation name="com.sun.star.comp.Oasis2OOoTransformer" + constructor="xmloff_Oasis2OOoTransformer_get_implementation"> + <service name="com.sun.star.comp.Oasis2OOoTransformer"/> + <optional/> + </implementation> + <implementation name="com.sun.star.comp.Writer.XMLAutotextEventsImporter" + constructor="xmloff_XMLAutoTextEventImportOOO_get_implementation"> + <service name="com.sun.star.comp.Writer.XMLAutotextEventsImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Writer.XMLContentImporter" + constructor="xmloff_XMLWriterContentImportOOO_get_implementation"> + <service name="com.sun.star.comp.Writer.XMLContentImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Writer.XMLImporter" + constructor="xmloff_XMLWriterImportOOO_get_implementation"> + <service name="com.sun.star.comp.Writer.XMLImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Writer.XMLMetaImporter" + constructor="xmloff_XMLWriterMetaImportOOO_get_implementation"> + <service name="com.sun.star.comp.Writer.XMLMetaImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Writer.XMLSettingsImporter" + constructor="xmloff_XMLWriterSettingsImportOOO_get_implementation"> + <service name="com.sun.star.comp.Writer.XMLSettingsImporter"/> + </implementation> + <implementation name="com.sun.star.comp.Writer.XMLStylesImporter" + constructor="xmloff_XMLWriterStylesImportOOO_get_implementation"> + <service name="com.sun.star.comp.Writer.XMLStylesImporter"/> + </implementation> + <implementation name="com.sun.star.document.XMLMetaImporter" + constructor="xmloff_XMLMetaImportOOO_get_implementation"> + <service name="com.sun.star.document.XMLMetaImporter"/> + </implementation> +</component> diff --git a/xmloff/source/transform/xof.component.chart b/xmloff/source/transform/xof.component.chart new file mode 100644 index 000000000..77713a8b7 --- /dev/null +++ b/xmloff/source/transform/xof.component.chart @@ -0,0 +1,11 @@ +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +com.sun.star.comp.Chart.XMLContentImporter +com.sun.star.comp.Chart.XMLImporter +com.sun.star.comp.Chart.XMLStylesImporter +com.sun.star.comp.Oasis2OOoTransformer +com.sun.star.comp.OOo2OasisTransformer |