ximpshap.cxx (1f882ec4) ximpshap.cxx (f3b8b509)
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

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

921 {
922 return sal_True;
923 }
924 }
925
926 return sal_False;
927}
928
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

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

921 {
922 return sal_True;
923 }
924 }
925
926 return sal_False;
927}
928
929void SdXMLShapeContext::onDemandRescueUsefulDataFromTemporary( const SvXMLImportContext& rCandidate )
930{
931 const SdXMLShapeContext* pCandidate = dynamic_cast< const SdXMLShapeContext* >(&rCandidate);
932
933 if(!mxGluePoints.is() && pCandidate)
934 {
935 // try to rescue GluePoints from rCandidate to local if we not yet have GluePoints by copying them
936 uno::Reference< drawing::XGluePointsSupplier > xSourceSupplier( pCandidate->getShape(), uno::UNO_QUERY );
937 if( !xSourceSupplier.is() )
938 return;
939
940 uno::Reference< container::XIdentifierAccess > xSourceGluePoints( xSourceSupplier->getGluePoints(), uno::UNO_QUERY );
941 if( !xSourceGluePoints.is() )
942 return;
943
944 uno::Sequence< sal_Int32 > aSourceIdSequence( xSourceGluePoints->getIdentifiers() );
945 const sal_Int32 nSourceCount(aSourceIdSequence.getLength());
946 UniReference< XMLShapeImportHelper > xSourceShapeImportHelper(const_cast< SdXMLShapeContext* >(pCandidate)->GetImport().GetShapeImport());
947
948 if(nSourceCount)
949 {
950 // rCandidate has GluePoints; prepare the GluePoint container for the local shape
951 uno::Reference< drawing::XGluePointsSupplier > xSupplier( mxShape, uno::UNO_QUERY );
952 if( !xSupplier.is() )
953 return;
954
955 mxGluePoints = uno::Reference< container::XIdentifierContainer >::query( xSupplier->getGluePoints() );
956
957 if( !mxGluePoints.is() )
958 return;
959
960 drawing::GluePoint2 aSourceGluePoint;
961
962 for( sal_Int32 nSourceIndex(0); nSourceIndex < nSourceCount; nSourceIndex++ )
963 {
964 const sal_Int32 nSourceIdentifier = aSourceIdSequence[nSourceIndex];
965
966 // loop over GluePoints which are UserDefined (avoid the auto mapped ones)
967 if((xSourceGluePoints->getByIdentifier( nSourceIdentifier ) >>= aSourceGluePoint)
968 && aSourceGluePoint.IsUserDefined)
969 {
970 // get original mappingID back, this is the draw:id imported with a draw:glue-point
971 const sal_Int32 nDestinnationId = xSourceShapeImportHelper->findGluePointMapping(
972 pCandidate->getShape(),
973 nSourceIdentifier );
974
975 if(-1 != nSourceIdentifier)
976 {
977 // if we got that we are able to add a copy of that GluePoint to the local
978 // context and xShape since we have all information that the source shape
979 // and context had at import time
980 try
981 {
982 const sal_Int32 nInternalId = mxGluePoints->insert( uno::makeAny( aSourceGluePoint ) );
983 GetImport().GetShapeImport()->addGluePointMapping( mxShape, nDestinnationId, nInternalId );
984 }
985 catch( uno::Exception& )
986 {
987 DBG_ERROR( "exception during setting of glue points!");
988 }
989 }
990 }
991 }
992 }
993 }
994}
995
929////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
930////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
931
932TYPEINIT1( SdXMLRectShapeContext, SdXMLShapeContext );
933
934SdXMLRectShapeContext::SdXMLRectShapeContext(
935 SvXMLImport& rImport,
936 sal_uInt16 nPrfx,

--- 3098 unchanged lines hidden ---
996////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
997////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
998
999TYPEINIT1( SdXMLRectShapeContext, SdXMLShapeContext );
1000
1001SdXMLRectShapeContext::SdXMLRectShapeContext(
1002 SvXMLImport& rImport,
1003 sal_uInt16 nPrfx,

--- 3098 unchanged lines hidden ---