Author: alg
Date: Tue Feb 4 17:42:05 2014
New Revision: 1564400
URL: http://svn.apache.org/r1564400
Log:
i124143 for draw:frame containing multiple draw:image and draw:glue-point it is
necessary to move the GluePoints from the last draw:image where they were
automatically imported to the surviving one if these are different
Modified:
openoffice/trunk/main/xmloff/inc/xmloff/shapeimport.hxx
openoffice/trunk/main/xmloff/inc/xmloff/xmlictxt.hxx
openoffice/trunk/main/xmloff/source/core/xmlictxt.cxx
openoffice/trunk/main/xmloff/source/core/xmlmultiimagehelper.cxx
openoffice/trunk/main/xmloff/source/draw/shapeimport.cxx
openoffice/trunk/main/xmloff/source/draw/ximpshap.cxx
openoffice/trunk/main/xmloff/source/draw/ximpshap.hxx
Modified: openoffice/trunk/main/xmloff/inc/xmloff/shapeimport.hxx
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/xmloff/inc/xmloff/shapeimport.hxx?rev=1564400&r1=1564399&r2=1564400&view=diff
==============================================================================
--- openoffice/trunk/main/xmloff/inc/xmloff/shapeimport.hxx (original)
+++ openoffice/trunk/main/xmloff/inc/xmloff/shapeimport.hxx Tue Feb 4 17:42:05
2014
@@ -394,12 +394,17 @@ public:
void addGluePointMapping( com::sun::star::uno::Reference<
com::sun::star::drawing::XShape >& xShape,
sal_Int32 nSourceId,
sal_Int32 nDestinnationId );
+ /** find mapping for given DestinationID. This allows to extract the
original draw:id imported with a draw:glue-point */
+ sal_Int32 findGluePointMapping(
+ const com::sun::star::uno::Reference< com::sun::star::drawing::XShape
>& xShape,
+ sal_Int32 nDestinnationId ) const;
+
/** moves all current DestinationId's for rXShape by n */
void moveGluePointMapping( const com::sun::star::uno::Reference<
com::sun::star::drawing::XShape >& xShape, const sal_Int32 n );
/** retrieves a mapping for a glue point identifier from the current
xml file to the identifier created after
inserting the new glue point into the core. The mapping must be
initialized first with addGluePointMapping() */
- sal_Int32 getGluePointId( com::sun::star::uno::Reference<
com::sun::star::drawing::XShape >& xShape, sal_Int32 nSourceId );
+ sal_Int32 getGluePointId( const com::sun::star::uno::Reference<
com::sun::star::drawing::XShape >& xShape, sal_Int32 nSourceId );
/** this method must be calling before the first shape is imported for
the given page.
Calls to this method can be nested */
Modified: openoffice/trunk/main/xmloff/inc/xmloff/xmlictxt.hxx
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/xmloff/inc/xmloff/xmlictxt.hxx?rev=1564400&r1=1564399&r2=1564400&view=diff
==============================================================================
--- openoffice/trunk/main/xmloff/inc/xmloff/xmlictxt.hxx (original)
+++ openoffice/trunk/main/xmloff/inc/xmloff/xmlictxt.hxx Tue Feb 4 17:42:05
2014
@@ -94,6 +94,11 @@ public:
// This method is called for all characters that are contained in the
// current element. The default is to ignore them.
virtual void Characters( const ::rtl::OUString& rChars );
+
+ // #124143# allow to copy evtl. useful data from another temporary import
context, e.g. used to
+ // support multiple images and to rescue evtl. GluePoints imported with
one of the
+ // to be deprecated contents
+ virtual void onDemandRescueUsefulDataFromTemporary( const
SvXMLImportContext& rCandidate );
};
SV_DECL_REF( SvXMLImportContext )
Modified: openoffice/trunk/main/xmloff/source/core/xmlictxt.cxx
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/xmloff/source/core/xmlictxt.cxx?rev=1564400&r1=1564399&r2=1564400&view=diff
==============================================================================
--- openoffice/trunk/main/xmloff/source/core/xmlictxt.cxx (original)
+++ openoffice/trunk/main/xmloff/source/core/xmlictxt.cxx Tue Feb 4 17:42:05
2014
@@ -77,4 +77,7 @@ void SvXMLImportContext::Characters( con
{
}
+void SvXMLImportContext::onDemandRescueUsefulDataFromTemporary( const
SvXMLImportContext& )
+{
+}
Modified: openoffice/trunk/main/xmloff/source/core/xmlmultiimagehelper.cxx
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/xmloff/source/core/xmlmultiimagehelper.cxx?rev=1564400&r1=1564399&r2=1564400&view=diff
==============================================================================
--- openoffice/trunk/main/xmloff/source/core/xmlmultiimagehelper.cxx (original)
+++ openoffice/trunk/main/xmloff/source/core/xmlmultiimagehelper.cxx Tue Feb 4
17:42:05 2014
@@ -96,7 +96,7 @@ multiImageImportHelper::~multiImageImpor
const SvXMLImportContext* multiImageImportHelper::solveMultipleImages()
{
- const SvXMLImportContext* pRetval = 0;
+ SvXMLImportContext* pRetval = 0;
if(maImplContextVector.size())
{
@@ -133,7 +133,16 @@ const SvXMLImportContext* multiImageImpo
{
if(a != nIndexOfPreferred)
{
- removeGraphicFromImportContext(**maImplContextVector[a]);
+ SvXMLImportContext& rCandidate = **maImplContextVector[a];
+
+ if(pRetval)
+ {
+ // #124143# evtl. copy imported GluePoints before
deprecating
+ // this graphic and context
+
pRetval->onDemandRescueUsefulDataFromTemporary(rCandidate);
+ }
+
+ removeGraphicFromImportContext(rCandidate);
}
}
}
Modified: openoffice/trunk/main/xmloff/source/draw/shapeimport.cxx
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/xmloff/source/draw/shapeimport.cxx?rev=1564400&r1=1564399&r2=1564400&view=diff
==============================================================================
--- openoffice/trunk/main/xmloff/source/draw/shapeimport.cxx (original)
+++ openoffice/trunk/main/xmloff/source/draw/shapeimport.cxx Tue Feb 4
17:42:05 2014
@@ -1355,6 +1355,35 @@ void XMLShapeImportHelper::addGluePointM
mpPageContext->maShapeGluePointsMap[xShape][nSourceId] =
nDestinnationId;
}
+/** find mapping for given DestinationID. This allows to extract the original
draw:id imported with a draw:glue-point */
+sal_Int32 XMLShapeImportHelper::findGluePointMapping(
+ const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >&
xShape,
+ sal_Int32 nDestinnationId ) const
+{
+ if( mpPageContext )
+ {
+ ShapeGluePointsMap::iterator aShapeIter(
mpPageContext->maShapeGluePointsMap.find( xShape ) );
+
+ if( aShapeIter != mpPageContext->maShapeGluePointsMap.end() )
+ {
+ GluePointIdMap::iterator aShapeIdIter =
(*aShapeIter).second.begin();
+ GluePointIdMap::iterator aShapeIdEnd = (*aShapeIter).second.end();
+
+ while ( aShapeIdIter != aShapeIdEnd )
+ {
+ if ( (*aShapeIdIter).second == nDestinnationId )
+ {
+ return (*aShapeIdIter).first;
+ }
+
+ aShapeIdIter++;
+ }
+ }
+ }
+
+ return -1;
+}
+
/** moves all current DestinationId's by n */
void XMLShapeImportHelper::moveGluePointMapping( const
com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape,
const sal_Int32 n )
{
@@ -1377,7 +1406,7 @@ void XMLShapeImportHelper::moveGluePoint
/** retrieves a mapping for a glue point identifier from the current xml file
to the identifier created after
inserting the new glue point into the core. The mapping must be
initialized first with addGluePointMapping() */
-sal_Int32 XMLShapeImportHelper::getGluePointId(
com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape,
sal_Int32 nSourceId )
+sal_Int32 XMLShapeImportHelper::getGluePointId( const
com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape,
sal_Int32 nSourceId )
{
if( mpPageContext )
{
Modified: openoffice/trunk/main/xmloff/source/draw/ximpshap.cxx
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/xmloff/source/draw/ximpshap.cxx?rev=1564400&r1=1564399&r2=1564400&view=diff
==============================================================================
--- openoffice/trunk/main/xmloff/source/draw/ximpshap.cxx (original)
+++ openoffice/trunk/main/xmloff/source/draw/ximpshap.cxx Tue Feb 4 17:42:05
2014
@@ -926,6 +926,73 @@ sal_Bool SdXMLShapeContext::isPresentati
return sal_False;
}
+void SdXMLShapeContext::onDemandRescueUsefulDataFromTemporary( const
SvXMLImportContext& rCandidate )
+{
+ const SdXMLShapeContext* pCandidate = dynamic_cast< const
SdXMLShapeContext* >(&rCandidate);
+
+ if(!mxGluePoints.is() && pCandidate)
+ {
+ // try to rescue GluePoints from rCandidate to local if we not yet
have GluePoints by copying them
+ uno::Reference< drawing::XGluePointsSupplier > xSourceSupplier(
pCandidate->getShape(), uno::UNO_QUERY );
+ if( !xSourceSupplier.is() )
+ return;
+
+ uno::Reference< container::XIdentifierAccess > xSourceGluePoints(
xSourceSupplier->getGluePoints(), uno::UNO_QUERY );
+ if( !xSourceGluePoints.is() )
+ return;
+
+ uno::Sequence< sal_Int32 > aSourceIdSequence(
xSourceGluePoints->getIdentifiers() );
+ const sal_Int32 nSourceCount(aSourceIdSequence.getLength());
+ UniReference< XMLShapeImportHelper >
xSourceShapeImportHelper(const_cast< SdXMLShapeContext*
>(pCandidate)->GetImport().GetShapeImport());
+
+ if(nSourceCount)
+ {
+ // rCandidate has GluePoints; prepare the GluePoint container for
the local shape
+ uno::Reference< drawing::XGluePointsSupplier > xSupplier( mxShape,
uno::UNO_QUERY );
+ if( !xSupplier.is() )
+ return;
+
+ mxGluePoints = uno::Reference< container::XIdentifierContainer
>::query( xSupplier->getGluePoints() );
+
+ if( !mxGluePoints.is() )
+ return;
+
+ drawing::GluePoint2 aSourceGluePoint;
+
+ for( sal_Int32 nSourceIndex(0); nSourceIndex < nSourceCount;
nSourceIndex++ )
+ {
+ const sal_Int32 nSourceIdentifier =
aSourceIdSequence[nSourceIndex];
+
+ // loop over GluePoints which are UserDefined (avoid the auto
mapped ones)
+ if((xSourceGluePoints->getByIdentifier( nSourceIdentifier )
>>= aSourceGluePoint)
+ && aSourceGluePoint.IsUserDefined)
+ {
+ // get original mappingID back, this is the draw:id
imported with a draw:glue-point
+ const sal_Int32 nDestinnationId =
xSourceShapeImportHelper->findGluePointMapping(
+ pCandidate->getShape(),
+ nSourceIdentifier );
+
+ if(-1 != nSourceIdentifier)
+ {
+ // if we got that we are able to add a copy of that
GluePoint to the local
+ // context and xShape since we have all information
that the source shape
+ // and context had at import time
+ try
+ {
+ const sal_Int32 nInternalId =
mxGluePoints->insert( uno::makeAny( aSourceGluePoint ) );
+ GetImport().GetShapeImport()->addGluePointMapping(
mxShape, nDestinnationId, nInternalId );
+ }
+ catch( uno::Exception& )
+ {
+ DBG_ERROR( "exception during setting of glue
points!");
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Modified: openoffice/trunk/main/xmloff/source/draw/ximpshap.hxx
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/xmloff/source/draw/ximpshap.hxx?rev=1564400&r1=1564399&r2=1564400&view=diff
==============================================================================
--- openoffice/trunk/main/xmloff/source/draw/ximpshap.hxx (original)
+++ openoffice/trunk/main/xmloff/source/draw/ximpshap.hxx Tue Feb 4 17:42:05
2014
@@ -120,6 +120,10 @@ public:
/// access to ShapeId for evtl. late adding
const rtl::OUString& getShapeId() const { return maShapeId; }
+
+ // allow to copy evtl. useful data from another temporary import context,
e.g. used to
+ // support multiple images
+ virtual void onDemandRescueUsefulDataFromTemporary( const
SvXMLImportContext& rCandidate );
};
//////////////////////////////////////////////////////////////////////////////