ximpshap.cxx (bfba507c) ximpshap.cxx (598d8f9f)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 452 unchanged lines hidden (view full) ---

461 if(!mbTemporaryShape && (!GetImport().HasTextImport()
462 || !GetImport().GetTextImport()->IsInsideDeleteContext()))
463 {
464 xImp->shapeWithZIndexAdded( xShape, mnZOrder );
465 }
466
467 if( maShapeId.getLength() )
468 {
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 452 unchanged lines hidden (view full) ---

461 if(!mbTemporaryShape && (!GetImport().HasTextImport()
462 || !GetImport().GetTextImport()->IsInsideDeleteContext()))
463 {
464 xImp->shapeWithZIndexAdded( xShape, mnZOrder );
465 }
466
467 if( maShapeId.getLength() )
468 {
469 uno::Reference< uno::XInterface > xRef( xShape, uno::UNO_QUERY );
470 GetImport().getInterfaceToIdentifierMapper().registerReference( maShapeId, xRef );
469 const SdXMLGraphicObjectShapeContext* pGSC = dynamic_cast< const SdXMLGraphicObjectShapeContext* >(this);
470
471 /* avoid registering when LateRegister is needed. E.g. MultiImage support where in-between multiple
472 xShapes with the same ID would be registered. Registration is done after deciding which image
473 to keep, see calls to solveMultipleImages */
474 if(!pGSC || !pGSC->getLateAddToIdentifierMapper())
475 {
476 uno::Reference< uno::XInterface > xRef( xShape, uno::UNO_QUERY );
477 GetImport().getInterfaceToIdentifierMapper().registerReference( maShapeId, xRef );
478 }
471 }
472
473 // #91065# count only if counting for shape import is enabled
474 if(GetImport().GetShapeImport()->IsHandleProgressBarEnabled())
475 {
476 // #80365# increment progress bar at load once for each draw object
477 GetImport().GetProgressBarHelper()->Increment();
478 }

--- 1804 unchanged lines hidden (view full) ---

2283SdXMLGraphicObjectShapeContext::SdXMLGraphicObjectShapeContext(
2284 SvXMLImport& rImport,
2285 sal_uInt16 nPrfx,
2286 const OUString& rLocalName,
2287 const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
2288 uno::Reference< drawing::XShapes >& rShapes,
2289 sal_Bool bTemporaryShape)
2290: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
479 }
480
481 // #91065# count only if counting for shape import is enabled
482 if(GetImport().GetShapeImport()->IsHandleProgressBarEnabled())
483 {
484 // #80365# increment progress bar at load once for each draw object
485 GetImport().GetProgressBarHelper()->Increment();
486 }

--- 1804 unchanged lines hidden (view full) ---

2291SdXMLGraphicObjectShapeContext::SdXMLGraphicObjectShapeContext(
2292 SvXMLImport& rImport,
2293 sal_uInt16 nPrfx,
2294 const OUString& rLocalName,
2295 const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
2296 uno::Reference< drawing::XShapes >& rShapes,
2297 sal_Bool bTemporaryShape)
2298: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
2291 maURL()
2299 maURL(),
2300 mbLateAddToIdentifierMapper(false)
2292{
2293}
2294
2295//////////////////////////////////////////////////////////////////////////////
2296
2297// this is called from the parent group for each unparsed attribute in the attribute list
2298void SdXMLGraphicObjectShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
2299{

--- 1123 unchanged lines hidden (view full) ---

3423 {
3424 pContext = GetImport().GetShapeImport()->CreateFrameChildContext(
3425 GetImport(), nPrefix, rLocalName, xAttrList, mxShapes, mxAttrList);
3426
3427 mxImplContext = pContext;
3428 mbSupportsReplacement = IsXMLToken(rLocalName, XML_OBJECT ) || IsXMLToken(rLocalName, XML_OBJECT_OLE);
3429 setSupportsMultipleContents(IsXMLToken(rLocalName, XML_IMAGE));
3430
2301{
2302}
2303
2304//////////////////////////////////////////////////////////////////////////////
2305
2306// this is called from the parent group for each unparsed attribute in the attribute list
2307void SdXMLGraphicObjectShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
2308{

--- 1123 unchanged lines hidden (view full) ---

3432 {
3433 pContext = GetImport().GetShapeImport()->CreateFrameChildContext(
3434 GetImport(), nPrefix, rLocalName, xAttrList, mxShapes, mxAttrList);
3435
3436 mxImplContext = pContext;
3437 mbSupportsReplacement = IsXMLToken(rLocalName, XML_OBJECT ) || IsXMLToken(rLocalName, XML_OBJECT_OLE);
3438 setSupportsMultipleContents(IsXMLToken(rLocalName, XML_IMAGE));
3439
3431 if(getSupportsMultipleContents() && dynamic_cast< SdXMLGraphicObjectShapeContext* >(pContext))
3440 if(getSupportsMultipleContents())
3432 {
3441 {
3433 addContent(*mxImplContext);
3442 SdXMLGraphicObjectShapeContext* pGSC = dynamic_cast< SdXMLGraphicObjectShapeContext* >(pContext);
3443
3444 if(pGSC)
3445 {
3446 // mark context as LateAdd to avoid conflicts with multiple objects registering with the same ID
3447 pGSC->setLateAddToIdentifierMapper(true);
3448 addContent(*mxImplContext);
3449 }
3434 }
3435 }
3436 else if(getSupportsMultipleContents() && XML_NAMESPACE_DRAW == nPrefix && IsXMLToken(rLocalName, XML_IMAGE))
3437 {
3438 // read another image
3439 pContext = GetImport().GetShapeImport()->CreateFrameChildContext(
3440 GetImport(), nPrefix, rLocalName, xAttrList, mxShapes, mxAttrList);
3441 mxImplContext = pContext;
3442
3450 }
3451 }
3452 else if(getSupportsMultipleContents() && XML_NAMESPACE_DRAW == nPrefix && IsXMLToken(rLocalName, XML_IMAGE))
3453 {
3454 // read another image
3455 pContext = GetImport().GetShapeImport()->CreateFrameChildContext(
3456 GetImport(), nPrefix, rLocalName, xAttrList, mxShapes, mxAttrList);
3457 mxImplContext = pContext;
3458
3443 if(dynamic_cast< SdXMLGraphicObjectShapeContext* >(pContext))
3459 SdXMLGraphicObjectShapeContext* pGSC = dynamic_cast< SdXMLGraphicObjectShapeContext* >(pContext);
3460
3461 if(pGSC)
3444 {
3462 {
3463 // mark context as LateAdd to avoid conflicts with multiple objects registering with the same ID
3464 pGSC->setLateAddToIdentifierMapper(true);
3445 addContent(*mxImplContext);
3446 }
3447 }
3448 else if( mbSupportsReplacement && !mxReplImplContext &&
3449 XML_NAMESPACE_DRAW == nPrefix &&
3450 IsXMLToken( rLocalName, XML_IMAGE ) )
3451 {
3452 // read replacement image

--- 46 unchanged lines hidden (view full) ---

3499void SdXMLFrameShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>&)
3500{
3501 // ignore
3502}
3503
3504void SdXMLFrameShapeContext::EndElement()
3505{
3506 /// solve if multiple image child contexts were imported
3465 addContent(*mxImplContext);
3466 }
3467 }
3468 else if( mbSupportsReplacement && !mxReplImplContext &&
3469 XML_NAMESPACE_DRAW == nPrefix &&
3470 IsXMLToken( rLocalName, XML_IMAGE ) )
3471 {
3472 // read replacement image

--- 46 unchanged lines hidden (view full) ---

3519void SdXMLFrameShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>&)
3520{
3521 // ignore
3522}
3523
3524void SdXMLFrameShapeContext::EndElement()
3525{
3526 /// solve if multiple image child contexts were imported
3507 solveMultipleImages();
3527 const SvXMLImportContext* pWinner = solveMultipleImages();
3528 const SdXMLGraphicObjectShapeContext* pGSCWinner = dynamic_cast< const SdXMLGraphicObjectShapeContext* >(pWinner);
3508
3529
3530 /// if we have a winner and it's on LateAdd, add it now
3531 if(pGSCWinner && pGSCWinner->getLateAddToIdentifierMapper() && pGSCWinner->getShapeId().getLength())
3532 {
3533 uno::Reference< uno::XInterface > xRef( pGSCWinner->getShape(), uno::UNO_QUERY );
3534 GetImport().getInterfaceToIdentifierMapper().registerReference( pGSCWinner->getShapeId(), xRef );
3535 }
3536
3509 if( !mxImplContext.Is() )
3510 {
3511 // now check if this is an empty presentation object
3512 sal_Int16 nAttrCount = mxAttrList.is() ? mxAttrList->getLength() : 0;
3513 for(sal_Int16 a(0); a < nAttrCount; a++)
3514 {
3515 OUString aLocalName;
3516 sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(mxAttrList->getNameByIndex(a), &aLocalName);

--- 362 unchanged lines hidden ---
3537 if( !mxImplContext.Is() )
3538 {
3539 // now check if this is an empty presentation object
3540 sal_Int16 nAttrCount = mxAttrList.is() ? mxAttrList->getLength() : 0;
3541 for(sal_Int16 a(0); a < nAttrCount; a++)
3542 {
3543 OUString aLocalName;
3544 sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(mxAttrList->getNameByIndex(a), &aLocalName);

--- 362 unchanged lines hidden ---