convert include/editeng/brushitem.hxx from String to OUString

and convert String* to OUString, no need to hold a pointer
to a ref-counted value type.

Change-Id: I79c62979ee8ec0d5e6d2efc50609ad5595571a7d
This commit is contained in:
Noel Grandin 2013-09-09 15:19:26 +02:00
parent b044a9535e
commit cfb4463d2a
15 changed files with 149 additions and 194 deletions

View File

@ -829,13 +829,13 @@ sal_Bool SvxBackgroundTabPage::FillItemSet( SfxItemSet& rCoreSet )
if ( !bIsLink && !bIsGraphicValid )
bIsGraphicValid = LoadLinkedGraphic_Impl();
if ( bGraphTransparencyChanged ||
eNewPos != eOldPos
if ( bGraphTransparencyChanged ||
eNewPos != eOldPos
|| bIsLink != bWasLink
|| ( bWasLink && *rOldItem.GetGraphicLink()
!= aBgdGraphicPath )
|| ( !bWasLink && rOldItem.GetGraphic()->GetBitmap()
!= aBgdGraphic.GetBitmap() )
|| ( bWasLink && rOldItem.GetGraphicLink()
!= aBgdGraphicPath )
|| ( !bWasLink && rOldItem.GetGraphic()->GetBitmap()
!= aBgdGraphic.GetBitmap() )
)
{
bModified = sal_True;
@ -1035,7 +1035,7 @@ sal_Bool SvxBackgroundTabPage::FillItemSetWithWallpaperItem( SfxItemSet& rCoreSe
SvxGraphicPosition eNewPos = GetGraphicPosition_Impl();
int bBitmapChanged = ( ( eNewPos != eOldPos ) ||
( *rOldItem.GetGraphicLink() != aBgdGraphicPath ) );
( rOldItem.GetGraphicLink() != aBgdGraphicPath ) );
int bBrushChanged = ( rOldItem.GetColor() != aBgdColor );
if( bBitmapChanged || bBrushChanged )
{
@ -1846,19 +1846,19 @@ void SvxBackgroundTabPage::FillControls_Impl( const SvxBrushItem& rBgdAttr,
}
else
{
const String* pStrLink = rBgdAttr.GetGraphicLink();
const String* pStrFilter = rBgdAttr.GetGraphicFilter();
const OUString aStrLink = rBgdAttr.GetGraphicLink();
const OUString aStrFilter = rBgdAttr.GetGraphicFilter();
lcl_setFillStyle(m_pLbSelect, XFILL_BITMAP);
ShowBitmapUI_Impl();
if ( pStrLink )
if ( !aStrLink.isEmpty() )
{
#ifdef DBG_UTIL
INetURLObject aObj( *pStrLink );
INetURLObject aObj( aStrLink );
DBG_ASSERT( aObj.GetProtocol() != INET_PROT_NOT_VALID, "Invalid URL!" );
#endif
aBgdGraphicPath = *pStrLink;
aBgdGraphicPath = aStrLink;
m_pBtnLink->Check( sal_True );
m_pBtnLink->Enable();
}
@ -1881,12 +1881,9 @@ void SvxBackgroundTabPage::FillControls_Impl( const SvxBrushItem& rBgdAttr,
FileClickHdl_Impl(m_pBtnLink);
if ( pStrFilter )
aBgdGraphicFilter = *pStrFilter;
else
aBgdGraphicFilter.Erase();
aBgdGraphicFilter = aStrFilter;
if ( !pStrLink || m_pBtnPreview->IsChecked() )
if ( aStrLink.isEmpty() || m_pBtnPreview->IsChecked() )
{
// Graphic exists in the item and doesn't have
// to be loaded:

View File

@ -222,8 +222,8 @@ void SvxGrfCropPage::Reset( const SfxItemSet &rSet )
aExampleWN.SetFrameSize( aOrigSize );
bFound = sal_True;
if( ((SvxBrushItem*)pItem)->GetGraphicLink() )
aGraphicName = *((SvxBrushItem*)pItem)->GetGraphicLink();
if( !((SvxBrushItem*)pItem)->GetGraphicLink().isEmpty() )
aGraphicName = ((SvxBrushItem*)pItem)->GetGraphicLink();
}
}
@ -349,9 +349,9 @@ void SvxGrfCropPage::ActivatePage(const SfxItemSet& rSet)
if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_GRAF_GRAPHIC, sal_False, &pItem ) )
{
const SvxBrushItem& rBrush = *(SvxBrushItem*)pItem;
if( rBrush.GetGraphicLink() &&
aGraphicName != *rBrush.GetGraphicLink() )
aGraphicName = *rBrush.GetGraphicLink();
if( !rBrush.GetGraphicLink().isEmpty() &&
aGraphicName != rBrush.GetGraphicLink() )
aGraphicName = rBrush.GetGraphicLink();
const Graphic* pGrf = rBrush.GetGraphic();
if( pGrf )

View File

@ -3340,8 +3340,8 @@ SvxBrushItem::SvxBrushItem( sal_uInt16 _nWhich ) :
aColor ( COL_TRANSPARENT ),
nShadingValue ( ShadingPattern::CLEAR ),
pImpl ( new SvxBrushItem_Impl( 0 ) ),
pStrLink ( NULL ),
pStrFilter ( NULL ),
maStrLink (),
maStrFilter (),
eGraphicPos ( GPOS_NONE ),
bLoadAgain ( sal_True )
@ -3357,8 +3357,8 @@ SvxBrushItem::SvxBrushItem( const Color& rColor, sal_uInt16 _nWhich) :
aColor ( rColor ),
nShadingValue ( ShadingPattern::CLEAR ),
pImpl ( new SvxBrushItem_Impl( 0 ) ),
pStrLink ( NULL ),
pStrFilter ( NULL ),
maStrLink (),
maStrFilter (),
eGraphicPos ( GPOS_NONE ),
bLoadAgain ( sal_True )
@ -3375,8 +3375,8 @@ SvxBrushItem::SvxBrushItem( const Graphic& rGraphic, SvxGraphicPosition ePos,
aColor ( COL_TRANSPARENT ),
nShadingValue ( ShadingPattern::CLEAR ),
pImpl ( new SvxBrushItem_Impl( new GraphicObject( rGraphic ) ) ),
pStrLink ( NULL ),
pStrFilter ( NULL ),
maStrLink (),
maStrFilter (),
eGraphicPos ( ( GPOS_NONE != ePos ) ? ePos : GPOS_MM ),
bLoadAgain ( sal_True )
@ -3394,8 +3394,8 @@ SvxBrushItem::SvxBrushItem( const GraphicObject& rGraphicObj,
aColor ( COL_TRANSPARENT ),
nShadingValue ( ShadingPattern::CLEAR ),
pImpl ( new SvxBrushItem_Impl( new GraphicObject( rGraphicObj ) ) ),
pStrLink ( NULL ),
pStrFilter ( NULL ),
maStrLink (),
maStrFilter (),
eGraphicPos ( ( GPOS_NONE != ePos ) ? ePos : GPOS_MM ),
bLoadAgain ( sal_True )
@ -3406,7 +3406,7 @@ SvxBrushItem::SvxBrushItem( const GraphicObject& rGraphicObj,
// -----------------------------------------------------------------------
SvxBrushItem::SvxBrushItem(
const String& rLink, const String& rFilter,
const OUString& rLink, const OUString& rFilter,
SvxGraphicPosition ePos, sal_uInt16 _nWhich ) :
SfxPoolItem( _nWhich ),
@ -3414,8 +3414,8 @@ SvxBrushItem::SvxBrushItem(
aColor ( COL_TRANSPARENT ),
nShadingValue ( ShadingPattern::CLEAR ),
pImpl ( new SvxBrushItem_Impl( NULL ) ),
pStrLink ( new String( rLink ) ),
pStrFilter ( new String( rFilter ) ),
maStrLink ( rLink ),
maStrFilter ( rFilter ),
eGraphicPos ( ( GPOS_NONE != ePos ) ? ePos : GPOS_MM ),
bLoadAgain ( sal_True )
@ -3433,8 +3433,8 @@ SvxBrushItem::SvxBrushItem( SvStream& rStream, sal_uInt16 nVersion,
aColor ( COL_TRANSPARENT ),
nShadingValue ( ShadingPattern::CLEAR ),
pImpl ( new SvxBrushItem_Impl( NULL ) ),
pStrLink ( NULL ),
pStrFilter ( NULL ),
maStrLink (),
maStrFilter (),
eGraphicPos ( GPOS_NONE )
{
@ -3525,14 +3525,13 @@ SvxBrushItem::SvxBrushItem( SvStream& rStream, sal_uInt16 nVersion,
OSL_FAIL("No BaseURL!");
String aAbs = INetURLObject::GetAbsURL( String(), aRel );
DBG_ASSERT( aAbs.Len(), "Invalid URL!" );
pStrLink = new String( aAbs );
maStrLink = aAbs;
}
if ( nDoLoad & LOAD_FILTER )
{
pStrFilter = new String;
// UNICODE: rStream >> *pStrFilter;
*pStrFilter = rStream.ReadUniOrByteString(rStream.GetStreamCharSet());
// UNICODE: rStream >> maStrFilter;
maStrFilter = rStream.ReadUniOrByteString(rStream.GetStreamCharSet());
}
rStream >> nPos;
@ -3548,8 +3547,8 @@ SvxBrushItem::SvxBrushItem( const SvxBrushItem& rItem ) :
SfxPoolItem( rItem.Which() ),
nShadingValue ( ShadingPattern::CLEAR ),
pImpl ( new SvxBrushItem_Impl( NULL ) ),
pStrLink ( NULL ),
pStrFilter ( NULL ),
maStrLink (),
maStrFilter (),
eGraphicPos ( GPOS_NONE ),
bLoadAgain ( sal_True )
@ -3563,8 +3562,6 @@ SvxBrushItem::~SvxBrushItem()
{
delete pImpl->pGraphicObject;
delete pImpl;
delete pStrLink;
delete pStrFilter;
}
// -----------------------------------------------------------------------
@ -3614,8 +3611,8 @@ bool SvxBrushItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
case MID_GRAPHIC_URL:
{
OUString sLink;
if ( pStrLink )
sLink = *pStrLink;
if ( !maStrLink.isEmpty() )
sLink = maStrLink;
else if( pImpl->pGraphicObject )
{
OUString sPrefix(
@ -3631,10 +3628,7 @@ bool SvxBrushItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
case MID_GRAPHIC_FILTER:
{
OUString sFilter;
if ( pStrFilter )
sFilter = *pStrFilter;
rVal <<= sFilter;
rVal <<= maStrFilter;
}
break;
@ -3716,7 +3710,7 @@ bool SvxBrushItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
}
else if( sLink.startsWith( UNO_NAME_GRAPHOBJ_URLPREFIX ) )
{
DELETEZ( pStrLink );
maStrLink = "";
String sTmp( sLink );
OString sId(OUStringToOString(sTmp.Copy(
sizeof(UNO_NAME_GRAPHOBJ_URLPREFIX)-1),
@ -3824,15 +3818,13 @@ SvxBrushItem& SvxBrushItem::operator=( const SvxBrushItem& rItem )
eGraphicPos = rItem.eGraphicPos;
DELETEZ( pImpl->pGraphicObject );
DELETEZ( pStrLink );
DELETEZ( pStrFilter );
maStrLink = "";
maStrFilter = "";
if ( GPOS_NONE != eGraphicPos )
{
if ( rItem.pStrLink )
pStrLink = new String( *rItem.pStrLink );
if ( rItem.pStrFilter )
pStrFilter = new String( *rItem.pStrFilter );
maStrLink = rItem.maStrLink;
maStrFilter = rItem.maStrFilter;
if ( rItem.pImpl->pGraphicObject )
{
pImpl->pGraphicObject = new GraphicObject( *rItem.pImpl->pGraphicObject );
@ -3859,20 +3851,14 @@ int SvxBrushItem::operator==( const SfxPoolItem& rAttr ) const
{
if ( GPOS_NONE != eGraphicPos )
{
if ( !rCmp.pStrLink )
bEqual = !pStrLink;
else
bEqual = pStrLink && ( *pStrLink == *rCmp.pStrLink );
bEqual = maStrLink == rCmp.maStrLink;
if ( bEqual )
{
if ( !rCmp.pStrFilter )
bEqual = !pStrFilter;
else
bEqual = pStrFilter && ( *pStrFilter == *rCmp.pStrFilter );
bEqual = maStrFilter == rCmp.maStrFilter;
}
if ( bEqual && !rCmp.pStrLink )
if ( bEqual )
{
if ( !rCmp.pImpl->pGraphicObject )
bEqual = !pImpl->pGraphicObject;
@ -3916,28 +3902,28 @@ SvStream& SvxBrushItem::Store( SvStream& rStream , sal_uInt16 /*nItemVersion*/ )
sal_uInt16 nDoLoad = 0;
if ( pImpl->pGraphicObject && !pStrLink )
if ( pImpl->pGraphicObject && maStrLink.isEmpty() )
nDoLoad |= LOAD_GRAPHIC;
if ( pStrLink )
if ( !maStrLink.isEmpty() )
nDoLoad |= LOAD_LINK;
if ( pStrFilter )
if ( !maStrFilter.isEmpty() )
nDoLoad |= LOAD_FILTER;
rStream << nDoLoad;
if ( pImpl->pGraphicObject && !pStrLink )
if ( pImpl->pGraphicObject && maStrLink.isEmpty() )
rStream << pImpl->pGraphicObject->GetGraphic();
if ( pStrLink )
if ( !maStrLink.isEmpty() )
{
OSL_FAIL("No BaseURL!");
// TODO/MBA: how to get a BaseURL?!
String aRel = INetURLObject::GetRelURL( String(), *pStrLink );
String aRel = INetURLObject::GetRelURL( String(), maStrLink );
// UNICODE: rStream << aRel;
rStream.WriteUniOrByteString(aRel, rStream.GetStreamCharSet());
}
if ( pStrFilter )
if ( !maStrFilter.isEmpty() )
{
// UNICODE: rStream << *pStrFilter;
rStream.WriteUniOrByteString(*pStrFilter, rStream.GetStreamCharSet());
// UNICODE: rStream << maStrFilter;
rStream.WriteUniOrByteString(maStrFilter, rStream.GetStreamCharSet());
}
rStream << (sal_Int8)eGraphicPos;
return rStream;
@ -3953,37 +3939,33 @@ void SvxBrushItem::PurgeMedium() const
// -----------------------------------------------------------------------
const GraphicObject* SvxBrushItem::GetGraphicObject() const
{
if ( bLoadAgain && pStrLink && !pImpl->pGraphicObject )
if ( bLoadAgain && !maStrLink.isEmpty() && !pImpl->pGraphicObject )
// when graphics already loaded, use as a cache
{
// only with "valid" names - empty names now allowed
if( pStrLink->Len() )
pImpl->pStream = utl::UcbStreamHelper::CreateStream( maStrLink, STREAM_STD_READ );
if( pImpl->pStream && !pImpl->pStream->GetError() )
{
pImpl->pStream = utl::UcbStreamHelper::CreateStream( *pStrLink, STREAM_STD_READ );
if( pImpl->pStream && !pImpl->pStream->GetError() )
{
Graphic aGraphic;
int nRes;
pImpl->pStream->Seek( STREAM_SEEK_TO_BEGIN );
nRes = GraphicFilter::GetGraphicFilter().
ImportGraphic( aGraphic, *pStrLink, *pImpl->pStream,
GRFILTER_FORMAT_DONTKNOW, NULL, GRFILTER_I_FLAGS_DONT_SET_LOGSIZE_FOR_JPEG );
Graphic aGraphic;
int nRes;
pImpl->pStream->Seek( STREAM_SEEK_TO_BEGIN );
nRes = GraphicFilter::GetGraphicFilter().
ImportGraphic( aGraphic, maStrLink, *pImpl->pStream,
GRFILTER_FORMAT_DONTKNOW, NULL, GRFILTER_I_FLAGS_DONT_SET_LOGSIZE_FOR_JPEG );
if( nRes != GRFILTER_OK )
{
const_cast < SvxBrushItem*> (this)->bLoadAgain = sal_False;
}
else
{
pImpl->pGraphicObject = new GraphicObject;
pImpl->pGraphicObject->SetGraphic( aGraphic );
const_cast < SvxBrushItem*> (this)->ApplyGraphicTransparency_Impl();
}
}
else
if( nRes != GRFILTER_OK )
{
const_cast < SvxBrushItem*> (this)->bLoadAgain = sal_False;
}
else
{
pImpl->pGraphicObject = new GraphicObject;
pImpl->pGraphicObject->SetGraphic( aGraphic );
const_cast < SvxBrushItem*> (this)->ApplyGraphicTransparency_Impl();
}
}
else
{
const_cast < SvxBrushItem*> (this)->bLoadAgain = sal_False;
}
}
@ -4007,12 +3989,12 @@ void SvxBrushItem::SetGraphicPos( SvxGraphicPosition eNew )
if ( GPOS_NONE == eGraphicPos )
{
DELETEZ( pImpl->pGraphicObject );
DELETEZ( pStrLink );
DELETEZ( pStrFilter );
maStrLink = "";
maStrFilter = "";
}
else
{
if ( !pImpl->pGraphicObject && !pStrLink )
if ( !pImpl->pGraphicObject && maStrLink.isEmpty() )
{
pImpl->pGraphicObject = new GraphicObject; // Creating a dummy
}
@ -4023,7 +4005,7 @@ void SvxBrushItem::SetGraphicPos( SvxGraphicPosition eNew )
void SvxBrushItem::SetGraphic( const Graphic& rNew )
{
if ( !pStrLink )
if ( maStrLink.isEmpty() )
{
if ( pImpl->pGraphicObject )
pImpl->pGraphicObject->SetGraphic( rNew );
@ -4045,7 +4027,7 @@ void SvxBrushItem::SetGraphic( const Graphic& rNew )
void SvxBrushItem::SetGraphicObject( const GraphicObject& rNewObj )
{
if ( !pStrLink )
if ( maStrLink.isEmpty() )
{
if ( pImpl->pGraphicObject )
*pImpl->pGraphicObject = rNewObj;
@ -4065,34 +4047,22 @@ void SvxBrushItem::SetGraphicObject( const GraphicObject& rNewObj )
// -----------------------------------------------------------------------
void SvxBrushItem::SetGraphicLink( const String& rNew )
void SvxBrushItem::SetGraphicLink( const OUString& rNew )
{
if ( !rNew.Len() )
DELETEZ( pStrLink );
if ( rNew.isEmpty() )
maStrLink = "";
else
{
if ( pStrLink )
*pStrLink = rNew;
else
pStrLink = new String( rNew );
maStrLink = rNew;
DELETEZ( pImpl->pGraphicObject );
}
}
// -----------------------------------------------------------------------
void SvxBrushItem::SetGraphicFilter( const String& rNew )
void SvxBrushItem::SetGraphicFilter( const OUString& rNew )
{
if ( !rNew.Len() )
DELETEZ( pStrFilter );
else
{
if ( pStrFilter )
*pStrFilter = rNew;
else
pStrFilter = new String( rNew );
}
maStrFilter = rNew;
}
void SvxBrushItem::SetShadingValue( const sal_uInt32 nNew )
@ -4151,15 +4121,15 @@ SvxBrushItem::SvxBrushItem( const CntWallpaperItem& rItem, sal_uInt16 _nWhich )
SfxPoolItem ( _nWhich ),
nShadingValue ( ShadingPattern::CLEAR ),
pImpl ( new SvxBrushItem_Impl( 0 ) ),
pStrLink ( 0),
pStrFilter ( 0),
maStrLink (),
maStrFilter (),
bLoadAgain ( sal_True )
{
aColor = rItem.GetColor();
if (!rItem.GetBitmapURL().isEmpty())
{
pStrLink = new String( rItem.GetBitmapURL() );
maStrLink = rItem.GetBitmapURL();
SetGraphicPos( WallpaperStyle2GraphicPos((WallpaperStyle)rItem.GetStyle() ) );
}
}

View File

@ -269,7 +269,7 @@ SvStream& SvxNumberFormat::Store(SvStream &rStream, FontToSubsFontConverter pC
// in SD or SI force bullet itself to be stored,
// for that purpose throw away link when link and graphic
// are present, so Brush save is forced
if(pGraphicBrush->GetGraphicLink() && pGraphicBrush->GetGraphic())
if(!pGraphicBrush->GetGraphicLink().isEmpty() && pGraphicBrush->GetGraphic())
{
String aEmpty;
pGraphicBrush->SetGraphicLink(aEmpty);
@ -421,10 +421,7 @@ void SvxNumberFormat::SetGraphicBrush( const SvxBrushItem* pBrushItem,
void SvxNumberFormat::SetGraphic( const OUString& rName )
{
const String* pName;
if( pGraphicBrush &&
0 != (pName = pGraphicBrush->GetGraphicLink())
&& *pName == rName )
if( pGraphicBrush && pGraphicBrush->GetGraphicLink() == rName )
return ;
delete pGraphicBrush;
@ -915,17 +912,15 @@ sal_Bool SvxNumRule::UnLinkGraphics()
{
SvxNumberFormat aFmt(GetLevel(i));
const SvxBrushItem* pBrush = aFmt.GetBrush();
const String* pLinkStr;
const Graphic* pGraphic;
if(SVX_NUM_BITMAP == aFmt.GetNumberingType())
{
if(pBrush &&
0 != (pLinkStr = pBrush->GetGraphicLink()) &&
pLinkStr->Len() &&
0 !=(pGraphic = pBrush->GetGraphic()))
!pBrush->GetGraphicLink().isEmpty() &&
0 != (pGraphic = pBrush->GetGraphic()))
{
SvxBrushItem aTempItem(*pBrush);
aTempItem.SetGraphicLink( String());
aTempItem.SetGraphicLink("");
aTempItem.SetGraphic(*pGraphic);
sal_Int16 eOrient = aFmt.GetVertOrient();
aFmt.SetGraphicBrush( &aTempItem, &aFmt.GetGraphicSize(), &eOrient );

View File

@ -29,7 +29,6 @@
class Graphic;
class GraphicObject;
class CntWallpaperItem;
class String;
#define BRUSH_GRAPHIC_VERSION ((sal_uInt16)0x0001)
@ -51,10 +50,10 @@ class EDITENG_DLLPUBLIC SvxBrushItem : public SfxPoolItem
Color aColor;
sal_Int32 nShadingValue;
SvxBrushItem_Impl* pImpl;
String* pStrLink;
String* pStrFilter;
OUString maStrLink;
OUString maStrFilter;
SvxGraphicPosition eGraphicPos;
sal_Bool bLoadAgain;
sal_Bool bLoadAgain;
void ApplyGraphicTransparency_Impl();
DECL_STATIC_LINK( SvxBrushItem, DoneHdl_Impl, void *);
@ -72,7 +71,7 @@ public:
SvxGraphicPosition ePos, sal_uInt16 nWhich );
SvxBrushItem( const GraphicObject& rGraphicObj,
SvxGraphicPosition ePos, sal_uInt16 nWhich );
SvxBrushItem( const String& rLink, const String& rFilter,
SvxBrushItem( const OUString& rLink, const OUString& rFilter,
SvxGraphicPosition ePos, sal_uInt16 nWhich );
SvxBrushItem( const SvxBrushItem& );
SvxBrushItem( const CntWallpaperItem&, sal_uInt16 nWhich );
@ -108,15 +107,15 @@ public:
sal_uInt32 GetShadingValue() const { return nShadingValue; }
const Graphic* GetGraphic() const;
const GraphicObject* GetGraphicObject() const;
const String* GetGraphicLink() const { return pStrLink; }
const String* GetGraphicFilter() const { return pStrFilter; }
OUString GetGraphicLink() const { return maStrLink; }
OUString GetGraphicFilter() const { return maStrFilter; }
void SetShadingValue( const sal_uInt32 nNew );
void SetGraphicPos( SvxGraphicPosition eNew );
void SetGraphic( const Graphic& rNew );
void SetGraphicObject( const GraphicObject& rNewObj );
void SetGraphicLink( const String& rNew );
void SetGraphicFilter( const String& rNew );
void SetGraphicLink( const OUString& rNew );
void SetGraphicFilter( const OUString& rNew );
SvxBrushItem& operator=( const SvxBrushItem& rItem);

View File

@ -566,11 +566,11 @@ void ScHTMLExport::WriteBody()
if ( bAll && GPOS_NONE != pBrushItem->GetGraphicPos() )
{
const String* pLink = pBrushItem->GetGraphicLink();
OUString aLink = pBrushItem->GetGraphicLink();
String aGrfNm;
// Embedded graphic -> write using WriteGraphic
if( !pLink )
if( aLink.isEmpty() )
{
const Graphic* pGrf = pBrushItem->GetGraphic();
if( pGrf )
@ -588,13 +588,13 @@ void ScHTMLExport::WriteBody()
aGrfNm, URIHelper::GetMaybeFileHdl(), true, false);
if ( HasCId() )
MakeCIdURL( aGrfNm );
pLink = &aGrfNm;
aLink = aGrfNm;
}
}
}
else
{
aGrfNm = *pLink;
aGrfNm = aLink;
if( bCopyLocalFileToINet || HasCId() )
{
CopyLocalFileToINet( aGrfNm, aStreamPath );
@ -605,14 +605,14 @@ void ScHTMLExport::WriteBody()
aGrfNm = URIHelper::SmartRel2Abs(
INetURLObject(aBaseURL),
aGrfNm, URIHelper::GetMaybeFileHdl(), true, false);
pLink = &aGrfNm;
aLink = aGrfNm;
}
if( pLink )
if( !aLink.isEmpty() )
{
rStrm << ' ' << OOO_STRING_SVTOOLS_HTML_O_background << "=\"";
OUT_STR( URIHelper::simpleNormalizedMakeRelative(
aBaseURL,
*pLink ) ) << '\"';
aLink ) ) << '\"';
}
}
if ( !aHTMLStyle.aBackgroundColor.GetTransparency() )

View File

@ -682,11 +682,11 @@ sal_Bool GraphyicBulletsTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIn
if ( pGrf )
{
const String* pGrfName = pBrsh->GetGraphicLink();
const OUString aGrfName = pBrsh->GetGraphicLink();
//String* pGrfName = (String*)(pBrsh->GetGraphicLink());
GrfBulDataRelation* pEntry = aGrfDataLst[nIndex];
if ( pGrfName )
pEntry->sGrfName = *pGrfName;
if ( !aGrfName.isEmpty() )
pEntry->sGrfName = aGrfName;
//pEntry->sDescription = sEmpty;
pEntry->nGallaryIndex = (sal_uInt16)0xFFFF;
pEntry->bIsCustomized = sal_True;
@ -1073,10 +1073,10 @@ sal_Bool MixBulletsTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,s
OUString sEmpty;
if ( pGrf )
{
const String* pGrfName = pBrsh->GetGraphicLink();
const OUString aGrfName = pBrsh->GetGraphicLink();
GrfBulDataRelation* pEntry = (GrfBulDataRelation*) (pActualBullets[nIndex]->pBullets);
if ( pGrfName )
pEntry->sGrfName = *pGrfName;
if ( !aGrfName.isEmpty() )
pEntry->sGrfName = aGrfName;
GraphyicBulletsTypeMgr& rGrfTMgr = GraphyicBulletsTypeMgr::GetInstance();
{
pActualBullets[nIndex]->nIndexDefault = (sal_uInt16)0xFFFF;
@ -1125,16 +1125,16 @@ sal_Bool MixBulletsTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,s
else
return sal_False;
const String* pGrfName = 0;
OUString aGrfName;
if ( pGrf )
{
pGrfName = pBrsh->GetGraphicLink();
aGrfName = pBrsh->GetGraphicLink();
pActualBullets[nIndex]->eType = eNBType::GRAPHICBULLETS;
pActualBullets[nIndex]->nIndex = nIndex+1; //index in the tab page display,decrease 1 to the index within arr
pActualBullets[nIndex]->pBullets = new GrfBulDataRelation(eNBType::GRAPHICBULLETS) ;
if (pGrfName)
((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->sGrfName = *pGrfName;
if (!aGrfName.isEmpty())
((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->sGrfName = aGrfName;
((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->bIsCustomized = sal_True;
((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->eType = eNBType::GRAPHICBULLETS;
GraphyicBulletsTypeMgr& rGrfTMgr = GraphyicBulletsTypeMgr::GetInstance();

View File

@ -907,14 +907,14 @@ void SwHTMLParser::InsertBodyOptions()
if( bBGColor && !pCSS1Parser->IsBodyBGColorSet() )
{
// Hintergrundfarbe aus "BGCOLOR"
String aLink;
if( aBrushItem.GetGraphicLink() )
aLink = *aBrushItem.GetGraphicLink();
OUString aLink;
if( !aBrushItem.GetGraphicLink().isEmpty() )
aLink = aBrushItem.GetGraphicLink();
SvxGraphicPosition ePos = aBrushItem.GetGraphicPos();
aBrushItem.SetColor( aBGColor );
if( aLink.Len() )
if( !aLink.isEmpty() )
{
aBrushItem.SetGraphicLink( aLink );
aBrushItem.SetGraphicPos( ePos );

View File

@ -146,7 +146,7 @@ sal_Bool SwHTMLWrtTable::HasTabBackground( const SwTableBox& rBox,
/// The table box has a background, if its background color is not "no fill"/
/// "auto fill" or it has a background graphic.
bRet = rBrushItem.GetColor() != COL_TRANSPARENT ||
rBrushItem.GetGraphicLink() || rBrushItem.GetGraphic();
!rBrushItem.GetGraphicLink().isEmpty() || rBrushItem.GetGraphic();
}
else
{
@ -175,7 +175,7 @@ sal_Bool SwHTMLWrtTable::HasTabBackground( const SwTableLine& rLine,
/// The table line has a background, if its background color is not "no fill"/
/// "auto fill" or it has a background graphic.
sal_Bool bRet = rBrushItem.GetColor() != COL_TRANSPARENT ||
rBrushItem.GetGraphicLink() || rBrushItem.GetGraphic();
!rBrushItem.GetGraphicLink().isEmpty() || rBrushItem.GetGraphic();
if( !bRet )
{

View File

@ -119,7 +119,7 @@ SvXMLImportContext *SwXMLBrushItemImportContext::CreateChildContext(
if( xmloff::token::IsXMLToken( rLocalName,
xmloff::token::XML_BINARY_DATA ) )
{
if( !xBase64Stream.is() && !pItem->GetGraphicLink() )
if( !xBase64Stream.is() && pItem->GetGraphicLink().isEmpty() )
{
const GraphicObject *pGrObj = pItem->GetGraphicObject();
if( !pGrObj || GRAPHIC_NONE == pGrObj->GetType() )
@ -150,7 +150,7 @@ void SwXMLBrushItemImportContext::EndElement()
SvXMLImportItemMapper::PutXMLValue( *pItem, sURL, MID_GRAPHIC_LINK, GetImport().GetMM100UnitConverter() );
}
if( !(pItem->GetGraphicLink() || pItem->GetGraphic() ) )
if( pItem->GetGraphicLink().isEmpty() && !(pItem->GetGraphic()) )
pItem->SetGraphicPos( GPOS_NONE );
else if( GPOS_NONE == pItem->GetGraphicPos() )
pItem->SetGraphicPos( GPOS_TILED );

View File

@ -987,9 +987,9 @@ bool SvXMLExportItemMapper::QueryXMLValue(
case MID_GRAPHIC_FILTER:
if( pBrush->GetGraphicPos() != GPOS_NONE &&
pBrush->GetGraphicFilter() )
!pBrush->GetGraphicFilter().isEmpty() )
{
aOut.append( *pBrush->GetGraphicFilter() );
aOut.append( pBrush->GetGraphicFilter() );
bOk = true;
}
break;

View File

@ -157,7 +157,7 @@ SwReadOnlyPopup::SwReadOnlyPopup( const Point &rDPos, SwView &rV ) :
if ( GPOS_NONE != pItem->GetGraphicPos() )
{
bEnableBack = sal_True;
if ( pItem->GetGraphicLink() )
if ( !pItem->GetGraphicLink().isEmpty() )
{
if ( aThemeList.empty() )
GalleryExplorer::FillThemeList( aThemeList );
@ -240,13 +240,13 @@ void SwReadOnlyPopup::Execute( Window* pWin, sal_uInt16 nId )
SfxDispatcher &rDis = *rView.GetViewFrame()->GetDispatcher();
if ( nId >= MN_READONLY_GRAPHICTOGALLERY )
{
String sTmp;
OUString sTmp;
sal_uInt16 nSaveId;
if ( nId >= MN_READONLY_BACKGROUNDTOGALLERY )
{
nId -= MN_READONLY_BACKGROUNDTOGALLERY+3;
nSaveId = MN_READONLY_SAVEBACKGROUND;
sTmp = *pItem->GetGraphicLink();
sTmp = pItem->GetGraphicLink();
}
else
{
@ -257,7 +257,7 @@ void SwReadOnlyPopup::Execute( Window* pWin, sal_uInt16 nId )
if ( !bGrfToGalleryAsLnk )
sTmp = SaveGraphic( nSaveId );
if ( sTmp.Len() )
if ( !sTmp.isEmpty() )
GalleryExplorer::InsertURL( aThemeList[nId], sTmp );
return;
@ -347,15 +347,15 @@ String SwReadOnlyPopup::SaveGraphic( sal_uInt16 nId )
// fish out the graphic's name
if ( MN_READONLY_SAVEBACKGROUND == nId )
{
if ( pItem->GetGraphicLink() )
sGrfName = *pItem->GetGraphicLink();
if ( !pItem->GetGraphicLink().isEmpty() )
sGrfName = pItem->GetGraphicLink();
((SvxBrushItem*)pItem)->SetDoneLink( Link() );
const Graphic *pGrf = pItem->GetGraphic();
if ( pGrf )
{
aGraphic = *pGrf;
if ( pItem->GetGraphicLink() )
sGrfName = *pItem->GetGraphicLink();
if ( !pItem->GetGraphicLink().isEmpty() )
sGrfName = pItem->GetGraphicLink();
}
else
return aEmptyStr;

View File

@ -2440,9 +2440,9 @@ void SwGrfExtPage::ActivatePage(const SfxItemSet& rSet)
if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_GRAF_GRAPHIC, sal_False, &pItem ) )
{
const SvxBrushItem& rBrush = *(SvxBrushItem*)pItem;
if( rBrush.GetGraphicLink() )
if( !rBrush.GetGraphicLink().isEmpty() )
{
aGrfName = aNewGrfName = *rBrush.GetGraphicLink();
aGrfName = aNewGrfName = rBrush.GetGraphicLink();
m_pConnectED->SetText( aNewGrfName );
}
const Graphic* pGrf = rBrush.GetGraphic();

View File

@ -373,15 +373,15 @@ void SwGrfShell::Execute(SfxRequest &rReq)
if( SFX_ITEM_SET == pSet->GetItemState(
SID_ATTR_GRAF_GRAPHIC, sal_True, &pItem ))
{
if( ((SvxBrushItem*)pItem)->GetGraphicLink() )
sGrfNm = *((SvxBrushItem*)pItem)->GetGraphicLink();
if( !((SvxBrushItem*)pItem)->GetGraphicLink().isEmpty() )
sGrfNm = ((SvxBrushItem*)pItem)->GetGraphicLink();
else
sGrfNm = OUString();
sGrfNm = "";
if( ((SvxBrushItem*)pItem)->GetGraphicFilter() )
sFilterNm = *((SvxBrushItem*)pItem)->GetGraphicFilter();
if( !((SvxBrushItem*)pItem)->GetGraphicFilter().isEmpty() )
sFilterNm = ((SvxBrushItem*)pItem)->GetGraphicFilter();
else
sFilterNm = OUString();
sFilterNm = "";
if( !sGrfNm.isEmpty() )
{

View File

@ -126,10 +126,7 @@ void SwTextShell::ExecEnterNum(SfxRequest &rReq)
if(SVX_NUM_BITMAP == aFmt.GetNumberingType())
{
const SvxBrushItem* pBrush = aFmt.GetBrush();
const String* pLinkStr;
if(pBrush &&
0 != (pLinkStr = pBrush->GetGraphicLink()) &&
pLinkStr->Len())
if(pBrush && !pBrush->GetGraphicLink().isEmpty())
aFmt.SetNumberingType(SvxExtNumType(SVX_NUM_BITMAP|LINK_TOKEN));
aRule.SetLevel(i, aFmt, aRule.Get(i) != 0);
}
@ -289,10 +286,7 @@ void SwTextShell::ExecSetNumber(SfxRequest &rReq)
if(SVX_NUM_BITMAP == aFmt.GetNumberingType())
{
const SvxBrushItem* pBrush = aFmt.GetBrush();
const String* pLinkStr;
if(pBrush &&
0 != (pLinkStr = pBrush->GetGraphicLink()) &&
pLinkStr->Len())
if( pBrush && !pBrush->GetGraphicLink().isEmpty() )
aFmt.SetNumberingType(SvxExtNumType(SVX_NUM_BITMAP|LINK_TOKEN));
aSvxRule.SetLevel(i, aFmt, aSvxRule.Get(i) != 0);
}