You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by or...@apache.org on 2014/05/23 16:28:40 UTC
svn commit: r1597102 - in /openoffice/trunk/main/sw: inc/ndgrf.hxx
source/core/graphic/ndgrf.cxx source/filter/xml/xmltexte.cxx
Author: orw
Date: Fri May 23 14:28:40 2014
New Revision: 1597102
URL: http://svn.apache.org/r1597102
Log:
124946: only apply new embedded stream name for a graphic, if is already has one.
- needed correction for the fix made for issue 114361
Modified:
openoffice/trunk/main/sw/inc/ndgrf.hxx
openoffice/trunk/main/sw/source/core/graphic/ndgrf.cxx
openoffice/trunk/main/sw/source/filter/xml/xmltexte.cxx
Modified: openoffice/trunk/main/sw/inc/ndgrf.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/inc/ndgrf.hxx?rev=1597102&r1=1597101&r2=1597102&view=diff
==============================================================================
--- openoffice/trunk/main/sw/inc/ndgrf.hxx (original)
+++ openoffice/trunk/main/sw/inc/ndgrf.hxx Fri May 23 14:28:40 2014
@@ -75,7 +75,6 @@ class SW_DLLPUBLIC SwGrfNode: public SwN
void InsertLink( const String& rGrfName, const String& rFltName );
sal_Bool ImportGraphic( SvStream& rStrm );
- sal_Bool HasStreamName() const { return maGrfObj.HasUserData(); }
void _GetStreamStorageNames( String& rStrmName, String& rStgName ) const;
void DelStreamName();
DECL_LINK( SwapGraphic, GraphicObject* );
@@ -177,6 +176,7 @@ public:
// Entfernen der Grafik, um Speicher freizugeben
short SwapOut();
+ sal_Bool HasEmbeddedStreamName() const { return maGrfObj.HasUserData(); }
// applying new stream name for embedded graphic - needed as saving the document might change this stream name
void ApplyNewEmbeddedStreamName( const String& r )
{
Modified: openoffice/trunk/main/sw/source/core/graphic/ndgrf.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/graphic/ndgrf.cxx?rev=1597102&r1=1597101&r2=1597102&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/core/graphic/ndgrf.cxx (original)
+++ openoffice/trunk/main/sw/source/core/graphic/ndgrf.cxx Fri May 23 14:28:40 2014
@@ -239,7 +239,7 @@ sal_Bool SwGrfNode::ReRead(
else if( pGraphic && !rGrfName.Len() )
{
// MIB 27.02.2001: Old stream must be deleted before the new one is set.
- if( HasStreamName() )
+ if( HasEmbeddedStreamName() )
DelStreamName();
maGrfObj.SetGraphic( *pGraphic );
@@ -249,7 +249,7 @@ sal_Bool SwGrfNode::ReRead(
else if( pGrfObj && !rGrfName.Len() )
{
// MIB 27.02.2001: Old stream must be deleted before the new one is set.
- if( HasStreamName() )
+ if( HasEmbeddedStreamName() )
DelStreamName();
maGrfObj = *pGrfObj;
@@ -265,7 +265,7 @@ sal_Bool SwGrfNode::ReRead(
else
{
- if( HasStreamName() )
+ if( HasEmbeddedStreamName() )
DelStreamName();
// einen neuen Grafik-Link anlegen
@@ -546,21 +546,16 @@ short SwGrfNode::SwapIn( sal_Bool bWaitF
else
nRet = 1;
}
- else if( maGrfObj.IsSwappedOut() )
- {
- // Die Grafik ist im Storage oder im TempFile drin
- if( !HasStreamName() )
- nRet = (short)maGrfObj.SwapIn();
- else
- {
+ else if ( maGrfObj.IsSwappedOut() )
+ {
+ // Die Grafik ist im Storage oder im TempFile drin
+ if ( !HasEmbeddedStreamName() )
+ nRet = (short) maGrfObj.SwapIn();
+ else
+ {
- // --> OD 2005-05-04 #i48434# - usage of new method <_GetStreamForEmbedGrf(..)>
try
{
- // --> OD, MAV 2005-08-17 #i53025# - needed correction of new
- // method <_GetStreamForEmbedGrf(..)>
-// bool bGraphic(false);
-// SvStream* pStrm = _GetStreamForEmbedGrf( bGraphic );
String aStrmName, aPicStgName;
_GetStreamStorageNames( aStrmName, aPicStgName );
uno::Reference < embed::XStorage > refPics = _GetDocSubstorageOrRoot( aPicStgName );
@@ -571,34 +566,30 @@ short SwGrfNode::SwapIn( sal_Bool bWaitF
nRet = 1;
delete pStrm;
}
- // <--
}
catch ( uno::Exception& )
{
- // --> OD 2005-04-25 #i48434#
ASSERT( false, "<SwGrfNode::SwapIn(..)> - unhandled exception!" );
- // <--
}
- // <--
- }
+ }
- if( 1 == nRet )
- {
- SwMsgPoolItem aMsg( RES_GRAPHIC_SWAPIN );
+ if ( 1 == nRet )
+ {
+ SwMsgPoolItem aMsg( RES_GRAPHIC_SWAPIN );
ModifyNotification( &aMsg, &aMsg );
- }
- }
- else
- nRet = 1;
- DBG_ASSERTWARNING( nRet, "Grafik kann nicht eingeswapt werden" );
+ }
+ }
+ else
+ nRet = 1;
+ DBG_ASSERTWARNING( nRet, "Grafik kann nicht eingeswapt werden" );
- if( nRet )
- {
- if( !nGrfSize.Width() && !nGrfSize.Height() )
- SetTwipSize( ::GetGraphicSizeTwip( maGrfObj.GetGraphic(), 0 ) );
- }
- bInSwapIn = sal_False;
- return nRet;
+ if ( nRet )
+ {
+ if ( !nGrfSize.Width() && !nGrfSize.Height() )
+ SetTwipSize( ::GetGraphicSizeTwip( maGrfObj.GetGraphic(), 0 ) );
+ }
+ bInSwapIn = sal_False;
+ return nRet;
}
@@ -614,7 +605,7 @@ short SwGrfNode::SwapOut()
// Die Grafik wird in eine TempFile geschrieben, wenn
// sie frisch eingefuegt war, d.h. wenn es noch keinen
// Streamnamen im Storage gibt.
- if( !HasStreamName() )
+ if( !HasEmbeddedStreamName() )
if( !maGrfObj.SwapOut() )
return 0;
}
@@ -665,7 +656,7 @@ sal_Bool SwGrfNode::SavePersistentData()
}
// Erst mal reinswappen, falls sie im Storage ist
- if( HasStreamName() && !SwapIn() )
+ if( HasEmbeddedStreamName() && !SwapIn() )
return sal_False;
// --> OD 2005-04-19 #i44367#
@@ -866,7 +857,7 @@ void SwGrfNode::ScaleImageMap()
void SwGrfNode::DelStreamName()
{
- if( HasStreamName() )
+ if( HasEmbeddedStreamName() )
{
// Dann die Grafik im Storage loeschen
uno::Reference < embed::XStorage > xDocStg = GetDoc()->GetDocStorage();
@@ -1026,7 +1017,7 @@ SwCntntNode* SwGrfNode::MakeCopy( SwDoc*
Graphic aTmpGrf;
SwBaseLink* pLink = (SwBaseLink*)(::sfx2::SvBaseLink*) refLink;
- if( !pLink && HasStreamName() )
+ if( !pLink && HasEmbeddedStreamName() )
{
// --> OD 2005-05-04 #i48434# - usage of new method <_GetStreamForEmbedGrf(..)>
try
@@ -1114,7 +1105,7 @@ IMPL_LINK( SwGrfNode, SwapGraphic, Graph
{
pRet = GRFMGR_AUTOSWAPSTREAM_TEMP;
- if( HasStreamName() )
+ if( HasEmbeddedStreamName() )
{
// --> OD 2005-05-04 #i48434# - usage of new method <_GetStreamForEmbedGrf(..)>
try
Modified: openoffice/trunk/main/sw/source/filter/xml/xmltexte.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/filter/xml/xmltexte.cxx?rev=1597102&r1=1597101&r2=1597102&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/filter/xml/xmltexte.cxx (original)
+++ openoffice/trunk/main/sw/source/filter/xml/xmltexte.cxx Fri May 23 14:28:40 2014
@@ -211,31 +211,33 @@ SwXMLTextParagraphExport::~SwXMLTextPara
}
void SwXMLTextParagraphExport::setTextEmbeddedGraphicURL(
- const Reference < XPropertySet >& rPropSet,
- OUString& rURL) const
-{
- if( !rURL.getLength() )
- return;
+ const Reference< XPropertySet >& rPropSet,
+ OUString& rURL ) const
+ {
+ if ( !rURL.getLength() )
+ return;
- SwGrfNode *pGrfNd = GetNoTxtNode( rPropSet )->GetGrfNode();
- if( !pGrfNd->IsGrfLink() )
- {
- String aNewURL( RTL_CONSTASCII_STRINGPARAM("vnd.sun.star.Package:") );
- aNewURL += String(rURL);
- pGrfNd->ApplyNewEmbeddedStreamName( aNewURL );
+ SwGrfNode *pGrfNd = GetNoTxtNode( rPropSet )->GetGrfNode();
+ if ( !pGrfNd->IsGrfLink() )
+ {
+ // Apply new embedded stream name, only if graphic node already has one.
+ // - The saving of recovery information triggers this method, but for a newly created
+ // document the new embedded stream name shall not be applied.
+ // - The saving of a newly created document to own format (ODF) triggers this method,
+ // but the embedded stream name is not needed as its original inserted data is still in use.
+ if ( pGrfNd->HasEmbeddedStreamName() )
+ {
+ String aNewURL( RTL_CONSTASCII_STRINGPARAM( "vnd.sun.star.Package:" ) );
+ aNewURL += String( rURL );
+ pGrfNd->ApplyNewEmbeddedStreamName( aNewURL );
+ }
// #i15411# save-as will swap all graphics in; we need to swap
// them out again, to prevent excessive memory use
pGrfNd->SwapOut();
- }
+ }
}
-/*
-static void lcl_addParam ( SvXMLExport &rExport, const SvCommand &rCommand )
-{
- rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, rCommand.GetCommand() );
- rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, rCommand.GetArgument() );
- SvXMLElementExport aElem( rExport, XML_NAMESPACE_DRAW, XML_PARAM, sal_False, sal_True );
-}*/
+
static void lcl_addURL ( SvXMLExport &rExport, const String &rURL,
sal_Bool bToRel = sal_True )