Author: orw Date: Tue Dec 3 14:02:51 2013 New Revision: 1547392 URL: http://svn.apache.org/r1547392 Log: 113059: *.docx import: correct handling of comment/annotation, footnote and endnote IDs for parsing the corresponding sub streams
Kudos to Pavel <pavelja...@apache.org> for his analysis and findings Modified: openoffice/branches/ooxml-osba/main/writerfilter/inc/ooxml/OOXMLDocument.hxx openoffice/branches/ooxml-osba/main/writerfilter/inc/resourcemodel/WW8ResourceModel.hxx openoffice/branches/ooxml-osba/main/writerfilter/source/doctok/WW8ResourceModelImpl.cxx openoffice/branches/ooxml-osba/main/writerfilter/source/doctok/WW8ResourceModelImpl.hxx openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/Handler.cxx openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLFastDocumentHandler.hxx openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLParserState.cxx openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLParserState.hxx openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLPropertySetImpl.hxx openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/model.xml Modified: openoffice/branches/ooxml-osba/main/writerfilter/inc/ooxml/OOXMLDocument.hxx URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/writerfilter/inc/ooxml/OOXMLDocument.hxx?rev=1547392&r1=1547391&r2=1547392&view=diff ============================================================================== --- openoffice/branches/ooxml-osba/main/writerfilter/inc/ooxml/OOXMLDocument.hxx (original) +++ openoffice/branches/ooxml-osba/main/writerfilter/inc/ooxml/OOXMLDocument.hxx Tue Dec 3 14:02:51 2013 @@ -156,11 +156,11 @@ public: @param rStream stream handler to resolve to @param rNoteType type of footnote to resolve - @param rNoteId id of the footnote to resolve + @param nIDForXNoteStream id of the footnote to resolve */ virtual void resolveFootnote(Stream & rStream, const Id & rNoteType, - const rtl::OUString & rNoteId) = 0; + const sal_Int32 nIDForXNoteStream ) = 0; /** Resolves an endnote to a stream handler. @@ -168,21 +168,21 @@ public: note id matches. @param rStream stream handler to resolve to - @param rNoteType type of footnote to resolve - @param rNoteId id of the endnote to resolve + @param rNoteType type of endnote to resolve + @param nIDForXNoteStream id of the endnote to resolve */ virtual void resolveEndnote(Stream & rStream, const Id & rNoteType, - const rtl::OUString & rNoteId) = 0; + const sal_Int32 nIDForXNoteStream ) = 0; /** Resolves a comment to a stream handler. @param rStream stream handler to resolve to - @param rComment id of the comment to resolve + @param nIDForXNoteStream id of the comment to resolve */ virtual void resolveComment(Stream & rStream, - const rtl::OUString & rCommentId) = 0; + const sal_Int32 nIDForXNoteStream ) = 0; /** Resolves a picture to a stream handler. @@ -239,12 +239,11 @@ public: virtual uno::Reference<drawing::XDrawPage> getDrawPage() = 0; virtual uno::Reference<io::XInputStream> getInputStream() = 0; virtual uno::Reference<io::XInputStream> getStorageStream() = 0; - virtual uno::Reference<io::XInputStream> getInputStreamForId - (const ::rtl::OUString & rId) = 0; - virtual void setXNoteId(const rtl::OUString & rId) = 0; - virtual const ::rtl::OUString & getXNoteId() const = 0; - virtual void setXNoteType(const Id & nId) = 0; - virtual const Id & getXNoteType() const = 0; + virtual uno::Reference<io::XInputStream> getInputStreamForId( const ::rtl::OUString & rId ) = 0; + + virtual void setIDForXNoteStream( const sal_Int32 nID ) = 0; + virtual const sal_Int32 getIDForXNoteStream() const = 0; + virtual const ::rtl::OUString & getTarget() const = 0; }; Modified: openoffice/branches/ooxml-osba/main/writerfilter/inc/resourcemodel/WW8ResourceModel.hxx URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/writerfilter/inc/resourcemodel/WW8ResourceModel.hxx?rev=1547392&r1=1547391&r2=1547392&view=diff ============================================================================== --- openoffice/branches/ooxml-osba/main/writerfilter/inc/resourcemodel/WW8ResourceModel.hxx (original) +++ openoffice/branches/ooxml-osba/main/writerfilter/inc/resourcemodel/WW8ResourceModel.hxx Tue Dec 3 14:02:51 2013 @@ -298,7 +298,7 @@ public: /** Returns integer representation of the value. */ - virtual int getInt() const = 0; + virtual sal_Int32 getInt() const = 0; /** Returns string representation of the value. Modified: openoffice/branches/ooxml-osba/main/writerfilter/source/doctok/WW8ResourceModelImpl.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/writerfilter/source/doctok/WW8ResourceModelImpl.cxx?rev=1547392&r1=1547391&r2=1547392&view=diff ============================================================================== --- openoffice/branches/ooxml-osba/main/writerfilter/source/doctok/WW8ResourceModelImpl.cxx (original) +++ openoffice/branches/ooxml-osba/main/writerfilter/source/doctok/WW8ResourceModelImpl.cxx Tue Dec 3 14:02:51 2013 @@ -316,7 +316,7 @@ string WW8Sprm::getName() const return (*SprmIdToString::Instance())(getId()); } -int WW8Value::getInt() const +sal_Int32 WW8Value::getInt() const { return 0; } @@ -351,7 +351,7 @@ writerfilter::Reference<BinaryObj>::Poin return writerfilter::Reference<BinaryObj>::Pointer_t(); } -int WW8IntValue::getInt() const +sal_Int32 WW8IntValue::getInt() const { return mValue; } @@ -389,7 +389,7 @@ WW8Value::Pointer_t createValue(WW8Value return value; } -int WW8StringValue::getInt() const +sal_Int32 WW8StringValue::getInt() const { return 0; } Modified: openoffice/branches/ooxml-osba/main/writerfilter/source/doctok/WW8ResourceModelImpl.hxx URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/writerfilter/source/doctok/WW8ResourceModelImpl.hxx?rev=1547392&r1=1547391&r2=1547392&view=diff ============================================================================== --- openoffice/branches/ooxml-osba/main/writerfilter/source/doctok/WW8ResourceModelImpl.hxx (original) +++ openoffice/branches/ooxml-osba/main/writerfilter/source/doctok/WW8ResourceModelImpl.hxx Tue Dec 3 14:02:51 2013 @@ -158,7 +158,7 @@ public: virtual ~WW8Value() {} virtual string toString() const; - virtual int getInt() const; + virtual sal_Int32 getInt() const; virtual ::rtl::OUString getString() const; virtual uno::Any getAny() const; virtual writerfilter::Reference<Properties>::Pointer_t getProperties(); @@ -174,7 +174,7 @@ public: WW8IntValue(int value) : mValue(value) {} virtual ~WW8IntValue() {} - virtual int getInt() const; + virtual sal_Int32 getInt() const; virtual ::rtl::OUString getString() const; virtual uno::Any getAny() const; @@ -200,7 +200,7 @@ public: WW8StringValue(::rtl::OUString string_) : mString(string_) {} virtual ~WW8StringValue() {} - virtual int getInt() const; + virtual sal_Int32 getInt() const; virtual ::rtl::OUString getString() const; virtual uno::Any getAny() const; Modified: openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/Handler.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/Handler.cxx?rev=1547392&r1=1547391&r2=1547392&view=diff ============================================================================== --- openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/Handler.cxx (original) +++ openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/Handler.cxx Tue Dec 3 14:02:51 2013 @@ -46,7 +46,7 @@ void OOXMLFootnoteHandler::attribute(Id switch (name) { case NS_ooxml::LN_CT_FtnEdnRef_id: - mpFastContext->resolveFootnote(val.getString()); + mpFastContext->resolveFootnote(val.getInt()); break; default: break; @@ -74,7 +74,7 @@ void OOXMLEndnoteHandler::attribute(Id n switch (name) { case NS_ooxml::LN_CT_FtnEdnRef_id: - mpFastContext->resolveEndnote(val.getString()); + mpFastContext->resolveEndnote(val.getInt()); break; default: break; @@ -102,7 +102,7 @@ void OOXMLCommentHandler::attribute(Id n switch (name) { case NS_ooxml::LN_CT_Markup_id: - mpFastContext->resolveComment(val.getString()); + mpFastContext->resolveComment(val.getInt()); break; default: ; Modified: openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx?rev=1547392&r1=1547391&r2=1547392&view=diff ============================================================================== --- openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx (original) +++ openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx Tue Dec 3 14:02:51 2013 @@ -45,9 +45,37 @@ TagLogger::Pointer_t debug_logger(TagLog using namespace ::std; -OOXMLDocumentImpl::OOXMLDocumentImpl -(OOXMLStream::Pointer_t pStream) -: mpStream(pStream), mXNoteType(0), mbIsSubstream( false ) +OOXMLDocumentImpl::OOXMLDocumentImpl( + OOXMLStream::Pointer_t pStream ) + : mpStream(pStream) + , mnIDForXNoteStream( -1 ) + , mxModel() + , mxDrawPage() + , mbIsSubstream( false ) +{ +} + +OOXMLDocumentImpl::OOXMLDocumentImpl( + OOXMLStream::Pointer_t pStream, + uno::Reference<frame::XModel> xModel, + uno::Reference<drawing::XDrawPage> xDrawPage, + const bool bIsSubstream ) + : mpStream(pStream) + , mnIDForXNoteStream( -1 ) + , mxModel( xModel ) + , mxDrawPage( xDrawPage ) + , mbIsSubstream( bIsSubstream ) +{ +} + +OOXMLDocumentImpl::OOXMLDocumentImpl( + OOXMLStream::Pointer_t pStream, + const sal_Int32 nIDForXNoteStream ) + : mpStream(pStream) + , mnIDForXNoteStream( nIDForXNoteStream ) + , mxModel() + , mxDrawPage() + , mbIsSubstream( false ) { } @@ -68,8 +96,7 @@ void OOXMLDocumentImpl::resolveFastSubSt { uno::Reference<uno::XComponentContext> xContext(mpStream->getContext()); OOXMLFastDocumentHandler * pDocHandler = - new OOXMLFastDocumentHandler( - xContext, &rStreamHandler, this, msXNoteId ); + new OOXMLFastDocumentHandler( xContext, &rStreamHandler, this ); uno::Reference < xml::sax::XFastDocumentHandler > xDocumentHandler (pDocHandler); @@ -100,25 +127,16 @@ void OOXMLDocumentImpl::resolveFastSubSt rStream.substream(nId, pStream); } -void OOXMLDocumentImpl::setXNoteId(const rtl::OUString & rId) -{ - msXNoteId = rId; -} - -const rtl::OUString & OOXMLDocumentImpl::getXNoteId() const +void OOXMLDocumentImpl::setIDForXNoteStream( const sal_Int32 nID ) { - return msXNoteId; + mnIDForXNoteStream = nID; } -void OOXMLDocumentImpl::setXNoteType(const Id & nId) +const sal_Int32 OOXMLDocumentImpl::getIDForXNoteStream() const { - mXNoteType = nId; + return mnIDForXNoteStream; } -const Id & OOXMLDocumentImpl::getXNoteType() const -{ - return mXNoteType; -} const ::rtl::OUString & OOXMLDocumentImpl::getTarget() const { @@ -131,17 +149,19 @@ OOXMLDocumentImpl::getSubStream(const rt OOXMLStream::Pointer_t pStream (OOXMLDocumentFactory::createStream(mpStream, rId)); - OOXMLDocumentImpl * pTemp; - writerfilter::Reference<Stream>::Pointer_t pRet( pTemp = new OOXMLDocumentImpl(pStream) ); - pTemp->setModel(mxModel); - pTemp->setDrawPage(mxDrawPage); - pTemp->setIsSubstream( true ); + writerfilter::Reference<Stream>::Pointer_t pRet( + new OOXMLDocumentImpl( + pStream, + mxModel, + mxDrawPage, + true ) ); + return pRet; } -writerfilter::Reference<Stream>::Pointer_t -OOXMLDocumentImpl::getXNoteStream(OOXMLStream::StreamType_t nType, const Id & rType, - const rtl::OUString & rId) +writerfilter::Reference<Stream>::Pointer_t OOXMLDocumentImpl::getXNoteStream( + OOXMLStream::StreamType_t nType, + const sal_Int32 nIDForXNoteStream ) { #ifdef DEBUG_ELEMENT debug_logger->startElement("getXNoteStream"); @@ -151,19 +171,21 @@ OOXMLDocumentImpl::getXNoteStream(OOXMLS OOXMLStream::Pointer_t pStream = (OOXMLDocumentFactory::createStream(mpStream, nType)); - OOXMLDocumentImpl * pDocument = new OOXMLDocumentImpl(pStream); - pDocument->setXNoteId(rId); - pDocument->setXNoteType(rType); + OOXMLDocumentImpl * pDocument = + new OOXMLDocumentImpl( + pStream, + nIDForXNoteStream ); return writerfilter::Reference<Stream>::Pointer_t(pDocument); } -void OOXMLDocumentImpl::resolveFootnote(Stream & rStream, - const Id & rType, - const rtl::OUString & rNoteId) +void OOXMLDocumentImpl::resolveFootnote( + Stream & rStream, + const Id & rType, + const sal_Int32 nIDForXNoteStream ) { writerfilter::Reference<Stream>::Pointer_t pStream = - getXNoteStream(OOXMLStream::FOOTNOTES, rType, rNoteId); + getXNoteStream( OOXMLStream::FOOTNOTES, nIDForXNoteStream ); Id nId; switch (rType) @@ -177,15 +199,16 @@ void OOXMLDocumentImpl::resolveFootnote( break; } - resolveFastSubStreamWithId(rStream, pStream, nId); + resolveFastSubStreamWithId( rStream, pStream, nId ); } -void OOXMLDocumentImpl::resolveEndnote(Stream & rStream, - const Id & rType, - const rtl::OUString & rNoteId) +void OOXMLDocumentImpl::resolveEndnote( + Stream & rStream, + const Id & rType, + const sal_Int32 nIDForXNoteStream ) { writerfilter::Reference<Stream>::Pointer_t pStream = - getXNoteStream(OOXMLStream::ENDNOTES, rType, rNoteId); + getXNoteStream( OOXMLStream::ENDNOTES, nIDForXNoteStream ); Id nId; switch (rType) @@ -199,16 +222,17 @@ void OOXMLDocumentImpl::resolveEndnote(S break; } - resolveFastSubStreamWithId(rStream, pStream, nId); + resolveFastSubStreamWithId( rStream, pStream, nId ); } -void OOXMLDocumentImpl::resolveComment(Stream & rStream, - const rtl::OUString & rId) +void OOXMLDocumentImpl::resolveComment( + Stream & rStream, + const sal_Int32 nIDForXNoteStream ) { writerfilter::Reference<Stream>::Pointer_t pStream = - getXNoteStream(OOXMLStream::COMMENTS, 0, rId); + getXNoteStream(OOXMLStream::COMMENTS, nIDForXNoteStream ); - resolveFastSubStreamWithId(rStream, pStream, NS_rtf::LN_annotation); + resolveFastSubStreamWithId( rStream, pStream, NS_rtf::LN_annotation ); } OOXMLPropertySet * OOXMLDocumentImpl::getPicturePropSet @@ -315,8 +339,7 @@ void OOXMLDocumentImpl::resolve(Stream & uno::Reference<uno::XComponentContext> xContext(mpStream->getContext()); OOXMLFastDocumentHandler * pDocHandler = - new OOXMLFastDocumentHandler( - xContext, &rStream, this, msXNoteId ); + new OOXMLFastDocumentHandler( xContext, &rStream, this ); pDocHandler->setIsSubstream( mbIsSubstream ); uno::Reference < xml::sax::XFastDocumentHandler > xDocumentHandler (pDocHandler); @@ -392,9 +415,8 @@ uno::Reference<io::XInputStream> OOXMLDo return mpStream->getStorageStream(); } -OOXMLDocument * -OOXMLDocumentFactory::createDocument -(OOXMLStream::Pointer_t pStream) +OOXMLDocument * OOXMLDocumentFactory::createDocument( + OOXMLStream::Pointer_t pStream ) { return new OOXMLDocumentImpl(pStream); } Modified: openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx?rev=1547392&r1=1547391&r2=1547392&view=diff ============================================================================== --- openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx (original) +++ openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx Tue Dec 3 14:02:51 2013 @@ -40,46 +40,64 @@ using namespace ::com::sun::star; class OOXMLDocumentImpl : public OOXMLDocument { OOXMLStream::Pointer_t mpStream; - rtl::OUString msXNoteId; - Id mXNoteType; + // ID for parsing certain item in a XNote stream + // used for footnotes, endnotes and comments streams + sal_Int32 mnIDForXNoteStream; uno::Reference<frame::XModel> mxModel; uno::Reference<drawing::XDrawPage> mxDrawPage; - bool mbIsSubstream; + const bool mbIsSubstream; protected: - virtual void resolveFastSubStream(Stream & rStream, - OOXMLStream::StreamType_t nType); + virtual void resolveFastSubStream( + Stream & rStream, + OOXMLStream::StreamType_t nType); + + virtual void resolveFastSubStreamWithId( + Stream & rStream, + writerfilter::Reference<Stream>::Pointer_t pStream, + sal_uInt32 nId); + + writerfilter::Reference<Stream>::Pointer_t getSubStream( + const rtl::OUString & rId ); + + writerfilter::Reference<Stream>::Pointer_t getXNoteStream( + OOXMLStream::StreamType_t nType, + const sal_Int32 nIDForXNoteStream ); - virtual void resolveFastSubStreamWithId(Stream & rStream, - writerfilter::Reference<Stream>::Pointer_t pStream, - sal_uInt32 nId); - - writerfilter::Reference<Stream>::Pointer_t - getSubStream(const rtl::OUString & rId); - - writerfilter::Reference<Stream>::Pointer_t - getXNoteStream(OOXMLStream::StreamType_t nType, - const Id & rType, - const rtl::OUString & rNoteId); +public: + explicit OOXMLDocumentImpl( + OOXMLStream::Pointer_t pStream ); - void setIsSubstream( bool bSubstream ) { mbIsSubstream = bSubstream; }; + OOXMLDocumentImpl( + OOXMLStream::Pointer_t pStream, + uno::Reference<frame::XModel> xModel, + uno::Reference<drawing::XDrawPage> xDrawPage, + const bool bIsSubstream ); + + OOXMLDocumentImpl( + OOXMLStream::Pointer_t pStream, + const sal_Int32 nIDForXNoteStream ); -public: - OOXMLDocumentImpl(OOXMLStream::Pointer_t pStream); virtual ~OOXMLDocumentImpl(); virtual void resolve(Stream & rStream); virtual string getType() const; - virtual void resolveFootnote(Stream & rStream, - const Id & rType, - const rtl::OUString & rNoteId); - virtual void resolveEndnote(Stream & rStream, - const Id & rType, - const rtl::OUString & rNoteId); + virtual void resolveFootnote( + Stream & rStream, + const Id & rType, + const sal_Int32 nIDForXNoteStream ); + virtual void resolveEndnote( + Stream & rStream, + const Id & rType, + const sal_Int32 nIDForXNoteStream ); + virtual void resolveComment( + Stream & rStream, + const sal_Int32 nIDForXNoteStream ); + virtual void resolveHeader(Stream & rStream, const sal_Int32 type, const rtl::OUString & rId); @@ -87,8 +105,6 @@ public: const sal_Int32 type, const rtl::OUString & rId); - virtual void resolveComment(Stream & rStream, const rtl::OUString & rId); - virtual OOXMLPropertySet * getPicturePropSet (const ::rtl::OUString & rId); virtual void resolvePicture(Stream & rStream, const rtl::OUString & rId); @@ -102,10 +118,10 @@ public: virtual uno::Reference<io::XInputStream> getInputStream(); virtual uno::Reference<io::XInputStream> getStorageStream(); virtual uno::Reference<io::XInputStream> getInputStreamForId(const rtl::OUString & rId); - virtual void setXNoteId(const rtl::OUString & rId); - virtual const ::rtl::OUString & getXNoteId() const; - virtual void setXNoteType(const Id & rId); - virtual const Id & getXNoteType() const; + + virtual void setIDForXNoteStream( const sal_Int32 nID ); + virtual const sal_Int32 getIDForXNoteStream() const; + virtual const ::rtl::OUString & getTarget() const; }; }} Modified: openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx?rev=1547392&r1=1547391&r2=1547392&view=diff ============================================================================== --- openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx (original) +++ openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx Tue Dec 3 14:02:51 2013 @@ -1032,37 +1032,31 @@ bool OOXMLFastContextHandler::isForwardE return mpParserState->isForwardEvents(); } -void OOXMLFastContextHandler::setXNoteId(const ::rtl::OUString & rId) -{ - mpParserState->setXNoteId(rId); -} -void OOXMLFastContextHandler::setXNoteId(OOXMLValue::Pointer_t pValue) +void OOXMLFastContextHandler::setIDForXNoteStream(OOXMLValue::Pointer_t pValue) { - mpParserState->setXNoteId(pValue->getString()); + mpParserState->getDocument()->setIDForXNoteStream(pValue->getInt()); } -const rtl::OUString & OOXMLFastContextHandler::getXNoteId() const -{ - return mpParserState->getXNoteId(); -} -void OOXMLFastContextHandler::resolveFootnote -(const rtl::OUString & rId) +void OOXMLFastContextHandler::resolveFootnote( + const sal_Int32 nIDForXNoteStream ) { mpParserState->getDocument()->resolveFootnote - (*mpStream, 0, rId); + (*mpStream, 0, nIDForXNoteStream); } -void OOXMLFastContextHandler::resolveEndnote(const rtl::OUString & rId) +void OOXMLFastContextHandler::resolveEndnote( + const sal_Int32 nIDForXNoteStream ) { mpParserState->getDocument()->resolveEndnote - (*mpStream, 0, rId); + (*mpStream, 0, nIDForXNoteStream); } -void OOXMLFastContextHandler::resolveComment(const rtl::OUString & rId) +void OOXMLFastContextHandler::resolveComment( + const sal_Int32 nIDForXNoteStream ) { - mpParserState->getDocument()->resolveComment(*mpStream, rId); + mpParserState->getDocument()->resolveComment(*mpStream, nIDForXNoteStream); } void OOXMLFastContextHandler::resolvePicture(const rtl::OUString & rId) @@ -1624,7 +1618,7 @@ OOXMLFastContextHandlerXNote::OOXMLFastC ( OOXMLFastContextHandler * pContext ) : OOXMLFastContextHandlerProperties( pContext ) , mbForwardEventsSaved( false ) - , msMyXNoteId() + , mnMyXNoteId( -1 ) { } @@ -1639,7 +1633,7 @@ void OOXMLFastContextHandlerXNote::lcl_s { mbForwardEventsSaved = isForwardEvents(); - if (msMyXNoteId.compareTo(getXNoteId()) == 0) + if ( mnMyXNoteId == mpParserState->getDocument()->getIDForXNoteStream() ) setForwardEvents(true); else setForwardEvents(false); @@ -1661,12 +1655,12 @@ void OOXMLFastContextHandlerXNote::check { #ifdef DEBUG_ELEMENT debug_logger->startElement("checkId"); - debug_logger->attribute("myId", pValue->getString()); - debug_logger->attribute("id", getXNoteId()); + debug_logger->attribute("myId", pValue->getInt()); + debug_logger->attribute("id", mpParserState->getDocument()->getXNoteId()); debug_logger->endElement("checkId"); #endif - msMyXNoteId = pValue->getString(); + mnMyXNoteId = pValue->getInt(); } /* Modified: openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx?rev=1547392&r1=1547391&r2=1547392&view=diff ============================================================================== --- openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx (original) +++ openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx Tue Dec 3 14:02:51 2013 @@ -59,11 +59,12 @@ public: enum ResourceEnum_t { UNKNOWN, STREAM, PROPERTIES, TABLE, SHAPE }; OOXMLFastContextHandler(); - explicit OOXMLFastContextHandler - (uno::Reference< uno::XComponentContext > const & context); - explicit OOXMLFastContextHandler - (OOXMLFastContextHandler * pContext); + explicit OOXMLFastContextHandler( + uno::Reference< uno::XComponentContext > const & context ); + + explicit OOXMLFastContextHandler( + OOXMLFastContextHandler * pContext ); virtual ~OOXMLFastContextHandler(); @@ -141,9 +142,10 @@ public: void mark(const Id & rId, OOXMLValue::Pointer_t pVal); - void resolveFootnote(const rtl::OUString & rId); - void resolveEndnote(const rtl::OUString & rId); - void resolveComment(const rtl::OUString & rId); + void resolveFootnote( const sal_Int32 nIDForXNoteStream ); + void resolveEndnote( const sal_Int32 nIDForXNoteStream ); + void resolveComment( const sal_Int32 nIDForXNoteStream ); + void resolvePicture(const rtl::OUString & rId); void resolveHeader(const sal_Int32 type, const rtl::OUString & rId); @@ -160,9 +162,9 @@ public: void setDocument(OOXMLDocument * pDocument); OOXMLDocument * getDocument(); - void setXNoteId(OOXMLValue::Pointer_t pValue); - void setXNoteId(const ::rtl::OUString & rId); - const rtl::OUString & getXNoteId() const; + + void setIDForXNoteStream(OOXMLValue::Pointer_t pValue); + void setForwardEvents(bool bForwardEvents); bool isForwardEvents() const; virtual void setParent(OOXMLFastContextHandler * pParent); @@ -430,7 +432,7 @@ public: private: bool mbForwardEventsSaved; - ::rtl::OUString msMyXNoteId; + sal_Int32 mnMyXNoteId; virtual void lcl_startFastElement (Token_t Element, Modified: openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx?rev=1547392&r1=1547391&r2=1547392&view=diff ============================================================================== --- openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx (original) +++ openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx Tue Dec 3 14:02:51 2013 @@ -42,15 +42,13 @@ using namespace ::std; OOXMLFastDocumentHandler::OOXMLFastDocumentHandler( uno::Reference< uno::XComponentContext > const & context, Stream* pStream, - OOXMLDocument* pDocument, - const ::rtl::OUString& rXNoteId ) + OOXMLDocument* pDocument ) : m_xContext(context) , mpStream( pStream ) #ifdef DEBUG_ELEMENT , mpTmpStream() #endif , mpDocument( pDocument ) - , msXNoteId( rXNoteId ) , mpContextHandler() { #ifdef DEBUG_PROTOCOL @@ -140,11 +138,10 @@ OOXMLFastDocumentHandler::getContextHand { if (mpContextHandler == OOXMLFastContextHandler::Pointer_t()) { - mpContextHandler.reset - (new OOXMLFastContextHandler(m_xContext)); + mpContextHandler.reset( + new OOXMLFastContextHandler(m_xContext) ); mpContextHandler->setStream(mpStream); mpContextHandler->setDocument(mpDocument); - mpContextHandler->setXNoteId(msXNoteId); mpContextHandler->setForwardEvents(true); } @@ -196,7 +193,7 @@ Name #endif return uno::Reference< xml::sax::XFastContextHandler > - ( new OOXMLFastDocumentHandler( m_xContext, 0, 0, ::rtl::OUString() ) ); + ( new OOXMLFastDocumentHandler( m_xContext, 0, 0 ) ); } void SAL_CALL OOXMLFastDocumentHandler::characters(const ::rtl::OUString & /*aChars*/) Modified: openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLFastDocumentHandler.hxx URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLFastDocumentHandler.hxx?rev=1547392&r1=1547391&r2=1547392&view=diff ============================================================================== --- openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLFastDocumentHandler.hxx (original) +++ openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLFastDocumentHandler.hxx Tue Dec 3 14:02:51 2013 @@ -47,8 +47,8 @@ public: OOXMLFastDocumentHandler( uno::Reference< uno::XComponentContext > const & context, Stream* pStream, - OOXMLDocument* pDocument, - const ::rtl::OUString& rXNoteId ); + OOXMLDocument* pDocument ); + virtual ~OOXMLFastDocumentHandler() {} // ::com::sun::star::xml::sax::XFastDocumentHandler: @@ -103,7 +103,6 @@ private: Stream::Pointer_t mpTmpStream; #endif OOXMLDocument * mpDocument; - ::rtl::OUString msXNoteId; mutable boost::shared_ptr<OOXMLFastContextHandler> mpContextHandler; boost::shared_ptr<OOXMLFastContextHandler> getContextHandler() const; }; Modified: openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLParserState.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLParserState.cxx?rev=1547392&r1=1547391&r2=1547392&view=diff ============================================================================== --- openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLParserState.cxx (original) +++ openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLParserState.cxx Tue Dec 3 14:02:51 2013 @@ -123,15 +123,6 @@ OOXMLDocument * OOXMLParserState::getDoc return mpDocument; } -void OOXMLParserState::setXNoteId(const rtl::OUString & rId) -{ - mpDocument->setXNoteId(rId); -} - -const rtl::OUString & OOXMLParserState::getXNoteId() const -{ - return mpDocument->getXNoteId(); -} const ::rtl::OUString & OOXMLParserState::getTarget() const { @@ -308,9 +299,7 @@ XMLTag::Pointer_t OOXMLParserState::toTa sTmp += "-"; pTag->addAttr("state", sTmp); - pTag->addAttr("XNoteId", - OUStringToOString(getXNoteId(), - RTL_TEXTENCODING_ASCII_US).getStr()); + pTag->addAttr("XNoteId", getDocument()->getIDForXNoteStream() ); if (mpCharacterProps != OOXMLPropertySet::Pointer_t()) pTag->chars(mpCharacterProps->toString()); Modified: openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLParserState.hxx URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLParserState.hxx?rev=1547392&r1=1547391&r2=1547392&view=diff ============================================================================== --- openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLParserState.hxx (original) +++ openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLParserState.hxx Tue Dec 3 14:02:51 2013 @@ -48,7 +48,6 @@ class OOXMLParserState unsigned int mnContexts; unsigned int mnHandle; OOXMLDocument * mpDocument; - rtl::OUString msXNoteId; rtl::OUString msTarget; OOXMLPropertySet::Pointer_t mpCharacterProps; stack<OOXMLPropertySet::Pointer_t> mCellProps; @@ -85,9 +84,6 @@ public: void setDocument(OOXMLDocument * pDocument); OOXMLDocument * getDocument() const; - void setXNoteId(const rtl::OUString & rId); - const rtl::OUString & getXNoteId() const; - const rtl::OUString & getTarget() const; void resolveCharacterProperties(Stream & rStream); Modified: openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx?rev=1547392&r1=1547391&r2=1547392&view=diff ============================================================================== --- openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx (original) +++ openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx Tue Dec 3 14:02:51 2013 @@ -201,7 +201,7 @@ bool OOXMLValue::getBool() const return false; } -int OOXMLValue::getInt() const +sal_Int32 OOXMLValue::getInt() const { return 0; } @@ -301,7 +301,7 @@ bool OOXMLBooleanValue::getBool() const return mbValue; } -int OOXMLBooleanValue::getInt() const +sal_Int32 OOXMLBooleanValue::getInt() const { return mbValue ? 1 : 0; } @@ -594,7 +594,7 @@ OOXMLIntegerValue::~OOXMLIntegerValue() { } -int OOXMLIntegerValue::getInt() const +sal_Int32 OOXMLIntegerValue::getInt() const { return mnValue; } @@ -637,7 +637,7 @@ OOXMLHexValue::~OOXMLHexValue() { } -int OOXMLHexValue::getInt() const +sal_Int32 OOXMLHexValue::getInt() const { return mnValue; } Modified: openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLPropertySetImpl.hxx URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLPropertySetImpl.hxx?rev=1547392&r1=1547391&r2=1547392&view=diff ============================================================================== --- openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLPropertySetImpl.hxx (original) +++ openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/OOXMLPropertySetImpl.hxx Tue Dec 3 14:02:51 2013 @@ -47,7 +47,7 @@ public: OOXMLValue(); virtual ~OOXMLValue(); - virtual int getInt() const; + virtual sal_Int32 getInt() const; virtual bool getBool() const; virtual ::rtl::OUString getString() const; virtual uno::Any getAny() const; @@ -108,7 +108,7 @@ public: explicit OOXMLBooleanValue(const rtl::OUString & rValue); virtual ~OOXMLBooleanValue(); - virtual int getInt() const; + virtual sal_Int32 getInt() const; virtual bool getBool() const; virtual uno::Any getAny() const; virtual string toString() const; @@ -197,7 +197,7 @@ public: explicit OOXMLIntegerValue(const rtl::OUString & rValue); virtual ~OOXMLIntegerValue(); - virtual int getInt() const; + virtual sal_Int32 getInt() const; virtual uno::Any getAny() const; virtual string toString() const; virtual OOXMLValue * clone() const; @@ -212,7 +212,7 @@ public: explicit OOXMLHexValue(const rtl::OUString & rValue); virtual ~OOXMLHexValue(); - virtual int getInt() const; + virtual sal_Int32 getInt() const; virtual string toString() const; virtual OOXMLValue * clone() const; }; Modified: openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/model.xml URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/model.xml?rev=1547392&r1=1547391&r2=1547392&view=diff ============================================================================== --- openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/model.xml (original) +++ openoffice/branches/ooxml-osba/main/writerfilter/source/ooxml/model.xml Tue Dec 3 14:02:51 2013 @@ -14439,10 +14439,6 @@ </optional> </define> <define name="CT_MarkupRangeBookmark"> - <attribute name="id"> - <text/> - <xs:documentation>Annotation Identifier</xs:documentation> - </attribute> <ref name="CT_MarkupRange"/> </define> <define name="CT_MarkupRangeCommentStart"> @@ -14485,10 +14481,6 @@ </attribute> </define> <define name="CT_Comment"> - <attribute name="id"> - <ref name="ST_DecimalNumber"/> - <xs:documentation>Annotation Identifier</xs:documentation> - </attribute> <ref name="CT_TrackChange"/> <zeroOrMore> <ref name="EG_BlockLevelElts"/> @@ -18159,13 +18151,13 @@ </attribute> </optional> <attribute name="id"> - <text/> + <ref name="ST_DecimalNumber"/> <xs:documentation>Footnote/Endnote ID Reference</xs:documentation> </attribute> </define> <define name="CT_FtnEdnSepRef"> <attribute name="id"> - <text/> + <ref name="ST_DecimalNumber"/> <xs:documentation>Footnote/Endnote ID</xs:documentation> </attribute> </define> @@ -18180,7 +18172,7 @@ </attribute> </optional> <attribute name="id"> - <text/> + <ref name="ST_DecimalNumber"/> <xs:documentation>Footnote/Endnote ID</xs:documentation> </attribute> </define> @@ -22859,7 +22851,7 @@ </resource> <resource name="CT_FtnEdnRef" resource="Properties" tag="reference"> <attribute name="customMarkFollows" tokenid="ooxml:CT_FtnEdnRef_customMarkFollows"/> - <attribute name="id" tokenid="ooxml:CT_FtnEdnRef_id" action="setXNoteId"/> + <attribute name="id" tokenid="ooxml:CT_FtnEdnRef_id" action="setIDForXNoteStream"/> <action name="end" action="handleXNotes"/> </resource> <resource name="CT_FtnEdnSepRef" resource="Properties" tag="reference">