include/xmloff/DocumentSettingsContext.hxx | 8 include/xmloff/XMLTextTableContext.hxx | 1 include/xmloff/txtimp.hxx | 10 sw/source/filter/xml/xmltbli.cxx | 721 ++++++++++++++++ sw/source/filter/xml/xmltbli.hxx | 9 xmloff/inc/txtfldi.hxx | 13 xmloff/source/core/DocumentSettingsContext.cxx | 276 ++++++ xmloff/source/text/XMLFootnoteImportContext.cxx | 10 xmloff/source/text/XMLSectionImportContext.cxx | 31 xmloff/source/text/XMLSectionSourceDDEImportContext.cxx | 16 xmloff/source/text/XMLSectionSourceImportContext.cxx | 13 xmloff/source/text/XMLTextColumnsContext.cxx | 32 xmloff/source/text/XMLTextFrameContext.cxx | 39 xmloff/source/text/XMLTextFrameContext.hxx | 10 xmloff/source/text/XMLTextFrameHyperlinkContext.cxx | 85 + xmloff/source/text/XMLTextFrameHyperlinkContext.hxx | 9 xmloff/source/text/XMLTextTableContext.cxx | 6 xmloff/source/text/txtdropi.cxx | 16 xmloff/source/text/txtfldi.cxx | 182 +++- xmloff/source/text/txtimp.cxx | 17 20 files changed, 1457 insertions(+), 47 deletions(-)
New commits: commit daeb13960552847385d5160881ae818bfd4bf096 Author: Daniel Sikeler <d.sikele...@gmail.com> Date: Tue Feb 24 08:39:45 2015 +0100 fix warning "unused parameter" Change-Id: Id29b2cb5a03bb5f69a6a7bbb3d13d0cf6188e9e2 diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index 5653bb2..b4dbdde 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -601,7 +601,7 @@ SwXMLTableCellContext_Impl::SwXMLTableCellContext_Impl( } SwXMLTableCellContext_Impl::SwXMLTableCellContext_Impl( - SwXMLImport& rImport, sal_Int32 Element, + SwXMLImport& rImport, sal_Int32 /*Element*/, const Reference< xml::sax::XFastAttributeList > & xAttrList, SwXMLTableContext *pTable ) : SvXMLImportContext( rImport ), @@ -1095,7 +1095,7 @@ SwXMLTableColContext_Impl::SwXMLTableColContext_Impl( } SwXMLTableColContext_Impl::SwXMLTableColContext_Impl( - SwXMLImport& rImport, sal_Int32 Element, + SwXMLImport& rImport, sal_Int32 /*Element*/, const Reference< xml::sax::XFastAttributeList >& xAttrList, SwXMLTableContext *pTable ) : SvXMLImportContext( rImport ), commit d5a19e12e5a466b7484aaeb9cd385183802a79d8 Author: Daniel Sikeler <d.sikele...@gmail.com> Date: Tue Feb 24 08:27:23 2015 +0100 XMLDdeFiledDeclsImportContext impl fastparser interface Change-Id: I5833e52fe90d5fdb1a2457338ad4d474772526d9 diff --git a/xmloff/inc/txtfldi.hxx b/xmloff/inc/txtfldi.hxx index 85ce21d..6539813 100644 --- a/xmloff/inc/txtfldi.hxx +++ b/xmloff/inc/txtfldi.hxx @@ -1048,12 +1048,17 @@ public: XMLDdeFieldDeclsImportContext(SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& sLocalName); + XMLDdeFieldDeclsImportContext(SvXMLImport& rImport, sal_Int32 Element); virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList> & xAttrList ) SAL_OVERRIDE; + virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL + createFastChildContext( sal_Int32 Element, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) + throw(css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; }; /** import dde field declaration (<text:dde-connection-decl>) */ diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx index cf4cebc..2eddc83 100644 --- a/xmloff/source/text/txtfldi.cxx +++ b/xmloff/source/text/txtfldi.cxx @@ -3000,6 +3000,13 @@ XMLDdeFieldDeclsImportContext::XMLDdeFieldDeclsImportContext( { } +XMLDdeFieldDeclsImportContext::XMLDdeFieldDeclsImportContext( + SvXMLImport& rImport, sal_Int32 /*Element*/ ) +: SvXMLImportContext( rImport ), + aTokenMap(aDdeDeclAttrTokenMap) +{ +} + SvXMLImportContext * XMLDdeFieldDeclsImportContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, @@ -3019,7 +3026,21 @@ SvXMLImportContext * XMLDdeFieldDeclsImportContext::CreateChildContext( } } - +Reference< XFastContextHandler > SAL_CALL + XMLDdeFieldDeclsImportContext::createFastChildContext( + sal_Int32 Element, const Reference< XFastAttributeList >& xAttrList ) + throw(RuntimeException, SAXException, std::exception) +{ + if( Element == (NAMESPACE | XML_NAMESPACE_TEXT | XML_dde_connection_decl) ) + { + return new XMLDdeFieldDeclImportContext( GetImport(), Element, + aTokenMap ); + } + else + { + return SvXMLImportContext::createFastChildContext( Element, xAttrList ); + } +} // import dde field declaration commit 372ee91eebfb0fc7efc125ea56f3fe6060f838a5 Author: Daniel Sikeler <d.sikele...@gmail.com> Date: Tue Feb 24 08:26:14 2015 +0100 XMLDdeFiledDeclImportContext impl fastparser ... interface Change-Id: I121cbe4accab8b08801d6cd4be63389b10b41729 diff --git a/xmloff/inc/txtfldi.hxx b/xmloff/inc/txtfldi.hxx index 4023aac..85ce21d 100644 --- a/xmloff/inc/txtfldi.hxx +++ b/xmloff/inc/txtfldi.hxx @@ -35,7 +35,8 @@ #include <rtl/ustrbuf.hxx> namespace com { namespace sun { namespace star { - namespace xml { namespace sax { class XAttributeList; } } + namespace xml { namespace sax { class XAttributeList; + class XFastAttributeList;} } namespace text { class XTextField; } namespace beans { class XPropertySet; struct PropertyValue; } } } } @@ -1073,11 +1074,16 @@ public: sal_uInt16 nPrfx, const OUString& sLocalName, const SvXMLTokenMap& rMap); + XMLDdeFieldDeclImportContext( SvXMLImport& rImport, + sal_Int32 Element, const SvXMLTokenMap& rMap ); // create fieldmaster virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList> & xAttrList) SAL_OVERRIDE; + virtual void SAL_CALL startFastElement( sal_Int32 Element, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) + throw(css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; }; /** import dde fields (<text:dde-connection>) */ diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx index a9f367b..cf4cebc 100644 --- a/xmloff/source/text/txtfldi.cxx +++ b/xmloff/source/text/txtfldi.cxx @@ -3042,6 +3042,20 @@ XMLDdeFieldDeclImportContext::XMLDdeFieldDeclImportContext( DBG_ASSERT(IsXMLToken(sLocalName, XML_DDE_CONNECTION_DECL), "wrong name"); } +XMLDdeFieldDeclImportContext::XMLDdeFieldDeclImportContext( + SvXMLImport& rImport, sal_Int32 Element, + const SvXMLTokenMap& rMap ) +: SvXMLImportContext( rImport ), + sPropertyIsAutomaticUpdate(sAPI_is_automatic_update), + sPropertyName(sAPI_name), + sPropertyDDECommandType(sAPI_dde_command_type), + sPropertyDDECommandFile(sAPI_dde_command_file), + sPropertyDDECommandElement(sAPI_dde_command_element), + rTokenMap(rMap) +{ + DBG_ASSERT( Element == (NAMESPACE | XML_NAMESPACE_TEXT | XML_dde_connection_decl), "wrong xml-tag"); +} + void XMLDdeFieldDeclImportContext::StartElement( const Reference<XAttributeList> & xAttrList) { @@ -3160,7 +3174,119 @@ void XMLDdeFieldDeclImportContext::StartElement( // else: ignore } +void SAL_CALL XMLDdeFieldDeclImportContext::startFastElement( + sal_Int32 /*Element*/, const Reference< XFastAttributeList >& xAttrList ) + throw(RuntimeException, SAXException, std::exception) +{ + OUString sName; + OUString sCommandApplication; + OUString sCommandTopic; + OUString sCommandItem; + sal_Bool bUpdate = sal_False; + bool bNameOK = false; + bool bCommandApplicationOK = false; + bool bCommandTopicOK = false; + bool bCommandItemOK = false; + + // process attributes + Sequence< xml::FastAttribute > attributes = xAttrList->getFastAttributes(); + for( xml::FastAttribute attribute : attributes ) + { + switch (rTokenMap.Get(attribute.Token)) + { + case XML_TOK_DDEFIELD_NAME: + sName = attribute.Value; + bNameOK = true; + break; + case XML_TOK_DDEFIELD_APPLICATION: + sCommandApplication = attribute.Value; + bCommandApplicationOK = true; + break; + case XML_TOK_DDEFIELD_TOPIC: + sCommandTopic = attribute.Value; + bCommandTopicOK = true; + break; + case XML_TOK_DDEFIELD_ITEM: + sCommandItem = attribute.Value; + bCommandItemOK = true; + break; + case XML_TOK_DDEFIELD_UPDATE: + { + bool bTmp(false); + if (::sax::Converter::convertBool( + bTmp, attribute.Value) ) + { + bUpdate = bTmp; + } + break; + } + } + } + + // valid data? + if (bNameOK && bCommandApplicationOK && bCommandTopicOK && bCommandItemOK) + { + // make service name + OUStringBuffer sBuf; + sBuf.appendAscii(sAPI_fieldmaster_prefix); + sBuf.appendAscii(sAPI_dde); + + // create DDE TextFieldMaster + Reference<XMultiServiceFactory> xFactory(GetImport().GetModel(), + UNO_QUERY); + if( xFactory.is() ) + { + /* #i6432# There might be multiple occurrences of one DDE + declaration if it is used in more than one of + header/footer/body. createInstance will throw an exception if we + try to create the second, third, etc. instance of such a + declaration. Thus we ignore the exception. Otherwise this will + lead to an unloadable document. */ + try + { + Reference<XInterface> xIfc = + xFactory->createInstance(sBuf.makeStringAndClear()); + if( xIfc.is() ) + { + Reference<XPropertySet> xPropSet( xIfc, UNO_QUERY ); + if (xPropSet.is() && + xPropSet->getPropertySetInfo()->hasPropertyByName( + sPropertyDDECommandType)) + { + Any aAny; + + aAny <<= sName; + xPropSet->setPropertyValue(sPropertyName, aAny); + + aAny <<= sCommandApplication; + xPropSet->setPropertyValue(sPropertyDDECommandType, aAny); + + aAny <<= sCommandTopic; + xPropSet->setPropertyValue(sPropertyDDECommandFile, aAny); + + aAny <<= sCommandItem; + xPropSet->setPropertyValue(sPropertyDDECommandElement, + aAny); + + aAny.setValue(&bUpdate, ::getBooleanCppuType()); + xPropSet->setPropertyValue(sPropertyIsAutomaticUpdate, + aAny); + } + // else: ignore (can't get XPropertySet, or DDE + // properties are not supported) + } + // else: ignore + } + catch (const Exception&) + { + //ignore + } + } + // else: ignore + } + // else: ignore +} // DDE field import commit aecc80b48bce8cec371b8a7482d2d83385600267 Author: Daniel Sikeler <d.sikele...@gmail.com> Date: Mon Feb 23 15:55:55 2015 +0100 SwXMLTableContext method implementation all methods needed by the fastparser interface are implemented Change-Id: Ia2c4a4c91bd6fcc5606a1cc021c8f112f78207fc diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index 97b4d7a..5653bb2 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -1977,6 +1977,107 @@ SwXMLTableContext::SwXMLTableContext( SwXMLImport& rImport, nCurCol( 0UL ), nWidth( 0UL ) { + OUString aName; + OUString sXmlId; + + // this method will modify the document directly -> lock SolarMutex + SolarMutexGuard aGuard; + + if( xAttrList.is() ) + { + if( xAttrList->hasAttribute( FastToken::NAMESPACE | XML_NAMESPACE_TABLE | XML_style_name ) ) + aStyleName = xAttrList->getValue( FastToken::NAMESPACE | XML_NAMESPACE_TABLE | XML_style_name ); + else if( xAttrList->hasAttribute( FastToken::NAMESPACE | XML_NAMESPACE_TABLE | XML_name ) ) + aName = xAttrList->getValue( FastToken::NAMESPACE | XML_NAMESPACE_TABLE | XML_name ); + else if( xAttrList->hasAttribute( FastToken::NAMESPACE | XML_NAMESPACE_TABLE | XML_default_cell_style_name ) ) + aDfltCellStyleName = xAttrList->getValue( FastToken::NAMESPACE | XML_NAMESPACE_TABLE | XML_default_cell_style_name ); + else if( xAttrList->hasAttribute( FastToken::NAMESPACE | XML_NAMESPACE_XML | XML_id ) ) + sXmlId = xAttrList->getValue( FastToken::NAMESPACE | XML_NAMESPACE_XML | XML_id ); + } + + SwDoc *pDoc = SwImport::GetDocFromXMLImport( GetSwImport() ); + + OUString sTblName; + if( !aName.isEmpty() ) + { + const SwTableFmt *pTblFmt = pDoc->FindTblFmtByName( aName ); + if( !pTblFmt ) + sTblName = aName; + } + if( sTblName.isEmpty() ) + { + sTblName = pDoc->GetUniqueTblName(); + GetImport().GetTextImport() + ->GetRenameMap().Add( XML_TEXT_RENAME_TYPE_TABLE, aName, sTblName ); + } + + Reference< XTextTable > xTable; + const SwXTextTable *pXTable = 0; + Reference<XMultiServiceFactory> xFactory( GetImport().GetModel(), + UNO_QUERY ); + OSL_ENSURE( xFactory.is(), "factory missing" ); + if( xFactory.is() ) + { + Reference<XInterface> xIfc = xFactory->createInstance( "com.sun.star.text.TextTable" ); + OSL_ENSURE( xIfc.is(), "Couldn't create a table" ); + + if( xIfc.is() ) + xTable = Reference< XTextTable > ( xIfc, UNO_QUERY ); + } + + if( xTable.is() ) + { + xTable->initialize( 1, 1 ); + + try + { + xTextContent = xTable; + GetImport().GetTextImport()->InsertTextContent( xTextContent ); + } + catch( IllegalArgumentException& ) + { + xTable = 0; + } + } + + if( xTable.is() ) + { + //FIXME + // xml:id for RDF metadata + GetImport().SetXmlId(xTable, sXmlId); + + Reference<XUnoTunnel> xTableTunnel( xTable, UNO_QUERY); + if( xTableTunnel.is() ) + { + pXTable = reinterpret_cast< SwXTextTable * >( + sal::static_int_cast< sal_IntPtr >( xTableTunnel->getSomething( SwXTextTable::getUnoTunnelId() ))); + OSL_ENSURE( pXTable, "SwXTextTable missing" ); + } + + Reference < XCellRange > xCellRange( xTable, UNO_QUERY ); + Reference < XCell > xCell = xCellRange->getCellByPosition( 0, 0 ); + Reference < XText> xText( xCell, UNO_QUERY ); + xOldCursor = GetImport().GetTextImport()->GetCursor(); + GetImport().GetTextImport()->SetCursor( xText->createTextCursor() ); + + // take care of open redlines for tables + GetImport().GetTextImport()->RedlineAdjustStartNodeCursor(true); + } + if( pXTable ) + { + SwFrmFmt *pTblFrmFmt = pXTable->GetFrmFmt(); + OSL_ENSURE( pTblFrmFmt, "table format missing" ); + SwTable *pTbl = SwTable::FindTable( pTblFrmFmt ); + OSL_ENSURE( pTbl, "table missing" ); + pTableNode = pTbl->GetTableNode(); + OSL_ENSURE( pTableNode, "table node missing" ); + + pTblFrmFmt->SetName( sTblName ); + + SwTableLine *pLine1 = pTableNode->GetTable().GetTabLines()[0U]; + pBox1 = pLine1->GetTabBoxes()[0U]; + pSttNd1 = pBox1->GetSttNd(); + } } SwXMLTableContext::SwXMLTableContext( SwXMLImport& rImport, @@ -2105,6 +2206,48 @@ Reference< xml::sax::XFastContextHandler > SAL_CALL { Reference< xml::sax::XFastContextHandler > pContext = 0; + const SvXMLTokenMap& rTokenMap = GetSwImport().GetTableElemTokenMap(); + bool bHeader = false; + switch( rTokenMap.Get( Element ) ) + { + case XML_TOK_TABLE_HEADER_COLS: + case XML_TOK_TABLE_COLS: + if( IsValid() ) + pContext = new SwXMLTableColsContext_Impl( GetSwImport(), + Element, xAttrList, this ); + break; + case XML_TOK_TABLE_COL: + if( IsValid() && IsInsertColPossible() ) + pContext = new SwXMLTableColContext_Impl( GetSwImport(), + Element, xAttrList, this ); + break; + case XML_TOK_TABLE_HEADER_ROWS: + bHeader = true; + //fall-through + case XML_TOK_TABLE_ROWS: + pContext = new SwXMLTableRowsContext_Impl( GetSwImport(), + Element, xAttrList, this, bHeader ); + break; + case XML_TOK_TABLE_ROW: + if( IsInsertRowPossible() ) + pContext = new SwXMLTableRowContext_Impl( GetSwImport(), + Element, xAttrList, this ); + break; + case XML_TOK_OFFICE_DDE_SOURCE: + // save context for later processing (discard old context, if approp.) + if( IsValid() ) + { + if( pDDESource != NULL ) + { + pDDESource->ReleaseRef(); + } + pDDESource = new SwXMLDDETableContext_Impl( GetSwImport(), Element ); + pDDESource->AddFirstRef(); + pContext = pDDESource; + } + break; + } + if( !pContext.is() ) pContext = new SvXMLImportContext( GetImport() ); commit 4469d25259ca968f4ab9ad715645b9cb9cfbc3bf Author: Daniel Sikeler <d.sikele...@gmail.com> Date: Mon Feb 23 15:43:56 2015 +0100 SwXMLDDETableContext_Impl impl. fast interface all methods implemented Change-Id: I524b2a90ca051769431bc52b5e79311783608780 diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index a2ffb97..97b4d7a 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -1555,11 +1555,15 @@ public: SwXMLDDETableContext_Impl( SwXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName); + SwXMLDDETableContext_Impl( SwXMLImport& rImport, sal_Int32 Element); virtual ~SwXMLDDETableContext_Impl(); virtual void StartElement( const Reference<xml::sax::XAttributeList> & xAttrList) SAL_OVERRIDE; + virtual void SAL_CALL startFastElement( sal_Int32 Element, + const Reference< xml::sax::XFastAttributeList >& xAttrList) + throw(RuntimeException, xml::sax::SAXException, std::exception) SAL_OVERRIDE; OUString& GetConnectionName() { return sConnectionName; } OUString& GetDDEApplication() { return sDDEApplication; } @@ -1581,6 +1585,17 @@ SwXMLDDETableContext_Impl::SwXMLDDETableContext_Impl( { } +SwXMLDDETableContext_Impl::SwXMLDDETableContext_Impl( + SwXMLImport& rImport, sal_Int32 /*Element*/ ) +: SvXMLImportContext(rImport), + sConnectionName(), + sDDEApplication(), + sDDEItem(), + sDDETopic(), + bIsAutomaticUpdate(false) +{ +} + SwXMLDDETableContext_Impl::~SwXMLDDETableContext_Impl() { } @@ -1631,6 +1646,45 @@ void SwXMLDDETableContext_Impl::StartElement( } } +void SAL_CALL SwXMLDDETableContext_Impl::startFastElement( sal_Int32 /*Element*/, + const Reference< xml::sax::XFastAttributeList >& xAttrList ) + throw(RuntimeException, xml::sax::SAXException, std::exception) +{ + if( xAttrList.is() ) + { + if( xAttrList->hasAttribute( FastToken::NAMESPACE | XML_NAMESPACE_OFFICE | XML_dde_application ) ) + { + sDDEApplication = xAttrList->getValue( FastToken::NAMESPACE | XML_NAMESPACE_OFFICE | XML_dde_application ); + } + else if( xAttrList->hasAttribute( FastToken::NAMESPACE | XML_NAMESPACE_OFFICE | XML_dde_topic ) ) + { + sDDETopic = xAttrList->getValue( FastToken::NAMESPACE | XML_NAMESPACE_OFFICE | XML_dde_topic ); + } + else if( xAttrList->hasAttribute( FastToken::NAMESPACE | XML_NAMESPACE_OFFICE | XML_dde_item ) ) + { + sDDEItem = xAttrList->getValue( FastToken::NAMESPACE | XML_NAMESPACE_OFFICE | XML_dde_item ); + } + else if( xAttrList->hasAttribute( FastToken::NAMESPACE | XML_NAMESPACE_OFFICE | XML_name ) ) + { + sConnectionName = xAttrList->getValue( FastToken::NAMESPACE | XML_NAMESPACE_OFFICE | XML_name ); + } + else if( xAttrList->hasAttribute( FastToken::NAMESPACE | XML_NAMESPACE_OFFICE | XML_dde_application ) ) + { + sDDEApplication = xAttrList->getValue( FastToken::NAMESPACE | XML_NAMESPACE_OFFICE | XML_dde_application ); + } + else if( xAttrList->hasAttribute( FastToken::NAMESPACE | XML_NAMESPACE_OFFICE | XML_automatic_update ) ) + { + bool bTmp(false); + if( ::sax::Converter::convertBool(bTmp, + xAttrList->getValue( FastToken::NAMESPACE | XML_NAMESPACE_OFFICE | XML_automatic_update )) ) + { + bIsAutomaticUpdate = bTmp; + } + } + // else: unknown attibute + } +} + // generate a new name for DDE field type (called by lcl_GetDDEFieldType below) static OUString lcl_GenerateFldTypeName(const OUString& sPrefix, SwTableNode* pTableNode) { commit 41734c22db82bc6b0d16533788059d5114efdc58 Author: Daniel Sikeler <d.sikele...@gmail.com> Date: Mon Feb 23 15:18:21 2015 +0100 SwXMLTableRowsContext_Impl impl. fast interface all methods implemented Change-Id: Ife98952b9cad7d0f234538b57222df83c25e94f7 diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index 45c0260..a2ffb97 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -1459,12 +1459,19 @@ public: const Reference< xml::sax::XAttributeList > & xAttrList, SwXMLTableContext *pTable, bool bHead ); + SwXMLTableRowsContext_Impl( SwXMLImport& rImport, sal_Int32 Element, + const Reference< xml::sax::XFastAttributeList >& xAttrList, + SwXMLTableContext *pTable, bool bHead ); virtual ~SwXMLTableRowsContext_Impl(); virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< xml::sax::XAttributeList > & xAttrList ) SAL_OVERRIDE; + virtual Reference< xml::sax::XFastContextHandler > SAL_CALL + createFastChildContext( sal_Int32 Element, + const Reference< xml::sax::XFastAttributeList >& xAttrList ) + throw(RuntimeException, xml::sax::SAXException, std::exception) SAL_OVERRIDE; SwXMLImport& GetSwImport() { return static_cast<SwXMLImport&>(GetImport()); } }; @@ -1481,6 +1488,16 @@ SwXMLTableRowsContext_Impl::SwXMLTableRowsContext_Impl( SwXMLImport& rImport, { } +SwXMLTableRowsContext_Impl::SwXMLTableRowsContext_Impl( + SwXMLImport& rImport, sal_Int32 /*Element*/, + const Reference< xml::sax::XFastAttributeList >&, + SwXMLTableContext *pTable, bool bHead ) +: SvXMLImportContext( rImport ), + xMyTable( pTable ), + bHeader( bHead ) +{ +} + SwXMLTableRowsContext_Impl::~SwXMLTableRowsContext_Impl() { } @@ -1506,6 +1523,24 @@ SvXMLImportContext *SwXMLTableRowsContext_Impl::CreateChildContext( return pContext; } +Reference< xml::sax::XFastContextHandler > SAL_CALL + SwXMLTableRowsContext_Impl::createFastChildContext( sal_Int32 Element, + const Reference< xml::sax::XFastAttributeList >& xAttrList ) + throw(RuntimeException, xml::sax::SAXException, std::exception) +{ + Reference< xml::sax::XFastContextHandler > pContext = 0; + + if( Element == (FastToken::NAMESPACE | XML_NAMESPACE_TABLE | XML_table_row) + && GetTable()->IsInsertRowPossible() ) + pContext = new SwXMLTableRowContext_Impl( GetSwImport(), Element, + xAttrList, GetTable(), bHeader ); + + if( !pContext.is() ) + pContext = new SvXMLImportContext( GetImport() ); + + return pContext; +} + class SwXMLDDETableContext_Impl : public SvXMLImportContext { OUString sConnectionName; commit a601c87903967be9412611dabc386858f1241fe7 Author: Daniel Sikeler <d.sikele...@gmail.com> Date: Mon Feb 23 15:04:37 2015 +0100 SwXMLTableRowContext_Impl impl. fast interface all methods implemented Change-Id: Ic3cfce39d4fea388e5b2163e84f384f11cfc04cb diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index b79c8ea..45c0260 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -1254,14 +1254,23 @@ public: SwXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, const Reference< xml::sax::XAttributeList > & xAttrList, SwXMLTableContext *pTable, bool bInHead=false ); + SwXMLTableRowContext_Impl( SwXMLImport& rImport, sal_Int32 Element, + const Reference< xml::sax::XFastAttributeList >& xAttrList, + SwXMLTableContext *pTable, bool bInHead=false ); virtual ~SwXMLTableRowContext_Impl(); virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< xml::sax::XAttributeList > & xAttrList ) SAL_OVERRIDE; + virtual Reference< xml::sax::XFastContextHandler > SAL_CALL + createFastChildContext( sal_Int32 Element, + const Reference< xml::sax::XFastAttributeList >& xAttrList ) + throw(RuntimeException, xml::sax::SAXException, std::exception) SAL_OVERRIDE; virtual void EndElement() SAL_OVERRIDE; + virtual void SAL_CALL endFastElement( sal_Int32 Element ) + throw(RuntimeException, xml::sax::SAXException, std::exception) SAL_OVERRIDE; SwXMLImport& GetSwImport() { return static_cast<SwXMLImport&>(GetImport()); } }; @@ -1317,6 +1326,44 @@ SwXMLTableRowContext_Impl::SwXMLTableRowContext_Impl( SwXMLImport& rImport, sXmlId ); } +SwXMLTableRowContext_Impl::SwXMLTableRowContext_Impl( + SwXMLImport& rImport, sal_Int32 /*Element*/, + const Reference< xml::sax::XFastAttributeList >& xAttrList, + SwXMLTableContext *pTable, bool bInHead ) +: SvXMLImportContext( rImport ), + xMyTable( pTable ), + nRowRepeat( 1 ) +{ + OUString aStyleName, aDfltCellStyleName; + OUString sXmlId; + + if( xAttrList.is() ) + { + if( xAttrList->hasAttribute( FastToken::NAMESPACE | XML_NAMESPACE_TABLE | XML_style_name ) ) + { + aStyleName = xAttrList->getValue( FastToken::NAMESPACE | XML_NAMESPACE_TABLE | XML_style_name ); + } + else if( xAttrList->hasAttribute( FastToken::NAMESPACE | XML_NAMESPACE_TABLE | XML_number_rows_repeated ) ) + { + nRowRepeat = static_cast< sal_Int32 >( xAttrList->getValue( + FastToken::NAMESPACE | XML_NAMESPACE_TABLE | XML_number_rows_repeated ).toInt32() ); + if( nRowRepeat < 1UL ) + nRowRepeat = 1UL; + } + else if( xAttrList->hasAttribute( FastToken::NAMESPACE | XML_NAMESPACE_TABLE | XML_default_cell_style_name ) ) + { + aDfltCellStyleName = xAttrList->getValue( FastToken::NAMESPACE | XML_NAMESPACE_TABLE | XML_default_cell_style_name ); + } + else if( xAttrList->hasAttribute( FastToken::NAMESPACE | XML_NAMESPACE_XML | XML_id ) ) + { + sXmlId = xAttrList->getValue( FastToken::NAMESPACE | XML_NAMESPACE_XML | XML_id ); + } + } + if( GetTable()->IsValid() ) + GetTable()->InsertRow( aStyleName, aDfltCellStyleName, bInHead, + sXmlId ); +} + void SwXMLTableRowContext_Impl::EndElement() { if( GetTable()->IsValid() ) @@ -1328,6 +1375,18 @@ void SwXMLTableRowContext_Impl::EndElement() } } +void SAL_CALL SwXMLTableRowContext_Impl::endFastElement( sal_Int32 /*Element*/ ) + throw(RuntimeException, xml::sax::SAXException, std::exception) +{ + if( GetTable()->IsValid() ) + { + GetTable()->FinishRow(); + + if( nRowRepeat > 1UL ) + GetTable()->InsertRepRows( nRowRepeat ); + } +} + SwXMLTableRowContext_Impl::~SwXMLTableRowContext_Impl() { } @@ -1360,6 +1419,31 @@ SvXMLImportContext *SwXMLTableRowContext_Impl::CreateChildContext( return pContext; } +Reference< xml::sax::XFastContextHandler > SAL_CALL + SwXMLTableRowContext_Impl::createFastChildContext( sal_Int32 Element, + const Reference< xml::sax::XFastAttributeList >& xAttrList ) + throw(RuntimeException, xml::sax::SAXException, std::exception) +{ + Reference< xml::sax::XFastContextHandler > pContext = 0; + + if( Element == (FastToken::NAMESPACE | XML_NAMESPACE_TABLE | XML_table_cell) + || Element == (FastToken::NAMESPACE | XML_NAMESPACE_LO_EXT | XML_table_cell) ) + { + pContext = new SwXMLTableCellContext_Impl( GetSwImport(), + Element, xAttrList, GetTable() ); + } + else if( Element == (FastToken::NAMESPACE | XML_NAMESPACE_TABLE | XML_covered_table_cell) + || Element == (FastToken::NAMESPACE | XML_NAMESPACE_LO_EXT | XML_covered_table_cell) ) + { + pContext = new SvXMLImportContext( GetImport() ); + } + + if( !pContext.is() ) + pContext = new SvXMLImportContext( GetImport() ); + + return pContext; +} + class SwXMLTableRowsContext_Impl : public SvXMLImportContext { SvXMLImportContextRef xMyTable; commit ba540f330f64745058f31f7bc2060b5d86363911 Author: Daniel Sikeler <d.sikele...@gmail.com> Date: Mon Feb 23 14:37:39 2015 +0100 SwXMLTableColsContext_Impl impl. fast interface Change-Id: I41bdb7bab872c790d04e4aea5127c6866ff48d50 diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index 68f16c9..b79c8ea 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -1163,12 +1163,19 @@ public: const OUString& rLName, const Reference< xml::sax::XAttributeList > & xAttrList, SwXMLTableContext *pTable ); + SwXMLTableColsContext_Impl( SwXMLImport& rImport, sal_Int32 Element, + const Reference< xml::sax::XFastAttributeList >& xAttrList, + SwXMLTableContext *pTable ); virtual ~SwXMLTableColsContext_Impl(); virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< xml::sax::XAttributeList > & xAttrList ) SAL_OVERRIDE; + virtual Reference< xml::sax::XFastContextHandler > SAL_CALL + createFastChildContext( sal_Int32 Element, + const Reference< xml::sax::XFastAttributeList >& xAttrList ) + throw(RuntimeException, xml::sax::SAXException, std::exception) SAL_OVERRIDE; SwXMLImport& GetSwImport() { return static_cast<SwXMLImport&>(GetImport()); } }; @@ -1182,6 +1189,15 @@ SwXMLTableColsContext_Impl::SwXMLTableColsContext_Impl( { } +SwXMLTableColsContext_Impl::SwXMLTableColsContext_Impl( + SwXMLImport& rImport, sal_Int32 /*Element*/, + const Reference< xml::sax::XFastAttributeList >&, + SwXMLTableContext *pTable ) +: SvXMLImportContext( rImport ), + xMyTable( pTable ) +{ +} + SwXMLTableColsContext_Impl::~SwXMLTableColsContext_Impl() { } @@ -1206,6 +1222,24 @@ SvXMLImportContext *SwXMLTableColsContext_Impl::CreateChildContext( return pContext; } +Reference< xml::sax::XFastContextHandler > SAL_CALL + SwXMLTableColsContext_Impl::createFastChildContext( sal_Int32 Element, + const Reference< xml::sax::XFastAttributeList >& xAttrList ) + throw(RuntimeException, xml::sax::SAXException, std::exception) +{ + Reference< xml::sax::XFastContextHandler > pContext = 0; + + if( Element == (FastToken::NAMESPACE | XML_NAMESPACE_TABLE | XML_table_column) + && GetTable()->IsInsertColPossible() ) + pContext = new SwXMLTableColContext_Impl( GetSwImport(), + Element, xAttrList, GetTable() ); + + if( !pContext.is() ) + pContext = new SvXMLImportContext( GetImport() ); + + return pContext; +} + class SwXMLTableRowContext_Impl : public SvXMLImportContext { SvXMLImportContextRef xMyTable; commit 439d683c1fa130eb3f58be79ddc19179005a1511 Author: Daniel Sikeler <d.sikele...@gmail.com> Date: Mon Feb 23 14:23:17 2015 +0100 SwXMLTableColContext_Impl impl fast interfaces Change-Id: I4884e99956b850a950de68b799670c0a7acbb41d diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index 7e6b78a..68f16c9 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -1022,6 +1022,9 @@ public: SwXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, const Reference< xml::sax::XAttributeList > & xAttrList, SwXMLTableContext *pTable ); + SwXMLTableColContext_Impl( SwXMLImport& rImport, sal_Int32 Element, + const Reference< xml::sax::XFastAttributeList >& xAttrList, + SwXMLTableContext *pTable ); virtual ~SwXMLTableColContext_Impl(); @@ -1091,6 +1094,58 @@ SwXMLTableColContext_Impl::SwXMLTableColContext_Impl( } } +SwXMLTableColContext_Impl::SwXMLTableColContext_Impl( + SwXMLImport& rImport, sal_Int32 Element, + const Reference< xml::sax::XFastAttributeList >& xAttrList, + SwXMLTableContext *pTable ) +: SvXMLImportContext( rImport ), + xMyTable( pTable ) +{ + sal_uInt32 nColRep = 1UL; + OUString aStyleName, aDfltCellStyleName; + + if( xAttrList.is() ) + { + if( xAttrList->hasAttribute( FastToken::NAMESPACE | XML_NAMESPACE_TABLE | XML_style_name ) ) + aStyleName = xAttrList->getValue( FastToken::NAMESPACE | XML_NAMESPACE_TABLE | XML_style_name ); + else if( xAttrList->hasAttribute( FastToken::NAMESPACE | XML_NAMESPACE_TABLE | XML_number_columns_repeated ) ) + nColRep = static_cast< sal_uInt32 >(xAttrList->getValue( + FastToken::NAMESPACE | XML_NAMESPACE_TABLE | XML_number_columns_repeated ).toInt32()); + else if( xAttrList->hasAttribute( FastToken::NAMESPACE | XML_NAMESPACE_TABLE | XML_default_cell_style_name ) ) + aDfltCellStyleName = xAttrList->getValue( FastToken::NAMESPACE | XML_NAMESPACE_TABLE | XML_default_cell_style_name ); + else if( xAttrList->hasAttribute( FastToken::NAMESPACE | XML_NAMESPACE_XML | XML_id ) ) + { + ; + } + //FIXME where to put this??? columns do not actually exist in writer... + } + + sal_Int32 nWidth = MINLAY; + bool bRelWidth = true; + if( !aStyleName.isEmpty() ) + { + const SfxPoolItem *pItem; + const SfxItemSet *pAutoItemSet = 0; + if( GetSwImport().FindAutomaticStyle( + XML_STYLE_FAMILY_TABLE_COLUMN, + aStyleName, &pAutoItemSet ) && + pAutoItemSet && + SfxItemState::SET == pAutoItemSet->GetItemState( RES_FRM_SIZE, false, + &pItem ) ) + { + const SwFmtFrmSize *pSize = static_cast<const SwFmtFrmSize *>(pItem); + nWidth = pSize->GetWidth(); + bRelWidth = ATT_VAR_SIZE == pSize->GetHeightSizeType(); + } + } + + if( nWidth ) + { + while( nColRep-- && GetTable()->IsInsertColPossible() ) + GetTable()->InsertColumn( nWidth, bRelWidth, &aDfltCellStyleName ); + } +} + SwXMLTableColContext_Impl::~SwXMLTableColContext_Impl() { } commit 851788167c97d8bea8f32d756567e06ed26856f5 Author: Daniel Sikeler <d.sikele...@gmail.com> Date: Mon Feb 23 13:19:53 2015 +0100 SwXMLTableCellContext_Impl impl. fast interface all necessary methods from fastparser interface implemented Change-Id: Ifc8bbec6f14d8b01d75b14bc8d840c1288866307 diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index 9550f35..7e6b78a 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -446,13 +446,22 @@ public: SwXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, const Reference< xml::sax::XAttributeList > & xAttrList, SwXMLTableContext *pTable ); + SwXMLTableCellContext_Impl( SwXMLImport& rImport, sal_Int32 Element, + const Reference< xml::sax::XFastAttributeList >& xAttrList, + SwXMLTableContext *pTable ); virtual ~SwXMLTableCellContext_Impl(); virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< xml::sax::XAttributeList > & xAttrList ) SAL_OVERRIDE; + virtual Reference< xml::sax::XFastContextHandler > SAL_CALL + createFastChildContext( sal_Int32 Element, + const Reference< xml::sax::XFastAttributeList >& xAttrList ) + throw(RuntimeException, xml::sax::SAXException, std::exception) SAL_OVERRIDE; virtual void EndElement() SAL_OVERRIDE; + virtual void SAL_CALL endFastElement( sal_Int32 Element ) + throw(RuntimeException, xml::sax::SAXException, std::exception) SAL_OVERRIDE; SwXMLImport& GetSwImport() { return static_cast<SwXMLImport&>(GetImport()); } }; @@ -591,6 +600,133 @@ SwXMLTableCellContext_Impl::SwXMLTableCellContext_Impl( } } +SwXMLTableCellContext_Impl::SwXMLTableCellContext_Impl( + SwXMLImport& rImport, sal_Int32 Element, + const Reference< xml::sax::XFastAttributeList > & xAttrList, + SwXMLTableContext *pTable ) +: SvXMLImportContext( rImport ), + sFormula(), + xMyTable( pTable ), + fValue( 0.0 ), + bHasValue( false ), + m_bHasStringValue(false), + m_bValueTypeIsString(false), + bProtect( false ), + nRowSpan( 1UL ), + nColSpan( 1UL ), + nColRepeat( 1UL ), + bHasTextContent( false ), + bHasTableContent( false ) +{ + sSaveParaDefault = GetImport().GetTextImport()->GetCellParaStyleDefault(); + uno::Sequence< xml::FastAttribute > attributes = xAttrList->getFastAttributes(); + for( xml::FastAttribute attribute : attributes ) + { + const SvXMLTokenMap& rTokenMap = + GetSwImport().GetTableCellAttrTokenMap(); + switch( rTokenMap.Get( attribute.Token ) ) + { + case XML_TOK_TABLE_XMLID: + mXmlId = attribute.Value; + break; + case XML_TOK_TABLE_STYLE_NAME: + aStyleName = attribute.Value; + GetImport().GetTextImport()->SetCellParaStyleDefault(attribute.Value); + break; + case XML_TOK_TABLE_NUM_COLS_SPANNED: + nColSpan = (sal_uInt32)attribute.Value.toInt32(); + if( nColSpan < 1UL ) + nColSpan = 1UL; + break; + case XML_TOK_TABLE_NUM_ROWS_SPANNED: + nRowSpan = (sal_uInt32)attribute.Value.toInt32(); + if( nRowSpan < 1UL ) + nRowSpan = 1UL; + break; + case XML_TOK_TABLE_NUM_COLS_REPEATED: + nColRepeat = (sal_uInt32)attribute.Value.toInt32(); + if( nColRepeat < 1UL ) + nColRepeat = 1UL; + break; + case XML_TOK_TABLE_FORMULA: + { + OUString sTmp; + const sal_uInt16 nPrefix2 = GetImport().GetNamespaceMap(). + _GetKeyByAttrName( attribute.Value, &sTmp, false ); + sFormula = XML_NAMESPACE_OOOW == nPrefix2 ? sTmp : attribute.Value; + } + break; + case XML_TOK_TABLE_VALUE: + { + double fTmp; + if (::sax::Converter::convertDouble(fTmp, attribute.Value)) + { + fValue = fTmp; + bHasValue = true; + } + } + break; + case XML_TOK_TABLE_TIME_VALUE: + { + double fTmp; + if (::sax::Converter::convertDuration(fTmp, attribute.Value)) + { + fValue = fTmp; + bHasValue = true; + } + } + break; + case XML_TOK_TABLE_DATE_VALUE: + { + double fTmp; + if (GetImport().GetMM100UnitConverter().convertDateTime(fTmp, + attribute.Value)) + { + fValue = fTmp; + bHasValue = true; + } + } + break; + case XML_TOK_TABLE_BOOLEAN_VALUE: + { + bool bTmp(false); + if (::sax::Converter::convertBool(bTmp, attribute.Value)) + { + fValue = (bTmp ? 1.0 : 0.0); + bHasValue = true; + } + } + break; + case XML_TOK_TABLE_PROTECTED: + { + bool bTmp(false); + if (::sax::Converter::convertBool(bTmp, attribute.Value)) + { + bProtect = bTmp; + } + } + break; + case XML_TOK_TABLE_STRING_VALUE: + { + m_StringValue = attribute.Value; + m_bHasStringValue = true; + } + break; + case XML_TOK_TABLE_VALUE_TYPE: + { + if ("string" == attribute.Value) + { + m_bValueTypeIsString = true; + } + // ignore other types - it would be correct to require + // matching value-type and $type-value attributes, + // but we've been reading those without checking forever. + } + break; + } + } +} + SwXMLTableCellContext_Impl::~SwXMLTableCellContext_Impl() { } @@ -696,6 +832,66 @@ SvXMLImportContext *SwXMLTableCellContext_Impl::CreateChildContext( return pContext; } +Reference< xml::sax::XFastContextHandler > SAL_CALL + SwXMLTableCellContext_Impl::createFastChildContext( sal_Int32 Element, + const Reference< xml::sax::XFastAttributeList >& xAttrList ) + throw(RuntimeException, xml::sax::SAXException, std::exception) +{ + Reference< xml::sax::XFastContextHandler > pContext = 0; + + OUString sXmlId; + bool bSubTable = false; + if( Element == (FastToken::NAMESPACE | XML_NAMESPACE_TABLE | XML_table) ) + { + uno::Sequence< xml::FastAttribute > attributes = xAttrList->getFastAttributes(); + for( xml::FastAttribute attribute : attributes ) + { + if( attribute.Token == (FastToken::NAMESPACE | XML_NAMESPACE_TABLE | XML_is_sub_table) + && attribute.Value.equals( "true" ) ) + { + bSubTable = true; + } + else if( attribute.Token == (FastToken::NAMESPACE | XML_NAMESPACE_XML | XML_id) ) + { + sXmlId = attribute.Value; + } + //FIXME: RDFa + } + } + + if( bSubTable ) + { + if( !HasContent() ) + { + SwXMLTableContext *pTblContext = + new SwXMLTableContext( GetSwImport(), Element, + xAttrList, GetTable() ); + pContext = pTblContext; + if( GetTable()->IsValid() ) + InsertContent( pTblContext ); + + GetTable()->SetHasSubTables( true ); + } + } + else + { + if( GetTable()->IsValid() ) + InsertContentIfNotThere(); + // fdo#60842: "office:string-value" overrides text content -> no import + if (!(m_bValueTypeIsString && m_bHasStringValue)) + { + pContext = GetImport().GetTextImport()->CreateTextChildContext( + GetImport(), Element, xAttrList, + XML_TEXT_TYPE_CELL ); + } + } + + if( !pContext.is() ) + pContext = new SvXMLImportContext( GetImport() ); + + return pContext; +} + void SwXMLTableCellContext_Impl::EndElement() { if( GetTable()->IsValid() ) @@ -754,6 +950,66 @@ void SwXMLTableCellContext_Impl::EndElement() GetImport().GetTextImport()->SetCellParaStyleDefault(sSaveParaDefault); } +void SAL_CALL SwXMLTableCellContext_Impl::endFastElement( sal_Int32 /*Element*/) + throw(RuntimeException, xml::sax::SAXException, std::exception) +{ + if( GetTable()->IsValid() ) + { + if( bHasTextContent ) + { + GetImport().GetTextImport()->DeleteParagraph(); + if( nColRepeat > 1 && nColSpan == 1 ) + { + // The original text is invalid after deleting the last + // paragraph + Reference < XTextCursor > xSrcTxtCursor = + GetImport().GetTextImport()->GetText()->createTextCursor(); + xSrcTxtCursor->gotoEnd( sal_True ); + + // Until we have an API for copying we have to use the core. + Reference<XUnoTunnel> xSrcCrsrTunnel( xSrcTxtCursor, UNO_QUERY); + assert(xSrcCrsrTunnel.is() && "missing XUnoTunnel for Cursor"); + OTextCursorHelper *pSrcTxtCrsr = reinterpret_cast< OTextCursorHelper * >( + sal::static_int_cast< sal_IntPtr >( xSrcCrsrTunnel->getSomething( OTextCursorHelper::getUnoTunnelId() ))); + assert(pSrcTxtCrsr && "SwXTextCursor missing"); + SwDoc *pDoc = pSrcTxtCrsr->GetDoc(); + const SwPaM *pSrcPaM = pSrcTxtCrsr->GetPaM(); + + while( nColRepeat > 1 && GetTable()->IsInsertCellPossible() ) + { + _InsertContent(); + + Reference<XUnoTunnel> xDstCrsrTunnel( + GetImport().GetTextImport()->GetCursor(), UNO_QUERY); + assert(xDstCrsrTunnel.is() && "missing XUnoTunnel for Cursor"); + OTextCursorHelper *pDstTxtCrsr = reinterpret_cast< OTextCursorHelper * >( + sal::static_int_cast< sal_IntPtr >( xDstCrsrTunnel->getSomething( OTextCursorHelper::getUnoTunnelId() )) ); + assert(pDstTxtCrsr && "SwXTextCursor missing"); + SwPaM aSrcPaM(*pSrcPaM->GetMark(), *pSrcPaM->GetPoint()); + SwPosition aDstPos( *pDstTxtCrsr->GetPaM()->GetPoint() ); + pDoc->getIDocumentContentOperations().CopyRange( aSrcPaM, aDstPos, false ); + + nColRepeat--; + } + } + } + else if( !bHasTableContent ) + { + InsertContent(); + if( nColRepeat > 1 && nColSpan == 1 ) + { + while( nColRepeat > 1 && GetTable()->IsInsertCellPossible() ) + { + _InsertContent(); + nColRepeat--; + } + } + } + } + GetImport().GetTextImport()->SetCellParaStyleDefault(sSaveParaDefault); +} + + class SwXMLTableColContext_Impl : public SvXMLImportContext { SvXMLImportContextRef xMyTable; commit 0c29905a1843f25d0c659d65c4c592493205753c Author: Daniel Sikeler <d.sikele...@gmail.com> Date: Mon Feb 23 13:35:55 2015 +0100 SwXMLTableContext impl. fastparser interface only method declarations, no implementation Change-Id: I582be1320c7b6140159479e25809fbc22bbcf25c diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index 72134aa..9550f35 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -1439,6 +1439,29 @@ SwXMLTableContext::SwXMLTableContext( SwXMLImport& rImport, } SwXMLTableContext::SwXMLTableContext( SwXMLImport& rImport, + sal_Int32 Element, + const Reference< xml::sax::XFastAttributeList > & xAttrList ) +: XMLTextTableContext( rImport, Element ), + pColumnDefaultCellStyleNames( 0 ), + pRows( new SwXMLTableRows_Impl ), + pTableNode( 0 ), + pBox1( 0 ), + pSttNd1( 0 ), + pBoxFmt( 0 ), + pLineFmt( 0 ), + pSharedBoxFormats(NULL), + pDDESource(NULL), + bFirstSection( true ), + bRelWidth( true ), + bHasSubTables( false ), + nHeaderRows( 0 ), + nCurRow( 0UL ), + nCurCol( 0UL ), + nWidth( 0UL ) +{ +} + +SwXMLTableContext::SwXMLTableContext( SwXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, const Reference< xml::sax::XAttributeList > &, @@ -1464,6 +1487,30 @@ SwXMLTableContext::SwXMLTableContext( SwXMLImport& rImport, { } +SwXMLTableContext::SwXMLTableContext( SwXMLImport& rImport, + sal_Int32 Element, const Reference< xml::sax::XFastAttributeList >&, + SwXMLTableContext *pTable ) +: XMLTextTableContext( rImport, Element ), + pColumnDefaultCellStyleNames( 0 ), + pRows( new SwXMLTableRows_Impl ), + pTableNode( pTable->pTableNode ), + pBox1( 0 ), + pSttNd1( 0 ), + pBoxFmt( 0 ), + pLineFmt( 0 ), + pSharedBoxFormats(NULL), + xParentTable( pTable ), + pDDESource(NULL), + bFirstSection( false ), + bRelWidth( true ), + bHasSubTables( false ), + nHeaderRows( 0 ), + nCurRow( 0UL ), + nCurCol( 0UL ), + nWidth( 0UL ) +{ +} + SwXMLTableContext::~SwXMLTableContext() { delete pColumnDefaultCellStyleNames; @@ -1533,6 +1580,19 @@ SvXMLImportContext *SwXMLTableContext::CreateChildContext( sal_uInt16 nPrefix, return pContext; } +Reference< xml::sax::XFastContextHandler > SAL_CALL + SwXMLTableContext::createFastChildContext( sal_Int32 Element, + const Reference< xml::sax::XFastAttributeList >& xAttrList ) + throw(RuntimeException, xml::sax::SAXException, std::exception) +{ + Reference< xml::sax::XFastContextHandler > pContext = 0; + + if( !pContext.is() ) + pContext = new SvXMLImportContext( GetImport() ); + + return pContext; +} + void SwXMLTableContext::InsertColumn( sal_Int32 nWidth2, bool bRelWidth2, const OUString *pDfltCellStyleName ) { diff --git a/sw/source/filter/xml/xmltbli.hxx b/sw/source/filter/xml/xmltbli.hxx index f5017fb..ac62c96 100644 --- a/sw/source/filter/xml/xmltbli.hxx +++ b/sw/source/filter/xml/xmltbli.hxx @@ -136,11 +136,16 @@ public: const OUString& rLName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); + SwXMLTableContext( SwXMLImport& rImport, sal_Int32 Element, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList); SwXMLTableContext( SwXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList, SwXMLTableContext *pTable ); + SwXMLTableContext( SwXMLImport& rImport, sal_Int32 Element, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList, + SwXMLTableContext *pTable ); virtual ~SwXMLTableContext(); @@ -148,6 +153,10 @@ public: const OUString& rLocalName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList ) SAL_OVERRIDE; + virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL + createFastChildContext( sal_Int32 Element, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList) + throw(css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; SwXMLImport& GetSwImport() { return static_cast<SwXMLImport&>(GetImport()); } commit 1582c490a700bc6f909ddd145fd41f3560df9e22 Author: Daniel Sikeler <d.sikele...@gmail.com> Date: Mon Feb 23 13:46:10 2015 +0100 XMLTextImportHelper compatible with fastparser one method needs implementation Change-Id: Id76773e3e0fdb1e05cc3d68de6da938f2598c449 diff --git a/include/xmloff/txtimp.hxx b/include/xmloff/txtimp.hxx index 592c834..a98581d 100644 --- a/include/xmloff/txtimp.hxx +++ b/include/xmloff/txtimp.hxx @@ -64,7 +64,8 @@ namespace text { namespace frame { class XModel; } namespace container { class XNameContainer; class XIndexReplace; class XNameAccess; } namespace beans { class XPropertySet; } -namespace xml { namespace sax { class XAttributeList; } } +namespace xml { namespace sax { class XAttributeList; + class XFastAttributeList; } } namespace util { struct DateTime; } namespace lang { class XMultiServiceFactory; } } } } @@ -383,6 +384,9 @@ protected: sal_uInt16 nPrefix, const OUString& rLocalName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); + virtual SvXMLImportContext *CreateTableChildContext( + SvXMLImport& rImport, sal_Int32 Element, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList); // access, lazy initialization and destruction of backpatchers // Code is implemented in XMLPropertyBackpatcher.cxx @@ -415,6 +419,10 @@ public: const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList, XMLTextType eType = XML_TEXT_TYPE_SHAPE ); + SvXMLImportContext *CreateTextChildContext( + SvXMLImport& rImport, sal_Int32 Element, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList, + XMLTextType eType = XML_TEXT_TYPE_SHAPE ); SvXMLTokenMap const& GetTextElemTokenMap(); SvXMLTokenMap const& GetTextPElemTokenMap(); diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index edecd75..3683df5 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -2612,6 +2612,16 @@ SvXMLImportContext *XMLTextImportHelper::CreateTextChildContext( return pContext; } +SvXMLImportContext *XMLTextImportHelper::CreateTextChildContext( + SvXMLImport& rImport, sal_Int32 Element, + const Reference< XFastAttributeList >& xAttrList, + XMLTextType eType ) +{ + SvXMLImportContext *pContext = 0; + + return pContext; +} + SvXMLImportContext *XMLTextImportHelper::CreateTableChildContext( SvXMLImport&, sal_uInt16 /*nPrefix*/, const OUString& /*rLocalName*/, @@ -2620,6 +2630,13 @@ SvXMLImportContext *XMLTextImportHelper::CreateTableChildContext( return 0; } +SvXMLImportContext *XMLTextImportHelper::CreateTableChildContext( + SvXMLImport&, sal_Int32 /*Element*/, + const Reference< XFastAttributeList >& ) +{ + return 0; +} + /// get data style key for use with NumberFormat property sal_Int32 XMLTextImportHelper::GetDataStyleKey(const OUString& sStyleName, bool* pIsSystemLanguage ) commit 0c3da70b9c8c5fa489259617dc94b9265a4ae622 Author: Daniel Sikeler <d.sikele...@gmail.com> Date: Mon Feb 23 13:39:42 2015 +0100 XMLTextTableContext implements fast interface Change-Id: Id33586bf876d822ae9a3fd4cfc18877fb20c3adf diff --git a/include/xmloff/XMLTextTableContext.hxx b/include/xmloff/XMLTextTableContext.hxx index a039beb..f5d8857 100644 --- a/include/xmloff/XMLTextTableContext.hxx +++ b/include/xmloff/XMLTextTableContext.hxx @@ -39,6 +39,7 @@ public: XMLTextTableContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName ); + XMLTextTableContext( SvXMLImport& rImport, sal_Int32 Element ); virtual ~XMLTextTableContext(); virtual ::com::sun::star::uno::Reference < diff --git a/xmloff/source/text/XMLTextTableContext.cxx b/xmloff/source/text/XMLTextTableContext.cxx index 51f0755..22996c7 100644 --- a/xmloff/source/text/XMLTextTableContext.cxx +++ b/xmloff/source/text/XMLTextTableContext.cxx @@ -33,6 +33,12 @@ XMLTextTableContext::XMLTextTableContext( { } +XMLTextTableContext::XMLTextTableContext( + SvXMLImport& rImport, sal_Int32 /*Element*/ ) +: SvXMLImportContext( rImport ) +{ +} + XMLTextTableContext::~XMLTextTableContext() { } commit 054d890b2ec83876ebfbda5a4da1f7a1b3125340 Author: Daniel Sikeler <d.sikele...@gmail.com> Date: Fri Feb 13 13:23:54 2015 +0100 XMLDocumentSettingsContext impl. fast interface all methods implemented Change-Id: Ia4f99d9f4509e7ea38b89d37989ddc5c31e407a9 diff --git a/include/xmloff/DocumentSettingsContext.hxx b/include/xmloff/DocumentSettingsContext.hxx index 24296f3..0df9d77 100644 --- a/include/xmloff/DocumentSettingsContext.hxx +++ b/include/xmloff/DocumentSettingsContext.hxx @@ -38,13 +38,21 @@ public: XMLDocumentSettingsContext(SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList>& xAttrList); + XMLDocumentSettingsContext( SvXMLImport& rImport, sal_Int32 Element, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList); virtual ~XMLDocumentSettingsContext(); virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList>& xAttrList ) SAL_OVERRIDE; + virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( + sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList>& Attribs) + throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; + virtual void EndElement() SAL_OVERRIDE; + virtual void SAL_CALL endFastElement( sal_Int32 Element) + throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; private: XMLDocumentSettingsContext(); // never implemented diff --git a/xmloff/source/core/DocumentSettingsContext.cxx b/xmloff/source/core/DocumentSettingsContext.cxx index 2f52387..d083f7a 100644 --- a/xmloff/source/core/DocumentSettingsContext.cxx +++ b/xmloff/source/core/DocumentSettingsContext.cxx @@ -372,6 +372,15 @@ XMLDocumentSettingsContext::XMLDocumentSettingsContext(SvXMLImport& rImport, sal // here are no attributes } +XMLDocumentSettingsContext::XMLDocumentSettingsContext( + SvXMLImport& rImport, sal_Int32 /*Element*/, + const uno::Reference< xml::sax::XFastAttributeList >& ) +: SvXMLImportContext( rImport ), + m_pData( new XMLDocumentSettingsContext_Data ) +{ + // here are no attributes +} + XMLDocumentSettingsContext::~XMLDocumentSettingsContext() { } @@ -441,8 +450,50 @@ SvXMLImportContext *XMLDocumentSettingsContext::CreateChildContext( sal_uInt16 p return pContext; } +uno::Reference< xml::sax::XFastContextHandler > SAL_CALL XMLDocumentSettingsContext::createFastChildContext( + sal_Int32 Element, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) +{ + SvXMLImportContext *pContext = 0; + OUString sName; + + if( xAttrList->hasAttribute( FastToken::NAMESPACE | XML_NAMESPACE_CONFIG | XML_name ) ) + { + sName = xAttrList->getValue( FastToken::NAMESPACE | XML_NAMESPACE_CONFIG | XML_name ); + } + + if( Element == (FastToken::NAMESPACE | XML_NAMESPACE_CONFIG | XML_config_item_set) ) + { + if( xAttrList->hasAttribute( FastToken::NAMESPACE | XML_NAMESPACE_OOO | XML_view_settings ) ) + pContext = new XMLConfigItemSetContext(GetImport(), xAttrList, m_pData->aViewProps, NULL); + else if( xAttrList->hasAttribute( FastToken::NAMESPACE | XML_NAMESPACE_OOO | XML_configuration_settings ) ) + pContext = new XMLConfigItemSetContext(GetImport(), xAttrList, m_pData->aConfigProps, NULL); + else + { + //TODO :: Fix right name + m_pData->aDocSpecificSettings.push_back( SettingsGroup( "", uno::Any() ) ); + std::list< SettingsGroup >::reverse_iterator settingsPos = + m_pData->aDocSpecificSettings.rbegin(); + + pContext = new XMLConfigItemSetContext(GetImport(), xAttrList, settingsPos->aSettings, NULL); + } + } + + if( !pContext ) + pContext = new SvXMLImportContext( GetImport() ); + + return pContext; +} + void XMLDocumentSettingsContext::EndElement() { + //workaround until EndElement can be removed + endFastElement(0); +} + +void SAL_CALL XMLDocumentSettingsContext::endFastElement( sal_Int32 /*Element*/ ) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) +{ uno::Sequence<beans::PropertyValue> aSeqViewProps; if (m_pData->aViewProps >>= aSeqViewProps) { commit 51d846e71204921a78b60567ea071751722be441 Author: Daniel Sikeler <d.sikele...@gmail.com> Date: Fri Feb 13 13:14:55 2015 +0100 derived classes of XMLConfigBaseContext ... implement fast interface XMLConfigItemMapIndexedContext XMLConfigItemSetContext XMLConfigItemMapNamedContext Change-Id: I77d60ec15f31f4908194c688b0ad8eaff97bb3d5 diff --git a/xmloff/source/core/DocumentSettingsContext.cxx b/xmloff/source/core/DocumentSettingsContext.cxx index 2510924..2f52387 100644 --- a/xmloff/source/core/DocumentSettingsContext.cxx +++ b/xmloff/source/core/DocumentSettingsContext.cxx @@ -191,14 +191,22 @@ public: ::com::sun::star::xml::sax::XAttributeList>& xAttrList, com::sun::star::uno::Any& rAny, XMLConfigBaseContext* pBaseContext); + XMLConfigItemSetContext(SvXMLImport& rImport, + const uno::Reference< xml::sax::XFastAttributeList >& xAttrList, + uno::Any& rAny, XMLConfigBaseContext* pBaseContext); virtual ~XMLConfigItemSetContext(); virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList>& xAttrList ) SAL_OVERRIDE; + virtual uno::Reference< xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( + sal_Int32 Element, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList ) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) SAL_OVERRIDE; virtual void EndElement() SAL_OVERRIDE; + virtual void SAL_CALL endFastElement( sal_Int32 Element ) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) SAL_OVERRIDE; }; class XMLConfigItemMapNamedContext : public XMLConfigBaseContext @@ -209,6 +217,9 @@ public: ::com::sun::star::xml::sax::XAttributeList>& xAttrList, com::sun::star::uno::Any& rAny, XMLConfigBaseContext* pBaseContext); + XMLConfigItemMapNamedContext(SvXMLImport& rImport, sal_Int32 Element, + const uno::Reference< xml::sax::XFastAttributeList >& xAttrList, + uno::Any& rAny, XMLConfigBaseContext* pBaseContext); virtual ~XMLConfigItemMapNamedContext(); virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, @@ -217,6 +228,13 @@ public: ::com::sun::star::xml::sax::XAttributeList>& xAttrList ) SAL_OVERRIDE; virtual void EndElement() SAL_OVERRIDE; + + virtual uno::Reference< xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( + sal_Int32 Element, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList ) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) SAL_OVERRIDE; + + virtual void SAL_CALL endFastElement( sal_Int32 Element ) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) SAL_OVERRIDE; }; class XMLConfigItemMapIndexedContext : public XMLConfigBaseContext @@ -232,6 +250,10 @@ public: com::sun::star::uno::Any& rAny, const OUString& rConfigItemName, XMLConfigBaseContext* pBaseContext); + XMLConfigItemMapIndexedContext(SvXMLImport& rImport, sal_Int32 Element, + const uno::Reference< xml::sax::XFastAttributeList >& xAttrList, + uno::Any& rAny, const OUString& rConfigItemName, XMLConfigBaseContext* pBaseContext); + virtual ~XMLConfigItemMapIndexedContext(); virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, @@ -240,6 +262,13 @@ public: ::com::sun::star::xml::sax::XAttributeList>& xAttrList ) SAL_OVERRIDE; virtual void EndElement() SAL_OVERRIDE; + + virtual uno::Reference< xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( + sal_Int32 Element, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList ) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) SAL_OVERRIDE; + + virtual void SAL_CALL endFastElement( sal_Int32 Element ) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) SAL_OVERRIDE; }; SvXMLImportContext *CreateSettingsContext(SvXMLImport& rImport, sal_uInt16 p_nPrefix, @@ -285,6 +314,34 @@ SvXMLImportContext *CreateSettingsContext(SvXMLImport& rImport, sal_uInt16 p_nPr return pContext; } +uno::Reference< xml::sax::XFastContextHandler > CreateSettingsContext( + SvXMLImport& rImport, sal_Int32 Element, + const uno::Reference< xml::sax::XFastAttributeList >& xAttrList, + beans::PropertyValue& rProp, XMLConfigBaseContext* pBaseContext) +{ + SvXMLImportContext *pContext = 0; + rProp.Name.clear(); + + if( xAttrList->hasAttribute( FastToken::NAMESPACE | XML_NAMESPACE_CONFIG | XML_name ) ) + { + rProp.Name = xAttrList->getValue( FastToken::NAMESPACE | XML_NAMESPACE_CONFIG | XML_name ); + } + + if( Element == (FastToken::NAMESPACE | XML_NAMESPACE_CONFIG | XML_config_item) ) + pContext = new XMLConfigItemContext(rImport, Element, xAttrList, rProp.Value, rProp.Name, pBaseContext); + else if( Element == (FastToken::NAMESPACE | XML_NAMESPACE_CONFIG | XML_config_item_set) || + Element == (FastToken::NAMESPACE | XML_NAMESPACE_CONFIG | XML_config_item_map_entry) ) + pContext = new XMLConfigItemSetContext(rImport, xAttrList, rProp.Value, pBaseContext); + else if( Element == (FastToken::NAMESPACE | XML_NAMESPACE_CONFIG | XML_config_item_map_named) ) + pContext = new XMLConfigItemMapNamedContext(rImport, Element, xAttrList, rProp.Value, pBaseContext); + else if( Element == (FastToken::NAMESPACE | XML_NAMESPACE_CONFIG | XML_config_item_map_indexed) ) + pContext = new XMLConfigItemMapIndexedContext(rImport, Element, xAttrList, rProp.Value, rProp.Name, pBaseContext); + + if( !pContext ) + pContext = new SvXMLImportContext( rImport ); + return pContext; +} + namespace { struct SettingsGroup @@ -489,6 +546,14 @@ XMLConfigItemSetContext::XMLConfigItemSetContext(SvXMLImport& rImport, sal_uInt1 // here are no attributes } +XMLConfigItemSetContext::XMLConfigItemSetContext(SvXMLImport& rImport, + const uno::Reference< xml::sax::XFastAttributeList >&, + uno::Any& rAny, XMLConfigBaseContext* pBaseContext) + : XMLConfigBaseContext( rImport, rAny, pBaseContext ) +{ + // here are no attributes +} + XMLConfigItemSetContext::~XMLConfigItemSetContext() { } @@ -501,6 +566,13 @@ SvXMLImportContext *XMLConfigItemSetContext::CreateChildContext( sal_uInt16 nPre return CreateSettingsContext(GetImport(), nPrefix, rLocalName, xAttrList, maProp, this); } +uno::Reference< xml::sax::XFastContextHandler > SAL_CALL XMLConfigItemSetContext::createFastChildContext( + sal_Int32 Element, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) +{ + return CreateSettingsContext(GetImport(), Element, xAttrList, maProp, this); +} + void XMLConfigItemSetContext::EndElement() { mrAny <<= maProps.GetSequence(); @@ -508,6 +580,14 @@ void XMLConfigItemSetContext::EndElement() mpBaseContext->AddPropertyValue(); } +void SAL_CALL XMLConfigItemSetContext::endFastElement( sal_Int32 /*Element*/ ) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) +{ + mrAny <<= maProps.GetSequence(); + if (mpBaseContext) + mpBaseContext->AddPropertyValue(); +} + XMLConfigItemContext::XMLConfigItemContext(SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList>& xAttrList, @@ -770,6 +850,14 @@ XMLConfigItemMapNamedContext::XMLConfigItemMapNamedContext(SvXMLImport& rImport, { } +XMLConfigItemMapNamedContext::XMLConfigItemMapNamedContext(SvXMLImport& rImport, + sal_Int32 /*Element*/, + const uno::Reference< xml::sax::XFastAttributeList >&, + uno::Any& rAny, XMLConfigBaseContext* pBaseContext) + : XMLConfigBaseContext(rImport, rAny, pBaseContext) +{ +} + XMLConfigItemMapNamedContext::~XMLConfigItemMapNamedContext() { } @@ -782,6 +870,13 @@ SvXMLImportContext *XMLConfigItemMapNamedContext::CreateChildContext( sal_uInt16 return CreateSettingsContext(GetImport(), nPrefix, rLocalName, xAttrList, maProp, this); } +uno::Reference< xml::sax::XFastContextHandler > SAL_CALL XMLConfigItemMapNamedContext::createFastChildContext( + sal_Int32 Element, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList ) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) +{ + return CreateSettingsContext(GetImport(), Element, xAttrList, maProp, this); +} + void XMLConfigItemMapNamedContext::EndElement() { if (mpBaseContext) @@ -794,6 +889,19 @@ void XMLConfigItemMapNamedContext::EndElement() } } +void SAL_CALL XMLConfigItemMapNamedContext::endFastElement( sal_Int32 /*Element*/ ) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) +{ + if (mpBaseContext) + { + mrAny <<= maProps.GetNameContainer(); + mpBaseContext->AddPropertyValue(); + } + else { + OSL_FAIL("no BaseContext"); + } +} + XMLConfigItemMapIndexedContext::XMLConfigItemMapIndexedContext(SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, const ::com::sun::star::uno::Reference< @@ -806,6 +914,16 @@ XMLConfigItemMapIndexedContext::XMLConfigItemMapIndexedContext(SvXMLImport& rImp { } +XMLConfigItemMapIndexedContext::XMLConfigItemMapIndexedContext( + SvXMLImport& rImport, sal_Int32 /*Element*/, + const uno::Reference< xml::sax::XFastAttributeList >& , + uno::Any& rAny, const OUString& rConfigItemName, + XMLConfigBaseContext* pBaseContext) + : XMLConfigBaseContext(rImport, rAny, pBaseContext), + maConfigItemName( rConfigItemName ) +{ +} + XMLConfigItemMapIndexedContext::~XMLConfigItemMapIndexedContext() { } @@ -818,8 +936,21 @@ SvXMLImportContext *XMLConfigItemMapIndexedContext::CreateChildContext( sal_uInt return CreateSettingsContext(GetImport(), nPrefix, rLocalName, xAttrList, maProp, this); } +uno::Reference< xml::sax::XFastContextHandler > SAL_CALL XMLConfigItemMapIndexedContext::createFastChildContext( + sal_Int32 Element, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) +{ + return CreateSettingsContext(GetImport(), Element, xAttrList, maProp, this); +} + void XMLConfigItemMapIndexedContext::EndElement() { + endFastElement( 0 ); +} + +void SAL_CALL XMLConfigItemMapIndexedContext::endFastElement( sal_Int32 /*Element*/ ) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) +{ if (mpBaseContext) { if ( maConfigItemName == "ForbiddenCharacters" ) commit b13e5ac10cd49e8d6c7c614473d0af2079348f04 Author: Daniel Sikeler <d.sikele...@gmail.com> Date: Fri Feb 13 13:02:26 2015 +0100 XMLConfigItemContext implements fast interface the method endElement must be changed Change-Id: Ib1cb478017cffe22ed6a232625949bc14ff3581f diff --git a/xmloff/source/core/DocumentSettingsContext.cxx b/xmloff/source/core/DocumentSettingsContext.cxx index 7fabac1..2510924 100644 --- a/xmloff/source/core/DocumentSettingsContext.cxx +++ b/xmloff/source/core/DocumentSettingsContext.cxx @@ -158,6 +158,10 @@ public: com::sun::star::uno::Any& rAny, const OUString& rItemName, XMLConfigBaseContext* pBaseContext); + XMLConfigItemContext(SvXMLImport& rImport, sal_Int32 Element, + const uno::Reference< xml::sax::XFastAttributeList >& xAttrList, + uno::Any& rAny, const OUString& rItemName, XMLConfigBaseContext* pBaseContext); + virtual ~XMLConfigItemContext(); virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, @@ -168,6 +172,14 @@ public: virtual void EndElement() SAL_OVERRIDE; + virtual uno::Reference< xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( + sal_Int32 Element, const uno::Reference< xml::sax::XFastAttributeList>& xAttrList) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL endFastElement( sal_Int32 Element ) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL characters( const OUString& aChars ) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) SAL_OVERRIDE; + virtual void ManipulateConfigItem(); }; @@ -524,6 +536,18 @@ XMLConfigItemContext::XMLConfigItemContext(SvXMLImport& rImport, sal_uInt16 nPrf } } +XMLConfigItemContext::XMLConfigItemContext(SvXMLImport& rImport, sal_Int32 /*Element*/, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList, + css::uno::Any& rTempAny, const OUString& rTempItemName, XMLConfigBaseContext* pTempBaseContext) + : SvXMLImportContext(rImport), + mrAny(rTempAny), + mrItemName(rTempItemName), + mpBaseContext(pTempBaseContext) +{ + if( xAttrList->hasAttribute( FastToken::NAMESPACE | XML_NAMESPACE_CONFIG | XML_type ) ) + msType = xAttrList->getValue( FastToken::NAMESPACE | XML_NAMESPACE_CONFIG | XML_type ); +} + XMLConfigItemContext::~XMLConfigItemContext() { } @@ -537,6 +561,14 @@ SvXMLImportContext *XMLConfigItemContext::CreateChildContext( sal_uInt16 nPrefix return pContext; } +uno::Reference< xml::sax::XFastContextHandler > SAL_CALL XMLConfigItemContext::createFastChildContext( + sal_Int32 /*Element*/, const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) +{ + SvXMLImportContext* pContext = new SvXMLImportContext(GetImport()); + return pContext; +} + void XMLConfigItemContext::Characters( const OUString& rChars ) { if (IsXMLToken(msType, XML_BASE64BINARY)) @@ -556,6 +588,44 @@ void XMLConfigItemContext::Characters( const OUString& rChars ) sChars = sTrimmedChars; } uno::Sequence<sal_Int8> aBuffer((sChars.getLength() / 4) * 3 ); + sal_Int32 const nCharsDecoded = + ::sax::Converter::decodeBase64SomeChars( aBuffer, sChars ); + sal_uInt32 nStartPos(maDecoded.getLength()); + sal_uInt32 nCount(aBuffer.getLength()); + maDecoded.realloc(nStartPos + nCount); + sal_Int8* pDecoded = maDecoded.getArray(); + sal_Int8* pBuffer = aBuffer.getArray(); + for (sal_uInt32 i = 0; i < nCount; i++, pBuffer++) + pDecoded[nStartPos + i] = *pBuffer; + if( nCharsDecoded != sChars.getLength() ) + msValue = sChars.copy( nCharsDecoded ); + } + } + else + msValue += rChars; +} + +void SAL_CALL XMLConfigItemContext::characters( const OUString& rChars ) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) +{ + //TODO: should be done via tokens + if( msType.equals( "base64Binary" ) ) + { + OUString sTrimmedChars( rChars.trim() ); + if( !sTrimmedChars.isEmpty() ) + { + OUString sChars; + if( !msValue.isEmpty() ) + { + sChars = msValue; + sChars += sTrimmedChars; + msValue.clear(); + } + else + { + sChars = sTrimmedChars; + } + uno::Sequence<sal_Int8> aBuffer((sChars.getLength() / 4) * 3 ); sal_Int32 const nCharsDecoded = ::sax::Converter::decodeBase64SomeChars( aBuffer, sChars ); sal_uInt32 nStartPos(maDecoded.getLength()); @@ -575,6 +645,14 @@ void XMLConfigItemContext::Characters( const OUString& rChars ) void XMLConfigItemContext::EndElement() { + //workaround until EndElement can be removed + endFastElement(0); +} + +void SAL_CALL XMLConfigItemContext::endFastElement(sal_Int32 /*Element*/) + throw (uno::RuntimeException, xml::sax::SAXException, std::exception) +{ + //TODO: remove IsXMLToken with equivalent method if (mpBaseContext) { if (IsXMLToken(msType, XML_BOOLEAN)) commit 9d27bac3b4d9706450bda0b9dbccaee20e1240ae Author: Daniel Sikeler <d.sikele...@gmail.com> Date: Fri Feb 13 12:52:24 2015 +0100 XMLConfigBaseContext implements fast interface Change-Id: I8d095eab8fef2e9f9778205d9a1b860ca9bae00c diff --git a/xmloff/source/core/DocumentSettingsContext.cxx b/xmloff/source/core/DocumentSettingsContext.cxx index 5e3fc42..7fabac1 100644 --- a/xmloff/source/core/DocumentSettingsContext.cxx +++ b/xmloff/source/core/DocumentSettingsContext.cxx @@ -27,6 +27,7 @@ #include <xmloff/DocumentSettingsContext.hxx> #include <xmloff/xmlimp.hxx> #include <xmloff/xmltoken.hxx> +#include <xmloff/token/tokens.hxx> #include <xmloff/xmlnmspe.hxx> #include <xmloff/nmspmap.hxx> #include <xmloff/xmluconv.hxx> @@ -43,12 +44,15 @@ #include <com/sun/star/document/PrinterIndependentLayout.hpp> #include <com/sun/star/document/IndexedPropertyValues.hpp> #include <com/sun/star/document/NamedPropertyValues.hpp> +#include <com/sun/star/xml/sax/FastToken.hpp> #include <rtl/ustrbuf.hxx> #include <osl/diagnose.h> #include <xmlenums.hxx> using namespace com::sun::star; +using namespace css::xml::sax; using namespace ::xmloff::token; +using namespace xmloff; class XMLMyList { @@ -131,6 +135,8 @@ public: XMLConfigBaseContext(SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, com::sun::star::uno::Any& rAny, XMLConfigBaseContext* pBaseContext); + XMLConfigBaseContext(SvXMLImport& rImport, uno::Any& rAny, + XMLConfigBaseContext* pBaseContext); virtual ~XMLConfigBaseContext(); void AddPropertyValue() { maProps.push_back(maProp); } @@ -446,6 +452,16 @@ XMLConfigBaseContext::XMLConfigBaseContext(SvXMLImport& rImport, sal_uInt16 nPrf { } +XMLConfigBaseContext::XMLConfigBaseContext(SvXMLImport& rImport, + uno::Any& rTempAny, XMLConfigBaseContext* pTempBaseContext) + : SvXMLImportContext( rImport ), + maProps( rImport.GetComponentContext() ), + maProp(), + mrAny(rTempAny), + mpBaseContext(pTempBaseContext) +{ +} + XMLConfigBaseContext::~XMLConfigBaseContext() { } commit 64671f4ac91aca55cdb600540e6a52836270bf2c Author: Daniel Sikeler <d.sikele...@gmail.com> Date: Fri Feb 13 12:32:00 2015 +0100 XMLTextFrameHyperlinkContext impl fast interface all methods are implemented Change-Id: Iefc12d9fa4e1f48abacc0b2d6447305189a3df1c diff --git a/xmloff/source/text/XMLTextFrameHyperlinkContext.cxx b/xmloff/source/text/XMLTextFrameHyperlinkContext.cxx index 1e76bd3..778b04b 100644 --- a/xmloff/source/text/XMLTextFrameHyperlinkContext.cxx +++ b/xmloff/source/text/XMLTextFrameHyperlinkContext.cxx @@ -23,6 +23,8 @@ #include <xmloff/nmspmap.hxx> #include <xmloff/xmlnmspe.hxx> #include <xmloff/xmltoken.hxx> +#include <xmloff/token/tokens.hxx> +#include <com/sun/star/xml/sax/FastToken.hpp> #include "XMLTextFrameContext.hxx" #include "XMLTextFrameHyperlinkContext.hxx" @@ -33,6 +35,8 @@ using namespace ::com::sun::star::text; using namespace ::com::sun::star::xml::sax; using namespace ::com::sun::star::beans; using namespace ::xmloff::token; +using namespace xmloff; +using css::xml::sax::FastToken::NAMESPACE; namespace drawing = com::sun::star::drawing; @@ -96,6 +100,56 @@ XMLTextFrameHyperlinkContext::XMLTextFrameHyperlinkContext( } } +XMLTextFrameHyperlinkContext::XMLTextFrameHyperlinkContext( + SvXMLImport& rImport, sal_Int32 /*Element*/, + const Reference< XFastAttributeList >& xAttrList, + TextContentAnchorType eATyp ) +: SvXMLImportContext( rImport ), + eDefaultAnchorType( eATyp ), + bMap( false ) +{ + OUString sShow; + const SvXMLTokenMap& rTokenMap = + GetImport().GetTextImport()->GetTextHyperlinkAttrTokenMap(); + + Sequence< css::xml::FastAttribute > attributes = xAttrList->getFastAttributes(); + for( css::xml::FastAttribute attribute : attributes ) + { + switch( rTokenMap.Get( attribute.Token ) ) + { + case XML_TOK_TEXT_HYPERLINK_HREF: + sHRef = GetImport().GetAbsoluteReference( attribute.Value ); + break; + case XML_TOK_TEXT_HYPERLINK_NAME: + sName = attribute.Value; + break; + case XML_TOK_TEXT_HYPERLINK_TARGET_FRAME: + sTargetFrameName = attribute.Value; + break; + case XML_TOK_TEXT_HYPERLINK_SHOW: + sShow = attribute.Value; + break; + case XML_TOK_TEXT_HYPERLINK_SERVER_MAP: + { + bool bTmp(false); + if( ::sax::Converter::convertBool( bTmp, attribute.Value ) ) + { + bMap = bTmp; + } + } + break; + } + } + + if( !sShow.isEmpty() && sTargetFrameName.isEmpty() ) + { + if( sShow.equals( "new" ) ) + sTargetFrameName = "_blank"; + else if( sShow.equals( "replace" ) ) + sTargetFrameName = "_self"; + } +} + XMLTextFrameHyperlinkContext::~XMLTextFrameHyperlinkContext() { } @@ -104,6 +158,11 @@ void XMLTextFrameHyperlinkContext::EndElement() { } +void SAL_CALL XMLTextFrameHyperlinkContext::endFastElement( sal_Int32 /*Element*/ ) + throw(RuntimeException, SAXException, std::exception) +{ +} + SvXMLImportContext *XMLTextFrameHyperlinkContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, @@ -132,6 +191,32 @@ SvXMLImportContext *XMLTextFrameHyperlinkContext::CreateChildContext( return pContext; } +Reference< XFastContextHandler > SAL_CALL + XMLTextFrameHyperlinkContext::createFastChildContext( sal_Int32 Element, + const Reference< XFastAttributeList >& xAttrList ) + throw(RuntimeException, SAXException, std::exception) +{ + SvXMLImportContext *pContext = 0; + XMLTextFrameContext *pTextFrameContext = 0; + + if( Element == (NAMESPACE | XML_NAMESPACE_DRAW | XML_frame) ) + { + pTextFrameContext = new XMLTextFrameContext( GetImport(), Element, + xAttrList, eDefaultAnchorType ); + } + + if( pTextFrameContext ) + { + pTextFrameContext->SetHyperlink( sHRef, sName, sTargetFrameName, bMap ); + pContext = pTextFrameContext; + xFrameContext = pContext; + } + else + pContext = new SvXMLImportContext( GetImport() ); + + return pContext; +} + TextContentAnchorType XMLTextFrameHyperlinkContext::GetAnchorType() const { diff --git a/xmloff/source/text/XMLTextFrameHyperlinkContext.hxx b/xmloff/source/text/XMLTextFrameHyperlinkContext.hxx index 8e3c076..ff58d88 100644 --- a/xmloff/source/text/XMLTextFrameHyperlinkContext.hxx +++ b/xmloff/source/text/XMLTextFrameHyperlinkContext.hxx @@ -48,14 +48,23 @@ public: const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList, ::com::sun::star::text::TextContentAnchorType eDefaultAnchorType ); + XMLTextFrameHyperlinkContext( SvXMLImport& rImport, sal_Int32 Element, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList, + css::text::TextContentAnchorType eDefaultAnchorType ); virtual ~XMLTextFrameHyperlinkContext(); virtual void EndElement() SAL_OVERRIDE; + virtual void SAL_CALL endFastElement( sal_Int32 Element ) + throw(css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList ) SAL_OVERRIDE; + virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL + createFastChildContext( sal_Int32 Element, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) + throw(css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; ::com::sun::star::text::TextContentAnchorType GetAnchorType() const; commit 76434261f0921081ce03101a62edcfe39c2ac6b2 Author: Daniel Sikeler <d.sikele...@gmail.com> Date: Fri Feb 13 12:31:01 2015 +0100 XMLTextFrameContext implements fast inteface only methods declarations, implementations are missing Change-Id: I113d81b19e1fc406b47e80331a5a2bd091348fa3 diff --git a/xmloff/source/text/XMLTextFrameContext.cxx b/xmloff/source/text/XMLTextFrameContext.cxx index 58ed9b3..07082aa 100644 --- a/xmloff/source/text/XMLTextFrameContext.cxx +++ b/xmloff/source/text/XMLTextFrameContext.cxx @@ -56,6 +56,8 @@ #include <basegfx/matrix/b2dhommatrixtools.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <map> +#include <xmloff/token/tokens.hxx> +#include <com/sun/star/xml/sax/FastToken.hpp> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -68,6 +70,8 @@ using namespace ::com::sun::star::drawing; using namespace ::com::sun::star::document; using namespace ::xmloff::token; using ::com::sun::star::document::XEventsSupplier; +using namespace xmloff; +using css::xml::sax::FastToken::NAMESPACE; #define XML_TEXT_FRAME_TEXTBOX 1 #define XML_TEXT_FRAME_GRAPHIC 2 @@ -1380,6 +1384,7 @@ XMLTextFrameContext::XMLTextFrameContext( : SvXMLImportContext( rImport, nPrfx, rLName ) , MultiImageImportHelper() , m_xAttrList( new SvXMLAttributeList( xAttrList ) ) +, m_xFastAttrList( 0 ) , m_pHyperlink( 0 ) // Implement Title/Description Elements UI (#i73249#) , m_sTitle() @@ -1430,6 +1435,25 @@ XMLTextFrameContext::XMLTextFrameContext( } } +XMLTextFrameContext::XMLTextFrameContext( + SvXMLImport& rImport, sal_Int32 /*Element*/, + const Reference< XFastAttributeList >& xAttrList, + TextContentAnchorType eATyp ) +: SvXMLImportContext( rImport ), + MultiImageImportHelper(), + m_xAttrList( 0 ), + m_xFastAttrList( xAttrList ), + m_pHyperlink( 0 ), + // Implement Title/Description Elements UI (#i73249#) + m_sTitle(), + m_sDesc(), + m_eDefaultAnchorType( eATyp ), + // Shapes in Writer cannot be named via context menu (#i51726#) + m_HasAutomaticStyleWithoutParentStyle( false ), + m_bSupportsReplacement( false ) +{ +} + XMLTextFrameContext::~XMLTextFrameContext() { delete m_pHyperlink; @@ -1475,6 +1499,11 @@ void XMLTextFrameContext::EndElement() } } +void SAL_CALL XMLTextFrameContext::endFastElement( sal_Int32 /*Element*/ ) + throw(RuntimeException, SAXException, std::exception) +{ +} + SvXMLImportContext *XMLTextFrameContext::CreateChildContext( sal_uInt16 p_nPrefix, const OUString& rLocalName, @@ -1684,6 +1713,16 @@ SvXMLImportContext *XMLTextFrameContext::CreateChildContext( return pContext; } +Reference< XFastContextHandler > SAL_CALL + XMLTextFrameContext::createFastChildContext( sal_Int32 /*Element*/, + const Reference< XFastAttributeList >& /*xAttrList*/ ) + throw(RuntimeException, SAXException, std::exception) +{ + Reference< XFastContextHandler > pContext = 0; + + return pContext; +} + void XMLTextFrameContext::SetHyperlink( const OUString& rHRef, const OUString& rName, const OUString& rTargetFrameName, diff --git a/xmloff/source/text/XMLTextFrameContext.hxx b/xmloff/source/text/XMLTextFrameContext.hxx index affb9bb..68ec0cc 100644 --- a/xmloff/source/text/XMLTextFrameContext.hxx +++ b/xmloff/source/text/XMLTextFrameContext.hxx @@ -34,6 +34,7 @@ class XMLTextFrameContext : public SvXMLImportContext, public MultiImageImportHe { ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > m_xAttrList; + css::uno::Reference< css::xml::sax::XFastAttributeList > m_xFastAttrList; SvXMLImportContextRef m_xImplContext; SvXMLImportContextRef m_xReplImplContext; @@ -72,14 +73,23 @@ public: const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList, ::com::sun::star::text::TextContentAnchorType eDfltAnchorType ); + XMLTextFrameContext( SvXMLImport& rImport, sal_Int32 Element, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList, + css::text::TextContentAnchorType eDfltAnchorType ); virtual ~XMLTextFrameContext(); virtual void EndElement() SAL_OVERRIDE; + virtual void SAL_CALL endFastElement( sal_Int32 Element ) + throw(css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList ) SAL_OVERRIDE; + virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL + createFastChildContext( sal_Int32 Element, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) + throw(css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; void SetHyperlink( const OUString& rHRef, const OUString& rName, commit 83f7f8d7b52caa671fdd46cc9e328c2cfa888bc8 Author: Daniel Sikeler <d.sikele...@gmail.com> Date: Fri Feb 13 10:34:38 2015 +0100 SvXMLTokenMapEntries in xmloff/source/text/ Change-Id: I9ba59566f9f936f4f35176e801a1c690ad113427 diff --git a/xmloff/source/text/XMLFootnoteImportContext.cxx b/xmloff/source/text/XMLFootnoteImportContext.cxx index 440ff06..de26402 100644 --- a/xmloff/source/text/XMLFootnoteImportContext.cxx +++ b/xmloff/source/text/XMLFootnoteImportContext.cxx @@ -25,6 +25,7 @@ #include <xmloff/nmspmap.hxx> #include <xmloff/xmlnmspe.hxx> #include <xmloff/xmltoken.hxx> +#include <xmloff/token/tokens.hxx> #include "XMLFootnoteBodyImportContext.hxx" #include "XMLTextListBlockContext.hxx" @@ -35,6 +36,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/text/XFootnote.hpp> +#include <com/sun/star/xml/sax/FastToken.hpp> @@ -44,6 +46,8 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::xml::sax; using namespace ::xmloff::token; +using namespace xmloff; +using css::xml::sax::FastToken::NAMESPACE; TYPEINIT1(XMLFootnoteImportContext, SvXMLImportContext); @@ -58,8 +62,10 @@ enum XMLFootnoteChildToken { static const SvXMLTokenMapEntry aFootnoteChildTokenMap[] = { { XML_NAMESPACE_TEXT, XML_NOTE_CITATION, - XML_TOK_FTN_NOTE_CITATION }, - { XML_NAMESPACE_TEXT, XML_NOTE_BODY, XML_TOK_FTN_NOTE_BODY }, + XML_TOK_FTN_NOTE_CITATION, + (NAMESPACE | XML_NAMESPACE_TEXT | XML_note_citation) }, + { XML_NAMESPACE_TEXT, XML_NOTE_BODY, XML_TOK_FTN_NOTE_BODY, + (NAMESPACE | XML_NAMESPACE_TEXT | XML_note_body) }, XML_TOKEN_MAP_END }; diff --git a/xmloff/source/text/XMLSectionImportContext.cxx b/xmloff/source/text/XMLSectionImportContext.cxx index ea8ed95..b3e16aa 100644 --- a/xmloff/source/text/XMLSectionImportContext.cxx +++ b/xmloff/source/text/XMLSectionImportContext.cxx @@ -27,6 +27,7 @@ #include <xmloff/xmlnmspe.hxx> #include <xmloff/xmltoken.hxx> #include <xmloff/prstylei.hxx> +#include <xmloff/token/tokens.hxx> #include <sax/tools/converter.hxx> #include <com/sun/star/container/XNamed.hpp> #include <com/sun/star/uno/Reference.h> @@ -34,6 +35,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/text/ControlCharacter.hpp> +#include <com/sun/star/xml/sax/FastToken.hpp> using ::com::sun::star::beans::XPropertySet; @@ -41,10 +43,12 @@ using ::com::sun::star::uno::Reference; using ::com::sun::star::xml::sax::XAttributeList; using ::com::sun::star::lang::XMultiServiceFactory; using ::com::sun::star::container::XNamed; +using css::xml::sax::FastToken::NAMESPACE; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::text; using namespace ::xmloff::token; +using namespace xmloff; TYPEINIT1( XMLSectionImportContext, SvXMLImportContext ); @@ -71,16 +75,25 @@ enum XMLSectionToken static const SvXMLTokenMapEntry aSectionTokenMap[] = { - { XML_NAMESPACE_XML , XML_ID, XML_TOK_SECTION_XMLID }, - { XML_NAMESPACE_TEXT, XML_STYLE_NAME, XML_TOK_SECTION_STYLE_NAME }, - { XML_NAMESPACE_TEXT, XML_NAME, XML_TOK_SECTION_NAME }, - { XML_NAMESPACE_TEXT, XML_CONDITION, XML_TOK_SECTION_CONDITION }, - { XML_NAMESPACE_TEXT, XML_DISPLAY, XML_TOK_SECTION_DISPLAY }, - { XML_NAMESPACE_TEXT, XML_PROTECTED, XML_TOK_SECTION_PROTECT }, - { XML_NAMESPACE_TEXT, XML_PROTECTION_KEY, XML_TOK_SECTION_PROTECTION_KEY}, - { XML_NAMESPACE_TEXT, XML_IS_HIDDEN, XML_TOK_SECTION_IS_HIDDEN }, + { XML_NAMESPACE_XML , XML_ID, XML_TOK_SECTION_XMLID, + (NAMESPACE | XML_NAMESPACE_XML | XML_id) }, + { XML_NAMESPACE_TEXT, XML_STYLE_NAME, XML_TOK_SECTION_STYLE_NAME, + (NAMESPACE | XML_NAMESPACE_TEXT | XML_style_name) }, + { XML_NAMESPACE_TEXT, XML_NAME, XML_TOK_SECTION_NAME, + (NAMESPACE | XML_NAMESPACE_TEXT | XML_name) }, + { XML_NAMESPACE_TEXT, XML_CONDITION, XML_TOK_SECTION_CONDITION, + (NAMESPACE | XML_NAMESPACE_TEXT | XML_condition) }, + { XML_NAMESPACE_TEXT, XML_DISPLAY, XML_TOK_SECTION_DISPLAY, + (NAMESPACE | XML_NAMESPACE_TEXT | XML_display) }, + { XML_NAMESPACE_TEXT, XML_PROTECTED, XML_TOK_SECTION_PROTECT, + (NAMESPACE | XML_NAMESPACE_TEXT | XML_protected) }, + { XML_NAMESPACE_TEXT, XML_PROTECTION_KEY, XML_TOK_SECTION_PROTECTION_KEY, + (NAMESPACE | XML_NAMESPACE_TEXT | XML_protection_key) }, + { XML_NAMESPACE_TEXT, XML_IS_HIDDEN, XML_TOK_SECTION_IS_HIDDEN, + (NAMESPACE | XML_NAMESPACE_TEXT | XML_is_hidden) }, // compatibility with SRC629 (or earlier) versions - { XML_NAMESPACE_TEXT, XML_PROTECT, XML_TOK_SECTION_PROTECT }, + { XML_NAMESPACE_TEXT, XML_PROTECT, XML_TOK_SECTION_PROTECT, + (NAMESPACE | XML_NAMESPACE_TEXT | XML_protect) }, XML_TOKEN_MAP_END }; diff --git a/xmloff/source/text/XMLSectionSourceDDEImportContext.cxx b/xmloff/source/text/XMLSectionSourceDDEImportContext.cxx index fc8aa97..cc8681d 100644 --- a/xmloff/source/text/XMLSectionSourceDDEImportContext.cxx +++ b/xmloff/source/text/XMLSectionSourceDDEImportContext.cxx @@ -26,20 +26,24 @@ #include <xmloff/nmspmap.hxx> #include <xmloff/xmlnmspe.hxx> #include <xmloff/xmltoken.hxx> +#include <xmloff/token/tokens.hxx> #include <sax/tools/converter.hxx> #include <com/sun/star/uno/Reference.h> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XMultiPropertySet.hpp> #include <tools/debug.hxx> +#include <com/sun/star/xml/sax/FastToken.hpp> using ::com::sun::star::beans::XPropertySet; using ::com::sun::star::beans::XMultiPropertySet; using ::com::sun::star::uno::Reference; using ::com::sun::star::xml::sax::XAttributeList; +using css::xml::sax::FastToken::NAMESPACE; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::text; using namespace ::xmloff::token; +using namespace xmloff; const sal_Char sAPI_DDECommandFile[] = "DDECommandFile"; const sal_Char sAPI_DDECommandType[] = "DDECommandType"; @@ -78,11 +82,15 @@ enum XMLSectionSourceDDEToken static const SvXMLTokenMapEntry aSectionSourceDDETokenMap[] = { { XML_NAMESPACE_OFFICE, XML_DDE_APPLICATION, - XML_TOK_SECTION_DDE_APPLICATION }, - { XML_NAMESPACE_OFFICE, XML_DDE_TOPIC, XML_TOK_SECTION_DDE_TOPIC }, - { XML_NAMESPACE_OFFICE, XML_DDE_ITEM, XML_TOK_SECTION_DDE_ITEM }, + XML_TOK_SECTION_DDE_APPLICATION, + (NAMESPACE | XML_NAMESPACE_OFFICE | XML_dde_application) }, + { XML_NAMESPACE_OFFICE, XML_DDE_TOPIC, XML_TOK_SECTION_DDE_TOPIC, + (NAMESPACE | XML_NAMESPACE_OFFICE | XML_dde_topic) }, + { XML_NAMESPACE_OFFICE, XML_DDE_ITEM, XML_TOK_SECTION_DDE_ITEM, + (NAMESPACE | XML_NAMESPACE_OFFICE | XML_dde_item) }, { XML_NAMESPACE_OFFICE, XML_AUTOMATIC_UPDATE, - XML_TOK_SECTION_IS_AUTOMATIC_UPDATE }, + XML_TOK_SECTION_IS_AUTOMATIC_UPDATE, + (NAMESPACE | XML_NAMESPACE_OFFICE | XML_automatic_update) }, XML_TOKEN_MAP_END }; diff --git a/xmloff/source/text/XMLSectionSourceImportContext.cxx b/xmloff/source/text/XMLSectionSourceImportContext.cxx index 9a3e757..35592aa 100644 --- a/xmloff/source/text/XMLSectionSourceImportContext.cxx +++ b/xmloff/source/text/XMLSectionSourceImportContext.cxx @@ -26,17 +26,21 @@ #include <xmloff/nmspmap.hxx> #include <xmloff/xmlnmspe.hxx> #include <xmloff/xmltoken.hxx> +#include <xmloff/token/tokens.hxx> #include <com/sun/star/uno/Reference.h> #include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/xml/sax/FastToken.hpp> using ::com::sun::star::beans::XPropertySet; using ::com::sun::star::uno::Reference; using ::com::sun::star::xml::sax::XAttributeList; +using css::xml::sax::FastToken::NAMESPACE; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::text; using namespace ::xmloff::token; +using namespace xmloff; TYPEINIT1(XMLSectionSourceImportContext, SvXMLImportContext); @@ -64,10 +68,13 @@ enum XMLSectionSourceToken static const SvXMLTokenMapEntry aSectionSourceTokenMap[] = { - { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_SECTION_XLINK_HREF }, - { XML_NAMESPACE_TEXT, XML_FILTER_NAME, XML_TOK_SECTION_TEXT_FILTER_NAME }, + { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_SECTION_XLINK_HREF, + (NAMESPACE | XML_NAMESPACE_XLINK | XML_href) }, + { XML_NAMESPACE_TEXT, XML_FILTER_NAME, XML_TOK_SECTION_TEXT_FILTER_NAME, + (NAMESPACE | XML_NAMESPACE_TEXT | XML_filter_name) }, { XML_NAMESPACE_TEXT, XML_SECTION_NAME, - XML_TOK_SECTION_TEXT_SECTION_NAME }, + XML_TOK_SECTION_TEXT_SECTION_NAME, + (NAMESPACE | XML_NAMESPACE_TEXT | XML_section_name) }, XML_TOKEN_MAP_END }; ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits