filter/source/svg/svgreader.cxx | 6 +++- sal/inc/sal/log-areas.dox | 1 sax/source/expatwrap/sax_expat.cxx | 48 +++++++++++++++++++++++++---------- sax/source/fastparser/fastparser.cxx | 15 +++++----- svgio/source/svguno/xsvgparser.cxx | 9 ++++++ svx/inc/svx/svdundo.hxx | 9 ------ svx/source/svdraw/svdundo.cxx | 20 -------------- 7 files changed, 58 insertions(+), 50 deletions(-)
New commits: commit fcb1e4d8433b49686cd8e53c699dd5d6503ea314 Author: Michael Stahl <mst...@redhat.com> Date: Wed Feb 13 15:59:38 2013 +0100 fdo#60471: svgio, sax: enable internal entity declarations for SVG Change-Id: I147acac61dfe0b626268fe1e600dcf641ca63a0c diff --git a/sax/source/expatwrap/sax_expat.cxx b/sax/source/expatwrap/sax_expat.cxx index 7d4d792..b9ce821 100644 --- a/sax/source/expatwrap/sax_expat.cxx +++ b/sax/source/expatwrap/sax_expat.cxx @@ -24,7 +24,7 @@ #include <osl/diagnose.h> #include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/util/XCloneable.hpp> +#include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp> #include <com/sun/star/xml/sax/XParser.hpp> #include <com/sun/star/xml/sax/SAXParseException.hpp> @@ -32,8 +32,7 @@ #include <cppuhelper/factory.hxx> #include <cppuhelper/weak.hxx> -#include <cppuhelper/implbase1.hxx> -#include <cppuhelper/implbase2.hxx> +#include <cppuhelper/implbase3.hxx> #include <expat.h> @@ -45,7 +44,6 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::registry; using namespace ::com::sun::star::xml::sax; -using namespace ::com::sun::star::util; using namespace ::com::sun::star::io; #include "factory.hxx" @@ -136,11 +134,10 @@ class SaxExpatParser_Impl; // This class implements the external Parser interface -class SaxExpatParser : - public WeakImplHelper2< - XParser, - XServiceInfo - > +class SaxExpatParser + : public WeakImplHelper3< XInitialization + , XServiceInfo + , XParser > { public: @@ -153,6 +150,10 @@ public: static Sequence< OUString > getSupportedServiceNames_Static(void) throw (); public: + // ::com::sun::star::lang::XInitialization: + virtual void SAL_CALL initialize(Sequence<Any> const& rArguments) + throw (RuntimeException, Exception); + // The SAX-Parser-Interface virtual void SAL_CALL parseStream( const InputSource& structSource) throw ( SAXException, @@ -222,6 +223,7 @@ class SaxExpatParser_Impl public: // module scope Mutex aMutex; OUString sCDATA; + bool m_bEnableDoS; // fdo#60471 thank you Adobe Illustrator Reference< XDocumentHandler > rDocumentHandler; Reference< XExtendedDocumentHandler > rExtendedDocumentHandler; @@ -257,6 +259,7 @@ public: // module scope public: SaxExpatParser_Impl() : sCDATA("CDATA") + , m_bEnableDoS(false) { } @@ -452,6 +455,22 @@ SaxExpatParser::~SaxExpatParser() delete m_pImpl; } +// ::com::sun::star::lang::XInitialization: +void SAL_CALL +SaxExpatParser::initialize(Sequence< Any > const& rArguments) + throw (RuntimeException, Exception) +{ + // possible arguments: a string "DoSmeplease" + if (rArguments.getLength()) + { + OUString str; + if ((rArguments[0] >>= str) && "DoSmeplease" == str) + { + MutexGuard guard( m_pImpl->aMutex ); + m_pImpl->m_bEnableDoS = true; + } + } +} /*************** * @@ -500,7 +519,10 @@ void SaxExpatParser::parseStream( const InputSource& structSource) XML_SetCharacterDataHandler( entity.pParser , call_callbackCharacters ); XML_SetProcessingInstructionHandler(entity.pParser , call_callbackProcessingInstruction ); - XML_SetEntityDeclHandler(entity.pParser, call_callbackEntityDecl); + if (!m_pImpl->m_bEnableDoS) + { + XML_SetEntityDeclHandler(entity.pParser, call_callbackEntityDecl); + } XML_SetNotationDeclHandler( entity.pParser, call_callbackNotationDecl ); XML_SetExternalEntityRefHandler( entity.pParser, call_callbackExternalEntityRef); diff --git a/svgio/source/svguno/xsvgparser.cxx b/svgio/source/svguno/xsvgparser.cxx index 26a81c0..1b12d9ad 100644 --- a/svgio/source/svguno/xsvgparser.cxx +++ b/svgio/source/svguno/xsvgparser.cxx @@ -21,6 +21,7 @@ #include <com/sun/star/graphic/XSvgParser.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XInitialization.hpp> #include <cppuhelper/implbase2.hxx> #include <svgio/svgreader/svgdocumenthandler.hxx> #include <com/sun/star/xml/sax/XParser.hpp> @@ -131,6 +132,14 @@ namespace svgio // get parser uno::Reference< xml::sax::XParser > xParser( xml::sax::Parser::create(context_)); + // fdo#60471 need to enable internal entities because + // certain ... popular proprietary products write SVG files + // that use entities to define XML namespaces. + uno::Reference<lang::XInitialization> const xInit(xParser, + uno::UNO_QUERY_THROW); + uno::Sequence<uno::Any> args(1); + args[0] <<= OUString("DoSmeplease"); + xInit->initialize(args); // connect parser and filter xParser->setDocumentHandler(xSvgDocHdl); commit 2f4bd9d44f8bc9e50cd4b1205fa53e0a15ce0954 Author: Michael Stahl <mst...@redhat.com> Date: Wed Feb 13 15:42:37 2013 +0100 filter: svg: optimizeGradientStops: fix STL assertion Check that there is actually more than one element in maStops before tweaking its first 2 elements (can be reproduced with fdo#60471 Tux.svg) Change-Id: I7e6ffdf510bb590a9ea9e3782b30247b8fb46ed5 diff --git a/filter/source/svg/svgreader.cxx b/filter/source/svg/svgreader.cxx index 5e9e994..5aedf0d 100644 --- a/filter/source/svg/svgreader.cxx +++ b/filter/source/svg/svgreader.cxx @@ -327,7 +327,7 @@ struct AnnotatingVisitor bool hasGradientOpacity( const Gradient& rGradient ) { return - !rGradient.maStops.empty() && + (rGradient.maStops.size() > 1) && (maGradientStopVector[ rGradient.maStops[0]].maStopColor.a != 1.0 || maGradientStopVector[ @@ -367,6 +367,10 @@ struct AnnotatingVisitor } rGradient.maStops = aNewStops; + if (rGradient.maStops.size() < 2) + { + return; // can't optimize further... + } // axial gradient, maybe? if( rGradient.meType == Gradient::LINEAR && commit 4db5b17c78c3a6567abfcd3cb43a46c1c4c80cf4 Author: Michael Stahl <mst...@redhat.com> Date: Wed Feb 13 15:18:30 2013 +0100 sax: convert some legacy assertions Change-Id: I3b4f1caa2c2d7a0fd88ea53bf05d01b2c7cc115a diff --git a/sal/inc/sal/log-areas.dox b/sal/inc/sal/log-areas.dox index 0d2ae52..1c821b1 100644 --- a/sal/inc/sal/log-areas.dox +++ b/sal/inc/sal/log-areas.dox @@ -237,6 +237,7 @@ certain functionality. @li @c linguistic @li @c oox @li @c rsc +@li @c sax @li @c shell @li @c stoc @li @c svx diff --git a/sax/source/expatwrap/sax_expat.cxx b/sax/source/expatwrap/sax_expat.cxx index db17402..7d4d792 100644 --- a/sax/source/expatwrap/sax_expat.cxx +++ b/sax/source/expatwrap/sax_expat.cxx @@ -794,7 +794,7 @@ void SaxExpatParser_Impl::callbackStartElement( void *pvThis , pImpl->pAttrList->clear(); while( awAttributes[i] ) { - OSL_ASSERT( awAttributes[i+1] ); + assert(awAttributes[i+1]); pImpl->pAttrList->addAttribute( XML_CHAR_TO_OUSTRING( awAttributes[i] ) , pImpl->sCDATA, // expat doesn't know types @@ -853,10 +853,10 @@ void SaxExpatParser_Impl::callbackEntityDecl( { SaxExpatParser_Impl *pImpl = ((SaxExpatParser_Impl*)pvThis); if (value) { // value != 0 means internal entity - OSL_TRACE("SaxExpatParser: internal entity declaration, stopping"); + SAL_INFO("sax","SaxExpatParser: internal entity declaration, stopping"); XML_StopParser(pImpl->getEntity().pParser, XML_FALSE); pImpl->exception = SAXParseException( - ::rtl::OUString( "SaxExpatParser: internal entity declaration, stopping"), + "SaxExpatParser: internal entity declaration, stopping", 0, Any(), pImpl->rDocumentLocator->getPublicId(), pImpl->rDocumentLocator->getSystemId(), diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index 4f63130..fc27f10 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -235,7 +235,7 @@ void FastSaxParser::pushContext() void FastSaxParser::popContext() { Entity& rEntity = getEntity(); - OSL_ENSURE( !rEntity.maContextStack.empty(), "sax::FastSaxParser::popContext(), pop without push?" ); + assert(!rEntity.maContextStack.empty()); // pop without push? if( !rEntity.maContextStack.empty() ) rEntity.maContextStack.pop(); } @@ -245,7 +245,7 @@ void FastSaxParser::popContext() void FastSaxParser::DefineNamespace( const OString& rPrefix, const sal_Char* pNamespaceURL ) { Entity& rEntity = getEntity(); - OSL_ENSURE( !rEntity.maContextStack.empty(), "sax::FastSaxParser::DefineNamespace(), I need a context!" ); + assert(!rEntity.maContextStack.empty()); // need a context! if( !rEntity.maContextStack.empty() ) { sal_uInt32 nOffset = rEntity.maContextStack.top()->mnNamespaceCount++; @@ -743,7 +743,7 @@ void FastSaxParser::callbackStartElement( const XML_Char* pwName, const XML_Char // #158414# first: get namespaces for( ; awAttributes[i]; i += 2 ) { - OSL_ASSERT( awAttributes[i+1] ); + assert(awAttributes[i+1]); splitName( awAttributes[i], pPrefix, nPrefixLen, pName, nNameLen ); if( nPrefixLen ) @@ -853,7 +853,7 @@ void FastSaxParser::callbackStartElement( const XML_Char* pwName, const XML_Char void FastSaxParser::callbackEndElement( SAL_UNUSED_PARAMETER const XML_Char* ) { Entity& rEntity = getEntity(); - OSL_ENSURE( !rEntity.maContextStack.empty(), "FastSaxParser::callbackEndElement - no context" ); + assert(!rEntity.maContextStack.empty()); // no context? if( !rEntity.maContextStack.empty() ) { SaxContextImplPtr pContext = rEntity.maContextStack.top(); @@ -900,18 +900,17 @@ void FastSaxParser::callbackEntityDecl( SAL_UNUSED_PARAMETER const XML_Char * /*notationName*/) { if (value) { // value != 0 means internal entity - OSL_TRACE("FastSaxParser: internal entity declaration, stopping"); + SAL_INFO("sax", "FastSaxParser: internal entity declaration, stopping"); XML_StopParser(getEntity().mpParser, XML_FALSE); getEntity().maSavedException <<= SAXParseException( - ::rtl::OUString( - "FastSaxParser: internal entity declaration, stopping"), + "FastSaxParser: internal entity declaration, stopping", static_cast<OWeakObject*>(this), Any(), mxDocumentLocator->getPublicId(), mxDocumentLocator->getSystemId(), mxDocumentLocator->getLineNumber(), mxDocumentLocator->getColumnNumber() ); } else { - OSL_TRACE("FastSaxParser: ignoring external entity declaration"); + SAL_INFO("sax", "FastSaxParser: ignoring external entity declaration"); } } commit ed09e6b233eac719744b32daf0ea47cea423bcc3 Author: Michael Stahl <mst...@redhat.com> Date: Wed Feb 13 14:19:26 2013 +0100 Revert "fdo#34558 don't crash on undoing text frame removal" This reverts commit e462a30d03c16aa4202f8d28ad52b15feb3d9255. diff --git a/svx/inc/svx/svdundo.hxx b/svx/inc/svx/svdundo.hxx index 8066c72..0d3713e 100644 --- a/svx/inc/svx/svdundo.hxx +++ b/svx/inc/svx/svdundo.hxx @@ -20,7 +20,6 @@ #ifndef _SVDUNDO_HXX #define _SVDUNDO_HXX -#include <svl/lstner.hxx> #include <svl/solar.hrc> #include <svl/undo.hxx> #include <tools/gen.hxx> @@ -253,12 +252,9 @@ public: // //************************************************************ -class SVX_DLLPUBLIC SdrUndoObjList : public SdrUndoObj, public SfxListener { +class SVX_DLLPUBLIC SdrUndoObjList : public SdrUndoObj { bool bOwner; -public: - TYPEINFO(); - protected: SdrObjList* pObjList; SdrView* pView; // um bei ObjDel, Undo die @@ -274,9 +270,6 @@ protected: void SetView(SdrView* pView1, SdrPageView* pPageView1) { pView=pView1; pPageView=pPageView1; } bool IsOwner() { return bOwner; } void SetOwner(bool bNew); - -private: - virtual void Notify(SfxBroadcaster& rBroadcaster, const SfxHint& rHint); }; //************************************************************ diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx index 5e53ab1..452761d 100644 --- a/svx/source/svdraw/svdundo.cxx +++ b/svx/source/svdraw/svdundo.cxx @@ -655,8 +655,6 @@ OUString SdrUndoGeoObj::GetComment() const //////////////////////////////////////////////////////////////////////////////////////////////////// -TYPEINIT1(SdrUndoObjList, SfxListener); - SdrUndoObjList::SdrUndoObjList(SdrObject& rNewObj, bool bOrdNumDirect) : SdrUndoObj(rNewObj), bOwner(sal_False), @@ -669,14 +667,10 @@ SdrUndoObjList::SdrUndoObjList(SdrObject& rNewObj, bool bOrdNumDirect) } else { nOrdNum=pObj->GetOrdNum(); } - - StartListening(*pObjList->GetModel()); } SdrUndoObjList::~SdrUndoObjList() { - EndListening(*pObjList->GetModel()); - if (pObj!=NULL && IsOwner()) { // Attribute have to go back to the regular Pool @@ -692,20 +686,6 @@ void SdrUndoObjList::SetOwner(bool bNew) bOwner = bNew; } -void SdrUndoObjList::Notify(SfxBroadcaster&, const SfxHint& rHint) -{ - const SdrHint* pSdrHint(dynamic_cast<const SdrHint*>(&rHint)); - if (pSdrHint) - { - if ((pSdrHint->GetObject() == pObj) && (pSdrHint->GetKind() == HINT_OBJCHG)) - { - const sal_uInt32 nNewOrdNum(pObj->GetOrdNum()); - if (nNewOrdNum != nOrdNum) - nOrdNum = nNewOrdNum; - } - } -} - //////////////////////////////////////////////////////////////////////////////////////////////////// void SdrUndoRemoveObj::Undo() _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits